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