samva 0.52.0 → 0.54.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 (43) hide show
  1. package/dist/client/sdk.gen.d.ts +55 -18
  2. package/dist/client/sdk.gen.js +165 -45
  3. package/dist/client/types.gen.d.ts +313 -21
  4. package/dist/effect/brands.d.ts +8 -1
  5. package/dist/effect/descriptors/brands.d.ts +4 -4
  6. package/dist/effect/descriptors/brands.js +4 -4
  7. package/dist/effect/descriptors/email.d.ts +21 -1
  8. package/dist/effect/descriptors/email.js +21 -1
  9. package/dist/effect/email.d.ts +12 -0
  10. package/dist/effect/email.js +5 -1
  11. package/dist/effect/events.d.ts +16 -0
  12. package/dist/effect/generated/api-keys.js +2 -2
  13. package/dist/effect/generated/brands.d.ts +78 -8
  14. package/dist/effect/generated/brands.js +21 -12
  15. package/dist/effect/generated/email.d.ts +473 -2
  16. package/dist/effect/generated/email.js +106 -7
  17. package/dist/effect/generated/events.d.ts +48 -0
  18. package/dist/effect/generated/events.js +1 -1
  19. package/dist/effect/generated/journeys.d.ts +1173 -55
  20. package/dist/effect/generated/journeys.js +10 -4
  21. package/dist/effect/generated/logs.d.ts +12 -0
  22. package/dist/effect/generated/mailboxes.d.ts +8 -0
  23. package/dist/effect/generated/mailboxes.js +2 -1
  24. package/dist/effect/generated/messages.d.ts +16 -0
  25. package/dist/effect/generated/messages.js +7 -1
  26. package/dist/effect/generated/scheduled-messages.d.ts +36 -0
  27. package/dist/effect/generated/shared.d.ts +438 -15
  28. package/dist/effect/generated/shared.js +59 -13
  29. package/dist/effect/generated/templates.d.ts +34 -1
  30. package/dist/effect/generated/templates.js +18 -3
  31. package/dist/effect/generated/whats-app-flows.d.ts +23 -5
  32. package/dist/effect/generated/whats-app-flows.js +9 -7
  33. package/dist/effect/generated-metadata.d.ts +12 -0
  34. package/dist/effect/generated-metadata.js +2 -0
  35. package/dist/effect/journeys.d.ts +76 -0
  36. package/dist/effect/mailboxes.d.ts +2 -0
  37. package/dist/effect/scheduled-messages.d.ts +66 -0
  38. package/dist/effect/templates.d.ts +1 -0
  39. package/dist/effect/whatsapp-flows.d.ts +30 -0
  40. package/dist/package.js +1 -1
  41. package/dist/promises/types.gen.d.ts +1 -1
  42. package/dist/service-map.d.ts +15 -5
  43. package/package.json +2 -2
@@ -1343,6 +1343,41 @@ var Campaigns = class {
1343
1343
  }
1344
1344
  };
