@omni-commerce/cli 0.8.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -11,7 +11,8 @@ var GLOBAL_TRUE_FLAGS = /* @__PURE__ */ new Set([
11
11
  "schema",
12
12
  "dry-run",
13
13
  "version",
14
- "v"
14
+ "v",
15
+ "no-browser"
15
16
  ]);
16
17
  function parseArgv(argv) {
17
18
  const trail = [];
@@ -69,6 +70,129 @@ function flagString(flags, name) {
69
70
  return typeof value === "string" && value.trim() ? value.trim() : void 0;
70
71
  }
71
72
 
73
+ // src/browser-login.ts
74
+ import { setTimeout as sleep } from "timers/promises";
75
+
76
+ // src/open-browser.ts
77
+ import { execFile } from "child_process";
78
+ import { promisify } from "util";
79
+ var executeFile = promisify(execFile);
80
+ async function openBrowser(url) {
81
+ const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "rundll32.exe" : "xdg-open";
82
+ const args = process.platform === "win32" ? ["url.dll,FileProtocolHandler", url] : [url];
83
+ await executeFile(command, args, { timeout: 1e4 });
84
+ }
85
+
86
+ // src/version.ts
87
+ var CLI_VERSION = "0.10.0";
88
+
89
+ // src/browser-login.ts
90
+ function loginOrigin(baseUrl) {
91
+ const url = new URL(baseUrl);
92
+ const loopback = ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname);
93
+ if (url.protocol !== "https:" && !(url.protocol === "http:" && loopback) || url.username || url.password || url.search || url.hash || url.pathname !== "/") {
94
+ throw new Error(
95
+ "Login requires an HTTPS API origin (HTTP is allowed on localhost)."
96
+ );
97
+ }
98
+ return url.origin;
99
+ }
100
+ async function readResponse(response) {
101
+ const body = await response.json().catch(() => null);
102
+ if (!body || typeof body !== "object" || Array.isArray(body)) {
103
+ throw new Error("Invalid login response. Check --base-url and try again.");
104
+ }
105
+ return body;
106
+ }
107
+ async function browserLogin(baseUrl, options = {}) {
108
+ const origin = loginOrigin(baseUrl);
109
+ const fetchImpl = options.fetch ?? fetch;
110
+ const post = (path2, body, timeoutMs = 3e4) => fetchImpl(new URL(path2, origin), {
111
+ method: "POST",
112
+ headers: { "Content-Type": "application/json" },
113
+ body: JSON.stringify(body),
114
+ redirect: "error",
115
+ signal: AbortSignal.timeout(Math.max(1, timeoutMs))
116
+ });
117
+ const started = await post("/api/cli/device/code", {
118
+ client_version: CLI_VERSION
119
+ });
120
+ if (!started.ok)
121
+ throw new Error(
122
+ `Could not start browser login (${started.status}). Try again shortly.`
123
+ );
124
+ const issued = await readResponse(started);
125
+ if (typeof issued.device_code !== "string" || !/^[a-f0-9]{64}$/.test(issued.device_code) || typeof issued.user_code !== "string" || !/^[A-Z]{4}-[A-Z]{4}$/.test(issued.user_code) || typeof issued.verification_uri_complete !== "string" || typeof issued.expires_in !== "number" || !Number.isFinite(issued.expires_in) || issued.expires_in <= 0 || issued.expires_in > 900 || typeof issued.interval !== "number" || !Number.isFinite(issued.interval) || issued.interval < 5 || issued.interval > 900) {
126
+ throw new Error(
127
+ "Invalid browser login response. Check --base-url and try again."
128
+ );
129
+ }
130
+ const verificationUrl = new URL(issued.verification_uri_complete);
131
+ if (verificationUrl.origin !== origin || verificationUrl.username || verificationUrl.password || verificationUrl.pathname !== "/cli/authorize" || verificationUrl.searchParams.get("code") !== issued.user_code || [...verificationUrl.searchParams.keys()].some((key) => key !== "code") || verificationUrl.hash) {
132
+ throw new Error("The login page does not match the requested API origin.");
133
+ }
134
+ const deadline = Date.now() + issued.expires_in * 1e3;
135
+ let intervalMs = issued.interval * 1e3;
136
+ process.stdout.write(
137
+ `Confirm code ${issued.user_code} in your browser.
138
+ ${verificationUrl.toString()}
139
+ `
140
+ );
141
+ if (!options.noBrowser) {
142
+ try {
143
+ await (options.openBrowser ?? openBrowser)(verificationUrl.toString());
144
+ } catch {
145
+ process.stderr.write(
146
+ "Could not open your browser. Open the URL above to continue.\n"
147
+ );
148
+ }
149
+ }
150
+ while (Date.now() < deadline) {
151
+ await sleep(Math.min(intervalMs, deadline - Date.now()));
152
+ if (Date.now() >= deadline) break;
153
+ let response;
154
+ try {
155
+ response = await post(
156
+ "/api/cli/device/token",
157
+ { device_code: issued.device_code },
158
+ Math.min(3e4, deadline - Date.now())
159
+ );
160
+ } catch {
161
+ intervalMs = Math.min(Math.max(intervalMs * 2, 1e4), 6e4);
162
+ continue;
163
+ }
164
+ if (response.status === 429 || response.status >= 500) {
165
+ const retryAfter = Number(response.headers.get("Retry-After"));
166
+ intervalMs = Math.max(
167
+ intervalMs + 5e3,
168
+ Number.isFinite(retryAfter) ? retryAfter * 1e3 : 0
169
+ );
170
+ continue;
171
+ }
172
+ const result = await readResponse(response);
173
+ if (response.ok) {
174
+ if (typeof result.api_key !== "string" || !result.api_key.startsWith("omni_sk_") || result.token_type !== "api_key") {
175
+ throw new Error("The login server did not return valid credentials.");
176
+ }
177
+ return { apiKey: result.api_key, baseUrl: origin };
178
+ }
179
+ if (result.error === "authorization_pending") continue;
180
+ if (result.error === "slow_down") {
181
+ intervalMs += 5e3;
182
+ continue;
183
+ }
184
+ if (result.error === "access_denied")
185
+ throw new Error(
186
+ "Browser login was denied. Run omni auth login to try again."
187
+ );
188
+ if (result.error === "expired_token") break;
189
+ throw new Error(
190
+ `Browser login failed (${response.status}). Run omni auth login to try again.`
191
+ );
192
+ }
193
+ throw new Error("Browser login expired. Run omni auth login to try again.");
194
+ }
195
+
72
196
  // src/config.ts
73
197
  import { chmod, mkdir, readFile, rm, writeFile } from "fs/promises";
74
198
  import { homedir } from "os";
@@ -87,9 +211,12 @@ async function readConfig() {
87
211
  }
