@effect-gql/federation 0.1.0 → 1.0.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.
@@ -1,182 +0,0 @@
1
- import { Effect, Pipeable } from "effect";
2
- import * as S from "effect/Schema";
3
- import { GraphQLSchemaBuilder, GraphQLSchema, type DirectiveApplication } from "@effect-gql/core";
4
- import type { EntityRegistration, FederatedSchemaConfig, FederatedSchemaResult } from "./types";
5
- /**
6
- * Federation-aware schema builder that extends the core GraphQLSchemaBuilder
7
- * with Apollo Federation 2.x support.
8
- *
9
- * @example
10
- * ```typescript
11
- * const schema = FederatedSchemaBuilder.empty
12
- * .pipe(
13
- * entity({
14
- * name: "User",
15
- * schema: UserSchema,
16
- * keys: [key({ fields: "id" })],
17
- * resolveReference: (ref) => UserService.findById(ref.id),
18
- * }),
19
- * query("me", {
20
- * type: UserSchema,
21
- * resolve: () => UserService.getCurrentUser(),
22
- * }),
23
- * )
24
- * .buildFederatedSchema()
25
- * ```
26
- */
27
- export declare class FederatedSchemaBuilder<R = never> implements Pipeable.Pipeable {
28
- private readonly state;
29
- private constructor();
30
- /**
31
- * Pipeable interface implementation
32
- */
33
- pipe<A>(this: A): A;
34
- pipe<A, B>(this: A, ab: (a: A) => B): B;
35
- pipe<A, B, C>(this: A, ab: (a: A) => B, bc: (b: B) => C): C;
36
- pipe<A, B, C, D>(this: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D): D;
37
- pipe<A, B, C, D, E>(this: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E): E;
38
- pipe<A, B, C, D, E, F>(this: A, ab: (a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F): F;
39
- /**
40
- * Create an empty federated schema builder
41
- */
42
- static empty: FederatedSchemaBuilder<never>;
43
- /**
44
- * Create a builder with custom configuration
45
- */
46
- static create(config?: FederatedSchemaConfig): FederatedSchemaBuilder<never>;
47
- /**
48
- * Create a new builder with updated state
49
- */
50
- private with;
51
- /**
52
- * Get the underlying core builder for advanced usage
53
- */
54
- get coreBuilder(): GraphQLSchemaBuilder<R>;
55
- /**
56
- * Register an entity type with @key directive(s) and reference resolver.
57
- *
58
- * Entities are the core building block of Apollo Federation. They represent
59
- * types that can be resolved across subgraph boundaries using their key fields.
60
- *
61
- * @example
62
- * ```typescript
63
- * builder.entity({
64
- * name: "User",
65
- * schema: UserSchema,
66
- * keys: [key({ fields: "id" })],
67
- * resolveReference: (ref) => UserService.findById(ref.id),
68
- * })
69
- * ```
70
- */
71
- entity<A, R2>(config: EntityRegistration<A, R2>): FederatedSchemaBuilder<R | R2>;
72
- /**
73
- * Add a query field
74
- */
75
- query<A, E, R2, Args = void>(name: string, config: {
76
- type: S.Schema<A, any, any>;
77
- args?: S.Schema<Args, any, any>;
78
- description?: string;
79
- directives?: readonly DirectiveApplication[];
80
- resolve: (args: Args) => Effect.Effect<A, E, R2>;
81
- }): FederatedSchemaBuilder<R | R2>;
82
- /**
83
- * Add a mutation field
84
- */
85
- mutation<A, E, R2, Args = void>(name: string, config: {
86
- type: S.Schema<A, any, any>;
87
- args?: S.Schema<Args, any, any>;
88
- description?: string;
89
- directives?: readonly DirectiveApplication[];
90
- resolve: (args: Args) => Effect.Effect<A, E, R2>;
91
- }): FederatedSchemaBuilder<R | R2>;
92
- /**
93
- * Add a subscription field
94
- */
95
- subscription<A, E, R2, Args = void>(name: string, config: {
96
- type: S.Schema<A, any, any>;
97
- args?: S.Schema<Args, any, any>;
98
- description?: string;
99
- directives?: readonly DirectiveApplication[];
100
- subscribe: (args: Args) => Effect.Effect<import("effect").Stream.Stream<A, E, R2>, E, R2>;
101
- resolve?: (value: A, args: Args) => Effect.Effect<A, E, R2>;
102
- }): FederatedSchemaBuilder<R | R2>;
103
- /**
104
- * Register an object type (non-entity)
105
- */
106
- objectType<A, R2 = never>(config: {
107
- name?: string;
108
- schema: S.Schema<A, any, any>;
109
- implements?: readonly string[];
110
- directives?: readonly DirectiveApplication[];
111
- }): FederatedSchemaBuilder<R | R2>;
112
- /**
113
- * Register an interface type
114
- */
115
- interfaceType(config: {
116
- name?: string;
117
- schema: S.Schema<any, any, any>;
118
- resolveType?: (value: any) => string;
119
- directives?: readonly DirectiveApplication[];
120
- }): FederatedSchemaBuilder<R>;
121
- /**
122
- * Register an enum type
123
- */
124
- enumType(config: {
125
- name: string;
126
- values: readonly string[];
127
- description?: string;
128
- directives?: readonly DirectiveApplication[];
129
- }): FederatedSchemaBuilder<R>;
130
- /**
131
- * Register a union type
132
- */
133
- unionType(config: {
134
- name: string;
135
- types: readonly string[];
136
- resolveType?: (value: any) => string;
137
- directives?: readonly DirectiveApplication[];
138
- }): FederatedSchemaBuilder<R>;
139
- /**
140
- * Register an input type
141
- */
142
- inputType(config: {
143
- name?: string;
144
- schema: S.Schema<any, any, any>;
145
- description?: string;
146
- directives?: readonly DirectiveApplication[];
147
- }): FederatedSchemaBuilder<R>;
148
- /**
149
- * Add a computed/relational field to an object type
150
- */
151
- field<Parent, A, E, R2, Args = void>(typeName: string, fieldName: string, config: {
152
- type: S.Schema<A, any, any>;
153
- args?: S.Schema<Args, any, any>;
154
- description?: string;
155
- directives?: readonly DirectiveApplication[];
156
- resolve: (parent: Parent, args: Args) => Effect.Effect<A, E, R2>;
157
- }): FederatedSchemaBuilder<R | R2>;
158
- /**
159
- * Build the federated GraphQL schema with _entities and _service queries.
160
- *
161
- * Returns both the executable schema and the Federation-compliant SDL.
162
- */
163
- buildFederatedSchema(): FederatedSchemaResult;
164
- /**
165
- * Check if the core builder has any query fields registered
166
- */
167
- private hasQueryFields;
168
- /**
169
- * Build a standard (non-federated) schema.
170
- * Useful for testing or running without a gateway.
171
- */
172
- buildSchema(): GraphQLSchema;
173
- /**
174
- * Generate Federation-compliant SDL with directive annotations.
175
- */
176
- private generateFederatedSDL;
177
- /**
178
- * Annotate SDL types with their federation directives from extensions.
179
- */
180
- private annotateSDLWithDirectives;
181
- }
182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MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;KACjE,GACA,sBAAsB,CAAC,CAAC,GAAG,EAAE,CAAC;IAcjC;;;;OAIG;IACH,oBAAoB,IAAI,qBAAqB;IAyH7C;;OAEG;IACH,OAAO,CAAC,cAAc;IAYtB;;;OAGG;IACH,WAAW,IAAI,aAAa;IAQ5B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAuB5B;;OAEG;IACH,OAAO,CAAC,yBAAyB;CAyDlC"}
@@ -1,442 +0,0 @@
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"federated-builder.js","sourceRoot":"","sources":["../src/federated-builder.ts"],"names":[],"mappings":";;;;;;;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ED,OAAO,MAAM,CAAA;IACf,CAAC;;AApgBH,wDAqgBC;AAED;;GAEG;AACH,SAAS,eAAe,CAAC,SAA+B;IACtD,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChE,OAAO,IAAI,SAAS,CAAC,IAAI,EAAE,CAAA;IAC7B,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC;SACxC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACpB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO,GAAG,GAAG,MAAM,KAAK,GAAG,CAAA;QAC7B,CAAC;QACD,OAAO,GAAG,GAAG,KAAK,IAAI,CAAC,SAAS,CAAC,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 DELETED
@@ -1,7 +0,0 @@
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
@@ -1 +0,0 @@
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"}