@spinajs/email 2.0.180 → 2.0.181

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.
Files changed (47) hide show
  1. package/lib/cjs/cli/SendEmail.d.ts +16 -16
  2. package/lib/cjs/cli/SendEmail.js +82 -82
  3. package/lib/cjs/cli/SendEmail.js.map +1 -1
  4. package/lib/cjs/config/email.d.ts +28 -28
  5. package/lib/cjs/config/email.js +35 -35
  6. package/lib/cjs/events/EmailSent.d.ts +23 -23
  7. package/lib/cjs/events/EmailSent.js +32 -32
  8. package/lib/cjs/events/EmailSent.js.map +1 -1
  9. package/lib/cjs/index.d.ts +23 -23
  10. package/lib/cjs/index.js +76 -76
  11. package/lib/cjs/index.js.map +1 -1
  12. package/lib/cjs/interfaces.d.ts +114 -114
  13. package/lib/cjs/interfaces.js +44 -44
  14. package/lib/cjs/interfaces.js.map +1 -1
  15. package/lib/cjs/jobs/EmailSend.d.ts +30 -30
  16. package/lib/cjs/jobs/EmailSend.js +36 -36
  17. package/lib/cjs/jobs/EmailSend.js.map +1 -1
  18. package/lib/cjs/schemas/email.smtp.configuration.d.ts +52 -52
  19. package/lib/cjs/schemas/email.smtp.configuration.js +38 -38
  20. package/lib/cjs/transports.d.ts +9 -9
  21. package/lib/cjs/transports.js +24 -24
  22. package/lib/cjs/transports.js.map +1 -1
  23. package/lib/mjs/cli/SendEmail.d.ts +16 -16
  24. package/lib/mjs/cli/SendEmail.js +56 -56
  25. package/lib/mjs/cli/SendEmail.js.map +1 -1
  26. package/lib/mjs/config/email.d.ts +28 -28
  27. package/lib/mjs/config/email.js +33 -33
  28. package/lib/mjs/events/EmailSent.d.ts +23 -23
  29. package/lib/mjs/events/EmailSent.js +29 -29
  30. package/lib/mjs/events/EmailSent.js.map +1 -1
  31. package/lib/mjs/index.d.ts +23 -23
  32. package/lib/mjs/index.js +56 -56
  33. package/lib/mjs/index.js.map +1 -1
  34. package/lib/mjs/interfaces.d.ts +114 -114
  35. package/lib/mjs/interfaces.js +39 -39
  36. package/lib/mjs/interfaces.js.map +1 -1
  37. package/lib/mjs/jobs/EmailSend.d.ts +30 -30
  38. package/lib/mjs/jobs/EmailSend.js +33 -33
  39. package/lib/mjs/jobs/EmailSend.js.map +1 -1
  40. package/lib/mjs/schemas/email.smtp.configuration.d.ts +52 -52
  41. package/lib/mjs/schemas/email.smtp.configuration.js +36 -36
  42. package/lib/mjs/transports.d.ts +9 -9
  43. package/lib/mjs/transports.js +21 -21
  44. package/lib/mjs/transports.js.map +1 -1
  45. package/lib/tsconfig.cjs.tsbuildinfo +1 -1
  46. package/lib/tsconfig.mjs.tsbuildinfo +1 -1
  47. package/package.json +8 -8
@@ -1,17 +1,17 @@
1
- import { CliCommand } from '@spinajs/cli';
2
- import { Log } from '@spinajs/log-common';
3
- interface EmailOptions {
4
- connection: string;
5
- from: string;
6
- to: string;
7
- template?: string;
8
- model?: string;
9
- subject: string;
10
- content?: string;
11
- }
12
- export declare class SendEmailCommand extends CliCommand {
13
- protected Log: Log;
14
- execute(options: EmailOptions): Promise<void>;
15
- }
16
- export {};
1
+ import { CliCommand } from '@spinajs/cli';
2
+ import { Log } from '@spinajs/log-common';
3
+ interface EmailOptions {
4
+ connection: string;
5
+ from: string;
6
+ to: string;
7
+ template?: string;
8
+ model?: string;
9
+ subject: string;
10
+ content?: string;
11
+ }
12
+ export declare class SendEmailCommand extends CliCommand {
13
+ protected Log: Log;
14
+ execute(options: EmailOptions): Promise<void>;
15
+ }
16
+ export {};
17
17
  //# sourceMappingURL=SendEmail.d.ts.map
