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