samva 0.12.0 → 0.14.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 (75) hide show
  1. package/AGENTS.md +9 -0
  2. package/README.md +51 -6
  3. package/dist/{categories-DvsHUJtX.js → categories-BGUBFdH9.js} +13 -1
  4. package/dist/client/sdk.gen.d.ts +130 -32
  5. package/dist/client/types.gen.d.ts +979 -168
  6. package/dist/{client-Cj1bqIEe.js → client-CZjhOKPM.js} +898 -177
  7. package/dist/effect/analytics.d.ts +6 -6
  8. package/dist/effect/analytics.js +1 -1
  9. package/dist/effect/api-keys.d.ts +20 -20
  10. package/dist/effect/api-keys.js +1 -1
  11. package/dist/effect/attachments.js +1 -1
  12. package/dist/effect/brands.js +2 -2
  13. package/dist/effect/campaigns.d.ts +13 -13
  14. package/dist/effect/campaigns.js +1 -1
  15. package/dist/effect/categories.js +1 -1
  16. package/dist/effect/client.js +1 -1
  17. package/dist/effect/contact-groups.d.ts +9 -12
  18. package/dist/effect/contact-groups.js +1 -1
  19. package/dist/effect/contacts.d.ts +161 -76
  20. package/dist/effect/contacts.js +1 -1
  21. package/dist/effect/conversations.d.ts +20 -20
  22. package/dist/effect/conversations.js +1 -1
  23. package/dist/effect/custom-fields.d.ts +1 -1
  24. package/dist/effect/custom-fields.js +1 -1
  25. package/dist/effect/email.d.ts +27 -27
  26. package/dist/effect/email.js +2 -2
  27. package/dist/effect/extension-installations.d.ts +68 -2
  28. package/dist/effect/extension-installations.js +5 -3
  29. package/dist/effect/extensions.d.ts +3 -3
  30. package/dist/effect/extensions.js +1 -1
  31. package/dist/effect/feedback.d.ts +1 -1
  32. package/dist/effect/feedback.js +2 -2
  33. package/dist/effect/generated-metadata.d.ts +12 -0
  34. package/dist/effect/generated.d.ts +6502 -906
  35. package/dist/effect/index.d.ts +3 -1
  36. package/dist/effect/index.js +6 -4
  37. package/dist/effect/internal/client.d.ts +16 -2
  38. package/dist/effect/internal/operation.d.ts +14 -11
  39. package/dist/effect/mailboxes.d.ts +1725 -108
  40. package/dist/effect/mailboxes.js +3 -3
  41. package/dist/effect/media.d.ts +1 -1
  42. package/dist/effect/media.js +1 -1
  43. package/dist/effect/messages.d.ts +21 -19
  44. package/dist/effect/messages.js +1 -1
  45. package/dist/effect/namespaces.js +1 -1
  46. package/dist/effect/operations.d.ts +6 -6
  47. package/dist/effect/operations.js +1 -1
  48. package/dist/effect/organizations.d.ts +30 -0
  49. package/dist/effect/organizations.js +4 -2
  50. package/dist/effect/retry.js +1 -1
  51. package/dist/effect/scheduled-messages.d.ts +7 -7
  52. package/dist/effect/scheduled-messages.js +1 -1
  53. package/dist/effect/subscriptions.d.ts +15 -0
  54. package/dist/effect/subscriptions.js +9 -0
  55. package/dist/effect/templates.d.ts +52 -14
  56. package/dist/effect/templates.js +5 -3
  57. package/dist/effect/unsubscribe-groups.d.ts +1 -1
  58. package/dist/effect/unsubscribe-groups.js +1 -1
  59. package/dist/effect/webhooks.d.ts +15 -15
  60. package/dist/effect/webhooks.js +2 -2
  61. package/dist/index.js +4 -3
  62. package/dist/inline-attachments-BrNnSMF2.js +121 -0
  63. package/dist/inline-attachments.d.ts +65 -0
  64. package/dist/{mailbox-events-CsbF35vH.js → mailbox-events-VKR4f3qq.js} +6 -4
  65. package/dist/mailbox-events.d.ts +1 -1
  66. package/dist/{mailboxes-BtcktcNB.js → mailboxes-DT02zP7q.js} +13 -5
  67. package/dist/{operation-BEghYyLu.js → operation-g8nAzmIM.js} +63 -3
  68. package/dist/promises/errors.gen.d.ts +38 -2
  69. package/dist/promises/index.d.ts +7 -4
  70. package/dist/promises/index.js +4 -3
  71. package/dist/promises/types.gen.d.ts +1 -1
  72. package/dist/{promises-BzrwhHEW.js → promises-BFRKhpSS.js} +1070 -49
  73. package/dist/service-map.d.ts +40 -0
  74. package/package.json +7 -2
  75. package/dist/client-attribution-BTWYSXxo.js +0 -9
@@ -1,5 +1,5 @@
1
- import { n as clientAttribution, t as CLIENT_ATTRIBUTION_HEADER } from "./client-attribution-BTWYSXxo.js";
2
- import { t as MailboxEventStream } from "./mailbox-events-CsbF35vH.js";
1
+ import { a as withUploadedAttachments, n as mediaCreateBody, o as CLIENT_ATTRIBUTION_HEADER, r as planInlineUploads, s as clientAttribution, t as MediaUploadError } from "./inline-attachments-BrNnSMF2.js";
2
+ import { t as MailboxEventStream } from "./mailbox-events-VKR4f3qq.js";
3
3
  import { n as buildMessagesSendPayload, r as replyToEmailsPayload, t as buildEmailSendPayload } from "./normalize-B79uJIeb.js";
4
4
  //#region src/client/core/bodySerializer.gen.ts
5
5
  const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) };
