@nestjs/apollo 13.0.3 → 13.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/dist/drivers/apollo-base.driver.d.ts.map +1 -1
- package/dist/drivers/apollo-base.driver.js +10 -1
- package/dist/graphiql/graphiql-html.factory.d.ts +5 -0
- package/dist/graphiql/graphiql-html.factory.d.ts.map +1 -0
- package/dist/graphiql/graphiql-html.factory.js +67 -0
- package/dist/graphiql/graphiql-playground.plugin.d.ts +13 -0
- package/dist/graphiql/graphiql-playground.plugin.d.ts.map +1 -0
- package/dist/graphiql/graphiql-playground.plugin.js +19 -0
- package/dist/graphiql/interfaces/graphiql-options.interface.d.ts +26 -0
- package/dist/graphiql/interfaces/graphiql-options.interface.d.ts.map +1 -0
- package/dist/graphiql/interfaces/graphiql-options.interface.js +2 -0
- package/dist/interfaces/apollo-driver-config.interface.d.ts +6 -0
- package/dist/interfaces/apollo-driver-config.interface.d.ts.map +1 -1
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
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;AAYhE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;
|
|
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;AAYhE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAKxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAUnD,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;IAsDjD,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,IAExB,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,4EAE1C,GAAG;cAMQ,eAAe,CAC7B,OAAO,EAAE,CAAC,EACV,EAAE,YAAY,EAAE,GAAE;QAAE,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;KAAO;cA6CtC,eAAe,CAC7B,OAAO,EAAE,CAAC,EACV,EAAE,YAAY,EAAE,GAAE;QAAE,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;KAAO;IAuCtD,OAAO,CAAC,iBAAiB;IAuBzB,OAAO,CAAC,0BAA0B;IA0ClC,OAAO,CAAC,mBAAmB;IA8B3B,OAAO,CAAC,iBAAiB;CAgB1B"}
|
|
@@ -13,6 +13,7 @@ const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
|
|
|
13
13
|
const graphql_1 = require("@nestjs/graphql");
|
|
14
14
|
const graphql_2 = require("graphql");
|
|
15
15
|
const omit = require("lodash.omit");
|
|
16
|
+
const graphiql_playground_plugin_1 = require("../graphiql/graphiql-playground.plugin");
|
|
16
17
|
const async_iterator_util_1 = require("../utils/async-iterator.util");
|
|
17
18
|
const apolloPredefinedExceptions = {
|
|
18
19
|
[common_1.HttpStatus.BAD_REQUEST]: errors_1.ApolloServerErrorCode.BAD_REQUEST,
|
|
@@ -46,7 +47,15 @@ class ApolloBaseDriver extends graphql_1.AbstractGraphQLDriver {
|
|
|
46
47
|
fieldResolverEnhancers: [],
|
|
47
48
|
stopOnTerminationSignals: false,
|
|
48
49
|
};
|
|
49
|
-
if (
|
|
50
|
+
if (options.graphiql) {
|
|
51
|
+
const graphiQlPlaygroundOpts = typeof options.graphiql === 'object' ? options.graphiql : {};
|
|
52
|
+
graphiQlPlaygroundOpts.url ??= options.path;
|
|
53
|
+
defaults = {
|
|
54
|
+
...defaults,
|
|
55
|
+
plugins: [new graphiql_playground_plugin_1.GraphiQLPlaygroundPlugin(graphiQlPlaygroundOpts)],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
else if ((options.playground === undefined &&
|
|
50
59
|
process.env.NODE_ENV !== 'production') ||
|
|
51
60
|
options.playground) {
|
|
52
61
|
const playgroundOptions = typeof options.playground === 'object' ? options.playground : undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphiql-html.factory.d.ts","sourceRoot":"","sources":["../../lib/graphiql/graphiql-html.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAE1E,qBAAa,mBAAmB;IAC9B,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM;CA6DzC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GraphiQLHTMLFactory = void 0;
|
|
4
|
+
class GraphiQLHTMLFactory {
|
|
5
|
+
create(options) {
|
|
6
|
+
const shouldPersistHeaders = options.shouldPersistHeaders ?? true;
|
|
7
|
+
const isHeadersEditorEnabled = options.isHeadersEditorEnabled ?? true;
|
|
8
|
+
const headers = options.headers ?? {};
|
|
9
|
+
const url = options.url ?? '/graphql';
|
|
10
|
+
const html = `
|
|
11
|
+
<!--
|
|
12
|
+
* Copyright (c) 2021 GraphQL Contributors
|
|
13
|
+
* All rights reserved.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
-->
|
|
18
|
+
<!DOCTYPE html>
|
|
19
|
+
<html lang="en">
|
|
20
|
+
<head>
|
|
21
|
+
<title>GraphiQL</title>
|
|
22
|
+
<style>
|
|
23
|
+
body {
|
|
24
|
+
height: 100%;
|
|
25
|
+
margin: 0;
|
|
26
|
+
width: 100%;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
#graphiql {
|
|
31
|
+
height: 100vh;
|
|
32
|
+
}
|
|
33
|
+
</style>
|
|
34
|
+
<script crossorigin src="https://unpkg.com/react@18/umd/react.development.js"></script>
|
|
35
|
+
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
|
|
36
|
+
<link rel="stylesheet" href="https://unpkg.com/graphiql@3.8.3/graphiql.min.css" />
|
|
37
|
+
</head>
|
|
38
|
+
|
|
39
|
+
<body>
|
|
40
|
+
<div id="graphiql">Loading...</div>
|
|
41
|
+
<script
|
|
42
|
+
src="https://unpkg.com/graphiql@3.8.3/graphiql.min.js"
|
|
43
|
+
type="application/javascript"
|
|
44
|
+
></script>
|
|
45
|
+
<script>
|
|
46
|
+
const fetcher = GraphiQL.createFetcher({
|
|
47
|
+
url: '${url}',
|
|
48
|
+
subscriptionUrl: '${url}',
|
|
49
|
+
headers: ${JSON.stringify(headers)},
|
|
50
|
+
})
|
|
51
|
+
ReactDOM.render(
|
|
52
|
+
React.createElement(GraphiQL, {
|
|
53
|
+
fetcher,
|
|
54
|
+
defaultEditorToolsVisibility: true,
|
|
55
|
+
shouldPersistHeaders: ${shouldPersistHeaders ? 'true' : 'false'},
|
|
56
|
+
isHeadersEditorEnabled: ${isHeadersEditorEnabled ? 'true' : 'false'},
|
|
57
|
+
}),
|
|
58
|
+
document.getElementById('graphiql'),
|
|
59
|
+
);
|
|
60
|
+
</script>
|
|
61
|
+
</body>
|
|
62
|
+
</html>
|
|
63
|
+
`;
|
|
64
|
+
return html;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.GraphiQLHTMLFactory = GraphiQLHTMLFactory;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ApolloServerPlugin } from '@apollo/server';
|
|
2
|
+
import { GraphiQLOptions } from './interfaces/graphiql-options.interface';
|
|
3
|
+
export declare class GraphiQLPlaygroundPlugin implements ApolloServerPlugin {
|
|
4
|
+
private readonly options;
|
|
5
|
+
private readonly graphiqlHTMLFactory;
|
|
6
|
+
constructor(options: GraphiQLOptions);
|
|
7
|
+
serverWillStart(): Promise<{
|
|
8
|
+
renderLandingPage(): Promise<{
|
|
9
|
+
html: string;
|
|
10
|
+
}>;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=graphiql-playground.plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphiql-playground.plugin.d.ts","sourceRoot":"","sources":["../../lib/graphiql/graphiql-playground.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAE1E,qBAAa,wBAAyB,YAAW,kBAAkB;IAGrD,OAAO,CAAC,QAAQ,CAAC,OAAO;IAFpC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAA6B;gBAEpC,OAAO,EAAE,eAAe;IAE/C,eAAe;;;;;CAQtB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GraphiQLPlaygroundPlugin = void 0;
|
|
4
|
+
const graphiql_html_factory_1 = require("./graphiql-html.factory");
|
|
5
|
+
class GraphiQLPlaygroundPlugin {
|
|
6
|
+
constructor(options) {
|
|
7
|
+
this.options = options;
|
|
8
|
+
this.graphiqlHTMLFactory = new graphiql_html_factory_1.GraphiQLHTMLFactory();
|
|
9
|
+
}
|
|
10
|
+
async serverWillStart() {
|
|
11
|
+
const html = this.graphiqlHTMLFactory.create(this.options);
|
|
12
|
+
return {
|
|
13
|
+
async renderLandingPage() {
|
|
14
|
+
return { html };
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.GraphiQLPlaygroundPlugin = GraphiQLPlaygroundPlugin;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ref https://github.com/graphql/graphiql/blob/main/packages/graphiql/src/GraphiQL.tsx#L97
|
|
3
|
+
* @ref https://github.com/graphql/graphiql/blob/main/packages/graphiql/src/GraphiQL.tsx#L192
|
|
4
|
+
*/
|
|
5
|
+
export interface GraphiQLOptions {
|
|
6
|
+
url?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Headers you can provide statically.
|
|
9
|
+
*
|
|
10
|
+
* If you enable the headers editor and the user provides
|
|
11
|
+
* A header you set statically here, it will be overridden by their value.
|
|
12
|
+
*/
|
|
13
|
+
headers?: Record<string, string>;
|
|
14
|
+
/**
|
|
15
|
+
* This prop toggles if the contents of the headers editor are persisted in
|
|
16
|
+
* storage.
|
|
17
|
+
* @default true
|
|
18
|
+
*/
|
|
19
|
+
shouldPersistHeaders?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Toggle if the headers editor should be shown inside the editor tools.
|
|
22
|
+
* @default true
|
|
23
|
+
*/
|
|
24
|
+
isHeadersEditorEnabled?: boolean;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=graphiql-options.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphiql-options.interface.d.ts","sourceRoot":"","sources":["../../../lib/graphiql/interfaces/graphiql-options.interface.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;OAGG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ApolloServerOptionsWithTypeDefs } from '@apollo/server';
|
|
2
2
|
import { ApolloServerPluginLandingPageGraphQLPlaygroundOptions } from '@apollo/server-plugin-landing-page-graphql-playground';
|
|
3
3
|
import { GqlModuleAsyncOptions, GqlModuleOptions, GqlOptionsFactory, SubscriptionConfig } from '@nestjs/graphql';
|
|
4
|
+
import { GraphiQLOptions } from '../graphiql/interfaces/graphiql-options.interface';
|
|
4
5
|
/**
|
|
5
6
|
* @publicApi
|
|
6
7
|
*/
|
|
@@ -24,8 +25,13 @@ export interface ApolloDriverConfig extends Omit<ApolloServerOptionsWithTypeDefs
|
|
|
24
25
|
subscriptions?: SubscriptionConfig;
|
|
25
26
|
/**
|
|
26
27
|
* GraphQL playground options.
|
|
28
|
+
* The built-in playground is deprecated and will be replaced with GraphiQL in the future.
|
|
27
29
|
*/
|
|
28
30
|
playground?: boolean | ApolloServerPluginLandingPageGraphQLPlaygroundOptions;
|
|
31
|
+
/**
|
|
32
|
+
* GraphiQL options, or a boolean to enable GraphiQL with default options.
|
|
33
|
+
*/
|
|
34
|
+
graphiql?: boolean | GraphiQLOptions;
|
|
29
35
|
/**
|
|
30
36
|
* If enabled, will register a global interceptor that automatically maps
|
|
31
37
|
* "HttpException" class instances to corresponding Apollo errors.
|
|
@@ -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,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;
|
|
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;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,mDAAmD,CAAC;AAEpF;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,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;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,qDAAqD,CAAC;IAE7E;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,eAAe,CAAC;IAErC;;;;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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/apollo",
|
|
3
|
-
"version": "13.0
|
|
3
|
+
"version": "13.1.0",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@apollo)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
"url": "https://github.com/nestjs/graphql/issues"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@apollo/gateway": "2.
|
|
25
|
+
"@apollo/gateway": "2.10.1",
|
|
26
26
|
"@apollo/server": "4.9.3",
|
|
27
27
|
"@apollo/server-plugin-response-cache": "4.1.4",
|
|
28
28
|
"@apollo/subgraph": "2.2.3",
|
|
29
29
|
"@as-integrations/fastify": "2.1.1",
|
|
30
|
-
"@nestjs/common": "11.0.
|
|
31
|
-
"@nestjs/core": "11.0.
|
|
32
|
-
"@nestjs/platform-express": "11.0.
|
|
33
|
-
"@nestjs/platform-fastify": "11.0.
|
|
34
|
-
"@nestjs/testing": "11.0.
|
|
30
|
+
"@nestjs/common": "11.0.15",
|
|
31
|
+
"@nestjs/core": "11.0.15",
|
|
32
|
+
"@nestjs/platform-express": "11.0.15",
|
|
33
|
+
"@nestjs/platform-fastify": "11.0.15",
|
|
34
|
+
"@nestjs/testing": "11.0.15",
|
|
35
35
|
"apollo-cache-inmemory": "1.6.6",
|
|
36
36
|
"apollo-client": "2.6.10",
|
|
37
37
|
"apollo-link-ws": "1.0.20"
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"optional": true
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "416ebb0abebd69a75500f452ddbbe39de9722f72"
|
|
67
67
|
}
|