@venizia/ignis 0.2.0 → 0.2.1-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/dist/base/middlewares/request-spy/request-spy.middleware.d.ts +1 -1
- package/dist/base/middlewares/request-spy/request-spy.middleware.d.ts.map +1 -1
- package/dist/base/middlewares/request-spy/request-spy.middleware.js +7 -2
- package/dist/base/middlewares/request-spy/request-spy.middleware.js.map +1 -1
- package/dist/components/mail/common/constants.d.ts +5 -0
- package/dist/components/mail/common/constants.d.ts.map +1 -1
- package/dist/components/mail/common/constants.js +11 -0
- package/dist/components/mail/common/constants.js.map +1 -1
- package/dist/components/mail/common/errors.d.ts +25 -0
- package/dist/components/mail/common/errors.d.ts.map +1 -1
- package/dist/components/mail/common/errors.js +22 -0
- package/dist/components/mail/common/errors.js.map +1 -1
- package/dist/components/mail/common/types/message.d.ts +2 -1
- package/dist/components/mail/common/types/message.d.ts.map +1 -1
- package/dist/components/mail/common/types/options.d.ts +7 -0
- package/dist/components/mail/common/types/options.d.ts.map +1 -1
- package/dist/components/mail/component.d.ts +2 -0
- package/dist/components/mail/component.d.ts.map +1 -1
- package/dist/components/mail/component.js +57 -17
- package/dist/components/mail/component.js.map +1 -1
- package/dist/components/mail/helpers/transporters/amazon-ses-transporter.helper.d.ts.map +1 -1
- package/dist/components/mail/helpers/transporters/amazon-ses-transporter.helper.js +2 -0
- package/dist/components/mail/helpers/transporters/amazon-ses-transporter.helper.js.map +1 -1
- package/dist/components/mail/helpers/transporters/mailgun-transporter.helper.d.ts.map +1 -1
- package/dist/components/mail/helpers/transporters/mailgun-transporter.helper.js +6 -6
- package/dist/components/mail/helpers/transporters/mailgun-transporter.helper.js.map +1 -1
- package/dist/components/mail/helpers/transporters/nodemail-transporter.helper.d.ts.map +1 -1
- package/dist/components/mail/helpers/transporters/nodemail-transporter.helper.js +12 -1
- package/dist/components/mail/helpers/transporters/nodemail-transporter.helper.js.map +1 -1
- package/dist/components/mail/services/mail.service.d.ts.map +1 -1
- package/dist/components/mail/services/mail.service.js +19 -3
- package/dist/components/mail/services/mail.service.js.map +1 -1
- package/dist/components/mail/utilities/attachment.utility.d.ts +31 -0
- package/dist/components/mail/utilities/attachment.utility.d.ts.map +1 -0
- package/dist/components/mail/utilities/attachment.utility.js +214 -0
- package/dist/components/mail/utilities/attachment.utility.js.map +1 -0
- package/dist/components/mail/utilities/body.utility.d.ts +6 -0
- package/dist/components/mail/utilities/body.utility.d.ts.map +1 -0
- package/dist/components/mail/utilities/body.utility.js +20 -0
- package/dist/components/mail/utilities/body.utility.js.map +1 -0
- package/dist/components/mail/utilities/mime.utility.d.ts.map +1 -1
- package/dist/components/mail/utilities/mime.utility.js +3 -27
- package/dist/components/mail/utilities/mime.utility.js.map +1 -1
- package/dist/components/static-asset/common/constants.d.ts +8 -0
- package/dist/components/static-asset/common/constants.d.ts.map +1 -1
- package/dist/components/static-asset/common/constants.js +11 -1
- package/dist/components/static-asset/common/constants.js.map +1 -1
- package/dist/components/static-asset/common/errors.d.ts +9 -0
- package/dist/components/static-asset/common/errors.d.ts.map +1 -1
- package/dist/components/static-asset/common/errors.js +9 -0
- package/dist/components/static-asset/common/errors.js.map +1 -1
- package/dist/components/static-asset/common/types.d.ts +25 -12
- package/dist/components/static-asset/common/types.d.ts.map +1 -1
- package/dist/components/static-asset/controller/base.definition.d.ts.map +1 -1
- package/dist/components/static-asset/controller/base.definition.js +10 -1
- package/dist/components/static-asset/controller/base.definition.js.map +1 -1
- package/dist/components/static-asset/controller/factory.d.ts.map +1 -1
- package/dist/components/static-asset/controller/factory.js +618 -563
- package/dist/components/static-asset/controller/factory.js.map +1 -1
- package/dist/components/static-asset/controller/key-scope.d.ts +28 -0
- package/dist/components/static-asset/controller/key-scope.d.ts.map +1 -0
- package/dist/components/static-asset/controller/key-scope.js +44 -0
- package/dist/components/static-asset/controller/key-scope.js.map +1 -0
- package/dist/components/static-asset/controller/meta-link.d.ts +37 -0
- package/dist/components/static-asset/controller/meta-link.d.ts.map +1 -0
- package/dist/components/static-asset/controller/meta-link.js +95 -0
- package/dist/components/static-asset/controller/meta-link.js.map +1 -0
- package/dist/components/static-asset/controller/route-options.d.ts +18 -0
- package/dist/components/static-asset/controller/route-options.d.ts.map +1 -0
- package/dist/components/static-asset/controller/route-options.js +37 -0
- package/dist/components/static-asset/controller/route-options.js.map +1 -0
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +19 -0
- package/dist/testing/index.js.map +1 -0
- package/package.json +9 -5
|
@@ -2,7 +2,7 @@ import { BaseHelper } from '@venizia/ignis-helpers/core';
|
|
|
2
2
|
import type { IProvider } from '@venizia/ignis-inversion';
|
|
3
3
|
import type { MiddlewareHandler } from 'hono/types';
|
|
4
4
|
import { type TContext } from '@venizia/ignis-kernel';
|
|
5
|
-
/** Logs incoming/outgoing request details. The BODY is logged only in a recognised development environment - see the constructor for why that test is fail-closed. */
|
|
5
|
+
/** Logs incoming/outgoing request details. The BODY is parsed and logged only in a recognised development environment - see the constructor for why that test is fail-closed; elsewhere only a JSON body is parsed, for its malformed-body 400. */
|
|
6
6
|
export declare class RequestSpyMiddleware extends BaseHelper implements IProvider<MiddlewareHandler> {
|
|
7
7
|
static readonly REQUEST_ID_KEY = "requestId";
|
|
8
8
|
private isDebugMode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-spy.middleware.d.ts","sourceRoot":"","sources":["../../../../src/base/middlewares/request-spy/request-spy.middleware.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAA8B,MAAM,6BAA6B,CAAC;AAErF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAiC,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAIrF,
|
|
1
|
+
{"version":3,"file":"request-spy.middleware.d.ts","sourceRoot":"","sources":["../../../../src/base/middlewares/request-spy/request-spy.middleware.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAA8B,MAAM,6BAA6B,CAAC;AAErF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAiC,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAIrF,mPAAmP;AACnP,qBAAa,oBAAqB,SAAQ,UAAW,YAAW,SAAS,CAAC,iBAAiB,CAAC;IAC1F,MAAM,CAAC,QAAQ,CAAC,cAAc,eAAkB;IAEhD,OAAO,CAAC,WAAW,CAAU;IAE7B;;;;;;;;;OASG;;IAOH,8PAA8P;IACxP,SAAS,CAAC,IAAI,EAAE;QAAE,GAAG,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAiDjE,wEAAwE;IACxE,KAAK;CAyDN"}
|
|
@@ -8,7 +8,7 @@ const common_1 = require("@venizia/ignis-helpers/common");
|
|
|
8
8
|
const factory_1 = require("hono/factory");
|
|
9
9
|
const ignis_kernel_1 = require("@venizia/ignis-kernel");
|
|
10
10
|
const TEXT_CONTENT_TYPE_PREFIX = 'text/';
|
|
11
|
-
/** Logs incoming/outgoing request details. The BODY is logged only in a recognised development environment - see the constructor for why that test is fail-closed. */
|
|
11
|
+
/** Logs incoming/outgoing request details. The BODY is parsed and logged only in a recognised development environment - see the constructor for why that test is fail-closed; elsewhere only a JSON body is parsed, for its malformed-body 400. */
|
|
12
12
|
class RequestSpyMiddleware extends core_1.BaseHelper {
|
|
13
13
|
static { this.REQUEST_ID_KEY = ignis_kernel_1.REQUEST_ID_KEY; }
|
|
14
14
|
/**
|
|
@@ -80,11 +80,16 @@ class RequestSpyMiddleware extends core_1.BaseHelper {
|
|
|
80
80
|
// Best-effort, never fatal: a unix socket, some proxies and any in-process call yield no connection info - refusing to serve because the client IP is unknown turns a logging gap into an outage.
|
|
81
81
|
const clientIp = incomingIp ?? forwardedIp ?? 'unknown';
|
|
82
82
|
const query = req.query() ?? {};
|
|
83
|
-
const body = await this.parseBody(context);
|
|
84
83
|
if (this.isDebugMode) {
|
|
84
|
+
const body = await this.parseBody({ req });
|
|
85
85
|
this.logger.info('[%s][%s][=>] %s %s | query: %j | body: %j', requestId, clientIp, method.padEnd(8, ' '), path, query, body);
|
|
86
86
|
}
|
|
87
87
|
else {
|
|
88
|
+
// Only JSON is parsed here: its clean 400 on a malformed body is a contract. Any other body
|
|
89
|
+
// would be read for a log line that never prints it, before the route's own size checks.
|
|
90
|
+
if (req.header(common_1.HTTP.Headers.CONTENT_TYPE)?.includes(common_1.HTTP.HeaderValues.APPLICATION_JSON)) {
|
|
91
|
+
await this.parseBody({ req });
|
|
92
|
+
}
|
|
88
93
|
this.logger.info('[%s][%s][=>] %s %s | query: %j', requestId, clientIp, method.padEnd(8, ' '), path, query);
|
|
89
94
|
}
|
|
90
95
|
await next();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-spy.middleware.js","sourceRoot":"","sources":["../../../../src/base/middlewares/request-spy/request-spy.middleware.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAC7D,0DAAqD;AACrD,sDAAqF;AACrF,0DAAqD;AAErD,0CAAgD;AAEhD,wDAAqF;AAErF,MAAM,wBAAwB,GAAG,OAAO,CAAC;AAEzC,
|
|
1
|
+
{"version":3,"file":"request-spy.middleware.js","sourceRoot":"","sources":["../../../../src/base/middlewares/request-spy/request-spy.middleware.ts"],"names":[],"mappings":";;;AAAA,iEAA6D;AAC7D,0DAAqD;AACrD,sDAAqF;AACrF,0DAAqD;AAErD,0CAAgD;AAEhD,wDAAqF;AAErF,MAAM,wBAAwB,GAAG,OAAO,CAAC;AAEzC,mPAAmP;AACnP,MAAa,oBAAqB,SAAQ,iBAAU;aAClC,mBAAc,GAAG,6BAAc,C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EAAE,GAAG,CAAC,EACrB,IAAI,EACJ,QAAQ,CACT,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;;AAhIH,oDAiIC"}
|
|
@@ -2,6 +2,8 @@ import type { TConstValue } from '@venizia/ignis-helpers/common';
|
|
|
2
2
|
export declare class MailDefaults {
|
|
3
3
|
static readonly BATCH_CONCURRENCY = 5;
|
|
4
4
|
static readonly FALLBACK_FROM = "noreply@example.com";
|
|
5
|
+
/** Bytes of attachment content one message may carry, all attachments together. */
|
|
6
|
+
static readonly MAX_ATTACHMENT_BYTES: number;
|
|
5
7
|
}
|
|
6
8
|
/** Built via {@link MessageCode.build}: `ApplicationError` lower-cases codes, so a SCREAMING_CASE literal would reach the client in a spelling no const here matches. */
|
|
7
9
|
export declare class MailErrorCodes {
|
|
@@ -11,6 +13,9 @@ export declare class MailErrorCodes {
|
|
|
11
13
|
static readonly INVALID_RECIPIENT: string;
|
|
12
14
|
static readonly BATCH_SEND_FAILED: string;
|
|
13
15
|
static readonly TEMPLATE_NOT_FOUND: string;
|
|
16
|
+
static readonly ATTACHMENT_PATH_REFUSED: string;
|
|
17
|
+
static readonly ATTACHMENT_TOO_LARGE: string;
|
|
18
|
+
static readonly BODY_SOURCE_REFUSED: string;
|
|
14
19
|
}
|
|
15
20
|
export declare class MailExecutorErrors {
|
|
16
21
|
static readonly PROCESSOR_NOT_SET = "Processor not set. Call setProcessor() first.";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/components/mail/common/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAGjE,qBAAa,YAAY;IACvB,MAAM,CAAC,QAAQ,CAAC,iBAAiB,KAAK;IACtC,MAAM,CAAC,QAAQ,CAAC,aAAa,yBAAyB;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/components/mail/common/constants.ts"],"names":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Q,cAAmE;IAC3F,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGvC;AAED,qBAAa,aAAa;IACxB,MAAM,CAAC,QAAQ,CAAC,UAAU,gBAAgB;IAC1C,MAAM,CAAC,QAAQ,CAAC,OAAO,aAAa;IACpC,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAElC,MAAM,CAAC,QAAQ,CAAC,UAAU,gBAAgB;CAC3C;AAED,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -5,6 +5,8 @@ const core_1 = require("@venizia/ignis-helpers/core");
|
|
|
5
5
|
class MailDefaults {
|
|
6
6
|
static { this.BATCH_CONCURRENCY = 5; }
|
|
7
7
|
static { this.FALLBACK_FROM = 'noreply@example.com'; }
|
|
8
|
+
/** Bytes of attachment content one message may carry, all attachments together. */
|
|
9
|
+
static { this.MAX_ATTACHMENT_BYTES = 25 * 1024 * 1024; }
|
|
8
10
|
}
|
|
9
11
|
exports.MailDefaults = MailDefaults;
|
|
10
12
|
/** Built via {@link MessageCode.build}: `ApplicationError` lower-cases codes, so a SCREAMING_CASE literal would reach the client in a spelling no const here matches. */
|
|
@@ -25,6 +27,15 @@ class MailErrorCodes {
|
|
|
25
27
|
static { this.TEMPLATE_NOT_FOUND = core_1.MessageCode.build({
|
|
26
28
|
parts: ['core', 'mail', 'template_not_found'],
|
|
27
29
|
}); }
|
|
30
|
+
static { this.ATTACHMENT_PATH_REFUSED = core_1.MessageCode.build({
|
|
31
|
+
parts: ['core', 'mail', 'attachment_path_refused'],
|
|
32
|
+
}); }
|
|
33
|
+
static { this.ATTACHMENT_TOO_LARGE = core_1.MessageCode.build({
|
|
34
|
+
parts: ['core', 'mail', 'attachment_too_large'],
|
|
35
|
+
}); }
|
|
36
|
+
static { this.BODY_SOURCE_REFUSED = core_1.MessageCode.build({
|
|
37
|
+
parts: ['core', 'mail', 'body_source_refused'],
|
|
38
|
+
}); }
|
|
28
39
|
}
|
|
29
40
|
exports.MailErrorCodes = MailErrorCodes;
|
|
30
41
|
class MailExecutorErrors {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/components/mail/common/constants.ts"],"names":[],"mappings":";;;AACA,sDAA0D;AAE1D,MAAa,YAAY;aACP,sBAAiB,GAAG,CAAC,CAAC;aACtB,kBAAa,GAAG,qBAAqB,CAAC;;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/components/mail/common/constants.ts"],"names":[],"mappings":";;;AACA,sDAA0D;AAE1D,MAAa,YAAY;aACP,sBAAiB,GAAG,CAAC,CAAC;aACtB,kBAAa,GAAG,qBAAqB,CAAC;IACtD,mFAAmF;aACnE,yBAAoB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;;AAJ1D,oCAKC;AAED,yKAAyK;AACzK,MAAa,cAAc;aACT,0BAAqB,GAAG,kBAAW,CAAC,KAAK,CAAC;QACxD,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,uBAAuB,CAAC;KACjD,CAAC,CAAC;aACa,gBAAW,GAAG,kBAAW,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,CAAC,CAAC;aAC5E,wBAAmB,GAAG,kBAAW,CAAC,KAAK,CAAC;QACtD,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,qBAAqB,CAAC;KAC/C,CAAC,CAAC;aACa,sBAAiB,GAAG,kBAAW,CAAC,KAAK,CAAC;QACpD,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,mBAAmB,CAAC;KAC7C,CAAC,CAAC;aACa,sBAAiB,GAAG,kBAAW,CAAC,KAAK,CAAC;QACpD,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,mBAAmB,CAAC;KAC7C,CAAC,CAAC;aACa,uBAAkB,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AO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;;AARH,kDASC;AAED,MAAa,aAAa;aACR,eAAU,GAAG,YAAY,CAAC;aAC1B,YAAO,GAAG,SAAS,CAAC;aACpB,WAAM,GAAG,QAAQ,CAAC;IAClC,uHAAuH;aACvG,eAAU,GAAG,YAAY,CAAC;;AAL5C,sCAMC"}
|
|
@@ -26,6 +26,31 @@ export declare const MailErrors: {
|
|
|
26
26
|
readonly statusCode: 400;
|
|
27
27
|
readonly category: "validation";
|
|
28
28
|
};
|
|
29
|
+
/** One answer for every refused source - outside the root, missing, not a file - so a caller cannot probe which files exist. */
|
|
30
|
+
readonly ATTACHMENT_PATH_REFUSED: {
|
|
31
|
+
readonly message: {
|
|
32
|
+
readonly text: "Mail attachment path refused";
|
|
33
|
+
readonly code: "core.mail.attachment_path_refused";
|
|
34
|
+
};
|
|
35
|
+
readonly statusCode: 400;
|
|
36
|
+
readonly category: "validation";
|
|
37
|
+
};
|
|
38
|
+
readonly ATTACHMENT_TOO_LARGE: {
|
|
39
|
+
readonly message: {
|
|
40
|
+
readonly text: "Mail attachments are larger than the maximum allowed";
|
|
41
|
+
readonly code: "core.mail.attachment_too_large";
|
|
42
|
+
};
|
|
43
|
+
readonly statusCode: 413;
|
|
44
|
+
readonly category: "validation";
|
|
45
|
+
};
|
|
46
|
+
readonly BODY_SOURCE_REFUSED: {
|
|
47
|
+
readonly message: {
|
|
48
|
+
readonly text: "Mail body must be text";
|
|
49
|
+
readonly code: "core.mail.body_source_refused";
|
|
50
|
+
};
|
|
51
|
+
readonly statusCode: 400;
|
|
52
|
+
readonly category: "validation";
|
|
53
|
+
};
|
|
29
54
|
};
|
|
30
55
|
/** Registers these codes with the shared key registry so a consumer gets autocomplete on `messageCode`. */
|
|
31
56
|
declare module '@venizia/ignis-helpers' {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/components/mail/common/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAIrF,oPAAoP;AACpP,qTAAqT;AACrT,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/components/mail/common/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAIrF,oPAAoP;AACpP,qTAAqT;AACrT,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;IAgBrB,gIAAgI;;;;;;;;;;;;;;;;;;;;;;;;;CAsB7E,CAAC;AAEtD,2GAA2G;AAC3G,OAAO,QAAQ,wBAAwB,CAAC;IACtC,UAAU,iBAAkB,SAAQ,eAAe,CAAC,OAAO,UAAU,CAAC;KAAG;CAC1E"}
|
|
@@ -21,5 +21,27 @@ exports.MailErrors = {
|
|
|
21
21
|
statusCode: common_1.HTTP.ResultCodes.RS_4.BadRequest,
|
|
22
22
|
category: core_1.ErrorScopes.VALIDATION,
|
|
23
23
|
},
|
|
24
|
+
/** One answer for every refused source - outside the root, missing, not a file - so a caller cannot probe which files exist. */
|
|
25
|
+
ATTACHMENT_PATH_REFUSED: {
|
|
26
|
+
message: {
|
|
27
|
+
text: 'Mail attachment path refused',
|
|
28
|
+
code: 'core.mail.attachment_path_refused',
|
|
29
|
+
},
|
|
30
|
+
statusCode: common_1.HTTP.ResultCodes.RS_4.BadRequest,
|
|
31
|
+
category: core_1.ErrorScopes.VALIDATION,
|
|
32
|
+
},
|
|
33
|
+
ATTACHMENT_TOO_LARGE: {
|
|
34
|
+
message: {
|
|
35
|
+
text: 'Mail attachments are larger than the maximum allowed',
|
|
36
|
+
code: 'core.mail.attachment_too_large',
|
|
37
|
+
},
|
|
38
|
+
statusCode: common_1.HTTP.ResultCodes.RS_4.ContentTooLarge,
|
|
39
|
+
category: core_1.ErrorScopes.VALIDATION,
|
|
40
|
+
},
|
|
41
|
+
BODY_SOURCE_REFUSED: {
|
|
42
|
+
message: { text: 'Mail body must be text', code: 'core.mail.body_source_refused' },
|
|
43
|
+
statusCode: common_1.HTTP.ResultCodes.RS_4.BadRequest,
|
|
44
|
+
category: core_1.ErrorScopes.VALIDATION,
|
|
45
|
+
},
|
|
24
46
|
};
|
|
25
47
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/components/mail/common/errors.ts"],"names":[],"mappings":";;;AACA,sDAA0D;AAC1D,0DAAqD;AAErD,oPAAoP;AACpP,qTAAqT;AACxS,QAAA,UAAU,GAAG;IACxB,kBAAkB,EAAE;QAClB,OAAO,EAAE,EAAE,IAAI,EAAE,yBAAyB,EAAE,IAAI,EAAE,8BAA8B,EAAE;QAClF,UAAU,EAAE,aAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ;QAC1C,QAAQ,EAAE,kBAAW,CAAC,QAAQ;KAC/B;IACD,qBAAqB,EAAE;QACrB,OAAO,EAAE,EAAE,IAAI,EAAE,4BAA4B,EAAE,IAAI,EAAE,iCAAiC,EAAE;QACxF,UAAU,EAAE,aAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU;QAC5C,QAAQ,EAAE,kBAAW,CAAC,UAAU;KACjC;IACD,iBAAiB,EAAE;QACjB,OAAO,EAAE,EAAE,IAAI,EAAE,wBAAwB,EAAE,IAAI,EAAE,6BAA6B,EAAE;QAChF,UAAU,EAAE,aAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU;QAC5C,QAAQ,EAAE,kBAAW,CAAC,UAAU;KACjC;CACkD,CAAC"}
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/components/mail/common/errors.ts"],"names":[],"mappings":";;;AACA,sDAA0D;AAC1D,0DAAqD;AAErD,oPAAoP;AACpP,q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E,kBAAW,CAAC,UAAU;KACjC;CACkD,CAAC"}
|
|
@@ -2,8 +2,9 @@ import type { Readable } from 'node:stream';
|
|
|
2
2
|
export interface IMailAttachment {
|
|
3
3
|
filename?: string;
|
|
4
4
|
contentType?: string;
|
|
5
|
+
/** A file under the mail options' `attachmentRoot`; refused when no root is set. */
|
|
5
6
|
path?: string;
|
|
6
|
-
content?: string | Buffer | Readable
|
|
7
|
+
content?: string | Buffer | Uint8Array | Readable | ReadableStream<Uint8Array>;
|
|
7
8
|
encoding?: BufferEncoding;
|
|
8
9
|
cid?: string;
|
|
9
10
|
[key: string]: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../../src/components/mail/common/types/message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../../src/components/mail/common/types/message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oFAAoF;IACpF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;IAC/E,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,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AAE;QACjB,YAAY,EAAE,MAAM,CAAC;QACrB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC1B,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAC9B,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;KACjC,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7B,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5B"}
|
|
@@ -4,6 +4,13 @@ import type { IMailTransport } from './message';
|
|
|
4
4
|
export interface IBaseMailOptions {
|
|
5
5
|
from?: string;
|
|
6
6
|
fromName?: string;
|
|
7
|
+
/**
|
|
8
|
+
* The only directory an `attachment.path` may be read from; `path` is resolved against it and
|
|
9
|
+
* refused if it lands outside, symlinks included. Unset, every `path` is refused.
|
|
10
|
+
*/
|
|
11
|
+
attachmentRoot?: string;
|
|
12
|
+
/** Bytes of attachment content one message may carry, all attachments together. Default 25 MB. */
|
|
13
|
+
maxAttachmentBytes?: number;
|
|
7
14
|
}
|
|
8
15
|
export interface INodemailerMailOptions extends IBaseMailOptions {
|
|
9
16
|
provider: 'nodemailer';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../../../src/components/mail/common/types/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../../../src/components/mail/common/types/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,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,GAAG,OAAO,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,eAAe,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;CACnE,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,KAAK,QAAQ,EAAE,OAAO,KAAK,OAAO,CAAC;AAEhE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtF,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,0KAA0K;AAC1K,MAAM,MAAM,gBAAgB,CAC1B,OAAO,SAAS,OAAO,GAAG,OAAO,EACjC,OAAO,SAAS,OAAO,GAAG,OAAO,IAC/B;IACF,WAAW,EAAE,KAAK,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC;IAC9C,gBAAgB,EAAE,KAAK,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;IAClD,iBAAiB,EAAE,KAAK,KAAK,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,EAAE,kBAAkB,GAAG,mBAAmB,CAAC,GAAG;IAChG,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC"}
|
|
@@ -10,6 +10,8 @@ export declare class MailComponent extends BaseComponent<TMailOptions> {
|
|
|
10
10
|
initGenerators(): void;
|
|
11
11
|
initProviders(): void;
|
|
12
12
|
initServices(): void;
|
|
13
|
+
/** A bad limit or root would otherwise surface on every send, as a 400 that blames the caller. */
|
|
14
|
+
private validateAttachmentOptions;
|
|
13
15
|
createAndBindInstances(): void;
|
|
14
16
|
}
|
|
15
17
|
//# sourceMappingURL=component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/mail/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/mail/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAOtD,OAAO,KAAK,EAA4B,YAAY,EAAE,MAAM,UAAU,CAAC;AAYvE,qBAAa,aAAc,SAAQ,aAAa,CAAC,YAAY,CAAC;IAEN,OAAO,CAAC,WAAW;gBAAX,WAAW,EAAE,eAAe;IAS1F,kHAAkH;IACnG,SAAS,CAAC,IAAI,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAcnD,OAAO,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBxC,cAAc;IAYd,aAAa;IAWb,YAAY;IAWZ,kGAAkG;IAClG,OAAO,CAAC,yBAAyB;IA2CjC,sBAAsB,IAAI,IAAI;CAqC/B"}
|
|
@@ -19,7 +19,10 @@ const ignis_kernel_1 = require("@venizia/ignis-kernel");
|
|
|
19
19
|
const metadata_1 = require("../../base/metadata");
|
|
20
20
|
const common_1 = require("../../common");
|
|
21
21
|
const core_1 = require("@venizia/ignis-helpers/core");
|
|
22
|
-
const common_2 = require("
|
|
22
|
+
const common_2 = require("@venizia/ignis-helpers/common");
|
|
23
|
+
const node_fs_1 = require("node:fs");
|
|
24
|
+
const node_path_1 = require("node:path");
|
|
25
|
+
const common_3 = require("./common");
|
|
23
26
|
const providers_1 = require("./providers");
|
|
24
27
|
const services_1 = require("./services");
|
|
25
28
|
let MailComponent = MailComponent_1 = class MailComponent extends ignis_kernel_1.BaseComponent {
|
|
@@ -39,12 +42,12 @@ let MailComponent = MailComponent_1 = class MailComponent extends ignis_kernel_1
|
|
|
39
42
|
return;
|
|
40
43
|
}
|
|
41
44
|
if (opts !== undefined) {
|
|
42
|
-
this.application.bind({ key:
|
|
45
|
+
this.application.bind({ key: common_3.MailKeys.MAIL_OPTIONS }).toValue(opts);
|
|
43
46
|
}
|
|
44
47
|
await super.configure(opts);
|
|
45
48
|
}
|
|
46
49
|
binding() {
|
|
47
|
-
if (!this.application.isBound({ key:
|
|
50
|
+
if (!this.application.isBound({ key: common_3.MailKeys.MAIL_OPTIONS })) {
|
|
48
51
|
this.logger
|
|
49
52
|
.for(this.binding.name)
|
|
50
53
|
.error('Mail options not configured. Please bind MailKeys.MAIL_OPTIONS before adding MailComponent.');
|
|
@@ -60,63 +63,100 @@ let MailComponent = MailComponent_1 = class MailComponent extends ignis_kernel_1
|
|
|
60
63
|
}
|
|
61
64
|
initGenerators() {
|
|
62
65
|
this.application
|
|
63
|
-
.bind({ key:
|
|
66
|
+
.bind({ key: common_3.MailKeys.MAIL_VERIFICATION_CODE_GENERATOR })
|
|
64
67
|
.toClass(services_1.NumericCodeGenerator);
|
|
65
68
|
this.application
|
|
66
|
-
.bind({ key:
|
|
69
|
+
.bind({ key: common_3.MailKeys.MAIL_VERIFICATION_TOKEN_GENERATOR })
|
|
67
70
|
.toClass(services_1.RandomTokenGenerator);
|
|
68
71
|
this.application
|
|
69
|
-
.bind({ key:
|
|
72
|
+
.bind({ key: common_3.MailKeys.MAIL_VERIFICATION_DATA_GENERATOR })
|
|
70
73
|
.toClass(services_1.DefaultVerificationDataGenerator);
|
|
71
74
|
}
|
|
72
75
|
initProviders() {
|
|
73
76
|
this.application
|
|
74
|
-
.bind({ key:
|
|
77
|
+
.bind({ key: common_3.MailKeys.MAIL_TRANSPORT_PROVIDER })
|
|
75
78
|
.toProvider(providers_1.MailTransportProvider)
|
|
76
79
|
.setScope('singleton');
|
|
77
80
|
this.application
|
|
78
|
-
.bind({ key:
|
|
81
|
+
.bind({ key: common_3.MailKeys.MAIL_QUEUE_EXECUTOR_PROVIDER })
|
|
79
82
|
.toProvider(providers_1.MailQueueExecutorProvider)
|
|
80
83
|
.setScope('singleton');
|
|
81
84
|
}
|
|
82
85
|
initServices() {
|
|
83
86
|
this.application
|
|
84
|
-
.bind({ key:
|
|
87
|
+
.bind({ key: common_3.MailKeys.MAIL_SERVICE })
|
|
85
88
|
.toClass(services_1.MailService)
|
|
86
89
|
.setScope('singleton');
|
|
87
90
|
this.application
|
|
88
|
-
.bind({ key:
|
|
91
|
+
.bind({ key: common_3.MailKeys.MAIL_TEMPLATE_ENGINE })
|
|
89
92
|
.toClass(services_1.TemplateEngineService)
|
|
90
93
|
.setScope('singleton');
|
|
91
94
|
}
|
|
95
|
+
/** A bad limit or root would otherwise surface on every send, as a 400 that blames the caller. */
|
|
96
|
+
validateAttachmentOptions(opts) {
|
|
97
|
+
const { attachmentRoot, maxAttachmentBytes } = opts.options;
|
|
98
|
+
const buildOptionError = (details) => {
|
|
99
|
+
return (0, core_1.getError)({
|
|
100
|
+
statusCode: common_2.HTTP.ResultCodes.RS_5.InternalServerError,
|
|
101
|
+
messageCode: common_3.MailErrorCodes.INVALID_CONFIGURATION,
|
|
102
|
+
message: `Invalid mail options | ${details.message}`,
|
|
103
|
+
cause: details.cause,
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
const isValidLimit = maxAttachmentBytes === undefined ||
|
|
107
|
+
(Number.isSafeInteger(maxAttachmentBytes) && maxAttachmentBytes > 0);
|
|
108
|
+
if (!isValidLimit) {
|
|
109
|
+
throw buildOptionError({ message: 'maxAttachmentBytes must be a positive integer' });
|
|
110
|
+
}
|
|
111
|
+
if (attachmentRoot === undefined) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (typeof attachmentRoot !== 'string' || !(0, node_path_1.isAbsolute)(attachmentRoot)) {
|
|
115
|
+
throw buildOptionError({ message: 'attachmentRoot must be an absolute path' });
|
|
116
|
+
}
|
|
117
|
+
let isDirectory;
|
|
118
|
+
try {
|
|
119
|
+
isDirectory = (0, node_fs_1.statSync)(attachmentRoot).isDirectory();
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
throw buildOptionError({
|
|
123
|
+
message: 'attachmentRoot must be an existing directory',
|
|
124
|
+
cause: error,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
if (!isDirectory) {
|
|
128
|
+
throw buildOptionError({ message: 'attachmentRoot must be an existing directory' });
|
|
129
|
+
}
|
|
130
|
+
}
|
|
92
131
|
createAndBindInstances() {
|
|
93
132
|
// Transport
|
|
94
133
|
const transportGetter = this.application.get({
|
|
95
|
-
key:
|
|
134
|
+
key: common_3.MailKeys.MAIL_TRANSPORT_PROVIDER,
|
|
96
135
|
});
|
|
97
|
-
const mailOptions = this.application.get({ key:
|
|
136
|
+
const mailOptions = this.application.get({ key: common_3.MailKeys.MAIL_OPTIONS });
|
|
137
|
+
this.validateAttachmentOptions({ options: mailOptions });
|
|
98
138
|
// Only the provider is logged: the options carry SMTP / API credentials, which must never reach a log sink.
|
|
99
139
|
this.logger
|
|
100
140
|
.for(this.createAndBindInstances.name)
|
|
101
141
|
.info('Mail provider: %s', mailOptions.provider);
|
|
102
142
|
const mailTransportInstance = transportGetter(mailOptions);
|
|
103
|
-
this.application.bind({ key:
|
|
143
|
+
this.application.bind({ key: common_3.MailKeys.MAIL_TRANSPORT_INSTANCE }).toValue(mailTransportInstance);
|
|
104
144
|
// Queue
|
|
105
145
|
const queueGetter = this.application.get({
|
|
106
|
-
key:
|
|
146
|
+
key: common_3.MailKeys.MAIL_QUEUE_EXECUTOR_PROVIDER,
|
|
107
147
|
});
|
|
108
148
|
// Queueing is opt-in: with no executor config bound, fall back to the direct (inline) executor instead of a "binding is not bounded" crash at boot.
|
|
109
149
|
const queueConfig = this.application.get({
|
|
110
|
-
key:
|
|
150
|
+
key: common_3.MailKeys.MAIL_QUEUE_EXECUTOR_CONFIG,
|
|
111
151
|
isOptional: true,
|
|
112
|
-
}) ?? { type:
|
|
152
|
+
}) ?? { type: common_3.MailQueueExecutorTypes.DIRECT };
|
|
113
153
|
// Same reason as above: a bullmq config carries the Redis password.
|
|
114
154
|
this.logger
|
|
115
155
|
.for(this.createAndBindInstances.name)
|
|
116
156
|
.info('Mail queue executor type: %s', queueConfig.type);
|
|
117
157
|
const queueExecutorInstance = queueGetter(queueConfig);
|
|
118
158
|
this.application
|
|
119
|
-
.bind({ key:
|
|
159
|
+
.bind({ key: common_3.MailKeys.MAIL_QUEUE_EXECUTOR_INSTANCE })
|
|
120
160
|
.toValue(queueExecutorInstance);
|
|
121
161
|
}
|
|
122
162
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/components/mail/component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAsD;AACtD,wDAAsD;AACtD,8CAAyC;AACzC,qCAAwC;AACxC,sDAAuD;
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/components/mail/component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAsD;AACtD,wDAAsD;AACtD,8CAAyC;AACzC,qCAAwC;AACxC,sDAAuD;AACvD,0DAAqD;AACrD,qCAAmC;AACnC,yCAAuC;AAEvC,qCAA4E;AAE5E,2CAA+E;AAC/E,yCAMoB;AAEpB,IAAa,aAAa,qBAA1B,MAAa,aAAc,SAAQ,4BAA2B;IAC5D,YAC8D,WAA4B;QAExF,KAAK,CAAC;YACJ,KAAK,EAAE,eAAa,CAAC,IAAI;YACzB,WAAW,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE;YACrD,QAAQ,EAAE,EAAE;SACb,CAAC,CAAC;QANyD,gBAAW,GAAX,WAAW,CAAiB;IAO1F,CA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E,qBAAY,CAAC,oBAAoB,EAAE,CAAC,CAAA;qCAAsB,8BAAe;GAF/E,aAAa,CAmKzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amazon-ses-transporter.helper.d.ts","sourceRoot":"","sources":["../../../../../src/components/mail/helpers/transporters/amazon-ses-transporter.helper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAY,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"amazon-ses-transporter.helper.d.ts","sourceRoot":"","sources":["../../../../../src/components/mail/helpers/transporters/amazon-ses-transporter.helper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAY,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,cAAc,CAAC;AAItB,qBAAa,wBAAyB,SAAQ,UAAW,YAAW,cAAc;IAChF,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,2BAA2B,CAAU;IAC7C,OAAO,CAAC,4BAA4B,CAAU;IAC9C,OAAO,CAAC,MAAM,CAAC,CAAqC;gBAExC,IAAI,EAAE;QAAE,MAAM,EAAE,gBAAgB,CAAC;QAAC,MAAM,CAAC,EAAE,gBAAgB,CAAA;KAAE;IAQnE,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC;IAkDrD,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAwB1B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAM5B,SAAS,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI;IAWzC,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB;IAkBjE,OAAO,CAAC,cAAc;CAWvB"}
|
|
@@ -6,6 +6,7 @@ const ignis_helpers_1 = require("@venizia/ignis-helpers");
|
|
|
6
6
|
const core_1 = require("@venizia/ignis-helpers/core");
|
|
7
7
|
const common_2 = require("../../common");
|
|
8
8
|
const utilities_1 = require("../../utilities");
|
|
9
|
+
const attachment_utility_1 = require("../../utilities/attachment.utility");
|
|
9
10
|
class AmazonSesTransportHelper extends core_1.BaseHelper {
|
|
10
11
|
constructor(opts) {
|
|
11
12
|
super({ scope: AmazonSesTransportHelper.name });
|
|
@@ -47,6 +48,7 @@ class AmazonSesTransportHelper extends core_1.BaseHelper {
|
|
|
47
48
|
}
|
|
48
49
|
catch (error) {
|
|
49
50
|
logger.error('Amazon SES send failed | error: %s', error instanceof Error ? error.message : error);
|
|
51
|
+
(0, attachment_utility_1.releaseAttachmentStreams)({ attachments: message.attachments });
|
|
50
52
|
return {
|
|
51
53
|
success: false,
|
|
52
54
|
error: error instanceof Error ? error.message : 'Unknown error',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amazon-ses-transporter.helper.js","sourceRoot":"","sources":["../../../../../src/components/mail/helpers/transporters/amazon-ses-transporter.helper.ts"],"names":[],"mappings":";;;AAAA,0DAAqD;AACrD,0DAAqE;AACrE,sDAAmE;AACnE,yCAQsB;AACtB,+CAA6F;
|
|
1
|
+
{"version":3,"file":"amazon-ses-transporter.helper.js","sourceRoot":"","sources":["../../../../../src/components/mail/helpers/transporters/amazon-ses-transporter.helper.ts"],"names":[],"mappings":";;;AAAA,0DAAqD;AACrD,0DAAqE;AACrE,sDAAmE;AACnE,yCAQsB;AACtB,+CAA6F;AAC7F,2EAA8E;AAE9E,MAAa,wBAAyB,SAAQ,iBAAU;IAMtD,YAAY,IAA6D;QACvE,KAAK,CAAC,EAAE,KAAK,EAAE,wBAAwB,CAAC,I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F;IAC/E,cAAc,CAAC,MAAwB;QAC7C,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAClB,OAAO;QACT,CAAC;QAED,MAAM,IAAA,eAAQ,EAAC;YACb,UAAU,EAAE,aAAI,CAAC,WAAW,CAAC,IAAI,CAAC,mBAAmB;YACrD,WAAW,EAAE,uBAAc,CAAC,qBAAqB;YACjD,OAAO,EAAE,mDAAmD;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AAtID,4DAsIC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mailgun-transporter.helper.d.ts","sourceRoot":"","sources":["../../../../../src/components/mail/helpers/transporters/mailgun-transporter.helper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAY,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"mailgun-transporter.helper.d.ts","sourceRoot":"","sources":["../../../../../src/components/mail/helpers/transporters/mailgun-transporter.helper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAY,MAAM,6BAA6B,CAAC;AAEnE,OAAO,KAAK,EAEV,YAAY,EACZ,eAAe,EACf,cAAc,EACd,cAAc,EACd,cAAc,EACf,MAAM,cAAc,CAAC;AAOtB,qBAAa,sBAAuB,SAAQ,UAAW,YAAW,cAAc;IAC9E,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAC,CAAiB;gBAEpB,IAAI,EAAE;QAAE,MAAM,EAAE,cAAc,CAAC;QAAC,MAAM,CAAC,EAAE,cAAc,CAAA;KAAE;IAOrE,SAAS,CAAC,MAAM,EAAE,cAAc;IAOhC,sHAAsH;IACtH,OAAO,CAAC,cAAc;IAoBtB,+FAA+F;IAC/F,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO;IAQhD,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC;IAiDrD,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;CAmBjC"}
|
|
@@ -5,6 +5,7 @@ const common_1 = require("@venizia/ignis-helpers/common");
|
|
|
5
5
|
const core_1 = require("@venizia/ignis-helpers/core");
|
|
6
6
|
const ignis_helpers_1 = require("@venizia/ignis-helpers");
|
|
7
7
|
const common_2 = require("../../common");
|
|
8
|
+
const attachment_utility_1 = require("../../utilities/attachment.utility");
|
|
8
9
|
class MailgunTransportHelper extends core_1.BaseHelper {
|
|
9
10
|
constructor(opts) {
|
|
10
11
|
super({ scope: MailgunTransportHelper.name });
|
|
@@ -60,12 +61,10 @@ class MailgunTransportHelper extends core_1.BaseHelper {
|
|
|
60
61
|
});
|
|
61
62
|
}
|
|
62
63
|
if (message.attachments && message.attachments.length > 0) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
};
|
|
68
|
-
return attachment;
|
|
64
|
+
// No root: MailService resolved paths already; one that reaches here is refused, not read.
|
|
65
|
+
const attachments = await (0, attachment_utility_1.resolveMailAttachments)({ attachments: message.attachments });
|
|
66
|
+
mailgunMessage.attachment = attachments.map((attachment) => {
|
|
67
|
+
return { filename: attachment.filename, data: attachment.content };
|
|
69
68
|
});
|
|
70
69
|
}
|
|
71
70
|
this.logger.for(this.send.name).debug('Sending email with Mailgun to: %s', mailgunMessage.to);
|
|
@@ -78,6 +77,7 @@ class MailgunTransportHelper extends core_1.BaseHelper {
|
|
|
78
77
|
}
|
|
79
78
|
catch (error) {
|
|
80
79
|
this.logger.for(this.send.name).error('Mailgun send failed: %s', error);
|
|
80
|
+
(0, attachment_utility_1.releaseAttachmentStreams)({ attachments: message.attachments });
|
|
81
81
|
return {
|
|
82
82
|
success: false,
|
|
83
83
|
error: error instanceof Error ? error.message : 'Unknown error',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mailgun-transporter.helper.js","sourceRoot":"","sources":["../../../../../src/components/mail/helpers/transporters/mailgun-transporter.helper.ts"],"names":[],"mappings":";;;AAAA,0DAAqD;AAErD,sDAAmE;AACnE,0DAAuD;
|
|
1
|
+
{"version":3,"file":"mailgun-transporter.helper.js","sourceRoot":"","sources":["../../../../../src/components/mail/helpers/transporters/mailgun-transporter.helper.ts"],"names":[],"mappings":";;;AAAA,0DAAqD;AAErD,sDAAmE;AACnE,0DAAuD;AASvD,yCAA8C;AAC9C,2EAG4C;AAE5C,MAAa,sBAAuB,SAAQ,iBAAU;IAKpD,YAAY,IAAyD;QACnE,KAAK,CAAC,EAAE,KAAK,EAAE,sBAAsB,CAAC,IAAI,EAAE,CAAC,CAAC;QAE9C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IAED,SAAS,CAAC,MAAsB;QAC9B,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAE5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACzC,CAAC;IAED,sHAAsH;IAC9G,cAAc,CAAC,MAAsB;QAC3C,MAAM,WAAW,GAAI,CAAC,UAAU,EAAE,KAAK,EAAE,QAAQ,CAAW,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;YACxE,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;QAEH,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC7B,OAAO;QACT,CAAC;QAED,IAAI,CAAC,MAAM;aACR,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;aACxB,KAAK,CA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AE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;YAC/D,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;aAChE,CAAC;QACJ,CAAC;IACH,CAAC;IAED,KAAK,CAAC,MAAM;QACV,IAAI,CAAC;YACH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;YAC3E,yFAAyF;YACzF,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE;gBACpC,IAAI,EAAE,SAAS,GAAG,IAAI,CAAC,MAAM;gBAC7B,EAAE,EAAE,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC;gBAC7B,OAAO,EAAE,mBAAmB;gBAC5B,IAAI,EAAE,6BAA6B;gBACnC,YAAY,EAAE,KAAK,EAAE,0CAA0C;aAChE,CAAC,CAAC;YAEH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;YACvF,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,qCAAqC,EAAE,KAAK,CAAC,CAAC;YACtF,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AArHD,wDAqHC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodemail-transporter.helper.d.ts","sourceRoot":"","sources":["../../../../../src/components/mail/helpers/transporters/nodemail-transporter.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"nodemail-transporter.helper.d.ts","sourceRoot":"","sources":["../../../../../src/components/mail/helpers/transporters/nodemail-transporter.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AAOtB,qBAAa,yBAA0B,SAAQ,UAAW,YAAW,cAAc;IACjF,OAAO,CAAC,WAAW,CAAU;IAC7B,OAAO,CAAC,MAAM,CAAC,CAAoB;gBAEvB,IAAI,EAAE;QAAE,MAAM,EAAE,iBAAiB,CAAC;QAAC,MAAM,CAAC,EAAE,iBAAiB,CAAA;KAAE;IAO3E,SAAS,CAAC,MAAM,EAAE,iBAAiB;IAInC,8FAA8F;IAC9F,SAAS,CAAC,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO;IAKxD,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC;IA2CrD,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAY1B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAI7B"}
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.NodemailerTransportHelper = void 0;
|
|
4
4
|
const core_1 = require("@venizia/ignis-helpers/core");
|
|
5
5
|
const ignis_helpers_1 = require("@venizia/ignis-helpers");
|
|
6
|
+
const attachment_utility_1 = require("../../utilities/attachment.utility");
|
|
7
|
+
const body_utility_1 = require("../../utilities/body.utility");
|
|
6
8
|
class NodemailerTransportHelper extends core_1.BaseHelper {
|
|
7
9
|
constructor(opts) {
|
|
8
10
|
super({ scope: NodemailerTransportHelper.name });
|
|
@@ -19,6 +21,11 @@ class NodemailerTransportHelper extends core_1.BaseHelper {
|
|
|
19
21
|
}
|
|
20
22
|
async send(message) {
|
|
21
23
|
try {
|
|
24
|
+
(0, body_utility_1.assertMailBodyIsText)({ message });
|
|
25
|
+
// No root: MailService resolved paths already; one that reaches here is refused, not read.
|
|
26
|
+
const attachments = message.attachments
|
|
27
|
+
? await (0, attachment_utility_1.resolveMailAttachments)({ attachments: message.attachments })
|
|
28
|
+
: undefined;
|
|
22
29
|
const mailOptions = {
|
|
23
30
|
from: message.from,
|
|
24
31
|
to: Array.isArray(message.to) ? message.to.join(', ') : message.to,
|
|
@@ -28,8 +35,11 @@ class NodemailerTransportHelper extends core_1.BaseHelper {
|
|
|
28
35
|
subject: message.subject,
|
|
29
36
|
text: message.text,
|
|
30
37
|
html: message.html,
|
|
31
|
-
attachments
|
|
38
|
+
attachments,
|
|
32
39
|
headers: message.headers,
|
|
40
|
+
// Nodemailer's own switches: no field it is handed can make it open a file or fetch a URL.
|
|
41
|
+
disableFileAccess: true,
|
|
42
|
+
disableUrlAccess: true,
|
|
33
43
|
};
|
|
34
44
|
this.logger.for(this.send.name).debug('Sending email with nodemailer to: %s', mailOptions.to);
|
|
35
45
|
const info = await this.transporter.sendMail(mailOptions);
|
|
@@ -41,6 +51,7 @@ class NodemailerTransportHelper extends core_1.BaseHelper {
|
|
|
41
51
|
}
|
|
42
52
|
catch (error) {
|
|
43
53
|
this.logger.for(this.send.name).error('Nodemailer send failed: %s', error);
|
|
54
|
+
(0, attachment_utility_1.releaseAttachmentStreams)({ attachments: message.attachments });
|
|
44
55
|
return {
|
|
45
56
|
success: false,
|
|
46
57
|
error: error instanceof Error ? error.message : 'Unknown error',
|