@xata.io/client 0.0.0-alpha.vf229a69778d4166c9021b4cec87cfce2b38e6bbf → 0.0.0-alpha.vf22cd1268cc516ac7867c22d558b9480f18e2df1
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 +24 -2
- package/dist/index.cjs +1000 -2260
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5103 -4819
- package/dist/index.mjs +983 -2255
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -37,8 +37,7 @@ function getLens(b64) {
|
|
37
37
|
throw new Error("Invalid string. Length must be a multiple of 4");
|
38
38
|
}
|
39
39
|
let validLen = b64.indexOf("=");
|
40
|
-
if (validLen === -1)
|
41
|
-
validLen = len;
|
40
|
+
if (validLen === -1) validLen = len;
|
42
41
|
const placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4;
|
43
42
|
return [validLen, placeHoldersLen];
|
44
43
|
}
|
@@ -373,10 +372,8 @@ class Buffer extends Uint8Array {
|
|
373
372
|
break;
|
374
373
|
}
|
375
374
|
}
|
376
|
-
if (x < y)
|
377
|
-
|
378
|
-
if (y < x)
|
379
|
-
return 1;
|
375
|
+
if (x < y) return -1;
|
376
|
+
if (y < x) return 1;
|
380
377
|
return 0;
|
381
378
|
}
|
382
379
|
/**
|
@@ -389,33 +386,21 @@ class Buffer extends Uint8Array {
|
|
389
386
|
* @param sourceEnd The offset within this buffer at which to end copying (exclusive).
|
390
387
|
*/
|
391
388
|
copy(targetBuffer, targetStart, sourceStart, sourceEnd) {
|
392
|
-
if (!Buffer.isBuffer(targetBuffer))
|
393
|
-
|
394
|
-
if (!
|
395
|
-
|
396
|
-
if (
|
397
|
-
|
398
|
-
if (
|
399
|
-
|
400
|
-
if (
|
401
|
-
targetStart = targetBuffer.length;
|
402
|
-
if (!targetStart)
|
403
|
-
targetStart = 0;
|
404
|
-
if (sourceEnd > 0 && sourceEnd < sourceStart)
|
405
|
-
sourceEnd = sourceStart;
|
406
|
-
if (sourceEnd === sourceStart)
|
407
|
-
return 0;
|
408
|
-
if (targetBuffer.length === 0 || this.length === 0)
|
409
|
-
return 0;
|
389
|
+
if (!Buffer.isBuffer(targetBuffer)) throw new TypeError("argument should be a Buffer");
|
390
|
+
if (!sourceStart) sourceStart = 0;
|
391
|
+
if (!targetStart) targetStart = 0;
|
392
|
+
if (!sourceEnd && sourceEnd !== 0) sourceEnd = this.length;
|
393
|
+
if (targetStart >= targetBuffer.length) targetStart = targetBuffer.length;
|
394
|
+
if (!targetStart) targetStart = 0;
|
395
|
+
if (sourceEnd > 0 && sourceEnd < sourceStart) sourceEnd = sourceStart;
|
396
|
+
if (sourceEnd === sourceStart) return 0;
|
397
|
+
if (targetBuffer.length === 0 || this.length === 0) return 0;
|
410
398
|
if (targetStart < 0) {
|
411
399
|
throw new RangeError("targetStart out of bounds");
|
412
400
|
}
|
413
|
-
if (sourceStart < 0 || sourceStart >= this.length)
|
414
|
-
|
415
|
-
if (sourceEnd
|
416
|
-
throw new RangeError("sourceEnd out of bounds");
|
417
|
-
if (sourceEnd > this.length)
|
418
|
-
sourceEnd = this.length;
|
401
|
+
if (sourceStart < 0 || sourceStart >= this.length) throw new RangeError("Index out of range");
|
402
|
+
if (sourceEnd < 0) throw new RangeError("sourceEnd out of bounds");
|
403
|
+
if (sourceEnd > this.length) sourceEnd = this.length;
|
419
404
|
if (targetBuffer.length - targetStart < sourceEnd - sourceStart) {
|
420
405
|
sourceEnd = targetBuffer.length - targetStart + sourceStart;
|
421
406
|
}
|
@@ -1576,8 +1561,7 @@ class Buffer extends Uint8Array {
|
|
1576
1561
|
let c, hi, lo;
|
1577
1562
|
const byteArray = [];
|
1578
1563
|
for (let i = 0; i < str.length; ++i) {
|
1579
|
-
if ((units -= 2) < 0)
|
1580
|
-
break;
|
1564
|
+
if ((units -= 2) < 0) break;
|
1581
1565
|
c = str.charCodeAt(i);
|
1582
1566
|
hi = c >> 8;
|
1583
1567
|
lo = c % 256;
|
@@ -1731,13 +1715,10 @@ class Buffer extends Uint8Array {
|
|
1731
1715
|
let foundIndex = -1;
|
1732
1716
|
for (i = byteOffset; i < arrLength; i++) {
|
1733
1717
|
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
1734
|
-
if (foundIndex === -1)
|
1735
|
-
|
1736
|
-
if (i - foundIndex + 1 === valLength)
|
1737
|
-
return foundIndex * indexSize;
|
1718
|
+
if (foundIndex === -1) foundIndex = i;
|
1719
|
+
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
|
1738
1720
|
} else {
|
1739
|
-
if (foundIndex !== -1)
|
1740
|
-
i -= i - foundIndex;
|
1721
|
+
if (foundIndex !== -1) i -= i - foundIndex;
|
1741
1722
|
foundIndex = -1;
|
1742
1723
|
}
|
1743
1724
|
}
|
@@ -1761,18 +1742,13 @@ class Buffer extends Uint8Array {
|
|
1761
1742
|
return -1;
|
1762
1743
|
}
|
1763
1744
|
static _checkOffset(offset, ext, length) {
|
1764
|
-
if (offset % 1 !== 0 || offset < 0)
|
1765
|
-
|
1766
|
-
if (offset + ext > length)
|
1767
|
-
throw new RangeError("Trying to access beyond buffer length");
|
1745
|
+
if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint");
|
1746
|
+
if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
|
1768
1747
|
}
|
1769
1748
|
static _checkInt(buf, value, offset, ext, max, min) {
|
1770
|
-
if (!Buffer.isBuffer(buf))
|
1771
|
-
|
1772
|
-
if (
|
1773
|
-
throw new RangeError('"value" argument is out of bounds');
|
1774
|
-
if (offset + ext > buf.length)
|
1775
|
-
throw new RangeError("Index out of range");
|
1749
|
+
if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
1750
|
+
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
|
1751
|
+
if (offset + ext > buf.length) throw new RangeError("Index out of range");
|
1776
1752
|
}
|
1777
1753
|
static _getEncoding(encoding) {
|
1778
1754
|
let toLowerCase = false;
|
@@ -1822,8 +1798,7 @@ const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
|
|
1822
1798
|
function base64clean(str) {
|
1823
1799
|
str = str.split("=")[0];
|
1824
1800
|
str = str.trim().replace(INVALID_BASE64_RE, "");
|
1825
|
-
if (str.length < 2)
|
1826
|
-
return "";
|
1801
|
+
if (str.length < 2) return "";
|
1827
1802
|
while (str.length % 4 !== 0) {
|
1828
1803
|
str = str + "=";
|
1829
1804
|
}
|
@@ -1924,155 +1899,15 @@ function promiseMap(inputValues, mapper) {
|
|
1924
1899
|
return inputValues.reduce(reducer, Promise.resolve([]));
|
1925
1900
|
}
|
1926
1901
|
|
1927
|
-
|
1928
|
-
|
1929
|
-
if (isDefined(process) && isDefined(process.env)) {
|
1930
|
-
return {
|
1931
|
-
apiKey: process.env.XATA_API_KEY ?? getGlobalApiKey(),
|
1932
|
-
databaseURL: process.env.XATA_DATABASE_URL ?? getGlobalDatabaseURL(),
|
1933
|
-
branch: process.env.XATA_BRANCH ?? getGlobalBranch(),
|
1934
|
-
deployPreview: process.env.XATA_PREVIEW,
|
1935
|
-
deployPreviewBranch: process.env.XATA_PREVIEW_BRANCH,
|
1936
|
-
vercelGitCommitRef: process.env.VERCEL_GIT_COMMIT_REF,
|
1937
|
-
vercelGitRepoOwner: process.env.VERCEL_GIT_REPO_OWNER
|
1938
|
-
};
|
1939
|
-
}
|
1940
|
-
} catch (err) {
|
1941
|
-
}
|
1942
|
-
try {
|
1943
|
-
if (isObject(Deno) && isObject(Deno.env)) {
|
1944
|
-
return {
|
1945
|
-
apiKey: Deno.env.get("XATA_API_KEY") ?? getGlobalApiKey(),
|
1946
|
-
databaseURL: Deno.env.get("XATA_DATABASE_URL") ?? getGlobalDatabaseURL(),
|
1947
|
-
branch: Deno.env.get("XATA_BRANCH") ?? getGlobalBranch(),
|
1948
|
-
deployPreview: Deno.env.get("XATA_PREVIEW"),
|
1949
|
-
deployPreviewBranch: Deno.env.get("XATA_PREVIEW_BRANCH"),
|
1950
|
-
vercelGitCommitRef: Deno.env.get("VERCEL_GIT_COMMIT_REF"),
|
1951
|
-
vercelGitRepoOwner: Deno.env.get("VERCEL_GIT_REPO_OWNER")
|
1952
|
-
};
|
1953
|
-
}
|
1954
|
-
} catch (err) {
|
1955
|
-
}
|
1956
|
-
return {
|
1957
|
-
apiKey: getGlobalApiKey(),
|
1958
|
-
databaseURL: getGlobalDatabaseURL(),
|
1959
|
-
branch: getGlobalBranch(),
|
1960
|
-
deployPreview: void 0,
|
1961
|
-
deployPreviewBranch: void 0,
|
1962
|
-
vercelGitCommitRef: void 0,
|
1963
|
-
vercelGitRepoOwner: void 0
|
1964
|
-
};
|
1965
|
-
}
|
1966
|
-
function getEnableBrowserVariable() {
|
1967
|
-
try {
|
1968
|
-
if (isObject(process) && isObject(process.env) && process.env.XATA_ENABLE_BROWSER !== void 0) {
|
1969
|
-
return process.env.XATA_ENABLE_BROWSER === "true";
|
1970
|
-
}
|
1971
|
-
} catch (err) {
|
1972
|
-
}
|
1973
|
-
try {
|
1974
|
-
if (isObject(Deno) && isObject(Deno.env) && Deno.env.get("XATA_ENABLE_BROWSER") !== void 0) {
|
1975
|
-
return Deno.env.get("XATA_ENABLE_BROWSER") === "true";
|
1976
|
-
}
|
1977
|
-
} catch (err) {
|
1978
|
-
}
|
1979
|
-
try {
|
1980
|
-
return XATA_ENABLE_BROWSER === true || XATA_ENABLE_BROWSER === "true";
|
1981
|
-
} catch (err) {
|
1982
|
-
return void 0;
|
1983
|
-
}
|
1984
|
-
}
|
1985
|
-
function getGlobalApiKey() {
|
1986
|
-
try {
|
1987
|
-
return XATA_API_KEY;
|
1988
|
-
} catch (err) {
|
1989
|
-
return void 0;
|
1990
|
-
}
|
1991
|
-
}
|
1992
|
-
function getGlobalDatabaseURL() {
|
1993
|
-
try {
|
1994
|
-
return XATA_DATABASE_URL;
|
1995
|
-
} catch (err) {
|
1996
|
-
return void 0;
|
1997
|
-
}
|
1998
|
-
}
|
1999
|
-
function getGlobalBranch() {
|
2000
|
-
try {
|
2001
|
-
return XATA_BRANCH;
|
2002
|
-
} catch (err) {
|
2003
|
-
return void 0;
|
2004
|
-
}
|
2005
|
-
}
|
2006
|
-
function getDatabaseURL() {
|
2007
|
-
try {
|
2008
|
-
const { databaseURL } = getEnvironment();
|
2009
|
-
return databaseURL;
|
2010
|
-
} catch (err) {
|
2011
|
-
return void 0;
|
2012
|
-
}
|
2013
|
-
}
|
2014
|
-
function getAPIKey() {
|
2015
|
-
try {
|
2016
|
-
const { apiKey } = getEnvironment();
|
2017
|
-
return apiKey;
|
2018
|
-
} catch (err) {
|
2019
|
-
return void 0;
|
2020
|
-
}
|
2021
|
-
}
|
2022
|
-
function getBranch() {
|
2023
|
-
try {
|
2024
|
-
const { branch } = getEnvironment();
|
2025
|
-
return branch;
|
2026
|
-
} catch (err) {
|
2027
|
-
return void 0;
|
2028
|
-
}
|
2029
|
-
}
|
2030
|
-
function buildPreviewBranchName({ org, branch }) {
|
2031
|
-
return `preview-${org}-${branch}`;
|
2032
|
-
}
|
2033
|
-
function getPreviewBranch() {
|
2034
|
-
try {
|
2035
|
-
const { deployPreview, deployPreviewBranch, vercelGitCommitRef, vercelGitRepoOwner } = getEnvironment();
|
2036
|
-
if (deployPreviewBranch)
|
2037
|
-
return deployPreviewBranch;
|
2038
|
-
switch (deployPreview) {
|
2039
|
-
case "vercel": {
|
2040
|
-
if (!vercelGitCommitRef || !vercelGitRepoOwner) {
|
2041
|
-
console.warn("XATA_PREVIEW=vercel but VERCEL_GIT_COMMIT_REF or VERCEL_GIT_REPO_OWNER is not valid");
|
2042
|
-
return void 0;
|
2043
|
-
}
|
2044
|
-
return buildPreviewBranchName({ org: vercelGitRepoOwner, branch: vercelGitCommitRef });
|
2045
|
-
}
|
2046
|
-
}
|
2047
|
-
return void 0;
|
2048
|
-
} catch (err) {
|
2049
|
-
return void 0;
|
2050
|
-
}
|
2051
|
-
}
|
2052
|
-
|
2053
|
-
var __accessCheck$8 = (obj, member, msg) => {
|
2054
|
-
if (!member.has(obj))
|
2055
|
-
throw TypeError("Cannot " + msg);
|
2056
|
-
};
|
2057
|
-
var __privateGet$7 = (obj, member, getter) => {
|
2058
|
-
__accessCheck$8(obj, member, "read from private field");
|
2059
|
-
return getter ? getter.call(obj) : member.get(obj);
|
2060
|
-
};
|
2061
|
-
var __privateAdd$8 = (obj, member, value) => {
|
2062
|
-
if (member.has(obj))
|
2063
|
-
throw TypeError("Cannot add the same private member more than once");
|
2064
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
1902
|
+
var __typeError$6 = (msg) => {
|
1903
|
+
throw TypeError(msg);
|
2065
1904
|
};
|
2066
|
-
var
|
2067
|
-
|
2068
|
-
|
2069
|
-
|
2070
|
-
|
2071
|
-
var
|
2072
|
-
__accessCheck$8(obj, member, "access private method");
|
2073
|
-
return method;
|
2074
|
-
};
|
2075
|
-
var _fetch, _queue, _concurrency, _enqueue, enqueue_fn;
|
1905
|
+
var __accessCheck$6 = (obj, member, msg) => member.has(obj) || __typeError$6("Cannot " + msg);
|
1906
|
+
var __privateGet$5 = (obj, member, getter) => (__accessCheck$6(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
1907
|
+
var __privateAdd$6 = (obj, member, value) => member.has(obj) ? __typeError$6("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
1908
|
+
var __privateSet$4 = (obj, member, value, setter) => (__accessCheck$6(obj, member, "write to private field"), member.set(obj, value), value);
|
1909
|
+
var __privateMethod$4 = (obj, member, method) => (__accessCheck$6(obj, member, "access private method"), method);
|
1910
|
+
var _fetch, _queue, _concurrency, _ApiRequestPool_instances, enqueue_fn;
|
2076
1911
|
const REQUEST_TIMEOUT = 5 * 60 * 1e3;
|
2077
1912
|
function getFetchImplementation(userFetch) {
|
2078
1913
|
const globalFetch = typeof fetch !== "undefined" ? fetch : void 0;
|
@@ -2085,23 +1920,23 @@ function getFetchImplementation(userFetch) {
|
|
2085
1920
|
}
|
2086
1921
|
class ApiRequestPool {
|
2087
1922
|
constructor(concurrency = 10) {
|
2088
|
-
__privateAdd$
|
2089
|
-
__privateAdd$
|
2090
|
-
__privateAdd$
|
2091
|
-
__privateAdd$
|
2092
|
-
__privateSet$
|
2093
|
-
__privateSet$
|
1923
|
+
__privateAdd$6(this, _ApiRequestPool_instances);
|
1924
|
+
__privateAdd$6(this, _fetch);
|
1925
|
+
__privateAdd$6(this, _queue);
|
1926
|
+
__privateAdd$6(this, _concurrency);
|
1927
|
+
__privateSet$4(this, _queue, []);
|
1928
|
+
__privateSet$4(this, _concurrency, concurrency);
|
2094
1929
|
this.running = 0;
|
2095
1930
|
this.started = 0;
|
2096
1931
|
}
|
2097
1932
|
setFetch(fetch2) {
|
2098
|
-
__privateSet$
|
1933
|
+
__privateSet$4(this, _fetch, fetch2);
|
2099
1934
|
}
|
2100
1935
|
getFetch() {
|
2101
|
-
if (!__privateGet$
|
1936
|
+
if (!__privateGet$5(this, _fetch)) {
|
2102
1937
|
throw new Error("Fetch not set");
|
2103
1938
|
}
|
2104
|
-
return __privateGet$
|
1939
|
+
return __privateGet$5(this, _fetch);
|
2105
1940
|
}
|
2106
1941
|
request(url, options) {
|
2107
1942
|
const start = /* @__PURE__ */ new Date();
|
@@ -2123,7 +1958,7 @@ class ApiRequestPool {
|
|
2123
1958
|
}
|
2124
1959
|
return response;
|
2125
1960
|
};
|
2126
|
-
return __privateMethod$4(this,
|
1961
|
+
return __privateMethod$4(this, _ApiRequestPool_instances, enqueue_fn).call(this, async () => {
|
2127
1962
|
return await runRequest();
|
2128
1963
|
});
|
2129
1964
|
}
|
@@ -2131,21 +1966,21 @@ class ApiRequestPool {
|
|
2131
1966
|
_fetch = new WeakMap();
|
2132
1967
|
_queue = new WeakMap();
|
2133
1968
|
_concurrency = new WeakMap();
|
2134
|
-
|
1969
|
+
_ApiRequestPool_instances = new WeakSet();
|
2135
1970
|
enqueue_fn = function(task) {
|
2136
|
-
const promise = new Promise((resolve) => __privateGet$
|
1971
|
+
const promise = new Promise((resolve) => __privateGet$5(this, _queue).push(resolve)).finally(() => {
|
2137
1972
|
this.started--;
|
2138
1973
|
this.running++;
|
2139
1974
|
}).then(() => task()).finally(() => {
|
2140
1975
|
this.running--;
|
2141
|
-
const next = __privateGet$
|
1976
|
+
const next = __privateGet$5(this, _queue).shift();
|
2142
1977
|
if (next !== void 0) {
|
2143
1978
|
this.started++;
|
2144
1979
|
next();
|
2145
1980
|
}
|
2146
1981
|
});
|
2147
|
-
if (this.running + this.started < __privateGet$
|
2148
|
-
const next = __privateGet$
|
1982
|
+
if (this.running + this.started < __privateGet$5(this, _concurrency)) {
|
1983
|
+
const next = __privateGet$5(this, _queue).shift();
|
2149
1984
|
if (next !== void 0) {
|
2150
1985
|
this.started++;
|
2151
1986
|
next();
|
@@ -2334,7 +2169,7 @@ function defaultOnOpen(response) {
|
|
2334
2169
|
}
|
2335
2170
|
}
|
2336
2171
|
|
2337
|
-
const VERSION = "0.
|
2172
|
+
const VERSION = "0.30.0";
|
2338
2173
|
|
2339
2174
|
class ErrorWithCause extends Error {
|
2340
2175
|
constructor(message, options) {
|
@@ -2414,18 +2249,15 @@ function parseProviderString(provider = "production") {
|
|
2414
2249
|
return provider;
|
2415
2250
|
}
|
2416
2251
|
const [main, workspaces] = provider.split(",");
|
2417
|
-
if (!main || !workspaces)
|
2418
|
-
return null;
|
2252
|
+
if (!main || !workspaces) return null;
|
2419
2253
|
return { main, workspaces };
|
2420
2254
|
}
|
2421
2255
|
function buildProviderString(provider) {
|
2422
|
-
if (isHostProviderAlias(provider))
|
2423
|
-
return provider;
|
2256
|
+
if (isHostProviderAlias(provider)) return provider;
|
2424
2257
|
return `${provider.main},${provider.workspaces}`;
|
2425
2258
|
}
|
2426
2259
|
function parseWorkspacesUrlParts(url) {
|
2427
|
-
if (!isString(url))
|
2428
|
-
return null;
|
2260
|
+
if (!isString(url)) return null;
|
2429
2261
|
const matches = {
|
2430
2262
|
production: url.match(/(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.xata\.sh\/db\/([^:]+):?(.*)?/),
|
2431
2263
|
staging: url.match(/(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.staging-xata\.dev\/db\/([^:]+):?(.*)?/),
|
@@ -2433,16 +2265,14 @@ function parseWorkspacesUrlParts(url) {
|
|
2433
2265
|
local: url.match(/(?:https?:\/\/)?([^.]+)(?:\.([^.]+))\.localhost:(?:\d+)\/db\/([^:]+):?(.*)?/)
|
2434
2266
|
};
|
2435
2267
|
const [host, match] = Object.entries(matches).find(([, match2]) => match2 !== null) ?? [];
|
2436
|
-
if (!isHostProviderAlias(host) || !match)
|
2437
|
-
return null;
|
2268
|
+
if (!isHostProviderAlias(host) || !match) return null;
|
2438
2269
|
return { workspace: match[1], region: match[2], database: match[3], branch: match[4], host };
|
2439
2270
|
}
|
2440
2271
|
|
2441
2272
|
const pool = new ApiRequestPool();
|
2442
2273
|
const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
2443
2274
|
const cleanQueryParams = Object.entries(queryParams).reduce((acc, [key, value]) => {
|
2444
|
-
if (value === void 0 || value === null)
|
2445
|
-
return acc;
|
2275
|
+
if (value === void 0 || value === null) return acc;
|
2446
2276
|
return { ...acc, [key]: value };
|
2447
2277
|
}, {});
|
2448
2278
|
const query = new URLSearchParams(cleanQueryParams).toString();
|
@@ -2490,8 +2320,7 @@ function hostHeader(url) {
|
|
2490
2320
|
return groups?.host ? { Host: groups.host } : {};
|
2491
2321
|
}
|
2492
2322
|
async function parseBody(body, headers) {
|
2493
|
-
if (!isDefined(body))
|
2494
|
-
return void 0;
|
2323
|
+
if (!isDefined(body)) return void 0;
|
2495
2324
|
if (isBlob(body) || typeof body.text === "function") {
|
2496
2325
|
return body;
|
2497
2326
|
}
|
@@ -2546,6 +2375,8 @@ async function fetch$1({
|
|
2546
2375
|
"X-Xata-Client-ID": clientID ?? defaultClientID,
|
2547
2376
|
"X-Xata-Session-ID": sessionID ?? generateUUID(),
|
2548
2377
|
"X-Xata-Agent": xataAgent,
|
2378
|
+
// Force field rename to xata_ internal properties
|
2379
|
+
"X-Features": compact(["feat-internal-field-rename-api=1", customHeaders?.["X-Features"]]).join(" "),
|
2549
2380
|
...customHeaders,
|
2550
2381
|
...hostHeader(fullUrl),
|
2551
2382
|
Authorization: `Bearer ${apiKey}`
|
@@ -2568,8 +2399,7 @@ async function fetch$1({
|
|
2568
2399
|
[TraceAttributes.CLOUDFLARE_RAY_ID]: response.headers?.get("cf-ray") ?? void 0
|
2569
2400
|
});
|
2570
2401
|
const message = response.headers?.get("x-xata-message");
|
2571
|
-
if (message)
|
2572
|
-
console.warn(message);
|
2402
|
+
if (message) console.warn(message);
|
2573
2403
|
if (response.status === 204) {
|
2574
2404
|
return {};
|
2575
2405
|
}
|
@@ -2653,7 +2483,72 @@ function parseUrl(url) {
|
|
2653
2483
|
|
2654
2484
|
const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
|
2655
2485
|
|
2656
|
-
const
|
2486
|
+
const getTasks = (variables, signal) => dataPlaneFetch({
|
2487
|
+
url: "/tasks",
|
2488
|
+
method: "get",
|
2489
|
+
...variables,
|
2490
|
+
signal
|
2491
|
+
});
|
2492
|
+
const getTaskStatus = (variables, signal) => dataPlaneFetch({
|
2493
|
+
url: "/tasks/{taskId}",
|
2494
|
+
method: "get",
|
2495
|
+
...variables,
|
2496
|
+
signal
|
2497
|
+
});
|
2498
|
+
const listClusterBranches = (variables, signal) => dataPlaneFetch({
|
2499
|
+
url: "/cluster/{clusterId}/branches",
|
2500
|
+
method: "get",
|
2501
|
+
...variables,
|
2502
|
+
signal
|
2503
|
+
});
|
2504
|
+
const listClusterExtensions = (variables, signal) => dataPlaneFetch({
|
2505
|
+
url: "/cluster/{clusterId}/extensions",
|
2506
|
+
method: "get",
|
2507
|
+
...variables,
|
2508
|
+
signal
|
2509
|
+
});
|
2510
|
+
const installClusterExtension = (variables, signal) => dataPlaneFetch({
|
2511
|
+
url: "/cluster/{clusterId}/extensions",
|
2512
|
+
method: "post",
|
2513
|
+
...variables,
|
2514
|
+
signal
|
2515
|
+
});
|
2516
|
+
const dropClusterExtension = (variables, signal) => dataPlaneFetch({
|
2517
|
+
url: "/cluster/{clusterId}/extensions",
|
2518
|
+
method: "delete",
|
2519
|
+
...variables,
|
2520
|
+
signal
|
2521
|
+
});
|
2522
|
+
const getClusterMetrics = (variables, signal) => dataPlaneFetch({
|
2523
|
+
url: "/cluster/{clusterId}/metrics",
|
2524
|
+
method: "get",
|
2525
|
+
...variables,
|
2526
|
+
signal
|
2527
|
+
});
|
2528
|
+
const applyMigration = (variables, signal) => dataPlaneFetch({
|
2529
|
+
url: "/db/{dbBranchName}/migrations/apply",
|
2530
|
+
method: "post",
|
2531
|
+
...variables,
|
2532
|
+
signal
|
2533
|
+
});
|
2534
|
+
const startMigration = (variables, signal) => dataPlaneFetch({
|
2535
|
+
url: "/db/{dbBranchName}/migrations/start",
|
2536
|
+
method: "post",
|
2537
|
+
...variables,
|
2538
|
+
signal
|
2539
|
+
});
|
2540
|
+
const completeMigration = (variables, signal) => dataPlaneFetch({
|
2541
|
+
url: "/db/{dbBranchName}/migrations/complete",
|
2542
|
+
method: "post",
|
2543
|
+
...variables,
|
2544
|
+
signal
|
2545
|
+
});
|
2546
|
+
const rollbackMigration = (variables, signal) => dataPlaneFetch({
|
2547
|
+
url: "/db/{dbBranchName}/migrations/rollback",
|
2548
|
+
method: "post",
|
2549
|
+
...variables,
|
2550
|
+
signal
|
2551
|
+
});
|
2657
2552
|
const adaptTable = (variables, signal) => dataPlaneFetch({
|
2658
2553
|
url: "/db/{dbBranchName}/migrations/adapt/{tableName}",
|
2659
2554
|
method: "post",
|
@@ -2666,9 +2561,30 @@ const adaptAllTables = (variables, signal) => dataPlaneFetch({
|
|
2666
2561
|
...variables,
|
2667
2562
|
signal
|
2668
2563
|
});
|
2669
|
-
const getBranchMigrationJobStatus = (variables, signal) => dataPlaneFetch({
|
2670
|
-
|
2671
|
-
|
2564
|
+
const getBranchMigrationJobStatus = (variables, signal) => dataPlaneFetch({
|
2565
|
+
url: "/db/{dbBranchName}/migrations/status",
|
2566
|
+
method: "get",
|
2567
|
+
...variables,
|
2568
|
+
signal
|
2569
|
+
});
|
2570
|
+
const getMigrationJobs = (variables, signal) => dataPlaneFetch({
|
2571
|
+
url: "/db/{dbBranchName}/migrations/jobs",
|
2572
|
+
method: "get",
|
2573
|
+
...variables,
|
2574
|
+
signal
|
2575
|
+
});
|
2576
|
+
const getMigrationJobStatus = (variables, signal) => dataPlaneFetch({
|
2577
|
+
url: "/db/{dbBranchName}/migrations/jobs/{jobId}",
|
2578
|
+
method: "get",
|
2579
|
+
...variables,
|
2580
|
+
signal
|
2581
|
+
});
|
2582
|
+
const getMigrationHistory = (variables, signal) => dataPlaneFetch({
|
2583
|
+
url: "/db/{dbBranchName}/migrations/history",
|
2584
|
+
method: "get",
|
2585
|
+
...variables,
|
2586
|
+
signal
|
2587
|
+
});
|
2672
2588
|
const getBranchList = (variables, signal) => dataPlaneFetch({
|
2673
2589
|
url: "/dbs/{dbName}",
|
2674
2590
|
method: "get",
|
@@ -2682,6 +2598,7 @@ const getDatabaseSettings = (variables, signal) => dataPlaneFetch({
|
|
2682
2598
|
signal
|
2683
2599
|
});
|
2684
2600
|
const updateDatabaseSettings = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/settings", method: "patch", ...variables, signal });
|
2601
|
+
const createBranchAsync = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/async", method: "put", ...variables, signal });
|
2685
2602
|
const getBranchDetails = (variables, signal) => dataPlaneFetch({
|
2686
2603
|
url: "/db/{dbBranchName}",
|
2687
2604
|
method: "get",
|
@@ -2701,12 +2618,25 @@ const getSchema = (variables, signal) => dataPlaneFetch({
|
|
2701
2618
|
...variables,
|
2702
2619
|
signal
|
2703
2620
|
});
|
2621
|
+
const getSchemas = (variables, signal) => dataPlaneFetch({
|
2622
|
+
url: "/db/{dbBranchName}/schemas",
|
2623
|
+
method: "get",
|
2624
|
+
...variables,
|
2625
|
+
signal
|
2626
|
+
});
|
2704
2627
|
const copyBranch = (variables, signal) => dataPlaneFetch({
|
2705
2628
|
url: "/db/{dbBranchName}/copy",
|
2706
2629
|
method: "post",
|
2707
2630
|
...variables,
|
2708
2631
|
signal
|
2709
2632
|
});
|
2633
|
+
const getBranchMoveStatus = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/move", method: "get", ...variables, signal });
|
2634
|
+
const moveBranch = (variables, signal) => dataPlaneFetch({
|
2635
|
+
url: "/db/{dbBranchName}/move",
|
2636
|
+
method: "put",
|
2637
|
+
...variables,
|
2638
|
+
signal
|
2639
|
+
});
|
2710
2640
|
const updateBranchMetadata = (variables, signal) => dataPlaneFetch({
|
2711
2641
|
url: "/db/{dbBranchName}/metadata",
|
2712
2642
|
method: "put",
|
@@ -2727,12 +2657,42 @@ const getBranchStats = (variables, signal) => dataPlaneFetch({
|
|
2727
2657
|
});
|
2728
2658
|
const getGitBranchesMapping = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables, signal });
|
2729
2659
|
const addGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables, signal });
|
2730
|
-
const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({
|
2731
|
-
|
2732
|
-
|
2733
|
-
|
2734
|
-
|
2735
|
-
|
2660
|
+
const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({
|
2661
|
+
url: "/dbs/{dbName}/gitBranches",
|
2662
|
+
method: "delete",
|
2663
|
+
...variables,
|
2664
|
+
signal
|
2665
|
+
});
|
2666
|
+
const resolveBranch = (variables, signal) => dataPlaneFetch({
|
2667
|
+
url: "/dbs/{dbName}/resolveBranch",
|
2668
|
+
method: "get",
|
2669
|
+
...variables,
|
2670
|
+
signal
|
2671
|
+
});
|
2672
|
+
const getBranchMigrationHistory = (variables, signal) => dataPlaneFetch({
|
2673
|
+
url: "/db/{dbBranchName}/migrations",
|
2674
|
+
method: "get",
|
2675
|
+
...variables,
|
2676
|
+
signal
|
2677
|
+
});
|
2678
|
+
const getBranchMigrationPlan = (variables, signal) => dataPlaneFetch({
|
2679
|
+
url: "/db/{dbBranchName}/migrations/plan",
|
2680
|
+
method: "post",
|
2681
|
+
...variables,
|
2682
|
+
signal
|
2683
|
+
});
|
2684
|
+
const executeBranchMigrationPlan = (variables, signal) => dataPlaneFetch({
|
2685
|
+
url: "/db/{dbBranchName}/migrations/execute",
|
2686
|
+
method: "post",
|
2687
|
+
...variables,
|
2688
|
+
signal
|
2689
|
+
});
|
2690
|
+
const queryMigrationRequests = (variables, signal) => dataPlaneFetch({
|
2691
|
+
url: "/dbs/{dbName}/migrations/query",
|
2692
|
+
method: "post",
|
2693
|
+
...variables,
|
2694
|
+
signal
|
2695
|
+
});
|
2736
2696
|
const createMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
2737
2697
|
const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2738
2698
|
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
@@ -2740,23 +2700,78 @@ const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
|
2740
2700
|
...variables,
|
2741
2701
|
signal
|
2742
2702
|
});
|
2743
|
-
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2744
|
-
|
2745
|
-
|
2746
|
-
|
2703
|
+
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2704
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
2705
|
+
method: "patch",
|
2706
|
+
...variables,
|
2707
|
+
signal
|
2708
|
+
});
|
2709
|
+
const listMigrationRequestsCommits = (variables, signal) => dataPlaneFetch({
|
2710
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/commits",
|
2711
|
+
method: "post",
|
2712
|
+
...variables,
|
2713
|
+
signal
|
2714
|
+
});
|
2715
|
+
const compareMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2716
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/compare",
|
2717
|
+
method: "post",
|
2718
|
+
...variables,
|
2719
|
+
signal
|
2720
|
+
});
|
2721
|
+
const getMigrationRequestIsMerged = (variables, signal) => dataPlaneFetch({
|
2722
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
2723
|
+
method: "get",
|
2724
|
+
...variables,
|
2725
|
+
signal
|
2726
|
+
});
|
2747
2727
|
const mergeMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2748
2728
|
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
2749
2729
|
method: "post",
|
2750
2730
|
...variables,
|
2751
2731
|
signal
|
2752
2732
|
});
|
2753
|
-
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({
|
2754
|
-
|
2755
|
-
|
2756
|
-
|
2757
|
-
|
2758
|
-
|
2759
|
-
const
|
2733
|
+
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({
|
2734
|
+
url: "/db/{dbBranchName}/schema/history",
|
2735
|
+
method: "post",
|
2736
|
+
...variables,
|
2737
|
+
signal
|
2738
|
+
});
|
2739
|
+
const compareBranchWithUserSchema = (variables, signal) => dataPlaneFetch({
|
2740
|
+
url: "/db/{dbBranchName}/schema/compare",
|
2741
|
+
method: "post",
|
2742
|
+
...variables,
|
2743
|
+
signal
|
2744
|
+
});
|
2745
|
+
const compareBranchSchemas = (variables, signal) => dataPlaneFetch({
|
2746
|
+
url: "/db/{dbBranchName}/schema/compare/{branchName}",
|
2747
|
+
method: "post",
|
2748
|
+
...variables,
|
2749
|
+
signal
|
2750
|
+
});
|
2751
|
+
const updateBranchSchema = (variables, signal) => dataPlaneFetch({
|
2752
|
+
url: "/db/{dbBranchName}/schema/update",
|
2753
|
+
method: "post",
|
2754
|
+
...variables,
|
2755
|
+
signal
|
2756
|
+
});
|
2757
|
+
const previewBranchSchemaEdit = (variables, signal) => dataPlaneFetch({
|
2758
|
+
url: "/db/{dbBranchName}/schema/preview",
|
2759
|
+
method: "post",
|
2760
|
+
...variables,
|
2761
|
+
signal
|
2762
|
+
});
|
2763
|
+
const applyBranchSchemaEdit = (variables, signal) => dataPlaneFetch({
|
2764
|
+
url: "/db/{dbBranchName}/schema/apply",
|
2765
|
+
method: "post",
|
2766
|
+
...variables,
|
2767
|
+
signal
|
2768
|
+
});
|
2769
|
+
const pushBranchMigrations = (variables, signal) => dataPlaneFetch({
|
2770
|
+
url: "/db/{dbBranchName}/schema/push",
|
2771
|
+
method: "post",
|
2772
|
+
...variables,
|
2773
|
+
signal
|
2774
|
+
});
|
2760
2775
|
const createTable = (variables, signal) => dataPlaneFetch({
|
2761
2776
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
2762
2777
|
method: "put",
|
@@ -2769,14 +2784,24 @@ const deleteTable = (variables, signal) => dataPlaneFetch({
|
|
2769
2784
|
...variables,
|
2770
2785
|
signal
|
2771
2786
|
});
|
2772
|
-
const updateTable = (variables, signal) => dataPlaneFetch({
|
2787
|
+
const updateTable = (variables, signal) => dataPlaneFetch({
|
2788
|
+
url: "/db/{dbBranchName}/tables/{tableName}",
|
2789
|
+
method: "patch",
|
2790
|
+
...variables,
|
2791
|
+
signal
|
2792
|
+
});
|
2773
2793
|
const getTableSchema = (variables, signal) => dataPlaneFetch({
|
2774
2794
|
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
2775
2795
|
method: "get",
|
2776
2796
|
...variables,
|
2777
2797
|
signal
|
2778
2798
|
});
|
2779
|
-
const setTableSchema = (variables, signal) => dataPlaneFetch({
|
2799
|
+
const setTableSchema = (variables, signal) => dataPlaneFetch({
|
2800
|
+
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
2801
|
+
method: "put",
|
2802
|
+
...variables,
|
2803
|
+
signal
|
2804
|
+
});
|
2780
2805
|
const getTableColumns = (variables, signal) => dataPlaneFetch({
|
2781
2806
|
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
2782
2807
|
method: "get",
|
@@ -2784,7 +2809,12 @@ const getTableColumns = (variables, signal) => dataPlaneFetch({
|
|
2784
2809
|
signal
|
2785
2810
|
});
|
2786
2811
|
const addTableColumn = (variables, signal) => dataPlaneFetch(
|
2787
|
-
{
|
2812
|
+
{
|
2813
|
+
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
2814
|
+
method: "post",
|
2815
|
+
...variables,
|
2816
|
+
signal
|
2817
|
+
}
|
2788
2818
|
);
|
2789
2819
|
const getColumn = (variables, signal) => dataPlaneFetch({
|
2790
2820
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
@@ -2792,15 +2822,30 @@ const getColumn = (variables, signal) => dataPlaneFetch({
|
|
2792
2822
|
...variables,
|
2793
2823
|
signal
|
2794
2824
|
});
|
2795
|
-
const updateColumn = (variables, signal) => dataPlaneFetch({
|
2825
|
+
const updateColumn = (variables, signal) => dataPlaneFetch({
|
2826
|
+
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
2827
|
+
method: "patch",
|
2828
|
+
...variables,
|
2829
|
+
signal
|
2830
|
+
});
|
2796
2831
|
const deleteColumn = (variables, signal) => dataPlaneFetch({
|
2797
2832
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
2798
2833
|
method: "delete",
|
2799
2834
|
...variables,
|
2800
2835
|
signal
|
2801
2836
|
});
|
2802
|
-
const branchTransaction = (variables, signal) => dataPlaneFetch({
|
2803
|
-
|
2837
|
+
const branchTransaction = (variables, signal) => dataPlaneFetch({
|
2838
|
+
url: "/db/{dbBranchName}/transaction",
|
2839
|
+
method: "post",
|
2840
|
+
...variables,
|
2841
|
+
signal
|
2842
|
+
});
|
2843
|
+
const insertRecord = (variables, signal) => dataPlaneFetch({
|
2844
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data",
|
2845
|
+
method: "post",
|
2846
|
+
...variables,
|
2847
|
+
signal
|
2848
|
+
});
|
2804
2849
|
const getFileItem = (variables, signal) => dataPlaneFetch({
|
2805
2850
|
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file/{fileId}",
|
2806
2851
|
method: "get",
|
@@ -2843,19 +2888,44 @@ const getRecord = (variables, signal) => dataPlaneFetch({
|
|
2843
2888
|
...variables,
|
2844
2889
|
signal
|
2845
2890
|
});
|
2846
|
-
const insertRecordWithID = (variables, signal) => dataPlaneFetch({
|
2847
|
-
|
2848
|
-
|
2849
|
-
const deleteRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "delete", ...variables, signal });
|
2850
|
-
const bulkInsertTableRecords = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/bulk", method: "post", ...variables, signal });
|
2851
|
-
const queryTable = (variables, signal) => dataPlaneFetch({
|
2852
|
-
url: "/db/{dbBranchName}/tables/{tableName}/query",
|
2853
|
-
method: "post",
|
2891
|
+
const insertRecordWithID = (variables, signal) => dataPlaneFetch({
|
2892
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
2893
|
+
method: "put",
|
2854
2894
|
...variables,
|
2855
2895
|
signal
|
2856
2896
|
});
|
2857
|
-
const
|
2858
|
-
url: "/db/{dbBranchName}/
|
2897
|
+
const updateRecordWithID = (variables, signal) => dataPlaneFetch({
|
2898
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
2899
|
+
method: "patch",
|
2900
|
+
...variables,
|
2901
|
+
signal
|
2902
|
+
});
|
2903
|
+
const upsertRecordWithID = (variables, signal) => dataPlaneFetch({
|
2904
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
2905
|
+
method: "post",
|
2906
|
+
...variables,
|
2907
|
+
signal
|
2908
|
+
});
|
2909
|
+
const deleteRecord = (variables, signal) => dataPlaneFetch({
|
2910
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
2911
|
+
method: "delete",
|
2912
|
+
...variables,
|
2913
|
+
signal
|
2914
|
+
});
|
2915
|
+
const bulkInsertTableRecords = (variables, signal) => dataPlaneFetch({
|
2916
|
+
url: "/db/{dbBranchName}/tables/{tableName}/bulk",
|
2917
|
+
method: "post",
|
2918
|
+
...variables,
|
2919
|
+
signal
|
2920
|
+
});
|
2921
|
+
const queryTable = (variables, signal) => dataPlaneFetch({
|
2922
|
+
url: "/db/{dbBranchName}/tables/{tableName}/query",
|
2923
|
+
method: "post",
|
2924
|
+
...variables,
|
2925
|
+
signal
|
2926
|
+
});
|
2927
|
+
const searchBranch = (variables, signal) => dataPlaneFetch({
|
2928
|
+
url: "/db/{dbBranchName}/search",
|
2859
2929
|
method: "post",
|
2860
2930
|
...variables,
|
2861
2931
|
signal
|
@@ -2866,16 +2936,36 @@ const searchTable = (variables, signal) => dataPlaneFetch({
|
|
2866
2936
|
...variables,
|
2867
2937
|
signal
|
2868
2938
|
});
|
2869
|
-
const vectorSearchTable = (variables, signal) => dataPlaneFetch({
|
2939
|
+
const vectorSearchTable = (variables, signal) => dataPlaneFetch({
|
2940
|
+
url: "/db/{dbBranchName}/tables/{tableName}/vectorSearch",
|
2941
|
+
method: "post",
|
2942
|
+
...variables,
|
2943
|
+
signal
|
2944
|
+
});
|
2870
2945
|
const askTable = (variables, signal) => dataPlaneFetch({
|
2871
2946
|
url: "/db/{dbBranchName}/tables/{tableName}/ask",
|
2872
2947
|
method: "post",
|
2873
2948
|
...variables,
|
2874
2949
|
signal
|
2875
2950
|
});
|
2876
|
-
const askTableSession = (variables, signal) => dataPlaneFetch({
|
2877
|
-
|
2878
|
-
|
2951
|
+
const askTableSession = (variables, signal) => dataPlaneFetch({
|
2952
|
+
url: "/db/{dbBranchName}/tables/{tableName}/ask/{sessionId}",
|
2953
|
+
method: "post",
|
2954
|
+
...variables,
|
2955
|
+
signal
|
2956
|
+
});
|
2957
|
+
const summarizeTable = (variables, signal) => dataPlaneFetch({
|
2958
|
+
url: "/db/{dbBranchName}/tables/{tableName}/summarize",
|
2959
|
+
method: "post",
|
2960
|
+
...variables,
|
2961
|
+
signal
|
2962
|
+
});
|
2963
|
+
const aggregateTable = (variables, signal) => dataPlaneFetch({
|
2964
|
+
url: "/db/{dbBranchName}/tables/{tableName}/aggregate",
|
2965
|
+
method: "post",
|
2966
|
+
...variables,
|
2967
|
+
signal
|
2968
|
+
});
|
2879
2969
|
const fileAccess = (variables, signal) => dataPlaneFetch({
|
2880
2970
|
url: "/file/{fileId}",
|
2881
2971
|
method: "get",
|
@@ -2894,15 +2984,34 @@ const sqlQuery = (variables, signal) => dataPlaneFetch({
|
|
2894
2984
|
...variables,
|
2895
2985
|
signal
|
2896
2986
|
});
|
2987
|
+
const sqlBatchQuery = (variables, signal) => dataPlaneFetch({
|
2988
|
+
url: "/db/{dbBranchName}/sql/batch",
|
2989
|
+
method: "post",
|
2990
|
+
...variables,
|
2991
|
+
signal
|
2992
|
+
});
|
2897
2993
|
const operationsByTag$2 = {
|
2994
|
+
tasks: { getTasks, getTaskStatus },
|
2995
|
+
cluster: {
|
2996
|
+
listClusterBranches,
|
2997
|
+
listClusterExtensions,
|
2998
|
+
installClusterExtension,
|
2999
|
+
dropClusterExtension,
|
3000
|
+
getClusterMetrics
|
3001
|
+
},
|
2898
3002
|
migrations: {
|
2899
3003
|
applyMigration,
|
3004
|
+
startMigration,
|
3005
|
+
completeMigration,
|
3006
|
+
rollbackMigration,
|
2900
3007
|
adaptTable,
|
2901
3008
|
adaptAllTables,
|
2902
3009
|
getBranchMigrationJobStatus,
|
3010
|
+
getMigrationJobs,
|
2903
3011
|
getMigrationJobStatus,
|
2904
3012
|
getMigrationHistory,
|
2905
3013
|
getSchema,
|
3014
|
+
getSchemas,
|
2906
3015
|
getBranchMigrationHistory,
|
2907
3016
|
getBranchMigrationPlan,
|
2908
3017
|
executeBranchMigrationPlan,
|
@@ -2916,10 +3025,13 @@ const operationsByTag$2 = {
|
|
2916
3025
|
},
|
2917
3026
|
branch: {
|
2918
3027
|
getBranchList,
|
3028
|
+
createBranchAsync,
|
2919
3029
|
getBranchDetails,
|
2920
3030
|
createBranch,
|
2921
3031
|
deleteBranch,
|
2922
3032
|
copyBranch,
|
3033
|
+
getBranchMoveStatus,
|
3034
|
+
moveBranch,
|
2923
3035
|
updateBranchMetadata,
|
2924
3036
|
getBranchMetadata,
|
2925
3037
|
getBranchStats,
|
@@ -2961,7 +3073,16 @@ const operationsByTag$2 = {
|
|
2961
3073
|
deleteRecord,
|
2962
3074
|
bulkInsertTableRecords
|
2963
3075
|
},
|
2964
|
-
files: {
|
3076
|
+
files: {
|
3077
|
+
getFileItem,
|
3078
|
+
putFileItem,
|
3079
|
+
deleteFileItem,
|
3080
|
+
getFile,
|
3081
|
+
putFile,
|
3082
|
+
deleteFile,
|
3083
|
+
fileAccess,
|
3084
|
+
fileUpload
|
3085
|
+
},
|
2965
3086
|
searchAndFilter: {
|
2966
3087
|
queryTable,
|
2967
3088
|
searchBranch,
|
@@ -2972,7 +3093,7 @@ const operationsByTag$2 = {
|
|
2972
3093
|
summarizeTable,
|
2973
3094
|
aggregateTable
|
2974
3095
|
},
|
2975
|
-
sql: { sqlQuery }
|
3096
|
+
sql: { sqlQuery, sqlBatchQuery }
|
2976
3097
|
};
|
2977
3098
|
|
2978
3099
|
const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
|
@@ -3039,7 +3160,12 @@ const deleteOAuthAccessToken = (variables, signal) => controlPlaneFetch({
|
|
3039
3160
|
...variables,
|
3040
3161
|
signal
|
3041
3162
|
});
|
3042
|
-
const updateOAuthAccessToken = (variables, signal) => controlPlaneFetch({
|
3163
|
+
const updateOAuthAccessToken = (variables, signal) => controlPlaneFetch({
|
3164
|
+
url: "/user/oauth/tokens/{token}",
|
3165
|
+
method: "patch",
|
3166
|
+
...variables,
|
3167
|
+
signal
|
3168
|
+
});
|
3043
3169
|
const getWorkspacesList = (variables, signal) => controlPlaneFetch({
|
3044
3170
|
url: "/workspaces",
|
3045
3171
|
method: "get",
|
@@ -3070,1451 +3196,253 @@ const deleteWorkspace = (variables, signal) => controlPlaneFetch({
|
|
3070
3196
|
...variables,
|
3071
3197
|
signal
|
3072
3198
|
});
|
3073
|
-
const getWorkspaceSettings = (variables, signal) => controlPlaneFetch({
|
3074
|
-
|
3075
|
-
|
3076
|
-
const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables, signal });
|
3077
|
-
const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
3078
|
-
url: "/workspaces/{workspaceId}/members/{userId}",
|
3079
|
-
method: "delete",
|
3199
|
+
const getWorkspaceSettings = (variables, signal) => controlPlaneFetch({
|
3200
|
+
url: "/workspaces/{workspaceId}/settings",
|
3201
|
+
method: "get",
|
3080
3202
|
...variables,
|
3081
3203
|
signal
|
3082
3204
|
});
|
3083
|
-
const
|
3084
|
-
|
3085
|
-
|
3086
|
-
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
|
3087
|
-
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
|
3088
|
-
const listClusters = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters", method: "get", ...variables, signal });
|
3089
|
-
const createCluster = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters", method: "post", ...variables, signal });
|
3090
|
-
const getCluster = (variables, signal) => controlPlaneFetch({
|
3091
|
-
url: "/workspaces/{workspaceId}/clusters/{clusterId}",
|
3092
|
-
method: "get",
|
3205
|
+
const updateWorkspaceSettings = (variables, signal) => controlPlaneFetch({
|
3206
|
+
url: "/workspaces/{workspaceId}/settings",
|
3207
|
+
method: "patch",
|
3093
3208
|
...variables,
|
3094
3209
|
signal
|
3095
3210
|
});
|
3096
|
-
const
|
3097
|
-
|
3098
|
-
url: "/workspaces/{workspaceId}/dbs",
|
3211
|
+
const getWorkspaceMembersList = (variables, signal) => controlPlaneFetch({
|
3212
|
+
url: "/workspaces/{workspaceId}/members",
|
3099
3213
|
method: "get",
|
3100
3214
|
...variables,
|
3101
3215
|
signal
|
3102
3216
|
});
|
3103
|
-
const
|
3104
|
-
|
3105
|
-
|
3106
|
-
method: "delete",
|
3217
|
+
const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({
|
3218
|
+
url: "/workspaces/{workspaceId}/members/{userId}",
|
3219
|
+
method: "put",
|
3107
3220
|
...variables,
|
3108
3221
|
signal
|
3109
3222
|
});
|
3110
|
-
const
|
3111
|
-
|
3112
|
-
|
3113
|
-
const getDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}/github", method: "get", ...variables, signal });
|
3114
|
-
const updateDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}/github", method: "put", ...variables, signal });
|
3115
|
-
const deleteDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}/github", method: "delete", ...variables, signal });
|
3116
|
-
const listRegions = (variables, signal) => controlPlaneFetch({
|
3117
|
-
url: "/workspaces/{workspaceId}/regions",
|
3118
|
-
method: "get",
|
3223
|
+
const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
3224
|
+
url: "/workspaces/{workspaceId}/members/{userId}",
|
3225
|
+
method: "delete",
|
3119
3226
|
...variables,
|
3120
3227
|
signal
|
3121
3228
|
});
|
3122
|
-
const
|
3123
|
-
|
3124
|
-
|
3125
|
-
|
3126
|
-
|
3127
|
-
|
3128
|
-
|
3129
|
-
|
3130
|
-
|
3131
|
-
|
3132
|
-
|
3133
|
-
|
3134
|
-
|
3135
|
-
|
3136
|
-
|
3137
|
-
|
3138
|
-
|
3139
|
-
|
3140
|
-
|
3141
|
-
|
3142
|
-
|
3143
|
-
|
3144
|
-
|
3145
|
-
|
3146
|
-
|
3147
|
-
|
3148
|
-
|
3149
|
-
|
3150
|
-
|
3151
|
-
|
3152
|
-
|
3153
|
-
|
3154
|
-
|
3155
|
-
|
3156
|
-
|
3157
|
-
|
3158
|
-
|
3159
|
-
|
3160
|
-
|
3161
|
-
|
3162
|
-
|
3163
|
-
|
3164
|
-
|
3165
|
-
}
|
3166
|
-
|
3167
|
-
|
3168
|
-
|
3169
|
-
|
3170
|
-
|
3171
|
-
|
3172
|
-
|
3173
|
-
|
3174
|
-
|
3175
|
-
|
3176
|
-
|
3177
|
-
}
|
3178
|
-
|
3179
|
-
|
3180
|
-
|
3181
|
-
|
3182
|
-
|
3183
|
-
|
3184
|
-
|
3185
|
-
|
3186
|
-
|
3187
|
-
};
|
3188
|
-
|
3189
|
-
|
3190
|
-
|
3191
|
-
|
3192
|
-
|
3193
|
-
|
3194
|
-
|
3195
|
-
|
3196
|
-
|
3197
|
-
|
3198
|
-
|
3199
|
-
|
3200
|
-
|
3201
|
-
|
3202
|
-
|
3203
|
-
|
3204
|
-
|
3205
|
-
|
3206
|
-
|
3207
|
-
|
3208
|
-
|
3209
|
-
|
3210
|
-
|
3211
|
-
|
3212
|
-
|
3213
|
-
|
3214
|
-
|
3215
|
-
|
3216
|
-
|
3217
|
-
|
3218
|
-
|
3219
|
-
|
3220
|
-
|
3221
|
-
|
3222
|
-
|
3223
|
-
|
3224
|
-
|
3225
|
-
}
|
3226
|
-
|
3227
|
-
|
3228
|
-
|
3229
|
-
|
3230
|
-
|
3231
|
-
|
3232
|
-
|
3233
|
-
|
3234
|
-
|
3235
|
-
|
3236
|
-
|
3237
|
-
|
3238
|
-
|
3239
|
-
|
3240
|
-
|
3241
|
-
|
3242
|
-
|
3243
|
-
|
3244
|
-
|
3245
|
-
|
3246
|
-
|
3247
|
-
|
3248
|
-
|
3249
|
-
|
3250
|
-
|
3251
|
-
|
3252
|
-
|
3253
|
-
|
3254
|
-
|
3255
|
-
|
3256
|
-
|
3257
|
-
|
3258
|
-
|
3259
|
-
|
3260
|
-
|
3261
|
-
|
3262
|
-
|
3263
|
-
|
3264
|
-
|
3265
|
-
}
|
3266
|
-
|
3267
|
-
|
3268
|
-
|
3269
|
-
|
3270
|
-
|
3271
|
-
|
3272
|
-
|
3273
|
-
|
3274
|
-
|
3275
|
-
|
3276
|
-
|
3277
|
-
|
3278
|
-
|
3279
|
-
|
3280
|
-
|
3281
|
-
|
3282
|
-
|
3283
|
-
|
3284
|
-
|
3285
|
-
|
3286
|
-
|
3287
|
-
|
3288
|
-
|
3289
|
-
|
3290
|
-
|
3291
|
-
}
|
3292
|
-
getUserAPIKeys() {
|
3293
|
-
return operationsByTag.authentication.getUserAPIKeys({ ...this.extraProps });
|
3294
|
-
}
|
3295
|
-
createUserAPIKey({ name }) {
|
3296
|
-
return operationsByTag.authentication.createUserAPIKey({
|
3297
|
-
pathParams: { keyName: name },
|
3298
|
-
...this.extraProps
|
3299
|
-
});
|
3300
|
-
}
|
3301
|
-
deleteUserAPIKey({ name }) {
|
3302
|
-
return operationsByTag.authentication.deleteUserAPIKey({
|
3303
|
-
pathParams: { keyName: name },
|
3304
|
-
...this.extraProps
|
3305
|
-
});
|
3306
|
-
}
|
3307
|
-
}
|
3308
|
-
class WorkspaceApi {
|
3309
|
-
constructor(extraProps) {
|
3310
|
-
this.extraProps = extraProps;
|
3311
|
-
}
|
3312
|
-
getWorkspacesList() {
|
3313
|
-
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
3314
|
-
}
|
3315
|
-
createWorkspace({ data }) {
|
3316
|
-
return operationsByTag.workspaces.createWorkspace({
|
3317
|
-
body: data,
|
3318
|
-
...this.extraProps
|
3319
|
-
});
|
3320
|
-
}
|
3321
|
-
getWorkspace({ workspace }) {
|
3322
|
-
return operationsByTag.workspaces.getWorkspace({
|
3323
|
-
pathParams: { workspaceId: workspace },
|
3324
|
-
...this.extraProps
|
3325
|
-
});
|
3326
|
-
}
|
3327
|
-
updateWorkspace({
|
3328
|
-
workspace,
|
3329
|
-
update
|
3330
|
-
}) {
|
3331
|
-
return operationsByTag.workspaces.updateWorkspace({
|
3332
|
-
pathParams: { workspaceId: workspace },
|
3333
|
-
body: update,
|
3334
|
-
...this.extraProps
|
3335
|
-
});
|
3336
|
-
}
|
3337
|
-
deleteWorkspace({ workspace }) {
|
3338
|
-
return operationsByTag.workspaces.deleteWorkspace({
|
3339
|
-
pathParams: { workspaceId: workspace },
|
3340
|
-
...this.extraProps
|
3341
|
-
});
|
3342
|
-
}
|
3343
|
-
getWorkspaceMembersList({ workspace }) {
|
3344
|
-
return operationsByTag.workspaces.getWorkspaceMembersList({
|
3345
|
-
pathParams: { workspaceId: workspace },
|
3346
|
-
...this.extraProps
|
3347
|
-
});
|
3348
|
-
}
|
3349
|
-
updateWorkspaceMemberRole({
|
3350
|
-
workspace,
|
3351
|
-
user,
|
3352
|
-
role
|
3353
|
-
}) {
|
3354
|
-
return operationsByTag.workspaces.updateWorkspaceMemberRole({
|
3355
|
-
pathParams: { workspaceId: workspace, userId: user },
|
3356
|
-
body: { role },
|
3357
|
-
...this.extraProps
|
3358
|
-
});
|
3359
|
-
}
|
3360
|
-
removeWorkspaceMember({
|
3361
|
-
workspace,
|
3362
|
-
user
|
3363
|
-
}) {
|
3364
|
-
return operationsByTag.workspaces.removeWorkspaceMember({
|
3365
|
-
pathParams: { workspaceId: workspace, userId: user },
|
3366
|
-
...this.extraProps
|
3367
|
-
});
|
3368
|
-
}
|
3369
|
-
}
|
3370
|
-
class InvitesApi {
|
3371
|
-
constructor(extraProps) {
|
3372
|
-
this.extraProps = extraProps;
|
3373
|
-
}
|
3374
|
-
inviteWorkspaceMember({
|
3375
|
-
workspace,
|
3376
|
-
email,
|
3377
|
-
role
|
3378
|
-
}) {
|
3379
|
-
return operationsByTag.invites.inviteWorkspaceMember({
|
3380
|
-
pathParams: { workspaceId: workspace },
|
3381
|
-
body: { email, role },
|
3382
|
-
...this.extraProps
|
3383
|
-
});
|
3384
|
-
}
|
3385
|
-
updateWorkspaceMemberInvite({
|
3386
|
-
workspace,
|
3387
|
-
invite,
|
3388
|
-
role
|
3389
|
-
}) {
|
3390
|
-
return operationsByTag.invites.updateWorkspaceMemberInvite({
|
3391
|
-
pathParams: { workspaceId: workspace, inviteId: invite },
|
3392
|
-
body: { role },
|
3393
|
-
...this.extraProps
|
3394
|
-
});
|
3395
|
-
}
|
3396
|
-
cancelWorkspaceMemberInvite({
|
3397
|
-
workspace,
|
3398
|
-
invite
|
3399
|
-
}) {
|
3400
|
-
return operationsByTag.invites.cancelWorkspaceMemberInvite({
|
3401
|
-
pathParams: { workspaceId: workspace, inviteId: invite },
|
3402
|
-
...this.extraProps
|
3403
|
-
});
|
3404
|
-
}
|
3405
|
-
acceptWorkspaceMemberInvite({
|
3406
|
-
workspace,
|
3407
|
-
key
|
3408
|
-
}) {
|
3409
|
-
return operationsByTag.invites.acceptWorkspaceMemberInvite({
|
3410
|
-
pathParams: { workspaceId: workspace, inviteKey: key },
|
3411
|
-
...this.extraProps
|
3412
|
-
});
|
3413
|
-
}
|
3414
|
-
resendWorkspaceMemberInvite({
|
3415
|
-
workspace,
|
3416
|
-
invite
|
3417
|
-
}) {
|
3418
|
-
return operationsByTag.invites.resendWorkspaceMemberInvite({
|
3419
|
-
pathParams: { workspaceId: workspace, inviteId: invite },
|
3420
|
-
...this.extraProps
|
3421
|
-
});
|
3422
|
-
}
|
3423
|
-
}
|
3424
|
-
class BranchApi {
|
3425
|
-
constructor(extraProps) {
|
3426
|
-
this.extraProps = extraProps;
|
3427
|
-
}
|
3428
|
-
getBranchList({
|
3429
|
-
workspace,
|
3430
|
-
region,
|
3431
|
-
database
|
3432
|
-
}) {
|
3433
|
-
return operationsByTag.branch.getBranchList({
|
3434
|
-
pathParams: { workspace, region, dbName: database },
|
3435
|
-
...this.extraProps
|
3436
|
-
});
|
3437
|
-
}
|
3438
|
-
getBranchDetails({
|
3439
|
-
workspace,
|
3440
|
-
region,
|
3441
|
-
database,
|
3442
|
-
branch
|
3443
|
-
}) {
|
3444
|
-
return operationsByTag.branch.getBranchDetails({
|
3445
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
3446
|
-
...this.extraProps
|
3447
|
-
});
|
3448
|
-
}
|
3449
|
-
createBranch({
|
3450
|
-
workspace,
|
3451
|
-
region,
|
3452
|
-
database,
|
3453
|
-
branch,
|
3454
|
-
from,
|
3455
|
-
metadata
|
3456
|
-
}) {
|
3457
|
-
return operationsByTag.branch.createBranch({
|
3458
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
3459
|
-
body: { from, metadata },
|
3460
|
-
...this.extraProps
|
3461
|
-
});
|
3462
|
-
}
|
3463
|
-
deleteBranch({
|
3464
|
-
workspace,
|
3465
|
-
region,
|
3466
|
-
database,
|
3467
|
-
branch
|
3468
|
-
}) {
|
3469
|
-
return operationsByTag.branch.deleteBranch({
|
3470
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
3471
|
-
...this.extraProps
|
3472
|
-
});
|
3473
|
-
}
|
3474
|
-
copyBranch({
|
3475
|
-
workspace,
|
3476
|
-
region,
|
3477
|
-
database,
|
3478
|
-
branch,
|
3479
|
-
destinationBranch,
|
3480
|
-
limit
|
3481
|
-
}) {
|
3482
|
-
return operationsByTag.branch.copyBranch({
|
3483
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
3484
|
-
body: { destinationBranch, limit },
|
3485
|
-
...this.extraProps
|
3486
|
-
});
|
3487
|
-
}
|
3488
|
-
updateBranchMetadata({
|
3489
|
-
workspace,
|
3490
|
-
region,
|
3491
|
-
database,
|
3492
|
-
branch,
|
3493
|
-
metadata
|
3494
|
-
}) {
|
3495
|
-
return operationsByTag.branch.updateBranchMetadata({
|
3496
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
3497
|
-
body: metadata,
|
3498
|
-
...this.extraProps
|
3499
|
-
});
|
3500
|
-
}
|
3501
|
-
getBranchMetadata({
|
3502
|
-
workspace,
|
3503
|
-
region,
|
3504
|
-
database,
|
3505
|
-
branch
|
3506
|
-
}) {
|
3507
|
-
return operationsByTag.branch.getBranchMetadata({
|
3508
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
3509
|
-
...this.extraProps
|
3510
|
-
});
|
3511
|
-
}
|
3512
|
-
getBranchStats({
|
3513
|
-
workspace,
|
3514
|
-
region,
|
3515
|
-
database,
|
3516
|
-
branch
|
3517
|
-
}) {
|
3518
|
-
return operationsByTag.branch.getBranchStats({
|
3519
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
3520
|
-
...this.extraProps
|
3521
|
-
});
|
3522
|
-
}
|
3523
|
-
getGitBranchesMapping({
|
3524
|
-
workspace,
|
3525
|
-
region,
|
3526
|
-
database
|
3527
|
-
}) {
|
3528
|
-
return operationsByTag.branch.getGitBranchesMapping({
|
3529
|
-
pathParams: { workspace, region, dbName: database },
|
3530
|
-
...this.extraProps
|
3531
|
-
});
|
3532
|
-
}
|
3533
|
-
addGitBranchesEntry({
|
3534
|
-
workspace,
|
3535
|
-
region,
|
3536
|
-
database,
|
3537
|
-
gitBranch,
|
3538
|
-
xataBranch
|
3539
|
-
}) {
|
3540
|
-
return operationsByTag.branch.addGitBranchesEntry({
|
3541
|
-
pathParams: { workspace, region, dbName: database },
|
3542
|
-
body: { gitBranch, xataBranch },
|
3543
|
-
...this.extraProps
|
3544
|
-
});
|
3545
|
-
}
|
3546
|
-
removeGitBranchesEntry({
|
3547
|
-
workspace,
|
3548
|
-
region,
|
3549
|
-
database,
|
3550
|
-
gitBranch
|
3551
|
-
}) {
|
3552
|
-
return operationsByTag.branch.removeGitBranchesEntry({
|
3553
|
-
pathParams: { workspace, region, dbName: database },
|
3554
|
-
queryParams: { gitBranch },
|
3555
|
-
...this.extraProps
|
3556
|
-
});
|
3557
|
-
}
|
3558
|
-
resolveBranch({
|
3559
|
-
workspace,
|
3560
|
-
region,
|
3561
|
-
database,
|
3562
|
-
gitBranch,
|
3563
|
-
fallbackBranch
|
3564
|
-
}) {
|
3565
|
-
return operationsByTag.branch.resolveBranch({
|
3566
|
-
pathParams: { workspace, region, dbName: database },
|
3567
|
-
queryParams: { gitBranch, fallbackBranch },
|
3568
|
-
...this.extraProps
|
3569
|
-
});
|
3570
|
-
}
|
3571
|
-
pgRollMigrationHistory({
|
3572
|
-
workspace,
|
3573
|
-
region,
|
3574
|
-
database,
|
3575
|
-
branch
|
3576
|
-
}) {
|
3577
|
-
return operationsByTag.migrations.getMigrationHistory({
|
3578
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
3579
|
-
...this.extraProps
|
3580
|
-
});
|
3581
|
-
}
|
3582
|
-
applyMigration({
|
3583
|
-
workspace,
|
3584
|
-
region,
|
3585
|
-
database,
|
3586
|
-
branch,
|
3587
|
-
migration
|
3588
|
-
}) {
|
3589
|
-
return operationsByTag.migrations.applyMigration({
|
3590
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
3591
|
-
body: migration,
|
3592
|
-
...this.extraProps
|
3593
|
-
});
|
3594
|
-
}
|
3595
|
-
}
|
3596
|
-
class TableApi {
|
3597
|
-
constructor(extraProps) {
|
3598
|
-
this.extraProps = extraProps;
|
3599
|
-
}
|
3600
|
-
createTable({
|
3601
|
-
workspace,
|
3602
|
-
region,
|
3603
|
-
database,
|
3604
|
-
branch,
|
3605
|
-
table
|
3606
|
-
}) {
|
3607
|
-
return operationsByTag.table.createTable({
|
3608
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
3609
|
-
...this.extraProps
|
3610
|
-
});
|
3611
|
-
}
|
3612
|
-
deleteTable({
|
3613
|
-
workspace,
|
3614
|
-
region,
|
3615
|
-
database,
|
3616
|
-
branch,
|
3617
|
-
table
|
3618
|
-
}) {
|
3619
|
-
return operationsByTag.table.deleteTable({
|
3620
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
3621
|
-
...this.extraProps
|
3622
|
-
});
|
3623
|
-
}
|
3624
|
-
updateTable({
|
3625
|
-
workspace,
|
3626
|
-
region,
|
3627
|
-
database,
|
3628
|
-
branch,
|
3629
|
-
table,
|
3630
|
-
update
|
3631
|
-
}) {
|
3632
|
-
return operationsByTag.table.updateTable({
|
3633
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
3634
|
-
body: update,
|
3635
|
-
...this.extraProps
|
3636
|
-
});
|
3637
|
-
}
|
3638
|
-
getTableSchema({
|
3639
|
-
workspace,
|
3640
|
-
region,
|
3641
|
-
database,
|
3642
|
-
branch,
|
3643
|
-
table
|
3644
|
-
}) {
|
3645
|
-
return operationsByTag.table.getTableSchema({
|
3646
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
3647
|
-
...this.extraProps
|
3648
|
-
});
|
3649
|
-
}
|
3650
|
-
setTableSchema({
|
3651
|
-
workspace,
|
3652
|
-
region,
|
3653
|
-
database,
|
3654
|
-
branch,
|
3655
|
-
table,
|
3656
|
-
schema
|
3657
|
-
}) {
|
3658
|
-
return operationsByTag.table.setTableSchema({
|
3659
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
3660
|
-
body: schema,
|
3661
|
-
...this.extraProps
|
3662
|
-
});
|
3663
|
-
}
|
3664
|
-
getTableColumns({
|
3665
|
-
workspace,
|
3666
|
-
region,
|
3667
|
-
database,
|
3668
|
-
branch,
|
3669
|
-
table
|
3670
|
-
}) {
|
3671
|
-
return operationsByTag.table.getTableColumns({
|
3672
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
3673
|
-
...this.extraProps
|
3674
|
-
});
|
3675
|
-
}
|
3676
|
-
addTableColumn({
|
3677
|
-
workspace,
|
3678
|
-
region,
|
3679
|
-
database,
|
3680
|
-
branch,
|
3681
|
-
table,
|
3682
|
-
column
|
3683
|
-
}) {
|
3684
|
-
return operationsByTag.table.addTableColumn({
|
3685
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
3686
|
-
body: column,
|
3687
|
-
...this.extraProps
|
3688
|
-
});
|
3689
|
-
}
|
3690
|
-
getColumn({
|
3691
|
-
workspace,
|
3692
|
-
region,
|
3693
|
-
database,
|
3694
|
-
branch,
|
3695
|
-
table,
|
3696
|
-
column
|
3697
|
-
}) {
|
3698
|
-
return operationsByTag.table.getColumn({
|
3699
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
3700
|
-
...this.extraProps
|
3701
|
-
});
|
3702
|
-
}
|
3703
|
-
updateColumn({
|
3704
|
-
workspace,
|
3705
|
-
region,
|
3706
|
-
database,
|
3707
|
-
branch,
|
3708
|
-
table,
|
3709
|
-
column,
|
3710
|
-
update
|
3711
|
-
}) {
|
3712
|
-
return operationsByTag.table.updateColumn({
|
3713
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
3714
|
-
body: update,
|
3715
|
-
...this.extraProps
|
3716
|
-
});
|
3717
|
-
}
|
3718
|
-
deleteColumn({
|
3719
|
-
workspace,
|
3720
|
-
region,
|
3721
|
-
database,
|
3722
|
-
branch,
|
3723
|
-
table,
|
3724
|
-
column
|
3725
|
-
}) {
|
3726
|
-
return operationsByTag.table.deleteColumn({
|
3727
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
3728
|
-
...this.extraProps
|
3729
|
-
});
|
3730
|
-
}
|
3731
|
-
}
|
3732
|
-
class RecordsApi {
|
3733
|
-
constructor(extraProps) {
|
3734
|
-
this.extraProps = extraProps;
|
3735
|
-
}
|
3736
|
-
insertRecord({
|
3737
|
-
workspace,
|
3738
|
-
region,
|
3739
|
-
database,
|
3740
|
-
branch,
|
3741
|
-
table,
|
3742
|
-
record,
|
3743
|
-
columns
|
3744
|
-
}) {
|
3745
|
-
return operationsByTag.records.insertRecord({
|
3746
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
3747
|
-
queryParams: { columns },
|
3748
|
-
body: record,
|
3749
|
-
...this.extraProps
|
3750
|
-
});
|
3751
|
-
}
|
3752
|
-
getRecord({
|
3753
|
-
workspace,
|
3754
|
-
region,
|
3755
|
-
database,
|
3756
|
-
branch,
|
3757
|
-
table,
|
3758
|
-
id,
|
3759
|
-
columns
|
3760
|
-
}) {
|
3761
|
-
return operationsByTag.records.getRecord({
|
3762
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
3763
|
-
queryParams: { columns },
|
3764
|
-
...this.extraProps
|
3765
|
-
});
|
3766
|
-
}
|
3767
|
-
insertRecordWithID({
|
3768
|
-
workspace,
|
3769
|
-
region,
|
3770
|
-
database,
|
3771
|
-
branch,
|
3772
|
-
table,
|
3773
|
-
id,
|
3774
|
-
record,
|
3775
|
-
columns,
|
3776
|
-
createOnly,
|
3777
|
-
ifVersion
|
3778
|
-
}) {
|
3779
|
-
return operationsByTag.records.insertRecordWithID({
|
3780
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
3781
|
-
queryParams: { columns, createOnly, ifVersion },
|
3782
|
-
body: record,
|
3783
|
-
...this.extraProps
|
3784
|
-
});
|
3785
|
-
}
|
3786
|
-
updateRecordWithID({
|
3787
|
-
workspace,
|
3788
|
-
region,
|
3789
|
-
database,
|
3790
|
-
branch,
|
3791
|
-
table,
|
3792
|
-
id,
|
3793
|
-
record,
|
3794
|
-
columns,
|
3795
|
-
ifVersion
|
3796
|
-
}) {
|
3797
|
-
return operationsByTag.records.updateRecordWithID({
|
3798
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
3799
|
-
queryParams: { columns, ifVersion },
|
3800
|
-
body: record,
|
3801
|
-
...this.extraProps
|
3802
|
-
});
|
3803
|
-
}
|
3804
|
-
upsertRecordWithID({
|
3805
|
-
workspace,
|
3806
|
-
region,
|
3807
|
-
database,
|
3808
|
-
branch,
|
3809
|
-
table,
|
3810
|
-
id,
|
3811
|
-
record,
|
3812
|
-
columns,
|
3813
|
-
ifVersion
|
3814
|
-
}) {
|
3815
|
-
return operationsByTag.records.upsertRecordWithID({
|
3816
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
3817
|
-
queryParams: { columns, ifVersion },
|
3818
|
-
body: record,
|
3819
|
-
...this.extraProps
|
3820
|
-
});
|
3821
|
-
}
|
3822
|
-
deleteRecord({
|
3823
|
-
workspace,
|
3824
|
-
region,
|
3825
|
-
database,
|
3826
|
-
branch,
|
3827
|
-
table,
|
3828
|
-
id,
|
3829
|
-
columns
|
3830
|
-
}) {
|
3831
|
-
return operationsByTag.records.deleteRecord({
|
3832
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
3833
|
-
queryParams: { columns },
|
3834
|
-
...this.extraProps
|
3835
|
-
});
|
3836
|
-
}
|
3837
|
-
bulkInsertTableRecords({
|
3838
|
-
workspace,
|
3839
|
-
region,
|
3840
|
-
database,
|
3841
|
-
branch,
|
3842
|
-
table,
|
3843
|
-
records,
|
3844
|
-
columns
|
3845
|
-
}) {
|
3846
|
-
return operationsByTag.records.bulkInsertTableRecords({
|
3847
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
3848
|
-
queryParams: { columns },
|
3849
|
-
body: { records },
|
3850
|
-
...this.extraProps
|
3851
|
-
});
|
3852
|
-
}
|
3853
|
-
branchTransaction({
|
3854
|
-
workspace,
|
3855
|
-
region,
|
3856
|
-
database,
|
3857
|
-
branch,
|
3858
|
-
operations
|
3859
|
-
}) {
|
3860
|
-
return operationsByTag.records.branchTransaction({
|
3861
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
3862
|
-
body: { operations },
|
3863
|
-
...this.extraProps
|
3864
|
-
});
|
3865
|
-
}
|
3866
|
-
}
|
3867
|
-
class FilesApi {
|
3868
|
-
constructor(extraProps) {
|
3869
|
-
this.extraProps = extraProps;
|
3870
|
-
}
|
3871
|
-
getFileItem({
|
3872
|
-
workspace,
|
3873
|
-
region,
|
3874
|
-
database,
|
3875
|
-
branch,
|
3876
|
-
table,
|
3877
|
-
record,
|
3878
|
-
column,
|
3879
|
-
fileId
|
3880
|
-
}) {
|
3881
|
-
return operationsByTag.files.getFileItem({
|
3882
|
-
pathParams: {
|
3883
|
-
workspace,
|
3884
|
-
region,
|
3885
|
-
dbBranchName: `${database}:${branch}`,
|
3886
|
-
tableName: table,
|
3887
|
-
recordId: record,
|
3888
|
-
columnName: column,
|
3889
|
-
fileId
|
3890
|
-
},
|
3891
|
-
...this.extraProps
|
3892
|
-
});
|
3893
|
-
}
|
3894
|
-
putFileItem({
|
3895
|
-
workspace,
|
3896
|
-
region,
|
3897
|
-
database,
|
3898
|
-
branch,
|
3899
|
-
table,
|
3900
|
-
record,
|
3901
|
-
column,
|
3902
|
-
fileId,
|
3903
|
-
file
|
3904
|
-
}) {
|
3905
|
-
return operationsByTag.files.putFileItem({
|
3906
|
-
pathParams: {
|
3907
|
-
workspace,
|
3908
|
-
region,
|
3909
|
-
dbBranchName: `${database}:${branch}`,
|
3910
|
-
tableName: table,
|
3911
|
-
recordId: record,
|
3912
|
-
columnName: column,
|
3913
|
-
fileId
|
3914
|
-
},
|
3915
|
-
// @ts-ignore
|
3916
|
-
body: file,
|
3917
|
-
...this.extraProps
|
3918
|
-
});
|
3919
|
-
}
|
3920
|
-
deleteFileItem({
|
3921
|
-
workspace,
|
3922
|
-
region,
|
3923
|
-
database,
|
3924
|
-
branch,
|
3925
|
-
table,
|
3926
|
-
record,
|
3927
|
-
column,
|
3928
|
-
fileId
|
3929
|
-
}) {
|
3930
|
-
return operationsByTag.files.deleteFileItem({
|
3931
|
-
pathParams: {
|
3932
|
-
workspace,
|
3933
|
-
region,
|
3934
|
-
dbBranchName: `${database}:${branch}`,
|
3935
|
-
tableName: table,
|
3936
|
-
recordId: record,
|
3937
|
-
columnName: column,
|
3938
|
-
fileId
|
3939
|
-
},
|
3940
|
-
...this.extraProps
|
3941
|
-
});
|
3942
|
-
}
|
3943
|
-
getFile({
|
3944
|
-
workspace,
|
3945
|
-
region,
|
3946
|
-
database,
|
3947
|
-
branch,
|
3948
|
-
table,
|
3949
|
-
record,
|
3950
|
-
column
|
3951
|
-
}) {
|
3952
|
-
return operationsByTag.files.getFile({
|
3953
|
-
pathParams: {
|
3954
|
-
workspace,
|
3955
|
-
region,
|
3956
|
-
dbBranchName: `${database}:${branch}`,
|
3957
|
-
tableName: table,
|
3958
|
-
recordId: record,
|
3959
|
-
columnName: column
|
3960
|
-
},
|
3961
|
-
...this.extraProps
|
3962
|
-
});
|
3963
|
-
}
|
3964
|
-
putFile({
|
3965
|
-
workspace,
|
3966
|
-
region,
|
3967
|
-
database,
|
3968
|
-
branch,
|
3969
|
-
table,
|
3970
|
-
record,
|
3971
|
-
column,
|
3972
|
-
file
|
3973
|
-
}) {
|
3974
|
-
return operationsByTag.files.putFile({
|
3975
|
-
pathParams: {
|
3976
|
-
workspace,
|
3977
|
-
region,
|
3978
|
-
dbBranchName: `${database}:${branch}`,
|
3979
|
-
tableName: table,
|
3980
|
-
recordId: record,
|
3981
|
-
columnName: column
|
3982
|
-
},
|
3983
|
-
body: file,
|
3984
|
-
...this.extraProps
|
3985
|
-
});
|
3986
|
-
}
|
3987
|
-
deleteFile({
|
3988
|
-
workspace,
|
3989
|
-
region,
|
3990
|
-
database,
|
3991
|
-
branch,
|
3992
|
-
table,
|
3993
|
-
record,
|
3994
|
-
column
|
3995
|
-
}) {
|
3996
|
-
return operationsByTag.files.deleteFile({
|
3997
|
-
pathParams: {
|
3998
|
-
workspace,
|
3999
|
-
region,
|
4000
|
-
dbBranchName: `${database}:${branch}`,
|
4001
|
-
tableName: table,
|
4002
|
-
recordId: record,
|
4003
|
-
columnName: column
|
4004
|
-
},
|
4005
|
-
...this.extraProps
|
4006
|
-
});
|
4007
|
-
}
|
4008
|
-
fileAccess({
|
4009
|
-
workspace,
|
4010
|
-
region,
|
4011
|
-
fileId,
|
4012
|
-
verify
|
4013
|
-
}) {
|
4014
|
-
return operationsByTag.files.fileAccess({
|
4015
|
-
pathParams: {
|
4016
|
-
workspace,
|
4017
|
-
region,
|
4018
|
-
fileId
|
4019
|
-
},
|
4020
|
-
queryParams: { verify },
|
4021
|
-
...this.extraProps
|
4022
|
-
});
|
4023
|
-
}
|
4024
|
-
}
|
4025
|
-
class SearchAndFilterApi {
|
4026
|
-
constructor(extraProps) {
|
4027
|
-
this.extraProps = extraProps;
|
4028
|
-
}
|
4029
|
-
queryTable({
|
4030
|
-
workspace,
|
4031
|
-
region,
|
4032
|
-
database,
|
4033
|
-
branch,
|
4034
|
-
table,
|
4035
|
-
filter,
|
4036
|
-
sort,
|
4037
|
-
page,
|
4038
|
-
columns,
|
4039
|
-
consistency
|
4040
|
-
}) {
|
4041
|
-
return operationsByTag.searchAndFilter.queryTable({
|
4042
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
4043
|
-
body: { filter, sort, page, columns, consistency },
|
4044
|
-
...this.extraProps
|
4045
|
-
});
|
4046
|
-
}
|
4047
|
-
searchTable({
|
4048
|
-
workspace,
|
4049
|
-
region,
|
4050
|
-
database,
|
4051
|
-
branch,
|
4052
|
-
table,
|
4053
|
-
query,
|
4054
|
-
fuzziness,
|
4055
|
-
target,
|
4056
|
-
prefix,
|
4057
|
-
filter,
|
4058
|
-
highlight,
|
4059
|
-
boosters
|
4060
|
-
}) {
|
4061
|
-
return operationsByTag.searchAndFilter.searchTable({
|
4062
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
4063
|
-
body: { query, fuzziness, target, prefix, filter, highlight, boosters },
|
4064
|
-
...this.extraProps
|
4065
|
-
});
|
4066
|
-
}
|
4067
|
-
searchBranch({
|
4068
|
-
workspace,
|
4069
|
-
region,
|
4070
|
-
database,
|
4071
|
-
branch,
|
4072
|
-
tables,
|
4073
|
-
query,
|
4074
|
-
fuzziness,
|
4075
|
-
prefix,
|
4076
|
-
highlight
|
4077
|
-
}) {
|
4078
|
-
return operationsByTag.searchAndFilter.searchBranch({
|
4079
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
4080
|
-
body: { tables, query, fuzziness, prefix, highlight },
|
4081
|
-
...this.extraProps
|
4082
|
-
});
|
4083
|
-
}
|
4084
|
-
vectorSearchTable({
|
4085
|
-
workspace,
|
4086
|
-
region,
|
4087
|
-
database,
|
4088
|
-
branch,
|
4089
|
-
table,
|
4090
|
-
queryVector,
|
4091
|
-
column,
|
4092
|
-
similarityFunction,
|
4093
|
-
size,
|
4094
|
-
filter
|
4095
|
-
}) {
|
4096
|
-
return operationsByTag.searchAndFilter.vectorSearchTable({
|
4097
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
4098
|
-
body: { queryVector, column, similarityFunction, size, filter },
|
4099
|
-
...this.extraProps
|
4100
|
-
});
|
4101
|
-
}
|
4102
|
-
askTable({
|
4103
|
-
workspace,
|
4104
|
-
region,
|
4105
|
-
database,
|
4106
|
-
branch,
|
4107
|
-
table,
|
4108
|
-
options
|
4109
|
-
}) {
|
4110
|
-
return operationsByTag.searchAndFilter.askTable({
|
4111
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
4112
|
-
body: { ...options },
|
4113
|
-
...this.extraProps
|
4114
|
-
});
|
4115
|
-
}
|
4116
|
-
askTableSession({
|
4117
|
-
workspace,
|
4118
|
-
region,
|
4119
|
-
database,
|
4120
|
-
branch,
|
4121
|
-
table,
|
4122
|
-
sessionId,
|
4123
|
-
message
|
4124
|
-
}) {
|
4125
|
-
return operationsByTag.searchAndFilter.askTableSession({
|
4126
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, sessionId },
|
4127
|
-
body: { message },
|
4128
|
-
...this.extraProps
|
4129
|
-
});
|
4130
|
-
}
|
4131
|
-
summarizeTable({
|
4132
|
-
workspace,
|
4133
|
-
region,
|
4134
|
-
database,
|
4135
|
-
branch,
|
4136
|
-
table,
|
4137
|
-
filter,
|
4138
|
-
columns,
|
4139
|
-
summaries,
|
4140
|
-
sort,
|
4141
|
-
summariesFilter,
|
4142
|
-
page,
|
4143
|
-
consistency
|
4144
|
-
}) {
|
4145
|
-
return operationsByTag.searchAndFilter.summarizeTable({
|
4146
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
4147
|
-
body: { filter, columns, summaries, sort, summariesFilter, page, consistency },
|
4148
|
-
...this.extraProps
|
4149
|
-
});
|
4150
|
-
}
|
4151
|
-
aggregateTable({
|
4152
|
-
workspace,
|
4153
|
-
region,
|
4154
|
-
database,
|
4155
|
-
branch,
|
4156
|
-
table,
|
4157
|
-
filter,
|
4158
|
-
aggs
|
4159
|
-
}) {
|
4160
|
-
return operationsByTag.searchAndFilter.aggregateTable({
|
4161
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
4162
|
-
body: { filter, aggs },
|
4163
|
-
...this.extraProps
|
4164
|
-
});
|
4165
|
-
}
|
4166
|
-
}
|
4167
|
-
class MigrationRequestsApi {
|
4168
|
-
constructor(extraProps) {
|
4169
|
-
this.extraProps = extraProps;
|
4170
|
-
}
|
4171
|
-
queryMigrationRequests({
|
4172
|
-
workspace,
|
4173
|
-
region,
|
4174
|
-
database,
|
4175
|
-
filter,
|
4176
|
-
sort,
|
4177
|
-
page,
|
4178
|
-
columns
|
4179
|
-
}) {
|
4180
|
-
return operationsByTag.migrationRequests.queryMigrationRequests({
|
4181
|
-
pathParams: { workspace, region, dbName: database },
|
4182
|
-
body: { filter, sort, page, columns },
|
4183
|
-
...this.extraProps
|
4184
|
-
});
|
4185
|
-
}
|
4186
|
-
createMigrationRequest({
|
4187
|
-
workspace,
|
4188
|
-
region,
|
4189
|
-
database,
|
4190
|
-
migration
|
4191
|
-
}) {
|
4192
|
-
return operationsByTag.migrationRequests.createMigrationRequest({
|
4193
|
-
pathParams: { workspace, region, dbName: database },
|
4194
|
-
body: migration,
|
4195
|
-
...this.extraProps
|
4196
|
-
});
|
4197
|
-
}
|
4198
|
-
getMigrationRequest({
|
4199
|
-
workspace,
|
4200
|
-
region,
|
4201
|
-
database,
|
4202
|
-
migrationRequest
|
4203
|
-
}) {
|
4204
|
-
return operationsByTag.migrationRequests.getMigrationRequest({
|
4205
|
-
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
4206
|
-
...this.extraProps
|
4207
|
-
});
|
4208
|
-
}
|
4209
|
-
updateMigrationRequest({
|
4210
|
-
workspace,
|
4211
|
-
region,
|
4212
|
-
database,
|
4213
|
-
migrationRequest,
|
4214
|
-
update
|
4215
|
-
}) {
|
4216
|
-
return operationsByTag.migrationRequests.updateMigrationRequest({
|
4217
|
-
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
4218
|
-
body: update,
|
4219
|
-
...this.extraProps
|
4220
|
-
});
|
4221
|
-
}
|
4222
|
-
listMigrationRequestsCommits({
|
4223
|
-
workspace,
|
4224
|
-
region,
|
4225
|
-
database,
|
4226
|
-
migrationRequest,
|
4227
|
-
page
|
4228
|
-
}) {
|
4229
|
-
return operationsByTag.migrationRequests.listMigrationRequestsCommits({
|
4230
|
-
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
4231
|
-
body: { page },
|
4232
|
-
...this.extraProps
|
4233
|
-
});
|
4234
|
-
}
|
4235
|
-
compareMigrationRequest({
|
4236
|
-
workspace,
|
4237
|
-
region,
|
4238
|
-
database,
|
4239
|
-
migrationRequest
|
4240
|
-
}) {
|
4241
|
-
return operationsByTag.migrationRequests.compareMigrationRequest({
|
4242
|
-
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
4243
|
-
...this.extraProps
|
4244
|
-
});
|
4245
|
-
}
|
4246
|
-
getMigrationRequestIsMerged({
|
4247
|
-
workspace,
|
4248
|
-
region,
|
4249
|
-
database,
|
4250
|
-
migrationRequest
|
4251
|
-
}) {
|
4252
|
-
return operationsByTag.migrationRequests.getMigrationRequestIsMerged({
|
4253
|
-
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
4254
|
-
...this.extraProps
|
4255
|
-
});
|
4256
|
-
}
|
4257
|
-
mergeMigrationRequest({
|
4258
|
-
workspace,
|
4259
|
-
region,
|
4260
|
-
database,
|
4261
|
-
migrationRequest
|
4262
|
-
}) {
|
4263
|
-
return operationsByTag.migrationRequests.mergeMigrationRequest({
|
4264
|
-
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
4265
|
-
...this.extraProps
|
4266
|
-
});
|
4267
|
-
}
|
4268
|
-
}
|
4269
|
-
class MigrationsApi {
|
4270
|
-
constructor(extraProps) {
|
4271
|
-
this.extraProps = extraProps;
|
4272
|
-
}
|
4273
|
-
getBranchMigrationHistory({
|
4274
|
-
workspace,
|
4275
|
-
region,
|
4276
|
-
database,
|
4277
|
-
branch,
|
4278
|
-
limit,
|
4279
|
-
startFrom
|
4280
|
-
}) {
|
4281
|
-
return operationsByTag.migrations.getBranchMigrationHistory({
|
4282
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
4283
|
-
body: { limit, startFrom },
|
4284
|
-
...this.extraProps
|
4285
|
-
});
|
4286
|
-
}
|
4287
|
-
getBranchMigrationPlan({
|
4288
|
-
workspace,
|
4289
|
-
region,
|
4290
|
-
database,
|
4291
|
-
branch,
|
4292
|
-
schema
|
4293
|
-
}) {
|
4294
|
-
return operationsByTag.migrations.getBranchMigrationPlan({
|
4295
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
4296
|
-
body: schema,
|
4297
|
-
...this.extraProps
|
4298
|
-
});
|
4299
|
-
}
|
4300
|
-
executeBranchMigrationPlan({
|
4301
|
-
workspace,
|
4302
|
-
region,
|
4303
|
-
database,
|
4304
|
-
branch,
|
4305
|
-
plan
|
4306
|
-
}) {
|
4307
|
-
return operationsByTag.migrations.executeBranchMigrationPlan({
|
4308
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
4309
|
-
body: plan,
|
4310
|
-
...this.extraProps
|
4311
|
-
});
|
4312
|
-
}
|
4313
|
-
getBranchSchemaHistory({
|
4314
|
-
workspace,
|
4315
|
-
region,
|
4316
|
-
database,
|
4317
|
-
branch,
|
4318
|
-
page
|
4319
|
-
}) {
|
4320
|
-
return operationsByTag.migrations.getBranchSchemaHistory({
|
4321
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
4322
|
-
body: { page },
|
4323
|
-
...this.extraProps
|
4324
|
-
});
|
4325
|
-
}
|
4326
|
-
compareBranchWithUserSchema({
|
4327
|
-
workspace,
|
4328
|
-
region,
|
4329
|
-
database,
|
4330
|
-
branch,
|
4331
|
-
schema,
|
4332
|
-
schemaOperations,
|
4333
|
-
branchOperations
|
4334
|
-
}) {
|
4335
|
-
return operationsByTag.migrations.compareBranchWithUserSchema({
|
4336
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
4337
|
-
body: { schema, schemaOperations, branchOperations },
|
4338
|
-
...this.extraProps
|
4339
|
-
});
|
4340
|
-
}
|
4341
|
-
compareBranchSchemas({
|
4342
|
-
workspace,
|
4343
|
-
region,
|
4344
|
-
database,
|
4345
|
-
branch,
|
4346
|
-
compare,
|
4347
|
-
sourceBranchOperations,
|
4348
|
-
targetBranchOperations
|
4349
|
-
}) {
|
4350
|
-
return operationsByTag.migrations.compareBranchSchemas({
|
4351
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, branchName: compare },
|
4352
|
-
body: { sourceBranchOperations, targetBranchOperations },
|
4353
|
-
...this.extraProps
|
4354
|
-
});
|
4355
|
-
}
|
4356
|
-
updateBranchSchema({
|
4357
|
-
workspace,
|
4358
|
-
region,
|
4359
|
-
database,
|
4360
|
-
branch,
|
4361
|
-
migration
|
4362
|
-
}) {
|
4363
|
-
return operationsByTag.migrations.updateBranchSchema({
|
4364
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
4365
|
-
body: migration,
|
4366
|
-
...this.extraProps
|
4367
|
-
});
|
4368
|
-
}
|
4369
|
-
previewBranchSchemaEdit({
|
4370
|
-
workspace,
|
4371
|
-
region,
|
4372
|
-
database,
|
4373
|
-
branch,
|
4374
|
-
data
|
4375
|
-
}) {
|
4376
|
-
return operationsByTag.migrations.previewBranchSchemaEdit({
|
4377
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
4378
|
-
body: data,
|
4379
|
-
...this.extraProps
|
4380
|
-
});
|
4381
|
-
}
|
4382
|
-
applyBranchSchemaEdit({
|
4383
|
-
workspace,
|
4384
|
-
region,
|
4385
|
-
database,
|
4386
|
-
branch,
|
4387
|
-
edits
|
4388
|
-
}) {
|
4389
|
-
return operationsByTag.migrations.applyBranchSchemaEdit({
|
4390
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
4391
|
-
body: { edits },
|
4392
|
-
...this.extraProps
|
4393
|
-
});
|
4394
|
-
}
|
4395
|
-
pushBranchMigrations({
|
4396
|
-
workspace,
|
4397
|
-
region,
|
4398
|
-
database,
|
4399
|
-
branch,
|
4400
|
-
migrations
|
4401
|
-
}) {
|
4402
|
-
return operationsByTag.migrations.pushBranchMigrations({
|
4403
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
4404
|
-
body: { migrations },
|
4405
|
-
...this.extraProps
|
4406
|
-
});
|
4407
|
-
}
|
4408
|
-
getSchema({
|
4409
|
-
workspace,
|
4410
|
-
region,
|
4411
|
-
database,
|
4412
|
-
branch
|
4413
|
-
}) {
|
4414
|
-
return operationsByTag.migrations.getSchema({
|
4415
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
4416
|
-
...this.extraProps
|
4417
|
-
});
|
4418
|
-
}
|
4419
|
-
}
|
4420
|
-
class DatabaseApi {
|
4421
|
-
constructor(extraProps) {
|
4422
|
-
this.extraProps = extraProps;
|
4423
|
-
}
|
4424
|
-
getDatabaseList({ workspace }) {
|
4425
|
-
return operationsByTag.databases.getDatabaseList({
|
4426
|
-
pathParams: { workspaceId: workspace },
|
4427
|
-
...this.extraProps
|
4428
|
-
});
|
4429
|
-
}
|
4430
|
-
createDatabase({
|
4431
|
-
workspace,
|
4432
|
-
database,
|
4433
|
-
data,
|
4434
|
-
headers
|
4435
|
-
}) {
|
4436
|
-
return operationsByTag.databases.createDatabase({
|
4437
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
4438
|
-
body: data,
|
4439
|
-
headers,
|
4440
|
-
...this.extraProps
|
4441
|
-
});
|
4442
|
-
}
|
4443
|
-
deleteDatabase({
|
4444
|
-
workspace,
|
4445
|
-
database
|
4446
|
-
}) {
|
4447
|
-
return operationsByTag.databases.deleteDatabase({
|
4448
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
4449
|
-
...this.extraProps
|
4450
|
-
});
|
4451
|
-
}
|
4452
|
-
getDatabaseMetadata({
|
4453
|
-
workspace,
|
4454
|
-
database
|
4455
|
-
}) {
|
4456
|
-
return operationsByTag.databases.getDatabaseMetadata({
|
4457
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
4458
|
-
...this.extraProps
|
4459
|
-
});
|
4460
|
-
}
|
4461
|
-
updateDatabaseMetadata({
|
4462
|
-
workspace,
|
4463
|
-
database,
|
4464
|
-
metadata
|
4465
|
-
}) {
|
4466
|
-
return operationsByTag.databases.updateDatabaseMetadata({
|
4467
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
4468
|
-
body: metadata,
|
4469
|
-
...this.extraProps
|
4470
|
-
});
|
4471
|
-
}
|
4472
|
-
renameDatabase({
|
4473
|
-
workspace,
|
4474
|
-
database,
|
4475
|
-
newName
|
4476
|
-
}) {
|
4477
|
-
return operationsByTag.databases.renameDatabase({
|
4478
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
4479
|
-
body: { newName },
|
4480
|
-
...this.extraProps
|
4481
|
-
});
|
4482
|
-
}
|
4483
|
-
getDatabaseGithubSettings({
|
4484
|
-
workspace,
|
4485
|
-
database
|
4486
|
-
}) {
|
4487
|
-
return operationsByTag.databases.getDatabaseGithubSettings({
|
4488
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
4489
|
-
...this.extraProps
|
4490
|
-
});
|
4491
|
-
}
|
4492
|
-
updateDatabaseGithubSettings({
|
4493
|
-
workspace,
|
4494
|
-
database,
|
4495
|
-
settings
|
4496
|
-
}) {
|
4497
|
-
return operationsByTag.databases.updateDatabaseGithubSettings({
|
4498
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
4499
|
-
body: settings,
|
4500
|
-
...this.extraProps
|
4501
|
-
});
|
4502
|
-
}
|
4503
|
-
deleteDatabaseGithubSettings({
|
4504
|
-
workspace,
|
4505
|
-
database
|
4506
|
-
}) {
|
4507
|
-
return operationsByTag.databases.deleteDatabaseGithubSettings({
|
4508
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
4509
|
-
...this.extraProps
|
4510
|
-
});
|
3229
|
+
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
3230
|
+
url: "/workspaces/{workspaceId}/invites",
|
3231
|
+
method: "post",
|
3232
|
+
...variables,
|
3233
|
+
signal
|
3234
|
+
});
|
3235
|
+
const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3236
|
+
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
3237
|
+
method: "patch",
|
3238
|
+
...variables,
|
3239
|
+
signal
|
3240
|
+
});
|
3241
|
+
const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3242
|
+
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
3243
|
+
method: "delete",
|
3244
|
+
...variables,
|
3245
|
+
signal
|
3246
|
+
});
|
3247
|
+
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3248
|
+
url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept",
|
3249
|
+
method: "post",
|
3250
|
+
...variables,
|
3251
|
+
signal
|
3252
|
+
});
|
3253
|
+
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3254
|
+
url: "/workspaces/{workspaceId}/invites/{inviteId}/resend",
|
3255
|
+
method: "post",
|
3256
|
+
...variables,
|
3257
|
+
signal
|
3258
|
+
});
|
3259
|
+
const listClusters = (variables, signal) => controlPlaneFetch({
|
3260
|
+
url: "/workspaces/{workspaceId}/clusters",
|
3261
|
+
method: "get",
|
3262
|
+
...variables,
|
3263
|
+
signal
|
3264
|
+
});
|
3265
|
+
const createCluster = (variables, signal) => controlPlaneFetch({
|
3266
|
+
url: "/workspaces/{workspaceId}/clusters",
|
3267
|
+
method: "post",
|
3268
|
+
...variables,
|
3269
|
+
signal
|
3270
|
+
});
|
3271
|
+
const getCluster = (variables, signal) => controlPlaneFetch({
|
3272
|
+
url: "/workspaces/{workspaceId}/clusters/{clusterId}",
|
3273
|
+
method: "get",
|
3274
|
+
...variables,
|
3275
|
+
signal
|
3276
|
+
});
|
3277
|
+
const updateCluster = (variables, signal) => controlPlaneFetch({
|
3278
|
+
url: "/workspaces/{workspaceId}/clusters/{clusterId}",
|
3279
|
+
method: "patch",
|
3280
|
+
...variables,
|
3281
|
+
signal
|
3282
|
+
});
|
3283
|
+
const deleteCluster = (variables, signal) => controlPlaneFetch({
|
3284
|
+
url: "/workspaces/{workspaceId}/clusters/{clusterId}",
|
3285
|
+
method: "delete",
|
3286
|
+
...variables,
|
3287
|
+
signal
|
3288
|
+
});
|
3289
|
+
const getDatabaseList = (variables, signal) => controlPlaneFetch({
|
3290
|
+
url: "/workspaces/{workspaceId}/dbs",
|
3291
|
+
method: "get",
|
3292
|
+
...variables,
|
3293
|
+
signal
|
3294
|
+
});
|
3295
|
+
const createDatabase = (variables, signal) => controlPlaneFetch({
|
3296
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3297
|
+
method: "put",
|
3298
|
+
...variables,
|
3299
|
+
signal
|
3300
|
+
});
|
3301
|
+
const deleteDatabase = (variables, signal) => controlPlaneFetch({
|
3302
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3303
|
+
method: "delete",
|
3304
|
+
...variables,
|
3305
|
+
signal
|
3306
|
+
});
|
3307
|
+
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({
|
3308
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3309
|
+
method: "get",
|
3310
|
+
...variables,
|
3311
|
+
signal
|
3312
|
+
});
|
3313
|
+
const updateDatabaseMetadata = (variables, signal) => controlPlaneFetch({
|
3314
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3315
|
+
method: "patch",
|
3316
|
+
...variables,
|
3317
|
+
signal
|
3318
|
+
});
|
3319
|
+
const renameDatabase = (variables, signal) => controlPlaneFetch({
|
3320
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/rename",
|
3321
|
+
method: "post",
|
3322
|
+
...variables,
|
3323
|
+
signal
|
3324
|
+
});
|
3325
|
+
const getDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({
|
3326
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/github",
|
3327
|
+
method: "get",
|
3328
|
+
...variables,
|
3329
|
+
signal
|
3330
|
+
});
|
3331
|
+
const updateDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({
|
3332
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/github",
|
3333
|
+
method: "put",
|
3334
|
+
...variables,
|
3335
|
+
signal
|
3336
|
+
});
|
3337
|
+
const deleteDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({
|
3338
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/github",
|
3339
|
+
method: "delete",
|
3340
|
+
...variables,
|
3341
|
+
signal
|
3342
|
+
});
|
3343
|
+
const listRegions = (variables, signal) => controlPlaneFetch({
|
3344
|
+
url: "/workspaces/{workspaceId}/regions",
|
3345
|
+
method: "get",
|
3346
|
+
...variables,
|
3347
|
+
signal
|
3348
|
+
});
|
3349
|
+
const operationsByTag$1 = {
|
3350
|
+
oAuth: {
|
3351
|
+
getAuthorizationCode,
|
3352
|
+
grantAuthorizationCode,
|
3353
|
+
getUserOAuthClients,
|
3354
|
+
deleteUserOAuthClient,
|
3355
|
+
getUserOAuthAccessTokens,
|
3356
|
+
deleteOAuthAccessToken,
|
3357
|
+
updateOAuthAccessToken
|
3358
|
+
},
|
3359
|
+
users: { getUser, updateUser, deleteUser },
|
3360
|
+
authentication: { getUserAPIKeys, createUserAPIKey, deleteUserAPIKey },
|
3361
|
+
workspaces: {
|
3362
|
+
getWorkspacesList,
|
3363
|
+
createWorkspace,
|
3364
|
+
getWorkspace,
|
3365
|
+
updateWorkspace,
|
3366
|
+
deleteWorkspace,
|
3367
|
+
getWorkspaceSettings,
|
3368
|
+
updateWorkspaceSettings,
|
3369
|
+
getWorkspaceMembersList,
|
3370
|
+
updateWorkspaceMemberRole,
|
3371
|
+
removeWorkspaceMember
|
3372
|
+
},
|
3373
|
+
invites: {
|
3374
|
+
inviteWorkspaceMember,
|
3375
|
+
updateWorkspaceMemberInvite,
|
3376
|
+
cancelWorkspaceMemberInvite,
|
3377
|
+
acceptWorkspaceMemberInvite,
|
3378
|
+
resendWorkspaceMemberInvite
|
3379
|
+
},
|
3380
|
+
xbcontrolOther: {
|
3381
|
+
listClusters,
|
3382
|
+
createCluster,
|
3383
|
+
getCluster,
|
3384
|
+
updateCluster,
|
3385
|
+
deleteCluster
|
3386
|
+
},
|
3387
|
+
databases: {
|
3388
|
+
getDatabaseList,
|
3389
|
+
createDatabase,
|
3390
|
+
deleteDatabase,
|
3391
|
+
getDatabaseMetadata,
|
3392
|
+
updateDatabaseMetadata,
|
3393
|
+
renameDatabase,
|
3394
|
+
getDatabaseGithubSettings,
|
3395
|
+
updateDatabaseGithubSettings,
|
3396
|
+
deleteDatabaseGithubSettings,
|
3397
|
+
listRegions
|
4511
3398
|
}
|
4512
|
-
|
4513
|
-
|
4514
|
-
|
4515
|
-
|
3399
|
+
};
|
3400
|
+
|
3401
|
+
const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
|
3402
|
+
|
3403
|
+
const buildApiClient = () => class {
|
3404
|
+
constructor(options = {}) {
|
3405
|
+
const provider = options.host ?? "production";
|
3406
|
+
const apiKey = options.apiKey;
|
3407
|
+
const trace = options.trace ?? defaultTrace;
|
3408
|
+
const clientID = generateUUID();
|
3409
|
+
if (!apiKey) {
|
3410
|
+
throw new Error("Could not resolve a valid apiKey");
|
3411
|
+
}
|
3412
|
+
const extraProps = {
|
3413
|
+
apiUrl: getHostUrl(provider, "main"),
|
3414
|
+
workspacesApiUrl: getHostUrl(provider, "workspaces"),
|
3415
|
+
fetch: getFetchImplementation(options.fetch),
|
3416
|
+
apiKey,
|
3417
|
+
trace,
|
3418
|
+
clientName: options.clientName,
|
3419
|
+
xataAgentExtra: options.xataAgentExtra,
|
3420
|
+
clientID
|
3421
|
+
};
|
3422
|
+
return new Proxy(this, {
|
3423
|
+
get: (_target, namespace) => {
|
3424
|
+
if (operationsByTag[namespace] === void 0) {
|
3425
|
+
return void 0;
|
3426
|
+
}
|
3427
|
+
return new Proxy(
|
3428
|
+
{},
|
3429
|
+
{
|
3430
|
+
get: (_target2, operation) => {
|
3431
|
+
if (operationsByTag[namespace][operation] === void 0) {
|
3432
|
+
return void 0;
|
3433
|
+
}
|
3434
|
+
const method = operationsByTag[namespace][operation];
|
3435
|
+
return async (params) => {
|
3436
|
+
return await method({ ...params, ...extraProps });
|
3437
|
+
};
|
3438
|
+
}
|
3439
|
+
}
|
3440
|
+
);
|
3441
|
+
}
|
4516
3442
|
});
|
4517
3443
|
}
|
3444
|
+
};
|
3445
|
+
class XataApiClient extends buildApiClient() {
|
4518
3446
|
}
|
4519
3447
|
|
4520
3448
|
class XataApiPlugin {
|
@@ -4542,8 +3470,7 @@ function buildTransformString(transformations) {
|
|
4542
3470
|
).join(",");
|
4543
3471
|
}
|
4544
3472
|
function transformImage(url, ...transformations) {
|
4545
|
-
if (!isDefined(url))
|
4546
|
-
return void 0;
|
3473
|
+
if (!isDefined(url)) return void 0;
|
4547
3474
|
const newTransformations = buildTransformString(transformations);
|
4548
3475
|
const { hostname, pathname, search } = new URL(url);
|
4549
3476
|
const pathParts = pathname.split("/");
|
@@ -4656,8 +3583,7 @@ class XataFile {
|
|
4656
3583
|
}
|
4657
3584
|
}
|
4658
3585
|
const parseInputFileEntry = async (entry) => {
|
4659
|
-
if (!isDefined(entry))
|
4660
|
-
return null;
|
3586
|
+
if (!isDefined(entry)) return null;
|
4661
3587
|
const { id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout, uploadUrlTimeout } = await entry;
|
4662
3588
|
return compactObject({
|
4663
3589
|
id,
|
@@ -4672,24 +3598,19 @@ const parseInputFileEntry = async (entry) => {
|
|
4672
3598
|
};
|
4673
3599
|
|
4674
3600
|
function cleanFilter(filter) {
|
4675
|
-
if (!isDefined(filter))
|
4676
|
-
|
4677
|
-
if (!isObject(filter))
|
4678
|
-
return filter;
|
3601
|
+
if (!isDefined(filter)) return void 0;
|
3602
|
+
if (!isObject(filter)) return filter;
|
4679
3603
|
const values = Object.fromEntries(
|
4680
3604
|
Object.entries(filter).reduce((acc, [key, value]) => {
|
4681
|
-
if (!isDefined(value))
|
4682
|
-
return acc;
|
3605
|
+
if (!isDefined(value)) return acc;
|
4683
3606
|
if (Array.isArray(value)) {
|
4684
3607
|
const clean = value.map((item) => cleanFilter(item)).filter((item) => isDefined(item));
|
4685
|
-
if (clean.length === 0)
|
4686
|
-
return acc;
|
3608
|
+
if (clean.length === 0) return acc;
|
4687
3609
|
return [...acc, [key, clean]];
|
4688
3610
|
}
|
4689
3611
|
if (isObject(value)) {
|
4690
3612
|
const clean = cleanFilter(value);
|
4691
|
-
if (!isDefined(clean))
|
4692
|
-
return acc;
|
3613
|
+
if (!isDefined(clean)) return acc;
|
4693
3614
|
return [...acc, [key, clean]];
|
4694
3615
|
}
|
4695
3616
|
return [...acc, [key, value]];
|
@@ -4699,10 +3620,8 @@ function cleanFilter(filter) {
|
|
4699
3620
|
}
|
4700
3621
|
|
4701
3622
|
function stringifyJson(value) {
|
4702
|
-
if (!isDefined(value))
|
4703
|
-
|
4704
|
-
if (isString(value))
|
4705
|
-
return value;
|
3623
|
+
if (!isDefined(value)) return value;
|
3624
|
+
if (isString(value)) return value;
|
4706
3625
|
try {
|
4707
3626
|
return JSON.stringify(value);
|
4708
3627
|
} catch (e) {
|
@@ -4717,29 +3636,18 @@ function parseJson(value) {
|
|
4717
3636
|
}
|
4718
3637
|
}
|
4719
3638
|
|
4720
|
-
var
|
4721
|
-
|
4722
|
-
throw TypeError("Cannot " + msg);
|
4723
|
-
};
|
4724
|
-
var __privateGet$5 = (obj, member, getter) => {
|
4725
|
-
__accessCheck$6(obj, member, "read from private field");
|
4726
|
-
return getter ? getter.call(obj) : member.get(obj);
|
4727
|
-
};
|
4728
|
-
var __privateAdd$6 = (obj, member, value) => {
|
4729
|
-
if (member.has(obj))
|
4730
|
-
throw TypeError("Cannot add the same private member more than once");
|
4731
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
4732
|
-
};
|
4733
|
-
var __privateSet$4 = (obj, member, value, setter) => {
|
4734
|
-
__accessCheck$6(obj, member, "write to private field");
|
4735
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
4736
|
-
return value;
|
3639
|
+
var __typeError$5 = (msg) => {
|
3640
|
+
throw TypeError(msg);
|
4737
3641
|
};
|
3642
|
+
var __accessCheck$5 = (obj, member, msg) => member.has(obj) || __typeError$5("Cannot " + msg);
|
3643
|
+
var __privateGet$4 = (obj, member, getter) => (__accessCheck$5(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
3644
|
+
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);
|
3645
|
+
var __privateSet$3 = (obj, member, value, setter) => (__accessCheck$5(obj, member, "write to private field"), member.set(obj, value), value);
|
4738
3646
|
var _query, _page;
|
4739
3647
|
class Page {
|
4740
3648
|
constructor(query, meta, records = []) {
|
4741
|
-
__privateAdd$
|
4742
|
-
__privateSet$
|
3649
|
+
__privateAdd$5(this, _query);
|
3650
|
+
__privateSet$3(this, _query, query);
|
4743
3651
|
this.meta = meta;
|
4744
3652
|
this.records = new PageRecordArray(this, records);
|
4745
3653
|
}
|
@@ -4750,7 +3658,7 @@ class Page {
|
|
4750
3658
|
* @returns The next page or results.
|
4751
3659
|
*/
|
4752
3660
|
async nextPage(size, offset) {
|
4753
|
-
return __privateGet$
|
3661
|
+
return __privateGet$4(this, _query).getPaginated({ pagination: { size, offset, after: this.meta.page.cursor } });
|
4754
3662
|
}
|
4755
3663
|
/**
|
4756
3664
|
* Retrieves the previous page of results.
|
@@ -4759,7 +3667,7 @@ class Page {
|
|
4759
3667
|
* @returns The previous page or results.
|
4760
3668
|
*/
|
4761
3669
|
async previousPage(size, offset) {
|
4762
|
-
return __privateGet$
|
3670
|
+
return __privateGet$4(this, _query).getPaginated({ pagination: { size, offset, before: this.meta.page.cursor } });
|
4763
3671
|
}
|
4764
3672
|
/**
|
4765
3673
|
* Retrieves the start page of results.
|
@@ -4768,7 +3676,7 @@ class Page {
|
|
4768
3676
|
* @returns The start page or results.
|
4769
3677
|
*/
|
4770
3678
|
async startPage(size, offset) {
|
4771
|
-
return __privateGet$
|
3679
|
+
return __privateGet$4(this, _query).getPaginated({ pagination: { size, offset, start: this.meta.page.cursor } });
|
4772
3680
|
}
|
4773
3681
|
/**
|
4774
3682
|
* Retrieves the end page of results.
|
@@ -4777,7 +3685,7 @@ class Page {
|
|
4777
3685
|
* @returns The end page or results.
|
4778
3686
|
*/
|
4779
3687
|
async endPage(size, offset) {
|
4780
|
-
return __privateGet$
|
3688
|
+
return __privateGet$4(this, _query).getPaginated({ pagination: { size, offset, end: this.meta.page.cursor } });
|
4781
3689
|
}
|
4782
3690
|
/**
|
4783
3691
|
* Shortcut method to check if there will be additional results if the next page of results is retrieved.
|
@@ -4825,8 +3733,8 @@ class RecordArray extends Array {
|
|
4825
3733
|
const _PageRecordArray = class _PageRecordArray extends Array {
|
4826
3734
|
constructor(...args) {
|
4827
3735
|
super(..._PageRecordArray.parseConstructorParams(...args));
|
4828
|
-
__privateAdd$
|
4829
|
-
__privateSet$
|
3736
|
+
__privateAdd$5(this, _page);
|
3737
|
+
__privateSet$3(this, _page, isObject(args[0]?.meta) ? args[0] : { meta: { page: { cursor: "", more: false } }, records: [] });
|
4830
3738
|
}
|
4831
3739
|
static parseConstructorParams(...args) {
|
4832
3740
|
if (args.length === 1 && typeof args[0] === "number") {
|
@@ -4856,7 +3764,7 @@ const _PageRecordArray = class _PageRecordArray extends Array {
|
|
4856
3764
|
* @returns A new array of objects
|
4857
3765
|
*/
|
4858
3766
|
async nextPage(size, offset) {
|
4859
|
-
const newPage = await __privateGet$
|
3767
|
+
const newPage = await __privateGet$4(this, _page).nextPage(size, offset);
|
4860
3768
|
return new _PageRecordArray(newPage);
|
4861
3769
|
}
|
4862
3770
|
/**
|
@@ -4865,7 +3773,7 @@ const _PageRecordArray = class _PageRecordArray extends Array {
|
|
4865
3773
|
* @returns A new array of objects
|
4866
3774
|
*/
|
4867
3775
|
async previousPage(size, offset) {
|
4868
|
-
const newPage = await __privateGet$
|
3776
|
+
const newPage = await __privateGet$4(this, _page).previousPage(size, offset);
|
4869
3777
|
return new _PageRecordArray(newPage);
|
4870
3778
|
}
|
4871
3779
|
/**
|
@@ -4874,7 +3782,7 @@ const _PageRecordArray = class _PageRecordArray extends Array {
|
|
4874
3782
|
* @returns A new array of objects
|
4875
3783
|
*/
|
4876
3784
|
async startPage(size, offset) {
|
4877
|
-
const newPage = await __privateGet$
|
3785
|
+
const newPage = await __privateGet$4(this, _page).startPage(size, offset);
|
4878
3786
|
return new _PageRecordArray(newPage);
|
4879
3787
|
}
|
4880
3788
|
/**
|
@@ -4883,69 +3791,54 @@ const _PageRecordArray = class _PageRecordArray extends Array {
|
|
4883
3791
|
* @returns A new array of objects
|
4884
3792
|
*/
|
4885
3793
|
async endPage(size, offset) {
|
4886
|
-
const newPage = await __privateGet$
|
3794
|
+
const newPage = await __privateGet$4(this, _page).endPage(size, offset);
|
4887
3795
|
return new _PageRecordArray(newPage);
|
4888
3796
|
}
|
4889
3797
|
/**
|
4890
3798
|
* @returns Boolean indicating if there is a next page
|
4891
3799
|
*/
|
4892
3800
|
hasNextPage() {
|
4893
|
-
return __privateGet$
|
3801
|
+
return __privateGet$4(this, _page).meta.page.more;
|
4894
3802
|
}
|
4895
3803
|
};
|
4896
3804
|
_page = new WeakMap();
|
4897
3805
|
let PageRecordArray = _PageRecordArray;
|
4898
3806
|
|
4899
|
-
var
|
4900
|
-
|
4901
|
-
throw TypeError("Cannot " + msg);
|
4902
|
-
};
|
4903
|
-
var __privateGet$4 = (obj, member, getter) => {
|
4904
|
-
__accessCheck$5(obj, member, "read from private field");
|
4905
|
-
return getter ? getter.call(obj) : member.get(obj);
|
4906
|
-
};
|
4907
|
-
var __privateAdd$5 = (obj, member, value) => {
|
4908
|
-
if (member.has(obj))
|
4909
|
-
throw TypeError("Cannot add the same private member more than once");
|
4910
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
3807
|
+
var __typeError$4 = (msg) => {
|
3808
|
+
throw TypeError(msg);
|
4911
3809
|
};
|
4912
|
-
var
|
4913
|
-
|
4914
|
-
|
4915
|
-
|
4916
|
-
|
4917
|
-
var
|
4918
|
-
__accessCheck$5(obj, member, "access private method");
|
4919
|
-
return method;
|
4920
|
-
};
|
4921
|
-
var _table$1, _repository, _data, _cleanFilterConstraint, cleanFilterConstraint_fn;
|
3810
|
+
var __accessCheck$4 = (obj, member, msg) => member.has(obj) || __typeError$4("Cannot " + msg);
|
3811
|
+
var __privateGet$3 = (obj, member, getter) => (__accessCheck$4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
3812
|
+
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);
|
3813
|
+
var __privateSet$2 = (obj, member, value, setter) => (__accessCheck$4(obj, member, "write to private field"), member.set(obj, value), value);
|
3814
|
+
var __privateMethod$3 = (obj, member, method) => (__accessCheck$4(obj, member, "access private method"), method);
|
3815
|
+
var _table$1, _repository, _data, _Query_instances, cleanFilterConstraint_fn;
|
4922
3816
|
const _Query = class _Query {
|
4923
3817
|
constructor(repository, table, data, rawParent) {
|
4924
|
-
__privateAdd$
|
4925
|
-
__privateAdd$
|
4926
|
-
__privateAdd$
|
4927
|
-
__privateAdd$
|
3818
|
+
__privateAdd$4(this, _Query_instances);
|
3819
|
+
__privateAdd$4(this, _table$1);
|
3820
|
+
__privateAdd$4(this, _repository);
|
3821
|
+
__privateAdd$4(this, _data, { filter: {} });
|
4928
3822
|
// Implements pagination
|
4929
3823
|
this.meta = { page: { cursor: "start", more: true, size: PAGINATION_DEFAULT_SIZE } };
|
4930
3824
|
this.records = new PageRecordArray(this, []);
|
4931
|
-
__privateSet$
|
3825
|
+
__privateSet$2(this, _table$1, table);
|
4932
3826
|
if (repository) {
|
4933
|
-
__privateSet$
|
3827
|
+
__privateSet$2(this, _repository, repository);
|
4934
3828
|
} else {
|
4935
|
-
__privateSet$
|
3829
|
+
__privateSet$2(this, _repository, this);
|
4936
3830
|
}
|
4937
3831
|
const parent = cleanParent(data, rawParent);
|
4938
|
-
__privateGet$
|
4939
|
-
__privateGet$
|
4940
|
-
__privateGet$
|
4941
|
-
__privateGet$
|
4942
|
-
__privateGet$
|
4943
|
-
__privateGet$
|
4944
|
-
__privateGet$
|
4945
|
-
__privateGet$
|
4946
|
-
__privateGet$
|
4947
|
-
__privateGet$
|
4948
|
-
__privateGet$4(this, _data).fetchOptions = data.fetchOptions ?? parent?.fetchOptions;
|
3832
|
+
__privateGet$3(this, _data).filter = data.filter ?? parent?.filter ?? {};
|
3833
|
+
__privateGet$3(this, _data).filter.$any = data.filter?.$any ?? parent?.filter?.$any;
|
3834
|
+
__privateGet$3(this, _data).filter.$all = data.filter?.$all ?? parent?.filter?.$all;
|
3835
|
+
__privateGet$3(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
|
3836
|
+
__privateGet$3(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
|
3837
|
+
__privateGet$3(this, _data).sort = data.sort ?? parent?.sort;
|
3838
|
+
__privateGet$3(this, _data).columns = data.columns ?? parent?.columns;
|
3839
|
+
__privateGet$3(this, _data).consistency = data.consistency ?? parent?.consistency;
|
3840
|
+
__privateGet$3(this, _data).pagination = data.pagination ?? parent?.pagination;
|
3841
|
+
__privateGet$3(this, _data).fetchOptions = data.fetchOptions ?? parent?.fetchOptions;
|
4949
3842
|
this.any = this.any.bind(this);
|
4950
3843
|
this.all = this.all.bind(this);
|
4951
3844
|
this.not = this.not.bind(this);
|
@@ -4956,10 +3849,10 @@ const _Query = class _Query {
|
|
4956
3849
|
Object.defineProperty(this, "repository", { enumerable: false });
|
4957
3850
|
}
|
4958
3851
|
getQueryOptions() {
|
4959
|
-
return __privateGet$
|
3852
|
+
return __privateGet$3(this, _data);
|
4960
3853
|
}
|
4961
3854
|
key() {
|
4962
|
-
const { columns = [], filter = {}, sort = [], pagination = {} } = __privateGet$
|
3855
|
+
const { columns = [], filter = {}, sort = [], pagination = {} } = __privateGet$3(this, _data);
|
4963
3856
|
const key = JSON.stringify({ columns, filter, sort, pagination });
|
4964
3857
|
return toBase64(key);
|
4965
3858
|
}
|
@@ -4970,7 +3863,7 @@ const _Query = class _Query {
|
|
4970
3863
|
*/
|
4971
3864
|
any(...queries) {
|
4972
3865
|
const $any = queries.map((query) => query.getQueryOptions().filter ?? {});
|
4973
|
-
return new _Query(__privateGet$
|
3866
|
+
return new _Query(__privateGet$3(this, _repository), __privateGet$3(this, _table$1), { filter: { $any } }, __privateGet$3(this, _data));
|
4974
3867
|
}
|
4975
3868
|
/**
|
4976
3869
|
* Builds a new query object representing a logical AND between the given subqueries.
|
@@ -4979,7 +3872,7 @@ const _Query = class _Query {
|
|
4979
3872
|
*/
|
4980
3873
|
all(...queries) {
|
4981
3874
|
const $all = queries.map((query) => query.getQueryOptions().filter ?? {});
|
4982
|
-
return new _Query(__privateGet$
|
3875
|
+
return new _Query(__privateGet$3(this, _repository), __privateGet$3(this, _table$1), { filter: { $all } }, __privateGet$3(this, _data));
|
4983
3876
|
}
|
4984
3877
|
/**
|
4985
3878
|
* Builds a new query object representing a logical OR negating each subquery. In pseudo-code: !q1 OR !q2
|
@@ -4988,7 +3881,7 @@ const _Query = class _Query {
|
|
4988
3881
|
*/
|
4989
3882
|
not(...queries) {
|
4990
3883
|
const $not = queries.map((query) => query.getQueryOptions().filter ?? {});
|
4991
|
-
return new _Query(__privateGet$
|
3884
|
+
return new _Query(__privateGet$3(this, _repository), __privateGet$3(this, _table$1), { filter: { $not } }, __privateGet$3(this, _data));
|
4992
3885
|
}
|
4993
3886
|
/**
|
4994
3887
|
* Builds a new query object representing a logical AND negating each subquery. In pseudo-code: !q1 AND !q2
|
@@ -4997,25 +3890,25 @@ const _Query = class _Query {
|
|
4997
3890
|
*/
|
4998
3891
|
none(...queries) {
|
4999
3892
|
const $none = queries.map((query) => query.getQueryOptions().filter ?? {});
|
5000
|
-
return new _Query(__privateGet$
|
3893
|
+
return new _Query(__privateGet$3(this, _repository), __privateGet$3(this, _table$1), { filter: { $none } }, __privateGet$3(this, _data));
|
5001
3894
|
}
|
5002
3895
|
filter(a, b) {
|
5003
3896
|
if (arguments.length === 1) {
|
5004
3897
|
const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
|
5005
|
-
[column]: __privateMethod$3(this,
|
3898
|
+
[column]: __privateMethod$3(this, _Query_instances, cleanFilterConstraint_fn).call(this, column, constraint)
|
5006
3899
|
}));
|
5007
|
-
const $all = compact([__privateGet$
|
5008
|
-
return new _Query(__privateGet$
|
3900
|
+
const $all = compact([__privateGet$3(this, _data).filter?.$all].flat().concat(constraints));
|
3901
|
+
return new _Query(__privateGet$3(this, _repository), __privateGet$3(this, _table$1), { filter: { $all } }, __privateGet$3(this, _data));
|
5009
3902
|
} else {
|
5010
|
-
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this,
|
5011
|
-
const $all = compact([__privateGet$
|
5012
|
-
return new _Query(__privateGet$
|
3903
|
+
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this, _Query_instances, cleanFilterConstraint_fn).call(this, a, b) }] : void 0;
|
3904
|
+
const $all = compact([__privateGet$3(this, _data).filter?.$all].flat().concat(constraints));
|
3905
|
+
return new _Query(__privateGet$3(this, _repository), __privateGet$3(this, _table$1), { filter: { $all } }, __privateGet$3(this, _data));
|
5013
3906
|
}
|
5014
3907
|
}
|
5015
3908
|
sort(column, direction = "asc") {
|
5016
|
-
const originalSort = [__privateGet$
|
3909
|
+
const originalSort = [__privateGet$3(this, _data).sort ?? []].flat();
|
5017
3910
|
const sort = [...originalSort, { column, direction }];
|
5018
|
-
return new _Query(__privateGet$
|
3911
|
+
return new _Query(__privateGet$3(this, _repository), __privateGet$3(this, _table$1), { sort }, __privateGet$3(this, _data));
|
5019
3912
|
}
|
5020
3913
|
/**
|
5021
3914
|
* Builds a new query specifying the set of columns to be returned in the query response.
|
@@ -5024,15 +3917,15 @@ const _Query = class _Query {
|
|
5024
3917
|
*/
|
5025
3918
|
select(columns) {
|
5026
3919
|
return new _Query(
|
5027
|
-
__privateGet$
|
5028
|
-
__privateGet$
|
3920
|
+
__privateGet$3(this, _repository),
|
3921
|
+
__privateGet$3(this, _table$1),
|
5029
3922
|
{ columns },
|
5030
|
-
__privateGet$
|
3923
|
+
__privateGet$3(this, _data)
|
5031
3924
|
);
|
5032
3925
|
}
|
5033
3926
|
getPaginated(options = {}) {
|
5034
|
-
const query = new _Query(__privateGet$
|
5035
|
-
return __privateGet$
|
3927
|
+
const query = new _Query(__privateGet$3(this, _repository), __privateGet$3(this, _table$1), options, __privateGet$3(this, _data));
|
3928
|
+
return __privateGet$3(this, _repository).query(query);
|
5036
3929
|
}
|
5037
3930
|
/**
|
5038
3931
|
* Get results in an iterator
|
@@ -5086,27 +3979,18 @@ const _Query = class _Query {
|
|
5086
3979
|
}
|
5087
3980
|
async getFirstOrThrow(options = {}) {
|
5088
3981
|
const records = await this.getMany({ ...options, pagination: { size: 1 } });
|
5089
|
-
if (records[0] === void 0)
|
5090
|
-
throw new Error("No results found.");
|
3982
|
+
if (records[0] === void 0) throw new Error("No results found.");
|
5091
3983
|
return records[0];
|
5092
3984
|
}
|
5093
3985
|
async summarize(params = {}) {
|
5094
3986
|
const { summaries, summariesFilter, ...options } = params;
|
5095
3987
|
const query = new _Query(
|
5096
|
-
__privateGet$
|
5097
|
-
__privateGet$
|
3988
|
+
__privateGet$3(this, _repository),
|
3989
|
+
__privateGet$3(this, _table$1),
|
5098
3990
|
options,
|
5099
|
-
__privateGet$
|
3991
|
+
__privateGet$3(this, _data)
|
5100
3992
|
);
|
5101
|
-
return __privateGet$
|
5102
|
-
}
|
5103
|
-
/**
|
5104
|
-
* Builds a new query object adding a cache TTL in milliseconds.
|
5105
|
-
* @param ttl The cache TTL in milliseconds.
|
5106
|
-
* @returns A new Query object.
|
5107
|
-
*/
|
5108
|
-
cache(ttl) {
|
5109
|
-
return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { cache: ttl }, __privateGet$4(this, _data));
|
3993
|
+
return __privateGet$3(this, _repository).summarizeTable(query, summaries, summariesFilter);
|
5110
3994
|
}
|
5111
3995
|
/**
|
5112
3996
|
* Retrieve next page of records
|
@@ -5150,14 +4034,14 @@ const _Query = class _Query {
|
|
5150
4034
|
_table$1 = new WeakMap();
|
5151
4035
|
_repository = new WeakMap();
|
5152
4036
|
_data = new WeakMap();
|
5153
|
-
|
4037
|
+
_Query_instances = new WeakSet();
|
5154
4038
|
cleanFilterConstraint_fn = function(column, value) {
|
5155
|
-
const columnType = __privateGet$
|
4039
|
+
const columnType = __privateGet$3(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
|
5156
4040
|
if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
|
5157
4041
|
return { $includes: value };
|
5158
4042
|
}
|
5159
|
-
if (columnType === "link" && isObject(value) && isString(value.
|
5160
|
-
return value.
|
4043
|
+
if (columnType === "link" && isObject(value) && isString(value.xata_id)) {
|
4044
|
+
return value.xata_id;
|
5161
4045
|
}
|
5162
4046
|
return value;
|
5163
4047
|
};
|
@@ -5185,12 +4069,7 @@ const RecordColumnTypes = [
|
|
5185
4069
|
"json"
|
5186
4070
|
];
|
5187
4071
|
function isIdentifiable(x) {
|
5188
|
-
return isObject(x) && isString(x?.
|
5189
|
-
}
|
5190
|
-
function isXataRecord(x) {
|
5191
|
-
const record = x;
|
5192
|
-
const metadata = record?.getMetadata();
|
5193
|
-
return isIdentifiable(x) && isObject(metadata) && typeof metadata.version === "number";
|
4072
|
+
return isObject(x) && isString(x?.xata_id);
|
5194
4073
|
}
|
5195
4074
|
|
5196
4075
|
function isValidExpandedColumn(column) {
|
@@ -5216,8 +4095,7 @@ function isSortFilterString(value) {
|
|
5216
4095
|
}
|
5217
4096
|
function isSortFilterBase(filter) {
|
5218
4097
|
return isObject(filter) && Object.entries(filter).every(([key, value]) => {
|
5219
|
-
if (key === "*")
|
5220
|
-
return value === "random";
|
4098
|
+
if (key === "*") return value === "random";
|
5221
4099
|
return value === "asc" || value === "desc";
|
5222
4100
|
});
|
5223
4101
|
}
|
@@ -5238,29 +4116,15 @@ function buildSortFilter(filter) {
|
|
5238
4116
|
}
|
5239
4117
|
}
|
5240
4118
|
|
5241
|
-
var
|
5242
|
-
|
5243
|
-
throw TypeError("Cannot " + msg);
|
5244
|
-
};
|
5245
|
-
var __privateGet$3 = (obj, member, getter) => {
|
5246
|
-
__accessCheck$4(obj, member, "read from private field");
|
5247
|
-
return getter ? getter.call(obj) : member.get(obj);
|
5248
|
-
};
|
5249
|
-
var __privateAdd$4 = (obj, member, value) => {
|
5250
|
-
if (member.has(obj))
|
5251
|
-
throw TypeError("Cannot add the same private member more than once");
|
5252
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
5253
|
-
};
|
5254
|
-
var __privateSet$2 = (obj, member, value, setter) => {
|
5255
|
-
__accessCheck$4(obj, member, "write to private field");
|
5256
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
5257
|
-
return value;
|
4119
|
+
var __typeError$3 = (msg) => {
|
4120
|
+
throw TypeError(msg);
|
5258
4121
|
};
|
5259
|
-
var
|
5260
|
-
|
5261
|
-
|
5262
|
-
|
5263
|
-
var
|
4122
|
+
var __accessCheck$3 = (obj, member, msg) => member.has(obj) || __typeError$3("Cannot " + msg);
|
4123
|
+
var __privateGet$2 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
4124
|
+
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);
|
4125
|
+
var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), member.set(obj, value), value);
|
4126
|
+
var __privateMethod$2 = (obj, member, method) => (__accessCheck$3(obj, member, "access private method"), method);
|
4127
|
+
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;
|
5264
4128
|
const BULK_OPERATION_MAX_SIZE = 1e3;
|
5265
4129
|
class Repository extends Query {
|
5266
4130
|
}
|
@@ -5271,79 +4135,65 @@ class RestRepository extends Query {
|
|
5271
4135
|
{ name: options.table, schema: options.schemaTables?.find((table) => table.name === options.table) },
|
5272
4136
|
{}
|
5273
4137
|
);
|
5274
|
-
__privateAdd$
|
5275
|
-
__privateAdd$
|
5276
|
-
__privateAdd$
|
5277
|
-
__privateAdd$
|
5278
|
-
__privateAdd$
|
5279
|
-
__privateAdd$
|
5280
|
-
|
5281
|
-
|
5282
|
-
|
5283
|
-
|
5284
|
-
__privateAdd$4(this, _getSchemaTables);
|
5285
|
-
__privateAdd$4(this, _transformObjectToApi);
|
5286
|
-
__privateAdd$4(this, _table, void 0);
|
5287
|
-
__privateAdd$4(this, _getFetchProps, void 0);
|
5288
|
-
__privateAdd$4(this, _db, void 0);
|
5289
|
-
__privateAdd$4(this, _cache, void 0);
|
5290
|
-
__privateAdd$4(this, _schemaTables, void 0);
|
5291
|
-
__privateAdd$4(this, _trace, void 0);
|
5292
|
-
__privateSet$2(this, _table, options.table);
|
5293
|
-
__privateSet$2(this, _db, options.db);
|
5294
|
-
__privateSet$2(this, _cache, options.pluginOptions.cache);
|
5295
|
-
__privateSet$2(this, _schemaTables, options.schemaTables);
|
5296
|
-
__privateSet$2(this, _getFetchProps, () => ({ ...options.pluginOptions, sessionID: generateUUID() }));
|
4138
|
+
__privateAdd$3(this, _RestRepository_instances);
|
4139
|
+
__privateAdd$3(this, _table);
|
4140
|
+
__privateAdd$3(this, _getFetchProps);
|
4141
|
+
__privateAdd$3(this, _db);
|
4142
|
+
__privateAdd$3(this, _schemaTables);
|
4143
|
+
__privateAdd$3(this, _trace);
|
4144
|
+
__privateSet$1(this, _table, options.table);
|
4145
|
+
__privateSet$1(this, _db, options.db);
|
4146
|
+
__privateSet$1(this, _schemaTables, options.schemaTables);
|
4147
|
+
__privateSet$1(this, _getFetchProps, () => ({ ...options.pluginOptions, sessionID: generateUUID() }));
|
5297
4148
|
const trace = options.pluginOptions.trace ?? defaultTrace;
|
5298
|
-
__privateSet$
|
4149
|
+
__privateSet$1(this, _trace, async (name, fn, options2 = {}) => {
|
5299
4150
|
return trace(name, fn, {
|
5300
4151
|
...options2,
|
5301
|
-
[TraceAttributes.TABLE]: __privateGet$
|
4152
|
+
[TraceAttributes.TABLE]: __privateGet$2(this, _table),
|
5302
4153
|
[TraceAttributes.KIND]: "sdk-operation",
|
5303
4154
|
[TraceAttributes.VERSION]: VERSION
|
5304
4155
|
});
|
5305
4156
|
});
|
5306
4157
|
}
|
5307
4158
|
async create(a, b, c, d) {
|
5308
|
-
return __privateGet$
|
4159
|
+
return __privateGet$2(this, _trace).call(this, "create", async () => {
|
5309
4160
|
const ifVersion = parseIfVersion(b, c, d);
|
5310
4161
|
if (Array.isArray(a)) {
|
5311
|
-
if (a.length === 0)
|
5312
|
-
|
5313
|
-
const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: true });
|
4162
|
+
if (a.length === 0) return [];
|
4163
|
+
const ids = await __privateMethod$2(this, _RestRepository_instances, insertRecords_fn).call(this, a, { ifVersion, createOnly: true });
|
5314
4164
|
const columns = isValidSelectableColumns(b) ? b : ["*"];
|
5315
4165
|
const result = await this.read(ids, columns);
|
5316
4166
|
return result;
|
5317
4167
|
}
|
5318
4168
|
if (isString(a) && isObject(b)) {
|
5319
|
-
if (a === "")
|
5320
|
-
throw new Error("The id can't be empty");
|
4169
|
+
if (a === "") throw new Error("The id can't be empty");
|
5321
4170
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
5322
|
-
return await __privateMethod$2(this,
|
4171
|
+
return await __privateMethod$2(this, _RestRepository_instances, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
|
5323
4172
|
}
|
5324
|
-
if (isObject(a) && isString(a.
|
5325
|
-
if (a.
|
5326
|
-
throw new Error("The id can't be empty");
|
4173
|
+
if (isObject(a) && isString(a.xata_id)) {
|
4174
|
+
if (a.xata_id === "") throw new Error("The id can't be empty");
|
5327
4175
|
const columns = isValidSelectableColumns(b) ? b : void 0;
|
5328
|
-
return await __privateMethod$2(this,
|
4176
|
+
return await __privateMethod$2(this, _RestRepository_instances, insertRecordWithId_fn).call(this, a.xata_id, { ...a, xata_id: void 0 }, columns, {
|
4177
|
+
createOnly: true,
|
4178
|
+
ifVersion
|
4179
|
+
});
|
5329
4180
|
}
|
5330
4181
|
if (isObject(a)) {
|
5331
4182
|
const columns = isValidSelectableColumns(b) ? b : void 0;
|
5332
|
-
return __privateMethod$2(this,
|
4183
|
+
return __privateMethod$2(this, _RestRepository_instances, insertRecordWithoutId_fn).call(this, a, columns);
|
5333
4184
|
}
|
5334
4185
|
throw new Error("Invalid arguments for create method");
|
5335
4186
|
});
|
5336
4187
|
}
|
5337
4188
|
async read(a, b) {
|
5338
|
-
return __privateGet$
|
4189
|
+
return __privateGet$2(this, _trace).call(this, "read", async () => {
|
5339
4190
|
const columns = isValidSelectableColumns(b) ? b : ["*"];
|
5340
4191
|
if (Array.isArray(a)) {
|
5341
|
-
if (a.length === 0)
|
5342
|
-
return [];
|
4192
|
+
if (a.length === 0) return [];
|
5343
4193
|
const ids = a.map((item) => extractId(item));
|
5344
|
-
const finalObjects = await this.getAll({ filter: {
|
4194
|
+
const finalObjects = await this.getAll({ filter: { xata_id: { $any: compact(ids) } }, columns });
|
5345
4195
|
const dictionary = finalObjects.reduce((acc, object) => {
|
5346
|
-
acc[object.
|
4196
|
+
acc[object.xata_id] = object;
|
5347
4197
|
return acc;
|
5348
4198
|
}, {});
|
5349
4199
|
return ids.map((id2) => dictionary[id2 ?? ""] ?? null);
|
@@ -5356,17 +4206,17 @@ class RestRepository extends Query {
|
|
5356
4206
|
workspace: "{workspaceId}",
|
5357
4207
|
dbBranchName: "{dbBranch}",
|
5358
4208
|
region: "{region}",
|
5359
|
-
tableName: __privateGet$
|
4209
|
+
tableName: __privateGet$2(this, _table),
|
5360
4210
|
recordId: id
|
5361
4211
|
},
|
5362
4212
|
queryParams: { columns },
|
5363
|
-
...__privateGet$
|
4213
|
+
...__privateGet$2(this, _getFetchProps).call(this)
|
5364
4214
|
});
|
5365
|
-
const schemaTables = await __privateMethod$2(this,
|
4215
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5366
4216
|
return initObject(
|
5367
|
-
__privateGet$
|
4217
|
+
__privateGet$2(this, _db),
|
5368
4218
|
schemaTables,
|
5369
|
-
__privateGet$
|
4219
|
+
__privateGet$2(this, _table),
|
5370
4220
|
response,
|
5371
4221
|
columns
|
5372
4222
|
);
|
@@ -5381,7 +4231,7 @@ class RestRepository extends Query {
|
|
5381
4231
|
});
|
5382
4232
|
}
|
5383
4233
|
async readOrThrow(a, b) {
|
5384
|
-
return __privateGet$
|
4234
|
+
return __privateGet$2(this, _trace).call(this, "readOrThrow", async () => {
|
5385
4235
|
const result = await this.read(a, b);
|
5386
4236
|
if (Array.isArray(result)) {
|
5387
4237
|
const missingIds = compact(
|
@@ -5400,14 +4250,13 @@ class RestRepository extends Query {
|
|
5400
4250
|
});
|
5401
4251
|
}
|
5402
4252
|
async update(a, b, c, d) {
|
5403
|
-
return __privateGet$
|
4253
|
+
return __privateGet$2(this, _trace).call(this, "update", async () => {
|
5404
4254
|
const ifVersion = parseIfVersion(b, c, d);
|
5405
4255
|
if (Array.isArray(a)) {
|
5406
|
-
if (a.length === 0)
|
5407
|
-
|
5408
|
-
const existing = await this.read(a, ["id"]);
|
4256
|
+
if (a.length === 0) return [];
|
4257
|
+
const existing = await this.read(a, ["xata_id"]);
|
5409
4258
|
const updates = a.filter((_item, index) => existing[index] !== null);
|
5410
|
-
await __privateMethod$2(this,
|
4259
|
+
await __privateMethod$2(this, _RestRepository_instances, updateRecords_fn).call(this, updates, {
|
5411
4260
|
ifVersion,
|
5412
4261
|
upsert: false
|
5413
4262
|
});
|
@@ -5418,22 +4267,21 @@ class RestRepository extends Query {
|
|
5418
4267
|
try {
|
5419
4268
|
if (isString(a) && isObject(b)) {
|
5420
4269
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
5421
|
-
return await __privateMethod$2(this,
|
4270
|
+
return await __privateMethod$2(this, _RestRepository_instances, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
5422
4271
|
}
|
5423
|
-
if (isObject(a) && isString(a.
|
4272
|
+
if (isObject(a) && isString(a.xata_id)) {
|
5424
4273
|
const columns = isValidSelectableColumns(b) ? b : void 0;
|
5425
|
-
return await __privateMethod$2(this,
|
4274
|
+
return await __privateMethod$2(this, _RestRepository_instances, updateRecordWithID_fn).call(this, a.xata_id, { ...a, xata_id: void 0 }, columns, { ifVersion });
|
5426
4275
|
}
|
5427
4276
|
} catch (error) {
|
5428
|
-
if (error.status === 422)
|
5429
|
-
return null;
|
4277
|
+
if (error.status === 422) return null;
|
5430
4278
|
throw error;
|
5431
4279
|
}
|
5432
4280
|
throw new Error("Invalid arguments for update method");
|
5433
4281
|
});
|
5434
4282
|
}
|
5435
4283
|
async updateOrThrow(a, b, c, d) {
|
5436
|
-
return __privateGet$
|
4284
|
+
return __privateGet$2(this, _trace).call(this, "updateOrThrow", async () => {
|
5437
4285
|
const result = await this.update(a, b, c, d);
|
5438
4286
|
if (Array.isArray(result)) {
|
5439
4287
|
const missingIds = compact(
|
@@ -5452,12 +4300,11 @@ class RestRepository extends Query {
|
|
5452
4300
|
});
|
5453
4301
|
}
|
5454
4302
|
async createOrUpdate(a, b, c, d) {
|
5455
|
-
return __privateGet$
|
4303
|
+
return __privateGet$2(this, _trace).call(this, "createOrUpdate", async () => {
|
5456
4304
|
const ifVersion = parseIfVersion(b, c, d);
|
5457
4305
|
if (Array.isArray(a)) {
|
5458
|
-
if (a.length === 0)
|
5459
|
-
|
5460
|
-
await __privateMethod$2(this, _updateRecords, updateRecords_fn).call(this, a, {
|
4306
|
+
if (a.length === 0) return [];
|
4307
|
+
await __privateMethod$2(this, _RestRepository_instances, updateRecords_fn).call(this, a, {
|
5461
4308
|
ifVersion,
|
5462
4309
|
upsert: true
|
5463
4310
|
});
|
@@ -5466,86 +4313,81 @@ class RestRepository extends Query {
|
|
5466
4313
|
return result;
|
5467
4314
|
}
|
5468
4315
|
if (isString(a) && isObject(b)) {
|
5469
|
-
if (a === "")
|
5470
|
-
throw new Error("The id can't be empty");
|
4316
|
+
if (a === "") throw new Error("The id can't be empty");
|
5471
4317
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
5472
|
-
return await __privateMethod$2(this,
|
4318
|
+
return await __privateMethod$2(this, _RestRepository_instances, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
5473
4319
|
}
|
5474
|
-
if (isObject(a) && isString(a.
|
5475
|
-
if (a.
|
5476
|
-
throw new Error("The id can't be empty");
|
4320
|
+
if (isObject(a) && isString(a.xata_id)) {
|
4321
|
+
if (a.xata_id === "") throw new Error("The id can't be empty");
|
5477
4322
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
5478
|
-
return await __privateMethod$2(this,
|
4323
|
+
return await __privateMethod$2(this, _RestRepository_instances, upsertRecordWithID_fn).call(this, a.xata_id, { ...a, xata_id: void 0 }, columns, { ifVersion });
|
5479
4324
|
}
|
5480
4325
|
if (!isDefined(a) && isObject(b)) {
|
5481
4326
|
return await this.create(b, c);
|
5482
4327
|
}
|
5483
|
-
if (isObject(a) && !isDefined(a.
|
4328
|
+
if (isObject(a) && !isDefined(a.xata_id)) {
|
5484
4329
|
return await this.create(a, b);
|
5485
4330
|
}
|
5486
4331
|
throw new Error("Invalid arguments for createOrUpdate method");
|
5487
4332
|
});
|
5488
4333
|
}
|
5489
4334
|
async createOrReplace(a, b, c, d) {
|
5490
|
-
return __privateGet$
|
4335
|
+
return __privateGet$2(this, _trace).call(this, "createOrReplace", async () => {
|
5491
4336
|
const ifVersion = parseIfVersion(b, c, d);
|
5492
4337
|
if (Array.isArray(a)) {
|
5493
|
-
if (a.length === 0)
|
5494
|
-
|
5495
|
-
const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: false });
|
4338
|
+
if (a.length === 0) return [];
|
4339
|
+
const ids = await __privateMethod$2(this, _RestRepository_instances, insertRecords_fn).call(this, a, { ifVersion, createOnly: false });
|
5496
4340
|
const columns = isValidSelectableColumns(b) ? b : ["*"];
|
5497
4341
|
const result = await this.read(ids, columns);
|
5498
4342
|
return result;
|
5499
4343
|
}
|
5500
4344
|
if (isString(a) && isObject(b)) {
|
5501
|
-
if (a === "")
|
5502
|
-
throw new Error("The id can't be empty");
|
4345
|
+
if (a === "") throw new Error("The id can't be empty");
|
5503
4346
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
5504
|
-
return await __privateMethod$2(this,
|
4347
|
+
return await __privateMethod$2(this, _RestRepository_instances, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
|
5505
4348
|
}
|
5506
|
-
if (isObject(a) && isString(a.
|
5507
|
-
if (a.
|
5508
|
-
throw new Error("The id can't be empty");
|
4349
|
+
if (isObject(a) && isString(a.xata_id)) {
|
4350
|
+
if (a.xata_id === "") throw new Error("The id can't be empty");
|
5509
4351
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
5510
|
-
return await __privateMethod$2(this,
|
4352
|
+
return await __privateMethod$2(this, _RestRepository_instances, insertRecordWithId_fn).call(this, a.xata_id, { ...a, xata_id: void 0 }, columns, {
|
4353
|
+
createOnly: false,
|
4354
|
+
ifVersion
|
4355
|
+
});
|
5511
4356
|
}
|
5512
4357
|
if (!isDefined(a) && isObject(b)) {
|
5513
4358
|
return await this.create(b, c);
|
5514
4359
|
}
|
5515
|
-
if (isObject(a) && !isDefined(a.
|
4360
|
+
if (isObject(a) && !isDefined(a.xata_id)) {
|
5516
4361
|
return await this.create(a, b);
|
5517
4362
|
}
|
5518
4363
|
throw new Error("Invalid arguments for createOrReplace method");
|
5519
4364
|
});
|
5520
4365
|
}
|
5521
4366
|
async delete(a, b) {
|
5522
|
-
return __privateGet$
|
4367
|
+
return __privateGet$2(this, _trace).call(this, "delete", async () => {
|
5523
4368
|
if (Array.isArray(a)) {
|
5524
|
-
if (a.length === 0)
|
5525
|
-
return [];
|
4369
|
+
if (a.length === 0) return [];
|
5526
4370
|
const ids = a.map((o) => {
|
5527
|
-
if (isString(o))
|
5528
|
-
|
5529
|
-
if (isString(o.id))
|
5530
|
-
return o.id;
|
4371
|
+
if (isString(o)) return o;
|
4372
|
+
if (isString(o.xata_id)) return o.xata_id;
|
5531
4373
|
throw new Error("Invalid arguments for delete method");
|
5532
4374
|
});
|
5533
4375
|
const columns = isValidSelectableColumns(b) ? b : ["*"];
|
5534
4376
|
const result = await this.read(a, columns);
|
5535
|
-
await __privateMethod$2(this,
|
4377
|
+
await __privateMethod$2(this, _RestRepository_instances, deleteRecords_fn).call(this, ids);
|
5536
4378
|
return result;
|
5537
4379
|
}
|
5538
4380
|
if (isString(a)) {
|
5539
|
-
return __privateMethod$2(this,
|
4381
|
+
return __privateMethod$2(this, _RestRepository_instances, deleteRecord_fn).call(this, a, b);
|
5540
4382
|
}
|
5541
|
-
if (isObject(a) && isString(a.
|
5542
|
-
return __privateMethod$2(this,
|
4383
|
+
if (isObject(a) && isString(a.xata_id)) {
|
4384
|
+
return __privateMethod$2(this, _RestRepository_instances, deleteRecord_fn).call(this, a.xata_id, b);
|
5543
4385
|
}
|
5544
4386
|
throw new Error("Invalid arguments for delete method");
|
5545
4387
|
});
|
5546
4388
|
}
|
5547
4389
|
async deleteOrThrow(a, b) {
|
5548
|
-
return __privateGet$
|
4390
|
+
return __privateGet$2(this, _trace).call(this, "deleteOrThrow", async () => {
|
5549
4391
|
const result = await this.delete(a, b);
|
5550
4392
|
if (Array.isArray(result)) {
|
5551
4393
|
const missingIds = compact(
|
@@ -5563,13 +4405,13 @@ class RestRepository extends Query {
|
|
5563
4405
|
});
|
5564
4406
|
}
|
5565
4407
|
async search(query, options = {}) {
|
5566
|
-
return __privateGet$
|
4408
|
+
return __privateGet$2(this, _trace).call(this, "search", async () => {
|
5567
4409
|
const { records, totalCount } = await searchTable({
|
5568
4410
|
pathParams: {
|
5569
4411
|
workspace: "{workspaceId}",
|
5570
4412
|
dbBranchName: "{dbBranch}",
|
5571
4413
|
region: "{region}",
|
5572
|
-
tableName: __privateGet$
|
4414
|
+
tableName: __privateGet$2(this, _table)
|
5573
4415
|
},
|
5574
4416
|
body: {
|
5575
4417
|
query,
|
@@ -5581,23 +4423,23 @@ class RestRepository extends Query {
|
|
5581
4423
|
page: options.page,
|
5582
4424
|
target: options.target
|
5583
4425
|
},
|
5584
|
-
...__privateGet$
|
4426
|
+
...__privateGet$2(this, _getFetchProps).call(this)
|
5585
4427
|
});
|
5586
|
-
const schemaTables = await __privateMethod$2(this,
|
4428
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5587
4429
|
return {
|
5588
|
-
records: records.map((item) => initObject(__privateGet$
|
4430
|
+
records: records.map((item) => initObject(__privateGet$2(this, _db), schemaTables, __privateGet$2(this, _table), item, ["*"])),
|
5589
4431
|
totalCount
|
5590
4432
|
};
|
5591
4433
|
});
|
5592
4434
|
}
|
5593
4435
|
async vectorSearch(column, query, options) {
|
5594
|
-
return __privateGet$
|
4436
|
+
return __privateGet$2(this, _trace).call(this, "vectorSearch", async () => {
|
5595
4437
|
const { records, totalCount } = await vectorSearchTable({
|
5596
4438
|
pathParams: {
|
5597
4439
|
workspace: "{workspaceId}",
|
5598
4440
|
dbBranchName: "{dbBranch}",
|
5599
4441
|
region: "{region}",
|
5600
|
-
tableName: __privateGet$
|
4442
|
+
tableName: __privateGet$2(this, _table)
|
5601
4443
|
},
|
5602
4444
|
body: {
|
5603
4445
|
column,
|
@@ -5606,42 +4448,39 @@ class RestRepository extends Query {
|
|
5606
4448
|
size: options?.size,
|
5607
4449
|
filter: options?.filter
|
5608
4450
|
},
|
5609
|
-
...__privateGet$
|
4451
|
+
...__privateGet$2(this, _getFetchProps).call(this)
|
5610
4452
|
});
|
5611
|
-
const schemaTables = await __privateMethod$2(this,
|
4453
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5612
4454
|
return {
|
5613
|
-
records: records.map((item) => initObject(__privateGet$
|
4455
|
+
records: records.map((item) => initObject(__privateGet$2(this, _db), schemaTables, __privateGet$2(this, _table), item, ["*"])),
|
5614
4456
|
totalCount
|
5615
4457
|
};
|
5616
4458
|
});
|
5617
4459
|
}
|
5618
4460
|
async aggregate(aggs, filter) {
|
5619
|
-
return __privateGet$
|
4461
|
+
return __privateGet$2(this, _trace).call(this, "aggregate", async () => {
|
5620
4462
|
const result = await aggregateTable({
|
5621
4463
|
pathParams: {
|
5622
4464
|
workspace: "{workspaceId}",
|
5623
4465
|
dbBranchName: "{dbBranch}",
|
5624
4466
|
region: "{region}",
|
5625
|
-
tableName: __privateGet$
|
4467
|
+
tableName: __privateGet$2(this, _table)
|
5626
4468
|
},
|
5627
4469
|
body: { aggs, filter },
|
5628
|
-
...__privateGet$
|
4470
|
+
...__privateGet$2(this, _getFetchProps).call(this)
|
5629
4471
|
});
|
5630
4472
|
return result;
|
5631
4473
|
});
|
5632
4474
|
}
|
5633
4475
|
async query(query) {
|
5634
|
-
return __privateGet$
|
5635
|
-
const cacheQuery = await __privateMethod$2(this, _getCacheQuery, getCacheQuery_fn).call(this, query);
|
5636
|
-
if (cacheQuery)
|
5637
|
-
return new Page(query, cacheQuery.meta, cacheQuery.records);
|
4476
|
+
return __privateGet$2(this, _trace).call(this, "query", async () => {
|
5638
4477
|
const data = query.getQueryOptions();
|
5639
4478
|
const { meta, records: objects } = await queryTable({
|
5640
4479
|
pathParams: {
|
5641
4480
|
workspace: "{workspaceId}",
|
5642
4481
|
dbBranchName: "{dbBranch}",
|
5643
4482
|
region: "{region}",
|
5644
|
-
tableName: __privateGet$
|
4483
|
+
tableName: __privateGet$2(this, _table)
|
5645
4484
|
},
|
5646
4485
|
body: {
|
5647
4486
|
filter: cleanFilter(data.filter),
|
@@ -5651,31 +4490,30 @@ class RestRepository extends Query {
|
|
5651
4490
|
consistency: data.consistency
|
5652
4491
|
},
|
5653
4492
|
fetchOptions: data.fetchOptions,
|
5654
|
-
...__privateGet$
|
4493
|
+
...__privateGet$2(this, _getFetchProps).call(this)
|
5655
4494
|
});
|
5656
|
-
const schemaTables = await __privateMethod$2(this,
|
4495
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5657
4496
|
const records = objects.map(
|
5658
4497
|
(record) => initObject(
|
5659
|
-
__privateGet$
|
4498
|
+
__privateGet$2(this, _db),
|
5660
4499
|
schemaTables,
|
5661
|
-
__privateGet$
|
4500
|
+
__privateGet$2(this, _table),
|
5662
4501
|
record,
|
5663
4502
|
data.columns ?? ["*"]
|
5664
4503
|
)
|
5665
4504
|
);
|
5666
|
-
await __privateMethod$2(this, _setCacheQuery, setCacheQuery_fn).call(this, query, meta, records);
|
5667
4505
|
return new Page(query, meta, records);
|
5668
4506
|
});
|
5669
4507
|
}
|
5670
4508
|
async summarizeTable(query, summaries, summariesFilter) {
|
5671
|
-
return __privateGet$
|
4509
|
+
return __privateGet$2(this, _trace).call(this, "summarize", async () => {
|
5672
4510
|
const data = query.getQueryOptions();
|
5673
4511
|
const result = await summarizeTable({
|
5674
4512
|
pathParams: {
|
5675
4513
|
workspace: "{workspaceId}",
|
5676
4514
|
dbBranchName: "{dbBranch}",
|
5677
4515
|
region: "{region}",
|
5678
|
-
tableName: __privateGet$
|
4516
|
+
tableName: __privateGet$2(this, _table)
|
5679
4517
|
},
|
5680
4518
|
body: {
|
5681
4519
|
filter: cleanFilter(data.filter),
|
@@ -5686,13 +4524,13 @@ class RestRepository extends Query {
|
|
5686
4524
|
summaries,
|
5687
4525
|
summariesFilter
|
5688
4526
|
},
|
5689
|
-
...__privateGet$
|
4527
|
+
...__privateGet$2(this, _getFetchProps).call(this)
|
5690
4528
|
});
|
5691
|
-
const schemaTables = await __privateMethod$2(this,
|
4529
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5692
4530
|
return {
|
5693
4531
|
...result,
|
5694
4532
|
summaries: result.summaries.map(
|
5695
|
-
(summary) => initObject(__privateGet$
|
4533
|
+
(summary) => initObject(__privateGet$2(this, _db), schemaTables, __privateGet$2(this, _table), summary, data.columns ?? [])
|
5696
4534
|
)
|
5697
4535
|
};
|
5698
4536
|
});
|
@@ -5704,7 +4542,7 @@ class RestRepository extends Query {
|
|
5704
4542
|
workspace: "{workspaceId}",
|
5705
4543
|
dbBranchName: "{dbBranch}",
|
5706
4544
|
region: "{region}",
|
5707
|
-
tableName: __privateGet$
|
4545
|
+
tableName: __privateGet$2(this, _table),
|
5708
4546
|
sessionId: options?.sessionId
|
5709
4547
|
},
|
5710
4548
|
body: {
|
@@ -5714,7 +4552,7 @@ class RestRepository extends Query {
|
|
5714
4552
|
search: options?.searchType === "keyword" ? options?.search : void 0,
|
5715
4553
|
vectorSearch: options?.searchType === "vector" ? options?.vectorSearch : void 0
|
5716
4554
|
},
|
5717
|
-
...__privateGet$
|
4555
|
+
...__privateGet$2(this, _getFetchProps).call(this)
|
5718
4556
|
};
|
5719
4557
|
if (options?.onMessage) {
|
5720
4558
|
fetchSSERequest({
|
@@ -5734,51 +4572,47 @@ class RestRepository extends Query {
|
|
5734
4572
|
_table = new WeakMap();
|
5735
4573
|
_getFetchProps = new WeakMap();
|
5736
4574
|
_db = new WeakMap();
|
5737
|
-
_cache = new WeakMap();
|
5738
4575
|
_schemaTables = new WeakMap();
|
5739
4576
|
_trace = new WeakMap();
|
5740
|
-
|
4577
|
+
_RestRepository_instances = new WeakSet();
|
5741
4578
|
insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
5742
|
-
const record = await __privateMethod$2(this,
|
4579
|
+
const record = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
|
5743
4580
|
const response = await insertRecord({
|
5744
4581
|
pathParams: {
|
5745
4582
|
workspace: "{workspaceId}",
|
5746
4583
|
dbBranchName: "{dbBranch}",
|
5747
4584
|
region: "{region}",
|
5748
|
-
tableName: __privateGet$
|
4585
|
+
tableName: __privateGet$2(this, _table)
|
5749
4586
|
},
|
5750
4587
|
queryParams: { columns },
|
5751
4588
|
body: record,
|
5752
|
-
...__privateGet$
|
4589
|
+
...__privateGet$2(this, _getFetchProps).call(this)
|
5753
4590
|
});
|
5754
|
-
const schemaTables = await __privateMethod$2(this,
|
5755
|
-
return initObject(__privateGet$
|
4591
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
4592
|
+
return initObject(__privateGet$2(this, _db), schemaTables, __privateGet$2(this, _table), response, columns);
|
5756
4593
|
};
|
5757
|
-
_insertRecordWithId = new WeakSet();
|
5758
4594
|
insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
|
5759
|
-
if (!recordId)
|
5760
|
-
|
5761
|
-
const record = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
|
4595
|
+
if (!recordId) return null;
|
4596
|
+
const record = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
|
5762
4597
|
const response = await insertRecordWithID({
|
5763
4598
|
pathParams: {
|
5764
4599
|
workspace: "{workspaceId}",
|
5765
4600
|
dbBranchName: "{dbBranch}",
|
5766
4601
|
region: "{region}",
|
5767
|
-
tableName: __privateGet$
|
4602
|
+
tableName: __privateGet$2(this, _table),
|
5768
4603
|
recordId
|
5769
4604
|
},
|
5770
4605
|
body: record,
|
5771
4606
|
queryParams: { createOnly, columns, ifVersion },
|
5772
|
-
...__privateGet$
|
4607
|
+
...__privateGet$2(this, _getFetchProps).call(this)
|
5773
4608
|
});
|
5774
|
-
const schemaTables = await __privateMethod$2(this,
|
5775
|
-
return initObject(__privateGet$
|
4609
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
4610
|
+
return initObject(__privateGet$2(this, _db), schemaTables, __privateGet$2(this, _table), response, columns);
|
5776
4611
|
};
|
5777
|
-
_insertRecords = new WeakSet();
|
5778
4612
|
insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
|
5779
4613
|
const operations = await promiseMap(objects, async (object) => {
|
5780
|
-
const record = await __privateMethod$2(this,
|
5781
|
-
return { insert: { table: __privateGet$
|
4614
|
+
const record = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
|
4615
|
+
return { insert: { table: __privateGet$2(this, _table), record, createOnly, ifVersion } };
|
5782
4616
|
});
|
5783
4617
|
const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
|
5784
4618
|
const ids = [];
|
@@ -5790,7 +4624,7 @@ insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
|
|
5790
4624
|
region: "{region}"
|
5791
4625
|
},
|
5792
4626
|
body: { operations: operations2 },
|
5793
|
-
...__privateGet$
|
4627
|
+
...__privateGet$2(this, _getFetchProps).call(this)
|
5794
4628
|
});
|
5795
4629
|
for (const result of results) {
|
5796
4630
|
if (result.operation === "insert") {
|
@@ -5802,26 +4636,24 @@ insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
|
|
5802
4636
|
}
|
5803
4637
|
return ids;
|
5804
4638
|
};
|
5805
|
-
_updateRecordWithID = new WeakSet();
|
5806
4639
|
updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
5807
|
-
if (!recordId)
|
5808
|
-
|
5809
|
-
const { id: _id, ...record } = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
|
4640
|
+
if (!recordId) return null;
|
4641
|
+
const { xata_id: _id, ...record } = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
|
5810
4642
|
try {
|
5811
4643
|
const response = await updateRecordWithID({
|
5812
4644
|
pathParams: {
|
5813
4645
|
workspace: "{workspaceId}",
|
5814
4646
|
dbBranchName: "{dbBranch}",
|
5815
4647
|
region: "{region}",
|
5816
|
-
tableName: __privateGet$
|
4648
|
+
tableName: __privateGet$2(this, _table),
|
5817
4649
|
recordId
|
5818
4650
|
},
|
5819
4651
|
queryParams: { columns, ifVersion },
|
5820
4652
|
body: record,
|
5821
|
-
...__privateGet$
|
4653
|
+
...__privateGet$2(this, _getFetchProps).call(this)
|
5822
4654
|
});
|
5823
|
-
const schemaTables = await __privateMethod$2(this,
|
5824
|
-
return initObject(__privateGet$
|
4655
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
4656
|
+
return initObject(__privateGet$2(this, _db), schemaTables, __privateGet$2(this, _table), response, columns);
|
5825
4657
|
} catch (e) {
|
5826
4658
|
if (isObject(e) && e.status === 404) {
|
5827
4659
|
return null;
|
@@ -5829,11 +4661,10 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
|
|
5829
4661
|
throw e;
|
5830
4662
|
}
|
5831
4663
|
};
|
5832
|
-
_updateRecords = new WeakSet();
|
5833
4664
|
updateRecords_fn = async function(objects, { ifVersion, upsert }) {
|
5834
|
-
const operations = await promiseMap(objects, async ({
|
5835
|
-
const fields = await __privateMethod$2(this,
|
5836
|
-
return { update: { table: __privateGet$
|
4665
|
+
const operations = await promiseMap(objects, async ({ xata_id, ...object }) => {
|
4666
|
+
const fields = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
|
4667
|
+
return { update: { table: __privateGet$2(this, _table), id: xata_id, ifVersion, upsert, fields } };
|
5837
4668
|
});
|
5838
4669
|
const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
|
5839
4670
|
const ids = [];
|
@@ -5845,7 +4676,7 @@ updateRecords_fn = async function(objects, { ifVersion, upsert }) {
|
|
5845
4676
|
region: "{region}"
|
5846
4677
|
},
|
5847
4678
|
body: { operations: operations2 },
|
5848
|
-
...__privateGet$
|
4679
|
+
...__privateGet$2(this, _getFetchProps).call(this)
|
5849
4680
|
});
|
5850
4681
|
for (const result of results) {
|
5851
4682
|
if (result.operation === "update") {
|
@@ -5857,43 +4688,39 @@ updateRecords_fn = async function(objects, { ifVersion, upsert }) {
|
|
5857
4688
|
}
|
5858
4689
|
return ids;
|
5859
4690
|
};
|
5860
|
-
_upsertRecordWithID = new WeakSet();
|
5861
4691
|
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
5862
|
-
if (!recordId)
|
5863
|
-
return null;
|
4692
|
+
if (!recordId) return null;
|
5864
4693
|
const response = await upsertRecordWithID({
|
5865
4694
|
pathParams: {
|
5866
4695
|
workspace: "{workspaceId}",
|
5867
4696
|
dbBranchName: "{dbBranch}",
|
5868
4697
|
region: "{region}",
|
5869
|
-
tableName: __privateGet$
|
4698
|
+
tableName: __privateGet$2(this, _table),
|
5870
4699
|
recordId
|
5871
4700
|
},
|
5872
4701
|
queryParams: { columns, ifVersion },
|
5873
4702
|
body: object,
|
5874
|
-
...__privateGet$
|
4703
|
+
...__privateGet$2(this, _getFetchProps).call(this)
|
5875
4704
|
});
|
5876
|
-
const schemaTables = await __privateMethod$2(this,
|
5877
|
-
return initObject(__privateGet$
|
4705
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
4706
|
+
return initObject(__privateGet$2(this, _db), schemaTables, __privateGet$2(this, _table), response, columns);
|
5878
4707
|
};
|
5879
|
-
_deleteRecord = new WeakSet();
|
5880
4708
|
deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
5881
|
-
if (!recordId)
|
5882
|
-
return null;
|
4709
|
+
if (!recordId) return null;
|
5883
4710
|
try {
|
5884
4711
|
const response = await deleteRecord({
|
5885
4712
|
pathParams: {
|
5886
4713
|
workspace: "{workspaceId}",
|
5887
4714
|
dbBranchName: "{dbBranch}",
|
5888
4715
|
region: "{region}",
|
5889
|
-
tableName: __privateGet$
|
4716
|
+
tableName: __privateGet$2(this, _table),
|
5890
4717
|
recordId
|
5891
4718
|
},
|
5892
4719
|
queryParams: { columns },
|
5893
|
-
...__privateGet$
|
4720
|
+
...__privateGet$2(this, _getFetchProps).call(this)
|
5894
4721
|
});
|
5895
|
-
const schemaTables = await __privateMethod$2(this,
|
5896
|
-
return initObject(__privateGet$
|
4722
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
4723
|
+
return initObject(__privateGet$2(this, _db), schemaTables, __privateGet$2(this, _table), response, columns);
|
5897
4724
|
} catch (e) {
|
5898
4725
|
if (isObject(e) && e.status === 404) {
|
5899
4726
|
return null;
|
@@ -5901,10 +4728,9 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
|
5901
4728
|
throw e;
|
5902
4729
|
}
|
5903
4730
|
};
|
5904
|
-
_deleteRecords = new WeakSet();
|
5905
4731
|
deleteRecords_fn = async function(recordIds) {
|
5906
4732
|
const chunkedOperations = chunk(
|
5907
|
-
compact(recordIds).map((id) => ({ delete: { table: __privateGet$
|
4733
|
+
compact(recordIds).map((id) => ({ delete: { table: __privateGet$2(this, _table), id } })),
|
5908
4734
|
BULK_OPERATION_MAX_SIZE
|
5909
4735
|
);
|
5910
4736
|
for (const operations of chunkedOperations) {
|
@@ -5915,52 +4741,30 @@ deleteRecords_fn = async function(recordIds) {
|
|
5915
4741
|
region: "{region}"
|
5916
4742
|
},
|
5917
4743
|
body: { operations },
|
5918
|
-
...__privateGet$
|
4744
|
+
...__privateGet$2(this, _getFetchProps).call(this)
|
5919
4745
|
});
|
5920
4746
|
}
|
5921
4747
|
};
|
5922
|
-
_setCacheQuery = new WeakSet();
|
5923
|
-
setCacheQuery_fn = async function(query, meta, records) {
|
5924
|
-
await __privateGet$3(this, _cache)?.set(`query_${__privateGet$3(this, _table)}:${query.key()}`, { date: /* @__PURE__ */ new Date(), meta, records });
|
5925
|
-
};
|
5926
|
-
_getCacheQuery = new WeakSet();
|
5927
|
-
getCacheQuery_fn = async function(query) {
|
5928
|
-
const key = `query_${__privateGet$3(this, _table)}:${query.key()}`;
|
5929
|
-
const result = await __privateGet$3(this, _cache)?.get(key);
|
5930
|
-
if (!result)
|
5931
|
-
return null;
|
5932
|
-
const defaultTTL = __privateGet$3(this, _cache)?.defaultQueryTTL ?? -1;
|
5933
|
-
const { cache: ttl = defaultTTL } = query.getQueryOptions();
|
5934
|
-
if (ttl < 0)
|
5935
|
-
return null;
|
5936
|
-
const hasExpired = result.date.getTime() + ttl < Date.now();
|
5937
|
-
return hasExpired ? null : result;
|
5938
|
-
};
|
5939
|
-
_getSchemaTables = new WeakSet();
|
5940
4748
|
getSchemaTables_fn = async function() {
|
5941
|
-
if (__privateGet$
|
5942
|
-
return __privateGet$3(this, _schemaTables);
|
4749
|
+
if (__privateGet$2(this, _schemaTables)) return __privateGet$2(this, _schemaTables);
|
5943
4750
|
const { schema } = await getBranchDetails({
|
5944
4751
|
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
5945
|
-
...__privateGet$
|
4752
|
+
...__privateGet$2(this, _getFetchProps).call(this)
|
5946
4753
|
});
|
5947
|
-
__privateSet$
|
4754
|
+
__privateSet$1(this, _schemaTables, schema.tables);
|
5948
4755
|
return schema.tables;
|
5949
4756
|
};
|
5950
|
-
_transformObjectToApi = new WeakSet();
|
5951
4757
|
transformObjectToApi_fn = async function(object) {
|
5952
|
-
const schemaTables = await __privateMethod$2(this,
|
5953
|
-
const schema = schemaTables.find((table) => table.name === __privateGet$
|
5954
|
-
if (!schema)
|
5955
|
-
throw new Error(`Table ${__privateGet$3(this, _table)} not found in schema`);
|
4758
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
4759
|
+
const schema = schemaTables.find((table) => table.name === __privateGet$2(this, _table));
|
4760
|
+
if (!schema) throw new Error(`Table ${__privateGet$2(this, _table)} not found in schema`);
|
5956
4761
|
const result = {};
|
5957
4762
|
for (const [key, value] of Object.entries(object)) {
|
5958
|
-
if (
|
5959
|
-
continue;
|
4763
|
+
if (["xata_version", "xata_createdat", "xata_updatedat"].includes(key)) continue;
|
5960
4764
|
const type = schema.columns.find((column) => column.name === key)?.type;
|
5961
4765
|
switch (type) {
|
5962
4766
|
case "link": {
|
5963
|
-
result[key] = isIdentifiable(value) ? value.
|
4767
|
+
result[key] = isIdentifiable(value) ? value.xata_id : value;
|
5964
4768
|
break;
|
5965
4769
|
}
|
5966
4770
|
case "datetime": {
|
@@ -5984,14 +4788,11 @@ transformObjectToApi_fn = async function(object) {
|
|
5984
4788
|
};
|
5985
4789
|
const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
5986
4790
|
const data = {};
|
5987
|
-
|
5988
|
-
Object.assign(data, rest);
|
4791
|
+
Object.assign(data, { ...object });
|
5989
4792
|
const { columns } = schemaTables.find(({ name }) => name === table) ?? {};
|
5990
|
-
if (!columns)
|
5991
|
-
console.error(`Table ${table} not found in schema`);
|
4793
|
+
if (!columns) console.error(`Table ${table} not found in schema`);
|
5992
4794
|
for (const column of columns ?? []) {
|
5993
|
-
if (!isValidColumn(selectedColumns, column))
|
5994
|
-
continue;
|
4795
|
+
if (!isValidColumn(selectedColumns, column)) continue;
|
5995
4796
|
const value = data[column.name];
|
5996
4797
|
switch (column.type) {
|
5997
4798
|
case "datetime": {
|
@@ -6026,7 +4827,7 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
6026
4827
|
selectedLinkColumns
|
6027
4828
|
);
|
6028
4829
|
} else {
|
6029
|
-
data[column.name] = null;
|
4830
|
+
data[column.name] = value ?? null;
|
6030
4831
|
}
|
6031
4832
|
break;
|
6032
4833
|
}
|
@@ -6048,28 +4849,21 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
6048
4849
|
}
|
6049
4850
|
}
|
6050
4851
|
const record = { ...data };
|
6051
|
-
const metadata = xata !== void 0 ? { ...xata, createdAt: new Date(xata.createdAt), updatedAt: new Date(xata.updatedAt) } : void 0;
|
6052
4852
|
record.read = function(columns2) {
|
6053
|
-
return db[table].read(record["
|
4853
|
+
return db[table].read(record["xata_id"], columns2);
|
6054
4854
|
};
|
6055
4855
|
record.update = function(data2, b, c) {
|
6056
4856
|
const columns2 = isValidSelectableColumns(b) ? b : ["*"];
|
6057
4857
|
const ifVersion = parseIfVersion(b, c);
|
6058
|
-
return db[table].update(record["
|
4858
|
+
return db[table].update(record["xata_id"], data2, columns2, { ifVersion });
|
6059
4859
|
};
|
6060
4860
|
record.replace = function(data2, b, c) {
|
6061
4861
|
const columns2 = isValidSelectableColumns(b) ? b : ["*"];
|
6062
4862
|
const ifVersion = parseIfVersion(b, c);
|
6063
|
-
return db[table].createOrReplace(record["
|
4863
|
+
return db[table].createOrReplace(record["xata_id"], data2, columns2, { ifVersion });
|
6064
4864
|
};
|
6065
4865
|
record.delete = function() {
|
6066
|
-
return db[table].delete(record["
|
6067
|
-
};
|
6068
|
-
if (metadata !== void 0) {
|
6069
|
-
record.xata = Object.freeze(metadata);
|
6070
|
-
}
|
6071
|
-
record.getMetadata = function() {
|
6072
|
-
return record.xata;
|
4866
|
+
return db[table].delete(record["xata_id"]);
|
6073
4867
|
};
|
6074
4868
|
record.toSerializable = function() {
|
6075
4869
|
return JSON.parse(JSON.stringify(record));
|
@@ -6077,22 +4871,19 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
6077
4871
|
record.toString = function() {
|
6078
4872
|
return JSON.stringify(record);
|
6079
4873
|
};
|
6080
|
-
for (const prop of ["read", "update", "replace", "delete", "
|
4874
|
+
for (const prop of ["read", "update", "replace", "delete", "toSerializable", "toString"]) {
|
6081
4875
|
Object.defineProperty(record, prop, { enumerable: false });
|
6082
4876
|
}
|
6083
4877
|
Object.freeze(record);
|
6084
4878
|
return record;
|
6085
4879
|
};
|
6086
4880
|
function extractId(value) {
|
6087
|
-
if (isString(value))
|
6088
|
-
|
6089
|
-
if (isObject(value) && isString(value.id))
|
6090
|
-
return value.id;
|
4881
|
+
if (isString(value)) return value;
|
4882
|
+
if (isObject(value) && isString(value.xata_id)) return value.xata_id;
|
6091
4883
|
return void 0;
|
6092
4884
|
}
|
6093
4885
|
function isValidColumn(columns, column) {
|
6094
|
-
if (columns.includes("*"))
|
6095
|
-
return true;
|
4886
|
+
if (columns.includes("*")) return true;
|
6096
4887
|
return columns.filter((item) => isString(item) && item.startsWith(column.name)).length > 0;
|
6097
4888
|
}
|
6098
4889
|
function parseIfVersion(...args) {
|
@@ -6104,55 +4895,6 @@ function parseIfVersion(...args) {
|
|
6104
4895
|
return void 0;
|
6105
4896
|
}
|
6106
4897
|
|
6107
|
-
var __accessCheck$3 = (obj, member, msg) => {
|
6108
|
-
if (!member.has(obj))
|
6109
|
-
throw TypeError("Cannot " + msg);
|
6110
|
-
};
|
6111
|
-
var __privateGet$2 = (obj, member, getter) => {
|
6112
|
-
__accessCheck$3(obj, member, "read from private field");
|
6113
|
-
return getter ? getter.call(obj) : member.get(obj);
|
6114
|
-
};
|
6115
|
-
var __privateAdd$3 = (obj, member, value) => {
|
6116
|
-
if (member.has(obj))
|
6117
|
-
throw TypeError("Cannot add the same private member more than once");
|
6118
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
6119
|
-
};
|
6120
|
-
var __privateSet$1 = (obj, member, value, setter) => {
|
6121
|
-
__accessCheck$3(obj, member, "write to private field");
|
6122
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
6123
|
-
return value;
|
6124
|
-
};
|
6125
|
-
var _map;
|
6126
|
-
class SimpleCache {
|
6127
|
-
constructor(options = {}) {
|
6128
|
-
__privateAdd$3(this, _map, void 0);
|
6129
|
-
__privateSet$1(this, _map, /* @__PURE__ */ new Map());
|
6130
|
-
this.capacity = options.max ?? 500;
|
6131
|
-
this.defaultQueryTTL = options.defaultQueryTTL ?? 60 * 1e3;
|
6132
|
-
}
|
6133
|
-
async getAll() {
|
6134
|
-
return Object.fromEntries(__privateGet$2(this, _map));
|
6135
|
-
}
|
6136
|
-
async get(key) {
|
6137
|
-
return __privateGet$2(this, _map).get(key) ?? null;
|
6138
|
-
}
|
6139
|
-
async set(key, value) {
|
6140
|
-
await this.delete(key);
|
6141
|
-
__privateGet$2(this, _map).set(key, value);
|
6142
|
-
if (__privateGet$2(this, _map).size > this.capacity) {
|
6143
|
-
const leastRecentlyUsed = __privateGet$2(this, _map).keys().next().value;
|
6144
|
-
await this.delete(leastRecentlyUsed);
|
6145
|
-
}
|
6146
|
-
}
|
6147
|
-
async delete(key) {
|
6148
|
-
__privateGet$2(this, _map).delete(key);
|
6149
|
-
}
|
6150
|
-
async clear() {
|
6151
|
-
return __privateGet$2(this, _map).clear();
|
6152
|
-
}
|
6153
|
-
}
|
6154
|
-
_map = new WeakMap();
|
6155
|
-
|
6156
4898
|
const greaterThan = (value) => ({ $gt: value });
|
6157
4899
|
const gt = greaterThan;
|
6158
4900
|
const greaterThanEquals = (value) => ({ $ge: value });
|
@@ -6181,19 +4923,12 @@ const includesAll = (value) => ({ $includesAll: value });
|
|
6181
4923
|
const includesNone = (value) => ({ $includesNone: value });
|
6182
4924
|
const includesAny = (value) => ({ $includesAny: value });
|
6183
4925
|
|
6184
|
-
var
|
6185
|
-
|
6186
|
-
throw TypeError("Cannot " + msg);
|
6187
|
-
};
|
6188
|
-
var __privateGet$1 = (obj, member, getter) => {
|
6189
|
-
__accessCheck$2(obj, member, "read from private field");
|
6190
|
-
return getter ? getter.call(obj) : member.get(obj);
|
6191
|
-
};
|
6192
|
-
var __privateAdd$2 = (obj, member, value) => {
|
6193
|
-
if (member.has(obj))
|
6194
|
-
throw TypeError("Cannot add the same private member more than once");
|
6195
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
4926
|
+
var __typeError$2 = (msg) => {
|
4927
|
+
throw TypeError(msg);
|
6196
4928
|
};
|
4929
|
+
var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg);
|
4930
|
+
var __privateGet$1 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
4931
|
+
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);
|
6197
4932
|
var _tables;
|
6198
4933
|
class SchemaPlugin extends XataPlugin {
|
6199
4934
|
constructor() {
|
@@ -6205,8 +4940,7 @@ class SchemaPlugin extends XataPlugin {
|
|
6205
4940
|
{},
|
6206
4941
|
{
|
6207
4942
|
get: (_target, table) => {
|
6208
|
-
if (!isString(table))
|
6209
|
-
throw new Error("Invalid table name");
|
4943
|
+
if (!isString(table)) throw new Error("Invalid table name");
|
6210
4944
|
if (__privateGet$1(this, _tables)[table] === void 0) {
|
6211
4945
|
__privateGet$1(this, _tables)[table] = new RestRepository({ db, pluginOptions, table, schemaTables: pluginOptions.tables });
|
6212
4946
|
}
|
@@ -6297,42 +5031,35 @@ function getContentType(file) {
|
|
6297
5031
|
return "application/octet-stream";
|
6298
5032
|
}
|
6299
5033
|
|
6300
|
-
var
|
6301
|
-
|
6302
|
-
throw TypeError("Cannot " + msg);
|
6303
|
-
};
|
6304
|
-
var __privateAdd$1 = (obj, member, value) => {
|
6305
|
-
if (member.has(obj))
|
6306
|
-
throw TypeError("Cannot add the same private member more than once");
|
6307
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
5034
|
+
var __typeError$1 = (msg) => {
|
5035
|
+
throw TypeError(msg);
|
6308
5036
|
};
|
6309
|
-
var
|
6310
|
-
|
6311
|
-
|
6312
|
-
|
6313
|
-
var _search, search_fn;
|
5037
|
+
var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
|
5038
|
+
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);
|
5039
|
+
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
5040
|
+
var _SearchPlugin_instances, search_fn;
|
6314
5041
|
class SearchPlugin extends XataPlugin {
|
6315
5042
|
constructor(db) {
|
6316
5043
|
super();
|
6317
5044
|
this.db = db;
|
6318
|
-
__privateAdd$1(this,
|
5045
|
+
__privateAdd$1(this, _SearchPlugin_instances);
|
6319
5046
|
}
|
6320
5047
|
build(pluginOptions) {
|
6321
5048
|
return {
|
6322
5049
|
all: async (query, options = {}) => {
|
6323
|
-
const { records, totalCount } = await __privateMethod$1(this,
|
5050
|
+
const { records, totalCount } = await __privateMethod$1(this, _SearchPlugin_instances, search_fn).call(this, query, options, pluginOptions);
|
6324
5051
|
return {
|
6325
5052
|
totalCount,
|
6326
5053
|
records: records.map((record) => {
|
6327
|
-
const
|
5054
|
+
const table = record.xata_table;
|
6328
5055
|
return { table, record: initObject(this.db, pluginOptions.tables, table, record, ["*"]) };
|
6329
5056
|
})
|
6330
5057
|
};
|
6331
5058
|
},
|
6332
5059
|
byTable: async (query, options = {}) => {
|
6333
|
-
const { records: rawRecords, totalCount } = await __privateMethod$1(this,
|
5060
|
+
const { records: rawRecords, totalCount } = await __privateMethod$1(this, _SearchPlugin_instances, search_fn).call(this, query, options, pluginOptions);
|
6334
5061
|
const records = rawRecords.reduce((acc, record) => {
|
6335
|
-
const
|
5062
|
+
const table = record.xata_table;
|
6336
5063
|
const items = acc[table] ?? [];
|
6337
5064
|
const item = initObject(this.db, pluginOptions.tables, table, record, ["*"]);
|
6338
5065
|
return { ...acc, [table]: [...items, item] };
|
@@ -6342,7 +5069,7 @@ class SearchPlugin extends XataPlugin {
|
|
6342
5069
|
};
|
6343
5070
|
}
|
6344
5071
|
}
|
6345
|
-
|
5072
|
+
_SearchPlugin_instances = new WeakSet();
|
6346
5073
|
search_fn = async function(query, options, pluginOptions) {
|
6347
5074
|
const { tables, fuzziness, highlight, prefix, page } = options ?? {};
|
6348
5075
|
const { records, totalCount } = await searchBranch({
|
@@ -6378,8 +5105,7 @@ function arrayString(val) {
|
|
6378
5105
|
return result;
|
6379
5106
|
}
|
6380
5107
|
function prepareValue(value) {
|
6381
|
-
if (!isDefined(value))
|
6382
|
-
return null;
|
5108
|
+
if (!isDefined(value)) return null;
|
6383
5109
|
if (value instanceof Date) {
|
6384
5110
|
return value.toISOString();
|
6385
5111
|
}
|
@@ -6419,19 +5145,28 @@ class SQLPlugin extends XataPlugin {
|
|
6419
5145
|
throw new Error("Invalid usage of `xata.sql`. Please use it as a tagged template or with an object.");
|
6420
5146
|
}
|
6421
5147
|
const { statement, params, consistency, responseType } = prepareParams(query, parameters);
|
6422
|
-
const {
|
6423
|
-
records,
|
6424
|
-
rows,
|
6425
|
-
warning,
|
6426
|
-
columns = []
|
6427
|
-
} = await sqlQuery({
|
5148
|
+
const { warning, columns, ...response } = await sqlQuery({
|
6428
5149
|
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
6429
5150
|
body: { statement, params, consistency, responseType },
|
6430
5151
|
...pluginOptions
|
6431
5152
|
});
|
5153
|
+
const records = "records" in response ? response.records : void 0;
|
5154
|
+
const rows = "rows" in response ? response.rows : void 0;
|
6432
5155
|
return { records, rows, warning, columns };
|
6433
5156
|
};
|
6434
5157
|
sqlFunction.connectionString = buildConnectionString(pluginOptions);
|
5158
|
+
sqlFunction.batch = async (query) => {
|
5159
|
+
const { results } = await sqlBatchQuery({
|
5160
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
5161
|
+
body: {
|
5162
|
+
statements: query.statements.map(({ statement, params }) => ({ statement, params })),
|
5163
|
+
consistency: query.consistency,
|
5164
|
+
responseType: query.responseType
|
5165
|
+
},
|
5166
|
+
...pluginOptions
|
5167
|
+
});
|
5168
|
+
return { results };
|
5169
|
+
};
|
6435
5170
|
return sqlFunction;
|
6436
5171
|
}
|
6437
5172
|
}
|
@@ -6458,8 +5193,7 @@ function buildDomain(host, region) {
|
|
6458
5193
|
function buildConnectionString({ apiKey, workspacesApiUrl, branch }) {
|
6459
5194
|
const url = isString(workspacesApiUrl) ? workspacesApiUrl : workspacesApiUrl("", {});
|
6460
5195
|
const parts = parseWorkspacesUrlParts(url);
|
6461
|
-
if (!parts)
|
6462
|
-
throw new Error("Invalid workspaces URL");
|
5196
|
+
if (!parts) throw new Error("Invalid workspaces URL");
|
6463
5197
|
const { workspace: workspaceSlug, region, database, host } = parts;
|
6464
5198
|
const domain = buildDomain(host, region);
|
6465
5199
|
const workspace = workspaceSlug.split("-").pop();
|
@@ -6484,40 +5218,24 @@ class TransactionPlugin extends XataPlugin {
|
|
6484
5218
|
}
|
6485
5219
|
}
|
6486
5220
|
|
6487
|
-
var
|
6488
|
-
|
6489
|
-
throw TypeError("Cannot " + msg);
|
6490
|
-
};
|
6491
|
-
var __privateGet = (obj, member, getter) => {
|
6492
|
-
__accessCheck(obj, member, "read from private field");
|
6493
|
-
return getter ? getter.call(obj) : member.get(obj);
|
6494
|
-
};
|
6495
|
-
var __privateAdd = (obj, member, value) => {
|
6496
|
-
if (member.has(obj))
|
6497
|
-
throw TypeError("Cannot add the same private member more than once");
|
6498
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
6499
|
-
};
|
6500
|
-
var __privateSet = (obj, member, value, setter) => {
|
6501
|
-
__accessCheck(obj, member, "write to private field");
|
6502
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
6503
|
-
return value;
|
6504
|
-
};
|
6505
|
-
var __privateMethod = (obj, member, method) => {
|
6506
|
-
__accessCheck(obj, member, "access private method");
|
6507
|
-
return method;
|
5221
|
+
var __typeError = (msg) => {
|
5222
|
+
throw TypeError(msg);
|
6508
5223
|
};
|
5224
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
5225
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
5226
|
+
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);
|
5227
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
5228
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
6509
5229
|
const buildClient = (plugins) => {
|
6510
|
-
var _options,
|
5230
|
+
var _options, _instances, parseOptions_fn, getFetchProps_fn, _a;
|
6511
5231
|
return _a = class {
|
6512
5232
|
constructor(options = {}, tables) {
|
6513
|
-
__privateAdd(this,
|
6514
|
-
__privateAdd(this,
|
6515
|
-
|
6516
|
-
const safeOptions = __privateMethod(this, _parseOptions, parseOptions_fn).call(this, options);
|
5233
|
+
__privateAdd(this, _instances);
|
5234
|
+
__privateAdd(this, _options);
|
5235
|
+
const safeOptions = __privateMethod(this, _instances, parseOptions_fn).call(this, options);
|
6517
5236
|
__privateSet(this, _options, safeOptions);
|
6518
5237
|
const pluginOptions = {
|
6519
|
-
...__privateMethod(this,
|
6520
|
-
cache: safeOptions.cache,
|
5238
|
+
...__privateMethod(this, _instances, getFetchProps_fn).call(this, safeOptions),
|
6521
5239
|
host: safeOptions.host,
|
6522
5240
|
tables,
|
6523
5241
|
branch: safeOptions.branch
|
@@ -6534,8 +5252,7 @@ const buildClient = (plugins) => {
|
|
6534
5252
|
this.sql = sql;
|
6535
5253
|
this.files = files;
|
6536
5254
|
for (const [key, namespace] of Object.entries(plugins ?? {})) {
|
6537
|
-
if (namespace === void 0)
|
6538
|
-
continue;
|
5255
|
+
if (namespace === void 0) continue;
|
6539
5256
|
this[key] = namespace.build(pluginOptions);
|
6540
5257
|
}
|
6541
5258
|
}
|
@@ -6544,8 +5261,8 @@ const buildClient = (plugins) => {
|
|
6544
5261
|
const branch = __privateGet(this, _options).branch;
|
6545
5262
|
return { databaseURL, branch };
|
6546
5263
|
}
|
6547
|
-
}, _options = new WeakMap(),
|
6548
|
-
const enableBrowser = options?.enableBrowser ??
|
5264
|
+
}, _options = new WeakMap(), _instances = new WeakSet(), parseOptions_fn = function(options) {
|
5265
|
+
const enableBrowser = options?.enableBrowser ?? false;
|
6549
5266
|
const isBrowser = typeof window !== "undefined" && typeof Deno === "undefined";
|
6550
5267
|
if (isBrowser && !enableBrowser) {
|
6551
5268
|
throw new Error(
|
@@ -6553,9 +5270,9 @@ const buildClient = (plugins) => {
|
|
6553
5270
|
);
|
6554
5271
|
}
|
6555
5272
|
const fetch = getFetchImplementation(options?.fetch);
|
6556
|
-
const databaseURL = options?.databaseURL
|
6557
|
-
const apiKey = options?.apiKey
|
6558
|
-
const
|
5273
|
+
const databaseURL = options?.databaseURL;
|
5274
|
+
const apiKey = options?.apiKey;
|
5275
|
+
const branch = options?.branch;
|
6559
5276
|
const trace = options?.trace ?? defaultTrace;
|
6560
5277
|
const clientName = options?.clientName;
|
6561
5278
|
const host = options?.host ?? "production";
|
@@ -6566,32 +5283,14 @@ const buildClient = (plugins) => {
|
|
6566
5283
|
if (!databaseURL) {
|
6567
5284
|
throw new Error("Option databaseURL is required");
|
6568
5285
|
}
|
6569
|
-
|
6570
|
-
|
6571
|
-
const branch = options?.branch || previewBranch || envBranch || "main";
|
6572
|
-
if (!!previewBranch && branch !== previewBranch) {
|
6573
|
-
console.warn(
|
6574
|
-
`Ignoring preview branch ${previewBranch} because branch option was passed to the client constructor with value ${branch}`
|
6575
|
-
);
|
6576
|
-
} else if (!!envBranch && branch !== envBranch) {
|
6577
|
-
console.warn(
|
6578
|
-
`Ignoring branch ${envBranch} because branch option was passed to the client constructor with value ${branch}`
|
6579
|
-
);
|
6580
|
-
} else if (!!previewBranch && !!envBranch && previewBranch !== envBranch) {
|
6581
|
-
console.warn(
|
6582
|
-
`Ignoring preview branch ${previewBranch} and branch ${envBranch} because branch option was passed to the client constructor with value ${branch}`
|
6583
|
-
);
|
6584
|
-
} else if (!previewBranch && !envBranch && options?.branch === void 0) {
|
6585
|
-
console.warn(
|
6586
|
-
`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.`
|
6587
|
-
);
|
5286
|
+
if (!branch) {
|
5287
|
+
throw new Error("Option branch is required");
|
6588
5288
|
}
|
6589
5289
|
return {
|
6590
5290
|
fetch,
|
6591
5291
|
databaseURL,
|
6592
5292
|
apiKey,
|
6593
5293
|
branch,
|
6594
|
-
cache,
|
6595
5294
|
trace,
|
6596
5295
|
host,
|
6597
5296
|
clientID: generateUUID(),
|
@@ -6599,7 +5298,7 @@ const buildClient = (plugins) => {
|
|
6599
5298
|
clientName,
|
6600
5299
|
xataAgentExtra
|
6601
5300
|
};
|
6602
|
-
},
|
5301
|
+
}, getFetchProps_fn = function({
|
6603
5302
|
fetch,
|
6604
5303
|
apiKey,
|
6605
5304
|
databaseURL,
|
@@ -6640,26 +5339,19 @@ class Serializer {
|
|
6640
5339
|
}
|
6641
5340
|
toJSON(data) {
|
6642
5341
|
function visit(obj) {
|
6643
|
-
if (Array.isArray(obj))
|
6644
|
-
return obj.map(visit);
|
5342
|
+
if (Array.isArray(obj)) return obj.map(visit);
|
6645
5343
|
const type = typeof obj;
|
6646
|
-
if (type === "undefined")
|
6647
|
-
|
6648
|
-
if (
|
6649
|
-
return { [META]: "bigint", [VALUE]: obj.toString() };
|
6650
|
-
if (obj === null || type !== "object")
|
6651
|
-
return obj;
|
5344
|
+
if (type === "undefined") return { [META]: "undefined" };
|
5345
|
+
if (type === "bigint") return { [META]: "bigint", [VALUE]: obj.toString() };
|
5346
|
+
if (obj === null || type !== "object") return obj;
|
6652
5347
|
const constructor = obj.constructor;
|
6653
5348
|
const o = { [META]: constructor.name };
|
6654
5349
|
for (const [key, value] of Object.entries(obj)) {
|
6655
5350
|
o[key] = visit(value);
|
6656
5351
|
}
|
6657
|
-
if (constructor === Date)
|
6658
|
-
|
6659
|
-
if (constructor ===
|
6660
|
-
o[VALUE] = Object.fromEntries(obj);
|
6661
|
-
if (constructor === Set)
|
6662
|
-
o[VALUE] = [...obj];
|
5352
|
+
if (constructor === Date) o[VALUE] = obj.toISOString();
|
5353
|
+
if (constructor === Map) o[VALUE] = Object.fromEntries(obj);
|
5354
|
+
if (constructor === Set) o[VALUE] = [...obj];
|
6663
5355
|
return o;
|
6664
5356
|
}
|
6665
5357
|
return JSON.stringify(visit(data));
|
@@ -6672,16 +5364,11 @@ class Serializer {
|
|
6672
5364
|
if (constructor) {
|
6673
5365
|
return Object.assign(Object.create(constructor.prototype), rest);
|
6674
5366
|
}
|
6675
|
-
if (clazz === "Date")
|
6676
|
-
|
6677
|
-
if (clazz === "
|
6678
|
-
|
6679
|
-
if (clazz === "
|
6680
|
-
return new Map(Object.entries(val));
|
6681
|
-
if (clazz === "bigint")
|
6682
|
-
return BigInt(val);
|
6683
|
-
if (clazz === "undefined")
|
6684
|
-
return void 0;
|
5367
|
+
if (clazz === "Date") return new Date(val);
|
5368
|
+
if (clazz === "Set") return new Set(val);
|
5369
|
+
if (clazz === "Map") return new Map(Object.entries(val));
|
5370
|
+
if (clazz === "bigint") return BigInt(val);
|
5371
|
+
if (clazz === "undefined") return void 0;
|
6685
5372
|
return rest;
|
6686
5373
|
}
|
6687
5374
|
return value;
|
@@ -6696,6 +5383,47 @@ const deserialize = (json) => {
|
|
6696
5383
|
return defaultSerializer.fromJSON(json);
|
6697
5384
|
};
|
6698
5385
|
|
5386
|
+
function parseEnvironment(environment) {
|
5387
|
+
try {
|
5388
|
+
if (typeof environment === "function") {
|
5389
|
+
return new Proxy(
|
5390
|
+
{},
|
5391
|
+
{
|
5392
|
+
get(target) {
|
5393
|
+
return environment(target);
|
5394
|
+
}
|
5395
|
+
}
|
5396
|
+
);
|
5397
|
+
}
|
5398
|
+
if (isObject(environment)) {
|
5399
|
+
return environment;
|
5400
|
+
}
|
5401
|
+
} catch (error) {
|
5402
|
+
}
|
5403
|
+
return {};
|
5404
|
+
}
|
5405
|
+
function buildPreviewBranchName({ org, branch }) {
|
5406
|
+
return `preview-${org}-${branch}`;
|
5407
|
+
}
|
5408
|
+
function getDeployPreviewBranch(environment) {
|
5409
|
+
try {
|
5410
|
+
const { deployPreview, deployPreviewBranch, vercelGitCommitRef, vercelGitRepoOwner } = parseEnvironment(environment);
|
5411
|
+
if (deployPreviewBranch) return deployPreviewBranch;
|
5412
|
+
switch (deployPreview) {
|
5413
|
+
case "vercel": {
|
5414
|
+
if (!vercelGitCommitRef || !vercelGitRepoOwner) {
|
5415
|
+
console.warn("XATA_PREVIEW=vercel but VERCEL_GIT_COMMIT_REF or VERCEL_GIT_REPO_OWNER is not valid");
|
5416
|
+
return void 0;
|
5417
|
+
}
|
5418
|
+
return buildPreviewBranchName({ org: vercelGitRepoOwner, branch: vercelGitCommitRef });
|
5419
|
+
}
|
5420
|
+
}
|
5421
|
+
return void 0;
|
5422
|
+
} catch (err) {
|
5423
|
+
return void 0;
|
5424
|
+
}
|
5425
|
+
}
|
5426
|
+
|
6699
5427
|
class XataError extends Error {
|
6700
5428
|
constructor(message, status) {
|
6701
5429
|
super(message);
|
@@ -6703,5 +5431,5 @@ class XataError extends Error {
|
|
6703
5431
|
}
|
6704
5432
|
}
|
6705
5433
|
|
6706
|
-
export { BaseClient, Buffer, FetcherError, FilesPlugin, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, PageRecordArray, Query, RecordArray, RecordColumnTypes, Repository, RestRepository, SQLPlugin, SchemaPlugin, SearchPlugin, Serializer,
|
5434
|
+
export { BaseClient, Buffer, FetcherError, FilesPlugin, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, PageRecordArray, Query, RecordArray, RecordColumnTypes, Repository, RestRepository, SQLPlugin, SchemaPlugin, SearchPlugin, Serializer, TransactionPlugin, XataApiClient, XataApiPlugin, XataError, XataFile, XataPlugin, acceptWorkspaceMemberInvite, adaptAllTables, adaptTable, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, applyMigration, askTable, askTableSession, branchTransaction, buildClient, buildPreviewBranchName, buildProviderString, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, completeMigration, contains, copyBranch, createBranch, createBranchAsync, createCluster, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteCluster, deleteColumn, deleteDatabase, deleteDatabaseGithubSettings, deleteFile, deleteFileItem, deleteOAuthAccessToken, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteUserOAuthClient, deleteWorkspace, deserialize, dropClusterExtension, endsWith, equals, executeBranchMigrationPlan, exists, fileAccess, fileUpload, ge, getAuthorizationCode, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationJobStatus, getBranchMigrationPlan, getBranchMoveStatus, getBranchSchemaHistory, getBranchStats, getCluster, getClusterMetrics, getColumn, getDatabaseGithubSettings, getDatabaseList, getDatabaseMetadata, getDatabaseSettings, getDeployPreviewBranch, getFile, getFileItem, getGitBranchesMapping, getHostUrl, getMigrationHistory, getMigrationJobStatus, getMigrationJobs, getMigrationRequest, getMigrationRequestIsMerged, getRecord, getSchema, getSchemas, getTableColumns, getTableSchema, getTaskStatus, getTasks, getUser, getUserAPIKeys, getUserOAuthAccessTokens, getUserOAuthClients, getWorkspace, getWorkspaceMembersList, getWorkspaceSettings, getWorkspacesList, grantAuthorizationCode, greaterEquals, greaterThan, greaterThanEquals, gt, gte, iContains, iPattern, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, installClusterExtension, inviteWorkspaceMember, is, isCursorPaginationOptions, isHostProviderAlias, isHostProviderBuilder, isIdentifiable, isNot, isValidExpandedColumn, isValidSelectableColumns, le, lessEquals, lessThan, lessThanEquals, listClusterBranches, listClusterExtensions, listClusters, listMigrationRequestsCommits, listRegions, lt, lte, mergeMigrationRequest, moveBranch, notExists, operationsByTag, parseProviderString, parseWorkspacesUrlParts, pattern, previewBranchSchemaEdit, pushBranchMigrations, putFile, putFileItem, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, renameDatabase, resendWorkspaceMemberInvite, resolveBranch, rollbackMigration, searchBranch, searchTable, serialize, setTableSchema, sqlBatchQuery, sqlQuery, startMigration, startsWith, summarizeTable, transformImage, updateBranchMetadata, updateBranchSchema, updateCluster, updateColumn, updateDatabaseGithubSettings, updateDatabaseMetadata, updateDatabaseSettings, updateMigrationRequest, updateOAuthAccessToken, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, updateWorkspaceSettings, upsertRecordWithID, vectorSearchTable };
|
6707
5435
|
//# sourceMappingURL=index.mjs.map
|