@@ -1,83 +1,83 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
- return c > 3 && r && Object.defineProperty(target, key, r), r;
23
- };
24
- var __importStar = (this && this.__importStar) || function (mod) {
25
- if (mod && mod.__esModule) return mod;
26
- var result = {};
27
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
- __setModuleDefault(result, mod);
29
- return result;
30
- };
31
- var __metadata = (this && this.__metadata) || function (k, v) {
32
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.SendEmailCommand = void 0;
36
- const cli_1 = require("@spinajs/cli");
37
- const di_1 = require("@spinajs/di");
38
- const fs = __importStar(require("fs"));
39
- const log_common_1 = require("@spinajs/log-common");
40
- const index_js_1 = require("./../index.js");
41
- let SendEmailCommand = class SendEmailCommand extends cli_1.CliCommand {
42
- async execute(options) {
43
- this.Log.trace(`Sending email with options options: ${JSON.stringify(options)}`);
44
- try {
45
- const emails = await di_1.DI.resolve(index_js_1.DefaultEmailService);
46
- let model = {};
47
- if (options.model && fs.existsSync(options.model)) {
48
- this.Log.trace(`Found model file at ${options.model}, trying to load model data ... `);
49
- const mText = fs.readFileSync(options.model, { encoding: 'utf-8' });
50
- model = JSON.parse(mText);
51
- }
52
- await emails.send({
53
- from: options.from,
54
- to: options.to.split(','),
55
- connection: options.connection,
56
- template: options.template,
57
- model: model,
58
- subject: options.subject,
59
- text: options.content,
60
- });
61
- this.Log.success(`Email send succesyfully to: ${options.to}, from: ${options.from}, subject: ${options.subject}`);
62
- }
63
- catch (err) {
64
- this.Log.error(`Cannot send email, reason: ${err.message}, stack: ${err.stack}`);
65
- }
66
- }
67
- };
68
- __decorate([
69
- (0, log_common_1.Logger)('email'),
70
- __metadata("design:type", log_common_1.Log)
71
- ], SendEmailCommand.prototype, "Log", void 0);
72
- SendEmailCommand = __decorate([
73
- (0, cli_1.Command)('email-send', 'Sends email, mainly for testing purpose or scheduled tasks'),
74
- (0, cli_1.Option)('-c, --connection [connection]', true, 'name of connection'),
75
- (0, cli_1.Option)('-f, --from [from]', true, 'from email'),
76
- (0, cli_1.Option)('-t, --to [to]', true, 'receipients, can be many ( comma separated )'),
77
- (0, cli_1.Option)('-e, --template [template]', false, 'template name'),
78
- (0, cli_1.Option)('-m, --model [model]', false, 'path to model data for template, in json format'),
79
- (0, cli_1.Option)('-s, --subject [model]', true, 'subject'),
80
- (0, cli_1.Option)('-c, --content [content]', false, 'text content if template is not provided')
81
- ], SendEmailCommand);
82
- exports.SendEmailCommand = SendEmailCommand;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
31
+ var __metadata = (this && this.__metadata) || function (k, v) {
32
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.SendEmailCommand = void 0;
36
+ const cli_1 = require("@spinajs/cli");
37
+ const di_1 = require("@spinajs/di");
38
+ const fs = __importStar(require("fs"));
39
+ const log_common_1 = require("@spinajs/log-common");
40
+ const index_js_1 = require("./../index.js");
41
+ let SendEmailCommand = class SendEmailCommand extends cli_1.CliCommand {
42
+ async execute(options) {
43
+ this.Log.trace(`Sending email with options options: ${JSON.stringify(options)}`);
44
+ try {
45
+ const emails = await di_1.DI.resolve(index_js_1.DefaultEmailService);
46
+ let model = {};
47
+ if (options.model && fs.existsSync(options.model)) {
48
+ this.Log.trace(`Found model file at ${options.model}, trying to load model data ... `);
49
+ const mText = fs.readFileSync(options.model, { encoding: 'utf-8' });
50
+ model = JSON.parse(mText);
51
+ }
52
+ await emails.send({
53
+ from: options.from,
54
+ to: options.to.split(','),
55
+ connection: options.connection,
56
+ template: options.template,
57
+ model: model,
58
+ subject: options.subject,
59
+ text: options.content,
60
+ });
61
+ this.Log.success(`Email send succesyfully to: ${options.to}, from: ${options.from}, subject: ${options.subject}`);
62
+ }
63
+ catch (err) {
64
+ this.Log.error(`Cannot send email, reason: ${err.message}, stack: ${err.stack}`);
65
+ }
66
+ }
67
+ };
68
+ exports.SendEmailCommand = SendEmailCommand;
69
+ __decorate([
70
+ (0, log_common_1.Logger)('email'),
71
+ __metadata("design:type", log_common_1.Log)
72
+ ], SendEmailCommand.prototype, "Log", void 0);
73
+ exports.SendEmailCommand = SendEmailCommand = __decorate([
74
+ (0, cli_1.Command)('email-send', 'Sends email, mainly for testing purpose or scheduled tasks'),
75
+ (0, cli_1.Option)('-c, --connection [connection]', true, 'name of connection'),
76
+ (0, cli_1.Option)('-f, --from [from]', true, 'from email'),
77
+ (0, cli_1.Option)('-t, --to [to]', true, 'receipients, can be many ( comma separated )'),
78
+ (0, cli_1.Option)('-e, --template [template]', false, 'template name'),
79
+ (0, cli_1.Option)('-m, --model [model]', false, 'path to model data for template, in json format'),
80
+ (0, cli_1.Option)('-s, --subject [model]', true, 'subject'),
81
+ (0, cli_1.Option)('-c, --content [content]', false, 'text content if template is not provided')
82
+ ], SendEmailCommand);
83
83
  //# sourceMappingURL=SendEmail.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SendEmail.js","sourceRoot":"","sources":["../../../src/cli/SendEmail.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAA2D;AAC3D,oCAAiC;AACjC,uCAAyB;AACzB,oDAAkD;AAClD,4CAAoD;AAoB7C,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,gBAAU;IAIvC,KAAK,CAAC,OAAO,CAAC,OAAqB;QACxC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,uCAAuC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAEjF,IAAI;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EAAE,KAAK,EAAE,iDAAiD,CAAC;IACvF,IAAA,YAAM,EAAC,uBAAuB,EAAE,IAAI,EAAE,SAAS,CAAC;IAChD,IAAA,YAAM,EAAC,yBAAyB,EAAE,KAAK,EAAE,0CAA0C,CAAC;GACxE,gBAAgB,CAiC5B"}
@@ -1,29 +1,29 @@
1
- declare const email: {
2
- system: {
3
- dirs: {
4
- cli: string[];
5
- jobs: string[];
6
- };
7
- };
8
- email: {
9
- queue: string;
10
- };
11
- queue: {
12
- routing: {
13
- EmailSendJob: {
14
- connection: string;
15
- };
16
- EmailSent: {
17
- connection: string;
18
- };
19
- };
20
- connections: {
21
- name: string;
22
- service: string;
23
- defaultQueueChannel: string;
24
- defaultTopicChannel: string;
25
- }[];
26
- };
27
- };
28
- export default email;
1
+ declare const email: {
2
+ system: {
3
+ dirs: {
4
+ cli: string[];
5
+ jobs: string[];
6
+ };
7
+ };
8
+ email: {
9
+ queue: string;
10
+ };
11
+ queue: {
12
+ routing: {
13
+ EmailSendJob: {
14
+ connection: string;
15
+ };
16
+ EmailSent: {
17
+ connection: string;
18
+ };
19
+ };
20
+ connections: {
21
+ name: string;
22
+ service: string;
23
+ defaultQueueChannel: string;
24
+ defaultTopicChannel: string;
25
+ }[];
26
+ };
27
+ };
28
+ export default email;
29
29
  //# sourceMappingURL=email.d.ts.map
@@ -1,36 +1,36 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const path_1 = require("path");
4
- function dir(path) {
5
- const inCommonJs = typeof module !== 'undefined';
6
- return (0, path_1.resolve)((0, path_1.normalize)((0, path_1.join)(process.cwd(), 'node_modules', '@spinajs', 'email', 'lib', inCommonJs ? 'cjs' : 'mjs', path)));
7
- }
8
- const email = {
9
- system: {
10
- dirs: {
11
- cli: [dir('cli')],
12
- jobs: [dir('jobs')],
13
- },
14
- },
15
- email: {
16
- // default email queue / transport
17
- queue: 'email-queue-black-hole',
18
- },
19
- queue: {
20
- routing: {
21
- EmailSendJob: { connection: 'email-queue-black-hole' },
22
- EmailSent: { connection: 'email-queue-black-hole' },
23
- },
24
- // by default we dont have queue server for sending emails
25
- connections: [
26
- {
27
- name: 'email-queue-black-hole',
28
- service: 'BlackHoleQueueClient',
29
- defaultQueueChannel: 'email-jobs',
30
- defaultTopicChannel: 'email-events',
31
- },
32
- ],
33
- },
34
- };
35
- exports.default = email;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const path_1 = require("path");
4
+ function dir(path) {
5
+ const inCommonJs = typeof module !== 'undefined';
6
+ return (0, path_1.resolve)((0, path_1.normalize)((0, path_1.join)(process.cwd(), 'node_modules', '@spinajs', 'email', 'lib', inCommonJs ? 'cjs' : 'mjs', path)));
7
+ }
8
+ const email = {
9
+ system: {
10
+ dirs: {
11
+ cli: [dir('cli')],
12
+ jobs: [dir('jobs')],
13
+ },
14
+ },
15
+ email: {
16
+ // default email queue / transport
17
+ queue: 'email-queue-black-hole',
18
+ },
19
+ queue: {
20
+ routing: {
21
+ EmailSendJob: { connection: 'email-queue-black-hole' },
22
+ EmailSent: { connection: 'email-queue-black-hole' },
23
+ },
24
+ // by default we dont have queue server for sending emails
25
+ connections: [
26
+ {
27
+ name: 'email-queue-black-hole',
28
+ service: 'BlackHoleQueueClient',
29
+ defaultQueueChannel: 'email-jobs',
30
+ defaultTopicChannel: 'email-events',
31
+ },
32
+ ],
33
+ },
34
+ };
35
+ exports.default = email;
36
36
  //# sourceMappingURL=email.js.map
@@ -1,24 +1,24 @@
1
- import { QueueEvent } from '@spinajs/queue';
2
- import { DateTime } from 'luxon';
3
- import { IEmail } from '../interfaces.js';
4
- export declare class EmailSent extends QueueEvent {
5
- Connection?: string;
6
- From: string;
7
- To: string[];
8
- /**
9
- * Email template eg. pug file or mustashe
10
- */
11
- Template?: string;
12
- /**
13
- * Data model used in template
14
- */
15
- Model?: any;
16
- Subject: string;
17
- /**
18
- * text content if template is not provided
19
- */
20
- Content?: string;
21
- SentAt: DateTime;
22
- constructor(email: IEmail);
23
- }
1
+ import { QueueEvent } from '@spinajs/queue';
2
+ import { DateTime } from 'luxon';
3
+ import { IEmail } from '../interfaces.js';
4
+ export declare class EmailSent extends QueueEvent {
5
+ Connection?: string;
6
+ From: string;
7
+ To: string[];
8
+ /**
9
+ * Email template eg. pug file or mustashe
10
+ */
11
+ Template?: string;
12
+ /**
13
+ * Data model used in template
14
+ */
15
+ Model?: any;
16
+ Subject: string;
17
+ /**
18
+ * text content if template is not provided
19
+ */
20
+ Content?: string;
21
+ SentAt: DateTime;
22
+ constructor(email: IEmail);
23
+ }
24
24
  //# sourceMappingURL=EmailSent.d.ts.map
@@ -1,33 +1,33 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.EmailSent = void 0;
13
- const queue_1 = require("@spinajs/queue");
14
- const luxon_1 = require("luxon");
15
- let EmailSent = class EmailSent extends queue_1.QueueEvent {
16
- constructor(email) {
17
- super();
18
- this.Connection = email.connection;
19
- this.From = email.from;
20
- this.To = email.to;
21
- this.Template = email.template;
22
- this.Model = email.model;
23
- this.Subject = email.subject;
24
- this.Content = email.text;
25
- this.SentAt = luxon_1.DateTime.now();
26
- }
27
- };
28
- EmailSent = __decorate([
29
- (0, queue_1.Event)(),
30
- __metadata("design:paramtypes", [Object])
31
- ], EmailSent);
32
- exports.EmailSent = EmailSent;
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.EmailSent = void 0;
13
+ const queue_1 = require("@spinajs/queue");
14
+ const luxon_1 = require("luxon");
15
+ let EmailSent = class EmailSent extends queue_1.QueueEvent {
16
+ constructor(email) {
17
+ super();
18
+ this.Connection = email.connection;
19
+ this.From = email.from;
20
+ this.To = email.to;
21
+ this.Template = email.template;
22
+ this.Model = email.model;
23
+ this.Subject = email.subject;
24
+ this.Content = email.text;
25
+ this.SentAt = luxon_1.DateTime.now();
26
+ }
27
+ };
28
+ exports.EmailSent = EmailSent;
29
+ exports.EmailSent = EmailSent = __decorate([
30
+ (0, queue_1.Event)(),
31
+ __metadata("design:paramtypes", [Object])
32
+ ], EmailSent);
33
33
  //# sourceMappingURL=EmailSent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmailSent.js","sourceRoot":"","sources":["../../../src/events/EmailSent.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAAmD;AACnD,iCAAiC;AAI1B,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,kBAAU;IA0BvC,YAAY,KAAa;QACvB,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;QACnC,IAAI,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CrB"}
@@ -1,24 +1,24 @@
1
- import { Bootstrapper } from '@spinajs/di';
2
- import { IEmail, EmailService } from './interfaces.js';
3
- import { EmailSend } from './jobs/EmailSend.js';
4
- export * from './interfaces.js';
5
- export * from './transports.js';
6
- export * from './jobs/EmailSend.js';
7
- export declare class LogBotstrapper extends Bootstrapper {
8
- bootstrap(): void;
9
- }
10
- /**
11
- * Email sending service.
12
- */
13
- export declare class DefaultEmailService extends EmailService {
14
- /**
15
- *
16
- * Tries to sends email immediately
17
- *
18
- * @param email - email struct
19
- */
20
- send(email: IEmail): Promise<void>;
21
- sendDeferred(email: IEmail): Promise<EmailSend>;
22
- processDefferedEmails(): Promise<void>;
23
- }
1
+ import { Bootstrapper } from '@spinajs/di';
2
+ import { IEmail, EmailService } from './interfaces.js';
3
+ import { EmailSend } from './jobs/EmailSend.js';
4
+ export * from './interfaces.js';
5
+ export * from './transports.js';
6
+ export * from './jobs/EmailSend.js';
7
+ export declare class LogBotstrapper extends Bootstrapper {
8
+ bootstrap(): void;
9
+ }
10
+ /**
11
+ * Email sending service.
12
+ */
13
+ export declare class DefaultEmailService extends EmailService {
14
+ /**
15
+ *
16
+ * Tries to sends email immediately
17
+ *
18
+ * @param email - email struct
19
+ */
20
+ send(email: IEmail): Promise<void>;
21
+ sendDeferred(email: IEmail): Promise<EmailSend>;
22
+ processDefferedEmails(): Promise<void>;
23
+ }
24
24
  //# sourceMappingURL=index.d.ts.map