@theguild/federation-composition 0.11.2 → 0.11.3-rc-20240619190729-4adb79a
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/specifications/federation.js +9 -2
- package/cjs/subgraph/state.js +2 -0
- package/cjs/subgraph/validation/validation-context.js +2 -0
- package/esm/specifications/federation.js +9 -2
- package/esm/subgraph/state.js +2 -0
- package/esm/subgraph/validation/validation-context.js +2 -0
- package/package.json +1 -1
- package/typings/subgraph/validation/validation-context.d.cts +1 -1
- package/typings/subgraph/validation/validation-context.d.ts +1 -1
|
@@ -168,7 +168,7 @@ const federationSpecFactory = {
|
|
|
168
168
|
) on FIELD_DEFINITION | OBJECT | INTERFACE | SCALAR | ENUM
|
|
169
169
|
directive @authenticated on FIELD_DEFINITION | OBJECT | INTERFACE | SCALAR | ENUM
|
|
170
170
|
directive @requiresScopes(
|
|
171
|
-
scopes: [[
|
|
171
|
+
scopes: [[federation__Scope!]!]!
|
|
172
172
|
) on FIELD_DEFINITION | OBJECT | INTERFACE | SCALAR | ENUM
|
|
173
173
|
directive @composeDirective(name: String!) repeatable on SCHEMA
|
|
174
174
|
directive @extends on OBJECT | INTERFACE
|
|
@@ -187,7 +187,8 @@ const federationSpecFactory = {
|
|
|
187
187
|
name: String!
|
|
188
188
|
) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
|
|
189
189
|
scalar FieldSet
|
|
190
|
-
scalar
|
|
190
|
+
scalar federation__Policy
|
|
191
|
+
scalar federation__Scope
|
|
191
192
|
`, prefix, imports),
|
|
192
193
|
};
|
|
193
194
|
function createTypeDefinitions(doc, prefix, imports) {
|
|
@@ -203,6 +204,12 @@ function createTypeDefinitions(doc, prefix, imports) {
|
|
|
203
204
|
toInclude.add('FieldSet');
|
|
204
205
|
toInclude.add('federation__FieldSet');
|
|
205
206
|
}
|
|
207
|
+
if (toInclude.has('requiresScopes')) {
|
|
208
|
+
toInclude.add('federation__Scope');
|
|
209
|
+
}
|
|
210
|
+
if (toInclude.has('policy')) {
|
|
211
|
+
toInclude.add('federation__Policy');
|
|
212
|
+
}
|
|
206
213
|
const directives = [];
|
|
207
214
|
const types = [];
|
|
208
215
|
for (const node of docAST.definitions) {
|
package/cjs/subgraph/state.js
CHANGED
|
@@ -578,6 +578,8 @@ function directiveFactory(state) {
|
|
|
578
578
|
function cleanSubgraphStateFromFederationSpec(state) {
|
|
579
579
|
state.types.delete('_FieldSet');
|
|
580
580
|
state.types.delete('federation__FieldSet');
|
|
581
|
+
state.types.delete('federation__Policy');
|
|
582
|
+
state.types.delete('federation__Scope');
|
|
581
583
|
return state;
|
|
582
584
|
}
|
|
583
585
|
exports.cleanSubgraphStateFromFederationSpec = cleanSubgraphStateFromFederationSpec;
|
|
@@ -126,6 +126,7 @@ function createSubgraphValidationContext(subgraph, federation, typeNodeInfo, sta
|
|
|
126
126
|
setOfNames = directiveAlternativeNamesMap.get(specDirective.name.value);
|
|
127
127
|
}
|
|
128
128
|
setOfNames.add(alias ? alias.replace(/^@/, '') : specDirective.name.value);
|
|
129
|
+
setOfNames.add(`federation__${specDirective.name.value}`);
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
const typeAlternativeNamesMap = new Map();
|
|
@@ -148,6 +149,7 @@ function createSubgraphValidationContext(subgraph, federation, typeNodeInfo, sta
|
|
|
148
149
|
setOfNames = typeAlternativeNamesMap.get(specType.name.value);
|
|
149
150
|
}
|
|
150
151
|
setOfNames.add(alias ? alias : specType.name.value);
|
|
152
|
+
setOfNames.add(`federation__${specType.name.value}`);
|
|
151
153
|
}
|
|
152
154
|
}
|
|
153
155
|
const importedTypesSet = new Set(availableSpec.types.map(t => t.name.value));
|
|
@@ -163,7 +163,7 @@ const federationSpecFactory = {
|
|
|
163
163
|
) on FIELD_DEFINITION | OBJECT | INTERFACE | SCALAR | ENUM
|
|
164
164
|
directive @authenticated on FIELD_DEFINITION | OBJECT | INTERFACE | SCALAR | ENUM
|
|
165
165
|
directive @requiresScopes(
|
|
166
|
-
scopes: [[
|
|
166
|
+
scopes: [[federation__Scope!]!]!
|
|
167
167
|
) on FIELD_DEFINITION | OBJECT | INTERFACE | SCALAR | ENUM
|
|
168
168
|
directive @composeDirective(name: String!) repeatable on SCHEMA
|
|
169
169
|
directive @extends on OBJECT | INTERFACE
|
|
@@ -182,7 +182,8 @@ const federationSpecFactory = {
|
|
|
182
182
|
name: String!
|
|
183
183
|
) repeatable on FIELD_DEFINITION | INTERFACE | OBJECT | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION
|
|
184
184
|
scalar FieldSet
|
|
185
|
-
scalar
|
|
185
|
+
scalar federation__Policy
|
|
186
|
+
scalar federation__Scope
|
|
186
187
|
`, prefix, imports),
|
|
187
188
|
};
|
|
188
189
|
function createTypeDefinitions(doc, prefix, imports) {
|
|
@@ -198,6 +199,12 @@ function createTypeDefinitions(doc, prefix, imports) {
|
|
|
198
199
|
toInclude.add('FieldSet');
|
|
199
200
|
toInclude.add('federation__FieldSet');
|
|
200
201
|
}
|
|
202
|
+
if (toInclude.has('requiresScopes')) {
|
|
203
|
+
toInclude.add('federation__Scope');
|
|
204
|
+
}
|
|
205
|
+
if (toInclude.has('policy')) {
|
|
206
|
+
toInclude.add('federation__Policy');
|
|
207
|
+
}
|
|
201
208
|
const directives = [];
|
|
202
209
|
const types = [];
|
|
203
210
|
for (const node of docAST.definitions) {
|
package/esm/subgraph/state.js
CHANGED
|
@@ -574,6 +574,8 @@ function directiveFactory(state) {
|
|
|
574
574
|
export function cleanSubgraphStateFromFederationSpec(state) {
|
|
575
575
|
state.types.delete('_FieldSet');
|
|
576
576
|
state.types.delete('federation__FieldSet');
|
|
577
|
+
state.types.delete('federation__Policy');
|
|
578
|
+
state.types.delete('federation__Scope');
|
|
577
579
|
return state;
|
|
578
580
|
}
|
|
579
581
|
export function cleanSubgraphStateFromLinkSpec(state) {
|
|
@@ -122,6 +122,7 @@ export function createSubgraphValidationContext(subgraph, federation, typeNodeIn
|
|
|
122
122
|
setOfNames = directiveAlternativeNamesMap.get(specDirective.name.value);
|
|
123
123
|
}
|
|
124
124
|
setOfNames.add(alias ? alias.replace(/^@/, '') : specDirective.name.value);
|
|
125
|
+
setOfNames.add(`federation__${specDirective.name.value}`);
|
|
125
126
|
}
|
|
126
127
|
}
|
|
127
128
|
const typeAlternativeNamesMap = new Map();
|
|
@@ -144,6 +145,7 @@ export function createSubgraphValidationContext(subgraph, federation, typeNodeIn
|
|
|
144
145
|
setOfNames = typeAlternativeNamesMap.get(specType.name.value);
|
|
145
146
|
}
|
|
146
147
|
setOfNames.add(alias ? alias : specType.name.value);
|
|
148
|
+
setOfNames.add(`federation__${specType.name.value}`);
|
|
147
149
|
}
|
|
148
150
|
}
|
|
149
151
|
const importedTypesSet = new Set(availableSpec.types.map(t => t.name.value));
|
package/package.json
CHANGED
|
@@ -179,7 +179,7 @@ export declare function createSubgraphValidationContext(subgraph: {
|
|
|
179
179
|
};
|
|
180
180
|
composedDirectives: Set<string>;
|
|
181
181
|
state: import("../state.js").SubgraphState;
|
|
182
|
-
markSpecAsUsed(specName: "link" | "tag" | "inaccessible" | "
|
|
182
|
+
markSpecAsUsed(specName: "link" | "tag" | "inaccessible" | "requiresScopes" | "policy" | "authenticated"): void;
|
|
183
183
|
visitor(typeNodeInfo: TypeNodeInfo): import("graphql").ASTVisitor;
|
|
184
184
|
};
|
|
185
185
|
isLinkSpecDirective(name: string): boolean;
|
|
@@ -179,7 +179,7 @@ export declare function createSubgraphValidationContext(subgraph: {
|
|
|
179
179
|
};
|
|
180
180
|
composedDirectives: Set<string>;
|
|
181
181
|
state: import("../state.js").SubgraphState;
|
|
182
|
-
markSpecAsUsed(specName: "link" | "tag" | "inaccessible" | "
|
|
182
|
+
markSpecAsUsed(specName: "link" | "tag" | "inaccessible" | "requiresScopes" | "policy" | "authenticated"): void;
|
|
183
183
|
visitor(typeNodeInfo: TypeNodeInfo): import("graphql").ASTVisitor;
|
|
184
184
|
};
|
|
185
185
|
isLinkSpecDirective(name: string): boolean;
|