@wundergraph/composition 0.0.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/LICENSE +18 -0
- package/README.md +3 -0
- package/dist/ast/ast.d.ts +84 -0
- package/dist/ast/ast.js +183 -0
- package/dist/ast/ast.js.map +1 -0
- package/dist/ast/utils.d.ts +130 -0
- package/dist/ast/utils.js +298 -0
- package/dist/ast/utils.js.map +1 -0
- package/dist/buildASTSchema/buildASTSchema.d.ts +22 -0
- package/dist/buildASTSchema/buildASTSchema.js +59 -0
- package/dist/buildASTSchema/buildASTSchema.js.map +1 -0
- package/dist/buildASTSchema/extendSchema.d.ts +21 -0
- package/dist/buildASTSchema/extendSchema.js +555 -0
- package/dist/buildASTSchema/extendSchema.js.map +1 -0
- package/dist/errors/errors.d.ts +60 -0
- package/dist/errors/errors.js +302 -0
- package/dist/errors/errors.js.map +1 -0
- package/dist/federation/federation-factory.d.ts +58 -0
- package/dist/federation/federation-factory.js +843 -0
- package/dist/federation/federation-factory.js.map +1 -0
- package/dist/federation/federation-result.d.ts +6 -0
- package/dist/federation/federation-result.js +10 -0
- package/dist/federation/federation-result.js.map +1 -0
- package/dist/federation/subgraph.d.ts +18 -0
- package/dist/federation/subgraph.js +305 -0
- package/dist/federation/subgraph.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/normalization/normalization-factory.d.ts +54 -0
- package/dist/normalization/normalization-factory.js +882 -0
- package/dist/normalization/normalization-factory.js.map +1 -0
- package/dist/normalization/utils.d.ts +121 -0
- package/dist/normalization/utils.js +278 -0
- package/dist/normalization/utils.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/type-merging/type-merging.d.ts +9 -0
- package/dist/type-merging/type-merging.js +112 -0
- package/dist/type-merging/type-merging.js.map +1 -0
- package/dist/utils/constants.d.ts +6 -0
- package/dist/utils/constants.js +157 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/string-constants.d.ts +39 -0
- package/dist/utils/string-constants.js +43 -0
- package/dist/utils/string-constants.js.map +1 -0
- package/dist/utils/utils.d.ts +7 -0
- package/dist/utils/utils.js +80 -0
- package/dist/utils/utils.js.map +1 -0
- package/package.json +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Limited Testing License (LTL)
|
|
2
|
+
|
|
3
|
+
Licensor: WunderGraph, Inc.
|
|
4
|
+
Licensed Work: "@wundergraph/composition" package. The licensed work is (c) 2023 by WunderGraph, Inc.
|
|
5
|
+
|
|
6
|
+
Notice
|
|
7
|
+
The Limited Testing License (this document, or the "License", or "LTL") is a proprietary, closed-source license.
|
|
8
|
+
|
|
9
|
+
Terms
|
|
10
|
+
The Licensor hereby grants you a non-exclusive, non-transferable, limited right to use the Licensed Work strictly for the purpose of internal evaluation and testing within your environment.
|
|
11
|
+
You are not permitted to use the Licensed Work in any other way, explicitly not for commercial or production use.
|
|
12
|
+
You may not redistribute or sublicense the Licensed Work, in whole or in part, or create derivative works of the Licensed Work.
|
|
13
|
+
You are not permitted to use the Licensed Work after September 30th, 2023.
|
|
14
|
+
Any use of the Licensed Work in violation of this License will automatically terminate your rights under this License for the current and all other versions of the Licensed Work.
|
|
15
|
+
|
|
16
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN “AS IS” BASIS.
|
|
17
|
+
LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION)
|
|
18
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE.
|
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { BooleanValueNode, ConstValueNode, DirectiveDefinitionNode, EnumTypeDefinitionNode, EnumValueDefinitionNode, EnumValueNode, FieldDefinitionNode, FloatValueNode, InputObjectTypeDefinitionNode, InputValueDefinitionNode, InterfaceTypeDefinitionNode, IntValueNode, Kind, NamedTypeNode, NameNode, ObjectTypeDefinitionNode, ObjectTypeExtensionNode, ScalarTypeDefinitionNode, StringValueNode, TypeNode, UnionTypeDefinitionNode } from 'graphql';
|
|
2
|
+
export type ConstValueNodeWithValue = IntValueNode | FloatValueNode | StringValueNode | BooleanValueNode | EnumValueNode;
|
|
3
|
+
export declare function deepCopyTypeNode(node: TypeNode, parentName: string, fieldName: string): TypeNode;
|
|
4
|
+
export type MutableEnumTypeDefinitionNode = {
|
|
5
|
+
description?: StringValueNode;
|
|
6
|
+
kind: Kind.ENUM_TYPE_DEFINITION;
|
|
7
|
+
name: NameNode;
|
|
8
|
+
values: MutableEnumValueDefinitionNode[];
|
|
9
|
+
};
|
|
10
|
+
export declare function enumTypeDefinitionNodeToMutable(node: EnumTypeDefinitionNode): MutableEnumTypeDefinitionNode;
|
|
11
|
+
export type MutableEnumValueDefinitionNode = {
|
|
12
|
+
description?: StringValueNode;
|
|
13
|
+
kind: Kind.ENUM_VALUE_DEFINITION;
|
|
14
|
+
name: NameNode;
|
|
15
|
+
};
|
|
16
|
+
export declare function enumValueDefinitionNodeToMutable(node: EnumValueDefinitionNode): MutableEnumValueDefinitionNode;
|
|
17
|
+
export type MutableFieldDefinitionNode = {
|
|
18
|
+
arguments: MutableInputValueDefinitionNode[];
|
|
19
|
+
description?: StringValueNode;
|
|
20
|
+
kind: Kind.FIELD_DEFINITION;
|
|
21
|
+
name: NameNode;
|
|
22
|
+
type: TypeNode;
|
|
23
|
+
};
|
|
24
|
+
export declare function fieldDefinitionNodeToMutable(node: FieldDefinitionNode, parentName: string): MutableFieldDefinitionNode;
|
|
25
|
+
export type MutableInputObjectTypeDefinitionNode = {
|
|
26
|
+
description?: StringValueNode;
|
|
27
|
+
fields: InputValueDefinitionNode[];
|
|
28
|
+
kind: Kind.INPUT_OBJECT_TYPE_DEFINITION;
|
|
29
|
+
name: NameNode;
|
|
30
|
+
};
|
|
31
|
+
export declare function inputObjectTypeDefinitionNodeToMutable(node: InputObjectTypeDefinitionNode): MutableInputObjectTypeDefinitionNode;
|
|
32
|
+
export type MutableInputValueDefinitionNode = {
|
|
33
|
+
defaultValue?: ConstValueNode;
|
|
34
|
+
description?: StringValueNode;
|
|
35
|
+
kind: Kind.INPUT_VALUE_DEFINITION;
|
|
36
|
+
name: NameNode;
|
|
37
|
+
type: TypeNode;
|
|
38
|
+
};
|
|
39
|
+
export declare function inputValueDefinitionNodeToMutable(node: InputValueDefinitionNode, parentName: string): MutableInputValueDefinitionNode;
|
|
40
|
+
export type MutableInterfaceTypeDefinitionNode = {
|
|
41
|
+
description?: StringValueNode;
|
|
42
|
+
fields: FieldDefinitionNode[];
|
|
43
|
+
interfaces: NamedTypeNode[];
|
|
44
|
+
kind: Kind.INTERFACE_TYPE_DEFINITION;
|
|
45
|
+
name: NameNode;
|
|
46
|
+
};
|
|
47
|
+
export declare function interfaceTypeDefinitionNodeToMutable(node: InterfaceTypeDefinitionNode): MutableInterfaceTypeDefinitionNode;
|
|
48
|
+
export type MutableObjectTypeDefinitionNode = {
|
|
49
|
+
description?: StringValueNode;
|
|
50
|
+
fields: FieldDefinitionNode[];
|
|
51
|
+
interfaces: NamedTypeNode[];
|
|
52
|
+
kind: Kind.OBJECT_TYPE_DEFINITION;
|
|
53
|
+
name: NameNode;
|
|
54
|
+
};
|
|
55
|
+
export declare function objectTypeDefinitionNodeToMutable(node: ObjectTypeDefinitionNode): MutableObjectTypeDefinitionNode;
|
|
56
|
+
export type MutableObjectTypeExtensionNode = {
|
|
57
|
+
description?: StringValueNode;
|
|
58
|
+
fields: FieldDefinitionNode[];
|
|
59
|
+
interfaces: NamedTypeNode[];
|
|
60
|
+
kind: Kind.OBJECT_TYPE_EXTENSION;
|
|
61
|
+
name: NameNode;
|
|
62
|
+
};
|
|
63
|
+
export declare function objectTypeExtensionNodeToMutable(node: ObjectTypeExtensionNode): MutableObjectTypeExtensionNode;
|
|
64
|
+
export declare function objectTypeExtensionNodeToMutableDefinitionNode(node: ObjectTypeExtensionNode): MutableObjectTypeDefinitionNode;
|
|
65
|
+
export type MutableScalarTypeDefinitionNode = {
|
|
66
|
+
description?: StringValueNode;
|
|
67
|
+
kind: Kind.SCALAR_TYPE_DEFINITION;
|
|
68
|
+
name: NameNode;
|
|
69
|
+
};
|
|
70
|
+
export declare function scalarTypeDefinitionNodeToMutable(node: ScalarTypeDefinitionNode): MutableScalarTypeDefinitionNode;
|
|
71
|
+
export type MutableTypeNode = {
|
|
72
|
+
kind: Kind.NAMED_TYPE | Kind.LIST_TYPE | Kind.NON_NULL_TYPE;
|
|
73
|
+
name?: NameNode;
|
|
74
|
+
type?: MutableTypeNode;
|
|
75
|
+
};
|
|
76
|
+
export declare const maximumTypeNesting = 30;
|
|
77
|
+
export type MutableUnionTypeDefinitionNode = {
|
|
78
|
+
description?: StringValueNode;
|
|
79
|
+
kind: Kind.UNION_TYPE_DEFINITION;
|
|
80
|
+
name: NameNode;
|
|
81
|
+
types: NamedTypeNode[];
|
|
82
|
+
};
|
|
83
|
+
export declare function unionTypeDefinitionNodeToMutable(node: UnionTypeDefinitionNode): MutableUnionTypeDefinitionNode;
|
|
84
|
+
export type MutableTypeDefinitionNode = MutableScalarTypeDefinitionNode | MutableObjectTypeDefinitionNode | MutableInterfaceTypeDefinitionNode | MutableUnionTypeDefinitionNode | MutableEnumTypeDefinitionNode | MutableInputObjectTypeDefinitionNode | DirectiveDefinitionNode;
|
package/dist/ast/ast.js
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unionTypeDefinitionNodeToMutable = exports.maximumTypeNesting = exports.scalarTypeDefinitionNodeToMutable = exports.objectTypeExtensionNodeToMutableDefinitionNode = exports.objectTypeExtensionNodeToMutable = exports.objectTypeDefinitionNodeToMutable = exports.interfaceTypeDefinitionNodeToMutable = exports.inputValueDefinitionNodeToMutable = exports.inputObjectTypeDefinitionNodeToMutable = exports.fieldDefinitionNodeToMutable = exports.enumValueDefinitionNodeToMutable = exports.enumTypeDefinitionNodeToMutable = exports.deepCopyTypeNode = void 0;
|
|
4
|
+
const graphql_1 = require("graphql");
|
|
5
|
+
const errors_1 = require("../errors/errors");
|
|
6
|
+
function deepCopyFieldsAndInterfaces(node, fields, interfaces) {
|
|
7
|
+
if (node.fields) {
|
|
8
|
+
for (const field of node.fields) {
|
|
9
|
+
fields.push(fieldDefinitionNodeToMutable(field, node.name.value)); // TODO better error for arguments
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
if (node.interfaces) {
|
|
13
|
+
for (const face of node.interfaces) {
|
|
14
|
+
interfaces.push({ ...face });
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function deepCopyTypeNode(node, parentName, fieldName) {
|
|
19
|
+
const deepCopy = { kind: node.kind };
|
|
20
|
+
let lastTypeNode = deepCopy;
|
|
21
|
+
for (let i = 0; i < exports.maximumTypeNesting; i++) {
|
|
22
|
+
switch (node.kind) {
|
|
23
|
+
case graphql_1.Kind.NAMED_TYPE:
|
|
24
|
+
lastTypeNode.name = { ...node.name };
|
|
25
|
+
return deepCopy;
|
|
26
|
+
case graphql_1.Kind.LIST_TYPE:
|
|
27
|
+
lastTypeNode.kind = node.kind;
|
|
28
|
+
lastTypeNode.type = { kind: node.type.kind };
|
|
29
|
+
lastTypeNode = lastTypeNode.type;
|
|
30
|
+
node = node.type;
|
|
31
|
+
continue;
|
|
32
|
+
case graphql_1.Kind.NON_NULL_TYPE:
|
|
33
|
+
lastTypeNode.kind = node.kind;
|
|
34
|
+
lastTypeNode.type = { kind: node.type.kind };
|
|
35
|
+
lastTypeNode = lastTypeNode.type;
|
|
36
|
+
node = node.type;
|
|
37
|
+
continue;
|
|
38
|
+
default:
|
|
39
|
+
throw (0, errors_1.federationUnexpectedNodeKindError)(parentName, fieldName);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
throw new Error(`Field ${parentName}.${fieldName} has more than 30 layers of nesting, or there is a cyclical error.`);
|
|
43
|
+
}
|
|
44
|
+
exports.deepCopyTypeNode = deepCopyTypeNode;
|
|
45
|
+
function enumTypeDefinitionNodeToMutable(node) {
|
|
46
|
+
const values = [];
|
|
47
|
+
if (node.values) {
|
|
48
|
+
for (const value of node.values) {
|
|
49
|
+
values.push(enumValueDefinitionNodeToMutable(value));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
description: node.description ? { ...node.description } : undefined,
|
|
54
|
+
kind: node.kind,
|
|
55
|
+
name: { ...node.name },
|
|
56
|
+
values,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
exports.enumTypeDefinitionNodeToMutable = enumTypeDefinitionNodeToMutable;
|
|
60
|
+
function enumValueDefinitionNodeToMutable(node) {
|
|
61
|
+
return {
|
|
62
|
+
description: node.description ? { ...node.description } : undefined,
|
|
63
|
+
kind: node.kind,
|
|
64
|
+
name: { ...node.name },
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
exports.enumValueDefinitionNodeToMutable = enumValueDefinitionNodeToMutable;
|
|
68
|
+
function fieldDefinitionNodeToMutable(node, parentName) {
|
|
69
|
+
const args = [];
|
|
70
|
+
if (node.arguments) {
|
|
71
|
+
for (const argument of node.arguments) {
|
|
72
|
+
args.push(inputValueDefinitionNodeToMutable(argument, node.name.value)); // TODO better error for arguments
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
arguments: args,
|
|
77
|
+
description: node.description ? { ...node.description } : undefined,
|
|
78
|
+
kind: node.kind,
|
|
79
|
+
name: { ...node.name },
|
|
80
|
+
type: deepCopyTypeNode(node.type, parentName, node.name.value),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
exports.fieldDefinitionNodeToMutable = fieldDefinitionNodeToMutable;
|
|
84
|
+
function inputObjectTypeDefinitionNodeToMutable(node) {
|
|
85
|
+
const fields = [];
|
|
86
|
+
if (node.fields) {
|
|
87
|
+
for (const field of node.fields) {
|
|
88
|
+
fields.push(inputValueDefinitionNodeToMutable(field, node.name.value));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
description: node.description ? { ...node.description } : undefined,
|
|
93
|
+
fields,
|
|
94
|
+
kind: node.kind,
|
|
95
|
+
name: { ...node.name },
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
exports.inputObjectTypeDefinitionNodeToMutable = inputObjectTypeDefinitionNodeToMutable;
|
|
99
|
+
function inputValueDefinitionNodeToMutable(node, parentName) {
|
|
100
|
+
return {
|
|
101
|
+
defaultValue: node.defaultValue ? { ...node.defaultValue } : undefined,
|
|
102
|
+
description: node.description ? { ...node.description } : undefined,
|
|
103
|
+
kind: node.kind,
|
|
104
|
+
name: { ...node.name },
|
|
105
|
+
type: deepCopyTypeNode(node.type, parentName, node.name.value),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
exports.inputValueDefinitionNodeToMutable = inputValueDefinitionNodeToMutable;
|
|
109
|
+
function interfaceTypeDefinitionNodeToMutable(node) {
|
|
110
|
+
const fields = [];
|
|
111
|
+
const interfaces = [];
|
|
112
|
+
deepCopyFieldsAndInterfaces(node, fields, interfaces);
|
|
113
|
+
return {
|
|
114
|
+
description: node.description ? { ...node.description } : undefined,
|
|
115
|
+
fields,
|
|
116
|
+
interfaces,
|
|
117
|
+
kind: node.kind,
|
|
118
|
+
name: { ...node.name },
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
exports.interfaceTypeDefinitionNodeToMutable = interfaceTypeDefinitionNodeToMutable;
|
|
122
|
+
function objectTypeDefinitionNodeToMutable(node) {
|
|
123
|
+
const fields = [];
|
|
124
|
+
const interfaces = [];
|
|
125
|
+
deepCopyFieldsAndInterfaces(node, fields, interfaces);
|
|
126
|
+
return {
|
|
127
|
+
description: node.description ? { ...node.description } : undefined,
|
|
128
|
+
fields,
|
|
129
|
+
interfaces,
|
|
130
|
+
kind: node.kind,
|
|
131
|
+
name: { ...node.name },
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
exports.objectTypeDefinitionNodeToMutable = objectTypeDefinitionNodeToMutable;
|
|
135
|
+
function objectTypeExtensionNodeToMutable(node) {
|
|
136
|
+
const fields = [];
|
|
137
|
+
const interfaces = [];
|
|
138
|
+
deepCopyFieldsAndInterfaces(node, fields, interfaces);
|
|
139
|
+
return {
|
|
140
|
+
fields,
|
|
141
|
+
interfaces,
|
|
142
|
+
kind: node.kind,
|
|
143
|
+
name: { ...node.name },
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
exports.objectTypeExtensionNodeToMutable = objectTypeExtensionNodeToMutable;
|
|
147
|
+
function objectTypeExtensionNodeToMutableDefinitionNode(node) {
|
|
148
|
+
const fields = [];
|
|
149
|
+
const interfaces = [];
|
|
150
|
+
deepCopyFieldsAndInterfaces(node, fields, interfaces);
|
|
151
|
+
return {
|
|
152
|
+
fields,
|
|
153
|
+
interfaces,
|
|
154
|
+
kind: graphql_1.Kind.OBJECT_TYPE_DEFINITION,
|
|
155
|
+
name: { ...node.name },
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
exports.objectTypeExtensionNodeToMutableDefinitionNode = objectTypeExtensionNodeToMutableDefinitionNode;
|
|
159
|
+
function scalarTypeDefinitionNodeToMutable(node) {
|
|
160
|
+
return {
|
|
161
|
+
description: node.description ? { ...node.description } : undefined,
|
|
162
|
+
kind: graphql_1.Kind.SCALAR_TYPE_DEFINITION,
|
|
163
|
+
name: { ...node.name },
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
exports.scalarTypeDefinitionNodeToMutable = scalarTypeDefinitionNodeToMutable;
|
|
167
|
+
exports.maximumTypeNesting = 30;
|
|
168
|
+
function unionTypeDefinitionNodeToMutable(node) {
|
|
169
|
+
const types = [];
|
|
170
|
+
if (node.types) {
|
|
171
|
+
for (const member of node.types) {
|
|
172
|
+
types.push({ ...member });
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
description: node.description ? { ...node.description } : undefined,
|
|
177
|
+
kind: node.kind,
|
|
178
|
+
name: { ...node.name },
|
|
179
|
+
types,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
exports.unionTypeDefinitionNodeToMutable = unionTypeDefinitionNodeToMutable;
|
|
183
|
+
//# sourceMappingURL=ast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast.js","sourceRoot":"","sources":["../../src/ast/ast.ts"],"names":[],"mappings":";;;AAAA,qCAsBiB;AACjB,6CAAqE;AAErE,SAAS,2BAA2B,CAClC,IAAsF,EACtF,MAAoC,EAAE,UAA2B;IAEjE,IAAI,IAAI,CAAC,MAAM,EAAE;QACf,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE;YAC/B,MAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,kCAAkC;SACtG;KACF;IACD,IAAI,IAAI,CAAC,UAAU,EAAE;QACnB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,UAAU,EAAE;YAClC,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;SAC9B;KACF;AACH,CAAC;AAID,SAAgB,gBAAgB,CAAC,IAAc,EAAE,UAAkB,EAAE,SAAiB;IACpF,MAAM,QAAQ,GAAoB,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;IACtD,IAAI,YAAY,GAAG,QAAQ,CAAC;IAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,0BAAkB,EAAE,CAAC,EAAE,EAAE;QAC3C,QAAQ,IAAI,CAAC,IAAI,EAAE;YACjB,KAAK,cAAI,CAAC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wGAUC;AAQD,SAAgB,iCAAiC,CAAC,IAA8B;IAC9E,OAAO;QACL,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS;QACnE,IAAI,EAAE,cAAI,CAAC,sBAAsB;QACjC,IAAI,EAAE,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE;KACvB,CAAC;AACJ,CAAC;AAND,8EAMC;AAQY,QAAA,kBAAkB,GAAG,EAAE,CAAC;AASrC,SAAgB,gCAAgC,CAAC,IAA6B;IAC5E,MAAM,KAAK,GAAoB,EAAE,CAAC;IAClC,IAAI,IAAI,CAAC,KAAK,EAAE;QACd,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,KAAK,EAAE;YAC/B,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;SAC3B;KACF;IACD,OAAO;QACL,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,SAAS;QACnE,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,IAAI,EAAE,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE;QACtB,KAAK;KACN,CAAC;AACJ,CAAC;AAbD,4EAaC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { FieldDefinitionNode, InterfaceTypeDefinitionNode, InterfaceTypeExtensionNode, Kind, NamedTypeNode, NameNode, ObjectTypeDefinitionNode, ObjectTypeExtensionNode, OperationTypeNode } from 'graphql';
|
|
2
|
+
import { MutableEnumTypeDefinitionNode, MutableEnumValueDefinitionNode, MutableFieldDefinitionNode, MutableInputObjectTypeDefinitionNode, MutableInputValueDefinitionNode, MutableInterfaceTypeDefinitionNode, MutableObjectTypeDefinitionNode, MutableObjectTypeExtensionNode, MutableScalarTypeDefinitionNode, MutableUnionTypeDefinitionNode } from './ast';
|
|
3
|
+
export declare enum MergeMethod {
|
|
4
|
+
UNION = 0,
|
|
5
|
+
INTERSECTION = 1,
|
|
6
|
+
CONSISTENT = 2
|
|
7
|
+
}
|
|
8
|
+
export type EntityContainer = {
|
|
9
|
+
fields: Set<string>;
|
|
10
|
+
keys: Set<string>;
|
|
11
|
+
subgraphs: Set<string>;
|
|
12
|
+
};
|
|
13
|
+
export type EnumContainer = {
|
|
14
|
+
appearances: number;
|
|
15
|
+
values: EnumValueMap;
|
|
16
|
+
kind: Kind.ENUM_TYPE_DEFINITION;
|
|
17
|
+
node: MutableEnumTypeDefinitionNode;
|
|
18
|
+
};
|
|
19
|
+
export type EnumValueContainer = {
|
|
20
|
+
appearances: number;
|
|
21
|
+
node: MutableEnumValueDefinitionNode;
|
|
22
|
+
};
|
|
23
|
+
export type EnumValueMap = Map<string, EnumValueContainer>;
|
|
24
|
+
export type FieldContainer = {
|
|
25
|
+
appearances: number;
|
|
26
|
+
arguments: InputValueMap;
|
|
27
|
+
isShareable: boolean;
|
|
28
|
+
node: MutableFieldDefinitionNode;
|
|
29
|
+
rootTypeName: string;
|
|
30
|
+
subgraphs: Set<string>;
|
|
31
|
+
subgraphsByShareable: Map<string, boolean>;
|
|
32
|
+
};
|
|
33
|
+
export type FieldMap = Map<string, FieldContainer>;
|
|
34
|
+
export type InputValueContainer = {
|
|
35
|
+
appearances: number;
|
|
36
|
+
includeDefaultValue: boolean;
|
|
37
|
+
node: MutableInputValueDefinitionNode;
|
|
38
|
+
};
|
|
39
|
+
export type InputValueMap = Map<string, InputValueContainer>;
|
|
40
|
+
export type InputObjectContainer = {
|
|
41
|
+
appearances: number;
|
|
42
|
+
fields: InputValueMap;
|
|
43
|
+
kind: Kind.INPUT_OBJECT_TYPE_DEFINITION;
|
|
44
|
+
node: MutableInputObjectTypeDefinitionNode;
|
|
45
|
+
};
|
|
46
|
+
export type InterfaceContainer = {
|
|
47
|
+
appearances: number;
|
|
48
|
+
fields: FieldMap;
|
|
49
|
+
interfaces: Set<string>;
|
|
50
|
+
kind: Kind.INTERFACE_TYPE_DEFINITION;
|
|
51
|
+
node: MutableInterfaceTypeDefinitionNode;
|
|
52
|
+
subgraphs: Set<string>;
|
|
53
|
+
};
|
|
54
|
+
export type ObjectContainer = {
|
|
55
|
+
appearances: number;
|
|
56
|
+
fields: FieldMap;
|
|
57
|
+
entityKeys: Set<string>;
|
|
58
|
+
interfaces: Set<string>;
|
|
59
|
+
isRootType: boolean;
|
|
60
|
+
kind: Kind.OBJECT_TYPE_DEFINITION;
|
|
61
|
+
node: MutableObjectTypeDefinitionNode;
|
|
62
|
+
subgraphs: Set<string>;
|
|
63
|
+
};
|
|
64
|
+
export type ObjectExtensionContainer = {
|
|
65
|
+
appearances: number;
|
|
66
|
+
fields: FieldMap;
|
|
67
|
+
entityKeys: Set<string>;
|
|
68
|
+
interfaces: Set<string>;
|
|
69
|
+
isRootType: boolean;
|
|
70
|
+
kind: Kind.OBJECT_TYPE_EXTENSION;
|
|
71
|
+
node: MutableObjectTypeExtensionNode;
|
|
72
|
+
subgraphs: Set<string>;
|
|
73
|
+
};
|
|
74
|
+
export type OperationField = {
|
|
75
|
+
inlineFragment: string;
|
|
76
|
+
path: string;
|
|
77
|
+
name: string;
|
|
78
|
+
parentTypeName: string;
|
|
79
|
+
responseType: string;
|
|
80
|
+
rootTypeName: string;
|
|
81
|
+
subgraphs: Set<string>;
|
|
82
|
+
};
|
|
83
|
+
export type PotentiallyUnresolvableField = {
|
|
84
|
+
fieldContainer: FieldContainer;
|
|
85
|
+
fullResolverPaths: string[];
|
|
86
|
+
operationField: OperationField;
|
|
87
|
+
};
|
|
88
|
+
export type ScalarContainer = {
|
|
89
|
+
appearances: number;
|
|
90
|
+
kind: Kind.SCALAR_TYPE_DEFINITION;
|
|
91
|
+
node: MutableScalarTypeDefinitionNode;
|
|
92
|
+
};
|
|
93
|
+
export type UnionContainer = {
|
|
94
|
+
appearances: number;
|
|
95
|
+
kind: Kind.UNION_TYPE_DEFINITION;
|
|
96
|
+
members: Set<string>;
|
|
97
|
+
node: MutableUnionTypeDefinitionNode;
|
|
98
|
+
};
|
|
99
|
+
export type ParentContainer = EnumContainer | InputObjectContainer | InterfaceContainer | ObjectContainer | UnionContainer | ScalarContainer;
|
|
100
|
+
export type ExtensionContainer = ObjectExtensionContainer;
|
|
101
|
+
export type ParentMap = Map<string, ParentContainer>;
|
|
102
|
+
export declare function isObjectNodeEntity(node: ObjectTypeDefinitionNode | ObjectTypeExtensionNode): boolean;
|
|
103
|
+
export declare function extractEntityKeys(node: ObjectTypeDefinitionNode | ObjectTypeExtensionNode, keySet: Set<string>): Set<string>;
|
|
104
|
+
export type EntityKey = {
|
|
105
|
+
nestedKeys?: EntityKey[];
|
|
106
|
+
parent: string;
|
|
107
|
+
siblings: string[];
|
|
108
|
+
};
|
|
109
|
+
export type EntityKeyExtractionResult = {
|
|
110
|
+
entityKey?: EntityKey;
|
|
111
|
+
error?: Error;
|
|
112
|
+
};
|
|
113
|
+
export declare function getEntityKeyExtractionResult(rawEntityKey: string, parentTypeName: string): EntityKeyExtractionResult;
|
|
114
|
+
export type EntityKeyExtractionResults = {
|
|
115
|
+
entityKeyMap: Map<string, EntityKey>;
|
|
116
|
+
errors: Error[];
|
|
117
|
+
};
|
|
118
|
+
export declare function getEntityKeyExtractionResults(node: ObjectTypeDefinitionNode | ObjectTypeExtensionNode, entityKeyMap: Map<string, EntityKey>): EntityKeyExtractionResults;
|
|
119
|
+
export declare function extractInterfaces(node: InterfaceTypeDefinitionNode | InterfaceTypeExtensionNode | ObjectTypeDefinitionNode | ObjectTypeExtensionNode, interfaces: Set<string>): Set<string>;
|
|
120
|
+
export declare function isNodeShareable(node: ObjectTypeDefinitionNode | ObjectTypeExtensionNode | FieldDefinitionNode): boolean;
|
|
121
|
+
export declare function assertEqualKindsOrThrow(kind: Kind, other: Kind): void;
|
|
122
|
+
export declare function areBaseAndExtensionKindsCompatible(baseKind: Kind, extensionKind: Kind): boolean;
|
|
123
|
+
export declare function stringToNameNode(value: string): NameNode;
|
|
124
|
+
export declare function stringToNameNodes(values: string[]): NameNode[];
|
|
125
|
+
export declare function stringToNamedTypeNode(value: string): NamedTypeNode;
|
|
126
|
+
export declare function setToNamedTypeNodeArray(set: Set<string>): NamedTypeNode[];
|
|
127
|
+
export declare function nodeKindToDirectiveLocation(kind: Kind): string;
|
|
128
|
+
export declare const operationTypeNodeToDefaultType: Map<OperationTypeNode, string>;
|
|
129
|
+
export declare function isKindAbstract(kind: Kind): boolean;
|
|
130
|
+
export declare function getInlineFragmentString(parentTypeName: string): string;
|