@xata.io/client 0.29.4 → 0.29.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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$8 = (msg) => {
2030
+ throw TypeError(msg);
2076
2031
  };
2077
- var _fetch, _queue, _concurrency, _enqueue, enqueue_fn;
2032
+ var __accessCheck$8 = (obj, member, msg) => member.has(obj) || __typeError$8("Cannot " + msg);
2033
+ var __privateGet$7 = (obj, member, getter) => (__accessCheck$8(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
2034
+ var __privateAdd$8 = (obj, member, value) => member.has(obj) ? __typeError$8("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
2035
+ var __privateSet$6 = (obj, member, value, setter) => (__accessCheck$8(obj, member, "write to private field"), member.set(obj, value), value);
2036
+ var __privateMethod$4 = (obj, member, method) => (__accessCheck$8(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,10 +2047,10 @@ 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);
2050
+ __privateAdd$8(this, _ApiRequestPool_instances);
2051
+ __privateAdd$8(this, _fetch);
2052
+ __privateAdd$8(this, _queue);
2053
+ __privateAdd$8(this, _concurrency);
2094
2054
  __privateSet$6(this, _queue, []);
2095
2055
  __privateSet$6(this, _concurrency, concurrency);
2096
2056
  this.running = 0;
@@ -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,7 +2093,7 @@ 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
2098
  const promise = new Promise((resolve) => __privateGet$7(this, _queue).push(resolve)).finally(() => {
2139
2099
  this.started--;
@@ -2336,7 +2296,7 @@ function defaultOnOpen(response) {
2336
2296
  }
2337
2297
  }
2338
2298
 
2339
- const VERSION = "0.29.4";
2299
+ const VERSION = "0.29.5";
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,30 @@ 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 applyMigration = (variables, signal) => dataPlaneFetch({
2612
+ url: "/db/{dbBranchName}/migrations/apply",
2613
+ method: "post",
2614
+ ...variables,
2615
+ signal
2616
+ });
2617
+ const startMigration = (variables, signal) => dataPlaneFetch({
2618
+ url: "/db/{dbBranchName}/migrations/start",
2619
+ method: "post",
2620
+ ...variables,
2621
+ signal
2622
+ });
2623
+ const completeMigration = (variables, signal) => dataPlaneFetch({
2624
+ url: "/db/{dbBranchName}/migrations/complete",
2625
+ method: "post",
2626
+ ...variables,
2627
+ signal
2628
+ });
2629
+ const rollbackMigration = (variables, signal) => dataPlaneFetch({
2630
+ url: "/db/{dbBranchName}/migrations/rollback",
2631
+ method: "post",
2632
+ ...variables,
2633
+ signal
2634
+ });
2659
2635
  const adaptTable = (variables, signal) => dataPlaneFetch({
2660
2636
  url: "/db/{dbBranchName}/migrations/adapt/{tableName}",
2661
2637
  method: "post",
@@ -2668,9 +2644,24 @@ const adaptAllTables = (variables, signal) => dataPlaneFetch({
2668
2644
  ...variables,
2669
2645
  signal
2670
2646
  });
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 });
2647
+ const getBranchMigrationJobStatus = (variables, signal) => dataPlaneFetch({
2648
+ url: "/db/{dbBranchName}/migrations/status",
2649
+ method: "get",
2650
+ ...variables,
2651
+ signal
2652
+ });
2653
+ const getMigrationJobStatus = (variables, signal) => dataPlaneFetch({
2654
+ url: "/db/{dbBranchName}/migrations/jobs/{jobId}",
2655
+ method: "get",
2656
+ ...variables,
2657
+ signal
2658
+ });
2659
+ const getMigrationHistory = (variables, signal) => dataPlaneFetch({
2660
+ url: "/db/{dbBranchName}/migrations/history",
2661
+ method: "get",
2662
+ ...variables,
2663
+ signal
2664
+ });
2674
2665
  const getBranchList = (variables, signal) => dataPlaneFetch({
2675
2666
  url: "/dbs/{dbName}",
2676
2667
  method: "get",
@@ -2729,12 +2720,42 @@ const getBranchStats = (variables, signal) => dataPlaneFetch({
2729
2720
  });
2730
2721
  const getGitBranchesMapping = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables, signal });
2731
2722
  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 });
2723
+ const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({
2724
+ url: "/dbs/{dbName}/gitBranches",
2725
+ method: "delete",
2726
+ ...variables,
2727
+ signal
2728
+ });
2729
+ const resolveBranch = (variables, signal) => dataPlaneFetch({
2730
+ url: "/dbs/{dbName}/resolveBranch",
2731
+ method: "get",
2732
+ ...variables,
2733
+ signal
2734
+ });
2735
+ const getBranchMigrationHistory = (variables, signal) => dataPlaneFetch({
2736
+ url: "/db/{dbBranchName}/migrations",
2737
+ method: "get",
2738
+ ...variables,
2739
+ signal
2740
+ });
2741
+ const getBranchMigrationPlan = (variables, signal) => dataPlaneFetch({
2742
+ url: "/db/{dbBranchName}/migrations/plan",
2743
+ method: "post",
2744
+ ...variables,
2745
+ signal
2746
+ });
2747
+ const executeBranchMigrationPlan = (variables, signal) => dataPlaneFetch({
2748
+ url: "/db/{dbBranchName}/migrations/execute",
2749
+ method: "post",
2750
+ ...variables,
2751
+ signal
2752
+ });
2753
+ const queryMigrationRequests = (variables, signal) => dataPlaneFetch({
2754
+ url: "/dbs/{dbName}/migrations/query",
2755
+ method: "post",
2756
+ ...variables,
2757
+ signal
2758
+ });
2738
2759
  const createMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
2739
2760
  const getMigrationRequest = (variables, signal) => dataPlaneFetch({
2740
2761
  url: "/dbs/{dbName}/migrations/{mrNumber}",
@@ -2742,23 +2763,78 @@ const getMigrationRequest = (variables, signal) => dataPlaneFetch({
2742
2763
  ...variables,
2743
2764
  signal
2744
2765
  });
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 });
2766
+ const updateMigrationRequest = (variables, signal) => dataPlaneFetch({
2767
+ url: "/dbs/{dbName}/migrations/{mrNumber}",
2768
+ method: "patch",
2769
+ ...variables,
2770
+ signal
2771
+ });
2772
+ const listMigrationRequestsCommits = (variables, signal) => dataPlaneFetch({
2773
+ url: "/dbs/{dbName}/migrations/{mrNumber}/commits",
2774
+ method: "post",
2775
+ ...variables,
2776
+ signal
2777
+ });
2778
+ const compareMigrationRequest = (variables, signal) => dataPlaneFetch({
2779
+ url: "/dbs/{dbName}/migrations/{mrNumber}/compare",
2780
+ method: "post",
2781
+ ...variables,
2782
+ signal
2783
+ });
2784
+ const getMigrationRequestIsMerged = (variables, signal) => dataPlaneFetch({
2785
+ url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
2786
+ method: "get",
2787
+ ...variables,
2788
+ signal
2789
+ });
2749
2790
  const mergeMigrationRequest = (variables, signal) => dataPlaneFetch({
2750
2791
  url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
2751
2792
  method: "post",
2752
2793
  ...variables,
2753
2794
  signal
2754
2795
  });
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 });
2796
+ const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({
2797
+ url: "/db/{dbBranchName}/schema/history",
2798
+ method: "post",
2799
+ ...variables,
2800
+ signal
2801
+ });
2802
+ const compareBranchWithUserSchema = (variables, signal) => dataPlaneFetch({
2803
+ url: "/db/{dbBranchName}/schema/compare",
2804
+ method: "post",
2805
+ ...variables,
2806
+ signal
2807
+ });
2808
+ const compareBranchSchemas = (variables, signal) => dataPlaneFetch({
2809
+ url: "/db/{dbBranchName}/schema/compare/{branchName}",
2810
+ method: "post",
2811
+ ...variables,
2812
+ signal
2813
+ });
2814
+ const updateBranchSchema = (variables, signal) => dataPlaneFetch({
2815
+ url: "/db/{dbBranchName}/schema/update",
2816
+ method: "post",
2817
+ ...variables,
2818
+ signal
2819
+ });
2820
+ const previewBranchSchemaEdit = (variables, signal) => dataPlaneFetch({
2821
+ url: "/db/{dbBranchName}/schema/preview",
2822
+ method: "post",
2823
+ ...variables,
2824
+ signal
2825
+ });
2826
+ const applyBranchSchemaEdit = (variables, signal) => dataPlaneFetch({
2827
+ url: "/db/{dbBranchName}/schema/apply",
2828
+ method: "post",
2829
+ ...variables,
2830
+ signal
2831
+ });
2832
+ const pushBranchMigrations = (variables, signal) => dataPlaneFetch({
2833
+ url: "/db/{dbBranchName}/schema/push",
2834
+ method: "post",
2835
+ ...variables,
2836
+ signal
2837
+ });
2762
2838
  const createTable = (variables, signal) => dataPlaneFetch({
2763
2839
  url: "/db/{dbBranchName}/tables/{tableName}",
2764
2840
  method: "put",
@@ -2771,14 +2847,24 @@ const deleteTable = (variables, signal) => dataPlaneFetch({
2771
2847
  ...variables,
2772
2848
  signal
2773
2849
  });
2774
- const updateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}", method: "patch", ...variables, signal });
2850
+ const updateTable = (variables, signal) => dataPlaneFetch({
2851
+ url: "/db/{dbBranchName}/tables/{tableName}",
2852
+ method: "patch",
2853
+ ...variables,
2854
+ signal
2855
+ });
2775
2856
  const getTableSchema = (variables, signal) => dataPlaneFetch({
2776
2857
  url: "/db/{dbBranchName}/tables/{tableName}/schema",
2777
2858
  method: "get",
2778
2859
  ...variables,
2779
2860
  signal
2780
2861
  });
2781
- const setTableSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/schema", method: "put", ...variables, signal });
2862
+ const setTableSchema = (variables, signal) => dataPlaneFetch({
2863
+ url: "/db/{dbBranchName}/tables/{tableName}/schema",
2864
+ method: "put",
2865
+ ...variables,
2866
+ signal
2867
+ });
2782
2868
  const getTableColumns = (variables, signal) => dataPlaneFetch({
2783
2869
  url: "/db/{dbBranchName}/tables/{tableName}/columns",
2784
2870
  method: "get",
@@ -2786,7 +2872,12 @@ const getTableColumns = (variables, signal) => dataPlaneFetch({
2786
2872
  signal
2787
2873
  });
2788
2874
  const addTableColumn = (variables, signal) => dataPlaneFetch(
2789
- { url: "/db/{dbBranchName}/tables/{tableName}/columns", method: "post", ...variables, signal }
2875
+ {
2876
+ url: "/db/{dbBranchName}/tables/{tableName}/columns",
2877
+ method: "post",
2878
+ ...variables,
2879
+ signal
2880
+ }
2790
2881
  );
2791
2882
  const getColumn = (variables, signal) => dataPlaneFetch({
2792
2883
  url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
@@ -2794,15 +2885,30 @@ const getColumn = (variables, signal) => dataPlaneFetch({
2794
2885
  ...variables,
2795
2886
  signal
2796
2887
  });
2797
- const updateColumn = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}", method: "patch", ...variables, signal });
2888
+ const updateColumn = (variables, signal) => dataPlaneFetch({
2889
+ url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
2890
+ method: "patch",
2891
+ ...variables,
2892
+ signal
2893
+ });
2798
2894
  const deleteColumn = (variables, signal) => dataPlaneFetch({
2799
2895
  url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
2800
2896
  method: "delete",
2801
2897
  ...variables,
2802
2898
  signal
2803
2899
  });
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 });
2900
+ const branchTransaction = (variables, signal) => dataPlaneFetch({
2901
+ url: "/db/{dbBranchName}/transaction",
2902
+ method: "post",
2903
+ ...variables,
2904
+ signal
2905
+ });
2906
+ const insertRecord = (variables, signal) => dataPlaneFetch({
2907
+ url: "/db/{dbBranchName}/tables/{tableName}/data",
2908
+ method: "post",
2909
+ ...variables,
2910
+ signal
2911
+ });
2806
2912
  const getFileItem = (variables, signal) => dataPlaneFetch({
2807
2913
  url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file/{fileId}",
2808
2914
  method: "get",
@@ -2845,11 +2951,36 @@ const getRecord = (variables, signal) => dataPlaneFetch({
2845
2951
  ...variables,
2846
2952
  signal
2847
2953
  });
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 });
2954
+ const insertRecordWithID = (variables, signal) => dataPlaneFetch({
2955
+ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
2956
+ method: "put",
2957
+ ...variables,
2958
+ signal
2959
+ });
2960
+ const updateRecordWithID = (variables, signal) => dataPlaneFetch({
2961
+ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
2962
+ method: "patch",
2963
+ ...variables,
2964
+ signal
2965
+ });
2966
+ const upsertRecordWithID = (variables, signal) => dataPlaneFetch({
2967
+ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
2968
+ method: "post",
2969
+ ...variables,
2970
+ signal
2971
+ });
2972
+ const deleteRecord = (variables, signal) => dataPlaneFetch({
2973
+ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
2974
+ method: "delete",
2975
+ ...variables,
2976
+ signal
2977
+ });
2978
+ const bulkInsertTableRecords = (variables, signal) => dataPlaneFetch({
2979
+ url: "/db/{dbBranchName}/tables/{tableName}/bulk",
2980
+ method: "post",
2981
+ ...variables,
2982
+ signal
2983
+ });
2853
2984
  const queryTable = (variables, signal) => dataPlaneFetch({
2854
2985
  url: "/db/{dbBranchName}/tables/{tableName}/query",
2855
2986
  method: "post",
@@ -2868,16 +2999,36 @@ const searchTable = (variables, signal) => dataPlaneFetch({
2868
2999
  ...variables,
2869
3000
  signal
2870
3001
  });
2871
- const vectorSearchTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/vectorSearch", method: "post", ...variables, signal });
3002
+ const vectorSearchTable = (variables, signal) => dataPlaneFetch({
3003
+ url: "/db/{dbBranchName}/tables/{tableName}/vectorSearch",
3004
+ method: "post",
3005
+ ...variables,
3006
+ signal
3007
+ });
2872
3008
  const askTable = (variables, signal) => dataPlaneFetch({
2873
3009
  url: "/db/{dbBranchName}/tables/{tableName}/ask",
2874
3010
  method: "post",
2875
3011
  ...variables,
2876
3012
  signal
2877
3013
  });
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 });
3014
+ const askTableSession = (variables, signal) => dataPlaneFetch({
3015
+ url: "/db/{dbBranchName}/tables/{tableName}/ask/{sessionId}",
3016
+ method: "post",
3017
+ ...variables,
3018
+ signal
3019
+ });
3020
+ const summarizeTable = (variables, signal) => dataPlaneFetch({
3021
+ url: "/db/{dbBranchName}/tables/{tableName}/summarize",
3022
+ method: "post",
3023
+ ...variables,
3024
+ signal
3025
+ });
3026
+ const aggregateTable = (variables, signal) => dataPlaneFetch({
3027
+ url: "/db/{dbBranchName}/tables/{tableName}/aggregate",
3028
+ method: "post",
3029
+ ...variables,
3030
+ signal
3031
+ });
2881
3032
  const fileAccess = (variables, signal) => dataPlaneFetch({
2882
3033
  url: "/file/{fileId}",
2883
3034
  method: "get",
@@ -2896,9 +3047,18 @@ const sqlQuery = (variables, signal) => dataPlaneFetch({
2896
3047
  ...variables,
2897
3048
  signal
2898
3049
  });
3050
+ const sqlBatchQuery = (variables, signal) => dataPlaneFetch({
3051
+ url: "/db/{dbBranchName}/sql/batch",
3052
+ method: "post",
3053
+ ...variables,
3054
+ signal
3055
+ });
2899
3056
  const operationsByTag$2 = {
2900
3057
  migrations: {
2901
3058
  applyMigration,
3059
+ startMigration,
3060
+ completeMigration,
3061
+ rollbackMigration,
2902
3062
  adaptTable,
2903
3063
  adaptAllTables,
2904
3064
  getBranchMigrationJobStatus,
@@ -2963,7 +3123,16 @@ const operationsByTag$2 = {
2963
3123
  deleteRecord,
2964
3124
  bulkInsertTableRecords
2965
3125
  },
2966
- files: { getFileItem, putFileItem, deleteFileItem, getFile, putFile, deleteFile, fileAccess, fileUpload },
3126
+ files: {
3127
+ getFileItem,
3128
+ putFileItem,
3129
+ deleteFileItem,
3130
+ getFile,
3131
+ putFile,
3132
+ deleteFile,
3133
+ fileAccess,
3134
+ fileUpload
3135
+ },
2967
3136
  searchAndFilter: {
2968
3137
  queryTable,
2969
3138
  searchBranch,
@@ -2974,7 +3143,7 @@ const operationsByTag$2 = {
2974
3143
  summarizeTable,
2975
3144
  aggregateTable
2976
3145
  },
2977
- sql: { sqlQuery }
3146
+ sql: { sqlQuery, sqlBatchQuery }
2978
3147
  };
2979
3148
 
2980
3149
  const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
@@ -3041,7 +3210,12 @@ const deleteOAuthAccessToken = (variables, signal) => controlPlaneFetch({
3041
3210
  ...variables,
3042
3211
  signal
3043
3212
  });
3044
- const updateOAuthAccessToken = (variables, signal) => controlPlaneFetch({ url: "/user/oauth/tokens/{token}", method: "patch", ...variables, signal });
3213
+ const updateOAuthAccessToken = (variables, signal) => controlPlaneFetch({
3214
+ url: "/user/oauth/tokens/{token}",
3215
+ method: "patch",
3216
+ ...variables,
3217
+ signal
3218
+ });
3045
3219
  const getWorkspacesList = (variables, signal) => controlPlaneFetch({
3046
3220
  url: "/workspaces",
3047
3221
  method: "get",
@@ -3072,49 +3246,150 @@ const deleteWorkspace = (variables, signal) => controlPlaneFetch({
3072
3246
  ...variables,
3073
3247
  signal
3074
3248
  });
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 });
3249
+ const getWorkspaceSettings = (variables, signal) => controlPlaneFetch({
3250
+ url: "/workspaces/{workspaceId}/settings",
3251
+ method: "get",
3252
+ ...variables,
3253
+ signal
3254
+ });
3255
+ const updateWorkspaceSettings = (variables, signal) => controlPlaneFetch({
3256
+ url: "/workspaces/{workspaceId}/settings",
3257
+ method: "patch",
3258
+ ...variables,
3259
+ signal
3260
+ });
3261
+ const getWorkspaceMembersList = (variables, signal) => controlPlaneFetch({
3262
+ url: "/workspaces/{workspaceId}/members",
3263
+ method: "get",
3264
+ ...variables,
3265
+ signal
3266
+ });
3267
+ const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({
3268
+ url: "/workspaces/{workspaceId}/members/{userId}",
3269
+ method: "put",
3270
+ ...variables,
3271
+ signal
3272
+ });
3079
3273
  const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
3080
3274
  url: "/workspaces/{workspaceId}/members/{userId}",
3081
3275
  method: "delete",
3082
3276
  ...variables,
3083
3277
  signal
3084
3278
  });
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 });
3279
+ const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({
3280
+ url: "/workspaces/{workspaceId}/invites",
3281
+ method: "post",
3282
+ ...variables,
3283
+ signal
3284
+ });
3285
+ const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
3286
+ url: "/workspaces/{workspaceId}/invites/{inviteId}",
3287
+ method: "patch",
3288
+ ...variables,
3289
+ signal
3290
+ });
3291
+ const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
3292
+ url: "/workspaces/{workspaceId}/invites/{inviteId}",
3293
+ method: "delete",
3294
+ ...variables,
3295
+ signal
3296
+ });
3297
+ const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
3298
+ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept",
3299
+ method: "post",
3300
+ ...variables,
3301
+ signal
3302
+ });
3303
+ const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
3304
+ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend",
3305
+ method: "post",
3306
+ ...variables,
3307
+ signal
3308
+ });
3309
+ const listClusters = (variables, signal) => controlPlaneFetch({
3310
+ url: "/workspaces/{workspaceId}/clusters",
3311
+ method: "get",
3312
+ ...variables,
3313
+ signal
3314
+ });
3315
+ const createCluster = (variables, signal) => controlPlaneFetch({
3316
+ url: "/workspaces/{workspaceId}/clusters",
3317
+ method: "post",
3318
+ ...variables,
3319
+ signal
3320
+ });
3092
3321
  const getCluster = (variables, signal) => controlPlaneFetch({
3093
3322
  url: "/workspaces/{workspaceId}/clusters/{clusterId}",
3094
3323
  method: "get",
3095
3324
  ...variables,
3096
3325
  signal
3097
3326
  });
