@hisaabo/cli 0.3.2 → 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.
Files changed (84) hide show
  1. package/.turbo/turbo-typecheck.log +1 -1
  2. package/README.md +1 -1
  3. package/dist/bin/{audit-trail-2YGXGUXW.js → audit-trail-5LOCJ7XZ.js} +4 -4
  4. package/dist/bin/{categories-P5VFWD5F.js → categories-64WWZTND.js} +3 -3
  5. package/dist/bin/{check-slug-4TMOTWUJ.js → check-slug-FLHHUDYS.js} +3 -3
  6. package/dist/bin/{chunk-FTOBDKMO.js → chunk-4MEL44QX.js} +54 -10
  7. package/dist/bin/chunk-FIMJZAS4.js +84 -0
  8. package/dist/bin/{chunk-EYNDY7RB.js → chunk-NO4FIFMS.js} +2 -1
  9. package/dist/bin/{chunk-FFBG6RU4.js → chunk-T63VQXNM.js} +1 -1
  10. package/dist/bin/{client-QNJ2H5CW.js → client-5NZ23GML.js} +1 -1
  11. package/dist/bin/{collection-efficiency-WMKEGS6U.js → collection-efficiency-U56XNVEE.js} +4 -4
  12. package/dist/bin/{config-UKVQYPPR.js → config-335MN4I7.js} +2 -2
  13. package/dist/bin/{create-Y22FAVOW.js → create-RPDEORDD.js} +3 -3
  14. package/dist/bin/{default-account-SA56M66A.js → default-account-AE6EXZZR.js} +3 -3
  15. package/dist/bin/{expenses-VZAOLYUW.js → expenses-5N2QSG54.js} +4 -4
  16. package/dist/bin/{export-QZ6WT6PJ.js → export-QICOQK34.js} +3 -3
  17. package/dist/bin/{factory-2DCU3B5T.js → factory-KOCW2AQM.js} +4 -4
  18. package/dist/bin/{get-EXL44I2X.js → get-A43QCI2S.js} +3 -3
  19. package/dist/bin/{get-6UYP6UVD.js → get-GWH6S5SJ.js} +4 -4
  20. package/dist/bin/hisaabo.js +280 -67
  21. package/dist/bin/invitations-P3EEN5WI.js +66 -0
  22. package/dist/bin/{invite-O26SAL72.js → invite-T3CKX53E.js} +3 -3
  23. package/dist/bin/{invoice-breakdown-XEATXVMR.js → invoice-breakdown-FN5BEFJD.js} +4 -4
  24. package/dist/bin/{items-3U5USBVG.js → items-2OOCQKVF.js} +4 -4
  25. package/dist/bin/{items-toggle-YEKMI2CM.js → items-toggle-SKZWCGJH.js} +3 -3
  26. package/dist/bin/{list-VBAHY72W.js → list-A2RKI3ZG.js} +4 -4
  27. package/dist/bin/list-NRMBMKMI.js +90 -0
  28. package/dist/bin/{list-FX2C3NCL.js → list-T74SN6IR.js} +3 -3
  29. package/dist/bin/{members-5FPRUAB6.js → members-W2GW3ODT.js} +4 -4
  30. package/dist/bin/{monthly-comparison-JEJ3TTY2.js → monthly-comparison-T34ZFOHL.js} +4 -4
  31. package/dist/bin/{order-cancel-XI2LKYXV.js → order-cancel-TI27JYYD.js} +3 -3
  32. package/dist/bin/{order-confirm-HUFCU6MO.js → order-confirm-VMRAMNTD.js} +3 -3
  33. package/dist/bin/{order-get-NSDMPUZR.js → order-get-C2RBUR4O.js} +4 -4
  34. package/dist/bin/{order-update-C7QYSD5R.js → order-update-RE3HATNF.js} +4 -4
  35. package/dist/bin/{output-QFLEKG5W.js → output-NUOL7KJW.js} +1 -1
  36. package/dist/bin/{payment-modes-WI3AWSES.js → payment-modes-WOOT22I7.js} +4 -4
  37. package/dist/bin/{profit-loss-5RIEOBKP.js → profit-loss-T4RESJ32.js} +4 -4
  38. package/dist/bin/{receivables-aging-L6DIQCNE.js → receivables-aging-6XMENEWS.js} +4 -4
  39. package/dist/bin/{remove-M2B4TZ37.js → remove-6QZI4JCY.js} +3 -3
  40. package/dist/bin/revoke-AVEMPAC7.js +40 -0
  41. package/dist/bin/{revoke-H3V2GNCD.js → revoke-YUCFZFNR.js} +3 -3
  42. package/dist/bin/revoke-all-LFW5WBHO.js +33 -0
  43. package/dist/bin/revoke-invitation-DTGQRJR4.js +40 -0
  44. package/dist/bin/{sales-trend-TICB3KGF.js → sales-trend-ZYBRUDUU.js} +4 -4
  45. package/dist/bin/{sequence-XUD6FAKY.js → sequence-FPOJTI2P.js} +3 -3
  46. package/dist/bin/{store-UQ2DDQ5I.js → store-IOB4Y67C.js} +4 -4
  47. package/dist/bin/{summary-BPNFC7I2.js → summary-5KYBA4ZO.js} +4 -4
  48. package/dist/bin/{top-customers-WGGJWKCN.js → top-customers-WSQ2UEJL.js} +4 -4
  49. package/dist/bin/{top-items-C7ZDDJMR.js → top-items-RWQPDGLN.js} +4 -4
  50. package/dist/bin/{top-outstanding-MOGWJIQS.js → top-outstanding-QAMO2E7Y.js} +4 -4
  51. package/dist/bin/{unpaid-invoices-ZUPNMQJP.js → unpaid-invoices-WB3TK5B4.js} +4 -4
  52. package/dist/bin/{untracked-BCJEVDW4.js → untracked-H733MYJL.js} +4 -4
  53. package/dist/bin/{update-IG565YIN.js → update-H6LPO2Z4.js} +3 -3
  54. package/dist/bin/{update-HIU4PANX.js → update-JU2X3XU5.js} +4 -4
  55. package/dist/bin/{update-PVLAX7T3.js → update-TLBUIC5J.js} +4 -4
  56. package/dist/bin/{update-role-Q4ZYJRYT.js → update-role-QST7BVFX.js} +3 -3
  57. package/dist/bin/{update-settings-XPC6L5WM.js → update-settings-Q2EGRLKZ.js} +3 -3
  58. package/package.json +2 -6
  59. package/src/auth.ts +12 -3
  60. package/src/bin/hisaabo.ts +6 -1
  61. package/src/bin/registrars/auth.ts +79 -10
  62. package/src/bin/registrars/bank.ts +34 -0
  63. package/src/bin/registrars/session.ts +32 -0
  64. package/src/bin/registrars/tenant.ts +18 -0
  65. package/src/client.ts +94 -11
  66. package/src/commands/bank/gateway-config.ts +61 -0
  67. package/src/commands/bank/update-gateway.ts +84 -0
  68. package/src/commands/session/list.ts +91 -0
  69. package/src/commands/session/revoke-all.ts +20 -0
  70. package/src/commands/session/revoke.ts +32 -0
  71. package/src/commands/tenant/invitations.ts +62 -0
  72. package/src/commands/tenant/revoke-invitation.ts +32 -0
  73. package/src/config.ts +51 -2
  74. package/src/error-handler.ts +53 -0
  75. package/src/output.ts +1 -0
  76. package/src/spinner.ts +39 -0
  77. package/tsup.config.ts +6 -1
  78. package/dist/bin/chunk-2P35S2C3.js +0 -46
  79. package/src/components/ErrorDisplay.tsx +0 -16
  80. package/src/components/Header.tsx +0 -26
  81. package/src/components/MoneyCell.tsx +0 -16
  82. package/src/components/Spinner.tsx +0 -12
  83. package/src/components/StatusBadge.tsx +0 -39
  84. 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
