timber-node 0.0.1
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 +0 -0
- package/dist/billPayment.d.ts +115 -0
- package/dist/billPayment.js +144 -0
- package/dist/customer.d.ts +93 -0
- package/dist/customer.js +82 -0
- package/dist/employee.d.ts +120 -0
- package/dist/employee.js +99 -0
- package/dist/expense.d.ts +116 -0
- package/dist/expense.js +105 -0
- package/dist/expenseCategory.d.ts +95 -0
- package/dist/expenseCategory.js +87 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +50 -0
- package/dist/invoice.d.ts +109 -0
- package/dist/invoice.js +100 -0
- package/dist/invoicePayment.d.ts +119 -0
- package/dist/invoicePayment.js +113 -0
- package/dist/rawExpense.d.ts +87 -0
- package/dist/rawExpense.js +76 -0
- package/dist/salary.d.ts +121 -0
- package/dist/salary.js +101 -0
- package/dist/taxRate.d.ts +36 -0
- package/dist/taxRate.js +26 -0
- package/dist/vendorPayment.d.ts +195 -0
- package/dist/vendorPayment.js +236 -0
- package/package.json +46 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { AxiosInstance, AxiosResponse } from "axios";
|
|
2
|
+
export interface InvoicePaymentData {
|
|
3
|
+
invoice: string;
|
|
4
|
+
date: string;
|
|
5
|
+
payment_method: string;
|
|
6
|
+
cheque_no?: string;
|
|
7
|
+
cheque_date?: string;
|
|
8
|
+
bank_name?: string;
|
|
9
|
+
file?: string;
|
|
10
|
+
amount: string;
|
|
11
|
+
}
|
|
12
|
+
export interface InvoicePayment extends InvoicePaymentData {
|
|
13
|
+
_id: string;
|
|
14
|
+
created_at?: string;
|
|
15
|
+
updated_at?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface InvoicePaymentQueryParams {
|
|
18
|
+
page?: number;
|
|
19
|
+
limit?: number;
|
|
20
|
+
invoice: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Service for Invoice Payment
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const { createClient } = require('timber-sdk-dev');
|
|
28
|
+
* const client = createClient('your-api-key');
|
|
29
|
+
* const invoicePayment = await client.invoicePayment.list({ page: 1, limit: 10 });
|
|
30
|
+
* console.log(invoicePayment.data);
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare class InvoicePaymentService {
|
|
34
|
+
private http;
|
|
35
|
+
constructor(http: AxiosInstance);
|
|
36
|
+
/**
|
|
37
|
+
* Fetch a paginated list of invoice payments.
|
|
38
|
+
*
|
|
39
|
+
* @param params - Query options like page, limit, filters, sort.
|
|
40
|
+
* @returns List of invoice payments matching the query.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* const invoicePayments = await client.invoicePayment.list({ page: 1, limit: 5 });
|
|
45
|
+
* console.log(invoicePayments.data);
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
list(params?: InvoicePaymentQueryParams): Promise<AxiosResponse<InvoicePayment[]>>;
|
|
49
|
+
/**
|
|
50
|
+
* Create a new invoice payment.
|
|
51
|
+
*
|
|
52
|
+
* @param data - Invoice payment creation payload
|
|
53
|
+
* @returns The created invoice payment
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const newInvoicePayment = {
|
|
58
|
+
* invoice: "INV-1234",
|
|
59
|
+
* date: "2025-06-23",
|
|
60
|
+
* payment_method: "cash",
|
|
61
|
+
* cheque_no: "123456789",
|
|
62
|
+
* cheque_date: "2025-06-23",
|
|
63
|
+
* cheque_due_date: "2025-06-23",
|
|
64
|
+
* amount: 45.75,
|
|
65
|
+
* bank_name: "Bank of America",
|
|
66
|
+
* is_paid: false,
|
|
67
|
+
* file: [File],
|
|
68
|
+
* };
|
|
69
|
+
* const response = await client.invoicePayment.create(newInvoicePayment);
|
|
70
|
+
* console.log(response.data);
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
create(data: InvoicePaymentData): Promise<AxiosResponse<InvoicePayment>>;
|
|
74
|
+
/**
|
|
75
|
+
* Update an existing invoice payment.
|
|
76
|
+
*
|
|
77
|
+
* @param id - Invoice payment ID
|
|
78
|
+
* @param data - Partial update data
|
|
79
|
+
* @returns Updated invoice payment
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* const updates = { amount: 50.0 };
|
|
84
|
+
* const updated = await client.invoicePayment.update('invoice_payment_id_here', updates);
|
|
85
|
+
* console.log(updated.data);
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
update(id: string, data: Partial<InvoicePaymentData>): Promise<AxiosResponse<InvoicePayment>>;
|
|
89
|
+
/**
|
|
90
|
+
* Delete an invoice payment by ID.
|
|
91
|
+
*
|
|
92
|
+
* @param id - Invoice payment ID
|
|
93
|
+
* @returns Confirmation message
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* const response = await client.invoicePayment.delete('invoice_payment_id_here');
|
|
98
|
+
* console.log(response.data.message);
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
get(id: string): Promise<AxiosResponse<InvoicePayment>>;
|
|
102
|
+
/**
|
|
103
|
+
* Delete an invoice payment by ID.
|
|
104
|
+
*
|
|
105
|
+
* @param id - Invoice payment ID
|
|
106
|
+
* @returns Confirmation message
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* const response = await client.invoicePayment.delete('invoice_payment_id_here');
|
|
111
|
+
* console.log(response.data.message);
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
delete(id: string, data: {
|
|
115
|
+
remarks: string;
|
|
116
|
+
}): Promise<AxiosResponse<{
|
|
117
|
+
message: string;
|
|
118
|
+
}>>;
|
|
119
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvoicePaymentService = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Service for Invoice Payment
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const { createClient } = require('timber-sdk-dev');
|
|
10
|
+
* const client = createClient('your-api-key');
|
|
11
|
+
* const invoicePayment = await client.invoicePayment.list({ page: 1, limit: 10 });
|
|
12
|
+
* console.log(invoicePayment.data);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
class InvoicePaymentService {
|
|
16
|
+
constructor(http) {
|
|
17
|
+
this.http = http;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Fetch a paginated list of invoice payments.
|
|
21
|
+
*
|
|
22
|
+
* @param params - Query options like page, limit, filters, sort.
|
|
23
|
+
* @returns List of invoice payments matching the query.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const invoicePayments = await client.invoicePayment.list({ page: 1, limit: 5 });
|
|
28
|
+
* console.log(invoicePayments.data);
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
async list(params = {
|
|
32
|
+
invoice: "",
|
|
33
|
+
}) {
|
|
34
|
+
return await this.http.get("/customer/invoice/payment-records", { params });
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Create a new invoice payment.
|
|
38
|
+
*
|
|
39
|
+
* @param data - Invoice payment creation payload
|
|
40
|
+
* @returns The created invoice payment
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* const newInvoicePayment = {
|
|
45
|
+
* invoice: "INV-1234",
|
|
46
|
+
* date: "2025-06-23",
|
|
47
|
+
* payment_method: "cash",
|
|
48
|
+
* cheque_no: "123456789",
|
|
49
|
+
* cheque_date: "2025-06-23",
|
|
50
|
+
* cheque_due_date: "2025-06-23",
|
|
51
|
+
* amount: 45.75,
|
|
52
|
+
* bank_name: "Bank of America",
|
|
53
|
+
* is_paid: false,
|
|
54
|
+
* file: [File],
|
|
55
|
+
* };
|
|
56
|
+
* const response = await client.invoicePayment.create(newInvoicePayment);
|
|
57
|
+
* console.log(response.data);
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
async create(data) {
|
|
61
|
+
return await this.http.post("/customer/invoice/payment-records", data);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Update an existing invoice payment.
|
|
65
|
+
*
|
|
66
|
+
* @param id - Invoice payment ID
|
|
67
|
+
* @param data - Partial update data
|
|
68
|
+
* @returns Updated invoice payment
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const updates = { amount: 50.0 };
|
|
73
|
+
* const updated = await client.invoicePayment.update('invoice_payment_id_here', updates);
|
|
74
|
+
* console.log(updated.data);
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
async update(id, data) {
|
|
78
|
+
return await this.http.put(`/customer/invoice/payment-records/${id}`, data);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Delete an invoice payment by ID.
|
|
82
|
+
*
|
|
83
|
+
* @param id - Invoice payment ID
|
|
84
|
+
* @returns Confirmation message
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* const response = await client.invoicePayment.delete('invoice_payment_id_here');
|
|
89
|
+
* console.log(response.data.message);
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
async get(id) {
|
|
93
|
+
return await this.http.get(`/customer/invoice/payment-records/${id}`);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Delete an invoice payment by ID.
|
|
97
|
+
*
|
|
98
|
+
* @param id - Invoice payment ID
|
|
99
|
+
* @returns Confirmation message
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```ts
|
|
103
|
+
* const response = await client.invoicePayment.delete('invoice_payment_id_here');
|
|
104
|
+
* console.log(response.data.message);
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
async delete(id, data) {
|
|
108
|
+
return await this.http.delete(`/customer/invoice/payment-records/${id}`, {
|
|
109
|
+
data,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
exports.InvoicePaymentService = InvoicePaymentService;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { AxiosInstance, AxiosResponse } from "axios";
|
|
2
|
+
export interface CreateRawExpenseRequest {
|
|
3
|
+
file: File;
|
|
4
|
+
}
|
|
5
|
+
export interface RawExpense {
|
|
6
|
+
_id: string;
|
|
7
|
+
user: string;
|
|
8
|
+
company: string;
|
|
9
|
+
status: string;
|
|
10
|
+
expense_id: string;
|
|
11
|
+
files: [
|
|
12
|
+
{
|
|
13
|
+
name: string;
|
|
14
|
+
type: string;
|
|
15
|
+
url: string;
|
|
16
|
+
size: number;
|
|
17
|
+
extension: string;
|
|
18
|
+
}
|
|
19
|
+
];
|
|
20
|
+
created_at: string;
|
|
21
|
+
updated_at: string;
|
|
22
|
+
}
|
|
23
|
+
export interface RawExpenseQueryParams {
|
|
24
|
+
page: number;
|
|
25
|
+
limit: number;
|
|
26
|
+
sort: string;
|
|
27
|
+
filters: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Service for Raw Expense
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const { createClient } = require('timber-sdk-dev');
|
|
35
|
+
* const client = createClient('your-api-key');
|
|
36
|
+
* const rawExpense = await client.rawExpense.list({ page: 1, limit: 10 });
|
|
37
|
+
* console.log(rawExpense.data);
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare class RawExpenseService {
|
|
41
|
+
private http;
|
|
42
|
+
constructor(http: AxiosInstance);
|
|
43
|
+
/**
|
|
44
|
+
* Fetch a paginated list of raw expenses.
|
|
45
|
+
*
|
|
46
|
+
* @param params - Query options like page, limit, filters, sort.
|
|
47
|
+
* @returns List of raw expenses matching the query.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* const rawExpenses = await client.rawExpense.list({ page: 1, limit: 5 });
|
|
52
|
+
* console.log(rawExpenses.data);
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
list(params: RawExpenseQueryParams): Promise<AxiosResponse<RawExpense[]>>;
|
|
56
|
+
/**
|
|
57
|
+
* Create a new raw expense.
|
|
58
|
+
*
|
|
59
|
+
* @param data - Raw expense creation payload
|
|
60
|
+
* @returns The created raw expense
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* const newRawExpense = {
|
|
65
|
+
* file: [File],
|
|
66
|
+
* };
|
|
67
|
+
* const response = await client.rawExpense.create(newRawExpense);
|
|
68
|
+
* console.log(response.data);
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
create(data: CreateRawExpenseRequest): Promise<AxiosResponse<RawExpense>>;
|
|
72
|
+
/**
|
|
73
|
+
* Delete an raw expense by ID.
|
|
74
|
+
*
|
|
75
|
+
* @param id - Raw expense ID
|
|
76
|
+
* @returns Confirmation message
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* const response = await client.rawExpense.delete('raw_expense_id_here');
|
|
81
|
+
* console.log(response.data.message);
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
delete(id: string): Promise<AxiosResponse<{
|
|
85
|
+
message: string;
|
|
86
|
+
}>>;
|
|
87
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RawExpenseService = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Service for Raw Expense
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const { createClient } = require('timber-sdk-dev');
|
|
10
|
+
* const client = createClient('your-api-key');
|
|
11
|
+
* const rawExpense = await client.rawExpense.list({ page: 1, limit: 10 });
|
|
12
|
+
* console.log(rawExpense.data);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
class RawExpenseService {
|
|
16
|
+
constructor(http) {
|
|
17
|
+
this.http = http;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Fetch a paginated list of raw expenses.
|
|
21
|
+
*
|
|
22
|
+
* @param params - Query options like page, limit, filters, sort.
|
|
23
|
+
* @returns List of raw expenses matching the query.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const rawExpenses = await client.rawExpense.list({ page: 1, limit: 5 });
|
|
28
|
+
* console.log(rawExpenses.data);
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
async list(params) {
|
|
32
|
+
return await this.http.get("/customer/expense/raw", {
|
|
33
|
+
params,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Create a new raw expense.
|
|
38
|
+
*
|
|
39
|
+
* @param data - Raw expense creation payload
|
|
40
|
+
* @returns The created raw expense
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* const newRawExpense = {
|
|
45
|
+
* file: [File],
|
|
46
|
+
* };
|
|
47
|
+
* const response = await client.rawExpense.create(newRawExpense);
|
|
48
|
+
* console.log(response.data);
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
async create(data) {
|
|
52
|
+
const formData = new FormData();
|
|
53
|
+
formData.append("file", data.file);
|
|
54
|
+
return await this.http.post("/customer/expense/raw", formData, {
|
|
55
|
+
headers: {
|
|
56
|
+
"Content-Type": "multipart/form-data",
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Delete an raw expense by ID.
|
|
62
|
+
*
|
|
63
|
+
* @param id - Raw expense ID
|
|
64
|
+
* @returns Confirmation message
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* const response = await client.rawExpense.delete('raw_expense_id_here');
|
|
69
|
+
* console.log(response.data.message);
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
async delete(id) {
|
|
73
|
+
return await this.http.delete(`/customer/expense/raw/${id}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.RawExpenseService = RawExpenseService;
|
package/dist/salary.d.ts
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { AxiosInstance, AxiosResponse } from "axios";
|
|
2
|
+
export interface CreateSalaryData {
|
|
3
|
+
month: number;
|
|
4
|
+
year: number;
|
|
5
|
+
}
|
|
6
|
+
export type UpdateSalaryData = Partial<CreateSalaryData>;
|
|
7
|
+
export interface Salary {
|
|
8
|
+
_id: string;
|
|
9
|
+
user: string;
|
|
10
|
+
company: string;
|
|
11
|
+
employee: string;
|
|
12
|
+
month: string;
|
|
13
|
+
year: string;
|
|
14
|
+
basic_salary: number;
|
|
15
|
+
allowance: number;
|
|
16
|
+
deduction: number;
|
|
17
|
+
incentive: number;
|
|
18
|
+
overtime: number;
|
|
19
|
+
net_salary: number;
|
|
20
|
+
is_paid: boolean;
|
|
21
|
+
paid_date: string;
|
|
22
|
+
wafeq_expense_id: string;
|
|
23
|
+
zoho_expense_id: string;
|
|
24
|
+
qb_expense_id: string;
|
|
25
|
+
xero_expense_id: string;
|
|
26
|
+
reconciled: boolean;
|
|
27
|
+
created_at: string;
|
|
28
|
+
updated_at: string;
|
|
29
|
+
}
|
|
30
|
+
export interface SalaryQueryParams {
|
|
31
|
+
page: number;
|
|
32
|
+
limit: number;
|
|
33
|
+
sort: string;
|
|
34
|
+
filters: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Service for Salary
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* const { createClient } = require('timber-sdk-dev');
|
|
42
|
+
* const client = createClient('your-api-key');
|
|
43
|
+
* const salary = await client.salary.list({ page: 1, limit: 10 });
|
|
44
|
+
* console.log(salary.data);
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare class SalaryService {
|
|
48
|
+
private http;
|
|
49
|
+
constructor(http: AxiosInstance);
|
|
50
|
+
/**
|
|
51
|
+
* Fetch a paginated list of salaries.
|
|
52
|
+
*
|
|
53
|
+
* @param params - Query options like page, limit, filters, sort.
|
|
54
|
+
* @returns List of salaries matching the query.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const salaries = await client.salary.list({ page: 1, limit: 5 });
|
|
59
|
+
* console.log(salaries.data);
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
list(params: SalaryQueryParams): Promise<AxiosResponse<Salary[]>>;
|
|
63
|
+
/**
|
|
64
|
+
* Fetch a single salary by ID.
|
|
65
|
+
*
|
|
66
|
+
* @param id - Salary ID
|
|
67
|
+
* @returns Salary object
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* const salary = await client.salary.get('salary_id_here');
|
|
72
|
+
* console.log(salary.data);
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
get(id: string): Promise<AxiosResponse<Salary>>;
|
|
76
|
+
/**
|
|
77
|
+
* Create a new salary.
|
|
78
|
+
*
|
|
79
|
+
* @param data - Salary creation payload
|
|
80
|
+
* @returns The created salary
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* const newSalary = {
|
|
85
|
+
* month: 1,
|
|
86
|
+
* year: 2025,
|
|
87
|
+
* basic_salary: 50000,
|
|
88
|
+
* allowance: 10000,
|
|
89
|
+
* deduction: 10000,
|
|
90
|
+
* incentive: 10000,
|
|
91
|
+
* overtime: 10000,
|
|
92
|
+
* net_salary: 50000,
|
|
93
|
+
* is_paid: true,
|
|
94
|
+
* paid_date: "2025-06-23",
|
|
95
|
+
* wafeq_expense_id: "123456789",
|
|
96
|
+
* zoho_expense_id: "123456789",
|
|
97
|
+
* qb_expense_id: "123456789",
|
|
98
|
+
* xero_expense_id: "123456789",
|
|
99
|
+
* reconciled: true,
|
|
100
|
+
* };
|
|
101
|
+
* const response = await client.salary.create(newSalary);
|
|
102
|
+
* console.log(response.data);
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
create(data: CreateSalaryData): Promise<AxiosResponse<Salary>>;
|
|
106
|
+
/**
|
|
107
|
+
* Update an existing salary.
|
|
108
|
+
*
|
|
109
|
+
* @param id - Salary ID
|
|
110
|
+
* @param data - Partial update data
|
|
111
|
+
* @returns Updated salary
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* const updates = { basic_salary: 60000 };
|
|
116
|
+
* const updated = await client.salary.update('salary_id_here', updates);
|
|
117
|
+
* console.log(updated.data);
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
update(id: string, data: Partial<CreateSalaryData>): Promise<AxiosResponse<Salary>>;
|
|
121
|
+
}
|
package/dist/salary.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SalaryService = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Service for Salary
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const { createClient } = require('timber-sdk-dev');
|
|
10
|
+
* const client = createClient('your-api-key');
|
|
11
|
+
* const salary = await client.salary.list({ page: 1, limit: 10 });
|
|
12
|
+
* console.log(salary.data);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
class SalaryService {
|
|
16
|
+
constructor(http) {
|
|
17
|
+
this.http = http;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Fetch a paginated list of salaries.
|
|
21
|
+
*
|
|
22
|
+
* @param params - Query options like page, limit, filters, sort.
|
|
23
|
+
* @returns List of salaries matching the query.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const salaries = await client.salary.list({ page: 1, limit: 5 });
|
|
28
|
+
* console.log(salaries.data);
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
async list(params) {
|
|
32
|
+
return await this.http.get("/customer/salary", {
|
|
33
|
+
params,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Fetch a single salary by ID.
|
|
38
|
+
*
|
|
39
|
+
* @param id - Salary ID
|
|
40
|
+
* @returns Salary object
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* const salary = await client.salary.get('salary_id_here');
|
|
45
|
+
* console.log(salary.data);
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
async get(id) {
|
|
49
|
+
return await this.http.get(`/customer/salary/${id}`);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Create a new salary.
|
|
53
|
+
*
|
|
54
|
+
* @param data - Salary creation payload
|
|
55
|
+
* @returns The created salary
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* const newSalary = {
|
|
60
|
+
* month: 1,
|
|
61
|
+
* year: 2025,
|
|
62
|
+
* basic_salary: 50000,
|
|
63
|
+
* allowance: 10000,
|
|
64
|
+
* deduction: 10000,
|
|
65
|
+
* incentive: 10000,
|
|
66
|
+
* overtime: 10000,
|
|
67
|
+
* net_salary: 50000,
|
|
68
|
+
* is_paid: true,
|
|
69
|
+
* paid_date: "2025-06-23",
|
|
70
|
+
* wafeq_expense_id: "123456789",
|
|
71
|
+
* zoho_expense_id: "123456789",
|
|
72
|
+
* qb_expense_id: "123456789",
|
|
73
|
+
* xero_expense_id: "123456789",
|
|
74
|
+
* reconciled: true,
|
|
75
|
+
* };
|
|
76
|
+
* const response = await client.salary.create(newSalary);
|
|
77
|
+
* console.log(response.data);
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
async create(data) {
|
|
81
|
+
return await this.http.post("/customer/salary", data);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Update an existing salary.
|
|
85
|
+
*
|
|
86
|
+
* @param id - Salary ID
|
|
87
|
+
* @param data - Partial update data
|
|
88
|
+
* @returns Updated salary
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* const updates = { basic_salary: 60000 };
|
|
93
|
+
* const updated = await client.salary.update('salary_id_here', updates);
|
|
94
|
+
* console.log(updated.data);
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
async update(id, data) {
|
|
98
|
+
return await this.http.put(`/customer/salary/${id}`, data);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.SalaryService = SalaryService;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AxiosInstance, AxiosResponse } from "axios";
|
|
2
|
+
export interface TaxRateData {
|
|
3
|
+
name: string;
|
|
4
|
+
percentage: number;
|
|
5
|
+
is_active: boolean;
|
|
6
|
+
description?: string;
|
|
7
|
+
country?: string;
|
|
8
|
+
type: string;
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}
|
|
11
|
+
export interface TaxRate extends TaxRateData {
|
|
12
|
+
_id: string;
|
|
13
|
+
createdAt?: string;
|
|
14
|
+
updatedAt?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface TaxRateQueryParams {
|
|
17
|
+
page?: number;
|
|
18
|
+
limit?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Service for Tax Rate
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const { createClient } = require('timber-sdk-dev');
|
|
26
|
+
* const client = createClient('your-api-key');
|
|
27
|
+
* const taxRate = await client.taxRate.list({ page: 1, limit: 10 });
|
|
28
|
+
* console.log(taxRate.data);
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare class TaxRateService {
|
|
32
|
+
private http;
|
|
33
|
+
constructor(http: AxiosInstance);
|
|
34
|
+
list(params?: TaxRateQueryParams): Promise<AxiosResponse<TaxRate[]>>;
|
|
35
|
+
get(id: string): Promise<AxiosResponse<TaxRate>>;
|
|
36
|
+
}
|
package/dist/taxRate.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TaxRateService = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Service for Tax Rate
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const { createClient } = require('timber-sdk-dev');
|
|
10
|
+
* const client = createClient('your-api-key');
|
|
11
|
+
* const taxRate = await client.taxRate.list({ page: 1, limit: 10 });
|
|
12
|
+
* console.log(taxRate.data);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
class TaxRateService {
|
|
16
|
+
constructor(http) {
|
|
17
|
+
this.http = http;
|
|
18
|
+
}
|
|
19
|
+
async list(params = {}) {
|
|
20
|
+
return await this.http.get("/customer/tax-rate", { params });
|
|
21
|
+
}
|
|
22
|
+
async get(id) {
|
|
23
|
+
return await this.http.get(`/customer/tax-rate/${id}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.TaxRateService = TaxRateService;
|