@hisaabo/cli 0.1.0 → 0.3.2
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 +332 -0
- package/dist/bin/audit-trail-2YGXGUXW.js +78 -0
- package/dist/bin/categories-P5VFWD5F.js +47 -0
- package/dist/bin/check-slug-4TMOTWUJ.js +65 -0
- package/dist/bin/chunk-2P35S2C3.js +46 -0
- package/dist/bin/chunk-EYNDY7RB.js +175 -0
- package/dist/bin/chunk-FFBG6RU4.js +156 -0
- package/dist/bin/chunk-FTOBDKMO.js +804 -0
- package/dist/bin/client-QNJ2H5CW.js +11 -0
- package/dist/bin/collection-efficiency-WMKEGS6U.js +165 -0
- package/dist/bin/config-UKVQYPPR.js +18 -0
- package/dist/bin/create-Y22FAVOW.js +83 -0
- package/dist/bin/default-account-SA56M66A.js +58 -0
- package/dist/bin/expenses-VZAOLYUW.js +89 -0
- package/dist/bin/export-QZ6WT6PJ.js +59 -0
- package/dist/bin/factory-2DCU3B5T.js +483 -0
- package/dist/bin/get-6UYP6UVD.js +71 -0
- package/dist/bin/get-EXL44I2X.js +66 -0
- package/dist/bin/hisaabo.js +2029 -1450
- package/dist/bin/invite-O26SAL72.js +53 -0
- package/dist/bin/invoice-breakdown-XEATXVMR.js +97 -0
- package/dist/bin/items-3U5USBVG.js +62 -0
- package/dist/bin/items-toggle-YEKMI2CM.js +46 -0
- package/dist/bin/list-FX2C3NCL.js +46 -0
- package/dist/bin/list-VBAHY72W.js +79 -0
- package/dist/bin/members-5FPRUAB6.js +55 -0
- package/dist/bin/monthly-comparison-JEJ3TTY2.js +176 -0
- package/dist/bin/order-cancel-XI2LKYXV.js +55 -0
- package/dist/bin/order-confirm-HUFCU6MO.js +53 -0
- package/dist/bin/order-get-NSDMPUZR.js +88 -0
- package/dist/bin/order-update-C7QYSD5R.js +60 -0
- package/dist/bin/output-QFLEKG5W.js +35 -0
- package/dist/bin/payment-modes-WI3AWSES.js +126 -0
- package/dist/bin/profit-loss-5RIEOBKP.js +135 -0
- package/dist/bin/receivables-aging-L6DIQCNE.js +161 -0
- package/dist/bin/remove-M2B4TZ37.js +52 -0
- package/dist/bin/revoke-H3V2GNCD.js +52 -0
- package/dist/bin/sales-trend-TICB3KGF.js +71 -0
- package/dist/bin/sequence-XUD6FAKY.js +66 -0
- package/dist/bin/store-UQ2DDQ5I.js +82 -0
- package/dist/bin/summary-BPNFC7I2.js +113 -0
- package/dist/bin/top-customers-WGGJWKCN.js +81 -0
- package/dist/bin/top-items-C7ZDDJMR.js +84 -0
- package/dist/bin/top-outstanding-MOGWJIQS.js +64 -0
- package/dist/bin/unpaid-invoices-ZUPNMQJP.js +65 -0
- package/dist/bin/untracked-BCJEVDW4.js +67 -0
- package/dist/bin/update-HIU4PANX.js +54 -0
- package/dist/bin/update-IG565YIN.js +61 -0
- package/dist/bin/update-PVLAX7T3.js +57 -0
- package/dist/bin/update-role-Q4ZYJRYT.js +45 -0
- package/dist/bin/update-settings-XPC6L5WM.js +56 -0
- package/package.json +6 -1
- package/src/bin/hisaabo.ts +42 -933
- package/src/bin/registrars/api-key.ts +44 -0
- package/src/bin/registrars/auth.ts +153 -0
- package/src/bin/registrars/automated-invoice.ts +167 -0
- package/src/bin/registrars/bank.ts +90 -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/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 +55 -0
- package/src/client.ts +495 -4
- 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/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/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/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/update-role.ts +41 -0
package/src/client.ts
CHANGED
|
@@ -157,6 +157,18 @@ export class HisaaboClient {
|
|
|
157
157
|
me() {
|
|
158
158
|
return c.query<AuthUser>("auth.me");
|
|
159
159
|
},
|
|
160
|
+
completeProfile(input: { name: string }) {
|
|
161
|
+
return c.mutate<any>("auth.completeProfile", input);
|
|
162
|
+
},
|
|
163
|
+
logoutAll() {
|
|
164
|
+
return c.mutate<any>("auth.logoutAll", {});
|
|
165
|
+
},
|
|
166
|
+
register(input: any) {
|
|
167
|
+
return c.mutate<any>("auth.register", input);
|
|
168
|
+
},
|
|
169
|
+
updateName(input: { name: string }) {
|
|
170
|
+
return c.mutate<any>("auth.updateName", input);
|
|
171
|
+
},
|
|
160
172
|
};
|
|
161
173
|
}
|
|
162
174
|
|
|
@@ -169,7 +181,22 @@ export class HisaaboClient {
|
|
|
169
181
|
return c.query<BusinessSummary[]>("business.list");
|
|
170
182
|
},
|
|
171
183
|
get() {
|
|
172
|
-
return c.query<BusinessDetail>("business.
|
|
184
|
+
return c.query<BusinessDetail>("business.getById");
|
|
185
|
+
},
|
|
186
|
+
create(input: any) {
|
|
187
|
+
return c.mutate<any>("business.create", input);
|
|
188
|
+
},
|
|
189
|
+
update(input: any) {
|
|
190
|
+
return c.mutate<any>("business.update", input);
|
|
191
|
+
},
|
|
192
|
+
updateSequenceNumber(input: any) {
|
|
193
|
+
return c.mutate<any>("business.updateSequenceNumber", input);
|
|
194
|
+
},
|
|
195
|
+
auditTrail(input?: { page?: number; limit?: number }) {
|
|
196
|
+
return c.query<any>("business.auditTrail", input);
|
|
197
|
+
},
|
|
198
|
+
exportData() {
|
|
199
|
+
return c.mutate<any>("business.exportData", {});
|
|
173
200
|
},
|
|
174
201
|
};
|
|
175
202
|
}
|
|
@@ -183,11 +210,14 @@ export class HisaaboClient {
|
|
|
183
210
|
return c.query<PaginatedResult<InvoiceSummary>>("invoice.list", input);
|
|
184
211
|
},
|
|
185
212
|
get(id: string) {
|
|
186
|
-
return c.query<InvoiceDetail>("invoice.
|
|
213
|
+
return c.query<InvoiceDetail>("invoice.getById", { id });
|
|
187
214
|
},
|
|
188
215
|
create(input: InvoiceCreateInput) {
|
|
189
216
|
return c.mutate<InvoiceDetail>("invoice.create", input);
|
|
190
217
|
},
|
|
218
|
+
update(input: any) {
|
|
219
|
+
return c.mutate<any>("invoice.update", input);
|
|
220
|
+
},
|
|
191
221
|
updateStatus(id: string, status: InvoiceStatus) {
|
|
192
222
|
return c.mutate<InvoiceSummary>("invoice.updateStatus", { id, status });
|
|
193
223
|
},
|
|
@@ -206,7 +236,7 @@ export class HisaaboClient {
|
|
|
206
236
|
return c.query<PaginatedResult<PartySummary>>("party.list", input);
|
|
207
237
|
},
|
|
208
238
|
get(id: string) {
|
|
209
|
-
return c.query<PartyDetail>("party.
|
|
239
|
+
return c.query<PartyDetail>("party.getById", { id });
|
|
210
240
|
},
|
|
211
241
|
create(input: PartyCreateInput) {
|
|
212
242
|
return c.mutate<PartySummary>("party.create", input);
|
|
@@ -220,6 +250,18 @@ export class HisaaboClient {
|
|
|
220
250
|
ledger(partyId: string, input?: LedgerInput) {
|
|
221
251
|
return c.query<LedgerResult>("party.ledger", { partyId, ...input });
|
|
222
252
|
},
|
|
253
|
+
ledgerReport(input: any) {
|
|
254
|
+
return c.query<any>("party.ledgerReport", input);
|
|
255
|
+
},
|
|
256
|
+
getStats(input: any) {
|
|
257
|
+
return c.query<any>("party.getStats", input);
|
|
258
|
+
},
|
|
259
|
+
topItems(input: any) {
|
|
260
|
+
return c.query<any>("party.topItems", input);
|
|
261
|
+
},
|
|
262
|
+
merge(input: any) {
|
|
263
|
+
return c.mutate<any>("party.merge", input);
|
|
264
|
+
},
|
|
223
265
|
};
|
|
224
266
|
}
|
|
225
267
|
|
|
@@ -232,7 +274,7 @@ export class HisaaboClient {
|
|
|
232
274
|
return c.query<PaginatedResult<ItemSummary>>("item.list", input);
|
|
233
275
|
},
|
|
234
276
|
get(id: string) {
|
|
235
|
-
return c.query<ItemDetail>("item.
|
|
277
|
+
return c.query<ItemDetail>("item.getById", { id });
|
|
236
278
|
},
|
|
237
279
|
create(input: ItemCreateInput) {
|
|
238
280
|
return c.mutate<ItemSummary>("item.create", input);
|
|
@@ -249,6 +291,42 @@ export class HisaaboClient {
|
|
|
249
291
|
categories() {
|
|
250
292
|
return c.query<string[]>("item.categories");
|
|
251
293
|
},
|
|
294
|
+
createVariant(input: any) {
|
|
295
|
+
return c.mutate<any>("item.createVariant", input);
|
|
296
|
+
},
|
|
297
|
+
updateVariant(input: any) {
|
|
298
|
+
return c.mutate<any>("item.updateVariant", input);
|
|
299
|
+
},
|
|
300
|
+
deleteVariant(input: any) {
|
|
301
|
+
return c.mutate<any>("item.deleteVariant", input);
|
|
302
|
+
},
|
|
303
|
+
listVariants(input: any) {
|
|
304
|
+
return c.query<any>("item.listVariants", input);
|
|
305
|
+
},
|
|
306
|
+
merge(input: any) {
|
|
307
|
+
return c.mutate<any>("item.merge", input);
|
|
308
|
+
},
|
|
309
|
+
switchBaseUnit(input: any) {
|
|
310
|
+
return c.mutate<any>("item.switchBaseUnit", input);
|
|
311
|
+
},
|
|
312
|
+
renameUnit(input: any) {
|
|
313
|
+
return c.mutate<any>("item.renameUnit", input);
|
|
314
|
+
},
|
|
315
|
+
stockAdjustmentHistory(input: any) {
|
|
316
|
+
return c.query<any>("item.stockAdjustmentHistory", input);
|
|
317
|
+
},
|
|
318
|
+
lowStockCount() {
|
|
319
|
+
return c.query<any>("item.lowStockCount");
|
|
320
|
+
},
|
|
321
|
+
priceHistory(input: any) {
|
|
322
|
+
return c.query<any>("item.priceHistory", input);
|
|
323
|
+
},
|
|
324
|
+
salesStats(input: any) {
|
|
325
|
+
return c.query<any>("item.salesStats", input);
|
|
326
|
+
},
|
|
327
|
+
stockMovements(input: any) {
|
|
328
|
+
return c.query<any>("item.stockMovements", input);
|
|
329
|
+
},
|
|
252
330
|
};
|
|
253
331
|
}
|
|
254
332
|
|
|
@@ -272,6 +350,18 @@ export class HisaaboClient {
|
|
|
272
350
|
delete(id: string) {
|
|
273
351
|
return c.mutate<{ success: boolean }>("payment.delete", { id });
|
|
274
352
|
},
|
|
353
|
+
unpaidInvoices(input: any) {
|
|
354
|
+
return c.query<any>("payment.unpaidInvoices", input);
|
|
355
|
+
},
|
|
356
|
+
untrackedPayments(input: any) {
|
|
357
|
+
return c.query<any>("payment.untrackedPayments", input);
|
|
358
|
+
},
|
|
359
|
+
defaultAccount(input?: any) {
|
|
360
|
+
return c.query<any>("payment.defaultAccount", input);
|
|
361
|
+
},
|
|
362
|
+
assignAccount(input: any) {
|
|
363
|
+
return c.mutate<any>("payment.assignAccount", input);
|
|
364
|
+
},
|
|
275
365
|
};
|
|
276
366
|
}
|
|
277
367
|
|
|
@@ -306,6 +396,42 @@ export class HisaaboClient {
|
|
|
306
396
|
summary(input?: DashboardInput) {
|
|
307
397
|
return c.query<DashboardSummary>("dashboard.summary", input);
|
|
308
398
|
},
|
|
399
|
+
salesTrend(input: { months?: number; fromDate?: string; toDate?: string; granularity?: string }) {
|
|
400
|
+
return c.query<any>("dashboard.salesTrend", input);
|
|
401
|
+
},
|
|
402
|
+
topOutstanding(input?: { limit?: number }) {
|
|
403
|
+
return c.query<any>("dashboard.topOutstanding", input);
|
|
404
|
+
},
|
|
405
|
+
topCustomers(input?: { limit?: number; fromDate?: string; toDate?: string }) {
|
|
406
|
+
return c.query<any>("dashboard.topCustomers", input);
|
|
407
|
+
},
|
|
408
|
+
topSellingItems(input?: { limit?: number; itemType?: string; fromDate?: string; toDate?: string }) {
|
|
409
|
+
return c.query<any>("dashboard.topSellingItems", input);
|
|
410
|
+
},
|
|
411
|
+
expensesByCategory(input?: { fromDate?: string; toDate?: string }) {
|
|
412
|
+
return c.query<any>("dashboard.expensesByCategory", input);
|
|
413
|
+
},
|
|
414
|
+
invoiceStatusBreakdown(input?: { fromDate?: string; toDate?: string }) {
|
|
415
|
+
return c.query<any>("dashboard.invoiceStatusBreakdown", input);
|
|
416
|
+
},
|
|
417
|
+
profitAndLoss(input?: { fromDate?: string; toDate?: string }) {
|
|
418
|
+
return c.query<any>("dashboard.profitAndLoss", input);
|
|
419
|
+
},
|
|
420
|
+
receivablesAging() {
|
|
421
|
+
return c.query<any>("dashboard.receivablesAging");
|
|
422
|
+
},
|
|
423
|
+
paymentModeBreakdown(input?: { fromDate?: string; toDate?: string }) {
|
|
424
|
+
return c.query<any>("dashboard.paymentModeBreakdown", input);
|
|
425
|
+
},
|
|
426
|
+
collectionEfficiency(input?: { fromDate?: string; toDate?: string }) {
|
|
427
|
+
return c.query<any>("dashboard.collectionEfficiency", input);
|
|
428
|
+
},
|
|
429
|
+
monthlyComparison() {
|
|
430
|
+
return c.query<any>("dashboard.monthlyComparison");
|
|
431
|
+
},
|
|
432
|
+
shippingSummary(input?: { fromDate?: string; toDate?: string }) {
|
|
433
|
+
return c.query<any>("dashboard.shippingSummary", input);
|
|
434
|
+
},
|
|
309
435
|
};
|
|
310
436
|
}
|
|
311
437
|
|
|
@@ -407,6 +533,18 @@ export class HisaaboClient {
|
|
|
407
533
|
paymentSummary(input: PaymentSummaryInput) {
|
|
408
534
|
return c.query<PaymentSummaryResult>("reports.paymentSummary", input);
|
|
409
535
|
},
|
|
536
|
+
salesRegister(input: { fromDate: string; toDate: string; partyId?: string }) {
|
|
537
|
+
return c.query<any>("reports.salesRegister", input);
|
|
538
|
+
},
|
|
539
|
+
purchaseRegister(input: { fromDate: string; toDate: string; partyId?: string }) {
|
|
540
|
+
return c.query<any>("reports.purchaseRegister", input);
|
|
541
|
+
},
|
|
542
|
+
cashFlowForecast(input?: Record<string, unknown>) {
|
|
543
|
+
return c.query<any>("reports.cashFlowForecast", input ?? {});
|
|
544
|
+
},
|
|
545
|
+
collectionEfficiency(input: { fromDate: string; toDate: string }) {
|
|
546
|
+
return c.query<any>("reports.collectionEfficiency", input);
|
|
547
|
+
},
|
|
410
548
|
};
|
|
411
549
|
}
|
|
412
550
|
|
|
@@ -430,6 +568,21 @@ export class HisaaboClient {
|
|
|
430
568
|
updateOrder(input: { orderId: string; status: "preparing" | "ready" | "delivered" }) {
|
|
431
569
|
return c.mutate<{ success: boolean; status: string }>("store.updateOrderStatus", input);
|
|
432
570
|
},
|
|
571
|
+
confirmOrder(input: any) {
|
|
572
|
+
return c.mutate<any>("store.confirmOrder", input);
|
|
573
|
+
},
|
|
574
|
+
cancelOrder(input: any) {
|
|
575
|
+
return c.mutate<any>("store.cancelOrder", input);
|
|
576
|
+
},
|
|
577
|
+
checkSlug(input: any) {
|
|
578
|
+
return c.query<any>("store.checkSlug", input);
|
|
579
|
+
},
|
|
580
|
+
listStoreItems(input: any) {
|
|
581
|
+
return c.query<any>("store.listStoreItems", input);
|
|
582
|
+
},
|
|
583
|
+
bulkToggleItems(input: any) {
|
|
584
|
+
return c.mutate<any>("store.bulkToggleItems", input);
|
|
585
|
+
},
|
|
433
586
|
};
|
|
434
587
|
}
|
|
435
588
|
|
|
@@ -459,6 +612,262 @@ export class HisaaboClient {
|
|
|
459
612
|
};
|
|
460
613
|
}
|
|
461
614
|
|
|
615
|
+
// ── Tenant ───────────────────────────────────────────────────
|
|
616
|
+
|
|
617
|
+
get tenant() {
|
|
618
|
+
const c = this;
|
|
619
|
+
return {
|
|
620
|
+
list() {
|
|
621
|
+
return c.query<any>("tenant.list");
|
|
622
|
+
},
|
|
623
|
+
select(input: any) {
|
|
624
|
+
return c.mutate<any>("tenant.select", input);
|
|
625
|
+
},
|
|
626
|
+
members() {
|
|
627
|
+
return c.query<any>("tenant.members");
|
|
628
|
+
},
|
|
629
|
+
inviteMember(input: any) {
|
|
630
|
+
return c.mutate<any>("tenant.inviteMember", input);
|
|
631
|
+
},
|
|
632
|
+
removeMember(input: any) {
|
|
633
|
+
return c.mutate<any>("tenant.removeMember", input);
|
|
634
|
+
},
|
|
635
|
+
updateMemberRole(input: any) {
|
|
636
|
+
return c.mutate<any>("tenant.updateMemberRole", input);
|
|
637
|
+
},
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
// ── Document ──────────────────────────────────────────────────
|
|
642
|
+
|
|
643
|
+
get document() {
|
|
644
|
+
const c = this;
|
|
645
|
+
return {
|
|
646
|
+
convert(input: any) {
|
|
647
|
+
return c.mutate<any>("document.convert", input);
|
|
648
|
+
},
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
// ── Quotation ─────────────────────────────────────────────────
|
|
653
|
+
|
|
654
|
+
get quotation() {
|
|
655
|
+
const c = this;
|
|
656
|
+
return {
|
|
657
|
+
list(input: any) {
|
|
658
|
+
return c.query<any>("quotation.list", input);
|
|
659
|
+
},
|
|
660
|
+
getById(input: any) {
|
|
661
|
+
return c.query<any>("quotation.getById", input);
|
|
662
|
+
},
|
|
663
|
+
create(input: any) {
|
|
664
|
+
return c.mutate<any>("quotation.create", input);
|
|
665
|
+
},
|
|
666
|
+
updateStatus(input: any) {
|
|
667
|
+
return c.mutate<any>("quotation.updateStatus", input);
|
|
668
|
+
},
|
|
669
|
+
delete(input: any) {
|
|
670
|
+
return c.mutate<any>("quotation.delete", input);
|
|
671
|
+
},
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
// ── Credit Note ───────────────────────────────────────────────
|
|
676
|
+
|
|
677
|
+
get creditNote() {
|
|
678
|
+
const c = this;
|
|
679
|
+
return {
|
|
680
|
+
list(input: any) {
|
|
681
|
+
return c.query<any>("creditNote.list", input);
|
|
682
|
+
},
|
|
683
|
+
getById(input: any) {
|
|
684
|
+
return c.query<any>("creditNote.getById", input);
|
|
685
|
+
},
|
|
686
|
+
create(input: any) {
|
|
687
|
+
return c.mutate<any>("creditNote.create", input);
|
|
688
|
+
},
|
|
689
|
+
updateStatus(input: any) {
|
|
690
|
+
return c.mutate<any>("creditNote.updateStatus", input);
|
|
691
|
+
},
|
|
692
|
+
delete(input: any) {
|
|
693
|
+
return c.mutate<any>("creditNote.delete", input);
|
|
694
|
+
},
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
// ── Debit Note ────────────────────────────────────────────────
|
|
699
|
+
|
|
700
|
+
get debitNote() {
|
|
701
|
+
const c = this;
|
|
702
|
+
return {
|
|
703
|
+
list(input: any) {
|
|
704
|
+
return c.query<any>("debitNote.list", input);
|
|
705
|
+
},
|
|
706
|
+
getById(input: any) {
|
|
707
|
+
return c.query<any>("debitNote.getById", input);
|
|
708
|
+
},
|
|
709
|
+
create(input: any) {
|
|
710
|
+
return c.mutate<any>("debitNote.create", input);
|
|
711
|
+
},
|
|
712
|
+
updateStatus(input: any) {
|
|
713
|
+
return c.mutate<any>("debitNote.updateStatus", input);
|
|
714
|
+
},
|
|
715
|
+
delete(input: any) {
|
|
716
|
+
return c.mutate<any>("debitNote.delete", input);
|
|
717
|
+
},
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
// ── Delivery Challan ──────────────────────────────────────────
|
|
722
|
+
|
|
723
|
+
get deliveryChallan() {
|
|
724
|
+
const c = this;
|
|
725
|
+
return {
|
|
726
|
+
list(input: any) {
|
|
727
|
+
return c.query<any>("deliveryChallan.list", input);
|
|
728
|
+
},
|
|
729
|
+
getById(input: any) {
|
|
730
|
+
return c.query<any>("deliveryChallan.getById", input);
|
|
731
|
+
},
|
|
732
|
+
create(input: any) {
|
|
733
|
+
return c.mutate<any>("deliveryChallan.create", input);
|
|
734
|
+
},
|
|
735
|
+
updateStatus(input: any) {
|
|
736
|
+
return c.mutate<any>("deliveryChallan.updateStatus", input);
|
|
737
|
+
},
|
|
738
|
+
delete(input: any) {
|
|
739
|
+
return c.mutate<any>("deliveryChallan.delete", input);
|
|
740
|
+
},
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
// ── Proforma ──────────────────────────────────────────────────
|
|
745
|
+
|
|
746
|
+
get proforma() {
|
|
747
|
+
const c = this;
|
|
748
|
+
return {
|
|
749
|
+
list(input: any) {
|
|
750
|
+
return c.query<any>("proforma.list", input);
|
|
751
|
+
},
|
|
752
|
+
getById(input: any) {
|
|
753
|
+
return c.query<any>("proforma.getById", input);
|
|
754
|
+
},
|
|
755
|
+
create(input: any) {
|
|
756
|
+
return c.mutate<any>("proforma.create", input);
|
|
757
|
+
},
|
|
758
|
+
updateStatus(input: any) {
|
|
759
|
+
return c.mutate<any>("proforma.updateStatus", input);
|
|
760
|
+
},
|
|
761
|
+
delete(input: any) {
|
|
762
|
+
return c.mutate<any>("proforma.delete", input);
|
|
763
|
+
},
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
// ── Sales Return ──────────────────────────────────────────────
|
|
768
|
+
|
|
769
|
+
get salesReturn() {
|
|
770
|
+
const c = this;
|
|
771
|
+
return {
|
|
772
|
+
list(input: any) {
|
|
773
|
+
return c.query<any>("salesReturn.list", input);
|
|
774
|
+
},
|
|
775
|
+
getById(input: any) {
|
|
776
|
+
return c.query<any>("salesReturn.getById", input);
|
|
777
|
+
},
|
|
778
|
+
create(input: any) {
|
|
779
|
+
return c.mutate<any>("salesReturn.create", input);
|
|
780
|
+
},
|
|
781
|
+
updateStatus(input: any) {
|
|
782
|
+
return c.mutate<any>("salesReturn.updateStatus", input);
|
|
783
|
+
},
|
|
784
|
+
delete(input: any) {
|
|
785
|
+
return c.mutate<any>("salesReturn.delete", input);
|
|
786
|
+
},
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
// ── Purchase Return ───────────────────────────────────────────
|
|
791
|
+
|
|
792
|
+
get purchaseReturn() {
|
|
793
|
+
const c = this;
|
|
794
|
+
return {
|
|
795
|
+
list(input: any) {
|
|
796
|
+
return c.query<any>("purchaseReturn.list", input);
|
|
797
|
+
},
|
|
798
|
+
getById(input: any) {
|
|
799
|
+
return c.query<any>("purchaseReturn.getById", input);
|
|
800
|
+
},
|
|
801
|
+
create(input: any) {
|
|
802
|
+
return c.mutate<any>("purchaseReturn.create", input);
|
|
803
|
+
},
|
|
804
|
+
updateStatus(input: any) {
|
|
805
|
+
return c.mutate<any>("purchaseReturn.updateStatus", input);
|
|
806
|
+
},
|
|
807
|
+
delete(input: any) {
|
|
808
|
+
return c.mutate<any>("purchaseReturn.delete", input);
|
|
809
|
+
},
|
|
810
|
+
};
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
// ── Recurring Invoice ─────────────────────────────────────────
|
|
814
|
+
|
|
815
|
+
get recurringInvoice() {
|
|
816
|
+
const c = this;
|
|
817
|
+
return {
|
|
818
|
+
list(input: RecurringInvoiceListInput) {
|
|
819
|
+
return c.query<PaginatedResult<RecurringInvoiceSummary>>("recurringInvoice.list", input);
|
|
820
|
+
},
|
|
821
|
+
getById(id: string) {
|
|
822
|
+
return c.query<RecurringInvoiceDetail>("recurringInvoice.getById", { id });
|
|
823
|
+
},
|
|
824
|
+
create(input: RecurringInvoiceCreateInput) {
|
|
825
|
+
return c.mutate<RecurringInvoiceDetail>("recurringInvoice.create", input);
|
|
826
|
+
},
|
|
827
|
+
update(id: string, data: Partial<RecurringInvoiceCreateInput>) {
|
|
828
|
+
return c.mutate<RecurringInvoiceDetail>("recurringInvoice.update", { id, data });
|
|
829
|
+
},
|
|
830
|
+
delete(id: string) {
|
|
831
|
+
return c.mutate<{ success: boolean }>("recurringInvoice.delete", { id });
|
|
832
|
+
},
|
|
833
|
+
pause(id: string) {
|
|
834
|
+
return c.mutate<{ success: boolean }>("recurringInvoice.pause", { id });
|
|
835
|
+
},
|
|
836
|
+
resume(id: string) {
|
|
837
|
+
return c.mutate<{ success: boolean }>("recurringInvoice.resume", { id });
|
|
838
|
+
},
|
|
839
|
+
runNow(id: string) {
|
|
840
|
+
return c.mutate<{ success: boolean; invoiceId?: string }>("recurringInvoice.runNow", { id });
|
|
841
|
+
},
|
|
842
|
+
executionHistory(templateId: string, page?: number, limit?: number) {
|
|
843
|
+
return c.query<PaginatedResult<RecurringInvoiceExecution>>("recurringInvoice.executionHistory", { templateId, page, limit });
|
|
844
|
+
},
|
|
845
|
+
planUsage() {
|
|
846
|
+
return c.query<RecurringInvoicePlanUsage>("recurringInvoice.planUsage");
|
|
847
|
+
},
|
|
848
|
+
suggestions() {
|
|
849
|
+
return c.query<RecurringInvoiceSuggestion[]>("recurringInvoice.suggestions");
|
|
850
|
+
},
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
// ── API Key ───────────────────────────────────────────────────
|
|
855
|
+
|
|
856
|
+
get apiKey() {
|
|
857
|
+
const c = this;
|
|
858
|
+
return {
|
|
859
|
+
list() {
|
|
860
|
+
return c.query<any>("apiKey.list");
|
|
861
|
+
},
|
|
862
|
+
create(input: any) {
|
|
863
|
+
return c.mutate<any>("apiKey.create", input);
|
|
864
|
+
},
|
|
865
|
+
revoke(input: any) {
|
|
866
|
+
return c.mutate<any>("apiKey.revoke", input);
|
|
867
|
+
},
|
|
868
|
+
};
|
|
869
|
+
}
|
|
870
|
+
|
|
462
871
|
// ── Import ────────────────────────────────────────────────────
|
|
463
872
|
|
|
464
873
|
get import() {
|
|
@@ -1227,3 +1636,85 @@ export interface ImportResult {
|
|
|
1227
1636
|
export interface ImportItemsResult extends ImportResult {
|
|
1228
1637
|
created: number;
|
|
1229
1638
|
}
|
|
1639
|
+
|
|
1640
|
+
// ── Recurring Invoice types ───────────────────────────────────────────────
|
|
1641
|
+
|
|
1642
|
+
export type RecurringInvoiceStatus = "active" | "paused" | "completed" | "expired";
|
|
1643
|
+
export type RecurringInvoiceFrequency = "weekly" | "biweekly" | "monthly" | "quarterly" | "half_yearly" | "yearly" | "custom";
|
|
1644
|
+
|
|
1645
|
+
export interface RecurringInvoiceSummary {
|
|
1646
|
+
id: string;
|
|
1647
|
+
name: string;
|
|
1648
|
+
partyName: string;
|
|
1649
|
+
type: "sale" | "purchase";
|
|
1650
|
+
frequency: RecurringInvoiceFrequency;
|
|
1651
|
+
status: RecurringInvoiceStatus;
|
|
1652
|
+
nextRunDate: string | null;
|
|
1653
|
+
lastRunDate: string | null;
|
|
1654
|
+
totalRuns: number;
|
|
1655
|
+
maxRuns: number | null;
|
|
1656
|
+
startDate: string;
|
|
1657
|
+
endDate: string | null;
|
|
1658
|
+
createdAt: string;
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
export interface RecurringInvoiceLineItem {
|
|
1662
|
+
description: string;
|
|
1663
|
+
quantity: string;
|
|
1664
|
+
unitPrice: string;
|
|
1665
|
+
taxPercent?: string;
|
|
1666
|
+
discountPercent?: string;
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
export interface RecurringInvoiceDetail extends RecurringInvoiceSummary {
|
|
1670
|
+
partyId: string;
|
|
1671
|
+
customIntervalDays: number | null;
|
|
1672
|
+
lineItems: RecurringInvoiceLineItem[];
|
|
1673
|
+
notes: string | null;
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
export interface RecurringInvoiceListInput {
|
|
1677
|
+
status?: RecurringInvoiceStatus;
|
|
1678
|
+
page?: number;
|
|
1679
|
+
limit?: number;
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
export interface RecurringInvoiceCreateInput {
|
|
1683
|
+
partyId: string;
|
|
1684
|
+
name: string;
|
|
1685
|
+
type: "sale" | "purchase";
|
|
1686
|
+
frequency: RecurringInvoiceFrequency;
|
|
1687
|
+
customIntervalDays?: number;
|
|
1688
|
+
lineItems: Array<{
|
|
1689
|
+
description: string;
|
|
1690
|
+
quantity: string;
|
|
1691
|
+
unitPrice: string;
|
|
1692
|
+
taxPercent?: string;
|
|
1693
|
+
discountPercent?: string;
|
|
1694
|
+
}>;
|
|
1695
|
+
startDate: string;
|
|
1696
|
+
endDate?: string;
|
|
1697
|
+
maxRuns?: number;
|
|
1698
|
+
notes?: string;
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
export interface RecurringInvoiceExecution {
|
|
1702
|
+
id: string;
|
|
1703
|
+
invoiceNumber: string;
|
|
1704
|
+
status: string;
|
|
1705
|
+
errorMessage: string | null;
|
|
1706
|
+
executedAt: string;
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
export interface RecurringInvoicePlanUsage {
|
|
1710
|
+
runsThisMonth: number;
|
|
1711
|
+
totalTemplates: number;
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
export interface RecurringInvoiceSuggestion {
|
|
1715
|
+
partyId: string;
|
|
1716
|
+
partyName: string;
|
|
1717
|
+
frequency: string;
|
|
1718
|
+
confidence: number;
|
|
1719
|
+
reason: string;
|
|
1720
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { HisaaboClient, HisaaboApiError } from "../../client.js";
|
|
2
|
+
import { requireAuth } from "../../config.js";
|
|
3
|
+
import { fatalError, outputJSON, EXIT, hasColor } from "../../output.js";
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
|
|
6
|
+
interface ApiKeyCreateOpts {
|
|
7
|
+
name: string;
|
|
8
|
+
json?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export async function apiKeyCreateCommand(opts: ApiKeyCreateOpts): Promise<void> {
|
|
12
|
+
const cfg = requireAuth();
|
|
13
|
+
const client = new HisaaboClient(cfg);
|
|
14
|
+
|
|
15
|
+
if (!opts.name || opts.name.trim().length === 0) {
|
|
16
|
+
fatalError("--name is required.", EXIT.USAGE);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
const result = await client.apiKey.create({ name: opts.name.trim() });
|
|
21
|
+
|
|
22
|
+
if (opts.json) {
|
|
23
|
+
outputJSON(result);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const key = String(result?.key ?? result?.apiKey ?? result?.token ?? "");
|
|
28
|
+
const id = String(result?.id ?? "");
|
|
29
|
+
|
|
30
|
+
// Security banner — key is shown ONLY ONCE
|
|
31
|
+
if (hasColor()) {
|
|
32
|
+
process.stdout.write("\n");
|
|
33
|
+
process.stdout.write(chalk.bold.green(" ✓ API key created successfully!\n"));
|
|
34
|
+
process.stdout.write("\n");
|
|
35
|
+
process.stdout.write(chalk.bold.yellow(" ⚠ IMPORTANT: Copy this key now — it will NOT be shown again.\n"));
|
|
36
|
+
process.stdout.write("\n");
|
|
37
|
+
if (key) {
|
|
38
|
+
process.stdout.write(" " + chalk.bold("Your API key:") + "\n");
|
|
39
|
+
process.stdout.write("\n");
|
|
40
|
+
process.stdout.write(" " + chalk.cyan.bold(key) + "\n");
|
|
41
|
+
process.stdout.write("\n");
|
|
42
|
+
}
|
|
43
|
+
process.stdout.write(chalk.dim(" Use it with: hisaabo login --token <key>\n"));
|
|
44
|
+
process.stdout.write(chalk.dim(" Or set env: HISAABO_TOKEN=" + (key ? key : "<key>") + "\n"));
|
|
45
|
+
if (id) process.stdout.write(chalk.dim(`\n Key ID: ${id}\n`));
|
|
46
|
+
process.stdout.write("\n");
|
|
47
|
+
} else {
|
|
48
|
+
process.stdout.write("\nAPI key created successfully!\n\n");
|
|
49
|
+
process.stdout.write("IMPORTANT: Copy this key now — it will NOT be shown again.\n\n");
|
|
50
|
+
if (key) {
|
|
51
|
+
process.stdout.write(`Your API key:\n\n ${key}\n\n`);
|
|
52
|
+
process.stdout.write(`Usage: hisaabo login --token ${key}\n`);
|
|
53
|
+
}
|
|
54
|
+
if (id) process.stdout.write(`Key ID: ${id}\n`);
|
|
55
|
+
process.stdout.write("\n");
|
|
56
|
+
}
|
|
57
|
+
} catch (e) {
|
|
58
|
+
if (e instanceof HisaaboApiError) {
|
|
59
|
+
const err = e.hisaaboError;
|
|
60
|
+
if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
|
|
61
|
+
if (err.code === "forbidden") fatalError(err.message, EXIT.FORBIDDEN);
|
|
62
|
+
if (err.code === "validation_failed") {
|
|
63
|
+
const msgs = Object.entries(err.fields)
|
|
64
|
+
.map(([f, ms]) => ` ${f}: ${ms.join(", ")}`)
|
|
65
|
+
.join("\n");
|
|
66
|
+
fatalError(`Validation failed:\n${msgs}`, EXIT.VALIDATION);
|
|
67
|
+
}
|
|
68
|
+
if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
|
|
69
|
+
}
|
|
70
|
+
fatalError(String(e instanceof Error ? e.message : e));
|
|
71
|
+
}
|
|
72
|
+
}
|