@marlinjai/mail-contract 0.22.0 → 0.24.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 +920 -19
- package/dist/index.d.ts +920 -19
- package/dist/index.js +391 -182
- package/dist/index.mjs +374 -182
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -107,6 +107,8 @@ __export(index_exports, {
|
|
|
107
107
|
BEARER_PREFIX: () => BEARER_PREFIX,
|
|
108
108
|
BILLING_NOT_CONFIGURED_REASON: () => BILLING_NOT_CONFIGURED_REASON,
|
|
109
109
|
BillingAddons: () => BillingAddons,
|
|
110
|
+
BoughtDomain: () => BoughtDomain,
|
|
111
|
+
BoughtDomainRecordParams: () => BoughtDomainRecordParams,
|
|
110
112
|
BoundedAutomationFilter: () => BoundedAutomationFilter,
|
|
111
113
|
BoundedSegmentFilter: () => BoundedSegmentFilter,
|
|
112
114
|
COMPANY_GRANT_ROLES: () => COMPANY_GRANT_ROLES,
|
|
@@ -141,24 +143,37 @@ __export(index_exports, {
|
|
|
141
143
|
DATE_PASSED_ANSWERS: () => DATE_PASSED_ANSWERS,
|
|
142
144
|
DEFAULT_INVITE_TTL_DAYS: () => DEFAULT_INVITE_TTL_DAYS,
|
|
143
145
|
DEFAULT_PAGE_LIMIT: () => DEFAULT_PAGE_LIMIT,
|
|
146
|
+
DNS_RECORD_TYPES: () => DNS_RECORD_TYPES,
|
|
144
147
|
DOCUMENT_SCHEMA_VERSIONS: () => DOCUMENT_SCHEMA_VERSIONS,
|
|
145
148
|
DOMAIN_BUYING_BLOCKS: () => DOMAIN_BUYING_BLOCKS,
|
|
146
149
|
DOMAIN_BUYING_NOT_CONFIGURED_REASON: () => DOMAIN_BUYING_NOT_CONFIGURED_REASON,
|
|
150
|
+
DOMAIN_LEAVE_STATES: () => DOMAIN_LEAVE_STATES,
|
|
151
|
+
DOMAIN_LEAVE_WAYS: () => DOMAIN_LEAVE_WAYS,
|
|
147
152
|
DOMAIN_ORDER_KINDS: () => DOMAIN_ORDER_KINDS,
|
|
148
153
|
DOMAIN_ORDER_STATES: () => DOMAIN_ORDER_STATES,
|
|
149
154
|
DOMAIN_PRICE_CHANGED_REASON: () => DOMAIN_PRICE_CHANGED_REASON,
|
|
155
|
+
DOMAIN_RENEWAL_STATES: () => DOMAIN_RENEWAL_STATES,
|
|
150
156
|
DOMAIN_UNAVAILABLE_REASONS: () => DOMAIN_UNAVAILABLE_REASONS,
|
|
151
157
|
DateOnly: () => DateOnly,
|
|
152
158
|
DatePassedAnswer: () => DatePassedAnswer,
|
|
153
159
|
DelayStep: () => DelayStep,
|
|
160
|
+
DnsRecordType: () => DnsRecordType,
|
|
154
161
|
DocumentSchemaVersion: () => DocumentSchemaVersion,
|
|
155
162
|
DomainBuyingBlock: () => DomainBuyingBlock,
|
|
163
|
+
DomainLeave: () => DomainLeave,
|
|
164
|
+
DomainLeaveCreate: () => DomainLeaveCreate,
|
|
165
|
+
DomainLeaveState: () => DomainLeaveState,
|
|
166
|
+
DomainLeaveWay: () => DomainLeaveWay,
|
|
156
167
|
DomainOffer: () => DomainOffer,
|
|
157
168
|
DomainOrder: () => DomainOrder,
|
|
158
169
|
DomainOrderCreate: () => DomainOrderCreate,
|
|
159
170
|
DomainOrderKind: () => DomainOrderKind,
|
|
160
171
|
DomainOrderState: () => DomainOrderState,
|
|
172
|
+
DomainRecord: () => DomainRecord,
|
|
173
|
+
DomainRecordInput: () => DomainRecordInput,
|
|
161
174
|
DomainRegistrant: () => DomainRegistrant,
|
|
175
|
+
DomainRenewal: () => DomainRenewal,
|
|
176
|
+
DomainRenewalState: () => DomainRenewalState,
|
|
162
177
|
DomainSearchQuery: () => DomainSearchQuery,
|
|
163
178
|
DomainSearchResult: () => DomainSearchResult,
|
|
164
179
|
DomainUnavailableReason: () => DomainUnavailableReason,
|
|
@@ -535,6 +550,7 @@ __export(index_exports, {
|
|
|
535
550
|
WorkspaceMove: () => WorkspaceMove,
|
|
536
551
|
WorkspaceSettings: () => WorkspaceSettings,
|
|
537
552
|
WorkspaceUpdate: () => WorkspaceUpdate,
|
|
553
|
+
ZoneFile: () => ZoneFile,
|
|
538
554
|
acceptsIdempotencyKey: () => acceptsIdempotencyKey,
|
|
539
555
|
addInsertion: () => addInsertion,
|
|
540
556
|
addInsertionChoice: () => addInsertionChoice,
|
|
@@ -544,6 +560,7 @@ __export(index_exports, {
|
|
|
544
560
|
automationFilterFamily: () => automationFilterFamily,
|
|
545
561
|
automationRoutes: () => automationRoutes,
|
|
546
562
|
billingRoutes: () => billingRoutes,
|
|
563
|
+
boughtDomainRoutes: () => boughtDomainRoutes,
|
|
547
564
|
buildPath: () => buildPath,
|
|
548
565
|
buildTemplatePatch: () => buildTemplatePatch,
|
|
549
566
|
canDeleteMailing: () => canDeleteMailing,
|
|
@@ -3726,8 +3743,15 @@ var AUDIT_ACTIONS = [
|
|
|
3726
3743
|
"domain_order.ready",
|
|
3727
3744
|
"domain_order.needs_attention",
|
|
3728
3745
|
"domain_order.kind_changed",
|
|
3746
|
+
"domain_order.no_charge",
|
|
3729
3747
|
"domain_order.refunded",
|
|
3730
3748
|
"domain_order.cancelled",
|
|
3749
|
+
// Bought domains, managed by their holder
|
|
3750
|
+
"domain_record.created",
|
|
3751
|
+
"domain_record.updated",
|
|
3752
|
+
"domain_record.deleted",
|
|
3753
|
+
"domain_leave.requested",
|
|
3754
|
+
"domain_leave.done",
|
|
3731
3755
|
// A1: automations
|
|
3732
3756
|
"automation.created",
|
|
3733
3757
|
"automation.updated",
|
|
@@ -5033,36 +5057,136 @@ var DomainOrder = import_zod16.z.object({
|
|
|
5033
5057
|
updated_at: Timestamp
|
|
5034
5058
|
});
|
|
5035
5059
|
|
|
5036
|
-
// src/
|
|
5060
|
+
// src/bought-domains.ts
|
|
5037
5061
|
var import_zod17 = require("zod");
|
|
5038
|
-
var
|
|
5062
|
+
var DOMAIN_LEAVE_WAYS = ["cloudflare_account", "transfer"];
|
|
5063
|
+
var DomainLeaveWay = import_zod17.z.enum(DOMAIN_LEAVE_WAYS);
|
|
5064
|
+
var DOMAIN_LEAVE_STATES = ["requested", "done", "cancelled"];
|
|
5065
|
+
var DomainLeaveState = import_zod17.z.enum(DOMAIN_LEAVE_STATES);
|
|
5066
|
+
var DomainLeave = import_zod17.z.object({
|
|
5067
|
+
id: Id,
|
|
5068
|
+
way: DomainLeaveWay,
|
|
5069
|
+
state: DomainLeaveState,
|
|
5070
|
+
/** The Cloudflare account the domain moves into (way `cloudflare_account`). */
|
|
5071
|
+
target_account_id: import_zod17.z.string().nullable(),
|
|
5072
|
+
/** The transfer code, once support has it (way `transfer`, state `done`); only owners and admins read it. */
|
|
5073
|
+
auth_code: import_zod17.z.string().nullable(),
|
|
5074
|
+
requested_at: Timestamp,
|
|
5075
|
+
done_at: Timestamp.nullable()
|
|
5076
|
+
});
|
|
5077
|
+
var DOMAIN_RENEWAL_STATES = ["invoiced", "failed", "paid", "stopped", "lapsed"];
|
|
5078
|
+
var DomainRenewalState = import_zod17.z.enum(DOMAIN_RENEWAL_STATES);
|
|
5079
|
+
var DomainRenewal = import_zod17.z.object({
|
|
5080
|
+
state: DomainRenewalState,
|
|
5081
|
+
amount_cents: import_zod17.z.number().int().min(0),
|
|
5082
|
+
/** Stripe's hosted page to pay the renewal by hand; null until Stripe has made it. */
|
|
5083
|
+
pay_url: import_zod17.z.string().url().nullable()
|
|
5084
|
+
});
|
|
5085
|
+
var BoughtDomain = import_zod17.z.object({
|
|
5086
|
+
/** The order the domain was bought with. */
|
|
5087
|
+
id: Id,
|
|
5088
|
+
domain: import_zod17.z.string(),
|
|
5089
|
+
kind: DomainOrderKind,
|
|
5090
|
+
registrant_name: import_zod17.z.string(),
|
|
5091
|
+
registered_at: Timestamp,
|
|
5092
|
+
/** When the paid year ends. */
|
|
5093
|
+
expires_at: Timestamp.nullable(),
|
|
5094
|
+
/** Each further year, final, in euro cents; 0 for a domain registered without a charge. */
|
|
5095
|
+
renewal_price_cents: import_zod17.z.number().int().min(0),
|
|
5096
|
+
currency: import_zod17.z.literal("EUR"),
|
|
5097
|
+
/** Registered for one of Lumitra's own companies, never charged. */
|
|
5098
|
+
no_charge: import_zod17.z.boolean(),
|
|
5099
|
+
/** When the next year is charged (45 days before expiry); null when it is never charged. */
|
|
5100
|
+
next_charge_at: Timestamp.nullable(),
|
|
5101
|
+
/** The current year's renewal, once it was charged; null before. */
|
|
5102
|
+
renewal: DomainRenewal.nullable(),
|
|
5103
|
+
/** The earliest moment each way of leaving is possible. */
|
|
5104
|
+
move_account_from: Timestamp,
|
|
5105
|
+
transfer_from: Timestamp,
|
|
5106
|
+
/** The latest request to leave, if any. */
|
|
5107
|
+
leave: DomainLeave.nullable(),
|
|
5108
|
+
/** True once the domain has left: its records are no longer Lumitra Mail's to edit. */
|
|
5109
|
+
left: import_zod17.z.boolean()
|
|
5110
|
+
});
|
|
5111
|
+
var DNS_RECORD_TYPES = ["A", "AAAA", "CNAME", "TXT", "MX", "NS"];
|
|
5112
|
+
var DnsRecordType = import_zod17.z.enum(DNS_RECORD_TYPES);
|
|
5113
|
+
var DomainRecord = import_zod17.z.object({
|
|
5114
|
+
id: import_zod17.z.string(),
|
|
5115
|
+
type: import_zod17.z.string(),
|
|
5116
|
+
/** The full name (www.example.com). */
|
|
5117
|
+
name: import_zod17.z.string(),
|
|
5118
|
+
content: import_zod17.z.string(),
|
|
5119
|
+
/** Seconds; 1 is automatic. */
|
|
5120
|
+
ttl: import_zod17.z.number().int(),
|
|
5121
|
+
/** Served through Cloudflare's proxy (A, AAAA, CNAME only). */
|
|
5122
|
+
proxied: import_zod17.z.boolean(),
|
|
5123
|
+
priority: import_zod17.z.number().int().nullable(),
|
|
5124
|
+
/**
|
|
5125
|
+
* Not the holder's to change: a record Lumitra Mail wrote for sending (it
|
|
5126
|
+
* keeps those right itself), or a type the dashboard does not edit.
|
|
5127
|
+
*/
|
|
5128
|
+
locked: import_zod17.z.boolean()
|
|
5129
|
+
});
|
|
5130
|
+
var IPV4 = /^(25[0-5]|2[0-4]\d|1?\d?\d)(\.(25[0-5]|2[0-4]\d|1?\d?\d)){3}$/;
|
|
5131
|
+
var HOSTNAME = /^(?=.{1,253}\.?$)([a-z0-9_](?:[a-z0-9_-]{0,61}[a-z0-9])?\.)*[a-z0-9_](?:[a-z0-9_-]{0,61}[a-z0-9])?\.?$/i;
|
|
5132
|
+
var DomainRecordInput = import_zod17.z.object({
|
|
5133
|
+
type: DnsRecordType,
|
|
5134
|
+
name: import_zod17.z.string().trim().min(1).max(253),
|
|
5135
|
+
content: import_zod17.z.string().trim().min(1).max(2048),
|
|
5136
|
+
ttl: import_zod17.z.union([import_zod17.z.literal(1), import_zod17.z.number().int().min(60).max(86400)]).default(1),
|
|
5137
|
+
proxied: import_zod17.z.boolean().default(false),
|
|
5138
|
+
priority: import_zod17.z.number().int().min(0).max(65535).nullable().optional()
|
|
5139
|
+
}).superRefine((r, ctx) => {
|
|
5140
|
+
const bad = (path, message) => ctx.addIssue({ code: import_zod17.z.ZodIssueCode.custom, path: [path], message });
|
|
5141
|
+
if (r.type === "A" && !IPV4.test(r.content)) bad("content", "must be an IPv4 address, such as 192.0.2.10");
|
|
5142
|
+
if (r.type === "AAAA" && (!r.content.includes(":") || !/^[0-9a-f:.]+$/i.test(r.content))) bad("content", "must be an IPv6 address, such as 2001:db8::10");
|
|
5143
|
+
if ((r.type === "CNAME" || r.type === "MX" || r.type === "NS") && !HOSTNAME.test(r.content)) bad("content", "must be a host name, such as host.example.com");
|
|
5144
|
+
if (r.type === "MX" && (r.priority === void 0 || r.priority === null)) bad("priority", "is needed for an MX record");
|
|
5145
|
+
if (r.type !== "MX" && r.priority !== void 0 && r.priority !== null) bad("priority", "is only for an MX record");
|
|
5146
|
+
if (r.proxied && !["A", "AAAA", "CNAME"].includes(r.type)) bad("proxied", "is only for A, AAAA and CNAME records");
|
|
5147
|
+
});
|
|
5148
|
+
var BoughtDomainRecordParams = import_zod17.z.object({ id: Id, record_id: import_zod17.z.string().regex(/^[0-9a-f]{32}$/, "must be a record id") });
|
|
5149
|
+
var DomainLeaveCreate = import_zod17.z.object({
|
|
5150
|
+
way: DomainLeaveWay,
|
|
5151
|
+
/** The holder's own Cloudflare account id (32 hex characters), for `cloudflare_account`. */
|
|
5152
|
+
target_account_id: import_zod17.z.string().trim().toLowerCase().regex(/^[0-9a-f]{32}$/, "must be a Cloudflare account id: 32 letters and digits, from the account\u2019s overview page").optional()
|
|
5153
|
+
}).superRefine((r, ctx) => {
|
|
5154
|
+
if (r.way === "cloudflare_account" && !r.target_account_id) {
|
|
5155
|
+
ctx.addIssue({ code: import_zod17.z.ZodIssueCode.custom, path: ["target_account_id"], message: "is needed to move the domain into your Cloudflare account" });
|
|
5156
|
+
}
|
|
5157
|
+
});
|
|
5158
|
+
var ZoneFile = import_zod17.z.object({ domain: import_zod17.z.string(), zone_file: import_zod17.z.string() });
|
|
5159
|
+
|
|
5160
|
+
// src/contacts.ts
|
|
5161
|
+
var import_zod18 = require("zod");
|
|
5162
|
+
var Topic = import_zod18.z.object({
|
|
5039
5163
|
id: Id,
|
|
5040
5164
|
slug: Slug,
|
|
5041
|
-
name:
|
|
5165
|
+
name: import_zod18.z.string().min(1).max(120),
|
|
5042
5166
|
/** Shown on the hosted preference page. */
|
|
5043
|
-
description:
|
|
5167
|
+
description: import_zod18.z.string().max(1e3).nullable(),
|
|
5044
5168
|
/** Translations of `name` and `description` per locale, for the hosted page. */
|
|
5045
|
-
translations:
|
|
5046
|
-
|
|
5169
|
+
translations: import_zod18.z.record(
|
|
5170
|
+
import_zod18.z.object({ name: import_zod18.z.string().min(1).max(120), description: import_zod18.z.string().max(1e3).nullable() })
|
|
5047
5171
|
),
|
|
5048
5172
|
created_at: Timestamp,
|
|
5049
5173
|
updated_at: Timestamp
|
|
5050
5174
|
});
|
|
5051
|
-
var TopicCreate =
|
|
5175
|
+
var TopicCreate = import_zod18.z.object({
|
|
5052
5176
|
slug: Slug,
|
|
5053
|
-
name:
|
|
5054
|
-
description:
|
|
5177
|
+
name: import_zod18.z.string().min(1).max(120),
|
|
5178
|
+
description: import_zod18.z.string().max(1e3).optional(),
|
|
5055
5179
|
translations: Topic.shape.translations.optional()
|
|
5056
5180
|
});
|
|
5057
5181
|
var TopicUpdate = TopicCreate.omit({ slug: true }).partial().refine((v) => Object.keys(v).length > 0, "at least one field");
|
|
5058
|
-
var Contact =
|
|
5182
|
+
var Contact = import_zod18.z.object({
|
|
5059
5183
|
id: Id,
|
|
5060
|
-
external_id:
|
|
5184
|
+
external_id: import_zod18.z.string().min(1).max(255).nullable(),
|
|
5061
5185
|
/** Stored lowercased, unique per workspace. */
|
|
5062
5186
|
email: Email,
|
|
5063
|
-
first_name:
|
|
5064
|
-
last_name:
|
|
5065
|
-
locale:
|
|
5187
|
+
first_name: import_zod18.z.string().max(200).nullable(),
|
|
5188
|
+
last_name: import_zod18.z.string().max(200).nullable(),
|
|
5189
|
+
locale: import_zod18.z.string().min(2).max(35).nullable(),
|
|
5066
5190
|
/**
|
|
5067
5191
|
* The person's own time zone, an IANA name such as `Europe/Berlin` (A1).
|
|
5068
5192
|
* Every wall clock an automation waits for is read in it, falling back to the
|
|
@@ -5070,65 +5194,65 @@ var Contact = import_zod17.z.object({
|
|
|
5070
5194
|
*/
|
|
5071
5195
|
timezone: TimezoneName.nullable(),
|
|
5072
5196
|
properties: Properties,
|
|
5073
|
-
topics:
|
|
5197
|
+
topics: import_zod18.z.array(Slug),
|
|
5074
5198
|
/** The slugs of the contact's tags (S4). */
|
|
5075
|
-
tags:
|
|
5199
|
+
tags: import_zod18.z.array(Slug),
|
|
5076
5200
|
created_at: Timestamp,
|
|
5077
5201
|
updated_at: Timestamp
|
|
5078
5202
|
});
|
|
5079
|
-
var ContactUpsert =
|
|
5080
|
-
external_id:
|
|
5203
|
+
var ContactUpsert = import_zod18.z.object({
|
|
5204
|
+
external_id: import_zod18.z.string().min(1).max(255).optional(),
|
|
5081
5205
|
email: Email.optional(),
|
|
5082
|
-
first_name:
|
|
5083
|
-
last_name:
|
|
5084
|
-
locale:
|
|
5206
|
+
first_name: import_zod18.z.string().max(200).nullable().optional(),
|
|
5207
|
+
last_name: import_zod18.z.string().max(200).nullable().optional(),
|
|
5208
|
+
locale: import_zod18.z.string().min(2).max(35).nullable().optional(),
|
|
5085
5209
|
timezone: TimezoneName.nullable().optional(),
|
|
5086
5210
|
properties: Properties.optional(),
|
|
5087
|
-
topics:
|
|
5211
|
+
topics: import_zod18.z.array(Slug).max(100).optional()
|
|
5088
5212
|
}).refine((v) => v.external_id !== void 0 || v.email !== void 0, {
|
|
5089
5213
|
message: "external_id or email is required",
|
|
5090
5214
|
path: ["email"]
|
|
5091
5215
|
});
|
|
5092
|
-
var ContactUpsertResult =
|
|
5216
|
+
var ContactUpsertResult = import_zod18.z.object({
|
|
5093
5217
|
contact: Contact,
|
|
5094
|
-
created:
|
|
5218
|
+
created: import_zod18.z.boolean()
|
|
5095
5219
|
});
|
|
5096
5220
|
var ContactListQuery = PageQuery.extend({
|
|
5097
|
-
email:
|
|
5098
|
-
external_id:
|
|
5221
|
+
email: import_zod18.z.string().min(1).max(254).optional(),
|
|
5222
|
+
external_id: import_zod18.z.string().min(1).max(255).optional(),
|
|
5099
5223
|
topic: Slug.optional()
|
|
5100
5224
|
});
|
|
5101
|
-
var ContactErased =
|
|
5102
|
-
ok:
|
|
5103
|
-
erased_messages:
|
|
5104
|
-
erased_recipients:
|
|
5105
|
-
suppressions_kept:
|
|
5225
|
+
var ContactErased = import_zod18.z.object({
|
|
5226
|
+
ok: import_zod18.z.literal(true),
|
|
5227
|
+
erased_messages: import_zod18.z.number().int().min(0),
|
|
5228
|
+
erased_recipients: import_zod18.z.number().int().min(0),
|
|
5229
|
+
suppressions_kept: import_zod18.z.number().int().min(0)
|
|
5106
5230
|
});
|
|
5107
5231
|
var SUPPRESSION_REASONS = ["unsubscribed", "bounced", "complained", "manual"];
|
|
5108
|
-
var SuppressionReason =
|
|
5109
|
-
var Suppression =
|
|
5232
|
+
var SuppressionReason = import_zod18.z.enum(SUPPRESSION_REASONS);
|
|
5233
|
+
var Suppression = import_zod18.z.object({
|
|
5110
5234
|
id: Id,
|
|
5111
5235
|
email: Email,
|
|
5112
5236
|
reason: SuppressionReason,
|
|
5113
5237
|
topic: Slug.nullable(),
|
|
5114
5238
|
source_message_id: Id.nullable(),
|
|
5115
|
-
note:
|
|
5239
|
+
note: import_zod18.z.string().max(1e3).nullable(),
|
|
5116
5240
|
created_at: Timestamp
|
|
5117
5241
|
});
|
|
5118
|
-
var SuppressionCreate =
|
|
5242
|
+
var SuppressionCreate = import_zod18.z.object({
|
|
5119
5243
|
email: Email,
|
|
5120
|
-
reason:
|
|
5244
|
+
reason: import_zod18.z.enum(["manual", "unsubscribed"]),
|
|
5121
5245
|
topic: Slug.nullable().optional(),
|
|
5122
|
-
note:
|
|
5246
|
+
note: import_zod18.z.string().max(1e3).optional()
|
|
5123
5247
|
});
|
|
5124
5248
|
var SuppressionListQuery = PageQuery.extend({
|
|
5125
|
-
email:
|
|
5249
|
+
email: import_zod18.z.string().min(1).max(254).optional(),
|
|
5126
5250
|
reason: SuppressionReason.optional(),
|
|
5127
5251
|
topic: Slug.optional()
|
|
5128
5252
|
});
|
|
5129
5253
|
|
|
5130
5254
|
// src/webhooks.ts
|
|
5131
|
-
var
|
|
5255
|
+
var import_zod19 = require("zod");
|
|
5132
5256
|
var WEBHOOK_EVENT_TYPES = [
|
|
5133
5257
|
"message.sent",
|
|
5134
5258
|
"message.failed",
|
|
@@ -5172,23 +5296,23 @@ var WEBHOOK_EVENT_TYPES = [
|
|
|
5172
5296
|
"template.updated",
|
|
5173
5297
|
"template.deleted"
|
|
5174
5298
|
];
|
|
5175
|
-
var WebhookEventType =
|
|
5176
|
-
var MessageEventBase =
|
|
5299
|
+
var WebhookEventType = import_zod19.z.enum(WEBHOOK_EVENT_TYPES);
|
|
5300
|
+
var MessageEventBase = import_zod19.z.object({
|
|
5177
5301
|
message_id: Id,
|
|
5178
5302
|
mailing_id: Id.nullable(),
|
|
5179
5303
|
mailing_metadata: MailingMetadata.nullable(),
|
|
5180
5304
|
recipient_id: Id.nullable(),
|
|
5181
5305
|
contact_id: Id.nullable(),
|
|
5182
|
-
external_id:
|
|
5306
|
+
external_id: import_zod19.z.string().nullable(),
|
|
5183
5307
|
email: Email,
|
|
5184
|
-
subject:
|
|
5308
|
+
subject: import_zod19.z.string(),
|
|
5185
5309
|
topic: Slug.nullable(),
|
|
5186
|
-
provider_message_id:
|
|
5187
|
-
is_test:
|
|
5310
|
+
provider_message_id: import_zod19.z.string().nullable(),
|
|
5311
|
+
is_test: import_zod19.z.boolean()
|
|
5188
5312
|
});
|
|
5189
5313
|
var MessageSentData = MessageEventBase.extend({
|
|
5190
5314
|
/** The final HTML as sent, so the client can archive it beside its own records. */
|
|
5191
|
-
html:
|
|
5315
|
+
html: import_zod19.z.string(),
|
|
5192
5316
|
sent_at: Timestamp,
|
|
5193
5317
|
/**
|
|
5194
5318
|
* The choice each insertion made (see `Message.insertions`); absent or null
|
|
@@ -5199,20 +5323,20 @@ var MessageSentData = MessageEventBase.extend({
|
|
|
5199
5323
|
insertions: InsertionChoices.nullish()
|
|
5200
5324
|
});
|
|
5201
5325
|
var MessageFailedData = MessageEventBase.extend({
|
|
5202
|
-
error:
|
|
5326
|
+
error: import_zod19.z.string(),
|
|
5203
5327
|
/** False when the provider rejected permanently; the recipient will not be retried. */
|
|
5204
|
-
retryable:
|
|
5328
|
+
retryable: import_zod19.z.boolean(),
|
|
5205
5329
|
failed_at: Timestamp
|
|
5206
5330
|
});
|
|
5207
5331
|
var UNSUBSCRIBE_SOURCES = ["hosted_page", "one_click", "api", "dashboard", "signup_form"];
|
|
5208
|
-
var ContactUnsubscribedData =
|
|
5332
|
+
var ContactUnsubscribedData = import_zod19.z.object({
|
|
5209
5333
|
contact_id: Id.nullable(),
|
|
5210
|
-
external_id:
|
|
5334
|
+
external_id: import_zod19.z.string().nullable(),
|
|
5211
5335
|
email: Email,
|
|
5212
5336
|
/** The topic unsubscribed from; null means every topic. */
|
|
5213
5337
|
topic: Slug.nullable(),
|
|
5214
5338
|
mailing_id: Id.nullable(),
|
|
5215
|
-
source:
|
|
5339
|
+
source: import_zod19.z.enum(UNSUBSCRIBE_SOURCES),
|
|
5216
5340
|
unsubscribed_at: Timestamp
|
|
5217
5341
|
});
|
|
5218
5342
|
var ContactResubscribedData = ContactUnsubscribedData.omit({ unsubscribed_at: true }).extend({
|
|
@@ -5221,142 +5345,142 @@ var ContactResubscribedData = ContactUnsubscribedData.omit({ unsubscribed_at: tr
|
|
|
5221
5345
|
* breaker undid a `bounced` block it judged false (a `contact.bounced` for the
|
|
5222
5346
|
* same address and mailing went out before); `topic` is null.
|
|
5223
5347
|
*/
|
|
5224
|
-
source:
|
|
5348
|
+
source: import_zod19.z.enum([...UNSUBSCRIBE_SOURCES, "bounce_reverted"]),
|
|
5225
5349
|
resubscribed_at: Timestamp
|
|
5226
5350
|
});
|
|
5227
|
-
var ContactBouncedData =
|
|
5351
|
+
var ContactBouncedData = import_zod19.z.object({
|
|
5228
5352
|
contact_id: Id.nullable(),
|
|
5229
|
-
external_id:
|
|
5353
|
+
external_id: import_zod19.z.string().nullable(),
|
|
5230
5354
|
email: Email,
|
|
5231
5355
|
/** `bounced` for a hard bounce, `complained` for a spam complaint. */
|
|
5232
|
-
reason:
|
|
5356
|
+
reason: import_zod19.z.enum(["bounced", "complained"]),
|
|
5233
5357
|
message_id: Id.nullable(),
|
|
5234
|
-
diagnostic:
|
|
5358
|
+
diagnostic: import_zod19.z.string().nullable(),
|
|
5235
5359
|
bounced_at: Timestamp
|
|
5236
5360
|
});
|
|
5237
|
-
var MailingFinishedData =
|
|
5361
|
+
var MailingFinishedData = import_zod19.z.object({
|
|
5238
5362
|
mailing_id: Id,
|
|
5239
5363
|
mailing_metadata: MailingMetadata,
|
|
5240
|
-
status:
|
|
5364
|
+
status: import_zod19.z.enum(["sent", "partially_failed", "cancelled"]),
|
|
5241
5365
|
counts: MailingCounts,
|
|
5242
5366
|
finished_at: Timestamp
|
|
5243
5367
|
});
|
|
5244
|
-
var ContactSubscribedData =
|
|
5368
|
+
var ContactSubscribedData = import_zod19.z.object({
|
|
5245
5369
|
contact_id: Id,
|
|
5246
|
-
external_id:
|
|
5370
|
+
external_id: import_zod19.z.string().nullable(),
|
|
5247
5371
|
email: Email,
|
|
5248
|
-
topics:
|
|
5249
|
-
source:
|
|
5372
|
+
topics: import_zod19.z.array(Slug),
|
|
5373
|
+
source: import_zod19.z.enum(["signup_form", "api", "dashboard", "automation"]),
|
|
5250
5374
|
signup_form_id: Id.nullable(),
|
|
5251
|
-
signup_form_version:
|
|
5375
|
+
signup_form_version: import_zod19.z.number().int().min(1).nullable(),
|
|
5252
5376
|
subscribed_at: Timestamp
|
|
5253
5377
|
});
|
|
5254
|
-
var ImportFinishedData =
|
|
5378
|
+
var ImportFinishedData = import_zod19.z.object({
|
|
5255
5379
|
import_id: Id,
|
|
5256
|
-
status:
|
|
5380
|
+
status: import_zod19.z.enum(["completed", "cancelled", "failed"]),
|
|
5257
5381
|
result: ImportReport.nullable(),
|
|
5258
|
-
error:
|
|
5382
|
+
error: import_zod19.z.string().nullable(),
|
|
5259
5383
|
finished_at: Timestamp
|
|
5260
5384
|
});
|
|
5261
|
-
var MailingScheduledData =
|
|
5385
|
+
var MailingScheduledData = import_zod19.z.object({
|
|
5262
5386
|
mailing_id: Id,
|
|
5263
5387
|
mailing_metadata: MailingMetadata,
|
|
5264
5388
|
scheduled_at: Timestamp.nullable()
|
|
5265
5389
|
});
|
|
5266
|
-
var MailingStartedData =
|
|
5390
|
+
var MailingStartedData = import_zod19.z.object({
|
|
5267
5391
|
mailing_id: Id,
|
|
5268
5392
|
mailing_metadata: MailingMetadata,
|
|
5269
|
-
trigger:
|
|
5270
|
-
recipients:
|
|
5393
|
+
trigger: import_zod19.z.enum(["send", "schedule"]),
|
|
5394
|
+
recipients: import_zod19.z.number().int().min(0),
|
|
5271
5395
|
started_at: Timestamp
|
|
5272
5396
|
});
|
|
5273
|
-
var MailingScheduleFailedData =
|
|
5397
|
+
var MailingScheduleFailedData = import_zod19.z.object({
|
|
5274
5398
|
mailing_id: Id,
|
|
5275
5399
|
mailing_metadata: MailingMetadata,
|
|
5276
|
-
code:
|
|
5277
|
-
message:
|
|
5400
|
+
code: import_zod19.z.string(),
|
|
5401
|
+
message: import_zod19.z.string(),
|
|
5278
5402
|
failed_at: Timestamp
|
|
5279
5403
|
});
|
|
5280
|
-
var MailingAbWinnerSelectedData =
|
|
5404
|
+
var MailingAbWinnerSelectedData = import_zod19.z.object({
|
|
5281
5405
|
mailing_id: Id,
|
|
5282
5406
|
mailing_metadata: MailingMetadata,
|
|
5283
|
-
winner:
|
|
5284
|
-
decided_by:
|
|
5285
|
-
variants:
|
|
5407
|
+
winner: import_zod19.z.string(),
|
|
5408
|
+
decided_by: import_zod19.z.enum(["metric", "manual"]),
|
|
5409
|
+
variants: import_zod19.z.array(VariantAnalytics),
|
|
5286
5410
|
decided_at: Timestamp
|
|
5287
5411
|
});
|
|
5288
|
-
var ContactTaggedData =
|
|
5412
|
+
var ContactTaggedData = import_zod19.z.object({
|
|
5289
5413
|
contact_id: Id,
|
|
5290
|
-
external_id:
|
|
5414
|
+
external_id: import_zod19.z.string().nullable(),
|
|
5291
5415
|
email: Email,
|
|
5292
5416
|
/** Only the tags the contact did not already have. */
|
|
5293
|
-
tags:
|
|
5294
|
-
source:
|
|
5417
|
+
tags: import_zod19.z.array(Slug).min(1),
|
|
5418
|
+
source: import_zod19.z.enum(["api", "dashboard", "signup_form", "import", "automation"]),
|
|
5295
5419
|
tagged_at: Timestamp
|
|
5296
5420
|
});
|
|
5297
|
-
var ContactUpdatedData =
|
|
5421
|
+
var ContactUpdatedData = import_zod19.z.object({
|
|
5298
5422
|
contact_id: Id,
|
|
5299
|
-
external_id:
|
|
5423
|
+
external_id: import_zod19.z.string().nullable(),
|
|
5300
5424
|
email: Email,
|
|
5301
|
-
changed:
|
|
5425
|
+
changed: import_zod19.z.array(import_zod19.z.string()).min(1),
|
|
5302
5426
|
properties: Properties,
|
|
5303
|
-
source:
|
|
5427
|
+
source: import_zod19.z.enum(["api", "dashboard", "signup_form", "import", "automation"]),
|
|
5304
5428
|
updated_at: Timestamp
|
|
5305
5429
|
});
|
|
5306
|
-
var AutomationRunEventBase =
|
|
5430
|
+
var AutomationRunEventBase = import_zod19.z.object({
|
|
5307
5431
|
automation_id: Id,
|
|
5308
|
-
automation_name:
|
|
5432
|
+
automation_name: import_zod19.z.string(),
|
|
5309
5433
|
run_id: Id,
|
|
5310
|
-
version:
|
|
5434
|
+
version: import_zod19.z.number().int().min(1),
|
|
5311
5435
|
contact_id: Id,
|
|
5312
|
-
external_id:
|
|
5436
|
+
external_id: import_zod19.z.string().nullable(),
|
|
5313
5437
|
email: Email
|
|
5314
5438
|
});
|
|
5315
5439
|
var AutomationRunStartedData = AutomationRunEventBase.extend({
|
|
5316
5440
|
/** What let them in: a trigger kind, or `manual` for an explicit enrolment. */
|
|
5317
|
-
trigger_kind:
|
|
5441
|
+
trigger_kind: import_zod19.z.string(),
|
|
5318
5442
|
entered_at: Timestamp
|
|
5319
5443
|
});
|
|
5320
5444
|
var AutomationRunCompletedData = AutomationRunEventBase.extend({
|
|
5321
|
-
last_step_id:
|
|
5445
|
+
last_step_id: import_zod19.z.string().nullable(),
|
|
5322
5446
|
completed_at: Timestamp
|
|
5323
5447
|
});
|
|
5324
5448
|
var AutomationRunExitedData = AutomationRunEventBase.extend({
|
|
5325
5449
|
reason: AutomationEndReason,
|
|
5326
|
-
step_id:
|
|
5450
|
+
step_id: import_zod19.z.string().nullable(),
|
|
5327
5451
|
exited_at: Timestamp
|
|
5328
5452
|
});
|
|
5329
5453
|
var AutomationRunFailedData = AutomationRunEventBase.extend({
|
|
5330
|
-
reason:
|
|
5331
|
-
step_id:
|
|
5454
|
+
reason: import_zod19.z.string(),
|
|
5455
|
+
step_id: import_zod19.z.string().nullable(),
|
|
5332
5456
|
failed_at: Timestamp
|
|
5333
5457
|
});
|
|
5334
5458
|
var AutomationWebhookData = AutomationRunEventBase.extend({
|
|
5335
|
-
step_id:
|
|
5459
|
+
step_id: import_zod19.z.string(),
|
|
5336
5460
|
/** The step's own label, when it was given one, so a receiver can branch on a name. */
|
|
5337
|
-
step_label:
|
|
5461
|
+
step_label: import_zod19.z.string().nullable(),
|
|
5338
5462
|
/** Whatever the step carries, verbatim. Null when it carries nothing. */
|
|
5339
5463
|
payload: JsonValue.nullable(),
|
|
5340
5464
|
fired_at: Timestamp
|
|
5341
5465
|
});
|
|
5342
|
-
var TemplateEventBase =
|
|
5466
|
+
var TemplateEventBase = import_zod19.z.object({
|
|
5343
5467
|
template_id: Id,
|
|
5344
|
-
name:
|
|
5345
|
-
version:
|
|
5346
|
-
source:
|
|
5468
|
+
name: import_zod19.z.string().min(1).max(200),
|
|
5469
|
+
version: import_zod19.z.number().int().min(1),
|
|
5470
|
+
source: import_zod19.z.enum(["api", "dashboard", "mjml_import"])
|
|
5347
5471
|
});
|
|
5348
5472
|
var TemplateCreatedData = TemplateEventBase.extend({ created_at: Timestamp });
|
|
5349
|
-
var TemplateUpdatedData = TemplateEventBase.extend({ archived:
|
|
5473
|
+
var TemplateUpdatedData = TemplateEventBase.extend({ archived: import_zod19.z.boolean(), updated_at: Timestamp });
|
|
5350
5474
|
var TemplateDeletedData = TemplateEventBase.extend({ deleted_at: Timestamp });
|
|
5351
|
-
var envelope = (type, data) =>
|
|
5475
|
+
var envelope = (type, data) => import_zod19.z.object({
|
|
5352
5476
|
/** Unique per event: a receiver deduplicates on it (deliveries may repeat). */
|
|
5353
5477
|
id: Id,
|
|
5354
|
-
type:
|
|
5478
|
+
type: import_zod19.z.literal(type),
|
|
5355
5479
|
created_at: Timestamp,
|
|
5356
5480
|
workspace_id: Id,
|
|
5357
5481
|
data
|
|
5358
5482
|
});
|
|
5359
|
-
var WebhookEvent =
|
|
5483
|
+
var WebhookEvent = import_zod19.z.discriminatedUnion("type", [
|
|
5360
5484
|
envelope("message.sent", MessageSentData),
|
|
5361
5485
|
envelope("message.failed", MessageFailedData),
|
|
5362
5486
|
envelope("contact.unsubscribed", ContactUnsubscribedData),
|
|
@@ -5380,16 +5504,16 @@ var WebhookEvent = import_zod18.z.discriminatedUnion("type", [
|
|
|
5380
5504
|
envelope("template.updated", TemplateUpdatedData),
|
|
5381
5505
|
envelope("template.deleted", TemplateDeletedData)
|
|
5382
5506
|
]);
|
|
5383
|
-
var WebhookEndpoint =
|
|
5507
|
+
var WebhookEndpoint = import_zod19.z.object({
|
|
5384
5508
|
id: Id,
|
|
5385
|
-
url:
|
|
5386
|
-
description:
|
|
5387
|
-
events:
|
|
5388
|
-
enabled:
|
|
5509
|
+
url: import_zod19.z.string().url(),
|
|
5510
|
+
description: import_zod19.z.string().max(500).nullable(),
|
|
5511
|
+
events: import_zod19.z.array(WebhookEventType).min(1),
|
|
5512
|
+
enabled: import_zod19.z.boolean(),
|
|
5389
5513
|
created_at: Timestamp,
|
|
5390
5514
|
updated_at: Timestamp
|
|
5391
5515
|
});
|
|
5392
|
-
var WebhookUrl =
|
|
5516
|
+
var WebhookUrl = import_zod19.z.string().url().refine((u) => {
|
|
5393
5517
|
try {
|
|
5394
5518
|
const url = new URL(u);
|
|
5395
5519
|
if (url.protocol === "https:") return true;
|
|
@@ -5398,35 +5522,35 @@ var WebhookUrl = import_zod18.z.string().url().refine((u) => {
|
|
|
5398
5522
|
return false;
|
|
5399
5523
|
}
|
|
5400
5524
|
}, "must be https (http only for localhost)");
|
|
5401
|
-
var WebhookEndpointCreate =
|
|
5525
|
+
var WebhookEndpointCreate = import_zod19.z.object({
|
|
5402
5526
|
url: WebhookUrl,
|
|
5403
|
-
description:
|
|
5404
|
-
events:
|
|
5405
|
-
enabled:
|
|
5527
|
+
description: import_zod19.z.string().max(500).optional(),
|
|
5528
|
+
events: import_zod19.z.array(WebhookEventType).min(1),
|
|
5529
|
+
enabled: import_zod19.z.boolean().optional()
|
|
5406
5530
|
});
|
|
5407
|
-
var WebhookEndpointUpdate =
|
|
5531
|
+
var WebhookEndpointUpdate = import_zod19.z.object({
|
|
5408
5532
|
url: WebhookUrl,
|
|
5409
|
-
description:
|
|
5410
|
-
events:
|
|
5411
|
-
enabled:
|
|
5533
|
+
description: import_zod19.z.string().max(500).nullable(),
|
|
5534
|
+
events: import_zod19.z.array(WebhookEventType).min(1),
|
|
5535
|
+
enabled: import_zod19.z.boolean()
|
|
5412
5536
|
}).partial().refine((v) => Object.keys(v).length > 0, "at least one field");
|
|
5413
|
-
var WebhookEndpointWithSecret =
|
|
5537
|
+
var WebhookEndpointWithSecret = import_zod19.z.object({
|
|
5414
5538
|
endpoint: WebhookEndpoint,
|
|
5415
|
-
secret:
|
|
5539
|
+
secret: import_zod19.z.string().min(32)
|
|
5416
5540
|
});
|
|
5417
5541
|
var WEBHOOK_DELIVERY_STATUSES = ["pending", "succeeded", "failed"];
|
|
5418
|
-
var WebhookDeliveryStatus =
|
|
5542
|
+
var WebhookDeliveryStatus = import_zod19.z.enum(WEBHOOK_DELIVERY_STATUSES);
|
|
5419
5543
|
var WEBHOOK_MAX_ATTEMPTS = 8;
|
|
5420
5544
|
var WEBHOOK_RETRY_DELAYS_SECONDS = [30, 120, 600, 1800, 3600, 7200, 21600];
|
|
5421
|
-
var WebhookDelivery =
|
|
5545
|
+
var WebhookDelivery = import_zod19.z.object({
|
|
5422
5546
|
id: Id,
|
|
5423
5547
|
endpoint_id: Id,
|
|
5424
5548
|
event_id: Id,
|
|
5425
5549
|
event_type: WebhookEventType,
|
|
5426
5550
|
status: WebhookDeliveryStatus,
|
|
5427
|
-
attempts:
|
|
5428
|
-
last_status_code:
|
|
5429
|
-
last_error:
|
|
5551
|
+
attempts: import_zod19.z.number().int().min(0),
|
|
5552
|
+
last_status_code: import_zod19.z.number().int().min(100).max(599).nullable(),
|
|
5553
|
+
last_error: import_zod19.z.string().nullable(),
|
|
5430
5554
|
next_attempt_at: Timestamp.nullable(),
|
|
5431
5555
|
delivered_at: Timestamp.nullable(),
|
|
5432
5556
|
created_at: Timestamp
|
|
@@ -5435,7 +5559,7 @@ var WebhookDeliveryListQuery = PageQuery.extend({
|
|
|
5435
5559
|
status: WebhookDeliveryStatus.optional(),
|
|
5436
5560
|
event_type: WebhookEventType.optional()
|
|
5437
5561
|
});
|
|
5438
|
-
var WebhookDeliveryParams =
|
|
5562
|
+
var WebhookDeliveryParams = import_zod19.z.object({ id: Id, delivery_id: Id });
|
|
5439
5563
|
|
|
5440
5564
|
// src/webhook-signing.ts
|
|
5441
5565
|
var WEBHOOK_SIGNATURE_HEADER = "x-mail-signature";
|
|
@@ -5502,99 +5626,99 @@ async function verifyWebhook(input) {
|
|
|
5502
5626
|
}
|
|
5503
5627
|
|
|
5504
5628
|
// src/billing.ts
|
|
5505
|
-
var
|
|
5629
|
+
var import_zod20 = require("zod");
|
|
5506
5630
|
var PLAN_IDS = ["free", "starter", "growth", "design_partner"];
|
|
5507
|
-
var PlanId =
|
|
5508
|
-
var PlanLimits =
|
|
5509
|
-
monthly_messages:
|
|
5510
|
-
contacts:
|
|
5511
|
-
members:
|
|
5512
|
-
providers:
|
|
5513
|
-
webhook_endpoints:
|
|
5631
|
+
var PlanId = import_zod20.z.enum(PLAN_IDS);
|
|
5632
|
+
var PlanLimits = import_zod20.z.object({
|
|
5633
|
+
monthly_messages: import_zod20.z.number().int().min(0).nullable(),
|
|
5634
|
+
contacts: import_zod20.z.number().int().min(0).nullable(),
|
|
5635
|
+
members: import_zod20.z.number().int().min(1).nullable(),
|
|
5636
|
+
providers: import_zod20.z.number().int().min(1).nullable(),
|
|
5637
|
+
webhook_endpoints: import_zod20.z.number().int().min(0).nullable(),
|
|
5514
5638
|
/** Automations that may be live (active or paused) at once (A1). */
|
|
5515
|
-
active_automations:
|
|
5639
|
+
active_automations: import_zod20.z.number().int().min(0).nullable(),
|
|
5516
5640
|
/** Steps one automation may hold. Null is the flow's own cap, not unlimited. */
|
|
5517
|
-
automation_steps:
|
|
5641
|
+
automation_steps: import_zod20.z.number().int().min(1).nullable(),
|
|
5518
5642
|
/** Own domains Lumitra Mail sends from (managed sending domains); 0 when the plan has none. */
|
|
5519
|
-
sending_domains:
|
|
5643
|
+
sending_domains: import_zod20.z.number().int().min(0).nullable()
|
|
5520
5644
|
});
|
|
5521
|
-
var PlanFeatures =
|
|
5645
|
+
var PlanFeatures = import_zod20.z.object({
|
|
5522
5646
|
/** A/B tests of subject and content on a mailing (S4). */
|
|
5523
|
-
ab_testing:
|
|
5647
|
+
ab_testing: import_zod20.z.boolean(),
|
|
5524
5648
|
/** Open and click tracking, still off until a workspace turns it on (`settings.tracking_enabled`). */
|
|
5525
|
-
tracking:
|
|
5649
|
+
tracking: import_zod20.z.boolean(),
|
|
5526
5650
|
/** Automations: flows a person walks through step by step (A1). */
|
|
5527
|
-
automations:
|
|
5651
|
+
automations: import_zod20.z.boolean()
|
|
5528
5652
|
});
|
|
5529
5653
|
var PLAN_FEATURES = ["ab_testing", "tracking", "automations"];
|
|
5530
|
-
var Plan =
|
|
5654
|
+
var Plan = import_zod20.z.object({
|
|
5531
5655
|
id: PlanId,
|
|
5532
|
-
name:
|
|
5656
|
+
name: import_zod20.z.string().min(1),
|
|
5533
5657
|
/** Price in the smallest currency unit per month; null for plans not sold. */
|
|
5534
|
-
monthly_price_cents:
|
|
5535
|
-
currency:
|
|
5658
|
+
monthly_price_cents: import_zod20.z.number().int().min(0).nullable(),
|
|
5659
|
+
currency: import_zod20.z.string().length(3),
|
|
5536
5660
|
limits: PlanLimits,
|
|
5537
5661
|
features: PlanFeatures
|
|
5538
5662
|
});
|
|
5539
|
-
var CatalogPlan = Plan.extend({ sellable:
|
|
5540
|
-
var Subscription =
|
|
5663
|
+
var CatalogPlan = Plan.extend({ sellable: import_zod20.z.boolean() });
|
|
5664
|
+
var Subscription = import_zod20.z.object({
|
|
5541
5665
|
workspace_id: Id,
|
|
5542
5666
|
plan: PlanId,
|
|
5543
|
-
status:
|
|
5667
|
+
status: import_zod20.z.enum(["active", "trialing", "past_due", "cancelled"]),
|
|
5544
5668
|
current_period_start: Timestamp,
|
|
5545
5669
|
current_period_end: Timestamp,
|
|
5546
|
-
cancel_at_period_end:
|
|
5670
|
+
cancel_at_period_end: import_zod20.z.boolean(),
|
|
5547
5671
|
/**
|
|
5548
5672
|
* A design partner outside billing (plan `design_partner`, no limits, no
|
|
5549
5673
|
* checkout). Set only by an operator, never through the API.
|
|
5550
5674
|
*/
|
|
5551
|
-
billing_exempt:
|
|
5675
|
+
billing_exempt: import_zod20.z.boolean(),
|
|
5552
5676
|
/**
|
|
5553
5677
|
* Own sending domains bought on top of the plan's included ones (the
|
|
5554
5678
|
* add-on), each a monthly charge on the same subscription. 0 without the
|
|
5555
5679
|
* add-on; the usage limit `sending_domains` is the plan's plus these.
|
|
5556
5680
|
*/
|
|
5557
|
-
extra_sending_domains:
|
|
5681
|
+
extra_sending_domains: import_zod20.z.number().int().min(0)
|
|
5558
5682
|
});
|
|
5559
|
-
var BillingAddons =
|
|
5560
|
-
sending_domain:
|
|
5561
|
-
monthly_price_cents:
|
|
5562
|
-
currency:
|
|
5563
|
-
sellable:
|
|
5683
|
+
var BillingAddons = import_zod20.z.object({
|
|
5684
|
+
sending_domain: import_zod20.z.object({
|
|
5685
|
+
monthly_price_cents: import_zod20.z.number().int().min(0),
|
|
5686
|
+
currency: import_zod20.z.string().length(3),
|
|
5687
|
+
sellable: import_zod20.z.boolean()
|
|
5564
5688
|
})
|
|
5565
5689
|
});
|
|
5566
5690
|
var MAX_EXTRA_SENDING_DOMAINS = 100;
|
|
5567
|
-
var ExtraSendingDomainsUpdate =
|
|
5691
|
+
var ExtraSendingDomainsUpdate = import_zod20.z.object({ quantity: import_zod20.z.number().int().min(0).max(MAX_EXTRA_SENDING_DOMAINS) });
|
|
5568
5692
|
var USAGE_METRICS = ["messages", "contacts", "members", "providers", "webhook_endpoints", "active_automations", "sending_domains"];
|
|
5569
|
-
var UsageMetric =
|
|
5693
|
+
var UsageMetric = import_zod20.z.enum(USAGE_METRICS);
|
|
5570
5694
|
var USAGE_WARNING_RATIO = 0.8;
|
|
5571
|
-
var UsageWarning =
|
|
5695
|
+
var UsageWarning = import_zod20.z.object({
|
|
5572
5696
|
metric: UsageMetric,
|
|
5573
|
-
used:
|
|
5574
|
-
limit:
|
|
5697
|
+
used: import_zod20.z.number().int().min(0),
|
|
5698
|
+
limit: import_zod20.z.number().int().min(0),
|
|
5575
5699
|
/** `approaching`: at or above USAGE_WARNING_RATIO of the limit; `reached`: at or above the limit. */
|
|
5576
|
-
level:
|
|
5700
|
+
level: import_zod20.z.enum(["approaching", "reached"])
|
|
5577
5701
|
});
|
|
5578
|
-
var TermsStatus =
|
|
5579
|
-
var Usage =
|
|
5702
|
+
var TermsStatus = import_zod20.z.object({ accepted_version: import_zod20.z.string().nullable(), current_version: import_zod20.z.string() });
|
|
5703
|
+
var Usage = import_zod20.z.object({
|
|
5580
5704
|
plan: PlanId,
|
|
5581
5705
|
period_start: Timestamp,
|
|
5582
5706
|
period_end: Timestamp,
|
|
5583
|
-
metrics:
|
|
5584
|
-
warnings:
|
|
5707
|
+
metrics: import_zod20.z.record(UsageMetric, import_zod20.z.object({ used: import_zod20.z.number().int().min(0), limit: import_zod20.z.number().int().min(0).nullable() })),
|
|
5708
|
+
warnings: import_zod20.z.array(UsageWarning),
|
|
5585
5709
|
terms: TermsStatus
|
|
5586
5710
|
});
|
|
5587
|
-
var TermsAcceptance =
|
|
5588
|
-
var CheckoutRequest =
|
|
5589
|
-
plan:
|
|
5590
|
-
success_url:
|
|
5591
|
-
cancel_url:
|
|
5711
|
+
var TermsAcceptance = import_zod20.z.object({ accept_terms: AcceptTerms });
|
|
5712
|
+
var CheckoutRequest = import_zod20.z.object({
|
|
5713
|
+
plan: import_zod20.z.enum(["starter", "growth"]),
|
|
5714
|
+
success_url: import_zod20.z.string().url(),
|
|
5715
|
+
cancel_url: import_zod20.z.string().url(),
|
|
5592
5716
|
/** The buyer accepted the terms of service and the processing agreement of this version. */
|
|
5593
5717
|
accept_terms: AcceptTerms
|
|
5594
5718
|
});
|
|
5595
|
-
var CheckoutSession =
|
|
5596
|
-
var PortalRequest =
|
|
5597
|
-
var PortalSession =
|
|
5719
|
+
var CheckoutSession = import_zod20.z.object({ url: import_zod20.z.string().url() });
|
|
5720
|
+
var PortalRequest = import_zod20.z.object({ return_url: import_zod20.z.string().url() });
|
|
5721
|
+
var PortalSession = import_zod20.z.object({ url: import_zod20.z.string().url() });
|
|
5598
5722
|
var USAGE_WARNING_HEADER = "x-mail-usage-warning";
|
|
5599
5723
|
function formatUsageWarningHeader(warnings) {
|
|
5600
5724
|
if (warnings.length === 0) return null;
|
|
@@ -5614,7 +5738,7 @@ function parseUsageWarningHeader(value) {
|
|
|
5614
5738
|
}
|
|
5615
5739
|
|
|
5616
5740
|
// src/routes.ts
|
|
5617
|
-
var
|
|
5741
|
+
var import_zod21 = require("zod");
|
|
5618
5742
|
var list = (item) => page(item);
|
|
5619
5743
|
var foundationRoutes = {
|
|
5620
5744
|
"workspaces.create": {
|
|
@@ -5860,7 +5984,7 @@ var templateRoutes = {
|
|
|
5860
5984
|
path: "/v1/templates/:id/export",
|
|
5861
5985
|
params: IdParams,
|
|
5862
5986
|
query: TemplateExportQuery,
|
|
5863
|
-
response:
|
|
5987
|
+
response: import_zod21.z.string(),
|
|
5864
5988
|
responseType: "text",
|
|
5865
5989
|
status: 200,
|
|
5866
5990
|
access: "read",
|
|
@@ -6240,7 +6364,7 @@ var sendingRoutes = {
|
|
|
6240
6364
|
path: "/v1/mailings/:id/export",
|
|
6241
6365
|
params: IdParams,
|
|
6242
6366
|
query: MailingExportQuery,
|
|
6243
|
-
response:
|
|
6367
|
+
response: import_zod21.z.string(),
|
|
6244
6368
|
responseType: "text",
|
|
6245
6369
|
status: 200,
|
|
6246
6370
|
access: "read",
|
|
@@ -6507,7 +6631,7 @@ var platformRoutes = {
|
|
|
6507
6631
|
"contactProperties.list": {
|
|
6508
6632
|
method: "GET",
|
|
6509
6633
|
path: "/v1/contact-properties",
|
|
6510
|
-
response:
|
|
6634
|
+
response: import_zod21.z.object({ data: import_zod21.z.array(ContactPropertyDefinition) }),
|
|
6511
6635
|
status: 200,
|
|
6512
6636
|
access: "read",
|
|
6513
6637
|
phase: "S4"
|
|
@@ -6806,7 +6930,7 @@ var billingRoutes = {
|
|
|
6806
6930
|
"billing.plans": {
|
|
6807
6931
|
method: "GET",
|
|
6808
6932
|
path: "/v1/billing/plans",
|
|
6809
|
-
response:
|
|
6933
|
+
response: import_zod21.z.object({ data: import_zod21.z.array(CatalogPlan), addons: BillingAddons }),
|
|
6810
6934
|
status: 200,
|
|
6811
6935
|
access: "read",
|
|
6812
6936
|
phase: "S5"
|
|
@@ -6895,6 +7019,73 @@ var domainBuyingRoutes = {
|
|
|
6895
7019
|
phase: "S5"
|
|
6896
7020
|
}
|
|
6897
7021
|
};
|
|
7022
|
+
var boughtDomainRoutes = {
|
|
7023
|
+
"boughtDomains.list": {
|
|
7024
|
+
method: "GET",
|
|
7025
|
+
path: "/v1/bought-domains",
|
|
7026
|
+
response: import_zod21.z.object({ data: import_zod21.z.array(BoughtDomain) }),
|
|
7027
|
+
status: 200,
|
|
7028
|
+
access: "admin",
|
|
7029
|
+
phase: "S5"
|
|
7030
|
+
},
|
|
7031
|
+
"boughtDomains.records": {
|
|
7032
|
+
method: "GET",
|
|
7033
|
+
path: "/v1/bought-domains/:id/records",
|
|
7034
|
+
params: IdParams,
|
|
7035
|
+
response: import_zod21.z.object({ data: import_zod21.z.array(DomainRecord) }),
|
|
7036
|
+
status: 200,
|
|
7037
|
+
access: "admin",
|
|
7038
|
+
phase: "S5"
|
|
7039
|
+
},
|
|
7040
|
+
"boughtDomains.createRecord": {
|
|
7041
|
+
method: "POST",
|
|
7042
|
+
path: "/v1/bought-domains/:id/records",
|
|
7043
|
+
params: IdParams,
|
|
7044
|
+
body: DomainRecordInput,
|
|
7045
|
+
response: DomainRecord,
|
|
7046
|
+
status: 201,
|
|
7047
|
+
access: "admin",
|
|
7048
|
+
phase: "S5"
|
|
7049
|
+
},
|
|
7050
|
+
"boughtDomains.updateRecord": {
|
|
7051
|
+
method: "PATCH",
|
|
7052
|
+
path: "/v1/bought-domains/:id/records/:record_id",
|
|
7053
|
+
params: BoughtDomainRecordParams,
|
|
7054
|
+
body: DomainRecordInput,
|
|
7055
|
+
response: DomainRecord,
|
|
7056
|
+
status: 200,
|
|
7057
|
+
access: "admin",
|
|
7058
|
+
phase: "S5"
|
|
7059
|
+
},
|
|
7060
|
+
"boughtDomains.deleteRecord": {
|
|
7061
|
+
method: "DELETE",
|
|
7062
|
+
path: "/v1/bought-domains/:id/records/:record_id",
|
|
7063
|
+
params: BoughtDomainRecordParams,
|
|
7064
|
+
response: Ok,
|
|
7065
|
+
status: 200,
|
|
7066
|
+
access: "admin",
|
|
7067
|
+
phase: "S5"
|
|
7068
|
+
},
|
|
7069
|
+
"boughtDomains.zoneFile": {
|
|
7070
|
+
method: "GET",
|
|
7071
|
+
path: "/v1/bought-domains/:id/zone-file",
|
|
7072
|
+
params: IdParams,
|
|
7073
|
+
response: ZoneFile,
|
|
7074
|
+
status: 200,
|
|
7075
|
+
access: "admin",
|
|
7076
|
+
phase: "S5"
|
|
7077
|
+
},
|
|
7078
|
+
"boughtDomains.leave": {
|
|
7079
|
+
method: "POST",
|
|
7080
|
+
path: "/v1/bought-domains/:id/leave",
|
|
7081
|
+
params: IdParams,
|
|
7082
|
+
body: DomainLeaveCreate,
|
|
7083
|
+
response: BoughtDomain,
|
|
7084
|
+
status: 201,
|
|
7085
|
+
access: "admin",
|
|
7086
|
+
phase: "S5"
|
|
7087
|
+
}
|
|
7088
|
+
};
|
|
6898
7089
|
var inviteRoutes = {
|
|
6899
7090
|
"invites.create": {
|
|
6900
7091
|
method: "POST",
|
|
@@ -7004,7 +7195,7 @@ var automationRoutes = {
|
|
|
7004
7195
|
method: "POST",
|
|
7005
7196
|
path: "/v1/automations/:id/pause",
|
|
7006
7197
|
params: IdParams,
|
|
7007
|
-
body:
|
|
7198
|
+
body: import_zod21.z.object({}).strict(),
|
|
7008
7199
|
response: Automation,
|
|
7009
7200
|
status: 200,
|
|
7010
7201
|
access: "write",
|
|
@@ -7014,7 +7205,7 @@ var automationRoutes = {
|
|
|
7014
7205
|
method: "POST",
|
|
7015
7206
|
path: "/v1/automations/:id/resume",
|
|
7016
7207
|
params: IdParams,
|
|
7017
|
-
body:
|
|
7208
|
+
body: import_zod21.z.object({}).strict(),
|
|
7018
7209
|
response: Automation,
|
|
7019
7210
|
status: 200,
|
|
7020
7211
|
access: "write",
|
|
@@ -7024,7 +7215,7 @@ var automationRoutes = {
|
|
|
7024
7215
|
method: "POST",
|
|
7025
7216
|
path: "/v1/automations/:id/archive",
|
|
7026
7217
|
params: IdParams,
|
|
7027
|
-
body:
|
|
7218
|
+
body: import_zod21.z.object({}).strict(),
|
|
7028
7219
|
response: Automation,
|
|
7029
7220
|
status: 200,
|
|
7030
7221
|
access: "write",
|
|
@@ -7140,6 +7331,7 @@ var routes = {
|
|
|
7140
7331
|
...platformRoutes,
|
|
7141
7332
|
...billingRoutes,
|
|
7142
7333
|
...domainBuyingRoutes,
|
|
7334
|
+
...boughtDomainRoutes,
|
|
7143
7335
|
...automationRoutes
|
|
7144
7336
|
};
|
|
7145
7337
|
var TRUSTED_APP_OPERATIONS = {
|
|
@@ -7272,6 +7464,8 @@ function matchRoute(method, pathname) {
|
|
|
7272
7464
|
BEARER_PREFIX,
|
|
7273
7465
|
BILLING_NOT_CONFIGURED_REASON,
|
|
7274
7466
|
BillingAddons,
|
|
7467
|
+
BoughtDomain,
|
|
7468
|
+
BoughtDomainRecordParams,
|
|
7275
7469
|
BoundedAutomationFilter,
|
|
7276
7470
|
BoundedSegmentFilter,
|
|
7277
7471
|
COMPANY_GRANT_ROLES,
|
|
@@ -7306,24 +7500,37 @@ function matchRoute(method, pathname) {
|
|
|
7306
7500
|
DATE_PASSED_ANSWERS,
|
|
7307
7501
|
DEFAULT_INVITE_TTL_DAYS,
|
|
7308
7502
|
DEFAULT_PAGE_LIMIT,
|
|
7503
|
+
DNS_RECORD_TYPES,
|
|
7309
7504
|
DOCUMENT_SCHEMA_VERSIONS,
|
|
7310
7505
|
DOMAIN_BUYING_BLOCKS,
|
|
7311
7506
|
DOMAIN_BUYING_NOT_CONFIGURED_REASON,
|
|
7507
|
+
DOMAIN_LEAVE_STATES,
|
|
7508
|
+
DOMAIN_LEAVE_WAYS,
|
|
7312
7509
|
DOMAIN_ORDER_KINDS,
|
|
7313
7510
|
DOMAIN_ORDER_STATES,
|
|
7314
7511
|
DOMAIN_PRICE_CHANGED_REASON,
|
|
7512
|
+
DOMAIN_RENEWAL_STATES,
|
|
7315
7513
|
DOMAIN_UNAVAILABLE_REASONS,
|
|
7316
7514
|
DateOnly,
|
|
7317
7515
|
DatePassedAnswer,
|
|
7318
7516
|
DelayStep,
|
|
7517
|
+
DnsRecordType,
|
|
7319
7518
|
DocumentSchemaVersion,
|
|
7320
7519
|
DomainBuyingBlock,
|
|
7520
|
+
DomainLeave,
|
|
7521
|
+
DomainLeaveCreate,
|
|
7522
|
+
DomainLeaveState,
|
|
7523
|
+
DomainLeaveWay,
|
|
7321
7524
|
DomainOffer,
|
|
7322
7525
|
DomainOrder,
|
|
7323
7526
|
DomainOrderCreate,
|
|
7324
7527
|
DomainOrderKind,
|
|
7325
7528
|
DomainOrderState,
|
|
7529
|
+
DomainRecord,
|
|
7530
|
+
DomainRecordInput,
|
|
7326
7531
|
DomainRegistrant,
|
|
7532
|
+
DomainRenewal,
|
|
7533
|
+
DomainRenewalState,
|
|
7327
7534
|
DomainSearchQuery,
|
|
7328
7535
|
DomainSearchResult,
|
|
7329
7536
|
DomainUnavailableReason,
|
|
@@ -7700,6 +7907,7 @@ function matchRoute(method, pathname) {
|
|
|
7700
7907
|
WorkspaceMove,
|
|
7701
7908
|
WorkspaceSettings,
|
|
7702
7909
|
WorkspaceUpdate,
|
|
7910
|
+
ZoneFile,
|
|
7703
7911
|
acceptsIdempotencyKey,
|
|
7704
7912
|
addInsertion,
|
|
7705
7913
|
addInsertionChoice,
|
|
@@ -7709,6 +7917,7 @@ function matchRoute(method, pathname) {
|
|
|
7709
7917
|
automationFilterFamily,
|
|
7710
7918
|
automationRoutes,
|
|
7711
7919
|
billingRoutes,
|
|
7920
|
+
boughtDomainRoutes,
|
|
7712
7921
|
buildPath,
|
|
7713
7922
|
buildTemplatePatch,
|
|
7714
7923
|
canDeleteMailing,
|