@venizia/ignis 0.2.0-23 → 0.2.0-25

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 (41) hide show
  1. package/dist/components/mail/common/constants.d.ts +1 -0
  2. package/dist/components/mail/common/constants.d.ts.map +1 -1
  3. package/dist/components/mail/common/constants.js +2 -0
  4. package/dist/components/mail/common/constants.js.map +1 -1
  5. package/dist/components/mail/common/types/message.d.ts +1 -0
  6. package/dist/components/mail/common/types/message.d.ts.map +1 -1
  7. package/dist/components/mail/common/types/options.d.ts +24 -1
  8. package/dist/components/mail/common/types/options.d.ts.map +1 -1
  9. package/dist/components/mail/helpers/transporters/amazon-ses-transporter.helper.d.ts +19 -0
  10. package/dist/components/mail/helpers/transporters/amazon-ses-transporter.helper.d.ts.map +1 -0
  11. package/dist/components/mail/helpers/transporters/amazon-ses-transporter.helper.js +111 -0
  12. package/dist/components/mail/helpers/transporters/amazon-ses-transporter.helper.js.map +1 -0
  13. package/dist/components/mail/helpers/transporters/index.d.ts +2 -1
  14. package/dist/components/mail/helpers/transporters/index.d.ts.map +1 -1
  15. package/dist/components/mail/helpers/transporters/index.js +2 -1
  16. package/dist/components/mail/helpers/transporters/index.js.map +1 -1
  17. package/dist/components/mail/providers/mail-transporter.provider.d.ts +2 -0
  18. package/dist/components/mail/providers/mail-transporter.provider.d.ts.map +1 -1
  19. package/dist/components/mail/providers/mail-transporter.provider.js +17 -0
  20. package/dist/components/mail/providers/mail-transporter.provider.js.map +1 -1
  21. package/dist/components/mail/utilities/address.utility.d.ts +9 -0
  22. package/dist/components/mail/utilities/address.utility.d.ts.map +1 -0
  23. package/dist/components/mail/utilities/address.utility.js +36 -0
  24. package/dist/components/mail/utilities/address.utility.js.map +1 -0
  25. package/dist/components/mail/utilities/index.d.ts +2 -0
  26. package/dist/components/mail/utilities/index.d.ts.map +1 -1
  27. package/dist/components/mail/utilities/index.js +2 -0
  28. package/dist/components/mail/utilities/index.js.map +1 -1
  29. package/dist/components/mail/utilities/mime.utility.d.ts +19 -0
  30. package/dist/components/mail/utilities/mime.utility.d.ts.map +1 -0
  31. package/dist/components/mail/utilities/mime.utility.js +407 -0
  32. package/dist/components/mail/utilities/mime.utility.js.map +1 -0
  33. package/dist/components/static-asset/index.d.ts +1 -0
  34. package/dist/components/static-asset/index.d.ts.map +1 -1
  35. package/dist/components/static-asset/index.js +1 -0
  36. package/dist/components/static-asset/index.js.map +1 -1
  37. package/dist/components/static-asset/ingest.d.ts +58 -0
  38. package/dist/components/static-asset/ingest.d.ts.map +1 -0
  39. package/dist/components/static-asset/ingest.js +82 -0
  40. package/dist/components/static-asset/ingest.js.map +1 -0
  41. package/package.json +10 -5
@@ -33,6 +33,7 @@ export declare class MailProviders {
33
33
  static readonly NODEMAILER = "nodemailer";
34
34
  static readonly MAILGUN = "mailgun";
35
35
  static readonly CUSTOM = "custom";
36
+ static readonly AMAZON_SES = "amazon-ses";
36
37
  }
37
38
  export type TMailProvider = TConstValue<typeof MailProviders>;
38
39
  //# sourceMappingURL=constants.d.ts.map
@@ -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;CACvD;AAED,yKAAyK;AACzK,qBAAa,cAAc;IACzB,MAAM,CAAC,QAAQ,CAAC,qBAAqB,SAElC;IACH,MAAM,CAAC,QAAQ,CAAC,WAAW,SAAiE;IAC5F,MAAM,CAAC,QAAQ,CAAC,mBAAmB,SAEhC;IACH,MAAM,CAAC,QAAQ,CAAC,iBAAiB,SAE9B;IACH,MAAM,CAAC,QAAQ,CAAC,iBAAiB,SAE9B;IACH,MAAM,CAAC,QAAQ,CAAC,kBAAkB,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C5F,MAAM,CAAC,QAAQ,CAAC,mBAAmB,SAEhC;IACH,MAAM,CAAC,QAAQ,CAAC,iBAAiB,SAE9B;IACH,MAAM,CAAC,QAAQ,CAAC,iBAAiB,SAE9B;IACH,MAAM,CAAC,QAAQ,CAAC,kBAAkB,SAE/B;CACJ;AAED,qBAAa,kBAAkB;IAC7B,MAAM,CAAC,QAAQ,CAAC,iBAAiB,mDAAmD;CACrF;AAED,qBAAa,sBAAsB;IACjC,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAClC,MAAM,CAAC,QAAQ,CAAC,cAAc,oBAAoB;IAClD,MAAM,CAAC,QAAQ,CAAC,MAAM,YAAY;IAElC,MAAM,CAAC,QAAQ,CAAC,UAAU,cAAoE;IAC9F,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGvC;AAED,qBAAa,mBAAmB;IAC9B,MAAM,CAAC,QAAQ,CAAC,UAAU,gBAAgB;IAC1C,MAAM,CAAC,QAAQ,CAAC,WAAW,iBAAiB;IAC5C,MAAM,CAAC,QAAQ,CAAC,IAAI,UAAU;IAE9B,MAAM,CAAC,QAAQ,CAAC,QAAQ,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"}
@@ -55,6 +55,8 @@ class MailProviders {
55
55
  static { this.NODEMAILER = 'nodemailer'; }
56
56
  static { this.MAILGUN = 'mailgun'; }
57
57
  static { this.CUSTOM = 'custom'; }
58
+ // Amazon SES supports both SMTP and HTTPS - this provider is the HTTPS API path; SMTP goes through NODEMAILER instead.
59
+ static { this.AMAZON_SES = 'amazon-ses'; }
58
60
  }
59
61
  exports.MailProviders = MailProviders;
60
62
  //# sourceMappingURL=constants.js.map
@@ -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;;AAFxD,oCAGC;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,GAAG,kBAAW,CAAC,KAAK,CAAC;QACrD,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,oBAAoB,CAAC;KAC9C,CAAC,CAAC;;AAhBL,wCAiBC;AAED,MAAa,kBAAkB;aACb,sBAAiB,GAAG,+CAA+C,CAAC;;AADtF,gDAEC;AAED,MAAa,sBAAsB;aACjB,W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AAW,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3F,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,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"}
@@ -4,6 +4,7 @@ export interface IMailAttachment {
4
4
  contentType?: string;
5
5
  path?: string;
6
6
  content?: string | Buffer | Readable;
7
+ encoding?: BufferEncoding;
7
8
  cid?: string;
8
9
  [key: string]: any;
9
10
  }
@@ -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;IACrC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EA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CAAC;IACtD,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3B,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IACtD,SAAS,CACP,QAAQ,EAAE,YAAY,EAAE,EACxB,OAAO,CAAC,EAAE;QACR,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,GACA,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IAC9B,YAAY,CAAC,IAAI,EAAE;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"}
@@ -15,6 +15,11 @@ export interface IMailgunMailOptions extends IBaseMailOptions {
15
15
  config: TMailgunConfig;
16
16
  module?: TMailgunModule;
17
17
  }
