@xata.io/client 0.0.0-alpha.vf229a69778d4166c9021b4cec87cfce2b38e6bbf → 0.0.0-alpha.vf250ad1109fa0bf434c4b58315deafdacff662ee
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 +3 -3
- package/CHANGELOG.md +18 -2
- package/dist/index.cjs +754 -1834
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1306 -962
- package/dist/index.mjs +738 -1835
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -39,8 +39,7 @@ function getLens(b64) {
|
|
39
39
|
throw new Error("Invalid string. Length must be a multiple of 4");
|
40
40
|
}
|
41
41
|
let validLen = b64.indexOf("=");
|
42
|
-
if (validLen === -1)
|
43
|
-
validLen = len;
|
42
|
+
if (validLen === -1) validLen = len;
|
44
43
|
const placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4;
|
45
44
|
return [validLen, placeHoldersLen];
|
46
45
|
}
|
@@ -375,10 +374,8 @@ class Buffer extends Uint8Array {
|
|
375
374
|
break;
|
376
375
|
}
|
377
376
|
}
|
378
|
-
if (x < y)
|
379
|
-
|
380
|
-
if (y < x)
|
381
|
-
return 1;
|
377
|
+
if (x < y) return -1;
|
378
|
+
if (y < x) return 1;
|
382
379
|
return 0;
|
383
380
|
}
|
384
381
|
/**
|
@@ -391,33 +388,21 @@ class Buffer extends Uint8Array {
|
|
391
388
|
* @param sourceEnd The offset within this buffer at which to end copying (exclusive).
|
392
389
|
*/
|
393
390
|
copy(targetBuffer, targetStart, sourceStart, sourceEnd) {
|
394
|
-
if (!Buffer.isBuffer(targetBuffer))
|
395
|
-
|
396
|
-
if (!
|
397
|
-
|
398
|
-
if (
|
399
|
-
|
400
|
-
if (
|
401
|
-
|
402
|
-
if (
|
403
|
-
targetStart = targetBuffer.length;
|
404
|
-
if (!targetStart)
|
405
|
-
targetStart = 0;
|
406
|
-
if (sourceEnd > 0 && sourceEnd < sourceStart)
|
407
|
-
sourceEnd = sourceStart;
|
408
|
-
if (sourceEnd === sourceStart)
|
409
|
-
return 0;
|
410
|
-
if (targetBuffer.length === 0 || this.length === 0)
|
411
|
-
return 0;
|
391
|
+
if (!Buffer.isBuffer(targetBuffer)) throw new TypeError("argument should be a Buffer");
|
392
|
+
if (!sourceStart) sourceStart = 0;
|
393
|
+
if (!targetStart) targetStart = 0;
|
394
|
+
if (!sourceEnd && sourceEnd !== 0) sourceEnd = this.length;
|
395
|
+
if (targetStart >= targetBuffer.length) targetStart = targetBuffer.length;
|
396
|
+
if (!targetStart) targetStart = 0;
|
397
|
+
if (sourceEnd > 0 && sourceEnd < sourceStart) sourceEnd = sourceStart;
|
398
|
+
if (sourceEnd === sourceStart) return 0;
|
399
|
+
if (targetBuffer.length === 0 || this.length === 0) return 0;
|
412
400
|
if (targetStart < 0) {
|
413
401
|
throw new RangeError("targetStart out of bounds");
|
414
402
|
}
|
415
|
-
if (sourceStart < 0 || sourceStart >= this.length)
|
416
|
-
|
417
|
-
if (sourceEnd
|
418
|
-
throw new RangeError("sourceEnd out of bounds");
|
419
|
-
if (sourceEnd > this.length)
|
420
|
-
sourceEnd = this.length;
|
403
|
+
if (sourceStart < 0 || sourceStart >= this.length) throw new RangeError("Index out of range");
|
404
|
+
if (sourceEnd < 0) throw new RangeError("sourceEnd out of bounds");
|
405
|
+
if (sourceEnd > this.length) sourceEnd = this.length;
|
421
406
|
if (targetBuffer.length - targetStart < sourceEnd - sourceStart) {
|
422
407
|
sourceEnd = targetBuffer.length - targetStart + sourceStart;
|
423
408
|
}
|
@@ -1578,8 +1563,7 @@ class Buffer extends Uint8Array {
|
|
1578
1563
|
let c, hi, lo;
|
1579
1564
|
const byteArray = [];
|
1580
1565
|
for (let i = 0; i < str.length; ++i) {
|
1581
|
-
if ((units -= 2) < 0)
|
1582
|
-
break;
|
1566
|
+
if ((units -= 2) < 0) break;
|
1583
1567
|
c = str.charCodeAt(i);
|
1584
1568
|
hi = c >> 8;
|
1585
1569
|
lo = c % 256;
|
@@ -1733,13 +1717,10 @@ class Buffer extends Uint8Array {
|
|
1733
1717
|
let foundIndex = -1;
|
1734
1718
|
for (i = byteOffset; i < arrLength; i++) {
|
1735
1719
|
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
|
1736
|
-
if (foundIndex === -1)
|
1737
|
-
|
1738
|
-
if (i - foundIndex + 1 === valLength)
|
1739
|
-
return foundIndex * indexSize;
|
1720
|
+
if (foundIndex === -1) foundIndex = i;
|
1721
|
+
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
|
1740
1722
|
} else {
|
1741
|
-
if (foundIndex !== -1)
|
1742
|
-
i -= i - foundIndex;
|
1723
|
+
if (foundIndex !== -1) i -= i - foundIndex;
|
1743
1724
|
foundIndex = -1;
|
1744
1725
|
}
|
1745
1726
|
}
|
@@ -1763,18 +1744,13 @@ class Buffer extends Uint8Array {
|
|
1763
1744
|
return -1;
|
1764
1745
|
}
|
1765
1746
|
static _checkOffset(offset, ext, length) {
|
1766
|
-
if (offset % 1 !== 0 || offset < 0)
|
1767
|
-
|
1768
|
-
if (offset + ext > length)
|
1769
|
-
throw new RangeError("Trying to access beyond buffer length");
|
1747
|
+
if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint");
|
1748
|
+
if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
|
1770
1749
|
}
|
1771
1750
|
static _checkInt(buf, value, offset, ext, max, min) {
|
1772
|
-
if (!Buffer.isBuffer(buf))
|
1773
|
-
|
1774
|
-
if (
|
1775
|
-
throw new RangeError('"value" argument is out of bounds');
|
1776
|
-
if (offset + ext > buf.length)
|
1777
|
-
throw new RangeError("Index out of range");
|
1751
|
+
if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
1752
|
+
if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
|
1753
|
+
if (offset + ext > buf.length) throw new RangeError("Index out of range");
|
1778
1754
|
}
|
1779
1755
|
static _getEncoding(encoding) {
|
1780
1756
|
let toLowerCase = false;
|
@@ -1824,8 +1800,7 @@ const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
|
|
1824
1800
|
function base64clean(str) {
|
1825
1801
|
str = str.split("=")[0];
|
1826
1802
|
str = str.trim().replace(INVALID_BASE64_RE, "");
|
1827
|
-
if (str.length < 2)
|
1828
|
-
return "";
|
1803
|
+
if (str.length < 2) return "";
|
1829
1804
|
while (str.length % 4 !== 0) {
|
1830
1805
|
str = str + "=";
|
1831
1806
|
}
|
@@ -2035,8 +2010,7 @@ function buildPreviewBranchName({ org, branch }) {
|
|
2035
2010
|
function getPreviewBranch() {
|
2036
2011
|
try {
|
2037
2012
|
const { deployPreview, deployPreviewBranch, vercelGitCommitRef, vercelGitRepoOwner } = getEnvironment();
|
2038
|
-
if (deployPreviewBranch)
|
2039
|
-
return deployPreviewBranch;
|
2013
|
+
if (deployPreviewBranch) return deployPreviewBranch;
|
2040
2014
|
switch (deployPreview) {
|
2041
2015
|
case "vercel": {
|
2042
2016
|
if (!vercelGitCommitRef || !vercelGitRepoOwner) {
|
@@ -2052,29 +2026,15 @@ function getPreviewBranch() {
|
|
2052
2026
|
}
|
2053
2027
|
}
|
2054
2028
|
|
2055
|
-
var
|
2056
|
-
|
2057
|
-
throw TypeError("Cannot " + msg);
|
2058
|
-
};
|
2059
|
-
var __privateGet$7 = (obj, member, getter) => {
|
2060
|
-
__accessCheck$8(obj, member, "read from private field");
|
2061
|
-
return getter ? getter.call(obj) : member.get(obj);
|
2062
|
-
};
|
2063
|
-
var __privateAdd$8 = (obj, member, value) => {
|
2064
|
-
if (member.has(obj))
|
2065
|
-
throw TypeError("Cannot add the same private member more than once");
|
2066
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
2067
|
-
};
|
2068
|
-
var __privateSet$6 = (obj, member, value, setter) => {
|
2069
|
-
__accessCheck$8(obj, member, "write to private field");
|
2070
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
2071
|
-
return value;
|
2072
|
-
};
|
2073
|
-
var __privateMethod$4 = (obj, member, method) => {
|
2074
|
-
__accessCheck$8(obj, member, "access private method");
|
2075
|
-
return method;
|
2029
|
+
var __typeError$7 = (msg) => {
|
2030
|
+
throw TypeError(msg);
|
2076
2031
|
};
|
2077
|
-
var
|
2032
|
+
var __accessCheck$7 = (obj, member, msg) => member.has(obj) || __typeError$7("Cannot " + msg);
|
2033
|
+
var __privateGet$6 = (obj, member, getter) => (__accessCheck$7(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
2034
|
+
var __privateAdd$7 = (obj, member, value) => member.has(obj) ? __typeError$7("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
2035
|
+
var __privateSet$5 = (obj, member, value, setter) => (__accessCheck$7(obj, member, "write to private field"), member.set(obj, value), value);
|
2036
|
+
var __privateMethod$4 = (obj, member, method) => (__accessCheck$7(obj, member, "access private method"), method);
|
2037
|
+
var _fetch, _queue, _concurrency, _ApiRequestPool_instances, enqueue_fn;
|
2078
2038
|
const REQUEST_TIMEOUT = 5 * 60 * 1e3;
|
2079
2039
|
function getFetchImplementation(userFetch) {
|
2080
2040
|
const globalFetch = typeof fetch !== "undefined" ? fetch : void 0;
|
@@ -2087,23 +2047,23 @@ function getFetchImplementation(userFetch) {
|
|
2087
2047
|
}
|
2088
2048
|
class ApiRequestPool {
|
2089
2049
|
constructor(concurrency = 10) {
|
2090
|
-
__privateAdd$
|
2091
|
-
__privateAdd$
|
2092
|
-
__privateAdd$
|
2093
|
-
__privateAdd$
|
2094
|
-
__privateSet$
|
2095
|
-
__privateSet$
|
2050
|
+
__privateAdd$7(this, _ApiRequestPool_instances);
|
2051
|
+
__privateAdd$7(this, _fetch);
|
2052
|
+
__privateAdd$7(this, _queue);
|
2053
|
+
__privateAdd$7(this, _concurrency);
|
2054
|
+
__privateSet$5(this, _queue, []);
|
2055
|
+
__privateSet$5(this, _concurrency, concurrency);
|
2096
2056
|
this.running = 0;
|
2097
2057
|
this.started = 0;
|
2098
2058
|
}
|
2099
2059
|
setFetch(fetch2) {
|
2100
|
-
__privateSet$
|
2060
|
+
__privateSet$5(this, _fetch, fetch2);
|
2101
2061
|
}
|
2102
2062
|
getFetch() {
|
2103
|
-
if (!__privateGet$
|
2063
|
+
if (!__privateGet$6(this, _fetch)) {
|
2104
2064
|
throw new Error("Fetch not set");
|
2105
2065
|
}
|
2106
|
-
return __privateGet$
|
2066
|
+
return __privateGet$6(this, _fetch);
|
2107
2067
|
}
|
2108
2068
|
request(url, options) {
|
2109
2069
|
const start = /* @__PURE__ */ new Date();
|
@@ -2125,7 +2085,7 @@ class ApiRequestPool {
|
|
2125
2085
|
}
|
2126
2086
|
return response;
|
2127
2087
|
};
|
2128
|
-
return __privateMethod$4(this,
|
2088
|
+
return __privateMethod$4(this, _ApiRequestPool_instances, enqueue_fn).call(this, async () => {
|
2129
2089
|
return await runRequest();
|
2130
2090
|
});
|
2131
2091
|
}
|
@@ -2133,21 +2093,21 @@ class ApiRequestPool {
|
|
2133
2093
|
_fetch = new WeakMap();
|
2134
2094
|
_queue = new WeakMap();
|
2135
2095
|
_concurrency = new WeakMap();
|
2136
|
-
|
2096
|
+
_ApiRequestPool_instances = new WeakSet();
|
2137
2097
|
enqueue_fn = function(task) {
|
2138
|
-
const promise = new Promise((resolve) => __privateGet$
|
2098
|
+
const promise = new Promise((resolve) => __privateGet$6(this, _queue).push(resolve)).finally(() => {
|
2139
2099
|
this.started--;
|
2140
2100
|
this.running++;
|
2141
2101
|
}).then(() => task()).finally(() => {
|
2142
2102
|
this.running--;
|
2143
|
-
const next = __privateGet$
|
2103
|
+
const next = __privateGet$6(this, _queue).shift();
|
2144
2104
|
if (next !== void 0) {
|
2145
2105
|
this.started++;
|
2146
2106
|
next();
|
2147
2107
|
}
|
2148
2108
|
});
|
2149
|
-
if (this.running + this.started < __privateGet$
|
2150
|
-
const next = __privateGet$
|
2109
|
+
if (this.running + this.started < __privateGet$6(this, _concurrency)) {
|
2110
|
+
const next = __privateGet$6(this, _queue).shift();
|
2151
2111
|
if (next !== void 0) {
|
2152
2112
|
this.started++;
|
2153
2113
|
next();
|
@@ -2200,6 +2160,7 @@ function getLines(onLine) {
|
|
2200
2160
|
fieldLength = position - lineStart;
|
2201
2161
|
}
|
2202
2162
|
break;
|
2163
|
+
// @ts-ignore:7029 \r case below should fallthrough to \n:
|
2203
2164
|
case 13 /* CarriageReturn */:
|
2204
2165
|
discardTrailingNewline = true;
|
2205
2166
|
case 10 /* NewLine */:
|
@@ -2336,7 +2297,7 @@ function defaultOnOpen(response) {
|
|
2336
2297
|
}
|
2337
2298
|
}
|
2338
2299
|
|
2339
|
-
const VERSION = "0.
|
2300
|
+
const VERSION = "0.30.0";
|
2340
2301
|
|
2341
2302
|
class ErrorWithCause extends Error {
|
2342
2303
|
constructor(message, options) {
|
@@ -2416,18 +2377,15 @@ function parseProviderString(provider = "production") {
|
|
2416
2377
|
return provider;
|
2417
2378
|
}
|
2418
2379
|
const [main, workspaces] = provider.split(",");
|
2419
|
-
if (!main || !workspaces)
|
2420
|
-
return null;
|
2380
|
+
if (!main || !workspaces) return null;
|
2421
2381
|
return { main, workspaces };
|
2422
2382
|
}
|
2423
2383
|
function buildProviderString(provider) {
|
2424
|
-
if (isHostProviderAlias(provider))
|
2425
|
-
return provider;
|
2384
|
+
if (isHostProviderAlias(provider)) return provider;
|
2426
2385
|
return `${provider.main},${provider.workspaces}`;
|
2427
2386
|
}
|
2428
2387
|
function parseWorkspacesUrlParts(url) {
|
2429
|
-
if (!isString(url))
|
2430
|
-
return null;
|
2388
|
+
if (!isString(url)) return null;
|
2431
2389
|
const matches = {
|
2432
2390
|
production: url.match(/(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.xata\.sh\/db\/([^:]+):?(.*)?/),
|
2433
2391
|
staging: url.match(/(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.staging-xata\.dev\/db\/([^:]+):?(.*)?/),
|
@@ -2435,22 +2393,20 @@ function parseWorkspacesUrlParts(url) {
|
|
2435
2393
|
local: url.match(/(?:https?:\/\/)?([^.]+)(?:\.([^.]+))\.localhost:(?:\d+)\/db\/([^:]+):?(.*)?/)
|
2436
2394
|
};
|
2437
2395
|
const [host, match] = Object.entries(matches).find(([, match2]) => match2 !== null) ?? [];
|
2438
|
-
if (!isHostProviderAlias(host) || !match)
|
2439
|
-
return null;
|
2396
|
+
if (!isHostProviderAlias(host) || !match) return null;
|
2440
2397
|
return { workspace: match[1], region: match[2], database: match[3], branch: match[4], host };
|
2441
2398
|
}
|
2442
2399
|
|
2443
2400
|
const pool = new ApiRequestPool();
|
2444
2401
|
const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
2445
2402
|
const cleanQueryParams = Object.entries(queryParams).reduce((acc, [key, value]) => {
|
2446
|
-
if (value === void 0 || value === null)
|
2447
|
-
return acc;
|
2403
|
+
if (value === void 0 || value === null) return acc;
|
2448
2404
|
return { ...acc, [key]: value };
|
2449
2405
|
}, {});
|
2450
2406
|
const query = new URLSearchParams(cleanQueryParams).toString();
|
2451
2407
|
const queryString = query.length > 0 ? `?${query}` : "";
|
2452
2408
|
const cleanPathParams = Object.entries(pathParams).reduce((acc, [key, value]) => {
|
2453
|
-
return { ...acc, [key]: encodeURIComponent(String(value ?? "")).replace(
|
2409
|
+
return { ...acc, [key]: encodeURIComponent(String(value ?? "")).replace(/%3A/g, ":") };
|
2454
2410
|
}, {});
|
2455
2411
|
return url.replace(/\{\w*\}/g, (key) => cleanPathParams[key.slice(1, -1)]) + queryString;
|
2456
2412
|
};
|
@@ -2492,8 +2448,7 @@ function hostHeader(url) {
|
|
2492
2448
|
return groups?.host ? { Host: groups.host } : {};
|
2493
2449
|
}
|
2494
2450
|
async function parseBody(body, headers) {
|
2495
|
-
if (!isDefined(body))
|
2496
|
-
return void 0;
|
2451
|
+
if (!isDefined(body)) return void 0;
|
2497
2452
|
if (isBlob(body) || typeof body.text === "function") {
|
2498
2453
|
return body;
|
2499
2454
|
}
|
@@ -2570,8 +2525,7 @@ async function fetch$1({
|
|
2570
2525
|
[TraceAttributes.CLOUDFLARE_RAY_ID]: response.headers?.get("cf-ray") ?? void 0
|
2571
2526
|
});
|
2572
2527
|
const message = response.headers?.get("x-xata-message");
|
2573
|
-
if (message)
|
2574
|
-
console.warn(message);
|
2528
|
+
if (message) console.warn(message);
|
2575
2529
|
if (response.status === 204) {
|
2576
2530
|
return {};
|
2577
2531
|
}
|
@@ -2655,7 +2609,72 @@ function parseUrl(url) {
|
|
2655
2609
|
|
2656
2610
|
const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
|
2657
2611
|
|
2658
|
-
const
|
2612
|
+
const getTasks = (variables, signal) => dataPlaneFetch({
|
2613
|
+
url: "/tasks",
|
2614
|
+
method: "get",
|
2615
|
+
...variables,
|
2616
|
+
signal
|
2617
|
+
});
|
2618
|
+
const getTaskStatus = (variables, signal) => dataPlaneFetch({
|
2619
|
+
url: "/tasks/{taskId}",
|
2620
|
+
method: "get",
|
2621
|
+
...variables,
|
2622
|
+
signal
|
2623
|
+
});
|
2624
|
+
const listClusterBranches = (variables, signal) => dataPlaneFetch({
|
2625
|
+
url: "/cluster/{clusterId}/branches",
|
2626
|
+
method: "get",
|
2627
|
+
...variables,
|
2628
|
+
signal
|
2629
|
+
});
|
2630
|
+
const listClusterExtensions = (variables, signal) => dataPlaneFetch({
|
2631
|
+
url: "/cluster/{clusterId}/extensions",
|
2632
|
+
method: "get",
|
2633
|
+
...variables,
|
2634
|
+
signal
|
2635
|
+
});
|
2636
|
+
const installClusterExtension = (variables, signal) => dataPlaneFetch({
|
2637
|
+
url: "/cluster/{clusterId}/extensions",
|
2638
|
+
method: "post",
|
2639
|
+
...variables,
|
2640
|
+
signal
|
2641
|
+
});
|
2642
|
+
const dropClusterExtension = (variables, signal) => dataPlaneFetch({
|
2643
|
+
url: "/cluster/{clusterId}/extensions",
|
2644
|
+
method: "delete",
|
2645
|
+
...variables,
|
2646
|
+
signal
|
2647
|
+
});
|
2648
|
+
const getClusterMetrics = (variables, signal) => dataPlaneFetch({
|
2649
|
+
url: "/cluster/{clusterId}/metrics",
|
2650
|
+
method: "get",
|
2651
|
+
...variables,
|
2652
|
+
signal
|
2653
|
+
});
|
2654
|
+
const applyMigration = (variables, signal) => dataPlaneFetch({
|
2655
|
+
url: "/db/{dbBranchName}/migrations/apply",
|
2656
|
+
method: "post",
|
2657
|
+
...variables,
|
2658
|
+
signal
|
2659
|
+
});
|
2660
|
+
const startMigration = (variables, signal) => dataPlaneFetch({
|
2661
|
+
url: "/db/{dbBranchName}/migrations/start",
|
2662
|
+
method: "post",
|
2663
|
+
...variables,
|
2664
|
+
signal
|
2665
|
+
});
|
2666
|
+
const completeMigration = (variables, signal) => dataPlaneFetch({
|
2667
|
+
url: "/db/{dbBranchName}/migrations/complete",
|
2668
|
+
method: "post",
|
2669
|
+
...variables,
|
2670
|
+
signal
|
2671
|
+
});
|
2672
|
+
const rollbackMigration = (variables, signal) => dataPlaneFetch({
|
2673
|
+
url: "/db/{dbBranchName}/migrations/rollback",
|
2674
|
+
method: "post",
|
2675
|
+
...variables,
|
2676
|
+
signal
|
2677
|
+
});
|
2659
2678
|
const adaptTable = (variables, signal) => dataPlaneFetch({
|
2660
2679
|
url: "/db/{dbBranchName}/migrations/adapt/{tableName}",
|
2661
2680
|
method: "post",
|
@@ -2668,9 +2687,30 @@ const adaptAllTables = (variables, signal) => dataPlaneFetch({
|
|
2668
2687
|
...variables,
|
2669
2688
|
signal
|
2670
2689
|
});
|
2671
|
-
const getBranchMigrationJobStatus = (variables, signal) => dataPlaneFetch({
|
2672
|
-
|
2673
|
-
|
2690
|
+
const getBranchMigrationJobStatus = (variables, signal) => dataPlaneFetch({
|
2691
|
+
url: "/db/{dbBranchName}/migrations/status",
|
2692
|
+
method: "get",
|
2693
|
+
...variables,
|
2694
|
+
signal
|
2695
|
+
});
|
2696
|
+
const getMigrationJobs = (variables, signal) => dataPlaneFetch({
|
2697
|
+
url: "/db/{dbBranchName}/migrations/jobs",
|
2698
|
+
method: "get",
|
2699
|
+
...variables,
|
2700
|
+
signal
|
2701
|
+
});
|
2702
|
+
const getMigrationJobStatus = (variables, signal) => dataPlaneFetch({
|
2703
|
+
url: "/db/{dbBranchName}/migrations/jobs/{jobId}",
|
2704
|
+
method: "get",
|
2705
|
+
...variables,
|
2706
|
+
signal
|
2707
|
+
});
|
2708
|
+
const getMigrationHistory = (variables, signal) => dataPlaneFetch({
|
2709
|
+
url: "/db/{dbBranchName}/migrations/history",
|
2710
|
+
method: "get",
|
2711
|
+
...variables,
|
2712
|
+
signal
|
2713
|
+
});
|
2674
2714
|
const getBranchList = (variables, signal) => dataPlaneFetch({
|
2675
2715
|
url: "/dbs/{dbName}",
|
2676
2716
|
method: "get",
|
@@ -2684,6 +2724,7 @@ const getDatabaseSettings = (variables, signal) => dataPlaneFetch({
|
|
2684
2724
|
signal
|
2685
2725
|
});
|
2686
2726
|
const updateDatabaseSettings = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/settings", method: "patch", ...variables, signal });
|
2727
|
+
const createBranchAsync = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/async", method: "put", ...variables, signal });
|
2687
2728
|
const getBranchDetails = (variables, signal) => dataPlaneFetch({
|
2688
2729
|
url: "/db/{dbBranchName}",
|
2689
2730
|
method: "get",
|
@@ -2703,12 +2744,25 @@ const getSchema = (variables, signal) => dataPlaneFetch({
|
|
2703
2744
|
...variables,
|
2704
2745
|
signal
|
2705
2746
|
});
|
2747
|
+
const getSchemas = (variables, signal) => dataPlaneFetch({
|
2748
|
+
url: "/db/{dbBranchName}/schemas",
|
2749
|
+
method: "get",
|
2750
|
+
...variables,
|
2751
|
+
signal
|
2752
|
+
});
|
2706
2753
|
const copyBranch = (variables, signal) => dataPlaneFetch({
|
2707
2754
|
url: "/db/{dbBranchName}/copy",
|
2708
2755
|
method: "post",
|
2709
2756
|
...variables,
|
2710
2757
|
signal
|
2711
2758
|
});
|
2759
|
+
const getBranchMoveStatus = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/move", method: "get", ...variables, signal });
|
2760
|
+
const moveBranch = (variables, signal) => dataPlaneFetch({
|
2761
|
+
url: "/db/{dbBranchName}/move",
|
2762
|
+
method: "put",
|
2763
|
+
...variables,
|
2764
|
+
signal
|
2765
|
+
});
|
2712
2766
|
const updateBranchMetadata = (variables, signal) => dataPlaneFetch({
|
2713
2767
|
url: "/db/{dbBranchName}/metadata",
|
2714
2768
|
method: "put",
|
@@ -2729,12 +2783,42 @@ const getBranchStats = (variables, signal) => dataPlaneFetch({
|
|
2729
2783
|
});
|
2730
2784
|
const getGitBranchesMapping = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables, signal });
|
2731
2785
|
const addGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables, signal });
|
2732
|
-
const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({
|
2733
|
-
|
2734
|
-
|
2735
|
-
|
2736
|
-
|
2737
|
-
|
2786
|
+
const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({
|
2787
|
+
url: "/dbs/{dbName}/gitBranches",
|
2788
|
+
method: "delete",
|
2789
|
+
...variables,
|
2790
|
+
signal
|
2791
|
+
});
|
2792
|
+
const resolveBranch = (variables, signal) => dataPlaneFetch({
|
2793
|
+
url: "/dbs/{dbName}/resolveBranch",
|
2794
|
+
method: "get",
|
2795
|
+
...variables,
|
2796
|
+
signal
|
2797
|
+
});
|
2798
|
+
const getBranchMigrationHistory = (variables, signal) => dataPlaneFetch({
|
2799
|
+
url: "/db/{dbBranchName}/migrations",
|
2800
|
+
method: "get",
|
2801
|
+
...variables,
|
2802
|
+
signal
|
2803
|
+
});
|
2804
|
+
const getBranchMigrationPlan = (variables, signal) => dataPlaneFetch({
|
2805
|
+
url: "/db/{dbBranchName}/migrations/plan",
|
2806
|
+
method: "post",
|
2807
|
+
...variables,
|
2808
|
+
signal
|
2809
|
+
});
|
2810
|
+
const executeBranchMigrationPlan = (variables, signal) => dataPlaneFetch({
|
2811
|
+
url: "/db/{dbBranchName}/migrations/execute",
|
2812
|
+
method: "post",
|
2813
|
+
...variables,
|
2814
|
+
signal
|
2815
|
+
});
|
2816
|
+
const queryMigrationRequests = (variables, signal) => dataPlaneFetch({
|
2817
|
+
url: "/dbs/{dbName}/migrations/query",
|
2818
|
+
method: "post",
|
2819
|
+
...variables,
|
2820
|
+
signal
|
2821
|
+
});
|
2738
2822
|
const createMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
2739
2823
|
const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2740
2824
|
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
@@ -2742,23 +2826,78 @@ const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
|
2742
2826
|
...variables,
|
2743
2827
|
signal
|
2744
2828
|
});
|
2745
|
-
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2746
|
-
|
2747
|
-
|
2748
|
-
|
2829
|
+
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2830
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
2831
|
+
method: "patch",
|
2832
|
+
...variables,
|
2833
|
+
signal
|
2834
|
+
});
|
2835
|
+
const listMigrationRequestsCommits = (variables, signal) => dataPlaneFetch({
|
2836
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/commits",
|
2837
|
+
method: "post",
|
2838
|
+
...variables,
|
2839
|
+
signal
|
2840
|
+
});
|
2841
|
+
const compareMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2842
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/compare",
|
2843
|
+
method: "post",
|
2844
|
+
...variables,
|
2845
|
+
signal
|
2846
|
+
});
|
2847
|
+
const getMigrationRequestIsMerged = (variables, signal) => dataPlaneFetch({
|
2848
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
2849
|
+
method: "get",
|
2850
|
+
...variables,
|
2851
|
+
signal
|
2852
|
+
});
|
2749
2853
|
const mergeMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2750
2854
|
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
2751
2855
|
method: "post",
|
2752
2856
|
...variables,
|
2753
2857
|
signal
|
2754
2858
|
});
|
2755
|
-
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({
|
2756
|
-
|
2757
|
-
|
2758
|
-
|
2759
|
-
|
2760
|
-
|
2761
|
-
const
|
2859
|
+
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({
|
2860
|
+
url: "/db/{dbBranchName}/schema/history",
|
2861
|
+
method: "post",
|
2862
|
+
...variables,
|
2863
|
+
signal
|
2864
|
+
});
|
2865
|
+
const compareBranchWithUserSchema = (variables, signal) => dataPlaneFetch({
|
2866
|
+
url: "/db/{dbBranchName}/schema/compare",
|
2867
|
+
method: "post",
|
2868
|
+
...variables,
|
2869
|
+
signal
|
2870
|
+
});
|
2871
|
+
const compareBranchSchemas = (variables, signal) => dataPlaneFetch({
|
2872
|
+
url: "/db/{dbBranchName}/schema/compare/{branchName}",
|
2873
|
+
method: "post",
|
2874
|
+
...variables,
|
2875
|
+
signal
|
2876
|
+
});
|
2877
|
+
const updateBranchSchema = (variables, signal) => dataPlaneFetch({
|
2878
|
+
url: "/db/{dbBranchName}/schema/update",
|
2879
|
+
method: "post",
|
2880
|
+
...variables,
|
2881
|
+
signal
|
2882
|
+
});
|
2883
|
+
const previewBranchSchemaEdit = (variables, signal) => dataPlaneFetch({
|
2884
|
+
url: "/db/{dbBranchName}/schema/preview",
|
2885
|
+
method: "post",
|
2886
|
+
...variables,
|
2887
|
+
signal
|
2888
|
+
});
|
2889
|
+
const applyBranchSchemaEdit = (variables, signal) => dataPlaneFetch({
|
2890
|
+
url: "/db/{dbBranchName}/schema/apply",
|
2891
|
+
method: "post",
|
2892
|
+
...variables,
|
2893
|
+
signal
|
2894
|
+
});
|
2895
|
+
const pushBranchMigrations = (variables, signal) => dataPlaneFetch({
|
2896
|
+
url: "/db/{dbBranchName}/schema/push",
|
2897
|
+
method: "post",
|
2898
|
+
...variables,
|
2899
|
+
signal
|
2900
|
+
});
|
2762
2901
|
const createTable = (variables, signal) => dataPlaneFetch({
|
2763
2902
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
2764
2903
|
method: "put",
|
@@ -2771,14 +2910,24 @@ const deleteTable = (variables, signal) => dataPlaneFetch({
|
|
2771
2910
|
...variables,
|
2772
2911
|
signal
|
2773
2912
|
});
|
2774
|
-
const updateTable = (variables, signal) => dataPlaneFetch({
|
2913
|
+
const updateTable = (variables, signal) => dataPlaneFetch({
|
2914
|
+
url: "/db/{dbBranchName}/tables/{tableName}",
|
2915
|
+
method: "patch",
|
2916
|
+
...variables,
|
2917
|
+
signal
|
2918
|
+
});
|
2775
2919
|
const getTableSchema = (variables, signal) => dataPlaneFetch({
|
2776
2920
|
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
2777
2921
|
method: "get",
|
2778
2922
|
...variables,
|
2779
2923
|
signal
|
2780
2924
|
});
|
2781
|
-
const setTableSchema = (variables, signal) => dataPlaneFetch({
|
2925
|
+
const setTableSchema = (variables, signal) => dataPlaneFetch({
|
2926
|
+
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
2927
|
+
method: "put",
|
2928
|
+
...variables,
|
2929
|
+
signal
|
2930
|
+
});
|
2782
2931
|
const getTableColumns = (variables, signal) => dataPlaneFetch({
|
2783
2932
|
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
2784
2933
|
method: "get",
|
@@ -2786,7 +2935,12 @@ const getTableColumns = (variables, signal) => dataPlaneFetch({
|
|
2786
2935
|
signal
|
2787
2936
|
});
|
2788
2937
|
const addTableColumn = (variables, signal) => dataPlaneFetch(
|
2789
|
-
{
|
2938
|
+
{
|
2939
|
+
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
2940
|
+
method: "post",
|
2941
|
+
...variables,
|
2942
|
+
signal
|
2943
|
+
}
|
2790
2944
|
);
|
2791
2945
|
const getColumn = (variables, signal) => dataPlaneFetch({
|
2792
2946
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
@@ -2794,15 +2948,30 @@ const getColumn = (variables, signal) => dataPlaneFetch({
|
|
2794
2948
|
...variables,
|
2795
2949
|
signal
|
2796
2950
|
});
|
2797
|
-
const updateColumn = (variables, signal) => dataPlaneFetch({
|
2951
|
+
const updateColumn = (variables, signal) => dataPlaneFetch({
|
2952
|
+
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
2953
|
+
method: "patch",
|
2954
|
+
...variables,
|
2955
|
+
signal
|
2956
|
+
});
|
2798
2957
|
const deleteColumn = (variables, signal) => dataPlaneFetch({
|
2799
2958
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
2800
2959
|
method: "delete",
|
2801
2960
|
...variables,
|
2802
2961
|
signal
|
2803
2962
|
});
|
2804
|
-
const branchTransaction = (variables, signal) => dataPlaneFetch({
|
2805
|
-
|
2963
|
+
const branchTransaction = (variables, signal) => dataPlaneFetch({
|
2964
|
+
url: "/db/{dbBranchName}/transaction",
|
2965
|
+
method: "post",
|
2966
|
+
...variables,
|
2967
|
+
signal
|
2968
|
+
});
|
2969
|
+
const insertRecord = (variables, signal) => dataPlaneFetch({
|
2970
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data",
|
2971
|
+
method: "post",
|
2972
|
+
...variables,
|
2973
|
+
signal
|
2974
|
+
});
|
2806
2975
|
const getFileItem = (variables, signal) => dataPlaneFetch({
|
2807
2976
|
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file/{fileId}",
|
2808
2977
|
method: "get",
|
@@ -2845,11 +3014,36 @@ const getRecord = (variables, signal) => dataPlaneFetch({
|
|
2845
3014
|
...variables,
|
2846
3015
|
signal
|
2847
3016
|
});
|
2848
|
-
const insertRecordWithID = (variables, signal) => dataPlaneFetch({
|
2849
|
-
|
2850
|
-
|
2851
|
-
|
2852
|
-
|
3017
|
+
const insertRecordWithID = (variables, signal) => dataPlaneFetch({
|
3018
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
3019
|
+
method: "put",
|
3020
|
+
...variables,
|
3021
|
+
signal
|
3022
|
+
});
|
3023
|
+
const updateRecordWithID = (variables, signal) => dataPlaneFetch({
|
3024
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
3025
|
+
method: "patch",
|
3026
|
+
...variables,
|
3027
|
+
signal
|
3028
|
+
});
|
3029
|
+
const upsertRecordWithID = (variables, signal) => dataPlaneFetch({
|
3030
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
3031
|
+
method: "post",
|
3032
|
+
...variables,
|
3033
|
+
signal
|
3034
|
+
});
|
3035
|
+
const deleteRecord = (variables, signal) => dataPlaneFetch({
|
3036
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
3037
|
+
method: "delete",
|
3038
|
+
...variables,
|
3039
|
+
signal
|
3040
|
+
});
|
3041
|
+
const bulkInsertTableRecords = (variables, signal) => dataPlaneFetch({
|
3042
|
+
url: "/db/{dbBranchName}/tables/{tableName}/bulk",
|
3043
|
+
method: "post",
|
3044
|
+
...variables,
|
3045
|
+
signal
|
3046
|
+
});
|
2853
3047
|
const queryTable = (variables, signal) => dataPlaneFetch({
|
2854
3048
|
url: "/db/{dbBranchName}/tables/{tableName}/query",
|
2855
3049
|
method: "post",
|
@@ -2868,16 +3062,36 @@ const searchTable = (variables, signal) => dataPlaneFetch({
|
|
2868
3062
|
...variables,
|
2869
3063
|
signal
|
2870
3064
|
});
|
2871
|
-
const vectorSearchTable = (variables, signal) => dataPlaneFetch({
|
3065
|
+
const vectorSearchTable = (variables, signal) => dataPlaneFetch({
|
3066
|
+
url: "/db/{dbBranchName}/tables/{tableName}/vectorSearch",
|
3067
|
+
method: "post",
|
3068
|
+
...variables,
|
3069
|
+
signal
|
3070
|
+
});
|
2872
3071
|
const askTable = (variables, signal) => dataPlaneFetch({
|
2873
3072
|
url: "/db/{dbBranchName}/tables/{tableName}/ask",
|
2874
3073
|
method: "post",
|
2875
3074
|
...variables,
|
2876
3075
|
signal
|
2877
3076
|
});
|
2878
|
-
const askTableSession = (variables, signal) => dataPlaneFetch({
|
2879
|
-
|
2880
|
-
|
3077
|
+
const askTableSession = (variables, signal) => dataPlaneFetch({
|
3078
|
+
url: "/db/{dbBranchName}/tables/{tableName}/ask/{sessionId}",
|
3079
|
+
method: "post",
|
3080
|
+
...variables,
|
3081
|
+
signal
|
3082
|
+
});
|
3083
|
+
const summarizeTable = (variables, signal) => dataPlaneFetch({
|
3084
|
+
url: "/db/{dbBranchName}/tables/{tableName}/summarize",
|
3085
|
+
method: "post",
|
3086
|
+
...variables,
|
3087
|
+
signal
|
3088
|
+
});
|
3089
|
+
const aggregateTable = (variables, signal) => dataPlaneFetch({
|
3090
|
+
url: "/db/{dbBranchName}/tables/{tableName}/aggregate",
|
3091
|
+
method: "post",
|
3092
|
+
...variables,
|
3093
|
+
signal
|
3094
|
+
});
|
2881
3095
|
const fileAccess = (variables, signal) => dataPlaneFetch({
|
2882
3096
|
url: "/file/{fileId}",
|
2883
3097
|
method: "get",
|
@@ -2896,15 +3110,34 @@ const sqlQuery = (variables, signal) => dataPlaneFetch({
|
|
2896
3110
|
...variables,
|
2897
3111
|
signal
|
2898
3112
|
});
|
3113
|
+
const sqlBatchQuery = (variables, signal) => dataPlaneFetch({
|
3114
|
+
url: "/db/{dbBranchName}/sql/batch",
|
3115
|
+
method: "post",
|
3116
|
+
...variables,
|
3117
|
+
signal
|
3118
|
+
});
|
2899
3119
|
const operationsByTag$2 = {
|
3120
|
+
tasks: { getTasks, getTaskStatus },
|
3121
|
+
cluster: {
|
3122
|
+
listClusterBranches,
|
3123
|
+
listClusterExtensions,
|
3124
|
+
installClusterExtension,
|
3125
|
+
dropClusterExtension,
|
3126
|
+
getClusterMetrics
|
3127
|
+
},
|
2900
3128
|
migrations: {
|
2901
3129
|
applyMigration,
|
3130
|
+
startMigration,
|
3131
|
+
completeMigration,
|
3132
|
+
rollbackMigration,
|
2902
3133
|
adaptTable,
|
2903
3134
|
adaptAllTables,
|
2904
3135
|
getBranchMigrationJobStatus,
|
3136
|
+
getMigrationJobs,
|
2905
3137
|
getMigrationJobStatus,
|
2906
3138
|
getMigrationHistory,
|
2907
3139
|
getSchema,
|
3140
|
+
getSchemas,
|
2908
3141
|
getBranchMigrationHistory,
|
2909
3142
|
getBranchMigrationPlan,
|
2910
3143
|
executeBranchMigrationPlan,
|
@@ -2918,10 +3151,13 @@ const operationsByTag$2 = {
|
|
2918
3151
|
},
|
2919
3152
|
branch: {
|
2920
3153
|
getBranchList,
|
3154
|
+
createBranchAsync,
|
2921
3155
|
getBranchDetails,
|
2922
3156
|
createBranch,
|
2923
3157
|
deleteBranch,
|
2924
3158
|
copyBranch,
|
3159
|
+
getBranchMoveStatus,
|
3160
|
+
moveBranch,
|
2925
3161
|
updateBranchMetadata,
|
2926
3162
|
getBranchMetadata,
|
2927
3163
|
getBranchStats,
|
@@ -2963,7 +3199,16 @@ const operationsByTag$2 = {
|
|
2963
3199
|
deleteRecord,
|
2964
3200
|
bulkInsertTableRecords
|
2965
3201
|
},
|
2966
|
-
files: {
|
3202
|
+
files: {
|
3203
|
+
getFileItem,
|
3204
|
+
putFileItem,
|
3205
|
+
deleteFileItem,
|
3206
|
+
getFile,
|
3207
|
+
putFile,
|
3208
|
+
deleteFile,
|
3209
|
+
fileAccess,
|
3210
|
+
fileUpload
|
3211
|
+
},
|
2967
3212
|
searchAndFilter: {
|
2968
3213
|
queryTable,
|
2969
3214
|
searchBranch,
|
@@ -2974,7 +3219,7 @@ const operationsByTag$2 = {
|
|
2974
3219
|
summarizeTable,
|
2975
3220
|
aggregateTable
|
2976
3221
|
},
|
2977
|
-
sql: { sqlQuery }
|
3222
|
+
sql: { sqlQuery, sqlBatchQuery }
|
2978
3223
|
};
|
2979
3224
|
|
2980
3225
|
const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
|
@@ -3041,7 +3286,12 @@ const deleteOAuthAccessToken = (variables, signal) => controlPlaneFetch({
|
|
3041
3286
|
...variables,
|
3042
3287
|
signal
|
3043
3288
|
});
|
3044
|
-
const updateOAuthAccessToken = (variables, signal) => controlPlaneFetch({
|
3289
|
+
const updateOAuthAccessToken = (variables, signal) => controlPlaneFetch({
|
3290
|
+
url: "/user/oauth/tokens/{token}",
|
3291
|
+
method: "patch",
|
3292
|
+
...variables,
|
3293
|
+
signal
|
3294
|
+
});
|
3045
3295
|
const getWorkspacesList = (variables, signal) => controlPlaneFetch({
|
3046
3296
|
url: "/workspaces",
|
3047
3297
|
method: "get",
|
@@ -3072,51 +3322,152 @@ const deleteWorkspace = (variables, signal) => controlPlaneFetch({
|
|
3072
3322
|
...variables,
|
3073
3323
|
signal
|
3074
3324
|
});
|
3075
|
-
const getWorkspaceSettings = (variables, signal) => controlPlaneFetch({
|
3076
|
-
|
3077
|
-
|
3078
|
-
|
3325
|
+
const getWorkspaceSettings = (variables, signal) => controlPlaneFetch({
|
3326
|
+
url: "/workspaces/{workspaceId}/settings",
|
3327
|
+
method: "get",
|
3328
|
+
...variables,
|
3329
|
+
signal
|
3330
|
+
});
|
3331
|
+
const updateWorkspaceSettings = (variables, signal) => controlPlaneFetch({
|
3332
|
+
url: "/workspaces/{workspaceId}/settings",
|
3333
|
+
method: "patch",
|
3334
|
+
...variables,
|
3335
|
+
signal
|
3336
|
+
});
|
3337
|
+
const getWorkspaceMembersList = (variables, signal) => controlPlaneFetch({
|
3338
|
+
url: "/workspaces/{workspaceId}/members",
|
3339
|
+
method: "get",
|
3340
|
+
...variables,
|
3341
|
+
signal
|
3342
|
+
});
|
3343
|
+
const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({
|
3344
|
+
url: "/workspaces/{workspaceId}/members/{userId}",
|
3345
|
+
method: "put",
|
3346
|
+
...variables,
|
3347
|
+
signal
|
3348
|
+
});
|
3079
3349
|
const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
3080
3350
|
url: "/workspaces/{workspaceId}/members/{userId}",
|
3081
3351
|
method: "delete",
|
3082
3352
|
...variables,
|
3083
3353
|
signal
|
3084
3354
|
});
|
3085
|
-
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
3086
|
-
|
3087
|
-
|
3088
|
-
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
|
3089
|
-
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
|
3090
|
-
const listClusters = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters", method: "get", ...variables, signal });
|
3091
|
-
const createCluster = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters", method: "post", ...variables, signal });
|
3092
|
-
const getCluster = (variables, signal) => controlPlaneFetch({
|
3093
|
-
url: "/workspaces/{workspaceId}/clusters/{clusterId}",
|
3094
|
-
method: "get",
|
3355
|
+
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
3356
|
+
url: "/workspaces/{workspaceId}/invites",
|
3357
|
+
method: "post",
|
3095
3358
|
...variables,
|
3096
3359
|
signal
|
3097
3360
|
});
|
3098
|
-
const
|
3099
|
-
|
3100
|
-
|
3101
|
-
method: "get",
|
3361
|
+
const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3362
|
+
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
3363
|
+
method: "patch",
|
3102
3364
|
...variables,
|
3103
3365
|
signal
|
3104
3366
|
});
|
3105
|
-
const
|
3106
|
-
|
3107
|
-
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3367
|
+
const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3368
|
+
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
3108
3369
|
method: "delete",
|
3109
3370
|
...variables,
|
3110
3371
|
signal
|
3111
3372
|
});
|
3112
|
-
const
|
3113
|
-
|
3114
|
-
|
3115
|
-
|
3116
|
-
|
3117
|
-
|
3118
|
-
const
|
3119
|
-
url: "/workspaces/{workspaceId}/
|
3373
|
+
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3374
|
+
url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept",
|
3375
|
+
method: "post",
|
3376
|
+
...variables,
|
3377
|
+
signal
|
3378
|
+
});
|
3379
|
+
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3380
|
+
url: "/workspaces/{workspaceId}/invites/{inviteId}/resend",
|
3381
|
+
method: "post",
|
3382
|
+
...variables,
|
3383
|
+
signal
|
3384
|
+
});
|
3385
|
+
const listClusters = (variables, signal) => controlPlaneFetch({
|
3386
|
+
url: "/workspaces/{workspaceId}/clusters",
|
3387
|
+
method: "get",
|
3388
|
+
...variables,
|
3389
|
+
signal
|
3390
|
+
});
|
3391
|
+
const createCluster = (variables, signal) => controlPlaneFetch({
|
3392
|
+
url: "/workspaces/{workspaceId}/clusters",
|
3393
|
+
method: "post",
|
3394
|
+
...variables,
|
3395
|
+
signal
|
3396
|
+
});
|
3397
|
+
const getCluster = (variables, signal) => controlPlaneFetch({
|
3398
|
+
url: "/workspaces/{workspaceId}/clusters/{clusterId}",
|
3399
|
+
method: "get",
|
3400
|
+
...variables,
|
3401
|
+
signal
|
3402
|
+
});
|
3403
|
+
const updateCluster = (variables, signal) => controlPlaneFetch({
|
3404
|
+
url: "/workspaces/{workspaceId}/clusters/{clusterId}",
|
3405
|
+
method: "patch",
|
3406
|
+
...variables,
|
3407
|
+
signal
|
3408
|
+
});
|
3409
|
+
const deleteCluster = (variables, signal) => controlPlaneFetch({
|
3410
|
+
url: "/workspaces/{workspaceId}/clusters/{clusterId}",
|
3411
|
+
method: "delete",
|
3412
|
+
...variables,
|
3413
|
+
signal
|
3414
|
+
});
|
3415
|
+
const getDatabaseList = (variables, signal) => controlPlaneFetch({
|
3416
|
+
url: "/workspaces/{workspaceId}/dbs",
|
3417
|
+
method: "get",
|
3418
|
+
...variables,
|
3419
|
+
signal
|
3420
|
+
});
|
3421
|
+
const createDatabase = (variables, signal) => controlPlaneFetch({
|
3422
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3423
|
+
method: "put",
|
3424
|
+
...variables,
|
3425
|
+
signal
|
3426
|
+
});
|
3427
|
+
const deleteDatabase = (variables, signal) => controlPlaneFetch({
|
3428
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3429
|
+
method: "delete",
|
3430
|
+
...variables,
|
3431
|
+
signal
|
3432
|
+
});
|
3433
|
+
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({
|
3434
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3435
|
+
method: "get",
|
3436
|
+
...variables,
|
3437
|
+
signal
|
3438
|
+
});
|
3439
|
+
const updateDatabaseMetadata = (variables, signal) => controlPlaneFetch({
|
3440
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3441
|
+
method: "patch",
|
3442
|
+
...variables,
|
3443
|
+
signal
|
3444
|
+
});
|
3445
|
+
const renameDatabase = (variables, signal) => controlPlaneFetch({
|
3446
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/rename",
|
3447
|
+
method: "post",
|
3448
|
+
...variables,
|
3449
|
+
signal
|
3450
|
+
});
|
3451
|
+
const getDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({
|
3452
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/github",
|
3453
|
+
method: "get",
|
3454
|
+
...variables,
|
3455
|
+
signal
|
3456
|
+
});
|
3457
|
+
const updateDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({
|
3458
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/github",
|
3459
|
+
method: "put",
|
3460
|
+
...variables,
|
3461
|
+
signal
|
3462
|
+
});
|
3463
|
+
const deleteDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({
|
3464
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/github",
|
3465
|
+
method: "delete",
|
3466
|
+
...variables,
|
3467
|
+
signal
|
3468
|
+
});
|
3469
|
+
const listRegions = (variables, signal) => controlPlaneFetch({
|
3470
|
+
url: "/workspaces/{workspaceId}/regions",
|
3120
3471
|
method: "get",
|
3121
3472
|
...variables,
|
3122
3473
|
signal
|
@@ -3152,7 +3503,13 @@ const operationsByTag$1 = {
|
|
3152
3503
|
acceptWorkspaceMemberInvite,
|
3153
3504
|
resendWorkspaceMemberInvite
|
3154
3505
|
},
|
3155
|
-
xbcontrolOther: {
|
3506
|
+
xbcontrolOther: {
|
3507
|
+
listClusters,
|
3508
|
+
createCluster,
|
3509
|
+
getCluster,
|
3510
|
+
updateCluster,
|
3511
|
+
deleteCluster
|
3512
|
+
},
|
3156
3513
|
databases: {
|
3157
3514
|
getDatabaseList,
|
3158
3515
|
createDatabase,
|
@@ -3169,29 +3526,8 @@ const operationsByTag$1 = {
|
|
3169
3526
|
|
3170
3527
|
const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
|
3171
3528
|
|
3172
|
-
|
3173
|
-
if (!member.has(obj))
|
3174
|
-
throw TypeError("Cannot " + msg);
|
3175
|
-
};
|
3176
|
-
var __privateGet$6 = (obj, member, getter) => {
|
3177
|
-
__accessCheck$7(obj, member, "read from private field");
|
3178
|
-
return getter ? getter.call(obj) : member.get(obj);
|
3179
|
-
};
|
3180
|
-
var __privateAdd$7 = (obj, member, value) => {
|
3181
|
-
if (member.has(obj))
|
3182
|
-
throw TypeError("Cannot add the same private member more than once");
|
3183
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
3184
|
-
};
|
3185
|
-
var __privateSet$5 = (obj, member, value, setter) => {
|
3186
|
-
__accessCheck$7(obj, member, "write to private field");
|
3187
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
3188
|
-
return value;
|
3189
|
-
};
|
3190
|
-
var _extraProps, _namespaces;
|
3191
|
-
class XataApiClient {
|
3529
|
+
const buildApiClient = () => class {
|
3192
3530
|
constructor(options = {}) {
|
3193
|
-
__privateAdd$7(this, _extraProps, void 0);
|
3194
|
-
__privateAdd$7(this, _namespaces, {});
|
3195
3531
|
const provider = options.host ?? "production";
|
3196
3532
|
const apiKey = options.apiKey ?? getAPIKey();
|
3197
3533
|
const trace = options.trace ?? defaultTrace;
|
@@ -3199,7 +3535,7 @@ class XataApiClient {
|
|
3199
3535
|
if (!apiKey) {
|
3200
3536
|
throw new Error("Could not resolve a valid apiKey");
|
3201
3537
|
}
|
3202
|
-
|
3538
|
+
const extraProps = {
|
3203
3539
|
apiUrl: getHostUrl(provider, "main"),
|
3204
3540
|
workspacesApiUrl: getHostUrl(provider, "workspaces"),
|
3205
3541
|
fetch: getFetchImplementation(options.fetch),
|
@@ -3208,1315 +3544,31 @@ class XataApiClient {
|
|
3208
3544
|
clientName: options.clientName,
|
3209
3545
|
xataAgentExtra: options.xataAgentExtra,
|
3210
3546
|
clientID
|
3547
|
+
};
|
3548
|
+
return new Proxy(this, {
|
3549
|
+
get: (_target, namespace) => {
|
3550
|
+
if (operationsByTag[namespace] === void 0) {
|
3551
|
+
return void 0;
|
3552
|
+
}
|
3553
|
+
return new Proxy(
|
3554
|
+
{},
|
3555
|
+
{
|
3556
|
+
get: (_target2, operation) => {
|
3557
|
+
if (operationsByTag[namespace][operation] === void 0) {
|
3558
|
+
return void 0;
|
3559
|
+
}
|
3560
|
+
const method = operationsByTag[namespace][operation];
|
3561
|
+
return async (params) => {
|
3562
|
+
return await method({ ...params, ...extraProps });
|
3563
|
+
};
|
3564
|
+
}
|
3565
|
+
}
|
3566
|
+
);
|
3567
|
+
}
|
3211
3568
|
});
|
3212
3569
|
}
|
3213
|
-
|
3214
|
-
|
3215
|
-
__privateGet$6(this, _namespaces).user = new UserApi(__privateGet$6(this, _extraProps));
|
3216
|
-
return __privateGet$6(this, _namespaces).user;
|
3217
|
-
}
|
3218
|
-
get authentication() {
|
3219
|
-
if (!__privateGet$6(this, _namespaces).authentication)
|
3220
|
-
__privateGet$6(this, _namespaces).authentication = new AuthenticationApi(__privateGet$6(this, _extraProps));
|
3221
|
-
return __privateGet$6(this, _namespaces).authentication;
|
3222
|
-
}
|
3223
|
-
get workspaces() {
|
3224
|
-
if (!__privateGet$6(this, _namespaces).workspaces)
|
3225
|
-
__privateGet$6(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$6(this, _extraProps));
|
3226
|
-
return __privateGet$6(this, _namespaces).workspaces;
|
3227
|
-
}
|
3228
|
-
get invites() {
|
3229
|
-
if (!__privateGet$6(this, _namespaces).invites)
|
3230
|
-
__privateGet$6(this, _namespaces).invites = new InvitesApi(__privateGet$6(this, _extraProps));
|
3231
|
-
return __privateGet$6(this, _namespaces).invites;
|
3232
|
-
}
|
3233
|
-
get database() {
|
3234
|
-
if (!__privateGet$6(this, _namespaces).database)
|
3235
|
-
__privateGet$6(this, _namespaces).database = new DatabaseApi(__privateGet$6(this, _extraProps));
|
3236
|
-
return __privateGet$6(this, _namespaces).database;
|
3237
|
-
}
|
3238
|
-
get branches() {
|
3239
|
-
if (!__privateGet$6(this, _namespaces).branches)
|
3240
|
-
__privateGet$6(this, _namespaces).branches = new BranchApi(__privateGet$6(this, _extraProps));
|
3241
|
-
return __privateGet$6(this, _namespaces).branches;
|
3242
|
-
}
|
3243
|
-
get migrations() {
|
3244
|
-
if (!__privateGet$6(this, _namespaces).migrations)
|
3245
|
-
__privateGet$6(this, _namespaces).migrations = new MigrationsApi(__privateGet$6(this, _extraProps));
|
3246
|
-
return __privateGet$6(this, _namespaces).migrations;
|
3247
|
-
}
|
3248
|
-
get migrationRequests() {
|
3249
|
-
if (!__privateGet$6(this, _namespaces).migrationRequests)
|
3250
|
-
__privateGet$6(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$6(this, _extraProps));
|
3251
|
-
return __privateGet$6(this, _namespaces).migrationRequests;
|
3252
|
-
}
|
3253
|
-
get tables() {
|
3254
|
-
if (!__privateGet$6(this, _namespaces).tables)
|
3255
|
-
__privateGet$6(this, _namespaces).tables = new TableApi(__privateGet$6(this, _extraProps));
|
3256
|
-
return __privateGet$6(this, _namespaces).tables;
|
3257
|
-
}
|
3258
|
-
get records() {
|
3259
|
-
if (!__privateGet$6(this, _namespaces).records)
|
3260
|
-
__privateGet$6(this, _namespaces).records = new RecordsApi(__privateGet$6(this, _extraProps));
|
3261
|
-
return __privateGet$6(this, _namespaces).records;
|
3262
|
-
}
|
3263
|
-
get files() {
|
3264
|
-
if (!__privateGet$6(this, _namespaces).files)
|
3265
|
-
__privateGet$6(this, _namespaces).files = new FilesApi(__privateGet$6(this, _extraProps));
|
3266
|
-
return __privateGet$6(this, _namespaces).files;
|
3267
|
-
}
|
3268
|
-
get searchAndFilter() {
|
3269
|
-
if (!__privateGet$6(this, _namespaces).searchAndFilter)
|
3270
|
-
__privateGet$6(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$6(this, _extraProps));
|
3271
|
-
return __privateGet$6(this, _namespaces).searchAndFilter;
|
3272
|
-
}
|
3273
|
-
}
|
3274
|
-
_extraProps = new WeakMap();
|
3275
|
-
_namespaces = new WeakMap();
|
3276
|
-
class UserApi {
|
3277
|
-
constructor(extraProps) {
|
3278
|
-
this.extraProps = extraProps;
|
3279
|
-
}
|
3280
|
-
getUser() {
|
3281
|
-
return operationsByTag.users.getUser({ ...this.extraProps });
|
3282
|
-
}
|
3283
|
-
updateUser({ user }) {
|
3284
|
-
return operationsByTag.users.updateUser({ body: user, ...this.extraProps });
|
3285
|
-
}
|
3286
|
-
deleteUser() {
|
3287
|
-
return operationsByTag.users.deleteUser({ ...this.extraProps });
|
3288
|
-
}
|
3289
|
-
}
|
3290
|
-
class AuthenticationApi {
|
3291
|
-
constructor(extraProps) {
|
3292
|
-
this.extraProps = extraProps;
|
3293
|
-
}
|
3294
|
-
getUserAPIKeys() {
|
3295
|
-
return operationsByTag.authentication.getUserAPIKeys({ ...this.extraProps });
|
3296
|
-
}
|
3297
|
-
createUserAPIKey({ name }) {
|
3298
|
-
return operationsByTag.authentication.createUserAPIKey({
|
3299
|
-
pathParams: { keyName: name },
|
3300
|
-
...this.extraProps
|
3301
|
-
});
|
3302
|
-
}
|
3303
|
-
deleteUserAPIKey({ name }) {
|
3304
|
-
return operationsByTag.authentication.deleteUserAPIKey({
|
3305
|
-
pathParams: { keyName: name },
|
3306
|
-
...this.extraProps
|
3307
|
-
});
|
3308
|
-
}
|
3309
|
-
}
|
3310
|
-
class WorkspaceApi {
|
3311
|
-
constructor(extraProps) {
|
3312
|
-
this.extraProps = extraProps;
|
3313
|
-
}
|
3314
|
-
getWorkspacesList() {
|
3315
|
-
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
3316
|
-
}
|
3317
|
-
createWorkspace({ data }) {
|
3318
|
-
return operationsByTag.workspaces.createWorkspace({
|
3319
|
-
body: data,
|
3320
|
-
...this.extraProps
|
3321
|
-
});
|
3322
|
-
}
|
3323
|
-
getWorkspace({ workspace }) {
|
3324
|
-
return operationsByTag.workspaces.getWorkspace({
|
3325
|
-
pathParams: { workspaceId: workspace },
|
3326
|
-
...this.extraProps
|
3327
|
-
});
|
3328
|
-
}
|
3329
|
-
updateWorkspace({
|
3330
|
-
workspace,
|
3331
|
-
update
|
3332
|
-
}) {
|
3333
|
-
return operationsByTag.workspaces.updateWorkspace({
|
3334
|
-
pathParams: { workspaceId: workspace },
|
3335
|
-
body: update,
|
3336
|
-
...this.extraProps
|
3337
|
-
});
|
3338
|
-
}
|
3339
|
-
deleteWorkspace({ workspace }) {
|
3340
|
-
return operationsByTag.workspaces.deleteWorkspace({
|
3341
|
-
pathParams: { workspaceId: workspace },
|
3342
|
-
...this.extraProps
|
3343
|
-
});
|
3344
|
-
}
|
3345
|
-
getWorkspaceMembersList({ workspace }) {
|
3346
|
-
return operationsByTag.workspaces.getWorkspaceMembersList({
|
3347
|
-
pathParams: { workspaceId: workspace },
|
3348
|
-
...this.extraProps
|
3349
|
-
});
|
3350
|
-
}
|
3351
|
-
updateWorkspaceMemberRole({
|
3352
|
-
workspace,
|
3353
|
-
user,
|
3354
|
-
role
|
3355
|
-
}) {
|
3356
|
-
return operationsByTag.workspaces.updateWorkspaceMemberRole({
|
3357
|
-
pathParams: { workspaceId: workspace, userId: user },
|
3358
|
-
body: { role },
|
3359
|
-
...this.extraProps
|
3360
|
-
});
|
3361
|
-
}
|
3362
|
-
removeWorkspaceMember({
|
3363
|
-
workspace,
|
3364
|
-
user
|
3365
|
-
}) {
|
3366
|
-
return operationsByTag.workspaces.removeWorkspaceMember({
|
3367
|
-
pathParams: { workspaceId: workspace, userId: user },
|
3368
|
-
...this.extraProps
|
3369
|
-
});
|
3370
|
-
}
|
3371
|
-
}
|
3372
|
-
class InvitesApi {
|
3373
|
-
constructor(extraProps) {
|
3374
|
-
this.extraProps = extraProps;
|
3375
|
-
}
|
3376
|
-
inviteWorkspaceMember({
|
3377
|
-
workspace,
|
3378
|
-
email,
|
3379
|
-
role
|
3380
|
-
}) {
|
3381
|
-
return operationsByTag.invites.inviteWorkspaceMember({
|
3382
|
-
pathParams: { workspaceId: workspace },
|
3383
|
-
body: { email, role },
|
3384
|
-
...this.extraProps
|
3385
|
-
});
|
3386
|
-
}
|
3387
|
-
updateWorkspaceMemberInvite({
|
3388
|
-
workspace,
|
3389
|
-
invite,
|
3390
|
-
role
|
3391
|
-
}) {
|
3392
|
-
return operationsByTag.invites.updateWorkspaceMemberInvite({
|
3393
|
-
pathParams: { workspaceId: workspace, inviteId: invite },
|
3394
|
-
body: { role },
|
3395
|
-
...this.extraProps
|
3396
|
-
});
|
3397
|
-
}
|
3398
|
-
cancelWorkspaceMemberInvite({
|
3399
|
-
workspace,
|
3400
|
-
invite
|
3401
|
-
}) {
|
3402
|
-
return operationsByTag.invites.cancelWorkspaceMemberInvite({
|
3403
|
-
pathParams: { workspaceId: workspace, inviteId: invite },
|
3404
|
-
...this.extraProps
|
3405
|
-
});
|
3406
|
-
}
|
3407
|
-
acceptWorkspaceMemberInvite({
|
3408
|
-
workspace,
|
3409
|
-
key
|
3410
|
-
}) {
|
3411
|
-
return operationsByTag.invites.acceptWorkspaceMemberInvite({
|
3412
|
-
pathParams: { workspaceId: workspace, inviteKey: key },
|
3413
|
-
...this.extraProps
|
3414
|
-
});
|
3415
|
-
}
|
3416
|
-
resendWorkspaceMemberInvite({
|
3417
|
-
workspace,
|
3418
|
-
invite
|
3419
|
-
}) {
|
3420
|
-
return operationsByTag.invites.resendWorkspaceMemberInvite({
|
3421
|
-
pathParams: { workspaceId: workspace, inviteId: invite },
|
3422
|
-
...this.extraProps
|
3423
|
-
});
|
3424
|
-
}
|
3425
|
-
}
|
3426
|
-
class BranchApi {
|
3427
|
-
constructor(extraProps) {
|
3428
|
-
this.extraProps = extraProps;
|
3429
|
-
}
|
3430
|
-
getBranchList({
|
3431
|
-
workspace,
|
3432
|
-
region,
|
3433
|
-
database
|
3434
|
-
}) {
|
3435
|
-
return operationsByTag.branch.getBranchList({
|
3436
|
-
pathParams: { workspace, region, dbName: database },
|
3437
|
-
...this.extraProps
|
3438
|
-
});
|
3439
|
-
}
|
3440
|
-
getBranchDetails({
|
3441
|
-
workspace,
|
3442
|
-
region,
|
3443
|
-
database,
|
3444
|
-
branch
|
3445
|
-
}) {
|
3446
|
-
return operationsByTag.branch.getBranchDetails({
|
3447
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
3448
|
-
...this.extraProps
|
3449
|
-
});
|
3450
|
-
}
|
3451
|
-
createBranch({
|
3452
|
-
workspace,
|
3453
|
-
region,
|
3454
|
-
database,
|
3455
|
-
branch,
|
3456
|
-
from,
|
3457
|
-
metadata
|
3458
|
-
}) {
|
3459
|
-
return operationsByTag.branch.createBranch({
|
3460
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
3461
|
-
body: { from, metadata },
|
3462
|
-
...this.extraProps
|
3463
|
-
});
|
3464
|
-
}
|
3465
|
-
deleteBranch({
|
3466
|
-
workspace,
|
3467
|
-
region,
|
3468
|
-
database,
|
3469
|
-
branch
|
3470
|
-
}) {
|
3471
|
-
return operationsByTag.branch.deleteBranch({
|
3472
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
3473
|
-
...this.extraProps
|
3474
|
-
});
|
3475
|
-
}
|
3476
|
-
copyBranch({
|
3477
|
-
workspace,
|
3478
|
-
region,
|
3479
|
-
database,
|
3480
|
-
branch,
|
3481
|
-
destinationBranch,
|
3482
|
-
limit
|
3483
|
-
}) {
|
3484
|
-
return operationsByTag.branch.copyBranch({
|
3485
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
3486
|
-
body: { destinationBranch, limit },
|
3487
|
-
...this.extraProps
|
3488
|
-
});
|
3489
|
-
}
|
3490
|
-
updateBranchMetadata({
|
3491
|
-
workspace,
|
3492
|
-
region,
|
3493
|
-
database,
|
3494
|
-
branch,
|
3495
|
-
metadata
|
3496
|
-
}) {
|
3497
|
-
return operationsByTag.branch.updateBranchMetadata({
|
3498
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
3499
|
-
body: metadata,
|
3500
|
-
...this.extraProps
|
3501
|
-
});
|
3502
|
-
}
|
3503
|
-
getBranchMetadata({
|
3504
|
-
workspace,
|
3505
|
-
region,
|
3506
|
-
database,
|
3507
|
-
branch
|
3508
|
-
}) {
|
3509
|
-
return operationsByTag.branch.getBranchMetadata({
|
3510
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
3511
|
-
...this.extraProps
|
3512
|
-
});
|
3513
|
-
}
|
3514
|
-
getBranchStats({
|
3515
|
-
workspace,
|
3516
|
-
region,
|
3517
|
-
database,
|
3518
|
-
branch
|
3519
|
-
}) {
|
3520
|
-
return operationsByTag.branch.getBranchStats({
|
3521
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
3522
|
-
...this.extraProps
|
3523
|
-
});
|
3524
|
-
}
|
3525
|
-
getGitBranchesMapping({
|
3526
|
-
workspace,
|
3527
|
-
region,
|
3528
|
-
database
|
3529
|
-
}) {
|
3530
|
-
return operationsByTag.branch.getGitBranchesMapping({
|
3531
|
-
pathParams: { workspace, region, dbName: database },
|
3532
|
-
...this.extraProps
|
3533
|
-
});
|
3534
|
-
}
|
3535
|
-
addGitBranchesEntry({
|
3536
|
-
workspace,
|
3537
|
-
region,
|
3538
|
-
database,
|
3539
|
-
gitBranch,
|
3540
|
-
xataBranch
|
3541
|
-
}) {
|
3542
|
-
return operationsByTag.branch.addGitBranchesEntry({
|
3543
|
-
pathParams: { workspace, region, dbName: database },
|
3544
|
-
body: { gitBranch, xataBranch },
|
3545
|
-
...this.extraProps
|
3546
|
-
});
|
3547
|
-
}
|
3548
|
-
removeGitBranchesEntry({
|
3549
|
-
workspace,
|
3550
|
-
region,
|
3551
|
-
database,
|
3552
|
-
gitBranch
|
3553
|
-
}) {
|
3554
|
-
return operationsByTag.branch.removeGitBranchesEntry({
|
3555
|
-
pathParams: { workspace, region, dbName: database },
|
3556
|
-
queryParams: { gitBranch },
|
3557
|
-
...this.extraProps
|
3558
|
-
});
|
3559
|
-
}
|
3560
|
-
resolveBranch({
|
3561
|
-
workspace,
|
3562
|
-
region,
|
3563
|
-
database,
|
3564
|
-
gitBranch,
|
3565
|
-
fallbackBranch
|
3566
|
-
}) {
|
3567
|
-
return operationsByTag.branch.resolveBranch({
|
3568
|
-
pathParams: { workspace, region, dbName: database },
|
3569
|
-
queryParams: { gitBranch, fallbackBranch },
|
3570
|
-
...this.extraProps
|
3571
|
-
});
|
3572
|
-
}
|
3573
|
-
pgRollMigrationHistory({
|
3574
|
-
workspace,
|
3575
|
-
region,
|
3576
|
-
database,
|
3577
|
-
branch
|
3578
|
-
}) {
|
3579
|
-
return operationsByTag.migrations.getMigrationHistory({
|
3580
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
3581
|
-
...this.extraProps
|
3582
|
-
});
|
3583
|
-
}
|
3584
|
-
applyMigration({
|
3585
|
-
workspace,
|
3586
|
-
region,
|
3587
|
-
database,
|
3588
|
-
branch,
|
3589
|
-
migration
|
3590
|
-
}) {
|
3591
|
-
return operationsByTag.migrations.applyMigration({
|
3592
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
3593
|
-
body: migration,
|
3594
|
-
...this.extraProps
|
3595
|
-
});
|
3596
|
-
}
|
3597
|
-
}
|
3598
|
-
class TableApi {
|
3599
|
-
constructor(extraProps) {
|
3600
|
-
this.extraProps = extraProps;
|
3601
|
-
}
|
3602
|
-
createTable({
|
3603
|
-
workspace,
|
3604
|
-
region,
|
3605
|
-
database,
|
3606
|
-
branch,
|
3607
|
-
table
|
3608
|
-
}) {
|
3609
|
-
return operationsByTag.table.createTable({
|
3610
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
3611
|
-
...this.extraProps
|
3612
|
-
});
|
3613
|
-
}
|
3614
|
-
deleteTable({
|
3615
|
-
workspace,
|
3616
|
-
region,
|
3617
|
-
database,
|
3618
|
-
branch,
|
3619
|
-
table
|
3620
|
-
}) {
|
3621
|
-
return operationsByTag.table.deleteTable({
|
3622
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
3623
|
-
...this.extraProps
|
3624
|
-
});
|
3625
|
-
}
|
3626
|
-
updateTable({
|
3627
|
-
workspace,
|
3628
|
-
region,
|
3629
|
-
database,
|
3630
|
-
branch,
|
3631
|
-
table,
|
3632
|
-
update
|
3633
|
-
}) {
|
3634
|
-
return operationsByTag.table.updateTable({
|
3635
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
3636
|
-
body: update,
|
3637
|
-
...this.extraProps
|
3638
|
-
});
|
3639
|
-
}
|
3640
|
-
getTableSchema({
|
3641
|
-
workspace,
|
3642
|
-
region,
|
3643
|
-
database,
|
3644
|
-
branch,
|
3645
|
-
table
|
3646
|
-
}) {
|
3647
|
-
return operationsByTag.table.getTableSchema({
|
3648
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
3649
|
-
...this.extraProps
|
3650
|
-
});
|
3651
|
-
}
|
3652
|
-
setTableSchema({
|
3653
|
-
workspace,
|
3654
|
-
region,
|
3655
|
-
database,
|
3656
|
-
branch,
|
3657
|
-
table,
|
3658
|
-
schema
|
3659
|
-
}) {
|
3660
|
-
return operationsByTag.table.setTableSchema({
|
3661
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
3662
|
-
body: schema,
|
3663
|
-
...this.extraProps
|
3664
|
-
});
|
3665
|
-
}
|
3666
|
-
getTableColumns({
|
3667
|
-
workspace,
|
3668
|
-
region,
|
3669
|
-
database,
|
3670
|
-
branch,
|
3671
|
-
table
|
3672
|
-
}) {
|
3673
|
-
return operationsByTag.table.getTableColumns({
|
3674
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
3675
|
-
...this.extraProps
|
3676
|
-
});
|
3677
|
-
}
|
3678
|
-
addTableColumn({
|
3679
|
-
workspace,
|
3680
|
-
region,
|
3681
|
-
database,
|
3682
|
-
branch,
|
3683
|
-
table,
|
3684
|
-
column
|
3685
|
-
}) {
|
3686
|
-
return operationsByTag.table.addTableColumn({
|
3687
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
3688
|
-
body: column,
|
3689
|
-
...this.extraProps
|
3690
|
-
});
|
3691
|
-
}
|
3692
|
-
getColumn({
|
3693
|
-
workspace,
|
3694
|
-
region,
|
3695
|
-
database,
|
3696
|
-
branch,
|
3697
|
-
table,
|
3698
|
-
column
|
3699
|
-
}) {
|
3700
|
-
return operationsByTag.table.getColumn({
|
3701
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
3702
|
-
...this.extraProps
|
3703
|
-
});
|
3704
|
-
}
|
3705
|
-
updateColumn({
|
3706
|
-
workspace,
|
3707
|
-
region,
|
3708
|
-
database,
|
3709
|
-
branch,
|
3710
|
-
table,
|
3711
|
-
column,
|
3712
|
-
update
|
3713
|
-
}) {
|
3714
|
-
return operationsByTag.table.updateColumn({
|
3715
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
3716
|
-
body: update,
|
3717
|
-
...this.extraProps
|
3718
|
-
});
|
3719
|
-
}
|
3720
|
-
deleteColumn({
|
3721
|
-
workspace,
|
3722
|
-
region,
|
3723
|
-
database,
|
3724
|
-
branch,
|
3725
|
-
table,
|
3726
|
-
column
|
3727
|
-
}) {
|
3728
|
-
return operationsByTag.table.deleteColumn({
|
3729
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
3730
|
-
...this.extraProps
|
3731
|
-
});
|
3732
|
-
}
|
3733
|
-
}
|
3734
|
-
class RecordsApi {
|
3735
|
-
constructor(extraProps) {
|
3736
|
-
this.extraProps = extraProps;
|
3737
|
-
}
|
3738
|
-
insertRecord({
|
3739
|
-
workspace,
|
3740
|
-
region,
|
3741
|
-
database,
|
3742
|
-
branch,
|
3743
|
-
table,
|
3744
|
-
record,
|
3745
|
-
columns
|
3746
|
-
}) {
|
3747
|
-
return operationsByTag.records.insertRecord({
|
3748
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
3749
|
-
queryParams: { columns },
|
3750
|
-
body: record,
|
3751
|
-
...this.extraProps
|
3752
|
-
});
|
3753
|
-
}
|
3754
|
-
getRecord({
|
3755
|
-
workspace,
|
3756
|
-
region,
|
3757
|
-
database,
|
3758
|
-
branch,
|
3759
|
-
table,
|
3760
|
-
id,
|
3761
|
-
columns
|
3762
|
-
}) {
|
3763
|
-
return operationsByTag.records.getRecord({
|
3764
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
3765
|
-
queryParams: { columns },
|
3766
|
-
...this.extraProps
|
3767
|
-
});
|
3768
|
-
}
|
3769
|
-
insertRecordWithID({
|
3770
|
-
workspace,
|
3771
|
-
region,
|
3772
|
-
database,
|
3773
|
-
branch,
|
3774
|
-
table,
|
3775
|
-
id,
|
3776
|
-
record,
|
3777
|
-
columns,
|
3778
|
-
createOnly,
|
3779
|
-
ifVersion
|
3780
|
-
}) {
|
3781
|
-
return operationsByTag.records.insertRecordWithID({
|
3782
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
3783
|
-
queryParams: { columns, createOnly, ifVersion },
|
3784
|
-
body: record,
|
3785
|
-
...this.extraProps
|
3786
|
-
});
|
3787
|
-
}
|
3788
|
-
updateRecordWithID({
|
3789
|
-
workspace,
|
3790
|
-
region,
|
3791
|
-
database,
|
3792
|
-
branch,
|
3793
|
-
table,
|
3794
|
-
id,
|
3795
|
-
record,
|
3796
|
-
columns,
|
3797
|
-
ifVersion
|
3798
|
-
}) {
|
3799
|
-
return operationsByTag.records.updateRecordWithID({
|
3800
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
3801
|
-
queryParams: { columns, ifVersion },
|
3802
|
-
body: record,
|
3803
|
-
...this.extraProps
|
3804
|
-
});
|
3805
|
-
}
|
3806
|
-
upsertRecordWithID({
|
3807
|
-
workspace,
|
3808
|
-
region,
|
3809
|
-
database,
|
3810
|
-
branch,
|
3811
|
-
table,
|
3812
|
-
id,
|
3813
|
-
record,
|
3814
|
-
columns,
|
3815
|
-
ifVersion
|
3816
|
-
}) {
|
3817
|
-
return operationsByTag.records.upsertRecordWithID({
|
3818
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
3819
|
-
queryParams: { columns, ifVersion },
|
3820
|
-
body: record,
|
3821
|
-
...this.extraProps
|
3822
|
-
});
|
3823
|
-
}
|
3824
|
-
deleteRecord({
|
3825
|
-
workspace,
|
3826
|
-
region,
|
3827
|
-
database,
|
3828
|
-
branch,
|
3829
|
-
table,
|
3830
|
-
id,
|
3831
|
-
columns
|
3832
|
-
}) {
|
3833
|
-
return operationsByTag.records.deleteRecord({
|
3834
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
3835
|
-
queryParams: { columns },
|
3836
|
-
...this.extraProps
|
3837
|
-
});
|
3838
|
-
}
|
3839
|
-
bulkInsertTableRecords({
|
3840
|
-
workspace,
|
3841
|
-
region,
|
3842
|
-
database,
|
3843
|
-
branch,
|
3844
|
-
table,
|
3845
|
-
records,
|
3846
|
-
columns
|
3847
|
-
}) {
|
3848
|
-
return operationsByTag.records.bulkInsertTableRecords({
|
3849
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
3850
|
-
queryParams: { columns },
|
3851
|
-
body: { records },
|
3852
|
-
...this.extraProps
|
3853
|
-
});
|
3854
|
-
}
|
3855
|
-
branchTransaction({
|
3856
|
-
workspace,
|
3857
|
-
region,
|
3858
|
-
database,
|
3859
|
-
branch,
|
3860
|
-
operations
|
3861
|
-
}) {
|
3862
|
-
return operationsByTag.records.branchTransaction({
|
3863
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
3864
|
-
body: { operations },
|
3865
|
-
...this.extraProps
|
3866
|
-
});
|
3867
|
-
}
|
3868
|
-
}
|
3869
|
-
class FilesApi {
|
3870
|
-
constructor(extraProps) {
|
3871
|
-
this.extraProps = extraProps;
|
3872
|
-
}
|
3873
|
-
getFileItem({
|
3874
|
-
workspace,
|
3875
|
-
region,
|
3876
|
-
database,
|
3877
|
-
branch,
|
3878
|
-
table,
|
3879
|
-
record,
|
3880
|
-
column,
|
3881
|
-
fileId
|
3882
|
-
}) {
|
3883
|
-
return operationsByTag.files.getFileItem({
|
3884
|
-
pathParams: {
|
3885
|
-
workspace,
|
3886
|
-
region,
|
3887
|
-
dbBranchName: `${database}:${branch}`,
|
3888
|
-
tableName: table,
|
3889
|
-
recordId: record,
|
3890
|
-
columnName: column,
|
3891
|
-
fileId
|
3892
|
-
},
|
3893
|
-
...this.extraProps
|
3894
|
-
});
|
3895
|
-
}
|
3896
|
-
putFileItem({
|
3897
|
-
workspace,
|
3898
|
-
region,
|
3899
|
-
database,
|
3900
|
-
branch,
|
3901
|
-
table,
|
3902
|
-
record,
|
3903
|
-
column,
|
3904
|
-
fileId,
|
3905
|
-
file
|
3906
|
-
}) {
|
3907
|
-
return operationsByTag.files.putFileItem({
|
3908
|
-
pathParams: {
|
3909
|
-
workspace,
|
3910
|
-
region,
|
3911
|
-
dbBranchName: `${database}:${branch}`,
|
3912
|
-
tableName: table,
|
3913
|
-
recordId: record,
|
3914
|
-
columnName: column,
|
3915
|
-
fileId
|
3916
|
-
},
|
3917
|
-
// @ts-ignore
|
3918
|
-
body: file,
|
3919
|
-
...this.extraProps
|
3920
|
-
});
|
3921
|
-
}
|
3922
|
-
deleteFileItem({
|
3923
|
-
workspace,
|
3924
|
-
region,
|
3925
|
-
database,
|
3926
|
-
branch,
|
3927
|
-
table,
|
3928
|
-
record,
|
3929
|
-
column,
|
3930
|
-
fileId
|
3931
|
-
}) {
|
3932
|
-
return operationsByTag.files.deleteFileItem({
|
3933
|
-
pathParams: {
|
3934
|
-
workspace,
|
3935
|
-
region,
|
3936
|
-
dbBranchName: `${database}:${branch}`,
|
3937
|
-
tableName: table,
|
3938
|
-
recordId: record,
|
3939
|
-
columnName: column,
|
3940
|
-
fileId
|
3941
|
-
},
|
3942
|
-
...this.extraProps
|
3943
|
-
});
|
3944
|
-
}
|
3945
|
-
getFile({
|
3946
|
-
workspace,
|
3947
|
-
region,
|
3948
|
-
database,
|
3949
|
-
branch,
|
3950
|
-
table,
|
3951
|
-
record,
|
3952
|
-
column
|
3953
|
-
}) {
|
3954
|
-
return operationsByTag.files.getFile({
|
3955
|
-
pathParams: {
|
3956
|
-
workspace,
|
3957
|
-
region,
|
3958
|
-
dbBranchName: `${database}:${branch}`,
|
3959
|
-
tableName: table,
|
3960
|
-
recordId: record,
|
3961
|
-
columnName: column
|
3962
|
-
},
|
3963
|
-
...this.extraProps
|
3964
|
-
});
|
3965
|
-
}
|
3966
|
-
putFile({
|
3967
|
-
workspace,
|
3968
|
-
region,
|
3969
|
-
database,
|
3970
|
-
branch,
|
3971
|
-
table,
|
3972
|
-
record,
|
3973
|
-
column,
|
3974
|
-
file
|
3975
|
-
}) {
|
3976
|
-
return operationsByTag.files.putFile({
|
3977
|
-
pathParams: {
|
3978
|
-
workspace,
|
3979
|
-
region,
|
3980
|
-
dbBranchName: `${database}:${branch}`,
|
3981
|
-
tableName: table,
|
3982
|
-
recordId: record,
|
3983
|
-
columnName: column
|
3984
|
-
},
|
3985
|
-
body: file,
|
3986
|
-
...this.extraProps
|
3987
|
-
});
|
3988
|
-
}
|
3989
|
-
deleteFile({
|
3990
|
-
workspace,
|
3991
|
-
region,
|
3992
|
-
database,
|
3993
|
-
branch,
|
3994
|
-
table,
|
3995
|
-
record,
|
3996
|
-
column
|
3997
|
-
}) {
|
3998
|
-
return operationsByTag.files.deleteFile({
|
3999
|
-
pathParams: {
|
4000
|
-
workspace,
|
4001
|
-
region,
|
4002
|
-
dbBranchName: `${database}:${branch}`,
|
4003
|
-
tableName: table,
|
4004
|
-
recordId: record,
|
4005
|
-
columnName: column
|
4006
|
-
},
|
4007
|
-
...this.extraProps
|
4008
|
-
});
|
4009
|
-
}
|
4010
|
-
fileAccess({
|
4011
|
-
workspace,
|
4012
|
-
region,
|
4013
|
-
fileId,
|
4014
|
-
verify
|
4015
|
-
}) {
|
4016
|
-
return operationsByTag.files.fileAccess({
|
4017
|
-
pathParams: {
|
4018
|
-
workspace,
|
4019
|
-
region,
|
4020
|
-
fileId
|
4021
|
-
},
|
4022
|
-
queryParams: { verify },
|
4023
|
-
...this.extraProps
|
4024
|
-
});
|
4025
|
-
}
|
4026
|
-
}
|
4027
|
-
class SearchAndFilterApi {
|
4028
|
-
constructor(extraProps) {
|
4029
|
-
this.extraProps = extraProps;
|
4030
|
-
}
|
4031
|
-
queryTable({
|
4032
|
-
workspace,
|
4033
|
-
region,
|
4034
|
-
database,
|
4035
|
-
branch,
|
4036
|
-
table,
|
4037
|
-
filter,
|
4038
|
-
sort,
|
4039
|
-
page,
|
4040
|
-
columns,
|
4041
|
-
consistency
|
4042
|
-
}) {
|
4043
|
-
return operationsByTag.searchAndFilter.queryTable({
|
4044
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
4045
|
-
body: { filter, sort, page, columns, consistency },
|
4046
|
-
...this.extraProps
|
4047
|
-
});
|
4048
|
-
}
|
4049
|
-
searchTable({
|
4050
|
-
workspace,
|
4051
|
-
region,
|
4052
|
-
database,
|
4053
|
-
branch,
|
4054
|
-
table,
|
4055
|
-
query,
|
4056
|
-
fuzziness,
|
4057
|
-
target,
|
4058
|
-
prefix,
|
4059
|
-
filter,
|
4060
|
-
highlight,
|
4061
|
-
boosters
|
4062
|
-
}) {
|
4063
|
-
return operationsByTag.searchAndFilter.searchTable({
|
4064
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
4065
|
-
body: { query, fuzziness, target, prefix, filter, highlight, boosters },
|
4066
|
-
...this.extraProps
|
4067
|
-
});
|
4068
|
-
}
|
4069
|
-
searchBranch({
|
4070
|
-
workspace,
|
4071
|
-
region,
|
4072
|
-
database,
|
4073
|
-
branch,
|
4074
|
-
tables,
|
4075
|
-
query,
|
4076
|
-
fuzziness,
|
4077
|
-
prefix,
|
4078
|
-
highlight
|
4079
|
-
}) {
|
4080
|
-
return operationsByTag.searchAndFilter.searchBranch({
|
4081
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
4082
|
-
body: { tables, query, fuzziness, prefix, highlight },
|
4083
|
-
...this.extraProps
|
4084
|
-
});
|
4085
|
-
}
|
4086
|
-
vectorSearchTable({
|
4087
|
-
workspace,
|
4088
|
-
region,
|
4089
|
-
database,
|
4090
|
-
branch,
|
4091
|
-
table,
|
4092
|
-
queryVector,
|
4093
|
-
column,
|
4094
|
-
similarityFunction,
|
4095
|
-
size,
|
4096
|
-
filter
|
4097
|
-
}) {
|
4098
|
-
return operationsByTag.searchAndFilter.vectorSearchTable({
|
4099
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
4100
|
-
body: { queryVector, column, similarityFunction, size, filter },
|
4101
|
-
...this.extraProps
|
4102
|
-
});
|
4103
|
-
}
|
4104
|
-
askTable({
|
4105
|
-
workspace,
|
4106
|
-
region,
|
4107
|
-
database,
|
4108
|
-
branch,
|
4109
|
-
table,
|
4110
|
-
options
|
4111
|
-
}) {
|
4112
|
-
return operationsByTag.searchAndFilter.askTable({
|
4113
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
4114
|
-
body: { ...options },
|
4115
|
-
...this.extraProps
|
4116
|
-
});
|
4117
|
-
}
|
4118
|
-
askTableSession({
|
4119
|
-
workspace,
|
4120
|
-
region,
|
4121
|
-
database,
|
4122
|
-
branch,
|
4123
|
-
table,
|
4124
|
-
sessionId,
|
4125
|
-
message
|
4126
|
-
}) {
|
4127
|
-
return operationsByTag.searchAndFilter.askTableSession({
|
4128
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, sessionId },
|
4129
|
-
body: { message },
|
4130
|
-
...this.extraProps
|
4131
|
-
});
|
4132
|
-
}
|
4133
|
-
summarizeTable({
|
4134
|
-
workspace,
|
4135
|
-
region,
|
4136
|
-
database,
|
4137
|
-
branch,
|
4138
|
-
table,
|
4139
|
-
filter,
|
4140
|
-
columns,
|
4141
|
-
summaries,
|
4142
|
-
sort,
|
4143
|
-
summariesFilter,
|
4144
|
-
page,
|
4145
|
-
consistency
|
4146
|
-
}) {
|
4147
|
-
return operationsByTag.searchAndFilter.summarizeTable({
|
4148
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
4149
|
-
body: { filter, columns, summaries, sort, summariesFilter, page, consistency },
|
4150
|
-
...this.extraProps
|
4151
|
-
});
|
4152
|
-
}
|
4153
|
-
aggregateTable({
|
4154
|
-
workspace,
|
4155
|
-
region,
|
4156
|
-
database,
|
4157
|
-
branch,
|
4158
|
-
table,
|
4159
|
-
filter,
|
4160
|
-
aggs
|
4161
|
-
}) {
|
4162
|
-
return operationsByTag.searchAndFilter.aggregateTable({
|
4163
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
4164
|
-
body: { filter, aggs },
|
4165
|
-
...this.extraProps
|
4166
|
-
});
|
4167
|
-
}
|
4168
|
-
}
|
4169
|
-
class MigrationRequestsApi {
|
4170
|
-
constructor(extraProps) {
|
4171
|
-
this.extraProps = extraProps;
|
4172
|
-
}
|
4173
|
-
queryMigrationRequests({
|
4174
|
-
workspace,
|
4175
|
-
region,
|
4176
|
-
database,
|
4177
|
-
filter,
|
4178
|
-
sort,
|
4179
|
-
page,
|
4180
|
-
columns
|
4181
|
-
}) {
|
4182
|
-
return operationsByTag.migrationRequests.queryMigrationRequests({
|
4183
|
-
pathParams: { workspace, region, dbName: database },
|
4184
|
-
body: { filter, sort, page, columns },
|
4185
|
-
...this.extraProps
|
4186
|
-
});
|
4187
|
-
}
|
4188
|
-
createMigrationRequest({
|
4189
|
-
workspace,
|
4190
|
-
region,
|
4191
|
-
database,
|
4192
|
-
migration
|
4193
|
-
}) {
|
4194
|
-
return operationsByTag.migrationRequests.createMigrationRequest({
|
4195
|
-
pathParams: { workspace, region, dbName: database },
|
4196
|
-
body: migration,
|
4197
|
-
...this.extraProps
|
4198
|
-
});
|
4199
|
-
}
|
4200
|
-
getMigrationRequest({
|
4201
|
-
workspace,
|
4202
|
-
region,
|
4203
|
-
database,
|
4204
|
-
migrationRequest
|
4205
|
-
}) {
|
4206
|
-
return operationsByTag.migrationRequests.getMigrationRequest({
|
4207
|
-
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
4208
|
-
...this.extraProps
|
4209
|
-
});
|
4210
|
-
}
|
4211
|
-
updateMigrationRequest({
|
4212
|
-
workspace,
|
4213
|
-
region,
|
4214
|
-
database,
|
4215
|
-
migrationRequest,
|
4216
|
-
update
|
4217
|
-
}) {
|
4218
|
-
return operationsByTag.migrationRequests.updateMigrationRequest({
|
4219
|
-
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
4220
|
-
body: update,
|
4221
|
-
...this.extraProps
|
4222
|
-
});
|
4223
|
-
}
|
4224
|
-
listMigrationRequestsCommits({
|
4225
|
-
workspace,
|
4226
|
-
region,
|
4227
|
-
database,
|
4228
|
-
migrationRequest,
|
4229
|
-
page
|
4230
|
-
}) {
|
4231
|
-
return operationsByTag.migrationRequests.listMigrationRequestsCommits({
|
4232
|
-
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
4233
|
-
body: { page },
|
4234
|
-
...this.extraProps
|
4235
|
-
});
|
4236
|
-
}
|
4237
|
-
compareMigrationRequest({
|
4238
|
-
workspace,
|
4239
|
-
region,
|
4240
|
-
database,
|
4241
|
-
migrationRequest
|
4242
|
-
}) {
|
4243
|
-
return operationsByTag.migrationRequests.compareMigrationRequest({
|
4244
|
-
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
4245
|
-
...this.extraProps
|
4246
|
-
});
|
4247
|
-
}
|
4248
|
-
getMigrationRequestIsMerged({
|
4249
|
-
workspace,
|
4250
|
-
region,
|
4251
|
-
database,
|
4252
|
-
migrationRequest
|
4253
|
-
}) {
|
4254
|
-
return operationsByTag.migrationRequests.getMigrationRequestIsMerged({
|
4255
|
-
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
4256
|
-
...this.extraProps
|
4257
|
-
});
|
4258
|
-
}
|
4259
|
-
mergeMigrationRequest({
|
4260
|
-
workspace,
|
4261
|
-
region,
|
4262
|
-
database,
|
4263
|
-
migrationRequest
|
4264
|
-
}) {
|
4265
|
-
return operationsByTag.migrationRequests.mergeMigrationRequest({
|
4266
|
-
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
4267
|
-
...this.extraProps
|
4268
|
-
});
|
4269
|
-
}
|
4270
|
-
}
|
4271
|
-
class MigrationsApi {
|
4272
|
-
constructor(extraProps) {
|
4273
|
-
this.extraProps = extraProps;
|
4274
|
-
}
|
4275
|
-
getBranchMigrationHistory({
|
4276
|
-
workspace,
|
4277
|
-
region,
|
4278
|
-
database,
|
4279
|
-
branch,
|
4280
|
-
limit,
|
4281
|
-
startFrom
|
4282
|
-
}) {
|
4283
|
-
return operationsByTag.migrations.getBranchMigrationHistory({
|
4284
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
4285
|
-
body: { limit, startFrom },
|
4286
|
-
...this.extraProps
|
4287
|
-
});
|
4288
|
-
}
|
4289
|
-
getBranchMigrationPlan({
|
4290
|
-
workspace,
|
4291
|
-
region,
|
4292
|
-
database,
|
4293
|
-
branch,
|
4294
|
-
schema
|
4295
|
-
}) {
|
4296
|
-
return operationsByTag.migrations.getBranchMigrationPlan({
|
4297
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
4298
|
-
body: schema,
|
4299
|
-
...this.extraProps
|
4300
|
-
});
|
4301
|
-
}
|
4302
|
-
executeBranchMigrationPlan({
|
4303
|
-
workspace,
|
4304
|
-
region,
|
4305
|
-
database,
|
4306
|
-
branch,
|
4307
|
-
plan
|
4308
|
-
}) {
|
4309
|
-
return operationsByTag.migrations.executeBranchMigrationPlan({
|
4310
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
4311
|
-
body: plan,
|
4312
|
-
...this.extraProps
|
4313
|
-
});
|
4314
|
-
}
|
4315
|
-
getBranchSchemaHistory({
|
4316
|
-
workspace,
|
4317
|
-
region,
|
4318
|
-
database,
|
4319
|
-
branch,
|
4320
|
-
page
|
4321
|
-
}) {
|
4322
|
-
return operationsByTag.migrations.getBranchSchemaHistory({
|
4323
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
4324
|
-
body: { page },
|
4325
|
-
...this.extraProps
|
4326
|
-
});
|
4327
|
-
}
|
4328
|
-
compareBranchWithUserSchema({
|
4329
|
-
workspace,
|
4330
|
-
region,
|
4331
|
-
database,
|
4332
|
-
branch,
|
4333
|
-
schema,
|
4334
|
-
schemaOperations,
|
4335
|
-
branchOperations
|
4336
|
-
}) {
|
4337
|
-
return operationsByTag.migrations.compareBranchWithUserSchema({
|
4338
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
4339
|
-
body: { schema, schemaOperations, branchOperations },
|
4340
|
-
...this.extraProps
|
4341
|
-
});
|
4342
|
-
}
|
4343
|
-
compareBranchSchemas({
|
4344
|
-
workspace,
|
4345
|
-
region,
|
4346
|
-
database,
|
4347
|
-
branch,
|
4348
|
-
compare,
|
4349
|
-
sourceBranchOperations,
|
4350
|
-
targetBranchOperations
|
4351
|
-
}) {
|
4352
|
-
return operationsByTag.migrations.compareBranchSchemas({
|
4353
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, branchName: compare },
|
4354
|
-
body: { sourceBranchOperations, targetBranchOperations },
|
4355
|
-
...this.extraProps
|
4356
|
-
});
|
4357
|
-
}
|
4358
|
-
updateBranchSchema({
|
4359
|
-
workspace,
|
4360
|
-
region,
|
4361
|
-
database,
|
4362
|
-
branch,
|
4363
|
-
migration
|
4364
|
-
}) {
|
4365
|
-
return operationsByTag.migrations.updateBranchSchema({
|
4366
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
4367
|
-
body: migration,
|
4368
|
-
...this.extraProps
|
4369
|
-
});
|
4370
|
-
}
|
4371
|
-
previewBranchSchemaEdit({
|
4372
|
-
workspace,
|
4373
|
-
region,
|
4374
|
-
database,
|
4375
|
-
branch,
|
4376
|
-
data
|
4377
|
-
}) {
|
4378
|
-
return operationsByTag.migrations.previewBranchSchemaEdit({
|
4379
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
4380
|
-
body: data,
|
4381
|
-
...this.extraProps
|
4382
|
-
});
|
4383
|
-
}
|
4384
|
-
applyBranchSchemaEdit({
|
4385
|
-
workspace,
|
4386
|
-
region,
|
4387
|
-
database,
|
4388
|
-
branch,
|
4389
|
-
edits
|
4390
|
-
}) {
|
4391
|
-
return operationsByTag.migrations.applyBranchSchemaEdit({
|
4392
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
4393
|
-
body: { edits },
|
4394
|
-
...this.extraProps
|
4395
|
-
});
|
4396
|
-
}
|
4397
|
-
pushBranchMigrations({
|
4398
|
-
workspace,
|
4399
|
-
region,
|
4400
|
-
database,
|
4401
|
-
branch,
|
4402
|
-
migrations
|
4403
|
-
}) {
|
4404
|
-
return operationsByTag.migrations.pushBranchMigrations({
|
4405
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
4406
|
-
body: { migrations },
|
4407
|
-
...this.extraProps
|
4408
|
-
});
|
4409
|
-
}
|
4410
|
-
getSchema({
|
4411
|
-
workspace,
|
4412
|
-
region,
|
4413
|
-
database,
|
4414
|
-
branch
|
4415
|
-
}) {
|
4416
|
-
return operationsByTag.migrations.getSchema({
|
4417
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
4418
|
-
...this.extraProps
|
4419
|
-
});
|
4420
|
-
}
|
4421
|
-
}
|
4422
|
-
class DatabaseApi {
|
4423
|
-
constructor(extraProps) {
|
4424
|
-
this.extraProps = extraProps;
|
4425
|
-
}
|
4426
|
-
getDatabaseList({ workspace }) {
|
4427
|
-
return operationsByTag.databases.getDatabaseList({
|
4428
|
-
pathParams: { workspaceId: workspace },
|
4429
|
-
...this.extraProps
|
4430
|
-
});
|
4431
|
-
}
|
4432
|
-
createDatabase({
|
4433
|
-
workspace,
|
4434
|
-
database,
|
4435
|
-
data,
|
4436
|
-
headers
|
4437
|
-
}) {
|
4438
|
-
return operationsByTag.databases.createDatabase({
|
4439
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
4440
|
-
body: data,
|
4441
|
-
headers,
|
4442
|
-
...this.extraProps
|
4443
|
-
});
|
4444
|
-
}
|
4445
|
-
deleteDatabase({
|
4446
|
-
workspace,
|
4447
|
-
database
|
4448
|
-
}) {
|
4449
|
-
return operationsByTag.databases.deleteDatabase({
|
4450
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
4451
|
-
...this.extraProps
|
4452
|
-
});
|
4453
|
-
}
|
4454
|
-
getDatabaseMetadata({
|
4455
|
-
workspace,
|
4456
|
-
database
|
4457
|
-
}) {
|
4458
|
-
return operationsByTag.databases.getDatabaseMetadata({
|
4459
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
4460
|
-
...this.extraProps
|
4461
|
-
});
|
4462
|
-
}
|
4463
|
-
updateDatabaseMetadata({
|
4464
|
-
workspace,
|
4465
|
-
database,
|
4466
|
-
metadata
|
4467
|
-
}) {
|
4468
|
-
return operationsByTag.databases.updateDatabaseMetadata({
|
4469
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
4470
|
-
body: metadata,
|
4471
|
-
...this.extraProps
|
4472
|
-
});
|
4473
|
-
}
|
4474
|
-
renameDatabase({
|
4475
|
-
workspace,
|
4476
|
-
database,
|
4477
|
-
newName
|
4478
|
-
}) {
|
4479
|
-
return operationsByTag.databases.renameDatabase({
|
4480
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
4481
|
-
body: { newName },
|
4482
|
-
...this.extraProps
|
4483
|
-
});
|
4484
|
-
}
|
4485
|
-
getDatabaseGithubSettings({
|
4486
|
-
workspace,
|
4487
|
-
database
|
4488
|
-
}) {
|
4489
|
-
return operationsByTag.databases.getDatabaseGithubSettings({
|
4490
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
4491
|
-
...this.extraProps
|
4492
|
-
});
|
4493
|
-
}
|
4494
|
-
updateDatabaseGithubSettings({
|
4495
|
-
workspace,
|
4496
|
-
database,
|
4497
|
-
settings
|
4498
|
-
}) {
|
4499
|
-
return operationsByTag.databases.updateDatabaseGithubSettings({
|
4500
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
4501
|
-
body: settings,
|
4502
|
-
...this.extraProps
|
4503
|
-
});
|
4504
|
-
}
|
4505
|
-
deleteDatabaseGithubSettings({
|
4506
|
-
workspace,
|
4507
|
-
database
|
4508
|
-
}) {
|
4509
|
-
return operationsByTag.databases.deleteDatabaseGithubSettings({
|
4510
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
4511
|
-
...this.extraProps
|
4512
|
-
});
|
4513
|
-
}
|
4514
|
-
listRegions({ workspace }) {
|
4515
|
-
return operationsByTag.databases.listRegions({
|
4516
|
-
pathParams: { workspaceId: workspace },
|
4517
|
-
...this.extraProps
|
4518
|
-
});
|
4519
|
-
}
|
3570
|
+
};
|
3571
|
+
class XataApiClient extends buildApiClient() {
|
4520
3572
|
}
|
4521
3573
|
|
4522
3574
|
class XataApiPlugin {
|
@@ -4544,8 +3596,7 @@ function buildTransformString(transformations) {
|
|
4544
3596
|
).join(",");
|
4545
3597
|
}
|
4546
3598
|
function transformImage(url, ...transformations) {
|
4547
|
-
if (!isDefined(url))
|
4548
|
-
return void 0;
|
3599
|
+
if (!isDefined(url)) return void 0;
|
4549
3600
|
const newTransformations = buildTransformString(transformations);
|
4550
3601
|
const { hostname, pathname, search } = new URL(url);
|
4551
3602
|
const pathParts = pathname.split("/");
|
@@ -4658,8 +3709,7 @@ class XataFile {
|
|
4658
3709
|
}
|
4659
3710
|
}
|
4660
3711
|
const parseInputFileEntry = async (entry) => {
|
4661
|
-
if (!isDefined(entry))
|
4662
|
-
return null;
|
3712
|
+
if (!isDefined(entry)) return null;
|
4663
3713
|
const { id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout, uploadUrlTimeout } = await entry;
|
4664
3714
|
return compactObject({
|
4665
3715
|
id,
|
@@ -4674,24 +3724,19 @@ const parseInputFileEntry = async (entry) => {
|
|
4674
3724
|
};
|
4675
3725
|
|
4676
3726
|
function cleanFilter(filter) {
|
4677
|
-
if (!isDefined(filter))
|
4678
|
-
|
4679
|
-
if (!isObject(filter))
|
4680
|
-
return filter;
|
3727
|
+
if (!isDefined(filter)) return void 0;
|
3728
|
+
if (!isObject(filter)) return filter;
|
4681
3729
|
const values = Object.fromEntries(
|
4682
3730
|
Object.entries(filter).reduce((acc, [key, value]) => {
|
4683
|
-
if (!isDefined(value))
|
4684
|
-
return acc;
|
3731
|
+
if (!isDefined(value)) return acc;
|
4685
3732
|
if (Array.isArray(value)) {
|
4686
3733
|
const clean = value.map((item) => cleanFilter(item)).filter((item) => isDefined(item));
|
4687
|
-
if (clean.length === 0)
|
4688
|
-
return acc;
|
3734
|
+
if (clean.length === 0) return acc;
|
4689
3735
|
return [...acc, [key, clean]];
|
4690
3736
|
}
|
4691
3737
|
if (isObject(value)) {
|
4692
3738
|
const clean = cleanFilter(value);
|
4693
|
-
if (!isDefined(clean))
|
4694
|
-
return acc;
|
3739
|
+
if (!isDefined(clean)) return acc;
|
4695
3740
|
return [...acc, [key, clean]];
|
4696
3741
|
}
|
4697
3742
|
return [...acc, [key, value]];
|
@@ -4701,10 +3746,8 @@ function cleanFilter(filter) {
|
|
4701
3746
|
}
|
4702
3747
|
|
4703
3748
|
function stringifyJson(value) {
|
4704
|
-
if (!isDefined(value))
|
4705
|
-
|
4706
|
-
if (isString(value))
|
4707
|
-
return value;
|
3749
|
+
if (!isDefined(value)) return value;
|
3750
|
+
if (isString(value)) return value;
|
4708
3751
|
try {
|
4709
3752
|
return JSON.stringify(value);
|
4710
3753
|
} catch (e) {
|
@@ -4719,28 +3762,17 @@ function parseJson(value) {
|
|
4719
3762
|
}
|
4720
3763
|
}
|
4721
3764
|
|
4722
|
-
var
|
4723
|
-
|
4724
|
-
throw TypeError("Cannot " + msg);
|
4725
|
-
};
|
4726
|
-
var __privateGet$5 = (obj, member, getter) => {
|
4727
|
-
__accessCheck$6(obj, member, "read from private field");
|
4728
|
-
return getter ? getter.call(obj) : member.get(obj);
|
4729
|
-
};
|
4730
|
-
var __privateAdd$6 = (obj, member, value) => {
|
4731
|
-
if (member.has(obj))
|
4732
|
-
throw TypeError("Cannot add the same private member more than once");
|
4733
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
4734
|
-
};
|
4735
|
-
var __privateSet$4 = (obj, member, value, setter) => {
|
4736
|
-
__accessCheck$6(obj, member, "write to private field");
|
4737
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
4738
|
-
return value;
|
3765
|
+
var __typeError$6 = (msg) => {
|
3766
|
+
throw TypeError(msg);
|
4739
3767
|
};
|
3768
|
+
var __accessCheck$6 = (obj, member, msg) => member.has(obj) || __typeError$6("Cannot " + msg);
|
3769
|
+
var __privateGet$5 = (obj, member, getter) => (__accessCheck$6(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
3770
|
+
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);
|
3771
|
+
var __privateSet$4 = (obj, member, value, setter) => (__accessCheck$6(obj, member, "write to private field"), member.set(obj, value), value);
|
4740
3772
|
var _query, _page;
|
4741
3773
|
class Page {
|
4742
3774
|
constructor(query, meta, records = []) {
|
4743
|
-
__privateAdd$6(this, _query
|
3775
|
+
__privateAdd$6(this, _query);
|
4744
3776
|
__privateSet$4(this, _query, query);
|
4745
3777
|
this.meta = meta;
|
4746
3778
|
this.records = new PageRecordArray(this, records);
|
@@ -4827,7 +3859,7 @@ class RecordArray extends Array {
|
|
4827
3859
|
const _PageRecordArray = class _PageRecordArray extends Array {
|
4828
3860
|
constructor(...args) {
|
4829
3861
|
super(..._PageRecordArray.parseConstructorParams(...args));
|
4830
|
-
__privateAdd$6(this, _page
|
3862
|
+
__privateAdd$6(this, _page);
|
4831
3863
|
__privateSet$4(this, _page, isObject(args[0]?.meta) ? args[0] : { meta: { page: { cursor: "", more: false } }, records: [] });
|
4832
3864
|
}
|
4833
3865
|
static parseConstructorParams(...args) {
|
@@ -4898,34 +3930,20 @@ const _PageRecordArray = class _PageRecordArray extends Array {
|
|
4898
3930
|
_page = new WeakMap();
|
4899
3931
|
let PageRecordArray = _PageRecordArray;
|
4900
3932
|
|
4901
|
-
var
|
4902
|
-
|
4903
|
-
throw TypeError("Cannot " + msg);
|
4904
|
-
};
|
4905
|
-
var __privateGet$4 = (obj, member, getter) => {
|
4906
|
-
__accessCheck$5(obj, member, "read from private field");
|
4907
|
-
return getter ? getter.call(obj) : member.get(obj);
|
4908
|
-
};
|
4909
|
-
var __privateAdd$5 = (obj, member, value) => {
|
4910
|
-
if (member.has(obj))
|
4911
|
-
throw TypeError("Cannot add the same private member more than once");
|
4912
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
4913
|
-
};
|
4914
|
-
var __privateSet$3 = (obj, member, value, setter) => {
|
4915
|
-
__accessCheck$5(obj, member, "write to private field");
|
4916
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
4917
|
-
return value;
|
4918
|
-
};
|
4919
|
-
var __privateMethod$3 = (obj, member, method) => {
|
4920
|
-
__accessCheck$5(obj, member, "access private method");
|
4921
|
-
return method;
|
3933
|
+
var __typeError$5 = (msg) => {
|
3934
|
+
throw TypeError(msg);
|
4922
3935
|
};
|
4923
|
-
var
|
3936
|
+
var __accessCheck$5 = (obj, member, msg) => member.has(obj) || __typeError$5("Cannot " + msg);
|
3937
|
+
var __privateGet$4 = (obj, member, getter) => (__accessCheck$5(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
3938
|
+
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);
|
3939
|
+
var __privateSet$3 = (obj, member, value, setter) => (__accessCheck$5(obj, member, "write to private field"), member.set(obj, value), value);
|
3940
|
+
var __privateMethod$3 = (obj, member, method) => (__accessCheck$5(obj, member, "access private method"), method);
|
3941
|
+
var _table$1, _repository, _data, _Query_instances, cleanFilterConstraint_fn;
|
4924
3942
|
const _Query = class _Query {
|
4925
3943
|
constructor(repository, table, data, rawParent) {
|
4926
|
-
__privateAdd$5(this,
|
4927
|
-
__privateAdd$5(this, _table$1
|
4928
|
-
__privateAdd$5(this, _repository
|
3944
|
+
__privateAdd$5(this, _Query_instances);
|
3945
|
+
__privateAdd$5(this, _table$1);
|
3946
|
+
__privateAdd$5(this, _repository);
|
4929
3947
|
__privateAdd$5(this, _data, { filter: {} });
|
4930
3948
|
// Implements pagination
|
4931
3949
|
this.meta = { page: { cursor: "start", more: true, size: PAGINATION_DEFAULT_SIZE } };
|
@@ -5004,12 +4022,12 @@ const _Query = class _Query {
|
|
5004
4022
|
filter(a, b) {
|
5005
4023
|
if (arguments.length === 1) {
|
5006
4024
|
const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
|
5007
|
-
[column]: __privateMethod$3(this,
|
4025
|
+
[column]: __privateMethod$3(this, _Query_instances, cleanFilterConstraint_fn).call(this, column, constraint)
|
5008
4026
|
}));
|
5009
4027
|
const $all = compact([__privateGet$4(this, _data).filter?.$all].flat().concat(constraints));
|
5010
4028
|
return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
|
5011
4029
|
} else {
|
5012
|
-
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this,
|
4030
|
+
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this, _Query_instances, cleanFilterConstraint_fn).call(this, a, b) }] : void 0;
|
5013
4031
|
const $all = compact([__privateGet$4(this, _data).filter?.$all].flat().concat(constraints));
|
5014
4032
|
return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
|
5015
4033
|
}
|
@@ -5088,8 +4106,7 @@ const _Query = class _Query {
|
|
5088
4106
|
}
|
5089
4107
|
async getFirstOrThrow(options = {}) {
|
5090
4108
|
const records = await this.getMany({ ...options, pagination: { size: 1 } });
|
5091
|
-
if (records[0] === void 0)
|
5092
|
-
throw new Error("No results found.");
|
4109
|
+
if (records[0] === void 0) throw new Error("No results found.");
|
5093
4110
|
return records[0];
|
5094
4111
|
}
|
5095
4112
|
async summarize(params = {}) {
|
@@ -5152,7 +4169,7 @@ const _Query = class _Query {
|
|
5152
4169
|
_table$1 = new WeakMap();
|
5153
4170
|
_repository = new WeakMap();
|
5154
4171
|
_data = new WeakMap();
|
5155
|
-
|
4172
|
+
_Query_instances = new WeakSet();
|
5156
4173
|
cleanFilterConstraint_fn = function(column, value) {
|
5157
4174
|
const columnType = __privateGet$4(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
|
5158
4175
|
if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
|
@@ -5218,8 +4235,7 @@ function isSortFilterString(value) {
|
|
5218
4235
|
}
|
5219
4236
|
function isSortFilterBase(filter) {
|
5220
4237
|
return isObject(filter) && Object.entries(filter).every(([key, value]) => {
|
5221
|
-
if (key === "*")
|
5222
|
-
return value === "random";
|
4238
|
+
if (key === "*") return value === "random";
|
5223
4239
|
return value === "asc" || value === "desc";
|
5224
4240
|
});
|
5225
4241
|
}
|
@@ -5240,29 +4256,15 @@ function buildSortFilter(filter) {
|
|
5240
4256
|
}
|
5241
4257
|
}
|
5242
4258
|
|
5243
|
-
var
|
5244
|
-
|
5245
|
-
throw TypeError("Cannot " + msg);
|
5246
|
-
};
|
5247
|
-
var __privateGet$3 = (obj, member, getter) => {
|
5248
|
-
__accessCheck$4(obj, member, "read from private field");
|
5249
|
-
return getter ? getter.call(obj) : member.get(obj);
|
5250
|
-
};
|
5251
|
-
var __privateAdd$4 = (obj, member, value) => {
|
5252
|
-
if (member.has(obj))
|
5253
|
-
throw TypeError("Cannot add the same private member more than once");
|
5254
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
4259
|
+
var __typeError$4 = (msg) => {
|
4260
|
+
throw TypeError(msg);
|
5255
4261
|
};
|
5256
|
-
var
|
5257
|
-
|
5258
|
-
|
5259
|
-
|
5260
|
-
|
5261
|
-
var
|
5262
|
-
__accessCheck$4(obj, member, "access private method");
|
5263
|
-
return method;
|
5264
|
-
};
|
5265
|
-
var _table, _getFetchProps, _db, _cache, _schemaTables, _trace, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn, _insertRecords, insertRecords_fn, _updateRecordWithID, updateRecordWithID_fn, _updateRecords, updateRecords_fn, _upsertRecordWithID, upsertRecordWithID_fn, _deleteRecord, deleteRecord_fn, _deleteRecords, deleteRecords_fn, _setCacheQuery, setCacheQuery_fn, _getCacheQuery, getCacheQuery_fn, _getSchemaTables, getSchemaTables_fn, _transformObjectToApi, transformObjectToApi_fn;
|
4262
|
+
var __accessCheck$4 = (obj, member, msg) => member.has(obj) || __typeError$4("Cannot " + msg);
|
4263
|
+
var __privateGet$3 = (obj, member, getter) => (__accessCheck$4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
4264
|
+
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);
|
4265
|
+
var __privateSet$2 = (obj, member, value, setter) => (__accessCheck$4(obj, member, "write to private field"), member.set(obj, value), value);
|
4266
|
+
var __privateMethod$2 = (obj, member, method) => (__accessCheck$4(obj, member, "access private method"), method);
|
4267
|
+
var _table, _getFetchProps, _db, _cache, _schemaTables, _trace, _RestRepository_instances, insertRecordWithoutId_fn, insertRecordWithId_fn, insertRecords_fn, updateRecordWithID_fn, updateRecords_fn, upsertRecordWithID_fn, deleteRecord_fn, deleteRecords_fn, setCacheQuery_fn, getCacheQuery_fn, getSchemaTables_fn, transformObjectToApi_fn;
|
5266
4268
|
const BULK_OPERATION_MAX_SIZE = 1e3;
|
5267
4269
|
class Repository extends Query {
|
5268
4270
|
}
|
@@ -5273,24 +4275,13 @@ class RestRepository extends Query {
|
|
5273
4275
|
{ name: options.table, schema: options.schemaTables?.find((table) => table.name === options.table) },
|
5274
4276
|
{}
|
5275
4277
|
);
|
5276
|
-
__privateAdd$4(this,
|
5277
|
-
__privateAdd$4(this,
|
5278
|
-
__privateAdd$4(this,
|
5279
|
-
__privateAdd$4(this,
|
5280
|
-
__privateAdd$4(this,
|
5281
|
-
__privateAdd$4(this,
|
5282
|
-
__privateAdd$4(this,
|
5283
|
-
__privateAdd$4(this, _deleteRecords);
|
5284
|
-
__privateAdd$4(this, _setCacheQuery);
|
5285
|
-
__privateAdd$4(this, _getCacheQuery);
|
5286
|
-
__privateAdd$4(this, _getSchemaTables);
|
5287
|
-
__privateAdd$4(this, _transformObjectToApi);
|
5288
|
-
__privateAdd$4(this, _table, void 0);
|
5289
|
-
__privateAdd$4(this, _getFetchProps, void 0);
|
5290
|
-
__privateAdd$4(this, _db, void 0);
|
5291
|
-
__privateAdd$4(this, _cache, void 0);
|
5292
|
-
__privateAdd$4(this, _schemaTables, void 0);
|
5293
|
-
__privateAdd$4(this, _trace, void 0);
|
4278
|
+
__privateAdd$4(this, _RestRepository_instances);
|
4279
|
+
__privateAdd$4(this, _table);
|
4280
|
+
__privateAdd$4(this, _getFetchProps);
|
4281
|
+
__privateAdd$4(this, _db);
|
4282
|
+
__privateAdd$4(this, _cache);
|
4283
|
+
__privateAdd$4(this, _schemaTables);
|
4284
|
+
__privateAdd$4(this, _trace);
|
5294
4285
|
__privateSet$2(this, _table, options.table);
|
5295
4286
|
__privateSet$2(this, _db, options.db);
|
5296
4287
|
__privateSet$2(this, _cache, options.pluginOptions.cache);
|
@@ -5310,28 +4301,25 @@ class RestRepository extends Query {
|
|
5310
4301
|
return __privateGet$3(this, _trace).call(this, "create", async () => {
|
5311
4302
|
const ifVersion = parseIfVersion(b, c, d);
|
5312
4303
|
if (Array.isArray(a)) {
|
5313
|
-
if (a.length === 0)
|
5314
|
-
|
5315
|
-
const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: true });
|
4304
|
+
if (a.length === 0) return [];
|
4305
|
+
const ids = await __privateMethod$2(this, _RestRepository_instances, insertRecords_fn).call(this, a, { ifVersion, createOnly: true });
|
5316
4306
|
const columns = isValidSelectableColumns(b) ? b : ["*"];
|
5317
4307
|
const result = await this.read(ids, columns);
|
5318
4308
|
return result;
|
5319
4309
|
}
|
5320
4310
|
if (isString(a) && isObject(b)) {
|
5321
|
-
if (a === "")
|
5322
|
-
throw new Error("The id can't be empty");
|
4311
|
+
if (a === "") throw new Error("The id can't be empty");
|
5323
4312
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
5324
|
-
return await __privateMethod$2(this,
|
4313
|
+
return await __privateMethod$2(this, _RestRepository_instances, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
|
5325
4314
|
}
|
5326
4315
|
if (isObject(a) && isString(a.id)) {
|
5327
|
-
if (a.id === "")
|
5328
|
-
throw new Error("The id can't be empty");
|
4316
|
+
if (a.id === "") throw new Error("The id can't be empty");
|
5329
4317
|
const columns = isValidSelectableColumns(b) ? b : void 0;
|
5330
|
-
return await __privateMethod$2(this,
|
4318
|
+
return await __privateMethod$2(this, _RestRepository_instances, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: true, ifVersion });
|
5331
4319
|
}
|
5332
4320
|
if (isObject(a)) {
|
5333
4321
|
const columns = isValidSelectableColumns(b) ? b : void 0;
|
5334
|
-
return __privateMethod$2(this,
|
4322
|
+
return __privateMethod$2(this, _RestRepository_instances, insertRecordWithoutId_fn).call(this, a, columns);
|
5335
4323
|
}
|
5336
4324
|
throw new Error("Invalid arguments for create method");
|
5337
4325
|
});
|
@@ -5340,8 +4328,7 @@ class RestRepository extends Query {
|
|
5340
4328
|
return __privateGet$3(this, _trace).call(this, "read", async () => {
|
5341
4329
|
const columns = isValidSelectableColumns(b) ? b : ["*"];
|
5342
4330
|
if (Array.isArray(a)) {
|
5343
|
-
if (a.length === 0)
|
5344
|
-
return [];
|
4331
|
+
if (a.length === 0) return [];
|
5345
4332
|
const ids = a.map((item) => extractId(item));
|
5346
4333
|
const finalObjects = await this.getAll({ filter: { id: { $any: compact(ids) } }, columns });
|
5347
4334
|
const dictionary = finalObjects.reduce((acc, object) => {
|
@@ -5364,7 +4351,7 @@ class RestRepository extends Query {
|
|
5364
4351
|
queryParams: { columns },
|
5365
4352
|
...__privateGet$3(this, _getFetchProps).call(this)
|
5366
4353
|
});
|
5367
|
-
const schemaTables = await __privateMethod$2(this,
|
4354
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5368
4355
|
return initObject(
|
5369
4356
|
__privateGet$3(this, _db),
|
5370
4357
|
schemaTables,
|
@@ -5405,11 +4392,10 @@ class RestRepository extends Query {
|
|
5405
4392
|
return __privateGet$3(this, _trace).call(this, "update", async () => {
|
5406
4393
|
const ifVersion = parseIfVersion(b, c, d);
|
5407
4394
|
if (Array.isArray(a)) {
|
5408
|
-
if (a.length === 0)
|
5409
|
-
return [];
|
4395
|
+
if (a.length === 0) return [];
|
5410
4396
|
const existing = await this.read(a, ["id"]);
|
5411
4397
|
const updates = a.filter((_item, index) => existing[index] !== null);
|
5412
|
-
await __privateMethod$2(this,
|
4398
|
+
await __privateMethod$2(this, _RestRepository_instances, updateRecords_fn).call(this, updates, {
|
5413
4399
|
ifVersion,
|
5414
4400
|
upsert: false
|
5415
4401
|
});
|
@@ -5420,15 +4406,14 @@ class RestRepository extends Query {
|
|
5420
4406
|
try {
|
5421
4407
|
if (isString(a) && isObject(b)) {
|
5422
4408
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
5423
|
-
return await __privateMethod$2(this,
|
4409
|
+
return await __privateMethod$2(this, _RestRepository_instances, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
5424
4410
|
}
|
5425
4411
|
if (isObject(a) && isString(a.id)) {
|
5426
4412
|
const columns = isValidSelectableColumns(b) ? b : void 0;
|
5427
|
-
return await __privateMethod$2(this,
|
4413
|
+
return await __privateMethod$2(this, _RestRepository_instances, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
5428
4414
|
}
|
5429
4415
|
} catch (error) {
|
5430
|
-
if (error.status === 422)
|
5431
|
-
return null;
|
4416
|
+
if (error.status === 422) return null;
|
5432
4417
|
throw error;
|
5433
4418
|
}
|
5434
4419
|
throw new Error("Invalid arguments for update method");
|
@@ -5457,9 +4442,8 @@ class RestRepository extends Query {
|
|
5457
4442
|
return __privateGet$3(this, _trace).call(this, "createOrUpdate", async () => {
|
5458
4443
|
const ifVersion = parseIfVersion(b, c, d);
|
5459
4444
|
if (Array.isArray(a)) {
|
5460
|
-
if (a.length === 0)
|
5461
|
-
|
5462
|
-
await __privateMethod$2(this, _updateRecords, updateRecords_fn).call(this, a, {
|
4445
|
+
if (a.length === 0) return [];
|
4446
|
+
await __privateMethod$2(this, _RestRepository_instances, updateRecords_fn).call(this, a, {
|
5463
4447
|
ifVersion,
|
5464
4448
|
upsert: true
|
5465
4449
|
});
|
@@ -5468,16 +4452,14 @@ class RestRepository extends Query {
|
|
5468
4452
|
return result;
|
5469
4453
|
}
|
5470
4454
|
if (isString(a) && isObject(b)) {
|
5471
|
-
if (a === "")
|
5472
|
-
throw new Error("The id can't be empty");
|
4455
|
+
if (a === "") throw new Error("The id can't be empty");
|
5473
4456
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
5474
|
-
return await __privateMethod$2(this,
|
4457
|
+
return await __privateMethod$2(this, _RestRepository_instances, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
5475
4458
|
}
|
5476
4459
|
if (isObject(a) && isString(a.id)) {
|
5477
|
-
if (a.id === "")
|
5478
|
-
throw new Error("The id can't be empty");
|
4460
|
+
if (a.id === "") throw new Error("The id can't be empty");
|
5479
4461
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
5480
|
-
return await __privateMethod$2(this,
|
4462
|
+
return await __privateMethod$2(this, _RestRepository_instances, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
5481
4463
|
}
|
5482
4464
|
if (!isDefined(a) && isObject(b)) {
|
5483
4465
|
return await this.create(b, c);
|
@@ -5492,24 +4474,21 @@ class RestRepository extends Query {
|
|
5492
4474
|
return __privateGet$3(this, _trace).call(this, "createOrReplace", async () => {
|
5493
4475
|
const ifVersion = parseIfVersion(b, c, d);
|
5494
4476
|
if (Array.isArray(a)) {
|
5495
|
-
if (a.length === 0)
|
5496
|
-
|
5497
|
-
const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: false });
|
4477
|
+
if (a.length === 0) return [];
|
4478
|
+
const ids = await __privateMethod$2(this, _RestRepository_instances, insertRecords_fn).call(this, a, { ifVersion, createOnly: false });
|
5498
4479
|
const columns = isValidSelectableColumns(b) ? b : ["*"];
|
5499
4480
|
const result = await this.read(ids, columns);
|
5500
4481
|
return result;
|
5501
4482
|
}
|
5502
4483
|
if (isString(a) && isObject(b)) {
|
5503
|
-
if (a === "")
|
5504
|
-
throw new Error("The id can't be empty");
|
4484
|
+
if (a === "") throw new Error("The id can't be empty");
|
5505
4485
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
5506
|
-
return await __privateMethod$2(this,
|
4486
|
+
return await __privateMethod$2(this, _RestRepository_instances, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
|
5507
4487
|
}
|
5508
4488
|
if (isObject(a) && isString(a.id)) {
|
5509
|
-
if (a.id === "")
|
5510
|
-
throw new Error("The id can't be empty");
|
4489
|
+
if (a.id === "") throw new Error("The id can't be empty");
|
5511
4490
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
5512
|
-
return await __privateMethod$2(this,
|
4491
|
+
return await __privateMethod$2(this, _RestRepository_instances, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
|
5513
4492
|
}
|
5514
4493
|
if (!isDefined(a) && isObject(b)) {
|
5515
4494
|
return await this.create(b, c);
|
@@ -5523,25 +4502,22 @@ class RestRepository extends Query {
|
|
5523
4502
|
async delete(a, b) {
|
5524
4503
|
return __privateGet$3(this, _trace).call(this, "delete", async () => {
|
5525
4504
|
if (Array.isArray(a)) {
|
5526
|
-
if (a.length === 0)
|
5527
|
-
return [];
|
4505
|
+
if (a.length === 0) return [];
|
5528
4506
|
const ids = a.map((o) => {
|
5529
|
-
if (isString(o))
|
5530
|
-
|
5531
|
-
if (isString(o.id))
|
5532
|
-
return o.id;
|
4507
|
+
if (isString(o)) return o;
|
4508
|
+
if (isString(o.id)) return o.id;
|
5533
4509
|
throw new Error("Invalid arguments for delete method");
|
5534
4510
|
});
|
5535
4511
|
const columns = isValidSelectableColumns(b) ? b : ["*"];
|
5536
4512
|
const result = await this.read(a, columns);
|
5537
|
-
await __privateMethod$2(this,
|
4513
|
+
await __privateMethod$2(this, _RestRepository_instances, deleteRecords_fn).call(this, ids);
|
5538
4514
|
return result;
|
5539
4515
|
}
|
5540
4516
|
if (isString(a)) {
|
5541
|
-
return __privateMethod$2(this,
|
4517
|
+
return __privateMethod$2(this, _RestRepository_instances, deleteRecord_fn).call(this, a, b);
|
5542
4518
|
}
|
5543
4519
|
if (isObject(a) && isString(a.id)) {
|
5544
|
-
return __privateMethod$2(this,
|
4520
|
+
return __privateMethod$2(this, _RestRepository_instances, deleteRecord_fn).call(this, a.id, b);
|
5545
4521
|
}
|
5546
4522
|
throw new Error("Invalid arguments for delete method");
|
5547
4523
|
});
|
@@ -5585,7 +4561,7 @@ class RestRepository extends Query {
|
|
5585
4561
|
},
|
5586
4562
|
...__privateGet$3(this, _getFetchProps).call(this)
|
5587
4563
|
});
|
5588
|
-
const schemaTables = await __privateMethod$2(this,
|
4564
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5589
4565
|
return {
|
5590
4566
|
records: records.map((item) => initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), item, ["*"])),
|
5591
4567
|
totalCount
|
@@ -5610,7 +4586,7 @@ class RestRepository extends Query {
|
|
5610
4586
|
},
|
5611
4587
|
...__privateGet$3(this, _getFetchProps).call(this)
|
5612
4588
|
});
|
5613
|
-
const schemaTables = await __privateMethod$2(this,
|
4589
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5614
4590
|
return {
|
5615
4591
|
records: records.map((item) => initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), item, ["*"])),
|
5616
4592
|
totalCount
|
@@ -5634,9 +4610,8 @@ class RestRepository extends Query {
|
|
5634
4610
|
}
|
5635
4611
|
async query(query) {
|
5636
4612
|
return __privateGet$3(this, _trace).call(this, "query", async () => {
|
5637
|
-
const cacheQuery = await __privateMethod$2(this,
|
5638
|
-
if (cacheQuery)
|
5639
|
-
return new Page(query, cacheQuery.meta, cacheQuery.records);
|
4613
|
+
const cacheQuery = await __privateMethod$2(this, _RestRepository_instances, getCacheQuery_fn).call(this, query);
|
4614
|
+
if (cacheQuery) return new Page(query, cacheQuery.meta, cacheQuery.records);
|
5640
4615
|
const data = query.getQueryOptions();
|
5641
4616
|
const { meta, records: objects } = await queryTable({
|
5642
4617
|
pathParams: {
|
@@ -5655,7 +4630,7 @@ class RestRepository extends Query {
|
|
5655
4630
|
fetchOptions: data.fetchOptions,
|
5656
4631
|
...__privateGet$3(this, _getFetchProps).call(this)
|
5657
4632
|
});
|
5658
|
-
const schemaTables = await __privateMethod$2(this,
|
4633
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5659
4634
|
const records = objects.map(
|
5660
4635
|
(record) => initObject(
|
5661
4636
|
__privateGet$3(this, _db),
|
@@ -5665,7 +4640,7 @@ class RestRepository extends Query {
|
|
5665
4640
|
data.columns ?? ["*"]
|
5666
4641
|
)
|
5667
4642
|
);
|
5668
|
-
await __privateMethod$2(this,
|
4643
|
+
await __privateMethod$2(this, _RestRepository_instances, setCacheQuery_fn).call(this, query, meta, records);
|
5669
4644
|
return new Page(query, meta, records);
|
5670
4645
|
});
|
5671
4646
|
}
|
@@ -5690,7 +4665,7 @@ class RestRepository extends Query {
|
|
5690
4665
|
},
|
5691
4666
|
...__privateGet$3(this, _getFetchProps).call(this)
|
5692
4667
|
});
|
5693
|
-
const schemaTables = await __privateMethod$2(this,
|
4668
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5694
4669
|
return {
|
5695
4670
|
...result,
|
5696
4671
|
summaries: result.summaries.map(
|
@@ -5739,9 +4714,9 @@ _db = new WeakMap();
|
|
5739
4714
|
_cache = new WeakMap();
|
5740
4715
|
_schemaTables = new WeakMap();
|
5741
4716
|
_trace = new WeakMap();
|
5742
|
-
|
4717
|
+
_RestRepository_instances = new WeakSet();
|
5743
4718
|
insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
5744
|
-
const record = await __privateMethod$2(this,
|
4719
|
+
const record = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
|
5745
4720
|
const response = await insertRecord({
|
5746
4721
|
pathParams: {
|
5747
4722
|
workspace: "{workspaceId}",
|
@@ -5753,14 +4728,12 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
5753
4728
|
body: record,
|
5754
4729
|
...__privateGet$3(this, _getFetchProps).call(this)
|
5755
4730
|
});
|
5756
|
-
const schemaTables = await __privateMethod$2(this,
|
4731
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5757
4732
|
return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
|
5758
4733
|
};
|
5759
|
-
_insertRecordWithId = new WeakSet();
|
5760
4734
|
insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
|
5761
|
-
if (!recordId)
|
5762
|
-
|
5763
|
-
const record = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
|
4735
|
+
if (!recordId) return null;
|
4736
|
+
const record = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
|
5764
4737
|
const response = await insertRecordWithID({
|
5765
4738
|
pathParams: {
|
5766
4739
|
workspace: "{workspaceId}",
|
@@ -5773,13 +4746,12 @@ insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { crea
|
|
5773
4746
|
queryParams: { createOnly, columns, ifVersion },
|
5774
4747
|
...__privateGet$3(this, _getFetchProps).call(this)
|
5775
4748
|
});
|
5776
|
-
const schemaTables = await __privateMethod$2(this,
|
4749
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5777
4750
|
return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
|
5778
4751
|
};
|
5779
|
-
_insertRecords = new WeakSet();
|
5780
4752
|
insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
|
5781
4753
|
const operations = await promiseMap(objects, async (object) => {
|
5782
|
-
const record = await __privateMethod$2(this,
|
4754
|
+
const record = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
|
5783
4755
|
return { insert: { table: __privateGet$3(this, _table), record, createOnly, ifVersion } };
|
5784
4756
|
});
|
5785
4757
|
const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
|
@@ -5804,11 +4776,9 @@ insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
|
|
5804
4776
|
}
|
5805
4777
|
return ids;
|
5806
4778
|
};
|
5807
|
-
_updateRecordWithID = new WeakSet();
|
5808
4779
|
updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
5809
|
-
if (!recordId)
|
5810
|
-
|
5811
|
-
const { id: _id, ...record } = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
|
4780
|
+
if (!recordId) return null;
|
4781
|
+
const { id: _id, ...record } = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
|
5812
4782
|
try {
|
5813
4783
|
const response = await updateRecordWithID({
|
5814
4784
|
pathParams: {
|
@@ -5822,7 +4792,7 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
|
|
5822
4792
|
body: record,
|
5823
4793
|
...__privateGet$3(this, _getFetchProps).call(this)
|
5824
4794
|
});
|
5825
|
-
const schemaTables = await __privateMethod$2(this,
|
4795
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5826
4796
|
return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
|
5827
4797
|
} catch (e) {
|
5828
4798
|
if (isObject(e) && e.status === 404) {
|
@@ -5831,10 +4801,9 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
|
|
5831
4801
|
throw e;
|
5832
4802
|
}
|
5833
4803
|
};
|
5834
|
-
_updateRecords = new WeakSet();
|
5835
4804
|
updateRecords_fn = async function(objects, { ifVersion, upsert }) {
|
5836
4805
|
const operations = await promiseMap(objects, async ({ id, ...object }) => {
|
5837
|
-
const fields = await __privateMethod$2(this,
|
4806
|
+
const fields = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
|
5838
4807
|
return { update: { table: __privateGet$3(this, _table), id, ifVersion, upsert, fields } };
|
5839
4808
|
});
|
5840
4809
|
const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
|
@@ -5859,10 +4828,8 @@ updateRecords_fn = async function(objects, { ifVersion, upsert }) {
|
|
5859
4828
|
}
|
5860
4829
|
return ids;
|
5861
4830
|
};
|
5862
|
-
_upsertRecordWithID = new WeakSet();
|
5863
4831
|
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
5864
|
-
if (!recordId)
|
5865
|
-
return null;
|
4832
|
+
if (!recordId) return null;
|
5866
4833
|
const response = await upsertRecordWithID({
|
5867
4834
|
pathParams: {
|
5868
4835
|
workspace: "{workspaceId}",
|
@@ -5875,13 +4842,11 @@ upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
|
|
5875
4842
|
body: object,
|
5876
4843
|
...__privateGet$3(this, _getFetchProps).call(this)
|
5877
4844
|
});
|
5878
|
-
const schemaTables = await __privateMethod$2(this,
|
4845
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5879
4846
|
return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
|
5880
4847
|
};
|
5881
|
-
_deleteRecord = new WeakSet();
|
5882
4848
|
deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
5883
|
-
if (!recordId)
|
5884
|
-
return null;
|
4849
|
+
if (!recordId) return null;
|
5885
4850
|
try {
|
5886
4851
|
const response = await deleteRecord({
|
5887
4852
|
pathParams: {
|
@@ -5894,7 +4859,7 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
|
5894
4859
|
queryParams: { columns },
|
5895
4860
|
...__privateGet$3(this, _getFetchProps).call(this)
|
5896
4861
|
});
|
5897
|
-
const schemaTables = await __privateMethod$2(this,
|
4862
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5898
4863
|
return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
|
5899
4864
|
} catch (e) {
|
5900
4865
|
if (isObject(e) && e.status === 404) {
|
@@ -5903,7 +4868,6 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
|
5903
4868
|
throw e;
|
5904
4869
|
}
|
5905
4870
|
};
|
5906
|
-
_deleteRecords = new WeakSet();
|
5907
4871
|
deleteRecords_fn = async function(recordIds) {
|
5908
4872
|
const chunkedOperations = chunk(
|
5909
4873
|
compact(recordIds).map((id) => ({ delete: { table: __privateGet$3(this, _table), id } })),
|
@@ -5921,27 +4885,21 @@ deleteRecords_fn = async function(recordIds) {
|
|
5921
4885
|
});
|
5922
4886
|
}
|
5923
4887
|
};
|
5924
|
-
_setCacheQuery = new WeakSet();
|
5925
4888
|
setCacheQuery_fn = async function(query, meta, records) {
|
5926
4889
|
await __privateGet$3(this, _cache)?.set(`query_${__privateGet$3(this, _table)}:${query.key()}`, { date: /* @__PURE__ */ new Date(), meta, records });
|
5927
4890
|
};
|
5928
|
-
_getCacheQuery = new WeakSet();
|
5929
4891
|
getCacheQuery_fn = async function(query) {
|
5930
4892
|
const key = `query_${__privateGet$3(this, _table)}:${query.key()}`;
|
5931
4893
|
const result = await __privateGet$3(this, _cache)?.get(key);
|
5932
|
-
if (!result)
|
5933
|
-
return null;
|
4894
|
+
if (!result) return null;
|
5934
4895
|
const defaultTTL = __privateGet$3(this, _cache)?.defaultQueryTTL ?? -1;
|
5935
4896
|
const { cache: ttl = defaultTTL } = query.getQueryOptions();
|
5936
|
-
if (ttl < 0)
|
5937
|
-
return null;
|
4897
|
+
if (ttl < 0) return null;
|
5938
4898
|
const hasExpired = result.date.getTime() + ttl < Date.now();
|
5939
4899
|
return hasExpired ? null : result;
|
5940
4900
|
};
|
5941
|
-
_getSchemaTables = new WeakSet();
|
5942
4901
|
getSchemaTables_fn = async function() {
|
5943
|
-
if (__privateGet$3(this, _schemaTables))
|
5944
|
-
return __privateGet$3(this, _schemaTables);
|
4902
|
+
if (__privateGet$3(this, _schemaTables)) return __privateGet$3(this, _schemaTables);
|
5945
4903
|
const { schema } = await getBranchDetails({
|
5946
4904
|
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
5947
4905
|
...__privateGet$3(this, _getFetchProps).call(this)
|
@@ -5949,16 +4907,13 @@ getSchemaTables_fn = async function() {
|
|
5949
4907
|
__privateSet$2(this, _schemaTables, schema.tables);
|
5950
4908
|
return schema.tables;
|
5951
4909
|
};
|
5952
|
-
_transformObjectToApi = new WeakSet();
|
5953
4910
|
transformObjectToApi_fn = async function(object) {
|
5954
|
-
const schemaTables = await __privateMethod$2(this,
|
4911
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5955
4912
|
const schema = schemaTables.find((table) => table.name === __privateGet$3(this, _table));
|
5956
|
-
if (!schema)
|
5957
|
-
throw new Error(`Table ${__privateGet$3(this, _table)} not found in schema`);
|
4913
|
+
if (!schema) throw new Error(`Table ${__privateGet$3(this, _table)} not found in schema`);
|
5958
4914
|
const result = {};
|
5959
4915
|
for (const [key, value] of Object.entries(object)) {
|
5960
|
-
if (key === "xata")
|
5961
|
-
continue;
|
4916
|
+
if (key === "xata") continue;
|
5962
4917
|
const type = schema.columns.find((column) => column.name === key)?.type;
|
5963
4918
|
switch (type) {
|
5964
4919
|
case "link": {
|
@@ -5989,11 +4944,9 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
5989
4944
|
const { xata, ...rest } = object ?? {};
|
5990
4945
|
Object.assign(data, rest);
|
5991
4946
|
const { columns } = schemaTables.find(({ name }) => name === table) ?? {};
|
5992
|
-
if (!columns)
|
5993
|
-
console.error(`Table ${table} not found in schema`);
|
4947
|
+
if (!columns) console.error(`Table ${table} not found in schema`);
|
5994
4948
|
for (const column of columns ?? []) {
|
5995
|
-
if (!isValidColumn(selectedColumns, column))
|
5996
|
-
continue;
|
4949
|
+
if (!isValidColumn(selectedColumns, column)) continue;
|
5997
4950
|
const value = data[column.name];
|
5998
4951
|
switch (column.type) {
|
5999
4952
|
case "datetime": {
|
@@ -6086,15 +5039,12 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
6086
5039
|
return record;
|
6087
5040
|
};
|
6088
5041
|
function extractId(value) {
|
6089
|
-
if (isString(value))
|
6090
|
-
|
6091
|
-
if (isObject(value) && isString(value.id))
|
6092
|
-
return value.id;
|
5042
|
+
if (isString(value)) return value;
|
5043
|
+
if (isObject(value) && isString(value.id)) return value.id;
|
6093
5044
|
return void 0;
|
6094
5045
|
}
|
6095
5046
|
function isValidColumn(columns, column) {
|
6096
|
-
if (columns.includes("*"))
|
6097
|
-
return true;
|
5047
|
+
if (columns.includes("*")) return true;
|
6098
5048
|
return columns.filter((item) => isString(item) && item.startsWith(column.name)).length > 0;
|
6099
5049
|
}
|
6100
5050
|
function parseIfVersion(...args) {
|
@@ -6106,28 +5056,17 @@ function parseIfVersion(...args) {
|
|
6106
5056
|
return void 0;
|
6107
5057
|
}
|
6108
5058
|
|
6109
|
-
var
|
6110
|
-
|
6111
|
-
throw TypeError("Cannot " + msg);
|
6112
|
-
};
|
6113
|
-
var __privateGet$2 = (obj, member, getter) => {
|
6114
|
-
__accessCheck$3(obj, member, "read from private field");
|
6115
|
-
return getter ? getter.call(obj) : member.get(obj);
|
6116
|
-
};
|
6117
|
-
var __privateAdd$3 = (obj, member, value) => {
|
6118
|
-
if (member.has(obj))
|
6119
|
-
throw TypeError("Cannot add the same private member more than once");
|
6120
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
6121
|
-
};
|
6122
|
-
var __privateSet$1 = (obj, member, value, setter) => {
|
6123
|
-
__accessCheck$3(obj, member, "write to private field");
|
6124
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
6125
|
-
return value;
|
5059
|
+
var __typeError$3 = (msg) => {
|
5060
|
+
throw TypeError(msg);
|
6126
5061
|
};
|
5062
|
+
var __accessCheck$3 = (obj, member, msg) => member.has(obj) || __typeError$3("Cannot " + msg);
|
5063
|
+
var __privateGet$2 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), member.get(obj));
|
5064
|
+
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);
|
5065
|
+
var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), member.set(obj, value), value);
|
6127
5066
|
var _map;
|
6128
5067
|
class SimpleCache {
|
6129
5068
|
constructor(options = {}) {
|
6130
|
-
__privateAdd$3(this, _map
|
5069
|
+
__privateAdd$3(this, _map);
|
6131
5070
|
__privateSet$1(this, _map, /* @__PURE__ */ new Map());
|
6132
5071
|
this.capacity = options.max ?? 500;
|
6133
5072
|
this.defaultQueryTTL = options.defaultQueryTTL ?? 60 * 1e3;
|
@@ -6143,7 +5082,7 @@ class SimpleCache {
|
|
6143
5082
|
__privateGet$2(this, _map).set(key, value);
|
6144
5083
|
if (__privateGet$2(this, _map).size > this.capacity) {
|
6145
5084
|
const leastRecentlyUsed = __privateGet$2(this, _map).keys().next().value;
|
6146
|
-
await this.delete(leastRecentlyUsed);
|
5085
|
+
if (leastRecentlyUsed) await this.delete(leastRecentlyUsed);
|
6147
5086
|
}
|
6148
5087
|
}
|
6149
5088
|
async delete(key) {
|
@@ -6183,19 +5122,12 @@ const includesAll = (value) => ({ $includesAll: value });
|
|
6183
5122
|
const includesNone = (value) => ({ $includesNone: value });
|
6184
5123
|
const includesAny = (value) => ({ $includesAny: value });
|
6185
5124
|
|
6186
|
-
var
|
6187
|
-
|
6188
|
-
throw TypeError("Cannot " + msg);
|
6189
|
-
};
|
6190
|
-
var __privateGet$1 = (obj, member, getter) => {
|
6191
|
-
__accessCheck$2(obj, member, "read from private field");
|
6192
|
-
return getter ? getter.call(obj) : member.get(obj);
|
6193
|
-
};
|
6194
|
-
var __privateAdd$2 = (obj, member, value) => {
|
6195
|
-
if (member.has(obj))
|
6196
|
-
throw TypeError("Cannot add the same private member more than once");
|
6197
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
5125
|
+
var __typeError$2 = (msg) => {
|
5126
|
+
throw TypeError(msg);
|
6198
5127
|
};
|
5128
|
+
var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg);
|
5129
|
+
var __privateGet$1 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
5130
|
+
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);
|
6199
5131
|
var _tables;
|
6200
5132
|
class SchemaPlugin extends XataPlugin {
|
6201
5133
|
constructor() {
|
@@ -6207,8 +5139,7 @@ class SchemaPlugin extends XataPlugin {
|
|
6207
5139
|
{},
|
6208
5140
|
{
|
6209
5141
|
get: (_target, table) => {
|
6210
|
-
if (!isString(table))
|
6211
|
-
throw new Error("Invalid table name");
|
5142
|
+
if (!isString(table)) throw new Error("Invalid table name");
|
6212
5143
|
if (__privateGet$1(this, _tables)[table] === void 0) {
|
6213
5144
|
__privateGet$1(this, _tables)[table] = new RestRepository({ db, pluginOptions, table, schemaTables: pluginOptions.tables });
|
6214
5145
|
}
|
@@ -6299,30 +5230,23 @@ function getContentType(file) {
|
|
6299
5230
|
return "application/octet-stream";
|
6300
5231
|
}
|
6301
5232
|
|
6302
|
-
var
|
6303
|
-
|
6304
|
-
throw TypeError("Cannot " + msg);
|
5233
|
+
var __typeError$1 = (msg) => {
|
5234
|
+
throw TypeError(msg);
|
6305
5235
|
};
|
6306
|
-
var
|
6307
|
-
|
6308
|
-
|
6309
|
-
|
6310
|
-
};
|
6311
|
-
var __privateMethod$1 = (obj, member, method) => {
|
6312
|
-
__accessCheck$1(obj, member, "access private method");
|
6313
|
-
return method;
|
6314
|
-
};
|
6315
|
-
var _search, search_fn;
|
5236
|
+
var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
|
5237
|
+
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);
|
5238
|
+
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
5239
|
+
var _SearchPlugin_instances, search_fn;
|
6316
5240
|
class SearchPlugin extends XataPlugin {
|
6317
5241
|
constructor(db) {
|
6318
5242
|
super();
|
6319
5243
|
this.db = db;
|
6320
|
-
__privateAdd$1(this,
|
5244
|
+
__privateAdd$1(this, _SearchPlugin_instances);
|
6321
5245
|
}
|
6322
5246
|
build(pluginOptions) {
|
6323
5247
|
return {
|
6324
5248
|
all: async (query, options = {}) => {
|
6325
|
-
const { records, totalCount } = await __privateMethod$1(this,
|
5249
|
+
const { records, totalCount } = await __privateMethod$1(this, _SearchPlugin_instances, search_fn).call(this, query, options, pluginOptions);
|
6326
5250
|
return {
|
6327
5251
|
totalCount,
|
6328
5252
|
records: records.map((record) => {
|
@@ -6332,7 +5256,7 @@ class SearchPlugin extends XataPlugin {
|
|
6332
5256
|
};
|
6333
5257
|
},
|
6334
5258
|
byTable: async (query, options = {}) => {
|
6335
|
-
const { records: rawRecords, totalCount } = await __privateMethod$1(this,
|
5259
|
+
const { records: rawRecords, totalCount } = await __privateMethod$1(this, _SearchPlugin_instances, search_fn).call(this, query, options, pluginOptions);
|
6336
5260
|
const records = rawRecords.reduce((acc, record) => {
|
6337
5261
|
const { table = "orphan" } = record.xata;
|
6338
5262
|
const items = acc[table] ?? [];
|
@@ -6344,7 +5268,7 @@ class SearchPlugin extends XataPlugin {
|
|
6344
5268
|
};
|
6345
5269
|
}
|
6346
5270
|
}
|
6347
|
-
|
5271
|
+
_SearchPlugin_instances = new WeakSet();
|
6348
5272
|
search_fn = async function(query, options, pluginOptions) {
|
6349
5273
|
const { tables, fuzziness, highlight, prefix, page } = options ?? {};
|
6350
5274
|
const { records, totalCount } = await searchBranch({
|
@@ -6380,8 +5304,7 @@ function arrayString(val) {
|
|
6380
5304
|
return result;
|
6381
5305
|
}
|
6382
5306
|
function prepareValue(value) {
|
6383
|
-
if (!isDefined(value))
|
6384
|
-
return null;
|
5307
|
+
if (!isDefined(value)) return null;
|
6385
5308
|
if (value instanceof Date) {
|
6386
5309
|
return value.toISOString();
|
6387
5310
|
}
|
@@ -6421,19 +5344,28 @@ class SQLPlugin extends XataPlugin {
|
|
6421
5344
|
throw new Error("Invalid usage of `xata.sql`. Please use it as a tagged template or with an object.");
|
6422
5345
|
}
|
6423
5346
|
const { statement, params, consistency, responseType } = prepareParams(query, parameters);
|
6424
|
-
const {
|
6425
|
-
records,
|
6426
|
-
rows,
|
6427
|
-
warning,
|
6428
|
-
columns = []
|
6429
|
-
} = await sqlQuery({
|
5347
|
+
const { warning, columns, ...response } = await sqlQuery({
|
6430
5348
|
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
6431
5349
|
body: { statement, params, consistency, responseType },
|
6432
5350
|
...pluginOptions
|
6433
5351
|
});
|
5352
|
+
const records = "records" in response ? response.records : void 0;
|
5353
|
+
const rows = "rows" in response ? response.rows : void 0;
|
6434
5354
|
return { records, rows, warning, columns };
|
6435
5355
|
};
|
6436
5356
|
sqlFunction.connectionString = buildConnectionString(pluginOptions);
|
5357
|
+
sqlFunction.batch = async (query) => {
|
5358
|
+
const { results } = await sqlBatchQuery({
|
5359
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
5360
|
+
body: {
|
5361
|
+
statements: query.statements.map(({ statement, params }) => ({ statement, params })),
|
5362
|
+
consistency: query.consistency,
|
5363
|
+
responseType: query.responseType
|
5364
|
+
},
|
5365
|
+
...pluginOptions
|
5366
|
+
});
|
5367
|
+
return { results };
|
5368
|
+
};
|
6437
5369
|
return sqlFunction;
|
6438
5370
|
}
|
6439
5371
|
}
|
@@ -6460,8 +5392,7 @@ function buildDomain(host, region) {
|
|
6460
5392
|
function buildConnectionString({ apiKey, workspacesApiUrl, branch }) {
|
6461
5393
|
const url = isString(workspacesApiUrl) ? workspacesApiUrl : workspacesApiUrl("", {});
|
6462
5394
|
const parts = parseWorkspacesUrlParts(url);
|
6463
|
-
if (!parts)
|
6464
|
-
throw new Error("Invalid workspaces URL");
|
5395
|
+
if (!parts) throw new Error("Invalid workspaces URL");
|
6465
5396
|
const { workspace: workspaceSlug, region, database, host } = parts;
|
6466
5397
|
const domain = buildDomain(host, region);
|
6467
5398
|
const workspace = workspaceSlug.split("-").pop();
|
@@ -6486,39 +5417,24 @@ class TransactionPlugin extends XataPlugin {
|
|
6486
5417
|
}
|
6487
5418
|
}
|
6488
5419
|
|
6489
|
-
var
|
6490
|
-
|
6491
|
-
throw TypeError("Cannot " + msg);
|
6492
|
-
};
|
6493
|
-
var __privateGet = (obj, member, getter) => {
|
6494
|
-
__accessCheck(obj, member, "read from private field");
|
6495
|
-
return getter ? getter.call(obj) : member.get(obj);
|
6496
|
-
};
|
6497
|
-
var __privateAdd = (obj, member, value) => {
|
6498
|
-
if (member.has(obj))
|
6499
|
-
throw TypeError("Cannot add the same private member more than once");
|
6500
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
6501
|
-
};
|
6502
|
-
var __privateSet = (obj, member, value, setter) => {
|
6503
|
-
__accessCheck(obj, member, "write to private field");
|
6504
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
6505
|
-
return value;
|
6506
|
-
};
|
6507
|
-
var __privateMethod = (obj, member, method) => {
|
6508
|
-
__accessCheck(obj, member, "access private method");
|
6509
|
-
return method;
|
5420
|
+
var __typeError = (msg) => {
|
5421
|
+
throw TypeError(msg);
|
6510
5422
|
};
|
5423
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
5424
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
5425
|
+
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);
|
5426
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
5427
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
6511
5428
|
const buildClient = (plugins) => {
|
6512
|
-
var _options,
|
5429
|
+
var _options, _instances, parseOptions_fn, getFetchProps_fn, _a;
|
6513
5430
|
return _a = class {
|
6514
5431
|
constructor(options = {}, tables) {
|
6515
|
-
__privateAdd(this,
|
6516
|
-
__privateAdd(this,
|
6517
|
-
|
6518
|
-
const safeOptions = __privateMethod(this, _parseOptions, parseOptions_fn).call(this, options);
|
5432
|
+
__privateAdd(this, _instances);
|
5433
|
+
__privateAdd(this, _options);
|
5434
|
+
const safeOptions = __privateMethod(this, _instances, parseOptions_fn).call(this, options);
|
6519
5435
|
__privateSet(this, _options, safeOptions);
|
6520
5436
|
const pluginOptions = {
|
6521
|
-
...__privateMethod(this,
|
5437
|
+
...__privateMethod(this, _instances, getFetchProps_fn).call(this, safeOptions),
|
6522
5438
|
cache: safeOptions.cache,
|
6523
5439
|
host: safeOptions.host,
|
6524
5440
|
tables,
|
@@ -6536,8 +5452,7 @@ const buildClient = (plugins) => {
|
|
6536
5452
|
this.sql = sql;
|
6537
5453
|
this.files = files;
|
6538
5454
|
for (const [key, namespace] of Object.entries(plugins ?? {})) {
|
6539
|
-
if (namespace === void 0)
|
6540
|
-
continue;
|
5455
|
+
if (namespace === void 0) continue;
|
6541
5456
|
this[key] = namespace.build(pluginOptions);
|
6542
5457
|
}
|
6543
5458
|
}
|
@@ -6546,7 +5461,7 @@ const buildClient = (plugins) => {
|
|
6546
5461
|
const branch = __privateGet(this, _options).branch;
|
6547
5462
|
return { databaseURL, branch };
|
6548
5463
|
}
|
6549
|
-
}, _options = new WeakMap(),
|
5464
|
+
}, _options = new WeakMap(), _instances = new WeakSet(), parseOptions_fn = function(options) {
|
6550
5465
|
const enableBrowser = options?.enableBrowser ?? getEnableBrowserVariable() ?? false;
|
6551
5466
|
const isBrowser = typeof window !== "undefined" && typeof Deno === "undefined";
|
6552
5467
|
if (isBrowser && !enableBrowser) {
|
@@ -6601,7 +5516,7 @@ const buildClient = (plugins) => {
|
|
6601
5516
|
clientName,
|
6602
5517
|
xataAgentExtra
|
6603
5518
|
};
|
6604
|
-
},
|
5519
|
+
}, getFetchProps_fn = function({
|
6605
5520
|
fetch,
|
6606
5521
|
apiKey,
|
6607
5522
|
databaseURL,
|
@@ -6642,26 +5557,19 @@ class Serializer {
|
|
6642
5557
|
}
|
6643
5558
|
toJSON(data) {
|
6644
5559
|
function visit(obj) {
|
6645
|
-
if (Array.isArray(obj))
|
6646
|
-
return obj.map(visit);
|
5560
|
+
if (Array.isArray(obj)) return obj.map(visit);
|
6647
5561
|
const type = typeof obj;
|
6648
|
-
if (type === "undefined")
|
6649
|
-
|
6650
|
-
if (
|
6651
|
-
return { [META]: "bigint", [VALUE]: obj.toString() };
|
6652
|
-
if (obj === null || type !== "object")
|
6653
|
-
return obj;
|
5562
|
+
if (type === "undefined") return { [META]: "undefined" };
|
5563
|
+
if (type === "bigint") return { [META]: "bigint", [VALUE]: obj.toString() };
|
5564
|
+
if (obj === null || type !== "object") return obj;
|
6654
5565
|
const constructor = obj.constructor;
|
6655
5566
|
const o = { [META]: constructor.name };
|
6656
5567
|
for (const [key, value] of Object.entries(obj)) {
|
6657
5568
|
o[key] = visit(value);
|
6658
5569
|
}
|
6659
|
-
if (constructor === Date)
|
6660
|
-
|
6661
|
-
if (constructor ===
|
6662
|
-
o[VALUE] = Object.fromEntries(obj);
|
6663
|
-
if (constructor === Set)
|
6664
|
-
o[VALUE] = [...obj];
|
5570
|
+
if (constructor === Date) o[VALUE] = obj.toISOString();
|
5571
|
+
if (constructor === Map) o[VALUE] = Object.fromEntries(obj);
|
5572
|
+
if (constructor === Set) o[VALUE] = [...obj];
|
6665
5573
|
return o;
|
6666
5574
|
}
|
6667
5575
|
return JSON.stringify(visit(data));
|
@@ -6674,16 +5582,11 @@ class Serializer {
|
|
6674
5582
|
if (constructor) {
|
6675
5583
|
return Object.assign(Object.create(constructor.prototype), rest);
|
6676
5584
|
}
|
6677
|
-
if (clazz === "Date")
|
6678
|
-
|
6679
|
-
if (clazz === "
|
6680
|
-
|
6681
|
-
if (clazz === "
|
6682
|
-
return new Map(Object.entries(val));
|
6683
|
-
if (clazz === "bigint")
|
6684
|
-
return BigInt(val);
|
6685
|
-
if (clazz === "undefined")
|
6686
|
-
return void 0;
|
5585
|
+
if (clazz === "Date") return new Date(val);
|
5586
|
+
if (clazz === "Set") return new Set(val);
|
5587
|
+
if (clazz === "Map") return new Map(Object.entries(val));
|
5588
|
+
if (clazz === "bigint") return BigInt(val);
|
5589
|
+
if (clazz === "undefined") return void 0;
|
6687
5590
|
return rest;
|
6688
5591
|
}
|
6689
5592
|
return value;
|
@@ -6751,9 +5654,11 @@ exports.cancelWorkspaceMemberInvite = cancelWorkspaceMemberInvite;
|
|
6751
5654
|
exports.compareBranchSchemas = compareBranchSchemas;
|
6752
5655
|
exports.compareBranchWithUserSchema = compareBranchWithUserSchema;
|
6753
5656
|
exports.compareMigrationRequest = compareMigrationRequest;
|
5657
|
+
exports.completeMigration = completeMigration;
|
6754
5658
|
exports.contains = contains;
|
6755
5659
|
exports.copyBranch = copyBranch;
|
6756
5660
|
exports.createBranch = createBranch;
|
5661
|
+
exports.createBranchAsync = createBranchAsync;
|
6757
5662
|
exports.createCluster = createCluster;
|
6758
5663
|
exports.createDatabase = createDatabase;
|
6759
5664
|
exports.createMigrationRequest = createMigrationRequest;
|
@@ -6761,6 +5666,7 @@ exports.createTable = createTable;
|
|
6761
5666
|
exports.createUserAPIKey = createUserAPIKey;
|
6762
5667
|
exports.createWorkspace = createWorkspace;
|
6763
5668
|
exports.deleteBranch = deleteBranch;
|
5669
|
+
exports.deleteCluster = deleteCluster;
|
6764
5670
|
exports.deleteColumn = deleteColumn;
|
6765
5671
|
exports.deleteDatabase = deleteDatabase;
|
6766
5672
|
exports.deleteDatabaseGithubSettings = deleteDatabaseGithubSettings;
|
@@ -6774,6 +5680,7 @@ exports.deleteUserAPIKey = deleteUserAPIKey;
|
|
6774
5680
|
exports.deleteUserOAuthClient = deleteUserOAuthClient;
|
6775
5681
|
exports.deleteWorkspace = deleteWorkspace;
|
6776
5682
|
exports.deserialize = deserialize;
|
5683
|
+
exports.dropClusterExtension = dropClusterExtension;
|
6777
5684
|
exports.endsWith = endsWith;
|
6778
5685
|
exports.equals = equals;
|
6779
5686
|
exports.executeBranchMigrationPlan = executeBranchMigrationPlan;
|
@@ -6790,9 +5697,11 @@ exports.getBranchMetadata = getBranchMetadata;
|
|
6790
5697
|
exports.getBranchMigrationHistory = getBranchMigrationHistory;
|
6791
5698
|
exports.getBranchMigrationJobStatus = getBranchMigrationJobStatus;
|
6792
5699
|
exports.getBranchMigrationPlan = getBranchMigrationPlan;
|
5700
|
+
exports.getBranchMoveStatus = getBranchMoveStatus;
|
6793
5701
|
exports.getBranchSchemaHistory = getBranchSchemaHistory;
|
6794
5702
|
exports.getBranchStats = getBranchStats;
|
6795
5703
|
exports.getCluster = getCluster;
|
5704
|
+
exports.getClusterMetrics = getClusterMetrics;
|
6796
5705
|
exports.getColumn = getColumn;
|
6797
5706
|
exports.getDatabaseGithubSettings = getDatabaseGithubSettings;
|
6798
5707
|
exports.getDatabaseList = getDatabaseList;
|
@@ -6805,13 +5714,17 @@ exports.getGitBranchesMapping = getGitBranchesMapping;
|
|
6805
5714
|
exports.getHostUrl = getHostUrl;
|
6806
5715
|
exports.getMigrationHistory = getMigrationHistory;
|
6807
5716
|
exports.getMigrationJobStatus = getMigrationJobStatus;
|
5717
|
+
exports.getMigrationJobs = getMigrationJobs;
|
6808
5718
|
exports.getMigrationRequest = getMigrationRequest;
|
6809
5719
|
exports.getMigrationRequestIsMerged = getMigrationRequestIsMerged;
|
6810
5720
|
exports.getPreviewBranch = getPreviewBranch;
|
6811
5721
|
exports.getRecord = getRecord;
|
6812
5722
|
exports.getSchema = getSchema;
|
5723
|
+
exports.getSchemas = getSchemas;
|
6813
5724
|
exports.getTableColumns = getTableColumns;
|
6814
5725
|
exports.getTableSchema = getTableSchema;
|
5726
|
+
exports.getTaskStatus = getTaskStatus;
|
5727
|
+
exports.getTasks = getTasks;
|
6815
5728
|
exports.getUser = getUser;
|
6816
5729
|
exports.getUserAPIKeys = getUserAPIKeys;
|
6817
5730
|
exports.getUserOAuthAccessTokens = getUserOAuthAccessTokens;
|
@@ -6834,6 +5747,7 @@ exports.includesAny = includesAny;
|
|
6834
5747
|
exports.includesNone = includesNone;
|
6835
5748
|
exports.insertRecord = insertRecord;
|
6836
5749
|
exports.insertRecordWithID = insertRecordWithID;
|
5750
|
+
exports.installClusterExtension = installClusterExtension;
|
6837
5751
|
exports.inviteWorkspaceMember = inviteWorkspaceMember;
|
6838
5752
|
exports.is = is;
|
6839
5753
|
exports.isCursorPaginationOptions = isCursorPaginationOptions;
|
@@ -6848,12 +5762,15 @@ exports.le = le;
|
|
6848
5762
|
exports.lessEquals = lessEquals;
|
6849
5763
|
exports.lessThan = lessThan;
|
6850
5764
|
exports.lessThanEquals = lessThanEquals;
|
5765
|
+
exports.listClusterBranches = listClusterBranches;
|
5766
|
+
exports.listClusterExtensions = listClusterExtensions;
|
6851
5767
|
exports.listClusters = listClusters;
|
6852
5768
|
exports.listMigrationRequestsCommits = listMigrationRequestsCommits;
|
6853
5769
|
exports.listRegions = listRegions;
|
6854
5770
|
exports.lt = lt;
|
6855
5771
|
exports.lte = lte;
|
6856
5772
|
exports.mergeMigrationRequest = mergeMigrationRequest;
|
5773
|
+
exports.moveBranch = moveBranch;
|
6857
5774
|
exports.notExists = notExists;
|
6858
5775
|
exports.operationsByTag = operationsByTag;
|
6859
5776
|
exports.parseProviderString = parseProviderString;
|
@@ -6870,11 +5787,14 @@ exports.removeWorkspaceMember = removeWorkspaceMember;
|
|
6870
5787
|
exports.renameDatabase = renameDatabase;
|
6871
5788
|
exports.resendWorkspaceMemberInvite = resendWorkspaceMemberInvite;
|
6872
5789
|
exports.resolveBranch = resolveBranch;
|
5790
|
+
exports.rollbackMigration = rollbackMigration;
|
6873
5791
|
exports.searchBranch = searchBranch;
|
6874
5792
|
exports.searchTable = searchTable;
|
6875
5793
|
exports.serialize = serialize;
|
6876
5794
|
exports.setTableSchema = setTableSchema;
|
5795
|
+
exports.sqlBatchQuery = sqlBatchQuery;
|
6877
5796
|
exports.sqlQuery = sqlQuery;
|
5797
|
+
exports.startMigration = startMigration;
|
6878
5798
|
exports.startsWith = startsWith;
|
6879
5799
|
exports.summarizeTable = summarizeTable;
|
6880
5800
|
exports.transformImage = transformImage;
|