@nmxjs/app 1.0.6 → 1.0.8

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 +1,2 @@
1
- export declare const getGraphQlModule: () => import("@nestjs/common").DynamicModule;
1
+ import { IGetGraphQlModuleOptions } from './interfaces';
2
+ export declare const getGraphQlModule: ({ onSubscriptionConnect, onSubscriptionDisconnect }?: IGetGraphQlModuleOptions) => import("@nestjs/common").DynamicModule;
@@ -5,18 +5,12 @@ 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 = () => graphql_1.GraphQLModule.forRootAsync({
8
+ const getGraphQlModule = ({ onSubscriptionConnect, onSubscriptionDisconnect } = {}) => graphql_1.GraphQLModule.forRootAsync({
9
9
  driver: apollo_1.ApolloDriver,
10
- useFactory: () => ({
11
- debug: false,
12
- autoSchemaFile: true,
13
- installSubscriptionHandlers: true,
14
- playground: (0, utils_1.getEnvironment)() !== types_1.EnvironmentEnum.PRODUCTION,
15
- cors: {
10
+ useFactory: () => (Object.assign(Object.assign({ debug: false, autoSchemaFile: true, installSubscriptionHandlers: true, playground: (0, utils_1.getEnvironment)() !== types_1.EnvironmentEnum.PRODUCTION, cors: {
16
11
  credentials: true,
17
12
  origin: [process.env.ORIGIN || '*'],
18
- },
19
- formatError: (error) => {
13
+ }, formatError: (error) => {
20
14
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
21
15
  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)
22
16
  ? { code: error.extensions.exception.error.code }
@@ -26,12 +20,16 @@ const getGraphQlModule = () => graphql_1.GraphQLModule.forRootAsync({
26
20
  ((_g = error.extensions.exception) === null || _g === void 0 ? void 0 : _g.message) ||
27
21
  ((_j = (_h = error.extensions.exception) === null || _h === void 0 ? void 0 : _h.thrownValue) === null || _j === void 0 ? void 0 : _j.message) ||
28
22
  error.toString() }));
29
- },
30
- context: ctx => ({
23
+ } }, (onSubscriptionConnect || onSubscriptionDisconnect
24
+ ? {
25
+ subscriptions: {
26
+ 'subscriptions-transport-ws': Object.assign(Object.assign({}, (onSubscriptionConnect ? { onConnect: onSubscriptionConnect } : {})), (onSubscriptionDisconnect ? { onDisconnect: onSubscriptionDisconnect } : {})),
27
+ },
28
+ }
29
+ : {})), { context: ctx => ({
31
30
  req: ctx.req,
32
31
  res: ctx.res,
33
- }),
34
- }),
32
+ }) })),
35
33
  });
36
34
  exports.getGraphQlModule = getGraphQlModule;
37
35
  //# 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;AAEzC,MAAM,gBAAgB,GAAG,GAAG,EAAE,CACnC,uBAAa,CAAC,YAAY,CAAqB;IAC7C,MAAM,EAAE,qBAAY;IACpB,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;QACjB,KAAK,EAAE,KAAK;QACZ,cAAc,EAAE,IAAI;QACpB,2BAA2B,EAAE,IAAI;QACjC,UAAU,EAAE,IAAA,sBAAc,GAAE,KAAK,uBAAe,CAAC,UAAU;QAC3D,IAAI,EAAE;YACJ,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC;SACpC;QACD,WAAW,EAAE,CAAC,KAAU,EAAE,EAAE;;YAAC,OAAA,+CACxB,CAAC,CAAA,MAAA,MAAA,KAAK,CAAC,UAAU,CAAC,SAAS,0CAAE,KAAK,0CAAE,IAAI;gBACzC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,UAAU,CAA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AqB,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;aACF;SACF;QACH,CAAC,CAAC,EAAE,CAAC,KACP,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;YACf,GAAG,EAAE,GAAG,CAAC,GAAG;YACZ,GAAG,EAAE,GAAG,CAAC,GAAG;SACb,CAAC,IACF;CACH,CAAC,CAAC;AAxCQ,QAAA,gBAAgB,oBAwCxB"}
@@ -0,0 +1,5 @@
1
+ import { ICallback } from '@nmxjs/types';
2
+ export interface IGetGraphQlModuleOptions {
3
+ onSubscriptionConnect?: ICallback<Record<string, string>>;
4
+ onSubscriptionDisconnect?: ICallback<Record<string, string>>;
5
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=IGetGraphQlModuleOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IGetGraphQlModuleOptions.js","sourceRoot":"","sources":["../../src/interfaces/IGetGraphQlModuleOptions.ts"],"names":[],"mappings":""}
@@ -1 +1,2 @@
1
1
  export * from './ICreateNestAppOptions';
2
+ export * from './IGetGraphQlModuleOptions';
@@ -15,4 +15,5 @@ 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);
18
19
  //# 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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nmxjs/app",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -28,9 +28,10 @@
28
28
  "dependencies": {
29
29
  "@apollo/server": "^4.9.5",
30
30
  "@nestjs/apollo": "^12.0.11",
31
- "@nmxjs/api": "^1.1.7",
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
  }