@tc-libs/helper 0.5.0 → 0.7.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tc-libs/helper",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "dependencies": {
5
5
  "tslib": "^2.3.0",
6
6
  "@nestjs/common": "^10.0.2",
@@ -1,9 +1,6 @@
1
1
  "use strict";
2
- var HelperModule_1;
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.HelperModule = void 0;
5
- const tslib_1 = require("tslib");
6
- const common_1 = require("@nestjs/common");
7
4
  const services_1 = require("./services");
8
5
  const jwt_1 = require("@nestjs/jwt");
9
6
  const helper_geo_service_1 = require("./services/helper.geo.service");
@@ -18,10 +15,10 @@ const services = [
18
15
  services_1.PasswordService,
19
16
  helper_geo_service_1.GeoService,
20
17
  ];
21
- let HelperModule = HelperModule_1 = class HelperModule {
18
+ class HelperModule {
22
19
  static register(options, isGlobal) {
23
20
  return {
24
- module: HelperModule_1,
21
+ module: HelperModule,
25
22
  imports: [
26
23
  jwt_1.JwtModule.register({
27
24
  secret: options.jwt.defaultSecretKey,
@@ -40,8 +37,23 @@ let HelperModule = HelperModule_1 = class HelperModule {
40
37
  }
41
38
  static registerAsync(options, isGlobal) {
42
39
  return {
43
- module: HelperModule_1,
44
- imports: options.imports,
40
+ module: HelperModule,
41
+ imports: [
42
+ ...(options.imports || []),
43
+ jwt_1.JwtModule.registerAsync({
44
+ imports: options.imports,
45
+ useFactory: async (...args) => {
46
+ const helperOptions = await options.useFactory(...args);
47
+ return {
48
+ secret: helperOptions.jwt.defaultSecretKey,
49
+ signOptions: {
50
+ expiresIn: helperOptions.jwt.defaultExpirationTime,
51
+ },
52
+ };
53
+ },
54
+ inject: options.inject,
55
+ }),
56
+ ],
45
57
  providers: [
46
58
  {
47
59
  provide: helper_module_options_1.HELPER_CONFIG_OPTIONS,
@@ -54,13 +66,6 @@ let HelperModule = HelperModule_1 = class HelperModule {
54
66
  global: isGlobal,
55
67
  };
56
68
  }
57
- };
69
+ }
58
70
  exports.HelperModule = HelperModule;
59
- exports.HelperModule = HelperModule = HelperModule_1 = tslib_1.__decorate([
60
- (0, common_1.Module)({
61
- providers: [...services],
62
- exports: [...services],
63
- imports: [],
64
- })
65
- ], HelperModule);
66
71
  //# sourceMappingURL=helper.module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helper.module.js","sourceRoot":"","sources":["../../../../packages/helper/src/helper.module.ts"],"names":[],"mappings":";;;;;AAAA,2CAAuD;AACvD,yCAQoB;AACpB,qCAAwC;AACxC,sEAA2D;AAC3D,mEAGiC;AAEjC,MAAM,QAAQ,GAAG;IACf,sBAAW;IACX,4BAAiB;IACjB,sBAAW;IACX,wBAAa;IACb,wBAAa;IACb,uBAAY;IACZ,0BAAe;IACf,+BAAU;CACX,CAAC;AAOK,IAAM,YAAY,oBAAlB,MAAM,YAAY;IACvB,MAAM,CAAC,QAAQ,CAAC,OAAsB,EAAE,QAAkB;QACxD,OAAO;YACL,MAAM,EAAE,cAAY;YACpB,OAAO,EAAE;gBACP,eAAS,CAAC,QAAQ,CAAC;oBACjB,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB;oBACpC,WAAW,EAAE;wBACX,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB;qBAC7C;iBACF,CAAC;aACH;YACD,SAAS,EAAE;gBACT,EAAE,OAAO,EAAE,6CAAqB,EAAE,QAAQ,EAAE,OAAO,EAAE;gBACrD,GAAG,QAAQ;aACZ;YACD,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;YACtB,MAAM,EAAE,QAAQ;SACjB,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,aAAa,CAClB,OAA2B,EAC3B,QAAkB;QAElB,OAAO;YACL,MAAM,EAAE,cAAY;YACpB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,6CAAqB;oBAC9B,UAAU,EAAE,OAAO,CAAC,UAAU;oBAC9B,MAAM,EAAE,OAAO,CAAC,MAAM;iBACvB;gBACD,GAAG,QAAQ;aACZ;YACD,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;YACtB,MAAM,EAAE,QAAQ;SACjB,CAAC;IACJ,CAAC;CACF,CAAA;AAvCY,oCAAY;uBAAZ,YAAY;IALxB,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAC,GAAG,QAAQ,CAAC;QACxB,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;QACtB,OAAO,EAAE,EAAE;KACZ,CAAC;GACW,YAAY,CAuCxB"}
1
+ {"version":3,"file":"helper.module.js","sourceRoot":"","sources":["../../../../packages/helper/src/helper.module.ts"],"names":[],"mappings":";;;AACA,yCAQoB;AACpB,qCAAwC;AACxC,sEAA2D;AAC3D,mEAGiC;AAEjC,MAAM,QAAQ,GAAG;IACf,sBAAW;IACX,4BAAiB;IACjB,sBAAW;IACX,wBAAa;IACb,wBAAa;IACb,uBAAY;IACZ,0BAAe;IACf,+BAAU;CACX,CAAC;AAEF,MAAa,YAAY;IACvB,MAAM,CAAC,QAAQ,CAAC,OAAsB,EAAE,QAAkB;QACxD,OAAO;YACL,MAAM,EAAE,YAAY;YACpB,OAAO,EAAE;gBACP,eAAS,CAAC,QAAQ,CAAC;oBACjB,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB;oBACpC,WAAW,EAAE;wBACX,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB;qBAC7C;iBACF,CAAC;aACH;YACD,SAAS,EAAE;gBACT,EAAE,OAAO,EAAE,6CAAqB,EAAE,QAAQ,EAAE,OAAO,EAAE;gBACrD,GAAG,QAAQ;aACZ;YACD,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC;YACtB,MAAM,EAAE,QAAQ;SACjB,CAAC;IACJ,CA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