@nmxjs/app 1.0.7 → 1.0.9
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/getGraphQlModule.d.ts +2 -1
- package/dist/getGraphQlModule.js +31 -28
- package/dist/getGraphQlModule.js.map +1 -1
- package/dist/interfaces/IGetGraphQlModuleOptions.d.ts +6 -0
- package/dist/interfaces/IGetGraphQlModuleOptions.js +3 -0
- package/dist/interfaces/IGetGraphQlModuleOptions.js.map +1 -0
- package/dist/interfaces/IGetGraphQlModuleUseFactoryResult.d.ts +6 -0
- package/dist/interfaces/IGetGraphQlModuleUseFactoryResult.js +3 -0
- package/dist/interfaces/IGetGraphQlModuleUseFactoryResult.js.map +1 -0
- package/dist/interfaces/index.d.ts +2 -0
- package/dist/interfaces/index.js +2 -0
- package/dist/interfaces/index.js.map +1 -1
- package/package.json +2 -1
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { IGetGraphQlModuleOptions } from './interfaces';
|
|
2
|
+
export declare const getGraphQlModule: (options?: IGetGraphQlModuleOptions) => import("@nestjs/common").DynamicModule;
|
package/dist/getGraphQlModule.js
CHANGED
|
@@ -5,33 +5,36 @@ const apollo_1 = require("@nestjs/apollo");
|
|
|
5
5
|
const utils_1 = require("@nmxjs/utils");
|
|
6
6
|
const types_1 = require("@nmxjs/types");
|
|
7
7
|
const graphql_1 = require("@nestjs/graphql");
|
|
8
|
-
const getGraphQlModule = () =>
|
|
9
|
-
|
|
10
|
-
useFactory: () =>
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
8
|
+
const getGraphQlModule = (options) => {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
return graphql_1.GraphQLModule.forRootAsync(Object.assign(Object.assign(Object.assign({}, (((_a = options === null || options === void 0 ? void 0 : options.inject) === null || _a === void 0 ? void 0 : _a.length) ? { inject: options.inject } : {})), (((_b = options === null || options === void 0 ? void 0 : options.imports) === null || _b === void 0 ? void 0 : _b.length) ? { imports: options.imports } : {})), { driver: apollo_1.ApolloDriver, useFactory: async (...params) => {
|
|
11
|
+
const { origin, onSubscriptionConnect, onSubscriptionDisconnect } = (options === null || options === void 0 ? void 0 : options.useFactory)
|
|
12
|
+
? await options.useFactory(...params)
|
|
13
|
+
: {};
|
|
14
|
+
return Object.assign(Object.assign({ debug: false, autoSchemaFile: true, installSubscriptionHandlers: true, playground: (0, utils_1.getEnvironment)() !== types_1.EnvironmentEnum.PRODUCTION, cors: {
|
|
15
|
+
credentials: true,
|
|
16
|
+
origin: [origin || process.env.ORIGIN || '*'],
|
|
17
|
+
}, formatError: (error) => {
|
|
18
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
19
|
+
return (Object.assign(Object.assign(Object.assign({}, (((_b = (_a = error.extensions.exception) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.code)
|
|
20
|
+
? { code: error.extensions.exception.error.code }
|
|
21
|
+
: error.extensions.code
|
|
22
|
+
? { code: error.extensions.code }
|
|
23
|
+
: {})), (((_d = (_c = error.extensions.exception) === null || _c === void 0 ? void 0 : _c.thrownValue) === null || _d === void 0 ? void 0 : _d.code) ? { code: error.extensions.exception.thrownValue.code } : {})), { message: ((_f = (_e = error.extensions.exception) === null || _e === void 0 ? void 0 : _e.error) === null || _f === void 0 ? void 0 : _f.message) ||
|
|
24
|
+
((_g = error.extensions.exception) === null || _g === void 0 ? void 0 : _g.message) ||
|
|
25
|
+
((_j = (_h = error.extensions.exception) === null || _h === void 0 ? void 0 : _h.thrownValue) === null || _j === void 0 ? void 0 : _j.message) ||
|
|
26
|
+
error.toString() }));
|
|
27
|
+
} }, (onSubscriptionConnect || onSubscriptionDisconnect
|
|
28
|
+
? {
|
|
29
|
+
subscriptions: {
|
|
30
|
+
'subscriptions-transport-ws': Object.assign(Object.assign({}, (onSubscriptionConnect ? { onConnect: onSubscriptionConnect } : {})), (onSubscriptionDisconnect ? { onDisconnect: onSubscriptionDisconnect } : {})),
|
|
31
|
+
},
|
|
32
|
+
}
|
|
33
|
+
: {})), { context: ctx => ({
|
|
34
|
+
req: ctx.req,
|
|
35
|
+
res: ctx.res,
|
|
36
|
+
}) });
|
|
37
|
+
} }));
|
|
38
|
+
};
|
|
36
39
|
exports.getGraphQlModule = getGraphQlModule;
|
|
37
40
|
//# sourceMappingURL=getGraphQlModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getGraphQlModule.js","sourceRoot":"","sources":["../src/getGraphQlModule.ts"],"names":[],"mappings":";;;AAAA,2CAAkE;AAClE,wCAA8C;AAC9C,wCAA+C;AAC/C,6CAAgD;
|
|
1
|
+
{"version":3,"file":"getGraphQlModule.js","sourceRoot":"","sources":["../src/getGraphQlModule.ts"],"names":[],"mappings":";;;AAAA,2CAAkE;AAClE,wCAA8C;AAC9C,wCAA+C;AAC/C,6CAAgD;AAGzC,MAAM,gBAAgB,GAAG,CAAC,OAAkC,EAAE,EAAE;;IACrE,OAAA,uBAAa,CAAC,YAAY,+CACrB,CAAC,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,0CAAE,MAAM,EAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAC3D,CAAC,CAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,0CAAE,MAAM,EAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC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MAAA,MAAA,KAAK,CAAC,UAAU,CAAC,SAAS,0CAAE,KAAK,0CAAE,OAAO;6BAC1C,MAAA,KAAK,CAAC,UAAU,CAAC,SAAS,0CAAE,OAAO,CAAA;6BACnC,MAAA,MAAA,KAAK,CAAC,UAAU,CAAC,SAAS,0CAAE,WAAW,0CAAE,OAAO,CAAA;4BAChD,KAAK,CAAC,QAAQ,EAAE,IAClB,CAAA;iBAAA,IACC,CAAC,qBAAqB,IAAI,wBAAwB;gBACnD,CAAC,CAAC;oBACE,aAAa,EAAE;wBACb,4BAA4B,kCACvB,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GACnE,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,wBAAwB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAChF;qBACF;iBACF;gBACH,CAAC,CAAC,EAAE,CAAC,KACP,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;oBACf,GAAG,EAAE,GAAG,CAAC,GAAG;oBACZ,GAAG,EAAE,GAAG,CAAC,GAAG;iBACb,CAAC,IACF;QACJ,CAAC,IACD,CAAA;CAAA,CAAC;AA/CQ,QAAA,gBAAgB,oBA+CxB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ModuleMetadata } from '@nestjs/common';
|
|
2
|
+
import { IGetGraphQlModuleUseFactoryResult } from './IGetGraphQlModuleUseFactoryResult';
|
|
3
|
+
export interface IGetGraphQlModuleOptions extends Pick<ModuleMetadata, 'imports'> {
|
|
4
|
+
inject?: Array<string | symbol>;
|
|
5
|
+
useFactory: (...params: any[]) => IGetGraphQlModuleUseFactoryResult | Promise<IGetGraphQlModuleUseFactoryResult>;
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IGetGraphQlModuleOptions.js","sourceRoot":"","sources":["../../src/interfaces/IGetGraphQlModuleOptions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IGetGraphQlModuleUseFactoryResult.js","sourceRoot":"","sources":["../../src/interfaces/IGetGraphQlModuleUseFactoryResult.ts"],"names":[],"mappings":""}
|
package/dist/interfaces/index.js
CHANGED
|
@@ -15,4 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./ICreateNestAppOptions"), exports);
|
|
18
|
+
__exportStar(require("./IGetGraphQlModuleOptions"), exports);
|
|
19
|
+
__exportStar(require("./IGetGraphQlModuleUseFactoryResult"), exports);
|
|
18
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,6DAA2C;AAC3C,sEAAoD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nmxjs/app",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"@nmxjs/api": "^1.1.8",
|
|
32
32
|
"@nmxjs/config": "^1.0.4",
|
|
33
33
|
"@nmxjs/events": "^1.0.4",
|
|
34
|
+
"@nmxjs/types": "^1.0.0",
|
|
34
35
|
"compression": "^1.7.4",
|
|
35
36
|
"helmet": "^7.1.0"
|
|
36
37
|
}
|