@xata.io/client 0.0.0-alpha.fd777ef → 0.0.0-beta.09bfef8
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 +14 -0
- package/dist/api/client.d.ts +1 -1
- package/dist/api/client.js +8 -8
- package/dist/api/fetcher.d.ts +15 -0
- package/dist/api/fetcher.js +19 -13
- package/dist/schema/config.d.ts +4 -0
- package/dist/schema/config.js +83 -0
- package/dist/schema/filters.d.ts +16 -12
- package/dist/schema/operators.d.ts +17 -27
- package/dist/schema/operators.js +1 -14
- package/dist/schema/query.d.ts +3 -3
- package/dist/schema/repository.d.ts +56 -8
- package/dist/schema/repository.js +143 -54
- package/dist/schema/selection.d.ts +4 -3
- package/dist/schema/selection.spec.js +152 -58
- package/dist/schema/sorting.d.ts +8 -3
- package/dist/schema/sorting.js +18 -15
- package/dist/schema/sorting.spec.d.ts +1 -0
- package/dist/schema/sorting.spec.js +9 -0
- package/dist/util/environment.d.ts +5 -0
- package/dist/util/environment.js +68 -0
- package/dist/util/fetch.d.ts +2 -0
- package/dist/util/fetch.js +13 -0
- package/dist/util/lang.d.ts +1 -1
- package/dist/util/lang.js +1 -1
- package/package.json +2 -2
@@ -0,0 +1,68 @@
|
|
1
|
+
"use strict";
|
2
|
+
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
|
3
|
+
///<reference path="../types/global-node.d.ts"/>
|
4
|
+
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
|
5
|
+
///<reference path="../types/global-variables.d.ts"/>
|
6
|
+
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
|
7
|
+
///<reference path="../types/global-deno.d.ts"/>
|
8
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
9
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
10
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
11
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
12
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
13
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
14
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
15
|
+
});
|
16
|
+
};
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
18
|
+
exports.getGitBranch = exports.getEnvVariable = void 0;
|
19
|
+
const lang_1 = require("./lang");
|
20
|
+
function getEnvVariable(name) {
|
21
|
+
var _a, _b;
|
22
|
+
// Node.js: process.env
|
23
|
+
try {
|
24
|
+
if ((0, lang_1.isObject)(process) && (0, lang_1.isString)((_a = process === null || process === void 0 ? void 0 : process.env) === null || _a === void 0 ? void 0 : _a[name])) {
|
25
|
+
return process.env[name];
|
26
|
+
}
|
27
|
+
}
|
28
|
+
catch (err) {
|
29
|
+
// Ignore: Should never happen
|
30
|
+
}
|
31
|
+
try {
|
32
|
+
// Deno: Deno.env.get
|
33
|
+
if ((0, lang_1.isObject)(Deno) && (0, lang_1.isString)((_b = Deno === null || Deno === void 0 ? void 0 : Deno.env) === null || _b === void 0 ? void 0 : _b.get(name))) {
|
34
|
+
return Deno.env.get(name);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
catch (err) {
|
38
|
+
// Ignore: Will fail if not using --allow-env
|
39
|
+
}
|
40
|
+
}
|
41
|
+
exports.getEnvVariable = getEnvVariable;
|
42
|
+
function getGitBranch() {
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
44
|
+
// Node.js: child_process.execSync
|
45
|
+
try {
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
47
|
+
return require('child_process').execSync('git branch --show-current', { encoding: 'utf-8' }).trim();
|
48
|
+
}
|
49
|
+
catch (err) {
|
50
|
+
// Ignore
|
51
|
+
}
|
52
|
+
// Deno: Deno.run
|
53
|
+
try {
|
54
|
+
if ((0, lang_1.isObject)(Deno)) {
|
55
|
+
const process = Deno.run({
|
56
|
+
cmd: ['git', 'branch', '--show-current'],
|
57
|
+
stdout: 'piped',
|
58
|
+
stderr: 'piped'
|
59
|
+
});
|
60
|
+
return new TextDecoder().decode(yield process.output()).trim();
|
61
|
+
}
|
62
|
+
}
|
63
|
+
catch (err) {
|
64
|
+
// Ignore: Will fail if not using --allow-run
|
65
|
+
}
|
66
|
+
});
|
67
|
+
}
|
68
|
+
exports.getGitBranch = getGitBranch;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getFetchImplementation = void 0;
|
4
|
+
function getFetchImplementation(userFetch) {
|
5
|
+
const globalFetch = typeof fetch !== 'undefined' ? fetch : undefined;
|
6
|
+
const fetchImpl = userFetch !== null && userFetch !== void 0 ? userFetch : globalFetch;
|
7
|
+
if (!fetchImpl) {
|
8
|
+
/** @todo add a link after docs exist */
|
9
|
+
throw new Error(`The \`fetch\` option passed to the Xata client is resolving to a falsy value and may not be correctly imported.`);
|
10
|
+
}
|
11
|
+
return fetchImpl;
|
12
|
+
}
|
13
|
+
exports.getFetchImplementation = getFetchImplementation;
|
package/dist/util/lang.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
export declare function compact<T>(arr: Array<T | null | undefined>): T[];
|
2
2
|
export declare function compactObject<T>(obj: Record<string, T | null | undefined>): Record<string, T>;
|
3
3
|
export declare type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
4
|
-
export declare function isObject(value: any): value is
|
4
|
+
export declare function isObject(value: any): value is Record<string, unknown>;
|
5
5
|
export declare function isString(value: any): value is string;
|
package/dist/util/lang.js
CHANGED
@@ -13,7 +13,7 @@ function compactObject(obj) {
|
|
13
13
|
}
|
14
14
|
exports.compactObject = compactObject;
|
15
15
|
function isObject(value) {
|
16
|
-
return value
|
16
|
+
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
17
17
|
}
|
18
18
|
exports.isObject = isObject;
|
19
19
|
function isString(value) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@xata.io/client",
|
3
|
-
"version": "0.0.0-
|
3
|
+
"version": "0.0.0-beta.09bfef8",
|
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": "
|
23
|
+
"gitHead": "09bfef88b675f94cf64851e574c4e6cfc65e4b05"
|
24
24
|
}
|