samva 0.2.0 → 0.4.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 (51) hide show
  1. package/AGENTS.md +1 -1
  2. package/README.md +14 -3
  3. package/dist/client/sdk.gen.d.ts +321 -129
  4. package/dist/client/types.gen.d.ts +1818 -777
  5. package/dist/{client-BqkU-sFv.js → client-BmZK_uCt.js} +2699 -1839
  6. package/dist/client-attribution-BslSOa_8.js +9 -0
  7. package/dist/client-attribution.d.ts +2 -0
  8. package/dist/effect/api-keys.d.ts +51 -51
  9. package/dist/effect/api-keys.js +1 -1
  10. package/dist/effect/campaigns.d.ts +320 -1005
  11. package/dist/effect/campaigns.js +1 -1
  12. package/dist/effect/categories.d.ts +6 -6
  13. package/dist/effect/client.js +1 -1
  14. package/dist/effect/contacts.d.ts +292 -314
  15. package/dist/effect/contacts.js +1 -1
  16. package/dist/effect/conversations.d.ts +305 -437
  17. package/dist/effect/conversations.js +1 -1
  18. package/dist/effect/design.d.ts +74 -74
  19. package/dist/effect/design.js +1 -1
  20. package/dist/effect/email.d.ts +233 -265
  21. package/dist/effect/email.js +2 -2
  22. package/dist/effect/generated.d.ts +13410 -14526
  23. package/dist/effect/index.d.ts +1 -0
  24. package/dist/effect/index.js +3 -2
  25. package/dist/effect/internal/client.d.ts +1 -1
  26. package/dist/effect/internal/operation.d.ts +32 -129
  27. package/dist/effect/media.d.ts +80 -0
  28. package/dist/effect/media.js +19 -0
  29. package/dist/effect/messages.d.ts +90 -307
  30. package/dist/effect/messages.js +1 -1
  31. package/dist/effect/operations.d.ts +17 -17
  32. package/dist/effect/operations.js +1 -1
  33. package/dist/effect/organizations.d.ts +162 -180
  34. package/dist/effect/organizations.js +1 -1
  35. package/dist/effect/runtime.d.ts +0 -2
  36. package/dist/effect/scheduled-messages.d.ts +242 -639
  37. package/dist/effect/scheduled-messages.js +1 -1
  38. package/dist/effect/templates.d.ts +1376 -2033
  39. package/dist/effect/templates.js +40 -30
  40. package/dist/effect/webhooks.d.ts +53 -54
  41. package/dist/effect/webhooks.js +2 -2
  42. package/dist/index.js +1 -1
  43. package/dist/{normalize-LkWl4HUF.js → normalize-BiIJnycv.js} +6 -15
  44. package/dist/normalize.d.ts +3 -33
  45. package/dist/{operation-Ccqh_yxb.js → operation-B1knNlxk.js} +83 -38
  46. package/dist/promises/index.d.ts +13 -21
  47. package/dist/promises/index.js +1 -1
  48. package/dist/promises/types.gen.d.ts +1 -1
  49. package/dist/{promises-Dgv8UmCC.js → promises-n1opem5V.js} +572 -184
  50. package/dist/service-map.d.ts +96 -44
  51. package/package.json +23 -19
