@omni-commerce/sdk 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -33,12 +33,12 @@ function normalizeClientOptions(options = {}) {
33
33
  }
34
34
 
35
35
  // src/version.ts
36
- var SDK_VERSION = "0.19.0";
36
+ var SDK_VERSION = "0.20.0";
37
37
  var SDK_USER_AGENT = `omnicommerce-js/${SDK_VERSION}`;
38
38
 
39
39
  // src/environments.ts
40
40
  var OmniEnvironment = {
41
- Production: "https://omnicommerce.sg",
41
+ Production: "https://omnicommerce.ai",
42
42
  Local: "http://localhost:3000"
43
43
  };
44
44
 
@@ -1490,11 +1490,31 @@ var CampaignsClient = class {
1490
1490
  * `GET /api/v1/campaigns`
1491
1491
  */
1492
1492
  list(request = {}, requestOptions) {
1493
- const { organizationId, q, stage, offset, limit, sortBy, sortDir } = request ?? {};
1493
+ const {
1494
+ organizationId,
1495
+ q,
1496
+ marketplace,
1497
+ store,
1498
+ stage,
1499
+ offset,
1500
+ limit,
1501
+ sortBy,
1502
+ sortDir
1503
+ } = request ?? {};
1494
1504
  return this._http.request({
1495
1505
  method: "GET",
1496
1506
  path: "/api/v1/campaigns",
1497
- query: { organizationId, q, stage, offset, limit, sortBy, sortDir },
1507
+ query: {
1508
+ organizationId,
1509
+ q,
1510
+ marketplace,
1511
+ store,
1512
+ stage,
1513
+ offset,
1514
+ limit,
1515
+ sortBy,
1516
+ sortDir
1517
+ },
1498
1518
  body: void 0,
1499
1519
  ...mergeRequestOptions(requestOptions)
1500
1520
  });
@@ -1533,6 +1553,25 @@ var CampaignsClient = class {
1533
1553
  ...mergeRequestOptions(requestOptions)
1534
1554
  });
1535
1555
  }
