@theguild/federation-composition 0.11.1 → 0.11.2-alpha-20240612134640-775a9bf

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/cjs/subgraph/state.js +36 -5
  2. package/cjs/supergraph/composition/ast.js +5 -1
  3. package/cjs/supergraph/composition/directive.js +6 -2
  4. package/cjs/supergraph/composition/input-object-type.js +4 -2
  5. package/cjs/supergraph/composition/interface-type.js +6 -2
  6. package/cjs/supergraph/composition/object-type.js +7 -2
  7. package/esm/subgraph/state.js +35 -4
  8. package/esm/supergraph/composition/ast.js +5 -1
  9. package/esm/supergraph/composition/directive.js +6 -2
  10. package/esm/supergraph/composition/input-object-type.js +4 -2
  11. package/esm/supergraph/composition/interface-type.js +6 -2
  12. package/esm/supergraph/composition/object-type.js +7 -2
  13. package/package.json +1 -1
  14. package/typings/subgraph/state.d.cts +10 -0
  15. package/typings/subgraph/state.d.ts +10 -0
  16. package/typings/subgraph/validation/validation-context.d.cts +4 -0
  17. package/typings/subgraph/validation/validation-context.d.ts +4 -0
  18. package/typings/supergraph/composition/ast.d.cts +2 -0
  19. package/typings/supergraph/composition/ast.d.ts +2 -0
  20. package/typings/supergraph/composition/directive.d.cts +3 -1
  21. package/typings/supergraph/composition/directive.d.ts +3 -1
  22. package/typings/supergraph/composition/input-object-type.d.cts +2 -1
  23. package/typings/supergraph/composition/input-object-type.d.ts +2 -1
  24. package/typings/supergraph/composition/interface-type.d.cts +3 -1
  25. package/typings/supergraph/composition/interface-type.d.ts +3 -1
  26. package/typings/supergraph/composition/object-type.d.cts +3 -1
  27. package/typings/supergraph/composition/object-type.d.ts +3 -1
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cleanSubgraphStateFromLinkSpec = exports.cleanSubgraphStateFromFederationSpec = exports.createSubgraphStateBuilder = exports.TypeKind = void 0;
3
+ exports.cleanSubgraphStateFromLinkSpec = exports.cleanSubgraphStateFromFederationSpec = exports.createSubgraphStateBuilder = exports.ArgumentKind = exports.TypeKind = void 0;
4
4
  const graphql_1 = require("graphql");
5
5
  const printer_js_1 = require("../graphql/printer.js");
6
6
  const federation_js_1 = require("../specifications/federation.js");
@@ -15,6 +15,11 @@ var TypeKind;
15
15
  TypeKind["INPUT_OBJECT"] = "INPUT_OBJECT";
16
16
  TypeKind["DIRECTIVE"] = "DIRECTIVE";
17
17
  })(TypeKind || (exports.TypeKind = TypeKind = {}));
18
+ var ArgumentKind;
19
+ (function (ArgumentKind) {
20
+ ArgumentKind["SCALAR"] = "SCALAR";
21
+ ArgumentKind["ENUM"] = "ENUM";
22
+ })(ArgumentKind || (exports.ArgumentKind = ArgumentKind = {}));
18
23
  const MISSING = 'MISSING';