+ outputTable
15
+ } from "./chunk-NO4FIFMS.js";
16
+
17
+ // src/commands/tenant/invitations.ts
18
+ import chalk from "chalk";
19
+ async function listInvitationsCommand(opts) {
20
+ const cfg = requireAuth();
21
+ const client = new HisaaboClient(cfg);
22
+ try {
23
+ const invitations = await client.tenant.pendingInvitations();
24
+ if (opts.json) {
25
+ outputJSON(invitations);
26
+ return;
27
+ }
28
+ const items = Array.isArray(invitations) ? invitations : invitations?.items ?? invitations?.data ?? [];
29
+ if (items.length === 0) {
30
+ console.log("No pending invitations.");
31
+ return;
32
+ }
33
+ const rows = items.map((item) => {
34
+ const inv = item;
35
+ return {
36
+ id: String(inv["id"] ?? "").slice(0, 8) + "...",
37
+ email: String(inv["email"] ?? "\u2014"),
38
+ role: String(inv["role"] ?? "\u2014"),
39
+ invitedBy: String(inv["invitedByName"] ?? "\u2014"),
40
+ expires: inv["expiresAt"] ? new Date(String(inv["expiresAt"])).toLocaleDateString() : "\u2014"
41
+ };
42
+ });
43
+ const columns = [
44
+ { key: "id", header: "ID", align: "left" },
45
+ { key: "email", header: "Email", align: "left" },
46
+ { key: "role", header: "Role", align: "left" },
47
+ { key: "invitedBy", header: "Invited By", align: "left" },
48
+ { key: "expires", header: "Expires", align: "left" }
49
+ ];
50
+ if (hasColor()) process.stdout.write("\n" + chalk.bold(" Pending Invitations\n") + "\n");
51
+ else process.stdout.write("\n Pending Invitations\n\n");
52
+ outputTable(rows, columns);
53
+ process.stdout.write("\n");
54
+ } catch (e) {
55
+ if (e instanceof HisaaboApiError) {
56
+ const err = e.hisaaboError;
57
+ if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
58
+ if (err.code === "forbidden") fatalError(err.message, EXIT.FORBIDDEN);
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
+ listInvitationsCommand
66
+ };
@@ -2,16 +2,16 @@
2
2
  import {
3
3
  HisaaboApiError,
4
4
  HisaaboClient
5
- } from "./chunk-FTOBDKMO.js";
5
+ } from "./chunk-4MEL44QX.js";
6
6
  import {
7
7
  requireAuth
8
- } from "./chunk-2P35S2C3.js";
8
+ } from "./chunk-FIMJZAS4.js";
9
9
  import {
10
10
  EXIT,
11
11
  fatalError,
12
12
  outputJSON,
13
13
  success
14
- } from "./chunk-EYNDY7RB.js";
14
+ } from "./chunk-NO4FIFMS.js";
15
15
 
