@forjio/storlaunch-cli 0.2.0 → 0.4.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/commands/inventory.d.ts +4 -0
- package/dist/commands/inventory.d.ts.map +1 -0
- package/dist/commands/inventory.js +469 -0
- package/dist/commands/inventory.js.map +1 -0
- package/dist/commands/ledger.d.ts +4 -0
- package/dist/commands/ledger.d.ts.map +1 -0
- package/dist/commands/ledger.js +178 -0
- package/dist/commands/ledger.js.map +1 -0
- package/dist/commands/sell.d.ts +3 -5
- package/dist/commands/sell.d.ts.map +1 -1
- package/dist/commands/sell.js +9 -5
- package/dist/commands/sell.js.map +1 -1
- package/dist/commands/shipping.d.ts +4 -0
- package/dist/commands/shipping.d.ts.map +1 -0
- package/dist/commands/shipping.js +344 -0
- package/dist/commands/shipping.js.map +1 -0
- package/dist/commands/storefront.d.ts.map +1 -1
- package/dist/commands/storefront.js +45 -4
- package/dist/commands/storefront.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inventory.d.ts","sourceRoot":"","sources":["../../src/commands/inventory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA+bpC,QAAA,MAAM,SAAS,SAA6E,CAAC;AAM7F,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { readFileSync } from "node:fs";
|
|
4
|
+
import { apiRequest, ApiClientError } from "../lib/api.js";
|
|
5
|
+
import { output } from "../lib/output.js";
|
|
6
|
+
/**
|
|
7
|
+
* `sell inventory` — variants, warehouses, stock adjustments, CSV import,
|
|
8
|
+
* low-stock alerts, movement history. Covers the full set of /inventory/*
|
|
9
|
+
* merchant endpoints.
|
|
10
|
+
*/
|
|
11
|
+
function getExitCode(err) {
|
|
12
|
+
if (err instanceof ApiClientError) {
|
|
13
|
+
if (err.status === 401 || err.status === 403)
|
|
14
|
+
return 2;
|
|
15
|
+
if (err.status === 429)
|
|
16
|
+
return 3;
|
|
17
|
+
if (err.code === "QUOTA_EXCEEDED")
|
|
18
|
+
return 4;
|
|
19
|
+
}
|
|
20
|
+
return 1;
|
|
21
|
+
}
|
|
22
|
+
function handleError(err, json) {
|
|
23
|
+
if (json && err instanceof ApiClientError) {
|
|
24
|
+
console.error(JSON.stringify({ data: null, error: { code: err.code, message: err.message } }, null, 2));
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
console.error(chalk.red(`Error: ${err instanceof Error ? err.message : String(err)}`));
|
|
28
|
+
}
|
|
29
|
+
process.exit(getExitCode(err));
|
|
30
|
+
}
|
|
31
|
+
// ─── Variants ────────────────────────────────────────────────
|
|
32
|
+
const variants = new Command("variants").description("Manage product variants (SKUs)");
|
|
33
|
+
variants
|
|
34
|
+
.command("create")
|
|
35
|
+
.description("Create a variant (SKU) for a product")
|
|
36
|
+
.requiredOption("--product <id>", "Product ID")
|
|
37
|
+
.requiredOption("--name <name>", "Variant name (e.g. 'Red / M')")
|
|
38
|
+
.option("--sku <sku>", "SKU code")
|
|
39
|
+
.option("--price-delta <amount>", "Price delta vs product price in smallest currency unit", parseInt)
|
|
40
|
+
.option("--cost-price <amount>", "Cost price for margin tracking", parseInt)
|
|
41
|
+
.option("--low-stock-threshold <n>", "Alert when stock drops below this", parseInt)
|
|
42
|
+
.action(async (opts, cmd) => {
|
|
43
|
+
const g = cmd.optsWithGlobals();
|
|
44
|
+
try {
|
|
45
|
+
const body = {
|
|
46
|
+
productId: opts.product,
|
|
47
|
+
name: opts.name,
|
|
48
|
+
};
|
|
49
|
+
if (opts.sku)
|
|
50
|
+
body["sku"] = opts.sku;
|
|
51
|
+
if (opts.priceDelta !== undefined)
|
|
52
|
+
body["priceDelta"] = opts.priceDelta;
|
|
53
|
+
if (opts.costPrice !== undefined)
|
|
54
|
+
body["costPrice"] = opts.costPrice;
|
|
55
|
+
if (opts.lowStockThreshold !== undefined)
|
|
56
|
+
body["lowStockThreshold"] = opts.lowStockThreshold;
|
|
57
|
+
const result = await apiRequest("/inventory/variants", {
|
|
58
|
+
method: "POST",
|
|
59
|
+
body,
|
|
60
|
+
sandbox: g.sandbox,
|
|
61
|
+
});
|
|
62
|
+
if (g.json) {
|
|
63
|
+
output(result, { json: true });
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const data = (result["data"] ?? result);
|
|
67
|
+
console.log(`Variant created: ${chalk.bold(String(data["id"]))}`);
|
|
68
|
+
console.log(`Name: ${data["name"]}`);
|
|
69
|
+
if (data["sku"])
|
|
70
|
+
console.log(`SKU: ${data["sku"]}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
handleError(err, g.json);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
variants
|
|
78
|
+
.command("list")
|
|
79
|
+
.description("List variants for a product")
|
|
80
|
+
.requiredOption("--product <id>", "Product ID")
|
|
81
|
+
.action(async (opts, cmd) => {
|
|
82
|
+
const g = cmd.optsWithGlobals();
|
|
83
|
+
try {
|
|
84
|
+
const result = await apiRequest("/inventory/variants", {
|
|
85
|
+
query: { productId: opts.product },
|
|
86
|
+
sandbox: g.sandbox,
|
|
87
|
+
});
|
|
88
|
+
if (g.json) {
|
|
89
|
+
output(result, { json: true });
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
const cols = [
|
|
93
|
+
{ key: "id", header: "ID", width: 24 },
|
|
94
|
+
{ key: "name", header: "Name", width: 24 },
|
|
95
|
+
{ key: "sku", header: "SKU", width: 20 },
|
|
96
|
+
{ key: "priceDelta", header: "Δ Price" },
|
|
97
|
+
{ key: "lowStockThreshold", header: "Alert ≤" },
|
|
98
|
+
{ key: "isDefault", header: "Default" },
|
|
99
|
+
];
|
|
100
|
+
output((result["data"] ?? result), { columns: cols });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
handleError(err, g.json);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
variants
|
|
108
|
+
.command("update <id>")
|
|
109
|
+
.description("Update a variant")
|
|
110
|
+
.option("--name <name>", "New name")
|
|
111
|
+
.option("--sku <sku>", "New SKU code")
|
|
112
|
+
.option("--price-delta <amount>", "New price delta", parseInt)
|
|
113
|
+
.option("--cost-price <amount>", "New cost price", parseInt)
|
|
114
|
+
.option("--low-stock-threshold <n>", "New threshold", parseInt)
|
|
115
|
+
.action(async (id, opts, cmd) => {
|
|
116
|
+
const g = cmd.optsWithGlobals();
|
|
117
|
+
try {
|
|
118
|
+
const body = {};
|
|
119
|
+
if (opts.name)
|
|
120
|
+
body["name"] = opts.name;
|
|
121
|
+
if (opts.sku !== undefined)
|
|
122
|
+
body["sku"] = opts.sku;
|
|
123
|
+
if (opts.priceDelta !== undefined)
|
|
124
|
+
body["priceDelta"] = opts.priceDelta;
|
|
125
|
+
if (opts.costPrice !== undefined)
|
|
126
|
+
body["costPrice"] = opts.costPrice;
|
|
127
|
+
if (opts.lowStockThreshold !== undefined)
|
|
128
|
+
body["lowStockThreshold"] = opts.lowStockThreshold;
|
|
129
|
+
const result = await apiRequest(`/inventory/variants/${id}`, {
|
|
130
|
+
method: "PATCH",
|
|
131
|
+
body,
|
|
132
|
+
sandbox: g.sandbox,
|
|
133
|
+
});
|
|
134
|
+
if (g.json) {
|
|
135
|
+
output(result, { json: true });
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
console.log(chalk.green(`Variant ${id} updated.`));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
catch (err) {
|
|
142
|
+
handleError(err, g.json);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
variants
|
|
146
|
+
.command("delete <id>")
|
|
147
|
+
.description("Archive a variant (default variant cannot be archived)")
|
|
148
|
+
.action(async (id, _, cmd) => {
|
|
149
|
+
const g = cmd.optsWithGlobals();
|
|
150
|
+
try {
|
|
151
|
+
await apiRequest(`/inventory/variants/${id}`, { method: "DELETE", sandbox: g.sandbox });
|
|
152
|
+
if (g.json) {
|
|
153
|
+
output({ archived: true, id }, { json: true });
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
console.log(chalk.green(`Variant ${id} archived.`));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
catch (err) {
|
|
160
|
+
handleError(err, g.json);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
// ─── Warehouses ──────────────────────────────────────────────
|
|
164
|
+
const warehouses = new Command("warehouses").description("Manage warehouses / stock locations");
|
|
165
|
+
warehouses
|
|
166
|
+
.command("create")
|
|
167
|
+
.description("Create a warehouse")
|
|
168
|
+
.requiredOption("--name <name>", "Warehouse name")
|
|
169
|
+
.option("--address <text>", "Street address")
|
|
170
|
+
.option("--city <city>", "City")
|
|
171
|
+
.option("--postal <code>", "Postal code")
|
|
172
|
+
.option("--lat <n>", "Latitude", parseFloat)
|
|
173
|
+
.option("--lng <n>", "Longitude", parseFloat)
|
|
174
|
+
.option("--phone <phone>", "Contact phone")
|
|
175
|
+
.option("--default", "Set as default warehouse")
|
|
176
|
+
.action(async (opts, cmd) => {
|
|
177
|
+
const g = cmd.optsWithGlobals();
|
|
178
|
+
try {
|
|
179
|
+
const body = { name: opts.name };
|
|
180
|
+
if (opts.address)
|
|
181
|
+
body["address"] = opts.address;
|
|
182
|
+
if (opts.city)
|
|
183
|
+
body["city"] = opts.city;
|
|
184
|
+
if (opts.postal)
|
|
185
|
+
body["postal"] = opts.postal;
|
|
186
|
+
if (opts.lat !== undefined)
|
|
187
|
+
body["lat"] = opts.lat;
|
|
188
|
+
if (opts.lng !== undefined)
|
|
189
|
+
body["lng"] = opts.lng;
|
|
190
|
+
if (opts.phone)
|
|
191
|
+
body["phone"] = opts.phone;
|
|
192
|
+
if (opts.default)
|
|
193
|
+
body["isDefault"] = true;
|
|
194
|
+
const result = await apiRequest("/inventory/warehouses", {
|
|
195
|
+
method: "POST",
|
|
196
|
+
body,
|
|
197
|
+
sandbox: g.sandbox,
|
|
198
|
+
});
|
|
199
|
+
if (g.json) {
|
|
200
|
+
output(result, { json: true });
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
const data = (result["data"] ?? result);
|
|
204
|
+
console.log(`Warehouse created: ${chalk.bold(String(data["id"]))}`);
|
|
205
|
+
console.log(`Name: ${data["name"]}`);
|
|
206
|
+
if (data["isDefault"])
|
|
207
|
+
console.log(chalk.dim("Default: yes"));
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
catch (err) {
|
|
211
|
+
handleError(err, g.json);
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
warehouses
|
|
215
|
+
.command("list")
|
|
216
|
+
.description("List warehouses")
|
|
217
|
+
.action(async (_opts, cmd) => {
|
|
218
|
+
const g = cmd.optsWithGlobals();
|
|
219
|
+
try {
|
|
220
|
+
const result = await apiRequest("/inventory/warehouses", {
|
|
221
|
+
sandbox: g.sandbox,
|
|
222
|
+
});
|
|
223
|
+
if (g.json) {
|
|
224
|
+
output(result, { json: true });
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
const cols = [
|
|
228
|
+
{ key: "id", header: "ID", width: 24 },
|
|
229
|
+
{ key: "name", header: "Name", width: 24 },
|
|
230
|
+
{ key: "city", header: "City", width: 16 },
|
|
231
|
+
{ key: "postal", header: "Postal" },
|
|
232
|
+
{ key: "isDefault", header: "Default" },
|
|
233
|
+
];
|
|
234
|
+
output((result["data"] ?? result), { columns: cols });
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
catch (err) {
|
|
238
|
+
handleError(err, g.json);
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
warehouses
|
|
242
|
+
.command("update <id>")
|
|
243
|
+
.description("Update a warehouse")
|
|
244
|
+
.option("--name <name>", "New name")
|
|
245
|
+
.option("--address <text>", "New street address")
|
|
246
|
+
.option("--city <city>", "New city")
|
|
247
|
+
.option("--postal <code>", "New postal code")
|
|
248
|
+
.option("--lat <n>", "New latitude", parseFloat)
|
|
249
|
+
.option("--lng <n>", "New longitude", parseFloat)
|
|
250
|
+
.option("--phone <phone>", "New contact phone")
|
|
251
|
+
.option("--default", "Make this the default warehouse (demotes current default)")
|
|
252
|
+
.action(async (id, opts, cmd) => {
|
|
253
|
+
const g = cmd.optsWithGlobals();
|
|
254
|
+
try {
|
|
255
|
+
const body = {};
|
|
256
|
+
if (opts.name)
|
|
257
|
+
body["name"] = opts.name;
|
|
258
|
+
if (opts.address !== undefined)
|
|
259
|
+
body["address"] = opts.address;
|
|
260
|
+
if (opts.city !== undefined)
|
|
261
|
+
body["city"] = opts.city;
|
|
262
|
+
if (opts.postal !== undefined)
|
|
263
|
+
body["postal"] = opts.postal;
|
|
264
|
+
if (opts.lat !== undefined)
|
|
265
|
+
body["lat"] = opts.lat;
|
|
266
|
+
if (opts.lng !== undefined)
|
|
267
|
+
body["lng"] = opts.lng;
|
|
268
|
+
if (opts.phone !== undefined)
|
|
269
|
+
body["phone"] = opts.phone;
|
|
270
|
+
if (opts.default)
|
|
271
|
+
body["isDefault"] = true;
|
|
272
|
+
const result = await apiRequest(`/inventory/warehouses/${id}`, {
|
|
273
|
+
method: "PATCH",
|
|
274
|
+
body,
|
|
275
|
+
sandbox: g.sandbox,
|
|
276
|
+
});
|
|
277
|
+
if (g.json) {
|
|
278
|
+
output(result, { json: true });
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
console.log(chalk.green(`Warehouse ${id} updated.`));
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
catch (err) {
|
|
285
|
+
handleError(err, g.json);
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
warehouses
|
|
289
|
+
.command("delete <id>")
|
|
290
|
+
.description("Archive a warehouse (default warehouse cannot be archived)")
|
|
291
|
+
.action(async (id, _, cmd) => {
|
|
292
|
+
const g = cmd.optsWithGlobals();
|
|
293
|
+
try {
|
|
294
|
+
await apiRequest(`/inventory/warehouses/${id}`, { method: "DELETE", sandbox: g.sandbox });
|
|
295
|
+
if (g.json) {
|
|
296
|
+
output({ archived: true, id }, { json: true });
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
console.log(chalk.green(`Warehouse ${id} archived.`));
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
catch (err) {
|
|
303
|
+
handleError(err, g.json);
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
// ─── Stock ───────────────────────────────────────────────────
|
|
307
|
+
const stock = new Command("stock").description("Stock levels, adjustments, history, alerts");
|
|
308
|
+
stock
|
|
309
|
+
.command("get")
|
|
310
|
+
.description("Get stock for a variant across all warehouses")
|
|
311
|
+
.requiredOption("--variant <id>", "Variant ID")
|
|
312
|
+
.action(async (opts, cmd) => {
|
|
313
|
+
const g = cmd.optsWithGlobals();
|
|
314
|
+
try {
|
|
315
|
+
const result = await apiRequest("/inventory/stock", {
|
|
316
|
+
query: { variantId: opts.variant },
|
|
317
|
+
sandbox: g.sandbox,
|
|
318
|
+
});
|
|
319
|
+
output(result, { json: g.json });
|
|
320
|
+
}
|
|
321
|
+
catch (err) {
|
|
322
|
+
handleError(err, g.json);
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
stock
|
|
326
|
+
.command("adjust")
|
|
327
|
+
.description("Adjust stock (positive delta = receive, negative = remove)")
|
|
328
|
+
.requiredOption("--variant <id>", "Variant ID")
|
|
329
|
+
.requiredOption("--warehouse <id>", "Warehouse ID")
|
|
330
|
+
.requiredOption("--delta <n>", "Stock delta (can be negative)", parseInt)
|
|
331
|
+
.option("--reason <reason>", "Reason: manual_adjust, refund_restock, transfer_in, transfer_out, damaged, returned_to_supplier, initial_stock, import", "manual_adjust")
|
|
332
|
+
.option("--note <text>", "Optional note")
|
|
333
|
+
.action(async (opts, cmd) => {
|
|
334
|
+
const g = cmd.optsWithGlobals();
|
|
335
|
+
try {
|
|
336
|
+
const body = {
|
|
337
|
+
variantId: opts.variant,
|
|
338
|
+
warehouseId: opts.warehouse,
|
|
339
|
+
delta: opts.delta,
|
|
340
|
+
reason: opts.reason,
|
|
341
|
+
};
|
|
342
|
+
if (opts.note)
|
|
343
|
+
body["note"] = opts.note;
|
|
344
|
+
const result = await apiRequest("/inventory/adjust", {
|
|
345
|
+
method: "POST",
|
|
346
|
+
body,
|
|
347
|
+
sandbox: g.sandbox,
|
|
348
|
+
});
|
|
349
|
+
if (g.json) {
|
|
350
|
+
output(result, { json: true });
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
const data = (result["data"] ?? result);
|
|
354
|
+
const sign = opts.delta > 0 ? "+" : "";
|
|
355
|
+
console.log(chalk.green(`Stock adjusted: ${sign}${opts.delta} (${opts.reason})`));
|
|
356
|
+
if (data["id"])
|
|
357
|
+
console.log(chalk.dim(`Movement: ${String(data["id"])}`));
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
catch (err) {
|
|
361
|
+
handleError(err, g.json);
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
stock
|
|
365
|
+
.command("history")
|
|
366
|
+
.description("Stock movement history")
|
|
367
|
+
.option("--variant <id>", "Filter by variant ID")
|
|
368
|
+
.option("--warehouse <id>", "Filter by warehouse ID")
|
|
369
|
+
.option("--limit <n>", "Items per page", parseInt)
|
|
370
|
+
.option("--cursor <cursor>", "Pagination cursor")
|
|
371
|
+
.action(async (opts, cmd) => {
|
|
372
|
+
const g = cmd.optsWithGlobals();
|
|
373
|
+
try {
|
|
374
|
+
const result = await apiRequest("/inventory/movements", {
|
|
375
|
+
query: {
|
|
376
|
+
variantId: opts.variant,
|
|
377
|
+
warehouseId: opts.warehouse,
|
|
378
|
+
limit: opts.limit,
|
|
379
|
+
cursor: opts.cursor,
|
|
380
|
+
},
|
|
381
|
+
sandbox: g.sandbox,
|
|
382
|
+
});
|
|
383
|
+
if (g.json) {
|
|
384
|
+
output(result, { json: true });
|
|
385
|
+
}
|
|
386
|
+
else {
|
|
387
|
+
const cols = [
|
|
388
|
+
{ key: "createdAt", header: "When", width: 24 },
|
|
389
|
+
{ key: "delta", header: "Δ" },
|
|
390
|
+
{ key: "reason", header: "Reason", width: 20 },
|
|
391
|
+
{ key: "variantId", header: "Variant", width: 24 },
|
|
392
|
+
{ key: "warehouseId", header: "Warehouse", width: 24 },
|
|
393
|
+
{ key: "note", header: "Note", width: 30 },
|
|
394
|
+
];
|
|
395
|
+
output((result["data"] ?? result), { columns: cols });
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
catch (err) {
|
|
399
|
+
handleError(err, g.json);
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
stock
|
|
403
|
+
.command("alerts")
|
|
404
|
+
.description("List low-stock alerts across all variants + warehouses")
|
|
405
|
+
.action(async (_opts, cmd) => {
|
|
406
|
+
const g = cmd.optsWithGlobals();
|
|
407
|
+
try {
|
|
408
|
+
const result = await apiRequest("/inventory/low-stock", {
|
|
409
|
+
sandbox: g.sandbox,
|
|
410
|
+
});
|
|
411
|
+
if (g.json) {
|
|
412
|
+
output(result, { json: true });
|
|
413
|
+
}
|
|
414
|
+
else {
|
|
415
|
+
const cols = [
|
|
416
|
+
{ key: "productName", header: "Product", width: 24 },
|
|
417
|
+
{ key: "variantName", header: "Variant", width: 20 },
|
|
418
|
+
{ key: "sku", header: "SKU", width: 18 },
|
|
419
|
+
{ key: "warehouseName", header: "Warehouse", width: 18 },
|
|
420
|
+
{ key: "currentStock", header: "On hand" },
|
|
421
|
+
{ key: "threshold", header: "Threshold" },
|
|
422
|
+
];
|
|
423
|
+
output((result["data"] ?? result), { columns: cols });
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
catch (err) {
|
|
427
|
+
handleError(err, g.json);
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
stock
|
|
431
|
+
.command("import")
|
|
432
|
+
.description("Bulk import stock from a CSV file")
|
|
433
|
+
.requiredOption("--file <path>", "Path to CSV file (columns: sku,name,productSlug,warehouseId,quantity,lowStockThreshold,costPrice)")
|
|
434
|
+
.action(async (opts, cmd) => {
|
|
435
|
+
const g = cmd.optsWithGlobals();
|
|
436
|
+
try {
|
|
437
|
+
const csv = readFileSync(opts.file, "utf8");
|
|
438
|
+
const result = await apiRequest("/inventory/import", {
|
|
439
|
+
method: "POST",
|
|
440
|
+
body: { csv },
|
|
441
|
+
sandbox: g.sandbox,
|
|
442
|
+
});
|
|
443
|
+
if (g.json) {
|
|
444
|
+
output(result, { json: true });
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
const data = (result["data"] ?? result);
|
|
448
|
+
console.log(chalk.green(`Imported: ${data["imported"] ?? 0}`));
|
|
449
|
+
if (data["skipped"])
|
|
450
|
+
console.log(chalk.yellow(`Skipped: ${data["skipped"]}`));
|
|
451
|
+
const errors = data["errors"];
|
|
452
|
+
if (errors && errors.length > 0) {
|
|
453
|
+
console.log(chalk.red(`Errors:`));
|
|
454
|
+
for (const e of errors)
|
|
455
|
+
console.log(chalk.red(` - ${e}`));
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
catch (err) {
|
|
460
|
+
handleError(err, g.json);
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
// ─── Top-level inventory command ─────────────────────────────
|
|
464
|
+
const inventory = new Command("inventory").description("Variants (SKUs), warehouses, stock");
|
|
465
|
+
inventory.addCommand(variants);
|
|
466
|
+
inventory.addCommand(warehouses);
|
|
467
|
+
inventory.addCommand(stock);
|
|
468
|
+
export { inventory };
|
|
469
|
+
//# sourceMappingURL=inventory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inventory.js","sourceRoot":"","sources":["../../src/commands/inventory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,O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