@xata.io/client
Advanced tools
Comparing version 0.0.0-alpha.e39eb6f to 0.0.0-alpha.e3f7a92
@@ -20,2 +20,3 @@ "use strict"; | ||
exports.XataError = exports.BaseClient = exports.RestRespositoryFactory = exports.RestRepository = exports.Repository = exports.Query = exports.includesAll = exports.includesPattern = exports.includesSubstring = exports.includes = exports.contains = exports.isNot = exports.is = exports.pattern = exports.endsWith = exports.startsWith = exports.notExists = exports.exists = exports.le = exports.lte = exports.lt = exports.gte = exports.ge = exports.gt = void 0; | ||
const errors_1 = require("./util/errors"); | ||
const gt = (value) => ({ $gt: value }); | ||
@@ -169,21 +170,12 @@ exports.gt = gt; | ||
this.client = client; | ||
const { fetch } = client.options; | ||
if (fetch) { | ||
const doWeHaveFetch = typeof fetch !== 'undefined'; | ||
const isInjectedFetchProblematic = !this.client.options.fetch; | ||
if (doWeHaveFetch) { | ||
this.fetch = fetch; | ||
} | ||
else if (typeof window === 'object') { | ||
this.fetch = window.fetch; | ||
else if (isInjectedFetchProblematic) { | ||
throw errors_1.errors.falsyFetchImplementation; | ||
} | ||
else if (typeof require === 'function') { | ||
try { | ||
this.fetch = require('node-fetch'); | ||
} | ||
catch (err) { | ||
try { | ||
this.fetch = require('cross-fetch'); | ||
} | ||
catch (err) { | ||
throw new Error('No fetch implementation found. Please provide one in the constructor'); | ||
} | ||
} | ||
else { | ||
this.fetch = this.client.options.fetch; | ||
} | ||
@@ -190,0 +182,0 @@ Object.defineProperty(this, 'client', { enumerable: false }); |
{ | ||
"name": "@xata.io/client", | ||
"version": "0.0.0-alpha.e39eb6f", | ||
"version": "0.0.0-alpha.e3f7a92", | ||
"description": "Xata.io SDK for TypeScript and JavaScript", | ||
@@ -23,3 +23,3 @@ "main": "./dist/index.js", | ||
"homepage": "https://github.com/xataio/client-ts/blob/main/client/README.md", | ||
"gitHead": "e39eb6ff6ee86adbc9b7c445c05c47b65a970fee" | ||
"gitHead": "e3f7a9253d72151233d02b397e0ab83a254ae8b4" | ||
} |
@@ -0,1 +1,3 @@ | ||
import { errors } from './util/errors'; | ||
export interface XataRecord { | ||
@@ -283,18 +285,11 @@ id: string; | ||
const { fetch } = client.options; | ||
const doWeHaveFetch = typeof fetch !== 'undefined'; | ||
const isInjectedFetchProblematic = !this.client.options.fetch; | ||
if (fetch) { | ||
if (doWeHaveFetch) { | ||
this.fetch = fetch; | ||
} else if (typeof window === 'object') { | ||
this.fetch = window.fetch; | ||
} else if (typeof require === 'function') { | ||
try { | ||
this.fetch = require('node-fetch'); | ||
} catch (err) { | ||
try { | ||
this.fetch = require('cross-fetch'); | ||
} catch (err) { | ||
throw new Error('No fetch implementation found. Please provide one in the constructor'); | ||
} | ||
} | ||
} else if (isInjectedFetchProblematic) { | ||
throw errors.falsyFetchImplementation; | ||
} else { | ||
this.fetch = this.client.options.fetch; | ||
} | ||
@@ -301,0 +296,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75124
13
1611