19
24
  function createSubgraphStateBuilder(graph, typeDefs, version, links) {
20
25
  const linksWithDirective = links.filter(link => !(0, federation_js_1.isFederationLink)(link) && link.imports.some(im => im.kind === 'directive'));
@@ -43,11 +48,13 @@ function createSubgraphStateBuilder(graph, typeDefs, version, links) {
43
48
  };
44
49
  const schemaDef = typeDefs.definitions.find(isSchemaDefinition);
45
50
  const leafTypeNames = new Set(specifiedScalars);
51
+ const enumTypeNames = new Set();
46
52
  for (const typeDef of typeDefs.definitions) {
47
- if (typeDef.kind === graphql_1.Kind.SCALAR_TYPE_DEFINITION ||
48
- typeDef.kind === graphql_1.Kind.SCALAR_TYPE_EXTENSION ||
49
- typeDef.kind === graphql_1.Kind.ENUM_TYPE_DEFINITION ||
50
- typeDef.kind === graphql_1.Kind.ENUM_TYPE_EXTENSION) {
53
+ if (typeDef.kind === graphql_1.Kind.ENUM_TYPE_DEFINITION || typeDef.kind === graphql_1.Kind.ENUM_TYPE_EXTENSION) {
54
+ enumTypeNames.add(typeDef.name.value);
55
+ leafTypeNames.add(typeDef.name.value);
56
+ }
57
+ else if (typeDef.kind === graphql_1.Kind.SCALAR_TYPE_DEFINITION || typeDef.kind === graphql_1.Kind.SCALAR_TYPE_EXTENSION) {
51
58
  leafTypeNames.add(typeDef.name.value);
52
59
  }
53
60
  }
@@ -159,6 +166,7 @@ function createSubgraphStateBuilder(graph, typeDefs, version, links) {
159
166
  const referencesEnumType = enumTypesByName.has(outputTypeName);
160
167
  if (isInputObjectType) {
161
168
  inputObjectTypeBuilder.field.setType(typeDef.name.value, node.name.value, (0, helpers_js_1.printOutputType)(node.type));
169
+ inputObjectTypeBuilder.field.setKind(typeDef.name.value, node.name.value, enumTypeNames.has(outputTypeName) ? ArgumentKind.ENUM : ArgumentKind.SCALAR);
162
170
  if (referencesEnumType) {
163
171
  enumTypeBuilder.setReferencedByInputType(outputTypeName, `${typeDef.name.value}.${node.name.value}`);
164
172
  }
@@ -168,6 +176,7 @@ function createSubgraphStateBuilder(graph, typeDefs, version, links) {
168
176
  }
169
177
  if (isObjectType && fieldDef) {
170
178
  objectTypeBuilder.field.arg.setType(typeDef.name.value, fieldDef.name.value, node.name.value, (0, helpers_js_1.printOutputType)(node.type));
179
+ objectTypeBuilder.field.arg.setKind(typeDef.name.value, fieldDef.name.value, node.name.value, enumTypeNames.has(outputTypeName) ? ArgumentKind.ENUM : ArgumentKind.SCALAR);
171
180
  if (node.defaultValue) {
172
181
  objectTypeBuilder.field.arg.setDefaultValue(typeDef.name.value, fieldDef.name.value, node.name.value, (0, printer_js_1.print)(node.defaultValue));
173
182
  }
@@ -177,6 +186,7 @@ function createSubgraphStateBuilder(graph, typeDefs, version, links) {
177
186
  }
178
187
  if (isInterfaceType && fieldDef) {
179
188
  interfaceTypeBuilder.field.arg.setType(typeDef.name.value, fieldDef.name.value, node.name.value, (0, helpers_js_1.printOutputType)(node.type));
189
+ interfaceTypeBuilder.field.arg.setKind(typeDef.name.value, fieldDef.name.value, node.name.value, enumTypeNames.has(outputTypeName) ? ArgumentKind.ENUM : ArgumentKind.SCALAR);
180
190
  if (node.defaultValue) {
181
191
  interfaceTypeBuilder.field.arg.setDefaultValue(typeDef.name.value, fieldDef.name.value, node.name.value, (0, printer_js_1.print)(node.defaultValue));
182
192
  }
@@ -422,6 +432,8 @@ function createSubgraphStateBuilder(graph, typeDefs, version, links) {
422
432
  if (node.arguments?.length) {
423
433
  for (const arg of node.arguments) {
424
434
  directiveBuilder.arg.setType(directiveName, arg.name.value, (0, helpers_js_1.printOutputType)(arg.type));
435
+ const outputTypeName = resolveTypeName(arg.type);
436
+ directiveBuilder.arg.setKind(directiveName, arg.name.value, enumTypeNames.has(outputTypeName) ? ArgumentKind.ENUM : ArgumentKind.SCALAR);
425
437
  if (typeof arg.defaultValue !== 'undefined') {
426
438
  directiveBuilder.arg.setDefaultValue(directiveName, arg.name.value, (0, printer_js_1.print)(arg.defaultValue));
427
439
  }
@@ -532,6 +544,9 @@ function directiveFactory(state) {
532
544
  setType(directiveName, argName, argType) {
533
545
  getOrCreateDirectiveArg(state, directiveName, argName).type = argType;
534
546
  },
547
+ setKind(directiveName, argName, argKind) {
548
+ getOrCreateDirectiveArg(state, directiveName, argName).kind = argKind;
549
+ },
535
550
  setDirective(typeName, argName, directive) {
536
551
  getOrCreateDirectiveArg(state, typeName, argName).ast.directives.push(directive);
537
552
  },
@@ -810,6 +825,12 @@ function objectTypeFactory(state, renameObject, interfaceTypeBuilder, isInterfac
810
825
  getOrCreateObjectFieldArgument(state, renameObject, typeName, fieldName, argName).type =
811
826
  argType;
812
827
  },
828
+ setKind(typeName, fieldName, argName, argKind) {
829
+ if (isInterfaceObject(typeName)) {
830
+ return interfaceTypeBuilder.field.arg.setKind(typeName, fieldName, argName, argKind);
831
+ }
832
+ getOrCreateObjectFieldArgument(state, renameObject, typeName, fieldName, argName).kind = argKind;
833
+ },
813
834
  setDescription(typeName, fieldName, argName, description) {
814
835
  if (isInterfaceObject(typeName)) {
815
836
  return interfaceTypeBuilder.field.arg.setDescription(typeName, fieldName, argName, description);
@@ -950,6 +971,9 @@ function interfaceTypeFactory(state) {
950
971
  setType(typeName, fieldName, argName, argType) {
951
972
  getOrCreateInterfaceFieldArgument(state, typeName, fieldName, argName).type = argType;
952
973
  },
974
+ setKind(typeName, fieldName, argName, argKind) {
975
+ getOrCreateInterfaceFieldArgument(state, typeName, fieldName, argName).kind = argKind;
976
+ },
953
977
  setDefaultValue(typeName, fieldName, argName, defaultValue) {
954
978
  getOrCreateInterfaceFieldArgument(state, typeName, fieldName, argName).defaultValue =
955
979
  defaultValue;
@@ -1006,6 +1030,9 @@ function inputObjectTypeFactory(state) {
1006
1030
  setType(typeName, fieldName, fieldType) {
1007
1031
  getOrCreateInputObjectField(state, typeName, fieldName).type = fieldType;
1008
1032
  },
1033
+ setKind(typeName, fieldName, fieldKind) {
1034
+ getOrCreateInputObjectField(state, typeName, fieldName).kind = fieldKind;
1035
+ },
1009
1036
  setDescription(typeName, fieldName, description) {
1010
1037
  getOrCreateInputObjectField(state, typeName, fieldName).description = description;
1011
1038
  },
@@ -1130,6 +1157,7 @@ function getOrCreateDirectiveArg(state, directiveName, argName) {
1130
1157
  const arg = {
1131
1158
  name: argName,
1132
1159
  type: MISSING,
1160
+ kind: ArgumentKind.SCALAR,
1133
1161
  inaccessible: false,
1134
1162
  tags: new Set(),
1135
1163
  ast: {
@@ -1368,6 +1396,7 @@ function getOrCreateInputObjectField(state, typeName, fieldName) {
1368
1396
  const field = {
1369
1397
  name: fieldName,
1370
1398
  type: MISSING,
1399
+ kind: ArgumentKind.SCALAR,
1371
1400
  inaccessible: false,
1372
1401
  tags: new Set(),
1373
1402
  ast: {
@@ -1400,6 +1429,7 @@ function getOrCreateObjectFieldArgument(state, renameObject, typeName, fieldName
1400
1429
  const arg = {
1401
1430
  name: argName,
1402
1431
  type: MISSING,
1432
+ kind: ArgumentKind.SCALAR,
1403
1433
  inaccessible: false,
1404
1434
  tags: new Set(),
1405
1435
  ast: {
@@ -1418,6 +1448,7 @@ function getOrCreateInterfaceFieldArgument(state, typeName, fieldName, argName)
1418
1448
  const arg = {
1419
1449
  name: argName,
1420
1450
  type: MISSING,
1451
+ kind: ArgumentKind.SCALAR,
1421
1452
  inaccessible: false,
1422
1453
  tags: new Set(),
1423
1454
  ast: {
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.stripFederation = exports.schemaCoordinate = exports.createJoinGraphEnumTypeNode = exports.createScalarTypeNode = exports.createEnumTypeNode = exports.createUnionTypeNode = exports.createInputObjectTypeNode = exports.createInterfaceTypeNode = exports.createObjectTypeNode = exports.createDirectiveNode = exports.createSchemaNode = void 0;
4
4
  const graphql_1 = require("graphql");
5
5
  const printer_js_1 = require("../../graphql/printer.js");
6
+ const state_js_1 = require("../../subgraph/state.js");
6
7
  function createSchemaNode(schema) {
7
8
  return {
8
9
  kind: graphql_1.Kind.SCHEMA_DEFINITION,
@@ -193,7 +194,10 @@ function createFieldArgumentNode(argument) {
193
194
  value: argument.name,
194
195
  },
195
196
  defaultValue: typeof argument.defaultValue === 'string'
196
- ? (0, graphql_1.parseConstValue)(argument.defaultValue)
197
+ ? argument.kind === state_js_1.ArgumentKind.ENUM ? {
198
+ kind: graphql_1.Kind.ENUM,
199
+ value: argument.defaultValue.startsWith(`"`) && argument.defaultValue.endsWith(`"`) ? argument.defaultValue.substring(1, argument.defaultValue.length - 1) : argument.defaultValue,
200
+ } : (0, graphql_1.parseConstValue)(argument.defaultValue)
197
201
  : undefined,
198
202
  type: (0, graphql_1.parseType)(argument.type),
199
203
  directives: applyDirectives(argument),
@@ -17,7 +17,7 @@ function directiveBuilder() {
17
17
  directiveState.repeatable = true;
18
18
  }
19
19
  for (const arg of directive.args.values()) {
20
- const argState = getOrCreateArg(directiveState, arg.name, arg.type);
20
+ const argState = getOrCreateArg(directiveState, arg.name, arg.type, arg.kind);
21
21
  arg.tags.forEach(tag => argState.tags.add(tag));
22
22
  if (arg.type.endsWith('!')) {
23
23
  argState.type = arg.type;
@@ -28,8 +28,10 @@ function directiveBuilder() {
28
28
  if (arg.inaccessible) {
29
29
  argState.inaccessible = true;
30
30
  }
31
+ argState.kind = arg.kind;
31
32
  argState.byGraph.set(graph.id, {
32
33
  type: arg.type,
34
+ kind: arg.kind,
33
35
  defaultValue: arg.defaultValue,
34
36
  version: graph.version,
35
37
  });
@@ -48,6 +50,7 @@ function directiveBuilder() {
48
50
  arguments: Array.from(directive.args.values()).map(arg => ({
49
51
  name: arg.name,
50
52
  type: arg.type,
53
+ kind: arg.kind,
51
54
  tags: Array.from(arg.tags),
52
55
  inaccessible: arg.inaccessible,
53
56
  defaultValue: arg.defaultValue,
@@ -76,7 +79,7 @@ function getOrCreateDirective(state, directiveName) {
76
79
  state.set(directiveName, def);
77
80
  return def;
78
81
  }
79
- function getOrCreateArg(directiveState, argName, argType) {
82
+ function getOrCreateArg(directiveState, argName, argType, argKind) {
80
83
  const existing = directiveState.args.get(argName);
81
84
  if (existing) {
82
85
  return existing;
@@ -84,6 +87,7 @@ function getOrCreateArg(directiveState, argName, argType) {
84
87
  const def = {
85
88
  name: argName,
86
89
  type: argType,
90
+ kind: argKind,
87
91
  inaccessible: false,
88
92
  tags: new Set(),
89
93
  byGraph: new Map(),
@@ -27,7 +27,7 @@ function inputObjectTypeBuilder() {
27
27
  version: graph.version,
28
28
  });
29
29
  for (const field of type.fields.values()) {
30
- const fieldState = getOrCreateField(inputObjectTypeState, field.name, field.type);
30
+ const fieldState = getOrCreateField(inputObjectTypeState, field.name, field.type, field.kind);
31
31
  field.tags.forEach(tag => fieldState.tags.add(tag));
32
32
  if (field.type.endsWith('!') && !fieldState.type.endsWith('!')) {
33
33
  fieldState.type = field.type;
@@ -44,6 +44,7 @@ function inputObjectTypeBuilder() {
44
44
  if (typeof field.defaultValue !== 'undefined') {
45
45
  fieldState.defaultValue = field.defaultValue;
46
46
  }
47
+ fieldState.kind = field.kind;
47
48
  field.ast.directives.forEach(directive => {
48
49
  fieldState.ast.directives.push(directive);
49
50
  });
@@ -125,7 +126,7 @@ function getOrCreateInputObjectType(state, typeName) {
125
126
  state.set(typeName, def);
126
127
  return def;
127
128
  }
128
- function getOrCreateField(objectTypeState, fieldName, fieldType) {
129
+ function getOrCreateField(objectTypeState, fieldName, fieldType, fieldKind) {
129
130
  const existing = objectTypeState.fields.get(fieldName);
130
131
  if (existing) {
131
132
  return existing;
@@ -133,6 +134,7 @@ function getOrCreateField(objectTypeState, fieldName, fieldType) {
133
134
  const def = {
134
135
  name: fieldName,
135
136
  type: fieldType,
137
+ kind: fieldKind,
136
138
  tags: new Set(),
137
139
  inaccessible: false,
138
140
  byGraph: new Map(),
@@ -90,7 +90,7 @@ function interfaceTypeBuilder() {
90
90
  usedAsKey,
91
91
  });
92
92
  for (const arg of field.args.values()) {
93
- const argState = getOrCreateArg(fieldState, arg.name, arg.type);
93
+ const argState = getOrCreateArg(fieldState, arg.name, arg.type, arg.kind);
94
94
  arg.tags.forEach(tag => argState.tags.add(tag));
95
95
  if (arg.type.endsWith('!')) {
96
96
  argState.type = arg.type;
@@ -107,8 +107,10 @@ function interfaceTypeBuilder() {
107
107
  arg.ast.directives.forEach(directive => {
108
108
  argState.ast.directives.push(directive);
109
109
  });
110
+ argState.kind = arg.kind;
110
111
  argState.byGraph.set(graph.id, {
111
112
  type: arg.type,
113
+ kind: arg.kind,
112
114
  defaultValue: arg.defaultValue,
113
115
  version: graph.version,
114
116
  });
@@ -164,6 +166,7 @@ function interfaceTypeBuilder() {
164
166
  return {
165
167
  name: arg.name,
166
168
  type: arg.type,
169
+ kind: arg.kind,
167
170
  tags: Array.from(arg.tags),
168
171
  defaultValue: arg.defaultValue,
169
172
  deprecated: arg.deprecated,
@@ -277,7 +280,7 @@ function getOrCreateInterfaceField(interfaceTypeState, fieldName, fieldType) {
277
280
  interfaceTypeState.fields.set(fieldName, def);
278
281
  return def;
279
282
  }
280
- function getOrCreateArg(fieldState, argName, argType) {
283
+ function getOrCreateArg(fieldState, argName, argType, argKind) {
281
284
  const existing = fieldState.args.get(argName);
282
285
  if (existing) {
283
286
  return existing;
@@ -285,6 +288,7 @@ function getOrCreateArg(fieldState, argName, argType) {
285
288
  const def = {
286
289
  name: argName,
287
290
  type: argType,
291
+ kind: argKind,
288
292
  tags: new Set(),
289
293
  byGraph: new Map(),
290
294
  ast: {
@@ -130,7 +130,7 @@ function objectTypeBuilder() {
130
130
  version: graph.version,
131
131
  });
132
132
  for (const arg of field.args.values()) {
133
- const argState = getOrCreateArg(fieldState, arg.name, arg.type);
133
+ const argState = getOrCreateArg(fieldState, arg.name, arg.type, arg.kind);
134
134
  arg.tags.forEach(tag => argState.tags.add(tag));
135
135
  if (arg.type.endsWith('!')) {
136
136
  argState.type = arg.type;
@@ -150,8 +150,10 @@ function objectTypeBuilder() {
150
150
  if (typeof arg.defaultValue !== 'undefined') {
151
151
  argState.defaultValue = arg.defaultValue;
152
152
  }
153
+ argState.kind = arg.kind;
153
154
  argState.byGraph.set(graph.id, {
154
155
  type: arg.type,
156
+ kind: arg.kind,
155
157
  inaccessible: arg.inaccessible,
156
158
  defaultValue: arg.defaultValue,
157
159
  version: graph.version,
@@ -437,6 +439,7 @@ function objectTypeBuilder() {
437
439
  return {
438
440
  name: arg.name,
439
441
  type: arg.type,
442
+ kind: arg.kind,
440
443
  inaccessible: arg.inaccessible,
441
444
  tags: Array.from(arg.tags),
442
445
  defaultValue: arg.defaultValue,
@@ -480,6 +483,7 @@ function objectTypeBuilder() {
480
483
  return {
481
484
  name: arg.name,
482
485
  type: arg.type,
486
+ kind: arg.kind,
483
487
  inaccessible: false,
484
488
  tags: Array.from(arg.tags),
485
489
  defaultValue: arg.defaultValue,
@@ -582,7 +586,7 @@ function getOrCreateField(objectTypeState, fieldName, fieldType) {
582
586
  objectTypeState.fields.set(fieldName, def);
583
587
  return def;
584
588
  }
585
- function getOrCreateArg(fieldState, argName, argType) {
589
+ function getOrCreateArg(fieldState, argName, argType, argKind) {
586
590
  const existing = fieldState.args.get(argName);
587
591
  if (existing) {
588
592
  return existing;
@@ -590,6 +594,7 @@ function getOrCreateArg(fieldState, argName, argType) {
590
594
  const def = {
591
595
  name: argName,
592
596
  type: argType,
597
+ kind: argKind,
593
598
  tags: new Set(),
594
599
  inaccessible: false,
595
600
  byGraph: new Map(),
@@ -12,6 +12,11 @@ export var TypeKind;
12
12
  TypeKind["INPUT_OBJECT"] = "INPUT_OBJECT";
13
13
  TypeKind["DIRECTIVE"] = "DIRECTIVE";
14
14
  })(TypeKind || (TypeKind = {}));
15
+ export var ArgumentKind;
16
+ (function (ArgumentKind) {
17
+ ArgumentKind["SCALAR"] = "SCALAR";
18
+ ArgumentKind["ENUM"] = "ENUM";
19
+ })(ArgumentKind || (ArgumentKind = {}));
15
20
  const MISSING = 'MISSING';
16
21
  export function createSubgraphStateBuilder(graph, typeDefs, version, links) {
17
22
  const linksWithDirective = links.filter(link => !isFederationLink(link) && link.imports.some(im => im.kind === 'directive'));
@@ -40,11 +45,13 @@ export function createSubgraphStateBuilder(graph, typeDefs, version, links) {
40
45
  };
41
46
  const schemaDef = typeDefs.definitions.find(isSchemaDefinition);
42
47
  const leafTypeNames = new Set(specifiedScalars);
48
+ const enumTypeNames = new Set();
43
49
  for (const typeDef of typeDefs.definitions) {
44
- if (typeDef.kind === Kind.SCALAR_TYPE_DEFINITION ||
45
- typeDef.kind === Kind.SCALAR_TYPE_EXTENSION ||
46
- typeDef.kind === Kind.ENUM_TYPE_DEFINITION ||
47
- typeDef.kind === Kind.ENUM_TYPE_EXTENSION) {
50
+ if (typeDef.kind === Kind.ENUM_TYPE_DEFINITION || typeDef.kind === Kind.ENUM_TYPE_EXTENSION) {
51
+ enumTypeNames.add(typeDef.name.value);
52
+ leafTypeNames.add(typeDef.name.value);
53
+ }
54
+ else if (typeDef.kind === Kind.SCALAR_TYPE_DEFINITION || typeDef.kind === Kind.SCALAR_TYPE_EXTENSION) {
48
55
  leafTypeNames.add(typeDef.name.value);
49
56
  }
50
57
  }
@@ -156,6 +163,7 @@ export function createSubgraphStateBuilder(graph, typeDefs, version, links) {
156
163
  const referencesEnumType = enumTypesByName.has(outputTypeName);
157
164
  if (isInputObjectType) {
158
165
  inputObjectTypeBuilder.field.setType(typeDef.name.value, node.name.value, printOutputType(node.type));
166
+ inputObjectTypeBuilder.field.setKind(typeDef.name.value, node.name.value, enumTypeNames.has(outputTypeName) ? ArgumentKind.ENUM : ArgumentKind.SCALAR);
159
167
  if (referencesEnumType) {
160
168
  enumTypeBuilder.setReferencedByInputType(outputTypeName, `${typeDef.name.value}.${node.name.value}`);
161
169
  }
@@ -165,6 +173,7 @@ export function createSubgraphStateBuilder(graph, typeDefs, version, links) {
165
173
  }
166
174
  if (isObjectType && fieldDef) {
167
175
  objectTypeBuilder.field.arg.setType(typeDef.name.value, fieldDef.name.value, node.name.value, printOutputType(node.type));
176
+ objectTypeBuilder.field.arg.setKind(typeDef.name.value, fieldDef.name.value, node.name.value, enumTypeNames.has(outputTypeName) ? ArgumentKind.ENUM : ArgumentKind.SCALAR);
168
177
  if (node.defaultValue) {
169
178
  objectTypeBuilder.field.arg.setDefaultValue(typeDef.name.value, fieldDef.name.value, node.name.value, print(node.defaultValue));
170
179
  }
@@ -174,6 +183,7 @@ export function createSubgraphStateBuilder(graph, typeDefs, version, links) {
174
183
  }
175
184
  if (isInterfaceType && fieldDef) {
176
185
  interfaceTypeBuilder.field.arg.setType(typeDef.name.value, fieldDef.name.value, node.name.value, printOutputType(node.type));
186
+ interfaceTypeBuilder.field.arg.setKind(typeDef.name.value, fieldDef.name.value, node.name.value, enumTypeNames.has(outputTypeName) ? ArgumentKind.ENUM : ArgumentKind.SCALAR);
177
187
  if (node.defaultValue) {
178
188
  interfaceTypeBuilder.field.arg.setDefaultValue(typeDef.name.value, fieldDef.name.value, node.name.value, print(node.defaultValue));
179
189
  }
@@ -419,6 +429,8 @@ export function createSubgraphStateBuilder(graph, typeDefs, version, links) {
419
429
  if (node.arguments?.length) {
420
430
  for (const arg of node.arguments) {
421
431
  directiveBuilder.arg.setType(directiveName, arg.name.value, printOutputType(arg.type));
432
+ const outputTypeName = resolveTypeName(arg.type);
433
+ directiveBuilder.arg.setKind(directiveName, arg.name.value, enumTypeNames.has(outputTypeName) ? ArgumentKind.ENUM : ArgumentKind.SCALAR);
422
434
  if (typeof arg.defaultValue !== 'undefined') {
423
435
  directiveBuilder.arg.setDefaultValue(directiveName, arg.name.value, print(arg.defaultValue));
424
436
  }
@@ -528,6 +540,9 @@ function directiveFactory(state) {
528
540
  setType(directiveName, argName, argType) {
529
541
  getOrCreateDirectiveArg(state, directiveName, argName).type = argType;
530
542
  },
543
+ setKind(directiveName, argName, argKind) {
544
+ getOrCreateDirectiveArg(state, directiveName, argName).kind = argKind;
545
+ },
531
546
  setDirective(typeName, argName, directive) {
532
547
  getOrCreateDirectiveArg(state, typeName, argName).ast.directives.push(directive);
533
548
  },
@@ -804,6 +819,12 @@ function objectTypeFactory(state, renameObject, interfaceTypeBuilder, isInterfac
804
819
  getOrCreateObjectFieldArgument(state, renameObject, typeName, fieldName, argName).type =
805
820
  argType;
806
821
  },
822
+ setKind(typeName, fieldName, argName, argKind) {
823
+ if (isInterfaceObject(typeName)) {
824
+ return interfaceTypeBuilder.field.arg.setKind(typeName, fieldName, argName, argKind);
825
+ }
826
+ getOrCreateObjectFieldArgument(state, renameObject, typeName, fieldName, argName).kind = argKind;
827
+ },
807
828
  setDescription(typeName, fieldName, argName, description) {
808
829
  if (isInterfaceObject(typeName)) {
809
830
  return interfaceTypeBuilder.field.arg.setDescription(typeName, fieldName, argName, description);
@@ -944,6 +965,9 @@ function interfaceTypeFactory(state) {
944
965
  setType(typeName, fieldName, argName, argType) {
945
966
  getOrCreateInterfaceFieldArgument(state, typeName, fieldName, argName).type = argType;
946
967
  },
968
+ setKind(typeName, fieldName, argName, argKind) {
969
+ getOrCreateInterfaceFieldArgument(state, typeName, fieldName, argName).kind = argKind;
970
+ },
947
971
  setDefaultValue(typeName, fieldName, argName, defaultValue) {
948
972
  getOrCreateInterfaceFieldArgument(state, typeName, fieldName, argName).defaultValue =
949
973
  defaultValue;
@@ -1000,6 +1024,9 @@ function inputObjectTypeFactory(state) {
1000
1024
  setType(typeName, fieldName, fieldType) {
1001
1025
  getOrCreateInputObjectField(state, typeName, fieldName).type = fieldType;
1002
1026
  },
1027
+ setKind(typeName, fieldName, fieldKind) {
1028
+ getOrCreateInputObjectField(state, typeName, fieldName).kind = fieldKind;
1029
+ },
1003
1030
  setDescription(typeName, fieldName, description) {
1004
1031
  getOrCreateInputObjectField(state, typeName, fieldName).description = description;
1005
1032
  },
@@ -1124,6 +1151,7 @@ function getOrCreateDirectiveArg(state, directiveName, argName) {
1124
1151
  const arg = {
1125
1152
  name: argName,
1126
1153
  type: MISSING,
1154
+ kind: ArgumentKind.SCALAR,
1127
1155
  inaccessible: false,
1128
1156
  tags: new Set(),
1129
1157
  ast: {
@@ -1362,6 +1390,7 @@ function getOrCreateInputObjectField(state, typeName, fieldName) {
1362
1390
  const field = {
1363
1391
  name: fieldName,
1364
1392
  type: MISSING,
1393
+ kind: ArgumentKind.SCALAR,
1365
1394
  inaccessible: false,
1366
1395
  tags: new Set(),
1367
1396
  ast: {
@@ -1394,6 +1423,7 @@ function getOrCreateObjectFieldArgument(state, renameObject, typeName, fieldName
1394
1423
  const arg = {
1395
1424
  name: argName,
1396
1425
  type: MISSING,
1426
+ kind: ArgumentKind.SCALAR,
1397
1427
  inaccessible: false,
1398
1428
  tags: new Set(),
1399
1429
  ast: {
@@ -1412,6 +1442,7 @@ function getOrCreateInterfaceFieldArgument(state, typeName, fieldName, argName)
1412
1442
  const arg = {
1413
1443
  name: argName,
1414
1444
  type: MISSING,
1445
+ kind: ArgumentKind.SCALAR,
1415
1446
  inaccessible: false,
1416
1447
  tags: new Set(),
1417
1448
  ast: {
@@ -1,5 +1,6 @@
1
1
  import { Kind, OperationTypeNode, parseConstValue, parseType, specifiedDirectives, visit, visitInParallel, } from 'graphql';
2
2
  import { print } from '../../graphql/printer.js';
3
+ import { ArgumentKind } from '../../subgraph/state.js';
3
4
  export function createSchemaNode(schema) {
4
5
  return {
5
6
  kind: Kind.SCHEMA_DEFINITION,
@@ -181,7 +182,10 @@ function createFieldArgumentNode(argument) {
181
182
  value: argument.name,
182
183
  },
183
184
  defaultValue: typeof argument.defaultValue === 'string'
184
- ? parseConstValue(argument.defaultValue)
185
+ ? argument.kind === ArgumentKind.ENUM ? {
186
+ kind: Kind.ENUM,
187
+ value: argument.defaultValue.startsWith(`"`) && argument.defaultValue.endsWith(`"`) ? argument.defaultValue.substring(1, argument.defaultValue.length - 1) : argument.defaultValue,
188
+ } : parseConstValue(argument.defaultValue)
185
189
  : undefined,
186
190
  type: parseType(argument.type),
187
191
  directives: applyDirectives(argument),
@@ -14,7 +14,7 @@ export function directiveBuilder() {
14
14
  directiveState.repeatable = true;
15
15
  }
16
16
  for (const arg of directive.args.values()) {
17
- const argState = getOrCreateArg(directiveState, arg.name, arg.type);
17
+ const argState = getOrCreateArg(directiveState, arg.name, arg.type, arg.kind);
18
18
  arg.tags.forEach(tag => argState.tags.add(tag));
19
19
  if (arg.type.endsWith('!')) {
20
20
  argState.type = arg.type;
@@ -25,8 +25,10 @@ export function directiveBuilder() {
25
25
  if (arg.inaccessible) {
26
26
  argState.inaccessible = true;
27
27
  }
28
+ argState.kind = arg.kind;
28
29
  argState.byGraph.set(graph.id, {
29
30
  type: arg.type,
31
+ kind: arg.kind,
30
32
  defaultValue: arg.defaultValue,
31
33
  version: graph.version,
32
34
  });
@@ -45,6 +47,7 @@ export function directiveBuilder() {
45
47
  arguments: Array.from(directive.args.values()).map(arg => ({
46
48
  name: arg.name,
47
49
  type: arg.type,
50
+ kind: arg.kind,
48
51
  tags: Array.from(arg.tags),
49
52
  inaccessible: arg.inaccessible,
50
53
  defaultValue: arg.defaultValue,
@@ -72,7 +75,7 @@ function getOrCreateDirective(state, directiveName) {
72
75
  state.set(directiveName, def);
73
76
  return def;
74
77
  }
75
- function getOrCreateArg(directiveState, argName, argType) {
78
+ function getOrCreateArg(directiveState, argName, argType, argKind) {
76
79
  const existing = directiveState.args.get(argName);
77
80
  if (existing) {
78
81
  return existing;
@@ -80,6 +83,7 @@ function getOrCreateArg(directiveState, argName, argType) {
80
83
  const def = {
81
84
  name: argName,
82
85
  type: argType,
86
+ kind: argKind,
83
87
  inaccessible: false,
84
88
  tags: new Set(),
85
89
  byGraph: new Map(),
@@ -24,7 +24,7 @@ export function inputObjectTypeBuilder() {
24
24
  version: graph.version,
25
25
  });
26
26
  for (const field of type.fields.values()) {
27
- const fieldState = getOrCreateField(inputObjectTypeState, field.name, field.type);
27
+ const fieldState = getOrCreateField(inputObjectTypeState, field.name, field.type, field.kind);
28
28
  field.tags.forEach(tag => fieldState.tags.add(tag));
29
29
  if (field.type.endsWith('!') && !fieldState.type.endsWith('!')) {
30
30
  fieldState.type = field.type;
@@ -41,6 +41,7 @@ export function inputObjectTypeBuilder() {
41
41
  if (typeof field.defaultValue !== 'undefined') {
42
42
  fieldState.defaultValue = field.defaultValue;
43
43
  }
44
+ fieldState.kind = field.kind;
44
45
  field.ast.directives.forEach(directive => {
45
46
  fieldState.ast.directives.push(directive);
46
47
  });
@@ -121,7 +122,7 @@ function getOrCreateInputObjectType(state, typeName) {
121
122
  state.set(typeName, def);
122
123
  return def;
123
124
  }
124
- function getOrCreateField(objectTypeState, fieldName, fieldType) {
125
+ function getOrCreateField(objectTypeState, fieldName, fieldType, fieldKind) {
125
126
  const existing = objectTypeState.fields.get(fieldName);
126
127
  if (existing) {
127
128
  return existing;
@@ -129,6 +130,7 @@ function getOrCreateField(objectTypeState, fieldName, fieldType) {
129
130
  const def = {
130
131
  name: fieldName,
131
132
  type: fieldType,
133
+ kind: fieldKind,
132
134
  tags: new Set(),
133
135
  inaccessible: false,
134
136
  byGraph: new Map(),
@@ -87,7 +87,7 @@ export function interfaceTypeBuilder() {
87
87
  usedAsKey,
88
88
  });
89
89
  for (const arg of field.args.values()) {
90
- const argState = getOrCreateArg(fieldState, arg.name, arg.type);
90
+ const argState = getOrCreateArg(fieldState, arg.name, arg.type, arg.kind);
91
91
  arg.tags.forEach(tag => argState.tags.add(tag));
92
92
  if (arg.type.endsWith('!')) {
93
93
  argState.type = arg.type;
@@ -104,8 +104,10 @@ export function interfaceTypeBuilder() {
104
104
  arg.ast.directives.forEach(directive => {
105
105
  argState.ast.directives.push(directive);
106
106
  });
107
+ argState.kind = arg.kind;
107
108
  argState.byGraph.set(graph.id, {
108
109
  type: arg.type,
110
+ kind: arg.kind,
109
111
  defaultValue: arg.defaultValue,
110
112
  version: graph.version,
111
113
  });
@@ -161,6 +163,7 @@ export function interfaceTypeBuilder() {
161
163
  return {
162
164
  name: arg.name,
163
165
  type: arg.type,
166
+ kind: arg.kind,
164
167
  tags: Array.from(arg.tags),
165
168
  defaultValue: arg.defaultValue,
166
169
  deprecated: arg.deprecated,
@@ -273,7 +276,7 @@ function getOrCreateInterfaceField(interfaceTypeState, fieldName, fieldType) {
273
276
  interfaceTypeState.fields.set(fieldName, def);
274
277
  return def;
275
278
  }
276
- function getOrCreateArg(fieldState, argName, argType) {
279
+ function getOrCreateArg(fieldState, argName, argType, argKind) {
277
280
  const existing = fieldState.args.get(argName);
278
281
  if (existing) {
279
282
  return existing;
@@ -281,6 +284,7 @@ function getOrCreateArg(fieldState, argName, argType) {
281
284
  const def = {
282
285
  name: argName,
283
286
  type: argType,
287
+ kind: argKind,
284
288
  tags: new Set(),
285
289
  byGraph: new Map(),
286
290
  ast: {
@@ -126,7 +126,7 @@ export function objectTypeBuilder() {
126
126
  version: graph.version,
127
127
  });
128
128
  for (const arg of field.args.values()) {
129
- const argState = getOrCreateArg(fieldState, arg.name, arg.type);
129
+ const argState = getOrCreateArg(fieldState, arg.name, arg.type, arg.kind);
130
130
  arg.tags.forEach(tag => argState.tags.add(tag));
131
131
  if (arg.type.endsWith('!')) {
132
132
  argState.type = arg.type;
@@ -146,8 +146,10 @@ export function objectTypeBuilder() {
146
146
  if (typeof arg.defaultValue !== 'undefined') {
147
147
  argState.defaultValue = arg.defaultValue;
148
148
  }
149
+ argState.kind = arg.kind;
149
150
  argState.byGraph.set(graph.id, {
150
151
  type: arg.type,
152
+ kind: arg.kind,
151
153
  inaccessible: arg.inaccessible,
152
154
  defaultValue: arg.defaultValue,
153
155
  version: graph.version,
@@ -433,6 +435,7 @@ export function objectTypeBuilder() {
433
435
  return {
434
436
  name: arg.name,
435
437
  type: arg.type,
438
+ kind: arg.kind,
436
439
  inaccessible: arg.inaccessible,
437
440
  tags: Array.from(arg.tags),
438
441
  defaultValue: arg.defaultValue,
@@ -476,6 +479,7 @@ export function objectTypeBuilder() {
476
479
  return {
477
480
  name: arg.name,
478
481
  type: arg.type,
482
+ kind: arg.kind,
479
483
  inaccessible: false,
480
484
  tags: Array.from(arg.tags),
481
485
  defaultValue: arg.defaultValue,
@@ -577,7 +581,7 @@ function getOrCreateField(objectTypeState, fieldName, fieldType) {
577
581
  objectTypeState.fields.set(fieldName, def);
578
582
  return def;
579
583
  }
580
- function getOrCreateArg(fieldState, argName, argType) {
584
+ function getOrCreateArg(fieldState, argName, argType, argKind) {
581
585
  const existing = fieldState.args.get(argName);
582
586
  if (existing) {
583
587
  return existing;
@@ -585,6 +589,7 @@ function getOrCreateArg(fieldState, argName, argType) {
585
589
  const def = {
586
590
  name: argName,
587
591
  type: argType,
592
+ kind: argKind,
588
593
  tags: new Set(),
589
594
  inaccessible: false,
590
595
  byGraph: new Map(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theguild/federation-composition",
3
- "version": "0.11.1",
3
+ "version": "0.11.2-alpha-20240612134640-775a9bf",
4
4
  "description": "Open Source Composition library for Apollo Federation",
5
5
  "peerDependencies": {
6
6
  "graphql": "^16.0.0"
@@ -12,6 +12,10 @@ export declare enum TypeKind {
12
12
  INPUT_OBJECT = "INPUT_OBJECT",
13
13
  DIRECTIVE = "DIRECTIVE"
14
14
  }
15
+ export declare enum ArgumentKind {
16
+ SCALAR = "SCALAR",
17
+ ENUM = "ENUM"
18
+ }
15
19
  export interface Directive {
16
20
  kind: TypeKind.DIRECTIVE;
17
21
  name: string;
@@ -145,6 +149,7 @@ export interface Field {
145
149
  export interface InputField {
146
150
  name: string;
147
151
  type: string;
152
+ kind: ArgumentKind;
148
153
  inaccessible: boolean;
149
154
  tags: Set<string>;
150
155
  defaultValue?: string;
@@ -164,6 +169,7 @@ export interface EnumValue {
164
169
  export interface Argument {
165
170
  name: string;
166
171
  type: string;
172
+ kind: ArgumentKind;
167
173
  inaccessible: boolean;
168
174
  tags: Set<string>;
169
175
  defaultValue?: string;
@@ -223,6 +229,7 @@ export declare function createSubgraphStateBuilder(graph: {
223
229
  arg: {
224
230
  setTag(directiveName: string, argName: string, tag: string): void;
225
231
  setType(directiveName: string, argName: string, argType: string): void;
232
+ setKind(directiveName: string, argName: string, argKind: ArgumentKind): void;
226
233
  setDirective(typeName: string, argName: string, directive: DirectiveNode): void;
227
234
  setDefaultValue(typeName: string, argName: string, defaultValue: string): void;
228
235
  setInaccessible(typeName: string, argName: string): void;
@@ -275,6 +282,7 @@ export declare function createSubgraphStateBuilder(graph: {
275
282
  setUsed(typeName: string, fieldName: string): void;
276
283
  arg: {
277
284
  setType(typeName: string, fieldName: string, argName: string, argType: string): void;
285
+ setKind(typeName: string, fieldName: string, argName: string, argKind: ArgumentKind): void;
278
286
  setDescription(typeName: string, fieldName: string, argName: string, description: Description): void;
279
287
  setDeprecated(typeName: string, fieldName: string, argName: string, reason?: string | undefined): void;
280
288
  setDirective(typeName: string, fieldName: string, argName: string, directive: DirectiveNode): void;
@@ -315,6 +323,7 @@ export declare function createSubgraphStateBuilder(graph: {
315
323
  setDeprecated(typeName: string, fieldName: string, reason?: string | undefined): void;
316
324
  arg: {
317
325
  setType(typeName: string, fieldName: string, argName: string, argType: string): void;
326
+ setKind(typeName: string, fieldName: string, argName: string, argKind: ArgumentKind): void;
318
327
  setDefaultValue(typeName: string, fieldName: string, argName: string, defaultValue: string): void;
319
328
  setDeprecated(typeName: string, fieldName: string, argName: string, reason?: string | undefined): void;
320
329
  setDescription(typeName: string, fieldName: string, argName: string, description: Description): void;
@@ -333,6 +342,7 @@ export declare function createSubgraphStateBuilder(graph: {
333
342
  setTag(typeName: string, tag: string): void;
334
343
  field: {
335
344
  setType(typeName: string, fieldName: string, fieldType: string): void;
345
+ setKind(typeName: string, fieldName: string, fieldKind: ArgumentKind): void;
336
346
  setDescription(typeName: string, fieldName: string, description: Description): void;
337
347
  setDeprecated(typeName: string, fieldName: string, reason?: string | undefined): void;
338
348
  setDefaultValue(typeName: string, fieldName: string, defaultValue: string): void;
@@ -12,6 +12,10 @@ export declare enum TypeKind {
12
12
  INPUT_OBJECT = "INPUT_OBJECT",
13
13
  DIRECTIVE = "DIRECTIVE"
14
14
  }
15
+ export declare enum ArgumentKind {
16
+ SCALAR = "SCALAR",
17
+ ENUM = "ENUM"
18
+ }
15
19
  export interface Directive {
16
20
  kind: TypeKind.DIRECTIVE;
17
21
  name: string;
@@ -145,6 +149,7 @@ export interface Field {
145
149
  export interface InputField {
146
150
  name: string;
147
151
  type: string;
152
+ kind: ArgumentKind;
148
153
  inaccessible: boolean;
149
154
  tags: Set<string>;
150
155
  defaultValue?: string;
@@ -164,6 +169,7 @@ export interface EnumValue {
164
169
  export interface Argument {
165
170
  name: string;
166
171
  type: string;
172
+ kind: ArgumentKind;
167
173
  inaccessible: boolean;
168
174
  tags: Set<string>;
169
175
  defaultValue?: string;
@@ -223,6 +229,7 @@ export declare function createSubgraphStateBuilder(graph: {
223
229
  arg: {
224
230
  setTag(directiveName: string, argName: string, tag: string): void;
225
231
  setType(directiveName: string, argName: string, argType: string): void;
232
+ setKind(directiveName: string, argName: string, argKind: ArgumentKind): void;
226
233
  setDirective(typeName: string, argName: string, directive: DirectiveNode): void;
227
234
  setDefaultValue(typeName: string, argName: string, defaultValue: string): void;
228
235
  setInaccessible(typeName: string, argName: string): void;
@@ -275,6 +282,7 @@ export declare function createSubgraphStateBuilder(graph: {
275
282
  setUsed(typeName: string, fieldName: string): void;
276
283
  arg: {
277
284
  setType(typeName: string, fieldName: string, argName: string, argType: string): void;
285
+ setKind(typeName: string, fieldName: string, argName: string, argKind: ArgumentKind): void;
278
286
  setDescription(typeName: string, fieldName: string, argName: string, description: Description): void;
279
287
  setDeprecated(typeName: string, fieldName: string, argName: string, reason?: string | undefined): void;
280
288
  setDirective(typeName: string, fieldName: string, argName: string, directive: DirectiveNode): void;
@@ -315,6 +323,7 @@ export declare function createSubgraphStateBuilder(graph: {
315
323
  setDeprecated(typeName: string, fieldName: string, reason?: string | undefined): void;
316
324
  arg: {
317
325
  setType(typeName: string, fieldName: string, argName: string, argType: string): void;
326
+ setKind(typeName: string, fieldName: string, argName: string, argKind: ArgumentKind): void;
318
327
  setDefaultValue(typeName: string, fieldName: string, argName: string, defaultValue: string): void;
319
328
  setDeprecated(typeName: string, fieldName: string, argName: string, reason?: string | undefined): void;
320
329
  setDescription(typeName: string, fieldName: string, argName: string, description: Description): void;
@@ -333,6 +342,7 @@ export declare function createSubgraphStateBuilder(graph: {
333
342
  setTag(typeName: string, tag: string): void;
334
343
  field: {
335
344
  setType(typeName: string, fieldName: string, fieldType: string): void;
345
+ setKind(typeName: string, fieldName: string, fieldKind: ArgumentKind): void;
336
346
  setDescription(typeName: string, fieldName: string, description: Description): void;
337
347
  setDeprecated(typeName: string, fieldName: string, reason?: string | undefined): void;
338
348
  setDefaultValue(typeName: string, fieldName: string, defaultValue: string): void;
@@ -30,6 +30,7 @@ export declare function createSubgraphValidationContext(subgraph: {
30
30
  arg: {
31
31
  setTag(directiveName: string, argName: string, tag: string): void;
32
32
  setType(directiveName: string, argName: string, argType: string): void;
33
+ setKind(directiveName: string, argName: string, argKind: import("../state.js").ArgumentKind): void;
33
34
  setDirective(typeName: string, argName: string, directive: import("graphql").DirectiveNode): void;
34
35
  setDefaultValue(typeName: string, argName: string, defaultValue: string): void;
35
36
  setInaccessible(typeName: string, argName: string): void;
@@ -82,6 +83,7 @@ export declare function createSubgraphValidationContext(subgraph: {
82
83
  setUsed(typeName: string, fieldName: string): void;
83
84
  arg: {
84
85
  setType(typeName: string, fieldName: string, argName: string, argType: string): void;
86
+ setKind(typeName: string, fieldName: string, argName: string, argKind: import("../state.js").ArgumentKind): void;
85
87
  setDescription(typeName: string, fieldName: string, argName: string, description: import("../state.js").Description): void;
86
88
  setDeprecated(typeName: string, fieldName: string, argName: string, reason?: string | undefined): void;
87
89
  setDirective(typeName: string, fieldName: string, argName: string, directive: import("graphql").DirectiveNode): void;
@@ -122,6 +124,7 @@ export declare function createSubgraphValidationContext(subgraph: {
122
124
  setDeprecated(typeName: string, fieldName: string, reason?: string | undefined): void;
123
125
  arg: {
124
126
  setType(typeName: string, fieldName: string, argName: string, argType: string): void;
127
+ setKind(typeName: string, fieldName: string, argName: string, argKind: import("../state.js").ArgumentKind): void;
125
128
  setDefaultValue(typeName: string, fieldName: string, argName: string, defaultValue: string): void;
126
129
  setDeprecated(typeName: string, fieldName: string, argName: string, reason?: string | undefined): void;
127
130
  setDescription(typeName: string, fieldName: string, argName: string, description: import("../state.js").Description): void;
@@ -140,6 +143,7 @@ export declare function createSubgraphValidationContext(subgraph: {
140
143
  setTag(typeName: string, tag: string): void;
141
144
  field: {
142
145
  setType(typeName: string, fieldName: string, fieldType: string): void;
146
+ setKind(typeName: string, fieldName: string, fieldKind: import("../state.js").ArgumentKind): void;
143
147
  setDescription(typeName: string, fieldName: string, description: import("../state.js").Description): void;
144
148
  setDeprecated(typeName: string, fieldName: string, reason?: string | undefined): void;
145
149
  setDefaultValue(typeName: string, fieldName: string, defaultValue: string): void;
@@ -30,6 +30,7 @@ export declare function createSubgraphValidationContext(subgraph: {
30
30
  arg: {
31
31
  setTag(directiveName: string, argName: string, tag: string): void;
32
32
  setType(directiveName: string, argName: string, argType: string): void;
33
+ setKind(directiveName: string, argName: string, argKind: import("../state.js").ArgumentKind): void;
33
34
  setDirective(typeName: string, argName: string, directive: import("graphql").DirectiveNode): void;
34
35
  setDefaultValue(typeName: string, argName: string, defaultValue: string): void;
35
36
  setInaccessible(typeName: string, argName: string): void;
@@ -82,6 +83,7 @@ export declare function createSubgraphValidationContext(subgraph: {
82
83
  setUsed(typeName: string, fieldName: string): void;
83
84
  arg: {
84
85
  setType(typeName: string, fieldName: string, argName: string, argType: string): void;
86
+ setKind(typeName: string, fieldName: string, argName: string, argKind: import("../state.js").ArgumentKind): void;
85
87
  setDescription(typeName: string, fieldName: string, argName: string, description: import("../state.js").Description): void;
86
88
  setDeprecated(typeName: string, fieldName: string, argName: string, reason?: string | undefined): void;
87
89
  setDirective(typeName: string, fieldName: string, argName: string, directive: import("graphql").DirectiveNode): void;
@@ -122,6 +124,7 @@ export declare function createSubgraphValidationContext(subgraph: {
122
124
  setDeprecated(typeName: string, fieldName: string, reason?: string | undefined): void;
123
125
  arg: {
124
126
  setType(typeName: string, fieldName: string, argName: string, argType: string): void;
127
+ setKind(typeName: string, fieldName: string, argName: string, argKind: import("../state.js").ArgumentKind): void;
125
128
  setDefaultValue(typeName: string, fieldName: string, argName: string, defaultValue: string): void;
126
129
  setDeprecated(typeName: string, fieldName: string, argName: string, reason?: string | undefined): void;
127
130
  setDescription(typeName: string, fieldName: string, argName: string, description: import("../state.js").Description): void;
@@ -140,6 +143,7 @@ export declare function createSubgraphValidationContext(subgraph: {
140
143
  setTag(typeName: string, tag: string): void;
141
144
  field: {
142
145
  setType(typeName: string, fieldName: string, fieldType: string): void;
146
+ setKind(typeName: string, fieldName: string, fieldKind: import("../state.js").ArgumentKind): void;
143
147
  setDescription(typeName: string, fieldName: string, description: import("../state.js").Description): void;
144
148
  setDeprecated(typeName: string, fieldName: string, reason?: string | undefined): void;
145
149
  setDefaultValue(typeName: string, fieldName: string, defaultValue: string): void;
@@ -1,4 +1,5 @@
1
1
  import { ASTNode, ConstDirectiveNode, DirectiveDefinitionNode, DocumentNode, EnumTypeDefinitionNode, EnumValueDefinitionNode, FieldDefinitionNode, InputObjectTypeDefinitionNode, InputValueDefinitionNode, InterfaceTypeDefinitionNode, ObjectTypeDefinitionNode, ScalarTypeDefinitionNode, SchemaDefinitionNode, StringValueNode, UnionTypeDefinitionNode } from 'graphql';
2
+ import { ArgumentKind } from '../../subgraph/state.cjs';
2
3
  type inferArgument<T> = T extends (arg: infer A) => any ? A : never;
3
4
  export type DirectiveAST = inferArgument<typeof createDirectiveNode>;
4
5
  export type ObjectTypeAST = inferArgument<typeof createObjectTypeNode>;
@@ -175,6 +176,7 @@ declare function createEnumValueNode(enumValue: {
175
176
  declare function createFieldArgumentNode(argument: {
176
177
  name: string;
177
178
  type: string;
179
+ kind: ArgumentKind;
178
180
  defaultValue?: string;
179
181
  inaccessible?: boolean;
180
182
  tags?: string[];
@@ -1,4 +1,5 @@
1
1
  import { ASTNode, ConstDirectiveNode, DirectiveDefinitionNode, DocumentNode, EnumTypeDefinitionNode, EnumValueDefinitionNode, FieldDefinitionNode, InputObjectTypeDefinitionNode, InputValueDefinitionNode, InterfaceTypeDefinitionNode, ObjectTypeDefinitionNode, ScalarTypeDefinitionNode, SchemaDefinitionNode, StringValueNode, UnionTypeDefinitionNode } from 'graphql';
2
+ import { ArgumentKind } from '../../subgraph/state.js';
2
3
  type inferArgument<T> = T extends (arg: infer A) => any ? A : never;
3
4
  export type DirectiveAST = inferArgument<typeof createDirectiveNode>;
4
5
  export type ObjectTypeAST = inferArgument<typeof createObjectTypeNode>;
@@ -175,6 +176,7 @@ declare function createEnumValueNode(enumValue: {
175
176
  declare function createFieldArgumentNode(argument: {
176
177
  name: string;
177
178
  type: string;
179
+ kind: ArgumentKind;
178
180
  defaultValue?: string;
179
181
  inaccessible?: boolean;
180
182
  tags?: string[];
@@ -1,6 +1,6 @@
1
1
  import { DirectiveNode } from 'graphql';
2
2
  import { FederationVersion } from '../../specifications/federation.cjs';
3
- import type { Directive } from '../../subgraph/state.cjs';
3
+ import type { ArgumentKind, Directive } from '../../subgraph/state.cjs';
4
4
  import { MapByGraph, TypeBuilder } from './common.cjs';
5
5
  export declare function directiveBuilder(): TypeBuilder<Directive, DirectiveState>;
6
6
  export type DirectiveState = {
@@ -19,6 +19,7 @@ type DirectiveStateInGraph = {
19
19
  export type DirectiveArgState = {
20
20
  name: string;
21
21
  type: string;
22
+ kind: ArgumentKind;
22
23
  tags: Set<string>;
23
24
  inaccessible: boolean;
24
25
  defaultValue?: string;
@@ -29,6 +30,7 @@ export type DirectiveArgState = {
29
30
  };
30
31
  type ArgStateInGraph = {
31
32
  type: string;
33
+ kind: ArgumentKind;
32
34
  defaultValue?: string;
33
35
  version: FederationVersion;
34
36
  };
@@ -1,6 +1,6 @@
1
1
  import { DirectiveNode } from 'graphql';
2
2
  import { FederationVersion } from '../../specifications/federation.js';
3
- import type { Directive } from '../../subgraph/state.js';
3
+ import type { ArgumentKind, Directive } from '../../subgraph/state.js';
4
4
  import { MapByGraph, TypeBuilder } from './common.js';
5
5
  export declare function directiveBuilder(): TypeBuilder<Directive, DirectiveState>;
6
6
  export type DirectiveState = {
@@ -19,6 +19,7 @@ type DirectiveStateInGraph = {
19
19
  export type DirectiveArgState = {
20
20
  name: string;
21
21
  type: string;
22
+ kind: ArgumentKind;
22
23
  tags: Set<string>;
23
24
  inaccessible: boolean;
24
25
  defaultValue?: string;
@@ -29,6 +30,7 @@ export type DirectiveArgState = {
29
30
  };
30
31
  type ArgStateInGraph = {
31
32
  type: string;
33
+ kind: ArgumentKind;
32
34
  defaultValue?: string;
33
35
  version: FederationVersion;
34
36
  };
@@ -1,6 +1,6 @@
1
1
  import { DirectiveNode } from 'graphql';
2
2
  import { FederationVersion } from '../../specifications/federation.cjs';
3
- import { Deprecated, Description, InputObjectType } from '../../subgraph/state.cjs';
3
+ import { ArgumentKind, Deprecated, Description, InputObjectType } from '../../subgraph/state.cjs';
4
4
  import { type MapByGraph, type TypeBuilder } from './common.cjs';
5
5
  export declare function inputObjectTypeBuilder(): TypeBuilder<InputObjectType, InputObjectTypeState>;
6
6
  export interface InputObjectTypeState {
@@ -19,6 +19,7 @@ export interface InputObjectTypeState {
19
19
  export type InputObjectTypeFieldState = {
20
20
  name: string;
21
21
  type: string;
22
+ kind: ArgumentKind;
22
23
  tags: Set<string>;
23
24
  inaccessible: boolean;
24
25
  defaultValue?: string;
@@ -1,6 +1,6 @@
1
1
  import { DirectiveNode } from 'graphql';
2
2
  import { FederationVersion } from '../../specifications/federation.js';
3
- import { Deprecated, Description, InputObjectType } from '../../subgraph/state.js';
3
+ import { ArgumentKind, Deprecated, Description, InputObjectType } from '../../subgraph/state.js';
4
4
  import { type MapByGraph, type TypeBuilder } from './common.js';
5
5
  export declare function inputObjectTypeBuilder(): TypeBuilder<InputObjectType, InputObjectTypeState>;
6
6
  export interface InputObjectTypeState {
@@ -19,6 +19,7 @@ export interface InputObjectTypeState {
19
19
  export type InputObjectTypeFieldState = {
20
20
  name: string;
21
21
  type: string;
22
+ kind: ArgumentKind;
22
23
  tags: Set<string>;
23
24
  inaccessible: boolean;
24
25
  defaultValue?: string;
@@ -1,6 +1,6 @@
1
1
  import { DirectiveNode } from 'graphql';
2
2
  import { FederationVersion } from '../../specifications/federation.cjs';
3
- import { Deprecated, Description, InterfaceType } from '../../subgraph/state.cjs';
3
+ import { ArgumentKind, Deprecated, Description, InterfaceType } from '../../subgraph/state.cjs';
4
4
  import type { Key, MapByGraph, TypeBuilder } from './common.cjs';
5
5
  export declare function interfaceTypeBuilder(): TypeBuilder<InterfaceType, InterfaceTypeState>;
6
6
  export type InterfaceTypeState = {
@@ -44,6 +44,7 @@ export type InterfaceTypeFieldState = {
44
44
  export type InterfaceTypeFieldArgState = {
45
45
  name: string;
46
46
  type: string;
47
+ kind: ArgumentKind;
47
48
  tags: Set<string>;
48
49
  defaultValue?: string;
49
50
  description?: Description;
@@ -73,6 +74,7 @@ type FieldStateInGraph = {
73
74
  };
74
75
  type ArgStateInGraph = {
75
76
  type: string;
77
+ kind: ArgumentKind;
76
78
  defaultValue?: string;
77
79
  version: FederationVersion;
78
80
  };
@@ -1,6 +1,6 @@
1
1
  import { DirectiveNode } from 'graphql';
2
2
  import { FederationVersion } from '../../specifications/federation.js';
3
- import { Deprecated, Description, InterfaceType } from '../../subgraph/state.js';
3
+ import { ArgumentKind, Deprecated, Description, InterfaceType } from '../../subgraph/state.js';
4
4
  import type { Key, MapByGraph, TypeBuilder } from './common.js';
5
5
  export declare function interfaceTypeBuilder(): TypeBuilder<InterfaceType, InterfaceTypeState>;
6
6
  export type InterfaceTypeState = {
@@ -44,6 +44,7 @@ export type InterfaceTypeFieldState = {
44
44
  export type InterfaceTypeFieldArgState = {
45
45
  name: string;
46
46
  type: string;
47
+ kind: ArgumentKind;
47
48
  tags: Set<string>;
48
49
  defaultValue?: string;
49
50
  description?: Description;
@@ -73,6 +74,7 @@ type FieldStateInGraph = {
73
74
  };
74
75
  type ArgStateInGraph = {
75
76
  type: string;
77
+ kind: ArgumentKind;
76
78
  defaultValue?: string;
77
79
  version: FederationVersion;
78
80
  };
@@ -1,6 +1,6 @@
1
1
  import { DirectiveNode } from 'graphql';
2
2
  import type { FederationVersion } from '../../specifications/federation.cjs';
3
- import { Deprecated, Description, ObjectType } from '../../subgraph/state.cjs';
3
+ import { ArgumentKind, Deprecated, Description, ObjectType } from '../../subgraph/state.cjs';
4
4
  import type { Key, MapByGraph, TypeBuilder } from './common.cjs';
5
5
  export declare function isRealExtension(meta: ObjectTypeStateInGraph, version: FederationVersion): boolean;
6
6
  export declare function objectTypeBuilder(): TypeBuilder<ObjectType, ObjectTypeState>;
@@ -47,6 +47,7 @@ export type ObjectTypeFieldState = {
47
47
  export type ObjectTypeFieldArgState = {
48
48
  name: string;
49
49
  type: string;
50
+ kind: ArgumentKind;
50
51
  tags: Set<string>;
51
52
  inaccessible: boolean;
52
53
  defaultValue?: string;
@@ -86,6 +87,7 @@ type FieldStateInGraph = {
86
87
  };
87
88
  type ArgStateInGraph = {
88
89
  type: string;
90
+ kind: ArgumentKind;
89
91
  inaccessible: boolean;
90
92
  defaultValue?: string;
91
93
  version: FederationVersion;
@@ -1,6 +1,6 @@
1
1
  import { DirectiveNode } from 'graphql';
2
2
  import type { FederationVersion } from '../../specifications/federation.js';
3
- import { Deprecated, Description, ObjectType } from '../../subgraph/state.js';
3
+ import { ArgumentKind, Deprecated, Description, ObjectType } from '../../subgraph/state.js';
4
4
  import type { Key, MapByGraph, TypeBuilder } from './common.js';
5
5
  export declare function isRealExtension(meta: ObjectTypeStateInGraph, version: FederationVersion): boolean;
6
6
  export declare function objectTypeBuilder(): TypeBuilder<ObjectType, ObjectTypeState>;
@@ -47,6 +47,7 @@ export type ObjectTypeFieldState = {
47
47
  export type ObjectTypeFieldArgState = {
48
48
  name: string;
49
49
  type: string;
50
+ kind: ArgumentKind;
50
51
  tags: Set<string>;
51
52
  inaccessible: boolean;
52
53
  defaultValue?: string;
@@ -86,6 +87,7 @@ type FieldStateInGraph = {
86
87
  };
87
88
  type ArgStateInGraph = {
88
89
  type: string;
90
+ kind: ArgumentKind;
89
91
  inaccessible: boolean;
90
92
  defaultValue?: string;
91
93
  version: FederationVersion;