@@ -1,4 +1,5 @@
1
- import { n as buildMessagesSendPayload, r as replyToEmailsPayload, t as buildEmailSendPayload } from "./normalize-LkWl4HUF.js";
1
+ import { n as clientAttribution, t as CLIENT_ATTRIBUTION_HEADER } from "./client-attribution-BslSOa_8.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
@@ -45,18 +46,20 @@ function buildClientParams(args, fields) {
45
46
  for (const [index, arg] of args.entries()) {
46
47
  if (fields[index]) config = fields[index];
47
48
  if (!config) continue;
48
- if ("in" in config) if (config.key) {
49
- const field = map.get(config.key);
50
- const name = field.map || config.key;
51
- if (field.in) writeSlot(field.in, name, arg);
52
- } else params.body = arg;
53
- else for (const [key, value] of Object.entries(arg ?? {})) {
49
+ if ("in" in config) {
50
+ if (config.key) {
51
+ const field = map.get(config.key);
52
+ const name = field.map || config.key;
53
+ if (field.in) writeSlot(field.in, name, arg);
54
+ } else params.body = arg;
55
+ } else for (const [key, value] of Object.entries(arg ?? {})) {
54
56
  const field = map.get(key);
55
- if (field) if (field.in) {
56
- const name = field.map || key;
57
- writeSlot(field.in, name, value);
58
- } else params[field.map] = value;
59
- else {
57
+ if (field) {
58
+ if (field.in) {
59
+ const name = field.map || key;
60
+ writeSlot(field.in, name, value);
61
+ } else params[field.map] = value;
62
+ } else {
60
63
  const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix));
61
64
  if (extra) {
62
65
  const [prefix, slot] = extra;
@@ -675,7 +678,7 @@ var Messages = class {
675
678
  /**
676
679
  * List messages
677
680
  *
678
- * 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 across all channels, with optional filters for channel, direction, status, conversation, contact, and date range.
679
682
  */
680
683
  static list(parameters, options) {
681
684
  const params = buildClientParams([parameters], [{ args: [
@@ -691,6 +694,10 @@ var Messages = class {
691
694
  in: "query",
692
695
  key: "channel"
693
696
  },
697
+ {
698
+ in: "query",
699
+ key: "direction"
700
+ },
694
701
  {
695
702
  in: "query",
696
703
  key: "status"
@@ -725,14 +732,14 @@ var Messages = class {
725
732
  /**
726
733
  * Send a message
727
734
  *
728
- * Sends a message on the requested channel and returns the created message with a 201 Created status. `channel` selects the payload variant. Email sends today; the SMS and WhatsApp variants are coming soon and answer 403 until the channel launches for your organization, so integrating against them now costs no rewrite later. Repeating an identical request with the same optional `Idempotency-Key` header returns the original message; reusing the key for different content returns a conflict.
735
+ * Sends a message on the requested channel and returns the created message with a 201 Created status. `channel` selects the payload variant. Repeating an identical request with the same optional `Idempotency-Key` header returns the original message; reusing the key for different content returns a conflict.
729
736
  */
730
737
  static send(parameters, options) {
731
738
  const params = buildClientParams([parameters], [{ args: [{
732
739
  in: "headers",
733
740
  key: "idempotency-key"
734
741
  }, {
735
- key: "body",
742
+ key: "emailSendMessagePayload",
736
743
  map: "body"
737
744
  }] }]);
738
745
  return (options?.client ?? client).post({
@@ -793,7 +800,7 @@ var Messages = class {
793
800
  /**
794
801
  * Get email message details
795
802
  *
796
- * Returns the email projection of a message, optionally including signed S3 URLs for its raw MIME, HTML, and text content.
803
+ * Returns email delivery details for a message, optionally including signed URLs for its raw MIME, HTML, and text content.
797
804
  */
798
805
  static getEmail(parameters, options) {
799
806
  const params = buildClientParams([parameters], [{ args: [
@@ -971,7 +978,7 @@ var ScheduledMessages = class {
971
978
  /**
972
979
  * Schedule a message
973
980
  *
974
- * Schedules a message at the absolute ISO-8601 instant in scheduledFor. The send payload is the same channel union the immediate send accepts, with each channel's content checked at schedule time so a send that could never render fails now rather than hours later: email schedules today, and the SMS and WhatsApp variants are coming soon and answer 403 until the channel launches. Optional timezone is validated IANA display metadata only and never changes the execution instant.
981
+ * 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.
975
982
  */
976
983
  static create(parameters, options) {
977
984
  const params = buildClientParams([parameters], [{ args: [
@@ -1413,7 +1420,7 @@ var Email = class {
1413
1420
  /**
1414
1421
  * Get email tracking defaults
1415
1422
  *
1416
- * 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.
1423
+ * Returns the workspace's independent defaults for open and click tracking, both enabled unless configured otherwise. Recipient opt-out takes precedence over these defaults.
1417
1424
  */
1418
1425
  static getTrackingDefaults(options) {
1419
1426
  return (options?.client ?? client).get({
@@ -1527,12 +1534,15 @@ var Email = class {
1527
1534
  /**
1528
1535
  * Add a sending domain
1529
1536
  *
1530
- * Registers a domain for sending and returns it with the DNS records required to verify ownership and configure DKIM. Responds with 201.
1537
+ * 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.
1531
1538
  */
1532
1539
  static addDomain(parameters, options) {
1533
1540
  const params = buildClientParams([parameters], [{ args: [{
1534
1541
  in: "body",
1535
1542
  key: "domain"
1543
+ }, {
1544
+ in: "body",
1545
+ key: "connection"
1536
1546
  }] }]);
1537
1547
  return (options?.client ?? client).post({
1538
1548
  security: [{
@@ -1904,7 +1914,7 @@ var Email = class {
1904
1914
  /**
1905
1915
  * Disable a custom tracking domain
1906
1916
  *
1907
- * 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.
1917
+ * 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.
1908
1918
  */
1909
1919
  static disableCustomTracking(parameters, options) {
1910
1920
  const params = buildClientParams([parameters], [{ args: [{
@@ -2085,10 +2095,14 @@ var Email = class {
2085
2095
  /**
2086
2096
  * Add a sender identity
2087
2097
  *
2088
- * Creates a sender identity for an email address and returns it. Responds with 201.
2098
+ * Durably creates a sender identity. The required Idempotency-Key replays the original sender for an identical request and conflicts when reused with different input.
2089
2099
  */
2090
2100
  static addSender(parameters, options) {
2091
2101
  const params = buildClientParams([parameters], [{ args: [
2102
+ {
2103
+ in: "headers",
2104
+ key: "idempotency-key"
2105
+ },
2092
2106
  {
2093
2107
  in: "body",
2094
2108
  key: "email"
@@ -2144,7 +2158,7 @@ var Email = class {
2144
2158
  /**
2145
2159
  * Remove a sender identity
2146
2160
  *
2147
- * Permanently deletes a sender identity from the organization.
2161
+ * Accepts sender removal, marks it inactive, and retains its deleting lifecycle until provider identity and association cleanup is confirmed.
2148
2162
  */
2149
2163
  static removeSender(parameters, options) {
2150
2164
  const params = buildClientParams([parameters], [{ args: [{
@@ -2835,6 +2849,131 @@ var Email = class {
2835
2849
  });
2836
2850
  }
2837
2851
  };
2852
+ var Media = class {
2853
+ /**
2854
+ * Create a media object
2855
+ *
2856
+ * 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.
2857
+ */
2858
+ static create(parameters, options) {
2859
+ const params = buildClientParams([parameters], [{ args: [
2860
+ {
2861
+ in: "body",
2862
+ key: "filename"
2863
+ },
2864
+ {
2865
+ in: "body",
2866
+ key: "contentType"
2867
+ },
2868
+ {
2869
+ in: "body",
2870
+ key: "sizeBytes"
2871
+ },
2872
+ {
2873
+ in: "body",
2874
+ key: "purpose"
2875
+ },
2876
+ {
2877
+ in: "body",
2878
+ key: "checksumSha256"
2879
+ }
2880
+ ] }]);
2881
+ return (options?.client ?? client).post({
2882
+ security: [{
2883
+ name: "x-api-key",
2884
+ type: "apiKey"
2885
+ }],
2886
+ url: "/v1/media",
2887
+ ...options,
2888
+ ...params,
2889
+ headers: {
2890
+ "Content-Type": "application/json",
2891
+ ...options?.headers,
2892
+ ...params.headers
2893
+ }
2894
+ });
2895
+ }
2896
+ /**
2897
+ * Complete a media upload
2898
+ *
2899
+ * Verifies the uploaded object exists in storage, marks the media object ready, and returns it with a download URL.
2900
+ */
2901
+ static complete(parameters, options) {
2902
+ const params = buildClientParams([parameters], [{ args: [{
2903
+ in: "path",
2904
+ key: "mediaId"
2905
+ }] }]);
2906
+ return (options?.client ?? client).post({
2907
+ security: [{
2908
+ name: "x-api-key",
2909
+ type: "apiKey"
2910
+ }],
2911
+ url: "/v1/media/{mediaId}/complete",
2912
+ ...options,
2913
+ ...params
2914
+ });
2915
+ }
2916
+ /**
2917
+ * Delete a media object
2918
+ *
2919
+ * Deletes a pending media object and the bytes stored for it. Fails if the media object is already ready.
2920
+ */
2921
+ static remove(parameters, options) {
2922
+ const params = buildClientParams([parameters], [{ args: [{
2923
+ in: "path",
2924
+ key: "mediaId"
2925
+ }] }]);
2926
+ return (options?.client ?? client).delete({
2927
+ security: [{
2928
+ name: "x-api-key",
2929
+ type: "apiKey"
2930
+ }],
2931
+ url: "/v1/media/{mediaId}",
2932
+ ...options,
2933
+ ...params
2934
+ });
2935
+ }
2936
+ /**
2937
+ * Get a media object
2938
+ *
2939
+ * Returns the media object's metadata, including status, dimensions, and confirmation timestamps.
2940
+ */
2941
+ static getById(parameters, options) {
2942
+ const params = buildClientParams([parameters], [{ args: [{
2943
+ in: "path",
2944
+ key: "mediaId"
2945
+ }] }]);
2946
+ return (options?.client ?? client).get({
2947
+ security: [{
2948
+ name: "x-api-key",
2949
+ type: "apiKey"
2950
+ }],
2951
+ url: "/v1/media/{mediaId}",
2952
+ ...options,
2953
+ ...params
2954
+ });
2955
+ }
2956
+ /**
2957
+ * Get a media download URL
2958
+ *
2959
+ * Generates a presigned, time-limited download URL for a ready media object.
2960
+ */
2961
+ static downloadUrl(parameters, options) {
2962
+ const params = buildClientParams([parameters], [{ args: [{
2963
+ in: "path",
2964
+ key: "mediaId"
2965
+ }] }]);
2966
+ return (options?.client ?? client).get({
2967
+ security: [{
2968
+ name: "x-api-key",
2969
+ type: "apiKey"
2970
+ }],
2971
+ url: "/v1/media/{mediaId}/url",
2972
+ ...options,
2973
+ ...params
2974
+ });
2975
+ }
2976
+ };
2838
2977
  var Conversations = class {
2839
2978
  /**
2840
2979
  * List conversations
@@ -3340,7 +3479,7 @@ var Contacts = class {
3340
3479
  /**
3341
3480
  * Find a contact
3342
3481
  *
3343
- * Looks up a single contact by email, phone, WhatsApp, or external ID, returning null when no contact matches.
3482
+ * Samva API operation.
3344
3483
  */
3345
3484
  static find(parameters, options) {
3346
3485
  const params = buildClientParams([parameters], [{ args: [
@@ -3352,10 +3491,6 @@ var Contacts = class {
3352
3491
  in: "body",
3353
3492
  key: "phone"
3354
3493
  },
3355
- {
3356
- in: "body",
3357
- key: "whatsapp"
3358
- },
3359
3494
  {
3360
3495
  in: "body",
3361
3496
  key: "externalId"
@@ -3391,10 +3526,6 @@ var Contacts = class {
3391
3526
  in: "body",
3392
3527
  key: "phone"
3393
3528
  },
3394
- {
3395
- in: "body",
3396
- key: "whatsapp"
3397
- },
3398
3529
  {
3399
3530
  in: "body",
3400
3531
  key: "externalId"
@@ -3842,7 +3973,7 @@ var Templates = class {
3842
3973
  /**
3843
3974
  * Create a template
3844
3975
  *
3845
- * Creates a template from SML source; the source's root tag determines the template's channel. Returns the created template with status 201.
3976
+ * Creates an email template project from Samva's canonical TSX starter and returns its template entry with status 201.
3846
3977
  */
3847
3978
  static create(parameters, options) {
3848
3979
  const params = buildClientParams([parameters], [{ args: [
@@ -3852,47 +3983,23 @@ var Templates = class {
3852
3983
  },
3853
3984
  {
3854
3985
  in: "body",
3855
- key: "slug"
3856
- },
3857
- {
3858
- in: "body",
3859
- key: "origin"
3860
- },
3861
- {
3862
- in: "body",
3863
- key: "description"
3864
- },
3865
- {
3866
- in: "body",
3867
- key: "category"
3868
- },
3869
- {
3870
- in: "body",
3871
- key: "source"
3872
- },
3873
- {
3874
- in: "body",
3875
- key: "subject"
3876
- },
3877
- {
3878
- in: "body",
3879
- key: "headers"
3986
+ key: "projectName"
3880
3987
  },
3881
3988
  {
3882
3989
  in: "body",
3883
- key: "variableSchema"
3990
+ key: "slug"
3884
3991
  },
3885
3992
  {
3886
3993
  in: "body",
3887
- key: "compliance"
3994
+ key: "galleryTemplateId"
3888
3995
  },
3889
3996
  {
3890
3997
  in: "body",
3891
- key: "performance"
3998
+ key: "description"
3892
3999
  },
3893
4000
  {
3894
4001
  in: "body",
3895
- key: "designOverrides"
4002
+ key: "category"
3896
4003
  },
3897
4004
  {
3898
4005
  in: "body",
@@ -3900,11 +4007,7 @@ var Templates = class {
3900
4007
  },
3901
4008
  {
3902
4009
  in: "body",
3903
- key: "isDefault"
3904
- },
3905
- {
3906
- in: "body",
3907
- key: "version"
4010
+ key: "idempotencyKey"
3908
4011
  }
3909
4012
  ] }]);
3910
4013
  return (options?.client ?? client).post({
@@ -3922,6 +4025,11 @@ var Templates = class {
3922
4025
  }
3923
4026
  });
3924
4027
  }
4028
+ /**
4029
+ * List templates for the dashboard
4030
+ *
4031
+ * Returns a paginated dashboard view that groups related channel templates into families and leaves standalone templates ungrouped.
4032
+ */
3925
4033
  static listDashboard(parameters, options) {
3926
4034
  const params = buildClientParams([parameters], [{ args: [
3927
4035
  {
@@ -3971,6 +4079,11 @@ var Templates = class {
3971
4079
  ...params
3972
4080
  });
3973
4081
  }
4082
+ /**
4083
+ * List template families
4084
+ *
4085
+ * Returns a paginated list of the organization's template families and members.
4086
+ */
3974
4087
  static listFamilies(parameters, options) {
3975
4088
  const params = buildClientParams([parameters], [{ args: [{
3976
4089
  in: "query",
@@ -3989,6 +4102,11 @@ var Templates = class {
3989
4102
  ...params
3990
4103
  });
3991
4104
  }
4105
+ /**
4106
+ * Create a template family
4107
+ *
4108
+ * Creates an empty template family with the supplied name and returns it with status 201.
4109
+ */
3992
4110
  static createFamily(parameters, options) {
3993
4111
  const params = buildClientParams([parameters], [{ args: [{
3994
4112
  in: "body",
@@ -4009,6 +4127,11 @@ var Templates = class {
4009
4127
  }
4010
4128
  });
4011
4129
  }
4130
+ /**
4131
+ * Delete a template family
4132
+ *
4133
+ * Deletes a template family without deleting its member templates.
4134
+ */
4012
4135
  static deleteFamily(parameters, options) {
4013
4136
  const params = buildClientParams([parameters], [{ args: [{
4014
4137
  in: "path",
@@ -4024,6 +4147,11 @@ var Templates = class {
4024
4147
  ...params
4025
4148
  });
4026
4149
  }
4150
+ /**
4151
+ * Get a template family
4152
+ *
4153
+ * Returns a template family and its channel-specific member templates.
4154
+ */
4027
4155
  static getFamily(parameters, options) {
4028
4156
  const params = buildClientParams([parameters], [{ args: [{
4029
4157
  in: "path",
@@ -4039,6 +4167,11 @@ var Templates = class {
4039
4167
  ...params
4040
4168
  });
4041
4169
  }
4170
+ /**
4171
+ * Rename a template family
4172
+ *
4173
+ * Changes a template family's name and returns the updated family.
4174
+ */
4042
4175
  static renameFamily(parameters, options) {
4043
4176
  const params = buildClientParams([parameters], [{ args: [{
4044
4177
  in: "path",
@@ -4062,6 +4195,11 @@ var Templates = class {
4062
4195
  }
4063
4196
  });
4064
4197
  }
4198
+ /**
4199
+ * Create a family from a template
4200
+ *
4201
+ * Creates a template family containing the specified template and returns the new family with status 201.
4202
+ */
4065
4203
  static createFamilyFromTemplate(parameters, options) {
4066
4204
  const params = buildClientParams([parameters], [{ args: [{
4067
4205
  in: "path",
@@ -4085,6 +4223,11 @@ var Templates = class {
4085
4223
  }
4086
4224
  });
4087
4225
  }
4226
+ /**
4227
+ * Detach a template from a family
4228
+ *
4229
+ * Removes a member template from the family without deleting the template.
4230
+ */
4088
4231
  static detachFamilyMember(parameters, options) {
4089
4232
  const params = buildClientParams([parameters], [{ args: [{
4090
4233
  in: "path",
@@ -4103,6 +4246,11 @@ var Templates = class {
4103
4246
  ...params
4104
4247
  });
4105
4248
  }
4249
+ /**
4250
+ * Attach a template to a family
4251
+ *
4252
+ * Adds an existing template as a channel member of the family and returns the updated family.
4253
+ */
4106
4254
  static attachFamilyMember(parameters, options) {
4107
4255
  const params = buildClientParams([parameters], [{ args: [{
4108
4256
  in: "path",
@@ -4121,24 +4269,6 @@ var Templates = class {
4121
4269
  ...params
4122
4270
  });
4123
4271
  }
4124
- static addFamilyChannel(parameters, options) {
4125
- const params = buildClientParams([parameters], [{ args: [{
4126
- in: "path",
4127
- key: "familyId"
4128
- }, {
4129
- in: "path",
4130
- key: "channel"
4131
- }] }]);
4132
- return (options?.client ?? client).post({
4133
- security: [{
4134
- name: "x-api-key",
4135
- type: "apiKey"
4136
- }],
4137
- url: "/v1/templates/families/{familyId}/channels/{channel}",
4138
- ...options,
4139
- ...params
4140
- });
4141
- }
4142
4272
  /**
4143
4273
  * Delete a template
4144
4274
  *
@@ -4162,7 +4292,7 @@ var Templates = class {
4162
4292
  /**
4163
4293
  * Get a template
4164
4294
  *
4165
- * Returns template metadata and compiled channel content. Read live SML through the template-document API.
4295
+ * Returns template metadata, its project entry path, and compiled channel content. Open live project files through the workspace API.
4166
4296
  */
4167
4297
  static getById(parameters, options) {
4168
4298
  const params = buildClientParams([parameters], [{ args: [{
@@ -4182,7 +4312,7 @@ var Templates = class {
4182
4312
  /**
4183
4313
  * Update a template
4184
4314
  *
4185
- * Updates template metadata. Source changes use the template-document revision API.
4315
+ * Updates template metadata. Source changes use the project workspace API.
4186
4316
  */
4187
4317
  static update(parameters, options) {
4188
4318
  const params = buildClientParams([parameters], [{ args: [{
@@ -4208,24 +4338,35 @@ var Templates = class {
4208
4338
  });
4209
4339
  }
4210
4340
  /**
4211
- * Approve a template
4341
+ * Patch template project files
4212
4342
  *
4213
- * Records compliance approval for a template with optional notes and moves its status to approved unless it is already published or archived.
4343
+ * Applies revision-checked file patches to the shared project workspace overlay.
4214
4344
  */
4215
- static approve(parameters, options) {
4216
- const params = buildClientParams([parameters], [{ args: [{
4217
- in: "path",
4218
- key: "id"
4219
- }, {
4220
- in: "body",
4221
- key: "data"
4222
- }] }]);
4223
- return (options?.client ?? client).post({
4345
+ static patchWorkspace(parameters, options) {
4346
+ const params = buildClientParams([parameters], [{ args: [
4347
+ {
4348
+ in: "path",
4349
+ key: "id"
4350
+ },
4351
+ {
4352
+ in: "body",
4353
+ key: "expectedRevision"
4354
+ },
4355
+ {
4356
+ in: "body",
4357
+ key: "patches"
4358
+ },
4359
+ {
4360
+ in: "body",
4361
+ key: "idempotencyKey"
4362
+ }
4363
+ ] }]);
4364
+ return (options?.client ?? client).patch({
4224
4365
  security: [{
4225
4366
  name: "x-api-key",
4226
4367
  type: "apiKey"
4227
4368
  }],
4228
- url: "/v1/templates/{id}/approve",
4369
+ url: "/v1/templates/{id}/workspace",
4229
4370
  ...options,
4230
4371
  ...params,
4231
4372
  headers: {
@@ -4235,48 +4376,64 @@ var Templates = class {
4235
4376
  }
4236
4377
  });
4237
4378
  }
4238
- };
4239
- var TemplateDocuments = class {
4240
- static bootstrap(parameters, options) {
4379
+ /**
4380
+ * Open a template project workspace
4381
+ *
4382
+ * Creates or opens the shared project workspace at the current Artifact branch head and returns its effective files.
4383
+ */
4384
+ static openWorkspace(parameters, options) {
4241
4385
  const params = buildClientParams([parameters], [{ args: [{
4242
- in: "body",
4243
- key: "templateId"
4386
+ in: "path",
4387
+ key: "id"
4244
4388
  }] }]);
4245
4389
  return (options?.client ?? client).post({
4246
4390
  security: [{
4247
4391
  name: "x-api-key",
4248
4392
  type: "apiKey"
4249
4393
  }],
4250
- url: "/v1/template-documents/bootstrap",
4394
+ url: "/v1/templates/{id}/workspace",
4251
4395
  ...options,
4252
- ...params,
4253
- headers: {
4254
- "Content-Type": "application/json",
4255
- ...options?.headers,
4256
- ...params.headers
4257
- }
4396
+ ...params
4258
4397
  });
4259
4398
  }
4260
- static get(parameters, options) {
4399
+ /**
4400
+ * Diff a template project workspace
4401
+ *
4402
+ * Returns exact added, modified, and deleted project files against the current Git base commit.
4403
+ */
4404
+ static diffWorkspace(parameters, options) {
4261
4405
  const params = buildClientParams([parameters], [{ args: [{
4262
4406
  in: "path",
4263
- key: "templateId"
4407
+ key: "id"
4408
+ }, {
4409
+ in: "body",
4410
+ key: "expectedRevision"
4264
4411
  }] }]);
4265
- return (options?.client ?? client).get({
4412
+ return (options?.client ?? client).post({
4266
4413
  security: [{
4267
4414
  name: "x-api-key",
4268
4415
  type: "apiKey"
4269
4416
  }],
4270
- url: "/v1/template-documents/{templateId}",
4417
+ url: "/v1/templates/{id}/workspace/diff",
4271
4418
  ...options,
4272
- ...params
4419
+ ...params,
4420
+ headers: {
4421
+ "Content-Type": "application/json",
4422
+ ...options?.headers,
4423
+ ...params.headers
4424
+ }
4273
4425
  });
4274
4426
  }
4275
- static replace(parameters, options) {
4427
+ /**
4428
+ * Reconcile a template project workspace
4429
+ *
4430
+ * Fast-forwards or rebases the workspace onto the current Artifact branch head, retaining file conflicts for explicit resolution.
4431
+ */
4432
+ static reconcileWorkspace(parameters, options) {
4276
4433
  const params = buildClientParams([parameters], [{ args: [
4277
4434
  {
4278
4435
  in: "path",
4279
- key: "templateId"
4436
+ key: "id"
4280
4437
  },
4281
4438
  {
4282
4439
  in: "body",
@@ -4284,7 +4441,15 @@ var TemplateDocuments = class {
4284
4441
  },
4285
4442
  {
4286
4443
  in: "body",
4287
- key: "source"
4444
+ key: "assetResolution"
4445
+ },
4446
+ {
4447
+ in: "body",
4448
+ key: "expectedRemoteHead"
4449
+ },
4450
+ {
4451
+ in: "body",
4452
+ key: "idempotencyKey"
4288
4453
  }
4289
4454
  ] }]);
4290
4455
  return (options?.client ?? client).post({
@@ -4292,7 +4457,7 @@ var TemplateDocuments = class {
4292
4457
  name: "x-api-key",
4293
4458
  type: "apiKey"
4294
4459
  }],
4295
- url: "/v1/template-documents/{templateId}/source",
4460
+ url: "/v1/templates/{id}/workspace/reconcile",
4296
4461
  ...options,
4297
4462
  ...params,
4298
4463
  headers: {
@@ -4302,20 +4467,40 @@ var TemplateDocuments = class {
4302
4467
  }
4303
4468
  });
4304
4469
  }
4305
- static save(parameters, options) {
4306
- const params = buildClientParams([parameters], [{ args: [{
4307
- in: "path",
4308
- key: "templateId"
4309
- }, {
4310
- in: "body",
4311
- key: "revision"
4312
- }] }]);
4470
+ /**
4471
+ * Resolve a template workspace conflict
4472
+ *
4473
+ * Resolves one conflicted file by keeping the draft, using main, or supplying edited source.
4474
+ */
4475
+ static resolveWorkspaceConflict(parameters, options) {
4476
+ const params = buildClientParams([parameters], [{ args: [
4477
+ {
4478
+ in: "path",
4479
+ key: "id"
4480
+ },
4481
+ {
4482
+ in: "body",
4483
+ key: "expectedRevision"
4484
+ },
4485
+ {
4486
+ in: "body",
4487
+ key: "path"
4488
+ },
4489
+ {
4490
+ in: "body",
4491
+ key: "resolution"
4492
+ },
4493
+ {
4494
+ in: "body",
4495
+ key: "idempotencyKey"
4496
+ }
4497
+ ] }]);
4313
4498
  return (options?.client ?? client).post({
4314
4499
  security: [{
4315
4500
  name: "x-api-key",
4316
4501
  type: "apiKey"
4317
4502
  }],
4318
- url: "/v1/template-documents/{templateId}/save",
4503
+ url: "/v1/templates/{id}/workspace/conflicts",
4319
4504
  ...options,
4320
4505
  ...params,
4321
4506
  headers: {
@@ -4325,19 +4510,32 @@ var TemplateDocuments = class {
4325
4510
  }
4326
4511
  });
4327
4512
  }
4328
- static render(parameters, options) {
4513
+ /**
4514
+ * Save a template project workspace
4515
+ *
4516
+ * Validates the effective project tree and creates one normal Git commit on the Artifact default branch.
4517
+ */
4518
+ static saveWorkspace(parameters, options) {
4329
4519
  const params = buildClientParams([parameters], [{ args: [
4330
4520
  {
4331
4521
  in: "path",
4332
- key: "templateId"
4522
+ key: "id"
4333
4523
  },
4334
4524
  {
4335
4525
  in: "body",
4336
- key: "revision"
4526
+ key: "expectedRevision"
4337
4527
  },
4338
4528
  {
4339
4529
  in: "body",
4340
- key: "variables"
4530
+ key: "expectedHead"
4531
+ },
4532
+ {
4533
+ in: "body",
4534
+ key: "message"
4535
+ },
4536
+ {
4537
+ in: "body",
4538
+ key: "idempotencyKey"
4341
4539
  }
4342
4540
  ] }]);
4343
4541
  return (options?.client ?? client).post({
@@ -4345,7 +4543,7 @@ var TemplateDocuments = class {
4345
4543
  name: "x-api-key",
4346
4544
  type: "apiKey"
4347
4545
  }],
4348
- url: "/v1/template-documents/{templateId}/render",
4546
+ url: "/v1/templates/{id}/workspace/save",
4349
4547
  ...options,
4350
4548
  ...params,
4351
4549
  headers: {
@@ -4355,19 +4553,28 @@ var TemplateDocuments = class {
4355
4553
  }
4356
4554
  });
4357
4555
  }
4358
- static spamCheck(parameters, options) {
4556
+ /**
4557
+ * Stage a historical template project tree
4558
+ *
4559
+ * 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.
4560
+ */
4561
+ static restoreWorkspace(parameters, options) {
4359
4562
  const params = buildClientParams([parameters], [{ args: [
4360
4563
  {
4361
4564
  in: "path",
4362
- key: "templateId"
4565
+ key: "id"
4363
4566
  },
4364
4567
  {
4365
4568
  in: "body",
4366
- key: "revision"
4569
+ key: "expectedRevision"
4367
4570
  },
4368
4571
  {
4369
4572
  in: "body",
4370
- key: "variables"
4573
+ key: "commit"
4574
+ },
4575
+ {
4576
+ in: "body",
4577
+ key: "idempotencyKey"
4371
4578
  }
4372
4579
  ] }]);
4373
4580
  return (options?.client ?? client).post({
@@ -4375,7 +4582,58 @@ var TemplateDocuments = class {
4375
4582
  name: "x-api-key",
4376
4583
  type: "apiKey"
4377
4584
  }],
4378
- url: "/v1/template-documents/{templateId}/spam-check",
4585
+ url: "/v1/templates/{id}/workspace/restore",
4586
+ ...options,
4587
+ ...params,
4588
+ headers: {
4589
+ "Content-Type": "application/json",
4590
+ ...options?.headers,
4591
+ ...params.headers
4592
+ }
4593
+ });
4594
+ }
4595
+ /**
4596
+ * List template project commit history
4597
+ *
4598
+ * Returns bounded history from the Artifact repository default branch.
4599
+ */
4600
+ static workspaceHistory(parameters, options) {
4601
+ const params = buildClientParams([parameters], [{ args: [{
4602
+ in: "path",
4603
+ key: "id"
4604
+ }, {
4605
+ in: "query",
4606
+ key: "limit"
4607
+ }] }]);
4608
+ return (options?.client ?? client).get({
4609
+ security: [{
4610
+ name: "x-api-key",
4611
+ type: "apiKey"
4612
+ }],
4613
+ url: "/v1/templates/{id}/workspace/history",
4614
+ ...options,
4615
+ ...params
4616
+ });
4617
+ }
4618
+ /**
4619
+ * Check a template project workspace
4620
+ *
4621
+ * 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.
4622
+ */
4623
+ static checkWorkspace(parameters, options) {
4624
+ const params = buildClientParams([parameters], [{ args: [{
4625
+ in: "path",
4626
+ key: "id"
4627
+ }, {
4628
+ in: "body",
4629
+ key: "expectedRevision"
4630
+ }] }]);
4631
+ return (options?.client ?? client).post({
4632
+ security: [{
4633
+ name: "x-api-key",
4634
+ type: "apiKey"
4635
+ }],
4636
+ url: "/v1/templates/{id}/workspace/check",
4379
4637
  ...options,
4380
4638
  ...params,
4381
4639
  headers: {
@@ -4385,23 +4643,24 @@ var TemplateDocuments = class {
4385
4643
  }
4386
4644
  });
4387
4645
  }
4388
- static testSend(parameters, options) {
4646
+ /**
4647
+ * Render a declared template workspace fixture
4648
+ *
4649
+ * 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.
4650
+ */
4651
+ static renderWorkspaceFixture(parameters, options) {
4389
4652
  const params = buildClientParams([parameters], [{ args: [
4390
4653
  {
4391
4654
  in: "path",
4392
- key: "templateId"
4393
- },
4394
- {
4395
- in: "body",
4396
- key: "revision"
4655
+ key: "id"
4397
4656
  },
4398
4657
  {
4399
4658
  in: "body",
4400
- key: "to"
4659
+ key: "expectedRevision"
4401
4660
  },
4402
4661
  {
4403
4662
  in: "body",
4404
- key: "variables"
4663
+ key: "fixture"
4405
4664
  }
4406
4665
  ] }]);
4407
4666
  return (options?.client ?? client).post({
@@ -4409,7 +4668,7 @@ var TemplateDocuments = class {
4409
4668
  name: "x-api-key",
4410
4669
  type: "apiKey"
4411
4670
  }],
4412
- url: "/v1/template-documents/{templateId}/send-test",
4671
+ url: "/v1/templates/{id}/workspace/fixtures",
4413
4672
  ...options,
4414
4673
  ...params,
4415
4674
  headers: {
@@ -4419,27 +4678,32 @@ var TemplateDocuments = class {
4419
4678
  }
4420
4679
  });
4421
4680
  }
4422
- static send(parameters, options) {
4681
+ /**
4682
+ * Publish an exact template commit
4683
+ *
4684
+ * 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.
4685
+ */
4686
+ static publish(parameters, options) {
4423
4687
  const params = buildClientParams([parameters], [{ args: [
4424
4688
  {
4425
4689
  in: "path",
4426
- key: "templateId"
4690
+ key: "id"
4427
4691
  },
4428
4692
  {
4429
4693
  in: "body",
4430
- key: "revision"
4694
+ key: "projectId"
4431
4695
  },
4432
4696
  {
4433
4697
  in: "body",
4434
- key: "to"
4698
+ key: "commitSha"
4435
4699
  },
4436
4700
  {
4437
4701
  in: "body",
4438
- key: "variables"
4702
+ key: "entryPath"
4439
4703
  },
4440
4704
  {
4441
4705
  in: "body",
4442
- key: "schedule"
4706
+ key: "expectedWorkspaceRevision"
4443
4707
  }
4444
4708
  ] }]);
4445
4709
  return (options?.client ?? client).post({
@@ -4447,7 +4711,7 @@ var TemplateDocuments = class {
4447
4711
  name: "x-api-key",
4448
4712
  type: "apiKey"
4449
4713
  }],
4450
- url: "/v1/template-documents/{templateId}/send",
4714
+ url: "/v1/templates/{id}/publications",
4451
4715
  ...options,
4452
4716
  ...params,
4453
4717
  headers: {
@@ -4457,64 +4721,181 @@ var TemplateDocuments = class {
4457
4721
  }
4458
4722
  });
4459
4723
  }
4460
- static versions(parameters, options) {
4724
+ /**
4725
+ * Get a template publication
4726
+ *
4727
+ * Returns one immutable publication and its exact build receipt.
4728
+ */
4729
+ static getPublication(parameters, options) {
4461
4730
  const params = buildClientParams([parameters], [{ args: [{
4462
4731
  in: "path",
4463
- key: "templateId"
4732
+ key: "id"
4733
+ }, {
4734
+ in: "path",
4735
+ key: "publicationId"
4464
4736
  }] }]);
4465
4737
  return (options?.client ?? client).get({
4466
4738
  security: [{
4467
4739
  name: "x-api-key",
4468
4740
  type: "apiKey"
4469
4741
  }],
4470
- url: "/v1/template-documents/{templateId}/versions",
4742
+ url: "/v1/templates/{id}/publications/{publicationId}",
4471
4743
  ...options,
4472
4744
  ...params
4473
4745
  });
4474
4746
  }
4475
- static publish(parameters, options) {
4747
+ /**
4748
+ * List a template's input contracts
4749
+ *
4750
+ * 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.
4751
+ */
4752
+ static listInputContracts(parameters, options) {
4476
4753
  const params = buildClientParams([parameters], [{ args: [{
4477
4754
  in: "path",
4478
- key: "templateId"
4755
+ key: "id"
4479
4756
  }] }]);
4480
- return (options?.client ?? client).post({
4757
+ return (options?.client ?? client).get({
4481
4758
  security: [{
4482
4759
  name: "x-api-key",
4483
4760
  type: "apiKey"
4484
4761
  }],
4485
- url: "/v1/template-documents/{templateId}/publish",
4762
+ url: "/v1/templates/{id}/input-contracts",
4486
4763
  ...options,
4487
4764
  ...params
4488
4765
  });
4489
4766
  }
4490
- static unpublish(parameters, options) {
4767
+ /**
4768
+ * Get a template input contract
4769
+ *
4770
+ * Returns one immutable input contract and the published schema it validates against.
4771
+ */
4772
+ static getInputContract(parameters, options) {
4491
4773
  const params = buildClientParams([parameters], [{ args: [{
4492
4774
  in: "path",
4493
- key: "templateId"
4775
+ key: "id"
4776
+ }, {
4777
+ in: "path",
4778
+ key: "inputContractId"
4494
4779
  }] }]);
4495
- return (options?.client ?? client).post({
4780
+ return (options?.client ?? client).get({
4496
4781
  security: [{
4497
4782
  name: "x-api-key",
4498
4783
  type: "apiKey"
4499
4784
  }],
4500
- url: "/v1/template-documents/{templateId}/unpublish",
4785
+ url: "/v1/templates/{id}/input-contracts/{inputContractId}",
4501
4786
  ...options,
4502
4787
  ...params
4503
4788
  });
4504
4789
  }
4505
- static restore(parameters, options) {
4790
+ /**
4791
+ * Get a template project Git repository
4792
+ *
4793
+ * Returns the credential-free HTTPS remote and default branch for the template project repository.
4794
+ */
4795
+ static getGitRepository(parameters, options) {
4796
+ const params = buildClientParams([parameters], [{ args: [{
4797
+ in: "path",
4798
+ key: "id"
4799
+ }] }]);
4800
+ return (options?.client ?? client).get({
4801
+ security: [{
4802
+ name: "x-api-key",
4803
+ type: "apiKey"
4804
+ }],
4805
+ url: "/v1/templates/{id}/repository",
4806
+ ...options,
4807
+ ...params
4808
+ });
4809
+ }
4810
+ /**
4811
+ * Issue a template project Git credential
4812
+ *
4813
+ * Exchanges the caller's Samva authorization for a one-hour, repository-scoped Artifact Git credential.
4814
+ */
4815
+ static issueGitCredential(parameters, options) {
4816
+ const params = buildClientParams([parameters], [{ args: [{
4817
+ in: "path",
4818
+ key: "id"
4819
+ }, {
4820
+ in: "body",
4821
+ key: "scope"
4822
+ }] }]);
4823
+ return (options?.client ?? client).post({
4824
+ security: [{
4825
+ name: "x-api-key",
4826
+ type: "apiKey"
4827
+ }],
4828
+ url: "/v1/templates/{id}/repository/credentials",
4829
+ ...options,
4830
+ ...params,
4831
+ headers: {
4832
+ "Content-Type": "application/json",
4833
+ ...options?.headers,
4834
+ ...params.headers
4835
+ }
4836
+ });
4837
+ }
4838
+ /**
4839
+ * Attach a template workspace resource
4840
+ *
4841
+ * Adds or replaces one bounded persistent read-only resource and advances the workspace revision.
4842
+ */
4843
+ static attachWorkspaceResource(parameters, options) {
4844
+ const params = buildClientParams([parameters], [{ args: [
4845
+ {
4846
+ in: "path",
4847
+ key: "id"
4848
+ },
4849
+ {
4850
+ in: "body",
4851
+ key: "expectedRevision"
4852
+ },
4853
+ {
4854
+ in: "body",
4855
+ key: "resource"
4856
+ },
4857
+ {
4858
+ in: "body",
4859
+ key: "idempotencyKey"
4860
+ }
4861
+ ] }]);
4862
+ return (options?.client ?? client).post({
4863
+ security: [{
4864
+ name: "x-api-key",
4865
+ type: "apiKey"
4866
+ }],
4867
+ url: "/v1/templates/{id}/workspace/resources",
4868
+ ...options,
4869
+ ...params,
4870
+ headers: {
4871
+ "Content-Type": "application/json",
4872
+ ...options?.headers,
4873
+ ...params.headers
4874
+ }
4875
+ });
4876
+ }
4877
+ /**
4878
+ * Remove a template workspace resource
4879
+ *
4880
+ * Removes one persistent resource from mounted context and advances the workspace revision.
4881
+ */
4882
+ static removeWorkspaceResource(parameters, options) {
4506
4883
  const params = buildClientParams([parameters], [{ args: [
4507
4884
  {
4508
4885
  in: "path",
4509
- key: "templateId"
4886
+ key: "id"
4510
4887
  },
4511
4888
  {
4512
4889
  in: "path",
4513
- key: "versionId"
4890
+ key: "resourceId"
4514
4891
  },
4515
4892
  {
4516
4893
  in: "body",
4517
4894
  key: "expectedRevision"
4895
+ },
4896
+ {
4897
+ in: "body",
4898
+ key: "idempotencyKey"
4518
4899
  }
4519
4900
  ] }]);
4520
4901
  return (options?.client ?? client).post({
@@ -4522,7 +4903,7 @@ var TemplateDocuments = class {
4522
4903
  name: "x-api-key",
4523
4904
  type: "apiKey"
4524
4905
  }],
4525
- url: "/v1/template-documents/{templateId}/versions/{versionId}/restore",
4906
+ url: "/v1/templates/{id}/workspace/resources/{resourceId}/remove",
4526
4907
  ...options,
4527
4908
  ...params,
4528
4909
  headers: {
@@ -4609,7 +4990,7 @@ var Webhooks = class {
4609
4990
  /**
4610
4991
  * Create a webhook
4611
4992
  *
4612
- * Creates a webhook endpoint subscribed to the given event types and returns it with a 201 response.
4993
+ * Creates a signed webhook endpoint for Samva delivery and inbound events, stores subscriptions, and returns the endpoint and signing secret with a 201 response.
4613
4994
  */
4614
4995
  static create(parameters, options) {
4615
4996
  const params = buildClientParams([parameters], [{ args: [
@@ -4994,7 +5375,7 @@ var Organizations = class {
4994
5375
  /**
4995
5376
  * Delete the current workspace
4996
5377
  *
4997
- * Accepts owner-authorized durable workspace deletion. Repeating the same request with the same Idempotency-Key returns the existing organization-scoped operation.
5378
+ * 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.
4998
5379
  */
4999
5380
  static delete(parameters, options) {
5000
5381
  const params = buildClientParams([parameters], [{ args: [{
@@ -5197,7 +5578,7 @@ var ApiKeys = class {
5197
5578
  /**
5198
5579
  * Rotate an API key
5199
5580
  *
5200
- * Deactivates the existing key and issues a replacement with the same name and permissions. Returns the new key, including the plaintext secret.
5581
+ * Issues a replacement with the same owner, name, and permissions, then deactivates the existing key. Returns the new key, including the plaintext secret.
5201
5582
  */
5202
5583
  static rotate(parameters, options) {
5203
5584
  const params = buildClientParams([parameters], [{ args: [{
@@ -5786,7 +6167,7 @@ function createPromiseMessagesTransport(clientInstance) {
5786
6167
  getEmail: boundMessages.getEmail,
5787
6168
  getStatus: boundMessages.getStatus,
5788
6169
  getEvents: boundMessages.getEvents,
5789
- send: (input, options) => Messages.send({ body: buildMessagesSendPayload(input) }, {
6170
+ send: (input, options) => Messages.send({ emailSendMessagePayload: buildMessagesSendPayload(input) }, {
5790
6171
  ...options,
5791
6172
  client: clientInstance
5792
6173
  })
@@ -5797,20 +6178,25 @@ function createPromiseEmailTransport(clientInstance) {
5797
6178
  return Object.assign(boundEmail, {
5798
6179
  addSender: (input, options) => {
5799
6180
  const { replyToEmails, ...sender } = input;
6181
+ const { idempotencyKey = crypto.randomUUID(), ...requestOptions } = options ?? {};
5800
6182
  return Email.addSender({
6183
+ "idempotency-key": idempotencyKey,
5801
6184
  ...sender,
5802
6185
  ...replyToEmailsPayload(replyToEmails)
5803
6186
  }, {
5804
- ...options,
6187
+ ...requestOptions,
5805
6188
  client: clientInstance
5806
6189
  });
5807
6190
  },
5808
- send: (input, options) => Messages.send({ body: buildEmailSendPayload(input) }, {
6191
+ send: (input, options) => Messages.send({ emailSendMessagePayload: buildEmailSendPayload(input) }, {
5809
6192
  ...options,
5810
6193
  client: clientInstance
5811
6194
  })
5812
6195
  });
5813
6196
  }
6197
+ function createPromiseTemplatesTransport(clientInstance) {
6198
+ return createBoundService(Templates, clientInstance);
6199
+ }
5814
6200
  function createBoundService(service, clientInstance) {
5815
6201
  const bound = {};
5816
6202
  for (const key of Object.getOwnPropertyNames(service)) {
@@ -5859,25 +6245,27 @@ function createDirectService(service) {
5859
6245
  }
5860
6246
  /** Create a configured Promise client. */
5861
6247
  function createClient(config) {
5862
- const authHeaders = config.authToken ? { Authorization: `Bearer ${config.authToken}` } : { "X-API-Key": config.apiKey };
6248
+ const authHeaders = config.authToken !== void 0 ? { Authorization: `Bearer ${config.authToken}` } : { "X-API-Key": config.apiKey };
5863
6249
  const clientInstance = createClient$1({
5864
6250
  ...config,
5865
6251
  baseUrl: config.baseUrl ?? "https://api.samva.dev",
5866
- headers: {
5867
- ...config.headers,
5868
- ...authHeaders
5869
- },
6252
+ headers: mergeHeaders({ [CLIENT_ATTRIBUTION_HEADER]: clientAttribution("typescript-promise") }, config.headers, authHeaders),
5870
6253
  responseStyle: "fields",
5871
6254
  throwOnError: false
5872
6255
  });
6256
+ clientInstance.interceptors.request.use((request) => {
6257
+ const headers = new Headers(request.headers);
6258
+ for (const [name, value] of Object.entries(authHeaders)) headers.set(name, value);
6259
+ return new Request(request, { headers });
6260
+ });
5873
6261
  const raw = {
5874
6262
  client: clientInstance,
5875
6263
  messages: createBoundService(Messages, clientInstance),
5876
6264
  scheduledMessages: createBoundService(ScheduledMessages, clientInstance),
5877
6265
  campaigns: createBoundService(Campaigns, clientInstance),
5878
6266
  email: createBoundService(Email, clientInstance),
5879
- templates: createBoundService(Templates, clientInstance),
5880
- templateDocuments: createBoundService(TemplateDocuments, clientInstance),
6267
+ media: createBoundService(Media, clientInstance),
6268
+ templates: createPromiseTemplatesTransport(clientInstance),
5881
6269
  contacts: createBoundService(Contacts, clientInstance),
5882
6270
  conversations: createBoundService(Conversations, clientInstance),
5883
6271
  design: createBoundService(Design, clientInstance),
@@ -5894,8 +6282,8 @@ function createClient(config) {
5894
6282
  scheduledMessages: createDirectService(raw.scheduledMessages),
5895
6283
  campaigns: createDirectService(raw.campaigns),
5896
6284
  email: createDirectService(promiseEmail),
6285
+ media: createDirectService(raw.media),
5897
6286
  templates: createDirectService(raw.templates),
5898
- templateDocuments: createDirectService(raw.templateDocuments),
5899
6287
  contacts: createDirectService(raw.contacts),
5900
6288
  conversations: createDirectService(raw.conversations),
5901
6289
  design: createDirectService(raw.design),
@@ -5908,4 +6296,4 @@ function createClient(config) {
5908
6296
  //#endregion
5909
6297
  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 };
5910
6298
 
5911
- //# sourceMappingURL=promises-Dgv8UmCC.js.map
6299
+ //# sourceMappingURL=promises-n1opem5V.js.map