@velaro/cli 1.4.132 → 1.4.133

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.
@@ -73,6 +73,16 @@ ${RED}✗ Connection failed: ${e.message}${RST}
73
73
  }
74
74
  }
75
75
 
76
+ // The search endpoints need the Magento config id (configId) and the search text (query).
77
+ // Resolve the active store from /Magento/Configs; --config-id overrides it.
78
+ async function resolveConfigId(argv) {
79
+ if (argv.configId) return argv.configId;
80
+ const stores = await request('GET', '/Magento/Configs');
81
+ const active = (Array.isArray(stores) ? stores : []).find((s) => s.isActive);
82
+ if (!active) throw new Error('No active Magento store connected for this site.');
83
+ return active.id;
84
+ }
85
+
76
86
  // ── customers ─────────────────────────────────────────────────────────────────
77
87
 
78
88
  async function customersHandler(argv) {
@@ -81,7 +91,8 @@ async function customersHandler(argv) {
81
91
  process.exitCode = 1;
82
92
  return;
83
93
  }
84
- const r = await request('GET', `/Magento/Customers/Search?q=${encodeURIComponent(argv.email)}`);
94
+ const configId = await resolveConfigId(argv);
95
+ const r = await request('GET', `/Magento/Customers/Search?configId=${configId}&query=${encodeURIComponent(argv.email)}`);
85
96
  if (!r || !r.id) {
86
97
  console.log(`\nNo customer found for ${argv.email}.\n`);
87
98
  return;
@@ -104,7 +115,8 @@ async function ordersHandler(argv) {
104
115
  }
105
116
  const q = argv.id ?? argv.email;
106
117
  const limit = Math.min(50, argv.limit ?? 10);
107
- const orders = await request('GET', `/Magento/Orders/Search?q=${encodeURIComponent(q)}&limit=${limit}`);
118
+ const configId = await resolveConfigId(argv);
119
+ const orders = await request('GET', `/Magento/Orders/Search?configId=${configId}&query=${encodeURIComponent(q)}&limit=${limit}`);
108
120
  if (!Array.isArray(orders) || orders.length === 0) {
109
121
  console.log(`\nNo orders found for "${q}".\n`);
110
122
  return;
@@ -129,7 +141,8 @@ async function productsHandler(argv) {
129
141
  return;
130
142
  }
131
143
  const limit = Math.min(50, argv.limit ?? 10);
132
- const products = await request('GET', `/Magento/Products/Search?q=${encodeURIComponent(argv.query)}&limit=${limit}`);
144
+ const configId = await resolveConfigId(argv);
145
+ const products = await request('GET', `/Magento/Products/Search?configId=${configId}&query=${encodeURIComponent(argv.query)}&limit=${limit}`);
133
146
  if (!Array.isArray(products) || products.length === 0) {
134
147
  console.log(`\nNo products found for "${argv.query}".\n`);
135
148
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velaro/cli",
3
- "version": "1.4.132",
3
+ "version": "1.4.133",
4
4
  "description": "Velaro Workspace v20 — command-line interface for managing bots, knowledge base ingestion, MCP API keys, search indexes, and ops health.",
5
5
  "type": "module",
6
6
  "bin": {