@graphql-yoga/nestjs-federation 3.19.1-alpha-20251226160830-0bf7e5bcc7b9618b7deed66f4d1501a172b47440 → 3.19.1-alpha-20260113193351-a123ba72cca9021624bde80f73cb84f48963116a
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/CHANGELOG.md +5 -5
- package/dist/_virtual/_@oxc-project_runtime@0.107.0/helpers/decorate.cjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.107.0/helpers/decorate.mjs +10 -0
- package/dist/index.cjs +79 -0
- package/dist/index.d.cts +28 -0
- package/dist/index.d.mts +28 -0
- package/dist/index.mjs +68 -0
- package/package.json +18 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# @graphql-yoga/nestjs-federation
|
|
2
2
|
|
|
3
|
-
## 3.19.1-alpha-
|
|
3
|
+
## 3.19.1-alpha-20260113193351-a123ba72cca9021624bde80f73cb84f48963116a
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
7
|
- [#4320](https://github.com/graphql-hive/graphql-yoga/pull/4320)
|
|
8
|
-
[`
|
|
8
|
+
[`6b7a1fc`](https://github.com/graphql-hive/graphql-yoga/commit/6b7a1fcdbe8691f084e33f062c209fa079174320)
|
|
9
9
|
Thanks [@EmrysMyrddin](https://github.com/EmrysMyrddin)! - dependencies updates:
|
|
10
10
|
- Updated dependency
|
|
11
11
|
[`@envelop/apollo-federation@workspace:^` ↗︎](https://www.npmjs.com/package/@envelop/apollo-federation/v/workspace:^)
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
[`@envelop/core@workspace:^` ↗︎](https://www.npmjs.com/package/@envelop/core/v/workspace:^)
|
|
15
15
|
(from `^5.3.0`, in `dependencies`)
|
|
16
16
|
- Updated dependencies
|
|
17
|
-
[[`
|
|
18
|
-
- @graphql-yoga/plugin-apollo-inline-trace@3.18.1-alpha-
|
|
19
|
-
- @graphql-yoga/nestjs@3.19.1-alpha-
|
|
17
|
+
[[`6b7a1fc`](https://github.com/graphql-hive/graphql-yoga/commit/6b7a1fcdbe8691f084e33f062c209fa079174320)]:
|
|
18
|
+
- @graphql-yoga/plugin-apollo-inline-trace@3.18.1-alpha-20260113193351-a123ba72cca9021624bde80f73cb84f48963116a
|
|
19
|
+
- @graphql-yoga/nestjs@3.19.1-alpha-20260113193351-a123ba72cca9021624bde80f73cb84f48963116a
|
|
20
20
|
|
|
21
21
|
## 3.19.0
|
|
22
22
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
//#region \0@oxc-project+runtime@0.107.0/helpers/decorate.js
|
|
3
|
+
function __decorate(decorators, target, key, desc) {
|
|
4
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
6
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
7
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.__decorate = __decorate;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region \0@oxc-project+runtime@0.107.0/helpers/decorate.js
|
|
2
|
+
function __decorate(decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { __decorate };
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
const require_decorate = require('./_virtual/_@oxc-project_runtime@0.107.0/helpers/decorate.cjs');
|
|
2
|
+
let graphql = require("graphql");
|
|
3
|
+
let _apollo_gateway = require("@apollo/gateway");
|
|
4
|
+
let _apollo_subgraph = require("@apollo/subgraph");
|
|
5
|
+
let _envelop_apollo_federation = require("@envelop/apollo-federation");
|
|
6
|
+
let _graphql_yoga_nestjs = require("@graphql-yoga/nestjs");
|
|
7
|
+
let _graphql_yoga_plugin_apollo_inline_trace = require("@graphql-yoga/plugin-apollo-inline-trace");
|
|
8
|
+
let _nestjs_common = require("@nestjs/common");
|
|
9
|
+
let _nestjs_graphql = require("@nestjs/graphql");
|
|
10
|
+
|
|
11
|
+
//#region src/index.ts
|
|
12
|
+
let YogaFederationDriver = class YogaFederationDriver$1 extends _graphql_yoga_nestjs.AbstractYogaDriver {
|
|
13
|
+
subscriptionService;
|
|
14
|
+
constructor(graphqlFederationFactory) {
|
|
15
|
+
super();
|
|
16
|
+
this.graphqlFederationFactory = graphqlFederationFactory;
|
|
17
|
+
}
|
|
18
|
+
async generateSchema(options) {
|
|
19
|
+
return await this.graphqlFederationFactory.generateSchema(options);
|
|
20
|
+
}
|
|
21
|
+
async start(options) {
|
|
22
|
+
if (options.definitions?.path) {
|
|
23
|
+
if (!options.schema) throw new Error("Schema is required when providing definitions path");
|
|
24
|
+
await this.graphQlFactory.generateDefinitions((0, _apollo_subgraph.printSubgraphSchema)(options.schema), options);
|
|
25
|
+
}
|
|
26
|
+
await super.start({
|
|
27
|
+
...options,
|
|
28
|
+
plugins: [...options?.plugins || [], (0, _graphql_yoga_plugin_apollo_inline_trace.useApolloInlineTrace)()]
|
|
29
|
+
});
|
|
30
|
+
if (options.subscriptions && options.schema) {
|
|
31
|
+
const config = options.subscriptions === true ? { "graphql-ws": true } : options.subscriptions;
|
|
32
|
+
this.subscriptionService = new _nestjs_graphql.GqlSubscriptionService({
|
|
33
|
+
schema: options.schema,
|
|
34
|
+
path: options.path,
|
|
35
|
+
context: options.context,
|
|
36
|
+
...config
|
|
37
|
+
}, this.httpAdapterHost.httpAdapter?.getHttpServer());
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async stop() {
|
|
41
|
+
await this.subscriptionService?.stop();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
YogaFederationDriver = require_decorate.__decorate([(0, _nestjs_common.Injectable)()], YogaFederationDriver);
|
|
45
|
+
let YogaGatewayDriver = class YogaGatewayDriver$1 extends _graphql_yoga_nestjs.AbstractYogaDriver {
|
|
46
|
+
async generateSchema(_options) {
|
|
47
|
+
return new graphql.GraphQLSchema({});
|
|
48
|
+
}
|
|
49
|
+
async start(options) {
|
|
50
|
+
const { server: serverOpts = {}, gateway: gatewayOpts = {} } = options;
|
|
51
|
+
const gateway = new _apollo_gateway.ApolloGateway(gatewayOpts);
|
|
52
|
+
await gateway.load();
|
|
53
|
+
await super.start({
|
|
54
|
+
...serverOpts,
|
|
55
|
+
plugins: [...serverOpts.plugins || [], (0, _envelop_apollo_federation.useApolloFederation)({ gateway })]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
async mergeDefaultOptions(options) {
|
|
59
|
+
return {
|
|
60
|
+
...options,
|
|
61
|
+
server: await super.mergeDefaultOptions(options?.["server"] ?? {})
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
YogaGatewayDriver = require_decorate.__decorate([(0, _nestjs_common.Injectable)()], YogaGatewayDriver);
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
Object.defineProperty(exports, 'YogaFederationDriver', {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function () {
|
|
71
|
+
return YogaFederationDriver;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
Object.defineProperty(exports, 'YogaGatewayDriver', {
|
|
75
|
+
enumerable: true,
|
|
76
|
+
get: function () {
|
|
77
|
+
return YogaGatewayDriver;
|
|
78
|
+
}
|
|
79
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { GraphQLSchema } from "graphql";
|
|
2
|
+
import { GatewayConfig } from "@apollo/gateway";
|
|
3
|
+
import { AbstractYogaDriver, YogaDriver, YogaDriverConfig, YogaDriverPlatform } from "@graphql-yoga/nestjs";
|
|
4
|
+
import { Type } from "@nestjs/common";
|
|
5
|
+
import { GraphQLFederationFactory } from "@nestjs/graphql";
|
|
6
|
+
|
|
7
|
+
//#region src/index.d.ts
|
|
8
|
+
type YogaFederationDriverConfig<Platform extends YogaDriverPlatform = 'express'> = YogaDriverConfig<Platform>;
|
|
9
|
+
declare class YogaFederationDriver<Platform extends YogaDriverPlatform = 'express'> extends AbstractYogaDriver<Platform> {
|
|
10
|
+
private readonly graphqlFederationFactory;
|
|
11
|
+
private subscriptionService?;
|
|
12
|
+
constructor(graphqlFederationFactory: GraphQLFederationFactory);
|
|
13
|
+
generateSchema(options: YogaFederationDriverConfig<Platform>): Promise<GraphQLSchema>;
|
|
14
|
+
start(options: YogaFederationDriverConfig<Platform>): Promise<void>;
|
|
15
|
+
stop(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
interface YogaGatewayDriverConfig<Platform extends YogaDriverPlatform = 'express'> {
|
|
18
|
+
driver?: Type<YogaDriver<Platform>>;
|
|
19
|
+
gateway?: GatewayConfig;
|
|
20
|
+
server?: Omit<YogaDriverConfig<Platform>, 'endpoint' | 'schema' | 'typeDefs' | 'definitions' | 'resolvers' | 'resolverValidationOptions' | 'directiveResolvers' | 'autoSchemaFile' | 'transformSchema' | 'subscriptions' | 'buildSchemaOptions' | 'fieldResolverEnhancers' | 'driver'>;
|
|
21
|
+
}
|
|
22
|
+
declare class YogaGatewayDriver<Platform extends YogaDriverPlatform = 'express'> extends AbstractYogaDriver<Platform> {
|
|
23
|
+
generateSchema(_options: YogaGatewayDriverConfig<Platform>): Promise<GraphQLSchema>;
|
|
24
|
+
start(options: YogaGatewayDriverConfig<Platform>): Promise<void>;
|
|
25
|
+
mergeDefaultOptions(options: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { YogaFederationDriver, YogaFederationDriverConfig, YogaGatewayDriver, YogaGatewayDriverConfig };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { GraphQLSchema } from "graphql";
|
|
2
|
+
import { GatewayConfig } from "@apollo/gateway";
|
|
3
|
+
import { AbstractYogaDriver, YogaDriver, YogaDriverConfig, YogaDriverPlatform } from "@graphql-yoga/nestjs";
|
|
4
|
+
import { Type } from "@nestjs/common";
|
|
5
|
+
import { GraphQLFederationFactory } from "@nestjs/graphql";
|
|
6
|
+
|
|
7
|
+
//#region src/index.d.ts
|
|
8
|
+
type YogaFederationDriverConfig<Platform extends YogaDriverPlatform = 'express'> = YogaDriverConfig<Platform>;
|
|
9
|
+
declare class YogaFederationDriver<Platform extends YogaDriverPlatform = 'express'> extends AbstractYogaDriver<Platform> {
|
|
10
|
+
private readonly graphqlFederationFactory;
|
|
11
|
+
private subscriptionService?;
|
|
12
|
+
constructor(graphqlFederationFactory: GraphQLFederationFactory);
|
|
13
|
+
generateSchema(options: YogaFederationDriverConfig<Platform>): Promise<GraphQLSchema>;
|
|
14
|
+
start(options: YogaFederationDriverConfig<Platform>): Promise<void>;
|
|
15
|
+
stop(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
interface YogaGatewayDriverConfig<Platform extends YogaDriverPlatform = 'express'> {
|
|
18
|
+
driver?: Type<YogaDriver<Platform>>;
|
|
19
|
+
gateway?: GatewayConfig;
|
|
20
|
+
server?: Omit<YogaDriverConfig<Platform>, 'endpoint' | 'schema' | 'typeDefs' | 'definitions' | 'resolvers' | 'resolverValidationOptions' | 'directiveResolvers' | 'autoSchemaFile' | 'transformSchema' | 'subscriptions' | 'buildSchemaOptions' | 'fieldResolverEnhancers' | 'driver'>;
|
|
21
|
+
}
|
|
22
|
+
declare class YogaGatewayDriver<Platform extends YogaDriverPlatform = 'express'> extends AbstractYogaDriver<Platform> {
|
|
23
|
+
generateSchema(_options: YogaGatewayDriverConfig<Platform>): Promise<GraphQLSchema>;
|
|
24
|
+
start(options: YogaGatewayDriverConfig<Platform>): Promise<void>;
|
|
25
|
+
mergeDefaultOptions(options: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { YogaFederationDriver, YogaFederationDriverConfig, YogaGatewayDriver, YogaGatewayDriverConfig };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { __decorate } from "./_virtual/_@oxc-project_runtime@0.107.0/helpers/decorate.mjs";
|
|
2
|
+
import { GraphQLSchema } from "graphql";
|
|
3
|
+
import { ApolloGateway } from "@apollo/gateway";
|
|
4
|
+
import { printSubgraphSchema } from "@apollo/subgraph";
|
|
5
|
+
import { useApolloFederation } from "@envelop/apollo-federation";
|
|
6
|
+
import { AbstractYogaDriver } from "@graphql-yoga/nestjs";
|
|
7
|
+
import { useApolloInlineTrace } from "@graphql-yoga/plugin-apollo-inline-trace";
|
|
8
|
+
import { Injectable } from "@nestjs/common";
|
|
9
|
+
import { GqlSubscriptionService } from "@nestjs/graphql";
|
|
10
|
+
|
|
11
|
+
//#region src/index.ts
|
|
12
|
+
let YogaFederationDriver = class YogaFederationDriver$1 extends AbstractYogaDriver {
|
|
13
|
+
subscriptionService;
|
|
14
|
+
constructor(graphqlFederationFactory) {
|
|
15
|
+
super();
|
|
16
|
+
this.graphqlFederationFactory = graphqlFederationFactory;
|
|
17
|
+
}
|
|
18
|
+
async generateSchema(options) {
|
|
19
|
+
return await this.graphqlFederationFactory.generateSchema(options);
|
|
20
|
+
}
|
|
21
|
+
async start(options) {
|
|
22
|
+
if (options.definitions?.path) {
|
|
23
|
+
if (!options.schema) throw new Error("Schema is required when providing definitions path");
|
|
24
|
+
await this.graphQlFactory.generateDefinitions(printSubgraphSchema(options.schema), options);
|
|
25
|
+
}
|
|
26
|
+
await super.start({
|
|
27
|
+
...options,
|
|
28
|
+
plugins: [...options?.plugins || [], useApolloInlineTrace()]
|
|
29
|
+
});
|
|
30
|
+
if (options.subscriptions && options.schema) {
|
|
31
|
+
const config = options.subscriptions === true ? { "graphql-ws": true } : options.subscriptions;
|
|
32
|
+
this.subscriptionService = new GqlSubscriptionService({
|
|
33
|
+
schema: options.schema,
|
|
34
|
+
path: options.path,
|
|
35
|
+
context: options.context,
|
|
36
|
+
...config
|
|
37
|
+
}, this.httpAdapterHost.httpAdapter?.getHttpServer());
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async stop() {
|
|
41
|
+
await this.subscriptionService?.stop();
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
YogaFederationDriver = __decorate([Injectable()], YogaFederationDriver);
|
|
45
|
+
let YogaGatewayDriver = class YogaGatewayDriver$1 extends AbstractYogaDriver {
|
|
46
|
+
async generateSchema(_options) {
|
|
47
|
+
return new GraphQLSchema({});
|
|
48
|
+
}
|
|
49
|
+
async start(options) {
|
|
50
|
+
const { server: serverOpts = {}, gateway: gatewayOpts = {} } = options;
|
|
51
|
+
const gateway = new ApolloGateway(gatewayOpts);
|
|
52
|
+
await gateway.load();
|
|
53
|
+
await super.start({
|
|
54
|
+
...serverOpts,
|
|
55
|
+
plugins: [...serverOpts.plugins || [], useApolloFederation({ gateway })]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
async mergeDefaultOptions(options) {
|
|
59
|
+
return {
|
|
60
|
+
...options,
|
|
61
|
+
server: await super.mergeDefaultOptions(options?.["server"] ?? {})
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
YogaGatewayDriver = __decorate([Injectable()], YogaGatewayDriver);
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
export { YogaFederationDriver, YogaGatewayDriver };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-yoga/nestjs-federation",
|
|
3
|
-
"version": "3.19.1-alpha-
|
|
3
|
+
"version": "3.19.1-alpha-20260113193351-a123ba72cca9021624bde80f73cb84f48963116a",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "GraphQL Yoga driver with Apollo Federation for NestJS GraphQL.",
|
|
6
6
|
"repository": {
|
|
@@ -13,22 +13,22 @@
|
|
|
13
13
|
"engines": {
|
|
14
14
|
"node": ">=18.0.0"
|
|
15
15
|
},
|
|
16
|
-
"main": "dist/
|
|
17
|
-
"typings": "dist/
|
|
18
|
-
"module": "dist/
|
|
16
|
+
"main": "dist/index.cjs",
|
|
17
|
+
"typings": "dist/index.d.mts",
|
|
18
|
+
"module": "dist/index.mjs",
|
|
19
19
|
"exports": {
|
|
20
20
|
".": {
|
|
21
21
|
"require": {
|
|
22
|
-
"types": "./dist/
|
|
23
|
-
"default": "./dist/
|
|
22
|
+
"types": "./dist/index.d.cts",
|
|
23
|
+
"default": "./dist/index.cjs"
|
|
24
24
|
},
|
|
25
25
|
"import": {
|
|
26
|
-
"types": "./dist/
|
|
27
|
-
"default": "./dist/
|
|
26
|
+
"types": "./dist/index.d.mts",
|
|
27
|
+
"default": "./dist/index.mjs"
|
|
28
28
|
},
|
|
29
29
|
"default": {
|
|
30
|
-
"types": "./dist/
|
|
31
|
-
"default": "./dist/
|
|
30
|
+
"types": "./dist/index.d.mts",
|
|
31
|
+
"default": "./dist/index.mjs"
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"./package.json": "./package.json"
|
|
@@ -44,7 +44,9 @@
|
|
|
44
44
|
"federation"
|
|
45
45
|
],
|
|
46
46
|
"scripts": {
|
|
47
|
-
"
|
|
47
|
+
"build": "tsdown",
|
|
48
|
+
"check": "echo \"No checks specified\"; exit 0",
|
|
49
|
+
"watch": "tsdown --watch"
|
|
48
50
|
},
|
|
49
51
|
"peerDependencies": {
|
|
50
52
|
"@nestjs/common": "^11.0.0",
|
|
@@ -65,13 +67,17 @@
|
|
|
65
67
|
"@nestjs/core": "^11.0.0",
|
|
66
68
|
"@nestjs/graphql": "^13.0.0",
|
|
67
69
|
"graphql": "16.12.0",
|
|
70
|
+
"tsdown": "^0.20.0-beta.1",
|
|
68
71
|
"tslib": "^2.8.1"
|
|
69
72
|
},
|
|
70
73
|
"publishConfig": {
|
|
71
74
|
"access": "public"
|
|
72
75
|
},
|
|
73
76
|
"sideEffects": false,
|
|
77
|
+
"buildOptions": {
|
|
78
|
+
"input": "./src/index.ts"
|
|
79
|
+
},
|
|
74
80
|
"typescript": {
|
|
75
|
-
"definition": "dist/
|
|
81
|
+
"definition": "dist/index.d.mts"
|
|
76
82
|
}
|
|
77
83
|
}
|