@xata.io/client 0.26.4 → 0.26.5
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/.turbo/turbo-add-version.log +1 -1
- package/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +6 -0
- package/dist/index.cjs +28 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +28 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -18,7 +18,8 @@ const TraceAttributes = {
|
|
18
18
|
HTTP_METHOD: "http.method",
|
19
19
|
HTTP_URL: "http.url",
|
20
20
|
HTTP_ROUTE: "http.route",
|
21
|
-
HTTP_TARGET: "http.target"
|
21
|
+
HTTP_TARGET: "http.target",
|
22
|
+
CLOUDFLARE_RAY_ID: "cf.ray"
|
22
23
|
};
|
23
24
|
|
24
25
|
function notEmpty(value) {
|
@@ -30,8 +31,15 @@ function compact(arr) {
|
|
30
31
|
function compactObject(obj) {
|
31
32
|
return Object.fromEntries(Object.entries(obj).filter(([, value]) => notEmpty(value)));
|
32
33
|
}
|
34
|
+
function isBlob(value) {
|
35
|
+
try {
|
36
|
+
return value instanceof Blob;
|
37
|
+
} catch (error) {
|
38
|
+
return false;
|
39
|
+
}
|
40
|
+
}
|
33
41
|
function isObject(value) {
|
34
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date) && !(value
|
42
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date) && !isBlob(value);
|
35
43
|
}
|
36
44
|
function isDefined(value) {
|
37
45
|
return value !== null && value !== void 0;
|
@@ -263,14 +271,13 @@ var __privateMethod$4 = (obj, member, method) => {
|
|
263
271
|
return method;
|
264
272
|
};
|
265
273
|
var _fetch, _queue, _concurrency, _enqueue, enqueue_fn;
|
266
|
-
const REQUEST_TIMEOUT =
|
274
|
+
const REQUEST_TIMEOUT = 5 * 60 * 1e3;
|
267
275
|
function getFetchImplementation(userFetch) {
|
268
276
|
const globalFetch = typeof fetch !== "undefined" ? fetch : void 0;
|
269
|
-
const
|
277
|
+
const globalThisFetch = typeof globalThis !== "undefined" ? globalThis.fetch : void 0;
|
278
|
+
const fetchImpl = userFetch ?? globalFetch ?? globalThisFetch;
|
270
279
|
if (!fetchImpl) {
|
271
|
-
throw new Error(
|
272
|
-
`Couldn't find \`fetch\`. Install a fetch implementation such as \`node-fetch\` and pass it explicitly.`
|
273
|
-
);
|
280
|
+
throw new Error(`Couldn't find a global \`fetch\`. Pass a fetch implementation explicitly.`);
|
274
281
|
}
|
275
282
|
return fetchImpl;
|
276
283
|
}
|
@@ -527,7 +534,7 @@ function defaultOnOpen(response) {
|
|
527
534
|
}
|
528
535
|
}
|
529
536
|
|
530
|
-
const VERSION = "0.26.
|
537
|
+
const VERSION = "0.26.5";
|
531
538
|
|
532
539
|
var __defProp$7 = Object.defineProperty;
|
533
540
|
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
@@ -616,7 +623,7 @@ function hostHeader(url) {
|
|
616
623
|
async function parseBody(body, headers) {
|
617
624
|
if (!isDefined(body))
|
618
625
|
return void 0;
|
619
|
-
if (body
|
626
|
+
if (isBlob(body) || typeof body.text === "function") {
|
620
627
|
return body;
|
621
628
|
}
|
622
629
|
const { "Content-Type": contentType } = headers ?? {};
|
@@ -688,7 +695,8 @@ async function fetch$1({
|
|
688
695
|
[TraceAttributes.HTTP_REQUEST_ID]: requestId,
|
689
696
|
[TraceAttributes.HTTP_STATUS_CODE]: response.status,
|
690
697
|
[TraceAttributes.HTTP_HOST]: host,
|
691
|
-
[TraceAttributes.HTTP_SCHEME]: protocol?.replace(":", "")
|
698
|
+
[TraceAttributes.HTTP_SCHEME]: protocol?.replace(":", ""),
|
699
|
+
[TraceAttributes.CLOUDFLARE_RAY_ID]: response.headers?.get("cf-ray") ?? void 0
|
692
700
|
});
|
693
701
|
const message = response.headers?.get("x-xata-message");
|
694
702
|
if (message)
|
@@ -2671,7 +2679,7 @@ function getContentType(file) {
|
|
2671
2679
|
if (typeof file === "string") {
|
2672
2680
|
return "text/plain";
|
2673
2681
|
}
|
2674
|
-
if (file
|
2682
|
+
if (isBlob(file)) {
|
2675
2683
|
return file.type;
|
2676
2684
|
}
|
2677
2685
|
try {
|
@@ -2862,7 +2870,15 @@ const parseInputFileEntry = async (entry) => {
|
|
2862
2870
|
if (!isDefined(entry))
|
2863
2871
|
return null;
|
2864
2872
|
const { id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout } = await entry;
|
2865
|
-
return compactObject({
|
2873
|
+
return compactObject({
|
2874
|
+
id,
|
2875
|
+
// Name cannot be an empty string in our API
|
2876
|
+
name: name ? name : void 0,
|
2877
|
+
mediaType,
|
2878
|
+
base64Content,
|
2879
|
+
enablePublicUrl,
|
2880
|
+
signedUrlTimeout
|
2881
|
+
});
|
2866
2882
|
};
|
2867
2883
|
|
2868
2884
|
function cleanFilter(filter) {
|