@marlinjai/mail-contract 0.16.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -105,6 +105,7 @@ __export(index_exports, {
105
105
  AutomationWithFlow: () => AutomationWithFlow,
106
106
  BEARER_PREFIX: () => BEARER_PREFIX,
107
107
  BILLING_NOT_CONFIGURED_REASON: () => BILLING_NOT_CONFIGURED_REASON,
108
+ BillingAddons: () => BillingAddons,
108
109
  BoundedAutomationFilter: () => BoundedAutomationFilter,
109
110
  BoundedSegmentFilter: () => BoundedSegmentFilter,
110
111
  COMPANY_GRANT_ROLES: () => COMPANY_GRANT_ROLES,
@@ -161,6 +162,7 @@ __export(index_exports, {
161
162
  EventListQuery: () => EventListQuery,
162
163
  EventName: () => EventName,
163
164
  ExportFormat: () => ExportFormat,
165
+ ExtraSendingDomainsUpdate: () => ExtraSendingDomainsUpdate,
164
166
  FILTER_FIELD_OPERATORS: () => FILTER_FIELD_OPERATORS,
165
167
  FILTER_OPERATORS: () => FILTER_OPERATORS,
166
168
  FilterCondition: () => FilterCondition,
@@ -227,6 +229,7 @@ __export(index_exports, {
227
229
  MAX_DOCUMENT_BYTES: () => MAX_DOCUMENT_BYTES,
228
230
  MAX_ENGAGEMENT_DAYS: () => MAX_ENGAGEMENT_DAYS,
229
231
  MAX_EXPORT_WARNINGS_HEADER_LENGTH: () => MAX_EXPORT_WARNINGS_HEADER_LENGTH,
232
+ MAX_EXTRA_SENDING_DOMAINS: () => MAX_EXTRA_SENDING_DOMAINS,
230
233
  MAX_FILTER_DEPTH: () => MAX_FILTER_DEPTH,
231
234
  MAX_IMPORTED_REMOTE_IMAGES: () => MAX_IMPORTED_REMOTE_IMAGES,
232
235
  MAX_IMPORT_BYTES: () => MAX_IMPORT_BYTES,
@@ -620,6 +623,7 @@ __export(index_exports, {
620
623
  sameJson: () => sameJson,
621
624
  sampleMergeValue: () => sampleMergeValue,
622
625
  saveDemotions: () => saveDemotions,
626
+ sendingDomainRecordFullName: () => sendingDomainRecordFullName,
623
627
  sendingRoutes: () => sendingRoutes,
624
628
  setInsertionBy: () => setInsertionBy,
625
629
  setInsertionFilled: () => setInsertionFilled,
@@ -3615,6 +3619,7 @@ var AUDIT_ACTIONS = [
3615
3619
  "sending_domain.created",
3616
3620
  "sending_domain.updated",
3617
3621
  "sending_domain.checked",
3622
+ "sending_domain.records_written",
3618
3623
  "sending_domain.deleted",
3619
3624
  "topic.created",
3620
3625
  "topic.updated",
@@ -3672,6 +3677,7 @@ var AUDIT_ACTIONS = [
3672
3677
  "billing.checkout_started",
3673
3678
  "billing.subscription_changed",
3674
3679
  "billing.exemption_changed",
3680
+ "billing.extra_sending_domains_changed",
3675
3681
  // A1: automations
3676
3682
  "automation.created",
3677
3683
  "automation.updated",
@@ -4554,6 +4560,17 @@ var SendingDomainRecord = import_zod14.z.object({
4554
4560
  status: import_zod14.z.string().max(40),
4555
4561
  priority: import_zod14.z.number().int().min(0).max(65535).optional()
4556
4562
  });
4563
+ function sendingDomainRecordFullName(domain, name) {
4564
+ const d = domain.toLowerCase();
4565
+ const n = name.toLowerCase().replace(/\.$/, "");
4566
+ if (n === "@" || n === "") return d;
4567
+ const labels = d.split(".");
4568
+ for (let k = labels.length - 2; k >= 1; k--) {
4569
+ const sub = labels.slice(0, k).join(".");
4570
+ if (n === sub || n.endsWith(`.${sub}`)) return `${n}.${labels.slice(k).join(".")}`;
4571
+ }
4572
+ return `${n}.${d}`;
4573
+ }
4557
4574
  var SendingDomain = import_zod14.z.object({
4558
4575
  id: Id,
4559
4576
  domain: import_zod14.z.string(),
@@ -5099,8 +5116,23 @@ var Subscription = import_zod17.z.object({
5099
5116
  * A design partner outside billing (plan `design_partner`, no limits, no
5100
5117
  * checkout). Set only by an operator, never through the API.
5101
5118
  */
5102
- billing_exempt: import_zod17.z.boolean()
5119
+ billing_exempt: import_zod17.z.boolean(),
5120
+ /**
5121
+ * Own sending domains bought on top of the plan's included ones (the
5122
+ * add-on), each a monthly charge on the same subscription. 0 without the
5123
+ * add-on; the usage limit `sending_domains` is the plan's plus these.
5124
+ */
5125
+ extra_sending_domains: import_zod17.z.number().int().min(0)
5126
+ });
5127
+ var BillingAddons = import_zod17.z.object({
5128
+ sending_domain: import_zod17.z.object({
5129
+ monthly_price_cents: import_zod17.z.number().int().min(0),
5130
+ currency: import_zod17.z.string().length(3),
5131
+ sellable: import_zod17.z.boolean()
5132
+ })
5103
5133
  });
5134
+ var MAX_EXTRA_SENDING_DOMAINS = 100;
5135
+ var ExtraSendingDomainsUpdate = import_zod17.z.object({ quantity: import_zod17.z.number().int().min(0).max(MAX_EXTRA_SENDING_DOMAINS) });
5104
5136
  var USAGE_METRICS = ["messages", "contacts", "members", "providers", "webhook_endpoints", "active_automations", "sending_domains"];
5105
5137
  var UsageMetric = import_zod17.z.enum(USAGE_METRICS);
5106
5138
  var USAGE_WARNING_RATIO = 0.8;
@@ -6337,7 +6369,7 @@ var billingRoutes = {
6337
6369
  "billing.plans": {
6338
6370
  method: "GET",
6339
6371
  path: "/v1/billing/plans",
6340
- response: import_zod18.z.object({ data: import_zod18.z.array(CatalogPlan) }),
6372
+ response: import_zod18.z.object({ data: import_zod18.z.array(CatalogPlan), addons: BillingAddons }),
6341
6373
  status: 200,
6342
6374
  access: "read",
6343
6375
  phase: "S5"
@@ -6368,6 +6400,15 @@ var billingRoutes = {
6368
6400
  status: 200,
6369
6401
  access: "admin",
6370
6402
  phase: "S5"
6403
+ },
6404
+ "billing.setExtraSendingDomains": {
6405
+ method: "PUT",
6406
+ path: "/v1/billing/extra-sending-domains",
6407
+ body: ExtraSendingDomainsUpdate,
6408
+ response: Subscription,
6409
+ status: 200,
6410
+ access: "admin",
6411
+ phase: "S5"
6371
6412
  }
6372
6413
  };
6373
6414
  var inviteRoutes = {
@@ -6742,6 +6783,7 @@ function matchRoute(method, pathname) {
6742
6783
  AutomationWithFlow,
6743
6784
  BEARER_PREFIX,
6744
6785
  BILLING_NOT_CONFIGURED_REASON,
6786
+ BillingAddons,
6745
6787
  BoundedAutomationFilter,
6746
6788
  BoundedSegmentFilter,
6747
6789
  COMPANY_GRANT_ROLES,
@@ -6798,6 +6840,7 @@ function matchRoute(method, pathname) {
6798
6840
  EventListQuery,
6799
6841
  EventName,
6800
6842
  ExportFormat,
6843
+ ExtraSendingDomainsUpdate,
6801
6844
  FILTER_FIELD_OPERATORS,
6802
6845
  FILTER_OPERATORS,
6803
6846
  FilterCondition,
@@ -6864,6 +6907,7 @@ function matchRoute(method, pathname) {
6864
6907
  MAX_DOCUMENT_BYTES,
6865
6908
  MAX_ENGAGEMENT_DAYS,
6866
6909
  MAX_EXPORT_WARNINGS_HEADER_LENGTH,
6910
+ MAX_EXTRA_SENDING_DOMAINS,
6867
6911
  MAX_FILTER_DEPTH,
6868
6912
  MAX_IMPORTED_REMOTE_IMAGES,
6869
6913
  MAX_IMPORT_BYTES,
@@ -7257,6 +7301,7 @@ function matchRoute(method, pathname) {
7257
7301
  sameJson,
7258
7302
  sampleMergeValue,
7259
7303
  saveDemotions,
7304
+ sendingDomainRecordFullName,
7260
7305
  sendingRoutes,
7261
7306
  setInsertionBy,
7262
7307
  setInsertionFilled,
package/dist/index.mjs CHANGED
@@ -2965,6 +2965,7 @@ var AUDIT_ACTIONS = [
2965
2965
  "sending_domain.created",
2966
2966
  "sending_domain.updated",
2967
2967
  "sending_domain.checked",
2968
+ "sending_domain.records_written",
2968
2969
  "sending_domain.deleted",
2969
2970
  "topic.created",
2970
2971
  "topic.updated",
@@ -3022,6 +3023,7 @@ var AUDIT_ACTIONS = [
3022
3023
  "billing.checkout_started",
3023
3024
  "billing.subscription_changed",
3024
3025
  "billing.exemption_changed",
3026
+ "billing.extra_sending_domains_changed",
3025
3027
  // A1: automations
3026
3028
  "automation.created",
3027
3029
  "automation.updated",
@@ -3904,6 +3906,17 @@ var SendingDomainRecord = z14.object({
3904
3906
  status: z14.string().max(40),
3905
3907
  priority: z14.number().int().min(0).max(65535).optional()
3906
3908
  });
3909
+ function sendingDomainRecordFullName(domain, name) {
3910
+ const d = domain.toLowerCase();
3911
+ const n = name.toLowerCase().replace(/\.$/, "");
3912
+ if (n === "@" || n === "") return d;
3913
+ const labels = d.split(".");
3914
+ for (let k = labels.length - 2; k >= 1; k--) {
3915
+ const sub = labels.slice(0, k).join(".");
3916
+ if (n === sub || n.endsWith(`.${sub}`)) return `${n}.${labels.slice(k).join(".")}`;
3917
+ }
3918
+ return `${n}.${d}`;
3919
+ }
3907
3920
  var SendingDomain = z14.object({
3908
3921
  id: Id,
3909
3922
  domain: z14.string(),
@@ -4449,8 +4462,23 @@ var Subscription = z17.object({
4449
4462
  * A design partner outside billing (plan `design_partner`, no limits, no
4450
4463
  * checkout). Set only by an operator, never through the API.
4451
4464
  */
4452
- billing_exempt: z17.boolean()
4465
+ billing_exempt: z17.boolean(),
4466
+ /**
4467
+ * Own sending domains bought on top of the plan's included ones (the
4468
+ * add-on), each a monthly charge on the same subscription. 0 without the
4469
+ * add-on; the usage limit `sending_domains` is the plan's plus these.
4470
+ */
4471
+ extra_sending_domains: z17.number().int().min(0)
4472
+ });
4473
+ var BillingAddons = z17.object({
4474
+ sending_domain: z17.object({
4475
+ monthly_price_cents: z17.number().int().min(0),
4476
+ currency: z17.string().length(3),
4477
+ sellable: z17.boolean()
4478
+ })
4453
4479
  });
4480
+ var MAX_EXTRA_SENDING_DOMAINS = 100;
4481
+ var ExtraSendingDomainsUpdate = z17.object({ quantity: z17.number().int().min(0).max(MAX_EXTRA_SENDING_DOMAINS) });
4454
4482
  var USAGE_METRICS = ["messages", "contacts", "members", "providers", "webhook_endpoints", "active_automations", "sending_domains"];
4455
4483
  var UsageMetric = z17.enum(USAGE_METRICS);
4456
4484
  var USAGE_WARNING_RATIO = 0.8;
@@ -5687,7 +5715,7 @@ var billingRoutes = {
5687
5715
  "billing.plans": {
5688
5716
  method: "GET",
5689
5717
  path: "/v1/billing/plans",
5690
- response: z18.object({ data: z18.array(CatalogPlan) }),
5718
+ response: z18.object({ data: z18.array(CatalogPlan), addons: BillingAddons }),
5691
5719
  status: 200,
5692
5720
  access: "read",
5693
5721
  phase: "S5"
@@ -5718,6 +5746,15 @@ var billingRoutes = {
5718
5746
  status: 200,
5719
5747
  access: "admin",
5720
5748
  phase: "S5"
5749
+ },
5750
+ "billing.setExtraSendingDomains": {
5751
+ method: "PUT",
5752
+ path: "/v1/billing/extra-sending-domains",
5753
+ body: ExtraSendingDomainsUpdate,
5754
+ response: Subscription,
5755
+ status: 200,
5756
+ access: "admin",
5757
+ phase: "S5"
5721
5758
  }
5722
5759
  };
5723
5760
  var inviteRoutes = {
@@ -6091,6 +6128,7 @@ export {
6091
6128
  AutomationWithFlow,
6092
6129
  BEARER_PREFIX,
6093
6130
  BILLING_NOT_CONFIGURED_REASON,
6131
+ BillingAddons,
6094
6132
  BoundedAutomationFilter,
6095
6133
  BoundedSegmentFilter,
6096
6134
  COMPANY_GRANT_ROLES,
@@ -6147,6 +6185,7 @@ export {
6147
6185
  EventListQuery,
6148
6186
  EventName,
6149
6187
  ExportFormat,
6188
+ ExtraSendingDomainsUpdate,
6150
6189
  FILTER_FIELD_OPERATORS,
6151
6190
  FILTER_OPERATORS,
6152
6191
  FilterCondition,
@@ -6213,6 +6252,7 @@ export {
6213
6252
  MAX_DOCUMENT_BYTES,
6214
6253
  MAX_ENGAGEMENT_DAYS,
6215
6254
  MAX_EXPORT_WARNINGS_HEADER_LENGTH,
6255
+ MAX_EXTRA_SENDING_DOMAINS,
6216
6256
  MAX_FILTER_DEPTH,
6217
6257
  MAX_IMPORTED_REMOTE_IMAGES,
6218
6258
  MAX_IMPORT_BYTES,
@@ -6606,6 +6646,7 @@ export {
6606
6646
  sameJson,
6607
6647
  sampleMergeValue,
6608
6648
  saveDemotions,
6649
+ sendingDomainRecordFullName,
6609
6650
  sendingRoutes,
6610
6651
  setInsertionBy,
6611
6652
  setInsertionFilled,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.16.0",
6
+ "version": "0.18.0",
7
7
  "description": "The v1 API contract of the mail service: zod schemas and types for every request, response, error and webhook, the route table, and webhook signing helpers",
8
8
  "license": "MIT",
9
9
  "repository": {