samva 0.3.0 → 0.5.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.
Files changed (54) hide show
  1. package/AGENTS.md +1 -1
  2. package/README.md +5 -1
  3. package/dist/{categories-CsUa8ojo.js → categories-B9Nw2v_F.js} +5 -1
  4. package/dist/client/sdk.gen.d.ts +312 -190
  5. package/dist/client/types.gen.d.ts +2284 -728
  6. package/dist/{client-BOghX8fr.js → client-B7gEkvEq.js} +2740 -1036
  7. package/dist/client-attribution-B2yJBXdZ.js +9 -0
  8. package/dist/client-attribution.d.ts +2 -0
  9. package/dist/effect/api-keys.d.ts +51 -51
  10. package/dist/effect/api-keys.js +1 -1
  11. package/dist/effect/campaigns.d.ts +269 -219
  12. package/dist/effect/campaigns.js +1 -1
  13. package/dist/effect/categories.d.ts +6 -6
  14. package/dist/effect/categories.js +1 -1
  15. package/dist/effect/client.js +1 -1
  16. package/dist/effect/contacts.d.ts +225 -225
  17. package/dist/effect/contacts.js +1 -1
  18. package/dist/effect/conversations.d.ts +308 -293
  19. package/dist/effect/conversations.js +1 -1
  20. package/dist/effect/design.d.ts +76 -76
  21. package/dist/effect/design.js +1 -1
  22. package/dist/effect/email.d.ts +923 -213
  23. package/dist/effect/email.js +27 -3
  24. package/dist/effect/generated-metadata.d.ts +4 -0
  25. package/dist/effect/generated.d.ts +14948 -10919
  26. package/dist/effect/index.js +2 -2
  27. package/dist/effect/internal/client.d.ts +1 -1
  28. package/dist/effect/internal/operation.d.ts +31 -20
  29. package/dist/effect/media.d.ts +12 -12
  30. package/dist/effect/media.js +1 -1
  31. package/dist/effect/messages.d.ts +243 -61
  32. package/dist/effect/messages.js +5 -3
  33. package/dist/effect/operations.d.ts +17 -17
  34. package/dist/effect/operations.js +1 -1
  35. package/dist/effect/organizations.d.ts +162 -162
  36. package/dist/effect/organizations.js +1 -1
  37. package/dist/effect/retry.js +1 -1
  38. package/dist/effect/runtime.d.ts +0 -2
  39. package/dist/effect/scheduled-messages.d.ts +375 -277
  40. package/dist/effect/scheduled-messages.js +5 -3
  41. package/dist/effect/templates.d.ts +1383 -1554
  42. package/dist/effect/templates.js +40 -30
  43. package/dist/effect/webhooks.d.ts +81 -47
  44. package/dist/effect/webhooks.js +2 -2
  45. package/dist/index.js +2 -2
  46. package/dist/{normalize-BKFjbR9t.js → normalize-BiIJnycv.js} +2 -3
  47. package/dist/{operation-C2Q4cFJL.js → operation-B4FjN6wq.js} +113 -38
  48. package/dist/promises/errors.gen.d.ts +21 -2
  49. package/dist/promises/index.d.ts +11 -8
  50. package/dist/promises/index.js +2 -2
  51. package/dist/promises/types.gen.d.ts +1 -1
  52. package/dist/{promises-oiy7mOyu.js → promises-CP_nxUus.js} +828 -306
  53. package/dist/service-map.d.ts +136 -44
  54. package/package.json +13 -14
@@ -1,4 +1,5 @@
1
- import { n as buildMessagesSendPayload, r as replyToEmailsPayload, t as buildEmailSendPayload } from "./normalize-BKFjbR9t.js";
1
+ import { n as clientAttribution, t as CLIENT_ATTRIBUTION_HEADER } from "./client-attribution-B2yJBXdZ.js";
2
+ import { n as buildMessagesSendPayload, r as replyToEmailsPayload, t as buildEmailSendPayload } from "./normalize-BiIJnycv.js";
2
3
  //#region src/client/core/bodySerializer.gen.ts
3
4
  const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) };
4
5
  //#endregion
@@ -670,14 +671,14 @@ const createClient$1 = (config = {}) => {
670
671
  };
671
672
  //#endregion
672
673
  //#region src/client/client.gen.ts
673
- const client = createClient$1(createConfig());
674
+ const client = createClient$1(createConfig({ baseUrl: "https://api.samva.dev" }));
674
675
  //#endregion
675
676
  //#region src/client/sdk.gen.ts
