@zauru-sdk/services 2.24.0 → 2.25.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/dist/esm/zauru/httpCMS.js +24 -1
- package/dist/esm/zauru/httpGraphQL.js +24 -1
- package/dist/esm/zauru/httpOauth.js +24 -1
- package/dist/esm/zauru/httpZauru.js +24 -1
- package/dist/esm/zauru/zauru-purchase-orders.js +17 -0
- package/dist/zauru/zauru-purchase-orders.d.ts +6 -0
- package/package.json +3 -3
|
@@ -12,7 +12,30 @@ axiosInstance.interceptors.request.use(function (request) {
|
|
|
12
12
|
request.metadata = { startTime: Date.now() };
|
|
13
13
|
if (config.debugHTTP) {
|
|
14
14
|
console.log(chalk.cyan(`[DEBUG] REQUEST METHOD: ${request.method?.toUpperCase()}`));
|
|
15
|
-
|
|
15
|
+
let _bodyType;
|
|
16
|
+
let _bodyLog;
|
|
17
|
+
if (typeof FormData !== "undefined" && request.data instanceof FormData) {
|
|
18
|
+
_bodyType = "multipart/form-data";
|
|
19
|
+
const _entries = {};
|
|
20
|
+
request.data.forEach((value, key) => {
|
|
21
|
+
_entries[key] =
|
|
22
|
+
value instanceof Blob
|
|
23
|
+
? `[Blob/File: ${value.name ?? "unnamed"}]`
|
|
24
|
+
: value;
|
|
25
|
+
});
|
|
26
|
+
_bodyLog = JSON.stringify(_entries, null, 2);
|
|
27
|
+
}
|
|
28
|
+
else if (typeof URLSearchParams !== "undefined" &&
|
|
29
|
+
request.data instanceof URLSearchParams) {
|
|
30
|
+
_bodyType = "application/x-www-form-urlencoded";
|
|
31
|
+
_bodyLog = request.data.toString();
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
_bodyType = "application/json";
|
|
35
|
+
_bodyLog = JSON.stringify(request.data, null, 2);
|
|
36
|
+
}
|
|
37
|
+
console.log(chalk.cyan(`[DEBUG] REQUEST CONTENT TYPE: ${_bodyType}`));
|
|
38
|
+
console.log(chalk.cyan("[DEBUG] REQUEST BODY:"), _bodyLog);
|
|
16
39
|
}
|
|
17
40
|
return request;
|
|
18
41
|
}, function (error) {
|
|
@@ -12,7 +12,30 @@ axiosInstance.interceptors.request.use(function (request) {
|
|
|
12
12
|
request.metadata = { startTime: Date.now() };
|
|
13
13
|
if (config.debugHTTP) {
|
|
14
14
|
console.log(chalk.cyan(`[DEBUG] REQUEST METHOD: ${request.method?.toUpperCase()}`));
|
|
15
|
-
|
|
15
|
+
let _bodyType;
|
|
16
|
+
let _bodyLog;
|
|
17
|
+
if (typeof FormData !== "undefined" && request.data instanceof FormData) {
|
|
18
|
+
_bodyType = "multipart/form-data";
|
|
19
|
+
const _entries = {};
|
|
20
|
+
request.data.forEach((value, key) => {
|
|
21
|
+
_entries[key] =
|
|
22
|
+
value instanceof Blob
|
|
23
|
+
? `[Blob/File: ${value.name ?? "unnamed"}]`
|
|
24
|
+
: value;
|
|
25
|
+
});
|
|
26
|
+
_bodyLog = JSON.stringify(_entries, null, 2);
|
|
27
|
+
}
|
|
28
|
+
else if (typeof URLSearchParams !== "undefined" &&
|
|
29
|
+
request.data instanceof URLSearchParams) {
|
|
30
|
+
_bodyType = "application/x-www-form-urlencoded";
|
|
31
|
+
_bodyLog = request.data.toString();
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
_bodyType = "application/json";
|
|
35
|
+
_bodyLog = JSON.stringify(request.data, null, 2);
|
|
36
|
+
}
|
|
37
|
+
console.log(chalk.cyan(`[DEBUG] REQUEST CONTENT TYPE: ${_bodyType}`));
|
|
38
|
+
console.log(chalk.cyan("[DEBUG] REQUEST BODY:"), _bodyLog);
|
|
16
39
|
}
|
|
17
40
|
return request;
|
|
18
41
|
}, function (error) {
|
|
@@ -12,7 +12,30 @@ axiosInstance.interceptors.request.use(function (request) {
|
|
|
12
12
|
request.metadata = { startTime: Date.now() };
|
|
13
13
|
if (config.debugHTTP) {
|
|
14
14
|
console.log(chalk.cyan(`[DEBUG] REQUEST METHOD: ${request.method?.toUpperCase()}`));
|
|
15
|
-
|
|
15
|
+
let _bodyType;
|
|
16
|
+
let _bodyLog;
|
|
17
|
+
if (typeof FormData !== "undefined" && request.data instanceof FormData) {
|
|
18
|
+
_bodyType = "multipart/form-data";
|
|
19
|
+
const _entries = {};
|
|
20
|
+
request.data.forEach((value, key) => {
|
|
21
|
+
_entries[key] =
|
|
22
|
+
value instanceof Blob
|
|
23
|
+
? `[Blob/File: ${value.name ?? "unnamed"}]`
|
|
24
|
+
: value;
|
|
25
|
+
});
|
|
26
|
+
_bodyLog = JSON.stringify(_entries, null, 2);
|
|
27
|
+
}
|
|
28
|
+
else if (typeof URLSearchParams !== "undefined" &&
|
|
29
|
+
request.data instanceof URLSearchParams) {
|
|
30
|
+
_bodyType = "application/x-www-form-urlencoded";
|
|
31
|
+
_bodyLog = request.data.toString();
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
_bodyType = "application/json";
|
|
35
|
+
_bodyLog = JSON.stringify(request.data, null, 2);
|
|
36
|
+
}
|
|
37
|
+
console.log(chalk.cyan(`[DEBUG] REQUEST CONTENT TYPE: ${_bodyType}`));
|
|
38
|
+
console.log(chalk.cyan("[DEBUG] REQUEST BODY:"), _bodyLog);
|
|
16
39
|
}
|
|
17
40
|
return request;
|
|
18
41
|
}, function (error) {
|
|
@@ -12,7 +12,30 @@ axiosInstance.interceptors.request.use(function (request) {
|
|
|
12
12
|
request.metadata = { startTime: Date.now() };
|
|
13
13
|
if (config.debugHTTP) {
|
|
14
14
|
console.log(chalk.cyan(`[DEBUG] REQUEST METHOD: ${request.method?.toUpperCase()}`));
|
|
15
|
-
|
|
15
|
+
let _bodyType;
|
|
16
|
+
let _bodyLog;
|
|
17
|
+
if (typeof FormData !== "undefined" && request.data instanceof FormData) {
|
|
18
|
+
_bodyType = "multipart/form-data";
|
|
19
|
+
const _entries = {};
|
|
20
|
+
request.data.forEach((value, key) => {
|
|
21
|
+
_entries[key] =
|
|
22
|
+
value instanceof Blob
|
|
23
|
+
? `[Blob/File: ${value.name ?? "unnamed"}]`
|
|
24
|
+
: value;
|
|
25
|
+
});
|
|
26
|
+
_bodyLog = JSON.stringify(_entries, null, 2);
|
|
27
|
+
}
|
|
28
|
+
else if (typeof URLSearchParams !== "undefined" &&
|
|
29
|
+
request.data instanceof URLSearchParams) {
|
|
30
|
+
_bodyType = "application/x-www-form-urlencoded";
|
|
31
|
+
_bodyLog = request.data.toString();
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
_bodyType = "application/json";
|
|
35
|
+
_bodyLog = JSON.stringify(request.data, null, 2);
|
|
36
|
+
}
|
|
37
|
+
console.log(chalk.cyan(`[DEBUG] REQUEST CONTENT TYPE: ${_bodyType}`));
|
|
38
|
+
console.log(chalk.cyan("[DEBUG] REQUEST BODY:"), _bodyLog);
|
|
16
39
|
}
|
|
17
40
|
return request;
|
|
18
41
|
}, function (error) {
|
|
@@ -274,6 +274,23 @@ export const shallowUpdatePurchaseOrder = (headers, body) => {
|
|
|
274
274
|
* @returns
|
|
275
275
|
*/
|
|
276
276
|
export const getLast100Receptions = (session, agency_id) => {
|
|
277
|
+
return handlePossibleAxiosErrors(async () => {
|
|
278
|
+
const headers = await getGraphQLAPIHeaders(session);
|
|
279
|
+
const response = await httpGraphQLAPI.post("", {
|
|
280
|
+
query: getLast100ReceptionsStringQuery(agency_id),
|
|
281
|
+
}, { headers });
|
|
282
|
+
if (response.data.errors) {
|
|
283
|
+
throw new Error(response.data.errors.map((x) => x.message).join(";"));
|
|
284
|
+
}
|
|
285
|
+
return response.data?.data?.purchase_orders;
|
|
286
|
+
});
|
|
287
|
+
};
|
|
288
|
+
/**
|
|
289
|
+
* getLast100Receptions
|
|
290
|
+
* @param headers
|
|
291
|
+
* @returns
|
|
292
|
+
*/
|
|
293
|
+
export const getLast100ReceptionsOnMyAgency = (session, agency_id) => {
|
|
277
294
|
return handlePossibleAxiosErrors(async () => {
|
|
278
295
|
const headers = await getGraphQLAPIHeaders(session);
|
|
279
296
|
const agencyId = agency_id ?? Number(session.get("agency_id"));
|
|
@@ -126,6 +126,12 @@ export declare const shallowUpdatePurchaseOrder: (headers: any, body: Partial<Pu
|
|
|
126
126
|
* @returns
|
|
127
127
|
*/
|
|
128
128
|
export declare const getLast100Receptions: (session: Session, agency_id?: number | string) => Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>>;
|
|
129
|
+
/**
|
|
130
|
+
* getLast100Receptions
|
|
131
|
+
* @param headers
|
|
132
|
+
* @returns
|
|
133
|
+
*/
|
|
134
|
+
export declare const getLast100ReceptionsOnMyAgency: (session: Session, agency_id?: number | string) => Promise<AxiosUtilsResponse<PurchaseOrderGraphQL[]>>;
|
|
129
135
|
/**
|
|
130
136
|
* getPurchaseOrder
|
|
131
137
|
* @param headers
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/services",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.25.1",
|
|
4
4
|
"description": "Servicios de consulta a Zauru",
|
|
5
5
|
"main": "./dist/esm/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"@upstash/redis": "^1.34.5",
|
|
28
28
|
"@zauru-sdk/common": "^2.16.1",
|
|
29
29
|
"@zauru-sdk/config": "^2.23.1",
|
|
30
|
-
"@zauru-sdk/graphql": "^2.
|
|
30
|
+
"@zauru-sdk/graphql": "^2.25.0",
|
|
31
31
|
"@zauru-sdk/types": "^2.16.0",
|
|
32
32
|
"axios": "^1.6.7",
|
|
33
33
|
"chalk": "5.3.0"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "cd45bdf2a9db53b3e5e8c118be5a34f66a30d588"
|
|
36
36
|
}
|