@xata.io/client 0.29.4 → 0.30.0

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