@xata.io/client 0.29.4 → 0.29.5
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 +6 -0
- package/dist/index.cjs +635 -517
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +395 -15
- package/dist/index.mjs +631 -518
- 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$8 = (msg) => {
|
2028
|
+
throw TypeError(msg);
|
2074
2029
|
};
|
2075
|
-
var
|
2030
|
+
var __accessCheck$8 = (obj, member, msg) => member.has(obj) || __typeError$8("Cannot " + msg);
|
2031
|
+
var __privateGet$7 = (obj, member, getter) => (__accessCheck$8(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
2032
|
+
var __privateAdd$8 = (obj, member, value) => member.has(obj) ? __typeError$8("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
2033
|
+
var __privateSet$6 = (obj, member, value, setter) => (__accessCheck$8(obj, member, "write to private field"), member.set(obj, value), value);
|
2034
|
+
var __privateMethod$4 = (obj, member, method) => (__accessCheck$8(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,10 +2045,10 @@ function getFetchImplementation(userFetch) {
|
|
2085
2045
|
}
|
2086
2046
|
class ApiRequestPool {
|
2087
2047
|
constructor(concurrency = 10) {
|
2088
|
-
__privateAdd$8(this,
|
2089
|
-
__privateAdd$8(this, _fetch
|
2090
|
-
__privateAdd$8(this, _queue
|
2091
|
-
__privateAdd$8(this, _concurrency
|
2048
|
+
__privateAdd$8(this, _ApiRequestPool_instances);
|
2049
|
+
__privateAdd$8(this, _fetch);
|
2050
|
+
__privateAdd$8(this, _queue);
|
2051
|
+
__privateAdd$8(this, _concurrency);
|
2092
2052
|
__privateSet$6(this, _queue, []);
|
2093
2053
|
__privateSet$6(this, _concurrency, concurrency);
|
2094
2054
|
this.running = 0;
|
@@ -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,7 +2091,7 @@ 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
2096
|
const promise = new Promise((resolve) => __privateGet$7(this, _queue).push(resolve)).finally(() => {
|
2137
2097
|
this.started--;
|
@@ -2334,7 +2294,7 @@ function defaultOnOpen(response) {
|
|
2334
2294
|
}
|
2335
2295
|
}
|
2336
2296
|
|
2337
|
-
const VERSION = "0.29.
|
2297
|
+
const VERSION = "0.29.5";
|
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,30 @@ function parseUrl(url) {
|
|
2653
2606
|
|
2654
2607
|
const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
|
2655
2608
|
|
2656
|
-
const applyMigration = (variables, signal) => dataPlaneFetch({
|
2609
|
+
const applyMigration = (variables, signal) => dataPlaneFetch({
|
2610
|
+
url: "/db/{dbBranchName}/migrations/apply",
|
2611
|
+
method: "post",
|
2612
|
+
...variables,
|
2613
|
+
signal
|
2614
|
+
});
|
2615
|
+
const startMigration = (variables, signal) => dataPlaneFetch({
|
2616
|
+
url: "/db/{dbBranchName}/migrations/start",
|
2617
|
+
method: "post",
|
2618
|
+
...variables,
|
2619
|
+
signal
|
2620
|
+
});
|
2621
|
+
const completeMigration = (variables, signal) => dataPlaneFetch({
|
2622
|
+
url: "/db/{dbBranchName}/migrations/complete",
|
2623
|
+
method: "post",
|
2624
|
+
...variables,
|
2625
|
+
signal
|
2626
|
+
});
|
2627
|
+
const rollbackMigration = (variables, signal) => dataPlaneFetch({
|
2628
|
+
url: "/db/{dbBranchName}/migrations/rollback",
|
2629
|
+
method: "post",
|
2630
|
+
...variables,
|
2631
|
+
signal
|
2632
|
+
});
|
2657
2633
|
const adaptTable = (variables, signal) => dataPlaneFetch({
|
2658
2634
|
url: "/db/{dbBranchName}/migrations/adapt/{tableName}",
|
2659
2635
|
method: "post",
|
@@ -2666,9 +2642,24 @@ const adaptAllTables = (variables, signal) => dataPlaneFetch({
|
|
2666
2642
|
...variables,
|
2667
2643
|
signal
|
2668
2644
|
});
|
2669
|
-
const getBranchMigrationJobStatus = (variables, signal) => dataPlaneFetch({
|
2670
|
-
|
2671
|
-
|
2645
|
+
const getBranchMigrationJobStatus = (variables, signal) => dataPlaneFetch({
|
2646
|
+
url: "/db/{dbBranchName}/migrations/status",
|
2647
|
+
method: "get",
|
2648
|
+
...variables,
|
2649
|
+
signal
|
2650
|
+
});
|
2651
|
+
const getMigrationJobStatus = (variables, signal) => dataPlaneFetch({
|
2652
|
+
url: "/db/{dbBranchName}/migrations/jobs/{jobId}",
|
2653
|
+
method: "get",
|
2654
|
+
...variables,
|
2655
|
+
signal
|
2656
|
+
});
|
2657
|
+
const getMigrationHistory = (variables, signal) => dataPlaneFetch({
|
2658
|
+
url: "/db/{dbBranchName}/migrations/history",
|
2659
|
+
method: "get",
|
2660
|
+
...variables,
|
2661
|
+
signal
|
2662
|
+
});
|
2672
2663
|
const getBranchList = (variables, signal) => dataPlaneFetch({
|
2673
2664
|
url: "/dbs/{dbName}",
|
2674
2665
|
method: "get",
|
@@ -2727,12 +2718,42 @@ const getBranchStats = (variables, signal) => dataPlaneFetch({
|
|
2727
2718
|
});
|
2728
2719
|
const getGitBranchesMapping = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables, signal });
|
2729
2720
|
const addGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables, signal });
|
2730
|
-
const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({
|
2731
|
-
|
2732
|
-
|
2733
|
-
|
2734
|
-
|
2735
|
-
|
2721
|
+
const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({
|
2722
|
+
url: "/dbs/{dbName}/gitBranches",
|
2723
|
+
method: "delete",
|
2724
|
+
...variables,
|
2725
|
+
signal
|
2726
|
+
});
|
2727
|
+
const resolveBranch = (variables, signal) => dataPlaneFetch({
|
2728
|
+
url: "/dbs/{dbName}/resolveBranch",
|
2729
|
+
method: "get",
|
2730
|
+
...variables,
|
2731
|
+
signal
|
2732
|
+
});
|
2733
|
+
const getBranchMigrationHistory = (variables, signal) => dataPlaneFetch({
|
2734
|
+
url: "/db/{dbBranchName}/migrations",
|
2735
|
+
method: "get",
|
2736
|
+
...variables,
|
2737
|
+
signal
|
2738
|
+
});
|
2739
|
+
const getBranchMigrationPlan = (variables, signal) => dataPlaneFetch({
|
2740
|
+
url: "/db/{dbBranchName}/migrations/plan",
|
2741
|
+
method: "post",
|
2742
|
+
...variables,
|
2743
|
+
signal
|
2744
|
+
});
|
2745
|
+
const executeBranchMigrationPlan = (variables, signal) => dataPlaneFetch({
|
2746
|
+
url: "/db/{dbBranchName}/migrations/execute",
|
2747
|
+
method: "post",
|
2748
|
+
...variables,
|
2749
|
+
signal
|
2750
|
+
});
|
2751
|
+
const queryMigrationRequests = (variables, signal) => dataPlaneFetch({
|
2752
|
+
url: "/dbs/{dbName}/migrations/query",
|
2753
|
+
method: "post",
|
2754
|
+
...variables,
|
2755
|
+
signal
|
2756
|
+
});
|
2736
2757
|
const createMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
2737
2758
|
const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2738
2759
|
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
@@ -2740,23 +2761,78 @@ const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
|
2740
2761
|
...variables,
|
2741
2762
|
signal
|
2742
2763
|
});
|
2743
|
-
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2744
|
-
|
2745
|
-
|
2746
|
-
|
2764
|
+
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2765
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
2766
|
+
method: "patch",
|
2767
|
+
...variables,
|
2768
|
+
signal
|
2769
|
+
});
|
2770
|
+
const listMigrationRequestsCommits = (variables, signal) => dataPlaneFetch({
|
2771
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/commits",
|
2772
|
+
method: "post",
|
2773
|
+
...variables,
|
2774
|
+
signal
|
2775
|
+
});
|
2776
|
+
const compareMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2777
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/compare",
|
2778
|
+
method: "post",
|
2779
|
+
...variables,
|
2780
|
+
signal
|
2781
|
+
});
|
2782
|
+
const getMigrationRequestIsMerged = (variables, signal) => dataPlaneFetch({
|
2783
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
2784
|
+
method: "get",
|
2785
|
+
...variables,
|
2786
|
+
signal
|
2787
|
+
});
|
2747
2788
|
const mergeMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2748
2789
|
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
2749
2790
|
method: "post",
|
2750
2791
|
...variables,
|
2751
2792
|
signal
|
2752
2793
|
});
|
2753
|
-
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({
|
2754
|
-
|
2755
|
-
|
2756
|
-
|
2757
|
-
|
2758
|
-
|
2759
|
-
const
|
2794
|
+
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({
|
2795
|
+
url: "/db/{dbBranchName}/schema/history",
|
2796
|
+
method: "post",
|
2797
|
+
...variables,
|
2798
|
+
signal
|
2799
|
+
});
|
2800
|
+
const compareBranchWithUserSchema = (variables, signal) => dataPlaneFetch({
|
2801
|
+
url: "/db/{dbBranchName}/schema/compare",
|
2802
|
+
method: "post",
|
2803
|
+
...variables,
|
2804
|
+
signal
|
2805
|
+
});
|
2806
|
+
const compareBranchSchemas = (variables, signal) => dataPlaneFetch({
|
2807
|
+
url: "/db/{dbBranchName}/schema/compare/{branchName}",
|
2808
|
+
method: "post",
|
2809
|
+
...variables,
|
2810
|
+
signal
|
2811
|
+
});
|
2812
|
+
const updateBranchSchema = (variables, signal) => dataPlaneFetch({
|
2813
|
+
url: "/db/{dbBranchName}/schema/update",
|
2814
|
+
method: "post",
|
2815
|
+
...variables,
|
2816
|
+
signal
|
2817
|
+
});
|
2818
|
+
const previewBranchSchemaEdit = (variables, signal) => dataPlaneFetch({
|
2819
|
+
url: "/db/{dbBranchName}/schema/preview",
|
2820
|
+
method: "post",
|
2821
|
+
...variables,
|
2822
|
+
signal
|
2823
|
+
});
|
2824
|
+
const applyBranchSchemaEdit = (variables, signal) => dataPlaneFetch({
|
2825
|
+
url: "/db/{dbBranchName}/schema/apply",
|
2826
|
+
method: "post",
|
2827
|
+
...variables,
|
2828
|
+
signal
|
2829
|
+
});
|
2830
|
+
const pushBranchMigrations = (variables, signal) => dataPlaneFetch({
|
2831
|
+
url: "/db/{dbBranchName}/schema/push",
|
2832
|
+
method: "post",
|
2833
|
+
...variables,
|
2834
|
+
signal
|
2835
|
+
});
|
2760
2836
|
const createTable = (variables, signal) => dataPlaneFetch({
|
2761
2837
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
2762
2838
|
method: "put",
|
@@ -2769,14 +2845,24 @@ const deleteTable = (variables, signal) => dataPlaneFetch({
|
|
2769
2845
|
...variables,
|
2770
2846
|
signal
|
2771
2847
|
});
|
2772
|
-
const updateTable = (variables, signal) => dataPlaneFetch({
|
2848
|
+
const updateTable = (variables, signal) => dataPlaneFetch({
|
2849
|
+
url: "/db/{dbBranchName}/tables/{tableName}",
|
2850
|
+
method: "patch",
|
2851
|
+
...variables,
|
2852
|
+
signal
|
2853
|
+
});
|
2773
2854
|
const getTableSchema = (variables, signal) => dataPlaneFetch({
|
2774
2855
|
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
2775
2856
|
method: "get",
|
2776
2857
|
...variables,
|
2777
2858
|
signal
|
2778
2859
|
});
|
2779
|
-
const setTableSchema = (variables, signal) => dataPlaneFetch({
|
2860
|
+
const setTableSchema = (variables, signal) => dataPlaneFetch({
|
2861
|
+
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
2862
|
+
method: "put",
|
2863
|
+
...variables,
|
2864
|
+
signal
|
2865
|
+
});
|
2780
2866
|
const getTableColumns = (variables, signal) => dataPlaneFetch({
|
2781
2867
|
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
2782
2868
|
method: "get",
|
@@ -2784,7 +2870,12 @@ const getTableColumns = (variables, signal) => dataPlaneFetch({
|
|
2784
2870
|
signal
|
2785
2871
|
});
|
2786
2872
|
const addTableColumn = (variables, signal) => dataPlaneFetch(
|
2787
|
-
{
|
2873
|
+
{
|
2874
|
+
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
2875
|
+
method: "post",
|
2876
|
+
...variables,
|
2877
|
+
signal
|
2878
|
+
}
|
2788
2879
|
);
|
2789
2880
|
const getColumn = (variables, signal) => dataPlaneFetch({
|
2790
2881
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
@@ -2792,15 +2883,30 @@ const getColumn = (variables, signal) => dataPlaneFetch({
|
|
2792
2883
|
...variables,
|
2793
2884
|
signal
|
2794
2885
|
});
|
2795
|
-
const updateColumn = (variables, signal) => dataPlaneFetch({
|
2886
|
+
const updateColumn = (variables, signal) => dataPlaneFetch({
|
2887
|
+
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
2888
|
+
method: "patch",
|
2889
|
+
...variables,
|
2890
|
+
signal
|
2891
|
+
});
|
2796
2892
|
const deleteColumn = (variables, signal) => dataPlaneFetch({
|
2797
2893
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
2798
2894
|
method: "delete",
|
2799
2895
|
...variables,
|
2800
2896
|
signal
|
2801
2897
|
});
|
2802
|
-
const branchTransaction = (variables, signal) => dataPlaneFetch({
|
2803
|
-
|
2898
|
+
const branchTransaction = (variables, signal) => dataPlaneFetch({
|
2899
|
+
url: "/db/{dbBranchName}/transaction",
|
2900
|
+
method: "post",
|
2901
|
+
...variables,
|
2902
|
+
signal
|
2903
|
+
});
|
2904
|
+
const insertRecord = (variables, signal) => dataPlaneFetch({
|
2905
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data",
|
2906
|
+
method: "post",
|
2907
|
+
...variables,
|
2908
|
+
signal
|
2909
|
+
});
|
2804
2910
|
const getFileItem = (variables, signal) => dataPlaneFetch({
|
2805
2911
|
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file/{fileId}",
|
2806
2912
|
method: "get",
|
@@ -2843,11 +2949,36 @@ const getRecord = (variables, signal) => dataPlaneFetch({
|
|
2843
2949
|
...variables,
|
2844
2950
|
signal
|
2845
2951
|
});
|
2846
|
-
const insertRecordWithID = (variables, signal) => dataPlaneFetch({
|
2847
|
-
|
2848
|
-
|
2849
|
-
|
2850
|
-
|
2952
|
+
const insertRecordWithID = (variables, signal) => dataPlaneFetch({
|
2953
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
2954
|
+
method: "put",
|
2955
|
+
...variables,
|
2956
|
+
signal
|
2957
|
+
});
|
2958
|
+
const updateRecordWithID = (variables, signal) => dataPlaneFetch({
|
2959
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
2960
|
+
method: "patch",
|
2961
|
+
...variables,
|
2962
|
+
signal
|
2963
|
+
});
|
2964
|
+
const upsertRecordWithID = (variables, signal) => dataPlaneFetch({
|
2965
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
2966
|
+
method: "post",
|
2967
|
+
...variables,
|
2968
|
+
signal
|
2969
|
+
});
|
2970
|
+
const deleteRecord = (variables, signal) => dataPlaneFetch({
|
2971
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
2972
|
+
method: "delete",
|
2973
|
+
...variables,
|
2974
|
+
signal
|
2975
|
+
});
|
2976
|
+
const bulkInsertTableRecords = (variables, signal) => dataPlaneFetch({
|
2977
|
+
url: "/db/{dbBranchName}/tables/{tableName}/bulk",
|
2978
|
+
method: "post",
|
2979
|
+
...variables,
|
2980
|
+
signal
|
2981
|
+
});
|
2851
2982
|
const queryTable = (variables, signal) => dataPlaneFetch({
|
2852
2983
|
url: "/db/{dbBranchName}/tables/{tableName}/query",
|
2853
2984
|
method: "post",
|
@@ -2866,16 +2997,36 @@ const searchTable = (variables, signal) => dataPlaneFetch({
|
|
2866
2997
|
...variables,
|
2867
2998
|
signal
|
2868
2999
|
});
|
2869
|
-
const vectorSearchTable = (variables, signal) => dataPlaneFetch({
|
3000
|
+
const vectorSearchTable = (variables, signal) => dataPlaneFetch({
|
3001
|
+
url: "/db/{dbBranchName}/tables/{tableName}/vectorSearch",
|
3002
|
+
method: "post",
|
3003
|
+
...variables,
|
3004
|
+
signal
|
3005
|
+
});
|
2870
3006
|
const askTable = (variables, signal) => dataPlaneFetch({
|
2871
3007
|
url: "/db/{dbBranchName}/tables/{tableName}/ask",
|
2872
3008
|
method: "post",
|
2873
3009
|
...variables,
|
2874
3010
|
signal
|
2875
3011
|
});
|
2876
|
-
const askTableSession = (variables, signal) => dataPlaneFetch({
|
2877
|
-
|
2878
|
-
|
3012
|
+
const askTableSession = (variables, signal) => dataPlaneFetch({
|
3013
|
+
url: "/db/{dbBranchName}/tables/{tableName}/ask/{sessionId}",
|
3014
|
+
method: "post",
|
3015
|
+
...variables,
|
3016
|
+
signal
|
3017
|
+
});
|
3018
|
+
const summarizeTable = (variables, signal) => dataPlaneFetch({
|
3019
|
+
url: "/db/{dbBranchName}/tables/{tableName}/summarize",
|
3020
|
+
method: "post",
|
3021
|
+
...variables,
|
3022
|
+
signal
|
3023
|
+
});
|
3024
|
+
const aggregateTable = (variables, signal) => dataPlaneFetch({
|
3025
|
+
url: "/db/{dbBranchName}/tables/{tableName}/aggregate",
|
3026
|
+
method: "post",
|
3027
|
+
...variables,
|
3028
|
+
signal
|
3029
|
+
});
|
2879
3030
|
const fileAccess = (variables, signal) => dataPlaneFetch({
|
2880
3031
|
url: "/file/{fileId}",
|
2881
3032
|
method: "get",
|
@@ -2894,9 +3045,18 @@ const sqlQuery = (variables, signal) => dataPlaneFetch({
|
|
2894
3045
|
...variables,
|
2895
3046
|
signal
|
2896
3047
|
});
|
3048
|
+
const sqlBatchQuery = (variables, signal) => dataPlaneFetch({
|
3049
|
+
url: "/db/{dbBranchName}/sql/batch",
|
3050
|
+
method: "post",
|
3051
|
+
...variables,
|
3052
|
+
signal
|
3053
|
+
});
|
2897
3054
|
const operationsByTag$2 = {
|
2898
3055
|
migrations: {
|
2899
3056
|
applyMigration,
|
3057
|
+
startMigration,
|
3058
|
+
completeMigration,
|
3059
|
+
rollbackMigration,
|
2900
3060
|
adaptTable,
|
2901
3061
|
adaptAllTables,
|
2902
3062
|
getBranchMigrationJobStatus,
|
@@ -2961,7 +3121,16 @@ const operationsByTag$2 = {
|
|
2961
3121
|
deleteRecord,
|
2962
3122
|
bulkInsertTableRecords
|
2963
3123
|
},
|
2964
|
-
files: {
|
3124
|
+
files: {
|
3125
|
+
getFileItem,
|
3126
|
+
putFileItem,
|
3127
|
+
deleteFileItem,
|
3128
|
+
getFile,
|
3129
|
+
putFile,
|
3130
|
+
deleteFile,
|
3131
|
+
fileAccess,
|
3132
|
+
fileUpload
|
3133
|
+
},
|
2965
3134
|
searchAndFilter: {
|
2966
3135
|
queryTable,
|
2967
3136
|
searchBranch,
|
@@ -2972,7 +3141,7 @@ const operationsByTag$2 = {
|
|
2972
3141
|
summarizeTable,
|
2973
3142
|
aggregateTable
|
2974
3143
|
},
|
2975
|
-
sql: { sqlQuery }
|
3144
|
+
sql: { sqlQuery, sqlBatchQuery }
|
2976
3145
|
};
|
2977
3146
|
|
2978
3147
|
const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
|
@@ -3039,7 +3208,12 @@ const deleteOAuthAccessToken = (variables, signal) => controlPlaneFetch({
|
|
3039
3208
|
...variables,
|
3040
3209
|
signal
|
3041
3210
|
});
|
3042
|
-
const updateOAuthAccessToken = (variables, signal) => controlPlaneFetch({
|
3211
|
+
const updateOAuthAccessToken = (variables, signal) => controlPlaneFetch({
|
3212
|
+
url: "/user/oauth/tokens/{token}",
|
3213
|
+
method: "patch",
|
3214
|
+
...variables,
|
3215
|
+
signal
|
3216
|
+
});
|
3043
3217
|
const getWorkspacesList = (variables, signal) => controlPlaneFetch({
|
3044
3218
|
url: "/workspaces",
|
3045
3219
|
method: "get",
|
@@ -3070,49 +3244,150 @@ const deleteWorkspace = (variables, signal) => controlPlaneFetch({
|
|
3070
3244
|
...variables,
|
3071
3245
|
signal
|
3072
3246
|
});
|
3073
|
-
const getWorkspaceSettings = (variables, signal) => controlPlaneFetch({
|
3074
|
-
|
3075
|
-
|
3076
|
-
|
3247
|
+
const getWorkspaceSettings = (variables, signal) => controlPlaneFetch({
|
3248
|
+
url: "/workspaces/{workspaceId}/settings",
|
3249
|
+
method: "get",
|
3250
|
+
...variables,
|
3251
|
+
signal
|
3252
|
+
});
|
3253
|
+
const updateWorkspaceSettings = (variables, signal) => controlPlaneFetch({
|
3254
|
+
url: "/workspaces/{workspaceId}/settings",
|
3255
|
+
method: "patch",
|
3256
|
+
...variables,
|
3257
|
+
signal
|
3258
|
+
});
|
3259
|
+
const getWorkspaceMembersList = (variables, signal) => controlPlaneFetch({
|
3260
|
+
url: "/workspaces/{workspaceId}/members",
|
3261
|
+
method: "get",
|
3262
|
+
...variables,
|
3263
|
+
signal
|
3264
|
+
});
|
3265
|
+
const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({
|
3266
|
+
url: "/workspaces/{workspaceId}/members/{userId}",
|
3267
|
+
method: "put",
|
3268
|
+
...variables,
|
3269
|
+
signal
|
3270
|
+
});
|
3077
3271
|
const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
3078
3272
|
url: "/workspaces/{workspaceId}/members/{userId}",
|
3079
3273
|
method: "delete",
|
3080
3274
|
...variables,
|
3081
3275
|
signal
|
3082
3276
|
});
|
3083
|
-
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
3084
|
-
|
3085
|
-
|
3086
|
-
|
3087
|
-
|
3088
|
-
|
3089
|
-
const
|
3277
|
+
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
3278
|
+
url: "/workspaces/{workspaceId}/invites",
|
3279
|
+
method: "post",
|
3280
|
+
...variables,
|
3281
|
+
signal
|
3282
|
+
});
|
3283
|
+
const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3284
|
+
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
3285
|
+
method: "patch",
|
3286
|
+
...variables,
|
3287
|
+
signal
|
3288
|
+
});
|
3289
|
+
const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3290
|
+
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
3291
|
+
method: "delete",
|
3292
|
+
...variables,
|
3293
|
+
signal
|
3294
|
+
});
|
3295
|
+
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3296
|
+
url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept",
|
3297
|
+
method: "post",
|
3298
|
+
...variables,
|
3299
|
+
signal
|
3300
|
+
});
|
3301
|
+
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3302
|
+
url: "/workspaces/{workspaceId}/invites/{inviteId}/resend",
|
3303
|
+
method: "post",
|
3304
|
+
...variables,
|
3305
|
+
signal
|
3306
|
+
});
|
3307
|
+
const listClusters = (variables, signal) => controlPlaneFetch({
|
3308
|
+
url: "/workspaces/{workspaceId}/clusters",
|
3309
|
+
method: "get",
|
3310
|
+
...variables,
|
3311
|
+
signal
|
3312
|
+
});
|
3313
|
+
const createCluster = (variables, signal) => controlPlaneFetch({
|
3314
|
+
url: "/workspaces/{workspaceId}/clusters",
|
3315
|
+
method: "post",
|
3316
|
+
...variables,
|
3317
|
+
signal
|
3318
|
+
});
|
3090
3319
|
const getCluster = (variables, signal) => controlPlaneFetch({
|
3091
3320
|
url: "/workspaces/{workspaceId}/clusters/{clusterId}",
|
3092
3321
|
method: "get",
|
3093
3322
|
...variables,
|
3094
3323
|
signal
|
3095
3324
|
});
|
3096
|
-
const updateCluster = (variables, signal) => controlPlaneFetch({
|
3325
|
+
const updateCluster = (variables, signal) => controlPlaneFetch({
|
3326
|
+
url: "/workspaces/{workspaceId}/clusters/{clusterId}",
|
3327
|
+
method: "patch",
|
3328
|
+
...variables,
|
3329
|
+
signal
|
3330
|
+
});
|
3331
|
+
const deleteCluster = (variables, signal) => controlPlaneFetch({
|
3332
|
+
url: "/workspaces/{workspaceId}/clusters/{clusterId}",
|
3333
|
+
method: "delete",
|
3334
|
+
...variables,
|
3335
|
+
signal
|
3336
|
+
});
|
3097
3337
|
const getDatabaseList = (variables, signal) => controlPlaneFetch({
|
3098
3338
|
url: "/workspaces/{workspaceId}/dbs",
|
3099
3339
|
method: "get",
|
3100
3340
|
...variables,
|
3101
3341
|
signal
|
3102
3342
|
});
|
3103
|
-
const createDatabase = (variables, signal) => controlPlaneFetch({
|
3343
|
+
const createDatabase = (variables, signal) => controlPlaneFetch({
|
3344
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3345
|
+
method: "put",
|
3346
|
+
...variables,
|
3347
|
+
signal
|
3348
|
+
});
|
3104
3349
|
const deleteDatabase = (variables, signal) => controlPlaneFetch({
|
3105
3350
|
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3106
3351
|
method: "delete",
|
3107
3352
|
...variables,
|
3108
3353
|
signal
|
3109
3354
|
});
|
3110
|
-
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({
|
3111
|
-
|
3112
|
-
|
3113
|
-
|
3114
|
-
|
3115
|
-
|
3355
|
+
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({
|
3356
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3357
|
+
method: "get",
|
3358
|
+
...variables,
|
3359
|
+
signal
|
3360
|
+
});
|
3361
|
+
const updateDatabaseMetadata = (variables, signal) => controlPlaneFetch({
|
3362
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3363
|
+
method: "patch",
|
3364
|
+
...variables,
|
3365
|
+
signal
|
3366
|
+
});
|
3367
|
+
const renameDatabase = (variables, signal) => controlPlaneFetch({
|
3368
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/rename",
|
3369
|
+
method: "post",
|
3370
|
+
...variables,
|
3371
|
+
signal
|
3372
|
+
});
|
3373
|
+
const getDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({
|
3374
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/github",
|
3375
|
+
method: "get",
|
3376
|
+
...variables,
|
3377
|
+
signal
|
3378
|
+
});
|
3379
|
+
const updateDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({
|
3380
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/github",
|
3381
|
+
method: "put",
|
3382
|
+
...variables,
|
3383
|
+
signal
|
3384
|
+
});
|
3385
|
+
const deleteDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({
|
3386
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/github",
|
3387
|
+
method: "delete",
|
3388
|
+
...variables,
|
3389
|
+
signal
|
3390
|
+
});
|
3116
3391
|
const listRegions = (variables, signal) => controlPlaneFetch({
|
3117
3392
|
url: "/workspaces/{workspaceId}/regions",
|
3118
3393
|
method: "get",
|
@@ -3150,7 +3425,13 @@ const operationsByTag$1 = {
|
|
3150
3425
|
acceptWorkspaceMemberInvite,
|
3151
3426
|
resendWorkspaceMemberInvite
|
3152
3427
|
},
|
3153
|
-
xbcontrolOther: {
|
3428
|
+
xbcontrolOther: {
|
3429
|
+
listClusters,
|
3430
|
+
createCluster,
|
3431
|
+
getCluster,
|
3432
|
+
updateCluster,
|
3433
|
+
deleteCluster
|
3434
|
+
},
|
3154
3435
|
databases: {
|
3155
3436
|
getDatabaseList,
|
3156
3437
|
createDatabase,
|
@@ -3167,28 +3448,17 @@ const operationsByTag$1 = {
|
|
3167
3448
|
|
3168
3449
|
const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
|
3169
3450
|
|
3170
|
-
var
|
3171
|
-
|
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;
|
3451
|
+
var __typeError$7 = (msg) => {
|
3452
|
+
throw TypeError(msg);
|
3187
3453
|
};
|
3454
|
+
var __accessCheck$7 = (obj, member, msg) => member.has(obj) || __typeError$7("Cannot " + msg);
|
3455
|
+
var __privateGet$6 = (obj, member, getter) => (__accessCheck$7(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
3456
|
+
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);
|
3457
|
+
var __privateSet$5 = (obj, member, value, setter) => (__accessCheck$7(obj, member, "write to private field"), member.set(obj, value), value);
|
3188
3458
|
var _extraProps, _namespaces;
|
3189
3459
|
class XataApiClient {
|
3190
3460
|
constructor(options = {}) {
|
3191
|
-
__privateAdd$7(this, _extraProps
|
3461
|
+
__privateAdd$7(this, _extraProps);
|
3192
3462
|
__privateAdd$7(this, _namespaces, {});
|
3193
3463
|
const provider = options.host ?? "production";
|
3194
3464
|
const apiKey = options.apiKey ?? getAPIKey();
|
@@ -3209,38 +3479,31 @@ class XataApiClient {
|
|
3209
3479
|
});
|
3210
3480
|
}
|
3211
3481
|
get user() {
|
3212
|
-
if (!__privateGet$6(this, _namespaces).user)
|
3213
|
-
__privateGet$6(this, _namespaces).user = new UserApi(__privateGet$6(this, _extraProps));
|
3482
|
+
if (!__privateGet$6(this, _namespaces).user) __privateGet$6(this, _namespaces).user = new UserApi(__privateGet$6(this, _extraProps));
|
3214
3483
|
return __privateGet$6(this, _namespaces).user;
|
3215
3484
|
}
|
3216
3485
|
get authentication() {
|
3217
|
-
if (!__privateGet$6(this, _namespaces).authentication)
|
3218
|
-
__privateGet$6(this, _namespaces).authentication = new AuthenticationApi(__privateGet$6(this, _extraProps));
|
3486
|
+
if (!__privateGet$6(this, _namespaces).authentication) __privateGet$6(this, _namespaces).authentication = new AuthenticationApi(__privateGet$6(this, _extraProps));
|
3219
3487
|
return __privateGet$6(this, _namespaces).authentication;
|
3220
3488
|
}
|
3221
3489
|
get workspaces() {
|
3222
|
-
if (!__privateGet$6(this, _namespaces).workspaces)
|
3223
|
-
__privateGet$6(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$6(this, _extraProps));
|
3490
|
+
if (!__privateGet$6(this, _namespaces).workspaces) __privateGet$6(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$6(this, _extraProps));
|
3224
3491
|
return __privateGet$6(this, _namespaces).workspaces;
|
3225
3492
|
}
|
3226
3493
|
get invites() {
|
3227
|
-
if (!__privateGet$6(this, _namespaces).invites)
|
3228
|
-
__privateGet$6(this, _namespaces).invites = new InvitesApi(__privateGet$6(this, _extraProps));
|
3494
|
+
if (!__privateGet$6(this, _namespaces).invites) __privateGet$6(this, _namespaces).invites = new InvitesApi(__privateGet$6(this, _extraProps));
|
3229
3495
|
return __privateGet$6(this, _namespaces).invites;
|
3230
3496
|
}
|
3231
3497
|
get database() {
|
3232
|
-
if (!__privateGet$6(this, _namespaces).database)
|
3233
|
-
__privateGet$6(this, _namespaces).database = new DatabaseApi(__privateGet$6(this, _extraProps));
|
3498
|
+
if (!__privateGet$6(this, _namespaces).database) __privateGet$6(this, _namespaces).database = new DatabaseApi(__privateGet$6(this, _extraProps));
|
3234
3499
|
return __privateGet$6(this, _namespaces).database;
|
3235
3500
|
}
|
3236
3501
|
get branches() {
|
3237
|
-
if (!__privateGet$6(this, _namespaces).branches)
|
3238
|
-
__privateGet$6(this, _namespaces).branches = new BranchApi(__privateGet$6(this, _extraProps));
|
3502
|
+
if (!__privateGet$6(this, _namespaces).branches) __privateGet$6(this, _namespaces).branches = new BranchApi(__privateGet$6(this, _extraProps));
|
3239
3503
|
return __privateGet$6(this, _namespaces).branches;
|
3240
3504
|
}
|
3241
3505
|
get migrations() {
|
3242
|
-
if (!__privateGet$6(this, _namespaces).migrations)
|
3243
|
-
__privateGet$6(this, _namespaces).migrations = new MigrationsApi(__privateGet$6(this, _extraProps));
|
3506
|
+
if (!__privateGet$6(this, _namespaces).migrations) __privateGet$6(this, _namespaces).migrations = new MigrationsApi(__privateGet$6(this, _extraProps));
|
3244
3507
|
return __privateGet$6(this, _namespaces).migrations;
|
3245
3508
|
}
|
3246
3509
|
get migrationRequests() {
|
@@ -3249,23 +3512,19 @@ class XataApiClient {
|
|
3249
3512
|
return __privateGet$6(this, _namespaces).migrationRequests;
|
3250
3513
|
}
|
3251
3514
|
get tables() {
|
3252
|
-
if (!__privateGet$6(this, _namespaces).tables)
|
3253
|
-
__privateGet$6(this, _namespaces).tables = new TableApi(__privateGet$6(this, _extraProps));
|
3515
|
+
if (!__privateGet$6(this, _namespaces).tables) __privateGet$6(this, _namespaces).tables = new TableApi(__privateGet$6(this, _extraProps));
|
3254
3516
|
return __privateGet$6(this, _namespaces).tables;
|
3255
3517
|
}
|
3256
3518
|
get records() {
|
3257
|
-
if (!__privateGet$6(this, _namespaces).records)
|
3258
|
-
__privateGet$6(this, _namespaces).records = new RecordsApi(__privateGet$6(this, _extraProps));
|
3519
|
+
if (!__privateGet$6(this, _namespaces).records) __privateGet$6(this, _namespaces).records = new RecordsApi(__privateGet$6(this, _extraProps));
|
3259
3520
|
return __privateGet$6(this, _namespaces).records;
|
3260
3521
|
}
|
3261
3522
|
get files() {
|
3262
|
-
if (!__privateGet$6(this, _namespaces).files)
|
3263
|
-
__privateGet$6(this, _namespaces).files = new FilesApi(__privateGet$6(this, _extraProps));
|
3523
|
+
if (!__privateGet$6(this, _namespaces).files) __privateGet$6(this, _namespaces).files = new FilesApi(__privateGet$6(this, _extraProps));
|
3264
3524
|
return __privateGet$6(this, _namespaces).files;
|
3265
3525
|
}
|
3266
3526
|
get searchAndFilter() {
|
3267
|
-
if (!__privateGet$6(this, _namespaces).searchAndFilter)
|
3268
|
-
__privateGet$6(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$6(this, _extraProps));
|
3527
|
+
if (!__privateGet$6(this, _namespaces).searchAndFilter) __privateGet$6(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$6(this, _extraProps));
|
3269
3528
|
return __privateGet$6(this, _namespaces).searchAndFilter;
|
3270
3529
|
}
|
3271
3530
|
}
|
@@ -4542,8 +4801,7 @@ function buildTransformString(transformations) {
|
|
4542
4801
|
).join(",");
|
4543
4802
|
}
|
4544
4803
|
function transformImage(url, ...transformations) {
|
4545
|
-
if (!isDefined(url))
|
4546
|
-
return void 0;
|
4804
|
+
if (!isDefined(url)) return void 0;
|
4547
4805
|
const newTransformations = buildTransformString(transformations);
|
4548
4806
|
const { hostname, pathname, search } = new URL(url);
|
4549
4807
|
const pathParts = pathname.split("/");
|
@@ -4656,8 +4914,7 @@ class XataFile {
|
|
4656
4914
|
}
|
4657
4915
|
}
|
4658
4916
|
const parseInputFileEntry = async (entry) => {
|
4659
|
-
if (!isDefined(entry))
|
4660
|
-
return null;
|
4917
|
+
if (!isDefined(entry)) return null;
|
4661
4918
|
const { id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout, uploadUrlTimeout } = await entry;
|
4662
4919
|
return compactObject({
|
4663
4920
|
id,
|
@@ -4672,24 +4929,19 @@ const parseInputFileEntry = async (entry) => {
|
|
4672
4929
|
};
|
4673
4930
|
|
4674
4931
|
function cleanFilter(filter) {
|
4675
|
-
if (!isDefined(filter))
|
4676
|
-
|
4677
|
-
if (!isObject(filter))
|
4678
|
-
return filter;
|
4932
|
+
if (!isDefined(filter)) return void 0;
|
4933
|
+
if (!isObject(filter)) return filter;
|
4679
4934
|
const values = Object.fromEntries(
|
4680
4935
|
Object.entries(filter).reduce((acc, [key, value]) => {
|
4681
|
-
if (!isDefined(value))
|
4682
|
-
return acc;
|
4936
|
+
if (!isDefined(value)) return acc;
|
4683
4937
|
if (Array.isArray(value)) {
|
4684
4938
|
const clean = value.map((item) => cleanFilter(item)).filter((item) => isDefined(item));
|
4685
|
-
if (clean.length === 0)
|
4686
|
-
return acc;
|
4939
|
+
if (clean.length === 0) return acc;
|
4687
4940
|
return [...acc, [key, clean]];
|
4688
4941
|
}
|
4689
4942
|
if (isObject(value)) {
|
4690
4943
|
const clean = cleanFilter(value);
|
4691
|
-
if (!isDefined(clean))
|
4692
|
-
return acc;
|
4944
|
+
if (!isDefined(clean)) return acc;
|
4693
4945
|
return [...acc, [key, clean]];
|
4694
4946
|
}
|
4695
4947
|
return [...acc, [key, value]];
|
@@ -4699,10 +4951,8 @@ function cleanFilter(filter) {
|
|
4699
4951
|
}
|
4700
4952
|
|
4701
4953
|
function stringifyJson(value) {
|
4702
|
-
if (!isDefined(value))
|
4703
|
-
|
4704
|
-
if (isString(value))
|
4705
|
-
return value;
|
4954
|
+
if (!isDefined(value)) return value;
|
4955
|
+
if (isString(value)) return value;
|
4706
4956
|
try {
|
4707
4957
|
return JSON.stringify(value);
|
4708
4958
|
} catch (e) {
|
@@ -4717,28 +4967,17 @@ function parseJson(value) {
|
|
4717
4967
|
}
|
4718
4968
|
}
|
4719
4969
|
|
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;
|
4970
|
+
var __typeError$6 = (msg) => {
|
4971
|
+
throw TypeError(msg);
|
4737
4972
|
};
|
4973
|
+
var __accessCheck$6 = (obj, member, msg) => member.has(obj) || __typeError$6("Cannot " + msg);
|
4974
|
+
var __privateGet$5 = (obj, member, getter) => (__accessCheck$6(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
4975
|
+
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);
|
4976
|
+
var __privateSet$4 = (obj, member, value, setter) => (__accessCheck$6(obj, member, "write to private field"), member.set(obj, value), value);
|
4738
4977
|
var _query, _page;
|
4739
4978
|
class Page {
|
4740
4979
|
constructor(query, meta, records = []) {
|
4741
|
-
__privateAdd$6(this, _query
|
4980
|
+
__privateAdd$6(this, _query);
|
4742
4981
|
__privateSet$4(this, _query, query);
|
4743
4982
|
this.meta = meta;
|
4744
4983
|
this.records = new PageRecordArray(this, records);
|
@@ -4825,7 +5064,7 @@ class RecordArray extends Array {
|
|
4825
5064
|
const _PageRecordArray = class _PageRecordArray extends Array {
|
4826
5065
|
constructor(...args) {
|
4827
5066
|
super(..._PageRecordArray.parseConstructorParams(...args));
|
4828
|
-
__privateAdd$6(this, _page
|
5067
|
+
__privateAdd$6(this, _page);
|
4829
5068
|
__privateSet$4(this, _page, isObject(args[0]?.meta) ? args[0] : { meta: { page: { cursor: "", more: false } }, records: [] });
|
4830
5069
|
}
|
4831
5070
|
static parseConstructorParams(...args) {
|
@@ -4896,34 +5135,20 @@ const _PageRecordArray = class _PageRecordArray extends Array {
|
|
4896
5135
|
_page = new WeakMap();
|
4897
5136
|
let PageRecordArray = _PageRecordArray;
|
4898
5137
|
|
4899
|
-
var
|
4900
|
-
|
4901
|
-
throw TypeError("Cannot " + msg);
|
4902
|
-
};
|
4903
|
-
var __privateGet$4 = (obj, member, getter) => {
|
4904
|
-
__accessCheck$5(obj, member, "read from private field");
|
4905
|
-
return getter ? getter.call(obj) : member.get(obj);
|
4906
|
-
};
|
4907
|
-
var __privateAdd$5 = (obj, member, value) => {
|
4908
|
-
if (member.has(obj))
|
4909
|
-
throw TypeError("Cannot add the same private member more than once");
|
4910
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
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;
|
5138
|
+
var __typeError$5 = (msg) => {
|
5139
|
+
throw TypeError(msg);
|
4920
5140
|
};
|
4921
|
-
var
|
5141
|
+
var __accessCheck$5 = (obj, member, msg) => member.has(obj) || __typeError$5("Cannot " + msg);
|
5142
|
+
var __privateGet$4 = (obj, member, getter) => (__accessCheck$5(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
5143
|
+
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);
|
5144
|
+
var __privateSet$3 = (obj, member, value, setter) => (__accessCheck$5(obj, member, "write to private field"), member.set(obj, value), value);
|
5145
|
+
var __privateMethod$3 = (obj, member, method) => (__accessCheck$5(obj, member, "access private method"), method);
|
5146
|
+
var _table$1, _repository, _data, _Query_instances, cleanFilterConstraint_fn;
|
4922
5147
|
const _Query = class _Query {
|
4923
5148
|
constructor(repository, table, data, rawParent) {
|
4924
|
-
__privateAdd$5(this,
|
4925
|
-
__privateAdd$5(this, _table$1
|
4926
|
-
__privateAdd$5(this, _repository
|
5149
|
+
__privateAdd$5(this, _Query_instances);
|
5150
|
+
__privateAdd$5(this, _table$1);
|
5151
|
+
__privateAdd$5(this, _repository);
|
4927
5152
|
__privateAdd$5(this, _data, { filter: {} });
|
4928
5153
|
// Implements pagination
|
4929
5154
|
this.meta = { page: { cursor: "start", more: true, size: PAGINATION_DEFAULT_SIZE } };
|
@@ -5002,12 +5227,12 @@ const _Query = class _Query {
|
|
5002
5227
|
filter(a, b) {
|
5003
5228
|
if (arguments.length === 1) {
|
5004
5229
|
const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
|
5005
|
-
[column]: __privateMethod$3(this,
|
5230
|
+
[column]: __privateMethod$3(this, _Query_instances, cleanFilterConstraint_fn).call(this, column, constraint)
|
5006
5231
|
}));
|
5007
5232
|
const $all = compact([__privateGet$4(this, _data).filter?.$all].flat().concat(constraints));
|
5008
5233
|
return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
|
5009
5234
|
} else {
|
5010
|
-
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this,
|
5235
|
+
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this, _Query_instances, cleanFilterConstraint_fn).call(this, a, b) }] : void 0;
|
5011
5236
|
const $all = compact([__privateGet$4(this, _data).filter?.$all].flat().concat(constraints));
|
5012
5237
|
return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
|
5013
5238
|
}
|
@@ -5086,8 +5311,7 @@ const _Query = class _Query {
|
|
5086
5311
|
}
|
5087
5312
|
async getFirstOrThrow(options = {}) {
|
5088
5313
|
const records = await this.getMany({ ...options, pagination: { size: 1 } });
|
5089
|
-
if (records[0] === void 0)
|
5090
|
-
throw new Error("No results found.");
|
5314
|
+
if (records[0] === void 0) throw new Error("No results found.");
|
5091
5315
|
return records[0];
|
5092
5316
|
}
|
5093
5317
|
async summarize(params = {}) {
|
@@ -5150,7 +5374,7 @@ const _Query = class _Query {
|
|
5150
5374
|
_table$1 = new WeakMap();
|
5151
5375
|
_repository = new WeakMap();
|
5152
5376
|
_data = new WeakMap();
|
5153
|
-
|
5377
|
+
_Query_instances = new WeakSet();
|
5154
5378
|
cleanFilterConstraint_fn = function(column, value) {
|
5155
5379
|
const columnType = __privateGet$4(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
|
5156
5380
|
if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
|
@@ -5216,8 +5440,7 @@ function isSortFilterString(value) {
|
|
5216
5440
|
}
|
5217
5441
|
function isSortFilterBase(filter) {
|
5218
5442
|
return isObject(filter) && Object.entries(filter).every(([key, value]) => {
|
5219
|
-
if (key === "*")
|
5220
|
-
return value === "random";
|
5443
|
+
if (key === "*") return value === "random";
|
5221
5444
|
return value === "asc" || value === "desc";
|
5222
5445
|
});
|
5223
5446
|
}
|
@@ -5238,29 +5461,15 @@ function buildSortFilter(filter) {
|
|
5238
5461
|
}
|
5239
5462
|
}
|
5240
5463
|
|
5241
|
-
var
|
5242
|
-
|
5243
|
-
throw TypeError("Cannot " + msg);
|
5464
|
+
var __typeError$4 = (msg) => {
|
5465
|
+
throw TypeError(msg);
|
5244
5466
|
};
|
5245
|
-
var
|
5246
|
-
|
5247
|
-
|
5248
|
-
|
5249
|
-
var
|
5250
|
-
|
5251
|
-
throw TypeError("Cannot add the same private member more than once");
|
5252
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
5253
|
-
};
|
5254
|
-
var __privateSet$2 = (obj, member, value, setter) => {
|
5255
|
-
__accessCheck$4(obj, member, "write to private field");
|
5256
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
5257
|
-
return value;
|
5258
|
-
};
|
5259
|
-
var __privateMethod$2 = (obj, member, method) => {
|
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;
|
5467
|
+
var __accessCheck$4 = (obj, member, msg) => member.has(obj) || __typeError$4("Cannot " + msg);
|
5468
|
+
var __privateGet$3 = (obj, member, getter) => (__accessCheck$4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
5469
|
+
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);
|
5470
|
+
var __privateSet$2 = (obj, member, value, setter) => (__accessCheck$4(obj, member, "write to private field"), member.set(obj, value), value);
|
5471
|
+
var __privateMethod$2 = (obj, member, method) => (__accessCheck$4(obj, member, "access private method"), method);
|
5472
|
+
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
5473
|
const BULK_OPERATION_MAX_SIZE = 1e3;
|
5265
5474
|
class Repository extends Query {
|
5266
5475
|
}
|
@@ -5271,24 +5480,13 @@ class RestRepository extends Query {
|
|
5271
5480
|
{ name: options.table, schema: options.schemaTables?.find((table) => table.name === options.table) },
|
5272
5481
|
{}
|
5273
5482
|
);
|
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);
|
5483
|
+
__privateAdd$4(this, _RestRepository_instances);
|
5484
|
+
__privateAdd$4(this, _table);
|
5485
|
+
__privateAdd$4(this, _getFetchProps);
|
5486
|
+
__privateAdd$4(this, _db);
|
5487
|
+
__privateAdd$4(this, _cache);
|
5488
|
+
__privateAdd$4(this, _schemaTables);
|
5489
|
+
__privateAdd$4(this, _trace);
|
5292
5490
|
__privateSet$2(this, _table, options.table);
|
5293
5491
|
__privateSet$2(this, _db, options.db);
|
5294
5492
|
__privateSet$2(this, _cache, options.pluginOptions.cache);
|
@@ -5308,28 +5506,25 @@ class RestRepository extends Query {
|
|
5308
5506
|
return __privateGet$3(this, _trace).call(this, "create", async () => {
|
5309
5507
|
const ifVersion = parseIfVersion(b, c, d);
|
5310
5508
|
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 });
|
5509
|
+
if (a.length === 0) return [];
|
5510
|
+
const ids = await __privateMethod$2(this, _RestRepository_instances, insertRecords_fn).call(this, a, { ifVersion, createOnly: true });
|
5314
5511
|
const columns = isValidSelectableColumns(b) ? b : ["*"];
|
5315
5512
|
const result = await this.read(ids, columns);
|
5316
5513
|
return result;
|
5317
5514
|
}
|
5318
5515
|
if (isString(a) && isObject(b)) {
|
5319
|
-
if (a === "")
|
5320
|
-
throw new Error("The id can't be empty");
|
5516
|
+
if (a === "") throw new Error("The id can't be empty");
|
5321
5517
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
5322
|
-
return await __privateMethod$2(this,
|
5518
|
+
return await __privateMethod$2(this, _RestRepository_instances, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
|
5323
5519
|
}
|
5324
5520
|
if (isObject(a) && isString(a.id)) {
|
5325
|
-
if (a.id === "")
|
5326
|
-
throw new Error("The id can't be empty");
|
5521
|
+
if (a.id === "") throw new Error("The id can't be empty");
|
5327
5522
|
const columns = isValidSelectableColumns(b) ? b : void 0;
|
5328
|
-
return await __privateMethod$2(this,
|
5523
|
+
return await __privateMethod$2(this, _RestRepository_instances, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: true, ifVersion });
|
5329
5524
|
}
|
5330
5525
|
if (isObject(a)) {
|
5331
5526
|
const columns = isValidSelectableColumns(b) ? b : void 0;
|
5332
|
-
return __privateMethod$2(this,
|
5527
|
+
return __privateMethod$2(this, _RestRepository_instances, insertRecordWithoutId_fn).call(this, a, columns);
|
5333
5528
|
}
|
5334
5529
|
throw new Error("Invalid arguments for create method");
|
5335
5530
|
});
|
@@ -5338,8 +5533,7 @@ class RestRepository extends Query {
|
|
5338
5533
|
return __privateGet$3(this, _trace).call(this, "read", async () => {
|
5339
5534
|
const columns = isValidSelectableColumns(b) ? b : ["*"];
|
5340
5535
|
if (Array.isArray(a)) {
|
5341
|
-
if (a.length === 0)
|
5342
|
-
return [];
|
5536
|
+
if (a.length === 0) return [];
|
5343
5537
|
const ids = a.map((item) => extractId(item));
|
5344
5538
|
const finalObjects = await this.getAll({ filter: { id: { $any: compact(ids) } }, columns });
|
5345
5539
|
const dictionary = finalObjects.reduce((acc, object) => {
|
@@ -5362,7 +5556,7 @@ class RestRepository extends Query {
|
|
5362
5556
|
queryParams: { columns },
|
5363
5557
|
...__privateGet$3(this, _getFetchProps).call(this)
|
5364
5558
|
});
|
5365
|
-
const schemaTables = await __privateMethod$2(this,
|
5559
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5366
5560
|
return initObject(
|
5367
5561
|
__privateGet$3(this, _db),
|
5368
5562
|
schemaTables,
|
@@ -5403,11 +5597,10 @@ class RestRepository extends Query {
|
|
5403
5597
|
return __privateGet$3(this, _trace).call(this, "update", async () => {
|
5404
5598
|
const ifVersion = parseIfVersion(b, c, d);
|
5405
5599
|
if (Array.isArray(a)) {
|
5406
|
-
if (a.length === 0)
|
5407
|
-
return [];
|
5600
|
+
if (a.length === 0) return [];
|
5408
5601
|
const existing = await this.read(a, ["id"]);
|
5409
5602
|
const updates = a.filter((_item, index) => existing[index] !== null);
|
5410
|
-
await __privateMethod$2(this,
|
5603
|
+
await __privateMethod$2(this, _RestRepository_instances, updateRecords_fn).call(this, updates, {
|
5411
5604
|
ifVersion,
|
5412
5605
|
upsert: false
|
5413
5606
|
});
|
@@ -5418,15 +5611,14 @@ class RestRepository extends Query {
|
|
5418
5611
|
try {
|
5419
5612
|
if (isString(a) && isObject(b)) {
|
5420
5613
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
5421
|
-
return await __privateMethod$2(this,
|
5614
|
+
return await __privateMethod$2(this, _RestRepository_instances, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
5422
5615
|
}
|
5423
5616
|
if (isObject(a) && isString(a.id)) {
|
5424
5617
|
const columns = isValidSelectableColumns(b) ? b : void 0;
|
5425
|
-
return await __privateMethod$2(this,
|
5618
|
+
return await __privateMethod$2(this, _RestRepository_instances, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
5426
5619
|
}
|
5427
5620
|
} catch (error) {
|
5428
|
-
if (error.status === 422)
|
5429
|
-
return null;
|
5621
|
+
if (error.status === 422) return null;
|
5430
5622
|
throw error;
|
5431
5623
|
}
|
5432
5624
|
throw new Error("Invalid arguments for update method");
|
@@ -5455,9 +5647,8 @@ class RestRepository extends Query {
|
|
5455
5647
|
return __privateGet$3(this, _trace).call(this, "createOrUpdate", async () => {
|
5456
5648
|
const ifVersion = parseIfVersion(b, c, d);
|
5457
5649
|
if (Array.isArray(a)) {
|
5458
|
-
if (a.length === 0)
|
5459
|
-
|
5460
|
-
await __privateMethod$2(this, _updateRecords, updateRecords_fn).call(this, a, {
|
5650
|
+
if (a.length === 0) return [];
|
5651
|
+
await __privateMethod$2(this, _RestRepository_instances, updateRecords_fn).call(this, a, {
|
5461
5652
|
ifVersion,
|
5462
5653
|
upsert: true
|
5463
5654
|
});
|
@@ -5466,16 +5657,14 @@ class RestRepository extends Query {
|
|
5466
5657
|
return result;
|
5467
5658
|
}
|
5468
5659
|
if (isString(a) && isObject(b)) {
|
5469
|
-
if (a === "")
|
5470
|
-
throw new Error("The id can't be empty");
|
5660
|
+
if (a === "") throw new Error("The id can't be empty");
|
5471
5661
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
5472
|
-
return await __privateMethod$2(this,
|
5662
|
+
return await __privateMethod$2(this, _RestRepository_instances, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
5473
5663
|
}
|
5474
5664
|
if (isObject(a) && isString(a.id)) {
|
5475
|
-
if (a.id === "")
|
5476
|
-
throw new Error("The id can't be empty");
|
5665
|
+
if (a.id === "") throw new Error("The id can't be empty");
|
5477
5666
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
5478
|
-
return await __privateMethod$2(this,
|
5667
|
+
return await __privateMethod$2(this, _RestRepository_instances, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
5479
5668
|
}
|
5480
5669
|
if (!isDefined(a) && isObject(b)) {
|
5481
5670
|
return await this.create(b, c);
|
@@ -5490,24 +5679,21 @@ class RestRepository extends Query {
|
|
5490
5679
|
return __privateGet$3(this, _trace).call(this, "createOrReplace", async () => {
|
5491
5680
|
const ifVersion = parseIfVersion(b, c, d);
|
5492
5681
|
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 });
|
5682
|
+
if (a.length === 0) return [];
|
5683
|
+
const ids = await __privateMethod$2(this, _RestRepository_instances, insertRecords_fn).call(this, a, { ifVersion, createOnly: false });
|
5496
5684
|
const columns = isValidSelectableColumns(b) ? b : ["*"];
|
5497
5685
|
const result = await this.read(ids, columns);
|
5498
5686
|
return result;
|
5499
5687
|
}
|
5500
5688
|
if (isString(a) && isObject(b)) {
|
5501
|
-
if (a === "")
|
5502
|
-
throw new Error("The id can't be empty");
|
5689
|
+
if (a === "") throw new Error("The id can't be empty");
|
5503
5690
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
5504
|
-
return await __privateMethod$2(this,
|
5691
|
+
return await __privateMethod$2(this, _RestRepository_instances, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
|
5505
5692
|
}
|
5506
5693
|
if (isObject(a) && isString(a.id)) {
|
5507
|
-
if (a.id === "")
|
5508
|
-
throw new Error("The id can't be empty");
|
5694
|
+
if (a.id === "") throw new Error("The id can't be empty");
|
5509
5695
|
const columns = isValidSelectableColumns(c) ? c : void 0;
|
5510
|
-
return await __privateMethod$2(this,
|
5696
|
+
return await __privateMethod$2(this, _RestRepository_instances, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
|
5511
5697
|
}
|
5512
5698
|
if (!isDefined(a) && isObject(b)) {
|
5513
5699
|
return await this.create(b, c);
|
@@ -5521,25 +5707,22 @@ class RestRepository extends Query {
|
|
5521
5707
|
async delete(a, b) {
|
5522
5708
|
return __privateGet$3(this, _trace).call(this, "delete", async () => {
|
5523
5709
|
if (Array.isArray(a)) {
|
5524
|
-
if (a.length === 0)
|
5525
|
-
return [];
|
5710
|
+
if (a.length === 0) return [];
|
5526
5711
|
const ids = a.map((o) => {
|
5527
|
-
if (isString(o))
|
5528
|
-
|
5529
|
-
if (isString(o.id))
|
5530
|
-
return o.id;
|
5712
|
+
if (isString(o)) return o;
|
5713
|
+
if (isString(o.id)) return o.id;
|
5531
5714
|
throw new Error("Invalid arguments for delete method");
|
5532
5715
|
});
|
5533
5716
|
const columns = isValidSelectableColumns(b) ? b : ["*"];
|
5534
5717
|
const result = await this.read(a, columns);
|
5535
|
-
await __privateMethod$2(this,
|
5718
|
+
await __privateMethod$2(this, _RestRepository_instances, deleteRecords_fn).call(this, ids);
|
5536
5719
|
return result;
|
5537
5720
|
}
|
5538
5721
|
if (isString(a)) {
|
5539
|
-
return __privateMethod$2(this,
|
5722
|
+
return __privateMethod$2(this, _RestRepository_instances, deleteRecord_fn).call(this, a, b);
|
5540
5723
|
}
|
5541
5724
|
if (isObject(a) && isString(a.id)) {
|
5542
|
-
return __privateMethod$2(this,
|
5725
|
+
return __privateMethod$2(this, _RestRepository_instances, deleteRecord_fn).call(this, a.id, b);
|
5543
5726
|
}
|
5544
5727
|
throw new Error("Invalid arguments for delete method");
|
5545
5728
|
});
|
@@ -5583,7 +5766,7 @@ class RestRepository extends Query {
|
|
5583
5766
|
},
|
5584
5767
|
...__privateGet$3(this, _getFetchProps).call(this)
|
5585
5768
|
});
|
5586
|
-
const schemaTables = await __privateMethod$2(this,
|
5769
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5587
5770
|
return {
|
5588
5771
|
records: records.map((item) => initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), item, ["*"])),
|
5589
5772
|
totalCount
|
@@ -5608,7 +5791,7 @@ class RestRepository extends Query {
|
|
5608
5791
|
},
|
5609
5792
|
...__privateGet$3(this, _getFetchProps).call(this)
|
5610
5793
|
});
|
5611
|
-
const schemaTables = await __privateMethod$2(this,
|
5794
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5612
5795
|
return {
|
5613
5796
|
records: records.map((item) => initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), item, ["*"])),
|
5614
5797
|
totalCount
|
@@ -5632,9 +5815,8 @@ class RestRepository extends Query {
|
|
5632
5815
|
}
|
5633
5816
|
async query(query) {
|
5634
5817
|
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);
|
5818
|
+
const cacheQuery = await __privateMethod$2(this, _RestRepository_instances, getCacheQuery_fn).call(this, query);
|
5819
|
+
if (cacheQuery) return new Page(query, cacheQuery.meta, cacheQuery.records);
|
5638
5820
|
const data = query.getQueryOptions();
|
5639
5821
|
const { meta, records: objects } = await queryTable({
|
5640
5822
|
pathParams: {
|
@@ -5653,7 +5835,7 @@ class RestRepository extends Query {
|
|
5653
5835
|
fetchOptions: data.fetchOptions,
|
5654
5836
|
...__privateGet$3(this, _getFetchProps).call(this)
|
5655
5837
|
});
|
5656
|
-
const schemaTables = await __privateMethod$2(this,
|
5838
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5657
5839
|
const records = objects.map(
|
5658
5840
|
(record) => initObject(
|
5659
5841
|
__privateGet$3(this, _db),
|
@@ -5663,7 +5845,7 @@ class RestRepository extends Query {
|
|
5663
5845
|
data.columns ?? ["*"]
|
5664
5846
|
)
|
5665
5847
|
);
|
5666
|
-
await __privateMethod$2(this,
|
5848
|
+
await __privateMethod$2(this, _RestRepository_instances, setCacheQuery_fn).call(this, query, meta, records);
|
5667
5849
|
return new Page(query, meta, records);
|
5668
5850
|
});
|
5669
5851
|
}
|
@@ -5688,7 +5870,7 @@ class RestRepository extends Query {
|
|
5688
5870
|
},
|
5689
5871
|
...__privateGet$3(this, _getFetchProps).call(this)
|
5690
5872
|
});
|
5691
|
-
const schemaTables = await __privateMethod$2(this,
|
5873
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5692
5874
|
return {
|
5693
5875
|
...result,
|
5694
5876
|
summaries: result.summaries.map(
|
@@ -5737,9 +5919,9 @@ _db = new WeakMap();
|
|
5737
5919
|
_cache = new WeakMap();
|
5738
5920
|
_schemaTables = new WeakMap();
|
5739
5921
|
_trace = new WeakMap();
|
5740
|
-
|
5922
|
+
_RestRepository_instances = new WeakSet();
|
5741
5923
|
insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
5742
|
-
const record = await __privateMethod$2(this,
|
5924
|
+
const record = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
|
5743
5925
|
const response = await insertRecord({
|
5744
5926
|
pathParams: {
|
5745
5927
|
workspace: "{workspaceId}",
|
@@ -5751,14 +5933,12 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
5751
5933
|
body: record,
|
5752
5934
|
...__privateGet$3(this, _getFetchProps).call(this)
|
5753
5935
|
});
|
5754
|
-
const schemaTables = await __privateMethod$2(this,
|
5936
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5755
5937
|
return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
|
5756
5938
|
};
|
5757
|
-
_insertRecordWithId = new WeakSet();
|
5758
5939
|
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);
|
5940
|
+
if (!recordId) return null;
|
5941
|
+
const record = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
|
5762
5942
|
const response = await insertRecordWithID({
|
5763
5943
|
pathParams: {
|
5764
5944
|
workspace: "{workspaceId}",
|
@@ -5771,13 +5951,12 @@ insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { crea
|
|
5771
5951
|
queryParams: { createOnly, columns, ifVersion },
|
5772
5952
|
...__privateGet$3(this, _getFetchProps).call(this)
|
5773
5953
|
});
|
5774
|
-
const schemaTables = await __privateMethod$2(this,
|
5954
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5775
5955
|
return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
|
5776
5956
|
};
|
5777
|
-
_insertRecords = new WeakSet();
|
5778
5957
|
insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
|
5779
5958
|
const operations = await promiseMap(objects, async (object) => {
|
5780
|
-
const record = await __privateMethod$2(this,
|
5959
|
+
const record = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
|
5781
5960
|
return { insert: { table: __privateGet$3(this, _table), record, createOnly, ifVersion } };
|
5782
5961
|
});
|
5783
5962
|
const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
|
@@ -5802,11 +5981,9 @@ insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
|
|
5802
5981
|
}
|
5803
5982
|
return ids;
|
5804
5983
|
};
|
5805
|
-
_updateRecordWithID = new WeakSet();
|
5806
5984
|
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);
|
5985
|
+
if (!recordId) return null;
|
5986
|
+
const { id: _id, ...record } = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
|
5810
5987
|
try {
|
5811
5988
|
const response = await updateRecordWithID({
|
5812
5989
|
pathParams: {
|
@@ -5820,7 +5997,7 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
|
|
5820
5997
|
body: record,
|
5821
5998
|
...__privateGet$3(this, _getFetchProps).call(this)
|
5822
5999
|
});
|
5823
|
-
const schemaTables = await __privateMethod$2(this,
|
6000
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5824
6001
|
return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
|
5825
6002
|
} catch (e) {
|
5826
6003
|
if (isObject(e) && e.status === 404) {
|
@@ -5829,10 +6006,9 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
|
|
5829
6006
|
throw e;
|
5830
6007
|
}
|
5831
6008
|
};
|
5832
|
-
_updateRecords = new WeakSet();
|
5833
6009
|
updateRecords_fn = async function(objects, { ifVersion, upsert }) {
|
5834
6010
|
const operations = await promiseMap(objects, async ({ id, ...object }) => {
|
5835
|
-
const fields = await __privateMethod$2(this,
|
6011
|
+
const fields = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
|
5836
6012
|
return { update: { table: __privateGet$3(this, _table), id, ifVersion, upsert, fields } };
|
5837
6013
|
});
|
5838
6014
|
const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
|
@@ -5857,10 +6033,8 @@ updateRecords_fn = async function(objects, { ifVersion, upsert }) {
|
|
5857
6033
|
}
|
5858
6034
|
return ids;
|
5859
6035
|
};
|
5860
|
-
_upsertRecordWithID = new WeakSet();
|
5861
6036
|
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
5862
|
-
if (!recordId)
|
5863
|
-
return null;
|
6037
|
+
if (!recordId) return null;
|
5864
6038
|
const response = await upsertRecordWithID({
|
5865
6039
|
pathParams: {
|
5866
6040
|
workspace: "{workspaceId}",
|
@@ -5873,13 +6047,11 @@ upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
|
|
5873
6047
|
body: object,
|
5874
6048
|
...__privateGet$3(this, _getFetchProps).call(this)
|
5875
6049
|
});
|
5876
|
-
const schemaTables = await __privateMethod$2(this,
|
6050
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5877
6051
|
return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
|
5878
6052
|
};
|
5879
|
-
_deleteRecord = new WeakSet();
|
5880
6053
|
deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
5881
|
-
if (!recordId)
|
5882
|
-
return null;
|
6054
|
+
if (!recordId) return null;
|
5883
6055
|
try {
|
5884
6056
|
const response = await deleteRecord({
|
5885
6057
|
pathParams: {
|
@@ -5892,7 +6064,7 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
|
5892
6064
|
queryParams: { columns },
|
5893
6065
|
...__privateGet$3(this, _getFetchProps).call(this)
|
5894
6066
|
});
|
5895
|
-
const schemaTables = await __privateMethod$2(this,
|
6067
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5896
6068
|
return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
|
5897
6069
|
} catch (e) {
|
5898
6070
|
if (isObject(e) && e.status === 404) {
|
@@ -5901,7 +6073,6 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
|
5901
6073
|
throw e;
|
5902
6074
|
}
|
5903
6075
|
};
|
5904
|
-
_deleteRecords = new WeakSet();
|
5905
6076
|
deleteRecords_fn = async function(recordIds) {
|
5906
6077
|
const chunkedOperations = chunk(
|
5907
6078
|
compact(recordIds).map((id) => ({ delete: { table: __privateGet$3(this, _table), id } })),
|
@@ -5919,27 +6090,21 @@ deleteRecords_fn = async function(recordIds) {
|
|
5919
6090
|
});
|
5920
6091
|
}
|
5921
6092
|
};
|
5922
|
-
_setCacheQuery = new WeakSet();
|
5923
6093
|
setCacheQuery_fn = async function(query, meta, records) {
|
5924
6094
|
await __privateGet$3(this, _cache)?.set(`query_${__privateGet$3(this, _table)}:${query.key()}`, { date: /* @__PURE__ */ new Date(), meta, records });
|
5925
6095
|
};
|
5926
|
-
_getCacheQuery = new WeakSet();
|
5927
6096
|
getCacheQuery_fn = async function(query) {
|
5928
6097
|
const key = `query_${__privateGet$3(this, _table)}:${query.key()}`;
|
5929
6098
|
const result = await __privateGet$3(this, _cache)?.get(key);
|
5930
|
-
if (!result)
|
5931
|
-
return null;
|
6099
|
+
if (!result) return null;
|
5932
6100
|
const defaultTTL = __privateGet$3(this, _cache)?.defaultQueryTTL ?? -1;
|
5933
6101
|
const { cache: ttl = defaultTTL } = query.getQueryOptions();
|
5934
|
-
if (ttl < 0)
|
5935
|
-
return null;
|
6102
|
+
if (ttl < 0) return null;
|
5936
6103
|
const hasExpired = result.date.getTime() + ttl < Date.now();
|
5937
6104
|
return hasExpired ? null : result;
|
5938
6105
|
};
|
5939
|
-
_getSchemaTables = new WeakSet();
|
5940
6106
|
getSchemaTables_fn = async function() {
|
5941
|
-
if (__privateGet$3(this, _schemaTables))
|
5942
|
-
return __privateGet$3(this, _schemaTables);
|
6107
|
+
if (__privateGet$3(this, _schemaTables)) return __privateGet$3(this, _schemaTables);
|
5943
6108
|
const { schema } = await getBranchDetails({
|
5944
6109
|
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
5945
6110
|
...__privateGet$3(this, _getFetchProps).call(this)
|
@@ -5947,16 +6112,13 @@ getSchemaTables_fn = async function() {
|
|
5947
6112
|
__privateSet$2(this, _schemaTables, schema.tables);
|
5948
6113
|
return schema.tables;
|
5949
6114
|
};
|
5950
|
-
_transformObjectToApi = new WeakSet();
|
5951
6115
|
transformObjectToApi_fn = async function(object) {
|
5952
|
-
const schemaTables = await __privateMethod$2(this,
|
6116
|
+
const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
|
5953
6117
|
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`);
|
6118
|
+
if (!schema) throw new Error(`Table ${__privateGet$3(this, _table)} not found in schema`);
|
5956
6119
|
const result = {};
|
5957
6120
|
for (const [key, value] of Object.entries(object)) {
|
5958
|
-
if (key === "xata")
|
5959
|
-
continue;
|
6121
|
+
if (key === "xata") continue;
|
5960
6122
|
const type = schema.columns.find((column) => column.name === key)?.type;
|
5961
6123
|
switch (type) {
|
5962
6124
|
case "link": {
|
@@ -5987,11 +6149,9 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
5987
6149
|
const { xata, ...rest } = object ?? {};
|
5988
6150
|
Object.assign(data, rest);
|
5989
6151
|
const { columns } = schemaTables.find(({ name }) => name === table) ?? {};
|
5990
|
-
if (!columns)
|
5991
|
-
console.error(`Table ${table} not found in schema`);
|
6152
|
+
if (!columns) console.error(`Table ${table} not found in schema`);
|
5992
6153
|
for (const column of columns ?? []) {
|
5993
|
-
if (!isValidColumn(selectedColumns, column))
|
5994
|
-
continue;
|
6154
|
+
if (!isValidColumn(selectedColumns, column)) continue;
|
5995
6155
|
const value = data[column.name];
|
5996
6156
|
switch (column.type) {
|
5997
6157
|
case "datetime": {
|
@@ -6084,15 +6244,12 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
6084
6244
|
return record;
|
6085
6245
|
};
|
6086
6246
|
function extractId(value) {
|
6087
|
-
if (isString(value))
|
6088
|
-
|
6089
|
-
if (isObject(value) && isString(value.id))
|
6090
|
-
return value.id;
|
6247
|
+
if (isString(value)) return value;
|
6248
|
+
if (isObject(value) && isString(value.id)) return value.id;
|
6091
6249
|
return void 0;
|
6092
6250
|
}
|
6093
6251
|
function isValidColumn(columns, column) {
|
6094
|
-
if (columns.includes("*"))
|
6095
|
-
return true;
|
6252
|
+
if (columns.includes("*")) return true;
|
6096
6253
|
return columns.filter((item) => isString(item) && item.startsWith(column.name)).length > 0;
|
6097
6254
|
}
|
6098
6255
|
function parseIfVersion(...args) {
|
@@ -6104,28 +6261,17 @@ function parseIfVersion(...args) {
|
|
6104
6261
|
return void 0;
|
6105
6262
|
}
|
6106
6263
|
|
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;
|
6264
|
+
var __typeError$3 = (msg) => {
|
6265
|
+
throw TypeError(msg);
|
6124
6266
|
};
|
6267
|
+
var __accessCheck$3 = (obj, member, msg) => member.has(obj) || __typeError$3("Cannot " + msg);
|
6268
|
+
var __privateGet$2 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), member.get(obj));
|
6269
|
+
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);
|
6270
|
+
var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), member.set(obj, value), value);
|
6125
6271
|
var _map;
|
6126
6272
|
class SimpleCache {
|
6127
6273
|
constructor(options = {}) {
|
6128
|
-
__privateAdd$3(this, _map
|
6274
|
+
__privateAdd$3(this, _map);
|
6129
6275
|
__privateSet$1(this, _map, /* @__PURE__ */ new Map());
|
6130
6276
|
this.capacity = options.max ?? 500;
|
6131
6277
|
this.defaultQueryTTL = options.defaultQueryTTL ?? 60 * 1e3;
|
@@ -6181,19 +6327,12 @@ const includesAll = (value) => ({ $includesAll: value });
|
|
6181
6327
|
const includesNone = (value) => ({ $includesNone: value });
|
6182
6328
|
const includesAny = (value) => ({ $includesAny: value });
|
6183
6329
|
|
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);
|
6330
|
+
var __typeError$2 = (msg) => {
|
6331
|
+
throw TypeError(msg);
|
6196
6332
|
};
|
6333
|
+
var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg);
|
6334
|
+
var __privateGet$1 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
6335
|
+
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
6336
|
var _tables;
|
6198
6337
|
class SchemaPlugin extends XataPlugin {
|
6199
6338
|
constructor() {
|
@@ -6205,8 +6344,7 @@ class SchemaPlugin extends XataPlugin {
|
|
6205
6344
|
{},
|
6206
6345
|
{
|
6207
6346
|
get: (_target, table) => {
|
6208
|
-
if (!isString(table))
|
6209
|
-
throw new Error("Invalid table name");
|
6347
|
+
if (!isString(table)) throw new Error("Invalid table name");
|
6210
6348
|
if (__privateGet$1(this, _tables)[table] === void 0) {
|
6211
6349
|
__privateGet$1(this, _tables)[table] = new RestRepository({ db, pluginOptions, table, schemaTables: pluginOptions.tables });
|
6212
6350
|
}
|
@@ -6297,30 +6435,23 @@ function getContentType(file) {
|
|
6297
6435
|
return "application/octet-stream";
|
6298
6436
|
}
|
6299
6437
|
|
6300
|
-
var
|
6301
|
-
|
6302
|
-
throw TypeError("Cannot " + msg);
|
6303
|
-
};
|
6304
|
-
var __privateAdd$1 = (obj, member, value) => {
|
6305
|
-
if (member.has(obj))
|
6306
|
-
throw TypeError("Cannot add the same private member more than once");
|
6307
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
6438
|
+
var __typeError$1 = (msg) => {
|
6439
|
+
throw TypeError(msg);
|
6308
6440
|
};
|
6309
|
-
var
|
6310
|
-
|
6311
|
-
|
6312
|
-
|
6313
|
-
var _search, search_fn;
|
6441
|
+
var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
|
6442
|
+
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);
|
6443
|
+
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
6444
|
+
var _SearchPlugin_instances, search_fn;
|
6314
6445
|
class SearchPlugin extends XataPlugin {
|
6315
6446
|
constructor(db) {
|
6316
6447
|
super();
|
6317
6448
|
this.db = db;
|
6318
|
-
__privateAdd$1(this,
|
6449
|
+
__privateAdd$1(this, _SearchPlugin_instances);
|
6319
6450
|
}
|
6320
6451
|
build(pluginOptions) {
|
6321
6452
|
return {
|
6322
6453
|
all: async (query, options = {}) => {
|
6323
|
-
const { records, totalCount } = await __privateMethod$1(this,
|
6454
|
+
const { records, totalCount } = await __privateMethod$1(this, _SearchPlugin_instances, search_fn).call(this, query, options, pluginOptions);
|
6324
6455
|
return {
|
6325
6456
|
totalCount,
|
6326
6457
|
records: records.map((record) => {
|
@@ -6330,7 +6461,7 @@ class SearchPlugin extends XataPlugin {
|
|
6330
6461
|
};
|
6331
6462
|
},
|
6332
6463
|
byTable: async (query, options = {}) => {
|
6333
|
-
const { records: rawRecords, totalCount } = await __privateMethod$1(this,
|
6464
|
+
const { records: rawRecords, totalCount } = await __privateMethod$1(this, _SearchPlugin_instances, search_fn).call(this, query, options, pluginOptions);
|
6334
6465
|
const records = rawRecords.reduce((acc, record) => {
|
6335
6466
|
const { table = "orphan" } = record.xata;
|
6336
6467
|
const items = acc[table] ?? [];
|
@@ -6342,7 +6473,7 @@ class SearchPlugin extends XataPlugin {
|
|
6342
6473
|
};
|
6343
6474
|
}
|
6344
6475
|
}
|
6345
|
-
|
6476
|
+
_SearchPlugin_instances = new WeakSet();
|
6346
6477
|
search_fn = async function(query, options, pluginOptions) {
|
6347
6478
|
const { tables, fuzziness, highlight, prefix, page } = options ?? {};
|
6348
6479
|
const { records, totalCount } = await searchBranch({
|
@@ -6378,8 +6509,7 @@ function arrayString(val) {
|
|
6378
6509
|
return result;
|
6379
6510
|
}
|
6380
6511
|
function prepareValue(value) {
|
6381
|
-
if (!isDefined(value))
|
6382
|
-
return null;
|
6512
|
+
if (!isDefined(value)) return null;
|
6383
6513
|
if (value instanceof Date) {
|
6384
6514
|
return value.toISOString();
|
6385
6515
|
}
|
@@ -6432,6 +6562,18 @@ class SQLPlugin extends XataPlugin {
|
|
6432
6562
|
return { records, rows, warning, columns };
|
6433
6563
|
};
|
6434
6564
|
sqlFunction.connectionString = buildConnectionString(pluginOptions);
|
6565
|
+
sqlFunction.batch = async (query) => {
|
6566
|
+
const { results } = await sqlBatchQuery({
|
6567
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
6568
|
+
body: {
|
6569
|
+
statements: query.statements.map(({ statement, params }) => ({ statement, params })),
|
6570
|
+
consistency: query.consistency,
|
6571
|
+
responseType: query.responseType
|
6572
|
+
},
|
6573
|
+
...pluginOptions
|
6574
|
+
});
|
6575
|
+
return { results };
|
6576
|
+
};
|
6435
6577
|
return sqlFunction;
|
6436
6578
|
}
|
6437
6579
|
}
|
@@ -6458,8 +6600,7 @@ function buildDomain(host, region) {
|
|
6458
6600
|
function buildConnectionString({ apiKey, workspacesApiUrl, branch }) {
|
6459
6601
|
const url = isString(workspacesApiUrl) ? workspacesApiUrl : workspacesApiUrl("", {});
|
6460
6602
|
const parts = parseWorkspacesUrlParts(url);
|
6461
|
-
if (!parts)
|
6462
|
-
throw new Error("Invalid workspaces URL");
|
6603
|
+
if (!parts) throw new Error("Invalid workspaces URL");
|
6463
6604
|
const { workspace: workspaceSlug, region, database, host } = parts;
|
6464
6605
|
const domain = buildDomain(host, region);
|
6465
6606
|
const workspace = workspaceSlug.split("-").pop();
|
@@ -6484,39 +6625,24 @@ class TransactionPlugin extends XataPlugin {
|
|
6484
6625
|
}
|
6485
6626
|
}
|
6486
6627
|
|
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;
|
6628
|
+
var __typeError = (msg) => {
|
6629
|
+
throw TypeError(msg);
|
6508
6630
|
};
|
6631
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
6632
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
6633
|
+
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);
|
6634
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
6635
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
6509
6636
|
const buildClient = (plugins) => {
|
6510
|
-
var _options,
|
6637
|
+
var _options, _instances, parseOptions_fn, getFetchProps_fn, _a;
|
6511
6638
|
return _a = class {
|
6512
6639
|
constructor(options = {}, tables) {
|
6513
|
-
__privateAdd(this,
|
6514
|
-
__privateAdd(this,
|
6515
|
-
|
6516
|
-
const safeOptions = __privateMethod(this, _parseOptions, parseOptions_fn).call(this, options);
|
6640
|
+
__privateAdd(this, _instances);
|
6641
|
+
__privateAdd(this, _options);
|
6642
|
+
const safeOptions = __privateMethod(this, _instances, parseOptions_fn).call(this, options);
|
6517
6643
|
__privateSet(this, _options, safeOptions);
|
6518
6644
|
const pluginOptions = {
|
6519
|
-
...__privateMethod(this,
|
6645
|
+
...__privateMethod(this, _instances, getFetchProps_fn).call(this, safeOptions),
|
6520
6646
|
cache: safeOptions.cache,
|
6521
6647
|
host: safeOptions.host,
|
6522
6648
|
tables,
|
@@ -6534,8 +6660,7 @@ const buildClient = (plugins) => {
|
|
6534
6660
|
this.sql = sql;
|
6535
6661
|
this.files = files;
|
6536
6662
|
for (const [key, namespace] of Object.entries(plugins ?? {})) {
|
6537
|
-
if (namespace === void 0)
|
6538
|
-
continue;
|
6663
|
+
if (namespace === void 0) continue;
|
6539
6664
|
this[key] = namespace.build(pluginOptions);
|
6540
6665
|
}
|
6541
6666
|
}
|
@@ -6544,7 +6669,7 @@ const buildClient = (plugins) => {
|
|
6544
6669
|
const branch = __privateGet(this, _options).branch;
|
6545
6670
|
return { databaseURL, branch };
|
6546
6671
|
}
|
6547
|
-
}, _options = new WeakMap(),
|
6672
|
+
}, _options = new WeakMap(), _instances = new WeakSet(), parseOptions_fn = function(options) {
|
6548
6673
|
const enableBrowser = options?.enableBrowser ?? getEnableBrowserVariable() ?? false;
|
6549
6674
|
const isBrowser = typeof window !== "undefined" && typeof Deno === "undefined";
|
6550
6675
|
if (isBrowser && !enableBrowser) {
|
@@ -6599,7 +6724,7 @@ const buildClient = (plugins) => {
|
|
6599
6724
|
clientName,
|
6600
6725
|
xataAgentExtra
|
6601
6726
|
};
|
6602
|
-
},
|
6727
|
+
}, getFetchProps_fn = function({
|
6603
6728
|
fetch,
|
6604
6729
|
apiKey,
|
6605
6730
|
databaseURL,
|
@@ -6640,26 +6765,19 @@ class Serializer {
|
|
6640
6765
|
}
|
6641
6766
|
toJSON(data) {
|
6642
6767
|
function visit(obj) {
|
6643
|
-
if (Array.isArray(obj))
|
6644
|
-
return obj.map(visit);
|
6768
|
+
if (Array.isArray(obj)) return obj.map(visit);
|
6645
6769
|
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;
|
6770
|
+
if (type === "undefined") return { [META]: "undefined" };
|
6771
|
+
if (type === "bigint") return { [META]: "bigint", [VALUE]: obj.toString() };
|
6772
|
+
if (obj === null || type !== "object") return obj;
|
6652
6773
|
const constructor = obj.constructor;
|
6653
6774
|
const o = { [META]: constructor.name };
|
6654
6775
|
for (const [key, value] of Object.entries(obj)) {
|
6655
6776
|
o[key] = visit(value);
|
6656
6777
|
}
|
6657
|
-
if (constructor === Date)
|
6658
|
-
|
6659
|
-
if (constructor ===
|
6660
|
-
o[VALUE] = Object.fromEntries(obj);
|
6661
|
-
if (constructor === Set)
|
6662
|
-
o[VALUE] = [...obj];
|
6778
|
+
if (constructor === Date) o[VALUE] = obj.toISOString();
|
6779
|
+
if (constructor === Map) o[VALUE] = Object.fromEntries(obj);
|
6780
|
+
if (constructor === Set) o[VALUE] = [...obj];
|
6663
6781
|
return o;
|
6664
6782
|
}
|
6665
6783
|
return JSON.stringify(visit(data));
|
@@ -6672,16 +6790,11 @@ class Serializer {
|
|
6672
6790
|
if (constructor) {
|
6673
6791
|
return Object.assign(Object.create(constructor.prototype), rest);
|
6674
6792
|
}
|
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;
|
6793
|
+
if (clazz === "Date") return new Date(val);
|
6794
|
+
if (clazz === "Set") return new Set(val);
|
6795
|
+
if (clazz === "Map") return new Map(Object.entries(val));
|
6796
|
+
if (clazz === "bigint") return BigInt(val);
|
6797
|
+
if (clazz === "undefined") return void 0;
|
6685
6798
|
return rest;
|
6686
6799
|
}
|
6687
6800
|
return value;
|
@@ -6703,5 +6816,5 @@ class XataError extends Error {
|
|
6703
6816
|
}
|
6704
6817
|
}
|
6705
6818
|
|
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 };
|
6819
|
+
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, 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, 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
6820
|
//# sourceMappingURL=index.mjs.map
|