@marlinjai/mail-contract 0.3.0 → 0.4.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 +226 -155
- package/dist/index.d.ts +226 -155
- package/dist/index.js +32 -3
- package/dist/index.mjs +30 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -199,6 +199,7 @@ __export(index_exports, {
|
|
|
199
199
|
InviteListQuery: () => InviteListQuery,
|
|
200
200
|
InviteStatus: () => InviteStatus,
|
|
201
201
|
JsonValue: () => JsonValue,
|
|
202
|
+
LETTER_RECIPIENT_REFUSAL: () => LETTER_RECIPIENT_REFUSAL,
|
|
202
203
|
LIST_UNSUBSCRIBE_POST_VALUE: () => LIST_UNSUBSCRIBE_POST_VALUE,
|
|
203
204
|
MAILING_ACTIONS: () => MAILING_ACTIONS,
|
|
204
205
|
MAILING_KINDS: () => MAILING_KINDS,
|
|
@@ -217,6 +218,7 @@ __export(index_exports, {
|
|
|
217
218
|
MAX_IMPORT_URL_LENGTH: () => MAX_IMPORT_URL_LENGTH,
|
|
218
219
|
MAX_INVITE_TTL_DAYS: () => MAX_INVITE_TTL_DAYS,
|
|
219
220
|
MAX_IN_LIST: () => MAX_IN_LIST,
|
|
221
|
+
MAX_LETTER_RECIPIENTS: () => MAX_LETTER_RECIPIENTS,
|
|
220
222
|
MAX_MERGE_DEFAULTS: () => MAX_MERGE_DEFAULTS,
|
|
221
223
|
MAX_MERGE_DEFAULT_LENGTH: () => MAX_MERGE_DEFAULT_LENGTH,
|
|
222
224
|
MAX_MJML_DEPTH: () => MAX_MJML_DEPTH,
|
|
@@ -904,7 +906,12 @@ var Mailing = import_zod5.z.object({
|
|
|
904
906
|
/** The template the document was taken from, if any. The snapshot is what is sent. */
|
|
905
907
|
template_id: Id.nullable(),
|
|
906
908
|
document: TemplateDocument,
|
|
907
|
-
|
|
909
|
+
/**
|
|
910
|
+
* The topic the mailing is sent under. Null for a letter (a one-to-one
|
|
911
|
+
* mailing with at most one recipient, which belongs to no topic and whose
|
|
912
|
+
* unsubscribe link offers every topic) and for an automation's notification.
|
|
913
|
+
*/
|
|
914
|
+
topic: Slug.nullable(),
|
|
908
915
|
provider_id: Id,
|
|
909
916
|
status: MailingStatus,
|
|
910
917
|
counts: MailingCounts,
|
|
@@ -929,7 +936,13 @@ var MailingContent = {
|
|
|
929
936
|
name: import_zod5.z.string().max(200).optional(),
|
|
930
937
|
subject: import_zod5.z.string().min(1).max(998),
|
|
931
938
|
preheader: import_zod5.z.string().max(500).optional(),
|
|
932
|
-
|
|
939
|
+
/**
|
|
940
|
+
* Omitted or null makes the mailing a letter: one recipient at most, sent to
|
|
941
|
+
* anybody not blocked on every topic, with an unsubscribe link that offers
|
|
942
|
+
* every topic and no List-Unsubscribe headers. See "Letters" in the
|
|
943
|
+
* contract's documentation.
|
|
944
|
+
*/
|
|
945
|
+
topic: Slug.nullable().optional(),
|
|
933
946
|
provider_id: Id,
|
|
934
947
|
metadata: MailingMetadata.optional()
|
|
935
948
|
};
|
|
@@ -945,7 +958,8 @@ var MailingUpdate = import_zod5.z.object({
|
|
|
945
958
|
name: import_zod5.z.string().max(200).nullable().optional(),
|
|
946
959
|
subject: MailingContent.subject.optional(),
|
|
947
960
|
preheader: import_zod5.z.string().max(500).nullable().optional(),
|
|
948
|
-
|
|
961
|
+
/** Null turns a draft into a letter, which it can only be with at most one recipient. */
|
|
962
|
+
topic: Slug.nullable().optional(),
|
|
949
963
|
provider_id: Id.optional(),
|
|
950
964
|
metadata: MailingMetadata.optional(),
|
|
951
965
|
document: TemplateDocument.optional()
|
|
@@ -993,6 +1007,8 @@ var Recipient = import_zod5.z.object({
|
|
|
993
1007
|
updated_at: Timestamp
|
|
994
1008
|
});
|
|
995
1009
|
var MAX_RECIPIENTS_PER_BATCH = 1e3;
|
|
1010
|
+
var MAX_LETTER_RECIPIENTS = 1;
|
|
1011
|
+
var LETTER_RECIPIENT_REFUSAL = "letter_has_one_recipient";
|
|
996
1012
|
var RecipientInput = import_zod5.z.object({
|
|
997
1013
|
contact_id: Id.optional(),
|
|
998
1014
|
external_id: import_zod5.z.string().min(1).max(255).optional(),
|
|
@@ -2530,6 +2546,7 @@ var AUDIT_ACTIONS = [
|
|
|
2530
2546
|
"provider.anomaly_cleared",
|
|
2531
2547
|
"topic.created",
|
|
2532
2548
|
"topic.updated",
|
|
2549
|
+
"topic.deleted",
|
|
2533
2550
|
"template.created",
|
|
2534
2551
|
"template.updated",
|
|
2535
2552
|
"template.deleted",
|
|
@@ -3777,6 +3794,16 @@ var sendingRoutes = {
|
|
|
3777
3794
|
access: "admin",
|
|
3778
3795
|
phase: "S2"
|
|
3779
3796
|
},
|
|
3797
|
+
/** Refused with `conflict` while a mailing or an automation step still uses the topic; subscriptions and suppressions on it go with it. */
|
|
3798
|
+
"topics.delete": {
|
|
3799
|
+
method: "DELETE",
|
|
3800
|
+
path: "/v1/topics/:id",
|
|
3801
|
+
params: IdParams,
|
|
3802
|
+
response: Ok,
|
|
3803
|
+
status: 200,
|
|
3804
|
+
access: "admin",
|
|
3805
|
+
phase: "S2"
|
|
3806
|
+
},
|
|
3780
3807
|
"contacts.upsert": {
|
|
3781
3808
|
method: "POST",
|
|
3782
3809
|
path: "/v1/contacts",
|
|
@@ -4898,6 +4925,7 @@ function matchRoute(method, pathname) {
|
|
|
4898
4925
|
InviteListQuery,
|
|
4899
4926
|
InviteStatus,
|
|
4900
4927
|
JsonValue,
|
|
4928
|
+
LETTER_RECIPIENT_REFUSAL,
|
|
4901
4929
|
LIST_UNSUBSCRIBE_POST_VALUE,
|
|
4902
4930
|
MAILING_ACTIONS,
|
|
4903
4931
|
MAILING_KINDS,
|
|
@@ -4916,6 +4944,7 @@ function matchRoute(method, pathname) {
|
|
|
4916
4944
|
MAX_IMPORT_URL_LENGTH,
|
|
4917
4945
|
MAX_INVITE_TTL_DAYS,
|
|
4918
4946
|
MAX_IN_LIST,
|
|
4947
|
+
MAX_LETTER_RECIPIENTS,
|
|
4919
4948
|
MAX_MERGE_DEFAULTS,
|
|
4920
4949
|
MAX_MERGE_DEFAULT_LENGTH,
|
|
4921
4950
|
MAX_MJML_DEPTH,
|
package/dist/index.mjs
CHANGED
|
@@ -439,7 +439,12 @@ var Mailing = z5.object({
|
|
|
439
439
|
/** The template the document was taken from, if any. The snapshot is what is sent. */
|
|
440
440
|
template_id: Id.nullable(),
|
|
441
441
|
document: TemplateDocument,
|
|
442
|
-
|
|
442
|
+
/**
|
|
443
|
+
* The topic the mailing is sent under. Null for a letter (a one-to-one
|
|
444
|
+
* mailing with at most one recipient, which belongs to no topic and whose
|
|
445
|
+
* unsubscribe link offers every topic) and for an automation's notification.
|
|
446
|
+
*/
|
|
447
|
+
topic: Slug.nullable(),
|
|
443
448
|
provider_id: Id,
|
|
444
449
|
status: MailingStatus,
|
|
445
450
|
counts: MailingCounts,
|
|
@@ -464,7 +469,13 @@ var MailingContent = {
|
|
|
464
469
|
name: z5.string().max(200).optional(),
|
|
465
470
|
subject: z5.string().min(1).max(998),
|
|
466
471
|
preheader: z5.string().max(500).optional(),
|
|
467
|
-
|
|
472
|
+
/**
|
|
473
|
+
* Omitted or null makes the mailing a letter: one recipient at most, sent to
|
|
474
|
+
* anybody not blocked on every topic, with an unsubscribe link that offers
|
|
475
|
+
* every topic and no List-Unsubscribe headers. See "Letters" in the
|
|
476
|
+
* contract's documentation.
|
|
477
|
+
*/
|
|
478
|
+
topic: Slug.nullable().optional(),
|
|
468
479
|
provider_id: Id,
|
|
469
480
|
metadata: MailingMetadata.optional()
|
|
470
481
|
};
|
|
@@ -480,7 +491,8 @@ var MailingUpdate = z5.object({
|
|
|
480
491
|
name: z5.string().max(200).nullable().optional(),
|
|
481
492
|
subject: MailingContent.subject.optional(),
|
|
482
493
|
preheader: z5.string().max(500).nullable().optional(),
|
|
483
|
-
|
|
494
|
+
/** Null turns a draft into a letter, which it can only be with at most one recipient. */
|
|
495
|
+
topic: Slug.nullable().optional(),
|
|
484
496
|
provider_id: Id.optional(),
|
|
485
497
|
metadata: MailingMetadata.optional(),
|
|
486
498
|
document: TemplateDocument.optional()
|
|
@@ -528,6 +540,8 @@ var Recipient = z5.object({
|
|
|
528
540
|
updated_at: Timestamp
|
|
529
541
|
});
|
|
530
542
|
var MAX_RECIPIENTS_PER_BATCH = 1e3;
|
|
543
|
+
var MAX_LETTER_RECIPIENTS = 1;
|
|
544
|
+
var LETTER_RECIPIENT_REFUSAL = "letter_has_one_recipient";
|
|
531
545
|
var RecipientInput = z5.object({
|
|
532
546
|
contact_id: Id.optional(),
|
|
533
547
|
external_id: z5.string().min(1).max(255).optional(),
|
|
@@ -2065,6 +2079,7 @@ var AUDIT_ACTIONS = [
|
|
|
2065
2079
|
"provider.anomaly_cleared",
|
|
2066
2080
|
"topic.created",
|
|
2067
2081
|
"topic.updated",
|
|
2082
|
+
"topic.deleted",
|
|
2068
2083
|
"template.created",
|
|
2069
2084
|
"template.updated",
|
|
2070
2085
|
"template.deleted",
|
|
@@ -3312,6 +3327,16 @@ var sendingRoutes = {
|
|
|
3312
3327
|
access: "admin",
|
|
3313
3328
|
phase: "S2"
|
|
3314
3329
|
},
|
|
3330
|
+
/** Refused with `conflict` while a mailing or an automation step still uses the topic; subscriptions and suppressions on it go with it. */
|
|
3331
|
+
"topics.delete": {
|
|
3332
|
+
method: "DELETE",
|
|
3333
|
+
path: "/v1/topics/:id",
|
|
3334
|
+
params: IdParams,
|
|
3335
|
+
response: Ok,
|
|
3336
|
+
status: 200,
|
|
3337
|
+
access: "admin",
|
|
3338
|
+
phase: "S2"
|
|
3339
|
+
},
|
|
3315
3340
|
"contacts.upsert": {
|
|
3316
3341
|
method: "POST",
|
|
3317
3342
|
path: "/v1/contacts",
|
|
@@ -4432,6 +4457,7 @@ export {
|
|
|
4432
4457
|
InviteListQuery,
|
|
4433
4458
|
InviteStatus,
|
|
4434
4459
|
JsonValue,
|
|
4460
|
+
LETTER_RECIPIENT_REFUSAL,
|
|
4435
4461
|
LIST_UNSUBSCRIBE_POST_VALUE,
|
|
4436
4462
|
MAILING_ACTIONS,
|
|
4437
4463
|
MAILING_KINDS,
|
|
@@ -4450,6 +4476,7 @@ export {
|
|
|
4450
4476
|
MAX_IMPORT_URL_LENGTH,
|
|
4451
4477
|
MAX_INVITE_TTL_DAYS,
|
|
4452
4478
|
MAX_IN_LIST,
|
|
4479
|
+
MAX_LETTER_RECIPIENTS,
|
|
4453
4480
|
MAX_MERGE_DEFAULTS,
|
|
4454
4481
|
MAX_MERGE_DEFAULT_LENGTH,
|
|
4455
4482
|
MAX_MJML_DEPTH,
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.4.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": {
|