88
212
  async function writeConfig(config) {
89
213
  const directory = path.dirname(configPath());
90
- await mkdir(directory, { recursive: true });
214
+ await mkdir(directory, { recursive: true, mode: 448 });
91
215
  await writeFile(configPath(), `${JSON.stringify(config, null, 2)}
92
- `, "utf8");
216
+ `, {
217
+ encoding: "utf8",
218
+ mode: 384
219
+ });
93
220
  await chmod(configPath(), 384);
94
221
  }
95
222
  async function clearConfig() {
@@ -99,7 +226,7 @@ async function resolveCredentials(input2) {
99
226
  const file = await readConfig();
100
227
  const apiKey = input2.apiKey || process.env.OMNI_API_KEY || file.apiKey || void 0;
101
228
  const source = input2.apiKey ? "flag" : process.env.OMNI_API_KEY ? "env" : file.apiKey ? "config" : "none";
102
- const baseUrl = input2.baseUrl || process.env.OMNI_BASE_URL || file.baseUrl || "https://omnicommerce.sg";
229
+ const baseUrl = input2.baseUrl || process.env.OMNI_BASE_URL || file.baseUrl || "https://omnicommerce.ai";
103
230
  return { apiKey, baseUrl, source };
104
231
  }
105
232
  function maskSecret(value) {
@@ -237,6 +364,69 @@ ${body}
237
364
 
238
365
  // src/generated/commands.ts
239
366
  var COMMANDS = [
367
+ {
368
+ trail: ["api", "get-embedwell-knownagent-card-json"],
369
+ resourcePath: ["api"],
370
+ methodName: "getEmbedwellKnownagentCardJson",
371
+ httpMethod: "GET",
372
+ path: "/api/embed/{deploymentId}/.well-known/agent-card.json",
373
+ summary: "Discover a published merchant agent",
374
+ flags: [
375
+ {
376
+ name: "deploymentId",
377
+ flag: "deployment-id",
378
+ required: true,
379
+ source: "path"
380
+ }
381
+ ],
382
+ acceptsJsonBody: false,
383
+ acceptsFile: false,
384
+ bodyRequired: false
385
+ },
386
+ {
387
+ trail: ["api", "embeda2a"],
388
+ resourcePath: ["api"],
389
+ methodName: "embeda2a",
390
+ httpMethod: "POST",
391
+ path: "/api/embed/{deploymentId}/a2a",
392
+ summary: "Call a merchant agent using A2A",
393
+ flags: [
394
+ {
395
+ name: "deploymentId",
396
+ flag: "deployment-id",
397
+ required: true,
398
+ source: "path"
399
+ }
400
+ ],
401
+ acceptsJsonBody: true,
402
+ acceptsFile: false,
403
+ bodyRequired: true
404
+ },
405
+ {
406
+ trail: ["api", "embedcheckout-sessions"],
407
+ resourcePath: ["api"],
408
+ methodName: "embedcheckoutSessions",
409
+ httpMethod: "POST",
410
+ path: "/api/embed/{deploymentId}/checkout-sessions/{operation}",
411
+ summary: "Manage customer-owned purchase offers",
412
+ flags: [
413
+ {
414
+ name: "deploymentId",
415
+ flag: "deployment-id",
416
+ required: true,
417
+ source: "path"
418
+ },
419
+ {
420
+ name: "operation",
421
+ flag: "operation",
422
+ required: true,
423
+ source: "path"
424
+ }
425
+ ],
426
+ acceptsJsonBody: true,
427
+ acceptsFile: false,
428
+ bodyRequired: true
429
+ },
240
430
  {
241
431
  trail: ["agents", "general", "invoke"],
242
432
  resourcePath: ["agents", "general"],
@@ -1068,6 +1258,124 @@ var COMMANDS = [
1068
1258
  acceptsFile: false,
1069
1259
  bodyRequired: true
1070
1260
  },
1261
+ {
1262
+ trail: ["brand-kits", "list"],
1263
+ resourcePath: ["brandKits"],
1264
+ methodName: "list",
1265
+ httpMethod: "GET",
1266
+ path: "/api/v1/brand-kits",
1267
+ summary: "List Brand Kits",
1268
+ flags: [
1269
+ {
1270
+ name: "organizationId",
1271
+ flag: "organization-id",
1272
+ required: false,
1273
+ source: "query"
1274
+ },
1275
+ {
1276
+ name: "q",
1277
+ flag: "q",
1278
+ required: false,
1279
+ source: "query"
1280
+ },
1281
+ {
1282
+ name: "limit",
1283
+ flag: "limit",
1284
+ required: false,
1285
+ source: "query"
1286
+ },
1287
+ {
1288
+ name: "offset",
1289
+ flag: "offset",
1290
+ required: false,
1291
+ source: "query"
1292
+ }
1293
+ ],
1294
+ acceptsJsonBody: false,
1295
+ acceptsFile: false,
1296
+ bodyRequired: false
1297
+ },
1298
+ {
1299
+ trail: ["brand-kits", "create"],
1300
+ resourcePath: ["brandKits"],
1301
+ methodName: "create",
1302
+ httpMethod: "POST",
1303
+ path: "/api/v1/brand-kits",
1304
+ summary: "Create Brand Kit",
1305
+ flags: [],
1306
+ acceptsJsonBody: true,
1307
+ acceptsFile: false,
1308
+ bodyRequired: true
1309
+ },
1310
+ {
1311
+ trail: ["brand-kits", "delete"],
1312
+ resourcePath: ["brandKits"],
1313
+ methodName: "delete",
1314
+ httpMethod: "DELETE",
1315
+ path: "/api/v1/brand-kits/{brandKitId}",
1316
+ summary: "Delete Brand Kit",
1317
+ flags: [
1318
+ {
1319
+ name: "brandKitId",
1320
+ flag: "brand-kit-id",
1321
+ required: true,
1322
+ source: "path"
1323
+ },
1324
+ {
1325
+ name: "organizationId",
1326
+ flag: "organization-id",
1327
+ required: false,
1328
+ source: "query"
1329
+ }
1330
+ ],
1331
+ acceptsJsonBody: false,
1332
+ acceptsFile: false,
1333
+ bodyRequired: false
1334
+ },
1335
+ {
1336
+ trail: ["brand-kits", "get"],
1337
+ resourcePath: ["brandKits"],
1338
+ methodName: "get",
1339
+ httpMethod: "GET",
1340
+ path: "/api/v1/brand-kits/{brandKitId}",
1341
+ summary: "Get Brand Kit",
1342
+ flags: [
1343
+ {
1344
+ name: "brandKitId",
1345
+ flag: "brand-kit-id",
1346
+ required: true,
1347
+ source: "path"
1348
+ },
1349
+ {
1350
+ name: "organizationId",
1351
+ flag: "organization-id",
1352
+ required: false,
1353
+ source: "query"
1354
+ }
1355
+ ],
1356
+ acceptsJsonBody: false,
1357
+ acceptsFile: false,
1358
+ bodyRequired: false
1359
+ },
1360
+ {
1361
+ trail: ["brand-kits", "update"],
1362
+ resourcePath: ["brandKits"],
1363
+ methodName: "update",
1364
+ httpMethod: "PATCH",
1365
+ path: "/api/v1/brand-kits/{brandKitId}",
1366
+ summary: "Update Brand Kit",
1367
+ flags: [
1368
+ {
1369
+ name: "brandKitId",
1370
+ flag: "brand-kit-id",
1371
+ required: true,
1372
+ source: "path"
1373
+ }
1374
+ ],
1375
+ acceptsJsonBody: true,
1376
+ acceptsFile: false,
1377
+ bodyRequired: true
1378
+ },
1071
1379
  {
1072
1380
  trail: ["brandsgateway", "import-products"],
1073
1381
  resourcePath: ["brandsgateway"],
@@ -1433,6 +1741,30 @@ var COMMANDS = [
1433
1741
  acceptsFile: false,
1434
1742
  bodyRequired: true
1435
1743
  },
1744
+ {
1745
+ trail: ["commerce", "await-jobs"],
1746
+ resourcePath: ["commerce"],
1747
+ methodName: "awaitJobs",
1748
+ httpMethod: "POST",
1749
+ path: "/api/v1/commerce/jobs/await",
1750
+ summary: "Await Commerce Jobs",
1751
+ flags: [],
1752
+ acceptsJsonBody: true,
1753
+ acceptsFile: false,
1754
+ bodyRequired: true
1755
+ },
1756
+ {
1757
+ trail: ["commerce", "verify-state"],
1758
+ resourcePath: ["commerce"],
1759
+ methodName: "verifyState",
1760
+ httpMethod: "POST",
1761
+ path: "/api/v1/commerce/state/verify",
1762
+ summary: "Verify Commerce State",
1763
+ flags: [],
1764
+ acceptsJsonBody: true,
1765
+ acceptsFile: false,
1766
+ bodyRequired: true
1767
+ },
1436
1768
  {
1437
1769
  trail: ["compare", "get"],
1438
1770
  resourcePath: ["compare"],
@@ -1501,6 +1833,12 @@ var COMMANDS = [
1501
1833
  flag: "organization-id",
1502
1834
  required: false,
1503
1835
  source: "query"
1836
+ },
1837
+ {
1838
+ name: "includeDownloadUrl",
1839
+ flag: "include-download-url",
1840
+ required: false,
1841
+ source: "query"
1504
1842
  }
1505
1843
  ],
1506
1844
  acceptsJsonBody: false,
@@ -1556,6 +1894,79 @@ var COMMANDS = [
1556
1894
  acceptsFile: false,
1557
1895
  bodyRequired: true
1558
1896
  },
1897
+ {
1898
+ trail: ["inventory", "list"],
1899
+ resourcePath: ["inventory"],
1900
+ methodName: "list",
1901
+ httpMethod: "GET",
1902
+ path: "/api/v1/inventory",
1903
+ summary: "List Inventory Groups",
1904
+ flags: [
1905
+ {
1906
+ name: "productIds",
1907
+ flag: "product-ids",
1908
+ required: false,
1909
+ source: "query"
1910
+ },
1911
+ {
1912
+ name: "query",
1913
+ flag: "query",
1914
+ required: false,
1915
+ source: "query"
1916
+ },
1917
+ {
1918
+ name: "marketplace",
1919
+ flag: "marketplace",
1920
+ required: false,
1921
+ source: "query"
1922
+ },
1923
+ {
1924
+ name: "country",
1925
+ flag: "country",
1926
+ required: false,
1927
+ source: "query"
1928
+ },
1929
+ {
1930
+ name: "storeIds",
1931
+ flag: "store-ids",
1932
+ required: false,
1933
+ source: "query"
1934
+ },
1935
+ {
1936
+ name: "unlistedMarketplaces",
1937
+ flag: "unlisted-marketplaces",
1938
+ required: false,
1939
+ source: "query"
1940
+ },
1941
+ {
1942
+ name: "groupBy",
1943
+ flag: "group-by",
1944
+ required: false,
1945
+ source: "query"
1946
+ },
1947
+ {
1948
+ name: "status",
1949
+ flag: "status",
1950
+ required: false,
1951
+ source: "query"
1952
+ },
1953
+ {
1954
+ name: "offset",
1955
+ flag: "offset",
1956
+ required: false,
1957
+ source: "query"
1958
+ },
1959
+ {
1960
+ name: "limit",
1961
+ flag: "limit",
1962
+ required: false,
1963
+ source: "query"
1964
+ }
1965
+ ],
1966
+ acceptsJsonBody: false,
1967
+ acceptsFile: false,
1968
+ bodyRequired: false
1969
+ },
1559
1970
  {
1560
1971
  trail: ["jobs", "get"],
1561
1972
  resourcePath: ["jobs"],
@@ -2159,14 +2570,94 @@ var COMMANDS = [
2159
2570
  bodyRequired: true
2160
2571
  },
2161
2572
  {
2162
- trail: ["organizations", "create"],
2163
- resourcePath: ["organizations"],
2164
- methodName: "create",
2165
- httpMethod: "POST",
2166
- path: "/api/v1/organizations",
2167
- summary: "Create Organization",
2168
- flags: [],
2169
- acceptsJsonBody: true,
2573
+ trail: ["orders", "list-batch-action-options"],
2574
+ resourcePath: ["orders"],
2575
+ methodName: "listBatchActionOptions",
2576
+ httpMethod: "GET",
2577
+ path: "/api/v1/orders/actions",
2578
+ summary: "Check Order Action Options",
2579
+ flags: [
2580
+ {
2581
+ name: "orderIds",
2582
+ flag: "order-ids",
2583
+ required: true,
2584
+ source: "query"
2585
+ },
2586
+ {
2587
+ name: "action",
2588
+ flag: "action",
2589
+ required: true,
2590
+ source: "query"
2591
+ },
2592
+ {
2593
+ name: "organizationId",
2594
+ flag: "organization-id",
2595
+ required: false,
2596
+ source: "query"
2597
+ }
2598
+ ],
2599
+ acceptsJsonBody: false,
2600
+ acceptsFile: false,
2601
+ bodyRequired: false
2602
+ },
2603
+ {
2604
+ trail: ["orders", "process-actions"],
2605
+ resourcePath: ["orders"],
2606
+ methodName: "processActions",
2607
+ httpMethod: "POST",
2608
+ path: "/api/v1/orders/actions",
2609
+ summary: "Process Order Actions",
2610
+ flags: [],
2611
+ acceptsJsonBody: true,
2612
+ acceptsFile: false,
2613
+ bodyRequired: true
2614
+ },
2615
+ {
2616
+ trail: ["orders", "get-action-jobs"],
2617
+ resourcePath: ["orders"],
2618
+ methodName: "getActionJobs",
2619
+ httpMethod: "GET",
2620
+ path: "/api/v1/orders/actions/jobs",
2621
+ summary: "Get Order Action Jobs",
2622
+ flags: [
2623
+ {
2624
+ name: "jobIds",
2625
+ flag: "job-ids",
2626
+ required: true,
2627
+ source: "query"
2628
+ },
2629
+ {
2630
+ name: "organizationId",
2631
+ flag: "organization-id",
2632
+ required: false,
2633
+ source: "query"
2634
+ }
2635
+ ],
2636
+ acceptsJsonBody: false,
2637
+ acceptsFile: false,
2638
+ bodyRequired: false
2639
+ },
2640
+ {
2641
+ trail: ["orders", "create-picking-list"],
2642
+ resourcePath: ["orders"],
2643
+ methodName: "createPickingList",
2644
+ httpMethod: "POST",
2645
+ path: "/api/v1/orders/picking-list",
2646
+ summary: "Create Picking List",
2647
+ flags: [],
2648
+ acceptsJsonBody: true,
2649
+ acceptsFile: false,
2650
+ bodyRequired: true
2651
+ },
2652
+ {
2653
+ trail: ["organizations", "create"],
2654
+ resourcePath: ["organizations"],
2655
+ methodName: "create",
2656
+ httpMethod: "POST",
2657
+ path: "/api/v1/organizations",
2658
+ summary: "Create Organization",
2659
+ flags: [],
2660
+ acceptsJsonBody: true,
2170
2661
  acceptsFile: false,
2171
2662
  bodyRequired: true
2172
2663
  },
@@ -2367,6 +2858,90 @@ var COMMANDS = [
2367
2858
  flag: "offset",
2368
2859
  required: false,
2369
2860
  source: "query"
2861
+ },
2862
+ {
2863
+ name: "store",
2864
+ flag: "store",
2865
+ required: false,
2866
+ source: "query"
2867
+ },
2868
+ {
2869
+ name: "storeKeys",
2870
+ flag: "store-keys",
2871
+ required: false,
2872
+ source: "query"
2873
+ },
2874
+ {
2875
+ name: "brands",
2876
+ flag: "brands",
2877
+ required: false,
2878
+ source: "query"
2879
+ },
2880
+ {
2881
+ name: "bundleType",
2882
+ flag: "bundle-type",
2883
+ required: false,
2884
+ source: "query"
2885
+ },
2886
+ {
2887
+ name: "language",
2888
+ flag: "language",
2889
+ required: false,
2890
+ source: "query"
2891
+ },
2892
+ {
2893
+ name: "hasImage",
2894
+ flag: "has-image",
2895
+ required: false,
2896
+ source: "query"
2897
+ },
2898
+ {
2899
+ name: "stock",
2900
+ flag: "stock",
2901
+ required: false,
2902
+ source: "query"
2903
+ },
2904
+ {
2905
+ name: "duplicateStatus",
2906
+ flag: "duplicate-status",
2907
+ required: false,
2908
+ source: "query"
2909
+ },
2910
+ {
2911
+ name: "duplicateType",
2912
+ flag: "duplicate-type",
2913
+ required: false,
2914
+ source: "query"
2915
+ },
2916
+ {
2917
+ name: "publishedFrom",
2918
+ flag: "published-from",
2919
+ required: false,
2920
+ source: "query"
2921
+ },
2922
+ {
2923
+ name: "publishedTo",
2924
+ flag: "published-to",
2925
+ required: false,
2926
+ source: "query"
2927
+ },
2928
+ {
2929
+ name: "publishedTimeZone",
2930
+ flag: "published-time-zone",
2931
+ required: false,
2932
+ source: "query"
2933
+ },
2934
+ {
2935
+ name: "cursor",
2936
+ flag: "cursor",
2937
+ required: false,
2938
+ source: "query"
2939
+ },
2940
+ {
2941
+ name: "includeSummary",
2942
+ flag: "include-summary",
2943
+ required: false,
2944
+ source: "query"
2370
2945
  }
2371
2946
  ],
2372
2947
  acceptsJsonBody: false,
@@ -2593,6 +3168,43 @@ var COMMANDS = [
2593
3168
  acceptsFile: false,
2594
3169
  bodyRequired: true
2595
3170
  },
3171
+ {
3172
+ trail: ["products", "get-bulk-import-retry"],
3173
+ resourcePath: ["products"],
3174
+ methodName: "getBulkImportRetry",
3175
+ httpMethod: "GET",
3176
+ path: "/api/v1/products/bulk-import/retries/{retryJobId}",
3177
+ summary: "Get Import Retry Progress",
3178
+ flags: [
3179
+ {
3180
+ name: "retryJobId",
3181
+ flag: "retry-job-id",
3182
+ required: true,
3183
+ source: "path"
3184
+ },
3185
+ {
3186
+ name: "organizationId",
3187
+ flag: "organization-id",
3188
+ required: false,
3189
+ source: "query"
3190
+ }
3191
+ ],
3192
+ acceptsJsonBody: false,
3193
+ acceptsFile: false,
3194
+ bodyRequired: false
3195
+ },
3196
+ {
3197
+ trail: ["products", "retry-bulk-import"],
3198
+ resourcePath: ["products"],
3199
+ methodName: "retryBulkImport",
3200
+ httpMethod: "POST",
3201
+ path: "/api/v1/products/bulk-import/retry",
3202
+ summary: "Retry Failed Import or Review Jobs",
3203
+ flags: [],
3204
+ acceptsJsonBody: true,
3205
+ acceptsFile: false,
3206
+ bodyRequired: true
3207
+ },
2596
3208
  {
2597
3209
  trail: ["products", "compare-prices"],
2598
3210
  resourcePath: ["products"],
@@ -2642,6 +3254,133 @@ var COMMANDS = [
2642
3254
  acceptsFile: false,
2643
3255
  bodyRequired: true
2644
3256
  },
3257
+ {
3258
+ trail: ["products", "count"],
3259
+ resourcePath: ["products"],
3260
+ methodName: "count",
3261
+ httpMethod: "GET",
3262
+ path: "/api/v1/products/count",
3263
+ summary: "Count Products",
3264
+ flags: [
3265
+ {
3266
+ name: "status",
3267
+ flag: "status",
3268
+ required: false,
3269
+ source: "query"
3270
+ },
3271
+ {
3272
+ name: "marketplace",
3273
+ flag: "marketplace",
3274
+ required: false,
3275
+ source: "query"
3276
+ },
3277
+ {
3278
+ name: "country",
3279
+ flag: "country",
3280
+ required: false,
3281
+ source: "query"
3282
+ },
3283
+ {
3284
+ name: "q",
3285
+ flag: "q",
3286
+ required: false,
3287
+ source: "query"
3288
+ },
3289
+ {
3290
+ name: "sku",
3291
+ flag: "sku",
3292
+ required: false,
3293
+ source: "query"
3294
+ },
3295
+ {
3296
+ name: "minPrice",
3297
+ flag: "min-price",
3298
+ required: false,
3299
+ source: "query"
3300
+ },
3301
+ {
3302
+ name: "maxPrice",
3303
+ flag: "max-price",
3304
+ required: false,
3305
+ source: "query"
3306
+ },
3307
+ {
3308
+ name: "store",
3309
+ flag: "store",
3310
+ required: false,
3311
+ source: "query"
3312
+ },
3313
+ {
3314
+ name: "storeKeys",
3315
+ flag: "store-keys",
3316
+ required: false,
3317
+ source: "query"
3318
+ },
3319
+ {
3320
+ name: "brands",
3321
+ flag: "brands",
3322
+ required: false,
3323
+ source: "query"
3324
+ },
3325
+ {
3326
+ name: "bundleType",
3327
+ flag: "bundle-type",
3328
+ required: false,
3329
+ source: "query"
3330
+ },
3331
+ {
3332
+ name: "language",
3333
+ flag: "language",
3334
+ required: false,
3335
+ source: "query"
3336
+ },
3337
+ {
3338
+ name: "hasImage",
3339
+ flag: "has-image",
3340
+ required: false,
3341
+ source: "query"
3342
+ },
3343
+ {
3344
+ name: "stock",
3345
+ flag: "stock",
3346
+ required: false,
3347
+ source: "query"
3348
+ },
3349
+ {
3350
+ name: "duplicateStatus",
3351
+ flag: "duplicate-status",
3352
+ required: false,
3353
+ source: "query"
3354
+ },
3355
+ {
3356
+ name: "duplicateType",
3357
+ flag: "duplicate-type",
3358
+ required: false,
3359
+ source: "query"
3360
+ },
3361
+ {
3362
+ name: "publishedFrom",
3363
+ flag: "published-from",
3364
+ required: false,
3365
+ source: "query"
3366
+ },
3367
+ {
3368
+ name: "publishedTo",
3369
+ flag: "published-to",
3370
+ required: false,
3371
+ source: "query"
3372
+ },
3373
+ {
3374
+ name: "publishedTimeZone",
3375
+ flag: "published-time-zone",
3376
+ required: false,
3377
+ source: "query"
3378
+ }
3379
+ ],
3380
+ acceptsJsonBody: false,
3381
+ acceptsFile: false,
3382
+ bodyRequired: false
3383
+ },
2645
3384
  {
2646
3385
  trail: ["products", "enrich"],
2647
3386
  resourcePath: ["products"],
@@ -2867,10 +3606,177 @@ var COMMANDS = [
2867
3606
  summary: "Assign Products to Promotion",
2868
3607
  flags: [
2869
3608
  {
2870
- name: "promotionId",
2871
- flag: "promotion-id",
3609
+ name: "promotionId",
3610
+ flag: "promotion-id",
3611
+ required: true,
3612
+ source: "path"
3613
+ },
3614
+ {
3615
+ name: "organizationId",
3616
+ flag: "organization-id",
3617
+ required: false,
3618
+ source: "query"
3619
+ }
3620
+ ],
3621
+ acceptsJsonBody: true,
3622
+ acceptsFile: false,
3623
+ bodyRequired: true
3624
+ },
3625
+ {
3626
+ trail: ["promotions", "retry"],
3627
+ resourcePath: ["promotions"],
3628
+ methodName: "retry",
3629
+ httpMethod: "POST",
3630
+ path: "/api/v1/promotions/{promotionId}/retry",
3631
+ summary: "Retry Marketplace Delivery",
3632
+ flags: [
3633
+ {
3634
+ name: "promotionId",
3635
+ flag: "promotion-id",
3636
+ required: true,
3637
+ source: "path"
3638
+ },
3639
+ {
3640
+ name: "organizationId",
3641
+ flag: "organization-id",
3642
+ required: false,
3643
+ source: "query"
3644
+ }
3645
+ ],
3646
+ acceptsJsonBody: true,
3647
+ acceptsFile: false,
3648
+ bodyRequired: true
3649
+ },
3650
+ {
3651
+ trail: ["returns", "list"],
3652
+ resourcePath: ["returns"],
3653
+ methodName: "list",
3654
+ httpMethod: "GET",
3655
+ path: "/api/v1/returns",
3656
+ summary: "List Returns",
3657
+ flags: [
3658
+ {
3659
+ name: "organizationId",
3660
+ flag: "organization-id",
3661
+ required: false,
3662
+ source: "query"
3663
+ },
3664
+ {
3665
+ name: "marketplace",
3666
+ flag: "marketplace",
3667
+ required: false,
3668
+ source: "query"
3669
+ },
3670
+ {
3671
+ name: "accountId",
3672
+ flag: "account-id",
3673
+ required: false,
3674
+ source: "query"
3675
+ },
3676
+ {
3677
+ name: "externalOrderId",
3678
+ flag: "external-order-id",
3679
+ required: false,
3680
+ source: "query"
3681
+ },
3682
+ {
3683
+ name: "updatedSince",
3684
+ flag: "updated-since",
3685
+ required: false,
3686
+ source: "query"
3687
+ },
3688
+ {
3689
+ name: "cursor",
3690
+ flag: "cursor",
3691
+ required: false,
3692
+ source: "query"
3693
+ },
3694
+ {
3695
+ name: "limit",
3696
+ flag: "limit",
3697
+ required: false,
3698
+ source: "query"
3699
+ }
3700
+ ],
3701
+ acceptsJsonBody: false,
3702
+ acceptsFile: false,
3703
+ bodyRequired: false
3704
+ },
3705
+ {
3706
+ trail: ["returns", "get"],
3707
+ resourcePath: ["returns"],
3708
+ methodName: "get",
3709
+ httpMethod: "GET",
3710
+ path: "/api/v1/returns/{returnId}",
3711
+ summary: "Get Return",
3712
+ flags: [
3713
+ {
3714
+ name: "returnId",
3715
+ flag: "return-id",
3716
+ required: true,
3717
+ source: "path"
3718
+ },
3719
+ {
3720
+ name: "organizationId",
3721
+ flag: "organization-id",
3722
+ required: false,
3723
+ source: "query"
3724
+ }
3725
+ ],
3726
+ acceptsJsonBody: false,
3727
+ acceptsFile: false,
3728
+ bodyRequired: false
3729
+ },
3730
+ {
3731
+ trail: ["returns", "list-actions"],
3732
+ resourcePath: ["returns"],
3733
+ methodName: "listActions",
3734
+ httpMethod: "GET",
3735
+ path: "/api/v1/returns/actions",
3736
+ summary: "Check Return Actions",
3737
+ flags: [
3738
+ {
3739
+ name: "returnIds",
3740
+ flag: "return-ids",
3741
+ required: true,
3742
+ source: "query"
3743
+ },
3744
+ {
3745
+ name: "organizationId",
3746
+ flag: "organization-id",
3747
+ required: false,
3748
+ source: "query"
3749
+ }
3750
+ ],
3751
+ acceptsJsonBody: false,
3752
+ acceptsFile: false,
3753
+ bodyRequired: false
3754
+ },
3755
+ {
3756
+ trail: ["returns", "process"],
3757
+ resourcePath: ["returns"],
3758
+ methodName: "process",
3759
+ httpMethod: "POST",
3760
+ path: "/api/v1/returns/actions",
3761
+ summary: "Process Returns",
3762
+ flags: [],
3763
+ acceptsJsonBody: true,
3764
+ acceptsFile: false,
3765
+ bodyRequired: true
3766
+ },
3767
+ {
3768
+ trail: ["returns", "get-action-jobs"],
3769
+ resourcePath: ["returns"],
3770
+ methodName: "getActionJobs",
3771
+ httpMethod: "GET",
3772
+ path: "/api/v1/returns/actions/jobs",
3773
+ summary: "Get Return Action Jobs",
3774
+ flags: [
3775
+ {
3776
+ name: "jobIds",
3777
+ flag: "job-ids",
2872
3778
  required: true,
2873
- source: "path"
3779
+ source: "query"
2874
3780
  },
2875
3781
  {
2876
3782
  name: "organizationId",
@@ -2879,23 +3785,23 @@ var COMMANDS = [
2879
3785
  source: "query"
2880
3786
  }
2881
3787
  ],
2882
- acceptsJsonBody: true,
3788
+ acceptsJsonBody: false,
2883
3789
  acceptsFile: false,
2884
- bodyRequired: true
3790
+ bodyRequired: false
2885
3791
  },
2886
3792
  {
2887
- trail: ["promotions", "retry"],
2888
- resourcePath: ["promotions"],
2889
- methodName: "retry",
2890
- httpMethod: "POST",
2891
- path: "/api/v1/promotions/{promotionId}/retry",
2892
- summary: "Retry Marketplace Delivery",
3793
+ trail: ["returns", "list-for-orders"],
3794
+ resourcePath: ["returns"],
3795
+ methodName: "listForOrders",
3796
+ httpMethod: "GET",
3797
+ path: "/api/v1/returns/orders",
3798
+ summary: "Get Order Returns",
2893
3799
  flags: [
2894
3800
  {
2895
- name: "promotionId",
2896
- flag: "promotion-id",
3801
+ name: "orderIds",
3802
+ flag: "order-ids",
2897
3803
  required: true,
2898
- source: "path"
3804
+ source: "query"
2899
3805
  },
2900
3806
  {
2901
3807
  name: "organizationId",
@@ -2904,17 +3810,17 @@ var COMMANDS = [
2904
3810
  source: "query"
2905
3811
  }
2906
3812
  ],
2907
- acceptsJsonBody: true,
3813
+ acceptsJsonBody: false,
2908
3814
  acceptsFile: false,
2909
- bodyRequired: true
3815
+ bodyRequired: false
2910
3816
  },
2911
3817
  {
2912
- trail: ["returns", "list"],
2913
- resourcePath: ["returns"],
3818
+ trail: ["reviews", "list"],
3819
+ resourcePath: ["reviews"],
2914
3820
  methodName: "list",
2915
3821
  httpMethod: "GET",
2916
- path: "/api/v1/returns",
2917
- summary: "List Returns",
3822
+ path: "/api/v1/reviews",
3823
+ summary: "List Reviews",
2918
3824
  flags: [
2919
3825
  {
2920
3826
  name: "organizationId",
@@ -2922,6 +3828,12 @@ var COMMANDS = [
2922
3828
  required: false,
2923
3829
  source: "query"
2924
3830
  },
3831
+ {
3832
+ name: "q",
3833
+ flag: "q",
3834
+ required: false,
3835
+ source: "query"
3836
+ },
2925
3837
  {
2926
3838
  name: "marketplace",
2927
3839
  flag: "marketplace",
@@ -2929,26 +3841,32 @@ var COMMANDS = [
2929
3841
  source: "query"
2930
3842
  },
2931
3843
  {
2932
- name: "accountId",
2933
- flag: "account-id",
3844
+ name: "status",
3845
+ flag: "status",
2934
3846
  required: false,
2935
3847
  source: "query"
2936
3848
  },
2937
3849
  {
2938
- name: "externalOrderId",
2939
- flag: "external-order-id",
3850
+ name: "priority",
3851
+ flag: "priority",
2940
3852
  required: false,
2941
3853
  source: "query"
2942
3854
  },
2943
3855
  {
2944
- name: "updatedSince",
2945
- flag: "updated-since",
3856
+ name: "store",
3857
+ flag: "store",
2946
3858
  required: false,
2947
3859
  source: "query"
2948
3860
  },
2949
3861
  {
2950
- name: "cursor",
2951
- flag: "cursor",
3862
+ name: "productId",
3863
+ flag: "product-id",
3864
+ required: false,
3865
+ source: "query"
3866
+ },
3867
+ {
3868
+ name: "sortBy",
3869
+ flag: "sort-by",
2952
3870
  required: false,
2953
3871
  source: "query"
2954
3872
  },
@@ -2957,6 +3875,12 @@ var COMMANDS = [
2957
3875
  flag: "limit",
2958
3876
  required: false,
2959
3877
  source: "query"
3878
+ },
3879
+ {
3880
+ name: "offset",
3881
+ flag: "offset",
3882
+ required: false,
3883
+ source: "query"
2960
3884
  }
2961
3885
  ],
2962
3886
  acceptsJsonBody: false,
@@ -2964,16 +3888,16 @@ var COMMANDS = [
2964
3888
  bodyRequired: false
2965
3889
  },
2966
3890
  {
2967
- trail: ["returns", "get"],
2968
- resourcePath: ["returns"],
3891
+ trail: ["reviews", "get"],
3892
+ resourcePath: ["reviews"],
2969
3893
  methodName: "get",
2970
3894
  httpMethod: "GET",
2971
- path: "/api/v1/returns/{returnId}",
2972
- summary: "Get Return",
3895
+ path: "/api/v1/reviews/{reviewId}",
3896
+ summary: "Get Review",
2973
3897
  flags: [
2974
3898
  {
2975
- name: "returnId",
2976
- flag: "return-id",
3899
+ name: "reviewId",
3900
+ flag: "review-id",
2977
3901
  required: true,
2978
3902
  source: "path"
2979
3903
  },
@@ -2989,12 +3913,31 @@ var COMMANDS = [
2989
3913
  bodyRequired: false
2990
3914
  },
2991
3915
  {
2992
- trail: ["reviews", "list"],
3916
+ trail: ["reviews", "reply"],
2993
3917
  resourcePath: ["reviews"],
3918
+ methodName: "reply",
3919
+ httpMethod: "POST",
3920
+ path: "/api/v1/reviews/{reviewId}/reply",
3921
+ summary: "Reply to Review",
3922
+ flags: [
3923
+ {
3924
+ name: "reviewId",
3925
+ flag: "review-id",
3926
+ required: true,
3927
+ source: "path"
3928
+ }
3929
+ ],
3930
+ acceptsJsonBody: true,
3931
+ acceptsFile: false,
3932
+ bodyRequired: true
3933
+ },
3934
+ {
3935
+ trail: ["scripts", "list"],
3936
+ resourcePath: ["scripts"],
2994
3937
  methodName: "list",
2995
3938
  httpMethod: "GET",
2996
- path: "/api/v1/reviews",
2997
- summary: "List Reviews",
3939
+ path: "/api/v1/scripts",
3940
+ summary: "List Organization Scripts",
2998
3941
  flags: [
2999
3942
  {
3000
3943
  name: "organizationId",
@@ -3008,39 +3951,153 @@ var COMMANDS = [
3008
3951
  required: false,
3009
3952
  source: "query"
3010
3953
  },
3011
- {
3012
- name: "marketplace",
3013
- flag: "marketplace",
3014
- required: false,
3015
- source: "query"
3016
- },
3017
3954
  {
3018
3955
  name: "status",
3019
3956
  flag: "status",
3020
3957
  required: false,
3021
3958
  source: "query"
3022
- },
3959
+ }
3960
+ ],
3961
+ acceptsJsonBody: false,
3962
+ acceptsFile: false,
3963
+ bodyRequired: false
3964
+ },
3965
+ {
3966
+ trail: ["scripts", "create"],
3967
+ resourcePath: ["scripts"],
3968
+ methodName: "create",
3969
+ httpMethod: "POST",
3970
+ path: "/api/v1/scripts",
3971
+ summary: "Create Script",
3972
+ flags: [],
3973
+ acceptsJsonBody: true,
3974
+ acceptsFile: false,
3975
+ bodyRequired: true
3976
+ },
3977
+ {
3978
+ trail: ["scripts", "archive"],
3979
+ resourcePath: ["scripts"],
3980
+ methodName: "archive",
3981
+ httpMethod: "DELETE",
3982
+ path: "/api/v1/scripts/{scriptId}",
3983
+ summary: "Archive Script",
3984
+ flags: [
3023
3985
  {
3024
- name: "priority",
3025
- flag: "priority",
3026
- required: false,
3027
- source: "query"
3986
+ name: "scriptId",
3987
+ flag: "script-id",
3988
+ required: true,
3989
+ source: "path"
3028
3990
  },
3029
3991
  {
3030
- name: "store",
3031
- flag: "store",
3992
+ name: "organizationId",
3993
+ flag: "organization-id",
3032
3994
  required: false,
3033
3995
  source: "query"
3996
+ }
3997
+ ],
3998
+ acceptsJsonBody: false,
3999
+ acceptsFile: false,
4000
+ bodyRequired: false
4001
+ },
4002
+ {
4003
+ trail: ["scripts", "get"],
4004
+ resourcePath: ["scripts"],
4005
+ methodName: "get",
4006
+ httpMethod: "GET",
4007
+ path: "/api/v1/scripts/{scriptId}",
4008
+ summary: "Get Script",
4009
+ flags: [
4010
+ {
4011
+ name: "scriptId",
4012
+ flag: "script-id",
4013
+ required: true,
4014
+ source: "path"
3034
4015
  },
3035
4016
  {
3036
- name: "productId",
3037
- flag: "product-id",
4017
+ name: "organizationId",
4018
+ flag: "organization-id",
3038
4019
  required: false,
3039
4020
  source: "query"
4021
+ }
4022
+ ],
4023
+ acceptsJsonBody: false,
4024
+ acceptsFile: false,
4025
+ bodyRequired: false
4026
+ },
4027
+ {
4028
+ trail: ["scripts", "update"],
4029
+ resourcePath: ["scripts"],
4030
+ methodName: "update",
4031
+ httpMethod: "PATCH",
4032
+ path: "/api/v1/scripts/{scriptId}",
4033
+ summary: "Update Script",
4034
+ flags: [
4035
+ {
4036
+ name: "scriptId",
4037
+ flag: "script-id",
4038
+ required: true,
4039
+ source: "path"
4040
+ }
4041
+ ],
4042
+ acceptsJsonBody: true,
4043
+ acceptsFile: false,
4044
+ bodyRequired: true
4045
+ },
4046
+ {
4047
+ trail: ["scripts", "activate"],
4048
+ resourcePath: ["scripts"],
4049
+ methodName: "activate",
4050
+ httpMethod: "POST",
4051
+ path: "/api/v1/scripts/{scriptId}/activate",
4052
+ summary: "Activate Script Version",
4053
+ flags: [
4054
+ {
4055
+ name: "scriptId",
4056
+ flag: "script-id",
4057
+ required: true,
4058
+ source: "path"
4059
+ }
4060
+ ],
4061
+ acceptsJsonBody: true,
4062
+ acceptsFile: false,
4063
+ bodyRequired: true
4064
+ },
4065
+ {
4066
+ trail: ["scripts", "deploy"],
4067
+ resourcePath: ["scripts"],
4068
+ methodName: "deploy",
4069
+ httpMethod: "POST",
4070
+ path: "/api/v1/scripts/{scriptId}/deploy",
4071
+ summary: "Deploy Script",
4072
+ flags: [
4073
+ {
4074
+ name: "scriptId",
4075
+ flag: "script-id",
4076
+ required: true,
4077
+ source: "path"
4078
+ }
4079
+ ],
4080
+ acceptsJsonBody: true,
4081
+ acceptsFile: false,
4082
+ bodyRequired: true
4083
+ },
4084
+ {
4085
+ trail: ["scripts", "list-runs"],
4086
+ resourcePath: ["scripts"],
4087
+ methodName: "listRuns",
4088
+ httpMethod: "GET",
4089
+ path: "/api/v1/scripts/{scriptId}/runs",
4090
+ summary: "List Script Runs",
4091
+ flags: [
4092
+ {
4093
+ name: "scriptId",
4094
+ flag: "script-id",
4095
+ required: true,
4096
+ source: "path"
3040
4097
  },
3041
4098
  {
3042
- name: "sortBy",
3043
- flag: "sort-by",
4099
+ name: "organizationId",
4100
+ flag: "organization-id",
3044
4101
  required: false,
3045
4102
  source: "query"
3046
4103
  },
@@ -3049,12 +4106,6 @@ var COMMANDS = [
3049
4106
  flag: "limit",
3050
4107
  required: false,
3051
4108
  source: "query"
3052
- },
3053
- {
3054
- name: "offset",
3055
- flag: "offset",
3056
- required: false,
3057
- source: "query"
3058
4109
  }
3059
4110
  ],
3060
4111
  acceptsJsonBody: false,
@@ -3062,16 +4113,35 @@ var COMMANDS = [
3062
4113
  bodyRequired: false
3063
4114
  },
3064
4115
  {
3065
- trail: ["reviews", "get"],
3066
- resourcePath: ["reviews"],
3067
- methodName: "get",
4116
+ trail: ["scripts", "execute"],
4117
+ resourcePath: ["scripts"],
4118
+ methodName: "execute",
4119
+ httpMethod: "POST",
4120
+ path: "/api/v1/scripts/{scriptId}/runs",
4121
+ summary: "Execute Script",
4122
+ flags: [
4123
+ {
4124
+ name: "scriptId",
4125
+ flag: "script-id",
4126
+ required: true,
4127
+ source: "path"
4128
+ }
4129
+ ],
4130
+ acceptsJsonBody: true,
4131
+ acceptsFile: false,
4132
+ bodyRequired: true
4133
+ },
4134
+ {
4135
+ trail: ["scripts", "get-source"],
4136
+ resourcePath: ["scripts"],
4137
+ methodName: "getSource",
3068
4138
  httpMethod: "GET",
3069
- path: "/api/v1/reviews/{reviewId}",
3070
- summary: "Get Review",
4139
+ path: "/api/v1/scripts/{scriptId}/source",
4140
+ summary: "Get Script Source",
3071
4141
  flags: [
3072
4142
  {
3073
- name: "reviewId",
3074
- flag: "review-id",
4143
+ name: "scriptId",
4144
+ flag: "script-id",
3075
4145
  required: true,
3076
4146
  source: "path"
3077
4147
  },
@@ -3087,12 +4157,24 @@ var COMMANDS = [
3087
4157
  bodyRequired: false
3088
4158
  },
3089
4159
  {
3090
- trail: ["reviews", "reply"],
3091
- resourcePath: ["reviews"],
3092
- methodName: "reply",
4160
+ trail: ["scripts", "await-runs"],
4161
+ resourcePath: ["scripts"],
4162
+ methodName: "awaitRuns",
4163
+ httpMethod: "POST",
4164
+ path: "/api/v1/scripts/jobs/await",
4165
+ summary: "Read Script Run Results",
4166
+ flags: [],
4167
+ acceptsJsonBody: true,
4168
+ acceptsFile: false,
4169
+ bodyRequired: true
4170
+ },
4171
+ {
4172
+ trail: ["scripts", "cancel-runs"],
4173
+ resourcePath: ["scripts"],
4174
+ methodName: "cancelRuns",
3093
4175
  httpMethod: "POST",
3094
- path: "/api/v1/reviews/reply",
3095
- summary: "Reply to Reviews",
4176
+ path: "/api/v1/scripts/jobs/cancel",
4177
+ summary: "Cancel Script Runs",
3096
4178
  flags: [],
3097
4179
  acceptsJsonBody: true,
3098
4180
  acceptsFile: false,
@@ -3807,7 +4889,7 @@ function printRootHelp(commands) {
3807
4889
 
3808
4890
  Usage:
3809
4891
  omni <resource> <command> [flags]
3810
- omni auth login --api-key omni_sk_...
4892
+ omni auth login
3811
4893
  omni auth status
3812
4894
  omni auth logout
3813
4895
 
@@ -3816,7 +4898,7 @@ ${groups.map((group) => ` ${group}`).join("\n")}
3816
4898
 
3817
4899
  Global flags:
3818
4900
  --api-key <key> API key (or OMNI_API_KEY / omni auth login)
3819
- --base-url <url> API origin (default https://omnicommerce.sg)
4901
+ --base-url <url> API origin (default https://omnicommerce.ai)
3820
4902
  --json <object|-> JSON body, or - to read stdin
3821
4903
  --format json|table Output format (table on TTY, json when piped)
3822
4904
  --dry-run Print the request without sending it
@@ -3831,6 +4913,16 @@ Examples:
3831
4913
  omni jobs wait --job-id prod_123
3832
4914
  `;
3833
4915
  }
