@omni-commerce/sdk 0.18.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.cjs CHANGED
@@ -35,12 +35,12 @@ function normalizeClientOptions(options = {}) {
35
35
  }
36
36
 
37
37
  // src/version.ts
38
- var SDK_VERSION = "0.18.0";
38
+ var SDK_VERSION = "0.20.0";
39
39
  var SDK_USER_AGENT = `omnicommerce-js/${SDK_VERSION}`;
40
40
 
41
41
  // src/environments.ts
42
42
  var OmniEnvironment = {
43
- Production: "https://omnicommerce.sg",
43
+ Production: "https://omnicommerce.ai",
44
44
  Local: "http://localhost:3000"
45
45
  };
46
46
 
@@ -1492,11 +1492,31 @@ var CampaignsClient = class {
1492
1492
  * `GET /api/v1/campaigns`
1493
1493
  */
1494
1494
  list(request = {}, requestOptions) {
1495
- const { organizationId, q, stage, offset, limit, sortBy, sortDir } = request ?? {};
1495
+ const {
1496
+ organizationId,
1497
+ q,
1498
+ marketplace,
1499
+ store,
1500
+ stage,
1501
+ offset,
1502
+ limit,
1503
+ sortBy,
1504
+ sortDir
1505
+ } = request ?? {};
1496
1506
  return this._http.request({
1497
1507
  method: "GET",
1498
1508
  path: "/api/v1/campaigns",
1499
- query: { organizationId, q, stage, offset, limit, sortBy, sortDir },
1509
+ query: {
1510
+ organizationId,
1511
+ q,
1512
+ marketplace,
1513
+ store,
1514
+ stage,
1515
+ offset,
1516
+ limit,
1517
+ sortBy,
1518
+ sortDir
1519
+ },
1500
1520
  body: void 0,
1501
1521
  ...mergeRequestOptions(requestOptions)
1502
1522
  });
@@ -1535,6 +1555,25 @@ var CampaignsClient = class {
1535
1555
  ...mergeRequestOptions(requestOptions)
1536
1556
  });
1537
1557
  }
