@arkyn/server 3.0.1-beta.136 → 3.0.1-beta.138
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/bundle.js +546 -530
- package/dist/bundle.umd.cjs +8 -8
- package/dist/http/api/_logRequest.d.ts.map +1 -1
- package/dist/http/api/_logRequest.js +22 -1
- package/dist/utilities/decodeRequestErrorMessage.d.ts.map +1 -1
- package/dist/utilities/decodeRequestErrorMessage.js +4 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_logRequest.d.ts","sourceRoot":"","sources":["../../../src/http/api/_logRequest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_logRequest.d.ts","sourceRoot":"","sources":["../../../src/http/api/_logRequest.ts"],"names":[],"mappings":"AAIA,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,iBAAe,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA8E5D;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { formatJsonObject } from "@arkyn/shared";
|
|
1
2
|
import { flushDebugLogs } from "../..";
|
|
2
3
|
import { LogService } from "../../services/logService";
|
|
3
4
|
/**
|
|
@@ -75,7 +76,27 @@ async function logRequest(config) {
|
|
|
75
76
|
"Content-Type": "application/json",
|
|
76
77
|
Authorization: `Bearer ${userToken}`,
|
|
77
78
|
};
|
|
78
|
-
await fetch(apiUrl, {
|
|
79
|
+
const fetchResponse = await fetch(apiUrl, {
|
|
80
|
+
method: "POST",
|
|
81
|
+
body,
|
|
82
|
+
headers,
|
|
83
|
+
});
|
|
84
|
+
if (!fetchResponse.ok) {
|
|
85
|
+
const errorText = await fetchResponse.text();
|
|
86
|
+
const errorStatus = fetchResponse.status;
|
|
87
|
+
const errorStatusText = fetchResponse.statusText;
|
|
88
|
+
const jsonResponse = await fetchResponse.json().catch(() => null);
|
|
89
|
+
flushDebugLogs({
|
|
90
|
+
name: "LogError",
|
|
91
|
+
scheme: "red",
|
|
92
|
+
debugs: [
|
|
93
|
+
`Failed to log request.`,
|
|
94
|
+
`Status: ${errorStatus} ${errorStatusText}.`,
|
|
95
|
+
`Status text: ${errorText}.`,
|
|
96
|
+
`JSON Response: ${jsonResponse ? formatJsonObject(jsonResponse, 0) : "No JSON response"}`,
|
|
97
|
+
],
|
|
98
|
+
});
|
|
99
|
+
}
|
|
79
100
|
}
|
|
80
101
|
catch (err) {
|
|
81
102
|
flushDebugLogs({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decodeRequestErrorMessage.d.ts","sourceRoot":"","sources":["../../src/utilities/decodeRequestErrorMessage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,iBAAS,yBAAyB,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"decodeRequestErrorMessage.d.ts","sourceRoot":"","sources":["../../src/utilities/decodeRequestErrorMessage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,iBAAS,yBAAyB,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAyBxE;AAED,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -16,6 +16,10 @@ function decodeRequestErrorMessage(data, response) {
|
|
|
16
16
|
if (data?.message && typeof data?.message === "string") {
|
|
17
17
|
return data?.message;
|
|
18
18
|
}
|
|
19
|
+
if (data?.operator_erro_message &&
|
|
20
|
+
typeof data?.operator_erro_message === "string") {
|
|
21
|
+
return data?.operator_erro_message;
|
|
22
|
+
}
|
|
19
23
|
if (data?.error && typeof data?.error === "string") {
|
|
20
24
|
return data?.error;
|
|
21
25
|
}
|