@hisaabo/cli 0.7.5 → 0.8.6
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/LICENSE +31 -0
- package/README.md +9 -0
- package/dist/bin/{audit-trail-DLSSSM4T.js → audit-trail-IJ6SKACR.js} +2 -2
- package/dist/bin/{categories-63QR6WCV.js → categories-O6TODPAH.js} +2 -2
- package/dist/bin/{check-slug-NXO55WKH.js → check-slug-P7RFU6OP.js} +2 -2
- package/dist/bin/chunk-NO4FIFMS.js +0 -0
- package/dist/bin/{chunk-7MJDOL6B.js → chunk-QUITS2FE.js} +28 -0
- package/dist/bin/{chunk-M42SETRZ.js → chunk-WDN7RIE3.js} +23 -2
- package/dist/bin/chunk-ZPYC767N.js +0 -0
- package/dist/bin/{client-T32CIZA3.js → client-36JX5MR3.js} +1 -1
- package/dist/bin/{collection-efficiency-T6PWNTZO.js → collection-efficiency-DA5RWG3V.js} +2 -2
- package/dist/bin/{config-V4QFCONN.js → config-4LLNT4SH.js} +3 -1
- package/dist/bin/{create-NUKHDWLK.js → create-C5INBPQO.js} +2 -2
- package/dist/bin/{default-account-JWFPHMRF.js → default-account-2GMQ7ZA4.js} +2 -2
- package/dist/bin/{expenses-2UWUZVLI.js → expenses-S2YVA5UT.js} +2 -2
- package/dist/bin/{export-XSX7WQH7.js → export-YOOODNVX.js} +2 -2
- package/dist/bin/export-ZA43MLWO.js +191 -0
- package/dist/bin/{factory-BWOKRIP4.js → factory-6MUCSXTL.js} +2 -2
- package/dist/bin/{get-CHNTG3IM.js → get-GMQRROK2.js} +2 -2
- package/dist/bin/{get-ZSZ6SL3N.js → get-ZV3SC2VY.js} +2 -2
- package/dist/bin/hisaabo.js +100 -57
- package/dist/bin/import-UUHMLCKX.js +267 -0
- package/dist/bin/{invitations-H2SL3XAD.js → invitations-OVORTTMF.js} +2 -2
- package/dist/bin/{invite-EW73UIBE.js → invite-GGHBZY4U.js} +2 -2
- package/dist/bin/{invoice-breakdown-XP4QATCF.js → invoice-breakdown-32XXAZDP.js} +2 -2
- package/dist/bin/{items-DPD6EFTP.js → items-6NOIMH6B.js} +2 -2
- package/dist/bin/{items-toggle-R4OPSE4W.js → items-toggle-L6W6QKQD.js} +2 -2
- package/dist/bin/{list-PKHBE475.js → list-FC5JHKHD.js} +2 -2
- package/dist/bin/{list-KLEHBMQ2.js → list-OXAVDXH7.js} +2 -2
- package/dist/bin/{list-UR7OOJVF.js → list-RAR56EMQ.js} +2 -2
- package/dist/bin/{members-XA3TF4IQ.js → members-Y6XJVHHR.js} +2 -2
- package/dist/bin/{monthly-comparison-OLVS5HEY.js → monthly-comparison-IAUZ6SBJ.js} +2 -2
- package/dist/bin/{order-cancel-MXMJFFRR.js → order-cancel-QRTCNART.js} +2 -2
- package/dist/bin/{order-confirm-IXU45Q4L.js → order-confirm-LGQOMC4O.js} +2 -2
- package/dist/bin/{order-get-RDXMHLJ7.js → order-get-4XAQCRYV.js} +2 -2
- package/dist/bin/{order-update-KGIPBEJX.js → order-update-KZY4H2UR.js} +2 -2
- package/dist/bin/output-NUOL7KJW.js +0 -0
- package/dist/bin/{payment-modes-CZL35SVS.js → payment-modes-DY2ZEMK7.js} +2 -2
- package/dist/bin/{profit-loss-M332OSC5.js → profit-loss-5GJBG3PL.js} +2 -2
- package/dist/bin/{receivables-aging-OXRHGMBF.js → receivables-aging-6A7XJKDT.js} +2 -2
- package/dist/bin/{remove-I5HD2Y4K.js → remove-ZBX34TIQ.js} +2 -2
- package/dist/bin/{revoke-OC6AOMIZ.js → revoke-XDNOA2GJ.js} +2 -2
- package/dist/bin/{revoke-MFLWGCMP.js → revoke-ZTAMW2Q2.js} +2 -2
- package/dist/bin/{revoke-all-FSAPBB3P.js → revoke-all-365NRBOA.js} +2 -2
- package/dist/bin/{revoke-invitation-JXDPXTOW.js → revoke-invitation-PQH7XNYA.js} +2 -2
- package/dist/bin/{sales-trend-KK63WNDL.js → sales-trend-D6PQ7MHY.js} +2 -2
- package/dist/bin/{sequence-IQ4HUJ3W.js → sequence-KZWADVD7.js} +2 -2
- package/dist/bin/{store-6QT6HKG2.js → store-SVRZBUFO.js} +2 -2
- package/dist/bin/{summary-3FTF5B4A.js → summary-H6U7O5GJ.js} +2 -2
- package/dist/bin/{top-customers-HNYGXBQZ.js → top-customers-ATBN6RDI.js} +2 -2
- package/dist/bin/{top-items-JUDG3BVW.js → top-items-XXU6KYTC.js} +2 -2
- package/dist/bin/{top-outstanding-WK26ZNE5.js → top-outstanding-JTQNGGW4.js} +2 -2
- package/dist/bin/{unpaid-invoices-RYFIIIK7.js → unpaid-invoices-BTNQFWCH.js} +2 -2
- package/dist/bin/{untracked-FAFS3KCK.js → untracked-PAMEDJ6Y.js} +2 -2
- package/dist/bin/{update-5YSPXIWO.js → update-6ZMX2OYX.js} +2 -2
- package/dist/bin/{update-I46XLU77.js → update-EGHPFXLK.js} +2 -2
- package/dist/bin/{update-NAW2JWZS.js → update-EK4NJWU4.js} +2 -2
- package/dist/bin/{update-role-5GV42MSN.js → update-role-24PDTNFK.js} +2 -2
- package/dist/bin/{update-settings-KYSQDIEO.js → update-settings-AASI6WZX.js} +2 -2
- package/package.json +35 -9
- package/.turbo/turbo-build.log +0 -13
- package/.turbo/turbo-typecheck.log +0 -4
- package/CLI-UX-ARCHITECTURE.md +0 -1269
- package/src/auth.ts +0 -221
- package/src/bin/hisaabo.ts +0 -74
- package/src/bin/registrars/api-key.ts +0 -44
- package/src/bin/registrars/auth.ts +0 -222
- package/src/bin/registrars/automated-invoice.ts +0 -167
- package/src/bin/registrars/bank-recon.ts +0 -34
- package/src/bin/registrars/bank.ts +0 -124
- package/src/bin/registrars/business.ts +0 -120
- package/src/bin/registrars/dashboard.ts +0 -225
- package/src/bin/registrars/document.ts +0 -184
- package/src/bin/registrars/einvoice.ts +0 -46
- package/src/bin/registrars/ewb.ts +0 -37
- package/src/bin/registrars/expense.ts +0 -87
- package/src/bin/registrars/gst.ts +0 -57
- package/src/bin/registrars/import.ts +0 -49
- package/src/bin/registrars/invoice.ts +0 -117
- package/src/bin/registrars/itc.ts +0 -56
- package/src/bin/registrars/item.ts +0 -112
- package/src/bin/registrars/journal.ts +0 -47
- package/src/bin/registrars/party.ts +0 -81
- package/src/bin/registrars/payment.ts +0 -128
- package/src/bin/registrars/report.ts +0 -186
- package/src/bin/registrars/session.ts +0 -32
- package/src/bin/registrars/shipment.ts +0 -74
- package/src/bin/registrars/store.ts +0 -128
- package/src/bin/registrars/target.ts +0 -46
- package/src/bin/registrars/tenant.ts +0 -73
- package/src/client.ts +0 -2071
- package/src/commands/api-key/create.ts +0 -72
- package/src/commands/api-key/list.ts +0 -71
- package/src/commands/api-key/revoke.ts +0 -46
- package/src/commands/automated-invoice/create.ts +0 -85
- package/src/commands/automated-invoice/delete.ts +0 -42
- package/src/commands/automated-invoice/get.ts +0 -113
- package/src/commands/automated-invoice/history.ts +0 -65
- package/src/commands/automated-invoice/index.ts +0 -11
- package/src/commands/automated-invoice/list.ts +0 -91
- package/src/commands/automated-invoice/pause.ts +0 -29
- package/src/commands/automated-invoice/resume.ts +0 -29
- package/src/commands/automated-invoice/run-now.ts +0 -29
- package/src/commands/automated-invoice/suggestions.ts +0 -68
- package/src/commands/automated-invoice/update.ts +0 -54
- package/src/commands/automated-invoice/usage.ts +0 -68
- package/src/commands/bank/gateway-config.ts +0 -61
- package/src/commands/bank/index.ts +0 -244
- package/src/commands/bank/update-gateway.ts +0 -84
- package/src/commands/bank-recon/index.ts +0 -127
- package/src/commands/business/audit-trail.ts +0 -79
- package/src/commands/business/export.ts +0 -52
- package/src/commands/business/get.ts +0 -55
- package/src/commands/business/sequence.ts +0 -65
- package/src/commands/business/update.ts +0 -64
- package/src/commands/dashboard/collection-efficiency.ts +0 -164
- package/src/commands/dashboard/expenses.ts +0 -76
- package/src/commands/dashboard/invoice-breakdown.ts +0 -89
- package/src/commands/dashboard/monthly-comparison.ts +0 -193
- package/src/commands/dashboard/payment-modes.ts +0 -121
- package/src/commands/dashboard/profit-loss.ts +0 -146
- package/src/commands/dashboard/receivables-aging.ts +0 -169
- package/src/commands/dashboard/sales-trend.ts +0 -68
- package/src/commands/dashboard/summary.ts +0 -105
- package/src/commands/dashboard/top-customers.ts +0 -70
- package/src/commands/dashboard/top-items.ts +0 -74
- package/src/commands/dashboard/top-outstanding.ts +0 -61
- package/src/commands/dashboard.ts +0 -105
- package/src/commands/document/factory.ts +0 -590
- package/src/commands/einvoice/index.ts +0 -109
- package/src/commands/ewb/index.ts +0 -108
- package/src/commands/expense/categories.ts +0 -40
- package/src/commands/expense/create.ts +0 -51
- package/src/commands/expense/delete.ts +0 -45
- package/src/commands/expense/list.ts +0 -65
- package/src/commands/expense/update.ts +0 -58
- package/src/commands/gst/index.ts +0 -194
- package/src/commands/import/index.ts +0 -168
- package/src/commands/invoice/create.ts +0 -262
- package/src/commands/invoice/delete.ts +0 -44
- package/src/commands/invoice/get.ts +0 -113
- package/src/commands/invoice/list.ts +0 -126
- package/src/commands/invoice/pdf.ts +0 -75
- package/src/commands/invoice/status.ts +0 -41
- package/src/commands/itc/index.ts +0 -163
- package/src/commands/item/categories.ts +0 -40
- package/src/commands/item/create.ts +0 -98
- package/src/commands/item/delete.ts +0 -44
- package/src/commands/item/list.ts +0 -81
- package/src/commands/item/low-stock-count.ts +0 -32
- package/src/commands/item/merge.ts +0 -53
- package/src/commands/item/price-history.ts +0 -59
- package/src/commands/item/rename-unit.ts +0 -39
- package/src/commands/item/sales-stats.ts +0 -44
- package/src/commands/item/stock-history.ts +0 -70
- package/src/commands/item/stock.ts +0 -46
- package/src/commands/item/switch-base-unit.ts +0 -42
- package/src/commands/item/update.ts +0 -59
- package/src/commands/item/variants-create.ts +0 -58
- package/src/commands/item/variants-delete.ts +0 -47
- package/src/commands/item/variants-list.ts +0 -63
- package/src/commands/item/variants-update.ts +0 -61
- package/src/commands/journal/index.ts +0 -156
- package/src/commands/party/create.ts +0 -88
- package/src/commands/party/delete.ts +0 -44
- package/src/commands/party/get.ts +0 -42
- package/src/commands/party/ledger-report.ts +0 -81
- package/src/commands/party/ledger.ts +0 -63
- package/src/commands/party/list.ts +0 -69
- package/src/commands/party/merge.ts +0 -50
- package/src/commands/party/stats.ts +0 -40
- package/src/commands/party/top-items.ts +0 -57
- package/src/commands/party/update.ts +0 -65
- package/src/commands/payment/create.ts +0 -131
- package/src/commands/payment/default-account.ts +0 -56
- package/src/commands/payment/delete.ts +0 -46
- package/src/commands/payment/get.ts +0 -59
- package/src/commands/payment/list.ts +0 -66
- package/src/commands/payment/unpaid-invoices.ts +0 -69
- package/src/commands/payment/untracked.ts +0 -70
- package/src/commands/payment/update.ts +0 -54
- package/src/commands/report/index.ts +0 -736
- package/src/commands/session/list.ts +0 -91
- package/src/commands/session/revoke-all.ts +0 -20
- package/src/commands/session/revoke.ts +0 -32
- package/src/commands/shipment/index.ts +0 -170
- package/src/commands/store/check-slug.ts +0 -48
- package/src/commands/store/index.ts +0 -77
- package/src/commands/store/items-toggle.ts +0 -41
- package/src/commands/store/items.ts +0 -61
- package/src/commands/store/order-cancel.ts +0 -48
- package/src/commands/store/order-confirm.ts +0 -45
- package/src/commands/store/order-get.ts +0 -66
- package/src/commands/store/order-update.ts +0 -52
- package/src/commands/store/update-settings.ts +0 -52
- package/src/commands/target/index.ts +0 -118
- package/src/commands/tenant/invitations.ts +0 -62
- package/src/commands/tenant/invite.ts +0 -57
- package/src/commands/tenant/list.ts +0 -46
- package/src/commands/tenant/members.ts +0 -55
- package/src/commands/tenant/remove.ts +0 -47
- package/src/commands/tenant/revoke-invitation.ts +0 -32
- package/src/commands/tenant/update-role.ts +0 -41
- package/src/config.ts +0 -120
- package/src/error-handler.ts +0 -53
- package/src/format.ts +0 -181
- package/src/output.ts +0 -228
- package/src/spinner.ts +0 -39
- package/tsconfig.json +0 -22
- package/tsup.config.ts +0 -18
package/src/client.ts
DELETED
|
@@ -1,2071 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HisaaboClient — thin fetch wrapper over the tRPC HTTP API.
|
|
3
|
-
* CLI variant: adds x-client-type: "cli" header.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import superjson from "superjson";
|
|
7
|
-
|
|
8
|
-
export interface ClientConfig {
|
|
9
|
-
apiUrl: string;
|
|
10
|
-
token: string;
|
|
11
|
-
tenantId: string;
|
|
12
|
-
businessId: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// ── Structured error types ──────────────────────────────────────────────────
|
|
16
|
-
|
|
17
|
-
export type HisaaboError =
|
|
18
|
-
| { code: "unauthorized"; message: string }
|
|
19
|
-
| { code: "forbidden"; message: string }
|
|
20
|
-
| { code: "not_found"; resource: string }
|
|
21
|
-
| { code: "validation_failed"; fields: Record<string, string[]> }
|
|
22
|
-
| { code: "network_error"; message: string }
|
|
23
|
-
| { code: "rate_limited"; retryAfterMs: number; message: string }
|
|
24
|
-
| { code: "api_error"; message: string };
|
|
25
|
-
|
|
26
|
-
export class HisaaboApiError extends Error {
|
|
27
|
-
constructor(public readonly hisaaboError: HisaaboError) {
|
|
28
|
-
super(formatHisaaboError(hisaaboError));
|
|
29
|
-
this.name = "HisaaboApiError";
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function formatHisaaboError(err: HisaaboError): string {
|
|
34
|
-
switch (err.code) {
|
|
35
|
-
case "unauthorized":
|
|
36
|
-
return `Authentication required: ${err.message}`;
|
|
37
|
-
case "forbidden":
|
|
38
|
-
return `Permission denied: ${err.message}`;
|
|
39
|
-
case "not_found":
|
|
40
|
-
return `Not found: ${err.resource}`;
|
|
41
|
-
case "validation_failed":
|
|
42
|
-
return (
|
|
43
|
-
`Validation failed:\n` +
|
|
44
|
-
Object.entries(err.fields)
|
|
45
|
-
.map(([field, msgs]) => ` ${field}: ${msgs.join(", ")}`)
|
|
46
|
-
.join("\n")
|
|
47
|
-
);
|
|
48
|
-
case "rate_limited":
|
|
49
|
-
return `Rate limited: ${err.message}`;
|
|
50
|
-
case "network_error":
|
|
51
|
-
return `Network error: ${err.message}`;
|
|
52
|
-
case "api_error":
|
|
53
|
-
return `API error: ${err.message}`;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function normalizeTrpcError(raw: unknown): HisaaboError {
|
|
58
|
-
if (!raw || typeof raw !== "object") {
|
|
59
|
-
return { code: "api_error", message: "Unknown error from API" };
|
|
60
|
-
}
|
|
61
|
-
const err = raw as Record<string, unknown>;
|
|
62
|
-
const code = err["code"] as string | undefined;
|
|
63
|
-
const message = (err["message"] as string | undefined) ?? "Unknown error";
|
|
64
|
-
|
|
65
|
-
if (code === "UNAUTHORIZED") return { code: "unauthorized", message };
|
|
66
|
-
if (code === "FORBIDDEN") return { code: "forbidden", message };
|
|
67
|
-
if (code === "NOT_FOUND") return { code: "not_found", resource: message };
|
|
68
|
-
|
|
69
|
-
if (code === "BAD_REQUEST") {
|
|
70
|
-
const data = err["data"] as Record<string, unknown> | undefined;
|
|
71
|
-
const zodError = data?.["zodError"] as { fieldErrors?: Record<string, string[]> } | undefined;
|
|
72
|
-
if (zodError?.fieldErrors) {
|
|
73
|
-
return { code: "validation_failed", fields: zodError.fieldErrors };
|
|
74
|
-
}
|
|
75
|
-
return { code: "validation_failed", fields: { _: [message] } };
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return { code: "api_error", message };
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// ── HTTP client ────────────────────────────────────────────────────────────
|
|
82
|
-
|
|
83
|
-
export class HisaaboClient {
|
|
84
|
-
readonly apiUrl: string;
|
|
85
|
-
|
|
86
|
-
constructor(private readonly config: ClientConfig) {
|
|
87
|
-
this.apiUrl = config.apiUrl;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
private buildHeaders(): Record<string, string> {
|
|
91
|
-
return {
|
|
92
|
-
"Authorization": `Bearer ${this.config.token}`,
|
|
93
|
-
"x-business-id": this.config.businessId,
|
|
94
|
-
"x-tenant-id": this.config.tenantId,
|
|
95
|
-
"x-client-type": "cli",
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
private async unwrap<T>(res: Response): Promise<T> {
|
|
100
|
-
// Detect rate limiting before tRPC error parsing
|
|
101
|
-
if (res.status === 429) {
|
|
102
|
-
const retryAfter = res.headers.get("retry-after");
|
|
103
|
-
let retryMs = 60_000;
|
|
104
|
-
if (retryAfter) {
|
|
105
|
-
const parsed = Number(retryAfter);
|
|
106
|
-
if (Number.isFinite(parsed) && parsed > 0) {
|
|
107
|
-
retryMs = Math.min(parsed * 1000, 120_000); // cap at 2 minutes
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
throw new HisaaboApiError({
|
|
111
|
-
code: "rate_limited",
|
|
112
|
-
retryAfterMs: retryMs,
|
|
113
|
-
message: `Rate limited. Try again in ${Math.ceil(retryMs / 1000)}s.`,
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const body = await res.json() as unknown;
|
|
118
|
-
|
|
119
|
-
if (typeof body !== "object" || body === null) {
|
|
120
|
-
throw new HisaaboApiError({ code: "api_error", message: "Unexpected response format from API" });
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const envelope = body as Record<string, unknown>;
|
|
124
|
-
|
|
125
|
-
if (!res.ok || "error" in envelope) {
|
|
126
|
-
throw new HisaaboApiError(normalizeTrpcError(envelope["error"] ?? { code: "api_error", message: `HTTP ${res.status}` }));
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const result = (envelope["result"] as Record<string, unknown> | undefined);
|
|
130
|
-
if (!result) {
|
|
131
|
-
throw new HisaaboApiError({ code: "api_error", message: "Missing result in API response" });
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const data = result["data"] as unknown;
|
|
135
|
-
return superjson.deserialize(data as Parameters<typeof superjson.deserialize>[0]) as T;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
async query<T>(path: string, input?: unknown): Promise<T> {
|
|
139
|
-
const maxRetries = 2;
|
|
140
|
-
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
141
|
-
try {
|
|
142
|
-
const url = new URL(`${this.config.apiUrl}/api/trpc/${path}`);
|
|
143
|
-
if (input !== undefined) {
|
|
144
|
-
url.searchParams.set("input", JSON.stringify(superjson.serialize(input)));
|
|
145
|
-
}
|
|
146
|
-
const res = await fetch(url.toString(), { headers: this.buildHeaders() });
|
|
147
|
-
return await this.unwrap<T>(res);
|
|
148
|
-
} catch (e) {
|
|
149
|
-
// Auto-retry on rate limit for idempotent reads
|
|
150
|
-
if (e instanceof HisaaboApiError && e.hisaaboError.code === "rate_limited" && attempt < maxRetries) {
|
|
151
|
-
const waitMs = Math.min((e.hisaaboError as { retryAfterMs: number }).retryAfterMs, 10_000);
|
|
152
|
-
await new Promise((r) => setTimeout(r, waitMs));
|
|
153
|
-
continue;
|
|
154
|
-
}
|
|
155
|
-
if (e instanceof HisaaboApiError) throw e;
|
|
156
|
-
throw new HisaaboApiError({ code: "network_error", message: String(e instanceof Error ? e.message : e) });
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
throw new HisaaboApiError({ code: "api_error", message: "Max retries exceeded" });
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
async mutate<T>(path: string, input: unknown): Promise<T> {
|
|
163
|
-
try {
|
|
164
|
-
const res = await fetch(`${this.config.apiUrl}/api/trpc/${path}`, {
|
|
165
|
-
method: "POST",
|
|
166
|
-
headers: { ...this.buildHeaders(), "Content-Type": "application/json" },
|
|
167
|
-
body: JSON.stringify(superjson.serialize(input)),
|
|
168
|
-
});
|
|
169
|
-
return this.unwrap<T>(res);
|
|
170
|
-
} catch (e) {
|
|
171
|
-
if (e instanceof HisaaboApiError) throw e;
|
|
172
|
-
throw new HisaaboApiError({ code: "network_error", message: String(e instanceof Error ? e.message : e) });
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// ── Auth ──────────────────────────────────────────────────────
|
|
177
|
-
|
|
178
|
-
get auth() {
|
|
179
|
-
const c = this;
|
|
180
|
-
return {
|
|
181
|
-
login(input: { email: string; password: string }) {
|
|
182
|
-
return c.mutate<{ sessionId: string; user: AuthUser }>("auth.login", input);
|
|
183
|
-
},
|
|
184
|
-
logout() {
|
|
185
|
-
return c.mutate<{ success: boolean }>("auth.logout", {});
|
|
186
|
-
},
|
|
187
|
-
me() {
|
|
188
|
-
return c.query<AuthUser>("auth.me");
|
|
189
|
-
},
|
|
190
|
-
completeProfile(input: { name: string }) {
|
|
191
|
-
return c.mutate<any>("auth.completeProfile", input);
|
|
192
|
-
},
|
|
193
|
-
logoutAll() {
|
|
194
|
-
return c.mutate<any>("auth.logoutAll", {});
|
|
195
|
-
},
|
|
196
|
-
register(input: any) {
|
|
197
|
-
return c.mutate<any>("auth.register", input);
|
|
198
|
-
},
|
|
199
|
-
updateName(input: { name: string }) {
|
|
200
|
-
return c.mutate<any>("auth.updateName", input);
|
|
201
|
-
},
|
|
202
|
-
listSessions(input: { expired: boolean }) {
|
|
203
|
-
return c.query<any>("auth.listSessions", input);
|
|
204
|
-
},
|
|
205
|
-
revokeSession(input: { sessionId: string }) {
|
|
206
|
-
return c.mutate<any>("auth.revokeSession", input);
|
|
207
|
-
},
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// ── Business ──────────────────────────────────────────────────
|
|
212
|
-
|
|
213
|
-
get business() {
|
|
214
|
-
const c = this;
|
|
215
|
-
return {
|
|
216
|
-
list() {
|
|
217
|
-
return c.query<BusinessSummary[]>("business.list");
|
|
218
|
-
},
|
|
219
|
-
get() {
|
|
220
|
-
return c.query<BusinessDetail>("business.getById");
|
|
221
|
-
},
|
|
222
|
-
create(input: any) {
|
|
223
|
-
return c.mutate<any>("business.create", input);
|
|
224
|
-
},
|
|
225
|
-
update(input: any) {
|
|
226
|
-
return c.mutate<any>("business.update", input);
|
|
227
|
-
},
|
|
228
|
-
updateSequenceNumber(input: any) {
|
|
229
|
-
return c.mutate<any>("business.updateSequenceNumber", input);
|
|
230
|
-
},
|
|
231
|
-
auditTrail(input?: { page?: number; limit?: number }) {
|
|
232
|
-
return c.query<any>("business.auditTrail", input);
|
|
233
|
-
},
|
|
234
|
-
exportData() {
|
|
235
|
-
return c.mutate<any>("business.exportData", {});
|
|
236
|
-
},
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
// ── Invoice ───────────────────────────────────────────────────
|
|
241
|
-
|
|
242
|
-
get invoice() {
|
|
243
|
-
const c = this;
|
|
244
|
-
return {
|
|
245
|
-
list(input: InvoiceListInput) {
|
|
246
|
-
return c.query<PaginatedResult<InvoiceSummary>>("invoice.list", input);
|
|
247
|
-
},
|
|
248
|
-
get(id: string) {
|
|
249
|
-
return c.query<InvoiceDetail>("invoice.getById", { id });
|
|
250
|
-
},
|
|
251
|
-
create(input: InvoiceCreateInput) {
|
|
252
|
-
return c.mutate<InvoiceDetail>("invoice.create", input);
|
|
253
|
-
},
|
|
254
|
-
update(input: any) {
|
|
255
|
-
return c.mutate<any>("invoice.update", input);
|
|
256
|
-
},
|
|
257
|
-
updateStatus(id: string, status: InvoiceStatus) {
|
|
258
|
-
return c.mutate<InvoiceSummary>("invoice.updateStatus", { id, status });
|
|
259
|
-
},
|
|
260
|
-
delete(id: string) {
|
|
261
|
-
return c.mutate<{ success: boolean }>("invoice.delete", { id });
|
|
262
|
-
},
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
// ── Party ─────────────────────────────────────────────────────
|
|
267
|
-
|
|
268
|
-
get party() {
|
|
269
|
-
const c = this;
|
|
270
|
-
return {
|
|
271
|
-
list(input: PartyListInput) {
|
|
272
|
-
return c.query<PaginatedResult<PartySummary>>("party.list", input);
|
|
273
|
-
},
|
|
274
|
-
get(id: string) {
|
|
275
|
-
return c.query<PartyDetail>("party.getById", { id });
|
|
276
|
-
},
|
|
277
|
-
create(input: PartyCreateInput) {
|
|
278
|
-
return c.mutate<PartySummary>("party.create", input);
|
|
279
|
-
},
|
|
280
|
-
update(id: string, data: Partial<PartyCreateInput>) {
|
|
281
|
-
return c.mutate<PartyDetail>("party.update", { id, data });
|
|
282
|
-
},
|
|
283
|
-
delete(id: string) {
|
|
284
|
-
return c.mutate<{ success: boolean }>("party.delete", { id });
|
|
285
|
-
},
|
|
286
|
-
ledger(partyId: string, input?: LedgerInput) {
|
|
287
|
-
return c.query<LedgerResult>("party.ledger", { partyId, ...input });
|
|
288
|
-
},
|
|
289
|
-
ledgerReport(input: any) {
|
|
290
|
-
return c.query<any>("party.ledgerReport", input);
|
|
291
|
-
},
|
|
292
|
-
getStats(input: any) {
|
|
293
|
-
return c.query<any>("party.getStats", input);
|
|
294
|
-
},
|
|
295
|
-
topItems(input: any) {
|
|
296
|
-
return c.query<any>("party.topItems", input);
|
|
297
|
-
},
|
|
298
|
-
merge(input: any) {
|
|
299
|
-
return c.mutate<any>("party.merge", input);
|
|
300
|
-
},
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
// ── Item ──────────────────────────────────────────────────────
|
|
305
|
-
|
|
306
|
-
get item() {
|
|
307
|
-
const c = this;
|
|
308
|
-
return {
|
|
309
|
-
list(input: ItemListInput) {
|
|
310
|
-
return c.query<PaginatedResult<ItemSummary>>("item.list", input);
|
|
311
|
-
},
|
|
312
|
-
get(id: string) {
|
|
313
|
-
return c.query<ItemDetail>("item.getById", { id });
|
|
314
|
-
},
|
|
315
|
-
create(input: ItemCreateInput) {
|
|
316
|
-
return c.mutate<ItemSummary>("item.create", input);
|
|
317
|
-
},
|
|
318
|
-
update(id: string, data: Partial<ItemCreateInput>) {
|
|
319
|
-
return c.mutate<ItemDetail>("item.update", { id, data });
|
|
320
|
-
},
|
|
321
|
-
delete(id: string) {
|
|
322
|
-
return c.mutate<{ success: boolean }>("item.delete", { id });
|
|
323
|
-
},
|
|
324
|
-
adjustStock(input: StockAdjustInput) {
|
|
325
|
-
return c.mutate<ItemSummary>("item.adjustStock", input);
|
|
326
|
-
},
|
|
327
|
-
categories() {
|
|
328
|
-
return c.query<string[]>("item.categories");
|
|
329
|
-
},
|
|
330
|
-
createVariant(input: any) {
|
|
331
|
-
return c.mutate<any>("item.createVariant", input);
|
|
332
|
-
},
|
|
333
|
-
updateVariant(input: any) {
|
|
334
|
-
return c.mutate<any>("item.updateVariant", input);
|
|
335
|
-
},
|
|
336
|
-
deleteVariant(input: any) {
|
|
337
|
-
return c.mutate<any>("item.deleteVariant", input);
|
|
338
|
-
},
|
|
339
|
-
listVariants(input: any) {
|
|
340
|
-
return c.query<any>("item.listVariants", input);
|
|
341
|
-
},
|
|
342
|
-
merge(input: any) {
|
|
343
|
-
return c.mutate<any>("item.merge", input);
|
|
344
|
-
},
|
|
345
|
-
switchBaseUnit(input: any) {
|
|
346
|
-
return c.mutate<any>("item.switchBaseUnit", input);
|
|
347
|
-
},
|
|
348
|
-
renameUnit(input: any) {
|
|
349
|
-
return c.mutate<any>("item.renameUnit", input);
|
|
350
|
-
},
|
|
351
|
-
stockAdjustmentHistory(input: any) {
|
|
352
|
-
return c.query<any>("item.stockAdjustmentHistory", input);
|
|
353
|
-
},
|
|
354
|
-
lowStockCount() {
|
|
355
|
-
return c.query<any>("item.lowStockCount");
|
|
356
|
-
},
|
|
357
|
-
priceHistory(input: any) {
|
|
358
|
-
return c.query<any>("item.priceHistory", input);
|
|
359
|
-
},
|
|
360
|
-
salesStats(input: any) {
|
|
361
|
-
return c.query<any>("item.salesStats", input);
|
|
362
|
-
},
|
|
363
|
-
stockMovements(input: any) {
|
|
364
|
-
return c.query<any>("item.stockMovements", input);
|
|
365
|
-
},
|
|
366
|
-
};
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
// ── Payment ───────────────────────────────────────────────────
|
|
370
|
-
|
|
371
|
-
get payment() {
|
|
372
|
-
const c = this;
|
|
373
|
-
return {
|
|
374
|
-
list(input: PaymentListInput) {
|
|
375
|
-
return c.query<PaginatedResult<PaymentSummary>>("payment.list", input);
|
|
376
|
-
},
|
|
377
|
-
getById(id: string) {
|
|
378
|
-
return c.query<PaymentDetail | null>("payment.getById", { id });
|
|
379
|
-
},
|
|
380
|
-
create(input: PaymentCreateInput) {
|
|
381
|
-
return c.mutate<PaymentSummary>("payment.create", input);
|
|
382
|
-
},
|
|
383
|
-
update(input: PaymentUpdateInput) {
|
|
384
|
-
return c.mutate<PaymentSummary>("payment.update", input);
|
|
385
|
-
},
|
|
386
|
-
delete(id: string) {
|
|
387
|
-
return c.mutate<{ success: boolean }>("payment.delete", { id });
|
|
388
|
-
},
|
|
389
|
-
unpaidInvoices(input: any) {
|
|
390
|
-
return c.query<any>("payment.unpaidInvoices", input);
|
|
391
|
-
},
|
|
392
|
-
untrackedPayments(input: any) {
|
|
393
|
-
return c.query<any>("payment.untrackedPayments", input);
|
|
394
|
-
},
|
|
395
|
-
defaultAccount(input?: any) {
|
|
396
|
-
return c.query<any>("payment.defaultAccount", input);
|
|
397
|
-
},
|
|
398
|
-
assignAccount(input: any) {
|
|
399
|
-
return c.mutate<any>("payment.assignAccount", input);
|
|
400
|
-
},
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
// ── Expense ───────────────────────────────────────────────────
|
|
405
|
-
|
|
406
|
-
get expense() {
|
|
407
|
-
const c = this;
|
|
408
|
-
return {
|
|
409
|
-
list(input: ExpenseListInput) {
|
|
410
|
-
return c.query<PaginatedResult<ExpenseSummary>>("expense.list", input);
|
|
411
|
-
},
|
|
412
|
-
create(input: ExpenseCreateInput) {
|
|
413
|
-
return c.mutate<ExpenseSummary>("expense.create", input);
|
|
414
|
-
},
|
|
415
|
-
update(id: string, data: Partial<ExpenseCreateInput>) {
|
|
416
|
-
return c.mutate<ExpenseSummary>("expense.update", { id, data });
|
|
417
|
-
},
|
|
418
|
-
delete(id: string) {
|
|
419
|
-
return c.mutate<{ success: boolean }>("expense.delete", { id });
|
|
420
|
-
},
|
|
421
|
-
categories() {
|
|
422
|
-
return c.query<string[]>("expense.categories");
|
|
423
|
-
},
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
// ── Dashboard ─────────────────────────────────────────────────
|
|
428
|
-
|
|
429
|
-
get dashboard() {
|
|
430
|
-
const c = this;
|
|
431
|
-
return {
|
|
432
|
-
summary(input?: DashboardInput) {
|
|
433
|
-
return c.query<DashboardSummary>("dashboard.summary", input);
|
|
434
|
-
},
|
|
435
|
-
salesTrend(input: { months?: number; fromDate?: string; toDate?: string; granularity?: string }) {
|
|
436
|
-
return c.query<any>("dashboard.salesTrend", input);
|
|
437
|
-
},
|
|
438
|
-
topOutstanding(input?: { limit?: number }) {
|
|
439
|
-
return c.query<any>("dashboard.topOutstanding", input);
|
|
440
|
-
},
|
|
441
|
-
topCustomers(input?: { limit?: number; fromDate?: string; toDate?: string }) {
|
|
442
|
-
return c.query<any>("dashboard.topCustomers", input);
|
|
443
|
-
},
|
|
444
|
-
topSellingItems(input?: { limit?: number; itemType?: string; fromDate?: string; toDate?: string }) {
|
|
445
|
-
return c.query<any>("dashboard.topSellingItems", input);
|
|
446
|
-
},
|
|
447
|
-
expensesByCategory(input?: { fromDate?: string; toDate?: string }) {
|
|
448
|
-
return c.query<any>("dashboard.expensesByCategory", input);
|
|
449
|
-
},
|
|
450
|
-
invoiceStatusBreakdown(input?: { fromDate?: string; toDate?: string }) {
|
|
451
|
-
return c.query<any>("dashboard.invoiceStatusBreakdown", input);
|
|
452
|
-
},
|
|
453
|
-
profitAndLoss(input?: { fromDate?: string; toDate?: string }) {
|
|
454
|
-
return c.query<any>("dashboard.profitAndLoss", input);
|
|
455
|
-
},
|
|
456
|
-
receivablesAging() {
|
|
457
|
-
return c.query<any>("dashboard.receivablesAging");
|
|
458
|
-
},
|
|
459
|
-
paymentModeBreakdown(input?: { fromDate?: string; toDate?: string }) {
|
|
460
|
-
return c.query<any>("dashboard.paymentModeBreakdown", input);
|
|
461
|
-
},
|
|
462
|
-
collectionEfficiency(input?: { fromDate?: string; toDate?: string }) {
|
|
463
|
-
return c.query<any>("dashboard.collectionEfficiency", input);
|
|
464
|
-
},
|
|
465
|
-
monthlyComparison() {
|
|
466
|
-
return c.query<any>("dashboard.monthlyComparison");
|
|
467
|
-
},
|
|
468
|
-
shippingSummary(input?: { fromDate?: string; toDate?: string }) {
|
|
469
|
-
return c.query<any>("dashboard.shippingSummary", input);
|
|
470
|
-
},
|
|
471
|
-
};
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
// ── GST ───────────────────────────────────────────────────────
|
|
475
|
-
|
|
476
|
-
get gst() {
|
|
477
|
-
const c = this;
|
|
478
|
-
return {
|
|
479
|
-
gstr1(input: GstReportInput) {
|
|
480
|
-
return c.query<GstReportResult>("gst.gstr1", input);
|
|
481
|
-
},
|
|
482
|
-
gstr3b(input: GstReportInput) {
|
|
483
|
-
return c.query<GstReportResult>("gst.gstr3b", input);
|
|
484
|
-
},
|
|
485
|
-
gstr1CSV(input: GstReportInput) {
|
|
486
|
-
return c.query<{ csv: string; filename: string }>("gst.gstr1CSV", input);
|
|
487
|
-
},
|
|
488
|
-
gstr9(input: { financialYear: string }) {
|
|
489
|
-
return c.query<any>("gst.gstr9", input);
|
|
490
|
-
},
|
|
491
|
-
gstr2bUploads(input?: Record<string, unknown>) {
|
|
492
|
-
return c.query<any>("gstr2b.uploads", input ?? {});
|
|
493
|
-
},
|
|
494
|
-
};
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
// ── Shipment ──────────────────────────────────────────────────
|
|
498
|
-
|
|
499
|
-
get shipment() {
|
|
500
|
-
const c = this;
|
|
501
|
-
return {
|
|
502
|
-
list(input: ShipmentListInput) {
|
|
503
|
-
return c.query<PaginatedResult<ShipmentSummary>>("shipment.list", input);
|
|
504
|
-
},
|
|
505
|
-
get(id: string) {
|
|
506
|
-
return c.query<ShipmentDetail | null>("shipment.getById", { id });
|
|
507
|
-
},
|
|
508
|
-
create(input: ShipmentCreateInput) {
|
|
509
|
-
return c.mutate<ShipmentDetail>("shipment.create", input);
|
|
510
|
-
},
|
|
511
|
-
update(input: ShipmentUpdateInput) {
|
|
512
|
-
return c.mutate<ShipmentDetail>("shipment.update", input);
|
|
513
|
-
},
|
|
514
|
-
delete(id: string) {
|
|
515
|
-
return c.mutate<{ success: boolean }>("shipment.delete", { id });
|
|
516
|
-
},
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
// ── Bank Account ──────────────────────────────────────────────
|
|
521
|
-
|
|
522
|
-
get bankAccount() {
|
|
523
|
-
const c = this;
|
|
524
|
-
return {
|
|
525
|
-
list() {
|
|
526
|
-
return c.query<BankAccountSummary[]>("bankAccount.list");
|
|
527
|
-
},
|
|
528
|
-
get(id: string) {
|
|
529
|
-
return c.query<BankAccountDetail | null>("bankAccount.getById", { id });
|
|
530
|
-
},
|
|
531
|
-
create(input: BankAccountCreateInput) {
|
|
532
|
-
return c.mutate<BankAccountSummary>("bankAccount.create", input);
|
|
533
|
-
},
|
|
534
|
-
update(id: string, data: Partial<BankAccountCreateInput>) {
|
|
535
|
-
return c.mutate<BankAccountSummary>("bankAccount.update", { id, data });
|
|
536
|
-
},
|
|
537
|
-
delete(id: string) {
|
|
538
|
-
return c.mutate<{ success: boolean }>("bankAccount.delete", { id });
|
|
539
|
-
},
|
|
540
|
-
transfer(input: BankTransferInput) {
|
|
541
|
-
return c.mutate<BankTransferResult>("bankAccount.transfer", input);
|
|
542
|
-
},
|
|
543
|
-
listTransactions(input: BankTransactionListInput) {
|
|
544
|
-
return c.query<PaginatedResult<BankTransactionRow>>("bankAccount.listTransactions", input);
|
|
545
|
-
},
|
|
546
|
-
summary() {
|
|
547
|
-
return c.query<BankSummary>("bankAccount.summary");
|
|
548
|
-
},
|
|
549
|
-
getGatewayConfig(bankAccountId: string) {
|
|
550
|
-
return c.query<GatewayConfig | null>("bankAccount.getGatewayConfig", { bankAccountId });
|
|
551
|
-
},
|
|
552
|
-
upsertGatewayConfig(input: UpsertGatewayConfigInput) {
|
|
553
|
-
return c.mutate<GatewayConfig>("bankAccount.upsertGatewayConfig", input);
|
|
554
|
-
},
|
|
555
|
-
};
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
// ── Reports ───────────────────────────────────────────────────
|
|
559
|
-
|
|
560
|
-
get reports() {
|
|
561
|
-
const c = this;
|
|
562
|
-
return {
|
|
563
|
-
daybook(input: DaybookInput) {
|
|
564
|
-
return c.query<DaybookResult>("reports.daybook", input);
|
|
565
|
-
},
|
|
566
|
-
outstanding(input: OutstandingInput) {
|
|
567
|
-
return c.query<OutstandingResult>("reports.outstanding", input);
|
|
568
|
-
},
|
|
569
|
-
taxSummary(input: TaxSummaryInput) {
|
|
570
|
-
return c.query<TaxSummaryResult>("reports.taxSummary", input);
|
|
571
|
-
},
|
|
572
|
-
itemSales(input: ItemSalesInput) {
|
|
573
|
-
return c.query<ItemSalesResult>("reports.itemSales", input);
|
|
574
|
-
},
|
|
575
|
-
stockSummary(input: StockSummaryInput) {
|
|
576
|
-
return c.query<StockSummaryResult>("reports.stockSummary", input);
|
|
577
|
-
},
|
|
578
|
-
partyStatement(input: PartyStatementInput) {
|
|
579
|
-
return c.query<PartyStatementResult>("reports.partyStatement", input);
|
|
580
|
-
},
|
|
581
|
-
paymentSummary(input: PaymentSummaryInput) {
|
|
582
|
-
return c.query<PaymentSummaryResult>("reports.paymentSummary", input);
|
|
583
|
-
},
|
|
584
|
-
salesRegister(input: { fromDate: string; toDate: string; partyId?: string }) {
|
|
585
|
-
return c.query<any>("reports.salesRegister", input);
|
|
586
|
-
},
|
|
587
|
-
purchaseRegister(input: { fromDate: string; toDate: string; partyId?: string }) {
|
|
588
|
-
return c.query<any>("reports.purchaseRegister", input);
|
|
589
|
-
},
|
|
590
|
-
cashFlowForecast(input?: Record<string, unknown>) {
|
|
591
|
-
return c.query<any>("reports.cashFlowForecast", input ?? {});
|
|
592
|
-
},
|
|
593
|
-
collectionEfficiency(input: { fromDate: string; toDate: string }) {
|
|
594
|
-
return c.query<any>("reports.collectionEfficiency", input);
|
|
595
|
-
},
|
|
596
|
-
trialBalance(input?: Record<string, unknown>) {
|
|
597
|
-
return c.query<any>("reports.trialBalance", input ?? {});
|
|
598
|
-
},
|
|
599
|
-
balanceSheet(input?: Record<string, unknown>) {
|
|
600
|
-
return c.query<any>("reports.balanceSheet", input ?? {});
|
|
601
|
-
},
|
|
602
|
-
profitAndLoss(input?: Record<string, unknown>) {
|
|
603
|
-
return c.query<any>("reports.profitAndLoss", input ?? {});
|
|
604
|
-
},
|
|
605
|
-
cashFlowStatement(input?: Record<string, unknown>) {
|
|
606
|
-
return c.query<any>("reports.cashFlowStatement", input ?? {});
|
|
607
|
-
},
|
|
608
|
-
generalLedger(input: { accountId: string; fromDate?: string; toDate?: string }) {
|
|
609
|
-
return c.query<any>("reports.generalLedger", input);
|
|
610
|
-
},
|
|
611
|
-
comparativeTrialBalance(input?: Record<string, unknown>) {
|
|
612
|
-
return c.query<any>("reports.comparativeTrialBalance", input ?? {});
|
|
613
|
-
},
|
|
614
|
-
comparativeBalanceSheet(input?: Record<string, unknown>) {
|
|
615
|
-
return c.query<any>("reports.comparativeBalanceSheet", input ?? {});
|
|
616
|
-
},
|
|
617
|
-
comparativeProfitAndLoss(input?: Record<string, unknown>) {
|
|
618
|
-
return c.query<any>("reports.comparativeProfitAndLoss", input ?? {});
|
|
619
|
-
},
|
|
620
|
-
tallyExport(input?: Record<string, unknown>) {
|
|
621
|
-
return c.query<any>("reports.tallyExport", input ?? {});
|
|
622
|
-
},
|
|
623
|
-
};
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
// ── Store ─────────────────────────────────────────────────────
|
|
627
|
-
|
|
628
|
-
get store() {
|
|
629
|
-
const c = this;
|
|
630
|
-
return {
|
|
631
|
-
getSettings() {
|
|
632
|
-
return c.query<StoreSettings>("store.getSettings");
|
|
633
|
-
},
|
|
634
|
-
updateSettings(input: StoreSettingsUpdateInput) {
|
|
635
|
-
return c.mutate<StoreSettings>("store.updateSettings", input);
|
|
636
|
-
},
|
|
637
|
-
listOrders(input: StoreOrderListInput) {
|
|
638
|
-
return c.query<PaginatedResult<StoreOrderSummary>>("store.listOrders", input);
|
|
639
|
-
},
|
|
640
|
-
getOrder(id: string) {
|
|
641
|
-
return c.query<StoreOrderDetail | null>("store.getOrder", { id });
|
|
642
|
-
},
|
|
643
|
-
updateOrder(input: { orderId: string; status: "preparing" | "ready" | "delivered" }) {
|
|
644
|
-
return c.mutate<{ success: boolean; status: string }>("store.updateOrderStatus", input);
|
|
645
|
-
},
|
|
646
|
-
confirmOrder(input: any) {
|
|
647
|
-
return c.mutate<any>("store.confirmOrder", input);
|
|
648
|
-
},
|
|
649
|
-
cancelOrder(input: any) {
|
|
650
|
-
return c.mutate<any>("store.cancelOrder", input);
|
|
651
|
-
},
|
|
652
|
-
checkSlug(input: any) {
|
|
653
|
-
return c.query<any>("store.checkSlug", input);
|
|
654
|
-
},
|
|
655
|
-
listStoreItems(input: any) {
|
|
656
|
-
return c.query<any>("store.listStoreItems", input);
|
|
657
|
-
},
|
|
658
|
-
bulkToggleItems(input: any) {
|
|
659
|
-
return c.mutate<any>("store.bulkToggleItems", input);
|
|
660
|
-
},
|
|
661
|
-
};
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
// ── Target ────────────────────────────────────────────────────
|
|
665
|
-
|
|
666
|
-
get target() {
|
|
667
|
-
const c = this;
|
|
668
|
-
return {
|
|
669
|
-
list(input: TargetListInput) {
|
|
670
|
-
return c.query<TargetRow[]>("target.list", input);
|
|
671
|
-
},
|
|
672
|
-
create(input: TargetCreateInput) {
|
|
673
|
-
return c.mutate<TargetRow>("target.create", input);
|
|
674
|
-
},
|
|
675
|
-
getProgress(id: string) {
|
|
676
|
-
return c.query<TargetWithProgress>("target.getProgress", { id });
|
|
677
|
-
},
|
|
678
|
-
update(input: TargetUpdateInput) {
|
|
679
|
-
return c.mutate<TargetRow>("target.update", input);
|
|
680
|
-
},
|
|
681
|
-
delete(id: string) {
|
|
682
|
-
return c.mutate<{ success: boolean }>("target.delete", { id });
|
|
683
|
-
},
|
|
684
|
-
myTargets() {
|
|
685
|
-
return c.query<TargetWithProgress[]>("target.myTargets");
|
|
686
|
-
},
|
|
687
|
-
};
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
// ── Tenant ───────────────────────────────────────────────────
|
|
691
|
-
|
|
692
|
-
get tenant() {
|
|
693
|
-
const c = this;
|
|
694
|
-
return {
|
|
695
|
-
list() {
|
|
696
|
-
return c.query<any>("tenant.list");
|
|
697
|
-
},
|
|
698
|
-
select(input: any) {
|
|
699
|
-
return c.mutate<any>("tenant.select", input);
|
|
700
|
-
},
|
|
701
|
-
members() {
|
|
702
|
-
return c.query<any>("tenant.members");
|
|
703
|
-
},
|
|
704
|
-
inviteMember(input: any) {
|
|
705
|
-
return c.mutate<any>("tenant.inviteMember", input);
|
|
706
|
-
},
|
|
707
|
-
removeMember(input: any) {
|
|
708
|
-
return c.mutate<any>("tenant.removeMember", input);
|
|
709
|
-
},
|
|
710
|
-
updateMemberRole(input: any) {
|
|
711
|
-
return c.mutate<any>("tenant.updateMemberRole", input);
|
|
712
|
-
},
|
|
713
|
-
pendingInvitations() {
|
|
714
|
-
return c.query<any>("tenant.pendingInvitations");
|
|
715
|
-
},
|
|
716
|
-
revokeInvitation(input: { invitationId: string }) {
|
|
717
|
-
return c.mutate<any>("tenant.revokeInvitation", input);
|
|
718
|
-
},
|
|
719
|
-
};
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
// ── Document ──────────────────────────────────────────────────
|
|
723
|
-
|
|
724
|
-
get document() {
|
|
725
|
-
const c = this;
|
|
726
|
-
return {
|
|
727
|
-
convert(input: any) {
|
|
728
|
-
return c.mutate<any>("document.convert", input);
|
|
729
|
-
},
|
|
730
|
-
};
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
// ── Quotation ─────────────────────────────────────────────────
|
|
734
|
-
|
|
735
|
-
get quotation() {
|
|
736
|
-
const c = this;
|
|
737
|
-
return {
|
|
738
|
-
list(input: any) {
|
|
739
|
-
return c.query<any>("quotation.list", input);
|
|
740
|
-
},
|
|
741
|
-
getById(input: any) {
|
|
742
|
-
return c.query<any>("quotation.getById", input);
|
|
743
|
-
},
|
|
744
|
-
create(input: any) {
|
|
745
|
-
return c.mutate<any>("quotation.create", input);
|
|
746
|
-
},
|
|
747
|
-
updateStatus(input: any) {
|
|
748
|
-
return c.mutate<any>("quotation.updateStatus", input);
|
|
749
|
-
},
|
|
750
|
-
delete(input: any) {
|
|
751
|
-
return c.mutate<any>("quotation.delete", input);
|
|
752
|
-
},
|
|
753
|
-
};
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
// ── Credit Note ───────────────────────────────────────────────
|
|
757
|
-
|
|
758
|
-
get creditNote() {
|
|
759
|
-
const c = this;
|
|
760
|
-
return {
|
|
761
|
-
list(input: any) {
|
|
762
|
-
return c.query<any>("creditNote.list", input);
|
|
763
|
-
},
|
|
764
|
-
getById(input: any) {
|
|
765
|
-
return c.query<any>("creditNote.getById", input);
|
|
766
|
-
},
|
|
767
|
-
create(input: any) {
|
|
768
|
-
return c.mutate<any>("creditNote.create", input);
|
|
769
|
-
},
|
|
770
|
-
updateStatus(input: any) {
|
|
771
|
-
return c.mutate<any>("creditNote.updateStatus", input);
|
|
772
|
-
},
|
|
773
|
-
delete(input: any) {
|
|
774
|
-
return c.mutate<any>("creditNote.delete", input);
|
|
775
|
-
},
|
|
776
|
-
};
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
// ── Debit Note ────────────────────────────────────────────────
|
|
780
|
-
|
|
781
|
-
get debitNote() {
|
|
782
|
-
const c = this;
|
|
783
|
-
return {
|
|
784
|
-
list(input: any) {
|
|
785
|
-
return c.query<any>("debitNote.list", input);
|
|
786
|
-
},
|
|
787
|
-
getById(input: any) {
|
|
788
|
-
return c.query<any>("debitNote.getById", input);
|
|
789
|
-
},
|
|
790
|
-
create(input: any) {
|
|
791
|
-
return c.mutate<any>("debitNote.create", input);
|
|
792
|
-
},
|
|
793
|
-
updateStatus(input: any) {
|
|
794
|
-
return c.mutate<any>("debitNote.updateStatus", input);
|
|
795
|
-
},
|
|
796
|
-
delete(input: any) {
|
|
797
|
-
return c.mutate<any>("debitNote.delete", input);
|
|
798
|
-
},
|
|
799
|
-
};
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
// ── Delivery Challan ──────────────────────────────────────────
|
|
803
|
-
|
|
804
|
-
get deliveryChallan() {
|
|
805
|
-
const c = this;
|
|
806
|
-
return {
|
|
807
|
-
list(input: any) {
|
|
808
|
-
return c.query<any>("deliveryChallan.list", input);
|
|
809
|
-
},
|
|
810
|
-
getById(input: any) {
|
|
811
|
-
return c.query<any>("deliveryChallan.getById", input);
|
|
812
|
-
},
|
|
813
|
-
create(input: any) {
|
|
814
|
-
return c.mutate<any>("deliveryChallan.create", input);
|
|
815
|
-
},
|
|
816
|
-
updateStatus(input: any) {
|
|
817
|
-
return c.mutate<any>("deliveryChallan.updateStatus", input);
|
|
818
|
-
},
|
|
819
|
-
delete(input: any) {
|
|
820
|
-
return c.mutate<any>("deliveryChallan.delete", input);
|
|
821
|
-
},
|
|
822
|
-
};
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
// ── Proforma ──────────────────────────────────────────────────
|
|
826
|
-
|
|
827
|
-
get proforma() {
|
|
828
|
-
const c = this;
|
|
829
|
-
return {
|
|
830
|
-
list(input: any) {
|
|
831
|
-
return c.query<any>("proforma.list", input);
|
|
832
|
-
},
|
|
833
|
-
getById(input: any) {
|
|
834
|
-
return c.query<any>("proforma.getById", input);
|
|
835
|
-
},
|
|
836
|
-
create(input: any) {
|
|
837
|
-
return c.mutate<any>("proforma.create", input);
|
|
838
|
-
},
|
|
839
|
-
updateStatus(input: any) {
|
|
840
|
-
return c.mutate<any>("proforma.updateStatus", input);
|
|
841
|
-
},
|
|
842
|
-
delete(input: any) {
|
|
843
|
-
return c.mutate<any>("proforma.delete", input);
|
|
844
|
-
},
|
|
845
|
-
};
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
// ── Sales Return ──────────────────────────────────────────────
|
|
849
|
-
|
|
850
|
-
get salesReturn() {
|
|
851
|
-
const c = this;
|
|
852
|
-
return {
|
|
853
|
-
list(input: any) {
|
|
854
|
-
return c.query<any>("salesReturn.list", input);
|
|
855
|
-
},
|
|
856
|
-
getById(input: any) {
|
|
857
|
-
return c.query<any>("salesReturn.getById", input);
|
|
858
|
-
},
|
|
859
|
-
create(input: any) {
|
|
860
|
-
return c.mutate<any>("salesReturn.create", input);
|
|
861
|
-
},
|
|
862
|
-
updateStatus(input: any) {
|
|
863
|
-
return c.mutate<any>("salesReturn.updateStatus", input);
|
|
864
|
-
},
|
|
865
|
-
delete(input: any) {
|
|
866
|
-
return c.mutate<any>("salesReturn.delete", input);
|
|
867
|
-
},
|
|
868
|
-
};
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
// ── Purchase Return ───────────────────────────────────────────
|
|
872
|
-
|
|
873
|
-
get purchaseReturn() {
|
|
874
|
-
const c = this;
|
|
875
|
-
return {
|
|
876
|
-
list(input: any) {
|
|
877
|
-
return c.query<any>("purchaseReturn.list", input);
|
|
878
|
-
},
|
|
879
|
-
getById(input: any) {
|
|
880
|
-
return c.query<any>("purchaseReturn.getById", input);
|
|
881
|
-
},
|
|
882
|
-
create(input: any) {
|
|
883
|
-
return c.mutate<any>("purchaseReturn.create", input);
|
|
884
|
-
},
|
|
885
|
-
updateStatus(input: any) {
|
|
886
|
-
return c.mutate<any>("purchaseReturn.updateStatus", input);
|
|
887
|
-
},
|
|
888
|
-
delete(input: any) {
|
|
889
|
-
return c.mutate<any>("purchaseReturn.delete", input);
|
|
890
|
-
},
|
|
891
|
-
};
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
// ── Recurring Invoice ─────────────────────────────────────────
|
|
895
|
-
|
|
896
|
-
get recurringInvoice() {
|
|
897
|
-
const c = this;
|
|
898
|
-
return {
|
|
899
|
-
list(input: RecurringInvoiceListInput) {
|
|
900
|
-
return c.query<PaginatedResult<RecurringInvoiceSummary>>("recurringInvoice.list", input);
|
|
901
|
-
},
|
|
902
|
-
getById(id: string) {
|
|
903
|
-
return c.query<RecurringInvoiceDetail>("recurringInvoice.getById", { id });
|
|
904
|
-
},
|
|
905
|
-
create(input: RecurringInvoiceCreateInput) {
|
|
906
|
-
return c.mutate<RecurringInvoiceDetail>("recurringInvoice.create", input);
|
|
907
|
-
},
|
|
908
|
-
update(id: string, data: Partial<RecurringInvoiceCreateInput>) {
|
|
909
|
-
return c.mutate<RecurringInvoiceDetail>("recurringInvoice.update", { id, data });
|
|
910
|
-
},
|
|
911
|
-
delete(id: string) {
|
|
912
|
-
return c.mutate<{ success: boolean }>("recurringInvoice.delete", { id });
|
|
913
|
-
},
|
|
914
|
-
pause(id: string) {
|
|
915
|
-
return c.mutate<{ success: boolean }>("recurringInvoice.pause", { id });
|
|
916
|
-
},
|
|
917
|
-
resume(id: string) {
|
|
918
|
-
return c.mutate<{ success: boolean }>("recurringInvoice.resume", { id });
|
|
919
|
-
},
|
|
920
|
-
runNow(id: string) {
|
|
921
|
-
return c.mutate<{ success: boolean; invoiceId?: string }>("recurringInvoice.runNow", { id });
|
|
922
|
-
},
|
|
923
|
-
executionHistory(templateId: string, page?: number, limit?: number) {
|
|
924
|
-
return c.query<PaginatedResult<RecurringInvoiceExecution>>("recurringInvoice.executionHistory", { templateId, page, limit });
|
|
925
|
-
},
|
|
926
|
-
planUsage() {
|
|
927
|
-
return c.query<RecurringInvoicePlanUsage>("recurringInvoice.planUsage");
|
|
928
|
-
},
|
|
929
|
-
suggestions() {
|
|
930
|
-
return c.query<RecurringInvoiceSuggestion[]>("recurringInvoice.suggestions");
|
|
931
|
-
},
|
|
932
|
-
};
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
// ── API Key ───────────────────────────────────────────────────
|
|
936
|
-
|
|
937
|
-
get apiKey() {
|
|
938
|
-
const c = this;
|
|
939
|
-
return {
|
|
940
|
-
list() {
|
|
941
|
-
return c.query<any>("apiKey.list");
|
|
942
|
-
},
|
|
943
|
-
create(input: any) {
|
|
944
|
-
return c.mutate<any>("apiKey.create", input);
|
|
945
|
-
},
|
|
946
|
-
revoke(input: any) {
|
|
947
|
-
return c.mutate<any>("apiKey.revoke", input);
|
|
948
|
-
},
|
|
949
|
-
};
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
// ── Import ────────────────────────────────────────────────────
|
|
953
|
-
|
|
954
|
-
get import() {
|
|
955
|
-
const c = this;
|
|
956
|
-
return {
|
|
957
|
-
importParties(input: ImportPartiesInput) {
|
|
958
|
-
return c.mutate<ImportResult>("import.importParties", input);
|
|
959
|
-
},
|
|
960
|
-
importItems(input: ImportItemsInput) {
|
|
961
|
-
return c.mutate<ImportItemsResult>("import.importItems", input);
|
|
962
|
-
},
|
|
963
|
-
importInvoices(input: ImportInvoicesInput) {
|
|
964
|
-
return c.mutate<ImportResult>("import.importInvoices", input);
|
|
965
|
-
},
|
|
966
|
-
importPayments(input: ImportPaymentsInput) {
|
|
967
|
-
return c.mutate<ImportResult>("import.importPayments", input);
|
|
968
|
-
},
|
|
969
|
-
};
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
// ── Journal ───────────────────────────────────────────────────
|
|
973
|
-
|
|
974
|
-
get journal() {
|
|
975
|
-
const c = this;
|
|
976
|
-
return {
|
|
977
|
-
list(input?: Record<string, unknown>) {
|
|
978
|
-
return c.query<any>("journal.list", input ?? {});
|
|
979
|
-
},
|
|
980
|
-
getById(id: string) {
|
|
981
|
-
return c.query<any>("journal.getById", { id });
|
|
982
|
-
},
|
|
983
|
-
create(input: Record<string, unknown>) {
|
|
984
|
-
return c.mutate<any>("journal.create", input);
|
|
985
|
-
},
|
|
986
|
-
update(input: Record<string, unknown>) {
|
|
987
|
-
return c.mutate<any>("journal.update", input);
|
|
988
|
-
},
|
|
989
|
-
void(id: string) {
|
|
990
|
-
return c.mutate<any>("journal.void", { id });
|
|
991
|
-
},
|
|
992
|
-
delete(id: string) {
|
|
993
|
-
return c.mutate<any>("journal.delete", { id });
|
|
994
|
-
},
|
|
995
|
-
templateList() {
|
|
996
|
-
return c.query<any>("journal.templateList");
|
|
997
|
-
},
|
|
998
|
-
templateCreate(input: Record<string, unknown>) {
|
|
999
|
-
return c.mutate<any>("journal.templateCreate", input);
|
|
1000
|
-
},
|
|
1001
|
-
templateDelete(id: string) {
|
|
1002
|
-
return c.mutate<any>("journal.templateDelete", { id });
|
|
1003
|
-
},
|
|
1004
|
-
createFromTemplate(input: Record<string, unknown>) {
|
|
1005
|
-
return c.mutate<any>("journal.createFromTemplate", input);
|
|
1006
|
-
},
|
|
1007
|
-
};
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
// ── ITC ───────────────────────────────────────────────────────
|
|
1011
|
-
|
|
1012
|
-
get itc() {
|
|
1013
|
-
const c = this;
|
|
1014
|
-
return {
|
|
1015
|
-
dashboard(input?: Record<string, unknown>) {
|
|
1016
|
-
return c.query<any>("itc.dashboard", input ?? {});
|
|
1017
|
-
},
|
|
1018
|
-
ledger(input?: Record<string, unknown>) {
|
|
1019
|
-
return c.query<any>("itc.ledger", input ?? {});
|
|
1020
|
-
},
|
|
1021
|
-
agingAlerts() {
|
|
1022
|
-
return c.query<any>("itc.agingAlerts");
|
|
1023
|
-
},
|
|
1024
|
-
markBlocked(input: Record<string, unknown>) {
|
|
1025
|
-
return c.mutate<any>("itc.markBlocked", input);
|
|
1026
|
-
},
|
|
1027
|
-
markEligible(input: Record<string, unknown>) {
|
|
1028
|
-
return c.mutate<any>("itc.markEligible", input);
|
|
1029
|
-
},
|
|
1030
|
-
recordUtilization(input: Record<string, unknown>) {
|
|
1031
|
-
return c.mutate<any>("itc.recordUtilization", input);
|
|
1032
|
-
},
|
|
1033
|
-
gstr3bTable4(input?: Record<string, unknown>) {
|
|
1034
|
-
return c.query<any>("itc.gstr3bTable4", input ?? {});
|
|
1035
|
-
},
|
|
1036
|
-
};
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
// ── Bank Recon ────────────────────────────────────────────────
|
|
1040
|
-
|
|
1041
|
-
get bankRecon() {
|
|
1042
|
-
const c = this;
|
|
1043
|
-
return {
|
|
1044
|
-
importList(input?: Record<string, unknown>) {
|
|
1045
|
-
return c.query<any>("bankRecon.importList", input ?? {});
|
|
1046
|
-
},
|
|
1047
|
-
importDetail(importId: string) {
|
|
1048
|
-
return c.query<any>("bankRecon.importDetail", { importId });
|
|
1049
|
-
},
|
|
1050
|
-
summary(importId: string) {
|
|
1051
|
-
return c.query<any>("bankRecon.summary", { importId });
|
|
1052
|
-
},
|
|
1053
|
-
lines(input: Record<string, unknown>) {
|
|
1054
|
-
return c.query<any>("bankRecon.lines", input);
|
|
1055
|
-
},
|
|
1056
|
-
ruleList() {
|
|
1057
|
-
return c.query<any>("bankRecon.ruleList");
|
|
1058
|
-
},
|
|
1059
|
-
ruleCreate(input: Record<string, unknown>) {
|
|
1060
|
-
return c.mutate<any>("bankRecon.ruleCreate", input);
|
|
1061
|
-
},
|
|
1062
|
-
ruleUpdate(input: Record<string, unknown>) {
|
|
1063
|
-
return c.mutate<any>("bankRecon.ruleUpdate", input);
|
|
1064
|
-
},
|
|
1065
|
-
ruleDelete(id: string) {
|
|
1066
|
-
return c.mutate<any>("bankRecon.ruleDelete", { id });
|
|
1067
|
-
},
|
|
1068
|
-
templateList() {
|
|
1069
|
-
return c.query<any>("bankRecon.templateList");
|
|
1070
|
-
},
|
|
1071
|
-
confirmMatch(input: Record<string, unknown>) {
|
|
1072
|
-
return c.mutate<any>("bankRecon.confirmMatch", input);
|
|
1073
|
-
},
|
|
1074
|
-
manualMatch(input: Record<string, unknown>) {
|
|
1075
|
-
return c.mutate<any>("bankRecon.manualMatch", input);
|
|
1076
|
-
},
|
|
1077
|
-
unmatch(input: Record<string, unknown>) {
|
|
1078
|
-
return c.mutate<any>("bankRecon.unmatch", input);
|
|
1079
|
-
},
|
|
1080
|
-
createExpense(input: Record<string, unknown>) {
|
|
1081
|
-
return c.mutate<any>("bankRecon.createExpense", input);
|
|
1082
|
-
},
|
|
1083
|
-
ignoreLine(input: Record<string, unknown>) {
|
|
1084
|
-
return c.mutate<any>("bankRecon.ignoreLine", input);
|
|
1085
|
-
},
|
|
1086
|
-
};
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
|
-
// ── E-Invoice ─────────────────────────────────────────────────
|
|
1090
|
-
|
|
1091
|
-
get eInvoice() {
|
|
1092
|
-
const c = this;
|
|
1093
|
-
return {
|
|
1094
|
-
dashboard(input?: Record<string, unknown>) {
|
|
1095
|
-
return c.query<any>("eInvoice.dashboard", input ?? {});
|
|
1096
|
-
},
|
|
1097
|
-
generate(input: Record<string, unknown>) {
|
|
1098
|
-
return c.mutate<any>("eInvoice.generate", input);
|
|
1099
|
-
},
|
|
1100
|
-
cancel(input: Record<string, unknown>) {
|
|
1101
|
-
return c.mutate<any>("eInvoice.cancel", input);
|
|
1102
|
-
},
|
|
1103
|
-
retryFailed(input: Record<string, unknown>) {
|
|
1104
|
-
return c.mutate<any>("eInvoice.retryFailed", input);
|
|
1105
|
-
},
|
|
1106
|
-
bulkRetry(input?: Record<string, unknown>) {
|
|
1107
|
-
return c.mutate<any>("eInvoice.bulkRetry", input ?? {});
|
|
1108
|
-
},
|
|
1109
|
-
getStatus(invoiceId: string) {
|
|
1110
|
-
return c.query<any>("eInvoice.getStatus", { invoiceId });
|
|
1111
|
-
},
|
|
1112
|
-
};
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
// ── E-Way Bill ────────────────────────────────────────────────
|
|
1116
|
-
|
|
1117
|
-
get ewayBill() {
|
|
1118
|
-
const c = this;
|
|
1119
|
-
return {
|
|
1120
|
-
dashboard(input?: Record<string, unknown>) {
|
|
1121
|
-
return c.query<any>("ewayBill.dashboard", input ?? {});
|
|
1122
|
-
},
|
|
1123
|
-
generate(input: Record<string, unknown>) {
|
|
1124
|
-
return c.mutate<any>("ewayBill.generate", input);
|
|
1125
|
-
},
|
|
1126
|
-
cancel(input: Record<string, unknown>) {
|
|
1127
|
-
return c.mutate<any>("ewayBill.cancel", input);
|
|
1128
|
-
},
|
|
1129
|
-
updateVehicle(input: Record<string, unknown>) {
|
|
1130
|
-
return c.mutate<any>("ewayBill.updateVehicle", input);
|
|
1131
|
-
},
|
|
1132
|
-
extend(input: Record<string, unknown>) {
|
|
1133
|
-
return c.mutate<any>("ewayBill.extend", input);
|
|
1134
|
-
},
|
|
1135
|
-
getByInvoice(invoiceId: string) {
|
|
1136
|
-
return c.query<any>("ewayBill.getByInvoice", { invoiceId });
|
|
1137
|
-
},
|
|
1138
|
-
expiringList(input?: Record<string, unknown>) {
|
|
1139
|
-
return c.query<any>("ewayBill.expiringList", input ?? {});
|
|
1140
|
-
},
|
|
1141
|
-
};
|
|
1142
|
-
}
|
|
1143
|
-
|
|
1144
|
-
// ── GSTR-2B ───────────────────────────────────────────────────
|
|
1145
|
-
|
|
1146
|
-
get gstr2b() {
|
|
1147
|
-
const c = this;
|
|
1148
|
-
return {
|
|
1149
|
-
uploads(input?: Record<string, unknown>) {
|
|
1150
|
-
return c.query<any>("gstr2b.uploads", input ?? {});
|
|
1151
|
-
},
|
|
1152
|
-
records(input: Record<string, unknown>) {
|
|
1153
|
-
return c.query<any>("gstr2b.records", input);
|
|
1154
|
-
},
|
|
1155
|
-
summary(input: Record<string, unknown>) {
|
|
1156
|
-
return c.query<any>("gstr2b.summary", input);
|
|
1157
|
-
},
|
|
1158
|
-
missingInBooks(input: Record<string, unknown>) {
|
|
1159
|
-
return c.query<any>("gstr2b.missingInBooks", input);
|
|
1160
|
-
},
|
|
1161
|
-
missingIn2B(input: Record<string, unknown>) {
|
|
1162
|
-
return c.query<any>("gstr2b.missingIn2B", input);
|
|
1163
|
-
},
|
|
1164
|
-
};
|
|
1165
|
-
}
|
|
1166
|
-
|
|
1167
|
-
// ── Account ───────────────────────────────────────────────────
|
|
1168
|
-
|
|
1169
|
-
get account() {
|
|
1170
|
-
const c = this;
|
|
1171
|
-
return {
|
|
1172
|
-
list(input?: Record<string, unknown>) {
|
|
1173
|
-
return c.query<any>("account.list", input ?? {});
|
|
1174
|
-
},
|
|
1175
|
-
create(input: Record<string, unknown>) {
|
|
1176
|
-
return c.mutate<any>("account.create", input);
|
|
1177
|
-
},
|
|
1178
|
-
update(input: Record<string, unknown>) {
|
|
1179
|
-
return c.mutate<any>("account.update", input);
|
|
1180
|
-
},
|
|
1181
|
-
delete(id: string) {
|
|
1182
|
-
return c.mutate<any>("account.delete", { id });
|
|
1183
|
-
},
|
|
1184
|
-
};
|
|
1185
|
-
}
|
|
1186
|
-
|
|
1187
|
-
// ── System ──────────────────────────────────────────────────────
|
|
1188
|
-
|
|
1189
|
-
get system() {
|
|
1190
|
-
const c = this;
|
|
1191
|
-
return {
|
|
1192
|
-
maintenanceStatus() {
|
|
1193
|
-
return c.query<MaintenanceStatus>("system.maintenanceStatus");
|
|
1194
|
-
},
|
|
1195
|
-
};
|
|
1196
|
-
}
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1199
|
-
// ── Type definitions ───────────────────────────────────────────────────────
|
|
1200
|
-
|
|
1201
|
-
export interface PaginatedResult<T> {
|
|
1202
|
-
data: T[];
|
|
1203
|
-
total: number;
|
|
1204
|
-
page: number;
|
|
1205
|
-
limit: number;
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
export interface AuthUser {
|
|
1209
|
-
id: string;
|
|
1210
|
-
email: string;
|
|
1211
|
-
name: string;
|
|
1212
|
-
role: string;
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
export interface MaintenanceStatus {
|
|
1216
|
-
enabled: boolean;
|
|
1217
|
-
message: string;
|
|
1218
|
-
startsAt: string | null;
|
|
1219
|
-
endsAt: string | null;
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
export type InvoiceStatus =
|
|
1223
|
-
| "draft" | "unfulfilled" | "sent" | "paid" | "partial" | "overdue" | "cancelled" | "adjusted";
|
|
1224
|
-
|
|
1225
|
-
export type DocumentType =
|
|
1226
|
-
| "invoice" | "quotation" | "credit_note" | "debit_note"
|
|
1227
|
-
| "delivery_challan" | "proforma" | "sales_return" | "purchase_return";
|
|
1228
|
-
|
|
1229
|
-
export interface InvoiceSummary {
|
|
1230
|
-
id: string;
|
|
1231
|
-
invoiceNumber: string;
|
|
1232
|
-
partyName: string;
|
|
1233
|
-
partyId: string;
|
|
1234
|
-
type: "sale" | "purchase";
|
|
1235
|
-
documentType: DocumentType;
|
|
1236
|
-
status: InvoiceStatus;
|
|
1237
|
-
invoiceDate: string;
|
|
1238
|
-
dueDate: string | null;
|
|
1239
|
-
totalAmount: string;
|
|
1240
|
-
amountPaid: string;
|
|
1241
|
-
balanceDue: string;
|
|
1242
|
-
totalAdjusted?: string;
|
|
1243
|
-
relatedDocuments?: Array<{ id: string; documentType: string; invoiceNumber: string; totalAmount: string; status: string }>;
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
export interface LineItem {
|
|
1247
|
-
id?: string;
|
|
1248
|
-
itemId?: string | null;
|
|
1249
|
-
description: string;
|
|
1250
|
-
quantity: string;
|
|
1251
|
-
unitPrice: string;
|
|
1252
|
-
taxPercent: string;
|
|
1253
|
-
discountPercent: string;
|
|
1254
|
-
amount: string;
|
|
1255
|
-
selectedUnit?: string | null;
|
|
1256
|
-
variantId?: string | null;
|
|
1257
|
-
}
|
|
1258
|
-
|
|
1259
|
-
export interface InvoiceDetail extends InvoiceSummary {
|
|
1260
|
-
notes: string | null;
|
|
1261
|
-
termsAndConditions: string | null;
|
|
1262
|
-
lineItems: LineItem[];
|
|
1263
|
-
charges?: Array<{ label: string; amount: string }>;
|
|
1264
|
-
invoiceDiscount: string;
|
|
1265
|
-
roundOff: string;
|
|
1266
|
-
deliveryMethod?: string | null;
|
|
1267
|
-
createdByName?: string | null;
|
|
1268
|
-
createdAt?: string;
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
export interface InvoiceListInput {
|
|
1272
|
-
type?: "sale" | "purchase" | null;
|
|
1273
|
-
status?: InvoiceStatus | InvoiceStatus[] | null;
|
|
1274
|
-
documentType?: DocumentType;
|
|
1275
|
-
partyId?: string | null;
|
|
1276
|
-
fromDate?: string | null;
|
|
1277
|
-
toDate?: string | null;
|
|
1278
|
-
itemId?: string | null;
|
|
1279
|
-
search?: string | null;
|
|
1280
|
-
sortBy?: "date" | "amount" | "number" | null;
|
|
1281
|
-
sortDir?: "asc" | "desc" | null;
|
|
1282
|
-
page?: number;
|
|
1283
|
-
limit?: number;
|
|
1284
|
-
}
|
|
1285
|
-
|
|
1286
|
-
export interface InvoiceLineItemInput {
|
|
1287
|
-
itemId?: string;
|
|
1288
|
-
description: string;
|
|
1289
|
-
quantity: string;
|
|
1290
|
-
unitPrice: string;
|
|
1291
|
-
taxPercent?: string;
|
|
1292
|
-
discountPercent?: string;
|
|
1293
|
-
selectedUnit?: string | null;
|
|
1294
|
-
variantId?: string | null;
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
export interface InvoiceCreateInput {
|
|
1298
|
-
partyId: string;
|
|
1299
|
-
type: "sale" | "purchase";
|
|
1300
|
-
documentType?: DocumentType;
|
|
1301
|
-
invoiceDate?: string;
|
|
1302
|
-
dueDate?: string;
|
|
1303
|
-
notes?: string;
|
|
1304
|
-
termsAndConditions?: string;
|
|
1305
|
-
additionalCharges?: string;
|
|
1306
|
-
charges?: Array<{ label: string; amount: string }>;
|
|
1307
|
-
invoiceDiscount?: string;
|
|
1308
|
-
invoiceDiscountType?: "amount" | "percent";
|
|
1309
|
-
roundOff?: string;
|
|
1310
|
-
referenceDocumentId?: string;
|
|
1311
|
-
deliveryMethod?: string;
|
|
1312
|
-
lineItems: InvoiceLineItemInput[];
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
export interface PartySummary {
|
|
1316
|
-
id: string;
|
|
1317
|
-
name: string;
|
|
1318
|
-
type: "customer" | "supplier";
|
|
1319
|
-
phone: string | null;
|
|
1320
|
-
email: string | null;
|
|
1321
|
-
gstin: string | null;
|
|
1322
|
-
balance: string;
|
|
1323
|
-
city: string | null;
|
|
1324
|
-
category: string | null;
|
|
1325
|
-
}
|
|
1326
|
-
|
|
1327
|
-
export interface PartyDetail extends PartySummary {
|
|
1328
|
-
billingAddress: string | null;
|
|
1329
|
-
shippingAddress: string | null;
|
|
1330
|
-
pan: string | null;
|
|
1331
|
-
state: string | null;
|
|
1332
|
-
creditPeriodDays: number | null;
|
|
1333
|
-
creditLimit: string | null;
|
|
1334
|
-
contactPersonName: string | null;
|
|
1335
|
-
openingBalance: string;
|
|
1336
|
-
}
|
|
1337
|
-
|
|
1338
|
-
export interface PartyListInput {
|
|
1339
|
-
type?: "customer" | "supplier" | null;
|
|
1340
|
-
filter?: "all" | "customer" | "supplier" | "outstanding" | "overdue" | null;
|
|
1341
|
-
search?: string | null;
|
|
1342
|
-
category?: string | null;
|
|
1343
|
-
sortBy?: "name" | "balance" | null;
|
|
1344
|
-
sortDir?: "asc" | "desc" | null;
|
|
1345
|
-
page?: number;
|
|
1346
|
-
limit?: number;
|
|
1347
|
-
}
|
|
1348
|
-
|
|
1349
|
-
export interface PartyCreateInput {
|
|
1350
|
-
type: "customer" | "supplier";
|
|
1351
|
-
name: string;
|
|
1352
|
-
phone?: string;
|
|
1353
|
-
email?: string;
|
|
1354
|
-
gstin?: string;
|
|
1355
|
-
pan?: string;
|
|
1356
|
-
billingAddress?: string;
|
|
1357
|
-
shippingAddress?: string;
|
|
1358
|
-
city?: string;
|
|
1359
|
-
state?: string;
|
|
1360
|
-
stateCode?: string;
|
|
1361
|
-
pincode?: string;
|
|
1362
|
-
openingBalance?: string;
|
|
1363
|
-
category?: string;
|
|
1364
|
-
creditPeriodDays?: number;
|
|
1365
|
-
creditLimit?: string;
|
|
1366
|
-
contactPersonName?: string;
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
export interface LedgerEntry {
|
|
1370
|
-
date: string;
|
|
1371
|
-
description: string;
|
|
1372
|
-
debit: string;
|
|
1373
|
-
credit: string;
|
|
1374
|
-
balance: string;
|
|
1375
|
-
referenceType: string;
|
|
1376
|
-
referenceId: string;
|
|
1377
|
-
}
|
|
1378
|
-
|
|
1379
|
-
export interface LedgerResult {
|
|
1380
|
-
partyName: string;
|
|
1381
|
-
partyType: string;
|
|
1382
|
-
openingBalance: string;
|
|
1383
|
-
closingBalance: string;
|
|
1384
|
-
entries: LedgerEntry[];
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1387
|
-
export interface LedgerInput {
|
|
1388
|
-
fromDate?: string;
|
|
1389
|
-
toDate?: string;
|
|
1390
|
-
page?: number;
|
|
1391
|
-
limit?: number;
|
|
1392
|
-
}
|
|
1393
|
-
|
|
1394
|
-
export interface ItemSummary {
|
|
1395
|
-
id: string;
|
|
1396
|
-
name: string;
|
|
1397
|
-
sku: string | null;
|
|
1398
|
-
unit: string;
|
|
1399
|
-
salePrice: string | null;
|
|
1400
|
-
purchasePrice: string | null;
|
|
1401
|
-
taxPercent: string;
|
|
1402
|
-
stockQuantity: string;
|
|
1403
|
-
lowStockAlert: string | null;
|
|
1404
|
-
category: string | null;
|
|
1405
|
-
itemType: "product" | "service";
|
|
1406
|
-
}
|
|
1407
|
-
|
|
1408
|
-
export interface ItemDetail extends ItemSummary {
|
|
1409
|
-
description: string | null;
|
|
1410
|
-
hsn: string | null;
|
|
1411
|
-
itemMode: "simple" | "alt_units" | "variants";
|
|
1412
|
-
taxInclusive: boolean;
|
|
1413
|
-
unitVariants?: Array<{
|
|
1414
|
-
unit: string;
|
|
1415
|
-
conversionFactor: number;
|
|
1416
|
-
salePrice: string;
|
|
1417
|
-
purchasePrice?: string;
|
|
1418
|
-
}>;
|
|
1419
|
-
variants?: Array<{
|
|
1420
|
-
id: string;
|
|
1421
|
-
attributeValues: Record<string, string>;
|
|
1422
|
-
sku?: string;
|
|
1423
|
-
salePrice?: string;
|
|
1424
|
-
purchasePrice?: string;
|
|
1425
|
-
stockQuantity: string;
|
|
1426
|
-
}>;
|
|
1427
|
-
}
|
|
1428
|
-
|
|
1429
|
-
export interface ItemListInput {
|
|
1430
|
-
search?: string | null;
|
|
1431
|
-
category?: string | null;
|
|
1432
|
-
itemType?: "product" | "service" | null;
|
|
1433
|
-
lowStock?: boolean | null;
|
|
1434
|
-
page?: number;
|
|
1435
|
-
limit?: number;
|
|
1436
|
-
}
|
|
1437
|
-
|
|
1438
|
-
export interface ItemCreateInput {
|
|
1439
|
-
name: string;
|
|
1440
|
-
unit?: string;
|
|
1441
|
-
salePrice?: string;
|
|
1442
|
-
purchasePrice?: string;
|
|
1443
|
-
taxPercent?: string;
|
|
1444
|
-
stockQuantity?: string;
|
|
1445
|
-
lowStockAlert?: string;
|
|
1446
|
-
description?: string;
|
|
1447
|
-
hsn?: string;
|
|
1448
|
-
sku?: string;
|
|
1449
|
-
itemType?: "product" | "service";
|
|
1450
|
-
category?: string;
|
|
1451
|
-
}
|
|
1452
|
-
|
|
1453
|
-
export interface StockAdjustInput {
|
|
1454
|
-
itemId: string;
|
|
1455
|
-
adjustment: string;
|
|
1456
|
-
reason?: string;
|
|
1457
|
-
}
|
|
1458
|
-
|
|
1459
|
-
export interface PaymentSummary {
|
|
1460
|
-
id: string;
|
|
1461
|
-
paymentNumber: string;
|
|
1462
|
-
amount: string;
|
|
1463
|
-
discount: string;
|
|
1464
|
-
mode: string;
|
|
1465
|
-
paymentDate: string;
|
|
1466
|
-
referenceNumber: string | null;
|
|
1467
|
-
notes: string | null;
|
|
1468
|
-
partyName: string;
|
|
1469
|
-
partyId: string;
|
|
1470
|
-
invoiceId: string | null;
|
|
1471
|
-
}
|
|
1472
|
-
|
|
1473
|
-
export interface PaymentDetail extends PaymentSummary {
|
|
1474
|
-
bankAccountId: string | null;
|
|
1475
|
-
linkedInvoices: Array<{
|
|
1476
|
-
invoiceId: string;
|
|
1477
|
-
invoiceNumber: string;
|
|
1478
|
-
invoiceDate: string;
|
|
1479
|
-
totalAmount: string;
|
|
1480
|
-
amountPaid: string;
|
|
1481
|
-
status: string;
|
|
1482
|
-
amount: string;
|
|
1483
|
-
}>;
|
|
1484
|
-
}
|
|
1485
|
-
|
|
1486
|
-
export interface PaymentListInput {
|
|
1487
|
-
partyId?: string | null;
|
|
1488
|
-
invoiceId?: string | null;
|
|
1489
|
-
fromDate?: string | null;
|
|
1490
|
-
toDate?: string | null;
|
|
1491
|
-
search?: string | null;
|
|
1492
|
-
page?: number;
|
|
1493
|
-
limit?: number;
|
|
1494
|
-
}
|
|
1495
|
-
|
|
1496
|
-
export interface PaymentCreateInput {
|
|
1497
|
-
partyId: string;
|
|
1498
|
-
amount: string;
|
|
1499
|
-
mode: "cash" | "bank" | "upi" | "cheque" | "other";
|
|
1500
|
-
invoiceId?: string;
|
|
1501
|
-
discount?: string;
|
|
1502
|
-
referenceNumber?: string;
|
|
1503
|
-
paymentDate?: string;
|
|
1504
|
-
notes?: string;
|
|
1505
|
-
bankAccountId?: string;
|
|
1506
|
-
allocations?: Array<{ invoiceId: string; amount: string }>;
|
|
1507
|
-
}
|
|
1508
|
-
|
|
1509
|
-
export interface PaymentUpdateInput {
|
|
1510
|
-
id: string;
|
|
1511
|
-
amount?: string;
|
|
1512
|
-
mode?: "cash" | "bank" | "upi" | "cheque" | "other";
|
|
1513
|
-
discount?: string;
|
|
1514
|
-
referenceNumber?: string | null;
|
|
1515
|
-
paymentDate?: string;
|
|
1516
|
-
notes?: string | null;
|
|
1517
|
-
bankAccountId?: string | null;
|
|
1518
|
-
allocations?: Array<{ invoiceId: string; amount: string }>;
|
|
1519
|
-
}
|
|
1520
|
-
|
|
1521
|
-
export interface ExpenseSummary {
|
|
1522
|
-
id: string;
|
|
1523
|
-
category: string;
|
|
1524
|
-
description: string | null;
|
|
1525
|
-
amount: string;
|
|
1526
|
-
mode: string;
|
|
1527
|
-
expenseDate: string;
|
|
1528
|
-
referenceNumber: string | null;
|
|
1529
|
-
}
|
|
1530
|
-
|
|
1531
|
-
export interface ExpenseListInput {
|
|
1532
|
-
category?: string | null;
|
|
1533
|
-
fromDate?: string | null;
|
|
1534
|
-
toDate?: string | null;
|
|
1535
|
-
search?: string | null;
|
|
1536
|
-
page?: number;
|
|
1537
|
-
limit?: number;
|
|
1538
|
-
}
|
|
1539
|
-
|
|
1540
|
-
export interface ExpenseCreateInput {
|
|
1541
|
-
category: string;
|
|
1542
|
-
amount: string;
|
|
1543
|
-
mode: "cash" | "bank" | "upi" | "cheque" | "other";
|
|
1544
|
-
description?: string;
|
|
1545
|
-
expenseDate?: string;
|
|
1546
|
-
referenceNumber?: string;
|
|
1547
|
-
}
|
|
1548
|
-
|
|
1549
|
-
export interface DashboardInput {
|
|
1550
|
-
fromDate?: string;
|
|
1551
|
-
toDate?: string;
|
|
1552
|
-
}
|
|
1553
|
-
|
|
1554
|
-
export interface DashboardSummary {
|
|
1555
|
-
totalSales: string;
|
|
1556
|
-
totalPurchases: string;
|
|
1557
|
-
totalExpenses: string;
|
|
1558
|
-
receivable: string;
|
|
1559
|
-
payable: string;
|
|
1560
|
-
cashInHand: string;
|
|
1561
|
-
recentInvoices: Array<{
|
|
1562
|
-
id: string;
|
|
1563
|
-
invoiceNumber: string;
|
|
1564
|
-
partyName: string;
|
|
1565
|
-
totalAmount: string;
|
|
1566
|
-
status: string;
|
|
1567
|
-
invoiceDate: string;
|
|
1568
|
-
}>;
|
|
1569
|
-
}
|
|
1570
|
-
|
|
1571
|
-
export interface BusinessSummary {
|
|
1572
|
-
id: string;
|
|
1573
|
-
name: string;
|
|
1574
|
-
legalName: string | null;
|
|
1575
|
-
gstin: string | null;
|
|
1576
|
-
gstRegistrationType: string;
|
|
1577
|
-
}
|
|
1578
|
-
|
|
1579
|
-
export interface BusinessDetail extends BusinessSummary {
|
|
1580
|
-
pan: string;
|
|
1581
|
-
phone: string;
|
|
1582
|
-
email: string | null;
|
|
1583
|
-
address: string;
|
|
1584
|
-
city: string | null;
|
|
1585
|
-
state: string | null;
|
|
1586
|
-
stateCode: string | null;
|
|
1587
|
-
pincode: string | null;
|
|
1588
|
-
invoicePrefix: string;
|
|
1589
|
-
currency: string;
|
|
1590
|
-
financialYearStart: number;
|
|
1591
|
-
}
|
|
1592
|
-
|
|
1593
|
-
export interface GstReportInput {
|
|
1594
|
-
month: number;
|
|
1595
|
-
year: number;
|
|
1596
|
-
}
|
|
1597
|
-
|
|
1598
|
-
export interface GstReportResult {
|
|
1599
|
-
period: string;
|
|
1600
|
-
b2b?: unknown;
|
|
1601
|
-
b2c?: unknown;
|
|
1602
|
-
summary?: unknown;
|
|
1603
|
-
[key: string]: unknown;
|
|
1604
|
-
}
|
|
1605
|
-
|
|
1606
|
-
export type ShipmentStatus = "pending" | "shipped" | "in_transit" | "delivered" | "returned";
|
|
1607
|
-
|
|
1608
|
-
export interface ShipmentSummary {
|
|
1609
|
-
id: string;
|
|
1610
|
-
invoiceId: string | null;
|
|
1611
|
-
partyId: string | null;
|
|
1612
|
-
carrier: string | null;
|
|
1613
|
-
mode: string | null;
|
|
1614
|
-
trackingNumber: string | null;
|
|
1615
|
-
trackingUrl: string | null;
|
|
1616
|
-
cost: string;
|
|
1617
|
-
weight: string | null;
|
|
1618
|
-
status: ShipmentStatus;
|
|
1619
|
-
shipmentDate: string | null;
|
|
1620
|
-
estimatedDelivery: string | null;
|
|
1621
|
-
actualDelivery: string | null;
|
|
1622
|
-
notes: string | null;
|
|
1623
|
-
createdAt: string;
|
|
1624
|
-
invoiceNumber: string | null;
|
|
1625
|
-
partyName: string | null;
|
|
1626
|
-
}
|
|
1627
|
-
|
|
1628
|
-
export interface ShipmentDetail extends ShipmentSummary {
|
|
1629
|
-
businessId: string;
|
|
1630
|
-
shippingAddress: string | null;
|
|
1631
|
-
shippingCity: string | null;
|
|
1632
|
-
shippingPincode: string | null;
|
|
1633
|
-
updatedAt: string;
|
|
1634
|
-
}
|
|
1635
|
-
|
|
1636
|
-
export interface ShipmentListInput {
|
|
1637
|
-
status?: ShipmentStatus | null;
|
|
1638
|
-
invoiceId?: string | null;
|
|
1639
|
-
partyId?: string | null;
|
|
1640
|
-
page?: number;
|
|
1641
|
-
limit?: number;
|
|
1642
|
-
}
|
|
1643
|
-
|
|
1644
|
-
export interface ShipmentCreateInput {
|
|
1645
|
-
invoiceId?: string;
|
|
1646
|
-
partyId?: string;
|
|
1647
|
-
carrier?: string;
|
|
1648
|
-
mode?: string;
|
|
1649
|
-
trackingNumber?: string;
|
|
1650
|
-
trackingUrl?: string;
|
|
1651
|
-
cost?: string;
|
|
1652
|
-
weight?: string;
|
|
1653
|
-
shippingAddress?: string;
|
|
1654
|
-
shippingCity?: string;
|
|
1655
|
-
shippingPincode?: string;
|
|
1656
|
-
status?: ShipmentStatus;
|
|
1657
|
-
shipmentDate?: string;
|
|
1658
|
-
estimatedDelivery?: string;
|
|
1659
|
-
notes?: string;
|
|
1660
|
-
}
|
|
1661
|
-
|
|
1662
|
-
export interface ShipmentUpdateInput {
|
|
1663
|
-
id: string;
|
|
1664
|
-
carrier?: string;
|
|
1665
|
-
mode?: string;
|
|
1666
|
-
trackingNumber?: string;
|
|
1667
|
-
trackingUrl?: string;
|
|
1668
|
-
cost?: string;
|
|
1669
|
-
weight?: string;
|
|
1670
|
-
status?: ShipmentStatus;
|
|
1671
|
-
shipmentDate?: string;
|
|
1672
|
-
estimatedDelivery?: string;
|
|
1673
|
-
actualDelivery?: string;
|
|
1674
|
-
notes?: string;
|
|
1675
|
-
}
|
|
1676
|
-
|
|
1677
|
-
export type BankAccountType = "savings" | "current" | "cash" | "credit" | "other" | "payment_gateway";
|
|
1678
|
-
|
|
1679
|
-
export interface GatewayChargeRate {
|
|
1680
|
-
type: "percentage" | "flat";
|
|
1681
|
-
value: string;
|
|
1682
|
-
}
|
|
1683
|
-
|
|
1684
|
-
export interface GatewayChargeConfig {
|
|
1685
|
-
credit_card?: GatewayChargeRate;
|
|
1686
|
-
debit_card?: GatewayChargeRate;
|
|
1687
|
-
upi?: GatewayChargeRate;
|
|
1688
|
-
net_banking?: GatewayChargeRate;
|
|
1689
|
-
wallet?: GatewayChargeRate;
|
|
1690
|
-
default?: GatewayChargeRate;
|
|
1691
|
-
}
|
|
1692
|
-
|
|
1693
|
-
export interface GatewayConfig {
|
|
1694
|
-
id: string;
|
|
1695
|
-
businessId: string;
|
|
1696
|
-
bankAccountId: string;
|
|
1697
|
-
settlementAccountId: string;
|
|
1698
|
-
chargeConfig: GatewayChargeConfig;
|
|
1699
|
-
expenseCategory: string;
|
|
1700
|
-
autoSettle: boolean;
|
|
1701
|
-
isActive: boolean;
|
|
1702
|
-
createdAt: string;
|
|
1703
|
-
updatedAt: string;
|
|
1704
|
-
}
|
|
1705
|
-
|
|
1706
|
-
export interface UpsertGatewayConfigInput {
|
|
1707
|
-
bankAccountId: string;
|
|
1708
|
-
settlementAccountId: string;
|
|
1709
|
-
chargeConfig: GatewayChargeConfig;
|
|
1710
|
-
expenseCategory?: string;
|
|
1711
|
-
autoSettle?: boolean;
|
|
1712
|
-
}
|
|
1713
|
-
|
|
1714
|
-
export interface BankAccountSummary {
|
|
1715
|
-
id: string;
|
|
1716
|
-
accountName: string;
|
|
1717
|
-
accountNumber: string | null;
|
|
1718
|
-
ifsc: string | null;
|
|
1719
|
-
bankName: string | null;
|
|
1720
|
-
accountType: BankAccountType;
|
|
1721
|
-
openingBalance: string;
|
|
1722
|
-
currentBalance: string;
|
|
1723
|
-
isDefault: boolean;
|
|
1724
|
-
createdAt: string;
|
|
1725
|
-
}
|
|
1726
|
-
|
|
1727
|
-
export interface BankAccountDetail extends BankAccountSummary {
|
|
1728
|
-
recentTransactions: BankTransactionRow[];
|
|
1729
|
-
}
|
|
1730
|
-
|
|
1731
|
-
export interface BankTransactionRow {
|
|
1732
|
-
id: string;
|
|
1733
|
-
businessId: string;
|
|
1734
|
-
bankAccountId: string;
|
|
1735
|
-
type: "deposit" | "withdrawal" | "transfer";
|
|
1736
|
-
amount: string;
|
|
1737
|
-
description: string | null;
|
|
1738
|
-
referenceType: string | null;
|
|
1739
|
-
referenceId: string | null;
|
|
1740
|
-
transactionDate: string;
|
|
1741
|
-
createdAt: string;
|
|
1742
|
-
balanceAfter: string;
|
|
1743
|
-
}
|
|
1744
|
-
|
|
1745
|
-
export interface BankAccountCreateInput {
|
|
1746
|
-
accountName: string;
|
|
1747
|
-
accountNumber?: string;
|
|
1748
|
-
ifsc?: string;
|
|
1749
|
-
bankName?: string;
|
|
1750
|
-
accountType: BankAccountType;
|
|
1751
|
-
openingBalance?: string;
|
|
1752
|
-
isDefault?: boolean;
|
|
1753
|
-
}
|
|
1754
|
-
|
|
1755
|
-
export interface BankTransferInput {
|
|
1756
|
-
fromAccountId: string;
|
|
1757
|
-
toAccountId: string;
|
|
1758
|
-
amount: string;
|
|
1759
|
-
description?: string;
|
|
1760
|
-
transactionDate?: string;
|
|
1761
|
-
}
|
|
1762
|
-
|
|
1763
|
-
export interface BankTransferResult {
|
|
1764
|
-
withdrawal: BankTransactionRow;
|
|
1765
|
-
deposit: BankTransactionRow;
|
|
1766
|
-
}
|
|
1767
|
-
|
|
1768
|
-
export interface BankTransactionListInput {
|
|
1769
|
-
bankAccountId: string;
|
|
1770
|
-
fromDate?: string;
|
|
1771
|
-
toDate?: string;
|
|
1772
|
-
type?: "deposit" | "withdrawal" | "transfer";
|
|
1773
|
-
page?: number;
|
|
1774
|
-
limit?: number;
|
|
1775
|
-
}
|
|
1776
|
-
|
|
1777
|
-
export interface BankSummary {
|
|
1778
|
-
totalBalance: string;
|
|
1779
|
-
cashInHand: string;
|
|
1780
|
-
bankBalance: string;
|
|
1781
|
-
accountCount: number;
|
|
1782
|
-
}
|
|
1783
|
-
|
|
1784
|
-
export interface DaybookInput {
|
|
1785
|
-
fromDate: string;
|
|
1786
|
-
toDate: string;
|
|
1787
|
-
typeFilter?: "all" | "invoices" | "payments" | "expenses";
|
|
1788
|
-
}
|
|
1789
|
-
|
|
1790
|
-
export interface DaybookEntry {
|
|
1791
|
-
id: string;
|
|
1792
|
-
time: string;
|
|
1793
|
-
entryType: "invoice" | "payment" | "expense";
|
|
1794
|
-
number: string | null;
|
|
1795
|
-
partyOrCategory: string;
|
|
1796
|
-
debit: string;
|
|
1797
|
-
credit: string;
|
|
1798
|
-
mode: string | null;
|
|
1799
|
-
status: string | null;
|
|
1800
|
-
meta: Record<string, string | null>;
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
export interface DaybookResult {
|
|
1804
|
-
entries: DaybookEntry[];
|
|
1805
|
-
summary: {
|
|
1806
|
-
totalSalesInvoiced: string;
|
|
1807
|
-
totalPurchaseInvoiced: string;
|
|
1808
|
-
totalPaymentsReceived: string;
|
|
1809
|
-
totalPaymentsMade: string;
|
|
1810
|
-
totalExpenses: string;
|
|
1811
|
-
netCashMovement: string;
|
|
1812
|
-
};
|
|
1813
|
-
}
|
|
1814
|
-
|
|
1815
|
-
export interface OutstandingInput {
|
|
1816
|
-
type?: "receivable" | "payable" | "both";
|
|
1817
|
-
asOfDate?: string;
|
|
1818
|
-
}
|
|
1819
|
-
|
|
1820
|
-
export interface OutstandingResult {
|
|
1821
|
-
receivables: unknown | null;
|
|
1822
|
-
payables: unknown | null;
|
|
1823
|
-
}
|
|
1824
|
-
|
|
1825
|
-
export interface TaxSummaryInput {
|
|
1826
|
-
fromDate: string;
|
|
1827
|
-
toDate: string;
|
|
1828
|
-
type?: "sales" | "purchases" | "both";
|
|
1829
|
-
}
|
|
1830
|
-
|
|
1831
|
-
export interface TaxSummaryResult {
|
|
1832
|
-
rows: unknown[];
|
|
1833
|
-
summary: unknown;
|
|
1834
|
-
}
|
|
1835
|
-
|
|
1836
|
-
export interface ItemSalesInput {
|
|
1837
|
-
fromDate: string;
|
|
1838
|
-
toDate: string;
|
|
1839
|
-
category?: string;
|
|
1840
|
-
itemType?: "product" | "service";
|
|
1841
|
-
sortBy?: "revenue" | "quantity" | "invoices" | "margin";
|
|
1842
|
-
compareToPrevious?: boolean;
|
|
1843
|
-
}
|
|
1844
|
-
|
|
1845
|
-
export interface ItemSalesResult {
|
|
1846
|
-
rows: unknown[];
|
|
1847
|
-
summary: unknown;
|
|
1848
|
-
[key: string]: unknown;
|
|
1849
|
-
}
|
|
1850
|
-
|
|
1851
|
-
export interface StockSummaryInput {
|
|
1852
|
-
category?: string;
|
|
1853
|
-
showZeroStock?: boolean;
|
|
1854
|
-
}
|
|
1855
|
-
|
|
1856
|
-
export interface StockSummaryResult {
|
|
1857
|
-
rows: unknown[];
|
|
1858
|
-
summary: unknown;
|
|
1859
|
-
[key: string]: unknown;
|
|
1860
|
-
}
|
|
1861
|
-
|
|
1862
|
-
export interface PartyStatementInput {
|
|
1863
|
-
partyId: string;
|
|
1864
|
-
fromDate?: string;
|
|
1865
|
-
toDate?: string;
|
|
1866
|
-
}
|
|
1867
|
-
|
|
1868
|
-
export interface PartyStatementResult {
|
|
1869
|
-
[key: string]: unknown;
|
|
1870
|
-
}
|
|
1871
|
-
|
|
1872
|
-
export interface PaymentSummaryInput {
|
|
1873
|
-
fromDate: string;
|
|
1874
|
-
toDate: string;
|
|
1875
|
-
type?: "received" | "made" | "both";
|
|
1876
|
-
bankAccountId?: string;
|
|
1877
|
-
}
|
|
1878
|
-
|
|
1879
|
-
export interface PaymentSummaryResult {
|
|
1880
|
-
[key: string]: unknown;
|
|
1881
|
-
}
|
|
1882
|
-
|
|
1883
|
-
export interface StoreSettings {
|
|
1884
|
-
storeEnabled: boolean;
|
|
1885
|
-
storeSlug: string | null;
|
|
1886
|
-
storeName: string | null;
|
|
1887
|
-
storeDescription: string | null;
|
|
1888
|
-
[key: string]: unknown;
|
|
1889
|
-
}
|
|
1890
|
-
|
|
1891
|
-
export interface StoreSettingsUpdateInput {
|
|
1892
|
-
storeEnabled?: boolean;
|
|
1893
|
-
storeSlug?: string;
|
|
1894
|
-
storeName?: string;
|
|
1895
|
-
storeDescription?: string;
|
|
1896
|
-
[key: string]: unknown;
|
|
1897
|
-
}
|
|
1898
|
-
|
|
1899
|
-
export interface StoreOrderSummary {
|
|
1900
|
-
id: string;
|
|
1901
|
-
orderNumber: string;
|
|
1902
|
-
customerName: string;
|
|
1903
|
-
totalAmount: string;
|
|
1904
|
-
status: string;
|
|
1905
|
-
createdAt: string;
|
|
1906
|
-
}
|
|
1907
|
-
|
|
1908
|
-
export interface StoreOrderDetail extends StoreOrderSummary {
|
|
1909
|
-
items: Array<{ name: string; quantity: number; price: string }>;
|
|
1910
|
-
shippingAddress: string | null;
|
|
1911
|
-
notes: string | null;
|
|
1912
|
-
}
|
|
1913
|
-
|
|
1914
|
-
export interface StoreOrderListInput {
|
|
1915
|
-
status?: string | null;
|
|
1916
|
-
page?: number;
|
|
1917
|
-
limit?: number;
|
|
1918
|
-
}
|
|
1919
|
-
|
|
1920
|
-
export type TargetType = "order_count" | "order_value" | "item_quantity";
|
|
1921
|
-
export type TargetPeriod = "daily" | "weekly" | "monthly" | "quarterly" | "custom";
|
|
1922
|
-
|
|
1923
|
-
export interface TargetRow {
|
|
1924
|
-
id: string;
|
|
1925
|
-
type: TargetType;
|
|
1926
|
-
period: TargetPeriod;
|
|
1927
|
-
targetValue: string;
|
|
1928
|
-
startDate: string;
|
|
1929
|
-
endDate: string | null;
|
|
1930
|
-
assignedToId: string | null;
|
|
1931
|
-
itemId: string | null;
|
|
1932
|
-
notes: string | null;
|
|
1933
|
-
}
|
|
1934
|
-
|
|
1935
|
-
export interface TargetWithProgress extends TargetRow {
|
|
1936
|
-
currentValue: string;
|
|
1937
|
-
percentComplete: number;
|
|
1938
|
-
}
|
|
1939
|
-
|
|
1940
|
-
export interface TargetListInput {
|
|
1941
|
-
type?: TargetType | null;
|
|
1942
|
-
period?: TargetPeriod | null;
|
|
1943
|
-
page?: number;
|
|
1944
|
-
limit?: number;
|
|
1945
|
-
}
|
|
1946
|
-
|
|
1947
|
-
export interface TargetCreateInput {
|
|
1948
|
-
type: TargetType;
|
|
1949
|
-
period: TargetPeriod;
|
|
1950
|
-
targetValue: string;
|
|
1951
|
-
startDate: string;
|
|
1952
|
-
endDate?: string;
|
|
1953
|
-
assignedToId?: string;
|
|
1954
|
-
itemId?: string;
|
|
1955
|
-
notes?: string;
|
|
1956
|
-
}
|
|
1957
|
-
|
|
1958
|
-
export interface TargetUpdateInput {
|
|
1959
|
-
id: string;
|
|
1960
|
-
targetValue?: string;
|
|
1961
|
-
endDate?: string;
|
|
1962
|
-
notes?: string;
|
|
1963
|
-
}
|
|
1964
|
-
|
|
1965
|
-
export interface ImportPartiesInput {
|
|
1966
|
-
parties: Array<Record<string, unknown>>;
|
|
1967
|
-
}
|
|
1968
|
-
|
|
1969
|
-
export interface ImportItemsInput {
|
|
1970
|
-
items: Array<Record<string, unknown>>;
|
|
1971
|
-
}
|
|
1972
|
-
|
|
1973
|
-
export interface ImportInvoicesInput {
|
|
1974
|
-
invoices: Array<Record<string, unknown>>;
|
|
1975
|
-
}
|
|
1976
|
-
|
|
1977
|
-
export interface ImportPaymentsInput {
|
|
1978
|
-
payments: Array<Record<string, unknown>>;
|
|
1979
|
-
}
|
|
1980
|
-
|
|
1981
|
-
export interface ImportResult {
|
|
1982
|
-
imported: number;
|
|
1983
|
-
skipped: number;
|
|
1984
|
-
errors: Array<{ row: number; message: string }>;
|
|
1985
|
-
}
|
|
1986
|
-
|
|
1987
|
-
export interface ImportItemsResult extends ImportResult {
|
|
1988
|
-
created: number;
|
|
1989
|
-
}
|
|
1990
|
-
|
|
1991
|
-
// ── Recurring Invoice types ───────────────────────────────────────────────
|
|
1992
|
-
|
|
1993
|
-
export type RecurringInvoiceStatus = "active" | "paused" | "completed" | "expired";
|
|
1994
|
-
export type RecurringInvoiceFrequency = "weekly" | "biweekly" | "monthly" | "quarterly" | "half_yearly" | "yearly" | "custom";
|
|
1995
|
-
|
|
1996
|
-
export interface RecurringInvoiceSummary {
|
|
1997
|
-
id: string;
|
|
1998
|
-
name: string;
|
|
1999
|
-
partyName: string;
|
|
2000
|
-
type: "sale" | "purchase";
|
|
2001
|
-
frequency: RecurringInvoiceFrequency;
|
|
2002
|
-
status: RecurringInvoiceStatus;
|
|
2003
|
-
nextRunDate: string | null;
|
|
2004
|
-
lastRunDate: string | null;
|
|
2005
|
-
totalRuns: number;
|
|
2006
|
-
maxRuns: number | null;
|
|
2007
|
-
startDate: string;
|
|
2008
|
-
endDate: string | null;
|
|
2009
|
-
createdAt: string;
|
|
2010
|
-
}
|
|
2011
|
-
|
|
2012
|
-
export interface RecurringInvoiceLineItem {
|
|
2013
|
-
description: string;
|
|
2014
|
-
quantity: string;
|
|
2015
|
-
unitPrice: string;
|
|
2016
|
-
taxPercent?: string;
|
|
2017
|
-
discountPercent?: string;
|
|
2018
|
-
}
|
|
2019
|
-
|
|
2020
|
-
export interface RecurringInvoiceDetail extends RecurringInvoiceSummary {
|
|
2021
|
-
partyId: string;
|
|
2022
|
-
customIntervalDays: number | null;
|
|
2023
|
-
lineItems: RecurringInvoiceLineItem[];
|
|
2024
|
-
notes: string | null;
|
|
2025
|
-
}
|
|
2026
|
-
|
|
2027
|
-
export interface RecurringInvoiceListInput {
|
|
2028
|
-
status?: RecurringInvoiceStatus;
|
|
2029
|
-
page?: number;
|
|
2030
|
-
limit?: number;
|
|
2031
|
-
}
|
|
2032
|
-
|
|
2033
|
-
export interface RecurringInvoiceCreateInput {
|
|
2034
|
-
partyId: string;
|
|
2035
|
-
name: string;
|
|
2036
|
-
type: "sale" | "purchase";
|
|
2037
|
-
frequency: RecurringInvoiceFrequency;
|
|
2038
|
-
customIntervalDays?: number;
|
|
2039
|
-
lineItems: Array<{
|
|
2040
|
-
description: string;
|
|
2041
|
-
quantity: string;
|
|
2042
|
-
unitPrice: string;
|
|
2043
|
-
taxPercent?: string;
|
|
2044
|
-
discountPercent?: string;
|
|
2045
|
-
}>;
|
|
2046
|
-
startDate: string;
|
|
2047
|
-
endDate?: string;
|
|
2048
|
-
maxRuns?: number;
|
|
2049
|
-
notes?: string;
|
|
2050
|
-
}
|
|
2051
|
-
|
|
2052
|
-
export interface RecurringInvoiceExecution {
|
|
2053
|
-
id: string;
|
|
2054
|
-
invoiceNumber: string;
|
|
2055
|
-
status: string;
|
|
2056
|
-
errorMessage: string | null;
|
|
2057
|
-
executedAt: string;
|
|
2058
|
-
}
|
|
2059
|
-
|
|
2060
|
-
export interface RecurringInvoicePlanUsage {
|
|
2061
|
-
runsThisMonth: number;
|
|
2062
|
-
totalTemplates: number;
|
|
2063
|
-
}
|
|
2064
|
-
|
|
2065
|
-
export interface RecurringInvoiceSuggestion {
|
|
2066
|
-
partyId: string;
|
|
2067
|
-
partyName: string;
|
|
2068
|
-
frequency: string;
|
|
2069
|
-
confidence: number;
|
|
2070
|
-
reason: string;
|
|
2071
|
-
}
|