@xata.io/client 0.26.4 → 0.26.6
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 +4 -4
- package/CHANGELOG.md +14 -0
- package/dist/index.cjs +30 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +34 -3
- package/dist/index.mjs +30 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/.turbo/turbo-build.log
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
|
2
|
-
> @xata.io/client@0.26.
|
2
|
+
> @xata.io/client@0.26.6 build /home/runner/work/client-ts/client-ts/packages/client
|
3
3
|
> rimraf dist && rollup -c
|
4
4
|
|
5
5
|
[36m
|
6
6
|
[1msrc/index.ts[22m → [1mdist/index.cjs[22m...[39m
|
7
|
-
[32mcreated [1mdist/index.cjs[22m in [
|
7
|
+
[32mcreated [1mdist/index.cjs[22m in [1m1.3s[22m[39m
|
8
8
|
[36m
|
9
9
|
[1msrc/index.ts[22m → [1mdist/index.mjs[22m...[39m
|
10
|
-
[32mcreated [1mdist/index.mjs[22m in [
|
10
|
+
[32mcreated [1mdist/index.mjs[22m in [1m843ms[22m[39m
|
11
11
|
[36m
|
12
12
|
[1msrc/index.ts[22m → [1mdist/index.d.ts[22m...[39m
|
13
|
-
[32mcreated [1mdist/index.d.ts[22m in [
|
13
|
+
[32mcreated [1mdist/index.d.ts[22m in [1m10.3s[22m[39m
|
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# @xata.io/client
|
2
2
|
|
3
|
+
## 0.26.6
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#1180](https://github.com/xataio/client-ts/pull/1180) [`3330c9cf`](https://github.com/xataio/client-ts/commit/3330c9cf8d8db18b8e355a576e4afd589b6152bf) Thanks [@SferaDev](https://github.com/SferaDev)! - Support expanded links in `toSerialized`
|
8
|
+
|
9
|
+
- [#1191](https://github.com/xataio/client-ts/pull/1191) [`a738816d`](https://github.com/xataio/client-ts/commit/a738816d355f4415b0622bb5a23b4154f9855177) Thanks [@SferaDev](https://github.com/SferaDev)! - Add support for `percentiles` aggregation
|
10
|
+
|
11
|
+
## 0.26.5
|
12
|
+
|
13
|
+
### Patch Changes
|
14
|
+
|
15
|
+
- [#1166](https://github.com/xataio/client-ts/pull/1166) [`b9b9058f`](https://github.com/xataio/client-ts/commit/b9b9058f0bc81b660da45318c27191a62f041f21) Thanks [@SferaDev](https://github.com/SferaDev)! - Fix error with Node 16
|
16
|
+
|
3
17
|
## 0.26.4
|
4
18
|
|
5
19
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
@@ -20,7 +20,8 @@ const TraceAttributes = {
|
|
20
20
|
HTTP_METHOD: "http.method",
|
21
21
|
HTTP_URL: "http.url",
|
22
22
|
HTTP_ROUTE: "http.route",
|
23
|
-
HTTP_TARGET: "http.target"
|
23
|
+
HTTP_TARGET: "http.target",
|
24
|
+
CLOUDFLARE_RAY_ID: "cf.ray"
|
24
25
|
};
|
25
26
|
|
26
27
|
function notEmpty(value) {
|
@@ -32,8 +33,15 @@ function compact(arr) {
|
|
32
33
|
function compactObject(obj) {
|
33
34
|
return Object.fromEntries(Object.entries(obj).filter(([, value]) => notEmpty(value)));
|
34
35
|
}
|
36
|
+
function isBlob(value) {
|
37
|
+
try {
|
38
|
+
return value instanceof Blob;
|
39
|
+
} catch (error) {
|
40
|
+
return false;
|
41
|
+
}
|
42
|
+
}
|
35
43
|
function isObject(value) {
|
36
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date) && !(value
|
44
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date) && !isBlob(value);
|
37
45
|
}
|
38
46
|
function isDefined(value) {
|
39
47
|
return value !== null && value !== void 0;
|
@@ -265,14 +273,13 @@ var __privateMethod$4 = (obj, member, method) => {
|
|
265
273
|
return method;
|
266
274
|
};
|
267
275
|
var _fetch, _queue, _concurrency, _enqueue, enqueue_fn;
|
268
|
-
const REQUEST_TIMEOUT =
|
276
|
+
const REQUEST_TIMEOUT = 5 * 60 * 1e3;
|
269
277
|
function getFetchImplementation(userFetch) {
|
270
278
|
const globalFetch = typeof fetch !== "undefined" ? fetch : void 0;
|
271
|
-
const
|
279
|
+
const globalThisFetch = typeof globalThis !== "undefined" ? globalThis.fetch : void 0;
|
280
|
+
const fetchImpl = userFetch ?? globalFetch ?? globalThisFetch;
|
272
281
|
if (!fetchImpl) {
|
273
|
-
throw new Error(
|
274
|
-
`Couldn't find \`fetch\`. Install a fetch implementation such as \`node-fetch\` and pass it explicitly.`
|
275
|
-
);
|
282
|
+
throw new Error(`Couldn't find a global \`fetch\`. Pass a fetch implementation explicitly.`);
|
276
283
|
}
|
277
284
|
return fetchImpl;
|
278
285
|
}
|
@@ -529,7 +536,7 @@ function defaultOnOpen(response) {
|
|
529
536
|
}
|
530
537
|
}
|
531
538
|
|
532
|
-
const VERSION = "0.26.
|
539
|
+
const VERSION = "0.26.6";
|
533
540
|
|
534
541
|
var __defProp$7 = Object.defineProperty;
|
535
542
|
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
@@ -618,7 +625,7 @@ function hostHeader(url) {
|
|
618
625
|
async function parseBody(body, headers) {
|
619
626
|
if (!isDefined(body))
|
620
627
|
return void 0;
|
621
|
-
if (body
|
628
|
+
if (isBlob(body) || typeof body.text === "function") {
|
622
629
|
return body;
|
623
630
|
}
|
624
631
|
const { "Content-Type": contentType } = headers ?? {};
|
@@ -690,7 +697,8 @@ async function fetch$1({
|
|
690
697
|
[TraceAttributes.HTTP_REQUEST_ID]: requestId,
|
691
698
|
[TraceAttributes.HTTP_STATUS_CODE]: response.status,
|
692
699
|
[TraceAttributes.HTTP_HOST]: host,
|
693
|
-
[TraceAttributes.HTTP_SCHEME]: protocol?.replace(":", "")
|
700
|
+
[TraceAttributes.HTTP_SCHEME]: protocol?.replace(":", ""),
|
701
|
+
[TraceAttributes.CLOUDFLARE_RAY_ID]: response.headers?.get("cf-ray") ?? void 0
|
694
702
|
});
|
695
703
|
const message = response.headers?.get("x-xata-message");
|
696
704
|
if (message)
|
@@ -2673,7 +2681,7 @@ function getContentType(file) {
|
|
2673
2681
|
if (typeof file === "string") {
|
2674
2682
|
return "text/plain";
|
2675
2683
|
}
|
2676
|
-
if (file
|
2684
|
+
if (isBlob(file)) {
|
2677
2685
|
return file.type;
|
2678
2686
|
}
|
2679
2687
|
try {
|
@@ -2864,7 +2872,15 @@ const parseInputFileEntry = async (entry) => {
|
|
2864
2872
|
if (!isDefined(entry))
|
2865
2873
|
return null;
|
2866
2874
|
const { id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout } = await entry;
|
2867
|
-
return compactObject({
|
2875
|
+
return compactObject({
|
2876
|
+
id,
|
2877
|
+
// Name cannot be an empty string in our API
|
2878
|
+
name: name ? name : void 0,
|
2879
|
+
mediaType,
|
2880
|
+
base64Content,
|
2881
|
+
enablePublicUrl,
|
2882
|
+
signedUrlTimeout
|
2883
|
+
});
|
2868
2884
|
};
|
2869
2885
|
|
2870
2886
|
function cleanFilter(filter) {
|
@@ -4160,13 +4176,6 @@ transformObjectToApi_fn = async function(object) {
|
|
4160
4176
|
}
|
4161
4177
|
return result;
|
4162
4178
|
};
|
4163
|
-
const removeLinksFromObject = (object) => {
|
4164
|
-
return Object.entries(object).reduce((acc, [key, value]) => {
|
4165
|
-
if (key === "xata")
|
4166
|
-
return acc;
|
4167
|
-
return { ...acc, [key]: isIdentifiable(value) ? value.id : value };
|
4168
|
-
}, {});
|
4169
|
-
};
|
4170
4179
|
const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
4171
4180
|
const data = {};
|
4172
4181
|
const { xata, ...rest } = object ?? {};
|
@@ -4233,7 +4242,6 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
4233
4242
|
}
|
4234
4243
|
}
|
4235
4244
|
const record = { ...data };
|
4236
|
-
const serializable = { xata, ...removeLinksFromObject(data) };
|
4237
4245
|
const metadata = xata !== void 0 ? { ...xata, createdAt: new Date(xata.createdAt), updatedAt: new Date(xata.updatedAt) } : void 0;
|
4238
4246
|
record.read = function(columns2) {
|
4239
4247
|
return db[table].read(record["id"], columns2);
|
@@ -4256,10 +4264,10 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
4256
4264
|
return record.xata;
|
4257
4265
|
};
|
4258
4266
|
record.toSerializable = function() {
|
4259
|
-
return JSON.parse(JSON.stringify(
|
4267
|
+
return JSON.parse(JSON.stringify(record));
|
4260
4268
|
};
|
4261
4269
|
record.toString = function() {
|
4262
|
-
return JSON.stringify(
|
4270
|
+
return JSON.stringify(record);
|
4263
4271
|
};
|
4264
4272
|
for (const prop of ["read", "update", "replace", "delete", "getMetadata", "toSerializable", "toString"]) {
|
4265
4273
|
Object.defineProperty(record, prop, { enumerable: false });
|