@eleva-io/erp-sdk 0.1.7 → 0.1.9
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/dist/erp.d.ts +6 -4
- package/dist/erp.d.ts.map +1 -1
- package/dist/erp.js +7 -3
- package/dist/erp.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/modules/contacts/api.d.ts +2 -2
- package/dist/modules/contacts/api.d.ts.map +1 -1
- package/dist/modules/contacts/api.js.map +1 -1
- package/dist/modules/contacts/index.d.ts +2 -2
- package/dist/modules/contacts/index.d.ts.map +1 -1
- package/dist/modules/contacts/index.js.map +1 -1
- package/dist/modules/contacts/persons/api/addresses.d.ts +2 -2
- package/dist/modules/contacts/persons/api/addresses.d.ts.map +1 -1
- package/dist/modules/contacts/persons/api/addresses.js.map +1 -1
- package/dist/modules/contacts/persons/api/index.d.ts +2 -2
- package/dist/modules/contacts/persons/api/index.d.ts.map +1 -1
- package/dist/modules/contacts/persons/api/index.js.map +1 -1
- package/dist/modules/contacts/persons/api/persons.d.ts +4 -4
- package/dist/modules/contacts/persons/api/persons.d.ts.map +1 -1
- package/dist/modules/contacts/persons/api/persons.js +1 -1
- package/dist/modules/contacts/persons/api/persons.js.map +1 -1
- package/dist/modules/contacts/persons/index.d.ts +2 -2
- package/dist/modules/contacts/persons/index.d.ts.map +1 -1
- package/dist/modules/contacts/persons/index.js.map +1 -1
- package/dist/modules/contacts/persons/types/address.d.ts +1 -1
- package/dist/modules/contacts/persons/types/address.d.ts.map +1 -1
- package/dist/modules/contacts/persons/types/index.d.ts +3 -3
- package/dist/modules/contacts/persons/types/index.d.ts.map +1 -1
- package/dist/modules/contacts/persons/types/index.js.map +1 -1
- package/dist/modules/contacts/persons/types/person.d.ts +13 -4
- package/dist/modules/contacts/persons/types/person.d.ts.map +1 -1
- package/dist/modules/contacts/persons/types/person_address.d.ts +3 -3
- package/dist/modules/contacts/persons/types/person_address.d.ts.map +1 -1
- package/dist/modules/global/agents/index.d.ts +2 -0
- package/dist/modules/global/agents/index.d.ts.map +1 -0
- package/dist/modules/global/agents/index.js +18 -0
- package/dist/modules/global/agents/index.js.map +1 -0
- package/dist/modules/global/agents/types.d.ts +16 -0
- package/dist/modules/global/agents/types.d.ts.map +1 -0
- package/dist/modules/global/agents/types.js +10 -0
- package/dist/modules/global/agents/types.js.map +1 -0
- package/dist/modules/global/api.d.ts +9 -0
- package/dist/modules/global/api.d.ts.map +1 -0
- package/dist/modules/global/api.js +17 -0
- package/dist/modules/global/api.js.map +1 -0
- package/dist/modules/global/index.d.ts +3 -0
- package/dist/modules/global/index.d.ts.map +1 -0
- package/dist/modules/global/index.js +19 -0
- package/dist/modules/global/index.js.map +1 -0
- package/dist/modules/global/search/api.d.ts +10 -0
- package/dist/modules/global/search/api.d.ts.map +1 -0
- package/dist/modules/global/search/api.js +19 -0
- package/dist/modules/global/search/api.js.map +1 -0
- package/dist/modules/global/search/index.d.ts +3 -0
- package/dist/modules/global/search/index.d.ts.map +1 -0
- package/dist/modules/global/search/index.js +19 -0
- package/dist/modules/global/search/index.js.map +1 -0
- package/dist/modules/global/search/types.d.ts +37 -0
- package/dist/modules/global/search/types.d.ts.map +1 -0
- package/dist/modules/global/search/types.js +10 -0
- package/dist/modules/global/search/types.js.map +1 -0
- package/dist/modules/horizontal/api.d.ts +2 -2
- package/dist/modules/horizontal/api.d.ts.map +1 -1
- package/dist/modules/horizontal/api.js.map +1 -1
- package/dist/modules/horizontal/communities/api/agents.d.ts +2 -2
- package/dist/modules/horizontal/communities/api/agents.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/api/agents.js.map +1 -1
- package/dist/modules/horizontal/communities/api/blocks.d.ts +4 -4
- package/dist/modules/horizontal/communities/api/blocks.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/api/blocks.js +1 -1
- package/dist/modules/horizontal/communities/api/blocks.js.map +1 -1
- package/dist/modules/horizontal/communities/api/communities.d.ts +13 -11
- package/dist/modules/horizontal/communities/api/communities.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/api/communities.js +14 -7
- package/dist/modules/horizontal/communities/api/communities.js.map +1 -1
- package/dist/modules/horizontal/communities/api/communities_config.d.ts +3 -3
- package/dist/modules/horizontal/communities/api/communities_config.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/api/communities_config.js.map +1 -1
- package/dist/modules/horizontal/communities/api/documents.d.ts +3 -3
- package/dist/modules/horizontal/communities/api/documents.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/api/documents.js +6 -1
- package/dist/modules/horizontal/communities/api/documents.js.map +1 -1
- package/dist/modules/horizontal/communities/api/employees.d.ts +2 -2
- package/dist/modules/horizontal/communities/api/employees.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/api/employees.js.map +1 -1
- package/dist/modules/horizontal/communities/api/index.d.ts +11 -10
- package/dist/modules/horizontal/communities/api/index.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/api/index.js +1 -0
- package/dist/modules/horizontal/communities/api/index.js.map +1 -1
- package/dist/modules/horizontal/communities/api/properties.d.ts +3 -3
- package/dist/modules/horizontal/communities/api/properties.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/api/properties.js +1 -1
- package/dist/modules/horizontal/communities/api/properties.js.map +1 -1
- package/dist/modules/horizontal/communities/api/providers.d.ts +2 -2
- package/dist/modules/horizontal/communities/api/providers.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/api/providers.js.map +1 -1
- package/dist/modules/horizontal/communities/api/receipts.d.ts +4 -4
- package/dist/modules/horizontal/communities/api/receipts.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/api/receipts.js +1 -1
- package/dist/modules/horizontal/communities/api/receipts.js.map +1 -1
- package/dist/modules/horizontal/communities/api/roles.d.ts +2 -2
- package/dist/modules/horizontal/communities/api/roles.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/api/roles.js.map +1 -1
- package/dist/modules/horizontal/communities/api/route_trackings/index.d.ts +4 -0
- package/dist/modules/horizontal/communities/api/route_trackings/index.d.ts.map +1 -0
- package/dist/modules/horizontal/communities/api/route_trackings/index.js +20 -0
- package/dist/modules/horizontal/communities/api/route_trackings/index.js.map +1 -0
- package/dist/modules/horizontal/communities/api/route_trackings/route_trackings.d.ts +11 -0
- package/dist/modules/horizontal/communities/api/route_trackings/route_trackings.d.ts.map +1 -0
- package/dist/modules/horizontal/communities/api/route_trackings/route_trackings.js +21 -0
- package/dist/modules/horizontal/communities/api/route_trackings/route_trackings.js.map +1 -0
- package/dist/modules/horizontal/communities/api/route_trackings/routes.d.ts +27 -0
- package/dist/modules/horizontal/communities/api/route_trackings/routes.d.ts.map +1 -0
- package/dist/modules/horizontal/communities/api/route_trackings/routes.js +69 -0
- package/dist/modules/horizontal/communities/api/route_trackings/routes.js.map +1 -0
- package/dist/modules/horizontal/communities/api/route_trackings/zones.d.ts +11 -0
- package/dist/modules/horizontal/communities/api/route_trackings/zones.d.ts.map +1 -0
- package/dist/modules/horizontal/communities/api/route_trackings/zones.js +26 -0
- package/dist/modules/horizontal/communities/api/route_trackings/zones.js.map +1 -0
- package/dist/modules/horizontal/communities/index.d.ts +2 -2
- package/dist/modules/horizontal/communities/index.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/index.js.map +1 -1
- package/dist/modules/horizontal/communities/types/address.d.ts +2 -2
- package/dist/modules/horizontal/communities/types/address.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/types/agent.d.ts +2 -2
- package/dist/modules/horizontal/communities/types/agent.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/types/block.d.ts +4 -5
- package/dist/modules/horizontal/communities/types/block.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/types/community.d.ts +12 -5
- package/dist/modules/horizontal/communities/types/community.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/types/community_config.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/types/document.d.ts +2 -2
- package/dist/modules/horizontal/communities/types/document.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/types/employee.d.ts +3 -3
- package/dist/modules/horizontal/communities/types/employee.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/types/index.d.ts +10 -9
- package/dist/modules/horizontal/communities/types/index.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/types/index.js +1 -0
- package/dist/modules/horizontal/communities/types/index.js.map +1 -1
- package/dist/modules/horizontal/communities/types/property.d.ts +6 -6
- package/dist/modules/horizontal/communities/types/property.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/types/property.js.map +1 -1
- package/dist/modules/horizontal/communities/types/provider.d.ts +3 -3
- package/dist/modules/horizontal/communities/types/provider.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/types/receipt.d.ts +7 -7
- package/dist/modules/horizontal/communities/types/receipt.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/types/roles.d.ts +2 -2
- package/dist/modules/horizontal/communities/types/roles.d.ts.map +1 -1
- package/dist/modules/horizontal/communities/types/route_tracking.d.ts +53 -0
- package/dist/modules/horizontal/communities/types/route_tracking.d.ts.map +1 -0
- package/dist/modules/horizontal/communities/types/route_tracking.js +19 -0
- package/dist/modules/horizontal/communities/types/route_tracking.js.map +1 -0
- package/dist/modules/horizontal/communities/types/tag.d.ts.map +1 -1
- package/dist/modules/horizontal/index.d.ts +2 -2
- package/dist/modules/horizontal/index.d.ts.map +1 -1
- package/dist/modules/horizontal/index.js.map +1 -1
- package/dist/modules/index.d.ts +4 -3
- package/dist/modules/index.d.ts.map +1 -1
- package/dist/modules/index.js +1 -0
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/ticketing/api.d.ts +6 -15
- package/dist/modules/ticketing/api.d.ts.map +1 -1
- package/dist/modules/ticketing/api.js +9 -38
- package/dist/modules/ticketing/api.js.map +1 -1
- package/dist/modules/ticketing/index.d.ts +2 -2
- package/dist/modules/ticketing/index.d.ts.map +1 -1
- package/dist/modules/ticketing/index.js +1 -1
- package/dist/modules/ticketing/index.js.map +1 -1
- package/dist/modules/ticketing/tasks/api/activity_logs.d.ts +10 -0
- package/dist/modules/ticketing/tasks/api/activity_logs.d.ts.map +1 -0
- package/dist/modules/ticketing/tasks/api/activity_logs.js +21 -0
- package/dist/modules/ticketing/tasks/api/activity_logs.js.map +1 -0
- package/dist/modules/ticketing/tasks/api/attachments.d.ts +8 -0
- package/dist/modules/ticketing/tasks/api/attachments.d.ts.map +1 -0
- package/dist/modules/ticketing/tasks/api/attachments.js +16 -0
- package/dist/modules/ticketing/tasks/api/attachments.js.map +1 -0
- package/dist/modules/ticketing/tasks/api/conversations.d.ts +11 -0
- package/dist/modules/ticketing/tasks/api/conversations.d.ts.map +1 -0
- package/dist/modules/ticketing/tasks/api/conversations.js +35 -0
- package/dist/modules/ticketing/tasks/api/conversations.js.map +1 -0
- package/dist/modules/ticketing/tasks/api/followers.d.ts +11 -0
- package/dist/modules/ticketing/tasks/api/followers.d.ts.map +1 -0
- package/dist/modules/ticketing/tasks/api/followers.js +24 -0
- package/dist/modules/ticketing/tasks/api/followers.js.map +1 -0
- package/dist/modules/ticketing/tasks/api/index.d.ts +7 -0
- package/dist/modules/ticketing/tasks/api/index.d.ts.map +1 -0
- package/dist/modules/ticketing/tasks/api/index.js +23 -0
- package/dist/modules/ticketing/tasks/api/index.js.map +1 -0
- package/dist/modules/ticketing/tasks/api/resources.d.ts +11 -0
- package/dist/modules/ticketing/tasks/api/resources.d.ts.map +1 -0
- package/dist/modules/ticketing/tasks/api/resources.js +24 -0
- package/dist/modules/ticketing/tasks/api/resources.js.map +1 -0
- package/dist/modules/ticketing/tasks/api/tasks.d.ts +18 -0
- package/dist/modules/ticketing/tasks/api/tasks.d.ts.map +1 -0
- package/dist/modules/ticketing/tasks/api/tasks.js +51 -0
- package/dist/modules/ticketing/tasks/api/tasks.js.map +1 -0
- package/dist/modules/ticketing/tasks/index.d.ts +3 -0
- package/dist/modules/ticketing/tasks/index.d.ts.map +1 -0
- package/dist/modules/ticketing/tasks/index.js +19 -0
- package/dist/modules/ticketing/tasks/index.js.map +1 -0
- package/dist/modules/ticketing/tasks/types/activity_log.d.ts +28 -0
- package/dist/modules/ticketing/tasks/types/activity_log.d.ts.map +1 -0
- package/dist/modules/ticketing/tasks/types/activity_log.js +24 -0
- package/dist/modules/ticketing/tasks/types/activity_log.js.map +1 -0
- package/dist/modules/ticketing/tasks/types/converstation.d.ts +31 -0
- package/dist/modules/ticketing/tasks/types/converstation.d.ts.map +1 -0
- package/dist/modules/ticketing/tasks/types/converstation.js +11 -0
- package/dist/modules/ticketing/tasks/types/converstation.js.map +1 -0
- package/dist/modules/ticketing/tasks/types/follower.d.ts +8 -0
- package/dist/modules/ticketing/tasks/types/follower.d.ts.map +1 -0
- package/dist/modules/ticketing/tasks/types/follower.js +3 -0
- package/dist/modules/ticketing/tasks/types/follower.js.map +1 -0
- package/dist/modules/ticketing/tasks/types/index.d.ts +6 -0
- package/dist/modules/ticketing/tasks/types/index.d.ts.map +1 -0
- package/dist/modules/ticketing/tasks/types/index.js +22 -0
- package/dist/modules/ticketing/tasks/types/index.js.map +1 -0
- package/dist/modules/ticketing/tasks/types/resource.d.ts +18 -0
- package/dist/modules/ticketing/tasks/types/resource.d.ts.map +1 -0
- package/dist/modules/ticketing/tasks/types/resource.js +15 -0
- package/dist/modules/ticketing/tasks/types/resource.js.map +1 -0
- package/dist/modules/ticketing/tasks/types/task.d.ts +64 -0
- package/dist/modules/ticketing/tasks/types/task.d.ts.map +1 -0
- package/dist/modules/ticketing/tasks/types/task.js +25 -0
- package/dist/modules/ticketing/tasks/types/task.js.map +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/crud.d.ts +2 -2
- package/dist/utils/crud.d.ts.map +1 -1
- package/dist/utils/crud.js +6 -6
- package/dist/utils/crud.js.map +1 -1
- package/dist/utils/http.d.ts +16 -8
- package/dist/utils/http.d.ts.map +1 -1
- package/dist/utils/http.js +69 -23
- package/dist/utils/http.js.map +1 -1
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/signature.d.ts.map +1 -1
- package/dist/utils/signature.js +2 -5
- package/dist/utils/signature.js.map +1 -1
- package/dist/utils/types.d.ts.map +1 -1
- package/package.json +17 -3
package/dist/utils/http.js
CHANGED
|
@@ -16,7 +16,7 @@ class HTTPClient {
|
|
|
16
16
|
this._client = axios_1.default.create({
|
|
17
17
|
baseURL: this._config.baseURL,
|
|
18
18
|
headers: {
|
|
19
|
-
|
|
19
|
+
'Content-Type': 'application/json',
|
|
20
20
|
},
|
|
21
21
|
});
|
|
22
22
|
// Interceptor para agregar headers de autenticación
|
|
@@ -26,22 +26,22 @@ class HTTPClient {
|
|
|
26
26
|
data = {};
|
|
27
27
|
// Remover Content-Type para que axios lo establezca automáticamente con el boundary
|
|
28
28
|
if (config.headers) {
|
|
29
|
-
config.headers.delete(
|
|
29
|
+
config.headers.delete('Content-Type');
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
const signatureData = (0, signature_1.generateSignature)(data, this._config.apiKey, this._config.apiSecret);
|
|
33
33
|
// Manejar query params
|
|
34
34
|
if (config.params) {
|
|
35
|
-
const queryStr =
|
|
35
|
+
const queryStr = _buildQueryString(config.params);
|
|
36
36
|
config.url = `${config.url}?${queryStr}`;
|
|
37
37
|
config.params = undefined; // Limpiamos params ya que los incluimos en la URL
|
|
38
38
|
}
|
|
39
39
|
if (config.headers) {
|
|
40
|
-
config.headers.set(
|
|
41
|
-
config.headers.set(
|
|
42
|
-
config.headers.set(
|
|
40
|
+
config.headers.set('x-api-key', this._config.apiKey);
|
|
41
|
+
config.headers.set('x-timestamp', signatureData.timestamp.toString());
|
|
42
|
+
config.headers.set('x-signature', signatureData.signature);
|
|
43
43
|
}
|
|
44
|
-
console.log(
|
|
44
|
+
console.log(`>> HTTP REQUEST: [${config.method?.toLocaleUpperCase()}] ${config.url}`);
|
|
45
45
|
return config;
|
|
46
46
|
});
|
|
47
47
|
// Interceptor para manejar respuestas
|
|
@@ -50,66 +50,112 @@ class HTTPClient {
|
|
|
50
50
|
return response;
|
|
51
51
|
}, (error) => {
|
|
52
52
|
const apiError = {
|
|
53
|
-
code: error.response?.data?.code ||
|
|
54
|
-
message: error.response?.data?.message ||
|
|
53
|
+
code: error.response?.data?.code || 'UNKNOWN_ERROR',
|
|
54
|
+
message: error.response?.data?.message || 'An unexpected error occurred',
|
|
55
55
|
errors: error.response?.data?.errors || [],
|
|
56
56
|
};
|
|
57
57
|
return Promise.reject(apiError);
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
async get(path, params) {
|
|
61
|
-
console.log("get", path, params);
|
|
62
61
|
const response = await this._client.get(path, { params });
|
|
63
62
|
return response.data;
|
|
64
63
|
}
|
|
65
64
|
async post(path, data, params) {
|
|
66
|
-
console.log("post", path, data, params);
|
|
67
65
|
const response = await this._client.post(path, data, {
|
|
68
66
|
params,
|
|
69
67
|
});
|
|
70
68
|
return response.data;
|
|
71
69
|
}
|
|
72
70
|
async put(path, data, params) {
|
|
73
|
-
console.log("put", path, data, params);
|
|
74
71
|
const response = await this._client.put(path, data, {
|
|
75
72
|
params,
|
|
76
73
|
});
|
|
77
74
|
return response.data;
|
|
78
75
|
}
|
|
79
76
|
async patch(path, data, params) {
|
|
80
|
-
console.log("patch", path, data, params);
|
|
81
77
|
const response = await this._client.patch(path, data, {
|
|
82
78
|
params,
|
|
83
79
|
});
|
|
84
80
|
return response.data;
|
|
85
81
|
}
|
|
86
82
|
async delete(path, params) {
|
|
87
|
-
console.log("delete", path, params);
|
|
88
83
|
const response = await this._client.delete(path, {
|
|
89
84
|
params,
|
|
90
85
|
});
|
|
91
86
|
return response.data;
|
|
92
87
|
}
|
|
93
88
|
async getBinary(path, params) {
|
|
94
|
-
console.log("getBinary", path, params);
|
|
95
89
|
const response = await this._client.get(path, {
|
|
96
90
|
params,
|
|
97
|
-
responseType:
|
|
91
|
+
responseType: 'arraybuffer',
|
|
98
92
|
});
|
|
99
93
|
return Buffer.from(response.data);
|
|
100
94
|
}
|
|
101
|
-
async uploadFile(path,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
type: mime_types_1.default.lookup(fileName).toString(),
|
|
95
|
+
async uploadFile(path, data, params) {
|
|
96
|
+
const file = new File([data.file.data], data.file.name, {
|
|
97
|
+
type: mime_types_1.default.lookup(data.file.name).toString(),
|
|
105
98
|
});
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
99
|
+
const fd = new FormData();
|
|
100
|
+
fd.append(data.file.field || 'file', file, data.file.name);
|
|
101
|
+
Object.entries(data).forEach(([key, value]) => {
|
|
102
|
+
if (key === 'file')
|
|
103
|
+
return;
|
|
104
|
+
if (value === undefined)
|
|
105
|
+
return;
|
|
106
|
+
if (Array.isArray(value)) {
|
|
107
|
+
value.forEach((sv, i) => {
|
|
108
|
+
fd.append(`${key}[${i}]`, sv.toString());
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
else if (typeof value === 'object' && value !== null) {
|
|
112
|
+
Object.entries(value).forEach(([sk, sv]) => {
|
|
113
|
+
if (sv === undefined)
|
|
114
|
+
return;
|
|
115
|
+
fd.append(`${key}[${sk}]`, sv === null ? 'null' : sv.toString());
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
fd.append(key, value === null ? 'null' : value.toString());
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
const response = await this._client.post(path, fd, {
|
|
109
123
|
params,
|
|
110
124
|
});
|
|
111
125
|
return response.data;
|
|
112
126
|
}
|
|
113
127
|
}
|
|
114
128
|
exports.HTTPClient = HTTPClient;
|
|
129
|
+
function _deepBuildQuery(acc, obj, prefix) {
|
|
130
|
+
Object.entries(obj).forEach(([key, val]) => {
|
|
131
|
+
if (!val)
|
|
132
|
+
return;
|
|
133
|
+
const newPrefix = prefix ? `${prefix}[${key}]` : key;
|
|
134
|
+
if (Array.isArray(val)) {
|
|
135
|
+
val.forEach((v, i) => {
|
|
136
|
+
acc[`${newPrefix}[${i}]`] = v.toString();
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
else if (typeof val === 'object' && val !== null) {
|
|
140
|
+
_deepBuildQuery(acc, val, newPrefix);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
acc[newPrefix] = val.toString();
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function _buildQueryString(query) {
|
|
148
|
+
const reqQuery = {};
|
|
149
|
+
Object.entries(query).forEach(([key, value]) => {
|
|
150
|
+
if (!value)
|
|
151
|
+
return;
|
|
152
|
+
if (typeof value === 'object' && value !== null) {
|
|
153
|
+
_deepBuildQuery(reqQuery, value, key);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
reqQuery[key] = value.toString();
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
return querystring_1.default.stringify(reqQuery);
|
|
160
|
+
}
|
|
115
161
|
//# sourceMappingURL=http.js.map
|
package/dist/utils/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA4C;AAE5C,2CAA+C;AAC/C,8DAAqC;AACrC,4DAA6B;AAoB7B,MAAa,UAAU;IAGD;IAFZ,OAAO,CAAe;IAE9B,YAAoB,OAAyB;QAAzB,YAAO,GAAP,OAAO,CAAkB;QAC3C,IAAI,CAAC,OAAO,GAAG,eAAK,CAAC,MAAM,CAAC;YAC1B,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO;YAC7B,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;SACF,CAAC,CAAA;QAEF,oDAAoD;QACpD,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,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,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAA;QAClC,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,qBAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;AACxC,CAAC"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from './http';
|
|
2
|
+
export * from './signature';
|
|
3
|
+
export * from './crud';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA;AAC3B,cAAc,QAAQ,CAAA"}
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAsB;AACtB,8CAA2B;AAC3B,yCAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../src/utils/signature.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../src/utils/signature.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,aAAa,CAUjG"}
|
package/dist/utils/signature.js
CHANGED
|
@@ -6,12 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.generateSignature = generateSignature;
|
|
7
7
|
const crypto_1 = __importDefault(require("crypto"));
|
|
8
8
|
function generateSignature(body, apiKey, apiSecret) {
|
|
9
|
-
const bodyStr = JSON.stringify(body, null, 0) ||
|
|
9
|
+
const bodyStr = JSON.stringify(body, null, 0) || '';
|
|
10
10
|
const timestamp = Date.now();
|
|
11
|
-
const signature = crypto_1.default
|
|
12
|
-
.createHmac("sha256", apiSecret)
|
|
13
|
-
.update(`${bodyStr}:${timestamp}:${apiKey}`)
|
|
14
|
-
.digest("hex");
|
|
11
|
+
const signature = crypto_1.default.createHmac('sha256', apiSecret).update(`${bodyStr}:${timestamp}:${apiKey}`).digest('hex');
|
|
15
12
|
return {
|
|
16
13
|
signature,
|
|
17
14
|
timestamp,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signature.js","sourceRoot":"","sources":["../../src/utils/signature.ts"],"names":[],"mappings":";;;;;AAOA,
|
|
1
|
+
{"version":3,"file":"signature.js","sourceRoot":"","sources":["../../src/utils/signature.ts"],"names":[],"mappings":";;;;;AAOA,8CAUC;AAjBD,oDAA2B;AAO3B,SAAgB,iBAAiB,CAAC,IAAa,EAAE,MAAc,EAAE,SAAiB;IAChF,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;IACnD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;IAE5B,MAAM,SAAS,GAAG,gBAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,GAAG,OAAO,IAAI,SAAS,IAAI,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAElH,OAAO;QACL,SAAS;QACT,SAAS;KACV,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,KAAK,EAAE,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,KAAK,EAAE,CAAC,EAAE,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eleva-io/erp-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "SDK oficial para el ERP de Eleva",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -16,14 +16,27 @@
|
|
|
16
16
|
"author": "Eleva",
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"devDependencies": {
|
|
19
|
+
"@types/jest": "30.0.0",
|
|
19
20
|
"@types/mime-types": "3.0.1",
|
|
20
21
|
"@types/node": "^20.19.1",
|
|
22
|
+
"@typescript-eslint/eslint-plugin": "8.35.0",
|
|
23
|
+
"@typescript-eslint/parser": "8.35.0",
|
|
21
24
|
"dotenv": "^16.5.0",
|
|
25
|
+
"eslint": "9.29.0",
|
|
26
|
+
"eslint-config-prettier": "10.1.5",
|
|
27
|
+
"eslint-plugin-jest": "29.0.1",
|
|
28
|
+
"eslint-plugin-prettier": "5.5.1",
|
|
29
|
+
"jest": "30.0.3",
|
|
30
|
+
"prettier": "3.6.1",
|
|
31
|
+
"ts-jest": "29.4.0",
|
|
32
|
+
"ts-node": "10.9.2",
|
|
22
33
|
"tsc-alias": "1.8.16",
|
|
23
34
|
"tsx": "^4.20.3",
|
|
24
35
|
"typescript": "^5.8.3"
|
|
25
36
|
},
|
|
26
37
|
"dependencies": {
|
|
38
|
+
"@eslint/eslintrc": "3.3.1",
|
|
39
|
+
"@eslint/js": "9.29.0",
|
|
27
40
|
"axios": "^1.10.0",
|
|
28
41
|
"mime-types": "3.0.1",
|
|
29
42
|
"moment": "2.30.1"
|
|
@@ -37,8 +50,9 @@
|
|
|
37
50
|
},
|
|
38
51
|
"scripts": {
|
|
39
52
|
"build": "pnpm tsc && pnpm tsc-alias",
|
|
40
|
-
"test": "jest",
|
|
41
|
-
"
|
|
53
|
+
"test": "jest --config ./jest.config.ts",
|
|
54
|
+
"lint": "eslint 'src/**/*.{ts,tsx}' --fix",
|
|
55
|
+
"format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\"",
|
|
42
56
|
"sandbox": "tsx sandbox/index.ts",
|
|
43
57
|
"sandbox:watch": "tsx watch sandbox/index.ts"
|
|
44
58
|
}
|