@marlinjai/mail-contract 0.18.0 → 0.19.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 +31 -1
- package/dist/index.d.ts +31 -1
- package/dist/index.js +350 -331
- package/dist/index.mjs +348 -331
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -43,6 +43,7 @@ __export(index_exports, {
|
|
|
43
43
|
AbTestState: () => AbTestState,
|
|
44
44
|
AbVariant: () => AbVariant,
|
|
45
45
|
AbWinnerRequest: () => AbWinnerRequest,
|
|
46
|
+
AcceptTerms: () => AcceptTerms,
|
|
46
47
|
ApiKey: () => ApiKey,
|
|
47
48
|
ApiKeyCreate: () => ApiKeyCreate,
|
|
48
49
|
ApiKeyCreated: () => ApiKeyCreated,
|
|
@@ -214,6 +215,7 @@ __export(index_exports, {
|
|
|
214
215
|
InviteListQuery: () => InviteListQuery,
|
|
215
216
|
InviteStatus: () => InviteStatus,
|
|
216
217
|
JsonValue: () => JsonValue,
|
|
218
|
+
LEGAL_TERMS_VERSION: () => LEGAL_TERMS_VERSION,
|
|
217
219
|
LETTER_ONLY_MERGE_FIELDS: () => LETTER_ONLY_MERGE_FIELDS,
|
|
218
220
|
LETTER_RECIPIENT_REFUSAL: () => LETTER_RECIPIENT_REFUSAL,
|
|
219
221
|
LIST_UNSUBSCRIBE_POST_VALUE: () => LIST_UNSUBSCRIBE_POST_VALUE,
|
|
@@ -805,7 +807,7 @@ var API_VERSION_PREFIX = "/v1";
|
|
|
805
807
|
var HEALTH_PATH = "/healthz";
|
|
806
808
|
|
|
807
809
|
// src/workspace.ts
|
|
808
|
-
var
|
|
810
|
+
var import_zod12 = require("zod");
|
|
809
811
|
|
|
810
812
|
// src/automations.ts
|
|
811
813
|
var import_zod10 = require("zod");
|
|
@@ -3437,16 +3439,23 @@ var EventListQuery = PageQuery.extend({
|
|
|
3437
3439
|
contact_id: Id.optional()
|
|
3438
3440
|
});
|
|
3439
3441
|
|
|
3442
|
+
// src/legal.ts
|
|
3443
|
+
var import_zod11 = require("zod");
|
|
3444
|
+
var LEGAL_TERMS_VERSION = "2026-10-23";
|
|
3445
|
+
var AcceptTerms = import_zod11.z.literal(LEGAL_TERMS_VERSION, {
|
|
3446
|
+
errorMap: () => ({ message: `must be "${LEGAL_TERMS_VERSION}": accept the current terms of service and processing agreement` })
|
|
3447
|
+
});
|
|
3448
|
+
|
|
3440
3449
|
// src/workspace.ts
|
|
3441
|
-
var CompanyId =
|
|
3450
|
+
var CompanyId = import_zod12.z.string().min(1).max(64);
|
|
3442
3451
|
var ASSET_POLICIES = ["any", "service_only"];
|
|
3443
|
-
var AssetPolicy =
|
|
3452
|
+
var AssetPolicy = import_zod12.z.enum(ASSET_POLICIES);
|
|
3444
3453
|
var MAX_ALLOWED_ASSET_HOSTS = 20;
|
|
3445
|
-
var AssetHost =
|
|
3446
|
-
var MergeDefaults =
|
|
3454
|
+
var AssetHost = import_zod12.z.string().trim().toLowerCase().min(1).max(253).regex(/^(?=.{1,253}(?::\d{1,5})?$)[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?(\.[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)+(:\d{1,5})?$/, "a host name such as example.com");
|
|
3455
|
+
var MergeDefaults = import_zod12.z.record(MergeFieldName, MergeDefaultValue).refine((m) => Object.keys(m).length <= MAX_MERGE_DEFAULTS, `at most ${MAX_MERGE_DEFAULTS} merge defaults`).refine((m) => !Object.keys(m).some((k) => k in RESERVED_MERGE_FIELDS), {
|
|
3447
3456
|
message: `a reserved merge field (${Object.keys(RESERVED_MERGE_FIELDS).join(", ")}) cannot have a workspace default`
|
|
3448
3457
|
});
|
|
3449
|
-
var WorkspaceSettings =
|
|
3458
|
+
var WorkspaceSettings = import_zod12.z.object({
|
|
3450
3459
|
/**
|
|
3451
3460
|
* The workspace's main language (a {@link LocaleTag}, e.g. "de"): the main
|
|
3452
3461
|
* language of a new template, and of the hosted pages when nothing else
|
|
@@ -3459,9 +3468,9 @@ var WorkspaceSettings = import_zod11.z.object({
|
|
|
3459
3468
|
* each; the hosted pages are offered in those of them they support (English,
|
|
3460
3469
|
* German, French, Italian, Spanish). The service stores canonical casing.
|
|
3461
3470
|
*/
|
|
3462
|
-
locales:
|
|
3471
|
+
locales: import_zod12.z.array(LocaleTag).min(1).max(20).refine((l) => new Set(l.map((t) => t.toLowerCase())).size === l.length, "a language appears twice"),
|
|
3463
3472
|
/** Open and click tracking. Off by default, opt-in per workspace. */
|
|
3464
|
-
tracking_enabled:
|
|
3473
|
+
tracking_enabled: import_zod12.z.boolean(),
|
|
3465
3474
|
/** Where images, stylesheets and fonts in a mail may load from. `any` by default. */
|
|
3466
3475
|
asset_policy: AssetPolicy,
|
|
3467
3476
|
/**
|
|
@@ -3469,7 +3478,7 @@ var WorkspaceSettings = import_zod11.z.object({
|
|
|
3469
3478
|
* the workspace's website, typically. Empty by default. Ignored under `any`,
|
|
3470
3479
|
* which allows everything already.
|
|
3471
3480
|
*/
|
|
3472
|
-
allowed_asset_hosts:
|
|
3481
|
+
allowed_asset_hosts: import_zod12.z.array(AssetHost).max(MAX_ALLOWED_ASSET_HOSTS),
|
|
3473
3482
|
/** Merge values every mail of the workspace can use (see `MergeDefaults`). Empty by default. */
|
|
3474
3483
|
merge_defaults: MergeDefaults,
|
|
3475
3484
|
/**
|
|
@@ -3478,10 +3487,10 @@ var WorkspaceSettings = import_zod11.z.object({
|
|
|
3478
3487
|
*/
|
|
3479
3488
|
default_timezone: TimezoneName.nullable()
|
|
3480
3489
|
});
|
|
3481
|
-
var Workspace =
|
|
3490
|
+
var Workspace = import_zod12.z.object({
|
|
3482
3491
|
id: Id,
|
|
3483
3492
|
slug: Slug,
|
|
3484
|
-
name:
|
|
3493
|
+
name: import_zod12.z.string().min(1).max(120),
|
|
3485
3494
|
settings: WorkspaceSettings,
|
|
3486
3495
|
/**
|
|
3487
3496
|
* The auth-brain company (tenant) the workspace was created for, or null for
|
|
@@ -3492,13 +3501,13 @@ var Workspace = import_zod11.z.object({
|
|
|
3492
3501
|
created_at: Timestamp,
|
|
3493
3502
|
updated_at: Timestamp
|
|
3494
3503
|
});
|
|
3495
|
-
var WorkspaceCreate =
|
|
3504
|
+
var WorkspaceCreate = import_zod12.z.object({
|
|
3496
3505
|
slug: Slug,
|
|
3497
|
-
name:
|
|
3506
|
+
name: import_zod12.z.string().min(1).max(120),
|
|
3498
3507
|
settings: WorkspaceSettings.partial().optional(),
|
|
3499
|
-
owner:
|
|
3508
|
+
owner: import_zod12.z.object({
|
|
3500
3509
|
email: Email,
|
|
3501
|
-
name:
|
|
3510
|
+
name: import_zod12.z.string().max(200).nullable().optional()
|
|
3502
3511
|
}),
|
|
3503
3512
|
/**
|
|
3504
3513
|
* The auth-brain company the workspace is created in. Required since 0.14.0:
|
|
@@ -3507,27 +3516,33 @@ var WorkspaceCreate = import_zod11.z.object({
|
|
|
3507
3516
|
* invitation (`members.syncCompanyRole`). A workspace created before, without
|
|
3508
3517
|
* one, keeps working and simply has no such inheritance.
|
|
3509
3518
|
*/
|
|
3510
|
-
company_id: CompanyId
|
|
3519
|
+
company_id: CompanyId,
|
|
3520
|
+
/**
|
|
3521
|
+
* The person creating the workspace accepts the terms of service and the
|
|
3522
|
+
* processing agreement for its company, of this version (required since
|
|
3523
|
+
* 0.19.0): the workspace processes recipients' data from its first contact.
|
|
3524
|
+
*/
|
|
3525
|
+
accept_terms: AcceptTerms
|
|
3511
3526
|
});
|
|
3512
|
-
var WorkspaceUpdate =
|
|
3513
|
-
name:
|
|
3527
|
+
var WorkspaceUpdate = import_zod12.z.object({
|
|
3528
|
+
name: import_zod12.z.string().min(1).max(120),
|
|
3514
3529
|
settings: WorkspaceSettings.partial()
|
|
3515
3530
|
}).partial().refine((v) => Object.keys(v).length > 0, "at least one field");
|
|
3516
|
-
var WorkspaceMove =
|
|
3531
|
+
var WorkspaceMove = import_zod12.z.object({ company_id: CompanyId });
|
|
3517
3532
|
var MEMBER_ROLES = ["owner", "admin", "editor", "viewer"];
|
|
3518
|
-
var MemberRole =
|
|
3533
|
+
var MemberRole = import_zod12.z.enum(MEMBER_ROLES);
|
|
3519
3534
|
var WorkspaceMembership = Workspace.extend({ role: MemberRole });
|
|
3520
3535
|
var MEMBER_SOURCES = ["invited", "company"];
|
|
3521
|
-
var MemberSource =
|
|
3536
|
+
var MemberSource = import_zod12.z.enum(MEMBER_SOURCES);
|
|
3522
3537
|
var COMPANY_GRANT_ROLES = ["owner", "admin"];
|
|
3523
|
-
var CompanyGrantRole =
|
|
3538
|
+
var CompanyGrantRole = import_zod12.z.enum(COMPANY_GRANT_ROLES);
|
|
3524
3539
|
var COMPANY_ROLE_MAX_AGE_HOURS = 24;
|
|
3525
|
-
var Member =
|
|
3540
|
+
var Member = import_zod12.z.object({
|
|
3526
3541
|
id: Id,
|
|
3527
3542
|
/** The person's auth-brain subject. */
|
|
3528
|
-
subject:
|
|
3543
|
+
subject: import_zod12.z.string().min(1).max(255),
|
|
3529
3544
|
email: Email,
|
|
3530
|
-
name:
|
|
3545
|
+
name: import_zod12.z.string().max(200).nullable(),
|
|
3531
3546
|
/**
|
|
3532
3547
|
* The role in force: the higher of the person's own role in the workspace
|
|
3533
3548
|
* and the one a confirmed company role carries. For a `company` row that is
|
|
@@ -3554,48 +3569,48 @@ var Member = import_zod11.z.object({
|
|
|
3554
3569
|
* false is one whose company role has not been confirmed within
|
|
3555
3570
|
* `COMPANY_ROLE_MAX_AGE_HOURS`; it grants nothing and an admin may remove it.
|
|
3556
3571
|
*/
|
|
3557
|
-
inherited:
|
|
3572
|
+
inherited: import_zod12.z.boolean().optional()
|
|
3558
3573
|
});
|
|
3559
3574
|
var MAX_SYNC_COMPANIES = 100;
|
|
3560
|
-
var MemberCompanySync =
|
|
3575
|
+
var MemberCompanySync = import_zod12.z.object({
|
|
3561
3576
|
email: Email,
|
|
3562
|
-
name:
|
|
3563
|
-
companies:
|
|
3577
|
+
name: import_zod12.z.string().max(200).nullable().optional(),
|
|
3578
|
+
companies: import_zod12.z.array(import_zod12.z.object({ company_id: CompanyId, role: CompanyGrantRole })).max(MAX_SYNC_COMPANIES).refine((list2) => new Set(list2.map((c) => c.company_id)).size === list2.length, "each company at most once")
|
|
3564
3579
|
});
|
|
3565
|
-
var MemberCompanySyncResult =
|
|
3580
|
+
var MemberCompanySyncResult = import_zod12.z.object({
|
|
3566
3581
|
/** Workspaces in which the person now holds a company role they did not hold, or held differently, before this call. */
|
|
3567
|
-
granted:
|
|
3582
|
+
granted: import_zod12.z.array(Id),
|
|
3568
3583
|
/** Workspaces in which a company role was taken away by this call. */
|
|
3569
|
-
revoked:
|
|
3584
|
+
revoked: import_zod12.z.array(Id),
|
|
3570
3585
|
/** Workspaces in which the person's company role was already as stated. */
|
|
3571
|
-
unchanged:
|
|
3586
|
+
unchanged: import_zod12.z.array(Id)
|
|
3572
3587
|
});
|
|
3573
|
-
var MemberCreate =
|
|
3574
|
-
subject:
|
|
3588
|
+
var MemberCreate = import_zod12.z.object({
|
|
3589
|
+
subject: import_zod12.z.string().min(1).max(255),
|
|
3575
3590
|
email: Email,
|
|
3576
|
-
name:
|
|
3591
|
+
name: import_zod12.z.string().max(200).nullable().optional(),
|
|
3577
3592
|
role: MemberRole
|
|
3578
3593
|
});
|
|
3579
|
-
var MemberUpdate =
|
|
3594
|
+
var MemberUpdate = import_zod12.z.object({ role: MemberRole });
|
|
3580
3595
|
var API_KEY_SCOPES = ["full", "read", "send"];
|
|
3581
|
-
var ApiKeyScope =
|
|
3582
|
-
var ApiKey =
|
|
3596
|
+
var ApiKeyScope = import_zod12.z.enum(API_KEY_SCOPES);
|
|
3597
|
+
var ApiKey = import_zod12.z.object({
|
|
3583
3598
|
id: Id,
|
|
3584
|
-
name:
|
|
3599
|
+
name: import_zod12.z.string().min(1).max(120),
|
|
3585
3600
|
/** The first characters of the key, for recognising it in a list. */
|
|
3586
|
-
prefix:
|
|
3601
|
+
prefix: import_zod12.z.string().min(4).max(32),
|
|
3587
3602
|
scope: ApiKeyScope,
|
|
3588
3603
|
last_used_at: Timestamp.nullable(),
|
|
3589
3604
|
revoked_at: Timestamp.nullable(),
|
|
3590
3605
|
created_at: Timestamp
|
|
3591
3606
|
});
|
|
3592
|
-
var ApiKeyCreate =
|
|
3593
|
-
name:
|
|
3607
|
+
var ApiKeyCreate = import_zod12.z.object({
|
|
3608
|
+
name: import_zod12.z.string().min(1).max(120),
|
|
3594
3609
|
/** Omitted means `full`. */
|
|
3595
3610
|
scope: ApiKeyScope.optional()
|
|
3596
3611
|
});
|
|
3597
|
-
var ApiKeyCreated =
|
|
3598
|
-
key:
|
|
3612
|
+
var ApiKeyCreated = import_zod12.z.object({
|
|
3613
|
+
key: import_zod12.z.string().min(20),
|
|
3599
3614
|
api_key: ApiKey
|
|
3600
3615
|
});
|
|
3601
3616
|
var AUDIT_ACTIONS = [
|
|
@@ -3691,14 +3706,14 @@ var AUDIT_ACTIONS = [
|
|
|
3691
3706
|
"automation.run_ended",
|
|
3692
3707
|
"event.recorded"
|
|
3693
3708
|
];
|
|
3694
|
-
var AuditAction =
|
|
3709
|
+
var AuditAction = import_zod12.z.enum(AUDIT_ACTIONS);
|
|
3695
3710
|
var TRUSTED_APPS = ["booking"];
|
|
3696
|
-
var TrustedApp =
|
|
3697
|
-
var AuditActor =
|
|
3698
|
-
|
|
3699
|
-
type:
|
|
3711
|
+
var TrustedApp = import_zod12.z.enum(TRUSTED_APPS);
|
|
3712
|
+
var AuditActor = import_zod12.z.discriminatedUnion("type", [
|
|
3713
|
+
import_zod12.z.object({
|
|
3714
|
+
type: import_zod12.z.literal("member"),
|
|
3700
3715
|
member_id: Id,
|
|
3701
|
-
subject:
|
|
3716
|
+
subject: import_zod12.z.string().min(1),
|
|
3702
3717
|
/**
|
|
3703
3718
|
* The application the person acted through, when it was not the dashboard:
|
|
3704
3719
|
* the service set it from the service token the call carried, so it is
|
|
@@ -3706,26 +3721,26 @@ var AuditActor = import_zod11.z.discriminatedUnion("type", [
|
|
|
3706
3721
|
*/
|
|
3707
3722
|
app: TrustedApp.optional()
|
|
3708
3723
|
}),
|
|
3709
|
-
|
|
3710
|
-
type:
|
|
3724
|
+
import_zod12.z.object({
|
|
3725
|
+
type: import_zod12.z.literal("api_key"),
|
|
3711
3726
|
api_key_id: Id,
|
|
3712
3727
|
/**
|
|
3713
3728
|
* Who the client's application said it was acting for, from
|
|
3714
3729
|
* `ON_BEHALF_OF_HEADER`: reported by that application, never verified.
|
|
3715
3730
|
* Absent when the call carried no label.
|
|
3716
3731
|
*/
|
|
3717
|
-
on_behalf_of:
|
|
3732
|
+
on_behalf_of: import_zod12.z.string().min(1).max(ON_BEHALF_OF_MAX_LENGTH).optional()
|
|
3718
3733
|
}),
|
|
3719
3734
|
/** The service itself (the worker, a bounce, the hosted unsubscribe page). */
|
|
3720
|
-
|
|
3735
|
+
import_zod12.z.object({ type: import_zod12.z.literal("system"), reason: import_zod12.z.string().min(1).max(200) })
|
|
3721
3736
|
]);
|
|
3722
|
-
var AuditEntry =
|
|
3737
|
+
var AuditEntry = import_zod12.z.object({
|
|
3723
3738
|
id: Id,
|
|
3724
3739
|
action: AuditAction,
|
|
3725
3740
|
actor: AuditActor,
|
|
3726
|
-
target_type:
|
|
3741
|
+
target_type: import_zod12.z.string().min(1).max(64),
|
|
3727
3742
|
target_id: Id.nullable(),
|
|
3728
|
-
details:
|
|
3743
|
+
details: import_zod12.z.record(import_zod12.z.unknown()),
|
|
3729
3744
|
created_at: Timestamp
|
|
3730
3745
|
});
|
|
3731
3746
|
var AuditQuery = PageQuery.extend({
|
|
@@ -3734,12 +3749,12 @@ var AuditQuery = PageQuery.extend({
|
|
|
3734
3749
|
});
|
|
3735
3750
|
|
|
3736
3751
|
// src/invites.ts
|
|
3737
|
-
var
|
|
3752
|
+
var import_zod13 = require("zod");
|
|
3738
3753
|
var INVITE_STATUSES = ["pending", "accepted", "revoked", "expired"];
|
|
3739
|
-
var InviteStatus =
|
|
3754
|
+
var InviteStatus = import_zod13.z.enum(INVITE_STATUSES);
|
|
3740
3755
|
var DEFAULT_INVITE_TTL_DAYS = 7;
|
|
3741
3756
|
var MAX_INVITE_TTL_DAYS = 30;
|
|
3742
|
-
var Invite =
|
|
3757
|
+
var Invite = import_zod13.z.object({
|
|
3743
3758
|
id: Id,
|
|
3744
3759
|
/** Stored lowercased; only a person signed in with this address can accept. */
|
|
3745
3760
|
email: Email,
|
|
@@ -3747,32 +3762,32 @@ var Invite = import_zod12.z.object({
|
|
|
3747
3762
|
/** Derived from the timestamps below, never stored. */
|
|
3748
3763
|
status: InviteStatus,
|
|
3749
3764
|
/** The member who invited, while they are still one (null after they left). */
|
|
3750
|
-
invited_by:
|
|
3765
|
+
invited_by: import_zod13.z.object({ member_id: Id.nullable(), email: Email.nullable() }),
|
|
3751
3766
|
expires_at: Timestamp,
|
|
3752
3767
|
accepted_at: Timestamp.nullable(),
|
|
3753
3768
|
revoked_at: Timestamp.nullable(),
|
|
3754
3769
|
created_at: Timestamp
|
|
3755
3770
|
});
|
|
3756
|
-
var InviteCreate =
|
|
3771
|
+
var InviteCreate = import_zod13.z.object({
|
|
3757
3772
|
email: Email,
|
|
3758
3773
|
role: MemberRole,
|
|
3759
|
-
expires_in_days:
|
|
3774
|
+
expires_in_days: import_zod13.z.number().int().min(1).max(MAX_INVITE_TTL_DAYS).optional()
|
|
3760
3775
|
});
|
|
3761
|
-
var InviteCreated =
|
|
3776
|
+
var InviteCreated = import_zod13.z.object({
|
|
3762
3777
|
invite: Invite,
|
|
3763
|
-
token:
|
|
3778
|
+
token: import_zod13.z.string().min(32).max(128)
|
|
3764
3779
|
});
|
|
3765
3780
|
var InviteListQuery = PageQuery.extend({
|
|
3766
3781
|
status: InviteStatus.optional()
|
|
3767
3782
|
});
|
|
3768
|
-
var InviteAccept =
|
|
3769
|
-
token:
|
|
3783
|
+
var InviteAccept = import_zod13.z.object({
|
|
3784
|
+
token: import_zod13.z.string().min(32).max(128),
|
|
3770
3785
|
email: Email,
|
|
3771
|
-
name:
|
|
3786
|
+
name: import_zod13.z.string().max(200).nullable().optional()
|
|
3772
3787
|
});
|
|
3773
|
-
var InviteAccepted =
|
|
3788
|
+
var InviteAccepted = import_zod13.z.object({
|
|
3774
3789
|
workspace: WorkspaceMembership,
|
|
3775
|
-
already_member:
|
|
3790
|
+
already_member: import_zod13.z.boolean()
|
|
3776
3791
|
});
|
|
3777
3792
|
var INVITE_REFUSAL_REASONS = ["email_mismatch", "inviter_lacks_role", "expired", "revoked", "accepted"];
|
|
3778
3793
|
|
|
@@ -4402,13 +4417,13 @@ function renameInsertionEverywhere(drafts, from, rawTo) {
|
|
|
4402
4417
|
}
|
|
4403
4418
|
|
|
4404
4419
|
// src/providers.ts
|
|
4405
|
-
var
|
|
4420
|
+
var import_zod14 = require("zod");
|
|
4406
4421
|
var PROVIDER_KINDS = ["smtp", "resend"];
|
|
4407
|
-
var ProviderKind =
|
|
4408
|
-
var ProviderPolicy =
|
|
4409
|
-
daily_recipient_budget:
|
|
4410
|
-
min_interval_ms:
|
|
4411
|
-
max_recipients_per_message:
|
|
4422
|
+
var ProviderKind = import_zod14.z.enum(PROVIDER_KINDS);
|
|
4423
|
+
var ProviderPolicy = import_zod14.z.object({
|
|
4424
|
+
daily_recipient_budget: import_zod14.z.number().int().min(1).max(1e7),
|
|
4425
|
+
min_interval_ms: import_zod14.z.number().int().min(0).max(36e5),
|
|
4426
|
+
max_recipients_per_message: import_zod14.z.number().int().min(1).max(1e3)
|
|
4412
4427
|
});
|
|
4413
4428
|
var ICLOUD_SMTP_POLICY = {
|
|
4414
4429
|
daily_recipient_budget: 800,
|
|
@@ -4416,17 +4431,17 @@ var ICLOUD_SMTP_POLICY = {
|
|
|
4416
4431
|
max_recipients_per_message: 1
|
|
4417
4432
|
};
|
|
4418
4433
|
var SMTP_SECURITY = ["tls", "starttls"];
|
|
4419
|
-
var SmtpConfigBase =
|
|
4420
|
-
host:
|
|
4421
|
-
port:
|
|
4434
|
+
var SmtpConfigBase = import_zod14.z.object({
|
|
4435
|
+
host: import_zod14.z.string().min(1).max(255),
|
|
4436
|
+
port: import_zod14.z.number().int().min(1).max(65535),
|
|
4422
4437
|
/** `tls` connects encrypted (465), `starttls` upgrades (587). Never plaintext. */
|
|
4423
|
-
security:
|
|
4424
|
-
username:
|
|
4438
|
+
security: import_zod14.z.enum(SMTP_SECURITY),
|
|
4439
|
+
username: import_zod14.z.string().min(1).max(255)
|
|
4425
4440
|
});
|
|
4426
|
-
var ResendConfigBase =
|
|
4427
|
-
var ProviderRejections =
|
|
4428
|
-
count:
|
|
4429
|
-
last_error:
|
|
4441
|
+
var ResendConfigBase = import_zod14.z.object({});
|
|
4442
|
+
var ProviderRejections = import_zod14.z.object({
|
|
4443
|
+
count: import_zod14.z.number().int().min(0),
|
|
4444
|
+
last_error: import_zod14.z.string().nullable(),
|
|
4430
4445
|
last_at: Timestamp.nullable(),
|
|
4431
4446
|
/**
|
|
4432
4447
|
* The last time the bounce circuit breaker tripped on one of this provider's
|
|
@@ -4436,59 +4451,59 @@ var ProviderRejections = import_zod13.z.object({
|
|
|
4436
4451
|
* run's bounce blocks were undone and the mailing paused. `sample` is the
|
|
4437
4452
|
* reply that tripped it.
|
|
4438
4453
|
*/
|
|
4439
|
-
anomaly:
|
|
4454
|
+
anomaly: import_zod14.z.object({
|
|
4440
4455
|
at: Timestamp,
|
|
4441
4456
|
/** `mailing`: one mailing was paused. `provider`: 5 refusals in a row with the same reply across the provider's sends (test sends and one-recipient mailings included) within 24 hours. */
|
|
4442
|
-
scope:
|
|
4457
|
+
scope: import_zod14.z.enum(["mailing", "provider"]),
|
|
4443
4458
|
/**
|
|
4444
4459
|
* True while the provider-wide breaker is open: no bounce blocks through
|
|
4445
4460
|
* this provider, test sends refused and mailings not started or resumed
|
|
4446
4461
|
* (`provider_anomaly`), until an admin clears it (`providers.clearAnomaly`).
|
|
4447
4462
|
*/
|
|
4448
|
-
blocking:
|
|
4463
|
+
blocking: import_zod14.z.boolean(),
|
|
4449
4464
|
mailing_id: Id.nullable(),
|
|
4450
|
-
reason:
|
|
4451
|
-
sample:
|
|
4465
|
+
reason: import_zod14.z.string(),
|
|
4466
|
+
sample: import_zod14.z.string()
|
|
4452
4467
|
}).nullable()
|
|
4453
4468
|
});
|
|
4454
|
-
var ProviderEvents =
|
|
4455
|
-
status:
|
|
4456
|
-
source:
|
|
4457
|
-
url:
|
|
4458
|
-
error:
|
|
4469
|
+
var ProviderEvents = import_zod14.z.object({
|
|
4470
|
+
status: import_zod14.z.enum(["active", "needs_secret"]),
|
|
4471
|
+
source: import_zod14.z.enum(["automatic", "manual", "managed"]).nullable(),
|
|
4472
|
+
url: import_zod14.z.string().url(),
|
|
4473
|
+
error: import_zod14.z.string().nullable(),
|
|
4459
4474
|
/**
|
|
4460
4475
|
* Events that named an email this provider never sent through the service
|
|
4461
4476
|
* (another workspace or system sharing the Resend account): counted, never
|
|
4462
4477
|
* acted on.
|
|
4463
4478
|
*/
|
|
4464
|
-
unmatched:
|
|
4479
|
+
unmatched: import_zod14.z.number().int().min(0)
|
|
4465
4480
|
});
|
|
4466
4481
|
var RESEND_EVENT_TYPES = ["email.bounced", "email.complained", "email.delivery_delayed"];
|
|
4467
|
-
var ResendSigningSecret =
|
|
4468
|
-
var ProviderEventsSecret =
|
|
4482
|
+
var ResendSigningSecret = import_zod14.z.string().max(200).regex(/^whsec_[A-Za-z0-9+/]{16,}={0,2}$/, "must be the signing secret Resend shows, starting with whsec_");
|
|
4483
|
+
var ProviderEventsSecret = import_zod14.z.object({ signing_secret: ResendSigningSecret });
|
|
4469
4484
|
var ProviderFields = {
|
|
4470
|
-
name:
|
|
4471
|
-
from_name:
|
|
4485
|
+
name: import_zod14.z.string().min(1).max(120),
|
|
4486
|
+
from_name: import_zod14.z.string().min(1).max(120),
|
|
4472
4487
|
from_email: Email,
|
|
4473
4488
|
reply_to: Email.nullable(),
|
|
4474
4489
|
policy: ProviderPolicy
|
|
4475
4490
|
};
|
|
4476
|
-
var Provider =
|
|
4477
|
-
|
|
4491
|
+
var Provider = import_zod14.z.discriminatedUnion("kind", [
|
|
4492
|
+
import_zod14.z.object({
|
|
4478
4493
|
id: Id,
|
|
4479
|
-
kind:
|
|
4494
|
+
kind: import_zod14.z.literal("smtp"),
|
|
4480
4495
|
config: SmtpConfigBase,
|
|
4481
|
-
has_secret:
|
|
4496
|
+
has_secret: import_zod14.z.boolean(),
|
|
4482
4497
|
...ProviderFields,
|
|
4483
4498
|
rejections: ProviderRejections,
|
|
4484
4499
|
created_at: Timestamp,
|
|
4485
4500
|
updated_at: Timestamp
|
|
4486
4501
|
}),
|
|
4487
|
-
|
|
4502
|
+
import_zod14.z.object({
|
|
4488
4503
|
id: Id,
|
|
4489
|
-
kind:
|
|
4504
|
+
kind: import_zod14.z.literal("resend"),
|
|
4490
4505
|
config: ResendConfigBase,
|
|
4491
|
-
has_secret:
|
|
4506
|
+
has_secret: import_zod14.z.boolean(),
|
|
4492
4507
|
...ProviderFields,
|
|
4493
4508
|
rejections: ProviderRejections,
|
|
4494
4509
|
events: ProviderEvents,
|
|
@@ -4496,31 +4511,31 @@ var Provider = import_zod13.z.discriminatedUnion("kind", [
|
|
|
4496
4511
|
updated_at: Timestamp
|
|
4497
4512
|
})
|
|
4498
4513
|
]);
|
|
4499
|
-
var ProviderCreate =
|
|
4500
|
-
|
|
4501
|
-
kind:
|
|
4502
|
-
config: SmtpConfigBase.extend({ password:
|
|
4514
|
+
var ProviderCreate = import_zod14.z.discriminatedUnion("kind", [
|
|
4515
|
+
import_zod14.z.object({
|
|
4516
|
+
kind: import_zod14.z.literal("smtp"),
|
|
4517
|
+
config: SmtpConfigBase.extend({ password: import_zod14.z.string().min(1).max(1024) }),
|
|
4503
4518
|
...ProviderFields
|
|
4504
4519
|
}),
|
|
4505
|
-
|
|
4506
|
-
kind:
|
|
4507
|
-
config: ResendConfigBase.extend({ api_key:
|
|
4520
|
+
import_zod14.z.object({
|
|
4521
|
+
kind: import_zod14.z.literal("resend"),
|
|
4522
|
+
config: ResendConfigBase.extend({ api_key: import_zod14.z.string().min(1).max(1024) }),
|
|
4508
4523
|
...ProviderFields
|
|
4509
4524
|
})
|
|
4510
4525
|
]);
|
|
4511
|
-
var ProviderUpdate =
|
|
4512
|
-
|
|
4513
|
-
kind:
|
|
4514
|
-
config: SmtpConfigBase.extend({ password:
|
|
4526
|
+
var ProviderUpdate = import_zod14.z.discriminatedUnion("kind", [
|
|
4527
|
+
import_zod14.z.object({
|
|
4528
|
+
kind: import_zod14.z.literal("smtp"),
|
|
4529
|
+
config: SmtpConfigBase.extend({ password: import_zod14.z.string().min(1).max(1024).optional() }).partial().optional(),
|
|
4515
4530
|
name: ProviderFields.name.optional(),
|
|
4516
4531
|
from_name: ProviderFields.from_name.optional(),
|
|
4517
4532
|
from_email: ProviderFields.from_email.optional(),
|
|
4518
4533
|
reply_to: ProviderFields.reply_to.optional(),
|
|
4519
4534
|
policy: ProviderPolicy.partial().optional()
|
|
4520
4535
|
}),
|
|
4521
|
-
|
|
4522
|
-
kind:
|
|
4523
|
-
config: ResendConfigBase.extend({ api_key:
|
|
4536
|
+
import_zod14.z.object({
|
|
4537
|
+
kind: import_zod14.z.literal("resend"),
|
|
4538
|
+
config: ResendConfigBase.extend({ api_key: import_zod14.z.string().min(1).max(1024).optional() }).optional(),
|
|
4524
4539
|
name: ProviderFields.name.optional(),
|
|
4525
4540
|
from_name: ProviderFields.from_name.optional(),
|
|
4526
4541
|
from_email: ProviderFields.from_email.optional(),
|
|
@@ -4528,37 +4543,37 @@ var ProviderUpdate = import_zod13.z.discriminatedUnion("kind", [
|
|
|
4528
4543
|
policy: ProviderPolicy.partial().optional()
|
|
4529
4544
|
})
|
|
4530
4545
|
]);
|
|
4531
|
-
var ProviderUsage =
|
|
4546
|
+
var ProviderUsage = import_zod14.z.object({
|
|
4532
4547
|
provider_id: Id,
|
|
4533
|
-
recipients_last_24h:
|
|
4534
|
-
remaining_budget:
|
|
4548
|
+
recipients_last_24h: import_zod14.z.number().int().min(0),
|
|
4549
|
+
remaining_budget: import_zod14.z.number().int().min(0),
|
|
4535
4550
|
/** When enough of the rolling window frees up to send again, if exhausted. */
|
|
4536
4551
|
next_capacity_at: Timestamp.nullable()
|
|
4537
4552
|
});
|
|
4538
|
-
var ProviderVerifyResult =
|
|
4539
|
-
ok:
|
|
4540
|
-
error:
|
|
4553
|
+
var ProviderVerifyResult = import_zod14.z.object({
|
|
4554
|
+
ok: import_zod14.z.boolean(),
|
|
4555
|
+
error: import_zod14.z.string().nullable()
|
|
4541
4556
|
});
|
|
4542
4557
|
|
|
4543
4558
|
// src/sending-domains.ts
|
|
4544
|
-
var
|
|
4559
|
+
var import_zod15 = require("zod");
|
|
4545
4560
|
var SENDING_DOMAIN_STATUSES = ["pending_dns", "verifying", "verified", "failed", "temporary_failure"];
|
|
4546
|
-
var SendingDomainStatus =
|
|
4561
|
+
var SendingDomainStatus = import_zod15.z.enum(SENDING_DOMAIN_STATUSES);
|
|
4547
4562
|
var SENDING_DOMAIN_DNS_MODES = ["manual", "managed"];
|
|
4548
|
-
var SendingDomainDnsMode =
|
|
4563
|
+
var SendingDomainDnsMode = import_zod15.z.enum(SENDING_DOMAIN_DNS_MODES);
|
|
4549
4564
|
var SENDING_DOMAIN_REGION = "eu-west-1";
|
|
4550
|
-
var SendingDomainName =
|
|
4565
|
+
var SendingDomainName = import_zod15.z.string().trim().toLowerCase().max(253).regex(
|
|
4551
4566
|
/^(?=.{1,253}$)(?!-)[a-z0-9-]{1,63}(?<!-)(\.(?!-)[a-z0-9-]{1,63}(?<!-))*\.[a-z]{2,63}$/,
|
|
4552
4567
|
"must be a domain such as example.com, without https:// or an @"
|
|
4553
4568
|
);
|
|
4554
|
-
var SendingDomainRecord =
|
|
4555
|
-
record:
|
|
4556
|
-
name:
|
|
4557
|
-
type:
|
|
4558
|
-
value:
|
|
4559
|
-
ttl:
|
|
4560
|
-
status:
|
|
4561
|
-
priority:
|
|
4569
|
+
var SendingDomainRecord = import_zod15.z.object({
|
|
4570
|
+
record: import_zod15.z.string().max(40),
|
|
4571
|
+
name: import_zod15.z.string().max(253),
|
|
4572
|
+
type: import_zod15.z.string().max(10),
|
|
4573
|
+
value: import_zod15.z.string().max(4096),
|
|
4574
|
+
ttl: import_zod15.z.string().max(20),
|
|
4575
|
+
status: import_zod15.z.string().max(40),
|
|
4576
|
+
priority: import_zod15.z.number().int().min(0).max(65535).optional()
|
|
4562
4577
|
});
|
|
4563
4578
|
function sendingDomainRecordFullName(domain, name) {
|
|
4564
4579
|
const d = domain.toLowerCase();
|
|
@@ -4571,66 +4586,66 @@ function sendingDomainRecordFullName(domain, name) {
|
|
|
4571
4586
|
}
|
|
4572
4587
|
return `${n}.${d}`;
|
|
4573
4588
|
}
|
|
4574
|
-
var SendingDomain =
|
|
4589
|
+
var SendingDomain = import_zod15.z.object({
|
|
4575
4590
|
id: Id,
|
|
4576
|
-
domain:
|
|
4577
|
-
from_name:
|
|
4591
|
+
domain: import_zod15.z.string(),
|
|
4592
|
+
from_name: import_zod15.z.string(),
|
|
4578
4593
|
from_email: Email,
|
|
4579
4594
|
reply_to: Email.nullable(),
|
|
4580
4595
|
status: SendingDomainStatus,
|
|
4581
4596
|
dns_mode: SendingDomainDnsMode,
|
|
4582
|
-
records:
|
|
4597
|
+
records: import_zod15.z.array(SendingDomainRecord),
|
|
4583
4598
|
provider_id: Id.nullable(),
|
|
4584
4599
|
checked_at: Timestamp.nullable(),
|
|
4585
4600
|
verified_at: Timestamp.nullable(),
|
|
4586
|
-
last_error:
|
|
4601
|
+
last_error: import_zod15.z.string().nullable(),
|
|
4587
4602
|
created_at: Timestamp,
|
|
4588
4603
|
updated_at: Timestamp
|
|
4589
4604
|
});
|
|
4590
4605
|
var SenderFields = {
|
|
4591
|
-
from_name:
|
|
4606
|
+
from_name: import_zod15.z.string().trim().min(1).max(120),
|
|
4592
4607
|
from_email: Email,
|
|
4593
4608
|
reply_to: Email.nullable().optional()
|
|
4594
4609
|
};
|
|
4595
4610
|
function senderOnDomain(input, ctx) {
|
|
4596
4611
|
const at = input.from_email.lastIndexOf("@");
|
|
4597
4612
|
if (at < 0 || input.from_email.slice(at + 1).toLowerCase() !== input.domain) {
|
|
4598
|
-
ctx.addIssue({ code:
|
|
4613
|
+
ctx.addIssue({ code: import_zod15.z.ZodIssueCode.custom, path: ["from_email"], message: `must be an address on ${input.domain}` });
|
|
4599
4614
|
}
|
|
4600
4615
|
}
|
|
4601
|
-
var SendingDomainCreate =
|
|
4602
|
-
var SendingDomainUpdate =
|
|
4616
|
+
var SendingDomainCreate = import_zod15.z.object({ domain: SendingDomainName, ...SenderFields }).superRefine(senderOnDomain);
|
|
4617
|
+
var SendingDomainUpdate = import_zod15.z.object({ from_name: SenderFields.from_name.optional(), from_email: Email.optional(), reply_to: Email.nullable().optional() }).refine((v) => Object.keys(v).length > 0, "nothing to change");
|
|
4603
4618
|
|
|
4604
4619
|
// src/contacts.ts
|
|
4605
|
-
var
|
|
4606
|
-
var Topic =
|
|
4620
|
+
var import_zod16 = require("zod");
|
|
4621
|
+
var Topic = import_zod16.z.object({
|
|
4607
4622
|
id: Id,
|
|
4608
4623
|
slug: Slug,
|
|
4609
|
-
name:
|
|
4624
|
+
name: import_zod16.z.string().min(1).max(120),
|
|
4610
4625
|
/** Shown on the hosted preference page. */
|
|
4611
|
-
description:
|
|
4626
|
+
description: import_zod16.z.string().max(1e3).nullable(),
|
|
4612
4627
|
/** Translations of `name` and `description` per locale, for the hosted page. */
|
|
4613
|
-
translations:
|
|
4614
|
-
|
|
4628
|
+
translations: import_zod16.z.record(
|
|
4629
|
+
import_zod16.z.object({ name: import_zod16.z.string().min(1).max(120), description: import_zod16.z.string().max(1e3).nullable() })
|
|
4615
4630
|
),
|
|
4616
4631
|
created_at: Timestamp,
|
|
4617
4632
|
updated_at: Timestamp
|
|
4618
4633
|
});
|
|
4619
|
-
var TopicCreate =
|
|
4634
|
+
var TopicCreate = import_zod16.z.object({
|
|
4620
4635
|
slug: Slug,
|
|
4621
|
-
name:
|
|
4622
|
-
description:
|
|
4636
|
+
name: import_zod16.z.string().min(1).max(120),
|
|
4637
|
+
description: import_zod16.z.string().max(1e3).optional(),
|
|
4623
4638
|
translations: Topic.shape.translations.optional()
|
|
4624
4639
|
});
|
|
4625
4640
|
var TopicUpdate = TopicCreate.omit({ slug: true }).partial().refine((v) => Object.keys(v).length > 0, "at least one field");
|
|
4626
|
-
var Contact =
|
|
4641
|
+
var Contact = import_zod16.z.object({
|
|
4627
4642
|
id: Id,
|
|
4628
|
-
external_id:
|
|
4643
|
+
external_id: import_zod16.z.string().min(1).max(255).nullable(),
|
|
4629
4644
|
/** Stored lowercased, unique per workspace. */
|
|
4630
4645
|
email: Email,
|
|
4631
|
-
first_name:
|
|
4632
|
-
last_name:
|
|
4633
|
-
locale:
|
|
4646
|
+
first_name: import_zod16.z.string().max(200).nullable(),
|
|
4647
|
+
last_name: import_zod16.z.string().max(200).nullable(),
|
|
4648
|
+
locale: import_zod16.z.string().min(2).max(35).nullable(),
|
|
4634
4649
|
/**
|
|
4635
4650
|
* The person's own time zone, an IANA name such as `Europe/Berlin` (A1).
|
|
4636
4651
|
* Every wall clock an automation waits for is read in it, falling back to the
|
|
@@ -4638,65 +4653,65 @@ var Contact = import_zod15.z.object({
|
|
|
4638
4653
|
*/
|
|
4639
4654
|
timezone: TimezoneName.nullable(),
|
|
4640
4655
|
properties: Properties,
|
|
4641
|
-
topics:
|
|
4656
|
+
topics: import_zod16.z.array(Slug),
|
|
4642
4657
|
/** The slugs of the contact's tags (S4). */
|
|
4643
|
-
tags:
|
|
4658
|
+
tags: import_zod16.z.array(Slug),
|
|
4644
4659
|
created_at: Timestamp,
|
|
4645
4660
|
updated_at: Timestamp
|
|
4646
4661
|
});
|
|
4647
|
-
var ContactUpsert =
|
|
4648
|
-
external_id:
|
|
4662
|
+
var ContactUpsert = import_zod16.z.object({
|
|
4663
|
+
external_id: import_zod16.z.string().min(1).max(255).optional(),
|
|
4649
4664
|
email: Email.optional(),
|
|
4650
|
-
first_name:
|
|
4651
|
-
last_name:
|
|
4652
|
-
locale:
|
|
4665
|
+
first_name: import_zod16.z.string().max(200).nullable().optional(),
|
|
4666
|
+
last_name: import_zod16.z.string().max(200).nullable().optional(),
|
|
4667
|
+
locale: import_zod16.z.string().min(2).max(35).nullable().optional(),
|
|
4653
4668
|
timezone: TimezoneName.nullable().optional(),
|
|
4654
4669
|
properties: Properties.optional(),
|
|
4655
|
-
topics:
|
|
4670
|
+
topics: import_zod16.z.array(Slug).max(100).optional()
|
|
4656
4671
|
}).refine((v) => v.external_id !== void 0 || v.email !== void 0, {
|
|
4657
4672
|
message: "external_id or email is required",
|
|
4658
4673
|
path: ["email"]
|
|
4659
4674
|
});
|
|
4660
|
-
var ContactUpsertResult =
|
|
4675
|
+
var ContactUpsertResult = import_zod16.z.object({
|
|
4661
4676
|
contact: Contact,
|
|
4662
|
-
created:
|
|
4677
|
+
created: import_zod16.z.boolean()
|
|
4663
4678
|
});
|
|
4664
4679
|
var ContactListQuery = PageQuery.extend({
|
|
4665
|
-
email:
|
|
4666
|
-
external_id:
|
|
4680
|
+
email: import_zod16.z.string().min(1).max(254).optional(),
|
|
4681
|
+
external_id: import_zod16.z.string().min(1).max(255).optional(),
|
|
4667
4682
|
topic: Slug.optional()
|
|
4668
4683
|
});
|
|
4669
|
-
var ContactErased =
|
|
4670
|
-
ok:
|
|
4671
|
-
erased_messages:
|
|
4672
|
-
erased_recipients:
|
|
4673
|
-
suppressions_kept:
|
|
4684
|
+
var ContactErased = import_zod16.z.object({
|
|
4685
|
+
ok: import_zod16.z.literal(true),
|
|
4686
|
+
erased_messages: import_zod16.z.number().int().min(0),
|
|
4687
|
+
erased_recipients: import_zod16.z.number().int().min(0),
|
|
4688
|
+
suppressions_kept: import_zod16.z.number().int().min(0)
|
|
4674
4689
|
});
|
|
4675
4690
|
var SUPPRESSION_REASONS = ["unsubscribed", "bounced", "complained", "manual"];
|
|
4676
|
-
var SuppressionReason =
|
|
4677
|
-
var Suppression =
|
|
4691
|
+
var SuppressionReason = import_zod16.z.enum(SUPPRESSION_REASONS);
|
|
4692
|
+
var Suppression = import_zod16.z.object({
|
|
4678
4693
|
id: Id,
|
|
4679
4694
|
email: Email,
|
|
4680
4695
|
reason: SuppressionReason,
|
|
4681
4696
|
topic: Slug.nullable(),
|
|
4682
4697
|
source_message_id: Id.nullable(),
|
|
4683
|
-
note:
|
|
4698
|
+
note: import_zod16.z.string().max(1e3).nullable(),
|
|
4684
4699
|
created_at: Timestamp
|
|
4685
4700
|
});
|
|
4686
|
-
var SuppressionCreate =
|
|
4701
|
+
var SuppressionCreate = import_zod16.z.object({
|
|
4687
4702
|
email: Email,
|
|
4688
|
-
reason:
|
|
4703
|
+
reason: import_zod16.z.enum(["manual", "unsubscribed"]),
|
|
4689
4704
|
topic: Slug.nullable().optional(),
|
|
4690
|
-
note:
|
|
4705
|
+
note: import_zod16.z.string().max(1e3).optional()
|
|
4691
4706
|
});
|
|
4692
4707
|
var SuppressionListQuery = PageQuery.extend({
|
|
4693
|
-
email:
|
|
4708
|
+
email: import_zod16.z.string().min(1).max(254).optional(),
|
|
4694
4709
|
reason: SuppressionReason.optional(),
|
|
4695
4710
|
topic: Slug.optional()
|
|
4696
4711
|
});
|
|
4697
4712
|
|
|
4698
4713
|
// src/webhooks.ts
|
|
4699
|
-
var
|
|
4714
|
+
var import_zod17 = require("zod");
|
|
4700
4715
|
var WEBHOOK_EVENT_TYPES = [
|
|
4701
4716
|
"message.sent",
|
|
4702
4717
|
"message.failed",
|
|
@@ -4740,23 +4755,23 @@ var WEBHOOK_EVENT_TYPES = [
|
|
|
4740
4755
|
"template.updated",
|
|
4741
4756
|
"template.deleted"
|
|
4742
4757
|
];
|
|
4743
|
-
var WebhookEventType =
|
|
4744
|
-
var MessageEventBase =
|
|
4758
|
+
var WebhookEventType = import_zod17.z.enum(WEBHOOK_EVENT_TYPES);
|
|
4759
|
+
var MessageEventBase = import_zod17.z.object({
|
|
4745
4760
|
message_id: Id,
|
|
4746
4761
|
mailing_id: Id.nullable(),
|
|
4747
4762
|
mailing_metadata: MailingMetadata.nullable(),
|
|
4748
4763
|
recipient_id: Id.nullable(),
|
|
4749
4764
|
contact_id: Id.nullable(),
|
|
4750
|
-
external_id:
|
|
4765
|
+
external_id: import_zod17.z.string().nullable(),
|
|
4751
4766
|
email: Email,
|
|
4752
|
-
subject:
|
|
4767
|
+
subject: import_zod17.z.string(),
|
|
4753
4768
|
topic: Slug.nullable(),
|
|
4754
|
-
provider_message_id:
|
|
4755
|
-
is_test:
|
|
4769
|
+
provider_message_id: import_zod17.z.string().nullable(),
|
|
4770
|
+
is_test: import_zod17.z.boolean()
|
|
4756
4771
|
});
|
|
4757
4772
|
var MessageSentData = MessageEventBase.extend({
|
|
4758
4773
|
/** The final HTML as sent, so the client can archive it beside its own records. */
|
|
4759
|
-
html:
|
|
4774
|
+
html: import_zod17.z.string(),
|
|
4760
4775
|
sent_at: Timestamp,
|
|
4761
4776
|
/**
|
|
4762
4777
|
* The choice each insertion made (see `Message.insertions`); absent or null
|
|
@@ -4767,20 +4782,20 @@ var MessageSentData = MessageEventBase.extend({
|
|
|
4767
4782
|
insertions: InsertionChoices.nullish()
|
|
4768
4783
|
});
|
|
4769
4784
|
var MessageFailedData = MessageEventBase.extend({
|
|
4770
|
-
error:
|
|
4785
|
+
error: import_zod17.z.string(),
|
|
4771
4786
|
/** False when the provider rejected permanently; the recipient will not be retried. */
|
|
4772
|
-
retryable:
|
|
4787
|
+
retryable: import_zod17.z.boolean(),
|
|
4773
4788
|
failed_at: Timestamp
|
|
4774
4789
|
});
|
|
4775
4790
|
var UNSUBSCRIBE_SOURCES = ["hosted_page", "one_click", "api", "dashboard", "signup_form"];
|
|
4776
|
-
var ContactUnsubscribedData =
|
|
4791
|
+
var ContactUnsubscribedData = import_zod17.z.object({
|
|
4777
4792
|
contact_id: Id.nullable(),
|
|
4778
|
-
external_id:
|
|
4793
|
+
external_id: import_zod17.z.string().nullable(),
|
|
4779
4794
|
email: Email,
|
|
4780
4795
|
/** The topic unsubscribed from; null means every topic. */
|
|
4781
4796
|
topic: Slug.nullable(),
|
|
4782
4797
|
mailing_id: Id.nullable(),
|
|
4783
|
-
source:
|
|
4798
|
+
source: import_zod17.z.enum(UNSUBSCRIBE_SOURCES),
|
|
4784
4799
|
unsubscribed_at: Timestamp
|
|
4785
4800
|
});
|
|
4786
4801
|
var ContactResubscribedData = ContactUnsubscribedData.omit({ unsubscribed_at: true }).extend({
|
|
@@ -4789,142 +4804,142 @@ var ContactResubscribedData = ContactUnsubscribedData.omit({ unsubscribed_at: tr
|
|
|
4789
4804
|
* breaker undid a `bounced` block it judged false (a `contact.bounced` for the
|
|
4790
4805
|
* same address and mailing went out before); `topic` is null.
|
|
4791
4806
|
*/
|
|
4792
|
-
source:
|
|
4807
|
+
source: import_zod17.z.enum([...UNSUBSCRIBE_SOURCES, "bounce_reverted"]),
|
|
4793
4808
|
resubscribed_at: Timestamp
|
|
4794
4809
|
});
|
|
4795
|
-
var ContactBouncedData =
|
|
4810
|
+
var ContactBouncedData = import_zod17.z.object({
|
|
4796
4811
|
contact_id: Id.nullable(),
|
|
4797
|
-
external_id:
|
|
4812
|
+
external_id: import_zod17.z.string().nullable(),
|
|
4798
4813
|
email: Email,
|
|
4799
4814
|
/** `bounced` for a hard bounce, `complained` for a spam complaint. */
|
|
4800
|
-
reason:
|
|
4815
|
+
reason: import_zod17.z.enum(["bounced", "complained"]),
|
|
4801
4816
|
message_id: Id.nullable(),
|
|
4802
|
-
diagnostic:
|
|
4817
|
+
diagnostic: import_zod17.z.string().nullable(),
|
|
4803
4818
|
bounced_at: Timestamp
|
|
4804
4819
|
});
|
|
4805
|
-
var MailingFinishedData =
|
|
4820
|
+
var MailingFinishedData = import_zod17.z.object({
|
|
4806
4821
|
mailing_id: Id,
|
|
4807
4822
|
mailing_metadata: MailingMetadata,
|
|
4808
|
-
status:
|
|
4823
|
+
status: import_zod17.z.enum(["sent", "partially_failed", "cancelled"]),
|
|
4809
4824
|
counts: MailingCounts,
|
|
4810
4825
|
finished_at: Timestamp
|
|
4811
4826
|
});
|
|
4812
|
-
var ContactSubscribedData =
|
|
4827
|
+
var ContactSubscribedData = import_zod17.z.object({
|
|
4813
4828
|
contact_id: Id,
|
|
4814
|
-
external_id:
|
|
4829
|
+
external_id: import_zod17.z.string().nullable(),
|
|
4815
4830
|
email: Email,
|
|
4816
|
-
topics:
|
|
4817
|
-
source:
|
|
4831
|
+
topics: import_zod17.z.array(Slug),
|
|
4832
|
+
source: import_zod17.z.enum(["signup_form", "api", "dashboard", "automation"]),
|
|
4818
4833
|
signup_form_id: Id.nullable(),
|
|
4819
|
-
signup_form_version:
|
|
4834
|
+
signup_form_version: import_zod17.z.number().int().min(1).nullable(),
|
|
4820
4835
|
subscribed_at: Timestamp
|
|
4821
4836
|
});
|
|
4822
|
-
var ImportFinishedData =
|
|
4837
|
+
var ImportFinishedData = import_zod17.z.object({
|
|
4823
4838
|
import_id: Id,
|
|
4824
|
-
status:
|
|
4839
|
+
status: import_zod17.z.enum(["completed", "cancelled", "failed"]),
|
|
4825
4840
|
result: ImportReport.nullable(),
|
|
4826
|
-
error:
|
|
4841
|
+
error: import_zod17.z.string().nullable(),
|
|
4827
4842
|
finished_at: Timestamp
|
|
4828
4843
|
});
|
|
4829
|
-
var MailingScheduledData =
|
|
4844
|
+
var MailingScheduledData = import_zod17.z.object({
|
|
4830
4845
|
mailing_id: Id,
|
|
4831
4846
|
mailing_metadata: MailingMetadata,
|
|
4832
4847
|
scheduled_at: Timestamp.nullable()
|
|
4833
4848
|
});
|
|
4834
|
-
var MailingStartedData =
|
|
4849
|
+
var MailingStartedData = import_zod17.z.object({
|
|
4835
4850
|
mailing_id: Id,
|
|
4836
4851
|
mailing_metadata: MailingMetadata,
|
|
4837
|
-
trigger:
|
|
4838
|
-
recipients:
|
|
4852
|
+
trigger: import_zod17.z.enum(["send", "schedule"]),
|
|
4853
|
+
recipients: import_zod17.z.number().int().min(0),
|
|
4839
4854
|
started_at: Timestamp
|
|
4840
4855
|
});
|
|
4841
|
-
var MailingScheduleFailedData =
|
|
4856
|
+
var MailingScheduleFailedData = import_zod17.z.object({
|
|
4842
4857
|
mailing_id: Id,
|
|
4843
4858
|
mailing_metadata: MailingMetadata,
|
|
4844
|
-
code:
|
|
4845
|
-
message:
|
|
4859
|
+
code: import_zod17.z.string(),
|
|
4860
|
+
message: import_zod17.z.string(),
|
|
4846
4861
|
failed_at: Timestamp
|
|
4847
4862
|
});
|
|
4848
|
-
var MailingAbWinnerSelectedData =
|
|
4863
|
+
var MailingAbWinnerSelectedData = import_zod17.z.object({
|
|
4849
4864
|
mailing_id: Id,
|
|
4850
4865
|
mailing_metadata: MailingMetadata,
|
|
4851
|
-
winner:
|
|
4852
|
-
decided_by:
|
|
4853
|
-
variants:
|
|
4866
|
+
winner: import_zod17.z.string(),
|
|
4867
|
+
decided_by: import_zod17.z.enum(["metric", "manual"]),
|
|
4868
|
+
variants: import_zod17.z.array(VariantAnalytics),
|
|
4854
4869
|
decided_at: Timestamp
|
|
4855
4870
|
});
|
|
4856
|
-
var ContactTaggedData =
|
|
4871
|
+
var ContactTaggedData = import_zod17.z.object({
|
|
4857
4872
|
contact_id: Id,
|
|
4858
|
-
external_id:
|
|
4873
|
+
external_id: import_zod17.z.string().nullable(),
|
|
4859
4874
|
email: Email,
|
|
4860
4875
|
/** Only the tags the contact did not already have. */
|
|
4861
|
-
tags:
|
|
4862
|
-
source:
|
|
4876
|
+
tags: import_zod17.z.array(Slug).min(1),
|
|
4877
|
+
source: import_zod17.z.enum(["api", "dashboard", "signup_form", "import", "automation"]),
|
|
4863
4878
|
tagged_at: Timestamp
|
|
4864
4879
|
});
|
|
4865
|
-
var ContactUpdatedData =
|
|
4880
|
+
var ContactUpdatedData = import_zod17.z.object({
|
|
4866
4881
|
contact_id: Id,
|
|
4867
|
-
external_id:
|
|
4882
|
+
external_id: import_zod17.z.string().nullable(),
|
|
4868
4883
|
email: Email,
|
|
4869
|
-
changed:
|
|
4884
|
+
changed: import_zod17.z.array(import_zod17.z.string()).min(1),
|
|
4870
4885
|
properties: Properties,
|
|
4871
|
-
source:
|
|
4886
|
+
source: import_zod17.z.enum(["api", "dashboard", "signup_form", "import", "automation"]),
|
|
4872
4887
|
updated_at: Timestamp
|
|
4873
4888
|
});
|
|
4874
|
-
var AutomationRunEventBase =
|
|
4889
|
+
var AutomationRunEventBase = import_zod17.z.object({
|
|
4875
4890
|
automation_id: Id,
|
|
4876
|
-
automation_name:
|
|
4891
|
+
automation_name: import_zod17.z.string(),
|
|
4877
4892
|
run_id: Id,
|
|
4878
|
-
version:
|
|
4893
|
+
version: import_zod17.z.number().int().min(1),
|
|
4879
4894
|
contact_id: Id,
|
|
4880
|
-
external_id:
|
|
4895
|
+
external_id: import_zod17.z.string().nullable(),
|
|
4881
4896
|
email: Email
|
|
4882
4897
|
});
|
|
4883
4898
|
var AutomationRunStartedData = AutomationRunEventBase.extend({
|
|
4884
4899
|
/** What let them in: a trigger kind, or `manual` for an explicit enrolment. */
|
|
4885
|
-
trigger_kind:
|
|
4900
|
+
trigger_kind: import_zod17.z.string(),
|
|
4886
4901
|
entered_at: Timestamp
|
|
4887
4902
|
});
|
|
4888
4903
|
var AutomationRunCompletedData = AutomationRunEventBase.extend({
|
|
4889
|
-
last_step_id:
|
|
4904
|
+
last_step_id: import_zod17.z.string().nullable(),
|
|
4890
4905
|
completed_at: Timestamp
|
|
4891
4906
|
});
|
|
4892
4907
|
var AutomationRunExitedData = AutomationRunEventBase.extend({
|
|
4893
4908
|
reason: AutomationEndReason,
|
|
4894
|
-
step_id:
|
|
4909
|
+
step_id: import_zod17.z.string().nullable(),
|
|
4895
4910
|
exited_at: Timestamp
|
|
4896
4911
|
});
|
|
4897
4912
|
var AutomationRunFailedData = AutomationRunEventBase.extend({
|
|
4898
|
-
reason:
|
|
4899
|
-
step_id:
|
|
4913
|
+
reason: import_zod17.z.string(),
|
|
4914
|
+
step_id: import_zod17.z.string().nullable(),
|
|
4900
4915
|
failed_at: Timestamp
|
|
4901
4916
|
});
|
|
4902
4917
|
var AutomationWebhookData = AutomationRunEventBase.extend({
|
|
4903
|
-
step_id:
|
|
4918
|
+
step_id: import_zod17.z.string(),
|
|
4904
4919
|
/** The step's own label, when it was given one, so a receiver can branch on a name. */
|
|
4905
|
-
step_label:
|
|
4920
|
+
step_label: import_zod17.z.string().nullable(),
|
|
4906
4921
|
/** Whatever the step carries, verbatim. Null when it carries nothing. */
|
|
4907
4922
|
payload: JsonValue.nullable(),
|
|
4908
4923
|
fired_at: Timestamp
|
|
4909
4924
|
});
|
|
4910
|
-
var TemplateEventBase =
|
|
4925
|
+
var TemplateEventBase = import_zod17.z.object({
|
|
4911
4926
|
template_id: Id,
|
|
4912
|
-
name:
|
|
4913
|
-
version:
|
|
4914
|
-
source:
|
|
4927
|
+
name: import_zod17.z.string().min(1).max(200),
|
|
4928
|
+
version: import_zod17.z.number().int().min(1),
|
|
4929
|
+
source: import_zod17.z.enum(["api", "dashboard", "mjml_import"])
|
|
4915
4930
|
});
|
|
4916
4931
|
var TemplateCreatedData = TemplateEventBase.extend({ created_at: Timestamp });
|
|
4917
|
-
var TemplateUpdatedData = TemplateEventBase.extend({ archived:
|
|
4932
|
+
var TemplateUpdatedData = TemplateEventBase.extend({ archived: import_zod17.z.boolean(), updated_at: Timestamp });
|
|
4918
4933
|
var TemplateDeletedData = TemplateEventBase.extend({ deleted_at: Timestamp });
|
|
4919
|
-
var envelope = (type, data) =>
|
|
4934
|
+
var envelope = (type, data) => import_zod17.z.object({
|
|
4920
4935
|
/** Unique per event: a receiver deduplicates on it (deliveries may repeat). */
|
|
4921
4936
|
id: Id,
|
|
4922
|
-
type:
|
|
4937
|
+
type: import_zod17.z.literal(type),
|
|
4923
4938
|
created_at: Timestamp,
|
|
4924
4939
|
workspace_id: Id,
|
|
4925
4940
|
data
|
|
4926
4941
|
});
|
|
4927
|
-
var WebhookEvent =
|
|
4942
|
+
var WebhookEvent = import_zod17.z.discriminatedUnion("type", [
|
|
4928
4943
|
envelope("message.sent", MessageSentData),
|
|
4929
4944
|
envelope("message.failed", MessageFailedData),
|
|
4930
4945
|
envelope("contact.unsubscribed", ContactUnsubscribedData),
|
|
@@ -4948,16 +4963,16 @@ var WebhookEvent = import_zod16.z.discriminatedUnion("type", [
|
|
|
4948
4963
|
envelope("template.updated", TemplateUpdatedData),
|
|
4949
4964
|
envelope("template.deleted", TemplateDeletedData)
|
|
4950
4965
|
]);
|
|
4951
|
-
var WebhookEndpoint =
|
|
4966
|
+
var WebhookEndpoint = import_zod17.z.object({
|
|
4952
4967
|
id: Id,
|
|
4953
|
-
url:
|
|
4954
|
-
description:
|
|
4955
|
-
events:
|
|
4956
|
-
enabled:
|
|
4968
|
+
url: import_zod17.z.string().url(),
|
|
4969
|
+
description: import_zod17.z.string().max(500).nullable(),
|
|
4970
|
+
events: import_zod17.z.array(WebhookEventType).min(1),
|
|
4971
|
+
enabled: import_zod17.z.boolean(),
|
|
4957
4972
|
created_at: Timestamp,
|
|
4958
4973
|
updated_at: Timestamp
|
|
4959
4974
|
});
|
|
4960
|
-
var WebhookUrl =
|
|
4975
|
+
var WebhookUrl = import_zod17.z.string().url().refine((u) => {
|
|
4961
4976
|
try {
|
|
4962
4977
|
const url = new URL(u);
|
|
4963
4978
|
if (url.protocol === "https:") return true;
|
|
@@ -4966,35 +4981,35 @@ var WebhookUrl = import_zod16.z.string().url().refine((u) => {
|
|
|
4966
4981
|
return false;
|
|
4967
4982
|
}
|
|
4968
4983
|
}, "must be https (http only for localhost)");
|
|
4969
|
-
var WebhookEndpointCreate =
|
|
4984
|
+
var WebhookEndpointCreate = import_zod17.z.object({
|
|
4970
4985
|
url: WebhookUrl,
|
|
4971
|
-
description:
|
|
4972
|
-
events:
|
|
4973
|
-
enabled:
|
|
4986
|
+
description: import_zod17.z.string().max(500).optional(),
|
|
4987
|
+
events: import_zod17.z.array(WebhookEventType).min(1),
|
|
4988
|
+
enabled: import_zod17.z.boolean().optional()
|
|
4974
4989
|
});
|
|
4975
|
-
var WebhookEndpointUpdate =
|
|
4990
|
+
var WebhookEndpointUpdate = import_zod17.z.object({
|
|
4976
4991
|
url: WebhookUrl,
|
|
4977
|
-
description:
|
|
4978
|
-
events:
|
|
4979
|
-
enabled:
|
|
4992
|
+
description: import_zod17.z.string().max(500).nullable(),
|
|
4993
|
+
events: import_zod17.z.array(WebhookEventType).min(1),
|
|
4994
|
+
enabled: import_zod17.z.boolean()
|
|
4980
4995
|
}).partial().refine((v) => Object.keys(v).length > 0, "at least one field");
|
|
4981
|
-
var WebhookEndpointWithSecret =
|
|
4996
|
+
var WebhookEndpointWithSecret = import_zod17.z.object({
|
|
4982
4997
|
endpoint: WebhookEndpoint,
|
|
4983
|
-
secret:
|
|
4998
|
+
secret: import_zod17.z.string().min(32)
|
|
4984
4999
|
});
|
|
4985
5000
|
var WEBHOOK_DELIVERY_STATUSES = ["pending", "succeeded", "failed"];
|
|
4986
|
-
var WebhookDeliveryStatus =
|
|
5001
|
+
var WebhookDeliveryStatus = import_zod17.z.enum(WEBHOOK_DELIVERY_STATUSES);
|
|
4987
5002
|
var WEBHOOK_MAX_ATTEMPTS = 8;
|
|
4988
5003
|
var WEBHOOK_RETRY_DELAYS_SECONDS = [30, 120, 600, 1800, 3600, 7200, 21600];
|
|
4989
|
-
var WebhookDelivery =
|
|
5004
|
+
var WebhookDelivery = import_zod17.z.object({
|
|
4990
5005
|
id: Id,
|
|
4991
5006
|
endpoint_id: Id,
|
|
4992
5007
|
event_id: Id,
|
|
4993
5008
|
event_type: WebhookEventType,
|
|
4994
5009
|
status: WebhookDeliveryStatus,
|
|
4995
|
-
attempts:
|
|
4996
|
-
last_status_code:
|
|
4997
|
-
last_error:
|
|
5010
|
+
attempts: import_zod17.z.number().int().min(0),
|
|
5011
|
+
last_status_code: import_zod17.z.number().int().min(100).max(599).nullable(),
|
|
5012
|
+
last_error: import_zod17.z.string().nullable(),
|
|
4998
5013
|
next_attempt_at: Timestamp.nullable(),
|
|
4999
5014
|
delivered_at: Timestamp.nullable(),
|
|
5000
5015
|
created_at: Timestamp
|
|
@@ -5003,7 +5018,7 @@ var WebhookDeliveryListQuery = PageQuery.extend({
|
|
|
5003
5018
|
status: WebhookDeliveryStatus.optional(),
|
|
5004
5019
|
event_type: WebhookEventType.optional()
|
|
5005
5020
|
});
|
|
5006
|
-
var WebhookDeliveryParams =
|
|
5021
|
+
var WebhookDeliveryParams = import_zod17.z.object({ id: Id, delivery_id: Id });
|
|
5007
5022
|
|
|
5008
5023
|
// src/webhook-signing.ts
|
|
5009
5024
|
var WEBHOOK_SIGNATURE_HEADER = "x-mail-signature";
|
|
@@ -5070,94 +5085,96 @@ async function verifyWebhook(input) {
|
|
|
5070
5085
|
}
|
|
5071
5086
|
|
|
5072
5087
|
// src/billing.ts
|
|
5073
|
-
var
|
|
5088
|
+
var import_zod18 = require("zod");
|
|
5074
5089
|
var PLAN_IDS = ["free", "starter", "growth", "design_partner"];
|
|
5075
|
-
var PlanId =
|
|
5076
|
-
var PlanLimits =
|
|
5077
|
-
monthly_messages:
|
|
5078
|
-
contacts:
|
|
5079
|
-
members:
|
|
5080
|
-
providers:
|
|
5081
|
-
webhook_endpoints:
|
|
5090
|
+
var PlanId = import_zod18.z.enum(PLAN_IDS);
|
|
5091
|
+
var PlanLimits = import_zod18.z.object({
|
|
5092
|
+
monthly_messages: import_zod18.z.number().int().min(0).nullable(),
|
|
5093
|
+
contacts: import_zod18.z.number().int().min(0).nullable(),
|
|
5094
|
+
members: import_zod18.z.number().int().min(1).nullable(),
|
|
5095
|
+
providers: import_zod18.z.number().int().min(1).nullable(),
|
|
5096
|
+
webhook_endpoints: import_zod18.z.number().int().min(0).nullable(),
|
|
5082
5097
|
/** Automations that may be live (active or paused) at once (A1). */
|
|
5083
|
-
active_automations:
|
|
5098
|
+
active_automations: import_zod18.z.number().int().min(0).nullable(),
|
|
5084
5099
|
/** Steps one automation may hold. Null is the flow's own cap, not unlimited. */
|
|
5085
|
-
automation_steps:
|
|
5100
|
+
automation_steps: import_zod18.z.number().int().min(1).nullable(),
|
|
5086
5101
|
/** Own domains Lumitra Mail sends from (managed sending domains); 0 when the plan has none. */
|
|
5087
|
-
sending_domains:
|
|
5102
|
+
sending_domains: import_zod18.z.number().int().min(0).nullable()
|
|
5088
5103
|
});
|
|
5089
|
-
var PlanFeatures =
|
|
5104
|
+
var PlanFeatures = import_zod18.z.object({
|
|
5090
5105
|
/** A/B tests of subject and content on a mailing (S4). */
|
|
5091
|
-
ab_testing:
|
|
5106
|
+
ab_testing: import_zod18.z.boolean(),
|
|
5092
5107
|
/** Open and click tracking, still off until a workspace turns it on (`settings.tracking_enabled`). */
|
|
5093
|
-
tracking:
|
|
5108
|
+
tracking: import_zod18.z.boolean(),
|
|
5094
5109
|
/** Automations: flows a person walks through step by step (A1). */
|
|
5095
|
-
automations:
|
|
5110
|
+
automations: import_zod18.z.boolean()
|
|
5096
5111
|
});
|
|
5097
5112
|
var PLAN_FEATURES = ["ab_testing", "tracking", "automations"];
|
|
5098
|
-
var Plan =
|
|
5113
|
+
var Plan = import_zod18.z.object({
|
|
5099
5114
|
id: PlanId,
|
|
5100
|
-
name:
|
|
5115
|
+
name: import_zod18.z.string().min(1),
|
|
5101
5116
|
/** Price in the smallest currency unit per month; null for plans not sold. */
|
|
5102
|
-
monthly_price_cents:
|
|
5103
|
-
currency:
|
|
5117
|
+
monthly_price_cents: import_zod18.z.number().int().min(0).nullable(),
|
|
5118
|
+
currency: import_zod18.z.string().length(3),
|
|
5104
5119
|
limits: PlanLimits,
|
|
5105
5120
|
features: PlanFeatures
|
|
5106
5121
|
});
|
|
5107
|
-
var CatalogPlan = Plan.extend({ sellable:
|
|
5108
|
-
var Subscription =
|
|
5122
|
+
var CatalogPlan = Plan.extend({ sellable: import_zod18.z.boolean() });
|
|
5123
|
+
var Subscription = import_zod18.z.object({
|
|
5109
5124
|
workspace_id: Id,
|
|
5110
5125
|
plan: PlanId,
|
|
5111
|
-
status:
|
|
5126
|
+
status: import_zod18.z.enum(["active", "trialing", "past_due", "cancelled"]),
|
|
5112
5127
|
current_period_start: Timestamp,
|
|
5113
5128
|
current_period_end: Timestamp,
|
|
5114
|
-
cancel_at_period_end:
|
|
5129
|
+
cancel_at_period_end: import_zod18.z.boolean(),
|
|
5115
5130
|
/**
|
|
5116
5131
|
* A design partner outside billing (plan `design_partner`, no limits, no
|
|
5117
5132
|
* checkout). Set only by an operator, never through the API.
|
|
5118
5133
|
*/
|
|
5119
|
-
billing_exempt:
|
|
5134
|
+
billing_exempt: import_zod18.z.boolean(),
|
|
5120
5135
|
/**
|
|
5121
5136
|
* Own sending domains bought on top of the plan's included ones (the
|
|
5122
5137
|
* add-on), each a monthly charge on the same subscription. 0 without the
|
|
5123
5138
|
* add-on; the usage limit `sending_domains` is the plan's plus these.
|
|
5124
5139
|
*/
|
|
5125
|
-
extra_sending_domains:
|
|
5140
|
+
extra_sending_domains: import_zod18.z.number().int().min(0)
|
|
5126
5141
|
});
|
|
5127
|
-
var BillingAddons =
|
|
5128
|
-
sending_domain:
|
|
5129
|
-
monthly_price_cents:
|
|
5130
|
-
currency:
|
|
5131
|
-
sellable:
|
|
5142
|
+
var BillingAddons = import_zod18.z.object({
|
|
5143
|
+
sending_domain: import_zod18.z.object({
|
|
5144
|
+
monthly_price_cents: import_zod18.z.number().int().min(0),
|
|
5145
|
+
currency: import_zod18.z.string().length(3),
|
|
5146
|
+
sellable: import_zod18.z.boolean()
|
|
5132
5147
|
})
|
|
5133
5148
|
});
|
|
5134
5149
|
var MAX_EXTRA_SENDING_DOMAINS = 100;
|
|
5135
|
-
var ExtraSendingDomainsUpdate =
|
|
5150
|
+
var ExtraSendingDomainsUpdate = import_zod18.z.object({ quantity: import_zod18.z.number().int().min(0).max(MAX_EXTRA_SENDING_DOMAINS) });
|
|
5136
5151
|
var USAGE_METRICS = ["messages", "contacts", "members", "providers", "webhook_endpoints", "active_automations", "sending_domains"];
|
|
5137
|
-
var UsageMetric =
|
|
5152
|
+
var UsageMetric = import_zod18.z.enum(USAGE_METRICS);
|
|
5138
5153
|
var USAGE_WARNING_RATIO = 0.8;
|
|
5139
|
-
var UsageWarning =
|
|
5154
|
+
var UsageWarning = import_zod18.z.object({
|
|
5140
5155
|
metric: UsageMetric,
|
|
5141
|
-
used:
|
|
5142
|
-
limit:
|
|
5156
|
+
used: import_zod18.z.number().int().min(0),
|
|
5157
|
+
limit: import_zod18.z.number().int().min(0),
|
|
5143
5158
|
/** `approaching`: at or above USAGE_WARNING_RATIO of the limit; `reached`: at or above the limit. */
|
|
5144
|
-
level:
|
|
5159
|
+
level: import_zod18.z.enum(["approaching", "reached"])
|
|
5145
5160
|
});
|
|
5146
|
-
var Usage =
|
|
5161
|
+
var Usage = import_zod18.z.object({
|
|
5147
5162
|
plan: PlanId,
|
|
5148
5163
|
period_start: Timestamp,
|
|
5149
5164
|
period_end: Timestamp,
|
|
5150
|
-
metrics:
|
|
5151
|
-
warnings:
|
|
5152
|
-
});
|
|
5153
|
-
var CheckoutRequest =
|
|
5154
|
-
plan:
|
|
5155
|
-
success_url:
|
|
5156
|
-
cancel_url:
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
var
|
|
5165
|
+
metrics: import_zod18.z.record(UsageMetric, import_zod18.z.object({ used: import_zod18.z.number().int().min(0), limit: import_zod18.z.number().int().min(0).nullable() })),
|
|
5166
|
+
warnings: import_zod18.z.array(UsageWarning)
|
|
5167
|
+
});
|
|
5168
|
+
var CheckoutRequest = import_zod18.z.object({
|
|
5169
|
+
plan: import_zod18.z.enum(["starter", "growth"]),
|
|
5170
|
+
success_url: import_zod18.z.string().url(),
|
|
5171
|
+
cancel_url: import_zod18.z.string().url(),
|
|
5172
|
+
/** The buyer accepted the terms of service and the processing agreement of this version. */
|
|
5173
|
+
accept_terms: AcceptTerms
|
|
5174
|
+
});
|
|
5175
|
+
var CheckoutSession = import_zod18.z.object({ url: import_zod18.z.string().url() });
|
|
5176
|
+
var PortalRequest = import_zod18.z.object({ return_url: import_zod18.z.string().url() });
|
|
5177
|
+
var PortalSession = import_zod18.z.object({ url: import_zod18.z.string().url() });
|
|
5161
5178
|
var USAGE_WARNING_HEADER = "x-mail-usage-warning";
|
|
5162
5179
|
function formatUsageWarningHeader(warnings) {
|
|
5163
5180
|
if (warnings.length === 0) return null;
|
|
@@ -5177,7 +5194,7 @@ function parseUsageWarningHeader(value) {
|
|
|
5177
5194
|
}
|
|
5178
5195
|
|
|
5179
5196
|
// src/routes.ts
|
|
5180
|
-
var
|
|
5197
|
+
var import_zod19 = require("zod");
|
|
5181
5198
|
var list = (item) => page(item);
|
|
5182
5199
|
var foundationRoutes = {
|
|
5183
5200
|
"workspaces.create": {
|
|
@@ -5423,7 +5440,7 @@ var templateRoutes = {
|
|
|
5423
5440
|
path: "/v1/templates/:id/export",
|
|
5424
5441
|
params: IdParams,
|
|
5425
5442
|
query: TemplateExportQuery,
|
|
5426
|
-
response:
|
|
5443
|
+
response: import_zod19.z.string(),
|
|
5427
5444
|
responseType: "text",
|
|
5428
5445
|
status: 200,
|
|
5429
5446
|
access: "read",
|
|
@@ -5803,7 +5820,7 @@ var sendingRoutes = {
|
|
|
5803
5820
|
path: "/v1/mailings/:id/export",
|
|
5804
5821
|
params: IdParams,
|
|
5805
5822
|
query: MailingExportQuery,
|
|
5806
|
-
response:
|
|
5823
|
+
response: import_zod19.z.string(),
|
|
5807
5824
|
responseType: "text",
|
|
5808
5825
|
status: 200,
|
|
5809
5826
|
access: "read",
|
|
@@ -6070,7 +6087,7 @@ var platformRoutes = {
|
|
|
6070
6087
|
"contactProperties.list": {
|
|
6071
6088
|
method: "GET",
|
|
6072
6089
|
path: "/v1/contact-properties",
|
|
6073
|
-
response:
|
|
6090
|
+
response: import_zod19.z.object({ data: import_zod19.z.array(ContactPropertyDefinition) }),
|
|
6074
6091
|
status: 200,
|
|
6075
6092
|
access: "read",
|
|
6076
6093
|
phase: "S4"
|
|
@@ -6369,7 +6386,7 @@ var billingRoutes = {
|
|
|
6369
6386
|
"billing.plans": {
|
|
6370
6387
|
method: "GET",
|
|
6371
6388
|
path: "/v1/billing/plans",
|
|
6372
|
-
response:
|
|
6389
|
+
response: import_zod19.z.object({ data: import_zod19.z.array(CatalogPlan), addons: BillingAddons }),
|
|
6373
6390
|
status: 200,
|
|
6374
6391
|
access: "read",
|
|
6375
6392
|
phase: "S5"
|
|
@@ -6520,7 +6537,7 @@ var automationRoutes = {
|
|
|
6520
6537
|
method: "POST",
|
|
6521
6538
|
path: "/v1/automations/:id/pause",
|
|
6522
6539
|
params: IdParams,
|
|
6523
|
-
body:
|
|
6540
|
+
body: import_zod19.z.object({}).strict(),
|
|
6524
6541
|
response: Automation,
|
|
6525
6542
|
status: 200,
|
|
6526
6543
|
access: "write",
|
|
@@ -6530,7 +6547,7 @@ var automationRoutes = {
|
|
|
6530
6547
|
method: "POST",
|
|
6531
6548
|
path: "/v1/automations/:id/resume",
|
|
6532
6549
|
params: IdParams,
|
|
6533
|
-
body:
|
|
6550
|
+
body: import_zod19.z.object({}).strict(),
|
|
6534
6551
|
response: Automation,
|
|
6535
6552
|
status: 200,
|
|
6536
6553
|
access: "write",
|
|
@@ -6540,7 +6557,7 @@ var automationRoutes = {
|
|
|
6540
6557
|
method: "POST",
|
|
6541
6558
|
path: "/v1/automations/:id/archive",
|
|
6542
6559
|
params: IdParams,
|
|
6543
|
-
body:
|
|
6560
|
+
body: import_zod19.z.object({}).strict(),
|
|
6544
6561
|
response: Automation,
|
|
6545
6562
|
status: 200,
|
|
6546
6563
|
access: "write",
|
|
@@ -6721,6 +6738,7 @@ function matchRoute(method, pathname) {
|
|
|
6721
6738
|
AbTestState,
|
|
6722
6739
|
AbVariant,
|
|
6723
6740
|
AbWinnerRequest,
|
|
6741
|
+
AcceptTerms,
|
|
6724
6742
|
ApiKey,
|
|
6725
6743
|
ApiKeyCreate,
|
|
6726
6744
|
ApiKeyCreated,
|
|
@@ -6892,6 +6910,7 @@ function matchRoute(method, pathname) {
|
|
|
6892
6910
|
InviteListQuery,
|
|
6893
6911
|
InviteStatus,
|
|
6894
6912
|
JsonValue,
|
|
6913
|
+
LEGAL_TERMS_VERSION,
|
|
6895
6914
|
LETTER_ONLY_MERGE_FIELDS,
|
|
6896
6915
|
LETTER_RECIPIENT_REFUSAL,
|
|
6897
6916
|
LIST_UNSUBSCRIBE_POST_VALUE,
|