ebag 0.1.2 → 0.1.4

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 CHANGED
@@ -22,14 +22,12 @@ Get the cookie header from your browser and store it:
22
22
  ebag login --cookie "<cookie>"
23
23
  ```
24
24
 
25
- Notes:
25
+ ## Data and storage
26
26
 
27
+ - Config is stored in `~/.config/ebag` (override with `EBAG_CONFIG_DIR`).
27
28
  - Session data is stored in plain text at `~/.config/ebag/session.json` with owner-only permissions (`0600`).
28
29
  - List-based search caches product details in `~/.config/ebag/cache.json` for up to 6 hours.
29
- - Completed orders may be cached locally for faster access.
30
- - Unknown order statuses warn on stderr and include a link to file a GitHub issue.
31
- - API `statusText` values are inconsistent with the website and intentionally ignored (including `--json`).
32
- - `statusDescription` is the supported status label field in `--json` output and is computed at runtime.
30
+ - Completed orders may be cached locally for faster access, and the order cache is retained indefinitely.
33
31
 
34
32
  ## Products
35
33
 
@@ -99,6 +97,14 @@ npm test
99
97
 
100
98
  ## Changelog
101
99
 
100
+ ### 0.1.4
101
+
102
+ - Show out-of-stock status and expected restock date in cart output
103
+
104
+ ### 0.1.3
105
+
106
+ - Require `--qty` for cart update command
107
+
102
108
  ### 0.1.2
103
109
 
104
110
  - Log unknown order statuses in the lib layer and warn in the CLI
@@ -6,6 +6,8 @@ export declare function outputList(items: {
6
6
  id: number;
7
7
  name: string;
8
8
  count?: number;
9
+ available?: boolean;
10
+ expectedSupplyDate?: string;
9
11
  }[]): void;
10
12
  export declare function outputProductDetail(data: Record<string, unknown>): void;
11
13
  export declare function outputOrdersList(orders: OrderSummary[]): void;
@@ -43,7 +43,13 @@ function outputProducts(products) {
43
43
  function outputList(items) {
44
44
  for (const item of items) {
45
45
  const count = item.count !== undefined ? ` (${item.count})` : "";
46
- process.stdout.write(`${item.id} ${item.name}${count}\n`);
46
+ let suffix = "";
47
+ if (item.available === false) {
48
+ suffix = item.expectedSupplyDate
49
+ ? ` [out of stock, expected ${item.expectedSupplyDate}]`
50
+ : " [out of stock, no restock date]";
51
+ }
52
+ process.stdout.write(`${item.id} ${item.name}${count}${suffix}\n`);
47
53
  }
48
54
  }
49
55
  function outputProductDetail(data) {
package/dist/cli/index.js CHANGED
@@ -337,7 +337,7 @@ async function main() {
337
337
  cart
338
338
  .command("update")
339
339
  .argument("<productId>", "Product ID")
340
- .option("--qty <n>", "Quantity", "1")
340
+ .requiredOption("--qty <n>", "Quantity")
341
341
  .action(async (productId, options) => {
342
342
  const config = (0, config_1.loadConfig)();
343
343
  const session = requireSessionCookie();
@@ -377,7 +377,13 @@ async function main() {
377
377
  const count = entry.quantity ?? entry.qty;
378
378
  if (!id)
379
379
  return null;
380
- return { id: Number(id), name, count };
380
+ return {
381
+ id: Number(id),
382
+ name,
383
+ count,
384
+ available: entry.available,
385
+ expectedSupplyDate: entry.product?.expected_supply_date,
386
+ };
381
387
  })
382
388
  .filter(Boolean);
383
389
  if (listItems.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ebag",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Unofficial CLI for interacting with ebag.bg using cookie-based auth.",
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.ts",