16
16
  // src/commands/tenant/invite.ts
17
17
  var VALID_ROLES = ["admin", "seller_manager", "seller", "accountant"];
@@ -6,21 +6,21 @@ import {
6
6
  monthEnd,
7
7
  monthStart,
8
8
  todayISO
9
- } from "./chunk-FFBG6RU4.js";
9
+ } from "./chunk-T63VQXNM.js";
10
10
  import {
11
11
  HisaaboApiError,
12
12
  HisaaboClient
13
- } from "./chunk-FTOBDKMO.js";
13
+ } from "./chunk-4MEL44QX.js";
14
14
  import {
15
15
  requireAuth
16
- } from "./chunk-2P35S2C3.js";
16
+ } from "./chunk-FIMJZAS4.js";
17
17
  import {
18
18
  EXIT,
19
19
  fatalError,
20
20
  hasColor,
21
21
  outputJSON,
22
22
  outputTable
23
- } from "./chunk-EYNDY7RB.js";
23
+ } from "./chunk-NO4FIFMS.js";
24
24
 
25
25
  // src/commands/dashboard/invoice-breakdown.ts
26
26
  import chalk from "chalk";
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  formatAmount
4
- } from "./chunk-FFBG6RU4.js";
4
+ } from "./chunk-T63VQXNM.js";
5
5
  import {
6
6
  HisaaboApiError,
7
7
  HisaaboClient
8
- } from "./chunk-FTOBDKMO.js";
8
+ } from "./chunk-4MEL44QX.js";
9
9
  import {
10
10
  requireAuth
11
- } from "./chunk-2P35S2C3.js";
11
+ } from "./chunk-FIMJZAS4.js";
12
12
  import {
13
13
  EXIT,
14
14
  fatalError,
@@ -16,7 +16,7 @@ import {
16
16
  outputJSON,
17
17
  outputTSV,
18
18
  outputTable
19
- } from "./chunk-EYNDY7RB.js";
19
+ } from "./chunk-NO4FIFMS.js";
20
20
 