1558
+ /**
1559
+ * Change Campaign Details
1560
+ *
1561
+ * 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.
1562
+
1563
+ 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.
1564
+ *
1565
+ * `PATCH /api/v1/campaigns/{campaignId}`
1566
+ */
1567
+ update(request, requestOptions) {
1568
+ const { campaignId, ...body } = request ?? {};
1569
+ return this._http.request({
1570
+ method: "PATCH",
1571
+ path: `/api/v1/campaigns/${encodePathParam("campaignId", campaignId)}`,
1572
+ query: void 0,
1573
+ body,
1574
+ ...mergeRequestOptions(requestOptions)
1575
+ });
1576
+ }
1538
1577
  /**
1539
1578
  * Update Campaign
1540
1579
  *
@@ -1569,6 +1608,101 @@ var CampaignsClient = class {
1569
1608
  ...mergeRequestOptions(requestOptions)
1570
1609
  });
1571
1610
  }
1611
+ /**
1612
+ * Get Campaign Analytics
1613
+ *
1614
+ * 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.
1615
+
1616
+ Requires promotions:read. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
1617
+ *
1618
+ * `GET /api/v1/campaigns/{campaignId}/analytics`
1619
+ */
1620
+ getAnalytics(request, requestOptions) {
1621
+ const { campaignId, organizationId, analyticsWindow } = request ?? {};
1622
+ return this._http.request({
1623
+ method: "GET",
1624
+ path: `/api/v1/campaigns/${encodePathParam("campaignId", campaignId)}/analytics`,
1625
+ query: { organizationId, analyticsWindow },
1626
+ body: void 0,
1627
+ ...mergeRequestOptions(requestOptions)
1628
+ });
1629
+ }
1630
+ /**
1631
+ * Get Campaign Notifications
1632
+ *
1633
+ * Read the executing actor's campaign notification preference.
1634
+
1635
+ Requires promotions:read. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
1636
+ *
1637
+ * `GET /api/v1/campaigns/{campaignId}/notifications`
1638
+ */
1639
+ getNotifications(request, requestOptions) {
1640
+ const { campaignId, organizationId } = request ?? {};
1641
+ return this._http.request({
1642
+ method: "GET",
1643
+ path: `/api/v1/campaigns/${encodePathParam("campaignId", campaignId)}/notifications`,
1644
+ query: { organizationId },
1645
+ body: void 0,
1646
+ ...mergeRequestOptions(requestOptions)
1647
+ });
1648
+ }
1649
+ /**
1650
+ * Set Campaign Notifications
1651
+ *
1652
+ * Set only the executing actor's campaign notification preference. Does not change campaign delivery or other members' preferences.
1653
+
1654
+ Requires promotions:read. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
1655
+ *
1656
+ * `PUT /api/v1/campaigns/{campaignId}/notifications`
1657
+ */
1658
+ setNotifications(request, requestOptions) {
1659
+ const { campaignId, ...body } = request ?? {};
1660
+ return this._http.request({
1661
+ method: "PUT",
1662
+ path: `/api/v1/campaigns/${encodePathParam("campaignId", campaignId)}/notifications`,
1663
+ query: void 0,
1664
+ body,
1665
+ ...mergeRequestOptions(requestOptions)
1666
+ });
1667
+ }
1668
+ /**
1669
+ * List Campaign Offers
1670
+ *
1671
+ * Filter and page the canonical campaign plan or pending live proposal, with the same attention rules as the campaign editor.
1672
+
1673
+ Requires promotions:read. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
1674
+ *
1675
+ * `GET /api/v1/campaigns/{campaignId}/offers`
1676
+ */
1677
+ listOffers(request, requestOptions) {
1678
+ const { campaignId, kind, window, review, offset, limit, organizationId } = request ?? {};
1679
+ return this._http.request({
1680
+ method: "GET",
1681
+ path: `/api/v1/campaigns/${encodePathParam("campaignId", campaignId)}/offers`,
1682
+ query: { kind, window, review, offset, limit, organizationId },
1683
+ body: void 0,
1684
+ ...mergeRequestOptions(requestOptions)
1685
+ });
1686
+ }
1687
+ /**
1688
+ * Act on Campaigns
1689
+ *
1690
+ * 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.
1691
+
1692
+ Requires promotions:write. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
1693
+ *
1694
+ * `POST /api/v1/campaigns/actions`
1695
+ */
1696
+ actBatch(request, requestOptions) {
1697
+ const { ...body } = request ?? {};
1698
+ return this._http.request({
1699
+ method: "POST",
1700
+ path: "/api/v1/campaigns/actions",
1701
+ query: void 0,
1702
+ body,
1703
+ ...mergeRequestOptions(requestOptions)
1704
+ });
1705
+ }
1572
1706
  /**
1573
1707
  * Archive Campaigns
1574
1708
  *
@@ -1603,6 +1737,25 @@ var CampaignsClient = class {
1603
1737
  ...mergeRequestOptions(requestOptions)
1604
1738
  });
1605
1739
  }
1740
+ /**
1741
+ * Import Campaign Workbooks
1742
+ *
1743
+ * 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.
1744
+
1745
+ Requires promotions:write. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
1746
+ *
1747
+ * `POST /api/v1/campaigns/import`
1748
+ */
1749
+ importBriefs(request, requestOptions) {
1750
+ const { ...body } = request ?? {};
1751
+ return this._http.request({
1752
+ method: "POST",
1753
+ path: "/api/v1/campaigns/import",
1754
+ query: void 0,
1755
+ body,
1756
+ ...mergeRequestOptions(requestOptions)
1757
+ });
1758
+ }
1606
1759
  /**
1607
1760
  * Get Campaign Options
1608
1761
  *
@@ -1620,6 +1773,44 @@ var CampaignsClient = class {
1620
1773
  ...mergeRequestOptions(requestOptions)
1621
1774
  });
1622
1775
  }
1776
+ /**
1777
+ * Resolve Campaign Promotion Selection
1778
+ *
1779
+ * Read 1–50 eligible draft promotions as campaign offers without creating or publishing promotions. Exact organization/store ownership and existing campaign links are checked.
1780
+
1781
+ Requires promotions:write. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
1782
+ *
1783
+ * `POST /api/v1/campaigns/promotion-options`
1784
+ */
1785
+ resolvePromotionOptions(request, requestOptions) {
1786
+ const { ...body } = request ?? {};
1787
+ return this._http.request({
1788
+ method: "POST",
1789
+ path: "/api/v1/campaigns/promotion-options",
1790
+ query: void 0,
1791
+ body,
1792
+ ...mergeRequestOptions(requestOptions)
1793
+ });
1794
+ }
1795
+ /**
1796
+ * Validate Campaigns
1797
+ *
1798
+ * 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.
1799
+
1800
+ Requires promotions:read. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
1801
+ *
1802
+ * `POST /api/v1/campaigns/validate`
1803
+ */
1804
+ validate(request, requestOptions) {
1805
+ const { ...body } = request ?? {};
1806
+ return this._http.request({
1807
+ method: "POST",
1808
+ path: "/api/v1/campaigns/validate",
1809
+ query: void 0,
1810
+ body,
1811
+ ...mergeRequestOptions(requestOptions)
1812
+ });
1813
+ }
1623
1814
  };
