@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.cjs CHANGED
@@ -35,12 +35,12 @@ function normalizeClientOptions(options = {}) {
35
35
  }
36
36
 
37
37
  // src/version.ts
38
- var SDK_VERSION = "0.19.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) {
@@ -1757,12 +1948,20 @@ var CommerceClient = class {
1757
1948
  __publicField(this, "_http", _http);
1758
1949
  }
1759
1950
  /**
1760
- * Await Commerce Jobs
1761
- *
1762
- * 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
1763
- *
1764
- * `POST /api/v1/commerce/jobs/await`
1765
- */
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
+ */
1766
1965
  awaitJobs(request, requestOptions) {
1767
1966
  const { ...body } = request ?? {};
1768
1967
  return this._http.request({
@@ -1774,12 +1973,20 @@ var CommerceClient = class {
1774
1973
  });
1775
1974
  }
1776
1975
  /**
1777
- * Verify Commerce State
1778
- *
1779
- * 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
1780
- *
1781
- * `POST /api/v1/commerce/state/verify`
1782
- */
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
+ */
1783
1990
  verifyState(request, requestOptions) {
1784
1991
  const { ...body } = request ?? {};
1785
1992
  return this._http.request({
@@ -1860,16 +2067,16 @@ var DocumentsClient = class {
1860
2067
  /**
1861
2068
  * Get Document
1862
2069
  *
1863
- * 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.
1864
2071
  *
1865
2072
  * `GET /api/v1/documents/{documentId}`
1866
2073
  */
1867
2074
  get(request, requestOptions) {
1868
- const { documentId, organizationId } = request ?? {};
2075
+ const { documentId, organizationId, includeDownloadUrl } = request ?? {};
1869
2076
  return this._http.request({
1870
2077
  method: "GET",
1871
2078
  path: `/api/v1/documents/${encodePathParam("documentId", documentId)}`,
1872
- query: { organizationId },
2079
+ query: { organizationId, includeDownloadUrl },
1873
2080
  body: void 0,
1874
2081
  ...mergeRequestOptions(requestOptions)
1875
2082
  });
@@ -2781,11 +2988,14 @@ var ProductsClient = class {
2781
2988
  language,
2782
2989
  hasImage,
2783
2990
  stock,
2991
+ duplicateStatus,
2992
+ duplicateType,
2784
2993
  publishedFrom,
2785
2994
  publishedTo,
2786
2995
  publishedTimeZone,
2787
2996
  cursor,
2788
- includeSummary
2997
+ includeSummary,
2998
+ detail
2789
2999
  } = request ?? {};
2790
3000
  return this._http.request({
2791
3001
  method: "GET",
@@ -2808,11 +3018,14 @@ var ProductsClient = class {
2808
3018
  language,
2809
3019
  hasImage,
2810
3020
  stock,
3021
+ duplicateStatus,
3022
+ duplicateType,
2811
3023
  publishedFrom,
2812
3024
  publishedTo,
2813
3025
  publishedTimeZone,
2814
3026
  cursor,
2815
- includeSummary
3027
+ includeSummary,
3028
+ detail
2816
3029
  },
2817
3030
  body: void 0,
2818
3031
  ...mergeRequestOptions(requestOptions)
@@ -3233,6 +3446,8 @@ var ProductsClient = class {
3233
3446
  language,
3234
3447
  hasImage,
3235
3448
  stock,
3449
+ duplicateStatus,
3450
+ duplicateType,
3236
3451
  publishedFrom,
3237
3452
  publishedTo,
3238
3453
  publishedTimeZone
@@ -3255,6 +3470,8 @@ var ProductsClient = class {
3255
3470
  language,
3256
3471
  hasImage,
3257
3472
  stock,
3473
+ duplicateStatus,
3474
+ duplicateType,
3258
3475
  publishedFrom,
3259
3476
  publishedTo,
3260
3477
  publishedTimeZone
@@ -3266,7 +3483,7 @@ var ProductsClient = class {
3266
3483
  /**
3267
3484
  * Queue Product Enrichment
3268
3485
  *
3269
- * 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.
3270
3487
 
3271
3488
  ### Enrichment options
3272
3489
 
@@ -3333,6 +3550,7 @@ var PromotionsClient = class {
3333
3550
  list(request = {}, requestOptions) {
3334
3551
  const {
3335
3552
  organizationId,
3553
+ campaign,
3336
3554
  q,
3337
3555
  status,
3338
3556
  marketplace,
@@ -3347,6 +3565,7 @@ var PromotionsClient = class {
3347
3565
  path: "/api/v1/promotions",
3348
3566
  query: {
3349
3567
  organizationId,
3568
+ campaign,
3350
3569
  q,
3351
3570
  status,
3352
3571
  marketplace,
@@ -3428,6 +3647,25 @@ var PromotionsClient = class {
3428
3647
  ...mergeRequestOptions(requestOptions)
3429
3648
  });
3430
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
+ }
3431
3669
  /**
3432
3670
  * Unassign Products from Promotion
3433
3671
  *
@@ -3465,7 +3703,7 @@ var PromotionsClient = class {
3465
3703
  /**
3466
3704
  * Assign Products to Promotion
3467
3705
  *
3468
- * 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.
3469
3707
  *
3470
3708
  * `POST /api/v1/promotions/{promotionId}/products`
3471
3709
  */
@@ -3498,6 +3736,158 @@ var PromotionsClient = class {
3498
3736
  ...mergeRequestOptions(requestOptions)
3499
3737
  });
3500
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
+ }
3501
3891
  };
3502
3892
  var ReturnsClient = class {
3503
3893
  constructor(_http) {
@@ -3726,6 +4116,223 @@ var ReviewsClient = class {
3726
4116
  });
3727
4117
  }
3728
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
+ };
3729
4336
  var SearchClient = class {
3730
4337
  constructor(_http) {
3731
4338
  __publicField(this, "_http", _http);
@@ -4265,6 +4872,7 @@ var OmniGeneratedClient = class {
4265
4872
  __publicField(this, "promotions");
4266
4873
  __publicField(this, "returns");
4267
4874
  __publicField(this, "reviews");
4875
+ __publicField(this, "scripts");
4268
4876
  __publicField(this, "search");
4269
4877
  __publicField(this, "settlements");
4270
4878
  __publicField(this, "sync");
@@ -4304,6 +4912,7 @@ var OmniGeneratedClient = class {
4304
4912
  this.promotions = new PromotionsClient(this._http);
4305
4913
  this.returns = new ReturnsClient(this._http);
4306
4914
  this.reviews = new ReviewsClient(this._http);
4915
+ this.scripts = new ScriptsClient(this._http);
4307
4916
  this.search = new SearchClient(this._http);
4308
4917
  this.settlements = new SettlementsClient(this._http);
4309
4918
  this.sync = new SyncClient(this._http);