@xata.io/client 0.0.0-alpha.vf229a69778d4166c9021b4cec87cfce2b38e6bbf → 0.0.0-alpha.vf250ad1109fa0bf434c4b58315deafdacff662ee

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