21
21
  // src/commands/store/items.ts
22
22
  async function storeItemsCommand(opts) {
@@ -2,16 +2,16 @@
2
2
  import {
3
3
  HisaaboApiError,
4
4
  HisaaboClient
5
- } from "./chunk-FTOBDKMO.js";
5
+ } from "./chunk-4MEL44QX.js";
6
6
  import {
7
7
  requireAuth
8
- } from "./chunk-2P35S2C3.js";
8
+ } from "./chunk-FIMJZAS4.js";
9
9
  import {
10
10
  EXIT,
11
11
  fatalError,
12
12
  outputJSON,
13
13
  success
14
- } from "./chunk-EYNDY7RB.js";
14
+ } from "./chunk-NO4FIFMS.js";
15
15
 
16
16
  // src/commands/store/items-toggle.ts
17
17
  async function storeItemsToggleCommand(opts) {
@@ -2,14 +2,14 @@
2
2
  import {
3
3
  formatDate,
4
4
  formatRelativeDate
5
- } from "./chunk-FFBG6RU4.js";
5
+ } from "./chunk-T63VQXNM.js";
6
6
  import {
7
7
  HisaaboApiError,
8
8
  HisaaboClient
9
- } from "./chunk-FTOBDKMO.js";
9
+ } from "./chunk-4MEL44QX.js";
10
10
  import {
11
11
  requireAuth
12
- } from "./chunk-2P35S2C3.js";
12
+ } from "./chunk-FIMJZAS4.js";
13
13
  import {
14
14
  EXIT,
15
15
  fatalError,
@@ -18,7 +18,7 @@ import {
18
18
  outputJSON,
19
19
  outputTSV,
20
20
  outputTable
21
- } from "./chunk-EYNDY7RB.js";
21
+ } from "./chunk-NO4FIFMS.js";
22
22
 
23
23
  // src/commands/api-key/list.ts
24
24
  import chalk from "chalk";
