@effect-gql/federation 0.1.0
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 +7 -0
- package/dist/directives.d.ts +136 -0
- package/dist/directives.d.ts.map +1 -0
- package/dist/directives.js +171 -0
- package/dist/directives.js.map +1 -0
- package/dist/entities.d.ts +31 -0
- package/dist/entities.d.ts.map +1 -0
- package/dist/entities.js +76 -0
- package/dist/entities.js.map +1 -0
- package/dist/federated-builder.d.ts +182 -0
- package/dist/federated-builder.d.ts.map +1 -0
- package/dist/federated-builder.js +442 -0
- package/dist/federated-builder.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/pipe-api.d.ts +163 -0
- package/dist/pipe-api.d.ts.map +1 -0
- package/dist/pipe-api.js +127 -0
- package/dist/pipe-api.js.map +1 -0
- package/dist/scalars.d.ts +12 -0
- package/dist/scalars.d.ts.map +1 -0
- package/dist/scalars.js +59 -0
- package/dist/scalars.js.map +1 -0
- package/dist/types.d.ts +89 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +41 -0
- package/dist/types.js.map +1 -0
- package/package.json +47 -0
- package/src/directives.ts +170 -0
- package/src/entities.ts +90 -0
- package/src/federated-builder.ts +593 -0
- package/src/index.ts +47 -0
- package/src/pipe-api.ts +263 -0
- package/src/scalars.ts +59 -0
- package/src/types.ts +114 -0
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.FederatedSchemaBuilder = void 0;
|
|
37
|
+
const effect_1 = require("effect");
|
|
38
|
+
const S = __importStar(require("effect/Schema"));
|
|
39
|
+
const core_1 = require("@effect-gql/core");
|
|
40
|
+
const scalars_1 = require("./scalars");
|
|
41
|
+
const entities_1 = require("./entities");
|
|
42
|
+
const types_1 = require("./types");
|
|
43
|
+
/**
|
|
44
|
+
* Federation-aware schema builder that extends the core GraphQLSchemaBuilder
|
|
45
|
+
* with Apollo Federation 2.x support.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const schema = FederatedSchemaBuilder.empty
|
|
50
|
+
* .pipe(
|
|
51
|
+
* entity({
|
|
52
|
+
* name: "User",
|
|
53
|
+
* schema: UserSchema,
|
|
54
|
+
* keys: [key({ fields: "id" })],
|
|
55
|
+
* resolveReference: (ref) => UserService.findById(ref.id),
|
|
56
|
+
* }),
|
|
57
|
+
* query("me", {
|
|
58
|
+
* type: UserSchema,
|
|
59
|
+
* resolve: () => UserService.getCurrentUser(),
|
|
60
|
+
* }),
|
|
61
|
+
* )
|
|
62
|
+
* .buildFederatedSchema()
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
class FederatedSchemaBuilder {
|
|
66
|
+
state;
|
|
67
|
+
constructor(state) {
|
|
68
|
+
this.state = state;
|
|
69
|
+
}
|
|
70
|
+
pipe() {
|
|
71
|
+
return effect_1.Pipeable.pipeArguments(this, arguments);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Create an empty federated schema builder
|
|
75
|
+
*/
|
|
76
|
+
static empty = new FederatedSchemaBuilder({
|
|
77
|
+
coreBuilder: core_1.GraphQLSchemaBuilder.empty,
|
|
78
|
+
entities: new Map(),
|
|
79
|
+
version: "2.3",
|
|
80
|
+
});
|
|
81
|
+
/**
|
|
82
|
+
* Create a builder with custom configuration
|
|
83
|
+
*/
|
|
84
|
+
static create(config = {}) {
|
|
85
|
+
return new FederatedSchemaBuilder({
|
|
86
|
+
coreBuilder: core_1.GraphQLSchemaBuilder.empty,
|
|
87
|
+
entities: new Map(),
|
|
88
|
+
version: config.version ?? "2.3",
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Create a new builder with updated state
|
|
93
|
+
*/
|
|
94
|
+
with(updates) {
|
|
95
|
+
return new FederatedSchemaBuilder({
|
|
96
|
+
...this.state,
|
|
97
|
+
...updates,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Get the underlying core builder for advanced usage
|
|
102
|
+
*/
|
|
103
|
+
get coreBuilder() {
|
|
104
|
+
return this.state.coreBuilder;
|
|
105
|
+
}
|
|
106
|
+
// ============================================================================
|
|
107
|
+
// Entity Registration
|
|
108
|
+
// ============================================================================
|
|
109
|
+
/**
|
|
110
|
+
* Register an entity type with @key directive(s) and reference resolver.
|
|
111
|
+
*
|
|
112
|
+
* Entities are the core building block of Apollo Federation. They represent
|
|
113
|
+
* types that can be resolved across subgraph boundaries using their key fields.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* builder.entity({
|
|
118
|
+
* name: "User",
|
|
119
|
+
* schema: UserSchema,
|
|
120
|
+
* keys: [key({ fields: "id" })],
|
|
121
|
+
* resolveReference: (ref) => UserService.findById(ref.id),
|
|
122
|
+
* })
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
entity(config) {
|
|
126
|
+
const { name, schema, keys, directives } = config;
|
|
127
|
+
// Build directive applications for the object type
|
|
128
|
+
const typeDirectives = [
|
|
129
|
+
// Add @key directives
|
|
130
|
+
...keys.map((k) => ({
|
|
131
|
+
name: "key",
|
|
132
|
+
args: {
|
|
133
|
+
fields: k.fields,
|
|
134
|
+
...(k.resolvable !== undefined ? { resolvable: k.resolvable } : {}),
|
|
135
|
+
},
|
|
136
|
+
})),
|
|
137
|
+
// Add additional directives
|
|
138
|
+
...(directives?.map(types_1.toDirectiveApplication) ?? []),
|
|
139
|
+
];
|
|
140
|
+
// Register the entity as an object type with directives
|
|
141
|
+
const newCoreBuilder = this.state.coreBuilder.objectType({
|
|
142
|
+
name,
|
|
143
|
+
schema,
|
|
144
|
+
directives: typeDirectives,
|
|
145
|
+
});
|
|
146
|
+
// Add to entities map
|
|
147
|
+
const newEntities = new Map(this.state.entities);
|
|
148
|
+
newEntities.set(name, config);
|
|
149
|
+
return this.with({
|
|
150
|
+
coreBuilder: newCoreBuilder,
|
|
151
|
+
entities: newEntities,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
// ============================================================================
|
|
155
|
+
// Delegate to Core Builder
|
|
156
|
+
// ============================================================================
|
|
157
|
+
/**
|
|
158
|
+
* Add a query field
|
|
159
|
+
*/
|
|
160
|
+
query(name, config) {
|
|
161
|
+
return this.with({
|
|
162
|
+
coreBuilder: this.state.coreBuilder.query(name, config),
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Add a mutation field
|
|
167
|
+
*/
|
|
168
|
+
mutation(name, config) {
|
|
169
|
+
return this.with({
|
|
170
|
+
coreBuilder: this.state.coreBuilder.mutation(name, config),
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Add a subscription field
|
|
175
|
+
*/
|
|
176
|
+
subscription(name, config) {
|
|
177
|
+
return this.with({
|
|
178
|
+
coreBuilder: this.state.coreBuilder.subscription(name, config),
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Register an object type (non-entity)
|
|
183
|
+
*/
|
|
184
|
+
objectType(config) {
|
|
185
|
+
return this.with({
|
|
186
|
+
coreBuilder: this.state.coreBuilder.objectType(config),
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Register an interface type
|
|
191
|
+
*/
|
|
192
|
+
interfaceType(config) {
|
|
193
|
+
return this.with({
|
|
194
|
+
coreBuilder: this.state.coreBuilder.interfaceType(config),
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Register an enum type
|
|
199
|
+
*/
|
|
200
|
+
enumType(config) {
|
|
201
|
+
return this.with({
|
|
202
|
+
coreBuilder: this.state.coreBuilder.enumType(config),
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Register a union type
|
|
207
|
+
*/
|
|
208
|
+
unionType(config) {
|
|
209
|
+
return this.with({
|
|
210
|
+
coreBuilder: this.state.coreBuilder.unionType(config),
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Register an input type
|
|
215
|
+
*/
|
|
216
|
+
inputType(config) {
|
|
217
|
+
return this.with({
|
|
218
|
+
coreBuilder: this.state.coreBuilder.inputType(config),
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Add a computed/relational field to an object type
|
|
223
|
+
*/
|
|
224
|
+
field(typeName, fieldName, config) {
|
|
225
|
+
return this.with({
|
|
226
|
+
coreBuilder: this.state.coreBuilder.field(typeName, fieldName, config),
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
// ============================================================================
|
|
230
|
+
// Schema Building
|
|
231
|
+
// ============================================================================
|
|
232
|
+
/**
|
|
233
|
+
* Build the federated GraphQL schema with _entities and _service queries.
|
|
234
|
+
*
|
|
235
|
+
* Returns both the executable schema and the Federation-compliant SDL.
|
|
236
|
+
*/
|
|
237
|
+
buildFederatedSchema() {
|
|
238
|
+
// Add a dummy query if no queries exist to ensure schema builds properly
|
|
239
|
+
// This ensures all registered types are included in the schema
|
|
240
|
+
let builderForSchema = this.state.coreBuilder;
|
|
241
|
+
// Check if we need a placeholder query by attempting to build
|
|
242
|
+
// We need at least one query for GraphQL schema to be valid
|
|
243
|
+
const needsPlaceholder = !this.hasQueryFields();
|
|
244
|
+
if (needsPlaceholder) {
|
|
245
|
+
builderForSchema = builderForSchema.query("_placeholder", {
|
|
246
|
+
type: S.String,
|
|
247
|
+
resolve: () => effect_1.Effect.succeed("placeholder"),
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
// Build the base schema with all types included
|
|
251
|
+
const baseSchema = builderForSchema.buildSchema();
|
|
252
|
+
// Get the type registry from the base schema
|
|
253
|
+
const typeRegistry = new Map();
|
|
254
|
+
const typeMap = baseSchema.getTypeMap();
|
|
255
|
+
for (const [name, type] of Object.entries(typeMap)) {
|
|
256
|
+
// Use constructor name check instead of instanceof to handle multiple graphql instances
|
|
257
|
+
const isObjectType = type.constructor.name === "GraphQLObjectType";
|
|
258
|
+
if (isObjectType && !name.startsWith("__")) {
|
|
259
|
+
typeRegistry.set(name, type);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
// Create federation types
|
|
263
|
+
const entityUnion = this.state.entities.size > 0 ? (0, entities_1.createEntityUnion)(this.state.entities, typeRegistry) : null;
|
|
264
|
+
const serviceType = (0, entities_1.createServiceType)();
|
|
265
|
+
// Build federation query fields
|
|
266
|
+
const federationQueryFields = {};
|
|
267
|
+
if (entityUnion) {
|
|
268
|
+
federationQueryFields._entities = {
|
|
269
|
+
type: new core_1.GraphQLNonNull(new core_1.GraphQLList(entityUnion)),
|
|
270
|
+
args: {
|
|
271
|
+
representations: {
|
|
272
|
+
type: new core_1.GraphQLNonNull(new core_1.GraphQLList(new core_1.GraphQLNonNull(scalars_1.AnyScalar))),
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
resolve: (0, entities_1.createEntitiesResolver)(this.state.entities),
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
// Generate SDL before adding _service (to avoid circular reference)
|
|
279
|
+
const sdl = this.generateFederatedSDL(baseSchema, needsPlaceholder);
|
|
280
|
+
federationQueryFields._service = {
|
|
281
|
+
type: new core_1.GraphQLNonNull(serviceType),
|
|
282
|
+
resolve: (0, entities_1.createServiceResolver)(sdl),
|
|
283
|
+
};
|
|
284
|
+
// Build the final schema by extending the base Query type
|
|
285
|
+
const baseQueryType = baseSchema.getQueryType();
|
|
286
|
+
const baseQueryFields = baseQueryType?.getFields() ?? {};
|
|
287
|
+
const queryType = new core_1.GraphQLObjectType({
|
|
288
|
+
name: "Query",
|
|
289
|
+
fields: () => {
|
|
290
|
+
const fields = {};
|
|
291
|
+
// Copy base query fields (excluding placeholder)
|
|
292
|
+
for (const [name, field] of Object.entries(baseQueryFields)) {
|
|
293
|
+
if (name === "_placeholder")
|
|
294
|
+
continue;
|
|
295
|
+
fields[name] = {
|
|
296
|
+
type: field.type,
|
|
297
|
+
args: field.args.reduce((acc, arg) => {
|
|
298
|
+
acc[arg.name] = {
|
|
299
|
+
type: arg.type,
|
|
300
|
+
description: arg.description,
|
|
301
|
+
defaultValue: arg.defaultValue,
|
|
302
|
+
};
|
|
303
|
+
return acc;
|
|
304
|
+
}, {}),
|
|
305
|
+
description: field.description,
|
|
306
|
+
resolve: field.resolve,
|
|
307
|
+
extensions: field.extensions,
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
// Add federation fields
|
|
311
|
+
Object.assign(fields, federationQueryFields);
|
|
312
|
+
return fields;
|
|
313
|
+
},
|
|
314
|
+
});
|
|
315
|
+
// Collect all types for the schema
|
|
316
|
+
const types = [scalars_1.AnyScalar, scalars_1.FieldSetScalar, serviceType];
|
|
317
|
+
if (entityUnion) {
|
|
318
|
+
types.push(entityUnion);
|
|
319
|
+
}
|
|
320
|
+
// Add all types from base schema except Query
|
|
321
|
+
for (const [name, type] of Object.entries(typeMap)) {
|
|
322
|
+
if (!name.startsWith("__") && name !== "Query") {
|
|
323
|
+
types.push(type);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
const schema = new core_1.GraphQLSchema({
|
|
327
|
+
query: queryType,
|
|
328
|
+
mutation: baseSchema.getMutationType() ?? undefined,
|
|
329
|
+
subscription: baseSchema.getSubscriptionType() ?? undefined,
|
|
330
|
+
types,
|
|
331
|
+
});
|
|
332
|
+
return { schema, sdl };
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Check if the core builder has any query fields registered
|
|
336
|
+
*/
|
|
337
|
+
hasQueryFields() {
|
|
338
|
+
// We need to check if there are any queries registered
|
|
339
|
+
// Since we can't access private state, we try building and check
|
|
340
|
+
try {
|
|
341
|
+
const schema = this.state.coreBuilder.buildSchema();
|
|
342
|
+
const queryType = schema.getQueryType();
|
|
343
|
+
return queryType !== null && queryType !== undefined;
|
|
344
|
+
}
|
|
345
|
+
catch {
|
|
346
|
+
return false;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Build a standard (non-federated) schema.
|
|
351
|
+
* Useful for testing or running without a gateway.
|
|
352
|
+
*/
|
|
353
|
+
buildSchema() {
|
|
354
|
+
return this.state.coreBuilder.buildSchema();
|
|
355
|
+
}
|
|
356
|
+
// ============================================================================
|
|
357
|
+
// SDL Generation
|
|
358
|
+
// ============================================================================
|
|
359
|
+
/**
|
|
360
|
+
* Generate Federation-compliant SDL with directive annotations.
|
|
361
|
+
*/
|
|
362
|
+
generateFederatedSDL(schema, excludePlaceholder = false) {
|
|
363
|
+
// Start with federation schema extension
|
|
364
|
+
const lines = [
|
|
365
|
+
`extend schema @link(url: "https://specs.apollo.dev/federation/v${this.state.version}", import: ["@key", "@shareable", "@external", "@requires", "@provides", "@override", "@inaccessible", "@interfaceObject", "@tag"])`,
|
|
366
|
+
"",
|
|
367
|
+
];
|
|
368
|
+
// Print the base schema SDL
|
|
369
|
+
let baseSDL = (0, core_1.printSchema)(schema);
|
|
370
|
+
// Remove placeholder query if it was added
|
|
371
|
+
if (excludePlaceholder) {
|
|
372
|
+
baseSDL = baseSDL.replace(/\s*_placeholder:\s*String\n?/g, "");
|
|
373
|
+
}
|
|
374
|
+
// Process the SDL to add directive annotations
|
|
375
|
+
const annotatedSDL = this.annotateSDLWithDirectives(baseSDL, schema);
|
|
376
|
+
lines.push(annotatedSDL);
|
|
377
|
+
return lines.join("\n");
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Annotate SDL types with their federation directives from extensions.
|
|
381
|
+
*/
|
|
382
|
+
annotateSDLWithDirectives(sdl, schema) {
|
|
383
|
+
const typeMap = schema.getTypeMap();
|
|
384
|
+
let result = sdl;
|
|
385
|
+
for (const [typeName, type] of Object.entries(typeMap)) {
|
|
386
|
+
if (typeName.startsWith("__"))
|
|
387
|
+
continue;
|
|
388
|
+
const directives = type.extensions?.directives;
|
|
389
|
+
if (!directives || directives.length === 0)
|
|
390
|
+
continue;
|
|
391
|
+
const directiveStr = directives.map(formatDirective).join(" ");
|
|
392
|
+
// Match type definition and add directives
|
|
393
|
+
const typePattern = new RegExp(`(type\\s+${typeName}(?:\\s+implements\\s+[^{]+)?)(\\s*\\{)`, "g");
|
|
394
|
+
result = result.replace(typePattern, `$1 ${directiveStr}$2`);
|
|
395
|
+
const interfacePattern = new RegExp(`(interface\\s+${typeName})(\\s*\\{)`, "g");
|
|
396
|
+
result = result.replace(interfacePattern, `$1 ${directiveStr}$2`);
|
|
397
|
+
const enumPattern = new RegExp(`(enum\\s+${typeName})(\\s*\\{)`, "g");
|
|
398
|
+
result = result.replace(enumPattern, `$1 ${directiveStr}$2`);
|
|
399
|
+
const unionPattern = new RegExp(`(union\\s+${typeName})(\\s*=)`, "g");
|
|
400
|
+
result = result.replace(unionPattern, `$1 ${directiveStr}$2`);
|
|
401
|
+
const inputPattern = new RegExp(`(input\\s+${typeName})(\\s*\\{)`, "g");
|
|
402
|
+
result = result.replace(inputPattern, `$1 ${directiveStr}$2`);
|
|
403
|
+
}
|
|
404
|
+
// Also annotate fields with directives
|
|
405
|
+
for (const [typeName, type] of Object.entries(typeMap)) {
|
|
406
|
+
if (typeName.startsWith("__"))
|
|
407
|
+
continue;
|
|
408
|
+
if (!(type instanceof core_1.GraphQLObjectType))
|
|
409
|
+
continue;
|
|
410
|
+
const fields = type.getFields();
|
|
411
|
+
for (const [fieldName, field] of Object.entries(fields)) {
|
|
412
|
+
const fieldDirectives = field.extensions?.directives;
|
|
413
|
+
if (!fieldDirectives || fieldDirectives.length === 0)
|
|
414
|
+
continue;
|
|
415
|
+
const directiveStr = fieldDirectives.map(formatDirective).join(" ");
|
|
416
|
+
// Only replace within the context of this type
|
|
417
|
+
const typeBlockPattern = new RegExp(`(type\\s+${typeName}[^{]*\\{[\\s\\S]*?)(${fieldName}(?:\\([^)]*\\))?:\\s*[^\\n]+?)([\\n}])`, "g");
|
|
418
|
+
result = result.replace(typeBlockPattern, `$1$2 ${directiveStr}$3`);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
return result;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
exports.FederatedSchemaBuilder = FederatedSchemaBuilder;
|
|
425
|
+
/**
|
|
426
|
+
* Format a DirectiveApplication as SDL string
|
|
427
|
+
*/
|
|
428
|
+
function formatDirective(directive) {
|
|
429
|
+
if (!directive.args || Object.keys(directive.args).length === 0) {
|
|
430
|
+
return `@${directive.name}`;
|
|
431
|
+
}
|
|
432
|
+
const args = Object.entries(directive.args)
|
|
433
|
+
.map(([key, value]) => {
|
|
434
|
+
if (typeof value === "string") {
|
|
435
|
+
return `${key}: "${value}"`;
|
|
436
|
+
}
|
|
437
|
+
return `${key}: ${JSON.stringify(value)}`;
|
|
438
|
+
})
|
|
439
|
+
.join(", ");
|
|
440
|
+
return `@${directive.name}(${args})`;
|
|
441
|
+
}
|
|
442
|
+
//# sourceMappingURL=federated-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"federated-builder.js","sourceRoot":"","sources":["../src/federated-builder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAyC;AACzC,iDAAkC;AAClC,2CAQyB;AACzB,uCAAqD;AACrD,yCAKmB;AAEnB,mCAAgD;AAchD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,sBAAsB;IACI;IAArC,YAAqC,KAA+B;QAA/B,UAAK,GAAL,KAAK,CAA0B;IAAG,CAAC;IAwBxE,IAAI;QACF,OAAO,iBAAQ,CAAC,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;IAChD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,GAAG,IAAI,sBAAsB,CAAQ;QAC/C,WAAW,EAAE,2BAAoB,CAAC,KAAK;QACvC,QAAQ,EAAE,IAAI,GAAG,EAAE;QACnB,OAAO,EAAE,KAAK;KACf,CAAC,CAAA;IAEF;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,SAAgC,EAA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AAC,KAAK,CAAC,EAAE,CAAA;IAC3C,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAA;IAEb,OAAO,IAAI,SAAS,CAAC,IAAI,IAAI,IAAI,GAAG,CAAA;AACtC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { FederatedSchemaBuilder } from "./federated-builder";
|
|
2
|
+
export type { KeyDirective, FederationDirective, EntityRepresentation, EntityRegistration, FederatedSchemaConfig, FederatedSchemaResult, } from "./types";
|
|
3
|
+
export { toDirectiveApplication } from "./types";
|
|
4
|
+
export { key, shareable, inaccessible, interfaceObject, tag, external, requires, provides, override, } from "./directives";
|
|
5
|
+
export { entity, query, mutation, subscription, objectType, interfaceType, enumType, unionType, inputType, field, externalField, requiresField, providesField, overrideField, } from "./pipe-api";
|
|
6
|
+
export { AnyScalar, FieldSetScalar } from "./scalars";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAG5D,YAAY,EACV,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAGhD,OAAO,EACL,GAAG,EACH,SAAS,EACT,YAAY,EACZ,eAAe,EACf,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,GACT,MAAM,cAAc,CAAA;AAGrB,OAAO,EACL,MAAM,EACN,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,aAAa,EACb,QAAQ,EACR,SAAS,EACT,SAAS,EACT,KAAK,EACL,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,GACd,MAAM,YAAY,CAAA;AAGnB,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FieldSetScalar = exports.AnyScalar = exports.overrideField = exports.providesField = exports.requiresField = exports.externalField = exports.field = exports.inputType = exports.unionType = exports.enumType = exports.interfaceType = exports.objectType = exports.subscription = exports.mutation = exports.query = exports.entity = exports.override = exports.provides = exports.requires = exports.external = exports.tag = exports.interfaceObject = exports.inaccessible = exports.shareable = exports.key = exports.toDirectiveApplication = exports.FederatedSchemaBuilder = void 0;
|
|
4
|
+
// Core builder
|
|
5
|
+
var federated_builder_1 = require("./federated-builder");
|
|
6
|
+
Object.defineProperty(exports, "FederatedSchemaBuilder", { enumerable: true, get: function () { return federated_builder_1.FederatedSchemaBuilder; } });
|
|
7
|
+
var types_1 = require("./types");
|
|
8
|
+
Object.defineProperty(exports, "toDirectiveApplication", { enumerable: true, get: function () { return types_1.toDirectiveApplication; } });
|
|
9
|
+
// Directive factories
|
|
10
|
+
var directives_1 = require("./directives");
|
|
11
|
+
Object.defineProperty(exports, "key", { enumerable: true, get: function () { return directives_1.key; } });
|
|
12
|
+
Object.defineProperty(exports, "shareable", { enumerable: true, get: function () { return directives_1.shareable; } });
|
|
13
|
+
Object.defineProperty(exports, "inaccessible", { enumerable: true, get: function () { return directives_1.inaccessible; } });
|
|
14
|
+
Object.defineProperty(exports, "interfaceObject", { enumerable: true, get: function () { return directives_1.interfaceObject; } });
|
|
15
|
+
Object.defineProperty(exports, "tag", { enumerable: true, get: function () { return directives_1.tag; } });
|
|
16
|
+
Object.defineProperty(exports, "external", { enumerable: true, get: function () { return directives_1.external; } });
|
|
17
|
+
Object.defineProperty(exports, "requires", { enumerable: true, get: function () { return directives_1.requires; } });
|
|
18
|
+
Object.defineProperty(exports, "provides", { enumerable: true, get: function () { return directives_1.provides; } });
|
|
19
|
+
Object.defineProperty(exports, "override", { enumerable: true, get: function () { return directives_1.override; } });
|
|
20
|
+
// Pipe-able API
|
|
21
|
+
var pipe_api_1 = require("./pipe-api");
|
|
22
|
+
Object.defineProperty(exports, "entity", { enumerable: true, get: function () { return pipe_api_1.entity; } });
|
|
23
|
+
Object.defineProperty(exports, "query", { enumerable: true, get: function () { return pipe_api_1.query; } });
|
|
24
|
+
Object.defineProperty(exports, "mutation", { enumerable: true, get: function () { return pipe_api_1.mutation; } });
|
|
25
|
+
Object.defineProperty(exports, "subscription", { enumerable: true, get: function () { return pipe_api_1.subscription; } });
|
|
26
|
+
Object.defineProperty(exports, "objectType", { enumerable: true, get: function () { return pipe_api_1.objectType; } });
|
|
27
|
+
Object.defineProperty(exports, "interfaceType", { enumerable: true, get: function () { return pipe_api_1.interfaceType; } });
|
|
28
|
+
Object.defineProperty(exports, "enumType", { enumerable: true, get: function () { return pipe_api_1.enumType; } });
|
|
29
|
+
Object.defineProperty(exports, "unionType", { enumerable: true, get: function () { return pipe_api_1.unionType; } });
|
|
30
|
+
Object.defineProperty(exports, "inputType", { enumerable: true, get: function () { return pipe_api_1.inputType; } });
|
|
31
|
+
Object.defineProperty(exports, "field", { enumerable: true, get: function () { return pipe_api_1.field; } });
|
|
32
|
+
Object.defineProperty(exports, "externalField", { enumerable: true, get: function () { return pipe_api_1.externalField; } });
|
|
33
|
+
Object.defineProperty(exports, "requiresField", { enumerable: true, get: function () { return pipe_api_1.requiresField; } });
|
|
34
|
+
Object.defineProperty(exports, "providesField", { enumerable: true, get: function () { return pipe_api_1.providesField; } });
|
|
35
|
+
Object.defineProperty(exports, "overrideField", { enumerable: true, get: function () { return pipe_api_1.overrideField; } });
|
|
36
|
+
// Federation scalars (for advanced usage)
|
|
37
|
+
var scalars_1 = require("./scalars");
|
|
38
|
+
Object.defineProperty(exports, "AnyScalar", { enumerable: true, get: function () { return scalars_1.AnyScalar; } });
|
|
39
|
+
Object.defineProperty(exports, "FieldSetScalar", { enumerable: true, get: function () { return scalars_1.FieldSetScalar; } });
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,eAAe;AACf,yDAA4D;AAAnD,2HAAA,sBAAsB,OAAA;AAW/B,iCAAgD;AAAvC,+GAAA,sBAAsB,OAAA;AAE/B,sBAAsB;AACtB,2CAUqB;AATnB,iGAAA,GAAG,OAAA;AACH,uGAAA,SAAS,OAAA;AACT,0GAAA,YAAY,OAAA;AACZ,6GAAA,eAAe,OAAA;AACf,iGAAA,GAAG,OAAA;AACH,sGAAA,QAAQ,OAAA;AACR,sGAAA,QAAQ,OAAA;AACR,sGAAA,QAAQ,OAAA;AACR,sGAAA,QAAQ,OAAA;AAGV,gBAAgB;AAChB,uCAemB;AAdjB,kGAAA,MAAM,OAAA;AACN,iGAAA,KAAK,OAAA;AACL,oGAAA,QAAQ,OAAA;AACR,wGAAA,YAAY,OAAA;AACZ,sGAAA,UAAU,OAAA;AACV,yGAAA,aAAa,OAAA;AACb,oGAAA,QAAQ,OAAA;AACR,qGAAA,SAAS,OAAA;AACT,qGAAA,SAAS,OAAA;AACT,iGAAA,KAAK,OAAA;AACL,yGAAA,aAAa,OAAA;AACb,yGAAA,aAAa,OAAA;AACb,yGAAA,aAAa,OAAA;AACb,yGAAA,aAAa,OAAA;AAGf,0CAA0C;AAC1C,qCAAqD;AAA5C,oGAAA,SAAS,OAAA;AAAE,yGAAA,cAAc,OAAA"}
|