timber-node 0.4.4 → 0.4.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/README.md +127 -123
- package/dist/auth.js +1 -1
- package/dist/bankStatement.js +4 -2
- package/dist/billPayment.js +4 -4
- package/dist/cheque.js +2 -2
- package/dist/company.d.ts +15 -1
- package/dist/company.js +4 -4
- package/dist/customer.d.ts +1 -0
- package/dist/customer.js +52 -12
- package/dist/employee.js +1 -1
- package/dist/expense.js +5 -5
- package/dist/expenseCategory.js +4 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/invoice.js +35 -38
- package/dist/invoiceItem.js +4 -4
- package/dist/invoiceNumber.js +3 -3
- package/dist/invoicePayment.js +7 -5
- package/dist/{invoiceTemplates.d.ts → invoiceSettings.d.ts} +19 -19
- package/dist/{invoiceTemplates.js → invoiceSettings.js} +18 -18
- package/dist/rawExpense.js +3 -3
- package/dist/salary.js +4 -4
- package/dist/taxRate.d.ts +24 -2
- package/dist/taxRate.js +24 -4
- package/dist/utils/convertToFormData.d.ts +8 -0
- package/dist/utils/convertToFormData.js +71 -0
- package/dist/vendorPayment.js +6 -6
- package/package.json +63 -63
package/dist/invoice.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InvoiceService = void 0;
|
|
4
4
|
const getFormData_1 = require("./utils/getFormData");
|
|
5
|
+
const convertToFormData_1 = require("./utils/convertToFormData");
|
|
5
6
|
/**
|
|
6
7
|
* Service for Invoice
|
|
7
8
|
*
|
|
@@ -30,7 +31,7 @@ class InvoiceService {
|
|
|
30
31
|
* ```
|
|
31
32
|
*/
|
|
32
33
|
async list(params = {}) {
|
|
33
|
-
return await this.http.get('/customer/invoice', { params });
|
|
34
|
+
return await this.http.get('/user/sdk/customer/invoice', { params });
|
|
34
35
|
}
|
|
35
36
|
/**
|
|
36
37
|
* Fetch an invoice by ID.
|
|
@@ -45,49 +46,45 @@ class InvoiceService {
|
|
|
45
46
|
* ```
|
|
46
47
|
*/
|
|
47
48
|
async get(id) {
|
|
48
|
-
return await this.http.get(`/customer/invoice/${id}`);
|
|
49
|
+
return await this.http.get(`/user/sdk/customer/invoice/${id}`);
|
|
49
50
|
}
|
|
50
51
|
async create(data) {
|
|
51
52
|
const { formData, headers } = await (0, getFormData_1.getFormData)();
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
return await this.http.post('/customer/invoice', formData, {
|
|
53
|
+
const formattedFormData = (0, convertToFormData_1.convertToFormData)(data, formData);
|
|
54
|
+
// for (const key in data) {
|
|
55
|
+
// const value = (data as any)[key];
|
|
56
|
+
// if (key === 'items' || key === 'customer' || key === 'biller') {
|
|
57
|
+
// formattedFormData.append(key, JSON.stringify(value));
|
|
58
|
+
// } else if (key === 'logo' && value && typeof value.pipe === 'function') {
|
|
59
|
+
// // This is a ReadStream
|
|
60
|
+
// formattedFormData.append('logo', value);
|
|
61
|
+
// } else if (value instanceof Date) {
|
|
62
|
+
// formattedFormData.append(key, value.toISOString());
|
|
63
|
+
// } else if (value !== undefined && value !== null) {
|
|
64
|
+
// formattedFormData.append(key, value.toString());
|
|
65
|
+
// }
|
|
66
|
+
// }
|
|
67
|
+
return await this.http.post('/user/sdk/customer/invoice', formattedFormData, {
|
|
69
68
|
headers,
|
|
70
69
|
});
|
|
71
70
|
}
|
|
72
71
|
async update(id, data) {
|
|
73
72
|
const { formData, headers } = await (0, getFormData_1.getFormData)();
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
return await this.http.put(`/customer/invoice/${id}`, data, {
|
|
73
|
+
const formattedFormData = (0, convertToFormData_1.convertToFormData)(data, formData);
|
|
74
|
+
// for (const key in data) {
|
|
75
|
+
// const value = (data as any)[key];
|
|
76
|
+
// if (key === 'items' || key === 'customer' || key === 'biller') {
|
|
77
|
+
// formattedFormData.append(key, JSON.stringify(value));
|
|
78
|
+
// } else if (key === 'logo' && value && typeof value.pipe === 'function') {
|
|
79
|
+
// // This is a ReadStream
|
|
80
|
+
// formattedFormData.append('logo', value);
|
|
81
|
+
// } else if (value instanceof Date) {
|
|
82
|
+
// formattedFormData.append(key, value.toISOString());
|
|
83
|
+
// } else if (value !== undefined && value !== null) {
|
|
84
|
+
// formattedFormData.append(key, value.toString());
|
|
85
|
+
// }
|
|
86
|
+
// }
|
|
87
|
+
return await this.http.put(`/user/sdk/customer/invoice/${id}`, formattedFormData, {
|
|
91
88
|
headers,
|
|
92
89
|
});
|
|
93
90
|
}
|
|
@@ -104,7 +101,7 @@ class InvoiceService {
|
|
|
104
101
|
* ```
|
|
105
102
|
*/
|
|
106
103
|
async delete(id, data) {
|
|
107
|
-
return await this.http.delete(`/customer/invoice/${id}`, {
|
|
104
|
+
return await this.http.delete(`/user/sdk/customer/invoice/${id}`, {
|
|
108
105
|
data,
|
|
109
106
|
});
|
|
110
107
|
}
|
|
@@ -121,7 +118,7 @@ class InvoiceService {
|
|
|
121
118
|
* ```
|
|
122
119
|
*/
|
|
123
120
|
async download(id) {
|
|
124
|
-
return await this.http.get(`/customer/invoice/download/${id}`, {
|
|
121
|
+
return await this.http.get(`/user/sdk/customer/invoice/download/${id}`, {
|
|
125
122
|
responseType: 'arraybuffer', // Important: tells Axios to treat the response as binary
|
|
126
123
|
});
|
|
127
124
|
}
|
package/dist/invoiceItem.js
CHANGED
|
@@ -28,7 +28,7 @@ class InvoiceItemService {
|
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
30
|
async list(params) {
|
|
31
|
-
return await this.http.get('/customer/invoice-item', { params });
|
|
31
|
+
return await this.http.get('/user/sdk/customer/invoice-item', { params });
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Invoice Item suggestions.
|
|
@@ -43,7 +43,7 @@ class InvoiceItemService {
|
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
45
|
async suggestions({ search }) {
|
|
46
|
-
return await this.http.get('/customer/invoice-item/suggestions', {
|
|
46
|
+
return await this.http.get('/user/sdk/customer/invoice-item/suggestions', {
|
|
47
47
|
params: { search },
|
|
48
48
|
});
|
|
49
49
|
}
|
|
@@ -66,7 +66,7 @@ class InvoiceItemService {
|
|
|
66
66
|
* ```
|
|
67
67
|
*/
|
|
68
68
|
async create(data) {
|
|
69
|
-
return await this.http.post('/customer/invoice-item', data);
|
|
69
|
+
return await this.http.post('/user/sdk/customer/invoice-item', data);
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* Update an existing invoice template.
|
|
@@ -83,7 +83,7 @@ class InvoiceItemService {
|
|
|
83
83
|
* ```
|
|
84
84
|
*/
|
|
85
85
|
async update(id, data) {
|
|
86
|
-
return await this.http.patch(`/customer/invoice-item/${id}`, data);
|
|
86
|
+
return await this.http.patch(`/user/sdk/customer/invoice-item/${id}`, data);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
exports.InvoiceItemService = InvoiceItemService;
|
package/dist/invoiceNumber.js
CHANGED
|
@@ -27,7 +27,7 @@ class InvoiceNumberService {
|
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
29
|
async get() {
|
|
30
|
-
return await this.http.get(`/customer/invoice-number`);
|
|
30
|
+
return await this.http.get(`/user/sdk/customer/invoice-number`);
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Fetch next invoice number.
|
|
@@ -41,7 +41,7 @@ class InvoiceNumberService {
|
|
|
41
41
|
* ```
|
|
42
42
|
*/
|
|
43
43
|
async next() {
|
|
44
|
-
return await this.http.get(`/customer/invoice-number/next`);
|
|
44
|
+
return await this.http.get(`/user/sdk/customer/invoice-number/next`);
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Update an existing invoice number.
|
|
@@ -58,7 +58,7 @@ class InvoiceNumberService {
|
|
|
58
58
|
* ```
|
|
59
59
|
*/
|
|
60
60
|
async update(data) {
|
|
61
|
-
return await this.http.patch(`/customer/invoice-number`, data);
|
|
61
|
+
return await this.http.patch(`/user/sdk/customer/invoice-number`, data);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
exports.InvoiceNumberService = InvoiceNumberService;
|
package/dist/invoicePayment.js
CHANGED
|
@@ -32,7 +32,9 @@ class InvoicePaymentService {
|
|
|
32
32
|
async list(params = {
|
|
33
33
|
invoice: '',
|
|
34
34
|
}) {
|
|
35
|
-
return await this.http.get('/customer/invoice/payment-records', {
|
|
35
|
+
return await this.http.get('/user/sdk/customer/invoice/payment-records', {
|
|
36
|
+
params,
|
|
37
|
+
});
|
|
36
38
|
}
|
|
37
39
|
/**
|
|
38
40
|
* Create a new invoice payment.
|
|
@@ -79,7 +81,7 @@ class InvoicePaymentService {
|
|
|
79
81
|
if (data.file) {
|
|
80
82
|
formData.append('file', data.file);
|
|
81
83
|
}
|
|
82
|
-
return await this.http.post('/customer/invoice/payment-records', formData, {
|
|
84
|
+
return await this.http.post('/user/sdk/customer/invoice/payment-records', formData, {
|
|
83
85
|
headers,
|
|
84
86
|
});
|
|
85
87
|
}
|
|
@@ -126,7 +128,7 @@ class InvoicePaymentService {
|
|
|
126
128
|
if (data.file) {
|
|
127
129
|
formData.append('file', data.file);
|
|
128
130
|
}
|
|
129
|
-
return await this.http.put(`/customer/invoice/payment-records/${id}`, formData, {
|
|
131
|
+
return await this.http.put(`/user/sdk/customer/invoice/payment-records/${id}`, formData, {
|
|
130
132
|
headers,
|
|
131
133
|
});
|
|
132
134
|
}
|
|
@@ -143,7 +145,7 @@ class InvoicePaymentService {
|
|
|
143
145
|
* ```
|
|
144
146
|
*/
|
|
145
147
|
async get(id) {
|
|
146
|
-
return await this.http.get(`/customer/invoice/payment-records/${id}`);
|
|
148
|
+
return await this.http.get(`/user/sdk/customer/invoice/payment-records/${id}`);
|
|
147
149
|
}
|
|
148
150
|
/**
|
|
149
151
|
* Delete an invoice payment by ID.
|
|
@@ -158,7 +160,7 @@ class InvoicePaymentService {
|
|
|
158
160
|
* ```
|
|
159
161
|
*/
|
|
160
162
|
async delete(id, data) {
|
|
161
|
-
return await this.http.delete(`/customer/invoice/payment-records/${id}`, {
|
|
163
|
+
return await this.http.delete(`/user/sdk/customer/invoice/payment-records/${id}`, {
|
|
162
164
|
data,
|
|
163
165
|
});
|
|
164
166
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance, AxiosResponse } from 'axios';
|
|
2
|
-
export interface
|
|
2
|
+
export interface CreateInvoiceSettingsRequest {
|
|
3
3
|
terms: [
|
|
4
4
|
{
|
|
5
5
|
name: string;
|
|
@@ -14,8 +14,8 @@ export interface CreateInvoiceTemplateRequest {
|
|
|
14
14
|
];
|
|
15
15
|
type?: 'terms' | 'notes';
|
|
16
16
|
}
|
|
17
|
-
export type
|
|
18
|
-
export interface
|
|
17
|
+
export type UpdateInvoiceSettingsRequest = Partial<CreateInvoiceSettingsRequest>;
|
|
18
|
+
export interface InvoiceSettings {
|
|
19
19
|
_id: string;
|
|
20
20
|
company: string;
|
|
21
21
|
terms: [
|
|
@@ -33,7 +33,7 @@ export interface InvoiceTemplate {
|
|
|
33
33
|
created_at: string;
|
|
34
34
|
updated_at: string;
|
|
35
35
|
}
|
|
36
|
-
export interface
|
|
36
|
+
export interface InvoiceSettingsQueryParams {
|
|
37
37
|
page?: number;
|
|
38
38
|
limit?: number;
|
|
39
39
|
sort?: string;
|
|
@@ -47,11 +47,11 @@ export interface InvoiceTemplateQueryParams {
|
|
|
47
47
|
* ```ts
|
|
48
48
|
* const { createClient } = require('timber-sdk-dev');
|
|
49
49
|
* const client = createClient('your-api-key');
|
|
50
|
-
* const
|
|
51
|
-
* console.log(
|
|
50
|
+
* const InvoiceSettings = await client.InvoiceSettings.list({ page: 1, limit: 10 });
|
|
51
|
+
* console.log(InvoiceSettings.data);
|
|
52
52
|
* ```
|
|
53
53
|
*/
|
|
54
|
-
export declare class
|
|
54
|
+
export declare class InvoiceSettingsService {
|
|
55
55
|
private http;
|
|
56
56
|
constructor(http: AxiosInstance);
|
|
57
57
|
/**
|
|
@@ -61,11 +61,11 @@ export declare class InvoiceTemplateService {
|
|
|
61
61
|
*
|
|
62
62
|
* @example
|
|
63
63
|
* ```ts
|
|
64
|
-
* const
|
|
65
|
-
* console.log(
|
|
64
|
+
* const invoiceSettingss = await client.InvoiceSettings.list();
|
|
65
|
+
* console.log(invoiceSettingss.data);
|
|
66
66
|
* ```
|
|
67
67
|
*/
|
|
68
|
-
list(params:
|
|
68
|
+
list(params: InvoiceSettingsQueryParams): Promise<AxiosResponse<InvoiceSettings>>;
|
|
69
69
|
/**
|
|
70
70
|
* Fetch a single invoice template by ID.
|
|
71
71
|
*
|
|
@@ -74,10 +74,10 @@ export declare class InvoiceTemplateService {
|
|
|
74
74
|
*
|
|
75
75
|
* @example
|
|
76
76
|
* ```ts
|
|
77
|
-
* const
|
|
78
|
-
* console.log(
|
|
77
|
+
* const invoiceSettings = await client.InvoiceSettings.get('invoice_template_id_here');
|
|
78
|
+
* console.log(invoiceSettings.data);
|
|
79
79
|
* ``` */
|
|
80
|
-
get(id: string): Promise<AxiosResponse<
|
|
80
|
+
get(id: string): Promise<AxiosResponse<InvoiceSettings>>;
|
|
81
81
|
/**
|
|
82
82
|
* Create a new invoice template.
|
|
83
83
|
*
|
|
@@ -86,7 +86,7 @@ export declare class InvoiceTemplateService {
|
|
|
86
86
|
*
|
|
87
87
|
* @example
|
|
88
88
|
* ```ts
|
|
89
|
-
* const
|
|
89
|
+
* const newInvoiceSettings = {
|
|
90
90
|
* terms: [
|
|
91
91
|
* {
|
|
92
92
|
* name: "Terms",
|
|
@@ -100,11 +100,11 @@ export declare class InvoiceTemplateService {
|
|
|
100
100
|
* }
|
|
101
101
|
* ]
|
|
102
102
|
* };
|
|
103
|
-
* const response = await client.
|
|
103
|
+
* const response = await client.InvoiceSettings.create(newInvoiceSettings);
|
|
104
104
|
* console.log(response.data);
|
|
105
105
|
* ```
|
|
106
106
|
*/
|
|
107
|
-
create(data:
|
|
107
|
+
create(data: CreateInvoiceSettingsRequest): Promise<AxiosResponse<InvoiceSettings>>;
|
|
108
108
|
/**
|
|
109
109
|
* Update an existing invoice template.
|
|
110
110
|
*
|
|
@@ -120,11 +120,11 @@ export declare class InvoiceTemplateService {
|
|
|
120
120
|
* content: "Notes content"
|
|
121
121
|
* }
|
|
122
122
|
* ]};
|
|
123
|
-
* const updated = await client.
|
|
123
|
+
* const updated = await client.InvoiceSettings.update('invoice_template_id_here', updates);
|
|
124
124
|
* console.log(updated.data);
|
|
125
125
|
* ```
|
|
126
126
|
*/
|
|
127
|
-
update(id: string, data:
|
|
127
|
+
update(id: string, data: CreateInvoiceSettingsRequest): Promise<AxiosResponse<InvoiceSettings>>;
|
|
128
128
|
/**
|
|
129
129
|
* Delete an invoice template by ID.
|
|
130
130
|
*
|
|
@@ -133,7 +133,7 @@ export declare class InvoiceTemplateService {
|
|
|
133
133
|
*
|
|
134
134
|
* @example
|
|
135
135
|
* ```ts
|
|
136
|
-
* const response = await client.
|
|
136
|
+
* const response = await client.InvoiceSettings.delete('expense_category_id_here');
|
|
137
137
|
* console.log(response.data.message);
|
|
138
138
|
* ```
|
|
139
139
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.InvoiceSettingsService = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Service for Invoice Template
|
|
6
6
|
*
|
|
@@ -8,11 +8,11 @@ exports.InvoiceTemplateService = void 0;
|
|
|
8
8
|
* ```ts
|
|
9
9
|
* const { createClient } = require('timber-sdk-dev');
|
|
10
10
|
* const client = createClient('your-api-key');
|
|
11
|
-
* const
|
|
12
|
-
* console.log(
|
|
11
|
+
* const InvoiceSettings = await client.InvoiceSettings.list({ page: 1, limit: 10 });
|
|
12
|
+
* console.log(InvoiceSettings.data);
|
|
13
13
|
* ```
|
|
14
14
|
*/
|
|
15
|
-
class
|
|
15
|
+
class InvoiceSettingsService {
|
|
16
16
|
constructor(http) {
|
|
17
17
|
this.http = http;
|
|
18
18
|
}
|
|
@@ -23,12 +23,12 @@ class InvoiceTemplateService {
|
|
|
23
23
|
*
|
|
24
24
|
* @example
|
|
25
25
|
* ```ts
|
|
26
|
-
* const
|
|
27
|
-
* console.log(
|
|
26
|
+
* const invoiceSettingss = await client.InvoiceSettings.list();
|
|
27
|
+
* console.log(invoiceSettingss.data);
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
30
|
async list(params) {
|
|
31
|
-
return await this.http.get('/customer/invoice-
|
|
31
|
+
return await this.http.get('/user/sdk/customer/invoice-settings', {
|
|
32
32
|
params,
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -40,11 +40,11 @@ class InvoiceTemplateService {
|
|
|
40
40
|
*
|
|
41
41
|
* @example
|
|
42
42
|
* ```ts
|
|
43
|
-
* const
|
|
44
|
-
* console.log(
|
|
43
|
+
* const invoiceSettings = await client.InvoiceSettings.get('invoice_template_id_here');
|
|
44
|
+
* console.log(invoiceSettings.data);
|
|
45
45
|
* ``` */
|
|
46
46
|
async get(id) {
|
|
47
|
-
return await this.http.get(`/customer/invoice-
|
|
47
|
+
return await this.http.get(`/user/sdk/customer/invoice-settings/${id}`);
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Create a new invoice template.
|
|
@@ -54,7 +54,7 @@ class InvoiceTemplateService {
|
|
|
54
54
|
*
|
|
55
55
|
* @example
|
|
56
56
|
* ```ts
|
|
57
|
-
* const
|
|
57
|
+
* const newInvoiceSettings = {
|
|
58
58
|
* terms: [
|
|
59
59
|
* {
|
|
60
60
|
* name: "Terms",
|
|
@@ -68,12 +68,12 @@ class InvoiceTemplateService {
|
|
|
68
68
|
* }
|
|
69
69
|
* ]
|
|
70
70
|
* };
|
|
71
|
-
* const response = await client.
|
|
71
|
+
* const response = await client.InvoiceSettings.create(newInvoiceSettings);
|
|
72
72
|
* console.log(response.data);
|
|
73
73
|
* ```
|
|
74
74
|
*/
|
|
75
75
|
async create(data) {
|
|
76
|
-
return await this.http.post('/customer/invoice-
|
|
76
|
+
return await this.http.post('/user/sdk/customer/invoice-settings', data);
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* Update an existing invoice template.
|
|
@@ -90,12 +90,12 @@ class InvoiceTemplateService {
|
|
|
90
90
|
* content: "Notes content"
|
|
91
91
|
* }
|
|
92
92
|
* ]};
|
|
93
|
-
* const updated = await client.
|
|
93
|
+
* const updated = await client.InvoiceSettings.update('invoice_template_id_here', updates);
|
|
94
94
|
* console.log(updated.data);
|
|
95
95
|
* ```
|
|
96
96
|
*/
|
|
97
97
|
async update(id, data) {
|
|
98
|
-
return await this.http.put(`/customer/invoice-
|
|
98
|
+
return await this.http.put(`/user/sdk/customer/invoice-settings/${id}`, data);
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
101
|
* Delete an invoice template by ID.
|
|
@@ -105,12 +105,12 @@ class InvoiceTemplateService {
|
|
|
105
105
|
*
|
|
106
106
|
* @example
|
|
107
107
|
* ```ts
|
|
108
|
-
* const response = await client.
|
|
108
|
+
* const response = await client.InvoiceSettings.delete('expense_category_id_here');
|
|
109
109
|
* console.log(response.data.message);
|
|
110
110
|
* ```
|
|
111
111
|
*/
|
|
112
112
|
async delete(id) {
|
|
113
|
-
return await this.http.delete(`/customer/invoice-
|
|
113
|
+
return await this.http.delete(`/user/sdk/customer/invoice-settings/${id}`);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
exports.
|
|
116
|
+
exports.InvoiceSettingsService = InvoiceSettingsService;
|
package/dist/rawExpense.js
CHANGED
|
@@ -29,7 +29,7 @@ class RawExpenseService {
|
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
31
|
async list(params) {
|
|
32
|
-
return await this.http.get('/customer/expense/raw', {
|
|
32
|
+
return await this.http.get('/user/sdk/customer/expense/raw', {
|
|
33
33
|
params,
|
|
34
34
|
});
|
|
35
35
|
}
|
|
@@ -51,7 +51,7 @@ class RawExpenseService {
|
|
|
51
51
|
async create(data) {
|
|
52
52
|
const formData = new FormData();
|
|
53
53
|
formData.append('file', data.file);
|
|
54
|
-
return await this.http.post('/customer/expense/raw', formData, {
|
|
54
|
+
return await this.http.post('/user/sdk/customer/expense/raw', formData, {
|
|
55
55
|
headers: {
|
|
56
56
|
'Content-Type': 'multipart/form-data',
|
|
57
57
|
},
|
|
@@ -70,7 +70,7 @@ class RawExpenseService {
|
|
|
70
70
|
* ```
|
|
71
71
|
*/
|
|
72
72
|
async delete(id) {
|
|
73
|
-
return await this.http.delete(`/customer/expense/raw/${id}`);
|
|
73
|
+
return await this.http.delete(`/user/sdk/customer/expense/raw/${id}`);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
exports.RawExpenseService = RawExpenseService;
|
package/dist/salary.js
CHANGED
|
@@ -29,7 +29,7 @@ class SalaryService {
|
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
31
|
async list(params) {
|
|
32
|
-
return await this.http.get('/customer/salary', {
|
|
32
|
+
return await this.http.get('/user/sdk/customer/salary', {
|
|
33
33
|
params,
|
|
34
34
|
});
|
|
35
35
|
}
|
|
@@ -46,7 +46,7 @@ class SalaryService {
|
|
|
46
46
|
* ```
|
|
47
47
|
*/
|
|
48
48
|
async get(id) {
|
|
49
|
-
return await this.http.get(`/customer/salary/${id}`);
|
|
49
|
+
return await this.http.get(`/user/sdk/customer/salary/${id}`);
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* Create a new salary.
|
|
@@ -78,7 +78,7 @@ class SalaryService {
|
|
|
78
78
|
* ```
|
|
79
79
|
*/
|
|
80
80
|
async create(data) {
|
|
81
|
-
return await this.http.post('/customer/salary', data);
|
|
81
|
+
return await this.http.post('/user/sdk/customer/salary', data);
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
84
|
* Update an existing salary.
|
|
@@ -95,7 +95,7 @@ class SalaryService {
|
|
|
95
95
|
* ```
|
|
96
96
|
*/
|
|
97
97
|
async update(id, data) {
|
|
98
|
-
return await this.http.put(`/customer/salary/${id}`, data);
|
|
98
|
+
return await this.http.put(`/user/sdk/customer/salary/${id}`, data);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
exports.SalaryService = SalaryService;
|
package/dist/taxRate.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export interface TaxRateData {
|
|
|
8
8
|
type: string;
|
|
9
9
|
[key: string]: any;
|
|
10
10
|
}
|
|
11
|
+
export type TaxRateType = 'SALES' | 'PURCHASES';
|
|
11
12
|
export interface TaxRate extends TaxRateData {
|
|
12
13
|
_id: string;
|
|
13
14
|
createdAt?: string;
|
|
@@ -16,16 +17,37 @@ export interface TaxRate extends TaxRateData {
|
|
|
16
17
|
export interface TaxRateQueryParams {
|
|
17
18
|
page?: number;
|
|
18
19
|
limit?: number;
|
|
20
|
+
type?: TaxRateType;
|
|
19
21
|
}
|
|
20
22
|
/**
|
|
21
23
|
* Service for Tax Rate
|
|
22
24
|
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* The `type` parameter is mandatory and determines the tax context:
|
|
27
|
+
*
|
|
28
|
+
* - `SALES` → Use this when creating or displaying **customer invoices**
|
|
29
|
+
* - `PURCHASES` → Use this when creating or displaying **vendor payments / expenses**
|
|
30
|
+
*
|
|
23
31
|
* @example
|
|
24
32
|
* ```ts
|
|
25
33
|
* const { createClient } = require('timber-sdk-dev');
|
|
26
34
|
* const client = createClient('your-api-key');
|
|
27
|
-
*
|
|
28
|
-
*
|
|
35
|
+
*
|
|
36
|
+
* // Fetch tax rates for invoices
|
|
37
|
+
* const salesTaxes = await client.taxRate.list({
|
|
38
|
+
* page: 1,
|
|
39
|
+
* limit: 10,
|
|
40
|
+
* type: 'SALES'
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* // Fetch tax rates for vendor payments
|
|
44
|
+
* const purchaseTaxes = await client.taxRate.list({
|
|
45
|
+
* page: 1,
|
|
46
|
+
* limit: 10,
|
|
47
|
+
* type: 'PURCHASES'
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* console.log(salesTaxes.data);
|
|
29
51
|
* ```
|
|
30
52
|
*/
|
|
31
53
|
export declare class TaxRateService {
|
package/dist/taxRate.js
CHANGED
|
@@ -4,12 +4,32 @@ exports.TaxRateService = void 0;
|
|
|
4
4
|
/**
|
|
5
5
|
* Service for Tax Rate
|
|
6
6
|
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* The `type` parameter is mandatory and determines the tax context:
|
|
9
|
+
*
|
|
10
|
+
* - `SALES` → Use this when creating or displaying **customer invoices**
|
|
11
|
+
* - `PURCHASES` → Use this when creating or displaying **vendor payments / expenses**
|
|
12
|
+
*
|
|
7
13
|
* @example
|
|
8
14
|
* ```ts
|
|
9
15
|
* const { createClient } = require('timber-sdk-dev');
|
|
10
16
|
* const client = createClient('your-api-key');
|
|
11
|
-
*
|
|
12
|
-
*
|
|
17
|
+
*
|
|
18
|
+
* // Fetch tax rates for invoices
|
|
19
|
+
* const salesTaxes = await client.taxRate.list({
|
|
20
|
+
* page: 1,
|
|
21
|
+
* limit: 10,
|
|
22
|
+
* type: 'SALES'
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // Fetch tax rates for vendor payments
|
|
26
|
+
* const purchaseTaxes = await client.taxRate.list({
|
|
27
|
+
* page: 1,
|
|
28
|
+
* limit: 10,
|
|
29
|
+
* type: 'PURCHASES'
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* console.log(salesTaxes.data);
|
|
13
33
|
* ```
|
|
14
34
|
*/
|
|
15
35
|
class TaxRateService {
|
|
@@ -17,10 +37,10 @@ class TaxRateService {
|
|
|
17
37
|
this.http = http;
|
|
18
38
|
}
|
|
19
39
|
async list(params = {}) {
|
|
20
|
-
return await this.http.get('/customer/tax-rate', { params });
|
|
40
|
+
return await this.http.get('/user/sdk/customer/tax-rate', { params });
|
|
21
41
|
}
|
|
22
42
|
async get(id) {
|
|
23
|
-
return await this.http.get(`/customer/tax-rate/${id}`);
|
|
43
|
+
return await this.http.get(`/user/sdk/customer/tax-rate/${id}`);
|
|
24
44
|
}
|
|
25
45
|
}
|
|
26
46
|
exports.TaxRateService = TaxRateService;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a nested object to FormData
|
|
3
|
+
* @param obj - The object to convert
|
|
4
|
+
* @param formData - The FormData instance (optional, creates new if not provided)
|
|
5
|
+
* @param parentKey - The parent key for nested properties (used internally)
|
|
6
|
+
* @returns FormData instance
|
|
7
|
+
*/
|
|
8
|
+
export declare function convertToFormData(obj: any, formData?: FormData, parentKey?: string): FormData;
|