4916
+ function printAuthHelp() {
4917
+ return `Usage:
4918
+ omni auth login Sign in using your browser
4919
+ omni auth login --no-browser Print the login URL without opening it
4920
+ omni auth login --api-key <key> Save an existing API key
4921
+ omni auth login --base-url <origin> Sign in to another API origin
4922
+ omni auth status Show saved credential status
4923
+ omni auth logout Remove saved credentials
4924
+ `;
4925
+ }
3834
4926
  function printCommandHelp(command) {
3835
4927
  const flags = command.flags.map((flag) => {
3836
4928
  const req = flag.required ? "required" : "optional";
@@ -3857,9 +4949,6 @@ function matchCommands(commands, trail) {
3857
4949
  return { exact, prefix };
3858
4950
  }
3859
4951
 
3860
- // src/version.ts
3861
- var CLI_VERSION = "0.8.0";
3862
-
3863
4952
  // src/run.ts
3864
4953
  async function readStdin() {
3865
4954
  const chunks = [];
@@ -3891,21 +4980,26 @@ function buildRequest(command, flags, body) {
3891
4980
  }
3892
4981
  return request;
3893
4982
  }
3894
- async function handleAuth(trail, flags) {
4983
+ async function handleAuth(trail, flags, options) {
3895
4984
  const action = trail[1] ?? "status";
3896
4985
  if (action === "login") {
3897
- const apiKey = flagString(flags, "api-key");
3898
- if (!apiKey) {
3899
- throw new Error("omni auth login requires --api-key");
3900
- }
3901
4986
  const existing = await readConfig();
3902
- await writeConfig({
3903
- ...existing,
4987
+ const apiKey = flagString(flags, "api-key");
4988
+ const credentials = apiKey ? {
3904
4989
  apiKey,
3905
4990
  baseUrl: flagString(flags, "base-url") ?? existing.baseUrl
4991
+ } : await browserLogin(
4992
+ (await resolveCredentials({
4993
+ baseUrl: flagString(flags, "base-url")
4994
+ })).baseUrl,
4995
+ { ...options, noBrowser: flags["no-browser"] === true }
4996
+ );
4997
+ await writeConfig({
4998
+ ...existing,
4999
+ ...credentials
3906
5000
  });
3907
5001
  process.stdout.write(
3908
- `Saved credentials to config (${maskSecret(apiKey)})
5002
+ `Saved credentials to config (${maskSecret(credentials.apiKey)})
3909
5003
  `
3910
5004
  );
3911
5005
  return 0;
@@ -3915,6 +5009,7 @@ async function handleAuth(trail, flags) {
3915
5009
  process.stdout.write("Removed saved credentials\n");
3916
5010
  return 0;
3917
5011
  }
5012
+ if (action !== "status") throw new Error(`Unknown auth command: ${action}`);
3918
5013
  const resolved = await resolveCredentials({
3919
5014
  apiKey: flagString(flags, "api-key"),
3920
5015
  baseUrl: flagString(flags, "base-url")
@@ -3935,7 +5030,11 @@ async function runCli(argv, options) {
3935
5030
  return 0;
3936
5031
  }
3937
5032
  if (parsed.trail[0] === "auth") {
3938
- return handleAuth(parsed.trail, parsed.flags);
5033
+ if (parsed.help) {
5034
+ process.stdout.write(printAuthHelp());
5035
+ return 0;
5036
+ }
5037
+ return handleAuth(parsed.trail, parsed.flags, options);
3939
5038
  }
3940
5039
  if (parsed.trail.length === 0) {
3941
5040
  process.stdout.write(printRootHelp(COMMANDS));