18
+ export interface IAmazonSesMailOptions extends IBaseMailOptions {
19
+ provider: 'amazon-ses';
20
+ config: TAmazonSesConfig;
21
+ module?: TAmazonSesModule;
22
+ }
18
23
  export interface ICustomMailOptions extends IBaseMailOptions {
19
24
  provider: 'custom';
20
25
  config: IMailTransport;
@@ -23,7 +28,7 @@ export interface IGenericMailOptions extends IBaseMailOptions {
23
28
  provider: string;
24
29
  config: Record<string, AnyType>;
25
30
  }
26
- export type TMailOptions = INodemailerMailOptions | IMailgunMailOptions | ICustomMailOptions | IGenericMailOptions;
31
+ export type TMailOptions = INodemailerMailOptions | IAmazonSesMailOptions | IMailgunMailOptions | ICustomMailOptions | IGenericMailOptions;
27
32
  export type TNodemailerConfig = SMTPTransport | SMTPTransport.Options | string;
28
33
  export type TMailgunConfig = AnyType & {
29
34
  domain: string;
@@ -39,4 +44,22 @@ export type TNodemailerModule = {
39
44
  createTransport: (config: AnyType, defaults?: AnyType) => AnyType;
40
45
  };
41
46
  export type TMailgunModule = new (formData: AnyType) => AnyType;
47
+ export type TAmazonSesConfig = {
48
+ region: string;
49
+ credentials?: {
50
+ accessKeyId: string;
51
+ secretAccessKey: string;
52
+ sessionToken?: string;
53
+ };
54
+ endpoint?: string;
55
+ };
56
+ /** Same story as {@link TNodemailerModule} - a compiled binary hands this over explicitly since there is no `node_modules` to resolve `@aws-sdk/client-sesv2` against. */
57
+ export type TAmazonSesModule<TConfig extends AnyType = AnyType, TClient extends AnyType = AnyType> = {
58
+ SESv2Client: new (config: TConfig) => TClient;
59
+ SendEmailCommand: new (input: AnyType) => AnyType;
60
+ GetAccountCommand: new (input?: AnyType) => AnyType;
61
+ };
62
+ export type TAmazonSesClient = Pick<TAmazonSesModule, 'SendEmailCommand' | 'GetAccountCommand'> & {
63
+ client: AnyType;
64
+ };
42
65
  //# sourceMappingURL=options.d.ts.map
@@ -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;CACnB;AAED,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC9D,QAAQ,EAAE,YAAY,CAAC;IACvB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAoB,S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,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"}
@@ -0,0 +1,19 @@
1
+ import { BaseHelper } from '@venizia/ignis-helpers/core';
2
+ import { type IMailMessage, type IMailSendResult, type IMailTransport, type TAmazonSesClient, type TAmazonSesConfig, type TAmazonSesModule } from '../../common';
3
+ export declare class AmazonSesTransportHelper extends BaseHelper implements IMailTransport {
4
+ private client;
5
+ private sendEmailCommandConstructor;
6
+ private getAccountCommandConstructor;
7
+ private module?;
8
+ constructor(opts: {
9
+ config: TAmazonSesConfig;
10
+ module?: TAmazonSesModule;
11
+ });
12
+ send(message: IMailMessage): Promise<IMailSendResult>;
13
+ verify(): Promise<boolean>;
14
+ close(): Promise<void>;
15
+ configure(config: TAmazonSesConfig): void;
16
+ protected buildClient(config: TAmazonSesConfig): TAmazonSesClient;
17
+ private validateConfig;
18
+ }
19
+ //# sourceMappingURL=amazon-ses-transporter.helper.d.ts.map
@@ -0,0 +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":"AACA,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;AAGtB,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;IAiDrD,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"}
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AmazonSesTransportHelper = void 0;
4
+ const ignis_helpers_1 = require("@venizia/ignis-helpers");
5
+ const core_1 = require("@venizia/ignis-helpers/core");
6
+ const common_1 = require("../../common");
7
+ const utilities_1 = require("../../utilities");
8
+ class AmazonSesTransportHelper extends core_1.BaseHelper {
9
+ constructor(opts) {
10
+ super({ scope: AmazonSesTransportHelper.name });
11
+ this.module = opts.module;
12
+ this.configure(opts.config);
13
+ }
14
+ // ------------------------------------------------------------------------------------
15
+ async send(message) {
16
+ const logger = this.logger.for(this.send.name);
17
+ try {
18
+ logger.debug('Sending email with Amazon SES to: %s', message.to);
19
+ const rawMessage = await (0, utilities_1.buildRawMimeMessage)(message);
20
+ const command = new this.sendEmailCommandConstructor({
21
+ // `FromEmailAddress` carries the same RFC 5321/5322 mailbox syntax as the raw `From:`
22
+ // header and is subject to the same 7-bit-ASCII requirement - encoding it separately
23
+ // here (instead of passing `message.from` through untouched) is what keeps a non-ASCII
24
+ // display name from reaching the SES API as raw UTF-8 bytes.
25
+ FromEmailAddress: message.from ? (0, utilities_1.formatAddressHeader)(message.from) : message.from,
26
+ Destination: {
27
+ ToAddresses: (0, utilities_1.splitAddressList)(message.to),
28
+ CcAddresses: message.cc ? (0, utilities_1.splitAddressList)(message.cc) : undefined,
29
+ BccAddresses: message.bcc ? (0, utilities_1.splitAddressList)(message.bcc) : undefined,
30
+ },
31
+ // No `ReplyToAddresses` here: `buildRawMimeMessage` already writes a single, RFC
32
+ // 2047-encoded `Reply-To` header into the raw content. Setting both sends the same
33
+ // address through two channels SES treats independently - a client can end up showing a
34
+ // reply-to derived from whichever one SES prioritizes, and the other becomes a silent,
35
+ // unencoded duplicate that skipped the address encoding path entirely.
36
+ Content: {
37
+ Raw: { Data: rawMessage },
38
+ },
39
+ });
40
+ const result = await this.client.send(command);
41
+ return {
42
+ success: true,
43
+ messageId: result.MessageId,
44
+ response: result,
45
+ };
46
+ }
47
+ catch (error) {
48
+ logger.error('Amazon SES send failed | error: %s', error instanceof Error ? error.message : error);
49
+ return {
50
+ success: false,
51
+ error: error instanceof Error ? error.message : 'Unknown error',
52
+ };
53
+ }
54
+ }
55
+ // ------------------------------------------------------------------------------------
56
+ async verify() {
57
+ const logger = this.logger.for(this.verify.name);
58
+ try {
59
+ logger.info('Verifying Amazon SES account status');
60
+ const command = new this.getAccountCommandConstructor({});
61
+ const result = await this.client.send(command);
62
+ const enabled = result.SendingEnabled === true;
63
+ logger.info('Amazon SES account status: %s', enabled ? 'enabled' : 'disabled');
64
+ return enabled;
65
+ }
66
+ catch (error) {
67
+ logger.error('Amazon SES verification failed | error: %s', error instanceof Error ? error.message : error);
68
+ return false;
69
+ }
70
+ }
71
+ // ------------------------------------------------------------------------------------
72
+ async close() {
73
+ this.logger.for(this.close.name).info('Closing Amazon SES client');
74
+ this.client.destroy?.();
75
+ }
76
+ // ------------------------------------------------------------------------------------
77
+ configure(config) {
78
+ this.validateConfig(config);
79
+ const { client, SendEmailCommand, GetAccountCommand } = this.buildClient(config);
80
+ this.client = client;
81
+ this.sendEmailCommandConstructor = SendEmailCommand;
82
+ this.getAccountCommandConstructor = GetAccountCommand;
83
+ }
84
+ // ------------------------------------------------------------------------------------
85
+ buildClient(config) {
86
+ const sesModule = this.module ?? ignis_helpers_1.ModuleUtility.loadSync({ module: '@aws-sdk/client-sesv2' });
87
+ const client = new sesModule.SESv2Client({
88
+ region: config.region,
89
+ credentials: config.credentials,
90
+ endpoint: config.endpoint,
91
+ });
92
+ return {
93
+ client,
94
+ SendEmailCommand: sesModule.SendEmailCommand,
95
+ GetAccountCommand: sesModule.GetAccountCommand,
96
+ };
97
+ }
98
+ // ------------------------------------------------------------------------------------
99
+ validateConfig(config) {
100
+ if (config.region) {
101
+ return;
102
+ }
103
+ throw (0, core_1.getError)({
104
+ statusCode: 500,
105
+ messageCode: common_1.MailErrorCodes.INVALID_CONFIGURATION,
106
+ message: 'Invalid Amazon SES Configuration | Missing region',
107
+ });
108
+ }
109
+ }
110
+ exports.AmazonSesTransportHelper = AmazonSesTransportHelper;
111
+ //# sourceMappingURL=amazon-ses-transporter.helper.js.map
@@ -0,0 +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,0DAAqE;AACrE,sDAAmE;AACnE,yCAQsB;AACtB,+CAA6F;AAE7F,MAAa,wBAAyB,SAAQ,iBAAU;IAMtD,YAAY,IAA6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B;QAC7C,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAClB,OAAO;QACT,CAAC;QAED,MAAM,IAAA,eAAQ,EAAC;YACb,UAAU,EAAE,GAAG;YACf,WAAW,EAAE,uBAAc,CAAC,qBAAqB;YACjD,OAAO,EAAE,mDAAmD;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AArID,4DAqIC"}
@@ -1,3 +1,4 @@
1
- export * from './nodemail-transporter.helper';
1
+ export * from './amazon-ses-transporter.helper';
2
2
  export * from './mailgun-transporter.helper';
3
+ export * from './nodemail-transporter.helper';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/mail/helpers/transporters/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/mail/helpers/transporters/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC"}
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./nodemail-transporter.helper"), exports);
17
+ __exportStar(require("./amazon-ses-transporter.helper"), exports);
18
18
  __exportStar(require("./mailgun-transporter.helper"), exports);
19
+ __exportStar(require("./nodemail-transporter.helper"), exports);
19
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/mail/helpers/transporters/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gEAA8C;AAC9C,+DAA6C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/mail/helpers/transporters/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kEAAgD;AAChD,+DAA6C;AAC7C,gEAA8C"}
@@ -7,9 +7,11 @@ export declare class MailTransportProvider extends BaseProvider<TGetMailTranspor
7
7
  value(_container: Container): TGetMailTransportFn;
8
8
  private createNodemailerTransport;
9
9
  private createMailgunTransport;
10
+ private createAmazonSesTransport;
10
11
  private createCustomTransport;
11
12
  private isNodemailerOptions;
12
13
  private isMailgunOptions;
14
+ private isAmazonSesOptions;
13
15
  private isCustomOptions;
14
16
  }
15
17
  //# sourceMappingURL=mail-transporter.provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mail-transporter.provider.d.ts","sourceRoot":"","sources":["../../../../src/components/mail/providers/mail-transporter.provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAGV,cAAc,EAEd,YAAY,EACb,MAAM,WAAW,CAAC;AAKnB,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,YAAY,KAAK,cAAc,CAAC;AAE5E,qBAAa,qBAAsB,SAAQ,YAAY,CAAC,mBAAmB,CAAC;;IAK1E,KAAK,CAAC,UAAU,EAAE,SAAS,GAAG,mBAAmB;IA8BjD,OAAO,CAAC,yBAAyB;IAejC,OAAO,CAAC,sBAAsB;IAa9B,OAAO,CAAC,qBAAqB;IAgC7B,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,eAAe;CAGxB"}
1
+ {"version":3,"file":"mail-transporter.provider.d.ts","sourceRoot":"","sources":["../../../../src/components/mail/providers/mail-transporter.provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAIV,cAAc,EAEd,YAAY,EACb,MAAM,WAAW,CAAC;AASnB,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,YAAY,KAAK,cAAc,CAAC;AAE5E,qBAAa,qBAAsB,SAAQ,YAAY,CAAC,mBAAmB,CAAC;;IAK1E,KAAK,CAAC,UAAU,EAAE,SAAS,GAAG,mBAAmB;IAkCjD,OAAO,CAAC,yBAAyB;IAejC,OAAO,CAAC,sBAAsB;IAa9B,OAAO,CAAC,wBAAwB;IAahC,OAAO,CAAC,qBAAqB;IAgC7B,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,eAAe;CAGxB"}
@@ -22,6 +22,9 @@ class MailTransportProvider extends ignis_kernel_1.BaseProvider {
22
22
  case common_1.MailProviders.MAILGUN: {
23
23
  return this.createMailgunTransport(options);
24
24
  }
25
+ case common_1.MailProviders.AMAZON_SES: {
26
+ return this.createAmazonSesTransport(options);
27
+ }
25
28
  case common_1.MailProviders.CUSTOM: {
26
29
  return this.createCustomTransport(options);
27
30
  }
@@ -59,6 +62,17 @@ class MailTransportProvider extends ignis_kernel_1.BaseProvider {
59
62
  message: 'Invalid Mailgun configuration',
60
63
  });
61
64
  }
65
+ createAmazonSesTransport(options) {
66
+ if (this.isAmazonSesOptions(options)) {
67
+ this.logger.for(this.createAmazonSesTransport.name).info('Initializing Amazon SES transport');
68
+ return new helpers_1.AmazonSesTransportHelper({ config: options.config, module: options.module });
69
+ }
70
+ throw (0, core_1.getError)({
71
+ statusCode: 500,
72
+ messageCode: common_1.MailErrorCodes.INVALID_CONFIGURATION,
73
+ message: 'Invalid Amazon SES configuration',
74
+ });
75
+ }
62
76
  createCustomTransport(options) {
63
77
  if (!this.isCustomOptions(options)) {
64
78
  throw (0, core_1.getError)({
@@ -91,6 +105,9 @@ class MailTransportProvider extends ignis_kernel_1.BaseProvider {
91
105
  isMailgunOptions(options) {
92
106
  return options.provider === common_1.MailProviders.MAILGUN && 'config' in options;
93
107
  }
108
+ isAmazonSesOptions(options) {
109
+ return options.provider === common_1.MailProviders.AMAZON_SES && 'config' in options;
110
+ }
94
111
  isCustomOptions(options) {
95
112
  return options.provider === common_1.MailProviders.CUSTOM && 'config' in options;
96
113
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mail-transporter.provider.js","sourceRoot":"","sources":["../../../../src/components/mail/providers/mail-transporter.provider.ts"],"names":[],"mappings":";;;AAAA,wDAAqD;AAErD,sDAAuD;AAQvD,sCAA0D;AAC1D,wCAA+E;AAC/E,4CAA+C;AAI/C,MAAa,qBAAsB,SAAQ,2BAAiC;IAC1E;QACE,KAAK,CAAC,EAAE,KAAK,EAAE,qBAAqB,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,UAAqB;QACzB,OAAO,CAAC,OAAqB,EAAE,EAAE;YAC/B,IAAI,CAAC,MAAM;iBACR,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;iBACpB,IAAI,CAAC,0CAA0C,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;YAEtE,QAAQ,OAAO,CAAC,QAAQ,EAAE,CAAC;gBACzB,KAAK,sBAAa,CAAC,UAAU,CAAC,CAAC,CAAC;oBAC9B,OAAO,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC;gBACjD,CAAC;gBAED,KAAK,sBAAa,CAAC,OAAO,CAAC,CAAC,CAAC;oBAC3B,OAAO,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;gBAC9C,CAAC;gBAED,KAAK,sBAAa,CAAC,MAAM,CAAC,CAAC,CAAC;oBAC1B,OAAO,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;gBAC7C,CAAC;gBAED,OAAO,CAAC,CAAC,CAAC;oBACR,MAAM,IAAA,eAAQ,EAAC;wBAC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QAC3C,OAAO,OAAO,CAAC,QAAQ,KAAK,sBAAa,CAAC,MAAM,IAAI,QAAQ,IAAI,OAAO,CAAC;IAC1E,CAAC;CACF;AA1GD,sDA0GC"}
1
+ {"version":3,"file":"mail-transporter.provider.js","sourceRoot":"","sources":["../../../../src/components/mail/providers/mail-transporter.provider.ts"],"names":[],"mappings":";;;AAAA,wDAAqD;AAErD,sDAAuD;AASvD,sCAA0D;AAC1D,wCAIoB;AACpB,4CAA+C;AAI/C,MAAa,qBAAsB,SAAQ,2BAAiC;IAC1E;QACE,KAAK,CAAC,EAAE,KAAK,EAAE,qBAAqB,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,UAAqB;QACzB,OAAO,CAAC,OAAqB,EAAE,EAAE;YAC/B,IAAI,CAAC,MAAM;iBACR,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;iBACpB,IAAI,CAAC,0CAA0C,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;YAEtE,QAAQ,OAAO,CAAC,QAAQ,EAAE,CAAC;gBACzB,KAAK,sBAAa,CAAC,UAAU,CAAC,CAAC,CAAC;oBAC9B,OAAO,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC;gBACjD,CAAC;gBAED,KAAK,sBAAa,CAAC,OAAO,CAAC,CAAC,CAAC;oBAC3B,OAAO,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;gBAC9C,CAAC;gBAED,KAAK,sBAAa,CAAC,UAAU,CAAC,CAAC,CAAC;oBAC9B,OAAO,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;gBAChD,CAAC;gBAED,KAAK,sBAAa,CAAC,MAAM,CAAC,CAAC,CAAC;oBAC1B,OAAO,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;gBAC7C,CAAC;gBAED,OAAO,CAAC,CAAC,CAAC;oBACR,MAAM,IAAA,eAAQ,EAAC;wBAC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I,CAAC,EAAE;aACvH,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;QACrF,OAAO,OAAO,CAAC,MAAM,CAAC;IACxB,CAAC;IAEO,mBAAmB,CAAC,OAAqB;QAC/C,OAAO,OAAO,CAAC,QAAQ,KAAK,sBAAa,CAAC,UAAU,IAAI,QAAQ,IAAI,OAAO,CAAC;IAC9E,CAAC;IAEO,gBAAgB,CAAC,OAAqB;QAC5C,OAAO,OAAO,CAAC,QAAQ,KAAK,sBAAa,CAAC,OAAO,IAAI,QAAQ,IAAI,OAAO,CAAC;IAC3E,CAAC;IAEO,kBAAkB,CAAC,OAAqB;QAC9C,OAAO,OAAO,CAAC,QAAQ,KAAK,sBAAa,CAAC,UAAU,IAAI,QAAQ,IAAI,OAAO,CAAC;IAC9E,CAAC;IAEO,eAAe,CAAC,OAAqB;QAC3C,OAAO,OAAO,CAAC,QAAQ,KAAK,sBAAa,CAAC,MAAM,IAAI,QAAQ,IAAI,OAAO,CAAC;IAC1E,CAAC;CACF;AA/HD,sDA+HC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Splits one or more RFC 5322 mailbox strings into individual addresses. A caller-supplied `to`
3
+ * is frequently a single comma-separated string (`"a@x.com, b@y.com"`), not an array - treating
4
+ * it as one opaque address turns it into a single malformed recipient. Splitting only at
5
+ * top-level commas (outside a quoted display name) keeps `"Doe, Jane" <jane@x.com>` intact while
6
+ * still separating `"Doe, Jane" <jane@x.com>, bob@y.com` into its two mailboxes.
7
+ */
8
+ export declare function splitAddressList(value: string | string[]): string[];
9
+ //# sourceMappingURL=address.utility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address.utility.d.ts","sourceRoot":"","sources":["../../../../src/components/mail/utilities/address.utility.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,CA8BnE"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.splitAddressList = splitAddressList;
4
+ /**
5
+ * Splits one or more RFC 5322 mailbox strings into individual addresses. A caller-supplied `to`
6
+ * is frequently a single comma-separated string (`"a@x.com, b@y.com"`), not an array - treating
7
+ * it as one opaque address turns it into a single malformed recipient. Splitting only at
8
+ * top-level commas (outside a quoted display name) keeps `"Doe, Jane" <jane@x.com>` intact while
9
+ * still separating `"Doe, Jane" <jane@x.com>, bob@y.com` into its two mailboxes.
10
+ */
11
+ function splitAddressList(value) {
12
+ const items = Array.isArray(value) ? value : [value];
13
+ const addresses = [];
14
+ for (const item of items) {
15
+ let current = '';
16
+ let inQuotes = false;
17
+ for (const char of item) {
18
+ if (char === '"') {
19
+ inQuotes = !inQuotes;
20
+ }
21
+ if (char === ',' && !inQuotes) {
22
+ if (current.trim()) {
23
+ addresses.push(current.trim());
24
+ }
25
+ current = '';
26
+ continue;
27
+ }
28
+ current += char;
29
+ }
30
+ if (current.trim()) {
31
+ addresses.push(current.trim());
32
+ }
33
+ }
34
+ return addresses;
35
+ }
36
+ //# sourceMappingURL=address.utility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address.utility.js","sourceRoot":"","sources":["../../../../src/components/mail/utilities/address.utility.ts"],"names":[],"mappings":";;AAOA,4CA8BC;AArCD;;;;;;GAMG;AACH,SAAgB,gBAAgB,CAAC,KAAwB;IACvD,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACrD,MAAM,SAAS,GAAa,EAAE,CAAC;IAE/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,OAAO,GAAG,EAAE,CAAC;QACjB,IAAI,QAAQ,GAAG,KAAK,CAAC;QAErB,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACxB,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;gBACjB,QAAQ,GAAG,CAAC,QAAQ,CAAC;YACvB,CAAC;YAED,IAAI,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAC9B,IAAI,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;oBACnB,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;gBACjC,CAAC;gBACD,OAAO,GAAG,EAAE,CAAC;gBACb,SAAS;YACX,CAAC;YAED,OAAO,IAAI,IAAI,CAAC;QAClB,CAAC;QAED,IAAI,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;YACnB,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -1,3 +1,5 @@
1
1
  export * from './type.utility';
2
+ export * from './address.utility';
2
3
  export * from './verification.utility';
4
+ export * from './mime.utility';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/mail/utilities/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/mail/utilities/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC"}
@@ -15,5 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./type.utility"), exports);
18
+ __exportStar(require("./address.utility"), exports);
18
19
  __exportStar(require("./verification.utility"), exports);
20
+ __exportStar(require("./mime.utility"), exports);
19
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/mail/utilities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,yDAAuC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/mail/utilities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,oDAAkC;AAClC,yDAAuC;AACvC,iDAA+B"}
@@ -0,0 +1,19 @@
1
+ import { type IMailMessage } from '../common';
2
+ /** Formats a `to`/`cc`/`from`/`replyTo` field as one RFC 5322 address list: splits a
3
+ * comma-separated string or array into individual mailboxes, RFC 2047-encodes each display name,
4
+ * and rejoins with `, ` - the same shape whether the caller passed a string or an array. */
5
+ export declare function formatAddressHeader(value: string | string[]): string;
6
+ /**
7
+ * Builds a raw RFC 822 message with zero external dependencies - Amazon SES's `SendEmailCommand`
8
+ * `Content.Simple` shape has no attachment field, so attachments require a raw MIME body. Written
9
+ * by hand instead of depending on `nodemailer`'s `MailComposer` so the `ses` provider never needs
10
+ * the `nodemailer` peer installed at all.
11
+ *
12
+ * Inline (`cid`) attachments nest under `multipart/related` next to the body - a mail client
13
+ * only renders `cid:` references inline when they share a `multipart/related` parent with the
14
+ * body; under `multipart/mixed` they show up as ordinary downloadable attachments instead. Plain
15
+ * file attachments (no `cid`) stay under `multipart/mixed`, alongside the body or the
16
+ * `multipart/related` group when both kinds are present.
17
+ */
18
+ export declare function buildRawMimeMessage(message: IMailMessage): Promise<Buffer>;
19
+ //# sourceMappingURL=mime.utility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mime.utility.d.ts","sourceRoot":"","sources":["../../../../src/components/mail/utilities/mime.utility.ts"],"names":[],"mappings":"AAIA,OAAO,EAAwC,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AA2FpF;;4FAE4F;AAC5F,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,CAEpE;AA8RD;;;;;;;;;;;GAWG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CA6FhF"}
@@ -0,0 +1,407 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatAddressHeader = formatAddressHeader;
4
+ exports.buildRawMimeMessage = buildRawMimeMessage;
5
+ const node_crypto_1 = require("node:crypto");
6
+ const promises_1 = require("node:fs/promises");
7
+ const core_1 = require("@venizia/ignis-helpers/core");
8
+ const common_1 = require("../common");
9
+ const address_utility_1 = require("./address.utility");
10
+ const CRLF = '\r\n';
11
+ const BASE64_LINE_LENGTH = 76;
12
+ /** RFC 5322 recommends folding well under its own 998-byte hard limit; 78 matches common MTA
13
+ * practice. This is a *soft* preferred width, not a hard requirement - {@link foldHeaderLine}
14
+ * only forces a line break past it when a natural whitespace break point exists nearby. */
15
+ const MAX_HEADER_LINE_LENGTH = 78;
16
+ /** The real hard requirement: SES rejects any raw-message physical line at or over 1000 bytes.
17
+ * A 10-byte margin below that, and comfortably under RFC 5322's own 998-octet hard limit. Only
18
+ * an unbroken token that would itself cross this line forces {@link foldHeaderLine}'s
19
+ * content-altering hard-wrap fallback - below it, one long line is safer than corrupting an
20
+ * atomic value (a single very long address, an unbroken encoded-word) by splitting it. */
21
+ const MAX_HEADER_HARD_LIMIT = 990;
22
+ /** RFC 2047 caps one encoded-word (`=?charset?B?...?=` included) at 75 characters. */
23
+ const ENCODED_WORD_MAX_LENGTH = 75;
24
+ function isAscii(value) {
25
+ for (let index = 0; index < value.length; index++) {
26
+ if (value.charCodeAt(index) > 127) {
27
+ return false;
28
+ }
29
+ }
30
+ return true;
31
+ }
32
+ /**
33
+ * RFC 2047 §5(3) requires each encoded-word to carry whole characters - a multi-byte UTF-8
34
+ * sequence split across two encoded-words decodes to mojibake or invalid UTF-8 on either side of
35
+ * the cut. `bytesPerChunk` is a fixed byte budget, not a character-aligned one, so after slicing
36
+ * at that budget we walk the boundary back over any UTF-8 continuation bytes (`10xxxxxx`, i.e.
37
+ * `byte & 0xC0 === 0x80`) until it lands on the leading byte of a character. `bytesPerChunk` is
38
+ * always far larger than the longest UTF-8 sequence (4 bytes), so this walk-back can never
39
+ * consume the whole chunk. Words are joined with a single space - the required separator between
40
+ * adjacent encoded-words, and also a valid header-folding point.
41
+ */
42
+ function encodeWord(text) {
43
+ const prefix = '=?UTF-8?B?';
44
+ const suffix = '?=';
45
+ const maxPayloadChars = ENCODED_WORD_MAX_LENGTH - prefix.length - suffix.length;
46
+ const bytesPerChunk = Math.floor(maxPayloadChars / 4) * 3;
47
+ const bytes = Buffer.from(text, 'utf-8');
48
+ const words = [];
49
+ let offset = 0;
50
+ while (offset < bytes.length) {
51
+ let end = Math.min(offset + bytesPerChunk, bytes.length);
52
+ while (end < bytes.length && (bytes[end] & 0xc0) === 0x80) {
53
+ end--;
54
+ }
55
+ const chunk = bytes.subarray(offset, end);
56
+ words.push(`${prefix}${chunk.toString('base64')}${suffix}`);
57
+ offset = end;
58
+ }
59
+ return words.join(' ');
60
+ }
61
+ /** Only non-ASCII values pay for RFC 2047 encoding, so a plain-English subject or custom header
62
+ * stays byte-for-byte readable. */
63
+ function encodeHeaderValue(value) {
64
+ return isAscii(value) ? value : encodeWord(value);
65
+ }
66
+ /**
67
+ * Encodes only the *display-name* portion of `"Name" <addr@x.com>` (or bare `Name <addr@x.com>`).
68
+ * The `<addr-spec>` must stay 7-bit ASCII per RFC 5321/5322 and per the SES raw-message
69
+ * requirements - only the free-text name may become an RFC 2047 encoded-word. A bare address with
70
+ * no display name is returned unchanged.
71
+ */
72
+ function encodeAddress(address) {
73
+ const match = /^(.*)<([^<>]+)>\s*$/.exec(address);
74
+ if (!match) {
75
+ return address;
76
+ }
77
+ const [, rawName, addr] = match;
78
+ const name = rawName.trim().replace(/^"|"$/g, '');
79
+ if (name.length === 0 || isAscii(name)) {
80
+ return rawName.trim().length > 0 ? `${rawName.trim()} <${addr}>` : `<${addr}>`;
81
+ }
82
+ return `${encodeWord(name)} <${addr}>`;
83
+ }
84
+ /** Formats a `to`/`cc`/`from`/`replyTo` field as one RFC 5322 address list: splits a
85
+ * comma-separated string or array into individual mailboxes, RFC 2047-encodes each display name,
86
+ * and rejoins with `, ` - the same shape whether the caller passed a string or an array. */
87
+ function formatAddressHeader(value) {
88
+ return (0, address_utility_1.splitAddressList)(value).map(encodeAddress).join(', ');
89
+ }
90
+ /**
91
+ * RFC 5322 §2.2.3 header folding: inserting CRLF immediately before an existing whitespace
92
+ * character splits one logical header value across physical lines without changing its content
93
+ * (the folded whitespace is still there, just after a line break). SES enforces a 1000-byte
94
+ * ceiling per raw-message line; folding at {@link MAX_HEADER_LINE_LENGTH} keeps arbitrarily long
95
+ * recipient lists, subjects, or encoded display names deliverable regardless of how many
96
+ * addresses or how much non-ASCII text a caller supplies - purely by adding more physical
97
+ * lines, never by dropping or truncating anything (verified: rejoining every folded line always
98
+ * reproduces the original value exactly).
99
+ *
100
+ * The one value-altering fallback is deliberately gated on the *hard* limit, not the soft one:
101
+ * an unbroken token (a single very long address, an encoded-word with no adjacent break) that
102
+ * fits under {@link MAX_HEADER_HARD_LIMIT} is left on one long physical line rather than
103
+ * force-broken at the soft width - forcing a break through the middle of an atomic token (an
104
+ * email address has no internal whitespace) would insert a space that was never there,
105
+ * corrupting it. Only a token that would itself violate the real transport limit gets the
106
+ * content-altering hard-wrap - a case that essentially never occurs with real-world input.
107
+ */
108
+ function foldHeaderLine(line) {
109
+ const lines = [];
110
+ let remaining = line;
111
+ while (remaining.length > MAX_HEADER_LINE_LENGTH) {
112
+ let breakAt = remaining.lastIndexOf(' ', MAX_HEADER_LINE_LENGTH);
113
+ if (breakAt <= 0) {
114
+ // No break within the soft width - look further ahead instead of forcing one through an
115
+ // atomic token. Still bounded by the hard limit, so the physical line this produces can
116
+ // never violate the real transport constraint.
117
+ const nextBreak = remaining.indexOf(' ', MAX_HEADER_LINE_LENGTH);
118
+ breakAt = nextBreak > 0 && nextBreak <= MAX_HEADER_HARD_LIMIT ? nextBreak : -1;
119
+ }
120
+ if (breakAt > 0) {
121
+ lines.push(remaining.slice(0, breakAt));
122
+ remaining = remaining.slice(breakAt);
123
+ continue;
124
+ }
125
+ if (remaining.length <= MAX_HEADER_HARD_LIMIT) {
126
+ break;
127
+ }
128
+ // Truly no natural break within the hard limit - an unbroken token that would itself
129
+ // violate the transport line cap. This is the only path that can alter the value.
130
+ lines.push(remaining.slice(0, MAX_HEADER_HARD_LIMIT));
131
+ remaining = ` ${remaining.slice(MAX_HEADER_HARD_LIMIT)}`;
132
+ }
133
+ lines.push(remaining);
134
+ return lines.join(CRLF);
135
+ }
136
+ /** MIME requires encoded body lines capped well under the RFC 5322 998-byte hard limit. */
137
+ function foldBase64(base64) {
138
+ const lines = [];
139
+ for (let index = 0; index < base64.length; index += BASE64_LINE_LENGTH) {
140
+ lines.push(base64.slice(index, index + BASE64_LINE_LENGTH));
141
+ }
142
+ return lines.join(CRLF);
143
+ }
144
+ /** UTF-8 text (`text`/`html` bodies) must be encoded before folding - unlike {@link encodeBufferBase64}, which folds bytes that are already final. Two names instead of one so the caller can never feed raw bytes through the wrong path and silently double-encode them. */
145
+ function encodeTextBase64(text) {
146
+ return foldBase64(Buffer.from(text, 'utf-8').toString('base64'));
147
+ }
148
+ /** Attachment bytes are already final binary content - only folding applies, no UTF-8 re-encode. */
149
+ function encodeBufferBase64(buffer) {
150
+ return foldBase64(buffer.toString('base64'));
151
+ }
152
+ async function streamToBuffer(stream) {
153
+ const chunks = [];
154
+ for await (const chunk of stream) {
155
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
156
+ }
157
+ return Buffer.concat(chunks);
158
+ }
159
+ /** A string `content` is raw text unless `encoding` says otherwise (nodemailer's convention) - a
160
+ * caller that already holds a base64 payload sets `encoding: 'base64'` instead of handing over
161
+ * decoded bytes. */
162
+ async function readAttachmentContent(attachment) {
163
+ if (attachment.content !== undefined) {
164
+ if (Buffer.isBuffer(attachment.content)) {
165
+ return attachment.content;
166
+ }
167
+ if (typeof attachment.content === 'string') {
168
+ return Buffer.from(attachment.content, attachment.encoding ?? 'utf-8');
169
+ }
170
+ return streamToBuffer(attachment.content);
171
+ }
172
+ if (attachment.path) {
173
+ return (0, promises_1.readFile)(attachment.path);
174
+ }
175
+ return Buffer.alloc(0);
176
+ }
177
+ /** A literal CR/LF/NUL inside a header-bound value would let it break out of its own header line and forge additional headers or smuggle body content - classic email header injection. Every value spliced into a raw header line is checked here first, so an attempt fails loudly instead of silently reaching the wire.
178
+ *
179
+ * `value` is `unknown`, not `string`: `IMailMessage`/`IMailAttachment` both end in
180
+ * `[key: string]: any`, so nothing at the type layer stops a caller (e.g. a controller
181
+ * forwarding a request body) from putting a non-string - notably an array - where a string is
182
+ * declared. `Array.prototype.includes('\r')` checks element *equality*, not substring, so
183
+ * `['x\r\nBcc: evil'].includes('\r')` is `false` and a naive string-only check would wave a
184
+ * forged header straight through once it is later stringified by a template literal. Requiring
185
+ * `typeof value === 'string'` up front closes that gap for every field that flows through here. */
186
+ function assertNoHeaderInjection(opts) {
187
+ const { field, value } = opts;
188
+ if (typeof value !== 'string') {
189
+ throw (0, core_1.getError)({
190
+ statusCode: 500,
191
+ messageCode: common_1.MailErrorCodes.INVALID_CONFIGURATION,
192
+ message: `Invalid Amazon SES message | ${field} must be a string`,
193
+ });
194
+ }
195
+ if (!value.includes('\r') && !value.includes('\n') && !value.includes('\0')) {
196
+ return;
197
+ }
198
+ throw (0, core_1.getError)({
199
+ statusCode: 500,
200
+ messageCode: common_1.MailErrorCodes.INVALID_CONFIGURATION,
201
+ message: `Invalid Amazon SES message | ${field} contains illegal control characters`,
202
+ });
203
+ }
204
+ /** Same guard as {@link assertNoHeaderInjection}, applied to every address in a `to`/`cc`/`bcc`
205
+ * field individually - a string field only, not `[key: string]: any`; validating the raw
206
+ * caller-provided value (before splitting/joining) both types and content-checks each entry. */
207
+ function assertNoAddressListInjection(opts) {
208
+ const { field, value } = opts;
209
+ const list = Array.isArray(value) ? value : [value];
210
+ for (const item of list) {
211
+ assertNoHeaderInjection({ field, value: item });
212
+ }
213
+ }
214
+ function extractDomain(address) {
215
+ const match = address ? /@([^@>\s]+)>?\s*$/.exec(address) : null;
216
+ return match ? match[1] : 'localhost';
217
+ }
218
+ function buildHeaders(message) {
219
+ const headers = [];
220
+ if (message.from) {
221
+ assertNoAddressListInjection({ field: 'from', value: message.from });
222
+ headers.push(foldHeaderLine(`From: ${formatAddressHeader(message.from)}`));
223
+ }
224
+ if (message.to) {
225
+ assertNoAddressListInjection({ field: 'to', value: message.to });
226
+ headers.push(foldHeaderLine(`To: ${formatAddressHeader(message.to)}`));
227
+ }
228
+ if (message.cc) {
229
+ assertNoAddressListInjection({ field: 'cc', value: message.cc });
230
+ headers.push(foldHeaderLine(`Cc: ${formatAddressHeader(message.cc)}`));
231
+ }
232
+ if (message.replyTo) {
233
+ assertNoAddressListInjection({ field: 'replyTo', value: message.replyTo });
234
+ headers.push(foldHeaderLine(`Reply-To: ${formatAddressHeader(message.replyTo)}`));
235
+ }
236
+ assertNoHeaderInjection({ field: 'subject', value: message.subject });
237
+ headers.push(foldHeaderLine(`Subject: ${encodeHeaderValue(message.subject)}`));
238
+ // RFC 5322 requires both on every message; SES's raw-message parser does not synthesize them,
239
+ // so an omission here is an omission on the wire (some receiving MTAs reject a `Date`-less
240
+ // message outright, and a missing `Message-ID` breaks threading and dedup).
241
+ headers.push(`Date: ${new Date().toUTCString()}`);
242
+ headers.push(`Message-ID: <${(0, node_crypto_1.randomBytes)(16).toString('hex')}@${extractDomain(message.from)}>`);
243
+ headers.push('MIME-Version: 1.0');
244
+ if (message.headers) {
245
+ for (const [key, value] of Object.entries(message.headers)) {
246
+ assertNoHeaderInjection({ field: `headers.${key}`, value: key });
247
+ assertNoHeaderInjection({ field: `headers.${key}`, value });
248
+ headers.push(foldHeaderLine(`${key}: ${encodeHeaderValue(value)}`));
249
+ }
250
+ }
251
+ return headers;
252
+ }
253
+ /** One text/plain or text/html MIME part. `boundary` omitted only for the single-part, no-attachment case, where the content type belongs on the top-level headers instead of a nested part. */
254
+ function textPart(boundary, contentType, content) {
255
+ return [
256
+ `--${boundary}`,
257
+ `Content-Type: ${contentType}; charset=UTF-8`,
258
+ 'Content-Transfer-Encoding: base64',
259
+ '',
260
+ encodeTextBase64(content),
261
+ ].join(CRLF);
262
+ }
263
+ function escapeQuotedString(value) {
264
+ return value.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
265
+ }
266
+ /** RFC 2231 percent-encoding for the `filename*=`/`name*=` extended parameter form. */
267
+ function encodeRfc2231(value) {
268
+ return encodeURIComponent(value).replace(/[!'()*]/g, char => `%${char.charCodeAt(0).toString(16).toUpperCase()}`);
269
+ }
270
+ /**
271
+ * Builds the `; name="..."`/`; filename="..."` (and, for non-ASCII names, the RFC 2231
272
+ * `; filename*=UTF-8''...` extended form) suffix for a Content-Type/Content-Disposition line.
273
+ * ASCII names are still quoted-string escaped - an unescaped `"` or `\` in a filename would
274
+ * terminate the quoted string early and let the rest of the value merge into a sibling MIME
275
+ * parameter, corrupting the part header for every downstream reader.
276
+ */
277
+ function attachmentNameParams(attribute, value) {
278
+ if (isAscii(value)) {
279
+ return `; ${attribute}="${escapeQuotedString(value)}"`;
280
+ }
281
+ const asciiFallback = value.replace(/[^\x20-\x7E]/g, '_');
282
+ return (`; ${attribute}="${escapeQuotedString(asciiFallback)}"` +
283
+ `; ${attribute}*=UTF-8''${encodeRfc2231(value)}`);
284
+ }
285
+ async function attachmentPart(attachment, boundary) {
286
+ const content = await readAttachmentContent(attachment);
287
+ const contentType = attachment.contentType ?? 'application/octet-stream';
288
+ assertNoHeaderInjection({ field: 'attachment.contentType', value: contentType });
289
+ if (attachment.filename) {
290
+ assertNoHeaderInjection({ field: 'attachment.filename', value: attachment.filename });
291
+ }
292
+ if (attachment.cid) {
293
+ assertNoHeaderInjection({ field: 'attachment.cid', value: attachment.cid });
294
+ }
295
+ const nameAttribute = attachment.filename
296
+ ? attachmentNameParams('name', attachment.filename)
297
+ : '';
298
+ const filenameAttribute = attachment.filename
299
+ ? attachmentNameParams('filename', attachment.filename)
300
+ : '';
301
+ const disposition = attachment.cid ? 'inline' : 'attachment';
302
+ const headerLines = [
303
+ `--${boundary}`,
304
+ foldHeaderLine(`Content-Type: ${contentType}${nameAttribute}`),
305
+ 'Content-Transfer-Encoding: base64',
306
+ foldHeaderLine(`Content-Disposition: ${disposition}${filenameAttribute}`),
307
+ ];
308
+ if (attachment.cid) {
309
+ headerLines.push(`Content-ID: <${attachment.cid}>`);
310
+ }
311
+ return [...headerLines, '', encodeBufferBase64(content)].join(CRLF);
312
+ }
313
+ /** Every boundary is generated the same way - a fixed prefix plus random hex - so no two nested multipart sections in one message can ever collide. */
314
+ function newBoundary(label) {
315
+ return `----=_${label}_${(0, node_crypto_1.randomBytes)(12).toString('hex')}`;
316
+ }
317
+ /**
318
+ * Builds a raw RFC 822 message with zero external dependencies - Amazon SES's `SendEmailCommand`
319
+ * `Content.Simple` shape has no attachment field, so attachments require a raw MIME body. Written
320
+ * by hand instead of depending on `nodemailer`'s `MailComposer` so the `ses` provider never needs
321
+ * the `nodemailer` peer installed at all.
322
+ *
323
+ * Inline (`cid`) attachments nest under `multipart/related` next to the body - a mail client
324
+ * only renders `cid:` references inline when they share a `multipart/related` parent with the
325
+ * body; under `multipart/mixed` they show up as ordinary downloadable attachments instead. Plain
326
+ * file attachments (no `cid`) stay under `multipart/mixed`, alongside the body or the
327
+ * `multipart/related` group when both kinds are present.
328
+ */
329
+ async function buildRawMimeMessage(message) {
330
+ const headers = buildHeaders(message);
331
+ const attachments = message.attachments ?? [];
332
+ const inlineAttachments = attachments.filter(attachment => Boolean(attachment.cid));
333
+ const fileAttachments = attachments.filter(attachment => !attachment.cid);
334
+ const hasBothBodies = Boolean(message.text) && Boolean(message.html);
335
+ const singleContentType = message.html ? 'text/html' : 'text/plain';
336
+ const singleContent = message.html ?? message.text ?? '';
337
+ const bodyPart = (boundary) => {
338
+ if (!hasBothBodies) {
339
+ return textPart(boundary, singleContentType, singleContent);
340
+ }
341
+ const altBoundary = newBoundary('Alt');
342
+ return [
343
+ `--${boundary}`,
344
+ `Content-Type: multipart/alternative; boundary="${altBoundary}"`,
345
+ '',
346
+ [
347
+ textPart(altBoundary, 'text/plain', message.text ?? ''),
348
+ textPart(altBoundary, 'text/html', message.html ?? ''),
349
+ `--${altBoundary}--`,
350
+ ].join(CRLF),
351
+ ].join(CRLF);
352
+ };
353
+ if (attachments.length === 0 && !hasBothBodies) {
354
+ headers.push(`Content-Type: ${singleContentType}; charset=UTF-8`);
355
+ headers.push('Content-Transfer-Encoding: base64');
356
+ return Buffer.from([...headers, '', encodeTextBase64(singleContent)].join(CRLF), 'utf-8');
357
+ }
358
+ if (attachments.length === 0) {
359
+ const boundary = newBoundary('Alt');
360
+ headers.push(`Content-Type: multipart/alternative; boundary="${boundary}"`);
361
+ const parts = [
362
+ textPart(boundary, 'text/plain', message.text ?? ''),
363
+ textPart(boundary, 'text/html', message.html ?? ''),
364
+ `--${boundary}--`,
365
+ ];
366
+ return Buffer.from([...headers, '', parts.join(CRLF)].join(CRLF), 'utf-8');
367
+ }
368
+ const buildRelatedPart = async (parentBoundary) => {
369
+ const relatedBoundary = newBoundary('Related');
370
+ const parts = [bodyPart(relatedBoundary)];
371
+ for (const attachment of inlineAttachments) {
372
+ parts.push(await attachmentPart(attachment, relatedBoundary));
373
+ }
374
+ parts.push(`--${relatedBoundary}--`);
375
+ return [
376
+ `--${parentBoundary}`,
377
+ `Content-Type: multipart/related; boundary="${relatedBoundary}"`,
378
+ '',
379
+ parts.join(CRLF),
380
+ ].join(CRLF);
381
+ };
382
+ if (inlineAttachments.length > 0 && fileAttachments.length === 0) {
383
+ const relatedBoundary = newBoundary('Related');
384
+ const parts = [bodyPart(relatedBoundary)];
385
+ for (const attachment of inlineAttachments) {
386
+ parts.push(await attachmentPart(attachment, relatedBoundary));
387
+ }
388
+ parts.push(`--${relatedBoundary}--`);
389
+ headers.push(`Content-Type: multipart/related; boundary="${relatedBoundary}"`);
390
+ return Buffer.from([...headers, '', parts.join(CRLF)].join(CRLF), 'utf-8');
391
+ }
392
+ const mixedBoundary = newBoundary('Mixed');
393
+ headers.push(`Content-Type: multipart/mixed; boundary="${mixedBoundary}"`);
394
+ const bodyParts = [];
395
+ if (inlineAttachments.length > 0) {
396
+ bodyParts.push(await buildRelatedPart(mixedBoundary));
397
+ }
398
+ else {
399
+ bodyParts.push(bodyPart(mixedBoundary));
400
+ }
401
+ for (const attachment of fileAttachments) {
402
+ bodyParts.push(await attachmentPart(attachment, mixedBoundary));
403
+ }
404
+ bodyParts.push(`--${mixedBoundary}--`);
405
+ return Buffer.from([...headers, '', bodyParts.join(CRLF)].join(CRLF), 'utf-8');
406
+ }
407
+ //# sourceMappingURL=mime.utility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mime.utility.js","sourceRoot":"","sources":["../../../../src/components/mail/utilities/mime.utility.ts"],"names":[],"mappings":";;AAkGA,kDAEC;AA0SD,kDA6FC;AA3eD,6CAA0C;AAC1C,+CAA4C;AAE5C,sDAAuD;AACvD,sCAAoF;AACpF,uDAAqD;AAErD,MAAM,IAAI,GAAG,MAAM,CAAC;AACpB,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B;;2FAE2F;AAC3F,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAClC;;;;0FAI0F;AAC1F,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAClC,sFAAsF;AACtF,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAEnC,SAAS,OAAO,CAAC,KAAa;IAC5B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EA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Aa,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IAC3C,OAAO,CAAC,IAAI,CAAC,4CAA4C,aAAa,GAAG,CAAC,CAAC;IAE3E,MAAM,SAAS,GAAa,EAAE,CAAC;IAE/B,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjC,SAAS,CAAC,IAAI,CAAC,MAAM,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAAC;IACxD,CAAC;SAAM,CAAC;QACN,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,KAAK,MAAM,UAAU,IAAI,eAAe,EAAE,CAAC;QACzC,SAAS,CAAC,IAAI,CAAC,MAAM,cAAc,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC;IAClE,CAAC;IAED,SAAS,CAAC,IAAI,CAAC,KAAK,aAAa,IAAI,CAAC,CAAC;IAEvC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,EAAE,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;AACjF,CAAC"}
@@ -3,4 +3,5 @@ export * from './component';
3
3
  export * from './controller';
4
4
  export * from './models';
5
5
  export * from './repositories';
6
+ export * from './ingest';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/static-asset/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/static-asset/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC"}
@@ -19,4 +19,5 @@ __exportStar(require("./component"), exports);
19
19
  __exportStar(require("./controller"), exports);
20
20
  __exportStar(require("./models"), exports);
21
21
  __exportStar(require("./repositories"), exports);
22
+ __exportStar(require("./ingest"), exports);
22
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/static-asset/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,8CAA4B;AAC5B,+CAA6B;AAC7B,2CAAyB;AACzB,iDAA+B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/static-asset/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,8CAA4B;AAC5B,+CAA6B;AAC7B,2CAAyB;AACzB,iDAA+B;AAC/B,2CAAyB"}
@@ -0,0 +1,58 @@
1
+ import { type IBucketRef, type IObjectRef, type IFileStat, type IStorageHelper, type IUploadResult, type IUrlSafetyPolicy } from '@venizia/ignis-helpers';
2
+ /**
3
+ * What was stored, and what the backend reports about it. The stat is returned because `getStat`
4
+ * already ran to size the result - a caller writing its own row would otherwise pay for it twice.
5
+ *
6
+ * This does NOT write a meta link. The columns an application attaches to an object - a principal,
7
+ * a variant - come from its own domain, not from the object, so the row stays the caller's.
8
+ */
9
+ export interface IIngestFromUrlResult {
10
+ upload: IUploadResult;
11
+ stat: IFileStat;
12
+ }
13
+ /** Where a fetched object lands, and what it is attached to. */
14
+ export interface IIngestFromUrlOptions {
15
+ helper: IStorageHelper;
16
+ url: string;
17
+ bucket: IBucketRef;
18
+ /**
19
+ * Decides the stored key.
20
+ *
21
+ * **Absent, the key comes from the remote url's last path segment - which on an untrusted url is
22
+ * named by whoever supplied it.** Pass `resolveKey` whenever the url is not your own; the
23
+ * validation below bounds what it can do, but it does not make the remote name yours.
24
+ */
25
+ resolveKey?: (opts: {
26
+ url: URL;
27
+ contentType: string;
28
+ }) => string;
29
+ folderPath?: string;
30
+ /** Absent leaves IGNIS's own default: https only, no private address, 3 hops, 10s, 10 MB. */
31
+ policy?: IUrlSafetyPolicy;
32
+ /** Folder nesting the key may carry. Absent uses `BaseStorageHelper.DEFAULT_MAX_FOLDER_DEPTH`. */
33
+ maxFolderDepth?: number;
34
+ /**
35
+ * Where the object is served from. **Required**: an absent hook used to yield an empty link, which
36
+ * is exactly the value that satisfies a NOT NULL column and points nowhere.
37
+ */
38
+ normalizeLinkFn: (opts: {
39
+ bucket: IBucketRef;
40
+ object: IObjectRef;
41
+ }) => string;
42
+ }
43
+ /** Storing an object that came from somewhere else. */
44
+ export declare class AssetIngest {
45
+ /**
46
+ * Fetches an untrusted url and stores what comes back, without the bytes passing through this
47
+ * process: the guarded body is capped and handed to `writeStream` as a stream.
48
+ *
49
+ * The url is guarded by `UrlIngest.fetchGuarded` - scheme allow-list, every resolved address
50
+ * checked, redirects walked by hand with a per-hop re-check, and a timeout. A rebinding window
51
+ * remains open between the check and the connect; see `UrlIngest.assertPublicHost`.
52
+ *
53
+ * The served content type is decided from the stored KEY, never from what the remote host
54
+ * claimed - the same rule the asset routes apply, and for the same reason.
55
+ */
56
+ static fromUrl(opts: IIngestFromUrlOptions): Promise<IIngestFromUrlResult>;
57
+ }
58
+ //# sourceMappingURL=ingest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ingest.d.ts","sourceRoot":"","sources":["../../../src/components/static-asset/ingest.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAC;AAEhC;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,aAAa,CAAC;IACtB,IAAI,EAAE,SAAS,CAAC;CACjB;AAED,gEAAgE;AAChE,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,cAAc,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,UAAU,CAAC;IAEnB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,GAAG,EAAE,GAAG,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,6FAA6F;IAC7F,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAE1B,kGAAkG;IAClG,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,eAAe,EAAE,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,UAAU,CAAC;QAAC,MAAM,EAAE,UAAU,CAAA;KAAE,KAAK,MAAM,CAAC;CAC/E;AAUD,uDAAuD;AACvD,qBAAa,WAAW;IACtB;;;;;;;;;;OAUG;WACU,OAAO,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAkEjF"}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AssetIngest = void 0;
4
+ const core_1 = require("@venizia/ignis-helpers/core");
5
+ const ignis_helpers_1 = require("@venizia/ignis-helpers");
6
+ const readKeyFromUrl = (opts) => {
7
+ const { url, folderPath } = opts;
8
+ const lastSegment = url.pathname.split('/').filter(Boolean).pop() ?? 'object';
9
+ const normalized = lastSegment.toLowerCase().replace(/ /g, '_');
10
+ return folderPath ? `${folderPath}/${normalized}` : normalized;
11
+ };
12
+ /** Storing an object that came from somewhere else. */
13
+ class AssetIngest {
14
+ /**
15
+ * Fetches an untrusted url and stores what comes back, without the bytes passing through this
16
+ * process: the guarded body is capped and handed to `writeStream` as a stream.
17
+ *
18
+ * The url is guarded by `UrlIngest.fetchGuarded` - scheme allow-list, every resolved address
19
+ * checked, redirects walked by hand with a per-hop re-check, and a timeout. A rebinding window
20
+ * remains open between the check and the connect; see `UrlIngest.assertPublicHost`.
21
+ *
22
+ * The served content type is decided from the stored KEY, never from what the remote host
23
+ * claimed - the same rule the asset routes apply, and for the same reason.
24
+ */
25
+ static async fromUrl(opts) {
26
+ const { helper, url, bucket, folderPath, policy, resolveKey, normalizeLinkFn } = opts;
27
+ const response = await ignis_helpers_1.UrlIngest.fetchGuarded({ url, policy });
28
+ const remoteType = response.headers.get('content-type')?.split(';')[0]?.trim() ?? '';
29
+ const parsed = new URL(url);
30
+ const key = resolveKey
31
+ ? resolveKey({ url: parsed, contentType: remoteType })
32
+ : readKeyFromUrl({ url: parsed, folderPath });
33
+ // The helper's own default, not an unbounded one: an object arriving through ingest must obey
34
+ // the same depth rule as one arriving through the upload route.
35
+ if (!helper.isValidObjectKey({ object: { key }, maxDepth: opts.maxFolderDepth })) {
36
+ await response.body?.cancel();
37
+ throw (0, core_1.getError)({ message: `[AssetIngest.fromUrl] Invalid object key | key: ${key}` });
38
+ }
39
+ // Refused BEFORE the write starts, so a body that declares its size never opens a multipart
40
+ // upload at all. A body that lies or omits the header is caught mid-flight by `capStream`, and
41
+ // Bun's client answers that with `AbortMultipartUpload` - measured against a recording endpoint,
42
+ // not assumed - so no orphaned parts are left behind either way.
43
+ const declaredLength = Number(response.headers.get('content-length') ?? 0);
44
+ const maxBytes = policy?.maxBytes ?? ignis_helpers_1.UrlSafetyDefaults.MAX_BYTES;
45
+ if (declaredLength > maxBytes) {
46
+ await response.body?.cancel();
47
+ throw (0, core_1.getError)({
48
+ error: ignis_helpers_1.UrlSafetyErrors.URL_REFUSED,
49
+ message: `[AssetIngest.fromUrl] Body exceeds the cap | declared: ${declaredLength} | max: ${maxBytes}`,
50
+ });
51
+ }
52
+ if (!response.body) {
53
+ throw (0, core_1.getError)({ message: `[AssetIngest.fromUrl] Response carried no body | url: ${url}` });
54
+ }
55
+ const object = { key };
56
+ const contentType = helper.getMimeType({ filename: key });
57
+ await helper.writeStream({
58
+ bucket,
59
+ object,
60
+ source: ignis_helpers_1.UrlIngest.capStream({ source: response.body, policy }),
61
+ contentType,
62
+ maxFolderDepth: opts.maxFolderDepth,
63
+ });
64
+ const stat = await helper.getStat({ bucket, object });
65
+ const link = normalizeLinkFn({ bucket, object });
66
+ if (!link) {
67
+ throw (0, core_1.getError)({
68
+ message: `[AssetIngest.fromUrl] normalizeLinkFn returned an empty link | key: ${key}`,
69
+ });
70
+ }
71
+ return {
72
+ upload: {
73
+ bucket: { name: bucket.name },
74
+ object: { key, size: stat.size, contentType },
75
+ link,
76
+ },
77
+ stat,
78
+ };
79
+ }
80
+ }
81
+ exports.AssetIngest = AssetIngest;
82
+ //# sourceMappingURL=ingest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ingest.js","sourceRoot":"","sources":["../../../src/components/static-asset/ingest.ts"],"names":[],"mappings":";;;AAAA,sDAAuD;AACvD,0DAUgC;AA2ChC,MAAM,cAAc,GAAG,CAAC,IAAuC,EAAU,EAAE;IACzE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;IACjC,MAAM,WAAW,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,IAAI,QAAQ,CAAC;IAC9E,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAEhE,OAAO,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,IAAI,UAAU,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;AACjE,CAAC,CAAC;AAEF,uDAAuD;AACvD,MAAa,WAAW;IACtB;;;;;;;;;;OAUG;IACH,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAA2B;QAC9C,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,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CAAC;IACJ,CAAC;CACF;AA9ED,kCA8EC"}
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@venizia/ignis",
3
- "version": "0.2.0-23",
3
+ "version": "0.2.0-25",
4
4
  "description": "High-performance TypeScript server infrastructure combining LoopBack 4 enterprise architecture (decorator-based DI, repository pattern, component system) with Hono speed (~140k req/s). Features auto-generated OpenAPI docs, Drizzle ORM type-safe SQL, JWT/Basic authentication, Casbin authorization, convention-based bootstrapping, and pluggable components for health checks, Swagger UI, mail, Socket.IO, and static assets. Built for Bun and Node.js.",
5
5
  "keywords": [
6
6
  "access-control",
7
+ "amazon-ses",
7
8
  "api",
8
9
  "api-documentation",
9
10
  "authentication",
@@ -198,17 +199,18 @@
198
199
  "prepublishOnly": "bun run rebuild"
199
200
  },
200
201
  "dependencies": {
201
- "@venizia/ignis-connectors": "^0.2.0-23",
202
+ "@venizia/ignis-connectors": "^0.2.0-24",
202
203
  "@venizia/ignis-filter": "^0.2.0-7",
203
- "@venizia/ignis-helpers": "^0.2.0-17",
204
- "@venizia/ignis-inversion": "^0.2.0-5",
205
- "@venizia/ignis-kernel": "^0.2.0-23",
204
+ "@venizia/ignis-helpers": "^0.2.0-19",
205
+ "@venizia/ignis-inversion": "^0.2.0-6",
206
+ "@venizia/ignis-kernel": "^0.2.0-24",
206
207
  "lodash": "^4.18.1",
207
208
  "reflect-metadata": "^0.2.2",
208
209
  "zod": "^4.5.4"
209
210
  },
210
211
  "peerDependencies": {
211
212
  "@asteasolutions/zod-to-openapi": "^9.0.0",
213
+ "@aws-sdk/client-sesv2": "^3.700.0",
212
214
  "@connectrpc/connect": "^2.1.1",
213
215
  "@electric-sql/pglite": "^0.5.4",
214
216
  "@hono/node-server": "^2.0.10",
@@ -235,6 +237,9 @@
235
237
  "typesense": "^3.0.3"
236
238
  },
237
239
  "peerDependenciesMeta": {
240
+ "@aws-sdk/client-sesv2": {
241
+ "optional": true
242
+ },
238
243
  "@connectrpc/connect": {
239
244
  "optional": true
240
245
  },