@marlinjai/mail-contract 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +448 -107
- package/dist/index.d.ts +448 -107
- package/dist/index.js +56 -4
- package/dist/index.mjs +51 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -396,6 +396,11 @@ __export(index_exports, {
|
|
|
396
396
|
TEMPLATE_SORTS: () => TEMPLATE_SORTS,
|
|
397
397
|
TEMPLATE_SORT_DEFAULT_ORDER: () => TEMPLATE_SORT_DEFAULT_ORDER,
|
|
398
398
|
TERMINAL_MAILING_STATUSES: () => TERMINAL_MAILING_STATUSES,
|
|
399
|
+
TRANSACTIONAL_BLOCKING_REASONS: () => TRANSACTIONAL_BLOCKING_REASONS,
|
|
400
|
+
TRANSACTIONAL_NEEDS_LETTER_REFUSAL: () => TRANSACTIONAL_NEEDS_LETTER_REFUSAL,
|
|
401
|
+
TRANSACTIONAL_NEEDS_TEMPLATE_LOCALE_REFUSAL: () => TRANSACTIONAL_NEEDS_TEMPLATE_LOCALE_REFUSAL,
|
|
402
|
+
TRANSACTIONAL_NOT_ALLOWED_REFUSAL: () => TRANSACTIONAL_NOT_ALLOWED_REFUSAL,
|
|
403
|
+
TRANSACTIONAL_UNSUBSCRIBE_URL_REFUSAL: () => TRANSACTIONAL_UNSUBSCRIBE_URL_REFUSAL,
|
|
399
404
|
TRUSTED_APPS: () => TRUSTED_APPS,
|
|
400
405
|
TRUSTED_APP_OPERATIONS: () => TRUSTED_APP_OPERATIONS,
|
|
401
406
|
Tag: () => Tag,
|
|
@@ -1794,6 +1799,17 @@ var Mailing = import_zod8.z.object({
|
|
|
1794
1799
|
* the workspace's defaults, below the recipient's own. Empty by default.
|
|
1795
1800
|
*/
|
|
1796
1801
|
merge: MailingMerge.default({}),
|
|
1802
|
+
/**
|
|
1803
|
+
* Where a reader's reply goes for this mailing, or null for the sending
|
|
1804
|
+
* provider's own reply address (see `MailingContent.reply_to`).
|
|
1805
|
+
*/
|
|
1806
|
+
reply_to: Email.nullable().default(null),
|
|
1807
|
+
/**
|
|
1808
|
+
* Whether this is a transactional letter (see `MailingCreate.transactional`
|
|
1809
|
+
* and "Transactional letters" in the contract's documentation). False for
|
|
1810
|
+
* every mailing made without the flag.
|
|
1811
|
+
*/
|
|
1812
|
+
transactional: import_zod8.z.boolean().default(false),
|
|
1797
1813
|
scheduled_at: Timestamp.nullable(),
|
|
1798
1814
|
/** The A/B test on subject or content (S4), null when there is none. */
|
|
1799
1815
|
ab_test: AbTestState.nullable(),
|
|
@@ -1818,22 +1834,46 @@ var MailingContent = {
|
|
|
1818
1834
|
send_locale: LocaleTag.nullable().optional(),
|
|
1819
1835
|
/**
|
|
1820
1836
|
* Omitted or null makes the mailing a letter: one recipient at most, sent to
|
|
1821
|
-
* anybody not blocked on every topic, with an unsubscribe link
|
|
1822
|
-
*
|
|
1837
|
+
* anybody not blocked on every topic, with an unsubscribe link and
|
|
1838
|
+
* List-Unsubscribe headers that offer every topic. See "Letters" in the
|
|
1823
1839
|
* contract's documentation.
|
|
1824
1840
|
*/
|
|
1825
1841
|
topic: Slug.nullable().optional(),
|
|
1826
1842
|
provider_id: Id,
|
|
1827
1843
|
metadata: MailingMetadata.optional(),
|
|
1828
1844
|
/** See `Mailing.merge`. `first_name` and `last_name` only on a letter (no topic). */
|
|
1829
|
-
merge: MailingMerge.optional()
|
|
1845
|
+
merge: MailingMerge.optional(),
|
|
1846
|
+
/**
|
|
1847
|
+
* The Reply-To of this mailing's messages: one address, in place of the
|
|
1848
|
+
* sending provider's `reply_to`. Omitted or null keeps the provider's. The
|
|
1849
|
+
* sender (From) is always the provider's, and so is the mailto alternative
|
|
1850
|
+
* of the List-Unsubscribe header, since a request to leave belongs to the
|
|
1851
|
+
* workspace and not to whoever a reply reaches.
|
|
1852
|
+
*/
|
|
1853
|
+
reply_to: Email.nullable().optional()
|
|
1830
1854
|
};
|
|
1831
1855
|
var MailingCreate = import_zod8.z.object({
|
|
1832
1856
|
...MailingContent,
|
|
1833
1857
|
subject: MailingContent.subject.optional(),
|
|
1834
1858
|
document: TemplateDocument.optional(),
|
|
1835
1859
|
template_id: Id.optional(),
|
|
1836
|
-
template_locale: LocaleTag.optional()
|
|
1860
|
+
template_locale: LocaleTag.optional(),
|
|
1861
|
+
/**
|
|
1862
|
+
* True makes the mailing a transactional letter: mail that answers
|
|
1863
|
+
* something its one reader did and that they need whatever they chose
|
|
1864
|
+
* about marketing (a booking's confirmation, its reminder, its
|
|
1865
|
+
* cancellation). It needs no `{{unsubscribe_url}}`, carries no
|
|
1866
|
+
* List-Unsubscribe headers and is not stopped by an unsubscribe; a hard
|
|
1867
|
+
* bounce, a spam complaint and a block set by hand still stop it.
|
|
1868
|
+
*
|
|
1869
|
+
* Only a key that a trusted application created may set it (`forbidden`,
|
|
1870
|
+
* `details.reason: "transactional_not_allowed"`), only on a letter
|
|
1871
|
+
* (`validation_failed`, `"transactional_needs_letter"`), from a template
|
|
1872
|
+
* only with `template_locale` (`"transactional_needs_template_locale"`),
|
|
1873
|
+
* and it is fixed when the mailing is created. See "Transactional letters" in the
|
|
1874
|
+
* contract's documentation.
|
|
1875
|
+
*/
|
|
1876
|
+
transactional: import_zod8.z.boolean().optional()
|
|
1837
1877
|
}).refine((v) => v.document === void 0 !== (v.template_id === void 0), {
|
|
1838
1878
|
message: "exactly one of document or template_id",
|
|
1839
1879
|
path: ["document"]
|
|
@@ -1860,6 +1900,8 @@ var MailingUpdate = import_zod8.z.object({
|
|
|
1860
1900
|
* them.
|
|
1861
1901
|
*/
|
|
1862
1902
|
merge: MailingMerge.optional(),
|
|
1903
|
+
/** See `MailingContent.reply_to`. Null goes back to the provider's reply address. */
|
|
1904
|
+
reply_to: Email.nullable().optional(),
|
|
1863
1905
|
document: TemplateDocument.optional()
|
|
1864
1906
|
}).refine((v) => Object.keys(v).length > 0, "at least one field");
|
|
1865
1907
|
var MailingListQuery = PageQuery.extend({
|
|
@@ -1908,6 +1950,11 @@ var Recipient = import_zod8.z.object({
|
|
|
1908
1950
|
var MAX_RECIPIENTS_PER_BATCH = 1e3;
|
|
1909
1951
|
var MAX_LETTER_RECIPIENTS = 1;
|
|
1910
1952
|
var LETTER_RECIPIENT_REFUSAL = "letter_has_one_recipient";
|
|
1953
|
+
var TRANSACTIONAL_NOT_ALLOWED_REFUSAL = "transactional_not_allowed";
|
|
1954
|
+
var TRANSACTIONAL_NEEDS_LETTER_REFUSAL = "transactional_needs_letter";
|
|
1955
|
+
var TRANSACTIONAL_NEEDS_TEMPLATE_LOCALE_REFUSAL = "transactional_needs_template_locale";
|
|
1956
|
+
var TRANSACTIONAL_UNSUBSCRIBE_URL_REFUSAL = "transactional_has_unsubscribe_url";
|
|
1957
|
+
var TRANSACTIONAL_BLOCKING_REASONS = ["bounced", "complained", "manual"];
|
|
1911
1958
|
var RecipientInput = import_zod8.z.object({
|
|
1912
1959
|
contact_id: Id.optional(),
|
|
1913
1960
|
external_id: import_zod8.z.string().min(1).max(255).optional(),
|
|
@@ -6770,6 +6817,11 @@ function matchRoute(method, pathname) {
|
|
|
6770
6817
|
TEMPLATE_SORTS,
|
|
6771
6818
|
TEMPLATE_SORT_DEFAULT_ORDER,
|
|
6772
6819
|
TERMINAL_MAILING_STATUSES,
|
|
6820
|
+
TRANSACTIONAL_BLOCKING_REASONS,
|
|
6821
|
+
TRANSACTIONAL_NEEDS_LETTER_REFUSAL,
|
|
6822
|
+
TRANSACTIONAL_NEEDS_TEMPLATE_LOCALE_REFUSAL,
|
|
6823
|
+
TRANSACTIONAL_NOT_ALLOWED_REFUSAL,
|
|
6824
|
+
TRANSACTIONAL_UNSUBSCRIBE_URL_REFUSAL,
|
|
6773
6825
|
TRUSTED_APPS,
|
|
6774
6826
|
TRUSTED_APP_OPERATIONS,
|
|
6775
6827
|
Tag,
|
package/dist/index.mjs
CHANGED
|
@@ -1168,6 +1168,17 @@ var Mailing = z8.object({
|
|
|
1168
1168
|
* the workspace's defaults, below the recipient's own. Empty by default.
|
|
1169
1169
|
*/
|
|
1170
1170
|
merge: MailingMerge.default({}),
|
|
1171
|
+
/**
|
|
1172
|
+
* Where a reader's reply goes for this mailing, or null for the sending
|
|
1173
|
+
* provider's own reply address (see `MailingContent.reply_to`).
|
|
1174
|
+
*/
|
|
1175
|
+
reply_to: Email.nullable().default(null),
|
|
1176
|
+
/**
|
|
1177
|
+
* Whether this is a transactional letter (see `MailingCreate.transactional`
|
|
1178
|
+
* and "Transactional letters" in the contract's documentation). False for
|
|
1179
|
+
* every mailing made without the flag.
|
|
1180
|
+
*/
|
|
1181
|
+
transactional: z8.boolean().default(false),
|
|
1171
1182
|
scheduled_at: Timestamp.nullable(),
|
|
1172
1183
|
/** The A/B test on subject or content (S4), null when there is none. */
|
|
1173
1184
|
ab_test: AbTestState.nullable(),
|
|
@@ -1192,22 +1203,46 @@ var MailingContent = {
|
|
|
1192
1203
|
send_locale: LocaleTag.nullable().optional(),
|
|
1193
1204
|
/**
|
|
1194
1205
|
* Omitted or null makes the mailing a letter: one recipient at most, sent to
|
|
1195
|
-
* anybody not blocked on every topic, with an unsubscribe link
|
|
1196
|
-
*
|
|
1206
|
+
* anybody not blocked on every topic, with an unsubscribe link and
|
|
1207
|
+
* List-Unsubscribe headers that offer every topic. See "Letters" in the
|
|
1197
1208
|
* contract's documentation.
|
|
1198
1209
|
*/
|
|
1199
1210
|
topic: Slug.nullable().optional(),
|
|
1200
1211
|
provider_id: Id,
|
|
1201
1212
|
metadata: MailingMetadata.optional(),
|
|
1202
1213
|
/** See `Mailing.merge`. `first_name` and `last_name` only on a letter (no topic). */
|
|
1203
|
-
merge: MailingMerge.optional()
|
|
1214
|
+
merge: MailingMerge.optional(),
|
|
1215
|
+
/**
|
|
1216
|
+
* The Reply-To of this mailing's messages: one address, in place of the
|
|
1217
|
+
* sending provider's `reply_to`. Omitted or null keeps the provider's. The
|
|
1218
|
+
* sender (From) is always the provider's, and so is the mailto alternative
|
|
1219
|
+
* of the List-Unsubscribe header, since a request to leave belongs to the
|
|
1220
|
+
* workspace and not to whoever a reply reaches.
|
|
1221
|
+
*/
|
|
1222
|
+
reply_to: Email.nullable().optional()
|
|
1204
1223
|
};
|
|
1205
1224
|
var MailingCreate = z8.object({
|
|
1206
1225
|
...MailingContent,
|
|
1207
1226
|
subject: MailingContent.subject.optional(),
|
|
1208
1227
|
document: TemplateDocument.optional(),
|
|
1209
1228
|
template_id: Id.optional(),
|
|
1210
|
-
template_locale: LocaleTag.optional()
|
|
1229
|
+
template_locale: LocaleTag.optional(),
|
|
1230
|
+
/**
|
|
1231
|
+
* True makes the mailing a transactional letter: mail that answers
|
|
1232
|
+
* something its one reader did and that they need whatever they chose
|
|
1233
|
+
* about marketing (a booking's confirmation, its reminder, its
|
|
1234
|
+
* cancellation). It needs no `{{unsubscribe_url}}`, carries no
|
|
1235
|
+
* List-Unsubscribe headers and is not stopped by an unsubscribe; a hard
|
|
1236
|
+
* bounce, a spam complaint and a block set by hand still stop it.
|
|
1237
|
+
*
|
|
1238
|
+
* Only a key that a trusted application created may set it (`forbidden`,
|
|
1239
|
+
* `details.reason: "transactional_not_allowed"`), only on a letter
|
|
1240
|
+
* (`validation_failed`, `"transactional_needs_letter"`), from a template
|
|
1241
|
+
* only with `template_locale` (`"transactional_needs_template_locale"`),
|
|
1242
|
+
* and it is fixed when the mailing is created. See "Transactional letters" in the
|
|
1243
|
+
* contract's documentation.
|
|
1244
|
+
*/
|
|
1245
|
+
transactional: z8.boolean().optional()
|
|
1211
1246
|
}).refine((v) => v.document === void 0 !== (v.template_id === void 0), {
|
|
1212
1247
|
message: "exactly one of document or template_id",
|
|
1213
1248
|
path: ["document"]
|
|
@@ -1234,6 +1269,8 @@ var MailingUpdate = z8.object({
|
|
|
1234
1269
|
* them.
|
|
1235
1270
|
*/
|
|
1236
1271
|
merge: MailingMerge.optional(),
|
|
1272
|
+
/** See `MailingContent.reply_to`. Null goes back to the provider's reply address. */
|
|
1273
|
+
reply_to: Email.nullable().optional(),
|
|
1237
1274
|
document: TemplateDocument.optional()
|
|
1238
1275
|
}).refine((v) => Object.keys(v).length > 0, "at least one field");
|
|
1239
1276
|
var MailingListQuery = PageQuery.extend({
|
|
@@ -1282,6 +1319,11 @@ var Recipient = z8.object({
|
|
|
1282
1319
|
var MAX_RECIPIENTS_PER_BATCH = 1e3;
|
|
1283
1320
|
var MAX_LETTER_RECIPIENTS = 1;
|
|
1284
1321
|
var LETTER_RECIPIENT_REFUSAL = "letter_has_one_recipient";
|
|
1322
|
+
var TRANSACTIONAL_NOT_ALLOWED_REFUSAL = "transactional_not_allowed";
|
|
1323
|
+
var TRANSACTIONAL_NEEDS_LETTER_REFUSAL = "transactional_needs_letter";
|
|
1324
|
+
var TRANSACTIONAL_NEEDS_TEMPLATE_LOCALE_REFUSAL = "transactional_needs_template_locale";
|
|
1325
|
+
var TRANSACTIONAL_UNSUBSCRIBE_URL_REFUSAL = "transactional_has_unsubscribe_url";
|
|
1326
|
+
var TRANSACTIONAL_BLOCKING_REASONS = ["bounced", "complained", "manual"];
|
|
1285
1327
|
var RecipientInput = z8.object({
|
|
1286
1328
|
contact_id: Id.optional(),
|
|
1287
1329
|
external_id: z8.string().min(1).max(255).optional(),
|
|
@@ -6143,6 +6185,11 @@ export {
|
|
|
6143
6185
|
TEMPLATE_SORTS,
|
|
6144
6186
|
TEMPLATE_SORT_DEFAULT_ORDER,
|
|
6145
6187
|
TERMINAL_MAILING_STATUSES,
|
|
6188
|
+
TRANSACTIONAL_BLOCKING_REASONS,
|
|
6189
|
+
TRANSACTIONAL_NEEDS_LETTER_REFUSAL,
|
|
6190
|
+
TRANSACTIONAL_NEEDS_TEMPLATE_LOCALE_REFUSAL,
|
|
6191
|
+
TRANSACTIONAL_NOT_ALLOWED_REFUSAL,
|
|
6192
|
+
TRANSACTIONAL_UNSUBSCRIBE_URL_REFUSAL,
|
|
6146
6193
|
TRUSTED_APPS,
|
|
6147
6194
|
TRUSTED_APP_OPERATIONS,
|
|
6148
6195
|
Tag,
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.13.0",
|
|
7
7
|
"description": "The v1 API contract of the mail service: zod schemas and types for every request, response, error and webhook, the route table, and webhook signing helpers",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"repository": {
|