1624
1815
  var CatalogClient = class {
1625
1816
  constructor(_http) {
@@ -1752,6 +1943,61 @@ var CheckoutSessionsClient = class {
1752
1943
  });
1753
1944
  }
1754
1945
  };
1946
+ var CommerceClient = class {
1947
+ constructor(_http) {
1948
+ __publicField(this, "_http", _http);
1949
+ }
1950
+ /**
1951
+ * Await Commerce Jobs
1952
+ *
1953
+ * 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.
1954
+
1955
+ ### Request limits and access
1956
+
1957
+ 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.
1958
+
1959
+ ### Result interpretation
1960
+
1961
+ 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
1962
+ *
1963
+ * `POST /api/v1/commerce/jobs/await`
1964
+ */
1965
+ awaitJobs(request, requestOptions) {
1966
+ const { ...body } = request ?? {};
1967
+ return this._http.request({
1968
+ method: "POST",
1969
+ path: "/api/v1/commerce/jobs/await",
1970
+ query: void 0,
1971
+ body,
1972
+ ...mergeRequestOptions(requestOptions)
1973
+ });
1974
+ }
1975
+ /**
1976
+ * Verify Commerce State
1977
+ *
1978
+ * Perform fresh marketplace verification using the canonical services for every supported marketplace.
1979
+
1980
+ ### Targets and access
1981
+
1982
+ 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.
1983
+
1984
+ ### Verification results
1985
+
1986
+ Missing, unauthorized, unsupported and unconfirmed targets fail explicitly. A return decision can be confirmed while later lifecycle steps remain
1987
+ *
1988
+ * `POST /api/v1/commerce/state/verify`
1989
+ */
1990
+ verifyState(request, requestOptions) {
1991
+ const { ...body } = request ?? {};
1992
+ return this._http.request({
1993
+ method: "POST",
1994
+ path: "/api/v1/commerce/state/verify",
1995
+ query: void 0,
1996
+ body,
1997
+ ...mergeRequestOptions(requestOptions)
1998
+ });
1999
+ }
2000
+ };
1755
2001
  var CompareClient = class {
1756
2002
  constructor(_http) {
1757
2003
  __publicField(this, "_http", _http);
@@ -1821,16 +2067,16 @@ var DocumentsClient = class {
1821
2067
  /**
1822
2068
  * Get Document
1823
2069
  *
1824
- * Read one knowledge base document and its indexing status. Requires `documents:read`.
2070
+ * 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.
1825
2071
  *
1826
2072
  * `GET /api/v1/documents/{documentId}`
1827
2073
  */
1828
2074
  get(request, requestOptions) {
1829
- const { documentId, organizationId } = request ?? {};
2075
+ const { documentId, organizationId, includeDownloadUrl } = request ?? {};
1830
2076
  return this._http.request({
1831
2077
  method: "GET",
1832
2078
  path: `/api/v1/documents/${encodePathParam("documentId", documentId)}`,
1833
- query: { organizationId },
2079
+ query: { organizationId, includeDownloadUrl },
1834
2080
  body: void 0,
1835
2081
  ...mergeRequestOptions(requestOptions)
1836
2082
  });
@@ -2742,11 +2988,14 @@ var ProductsClient = class {
2742
2988
  language,
2743
2989
  hasImage,
2744
2990
  stock,
2991
+ duplicateStatus,
2992
+ duplicateType,
2745
2993
  publishedFrom,
2746
2994
  publishedTo,
2747
2995
  publishedTimeZone,
2748
2996
  cursor,
2749
- includeSummary
2997
+ includeSummary,
2998
+ detail
2750
2999
  } = request ?? {};
2751
3000
  return this._http.request({
2752
3001
  method: "GET",
@@ -2769,11 +3018,14 @@ var ProductsClient = class {
2769
3018
  language,
2770
3019
  hasImage,
2771
3020
  stock,
3021
+ duplicateStatus,
3022
+ duplicateType,
2772
3023
  publishedFrom,
2773
3024
  publishedTo,
2774
3025
  publishedTimeZone,
2775
3026
  cursor,
2776
- includeSummary
3027
+ includeSummary,
3028
+ detail
2777
3029
  },
2778
3030
  body: void 0,
2779
3031
  ...mergeRequestOptions(requestOptions)
@@ -3194,6 +3446,8 @@ var ProductsClient = class {
3194
3446
  language,
3195
3447
  hasImage,
3196
3448
  stock,
3449
+ duplicateStatus,
3450
+ duplicateType,
3197
3451
  publishedFrom,
3198
3452
  publishedTo,
3199
3453
  publishedTimeZone
@@ -3216,6 +3470,8 @@ var ProductsClient = class {
3216
3470
  language,
3217
3471
  hasImage,
3218
3472
  stock,
3473
+ duplicateStatus,
3474
+ duplicateType,
3219
3475
  publishedFrom,
3220
3476
  publishedTo,
3221
3477
  publishedTimeZone
@@ -3227,7 +3483,7 @@ var ProductsClient = class {
3227
3483
  /**
3228
3484
  * Queue Product Enrichment
3229
3485
  *
3230
- * 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.
3486
+ * 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.
3231
3487
 
3232
3488
  ### Enrichment options
3233
3489
 
@@ -3294,6 +3550,7 @@ var PromotionsClient = class {
3294
3550
  list(request = {}, requestOptions) {
3295
3551
  const {
3296
3552
  organizationId,
3553
+ campaign,
3297
3554
  q,
3298
3555
  status,
3299
3556
  marketplace,
@@ -3308,6 +3565,7 @@ var PromotionsClient = class {
3308
3565
  path: "/api/v1/promotions",
3309
3566
  query: {
3310
3567
  organizationId,
3568
+ campaign,
3311
3569
  q,
3312
3570
  status,
3313
3571
  marketplace,
@@ -3389,6 +3647,25 @@ var PromotionsClient = class {
3389
3647
  ...mergeRequestOptions(requestOptions)
3390
3648
  });
3391
3649
  }
3650
+ /**
3651
+ * Preview Promotion Prices
3652
+ *
3653
+ * 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.
3654
+
3655
+ Requires promotions:write. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
3656
+ *
3657
+ * `POST /api/v1/promotions/{promotionId}/preview`
3658
+ */
3659
+ preview(request, requestOptions) {
3660
+ const { promotionId, ...body } = request ?? {};
3661
+ return this._http.request({
3662
+ method: "POST",
3663
+ path: `/api/v1/promotions/${encodePathParam("promotionId", promotionId)}/preview`,
3664
+ query: void 0,
3665
+ body,
3666
+ ...mergeRequestOptions(requestOptions)
3667
+ });
3668
+ }
3392
3669
  /**
3393
3670
  * Unassign Products from Promotion
3394
3671
  *
@@ -3426,7 +3703,7 @@ var PromotionsClient = class {
3426
3703
  /**
3427
3704
  * Assign Products to Promotion
3428
3705
  *
3429
- * Assign one or more products to a promotion. Creates pending marketplace sync rows; call sync after assign. Requires `promotions:write`.
3706
+ * 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.
3430
3707
  *
3431
3708
  * `POST /api/v1/promotions/{promotionId}/products`
3432
3709
  */
@@ -3459,6 +3736,158 @@ var PromotionsClient = class {
3459
3736
  ...mergeRequestOptions(requestOptions)
3460
3737
  });
3461
3738
  }
3739
+ /**
3740
+ * Create Promotions with Products
3741
+ *
3742
+ * 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.
3743
+
3744
+ Requires promotions:write. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
3745
+ *
3746
+ * `POST /api/v1/promotions/batch`
3747
+ */
3748
+ createBatch(request, requestOptions) {
3749
+ const { ...body } = request ?? {};
3750
+ return this._http.request({
3751
+ method: "POST",
3752
+ path: "/api/v1/promotions/batch",
3753
+ query: void 0,
3754
+ body,
3755
+ ...mergeRequestOptions(requestOptions)
3756
+ });
3757
+ }
3758
+ /**
3759
+ * Find Promotion Campaigns
3760
+ *
3761
+ * Search campaign options with assigned promotions in the authenticated organization.
3762
+
3763
+ Requires promotions:read. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
3764
+ *
3765
+ * `GET /api/v1/promotions/campaign-options`
3766
+ */
3767
+ getCampaignOptions(request = {}, requestOptions) {
3768
+ const { organizationId, q } = request ?? {};
3769
+ return this._http.request({
3770
+ method: "GET",
3771
+ path: "/api/v1/promotions/campaign-options",
3772
+ query: { organizationId, q },
3773
+ body: void 0,
3774
+ ...mergeRequestOptions(requestOptions)
3775
+ });
3776
+ }
3777
+ /**
3778
+ * Get Promotion Marketplace Capabilities
3779
+ *
3780
+ * 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.
3781
+
3782
+ Requires promotions:read. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
3783
+ *
3784
+ * `GET /api/v1/promotions/capabilities`
3785
+ */
3786
+ getCapabilities(request = {}, requestOptions) {
3787
+ const { organizationId } = request ?? {};
3788
+ return this._http.request({
3789
+ method: "GET",
3790
+ path: "/api/v1/promotions/capabilities",
3791
+ query: { organizationId },
3792
+ body: void 0,
3793
+ ...mergeRequestOptions(requestOptions)
3794
+ });
3795
+ }
3796
+ /**
3797
+ * Delete Promotions
3798
+ *
3799
+ * Delete 1–500 promotions with the canonical marketplace cleanup flow. Requires promotions.delete permission. Ordered per-target errors and partial failures remain explicit.
3800
+
3801
+ Requires promotions:write. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
3802
+ *
3803
+ * `POST /api/v1/promotions/delete`
3804
+ */
3805
+ deleteBatch(request, requestOptions) {
3806
+ const { ...body } = request ?? {};
3807
+ return this._http.request({
3808
+ method: "POST",
3809
+ path: "/api/v1/promotions/delete",
3810
+ query: void 0,
3811
+ body,
3812
+ ...mergeRequestOptions(requestOptions)
3813
+ });
3814
+ }
3815
+ /**
3816
+ * Read Promotion Delivery
3817
+ *
3818
+ * 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.
3819
+
3820
+ Requires promotions:read. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
3821
+ *
3822
+ * `POST /api/v1/promotions/delivery`
3823
+ */
3824
+ getDelivery(request, requestOptions) {
3825
+ const { ...body } = request ?? {};
3826
+ return this._http.request({
3827
+ method: "POST",
3828
+ path: "/api/v1/promotions/delivery",
3829
+ query: void 0,
3830
+ body,
3831
+ ...mergeRequestOptions(requestOptions)
3832
+ });
3833
+ }
3834
+ /**
3835
+ * Find Eligible Promotion Products
3836
+ *
3837
+ * 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.
3838
+
3839
+ Requires promotions:read. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
3840
+ *
3841
+ * `POST /api/v1/promotions/product-options`
3842
+ */
3843
+ getProductOptions(request, requestOptions) {
3844
+ const { ...body } = request ?? {};
3845
+ return this._http.request({
3846
+ method: "POST",
3847
+ path: "/api/v1/promotions/product-options",
3848
+ query: void 0,
3849
+ body,
3850
+ ...mergeRequestOptions(requestOptions)
3851
+ });
3852
+ }
3853
+ /**
3854
+ * Set Promotion Statuses
3855
+ *
3856
+ * 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.
3857
+
3858
+ Requires promotions:write. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
3859
+ *
3860
+ * `POST /api/v1/promotions/status`
3861
+ */
3862
+ setStatuses(request, requestOptions) {
3863
+ const { ...body } = request ?? {};
3864
+ return this._http.request({
3865
+ method: "POST",
3866
+ path: "/api/v1/promotions/status",
3867
+ query: void 0,
3868
+ body,
3869
+ ...mergeRequestOptions(requestOptions)
3870
+ });
3871
+ }
3872
+ /**
3873
+ * Validate Promotions
3874
+ *
3875
+ * 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.
3876
+
3877
+ Requires promotions:read. API keys and delegated Computer credentials resolve organization scope without browser cookies; optional organizationId must match that scope.
3878
+ *
3879
+ * `POST /api/v1/promotions/validate`
3880
+ */
3881
+ validate(request, requestOptions) {
3882
+ const { ...body } = request ?? {};
3883
+ return this._http.request({
3884
+ method: "POST",
3885
+ path: "/api/v1/promotions/validate",
3886
+ query: void 0,
3887
+ body,
3888
+ ...mergeRequestOptions(requestOptions)
3889
+ });
3890
+ }
3462
3891
  };
3463
3892
  var ReturnsClient = class {
3464
3893
  constructor(_http) {
@@ -3687,6 +4116,223 @@ var ReviewsClient = class {
3687
4116
  });
3688
4117
  }
3689
4118
  };
4119
+ var ScriptsClient = class {
4120
+ constructor(_http) {
4121
+ __publicField(this, "_http", _http);
4122
+ }
4123
+ /**
4124
+ * List Organization Scripts
4125
+ *
4126
+ * 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.
4127
+ *
4128
+ * `GET /api/v1/scripts`
4129
+ */
4130
+ list(request = {}, requestOptions) {
4131
+ const { organizationId, q, status } = request ?? {};
4132
+ return this._http.request({
4133
+ method: "GET",
4134
+ path: "/api/v1/scripts",
4135
+ query: { organizationId, q, status },
4136
+ body: void 0,
4137
+ ...mergeRequestOptions(requestOptions)
4138
+ });
4139
+ }
4140
+ /**
4141
+ * Create Script
4142
+ *
4143
+ * 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.
4144
+ *
4145
+ * `POST /api/v1/scripts`
4146
+ */
4147
+ create(request, requestOptions) {
4148
+ const { ...body } = request ?? {};
4149
+ return this._http.request({
4150
+ method: "POST",
4151
+ path: "/api/v1/scripts",
4152
+ query: void 0,
4153
+ body,
4154
+ ...mergeRequestOptions(requestOptions)
4155
+ });
4156
+ }
4157
+ /**
4158
+ * Archive Script
4159
+ *
4160
+ * Archive and deactivate an organization script, retaining version and run history. Requires scripts:write and the automations.delete capability for user credentials.
4161
+ *
4162
+ * `DELETE /api/v1/scripts/{scriptId}`
4163
+ */
4164
+ archive(request, requestOptions) {
4165
+ const { scriptId, organizationId } = request ?? {};
4166
+ return this._http.request({
4167
+ method: "DELETE",
4168
+ path: `/api/v1/scripts/${encodePathParam("scriptId", scriptId)}`,
4169
+ query: { organizationId },
4170
+ body: void 0,
4171
+ ...mergeRequestOptions(requestOptions)
4172
+ });
4173
+ }
4174
+ /**
4175
+ * Get Script
4176
+ *
4177
+ * Read script metadata, tool name, and all immutable versions with argument/output JSON schemas. Requires scripts:read. The activeVersionId identifies the current execution schema.
4178
+ *
4179
+ * `GET /api/v1/scripts/{scriptId}`
4180
+ */
4181
+ get(request, requestOptions) {
4182
+ const { scriptId, organizationId } = request ?? {};
4183
+ return this._http.request({
4184
+ method: "GET",
4185
+ path: `/api/v1/scripts/${encodePathParam("scriptId", scriptId)}`,
4186
+ query: { organizationId },
4187
+ body: void 0,
4188
+ ...mergeRequestOptions(requestOptions)
4189
+ });
4190
+ }
4191
+ /**
4192
+ * Update Script
4193
+ *
4194
+ * Update metadata, approval mode, or draft source. Saving source does not change the active immutable deployment. Requires scripts:write.
4195
+ *
4196
+ * `PATCH /api/v1/scripts/{scriptId}`
4197
+ */
4198
+ update(request, requestOptions) {
4199
+ const { scriptId, ...body } = request ?? {};
4200
+ return this._http.request({
4201
+ method: "PATCH",
4202
+ path: `/api/v1/scripts/${encodePathParam("scriptId", scriptId)}`,
4203
+ query: void 0,
4204
+ body,
4205
+ ...mergeRequestOptions(requestOptions)
4206
+ });
4207
+ }
4208
+ /**
4209
+ * Activate Script Version
4210
+ *
4211
+ * Switch to a previously accepted immutable version belonging to this script, including rollback. Draft/failed versions cannot be activated. Requires scripts:write.
4212
+ *
4213
+ * `POST /api/v1/scripts/{scriptId}/activate`
4214
+ */
4215
+ activate(request, requestOptions) {
4216
+ const { scriptId, ...body } = request ?? {};
4217
+ return this._http.request({
4218
+ method: "POST",
4219
+ path: `/api/v1/scripts/${encodePathParam("scriptId", scriptId)}/activate`,
4220
+ query: void 0,
4221
+ body,
4222
+ ...mergeRequestOptions(requestOptions)
4223
+ });
4224
+ }
4225
+ /**
4226
+ * Deploy Script
4227
+ *
4228
+ * 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.
4229
+ *
4230
+ * `POST /api/v1/scripts/{scriptId}/deploy`
4231
+ */
4232
+ deploy(request, requestOptions) {
4233
+ const { scriptId, ...body } = request ?? {};
4234
+ return this._http.request({
4235
+ method: "POST",
4236
+ path: `/api/v1/scripts/${encodePathParam("scriptId", scriptId)}/deploy`,
4237
+ query: void 0,
4238
+ body,
4239
+ ...mergeRequestOptions(requestOptions)
4240
+ });
4241
+ }
4242
+ /**
4243
+ * List Script Runs
4244
+ *
4245
+ * Read recent runs and result/error references through the canonical run service. Requires scripts:read.
4246
+ *
4247
+ * `GET /api/v1/scripts/{scriptId}/runs`
4248
+ */
4249
+ listRuns(request, requestOptions) {
4250
+ const { scriptId, organizationId, limit } = request ?? {};
4251
+ return this._http.request({
4252
+ method: "GET",
4253
+ path: `/api/v1/scripts/${encodePathParam("scriptId", scriptId)}/runs`,
4254
+ query: { organizationId, limit },
4255
+ body: void 0,
4256
+ ...mergeRequestOptions(requestOptions)
4257
+ });
4258
+ }
4259
+ /**
4260
+ * Execute Script
4261
+ *
4262
+ * Submit a durable run of the active or explicitly pinned accepted version. Requires scripts:execute. Arguments must match its schema and fit 256 KiB.
4263
+
4264
+ Optional idempotencyKey identifies one invocation within this organization: reuse only for the same version and arguments.
4265
+
4266
+ 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.
4267
+ *
4268
+ * `POST /api/v1/scripts/{scriptId}/runs`
4269
+ */
4270
+ execute(request, requestOptions) {
4271
+ const { scriptId, ...body } = request ?? {};
4272
+ return this._http.request({
4273
+ method: "POST",
4274
+ path: `/api/v1/scripts/${encodePathParam("scriptId", scriptId)}/runs`,
4275
+ query: void 0,
4276
+ body,
4277
+ ...mergeRequestOptions(requestOptions)
4278
+ });
4279
+ }
4280
+ /**
4281
+ * Get Script Source
4282
+ *
4283
+ * Read current draft source from the organization's Windmill workspace. This may differ from the active version. Requires scripts:read.
4284
+ *
4285
+ * `GET /api/v1/scripts/{scriptId}/source`
4286
+ */
4287
+ getSource(request, requestOptions) {
4288
+ const { scriptId, organizationId } = request ?? {};
4289
+ return this._http.request({
4290
+ method: "GET",
4291
+ path: `/api/v1/scripts/${encodePathParam("scriptId", scriptId)}/source`,
4292
+ query: { organizationId },
4293
+ body: void 0,
4294
+ ...mergeRequestOptions(requestOptions)
4295
+ });
4296
+ }
4297
+ /**
4298
+ * Read Script Run Results
4299
+ *
4300
+ * Refresh 1–100 script run IDs in first-requested order, trimming and deduplicating IDs. Requires scripts:read.
4301
+
4302
+ 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.
4303
+
4304
+ Use script run IDs with this endpoint; the generic developer jobs API does not resolve them.
4305
+ *
4306
+ * `POST /api/v1/scripts/jobs/await`
4307
+ */
4308
+ awaitRuns(request, requestOptions) {
4309
+ const { ...body } = request ?? {};
4310
+ return this._http.request({
4311
+ method: "POST",
4312
+ path: "/api/v1/scripts/jobs/await",
4313
+ query: void 0,
4314
+ body,
4315
+ ...mergeRequestOptions(requestOptions)
4316
+ });
4317
+ }
4318
+ /**
4319
+ * Cancel Script Runs
4320
+ *
4321
+ * 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.
4322
+ *
4323
+ * `POST /api/v1/scripts/jobs/cancel`
4324
+ */
4325
+ cancelRuns(request, requestOptions) {
4326
+ const { ...body } = request ?? {};
4327
+ return this._http.request({
4328
+ method: "POST",
4329
+ path: "/api/v1/scripts/jobs/cancel",
4330
+ query: void 0,
4331
+ body,
4332
+ ...mergeRequestOptions(requestOptions)
4333
+ });
4334
+ }
4335
+ };
3690
4336
  var SearchClient = class {
3691
4337
  constructor(_http) {
3692
4338
  __publicField(this, "_http", _http);
@@ -4204,6 +4850,7 @@ var OmniGeneratedClient = class {
4204
4850
  __publicField(this, "campaigns");
4205
4851
  __publicField(this, "catalog");
4206
4852
  __publicField(this, "checkoutSessions");
4853
+ __publicField(this, "commerce");
4207
4854
  __publicField(this, "compare");
4208
4855
  __publicField(this, "directory");
4209
4856
  __publicField(this, "documents");
@@ -4225,6 +4872,7 @@ var OmniGeneratedClient = class {
4225
4872
  __publicField(this, "promotions");
4226
4873
  __publicField(this, "returns");
4227
4874
  __publicField(this, "reviews");
4875
+ __publicField(this, "scripts");
4228
4876
  __publicField(this, "search");
4229
4877
  __publicField(this, "settlements");
4230
4878
  __publicField(this, "sync");
@@ -4242,6 +4890,7 @@ var OmniGeneratedClient = class {
4242
4890
  this.campaigns = new CampaignsClient(this._http);
4243
4891
  this.catalog = new CatalogClient(this._http);
4244
4892
  this.checkoutSessions = new CheckoutSessionsClient(this._http);
4893
+ this.commerce = new CommerceClient(this._http);
4245
4894
  this.compare = new CompareClient(this._http);
4246
4895
  this.directory = new DirectoryClient(this._http);
4247
4896
  this.documents = new DocumentsClient(this._http);
@@ -4263,6 +4912,7 @@ var OmniGeneratedClient = class {
4263
4912
  this.promotions = new PromotionsClient(this._http);
4264
4913
  this.returns = new ReturnsClient(this._http);
4265
4914
  this.reviews = new ReviewsClient(this._http);
4915
+ this.scripts = new ScriptsClient(this._http);
4266
4916
  this.search = new SearchClient(this._http);
4267
4917
  this.settlements = new SettlementsClient(this._http);
4268
4918
  this.sync = new SyncClient(this._http);