@@ -3376,7 +3376,7 @@ var Media = class {
3376
3376
  /**
3377
3377
  * Create a media object
3378
3378
  *
3379
- * 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.
3379
+ * 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. Requires `messages:create`, or `email:send` for `attachment` media.
3380
3380
  */
3381
3381
  static create(parameters, options) {
3382
3382
  const params = buildClientParams([parameters], [{ args: [
@@ -3419,7 +3419,7 @@ var Media = class {
3419
3419
  /**
3420
3420
  * Complete a media upload
3421
3421
  *
3422
- * Verifies the uploaded object exists in storage, marks the media object ready, and returns it with a download URL.
3422
+ * Verifies the uploaded object exists in storage, marks the media object ready, and returns it with a download URL. Requires the permission that creating the media object did.
3423
3423
  */
3424
3424
  static complete(parameters, options) {
3425
3425
  const params = buildClientParams([parameters], [{ args: [{
@@ -4098,7 +4098,7 @@ var Contacts = class {
4098
4098
  /**
4099
4099
  * List contacts
4100
4100
  *
4101
- * Returns contact summaries for the organization, newest first, filterable by search term, status, and creation time (`after`, `before`). Pass `nextCursor` back as `cursor` for the next page; it is null on the last page. Read a contact's identities, profile, and metadata with `GET /v1/contacts/{id}`.
4101
+ * Returns contact summaries for the organization, newest first, filterable by search term, status, and creation time (`after`, `before`). `fields` is a comma-separated list of defined custom field keys to return in each summary's `customFields`; omitted keys and unselected fields are not returned. Filter by one defined custom field with `customField` and a JSON-encoded scalar `customFieldValue` (for example, `"creator"`, `42`, or `true`). Both filter parameters are required together, and unknown keys or values of the wrong type are rejected. Pass `nextCursor` back as `cursor` for the next page; it is null on the last page. Read full identities, profile, and metadata with `GET /v1/contacts/{id}`.
4102
4102
  */
4103
4103
  static list(parameters, options) {
4104
4104
  const params = buildClientParams([parameters], [{ args: [
@@ -4118,6 +4118,18 @@ var Contacts = class {
4118
4118
  in: "query",
4119
4119
  key: "status"
4120
4120
  },
4121
+ {
4122
+ in: "query",
4123
+ key: "fields"
4124
+ },
4125
+ {
4126
+ in: "query",
4127
+ key: "customField"
4128
+ },
4129
+ {
4130
+ in: "query",
4131
+ key: "customFieldValue"
4132
+ },
4121
4133
  {
4122
4134
  in: "query",
4123
4135
  key: "after"
@@ -4242,31 +4254,16 @@ var Contacts = class {
4242
4254
  /**
4243
4255
  * Find or create a contact
4244
4256
  *
4245
- * Returns an existing contact matching the given identifiers, or creates a new one when none exists.
4257
+ * Looks up exactly one identifier through `lookup: { type, value }`. Returns `{ contact, created: false }` unchanged when it exists. Otherwise creates the lookup identity (or external ID), applies `create` attributes, and returns `{ contact, created: true }`. Additional addresses belong in `create.identities`, custom fields in `create.profile.customFields`; custom field keys must be defined and values must match their types. An external ID lookup cannot be contradicted by `create.externalId`. Creation returns HTTP 409 ConflictError if an externalId or address belongs to another contact; the conflicting field is named and no contact is created. Use the update endpoint to change an existing contact.
4246
4258
  */
4247
4259
  static findOrCreate(parameters, options) {
4248
- const params = buildClientParams([parameters], [{ args: [
4249
- {
4250
- in: "body",
4251
- key: "email"
4252
- },
4253
- {
4254
- in: "body",
4255
- key: "phone"
4256
- },
4257
- {
4258
- in: "body",
4259
- key: "externalId"
4260
- },
4261
- {
4262
- in: "body",
4263
- key: "name"
4264
- },
4265
- {
4266
- in: "body",
4267
- key: "displayName"
4268
- }
4269
- ] }]);
4260
+ const params = buildClientParams([parameters], [{ args: [{
4261
+ in: "body",
4262
+ key: "lookup"
4263
+ }, {
4264
+ in: "body",
4265
+ key: "create"
4266
+ }] }]);
4270
4267
  return (options?.client ?? client).post({
4271
4268
  security: [{
4272
4269
  name: "x-api-key",
@@ -4526,7 +4523,7 @@ var Contacts = class {
4526
4523
  /**
4527
4524
  * Bulk import contacts
4528
4525
  *
4529
- * Creates or updates contacts in bulk from a list, returning per-entry results with created, updated, skipped, and error counts.
4526
+ * Creates contacts in bulk from a list of entries shaped like a create request, returning per-entry results with created, updated, skipped, and error counts. An entry whose identities match an existing contact is skipped, or updates it with `onConflict: "update"`.
4530
4527
  */
4531
4528
  static bulkImport(parameters, options) {
4532
4529
  const params = buildClientParams([parameters], [{ args: [{
@@ -4534,7 +4531,7 @@ var Contacts = class {
4534
4531
  key: "contacts"
4535
4532
  }, {
4536
4533
  in: "body",
4537
- key: "upsertByEmail"
4534
+ key: "onConflict"
4538
4535
  }] }]);
4539
4536
  return (options?.client ?? client).post({
4540
4537
  security: [{
@@ -4743,6 +4740,59 @@ var Contacts = class {
4743
4740
  });
4744
4741
  }
4745
4742
  };
4743
+ var Subscriptions = class {
4744
+ /**
4745
+ * Request subscription confirmation
4746
+ *
4747
+ * Sends a confirmation email from your sender. Only the recipient's explicit confirmation adds them to the active static contact group and clears the optional unsubscribe group. The link expires after seven days and can be used once. A custom published email template receives confirmUrl. Sending follows ordinary sender, admission, billing, and brand-footer settings. Requires email send authority in addition to the declared contact grants, including the optional unsubscribe preference change.
4748
+ */
4749
+ static subscribe(parameters, options) {
4750
+ const params = buildClientParams([parameters], [{ args: [
4751
+ {
4752
+ in: "body",
4753
+ key: "email"
4754
+ },
4755
+ {
4756
+ in: "body",
4757
+ key: "contactGroupId"
4758
+ },
4759
+ {
4760
+ in: "body",
4761
+ key: "from"
4762
+ },
4763
+ {
4764
+ in: "body",
4765
+ key: "unsubscribeGroupId"
4766
+ },
4767
+ {
4768
+ in: "body",
4769
+ key: "templateSlug"
4770
+ },
4771
+ {
4772
+ in: "body",
4773
+ key: "consentIp"
4774
+ },
4775
+ {
4776
+ in: "body",
4777
+ key: "consentSource"
4778
+ }
4779
+ ] }]);
4780
+ return (options?.client ?? client).post({
4781
+ security: [{
4782
+ name: "x-api-key",
4783
+ type: "apiKey"
4784
+ }],
4785
+ url: "/v1/subscriptions",
4786
+ ...options,
4787
+ ...params,
4788
+ headers: {
4789
+ "Content-Type": "application/json",
4790
+ ...options?.headers,
4791
+ ...params.headers
4792
+ }
4793
+ });
4794
+ }
4795
+ };
4746
4796
  var ContactGroups = class {
4747
4797
  /**
4748
4798
  * List contact groups
@@ -6454,6 +6504,49 @@ var Templates = class {
6454
6504
  });
6455
6505
  }
6456
6506
  /**
6507
+ * Render a template publication
6508
+ *
6509
+ * Renders one immutable publication against the `data` you pass, formatted in the `locale` and `timeZone` you name as a send formats them, and returns the subject, preheader, HTML and plain text a send would produce. `data` is validated against the publication's input schema exactly as a send validates it; invalid input returns a validation error that names each failing field. Nothing is sent or stored. Unpublished workspace edits are never rendered: only a publication id renders.
6510
+ */
6511
+ static renderPublication(parameters, options) {
6512
+ const params = buildClientParams([parameters], [{ args: [
6513
+ {
6514
+ in: "path",
6515
+ key: "id"
6516
+ },
6517
+ {
6518
+ in: "path",
6519
+ key: "publicationId"
6520
+ },
6521
+ {
6522
+ in: "body",
6523
+ key: "data"
6524
+ },
6525
+ {
6526
+ in: "body",
6527
+ key: "locale"
6528
+ },
6529
+ {
6530
+ in: "body",
6531
+ key: "timeZone"
6532
+ }
6533
+ ] }]);
6534
+ return (options?.client ?? client).post({
6535
+ security: [{
6536
+ name: "x-api-key",
6537
+ type: "apiKey"
6538
+ }],
6539
+ url: "/v1/templates/{id}/publications/{publicationId}/render",
6540
+ ...options,
6541
+ ...params,
6542
+ headers: {
6543
+ "Content-Type": "application/json",
6544
+ ...options?.headers,
6545
+ ...params.headers
6546
+ }
6547
+ });
6548
+ }
6549
+ /**
6457
6550
  * List a template's input contracts
6458
6551
  *
6459
6552
  * Returns the immutable input contracts this template has published under, newest version first. Pass `nextCursor` back as `cursor` for the next page; it is null on the last page. Send against a contract to follow later publications that validate input identically.
@@ -6842,7 +6935,7 @@ var Webhooks = class {
6842
6935
  /**
6843
6936
  * Create a webhook
6844
6937
  *
6845
- * Creates a signed webhook endpoint for Samva delivery and inbound events, stores subscriptions, and returns the endpoint and signing secret with a 201 response.
6938
+ * Creates a signed webhook endpoint for Samva delivery and inbound events, stores subscriptions, and returns the endpoint and signing secret with a 201 response. `mailboxIds` and `namespaceId` confine mailbox events; when both are set, every mailbox must belong to the namespace.
6846
6939
  */
6847
6940
  static create(parameters, options) {
6848
6941
  const params = buildClientParams([parameters], [{ args: [
@@ -6937,7 +7030,7 @@ var Webhooks = class {
6937
7030
  /**
6938
7031
  * Update a webhook
6939
7032
  *
6940
- * Updates a webhook's name, URL, subscribed events, channels, custom headers, or status and returns the updated endpoint.
7033
+ * Updates a webhook's name, URL, subscribed events, channels, custom headers, mailbox scope, or status and returns the updated endpoint. A change to `mailboxIds` or `namespaceId` is checked as the endpoint will stand afterward: every mailbox must belong to the namespace when both are set.
6941
7034
  */
6942
7035
  static update(parameters, options) {
6943
7036
  const params = buildClientParams([parameters], [{ args: [
@@ -7237,6 +7330,21 @@ var Organizations = class {
7237
7330
  });
7238
7331
  }
7239
7332
  /**
7333
+ * Get organization trust tier and sending limits
7334
+ *
7335
+ * Returns the current trust tier, plan and probation sending limits, and measured probation graduation progress. Limits are additional to billing allowance, domain readiness, and enforcement. Graduation is evaluated on delivery events.
7336
+ */
7337
+ static getTrustTier(options) {
7338
+ return (options?.client ?? client).get({
7339
+ security: [{
7340
+ name: "x-api-key",
7341
+ type: "apiKey"
7342
+ }],
7343
+ url: "/v1/organizations/trust-tier",
7344
+ ...options
7345
+ });
7346
+ }
7347
+ /**
7240
7348
  * Get organization usage
7241
7349
  *
7242
7350
  * Returns usage statistics for the current organization between `after` and `before`, which default to the current calendar month so far. `usage.periodStart` and `usage.periodEnd` echo the window counted.
@@ -8649,7 +8757,7 @@ var Mailboxes = class {
8649
8757
  /**
8650
8758
  * Send a new message
8651
8759
  *
8652
- * Starts a new conversation from the mailbox's default From address. `status` is `sent`, or `pending_approval` when the caller's grant or a mailbox policy holds sends for a person's approval; a policy that denies sends refuses it with 403.
8760
+ * Records a send action and returns 202 with its current receipt and a Location for action status. An installation, grant, or policy may require approval; otherwise the send is queued. Observe the same action through acceptance and mailbox completion. A policy refusal returns 403 with the recorded receipt.
8653
8761
  */
8654
8762
  static sendMessage(parameters, options) {
8655
8763
  const params = buildClientParams([parameters], [{ args: [
@@ -8786,6 +8894,36 @@ var Mailboxes = class {
8786
8894
  });
8787
8895
  }
8788
8896
  /**
8897
+ * Copy a message attachment
8898
+ *
8899
+ * Copies one of a received message's attachments into the organization's media and returns it as a draft attachment (`mediaId`), so a draft can carry it. A draft that forwards a message saves each original attachment this way.
8900
+ */
8901
+ static copyMessageAttachment(parameters, options) {
8902
+ const params = buildClientParams([parameters], [{ args: [
8903
+ {
8904
+ in: "path",
8905
+ key: "id"
8906
+ },
8907
+ {
8908
+ in: "path",
8909
+ key: "messageId"
8910
+ },
8911
+ {
8912
+ in: "path",
8913
+ key: "attachmentId"
8914
+ }
8915
+ ] }]);
8916
+ return (options?.client ?? client).post({
8917
+ security: [{
8918
+ name: "x-api-key",
8919
+ type: "apiKey"
8920
+ }],
8921
+ url: "/v1/mailboxes/{id}/messages/{messageId}/attachments/{attachmentId}/copy",
8922
+ ...options,
8923
+ ...params
8924
+ });
8925
+ }
8926
+ /**
8789
8927
  * Reply to a message
8790
8928
  *
8791
8929
  * Replies to the message's Reply-To address, or its sender, in the same thread. The server sets the recipients, subject, and threading headers.
@@ -9277,7 +9415,7 @@ var Mailboxes = class {
9277
9415
  /**
9278
9416
  * List mailbox actions
9279
9417
  *
9280
- * Returns the actions proposed on a mailbox, newest first, filterable by `state` (`approvalRequired` lists the sends waiting for a person) and creation time (`after`, `before`). Pass `nextCursor` back as `cursor` for the next page; it is null on the last page.
9418
+ * Returns the actions proposed on a mailbox, newest first, filterable by `threadId`, `state` (`approvalRequired` lists the sends waiting for a person), and creation time (`after`, `before`). Filters apply together within the mailbox. Pass `nextCursor` back as `cursor` for the next page; it is null on the last page.
9281
9419
  */
9282
9420
  static listActions(parameters, options) {
9283
9421
  const params = buildClientParams([parameters], [{ args: [
@@ -9293,6 +9431,10 @@ var Mailboxes = class {
9293
9431
  in: "query",
9294
9432
  key: "cursor"
9295
9433
  },
9434
+ {
9435
+ in: "query",
9436
+ key: "threadId"
9437
+ },
9296
9438
  {
9297
9439
  in: "query",
9298
9440
  key: "state"
@@ -9317,9 +9459,78 @@ var Mailboxes = class {
9317
9459
  });
9318
9460
  }
9319
9461
  /**
9462
+ * Get a mailbox action
9463
+ *
9464
+ * Returns one action with its current progress. Send actions expose their immutable approved content, deadline, problem, and accepted receipt. A caller with mailbox read access may inspect actions; send-only callers may inspect only their own proposals. Acceptance and mailbox completion do not mean recipient delivery.
9465
+ */
9466
+ static getAction(parameters, options) {
9467
+ const params = buildClientParams([parameters], [{ args: [{
9468
+ in: "path",
9469
+ key: "id"
9470
+ }, {
9471
+ in: "path",
9472
+ key: "actionId"
9473
+ }] }]);
9474
+ return (options?.client ?? client).get({
9475
+ security: [{
9476
+ name: "x-api-key",
9477
+ type: "apiKey"
9478
+ }],
9479
+ url: "/v1/mailboxes/{id}/actions/{actionId}",
9480
+ ...options,
9481
+ ...params
9482
+ });
9483
+ }
9484
+ /**
9485
+ * Cancel a mailbox send
9486
+ *
9487
+ * Cancels a definitely unsent action and reopens its draft atomically. Only an authorized person who proposed the send or can approve actions may cancel. Accepted sends return 409 with their winning receipt and cannot be withdrawn. An uncertain send requires reconciliation and cannot be cancelled as unsent.
9488
+ */
9489
+ static cancelAction(parameters, options) {
9490
+ const params = buildClientParams([parameters], [{ args: [{
9491
+ in: "path",
9492
+ key: "id"
9493
+ }, {
9494
+ in: "path",
9495
+ key: "actionId"
9496
+ }] }]);
9497
+ return (options?.client ?? client).post({
9498
+ security: [{
9499
+ name: "x-api-key",
9500
+ type: "apiKey"
9501
+ }],
9502
+ url: "/v1/mailboxes/{id}/actions/{actionId}/cancel",
9503
+ ...options,
9504
+ ...params
9505
+ });
9506
+ }
9507
+ /**
9508
+ * Resume a mailbox send
9509
+ *
9510
+ * Resumes the same action only after its previous execution is confirmed ended and safe continuation is possible. Only an authorized person who proposed the send or can approve actions may retry. Automatic waits need no manual Retry. This does not grant new approval, reset the original deadline, replace the message identity, or resubmit an accepted or uncertain send.
9511
+ */
9512
+ static retryAction(parameters, options) {
9513
+ const params = buildClientParams([parameters], [{ args: [{
9514
+ in: "path",
9515
+ key: "id"
9516
+ }, {
9517
+ in: "path",
9518
+ key: "actionId"
9519
+ }] }]);
9520
+ return (options?.client ?? client).post({
9521
+ security: [{
9522
+ name: "x-api-key",
9523
+ type: "apiKey"
9524
+ }],
9525
+ url: "/v1/mailboxes/{id}/actions/{actionId}/retry",
9526
+ ...options,
9527
+ ...params
9528
+ });
9529
+ }
9530
+ /**
9320
9531
  * Approve a mailbox action
9321
9532
  *
9322
- * Approves an action waiting for approval, executes it, and returns the executed action. Only a person signed in or through OAuth may approve, and never the one who proposed it.
9533
+ * Records approval of a send and returns 202 while it is pending. A send is queued for automatic retry within 15 minutes of approval; repeating approval does not extend this deadline. Accepted, completed, and notSent replays return 200. No expiry applies before approval. Only a person signed in or through OAuth may approve, and never the proposer. Non-send approvals execute synchronously and return 200 with their own execution states.
9323
9534
  */
9324
9535
  static approveAction(parameters, options) {
9325
9536
  const params = buildClientParams([parameters], [{ args: [{
@@ -9377,7 +9588,7 @@ var Mailboxes = class {
9377
9588
  /**
9378
9589
  * List mailbox events
9379
9590
  *
9380
- * Returns what happened on a mailbox, newest first, filterable by when it happened (`after`, `before`). Pass `nextCursor` back as `cursor` for the next page; it is null on the last page.
9591
+ * Returns mailbox audit records, newest first, filterable by when they happened (`after`, `before`). Audit event types: `mailbox.created`, `address.attached`, `email.received`, `email.released`, `email.sent`, `thread.created`, `action.proposed`, `action.policy_decided`, `action.approval_requested`, `action.approval_resolved`, `action.accepted`, `action.executed`, `action.failed`. Thread and draft changes have no dedicated audit event types. Pass `nextCursor` back as `cursor` for the next page; it is null on the last page.
9381
9592
  */
9382
9593
  static listEvents(parameters, options) {
9383
9594
  const params = buildClientParams([parameters], [{ args: [
@@ -9479,7 +9690,7 @@ var Namespaces = class {
9479
9690
  /**
9480
9691
  * Delete a namespace
9481
9692
  *
9482
- * Deletes an empty namespace. A namespace that still holds mailboxes or API keys conflicts: remove or move them first.
9693
+ * Deletes an empty namespace. A namespace that still holds mailboxes, API keys, or webhook endpoints conflicts: remove them first.
9483
9694
  */
9484
9695
  static remove(parameters, options) {
9485
9696
  const params = buildClientParams([parameters], [{ args: [{
@@ -9816,6 +10027,45 @@ var ExtensionInstallations = class {
9816
10027
  });
9817
10028
  }
9818
10029
  /**
10030
+ * Upgrade or roll back an installation
10031
+ *
10032
+ * Changes the pinned version in place. Omit version for the latest publication, or name a version string or id, including an older version to roll back. Preview with dryRun; changing requires acceptPermissions to list exactly the added permission: and event: grants. Only a person can upgrade. Credentials, owner, scope, send mode, and status stay attached to the installation.
10033
+ */
10034
+ static upgrade(parameters, options) {
10035
+ const params = buildClientParams([parameters], [{ args: [
10036
+ {
10037
+ in: "path",
10038
+ key: "id"
10039
+ },
10040
+ {
10041
+ in: "body",
10042
+ key: "version"
10043
+ },
10044
+ {
10045
+ in: "body",
10046
+ key: "acceptPermissions"
10047
+ },
10048
+ {
10049
+ in: "body",
10050
+ key: "dryRun"
10051
+ }
10052
+ ] }]);
10053
+ return (options?.client ?? client).post({
10054
+ security: [{
10055
+ name: "x-api-key",
10056
+ type: "apiKey"
10057
+ }],
10058
+ url: "/v1/extension-installations/{id}/upgrade",
10059
+ ...options,
10060
+ ...params,
10061
+ headers: {
10062
+ "Content-Type": "application/json",
10063
+ ...options?.headers,
10064
+ ...params.headers
10065
+ }
10066
+ });
10067
+ }
10068
+ /**
9819
10069
  * Disable an installation
9820
10070
  *
9821
10071
  * Stops the installation at once: its events stop, and its credential is refused on every surface until it is enabled again.
@@ -10019,6 +10269,20 @@ var InternalError = class extends SamvaApiError {
10019
10269
  Object.assign(this, payload);
10020
10270
  }
10021
10271
  };
10272
+ var MailboxSendConflictError = class extends SamvaApiError {
10273
+ _tag = "MailboxSendConflictError";
10274
+ constructor(payload, context = {}) {
10275
+ super(messageOf("MailboxSendConflictError", payload), context);
10276
+ Object.assign(this, payload);
10277
+ }
10278
+ };
10279
+ var MailboxSendRefusedError = class extends SamvaApiError {
10280
+ _tag = "MailboxSendRefusedError";
10281
+ constructor(payload, context = {}) {
10282
+ super(messageOf("MailboxSendRefusedError", payload), context);
10283
+ Object.assign(this, payload);
10284
+ }
10285
+ };
10022
10286
  var OnboardingReviewRequiredError = class extends SamvaApiError {
10023
10287
  _tag = "OnboardingReviewRequiredError";
10024
10288
  constructor(payload, context = {}) {
@@ -10047,6 +10311,13 @@ var ResourceNotFoundError = class extends SamvaApiError {
10047
10311
  Object.assign(this, payload);
10048
10312
  }
10049
10313
  };
10314
+ var SenderNotReadyError = class extends SamvaApiError {
10315
+ _tag = "SenderNotReadyError";
10316
+ constructor(payload, context = {}) {
10317
+ super(messageOf("SenderNotReadyError", payload), context);
10318
+ Object.assign(this, payload);
10319
+ }
10320
+ };
10050
10321
  var UnauthorizedError = class extends SamvaApiError {
10051
10322
  _tag = "UnauthorizedError";
10052
10323
  constructor(payload, context = {}) {
@@ -10074,10 +10345,13 @@ const constructors = {
10074
10345
  ForbiddenError,
10075
10346
  GatewayTimeoutError,
10076
10347
  InternalError,
10348
+ MailboxSendConflictError,
10349
+ MailboxSendRefusedError,
10077
10350
  OnboardingReviewRequiredError,
10078
10351
  PaymentRequiredError,
10079
10352
  RateLimitedError,
10080
10353
  ResourceNotFoundError,
10354
+ SenderNotReadyError,
10081
10355
  UnauthorizedError,
10082
10356
  ValidationError
10083
10357
  };
@@ -10281,6 +10555,680 @@ const payloadSchemas = {
10281
10555
  "x-category": ["transient"],
10282
10556
  "x-retryable": true
10283
10557
  },
10558
+ MailboxSendConflictError: {
10559
+ type: "object",
10560
+ properties: {
10561
+ _tag: {
10562
+ type: "string",
10563
+ enum: ["MailboxSendConflictError"]
10564
+ },
10565
+ message: { type: "string" },
10566
+ resource: { type: "string" },
10567
+ id: {
10568
+ type: "string",
10569
+ pattern: "^mbxact_[0-9a-hjkmnp-tv-z]{16,24}$",
10570
+ "x-samva-brand": "MailboxActionId"
10571
+ },
10572
+ receipt: {
10573
+ type: "object",
10574
+ properties: {
10575
+ actionId: {
10576
+ type: "string",
10577
+ pattern: "^mbxact_[0-9a-hjkmnp-tv-z]{16,24}$",
10578
+ "x-samva-brand": "MailboxActionId"
10579
+ },
10580
+ draftId: { anyOf: [{
10581
+ type: "string",
10582
+ pattern: "^mdraft_[0-9a-hjkmnp-tv-z]{16,24}$",
10583
+ "x-samva-brand": "MailboxDraftId"
10584
+ }, { type: "null" }] },
10585
+ messageId: { anyOf: [{
10586
+ type: "string",
10587
+ pattern: "^msg_[0-9a-hjkmnp-tv-z]{16,24}$",
10588
+ "x-samva-brand": "MessageId"
10589
+ }, { type: "null" }] },
10590
+ threadId: { anyOf: [{
10591
+ type: "string",
10592
+ pattern: "^thread_[0-9a-hjkmnp-tv-z]{16,24}$",
10593
+ "x-samva-brand": "MailboxThreadId"
10594
+ }, { type: "null" }] },
10595
+ state: {
10596
+ type: "string",
10597
+ enum: [
10598
+ "approvalRequired",
10599
+ "queued",
10600
+ "accepted",
10601
+ "completed",
10602
+ "notSent",
10603
+ "uncertain"
10604
+ ]
10605
+ },
10606
+ acceptedAt: { anyOf: [{ type: "string" }, { type: "null" }] },
10607
+ waitReason: { anyOf: [{
10608
+ type: "string",
10609
+ enum: [
10610
+ "rate",
10611
+ "daily-quota",
10612
+ "domain-health",
10613
+ "sending-paused",
10614
+ "upstream-unavailable",
10615
+ "retry",
10616
+ "campaign-paused",
10617
+ "domain-warming",
10618
+ "onboarding-review",
10619
+ "content-review",
10620
+ "screening-unavailable"
10621
+ ]
10622
+ }, { type: "null" }] },
10623
+ reviewExpectedAt: { anyOf: [{ type: "string" }, { type: "null" }] },
10624
+ skippedRecipients: {
10625
+ type: "array",
10626
+ items: {
10627
+ type: "object",
10628
+ properties: {
10629
+ address: { type: "string" },
10630
+ reason: {
10631
+ type: "string",
10632
+ enum: [
10633
+ "bounce",
10634
+ "complaint",
10635
+ "unsubscribe",
10636
+ "manual",
10637
+ "group-unsubscribe"
10638
+ ]
10639
+ },
10640
+ unsubscribeGroupId: { anyOf: [{
10641
+ type: "string",
10642
+ pattern: "^unsub_[0-9a-hjkmnp-tv-z]{16,24}$",
10643
+ "x-samva-brand": "UnsubscribeId"
10644
+ }, { type: "null" }] }
10645
+ },
10646
+ required: ["address", "reason"],
10647
+ additionalProperties: false
10648
+ }
10649
+ },
10650
+ executeUntil: { anyOf: [{ type: "string" }, { type: "null" }] },
10651
+ retryAt: { anyOf: [{ type: "string" }, { type: "null" }] },
10652
+ problem: { anyOf: [{
10653
+ type: "object",
10654
+ properties: {
10655
+ code: { type: "string" },
10656
+ message: { type: "string" },
10657
+ error: { anyOf: [{ anyOf: [
10658
+ {
10659
+ type: "object",
10660
+ properties: {
10661
+ _tag: {
10662
+ type: "string",
10663
+ enum: ["SenderNotReadyError"]
10664
+ },
10665
+ message: { type: "string" },
10666
+ sender: { type: "string" },
10667
+ retryAfterSeconds: { anyOf: [{ type: "number" }, { type: "null" }] }
10668
+ },
10669
+ required: [
10670
+ "_tag",
10671
+ "message",
10672
+ "sender"
10673
+ ],
10674
+ additionalProperties: false
10675
+ },
10676
+ {
10677
+ type: "object",
10678
+ properties: {
10679
+ _tag: {
10680
+ type: "string",
10681
+ enum: ["RateLimitedError"]
10682
+ },
10683
+ message: { type: "string" },
10684
+ retryAfterSeconds: { type: "number" }
10685
+ },
10686
+ required: [
10687
+ "_tag",
10688
+ "message",
10689
+ "retryAfterSeconds"
10690
+ ],
10691
+ additionalProperties: false
10692
+ },
10693
+ {
10694
+ type: "object",
10695
+ properties: {
10696
+ _tag: {
10697
+ type: "string",
10698
+ enum: ["OnboardingReviewRequiredError"]
10699
+ },
10700
+ message: { type: "string" },
10701
+ code: {
10702
+ type: "string",
10703
+ enum: [
10704
+ "review_required",
10705
+ "review_in_progress",
10706
+ "information_required",
10707
+ "review_rejected",
10708
+ "identity_review_required",
10709
+ "identity_review_rejected",
10710
+ "identity_changed"
10711
+ ]
10712
+ },
10713
+ decision: {
10714
+ type: "string",
10715
+ enum: [
10716
+ "undecided",
10717
+ "approved",
10718
+ "rejected"
10719
+ ]
10720
+ },
10721
+ stage: {
10722
+ type: "string",
10723
+ enum: [
10724
+ "collecting",
10725
+ "automated_review",
10726
+ "manual_review",
10727
+ "information_requested",
10728
+ "complete"
10729
+ ]
10730
+ },
10731
+ nextAction: {
10732
+ type: "string",
10733
+ enum: [
10734
+ "wait_for_review",
10735
+ "provide_information",
10736
+ "verify_sending_identity",
10737
+ "reapply",
10738
+ "contact_support"
10739
+ ]
10740
+ },
10741
+ identityId: { anyOf: [{ type: "string" }, { type: "null" }] }
10742
+ },
10743
+ required: [
10744
+ "_tag",
10745
+ "message",
10746
+ "code",
10747
+ "decision",
10748
+ "stage",
10749
+ "nextAction"
10750
+ ],
10751
+ additionalProperties: false
10752
+ },
10753
+ {
10754
+ type: "object",
10755
+ properties: {
10756
+ _tag: {
10757
+ type: "string",
10758
+ enum: ["PaymentRequiredError"]
10759
+ },
10760
+ message: { type: "string" },
10761
+ resource: { type: "string" },
10762
+ currentUsage: { type: "number" },
10763
+ limit: { type: "number" }
10764
+ },
10765
+ required: [
10766
+ "_tag",
10767
+ "message",
10768
+ "resource",
10769
+ "currentUsage",
10770
+ "limit"
10771
+ ],
10772
+ additionalProperties: false
10773
+ },
10774
+ {
10775
+ type: "object",
10776
+ properties: {
10777
+ _tag: {
10778
+ type: "string",
10779
+ enum: ["ValidationError"]
10780
+ },
10781
+ message: { type: "string" },
10782
+ fields: { anyOf: [{
10783
+ type: "object",
10784
+ additionalProperties: {
10785
+ type: "array",
10786
+ items: { type: "string" }
10787
+ }
10788
+ }, { type: "null" }] }
10789
+ },
10790
+ required: ["_tag", "message"],
10791
+ additionalProperties: false
10792
+ },
10793
+ {
10794
+ type: "object",
10795
+ properties: {
10796
+ _tag: {
10797
+ type: "string",
10798
+ enum: ["ForbiddenError"]
10799
+ },
10800
+ message: { type: "string" }
10801
+ },
10802
+ required: ["_tag", "message"],
10803
+ additionalProperties: false
10804
+ },
10805
+ {
10806
+ type: "object",
10807
+ properties: {
10808
+ _tag: {
10809
+ type: "string",
10810
+ enum: ["ResourceNotFoundError"]
10811
+ },
10812
+ resource: { type: "string" },
10813
+ id: { type: "string" },
10814
+ message: { type: "string" }
10815
+ },
10816
+ required: [
10817
+ "_tag",
10818
+ "resource",
10819
+ "id",
10820
+ "message"
10821
+ ],
10822
+ additionalProperties: false
10823
+ }
10824
+ ] }, { type: "null" }] }
10825
+ },
10826
+ required: ["code", "message"],
10827
+ additionalProperties: false
10828
+ }, { type: "null" }] },
10829
+ retryEligible: { type: "boolean" },
10830
+ decision: { anyOf: [{
10831
+ type: "object",
10832
+ properties: {
10833
+ outcome: {
10834
+ type: "string",
10835
+ enum: [
10836
+ "allow",
10837
+ "requireApproval",
10838
+ "deny"
10839
+ ]
10840
+ },
10841
+ reason: { anyOf: [{ type: "string" }, { type: "null" }] },
10842
+ policyId: { anyOf: [{
10843
+ type: "string",
10844
+ pattern: "^mbxpol_[0-9a-hjkmnp-tv-z]{16,24}$",
10845
+ "x-samva-brand": "MailboxPolicyId"
10846
+ }, { type: "null" }] },
10847
+ source: { anyOf: [{
10848
+ type: "string",
10849
+ enum: [
10850
+ "grant",
10851
+ "installation",
10852
+ "policy"
10853
+ ]
10854
+ }, { type: "null" }] },
10855
+ decidedAt: { type: "string" }
10856
+ },
10857
+ required: [
10858
+ "outcome",
10859
+ "reason",
10860
+ "policyId",
10861
+ "source",
10862
+ "decidedAt"
10863
+ ],
10864
+ additionalProperties: false
10865
+ }, { type: "null" }] },
10866
+ createdAt: { type: "string" },
10867
+ updatedAt: { type: "string" }
10868
+ },
10869
+ required: [
10870
+ "actionId",
10871
+ "draftId",
10872
+ "messageId",
10873
+ "threadId",
10874
+ "state",
10875
+ "acceptedAt",
10876
+ "waitReason",
10877
+ "reviewExpectedAt",
10878
+ "skippedRecipients",
10879
+ "executeUntil",
10880
+ "retryAt",
10881
+ "problem",
10882
+ "retryEligible",
10883
+ "decision",
10884
+ "createdAt",
10885
+ "updatedAt"
10886
+ ],
10887
+ additionalProperties: false
10888
+ }
10889
+ },
10890
+ required: [
10891
+ "_tag",
10892
+ "message",
10893
+ "resource",
10894
+ "id",
10895
+ "receipt"
10896
+ ],
10897
+ additionalProperties: false
10898
+ },
10899
+ MailboxSendRefusedError: {
10900
+ type: "object",
10901
+ properties: {
10902
+ _tag: {
10903
+ type: "string",
10904
+ enum: ["MailboxSendRefusedError"]
10905
+ },
10906
+ message: { type: "string" },
10907
+ receipt: {
10908
+ type: "object",
10909
+ properties: {
10910
+ actionId: {
10911
+ type: "string",
10912
+ pattern: "^mbxact_[0-9a-hjkmnp-tv-z]{16,24}$",
10913
+ "x-samva-brand": "MailboxActionId"
10914
+ },
10915
+ draftId: { anyOf: [{
10916
+ type: "string",
10917
+ pattern: "^mdraft_[0-9a-hjkmnp-tv-z]{16,24}$",
10918
+ "x-samva-brand": "MailboxDraftId"
10919
+ }, { type: "null" }] },
10920
+ messageId: { anyOf: [{
10921
+ type: "string",
10922
+ pattern: "^msg_[0-9a-hjkmnp-tv-z]{16,24}$",
10923
+ "x-samva-brand": "MessageId"
10924
+ }, { type: "null" }] },
10925
+ threadId: { anyOf: [{
10926
+ type: "string",
10927
+ pattern: "^thread_[0-9a-hjkmnp-tv-z]{16,24}$",
10928
+ "x-samva-brand": "MailboxThreadId"
10929
+ }, { type: "null" }] },
10930
+ state: {
10931
+ type: "string",
10932
+ enum: [
10933
+ "approvalRequired",
10934
+ "queued",
10935
+ "accepted",
10936
+ "completed",
10937
+ "notSent",
10938
+ "uncertain"
10939
+ ]
10940
+ },
10941
+ acceptedAt: { anyOf: [{ type: "string" }, { type: "null" }] },
10942
+ waitReason: { anyOf: [{
10943
+ type: "string",
10944
+ enum: [
10945
+ "rate",
10946
+ "daily-quota",
10947
+ "domain-health",
10948
+ "sending-paused",
10949
+ "upstream-unavailable",
10950
+ "retry",
10951
+ "campaign-paused",
10952
+ "domain-warming",
10953
+ "onboarding-review",
10954
+ "content-review",
10955
+ "screening-unavailable"
10956
+ ]
10957
+ }, { type: "null" }] },
10958
+ reviewExpectedAt: { anyOf: [{ type: "string" }, { type: "null" }] },
10959
+ skippedRecipients: {
10960
+ type: "array",
10961
+ items: {
10962
+ type: "object",
10963
+ properties: {
10964
+ address: { type: "string" },
10965
+ reason: {
10966
+ type: "string",
10967
+ enum: [
10968
+ "bounce",
10969
+ "complaint",
10970
+ "unsubscribe",
10971
+ "manual",
10972
+ "group-unsubscribe"
10973
+ ]
10974
+ },
10975
+ unsubscribeGroupId: { anyOf: [{
10976
+ type: "string",
10977
+ pattern: "^unsub_[0-9a-hjkmnp-tv-z]{16,24}$",
10978
+ "x-samva-brand": "UnsubscribeId"
10979
+ }, { type: "null" }] }
10980
+ },
10981
+ required: ["address", "reason"],
10982
+ additionalProperties: false
10983
+ }
10984
+ },
10985
+ executeUntil: { anyOf: [{ type: "string" }, { type: "null" }] },
10986
+ retryAt: { anyOf: [{ type: "string" }, { type: "null" }] },
10987
+ problem: { anyOf: [{
10988
+ type: "object",
10989
+ properties: {
10990
+ code: { type: "string" },
10991
+ message: { type: "string" },
10992
+ error: { anyOf: [{ anyOf: [
10993
+ {
10994
+ type: "object",
10995
+ properties: {
10996
+ _tag: {
10997
+ type: "string",
10998
+ enum: ["SenderNotReadyError"]
10999
+ },
11000
+ message: { type: "string" },
11001
+ sender: { type: "string" },
11002
+ retryAfterSeconds: { anyOf: [{ type: "number" }, { type: "null" }] }
11003
+ },
11004
+ required: [
11005
+ "_tag",
11006
+ "message",
11007
+ "sender"
11008
+ ],
11009
+ additionalProperties: false
11010
+ },
11011
+ {
11012
+ type: "object",
11013
+ properties: {
11014
+ _tag: {
11015
+ type: "string",
11016
+ enum: ["RateLimitedError"]
11017
+ },
11018
+ message: { type: "string" },
11019
+ retryAfterSeconds: { type: "number" }
11020
+ },
11021
+ required: [
11022
+ "_tag",
11023
+ "message",
11024
+ "retryAfterSeconds"
11025
+ ],
11026
+ additionalProperties: false
11027
+ },
11028
+ {
11029
+ type: "object",
11030
+ properties: {
11031
+ _tag: {
11032
+ type: "string",
11033
+ enum: ["OnboardingReviewRequiredError"]
11034
+ },
11035
+ message: { type: "string" },
11036
+ code: {
11037
+ type: "string",
11038
+ enum: [
11039
+ "review_required",
11040
+ "review_in_progress",
11041
+ "information_required",
11042
+ "review_rejected",
11043
+ "identity_review_required",
11044
+ "identity_review_rejected",
11045
+ "identity_changed"
11046
+ ]
11047
+ },
11048
+ decision: {
11049
+ type: "string",
11050
+ enum: [
11051
+ "undecided",
11052
+ "approved",
11053
+ "rejected"
11054
+ ]
11055
+ },
11056
+ stage: {
11057
+ type: "string",
11058
+ enum: [
11059
+ "collecting",
11060
+ "automated_review",
11061
+ "manual_review",
11062
+ "information_requested",
11063
+ "complete"
11064
+ ]
11065
+ },
11066
+ nextAction: {
11067
+ type: "string",
11068
+ enum: [
11069
+ "wait_for_review",
11070
+ "provide_information",
11071
+ "verify_sending_identity",
11072
+ "reapply",
11073
+ "contact_support"
11074
+ ]
11075
+ },
11076
+ identityId: { anyOf: [{ type: "string" }, { type: "null" }] }
11077
+ },
11078
+ required: [
11079
+ "_tag",
11080
+ "message",
11081
+ "code",
11082
+ "decision",
11083
+ "stage",
11084
+ "nextAction"
11085
+ ],
11086
+ additionalProperties: false
11087
+ },
11088
+ {
11089
+ type: "object",
11090
+ properties: {
11091
+ _tag: {
11092
+ type: "string",
11093
+ enum: ["PaymentRequiredError"]
11094
+ },
11095
+ message: { type: "string" },
11096
+ resource: { type: "string" },
11097
+ currentUsage: { type: "number" },
11098
+ limit: { type: "number" }
11099
+ },
11100
+ required: [
11101
+ "_tag",
11102
+ "message",
11103
+ "resource",
11104
+ "currentUsage",
11105
+ "limit"
11106
+ ],
11107
+ additionalProperties: false
11108
+ },
11109
+ {
11110
+ type: "object",
11111
+ properties: {
11112
+ _tag: {
11113
+ type: "string",
11114
+ enum: ["ValidationError"]
11115
+ },
11116
+ message: { type: "string" },
11117
+ fields: { anyOf: [{
11118
+ type: "object",
11119
+ additionalProperties: {
11120
+ type: "array",
11121
+ items: { type: "string" }
11122
+ }
11123
+ }, { type: "null" }] }
11124
+ },
11125
+ required: ["_tag", "message"],
11126
+ additionalProperties: false
11127
+ },
11128
+ {
11129
+ type: "object",
11130
+ properties: {
11131
+ _tag: {
11132
+ type: "string",
11133
+ enum: ["ForbiddenError"]
11134
+ },
11135
+ message: { type: "string" }
11136
+ },
11137
+ required: ["_tag", "message"],
11138
+ additionalProperties: false
11139
+ },
11140
+ {
11141
+ type: "object",
11142
+ properties: {
11143
+ _tag: {
11144
+ type: "string",
11145
+ enum: ["ResourceNotFoundError"]
11146
+ },
11147
+ resource: { type: "string" },
11148
+ id: { type: "string" },
11149
+ message: { type: "string" }
11150
+ },
11151
+ required: [
11152
+ "_tag",
11153
+ "resource",
11154
+ "id",
11155
+ "message"
11156
+ ],
11157
+ additionalProperties: false
11158
+ }
11159
+ ] }, { type: "null" }] }
11160
+ },
11161
+ required: ["code", "message"],
11162
+ additionalProperties: false
11163
+ }, { type: "null" }] },
11164
+ retryEligible: { type: "boolean" },
11165
+ decision: { anyOf: [{
11166
+ type: "object",
11167
+ properties: {
11168
+ outcome: {
11169
+ type: "string",
11170
+ enum: [
11171
+ "allow",
11172
+ "requireApproval",
11173
+ "deny"
11174
+ ]
11175
+ },
11176
+ reason: { anyOf: [{ type: "string" }, { type: "null" }] },
11177
+ policyId: { anyOf: [{
11178
+ type: "string",
11179
+ pattern: "^mbxpol_[0-9a-hjkmnp-tv-z]{16,24}$",
11180
+ "x-samva-brand": "MailboxPolicyId"
11181
+ }, { type: "null" }] },
11182
+ source: { anyOf: [{
11183
+ type: "string",
11184
+ enum: [
11185
+ "grant",
11186
+ "installation",
11187
+ "policy"
11188
+ ]
11189
+ }, { type: "null" }] },
11190
+ decidedAt: { type: "string" }
11191
+ },
11192
+ required: [
11193
+ "outcome",
11194
+ "reason",
11195
+ "policyId",
11196
+ "source",
11197
+ "decidedAt"
11198
+ ],
11199
+ additionalProperties: false
11200
+ }, { type: "null" }] },
11201
+ createdAt: { type: "string" },
11202
+ updatedAt: { type: "string" }
11203
+ },
11204
+ required: [
11205
+ "actionId",
11206
+ "draftId",
11207
+ "messageId",
11208
+ "threadId",
11209
+ "state",
11210
+ "acceptedAt",
11211
+ "waitReason",
11212
+ "reviewExpectedAt",
11213
+ "skippedRecipients",
11214
+ "executeUntil",
11215
+ "retryAt",
11216
+ "problem",
11217
+ "retryEligible",
11218
+ "decision",
11219
+ "createdAt",
11220
+ "updatedAt"
11221
+ ],
11222
+ additionalProperties: false
11223
+ }
11224
+ },
11225
+ required: [
11226
+ "_tag",
11227
+ "message",
11228
+ "receipt"
11229
+ ],
11230
+ additionalProperties: false
11231
+ },
10284
11232
  OnboardingReviewRequiredError: {
10285
11233
  type: "object",
10286
11234
  properties: {
@@ -10406,6 +11354,26 @@ const payloadSchemas = {
10406
11354
  "x-category": ["notFound"],
10407
11355
  "x-retryable": false
10408
11356
  },
11357
+ SenderNotReadyError: {
11358
+ type: "object",
11359
+ properties: {
11360
+ _tag: {
11361
+ type: "string",
11362
+ enum: ["SenderNotReadyError"]
11363
+ },
11364
+ message: { type: "string" },
11365
+ sender: { type: "string" },
11366
+ retryAfterSeconds: { anyOf: [{ type: "number" }, { type: "null" }] }
11367
+ },
11368
+ required: [
11369
+ "_tag",
11370
+ "message",
11371
+ "sender"
11372
+ ],
11373
+ additionalProperties: false,
11374
+ "x-category": ["transient"],
11375
+ "x-retryable": true
11376
+ },
10409
11377
  UnauthorizedError: {
10410
11378
  type: "object",
10411
11379
  properties: {
@@ -10509,9 +11477,9 @@ function fromApiError(error, context = {}) {
10509
11477
  * const samva = createClient({ apiKey: "<samva-api-key>" });
10510
11478
  *
10511
11479
  * try {
10512
- * const contact = await samva.contacts.findOrCreate({
10513
- * name: "Ada Lovelace",
10514
- * email: "ada@example.com",
11480
+ * const { contact } = await samva.contacts.findOrCreate({
11481
+ * create: { name: "Ada Lovelace" },
11482
+ * lookup: { type: "email", value: "ada@example.com" },
10515
11483
  * });
10516
11484
  * await samva.email.send({
10517
11485
  * to: contact,
@@ -10537,6 +11505,56 @@ function resolveIdempotencyKey(options) {
10537
11505
  requestOptions
10538
11506
  };
10539
11507
  }
11508
+ /**
11509
+ * Inline attachment content over the API's request cap travels as media instead: the largest
11510
+ * attachments are uploaded (create, put to the presigned URL, complete) and replaced by their
11511
+ * `mediaId`. The returned payload is the one request every send attempt reuses, so nothing is
11512
+ * uploaded twice.
11513
+ */
11514
+ async function uploadOversizedAttachments(clientInstance, payload, requestOptions) {
11515
+ const plan = planInlineUploads(payload);
11516
+ if (plan.length === 0) return payload;
11517
+ const uploaded = /* @__PURE__ */ new Map();
11518
+ const directMedia = createDirectService(createBoundService(Media, clientInstance));
11519
+ for (const upload of plan) {
11520
+ const created = await directMedia.create(mediaCreateBody(upload), requestOptions);
11521
+ await putUpload(clientInstance, upload, created, requestOptions.signal ?? void 0);
11522
+ await directMedia.complete({ id: created.id }, requestOptions);
11523
+ uploaded.set(upload.index, {
11524
+ mediaId: created.id,
11525
+ upload
11526
+ });
11527
+ }
11528
+ return withUploadedAttachments(payload, uploaded);
11529
+ }
11530
+ /**
11531
+ * Send with oversized inline attachments uploaded first. Within the cap this is the send call
11532
+ * itself, one request and no extra await, so its result is returned unchanged.
11533
+ */
11534
+ function sendWithUploads(clientInstance, payload, requestOptions, send) {
11535
+ if (planInlineUploads(payload).length === 0) return send(payload);
11536
+ return uploadOversizedAttachments(clientInstance, payload, requestOptions).then(send);
11537
+ }
11538
+ async function putUpload(clientInstance, upload, created, signal) {
11539
+ const fail = (status, cause) => new MediaUploadError({
11540
+ filename: upload.filename,
11541
+ mediaId: created.id,
11542
+ status,
11543
+ cause
11544
+ });
11545
+ let response;
11546
+ try {
11547
+ response = await (clientInstance.getConfig().fetch ?? globalThis.fetch)(new Request(created.upload.url, {
11548
+ method: created.upload.method,
11549
+ headers: created.upload.headers,
11550
+ body: upload.bytes,
11551
+ signal: signal ?? null
11552
+ }));
11553
+ } catch (error) {
11554
+ throw fail(void 0, error);
11555
+ }
11556
+ if (!response.ok) throw fail(response.status);
11557
+ }
10540
11558
  function createPromiseMessagesTransport(clientInstance) {
10541
11559
  const boundMessages = createBoundService(Messages, clientInstance);
10542
11560
  return {
@@ -10551,13 +11569,13 @@ function createPromiseMessagesTransport(clientInstance) {
10551
11569
  validateEmail: boundMessages.validateEmail,
10552
11570
  send: (input, options) => {
10553
11571
  const { idempotencyKey, requestOptions } = resolveIdempotencyKey(options);
10554
- return Messages.send({
11572
+ return sendWithUploads(clientInstance, buildMessagesSendPayload(input), requestOptions, (payload) => Messages.send({
10555
11573
  "idempotency-key": idempotencyKey,
10556
- emailSendMessagePayload: buildMessagesSendPayload(input)
11574
+ emailSendMessagePayload: payload
10557
11575
  }, {
10558
11576
  ...requestOptions,
10559
11577
  client: clientInstance
10560
- });
11578
+ }));
10561
11579
  }
10562
11580
  };
10563
11581
  }
@@ -10578,13 +11596,13 @@ function createPromiseEmailTransport(clientInstance) {
10578
11596
  },
10579
11597
  send: (input, options) => {
10580
11598
  const { idempotencyKey, requestOptions } = resolveIdempotencyKey(options);
10581
- return Messages.send({
11599
+ return sendWithUploads(clientInstance, buildEmailSendPayload(input), requestOptions, (payload) => Messages.send({
10582
11600
  "idempotency-key": idempotencyKey,
10583
- emailSendMessagePayload: buildEmailSendPayload(input)
11601
+ emailSendMessagePayload: payload
10584
11602
  }, {
10585
11603
  ...requestOptions,
10586
11604
  client: clientInstance
10587
- });
11605
+ }));
10588
11606
  }
10589
11607
  });
10590
11608
  }
@@ -10618,6 +11636,7 @@ async function unwrap(method, arguments_) {
10618
11636
  try {
10619
11637
  result = await method(...arguments_);
10620
11638
  } catch (error) {
11639
+ if (error instanceof MediaUploadError) throw error;
10621
11640
  throw fromApiError(error);
10622
11641
  }
10623
11642
  if (!isObject(result)) throw new SamvaTransportError(result);
@@ -10670,6 +11689,7 @@ function createClient(config) {
10670
11689
  attachments: createBoundService(Attachments, clientInstance),
10671
11690
  contactGroups: createBoundService(ContactGroups, clientInstance),
10672
11691
  customFields: createBoundService(CustomFields, clientInstance),
11692
+ subscriptions: createBoundService(Subscriptions, clientInstance),
10673
11693
  unsubscribeGroups: createBoundService(Unsubscribe, clientInstance),
10674
11694
  analytics: createBoundService(Analytics, clientInstance),
10675
11695
  feedback: createBoundService(Feedback, clientInstance),
@@ -10680,7 +11700,7 @@ function createClient(config) {
10680
11700
  };
10681
11701
  const streamConnection = {
10682
11702
  baseUrl: config.baseUrl ?? "https://api.samva.dev",
10683
- headers: Object.fromEntries(mergeHeaders({ [CLIENT_ATTRIBUTION_HEADER]: clientAttribution("typescript-promise") }, config.headers, authHeaders).entries()),
11703
+ headers: async () => Object.fromEntries(mergeHeaders({ [CLIENT_ATTRIBUTION_HEADER]: clientAttribution("typescript-promise") }, config.headers, authHeaders).entries()),
10684
11704
  fetch: config.fetch
10685
11705
  };
10686
11706
  const promiseMessages = createPromiseMessagesTransport(clientInstance);
@@ -10703,6 +11723,7 @@ function createClient(config) {
10703
11723
  attachments: createDirectService(raw.attachments),
10704
11724
  contactGroups: createDirectService(raw.contactGroups),
10705
11725
  customFields: createDirectService(raw.customFields),
11726
+ subscriptions: createDirectService(raw.subscriptions),
10706
11727
  unsubscribeGroups: createDirectService(raw.unsubscribeGroups),
10707
11728
  analytics: createDirectService(raw.analytics),
10708
11729
  feedback: createDirectService(raw.feedback),
@@ -10713,6 +11734,6 @@ function createClient(config) {
10713
11734
  };
10714
11735
  }
10715
11736
  //#endregion
10716
- export { fromApiError as S, ResourceNotFoundError as _, CampaignFooterRequiredError as a, UnauthorizedError as b, EmailChannelError as c, ForbiddenError as d, GatewayTimeoutError as f, RateLimitedError as g, PaymentRequiredError as h, BrandAddressRequiredError as i, ExternalServiceError as l, OnboardingReviewRequiredError as m, AnalyticsQueryError as n, ConflictError as o, InternalError as p, BillingProviderError as r, DeliveryUnavailableError as s, createClient as t, FlagDisabledError as u, SamvaApiError as v, ValidationError as x, SamvaTransportError as y };
11737
+ export { UnauthorizedError as C, SenderNotReadyError as S, fromApiError as T, PaymentRequiredError as _, CampaignFooterRequiredError as a, SamvaApiError as b, EmailChannelError as c, ForbiddenError as d, GatewayTimeoutError as f, OnboardingReviewRequiredError as g, MailboxSendRefusedError as h, BrandAddressRequiredError as i, ExternalServiceError as l, MailboxSendConflictError as m, AnalyticsQueryError as n, ConflictError as o, InternalError as p, BillingProviderError as r, DeliveryUnavailableError as s, createClient as t, FlagDisabledError as u, RateLimitedError as v, ValidationError as w, SamvaTransportError as x, ResourceNotFoundError as y };
10717
11738
 
10718
- //# sourceMappingURL=promises-BzrwhHEW.js.map
11739
+ //# sourceMappingURL=promises-BFRKhpSS.js.map