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