1345
1345
  var Email = class {
1346
+ /**
1347
+ * Get deliverability insights for a sending domain
1348
+ *
1349
+ * Requires the Deliverability Insights add-on. Returns delivery, permanent and transient bounce, and complaint rates by mailbox provider. Includes recommendations and Samva-tracked open and click rates for the sending domain. The report covers the last 7 days by default. Use days=30 for a 30-day report.
1350
+ */
1351
+ static getDeliverabilityInsights(parameters, options) {
1352
+ const params = buildClientParams([parameters], [{ args: [
1353
+ {
1354
+ in: "path",
1355
+ key: "id"
1356
+ },
1357
+ {
1358
+ in: "query",
1359
+ key: "days"
1360
+ },
1361
+ {
1362
+ in: "query",
1363
+ key: "mailboxProvider"
1364
+ }
1365
+ ] }]);
1366
+ return requestWithPolicy(options?.client ?? client, "emailGetDeliverabilityInsights", options, (headers, signal) => (options?.client ?? client).get({
1367
+ security: [{
1368
+ name: "x-api-key",
1369
+ type: "apiKey"
1370
+ }],
1371
+ url: "/v1/email/domains/{id}/deliverability",
1372
+ ...options,
1373
+ ...params,
1374
+ headers: {
1375
+ ...headers,
1376
+ ...params.headers
1377
+ },
1378
+ signal
1379
+ }));
1380
+ }
1346
1381
  /**
1347
1382
  * Get email review status
1348
1383
  *
@@ -1796,16 +1831,23 @@ var Email = class {
1796
1831
  /**
1797
1832
  * Build a one-click DNS apply URL
1798
1833
  *
1799
- * Builds the signed Domain Connect apply URL for the selected sending-only or sending-and-receiving service. The sending-and-receiving service writes the apex inbound MX, so it is refused until the domain's receiving is enabled. Manual DNS remains available for either mode.
1834
+ * Builds the signed Domain Connect apply URL for the selected sending-only or sending-and-receiving service. The sending-and-receiving service writes the apex inbound MX, so it is refused until the domain's receiving is enabled. Manual DNS remains available for either mode. With returnUrl, Samva handles the registrar return and redirects to your app with status and domainId. Omit it to return to the Samva dashboard.
1800
1835
  */
1801
1836
  static buildDomainConnectApplyUrl(parameters, options) {
1802
- const params = buildClientParams([parameters], [{ args: [{
1803
- in: "path",
1804
- key: "id"
1805
- }, {
1806
- in: "body",
1807
- key: "mode"
1808
- }] }]);
1837
+ const params = buildClientParams([parameters], [{ args: [
1838
+ {
1839
+ in: "path",
1840
+ key: "id"
1841
+ },
1842
+ {
1843
+ in: "body",
1844
+ key: "mode"
1845
+ },
1846
+ {
1847
+ in: "body",
1848
+ key: "returnUrl"
1849
+ }
1850
+ ] }]);
1809
1851
  return requestWithPolicy(options?.client ?? client, "emailBuildDomainConnectApplyUrl", options, (headers, signal) => (options?.client ?? client).post({
1810
1852
  security: [{
1811
1853
  name: "x-api-key",
@@ -2152,12 +2194,15 @@ var Email = class {
2152
2194
  /**
2153
2195
  * Build an automatic Custom Tracking Domain apply URL
2154
2196
  *
2155
- * Builds the signed Domain Connect URL for the current customer-selected tracking host. Samva fills in the host and the certificate validation record; the manual CNAME records remain available.
2197
+ * Builds the signed Domain Connect URL for the current customer-selected tracking host. Samva fills in the host and certificate validation record. With returnUrl, Samva handles the registrar return and redirects to your app with status, domainId, and customTrackingDomainId. Omit it to return to the Samva dashboard. The manual CNAME records remain available.
2156
2198
  */
2157
2199
  static buildCustomTrackingDomainConnectApplyUrl(parameters, options) {
2158
2200
  const params = buildClientParams([parameters], [{ args: [{
2159
2201
  in: "path",
2160
2202
  key: "id"
2203
+ }, {
2204
+ in: "query",
2205
+ key: "returnUrl"
2161
2206
  }] }]);
2162
2207
  return requestWithPolicy(options?.client ?? client, "emailBuildCustomTrackingDomainConnectApplyUrl", options, (headers, signal) => (options?.client ?? client).post({
2163
2208
  security: [{
@@ -2383,6 +2428,43 @@ var Email = class {
2383
2428
  }));
2384
2429
  }
2385
2430
  /**
2431
+ * Update a sender
2432
+ *
2433
+ * Updates a sender's display name and reply-to addresses without re-verification. Omit a field to leave it unchanged. Set it to null to clear it. Set replyToEmails to an empty array to suppress inherited reply-to addresses.
2434
+ */
2435
+ static updateSender(parameters, options) {
2436
+ const params = buildClientParams([parameters], [{ args: [
2437
+ {
2438
+ in: "path",
2439
+ key: "id"
2440
+ },
2441
+ {
2442
+ in: "body",
2443
+ key: "name"
2444
+ },
2445
+ {
2446
+ in: "body",
2447
+ key: "replyToEmails"
2448
+ }
2449
+ ] }]);
2450
+ return requestWithPolicy(options?.client ?? client, "emailUpdateSender", options, (headers, signal) => (options?.client ?? client).patch({
2451
+ security: [{
2452
+ name: "x-api-key",
2453
+ type: "apiKey"
2454
+ }],
2455
+ url: "/v1/email/senders/{id}",
2456
+ ...options,
2457
+ ...params,
2458
+ body: params.body ?? {},
2459
+ headers: {
2460
+ "Content-Type": "application/json",
2461
+ ...headers,
2462
+ ...params.headers
2463
+ },
2464
+ signal
2465
+ }));
2466
+ }
2467
+ /**
2386
2468
  * Set the default sender
2387
2469
  *
2388
2470
  * Sets a sendable sender (see `sendable` on the sender) as the default for the caller's namespace, the explicit namespaceId, or the sender's own scope. A namespace can select its own sender or a sender on a shared organization domain. This changes only the namespace's default; it does not change a shared sender. Omitted-`from` sends use this default when neither the request nor the template names a `from`.
@@ -5114,7 +5196,7 @@ var Events = class {
5114
5196
  /**
5115
5197
  * Record a contact event
5116
5198
  *
5117
- * Records a custom contact event. Identify the contact by exactly one ID, external ID, or email. A missing email or external ID creates a contact; an unknown contact ID returns 404. An organization-scoped idempotency key replays the original event. Event names use letters, digits, underscores, hyphens, and dots, up to 255 characters; contact. and samva. prefixes are reserved. Properties allow at most 50 keys and 32 KiB of UTF-8 JSON. Events are retained for 90 days.
5199
+ * Records a custom contact event. Identify the contact by exactly one ID, external ID, email, or E.164 phone number. An unmatched external ID, email, or phone number creates a contact; an unknown contact ID returns 404. An idempotency key replays the original event in the credential’s scope. Event names use letters, digits, underscores, hyphens, and dots, up to 255 characters; contact. and samva. prefixes are reserved. Properties allow at most 50 keys and 32 KiB of UTF-8 JSON. Events are retained for 90 days.
5118
5200
  */
5119
5201
  static create(parameters, options) {
5120
5202
  const params = buildClientParams([parameters], [{ args: [
@@ -5221,10 +5303,14 @@ var Journeys = class {
5221
5303
  /**
5222
5304
  * List journeys
5223
5305
  *
5224
- * Returns the organization's journeys, newest first, optionally filtered by status. Pass nextCursor back as cursor for the next page.
5306
+ * Returns the journeys the caller can access, newest first. Filter by namespaceId or status. Pass nextCursor back as cursor for the next page.
5225
5307
  */
5226
5308
  static list(parameters, options) {
5227
5309
  const params = buildClientParams([parameters], [{ args: [
5310
+ {
5311
+ in: "query",
5312
+ key: "namespaceId"
5313
+ },
5228
5314
  {
5229
5315
  in: "query",
5230
5316
  key: "status"
@@ -5256,16 +5342,23 @@ var Journeys = class {
5256
5342
  /**
5257
5343
  * Create a journey
5258
5344
  *
5259
- * Creates a draft journey from a definition: a trigger, a root node, and a graph of at most 200 nodes that is acyclic and fully reachable. Templates, senders, and groups the definition names must belong to the organization. Requires a plan that includes journeys.
5345
+ * Creates a draft journey from a definition: a trigger, a root node, and a graph of at most 200 nodes that is acyclic and fully reachable. A namespace key creates in its own namespace. An organization key can pass namespaceId to place the journey in a namespace. The journey can use resources available in its scope. Requires a plan that includes journeys.
5260
5346
  */
5261
5347
  static create(parameters, options) {
5262
- const params = buildClientParams([parameters], [{ args: [{
5263
- in: "body",
5264
- key: "name"
5265
- }, {
5266
- in: "body",
5267
- key: "definition"
5268
- }] }]);
5348
+ const params = buildClientParams([parameters], [{ args: [
5349
+ {
5350
+ in: "body",
5351
+ key: "name"
5352
+ },
5353
+ {
5354
+ in: "body",
5355
+ key: "namespaceId"
5356
+ },
5357
+ {
5358
+ in: "body",
5359
+ key: "definition"
5360
+ }
5361
+ ] }]);
5269
5362
  return requestWithPolicy(options?.client ?? client, "journeysCreate", options, (headers, signal) => (options?.client ?? client).post({
5270
5363
  security: [{
5271
5364
  name: "x-api-key",
@@ -9550,7 +9643,7 @@ var Templates = class {
9550
9643
  /**
9551
9644
  * Add a template entry
9552
9645
  *
9553
- * Registers a `.tsx` file under `templates/` or `emails/` in an existing template project as its own template and returns it with status 201. The file does not need to exist yet; publishing fails until a commit contains it. Repeating the call with the same entry path, name, and slug returns the existing template.
9646
+ * Registers a `.tsx` file under `templates/` or `emails/` in an existing project as an email or WhatsApp template and returns status 201. The source determines the channel when available. If the entry declares both channels, email is selected unless you pass a channel. For a local or unwritten file, pass its channel or omit it to register email. Publishing checks the channel against the saved commit. Repeating the call with the same entry path, name, and slug returns the existing template.
9554
9647
  */
9555
9648
  static addEntry(parameters, options) {
9556
9649
  const params = buildClientParams([parameters], [{ args: [
@@ -9570,6 +9663,10 @@ var Templates = class {
9570
9663
  in: "body",
9571
9664
  key: "slug"
9572
9665
  },
9666
+ {
9667
+ in: "body",
9668
+ key: "channel"
9669
+ },
9573
9670
  {
9574
9671
  in: "body",
9575
9672
  key: "description"
@@ -10428,9 +10525,13 @@ var Brands = class {
10428
10525
  /**
10429
10526
  * List brands
10430
10527
  *
10431
- * Returns the organization's brands, the default brand first.
10528
+ * Returns brands in the addressed scope, the default first. A namespace caller without brands sees the shared organization brands when no namespaceId is supplied.
10432
10529
  */
10433
- static list(options) {
10530
+ static list(parameters, options) {
10531
+ const params = buildClientParams([parameters], [{ args: [{
10532
+ in: "query",
10533
+ key: "namespaceId"
10534
+ }] }]);
10434
10535
  return requestWithPolicy(options?.client ?? client, "brandsList", options, (headers, signal) => (options?.client ?? client).get({
10435
10536
  security: [{
10436
10537
  name: "x-api-key",
@@ -10438,17 +10539,25 @@ var Brands = class {
10438
10539
  }],
10439
10540
  url: "/v1/brands",
10440
10541
  ...options,
10441
- headers: { ...headers },
10542
+ ...params,
10543
+ headers: {
10544
+ ...headers,
10545
+ ...params.headers
10546
+ },
10442
10547
  signal
10443
10548
  }));
10444
10549
  }
10445
10550
  /**
10446
10551
  * Create a brand
10447
10552
  *
10448
- * Creates a brand. The CSS must parse as a brand theme; a rejected theme answers 422 with located findings under `fields.css`. With `isDefault`, the new brand becomes the default. An organization holds at most 12 brands; creating one more answers 409 with a `ConflictError`.
10553
+ * Creates a brand. The CSS must parse as a brand theme; a rejected theme answers 422 with located findings under `fields.css`. The first namespace brand is its default. With `isDefault`, the new brand becomes the default for its scope. Each organization or namespace independently holds at most 12 brands; creating one more answers 409 with a `ConflictError`.
10449
10554
  */
10450
10555
  static create(parameters, options) {
10451
10556
  const params = buildClientParams([parameters], [{ args: [
10557
+ {
10558
+ in: "body",
10559
+ key: "namespaceId"
10560
+ },
10452
10561
  {
10453
10562
  in: "body",
10454
10563
  key: "slug"
@@ -10500,6 +10609,9 @@ var Brands = class {
10500
10609
  const params = buildClientParams([parameters], [{ args: [{
10501
10610
  in: "path",
10502
10611
  key: "slug"
10612
+ }, {
10613
+ in: "query",
10614
+ key: "namespaceId"
10503
10615
  }] }]);
10504
10616
  return requestWithPolicy(options?.client ?? client, "brandsRemove", options, (headers, signal) => (options?.client ?? client).delete({
10505
10617
  security: [{
@@ -10519,12 +10631,15 @@ var Brands = class {
10519
10631
  /**
10520
10632
  * Get a brand
10521
10633
  *
10522
- * Returns one brand by its slug.
10634
+ * Returns a brand by slug in the addressed scope. A namespace caller omitting namespaceId can also look up shared organization brands.
10523
10635
  */
10524
10636
  static get(parameters, options) {
10525
10637
  const params = buildClientParams([parameters], [{ args: [{
10526
10638
  in: "path",
10527
10639
  key: "slug"
10640
+ }, {
10641
+ in: "query",
10642
+ key: "namespaceId"
10528
10643
  }] }]);
10529
10644
  return requestWithPolicy(options?.client ?? client, "brandsGet", options, (headers, signal) => (options?.client ?? client).get({
10530
10645
  security: [{
@@ -10544,7 +10659,7 @@ var Brands = class {
10544
10659
  /**
10545
10660
  * Update a brand
10546
10661
  *
10547
- * Updates a brand. Each section given replaces that section whole. Published templates keep the brand they were built against until they are republished.
10662
+ * Updates a brand. Each section given replaces that section whole. Namespace sends using bare `samva:brand` use the current default.
10548
10663
  */
10549
10664
  static update(parameters, options) {
10550
10665
  const params = buildClientParams([parameters], [{ args: [
@@ -10552,6 +10667,10 @@ var Brands = class {
10552
10667
  in: "path",
10553
10668
  key: "slug"
10554
10669
  },
10670
+ {
10671
+ in: "body",
10672
+ key: "namespaceId"
10673
+ },
10555
10674
  {
10556
10675
  in: "body",
10557
10676
  key: "newSlug"
@@ -10593,12 +10712,15 @@ var Brands = class {
10593
10712
  /**
10594
10713
  * Make a brand the default
10595
10714
  *
10596
- * Makes this brand the organization's default: bare `samva:brand` and domains without a brand resolve to it at their next build or send.
10715
+ * Makes this brand the default in the addressed organization or namespace.
10597
10716
  */
10598
10717
  static setDefault(parameters, options) {
10599
10718
  const params = buildClientParams([parameters], [{ args: [{
10600
10719
  in: "path",
10601
10720
  key: "slug"
10721
+ }, {
10722
+ in: "query",
10723
+ key: "namespaceId"
10602
10724
  }] }]);
10603
10725
  return requestWithPolicy(options?.client ?? client, "brandsSetDefault", options, (headers, signal) => (options?.client ?? client).post({
10604
10726
  security: [{
@@ -15426,7 +15548,7 @@ var WhatsappFlows = class {
15426
15548
  /**
15427
15549
  * List flows
15428
15550
  *
15429
- * Returns the organization's flows, newest first, each with its current version.
15551
+ * Returns flows visible to the caller, newest first, each with its current version.
15430
15552
  */
15431
15553
  static list(options) {
15432
15554
  return requestWithPolicy(options?.client ?? client, "whatsappFlowsList", options, (headers, signal) => (options?.client ?? client).get({
@@ -15443,7 +15565,7 @@ var WhatsappFlows = class {
15443
15565
  /**
15444
15566
  * Create a flow
15445
15567
  *
15446
- * Creates a WhatsApp flow whose versions read `flows/<handle>.json` in the template project. The handle is unique in the organization; the categories are Meta's and go with every version to Meta.
15568
+ * Creates a WhatsApp flow whose versions read `flows/<handle>.json` in the template project. The handle is unique in its namespace or at organization level; the categories are Meta's and go with every version to Meta.
15447
15569
  */
15448
15570
  static create(parameters, options) {
15449
15571
  const params = buildClientParams([parameters], [{ args: [
@@ -15458,6 +15580,10 @@ var WhatsappFlows = class {
15458
15580
  {
15459
15581
  in: "body",
15460
15582
  key: "categories"
15583
+ },
15584
+ {
15585
+ in: "body",
15586
+ key: "submissionHandler"
15461
15587
  }
15462
15588
  ] }]);
15463
15589
  return requestWithPolicy(options?.client ?? client, "whatsappFlowsCreate", options, (headers, signal) => (options?.client ?? client).post({
@@ -15530,23 +15656,16 @@ var WhatsappFlows = class {
15530
15656
  /**
15531
15657
  * Record a flow version
15532
15658
  *
15533
- * Reads the flow's file at a commit on the project's default branch, checks it is Flow JSON Samva sends, and records it as the flow's current version. The same content returns the version that already recorded it.
15659
+ * Supply Flow JSON to commit the flow's file and record its version, or name a commit and workspace revision to record a file already on the project's default branch. The same content returns the version that already recorded it.
15534
15660
  */
15535
15661
  static recordVersion(parameters, options) {
15536
- const params = buildClientParams([parameters], [{ args: [
15537
- {
15538
- in: "path",
15539
- key: "id"
15540
- },
15541
- {
15542
- in: "body",
15543
- key: "commitSha"
15544
- },
15545
- {
15546
- in: "body",
15547
- key: "expectedWorkspaceRevision"
15548
- }
15549
- ] }]);
15662
+ const params = buildClientParams([parameters], [{ args: [{
15663
+ in: "path",
15664
+ key: "id"
15665
+ }, {
15666
+ key: "body",
15667
+ map: "body"
15668
+ }] }]);
15550
15669
  return requestWithPolicy(options?.client ?? client, "whatsappFlowsRecordVersion", options, (headers, signal) => (options?.client ?? client).post({
15551
15670
  security: [{
15552
15671
  name: "x-api-key",
@@ -15555,7 +15674,6 @@ var WhatsappFlows = class {
15555
15674
  url: "/v1/whatsapp/flows/{id}/versions",
15556
15675
  ...options,
15557
15676
  ...params,
15558
- body: params.body ?? {},
15559
15677
  headers: {
15560
15678
  "Content-Type": "application/json",
15561
15679
  ...headers,
@@ -15969,6 +16087,7 @@ Object.assign(Campaigns.pauseRun, { operation: "campaignsPauseRun" });
15969
16087
  Object.assign(Campaigns.resumeRun, { operation: "campaignsResumeRun" });
15970
16088
  Object.assign(Campaigns.cancelRun, { operation: "campaignsCancelRun" });
15971
16089
  Object.assign(Campaigns.listRecipients, { operation: "campaignsListRecipients" });
16090
+ Object.assign(Email.getDeliverabilityInsights, { operation: "emailGetDeliverabilityInsights" });
15972
16091
  Object.assign(Email.getOnboardingReview, { operation: "emailGetOnboardingReview" });
15973
16092
  Object.assign(Email.reapplyOnboardingReview, { operation: "emailReapplyOnboardingReview" });
15974
16093
  Object.assign(Email.respondToOnboardingInformationRequest, { operation: "emailRespondToOnboardingInformationRequest" });
@@ -16003,6 +16122,7 @@ Object.assign(Email.addSender, { operation: "emailAddSender" });
16003
16122
  Object.assign(Email.checkSenderVerification, { operation: "emailCheckSenderVerification" });
16004
16123
  Object.assign(Email.removeSender, { operation: "emailRemoveSender" });
16005
16124
  Object.assign(Email.getSender, { operation: "emailGetSender" });
16125
+ Object.assign(Email.updateSender, { operation: "emailUpdateSender" });
16006
16126
  Object.assign(Email.setDefaultSender, { operation: "emailSetDefaultSender" });
16007
16127
  Object.assign(Email.getStats, { operation: "emailGetStats" });
16008
16128
  Object.assign(Email.enableCatchAll, { operation: "emailEnableCatchAll" });