@omni-commerce/sdk 0.6.0 → 0.7.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
@@ -1,10 +1,19 @@
1
1
  'use strict';
2
2
 
3
3
  var __defProp = Object.defineProperty;
4
+ var __typeError = (msg) => {
5
+ throw TypeError(msg);
6
+ };
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
8
  var __export = (target, all) => {
5
9
  for (var name in all)
6
10
  __defProp(target, name, { get: all[name], enumerable: true });
7
11
  };
12
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
13
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
14
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
15
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
16
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
8
17
 
9
18
  // src/BaseClient.ts
10
19
  function normalizeClientOptions(options = {}) {
@@ -26,7 +35,7 @@ function normalizeClientOptions(options = {}) {
26
35
  }
27
36
 
28
37
  // src/version.ts
29
- var SDK_VERSION = "0.6.0";
38
+ var SDK_VERSION = "0.7.0";
30
39
  var SDK_USER_AGENT = `omnicommerce-js/${SDK_VERSION}`;
31
40
 
32
41
  // src/environments.ts
@@ -37,9 +46,6 @@ var OmniEnvironment = {
37
46
 
38
47
  // src/errors/OmniError.ts
39
48
  var OmniError = class extends Error {
40
- statusCode;
41
- body;
42
- rawResponse;
43
49
  constructor({
44
50
  message,
45
51
  statusCode,
@@ -47,6 +53,9 @@ var OmniError = class extends Error {
47
53
  rawResponse
48
54
  }) {
49
55
  super(message ?? defaultErrorMessage(statusCode, body));
56
+ __publicField(this, "statusCode");
57
+ __publicField(this, "body");
58
+ __publicField(this, "rawResponse");
50
59
  this.name = "OmniError";
51
60
  this.statusCode = statusCode;
52
61
  this.body = body;
@@ -225,11 +234,12 @@ function joinUrl(baseUrl, path, query) {
225
234
  }
226
235
 
227
236
  // src/core/http-response-promise.ts
228
- var HttpResponsePromise = class _HttpResponsePromise extends Promise {
229
- #response;
237
+ var _response;
238
+ var _HttpResponsePromise = class _HttpResponsePromise extends Promise {
230
239
  constructor(executor, response) {
231
240
  super(executor);
232
- this.#response = response;
241
+ __privateAdd(this, _response);
242
+ __privateSet(this, _response, response);
233
243
  }
234
244
  static from(response) {
235
245
  return new _HttpResponsePromise((resolve, reject) => {
@@ -237,9 +247,11 @@ var HttpResponsePromise = class _HttpResponsePromise extends Promise {
237
247
  }, response);
238
248
  }
239
249
  withRawResponse() {
240
- return this.#response;
250
+ return __privateGet(this, _response);
241
251
  }
242
252
  };
253
+ _response = new WeakMap();
254
+ var HttpResponsePromise = _HttpResponsePromise;
243
255
  function toRawResponse(response) {
244
256
  return {
245
257
  status: response.status,
@@ -252,9 +264,8 @@ function toRawResponse(response) {
252
264
  var IDEMPOTENT_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD", "OPTIONS", "PUT", "DELETE"]);
253
265
  var OmniHttp = class {
254
266
  constructor(options) {
255
- this.options = options;
267
+ __publicField(this, "options", options);
256
268
  }
257
- options;
258
269
  request(init) {
259
270
  return HttpResponsePromise.from(this.requestWithRaw(init));
260
271
  }
@@ -465,12 +476,12 @@ var TERMINAL_STATUSES = /* @__PURE__ */ new Set([
465
476
  ...CANCELLED_STATUSES
466
477
  ]);
467
478
  var JobFailedError = class extends OmniError {
468
- jobStatus;
469
479
  constructor(jobStatus, body) {
470
480
  super({
471
481
  message: `Job ended with status "${jobStatus}"`,
472
482
  body
473
483
  });
484
+ __publicField(this, "jobStatus");
474
485
  this.name = "JobFailedError";
475
486
  this.jobStatus = jobStatus;
476
487
  }
@@ -523,9 +534,8 @@ async function waitForJob(http, request, options) {
523
534
  // src/generated/resources.ts
524
535
  var AgentsGeneralClient = class {
525
536
  constructor(_http) {
526
- this._http = _http;
537
+ __publicField(this, "_http", _http);
527
538
  }
528
- _http;
529
539
  /**
530
540
  * Invoke the Omni agent
531
541
  *
@@ -582,17 +592,15 @@ var AgentsGeneralClient = class {
582
592
  };
583
593
  var AgentsClient = class {
584
594
  constructor(_http) {
585
- this._http = _http;
595
+ __publicField(this, "_http", _http);
596
+ __publicField(this, "general");
586
597
  this.general = new AgentsGeneralClient(this._http);
587
598
  }
588
- _http;
589
- general;
590
599
  };
591
600
  var AnalyticsClient = class {
592
601
  constructor(_http) {
593
- this._http = _http;
602
+ __publicField(this, "_http", _http);
594
603
  }
595
- _http;
596
604
  /**
597
605
  * Get Ads Analytics
598
606
  *
@@ -1011,9 +1019,8 @@ var AnalyticsClient = class {
1011
1019
  };
1012
1020
  var AopClient = class {
1013
1021
  constructor(_http) {
1014
- this._http = _http;
1022
+ __publicField(this, "_http", _http);
1015
1023
  }
1016
- _http;
1017
1024
  /**
1018
1025
  * Get AOP configuration
1019
1026
  *
@@ -1102,9 +1109,8 @@ var AopClient = class {
1102
1109
  };
1103
1110
  var BrandsgatewayClient = class {
1104
1111
  constructor(_http) {
1105
- this._http = _http;
1112
+ __publicField(this, "_http", _http);
1106
1113
  }
1107
- _http;
1108
1114
  /**
1109
1115
  * Import BrandsGateway Products
1110
1116
  *
@@ -1131,9 +1137,8 @@ var BrandsgatewayClient = class {
1131
1137
  };
1132
1138
  var CampaignsClient = class {
1133
1139
  constructor(_http) {
1134
- this._http = _http;
1140
+ __publicField(this, "_http", _http);
1135
1141
  }
1136
- _http;
1137
1142
  /**
1138
1143
  * List Campaigns
1139
1144
  *
@@ -1273,9 +1278,8 @@ var CampaignsClient = class {
1273
1278
  };
1274
1279
  var CatalogClient = class {
1275
1280
  constructor(_http) {
1276
- this._http = _http;
1281
+ __publicField(this, "_http", _http);
1277
1282
  }
1278
- _http;
1279
1283
  /**
1280
1284
  * Export Catalog Items
1281
1285
  *
@@ -1298,9 +1302,8 @@ var CatalogClient = class {
1298
1302
  };
1299
1303
  var CheckoutSessionsClient = class {
1300
1304
  constructor(_http) {
1301
- this._http = _http;
1305
+ __publicField(this, "_http", _http);
1302
1306
  }
1303
- _http;
1304
1307
  /**
1305
1308
  * Create Agentic Checkout Session
1306
1309
  *
@@ -1406,9 +1409,8 @@ var CheckoutSessionsClient = class {
1406
1409
  };
1407
1410
  var CompareClient = class {
1408
1411
  constructor(_http) {
1409
- this._http = _http;
1412
+ __publicField(this, "_http", _http);
1410
1413
  }
1411
- _http;
1412
1414
  /**
1413
1415
  * Compare Public Products
1414
1416
  *
@@ -1429,9 +1431,8 @@ var CompareClient = class {
1429
1431
  };
1430
1432
  var DirectoryClient = class {
1431
1433
  constructor(_http) {
1432
- this._http = _http;
1434
+ __publicField(this, "_http", _http);
1433
1435
  }
1434
- _http;
1435
1436
  /**
1436
1437
  * List Public Merchants
1437
1438
  *
@@ -1451,15 +1452,14 @@ var DirectoryClient = class {
1451
1452
  };
1452
1453
  var DocumentsClient = class {
1453
1454
  constructor(_http) {
1454
- this._http = _http;
1455
+ __publicField(this, "_http", _http);
1455
1456
  }
1456
- _http;
1457
1457
  /**
1458
1458
  * Upload Document
1459
1459
  *
1460
1460
  * Upload one file to the knowledge base as multipart/form-data. Requires `documents:write`.
1461
1461
 
1462
- Accepted: PDF up to 20 MB, Excel (.xlsx/.xlsm) up to 10 MB, images up to 8 MB, CSV and Markdown up to 2 MB. PDFs, Markdown, and images are indexed in the background; poll `GET /api/v1/documents/{documentId}` until `status` is `completed`. CSV and Excel are stored for agents to read but are not indexed.
1462
+ Accepted: PDF up to 20 MB, Word (.docx) and PowerPoint (.pptx) up to 20 MB, Excel (.xlsx/.xlsm) up to 10 MB, images up to 8 MB, CSV and Markdown up to 2 MB. PDFs, Word, PowerPoint, Markdown, and images are indexed in the background; poll `GET /api/v1/documents/{documentId}` until `status` is `completed`. CSV and Excel are stored for agents to read but are not indexed.
1463
1463
  *
1464
1464
  * `POST /api/v1/documents`
1465
1465
  */
@@ -1493,9 +1493,8 @@ var DocumentsClient = class {
1493
1493
  };
1494
1494
  var EvaluateClient = class {
1495
1495
  constructor(_http) {
1496
- this._http = _http;
1496
+ __publicField(this, "_http", _http);
1497
1497
  }
1498
- _http;
1499
1498
  /**
1500
1499
  * Evaluate SKU Readiness
1501
1500
  *
@@ -1516,9 +1515,8 @@ var EvaluateClient = class {
1516
1515
  };
1517
1516
  var FeedClient = class {
1518
1517
  constructor(_http) {
1519
- this._http = _http;
1518
+ __publicField(this, "_http", _http);
1520
1519
  }
1521
- _http;
1522
1520
  /**
1523
1521
  * Get Merchant LLM Feed
1524
1522
  *
@@ -1539,9 +1537,8 @@ var FeedClient = class {
1539
1537
  };
1540
1538
  var ImagesClient = class {
1541
1539
  constructor(_http) {
1542
- this._http = _http;
1540
+ __publicField(this, "_http", _http);
1543
1541
  }
1544
- _http;
1545
1542
  /**
1546
1543
  * Generate Ghost Mannequin Image
1547
1544
  *
@@ -1562,9 +1559,8 @@ var ImagesClient = class {
1562
1559
  };
1563
1560
  var JobsClient = class {
1564
1561
  constructor(_http) {
1565
- this._http = _http;
1562
+ __publicField(this, "_http", _http);
1566
1563
  }
1567
- _http;
1568
1564
  /**
1569
1565
  * Get Developer Job Status
1570
1566
  *
@@ -1618,9 +1614,8 @@ var JobsClient = class {
1618
1614
  };
1619
1615
  var LooksClient = class {
1620
1616
  constructor(_http) {
1621
- this._http = _http;
1617
+ __publicField(this, "_http", _http);
1622
1618
  }
1623
- _http;
1624
1619
  /**
1625
1620
  * List Looks
1626
1621
  *
@@ -1675,9 +1670,8 @@ var LooksClient = class {
1675
1670
  };
1676
1671
  var MarketplacesClient = class {
1677
1672
  constructor(_http) {
1678
- this._http = _http;
1673
+ __publicField(this, "_http", _http);
1679
1674
  }
1680
- _http;
1681
1675
  /**
1682
1676
  * List Connected Marketplaces
1683
1677
  *
@@ -1698,9 +1692,8 @@ var MarketplacesClient = class {
1698
1692
  };
1699
1693
  var MerchantsClient = class {
1700
1694
  constructor(_http) {
1701
- this._http = _http;
1695
+ __publicField(this, "_http", _http);
1702
1696
  }
1703
- _http;
1704
1697
  /**
1705
1698
  * Get Public Merchant Manifest
1706
1699
  *
@@ -1784,9 +1777,8 @@ var MerchantsClient = class {
1784
1777
  };
1785
1778
  var MonitorClient = class {
1786
1779
  constructor(_http) {
1787
- this._http = _http;
1780
+ __publicField(this, "_http", _http);
1788
1781
  }
1789
- _http;
1790
1782
  /**
1791
1783
  * Run AI Shelf Share Monitor
1792
1784
  *
@@ -1807,9 +1799,8 @@ var MonitorClient = class {
1807
1799
  };
1808
1800
  var OauthClient = class {
1809
1801
  constructor(_http) {
1810
- this._http = _http;
1802
+ __publicField(this, "_http", _http);
1811
1803
  }
1812
- _http;
1813
1804
  /**
1814
1805
  * Revoke Access Token
1815
1806
  *
@@ -1847,9 +1838,8 @@ var OauthClient = class {
1847
1838
  };
1848
1839
  var OrdersClient = class {
1849
1840
  constructor(_http) {
1850
- this._http = _http;
1841
+ __publicField(this, "_http", _http);
1851
1842
  }
1852
- _http;
1853
1843
  /**
1854
1844
  * List Orders
1855
1845
  *
@@ -2062,9 +2052,8 @@ var OrdersClient = class {
2062
2052
  };
2063
2053
  var OrganizationsClient = class {
2064
2054
  constructor(_http) {
2065
- this._http = _http;
2055
+ __publicField(this, "_http", _http);
2066
2056
  }
2067
- _http;
2068
2057
  /**
2069
2058
  * Create Organization
2070
2059
  *
@@ -2085,9 +2074,8 @@ var OrganizationsClient = class {
2085
2074
  };
2086
2075
  var PriceBooksClient = class {
2087
2076
  constructor(_http) {
2088
- this._http = _http;
2077
+ __publicField(this, "_http", _http);
2089
2078
  }
2090
- _http;
2091
2079
  /**
2092
2080
  * List Price Book Rules
2093
2081
  *
@@ -2195,9 +2183,8 @@ var PriceBooksClient = class {
2195
2183
  };
2196
2184
  var ProductCategoriesClient = class {
2197
2185
  constructor(_http) {
2198
- this._http = _http;
2186
+ __publicField(this, "_http", _http);
2199
2187
  }
2200
- _http;
2201
2188
  /**
2202
2189
  * Recommend Marketplace Product Categories
2203
2190
  *
@@ -2218,9 +2205,8 @@ var ProductCategoriesClient = class {
2218
2205
  };
2219
2206
  var ProductsClient = class {
2220
2207
  constructor(_http) {
2221
- this._http = _http;
2208
+ __publicField(this, "_http", _http);
2222
2209
  }
2223
- _http;
2224
2210
  /**
2225
2211
  * List Products
2226
2212
  *
@@ -2580,9 +2566,8 @@ var ProductsClient = class {
2580
2566
  };
2581
2567
  var PromotionsClient = class {
2582
2568
  constructor(_http) {
2583
- this._http = _http;
2569
+ __publicField(this, "_http", _http);
2584
2570
  }
2585
- _http;
2586
2571
  /**
2587
2572
  * List Promotions
2588
2573
  *
@@ -2761,9 +2746,8 @@ var PromotionsClient = class {
2761
2746
  };
2762
2747
  var ReturnsClient = class {
2763
2748
  constructor(_http) {
2764
- this._http = _http;
2749
+ __publicField(this, "_http", _http);
2765
2750
  }
2766
- _http;
2767
2751
  /**
2768
2752
  * List Returns
2769
2753
  *
@@ -2817,9 +2801,8 @@ var ReturnsClient = class {
2817
2801
  };
2818
2802
  var ReviewsClient = class {
2819
2803
  constructor(_http) {
2820
- this._http = _http;
2804
+ __publicField(this, "_http", _http);
2821
2805
  }
2822
- _http;
2823
2806
  /**
2824
2807
  * List Reviews
2825
2808
  *
@@ -2919,9 +2902,8 @@ var ReviewsClient = class {
2919
2902
  };
2920
2903
  var SearchClient = class {
2921
2904
  constructor(_http) {
2922
- this._http = _http;
2905
+ __publicField(this, "_http", _http);
2923
2906
  }
2924
- _http;
2925
2907
  /**
2926
2908
  * Search Public Merchant Products
2927
2909
  *
@@ -3020,9 +3002,8 @@ var SearchClient = class {
3020
3002
  };
3021
3003
  var SettlementsClient = class {
3022
3004
  constructor(_http) {
3023
- this._http = _http;
3005
+ __publicField(this, "_http", _http);
3024
3006
  }
3025
- _http;
3026
3007
  /**
3027
3008
  * List Settlements
3028
3009
  *
@@ -3113,9 +3094,8 @@ var SettlementsClient = class {
3113
3094
  };
3114
3095
  var SyncClient = class {
3115
3096
  constructor(_http) {
3116
- this._http = _http;
3097
+ __publicField(this, "_http", _http);
3117
3098
  }
3118
- _http;
3119
3099
  /**
3120
3100
  * Sync Product Commercial Fields
3121
3101
  *
@@ -3136,9 +3116,8 @@ var SyncClient = class {
3136
3116
  };
3137
3117
  var ThreadsClient = class {
3138
3118
  constructor(_http) {
3139
- this._http = _http;
3119
+ __publicField(this, "_http", _http);
3140
3120
  }
3141
- _http;
3142
3121
  /**
3143
3122
  * Get Thread Status
3144
3123
  *
@@ -3163,9 +3142,8 @@ var ThreadsClient = class {
3163
3142
  };
3164
3143
  var UcpCheckoutSessionsClient = class {
3165
3144
  constructor(_http) {
3166
- this._http = _http;
3145
+ __publicField(this, "_http", _http);
3167
3146
  }
3168
- _http;
3169
3147
  /**
3170
3148
  * Create UCP Checkout Session
3171
3149
  *
@@ -3271,9 +3249,8 @@ var UcpCheckoutSessionsClient = class {
3271
3249
  };
3272
3250
  var UcpOrdersClient = class {
3273
3251
  constructor(_http) {
3274
- this._http = _http;
3252
+ __publicField(this, "_http", _http);
3275
3253
  }
3276
- _http;
3277
3254
  /**
3278
3255
  * Get UCP Order
3279
3256
  *
@@ -3294,19 +3271,17 @@ var UcpOrdersClient = class {
3294
3271
  };
3295
3272
  var UcpClient = class {
3296
3273
  constructor(_http) {
3297
- this._http = _http;
3274
+ __publicField(this, "_http", _http);
3275
+ __publicField(this, "checkoutSessions");
3276
+ __publicField(this, "orders");
3298
3277
  this.checkoutSessions = new UcpCheckoutSessionsClient(this._http);
3299
3278
  this.orders = new UcpOrdersClient(this._http);
3300
3279
  }
3301
- _http;
3302
- checkoutSessions;
3303
- orders;
3304
3280
  };
3305
3281
  var WebhookEventsClient = class {
3306
3282
  constructor(_http) {
3307
- this._http = _http;
3283
+ __publicField(this, "_http", _http);
3308
3284
  }
3309
- _http;
3310
3285
  /**
3311
3286
  * List Webhook Events
3312
3287
  *
@@ -3327,9 +3302,8 @@ var WebhookEventsClient = class {
3327
3302
  };
3328
3303
  var WebhooksClient = class {
3329
3304
  constructor(_http) {
3330
- this._http = _http;
3305
+ __publicField(this, "_http", _http);
3331
3306
  }
3332
- _http;
3333
3307
  /**
3334
3308
  * List Developer Webhooks
3335
3309
  *
@@ -3366,9 +3340,8 @@ var WebhooksClient = class {
3366
3340
  };
3367
3341
  var ZaloraClient = class {
3368
3342
  constructor(_http) {
3369
- this._http = _http;
3343
+ __publicField(this, "_http", _http);
3370
3344
  }
3371
- _http;
3372
3345
  /**
3373
3346
  * Get Selected Zalora Import Status
3374
3347
  *
@@ -3414,7 +3387,42 @@ var ZaloraClient = class {
3414
3387
  };
3415
3388
  var OmniGeneratedClient = class {
3416
3389
  constructor(_http) {
3417
- this._http = _http;
3390
+ __publicField(this, "_http", _http);
3391
+ __publicField(this, "agents");
3392
+ __publicField(this, "analytics");
3393
+ __publicField(this, "aop");
3394
+ __publicField(this, "brandsgateway");
3395
+ __publicField(this, "campaigns");
3396
+ __publicField(this, "catalog");
3397
+ __publicField(this, "checkoutSessions");
3398
+ __publicField(this, "compare");
3399
+ __publicField(this, "directory");
3400
+ __publicField(this, "documents");
3401
+ __publicField(this, "evaluate");
3402
+ __publicField(this, "feed");
3403
+ __publicField(this, "images");
3404
+ __publicField(this, "jobs");
3405
+ __publicField(this, "looks");
3406
+ __publicField(this, "marketplaces");
3407
+ __publicField(this, "merchants");
3408
+ __publicField(this, "monitor");
3409
+ __publicField(this, "oauth");
3410
+ __publicField(this, "orders");
3411
+ __publicField(this, "organizations");
3412
+ __publicField(this, "priceBooks");
3413
+ __publicField(this, "productCategories");
3414
+ __publicField(this, "products");
3415
+ __publicField(this, "promotions");
3416
+ __publicField(this, "returns");
3417
+ __publicField(this, "reviews");
3418
+ __publicField(this, "search");
3419
+ __publicField(this, "settlements");
3420
+ __publicField(this, "sync");
3421
+ __publicField(this, "threads");
3422
+ __publicField(this, "ucp");
3423
+ __publicField(this, "webhookEvents");
3424
+ __publicField(this, "webhooks");
3425
+ __publicField(this, "zalora");
3418
3426
  this.agents = new AgentsClient(this._http);
3419
3427
  this.analytics = new AnalyticsClient(this._http);
3420
3428
  this.aop = new AopClient(this._http);
@@ -3451,42 +3459,6 @@ var OmniGeneratedClient = class {
3451
3459
  this.webhooks = new WebhooksClient(this._http);
3452
3460
  this.zalora = new ZaloraClient(this._http);
3453
3461
  }
3454
- _http;
3455
- agents;
3456
- analytics;
3457
- aop;
3458
- brandsgateway;
3459
- campaigns;
3460
- catalog;
3461
- checkoutSessions;
3462
- compare;
3463
- directory;
3464
- documents;
3465
- evaluate;
3466
- feed;
3467
- images;
3468
- jobs;
3469
- looks;
3470
- marketplaces;
3471
- merchants;
3472
- monitor;
3473
- oauth;
3474
- orders;
3475
- organizations;
3476
- priceBooks;
3477
- productCategories;
3478
- products;
3479
- promotions;
3480
- returns;
3481
- reviews;
3482
- search;
3483
- settlements;
3484
- sync;
3485
- threads;
3486
- ucp;
3487
- webhookEvents;
3488
- webhooks;
3489
- zalora;
3490
3462
  };
3491
3463
 
3492
3464
  // src/Client.ts