@wundergraph/composition 0.18.0 → 0.18.1
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.
- package/dist/ast/ast.d.ts +2 -9
- package/dist/ast/ast.js +4 -32
- package/dist/ast/ast.js.map +1 -1
- package/dist/ast/utils.d.ts +1 -2
- package/dist/ast/utils.js.map +1 -1
- package/dist/errors/errors.d.ts +6 -11
- package/dist/errors/errors.js +18 -29
- package/dist/errors/errors.js.map +1 -1
- package/dist/federation/federation-factory.d.ts +6 -6
- package/dist/federation/federation-factory.js +19 -18
- package/dist/federation/federation-factory.js.map +1 -1
- package/dist/federation/utils.d.ts +4 -4
- package/dist/federation/utils.js +2 -2
- package/dist/federation/utils.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/normalization/normalization-factory.d.ts +19 -26
- package/dist/normalization/normalization-factory.js +179 -994
- package/dist/normalization/normalization-factory.js.map +1 -1
- package/dist/normalization/utils.d.ts +6 -126
- package/dist/normalization/utils.js +71 -166
- package/dist/normalization/utils.js.map +1 -1
- package/dist/normalization/walkers.d.ts +5 -0
- package/dist/normalization/walkers.js +593 -0
- package/dist/normalization/walkers.js.map +1 -0
- package/dist/schema-building/ast.d.ts +104 -0
- package/dist/schema-building/ast.js +156 -0
- package/dist/schema-building/ast.js.map +1 -0
- package/dist/schema-building/type-definition-data.d.ts +108 -0
- package/dist/schema-building/type-definition-data.js +3 -0
- package/dist/schema-building/type-definition-data.js.map +1 -0
- package/dist/schema-building/type-extension-data.d.ts +45 -0
- package/dist/schema-building/type-extension-data.js +3 -0
- package/dist/schema-building/type-extension-data.js.map +1 -0
- package/dist/{type-merging → schema-building}/type-merging.js +5 -4
- package/dist/schema-building/type-merging.js.map +1 -0
- package/dist/schema-building/utils.d.ts +42 -0
- package/dist/schema-building/utils.js +600 -0
- package/dist/schema-building/utils.js.map +1 -0
- package/dist/subgraph/subgraph.d.ts +4 -5
- package/dist/subgraph/subgraph.js +2 -91
- package/dist/subgraph/subgraph.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/constants.d.ts +4 -2
- package/dist/utils/constants.js +383 -359
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/string-constants.d.ts +4 -0
- package/dist/utils/string-constants.js +6 -2
- package/dist/utils/string-constants.js.map +1 -1
- package/dist/utils/utils.d.ts +2 -4
- package/dist/utils/utils.js +4 -6
- package/dist/utils/utils.js.map +1 -1
- package/package.json +2 -2
- package/dist/type-merging/type-merging.js.map +0 -1
- /package/dist/{type-merging → schema-building}/type-merging.d.ts +0 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { ConstDirectiveNode, ConstValueNode, EnumTypeDefinitionNode, EnumValueDefinitionNode, FieldDefinitionNode, InputObjectTypeDefinitionNode, InputValueDefinitionNode, InterfaceTypeDefinitionNode, Kind, NamedTypeNode, NameNode, ObjectTypeDefinitionNode, ObjectTypeExtensionNode, ScalarTypeDefinitionNode, StringValueNode, TypeNode, UnionTypeDefinitionNode } from 'graphql';
|
|
2
|
+
export type MutableEnumNode = {
|
|
3
|
+
kind: Kind.ENUM_TYPE_DEFINITION;
|
|
4
|
+
name: NameNode;
|
|
5
|
+
description?: StringValueNode;
|
|
6
|
+
directives?: ConstDirectiveNode[];
|
|
7
|
+
values?: MutableEnumValueNode[];
|
|
8
|
+
};
|
|
9
|
+
export declare function getMutableEnumNode(node: EnumTypeDefinitionNode): MutableEnumNode;
|
|
10
|
+
export type MutableEnumValueNode = {
|
|
11
|
+
directives: ConstDirectiveNode[];
|
|
12
|
+
kind: Kind.ENUM_VALUE_DEFINITION;
|
|
13
|
+
name: NameNode;
|
|
14
|
+
description?: StringValueNode;
|
|
15
|
+
};
|
|
16
|
+
export declare function getMutableEnumValueNode(node: EnumValueDefinitionNode): MutableEnumValueNode;
|
|
17
|
+
export type MutableFieldNode = {
|
|
18
|
+
arguments: MutableInputValueNode[];
|
|
19
|
+
directives: ConstDirectiveNode[];
|
|
20
|
+
kind: Kind.FIELD_DEFINITION;
|
|
21
|
+
name: NameNode;
|
|
22
|
+
type: MutableTypeNode;
|
|
23
|
+
description?: StringValueNode;
|
|
24
|
+
};
|
|
25
|
+
export declare function getMutableFieldNode(node: FieldDefinitionNode, parentTypeName: string): MutableFieldNode;
|
|
26
|
+
export type MutableInputObjectNode = {
|
|
27
|
+
kind: Kind.INPUT_OBJECT_TYPE_DEFINITION;
|
|
28
|
+
name: NameNode;
|
|
29
|
+
description?: StringValueNode;
|
|
30
|
+
directives?: ConstDirectiveNode[];
|
|
31
|
+
fields?: InputValueDefinitionNode[];
|
|
32
|
+
};
|
|
33
|
+
export declare function getMutableInputObjectNode(node: InputObjectTypeDefinitionNode): MutableInputObjectNode;
|
|
34
|
+
export type MutableInputValueNode = {
|
|
35
|
+
directives: ConstDirectiveNode[];
|
|
36
|
+
kind: Kind.INPUT_VALUE_DEFINITION;
|
|
37
|
+
name: NameNode;
|
|
38
|
+
type: MutableTypeNode;
|
|
39
|
+
defaultValue?: ConstValueNode;
|
|
40
|
+
description?: StringValueNode;
|
|
41
|
+
};
|
|
42
|
+
export declare function getMutableInputValueNode(node: InputValueDefinitionNode, parentTypeName: string, fieldName: string): MutableInputValueNode;
|
|
43
|
+
export type MutableInterfaceNode = {
|
|
44
|
+
kind: Kind.INTERFACE_TYPE_DEFINITION;
|
|
45
|
+
name: NameNode;
|
|
46
|
+
description?: StringValueNode;
|
|
47
|
+
directives?: ConstDirectiveNode[];
|
|
48
|
+
fields?: FieldDefinitionNode[];
|
|
49
|
+
interfaces?: NamedTypeNode[];
|
|
50
|
+
};
|
|
51
|
+
export declare function getMutableInterfaceNode(node: InterfaceTypeDefinitionNode): MutableInterfaceNode;
|
|
52
|
+
export type MutableObjectNode = {
|
|
53
|
+
kind: Kind.OBJECT_TYPE_DEFINITION;
|
|
54
|
+
name: NameNode;
|
|
55
|
+
description?: StringValueNode;
|
|
56
|
+
directives?: ConstDirectiveNode[];
|
|
57
|
+
fields?: FieldDefinitionNode[];
|
|
58
|
+
interfaces?: NamedTypeNode[];
|
|
59
|
+
};
|
|
60
|
+
export declare function getMutableObjectNode(node: ObjectTypeDefinitionNode): MutableObjectNode;
|
|
61
|
+
export type MutableObjectExtensionNode = {
|
|
62
|
+
kind: Kind.OBJECT_TYPE_EXTENSION;
|
|
63
|
+
name: NameNode;
|
|
64
|
+
description?: StringValueNode;
|
|
65
|
+
directives?: ConstDirectiveNode[];
|
|
66
|
+
fields?: FieldDefinitionNode[];
|
|
67
|
+
interfaces?: NamedTypeNode[];
|
|
68
|
+
};
|
|
69
|
+
export declare function getMutableObjectExtensionNode(node: ObjectTypeDefinitionNode | ObjectTypeExtensionNode): MutableObjectExtensionNode;
|
|
70
|
+
export type MutableScalarNode = {
|
|
71
|
+
kind: Kind.SCALAR_TYPE_DEFINITION;
|
|
72
|
+
name: NameNode;
|
|
73
|
+
description?: StringValueNode;
|
|
74
|
+
directives?: ConstDirectiveNode[];
|
|
75
|
+
};
|
|
76
|
+
export declare function getMutableScalarNode(node: ScalarTypeDefinitionNode): MutableScalarNode;
|
|
77
|
+
export type MutableIntermediateTypeNode = {
|
|
78
|
+
kind: Kind.NAMED_TYPE | Kind.LIST_TYPE | Kind.NON_NULL_TYPE;
|
|
79
|
+
name?: NameNode;
|
|
80
|
+
type?: MutableIntermediateTypeNode;
|
|
81
|
+
};
|
|
82
|
+
export type MutableTypeNode = MutableNamedTypeNode | MutableListTypeNode | MutableNonNullTypeNode;
|
|
83
|
+
export type MutableNamedTypeNode = {
|
|
84
|
+
kind: Kind.NAMED_TYPE;
|
|
85
|
+
name: NameNode;
|
|
86
|
+
};
|
|
87
|
+
export type MutableListTypeNode = {
|
|
88
|
+
kind: Kind.LIST_TYPE;
|
|
89
|
+
type: MutableTypeNode;
|
|
90
|
+
};
|
|
91
|
+
export type MutableNonNullTypeNode = {
|
|
92
|
+
kind: Kind.NON_NULL_TYPE;
|
|
93
|
+
type: MutableNamedTypeNode | MutableListTypeNode;
|
|
94
|
+
};
|
|
95
|
+
export declare function getMutableTypeNode(node: TypeNode, childPath: string): MutableTypeNode;
|
|
96
|
+
export type MutableUnionNode = {
|
|
97
|
+
kind: Kind.UNION_TYPE_DEFINITION;
|
|
98
|
+
name: NameNode;
|
|
99
|
+
description?: StringValueNode;
|
|
100
|
+
directives?: ConstDirectiveNode[];
|
|
101
|
+
types?: NamedTypeNode[];
|
|
102
|
+
};
|
|
103
|
+
export declare function getMutableUnionNode(node: UnionTypeDefinitionNode): MutableUnionNode;
|
|
104
|
+
export declare function deepCopyTypeNode(node: TypeNode, parentTypeName: string, fieldName: string): TypeNode;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deepCopyTypeNode = exports.getMutableUnionNode = exports.getMutableTypeNode = exports.getMutableScalarNode = exports.getMutableObjectExtensionNode = exports.getMutableObjectNode = exports.getMutableInterfaceNode = exports.getMutableInputValueNode = exports.getMutableInputObjectNode = exports.getMutableFieldNode = exports.getMutableEnumValueNode = exports.getMutableEnumNode = void 0;
|
|
4
|
+
const graphql_1 = require("graphql");
|
|
5
|
+
const utils_1 = require("../ast/utils");
|
|
6
|
+
const errors_1 = require("../errors/errors");
|
|
7
|
+
const constants_1 = require("../utils/constants");
|
|
8
|
+
function getMutableEnumNode(node) {
|
|
9
|
+
return {
|
|
10
|
+
kind: node.kind,
|
|
11
|
+
name: { ...node.name },
|
|
12
|
+
description: (0, utils_1.formatDescription)(node.description),
|
|
13
|
+
values: node.values?.map((value) => getMutableEnumValueNode(value)),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
exports.getMutableEnumNode = getMutableEnumNode;
|
|
17
|
+
function getMutableEnumValueNode(node) {
|
|
18
|
+
return {
|
|
19
|
+
directives: [],
|
|
20
|
+
kind: node.kind,
|
|
21
|
+
name: { ...node.name },
|
|
22
|
+
description: (0, utils_1.formatDescription)(node.description),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
exports.getMutableEnumValueNode = getMutableEnumValueNode;
|
|
26
|
+
function getMutableFieldNode(node, parentTypeName) {
|
|
27
|
+
return {
|
|
28
|
+
arguments: [],
|
|
29
|
+
directives: [],
|
|
30
|
+
kind: node.kind,
|
|
31
|
+
name: { ...node.name },
|
|
32
|
+
type: deepCopyTypeNode(node.type, parentTypeName, node.name.value),
|
|
33
|
+
// arguments: node.arguments?.map(
|
|
34
|
+
// argumentNode => getMutableInputValueNode(argumentNode, parentTypeName, node.name.value),
|
|
35
|
+
// ),
|
|
36
|
+
description: (0, utils_1.formatDescription)(node.description),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
exports.getMutableFieldNode = getMutableFieldNode;
|
|
40
|
+
function getMutableInputObjectNode(node) {
|
|
41
|
+
return {
|
|
42
|
+
kind: node.kind,
|
|
43
|
+
name: { ...node.name },
|
|
44
|
+
description: (0, utils_1.formatDescription)(node.description),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
exports.getMutableInputObjectNode = getMutableInputObjectNode;
|
|
48
|
+
function getMutableInputValueNode(node, parentTypeName, fieldName) {
|
|
49
|
+
return {
|
|
50
|
+
directives: [],
|
|
51
|
+
kind: node.kind,
|
|
52
|
+
name: { ...node.name },
|
|
53
|
+
type: deepCopyTypeNode(node.type, parentTypeName, fieldName),
|
|
54
|
+
defaultValue: node.defaultValue,
|
|
55
|
+
description: (0, utils_1.formatDescription)(node.description),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
exports.getMutableInputValueNode = getMutableInputValueNode;
|
|
59
|
+
function getMutableInterfaceNode(node) {
|
|
60
|
+
return {
|
|
61
|
+
kind: node.kind,
|
|
62
|
+
name: { ...node.name },
|
|
63
|
+
description: (0, utils_1.formatDescription)(node.description),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
exports.getMutableInterfaceNode = getMutableInterfaceNode;
|
|
67
|
+
function getMutableObjectNode(node) {
|
|
68
|
+
return {
|
|
69
|
+
kind: node.kind,
|
|
70
|
+
name: { ...node.name },
|
|
71
|
+
description: (0, utils_1.formatDescription)(node.description),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
exports.getMutableObjectNode = getMutableObjectNode;
|
|
75
|
+
function getMutableObjectExtensionNode(node) {
|
|
76
|
+
const description = node.kind === graphql_1.Kind.OBJECT_TYPE_DEFINITION ? node.description : undefined;
|
|
77
|
+
return {
|
|
78
|
+
kind: graphql_1.Kind.OBJECT_TYPE_EXTENSION,
|
|
79
|
+
name: { ...node.name },
|
|
80
|
+
description: (0, utils_1.formatDescription)(description),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
exports.getMutableObjectExtensionNode = getMutableObjectExtensionNode;
|
|
84
|
+
function getMutableScalarNode(node) {
|
|
85
|
+
return {
|
|
86
|
+
kind: node.kind,
|
|
87
|
+
name: { ...node.name },
|
|
88
|
+
description: (0, utils_1.formatDescription)(node.description),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
exports.getMutableScalarNode = getMutableScalarNode;
|
|
92
|
+
// TODO errors
|
|
93
|
+
function getMutableTypeNode(node, childPath) {
|
|
94
|
+
const deepCopy = { kind: node.kind };
|
|
95
|
+
let lastTypeNode = deepCopy;
|
|
96
|
+
for (let i = 0; i < constants_1.MAXIMUM_TYPE_NESTING; i++) {
|
|
97
|
+
switch (node.kind) {
|
|
98
|
+
case graphql_1.Kind.NAMED_TYPE:
|
|
99
|
+
lastTypeNode.name = { ...node.name };
|
|
100
|
+
return deepCopy;
|
|
101
|
+
case graphql_1.Kind.LIST_TYPE:
|
|
102
|
+
lastTypeNode.kind = node.kind;
|
|
103
|
+
lastTypeNode.type = { kind: node.type.kind };
|
|
104
|
+
lastTypeNode = lastTypeNode.type;
|
|
105
|
+
node = node.type;
|
|
106
|
+
continue;
|
|
107
|
+
case graphql_1.Kind.NON_NULL_TYPE:
|
|
108
|
+
lastTypeNode.kind = node.kind;
|
|
109
|
+
lastTypeNode.type = { kind: node.type.kind };
|
|
110
|
+
lastTypeNode = lastTypeNode.type;
|
|
111
|
+
node = node.type;
|
|
112
|
+
continue;
|
|
113
|
+
default:
|
|
114
|
+
throw (0, errors_1.unexpectedTypeNodeKindFatalError)(childPath);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
throw new Error(`Field ${childPath} has more than ${constants_1.MAXIMUM_TYPE_NESTING} layers of nesting, or there is a cyclical error.`);
|
|
118
|
+
}
|
|
119
|
+
exports.getMutableTypeNode = getMutableTypeNode;
|
|
120
|
+
function getMutableUnionNode(node) {
|
|
121
|
+
return {
|
|
122
|
+
kind: node.kind,
|
|
123
|
+
name: { ...node.name },
|
|
124
|
+
description: (0, utils_1.formatDescription)(node.description),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
exports.getMutableUnionNode = getMutableUnionNode;
|
|
128
|
+
// TODO reduce arguments and refactor errors
|
|
129
|
+
function deepCopyTypeNode(node, parentTypeName, fieldName) {
|
|
130
|
+
const deepCopy = { kind: node.kind };
|
|
131
|
+
let lastTypeNode = deepCopy;
|
|
132
|
+
for (let i = 0; i < constants_1.MAXIMUM_TYPE_NESTING; i++) {
|
|
133
|
+
switch (node.kind) {
|
|
134
|
+
case graphql_1.Kind.NAMED_TYPE:
|
|
135
|
+
lastTypeNode.name = { ...node.name };
|
|
136
|
+
return deepCopy;
|
|
137
|
+
case graphql_1.Kind.LIST_TYPE:
|
|
138
|
+
lastTypeNode.kind = node.kind;
|
|
139
|
+
lastTypeNode.type = { kind: node.type.kind };
|
|
140
|
+
lastTypeNode = lastTypeNode.type;
|
|
141
|
+
node = node.type;
|
|
142
|
+
continue;
|
|
143
|
+
case graphql_1.Kind.NON_NULL_TYPE:
|
|
144
|
+
lastTypeNode.kind = node.kind;
|
|
145
|
+
lastTypeNode.type = { kind: node.type.kind };
|
|
146
|
+
lastTypeNode = lastTypeNode.type;
|
|
147
|
+
node = node.type;
|
|
148
|
+
continue;
|
|
149
|
+
default:
|
|
150
|
+
throw (0, errors_1.federationUnexpectedNodeKindError)(parentTypeName, fieldName);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
throw new Error(`Field ${parentTypeName}.${fieldName} has more than ${constants_1.MAXIMUM_TYPE_NESTING} layers of nesting, or there is a cyclical error.`);
|
|
154
|
+
}
|
|
155
|
+
exports.deepCopyTypeNode = deepCopyTypeNode;
|
|
156
|
+
//# sourceMappingURL=ast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast.js","sourceRoot":"","sources":["../../src/schema-building/ast.ts"],"names":[],"mappings":";;;AAAA,qCAkBiB;AACjB,wCAAiD;AACjD,6CAAuG;AACvG,kDAA0D;AAU1D,SAAgB,kBAAkB,CAAC,IAA4B;IAC7D,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,IAAI,EAAE,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE;QACtB,WAAW,EAAE,IAAA,yBAAiB,EAAC,IAAI,CAAC,WAAW,CAAC;QAChD,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC;KACpE,CAAC;AACJ,CAAC;AAPD,gDAOC;AASD,SAAgB,uBAAuB,CAAC,IAA6B;IACnE,OAAO;QACL,UAAU,EAAE,EAAE;QACd,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,IAAI,EAAE,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE;QACtB,WAAW,EAAE,IAAA,yBAAiB,EAAC,IAAI,CAAC,WAAW,CAAC;KACjD,CAAC;AACJ,CAAC;AAPD,0DAOC;AAWD,SAAgB,mBAAmB,CAAC,IAAyB,EAAE,cAAsB;IACnF,OAAO;QACL,SAAS,EAAE,EAAE;QACb,UAAU,EAAE,EAAE;QACd,IAAI,EAAE,IAAI,CAAC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C,IAAI,EAAE;YACjB,KAAK,cAAI,CAAC,UAAU;gBAClB,YAAY,CAAC,IAAI,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;gBACrC,OAAO,QAAoB,CAAC;YAC9B,KAAK,cAAI,CAAC,SAAS;gBACjB,YAAY,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;gBAC9B,YAAY,CAAC,IAAI,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;gBAC7C,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC;gBACjC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;gBACjB,SAAS;YACX,KAAK,cAAI,CAAC,aAAa;gBACrB,YAAY,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;gBAC9B,YAAY,CAAC,IAAI,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;gBAC7C,YAAY,GAAG,YAAY,CAAC,IAAI,CAAC;gBACjC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;gBACjB,SAAS;YACX;gBACE,MAAM,IAAA,0CAAiC,EAAC,cAAc,EAAE,SAAS,CAAC,CAAC;SACtE;KACF;IACD,MAAM,IAAI,KAAK,CACb,SAAS,cAAc,IAAI,SAAS,kBAAkB,gCAAoB,mDAAmD,CAC9H,CAAC;AACJ,CAAC;AA3BD,4CA2BC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { ConstDirectiveNode, ConstValueNode, Kind, NamedTypeNode, OperationTypeDefinitionNode, OperationTypeNode, StringValueNode } from 'graphql';
|
|
2
|
+
import { MutableEnumNode, MutableEnumValueNode, MutableFieldNode, MutableInputObjectNode, MutableInputValueNode, MutableInterfaceNode, MutableObjectNode, MutableScalarNode, MutableTypeNode, MutableUnionNode } from './ast';
|
|
3
|
+
import { ExtensionWithFieldsData } from './type-extension-data';
|
|
4
|
+
export type ArgumentData = {
|
|
5
|
+
directivesByDirectiveName: Map<string, ConstDirectiveNode[]>;
|
|
6
|
+
name: string;
|
|
7
|
+
node: MutableInputValueNode;
|
|
8
|
+
requiredSubgraphNames: Set<string>;
|
|
9
|
+
subgraphNames: Set<string>;
|
|
10
|
+
type: MutableTypeNode;
|
|
11
|
+
defaultValue?: ConstValueNode;
|
|
12
|
+
description?: StringValueNode;
|
|
13
|
+
};
|
|
14
|
+
export type EnumDefinitionData = {
|
|
15
|
+
appearances: number;
|
|
16
|
+
directivesByDirectiveName: Map<string, ConstDirectiveNode[]>;
|
|
17
|
+
enumValueDataByValueName: Map<string, EnumValueData>;
|
|
18
|
+
kind: Kind.ENUM_TYPE_DEFINITION;
|
|
19
|
+
typeName: string;
|
|
20
|
+
node: MutableEnumNode;
|
|
21
|
+
description?: StringValueNode;
|
|
22
|
+
};
|
|
23
|
+
export type EnumValueData = {
|
|
24
|
+
appearances: number;
|
|
25
|
+
directivesByDirectiveName: Map<string, ConstDirectiveNode[]>;
|
|
26
|
+
name: string;
|
|
27
|
+
node: MutableEnumValueNode;
|
|
28
|
+
parentTypeName: string;
|
|
29
|
+
description?: StringValueNode;
|
|
30
|
+
};
|
|
31
|
+
export type FieldData = {
|
|
32
|
+
argumentDataByArgumentName: Map<string, ArgumentData>;
|
|
33
|
+
directivesByDirectiveName: Map<string, ConstDirectiveNode[]>;
|
|
34
|
+
isExternalBySubgraphName: Map<string, boolean>;
|
|
35
|
+
isShareableBySubgraphName: Map<string, boolean>;
|
|
36
|
+
name: string;
|
|
37
|
+
namedTypeName: string;
|
|
38
|
+
node: MutableFieldNode;
|
|
39
|
+
parentTypeName: string;
|
|
40
|
+
subgraphNames: Set<string>;
|
|
41
|
+
description?: StringValueNode;
|
|
42
|
+
};
|
|
43
|
+
export type InputObjectDefinitionData = {
|
|
44
|
+
appearances: number;
|
|
45
|
+
directivesByDirectiveName: Map<string, ConstDirectiveNode[]>;
|
|
46
|
+
inputValueDataByValueName: Map<string, InputValueData>;
|
|
47
|
+
kind: Kind.INPUT_OBJECT_TYPE_DEFINITION;
|
|
48
|
+
typeName: string;
|
|
49
|
+
node: MutableInputObjectNode;
|
|
50
|
+
description?: StringValueNode;
|
|
51
|
+
};
|
|
52
|
+
export type InputValueData = {
|
|
53
|
+
appearances: number;
|
|
54
|
+
directivesByDirectiveName: Map<string, ConstDirectiveNode[]>;
|
|
55
|
+
name: string;
|
|
56
|
+
node: MutableInputValueNode;
|
|
57
|
+
parentTypeName: string;
|
|
58
|
+
description?: StringValueNode;
|
|
59
|
+
};
|
|
60
|
+
export type InterfaceData = {
|
|
61
|
+
directivesByDirectiveName: Map<string, ConstDirectiveNode[]>;
|
|
62
|
+
fieldDataByFieldName: Map<string, FieldData>;
|
|
63
|
+
implementedInterfaceTypeNames: Set<string>;
|
|
64
|
+
isEntity: boolean;
|
|
65
|
+
kind: Kind.INTERFACE_TYPE_DEFINITION;
|
|
66
|
+
typeName: string;
|
|
67
|
+
node: MutableInterfaceNode;
|
|
68
|
+
subgraphNames: Set<string>;
|
|
69
|
+
description?: StringValueNode;
|
|
70
|
+
};
|
|
71
|
+
export type ObjectData = {
|
|
72
|
+
directivesByDirectiveName: Map<string, ConstDirectiveNode[]>;
|
|
73
|
+
fieldDataByFieldName: Map<string, FieldData>;
|
|
74
|
+
implementedInterfaceTypeNames: Set<string>;
|
|
75
|
+
isEntity: boolean;
|
|
76
|
+
isRootType: boolean;
|
|
77
|
+
kind: Kind.OBJECT_TYPE_DEFINITION;
|
|
78
|
+
typeName: string;
|
|
79
|
+
node: MutableObjectNode;
|
|
80
|
+
subgraphNames: Set<string>;
|
|
81
|
+
description?: StringValueNode;
|
|
82
|
+
};
|
|
83
|
+
export type ScalarDefinitionData = {
|
|
84
|
+
directivesByDirectiveName: Map<string, ConstDirectiveNode[]>;
|
|
85
|
+
kind: Kind.SCALAR_TYPE_DEFINITION;
|
|
86
|
+
typeName: string;
|
|
87
|
+
node: MutableScalarNode;
|
|
88
|
+
description?: StringValueNode;
|
|
89
|
+
};
|
|
90
|
+
export type SchemaData = {
|
|
91
|
+
directivesByDirectiveName: Map<string, ConstDirectiveNode[]>;
|
|
92
|
+
kind: Kind.SCHEMA_DEFINITION;
|
|
93
|
+
typeName: string;
|
|
94
|
+
operationTypes: Map<OperationTypeNode, OperationTypeDefinitionNode>;
|
|
95
|
+
description?: StringValueNode;
|
|
96
|
+
};
|
|
97
|
+
export type UnionDefinitionData = {
|
|
98
|
+
directivesByDirectiveName: Map<string, ConstDirectiveNode[]>;
|
|
99
|
+
kind: Kind.UNION_TYPE_DEFINITION;
|
|
100
|
+
typeName: string;
|
|
101
|
+
memberByMemberTypeName: Map<string, NamedTypeNode>;
|
|
102
|
+
node: MutableUnionNode;
|
|
103
|
+
description?: StringValueNode;
|
|
104
|
+
};
|
|
105
|
+
export type ParentDefinitionData = EnumDefinitionData | InputObjectDefinitionData | InterfaceData | ObjectData | ScalarDefinitionData | UnionDefinitionData;
|
|
106
|
+
export type ParentWithFieldsData = DefinitionWithFieldsData | ExtensionWithFieldsData;
|
|
107
|
+
export type ChildData = EnumValueData | FieldData | InputValueData;
|
|
108
|
+
export type DefinitionWithFieldsData = InterfaceData | ObjectData;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-definition-data.js","sourceRoot":"","sources":["../../src/schema-building/type-definition-data.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ConstDirectiveNode, Kind, NamedTypeNode } from 'graphql';
|
|
2
|
+
import { EnumValueData, FieldData, InputValueData } from './type-definition-data';
|
|
3
|
+
import { MutableObjectExtensionNode } from './ast';
|
|
4
|
+
export type EnumExtensionData = {
|
|
5
|
+
directivesByDirectiveName: Map<string, ConstDirectiveNode[]>;
|
|
6
|
+
enumValueDataByValueName: Map<string, EnumValueData>;
|
|
7
|
+
kind: Kind.ENUM_TYPE_EXTENSION;
|
|
8
|
+
typeName: string;
|
|
9
|
+
};
|
|
10
|
+
export type ObjectExtensionData = {
|
|
11
|
+
directivesByDirectiveName: Map<string, ConstDirectiveNode[]>;
|
|
12
|
+
fieldDataByFieldName: Map<string, FieldData>;
|
|
13
|
+
implementedInterfaceTypeNames: Set<string>;
|
|
14
|
+
isEntity: boolean;
|
|
15
|
+
kind: Kind.OBJECT_TYPE_EXTENSION;
|
|
16
|
+
node: MutableObjectExtensionNode;
|
|
17
|
+
typeName: string;
|
|
18
|
+
};
|
|
19
|
+
export type InputObjectExtensionData = {
|
|
20
|
+
directivesByDirectiveName: Map<string, ConstDirectiveNode[]>;
|
|
21
|
+
inputValueDataByValueName: Map<string, InputValueData>;
|
|
22
|
+
kind: Kind.INPUT_OBJECT_TYPE_EXTENSION;
|
|
23
|
+
typeName: String;
|
|
24
|
+
};
|
|
25
|
+
export type InterfaceExtensionData = {
|
|
26
|
+
directivesByDirectiveName: Map<string, ConstDirectiveNode[]>;
|
|
27
|
+
fieldDataByFieldName: Map<string, FieldData>;
|
|
28
|
+
implementedInterfaceTypeNames: Set<string>;
|
|
29
|
+
isEntity: boolean;
|
|
30
|
+
kind: Kind.INTERFACE_TYPE_EXTENSION;
|
|
31
|
+
typeName: string;
|
|
32
|
+
};
|
|
33
|
+
export type ScalarExtensionData = {
|
|
34
|
+
directivesByDirectiveName: Map<string, ConstDirectiveNode[]>;
|
|
35
|
+
kind: Kind.SCALAR_TYPE_EXTENSION;
|
|
36
|
+
typeName: string;
|
|
37
|
+
};
|
|
38
|
+
export type UnionExtensionData = {
|
|
39
|
+
directivesByDirectiveName: Map<string, ConstDirectiveNode[]>;
|
|
40
|
+
kind: Kind.UNION_TYPE_EXTENSION;
|
|
41
|
+
memberByMemberTypeName: Map<string, NamedTypeNode>;
|
|
42
|
+
typeName: string;
|
|
43
|
+
};
|
|
44
|
+
export type ParentExtensionData = EnumExtensionData | InputObjectExtensionData | InterfaceExtensionData | ObjectExtensionData | ScalarExtensionData | UnionExtensionData;
|
|
45
|
+
export type ExtensionWithFieldsData = InterfaceExtensionData | ObjectExtensionData;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-extension-data.js","sourceRoot":"","sources":["../../src/schema-building/type-extension-data.ts"],"names":[],"mappings":""}
|
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getNamedTypeForChild = exports.isTypeRequired = exports.getMostRestrictiveMergedTypeNode = exports.getLeastRestrictiveMergedTypeNode = void 0;
|
|
4
4
|
const graphql_1 = require("graphql");
|
|
5
5
|
const errors_1 = require("../errors/errors");
|
|
6
|
-
const ast_1 = require("
|
|
6
|
+
const ast_1 = require("./ast");
|
|
7
|
+
const constants_1 = require("../utils/constants");
|
|
7
8
|
var DivergentType;
|
|
8
9
|
(function (DivergentType) {
|
|
9
10
|
DivergentType[DivergentType["NONE"] = 0] = "NONE";
|
|
@@ -18,7 +19,7 @@ function getMergedTypeNode(current, other, parentName, childName, mostRestrictiv
|
|
|
18
19
|
const mergedTypeNode = { kind: current.kind };
|
|
19
20
|
let divergentType = DivergentType.NONE;
|
|
20
21
|
let lastTypeNode = mergedTypeNode;
|
|
21
|
-
for (let i = 0; i <
|
|
22
|
+
for (let i = 0; i < constants_1.MAXIMUM_TYPE_NESTING; i++) {
|
|
22
23
|
if (current.kind === other.kind) {
|
|
23
24
|
switch (current.kind) {
|
|
24
25
|
case graphql_1.Kind.NAMED_TYPE:
|
|
@@ -82,7 +83,7 @@ function getMergedTypeNode(current, other, parentName, childName, mostRestrictiv
|
|
|
82
83
|
// At least one of the types must be a non-null wrapper, or the types are inconsistent
|
|
83
84
|
return { typeErrors: [current.kind, other.kind] };
|
|
84
85
|
}
|
|
85
|
-
throw new Error(`Field ${parentName}.${childName} has more than ${
|
|
86
|
+
throw new Error(`Field ${parentName}.${childName} has more than ${constants_1.MAXIMUM_TYPE_NESTING} layers of nesting, or there is a cyclical error.`);
|
|
86
87
|
}
|
|
87
88
|
function getLeastRestrictiveMergedTypeNode(current, other, parentName, childName) {
|
|
88
89
|
return getMergedTypeNode(current, other, parentName, childName, false);
|
|
@@ -105,7 +106,7 @@ function getNamedTypeForChild(childPath, typeNode) {
|
|
|
105
106
|
case graphql_1.Kind.NON_NULL_TYPE:
|
|
106
107
|
return getNamedTypeForChild(childPath, typeNode.type);
|
|
107
108
|
default:
|
|
108
|
-
throw (0, errors_1.
|
|
109
|
+
throw (0, errors_1.unexpectedTypeNodeKindFatalError)(childPath);
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
112
|
exports.getNamedTypeForChild = getNamedTypeForChild;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-merging.js","sourceRoot":"","sources":["../../src/schema-building/type-merging.ts"],"names":[],"mappings":";;;AAAA,qCAAuF;AACvF,6CAAuG;AACvG,+BAAsE;AACtE,kDAA0D;AAE1D,IAAK,aAIJ;AAJD,WAAK,aAAa;IAChB,iDAAI,CAAA;IACJ,uDAAO,CAAA;IACP,mDAAK,CAAA;AACP,CAAC,EAJI,aAAa,KAAb,aAAa,QAIjB;AAOD,SAAS,iBAAiB,CACxB,OAAiB,EACjB,KAAe,EACf,UAAkB,EAClB,SAAiB,EACjB,eAAwB;IAExB,KAAK,GAAG,IAAA,sBAAgB,EAAC,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,iCAAiC;IACzF,mGAAmG;IACnG,iEAAiE;IACjE,sFAAsF;IACtF,MAAM,cAAc,GAAgC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;IAC3E,IAAI,aAAa,GAAG,aAAa,CAAC,IAAI,CAAC;IACvC,IAAI,YAAY,GAAgC,cAAc,CAAC;IAC/D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,gCAAoB,EAAE,CAAC,EAAE,EAAE;QAC7C,IAAI,OAAO,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,EAAE;YAC/B,QAAQ,OAAO,CAAC,IAAI,EAAE;gBACpB,KAAK,cAAI,CAAC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jB,KAAe,EACf,UAAkB,EAClB,SAAiB;IAEjB,OAAO,iBAAiB,CAAC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;AACzE,CAAC;AAPD,8EAOC;AAED,SAAgB,gCAAgC,CAC9C,OAAiB,EACjB,KAAe,EACf,UAAkB,EAClB,SAAiB;IAEjB,OAAO,iBAAiB,CAAC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AACxE,CAAC;AAPD,4EAOC;AAED,SAAgB,cAAc,CAAC,IAAc;IAC3C,OAAO,IAAI,CAAC,IAAI,KAAK,cAAI,CAAC,aAAa,CAAC;AAC1C,CAAC;AAFD,wCAEC;AAED,SAAgB,oBAAoB,CAAC,SAAiB,EAAE,QAAkB;IACxE,QAAQ,QAAQ,CAAC,IAAI,EAAE;QACrB,KAAK,cAAI,CAAC,UAAU;YAClB,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;QAC7B,KAAK,cAAI,CAAC,SAAS,CAAC;QACpB,0BAA0B;QAC1B,KAAK,cAAI,CAAC,aAAa;YACrB,OAAO,oBAAoB,CAAC,SAAS,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;QACxD;YACE,MAAM,IAAA,yCAAgC,EAAC,SAAS,CAAC,CAAC;KACrD;AACH,CAAC;AAXD,oDAWC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ConstDirectiveNode, DirectiveDefinitionNode, EnumTypeDefinitionNode, EnumTypeExtensionNode, EnumValueDefinitionNode, FieldDefinitionNode, InputObjectTypeDefinitionNode, InputObjectTypeExtensionNode, InputValueDefinitionNode, InterfaceTypeDefinitionNode, InterfaceTypeExtensionNode, Kind, NamedTypeNode, ObjectTypeDefinitionNode, ObjectTypeExtensionNode, OperationTypeNode, ScalarTypeDefinitionNode, ScalarTypeExtensionNode, SchemaDefinitionNode, TypeNode, UnionTypeDefinitionNode, UnionTypeExtensionNode } from 'graphql';
|
|
2
|
+
import { ArgumentData, DefinitionWithFieldsData, EnumDefinitionData, EnumValueData, FieldData, InputObjectDefinitionData, InputValueData, ParentDefinitionData, ScalarDefinitionData, SchemaData, UnionDefinitionData } from './type-definition-data';
|
|
3
|
+
import { InputObjectTypeNode, InterfaceTypeNode, ObjectTypeNode, SchemaNode, UnionTypeNode } from '../ast/utils';
|
|
4
|
+
import { EnumExtensionData, ExtensionWithFieldsData, InputObjectExtensionData, ObjectExtensionData, ParentExtensionData, ScalarExtensionData, UnionExtensionData } from './type-extension-data';
|
|
5
|
+
import { AuthorizationData } from '../utils/utils';
|
|
6
|
+
type IsNodeExternalOrShareableResult = {
|
|
7
|
+
isExternal: boolean;
|
|
8
|
+
isShareable: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare function isNodeExternalOrShareable(node: ObjectTypeNode | FieldDefinitionNode, areAllFieldsShareable: boolean, directivesByDirectiveName: Map<string, ConstDirectiveNode[]>): IsNodeExternalOrShareableResult;
|
|
11
|
+
export declare function getDefinedArgumentsForDirective(directiveNode: ConstDirectiveNode, argumentTypeNodeByArgumentName: Map<string, TypeNode>, requiredArguments: Set<string>, hostPath: string, errorMessages: string[]): Set<string>;
|
|
12
|
+
export declare function getDirectiveValidationErrors(directiveNode: ConstDirectiveNode, hostKind: Kind, directivesByDirectiveName: Map<string, ConstDirectiveNode[]>, directiveDefinitionByDirectiveName: Map<string, DirectiveDefinitionNode>, handledRepeatedDirectivesByHostPath: Map<string, Set<string>>, hostPath: string, isArgument?: boolean): string[];
|
|
13
|
+
export declare function extractDirectives(node: EnumValueDefinitionNode | InputObjectTypeNode | InputValueDefinitionNode | InterfaceTypeNode | ObjectTypeNode | SchemaNode | UnionTypeNode, directivesByDirectiveName: Map<string, ConstDirectiveNode[]>, errors: Error[], directiveDefinitionByDirectiveName: Map<string, DirectiveDefinitionNode>, handledRepeatedDirectivesByHostPath: Map<string, Set<string>>, hostPath: string, isArgument?: boolean): Map<string, ConstDirectiveNode[]>;
|
|
14
|
+
export declare function extractArguments(argumentDataByArgumentName: Map<string, ArgumentData>, node: FieldDefinitionNode, errors: Error[], directiveDefinitionByDirectiveName: Map<string, DirectiveDefinitionNode>, handledRepeatedDirectivesByHostPath: Map<string, Set<string>>, parentsWithChildArguments: Set<string>, parentTypeName: string, subgraphName: string): Map<string, ArgumentData>;
|
|
15
|
+
export declare function upsertArgumentDataByNode(argumentDataByArgumentName: Map<string, ArgumentData>, node: InputValueDefinitionNode, errors: Error[], directiveDefinitionByDirectiveName: Map<string, DirectiveDefinitionNode>, handledRepeatedDirectivesByHostPath: Map<string, Set<string>>, parentTypeName: string, fieldName: string, subgraphName: string): void;
|
|
16
|
+
export declare function upsertEnumDefinitionDataByNode(parentDefinitionDataByTypeName: Map<string, ParentDefinitionData>, node: EnumTypeDefinitionNode, directivesByDirectiveName: Map<string, ConstDirectiveNode[]>): void;
|
|
17
|
+
export declare function upsertEnumExtensionDataByNode(parentExtensionDataByTypeName: Map<string, ParentExtensionData>, node: EnumTypeExtensionNode, directivesByDirectiveName: Map<string, ConstDirectiveNode[]>): void;
|
|
18
|
+
export declare function upsertEnumValueDataByNode(enumValueDataByValueName: Map<string, EnumValueData>, node: EnumValueDefinitionNode, errors: Error[], directiveDefinitionByDirectiveName: Map<string, DirectiveDefinitionNode>, handledRepeatedDirectivesByHostPath: Map<string, Set<string>>, parentTypeName: string): void;
|
|
19
|
+
export declare function addInheritedDirectivesToFieldData(parentDirectivesByDirectiveName: Map<string, ConstDirectiveNode[]>, fieldDirectivesByDirectiveName: Map<string, ConstDirectiveNode[]>): Map<string, ConstDirectiveNode[]>;
|
|
20
|
+
export declare function upsertFieldDataByNode(fieldDataByFieldName: Map<string, FieldData>, node: FieldDefinitionNode, errors: Error[], argumentDataByArgumentName: Map<string, ArgumentData>, directivesByDirectiveName: Map<string, ConstDirectiveNode[]>, parentTypeName: string, subgraphName: string, isSubgraphVersionTwo: boolean): FieldData;
|
|
21
|
+
export declare function upsertExtensionWithFieldsDataByNode(parentExtensionDataByTypeName: Map<string, ParentExtensionData>, node: InterfaceTypeDefinitionNode | InterfaceTypeExtensionNode | ObjectTypeDefinitionNode | ObjectTypeExtensionNode, errors: Error[], directiveDefinitionByDirectiveName: Map<string, DirectiveDefinitionNode>, handledRepeatedDirectivesByHostPath: Map<string, Set<string>>, isEntity: boolean): void;
|
|
22
|
+
export declare function upsertInputObjectDefinitionDataByNode(parentDefinitionDataByTypeName: Map<string, ParentDefinitionData>, node: InputObjectTypeDefinitionNode, errors: Error[], directiveDefinitionByDirectiveName: Map<string, DirectiveDefinitionNode>, handledRepeatedDirectivesByHostPath: Map<string, Set<string>>): void;
|
|
23
|
+
export declare function upsertInputObjectExtensionDataByNode(parentExtensionDataByTypeName: Map<string, ParentExtensionData>, node: InputObjectTypeExtensionNode, errors: Error[], directiveDefinitionByDirectiveName: Map<string, DirectiveDefinitionNode>, handledRepeatedDirectivesByHostPath: Map<string, Set<string>>): void;
|
|
24
|
+
export declare function upsertInputValueDataByNode(inputValueDataByValueName: Map<string, InputValueData>, node: InputValueDefinitionNode, errors: Error[], directiveDefinitionByDirectiveName: Map<string, DirectiveDefinitionNode>, handledRepeatedDirectivesByHostPath: Map<string, Set<string>>, parentTypeName: string): void;
|
|
25
|
+
export declare function upsertInterfaceDefinitionDataByNode(parentDefinitionDataByTypeName: Map<string, ParentDefinitionData>, node: InterfaceTypeDefinitionNode, errors: Error[], directiveDefinitionByDirectiveName: Map<string, DirectiveDefinitionNode>, handledRepeatedDirectivesByHostPath: Map<string, Set<string>>, isEntity: boolean, subgraphName: string): void;
|
|
26
|
+
export declare function upsertObjectDefinitionDataByNode(parentDefinitionDataByTypeName: Map<string, ParentDefinitionData>, node: ObjectTypeDefinitionNode, errors: Error[], directiveDefinitionByDirectiveName: Map<string, DirectiveDefinitionNode>, handledRepeatedDirectivesByHostPath: Map<string, Set<string>>, isEntity: boolean, isRootType: boolean, subgraphName: string): void;
|
|
27
|
+
export declare function upsertScalarDefinitionDataByNode(parentDefinitionDataByTypeName: Map<string, ParentDefinitionData>, node: ScalarTypeDefinitionNode, directivesByDirectiveName: Map<string, ConstDirectiveNode[]>): void;
|
|
28
|
+
export declare function upsertScalarExtensionDataByNode(parentExtensionDataByTypeName: Map<string, ParentExtensionData>, node: ScalarTypeExtensionNode, directivesByDirectiveName: Map<string, ConstDirectiveNode[]>): void;
|
|
29
|
+
export declare function extractUniqueUnionMembers(members: readonly NamedTypeNode[], membersByMemberTypeName: Map<string, NamedTypeNode>, errors: Error[], unionTypeName: string, abstractToConcreteTypeNames: Map<string, Set<string>>, referencedTypeNames: Set<string>): Map<string, NamedTypeNode>;
|
|
30
|
+
export declare function upsertUnionDefinitionDataByNode(parentDefinitionDataByTypeName: Map<string, ParentDefinitionData>, node: UnionTypeDefinitionNode, errors: Error[], directiveDefinitionByDirectiveName: Map<string, DirectiveDefinitionNode>, handledRepeatedDirectivesByHostPath: Map<string, Set<string>>, abstractToConcreteTypeNames: Map<string, Set<string>>, referencedTypeNames: Set<string>): void;
|
|
31
|
+
export declare function upsertUnionExtensionDataByNode(parentExtensionDataByTypeName: Map<string, ParentExtensionData>, node: UnionTypeExtensionNode, errors: Error[], directiveDefinitionByDirectiveName: Map<string, DirectiveDefinitionNode>, handledRepeatedDirectivesByHostPath: Map<string, Set<string>>, abstractToConcreteTypeNames: Map<string, Set<string>>, referencedTypeNames: Set<string>): void;
|
|
32
|
+
export declare function isTypeNameRootType(typeName: string, operationByTypeName: Map<string, OperationTypeNode>): boolean;
|
|
33
|
+
export declare function convertKindForExtension(node: InterfaceTypeDefinitionNode | InterfaceTypeExtensionNode | ObjectTypeDefinitionNode | ObjectTypeExtensionNode): Kind.INTERFACE_TYPE_EXTENSION | Kind.OBJECT_TYPE_EXTENSION;
|
|
34
|
+
export declare function extractImplementedInterfaceTypeNames(node: InterfaceTypeDefinitionNode | InterfaceTypeExtensionNode | ObjectTypeDefinitionNode | ObjectTypeExtensionNode, implementedInterfaceTypeNames: Set<string>, errors?: Error[]): Set<string>;
|
|
35
|
+
export declare function getEnumNodeByData(enumDefinitionData: EnumDefinitionData, errors: Error[], directiveDefinitionByDirectiveName: Map<string, DirectiveDefinitionNode>, authorizationDataByParentTypeName: Map<string, AuthorizationData>, enumExtensionData?: EnumExtensionData): import("./ast").MutableEnumNode;
|
|
36
|
+
export declare function getInputObjectNodeByData(inputObjectDefinitionData: InputObjectDefinitionData, errors: Error[], directiveDefinitionByDirectiveName: Map<string, DirectiveDefinitionNode>, authorizationDataByParentTypeName: Map<string, AuthorizationData>, inputObjectExtensionData?: InputObjectExtensionData): import("./ast").MutableInputObjectNode;
|
|
37
|
+
export declare function getParentWithFieldsNodeByData(parentWithFieldsData: DefinitionWithFieldsData | ObjectExtensionData, errors: Error[], directiveDefinitionByDirectiveName: Map<string, DirectiveDefinitionNode>, authorizationDataByParentTypeName: Map<string, AuthorizationData>, parentExtensionWithFieldsData?: ExtensionWithFieldsData): ObjectTypeDefinitionNode | InterfaceTypeDefinitionNode | ObjectTypeExtensionNode;
|
|
38
|
+
export declare function getScalarNodeByData(scalarDefinitionData: ScalarDefinitionData, errors: Error[], directiveDefinitionByDirectiveName: Map<string, DirectiveDefinitionNode>, scalarExtensionData?: ScalarExtensionData): import("./ast").MutableScalarNode;
|
|
39
|
+
export declare function getSchemaNodeByData(schemaData: SchemaData, errors: Error[], directiveDefinitionByDirectiveName: Map<string, DirectiveDefinitionNode>): SchemaDefinitionNode;
|
|
40
|
+
export declare function getUnionNodeByData(unionDefinitionData: UnionDefinitionData, errors: Error[], directiveDefinitionByDirectiveName: Map<string, DirectiveDefinitionNode>, unionExtensionData?: UnionExtensionData): import("./ast").MutableUnionNode;
|
|
41
|
+
export declare function removeInheritableDirectivesFromParentWithFieldsData(parentData: ParentDefinitionData | ParentExtensionData): void;
|
|
42
|
+
export {};
|