1556
+ /**
1557
+ * Change Campaign Details
1558
+ *
1559
+ * Partially edit the brief, upsert windows and promotion offers by stable id, or explicitly remove offer/window IDs. Omitted fields and children stay unchanged. Uses the campaign editor's canonical merger and marketplace validation.
1560
+
1561
+ Running edits build on the pending proposal and require named-approver approval before delivery. Send expectedRevision; expectedPendingVersion can guard a reviewed proposal (null for none). Requires promotions:write.
1562
+ *
1563
+ * `PATCH /api/v1/campaigns/{campaignId}`
1564
+ */
1565
+ update(request, requestOptions) {
1566
+ const { campaignId, ...body } = request ?? {};
1567
+ return this._http.request({
1568
+ method: "PATCH",
1569
+ path: `/api/v1/campaigns/${encodePathParam("campaignId", campaignId)}`,
1570
+ query: void 0,
1571
+ body,
1572
+ ...mergeRequestOptions(requestOptions)
1573
+ });
1574
+ }
1536
1575
  /**
1537
1576
  * Update Campaign
1538
1577
  *
@@ -1567,6 +1606,101 @@ var CampaignsClient = class {
1567
1606
  ...mergeRequestOptions(requestOptions)
1568
1607
  });
1569
1608
  }
1609
+ /**
1610
+ * Get Campaign Analytics
1611
+ *
1612
+ * Read the same imported-order campaign analytics as the application. Monetary totals are partitioned by currency. Optional analyticsWindow selects one campaign window; voucher utilisation limitations are explicit.
1613
+
1614
+ Requires promotions:read. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
1615
+ *
1616
+ * `GET /api/v1/campaigns/{campaignId}/analytics`
1617
+ */
1618
+ getAnalytics(request, requestOptions) {
1619
+ const { campaignId, organizationId, analyticsWindow } = request ?? {};
1620
+ return this._http.request({
1621
+ method: "GET",
1622
+ path: `/api/v1/campaigns/${encodePathParam("campaignId", campaignId)}/analytics`,
1623
+ query: { organizationId, analyticsWindow },
1624
+ body: void 0,
1625
+ ...mergeRequestOptions(requestOptions)
1626
+ });
1627
+ }
1628
+ /**
1629
+ * Get Campaign Notifications
1630
+ *
1631
+ * Read the executing actor's campaign notification preference.
1632
+
1633
+ Requires promotions:read. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
1634
+ *
1635
+ * `GET /api/v1/campaigns/{campaignId}/notifications`
1636
+ */
1637
+ getNotifications(request, requestOptions) {
1638
+ const { campaignId, organizationId } = request ?? {};
1639
+ return this._http.request({
1640
+ method: "GET",
1641
+ path: `/api/v1/campaigns/${encodePathParam("campaignId", campaignId)}/notifications`,
1642
+ query: { organizationId },
1643
+ body: void 0,
1644
+ ...mergeRequestOptions(requestOptions)
1645
+ });
1646
+ }
1647
+ /**
1648
+ * Set Campaign Notifications
1649
+ *
1650
+ * Set only the executing actor's campaign notification preference. Does not change campaign delivery or other members' preferences.
1651
+
1652
+ Requires promotions:read. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
1653
+ *
1654
+ * `PUT /api/v1/campaigns/{campaignId}/notifications`
1655
+ */
1656
+ setNotifications(request, requestOptions) {
1657
+ const { campaignId, ...body } = request ?? {};
1658
+ return this._http.request({
1659
+ method: "PUT",
1660
+ path: `/api/v1/campaigns/${encodePathParam("campaignId", campaignId)}/notifications`,
1661
+ query: void 0,
1662
+ body,
1663
+ ...mergeRequestOptions(requestOptions)
1664
+ });
1665
+ }
1666
+ /**
1667
+ * List Campaign Offers
1668
+ *
1669
+ * Filter and page the canonical campaign plan or pending live proposal, with the same attention rules as the campaign editor.
1670
+
1671
+ Requires promotions:read. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
1672
+ *
1673
+ * `GET /api/v1/campaigns/{campaignId}/offers`
1674
+ */
1675
+ listOffers(request, requestOptions) {
1676
+ const { campaignId, kind, window, review, offset, limit, organizationId } = request ?? {};
1677
+ return this._http.request({
1678
+ method: "GET",
1679
+ path: `/api/v1/campaigns/${encodePathParam("campaignId", campaignId)}/offers`,
1680
+ query: { kind, window, review, offset, limit, organizationId },
1681
+ body: void 0,
1682
+ ...mergeRequestOptions(requestOptions)
1683
+ });
1684
+ }
1685
+ /**
1686
+ * Act on Campaigns
1687
+ *
1688
+ * Apply one action to 1–20 reviewed targets. Approve, run, approve_and_run, end, resume, retry, approve_change, discard_change, archive, restore or delete. Requires each expectedRevision and the pending version for live-change decisions. Named-approver and current role/store checks remain enforced. Duplicates execute once; partial failures remain explicit. Starting queues durable delivery; inspect campaign executions to verify marketplace outcomes.
1689
+
1690
+ Requires promotions:write. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
1691
+ *
1692
+ * `POST /api/v1/campaigns/actions`
1693
+ */
1694
+ actBatch(request, requestOptions) {
1695
+ const { ...body } = request ?? {};
1696
+ return this._http.request({
1697
+ method: "POST",
1698
+ path: "/api/v1/campaigns/actions",
1699
+ query: void 0,
1700
+ body,
1701
+ ...mergeRequestOptions(requestOptions)
1702
+ });
1703
+ }
1570
1704
  /**
1571
1705
  * Archive Campaigns
1572
1706
  *
@@ -1601,6 +1735,25 @@ var CampaignsClient = class {
1601
1735
  ...mergeRequestOptions(requestOptions)
1602
1736
  });
1603
1737
  }
1738
+ /**
1739
+ * Import Campaign Workbooks
1740
+ *
1741
+ * Import 1–10 uploaded Excel document IDs. Preview defaults to true; set preview=false to save. Re-upload one document with campaignId to update a campaign. To apply a running campaign immediately, use applyChanges=true with the reviewed expectedRevision and expectedPendingVersion (null when none); only the named approver with publish permission may apply. Changed values and qualifying SKU removals use canonical marketplace validation and durable sync. Requires documents:read in addition to promotions:write. No browser session is required.
1742
+
1743
+ Requires promotions:write. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
1744
+ *
1745
+ * `POST /api/v1/campaigns/import`
1746
+ */
1747
+ importBriefs(request, requestOptions) {
1748
+ const { ...body } = request ?? {};
1749
+ return this._http.request({
1750
+ method: "POST",
1751
+ path: "/api/v1/campaigns/import",
1752
+ query: void 0,
1753
+ body,
1754
+ ...mergeRequestOptions(requestOptions)
1755
+ });
1756
+ }
1604
1757
  /**
1605
1758
  * Get Campaign Options
1606
1759
  *
@@ -1618,6 +1771,44 @@ var CampaignsClient = class {
1618
1771
  ...mergeRequestOptions(requestOptions)
1619
1772
  });
1620
1773
  }
1774
+ /**
1775
+ * Resolve Campaign Promotion Selection
1776
+ *
1777
+ * Read 1–50 eligible draft promotions as campaign offers without creating or publishing promotions. Exact organization/store ownership and existing campaign links are checked.
1778
+
1779
+ Requires promotions:write. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
1780
+ *
1781
+ * `POST /api/v1/campaigns/promotion-options`
1782
+ */
1783
+ resolvePromotionOptions(request, requestOptions) {
1784
+ const { ...body } = request ?? {};
1785
+ return this._http.request({
1786
+ method: "POST",
1787
+ path: "/api/v1/campaigns/promotion-options",
1788
+ query: void 0,
1789
+ body,
1790
+ ...mergeRequestOptions(requestOptions)
1791
+ });
1792
+ }
1793
+ /**
1794
+ * Validate Campaigns
1795
+ *
1796
+ * Read-only preflight of 1–10 saved campaign IDs or proposed plans. Uses the same readiness, connected-store and offer validation as approval. shiftToNow returns a proposed shifted plan; syncMode=campaign_start selects Full sync. Neither option saves or publishes. Save the returned plan with the reviewed revision before approve_and_run. Current marketplace delivery is separate execution evidence.
1797
+
1798
+ Requires promotions:read. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
1799
+ *
1800
+ * `POST /api/v1/campaigns/validate`
1801
+ */
1802
+ validate(request, requestOptions) {
1803
+ const { ...body } = request ?? {};
1804
+ return this._http.request({
1805
+ method: "POST",
1806
+ path: "/api/v1/campaigns/validate",
1807
+ query: void 0,
1808
+ body,
1809
+ ...mergeRequestOptions(requestOptions)
1810
+ });
1811
+ }
1621
1812
  };
