@hedhog/mail 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- import { ModuleMetadata, Provider, Type } from '@nestjs/common';
1
+ import { ModuleMetadata } from '@nestjs/common';
2
2
  export type MailModuleOptions = {
3
3
  global?: boolean;
4
4
  type: 'AWS';
@@ -26,11 +26,7 @@ export interface MailOptionsFactory {
26
26
  createMailOptions(): Promise<MailModuleOptions> | MailModuleOptions;
27
27
  }
28
28
  export interface MailModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
29
- global?: boolean;
30
- useExisting?: Type<MailOptionsFactory>;
31
- useClass?: Type<MailOptionsFactory>;
32
- useFactory?: (...args: any[]) => Promise<MailModuleOptions> | MailModuleOptions;
29
+ useFactory: (...args: any[]) => Promise<MailModuleOptions> | MailModuleOptions;
33
30
  inject?: any[];
34
- extraProviders?: Provider[];
35
31
  }
36
32
  //# sourceMappingURL=mail-module-options.interface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mail-module-options.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/mail-module-options.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEhE,MAAM,MAAM,iBAAiB,GACzB;IACE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;CACd,GACD;IACE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,GACD;IACE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEN,MAAM,WAAW,kBAAkB;IACjC,iBAAiB,IAAI,OAAO,CAAC,iBAAiB,CAAC,GAAG,iBAAiB,CAAC;CACrE;AAED,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC;IACvC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACvC,QAAQ,CAAC,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACpC,UAAU,CAAC,EAAE,CACX,GAAG,IAAI,EAAE,GAAG,EAAE,KACX,OAAO,CAAC,iBAAiB,CAAC,GAAG,iBAAiB,CAAC;IACpD,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,cAAc,CAAC,EAAE,QAAQ,EAAE,CAAC;CAC7B"}
1
+ {"version":3,"file":"mail-module-options.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/mail-module-options.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,MAAM,iBAAiB,GACzB;IACE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;CACd,GACD;IACE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,GACD;IACE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEN,MAAM,WAAW,kBAAkB;IACjC,iBAAiB,IAAI,OAAO,CAAC,iBAAiB,CAAC,GAAG,iBAAiB,CAAC;CACrE;AAED,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC;IACvC,UAAU,EAAE,CACV,GAAG,IAAI,EAAE,GAAG,EAAE,KACX,OAAO,CAAC,iBAAiB,CAAC,GAAG,iBAAiB,CAAC;IACpD,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;CAChB"}
@@ -1,9 +1,8 @@
1
1
  import { DynamicModule } from '@nestjs/common';
2
2
  import { MailModuleAsyncOptions, MailModuleOptions } from './interfaces/mail-module-options.interface';
3
3
  export declare class MailModule {
4
- static register(options: MailModuleOptions): DynamicModule;
5
- static registerAsync(options: MailModuleAsyncOptions): DynamicModule;
6
- private static createAsyncProviders;
4
+ static forRoot(options: MailModuleOptions): DynamicModule;
5
+ static forRootAsync(options: MailModuleAsyncOptions): DynamicModule;
7
6
  private static createAsyncOptionsProvider;
8
7
  }
9
8
  //# sourceMappingURL=mail.module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mail.module.d.ts","sourceRoot":"","sources":["../src/mail.module.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EAKd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EAElB,MAAM,4CAA4C,CAAC;AAIpD,qBAMa,UAAU;IACrB,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,aAAa;IAc1D,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,sBAAsB,GAAG,aAAa;IAYpE,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAenC,OAAO,CAAC,MAAM,CAAC,0BAA0B;CAiB1C"}
