@nestjs/apollo 10.2.0 → 11.0.0-next.2
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/dist/constants/apollo.constants.d.ts +2 -0
- package/dist/constants/apollo.constants.d.ts.map +1 -0
- package/dist/constants/apollo.constants.js +4 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +4 -0
- package/dist/decorators/plugin.decorator.js +2 -2
- package/dist/drivers/apollo-base.driver.d.ts +5 -5
- package/dist/drivers/apollo-base.driver.d.ts.map +1 -1
- package/dist/drivers/apollo-base.driver.js +78 -41
- package/dist/drivers/apollo-federation.driver.d.ts +2 -1
- package/dist/drivers/apollo-federation.driver.d.ts.map +1 -1
- package/dist/drivers/apollo-federation.driver.js +4 -10
- package/dist/drivers/apollo-gateway.driver.d.ts +1 -0
- package/dist/drivers/apollo-gateway.driver.d.ts.map +1 -1
- package/dist/drivers/apollo-gateway.driver.js +3 -0
- package/dist/drivers/apollo.driver.d.ts +1 -1
- package/dist/drivers/apollo.driver.d.ts.map +1 -1
- package/dist/drivers/apollo.driver.js +2 -3
- package/dist/errors/authentication.error.d.ts +11 -0
- package/dist/errors/authentication.error.d.ts.map +1 -0
- package/dist/errors/authentication.error.js +22 -0
- package/dist/errors/forbidden.error.d.ts +11 -0
- package/dist/errors/forbidden.error.d.ts.map +1 -0
- package/dist/errors/forbidden.error.js +22 -0
- package/dist/errors/index.d.ts +5 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +7 -0
- package/dist/errors/user-input.error.d.ts +11 -0
- package/dist/errors/user-input.error.d.ts.map +1 -0
- package/dist/errors/user-input.error.js +23 -0
- package/dist/errors/validation.error.d.ts +11 -0
- package/dist/errors/validation.error.d.ts.map +1 -0
- package/dist/errors/validation.error.js +23 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/interfaces/apollo-driver-config.interface.d.ts +5 -25
- package/dist/interfaces/apollo-driver-config.interface.d.ts.map +1 -1
- package/dist/interfaces/apollo-federation-driver-config.interface.d.ts +3 -3
- package/dist/interfaces/apollo-federation-driver-config.interface.d.ts.map +1 -1
- package/dist/interfaces/apollo-gateway-driver-config.interface.d.ts +2 -2
- package/dist/interfaces/apollo-gateway-driver-config.interface.d.ts.map +1 -1
- package/dist/services/plugins-explorer.service.js +2 -2
- package/dist/utils/async-iterator.util.d.ts +1 -1
- package/dist/utils/async-iterator.util.d.ts.map +1 -1
- package/dist/utils/get-apollo-server.d.ts +4 -2
- package/dist/utils/get-apollo-server.d.ts.map +1 -1
- package/dist/utils/get-apollo-server.js +2 -2
- package/package.json +23 -36
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apollo.constants.d.ts","sourceRoot":"","sources":["../../lib/constants/apollo.constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/constants/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Plugin = void 0;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
|
-
const
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
6
|
/**
|
|
7
7
|
* Decorator that marks a class as an Apollo plugin.
|
|
8
8
|
*/
|
|
9
9
|
function Plugin() {
|
|
10
10
|
return (target) => {
|
|
11
|
-
(0, common_1.SetMetadata)(
|
|
11
|
+
(0, common_1.SetMetadata)(constants_1.PLUGIN_METADATA, true)(target);
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
exports.Plugin = Plugin;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import { ApolloServer, type BaseContext } from '@apollo/server';
|
|
1
2
|
import { AbstractGraphQLDriver } from '@nestjs/graphql';
|
|
2
|
-
import { ApolloServerBase } from 'apollo-server-core';
|
|
3
3
|
import { ApolloDriverConfig } from '../interfaces';
|
|
4
4
|
export declare abstract class ApolloBaseDriver<T extends Record<string, any> = ApolloDriverConfig> extends AbstractGraphQLDriver<T> {
|
|
5
|
-
protected
|
|
6
|
-
get instance():
|
|
5
|
+
protected apolloServer: ApolloServer<BaseContext>;
|
|
6
|
+
get instance(): ApolloServer<BaseContext>;
|
|
7
7
|
start(apolloOptions: T): Promise<void>;
|
|
8
8
|
stop(): Promise<void>;
|
|
9
9
|
mergeDefaultOptions(options: T): Promise<T>;
|
|
10
10
|
subscriptionWithFilter(instanceRef: unknown, filterFn: (payload: any, variables: any, context: any) => boolean | Promise<boolean>, createSubscribeContext: Function): <TPayload, TVariables, TContext, TInfo>(args_0: TPayload, args_1: TVariables, args_2: TContext, args_3: TInfo) => any;
|
|
11
|
-
protected registerExpress(
|
|
11
|
+
protected registerExpress(options: T, { preStartHook }?: {
|
|
12
12
|
preStartHook?: () => void;
|
|
13
13
|
}): Promise<void>;
|
|
14
|
-
protected registerFastify(
|
|
14
|
+
protected registerFastify(options: T, { preStartHook }?: {
|
|
15
15
|
preStartHook?: () => void;
|
|
16
16
|
}): Promise<void>;
|
|
17
17
|
private wrapFormatErrorFn;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apollo-base.driver.d.ts","sourceRoot":"","sources":["../../lib/drivers/apollo-base.driver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"apollo-base.driver.d.ts","sourceRoot":"","sources":["../../lib/drivers/apollo-base.driver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAShE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAGxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AASnD,8BAAsB,gBAAgB,CACpC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,kBAAkB,CAClD,SAAQ,qBAAqB,CAAC,CAAC,CAAC;IAChC,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;IAElD,IAAI,QAAQ,IAAI,YAAY,CAAC,WAAW,CAAC,CAExC;IAEY,KAAK,CAAC,aAAa,EAAE,CAAC;IAa5B,IAAI;IAIE,mBAAmB,CAAC,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IA6CjD,sBAAsB,CAC3B,WAAW,EAAE,OAAO,EACpB,QAAQ,EAAE,CACR,OAAO,EAAE,GAAG,EACZ,SAAS,EAAE,GAAG,EACd,OAAO,EAAE,GAAG,KACT,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,EAC/B,sBAAsB,EAAE,QAAQ,qHAI7B,GAAG;cAMQ,eAAe,CAC7B,OAAO,EAAE,CAAC,EACV,EAAE,YAAY,EAAE,GAAE;QAAE,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;KAAO;cAkCtC,eAAe,CAC7B,OAAO,EAAE,CAAC,EACV,EAAE,YAAY,EAAE,GAAE;QAAE,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;KAAO;IAuCtD,OAAO,CAAC,iBAAiB;IAiBzB,OAAO,CAAC,0BAA0B;IAgClC,OAAO,CAAC,mBAAmB;IA8B3B,OAAO,CAAC,iBAAiB;CAgB1B"}
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ApolloBaseDriver = void 0;
|
|
4
|
+
const server_1 = require("@apollo/server");
|
|
5
|
+
const server_plugin_landing_page_graphql_playground_1 = require("@apollo/server-plugin-landing-page-graphql-playground");
|
|
6
|
+
const errors_1 = require("@apollo/server/errors");
|
|
7
|
+
const express4_1 = require("@apollo/server/express4");
|
|
8
|
+
const disabled_1 = require("@apollo/server/plugin/disabled");
|
|
9
|
+
const drainHttpServer_1 = require("@apollo/server/plugin/drainHttpServer");
|
|
4
10
|
const common_1 = require("@nestjs/common");
|
|
5
11
|
const load_package_util_1 = require("@nestjs/common/utils/load-package.util");
|
|
6
12
|
const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
|
|
7
13
|
const graphql_1 = require("@nestjs/graphql");
|
|
8
|
-
const
|
|
14
|
+
const graphql_2 = require("graphql");
|
|
9
15
|
const omit = require("lodash.omit");
|
|
10
16
|
const async_iterator_util_1 = require("../utils/async-iterator.util");
|
|
11
17
|
const apolloPredefinedExceptions = {
|
|
12
|
-
[common_1.HttpStatus.BAD_REQUEST]:
|
|
13
|
-
[common_1.HttpStatus.UNAUTHORIZED]:
|
|
14
|
-
[common_1.HttpStatus.FORBIDDEN]:
|
|
18
|
+
[common_1.HttpStatus.BAD_REQUEST]: errors_1.ApolloServerErrorCode.BAD_REQUEST,
|
|
19
|
+
[common_1.HttpStatus.UNAUTHORIZED]: 'UNAUTHENTICATED',
|
|
20
|
+
[common_1.HttpStatus.FORBIDDEN]: 'FORBIDDEN',
|
|
15
21
|
};
|
|
16
22
|
class ApolloBaseDriver extends graphql_1.AbstractGraphQLDriver {
|
|
17
23
|
get instance() {
|
|
18
|
-
return this.
|
|
24
|
+
return this.apolloServer;
|
|
19
25
|
}
|
|
20
26
|
async start(apolloOptions) {
|
|
21
27
|
const httpAdapter = this.httpAdapterHost.httpAdapter;
|
|
@@ -32,7 +38,7 @@ class ApolloBaseDriver extends graphql_1.AbstractGraphQLDriver {
|
|
|
32
38
|
}
|
|
33
39
|
stop() {
|
|
34
40
|
var _a;
|
|
35
|
-
return (_a = this.
|
|
41
|
+
return (_a = this.apolloServer) === null || _a === void 0 ? void 0 : _a.stop();
|
|
36
42
|
}
|
|
37
43
|
async mergeDefaultOptions(options) {
|
|
38
44
|
let defaults = {
|
|
@@ -47,7 +53,7 @@ class ApolloBaseDriver extends graphql_1.AbstractGraphQLDriver {
|
|
|
47
53
|
defaults = {
|
|
48
54
|
...defaults,
|
|
49
55
|
plugins: [
|
|
50
|
-
(0,
|
|
56
|
+
(0, server_plugin_landing_page_graphql_playground_1.ApolloServerPluginLandingPageGraphQLPlayground)(playgroundOptions),
|
|
51
57
|
],
|
|
52
58
|
};
|
|
53
59
|
}
|
|
@@ -56,7 +62,7 @@ class ApolloBaseDriver extends graphql_1.AbstractGraphQLDriver {
|
|
|
56
62
|
options.playground === false) {
|
|
57
63
|
defaults = {
|
|
58
64
|
...defaults,
|
|
59
|
-
plugins: [(0,
|
|
65
|
+
plugins: [(0, disabled_1.ApolloServerPluginLandingPageDisabled)()],
|
|
60
66
|
};
|
|
61
67
|
}
|
|
62
68
|
options = await super.mergeDefaultOptions(options, omit(defaults, 'plugins'));
|
|
@@ -68,40 +74,54 @@ class ApolloBaseDriver extends graphql_1.AbstractGraphQLDriver {
|
|
|
68
74
|
subscriptionWithFilter(instanceRef, filterFn, createSubscribeContext) {
|
|
69
75
|
return (...args) => (0, async_iterator_util_1.createAsyncIterator)(createSubscribeContext()(...args), (payload) => filterFn.call(instanceRef, payload, ...args.slice(1)));
|
|
70
76
|
}
|
|
71
|
-
async registerExpress(
|
|
72
|
-
const {
|
|
73
|
-
const { disableHealthCheck, path, onHealthCheck, cors, bodyParserConfig } = apolloOptions;
|
|
77
|
+
async registerExpress(options, { preStartHook } = {}) {
|
|
78
|
+
const { path, typeDefs, resolvers, schema } = options;
|
|
74
79
|
const httpAdapter = this.httpAdapterHost.httpAdapter;
|
|
75
80
|
const app = httpAdapter.getInstance();
|
|
81
|
+
const drainHttpServerPlugin = (0, drainHttpServer_1.ApolloServerPluginDrainHttpServer)({
|
|
82
|
+
httpServer: httpAdapter.getHttpServer(),
|
|
83
|
+
});
|
|
76
84
|
preStartHook === null || preStartHook === void 0 ? void 0 : preStartHook();
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
bodyParserConfig,
|
|
85
|
+
const server = new server_1.ApolloServer({
|
|
86
|
+
typeDefs,
|
|
87
|
+
resolvers,
|
|
88
|
+
schema,
|
|
89
|
+
...options,
|
|
90
|
+
plugins: options.plugins
|
|
91
|
+
? options.plugins.concat([drainHttpServerPlugin])
|
|
92
|
+
: [drainHttpServerPlugin],
|
|
86
93
|
});
|
|
87
|
-
|
|
94
|
+
await server.start();
|
|
95
|
+
app.use(path, (0, express4_1.expressMiddleware)(server, {
|
|
96
|
+
context: options.context,
|
|
97
|
+
}));
|
|
98
|
+
this.apolloServer = server;
|
|
88
99
|
}
|
|
89
|
-
async registerFastify(
|
|
90
|
-
const {
|
|
100
|
+
async registerFastify(options, { preStartHook } = {}) {
|
|
101
|
+
const { fastifyApolloDrainPlugin, fastifyApolloHandler } = (0, load_package_util_1.loadPackage)('@as-integrations/fastify', 'GraphQLModule', () => require('@as-integrations/fastify'));
|
|
91
102
|
const httpAdapter = this.httpAdapterHost.httpAdapter;
|
|
92
103
|
const app = httpAdapter.getInstance();
|
|
104
|
+
const { path, typeDefs, resolvers, schema } = options;
|
|
105
|
+
const apolloDrainPlugin = fastifyApolloDrainPlugin(app);
|
|
93
106
|
preStartHook === null || preStartHook === void 0 ? void 0 : preStartHook();
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
107
|
+
const server = new server_1.ApolloServer({
|
|
108
|
+
typeDefs,
|
|
109
|
+
resolvers,
|
|
110
|
+
schema,
|
|
111
|
+
...options,
|
|
112
|
+
plugins: options.plugins
|
|
113
|
+
? options.plugins.concat([apolloDrainPlugin])
|
|
114
|
+
: [apolloDrainPlugin],
|
|
115
|
+
});
|
|
116
|
+
await server.start();
|
|
117
|
+
app.route({
|
|
118
|
+
url: path,
|
|
119
|
+
method: ['GET', 'POST', 'OPTIONS'],
|
|
120
|
+
handler: fastifyApolloHandler(server, {
|
|
121
|
+
context: options.context,
|
|
122
|
+
}),
|
|
123
|
+
});
|
|
124
|
+
this.apolloServer = server;
|
|
105
125
|
}
|
|
106
126
|
wrapFormatErrorFn(options) {
|
|
107
127
|
if (options.autoTransformHttpErrors === false) {
|
|
@@ -131,10 +151,19 @@ class ApolloBaseDriver extends graphql_1.AbstractGraphQLDriver {
|
|
|
131
151
|
let error;
|
|
132
152
|
const httpStatus = exceptionRef === null || exceptionRef === void 0 ? void 0 : exceptionRef.status;
|
|
133
153
|
if (httpStatus in apolloPredefinedExceptions) {
|
|
134
|
-
error = new
|
|
154
|
+
error = new graphql_2.GraphQLError(exceptionRef === null || exceptionRef === void 0 ? void 0 : exceptionRef.message, {
|
|
155
|
+
extensions: {
|
|
156
|
+
code: apolloPredefinedExceptions[httpStatus],
|
|
157
|
+
},
|
|
158
|
+
});
|
|
135
159
|
}
|
|
136
160
|
else {
|
|
137
|
-
error = new
|
|
161
|
+
error = new graphql_2.GraphQLError(exceptionRef.message, {
|
|
162
|
+
extensions: {
|
|
163
|
+
code: errors_1.ApolloServerErrorCode.INTERNAL_SERVER_ERROR,
|
|
164
|
+
status: httpStatus,
|
|
165
|
+
},
|
|
166
|
+
});
|
|
138
167
|
}
|
|
139
168
|
error.stack = exceptionRef === null || exceptionRef === void 0 ? void 0 : exceptionRef.stacktrace;
|
|
140
169
|
error.extensions['response'] = exceptionRef === null || exceptionRef === void 0 ? void 0 : exceptionRef.response;
|
|
@@ -143,18 +172,26 @@ class ApolloBaseDriver extends graphql_1.AbstractGraphQLDriver {
|
|
|
143
172
|
}
|
|
144
173
|
wrapContextResolver(targetOptions, originalOptions = { ...targetOptions }) {
|
|
145
174
|
if (!targetOptions.context) {
|
|
146
|
-
targetOptions.context = (
|
|
175
|
+
targetOptions.context = async (contextOrRequest) => {
|
|
176
|
+
var _a;
|
|
177
|
+
return {
|
|
178
|
+
// New ApolloServer fastify integration has Request as first parameter to the Context function
|
|
179
|
+
req: (_a = contextOrRequest.req) !== null && _a !== void 0 ? _a : contextOrRequest,
|
|
180
|
+
};
|
|
181
|
+
};
|
|
147
182
|
}
|
|
148
183
|
else if ((0, shared_utils_1.isFunction)(targetOptions.context)) {
|
|
149
184
|
targetOptions.context = async (...args) => {
|
|
185
|
+
var _a;
|
|
150
186
|
const ctx = await originalOptions.context(...args);
|
|
151
|
-
const
|
|
152
|
-
return this.assignReqProperty(ctx, req !== null &&
|
|
187
|
+
const contextOrRequest = args[0];
|
|
188
|
+
return this.assignReqProperty(ctx, (_a = contextOrRequest.req) !== null && _a !== void 0 ? _a : contextOrRequest);
|
|
153
189
|
};
|
|
154
190
|
}
|
|
155
191
|
else {
|
|
156
|
-
targetOptions.context = (
|
|
157
|
-
|
|
192
|
+
targetOptions.context = async (contextOrRequest) => {
|
|
193
|
+
var _a;
|
|
194
|
+
return this.assignReqProperty(originalOptions.context, (_a = contextOrRequest.req) !== null && _a !== void 0 ? _a : contextOrRequest);
|
|
158
195
|
};
|
|
159
196
|
}
|
|
160
197
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ModulesContainer } from '@nestjs/core';
|
|
2
2
|
import { GraphQLFederationFactory } from '@nestjs/graphql';
|
|
3
|
+
import { GraphQLSchema } from 'graphql';
|
|
3
4
|
import { ApolloDriverConfig } from '../interfaces';
|
|
4
5
|
import { ApolloBaseDriver } from './apollo-base.driver';
|
|
5
6
|
export declare class ApolloFederationDriver extends ApolloBaseDriver {
|
|
@@ -7,6 +8,6 @@ export declare class ApolloFederationDriver extends ApolloBaseDriver {
|
|
|
7
8
|
private readonly pluginsExplorerService;
|
|
8
9
|
constructor(graphqlFederationFactory: GraphQLFederationFactory, modulesContainer: ModulesContainer);
|
|
9
10
|
start(options: ApolloDriverConfig): Promise<void>;
|
|
10
|
-
|
|
11
|
+
generateSchema(options: ApolloDriverConfig): Promise<GraphQLSchema>;
|
|
11
12
|
}
|
|
12
13
|
//# sourceMappingURL=apollo-federation.driver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apollo-federation.driver.d.ts","sourceRoot":"","sources":["../../lib/drivers/apollo-federation.driver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAU,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,qBACa,sBAAuB,SAAQ,gBAAgB;IAIxD,OAAO,CAAC,QAAQ,CAAC,wBAAwB;IAH3C,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAyB;gBAG7C,wBAAwB,EAAE,wBAAwB,EACnE,gBAAgB,EAAE,gBAAgB;IAMvB,KAAK,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"apollo-federation.driver.d.ts","sourceRoot":"","sources":["../../lib/drivers/apollo-federation.driver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAU,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,qBACa,sBAAuB,SAAQ,gBAAgB;IAIxD,OAAO,CAAC,QAAQ,CAAC,wBAAwB;IAH3C,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAyB;gBAG7C,wBAAwB,EAAE,wBAAwB,EACnE,gBAAgB,EAAE,gBAAgB;IAMvB,KAAK,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IA4BvD,cAAc,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,aAAa,CAAC;CAG3E"}
|
|
@@ -16,24 +16,18 @@ let ApolloFederationDriver = class ApolloFederationDriver extends apollo_base_dr
|
|
|
16
16
|
}
|
|
17
17
|
async start(options) {
|
|
18
18
|
options.plugins = (0, graphql_1.extend)(options.plugins || [], this.pluginsExplorerService.explore(options));
|
|
19
|
-
const adapterOptions = await this.graphqlFederationFactory.mergeWithSchema(options);
|
|
20
|
-
await this.runExecutorFactoryIfPresent(adapterOptions);
|
|
21
19
|
if (options.definitions && options.definitions.path) {
|
|
22
20
|
const { printSubgraphSchema } = (0, load_package_util_1.loadPackage)('@apollo/subgraph', 'ApolloFederation', () => require('@apollo/subgraph'));
|
|
23
|
-
await this.graphQlFactory.generateDefinitions(printSubgraphSchema(
|
|
21
|
+
await this.graphQlFactory.generateDefinitions(printSubgraphSchema(options.schema), options);
|
|
24
22
|
}
|
|
25
|
-
await super.start(
|
|
23
|
+
await super.start(options);
|
|
26
24
|
if (options.installSubscriptionHandlers || options.subscriptions) {
|
|
27
25
|
// TL;DR <https://github.com/apollographql/apollo-server/issues/2776>
|
|
28
26
|
throw new Error('No support for subscriptions yet when using Apollo Federation');
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const executor = await apolloOptions.executorFactory(apolloOptions.schema);
|
|
36
|
-
apolloOptions.executor = executor;
|
|
29
|
+
generateSchema(options) {
|
|
30
|
+
return this.graphqlFederationFactory.generateSchema(options);
|
|
37
31
|
}
|
|
38
32
|
};
|
|
39
33
|
ApolloFederationDriver = tslib_1.__decorate([
|
|
@@ -6,5 +6,6 @@ export declare class ApolloGatewayDriver extends ApolloBaseDriver<ApolloGatewayD
|
|
|
6
6
|
constructor(modulesContainer: ModulesContainer);
|
|
7
7
|
start(options: ApolloGatewayDriverConfig): Promise<void>;
|
|
8
8
|
mergeDefaultOptions(options: Record<string, any>): Promise<Record<string, any>>;
|
|
9
|
+
generateSchema(_: ApolloGatewayDriverConfig): any;
|
|
9
10
|
}
|
|
10
11
|
//# sourceMappingURL=apollo-gateway.driver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apollo-gateway.driver.d.ts","sourceRoot":"","sources":["../../lib/drivers/apollo-gateway.driver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,qBACa,mBAAoB,SAAQ,gBAAgB,CAAC,yBAAyB,CAAC;IAClF,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAyB;gBAEpD,gBAAgB,EAAE,gBAAgB;IAKjC,KAAK,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBxD,mBAAmB,CAC9B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC3B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"apollo-gateway.driver.d.ts","sourceRoot":"","sources":["../../lib/drivers/apollo-gateway.driver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,qBACa,mBAAoB,SAAQ,gBAAgB,CAAC,yBAAyB,CAAC;IAClF,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAyB;gBAEpD,gBAAgB,EAAE,gBAAgB;IAKjC,KAAK,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBxD,mBAAmB,CAC9B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC3B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAOxB,cAAc,CAAC,CAAC,EAAE,yBAAyB;CAGnD"}
|
|
@@ -30,6 +30,9 @@ let ApolloGatewayDriver = class ApolloGatewayDriver extends apollo_base_driver_1
|
|
|
30
30
|
server: await super.mergeDefaultOptions((_a = options === null || options === void 0 ? void 0 : options.server) !== null && _a !== void 0 ? _a : {}),
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
+
generateSchema(_) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
33
36
|
};
|
|
34
37
|
ApolloGatewayDriver = tslib_1.__decorate([
|
|
35
38
|
(0, common_1.Injectable)(),
|
|
@@ -5,7 +5,7 @@ export declare class ApolloDriver extends ApolloBaseDriver {
|
|
|
5
5
|
private _subscriptionService?;
|
|
6
6
|
private readonly pluginsExplorerService;
|
|
7
7
|
constructor(modulesContainer: ModulesContainer);
|
|
8
|
-
start(
|
|
8
|
+
start(options: ApolloDriverConfig): Promise<void>;
|
|
9
9
|
registerServer(apolloOptions: ApolloDriverConfig): Promise<void>;
|
|
10
10
|
stop(): Promise<void>;
|
|
11
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apollo.driver.d.ts","sourceRoot":"","sources":["../../lib/drivers/apollo.driver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAOhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,qBACa,YAAa,SAAQ,gBAAgB;IAChD,OAAO,CAAC,oBAAoB,CAAC,CAAyB;IACtD,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAyB;gBAEpD,gBAAgB,EAAE,gBAAgB;IAKjC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"apollo.driver.d.ts","sourceRoot":"","sources":["../../lib/drivers/apollo.driver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAOhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,qBACa,YAAa,SAAQ,gBAAgB;IAChD,OAAO,CAAC,oBAAoB,CAAC,CAAyB;IACtD,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAyB;gBAEpD,gBAAgB,EAAE,gBAAgB;IAKjC,KAAK,CAAC,OAAO,EAAE,kBAAkB;IA8BjC,cAAc,CAAC,aAAa,EAAE,kBAAkB;IAahD,IAAI;CAIlB"}
|
|
@@ -13,10 +13,9 @@ let ApolloDriver = class ApolloDriver extends apollo_base_driver_1.ApolloBaseDri
|
|
|
13
13
|
super();
|
|
14
14
|
this.pluginsExplorerService = new plugins_explorer_service_1.PluginsExplorerService(modulesContainer);
|
|
15
15
|
}
|
|
16
|
-
async start(
|
|
16
|
+
async start(options) {
|
|
17
17
|
var _a;
|
|
18
|
-
|
|
19
|
-
const options = await this.graphQlFactory.mergeWithSchema(apolloOptions);
|
|
18
|
+
options.plugins = (0, graphql_1.extend)(options.plugins || [], this.pluginsExplorerService.explore(options));
|
|
20
19
|
if (options.definitions && options.definitions.path) {
|
|
21
20
|
await this.graphQlFactory.generateDefinitions((0, graphql_2.printSchema)(options.schema), options);
|
|
22
21
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GraphQLError, GraphQLErrorOptions } from 'graphql';
|
|
2
|
+
/**
|
|
3
|
+
* This error is thrown when the user is not authenticated.
|
|
4
|
+
*
|
|
5
|
+
* "AuthenticationError" class was removed in the latest version of Apollo Server (4.0.0)
|
|
6
|
+
* It was moved to the @nestjs/apollo package to avoid regressions & make migration easier.
|
|
7
|
+
*/
|
|
8
|
+
export declare class AuthenticationError extends GraphQLError {
|
|
9
|
+
constructor(message: string, options?: GraphQLErrorOptions);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=authentication.error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication.error.d.ts","sourceRoot":"","sources":["../../lib/errors/authentication.error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE5D;;;;;GAKG;AACH,qBAAa,mBAAoB,SAAQ,YAAY;gBACvC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB;CAS3D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthenticationError = void 0;
|
|
4
|
+
const graphql_1 = require("graphql");
|
|
5
|
+
/**
|
|
6
|
+
* This error is thrown when the user is not authenticated.
|
|
7
|
+
*
|
|
8
|
+
* "AuthenticationError" class was removed in the latest version of Apollo Server (4.0.0)
|
|
9
|
+
* It was moved to the @nestjs/apollo package to avoid regressions & make migration easier.
|
|
10
|
+
*/
|
|
11
|
+
class AuthenticationError extends graphql_1.GraphQLError {
|
|
12
|
+
constructor(message, options) {
|
|
13
|
+
super(message, {
|
|
14
|
+
...options,
|
|
15
|
+
extensions: {
|
|
16
|
+
code: 'UNAUTHENTICATED',
|
|
17
|
+
...options === null || options === void 0 ? void 0 : options.extensions,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.AuthenticationError = AuthenticationError;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GraphQLError, GraphQLErrorOptions } from 'graphql';
|
|
2
|
+
/**
|
|
3
|
+
* This error is thrown when the user is not authorized to access a resource.
|
|
4
|
+
*
|
|
5
|
+
* "ForbiddenError" class was removed in the latest version of Apollo Server (4.0.0)
|
|
6
|
+
* It was moved to the @nestjs/apollo package to avoid regressions & make migration easier.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ForbiddenError extends GraphQLError {
|
|
9
|
+
constructor(message: string, options?: GraphQLErrorOptions);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=forbidden.error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forbidden.error.d.ts","sourceRoot":"","sources":["../../lib/errors/forbidden.error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE5D;;;;;GAKG;AACH,qBAAa,cAAe,SAAQ,YAAY;gBAClC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB;CAS3D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ForbiddenError = void 0;
|
|
4
|
+
const graphql_1 = require("graphql");
|
|
5
|
+
/**
|
|
6
|
+
* This error is thrown when the user is not authorized to access a resource.
|
|
7
|
+
*
|
|
8
|
+
* "ForbiddenError" class was removed in the latest version of Apollo Server (4.0.0)
|
|
9
|
+
* It was moved to the @nestjs/apollo package to avoid regressions & make migration easier.
|
|
10
|
+
*/
|
|
11
|
+
class ForbiddenError extends graphql_1.GraphQLError {
|
|
12
|
+
constructor(message, options) {
|
|
13
|
+
super(message, {
|
|
14
|
+
...options,
|
|
15
|
+
extensions: {
|
|
16
|
+
code: 'FORBIDDEN',
|
|
17
|
+
...options === null || options === void 0 ? void 0 : options.extensions,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.ForbiddenError = ForbiddenError;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./authentication.error"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./forbidden.error"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./user-input.error"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./validation.error"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GraphQLError, GraphQLErrorOptions } from 'graphql';
|
|
2
|
+
/**
|
|
3
|
+
* This error is thrown when the user input is invalid.
|
|
4
|
+
*
|
|
5
|
+
* "UserInputError" class was removed in the latest version of Apollo Server (4.0.0)
|
|
6
|
+
* It was moved to the @nestjs/apollo package to avoid regressions & make migration easier.
|
|
7
|
+
*/
|
|
8
|
+
export declare class UserInputError extends GraphQLError {
|
|
9
|
+
constructor(message: string, options?: GraphQLErrorOptions);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=user-input.error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-input.error.d.ts","sourceRoot":"","sources":["../../lib/errors/user-input.error.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE5D;;;;;GAKG;AACH,qBAAa,cAAe,SAAQ,YAAY;gBAClC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB;CAS3D"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserInputError = void 0;
|
|
4
|
+
const errors_1 = require("@apollo/server/errors");
|
|
5
|
+
const graphql_1 = require("graphql");
|
|
6
|
+
/**
|
|
7
|
+
* This error is thrown when the user input is invalid.
|
|
8
|
+
*
|
|
9
|
+
* "UserInputError" class was removed in the latest version of Apollo Server (4.0.0)
|
|
10
|
+
* It was moved to the @nestjs/apollo package to avoid regressions & make migration easier.
|
|
11
|
+
*/
|
|
12
|
+
class UserInputError extends graphql_1.GraphQLError {
|
|
13
|
+
constructor(message, options) {
|
|
14
|
+
super(message, {
|
|
15
|
+
...options,
|
|
16
|
+
extensions: {
|
|
17
|
+
code: errors_1.ApolloServerErrorCode.BAD_USER_INPUT,
|
|
18
|
+
...options === null || options === void 0 ? void 0 : options.extensions,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.UserInputError = UserInputError;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GraphQLError, GraphQLErrorOptions } from 'graphql';
|
|
2
|
+
/**
|
|
3
|
+
* This error is thrown when the user input does not pass validation.
|
|
4
|
+
*
|
|
5
|
+
* "ValidationError" class was removed in the latest version of Apollo Server (4.0.0)
|
|
6
|
+
* It was moved to the @nestjs/apollo package to avoid regressions & make migration easier.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ValidationError extends GraphQLError {
|
|
9
|
+
constructor(message: string, options?: GraphQLErrorOptions);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=validation.error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.error.d.ts","sourceRoot":"","sources":["../../lib/errors/validation.error.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE5D;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,YAAY;gBACnC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB;CAS3D"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidationError = void 0;
|
|
4
|
+
const errors_1 = require("@apollo/server/errors");
|
|
5
|
+
const graphql_1 = require("graphql");
|
|
6
|
+
/**
|
|
7
|
+
* This error is thrown when the user input does not pass validation.
|
|
8
|
+
*
|
|
9
|
+
* "ValidationError" class was removed in the latest version of Apollo Server (4.0.0)
|
|
10
|
+
* It was moved to the @nestjs/apollo package to avoid regressions & make migration easier.
|
|
11
|
+
*/
|
|
12
|
+
class ValidationError extends graphql_1.GraphQLError {
|
|
13
|
+
constructor(message, options) {
|
|
14
|
+
super(message, {
|
|
15
|
+
...options,
|
|
16
|
+
extensions: {
|
|
17
|
+
code: errors_1.ApolloServerErrorCode.GRAPHQL_VALIDATION_FAILED,
|
|
18
|
+
...options === null || options === void 0 ? void 0 : options.extensions,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.ValidationError = ValidationError;
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,5 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./decorators"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./drivers"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./errors"), exports);
|
|
6
7
|
tslib_1.__exportStar(require("./interfaces"), exports);
|
|
7
8
|
tslib_1.__exportStar(require("./utils"), exports);
|
|
@@ -1,33 +1,13 @@
|
|
|
1
|
+
import { ApolloServerOptionsWithTypeDefs } from '@apollo/server';
|
|
2
|
+
import { ApolloServerPluginLandingPageGraphQLPlaygroundOptions } from '@apollo/server-plugin-landing-page-graphql-playground';
|
|
1
3
|
import { GqlModuleAsyncOptions, GqlModuleOptions, GqlOptionsFactory, SubscriptionConfig } from '@nestjs/graphql';
|
|
2
|
-
import { ApolloServerPluginLandingPageGraphQLPlaygroundOptions, Config, GraphQLExecutor } from 'apollo-server-core';
|
|
3
|
-
import { GraphQLSchema } from 'graphql';
|
|
4
4
|
export interface ServerRegistration {
|
|
5
5
|
/**
|
|
6
6
|
* Path to mount GraphQL API
|
|
7
7
|
*/
|
|
8
8
|
path?: string;
|
|
9
|
-
/**
|
|
10
|
-
* CORS configuration
|
|
11
|
-
*/
|
|
12
|
-
cors?: any | boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Body-parser configuration
|
|
15
|
-
*/
|
|
16
|
-
bodyParserConfig?: any | boolean;
|
|
17
|
-
/**
|
|
18
|
-
* On health check hook
|
|
19
|
-
*/
|
|
20
|
-
onHealthCheck?: (req: any) => Promise<any>;
|
|
21
|
-
/**
|
|
22
|
-
* Whether to enable health check
|
|
23
|
-
*/
|
|
24
|
-
disableHealthCheck?: boolean;
|
|
25
9
|
}
|
|
26
|
-
export interface ApolloDriverConfig extends Omit<
|
|
27
|
-
/**
|
|
28
|
-
* Executor factory function
|
|
29
|
-
*/
|
|
30
|
-
executorFactory?: (schema: GraphQLSchema) => GraphQLExecutor | Promise<GraphQLExecutor>;
|
|
10
|
+
export interface ApolloDriverConfig extends Omit<ApolloServerOptionsWithTypeDefs<any>, 'typeDefs' | 'schema' | 'resolvers' | 'gateway'>, ServerRegistration, GqlModuleOptions {
|
|
31
11
|
/**
|
|
32
12
|
* If enabled, "subscriptions-transport-ws" will be automatically registered.
|
|
33
13
|
*/
|
|
@@ -47,6 +27,6 @@ export interface ApolloDriverConfig extends Omit<Config, 'typeDefs'>, ServerRegi
|
|
|
47
27
|
*/
|
|
48
28
|
autoTransformHttpErrors?: boolean;
|
|
49
29
|
}
|
|
50
|
-
export
|
|
51
|
-
export
|
|
30
|
+
export type ApolloDriverConfigFactory = GqlOptionsFactory<ApolloDriverConfig>;
|
|
31
|
+
export type ApolloDriverAsyncConfig = GqlModuleAsyncOptions<ApolloDriverConfig>;
|
|
52
32
|
//# sourceMappingURL=apollo-driver-config.interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apollo-driver-config.interface.d.ts","sourceRoot":"","sources":["../../lib/interfaces/apollo-driver-config.interface.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"apollo-driver-config.interface.d.ts","sourceRoot":"","sources":["../../lib/interfaces/apollo-driver-config.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,qDAAqD,EAAE,MAAM,uDAAuD,CAAC;AAC9H,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBACf,SAAQ,IAAI,CACR,+BAA+B,CAAC,GAAG,CAAC,EACpC,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAChD,EACD,kBAAkB,EAClB,gBAAgB;IAClB;;OAEG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;IAEtC;;OAEG;IACH,aAAa,CAAC,EAAE,kBAAkB,CAAC;IAEnC;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,qDAAqD,CAAC;IAE7E;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;AAC9E,MAAM,MAAM,uBAAuB,GAAG,qBAAqB,CAAC,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApolloDriverAsyncConfig, ApolloDriverConfig, ApolloDriverConfigFactory } from './apollo-driver-config.interface';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
2
|
+
export type ApolloFederationDriverConfig = ApolloDriverConfig;
|
|
3
|
+
export type ApolloFederationDriverConfigFactory = ApolloDriverConfigFactory;
|
|
4
|
+
export type ApolloFederationDriverAsyncConfig = ApolloDriverAsyncConfig;
|
|
5
5
|
//# sourceMappingURL=apollo-federation-driver-config.interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apollo-federation-driver-config.interface.d.ts","sourceRoot":"","sources":["../../lib/interfaces/apollo-federation-driver-config.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,yBAAyB,EAC1B,MAAM,kCAAkC,CAAC;AAE1C,
|
|
1
|
+
{"version":3,"file":"apollo-federation-driver-config.interface.d.ts","sourceRoot":"","sources":["../../lib/interfaces/apollo-federation-driver-config.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,yBAAyB,EAC1B,MAAM,kCAAkC,CAAC;AAE1C,MAAM,MAAM,4BAA4B,GAAG,kBAAkB,CAAC;AAC9D,MAAM,MAAM,mCAAmC,GAAG,yBAAyB,CAAC;AAC5E,MAAM,MAAM,iCAAiC,GAAG,uBAAuB,CAAC"}
|
|
@@ -16,6 +16,6 @@ export interface ApolloGatewayDriverConfig<TDriver extends GraphQLDriver = any>
|
|
|
16
16
|
*/
|
|
17
17
|
server?: Omit<ApolloDriverConfig, 'typeDefs' | 'typePaths' | 'include' | 'resolvers' | 'resolverValidationOptions' | 'directiveResolvers' | 'autoSchemaFile' | 'transformSchema' | 'definitions' | 'schema' | 'subscriptions' | 'buildSchemaOptions' | 'fieldResolverEnhancers' | 'driver'>;
|
|
18
18
|
}
|
|
19
|
-
export
|
|
20
|
-
export
|
|
19
|
+
export type ApolloGatewayDriverConfigFactory = GqlOptionsFactory<ApolloGatewayDriverConfig>;
|
|
20
|
+
export type ApolloGatewayDriverAsyncConfig = GqlModuleAsyncOptions<ApolloGatewayDriverConfig>;
|
|
21
21
|
//# sourceMappingURL=apollo-gateway-driver-config.interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apollo-gateway-driver-config.interface.d.ts","sourceRoot":"","sources":["../../lib/interfaces/apollo-gateway-driver-config.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,aAAa,EACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE,MAAM,WAAW,yBAAyB,CACxC,OAAO,SAAS,aAAa,GAAG,GAAG;IAEnC;;OAEG;IACH,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACvB;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;OAEG;IACH,MAAM,CAAC,EAAE,IAAI,CACX,kBAAkB,EAChB,UAAU,GACV,WAAW,GACX,SAAS,GACT,WAAW,GACX,2BAA2B,GAC3B,oBAAoB,GACpB,gBAAgB,GAChB,iBAAiB,GACjB,aAAa,GACb,QAAQ,GACR,eAAe,GACf,oBAAoB,GACpB,wBAAwB,GACxB,QAAQ,CACX,CAAC;CACH;AAED,
|
|
1
|
+
{"version":3,"file":"apollo-gateway-driver-config.interface.d.ts","sourceRoot":"","sources":["../../lib/interfaces/apollo-gateway-driver-config.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,aAAa,EACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE,MAAM,WAAW,yBAAyB,CACxC,OAAO,SAAS,aAAa,GAAG,GAAG;IAEnC;;OAEG;IACH,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACvB;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;OAEG;IACH,MAAM,CAAC,EAAE,IAAI,CACX,kBAAkB,EAChB,UAAU,GACV,WAAW,GACX,SAAS,GACT,WAAW,GACX,2BAA2B,GAC3B,oBAAoB,GACpB,gBAAgB,GAChB,iBAAiB,GACjB,aAAa,GACb,QAAQ,GACR,eAAe,GACf,oBAAoB,GACpB,wBAAwB,GACxB,QAAQ,CACX,CAAC;CACH;AAED,MAAM,MAAM,gCAAgC,GAC1C,iBAAiB,CAAC,yBAAyB,CAAC,CAAC;AAC/C,MAAM,MAAM,8BAA8B,GACxC,qBAAqB,CAAC,yBAAyB,CAAC,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PluginsExplorerService = void 0;
|
|
4
4
|
const graphql_1 = require("@nestjs/graphql");
|
|
5
|
-
const
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
6
|
class PluginsExplorerService extends graphql_1.BaseExplorerService {
|
|
7
7
|
constructor(modulesContainer) {
|
|
8
8
|
super();
|
|
@@ -17,7 +17,7 @@ class PluginsExplorerService extends graphql_1.BaseExplorerService {
|
|
|
17
17
|
if (!instance) {
|
|
18
18
|
return undefined;
|
|
19
19
|
}
|
|
20
|
-
const metadata = Reflect.getMetadata(
|
|
20
|
+
const metadata = Reflect.getMetadata(constants_1.PLUGIN_METADATA, instance.constructor);
|
|
21
21
|
return metadata ? instance : undefined;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async-iterator.util.d.ts","sourceRoot":"","sources":["../../lib/utils/async-iterator.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,
|
|
1
|
+
{"version":3,"file":"async-iterator.util.d.ts","sourceRoot":"","sources":["../../lib/utils/async-iterator.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI;IAC7B,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9C,MAAM,IAAI,GAAG,CAAC;IACd,KAAK,CAAC,KAAK,EAAE,GAAG,GAAG,GAAG,CAAC;IACvB,CAAC,eAAe,CAAC,EAAE,GAAG,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,mBAAmB,8DAEpB,QAAQ,8BA2DnB,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { INestApplicationContext } from '@nestjs/common';
|
|
2
|
-
import {
|
|
2
|
+
import { ApolloServer, type BaseContext } from '@apollo/server';
|
|
3
|
+
type GetApolloServer = (app: INestApplicationContext) => ApolloServer<BaseContext>;
|
|
3
4
|
/**
|
|
4
5
|
* Returns the underlying ApolloServer instance for a given application.
|
|
5
6
|
* @param app Nest application reference
|
|
6
7
|
* @returns Apollo Server instance used by the host application
|
|
7
8
|
*/
|
|
8
|
-
export declare
|
|
9
|
+
export declare const getApolloServer: GetApolloServer;
|
|
10
|
+
export {};
|
|
9
11
|
//# sourceMappingURL=get-apollo-server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-apollo-server.d.ts","sourceRoot":"","sources":["../../lib/utils/get-apollo-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"get-apollo-server.d.ts","sourceRoot":"","sources":["../../lib/utils/get-apollo-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAIzD,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEhE,KAAK,eAAe,GAAG,CACrB,GAAG,EAAE,uBAAuB,KACzB,YAAY,CAAC,WAAW,CAAC,CAAC;AAE/B;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,eAS7B,CAAC"}
|
|
@@ -7,7 +7,7 @@ const graphql_1 = require("@nestjs/graphql");
|
|
|
7
7
|
* @param app Nest application reference
|
|
8
8
|
* @returns Apollo Server instance used by the host application
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
const getApolloServer = (app) => {
|
|
11
11
|
var _a;
|
|
12
12
|
try {
|
|
13
13
|
const graphqlModule = app.get(graphql_1.GraphQLModule);
|
|
@@ -15,5 +15,5 @@ function getApolloServer(app) {
|
|
|
15
15
|
}
|
|
16
16
|
catch (error) { }
|
|
17
17
|
throw new Error(`Nest could not find the "GraphQLModule" in your application's container. Please, double-check if it's registered in the given application.`);
|
|
18
|
-
}
|
|
18
|
+
};
|
|
19
19
|
exports.getApolloServer = getApolloServer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/apollo",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0-next.2",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@apollo)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,63 +15,50 @@
|
|
|
15
15
|
"url": "git+https://github.com/nestjs/graphql.git"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
|
-
"test:e2e": "jest --config ./tests/jest-e2e.ts --runInBand
|
|
19
|
-
"test:e2e:fed2": "jest --config ./tests/jest-e2e-fed2.ts --runInBand",
|
|
18
|
+
"test:e2e": "jest --config ./tests/jest-e2e.ts --runInBand",
|
|
20
19
|
"test:e2e:dev": "jest --config ./tests/jest-e2e.ts --runInBand --watch"
|
|
21
20
|
},
|
|
22
21
|
"bugs": {
|
|
23
22
|
"url": "https://github.com/nestjs/graphql/issues"
|
|
24
23
|
},
|
|
25
24
|
"devDependencies": {
|
|
26
|
-
"@apollo/gateway": "
|
|
27
|
-
"@apollo/
|
|
28
|
-
"@apollo/
|
|
29
|
-
"@
|
|
30
|
-
"@
|
|
31
|
-
"@nestjs/
|
|
32
|
-
"@nestjs/
|
|
33
|
-
"@nestjs/
|
|
25
|
+
"@apollo/gateway": "2.2.3",
|
|
26
|
+
"@apollo/server": "4.3.2",
|
|
27
|
+
"@apollo/server-plugin-response-cache": "4.1.0",
|
|
28
|
+
"@apollo/subgraph": "2.2.3",
|
|
29
|
+
"@as-integrations/fastify": "1.3.0",
|
|
30
|
+
"@nestjs/common": "9.3.8",
|
|
31
|
+
"@nestjs/core": "9.3.8",
|
|
32
|
+
"@nestjs/platform-express": "9.3.8",
|
|
33
|
+
"@nestjs/platform-fastify": "9.3.8",
|
|
34
|
+
"@nestjs/testing": "9.3.8",
|
|
34
35
|
"apollo-cache-inmemory": "1.6.6",
|
|
35
36
|
"apollo-client": "2.6.10",
|
|
36
|
-
"apollo-link-ws": "1.0.20"
|
|
37
|
-
"apollo-server-core": "3.11.1",
|
|
38
|
-
"apollo-server-express": "3.11.1",
|
|
39
|
-
"apollo-server-fastify": "3.11.1",
|
|
40
|
-
"apollo-server-plugin-response-cache": "3.8.1",
|
|
41
|
-
"graphql-16": "npm:graphql@16.6.0"
|
|
37
|
+
"apollo-link-ws": "1.0.20"
|
|
42
38
|
},
|
|
43
39
|
"dependencies": {
|
|
40
|
+
"@apollo/server-plugin-landing-page-graphql-playground": "4.0.0",
|
|
44
41
|
"iterall": "1.3.0",
|
|
45
42
|
"lodash.omit": "4.5.0",
|
|
46
43
|
"tslib": "2.5.0"
|
|
47
44
|
},
|
|
48
45
|
"peerDependencies": {
|
|
49
|
-
"@apollo/gateway": "^
|
|
46
|
+
"@apollo/gateway": "^2.0.0",
|
|
47
|
+
"@apollo/server": "^4.3.2",
|
|
50
48
|
"@apollo/subgraph": "^2.0.0",
|
|
51
|
-
"@
|
|
52
|
-
"@nestjs/
|
|
53
|
-
"@nestjs/
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"apollo-server-fastify": "^3.5.0",
|
|
57
|
-
"graphql": "^15.8.0 || ^16.0.0"
|
|
49
|
+
"@as-integrations/fastify": "^1.3.0",
|
|
50
|
+
"@nestjs/common": "^9.0.0",
|
|
51
|
+
"@nestjs/core": "^9.3.8",
|
|
52
|
+
"@nestjs/graphql": "^10.1.7",
|
|
53
|
+
"graphql": "^16.6.0"
|
|
58
54
|
},
|
|
59
55
|
"peerDependenciesMeta": {
|
|
60
56
|
"@apollo/gateway": {
|
|
61
57
|
"optional": true
|
|
62
58
|
},
|
|
63
|
-
"@
|
|
64
|
-
"optional": true
|
|
65
|
-
},
|
|
66
|
-
"apollo-server-core": {
|
|
67
|
-
"optional": true
|
|
68
|
-
},
|
|
69
|
-
"apollo-server-express": {
|
|
70
|
-
"optional": true
|
|
71
|
-
},
|
|
72
|
-
"apollo-server-fastify": {
|
|
59
|
+
"@as-integrations/fastify": {
|
|
73
60
|
"optional": true
|
|
74
61
|
}
|
|
75
62
|
},
|
|
76
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "64494dbe4d6cac871dcbfb32f9df9568dafe0821"
|
|
77
64
|
}
|