@xata.io/client 0.0.0-next.vb0a85c9143c13dd5082810db994a5fede59bb0a4 → 0.0.0-next.vb8f7abfb21e48d64818016a0c33061c23e00341c
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 +11 -3
- package/dist/index.cjs +724 -603
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4734 -3872
- package/dist/index.mjs +710 -600
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -37,8 +37,7 @@ function getLens(b64) {
|
|
37
37
|
throw new Error("Invalid string. Length must be a multiple of 4");
|
38
38
|
}
|
39
39
|
let validLen = b64.indexOf("=");
|
40
|
-
if (validLen === -1)
|
41
|
-
validLen = len;
|
40
|
+
if (validLen === -1) validLen = len;
|
42
41
|
const placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4;
|
43
42
|
return [validLen, placeHoldersLen];
|
44
43
|
}
|
@@ -373,10 +372,8 @@ class Buffer extends Uint8Array {
|
|
373
372
|
break;
|
374
373
|
}
|
375
374
|
}
|
376
|
-
if (x < y)
|
377
|
-
|
378
|
-
if (y < x)
|
379
|
-
return 1;
|
375
|
+
if (x < y) return -1;
|
376
|
+
if (y < x) return 1;
|
380
377
|
return 0;
|
381
378
|
}
|
382
379
|
/**
|
@@ -389,33 +386,21 @@ class Buffer extends Uint8Array {
|
|
389
386
|
* @param sourceEnd The offset within this buffer at which to end copying (exclusive).
|
390
387
|
*/
|
391
388
|
copy(targetBuffer, targetStart, sourceStart, sourceEnd) {
|
392
|
-
if (!Buffer.isBuffer(targetBuffer))
|
393
|
-
|
394
|
-
if (!
|
395
|
-
|
396
|
-
if (
|
397
|
-
|
398
|
-
if (
|
399
|
-
|
400
|
-
if (
|
401
|
-
targetStart = targetBuffer.length;
|
402
|
-
if (!targetStart)
|
403
|
-
targetStart = 0;
|
404
|
-
if (sourceEnd > 0 && sourceEnd < sourceStart)
|
405
|
-
sourceEnd = sourceStart;
|
406
|
-
if (sourceEnd === sourceStart)
|
407
|
-
return 0;
|
408
|
-
if (targetBuffer.length === 0 || this.length === 0)
|
409
|
-
return 0;
|
389
|
+
if (!Buffer.isBuffer(targetBuffer)) throw new TypeError("argument should be a Buffer");
|
390
|
+
if (!sourceStart) sourceStart = 0;
|
391
|
+
if (!targetStart) targetStart = 0;
|
392
|
+
if (!sourceEnd && sourceEnd !== 0) sourceEnd = this.length;
|
393
|
+
if (targetStart >= targetBuffer.length) targetStart = targetBuffer.length;
|
394
|
+
if (!targetStart) targetStart = 0;
|
395
|
+
if (sourceEnd > 0 && sourceEnd < sourceStart) sourceEnd = sourceStart;
|
396
|
+
if (sourceEnd === sourceStart) return 0;
|
397
|
+
if (targetBuffer.length === 0 || this.length === 0) return 0;
|
410
398
|
if (targetStart < 0) {
|
411
399
|
throw new RangeError("targetStart out of bounds");
|
412
400
|
}
|
413
|
-
if (sourceStart < 0 || sourceStart >= this.length)
|
414
|
-
|
415
|
-
if (sourceEnd
|
416
|
-
throw new RangeError("sourceEnd out of bounds");
|
417
|
-
if (sourceEnd > this.length)
|
418
|
-
sourceEnd = this.length;
|
401
|
+
if (sourceStart < 0 || sourceStart >= this.length) throw new RangeError("Index out of range");
|
402
|
+
if (sourceEnd < 0) throw new RangeError("sourceEnd out of bounds");
|
403
|
+
if (sourceEnd > this.length) sourceEnd = this.length;
|
419
404
|
if (targetBuffer.length - targetStart < sourceEnd - sourceStart) {
|
420
405
|
sourceEnd = targetBuffer.length - targetStart + sourceStart;
|
421
406
|
}
|
@@ -1576,8 +1561,7 @@ class Buffer extends Uint8Array {
|
|
1576
1561
|
let c, hi, lo;
|
1577
1562
|
const byteArray = [];
|
1578
1563
|
for (let i = 0; i < str.length; ++i) {
|
1579
|
-
if ((units -= 2) < 0)
|
1580
|
-
break;
|
1564
|
+
if ((units -= 2) < 0) break;
|
1581
1565
|
c = str.charCodeAt(i);
|
1582
1566
|
hi = c >> 8;
|
1583
1567
|
lo = c % 256;
|
@@ -1731,13 +1715,10 @@ class Buffer extends Uint8Array {
|
|
1731
1715
|
let foundIndex = -1;
|
1732
1716
|
for (i = byteOffset; i < arrLength; i++) {
|
1733
1717
|
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
1734
|
-
if (foundIndex === -1)
|
1735
|
-
|
1736
|
-
if (i - foundIndex + 1 === valLength)
|
1737
|
-
return foundIndex * indexSize;
|
1718
|
+
if (foundIndex === -1) foundIndex = i;
|
1719
|
+
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
|
1738
1720
|
} else {
|
1739
|
-
if (foundIndex !== -1)
|
1740
|
-
i -= i - foundIndex;
|
1721
|
+
if (foundIndex !== -1) i -= i - foundIndex;
|
1741
1722
|
foundIndex = -1;
|
1742
1723
|
}
|
1743
1724
|
}
|
@@ -1761,18 +1742,13 @@ class Buffer extends Uint8Array {
|
|
1761
1742
|
return -1;
|
1762
1743
|
}
|
1763
1744
|
static _checkOffset(offset, ext, length) {
|
1764
|
-
if (offset % 1 !== 0 || offset < 0)
|
1765
|
-
|
1766
|
-
if (offset + ext > length)
|
1767
|
-
throw new RangeError("Trying to access beyond buffer length");
|
1745
|
+
if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint");
|
1746
|
+
if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
|
1768
1747
|
}
|
1769
1748
|
static _checkInt(buf, value, offset, ext, max, min) {
|
1770
|
-
if (!Buffer.isBuffer(buf))
|
1771
|
-
|
1772
|
-
if (
|
1773
|
-
throw new RangeError('"value" argument is out of bounds');
|
1774
|
-
if (offset + ext > buf.length)
|
1775
|
-
throw new RangeError("Index out of range");
|
1749
|
+
if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
1750
|
+
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
|
1751
|
+
if (offset + ext > buf.length) throw new RangeError("Index out of range");
|
1776
1752
|
}
|
1777
1753
|
static _getEncoding(encoding) {
|
1778
1754
|
let toLowerCase = false;
|
@@ -1822,8 +1798,7 @@ const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
|
|
1822
1798
|
function base64clean(str) {
|
1823
1799
|
str = str.split("=")[0];
|
1824
1800
|
str = str.trim().replace(INVALID_BASE64_RE, "");
|
1825
|
-
if (str.length < 2)
|
1826
|
-
return "";
|
1801
|
+
if (str.length < 2) return "";
|
1827
1802
|
while (str.length % 4 !== 0) {
|
1828
1803
|
str = str + "=";
|
1829
1804
|
}
|
@@ -1924,155 +1899,15 @@ function promiseMap(inputValues, mapper) {
|
|
1924
1899
|
return inputValues.reduce(reducer, Promise.resolve([]));
|
1925
1900
|
}
|
1926
1901
|
|
1927
|
-
|
1928
|
-
|
1929
|
-
if (isDefined(process) && isDefined(process.env)) {
|
1930
|
-
return {
|
1931
|
-
apiKey: process.env.XATA_API_KEY ?? getGlobalApiKey(),
|
1932
|
-
databaseURL: process.env.XATA_DATABASE_URL ?? getGlobalDatabaseURL(),
|
1933
|
-
branch: process.env.XATA_BRANCH ?? getGlobalBranch(),
|
1934
|
-
deployPreview: process.env.XATA_PREVIEW,
|
1935
|
-
deployPreviewBranch: process.env.XATA_PREVIEW_BRANCH,
|
1936
|
-
vercelGitCommitRef: process.env.VERCEL_GIT_COMMIT_REF,
|
1937
|
-
vercelGitRepoOwner: process.env.VERCEL_GIT_REPO_OWNER
|
1938
|
-
};
|
1939
|
-
}
|
1940
|
-
} catch (err) {
|
1941
|
-
}
|
1942
|
-
try {
|
1943
|
-
if (isObject(Deno) && isObject(Deno.env)) {
|
1944
|
-
return {
|
1945
|
-
apiKey: Deno.env.get("XATA_API_KEY") ?? getGlobalApiKey(),
|
1946
|
-
databaseURL: Deno.env.get("XATA_DATABASE_URL") ?? getGlobalDatabaseURL(),
|
1947
|
-
branch: Deno.env.get("XATA_BRANCH") ?? getGlobalBranch(),
|
1948
|
-
deployPreview: Deno.env.get("XATA_PREVIEW"),
|
1949
|
-
deployPreviewBranch: Deno.env.get("XATA_PREVIEW_BRANCH"),
|
1950
|
-
vercelGitCommitRef: Deno.env.get("VERCEL_GIT_COMMIT_REF"),
|
1951
|
-
vercelGitRepoOwner: Deno.env.get("VERCEL_GIT_REPO_OWNER")
|
1952
|
-
};
|
1953
|
-
}
|
1954
|
-
} catch (err) {
|
1955
|
-
}
|
1956
|
-
return {
|
1957
|
-
apiKey: getGlobalApiKey(),
|
1958
|
-
databaseURL: getGlobalDatabaseURL(),
|
1959
|
-
branch: getGlobalBranch(),
|
1960
|
-
deployPreview: void 0,
|
1961
|
-
deployPreviewBranch: void 0,
|
1962
|
-
vercelGitCommitRef: void 0,
|
1963
|
-
vercelGitRepoOwner: void 0
|
1964
|
-
};
|
1965
|
-
}
|
1966
|
-
function getEnableBrowserVariable() {
|
1967
|
-
try {
|
1968
|
-
if (isObject(process) && isObject(process.env) && process.env.XATA_ENABLE_BROWSER !== void 0) {
|
1969
|
-
return process.env.XATA_ENABLE_BROWSER === "true";
|
1970
|
-
}
|
1971
|
-
} catch (err) {
|
1972
|
-
}
|
1973
|
-
try {
|
1974
|
-
if (isObject(Deno) && isObject(Deno.env) && Deno.env.get("XATA_ENABLE_BROWSER") !== void 0) {
|
1975
|
-
return Deno.env.get("XATA_ENABLE_BROWSER") === "true";
|
1976
|
-
}
|
1977
|
-
} catch (err) {
|
1978
|
-
}
|
1979
|
-
try {
|
1980
|
-
return XATA_ENABLE_BROWSER === true || XATA_ENABLE_BROWSER === "true";
|
1981
|
-
} catch (err) {
|
1982
|
-
return void 0;
|
1983
|
-
}
|
1984
|
-
}
|
1985
|
-
function getGlobalApiKey() {
|
1986
|
-
try {
|
1987
|
-
return XATA_API_KEY;
|
1988
|
-
} catch (err) {
|
1989
|
-
return void 0;
|
1990
|
-
}
|
1991
|
-
}
|
1992
|
-
function getGlobalDatabaseURL() {
|
1993
|
-
try {
|
1994
|
-
return XATA_DATABASE_URL;
|
1995
|
-
} catch (err) {
|
1996
|
-
return void 0;
|
1997
|
-
}
|
1998
|
-
}
|
1999
|
-
function getGlobalBranch() {
|
2000
|
-
try {
|
2001
|
-
return XATA_BRANCH;
|
2002
|
-
} catch (err) {
|
2003
|
-
return void 0;
|
2004
|
-
}
|
2005
|
-
}
|
2006
|
-
function getDatabaseURL() {
|
2007
|
-
try {
|
2008
|
-
const { databaseURL } = getEnvironment();
|
2009
|
-
return databaseURL;
|
2010
|
-
} catch (err) {
|
2011
|
-
return void 0;
|
2012
|
-
}
|
2013
|
-
}
|
2014
|
-
function getAPIKey() {
|
2015
|
-
try {
|
2016
|
-
const { apiKey } = getEnvironment();
|
2017
|
-
return apiKey;
|
2018
|
-
} catch (err) {
|
2019
|
-
return void 0;
|
2020
|
-
}
|
2021
|
-
}
|
2022
|
-
function getBranch() {
|
2023
|
-
try {
|
2024
|
-
const { branch } = getEnvironment();
|
2025
|
-
return branch;
|
2026
|
-
} catch (err) {
|
2027
|
-
return void 0;
|
2028
|
-
}
|
2029
|
-
}
|
2030
|
-
function buildPreviewBranchName({ org, branch }) {
|
2031
|
-
return `preview-${org}-${branch}`;
|
2032
|
-
}
|
2033
|
-
function getPreviewBranch() {
|
2034
|
-
try {
|
2035
|
-
const { deployPreview, deployPreviewBranch, vercelGitCommitRef, vercelGitRepoOwner } = getEnvironment();
|
2036
|
-
if (deployPreviewBranch)
|
2037
|
-
return deployPreviewBranch;
|
2038
|
-
switch (deployPreview) {
|
2039
|
-
case "vercel": {
|
2040
|
-
if (!vercelGitCommitRef || !vercelGitRepoOwner) {
|
2041
|
-
console.warn("XATA_PREVIEW=vercel but VERCEL_GIT_COMMIT_REF or VERCEL_GIT_REPO_OWNER is not valid");
|
2042
|
-
return void 0;
|
2043
|
-
}
|
2044
|
-
return buildPreviewBranchName({ org: vercelGitRepoOwner, branch: vercelGitCommitRef });
|
2045
|
-
}
|
2046
|
-
}
|
2047
|
-
return void 0;
|
2048
|
-
} catch (err) {
|
2049
|
-
return void 0;
|
2050
|
-
}
|
2051
|
-
}
|
2052
|
-
|
2053
|
-
var __accessCheck$6 = (obj, member, msg) => {
|
2054
|
-
if (!member.has(obj))
|
2055
|
-
throw TypeError("Cannot " + msg);
|
2056
|
-
};
|
2057
|
-
var __privateGet$5 = (obj, member, getter) => {
|
2058
|
-
__accessCheck$6(obj, member, "read from private field");
|
2059
|
-
return getter ? getter.call(obj) : member.get(obj);
|
2060
|
-
};
|
2061
|
-
var __privateAdd$6 = (obj, member, value) => {
|
2062
|
-
if (member.has(obj))
|
2063
|
-
throw TypeError("Cannot add the same private member more than once");
|
2064
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
1902
|
+
var __typeError$6 = (msg) => {
|
1903
|
+
throw TypeError(msg);
|
2065
1904
|
};
|
2066
|
-
var
|
2067
|
-
|
2068
|
-
|
2069
|
-
|
2070
|
-
|
2071
|
-
var
|
2072
|
-
__accessCheck$6(obj, member, "access private method");
|
2073
|
-
return method;
|
2074
|
-
};
|
2075
|
-
var _fetch, _queue, _concurrency, _enqueue, enqueue_fn;
|
1905
|
+
var __accessCheck$6 = (obj, member, msg) => member.has(obj) || __typeError$6("Cannot " + msg);
|
1906
|
+
var __privateGet$5 = (obj, member, getter) => (__accessCheck$6(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
1907
|
+
var __privateAdd$6 = (obj, member, value) => member.has(obj) ? __typeError$6("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
1908
|
+
var __privateSet$4 = (obj, member, value, setter) => (__accessCheck$6(obj, member, "write to private field"), member.set(obj, value), value);
|
1909
|
+
var __privateMethod$4 = (obj, member, method) => (__accessCheck$6(obj, member, "access private method"), method);
|
1910
|
+
var _fetch, _queue, _concurrency, _ApiRequestPool_instances, enqueue_fn;
|
2076
1911
|
const REQUEST_TIMEOUT = 5 * 60 * 1e3;
|
2077
1912
|
function getFetchImplementation(userFetch) {
|
2078
1913
|
const globalFetch = typeof fetch !== "undefined" ? fetch : void 0;
|
@@ -2085,10 +1920,10 @@ function getFetchImplementation(userFetch) {
|
|
2085
1920
|
}
|
2086
1921
|
class ApiRequestPool {
|
2087
1922
|
constructor(concurrency = 10) {
|
2088
|
-
__privateAdd$6(this,
|
2089
|
-
__privateAdd$6(this, _fetch
|
2090
|
-
__privateAdd$6(this, _queue
|
2091
|
-
__privateAdd$6(this, _concurrency
|
1923
|
+
__privateAdd$6(this, _ApiRequestPool_instances);
|
1924
|
+
__privateAdd$6(this, _fetch);
|
1925
|
+
__privateAdd$6(this, _queue);
|
1926
|
+
__privateAdd$6(this, _concurrency);
|
2092
1927
|
__privateSet$4(this, _queue, []);
|
2093
1928
|
__privateSet$4(this, _concurrency, concurrency);
|
2094
1929
|
this.running = 0;
|
@@ -2123,7 +1958,7 @@ class ApiRequestPool {
|
|
2123
1958
|
}
|
2124
1959
|
return response;
|
2125
1960
|
};
|
2126
|
-
return __privateMethod$4(this,
|
1961
|
+
return __privateMethod$4(this, _ApiRequestPool_instances, enqueue_fn).call(this, async () => {
|
2127
1962
|
return await runRequest();
|
2128
1963
|
});
|
2129
1964
|
}
|
@@ -2131,7 +1966,7 @@ class ApiRequestPool {
|
|
2131
1966
|
_fetch = new WeakMap();
|
2132
1967
|
_queue = new WeakMap();
|
2133
1968
|
_concurrency = new WeakMap();
|
2134
|
-
|
1969
|
+
_ApiRequestPool_instances = new WeakSet();
|
2135
1970
|
enqueue_fn = function(task) {
|
2136
1971
|
const promise = new Promise((resolve) => __privateGet$5(this, _queue).push(resolve)).finally(() => {
|
2137
1972
|
this.started--;
|
@@ -2334,7 +2169,7 @@ function defaultOnOpen(response) {
|
|
2334
2169
|
}
|
2335
2170
|
}
|
2336
2171
|
|
2337
|
-
const VERSION = "0.29.
|
2172
|
+
const VERSION = "0.29.5";
|
2338
2173
|
|
2339
2174
|
class ErrorWithCause extends Error {
|
2340
2175
|
constructor(message, options) {
|
@@ -2414,18 +2249,15 @@ function parseProviderString(provider = "production") {
|
|
2414
2249
|
return provider;
|
2415
2250
|
}
|
2416
2251
|
const [main, workspaces] = provider.split(",");
|
2417
|
-
if (!main || !workspaces)
|
2418
|
-
return null;
|
2252
|
+
if (!main || !workspaces) return null;
|
2419
2253
|
return { main, workspaces };
|
2420
2254
|
}
|
2421
2255
|
function buildProviderString(provider) {
|
2422
|
-
if (isHostProviderAlias(provider))
|
2423
|
-
return provider;
|
2256
|
+
if (isHostProviderAlias(provider)) return provider;
|
2424
2257
|
return `${provider.main},${provider.workspaces}`;
|
2425
2258
|
}
|
2426
2259
|
function parseWorkspacesUrlParts(url) {
|
2427
|
-
if (!isString(url))
|
2428
|
-
return null;
|
2260
|
+
if (!isString(url)) return null;
|
2429
2261
|
const matches = {
|
2430
2262
|
production: url.match(/(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.xata\.sh\/db\/([^:]+):?(.*)?/),
|
2431
2263
|
staging: url.match(/(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.staging-xata\.dev\/db\/([^:]+):?(.*)?/),
|
@@ -2433,16 +2265,14 @@ function parseWorkspacesUrlParts(url) {
|
|
2433
2265
|
local: url.match(/(?:https?:\/\/)?([^.]+)(?:\.([^.]+))\.localhost:(?:\d+)\/db\/([^:]+):?(.*)?/)
|
2434
2266
|
};
|
2435
2267
|
const [host, match] = Object.entries(matches).find(([, match2]) => match2 !== null) ?? [];
|
2436
|
-
if (!isHostProviderAlias(host) || !match)
|
2437
|
-
return null;
|
2268
|
+
if (!isHostProviderAlias(host) || !match) return null;
|
2438
2269
|
return { workspace: match[1], region: match[2], database: match[3], branch: match[4], host };
|
2439
2270
|
}
|
2440
2271
|
|
2441
2272
|
const pool = new ApiRequestPool();
|
2442
2273
|
const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
2443
2274
|
const cleanQueryParams = Object.entries(queryParams).reduce((acc, [key, value]) => {
|
2444
|
-
if (value === void 0 || value === null)
|
2445
|
-
return acc;
|
2275
|
+
if (value === void 0 || value === null) return acc;
|
2446
2276
|
return { ...acc, [key]: value };
|
2447
2277
|
}, {});
|
2448
2278
|
const query = new URLSearchParams(cleanQueryParams).toString();
|
@@ -2490,8 +2320,7 @@ function hostHeader(url) {
|
|
2490
2320
|
return groups?.host ? { Host: groups.host } : {};
|
2491
2321
|
}
|
2492
2322
|
async function parseBody(body, headers) {
|
2493
|
-
if (!isDefined(body))
|
2494
|
-
return void 0;
|
2323
|
+
if (!isDefined(body)) return void 0;
|
2495
2324
|
if (isBlob(body) || typeof body.text === "function") {
|
2496
2325
|
return body;
|
2497
2326
|
}
|
@@ -2570,8 +2399,7 @@ async function fetch$1({
|
|
2570
2399
|
[TraceAttributes.CLOUDFLARE_RAY_ID]: response.headers?.get("cf-ray") ?? void 0
|
2571
2400
|
});
|
2572
2401
|
const message = response.headers?.get("x-xata-message");
|
2573
|
-
if (message)
|
2574
|
-
console.warn(message);
|
2402
|
+
if (message) console.warn(message);
|
2575
2403
|
if (response.status === 204) {
|
2576
2404
|
return {};
|
2577
2405
|
}
|
@@ -2655,7 +2483,60 @@ function parseUrl(url) {
|
|
2655
2483
|
|
2656
2484
|
const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
|
2657
2485
|
|
2658
|
-
const
|
2486
|
+
const listClusterBranches = (variables, signal) => dataPlaneFetch({
|
2487
|
+
url: "/cluster/{clusterId}/branches",
|
2488
|
+
method: "get",
|
2489
|
+
...variables,
|
2490
|
+
signal
|
2491
|
+
});
|
2492
|
+
const listClusterExtensions = (variables, signal) => dataPlaneFetch({
|
2493
|
+
url: "/cluster/{clusterId}/extensions",
|
2494
|
+
method: "get",
|
2495
|
+
...variables,
|
2496
|
+
signal
|
2497
|
+
});
|
2498
|
+
const installClusterExtension = (variables, signal) => dataPlaneFetch({
|
2499
|
+
url: "/cluster/{clusterId}/extensions",
|
2500
|
+
method: "post",
|
2501
|
+
...variables,
|
2502
|
+
signal
|
2503
|
+
});
|
2504
|
+
const dropClusterExtension = (variables, signal) => dataPlaneFetch({
|
2505
|
+
url: "/cluster/{clusterId}/extensions",
|
2506
|
+
method: "delete",
|
2507
|
+
...variables,
|
2508
|
+
signal
|
2509
|
+
});
|
2510
|
+
const getClusterMetrics = (variables, signal) => dataPlaneFetch({
|
2511
|
+
url: "/cluster/{clusterId}/metrics",
|
2512
|
+
method: "get",
|
2513
|
+
...variables,
|
2514
|
+
signal
|
2515
|
+
});
|
2516
|
+
const applyMigration = (variables, signal) => dataPlaneFetch({
|
2517
|
+
url: "/db/{dbBranchName}/migrations/apply",
|
2518
|
+
method: "post",
|
2519
|
+
...variables,
|
2520
|
+
signal
|
2521
|
+
});
|
2522
|
+
const startMigration = (variables, signal) => dataPlaneFetch({
|
2523
|
+
url: "/db/{dbBranchName}/migrations/start",
|
2524
|
+
method: "post",
|
2525
|
+
...variables,
|
2526
|
+
signal
|
2527
|
+
});
|
2528
|
+
const completeMigration = (variables, signal) => dataPlaneFetch({
|
2529
|
+
url: "/db/{dbBranchName}/migrations/complete",
|
2530
|
+
method: "post",
|
2531
|
+
...variables,
|
2532
|
+
signal
|
2533
|
+
});
|
2534
|
+
const rollbackMigration = (variables, signal) => dataPlaneFetch({
|
2535
|
+
url: "/db/{dbBranchName}/migrations/rollback",
|
2536
|
+
method: "post",
|
2537
|
+
...variables,
|
2538
|
+
signal
|
2539
|
+
});
|
2659
2540
|
const adaptTable = (variables, signal) => dataPlaneFetch({
|
2660
2541
|
url: "/db/{dbBranchName}/migrations/adapt/{tableName}",
|
2661
2542
|
method: "post",
|
@@ -2668,9 +2549,30 @@ const adaptAllTables = (variables, signal) => dataPlaneFetch({
|
|
2668
2549
|
...variables,
|
2669
2550
|
signal
|
2670
2551
|
});
|
2671
|
-
const getBranchMigrationJobStatus = (variables, signal) => dataPlaneFetch({
|
2672
|
-
|
2673
|
-
|
2552
|
+
const getBranchMigrationJobStatus = (variables, signal) => dataPlaneFetch({
|
2553
|
+
url: "/db/{dbBranchName}/migrations/status",
|
2554
|
+
method: "get",
|
2555
|
+
...variables,
|
2556
|
+
signal
|
2557
|
+
});
|
2558
|
+
const getMigrationJobs = (variables, signal) => dataPlaneFetch({
|
2559
|
+
url: "/db/{dbBranchName}/migrations/jobs",
|
2560
|
+
method: "get",
|
2561
|
+
...variables,
|
2562
|
+
signal
|
2563
|
+
});
|
2564
|
+
const getMigrationJobStatus = (variables, signal) => dataPlaneFetch({
|
2565
|
+
url: "/db/{dbBranchName}/migrations/jobs/{jobId}",
|
2566
|
+
method: "get",
|
2567
|
+
...variables,
|
2568
|
+
signal
|
2569
|
+
});
|
2570
|
+
const getMigrationHistory = (variables, signal) => dataPlaneFetch({
|
2571
|
+
url: "/db/{dbBranchName}/migrations/history",
|
2572
|
+
method: "get",
|
2573
|
+
...variables,
|
2574
|
+
signal
|
2575
|
+
});
|
2674
2576
|
const getBranchList = (variables, signal) => dataPlaneFetch({
|
2675
2577
|
url: "/dbs/{dbName}",
|
2676
2578
|
method: "get",
|
@@ -2703,12 +2605,25 @@ const getSchema = (variables, signal) => dataPlaneFetch({
|
|
2703
2605
|
...variables,
|
2704
2606
|
signal
|
2705
2607
|
});
|
2608
|
+
const getSchemas = (variables, signal) => dataPlaneFetch({
|
2609
|
+
url: "/db/{dbBranchName}/schemas",
|
2610
|
+
method: "get",
|
2611
|
+
...variables,
|
2612
|
+
signal
|
2613
|
+
});
|
2706
2614
|
const copyBranch = (variables, signal) => dataPlaneFetch({
|
2707
2615
|
url: "/db/{dbBranchName}/copy",
|
2708
2616
|
method: "post",
|
2709
2617
|
...variables,
|
2710
2618
|
signal
|
2711
2619
|
});
|
2620
|
+
const getBranchMoveStatus = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/move", method: "get", ...variables, signal });
|
2621
|
+
const moveBranch = (variables, signal) => dataPlaneFetch({
|
2622
|
+
url: "/db/{dbBranchName}/move",
|
2623
|
+
method: "put",
|
2624
|
+
...variables,
|
2625
|
+
signal
|
2626
|
+
});
|
2712
2627
|
const updateBranchMetadata = (variables, signal) => dataPlaneFetch({
|
2713
2628
|
url: "/db/{dbBranchName}/metadata",
|
2714
2629
|
method: "put",
|
@@ -2729,12 +2644,42 @@ const getBranchStats = (variables, signal) => dataPlaneFetch({
|
|
2729
2644
|
});
|
2730
2645
|
const getGitBranchesMapping = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables, signal });
|
2731
2646
|
const addGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables, signal });
|
2732
|
-
const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({
|
2733
|
-
|
2734
|
-
|
2735
|
-
|
2736
|
-
|
2737
|
-
|
2647
|
+
const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({
|
2648
|
+
url: "/dbs/{dbName}/gitBranches",
|
2649
|
+
method: "delete",
|
2650
|
+
...variables,
|
2651
|
+
signal
|
2652
|
+
});
|
2653
|
+
const resolveBranch = (variables, signal) => dataPlaneFetch({
|
2654
|
+
url: "/dbs/{dbName}/resolveBranch",
|
2655
|
+
method: "get",
|
2656
|
+
...variables,
|
2657
|
+
signal
|
2658
|
+
});
|
2659
|
+
const getBranchMigrationHistory = (variables, signal) => dataPlaneFetch({
|
2660
|
+
url: "/db/{dbBranchName}/migrations",
|
2661
|
+
method: "get",
|
2662
|
+
...variables,
|
2663
|
+
signal
|
2664
|
+
});
|
2665
|
+
const getBranchMigrationPlan = (variables, signal) => dataPlaneFetch({
|
2666
|
+
url: "/db/{dbBranchName}/migrations/plan",
|
2667
|
+
method: "post",
|
2668
|
+
...variables,
|
2669
|
+
signal
|
2670
|
+
});
|
2671
|
+
const executeBranchMigrationPlan = (variables, signal) => dataPlaneFetch({
|
2672
|
+
url: "/db/{dbBranchName}/migrations/execute",
|
2673
|
+
method: "post",
|
2674
|
+
...variables,
|
2675
|
+
signal
|
2676
|
+
});
|
2677
|
+
const queryMigrationRequests = (variables, signal) => dataPlaneFetch({
|
2678
|
+
url: "/dbs/{dbName}/migrations/query",
|
2679
|
+
method: "post",
|
2680
|
+
...variables,
|
2681
|
+
signal
|
2682
|
+
});
|
2738
2683
|
const createMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
2739
2684
|
const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2740
2685
|
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
@@ -2742,23 +2687,78 @@ const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
|
2742
2687
|
...variables,
|
2743
2688
|
signal
|
2744
2689
|
});
|
2745
|
-
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2746
|
-
|
2747
|
-
|
2748
|
-
|
2690
|
+
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2691
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
2692
|
+
method: "patch",
|
2693
|
+
...variables,
|
2694
|
+
signal
|
2695
|
+
});
|
2696
|
+
const listMigrationRequestsCommits = (variables, signal) => dataPlaneFetch({
|
2697
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/commits",
|
2698
|
+
method: "post",
|
2699
|
+
...variables,
|
2700
|
+
signal
|
2701
|
+
});
|
2702
|
+
const compareMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2703
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/compare",
|
2704
|
+
method: "post",
|
2705
|
+
...variables,
|
2706
|
+
signal
|
2707
|
+
});
|
2708
|
+
const getMigrationRequestIsMerged = (variables, signal) => dataPlaneFetch({
|
2709
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
2710
|
+
method: "get",
|
2711
|
+
...variables,
|
2712
|
+
signal
|
2713
|
+
});
|
2749
2714
|
const mergeMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2750
2715
|
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
2751
2716
|
method: "post",
|
2752
2717
|
...variables,
|
2753
2718
|
signal
|
2754
2719
|
});
|
2755
|
-
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({
|
2756
|
-
|
2757
|
-
|
2758
|
-
|
2759
|
-
|
2760
|
-
|
2761
|
-
const
|
2720
|
+
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({
|
2721
|
+
url: "/db/{dbBranchName}/schema/history",
|
2722
|
+
method: "post",
|
2723
|
+
...variables,
|
2724
|
+
signal
|
2725
|
+
});
|
2726
|
+
const compareBranchWithUserSchema = (variables, signal) => dataPlaneFetch({
|
2727
|
+
url: "/db/{dbBranchName}/schema/compare",
|
2728
|
+
method: "post",
|
2729
|
+
...variables,
|
2730
|
+
signal
|
2731
|
+
});
|
2732
|
+
const compareBranchSchemas = (variables, signal) => dataPlaneFetch({
|
2733
|
+
url: "/db/{dbBranchName}/schema/compare/{branchName}",
|
2734
|
+
method: "post",
|
2735
|
+
...variables,
|
2736
|
+
signal
|
2737
|
+
});
|
2738
|
+
const updateBranchSchema = (variables, signal) => dataPlaneFetch({
|
2739
|
+
url: "/db/{dbBranchName}/schema/update",
|
2740
|
+
method: "post",
|
2741
|
+
...variables,
|
2742
|
+
signal
|
2743
|
+
});
|
2744
|
+
const previewBranchSchemaEdit = (variables, signal) => dataPlaneFetch({
|
2745
|
+
url: "/db/{dbBranchName}/schema/preview",
|
2746
|
+
method: "post",
|
2747
|
+
...variables,
|
2748
|
+
signal
|
2749
|
+
});
|
2750
|
+
const applyBranchSchemaEdit = (variables, signal) => dataPlaneFetch({
|
2751
|
+
url: "/db/{dbBranchName}/schema/apply",
|
2752
|
+
method: "post",
|
2753
|
+
...variables,
|
2754
|
+
signal
|
2755
|
+
});
|
2756
|
+
const pushBranchMigrations = (variables, signal) => dataPlaneFetch({
|
2757
|
+
url: "/db/{dbBranchName}/schema/push",
|
2758
|
+
method: "post",
|
2759
|
+
...variables,
|
2760
|
+
signal
|
2761
|
+
});
|
2762
2762
|
const createTable = (variables, signal) => dataPlaneFetch({
|
2763
2763
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
2764
2764
|
method: "put",
|
@@ -2771,14 +2771,24 @@ const deleteTable = (variables, signal) => dataPlaneFetch({
|
|
2771
2771
|
...variables,
|
2772
2772
|
signal
|
2773
2773
|
});
|
2774
|
-
const updateTable = (variables, signal) => dataPlaneFetch({
|
2774
|
+
const updateTable = (variables, signal) => dataPlaneFetch({
|
2775
|
+
url: "/db/{dbBranchName}/tables/{tableName}",
|
2776
|
+
method: "patch",
|
2777
|
+
...variables,
|
2778
|
+
signal
|
2779
|
+
});
|
2775
2780
|
const getTableSchema = (variables, signal) => dataPlaneFetch({
|
2776
2781
|
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
2777
2782
|
method: "get",
|
2778
2783
|
...variables,
|
2779
2784
|
signal
|
2780
2785
|
});
|
2781
|
-
const setTableSchema = (variables, signal) => dataPlaneFetch({
|
2786
|
+
const setTableSchema = (variables, signal) => dataPlaneFetch({
|
2787
|
+
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
2788
|
+
method: "put",
|
2789
|
+
...variables,
|
2790
|
+
signal
|
2791
|
+
});
|
2782
2792
|
const getTableColumns = (variables, signal) => dataPlaneFetch({
|
2783
2793
|
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
2784
2794
|
method: "get",
|
@@ -2786,7 +2796,12 @@ const getTableColumns = (variables, signal) => dataPlaneFetch({
|
|
2786
2796
|
signal
|
2787
2797
|
});
|
2788
2798
|
const addTableColumn = (variables, signal) => dataPlaneFetch(
|
2789
|
-
{
|
2799
|
+
{
|
2800
|
+
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
2801
|
+
method: "post",
|
2802
|
+
...variables,
|
2803
|
+
signal
|
2804
|
+
}
|
2790
2805
|
);
|
2791
2806
|
const getColumn = (variables, signal) => dataPlaneFetch({
|
2792
2807
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
@@ -2794,15 +2809,30 @@ const getColumn = (variables, signal) => dataPlaneFetch({
|
|
2794
2809
|
...variables,
|
2795
2810
|
signal
|
2796
2811
|
});
|
2797
|
-
const updateColumn = (variables, signal) => dataPlaneFetch({
|
2812
|
+
const updateColumn = (variables, signal) => dataPlaneFetch({
|
2813
|
+
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
2814
|
+
method: "patch",
|
2815
|
+
...variables,
|
2816
|
+
signal
|
2817
|
+
});
|
2798
2818
|
const deleteColumn = (variables, signal) => dataPlaneFetch({
|
2799
2819
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
2800
2820
|
method: "delete",
|
2801
2821
|
...variables,
|
2802
2822
|
signal
|
2803
2823
|
});
|
2804
|
-
const branchTransaction = (variables, signal) => dataPlaneFetch({
|
2805
|
-
|
2824
|
+
const branchTransaction = (variables, signal) => dataPlaneFetch({
|
2825
|
+
url: "/db/{dbBranchName}/transaction",
|
2826
|
+
method: "post",
|
2827
|
+
...variables,
|
2828
|
+
signal
|
2829
|
+
});
|
2830
|
+
const insertRecord = (variables, signal) => dataPlaneFetch({
|
2831
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data",
|
2832
|
+
method: "post",
|
2833
|
+
...variables,
|
2834
|
+
signal
|
2835
|
+
});
|
2806
2836
|
const getFileItem = (variables, signal) => dataPlaneFetch({
|
2807
2837
|
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file/{fileId}",
|
2808
2838
|
method: "get",
|
@@ -2845,11 +2875,36 @@ const getRecord = (variables, signal) => dataPlaneFetch({
|
|
2845
2875
|
...variables,
|
2846
2876
|
signal
|
2847
2877
|
});
|
2848
|
-
const insertRecordWithID = (variables, signal) => dataPlaneFetch({
|
2849
|
-
|
2850
|
-
|
2851
|
-
|
2852
|
-
|
2878
|
+
const insertRecordWithID = (variables, signal) => dataPlaneFetch({
|
2879
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
2880
|
+
method: "put",
|
2881
|
+
...variables,
|
2882
|
+
signal
|
2883
|
+
});
|
2884
|
+
const updateRecordWithID = (variables, signal) => dataPlaneFetch({
|
2885
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
2886
|
+
method: "patch",
|
2887
|
+
...variables,
|
2888
|
+
signal
|
2889
|
+
});
|
2890
|
+
const upsertRecordWithID = (variables, signal) => dataPlaneFetch({
|
2891
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
2892
|
+
method: "post",
|
2893
|
+
...variables,
|
2894
|
+
signal
|
2895
|
+
});
|
2896
|
+
const deleteRecord = (variables, signal) => dataPlaneFetch({
|
2897
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
2898
|
+
method: "delete",
|
2899
|
+
...variables,
|
2900
|
+
signal
|
2901
|
+
});
|
2902
|
+
const bulkInsertTableRecords = (variables, signal) => dataPlaneFetch({
|
2903
|
+
url: "/db/{dbBranchName}/tables/{tableName}/bulk",
|
2904
|
+
method: "post",
|
2905
|
+
...variables,
|
2906
|
+
signal
|
2907
|
+
});
|
2853
2908
|
const queryTable = (variables, signal) => dataPlaneFetch({
|
2854
2909
|
url: "/db/{dbBranchName}/tables/{tableName}/query",
|
2855
2910
|
method: "post",
|
@@ -2868,16 +2923,36 @@ const searchTable = (variables, signal) => dataPlaneFetch({
|
|
2868
2923
|
...variables,
|
2869
2924
|
signal
|
2870
2925
|
});
|
2871
|
-
const vectorSearchTable = (variables, signal) => dataPlaneFetch({
|
2926
|
+
const vectorSearchTable = (variables, signal) => dataPlaneFetch({
|
2927
|
+
url: "/db/{dbBranchName}/tables/{tableName}/vectorSearch",
|
2928
|
+
method: "post",
|
2929
|
+
...variables,
|
2930
|
+
signal
|
2931
|
+
});
|
2872
2932
|
const askTable = (variables, signal) => dataPlaneFetch({
|
2873
2933
|
url: "/db/{dbBranchName}/tables/{tableName}/ask",
|
2874
2934
|
method: "post",
|
2875
2935
|
...variables,
|
2876
2936
|
signal
|
2877
2937
|
});
|
2878
|
-
const askTableSession = (variables, signal) => dataPlaneFetch({
|
2879
|
-
|
2880
|
-
|
2938
|
+
const askTableSession = (variables, signal) => dataPlaneFetch({
|
2939
|
+
url: "/db/{dbBranchName}/tables/{tableName}/ask/{sessionId}",
|
2940
|
+
method: "post",
|
2941
|
+
...variables,
|
2942
|
+
signal
|
2943
|
+
});
|
2944
|
+
const summarizeTable = (variables, signal) => dataPlaneFetch({
|
2945
|
+
url: "/db/{dbBranchName}/tables/{tableName}/summarize",
|
2946
|
+
method: "post",
|
2947
|
+
...variables,
|
2948
|
+
signal
|
2949
|
+
});
|
2950
|
+
const aggregateTable = (variables, signal) => dataPlaneFetch({
|
2951
|
+
url: "/db/{dbBranchName}/tables/{tableName}/aggregate",
|
2952
|
+
method: "post",
|
2953
|
+
...variables,
|
2954
|
+
signal
|
2955
|
+
});
|
2881
2956
|
const fileAccess = (variables, signal) => dataPlaneFetch({
|
2882
2957
|
url: "/file/{fileId}",
|
2883
2958
|
method: "get",
|
@@ -2896,15 +2971,33 @@ const sqlQuery = (variables, signal) => dataPlaneFetch({
|
|
2896
2971
|
...variables,
|
2897
2972
|
signal
|
2898
2973
|
});
|
2974
|
+
const sqlBatchQuery = (variables, signal) => dataPlaneFetch({
|
2975
|
+
url: "/db/{dbBranchName}/sql/batch",
|
2976
|
+
method: "post",
|
2977
|
+
...variables,
|
2978
|
+
signal
|
2979
|
+
});
|
2899
2980
|
const operationsByTag$2 = {
|
2981
|
+
cluster: {
|
2982
|
+
listClusterBranches,
|
2983
|
+
listClusterExtensions,
|
2984
|
+
installClusterExtension,
|
2985
|
+
dropClusterExtension,
|
2986
|
+
getClusterMetrics
|
2987
|
+
},
|
2900
2988
|
migrations: {
|
2901
2989
|
applyMigration,
|
2990
|
+
startMigration,
|
2991
|
+
completeMigration,
|
2992
|
+
rollbackMigration,
|
2902
2993
|
adaptTable,
|
2903
2994
|
adaptAllTables,
|
2904
2995
|
getBranchMigrationJobStatus,
|
2996
|
+
getMigrationJobs,
|
2905
2997
|
getMigrationJobStatus,
|
2906
2998
|
getMigrationHistory,
|
2907
2999
|
getSchema,
|
3000
|
+
getSchemas,
|
2908
3001
|
getBranchMigrationHistory,
|
2909
3002
|
getBranchMigrationPlan,
|
2910
3003
|
executeBranchMigrationPlan,
|
@@ -2922,6 +3015,8 @@ const operationsByTag$2 = {
|
|
2922
3015
|
createBranch,
|
2923
3016
|
deleteBranch,
|
2924
3017
|
copyBranch,
|
3018
|
+
getBranchMoveStatus,
|
3019
|
+
moveBranch,
|
2925
3020
|
updateBranchMetadata,
|
2926
3021
|
getBranchMetadata,
|
2927
3022
|
getBranchStats,
|
@@ -2963,7 +3058,16 @@ const operationsByTag$2 = {
|
|
2963
3058
|
deleteRecord,
|
2964
3059
|
bulkInsertTableRecords
|
2965
3060
|
},
|
2966
|
-
files: {
|
3061
|
+
files: {
|
3062
|
+
getFileItem,
|
3063
|
+
putFileItem,
|
3064
|
+
deleteFileItem,
|
3065
|
+
getFile,
|
3066
|
+
putFile,
|
3067
|
+
deleteFile,
|
3068
|
+
fileAccess,
|
3069
|
+
fileUpload
|
3070
|
+
},
|
2967
3071
|
searchAndFilter: {
|
2968
3072
|
queryTable,
|
2969
3073
|
searchBranch,
|
@@ -2974,7 +3078,7 @@ const operationsByTag$2 = {
|
|
2974
3078
|
summarizeTable,
|
2975
3079
|
aggregateTable
|
2976
3080
|
},
|
2977
|
-
sql: { sqlQuery }
|
3081
|
+
sql: { sqlQuery, sqlBatchQuery }
|
2978
3082
|
};
|
2979
3083
|
|
2980
3084
|
const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
|
@@ -3041,7 +3145,12 @@ const deleteOAuthAccessToken = (variables, signal) => controlPlaneFetch({
|
|
3041
3145
|
...variables,
|
3042
3146
|
signal
|
3043
3147
|
});
|
3044
|
-
const updateOAuthAccessToken = (variables, signal) => controlPlaneFetch({
|
3148
|
+
const updateOAuthAccessToken = (variables, signal) => controlPlaneFetch({
|
3149
|
+
url: "/user/oauth/tokens/{token}",
|
3150
|
+
method: "patch",
|
3151
|
+
...variables,
|
3152
|
+
signal
|
3153
|
+
});
|
3045
3154
|
const getWorkspacesList = (variables, signal) => controlPlaneFetch({
|
3046
3155
|
url: "/workspaces",
|
3047
3156
|
method: "get",
|
@@ -3072,49 +3181,150 @@ const deleteWorkspace = (variables, signal) => controlPlaneFetch({
|
|
3072
3181
|
...variables,
|
3073
3182
|
signal
|
3074
3183
|
});
|
3075
|
-
const getWorkspaceSettings = (variables, signal) => controlPlaneFetch({
|
3076
|
-
|
3077
|
-
|
3078
|
-
|
3184
|
+
const getWorkspaceSettings = (variables, signal) => controlPlaneFetch({
|
3185
|
+
url: "/workspaces/{workspaceId}/settings",
|
3186
|
+
method: "get",
|
3187
|
+
...variables,
|
3188
|
+
signal
|
3189
|
+
});
|
3190
|
+
const updateWorkspaceSettings = (variables, signal) => controlPlaneFetch({
|
3191
|
+
url: "/workspaces/{workspaceId}/settings",
|
3192
|
+
method: "patch",
|
3193
|
+
...variables,
|
3194
|
+
signal
|
3195
|
+
});
|
3196
|
+
const getWorkspaceMembersList = (variables, signal) => controlPlaneFetch({
|
3197
|
+
url: "/workspaces/{workspaceId}/members",
|
3198
|
+
method: "get",
|
3199
|
+
...variables,
|
3200
|
+
signal
|
3201
|
+
});
|
3202
|
+
const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({
|
3203
|
+
url: "/workspaces/{workspaceId}/members/{userId}",
|
3204
|
+
method: "put",
|
3205
|
+
...variables,
|
3206
|
+
signal
|
3207
|
+
});
|
3079
3208
|
const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
3080
3209
|
url: "/workspaces/{workspaceId}/members/{userId}",
|
3081
3210
|
method: "delete",
|
3082
3211
|
...variables,
|
3083
3212
|
signal
|
3084
3213
|
});
|
3085
|
-
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
3086
|
-
|
3087
|
-
|
3088
|
-
|
3089
|
-
|
3090
|
-
|
3091
|
-
const
|
3214
|
+
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
3215
|
+
url: "/workspaces/{workspaceId}/invites",
|
3216
|
+
method: "post",
|
3217
|
+
...variables,
|
3218
|
+
signal
|
3219
|
+
});
|
3220
|
+
const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3221
|
+
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
3222
|
+
method: "patch",
|
3223
|
+
...variables,
|
3224
|
+
signal
|
3225
|
+
});
|
3226
|
+
const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3227
|
+
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
3228
|
+
method: "delete",
|
3229
|
+
...variables,
|
3230
|
+
signal
|
3231
|
+
});
|
3232
|
+
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3233
|
+
url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept",
|
3234
|
+
method: "post",
|
3235
|
+
...variables,
|
3236
|
+
signal
|
3237
|
+
});
|
3238
|
+
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3239
|
+
url: "/workspaces/{workspaceId}/invites/{inviteId}/resend",
|
3240
|
+
method: "post",
|
3241
|
+
...variables,
|
3242
|
+
signal
|
3243
|
+
});
|
3244
|
+
const listClusters = (variables, signal) => controlPlaneFetch({
|
3245
|
+
url: "/workspaces/{workspaceId}/clusters",
|
3246
|
+
method: "get",
|
3247
|
+
...variables,
|
3248
|
+
signal
|
3249
|
+
});
|
3250
|
+
const createCluster = (variables, signal) => controlPlaneFetch({
|
3251
|
+
url: "/workspaces/{workspaceId}/clusters",
|
3252
|
+
method: "post",
|
3253
|
+
...variables,
|
3254
|
+
signal
|
3255
|
+
});
|
3092
3256
|
const getCluster = (variables, signal) => controlPlaneFetch({
|
3093
3257
|
url: "/workspaces/{workspaceId}/clusters/{clusterId}",
|
3094
3258
|
method: "get",
|
3095
3259
|
...variables,
|
3096
3260
|
signal
|
3097
3261
|
});
|
3098
|
-
const updateCluster = (variables, signal) => controlPlaneFetch({
|
3262
|
+
const updateCluster = (variables, signal) => controlPlaneFetch({
|
3263
|
+
url: "/workspaces/{workspaceId}/clusters/{clusterId}",
|
3264
|
+
method: "patch",
|
3265
|
+
...variables,
|
3266
|
+
signal
|
3267
|
+
});
|
3268
|
+
const deleteCluster = (variables, signal) => controlPlaneFetch({
|
3269
|
+
url: "/workspaces/{workspaceId}/clusters/{clusterId}",
|
3270
|
+
method: "delete",
|
3271
|
+
...variables,
|
3272
|
+
signal
|
3273
|
+
});
|
3099
3274
|
const getDatabaseList = (variables, signal) => controlPlaneFetch({
|
3100
3275
|
url: "/workspaces/{workspaceId}/dbs",
|
3101
3276
|
method: "get",
|
3102
3277
|
...variables,
|
3103
3278
|
signal
|
3104
3279
|
});
|
3105
|
-
const createDatabase = (variables, signal) => controlPlaneFetch({
|
3280
|
+
const createDatabase = (variables, signal) => controlPlaneFetch({
|
3281
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3282
|
+
method: "put",
|
3283
|
+
...variables,
|
3284
|
+
signal
|
3285
|
+
});
|
3106
3286
|
const deleteDatabase = (variables, signal) => controlPlaneFetch({
|
3107
3287
|
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3108
3288
|
method: "delete",
|
3109
3289
|
...variables,
|
3110
3290
|
signal
|
3111
3291
|
});
|
3112
|
-
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({
|
3113
|
-
|
3114
|
-
|
3115
|
-
|
3116
|
-
|
3117
|
-
|
3292
|
+
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({
|
3293
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3294
|
+
method: "get",
|
3295
|
+
...variables,
|
3296
|
+
signal
|
3297
|
+
});
|
3298
|
+
const updateDatabaseMetadata = (variables, signal) => controlPlaneFetch({
|
3299
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3300
|
+
method: "patch",
|
3301
|
+
...variables,
|
3302
|
+
signal
|
3303
|
+
});
|
3304
|
+
const renameDatabase = (variables, signal) => controlPlaneFetch({
|
3305
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/rename",
|
3306
|
+
method: "post",
|
3307
|
+
...variables,
|
3308
|
+
signal
|
3309
|
+
});
|
3310
|
+
const getDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({
|
3311
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/github",
|
3312
|
+
method: "get",
|
3313
|
+
...variables,
|
3314
|
+
signal
|
3315
|
+
});
|
3316
|
+
const updateDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({
|
3317
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/github",
|
3318
|
+
method: "put",
|
3319
|
+
...variables,
|
3320
|
+
signal
|
3321
|
+
});
|
3322
|
+
const deleteDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({
|
3323
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/github",
|
3324
|
+
method: "delete",
|
3325
|
+
...variables,
|
3326
|
+
signal
|
3327
|
+
});
|
3118
3328
|
const listRegions = (variables, signal) => controlPlaneFetch({
|
3119
3329
|
url: "/workspaces/{workspaceId}/regions",
|
3120
3330
|
method: "get",
|
@@ -3152,7 +3362,13 @@ const operationsByTag$1 = {
|
|
3152
3362
|
acceptWorkspaceMemberInvite,
|
3153
3363
|
resendWorkspaceMemberInvite
|
3154
3364
|
},
|
3155
|
-
xbcontrolOther: {
|
3365
|
+
xbcontrolOther: {
|
3366
|
+
listClusters,
|
3367
|
+
createCluster,
|
3368
|
+
getCluster,
|
3369
|
+
updateCluster,
|
3370
|
+
deleteCluster
|
3371
|
+
},
|
3156
3372
|
databases: {
|
3157
3373
|
getDatabaseList,
|
3158
3374
|
createDatabase,
|
@@ -3172,7 +3388,7 @@ const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
|
|
3172
3388
|
const buildApiClient = () => class {
|
3173
3389
|
constructor(options = {}) {
|
3174
3390
|
const provider = options.host ?? "production";
|
3175
|
-
const apiKey = options.apiKey
|
3391
|
+
const apiKey = options.apiKey;
|
3176
3392
|
const trace = options.trace ?? defaultTrace;
|
3177
3393
|
const clientID = generateUUID();
|
3178
3394
|
if (!apiKey) {
|
@@ -3239,8 +3455,7 @@ function buildTransformString(transformations) {
|
|
3239
3455
|
).join(",");
|
3240
3456
|
}
|
3241
3457
|
function transformImage(url, ...transformations) {
|
3242
|
-
if (!isDefined(url))
|
3243
|
-
return void 0;
|
3458
|
+
if (!isDefined(url)) return void 0;
|
3244
3459
|
const newTransformations = buildTransformString(transformations);
|
3245
3460
|
const { hostname, pathname, search } = new URL(url);
|
3246
3461
|
const pathParts = pathname.split("/");
|
@@ -3353,8 +3568,7 @@ class XataFile {
|
|
3353
3568
|
}
|
3354
3569
|
}
|
3355
3570
|
const parseInputFileEntry = async (entry) => {
|
3356
|
-
if (!isDefined(entry))
|
3357
|
-
return null;
|
3571
|
+
if (!isDefined(entry)) return null;
|
3358
3572
|
const { id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout, uploadUrlTimeout } = await entry;
|
3359
3573
|
return compactObject({
|
3360
3574
|
id,
|
@@ -3369,24 +3583,19 @@ const parseInputFileEntry = async (entry) => {
|
|
3369
3583
|
};
|
3370
3584
|
|
3371
3585
|
function cleanFilter(filter) {
|
3372
|
-
if (!isDefined(filter))
|
3373
|
-
|
3374
|
-
if (!isObject(filter))
|
3375
|
-
return filter;
|
3586
|
+
if (!isDefined(filter)) return void 0;
|
3587
|
+
if (!isObject(filter)) return filter;
|
3376
3588
|
const values = Object.fromEntries(
|
3377
3589
|
Object.entries(filter).reduce((acc, [key, value]) => {
|
3378
|
-
if (!isDefined(value))
|
3379
|
-
return acc;
|
3590
|
+
if (!isDefined(value)) return acc;
|
3380
3591
|
if (Array.isArray(value)) {
|
3381
3592
|
const clean = value.map((item) => cleanFilter(item)).filter((item) => isDefined(item));
|
3382
|
-
if (clean.length === 0)
|
3383
|
-
return acc;
|
3593
|
+
if (clean.length === 0) return acc;
|
3384
3594
|
return [...acc, [key, clean]];
|
3385
3595
|
}
|
3386
3596
|
if (isObject(value)) {
|
3387
3597
|
const clean = cleanFilter(value);
|
3388
|
-
if (!isDefined(clean))
|
3389
|
-
return acc;
|
3598
|
+
if (!isDefined(clean)) return acc;
|
3390
3599
|
return [...acc, [key, clean]];
|
3391
3600
|
}
|
3392
3601
|
return [...acc, [key, value]];
|
@@ -3396,10 +3605,8 @@ function cleanFilter(filter) {
|
|
3396
3605
|
}
|
3397
3606
|
|
3398
3607
|
function stringifyJson(value) {
|
3399
|
-
if (!isDefined(value))
|
3400
|
-
|
3401
|
-
if (isString(value))
|
3402
|
-
return value;
|
3608
|
+
if (!isDefined(value)) return value;
|
3609
|
+
if (isString(value)) return value;
|
3403
3610
|
try {
|
3404
3611
|
return JSON.stringify(value);
|
3405
3612
|
} catch (e) {
|
@@ -3414,28 +3621,17 @@ function parseJson(value) {
|
|
3414
3621
|
}
|
3415
3622
|
}
|
3416
3623
|
|
3417
|
-
var
|
3418
|
-
|
3419
|
-
throw TypeError("Cannot " + msg);
|
3420
|
-
};
|
3421
|
-
var __privateGet$4 = (obj, member, getter) => {
|
3422
|
-
__accessCheck$5(obj, member, "read from private field");
|
3423
|
-
return getter ? getter.call(obj) : member.get(obj);
|
3424
|
-
};
|
3425
|
-
var __privateAdd$5 = (obj, member, value) => {
|
3426
|
-
if (member.has(obj))
|
3427
|
-
throw TypeError("Cannot add the same private member more than once");
|
3428
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
3429
|
-
};
|
3430
|
-
var __privateSet$3 = (obj, member, value, setter) => {
|
3431
|
-
__accessCheck$5(obj, member, "write to private field");
|
3432
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
3433
|
-
return value;
|
3624
|
+
var __typeError$5 = (msg) => {
|
3625
|
+
throw TypeError(msg);
|
3434
3626
|
};
|
3627
|
+
var __accessCheck$5 = (obj, member, msg) => member.has(obj) || __typeError$5("Cannot " + msg);
|
3628
|
+
var __privateGet$4 = (obj, member, getter) => (__accessCheck$5(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
3629
|
+
var __privateAdd$5 = (obj, member, value) => member.has(obj) ? __typeError$5("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
3630
|
+
var __privateSet$3 = (obj, member, value, setter) => (__accessCheck$5(obj, member, "write to private field"), member.set(obj, value), value);
|
3435
3631
|
var _query, _page;
|
3436
3632
|
class Page {
|
3437
3633
|
constructor(query, meta, records = []) {
|
3438
|
-
__privateAdd$5(this, _query
|
3634
|
+
__privateAdd$5(this, _query);
|
3439
3635
|
__privateSet$3(this, _query, query);
|
3440
3636
|
this.meta = meta;
|
3441
3637
|
this.records = new PageRecordArray(this, records);
|
@@ -3522,7 +3718,7 @@ class RecordArray extends Array {
|
|
3522
3718
|
const _PageRecordArray = class _PageRecordArray extends Array {
|
3523
3719
|
constructor(...args) {
|
3524
3720
|
super(..._PageRecordArray.parseConstructorParams(...args));
|
3525
|
-
__privateAdd$5(this, _page
|
3721
|
+
__privateAdd$5(this, _page);
|
3526
3722
|
__privateSet$3(this, _page, isObject(args[0]?.meta) ? args[0] : { meta: { page: { cursor: "", more: false } }, records: [] });
|
3527
3723
|
}
|
3528
3724
|
static parseConstructorParams(...args) {
|
@@ -3593,34 +3789,20 @@ const _PageRecordArray = class _PageRecordArray extends Array {
|
|
3593
3789
|
_page = new WeakMap();
|
3594
3790
|
let PageRecordArray = _PageRecordArray;
|
3595
3791
|
|
3596
|
-
var
|
3597
|
-
|
3598
|
-
throw TypeError("Cannot " + msg);
|
3599
|
-
};
|
3600
|
-
var __privateGet$3 = (obj, member, getter) => {
|
3601
|
-
__accessCheck$4(obj, member, "read from private field");
|
3602
|
-
return getter ? getter.call(obj) : member.get(obj);
|
3792
|
+
var __typeError$4 = (msg) => {
|
3793
|
+
throw TypeError(msg);
|
3603
3794
|
};
|
3604
|
-
var
|
3605
|
-
|
3606
|
-
|
3607
|
-
|
3608
|
-
|
3609
|
-
var
|
3610
|
-
__accessCheck$4(obj, member, "write to private field");
|
3611
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
3612
|
-
return value;
|
3613
|
-
};
|
3614
|
-
var __privateMethod$3 = (obj, member, method) => {
|
3615
|
-
__accessCheck$4(obj, member, "access private method");
|
3616
|
-
return method;
|
3617
|
-
};
|
3618
|
-
var _table$1, _repository, _data, _cleanFilterConstraint, cleanFilterConstraint_fn;
|
3795
|
+
var __accessCheck$4 = (obj, member, msg) => member.has(obj) || __typeError$4("Cannot " + msg);
|
3796
|
+
var __privateGet$3 = (obj, member, getter) => (__accessCheck$4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
3797
|
+
var __privateAdd$4 = (obj, member, value) => member.has(obj) ? __typeError$4("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
3798
|
+
var __privateSet$2 = (obj, member, value, setter) => (__accessCheck$4(obj, member, "write to private field"), member.set(obj, value), value);
|
3799
|
+
var __privateMethod$3 = (obj, member, method) => (__accessCheck$4(obj, member, "access private method"), method);
|
3800
|
+
var _table$1, _repository, _data, _Query_instances, cleanFilterConstraint_fn;
|
3619
3801
|
const _Query = class _Query {
|
3620
3802
|
constructor(repository, table, data, rawParent) {
|
3621
|
-
__privateAdd$4(this,
|
3622
|
-
__privateAdd$4(this, _table$1
|
3623
|
-
__privateAdd$4(this, _repository
|
3803
|
+
__privateAdd$4(this, _Query_instances);
|
3804
|
+
__privateAdd$4(this, _table$1);
|
3805
|
+
__privateAdd$4(this, _repository);
|
3624
3806
|
__privateAdd$4(this, _data, { filter: {} });
|
3625
3807
|
// Implements pagination
|
3626
3808
|
this.meta = { page: { cursor: "start", more: true, size: PAGINATION_DEFAULT_SIZE } };
|
@@ -3698,12 +3880,12 @@ const _Query = class _Query {
|
|
3698
3880
|
filter(a, b) {
|
3699
3881
|
if (arguments.length === 1) {
|
3700
3882
|
const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
|
3701
|
-
[column]: __privateMethod$3(this,
|
3883
|
+
[column]: __privateMethod$3(this, _Query_instances, cleanFilterConstraint_fn).call(this, column, constraint)
|
3702
3884
|
}));
|
3703
3885
|
const $all = compact([__privateGet$3(this, _data).filter?.$all].flat().concat(constraints));
|
3704
3886
|
return new _Query(__privateGet$3(this, _repository), __privateGet$3(this, _table$1), { filter: { $all } }, __privateGet$3(this, _data));
|
3705
3887
|
} else {
|
3706
|
-
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this,
|
3888
|
+
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this, _Query_instances, cleanFilterConstraint_fn).call(this, a, b) }] : void 0;
|
3707
3889
|
const $all = compact([__privateGet$3(this, _data).filter?.$all].flat().concat(constraints));
|
3708
3890
|
return new _Query(__privateGet$3(this, _repository), __privateGet$3(this, _table$1), { filter: { $all } }, __privateGet$3(this, _data));
|
3709
3891
|
}
|
@@ -3782,8 +3964,7 @@ const _Query = class _Query {
|
|
3782
3964
|
}
|
3783
3965
|
async getFirstOrThrow(options = {}) {
|
3784
3966
|
const records = await this.getMany({ ...options, pagination: { size: 1 } });
|
3785
|
-
if (records[0] === void 0)
|
3786
|
-
throw new Error("No results found.");
|
3967
|
+
if (records[0] === void 0) throw new Error("No results found.");
|
3787
3968
|
return records[0];
|
3788
3969
|
}
|
3789
3970
|
async summarize(params = {}) {
|
@@ -3838,7 +4019,7 @@ const _Query = class _Query {
|
|
3838
4019
|
_table$1 = new WeakMap();
|
3839
4020
|
_repository = new WeakMap();
|
3840
4021
|
_data = new WeakMap();
|
3841
|
-
|
4022
|
+
_Query_instances = new WeakSet();
|
3842
4023
|
cleanFilterConstraint_fn = function(column, value) {
|
3843
4024
|
const columnType = __privateGet$3(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
|
3844
4025
|
if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
|
@@ -3899,8 +4080,7 @@ function isSortFilterString(value) {
|
|
3899
4080
|
}
|
3900
4081
|
function isSortFilterBase(filter) {
|
3901
4082
|
return isObject(filter) && Object.entries(filter).every(([key, value]) => {
|
3902
|
-
if (key === "*")
|
3903
|
-
return value === "random";
|
4083
|
+
if (key === "*") return value === "random";
|
3904
4084
|
return value === "asc" || value === "desc";
|
3905
4085
|
});
|
3906
4086
|
}
|
@@ -3921,29 +4101,15 @@ function buildSortFilter(filter) {
|
|
3921
4101
|
}
|
3922
4102
|
}
|
3923
4103
|
|
3924
|
-
var
|
3925
|
-
|
3926
|
-
throw TypeError("Cannot " + msg);
|
3927
|
-
};
|
3928
|
-
var __privateGet$2 = (obj, member, getter) => {
|
3929
|
-
__accessCheck$3(obj, member, "read from private field");
|
3930
|
-
return getter ? getter.call(obj) : member.get(obj);
|
4104
|
+
var __typeError$3 = (msg) => {
|
4105
|
+
throw TypeError(msg);
|
3931
4106
|
};
|
3932
|
-
var
|
3933
|
-
|
3934
|
-
|
3935
|
-
|
3936
|
-
|
3937
|
-
var
|
3938
|
-
__accessCheck$3(obj, member, "write to private field");
|
3939
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
3940
|
-
return value;
|
3941
|
-
};
|
3942
|
-
var __privateMethod$2 = (obj, member, method) => {
|
3943
|
-
__accessCheck$3(obj, member, "access private method");
|
3944
|
-
return method;
|
3945
|
-
};
|
3946
|
-
var _table, _getFetchProps, _db, _schemaTables, _trace, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn, _insertRecords, insertRecords_fn, _updateRecordWithID, updateRecordWithID_fn, _updateRecords, updateRecords_fn, _upsertRecordWithID, upsertRecordWithID_fn, _deleteRecord, deleteRecord_fn, _deleteRecords, deleteRecords_fn, _getSchemaTables, getSchemaTables_fn, _transformObjectToApi, transformObjectToApi_fn;
|
4107
|
+
var __accessCheck$3 = (obj, member, msg) => member.has(obj) || __typeError$3("Cannot " + msg);
|
4108
|
+
var __privateGet$2 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
4109
|
+
var __privateAdd$3 = (obj, member, value) => member.has(obj) ? __typeError$3("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
4110
|
+
var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), member.set(obj, value), value);
|
4111
|
+
var __privateMethod$2 = (obj, member, method) => (__accessCheck$3(obj, member, "access private method"), method);
|
4112
|
+
var _table, _getFetchProps, _db, _schemaTables, _trace, _RestRepository_instances, insertRecordWithoutId_fn, insertRecordWithId_fn, insertRecords_fn, updateRecordWithID_fn, updateRecords_fn, upsertRecordWithID_fn, deleteRecord_fn, deleteRecords_fn, getSchemaTables_fn, transformObjectToApi_fn;
|
3947
4113
|
const BULK_OPERATION_MAX_SIZE = 1e3;
|
3948
4114
|
class Repository extends Query {
|
3949
4115
|
}
|
@@ -3954,21 +4120,12 @@ class RestRepository extends Query {
|
|
3954
4120
|
{ name: options.table, schema: options.schemaTables?.find((table) => table.name === options.table) },
|
3955
4121
|
{}
|
3956
4122
|
);
|
3957
|
-
__privateAdd$3(this,
|
3958
|
-
__privateAdd$3(this,
|
3959
|
-
__privateAdd$3(this,
|
3960
|
-
__privateAdd$3(this,
|
3961
|
-
__privateAdd$3(this,
|
3962
|
-
__privateAdd$3(this,
|
3963
|
-
__privateAdd$3(this, _deleteRecord);
|
3964
|
-
__privateAdd$3(this, _deleteRecords);
|
3965
|
-
__privateAdd$3(this, _getSchemaTables);
|
3966
|
-
__privateAdd$3(this, _transformObjectToApi);
|
3967
|
-
__privateAdd$3(this, _table, void 0);
|
3968
|
-
__privateAdd$3(this, _getFetchProps, void 0);
|
3969
|
-
__privateAdd$3(this, _db, void 0);
|
3970
|
-
__privateAdd$3(this, _schemaTables, void 0);
|
3971
|
-
__privateAdd$3(this, _trace, void 0);
|
4123
|
+
__privateAdd$3(this, _RestRepository_instances);
|
4124
|
+
__privateAdd$3(this, _table);
|
4125
|
+
__privateAdd$3(this, _getFetchProps);
|
4126
|
+
__privateAdd$3(this, _db);
|
4127
|
+
__privateAdd$3(this, _schemaTables);
|
4128
|
+
__privateAdd$3(this, _trace);
|
3972
4129
|
__privateSet$1(this, _table, options.table);
|
3973
4130
|
__privateSet$1(this, _db, options.db);
|
3974
4131
|
__privateSet$1(this, _schemaTables, options.schemaTables);
|
@@ -3987,31 +4144,28 @@ class RestRepository extends Query {
|
|
3987
4144
|
return __privateGet$2(this, _trace).call(this, "create", async () => {
|
3988
4145
|
const ifVersion = parseIfVersion(b, c, d);
|
3989
4146
|
if (Array.isArray(a)) {
|
3990
|
-
if (a.length === 0)
|
3991
|
-
|
3992
|
-
const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: true });
|
4147
|
+
if (a.length === 0) return [];
|
4148
|
+
const ids = await __privateMethod$2(this, _RestRepository_instances, insertRecords_fn).call(this, a, { ifVersion, createOnly: true });
|
3993
4149
|
const columns = isValidSelectableColumns(b) ? b : ["*"];
|
3994
4150
|
const result = await this.read(ids, columns);
|
3995
4151
|
return result;
|
3996
4152
|
}
|
3997
4153
|
if (isString(a) && isObject(b)) {
|
3998
|
-
if (a === "")
|
3999
|
-
throw new Error("The id can't be empty");
|
4154
|
+
if (a === "") throw new Error("The id can't be empty");
|
4000
4155
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
4001
|
-
return await __privateMethod$2(this,
|
4156
|
+
return await __privateMethod$2(this, _RestRepository_instances, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
|
4002
4157
|
}
|
4003
4158
|
if (isObject(a) && isString(a.xata_id)) {
|
4004
|
-
if (a.xata_id === "")
|
4005
|
-
throw new Error("The id can't be empty");
|
4159
|
+
if (a.xata_id === "") throw new Error("The id can't be empty");
|
4006
4160
|
const columns = isValidSelectableColumns(b) ? b : void 0;
|
4007
|
-
return await __privateMethod$2(this,
|
4161
|
+
return await __privateMethod$2(this, _RestRepository_instances, insertRecordWithId_fn).call(this, a.xata_id, { ...a, xata_id: void 0 }, columns, {
|
4008
4162
|
createOnly: true,
|
4009
4163
|
ifVersion
|
4010
4164
|
});
|
4011
4165
|
}
|
4012
4166
|
if (isObject(a)) {
|
4013
4167
|
const columns = isValidSelectableColumns(b) ? b : void 0;
|
4014
|
-
return __privateMethod$2(this,
|
4168
|
+
return __privateMethod$2(this, _RestRepository_instances, insertRecordWithoutId_fn).call(this, a, columns);
|
4015
4169
|
}
|
4016
4170
|
throw new Error("Invalid arguments for create method");
|
4017
4171
|
});
|
@@ -4020,8 +4174,7 @@ class RestRepository extends Query {
|
|
4020
4174
|
return __privateGet$2(this, _trace).call(this, "read", async () => {
|
4021
4175
|
const columns = isValidSelectableColumns(b) ? b : ["*"];
|
4022
4176
|
if (Array.isArray(a)) {
|
4023
|
-
if (a.length === 0)
|
4024
|
-
return [];
|
4177
|
+
if (a.length === 0) return [];
|
4025
4178
|
const ids = a.map((item) => extractId(item));
|
4026
4179
|
const finalObjects = await this.getAll({ filter: { xata_id: { $any: compact(ids) } }, columns });
|
4027
4180
|
const dictionary = finalObjects.reduce((acc, object) => {
|
@@ -4044,7 +4197,7 @@ class RestRepository extends Query {
|
|
4044
4197
|
queryParams: { columns },
|
4045
4198
|
...__privateGet$2(this, _getFetchProps).call(this)
|
4046
4199
|
});
|
4047
|
-
const schemaTables = await __privateMethod$2(this,
|
4200
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
4048
4201
|
return initObject(
|
4049
4202
|
__privateGet$2(this, _db),
|
4050
4203
|
schemaTables,
|
@@ -4085,11 +4238,10 @@ class RestRepository extends Query {
|
|
4085
4238
|
return __privateGet$2(this, _trace).call(this, "update", async () => {
|
4086
4239
|
const ifVersion = parseIfVersion(b, c, d);
|
4087
4240
|
if (Array.isArray(a)) {
|
4088
|
-
if (a.length === 0)
|
4089
|
-
return [];
|
4241
|
+
if (a.length === 0) return [];
|
4090
4242
|
const existing = await this.read(a, ["xata_id"]);
|
4091
4243
|
const updates = a.filter((_item, index) => existing[index] !== null);
|
4092
|
-
await __privateMethod$2(this,
|
4244
|
+
await __privateMethod$2(this, _RestRepository_instances, updateRecords_fn).call(this, updates, {
|
4093
4245
|
ifVersion,
|
4094
4246
|
upsert: false
|
4095
4247
|
});
|
@@ -4100,15 +4252,14 @@ class RestRepository extends Query {
|
|
4100
4252
|
try {
|
4101
4253
|
if (isString(a) && isObject(b)) {
|
4102
4254
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
4103
|
-
return await __privateMethod$2(this,
|
4255
|
+
return await __privateMethod$2(this, _RestRepository_instances, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
4104
4256
|
}
|
4105
4257
|
if (isObject(a) && isString(a.xata_id)) {
|
4106
4258
|
const columns = isValidSelectableColumns(b) ? b : void 0;
|
4107
|
-
return await __privateMethod$2(this,
|
4259
|
+
return await __privateMethod$2(this, _RestRepository_instances, updateRecordWithID_fn).call(this, a.xata_id, { ...a, xata_id: void 0 }, columns, { ifVersion });
|
4108
4260
|
}
|
4109
4261
|
} catch (error) {
|
4110
|
-
if (error.status === 422)
|
4111
|
-
return null;
|
4262
|
+
if (error.status === 422) return null;
|
4112
4263
|
throw error;
|
4113
4264
|
}
|
4114
4265
|
throw new Error("Invalid arguments for update method");
|
@@ -4137,9 +4288,8 @@ class RestRepository extends Query {
|
|
4137
4288
|
return __privateGet$2(this, _trace).call(this, "createOrUpdate", async () => {
|
4138
4289
|
const ifVersion = parseIfVersion(b, c, d);
|
4139
4290
|
if (Array.isArray(a)) {
|
4140
|
-
if (a.length === 0)
|
4141
|
-
|
4142
|
-
await __privateMethod$2(this, _updateRecords, updateRecords_fn).call(this, a, {
|
4291
|
+
if (a.length === 0) return [];
|
4292
|
+
await __privateMethod$2(this, _RestRepository_instances, updateRecords_fn).call(this, a, {
|
4143
4293
|
ifVersion,
|
4144
4294
|
upsert: true
|
4145
4295
|
});
|
@@ -4148,16 +4298,14 @@ class RestRepository extends Query {
|
|
4148
4298
|
return result;
|
4149
4299
|
}
|
4150
4300
|
if (isString(a) && isObject(b)) {
|
4151
|
-
if (a === "")
|
4152
|
-
throw new Error("The id can't be empty");
|
4301
|
+
if (a === "") throw new Error("The id can't be empty");
|
4153
4302
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
4154
|
-
return await __privateMethod$2(this,
|
4303
|
+
return await __privateMethod$2(this, _RestRepository_instances, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
4155
4304
|
}
|
4156
4305
|
if (isObject(a) && isString(a.xata_id)) {
|
4157
|
-
if (a.xata_id === "")
|
4158
|
-
throw new Error("The id can't be empty");
|
4306
|
+
if (a.xata_id === "") throw new Error("The id can't be empty");
|
4159
4307
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
4160
|
-
return await __privateMethod$2(this,
|
4308
|
+
return await __privateMethod$2(this, _RestRepository_instances, upsertRecordWithID_fn).call(this, a.xata_id, { ...a, xata_id: void 0 }, columns, { ifVersion });
|
4161
4309
|
}
|
4162
4310
|
if (!isDefined(a) && isObject(b)) {
|
4163
4311
|
return await this.create(b, c);
|
@@ -4172,24 +4320,21 @@ class RestRepository extends Query {
|
|
4172
4320
|
return __privateGet$2(this, _trace).call(this, "createOrReplace", async () => {
|
4173
4321
|
const ifVersion = parseIfVersion(b, c, d);
|
4174
4322
|
if (Array.isArray(a)) {
|
4175
|
-
if (a.length === 0)
|
4176
|
-
|
4177
|
-
const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: false });
|
4323
|
+
if (a.length === 0) return [];
|
4324
|
+
const ids = await __privateMethod$2(this, _RestRepository_instances, insertRecords_fn).call(this, a, { ifVersion, createOnly: false });
|
4178
4325
|
const columns = isValidSelectableColumns(b) ? b : ["*"];
|
4179
4326
|
const result = await this.read(ids, columns);
|
4180
4327
|
return result;
|
4181
4328
|
}
|
4182
4329
|
if (isString(a) && isObject(b)) {
|
4183
|
-
if (a === "")
|
4184
|
-
throw new Error("The id can't be empty");
|
4330
|
+
if (a === "") throw new Error("The id can't be empty");
|
4185
4331
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
4186
|
-
return await __privateMethod$2(this,
|
4332
|
+
return await __privateMethod$2(this, _RestRepository_instances, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
|
4187
4333
|
}
|
4188
4334
|
if (isObject(a) && isString(a.xata_id)) {
|
4189
|
-
if (a.xata_id === "")
|
4190
|
-
throw new Error("The id can't be empty");
|
4335
|
+
if (a.xata_id === "") throw new Error("The id can't be empty");
|
4191
4336
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
4192
|
-
return await __privateMethod$2(this,
|
4337
|
+
return await __privateMethod$2(this, _RestRepository_instances, insertRecordWithId_fn).call(this, a.xata_id, { ...a, xata_id: void 0 }, columns, {
|
4193
4338
|
createOnly: false,
|
4194
4339
|
ifVersion
|
4195
4340
|
});
|
@@ -4206,25 +4351,22 @@ class RestRepository extends Query {
|
|
4206
4351
|
async delete(a, b) {
|
4207
4352
|
return __privateGet$2(this, _trace).call(this, "delete", async () => {
|
4208
4353
|
if (Array.isArray(a)) {
|
4209
|
-
if (a.length === 0)
|
4210
|
-
return [];
|
4354
|
+
if (a.length === 0) return [];
|
4211
4355
|
const ids = a.map((o) => {
|
4212
|
-
if (isString(o))
|
4213
|
-
|
4214
|
-
if (isString(o.xata_id))
|
4215
|
-
return o.xata_id;
|
4356
|
+
if (isString(o)) return o;
|
4357
|
+
if (isString(o.xata_id)) return o.xata_id;
|
4216
4358
|
throw new Error("Invalid arguments for delete method");
|
4217
4359
|
});
|
4218
4360
|
const columns = isValidSelectableColumns(b) ? b : ["*"];
|
4219
4361
|
const result = await this.read(a, columns);
|
4220
|
-
await __privateMethod$2(this,
|
4362
|
+
await __privateMethod$2(this, _RestRepository_instances, deleteRecords_fn).call(this, ids);
|
4221
4363
|
return result;
|
4222
4364
|
}
|
4223
4365
|
if (isString(a)) {
|
4224
|
-
return __privateMethod$2(this,
|
4366
|
+
return __privateMethod$2(this, _RestRepository_instances, deleteRecord_fn).call(this, a, b);
|
4225
4367
|
}
|
4226
4368
|
if (isObject(a) && isString(a.xata_id)) {
|
4227
|
-
return __privateMethod$2(this,
|
4369
|
+
return __privateMethod$2(this, _RestRepository_instances, deleteRecord_fn).call(this, a.xata_id, b);
|
4228
4370
|
}
|
4229
4371
|
throw new Error("Invalid arguments for delete method");
|
4230
4372
|
});
|
@@ -4268,7 +4410,7 @@ class RestRepository extends Query {
|
|
4268
4410
|
},
|
4269
4411
|
...__privateGet$2(this, _getFetchProps).call(this)
|
4270
4412
|
});
|
4271
|
-
const schemaTables = await __privateMethod$2(this,
|
4413
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
4272
4414
|
return {
|
4273
4415
|
records: records.map((item) => initObject(__privateGet$2(this, _db), schemaTables, __privateGet$2(this, _table), item, ["*"])),
|
4274
4416
|
totalCount
|
@@ -4293,7 +4435,7 @@ class RestRepository extends Query {
|
|
4293
4435
|
},
|
4294
4436
|
...__privateGet$2(this, _getFetchProps).call(this)
|
4295
4437
|
});
|
4296
|
-
const schemaTables = await __privateMethod$2(this,
|
4438
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
4297
4439
|
return {
|
4298
4440
|
records: records.map((item) => initObject(__privateGet$2(this, _db), schemaTables, __privateGet$2(this, _table), item, ["*"])),
|
4299
4441
|
totalCount
|
@@ -4335,7 +4477,7 @@ class RestRepository extends Query {
|
|
4335
4477
|
fetchOptions: data.fetchOptions,
|
4336
4478
|
...__privateGet$2(this, _getFetchProps).call(this)
|
4337
4479
|
});
|
4338
|
-
const schemaTables = await __privateMethod$2(this,
|
4480
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
4339
4481
|
const records = objects.map(
|
4340
4482
|
(record) => initObject(
|
4341
4483
|
__privateGet$2(this, _db),
|
@@ -4369,7 +4511,7 @@ class RestRepository extends Query {
|
|
4369
4511
|
},
|
4370
4512
|
...__privateGet$2(this, _getFetchProps).call(this)
|
4371
4513
|
});
|
4372
|
-
const schemaTables = await __privateMethod$2(this,
|
4514
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
4373
4515
|
return {
|
4374
4516
|
...result,
|
4375
4517
|
summaries: result.summaries.map(
|
@@ -4417,9 +4559,9 @@ _getFetchProps = new WeakMap();
|
|
4417
4559
|
_db = new WeakMap();
|
4418
4560
|
_schemaTables = new WeakMap();
|
4419
4561
|
_trace = new WeakMap();
|
4420
|
-
|
4562
|
+
_RestRepository_instances = new WeakSet();
|
4421
4563
|
insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
4422
|
-
const record = await __privateMethod$2(this,
|
4564
|
+
const record = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
|
4423
4565
|
const response = await insertRecord({
|
4424
4566
|
pathParams: {
|
4425
4567
|
workspace: "{workspaceId}",
|
@@ -4431,14 +4573,12 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
4431
4573
|
body: record,
|
4432
4574
|
...__privateGet$2(this, _getFetchProps).call(this)
|
4433
4575
|
});
|
4434
|
-
const schemaTables = await __privateMethod$2(this,
|
4576
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
4435
4577
|
return initObject(__privateGet$2(this, _db), schemaTables, __privateGet$2(this, _table), response, columns);
|
4436
4578
|
};
|
4437
|
-
_insertRecordWithId = new WeakSet();
|
4438
4579
|
insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
|
4439
|
-
if (!recordId)
|
4440
|
-
|
4441
|
-
const record = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
|
4580
|
+
if (!recordId) return null;
|
4581
|
+
const record = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
|
4442
4582
|
const response = await insertRecordWithID({
|
4443
4583
|
pathParams: {
|
4444
4584
|
workspace: "{workspaceId}",
|
@@ -4451,13 +4591,12 @@ insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { crea
|
|
4451
4591
|
queryParams: { createOnly, columns, ifVersion },
|
4452
4592
|
...__privateGet$2(this, _getFetchProps).call(this)
|
4453
4593
|
});
|
4454
|
-
const schemaTables = await __privateMethod$2(this,
|
4594
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
4455
4595
|
return initObject(__privateGet$2(this, _db), schemaTables, __privateGet$2(this, _table), response, columns);
|
4456
4596
|
};
|
4457
|
-
_insertRecords = new WeakSet();
|
4458
4597
|
insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
|
4459
4598
|
const operations = await promiseMap(objects, async (object) => {
|
4460
|
-
const record = await __privateMethod$2(this,
|
4599
|
+
const record = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
|
4461
4600
|
return { insert: { table: __privateGet$2(this, _table), record, createOnly, ifVersion } };
|
4462
4601
|
});
|
4463
4602
|
const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
|
@@ -4482,11 +4621,9 @@ insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
|
|
4482
4621
|
}
|
4483
4622
|
return ids;
|
4484
4623
|
};
|
4485
|
-
_updateRecordWithID = new WeakSet();
|
4486
4624
|
updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
4487
|
-
if (!recordId)
|
4488
|
-
|
4489
|
-
const { xata_id: _id, ...record } = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
|
4625
|
+
if (!recordId) return null;
|
4626
|
+
const { xata_id: _id, ...record } = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
|
4490
4627
|
try {
|
4491
4628
|
const response = await updateRecordWithID({
|
4492
4629
|
pathParams: {
|
@@ -4500,7 +4637,7 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
|
|
4500
4637
|
body: record,
|
4501
4638
|
...__privateGet$2(this, _getFetchProps).call(this)
|
4502
4639
|
});
|
4503
|
-
const schemaTables = await __privateMethod$2(this,
|
4640
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
4504
4641
|
return initObject(__privateGet$2(this, _db), schemaTables, __privateGet$2(this, _table), response, columns);
|
4505
4642
|
} catch (e) {
|
4506
4643
|
if (isObject(e) && e.status === 404) {
|
@@ -4509,10 +4646,9 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
|
|
4509
4646
|
throw e;
|
4510
4647
|
}
|
4511
4648
|
};
|
4512
|
-
_updateRecords = new WeakSet();
|
4513
4649
|
updateRecords_fn = async function(objects, { ifVersion, upsert }) {
|
4514
4650
|
const operations = await promiseMap(objects, async ({ xata_id, ...object }) => {
|
4515
|
-
const fields = await __privateMethod$2(this,
|
4651
|
+
const fields = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
|
4516
4652
|
return { update: { table: __privateGet$2(this, _table), id: xata_id, ifVersion, upsert, fields } };
|
4517
4653
|
});
|
4518
4654
|
const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
|
@@ -4537,10 +4673,8 @@ updateRecords_fn = async function(objects, { ifVersion, upsert }) {
|
|
4537
4673
|
}
|
4538
4674
|
return ids;
|
4539
4675
|
};
|
4540
|
-
_upsertRecordWithID = new WeakSet();
|
4541
4676
|
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
4542
|
-
if (!recordId)
|
4543
|
-
return null;
|
4677
|
+
if (!recordId) return null;
|
4544
4678
|
const response = await upsertRecordWithID({
|
4545
4679
|
pathParams: {
|
4546
4680
|
workspace: "{workspaceId}",
|
@@ -4553,13 +4687,11 @@ upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
|
|
4553
4687
|
body: object,
|
4554
4688
|
...__privateGet$2(this, _getFetchProps).call(this)
|
4555
4689
|
});
|
4556
|
-
const schemaTables = await __privateMethod$2(this,
|
4690
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
4557
4691
|
return initObject(__privateGet$2(this, _db), schemaTables, __privateGet$2(this, _table), response, columns);
|
4558
4692
|
};
|
4559
|
-
_deleteRecord = new WeakSet();
|
4560
4693
|
deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
4561
|
-
if (!recordId)
|
4562
|
-
return null;
|
4694
|
+
if (!recordId) return null;
|
4563
4695
|
try {
|
4564
4696
|
const response = await deleteRecord({
|
4565
4697
|
pathParams: {
|
@@ -4572,7 +4704,7 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
|
4572
4704
|
queryParams: { columns },
|
4573
4705
|
...__privateGet$2(this, _getFetchProps).call(this)
|
4574
4706
|
});
|
4575
|
-
const schemaTables = await __privateMethod$2(this,
|
4707
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
4576
4708
|
return initObject(__privateGet$2(this, _db), schemaTables, __privateGet$2(this, _table), response, columns);
|
4577
4709
|
} catch (e) {
|
4578
4710
|
if (isObject(e) && e.status === 404) {
|
@@ -4581,7 +4713,6 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
|
4581
4713
|
throw e;
|
4582
4714
|
}
|
4583
4715
|
};
|
4584
|
-
_deleteRecords = new WeakSet();
|
4585
4716
|
deleteRecords_fn = async function(recordIds) {
|
4586
4717
|
const chunkedOperations = chunk(
|
4587
4718
|
compact(recordIds).map((id) => ({ delete: { table: __privateGet$2(this, _table), id } })),
|
@@ -4599,10 +4730,8 @@ deleteRecords_fn = async function(recordIds) {
|
|
4599
4730
|
});
|
4600
4731
|
}
|
4601
4732
|
};
|
4602
|
-
_getSchemaTables = new WeakSet();
|
4603
4733
|
getSchemaTables_fn = async function() {
|
4604
|
-
if (__privateGet$2(this, _schemaTables))
|
4605
|
-
return __privateGet$2(this, _schemaTables);
|
4734
|
+
if (__privateGet$2(this, _schemaTables)) return __privateGet$2(this, _schemaTables);
|
4606
4735
|
const { schema } = await getBranchDetails({
|
4607
4736
|
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
4608
4737
|
...__privateGet$2(this, _getFetchProps).call(this)
|
@@ -4610,16 +4739,13 @@ getSchemaTables_fn = async function() {
|
|
4610
4739
|
__privateSet$1(this, _schemaTables, schema.tables);
|
4611
4740
|
return schema.tables;
|
4612
4741
|
};
|
4613
|
-
_transformObjectToApi = new WeakSet();
|
4614
4742
|
transformObjectToApi_fn = async function(object) {
|
4615
|
-
const schemaTables = await __privateMethod$2(this,
|
4743
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
4616
4744
|
const schema = schemaTables.find((table) => table.name === __privateGet$2(this, _table));
|
4617
|
-
if (!schema)
|
4618
|
-
throw new Error(`Table ${__privateGet$2(this, _table)} not found in schema`);
|
4745
|
+
if (!schema) throw new Error(`Table ${__privateGet$2(this, _table)} not found in schema`);
|
4619
4746
|
const result = {};
|
4620
4747
|
for (const [key, value] of Object.entries(object)) {
|
4621
|
-
if (["xata_version", "xata_createdat", "xata_updatedat"].includes(key))
|
4622
|
-
continue;
|
4748
|
+
if (["xata_version", "xata_createdat", "xata_updatedat"].includes(key)) continue;
|
4623
4749
|
const type = schema.columns.find((column) => column.name === key)?.type;
|
4624
4750
|
switch (type) {
|
4625
4751
|
case "link": {
|
@@ -4649,11 +4775,9 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
4649
4775
|
const data = {};
|
4650
4776
|
Object.assign(data, { ...object });
|
4651
4777
|
const { columns } = schemaTables.find(({ name }) => name === table) ?? {};
|
4652
|
-
if (!columns)
|
4653
|
-
console.error(`Table ${table} not found in schema`);
|
4778
|
+
if (!columns) console.error(`Table ${table} not found in schema`);
|
4654
4779
|
for (const column of columns ?? []) {
|
4655
|
-
if (!isValidColumn(selectedColumns, column))
|
4656
|
-
continue;
|
4780
|
+
if (!isValidColumn(selectedColumns, column)) continue;
|
4657
4781
|
const value = data[column.name];
|
4658
4782
|
switch (column.type) {
|
4659
4783
|
case "datetime": {
|
@@ -4739,15 +4863,12 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
4739
4863
|
return record;
|
4740
4864
|
};
|
4741
4865
|
function extractId(value) {
|
4742
|
-
if (isString(value))
|
4743
|
-
|
4744
|
-
if (isObject(value) && isString(value.xata_id))
|
4745
|
-
return value.xata_id;
|
4866
|
+
if (isString(value)) return value;
|
4867
|
+
if (isObject(value) && isString(value.xata_id)) return value.xata_id;
|
4746
4868
|
return void 0;
|
4747
4869
|
}
|
4748
4870
|
function isValidColumn(columns, column) {
|
4749
|
-
if (columns.includes("*"))
|
4750
|
-
return true;
|
4871
|
+
if (columns.includes("*")) return true;
|
4751
4872
|
return columns.filter((item) => isString(item) && item.startsWith(column.name)).length > 0;
|
4752
4873
|
}
|
4753
4874
|
function parseIfVersion(...args) {
|
@@ -4787,19 +4908,12 @@ const includesAll = (value) => ({ $includesAll: value });
|
|
4787
4908
|
const includesNone = (value) => ({ $includesNone: value });
|
4788
4909
|
const includesAny = (value) => ({ $includesAny: value });
|
4789
4910
|
|
4790
|
-
var
|
4791
|
-
|
4792
|
-
throw TypeError("Cannot " + msg);
|
4793
|
-
};
|
4794
|
-
var __privateGet$1 = (obj, member, getter) => {
|
4795
|
-
__accessCheck$2(obj, member, "read from private field");
|
4796
|
-
return getter ? getter.call(obj) : member.get(obj);
|
4797
|
-
};
|
4798
|
-
var __privateAdd$2 = (obj, member, value) => {
|
4799
|
-
if (member.has(obj))
|
4800
|
-
throw TypeError("Cannot add the same private member more than once");
|
4801
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
4911
|
+
var __typeError$2 = (msg) => {
|
4912
|
+
throw TypeError(msg);
|
4802
4913
|
};
|
4914
|
+
var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg);
|
4915
|
+
var __privateGet$1 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
4916
|
+
var __privateAdd$2 = (obj, member, value) => member.has(obj) ? __typeError$2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
4803
4917
|
var _tables;
|
4804
4918
|
class SchemaPlugin extends XataPlugin {
|
4805
4919
|
constructor() {
|
@@ -4811,8 +4925,7 @@ class SchemaPlugin extends XataPlugin {
|
|
4811
4925
|
{},
|
4812
4926
|
{
|
4813
4927
|
get: (_target, table) => {
|
4814
|
-
if (!isString(table))
|
4815
|
-
throw new Error("Invalid table name");
|
4928
|
+
if (!isString(table)) throw new Error("Invalid table name");
|
4816
4929
|
if (__privateGet$1(this, _tables)[table] === void 0) {
|
4817
4930
|
__privateGet$1(this, _tables)[table] = new RestRepository({ db, pluginOptions, table, schemaTables: pluginOptions.tables });
|
4818
4931
|
}
|
@@ -4903,30 +5016,23 @@ function getContentType(file) {
|
|
4903
5016
|
return "application/octet-stream";
|
4904
5017
|
}
|
4905
5018
|
|
4906
|
-
var
|
4907
|
-
|
4908
|
-
throw TypeError("Cannot " + msg);
|
4909
|
-
};
|
4910
|
-
var __privateAdd$1 = (obj, member, value) => {
|
4911
|
-
if (member.has(obj))
|
4912
|
-
throw TypeError("Cannot add the same private member more than once");
|
4913
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
5019
|
+
var __typeError$1 = (msg) => {
|
5020
|
+
throw TypeError(msg);
|
4914
5021
|
};
|
4915
|
-
var
|
4916
|
-
|
4917
|
-
|
4918
|
-
|
4919
|
-
var _search, search_fn;
|
5022
|
+
var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
|
5023
|
+
var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
5024
|
+
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
5025
|
+
var _SearchPlugin_instances, search_fn;
|
4920
5026
|
class SearchPlugin extends XataPlugin {
|
4921
5027
|
constructor(db) {
|
4922
5028
|
super();
|
4923
5029
|
this.db = db;
|
4924
|
-
__privateAdd$1(this,
|
5030
|
+
__privateAdd$1(this, _SearchPlugin_instances);
|
4925
5031
|
}
|
4926
5032
|
build(pluginOptions) {
|
4927
5033
|
return {
|
4928
5034
|
all: async (query, options = {}) => {
|
4929
|
-
const { records, totalCount } = await __privateMethod$1(this,
|
5035
|
+
const { records, totalCount } = await __privateMethod$1(this, _SearchPlugin_instances, search_fn).call(this, query, options, pluginOptions);
|
4930
5036
|
return {
|
4931
5037
|
totalCount,
|
4932
5038
|
records: records.map((record) => {
|
@@ -4936,7 +5042,7 @@ class SearchPlugin extends XataPlugin {
|
|
4936
5042
|
};
|
4937
5043
|
},
|
4938
5044
|
byTable: async (query, options = {}) => {
|
4939
|
-
const { records: rawRecords, totalCount } = await __privateMethod$1(this,
|
5045
|
+
const { records: rawRecords, totalCount } = await __privateMethod$1(this, _SearchPlugin_instances, search_fn).call(this, query, options, pluginOptions);
|
4940
5046
|
const records = rawRecords.reduce((acc, record) => {
|
4941
5047
|
const table = record.xata_table;
|
4942
5048
|
const items = acc[table] ?? [];
|
@@ -4948,7 +5054,7 @@ class SearchPlugin extends XataPlugin {
|
|
4948
5054
|
};
|
4949
5055
|
}
|
4950
5056
|
}
|
4951
|
-
|
5057
|
+
_SearchPlugin_instances = new WeakSet();
|
4952
5058
|
search_fn = async function(query, options, pluginOptions) {
|
4953
5059
|
const { tables, fuzziness, highlight, prefix, page } = options ?? {};
|
4954
5060
|
const { records, totalCount } = await searchBranch({
|
@@ -4984,8 +5090,7 @@ function arrayString(val) {
|
|
4984
5090
|
return result;
|
4985
5091
|
}
|
4986
5092
|
function prepareValue(value) {
|
4987
|
-
if (!isDefined(value))
|
4988
|
-
return null;
|
5093
|
+
if (!isDefined(value)) return null;
|
4989
5094
|
if (value instanceof Date) {
|
4990
5095
|
return value.toISOString();
|
4991
5096
|
}
|
@@ -5025,19 +5130,28 @@ class SQLPlugin extends XataPlugin {
|
|
5025
5130
|
throw new Error("Invalid usage of `xata.sql`. Please use it as a tagged template or with an object.");
|
5026
5131
|
}
|
5027
5132
|
const { statement, params, consistency, responseType } = prepareParams(query, parameters);
|
5028
|
-
const {
|
5029
|
-
records,
|
5030
|
-
rows,
|
5031
|
-
warning,
|
5032
|
-
columns = []
|
5033
|
-
} = await sqlQuery({
|
5133
|
+
const { warning, columns, ...response } = await sqlQuery({
|
5034
5134
|
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
5035
5135
|
body: { statement, params, consistency, responseType },
|
5036
5136
|
...pluginOptions
|
5037
5137
|
});
|
5138
|
+
const records = "records" in response ? response.records : void 0;
|
5139
|
+
const rows = "rows" in response ? response.rows : void 0;
|
5038
5140
|
return { records, rows, warning, columns };
|
5039
5141
|
};
|
5040
5142
|
sqlFunction.connectionString = buildConnectionString(pluginOptions);
|
5143
|
+
sqlFunction.batch = async (query) => {
|
5144
|
+
const { results } = await sqlBatchQuery({
|
5145
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
5146
|
+
body: {
|
5147
|
+
statements: query.statements.map(({ statement, params }) => ({ statement, params })),
|
5148
|
+
consistency: query.consistency,
|
5149
|
+
responseType: query.responseType
|
5150
|
+
},
|
5151
|
+
...pluginOptions
|
5152
|
+
});
|
5153
|
+
return { results };
|
5154
|
+
};
|
5041
5155
|
return sqlFunction;
|
5042
5156
|
}
|
5043
5157
|
}
|
@@ -5064,8 +5178,7 @@ function buildDomain(host, region) {
|
|
5064
5178
|
function buildConnectionString({ apiKey, workspacesApiUrl, branch }) {
|
5065
5179
|
const url = isString(workspacesApiUrl) ? workspacesApiUrl : workspacesApiUrl("", {});
|
5066
5180
|
const parts = parseWorkspacesUrlParts(url);
|
5067
|
-
if (!parts)
|
5068
|
-
throw new Error("Invalid workspaces URL");
|
5181
|
+
if (!parts) throw new Error("Invalid workspaces URL");
|
5069
5182
|
const { workspace: workspaceSlug, region, database, host } = parts;
|
5070
5183
|
const domain = buildDomain(host, region);
|
5071
5184
|
const workspace = workspaceSlug.split("-").pop();
|
@@ -5090,39 +5203,24 @@ class TransactionPlugin extends XataPlugin {
|
|
5090
5203
|
}
|
5091
5204
|
}
|
5092
5205
|
|
5093
|
-
var
|
5094
|
-
|
5095
|
-
throw TypeError("Cannot " + msg);
|
5096
|
-
};
|
5097
|
-
var __privateGet = (obj, member, getter) => {
|
5098
|
-
__accessCheck(obj, member, "read from private field");
|
5099
|
-
return getter ? getter.call(obj) : member.get(obj);
|
5100
|
-
};
|
5101
|
-
var __privateAdd = (obj, member, value) => {
|
5102
|
-
if (member.has(obj))
|
5103
|
-
throw TypeError("Cannot add the same private member more than once");
|
5104
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
5105
|
-
};
|
5106
|
-
var __privateSet = (obj, member, value, setter) => {
|
5107
|
-
__accessCheck(obj, member, "write to private field");
|
5108
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
5109
|
-
return value;
|
5110
|
-
};
|
5111
|
-
var __privateMethod = (obj, member, method) => {
|
5112
|
-
__accessCheck(obj, member, "access private method");
|
5113
|
-
return method;
|
5206
|
+
var __typeError = (msg) => {
|
5207
|
+
throw TypeError(msg);
|
5114
5208
|
};
|
5209
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
5210
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
5211
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
5212
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
5213
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
5115
5214
|
const buildClient = (plugins) => {
|
5116
|
-
var _options,
|
5215
|
+
var _options, _instances, parseOptions_fn, getFetchProps_fn, _a;
|
5117
5216
|
return _a = class {
|
5118
5217
|
constructor(options = {}, tables) {
|
5119
|
-
__privateAdd(this,
|
5120
|
-
__privateAdd(this,
|
5121
|
-
|
5122
|
-
const safeOptions = __privateMethod(this, _parseOptions, parseOptions_fn).call(this, options);
|
5218
|
+
__privateAdd(this, _instances);
|
5219
|
+
__privateAdd(this, _options);
|
5220
|
+
const safeOptions = __privateMethod(this, _instances, parseOptions_fn).call(this, options);
|
5123
5221
|
__privateSet(this, _options, safeOptions);
|
5124
5222
|
const pluginOptions = {
|
5125
|
-
...__privateMethod(this,
|
5223
|
+
...__privateMethod(this, _instances, getFetchProps_fn).call(this, safeOptions),
|
5126
5224
|
host: safeOptions.host,
|
5127
5225
|
tables,
|
5128
5226
|
branch: safeOptions.branch
|
@@ -5139,8 +5237,7 @@ const buildClient = (plugins) => {
|
|
5139
5237
|
this.sql = sql;
|
5140
5238
|
this.files = files;
|
5141
5239
|
for (const [key, namespace] of Object.entries(plugins ?? {})) {
|
5142
|
-
if (namespace === void 0)
|
5143
|
-
continue;
|
5240
|
+
if (namespace === void 0) continue;
|
5144
5241
|
this[key] = namespace.build(pluginOptions);
|
5145
5242
|
}
|
5146
5243
|
}
|
@@ -5149,8 +5246,8 @@ const buildClient = (plugins) => {
|
|
5149
5246
|
const branch = __privateGet(this, _options).branch;
|
5150
5247
|
return { databaseURL, branch };
|
5151
5248
|
}
|
5152
|
-
}, _options = new WeakMap(),
|
5153
|
-
const enableBrowser = options?.enableBrowser ??
|
5249
|
+
}, _options = new WeakMap(), _instances = new WeakSet(), parseOptions_fn = function(options) {
|
5250
|
+
const enableBrowser = options?.enableBrowser ?? false;
|
5154
5251
|
const isBrowser = typeof window !== "undefined" && typeof Deno === "undefined";
|
5155
5252
|
if (isBrowser && !enableBrowser) {
|
5156
5253
|
throw new Error(
|
@@ -5158,8 +5255,9 @@ const buildClient = (plugins) => {
|
|
5158
5255
|
);
|
5159
5256
|
}
|
5160
5257
|
const fetch = getFetchImplementation(options?.fetch);
|
5161
|
-
const databaseURL = options?.databaseURL
|
5162
|
-
const apiKey = options?.apiKey
|
5258
|
+
const databaseURL = options?.databaseURL;
|
5259
|
+
const apiKey = options?.apiKey;
|
5260
|
+
const branch = options?.branch;
|
5163
5261
|
const trace = options?.trace ?? defaultTrace;
|
5164
5262
|
const clientName = options?.clientName;
|
5165
5263
|
const host = options?.host ?? "production";
|
@@ -5170,25 +5268,8 @@ const buildClient = (plugins) => {
|
|
5170
5268
|
if (!databaseURL) {
|
5171
5269
|
throw new Error("Option databaseURL is required");
|
5172
5270
|
}
|
5173
|
-
|
5174
|
-
|
5175
|
-
const branch = options?.branch || previewBranch || envBranch || "main";
|
5176
|
-
if (!!previewBranch && branch !== previewBranch) {
|
5177
|
-
console.warn(
|
5178
|
-
`Ignoring preview branch ${previewBranch} because branch option was passed to the client constructor with value ${branch}`
|
5179
|
-
);
|
5180
|
-
} else if (!!envBranch && branch !== envBranch) {
|
5181
|
-
console.warn(
|
5182
|
-
`Ignoring branch ${envBranch} because branch option was passed to the client constructor with value ${branch}`
|
5183
|
-
);
|
5184
|
-
} else if (!!previewBranch && !!envBranch && previewBranch !== envBranch) {
|
5185
|
-
console.warn(
|
5186
|
-
`Ignoring preview branch ${previewBranch} and branch ${envBranch} because branch option was passed to the client constructor with value ${branch}`
|
5187
|
-
);
|
5188
|
-
} else if (!previewBranch && !envBranch && options?.branch === void 0) {
|
5189
|
-
console.warn(
|
5190
|
-
`No branch was passed to the client constructor. Using default branch ${branch}. You can set the branch with the environment variable XATA_BRANCH or by passing the branch option to the client constructor.`
|
5191
|
-
);
|
5271
|
+
if (!branch) {
|
5272
|
+
throw new Error("Option branch is required");
|
5192
5273
|
}
|
5193
5274
|
return {
|
5194
5275
|
fetch,
|
@@ -5202,7 +5283,7 @@ const buildClient = (plugins) => {
|
|
5202
5283
|
clientName,
|
5203
5284
|
xataAgentExtra
|
5204
5285
|
};
|
5205
|
-
},
|
5286
|
+
}, getFetchProps_fn = function({
|
5206
5287
|
fetch,
|
5207
5288
|
apiKey,
|
5208
5289
|
databaseURL,
|
@@ -5243,26 +5324,19 @@ class Serializer {
|
|
5243
5324
|
}
|
5244
5325
|
toJSON(data) {
|
5245
5326
|
function visit(obj) {
|
5246
|
-
if (Array.isArray(obj))
|
5247
|
-
return obj.map(visit);
|
5327
|
+
if (Array.isArray(obj)) return obj.map(visit);
|
5248
5328
|
const type = typeof obj;
|
5249
|
-
if (type === "undefined")
|
5250
|
-
|
5251
|
-
if (
|
5252
|
-
return { [META]: "bigint", [VALUE]: obj.toString() };
|
5253
|
-
if (obj === null || type !== "object")
|
5254
|
-
return obj;
|
5329
|
+
if (type === "undefined") return { [META]: "undefined" };
|
5330
|
+
if (type === "bigint") return { [META]: "bigint", [VALUE]: obj.toString() };
|
5331
|
+
if (obj === null || type !== "object") return obj;
|
5255
5332
|
const constructor = obj.constructor;
|
5256
5333
|
const o = { [META]: constructor.name };
|
5257
5334
|
for (const [key, value] of Object.entries(obj)) {
|
5258
5335
|
o[key] = visit(value);
|
5259
5336
|
}
|
5260
|
-
if (constructor === Date)
|
5261
|
-
|
5262
|
-
if (constructor ===
|
5263
|
-
o[VALUE] = Object.fromEntries(obj);
|
5264
|
-
if (constructor === Set)
|
5265
|
-
o[VALUE] = [...obj];
|
5337
|
+
if (constructor === Date) o[VALUE] = obj.toISOString();
|
5338
|
+
if (constructor === Map) o[VALUE] = Object.fromEntries(obj);
|
5339
|
+
if (constructor === Set) o[VALUE] = [...obj];
|
5266
5340
|
return o;
|
5267
5341
|
}
|
5268
5342
|
return JSON.stringify(visit(data));
|
@@ -5275,16 +5349,11 @@ class Serializer {
|
|
5275
5349
|
if (constructor) {
|
5276
5350
|
return Object.assign(Object.create(constructor.prototype), rest);
|
5277
5351
|
}
|
5278
|
-
if (clazz === "Date")
|
5279
|
-
|
5280
|
-
if (clazz === "
|
5281
|
-
|
5282
|
-
if (clazz === "
|
5283
|
-
return new Map(Object.entries(val));
|
5284
|
-
if (clazz === "bigint")
|
5285
|
-
return BigInt(val);
|
5286
|
-
if (clazz === "undefined")
|
5287
|
-
return void 0;
|
5352
|
+
if (clazz === "Date") return new Date(val);
|
5353
|
+
if (clazz === "Set") return new Set(val);
|
5354
|
+
if (clazz === "Map") return new Map(Object.entries(val));
|
5355
|
+
if (clazz === "bigint") return BigInt(val);
|
5356
|
+
if (clazz === "undefined") return void 0;
|
5288
5357
|
return rest;
|
5289
5358
|
}
|
5290
5359
|
return value;
|
@@ -5299,6 +5368,47 @@ const deserialize = (json) => {
|
|
5299
5368
|
return defaultSerializer.fromJSON(json);
|
5300
5369
|
};
|
5301
5370
|
|
5371
|
+
function parseEnvironment(environment) {
|
5372
|
+
try {
|
5373
|
+
if (typeof environment === "function") {
|
5374
|
+
return new Proxy(
|
5375
|
+
{},
|
5376
|
+
{
|
5377
|
+
get(target) {
|
5378
|
+
return environment(target);
|
5379
|
+
}
|
5380
|
+
}
|
5381
|
+
);
|
5382
|
+
}
|
5383
|
+
if (isObject(environment)) {
|
5384
|
+
return environment;
|
5385
|
+
}
|
5386
|
+
} catch (error) {
|
5387
|
+
}
|
5388
|
+
return {};
|
5389
|
+
}
|
5390
|
+
function buildPreviewBranchName({ org, branch }) {
|
5391
|
+
return `preview-${org}-${branch}`;
|
5392
|
+
}
|
5393
|
+
function getDeployPreviewBranch(environment) {
|
5394
|
+
try {
|
5395
|
+
const { deployPreview, deployPreviewBranch, vercelGitCommitRef, vercelGitRepoOwner } = parseEnvironment(environment);
|
5396
|
+
if (deployPreviewBranch) return deployPreviewBranch;
|
5397
|
+
switch (deployPreview) {
|
5398
|
+
case "vercel": {
|
5399
|
+
if (!vercelGitCommitRef || !vercelGitRepoOwner) {
|
5400
|
+
console.warn("XATA_PREVIEW=vercel but VERCEL_GIT_COMMIT_REF or VERCEL_GIT_REPO_OWNER is not valid");
|
5401
|
+
return void 0;
|
5402
|
+
}
|
5403
|
+
return buildPreviewBranchName({ org: vercelGitRepoOwner, branch: vercelGitCommitRef });
|
5404
|
+
}
|
5405
|
+
}
|
5406
|
+
return void 0;
|
5407
|
+
} catch (err) {
|
5408
|
+
return void 0;
|
5409
|
+
}
|
5410
|
+
}
|
5411
|
+
|
5302
5412
|
class XataError extends Error {
|
5303
5413
|
constructor(message, status) {
|
5304
5414
|
super(message);
|
@@ -5306,5 +5416,5 @@ class XataError extends Error {
|
|
5306
5416
|
}
|
5307
5417
|
}
|
5308
5418
|
|
5309
|
-
export { BaseClient, Buffer, FetcherError, FilesPlugin, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, PageRecordArray, Query, RecordArray, RecordColumnTypes, Repository, RestRepository, SQLPlugin, SchemaPlugin, SearchPlugin, Serializer, TransactionPlugin, XataApiClient, XataApiPlugin, XataError, XataFile, XataPlugin, acceptWorkspaceMemberInvite, adaptAllTables, adaptTable, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, applyMigration, askTable, askTableSession, branchTransaction, buildClient, buildPreviewBranchName, buildProviderString, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, copyBranch, createBranch, createCluster, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteDatabaseGithubSettings, deleteFile, deleteFileItem, deleteOAuthAccessToken, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteUserOAuthClient, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, fileAccess, fileUpload, ge,
|
5419
|
+
export { BaseClient, Buffer, FetcherError, FilesPlugin, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, PageRecordArray, Query, RecordArray, RecordColumnTypes, Repository, RestRepository, SQLPlugin, SchemaPlugin, SearchPlugin, Serializer, TransactionPlugin, XataApiClient, XataApiPlugin, XataError, XataFile, XataPlugin, acceptWorkspaceMemberInvite, adaptAllTables, adaptTable, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, applyMigration, askTable, askTableSession, branchTransaction, buildClient, buildPreviewBranchName, buildProviderString, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, completeMigration, contains, copyBranch, createBranch, createCluster, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteCluster, deleteColumn, deleteDatabase, deleteDatabaseGithubSettings, deleteFile, deleteFileItem, deleteOAuthAccessToken, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteUserOAuthClient, deleteWorkspace, deserialize, dropClusterExtension, endsWith, equals, executeBranchMigrationPlan, exists, fileAccess, fileUpload, ge, getAuthorizationCode, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationJobStatus, getBranchMigrationPlan, getBranchMoveStatus, getBranchSchemaHistory, getBranchStats, getCluster, getClusterMetrics, getColumn, getDatabaseGithubSettings, getDatabaseList, getDatabaseMetadata, getDatabaseSettings, getDeployPreviewBranch, getFile, getFileItem, getGitBranchesMapping, getHostUrl, getMigrationHistory, getMigrationJobStatus, getMigrationJobs, getMigrationRequest, getMigrationRequestIsMerged, getRecord, getSchema, getSchemas, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getUserOAuthAccessTokens, getUserOAuthClients, getWorkspace, getWorkspaceMembersList, getWorkspaceSettings, getWorkspacesList, grantAuthorizationCode, greaterEquals, greaterThan, greaterThanEquals, gt, gte, iContains, iPattern, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, installClusterExtension, inviteWorkspaceMember, is, isCursorPaginationOptions, isHostProviderAlias, isHostProviderBuilder, isIdentifiable, isNot, isValidExpandedColumn, isValidSelectableColumns, le, lessEquals, lessThan, lessThanEquals, listClusterBranches, listClusterExtensions, listClusters, listMigrationRequestsCommits, listRegions, lt, lte, mergeMigrationRequest, moveBranch, notExists, operationsByTag, parseProviderString, parseWorkspacesUrlParts, pattern, previewBranchSchemaEdit, pushBranchMigrations, putFile, putFileItem, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, renameDatabase, resendWorkspaceMemberInvite, resolveBranch, rollbackMigration, searchBranch, searchTable, serialize, setTableSchema, sqlBatchQuery, sqlQuery, startMigration, startsWith, summarizeTable, transformImage, updateBranchMetadata, updateBranchSchema, updateCluster, updateColumn, updateDatabaseGithubSettings, updateDatabaseMetadata, updateDatabaseSettings, updateMigrationRequest, updateOAuthAccessToken, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, updateWorkspaceSettings, upsertRecordWithID, vectorSearchTable };
|
5310
5420
|
//# sourceMappingURL=index.mjs.map
|