@hisaabo/cli 0.3.2 → 0.5.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/.turbo/turbo-typecheck.log +1 -1
- package/README.md +1 -1
- package/dist/bin/{audit-trail-2YGXGUXW.js → audit-trail-5LOCJ7XZ.js} +4 -4
- package/dist/bin/{categories-P5VFWD5F.js → categories-64WWZTND.js} +3 -3
- package/dist/bin/{check-slug-4TMOTWUJ.js → check-slug-FLHHUDYS.js} +3 -3
- package/dist/bin/{chunk-FTOBDKMO.js → chunk-4MEL44QX.js} +54 -10
- package/dist/bin/chunk-FIMJZAS4.js +84 -0
- package/dist/bin/{chunk-EYNDY7RB.js → chunk-NO4FIFMS.js} +2 -1
- package/dist/bin/{chunk-FFBG6RU4.js → chunk-T63VQXNM.js} +1 -1
- package/dist/bin/{client-QNJ2H5CW.js → client-5NZ23GML.js} +1 -1
- package/dist/bin/{collection-efficiency-WMKEGS6U.js → collection-efficiency-U56XNVEE.js} +4 -4
- package/dist/bin/{config-UKVQYPPR.js → config-335MN4I7.js} +2 -2
- package/dist/bin/{create-Y22FAVOW.js → create-RPDEORDD.js} +3 -3
- package/dist/bin/{default-account-SA56M66A.js → default-account-AE6EXZZR.js} +3 -3
- package/dist/bin/{expenses-VZAOLYUW.js → expenses-5N2QSG54.js} +4 -4
- package/dist/bin/{export-QZ6WT6PJ.js → export-QICOQK34.js} +3 -3
- package/dist/bin/{factory-2DCU3B5T.js → factory-KOCW2AQM.js} +4 -4
- package/dist/bin/{get-EXL44I2X.js → get-A43QCI2S.js} +3 -3
- package/dist/bin/{get-6UYP6UVD.js → get-GWH6S5SJ.js} +4 -4
- package/dist/bin/hisaabo.js +281 -70
- package/dist/bin/invitations-P3EEN5WI.js +66 -0
- package/dist/bin/{invite-O26SAL72.js → invite-T3CKX53E.js} +3 -3
- package/dist/bin/{invoice-breakdown-XEATXVMR.js → invoice-breakdown-FN5BEFJD.js} +4 -4
- package/dist/bin/{items-3U5USBVG.js → items-2OOCQKVF.js} +4 -4
- package/dist/bin/{items-toggle-YEKMI2CM.js → items-toggle-SKZWCGJH.js} +3 -3
- package/dist/bin/{list-VBAHY72W.js → list-A2RKI3ZG.js} +4 -4
- package/dist/bin/list-NRMBMKMI.js +90 -0
- package/dist/bin/{list-FX2C3NCL.js → list-T74SN6IR.js} +3 -3
- package/dist/bin/{members-5FPRUAB6.js → members-W2GW3ODT.js} +4 -4
- package/dist/bin/{monthly-comparison-JEJ3TTY2.js → monthly-comparison-T34ZFOHL.js} +4 -4
- package/dist/bin/{order-cancel-XI2LKYXV.js → order-cancel-TI27JYYD.js} +3 -3
- package/dist/bin/{order-confirm-HUFCU6MO.js → order-confirm-VMRAMNTD.js} +3 -3
- package/dist/bin/{order-get-NSDMPUZR.js → order-get-C2RBUR4O.js} +4 -4
- package/dist/bin/{order-update-C7QYSD5R.js → order-update-RE3HATNF.js} +4 -4
- package/dist/bin/{output-QFLEKG5W.js → output-NUOL7KJW.js} +1 -1
- package/dist/bin/{payment-modes-WI3AWSES.js → payment-modes-WOOT22I7.js} +4 -4
- package/dist/bin/{profit-loss-5RIEOBKP.js → profit-loss-T4RESJ32.js} +4 -4
- package/dist/bin/{receivables-aging-L6DIQCNE.js → receivables-aging-6XMENEWS.js} +4 -4
- package/dist/bin/{remove-M2B4TZ37.js → remove-6QZI4JCY.js} +3 -3
- package/dist/bin/revoke-AVEMPAC7.js +40 -0
- package/dist/bin/{revoke-H3V2GNCD.js → revoke-YUCFZFNR.js} +3 -3
- package/dist/bin/revoke-all-LFW5WBHO.js +33 -0
- package/dist/bin/revoke-invitation-DTGQRJR4.js +40 -0
- package/dist/bin/{sales-trend-TICB3KGF.js → sales-trend-ZYBRUDUU.js} +4 -4
- package/dist/bin/{sequence-XUD6FAKY.js → sequence-FPOJTI2P.js} +3 -3
- package/dist/bin/{store-UQ2DDQ5I.js → store-IOB4Y67C.js} +4 -4
- package/dist/bin/{summary-BPNFC7I2.js → summary-5KYBA4ZO.js} +4 -4
- package/dist/bin/{top-customers-WGGJWKCN.js → top-customers-WSQ2UEJL.js} +4 -4
- package/dist/bin/{top-items-C7ZDDJMR.js → top-items-RWQPDGLN.js} +4 -4
- package/dist/bin/{top-outstanding-MOGWJIQS.js → top-outstanding-QAMO2E7Y.js} +4 -4
- package/dist/bin/{unpaid-invoices-ZUPNMQJP.js → unpaid-invoices-WB3TK5B4.js} +4 -4
- package/dist/bin/{untracked-BCJEVDW4.js → untracked-H733MYJL.js} +4 -4
- package/dist/bin/{update-IG565YIN.js → update-H6LPO2Z4.js} +3 -3
- package/dist/bin/{update-HIU4PANX.js → update-JU2X3XU5.js} +4 -4
- package/dist/bin/{update-PVLAX7T3.js → update-TLBUIC5J.js} +4 -4
- package/dist/bin/{update-role-Q4ZYJRYT.js → update-role-QST7BVFX.js} +3 -3
- package/dist/bin/{update-settings-XPC6L5WM.js → update-settings-Q2EGRLKZ.js} +3 -3
- package/package.json +1 -5
- package/src/auth.ts +12 -3
- package/src/bin/hisaabo.ts +6 -1
- package/src/bin/registrars/auth.ts +79 -10
- package/src/bin/registrars/bank.ts +34 -0
- package/src/bin/registrars/session.ts +32 -0
- package/src/bin/registrars/tenant.ts +18 -0
- package/src/client.ts +95 -12
- package/src/commands/bank/gateway-config.ts +61 -0
- package/src/commands/bank/update-gateway.ts +84 -0
- package/src/commands/payment/create.ts +1 -3
- package/src/commands/session/list.ts +91 -0
- package/src/commands/session/revoke-all.ts +20 -0
- package/src/commands/session/revoke.ts +32 -0
- package/src/commands/tenant/invitations.ts +62 -0
- package/src/commands/tenant/revoke-invitation.ts +32 -0
- package/src/config.ts +51 -2
- package/src/error-handler.ts +53 -0
- package/src/output.ts +1 -0
- package/src/spinner.ts +39 -0
- package/tsup.config.ts +6 -1
- package/dist/bin/chunk-2P35S2C3.js +0 -46
- package/src/components/ErrorDisplay.tsx +0 -16
- package/src/components/Header.tsx +0 -26
- package/src/components/MoneyCell.tsx +0 -16
- package/src/components/Spinner.tsx +0 -12
- package/src/components/StatusBadge.tsx +0 -39
- package/src/components/Table.tsx +0 -63
package/dist/bin/hisaabo.js
CHANGED
|
@@ -11,18 +11,18 @@ import {
|
|
|
11
11
|
monthStart,
|
|
12
12
|
quarterRange,
|
|
13
13
|
todayISO
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-T63VQXNM.js";
|
|
15
15
|
import {
|
|
16
16
|
HisaaboApiError,
|
|
17
17
|
HisaaboClient
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-4MEL44QX.js";
|
|
19
19
|
import {
|
|
20
20
|
clearConfig,
|
|
21
21
|
getConfig,
|
|
22
22
|
getConfigPath,
|
|
23
23
|
requireAuth,
|
|
24
24
|
setConfig
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-FIMJZAS4.js";
|
|
26
26
|
import {
|
|
27
27
|
EXIT,
|
|
28
28
|
fatalError,
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
success,
|
|
38
38
|
termWidth,
|
|
39
39
|
warn
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-NO4FIFMS.js";
|
|
41
41
|
|
|
42
42
|
// src/bin/hisaabo.ts
|
|
43
43
|
import { Command } from "commander";
|
|
@@ -46,8 +46,15 @@ import { Command } from "commander";
|
|
|
46
46
|
import * as readline from "readline";
|
|
47
47
|
|
|
48
48
|
// src/auth.ts
|
|
49
|
+
function validateApiUrl(url) {
|
|
50
|
+
const parsed = new URL(url);
|
|
51
|
+
if (!["http:", "https:"].includes(parsed.protocol)) {
|
|
52
|
+
fatalError("API URL must use http:// or https://", EXIT.USAGE);
|
|
53
|
+
}
|
|
54
|
+
return parsed.origin + parsed.pathname.replace(/\/$/, "");
|
|
55
|
+
}
|
|
49
56
|
async function loginWithToken(apiUrl, token) {
|
|
50
|
-
const base = apiUrl
|
|
57
|
+
const base = validateApiUrl(apiUrl);
|
|
51
58
|
const client = new HisaaboClient({
|
|
52
59
|
apiUrl: base,
|
|
53
60
|
token,
|
|
@@ -108,14 +115,15 @@ async function loginWithToken(apiUrl, token) {
|
|
|
108
115
|
setConfig({
|
|
109
116
|
businessId: selected.id,
|
|
110
117
|
businessName: selected.name,
|
|
111
|
-
tenantId: selected.id
|
|
118
|
+
tenantId: selected.id,
|
|
119
|
+
tokenCreatedAt: Date.now()
|
|
112
120
|
});
|
|
113
121
|
success(`Authenticated as ${user.name ?? user.email} (${user.email}) via API key`);
|
|
114
122
|
console.log(" Active business: " + selected.name);
|
|
115
123
|
console.log(" Config saved to " + getConfigPath() + "\n");
|
|
116
124
|
}
|
|
117
125
|
async function login(apiUrl, email, password) {
|
|
118
|
-
const base = apiUrl
|
|
126
|
+
const base = validateApiUrl(apiUrl);
|
|
119
127
|
const client = new HisaaboClient({
|
|
120
128
|
apiUrl: base,
|
|
121
129
|
token: "",
|
|
@@ -164,8 +172,9 @@ async function login(apiUrl, email, password) {
|
|
|
164
172
|
setConfig({
|
|
165
173
|
businessId: selected.id,
|
|
166
174
|
businessName: selected.name,
|
|
167
|
-
tenantId: selected.id
|
|
175
|
+
tenantId: selected.id,
|
|
168
176
|
// fallback; real tenantId may differ
|
|
177
|
+
tokenCreatedAt: Date.now()
|
|
169
178
|
});
|
|
170
179
|
success(`Active business: ${selected.name}`);
|
|
171
180
|
console.log(" Config saved to " + getConfigPath());
|
|
@@ -218,15 +227,70 @@ async function whoami(jsonMode) {
|
|
|
218
227
|
}
|
|
219
228
|
|
|
220
229
|
// src/bin/registrars/auth.ts
|
|
230
|
+
function ask(rl, q) {
|
|
231
|
+
return new Promise((res) => rl.question(q, res));
|
|
232
|
+
}
|
|
233
|
+
function askSecret(prompt6) {
|
|
234
|
+
return new Promise((resolve2) => {
|
|
235
|
+
const rl = readline.createInterface({ input: process.stdin, terminal: true });
|
|
236
|
+
process.stdout.write(prompt6);
|
|
237
|
+
const chars = [];
|
|
238
|
+
const cleanup = () => {
|
|
239
|
+
process.stdin.removeListener("data", onData);
|
|
240
|
+
process.stdin.setRawMode?.(false);
|
|
241
|
+
process.stdin.pause();
|
|
242
|
+
};
|
|
243
|
+
const onSignal = () => {
|
|
244
|
+
cleanup();
|
|
245
|
+
process.exit(130);
|
|
246
|
+
};
|
|
247
|
+
process.once("SIGTERM", onSignal);
|
|
248
|
+
process.once("SIGHUP", onSignal);
|
|
249
|
+
const onData = (key) => {
|
|
250
|
+
const ch = key.toString();
|
|
251
|
+
if (ch === "\n" || ch === "\r") {
|
|
252
|
+
process.removeListener("SIGTERM", onSignal);
|
|
253
|
+
process.removeListener("SIGHUP", onSignal);
|
|
254
|
+
cleanup();
|
|
255
|
+
process.stdout.write("\n");
|
|
256
|
+
rl.close();
|
|
257
|
+
const result = chars.join("");
|
|
258
|
+
chars.length = 0;
|
|
259
|
+
resolve2(result);
|
|
260
|
+
} else if (ch === "\x7F" || ch === "\b") {
|
|
261
|
+
if (chars.length > 0) {
|
|
262
|
+
chars.pop();
|
|
263
|
+
process.stdout.write("\b \b");
|
|
264
|
+
}
|
|
265
|
+
} else if (ch === "") {
|
|
266
|
+
cleanup();
|
|
267
|
+
process.stdout.write("\n");
|
|
268
|
+
process.exit(130);
|
|
269
|
+
} else if (ch.charCodeAt(0) >= 32) {
|
|
270
|
+
chars.push(ch);
|
|
271
|
+
process.stdout.write("*");
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
if (process.stdin.isTTY) {
|
|
275
|
+
process.stdin.setRawMode?.(true);
|
|
276
|
+
process.stdin.resume();
|
|
277
|
+
process.stdin.on("data", onData);
|
|
278
|
+
} else {
|
|
279
|
+
rl.question("", (answer) => {
|
|
280
|
+
rl.close();
|
|
281
|
+
resolve2(answer.trim());
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
}
|
|
221
286
|
function registerAuthCommands(program2) {
|
|
222
|
-
program2.command("login").description("Authenticate and configure your Hisaabo server").option("--api-url <url>", "Server URL").option("--email <email>", "Email address").option("--password <password>", "Password").option("--token <token>", "API key (
|
|
287
|
+
program2.command("login").description("Authenticate and configure your Hisaabo server").option("--api-url <url>", "Server URL").option("--email <email>", "Email address").option("--password <password>", "Password (visible in shell history \u2014 prefer interactive prompt)").option("--token <token>", "API key (visible in shell history \u2014 prefer HISAABO_TOKEN env var)").action(async (opts) => {
|
|
223
288
|
let apiUrl = opts.apiUrl;
|
|
224
289
|
if (opts.token) {
|
|
225
290
|
if (!apiUrl) {
|
|
226
291
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
227
|
-
const ask = (q) => new Promise((res) => rl.question(q, res));
|
|
228
292
|
console.log("\n Hisaabo CLI\n " + "\u2500".repeat(11) + "\n");
|
|
229
|
-
const u = await ask(" Server URL [http://localhost:3000]: ");
|
|
293
|
+
const u = await ask(rl, " Server URL [http://localhost:3000]: ");
|
|
230
294
|
rl.close();
|
|
231
295
|
apiUrl = u.trim() || "http://localhost:3000";
|
|
232
296
|
}
|
|
@@ -237,17 +301,16 @@ function registerAuthCommands(program2) {
|
|
|
237
301
|
let password = opts.password;
|
|
238
302
|
if (!apiUrl || !email || !password) {
|
|
239
303
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
240
|
-
const ask = (q) => new Promise((res) => rl.question(q, res));
|
|
241
304
|
console.log("\n Hisaabo CLI\n " + "\u2500".repeat(11) + "\n");
|
|
242
305
|
if (!apiUrl) {
|
|
243
|
-
const u = await ask(" Server URL [http://localhost:3000]: ");
|
|
306
|
+
const u = await ask(rl, " Server URL [http://localhost:3000]: ");
|
|
244
307
|
apiUrl = u.trim() || "http://localhost:3000";
|
|
245
308
|
}
|
|
246
|
-
if (!email) email = (await ask(" Email: ")).trim();
|
|
309
|
+
if (!email) email = (await ask(rl, " Email: ")).trim();
|
|
310
|
+
rl.close();
|
|
247
311
|
if (!password) {
|
|
248
|
-
password =
|
|
312
|
+
password = await askSecret(" Password: ");
|
|
249
313
|
}
|
|
250
|
-
rl.close();
|
|
251
314
|
console.log("\n Tip: Generate an API key at Settings \u2192 API Keys for passwordless CLI access.\n");
|
|
252
315
|
}
|
|
253
316
|
await login(apiUrl, email, password);
|
|
@@ -327,19 +390,19 @@ function registerAuthCommands(program2) {
|
|
|
327
390
|
function registerDashboardCommands(program2) {
|
|
328
391
|
const dash = program2.command("dashboard").alias("dash").description("Business dashboard & analytics");
|
|
329
392
|
dash.command("summary").description("Financial summary overview (FY to date)").option("--json", "JSON output").action(async (opts) => {
|
|
330
|
-
const { dashboardCommand } = await import("./summary-
|
|
393
|
+
const { dashboardCommand } = await import("./summary-5KYBA4ZO.js");
|
|
331
394
|
await dashboardCommand({ json: opts.json });
|
|
332
395
|
});
|
|
333
396
|
dash.command("sales-trend").description("Sales trend over time").option("--months <n>", "Number of months to show", (v) => parseInt(v, 10)).option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--granularity <g>", "daily | weekly | monthly").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
|
|
334
|
-
const { dashboardSalesTrendCommand } = await import("./sales-trend-
|
|
397
|
+
const { dashboardSalesTrendCommand } = await import("./sales-trend-ZYBRUDUU.js");
|
|
335
398
|
await dashboardSalesTrendCommand(opts);
|
|
336
399
|
});
|
|
337
400
|
dash.command("top-outstanding").description("Parties with highest outstanding balances").option("--limit <n>", "Max rows to show", (v) => parseInt(v, 10)).option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
|
|
338
|
-
const { dashboardTopOutstandingCommand } = await import("./top-outstanding-
|
|
401
|
+
const { dashboardTopOutstandingCommand } = await import("./top-outstanding-QAMO2E7Y.js");
|
|
339
402
|
await dashboardTopOutstandingCommand(opts);
|
|
340
403
|
});
|
|
341
404
|
dash.command("top-customers").description("Top customers by revenue").option("--limit <n>", "Max rows to show", (v) => parseInt(v, 10)).option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--this-month", "Filter to current calendar month").option("--this-fy", "Filter to current financial year").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
|
|
342
|
-
const { dashboardTopCustomersCommand } = await import("./top-customers-
|
|
405
|
+
const { dashboardTopCustomersCommand } = await import("./top-customers-WSQ2UEJL.js");
|
|
343
406
|
await dashboardTopCustomersCommand({
|
|
344
407
|
limit: opts.limit,
|
|
345
408
|
from: opts.from,
|
|
@@ -351,7 +414,7 @@ function registerDashboardCommands(program2) {
|
|
|
351
414
|
});
|
|
352
415
|
});
|
|
353
416
|
dash.command("top-items").description("Top selling items by revenue and quantity").option("--limit <n>", "Max rows to show", (v) => parseInt(v, 10)).option("--type <type>", "Item type filter (product | service)").option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--this-month", "Filter to current calendar month").option("--this-fy", "Filter to current financial year").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
|
|
354
|
-
const { dashboardTopItemsCommand } = await import("./top-items-
|
|
417
|
+
const { dashboardTopItemsCommand } = await import("./top-items-RWQPDGLN.js");
|
|
355
418
|
await dashboardTopItemsCommand({
|
|
356
419
|
limit: opts.limit,
|
|
357
420
|
type: opts.type,
|
|
@@ -364,7 +427,7 @@ function registerDashboardCommands(program2) {
|
|
|
364
427
|
});
|
|
365
428
|
});
|
|
366
429
|
const expensesCmd = dash.command("expenses").description("Expenses broken down by category").option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--this-month", "Filter to current calendar month").option("--this-fy", "Filter to current financial year").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
|
|
367
|
-
const { dashboardExpensesCommand } = await import("./expenses-
|
|
430
|
+
const { dashboardExpensesCommand } = await import("./expenses-5N2QSG54.js");
|
|
368
431
|
await dashboardExpensesCommand({
|
|
369
432
|
from: opts.from,
|
|
370
433
|
to: opts.to,
|
|
@@ -376,7 +439,7 @@ function registerDashboardCommands(program2) {
|
|
|
376
439
|
});
|
|
377
440
|
expensesCmd.alias("expenses-by-category");
|
|
378
441
|
dash.command("invoice-breakdown").description("Invoice count and amounts by status").option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--this-month", "Filter to current calendar month").option("--this-fy", "Filter to current financial year").option("--json", "JSON output").action(async (opts) => {
|
|
379
|
-
const { dashboardInvoiceBreakdownCommand } = await import("./invoice-breakdown-
|
|
442
|
+
const { dashboardInvoiceBreakdownCommand } = await import("./invoice-breakdown-FN5BEFJD.js");
|
|
380
443
|
await dashboardInvoiceBreakdownCommand({
|
|
381
444
|
from: opts.from,
|
|
382
445
|
to: opts.to,
|
|
@@ -386,7 +449,7 @@ function registerDashboardCommands(program2) {
|
|
|
386
449
|
});
|
|
387
450
|
});
|
|
388
451
|
const plCmd = dash.command("profit-loss").description("Profit & Loss statement").option("--from <date>", "Start date (YYYY-MM-DD, default: FY start)").option("--to <date>", "End date (YYYY-MM-DD, default: today)").option("--this-month", "Scope to current calendar month").option("--this-fy", "Scope to current financial year").option("--json", "JSON output").action(async (opts) => {
|
|
389
|
-
const { dashboardProfitLossCommand } = await import("./profit-loss-
|
|
452
|
+
const { dashboardProfitLossCommand } = await import("./profit-loss-T4RESJ32.js");
|
|
390
453
|
await dashboardProfitLossCommand({
|
|
391
454
|
from: opts.from,
|
|
392
455
|
to: opts.to,
|
|
@@ -397,11 +460,11 @@ function registerDashboardCommands(program2) {
|
|
|
397
460
|
});
|
|
398
461
|
plCmd.alias("pl");
|
|
399
462
|
dash.command("receivables-aging").description("Receivables aging buckets (current / 1-30 / 31-60 / 61-90 / 90+)").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
|
|
400
|
-
const { dashboardReceivablesAgingCommand } = await import("./receivables-aging-
|
|
463
|
+
const { dashboardReceivablesAgingCommand } = await import("./receivables-aging-6XMENEWS.js");
|
|
401
464
|
await dashboardReceivablesAgingCommand({ json: opts.json, format: opts.format });
|
|
402
465
|
});
|
|
403
466
|
dash.command("payment-modes").description("Payment mode breakdown (cash / UPI / bank transfer / etc.)").option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--this-month", "Filter to current calendar month").option("--this-fy", "Filter to current financial year").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
|
|
404
|
-
const { dashboardPaymentModesCommand } = await import("./payment-modes-
|
|
467
|
+
const { dashboardPaymentModesCommand } = await import("./payment-modes-WOOT22I7.js");
|
|
405
468
|
await dashboardPaymentModesCommand({
|
|
406
469
|
from: opts.from,
|
|
407
470
|
to: opts.to,
|
|
@@ -412,7 +475,7 @@ function registerDashboardCommands(program2) {
|
|
|
412
475
|
});
|
|
413
476
|
});
|
|
414
477
|
dash.command("collection-efficiency").description("Collection rate, DSO, and aging breakdown").option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--this-month", "Filter to current calendar month").option("--this-fy", "Filter to current financial year").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
|
|
415
|
-
const { dashboardCollectionEfficiencyCommand } = await import("./collection-efficiency-
|
|
478
|
+
const { dashboardCollectionEfficiencyCommand } = await import("./collection-efficiency-U56XNVEE.js");
|
|
416
479
|
await dashboardCollectionEfficiencyCommand({
|
|
417
480
|
from: opts.from,
|
|
418
481
|
to: opts.to,
|
|
@@ -423,7 +486,7 @@ function registerDashboardCommands(program2) {
|
|
|
423
486
|
});
|
|
424
487
|
});
|
|
425
488
|
dash.command("monthly-comparison").description("Month-over-month comparison of sales, expenses, profit, and collections").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
|
|
426
|
-
const { dashboardMonthlyComparisonCommand } = await import("./monthly-comparison-
|
|
489
|
+
const { dashboardMonthlyComparisonCommand } = await import("./monthly-comparison-T34ZFOHL.js");
|
|
427
490
|
await dashboardMonthlyComparisonCommand({ json: opts.json, format: opts.format });
|
|
428
491
|
});
|
|
429
492
|
}
|
|
@@ -1628,9 +1691,7 @@ async function paymentCreateCommand(opts) {
|
|
|
1628
1691
|
console.log(`
|
|
1629
1692
|
Party: ${selected.name}
|
|
1630
1693
|
`);
|
|
1631
|
-
const
|
|
1632
|
-
const partial = await client.invoice.list({ partyId, status: "partial", limit: 10 });
|
|
1633
|
-
const unpaid = [...invoices.data, ...partial.data];
|
|
1694
|
+
const { data: unpaid } = await client.invoice.list({ partyId, status: ["sent", "partial", "overdue"], limit: 20 });
|
|
1634
1695
|
if (unpaid.length > 0) {
|
|
1635
1696
|
console.log(" Unpaid Invoices:");
|
|
1636
1697
|
console.log(" " + "\u2500".repeat(65));
|
|
@@ -1752,11 +1813,11 @@ function registerPaymentCommands(program2) {
|
|
|
1752
1813
|
await paymentDeleteCommand(id, { yes: opts.yes, json: opts.json });
|
|
1753
1814
|
});
|
|
1754
1815
|
payment.command("get <id>").description("Get payment details").option("--json", "JSON output").action(async (id, opts) => {
|
|
1755
|
-
const { paymentGetCommand } = await import("./get-
|
|
1816
|
+
const { paymentGetCommand } = await import("./get-GWH6S5SJ.js");
|
|
1756
1817
|
await paymentGetCommand(id, { json: opts.json });
|
|
1757
1818
|
});
|
|
1758
1819
|
payment.command("update <id>").description("Update a payment").option("--amount <amount>", "New amount").option("--mode <mode>", "Payment mode: cash, upi, bank, cheque, other").option("--date <YYYY-MM-DD>", "Payment date").option("--reference <ref>", "Reference number (empty string to clear)").option("--notes <text>", "Notes (empty string to clear)").option("--json", "JSON output").action(async (id, opts) => {
|
|
1759
|
-
const { paymentUpdateCommand } = await import("./update-
|
|
1820
|
+
const { paymentUpdateCommand } = await import("./update-JU2X3XU5.js");
|
|
1760
1821
|
await paymentUpdateCommand(id, {
|
|
1761
1822
|
json: opts.json,
|
|
1762
1823
|
amount: opts.amount,
|
|
@@ -1767,11 +1828,11 @@ function registerPaymentCommands(program2) {
|
|
|
1767
1828
|
});
|
|
1768
1829
|
});
|
|
1769
1830
|
payment.command("unpaid-invoices <partyId>").description("List unpaid invoices for a party").option("--json", "JSON output").option("--format <format>", "Output format: table, tsv, csv").action(async (partyId, opts) => {
|
|
1770
|
-
const { paymentUnpaidInvoicesCommand } = await import("./unpaid-invoices-
|
|
1831
|
+
const { paymentUnpaidInvoicesCommand } = await import("./unpaid-invoices-WB3TK5B4.js");
|
|
1771
1832
|
await paymentUnpaidInvoicesCommand(partyId, { json: opts.json, format: opts.format });
|
|
1772
1833
|
});
|
|
1773
1834
|
payment.command("untracked").description("List payments not linked to a bank account").option("--page <n>", "Page number", parseInt).option("--limit <n>", "Items per page", parseInt).option("--json", "JSON output").option("--format <format>", "Output format: table, tsv, csv").action(async (opts) => {
|
|
1774
|
-
const { paymentUntrackedCommand } = await import("./untracked-
|
|
1835
|
+
const { paymentUntrackedCommand } = await import("./untracked-H733MYJL.js");
|
|
1775
1836
|
await paymentUntrackedCommand({
|
|
1776
1837
|
json: opts.json,
|
|
1777
1838
|
format: opts.format,
|
|
@@ -1780,7 +1841,7 @@ function registerPaymentCommands(program2) {
|
|
|
1780
1841
|
});
|
|
1781
1842
|
});
|
|
1782
1843
|
payment.command("default-account").description("Show recommended bank account for payments").option("--party-id <id>", "Party UUID to scope recommendation").option("--json", "JSON output").action(async (opts) => {
|
|
1783
|
-
const { paymentDefaultAccountCommand } = await import("./default-account-
|
|
1844
|
+
const { paymentDefaultAccountCommand } = await import("./default-account-AE6EXZZR.js");
|
|
1784
1845
|
await paymentDefaultAccountCommand({ json: opts.json, partyId: opts.partyId });
|
|
1785
1846
|
});
|
|
1786
1847
|
}
|
|
@@ -1919,7 +1980,7 @@ function registerExpenseCommands(program2) {
|
|
|
1919
1980
|
await expenseDeleteCommand(id, { yes: opts.yes, json: opts.json });
|
|
1920
1981
|
});
|
|
1921
1982
|
expense.command("update <id>").description("Update an expense").option("--amount <amount>", "New amount").option("--category <cat>", "Expense category").option("--date <YYYY-MM-DD>", "Expense date").option("--description <text>", "Description").option("--payment-mode <mode>", "Payment mode: cash, upi, bank, cheque, other").option("--reference <ref>", "Reference number").option("--json", "JSON output").action(async (id, opts) => {
|
|
1922
|
-
const { expenseUpdateCommand } = await import("./update-
|
|
1983
|
+
const { expenseUpdateCommand } = await import("./update-TLBUIC5J.js");
|
|
1923
1984
|
await expenseUpdateCommand(id, {
|
|
1924
1985
|
json: opts.json,
|
|
1925
1986
|
amount: opts.amount,
|
|
@@ -1931,7 +1992,7 @@ function registerExpenseCommands(program2) {
|
|
|
1931
1992
|
});
|
|
1932
1993
|
});
|
|
1933
1994
|
expense.command("categories").description("List all expense categories").option("--json", "JSON output").action(async (opts) => {
|
|
1934
|
-
const { expenseCategoriesCommand } = await import("./categories-
|
|
1995
|
+
const { expenseCategoriesCommand } = await import("./categories-64WWZTND.js");
|
|
1935
1996
|
await expenseCategoriesCommand({ json: opts.json });
|
|
1936
1997
|
});
|
|
1937
1998
|
}
|
|
@@ -2718,6 +2779,114 @@ async function bankTransactionsCommand(accountId, opts) {
|
|
|
2718
2779
|
}
|
|
2719
2780
|
}
|
|
2720
2781
|
|
|
2782
|
+
// src/commands/bank/gateway-config.ts
|
|
2783
|
+
function formatChargeRate(rate) {
|
|
2784
|
+
if (!rate) return "-";
|
|
2785
|
+
return rate.type === "percentage" ? `${rate.value}%` : `Flat ${rate.value}`;
|
|
2786
|
+
}
|
|
2787
|
+
async function bankGatewayConfigCommand(accountId, opts) {
|
|
2788
|
+
const cfg = requireAuth();
|
|
2789
|
+
const client = new HisaaboClient(cfg);
|
|
2790
|
+
try {
|
|
2791
|
+
const config = await client.bankAccount.getGatewayConfig(accountId);
|
|
2792
|
+
if (!config) {
|
|
2793
|
+
fatalError(`No gateway configuration found for account: ${accountId}`, EXIT.NOT_FOUND);
|
|
2794
|
+
}
|
|
2795
|
+
if (opts.json) {
|
|
2796
|
+
outputJSON(config);
|
|
2797
|
+
return;
|
|
2798
|
+
}
|
|
2799
|
+
console.log(`
|
|
2800
|
+
Gateway Configuration`);
|
|
2801
|
+
console.log(" " + "\u2500".repeat(45));
|
|
2802
|
+
console.log(` Account: ${accountId}`);
|
|
2803
|
+
console.log(` Settlement Account: ${config.settlementAccountId}`);
|
|
2804
|
+
console.log(` Expense Category: ${config.expenseCategory}`);
|
|
2805
|
+
console.log(` Auto Settle: ${config.autoSettle ? "Yes" : "No"}`);
|
|
2806
|
+
console.log(` Active: ${config.isActive ? "Yes" : "No"}`);
|
|
2807
|
+
console.log();
|
|
2808
|
+
const modes = ["credit_card", "debit_card", "upi", "net_banking", "wallet", "default"];
|
|
2809
|
+
const rows = modes.map((mode) => ({
|
|
2810
|
+
mode,
|
|
2811
|
+
rate: formatChargeRate(config.chargeConfig[mode])
|
|
2812
|
+
}));
|
|
2813
|
+
const cols = [
|
|
2814
|
+
{ key: "mode", header: "Payment Mode", width: 18 },
|
|
2815
|
+
{ key: "rate", header: "Charge Rate", width: 16 }
|
|
2816
|
+
];
|
|
2817
|
+
console.log(" Charge Rates:\n");
|
|
2818
|
+
outputTable(rows, cols);
|
|
2819
|
+
console.log();
|
|
2820
|
+
} catch (e) {
|
|
2821
|
+
if (e instanceof HisaaboApiError) {
|
|
2822
|
+
const err = e.hisaaboError;
|
|
2823
|
+
if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
|
|
2824
|
+
if (err.code === "not_found") fatalError(`Bank account not found: ${accountId}`, EXIT.NOT_FOUND);
|
|
2825
|
+
if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
|
|
2826
|
+
}
|
|
2827
|
+
fatalError(String(e instanceof Error ? e.message : e));
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
|
|
2831
|
+
// src/commands/bank/update-gateway.ts
|
|
2832
|
+
function parseChargeRate(value) {
|
|
2833
|
+
if (value.toLowerCase().startsWith("flat:")) {
|
|
2834
|
+
return { type: "flat", value: value.slice(5) };
|
|
2835
|
+
}
|
|
2836
|
+
return { type: "percentage", value };
|
|
2837
|
+
}
|
|
2838
|
+
async function bankUpdateGatewayCommand(accountId, opts) {
|
|
2839
|
+
const cfg = requireAuth();
|
|
2840
|
+
const client = new HisaaboClient(cfg);
|
|
2841
|
+
try {
|
|
2842
|
+
const existing = await client.bankAccount.getGatewayConfig(accountId);
|
|
2843
|
+
const chargeConfig = existing?.chargeConfig ?? {};
|
|
2844
|
+
if (opts.chargeCreditCard !== void 0) {
|
|
2845
|
+
chargeConfig.credit_card = parseChargeRate(opts.chargeCreditCard);
|
|
2846
|
+
}
|
|
2847
|
+
if (opts.chargeDebitCard !== void 0) {
|
|
2848
|
+
chargeConfig.debit_card = parseChargeRate(opts.chargeDebitCard);
|
|
2849
|
+
}
|
|
2850
|
+
if (opts.chargeUpi !== void 0) {
|
|
2851
|
+
chargeConfig.upi = parseChargeRate(opts.chargeUpi);
|
|
2852
|
+
}
|
|
2853
|
+
if (opts.chargeNetBanking !== void 0) {
|
|
2854
|
+
chargeConfig.net_banking = parseChargeRate(opts.chargeNetBanking);
|
|
2855
|
+
}
|
|
2856
|
+
if (opts.chargeWallet !== void 0) {
|
|
2857
|
+
chargeConfig.wallet = parseChargeRate(opts.chargeWallet);
|
|
2858
|
+
}
|
|
2859
|
+
if (opts.chargeDefault !== void 0) {
|
|
2860
|
+
chargeConfig.default = parseChargeRate(opts.chargeDefault);
|
|
2861
|
+
}
|
|
2862
|
+
const settlementAccountId = opts.settlementAccount ?? existing?.settlementAccountId;
|
|
2863
|
+
if (!settlementAccountId) {
|
|
2864
|
+
fatalError("--settlement-account is required when creating a new gateway config", EXIT.USAGE);
|
|
2865
|
+
}
|
|
2866
|
+
const result = await client.bankAccount.upsertGatewayConfig({
|
|
2867
|
+
bankAccountId: accountId,
|
|
2868
|
+
settlementAccountId,
|
|
2869
|
+
chargeConfig
|
|
2870
|
+
});
|
|
2871
|
+
if (opts.json) {
|
|
2872
|
+
outputJSON(result);
|
|
2873
|
+
return;
|
|
2874
|
+
}
|
|
2875
|
+
success(`Gateway configuration updated for account: ${accountId}`);
|
|
2876
|
+
console.log(` Settlement Account: ${result.settlementAccountId}
|
|
2877
|
+
`);
|
|
2878
|
+
} catch (e) {
|
|
2879
|
+
if (e instanceof HisaaboApiError) {
|
|
2880
|
+
const err = e.hisaaboError;
|
|
2881
|
+
if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
|
|
2882
|
+
if (err.code === "validation_failed") fatalError(e.message, EXIT.VALIDATION);
|
|
2883
|
+
if (err.code === "not_found") fatalError(`Bank account not found: ${accountId}`, EXIT.NOT_FOUND);
|
|
2884
|
+
if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
|
|
2885
|
+
}
|
|
2886
|
+
fatalError(String(e instanceof Error ? e.message : e));
|
|
2887
|
+
}
|
|
2888
|
+
}
|
|
2889
|
+
|
|
2721
2890
|
// src/bin/registrars/bank.ts
|
|
2722
2891
|
function registerBankCommands(program2) {
|
|
2723
2892
|
const bank = program2.command("bank").description("Bank account management");
|
|
@@ -2759,6 +2928,21 @@ function registerBankCommands(program2) {
|
|
|
2759
2928
|
limit: opts.limit
|
|
2760
2929
|
});
|
|
2761
2930
|
});
|
|
2931
|
+
bank.command("gateway-config <accountId>").description("Display gateway configuration (charge rates, settlement account)").option("--json", "JSON output").action(async (accountId, opts) => {
|
|
2932
|
+
await bankGatewayConfigCommand(accountId, { json: opts.json });
|
|
2933
|
+
});
|
|
2934
|
+
bank.command("update-gateway <accountId>").description("Update gateway charge configuration").option("--json", "JSON output").option("--charge-credit-card <rate>", "Credit card charge rate (e.g. 2 for 2%, flat:20 for flat)").option("--charge-debit-card <rate>", "Debit card charge rate").option("--charge-upi <rate>", "UPI charge rate").option("--charge-net-banking <rate>", "Net banking charge rate").option("--charge-wallet <rate>", "Wallet charge rate").option("--charge-default <rate>", "Default charge rate for unlisted modes").option("--settlement-account <id>", "Settlement bank account ID").action(async (accountId, opts) => {
|
|
2935
|
+
await bankUpdateGatewayCommand(accountId, {
|
|
2936
|
+
json: opts.json,
|
|
2937
|
+
chargeCreditCard: opts.chargeCreditCard,
|
|
2938
|
+
chargeDebitCard: opts.chargeDebitCard,
|
|
2939
|
+
chargeUpi: opts.chargeUpi,
|
|
2940
|
+
chargeNetBanking: opts.chargeNetBanking,
|
|
2941
|
+
chargeWallet: opts.chargeWallet,
|
|
2942
|
+
chargeDefault: opts.chargeDefault,
|
|
2943
|
+
settlementAccount: opts.settlementAccount
|
|
2944
|
+
});
|
|
2945
|
+
});
|
|
2762
2946
|
}
|
|
2763
2947
|
|
|
2764
2948
|
// src/commands/shipment/index.ts
|
|
@@ -3037,11 +3221,11 @@ function registerTargetCommands(program2) {
|
|
|
3037
3221
|
function registerStoreCommands(program2) {
|
|
3038
3222
|
const store = program2.command("store").description("Online store management");
|
|
3039
3223
|
store.command("settings").description("Show store settings").option("--json", "JSON output").action(async (opts) => {
|
|
3040
|
-
const { storeSettingsCommand } = await import("./store-
|
|
3224
|
+
const { storeSettingsCommand } = await import("./store-IOB4Y67C.js");
|
|
3041
3225
|
await storeSettingsCommand({ json: opts.json });
|
|
3042
3226
|
});
|
|
3043
3227
|
store.command("update-settings").description("Update store settings").option("--slug <slug>", "Store URL slug").option("--tagline <text>", "Store tagline / description").option("--enabled <bool>", "Enable or disable store (true/false)").option("--json", "JSON output").action(async (opts) => {
|
|
3044
|
-
const { storeUpdateSettingsCommand } = await import("./update-settings-
|
|
3228
|
+
const { storeUpdateSettingsCommand } = await import("./update-settings-Q2EGRLKZ.js");
|
|
3045
3229
|
await storeUpdateSettingsCommand({
|
|
3046
3230
|
slug: opts.slug,
|
|
3047
3231
|
tagline: opts.tagline,
|
|
@@ -3050,11 +3234,11 @@ function registerStoreCommands(program2) {
|
|
|
3050
3234
|
});
|
|
3051
3235
|
});
|
|
3052
3236
|
store.command("items").description("List items available in the store").option("--json", "JSON output").option("--format <format>", "Output format: table, tsv, csv").action(async (opts) => {
|
|
3053
|
-
const { storeItemsCommand } = await import("./items-
|
|
3237
|
+
const { storeItemsCommand } = await import("./items-2OOCQKVF.js");
|
|
3054
3238
|
await storeItemsCommand({ json: opts.json, format: opts.format });
|
|
3055
3239
|
});
|
|
3056
3240
|
store.command("items-toggle").description("Bulk enable / disable store items").option("--enable <ids>", "Comma-separated item IDs to enable").option("--disable <ids>", "Comma-separated item IDs to disable").option("--json", "JSON output").action(async (opts) => {
|
|
3057
|
-
const { storeItemsToggleCommand } = await import("./items-toggle-
|
|
3241
|
+
const { storeItemsToggleCommand } = await import("./items-toggle-SKZWCGJH.js");
|
|
3058
3242
|
await storeItemsToggleCommand({
|
|
3059
3243
|
enable: opts.enable,
|
|
3060
3244
|
disable: opts.disable,
|
|
@@ -3062,7 +3246,7 @@ function registerStoreCommands(program2) {
|
|
|
3062
3246
|
});
|
|
3063
3247
|
});
|
|
3064
3248
|
store.command("orders").description("List store orders").option("--json", "JSON output").option("--status <status>", "Filter by order status").option("--page <n>", "Page number", parseInt).option("--limit <n>", "Items per page", parseInt).action(async (opts) => {
|
|
3065
|
-
const { storeOrdersCommand } = await import("./store-
|
|
3249
|
+
const { storeOrdersCommand } = await import("./store-IOB4Y67C.js");
|
|
3066
3250
|
await storeOrdersCommand({
|
|
3067
3251
|
json: opts.json,
|
|
3068
3252
|
status: opts.status,
|
|
@@ -3071,15 +3255,15 @@ function registerStoreCommands(program2) {
|
|
|
3071
3255
|
});
|
|
3072
3256
|
});
|
|
3073
3257
|
store.command("order-get <id>").description("Get order details").option("--json", "JSON output").action(async (id, opts) => {
|
|
3074
|
-
const { storeOrderGetCommand } = await import("./order-get-
|
|
3258
|
+
const { storeOrderGetCommand } = await import("./order-get-C2RBUR4O.js");
|
|
3075
3259
|
await storeOrderGetCommand(id, { json: opts.json });
|
|
3076
3260
|
});
|
|
3077
3261
|
store.command("order-confirm <id>").description("Confirm a pending order").option("-y, --yes", "Skip confirmation prompt").option("--json", "JSON output").action(async (id, opts) => {
|
|
3078
|
-
const { storeOrderConfirmCommand } = await import("./order-confirm-
|
|
3262
|
+
const { storeOrderConfirmCommand } = await import("./order-confirm-VMRAMNTD.js");
|
|
3079
3263
|
await storeOrderConfirmCommand(id, { json: opts.json, yes: opts.yes });
|
|
3080
3264
|
});
|
|
3081
3265
|
store.command("order-cancel <id>").description("Cancel an order").option("-y, --yes", "Skip confirmation prompt").option("--reason <text>", "Cancellation reason").option("--json", "JSON output").action(async (id, opts) => {
|
|
3082
|
-
const { storeOrderCancelCommand } = await import("./order-cancel-
|
|
3266
|
+
const { storeOrderCancelCommand } = await import("./order-cancel-TI27JYYD.js");
|
|
3083
3267
|
await storeOrderCancelCommand(id, {
|
|
3084
3268
|
json: opts.json,
|
|
3085
3269
|
yes: opts.yes,
|
|
@@ -3087,11 +3271,11 @@ function registerStoreCommands(program2) {
|
|
|
3087
3271
|
});
|
|
3088
3272
|
});
|
|
3089
3273
|
store.command("order-update <id>").description("Update order status").option("--status <status>", "New status: preparing, ready, delivered").option("--json", "JSON output").action(async (id, opts) => {
|
|
3090
|
-
const { storeOrderUpdateCommand } = await import("./order-update-
|
|
3274
|
+
const { storeOrderUpdateCommand } = await import("./order-update-RE3HATNF.js");
|
|
3091
3275
|
await storeOrderUpdateCommand(id, { json: opts.json, status: opts.status });
|
|
3092
3276
|
});
|
|
3093
3277
|
store.command("check-slug <slug>").description("Check store slug availability").option("--json", "JSON output").action(async (slug, opts) => {
|
|
3094
|
-
const { storeCheckSlugCommand } = await import("./check-slug-
|
|
3278
|
+
const { storeCheckSlugCommand } = await import("./check-slug-FLHHUDYS.js");
|
|
3095
3279
|
await storeCheckSlugCommand(slug, { json: opts.json });
|
|
3096
3280
|
});
|
|
3097
3281
|
}
|
|
@@ -3858,23 +4042,23 @@ function registerBusinessCommands(program2) {
|
|
|
3858
4042
|
}
|
|
3859
4043
|
});
|
|
3860
4044
|
business.command("get").description("Show current business details").option("--json", "JSON output").action(async (opts) => {
|
|
3861
|
-
const { businessGetCommand } = await import("./get-
|
|
4045
|
+
const { businessGetCommand } = await import("./get-A43QCI2S.js");
|
|
3862
4046
|
await businessGetCommand(opts);
|
|
3863
4047
|
});
|
|
3864
4048
|
business.command("update").description("Update business settings").option("--name <name>", "Business name").option("--gstin <gstin>", "GSTIN").option("--address <address>", "Address").option("--state <state>", "State").option("--phone <phone>", "Phone number").option("--email <email>", "Email address").option("--financial-year-start <month>", "Financial year start month (1\u201312)").option("--json", "JSON output").action(async (opts) => {
|
|
3865
|
-
const { businessUpdateCommand } = await import("./update-
|
|
4049
|
+
const { businessUpdateCommand } = await import("./update-H6LPO2Z4.js");
|
|
3866
4050
|
await businessUpdateCommand(opts);
|
|
3867
4051
|
});
|
|
3868
4052
|
business.command("sequence").description("Update invoice sequence number / prefix").requiredOption("--type <type>", "Document type: sale or purchase").option("--prefix <prefix>", "Invoice prefix (e.g. INV-)").option("--next-number <n>", "Next sequence number").option("--json", "JSON output").action(async (opts) => {
|
|
3869
|
-
const { businessSequenceCommand } = await import("./sequence-
|
|
4053
|
+
const { businessSequenceCommand } = await import("./sequence-FPOJTI2P.js");
|
|
3870
4054
|
await businessSequenceCommand(opts);
|
|
3871
4055
|
});
|
|
3872
4056
|
business.command("audit-trail").description("View audit log for this business").option("--page <n>", "Page number", "1").option("--limit <n>", "Results per page", "25").option("--json", "JSON output").option("--format <fmt>", "Output format: table, tsv, csv").action(async (opts) => {
|
|
3873
|
-
const { businessAuditTrailCommand } = await import("./audit-trail-
|
|
4057
|
+
const { businessAuditTrailCommand } = await import("./audit-trail-5LOCJ7XZ.js");
|
|
3874
4058
|
await businessAuditTrailCommand(opts);
|
|
3875
4059
|
});
|
|
3876
4060
|
business.command("export").description("Export all business data").option("--yes", "Skip confirmation prompt").option("--json", "JSON output").action(async (opts) => {
|
|
3877
|
-
const { businessExportCommand } = await import("./export-
|
|
4061
|
+
const { businessExportCommand } = await import("./export-QICOQK34.js");
|
|
3878
4062
|
await businessExportCommand(opts);
|
|
3879
4063
|
});
|
|
3880
4064
|
business.command("switch").description("Switch active business").option("--json", "JSON output").action(async (opts) => {
|
|
@@ -3956,30 +4140,30 @@ function registerDocumentCommands(program2) {
|
|
|
3956
4140
|
for (const dt of DOC_TYPES) {
|
|
3957
4141
|
const parent = program2.command(dt.cmd).description(`${dt.label} management`);
|
|
3958
4142
|
parent.command("list").description(`List ${dt.label.toLowerCase()}s`).option("--json", "JSON output").option("--format <format>", "Output format: table, tsv, csv, ids").option("--status <status>", `Filter by status: ${dt.statuses.join(", ")}`).option("--party <search>", "Filter by party name").option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--this-month", "Current month").option("--this-fy", "Current financial year").option("--page <n>", "Page number", parseInt).option("--limit <n>", "Items per page", parseInt).action(async (opts) => {
|
|
3959
|
-
const { docListCommand } = await import("./factory-
|
|
4143
|
+
const { docListCommand } = await import("./factory-KOCW2AQM.js");
|
|
3960
4144
|
await docListCommand(dt, opts);
|
|
3961
4145
|
});
|
|
3962
4146
|
parent.command("get <id>").description(`Get ${dt.label.toLowerCase()} details`).option("--json", "JSON output").action(async (id, opts) => {
|
|
3963
|
-
const { docGetCommand } = await import("./factory-
|
|
4147
|
+
const { docGetCommand } = await import("./factory-KOCW2AQM.js");
|
|
3964
4148
|
await docGetCommand(dt, id, opts);
|
|
3965
4149
|
});
|
|
3966
4150
|
parent.command("create").description(`Create a new ${dt.label.toLowerCase()}`).option("--json", "JSON output").option("--party-id <id>", "Party UUID").option("--party <name>", "Party search name").option("--date <date>", "Document date (YYYY-MM-DD)").option("--due-date <date>", "Due date (YYYY-MM-DD)").option("--item <desc>", "Item description (repeatable)", (v, a) => [...a, v], []).option("--qty <n>", "Quantity per item (repeatable)", (v, a) => [...a, v], []).option("--rate <n>", "Rate per item (repeatable)", (v, a) => [...a, v], []).option("--notes <text>", "Notes").option("--discount <pct>", "Discount percent").option("-y, --yes", "Skip confirmation").action(async (opts) => {
|
|
3967
|
-
const { docCreateCommand } = await import("./factory-
|
|
4151
|
+
const { docCreateCommand } = await import("./factory-KOCW2AQM.js");
|
|
3968
4152
|
await docCreateCommand(dt, opts);
|
|
3969
4153
|
});
|
|
3970
4154
|
parent.command("update-status <id> <status>").description(`Update ${dt.label.toLowerCase()} status (${dt.statuses.join(", ")})`).option("--json", "JSON output").action(async (id, status, opts) => {
|
|
3971
|
-
const { docStatusCommand } = await import("./factory-
|
|
4155
|
+
const { docStatusCommand } = await import("./factory-KOCW2AQM.js");
|
|
3972
4156
|
await docStatusCommand(dt, id, status, opts);
|
|
3973
4157
|
});
|
|
3974
4158
|
parent.command("delete <id>").description(`Delete a ${dt.label.toLowerCase()}`).option("-y, --yes", "Skip confirmation").option("--json", "JSON output").action(async (id, opts) => {
|
|
3975
|
-
const { docDeleteCommand } = await import("./factory-
|
|
4159
|
+
const { docDeleteCommand } = await import("./factory-KOCW2AQM.js");
|
|
3976
4160
|
await docDeleteCommand(dt, id, opts);
|
|
3977
4161
|
});
|
|
3978
4162
|
}
|
|
3979
4163
|
program2.command("document").description("Document conversion operations").command("convert").description("Convert one document type to another").requiredOption("--from-type <type>", "Source type (quotation, proforma, delivery-challan, etc.)").requiredOption("--from-id <id>", "Source document ID").requiredOption("--to-type <type>", "Target type (invoice, credit-note, etc.)").option("--json", "JSON output").option("-y, --yes", "Skip confirmation").action(async (opts) => {
|
|
3980
|
-
const { HisaaboClient: HisaaboClient2, HisaaboApiError: HisaaboApiError2 } = await import("./client-
|
|
3981
|
-
const { requireAuth: requireAuth2 } = await import("./config-
|
|
3982
|
-
const { fatalError: fatalError2, outputJSON: outputJSON2, success: success2, EXIT: EXIT2 } = await import("./output-
|
|
4164
|
+
const { HisaaboClient: HisaaboClient2, HisaaboApiError: HisaaboApiError2 } = await import("./client-5NZ23GML.js");
|
|
4165
|
+
const { requireAuth: requireAuth2 } = await import("./config-335MN4I7.js");
|
|
4166
|
+
const { fatalError: fatalError2, outputJSON: outputJSON2, success: success2, EXIT: EXIT2 } = await import("./output-NUOL7KJW.js");
|
|
3983
4167
|
const cfg = requireAuth2();
|
|
3984
4168
|
const client = new HisaaboClient2(cfg);
|
|
3985
4169
|
if (!opts.yes && process.stdin.isTTY) {
|
|
@@ -4030,47 +4214,73 @@ function registerDocumentCommands(program2) {
|
|
|
4030
4214
|
function registerTenantCommands(program2) {
|
|
4031
4215
|
const tenant = program2.command("tenant").description("Tenant / workspace management");
|
|
4032
4216
|
tenant.command("list").description("List tenants / organizations you belong to").option("--json", "JSON output").action(async (opts) => {
|
|
4033
|
-
const { tenantListCommand } = await import("./list-
|
|
4217
|
+
const { tenantListCommand } = await import("./list-T74SN6IR.js");
|
|
4034
4218
|
await tenantListCommand({ json: opts.json });
|
|
4035
4219
|
});
|
|
4036
4220
|
tenant.command("members").description("List members of the current tenant").option("--json", "JSON output").option("--format <format>", "Output format: table, tsv, csv").action(async (opts) => {
|
|
4037
|
-
const { tenantMembersCommand } = await import("./members-
|
|
4221
|
+
const { tenantMembersCommand } = await import("./members-W2GW3ODT.js");
|
|
4038
4222
|
await tenantMembersCommand({ json: opts.json, format: opts.format });
|
|
4039
4223
|
});
|
|
4040
4224
|
tenant.command("invite <email>").description("Invite a user to the tenant").option("--role <role>", "Role: admin, seller_manager, seller, accountant (default: seller)").option("--json", "JSON output").action(async (email, opts) => {
|
|
4041
|
-
const { tenantInviteCommand } = await import("./invite-
|
|
4225
|
+
const { tenantInviteCommand } = await import("./invite-T3CKX53E.js");
|
|
4042
4226
|
await tenantInviteCommand(email, { role: opts.role, json: opts.json });
|
|
4043
4227
|
});
|
|
4044
4228
|
tenant.command("remove <userId>").description("Remove a member from the tenant").option("-y, --yes", "Skip confirmation").option("--json", "JSON output").action(async (userId, opts) => {
|
|
4045
|
-
const { tenantRemoveCommand } = await import("./remove-
|
|
4229
|
+
const { tenantRemoveCommand } = await import("./remove-6QZI4JCY.js");
|
|
4046
4230
|
await tenantRemoveCommand(userId, { yes: opts.yes, json: opts.json });
|
|
4047
4231
|
});
|
|
4048
4232
|
tenant.command("update-role <userId> <role>").description("Update a member's role (admin, seller_manager, seller, accountant)").option("--json", "JSON output").action(async (userId, role, opts) => {
|
|
4049
|
-
const { tenantUpdateRoleCommand } = await import("./update-role-
|
|
4233
|
+
const { tenantUpdateRoleCommand } = await import("./update-role-QST7BVFX.js");
|
|
4050
4234
|
await tenantUpdateRoleCommand(userId, role, { json: opts.json });
|
|
4051
4235
|
});
|
|
4236
|
+
tenant.command("invitations").description("List pending invitations").option("--json", "JSON output").action(async (opts) => {
|
|
4237
|
+
const { listInvitationsCommand } = await import("./invitations-P3EEN5WI.js");
|
|
4238
|
+
await listInvitationsCommand(opts);
|
|
4239
|
+
});
|
|
4240
|
+
tenant.command("revoke-invitation <invitationId>").description("Revoke a pending invitation").option("--json", "JSON output").action(async (invitationId, opts) => {
|
|
4241
|
+
const { revokeInvitationCommand } = await import("./revoke-invitation-DTGQRJR4.js");
|
|
4242
|
+
await revokeInvitationCommand(invitationId, opts);
|
|
4243
|
+
});
|
|
4052
4244
|
}
|
|
4053
4245
|
|
|
4054
4246
|
// src/bin/registrars/api-key.ts
|
|
4055
4247
|
function registerApiKeyCommands(program2) {
|
|
4056
4248
|
const apiKey = program2.command("api-key").alias("key").description("API key management");
|
|
4057
4249
|
apiKey.command("list").description("List all API keys").option("--json", "JSON output").option("--format <fmt>", "Output format: table, tsv, csv").action(async (opts) => {
|
|
4058
|
-
const { apiKeyListCommand } = await import("./list-
|
|
4250
|
+
const { apiKeyListCommand } = await import("./list-A2RKI3ZG.js");
|
|
4059
4251
|
await apiKeyListCommand(opts);
|
|
4060
4252
|
});
|
|
4061
4253
|
apiKey.command("create").description("Create a new API key").requiredOption("--name <name>", "Name / label for this key").option("--json", "JSON output").action(async (opts) => {
|
|
4062
|
-
const { apiKeyCreateCommand } = await import("./create-
|
|
4254
|
+
const { apiKeyCreateCommand } = await import("./create-RPDEORDD.js");
|
|
4063
4255
|
await apiKeyCreateCommand(opts);
|
|
4064
4256
|
});
|
|
4065
4257
|
apiKey.command("revoke <id>").description("Revoke an API key by ID").option("--yes", "Skip confirmation prompt").option("--json", "JSON output").action(async (id, opts) => {
|
|
4066
|
-
const { apiKeyRevokeCommand } = await import("./revoke-
|
|
4258
|
+
const { apiKeyRevokeCommand } = await import("./revoke-YUCFZFNR.js");
|
|
4067
4259
|
await apiKeyRevokeCommand(id, opts);
|
|
4068
4260
|
});
|
|
4069
4261
|
}
|
|
4070
4262
|
|
|
4263
|
+
// src/bin/registrars/session.ts
|
|
4264
|
+
function registerSessionCommands(program2) {
|
|
4265
|
+
const session = program2.command("session").description("Manage active sessions");
|
|
4266
|
+
session.command("list").description("List active sessions").option("--expired", "Show expired sessions instead").option("--json", "JSON output").action(async (opts) => {
|
|
4267
|
+
const { listSessionsCommand } = await import("./list-NRMBMKMI.js");
|
|
4268
|
+
await listSessionsCommand(opts);
|
|
4269
|
+
});
|
|
4270
|
+
session.command("revoke <sessionId>").description("Revoke a specific session").option("--json", "JSON output").action(async (sessionId, opts) => {
|
|
4271
|
+
const { revokeSessionCommand } = await import("./revoke-AVEMPAC7.js");
|
|
4272
|
+
await revokeSessionCommand(sessionId, opts);
|
|
4273
|
+
});
|
|
4274
|
+
session.command("revoke-all").description("Sign out from all devices").action(async () => {
|
|
4275
|
+
const { revokeAllSessionsCommand } = await import("./revoke-all-LFW5WBHO.js");
|
|
4276
|
+
await revokeAllSessionsCommand();
|
|
4277
|
+
});
|
|
4278
|
+
}
|
|
4279
|
+
|
|
4071
4280
|
// src/bin/hisaabo.ts
|
|
4072
4281
|
var program = new Command();
|
|
4073
|
-
|
|
4282
|
+
var cliVersion = true ? "0.5.0" : "dev";
|
|
4283
|
+
program.name("hisaabo").description("Hisaabo CLI \u2014 Invoicing and business management").version(cliVersion);
|
|
4074
4284
|
registerAuthCommands(program);
|
|
4075
4285
|
registerDashboardCommands(program);
|
|
4076
4286
|
registerInvoiceCommands(program);
|
|
@@ -4090,6 +4300,7 @@ registerBusinessCommands(program);
|
|
|
4090
4300
|
registerDocumentCommands(program);
|
|
4091
4301
|
registerTenantCommands(program);
|
|
4092
4302
|
registerApiKeyCommands(program);
|
|
4303
|
+
registerSessionCommands(program);
|
|
4093
4304
|
program.parseAsync(process.argv).catch((err) => {
|
|
4094
4305
|
fatalError(String(err instanceof Error ? err.message : err));
|
|
4095
4306
|
});
|