@xsai/shared 0.0.27 → 0.0.29
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/index.js +7 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10,19 +10,19 @@ class XSAIError extends Error {
|
|
|
10
10
|
const strCamelToSnake = (str) => str.replace(/[A-Z]/g, (s) => `_${s.toLowerCase()}`);
|
|
11
11
|
const objCamelToSnake = (obj) => Object.fromEntries(Object.entries(obj).map(([k, v]) => [strCamelToSnake(k), v]));
|
|
12
12
|
|
|
13
|
-
const clean = (record) => Object.fromEntries(Object.entries(record).filter(([, v]) => v !==
|
|
13
|
+
const clean = (record) => Object.fromEntries(Object.entries(record).filter(([, v]) => v !== undefined));
|
|
14
14
|
|
|
15
15
|
const requestBody = (body) => JSON.stringify(objCamelToSnake(clean({
|
|
16
16
|
...body,
|
|
17
|
-
abortSignal:
|
|
18
|
-
apiKey:
|
|
19
|
-
baseURL:
|
|
20
|
-
fetch:
|
|
21
|
-
headers:
|
|
17
|
+
abortSignal: undefined,
|
|
18
|
+
apiKey: undefined,
|
|
19
|
+
baseURL: undefined,
|
|
20
|
+
fetch: undefined,
|
|
21
|
+
headers: undefined
|
|
22
22
|
})));
|
|
23
23
|
|
|
24
24
|
const requestHeaders = (headers, apiKey) => clean({
|
|
25
|
-
Authorization: apiKey ? `Bearer ${apiKey}` :
|
|
25
|
+
Authorization: apiKey ? `Bearer ${apiKey}` : undefined,
|
|
26
26
|
...headers
|
|
27
27
|
});
|
|
28
28
|
|