1622
1813
  var CatalogClient = class {
1623
1814
  constructor(_http) {
@@ -1755,12 +1946,20 @@ var CommerceClient = class {
1755
1946
  __publicField(this, "_http", _http);
1756
1947
  }
1757
1948
  /**
1758
- * Await Commerce Jobs
1759
- *
1760
- * Wait for a mixed batch of returned commerce correlations: inventory_job, price_event, publish_job, delist_batch, store_switch, omni_delete, zalora_import, enrichment_batch, order_action and return_action. Maximum 50000 entries; IDs are trimmed and duplicates collapse by kind/id in first-requested order. timeoutMs=0 reads once; bounded waits allow up to 120000ms. Catalog jobs require catalog:read; order/return jobs require orders:read; mixed batches require both. Session callers include organizationId. Every job retains its target identity, status, errors and available label artifacts. Missing or inaccessible fulfillment jobs fail explicitly. needs_review is an uncertain outcome, never automatic success or authorization to resubmit. data.success describes completion; use state verification
1761
- *
1762
- * `POST /api/v1/commerce/jobs/await`
1763
- */
1949
+ * Await Commerce Jobs
1950
+ *
1951
+ * Wait for a mixed batch of returned commerce correlations: inventory_job, price_event, price_book_sync, publish_job, delist_batch, store_switch, omni_delete, zalora_import, enrichment_batch, order_action and return_action.
1952
+
1953
+ ### Request limits and access
1954
+
1955
+ Maximum 50000 entries; IDs are trimmed and duplicates collapse by kind/id in first-requested order. timeoutMs=0 reads once; bounded waits allow up to 120000ms. Catalog jobs require catalog:read; order/return jobs require orders:read; mixed batches require both. Session callers include organizationId.
1956
+
1957
+ ### Result interpretation
1958
+
1959
+ Every job retains its target identity, status, errors and available label artifacts. Missing or inaccessible fulfillment jobs fail explicitly. needs_review is an uncertain outcome, never automatic success or authoriz
1960
+ *
1961
+ * `POST /api/v1/commerce/jobs/await`
1962
+ */
1764
1963
  awaitJobs(request, requestOptions) {
1765
1964
  const { ...body } = request ?? {};
1766
1965
  return this._http.request({
@@ -1772,12 +1971,20 @@ var CommerceClient = class {
1772
1971
  });
1773
1972
  }
1774
1973
  /**
1775
- * Verify Commerce State
1776
- *
1777
- * Perform fresh marketplace verification using the canonical services for every supported marketplace. For products provide productIds plus expected, or targets[{productId,expected}] for mixed values. For order and return operations provide their returned order_action/return_action correlations; product and fulfillment checks may share one request. Maximum 50000 entries per target array, with bounded concurrency. Catalog verification requires catalog:read; fulfillment verification requires orders:read; mixed batches require both. Session callers include organizationId. Missing, unauthorized, unsupported and unconfirmed targets fail explicitly. A return decision can be confirmed while later lifecycle steps remain pending. Labels confirm generated artifacts, not physical printing. Provider acc
1778
- *
1779
- * `POST /api/v1/commerce/state/verify`
1780
- */
1974
+ * Verify Commerce State
1975
+ *
1976
+ * Perform fresh marketplace verification using the canonical services for every supported marketplace.
1977
+
1978
+ ### Targets and access
1979
+
1980
+ For products provide productIds plus expected, or targets[{productId,expected}] for mixed values. For order, return and price-book operations provide their returned order_action/return_action/price_book_sync correlations; product and fulfillment checks may share one request. Maximum 50000 entries per target array, with bounded concurrency. Catalog verification requires catalog:read; fulfillment verification requires orders:read; mixed batches require both. Session callers include organizationId.
1981
+
1982
+ ### Verification results
1983
+
1984
+ Missing, unauthorized, unsupported and unconfirmed targets fail explicitly. A return decision can be confirmed while later lifecycle steps remain
1985
+ *
1986
+ * `POST /api/v1/commerce/state/verify`
1987
+ */
1781
1988
  verifyState(request, requestOptions) {
1782
1989
  const { ...body } = request ?? {};
1783
1990
  return this._http.request({
@@ -1858,16 +2065,16 @@ var DocumentsClient = class {
1858
2065
  /**
1859
2066
  * Get Document
1860
2067
  *
1861
- * Read one knowledge base document and its indexing status. Requires `documents:read`.
2068
+ * Read one knowledge base document and its indexing status. Requires `documents:read`. Set includeDownloadUrl=true for a private file URL valid for five minutes, suitable for SDK file downloads. URLs are scoped to the authenticated organization and are not returned for bank statements. Responses must not be cached.
1862
2069
  *
1863
2070
  * `GET /api/v1/documents/{documentId}`
1864
2071
  */
1865
2072
  get(request, requestOptions) {
1866
- const { documentId, organizationId } = request ?? {};
2073
+ const { documentId, organizationId, includeDownloadUrl } = request ?? {};
1867
2074
  return this._http.request({
1868
2075
  method: "GET",
1869
2076
  path: `/api/v1/documents/${encodePathParam("documentId", documentId)}`,
1870
- query: { organizationId },
2077
+ query: { organizationId, includeDownloadUrl },
1871
2078
  body: void 0,
1872
2079
  ...mergeRequestOptions(requestOptions)
1873
2080
  });
@@ -2779,11 +2986,14 @@ var ProductsClient = class {
2779
2986
  language,
2780
2987
  hasImage,
2781
2988
  stock,
2989
+ duplicateStatus,
2990
+ duplicateType,
2782
2991
  publishedFrom,
2783
2992
  publishedTo,
2784
2993
  publishedTimeZone,
2785
2994
  cursor,
2786
- includeSummary
2995
+ includeSummary,
2996
+ detail
2787
2997
  } = request ?? {};
2788
2998
  return this._http.request({
2789
2999
  method: "GET",
@@ -2806,11 +3016,14 @@ var ProductsClient = class {
2806
3016
  language,
2807
3017
  hasImage,
2808
3018
  stock,
3019
+ duplicateStatus,
3020
+ duplicateType,
2809
3021
  publishedFrom,
2810
3022
  publishedTo,
2811
3023
  publishedTimeZone,
2812
3024
  cursor,
2813
- includeSummary
3025
+ includeSummary,
3026
+ detail
2814
3027
  },
2815
3028
  body: void 0,
2816
3029
  ...mergeRequestOptions(requestOptions)
@@ -3231,6 +3444,8 @@ var ProductsClient = class {
3231
3444
  language,
3232
3445
  hasImage,
3233
3446
  stock,
3447
+ duplicateStatus,
3448
+ duplicateType,
3234
3449
  publishedFrom,
3235
3450
  publishedTo,
3236
3451
  publishedTimeZone
@@ -3253,6 +3468,8 @@ var ProductsClient = class {
3253
3468
  language,
3254
3469
  hasImage,
3255
3470
  stock,
3471
+ duplicateStatus,
3472
+ duplicateType,
3256
3473
  publishedFrom,
3257
3474
  publishedTo,
3258
3475
  publishedTimeZone
@@ -3264,7 +3481,7 @@ var ProductsClient = class {
3264
3481
  /**
3265
3482
  * Queue Product Enrichment
3266
3483
  *
3267
- * Requires catalog:enrich. Queue content enrichment for 1–1,000 existing Omni product IDs across all supported marketplaces. Returns 202 after queue submission without awaiting AI completion or publishing.
3484
+ * Requires catalog:enrich. Queue content enrichment for 1–1,000 existing Omni product IDs across all supported marketplaces. Returns 202 after queue submission without awaiting AI completion or publication.
3268
3485
 
3269
3486
  ### Enrichment options
3270
3487
 
@@ -3331,6 +3548,7 @@ var PromotionsClient = class {
3331
3548
  list(request = {}, requestOptions) {
3332
3549
  const {
3333
3550
  organizationId,
3551
+ campaign,
3334
3552
  q,
3335
3553
  status,
3336
3554
  marketplace,
@@ -3345,6 +3563,7 @@ var PromotionsClient = class {
3345
3563
  path: "/api/v1/promotions",
3346
3564
  query: {
3347
3565
  organizationId,
3566
+ campaign,
3348
3567
  q,
3349
3568
  status,
3350
3569
  marketplace,
@@ -3426,6 +3645,25 @@ var PromotionsClient = class {
3426
3645
  ...mergeRequestOptions(requestOptions)
3427
3646
  });
3428
3647
  }
3648
+ /**
3649
+ * Preview Promotion Prices
3650
+ *
3651
+ * Read canonical effective prices for up to 50 products, optionally scoped to an exact marketplace, store and country. Uses the same authoring permissions as the application's preview. Does not publish or change prices.
3652
+
3653
+ Requires promotions:write. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
3654
+ *
3655
+ * `POST /api/v1/promotions/{promotionId}/preview`
3656
+ */
3657
+ preview(request, requestOptions) {
3658
+ const { promotionId, ...body } = request ?? {};
3659
+ return this._http.request({
3660
+ method: "POST",
3661
+ path: `/api/v1/promotions/${encodePathParam("promotionId", promotionId)}/preview`,
3662
+ query: void 0,
3663
+ body,
3664
+ ...mergeRequestOptions(requestOptions)
3665
+ });
3666
+ }
3429
3667
  /**
3430
3668
  * Unassign Products from Promotion
3431
3669
  *
@@ -3463,7 +3701,7 @@ var PromotionsClient = class {
3463
3701
  /**
3464
3702
  * Assign Products to Promotion
3465
3703
  *
3466
- * Assign one or more products to a promotion. Creates pending marketplace sync rows; call sync after assign. Requires `promotions:write`.
3704
+ * Assign qualifying products and optional per-product discounts to a promotion. Active or scheduled promotions automatically queue durable marketplace delivery; drafts retain assignments for later publication. Requires `promotions:write` and current publish permission when publishing. Read promotion delivery to verify every target store.
3467
3705
  *
3468
3706
  * `POST /api/v1/promotions/{promotionId}/products`
3469
3707
  */
@@ -3496,6 +3734,158 @@ var PromotionsClient = class {
3496
3734
  ...mergeRequestOptions(requestOptions)
3497
3735
  });
3498
3736
  }
3737
+ /**
3738
+ * Create Promotions with Products
3739
+ *
3740
+ * Create 1–50 promotions using the shared flat promotion-write contract, with qualifying products and per-product discounts. Set promotion.status=draft explicitly when preparing drafts; otherwise the canonical creation flow activates promotions and requires publish permission. Saved IDs and delivery evidence are retained on partial delivery failure; retry those IDs rather than creating duplicates.
3741
+
3742
+ Requires promotions:write. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
3743
+ *
3744
+ * `POST /api/v1/promotions/batch`
3745
+ */
3746
+ createBatch(request, requestOptions) {
3747
+ const { ...body } = request ?? {};
3748
+ return this._http.request({
3749
+ method: "POST",
3750
+ path: "/api/v1/promotions/batch",
3751
+ query: void 0,
3752
+ body,
3753
+ ...mergeRequestOptions(requestOptions)
3754
+ });
3755
+ }
3756
+ /**
3757
+ * Find Promotion Campaigns
3758
+ *
3759
+ * Search campaign options with assigned promotions in the authenticated organization.
3760
+
3761
+ Requires promotions:read. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
3762
+ *
3763
+ * `GET /api/v1/promotions/campaign-options`
3764
+ */
3765
+ getCampaignOptions(request = {}, requestOptions) {
3766
+ const { organizationId, q } = request ?? {};
3767
+ return this._http.request({
3768
+ method: "GET",
3769
+ path: "/api/v1/promotions/campaign-options",
3770
+ query: { organizationId, q },
3771
+ body: void 0,
3772
+ ...mergeRequestOptions(requestOptions)
3773
+ });
3774
+ }
3775
+ /**
3776
+ * Get Promotion Marketplace Capabilities
3777
+ *
3778
+ * Report every canonical marketplace and promotion kind, including native, projected, browser-AOP and unsupported capabilities and voucher subtypes. WhatsApp's lack of promotion publishing is explicit.
3779
+
3780
+ Requires promotions:read. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
3781
+ *
3782
+ * `GET /api/v1/promotions/capabilities`
3783
+ */
3784
+ getCapabilities(request = {}, requestOptions) {
3785
+ const { organizationId } = request ?? {};
3786
+ return this._http.request({
3787
+ method: "GET",
3788
+ path: "/api/v1/promotions/capabilities",
3789
+ query: { organizationId },
3790
+ body: void 0,
3791
+ ...mergeRequestOptions(requestOptions)
3792
+ });
3793
+ }
3794
+ /**
3795
+ * Delete Promotions
3796
+ *
3797
+ * Delete 1–500 promotions with the canonical marketplace cleanup flow. Requires promotions.delete permission. Ordered per-target errors and partial failures remain explicit.
3798
+
3799
+ Requires promotions:write. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
3800
+ *
3801
+ * `POST /api/v1/promotions/delete`
3802
+ */
3803
+ deleteBatch(request, requestOptions) {
3804
+ const { ...body } = request ?? {};
3805
+ return this._http.request({
3806
+ method: "POST",
3807
+ path: "/api/v1/promotions/delete",
3808
+ query: void 0,
3809
+ body,
3810
+ ...mergeRequestOptions(requestOptions)
3811
+ });
3812
+ }
3813
+ /**
3814
+ * Read Promotion Delivery
3815
+ *
3816
+ * Read exact store/assignment delivery evidence for 1–50 promotions. A saved or active promotion is not proof that marketplace delivery succeeded. Check every returned deliveryStatuses entry, including explicit unsupported or unavailable states.
3817
+
3818
+ Requires promotions:read. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
3819
+ *
3820
+ * `POST /api/v1/promotions/delivery`
3821
+ */
3822
+ getDelivery(request, requestOptions) {
3823
+ const { ...body } = request ?? {};
3824
+ return this._http.request({
3825
+ method: "POST",
3826
+ path: "/api/v1/promotions/delivery",
3827
+ query: void 0,
3828
+ body,
3829
+ ...mergeRequestOptions(requestOptions)
3830
+ });
3831
+ }
3832
+ /**
3833
+ * Find Eligible Promotion Products
3834
+ *
3835
+ * Search or check up to 50 product IDs using canonical promotion assignment eligibility for the selected exact stores. Draft/unlisted products can be eligible for planning; live marketplace availability is rechecked during delivery.
3836
+
3837
+ Requires promotions:read. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
3838
+ *
3839
+ * `POST /api/v1/promotions/product-options`
3840
+ */
3841
+ getProductOptions(request, requestOptions) {
3842
+ const { ...body } = request ?? {};
3843
+ return this._http.request({
3844
+ method: "POST",
3845
+ path: "/api/v1/promotions/product-options",
3846
+ query: void 0,
3847
+ body,
3848
+ ...mergeRequestOptions(requestOptions)
3849
+ });
3850
+ }
3851
+ /**
3852
+ * Set Promotion Statuses
3853
+ *
3854
+ * Activate/publish, pause or archive 1–500 promotions. Activation requires promotions.publish permission. Uses the canonical status transition and durable marketplace sync/teardown flow; verify delivery separately.
3855
+
3856
+ Requires promotions:write. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
3857
+ *
3858
+ * `POST /api/v1/promotions/status`
3859
+ */
3860
+ setStatuses(request, requestOptions) {
3861
+ const { ...body } = request ?? {};
3862
+ return this._http.request({
3863
+ method: "POST",
3864
+ path: "/api/v1/promotions/status",
3865
+ query: void 0,
3866
+ body,
3867
+ ...mergeRequestOptions(requestOptions)
3868
+ });
3869
+ }
3870
+ /**
3871
+ * Validate Promotions
3872
+ *
3873
+ * Read-only validation of 1–50 saved promotion IDs or proposed definitions and product IDs. Reports marketplace terms, connected-store targeting and qualifying-product issues per target. Publishing still revalidates current state and can encounter marketplace API rejections.
3874
+
3875
+ Requires promotions:read. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
3876
+ *
3877
+ * `POST /api/v1/promotions/validate`
3878
+ */
3879
+ validate(request, requestOptions) {
3880
+ const { ...body } = request ?? {};
3881
+ return this._http.request({
3882
+ method: "POST",
3883
+ path: "/api/v1/promotions/validate",
3884
+ query: void 0,
3885
+ body,
3886
+ ...mergeRequestOptions(requestOptions)
3887
+ });
3888
+ }
3499
3889
  };
3500
3890
  var ReturnsClient = class {
3501
3891
  constructor(_http) {
@@ -3724,6 +4114,223 @@ var ReviewsClient = class {
3724
4114
  });
3725
4115
  }
3726
4116
  };
4117
+ var ScriptsClient = class {
4118
+ constructor(_http) {
4119
+ __publicField(this, "_http", _http);
4120
+ }
4121
+ /**
4122
+ * List Organization Scripts
4123
+ *
4124
+ * Discover custom Windmill scripts and their script__ tool names. Uses the same search and active/draft/archived filters as the app. Requires scripts:read. Default all excludes archived scripts; use status=archived to see archives.
4125
+ *
4126
+ * `GET /api/v1/scripts`
4127
+ */
4128
+ list(request = {}, requestOptions) {
4129
+ const { organizationId, q, status } = request ?? {};
4130
+ return this._http.request({
4131
+ method: "GET",
4132
+ path: "/api/v1/scripts",
4133
+ query: { organizationId, q, status },
4134
+ body: void 0,
4135
+ ...mergeRequestOptions(requestOptions)
4136
+ });
4137
+ }
4138
+ /**
4139
+ * Create Script
4140
+ *
4141
+ * Create an inactive TypeScript script. Optional source uses the canonical parser and 64 KiB UTF-8 limit; omitted source uses the starter. Requires scripts:write. Deploy explicitly before execution.
4142
+ *
4143
+ * `POST /api/v1/scripts`
4144
+ */
4145
+ create(request, requestOptions) {
4146
+ const { ...body } = request ?? {};
4147
+ return this._http.request({
4148
+ method: "POST",
4149
+ path: "/api/v1/scripts",
4150
+ query: void 0,
4151
+ body,
4152
+ ...mergeRequestOptions(requestOptions)
4153
+ });
4154
+ }
4155
+ /**
4156
+ * Archive Script
4157
+ *
4158
+ * Archive and deactivate an organization script, retaining version and run history. Requires scripts:write and the automations.delete capability for user credentials.
4159
+ *
4160
+ * `DELETE /api/v1/scripts/{scriptId}`
4161
+ */
4162
+ archive(request, requestOptions) {
4163
+ const { scriptId, organizationId } = request ?? {};
4164
+ return this._http.request({
4165
+ method: "DELETE",
4166
+ path: `/api/v1/scripts/${encodePathParam("scriptId", scriptId)}`,
4167
+ query: { organizationId },
4168
+ body: void 0,
4169
+ ...mergeRequestOptions(requestOptions)
4170
+ });
4171
+ }
4172
+ /**
4173
+ * Get Script
4174
+ *
4175
+ * Read script metadata, tool name, and all immutable versions with argument/output JSON schemas. Requires scripts:read. The activeVersionId identifies the current execution schema.
4176
+ *
4177
+ * `GET /api/v1/scripts/{scriptId}`
4178
+ */
4179
+ get(request, requestOptions) {
4180
+ const { scriptId, organizationId } = request ?? {};
4181
+ return this._http.request({
4182
+ method: "GET",
4183
+ path: `/api/v1/scripts/${encodePathParam("scriptId", scriptId)}`,
4184
+ query: { organizationId },
4185
+ body: void 0,
4186
+ ...mergeRequestOptions(requestOptions)
4187
+ });
4188
+ }
4189
+ /**
4190
+ * Update Script
4191
+ *
4192
+ * Update metadata, approval mode, or draft source. Saving source does not change the active immutable deployment. Requires scripts:write.
4193
+ *
4194
+ * `PATCH /api/v1/scripts/{scriptId}`
4195
+ */
4196
+ update(request, requestOptions) {
4197
+ const { scriptId, ...body } = request ?? {};
4198
+ return this._http.request({
4199
+ method: "PATCH",
4200
+ path: `/api/v1/scripts/${encodePathParam("scriptId", scriptId)}`,
4201
+ query: void 0,
4202
+ body,
4203
+ ...mergeRequestOptions(requestOptions)
4204
+ });
4205
+ }
4206
+ /**
4207
+ * Activate Script Version
4208
+ *
4209
+ * Switch to a previously accepted immutable version belonging to this script, including rollback. Draft/failed versions cannot be activated. Requires scripts:write.
4210
+ *
4211
+ * `POST /api/v1/scripts/{scriptId}/activate`
4212
+ */
4213
+ activate(request, requestOptions) {
4214
+ const { scriptId, ...body } = request ?? {};
4215
+ return this._http.request({
4216
+ method: "POST",
4217
+ path: `/api/v1/scripts/${encodePathParam("scriptId", scriptId)}/activate`,
4218
+ query: void 0,
4219
+ body,
4220
+ ...mergeRequestOptions(requestOptions)
4221
+ });
4222
+ }
4223
+ /**
4224
+ * Deploy Script
4225
+ *
4226
+ * Validate TypeScript source and create an immutable Windmill version. activate defaults to true. activate=false saves a draft version; it cannot execute until redeployed and accepted. Requires scripts:write. Does not enable the tool for agents automatically.
4227
+ *
4228
+ * `POST /api/v1/scripts/{scriptId}/deploy`
4229
+ */
4230
+ deploy(request, requestOptions) {
4231
+ const { scriptId, ...body } = request ?? {};
4232
+ return this._http.request({
4233
+ method: "POST",
4234
+ path: `/api/v1/scripts/${encodePathParam("scriptId", scriptId)}/deploy`,
4235
+ query: void 0,
4236
+ body,
4237
+ ...mergeRequestOptions(requestOptions)
4238
+ });
4239
+ }
4240
+ /**
4241
+ * List Script Runs
4242
+ *
4243
+ * Read recent runs and result/error references through the canonical run service. Requires scripts:read.
4244
+ *
4245
+ * `GET /api/v1/scripts/{scriptId}/runs`
4246
+ */
4247
+ listRuns(request, requestOptions) {
4248
+ const { scriptId, organizationId, limit } = request ?? {};
4249
+ return this._http.request({
4250
+ method: "GET",
4251
+ path: `/api/v1/scripts/${encodePathParam("scriptId", scriptId)}/runs`,
4252
+ query: { organizationId, limit },
4253
+ body: void 0,
4254
+ ...mergeRequestOptions(requestOptions)
4255
+ });
4256
+ }
4257
+ /**
4258
+ * Execute Script
4259
+ *
4260
+ * Submit a durable run of the active or explicitly pinned accepted version. Requires scripts:execute. Arguments must match its schema and fit 256 KiB.
4261
+
4262
+ Optional idempotencyKey identifies one invocation within this organization: reuse only for the same version and arguments.
4263
+
4264
+ HTTP 202 retains the run record and does not establish execution success; pass every run.id to scripts.awaitRuns and inspect resultRef/errorRef. Runs use immutable hashes and existing durable reconciliation.
4265
+ *
4266
+ * `POST /api/v1/scripts/{scriptId}/runs`
4267
+ */
4268
+ execute(request, requestOptions) {
4269
+ const { scriptId, ...body } = request ?? {};
4270
+ return this._http.request({
4271
+ method: "POST",
4272
+ path: `/api/v1/scripts/${encodePathParam("scriptId", scriptId)}/runs`,
4273
+ query: void 0,
4274
+ body,
4275
+ ...mergeRequestOptions(requestOptions)
4276
+ });
4277
+ }
4278
+ /**
4279
+ * Get Script Source
4280
+ *
4281
+ * Read current draft source from the organization's Windmill workspace. This may differ from the active version. Requires scripts:read.
4282
+ *
4283
+ * `GET /api/v1/scripts/{scriptId}/source`
4284
+ */
4285
+ getSource(request, requestOptions) {
4286
+ const { scriptId, organizationId } = request ?? {};
4287
+ return this._http.request({
4288
+ method: "GET",
4289
+ path: `/api/v1/scripts/${encodePathParam("scriptId", scriptId)}/source`,
4290
+ query: { organizationId },
4291
+ body: void 0,
4292
+ ...mergeRequestOptions(requestOptions)
4293
+ });
4294
+ }
4295
+ /**
4296
+ * Read Script Run Results
4297
+ *
4298
+ * Refresh 1–100 script run IDs in first-requested order, trimming and deduplicating IDs. Requires scripts:read.
4299
+
4300
+ This is a status snapshot and may return pending jobs; it never submits customer code again. success is true only when all requested runs succeeded. Results retain explicit per-target not_found/unavailable failures.
4301
+
4302
+ Use script run IDs with this endpoint; the generic developer jobs API does not resolve them.
4303
+ *
4304
+ * `POST /api/v1/scripts/jobs/await`
4305
+ */
4306
+ awaitRuns(request, requestOptions) {
4307
+ const { ...body } = request ?? {};
4308
+ return this._http.request({
4309
+ method: "POST",
4310
+ path: "/api/v1/scripts/jobs/await",
4311
+ query: void 0,
4312
+ body,
4313
+ ...mergeRequestOptions(requestOptions)
4314
+ });
4315
+ }
4316
+ /**
4317
+ * Cancel Script Runs
4318
+ *
4319
+ * Request cancellation for 1–100 run IDs, trimmed and deduplicated in first-requested order. Requires scripts:execute. Check each requested/confirmed/status; request acceptance does not confirm cancellation or roll back prior side effects. success requires every cancellation to be confirmed.
4320
+ *
4321
+ * `POST /api/v1/scripts/jobs/cancel`
4322
+ */
4323
+ cancelRuns(request, requestOptions) {
4324
+ const { ...body } = request ?? {};
4325
+ return this._http.request({
4326
+ method: "POST",
4327
+ path: "/api/v1/scripts/jobs/cancel",
4328
+ query: void 0,
4329
+ body,
4330
+ ...mergeRequestOptions(requestOptions)
4331
+ });
4332
+ }
4333
+ };
3727
4334
  var SearchClient = class {
3728
4335
  constructor(_http) {
3729
4336
  __publicField(this, "_http", _http);
@@ -4263,6 +4870,7 @@ var OmniGeneratedClient = class {
4263
4870
  __publicField(this, "promotions");
4264
4871
  __publicField(this, "returns");
4265
4872
  __publicField(this, "reviews");
4873
+ __publicField(this, "scripts");
4266
4874
  __publicField(this, "search");
4267
4875
  __publicField(this, "settlements");
4268
4876
  __publicField(this, "sync");
@@ -4302,6 +4910,7 @@ var OmniGeneratedClient = class {
4302
4910
  this.promotions = new PromotionsClient(this._http);
4303
4911
  this.returns = new ReturnsClient(this._http);
4304
4912
  this.reviews = new ReviewsClient(this._http);
4913
+ this.scripts = new ScriptsClient(this._http);
4305
4914
  this.search = new SearchClient(this._http);
4306
4915
  this.settlements = new SettlementsClient(this._http);
4307
4916
  this.sync = new SyncClient(this._http);