@omni-commerce/cli 0.21.0 → 0.24.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
@@ -84,7 +84,7 @@ async function openBrowser(url) {
84
84
  }
85
85
 
86
86
  // src/version.ts
87
- var CLI_VERSION = "0.21.0";
87
+ var CLI_VERSION = "0.24.0";
88
88
 
89
89
  // src/browser-login.ts
90
90
  function loginOrigin(baseUrl) {
@@ -434,6 +434,267 @@ var COMMANDS = [
434
434
  acceptsFile: false,
435
435
  bodyRequired: true
436
436
  },
437
+ {
438
+ trail: ["ads", "list-accounts"],
439
+ resourcePath: ["ads"],
440
+ methodName: "listAccounts",
441
+ httpMethod: "GET",
442
+ path: "/api/v1/ads/accounts",
443
+ summary: "List Ads accounts and capabilities",
444
+ description: "Requires ads:read. Every target is organization/store scoped. Partial failures are explicit in data.success and ordered results. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.",
445
+ flags: [
446
+ {
447
+ name: "marketplaces",
448
+ flag: "marketplaces",
449
+ required: false,
450
+ source: "query"
451
+ },
452
+ {
453
+ name: "organizationId",
454
+ flag: "organization-id",
455
+ required: false,
456
+ source: "query"
457
+ }
458
+ ],
459
+ acceptsJsonBody: false,
460
+ acceptsFile: false,
461
+ bodyRequired: false
462
+ },
463
+ {
464
+ trail: ["ads", "list-campaigns"],
465
+ resourcePath: ["ads"],
466
+ methodName: "listCampaigns",
467
+ httpMethod: "GET",
468
+ path: "/api/v1/ads/campaigns",
469
+ summary: "List saved and synced ads",
470
+ description: "Requires ads:read. Every target is organization/store scoped. Partial failures are explicit in data.success and ordered results. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.",
471
+ flags: [
472
+ {
473
+ name: "status",
474
+ flag: "status",
475
+ required: false,
476
+ source: "query"
477
+ },
478
+ {
479
+ name: "q",
480
+ flag: "q",
481
+ required: false,
482
+ source: "query"
483
+ },
484
+ {
485
+ name: "marketplace",
486
+ flag: "marketplace",
487
+ required: false,
488
+ source: "query"
489
+ },
490
+ {
491
+ name: "store",
492
+ flag: "store",
493
+ required: false,
494
+ source: "query"
495
+ },
496
+ {
497
+ name: "offset",
498
+ flag: "offset",
499
+ required: false,
500
+ source: "query"
501
+ },
502
+ {
503
+ name: "organizationId",
504
+ flag: "organization-id",
505
+ required: false,
506
+ source: "query"
507
+ }
508
+ ],
509
+ acceptsJsonBody: false,
510
+ acceptsFile: false,
511
+ bodyRequired: false
512
+ },
513
+ {
514
+ trail: ["ads", "create-campaign"],
515
+ resourcePath: ["ads"],
516
+ methodName: "createCampaign",
517
+ httpMethod: "POST",
518
+ path: "/api/v1/ads/campaigns",
519
+ summary: "Draft a multi-store Ads campaign",
520
+ description: "Requires ads:write. Every target is organization/store scoped. Partial failures are explicit in data.success and ordered results. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.",
521
+ flags: [],
522
+ acceptsJsonBody: true,
523
+ acceptsFile: false,
524
+ bodyRequired: true
525
+ },
526
+ {
527
+ trail: ["ads", "act-on-campaigns"],
528
+ resourcePath: ["ads"],
529
+ methodName: "actOnCampaigns",
530
+ httpMethod: "POST",
531
+ path: "/api/v1/ads/campaigns/actions",
532
+ summary: "Approve, stop or retry Ads campaign groups",
533
+ description: "Requires ads:approve. Every target is organization/store scoped. Accepted work runs durably; inspect per-target outcomes and returned planIds/jobIds until verified. Approval uses saved immutable seller budgets and schedules. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.",
534
+ flags: [],
535
+ acceptsJsonBody: true,
536
+ acceptsFile: false,
537
+ bodyRequired: true
538
+ },
539
+ {
540
+ trail: ["ads", "get-live-campaigns"],
541
+ resourcePath: ["ads"],
542
+ methodName: "getLiveCampaigns",
543
+ httpMethod: "POST",
544
+ path: "/api/v1/ads/campaigns/live",
545
+ summary: "Read live marketplace campaigns",
546
+ description: "Requires ads:read. Every target is organization/store scoped. Partial failures are explicit in data.success and ordered results. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.",
547
+ flags: [],
548
+ acceptsJsonBody: true,
549
+ acceptsFile: false,
550
+ bodyRequired: true
551
+ },
552
+ {
553
+ trail: ["ads", "get-campaigns"],
554
+ resourcePath: ["ads"],
555
+ methodName: "getCampaigns",
556
+ httpMethod: "POST",
557
+ path: "/api/v1/ads/campaigns/read",
558
+ summary: "Read saved Ads campaign groups",
559
+ description: "Requires ads:read. Every target is organization/store scoped. Partial failures are explicit in data.success and ordered results. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.",
560
+ flags: [],
561
+ acceptsJsonBody: true,
562
+ acceptsFile: false,
563
+ bodyRequired: true
564
+ },
565
+ {
566
+ trail: ["ads", "get-performance"],
567
+ resourcePath: ["ads"],
568
+ methodName: "getPerformance",
569
+ httpMethod: "POST",
570
+ path: "/api/v1/ads/performance",
571
+ summary: "Read live Ads performance",
572
+ description: "Requires ads:read. Every target is organization/store scoped. Partial failures are explicit in data.success and ordered results. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.",
573
+ flags: [],
574
+ acceptsJsonBody: true,
575
+ acceptsFile: false,
576
+ bodyRequired: true
577
+ },
578
+ {
579
+ trail: ["ads", "act-on-plans"],
580
+ resourcePath: ["ads"],
581
+ methodName: "actOnPlans",
582
+ httpMethod: "POST",
583
+ path: "/api/v1/ads/plans/actions",
584
+ summary: "Approve, stop or retry legacy Ads plans",
585
+ description: "Requires ads:approve. Every target is organization/store scoped. Accepted work runs durably; inspect per-target outcomes and returned planIds/jobIds until verified. Approval uses saved immutable seller budgets and schedules. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.",
586
+ flags: [],
587
+ acceptsJsonBody: true,
588
+ acceptsFile: false,
589
+ bodyRequired: true
590
+ },
591
+ {
592
+ trail: ["ads", "get-plans"],
593
+ resourcePath: ["ads"],
594
+ methodName: "getPlans",
595
+ httpMethod: "POST",
596
+ path: "/api/v1/ads/plans/status",
597
+ summary: "Read delivery and verification evidence",
598
+ description: "Requires ads:read. Every target is organization/store scoped. Partial failures are explicit in data.success and ordered results. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.",
599
+ flags: [],
600
+ acceptsJsonBody: true,
601
+ acceptsFile: false,
602
+ bodyRequired: true
603
+ },
604
+ {
605
+ trail: ["ads", "get-reports"],
606
+ resourcePath: ["ads"],
607
+ methodName: "getReports",
608
+ httpMethod: "GET",
609
+ path: "/api/v1/ads/reports",
610
+ summary: "Read persisted campaign reports",
611
+ description: "Requires ads:read. Every target is organization/store scoped. Partial failures are explicit in data.success and ordered results. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.",
612
+ flags: [
613
+ {
614
+ name: "from",
615
+ flag: "from",
616
+ required: true,
617
+ source: "query"
618
+ },
619
+ {
620
+ name: "to",
621
+ flag: "to",
622
+ required: true,
623
+ source: "query"
624
+ },
625
+ {
626
+ name: "marketplace",
627
+ flag: "marketplace",
628
+ required: false,
629
+ source: "query"
630
+ },
631
+ {
632
+ name: "country",
633
+ flag: "country",
634
+ required: false,
635
+ source: "query"
636
+ },
637
+ {
638
+ name: "store",
639
+ flag: "store",
640
+ required: false,
641
+ source: "query"
642
+ },
643
+ {
644
+ name: "currency",
645
+ flag: "currency",
646
+ required: false,
647
+ source: "query"
648
+ },
649
+ {
650
+ name: "campaign",
651
+ flag: "campaign",
652
+ required: false,
653
+ source: "query"
654
+ },
655
+ {
656
+ name: "offset",
657
+ flag: "offset",
658
+ required: false,
659
+ source: "query"
660
+ },
661
+ {
662
+ name: "organizationId",
663
+ flag: "organization-id",
664
+ required: false,
665
+ source: "query"
666
+ }
667
+ ],
668
+ acceptsJsonBody: false,
669
+ acceptsFile: false,
670
+ bodyRequired: false
671
+ },
672
+ {
673
+ trail: ["ads", "sync-reports"],
674
+ resourcePath: ["ads"],
675
+ methodName: "syncReports",
676
+ httpMethod: "POST",
677
+ path: "/api/v1/ads/sync",
678
+ summary: "Queue Ads report imports",
679
+ description: "Requires ads:read. Every target is organization/store scoped. Accepted work runs durably; inspect per-target outcomes and returned planIds/jobIds until verified. Approval uses saved immutable seller budgets and schedules. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.",
680
+ flags: [],
681
+ acceptsJsonBody: true,
682
+ acceptsFile: false,
683
+ bodyRequired: true
684
+ },
685
+ {
686
+ trail: ["ads", "get-sync-status"],
687
+ resourcePath: ["ads"],
688
+ methodName: "getSyncStatus",
689
+ httpMethod: "POST",
690
+ path: "/api/v1/ads/sync/status",
691
+ summary: "Read Ads import job status",
692
+ description: "Requires ads:read. Every target is organization/store scoped. Partial failures are explicit in data.success and ordered results. Shopee and Lazada support only the formats returned by accounts. Other marketplaces report a concrete limitation. External campaign IDs differ from saved campaign group UUIDs.",
693
+ flags: [],
694
+ acceptsJsonBody: true,
695
+ acceptsFile: false,
696
+ bodyRequired: true
697
+ },
437
698
  {
438
699
  trail: ["agents", "invoke"],
439
700
  resourcePath: ["agents"],
@@ -1356,6 +1617,200 @@ var COMMANDS = [
1356
1617
  acceptsFile: false,
1357
1618
  bodyRequired: true
1358
1619
  },
1620
+ {
1621
+ trail: ["bots", "list"],
1622
+ resourcePath: ["bots"],
1623
+ methodName: "list",
1624
+ httpMethod: "GET",
1625
+ path: "/api/v1/bots",
1626
+ summary: "List personal Bots",
1627
+ description: "Requires agents:invoke and assistant.use. Use a signed-in member session or a member's CLI token. Organization OAuth and Computer credentials cannot access personal Bots.",
1628
+ flags: [
1629
+ {
1630
+ name: "organizationId",
1631
+ flag: "organization-id",
1632
+ required: false,
1633
+ source: "query"
1634
+ },
1635
+ {
1636
+ name: "q",
1637
+ flag: "q",
1638
+ required: false,
1639
+ source: "query"
1640
+ },
1641
+ {
1642
+ name: "page",
1643
+ flag: "page",
1644
+ required: false,
1645
+ source: "query"
1646
+ },
1647
+ {
1648
+ name: "status",
1649
+ flag: "status",
1650
+ required: false,
1651
+ source: "query"
1652
+ }
1653
+ ],
1654
+ acceptsJsonBody: false,
1655
+ acceptsFile: false,
1656
+ bodyRequired: false
1657
+ },
1658
+ {
1659
+ trail: ["bots", "create"],
1660
+ resourcePath: ["bots"],
1661
+ methodName: "create",
1662
+ httpMethod: "POST",
1663
+ path: "/api/v1/bots",
1664
+ summary: "Create a personal Bot",
1665
+ description: "Requires agents:invoke and assistant.use. Use a signed-in member session or a member's CLI token. Organization OAuth and Computer credentials cannot access personal Bots.",
1666
+ flags: [
1667
+ {
1668
+ name: "organizationId",
1669
+ flag: "organization-id",
1670
+ required: false,
1671
+ source: "query"
1672
+ }
1673
+ ],
1674
+ acceptsJsonBody: true,
1675
+ acceptsFile: false,
1676
+ bodyRequired: true
1677
+ },
1678
+ {
1679
+ trail: ["bots", "list-routines"],
1680
+ resourcePath: ["bots"],
1681
+ methodName: "listRoutines",
1682
+ httpMethod: "GET",
1683
+ path: "/api/v1/bots/{botId}/routines",
1684
+ summary: "List a Bot's routines",
1685
+ description: "Requires agents:invoke and assistant.use. Use a signed-in member session or a member's CLI token. Organization OAuth and Computer credentials cannot access personal Bots.",
1686
+ flags: [
1687
+ {
1688
+ name: "botId",
1689
+ flag: "bot-id",
1690
+ required: true,
1691
+ source: "path"
1692
+ },
1693
+ {
1694
+ name: "organizationId",
1695
+ flag: "organization-id",
1696
+ required: false,
1697
+ source: "query"
1698
+ }
1699
+ ],
1700
+ acceptsJsonBody: false,
1701
+ acceptsFile: false,
1702
+ bodyRequired: false
1703
+ },
1704
+ {
1705
+ trail: ["bots", "mutate-routines"],
1706
+ resourcePath: ["bots"],
1707
+ methodName: "mutateRoutines",
1708
+ httpMethod: "POST",
1709
+ path: "/api/v1/bots/{botId}/routines",
1710
+ summary: "Manage a Bot's routines",
1711
+ description: "Requires agents:invoke and assistant.use. Use a signed-in member session or a member's CLI token. Organization OAuth and Computer credentials cannot access personal Bots.\n\nCreate, edit, link, pause, resume, delete, test, or run a batch of routines. New personal routines start paused. Reuse the same requestId only when retrying the same request. Inspect every ordered result before retrying failed targets.",
1712
+ flags: [
1713
+ {
1714
+ name: "botId",
1715
+ flag: "bot-id",
1716
+ required: true,
1717
+ source: "path"
1718
+ },
1719
+ {
1720
+ name: "organizationId",
1721
+ flag: "organization-id",
1722
+ required: false,
1723
+ source: "query"
1724
+ }
1725
+ ],
1726
+ acceptsJsonBody: true,
1727
+ acceptsFile: false,
1728
+ bodyRequired: true
1729
+ },
1730
+ {
1731
+ trail: ["bots", "list-runs"],
1732
+ resourcePath: ["bots"],
1733
+ methodName: "listRuns",
1734
+ httpMethod: "GET",
1735
+ path: "/api/v1/bots/{botId}/runs",
1736
+ summary: "List a Bot's message runs",
1737
+ description: "Requires agents:invoke and assistant.use. Use a signed-in member session or a member's CLI token. Organization OAuth and Computer credentials cannot access personal Bots.",
1738
+ flags: [
1739
+ {
1740
+ name: "botId",
1741
+ flag: "bot-id",
1742
+ required: true,
1743
+ source: "path"
1744
+ },
1745
+ {
1746
+ name: "organizationId",
1747
+ flag: "organization-id",
1748
+ required: false,
1749
+ source: "query"
1750
+ }
1751
+ ],
1752
+ acceptsJsonBody: false,
1753
+ acceptsFile: false,
1754
+ bodyRequired: false
1755
+ },
1756
+ {
1757
+ trail: ["bots", "send-message"],
1758
+ resourcePath: ["bots"],
1759
+ methodName: "sendMessage",
1760
+ httpMethod: "POST",
1761
+ path: "/api/v1/bots/{botId}/runs",
1762
+ summary: "Send a message to a Bot",
1763
+ description: "Requires agents:invoke and assistant.use. Use a signed-in member session or a member's CLI token. Organization OAuth and Computer credentials cannot access personal Bots.\n\nReuse the same requestId when retrying a submission. The response Location points to the run status.",
1764
+ flags: [
1765
+ {
1766
+ name: "botId",
1767
+ flag: "bot-id",
1768
+ required: true,
1769
+ source: "path"
1770
+ },
1771
+ {
1772
+ name: "organizationId",
1773
+ flag: "organization-id",
1774
+ required: false,
1775
+ source: "query"
1776
+ }
1777
+ ],
1778
+ acceptsJsonBody: true,
1779
+ acceptsFile: false,
1780
+ bodyRequired: true
1781
+ },
1782
+ {
1783
+ trail: ["bots", "get-run"],
1784
+ resourcePath: ["bots"],
1785
+ methodName: "getRun",
1786
+ httpMethod: "GET",
1787
+ path: "/api/v1/bots/{botId}/runs/{runId}",
1788
+ summary: "Read a Bot message run",
1789
+ description: "Requires agents:invoke and assistant.use. Use a signed-in member session or a member's CLI token. Organization OAuth and Computer credentials cannot access personal Bots.\n\nReturns the run's status, visible reply, and approval URL when available. Archived runs retain their status. Reopen their conversation to read the reply after the active run journal expires.",
1790
+ flags: [
1791
+ {
1792
+ name: "botId",
1793
+ flag: "bot-id",
1794
+ required: true,
1795
+ source: "path"
1796
+ },
1797
+ {
1798
+ name: "runId",
1799
+ flag: "run-id",
1800
+ required: true,
1801
+ source: "path"
1802
+ },
1803
+ {
1804
+ name: "organizationId",
1805
+ flag: "organization-id",
1806
+ required: false,
1807
+ source: "query"
1808
+ }
1809
+ ],
1810
+ acceptsJsonBody: false,
1811
+ acceptsFile: false,
1812
+ bodyRequired: false
1813
+ },
1359
1814
  {
1360
1815
  trail: ["brand-kits", "list"],
1361
1816
  resourcePath: ["brandKits"],
@@ -1974,6 +2429,106 @@ var COMMANDS = [
1974
2429
  acceptsFile: false,
1975
2430
  bodyRequired: true
1976
2431
  },
2432
+ {
2433
+ trail: ["bulk", "plan"],
2434
+ resourcePath: ["bulk"],
2435
+ methodName: "plan",
2436
+ httpMethod: "POST",
2437
+ path: "/api/v1/catalog/operations/plan",
2438
+ summary: "Create Catalog Operation Plan",
2439
+ description: "Create a staged pricing, catalog record import, or reviewable enrichment plan for up to one million targets. Add enrichment options for listing copy, images, or store taxonomy, or importRecords for new catalog records. Set importRecords.update on a file plan to prepare exact-SKU price or warehouse stock updates for review. An optional selection filter prepares an enrichment plan server-side. Poll status until draft, review the total, and explicitly submit. Repeat the original create request after an interruption. If the selection exceeds the limit, narrow the filters and create a new plan. The initiating identity can upload ordered chunks and submit the plan when complete. Reusing the same idempotency key and options resumes that plan. Requires catalog:write and catalog:read. Enrichment also requires catalog:enrich. Marketplace price sync also requires catalog:sync.",
2440
+ flags: [
2441
+ {
2442
+ name: "organizationId",
2443
+ flag: "organization-id",
2444
+ required: false,
2445
+ source: "query"
2446
+ }
2447
+ ],
2448
+ acceptsJsonBody: true,
2449
+ acceptsFile: false,
2450
+ bodyRequired: true
2451
+ },
2452
+ {
2453
+ trail: ["bulk", "append"],
2454
+ resourcePath: ["bulk"],
2455
+ methodName: "append",
2456
+ httpMethod: "POST",
2457
+ path: "/api/v1/catalog/operations/plan/append",
2458
+ summary: "Append Catalog Operation Chunk",
2459
+ description: "Upload up to 500 distinct targets at the next chunkIndex, starting at zero. Provide updates for pricing, productIds for enrichment, or products for record imports. Each product belongs to one chunk. Replaying the same chunk index and content is safe and returns the latest upload progress. Pricing captures product versions when targets are appended. Enrichment receipts identify the linked review and report when generation reaches review. Requires catalog:write.",
2460
+ flags: [
2461
+ {
2462
+ name: "organizationId",
2463
+ flag: "organization-id",
2464
+ required: false,
2465
+ source: "query"
2466
+ }
2467
+ ],
2468
+ acceptsJsonBody: true,
2469
+ acceptsFile: false,
2470
+ bodyRequired: true
2471
+ },
2472
+ {
2473
+ trail: ["bulk", "complete-file"],
2474
+ resourcePath: ["bulk"],
2475
+ methodName: "completeFile",
2476
+ httpMethod: "POST",
2477
+ path: "/api/v1/catalog/operations/plan/file-complete",
2478
+ summary: "Complete Catalog File",
2479
+ description: "Queue validation and import after all file parts are uploaded. For importRecords.update, validation ends at ready_for_review. Read the ordered preview with bulk.results and submit explicitly with expectedProductCount. For create-only file imports, validation queues the import automatically. Then follow the same operation in bulk.status and bulk.results. Repeat this request after a retryable interruption. Requires catalog:read and catalog:write.",
2480
+ flags: [
2481
+ {
2482
+ name: "organizationId",
2483
+ flag: "organization-id",
2484
+ required: false,
2485
+ source: "query"
2486
+ }
2487
+ ],
2488
+ acceptsJsonBody: true,
2489
+ acceptsFile: false,
2490
+ bodyRequired: true
2491
+ },
2492
+ {
2493
+ trail: ["bulk", "file-parts"],
2494
+ resourcePath: ["bulk"],
2495
+ methodName: "fileParts",
2496
+ httpMethod: "POST",
2497
+ path: "/api/v1/catalog/operations/plan/file-parts",
2498
+ summary: "Prepare Catalog File Parts",
2499
+ description: "Request signed PUT URLs for up to eight file parts. Each is 8 MiB except the final part. Send the exact bytes and x-amz-checksum-sha256 header to the signed URL. Previously uploaded matching parts are skipped. Requires catalog:read and catalog:write.",
2500
+ flags: [
2501
+ {
2502
+ name: "organizationId",
2503
+ flag: "organization-id",
2504
+ required: false,
2505
+ source: "query"
2506
+ }
2507
+ ],
2508
+ acceptsJsonBody: true,
2509
+ acceptsFile: false,
2510
+ bodyRequired: true
2511
+ },
2512
+ {
2513
+ trail: ["bulk", "submit"],
2514
+ resourcePath: ["bulk"],
2515
+ methodName: "submit",
2516
+ httpMethod: "POST",
2517
+ path: "/api/v1/catalog/operations/plan/submit",
2518
+ summary: "Submit Catalog Operation Plan",
2519
+ description: "Seal and queue the uploaded plan if its product count matches expectedProductCount. Retry the same request if admission is interrupted. Use bulk.status and bulk.results for progress and receipts. Requires the same scopes as plan creation.",
2520
+ flags: [
2521
+ {
2522
+ name: "organizationId",
2523
+ flag: "organization-id",
2524
+ required: false,
2525
+ source: "query"
2526
+ }
2527
+ ],
2528
+ acceptsJsonBody: true,
2529
+ acceptsFile: false,
2530
+ bodyRequired: true
2531
+ },
1977
2532
  {
1978
2533
  trail: ["bulk", "results"],
1979
2534
  resourcePath: ["bulk"],
@@ -1981,7 +2536,7 @@ var COMMANDS = [
1981
2536
  httpMethod: "POST",
1982
2537
  path: "/api/v1/catalog/operations/results",
1983
2538
  summary: "Get Catalog Operation Results",
1984
- description: "Read ordered per-product receipts and verification evidence for up to 50 operationIds. Filter status=failed to inspect failures directly. At most 100 rows across the requested operations per page. Requires catalog:read.",
2539
+ description: "Read ordered per-product receipts and verification evidence for up to 50 operationIds. Filter status=failed to inspect failures directly. Pass nextPageKey as after on the next request, keeping the operation order and status filter the same. At most 100 rows per page. Requires catalog:read.",
1985
2540
  flags: [],
1986
2541
  acceptsJsonBody: true,
1987
2542
  acceptsFile: false,
@@ -1994,7 +2549,7 @@ var COMMANDS = [
1994
2549
  httpMethod: "POST",
1995
2550
  path: "/api/v1/catalog/operations/status",
1996
2551
  summary: "Get Catalog Operation Status",
1997
- description: "Read compact progress for up to 50 operationIds in first-requested order. Pending is incomplete, and partial failures remain explicit. Requires catalog:read. Detailed receipts are returned only by the paginated report API.",
2552
+ description: "Read compact progress for up to 50 operationIds in first-requested order. Draft plans are still accepting input. A file update at ready_for_review requires approval via bulk.submit. Pending is incomplete, and partial failures remain explicit. Requires catalog:read. Detailed receipts are returned by the paginated results API.",
1998
2553
  flags: [],
1999
2554
  acceptsJsonBody: true,
2000
2555
  acceptsFile: false,
@@ -2352,6 +2907,19 @@ var COMMANDS = [
2352
2907
  acceptsFile: false,
2353
2908
  bodyRequired: true
2354
2909
  },
2910
+ {
2911
+ trail: ["email", "get-drafts"],
2912
+ resourcePath: ["email"],
2913
+ methodName: "getDrafts",
2914
+ httpMethod: "POST",
2915
+ path: "/api/v1/email/drafts/query",
2916
+ summary: "Get Email Drafts",
2917
+ description: "Read exact unsent drafts in one connected mailbox. Pass one to twenty draft resource IDs, in request order. Duplicate IDs are read once. The result includes a per-draft outcome for every distinct ID.\n\n### Authorization\n\nRequires `email:read` and the integration permission the matching chat tool needs, with a person's credential: a CLI login, a signed-in session, or the SDK key inside your own chat sandbox. Only your own connected mailboxes are reachable; another account's `connectionId` is refused.",
2918
+ flags: [],
2919
+ acceptsJsonBody: true,
2920
+ acceptsFile: false,
2921
+ bodyRequired: true
2922
+ },
2355
2923
  {
2356
2924
  trail: ["email", "get-message"],
2357
2925
  resourcePath: ["email"],
@@ -2412,14 +2980,46 @@ var COMMANDS = [
2412
2980
  source: "query"
2413
2981
  },
2414
2982
  {
2415
- name: "pageToken",
2416
- flag: "page-token",
2417
- required: false,
2418
- source: "query"
2983
+ name: "pageToken",
2984
+ flag: "page-token",
2985
+ required: false,
2986
+ source: "query"
2987
+ },
2988
+ {
2989
+ name: "readState",
2990
+ flag: "read-state",
2991
+ required: false,
2992
+ source: "query"
2993
+ },
2994
+ {
2995
+ name: "organizationId",
2996
+ flag: "organization-id",
2997
+ required: false,
2998
+ source: "query"
2999
+ }
3000
+ ],
3001
+ acceptsJsonBody: false,
3002
+ acceptsFile: false,
3003
+ bodyRequired: false
3004
+ },
3005
+ {
3006
+ trail: ["email", "get-thread"],
3007
+ resourcePath: ["email"],
3008
+ methodName: "getThread",
3009
+ httpMethod: "GET",
3010
+ path: "/api/v1/email/threads/{threadId}",
3011
+ summary: "Get Email Thread",
3012
+ description: "Read the Gmail or Outlook conversation for a `threadId` from Search Emails. Each message includes headers, up to 8,000 characters of plain text, and read and draft state.\n\n### Authorization\n\nRequires `email:read` and the integration permission the matching chat tool needs, with a person's credential: a CLI login, a signed-in session, or the SDK key inside your own chat sandbox. Only your own connected mailboxes are reachable; another account's `connectionId` is refused.",
3013
+ flags: [
3014
+ {
3015
+ name: "threadId",
3016
+ flag: "thread-id",
3017
+ required: true,
3018
+ source: "path"
2419
3019
  },
2420
3020
  {
2421
- name: "readState",
2422
- flag: "read-state",
3021
+ name: "connectionId",
3022
+ flag: "connection-id",
2423
3023
  required: false,
2424
3024
  source: "query"
2425
3025
  },
@@ -4842,6 +5442,217 @@ var COMMANDS = [
4842
5442
  acceptsFile: false,
4843
5443
  bodyRequired: false
4844
5444
  },
5445
+ {
5446
+ trail: ["review-queue", "list"],
5447
+ resourcePath: ["reviewQueue"],
5448
+ methodName: "list",
5449
+ httpMethod: "GET",
5450
+ path: "/api/v1/review-queue",
5451
+ summary: "List Review Queue Jobs",
5452
+ description: "Requires `catalog:read`.\n\nLists the same jobs as the Review queue, including outstanding bulk imports and updates before their product proposals exist. Use workflow, status, query, and date filters with limit and offset. Date-only bounds are inclusive calendar dates in timeZone (defaults to the session time zone or Asia/Singapore).",
5453
+ flags: [
5454
+ {
5455
+ name: "organizationId",
5456
+ flag: "organization-id",
5457
+ required: false,
5458
+ source: "query"
5459
+ },
5460
+ {
5461
+ name: "workflow",
5462
+ flag: "workflow",
5463
+ required: false,
5464
+ source: "query"
5465
+ },
5466
+ {
5467
+ name: "status",
5468
+ flag: "status",
5469
+ required: false,
5470
+ source: "query"
5471
+ },
5472
+ {
5473
+ name: "query",
5474
+ flag: "query",
5475
+ required: false,
5476
+ source: "query"
5477
+ },
5478
+ {
5479
+ name: "sortBy",
5480
+ flag: "sort-by",
5481
+ required: false,
5482
+ source: "query"
5483
+ },
5484
+ {
5485
+ name: "limit",
5486
+ flag: "limit",
5487
+ required: false,
5488
+ source: "query"
5489
+ },
5490
+ {
5491
+ name: "offset",
5492
+ flag: "offset",
5493
+ required: false,
5494
+ source: "query"
5495
+ },
5496
+ {
5497
+ name: "enrichmentStatus",
5498
+ flag: "enrichment-status",
5499
+ required: false,
5500
+ source: "query"
5501
+ },
5502
+ {
5503
+ name: "dateFrom",
5504
+ flag: "date-from",
5505
+ required: false,
5506
+ source: "query"
5507
+ },
5508
+ {
5509
+ name: "dateTo",
5510
+ flag: "date-to",
5511
+ required: false,
5512
+ source: "query"
5513
+ },
5514
+ {
5515
+ name: "timeZone",
5516
+ flag: "time-zone",
5517
+ required: false,
5518
+ source: "query"
5519
+ }
5520
+ ],
5521
+ acceptsJsonBody: false,
5522
+ acceptsFile: false,
5523
+ bodyRequired: false
5524
+ },
5525
+ {
5526
+ trail: ["review-queue", "get"],
5527
+ resourcePath: ["reviewQueue"],
5528
+ methodName: "get",
5529
+ httpMethod: "GET",
5530
+ path: "/api/v1/review-queue/{batchId}",
5531
+ summary: "Get Review Queue Job",
5532
+ description: "Requires `catalog:read`.\n\nReturns an AI product review job, including its linked review scopes. The queue parameter selects a product subset in queueSelection. Pass itemId to also read one saved proposal and its issues. Use the import workflow status API for entries with importJob.",
5533
+ flags: [
5534
+ {
5535
+ name: "batchId",
5536
+ flag: "batch-id",
5537
+ required: true,
5538
+ source: "path"
5539
+ },
5540
+ {
5541
+ name: "organizationId",
5542
+ flag: "organization-id",
5543
+ required: false,
5544
+ source: "query"
5545
+ },
5546
+ {
5547
+ name: "itemId",
5548
+ flag: "item-id",
5549
+ required: false,
5550
+ source: "query"
5551
+ },
5552
+ {
5553
+ name: "queue",
5554
+ flag: "queue",
5555
+ required: false,
5556
+ source: "query"
5557
+ }
5558
+ ],
5559
+ acceptsJsonBody: false,
5560
+ acceptsFile: false,
5561
+ bodyRequired: false
5562
+ },
5563
+ {
5564
+ trail: ["review-queue", "update"],
5565
+ resourcePath: ["reviewQueue"],
5566
+ methodName: "update",
5567
+ httpMethod: "PATCH",
5568
+ path: "/api/v1/review-queue/{batchId}",
5569
+ summary: "Rename Review Queue Job",
5570
+ description: "Requires `catalog:write`.\n\nUse an empty title to restore the default display title.",
5571
+ flags: [
5572
+ {
5573
+ name: "batchId",
5574
+ flag: "batch-id",
5575
+ required: true,
5576
+ source: "path"
5577
+ }
5578
+ ],
5579
+ acceptsJsonBody: true,
5580
+ acceptsFile: false,
5581
+ bodyRequired: true
5582
+ },
5583
+ {
5584
+ trail: ["review-queue", "approve"],
5585
+ resourcePath: ["reviewQueue"],
5586
+ methodName: "approve",
5587
+ httpMethod: "POST",
5588
+ path: "/api/v1/review-queue/{batchId}/approve",
5589
+ summary: "Approve Review Queue Items",
5590
+ description: "Requires `catalog:write`.\n\nApplies up to 100 explicitly selected review item IDs from the job and its linked batches. Approves the saved proposals through the catalog's normal stale-product and gallery checks. Set allowProductChangedOverride explicitly to approve despite an intervening product change. Already applied items are safe to resubmit. Call the publish endpoint separately to release approved changes.",
5591
+ flags: [
5592
+ {
5593
+ name: "batchId",
5594
+ flag: "batch-id",
5595
+ required: true,
5596
+ source: "path"
5597
+ }
5598
+ ],
5599
+ acceptsJsonBody: true,
5600
+ acceptsFile: false,
5601
+ bodyRequired: true
5602
+ },
5603
+ {
5604
+ trail: ["review-queue", "publish"],
5605
+ resourcePath: ["reviewQueue"],
5606
+ methodName: "publish",
5607
+ httpMethod: "POST",
5608
+ path: "/api/v1/review-queue/{batchId}/publish",
5609
+ summary: "Publish Review Queue Products",
5610
+ description: "Requires `catalog:sync`.\n\nSpecify productIds and visibility. Only products with all review scopes applied and outstanding releases to assigned marketplace stores are eligible. Optionally filter by marketplaces. Inspect every product and listing result for preparation failures. HTTP 202 confirms queue acceptance. Pass every returned correlation to POST /api/v1/commerce/jobs/await to check marketplace outcomes.",
5611
+ flags: [
5612
+ {
5613
+ name: "batchId",
5614
+ flag: "batch-id",
5615
+ required: true,
5616
+ source: "path"
5617
+ }
5618
+ ],
5619
+ acceptsJsonBody: true,
5620
+ acceptsFile: false,
5621
+ bodyRequired: true
5622
+ },
5623
+ {
5624
+ trail: ["review-queue", "get-settings"],
5625
+ resourcePath: ["reviewQueue"],
5626
+ methodName: "getSettings",
5627
+ httpMethod: "GET",
5628
+ path: "/api/v1/review-queue/settings",
5629
+ summary: "Get Review Queue Settings",
5630
+ description: "Requires catalog:review-settings for bearer credentials and company settings read permission for delegated users.\n\nReturns the organization defaults for enrichment and taxonomy auto-apply confidence.",
5631
+ flags: [
5632
+ {
5633
+ name: "organizationId",
5634
+ flag: "organization-id",
5635
+ required: false,
5636
+ source: "query"
5637
+ }
5638
+ ],
5639
+ acceptsJsonBody: false,
5640
+ acceptsFile: false,
5641
+ bodyRequired: false
5642
+ },
5643
+ {
5644
+ trail: ["review-queue", "update-settings"],
5645
+ resourcePath: ["reviewQueue"],
5646
+ methodName: "updateSettings",
5647
+ httpMethod: "PATCH",
5648
+ path: "/api/v1/review-queue/settings",
5649
+ summary: "Update Review Queue Settings",
5650
+ description: "Requires catalog:review-settings for bearer credentials and company settings write permission for delegated users.\n\nUpdate either or both thresholds from 0.50 to 1.00. Existing review jobs retain their saved settings.",
5651
+ flags: [],
5652
+ acceptsJsonBody: true,
5653
+ acceptsFile: false,
5654
+ bodyRequired: true
5655
+ },
4845
5656
  {
4846
5657
  trail: ["reviews", "list"],
4847
5658
  resourcePath: ["reviews"],
@@ -6152,51 +6963,51 @@ var COMMANDS = [
6152
6963
 
6153
6964
  // src/generated/campaign-inputs.ts
6154
6965
  var CAMPAIGN_INPUTS = {
6155
- "patch": {
6156
- "type": "object",
6157
- "properties": {
6158
- "expectedRevision": {
6159
- "type": "integer",
6160
- "exclusiveMinimum": 0,
6161
- "maximum": 9007199254740991
6162
- },
6163
- "name": {
6164
- "type": "string",
6165
- "minLength": 2,
6166
- "maxLength": 160
6167
- },
6168
- "objective": {
6169
- "type": "string",
6170
- "maxLength": 8e3
6171
- },
6172
- "brand": {
6173
- "type": "string",
6174
- "maxLength": 160
6175
- },
6176
- "ownerId": {
6177
- "type": "string",
6178
- "minLength": 1,
6179
- "maxLength": 160,
6180
- "description": "Organization member ID or eligible oauth:<clientId> actor from campaign options."
6181
- },
6182
- "approverId": {
6183
- "type": "string",
6184
- "minLength": 1,
6185
- "maxLength": 160,
6186
- "description": "Explicit named approver: organization member ID or eligible oauth:<clientId> actor from campaign options. Other users and API clients cannot approve on this actor's behalf."
6187
- },
6188
- "timezone": {
6189
- "type": "string"
6190
- },
6191
- "stores": {
6192
- "maxItems": 100,
6193
- "type": "array",
6194
- "items": {
6195
- "type": "object",
6196
- "properties": {
6197
- "marketplace": {
6198
- "type": "string",
6199
- "enum": [
6966
+ patch: {
6967
+ type: "object",
6968
+ properties: {
6969
+ expectedRevision: {
6970
+ type: "integer",
6971
+ exclusiveMinimum: 0,
6972
+ maximum: 9007199254740991
6973
+ },
6974
+ name: {
6975
+ type: "string",
6976
+ minLength: 2,
6977
+ maxLength: 160
6978
+ },
6979
+ objective: {
6980
+ type: "string",
6981
+ maxLength: 8e3
6982
+ },
6983
+ brand: {
6984
+ type: "string",
6985
+ maxLength: 160
6986
+ },
6987
+ ownerId: {
6988
+ type: "string",
6989
+ minLength: 1,
6990
+ maxLength: 160,
6991
+ description: "Organization member ID or eligible oauth:<clientId> actor from campaign options."
6992
+ },
6993
+ approverId: {
6994
+ type: "string",
6995
+ minLength: 1,
6996
+ maxLength: 160,
6997
+ description: "Explicit named approver: organization member ID or eligible oauth:<clientId> actor from campaign options. Other users and API clients cannot approve on this actor's behalf."
6998
+ },
6999
+ timezone: {
7000
+ type: "string"
7001
+ },
7002
+ stores: {
7003
+ maxItems: 100,
7004
+ type: "array",
7005
+ items: {
7006
+ type: "object",
7007
+ properties: {
7008
+ marketplace: {
7009
+ type: "string",
7010
+ enum: [
6200
7011
  "shopee",
6201
7012
  "lazada",
6202
7013
  "tiktok",
@@ -6207,65 +7018,57 @@ var CAMPAIGN_INPUTS = {
6207
7018
  "ebay"
6208
7019
  ]
6209
7020
  },
6210
- "country": {
6211
- "type": "string",
6212
- "minLength": 1,
6213
- "maxLength": 80
7021
+ country: {
7022
+ type: "string",
7023
+ minLength: 1,
7024
+ maxLength: 80
6214
7025
  },
6215
- "storeId": {
6216
- "type": "string",
6217
- "minLength": 1,
6218
- "maxLength": 160
7026
+ storeId: {
7027
+ type: "string",
7028
+ minLength: 1,
7029
+ maxLength: 160
6219
7030
  }
6220
7031
  },
6221
- "required": [
6222
- "marketplace",
6223
- "country",
6224
- "storeId"
6225
- ],
6226
- "additionalProperties": false
7032
+ required: ["marketplace", "country", "storeId"],
7033
+ additionalProperties: false
6227
7034
  }
6228
7035
  },
6229
- "serviceRequest": {
6230
- "type": "string",
6231
- "maxLength": 300
6232
- },
6233
- "priority": {
6234
- "type": "string",
6235
- "enum": [
6236
- "standard",
6237
- "priority",
6238
- "super_priority"
6239
- ]
6240
- },
6241
- "documentIds": {
6242
- "maxItems": 100,
6243
- "type": "array",
6244
- "items": {
6245
- "type": "string",
6246
- "minLength": 1,
6247
- "maxLength": 160
7036
+ serviceRequest: {
7037
+ type: "string",
7038
+ maxLength: 300
7039
+ },
7040
+ priority: {
7041
+ type: "string",
7042
+ enum: ["standard", "priority", "super_priority"]
7043
+ },
7044
+ documentIds: {
7045
+ maxItems: 100,
7046
+ type: "array",
7047
+ items: {
7048
+ type: "string",
7049
+ minLength: 1,
7050
+ maxLength: 160
6248
7051
  }
6249
7052
  },
6250
- "reviewDueAt": {
6251
- "anyOf": [
7053
+ reviewDueAt: {
7054
+ anyOf: [
6252
7055
  {
6253
- "type": "string",
6254
- "format": "date-time",
6255
- "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
7056
+ type: "string",
7057
+ format: "date-time",
7058
+ pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
6256
7059
  },
6257
7060
  {
6258
- "type": "null"
7061
+ type: "null"
6259
7062
  }
6260
7063
  ]
6261
7064
  },
6262
- "sourceCurrency": {
6263
- "type": "string",
6264
- "pattern": "^[A-Z]{3}$"
7065
+ sourceCurrency: {
7066
+ type: "string",
7067
+ pattern: "^[A-Z]{3}$"
6265
7068
  },
6266
- "sourceMarketplace": {
6267
- "type": "string",
6268
- "enum": [
7069
+ sourceMarketplace: {
7070
+ type: "string",
7071
+ enum: [
6269
7072
  "shopee",
6270
7073
  "lazada",
6271
7074
  "tiktok",
@@ -6276,81 +7079,78 @@ var CAMPAIGN_INPUTS = {
6276
7079
  "ebay"
6277
7080
  ]
6278
7081
  },
6279
- "sourceCountry": {
6280
- "type": "string",
6281
- "maxLength": 80
7082
+ sourceCountry: {
7083
+ type: "string",
7084
+ maxLength: 80
6282
7085
  },
6283
- "syncMode": {
6284
- "type": "string",
6285
- "enum": [
6286
- "offer_windows",
6287
- "campaign_start"
6288
- ]
7086
+ syncMode: {
7087
+ type: "string",
7088
+ enum: ["offer_windows", "campaign_start"]
6289
7089
  },
6290
- "cleanupNotes": {
6291
- "type": "string",
6292
- "maxLength": 8e3
6293
- },
6294
- "offers": {
6295
- "description": "Add or update promotions by stable offer id. Existing IDs patch only supplied fields; new IDs require windowId and promotion terms. Omitted offers stay unchanged.",
6296
- "maxItems": 500,
6297
- "type": "array",
6298
- "items": {
6299
- "type": "object",
6300
- "properties": {
6301
- "id": {
6302
- "type": "string",
6303
- "minLength": 1,
6304
- "maxLength": 160
7090
+ cleanupNotes: {
7091
+ type: "string",
7092
+ maxLength: 8e3
7093
+ },
7094
+ offers: {
7095
+ description: "Add or update promotions by stable offer id. Existing IDs patch only supplied fields; new IDs require windowId and promotion terms. Omitted offers stay unchanged.",
7096
+ maxItems: 500,
7097
+ type: "array",
7098
+ items: {
7099
+ type: "object",
7100
+ properties: {
7101
+ id: {
7102
+ type: "string",
7103
+ minLength: 1,
7104
+ maxLength: 160
6305
7105
  },
6306
- "windowId": {
6307
- "type": "string",
6308
- "minLength": 1,
6309
- "maxLength": 160
7106
+ windowId: {
7107
+ type: "string",
7108
+ minLength: 1,
7109
+ maxLength: 160
6310
7110
  },
6311
- "promotionId": {
6312
- "description": "Existing draft promotion attached to this window; the campaign controls its live dates.",
6313
- "type": "string",
6314
- "format": "uuid",
6315
- "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
7111
+ promotionId: {
7112
+ description: "Existing draft promotion attached to this window; the campaign controls its live dates.",
7113
+ type: "string",
7114
+ format: "uuid",
7115
+ pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
6316
7116
  },
6317
- "productIds": {
6318
- "maxItems": 200,
6319
- "type": "array",
6320
- "items": {
6321
- "type": "string",
6322
- "format": "uuid",
6323
- "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
7117
+ productIds: {
7118
+ maxItems: 200,
7119
+ type: "array",
7120
+ items: {
7121
+ type: "string",
7122
+ format: "uuid",
7123
+ pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
6324
7124
  }
6325
7125
  },
6326
- "reviewNotes": {
6327
- "type": "string",
6328
- "maxLength": 8e3
7126
+ reviewNotes: {
7127
+ type: "string",
7128
+ maxLength: 8e3
6329
7129
  },
6330
- "excludedReason": {
6331
- "type": "string",
6332
- "maxLength": 2e3
7130
+ excludedReason: {
7131
+ type: "string",
7132
+ maxLength: 2e3
6333
7133
  },
6334
- "name": {
6335
- "type": "string",
6336
- "minLength": 1,
6337
- "maxLength": 200
7134
+ name: {
7135
+ type: "string",
7136
+ minLength: 1,
7137
+ maxLength: 200
6338
7138
  },
6339
- "description": {
6340
- "anyOf": [
7139
+ description: {
7140
+ anyOf: [
6341
7141
  {
6342
- "type": "string",
6343
- "maxLength": 2e3
7142
+ type: "string",
7143
+ maxLength: 2e3
6344
7144
  },
6345
7145
  {
6346
- "type": "null"
7146
+ type: "null"
6347
7147
  }
6348
7148
  ]
6349
7149
  },
6350
- "kind": {
6351
- "description": "Canonical OmniCommerce promotion mechanic: product discount, flash sale, voucher, gift with purchase, Buy-X-Get-Y, bundle deal, or Lazada-only free shipping and early bird price.",
6352
- "type": "string",
6353
- "enum": [
7150
+ kind: {
7151
+ description: "Canonical OmniCommerce promotion mechanic: product discount, flash sale, voucher, gift with purchase, Buy-X-Get-Y, bundle deal, or Lazada-only free shipping and early bird price.",
7152
+ type: "string",
7153
+ enum: [
6354
7154
  "product_discount",
6355
7155
  "flash_sale",
6356
7156
  "voucher",
@@ -6361,78 +7161,65 @@ var CAMPAIGN_INPUTS = {
6361
7161
  "early_bird_price"
6362
7162
  ]
6363
7163
  },
6364
- "salesChannels": {
6365
- "minItems": 1,
6366
- "type": "array",
6367
- "items": {
6368
- "type": "string",
6369
- "enum": [
6370
- "pdp",
6371
- "live"
6372
- ]
7164
+ salesChannels: {
7165
+ minItems: 1,
7166
+ type: "array",
7167
+ items: {
7168
+ type: "string",
7169
+ enum: ["pdp", "live"]
6373
7170
  }
6374
7171
  },
6375
- "discountType": {
6376
- "type": "string",
6377
- "enum": [
6378
- "percentage",
6379
- "fixed_amount"
6380
- ]
7172
+ discountType: {
7173
+ type: "string",
7174
+ enum: ["percentage", "fixed_amount"]
6381
7175
  },
6382
- "discountValue": {
6383
- "type": "number",
6384
- "minimum": 0
7176
+ discountValue: {
7177
+ type: "number",
7178
+ minimum: 0
6385
7179
  },
6386
- "storeDiscounts": {
6387
- "description": "Patch discount terms for exact target store keys; unnamed stores remain unchanged. Null discountValue restores shared campaign terms for that store.",
6388
- "maxItems": 100,
6389
- "type": "array",
6390
- "items": {
6391
- "type": "object",
6392
- "properties": {
6393
- "storeKey": {
6394
- "type": "string",
6395
- "minLength": 1,
6396
- "maxLength": 255
7180
+ storeDiscounts: {
7181
+ description: "Patch discount terms for exact target store keys; unnamed stores remain unchanged. Null discountValue restores shared campaign terms for that store.",
7182
+ maxItems: 100,
7183
+ type: "array",
7184
+ items: {
7185
+ type: "object",
7186
+ properties: {
7187
+ storeKey: {
7188
+ type: "string",
7189
+ minLength: 1,
7190
+ maxLength: 255
6397
7191
  },
6398
- "discountType": {
6399
- "type": "string",
6400
- "enum": [
6401
- "percentage",
6402
- "fixed_amount"
6403
- ]
7192
+ discountType: {
7193
+ type: "string",
7194
+ enum: ["percentage", "fixed_amount"]
6404
7195
  },
6405
- "discountValue": {
6406
- "anyOf": [
7196
+ discountValue: {
7197
+ anyOf: [
6407
7198
  {
6408
- "type": "number",
6409
- "minimum": 0
7199
+ type: "number",
7200
+ minimum: 0
6410
7201
  },
6411
7202
  {
6412
- "type": "null"
7203
+ type: "null"
6413
7204
  }
6414
7205
  ]
6415
7206
  }
6416
7207
  },
6417
- "required": [
6418
- "storeKey",
6419
- "discountType",
6420
- "discountValue"
6421
- ],
6422
- "additionalProperties": false
7208
+ required: ["storeKey", "discountType", "discountValue"],
7209
+ additionalProperties: false
6423
7210
  }
6424
7211
  },
6425
- "targetStores": {
6426
- "description": "Up to 100 connected stores for create (required) or update. Copy marketplace, country, and storeId from get_promotions targetStores or find_products marketplaceDetails. Do not concatenate a storeKeys string.",
6427
- "minItems": 1,
6428
- "maxItems": 100,
6429
- "type": "array",
6430
- "items": {
6431
- "type": "object",
6432
- "properties": {
6433
- "marketplace": {
6434
- "type": "string",
6435
- "enum": [
7212
+ targetStores: {
7213
+ description: "Up to 100 connected stores for create (required) or update. Copy marketplace, country, and storeId from get_promotions targetStores or find_products marketplaceDetails. Do not concatenate a storeKeys string.",
7214
+ minItems: 1,
7215
+ maxItems: 100,
7216
+ type: "array",
7217
+ items: {
7218
+ type: "object",
7219
+ properties: {
7220
+ marketplace: {
7221
+ type: "string",
7222
+ enum: [
6436
7223
  "lazada",
6437
7224
  "shopee",
6438
7225
  "tiktok",
@@ -6442,112 +7229,108 @@ var CAMPAIGN_INPUTS = {
6442
7229
  "ebay"
6443
7230
  ]
6444
7231
  },
6445
- "country": {
6446
- "type": "string",
6447
- "minLength": 1,
6448
- "maxLength": 80
7232
+ country: {
7233
+ type: "string",
7234
+ minLength: 1,
7235
+ maxLength: 80
6449
7236
  },
6450
- "storeId": {
6451
- "type": "string",
6452
- "minLength": 1,
6453
- "maxLength": 120
7237
+ storeId: {
7238
+ type: "string",
7239
+ minLength: 1,
7240
+ maxLength: 120
6454
7241
  }
6455
7242
  },
6456
- "required": [
6457
- "marketplace",
6458
- "country",
6459
- "storeId"
6460
- ],
6461
- "additionalProperties": false
7243
+ required: ["marketplace", "country", "storeId"],
7244
+ additionalProperties: false
6462
7245
  }
6463
7246
  },
6464
- "minSalePrice": {
6465
- "anyOf": [
7247
+ minSalePrice: {
7248
+ anyOf: [
6466
7249
  {
6467
- "type": "number",
6468
- "minimum": 0
7250
+ type: "number",
7251
+ minimum: 0
6469
7252
  },
6470
7253
  {
6471
- "type": "null"
7254
+ type: "null"
6472
7255
  }
6473
7256
  ]
6474
7257
  },
6475
- "maxDiscountAmount": {
6476
- "anyOf": [
7258
+ maxDiscountAmount: {
7259
+ anyOf: [
6477
7260
  {
6478
- "type": "number",
6479
- "minimum": 0
7261
+ type: "number",
7262
+ minimum: 0
6480
7263
  },
6481
7264
  {
6482
- "type": "null"
7265
+ type: "null"
6483
7266
  }
6484
7267
  ]
6485
7268
  },
6486
- "minSpend": {
6487
- "anyOf": [
7269
+ minSpend: {
7270
+ anyOf: [
6488
7271
  {
6489
- "type": "number",
6490
- "minimum": 0
7272
+ type: "number",
7273
+ minimum: 0
6491
7274
  },
6492
7275
  {
6493
- "type": "null"
7276
+ type: "null"
6494
7277
  }
6495
7278
  ]
6496
7279
  },
6497
- "voucherCode": {
6498
- "anyOf": [
7280
+ voucherCode: {
7281
+ anyOf: [
6499
7282
  {
6500
- "type": "string",
6501
- "minLength": 1,
6502
- "maxLength": 100
7283
+ type: "string",
7284
+ minLength: 1,
7285
+ maxLength: 100
6503
7286
  },
6504
7287
  {
6505
- "type": "null"
7288
+ type: "null"
6506
7289
  }
6507
7290
  ]
6508
7291
  },
6509
- "claimStartsAt": {
6510
- "anyOf": [
7292
+ claimStartsAt: {
7293
+ anyOf: [
6511
7294
  {
6512
- "type": "string",
6513
- "format": "date-time",
6514
- "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
7295
+ type: "string",
7296
+ format: "date-time",
7297
+ pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
6515
7298
  },
6516
7299
  {
6517
- "type": "null"
7300
+ type: "null"
6518
7301
  }
6519
7302
  ]
6520
7303
  },
6521
- "totalUsageLimit": {
6522
- "anyOf": [
7304
+ totalUsageLimit: {
7305
+ anyOf: [
6523
7306
  {
6524
- "type": "integer",
6525
- "exclusiveMinimum": 0,
6526
- "maximum": 9007199254740991
7307
+ type: "integer",
7308
+ exclusiveMinimum: 0,
7309
+ maximum: 9007199254740991
6527
7310
  },
6528
7311
  {
6529
- "type": "null"
7312
+ type: "null"
6530
7313
  }
6531
7314
  ]
6532
7315
  },
6533
- "perBuyerLimit": {
6534
- "anyOf": [
7316
+ perBuyerLimit: {
7317
+ anyOf: [
6535
7318
  {
6536
- "type": "integer",
6537
- "exclusiveMinimum": 0,
6538
- "maximum": 9007199254740991
7319
+ type: "integer",
7320
+ exclusiveMinimum: 0,
7321
+ maximum: 9007199254740991
6539
7322
  },
6540
7323
  {
6541
- "type": "null"
7324
+ type: "null"
6542
7325
  }
6543
7326
  ]
6544
7327
  },
6545
- "voucherType": {
6546
- "description": "Voucher subtype from get_promotions capabilities.voucherTypes. Browser AOP types (delivery=browser_aop) are writable Seller Center vouchers. Omit browserAutomation.aopId to use the built-in marketplace AOP.",
6547
- "anyOf": [
7328
+ voucherType: {
7329
+ description: "Voucher subtype from get_promotions capabilities.voucherTypes. Browser AOP types (delivery=browser_aop) are writable Seller Center vouchers. Omit browserAutomation.aopId to use the built-in marketplace AOP.",
7330
+ anyOf: [
6548
7331
  {
6549
- "type": "string",
6550
- "enum": [
7332
+ type: "string",
7333
+ enum: [
6551
7334
  "shopee_shop",
6552
7335
  "shopee_product",
6553
7336
  "shopee_private",
@@ -6582,153 +7365,137 @@ var CAMPAIGN_INPUTS = {
6582
7365
  ]
6583
7366
  },
6584
7367
  {
6585
- "type": "null"
7368
+ type: "null"
6586
7369
  }
6587
7370
  ]
6588
7371
  },
6589
- "voucherCampaign": {
6590
- "description": "Campaign voucher targeting: exact campaignId/sessionId from Seller Center and termsAccepted only after the seller reviewed participation obligations. Required for shopee_campaign; nomination creates a draft awaiting marketplace review.",
6591
- "type": "object",
6592
- "properties": {
6593
- "campaignId": {
6594
- "type": "string",
6595
- "pattern": "^[1-9]\\d{0,39}$"
7372
+ voucherCampaign: {
7373
+ description: "Campaign voucher targeting: exact campaignId/sessionId from Seller Center and termsAccepted only after the seller reviewed participation obligations. Required for shopee_campaign; nomination creates a draft awaiting marketplace review.",
7374
+ type: "object",
7375
+ properties: {
7376
+ campaignId: {
7377
+ type: "string",
7378
+ pattern: "^[1-9]\\d{0,39}$"
6596
7379
  },
6597
- "sessionId": {
6598
- "type": "string",
6599
- "pattern": "^[1-9]\\d{0,39}$"
7380
+ sessionId: {
7381
+ type: "string",
7382
+ pattern: "^[1-9]\\d{0,39}$"
6600
7383
  },
6601
- "termsAccepted": {
6602
- "type": "boolean"
7384
+ termsAccepted: {
7385
+ type: "boolean"
6603
7386
  }
6604
7387
  },
6605
- "required": [
6606
- "campaignId",
6607
- "sessionId",
6608
- "termsAccepted"
6609
- ],
6610
- "additionalProperties": false
7388
+ required: ["campaignId", "sessionId", "termsAccepted"],
7389
+ additionalProperties: false
6611
7390
  },
6612
- "browserAutomation": {
6613
- "anyOf": [
7391
+ browserAutomation: {
7392
+ anyOf: [
6614
7393
  {
6615
- "type": "object",
6616
- "properties": {
6617
- "aopId": {
6618
- "type": "string",
6619
- "minLength": 1,
6620
- "maxLength": 160
7394
+ type: "object",
7395
+ properties: {
7396
+ aopId: {
7397
+ type: "string",
7398
+ minLength: 1,
7399
+ maxLength: 160
6621
7400
  },
6622
- "variableValues": {
6623
- "type": "object",
6624
- "propertyNames": {
6625
- "type": "string",
6626
- "minLength": 1,
6627
- "maxLength": 160
7401
+ variableValues: {
7402
+ type: "object",
7403
+ propertyNames: {
7404
+ type: "string",
7405
+ minLength: 1,
7406
+ maxLength: 160
6628
7407
  },
6629
- "additionalProperties": {
6630
- "type": "string",
6631
- "maxLength": 8e3
7408
+ additionalProperties: {
7409
+ type: "string",
7410
+ maxLength: 8e3
6632
7411
  }
6633
7412
  },
6634
- "instructions": {
6635
- "type": "string",
6636
- "maxLength": 8e3
7413
+ instructions: {
7414
+ type: "string",
7415
+ maxLength: 8e3
6637
7416
  }
6638
7417
  },
6639
- "additionalProperties": false
7418
+ additionalProperties: false
6640
7419
  },
6641
7420
  {
6642
- "type": "null"
7421
+ type: "null"
6643
7422
  }
6644
7423
  ]
6645
7424
  },
6646
- "voucherScope": {
6647
- "description": "shop = all products, products = selected assigned products. Repeat Buyer defaults to shop.",
6648
- "type": "string",
6649
- "enum": [
6650
- "products",
6651
- "shop"
6652
- ]
7425
+ voucherScope: {
7426
+ description: "shop = all products, products = selected assigned products. Repeat Buyer defaults to shop.",
7427
+ type: "string",
7428
+ enum: ["products", "shop"]
6653
7429
  },
6654
- "voucherReward": {
6655
- "description": "Seller Center reward type. coins_cashback is a percentage greater than 3 and does not reduce salePrice.",
6656
- "type": "string",
6657
- "enum": [
6658
- "discount",
6659
- "coins_cashback"
6660
- ]
7430
+ voucherReward: {
7431
+ description: "Seller Center reward type. coins_cashback is a percentage greater than 3 and does not reduce salePrice.",
7432
+ type: "string",
7433
+ enum: ["discount", "coins_cashback"]
6661
7434
  },
6662
- "voucherAudience": {
6663
- "type": "string",
6664
- "enum": [
6665
- "general",
6666
- "shop_follow"
6667
- ]
7435
+ voucherAudience: {
7436
+ type: "string",
7437
+ enum: ["general", "shop_follow"]
6668
7438
  },
6669
- "redemptionPoints": {
6670
- "description": "Membership points required per voucher redemption. Required for shopee_redemption and lazada_points_redeemable; unavailable for other voucher types.",
6671
- "type": "integer",
6672
- "exclusiveMinimum": 0,
6673
- "maximum": 9007199254740991
7439
+ redemptionPoints: {
7440
+ description: "Membership points required per voucher redemption. Required for shopee_redemption and lazada_points_redeemable; unavailable for other voucher types.",
7441
+ type: "integer",
7442
+ exclusiveMinimum: 0,
7443
+ maximum: 9007199254740991
6674
7444
  },
6675
- "repeatPurchaseMinCount": {
6676
- "description": "Shopee Repeat Buyer: minimum completed shop orders, 1 or 2. Required for shopee_repeat_buyer.",
6677
- "type": "integer",
6678
- "minimum": 1,
6679
- "maximum": 999
7445
+ repeatPurchaseMinCount: {
7446
+ description: "Shopee Repeat Buyer: minimum completed shop orders, 1 or 2. Required for shopee_repeat_buyer.",
7447
+ type: "integer",
7448
+ minimum: 1,
7449
+ maximum: 999
6680
7450
  },
6681
- "repeatPurchaseLookbackDays": {
6682
- "description": "Shopee Repeat Buyer: lookback window in days, one of 30, 90, 180 or 365. Required for shopee_repeat_buyer.",
6683
- "type": "integer",
6684
- "minimum": 1,
6685
- "maximum": 365
7451
+ repeatPurchaseLookbackDays: {
7452
+ description: "Shopee Repeat Buyer: lookback window in days, one of 30, 90, 180 or 365. Required for shopee_repeat_buyer.",
7453
+ type: "integer",
7454
+ minimum: 1,
7455
+ maximum: 365
6686
7456
  },
6687
- "smartVoucher": {
6688
- "description": "Shopee Smart Voucher toggle. Used by New Buyer and similar portal types.",
6689
- "type": "boolean"
7457
+ smartVoucher: {
7458
+ description: "Shopee Smart Voucher toggle. Used by New Buyer and similar portal types.",
7459
+ type: "boolean"
6690
7460
  },
6691
- "followPrizeExpiryDays": {
6692
- "description": "Shopee Follow Prize: days after claim until expiry. Seller Center is 7.",
6693
- "type": "integer",
6694
- "minimum": 1,
6695
- "maximum": 30
7461
+ followPrizeExpiryDays: {
7462
+ description: "Shopee Follow Prize: days after claim until expiry. Seller Center is 7.",
7463
+ type: "integer",
7464
+ minimum: 1,
7465
+ maximum: 30
6696
7466
  },
6697
- "videoDisplayMode": {
6698
- "description": "Shopee Video display: shopee_video = all Shopee Video; creator_video = targeted creator videos only.",
6699
- "type": "string",
6700
- "enum": [
6701
- "shopee_video",
6702
- "creator_video"
6703
- ]
7467
+ videoDisplayMode: {
7468
+ description: "Shopee Video display: shopee_video = all Shopee Video; creator_video = targeted creator videos only.",
7469
+ type: "string",
7470
+ enum: ["shopee_video", "creator_video"]
6704
7471
  },
6705
- "exclusiveCreatorUsernames": {
6706
- "description": "Exclusive Creator Voucher: up to 15 Shopee usernames.",
6707
- "maxItems": 15,
6708
- "type": "array",
6709
- "items": {
6710
- "type": "string",
6711
- "minLength": 1,
6712
- "maxLength": 64
7472
+ exclusiveCreatorUsernames: {
7473
+ description: "Exclusive Creator Voucher: up to 15 Shopee usernames.",
7474
+ maxItems: 15,
7475
+ type: "array",
7476
+ items: {
7477
+ type: "string",
7478
+ minLength: 1,
7479
+ maxLength: 64
6713
7480
  }
6714
7481
  },
6715
- "exclusiveStreamerUsernames": {
6716
- "description": "Exclusive Streamer Voucher: up to 15 Shopee usernames.",
6717
- "maxItems": 15,
6718
- "type": "array",
6719
- "items": {
6720
- "type": "string",
6721
- "minLength": 1,
6722
- "maxLength": 64
7482
+ exclusiveStreamerUsernames: {
7483
+ description: "Exclusive Streamer Voucher: up to 15 Shopee usernames.",
7484
+ maxItems: 15,
7485
+ type: "array",
7486
+ items: {
7487
+ type: "string",
7488
+ minLength: 1,
7489
+ maxLength: 64
6723
7490
  }
6724
7491
  },
6725
- "voucherDisplayChannels": {
6726
- "description": 'Shopee display setting. ["all"] = display on all pages; [] = hidden/share by code.',
6727
- "maxItems": 4,
6728
- "type": "array",
6729
- "items": {
6730
- "type": "string",
6731
- "enum": [
7492
+ voucherDisplayChannels: {
7493
+ description: 'Shopee display setting. ["all"] = display on all pages; [] = hidden/share by code.',
7494
+ maxItems: 4,
7495
+ type: "array",
7496
+ items: {
7497
+ type: "string",
7498
+ enum: [
6732
7499
  "all",
6733
7500
  "feed",
6734
7501
  "live",
@@ -6738,268 +7505,243 @@ var CAMPAIGN_INPUTS = {
6738
7505
  ]
6739
7506
  }
6740
7507
  },
6741
- "bundlePriceType": {
6742
- "type": "string",
6743
- "enum": [
6744
- "discount",
6745
- "fixed_price"
6746
- ]
7508
+ bundlePriceType: {
7509
+ type: "string",
7510
+ enum: ["discount", "fixed_price"]
6747
7511
  },
6748
- "bundleTiers": {
6749
- "maxItems": 2,
6750
- "type": "array",
6751
- "items": {
6752
- "type": "object",
6753
- "properties": {
6754
- "minimumQuantity": {
6755
- "type": "integer",
6756
- "minimum": 2,
6757
- "maximum": 3e3
7512
+ bundleTiers: {
7513
+ maxItems: 2,
7514
+ type: "array",
7515
+ items: {
7516
+ type: "object",
7517
+ properties: {
7518
+ minimumQuantity: {
7519
+ type: "integer",
7520
+ minimum: 2,
7521
+ maximum: 3e3
6758
7522
  },
6759
- "discountValue": {
6760
- "type": "number",
6761
- "exclusiveMinimum": 0
7523
+ discountValue: {
7524
+ type: "number",
7525
+ exclusiveMinimum: 0
6762
7526
  }
6763
7527
  },
6764
- "required": [
6765
- "minimumQuantity",
6766
- "discountValue"
6767
- ]
7528
+ required: ["minimumQuantity", "discountValue"]
6768
7529
  }
6769
7530
  },
6770
- "thresholdType": {
6771
- "type": "string",
6772
- "enum": [
6773
- "item_quantity",
6774
- "order_amount"
6775
- ]
7531
+ thresholdType: {
7532
+ type: "string",
7533
+ enum: ["item_quantity", "order_amount"]
6776
7534
  },
6777
- "thresholdValue": {
6778
- "type": "number",
6779
- "exclusiveMinimum": 0
7535
+ thresholdValue: {
7536
+ type: "number",
7537
+ exclusiveMinimum: 0
6780
7538
  },
6781
- "giftType": {
6782
- "type": "string",
6783
- "enum": [
6784
- "gift",
6785
- "sample"
6786
- ]
7539
+ giftType: {
7540
+ type: "string",
7541
+ enum: ["gift", "sample"]
6787
7542
  },
6788
- "giftQuantity": {
6789
- "type": "integer",
6790
- "exclusiveMinimum": 0,
6791
- "maximum": 999
7543
+ giftQuantity: {
7544
+ type: "integer",
7545
+ exclusiveMinimum: 0,
7546
+ maximum: 999
6792
7547
  },
6793
- "gifts": {
6794
- "minItems": 1,
6795
- "maxItems": 20,
6796
- "type": "array",
6797
- "items": {
6798
- "type": "object",
6799
- "properties": {
6800
- "productId": {
6801
- "type": "string",
6802
- "format": "uuid",
6803
- "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
7548
+ gifts: {
7549
+ minItems: 1,
7550
+ maxItems: 20,
7551
+ type: "array",
7552
+ items: {
7553
+ type: "object",
7554
+ properties: {
7555
+ productId: {
7556
+ type: "string",
7557
+ format: "uuid",
7558
+ pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
6804
7559
  },
6805
- "variantId": {
6806
- "anyOf": [
7560
+ variantId: {
7561
+ anyOf: [
6807
7562
  {
6808
- "type": "string",
6809
- "format": "uuid",
6810
- "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
7563
+ type: "string",
7564
+ format: "uuid",
7565
+ pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
6811
7566
  },
6812
7567
  {
6813
- "type": "null"
7568
+ type: "null"
6814
7569
  }
6815
7570
  ]
6816
7571
  },
6817
- "totalClaimLimit": {
6818
- "type": "integer",
6819
- "minimum": 1,
6820
- "maximum": 99999
7572
+ totalClaimLimit: {
7573
+ type: "integer",
7574
+ minimum: 1,
7575
+ maximum: 99999
6821
7576
  }
6822
7577
  },
6823
- "required": [
6824
- "productId",
6825
- "totalClaimLimit"
6826
- ],
6827
- "additionalProperties": false
7578
+ required: ["productId", "totalClaimLimit"],
7579
+ additionalProperties: false
6828
7580
  }
6829
7581
  },
6830
- "buyQuantity": {
6831
- "type": "integer",
6832
- "exclusiveMinimum": 0,
6833
- "maximum": 999
7582
+ buyQuantity: {
7583
+ type: "integer",
7584
+ exclusiveMinimum: 0,
7585
+ maximum: 999
6834
7586
  },
6835
- "getQuantity": {
6836
- "type": "integer",
6837
- "exclusiveMinimum": 0,
6838
- "maximum": 999
7587
+ getQuantity: {
7588
+ type: "integer",
7589
+ exclusiveMinimum: 0,
7590
+ maximum: 999
6839
7591
  },
6840
- "benefitProductIds": {
6841
- "minItems": 1,
6842
- "maxItems": 200,
6843
- "type": "array",
6844
- "items": {
6845
- "type": "string",
6846
- "format": "uuid",
6847
- "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
7592
+ benefitProductIds: {
7593
+ minItems: 1,
7594
+ maxItems: 200,
7595
+ type: "array",
7596
+ items: {
7597
+ type: "string",
7598
+ format: "uuid",
7599
+ pattern: "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
6848
7600
  }
6849
7601
  },
6850
- "benefitType": {
6851
- "type": "string",
6852
- "enum": [
6853
- "free",
6854
- "percentage",
6855
- "fixed_amount"
6856
- ]
7602
+ benefitType: {
7603
+ type: "string",
7604
+ enum: ["free", "percentage", "fixed_amount"]
6857
7605
  },
6858
- "benefitValue": {
6859
- "type": "number",
6860
- "minimum": 0
7606
+ benefitValue: {
7607
+ type: "number",
7608
+ minimum: 0
6861
7609
  },
6862
- "maxApplicationsPerOrder": {
6863
- "type": "integer",
6864
- "exclusiveMinimum": 0,
6865
- "maximum": 999
7610
+ maxApplicationsPerOrder: {
7611
+ type: "integer",
7612
+ exclusiveMinimum: 0,
7613
+ maximum: 999
6866
7614
  },
6867
- "bundleMinimumQuantity": {
6868
- "type": "integer",
6869
- "minimum": 2,
6870
- "maximum": 3e3
7615
+ bundleMinimumQuantity: {
7616
+ type: "integer",
7617
+ minimum: 2,
7618
+ maximum: 3e3
6871
7619
  },
6872
- "shippingDeliveryOption": {
6873
- "description": "Free shipping delivery option. Lazada: STANDARD (default), ECONOMY, EXPRESS, SELLER_OWN_FLEET or P2P, as offered by the store.",
6874
- "type": "string",
6875
- "pattern": "^[A-Z0-9_]{1,40}$"
7620
+ shippingDeliveryOption: {
7621
+ description: "Free shipping delivery option. Lazada: STANDARD (default), ECONOMY, EXPRESS, SELLER_OWN_FLEET or P2P, as offered by the store.",
7622
+ type: "string",
7623
+ pattern: "^[A-Z0-9_]{1,40}$"
6876
7624
  },
6877
- "shippingBudget": {
6878
- "description": "Free shipping: total shipping subsidy budget in the store currency. Omit for an unlimited budget.",
6879
- "type": "number",
6880
- "exclusiveMinimum": 0
7625
+ shippingBudget: {
7626
+ description: "Free shipping: total shipping subsidy budget in the store currency. Omit for an unlimited budget.",
7627
+ type: "number",
7628
+ exclusiveMinimum: 0
6881
7629
  }
6882
7630
  },
6883
- "required": [
6884
- "id"
6885
- ],
6886
- "additionalProperties": false
7631
+ required: ["id"],
7632
+ additionalProperties: false
6887
7633
  }
6888
7634
  },
6889
- "windows": {
6890
- "description": "Add or update windows by stable id. Existing IDs patch only supplied fields; new IDs require name, startsAt and endsAt. Omitted windows stay unchanged.",
6891
- "maxItems": 100,
6892
- "type": "array",
6893
- "items": {
6894
- "type": "object",
6895
- "properties": {
6896
- "id": {
6897
- "type": "string",
6898
- "minLength": 1,
6899
- "maxLength": 160
7635
+ windows: {
7636
+ description: "Add or update windows by stable id. Existing IDs patch only supplied fields; new IDs require name, startsAt and endsAt. Omitted windows stay unchanged.",
7637
+ maxItems: 100,
7638
+ type: "array",
7639
+ items: {
7640
+ type: "object",
7641
+ properties: {
7642
+ id: {
7643
+ type: "string",
7644
+ minLength: 1,
7645
+ maxLength: 160
6900
7646
  },
6901
- "name": {
6902
- "type": "string",
6903
- "minLength": 1,
6904
- "maxLength": 160
7647
+ name: {
7648
+ type: "string",
7649
+ minLength: 1,
7650
+ maxLength: 160
6905
7651
  },
6906
- "startsAt": {
6907
- "anyOf": [
7652
+ startsAt: {
7653
+ anyOf: [
6908
7654
  {
6909
- "type": "string",
6910
- "format": "date-time",
6911
- "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
7655
+ type: "string",
7656
+ format: "date-time",
7657
+ pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
6912
7658
  },
6913
7659
  {
6914
- "type": "null"
7660
+ type: "null"
6915
7661
  }
6916
7662
  ]
6917
7663
  },
6918
- "endsAt": {
6919
- "anyOf": [
7664
+ endsAt: {
7665
+ anyOf: [
6920
7666
  {
6921
- "type": "string",
6922
- "format": "date-time",
6923
- "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
7667
+ type: "string",
7668
+ format: "date-time",
7669
+ pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
6924
7670
  },
6925
7671
  {
6926
- "type": "null"
7672
+ type: "null"
6927
7673
  }
6928
7674
  ]
6929
7675
  },
6930
- "preparesAt": {
6931
- "anyOf": [
7676
+ preparesAt: {
7677
+ anyOf: [
6932
7678
  {
6933
- "type": "string",
6934
- "format": "date-time",
6935
- "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
7679
+ type: "string",
7680
+ format: "date-time",
7681
+ pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
6936
7682
  },
6937
7683
  {
6938
- "type": "null"
7684
+ type: "null"
6939
7685
  }
6940
7686
  ]
6941
7687
  },
6942
- "reviewNotes": {
6943
- "type": "string",
6944
- "maxLength": 8e3
7688
+ reviewNotes: {
7689
+ type: "string",
7690
+ maxLength: 8e3
6945
7691
  }
6946
7692
  },
6947
- "required": [
6948
- "id"
6949
- ],
6950
- "additionalProperties": false
7693
+ required: ["id"],
7694
+ additionalProperties: false
6951
7695
  }
6952
7696
  },
6953
- "removeWindowIds": {
6954
- "description": "Delete these windows. Move or remove their promotions in the same call. Maximum 100 IDs.",
6955
- "maxItems": 100,
6956
- "type": "array",
6957
- "items": {
6958
- "type": "string",
6959
- "minLength": 1,
6960
- "maxLength": 160
7697
+ removeWindowIds: {
7698
+ description: "Delete these windows. Move or remove their promotions in the same call. Maximum 100 IDs.",
7699
+ maxItems: 100,
7700
+ type: "array",
7701
+ items: {
7702
+ type: "string",
7703
+ minLength: 1,
7704
+ maxLength: 160
6961
7705
  }
6962
7706
  },
6963
- "removeOfferIds": {
6964
- "description": "Delete these draft promotion offers. Maximum 500 IDs.",
6965
- "maxItems": 500,
6966
- "type": "array",
6967
- "items": {
6968
- "type": "string",
6969
- "minLength": 1,
6970
- "maxLength": 160
7707
+ removeOfferIds: {
7708
+ description: "Delete these draft promotion offers. Maximum 500 IDs.",
7709
+ maxItems: 500,
7710
+ type: "array",
7711
+ items: {
7712
+ type: "string",
7713
+ minLength: 1,
7714
+ maxLength: 160
6971
7715
  }
6972
7716
  },
6973
- "organizationId": {
6974
- "description": "Required for session auth. Optional for an API key, which already identifies the organization.",
6975
- "type": "string",
6976
- "minLength": 1,
6977
- "maxLength": 120
7717
+ organizationId: {
7718
+ description: "Required for session auth. Optional for an API key, which already identifies the organization.",
7719
+ type: "string",
7720
+ minLength: 1,
7721
+ maxLength: 120
6978
7722
  },
6979
- "expectedPendingVersion": {
6980
- "anyOf": [
7723
+ expectedPendingVersion: {
7724
+ anyOf: [
6981
7725
  {
6982
- "type": "integer",
6983
- "exclusiveMinimum": 0,
6984
- "maximum": 9007199254740991
7726
+ type: "integer",
7727
+ exclusiveMinimum: 0,
7728
+ maximum: 9007199254740991
6985
7729
  },
6986
7730
  {
6987
- "type": "null"
7731
+ type: "null"
6988
7732
  }
6989
7733
  ]
6990
7734
  }
6991
7735
  },
6992
- "required": [
6993
- "expectedRevision"
6994
- ],
6995
- "additionalProperties": false
6996
- },
6997
- "action": {
6998
- "type": "object",
6999
- "properties": {
7000
- "action": {
7001
- "type": "string",
7002
- "enum": [
7736
+ required: ["expectedRevision"],
7737
+ additionalProperties: false
7738
+ },
7739
+ action: {
7740
+ type: "object",
7741
+ properties: {
7742
+ action: {
7743
+ type: "string",
7744
+ enum: [
7003
7745
  "approve",
7004
7746
  "run",
7005
7747
  "approve_and_run",
@@ -7010,33 +7752,30 @@ var CAMPAIGN_INPUTS = {
7010
7752
  "discard_change"
7011
7753
  ]
7012
7754
  },
7013
- "expectedRevision": {
7014
- "type": "integer",
7015
- "exclusiveMinimum": 0,
7016
- "maximum": 9007199254740991
7755
+ expectedRevision: {
7756
+ type: "integer",
7757
+ exclusiveMinimum: 0,
7758
+ maximum: 9007199254740991
7017
7759
  },
7018
- "expectedPendingVersion": {
7019
- "type": "integer",
7020
- "exclusiveMinimum": 0,
7021
- "maximum": 9007199254740991
7760
+ expectedPendingVersion: {
7761
+ type: "integer",
7762
+ exclusiveMinimum: 0,
7763
+ maximum: 9007199254740991
7022
7764
  },
7023
- "sellerReviewAcknowledgement": {
7024
- "description": "Fingerprint from the marketplace validation report, supplied only after the user explicitly acknowledges its seller-review findings for this revision and proposal version.",
7025
- "type": "string",
7026
- "pattern": "^[a-f0-9]{64}$"
7765
+ sellerReviewAcknowledgement: {
7766
+ description: "Fingerprint from the marketplace validation report, supplied only after the user explicitly acknowledges its seller-review findings for this revision and proposal version.",
7767
+ type: "string",
7768
+ pattern: "^[a-f0-9]{64}$"
7027
7769
  },
7028
- "organizationId": {
7029
- "description": "Required for session auth. Optional for an API key, which already identifies the organization.",
7030
- "type": "string",
7031
- "minLength": 1,
7032
- "maxLength": 120
7770
+ organizationId: {
7771
+ description: "Required for session auth. Optional for an API key, which already identifies the organization.",
7772
+ type: "string",
7773
+ minLength: 1,
7774
+ maxLength: 120
7033
7775
  }
7034
7776
  },
7035
- "required": [
7036
- "action",
7037
- "expectedRevision"
7038
- ],
7039
- "additionalProperties": false
7777
+ required: ["action", "expectedRevision"],
7778
+ additionalProperties: false
7040
7779
  }
7041
7780
  };
7042
7781
 
@@ -7362,14 +8101,306 @@ function matchCommands(commands, trail) {
7362
8101
  return { exact, prefix };
7363
8102
  }
7364
8103
 
8104
+ // src/catalog-file-errors.ts
8105
+ import { readCatalogFileFailures } from "@omni-commerce/sdk";
8106
+ var CATALOG_FILE_ERRORS = {
8107
+ trail: ["bulk", "file-errors"],
8108
+ resourcePath: ["bulk"],
8109
+ methodName: "fileErrors",
8110
+ httpMethod: "POST",
8111
+ path: "/api/v1/catalog/operations/results",
8112
+ summary: "Download failed catalog file receipts as JSONL",
8113
+ description: "Use the fileRecord number to identify rows to correct. Redirect stdout to save the report.",
8114
+ flags: [
8115
+ {
8116
+ name: "operationId",
8117
+ flag: "operation-id",
8118
+ required: true,
8119
+ source: "body"
8120
+ },
8121
+ {
8122
+ name: "organizationId",
8123
+ flag: "organization-id",
8124
+ required: false,
8125
+ source: "query"
8126
+ }
8127
+ ],
8128
+ acceptsJsonBody: false,
8129
+ acceptsFile: false,
8130
+ bodyRequired: false
8131
+ };
8132
+ async function exportCatalogFileErrors(client, request) {
8133
+ for await (const row of readCatalogFileFailures(client, {
8134
+ operationId: String(request.operationId),
8135
+ organizationId: request.organizationId
8136
+ })) {
8137
+ await new Promise((resolve, reject) => {
8138
+ process.stdout.write(
8139
+ JSON.stringify(row) + "\n",
8140
+ (error) => error ? reject(error) : resolve()
8141
+ );
8142
+ });
8143
+ }
8144
+ }
8145
+
8146
+ // src/catalog-pricing-upload.ts
8147
+ import { createReadStream } from "fs";
8148
+ import { open } from "fs/promises";
8149
+ import { createHash } from "crypto";
8150
+ import {
8151
+ submitCatalogPricing,
8152
+ submitCatalogRecords,
8153
+ submitCatalogEnrichment,
8154
+ submitCatalogFile
8155
+ } from "@omni-commerce/sdk";
8156
+ var CATALOG_PRICING_UPLOAD = {
8157
+ trail: ["bulk", "upload-pricing"],
8158
+ resourcePath: ["bulk"],
8159
+ methodName: "uploadPricing",
8160
+ httpMethod: "POST",
8161
+ path: "/api/v1/catalog/operations/plan",
8162
+ summary: "Upload a JSONL price and cost file in chunks to one catalog operation",
8163
+ description: "Use one product update per line. Re-run the same file and idempotency key to resume.",
8164
+ flags: [
8165
+ {
8166
+ name: "idempotencyKey",
8167
+ flag: "idempotency-key",
8168
+ required: true,
8169
+ source: "body"
8170
+ },
8171
+ {
8172
+ name: "organizationId",
8173
+ flag: "organization-id",
8174
+ required: false,
8175
+ source: "query"
8176
+ },
8177
+ {
8178
+ name: "syncToMarketplaces",
8179
+ flag: "sync-to-marketplaces",
8180
+ required: false,
8181
+ source: "body"
8182
+ },
8183
+ { name: "verify", flag: "verify", required: false, source: "body" }
8184
+ ],
8185
+ acceptsJsonBody: false,
8186
+ acceptsFile: true,
8187
+ bodyRequired: false
8188
+ };
8189
+ var catalogUploadFlags = CATALOG_PRICING_UPLOAD.flags.slice(0, 2);
8190
+ var CATALOG_RECORDS_UPLOAD = {
8191
+ ...CATALOG_PRICING_UPLOAD,
8192
+ trail: ["bulk", "upload-records"],
8193
+ methodName: "uploadRecords",
8194
+ summary: "Import catalog records from a large JSONL file",
8195
+ description: "Each line contains one product with a unique sku.",
8196
+ flags: catalogUploadFlags
8197
+ };
8198
+ var CATALOG_FILE_UPLOAD = {
8199
+ ...CATALOG_RECORDS_UPLOAD,
8200
+ trail: ["bulk", "upload-file"],
8201
+ methodName: "uploadFile",
8202
+ summary: "Upload a resumable CSV or JSONL catalog file",
8203
+ description: "Use the same file and idempotency key to resume. Set --scope to review updates to existing SKUs before submitting. The command returns one catalog operation ID.",
8204
+ flags: [
8205
+ ...catalogUploadFlags,
8206
+ {
8207
+ name: "columnMapping",
8208
+ flag: "column-mapping",
8209
+ required: false,
8210
+ source: "body"
8211
+ },
8212
+ { name: "scope", flag: "scope", required: false, source: "body" },
8213
+ {
8214
+ name: "locationId",
8215
+ flag: "location-id",
8216
+ required: false,
8217
+ source: "body"
8218
+ },
8219
+ { name: "sourceId", flag: "source-id", required: false, source: "body" },
8220
+ {
8221
+ name: "syncToMarketplaces",
8222
+ flag: "sync-to-marketplaces",
8223
+ required: false,
8224
+ source: "body"
8225
+ }
8226
+ ]
8227
+ };
8228
+ var CATALOG_ENRICHMENT_UPLOAD = {
8229
+ ...CATALOG_PRICING_UPLOAD,
8230
+ trail: ["bulk", "upload-enrichment"],
8231
+ methodName: "uploadEnrichment",
8232
+ summary: "Queue listing copy enrichment from a large JSONL file",
8233
+ description: "Each line contains one productId. Use bulk plan for custom enrichment options.",
8234
+ flags: catalogUploadFlags
8235
+ };
8236
+ var MAX_LINE_BYTES = 256 * 1024;
8237
+ async function* readCatalogRows(file, field) {
8238
+ let pending = "";
8239
+ let lineNumber = 0;
8240
+ function parseLine(line) {
8241
+ lineNumber += 1;
8242
+ if (Buffer.byteLength(line) > MAX_LINE_BYTES)
8243
+ throw new Error(`JSONL line ${lineNumber} exceeds 256 KiB.`);
8244
+ if (!line.trim()) return;
8245
+ try {
8246
+ const value = JSON.parse(line);
8247
+ if (typeof value !== "object" || value === null || typeof value[field] !== "string")
8248
+ throw new Error(`Missing ${field}`);
8249
+ return value;
8250
+ } catch {
8251
+ throw new Error(
8252
+ `JSONL line ${lineNumber} must be an object with ${field}.`
8253
+ );
8254
+ }
8255
+ }
8256
+ for await (const chunk of createReadStream(file, { encoding: "utf8" })) {
8257
+ const lines = (pending + chunk).split("\n");
8258
+ pending = lines.pop();
8259
+ for (const line of lines) {
8260
+ const update = parseLine(line);
8261
+ if (update) yield update;
8262
+ }
8263
+ if (Buffer.byteLength(pending) > MAX_LINE_BYTES)
8264
+ throw new Error(`JSONL line ${lineNumber + 1} exceeds 256 KiB.`);
8265
+ }
8266
+ if (pending) {
8267
+ const update = parseLine(pending);
8268
+ if (update) yield update;
8269
+ }
8270
+ }
8271
+ function parseBoolean(value, flag) {
8272
+ if (value === void 0) return;
8273
+ if (value === "true" || value === "false") return value === "true";
8274
+ throw new Error(`--${flag} must be true or false.`);
8275
+ }
8276
+ async function uploadCatalogPricing(client, request, command2, fetchImpl) {
8277
+ const options = {
8278
+ idempotencyKey: String(request.idempotencyKey),
8279
+ organizationId: request.organizationId
8280
+ };
8281
+ const file = String(request.file);
8282
+ if (command2 === CATALOG_FILE_UPLOAD) {
8283
+ const extension = file.split(".").at(-1)?.toLowerCase();
8284
+ if (extension !== "csv" && extension !== "jsonl")
8285
+ throw new Error("Use a .csv or .jsonl catalog file.");
8286
+ let columnMapping;
8287
+ if (request.columnMapping !== void 0) {
8288
+ const mapping = JSON.parse(String(request.columnMapping));
8289
+ if (extension !== "csv" || !mapping || typeof mapping !== "object" || Array.isArray(mapping) || !Object.values(mapping).every((value) => typeof value === "string"))
8290
+ throw new Error(
8291
+ "--column-mapping requires a JSON object that maps CSV catalog fields to supplier headers."
8292
+ );
8293
+ columnMapping = mapping;
8294
+ }
8295
+ const scope2 = request.scope;
8296
+ if (scope2 !== void 0 && scope2 !== "price" && scope2 !== "inventory" && scope2 !== "both")
8297
+ throw new Error("--scope must be price, inventory, or both.");
8298
+ const { locationId, sourceId } = request;
8299
+ const syncToMarketplaces = parseBoolean(
8300
+ request.syncToMarketplaces,
8301
+ "sync-to-marketplaces"
8302
+ );
8303
+ if ((scope2 === void 0 || scope2 === "price") && (locationId || sourceId))
8304
+ throw new Error(
8305
+ "Warehouse and source IDs require --scope inventory or both."
8306
+ );
8307
+ if ((scope2 === "inventory" || scope2 === "both") && !locationId && !sourceId)
8308
+ throw new Error("Choose --location-id or --source-id for stock updates.");
8309
+ if (scope2 === void 0 && syncToMarketplaces)
8310
+ throw new Error("--sync-to-marketplaces requires an update --scope.");
8311
+ const update = scope2 === void 0 ? void 0 : { scope: scope2, locationId, sourceId };
8312
+ const handle = await open(file, "r");
8313
+ try {
8314
+ const { size } = await handle.stat();
8315
+ return await submitCatalogFile(
8316
+ client,
8317
+ {
8318
+ ...options,
8319
+ format: extension,
8320
+ columnMapping,
8321
+ update,
8322
+ syncToMarketplaces
8323
+ },
8324
+ {
8325
+ size,
8326
+ async slice(start, end) {
8327
+ const bytes = new Uint8Array(Math.min(end, size) - start);
8328
+ let offset = 0;
8329
+ while (offset < bytes.length) {
8330
+ const { bytesRead } = await handle.read(
8331
+ bytes,
8332
+ offset,
8333
+ bytes.length - offset,
8334
+ start + offset
8335
+ );
8336
+ if (!bytesRead)
8337
+ throw new Error("The catalog file changed during upload.");
8338
+ offset += bytesRead;
8339
+ }
8340
+ return new Blob([bytes]);
8341
+ }
8342
+ },
8343
+ {
8344
+ fetch: fetchImpl,
8345
+ digest: async (bytes) => new Uint8Array(
8346
+ createHash("sha256").update(new Uint8Array(bytes)).digest()
8347
+ ).buffer
8348
+ }
8349
+ );
8350
+ } finally {
8351
+ await handle.close();
8352
+ }
8353
+ }
8354
+ if (command2 === CATALOG_RECORDS_UPLOAD)
8355
+ return submitCatalogRecords(
8356
+ client,
8357
+ options,
8358
+ readCatalogRows(file, "sku")
8359
+ );
8360
+ if (command2 === CATALOG_ENRICHMENT_UPLOAD) {
8361
+ const ids = async function* () {
8362
+ for await (const { productId } of readCatalogRows(
8363
+ file,
8364
+ "productId"
8365
+ ))
8366
+ yield productId;
8367
+ };
8368
+ return submitCatalogEnrichment(
8369
+ client,
8370
+ { ...options, enrichment: {} },
8371
+ ids()
8372
+ );
8373
+ }
8374
+ return submitCatalogPricing(
8375
+ client,
8376
+ {
8377
+ ...options,
8378
+ syncToMarketplaces: parseBoolean(
8379
+ request.syncToMarketplaces,
8380
+ "sync-to-marketplaces"
8381
+ ),
8382
+ verify: parseBoolean(request.verify, "verify")
8383
+ },
8384
+ readCatalogRows(file, "productId")
8385
+ );
8386
+ }
8387
+
7365
8388
  // src/run.ts
8389
+ var CATALOG_UPLOADS = [
8390
+ CATALOG_PRICING_UPLOAD,
8391
+ CATALOG_RECORDS_UPLOAD,
8392
+ CATALOG_FILE_UPLOAD,
8393
+ CATALOG_ENRICHMENT_UPLOAD
8394
+ ];
7366
8395
  var CLI_COMMANDS = [
7367
8396
  ...COMMANDS.filter(
7368
8397
  (command2) => !CAMPAIGN_COMMANDS.some(
7369
8398
  (custom) => custom.trail.join(" ") === command2.trail.join(" ")
7370
8399
  )
7371
8400
  ),
7372
- ...CAMPAIGN_COMMANDS
8401
+ ...CAMPAIGN_COMMANDS,
8402
+ ...CATALOG_UPLOADS,
8403
+ CATALOG_FILE_ERRORS
7373
8404
  ];
7374
8405
  async function readStdin() {
7375
8406
  const chunks = [];
@@ -7552,7 +8583,11 @@ ${unique.map((line) => ` omni ${line}`).join("\n")}
7552
8583
  fetch: options?.fetch
7553
8584
  });
7554
8585
  try {
7555
- const result = await executeCommand(client, command2, request);
8586
+ if (command2 === CATALOG_FILE_ERRORS) {
8587
+ await exportCatalogFileErrors(client, request);
8588
+ return 0;
8589
+ }
8590
+ const result = CATALOG_UPLOADS.includes(command2) ? await uploadCatalogPricing(client, request, command2, options?.fetch) : await executeCommand(client, command2, request);
7556
8591
  const format = resolveFormat(
7557
8592
  flagString(parsed.flags, "format"),
7558
8593
  options?.stdoutIsTty ?? Boolean(process.stdout.isTTY)