@@ -0,0 +1,90 @@
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
+ outputTable
15
+ } from "./chunk-NO4FIFMS.js";
16
+
17
+ // src/commands/session/list.ts
18
+ import chalk from "chalk";
19
+ async function listSessionsCommand(opts) {
20
+ const cfg = requireAuth();
21
+ const client = new HisaaboClient(cfg);
22
+ try {
23
+ const sessions = await client.auth.listSessions({ expired: opts.expired ?? false });
24
+ if (opts.json) {
25
+ outputJSON(sessions);
26
+ return;
27
+ }
28
+ const items = Array.isArray(sessions) ? sessions : sessions?.items ?? sessions?.data ?? [];
29
+ if (items.length === 0) {
30
+ console.log(opts.expired ? "No expired sessions." : "No active sessions.");
31
+ return;
32
+ }
33
+ const rows = items.map((item) => {
34
+ const s = item;
35
+ return {
36
+ id: String(s["id"] ?? "").slice(0, 12) + "...",
37
+ device: s["userAgent"] ? parseUA(String(s["userAgent"])) : "Unknown",
38
+ ip: String(s["ipAddress"] ?? "\u2014"),
39
+ lastUsed: s["lastUsedAt"] ? timeAgo(String(s["lastUsedAt"])) : "\u2014",
40
+ created: s["createdAt"] ? new Date(String(s["createdAt"])).toLocaleDateString() : "\u2014",
41
+ current: s["isCurrent"] ? "\u2713" : ""
42
+ };
43
+ });
44
+ const columns = [
45
+ { key: "id", header: "ID", align: "left" },
46
+ { key: "device", header: "Device", align: "left" },
47
+ { key: "ip", header: "IP", align: "left" },
48
+ { key: "lastUsed", header: "Last Used", align: "left" },
49
+ { key: "created", header: "Created", align: "left" },
50
+ { key: "current", header: "Current", align: "left" }
51
+ ];
52
+ if (hasColor()) process.stdout.write("\n" + chalk.bold(" Sessions\n") + "\n");
53
+ else process.stdout.write("\n Sessions\n\n");
54
+ outputTable(rows, columns);
55
+ process.stdout.write("\n");
56
+ } catch (e) {
57
+ if (e instanceof HisaaboApiError) {
58
+ const err = e.hisaaboError;
59
+ if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
60
+ if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
61
+ }
62
+ fatalError(String(e instanceof Error ? e.message : e));
63
+ }
64
+ }
65
+ function parseUA(ua) {
66
+ let browser = "Unknown";
67
+ if (ua.includes("Edg/")) browser = "Edge";
68
+ else if (ua.includes("Chrome/")) browser = "Chrome";
69
+ else if (ua.includes("Firefox/")) browser = "Firefox";
70
+ else if (ua.includes("Safari/")) browser = "Safari";
71
+ let os = "";
72
+ if (ua.includes("Windows")) os = "Windows";
73
+ else if (ua.includes("Mac OS")) os = "macOS";
74
+ else if (ua.includes("Linux")) os = "Linux";
75
+ else if (ua.includes("Android")) os = "Android";
76
+ else if (ua.includes("iPhone") || ua.includes("iPad")) os = "iOS";
77
+ return os ? `${browser} / ${os}` : browser;
78
+ }
79
+ function timeAgo(date) {
80
+ const diff = Date.now() - new Date(date).getTime();
81
+ const mins = Math.floor(diff / 6e4);
82
+ if (mins < 1) return "now";
83
+ if (mins < 60) return `${mins}m ago`;
84
+ const hrs = Math.floor(mins / 60);
85
+ if (hrs < 24) return `${hrs}h ago`;
86
+ return `${Math.floor(hrs / 24)}d ago`;
87
+ }
88
+ export {
89
+ listSessionsCommand
90
+ };
@@ -2,16 +2,16 @@
2
2
  import {
3
3
  HisaaboApiError,
4
4
  HisaaboClient
5
- } from "./chunk-FTOBDKMO.js";
5
+ } from "./chunk-4MEL44QX.js";
6
6
  import {
7
7
  requireAuth
8
- } from "./chunk-2P35S2C3.js";
8
+ } from "./chunk-FIMJZAS4.js";
9
9
  import {
10
10
  EXIT,
11
11
  fatalError,
12
12
  outputJSON,
13
13
  outputTable
14
- } from "./chunk-EYNDY7RB.js";
14
+ } from "./chunk-NO4FIFMS.js";
15
15
 
16
16
  // src/commands/tenant/list.ts