3098
- const updateCluster = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters/{clusterId}", method: "patch", ...variables, signal });
3327
+ const updateCluster = (variables, signal) => controlPlaneFetch({
3328
+ url: "/workspaces/{workspaceId}/clusters/{clusterId}",
3329
+ method: "patch",
3330
+ ...variables,
3331
+ signal
3332
+ });
3333
+ const deleteCluster = (variables, signal) => controlPlaneFetch({
3334
+ url: "/workspaces/{workspaceId}/clusters/{clusterId}",
3335
+ method: "delete",
3336
+ ...variables,
3337
+ signal
3338
+ });
3099
3339
  const getDatabaseList = (variables, signal) => controlPlaneFetch({
3100
3340
  url: "/workspaces/{workspaceId}/dbs",
3101
3341
  method: "get",
3102
3342
  ...variables,
3103
3343
  signal
3104
3344
  });
3105
- const createDatabase = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "put", ...variables, signal });
3345
+ const createDatabase = (variables, signal) => controlPlaneFetch({
3346
+ url: "/workspaces/{workspaceId}/dbs/{dbName}",
3347
+ method: "put",
3348
+ ...variables,
3349
+ signal
3350
+ });
3106
3351
  const deleteDatabase = (variables, signal) => controlPlaneFetch({
3107
3352
  url: "/workspaces/{workspaceId}/dbs/{dbName}",
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 });
3357
+ const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({
3358
+ url: "/workspaces/{workspaceId}/dbs/{dbName}",
3359
+ method: "get",
3360
+ ...variables,
3361
+ signal
3362
+ });
3363
+ const updateDatabaseMetadata = (variables, signal) => controlPlaneFetch({
3364
+ url: "/workspaces/{workspaceId}/dbs/{dbName}",
3365
+ method: "patch",
3366
+ ...variables,
3367
+ signal
3368
+ });
3369
+ const renameDatabase = (variables, signal) => controlPlaneFetch({
3370
+ url: "/workspaces/{workspaceId}/dbs/{dbName}/rename",
3371
+ method: "post",
3372
+ ...variables,
3373
+ signal
3374
+ });
3375
+ const getDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({
3376
+ url: "/workspaces/{workspaceId}/dbs/{dbName}/github",
3377
+ method: "get",
3378
+ ...variables,
3379
+ signal
3380
+ });
3381
+ const updateDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({
3382
+ url: "/workspaces/{workspaceId}/dbs/{dbName}/github",
3383
+ method: "put",
3384
+ ...variables,
3385
+ signal
3386
+ });
3387
+ const deleteDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({
3388
+ url: "/workspaces/{workspaceId}/dbs/{dbName}/github",
3389
+ method: "delete",
3390
+ ...variables,
3391
+ signal
3392
+ });
3118
3393
  const listRegions = (variables, signal) => controlPlaneFetch({
3119
3394
  url: "/workspaces/{workspaceId}/regions",
3120
3395
  method: "get",
@@ -3152,7 +3427,13 @@ const operationsByTag$1 = {
3152
3427
  acceptWorkspaceMemberInvite,
3153
3428
  resendWorkspaceMemberInvite
3154
3429
  },
3155
- xbcontrolOther: { listClusters, createCluster, getCluster, updateCluster },
3430
+ xbcontrolOther: {
3431
+ listClusters,
3432
+ createCluster,
3433
+ getCluster,
3434
+ updateCluster,
3435
+ deleteCluster
3436
+ },
3156
3437
  databases: {
3157
3438
  getDatabaseList,
3158
3439
  createDatabase,
@@ -3169,28 +3450,17 @@ const operationsByTag$1 = {
3169
3450
 
3170
3451
  const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
3171
3452
 
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;
3453
+ var __typeError$7 = (msg) => {
3454
+ throw TypeError(msg);
3189
3455
  };
3456
+ var __accessCheck$7 = (obj, member, msg) => member.has(obj) || __typeError$7("Cannot " + msg);
3457
+ var __privateGet$6 = (obj, member, getter) => (__accessCheck$7(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
3458
+ 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);
3459
+ var __privateSet$5 = (obj, member, value, setter) => (__accessCheck$7(obj, member, "write to private field"), member.set(obj, value), value);
3190
3460
  var _extraProps, _namespaces;
3191
3461
  class XataApiClient {
3192
3462
  constructor(options = {}) {
3193
- __privateAdd$7(this, _extraProps, void 0);
3463
+ __privateAdd$7(this, _extraProps);
3194
3464
  __privateAdd$7(this, _namespaces, {});
3195
3465
  const provider = options.host ?? "production";
3196
3466
  const apiKey = options.apiKey ?? getAPIKey();
@@ -3211,38 +3481,31 @@ class XataApiClient {
3211
3481
  });
3212
3482
  }
3213
3483
  get user() {
3214
- if (!__privateGet$6(this, _namespaces).user)
3215
- __privateGet$6(this, _namespaces).user = new UserApi(__privateGet$6(this, _extraProps));
3484
+ if (!__privateGet$6(this, _namespaces).user) __privateGet$6(this, _namespaces).user = new UserApi(__privateGet$6(this, _extraProps));
3216
3485
  return __privateGet$6(this, _namespaces).user;
3217
3486
  }
3218
3487
  get authentication() {
3219
- if (!__privateGet$6(this, _namespaces).authentication)
3220
- __privateGet$6(this, _namespaces).authentication = new AuthenticationApi(__privateGet$6(this, _extraProps));
3488
+ if (!__privateGet$6(this, _namespaces).authentication) __privateGet$6(this, _namespaces).authentication = new AuthenticationApi(__privateGet$6(this, _extraProps));
3221
3489
  return __privateGet$6(this, _namespaces).authentication;
3222
3490
  }
3223
3491
  get workspaces() {
3224
- if (!__privateGet$6(this, _namespaces).workspaces)
3225
- __privateGet$6(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$6(this, _extraProps));
3492
+ if (!__privateGet$6(this, _namespaces).workspaces) __privateGet$6(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$6(this, _extraProps));
3226
3493
  return __privateGet$6(this, _namespaces).workspaces;
3227
3494
  }
3228
3495
  get invites() {
3229
- if (!__privateGet$6(this, _namespaces).invites)
3230
- __privateGet$6(this, _namespaces).invites = new InvitesApi(__privateGet$6(this, _extraProps));
3496
+ if (!__privateGet$6(this, _namespaces).invites) __privateGet$6(this, _namespaces).invites = new InvitesApi(__privateGet$6(this, _extraProps));
3231
3497
  return __privateGet$6(this, _namespaces).invites;
3232
3498
  }
3233
3499
  get database() {
3234
- if (!__privateGet$6(this, _namespaces).database)
3235
- __privateGet$6(this, _namespaces).database = new DatabaseApi(__privateGet$6(this, _extraProps));
3500
+ if (!__privateGet$6(this, _namespaces).database) __privateGet$6(this, _namespaces).database = new DatabaseApi(__privateGet$6(this, _extraProps));
3236
3501
  return __privateGet$6(this, _namespaces).database;
3237
3502
  }
3238
3503
  get branches() {
3239
- if (!__privateGet$6(this, _namespaces).branches)
3240
- __privateGet$6(this, _namespaces).branches = new BranchApi(__privateGet$6(this, _extraProps));
3504
+ if (!__privateGet$6(this, _namespaces).branches) __privateGet$6(this, _namespaces).branches = new BranchApi(__privateGet$6(this, _extraProps));
3241
3505
  return __privateGet$6(this, _namespaces).branches;
3242
3506
  }
3243
3507
  get migrations() {
3244
- if (!__privateGet$6(this, _namespaces).migrations)
3245
- __privateGet$6(this, _namespaces).migrations = new MigrationsApi(__privateGet$6(this, _extraProps));
3508
+ if (!__privateGet$6(this, _namespaces).migrations) __privateGet$6(this, _namespaces).migrations = new MigrationsApi(__privateGet$6(this, _extraProps));
3246
3509
  return __privateGet$6(this, _namespaces).migrations;
3247
3510
  }
3248
3511
  get migrationRequests() {
@@ -3251,23 +3514,19 @@ class XataApiClient {
3251
3514
  return __privateGet$6(this, _namespaces).migrationRequests;
3252
3515
  }
3253
3516
  get tables() {
3254
- if (!__privateGet$6(this, _namespaces).tables)
3255
- __privateGet$6(this, _namespaces).tables = new TableApi(__privateGet$6(this, _extraProps));
3517
+ if (!__privateGet$6(this, _namespaces).tables) __privateGet$6(this, _namespaces).tables = new TableApi(__privateGet$6(this, _extraProps));
3256
3518
  return __privateGet$6(this, _namespaces).tables;
3257
3519
  }
3258
3520
  get records() {
3259
- if (!__privateGet$6(this, _namespaces).records)
3260
- __privateGet$6(this, _namespaces).records = new RecordsApi(__privateGet$6(this, _extraProps));
3521
+ if (!__privateGet$6(this, _namespaces).records) __privateGet$6(this, _namespaces).records = new RecordsApi(__privateGet$6(this, _extraProps));
3261
3522
  return __privateGet$6(this, _namespaces).records;
3262
3523
  }
3263
3524
  get files() {
3264
- if (!__privateGet$6(this, _namespaces).files)
3265
- __privateGet$6(this, _namespaces).files = new FilesApi(__privateGet$6(this, _extraProps));
3525
+ if (!__privateGet$6(this, _namespaces).files) __privateGet$6(this, _namespaces).files = new FilesApi(__privateGet$6(this, _extraProps));
3266
3526
  return __privateGet$6(this, _namespaces).files;
3267
3527
  }
3268
3528
  get searchAndFilter() {
3269
- if (!__privateGet$6(this, _namespaces).searchAndFilter)
3270
- __privateGet$6(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$6(this, _extraProps));
3529
+ if (!__privateGet$6(this, _namespaces).searchAndFilter) __privateGet$6(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$6(this, _extraProps));
3271
3530
  return __privateGet$6(this, _namespaces).searchAndFilter;
3272
3531
  }
3273
3532
  }
@@ -4544,8 +4803,7 @@ function buildTransformString(transformations) {
4544
4803
  ).join(",");
4545
4804
  }
4546
4805
  function transformImage(url, ...transformations) {
4547
- if (!isDefined(url))
4548
- return void 0;
4806
+ if (!isDefined(url)) return void 0;
4549
4807
  const newTransformations = buildTransformString(transformations);
4550
4808
  const { hostname, pathname, search } = new URL(url);
4551
4809
  const pathParts = pathname.split("/");
@@ -4658,8 +4916,7 @@ class XataFile {
4658
4916
  }
4659
4917
  }
4660
4918
  const parseInputFileEntry = async (entry) => {
4661
- if (!isDefined(entry))
4662
- return null;
4919
+ if (!isDefined(entry)) return null;
4663
4920
  const { id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout, uploadUrlTimeout } = await entry;
4664
4921
  return compactObject({
4665
4922
  id,
@@ -4674,24 +4931,19 @@ const parseInputFileEntry = async (entry) => {
4674
4931
  };
4675
4932
 
4676
4933
  function cleanFilter(filter) {
4677
- if (!isDefined(filter))
4678
- return void 0;
4679
- if (!isObject(filter))
4680
- return filter;
4934
+ if (!isDefined(filter)) return void 0;
4935
+ if (!isObject(filter)) return filter;
4681
4936
  const values = Object.fromEntries(
4682
4937
  Object.entries(filter).reduce((acc, [key, value]) => {
4683
- if (!isDefined(value))
4684
- return acc;
4938
+ if (!isDefined(value)) return acc;
4685
4939
  if (Array.isArray(value)) {
4686
4940
  const clean = value.map((item) => cleanFilter(item)).filter((item) => isDefined(item));
4687
- if (clean.length === 0)
4688
- return acc;
4941
+ if (clean.length === 0) return acc;
4689
4942
  return [...acc, [key, clean]];
4690
4943
  }
4691
4944
  if (isObject(value)) {
4692
4945
  const clean = cleanFilter(value);
4693
- if (!isDefined(clean))
4694
- return acc;
4946
+ if (!isDefined(clean)) return acc;
4695
4947
  return [...acc, [key, clean]];
4696
4948
  }
4697
4949
  return [...acc, [key, value]];
@@ -4701,10 +4953,8 @@ function cleanFilter(filter) {
4701
4953
  }
4702
4954
 
4703
4955
  function stringifyJson(value) {
4704
- if (!isDefined(value))
4705
- return value;
4706
- if (isString(value))
4707
- return value;
4956
+ if (!isDefined(value)) return value;
4957
+ if (isString(value)) return value;
4708
4958
  try {
4709
4959
  return JSON.stringify(value);
4710
4960
  } catch (e) {
@@ -4719,28 +4969,17 @@ function parseJson(value) {
4719
4969
  }
4720
4970
  }
4721
4971
 
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;
4972
+ var __typeError$6 = (msg) => {
4973
+ throw TypeError(msg);
4739
4974
  };
4975
+ var __accessCheck$6 = (obj, member, msg) => member.has(obj) || __typeError$6("Cannot " + msg);
4976
+ var __privateGet$5 = (obj, member, getter) => (__accessCheck$6(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
4977
+ 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);
4978
+ var __privateSet$4 = (obj, member, value, setter) => (__accessCheck$6(obj, member, "write to private field"), member.set(obj, value), value);
4740
4979
  var _query, _page;
4741
4980
  class Page {
4742
4981
  constructor(query, meta, records = []) {
4743
- __privateAdd$6(this, _query, void 0);
4982
+ __privateAdd$6(this, _query);
4744
4983
  __privateSet$4(this, _query, query);
4745
4984
  this.meta = meta;
4746
4985
  this.records = new PageRecordArray(this, records);
@@ -4827,7 +5066,7 @@ class RecordArray extends Array {
4827
5066
  const _PageRecordArray = class _PageRecordArray extends Array {
4828
5067
  constructor(...args) {
4829
5068
  super(..._PageRecordArray.parseConstructorParams(...args));
4830
- __privateAdd$6(this, _page, void 0);
5069
+ __privateAdd$6(this, _page);
4831
5070
  __privateSet$4(this, _page, isObject(args[0]?.meta) ? args[0] : { meta: { page: { cursor: "", more: false } }, records: [] });
4832
5071
  }
4833
5072
  static parseConstructorParams(...args) {
@@ -4898,34 +5137,20 @@ const _PageRecordArray = class _PageRecordArray extends Array {
4898
5137
  _page = new WeakMap();
4899
5138
  let PageRecordArray = _PageRecordArray;
4900
5139
 
4901
- var __accessCheck$5 = (obj, member, msg) => {
4902
- if (!member.has(obj))
4903
- throw TypeError("Cannot " + msg);
4904
- };
4905
- var __privateGet$4 = (obj, member, getter) => {
4906
- __accessCheck$5(obj, member, "read from private field");
4907
- return getter ? getter.call(obj) : member.get(obj);
4908
- };
4909
- var __privateAdd$5 = (obj, member, value) => {
4910
- if (member.has(obj))
4911
- throw TypeError("Cannot add the same private member more than once");
4912
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
4913
- };
4914
- var __privateSet$3 = (obj, member, value, setter) => {
4915
- __accessCheck$5(obj, member, "write to private field");
4916
- setter ? setter.call(obj, value) : member.set(obj, value);
4917
- return value;
4918
- };
4919
- var __privateMethod$3 = (obj, member, method) => {
4920
- __accessCheck$5(obj, member, "access private method");
4921
- return method;
5140
+ var __typeError$5 = (msg) => {
5141
+ throw TypeError(msg);
4922
5142
  };
4923
- var _table$1, _repository, _data, _cleanFilterConstraint, cleanFilterConstraint_fn;
5143
+ var __accessCheck$5 = (obj, member, msg) => member.has(obj) || __typeError$5("Cannot " + msg);
5144
+ var __privateGet$4 = (obj, member, getter) => (__accessCheck$5(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
5145
+ 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);
5146
+ var __privateSet$3 = (obj, member, value, setter) => (__accessCheck$5(obj, member, "write to private field"), member.set(obj, value), value);
5147
+ var __privateMethod$3 = (obj, member, method) => (__accessCheck$5(obj, member, "access private method"), method);
5148
+ var _table$1, _repository, _data, _Query_instances, cleanFilterConstraint_fn;
4924
5149
  const _Query = class _Query {
4925
5150
  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);
5151
+ __privateAdd$5(this, _Query_instances);
5152
+ __privateAdd$5(this, _table$1);
5153
+ __privateAdd$5(this, _repository);
4929
5154
  __privateAdd$5(this, _data, { filter: {} });
4930
5155
  // Implements pagination
4931
5156
  this.meta = { page: { cursor: "start", more: true, size: PAGINATION_DEFAULT_SIZE } };
@@ -5004,12 +5229,12 @@ const _Query = class _Query {
5004
5229
  filter(a, b) {
5005
5230
  if (arguments.length === 1) {
5006
5231
  const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
5007
- [column]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, column, constraint)
5232
+ [column]: __privateMethod$3(this, _Query_instances, cleanFilterConstraint_fn).call(this, column, constraint)
5008
5233
  }));
5009
5234
  const $all = compact([__privateGet$4(this, _data).filter?.$all].flat().concat(constraints));
5010
5235
  return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
5011
5236
  } else {
5012
- const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, a, b) }] : void 0;
5237
+ const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this, _Query_instances, cleanFilterConstraint_fn).call(this, a, b) }] : void 0;
5013
5238
  const $all = compact([__privateGet$4(this, _data).filter?.$all].flat().concat(constraints));
5014
5239
  return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
5015
5240
  }
@@ -5088,8 +5313,7 @@ const _Query = class _Query {
5088
5313
  }
5089
5314
  async getFirstOrThrow(options = {}) {
5090
5315
  const records = await this.getMany({ ...options, pagination: { size: 1 } });
5091
- if (records[0] === void 0)
5092
- throw new Error("No results found.");
5316
+ if (records[0] === void 0) throw new Error("No results found.");
5093
5317
  return records[0];
5094
5318
  }
5095
5319
  async summarize(params = {}) {
@@ -5152,7 +5376,7 @@ const _Query = class _Query {
5152
5376
  _table$1 = new WeakMap();
5153
5377
  _repository = new WeakMap();
5154
5378
  _data = new WeakMap();
5155
- _cleanFilterConstraint = new WeakSet();
5379
+ _Query_instances = new WeakSet();
5156
5380
  cleanFilterConstraint_fn = function(column, value) {
5157
5381
  const columnType = __privateGet$4(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
5158
5382
  if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
@@ -5218,8 +5442,7 @@ function isSortFilterString(value) {
5218
5442
  }
5219
5443
  function isSortFilterBase(filter) {
5220
5444
  return isObject(filter) && Object.entries(filter).every(([key, value]) => {
5221
- if (key === "*")
5222
- return value === "random";
5445
+ if (key === "*") return value === "random";
5223
5446
  return value === "asc" || value === "desc";
5224
5447
  });
5225
5448
  }
@@ -5240,29 +5463,15 @@ function buildSortFilter(filter) {
5240
5463
  }
5241
5464
  }
5242
5465
 
5243
- var __accessCheck$4 = (obj, member, msg) => {
5244
- if (!member.has(obj))
5245
- throw TypeError("Cannot " + msg);
5466
+ var __typeError$4 = (msg) => {
5467
+ throw TypeError(msg);
5246
5468
  };
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);
5255
- };
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;
5469
+ var __accessCheck$4 = (obj, member, msg) => member.has(obj) || __typeError$4("Cannot " + msg);
5470
+ var __privateGet$3 = (obj, member, getter) => (__accessCheck$4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
5471
+ 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);
5472
+ var __privateSet$2 = (obj, member, value, setter) => (__accessCheck$4(obj, member, "write to private field"), member.set(obj, value), value);
5473
+ var __privateMethod$2 = (obj, member, method) => (__accessCheck$4(obj, member, "access private method"), method);
5474
+ 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
5475
  const BULK_OPERATION_MAX_SIZE = 1e3;
5267
5476
  class Repository extends Query {
5268
5477
  }
@@ -5273,24 +5482,13 @@ class RestRepository extends Query {
5273
5482
  { name: options.table, schema: options.schemaTables?.find((table) => table.name === options.table) },
5274
5483
  {}
5275
5484
  );
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);
5485
+ __privateAdd$4(this, _RestRepository_instances);
5486
+ __privateAdd$4(this, _table);
5487
+ __privateAdd$4(this, _getFetchProps);
5488
+ __privateAdd$4(this, _db);
5489
+ __privateAdd$4(this, _cache);
5490
+ __privateAdd$4(this, _schemaTables);
5491
+ __privateAdd$4(this, _trace);
5294
5492
  __privateSet$2(this, _table, options.table);
5295
5493
  __privateSet$2(this, _db, options.db);
5296
5494
  __privateSet$2(this, _cache, options.pluginOptions.cache);
@@ -5310,28 +5508,25 @@ class RestRepository extends Query {
5310
5508
  return __privateGet$3(this, _trace).call(this, "create", async () => {
5311
5509
  const ifVersion = parseIfVersion(b, c, d);
5312
5510
  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 });
5511
+ if (a.length === 0) return [];
5512
+ const ids = await __privateMethod$2(this, _RestRepository_instances, insertRecords_fn).call(this, a, { ifVersion, createOnly: true });
5316
5513
  const columns = isValidSelectableColumns(b) ? b : ["*"];
5317
5514
  const result = await this.read(ids, columns);
5318
5515
  return result;
5319
5516
  }
5320
5517
  if (isString(a) && isObject(b)) {
5321
- if (a === "")
5322
- throw new Error("The id can't be empty");
5518
+ if (a === "") throw new Error("The id can't be empty");
5323
5519
  const columns = isValidSelectableColumns(c) ? c : void 0;
5324
- return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
5520
+ return await __privateMethod$2(this, _RestRepository_instances, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
5325
5521
  }
5326
5522
  if (isObject(a) && isString(a.id)) {
5327
- if (a.id === "")
5328
- throw new Error("The id can't be empty");
5523
+ if (a.id === "") throw new Error("The id can't be empty");
5329
5524
  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 });
5525
+ return await __privateMethod$2(this, _RestRepository_instances, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: true, ifVersion });
5331
5526
  }
5332
5527
  if (isObject(a)) {
5333
5528
  const columns = isValidSelectableColumns(b) ? b : void 0;
5334
- return __privateMethod$2(this, _insertRecordWithoutId, insertRecordWithoutId_fn).call(this, a, columns);
5529
+ return __privateMethod$2(this, _RestRepository_instances, insertRecordWithoutId_fn).call(this, a, columns);
5335
5530
  }
5336
5531
  throw new Error("Invalid arguments for create method");
5337
5532
  });
@@ -5340,8 +5535,7 @@ class RestRepository extends Query {
5340
5535
  return __privateGet$3(this, _trace).call(this, "read", async () => {
5341
5536
  const columns = isValidSelectableColumns(b) ? b : ["*"];
5342
5537
  if (Array.isArray(a)) {
5343
- if (a.length === 0)
5344
- return [];
5538
+ if (a.length === 0) return [];
5345
5539
  const ids = a.map((item) => extractId(item));
5346
5540
  const finalObjects = await this.getAll({ filter: { id: { $any: compact(ids) } }, columns });
5347
5541
  const dictionary = finalObjects.reduce((acc, object) => {
@@ -5364,7 +5558,7 @@ class RestRepository extends Query {
5364
5558
  queryParams: { columns },
5365
5559
  ...__privateGet$3(this, _getFetchProps).call(this)
5366
5560
  });
5367
- const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
5561
+ const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
5368
5562
  return initObject(
5369
5563
  __privateGet$3(this, _db),
5370
5564
  schemaTables,
@@ -5405,11 +5599,10 @@ class RestRepository extends Query {
5405
5599
  return __privateGet$3(this, _trace).call(this, "update", async () => {
5406
5600
  const ifVersion = parseIfVersion(b, c, d);
5407
5601
  if (Array.isArray(a)) {
5408
- if (a.length === 0)
5409
- return [];
5602
+ if (a.length === 0) return [];
5410
5603
  const existing = await this.read(a, ["id"]);
5411
5604
  const updates = a.filter((_item, index) => existing[index] !== null);
5412
- await __privateMethod$2(this, _updateRecords, updateRecords_fn).call(this, updates, {
5605
+ await __privateMethod$2(this, _RestRepository_instances, updateRecords_fn).call(this, updates, {
5413
5606
  ifVersion,
5414
5607
  upsert: false
5415
5608
  });
@@ -5420,15 +5613,14 @@ class RestRepository extends Query {
5420
5613
  try {
5421
5614
  if (isString(a) && isObject(b)) {
5422
5615
  const columns = isValidSelectableColumns(c) ? c : void 0;
5423
- return await __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
5616
+ return await __privateMethod$2(this, _RestRepository_instances, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
5424
5617
  }
5425
5618
  if (isObject(a) && isString(a.id)) {
5426
5619
  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 });
5620
+ return await __privateMethod$2(this, _RestRepository_instances, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
5428
5621
  }
5429
5622
  } catch (error) {
5430
- if (error.status === 422)
5431
- return null;
5623
+ if (error.status === 422) return null;
5432
5624
  throw error;
5433
5625
  }
5434
5626
  throw new Error("Invalid arguments for update method");
@@ -5457,9 +5649,8 @@ class RestRepository extends Query {
5457
5649
  return __privateGet$3(this, _trace).call(this, "createOrUpdate", async () => {
5458
5650
  const ifVersion = parseIfVersion(b, c, d);
5459
5651
  if (Array.isArray(a)) {
5460
- if (a.length === 0)
5461
- return [];
5462
- await __privateMethod$2(this, _updateRecords, updateRecords_fn).call(this, a, {
5652
+ if (a.length === 0) return [];
5653
+ await __privateMethod$2(this, _RestRepository_instances, updateRecords_fn).call(this, a, {
5463
5654
  ifVersion,
5464
5655
  upsert: true
5465
5656
  });
@@ -5468,16 +5659,14 @@ class RestRepository extends Query {
5468
5659
  return result;
5469
5660
  }
5470
5661
  if (isString(a) && isObject(b)) {
5471
- if (a === "")
5472
- throw new Error("The id can't be empty");
5662
+ if (a === "") throw new Error("The id can't be empty");
5473
5663
  const columns = isValidSelectableColumns(c) ? c : void 0;
5474
- return await __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
5664
+ return await __privateMethod$2(this, _RestRepository_instances, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
5475
5665
  }
5476
5666
  if (isObject(a) && isString(a.id)) {
5477
- if (a.id === "")
5478
- throw new Error("The id can't be empty");
5667
+ if (a.id === "") throw new Error("The id can't be empty");
5479
5668
  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 });
5669
+ return await __privateMethod$2(this, _RestRepository_instances, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
5481
5670
  }
5482
5671
  if (!isDefined(a) && isObject(b)) {
5483
5672
  return await this.create(b, c);
@@ -5492,24 +5681,21 @@ class RestRepository extends Query {
5492
5681
  return __privateGet$3(this, _trace).call(this, "createOrReplace", async () => {
5493
5682
  const ifVersion = parseIfVersion(b, c, d);
5494
5683
  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 });
5684
+ if (a.length === 0) return [];
5685
+ const ids = await __privateMethod$2(this, _RestRepository_instances, insertRecords_fn).call(this, a, { ifVersion, createOnly: false });
5498
5686
  const columns = isValidSelectableColumns(b) ? b : ["*"];
5499
5687
  const result = await this.read(ids, columns);
5500
5688
  return result;
5501
5689
  }
5502
5690
  if (isString(a) && isObject(b)) {
5503
- if (a === "")
5504
- throw new Error("The id can't be empty");
5691
+ if (a === "") throw new Error("The id can't be empty");
5505
5692
  const columns = isValidSelectableColumns(c) ? c : void 0;
5506
- return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
5693
+ return await __privateMethod$2(this, _RestRepository_instances, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
5507
5694
  }
5508
5695
  if (isObject(a) && isString(a.id)) {
5509
- if (a.id === "")
5510
- throw new Error("The id can't be empty");
5696
+ if (a.id === "") throw new Error("The id can't be empty");
5511
5697
  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 });
5698
+ return await __privateMethod$2(this, _RestRepository_instances, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
5513
5699
  }
5514
5700
  if (!isDefined(a) && isObject(b)) {
5515
5701
  return await this.create(b, c);
@@ -5523,25 +5709,22 @@ class RestRepository extends Query {
5523
5709
  async delete(a, b) {
5524
5710
  return __privateGet$3(this, _trace).call(this, "delete", async () => {
5525
5711
  if (Array.isArray(a)) {
5526
- if (a.length === 0)
5527
- return [];
5712
+ if (a.length === 0) return [];
5528
5713
  const ids = a.map((o) => {
5529
- if (isString(o))
5530
- return o;
5531
- if (isString(o.id))
5532
- return o.id;
5714
+ if (isString(o)) return o;
5715
+ if (isString(o.id)) return o.id;
5533
5716
  throw new Error("Invalid arguments for delete method");
5534
5717
  });
5535
5718
  const columns = isValidSelectableColumns(b) ? b : ["*"];
5536
5719
  const result = await this.read(a, columns);
5537
- await __privateMethod$2(this, _deleteRecords, deleteRecords_fn).call(this, ids);
5720
+ await __privateMethod$2(this, _RestRepository_instances, deleteRecords_fn).call(this, ids);
5538
5721
  return result;
5539
5722
  }
5540
5723
  if (isString(a)) {
5541
- return __privateMethod$2(this, _deleteRecord, deleteRecord_fn).call(this, a, b);
5724
+ return __privateMethod$2(this, _RestRepository_instances, deleteRecord_fn).call(this, a, b);
5542
5725
  }
5543
5726
  if (isObject(a) && isString(a.id)) {
5544
- return __privateMethod$2(this, _deleteRecord, deleteRecord_fn).call(this, a.id, b);
5727
+ return __privateMethod$2(this, _RestRepository_instances, deleteRecord_fn).call(this, a.id, b);
5545
5728
  }
5546
5729
  throw new Error("Invalid arguments for delete method");
5547
5730
  });
@@ -5585,7 +5768,7 @@ class RestRepository extends Query {
5585
5768
  },
5586
5769
  ...__privateGet$3(this, _getFetchProps).call(this)
5587
5770
  });
5588
- const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
5771
+ const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
5589
5772
  return {
5590
5773
  records: records.map((item) => initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), item, ["*"])),
5591
5774
  totalCount
@@ -5610,7 +5793,7 @@ class RestRepository extends Query {
5610
5793
  },
5611
5794
  ...__privateGet$3(this, _getFetchProps).call(this)
5612
5795
  });
5613
- const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
5796
+ const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
5614
5797
  return {
5615
5798
  records: records.map((item) => initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), item, ["*"])),
5616
5799
  totalCount
@@ -5634,9 +5817,8 @@ class RestRepository extends Query {
5634
5817
  }
5635
5818
  async query(query) {
5636
5819
  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);
5820
+ const cacheQuery = await __privateMethod$2(this, _RestRepository_instances, getCacheQuery_fn).call(this, query);
5821
+ if (cacheQuery) return new Page(query, cacheQuery.meta, cacheQuery.records);
5640
5822
  const data = query.getQueryOptions();
5641
5823
  const { meta, records: objects } = await queryTable({
5642
5824
  pathParams: {
@@ -5655,7 +5837,7 @@ class RestRepository extends Query {
5655
5837
  fetchOptions: data.fetchOptions,
5656
5838
  ...__privateGet$3(this, _getFetchProps).call(this)
5657
5839
  });
5658
- const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
5840
+ const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
5659
5841
  const records = objects.map(
5660
5842
  (record) => initObject(
5661
5843
  __privateGet$3(this, _db),
@@ -5665,7 +5847,7 @@ class RestRepository extends Query {
5665
5847
  data.columns ?? ["*"]
5666
5848
  )
5667
5849
  );
5668
- await __privateMethod$2(this, _setCacheQuery, setCacheQuery_fn).call(this, query, meta, records);
5850
+ await __privateMethod$2(this, _RestRepository_instances, setCacheQuery_fn).call(this, query, meta, records);
5669
5851
  return new Page(query, meta, records);
5670
5852
  });
5671
5853
  }
@@ -5690,7 +5872,7 @@ class RestRepository extends Query {
5690
5872
  },
5691
5873
  ...__privateGet$3(this, _getFetchProps).call(this)
5692
5874
  });
5693
- const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
5875
+ const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
5694
5876
  return {
5695
5877
  ...result,
5696
5878
  summaries: result.summaries.map(
@@ -5739,9 +5921,9 @@ _db = new WeakMap();
5739
5921
  _cache = new WeakMap();
5740
5922
  _schemaTables = new WeakMap();
5741
5923
  _trace = new WeakMap();
5742
- _insertRecordWithoutId = new WeakSet();
5924
+ _RestRepository_instances = new WeakSet();
5743
5925
  insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
5744
- const record = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
5926
+ const record = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
5745
5927
  const response = await insertRecord({
5746
5928
  pathParams: {
5747
5929
  workspace: "{workspaceId}",
@@ -5753,14 +5935,12 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
5753
5935
  body: record,
5754
5936
  ...__privateGet$3(this, _getFetchProps).call(this)
5755
5937
  });
5756
- const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
5938
+ const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
5757
5939
  return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
5758
5940
  };
5759
- _insertRecordWithId = new WeakSet();
5760
5941
  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);
5942
+ if (!recordId) return null;
5943
+ const record = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
5764
5944
  const response = await insertRecordWithID({
5765
5945
  pathParams: {
5766
5946
  workspace: "{workspaceId}",
@@ -5773,13 +5953,12 @@ insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { crea
5773
5953
  queryParams: { createOnly, columns, ifVersion },
5774
5954
  ...__privateGet$3(this, _getFetchProps).call(this)
5775
5955
  });
5776
- const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
5956
+ const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
5777
5957
  return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
5778
5958
  };
5779
- _insertRecords = new WeakSet();
5780
5959
  insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
5781
5960
  const operations = await promiseMap(objects, async (object) => {
5782
- const record = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
5961
+ const record = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
5783
5962
  return { insert: { table: __privateGet$3(this, _table), record, createOnly, ifVersion } };
5784
5963
  });
5785
5964
  const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
@@ -5804,11 +5983,9 @@ insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
5804
5983
  }
5805
5984
  return ids;
5806
5985
  };
5807
- _updateRecordWithID = new WeakSet();
5808
5986
  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);
5987
+ if (!recordId) return null;
5988
+ const { id: _id, ...record } = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
5812
5989
  try {
5813
5990
  const response = await updateRecordWithID({
5814
5991
  pathParams: {
@@ -5822,7 +5999,7 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
5822
5999
  body: record,
5823
6000
  ...__privateGet$3(this, _getFetchProps).call(this)
5824
6001
  });
5825
- const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
6002
+ const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
5826
6003
  return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
5827
6004
  } catch (e) {
5828
6005
  if (isObject(e) && e.status === 404) {
@@ -5831,10 +6008,9 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
5831
6008
  throw e;
5832
6009
  }
5833
6010
  };
5834
- _updateRecords = new WeakSet();
5835
6011
  updateRecords_fn = async function(objects, { ifVersion, upsert }) {
5836
6012
  const operations = await promiseMap(objects, async ({ id, ...object }) => {
5837
- const fields = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
6013
+ const fields = await __privateMethod$2(this, _RestRepository_instances, transformObjectToApi_fn).call(this, object);
5838
6014
  return { update: { table: __privateGet$3(this, _table), id, ifVersion, upsert, fields } };
5839
6015
  });
5840
6016
  const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
@@ -5859,10 +6035,8 @@ updateRecords_fn = async function(objects, { ifVersion, upsert }) {
5859
6035
  }
5860
6036
  return ids;
5861
6037
  };
5862
- _upsertRecordWithID = new WeakSet();
5863
6038
  upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
5864
- if (!recordId)
5865
- return null;
6039
+ if (!recordId) return null;
5866
6040
  const response = await upsertRecordWithID({
5867
6041
  pathParams: {
5868
6042
  workspace: "{workspaceId}",
@@ -5875,13 +6049,11 @@ upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
5875
6049
  body: object,
5876
6050
  ...__privateGet$3(this, _getFetchProps).call(this)
5877
6051
  });
5878
- const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
6052
+ const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
5879
6053
  return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
5880
6054
  };
5881
- _deleteRecord = new WeakSet();
5882
6055
  deleteRecord_fn = async function(recordId, columns = ["*"]) {
5883
- if (!recordId)
5884
- return null;
6056
+ if (!recordId) return null;
5885
6057
  try {
5886
6058
  const response = await deleteRecord({
5887
6059
  pathParams: {
@@ -5894,7 +6066,7 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
5894
6066
  queryParams: { columns },
5895
6067
  ...__privateGet$3(this, _getFetchProps).call(this)
5896
6068
  });
5897
- const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
6069
+ const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
5898
6070
  return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
5899
6071
  } catch (e) {
5900
6072
  if (isObject(e) && e.status === 404) {
@@ -5903,7 +6075,6 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
5903
6075
  throw e;
5904
6076
  }
5905
6077
  };
5906
- _deleteRecords = new WeakSet();
5907
6078
  deleteRecords_fn = async function(recordIds) {
5908
6079
  const chunkedOperations = chunk(
5909
6080
  compact(recordIds).map((id) => ({ delete: { table: __privateGet$3(this, _table), id } })),
@@ -5921,27 +6092,21 @@ deleteRecords_fn = async function(recordIds) {
5921
6092
  });
5922
6093
  }
5923
6094
  };
5924
- _setCacheQuery = new WeakSet();
5925
6095
  setCacheQuery_fn = async function(query, meta, records) {
5926
6096
  await __privateGet$3(this, _cache)?.set(`query_${__privateGet$3(this, _table)}:${query.key()}`, { date: /* @__PURE__ */ new Date(), meta, records });
5927
6097
  };
5928
- _getCacheQuery = new WeakSet();
5929
6098
  getCacheQuery_fn = async function(query) {
5930
6099
  const key = `query_${__privateGet$3(this, _table)}:${query.key()}`;
5931
6100
  const result = await __privateGet$3(this, _cache)?.get(key);
5932
- if (!result)
5933
- return null;
6101
+ if (!result) return null;
5934
6102
  const defaultTTL = __privateGet$3(this, _cache)?.defaultQueryTTL ?? -1;
5935
6103
  const { cache: ttl = defaultTTL } = query.getQueryOptions();
5936
- if (ttl < 0)
5937
- return null;
6104
+ if (ttl < 0) return null;
5938
6105
  const hasExpired = result.date.getTime() + ttl < Date.now();
5939
6106
  return hasExpired ? null : result;
5940
6107
  };
5941
- _getSchemaTables = new WeakSet();
5942
6108
  getSchemaTables_fn = async function() {
5943
- if (__privateGet$3(this, _schemaTables))
5944
- return __privateGet$3(this, _schemaTables);
6109
+ if (__privateGet$3(this, _schemaTables)) return __privateGet$3(this, _schemaTables);
5945
6110
  const { schema } = await getBranchDetails({
5946
6111
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
5947
6112
  ...__privateGet$3(this, _getFetchProps).call(this)
@@ -5949,16 +6114,13 @@ getSchemaTables_fn = async function() {
5949
6114
  __privateSet$2(this, _schemaTables, schema.tables);
5950
6115
  return schema.tables;
5951
6116
  };
5952
- _transformObjectToApi = new WeakSet();
5953
6117
  transformObjectToApi_fn = async function(object) {
5954
- const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
6118
+ const schemaTables = await __privateMethod$2(this, _RestRepository_instances, getSchemaTables_fn).call(this);
5955
6119
  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`);
6120
+ if (!schema) throw new Error(`Table ${__privateGet$3(this, _table)} not found in schema`);
5958
6121
  const result = {};
5959
6122
  for (const [key, value] of Object.entries(object)) {
5960
- if (key === "xata")
5961
- continue;
6123
+ if (key === "xata") continue;
5962
6124
  const type = schema.columns.find((column) => column.name === key)?.type;
5963
6125
  switch (type) {
5964
6126
  case "link": {
@@ -5989,11 +6151,9 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
5989
6151
  const { xata, ...rest } = object ?? {};
5990
6152
  Object.assign(data, rest);
5991
6153
  const { columns } = schemaTables.find(({ name }) => name === table) ?? {};
5992
- if (!columns)
5993
- console.error(`Table ${table} not found in schema`);
6154
+ if (!columns) console.error(`Table ${table} not found in schema`);
5994
6155
  for (const column of columns ?? []) {
5995
- if (!isValidColumn(selectedColumns, column))
5996
- continue;
6156
+ if (!isValidColumn(selectedColumns, column)) continue;
5997
6157
  const value = data[column.name];
5998
6158
  switch (column.type) {
5999
6159
  case "datetime": {
@@ -6086,15 +6246,12 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
6086
6246
  return record;
6087
6247
  };
6088
6248
  function extractId(value) {
6089
- if (isString(value))
6090
- return value;
6091
- if (isObject(value) && isString(value.id))
6092
- return value.id;
6249
+ if (isString(value)) return value;
6250
+ if (isObject(value) && isString(value.id)) return value.id;
6093
6251
  return void 0;
6094
6252
  }
6095
6253
  function isValidColumn(columns, column) {
6096
- if (columns.includes("*"))
6097
- return true;
6254
+ if (columns.includes("*")) return true;
6098
6255
  return columns.filter((item) => isString(item) && item.startsWith(column.name)).length > 0;
6099
6256
  }
6100
6257
  function parseIfVersion(...args) {
@@ -6106,28 +6263,17 @@ function parseIfVersion(...args) {
6106
6263
  return void 0;
6107
6264
  }
6108
6265
 
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;
6266
+ var __typeError$3 = (msg) => {
6267
+ throw TypeError(msg);
6126
6268
  };
6269
+ var __accessCheck$3 = (obj, member, msg) => member.has(obj) || __typeError$3("Cannot " + msg);
6270
+ var __privateGet$2 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), member.get(obj));
6271
+ 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);
6272
+ var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), member.set(obj, value), value);
6127
6273
  var _map;
6128
6274
  class SimpleCache {
6129
6275
  constructor(options = {}) {
6130
- __privateAdd$3(this, _map, void 0);
6276
+ __privateAdd$3(this, _map);
6131
6277
  __privateSet$1(this, _map, /* @__PURE__ */ new Map());
6132
6278
  this.capacity = options.max ?? 500;
6133
6279
  this.defaultQueryTTL = options.defaultQueryTTL ?? 60 * 1e3;
@@ -6183,19 +6329,12 @@ const includesAll = (value) => ({ $includesAll: value });
6183
6329
  const includesNone = (value) => ({ $includesNone: value });
6184
6330
  const includesAny = (value) => ({ $includesAny: value });
6185
6331
 
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);
6332
+ var __typeError$2 = (msg) => {
6333
+ throw TypeError(msg);
6198
6334
  };
6335
+ var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg);
6336
+ var __privateGet$1 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
6337
+ 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
6338
  var _tables;
6200
6339
  class SchemaPlugin extends XataPlugin {
6201
6340
  constructor() {
@@ -6207,8 +6346,7 @@ class SchemaPlugin extends XataPlugin {
6207
6346
  {},
6208
6347
  {
6209
6348
  get: (_target, table) => {
6210
- if (!isString(table))
6211
- throw new Error("Invalid table name");
6349
+ if (!isString(table)) throw new Error("Invalid table name");
6212
6350
  if (__privateGet$1(this, _tables)[table] === void 0) {
6213
6351
  __privateGet$1(this, _tables)[table] = new RestRepository({ db, pluginOptions, table, schemaTables: pluginOptions.tables });
6214
6352
  }
@@ -6299,30 +6437,23 @@ function getContentType(file) {
6299
6437
  return "application/octet-stream";
6300
6438
  }
6301
6439
 
6302
- var __accessCheck$1 = (obj, member, msg) => {
6303
- if (!member.has(obj))
6304
- throw TypeError("Cannot " + msg);
6305
- };
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);
6440
+ var __typeError$1 = (msg) => {
6441
+ throw TypeError(msg);
6310
6442
  };
6311
- var __privateMethod$1 = (obj, member, method) => {
6312
- __accessCheck$1(obj, member, "access private method");
6313
- return method;
6314
- };
6315
- var _search, search_fn;
6443
+ var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
6444
+ 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);
6445
+ var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
6446
+ var _SearchPlugin_instances, search_fn;
6316
6447
  class SearchPlugin extends XataPlugin {
6317
6448
  constructor(db) {
6318
6449
  super();
6319
6450
  this.db = db;
6320
- __privateAdd$1(this, _search);
6451
+ __privateAdd$1(this, _SearchPlugin_instances);
6321
6452
  }
6322
6453
  build(pluginOptions) {
6323
6454
  return {
6324
6455
  all: async (query, options = {}) => {
6325
- const { records, totalCount } = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
6456
+ const { records, totalCount } = await __privateMethod$1(this, _SearchPlugin_instances, search_fn).call(this, query, options, pluginOptions);
6326
6457
  return {
6327
6458
  totalCount,
6328
6459
  records: records.map((record) => {
@@ -6332,7 +6463,7 @@ class SearchPlugin extends XataPlugin {
6332
6463
  };
6333
6464
  },
6334
6465
  byTable: async (query, options = {}) => {
6335
- const { records: rawRecords, totalCount } = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
6466
+ const { records: rawRecords, totalCount } = await __privateMethod$1(this, _SearchPlugin_instances, search_fn).call(this, query, options, pluginOptions);
6336
6467
  const records = rawRecords.reduce((acc, record) => {
6337
6468
  const { table = "orphan" } = record.xata;
6338
6469
  const items = acc[table] ?? [];
@@ -6344,7 +6475,7 @@ class SearchPlugin extends XataPlugin {
6344
6475
  };
6345
6476
  }
6346
6477
  }
6347
- _search = new WeakSet();
6478
+ _SearchPlugin_instances = new WeakSet();
6348
6479
  search_fn = async function(query, options, pluginOptions) {
6349
6480
  const { tables, fuzziness, highlight, prefix, page } = options ?? {};
6350
6481
  const { records, totalCount } = await searchBranch({
@@ -6380,8 +6511,7 @@ function arrayString(val) {
6380
6511
  return result;
6381
6512
  }
6382
6513
  function prepareValue(value) {
6383
- if (!isDefined(value))
6384
- return null;
6514
+ if (!isDefined(value)) return null;
6385
6515
  if (value instanceof Date) {
6386
6516
  return value.toISOString();
6387
6517
  }
@@ -6434,6 +6564,18 @@ class SQLPlugin extends XataPlugin {
6434
6564
  return { records, rows, warning, columns };
6435
6565
  };
6436
6566
  sqlFunction.connectionString = buildConnectionString(pluginOptions);
6567
+ sqlFunction.batch = async (query) => {
6568
+ const { results } = await sqlBatchQuery({
6569
+ pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
6570
+ body: {
6571
+ statements: query.statements.map(({ statement, params }) => ({ statement, params })),
6572
+ consistency: query.consistency,
6573
+ responseType: query.responseType
6574
+ },
6575
+ ...pluginOptions
6576
+ });
6577
+ return { results };
6578
+ };
6437
6579
  return sqlFunction;
6438
6580
  }
6439
6581
  }
@@ -6460,8 +6602,7 @@ function buildDomain(host, region) {
6460
6602
  function buildConnectionString({ apiKey, workspacesApiUrl, branch }) {
6461
6603
  const url = isString(workspacesApiUrl) ? workspacesApiUrl : workspacesApiUrl("", {});
6462
6604
  const parts = parseWorkspacesUrlParts(url);
6463
- if (!parts)
6464
- throw new Error("Invalid workspaces URL");
6605
+ if (!parts) throw new Error("Invalid workspaces URL");
6465
6606
  const { workspace: workspaceSlug, region, database, host } = parts;
6466
6607
  const domain = buildDomain(host, region);
6467
6608
  const workspace = workspaceSlug.split("-").pop();
@@ -6486,39 +6627,24 @@ class TransactionPlugin extends XataPlugin {
6486
6627
  }
6487
6628
  }
6488
6629
 
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;
6630
+ var __typeError = (msg) => {
6631
+ throw TypeError(msg);
6510
6632
  };
6633
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
6634
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
6635
+ 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);
6636
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
6637
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
6511
6638
  const buildClient = (plugins) => {
6512
- var _options, _parseOptions, parseOptions_fn, _getFetchProps, getFetchProps_fn, _a;
6639
+ var _options, _instances, parseOptions_fn, getFetchProps_fn, _a;
6513
6640
  return _a = class {
6514
6641
  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);
6642
+ __privateAdd(this, _instances);
6643
+ __privateAdd(this, _options);
6644
+ const safeOptions = __privateMethod(this, _instances, parseOptions_fn).call(this, options);
6519
6645
  __privateSet(this, _options, safeOptions);
6520
6646
  const pluginOptions = {
6521
- ...__privateMethod(this, _getFetchProps, getFetchProps_fn).call(this, safeOptions),
6647
+ ...__privateMethod(this, _instances, getFetchProps_fn).call(this, safeOptions),
6522
6648
  cache: safeOptions.cache,
6523
6649
  host: safeOptions.host,
6524
6650
  tables,
@@ -6536,8 +6662,7 @@ const buildClient = (plugins) => {
6536
6662
  this.sql = sql;
6537
6663
  this.files = files;
6538
6664
  for (const [key, namespace] of Object.entries(plugins ?? {})) {
6539
- if (namespace === void 0)
6540
- continue;
6665
+ if (namespace === void 0) continue;
6541
6666
  this[key] = namespace.build(pluginOptions);
6542
6667
  }
6543
6668
  }
@@ -6546,7 +6671,7 @@ const buildClient = (plugins) => {
6546
6671
  const branch = __privateGet(this, _options).branch;
6547
6672
  return { databaseURL, branch };
6548
6673
  }
6549
- }, _options = new WeakMap(), _parseOptions = new WeakSet(), parseOptions_fn = function(options) {
6674
+ }, _options = new WeakMap(), _instances = new WeakSet(), parseOptions_fn = function(options) {
6550
6675
  const enableBrowser = options?.enableBrowser ?? getEnableBrowserVariable() ?? false;
6551
6676
  const isBrowser = typeof window !== "undefined" && typeof Deno === "undefined";
6552
6677
  if (isBrowser && !enableBrowser) {
@@ -6601,7 +6726,7 @@ const buildClient = (plugins) => {
6601
6726
  clientName,
6602
6727
  xataAgentExtra
6603
6728
  };
6604
- }, _getFetchProps = new WeakSet(), getFetchProps_fn = function({
6729
+ }, getFetchProps_fn = function({
6605
6730
  fetch,
6606
6731
  apiKey,
6607
6732
  databaseURL,
@@ -6642,26 +6767,19 @@ class Serializer {
6642
6767
  }
6643
6768
  toJSON(data) {
6644
6769
  function visit(obj) {
6645
- if (Array.isArray(obj))
6646
- return obj.map(visit);
6770
+ if (Array.isArray(obj)) return obj.map(visit);
6647
6771
  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;
6772
+ if (type === "undefined") return { [META]: "undefined" };
6773
+ if (type === "bigint") return { [META]: "bigint", [VALUE]: obj.toString() };
6774
+ if (obj === null || type !== "object") return obj;
6654
6775
  const constructor = obj.constructor;
6655
6776
  const o = { [META]: constructor.name };
6656
6777
  for (const [key, value] of Object.entries(obj)) {
6657
6778
  o[key] = visit(value);
6658
6779
  }
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];
6780
+ if (constructor === Date) o[VALUE] = obj.toISOString();
6781
+ if (constructor === Map) o[VALUE] = Object.fromEntries(obj);
6782
+ if (constructor === Set) o[VALUE] = [...obj];
6665
6783
  return o;
6666
6784
  }
6667
6785
  return JSON.stringify(visit(data));
@@ -6674,16 +6792,11 @@ class Serializer {
6674
6792
  if (constructor) {
6675
6793
  return Object.assign(Object.create(constructor.prototype), rest);
6676
6794
  }
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;
6795
+ if (clazz === "Date") return new Date(val);
6796
+ if (clazz === "Set") return new Set(val);
6797
+ if (clazz === "Map") return new Map(Object.entries(val));
6798
+ if (clazz === "bigint") return BigInt(val);
6799
+ if (clazz === "undefined") return void 0;
6687
6800
  return rest;
6688
6801
  }
6689
6802
  return value;
@@ -6751,6 +6864,7 @@ exports.cancelWorkspaceMemberInvite = cancelWorkspaceMemberInvite;
6751
6864
  exports.compareBranchSchemas = compareBranchSchemas;
6752
6865
  exports.compareBranchWithUserSchema = compareBranchWithUserSchema;
6753
6866
  exports.compareMigrationRequest = compareMigrationRequest;
6867
+ exports.completeMigration = completeMigration;
6754
6868
  exports.contains = contains;
6755
6869
  exports.copyBranch = copyBranch;
6756
6870
  exports.createBranch = createBranch;
@@ -6761,6 +6875,7 @@ exports.createTable = createTable;
6761
6875
  exports.createUserAPIKey = createUserAPIKey;
6762
6876
  exports.createWorkspace = createWorkspace;
6763
6877
  exports.deleteBranch = deleteBranch;
6878
+ exports.deleteCluster = deleteCluster;
6764
6879
  exports.deleteColumn = deleteColumn;
6765
6880
  exports.deleteDatabase = deleteDatabase;
6766
6881
  exports.deleteDatabaseGithubSettings = deleteDatabaseGithubSettings;
@@ -6870,11 +6985,14 @@ exports.removeWorkspaceMember = removeWorkspaceMember;
6870
6985
  exports.renameDatabase = renameDatabase;
6871
6986
  exports.resendWorkspaceMemberInvite = resendWorkspaceMemberInvite;
6872
6987
  exports.resolveBranch = resolveBranch;
6988
+ exports.rollbackMigration = rollbackMigration;
6873
6989
  exports.searchBranch = searchBranch;
6874
6990
  exports.searchTable = searchTable;
6875
6991
  exports.serialize = serialize;
6876
6992
  exports.setTableSchema = setTableSchema;
6993
+ exports.sqlBatchQuery = sqlBatchQuery;
6877
6994
  exports.sqlQuery = sqlQuery;
6995
+ exports.startMigration = startMigration;
6878
6996
  exports.startsWith = startsWith;
6879
6997
  exports.summarizeTable = summarizeTable;
6880
6998
  exports.transformImage = transformImage;