Skip to content

Commit e78ab45

Browse files
authored
Require client identity for registering operations (#615)
this adds client identity to the registration step!
2 parents 08a99bc + 8e05a9f commit e78ab45

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

packages/apollo/src/commands/queries/register.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,19 @@ export default class RegisterQueries extends Command {
3939
description:
4040
"Automatically remove @client and @connection directives and fields from operations"
4141
}),
42+
// XXX abstract for "clientFlags" and add to config
43+
clientIdentifier: flags.string({
44+
description:
45+
"Identifier for the client which will match ids from client traces, will use clientName if not provided"
46+
}),
47+
clientName: flags.string({
48+
required: true,
49+
description: "Name of the client that the queries will be attached to"
50+
}),
51+
clientVersion: flags.string({
52+
description:
53+
"The version of the client that the queries will be attached to"
54+
}),
4255
...engineFlags,
4356

4457
tagName: flags.string({
@@ -96,7 +109,11 @@ export default class RegisterQueries extends Command {
96109
}
97110

98111
const variables = {
99-
clientName: "TODO Client",
112+
clientIdentity: {
113+
clientName: flags.clientName,
114+
clientIdentifier: flags.clientIdentifier || flags.clientName,
115+
clientVersion: flags.clientVersion
116+
},
100117
serviceId: getIdFromKey(ctx.currentSchema.engineKey),
101118
operations: ctx.manifest.operations
102119
};

packages/apollo/src/operations/registerOperations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import gql from "graphql-tag";
33
export const REGISTER_OPERATIONS = gql`
44
mutation RegisterOperations(
55
$serviceId: ID!
6-
$clientName: String!
6+
$clientIdentity: RegisteredClientIdentityInput!
77
$operations: [RegisteredOperationInput!]!
88
) {
99
service(id: $serviceId) {

0 commit comments

Comments
 (0)