@xata.io/client 0.0.0-alpha.f75afb4 → 0.0.0-beta.09892c4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @xata.io/client
2
2
 
3
+ ## 0.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 12729ab: Make API client fetch implementation optional
8
+
3
9
  ## 0.5.0
4
10
 
5
11
  ### Patch Changes
@@ -4,7 +4,7 @@ import { HostProvider } from './providers';
4
4
  import type * as Responses from './responses';
5
5
  import type * as Schemas from './schemas';
6
6
  export interface XataApiClientOptions {
7
- fetch: FetchImpl;
7
+ fetch?: FetchImpl;
8
8
  apiKey: string;
9
9
  host?: HostProvider;
10
10
  }
@@ -17,14 +17,15 @@ const components_1 = require("./components");
17
17
  const providers_1 = require("./providers");
18
18
  class XataApiClient {
19
19
  constructor(options) {
20
- var _a;
20
+ var _a, _b;
21
21
  _XataApiClient_extraProps.set(this, void 0);
22
- const fetchImpl = typeof fetch !== 'undefined' ? fetch : options.fetch;
22
+ const globalFetch = typeof fetch !== 'undefined' ? fetch : undefined;
23
+ const fetchImpl = (_a = options.fetch) !== null && _a !== void 0 ? _a : globalFetch;
23
24
  if (!fetchImpl) {
24
25
  /** @todo add a link after docs exist */
25
26
  throw new Error(`The \`fetch\` option passed to the Xata client is resolving to a falsy value and may not be correctly imported.`);
26
27
  }
27
- const provider = (_a = options.host) !== null && _a !== void 0 ? _a : 'production';
28
+ const provider = (_b = options.host) !== null && _b !== void 0 ? _b : 'production';
28
29
  __classPrivateFieldSet(this, _XataApiClient_extraProps, {
29
30
  apiUrl: (0, providers_1.getHostUrl)(provider, 'main'),
30
31
  workspacesApiUrl: (0, providers_1.getHostUrl)(provider, 'workspaces'),
@@ -41,6 +41,7 @@ class Repository extends query_1.Query {
41
41
  exports.Repository = Repository;
42
42
  class RestRepository extends Repository {
43
43
  constructor(client, table) {
44
+ var _a;
44
45
  super(null, table, {});
45
46
  _RestRepository_instances.add(this);
46
47
  _RestRepository_client.set(this, void 0);
@@ -49,8 +50,10 @@ class RestRepository extends Repository {
49
50
  __classPrivateFieldSet(this, _RestRepository_client, client, "f");
50
51
  __classPrivateFieldSet(this, _RestRepository_table, table, "f");
51
52
  // TODO: Remove when integrating with API client
52
- const fetchImpl = typeof fetch !== 'undefined' ? fetch : __classPrivateFieldGet(this, _RestRepository_client, "f").options.fetch;
53
+ const globalFetch = typeof fetch !== 'undefined' ? fetch : undefined;
54
+ const fetchImpl = (_a = __classPrivateFieldGet(this, _RestRepository_client, "f").options.fetch) !== null && _a !== void 0 ? _a : globalFetch;
53
55
  if (!fetchImpl) {
56
+ /** @todo add a link after docs exist */
54
57
  throw new Error(`The \`fetch\` option passed to the Xata client is resolving to a falsy value and may not be correctly imported.`);
55
58
  }
56
59
  __classPrivateFieldSet(this, _RestRepository_fetch, fetchImpl, "f");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xata.io/client",
3
- "version": "0.0.0-alpha.f75afb4",
3
+ "version": "0.0.0-beta.09892c4",
4
4
  "description": "Xata.io SDK for TypeScript and JavaScript",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -20,5 +20,5 @@
20
20
  "url": "https://github.com/xataio/client-ts/issues"
21
21
  },
22
22
  "homepage": "https://github.com/xataio/client-ts/blob/main/client/README.md",
23
- "gitHead": "f75afb4f33bcbc57ac41784d154ac5a6fffcd1ce"
23
+ "gitHead": "09892c40a01ece59c802844310aac17aba7a281c"
24
24
  }