17
17
  async function tenantListCommand(opts) {
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  formatDate
4
- } from "./chunk-FFBG6RU4.js";
4
+ } from "./chunk-T63VQXNM.js";
5
5
  import {
6
6
  HisaaboApiError,
7
7
  HisaaboClient
8
- } from "./chunk-FTOBDKMO.js";
8
+ } from "./chunk-4MEL44QX.js";
9
9
  import {
10
10
  requireAuth
11
- } from "./chunk-2P35S2C3.js";
11
+ } from "./chunk-FIMJZAS4.js";
12
12
  import {
13
13
  EXIT,
14
14
  fatalError,
@@ -16,7 +16,7 @@ import {
16
16
  outputJSON,
17
17
  outputTSV,
18
18
  outputTable
19
- } from "./chunk-EYNDY7RB.js";
19
+ } from "./chunk-NO4FIFMS.js";
20
20
 
21
21
  // src/commands/tenant/members.ts
22
22
  async function tenantMembersCommand(opts) {
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  formatAmount
4
- } from "./chunk-FFBG6RU4.js";
4
+ } from "./chunk-T63VQXNM.js";
5
5
  import {
6
6
  HisaaboApiError,
7
7
  HisaaboClient
8
- } from "./chunk-FTOBDKMO.js";
8
+ } from "./chunk-4MEL44QX.js";
9
9
  import {
10
10
  requireAuth
11
- } from "./chunk-2P35S2C3.js";
11
+ } from "./chunk-FIMJZAS4.js";
12
12
  import {
13
13
  EXIT,
14
14
  fatalError,
@@ -17,7 +17,7 @@ import {
17
17
  outputJSON,
18
18
  outputTSV,
19
19
  outputTable
20
- } from "./chunk-EYNDY7RB.js";
20
+ } from "./chunk-NO4FIFMS.js";
21
21
 
22
22
  // src/commands/dashboard/monthly-comparison.ts
23
23
  import chalk from "chalk";
@@ -2,16 +2,16 @@
2
2
  import {
3
3
  HisaaboApiError,
4
4
  HisaaboClient
5
- } from "./chunk-FTOBDKMO.js";
5
+ } from "./chunk-4MEL44QX.js";
6
6
  import {
7
7
  requireAuth
8
- } from "./chunk-2P35S2C3.js";
8
+ } from "./chunk-FIMJZAS4.js";
9
9
  import {
10
10
  EXIT,
11
11
  fatalError,
12
12
  outputJSON,
13
13
  success
14
- } from "./chunk-EYNDY7RB.js";
14
+ } from "./chunk-NO4FIFMS.js";
15
15
 
16
16
  // src/commands/store/order-cancel.ts
17
17
  import * as readline from "readline";
@@ -2,16 +2,16 @@
2
2
  import {
3
3
  HisaaboApiError,
4
4
  HisaaboClient
5
- } from "./chunk-FTOBDKMO.js";
5
+ } from "./chunk-4MEL44QX.js";
6
6
  import {
7
7
  requireAuth
8
- } from "./chunk-2P35S2C3.js";
8
+ } from "./chunk-FIMJZAS4.js";
9
9
  import {
10
10
  EXIT,
11
11
  fatalError,
12
12
  outputJSON,
13
13
  success
14
- } from "./chunk-EYNDY7RB.js";
14
+ } from "./chunk-NO4FIFMS.js";
15
15
 
16
16
  // src/commands/store/order-confirm.ts
17
17
  import * as readline from "readline";
@@ -3,20 +3,20 @@ import {
3
3
  formatAmount,
4
4
  formatDate,
5
5
  formatStatus
6
- } from "./chunk-FFBG6RU4.js";
6
+ } from "./chunk-T63VQXNM.js";
7
7
  import {
8
8
  HisaaboApiError,
9
9
  HisaaboClient
10
- } from "./chunk-FTOBDKMO.js";
10
+ } from "./chunk-4MEL44QX.js";
11
11
  import {
12
12
  requireAuth
13
- } from "./chunk-2P35S2C3.js";
13
+ } from "./chunk-FIMJZAS4.js";
14
14
  import {
15
15
  EXIT,
16
16
  fatalError,
17
17
  hasColor,
18
18
  outputJSON
19
- } from "./chunk-EYNDY7RB.js";
19
+ } from "./chunk-NO4FIFMS.js";
20
20
 
