@xata.io/client 0.26.3 → 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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @xata.io/client@0.26.3 add-version /home/runner/work/client-ts/client-ts/packages/client
2
+ > @xata.io/client@0.26.5 add-version /home/runner/work/client-ts/client-ts/packages/client
3
3
  > node ../../scripts/add-version-file.mjs
4
4
 
@@ -1,13 +1,13 @@
1
1
 
2
- > @xata.io/client@0.26.3 build /home/runner/work/client-ts/client-ts/packages/client
2
+ > @xata.io/client@0.26.5 build /home/runner/work/client-ts/client-ts/packages/client
3
3
  > rimraf dist && rollup -c
4
4
 
5
5
  
6
6
  src/index.ts → dist/index.cjs...
7
- created dist/index.cjs in 1.3s
7
+ created dist/index.cjs in 1s
8
8
  
9
9
  src/index.ts → dist/index.mjs...
10
- created dist/index.mjs in 955ms
10
+ created dist/index.mjs in 797ms
11
11
  
12
12
  src/index.ts → dist/index.d.ts...
13
- created dist/index.d.ts in 11.6s
13
+ created dist/index.d.ts in 8s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @xata.io/client
2
2
 
3
+ ## 0.26.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#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
8
+
9
+ ## 0.26.4
10
+
11
+ ### Patch Changes
12
+
13
+ - [#1160](https://github.com/xataio/client-ts/pull/1160) [`7166797c`](https://github.com/xataio/client-ts/commit/7166797c28839198d20a9115d0414cebc2fed39b) Thanks [@SferaDev](https://github.com/SferaDev)! - [Files] Return file id on array
14
+
15
+ - [#1156](https://github.com/xataio/client-ts/pull/1156) [`b85df75f`](https://github.com/xataio/client-ts/commit/b85df75f2f466762a8b3d9824c9292c7e3db03fd) Thanks [@SferaDev](https://github.com/SferaDev)! - [Files] Add download transformation
16
+
3
17
  ## 0.26.3
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 instanceof Blob);
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 = 3e4;
276
+ const REQUEST_TIMEOUT = 5 * 60 * 1e3;
269
277
  function getFetchImplementation(userFetch) {
270
278
  const globalFetch = typeof fetch !== "undefined" ? fetch : void 0;
271
- const fetchImpl = userFetch ?? globalFetch;
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.3";
539
+ const VERSION = "0.26.5";
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 instanceof Blob || typeof body.text === "function") {
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 instanceof Blob) {
2684
+ if (isBlob(file)) {
2677
2685
  return file.type;
2678
2686
  }
2679
2687
  try {
@@ -2720,19 +2728,23 @@ var __publicField$6 = (obj, key, value) => {
2720
2728
  class XataFile {
2721
2729
  constructor(file) {
2722
2730
  /**
2723
- * Name of this file.
2731
+ * Identifier of the file.
2732
+ */
2733
+ __publicField$6(this, "id");
2734
+ /**
2735
+ * Name of the file.
2724
2736
  */
2725
2737
  __publicField$6(this, "name");
2726
2738
  /**
2727
- * Media type of this file.
2739
+ * Media type of the file.
2728
2740
  */
2729
2741
  __publicField$6(this, "mediaType");
2730
2742
  /**
2731
- * Base64 encoded content of this file.
2743
+ * Base64 encoded content of the file.
2732
2744
  */
2733
2745
  __publicField$6(this, "base64Content");
2734
2746
  /**
2735
- * Whether to enable public url for this file.
2747
+ * Whether to enable public url for the file.
2736
2748
  */
2737
2749
  __publicField$6(this, "enablePublicUrl");
2738
2750
  /**
@@ -2740,25 +2752,26 @@ class XataFile {
2740
2752
  */
2741
2753
  __publicField$6(this, "signedUrlTimeout");
2742
2754
  /**
2743
- * Size of this file.
2755
+ * Size of the file.
2744
2756
  */
2745
2757
  __publicField$6(this, "size");
2746
2758
  /**
2747
- * Version of this file.
2759
+ * Version of the file.
2748
2760
  */
2749
2761
  __publicField$6(this, "version");
2750
2762
  /**
2751
- * Url of this file.
2763
+ * Url of the file.
2752
2764
  */
2753
2765
  __publicField$6(this, "url");
2754
2766
  /**
2755
- * Signed url of this file.
2767
+ * Signed url of the file.
2756
2768
  */
2757
2769
  __publicField$6(this, "signedUrl");
2758
2770
  /**
2759
- * Attributes of this file.
2771
+ * Attributes of the file.
2760
2772
  */
2761
2773
  __publicField$6(this, "attributes");
2774
+ this.id = file.id;
2762
2775
  this.name = file.name || "";
2763
2776
  this.mediaType = file.mediaType || "application/octet-stream";
2764
2777
  this.base64Content = file.base64Content;
@@ -2859,7 +2872,15 @@ const parseInputFileEntry = async (entry) => {
2859
2872
  if (!isDefined(entry))
2860
2873
  return null;
2861
2874
  const { id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout } = await entry;
2862
- return compactObject({ id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout });
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
+ });
2863
2884
  };
2864
2885
 
2865
2886
  function cleanFilter(filter) {