676
677
  var Messages = class {
677
678
  /**
678
679
  * List messages
679
680
  *
680
- * Returns a paginated list of messages across all channels, with optional filters for channel, status, conversation, contact, and date range.
681
+ * Returns a paginated list of messages, with optional filters for channel, direction, status, conversation, contact, and date range.
681
682
  */
682
683
  static list(parameters, options) {
683
684
  const params = buildClientParams([parameters], [{ args: [
@@ -693,6 +694,10 @@ var Messages = class {
693
694
  in: "query",
694
695
  key: "channel"
695
696
  },
697
+ {
698
+ in: "query",
699
+ key: "direction"
700
+ },
696
701
  {
697
702
  in: "query",
698
703
  key: "status"
@@ -823,6 +828,61 @@ var Messages = class {
823
828
  });
824
829
  }
825
830
  /**
831
+ * Validate an email message
832
+ *
833
+ * Resolves recipients, sender, and inline or published-template content without creating contacts, messages, billing reservations, quota draws, queue work, or provider calls.
834
+ */
835
+ static validateEmail(parameters, options) {
836
+ const params = buildClientParams([parameters], [{ args: [
837
+ {
838
+ in: "body",
839
+ key: "conversationId"
840
+ },
841
+ {
842
+ in: "body",
843
+ key: "metadata"
844
+ },
845
+ {
846
+ in: "body",
847
+ key: "channel"
848
+ },
849
+ {
850
+ in: "body",
851
+ key: "to"
852
+ },
853
+ {
854
+ in: "body",
855
+ key: "cc"
856
+ },
857
+ {
858
+ in: "body",
859
+ key: "bcc"
860
+ },
861
+ {
862
+ in: "body",
863
+ key: "from"
864
+ },
865
+ {
866
+ in: "body",
867
+ key: "email"
868
+ }
869
+ ] }]);
870
+ return (options?.client ?? client).post({
871
+ security: [{
872
+ name: "x-api-key",
873
+ type: "apiKey"
874
+ }],
875
+ url: "/v1/messages/validate/email",
876
+ ...options,
877
+ ...params,
878
+ headers: {
879
+ "Content-Type": "application/json",
880
+ ...options?.headers,
881
+ ...params.headers
882
+ }
883
+ });
884
+ }
885
+ /**
826
886
  * Get message delivery status
827
887
  *
828
888
  * Returns the current delivery status of a message by its ID.
@@ -973,7 +1033,7 @@ var ScheduledMessages = class {
973
1033
  /**
974
1034
  * Schedule a message
975
1035
  *
976
- * Schedules a message at the absolute ISO-8601 instant in scheduledFor. Optional timezone is validated IANA display metadata only and never changes the execution instant.
1036
+ * Schedules a message for dispatch at the absolute ISO-8601 timestamp supplied in scheduledFor. Optional timezone is validated IANA display metadata only and never changes the execution instant.
977
1037
  */
978
1038
  static create(parameters, options) {
979
1039
  const params = buildClientParams([parameters], [{ args: [
@@ -1053,6 +1113,34 @@ var ScheduledMessages = class {
1053
1113
  ...params
1054
1114
  });
1055
1115
  }
1116
+ /**
1117
+ * Resume a review-paused scheduled message
1118
+ *
1119
+ * Explicitly resumes a scheduled message after onboarding review clearance. An overdue message requires either send_now or a new future scheduledFor value.
1120
+ */
1121
+ static resume(parameters, options) {
1122
+ const params = buildClientParams([parameters], [{ args: [{
1123
+ in: "path",
1124
+ key: "id"
1125
+ }, {
1126
+ key: "body",
1127
+ map: "body"
1128
+ }] }]);
1129
+ return (options?.client ?? client).post({
1130
+ security: [{
1131
+ name: "x-api-key",
1132
+ type: "apiKey"
1133
+ }],
1134
+ url: "/v1/messages/scheduled/{id}/resume",
1135
+ ...options,
1136
+ ...params,
1137
+ headers: {
1138
+ "Content-Type": "application/json",
1139
+ ...options?.headers,
1140
+ ...params.headers
1141
+ }
1142
+ });
1143
+ }
1056
1144
  };
1057
1145
  var Campaigns = class {
1058
1146
  /**
@@ -1412,10 +1500,85 @@ var Campaigns = class {
1412
1500
  }
1413
1501
  };
1414
1502
  var Email = class {
1503
+ /**
1504
+ * Get email onboarding review status
1505
+ *
1506
+ * Returns the customer-safe workspace review decision, workflow stage, next action, and current sending-identity clearances. A missing authority row is returned as a blocked initial state.
1507
+ */
1508
+ static getOnboardingReview(options) {
1509
+ return (options?.client ?? client).get({
1510
+ security: [{
1511
+ name: "x-api-key",
1512
+ type: "apiKey"
1513
+ }],
1514
+ url: "/v1/email/onboarding-review",
1515
+ ...options
1516
+ });
1517
+ }
1518
+ /**
1519
+ * Reapply for email onboarding review
1520
+ *
1521
+ * Allows a workspace owner or admin to submit a rejected workspace for review again. The expected generation prevents acting on stale status.
1522
+ */
1523
+ static reapplyOnboardingReview(parameters, options) {
1524
+ const params = buildClientParams([parameters], [{ args: [{
1525
+ in: "body",
1526
+ key: "expectedGeneration"
1527
+ }] }]);
1528
+ return (options?.client ?? client).post({
1529
+ security: [{
1530
+ name: "x-api-key",
1531
+ type: "apiKey"
1532
+ }],
1533
+ url: "/v1/email/onboarding-review/reapply",
1534
+ ...options,
1535
+ ...params,
1536
+ headers: {
1537
+ "Content-Type": "application/json",
1538
+ ...options?.headers,
1539
+ ...params.headers
1540
+ }
1541
+ });
1542
+ }
1543
+ /**
1544
+ * Respond to an email onboarding information request
1545
+ *
1546
+ * Allows workspace owners and admins to submit bounded text and up to three pending-scanned evidence uploads for the current review generation.
1547
+ */
1548
+ static respondToOnboardingInformationRequest(parameters, options) {
1549
+ const params = buildClientParams([parameters], [{ args: [
1550
+ {
1551
+ in: "body",
1552
+ key: "expectedGeneration"
1553
+ },
1554
+ {
1555
+ in: "body",
1556
+ key: "responseText"
1557
+ },
1558
+ {
1559
+ in: "body",
1560
+ key: "evidenceMediaIds"
1561
+ }
1562
+ ] }]);
1563
+ return (options?.client ?? client).post({
1564
+ security: [{
1565
+ name: "x-api-key",
1566
+ type: "apiKey"
1567
+ }],
1568
+ url: "/v1/email/onboarding-review/respond",
1569
+ ...options,
1570
+ ...params,
1571
+ headers: {
1572
+ "Content-Type": "application/json",
1573
+ ...options?.headers,
1574
+ ...params.headers
1575
+ }
1576
+ });
1577
+ }
1415
1578
  /**
1416
1579
  * Get email tracking defaults
1417
1580
  *
1418
- * Returns the organization's default open and click tracking policy. Each field is independent and defaults to enabled. Recipient opt-out takes precedence over these defaults.
1581
+ * Returns the workspace's independent defaults for open and click tracking, both enabled unless configured otherwise. Recipient opt-out takes precedence over these defaults.
1419
1582
  */
1420
1583
  static getTrackingDefaults(options) {
1421
1584
  return (options?.client ?? client).get({
@@ -1529,12 +1692,15 @@ var Email = class {
1529
1692
  /**
1530
1693
  * Add a sending domain
1531
1694
  *
1532
- * Registers a domain for sending and returns it with the DNS records required to verify ownership and configure DKIM. Responds with 201.
1695
+ * Registers a domain for sending and returns it with the DNS records required to verify ownership and configure DKIM. Responds with 201. Supplying a connection attaches the domain to that DNS account; the domain must sit inside the zone given with it.
1533
1696
  */
1534
1697
  static addDomain(parameters, options) {
1535
1698
  const params = buildClientParams([parameters], [{ args: [{
1536
1699
  in: "body",
1537
1700
  key: "domain"
1701
+ }, {
1702
+ in: "body",
1703
+ key: "connection"
1538
1704
  }] }]);
1539
1705
  return (options?.client ?? client).post({
1540
1706
  security: [{
@@ -1592,6 +1758,29 @@ var Email = class {
1592
1758
  });
1593
1759
  }
1594
1760
  /**
1761
+ * Stage a DKIM selector rotation
1762
+ *
1763
+ * Creates encrypted signing custody and returns a new public DKIM record. Publish it, then advance domain verification to cut over. Retain the former record until separately approved retirement.
1764
+ */
1765
+ static rotateDomainDkim(parameters, options) {
1766
+ const params = buildClientParams([parameters], [{ args: [{
1767
+ in: "headers",
1768
+ key: "idempotency-key"
1769
+ }, {
1770
+ in: "path",
1771
+ key: "id"
1772
+ }] }]);
1773
+ return (options?.client ?? client).post({
1774
+ security: [{
1775
+ name: "x-api-key",
1776
+ type: "apiKey"
1777
+ }],
1778
+ url: "/v1/email/domains/{id}/dkim-rotation",
1779
+ ...options,
1780
+ ...params
1781
+ });
1782
+ }
1783
+ /**
1595
1784
  * Remove a sending domain
1596
1785
  *
1597
1786
  * Permanently deletes a sending domain from the organization.
@@ -1906,7 +2095,7 @@ var Email = class {
1906
2095
  /**
1907
2096
  * Disable a custom tracking domain
1908
2097
  *
1909
- * Tears down a domain's custom tracking and its managed resources. Sends immediately revert to the shared tracking host. Existing custom links in already-delivered mail stop working.
2098
+ * Disables a domain's custom tracking, removes its managed resources, and immediately returns sends to the shared tracking host. Existing custom links in already-delivered mail stop working.
1910
2099
  */
1911
2100
  static disableCustomTracking(parameters, options) {
1912
2101
  const params = buildClientParams([parameters], [{ args: [{
@@ -2087,10 +2276,14 @@ var Email = class {
2087
2276
  /**
2088
2277
  * Add a sender identity
2089
2278
  *
2090
- * Creates a sender identity for an email address and returns it. Responds with 201.
2279
+ * Durably creates a sender identity. The required Idempotency-Key replays the original sender for an identical request and conflicts when reused with different input.
2091
2280
  */
2092
2281
  static addSender(parameters, options) {
2093
2282
  const params = buildClientParams([parameters], [{ args: [
2283
+ {
2284
+ in: "headers",
2285
+ key: "idempotency-key"
2286
+ },
2094
2287
  {
2095
2288
  in: "body",
2096
2289
  key: "email"
@@ -2146,7 +2339,7 @@ var Email = class {
2146
2339
  /**
2147
2340
  * Remove a sender identity
2148
2341
  *
2149
- * Permanently deletes a sender identity from the organization.
2342
+ * Accepts sender removal, marks it inactive, and retains its deleting lifecycle until provider identity and association cleanup is confirmed.
2150
2343
  */
2151
2344
  static removeSender(parameters, options) {
2152
2345
  const params = buildClientParams([parameters], [{ args: [{
@@ -2164,6 +2357,26 @@ var Email = class {
2164
2357
  });
2165
2358
  }
2166
2359
  /**
2360
+ * Get a sender identity
2361
+ *
2362
+ * Returns one sender identity owned by the authenticated organization. Other organizations' ids are reported as not found.
2363
+ */
2364
+ static getSender(parameters, options) {
2365
+ const params = buildClientParams([parameters], [{ args: [{
2366
+ in: "path",
2367
+ key: "id"
2368
+ }] }]);
2369
+ return (options?.client ?? client).get({
2370
+ security: [{
2371
+ name: "x-api-key",
2372
+ type: "apiKey"
2373
+ }],
2374
+ url: "/v1/email/senders/{id}",
2375
+ ...options,
2376
+ ...params
2377
+ });
2378
+ }
2379
+ /**
2167
2380
  * Set the organization default sender
2168
2381
  *
2169
2382
  * Marks a verified, active sender as the organization default, atomically clearing any previous default. Used for omitted-`from` sends when no default domain sender applies.
@@ -2836,34 +3049,52 @@ var Email = class {
2836
3049
  ...params
2837
3050
  });
2838
3051
  }
2839
- };
2840
- var Media = class {
2841
3052
  /**
2842
- * Create a media object
3053
+ * Get domain warming
2843
3054
  *
2844
- * Creates the media object in the pending state and returns it with the upload instruction — URL, method, and headers — for putting its bytes into storage.
3055
+ * Returns the domain's automated warming policy, its system-created 24-hour windows and policy snapshots, the rolling bounce and complaint window the safety rule reads, every pause above the plan, and the decision history. A domain without a plan returns the evidence and a null plan.
2845
3056
  */
2846
- static create(parameters, options) {
3057
+ static getDomainWarming(parameters, options) {
3058
+ const params = buildClientParams([parameters], [{ args: [{
3059
+ in: "path",
3060
+ key: "id"
3061
+ }] }]);
3062
+ return (options?.client ?? client).get({
3063
+ security: [{
3064
+ name: "x-api-key",
3065
+ type: "apiKey"
3066
+ }],
3067
+ url: "/v1/email/domains/{id}/warming",
3068
+ ...options,
3069
+ ...params
3070
+ });
3071
+ }
3072
+ /**
3073
+ * Start domain warming
3074
+ *
3075
+ * Starts an automated warming policy on a verified sending domain. Samva opens the first 24-hour campaign window immediately, then opens later windows from the saved growth policy after safe windows close. Direct sends are counted in the domain's window but never delayed. Responds with 201.
3076
+ */
3077
+ static createDomainWarmingPlan(parameters, options) {
2847
3078
  const params = buildClientParams([parameters], [{ args: [
2848
3079
  {
2849
- in: "body",
2850
- key: "filename"
3080
+ in: "path",
3081
+ key: "id"
2851
3082
  },
2852
3083
  {
2853
3084
  in: "body",
2854
- key: "contentType"
3085
+ key: "identity"
2855
3086
  },
2856
3087
  {
2857
3088
  in: "body",
2858
- key: "sizeBytes"
3089
+ key: "initialDailyRecipients"
2859
3090
  },
2860
3091
  {
2861
3092
  in: "body",
2862
- key: "purpose"
3093
+ key: "dailyGrowthPercent"
2863
3094
  },
2864
3095
  {
2865
3096
  in: "body",
2866
- key: "checksumSha256"
3097
+ key: "targetDailyRecipients"
2867
3098
  }
2868
3099
  ] }]);
2869
3100
  return (options?.client ?? client).post({
@@ -2871,7 +3102,7 @@ var Media = class {
2871
3102
  name: "x-api-key",
2872
3103
  type: "apiKey"
2873
3104
  }],
2874
- url: "/v1/media",
3105
+ url: "/v1/email/domains/{id}/warming",
2875
3106
  ...options,
2876
3107
  ...params,
2877
3108
  headers: {
@@ -2882,65 +3113,256 @@ var Media = class {
2882
3113
  });
2883
3114
  }
2884
3115
  /**
2885
- * Complete a media upload
3116
+ * Update domain warming policy
2886
3117
  *
2887
- * Verifies the uploaded object exists in storage, marks the media object ready, and returns it with a download URL.
3118
+ * Updates the growth percentage and daily target Samva uses for future 24-hour warming windows. Existing windows keep their policy snapshot, including a scheduled window, so prior authorization remains auditable.
2888
3119
  */
2889
- static complete(parameters, options) {
2890
- const params = buildClientParams([parameters], [{ args: [{
2891
- in: "path",
2892
- key: "mediaId"
2893
- }] }]);
2894
- return (options?.client ?? client).post({
3120
+ static updateDomainWarmingPolicy(parameters, options) {
3121
+ const params = buildClientParams([parameters], [{ args: [
3122
+ {
3123
+ in: "path",
3124
+ key: "id"
3125
+ },
3126
+ {
3127
+ in: "body",
3128
+ key: "dailyGrowthPercent"
3129
+ },
3130
+ {
3131
+ in: "body",
3132
+ key: "targetDailyRecipients"
3133
+ },
3134
+ {
3135
+ in: "body",
3136
+ key: "note"
3137
+ }
3138
+ ] }]);
3139
+ return (options?.client ?? client).patch({
2895
3140
  security: [{
2896
3141
  name: "x-api-key",
2897
3142
  type: "apiKey"
2898
3143
  }],
2899
- url: "/v1/media/{mediaId}/complete",
3144
+ url: "/v1/email/domains/{id}/warming/policy",
2900
3145
  ...options,
2901
- ...params
3146
+ ...params,
3147
+ headers: {
3148
+ "Content-Type": "application/json",
3149
+ ...options?.headers,
3150
+ ...params.headers
3151
+ }
2902
3152
  });
2903
3153
  }
2904
3154
  /**
2905
- * Delete a media object
3155
+ * Cancel a warming window
2906
3156
  *
2907
- * Deletes a pending media object and the bytes stored for it. Fails if the media object is already ready.
3157
+ * Cancels a scheduled or open system-created warming window. Recipients a campaign run already reserved from it stay reserved; no further runs draw from it.
2908
3158
  */
2909
- static remove(parameters, options) {
3159
+ static cancelDomainWarmingBatch(parameters, options) {
2910
3160
  const params = buildClientParams([parameters], [{ args: [{
2911
3161
  in: "path",
2912
- key: "mediaId"
3162
+ key: "id"
3163
+ }, {
3164
+ in: "path",
3165
+ key: "batchId"
2913
3166
  }] }]);
2914
3167
  return (options?.client ?? client).delete({
2915
3168
  security: [{
2916
3169
  name: "x-api-key",
2917
3170
  type: "apiKey"
2918
3171
  }],
2919
- url: "/v1/media/{mediaId}",
3172
+ url: "/v1/email/domains/{id}/warming/batches/{batchId}",
2920
3173
  ...options,
2921
3174
  ...params
2922
3175
  });
2923
3176
  }
2924
3177
  /**
2925
- * Get a media object
3178
+ * Pause domain warming
2926
3179
  *
2927
- * Returns the media object's metadata, including status, dimensions, and confirmation timestamps.
3180
+ * Pauses the plan. Campaign runs from the domain stop at their next page and queued campaign email waits until it expires; direct sends are unaffected.
2928
3181
  */
2929
- static getById(parameters, options) {
3182
+ static pauseDomainWarming(parameters, options) {
2930
3183
  const params = buildClientParams([parameters], [{ args: [{
2931
3184
  in: "path",
2932
- key: "mediaId"
3185
+ key: "id"
3186
+ }, {
3187
+ in: "body",
3188
+ key: "note"
2933
3189
  }] }]);
2934
- return (options?.client ?? client).get({
3190
+ return (options?.client ?? client).post({
2935
3191
  security: [{
2936
3192
  name: "x-api-key",
2937
3193
  type: "apiKey"
2938
3194
  }],
2939
- url: "/v1/media/{mediaId}",
3195
+ url: "/v1/email/domains/{id}/warming/pause",
2940
3196
  ...options,
2941
- ...params
2942
- });
2943
- }
3197
+ ...params,
3198
+ headers: {
3199
+ "Content-Type": "application/json",
3200
+ ...options?.headers,
3201
+ ...params.headers
3202
+ }
3203
+ });
3204
+ }
3205
+ /**
3206
+ * Resume domain warming
3207
+ *
3208
+ * Resumes a paused or held plan and the campaign runs it was holding. A plan the domain rule held resumes only once the domain's rolling window is under both limits again; until then the request is refused with the observed rate.
3209
+ */
3210
+ static resumeDomainWarming(parameters, options) {
3211
+ const params = buildClientParams([parameters], [{ args: [{
3212
+ in: "path",
3213
+ key: "id"
3214
+ }, {
3215
+ in: "body",
3216
+ key: "note"
3217
+ }] }]);
3218
+ return (options?.client ?? client).post({
3219
+ security: [{
3220
+ name: "x-api-key",
3221
+ type: "apiKey"
3222
+ }],
3223
+ url: "/v1/email/domains/{id}/warming/resume",
3224
+ ...options,
3225
+ ...params,
3226
+ headers: {
3227
+ "Content-Type": "application/json",
3228
+ ...options?.headers,
3229
+ ...params.headers
3230
+ }
3231
+ });
3232
+ }
3233
+ /**
3234
+ * Complete domain warming
3235
+ *
3236
+ * Ends the policy. Campaign runs from the domain are no longer gated by warming windows; the workspace safeguards still apply.
3237
+ */
3238
+ static completeDomainWarming(parameters, options) {
3239
+ const params = buildClientParams([parameters], [{ args: [{
3240
+ in: "path",
3241
+ key: "id"
3242
+ }, {
3243
+ in: "body",
3244
+ key: "note"
3245
+ }] }]);
3246
+ return (options?.client ?? client).post({
3247
+ security: [{
3248
+ name: "x-api-key",
3249
+ type: "apiKey"
3250
+ }],
3251
+ url: "/v1/email/domains/{id}/warming/complete",
3252
+ ...options,
3253
+ ...params,
3254
+ headers: {
3255
+ "Content-Type": "application/json",
3256
+ ...options?.headers,
3257
+ ...params.headers
3258
+ }
3259
+ });
3260
+ }
3261
+ };
3262
+ var Media = class {
3263
+ /**
3264
+ * Create a media object
3265
+ *
3266
+ * Creates the media object in the pending state and returns it with the upload instruction — URL, method, and headers — for putting its bytes into storage.
3267
+ */
3268
+ static create(parameters, options) {
3269
+ const params = buildClientParams([parameters], [{ args: [
3270
+ {
3271
+ in: "body",
3272
+ key: "filename"
3273
+ },
3274
+ {
3275
+ in: "body",
3276
+ key: "contentType"
3277
+ },
3278
+ {
3279
+ in: "body",
3280
+ key: "sizeBytes"
3281
+ },
3282
+ {
3283
+ in: "body",
3284
+ key: "purpose"
3285
+ },
3286
+ {
3287
+ in: "body",
3288
+ key: "checksumSha256"
3289
+ }
3290
+ ] }]);
3291
+ return (options?.client ?? client).post({
3292
+ security: [{
3293
+ name: "x-api-key",
3294
+ type: "apiKey"
3295
+ }],
3296
+ url: "/v1/media",
3297
+ ...options,
3298
+ ...params,
3299
+ headers: {
3300
+ "Content-Type": "application/json",
3301
+ ...options?.headers,
3302
+ ...params.headers
3303
+ }
3304
+ });
3305
+ }
3306
+ /**
3307
+ * Complete a media upload
3308
+ *
3309
+ * Verifies the uploaded object exists in storage, marks the media object ready, and returns it with a download URL.
3310
+ */
3311
+ static complete(parameters, options) {
3312
+ const params = buildClientParams([parameters], [{ args: [{
3313
+ in: "path",
3314
+ key: "mediaId"
3315
+ }] }]);
3316
+ return (options?.client ?? client).post({
3317
+ security: [{
3318
+ name: "x-api-key",
3319
+ type: "apiKey"
3320
+ }],
3321
+ url: "/v1/media/{mediaId}/complete",
3322
+ ...options,
3323
+ ...params
3324
+ });
3325
+ }
3326
+ /**
3327
+ * Delete a media object
3328
+ *
3329
+ * Deletes a pending media object and the bytes stored for it. Fails if the media object is already ready.
3330
+ */
3331
+ static remove(parameters, options) {
3332
+ const params = buildClientParams([parameters], [{ args: [{
3333
+ in: "path",
3334
+ key: "mediaId"
3335
+ }] }]);
3336
+ return (options?.client ?? client).delete({
3337
+ security: [{
3338
+ name: "x-api-key",
3339
+ type: "apiKey"
3340
+ }],
3341
+ url: "/v1/media/{mediaId}",
3342
+ ...options,
3343
+ ...params
3344
+ });
3345
+ }
3346
+ /**
3347
+ * Get a media object
3348
+ *
3349
+ * Returns the media object's metadata, including status, dimensions, and confirmation timestamps.
3350
+ */
3351
+ static getById(parameters, options) {
3352
+ const params = buildClientParams([parameters], [{ args: [{
3353
+ in: "path",
3354
+ key: "mediaId"
3355
+ }] }]);
3356
+ return (options?.client ?? client).get({
3357
+ security: [{
3358
+ name: "x-api-key",
3359
+ type: "apiKey"
3360
+ }],
3361
+ url: "/v1/media/{mediaId}",
3362
+ ...options,
3363
+ ...params
3364
+ });
3365
+ }
2944
3366
  /**
2945
3367
  * Get a media download URL
2946
3368
  *
@@ -3961,7 +4383,7 @@ var Templates = class {
3961
4383
  /**
3962
4384
  * Create a template
3963
4385
  *
3964
- * Creates a template from SML source; the source's root tag determines the template's channel. Returns the created template with status 201.
4386
+ * Creates an email template project from Samva's canonical TSX starter and returns its template entry with status 201.
3965
4387
  */
3966
4388
  static create(parameters, options) {
3967
4389
  const params = buildClientParams([parameters], [{ args: [
@@ -3971,47 +4393,23 @@ var Templates = class {
3971
4393
  },
3972
4394
  {
3973
4395
  in: "body",
3974
- key: "slug"
3975
- },
3976
- {
3977
- in: "body",
3978
- key: "origin"
3979
- },
3980
- {
3981
- in: "body",
3982
- key: "description"
3983
- },
3984
- {
3985
- in: "body",
3986
- key: "category"
4396
+ key: "projectName"
3987
4397
  },
3988
4398
  {
3989
4399
  in: "body",
3990
- key: "source"
3991
- },
3992
- {
3993
- in: "body",
3994
- key: "subject"
3995
- },
3996
- {
3997
- in: "body",
3998
- key: "headers"
3999
- },
4000
- {
4001
- in: "body",
4002
- key: "variableSchema"
4400
+ key: "slug"
4003
4401
  },
4004
4402
  {
4005
4403
  in: "body",
4006
- key: "compliance"
4404
+ key: "galleryTemplateId"
4007
4405
  },
4008
4406
  {
4009
4407
  in: "body",
4010
- key: "performance"
4408
+ key: "description"
4011
4409
  },
4012
4410
  {
4013
4411
  in: "body",
4014
- key: "designOverrides"
4412
+ key: "category"
4015
4413
  },
4016
4414
  {
4017
4415
  in: "body",
@@ -4019,11 +4417,7 @@ var Templates = class {
4019
4417
  },
4020
4418
  {
4021
4419
  in: "body",
4022
- key: "isDefault"
4023
- },
4024
- {
4025
- in: "body",
4026
- key: "version"
4420
+ key: "idempotencyKey"
4027
4421
  }
4028
4422
  ] }]);
4029
4423
  return (options?.client ?? client).post({
@@ -4286,29 +4680,6 @@ var Templates = class {
4286
4680
  });
4287
4681
  }
4288
4682
  /**
4289
- * Add a channel to a template family
4290
- *
4291
- * Creates a template for the requested channel in the family and returns the updated family with status 201.
4292
- */
4293
- static addFamilyChannel(parameters, options) {
4294
- const params = buildClientParams([parameters], [{ args: [{
4295
- in: "path",
4296
- key: "familyId"
4297
- }, {
4298
- in: "path",
4299
- key: "channel"
4300
- }] }]);
4301
- return (options?.client ?? client).post({
4302
- security: [{
4303
- name: "x-api-key",
4304
- type: "apiKey"
4305
- }],
4306
- url: "/v1/templates/families/{familyId}/channels/{channel}",
4307
- ...options,
4308
- ...params
4309
- });
4310
- }
4311
- /**
4312
4683
  * Delete a template
4313
4684
  *
4314
4685
  * Deletes a template from the organization and returns a success flag.
@@ -4331,7 +4702,7 @@ var Templates = class {
4331
4702
  /**
4332
4703
  * Get a template
4333
4704
  *
4334
- * Returns template metadata and compiled channel content. Read live SML through the template-document API.
4705
+ * Returns template metadata, its project entry path, and compiled channel content. Open live project files through the workspace API.
4335
4706
  */
4336
4707
  static getById(parameters, options) {
4337
4708
  const params = buildClientParams([parameters], [{ args: [{
@@ -4351,7 +4722,7 @@ var Templates = class {
4351
4722
  /**
4352
4723
  * Update a template
4353
4724
  *
4354
- * Updates template metadata. Source changes use the template-document revision API.
4725
+ * Updates template metadata. Source changes use the project workspace API.
4355
4726
  */
4356
4727
  static update(parameters, options) {
4357
4728
  const params = buildClientParams([parameters], [{ args: [{
@@ -4377,24 +4748,35 @@ var Templates = class {
4377
4748
  });
4378
4749
  }
4379
4750
  /**
4380
- * Approve a template
4751
+ * Patch template project files
4381
4752
  *
4382
- * Records compliance approval for a template with optional notes and moves its status to approved unless it is already published or archived.
4753
+ * Applies revision-checked file patches to the shared project workspace overlay.
4383
4754
  */
4384
- static approve(parameters, options) {
4385
- const params = buildClientParams([parameters], [{ args: [{
4386
- in: "path",
4387
- key: "id"
4388
- }, {
4389
- in: "body",
4390
- key: "data"
4391
- }] }]);
4392
- return (options?.client ?? client).post({
4755
+ static patchWorkspace(parameters, options) {
4756
+ const params = buildClientParams([parameters], [{ args: [
4757
+ {
4758
+ in: "path",
4759
+ key: "id"
4760
+ },
4761
+ {
4762
+ in: "body",
4763
+ key: "expectedRevision"
4764
+ },
4765
+ {
4766
+ in: "body",
4767
+ key: "patches"
4768
+ },
4769
+ {
4770
+ in: "body",
4771
+ key: "idempotencyKey"
4772
+ }
4773
+ ] }]);
4774
+ return (options?.client ?? client).patch({
4393
4775
  security: [{
4394
4776
  name: "x-api-key",
4395
4777
  type: "apiKey"
4396
4778
  }],
4397
- url: "/v1/templates/{id}/approve",
4779
+ url: "/v1/templates/{id}/workspace",
4398
4780
  ...options,
4399
4781
  ...params,
4400
4782
  headers: {
@@ -4404,83 +4786,80 @@ var Templates = class {
4404
4786
  }
4405
4787
  });
4406
4788
  }
4407
- };
4408
- var TemplateDocuments = class {
4409
4789
  /**
4410
- * Bootstrap a template document
4790
+ * Open a template project workspace
4411
4791
  *
4412
- * Creates or loads the authoritative editable document for a template and returns its current snapshot.
4792
+ * Creates or opens the shared project workspace at the current Artifact branch head and returns its effective files.
4413
4793
  */
4414
- static bootstrap(parameters, options) {
4794
+ static openWorkspace(parameters, options) {
4415
4795
  const params = buildClientParams([parameters], [{ args: [{
4416
- in: "body",
4417
- key: "templateId"
4796
+ in: "path",
4797
+ key: "id"
4418
4798
  }] }]);
4419
4799
  return (options?.client ?? client).post({
4420
4800
  security: [{
4421
4801
  name: "x-api-key",
4422
4802
  type: "apiKey"
4423
4803
  }],
4424
- url: "/v1/template-documents/bootstrap",
4804
+ url: "/v1/templates/{id}/workspace",
4425
4805
  ...options,
4426
- ...params,
4427
- headers: {
4428
- "Content-Type": "application/json",
4429
- ...options?.headers,
4430
- ...params.headers
4431
- }
4806
+ ...params
4432
4807
  });
4433
4808
  }
4434
4809
  /**
4435
- * Get a template document
4810
+ * Diff a template project workspace
4436
4811
  *
4437
- * Returns the current authoritative source, revision, and metadata for a template document.
4812
+ * Returns exact added, modified, and deleted project files against the current Git base commit.
4438
4813
  */
4439
- static get(parameters, options) {
4814
+ static diffWorkspace(parameters, options) {
4440
4815
  const params = buildClientParams([parameters], [{ args: [{
4441
4816
  in: "path",
4442
- key: "templateId"
4817
+ key: "id"
4818
+ }, {
4819
+ in: "body",
4820
+ key: "expectedRevision"
4443
4821
  }] }]);
4444
- return (options?.client ?? client).get({
4822
+ return (options?.client ?? client).post({
4445
4823
  security: [{
4446
4824
  name: "x-api-key",
4447
4825
  type: "apiKey"
4448
4826
  }],
4449
- url: "/v1/template-documents/{templateId}",
4827
+ url: "/v1/templates/{id}/workspace/diff",
4450
4828
  ...options,
4451
- ...params
4829
+ ...params,
4830
+ headers: {
4831
+ "Content-Type": "application/json",
4832
+ ...options?.headers,
4833
+ ...params.headers
4834
+ }
4452
4835
  });
4453
4836
  }
4454
4837
  /**
4455
- * Issue an agent admission
4838
+ * Reconcile a template project workspace
4456
4839
  *
4457
- * Authorizes a bounded template-agent operation against the current document and returns the admission context.
4840
+ * Fast-forwards or rebases the workspace onto the current Artifact branch head, retaining file conflicts for explicit resolution.
4458
4841
  */
4459
- static issueAgentAdmission(parameters, options) {
4842
+ static reconcileWorkspace(parameters, options) {
4460
4843
  const params = buildClientParams([parameters], [{ args: [
4461
4844
  {
4462
4845
  in: "path",
4463
- key: "templateId"
4464
- },
4465
- {
4466
- in: "body",
4467
- key: "method"
4846
+ key: "id"
4468
4847
  },
4469
4848
  {
4470
4849
  in: "body",
4471
- key: "route"
4850
+ key: "expectedRevision"
4472
4851
  },
4473
4852
  {
4474
4853
  in: "body",
4475
- key: "referenceDigest"
4854
+ key: "assetResolution"
4476
4855
  },
4477
4856
  {
4478
4857
  in: "body",
4479
- key: "research"
4858
+ key: "expectedRemoteHead"
4480
4859
  },
4481
4860
  {
4482
4861
  in: "body",
4483
- key: "competitorMessage"
4862
+ key: "idempotencyKey"
4484
4863
  }
4485
4864
  ] }]);
4486
4865
  return (options?.client ?? client).post({
@@ -4488,7 +4867,7 @@ var TemplateDocuments = class {
4488
4867
  name: "x-api-key",
4489
4868
  type: "apiKey"
4490
4869
  }],
4491
- url: "/v1/template-documents/{templateId}/agent-admission",
4870
+ url: "/v1/templates/{id}/workspace/reconcile",
4492
4871
  ...options,
4493
4872
  ...params,
4494
4873
  headers: {
@@ -4499,24 +4878,39 @@ var TemplateDocuments = class {
4499
4878
  });
4500
4879
  }
4501
4880
  /**
4502
- * Complete an agent conversation clear
4881
+ * Resolve a template workspace conflict
4503
4882
  *
4504
- * Records completion of an admitted agent conversation-clear operation for the template document.
4883
+ * Resolves one conflicted file by keeping the draft, using main, or supplying edited source.
4505
4884
  */
4506
- static completeAgentConversationClear(parameters, options) {
4507
- const params = buildClientParams([parameters], [{ args: [{
4508
- in: "path",
4509
- key: "templateId"
4510
- }, {
4511
- in: "body",
4512
- key: "conversationId"
4513
- }] }]);
4885
+ static resolveWorkspaceConflict(parameters, options) {
4886
+ const params = buildClientParams([parameters], [{ args: [
4887
+ {
4888
+ in: "path",
4889
+ key: "id"
4890
+ },
4891
+ {
4892
+ in: "body",
4893
+ key: "expectedRevision"
4894
+ },
4895
+ {
4896
+ in: "body",
4897
+ key: "path"
4898
+ },
4899
+ {
4900
+ in: "body",
4901
+ key: "resolution"
4902
+ },
4903
+ {
4904
+ in: "body",
4905
+ key: "idempotencyKey"
4906
+ }
4907
+ ] }]);
4514
4908
  return (options?.client ?? client).post({
4515
4909
  security: [{
4516
4910
  name: "x-api-key",
4517
4911
  type: "apiKey"
4518
4912
  }],
4519
- url: "/v1/template-documents/{templateId}/agent-conversation/clear-completion",
4913
+ url: "/v1/templates/{id}/workspace/conflicts",
4520
4914
  ...options,
4521
4915
  ...params,
4522
4916
  headers: {
@@ -4527,15 +4921,15 @@ var TemplateDocuments = class {
4527
4921
  });
4528
4922
  }
4529
4923
  /**
4530
- * Apply an agent proposal
4924
+ * Save a template project workspace
4531
4925
  *
4532
- * Applies an admitted agent-authored source proposal when its revision and source digest still match the document.
4926
+ * Validates the effective project tree and creates one normal Git commit on the Artifact default branch.
4533
4927
  */
4534
- static applyAgentProposal(parameters, options) {
4928
+ static saveWorkspace(parameters, options) {
4535
4929
  const params = buildClientParams([parameters], [{ args: [
4536
4930
  {
4537
4931
  in: "path",
4538
- key: "templateId"
4932
+ key: "id"
4539
4933
  },
4540
4934
  {
4541
4935
  in: "body",
@@ -4543,23 +4937,15 @@ var TemplateDocuments = class {
4543
4937
  },
4544
4938
  {
4545
4939
  in: "body",
4546
- key: "sourceDigest"
4547
- },
4548
- {
4549
- in: "body",
4550
- key: "idempotencyKey"
4940
+ key: "expectedHead"
4551
4941
  },
4552
4942
  {
4553
4943
  in: "body",
4554
- key: "source"
4944
+ key: "message"
4555
4945
  },
4556
4946
  {
4557
4947
  in: "body",
4558
- key: "references"
4559
- },
4560
- {
4561
- in: "body",
4562
- key: "proposalBinding"
4948
+ key: "idempotencyKey"
4563
4949
  }
4564
4950
  ] }]);
4565
4951
  return (options?.client ?? client).post({
@@ -4567,7 +4953,7 @@ var TemplateDocuments = class {
4567
4953
  name: "x-api-key",
4568
4954
  type: "apiKey"
4569
4955
  }],
4570
- url: "/v1/template-documents/{templateId}/agent-proposals/apply",
4956
+ url: "/v1/templates/{id}/workspace/save",
4571
4957
  ...options,
4572
4958
  ...params,
4573
4959
  headers: {
@@ -4578,15 +4964,15 @@ var TemplateDocuments = class {
4578
4964
  });
4579
4965
  }
4580
4966
  /**
4581
- * Replace template source
4967
+ * Stage a historical template project tree
4582
4968
  *
4583
- * Replaces the editable SML source when the expected revision matches and returns the updated document snapshot.
4969
+ * Builds the template entry before atomically staging a reachable historical commit and its emitted source; a later Save appends a new commit without rewriting branch history.
4584
4970
  */
4585
- static replace(parameters, options) {
4971
+ static restoreWorkspace(parameters, options) {
4586
4972
  const params = buildClientParams([parameters], [{ args: [
4587
4973
  {
4588
4974
  in: "path",
4589
- key: "templateId"
4975
+ key: "id"
4590
4976
  },
4591
4977
  {
4592
4978
  in: "body",
@@ -4594,7 +4980,11 @@ var TemplateDocuments = class {
4594
4980
  },
4595
4981
  {
4596
4982
  in: "body",
4597
- key: "source"
4983
+ key: "commit"
4984
+ },
4985
+ {
4986
+ in: "body",
4987
+ key: "idempotencyKey"
4598
4988
  }
4599
4989
  ] }]);
4600
4990
  return (options?.client ?? client).post({
@@ -4602,7 +4992,7 @@ var TemplateDocuments = class {
4602
4992
  name: "x-api-key",
4603
4993
  type: "apiKey"
4604
4994
  }],
4605
- url: "/v1/template-documents/{templateId}/source",
4995
+ url: "/v1/templates/{id}/workspace/restore",
4606
4996
  ...options,
4607
4997
  ...params,
4608
4998
  headers: {
@@ -4613,59 +5003,47 @@ var TemplateDocuments = class {
4613
5003
  });
4614
5004
  }
4615
5005
  /**
4616
- * Save a template document
5006
+ * List template project commit history
4617
5007
  *
4618
- * Materializes the specified document revision as a durable template source version and returns its receipt.
5008
+ * Returns bounded history from the Artifact repository default branch.
4619
5009
  */
4620
- static save(parameters, options) {
5010
+ static workspaceHistory(parameters, options) {
4621
5011
  const params = buildClientParams([parameters], [{ args: [{
4622
5012
  in: "path",
4623
- key: "templateId"
5013
+ key: "id"
4624
5014
  }, {
4625
- in: "body",
4626
- key: "revision"
5015
+ in: "query",
5016
+ key: "limit"
4627
5017
  }] }]);
4628
- return (options?.client ?? client).post({
5018
+ return (options?.client ?? client).get({
4629
5019
  security: [{
4630
5020
  name: "x-api-key",
4631
5021
  type: "apiKey"
4632
5022
  }],
4633
- url: "/v1/template-documents/{templateId}/save",
5023
+ url: "/v1/templates/{id}/workspace/history",
4634
5024
  ...options,
4635
- ...params,
4636
- headers: {
4637
- "Content-Type": "application/json",
4638
- ...options?.headers,
4639
- ...params.headers
4640
- }
5025
+ ...params
4641
5026
  });
4642
5027
  }
4643
5028
  /**
4644
- * Render a template document
5029
+ * Check a template project workspace
4645
5030
  *
4646
- * Renders the specified document revision with optional variables and reports any missing variables.
5031
+ * Builds the template entry from the current effective workspace tree, including unsaved file patches, and returns what the template declares plus every compile and target-client finding. Nothing is written and no message is rendered.
4647
5032
  */
4648
- static render(parameters, options) {
4649
- const params = buildClientParams([parameters], [{ args: [
4650
- {
4651
- in: "path",
4652
- key: "templateId"
4653
- },
4654
- {
4655
- in: "body",
4656
- key: "revision"
4657
- },
4658
- {
4659
- in: "body",
4660
- key: "variables"
4661
- }
4662
- ] }]);
5033
+ static checkWorkspace(parameters, options) {
5034
+ const params = buildClientParams([parameters], [{ args: [{
5035
+ in: "path",
5036
+ key: "id"
5037
+ }, {
5038
+ in: "body",
5039
+ key: "expectedRevision"
5040
+ }] }]);
4663
5041
  return (options?.client ?? client).post({
4664
5042
  security: [{
4665
5043
  name: "x-api-key",
4666
5044
  type: "apiKey"
4667
5045
  }],
4668
- url: "/v1/template-documents/{templateId}/render",
5046
+ url: "/v1/templates/{id}/workspace/check",
4669
5047
  ...options,
4670
5048
  ...params,
4671
5049
  headers: {
@@ -4676,23 +5054,23 @@ var TemplateDocuments = class {
4676
5054
  });
4677
5055
  }
4678
5056
  /**
4679
- * Check a template document for spam
5057
+ * Render a declared template workspace fixture
4680
5058
  *
4681
- * Renders and analyzes the specified document revision for spam risks, returning issues and recommendations.
5059
+ * Renders one of the named inputs the template declares against the current effective workspace tree. Only declared fixtures render here; arbitrary input renders against a publication.
4682
5060
  */
4683
- static spamCheck(parameters, options) {
5061
+ static renderWorkspaceFixture(parameters, options) {
4684
5062
  const params = buildClientParams([parameters], [{ args: [
4685
5063
  {
4686
5064
  in: "path",
4687
- key: "templateId"
5065
+ key: "id"
4688
5066
  },
4689
5067
  {
4690
5068
  in: "body",
4691
- key: "revision"
5069
+ key: "expectedRevision"
4692
5070
  },
4693
5071
  {
4694
5072
  in: "body",
4695
- key: "variables"
5073
+ key: "fixture"
4696
5074
  }
4697
5075
  ] }]);
4698
5076
  return (options?.client ?? client).post({
@@ -4700,7 +5078,7 @@ var TemplateDocuments = class {
4700
5078
  name: "x-api-key",
4701
5079
  type: "apiKey"
4702
5080
  }],
4703
- url: "/v1/template-documents/{templateId}/spam-check",
5081
+ url: "/v1/templates/{id}/workspace/fixtures",
4704
5082
  ...options,
4705
5083
  ...params,
4706
5084
  headers: {
@@ -4711,27 +5089,31 @@ var TemplateDocuments = class {
4711
5089
  });
4712
5090
  }
4713
5091
  /**
4714
- * Send a template test
5092
+ * Publish an exact template commit
4715
5093
  *
4716
- * Renders the specified document revision and sends a test message to one recipient without publishing it.
5094
+ * Builds an exact Git commit and entry path, stores the immutable executable and its assets, records the input contract it validates against, and makes that publication current.
4717
5095
  */
4718
- static testSend(parameters, options) {
5096
+ static publish(parameters, options) {
4719
5097
  const params = buildClientParams([parameters], [{ args: [
4720
5098
  {
4721
5099
  in: "path",
4722
- key: "templateId"
5100
+ key: "id"
4723
5101
  },
4724
5102
  {
4725
5103
  in: "body",
4726
- key: "revision"
5104
+ key: "projectId"
4727
5105
  },
4728
5106
  {
4729
5107
  in: "body",
4730
- key: "to"
5108
+ key: "commitSha"
5109
+ },
5110
+ {
5111
+ in: "body",
5112
+ key: "entryPath"
4731
5113
  },
4732
5114
  {
4733
5115
  in: "body",
4734
- key: "variables"
5116
+ key: "expectedWorkspaceRevision"
4735
5117
  }
4736
5118
  ] }]);
4737
5119
  return (options?.client ?? client).post({
@@ -4739,7 +5121,7 @@ var TemplateDocuments = class {
4739
5121
  name: "x-api-key",
4740
5122
  type: "apiKey"
4741
5123
  }],
4742
- url: "/v1/template-documents/{templateId}/send-test",
5124
+ url: "/v1/templates/{id}/publications",
4743
5125
  ...options,
4744
5126
  ...params,
4745
5127
  headers: {
@@ -4750,126 +5132,180 @@ var TemplateDocuments = class {
4750
5132
  });
4751
5133
  }
4752
5134
  /**
4753
- * Send a template document
5135
+ * Get a template publication
4754
5136
  *
4755
- * Sends or schedules the specified document revision for one or more recipients with optional variables.
5137
+ * Returns one immutable publication and its exact build receipt.
4756
5138
  */
4757
- static send(parameters, options) {
4758
- const params = buildClientParams([parameters], [{ args: [
4759
- {
4760
- in: "path",
4761
- key: "templateId"
4762
- },
4763
- {
4764
- in: "body",
4765
- key: "revision"
4766
- },
4767
- {
4768
- in: "body",
4769
- key: "to"
4770
- },
4771
- {
4772
- in: "body",
4773
- key: "variables"
4774
- },
4775
- {
4776
- in: "body",
4777
- key: "schedule"
4778
- }
4779
- ] }]);
4780
- return (options?.client ?? client).post({
5139
+ static getPublication(parameters, options) {
5140
+ const params = buildClientParams([parameters], [{ args: [{
5141
+ in: "path",
5142
+ key: "id"
5143
+ }, {
5144
+ in: "path",
5145
+ key: "publicationId"
5146
+ }] }]);
5147
+ return (options?.client ?? client).get({
4781
5148
  security: [{
4782
5149
  name: "x-api-key",
4783
5150
  type: "apiKey"
4784
5151
  }],
4785
- url: "/v1/template-documents/{templateId}/send",
5152
+ url: "/v1/templates/{id}/publications/{publicationId}",
4786
5153
  ...options,
4787
- ...params,
4788
- headers: {
4789
- "Content-Type": "application/json",
4790
- ...options?.headers,
4791
- ...params.headers
4792
- }
5154
+ ...params
4793
5155
  });
4794
5156
  }
4795
5157
  /**
4796
- * List template document versions
5158
+ * List a template's input contracts
4797
5159
  *
4798
- * Returns the saved source-version history for a template document.
5160
+ * Returns every immutable input contract this template has published under, newest version first. Send against a contract to follow later publications that validate input identically.
4799
5161
  */
4800
- static versions(parameters, options) {
5162
+ static listInputContracts(parameters, options) {
4801
5163
  const params = buildClientParams([parameters], [{ args: [{
4802
5164
  in: "path",
4803
- key: "templateId"
5165
+ key: "id"
4804
5166
  }] }]);
4805
5167
  return (options?.client ?? client).get({
4806
5168
  security: [{
4807
5169
  name: "x-api-key",
4808
5170
  type: "apiKey"
4809
5171
  }],
4810
- url: "/v1/template-documents/{templateId}/versions",
5172
+ url: "/v1/templates/{id}/input-contracts",
4811
5173
  ...options,
4812
5174
  ...params
4813
5175
  });
4814
5176
  }
4815
5177
  /**
4816
- * Publish a template document
5178
+ * Get a template input contract
4817
5179
  *
4818
- * Publishes the current saved template source version and returns its lifecycle receipt.
5180
+ * Returns one immutable input contract and the published schema it validates against.
4819
5181
  */
4820
- static publish(parameters, options) {
5182
+ static getInputContract(parameters, options) {
4821
5183
  const params = buildClientParams([parameters], [{ args: [{
4822
5184
  in: "path",
4823
- key: "templateId"
5185
+ key: "id"
5186
+ }, {
5187
+ in: "path",
5188
+ key: "inputContractId"
4824
5189
  }] }]);
4825
- return (options?.client ?? client).post({
5190
+ return (options?.client ?? client).get({
4826
5191
  security: [{
4827
5192
  name: "x-api-key",
4828
5193
  type: "apiKey"
4829
5194
  }],
4830
- url: "/v1/template-documents/{templateId}/publish",
5195
+ url: "/v1/templates/{id}/input-contracts/{inputContractId}",
4831
5196
  ...options,
4832
5197
  ...params
4833
5198
  });
4834
5199
  }
4835
5200
  /**
4836
- * Unpublish a template document
5201
+ * Get a template project Git repository
4837
5202
  *
4838
- * Unpublishes the current template source version and returns its lifecycle receipt.
5203
+ * Returns the credential-free HTTPS remote and default branch for the template project repository.
4839
5204
  */
4840
- static unpublish(parameters, options) {
5205
+ static getGitRepository(parameters, options) {
4841
5206
  const params = buildClientParams([parameters], [{ args: [{
4842
5207
  in: "path",
4843
- key: "templateId"
5208
+ key: "id"
4844
5209
  }] }]);
4845
- return (options?.client ?? client).post({
5210
+ return (options?.client ?? client).get({
4846
5211
  security: [{
4847
5212
  name: "x-api-key",
4848
5213
  type: "apiKey"
4849
5214
  }],
4850
- url: "/v1/template-documents/{templateId}/unpublish",
5215
+ url: "/v1/templates/{id}/repository",
4851
5216
  ...options,
4852
5217
  ...params
4853
5218
  });
4854
5219
  }
4855
5220
  /**
4856
- * Restore a template document version
5221
+ * Issue a template project Git credential
4857
5222
  *
4858
- * Restores a saved source version into the editable document when the expected revision matches.
5223
+ * Exchanges the caller's Samva authorization for a one-hour, repository-scoped Artifact Git credential.
4859
5224
  */
4860
- static restore(parameters, options) {
5225
+ static issueGitCredential(parameters, options) {
5226
+ const params = buildClientParams([parameters], [{ args: [{
5227
+ in: "path",
5228
+ key: "id"
5229
+ }, {
5230
+ in: "body",
5231
+ key: "scope"
5232
+ }] }]);
5233
+ return (options?.client ?? client).post({
5234
+ security: [{
5235
+ name: "x-api-key",
5236
+ type: "apiKey"
5237
+ }],
5238
+ url: "/v1/templates/{id}/repository/credentials",
5239
+ ...options,
5240
+ ...params,
5241
+ headers: {
5242
+ "Content-Type": "application/json",
5243
+ ...options?.headers,
5244
+ ...params.headers
5245
+ }
5246
+ });
5247
+ }
5248
+ /**
5249
+ * Attach a template workspace resource
5250
+ *
5251
+ * Adds or replaces one bounded persistent read-only resource and advances the workspace revision.
5252
+ */
5253
+ static attachWorkspaceResource(parameters, options) {
4861
5254
  const params = buildClientParams([parameters], [{ args: [
4862
5255
  {
4863
5256
  in: "path",
4864
- key: "templateId"
5257
+ key: "id"
5258
+ },
5259
+ {
5260
+ in: "body",
5261
+ key: "expectedRevision"
5262
+ },
5263
+ {
5264
+ in: "body",
5265
+ key: "resource"
4865
5266
  },
5267
+ {
5268
+ in: "body",
5269
+ key: "idempotencyKey"
5270
+ }
5271
+ ] }]);
5272
+ return (options?.client ?? client).post({
5273
+ security: [{
5274
+ name: "x-api-key",
5275
+ type: "apiKey"
5276
+ }],
5277
+ url: "/v1/templates/{id}/workspace/resources",
5278
+ ...options,
5279
+ ...params,
5280
+ headers: {
5281
+ "Content-Type": "application/json",
5282
+ ...options?.headers,
5283
+ ...params.headers
5284
+ }
5285
+ });
5286
+ }
5287
+ /**
5288
+ * Remove a template workspace resource
5289
+ *
5290
+ * Removes one persistent resource from mounted context and advances the workspace revision.
5291
+ */
5292
+ static removeWorkspaceResource(parameters, options) {
5293
+ const params = buildClientParams([parameters], [{ args: [
4866
5294
  {
4867
5295
  in: "path",
4868
- key: "versionId"
5296
+ key: "id"
5297
+ },
5298
+ {
5299
+ in: "path",
5300
+ key: "resourceId"
4869
5301
  },
4870
5302
  {
4871
5303
  in: "body",
4872
5304
  key: "expectedRevision"
5305
+ },
5306
+ {
5307
+ in: "body",
5308
+ key: "idempotencyKey"
4873
5309
  }
4874
5310
  ] }]);
4875
5311
  return (options?.client ?? client).post({
@@ -4877,7 +5313,7 @@ var TemplateDocuments = class {
4877
5313
  name: "x-api-key",
4878
5314
  type: "apiKey"
4879
5315
  }],
4880
- url: "/v1/template-documents/{templateId}/versions/{versionId}/restore",
5316
+ url: "/v1/templates/{id}/workspace/resources/{resourceId}/remove",
4881
5317
  ...options,
4882
5318
  ...params,
4883
5319
  headers: {
@@ -4934,7 +5370,7 @@ var Webhooks = class {
4934
5370
  /**
4935
5371
  * List webhooks
4936
5372
  *
4937
- * Returns a paginated list of the organization's webhook endpoints, optionally filtered by a name search.
5373
+ * Returns a paginated list of the organization's webhook endpoints with each endpoint's delivery counts, optionally filtered by name search and status.
4938
5374
  */
4939
5375
  static list(parameters, options) {
4940
5376
  const params = buildClientParams([parameters], [{ args: [
@@ -4949,6 +5385,10 @@ var Webhooks = class {
4949
5385
  {
4950
5386
  in: "query",
4951
5387
  key: "search"
5388
+ },
5389
+ {
5390
+ in: "query",
5391
+ key: "status"
4952
5392
  }
4953
5393
  ] }]);
4954
5394
  return (options?.client ?? client).get({
@@ -4964,7 +5404,7 @@ var Webhooks = class {
4964
5404
  /**
4965
5405
  * Create a webhook
4966
5406
  *
4967
- * Creates a webhook endpoint subscribed to the given event types and returns it with a 201 response.
5407
+ * Creates a signed webhook endpoint for Samva delivery and inbound events, stores subscriptions, and returns the endpoint and signing secret with a 201 response.
4968
5408
  */
4969
5409
  static create(parameters, options) {
4970
5410
  const params = buildClientParams([parameters], [{ args: [
@@ -5130,7 +5570,7 @@ var Webhooks = class {
5130
5570
  /**
5131
5571
  * List webhook delivery logs
5132
5572
  *
5133
- * Returns recent deliveries and their nested attempt diagnostics for a webhook endpoint.
5573
+ * Returns recent deliveries for a webhook endpoint, each naming the event type and time it was made for, with its nested attempt diagnostics.
5134
5574
  */
5135
5575
  static getLogs(parameters, options) {
5136
5576
  const params = buildClientParams([parameters], [{ args: [{
@@ -5153,12 +5593,15 @@ var Webhooks = class {
5153
5593
  /**
5154
5594
  * Get webhook delivery statistics
5155
5595
  *
5156
- * Returns aggregate pending, delivered, exhausted, and cancelled delivery counts for a webhook endpoint.
5596
+ * Returns aggregate pending, delivered, exhausted, and cancelled delivery counts for a webhook endpoint, plus the same counts per workspace-local calendar day over the selected period of 7, 30, or 90 days. Deliveries are retained for 90 days, so 90d is the whole history.
5157
5597
  */
5158
5598
  static getStats(parameters, options) {
5159
5599
  const params = buildClientParams([parameters], [{ args: [{
5160
5600
  in: "path",
5161
5601
  key: "webhookId"
5602
+ }, {
5603
+ in: "query",
5604
+ key: "period"
5162
5605
  }] }]);
5163
5606
  return (options?.client ?? client).get({
5164
5607
  security: [{
@@ -5349,7 +5792,7 @@ var Organizations = class {
5349
5792
  /**
5350
5793
  * Delete the current workspace
5351
5794
  *
5352
- * Accepts owner-authorized durable workspace deletion. Repeating the same request with the same Idempotency-Key returns the existing organization-scoped operation.
5795
+ * Starts an owner-authorized durable workspace deletion operation, confirming the workspace name in the request. Repeating the same request with the same Idempotency-Key returns the existing organization-scoped operation.
5353
5796
  */
5354
5797
  static delete(parameters, options) {
5355
5798
  const params = buildClientParams([parameters], [{ args: [{
@@ -5728,6 +6171,13 @@ var InternalError = class extends SamvaApiError {
5728
6171
  Object.assign(this, payload);
5729
6172
  }
5730
6173
  };
6174
+ var OnboardingReviewRequiredError = class extends SamvaApiError {
6175
+ _tag = "OnboardingReviewRequiredError";
6176
+ constructor(payload, context = {}) {
6177
+ super(messageOf("OnboardingReviewRequiredError", payload), context);
6178
+ Object.assign(this, payload);
6179
+ }
6180
+ };
5731
6181
  var PaymentRequiredError = class extends SamvaApiError {
5732
6182
  _tag = "PaymentRequiredError";
5733
6183
  constructor(payload, context = {}) {
@@ -5778,6 +6228,7 @@ const constructors = {
5778
6228
  FlagDisabledError,
5779
6229
  ForbiddenError,
5780
6230
  InternalError,
6231
+ OnboardingReviewRequiredError,
5781
6232
  PaymentRequiredError,
5782
6233
  RateLimitedError,
5783
6234
  ResourceNotFoundError,
@@ -5930,6 +6381,69 @@ const payloadSchemas = {
5930
6381
  "x-category": ["transient"],
5931
6382
  "x-retryable": true
5932
6383
  },
6384
+ OnboardingReviewRequiredError: {
6385
+ type: "object",
6386
+ properties: {
6387
+ _tag: {
6388
+ type: "string",
6389
+ enum: ["OnboardingReviewRequiredError"]
6390
+ },
6391
+ operation: { type: "string" },
6392
+ code: {
6393
+ type: "string",
6394
+ enum: [
6395
+ "review_required",
6396
+ "review_in_progress",
6397
+ "information_required",
6398
+ "review_rejected",
6399
+ "identity_review_required",
6400
+ "identity_review_rejected",
6401
+ "identity_changed"
6402
+ ]
6403
+ },
6404
+ decision: {
6405
+ type: "string",
6406
+ enum: [
6407
+ "undecided",
6408
+ "approved",
6409
+ "rejected",
6410
+ "exempt"
6411
+ ]
6412
+ },
6413
+ stage: {
6414
+ type: "string",
6415
+ enum: [
6416
+ "collecting",
6417
+ "automated_review",
6418
+ "manual_review",
6419
+ "information_requested",
6420
+ "complete"
6421
+ ]
6422
+ },
6423
+ nextAction: {
6424
+ type: "string",
6425
+ enum: [
6426
+ "wait_for_review",
6427
+ "provide_information",
6428
+ "verify_sending_identity",
6429
+ "reapply",
6430
+ "contact_support"
6431
+ ]
6432
+ },
6433
+ identityId: { anyOf: [{ type: "string" }, { type: "null" }] }
6434
+ },
6435
+ required: [
6436
+ "_tag",
6437
+ "operation",
6438
+ "code",
6439
+ "decision",
6440
+ "stage",
6441
+ "nextAction"
6442
+ ],
6443
+ additionalProperties: false,
6444
+ "x-category": ["validation"],
6445
+ "x-retryable": false
6446
+ },
5933
6447
  PaymentRequiredError: {
5934
6448
  type: "object",
5935
6449
  properties: {
@@ -6084,8 +6598,10 @@ const matchesSchema = (value, schema) => {
6084
6598
  if (schema.required?.some((key) => !Object.hasOwn(value, key)) === true) return false;
6085
6599
  const properties = schema.properties ?? {};
6086
6600
  for (const [key, propertySchema] of Object.entries(properties)) if (Object.hasOwn(value, key) && !matchesSchema(value[key], propertySchema)) return false;
6087
- if (typeof schema.additionalProperties === "object") {
6088
- for (const [key, propertyValue] of Object.entries(value)) if (!(key in properties) && !matchesSchema(propertyValue, schema.additionalProperties)) return false;
6601
+ if (schema.additionalProperties === false) {
6602
+ if (Object.keys(value).some((key) => !Object.hasOwn(properties, key))) return false;
6603
+ } else if (typeof schema.additionalProperties === "object") {
6604
+ for (const [key, propertyValue] of Object.entries(value)) if (!Object.hasOwn(properties, key) && !matchesSchema(propertyValue, schema.additionalProperties)) return false;
6089
6605
  }
6090
6606
  return true;
6091
6607
  };
@@ -6093,7 +6609,7 @@ const matchesSchema = (value, schema) => {
6093
6609
  function fromApiError(error, context = {}) {
6094
6610
  if (error instanceof SamvaApiError) return error;
6095
6611
  if (error instanceof SamvaTransportError) return error;
6096
- if (isRecord(error) && typeof error._tag === "string" && error._tag in constructors) {
6612
+ if (isRecord(error) && typeof error._tag === "string" && Object.hasOwn(constructors, error._tag)) {
6097
6613
  const tag = error._tag;
6098
6614
  if (!matchesSchema(error, payloadSchemas[tag])) return new SamvaTransportError(error, context);
6099
6615
  const Constructor = constructors[tag];
@@ -6141,6 +6657,7 @@ function createPromiseMessagesTransport(clientInstance) {
6141
6657
  getEmail: boundMessages.getEmail,
6142
6658
  getStatus: boundMessages.getStatus,
6143
6659
  getEvents: boundMessages.getEvents,
6660
+ validateEmail: boundMessages.validateEmail,
6144
6661
  send: (input, options) => Messages.send({ emailSendMessagePayload: buildMessagesSendPayload(input) }, {
6145
6662
  ...options,
6146
6663
  client: clientInstance
@@ -6152,11 +6669,13 @@ function createPromiseEmailTransport(clientInstance) {
6152
6669
  return Object.assign(boundEmail, {
6153
6670
  addSender: (input, options) => {
6154
6671
  const { replyToEmails, ...sender } = input;
6672
+ const { idempotencyKey = crypto.randomUUID(), ...requestOptions } = options ?? {};
6155
6673
  return Email.addSender({
6674
+ "idempotency-key": idempotencyKey,
6156
6675
  ...sender,
6157
6676
  ...replyToEmailsPayload(replyToEmails)
6158
6677
  }, {
6159
- ...options,
6678
+ ...requestOptions,
6160
6679
  client: clientInstance
6161
6680
  });
6162
6681
  },
@@ -6166,6 +6685,9 @@ function createPromiseEmailTransport(clientInstance) {
6166
6685
  })
6167
6686
  });
6168
6687
  }
6688
+ function createPromiseTemplatesTransport(clientInstance) {
6689
+ return createBoundService(Templates, clientInstance);
6690
+ }
6169
6691
  function createBoundService(service, clientInstance) {
6170
6692
  const bound = {};
6171
6693
  for (const key of Object.getOwnPropertyNames(service)) {
@@ -6214,17 +6736,19 @@ function createDirectService(service) {
6214
6736
  }
6215
6737
  /** Create a configured Promise client. */
6216
6738
  function createClient(config) {
6217
- const authHeaders = config.authToken ? { Authorization: `Bearer ${config.authToken}` } : { "X-API-Key": config.apiKey };
6739
+ const authHeaders = config.authToken !== void 0 ? { Authorization: `Bearer ${config.authToken}` } : { "X-API-Key": config.apiKey };
6218
6740
  const clientInstance = createClient$1({
6219
6741
  ...config,
6220
6742
  baseUrl: config.baseUrl ?? "https://api.samva.dev",
6221
- headers: {
6222
- ...config.headers,
6223
- ...authHeaders
6224
- },
6743
+ headers: mergeHeaders({ [CLIENT_ATTRIBUTION_HEADER]: clientAttribution("typescript-promise") }, config.headers, authHeaders),
6225
6744
  responseStyle: "fields",
6226
6745
  throwOnError: false
6227
6746
  });
6747
+ clientInstance.interceptors.request.use((request) => {
6748
+ const headers = new Headers(request.headers);
6749
+ for (const [name, value] of Object.entries(authHeaders)) headers.set(name, value);
6750
+ return new Request(request, { headers });
6751
+ });
6228
6752
  const raw = {
6229
6753
  client: clientInstance,
6230
6754
  messages: createBoundService(Messages, clientInstance),
@@ -6232,8 +6756,7 @@ function createClient(config) {
6232
6756
  campaigns: createBoundService(Campaigns, clientInstance),
6233
6757
  email: createBoundService(Email, clientInstance),
6234
6758
  media: createBoundService(Media, clientInstance),
6235
- templates: createBoundService(Templates, clientInstance),
6236
- templateDocuments: createBoundService(TemplateDocuments, clientInstance),
6759
+ templates: createPromiseTemplatesTransport(clientInstance),
6237
6760
  contacts: createBoundService(Contacts, clientInstance),
6238
6761
  conversations: createBoundService(Conversations, clientInstance),
6239
6762
  design: createBoundService(Design, clientInstance),
@@ -6252,7 +6775,6 @@ function createClient(config) {
6252
6775
  email: createDirectService(promiseEmail),
6253
6776
  media: createDirectService(raw.media),
6254
6777
  templates: createDirectService(raw.templates),
6255
- templateDocuments: createDirectService(raw.templateDocuments),
6256
6778
  contacts: createDirectService(raw.contacts),
6257
6779
  conversations: createDirectService(raw.conversations),
6258
6780
  design: createDirectService(raw.design),
@@ -6263,6 +6785,6 @@ function createClient(config) {
6263
6785
  };
6264
6786
  }
6265
6787
  //#endregion
6266
- export { fromApiError as _, ExternalServiceError as a, InternalError as c, ResourceNotFoundError as d, SamvaApiError as f, WebhookEnqueueError as g, ValidationError as h, EmailChannelError as i, PaymentRequiredError as l, UnauthorizedError as m, BillingProviderError as n, FlagDisabledError as o, SamvaTransportError as p, ConflictError as r, ForbiddenError as s, createClient as t, RateLimitedError as u };
6788
+ export { WebhookEnqueueError as _, ExternalServiceError as a, InternalError as c, RateLimitedError as d, ResourceNotFoundError as f, ValidationError as g, UnauthorizedError as h, EmailChannelError as i, OnboardingReviewRequiredError as l, SamvaTransportError as m, BillingProviderError as n, FlagDisabledError as o, SamvaApiError as p, ConflictError as r, ForbiddenError as s, createClient as t, PaymentRequiredError as u, fromApiError as v };
6267
6789
 
6268
- //# sourceMappingURL=promises-oiy7mOyu.js.map
6790
+ //# sourceMappingURL=promises-CP_nxUus.js.map