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