@typetron/framework 0.5.35 → 0.5.36

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.
@@ -60,6 +60,9 @@ the application loads each file.
60
60
  `AppConfig.server` selects the Node or uWebSockets HTTP server. A configured `websocketsPort` starts the separate WebSocket provider. Static
61
61
  assets are served when `staticAssets` entries are present.
62
62
 
63
+ `MailConfig.default` supports `memory`, `SendGrid`, and `Cloudflare`. Cloudflare requires `mailers.Cloudflare.accountId` and
64
+ `mailers.Cloudflare.apiToken`; see [Mail configuration](../Mail/Readme.md#cloudflare).
65
+
63
66
  Authentication configuration must provide a signing `signature`. If it is missing, application creation throws an error stating that
64
67
  `APP_SECRET` is not set up.
65
68
 
package/Mail/Readme.md CHANGED
@@ -6,6 +6,9 @@
6
6
  - [Sending Mail](#sending-mail)
7
7
  - [Recipients and Message Details](#recipients-and-message-details)
8
8
  - [Transports and Testing](#transports-and-testing)
9
+ - [Delivery Outcomes](#delivery-outcomes)
10
+ - [Cloudflare](#cloudflare)
11
+ - [Delivery Errors](#delivery-errors)
9
12
 
10
13
  ## Introduction
11
14
 
@@ -14,7 +17,8 @@ performs the delivery.
14
17
 
15
18
  ## Configuration
16
19
 
17
- Applications normally register `MailProvider` and configure `MailConfig`. The `default` mailer may be `memory` or `SendGrid`, and `from`
20
+ Applications normally register `MailProvider` and configure `MailConfig`. The `default` mailer may be `memory`, `SendGrid`, or `Cloudflare`,
21
+ and `from`
18
22
  supplies the default sender.
19
23
 
20
24
  ```ts
@@ -89,7 +93,7 @@ await mail
89
93
  ## Transports and Testing
90
94
 
91
95
  `MemoryTransport` stores sent messages in its public `messages` array and is suitable for tests and local development. `SendGridTransport`
92
- sends through `@sendgrid/mail` and converts SendGrid failures into an HTTP error.
96
+ sends through `@sendgrid/mail`. `CloudflareTransport` uses Node's built-in `fetch` to send through Cloudflare's REST API.
93
97
 
94
98
  ```ts
95
99
  const [message] = transport.messages
@@ -97,3 +101,81 @@ const [message] = transport.messages
97
101
  console.log(message.to)
98
102
  console.log(message.body)
99
103
  ```
104
+
105
+ ## Delivery Outcomes
106
+
107
+ Every transport returns the shared `SentMessage` type, exported from `@Typetron/Mail`. In addition to the original message details,
108
+ it has optional `messageId`, `delivered`, `queued`, `permanentBounces`, and `suppressedRecipients` fields.
109
+
110
+ Providers populate only the information they report. An `undefined` address array means the outcome was not reported; an empty array
111
+ means the provider reported no recipients with that outcome. A successful send means the transport accepted the request, and does not
112
+ guarantee delivery to every recipient. Outcomes describe the send response and are not updated later.
113
+
114
+ Cloudflare reports delivery, queue, and permanent bounce address arrays, plus suppressed recipients and a message ID when provided.
115
+ SendGrid exposes its [X-Message-ID response header](https://www.twilio.com/docs/sendgrid/glossary/x-message-id) as `messageId`,
116
+ leaving delivery outcomes undefined. Memory transport leaves all delivery metadata undefined.
117
+
118
+ ```ts
119
+ const sent = await mail.to('john@example.com').subject('Welcome').send('Welcome!')
120
+ if (sent.permanentBounces?.length) {
121
+ console.warn('Recipients bounced:', sent.permanentBounces)
122
+ }
123
+ ```
124
+
125
+ ## Cloudflare
126
+
127
+ Configure a Cloudflare account ID, an API token with email sending permission, and a sender on a domain configured for
128
+ [Cloudflare Email Service](https://developers.cloudflare.com/email-service/get-started/send-emails/):
129
+
130
+ ```ts
131
+ import { MailConfig } from '@Typetron/Framework'
132
+
133
+ export default new MailConfig({
134
+ default: 'Cloudflare',
135
+ from: {email: 'hello@example.com', name: 'Example'},
136
+ mailers: {
137
+ memory: {},
138
+ Cloudflare: {
139
+ accountId: process.env.CLOUDFLARE_ACCOUNT_ID!,
140
+ apiToken: process.env.CLOUDFLARE_API_TOKEN!,
141
+ },
142
+ },
143
+ })
144
+ ```
145
+
146
+ Registration throws `MailError` if either credential is missing or blank. For manual setup, use
147
+ `new CloudflareTransport({accountId, apiToken})` from `@Typetron/Mail` and pass it to `Mailer`.
148
+
149
+ A string body is sent as HTML, matching SendGrid. An `{html, text}` body sends both alternatives. Strings, named addresses, and address
150
+ arrays on `Mailable` are converted to Cloudflare's REST format for the sender, recipients, CC, BCC, and reply-to fields.
151
+
152
+ Delivery outcomes are available on the shared `SentMessage`; queued recipients may be delivered later. A successful API response
153
+ resolves even if some or all recipients permanently bounced or were suppressed.
154
+
155
+ Each send makes one request. The transport does not automatically retry failed or ambiguous requests, since an email may have already
156
+ been accepted before a network failure. Applications decide whether to retry.
157
+
158
+ ## Delivery Errors
159
+
160
+ Cloudflare and SendGrid throw `MailError` for API rejections and network failures. `provider` identifies the service, `status` contains
161
+ the upstream HTTP status when available, `context` holds provider-specific response details, and `cause` preserves an underlying error
162
+ when available. Cloudflare also throws `MailError` for malformed responses. A network failure leaves delivery uncertain.
163
+
164
+ For Cloudflare API rejections, `context` contains the response envelope, including its `errors` array. For non-JSON responses, it
165
+ contains the response text. For SendGrid API rejections, it contains `error.response.body`.
166
+
167
+ ```ts
168
+ import { MailError } from '@Typetron/Mail'
169
+
170
+ try {
171
+ await mail.to('john@example.com').send('Hello')
172
+ } catch (error) {
173
+ if (error instanceof MailError) {
174
+ console.error(error.provider, error.status, error.context)
175
+ }
176
+ throw error
177
+ }
178
+ ```
179
+
180
+ SendGrid failures now throw `MailError` instead of Router's `HttpError`. Applications choose how to translate provider failures into
181
+ their own HTTP responses.
package/Storage/Readme.md CHANGED
@@ -57,7 +57,6 @@ export default new StorageConfig({
57
57
  AWS disks use the SDK's default credential chain when `credentials` is omitted. The S3 driver is loaded only when an S3 disk is resolved;
58
58
  applications using it must install `@aws-sdk/client-s3` and `@aws-sdk/s3-request-presigner`.
59
59
 
60
-
61
60
  Local disks refuse keys that pass through a symbolic link inside the root and throw `StorageSymbolicLink`, so a link
62
61
  created in the disk can't redirect reads or writes outside of it.
63
62
 
@@ -1,4 +1,5 @@
1
1
  import { BaseConfig } from './BaseConfig';
2
+ import type { CloudflareTransportConfig } from '@Typetron/Mail';
2
3
  export type Mailers = keyof MailConfig['mailers'];
3
4
  export declare class MailConfig extends BaseConfig<MailConfig> {
4
5
  default: Mailers;
@@ -11,6 +12,7 @@ export declare class MailConfig extends BaseConfig<MailConfig> {
11
12
  SendGrid?: {
12
13
  key: string;
13
14
  };
15
+ Cloudflare?: CloudflareTransportConfig;
14
16
  SES?: {};
15
17
  Mailgun?: {};
16
18
  Postmark?: {};
@@ -1 +1 @@
1
- {"version":3,"file":"MailConfig.d.ts","sourceRoot":"","sources":["../../../Framework/Config/MailConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,MAAM,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,CAAA;AAEjD,qBAAa,UAAW,SAAQ,UAAU,CAAC,UAAU,CAAC;IAClD,OAAO,EAAE,OAAO,CAA6C;IAE7D,IAAI,EAAE;QACF,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;KACjB,CAAA;IAED,OAAO,EAAE;QACL,MAAM,EAAE,GAAG,CAAC;QAEZ,QAAQ,CAAC,EAAE;YACP,GAAG,EAAE,MAAM,CAAC;SACf,CAAC;QACF,GAAG,CAAC,EAAE,EAEL,CAAC;QACF,OAAO,CAAC,EAAE,EAET,CAAC;QACF,QAAQ,CAAC,EAAE,EAEV,CAAC;KAEL,CAAA;CACJ"}
1
+ {"version":3,"file":"MailConfig.d.ts","sourceRoot":"","sources":["../../../Framework/Config/MailConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAA;AAE/D,MAAM,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,CAAA;AAEjD,qBAAa,UAAW,SAAQ,UAAU,CAAC,UAAU,CAAC;IAClD,OAAO,EAAE,OAAO,CAA6C;IAE7D,IAAI,EAAE;QACF,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;KACjB,CAAA;IAED,OAAO,EAAE;QACL,MAAM,EAAE,GAAG,CAAC;QAEZ,QAAQ,CAAC,EAAE;YACP,GAAG,EAAE,MAAM,CAAC;SACf,CAAC;QACF,UAAU,CAAC,EAAE,yBAAyB,CAAC;QACvC,GAAG,CAAC,EAAE,EAEL,CAAC;QACF,OAAO,CAAC,EAAE,EAET,CAAC;QACF,QAAQ,CAAC,EAAE,EAEV,CAAC;KAEL,CAAA;CACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"MailConfig.js","sourceRoot":"","sources":["../../../Framework/Config/MailConfig.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAIzC,MAAa,UAAW,SAAQ,uBAAsB;IAClD,OAAO,GAAY,OAAO,CAAC,GAAG,EAAE,MAAiB,IAAI,QAAQ,CAAA;IAE7D,IAAI,CAGH;IAED,OAAO,CAgBN;CACJ;AAzBD,gCAyBC"}
1
+ {"version":3,"file":"MailConfig.js","sourceRoot":"","sources":["../../../Framework/Config/MailConfig.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAKzC,MAAa,UAAW,SAAQ,uBAAsB;IAClD,OAAO,GAAY,OAAO,CAAC,GAAG,EAAE,MAAiB,IAAI,QAAQ,CAAA;IAE7D,IAAI,CAGH;IAED,OAAO,CAiBN;CACJ;AA1BD,gCA0BC"}
@@ -1 +1 @@
1
- {"version":3,"file":"MailProvider.d.ts","sourceRoot":"","sources":["../../../Framework/Providers/MailProvider.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,UAAU,EAAW,MAAM,WAAW,CAAA;AAkB/C,qBAAa,YAAa,SAAQ,QAAQ;IAEtC,MAAM,EAAE,UAAU,CAAA;IAEX,QAAQ;CAIlB"}
1
+ {"version":3,"file":"MailProvider.d.ts","sourceRoot":"","sources":["../../../Framework/Providers/MailProvider.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,UAAU,EAAW,MAAM,WAAW,CAAA;AAyB/C,qBAAa,YAAa,SAAQ,QAAQ;IAEtC,MAAM,EAAE,UAAU,CAAA;IAEX,QAAQ;CAIlB"}
@@ -20,11 +20,18 @@ const mailers = {
20
20
  return new Mail_1.MemoryTransport();
21
21
  },
22
22
  SendGrid: (app, config) => {
23
- if (!config.mailers.SendGrid?.key) {
24
- throw new Error('SendGrid key is not set');
23
+ if (!config.mailers?.SendGrid?.key) {
24
+ throw new Mail_1.MailError('SendGrid key is not set', { provider: 'SendGrid' });
25
25
  }
26
26
  return new SendGridTransport_1.SendGridTransport(config.mailers.SendGrid?.key);
27
27
  },
28
+ Cloudflare: (app, config) => {
29
+ const options = config.mailers?.Cloudflare;
30
+ if (!options) {
31
+ throw new Mail_1.MailError('Cloudflare accountId and apiToken are required', { provider: 'Cloudflare' });
32
+ }
33
+ return new Mail_1.CloudflareTransport(options);
34
+ },
28
35
  };
29
36
  class MailProvider extends Provider_1.Provider {
30
37
  config;
@@ -1 +1 @@
1
- {"version":3,"file":"MailProvider.js","sourceRoot":"","sources":["../../../Framework/Providers/MailProvider.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;;;;;;;;;;;;AAEZ,mDAAuD;AACvD,0CAAsC;AACtC,sCAA+C;AAC/C,yCAAwD;AAExD,mFAA+E;AAE/E,MAAM,OAAO,GAAgE;IACzE,MAAM,EAAE,CAAC,GAAc,EAAE,MAAkB,EAAE,EAAE;QAC3C,OAAO,IAAI,sBAAe,EAAE,CAAA;IAChC,CAAC;IACD,QAAQ,EAAE,CAAC,GAAc,EAAE,MAAkB,EAAE,EAAE;QAC7C,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;QAC9C,CAAC;QAED,OAAO,IAAI,qCAAiB,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,GA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AAI,CAAC,OAAO,EAAE,CAAC;YACX,MAAM,IAAI,gBAAS,CAAC,gDAAgD,EAAE,EAAC,QAAQ,EAAE,YAAY,EAAC,CAAC,CAAA;QACnG,CAAC;QACD,OAAO,IAAI,0BAAmB,CAAC,OAAO,CAAC,CAAA;IAC3C,CAAC;CACJ,CAAA;AAED,MAAa,YAAa,SAAQ,mBAAQ;IAEtC,MAAM,CAAY;IAEX,QAAQ;QACX,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QACvE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,aAAM,EAAE,IAAI,aAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAA;IACjE,CAAC;CACJ;AARD,oCAQC;AANG;IADC,IAAA,kBAAM,GAAE;8BACD,mBAAU;4CAAA"}
@@ -0,0 +1,12 @@
1
+ export interface MailErrorOptions extends ErrorOptions {
2
+ provider: string;
3
+ status?: number;
4
+ context?: unknown;
5
+ }
6
+ export declare class MailError extends Error {
7
+ readonly provider: string;
8
+ readonly status?: number;
9
+ readonly context?: unknown;
10
+ constructor(message: string, options: MailErrorOptions);
11
+ }
12
+ //# sourceMappingURL=MailError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MailError.d.ts","sourceRoot":"","sources":["../../Mail/MailError.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IAClD,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,qBAAa,SAAU,SAAQ,KAAK;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;gBAEd,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB;CAOzD"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MailError = void 0;
4
+ class MailError extends Error {
5
+ provider;
6
+ status;
7
+ context;
8
+ constructor(message, options) {
9
+ super(message, { cause: options.cause });
10
+ this.name = 'MailError';
11
+ this.provider = options.provider;
12
+ this.status = options.status;
13
+ this.context = options.context;
14
+ }
15
+ }
16
+ exports.MailError = MailError;
17
+ //# sourceMappingURL=MailError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MailError.js","sourceRoot":"","sources":["../../Mail/MailError.ts"],"names":[],"mappings":";;;AAMA,MAAa,SAAU,SAAQ,KAAK;IACvB,QAAQ,CAAQ;IAChB,MAAM,CAAS;IACf,OAAO,CAAU;IAE1B,YAAY,OAAe,EAAE,OAAyB;QAClD,KAAK,CAAC,OAAO,EAAE,EAAC,KAAK,EAAE,OAAO,CAAC,KAAK,EAAC,CAAC,CAAA;QACtC,IAAI,CAAC,IAAI,GAAG,WAAW,CAAA;QACvB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;QAChC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;IAClC,CAAC;CACJ;AAZD,8BAYC"}
@@ -11,6 +11,11 @@ export declare class SentMessage {
11
11
  readonly replyTo?: string | MailAddress | (string | MailAddress)[];
12
12
  readonly cc?: string | MailAddress | (string | MailAddress)[];
13
13
  readonly bcc?: string | MailAddress | (string | MailAddress)[];
14
+ messageId?: string;
15
+ delivered?: string[];
16
+ queued?: string[];
17
+ permanentBounces?: string[];
18
+ suppressedRecipients?: string[];
14
19
  constructor(mail: Mailable);
15
20
  }
16
21
  //# sourceMappingURL=SentMessage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SentMessage.d.ts","sourceRoot":"","sources":["../../Mail/SentMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAElD,qBAAa,WAAW;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAA;IACnC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,CAAA;IACrD,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,CAAC,MAAM,GAAG,WAAW,CAAC,EAAE,CAAA;IAC7D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,CAAC,MAAM,GAAG,WAAW,CAAC,EAAE,CAAA;IAClE,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,CAAC,MAAM,GAAG,WAAW,CAAC,EAAE,CAAA;IAC7D,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,CAAC,MAAM,GAAG,WAAW,CAAC,EAAE,CAAA;gBAElD,IAAI,EAAE,QAAQ;CAO7B"}
1
+ {"version":3,"file":"SentMessage.d.ts","sourceRoot":"","sources":["../../Mail/SentMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAElD,qBAAa,WAAW;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAA;IACnC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,CAAA;IACrD,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,CAAC,MAAM,GAAG,WAAW,CAAC,EAAE,CAAA;IAC7D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,CAAC,MAAM,GAAG,WAAW,CAAC,EAAE,CAAA;IAClE,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,CAAC,MAAM,GAAG,WAAW,CAAC,EAAE,CAAA;IAC7D,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,CAAC,MAAM,GAAG,WAAW,CAAC,EAAE,CAAA;IAE9D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAA;gBAEnB,IAAI,EAAE,QAAQ;CAO7B"}
@@ -9,6 +9,11 @@ class SentMessage {
9
9
  replyTo;
10
10
  cc;
11
11
  bcc;
12
+ messageId;
13
+ delivered;
14
+ queued;
15
+ permanentBounces;
16
+ suppressedRecipients;
12
17
  constructor(mail) {
13
18
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
14
19
  const { content, ...mailDetails } = mail;
@@ -1 +1 @@
1
- {"version":3,"file":"SentMessage.js","sourceRoot":"","sources":["../../Mail/SentMessage.ts"],"names":[],"mappings":";;;AAGA,MAAa,WAAW;IACX,IAAI,CAAsB;IAC1B,OAAO,CAAS;IAChB,IAAI,CAAwC;IAC5C,EAAE,CAAkD;IACpD,OAAO,CAAkD;IACzD,EAAE,CAAkD;IACpD,GAAG,CAAkD;IAE9D,YAAY,IAAc;QACtB,6DAA6D;QAC7D,MAAM,EAAC,OAAO,EAAE,GAAG,WAAW,EAAC,GAAG,IAAI,CAAA;QACtC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;QAChC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,IAAI,CAAA;IAC3C,CAAC;CAEJ;AAhBD,kCAgBC"}
1
+ {"version":3,"file":"SentMessage.js","sourceRoot":"","sources":["../../Mail/SentMessage.ts"],"names":[],"mappings":";;;AAGA,MAAa,WAAW;IACX,IAAI,CAAsB;IAC1B,OAAO,CAAS;IAChB,IAAI,CAAwC;IAC5C,EAAE,CAAkD;IACpD,OAAO,CAAkD;IACzD,EAAE,CAAkD;IACpD,GAAG,CAAkD;IAE9D,SAAS,CAAS;IAClB,SAAS,CAAW;IACpB,MAAM,CAAW;IACjB,gBAAgB,CAAW;IAC3B,oBAAoB,CAAW;IAE/B,YAAY,IAAc;QACtB,6DAA6D;QAC7D,MAAM,EAAC,OAAO,EAAE,GAAG,WAAW,EAAC,GAAG,IAAI,CAAA;QACtC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;QAChC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,IAAI,CAAA;IAC3C,CAAC;CAEJ;AAtBD,kCAsBC"}
@@ -0,0 +1,13 @@
1
+ import { Mailable } from '../Mailable';
2
+ import { MailTransport } from '../MailTransport';
3
+ import { SentMessage } from '../SentMessage';
4
+ export interface CloudflareTransportConfig {
5
+ accountId: string;
6
+ apiToken: string;
7
+ }
8
+ export declare class CloudflareTransport extends MailTransport {
9
+ private config;
10
+ constructor(config: CloudflareTransportConfig);
11
+ send(message: Mailable): Promise<SentMessage>;
12
+ }
13
+ //# sourceMappingURL=CloudflareTransport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CloudflareTransport.d.ts","sourceRoot":"","sources":["../../../Mail/Transports/CloudflareTransport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,MAAM,WAAW,yBAAyB;IACtC,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;CACnB;AAUD,qBAAa,mBAAoB,SAAQ,aAAa;IACtC,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,yBAAyB;IAO/C,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC;CAoEtD"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CloudflareTransport = void 0;
4
+ const MailError_1 = require("../MailError");
5
+ const MailTransport_1 = require("../MailTransport");
6
+ const SentMessage_1 = require("../SentMessage");
7
+ function address(value) {
8
+ return typeof value === 'string' ? value : { address: value.email, name: value.name };
9
+ }
10
+ function addresses(value) {
11
+ return Array.isArray(value) ? value.map(address) : value === undefined ? undefined : address(value);
12
+ }
13
+ class CloudflareTransport extends MailTransport_1.MailTransport {
14
+ config;
15
+ constructor(config) {
16
+ super();
17
+ this.config = config;
18
+ if (!config.accountId?.trim() || !config.apiToken?.trim()) {
19
+ throw new MailError_1.MailError('Cloudflare accountId and apiToken are required', { provider: 'Cloudflare' });
20
+ }
21
+ }
22
+ async send(message) {
23
+ const sentMessage = new SentMessage_1.SentMessage(message);
24
+ const content = typeof sentMessage.body === 'string' ? { html: sentMessage.body } : sentMessage.body;
25
+ let response;
26
+ let body;
27
+ try {
28
+ response = await globalThis.fetch(`https://api.cloudflare.com/client/v4/accounts/${encodeURIComponent(this.config.accountId)}/email/sending/send`, {
29
+ method: 'POST',
30
+ headers: {
31
+ Authorization: `Bearer ${this.config.apiToken}`,
32
+ 'Content-Type': 'application/json',
33
+ },
34
+ body: JSON.stringify({
35
+ from: address(sentMessage.from),
36
+ to: addresses(sentMessage.to),
37
+ cc: addresses(sentMessage.cc),
38
+ bcc: addresses(sentMessage.bcc),
39
+ reply_to: addresses(sentMessage.replyTo),
40
+ subject: sentMessage.subject,
41
+ ...content,
42
+ }),
43
+ });
44
+ }
45
+ catch (cause) {
46
+ throw new MailError_1.MailError('Cloudflare mail request failed', { provider: 'Cloudflare', cause });
47
+ }
48
+ try {
49
+ body = await response.text();
50
+ }
51
+ catch (cause) {
52
+ throw new MailError_1.MailError('Could not read Cloudflare mail response', { provider: 'Cloudflare', status: response.status, cause });
53
+ }
54
+ let data;
55
+ try {
56
+ data = JSON.parse(body);
57
+ }
58
+ catch (cause) {
59
+ throw new MailError_1.MailError('Cloudflare returned an invalid mail response', {
60
+ provider: 'Cloudflare', status: response.status, context: body, cause,
61
+ });
62
+ }
63
+ if (!response.ok || data?.success !== true) {
64
+ throw new MailError_1.MailError('Cloudflare rejected the mail request', {
65
+ provider: 'Cloudflare', status: response.status, context: data,
66
+ });
67
+ }
68
+ const result = data.result;
69
+ const isAddresses = (value) => Array.isArray(value) && value.every(item => typeof item === 'string');
70
+ if (!result || !isAddresses(result.delivered) || !isAddresses(result.queued) || !isAddresses(result.permanent_bounces)
71
+ || (result.suppressed_recipients !== undefined && !isAddresses(result.suppressed_recipients))
72
+ || (result.message_id !== undefined && typeof result.message_id !== 'string')) {
73
+ throw new MailError_1.MailError('Cloudflare returned an invalid mail delivery result', {
74
+ provider: 'Cloudflare', status: response.status, context: data,
75
+ });
76
+ }
77
+ sentMessage.delivered = result.delivered;
78
+ sentMessage.queued = result.queued;
79
+ sentMessage.permanentBounces = result.permanent_bounces;
80
+ sentMessage.suppressedRecipients = result.suppressed_recipients;
81
+ sentMessage.messageId = result.message_id;
82
+ return sentMessage;
83
+ }
84
+ }
85
+ exports.CloudflareTransport = CloudflareTransport;
86
+ //# sourceMappingURL=CloudflareTransport.js.map
@@ -0,0 +1 @@
1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AED,WAAW,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAA;QACxC,WAAW,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAA;QAClC,WAAW,CAAC,gBAAgB,GAAG,MAAM,CAAC,iBAAiB,CAAA;QACvD,WAAW,CAAC,oBAAoB,GAAG,MAAM,CAAC,qBAAqB,CAAA;QAC/D,WAAW,CAAC,SAAS,GAAG,MAAM,CAAC,UAAU,CAAA;QACzC,OAAO,WAAW,CAAA;IACtB,CAAC;CACJ;AA5ED,kDA4EC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SendGridTransport.d.ts","sourceRoot":"","sources":["../../../Mail/Transports/SendGridTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAI5C,qBAAa,iBAAkB,SAAQ,aAAa;IAChD,QAAQ,EAAE,WAAW,EAAE,CAAK;IAG5B,MAAM,EAAE,UAAU,CAAA;gBAEN,GAAG,EAAE,MAAM;IAMjB,IAAI,CAAC,OAAO,EAAE,QAAQ;CA0E/B"}
1
+ {"version":3,"file":"SendGridTransport.d.ts","sourceRoot":"","sources":["../../../Mail/Transports/SendGridTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAI5C,qBAAa,iBAAkB,SAAQ,aAAa;IAChD,QAAQ,EAAE,WAAW,EAAE,CAAK;IAG5B,MAAM,EAAE,UAAU,CAAA;gBAEN,GAAG,EAAE,MAAM;IAMjB,IAAI,CAAC,OAAO,EAAE,QAAQ;CAsF/B"}
@@ -18,7 +18,7 @@ const SentMessage_1 = require("../SentMessage");
18
18
  const Container_1 = require("../../Container");
19
19
  const Framework_1 = require("../../Framework");
20
20
  const mail_1 = __importDefault(require("@sendgrid/mail"));
21
- const Http_1 = require("@Typetron/Router/Http");
21
+ const MailError_1 = require("../MailError");
22
22
  class SendGridTransport extends MailTransport_1.MailTransport {
23
23
  messages = [];
24
24
  config;
@@ -94,7 +94,18 @@ class SendGridTransport extends MailTransport_1.MailTransport {
94
94
  };
95
95
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
96
96
  /* @ts-ignore */ // SendGrid has TS issues
97
- await mail_1.default.send(sendGridMessage).catch(error => { throw new Http_1.HttpError(error.response.body.errors, error.code); });
97
+ const [response] = await mail_1.default.send(sendGridMessage).catch(error => {
98
+ throw new MailError_1.MailError('SendGrid mail request failed', {
99
+ provider: 'SendGrid',
100
+ status: typeof error.code === 'number' ? error.code : undefined,
101
+ context: error.response?.body,
102
+ cause: error,
103
+ });
104
+ });
105
+ const messageId = response.headers['x-message-id'];
106
+ if (typeof messageId === 'string') {
107
+ sentMessage.messageId = messageId;
108
+ }
98
109
  return sentMessage;
99
110
  }
100
111
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SendGridTransport.js","sourceRoot":"","sources":["../../../Mail/Transports/SendGridTransport.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAgD;AAChD,gDAA4C;AAE5C,+CAAwC;AACxC,+CAA4C;AAC5C,0DAAmC;AACnC,gDAAiD;AAEjD,MAAa,iBAAkB,SAAQ,6BAAa;IAChD,QAAQ,GAAkB,EAAE,CAAA;IAG5B,MAAM,CAAY;IAElB,YAAY,GAAW;QACnB,KAAK,EAAE,CAAA;QAEP,cAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;IACzB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAAiB;QACxB,MA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C,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA,CAAA,CAAC,CAAC,CAAA;QAEhH,OAAO,WAAW,CAAA;IACtB,CAAC;CACJ;AAtFD,8CAsFC;AAlFG;IADC,IAAA,kBAAM,GAAE;8BACD,sBAAU;iDAAA"}
1
+ {"version":3,"file":"SendGridTransport.js","sourceRoot":"","sources":["../../../Mail/Transports/SendGridTransport.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAgD;AAChD,gDAA4C;AAE5C,+CAAwC;AACxC,+CAA4C;AAC5C,0DAAmC;AACnC,4CAAwC;AAExC,MAAa,iBAAkB,SAAQ,6BAAa;IAChD,QAAQ,GAAkB,EAAE,CAAA;IAG5B,MAAM,CAAY;IAElB,YAAY,GAAW;QACnB,KAAK,EAAE,CAAA;QAEP,cAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;IACzB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAAiB;QACxB,MAAM,WAAW,GAAG,IAAI,yBAAW,CAAC,OAAO,CAAC,CAAA;QAE5C,MAAM,eAAe,GAAG;YACpB,gBAAgB,EAAE;gBACd;oBACI,EAAE,EAAE,WAAW,CAAC,EAAE;oBAClB,EAAE,EAAE,WAAW,CAAC,EAAE;oBAClB,GAAG,EAAE,WAAW,CAAC,GAAG;iBACvB;aACJ;YACD,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,OAAO,EAAE,WAAW,CAAC,OAAO;YAC5B,OAAO,EAAE,WAAW,CAAC,OAAO;YAC5B,OAAO,EAAE;gBACL;oBACI,IAAI,EAAE,WAAW;oBACjB,KAAK,EAAE,WAAW,CAAC,IAAI;iBAC1B;aACJ;YACD,iBAAiB;YACjB,QAAQ;YACR,2HAA2H;YAC3H,kCAAkC;YAClC,6BAA6B;YAC7B,oCAAoC;YACpC,QAAQ;YACR,KAAK;YACL,gBAAgB;YAChB,cAAc;YACd,aAAa;YACb,eAAe;YACf,K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1
  export * from './Transports/MemoryTransport';
2
+ export * from './Transports/CloudflareTransport';
3
+ export * from './SentMessage';
4
+ export * from './MailError';
2
5
  export * from './Mailer';
3
6
  export * from './Mailable';
4
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../Mail/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAA;AAC5C,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../Mail/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAA;AAC5C,cAAc,kCAAkC,CAAA;AAChD,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA"}
@@ -15,6 +15,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Transports/MemoryTransport"), exports);
18
+ __exportStar(require("./Transports/CloudflareTransport"), exports);
19
+ __exportStar(require("./SentMessage"), exports);
20
+ __exportStar(require("./MailError"), exports);
18
21
  __exportStar(require("./Mailer"), exports);
19
22
  __exportStar(require("./Mailable"), exports);
20
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../Mail/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA4C;AAC5C,2CAAwB;AACxB,6CAA0B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../Mail/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA4C;AAC5C,mEAAgD;AAChD,gDAA6B;AAC7B,8CAA2B;AAC3B,2CAAwB;AACxB,6CAA0B"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typetron/framework",
3
3
  "description": "Modern Node.js framework for modern apps written in Typescript",
4
4
  "license": "MIT",
5
- "version": "0.5.35",
5
+ "version": "0.5.36",
6
6
  "keywords": [
7
7
  "typetron",
8
8
  "framework",