1
+ {"version":3,"file":"mail.module.d.ts","sourceRoot":"","sources":["../src/mail.module.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAA4B,MAAM,gBAAgB,CAAC;AACzE,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,4CAA4C,CAAC;AAIpD,qBAEa,UAAU;IACrB,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,iBAAiB,GAAG,aAAa;IAgBzD,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,sBAAsB,GAAG,aAAa;IASnE,OAAO,CAAC,MAAM,CAAC,0BAA0B;CAS1C"}
@@ -13,65 +13,40 @@ const common_1 = require("@nestjs/common");
13
13
  const mail_consts_1 = require("./mail.consts");
14
14
  const mail_service_1 = require("./mail.service");
15
15
  let MailModule = MailModule_1 = class MailModule {
16
- static register(options) {
16
+ static forRoot(options) {
17
17
  console.log('MailModule.register', { options });
18
18
  return {
19
19
  module: MailModule_1,
20
- global: options.global,
20
+ imports: [axios_1.HttpModule],
21
21
  providers: [
22
+ mail_service_1.MailService,
22
23
  {
23
24
  provide: mail_consts_1.MAIL_MODULE_OPTIONS,
24
- useValue: options || {},
25
+ useValue: options,
25
26
  },
26
27
  ],
28
+ exports: [mail_service_1.MailService],
27
29
  };
28
30
  }
29
- static registerAsync(options) {
30
- var _a;
31
+ static forRootAsync(options) {
31
32
  return {
32
33
  module: MailModule_1,
33
- global: options.global,
34
- imports: options.imports || [],
35
- providers: [
36
- ...this.createAsyncProviders(options),
37
- ...((_a = options.extraProviders) !== null && _a !== void 0 ? _a : []),
38
- ],
34
+ imports: [...(options.imports || []), axios_1.HttpModule],
35
+ providers: [mail_service_1.MailService, this.createAsyncOptionsProvider(options)],
36
+ exports: [mail_service_1.MailService],
39
37
  };
40
38
  }
41
- static createAsyncProviders(options) {
42
- if (options.useExisting || options.useFactory) {
43
- return [this.createAsyncOptionsProvider(options)];
44
- }
45
- return [
46
- this.createAsyncOptionsProvider(options),
47
- {
48
- provide: options.useClass,
49
- useClass: options.useClass,
50
- },
51
- ];
52
- }
53
39
  static createAsyncOptionsProvider(options) {
54
- if (options.useFactory) {
55
- return {
56
- provide: mail_consts_1.MAIL_MODULE_OPTIONS,
57
- useFactory: options.useFactory,
58
- inject: options.inject || [],
59
- };
60
- }
61
40
  return {
62
41
  provide: mail_consts_1.MAIL_MODULE_OPTIONS,
63
- useFactory: async (optionsFactory) => await optionsFactory.createMailOptions(),
64
- inject: [options.useExisting || options.useClass],
42
+ useFactory: options.useFactory,
43
+ inject: options.inject || [],
65
44
  };
66
45
  }
67
46
  };
68
47
  exports.MailModule = MailModule;
69
48
  exports.MailModule = MailModule = MailModule_1 = __decorate([
70
49
  (0, common_1.Global)(),
71
- (0, common_1.Module)({
72
- imports: [(0, common_1.forwardRef)(() => axios_1.HttpModule)],
73
- providers: [mail_service_1.MailService],
74
- exports: [mail_service_1.MailService],
75
- })
50
+ (0, common_1.Module)({})
76
51
  ], MailModule);
77
52
  //# sourceMappingURL=mail.module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mail.module.js","sourceRoot":"","sources":["../src/mail.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,yCAA2C;AAC3C,2CAMwB;AAMxB,+CAAoD;AACpD,iDAA6C;AAQtC,IAAM,UAAU,kBAAhB,MAAM,UAAU;IACrB,MAAM,CAAC,QAAQ,CAAC,OAA0B;QACxC,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QAChD,OAAO;YACL,MAAM,EAAE,YAAU;YAClB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,iCAAmB;oBAC5B,QAAQ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AC7B,CAAC;IACJ,CAAC;CACF,CAAA;AAnCY,gCAAU;qBAAV,UAAU;IAFtB,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,UAAU,CAmCtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hedhog/mail",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "build": "tsc --project tsconfig.production.json && npm version patch",