@omni-commerce/cli 0.22.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/README.md +4 -0
- package/dist/index.js +901 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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.
|
|
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.
|
|
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
|
|
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"],
|
|
@@ -2434,6 +3002,38 @@ var COMMANDS = [
|
|
|
2434
3002
|
acceptsFile: false,
|
|
2435
3003
|
bodyRequired: false
|
|
2436
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"
|
|
3019
|
+
},
|
|
3020
|
+
{
|
|
3021
|
+
name: "connectionId",
|
|
3022
|
+
flag: "connection-id",
|
|
3023
|
+
required: false,
|
|
3024
|
+
source: "query"
|
|
3025
|
+
},
|
|
3026
|
+
{
|
|
3027
|
+
name: "organizationId",
|
|
3028
|
+
flag: "organization-id",
|
|
3029
|
+
required: false,
|
|
3030
|
+
source: "query"
|
|
3031
|
+
}
|
|
3032
|
+
],
|
|
3033
|
+
acceptsJsonBody: false,
|
|
3034
|
+
acceptsFile: false,
|
|
3035
|
+
bodyRequired: false
|
|
3036
|
+
},
|
|
2437
3037
|
{
|
|
2438
3038
|
trail: ["evaluate", "run"],
|
|
2439
3039
|
resourcePath: ["evaluate"],
|
|
@@ -7501,14 +8101,306 @@ function matchCommands(commands, trail) {
|
|
|
7501
8101
|
return { exact, prefix };
|
|
7502
8102
|
}
|
|
7503
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
|
+
|
|
7504
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
|
+
];
|
|
7505
8395
|
var CLI_COMMANDS = [
|
|
7506
8396
|
...COMMANDS.filter(
|
|
7507
8397
|
(command2) => !CAMPAIGN_COMMANDS.some(
|
|
7508
8398
|
(custom) => custom.trail.join(" ") === command2.trail.join(" ")
|
|
7509
8399
|
)
|
|
7510
8400
|
),
|
|
7511
|
-
...CAMPAIGN_COMMANDS
|
|
8401
|
+
...CAMPAIGN_COMMANDS,
|
|
8402
|
+
...CATALOG_UPLOADS,
|
|
8403
|
+
CATALOG_FILE_ERRORS
|
|
7512
8404
|
];
|
|
7513
8405
|
async function readStdin() {
|
|
7514
8406
|
const chunks = [];
|
|
@@ -7691,7 +8583,11 @@ ${unique.map((line) => ` omni ${line}`).join("\n")}
|
|
|
7691
8583
|
fetch: options?.fetch
|
|
7692
8584
|
});
|
|
7693
8585
|
try {
|
|
7694
|
-
|
|
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);
|
|
7695
8591
|
const format = resolveFormat(
|
|
7696
8592
|
flagString(parsed.flags, "format"),
|
|
7697
8593
|
options?.stdoutIsTty ?? Boolean(process.stdout.isTTY)
|