@theguild/federation-composition 0.1.3 → 0.1.4-alpha-20231123202339-d7a0c84
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/cjs/graphql/helpers.js
CHANGED
|
@@ -7,14 +7,33 @@ function isDirectiveDefinition(node) {
|
|
|
7
7
|
}
|
|
8
8
|
exports.isDirectiveDefinition = isDirectiveDefinition;
|
|
9
9
|
function stripFederationFromSupergraph(supergraph) {
|
|
10
|
-
function
|
|
11
|
-
|
|
10
|
+
function removeDirective(node) {
|
|
11
|
+
const directiveName = node.name.value;
|
|
12
|
+
const isSpecifiedDirective = graphql_1.specifiedDirectives.some(d => d.name === directiveName);
|
|
13
|
+
if (!isSpecifiedDirective) {
|
|
14
|
+
const isFederationDirective = directiveName === 'link' ||
|
|
15
|
+
directiveName === 'inaccessible' ||
|
|
16
|
+
directiveName === 'tag' ||
|
|
17
|
+
directiveName === 'join__graph' ||
|
|
18
|
+
directiveName === 'join__type' ||
|
|
19
|
+
directiveName === 'join__implements' ||
|
|
20
|
+
directiveName === 'join__unionMember' ||
|
|
21
|
+
directiveName === 'join__enumValue' ||
|
|
22
|
+
directiveName === 'join__field';
|
|
23
|
+
if (isFederationDirective) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
12
27
|
}
|
|
13
28
|
return (0, graphql_1.visit)(supergraph, {
|
|
14
|
-
DirectiveDefinition:
|
|
15
|
-
Directive:
|
|
16
|
-
SchemaDefinition
|
|
17
|
-
|
|
29
|
+
DirectiveDefinition: removeDirective,
|
|
30
|
+
Directive: removeDirective,
|
|
31
|
+
SchemaDefinition() {
|
|
32
|
+
return null;
|
|
33
|
+
},
|
|
34
|
+
SchemaExtension() {
|
|
35
|
+
return null;
|
|
36
|
+
},
|
|
18
37
|
EnumTypeDefinition: node => {
|
|
19
38
|
if (node.name.value === 'core__Purpose' ||
|
|
20
39
|
node.name.value === 'join__Graph' ||
|
package/esm/graphql/helpers.js
CHANGED
|
@@ -1,16 +1,35 @@
|
|
|
1
|
-
import { Kind, visit } from 'graphql';
|
|
1
|
+
import { Kind, specifiedDirectives, visit, } from 'graphql';
|
|
2
2
|
export function isDirectiveDefinition(node) {
|
|
3
3
|
return node.kind === Kind.DIRECTIVE_DEFINITION;
|
|
4
4
|
}
|
|
5
5
|
export function stripFederationFromSupergraph(supergraph) {
|
|
6
|
-
function
|
|
7
|
-
|
|
6
|
+
function removeDirective(node) {
|
|
7
|
+
const directiveName = node.name.value;
|
|
8
|
+
const isSpecifiedDirective = specifiedDirectives.some(d => d.name === directiveName);
|
|
9
|
+
if (!isSpecifiedDirective) {
|
|
10
|
+
const isFederationDirective = directiveName === 'link' ||
|
|
11
|
+
directiveName === 'inaccessible' ||
|
|
12
|
+
directiveName === 'tag' ||
|
|
13
|
+
directiveName === 'join__graph' ||
|
|
14
|
+
directiveName === 'join__type' ||
|
|
15
|
+
directiveName === 'join__implements' ||
|
|
16
|
+
directiveName === 'join__unionMember' ||
|
|
17
|
+
directiveName === 'join__enumValue' ||
|
|
18
|
+
directiveName === 'join__field';
|
|
19
|
+
if (isFederationDirective) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
8
23
|
}
|
|
9
24
|
return visit(supergraph, {
|
|
10
|
-
DirectiveDefinition:
|
|
11
|
-
Directive:
|
|
12
|
-
SchemaDefinition
|
|
13
|
-
|
|
25
|
+
DirectiveDefinition: removeDirective,
|
|
26
|
+
Directive: removeDirective,
|
|
27
|
+
SchemaDefinition() {
|
|
28
|
+
return null;
|
|
29
|
+
},
|
|
30
|
+
SchemaExtension() {
|
|
31
|
+
return null;
|
|
32
|
+
},
|
|
14
33
|
EnumTypeDefinition: node => {
|
|
15
34
|
if (node.name.value === 'core__Purpose' ||
|
|
16
35
|
node.name.value === 'join__Graph' ||
|
package/package.json
CHANGED
|
@@ -150,7 +150,7 @@ export declare function createSubgraphValidationContext(subgraph: {
|
|
|
150
150
|
};
|
|
151
151
|
composedDirectives: Set<string>;
|
|
152
152
|
state: import("../state.js").SubgraphState;
|
|
153
|
-
markSpecAsUsed(specName: "link" | "
|
|
153
|
+
markSpecAsUsed(specName: "link" | "inaccessible" | "tag"): void;
|
|
154
154
|
visitor(typeNodeInfo: TypeNodeInfo): import("graphql").ASTVisitor;
|
|
155
155
|
};
|
|
156
156
|
isAvailableFederationType(name: string): boolean;
|
|
@@ -150,7 +150,7 @@ export declare function createSubgraphValidationContext(subgraph: {
|
|
|
150
150
|
};
|
|
151
151
|
composedDirectives: Set<string>;
|
|
152
152
|
state: import("../state.js").SubgraphState;
|
|
153
|
-
markSpecAsUsed(specName: "link" | "
|
|
153
|
+
markSpecAsUsed(specName: "link" | "inaccessible" | "tag"): void;
|
|
154
154
|
visitor(typeNodeInfo: TypeNodeInfo): import("graphql").ASTVisitor;
|
|
155
155
|
};
|
|
156
156
|
isAvailableFederationType(name: string): boolean;
|