21
21
  // src/commands/store/order-get.ts
22
22
  import chalk from "chalk";
@@ -1,20 +1,20 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  formatStatus
4
- } from "./chunk-FFBG6RU4.js";
4
+ } from "./chunk-T63VQXNM.js";
5
5
  import {
6
6
  HisaaboApiError,
7
7
  HisaaboClient
8
- } from "./chunk-FTOBDKMO.js";
8
+ } from "./chunk-4MEL44QX.js";
9
9
  import {
10
10
  requireAuth
11
- } from "./chunk-2P35S2C3.js";
11
+ } from "./chunk-FIMJZAS4.js";
12
12
  import {
13
13
  EXIT,
14
14
  fatalError,
15
15
  outputJSON,
16
16
  success
17
- } from "./chunk-EYNDY7RB.js";
17
+ } from "./chunk-NO4FIFMS.js";
18
18
 
19
19
  // src/commands/store/order-update.ts
20
20
  var VALID_STATUSES = ["preparing", "ready", "delivered"];
@@ -15,7 +15,7 @@ import {
15
15
  success,
16
16
  termWidth,
17
17
  warn
18
- } from "./chunk-EYNDY7RB.js";
18
+ } from "./chunk-NO4FIFMS.js";
19
19
  export {
20
20
  EXIT,
21
21
  fatalError,
@@ -5,14 +5,14 @@ import {
5
5
  monthEnd,
6
6
  monthStart,
7
7
  todayISO
8
- } from "./chunk-FFBG6RU4.js";
8
+ } from "./chunk-T63VQXNM.js";
9
9
  import {
10
10
  HisaaboApiError,
11
11
  HisaaboClient
12
- } from "./chunk-FTOBDKMO.js";
12
+ } from "./chunk-4MEL44QX.js";
13
13
  import {
14
14
  requireAuth
15
- } from "./chunk-2P35S2C3.js";
15
+ } from "./chunk-FIMJZAS4.js";
16
16
  import {
17
17
  EXIT,
18
18
  fatalError,
@@ -21,7 +21,7 @@ import {
21
21
  outputJSON,
22
22
  outputTSV,
23
23
  outputTable
24
- } from "./chunk-EYNDY7RB.js";
24
+ } from "./chunk-NO4FIFMS.js";
25
25
 
26
26
  // src/commands/dashboard/payment-modes.ts
27
27
  import chalk from "chalk";
@@ -6,21 +6,21 @@ import {
6
6
  monthEnd,
7
7
  monthStart,
8
8
  todayISO
9
- } from "./chunk-FFBG6RU4.js";
9
+ } from "./chunk-T63VQXNM.js";
10
10
  import {
11
11
  HisaaboApiError,
12
12
  HisaaboClient
13
- } from "./chunk-FTOBDKMO.js";
13
+ } from "./chunk-4MEL44QX.js";
14
14
  import {
15
15
  requireAuth
16
- } from "./chunk-2P35S2C3.js";
16
+ } from "./chunk-FIMJZAS4.js";
17
17
  import {
18
18
  EXIT,
19
19
  fatalError,
20
20
  hasColor,
21
21
  outputJSON,
22
22
  termWidth
23
- } from "./chunk-EYNDY7RB.js";
23
+ } from "./chunk-NO4FIFMS.js";
24
24
 
25
25
  // src/commands/dashboard/profit-loss.ts
26
26
  import chalk from "chalk";
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  formatAmount
4
- } from "./chunk-FFBG6RU4.js";
4
+ } from "./chunk-T63VQXNM.js";
5
5
  import {
6
6
  HisaaboApiError,
7
7
  HisaaboClient
8
- } from "./chunk-FTOBDKMO.js";
8
+ } from "./chunk-4MEL44QX.js";
9
9
  import {
10
10
  requireAuth
11
- } from "./chunk-2P35S2C3.js";
11
+ } from "./chunk-FIMJZAS4.js";
12
12
  import {
13
13
  EXIT,
14
14
  fatalError,
@@ -18,7 +18,7 @@ import {
18
18
  outputTSV,
19
19
  outputTable,
20
20
  termWidth
21
- } from "./chunk-EYNDY7RB.js";
21
+ } from "./chunk-NO4FIFMS.js";
22
22
 
