@hisaabo/cli 0.1.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/.turbo/turbo-typecheck.log +1 -1
- package/README.md +332 -0
- package/dist/bin/audit-trail-5LOCJ7XZ.js +78 -0
- package/dist/bin/categories-64WWZTND.js +47 -0
- package/dist/bin/check-slug-FLHHUDYS.js +65 -0
- package/dist/bin/chunk-4MEL44QX.js +848 -0
- package/dist/bin/chunk-FIMJZAS4.js +84 -0
- package/dist/bin/chunk-NO4FIFMS.js +176 -0
- package/dist/bin/chunk-T63VQXNM.js +156 -0
- package/dist/bin/client-5NZ23GML.js +11 -0
- package/dist/bin/collection-efficiency-U56XNVEE.js +165 -0
- package/dist/bin/config-335MN4I7.js +18 -0
- package/dist/bin/create-RPDEORDD.js +83 -0
- package/dist/bin/default-account-AE6EXZZR.js +58 -0
- package/dist/bin/expenses-5N2QSG54.js +89 -0
- package/dist/bin/export-QICOQK34.js +59 -0
- package/dist/bin/factory-KOCW2AQM.js +483 -0
- package/dist/bin/get-A43QCI2S.js +66 -0
- package/dist/bin/get-GWH6S5SJ.js +71 -0
- package/dist/bin/hisaabo.js +2302 -1510
- package/dist/bin/invitations-P3EEN5WI.js +66 -0
- package/dist/bin/invite-T3CKX53E.js +53 -0
- package/dist/bin/invoice-breakdown-FN5BEFJD.js +97 -0
- package/dist/bin/items-2OOCQKVF.js +62 -0
- package/dist/bin/items-toggle-SKZWCGJH.js +46 -0
- package/dist/bin/list-A2RKI3ZG.js +79 -0
- package/dist/bin/list-NRMBMKMI.js +90 -0
- package/dist/bin/list-T74SN6IR.js +46 -0
- package/dist/bin/members-W2GW3ODT.js +55 -0
- package/dist/bin/monthly-comparison-T34ZFOHL.js +176 -0
- package/dist/bin/order-cancel-TI27JYYD.js +55 -0
- package/dist/bin/order-confirm-VMRAMNTD.js +53 -0
- package/dist/bin/order-get-C2RBUR4O.js +88 -0
- package/dist/bin/order-update-RE3HATNF.js +60 -0
- package/dist/bin/output-NUOL7KJW.js +35 -0
- package/dist/bin/payment-modes-WOOT22I7.js +126 -0
- package/dist/bin/profit-loss-T4RESJ32.js +135 -0
- package/dist/bin/receivables-aging-6XMENEWS.js +161 -0
- package/dist/bin/remove-6QZI4JCY.js +52 -0
- package/dist/bin/revoke-AVEMPAC7.js +40 -0
- package/dist/bin/revoke-YUCFZFNR.js +52 -0
- package/dist/bin/revoke-all-LFW5WBHO.js +33 -0
- package/dist/bin/revoke-invitation-DTGQRJR4.js +40 -0
- package/dist/bin/sales-trend-ZYBRUDUU.js +71 -0
- package/dist/bin/sequence-FPOJTI2P.js +66 -0
- package/dist/bin/store-IOB4Y67C.js +82 -0
- package/dist/bin/summary-5KYBA4ZO.js +113 -0
- package/dist/bin/top-customers-WSQ2UEJL.js +81 -0
- package/dist/bin/top-items-RWQPDGLN.js +84 -0
- package/dist/bin/top-outstanding-QAMO2E7Y.js +64 -0
- package/dist/bin/unpaid-invoices-WB3TK5B4.js +65 -0
- package/dist/bin/untracked-H733MYJL.js +67 -0
- package/dist/bin/update-H6LPO2Z4.js +61 -0
- package/dist/bin/update-JU2X3XU5.js +54 -0
- package/dist/bin/update-TLBUIC5J.js +57 -0
- package/dist/bin/update-role-QST7BVFX.js +45 -0
- package/dist/bin/update-settings-Q2EGRLKZ.js +56 -0
- package/package.json +7 -6
- package/src/auth.ts +12 -3
- package/src/bin/hisaabo.ts +49 -935
- package/src/bin/registrars/api-key.ts +44 -0
- package/src/bin/registrars/auth.ts +222 -0
- package/src/bin/registrars/automated-invoice.ts +167 -0
- package/src/bin/registrars/bank.ts +124 -0
- package/src/bin/registrars/business.ts +120 -0
- package/src/bin/registrars/dashboard.ts +225 -0
- package/src/bin/registrars/document.ts +184 -0
- package/src/bin/registrars/expense.ts +87 -0
- package/src/bin/registrars/gst.ts +41 -0
- package/src/bin/registrars/import.ts +49 -0
- package/src/bin/registrars/invoice.ts +117 -0
- package/src/bin/registrars/item.ts +112 -0
- package/src/bin/registrars/party.ts +81 -0
- package/src/bin/registrars/payment.ts +128 -0
- package/src/bin/registrars/report.ts +142 -0
- package/src/bin/registrars/session.ts +32 -0
- package/src/bin/registrars/shipment.ts +74 -0
- package/src/bin/registrars/store.ts +128 -0
- package/src/bin/registrars/target.ts +46 -0
- package/src/bin/registrars/tenant.ts +73 -0
- package/src/client.ts +589 -15
- package/src/commands/api-key/create.ts +72 -0
- package/src/commands/api-key/list.ts +71 -0
- package/src/commands/api-key/revoke.ts +46 -0
- package/src/commands/automated-invoice/create.ts +85 -0
- package/src/commands/automated-invoice/delete.ts +42 -0
- package/src/commands/automated-invoice/get.ts +113 -0
- package/src/commands/automated-invoice/history.ts +65 -0
- package/src/commands/automated-invoice/index.ts +11 -0
- package/src/commands/automated-invoice/list.ts +91 -0
- package/src/commands/automated-invoice/pause.ts +29 -0
- package/src/commands/automated-invoice/resume.ts +29 -0
- package/src/commands/automated-invoice/run-now.ts +29 -0
- package/src/commands/automated-invoice/suggestions.ts +68 -0
- package/src/commands/automated-invoice/update.ts +54 -0
- package/src/commands/automated-invoice/usage.ts +68 -0
- package/src/commands/bank/gateway-config.ts +61 -0
- package/src/commands/bank/update-gateway.ts +84 -0
- package/src/commands/business/audit-trail.ts +79 -0
- package/src/commands/business/export.ts +52 -0
- package/src/commands/business/get.ts +55 -0
- package/src/commands/business/sequence.ts +65 -0
- package/src/commands/business/update.ts +64 -0
- package/src/commands/dashboard/collection-efficiency.ts +164 -0
- package/src/commands/dashboard/expenses.ts +76 -0
- package/src/commands/dashboard/invoice-breakdown.ts +89 -0
- package/src/commands/dashboard/monthly-comparison.ts +193 -0
- package/src/commands/dashboard/payment-modes.ts +121 -0
- package/src/commands/dashboard/profit-loss.ts +146 -0
- package/src/commands/dashboard/receivables-aging.ts +169 -0
- package/src/commands/dashboard/sales-trend.ts +68 -0
- package/src/commands/dashboard/summary.ts +105 -0
- package/src/commands/dashboard/top-customers.ts +70 -0
- package/src/commands/dashboard/top-items.ts +74 -0
- package/src/commands/dashboard/top-outstanding.ts +61 -0
- package/src/commands/document/factory.ts +590 -0
- package/src/commands/expense/categories.ts +40 -0
- package/src/commands/expense/update.ts +58 -0
- package/src/commands/import/index.ts +68 -0
- package/src/commands/item/categories.ts +40 -0
- package/src/commands/item/low-stock-count.ts +32 -0
- package/src/commands/item/merge.ts +53 -0
- package/src/commands/item/price-history.ts +59 -0
- package/src/commands/item/rename-unit.ts +39 -0
- package/src/commands/item/sales-stats.ts +44 -0
- package/src/commands/item/stock-history.ts +70 -0
- package/src/commands/item/switch-base-unit.ts +42 -0
- package/src/commands/item/update.ts +59 -0
- package/src/commands/item/variants-create.ts +58 -0
- package/src/commands/item/variants-delete.ts +47 -0
- package/src/commands/item/variants-list.ts +63 -0
- package/src/commands/item/variants-update.ts +61 -0
- package/src/commands/party/ledger-report.ts +81 -0
- package/src/commands/party/merge.ts +50 -0
- package/src/commands/party/stats.ts +40 -0
- package/src/commands/party/top-items.ts +57 -0
- package/src/commands/party/update.ts +65 -0
- package/src/commands/payment/default-account.ts +56 -0
- package/src/commands/payment/get.ts +59 -0
- package/src/commands/payment/unpaid-invoices.ts +69 -0
- package/src/commands/payment/untracked.ts +70 -0
- package/src/commands/payment/update.ts +54 -0
- package/src/commands/report/index.ts +348 -1
- 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/store/check-slug.ts +48 -0
- package/src/commands/store/items-toggle.ts +41 -0
- package/src/commands/store/items.ts +61 -0
- package/src/commands/store/order-cancel.ts +48 -0
- package/src/commands/store/order-confirm.ts +45 -0
- package/src/commands/store/order-get.ts +66 -0
- package/src/commands/store/order-update.ts +52 -0
- package/src/commands/store/update-settings.ts +52 -0
- package/src/commands/tenant/invitations.ts +62 -0
- package/src/commands/tenant/invite.ts +57 -0
- package/src/commands/tenant/list.ts +46 -0
- package/src/commands/tenant/members.ts +55 -0
- package/src/commands/tenant/remove.ts +47 -0
- package/src/commands/tenant/revoke-invitation.ts +32 -0
- package/src/commands/tenant/update-role.ts +41 -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/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
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
HisaaboApiError,
|
|
4
|
+
HisaaboClient
|
|
5
|
+
} from "./chunk-4MEL44QX.js";
|
|
6
|
+
import {
|
|
7
|
+
requireAuth
|
|
8
|
+
} from "./chunk-FIMJZAS4.js";
|
|
9
|
+
import {
|
|
10
|
+
EXIT,
|
|
11
|
+
fatalError,
|
|
12
|
+
hasColor,
|
|
13
|
+
outputJSON
|
|
14
|
+
} from "./chunk-NO4FIFMS.js";
|
|
15
|
+
|
|
16
|
+
// src/commands/business/get.ts
|
|
17
|
+
import chalk from "chalk";
|
|
18
|
+
async function businessGetCommand(opts) {
|
|
19
|
+
const cfg = requireAuth();
|
|
20
|
+
const client = new HisaaboClient(cfg);
|
|
21
|
+
try {
|
|
22
|
+
const biz = await client.business.get();
|
|
23
|
+
if (opts.json) {
|
|
24
|
+
outputJSON(biz);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const sep = "\u2500".repeat(52);
|
|
28
|
+
const line = (label, value) => {
|
|
29
|
+
if (!value) return;
|
|
30
|
+
const lbl = hasColor() ? chalk.dim(label.padEnd(24)) : label.padEnd(24);
|
|
31
|
+
process.stdout.write(` ${lbl}${value}
|
|
32
|
+
`);
|
|
33
|
+
};
|
|
34
|
+
process.stdout.write("\n");
|
|
35
|
+
if (hasColor()) {
|
|
36
|
+
process.stdout.write(" " + chalk.bold(biz.name ?? "") + "\n");
|
|
37
|
+
process.stdout.write(" " + chalk.dim(sep) + "\n");
|
|
38
|
+
} else {
|
|
39
|
+
process.stdout.write(` ${biz.name ?? ""}
|
|
40
|
+
`);
|
|
41
|
+
process.stdout.write(" " + sep + "\n");
|
|
42
|
+
}
|
|
43
|
+
line("GSTIN", biz.gstin);
|
|
44
|
+
line("GST Type", biz.gstRegistrationType);
|
|
45
|
+
line("Phone", biz.phone);
|
|
46
|
+
line("Email", biz.email);
|
|
47
|
+
line("Address", biz.address);
|
|
48
|
+
line("City", biz.city);
|
|
49
|
+
line("State", biz.state);
|
|
50
|
+
line("Pincode", biz.pincode);
|
|
51
|
+
line("Financial Year Start", biz.financialYearStart ? `Month ${biz.financialYearStart}` : void 0);
|
|
52
|
+
line("Currency", biz.currency);
|
|
53
|
+
line("ID", biz.id);
|
|
54
|
+
process.stdout.write("\n");
|
|
55
|
+
} catch (e) {
|
|
56
|
+
if (e instanceof HisaaboApiError) {
|
|
57
|
+
const err = e.hisaaboError;
|
|
58
|
+
if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
|
|
59
|
+
if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
|
|
60
|
+
}
|
|
61
|
+
fatalError(String(e instanceof Error ? e.message : e));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export {
|
|
65
|
+
businessGetCommand
|
|
66
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
formatDate,
|
|
4
|
+
formatINR
|
|
5
|
+
} from "./chunk-T63VQXNM.js";
|
|
6
|
+
import {
|
|
7
|
+
HisaaboApiError,
|
|
8
|
+
HisaaboClient
|
|
9
|
+
} from "./chunk-4MEL44QX.js";
|
|
10
|
+
import {
|
|
11
|
+
requireAuth
|
|
12
|
+
} from "./chunk-FIMJZAS4.js";
|
|
13
|
+
import {
|
|
14
|
+
EXIT,
|
|
15
|
+
fatalError,
|
|
16
|
+
outputJSON
|
|
17
|
+
} from "./chunk-NO4FIFMS.js";
|
|
18
|
+
|
|
19
|
+
// src/commands/payment/get.ts
|
|
20
|
+
async function paymentGetCommand(id, opts) {
|
|
21
|
+
const cfg = requireAuth();
|
|
22
|
+
const client = new HisaaboClient(cfg);
|
|
23
|
+
try {
|
|
24
|
+
const payment = await client.payment.getById(id);
|
|
25
|
+
if (!payment) {
|
|
26
|
+
fatalError(`Payment not found: ${id}`, EXIT.NOT_FOUND);
|
|
27
|
+
}
|
|
28
|
+
if (opts.json) {
|
|
29
|
+
outputJSON(payment);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const p = payment;
|
|
33
|
+
const sep = "\u2500".repeat(48);
|
|
34
|
+
console.log(`
|
|
35
|
+
Payment: ${p.paymentNumber}`);
|
|
36
|
+
console.log(` ${sep}`);
|
|
37
|
+
console.log(` Party : ${p.partyName}`);
|
|
38
|
+
console.log(` Date : ${formatDate(p.paymentDate)}`);
|
|
39
|
+
console.log(` Amount : ${formatINR(p.amount)}`);
|
|
40
|
+
if (parseFloat(p.discount) > 0) {
|
|
41
|
+
console.log(` Discount : ${formatINR(p.discount)}`);
|
|
42
|
+
}
|
|
43
|
+
console.log(` Mode : ${p.mode}`);
|
|
44
|
+
console.log(` Reference : ${p.referenceNumber ?? "-"}`);
|
|
45
|
+
console.log(` Notes : ${p.notes ?? "-"}`);
|
|
46
|
+
console.log(` Bank Acct : ${p.bankAccountId ?? "-"}`);
|
|
47
|
+
if (p.linkedInvoices && p.linkedInvoices.length > 0) {
|
|
48
|
+
console.log(`
|
|
49
|
+
Linked Invoices:`);
|
|
50
|
+
console.log(` ${"\u2500".repeat(65)}`);
|
|
51
|
+
for (const inv of p.linkedInvoices) {
|
|
52
|
+
const total = formatINR(inv.totalAmount);
|
|
53
|
+
const applied = formatINR(inv.amount);
|
|
54
|
+
console.log(` ${inv.invoiceNumber.padEnd(14)} ${formatDate(inv.invoiceDate).padEnd(14)} Total: ${total.padStart(11)} Applied: ${applied.padStart(11)} [${inv.status.toUpperCase()}]`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
console.log();
|
|
58
|
+
} catch (e) {
|
|
59
|
+
if (e instanceof HisaaboApiError) {
|
|
60
|
+
const err = e.hisaaboError;
|
|
61
|
+
if (err.code === "not_found") fatalError(`Payment not found: ${id}`, EXIT.NOT_FOUND);
|
|
62
|
+
if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
|
|
63
|
+
if (err.code === "forbidden") fatalError(err.message, EXIT.FORBIDDEN);
|
|
64
|
+
if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
|
|
65
|
+
}
|
|
66
|
+
fatalError(String(e instanceof Error ? e.message : e));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
paymentGetCommand
|
|
71
|
+
};
|