smartletter 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/index.cjs +15 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -9
- package/dist/index.d.mts +21 -9
- package/dist/index.mjs +15 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -54,17 +54,17 @@ declare class Client {
|
|
|
54
54
|
|
|
55
55
|
interface EmailsSendParams {
|
|
56
56
|
/**
|
|
57
|
-
* `Name <address@your-domain>`; the domain must be verified.
|
|
57
|
+
* `Name <address@your-domain>`; the domain must be verified. Required, except with a `template` that has one.
|
|
58
58
|
*/
|
|
59
|
-
from
|
|
59
|
+
from?: string;
|
|
60
60
|
/**
|
|
61
61
|
* Up to 50 addresses.
|
|
62
62
|
*/
|
|
63
63
|
to: string | string[];
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
65
|
+
* Required, except with a `template` that has one.
|
|
66
66
|
*/
|
|
67
|
-
subject
|
|
67
|
+
subject?: string;
|
|
68
68
|
/**
|
|
69
69
|
* Send a published template instead of `html` / `text` (which are then refused). `from`, `subject` and `reply_to` override the template's.
|
|
70
70
|
*/
|
|
@@ -96,6 +96,10 @@ interface EmailsSendParams {
|
|
|
96
96
|
* Send later: ISO 8601 (`2026-10-20T09:00:00Z`) or English like `in 1 hour`, `tomorrow at 9am`. Up to 30 days.
|
|
97
97
|
*/
|
|
98
98
|
scheduledAt?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Only recipients eligible to this topic receive the email (topic preferences, like a newsletter); the others are marked `suppressed`. `null` = no topic.
|
|
101
|
+
*/
|
|
102
|
+
topicId?: string | null;
|
|
99
103
|
/**
|
|
100
104
|
* Up to 20 files, 10 MB in total. Executable types (.exe, .js, .bat…) are refused.
|
|
101
105
|
*/
|
|
@@ -127,17 +131,17 @@ type EmailsSendResponse = {
|
|
|
127
131
|
};
|
|
128
132
|
type BatchSendParams = {
|
|
129
133
|
/**
|
|
130
|
-
* `Name <address@your-domain>`; the domain must be verified.
|
|
134
|
+
* `Name <address@your-domain>`; the domain must be verified. Required, except with a `template` that has one.
|
|
131
135
|
*/
|
|
132
|
-
from
|
|
136
|
+
from?: string;
|
|
133
137
|
/**
|
|
134
138
|
* Up to 50 addresses.
|
|
135
139
|
*/
|
|
136
140
|
to: string | string[];
|
|
137
141
|
/**
|
|
138
|
-
*
|
|
142
|
+
* Required, except with a `template` that has one.
|
|
139
143
|
*/
|
|
140
|
-
subject
|
|
144
|
+
subject?: string;
|
|
141
145
|
/**
|
|
142
146
|
* Send a published template instead of `html` / `text` (which are then refused). `from`, `subject` and `reply_to` override the template's.
|
|
143
147
|
*/
|
|
@@ -169,6 +173,10 @@ type BatchSendParams = {
|
|
|
169
173
|
* Send later: ISO 8601 (`2026-10-20T09:00:00Z`) or English like `in 1 hour`, `tomorrow at 9am`. Up to 30 days.
|
|
170
174
|
*/
|
|
171
175
|
scheduledAt?: string;
|
|
176
|
+
/**
|
|
177
|
+
* Only recipients eligible to this topic receive the email (topic preferences, like a newsletter); the others are marked `suppressed`. `null` = no topic.
|
|
178
|
+
*/
|
|
179
|
+
topicId?: string | null;
|
|
172
180
|
}[];
|
|
173
181
|
type BatchSendResponse = {
|
|
174
182
|
data: {
|
|
@@ -209,6 +217,7 @@ type EmailsListResponse = {
|
|
|
209
217
|
reply_to: string[];
|
|
210
218
|
last_event: string;
|
|
211
219
|
scheduled_at: string | null;
|
|
220
|
+
topic_id: string | null;
|
|
212
221
|
}[];
|
|
213
222
|
};
|
|
214
223
|
interface EmailsGetParams {
|
|
@@ -227,6 +236,7 @@ type EmailsGetResponse = {
|
|
|
227
236
|
reply_to: string[];
|
|
228
237
|
last_event: string;
|
|
229
238
|
scheduled_at: string | null;
|
|
239
|
+
topic_id: string | null;
|
|
230
240
|
html: string | null;
|
|
231
241
|
text: string | null;
|
|
232
242
|
tags: {
|
|
@@ -3774,8 +3784,10 @@ interface SmartletterResources {
|
|
|
3774
3784
|
};
|
|
3775
3785
|
}
|
|
3776
3786
|
|
|
3777
|
-
type SendAttachment = Omit<NonNullable<EmailsSendParams["attachments"]>[number], "content"> & {
|
|
3787
|
+
type SendAttachment = Omit<NonNullable<EmailsSendParams["attachments"]>[number], "content" | "filename"> & {
|
|
3778
3788
|
content?: string | Uint8Array;
|
|
3789
|
+
/** `false` (Resend 6.32) : pas de nom de fichier ; la clé est omise de la requête. Utile avec `path`. */
|
|
3790
|
+
filename?: string | false | undefined;
|
|
3779
3791
|
};
|
|
3780
3792
|
type ContentKeys = "from" | "subject" | "template" | "html" | "text";
|
|
3781
3793
|
type EmailTemplate = NonNullable<EmailsSendParams["template"]>;
|
package/dist/index.d.mts
CHANGED
|
@@ -54,17 +54,17 @@ declare class Client {
|
|
|
54
54
|
|
|
55
55
|
interface EmailsSendParams {
|
|
56
56
|
/**
|
|
57
|
-
* `Name <address@your-domain>`; the domain must be verified.
|
|
57
|
+
* `Name <address@your-domain>`; the domain must be verified. Required, except with a `template` that has one.
|
|
58
58
|
*/
|
|
59
|
-
from
|
|
59
|
+
from?: string;
|
|
60
60
|
/**
|
|
61
61
|
* Up to 50 addresses.
|
|
62
62
|
*/
|
|
63
63
|
to: string | string[];
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
65
|
+
* Required, except with a `template` that has one.
|
|
66
66
|
*/
|
|
67
|
-
subject
|
|
67
|
+
subject?: string;
|
|
68
68
|
/**
|
|
69
69
|
* Send a published template instead of `html` / `text` (which are then refused). `from`, `subject` and `reply_to` override the template's.
|
|
70
70
|
*/
|
|
@@ -96,6 +96,10 @@ interface EmailsSendParams {
|
|
|
96
96
|
* Send later: ISO 8601 (`2026-10-20T09:00:00Z`) or English like `in 1 hour`, `tomorrow at 9am`. Up to 30 days.
|
|
97
97
|
*/
|
|
98
98
|
scheduledAt?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Only recipients eligible to this topic receive the email (topic preferences, like a newsletter); the others are marked `suppressed`. `null` = no topic.
|
|
101
|
+
*/
|
|
102
|
+
topicId?: string | null;
|
|
99
103
|
/**
|
|
100
104
|
* Up to 20 files, 10 MB in total. Executable types (.exe, .js, .bat…) are refused.
|
|
101
105
|
*/
|
|
@@ -127,17 +131,17 @@ type EmailsSendResponse = {
|
|
|
127
131
|
};
|
|
128
132
|
type BatchSendParams = {
|
|
129
133
|
/**
|
|
130
|
-
* `Name <address@your-domain>`; the domain must be verified.
|
|
134
|
+
* `Name <address@your-domain>`; the domain must be verified. Required, except with a `template` that has one.
|
|
131
135
|
*/
|
|
132
|
-
from
|
|
136
|
+
from?: string;
|
|
133
137
|
/**
|
|
134
138
|
* Up to 50 addresses.
|
|
135
139
|
*/
|
|
136
140
|
to: string | string[];
|
|
137
141
|
/**
|
|
138
|
-
*
|
|
142
|
+
* Required, except with a `template` that has one.
|
|
139
143
|
*/
|
|
140
|
-
subject
|
|
144
|
+
subject?: string;
|
|
141
145
|
/**
|
|
142
146
|
* Send a published template instead of `html` / `text` (which are then refused). `from`, `subject` and `reply_to` override the template's.
|
|
143
147
|
*/
|
|
@@ -169,6 +173,10 @@ type BatchSendParams = {
|
|
|
169
173
|
* Send later: ISO 8601 (`2026-10-20T09:00:00Z`) or English like `in 1 hour`, `tomorrow at 9am`. Up to 30 days.
|
|
170
174
|
*/
|
|
171
175
|
scheduledAt?: string;
|
|
176
|
+
/**
|
|
177
|
+
* Only recipients eligible to this topic receive the email (topic preferences, like a newsletter); the others are marked `suppressed`. `null` = no topic.
|
|
178
|
+
*/
|
|
179
|
+
topicId?: string | null;
|
|
172
180
|
}[];
|
|
173
181
|
type BatchSendResponse = {
|
|
174
182
|
data: {
|
|
@@ -209,6 +217,7 @@ type EmailsListResponse = {
|
|
|
209
217
|
reply_to: string[];
|
|
210
218
|
last_event: string;
|
|
211
219
|
scheduled_at: string | null;
|
|
220
|
+
topic_id: string | null;
|
|
212
221
|
}[];
|
|
213
222
|
};
|
|
214
223
|
interface EmailsGetParams {
|
|
@@ -227,6 +236,7 @@ type EmailsGetResponse = {
|
|
|
227
236
|
reply_to: string[];
|
|
228
237
|
last_event: string;
|
|
229
238
|
scheduled_at: string | null;
|
|
239
|
+
topic_id: string | null;
|
|
230
240
|
html: string | null;
|
|
231
241
|
text: string | null;
|
|
232
242
|
tags: {
|
|
@@ -3774,8 +3784,10 @@ interface SmartletterResources {
|
|
|
3774
3784
|
};
|
|
3775
3785
|
}
|
|
3776
3786
|
|
|
3777
|
-
type SendAttachment = Omit<NonNullable<EmailsSendParams["attachments"]>[number], "content"> & {
|
|
3787
|
+
type SendAttachment = Omit<NonNullable<EmailsSendParams["attachments"]>[number], "content" | "filename"> & {
|
|
3778
3788
|
content?: string | Uint8Array;
|
|
3789
|
+
/** `false` (Resend 6.32) : pas de nom de fichier ; la clé est omise de la requête. Utile avec `path`. */
|
|
3790
|
+
filename?: string | false | undefined;
|
|
3779
3791
|
};
|
|
3780
3792
|
type ContentKeys = "from" | "subject" | "template" | "html" | "text";
|
|
3781
3793
|
type EmailTemplate = NonNullable<EmailsSendParams["template"]>;
|
package/dist/index.mjs
CHANGED
|
@@ -43,7 +43,7 @@ var Client = class {
|
|
|
43
43
|
}
|
|
44
44
|
this.key = resolved;
|
|
45
45
|
this.baseUrl = (options.baseUrl || env("SMARTLETTER_BASE_URL") || DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
46
|
-
this.userAgent = options.userAgent ?? `smartletter-node/${"1.
|
|
46
|
+
this.userAgent = options.userAgent ?? `smartletter-node/${"1.1.0"}`;
|
|
47
47
|
}
|
|
48
48
|
async call(op, args, options = {}) {
|
|
49
49
|
const headers = new Headers(options.headers);
|
|
@@ -200,6 +200,9 @@ var OPERATIONS = {
|
|
|
200
200
|
scheduledAt: {
|
|
201
201
|
wire: "scheduled_at"
|
|
202
202
|
},
|
|
203
|
+
topicId: {
|
|
204
|
+
wire: "topic_id"
|
|
205
|
+
},
|
|
203
206
|
attachments: {
|
|
204
207
|
wire: "attachments",
|
|
205
208
|
items: {
|
|
@@ -282,6 +285,9 @@ var OPERATIONS = {
|
|
|
282
285
|
},
|
|
283
286
|
scheduledAt: {
|
|
284
287
|
wire: "scheduled_at"
|
|
288
|
+
},
|
|
289
|
+
topicId: {
|
|
290
|
+
wire: "topic_id"
|
|
285
291
|
}
|
|
286
292
|
}
|
|
287
293
|
},
|
|
@@ -2526,7 +2532,14 @@ async function prepare(email) {
|
|
|
2526
2532
|
const out = { ...rest };
|
|
2527
2533
|
if (react) out.html = await renderReact(react);
|
|
2528
2534
|
if (attachments) {
|
|
2529
|
-
out.attachments = attachments.map((a) =>
|
|
2535
|
+
out.attachments = attachments.map((a) => {
|
|
2536
|
+
const { filename, ...file } = a;
|
|
2537
|
+
return {
|
|
2538
|
+
...file,
|
|
2539
|
+
...filename === false ? {} : { filename },
|
|
2540
|
+
...a.content instanceof Uint8Array ? { content: toBase64(a.content) } : {}
|
|
2541
|
+
};
|
|
2542
|
+
});
|
|
2530
2543
|
}
|
|
2531
2544
|
return out;
|
|
2532
2545
|
}
|