23
23
  // src/commands/dashboard/receivables-aging.ts
24
24
  import chalk from "chalk";
@@ -2,16 +2,16 @@
2
2
  import {
3
3
  HisaaboApiError,
4
4
  HisaaboClient
5
- } from "./chunk-FTOBDKMO.js";
5
+ } from "./chunk-4MEL44QX.js";
6
6
  import {
7
7
  requireAuth
8
- } from "./chunk-2P35S2C3.js";
8
+ } from "./chunk-FIMJZAS4.js";
9
9
  import {
10
10
  EXIT,
11
11
  fatalError,
12
12
  outputJSON,
13
13
  success
14
- } from "./chunk-EYNDY7RB.js";
14
+ } from "./chunk-NO4FIFMS.js";
15
15
 
16
16
  // src/commands/tenant/remove.ts
17
17
  import * as readline from "readline";
@@ -0,0 +1,40 @@
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
+ outputJSON,
13
+ success
14
+ } from "./chunk-NO4FIFMS.js";
15
+
16
+ // src/commands/session/revoke.ts
17
+ async function revokeSessionCommand(sessionId, opts) {
18
+ const cfg = requireAuth();
19
+ const client = new HisaaboClient(cfg);
20
+ try {
21
+ const result = await client.auth.revokeSession({ sessionId });
22
+ if (opts.json) {
23
+ outputJSON(result);
24
+ return;
25
+ }
26
+ success("Session revoked successfully.");
27
+ } catch (e) {
28
+ if (e instanceof HisaaboApiError) {
29
+ const err = e.hisaaboError;
30
+ if (err.code === "not_found") fatalError(`Session not found: ${sessionId}`, EXIT.NOT_FOUND);
31
+ if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
32
+ if (err.code === "forbidden") fatalError(err.message, EXIT.FORBIDDEN);
33
+ if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
34
+ }
35
+ fatalError(String(e instanceof Error ? e.message : e));
36
+ }
37
+ }
38
+ export {
39
+ revokeSessionCommand
40
+ };
@@ -2,16 +2,16 @@
2
2
  import {
3
3
  HisaaboApiError,
4
4
  HisaaboClient
5
- } from "./chunk-FTOBDKMO.js";
5
+ } from "./chunk-4MEL44QX.js";
6
6
  import {
7
7
  requireAuth
8
- } from "./chunk-2P35S2C3.js";
8
+ } from "./chunk-FIMJZAS4.js";
9
9
  import {
10
10
  EXIT,
11
11
  fatalError,
12
12
  outputJSON,
13
13
  success
14
- } from "./chunk-EYNDY7RB.js";
14
+ } from "./chunk-NO4FIFMS.js";
15
15
 
16
16
  // src/commands/api-key/revoke.ts
17
17
  import * as readline from "readline";
@@ -0,0 +1,33 @@
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
+ success
13
+ } from "./chunk-NO4FIFMS.js";
14
+
15
+ // src/commands/session/revoke-all.ts
16
+ async function revokeAllSessionsCommand() {
17
+ const cfg = requireAuth();
18
+ const client = new HisaaboClient(cfg);
19
+ try {
20
+ await client.auth.logoutAll();
21
+ success("Signed out from all devices.");
22
+ } catch (e) {
23
+ if (e instanceof HisaaboApiError) {
24
+ const err = e.hisaaboError;
25
+ if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
26
+ if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
27
+ }
28
+ fatalError(String(e instanceof Error ? e.message : e));
29
+ }
30
+ }
31
+ export {
32
+ revokeAllSessionsCommand
33
+ };