@web-ts-toolkit/email-service 0.0.0-stage → 0.73.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,91 @@
1
1
  {
2
2
  "name": "@web-ts-toolkit/email-service",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "description": "Typed email preparation, queue and submission contracts for Node.js",
4
+ "version": "0.73.0",
5
+ "keywords": [
6
+ "email",
7
+ "handlebars",
8
+ "smtp",
9
+ "sendgrid",
10
+ "queue"
11
+ ],
12
+ "type": "commonjs",
13
+ "sideEffects": false,
14
+ "main": "./index.js",
15
+ "module": "./index.mjs",
16
+ "types": "./index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "types": {
20
+ "import": "./index.d.mts",
21
+ "require": "./index.d.ts",
22
+ "default": "./index.d.ts"
23
+ },
24
+ "import": "./index.mjs",
25
+ "require": "./index.js",
26
+ "default": "./index.js"
27
+ },
28
+ "./smtp": {
29
+ "types": {
30
+ "import": "./smtp.d.mts",
31
+ "require": "./smtp.d.ts",
32
+ "default": "./smtp.d.ts"
33
+ },
34
+ "import": "./smtp.mjs",
35
+ "require": "./smtp.js",
36
+ "default": "./smtp.js"
37
+ },
38
+ "./sendgrid": {
39
+ "types": {
40
+ "import": "./sendgrid.d.mts",
41
+ "require": "./sendgrid.d.ts",
42
+ "default": "./sendgrid.d.ts"
43
+ },
44
+ "import": "./sendgrid.mjs",
45
+ "require": "./sendgrid.js",
46
+ "default": "./sendgrid.js"
47
+ },
48
+ "./mongoose": {
49
+ "types": {
50
+ "import": "./mongoose.d.mts",
51
+ "require": "./mongoose.d.ts",
52
+ "default": "./mongoose.d.ts"
53
+ },
54
+ "import": "./mongoose.mjs",
55
+ "require": "./mongoose.js",
56
+ "default": "./mongoose.js"
57
+ }
58
+ },
59
+ "engines": {
60
+ "node": ">=24"
61
+ },
62
+ "peerDependencies": {
63
+ "mongoose": ">=9.12.2 <10",
64
+ "nodemailer": ">=10.6.0 <11"
65
+ },
66
+ "peerDependenciesMeta": {
67
+ "mongoose": {
68
+ "optional": true
69
+ },
70
+ "nodemailer": {
71
+ "optional": true
72
+ }
73
+ },
74
+ "dependencies": {
75
+ "handlebars": "~4.7.10"
76
+ },
77
+ "files": [
78
+ "**/*",
79
+ "!**/*.map"
80
+ ],
81
+ "author": "Junmin Ahn",
82
+ "bugs": {
83
+ "url": "https://github.com/egose/web-ts-toolkit/issues"
84
+ },
85
+ "license": "Apache-2.0",
86
+ "repository": {
87
+ "type": "git",
88
+ "url": "git+https://github.com/egose/web-ts-toolkit.git",
89
+ "directory": "packages/email-service"
90
+ }
91
+ }
@@ -0,0 +1,199 @@
1
+ /** Integer UTC epoch milliseconds, from 0 through 253402300799999 inclusive. */
2
+ type UnixMs = number;
3
+ /** Application/tenant namespace. It is not a credential or a substitute for host authorization. */
4
+ type EmailScope = string;
5
+ type EmailJobId = string;
6
+ type EmailAttemptId = string;
7
+ type Awaitable<T> = T | PromiseLike<T>;
8
+ /**
9
+ * Trusted live SMTP opt-in. Pass the same tuple at each factory in the queue; omit it for V1 (50 recipients).
10
+ * `namespace` is a canonical lowercase UUIDv4 for one logical backing. Keep its cap fixed; use a new namespace
11
+ * to change it. `maxRecipients` is an integer from 51 to 1,000, counting To, Cc and Bcc together.
12
+ * `format` selects storage, not the DTO's `version: 1`. Never select the binding from request data.
13
+ */
14
+ type SmtpCapacity = Readonly<{
15
+ format: 'smtp-v2';
16
+ namespace: string;
17
+ maxRecipients: number;
18
+ }>;
19
+ /** Plain JSON at the validation boundary; this type alone does not check serialization or size. */
20
+ type JsonValue = null | boolean | number | string | readonly JsonValue[] | JsonObject;
21
+ type JsonObject = {
22
+ readonly [key: string]: JsonValue;
23
+ };
24
+ /** Bounded opaque host tokens only: do not include addresses, other personal data, or secrets. */
25
+ type Correlation = Readonly<Record<string, string>>;
26
+ type Mailbox = {
27
+ readonly address: string;
28
+ readonly name?: string;
29
+ };
30
+ /** Preserve recipient grouping and order; SMTP, unlike SendGrid, can use only Cc/Bcc. */
31
+ type EmailEnvelope = {
32
+ readonly from: Mailbox;
33
+ readonly to: readonly Mailbox[];
34
+ readonly cc: readonly Mailbox[];
35
+ readonly bcc: readonly Mailbox[];
36
+ readonly replyTo?: Mailbox;
37
+ };
38
+ type ProviderRef = {
39
+ readonly kind: 'smtp';
40
+ readonly key: string;
41
+ readonly mode: 'live';
42
+ } | {
43
+ readonly kind: 'sendgrid';
44
+ readonly key: string;
45
+ readonly mode: 'live' | 'sandbox';
46
+ };
47
+ type EmailAdmissionKey = {
48
+ readonly kind: 'single';
49
+ readonly idempotencyKey: string;
50
+ } | {
51
+ readonly kind: 'batch';
52
+ readonly batchId: string;
53
+ readonly itemId: string;
54
+ };
55
+ type TemplateIdentity = {
56
+ readonly key: string;
57
+ readonly revision: string;
58
+ };
59
+ /** A versioned, integrity-checked reference in a trusted host resolver, not a filesystem path or URL. */
60
+ type AttachmentRef = {
61
+ readonly resolverKey: string;
62
+ readonly id: string;
63
+ readonly version: string;
64
+ readonly filename: string;
65
+ readonly contentType: string;
66
+ readonly byteLength: number;
67
+ readonly sha256: string;
68
+ };
69
+ type AttachmentResolution = {
70
+ readonly status: 'found';
71
+ readonly bytes: Uint8Array;
72
+ } | {
73
+ readonly status: 'unavailable';
74
+ };
75
+ /** Resolve a queued reference before handoff; a mutable source may no longer have the required version. */
76
+ type AttachmentResolver = (ref: Readonly<AttachmentRef>, context: {
77
+ scope: EmailScope;
78
+ signal: AbortSignal;
79
+ }) => Awaitable<AttachmentResolution>;
80
+ /** Copied bytes for one attempt; only the reference is part of the durable snapshot. */
81
+ type ResolvedAttachment = {
82
+ readonly ref: Readonly<AttachmentRef>;
83
+ readonly bytes: Uint8Array;
84
+ };
85
+ type SnapshotFields = {
86
+ readonly version: 1;
87
+ readonly template: TemplateIdentity;
88
+ readonly envelope: EmailEnvelope;
89
+ readonly preparedAt: UnixMs;
90
+ readonly expiresAt: UnixMs;
91
+ readonly priority: number;
92
+ readonly attachments: readonly AttachmentRef[];
93
+ readonly correlation: Correlation;
94
+ };
95
+ /** Frozen sending data for retries. Treat it as sensitive; SendGrid's active remote version is not pinned. */
96
+ type EmailSnapshot = SnapshotFields & ({
97
+ readonly kind: 'smtp';
98
+ readonly provider: Extract<ProviderRef, {
99
+ kind: 'smtp';
100
+ }>;
101
+ readonly smtpCapacity?: SmtpCapacity;
102
+ readonly subject: string;
103
+ readonly html?: string;
104
+ readonly text?: string;
105
+ } | {
106
+ readonly kind: 'sendgrid';
107
+ readonly provider: Extract<ProviderRef, {
108
+ kind: 'sendgrid';
109
+ }>;
110
+ readonly smtpCapacity?: never;
111
+ readonly templateId: string;
112
+ readonly data: JsonObject;
113
+ });
114
+ /** Versioned, sensitive outbox value. Store it with the host's business write, then relay it unchanged. */
115
+ type PreparedEmailCommand = {
116
+ readonly version: 1;
117
+ /** Present on every staged message from an opted-in SMTP lane, even below 51 recipients. */
118
+ readonly smtpCapacity?: SmtpCapacity;
119
+ readonly scope: EmailScope;
120
+ readonly key: EmailAdmissionKey;
121
+ readonly scheduleAt: UnixMs | null;
122
+ readonly intentHash: string;
123
+ readonly fingerprint: string;
124
+ readonly snapshotHash: string;
125
+ readonly snapshot: EmailSnapshot;
126
+ };
127
+ /** Timeout values are elapsed integer milliseconds, not wall-clock instants. */
128
+ type CallOptions = {
129
+ signal?: AbortSignal;
130
+ timeoutMs?: number;
131
+ };
132
+ interface EmailClock {
133
+ now(): UnixMs;
134
+ monotonicNow(): number;
135
+ sleep(ms: number, signal: AbortSignal): Promise<void>;
136
+ }
137
+
138
+ /** Outcome of submission only, never an inbox-delivery receipt. Sandbox is `validated`, not `accepted`. */
139
+ type SubmissionOutcome = 'unsubmitted' | 'accepted' | 'partially_accepted' | 'rejected' | 'unknown' | 'validated';
140
+ /** Only established transient nonacceptance/unsubmitted evidence may be safe to retry. */
141
+ type RetryClass = 'never' | 'safe_transient';
142
+ type SubmissionStage = 'pre_handoff' | 'attachment' | 'rate_limit' | 'connect' | 'tls' | 'auth' | 'envelope' | 'data' | 'http';
143
+ /** Zero-based index in the frozen group; no addresses. SendGrid provides no synchronous recipient results. */
144
+ type RecipientResult = {
145
+ readonly group: 'to' | 'cc' | 'bcc';
146
+ readonly index: number;
147
+ readonly status: 'accepted' | 'rejected';
148
+ };
149
+ /** Either or both; apply the later safe retry floor without arithmetic overflow. */
150
+ type RetryHint = {
151
+ readonly delayMs?: number;
152
+ readonly notBefore?: UnixMs;
153
+ };
154
+ /** Normalized, bounded evidence; never a raw SDK code or response message. */
155
+ type ProviderReason = 'smtp_accepted' | 'smtp_partial' | 'smtp_transient_reply' | 'smtp_permanent_reply' | 'sendgrid_accepted' | 'sendgrid_validated' | 'sendgrid_throttled' | 'sendgrid_rejected' | 'not_transmitted' | 'provider_configuration' | 'transport_uncertain' | 'provider_timeout' | 'provider_aborted';
156
+ type AttemptReason = ProviderReason | 'attachment_unavailable' | 'attachment_timeout' | 'attachment_invalid' | 'attachment_resolver_error' | 'rate_deferred' | 'rate_timeout' | 'rate_error' | 'profile_unavailable' | 'provider_preflight_error' | 'pre_handoff_timeout' | 'worker_stopped' | 'pre_handoff_lease_expired' | 'launch_window_closed' | 'post_handoff_lease_expired' | 'expired' | 'cancelled';
157
+ type AttemptResult = {
158
+ readonly outcome: SubmissionOutcome;
159
+ readonly retry: RetryClass;
160
+ readonly stage: SubmissionStage;
161
+ readonly reason: AttemptReason;
162
+ readonly retryHint?: RetryHint;
163
+ readonly recipients?: readonly RecipientResult[];
164
+ readonly messageId?: string;
165
+ readonly providerMessageId?: string;
166
+ };
167
+ type ProviderResult = Omit<AttemptResult, 'stage' | 'reason'> & {
168
+ readonly stage: Exclude<SubmissionStage, 'pre_handoff' | 'attachment' | 'rate_limit'>;
169
+ readonly reason: ProviderReason;
170
+ };
171
+ type ProviderSubmission<M extends EmailSnapshot> = {
172
+ readonly jobId: EmailJobId;
173
+ readonly attemptId: EmailAttemptId;
174
+ readonly snapshot: M;
175
+ readonly attachments: readonly ResolvedAttachment[];
176
+ };
177
+ type ProviderCall = {
178
+ signal: AbortSignal;
179
+ timeoutMs: number;
180
+ };
181
+ type SmtpSnapshot = Extract<EmailSnapshot, {
182
+ kind: 'smtp';
183
+ }>;
184
+ type SendGridSnapshot = Extract<EmailSnapshot, {
185
+ kind: 'sendgrid';
186
+ }>;
187
+ interface PreparedEmailSubmission {
188
+ /** One-shot I/O. Settle only once cancellation/deadline handling makes further send I/O impossible. */
189
+ submit(context: ProviderCall): Promise<ProviderResult>;
190
+ }
191
+ interface EmailProvider<M extends EmailSnapshot> {
192
+ readonly ref: M['provider'];
193
+ readonly smtpCapacity?: SmtpCapacity;
194
+ /** Validate and prepare without I/O. Direct unmanaged submission has no queue or retry guarantees. */
195
+ prepare(input: ProviderSubmission<M>): PreparedEmailSubmission;
196
+ }
197
+ type ConfiguredEmailProvider = EmailProvider<SmtpSnapshot> | EmailProvider<SendGridSnapshot>;
198
+
199
+ export type { Awaitable as A, SubmissionOutcome as B, Correlation as C, SubmissionStage as D, EmailEnvelope as E, JsonObject as J, Mailbox as M, ProviderRef as P, RecipientResult as R, SmtpCapacity as S, TemplateIdentity as T, UnixMs as U, EmailScope as a, EmailAdmissionKey as b, AttachmentRef as c, JsonValue as d, CallOptions as e, PreparedEmailCommand as f, EmailClock as g, AttachmentResolution as h, AttachmentResolver as i, AttemptReason as j, AttemptResult as k, ConfiguredEmailProvider as l, EmailAttemptId as m, EmailJobId as n, EmailProvider as o, EmailSnapshot as p, PreparedEmailSubmission as q, ProviderCall as r, ProviderReason as s, ProviderResult as t, ProviderSubmission as u, ResolvedAttachment as v, RetryClass as w, RetryHint as x, SendGridSnapshot as y, SmtpSnapshot as z };
@@ -0,0 +1,199 @@
1
+ /** Integer UTC epoch milliseconds, from 0 through 253402300799999 inclusive. */
2
+ type UnixMs = number;
3
+ /** Application/tenant namespace. It is not a credential or a substitute for host authorization. */
4
+ type EmailScope = string;
5
+ type EmailJobId = string;
6
+ type EmailAttemptId = string;
7
+ type Awaitable<T> = T | PromiseLike<T>;
8
+ /**
9
+ * Trusted live SMTP opt-in. Pass the same tuple at each factory in the queue; omit it for V1 (50 recipients).
10
+ * `namespace` is a canonical lowercase UUIDv4 for one logical backing. Keep its cap fixed; use a new namespace
11
+ * to change it. `maxRecipients` is an integer from 51 to 1,000, counting To, Cc and Bcc together.
12
+ * `format` selects storage, not the DTO's `version: 1`. Never select the binding from request data.
13
+ */
14
+ type SmtpCapacity = Readonly<{
15
+ format: 'smtp-v2';
16
+ namespace: string;
17
+ maxRecipients: number;
18
+ }>;
19
+ /** Plain JSON at the validation boundary; this type alone does not check serialization or size. */
20
+ type JsonValue = null | boolean | number | string | readonly JsonValue[] | JsonObject;
21
+ type JsonObject = {
22
+ readonly [key: string]: JsonValue;
23
+ };
24
+ /** Bounded opaque host tokens only: do not include addresses, other personal data, or secrets. */
25
+ type Correlation = Readonly<Record<string, string>>;
26
+ type Mailbox = {
27
+ readonly address: string;
28
+ readonly name?: string;
29
+ };
30
+ /** Preserve recipient grouping and order; SMTP, unlike SendGrid, can use only Cc/Bcc. */
31
+ type EmailEnvelope = {
32
+ readonly from: Mailbox;
33
+ readonly to: readonly Mailbox[];
34
+ readonly cc: readonly Mailbox[];
35
+ readonly bcc: readonly Mailbox[];
36
+ readonly replyTo?: Mailbox;
37
+ };
38
+ type ProviderRef = {
39
+ readonly kind: 'smtp';
40
+ readonly key: string;
41
+ readonly mode: 'live';
42
+ } | {
43
+ readonly kind: 'sendgrid';
44
+ readonly key: string;
45
+ readonly mode: 'live' | 'sandbox';
46
+ };
47
+ type EmailAdmissionKey = {
48
+ readonly kind: 'single';
49
+ readonly idempotencyKey: string;
50
+ } | {
51
+ readonly kind: 'batch';
52
+ readonly batchId: string;
53
+ readonly itemId: string;
54
+ };
55
+ type TemplateIdentity = {
56
+ readonly key: string;
57
+ readonly revision: string;
58
+ };
59
+ /** A versioned, integrity-checked reference in a trusted host resolver, not a filesystem path or URL. */
60
+ type AttachmentRef = {
61
+ readonly resolverKey: string;
62
+ readonly id: string;
63
+ readonly version: string;
64
+ readonly filename: string;
65
+ readonly contentType: string;
66
+ readonly byteLength: number;
67
+ readonly sha256: string;
68
+ };
69
+ type AttachmentResolution = {
70
+ readonly status: 'found';
71
+ readonly bytes: Uint8Array;
72
+ } | {
73
+ readonly status: 'unavailable';
74
+ };
75
+ /** Resolve a queued reference before handoff; a mutable source may no longer have the required version. */
76
+ type AttachmentResolver = (ref: Readonly<AttachmentRef>, context: {
77
+ scope: EmailScope;
78
+ signal: AbortSignal;
79
+ }) => Awaitable<AttachmentResolution>;
80
+ /** Copied bytes for one attempt; only the reference is part of the durable snapshot. */
81
+ type ResolvedAttachment = {
82
+ readonly ref: Readonly<AttachmentRef>;
83
+ readonly bytes: Uint8Array;
84
+ };
85
+ type SnapshotFields = {
86
+ readonly version: 1;
87
+ readonly template: TemplateIdentity;
88
+ readonly envelope: EmailEnvelope;
89
+ readonly preparedAt: UnixMs;
90
+ readonly expiresAt: UnixMs;
91
+ readonly priority: number;
92
+ readonly attachments: readonly AttachmentRef[];
93
+ readonly correlation: Correlation;
94
+ };
95
+ /** Frozen sending data for retries. Treat it as sensitive; SendGrid's active remote version is not pinned. */
96
+ type EmailSnapshot = SnapshotFields & ({
97
+ readonly kind: 'smtp';
98
+ readonly provider: Extract<ProviderRef, {
99
+ kind: 'smtp';
100
+ }>;
101
+ readonly smtpCapacity?: SmtpCapacity;
102
+ readonly subject: string;
103
+ readonly html?: string;
104
+ readonly text?: string;
105
+ } | {
106
+ readonly kind: 'sendgrid';
107
+ readonly provider: Extract<ProviderRef, {
108
+ kind: 'sendgrid';
109
+ }>;
110
+ readonly smtpCapacity?: never;
111
+ readonly templateId: string;
112
+ readonly data: JsonObject;
113
+ });
114
+ /** Versioned, sensitive outbox value. Store it with the host's business write, then relay it unchanged. */
115
+ type PreparedEmailCommand = {
116
+ readonly version: 1;
117
+ /** Present on every staged message from an opted-in SMTP lane, even below 51 recipients. */
118
+ readonly smtpCapacity?: SmtpCapacity;
119
+ readonly scope: EmailScope;
120
+ readonly key: EmailAdmissionKey;
121
+ readonly scheduleAt: UnixMs | null;
122
+ readonly intentHash: string;
123
+ readonly fingerprint: string;
124
+ readonly snapshotHash: string;
125
+ readonly snapshot: EmailSnapshot;
126
+ };
127
+ /** Timeout values are elapsed integer milliseconds, not wall-clock instants. */
128
+ type CallOptions = {
129
+ signal?: AbortSignal;
130
+ timeoutMs?: number;
131
+ };
132
+ interface EmailClock {
133
+ now(): UnixMs;
134
+ monotonicNow(): number;
135
+ sleep(ms: number, signal: AbortSignal): Promise<void>;
136
+ }
137
+
138
+ /** Outcome of submission only, never an inbox-delivery receipt. Sandbox is `validated`, not `accepted`. */
139
+ type SubmissionOutcome = 'unsubmitted' | 'accepted' | 'partially_accepted' | 'rejected' | 'unknown' | 'validated';
140
+ /** Only established transient nonacceptance/unsubmitted evidence may be safe to retry. */
141
+ type RetryClass = 'never' | 'safe_transient';
142
+ type SubmissionStage = 'pre_handoff' | 'attachment' | 'rate_limit' | 'connect' | 'tls' | 'auth' | 'envelope' | 'data' | 'http';
143
+ /** Zero-based index in the frozen group; no addresses. SendGrid provides no synchronous recipient results. */
144
+ type RecipientResult = {
145
+ readonly group: 'to' | 'cc' | 'bcc';
146
+ readonly index: number;
147
+ readonly status: 'accepted' | 'rejected';
148
+ };
149
+ /** Either or both; apply the later safe retry floor without arithmetic overflow. */
150
+ type RetryHint = {
151
+ readonly delayMs?: number;
152
+ readonly notBefore?: UnixMs;
153
+ };
154
+ /** Normalized, bounded evidence; never a raw SDK code or response message. */
155
+ type ProviderReason = 'smtp_accepted' | 'smtp_partial' | 'smtp_transient_reply' | 'smtp_permanent_reply' | 'sendgrid_accepted' | 'sendgrid_validated' | 'sendgrid_throttled' | 'sendgrid_rejected' | 'not_transmitted' | 'provider_configuration' | 'transport_uncertain' | 'provider_timeout' | 'provider_aborted';
156
+ type AttemptReason = ProviderReason | 'attachment_unavailable' | 'attachment_timeout' | 'attachment_invalid' | 'attachment_resolver_error' | 'rate_deferred' | 'rate_timeout' | 'rate_error' | 'profile_unavailable' | 'provider_preflight_error' | 'pre_handoff_timeout' | 'worker_stopped' | 'pre_handoff_lease_expired' | 'launch_window_closed' | 'post_handoff_lease_expired' | 'expired' | 'cancelled';
157
+ type AttemptResult = {
158
+ readonly outcome: SubmissionOutcome;
159
+ readonly retry: RetryClass;
160
+ readonly stage: SubmissionStage;
161
+ readonly reason: AttemptReason;
162
+ readonly retryHint?: RetryHint;
163
+ readonly recipients?: readonly RecipientResult[];
164
+ readonly messageId?: string;
165
+ readonly providerMessageId?: string;
166
+ };
167
+ type ProviderResult = Omit<AttemptResult, 'stage' | 'reason'> & {
168
+ readonly stage: Exclude<SubmissionStage, 'pre_handoff' | 'attachment' | 'rate_limit'>;
169
+ readonly reason: ProviderReason;
170
+ };
171
+ type ProviderSubmission<M extends EmailSnapshot> = {
172
+ readonly jobId: EmailJobId;
173
+ readonly attemptId: EmailAttemptId;
174
+ readonly snapshot: M;
175
+ readonly attachments: readonly ResolvedAttachment[];
176
+ };
177
+ type ProviderCall = {
178
+ signal: AbortSignal;
179
+ timeoutMs: number;
180
+ };
181
+ type SmtpSnapshot = Extract<EmailSnapshot, {
182
+ kind: 'smtp';
183
+ }>;
184
+ type SendGridSnapshot = Extract<EmailSnapshot, {
185
+ kind: 'sendgrid';
186
+ }>;
187
+ interface PreparedEmailSubmission {
188
+ /** One-shot I/O. Settle only once cancellation/deadline handling makes further send I/O impossible. */
189
+ submit(context: ProviderCall): Promise<ProviderResult>;
190
+ }
191
+ interface EmailProvider<M extends EmailSnapshot> {
192
+ readonly ref: M['provider'];
193
+ readonly smtpCapacity?: SmtpCapacity;
194
+ /** Validate and prepare without I/O. Direct unmanaged submission has no queue or retry guarantees. */
195
+ prepare(input: ProviderSubmission<M>): PreparedEmailSubmission;
196
+ }
197
+ type ConfiguredEmailProvider = EmailProvider<SmtpSnapshot> | EmailProvider<SendGridSnapshot>;
198
+
199
+ export type { Awaitable as A, SubmissionOutcome as B, Correlation as C, SubmissionStage as D, EmailEnvelope as E, JsonObject as J, Mailbox as M, ProviderRef as P, RecipientResult as R, SmtpCapacity as S, TemplateIdentity as T, UnixMs as U, EmailScope as a, EmailAdmissionKey as b, AttachmentRef as c, JsonValue as d, CallOptions as e, PreparedEmailCommand as f, EmailClock as g, AttachmentResolution as h, AttachmentResolver as i, AttemptReason as j, AttemptResult as k, ConfiguredEmailProvider as l, EmailAttemptId as m, EmailJobId as n, EmailProvider as o, EmailSnapshot as p, PreparedEmailSubmission as q, ProviderCall as r, ProviderReason as s, ProviderResult as t, ProviderSubmission as u, ResolvedAttachment as v, RetryClass as w, RetryHint as x, SendGridSnapshot as y, SmtpSnapshot as z };
package/sendgrid.d.mts ADDED
@@ -0,0 +1,18 @@
1
+ import { o as EmailProvider, y as SendGridSnapshot } from './provider-DC_av0SQ.mjs';
2
+
3
+ /** Instance-owned credentials for HTTPS Mail Send only, not for template administration. */
4
+ type SendGridProviderOptions = {
5
+ key: string;
6
+ /** An explicit Mail Send bearer token. Keep it in host secret configuration, not snapshots or logs. */
7
+ apiKey: string;
8
+ /** Defaults to live; sandbox validation does not submit an email. */
9
+ mode?: 'live' | 'sandbox';
10
+ };
11
+ /**
12
+ * Create a SendGrid Mail Send profile with no SDK or peer. The endpoint is fixed and
13
+ * TLS is verified. Construction and `prepare` do no network I/O; `submit` is one-shot
14
+ * with no redirects or retries. Live acceptance is not inbox delivery. Direct use is unmanaged.
15
+ */
16
+ declare function createSendGridProvider(options: SendGridProviderOptions): EmailProvider<SendGridSnapshot>;
17
+
18
+ export { type SendGridProviderOptions, createSendGridProvider };
package/sendgrid.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ import { o as EmailProvider, y as SendGridSnapshot } from './provider-DC_av0SQ.js';
2
+
3
+ /** Instance-owned credentials for HTTPS Mail Send only, not for template administration. */
4
+ type SendGridProviderOptions = {
5
+ key: string;
6
+ /** An explicit Mail Send bearer token. Keep it in host secret configuration, not snapshots or logs. */
7
+ apiKey: string;
8
+ /** Defaults to live; sandbox validation does not submit an email. */
9
+ mode?: 'live' | 'sandbox';
10
+ };
11
+ /**
12
+ * Create a SendGrid Mail Send profile with no SDK or peer. The endpoint is fixed and
13
+ * TLS is verified. Construction and `prepare` do no network I/O; `submit` is one-shot
14
+ * with no redirects or retries. Live acceptance is not inbox delivery. Direct use is unmanaged.
15
+ */
16
+ declare function createSendGridProvider(options: SendGridProviderOptions): EmailProvider<SendGridSnapshot>;
17
+
18
+ export { type SendGridProviderOptions, createSendGridProvider };