@xata.io/client 0.0.0-alpha.vf8b86c5 → 0.0.0-alpha.vf90263d

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
@@ -20,7 +20,8 @@ const TraceAttributes = {
20
20
  HTTP_METHOD: "http.method",
21
21
  HTTP_URL: "http.url",
22
22
  HTTP_ROUTE: "http.route",
23
- HTTP_TARGET: "http.target"
23
+ HTTP_TARGET: "http.target",
24
+ CLOUDFLARE_RAY_ID: "cf.ray"
24
25
  };
25
26
 
26
27
  function notEmpty(value) {
@@ -32,8 +33,15 @@ function compact(arr) {
32
33
  function compactObject(obj) {
33
34
  return Object.fromEntries(Object.entries(obj).filter(([, value]) => notEmpty(value)));
34
35
  }
36
+ function isBlob(value) {
37
+ try {
38
+ return value instanceof Blob;
39
+ } catch (error) {
40
+ return false;
41
+ }
42
+ }
35
43
  function isObject(value) {
36
- return Boolean(value) && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date);
44
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date) && !isBlob(value);
37
45
  }
38
46
  function isDefined(value) {
39
47
  return value !== null && value !== void 0;
@@ -88,6 +96,18 @@ function chunk(array, chunkSize) {
88
96
  async function timeout(ms) {
89
97
  return new Promise((resolve) => setTimeout(resolve, ms));
90
98
  }
99
+ function timeoutWithCancel(ms) {
100
+ let timeoutId;
101
+ const promise = new Promise((resolve) => {
102
+ timeoutId = setTimeout(() => {
103
+ resolve();
104
+ }, ms);
105
+ });
106
+ return {
107
+ cancel: () => clearTimeout(timeoutId),
108
+ promise
109
+ };
110
+ }
91
111
  function promiseMap(inputValues, mapper) {
92
112
  const reducer = (acc$, inputValue) => acc$.then(
93
113
  (acc) => mapper(inputValue).then((result) => {
@@ -196,7 +216,7 @@ function getAPIKey() {
196
216
  function getBranch() {
197
217
  try {
198
218
  const { branch } = getEnvironment();
199
- return branch ?? "main";
219
+ return branch;
200
220
  } catch (err) {
201
221
  return void 0;
202
222
  }
@@ -224,12 +244,6 @@ function getPreviewBranch() {
224
244
  }
225
245
  }
226
246
 
227
- var __defProp$8 = Object.defineProperty;
228
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
229
- var __publicField$8 = (obj, key, value) => {
230
- __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
231
- return value;
232
- };
233
247
  var __accessCheck$8 = (obj, member, msg) => {
234
248
  if (!member.has(obj))
235
249
  throw TypeError("Cannot " + msg);
@@ -253,13 +267,13 @@ var __privateMethod$4 = (obj, member, method) => {
253
267
  return method;
254
268
  };
255
269
  var _fetch, _queue, _concurrency, _enqueue, enqueue_fn;
270
+ const REQUEST_TIMEOUT = 5 * 60 * 1e3;
256
271
  function getFetchImplementation(userFetch) {
257
272
  const globalFetch = typeof fetch !== "undefined" ? fetch : void 0;
258
- const fetchImpl = userFetch ?? globalFetch;
273
+ const globalThisFetch = typeof globalThis !== "undefined" ? globalThis.fetch : void 0;
274
+ const fetchImpl = userFetch ?? globalFetch ?? globalThisFetch;
259
275
  if (!fetchImpl) {
260
- throw new Error(
261
- `Couldn't find \`fetch\`. Install a fetch implementation such as \`node-fetch\` and pass it explicitly.`
262
- );
276
+ throw new Error(`Couldn't find a global \`fetch\`. Pass a fetch implementation explicitly.`);
263
277
  }
264
278
  return fetchImpl;
265
279
  }
@@ -269,8 +283,6 @@ class ApiRequestPool {
269
283
  __privateAdd$8(this, _fetch, void 0);
270
284
  __privateAdd$8(this, _queue, void 0);
271
285
  __privateAdd$8(this, _concurrency, void 0);
272
- __publicField$8(this, "running");
273
- __publicField$8(this, "started");
274
286
  __privateSet$8(this, _queue, []);
275
287
  __privateSet$8(this, _concurrency, concurrency);
276
288
  this.running = 0;
@@ -287,9 +299,13 @@ class ApiRequestPool {
287
299
  }
288
300
  request(url, options) {
289
301
  const start = /* @__PURE__ */ new Date();
290
- const fetch2 = this.getFetch();
302
+ const fetchImpl = this.getFetch();
291
303
  const runRequest = async (stalled = false) => {
292
- const response = await fetch2(url, options);
304
+ const { promise, cancel } = timeoutWithCancel(REQUEST_TIMEOUT);
305
+ const response = await Promise.race([fetchImpl(url, options), promise.then(() => null)]).finally(cancel);
306
+ if (!response) {
307
+ throw new Error("Request timed out");
308
+ }
293
309
  if (response.status === 429) {
294
310
  const rateLimitReset = parseNumber(response.headers?.get("x-ratelimit-reset")) ?? 1;
295
311
  await timeout(rateLimitReset * 1e3);
@@ -297,7 +313,7 @@ class ApiRequestPool {
297
313
  }
298
314
  if (stalled) {
299
315
  const stalledTime = (/* @__PURE__ */ new Date()).getTime() - start.getTime();
300
- console.warn(`A request to Xata hit your workspace limits, was retried and stalled for ${stalledTime}ms`);
316
+ console.warn(`A request to Xata hit branch rate limits, was retried and stalled for ${stalledTime}ms`);
301
317
  }
302
318
  return response;
303
319
  };
@@ -512,26 +528,16 @@ function defaultOnOpen(response) {
512
528
  }
513
529
  }
514
530
 
515
- const VERSION = "0.24.3";
531
+ const VERSION = "0.27.0";
516
532
 
517
- var __defProp$7 = Object.defineProperty;
518
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
519
- var __publicField$7 = (obj, key, value) => {
520
- __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
521
- return value;
522
- };
523
533
  class ErrorWithCause extends Error {
524
534
  constructor(message, options) {
525
535
  super(message, options);
526
- __publicField$7(this, "cause");
527
536
  }
528
537
  }
529
538
  class FetcherError extends ErrorWithCause {
530
539
  constructor(status, data, requestId) {
531
540
  super(getMessage(data));
532
- __publicField$7(this, "status");
533
- __publicField$7(this, "requestId");
534
- __publicField$7(this, "errors");
535
541
  this.status = status;
536
542
  this.errors = isBulkError(data) ? data.errors : [{ message: getMessage(data), status }];
537
543
  this.requestId = requestId;
@@ -598,11 +604,14 @@ function hostHeader(url) {
598
604
  const { groups } = pattern.exec(url) ?? {};
599
605
  return groups?.host ? { Host: groups.host } : {};
600
606
  }
601
- function parseBody(body, headers) {
607
+ async function parseBody(body, headers) {
602
608
  if (!isDefined(body))
603
609
  return void 0;
610
+ if (isBlob(body) || typeof body.text === "function") {
611
+ return body;
612
+ }
604
613
  const { "Content-Type": contentType } = headers ?? {};
605
- if (String(contentType).toLowerCase() === "application/json") {
614
+ if (String(contentType).toLowerCase() === "application/json" && isObject(body)) {
606
615
  return JSON.stringify(body);
607
616
  }
608
617
  return body;
@@ -659,7 +668,7 @@ async function fetch$1({
659
668
  const response = await pool.request(url, {
660
669
  ...fetchOptions,
661
670
  method: method.toUpperCase(),
662
- body: parseBody(body, headers),
671
+ body: await parseBody(body, headers),
663
672
  headers,
664
673
  signal
665
674
  });
@@ -670,7 +679,8 @@ async function fetch$1({
670
679
  [TraceAttributes.HTTP_REQUEST_ID]: requestId,
671
680
  [TraceAttributes.HTTP_STATUS_CODE]: response.status,
672
681
  [TraceAttributes.HTTP_HOST]: host,
673
- [TraceAttributes.HTTP_SCHEME]: protocol?.replace(":", "")
682
+ [TraceAttributes.HTTP_SCHEME]: protocol?.replace(":", ""),
683
+ [TraceAttributes.CLOUDFLARE_RAY_ID]: response.headers?.get("cf-ray") ?? void 0
674
684
  });
675
685
  const message = response.headers?.get("x-xata-message");
676
686
  if (message)
@@ -758,6 +768,12 @@ function parseUrl(url) {
758
768
 
759
769
  const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
760
770
 
771
+ const applyMigration = (variables, signal) => dataPlaneFetch({
772
+ url: "/db/{dbBranchName}/pgroll/apply",
773
+ method: "post",
774
+ ...variables,
775
+ signal
776
+ });
761
777
  const getBranchList = (variables, signal) => dataPlaneFetch({
762
778
  url: "/dbs/{dbName}",
763
779
  method: "get",
@@ -777,6 +793,12 @@ const deleteBranch = (variables, signal) => dataPlaneFetch({
777
793
  ...variables,
778
794
  signal
779
795
  });
796
+ const getSchema = (variables, signal) => dataPlaneFetch({
797
+ url: "/db/{dbBranchName}/schema",
798
+ method: "get",
799
+ ...variables,
800
+ signal
801
+ });
780
802
  const copyBranch = (variables, signal) => dataPlaneFetch({
781
803
  url: "/db/{dbBranchName}/copy",
782
804
  method: "post",
@@ -942,12 +964,6 @@ const searchTable = (variables, signal) => dataPlaneFetch({
942
964
  ...variables,
943
965
  signal
944
966
  });
945
- const sqlQuery = (variables, signal) => dataPlaneFetch({
946
- url: "/db/{dbBranchName}/sql",
947
- method: "post",
948
- ...variables,
949
- signal
950
- });
951
967
  const vectorSearchTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/vectorSearch", method: "post", ...variables, signal });
952
968
  const askTable = (variables, signal) => dataPlaneFetch({
953
969
  url: "/db/{dbBranchName}/tables/{tableName}/ask",
@@ -955,7 +971,7 @@ const askTable = (variables, signal) => dataPlaneFetch({
955
971
  ...variables,
956
972
  signal
957
973
  });
958
- const chatSessionMessage = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/ask/{sessionId}", method: "post", ...variables, signal });
974
+ const askTableSession = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/ask/{sessionId}", method: "post", ...variables, signal });
959
975
  const summarizeTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/summarize", method: "post", ...variables, signal });
960
976
  const aggregateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/aggregate", method: "post", ...variables, signal });
961
977
  const fileAccess = (variables, signal) => dataPlaneFetch({
@@ -964,8 +980,15 @@ const fileAccess = (variables, signal) => dataPlaneFetch({
964
980
  ...variables,
965
981
  signal
966
982
  });
983
+ const sqlQuery = (variables, signal) => dataPlaneFetch({
984
+ url: "/db/{dbBranchName}/sql",
985
+ method: "post",
986
+ ...variables,
987
+ signal
988
+ });
967
989
  const operationsByTag$2 = {
968
990
  branch: {
991
+ applyMigration,
969
992
  getBranchList,
970
993
  getBranchDetails,
971
994
  createBranch,
@@ -980,6 +1003,7 @@ const operationsByTag$2 = {
980
1003
  resolveBranch
981
1004
  },
982
1005
  migrations: {
1006
+ getSchema,
983
1007
  getBranchMigrationHistory,
984
1008
  getBranchMigrationPlan,
985
1009
  executeBranchMigrationPlan,
@@ -1028,17 +1052,19 @@ const operationsByTag$2 = {
1028
1052
  queryTable,
1029
1053
  searchBranch,
1030
1054
  searchTable,
1031
- sqlQuery,
1032
1055
  vectorSearchTable,
1033
1056
  askTable,
1034
- chatSessionMessage,
1057
+ askTableSession,
1035
1058
  summarizeTable,
1036
1059
  aggregateTable
1037
- }
1060
+ },
1061
+ sql: { sqlQuery }
1038
1062
  };
1039
1063
 
1040
1064
  const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
1041
1065
 
1066
+ const getAuthorizationCode = (variables, signal) => controlPlaneFetch({ url: "/oauth/authorize", method: "get", ...variables, signal });
1067
+ const grantAuthorizationCode = (variables, signal) => controlPlaneFetch({ url: "/oauth/authorize", method: "post", ...variables, signal });
1042
1068
  const getUser = (variables, signal) => controlPlaneFetch({
1043
1069
  url: "/user",
1044
1070
  method: "get",
@@ -1075,6 +1101,31 @@ const deleteUserAPIKey = (variables, signal) => controlPlaneFetch({
1075
1101
  ...variables,
1076
1102
  signal
1077
1103
  });
1104
+ const getUserOAuthClients = (variables, signal) => controlPlaneFetch({
1105
+ url: "/user/oauth/clients",
1106
+ method: "get",
1107
+ ...variables,
1108
+ signal
1109
+ });
1110
+ const deleteUserOAuthClient = (variables, signal) => controlPlaneFetch({
1111
+ url: "/user/oauth/clients/{clientId}",
1112
+ method: "delete",
1113
+ ...variables,
1114
+ signal
1115
+ });
1116
+ const getUserOAuthAccessTokens = (variables, signal) => controlPlaneFetch({
1117
+ url: "/user/oauth/tokens",
1118
+ method: "get",
1119
+ ...variables,
1120
+ signal
1121
+ });
1122
+ const deleteOAuthAccessToken = (variables, signal) => controlPlaneFetch({
1123
+ url: "/user/oauth/tokens/{token}",
1124
+ method: "delete",
1125
+ ...variables,
1126
+ signal
1127
+ });
1128
+ const updateOAuthAccessToken = (variables, signal) => controlPlaneFetch({ url: "/user/oauth/tokens/{token}", method: "patch", ...variables, signal });
1078
1129
  const getWorkspacesList = (variables, signal) => controlPlaneFetch({
1079
1130
  url: "/workspaces",
1080
1131
  method: "get",
@@ -1118,6 +1169,20 @@ const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ u
1118
1169
  const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "delete", ...variables, signal });
1119
1170
  const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
1120
1171
  const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
1172
+ const listClusters = (variables, signal) => controlPlaneFetch({
1173
+ url: "/workspaces/{workspaceId}/clusters",
1174
+ method: "get",
1175
+ ...variables,
1176
+ signal
1177
+ });
1178
+ const createCluster = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters", method: "post", ...variables, signal });
1179
+ const getCluster = (variables, signal) => controlPlaneFetch({
1180
+ url: "/workspaces/{workspaceId}/clusters/{clusterId}",
1181
+ method: "get",
1182
+ ...variables,
1183
+ signal
1184
+ });
1185
+ const updateCluster = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters/{clusterId}", method: "patch", ...variables, signal });
1121
1186
  const getDatabaseList = (variables, signal) => controlPlaneFetch({
1122
1187
  url: "/workspaces/{workspaceId}/dbs",
1123
1188
  method: "get",
@@ -1144,6 +1209,15 @@ const listRegions = (variables, signal) => controlPlaneFetch({
1144
1209
  signal
1145
1210
  });
1146
1211
  const operationsByTag$1 = {
1212
+ oAuth: {
1213
+ getAuthorizationCode,
1214
+ grantAuthorizationCode,
1215
+ getUserOAuthClients,
1216
+ deleteUserOAuthClient,
1217
+ getUserOAuthAccessTokens,
1218
+ deleteOAuthAccessToken,
1219
+ updateOAuthAccessToken
1220
+ },
1147
1221
  users: { getUser, updateUser, deleteUser },
1148
1222
  authentication: { getUserAPIKeys, createUserAPIKey, deleteUserAPIKey },
1149
1223
  workspaces: {
@@ -1163,6 +1237,7 @@ const operationsByTag$1 = {
1163
1237
  acceptWorkspaceMemberInvite,
1164
1238
  resendWorkspaceMemberInvite
1165
1239
  },
1240
+ xbcontrolOther: { listClusters, createCluster, getCluster, updateCluster },
1166
1241
  databases: {
1167
1242
  getDatabaseList,
1168
1243
  createDatabase,
@@ -2156,7 +2231,7 @@ class SearchAndFilterApi {
2156
2231
  ...this.extraProps
2157
2232
  });
2158
2233
  }
2159
- chatSessionMessage({
2234
+ askTableSession({
2160
2235
  workspace,
2161
2236
  region,
2162
2237
  database,
@@ -2165,7 +2240,7 @@ class SearchAndFilterApi {
2165
2240
  sessionId,
2166
2241
  message
2167
2242
  }) {
2168
- return operationsByTag.searchAndFilter.chatSessionMessage({
2243
+ return operationsByTag.searchAndFilter.askTableSession({
2169
2244
  pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, sessionId },
2170
2245
  body: { message },
2171
2246
  ...this.extraProps
@@ -2558,60 +2633,6 @@ class XataApiPlugin {
2558
2633
  class XataPlugin {
2559
2634
  }
2560
2635
 
2561
- class FilesPlugin extends XataPlugin {
2562
- build(pluginOptions) {
2563
- return {
2564
- download: async (location) => {
2565
- const { table, record, column, fileId = "" } = location ?? {};
2566
- return await getFileItem({
2567
- pathParams: {
2568
- workspace: "{workspaceId}",
2569
- dbBranchName: "{dbBranch}",
2570
- region: "{region}",
2571
- tableName: table ?? "",
2572
- recordId: record ?? "",
2573
- columnName: column ?? "",
2574
- fileId
2575
- },
2576
- ...pluginOptions,
2577
- rawResponse: true
2578
- });
2579
- },
2580
- upload: async (location, file) => {
2581
- const { table, record, column, fileId = "" } = location ?? {};
2582
- return await putFileItem({
2583
- pathParams: {
2584
- workspace: "{workspaceId}",
2585
- dbBranchName: "{dbBranch}",
2586
- region: "{region}",
2587
- tableName: table ?? "",
2588
- recordId: record ?? "",
2589
- columnName: column ?? "",
2590
- fileId
2591
- },
2592
- body: file,
2593
- ...pluginOptions
2594
- });
2595
- },
2596
- delete: async (location) => {
2597
- const { table, record, column, fileId = "" } = location ?? {};
2598
- return await deleteFileItem({
2599
- pathParams: {
2600
- workspace: "{workspaceId}",
2601
- dbBranchName: "{dbBranch}",
2602
- region: "{region}",
2603
- tableName: table ?? "",
2604
- recordId: record ?? "",
2605
- columnName: column ?? "",
2606
- fileId
2607
- },
2608
- ...pluginOptions
2609
- });
2610
- }
2611
- };
2612
- }
2613
- }
2614
-
2615
2636
  function buildTransformString(transformations) {
2616
2637
  return transformations.flatMap(
2617
2638
  (t) => Object.entries(t).map(([key, value]) => {
@@ -2627,74 +2648,34 @@ function buildTransformString(transformations) {
2627
2648
  })
2628
2649
  ).join(",");
2629
2650
  }
2630
- function transformImage(url, transformations) {
2651
+ function transformImage(url, ...transformations) {
2631
2652
  if (!isDefined(url))
2632
2653
  return void 0;
2633
- const transformationsString = buildTransformString(transformations);
2654
+ const newTransformations = buildTransformString(transformations);
2634
2655
  const { hostname, pathname, search } = new URL(url);
2635
- return `https://${hostname}/transform/${transformationsString}${pathname}${search}`;
2656
+ const pathParts = pathname.split("/");
2657
+ const transformIndex = pathParts.findIndex((part) => part === "transform");
2658
+ const removedItems = transformIndex >= 0 ? pathParts.splice(transformIndex, 2) : [];
2659
+ const transform = `/transform/${[removedItems[1], newTransformations].filter(isDefined).join(",")}`;
2660
+ const path = pathParts.join("/");
2661
+ return `https://${hostname}${transform}${path}${search}`;
2636
2662
  }
2637
2663
 
2638
- var __defProp$6 = Object.defineProperty;
2639
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2640
- var __publicField$6 = (obj, key, value) => {
2641
- __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
2642
- return value;
2643
- };
2644
2664
  class XataFile {
2645
2665
  constructor(file) {
2646
- /**
2647
- * Name of this file.
2648
- */
2649
- __publicField$6(this, "name");
2650
- /**
2651
- * Media type of this file.
2652
- */
2653
- __publicField$6(this, "mediaType");
2654
- /**
2655
- * Base64 encoded content of this file.
2656
- */
2657
- __publicField$6(this, "base64Content");
2658
- /**
2659
- * Whether to enable public url for this file.
2660
- */
2661
- __publicField$6(this, "enablePublicUrl");
2662
- /**
2663
- * Timeout for the signed url.
2664
- */
2665
- __publicField$6(this, "signedUrlTimeout");
2666
- /**
2667
- * Size of this file.
2668
- */
2669
- __publicField$6(this, "size");
2670
- /**
2671
- * Version of this file.
2672
- */
2673
- __publicField$6(this, "version");
2674
- /**
2675
- * Url of this file.
2676
- */
2677
- __publicField$6(this, "url");
2678
- /**
2679
- * Signed url of this file.
2680
- */
2681
- __publicField$6(this, "signedUrl");
2682
- /**
2683
- * Attributes of this file.
2684
- */
2685
- __publicField$6(this, "attributes");
2686
- this.name = file.name;
2666
+ this.id = file.id;
2667
+ this.name = file.name || "";
2687
2668
  this.mediaType = file.mediaType || "application/octet-stream";
2688
2669
  this.base64Content = file.base64Content;
2689
- this.enablePublicUrl = file.enablePublicUrl;
2690
- this.signedUrlTimeout = file.signedUrlTimeout;
2691
- this.size = file.size;
2692
- this.version = file.version;
2693
- this.url = file.url;
2670
+ this.enablePublicUrl = file.enablePublicUrl ?? false;
2671
+ this.signedUrlTimeout = file.signedUrlTimeout ?? 300;
2672
+ this.size = file.size ?? 0;
2673
+ this.version = file.version ?? 1;
2674
+ this.url = file.url || "";
2694
2675
  this.signedUrl = file.signedUrl;
2695
- this.attributes = file.attributes;
2676
+ this.attributes = file.attributes || {};
2696
2677
  }
2697
- static async fromBuffer(buffer, options = {}) {
2678
+ static fromBuffer(buffer, options = {}) {
2698
2679
  const base64Content = buffer.toString("base64");
2699
2680
  return new XataFile({ ...options, base64Content });
2700
2681
  }
@@ -2704,9 +2685,9 @@ class XataFile {
2704
2685
  }
2705
2686
  return Buffer.from(this.base64Content, "base64");
2706
2687
  }
2707
- static async fromArrayBuffer(arrayBuffer, options = {}) {
2688
+ static fromArrayBuffer(arrayBuffer, options = {}) {
2708
2689
  const uint8Array = new Uint8Array(arrayBuffer);
2709
- return await this.fromUint8Array(uint8Array, options);
2690
+ return this.fromUint8Array(uint8Array, options);
2710
2691
  }
2711
2692
  toArrayBuffer() {
2712
2693
  if (!this.base64Content) {
@@ -2715,7 +2696,7 @@ class XataFile {
2715
2696
  const binary = atob(this.base64Content);
2716
2697
  return new ArrayBuffer(binary.length);
2717
2698
  }
2718
- static async fromUint8Array(uint8Array, options = {}) {
2699
+ static fromUint8Array(uint8Array, options = {}) {
2719
2700
  let binary = "";
2720
2701
  for (let i = 0; i < uint8Array.byteLength; i++) {
2721
2702
  binary += String.fromCharCode(uint8Array[i]);
@@ -2738,16 +2719,20 @@ class XataFile {
2738
2719
  const name = options.name ?? file.name;
2739
2720
  const mediaType = file.type;
2740
2721
  const arrayBuffer = await file.arrayBuffer();
2741
- return await this.fromArrayBuffer(arrayBuffer, { ...options, name, mediaType });
2722
+ return this.fromArrayBuffer(arrayBuffer, { ...options, name, mediaType });
2742
2723
  }
2743
2724
  toBlob() {
2744
2725
  if (!this.base64Content) {
2745
2726
  throw new Error(`File content is not available, please select property "base64Content" when querying the file`);
2746
2727
  }
2747
- const arrayBuffer = this.toArrayBuffer();
2748
- return new Blob([arrayBuffer], { type: this.mediaType });
2728
+ const binary = atob(this.base64Content);
2729
+ const uint8Array = new Uint8Array(binary.length);
2730
+ for (let i = 0; i < binary.length; i++) {
2731
+ uint8Array[i] = binary.charCodeAt(i);
2732
+ }
2733
+ return new Blob([uint8Array], { type: this.mediaType });
2749
2734
  }
2750
- static async fromString(string, options = {}) {
2735
+ static fromString(string, options = {}) {
2751
2736
  const base64Content = btoa(string);
2752
2737
  return new XataFile({ ...options, base64Content });
2753
2738
  }
@@ -2757,7 +2742,7 @@ class XataFile {
2757
2742
  }
2758
2743
  return atob(this.base64Content);
2759
2744
  }
2760
- static async fromBase64(base64Content, options = {}) {
2745
+ static fromBase64(base64Content, options = {}) {
2761
2746
  return new XataFile({ ...options, base64Content });
2762
2747
  }
2763
2748
  toBase64() {
@@ -2768,16 +2753,26 @@ class XataFile {
2768
2753
  }
2769
2754
  transform(...options) {
2770
2755
  return {
2771
- url: transformImage(this.url, options),
2772
- signedUrl: transformImage(this.signedUrl, options)
2756
+ url: transformImage(this.url, ...options),
2757
+ signedUrl: transformImage(this.signedUrl, ...options),
2758
+ metadataUrl: transformImage(this.url, ...options, { format: "json" }),
2759
+ metadataSignedUrl: transformImage(this.signedUrl, ...options, { format: "json" })
2773
2760
  };
2774
2761
  }
2775
2762
  }
2776
- const parseInputFileEntry = (entry) => {
2763
+ const parseInputFileEntry = async (entry) => {
2777
2764
  if (!isDefined(entry))
2778
2765
  return null;
2779
- const { id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout } = entry;
2780
- return compactObject({ id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout });
2766
+ const { id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout } = await entry;
2767
+ return compactObject({
2768
+ id,
2769
+ // Name cannot be an empty string in our API
2770
+ name: name ? name : void 0,
2771
+ mediaType,
2772
+ base64Content,
2773
+ enablePublicUrl,
2774
+ signedUrlTimeout
2775
+ });
2781
2776
  };
2782
2777
 
2783
2778
  function cleanFilter(filter) {
@@ -2807,12 +2802,25 @@ function cleanFilter(filter) {
2807
2802
  return Object.keys(values).length > 0 ? values : void 0;
2808
2803
  }
2809
2804
 
2810
- var __defProp$5 = Object.defineProperty;
2811
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2812
- var __publicField$5 = (obj, key, value) => {
2813
- __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
2814
- return value;
2815
- };
2805
+ function stringifyJson(value) {
2806
+ if (!isDefined(value))
2807
+ return value;
2808
+ if (isString(value))
2809
+ return value;
2810
+ try {
2811
+ return JSON.stringify(value);
2812
+ } catch (e) {
2813
+ return value;
2814
+ }
2815
+ }
2816
+ function parseJson(value) {
2817
+ try {
2818
+ return JSON.parse(value);
2819
+ } catch (e) {
2820
+ return value;
2821
+ }
2822
+ }
2823
+
2816
2824
  var __accessCheck$6 = (obj, member, msg) => {
2817
2825
  if (!member.has(obj))
2818
2826
  throw TypeError("Cannot " + msg);
@@ -2835,14 +2843,6 @@ var _query, _page;
2835
2843
  class Page {
2836
2844
  constructor(query, meta, records = []) {
2837
2845
  __privateAdd$6(this, _query, void 0);
2838
- /**
2839
- * Page metadata, required to retrieve additional records.
2840
- */
2841
- __publicField$5(this, "meta");
2842
- /**
2843
- * The set of results for this page.
2844
- */
2845
- __publicField$5(this, "records");
2846
2846
  __privateSet$6(this, _query, query);
2847
2847
  this.meta = meta;
2848
2848
  this.records = new RecordArray(this, records);
@@ -2892,9 +2892,9 @@ class Page {
2892
2892
  }
2893
2893
  }
2894
2894
  _query = new WeakMap();
2895
- const PAGINATION_MAX_SIZE = 200;
2895
+ const PAGINATION_MAX_SIZE = 1e3;
2896
2896
  const PAGINATION_DEFAULT_SIZE = 20;
2897
- const PAGINATION_MAX_OFFSET = 800;
2897
+ const PAGINATION_MAX_OFFSET = 49e3;
2898
2898
  const PAGINATION_DEFAULT_OFFSET = 0;
2899
2899
  function isCursorPaginationOptions(options) {
2900
2900
  return isDefined(options) && (isDefined(options.start) || isDefined(options.end) || isDefined(options.after) || isDefined(options.before));
@@ -2973,12 +2973,6 @@ const _RecordArray = class _RecordArray extends Array {
2973
2973
  _page = new WeakMap();
2974
2974
  let RecordArray = _RecordArray;
2975
2975
 
2976
- var __defProp$4 = Object.defineProperty;
2977
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2978
- var __publicField$4 = (obj, key, value) => {
2979
- __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
2980
- return value;
2981
- };
2982
2976
  var __accessCheck$5 = (obj, member, msg) => {
2983
2977
  if (!member.has(obj))
2984
2978
  throw TypeError("Cannot " + msg);
@@ -3009,8 +3003,8 @@ const _Query = class _Query {
3009
3003
  __privateAdd$5(this, _repository, void 0);
3010
3004
  __privateAdd$5(this, _data, { filter: {} });
3011
3005
  // Implements pagination
3012
- __publicField$4(this, "meta", { page: { cursor: "start", more: true, size: PAGINATION_DEFAULT_SIZE } });
3013
- __publicField$4(this, "records", new RecordArray(this, []));
3006
+ this.meta = { page: { cursor: "start", more: true, size: PAGINATION_DEFAULT_SIZE } };
3007
+ this.records = new RecordArray(this, []);
3014
3008
  __privateSet$5(this, _table$1, table);
3015
3009
  if (repository) {
3016
3010
  __privateSet$5(this, _repository, repository);
@@ -3265,7 +3259,8 @@ const RecordColumnTypes = [
3265
3259
  "datetime",
3266
3260
  "vector",
3267
3261
  "file[]",
3268
- "file"
3262
+ "file",
3263
+ "json"
3269
3264
  ];
3270
3265
  function isIdentifiable(x) {
3271
3266
  return isObject(x) && isString(x?.id);
@@ -3276,6 +3271,24 @@ function isXataRecord(x) {
3276
3271
  return isIdentifiable(x) && isObject(metadata) && typeof metadata.version === "number";
3277
3272
  }
3278
3273
 
3274
+ function isValidExpandedColumn(column) {
3275
+ return isObject(column) && isString(column.name);
3276
+ }
3277
+ function isValidSelectableColumns(columns) {
3278
+ if (!Array.isArray(columns)) {
3279
+ return false;
3280
+ }
3281
+ return columns.every((column) => {
3282
+ if (typeof column === "string") {
3283
+ return true;
3284
+ }
3285
+ if (typeof column === "object") {
3286
+ return isValidExpandedColumn(column);
3287
+ }
3288
+ return false;
3289
+ });
3290
+ }
3291
+
3279
3292
  function isSortFilterString(value) {
3280
3293
  return isString(value);
3281
3294
  }
@@ -3376,24 +3389,24 @@ class RestRepository extends Query {
3376
3389
  if (a.length === 0)
3377
3390
  return [];
3378
3391
  const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: true });
3379
- const columns = isStringArray(b) ? b : ["*"];
3392
+ const columns = isValidSelectableColumns(b) ? b : ["*"];
3380
3393
  const result = await this.read(ids, columns);
3381
3394
  return result;
3382
3395
  }
3383
3396
  if (isString(a) && isObject(b)) {
3384
3397
  if (a === "")
3385
3398
  throw new Error("The id can't be empty");
3386
- const columns = isStringArray(c) ? c : void 0;
3399
+ const columns = isValidSelectableColumns(c) ? c : void 0;
3387
3400
  return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
3388
3401
  }
3389
3402
  if (isObject(a) && isString(a.id)) {
3390
3403
  if (a.id === "")
3391
3404
  throw new Error("The id can't be empty");
3392
- const columns = isStringArray(b) ? b : void 0;
3405
+ const columns = isValidSelectableColumns(b) ? b : void 0;
3393
3406
  return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: true, ifVersion });
3394
3407
  }
3395
3408
  if (isObject(a)) {
3396
- const columns = isStringArray(b) ? b : void 0;
3409
+ const columns = isValidSelectableColumns(b) ? b : void 0;
3397
3410
  return __privateMethod$2(this, _insertRecordWithoutId, insertRecordWithoutId_fn).call(this, a, columns);
3398
3411
  }
3399
3412
  throw new Error("Invalid arguments for create method");
@@ -3401,7 +3414,7 @@ class RestRepository extends Query {
3401
3414
  }
3402
3415
  async read(a, b) {
3403
3416
  return __privateGet$4(this, _trace).call(this, "read", async () => {
3404
- const columns = isStringArray(b) ? b : ["*"];
3417
+ const columns = isValidSelectableColumns(b) ? b : ["*"];
3405
3418
  if (Array.isArray(a)) {
3406
3419
  if (a.length === 0)
3407
3420
  return [];
@@ -3428,7 +3441,13 @@ class RestRepository extends Query {
3428
3441
  ...__privateGet$4(this, _getFetchProps).call(this)
3429
3442
  });
3430
3443
  const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3431
- return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
3444
+ return initObject(
3445
+ __privateGet$4(this, _db),
3446
+ schemaTables,
3447
+ __privateGet$4(this, _table),
3448
+ response,
3449
+ columns
3450
+ );
3432
3451
  } catch (e) {
3433
3452
  if (isObject(e) && e.status === 404) {
3434
3453
  return null;
@@ -3470,17 +3489,17 @@ class RestRepository extends Query {
3470
3489
  ifVersion,
3471
3490
  upsert: false
3472
3491
  });
3473
- const columns = isStringArray(b) ? b : ["*"];
3492
+ const columns = isValidSelectableColumns(b) ? b : ["*"];
3474
3493
  const result = await this.read(a, columns);
3475
3494
  return result;
3476
3495
  }
3477
3496
  try {
3478
3497
  if (isString(a) && isObject(b)) {
3479
- const columns = isStringArray(c) ? c : void 0;
3498
+ const columns = isValidSelectableColumns(c) ? c : void 0;
3480
3499
  return await __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
3481
3500
  }
3482
3501
  if (isObject(a) && isString(a.id)) {
3483
- const columns = isStringArray(b) ? b : void 0;
3502
+ const columns = isValidSelectableColumns(b) ? b : void 0;
3484
3503
  return await __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
3485
3504
  }
3486
3505
  } catch (error) {
@@ -3520,20 +3539,20 @@ class RestRepository extends Query {
3520
3539
  ifVersion,
3521
3540
  upsert: true
3522
3541
  });
3523
- const columns = isStringArray(b) ? b : ["*"];
3542
+ const columns = isValidSelectableColumns(b) ? b : ["*"];
3524
3543
  const result = await this.read(a, columns);
3525
3544
  return result;
3526
3545
  }
3527
3546
  if (isString(a) && isObject(b)) {
3528
3547
  if (a === "")
3529
3548
  throw new Error("The id can't be empty");
3530
- const columns = isStringArray(c) ? c : void 0;
3549
+ const columns = isValidSelectableColumns(c) ? c : void 0;
3531
3550
  return await __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
3532
3551
  }
3533
3552
  if (isObject(a) && isString(a.id)) {
3534
3553
  if (a.id === "")
3535
3554
  throw new Error("The id can't be empty");
3536
- const columns = isStringArray(c) ? c : void 0;
3555
+ const columns = isValidSelectableColumns(c) ? c : void 0;
3537
3556
  return await __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
3538
3557
  }
3539
3558
  if (!isDefined(a) && isObject(b)) {
@@ -3552,20 +3571,20 @@ class RestRepository extends Query {
3552
3571
  if (a.length === 0)
3553
3572
  return [];
3554
3573
  const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: false });
3555
- const columns = isStringArray(b) ? b : ["*"];
3574
+ const columns = isValidSelectableColumns(b) ? b : ["*"];
3556
3575
  const result = await this.read(ids, columns);
3557
3576
  return result;
3558
3577
  }
3559
3578
  if (isString(a) && isObject(b)) {
3560
3579
  if (a === "")
3561
3580
  throw new Error("The id can't be empty");
3562
- const columns = isStringArray(c) ? c : void 0;
3581
+ const columns = isValidSelectableColumns(c) ? c : void 0;
3563
3582
  return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
3564
3583
  }
3565
3584
  if (isObject(a) && isString(a.id)) {
3566
3585
  if (a.id === "")
3567
3586
  throw new Error("The id can't be empty");
3568
- const columns = isStringArray(c) ? c : void 0;
3587
+ const columns = isValidSelectableColumns(c) ? c : void 0;
3569
3588
  return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
3570
3589
  }
3571
3590
  if (!isDefined(a) && isObject(b)) {
@@ -3589,7 +3608,7 @@ class RestRepository extends Query {
3589
3608
  return o.id;
3590
3609
  throw new Error("Invalid arguments for delete method");
3591
3610
  });
3592
- const columns = isStringArray(b) ? b : ["*"];
3611
+ const columns = isValidSelectableColumns(b) ? b : ["*"];
3593
3612
  const result = await this.read(a, columns);
3594
3613
  await __privateMethod$2(this, _deleteRecords, deleteRecords_fn).call(this, ids);
3595
3614
  return result;
@@ -3623,7 +3642,7 @@ class RestRepository extends Query {
3623
3642
  }
3624
3643
  async search(query, options = {}) {
3625
3644
  return __privateGet$4(this, _trace).call(this, "search", async () => {
3626
- const { records } = await searchTable({
3645
+ const { records, totalCount } = await searchTable({
3627
3646
  pathParams: {
3628
3647
  workspace: "{workspaceId}",
3629
3648
  dbBranchName: "{dbBranch}",
@@ -3643,12 +3662,15 @@ class RestRepository extends Query {
3643
3662
  ...__privateGet$4(this, _getFetchProps).call(this)
3644
3663
  });
3645
3664
  const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3646
- return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
3665
+ return {
3666
+ records: records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"])),
3667
+ totalCount
3668
+ };
3647
3669
  });
3648
3670
  }
3649
3671
  async vectorSearch(column, query, options) {
3650
3672
  return __privateGet$4(this, _trace).call(this, "vectorSearch", async () => {
3651
- const { records } = await vectorSearchTable({
3673
+ const { records, totalCount } = await vectorSearchTable({
3652
3674
  pathParams: {
3653
3675
  workspace: "{workspaceId}",
3654
3676
  dbBranchName: "{dbBranch}",
@@ -3665,7 +3687,10 @@ class RestRepository extends Query {
3665
3687
  ...__privateGet$4(this, _getFetchProps).call(this)
3666
3688
  });
3667
3689
  const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3668
- return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
3690
+ return {
3691
+ records: records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"])),
3692
+ totalCount
3693
+ };
3669
3694
  });
3670
3695
  }
3671
3696
  async aggregate(aggs, filter) {
@@ -3708,7 +3733,13 @@ class RestRepository extends Query {
3708
3733
  });
3709
3734
  const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3710
3735
  const records = objects.map(
3711
- (record) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), record, data.columns ?? ["*"])
3736
+ (record) => initObject(
3737
+ __privateGet$4(this, _db),
3738
+ schemaTables,
3739
+ __privateGet$4(this, _table),
3740
+ record,
3741
+ data.columns ?? ["*"]
3742
+ )
3712
3743
  );
3713
3744
  await __privateMethod$2(this, _setCacheQuery, setCacheQuery_fn).call(this, query, meta, records);
3714
3745
  return new Page(query, meta, records);
@@ -3735,27 +3766,38 @@ class RestRepository extends Query {
3735
3766
  },
3736
3767
  ...__privateGet$4(this, _getFetchProps).call(this)
3737
3768
  });
3738
- return result;
3769
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3770
+ return {
3771
+ ...result,
3772
+ summaries: result.summaries.map(
3773
+ (summary) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), summary, data.columns ?? [])
3774
+ )
3775
+ };
3739
3776
  });
3740
3777
  }
3741
3778
  ask(question, options) {
3779
+ const questionParam = options?.sessionId ? { message: question } : { question };
3742
3780
  const params = {
3743
3781
  pathParams: {
3744
3782
  workspace: "{workspaceId}",
3745
3783
  dbBranchName: "{dbBranch}",
3746
3784
  region: "{region}",
3747
- tableName: __privateGet$4(this, _table)
3785
+ tableName: __privateGet$4(this, _table),
3786
+ sessionId: options?.sessionId
3748
3787
  },
3749
3788
  body: {
3750
- question,
3751
- ...options
3789
+ ...questionParam,
3790
+ rules: options?.rules,
3791
+ searchType: options?.searchType,
3792
+ search: options?.searchType === "keyword" ? options?.search : void 0,
3793
+ vectorSearch: options?.searchType === "vector" ? options?.vectorSearch : void 0
3752
3794
  },
3753
3795
  ...__privateGet$4(this, _getFetchProps).call(this)
3754
3796
  };
3755
3797
  if (options?.onMessage) {
3756
3798
  fetchSSERequest({
3757
3799
  endpoint: "dataPlane",
3758
- url: "/db/{dbBranchName}/tables/{tableName}/ask",
3800
+ url: "/db/{dbBranchName}/tables/{tableName}/ask/{sessionId}",
3759
3801
  method: "POST",
3760
3802
  onMessage: (message) => {
3761
3803
  options.onMessage?.({ answer: message.text, records: message.records });
@@ -3763,7 +3805,7 @@ class RestRepository extends Query {
3763
3805
  ...params
3764
3806
  });
3765
3807
  } else {
3766
- return askTable(params);
3808
+ return askTableSession(params);
3767
3809
  }
3768
3810
  }
3769
3811
  }
@@ -4004,10 +4046,13 @@ transformObjectToApi_fn = async function(object) {
4004
4046
  break;
4005
4047
  }
4006
4048
  case `file`:
4007
- result[key] = parseInputFileEntry(value);
4049
+ result[key] = await parseInputFileEntry(value);
4008
4050
  break;
4009
4051
  case "file[]":
4010
- result[key] = value.map((item) => parseInputFileEntry(item));
4052
+ result[key] = await promiseMap(value, (item) => parseInputFileEntry(item));
4053
+ break;
4054
+ case "json":
4055
+ result[key] = stringifyJson(value);
4011
4056
  break;
4012
4057
  default:
4013
4058
  result[key] = value;
@@ -4015,13 +4060,6 @@ transformObjectToApi_fn = async function(object) {
4015
4060
  }
4016
4061
  return result;
4017
4062
  };
4018
- const removeLinksFromObject = (object) => {
4019
- return Object.entries(object).reduce((acc, [key, value]) => {
4020
- if (key === "xata")
4021
- return acc;
4022
- return { ...acc, [key]: isIdentifiable(value) ? value.id : value };
4023
- }, {});
4024
- };
4025
4063
  const initObject = (db, schemaTables, table, object, selectedColumns) => {
4026
4064
  const data = {};
4027
4065
  const { xata, ...rest } = object ?? {};
@@ -4052,13 +4090,19 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
4052
4090
  if (item === column.name) {
4053
4091
  return [...acc, "*"];
4054
4092
  }
4055
- if (item.startsWith(`${column.name}.`)) {
4093
+ if (isString(item) && item.startsWith(`${column.name}.`)) {
4056
4094
  const [, ...path] = item.split(".");
4057
4095
  return [...acc, path.join(".")];
4058
4096
  }
4059
4097
  return acc;
4060
4098
  }, []);
4061
- data[column.name] = initObject(db, schemaTables, linkTable, value, selectedLinkColumns);
4099
+ data[column.name] = initObject(
4100
+ db,
4101
+ schemaTables,
4102
+ linkTable,
4103
+ value,
4104
+ selectedLinkColumns
4105
+ );
4062
4106
  } else {
4063
4107
  data[column.name] = null;
4064
4108
  }
@@ -4070,6 +4114,9 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
4070
4114
  case "file[]":
4071
4115
  data[column.name] = value?.map((item) => new XataFile(item)) ?? null;
4072
4116
  break;
4117
+ case "json":
4118
+ data[column.name] = parseJson(value);
4119
+ break;
4073
4120
  default:
4074
4121
  data[column.name] = value ?? null;
4075
4122
  if (column.notNull === true && value === null) {
@@ -4079,33 +4126,34 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
4079
4126
  }
4080
4127
  }
4081
4128
  const record = { ...data };
4082
- const serializable = { xata, ...removeLinksFromObject(data) };
4083
4129
  const metadata = xata !== void 0 ? { ...xata, createdAt: new Date(xata.createdAt), updatedAt: new Date(xata.updatedAt) } : void 0;
4084
4130
  record.read = function(columns2) {
4085
4131
  return db[table].read(record["id"], columns2);
4086
4132
  };
4087
4133
  record.update = function(data2, b, c) {
4088
- const columns2 = isStringArray(b) ? b : ["*"];
4134
+ const columns2 = isValidSelectableColumns(b) ? b : ["*"];
4089
4135
  const ifVersion = parseIfVersion(b, c);
4090
4136
  return db[table].update(record["id"], data2, columns2, { ifVersion });
4091
4137
  };
4092
4138
  record.replace = function(data2, b, c) {
4093
- const columns2 = isStringArray(b) ? b : ["*"];
4139
+ const columns2 = isValidSelectableColumns(b) ? b : ["*"];
4094
4140
  const ifVersion = parseIfVersion(b, c);
4095
4141
  return db[table].createOrReplace(record["id"], data2, columns2, { ifVersion });
4096
4142
  };
4097
4143
  record.delete = function() {
4098
4144
  return db[table].delete(record["id"]);
4099
4145
  };
4100
- record.xata = Object.freeze(metadata);
4146
+ if (metadata !== void 0) {
4147
+ record.xata = Object.freeze(metadata);
4148
+ }
4101
4149
  record.getMetadata = function() {
4102
4150
  return record.xata;
4103
4151
  };
4104
4152
  record.toSerializable = function() {
4105
- return JSON.parse(JSON.stringify(serializable));
4153
+ return JSON.parse(JSON.stringify(record));
4106
4154
  };
4107
4155
  record.toString = function() {
4108
- return JSON.stringify(serializable);
4156
+ return JSON.stringify(record);
4109
4157
  };
4110
4158
  for (const prop of ["read", "update", "replace", "delete", "getMetadata", "toSerializable", "toString"]) {
4111
4159
  Object.defineProperty(record, prop, { enumerable: false });
@@ -4123,7 +4171,7 @@ function extractId(value) {
4123
4171
  function isValidColumn(columns, column) {
4124
4172
  if (columns.includes("*"))
4125
4173
  return true;
4126
- return columns.filter((item) => item.startsWith(column.name)).length > 0;
4174
+ return columns.filter((item) => isString(item) && item.startsWith(column.name)).length > 0;
4127
4175
  }
4128
4176
  function parseIfVersion(...args) {
4129
4177
  for (const arg of args) {
@@ -4134,12 +4182,6 @@ function parseIfVersion(...args) {
4134
4182
  return void 0;
4135
4183
  }
4136
4184
 
4137
- var __defProp$3 = Object.defineProperty;
4138
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4139
- var __publicField$3 = (obj, key, value) => {
4140
- __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
4141
- return value;
4142
- };
4143
4185
  var __accessCheck$3 = (obj, member, msg) => {
4144
4186
  if (!member.has(obj))
4145
4187
  throw TypeError("Cannot " + msg);
@@ -4162,8 +4204,6 @@ var _map;
4162
4204
  class SimpleCache {
4163
4205
  constructor(options = {}) {
4164
4206
  __privateAdd$3(this, _map, void 0);
4165
- __publicField$3(this, "capacity");
4166
- __publicField$3(this, "defaultQueryTTL");
4167
4207
  __privateSet$3(this, _map, /* @__PURE__ */ new Map());
4168
4208
  this.capacity = options.max ?? 500;
4169
4209
  this.defaultQueryTTL = options.defaultQueryTTL ?? 60 * 1e3;
@@ -4208,10 +4248,12 @@ const notExists = (column) => ({ $notExists: column });
4208
4248
  const startsWith = (value) => ({ $startsWith: value });
4209
4249
  const endsWith = (value) => ({ $endsWith: value });
4210
4250
  const pattern = (value) => ({ $pattern: value });
4251
+ const iPattern = (value) => ({ $iPattern: value });
4211
4252
  const is = (value) => ({ $is: value });
4212
4253
  const equals = is;
4213
4254
  const isNot = (value) => ({ $isNot: value });
4214
4255
  const contains = (value) => ({ $contains: value });
4256
+ const iContains = (value) => ({ $iContains: value });
4215
4257
  const includes = (value) => ({ $includes: value });
4216
4258
  const includesAll = (value) => ({ $includesAll: value });
4217
4259
  const includesNone = (value) => ({ $includesNone: value });
@@ -4267,6 +4309,80 @@ class SchemaPlugin extends XataPlugin {
4267
4309
  _tables = new WeakMap();
4268
4310
  _schemaTables$1 = new WeakMap();
4269
4311
 
4312
+ class FilesPlugin extends XataPlugin {
4313
+ build(pluginOptions) {
4314
+ return {
4315
+ download: async (location) => {
4316
+ const { table, record, column, fileId = "" } = location ?? {};
4317
+ return await getFileItem({
4318
+ pathParams: {
4319
+ workspace: "{workspaceId}",
4320
+ dbBranchName: "{dbBranch}",
4321
+ region: "{region}",
4322
+ tableName: table ?? "",
4323
+ recordId: record ?? "",
4324
+ columnName: column ?? "",
4325
+ fileId
4326
+ },
4327
+ ...pluginOptions,
4328
+ rawResponse: true
4329
+ });
4330
+ },
4331
+ upload: async (location, file, options) => {
4332
+ const { table, record, column, fileId = "" } = location ?? {};
4333
+ const resolvedFile = await file;
4334
+ const contentType = options?.mediaType || getContentType(resolvedFile);
4335
+ const body = resolvedFile instanceof XataFile ? resolvedFile.toBlob() : resolvedFile;
4336
+ return await putFileItem({
4337
+ ...pluginOptions,
4338
+ pathParams: {
4339
+ workspace: "{workspaceId}",
4340
+ dbBranchName: "{dbBranch}",
4341
+ region: "{region}",
4342
+ tableName: table ?? "",
4343
+ recordId: record ?? "",
4344
+ columnName: column ?? "",
4345
+ fileId
4346
+ },
4347
+ body,
4348
+ headers: { "Content-Type": contentType }
4349
+ });
4350
+ },
4351
+ delete: async (location) => {
4352
+ const { table, record, column, fileId = "" } = location ?? {};
4353
+ return await deleteFileItem({
4354
+ pathParams: {
4355
+ workspace: "{workspaceId}",
4356
+ dbBranchName: "{dbBranch}",
4357
+ region: "{region}",
4358
+ tableName: table ?? "",
4359
+ recordId: record ?? "",
4360
+ columnName: column ?? "",
4361
+ fileId
4362
+ },
4363
+ ...pluginOptions
4364
+ });
4365
+ }
4366
+ };
4367
+ }
4368
+ }
4369
+ function getContentType(file) {
4370
+ if (typeof file === "string") {
4371
+ return "text/plain";
4372
+ }
4373
+ if ("mediaType" in file) {
4374
+ return file.mediaType;
4375
+ }
4376
+ if (isBlob(file)) {
4377
+ return file.type;
4378
+ }
4379
+ try {
4380
+ return file.type;
4381
+ } catch (e) {
4382
+ }
4383
+ return "application/octet-stream";
4384
+ }
4385
+
4270
4386
  var __accessCheck$1 = (obj, member, msg) => {
4271
4387
  if (!member.has(obj))
4272
4388
  throw TypeError("Cannot " + msg);
@@ -4302,22 +4418,26 @@ class SearchPlugin extends XataPlugin {
4302
4418
  build(pluginOptions) {
4303
4419
  return {
4304
4420
  all: async (query, options = {}) => {
4305
- const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4421
+ const { records, totalCount } = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4306
4422
  const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, pluginOptions);
4307
- return records.map((record) => {
4308
- const { table = "orphan" } = record.xata;
4309
- return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
4310
- });
4423
+ return {
4424
+ totalCount,
4425
+ records: records.map((record) => {
4426
+ const { table = "orphan" } = record.xata;
4427
+ return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
4428
+ })
4429
+ };
4311
4430
  },
4312
4431
  byTable: async (query, options = {}) => {
4313
- const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4432
+ const { records: rawRecords, totalCount } = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4314
4433
  const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, pluginOptions);
4315
- return records.reduce((acc, record) => {
4434
+ const records = rawRecords.reduce((acc, record) => {
4316
4435
  const { table = "orphan" } = record.xata;
4317
4436
  const items = acc[table] ?? [];
4318
4437
  const item = initObject(this.db, schemaTables, table, record, ["*"]);
4319
4438
  return { ...acc, [table]: [...items, item] };
4320
4439
  }, {});
4440
+ return { totalCount, records };
4321
4441
  }
4322
4442
  };
4323
4443
  }
@@ -4326,13 +4446,13 @@ _schemaTables = new WeakMap();
4326
4446
  _search = new WeakSet();
4327
4447
  search_fn = async function(query, options, pluginOptions) {
4328
4448
  const { tables, fuzziness, highlight, prefix, page } = options ?? {};
4329
- const { records } = await searchBranch({
4449
+ const { records, totalCount } = await searchBranch({
4330
4450
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4331
4451
  // @ts-ignore https://github.com/xataio/client-ts/issues/313
4332
4452
  body: { tables, query, fuzziness, prefix, highlight, page },
4333
4453
  ...pluginOptions
4334
4454
  });
4335
- return records;
4455
+ return { records, totalCount };
4336
4456
  };
4337
4457
  _getSchemaTables = new WeakSet();
4338
4458
  getSchemaTables_fn = async function(pluginOptions) {
@@ -4346,6 +4466,78 @@ getSchemaTables_fn = async function(pluginOptions) {
4346
4466
  return schema.tables;
4347
4467
  };
4348
4468
 
4469
+ function escapeElement(elementRepresentation) {
4470
+ const escaped = elementRepresentation.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
4471
+ return '"' + escaped + '"';
4472
+ }
4473
+ function arrayString(val) {
4474
+ let result = "{";
4475
+ for (let i = 0; i < val.length; i++) {
4476
+ if (i > 0) {
4477
+ result = result + ",";
4478
+ }
4479
+ if (val[i] === null || typeof val[i] === "undefined") {
4480
+ result = result + "NULL";
4481
+ } else if (Array.isArray(val[i])) {
4482
+ result = result + arrayString(val[i]);
4483
+ } else if (val[i] instanceof Buffer) {
4484
+ result += "\\\\x" + val[i].toString("hex");
4485
+ } else {
4486
+ result += escapeElement(prepareValue(val[i]));
4487
+ }
4488
+ }
4489
+ result = result + "}";
4490
+ return result;
4491
+ }
4492
+ function prepareValue(value) {
4493
+ if (!isDefined(value))
4494
+ return null;
4495
+ if (value instanceof Date) {
4496
+ return value.toISOString();
4497
+ }
4498
+ if (Array.isArray(value)) {
4499
+ return arrayString(value);
4500
+ }
4501
+ if (isObject(value)) {
4502
+ return JSON.stringify(value);
4503
+ }
4504
+ try {
4505
+ return value.toString();
4506
+ } catch (e) {
4507
+ return value;
4508
+ }
4509
+ }
4510
+ function prepareParams(param1, param2) {
4511
+ if (isString(param1)) {
4512
+ return { statement: param1, params: param2?.map((value) => prepareValue(value)) };
4513
+ }
4514
+ if (isStringArray(param1)) {
4515
+ const statement = param1.reduce((acc, curr, index) => {
4516
+ return acc + curr + (index < (param2?.length ?? 0) ? "$" + (index + 1) : "");
4517
+ }, "");
4518
+ return { statement, params: param2?.map((value) => prepareValue(value)) };
4519
+ }
4520
+ if (isObject(param1)) {
4521
+ const { statement, params, consistency } = param1;
4522
+ return { statement, params: params?.map((value) => prepareValue(value)), consistency };
4523
+ }
4524
+ throw new Error("Invalid query");
4525
+ }
4526
+
4527
+ class SQLPlugin extends XataPlugin {
4528
+ build(pluginOptions) {
4529
+ return async (param1, ...param2) => {
4530
+ const { statement, params, consistency } = prepareParams(param1, param2);
4531
+ const { records, warning } = await sqlQuery({
4532
+ pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4533
+ body: { statement, params, consistency },
4534
+ ...pluginOptions
4535
+ });
4536
+ return { records, warning };
4537
+ };
4538
+ }
4539
+ }
4540
+
4349
4541
  class TransactionPlugin extends XataPlugin {
4350
4542
  build(pluginOptions) {
4351
4543
  return {
@@ -4361,12 +4553,6 @@ class TransactionPlugin extends XataPlugin {
4361
4553
  }
4362
4554
  }
4363
4555
 
4364
- var __defProp$2 = Object.defineProperty;
4365
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4366
- var __publicField$2 = (obj, key, value) => {
4367
- __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
4368
- return value;
4369
- };
4370
4556
  var __accessCheck = (obj, member, msg) => {
4371
4557
  if (!member.has(obj))
4372
4558
  throw TypeError("Cannot " + msg);
@@ -4396,10 +4582,6 @@ const buildClient = (plugins) => {
4396
4582
  __privateAdd(this, _parseOptions);
4397
4583
  __privateAdd(this, _getFetchProps);
4398
4584
  __privateAdd(this, _options, void 0);
4399
- __publicField$2(this, "db");
4400
- __publicField$2(this, "search");
4401
- __publicField$2(this, "transactions");
4402
- __publicField$2(this, "files");
4403
4585
  const safeOptions = __privateMethod(this, _parseOptions, parseOptions_fn).call(this, options);
4404
4586
  __privateSet(this, _options, safeOptions);
4405
4587
  const pluginOptions = {
@@ -4410,10 +4592,12 @@ const buildClient = (plugins) => {
4410
4592
  const db = new SchemaPlugin(schemaTables).build(pluginOptions);
4411
4593
  const search = new SearchPlugin(db, schemaTables).build(pluginOptions);
4412
4594
  const transactions = new TransactionPlugin().build(pluginOptions);
4595
+ const sql = new SQLPlugin().build(pluginOptions);
4413
4596
  const files = new FilesPlugin().build(pluginOptions);
4414
4597
  this.db = db;
4415
4598
  this.search = search;
4416
4599
  this.transactions = transactions;
4600
+ this.sql = sql;
4417
4601
  this.files = files;
4418
4602
  for (const [key, namespace] of Object.entries(plugins ?? {})) {
4419
4603
  if (namespace === void 0)
@@ -4511,17 +4695,11 @@ const buildClient = (plugins) => {
4511
4695
  class BaseClient extends buildClient() {
4512
4696
  }
4513
4697
 
4514
- var __defProp$1 = Object.defineProperty;
4515
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4516
- var __publicField$1 = (obj, key, value) => {
4517
- __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
4518
- return value;
4519
- };
4520
4698
  const META = "__";
4521
4699
  const VALUE = "___";
4522
4700
  class Serializer {
4523
4701
  constructor() {
4524
- __publicField$1(this, "classes", {});
4702
+ this.classes = {};
4525
4703
  }
4526
4704
  add(clazz) {
4527
4705
  this.classes[clazz.name] = clazz;
@@ -4599,22 +4777,16 @@ function buildWorkerRunner(config) {
4599
4777
  };
4600
4778
  }
4601
4779
 
4602
- var __defProp = Object.defineProperty;
4603
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4604
- var __publicField = (obj, key, value) => {
4605
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4606
- return value;
4607
- };
4608
4780
  class XataError extends Error {
4609
4781
  constructor(message, status) {
4610
4782
  super(message);
4611
- __publicField(this, "status");
4612
4783
  this.status = status;
4613
4784
  }
4614
4785
  }
4615
4786
 
4616
4787
  exports.BaseClient = BaseClient;
4617
4788
  exports.FetcherError = FetcherError;
4789
+ exports.FilesPlugin = FilesPlugin;
4618
4790
  exports.Operations = operationsByTag;
4619
4791
  exports.PAGINATION_DEFAULT_OFFSET = PAGINATION_DEFAULT_OFFSET;
4620
4792
  exports.PAGINATION_DEFAULT_SIZE = PAGINATION_DEFAULT_SIZE;
@@ -4626,10 +4798,12 @@ exports.RecordArray = RecordArray;
4626
4798
  exports.RecordColumnTypes = RecordColumnTypes;
4627
4799
  exports.Repository = Repository;
4628
4800
  exports.RestRepository = RestRepository;
4801
+ exports.SQLPlugin = SQLPlugin;
4629
4802
  exports.SchemaPlugin = SchemaPlugin;
4630
4803
  exports.SearchPlugin = SearchPlugin;
4631
4804
  exports.Serializer = Serializer;
4632
4805
  exports.SimpleCache = SimpleCache;
4806
+ exports.TransactionPlugin = TransactionPlugin;
4633
4807
  exports.XataApiClient = XataApiClient;
4634
4808
  exports.XataApiPlugin = XataApiPlugin;
4635
4809
  exports.XataError = XataError;
@@ -4640,7 +4814,9 @@ exports.addGitBranchesEntry = addGitBranchesEntry;
4640
4814
  exports.addTableColumn = addTableColumn;
4641
4815
  exports.aggregateTable = aggregateTable;
4642
4816
  exports.applyBranchSchemaEdit = applyBranchSchemaEdit;
4817
+ exports.applyMigration = applyMigration;
4643
4818
  exports.askTable = askTable;
4819
+ exports.askTableSession = askTableSession;
4644
4820
  exports.branchTransaction = branchTransaction;
4645
4821
  exports.buildClient = buildClient;
4646
4822
  exports.buildPreviewBranchName = buildPreviewBranchName;
@@ -4648,13 +4824,13 @@ exports.buildProviderString = buildProviderString;
4648
4824
  exports.buildWorkerRunner = buildWorkerRunner;
4649
4825
  exports.bulkInsertTableRecords = bulkInsertTableRecords;
4650
4826
  exports.cancelWorkspaceMemberInvite = cancelWorkspaceMemberInvite;
4651
- exports.chatSessionMessage = chatSessionMessage;
4652
4827
  exports.compareBranchSchemas = compareBranchSchemas;
4653
4828
  exports.compareBranchWithUserSchema = compareBranchWithUserSchema;
4654
4829
  exports.compareMigrationRequest = compareMigrationRequest;
4655
4830
  exports.contains = contains;
4656
4831
  exports.copyBranch = copyBranch;
4657
4832
  exports.createBranch = createBranch;
4833
+ exports.createCluster = createCluster;
4658
4834
  exports.createDatabase = createDatabase;
4659
4835
  exports.createMigrationRequest = createMigrationRequest;
4660
4836
  exports.createTable = createTable;
@@ -4666,10 +4842,12 @@ exports.deleteDatabase = deleteDatabase;
4666
4842
  exports.deleteDatabaseGithubSettings = deleteDatabaseGithubSettings;
4667
4843
  exports.deleteFile = deleteFile;
4668
4844
  exports.deleteFileItem = deleteFileItem;
4845
+ exports.deleteOAuthAccessToken = deleteOAuthAccessToken;
4669
4846
  exports.deleteRecord = deleteRecord;
4670
4847
  exports.deleteTable = deleteTable;
4671
4848
  exports.deleteUser = deleteUser;
4672
4849
  exports.deleteUserAPIKey = deleteUserAPIKey;
4850
+ exports.deleteUserOAuthClient = deleteUserOAuthClient;
4673
4851
  exports.deleteWorkspace = deleteWorkspace;
4674
4852
  exports.deserialize = deserialize;
4675
4853
  exports.endsWith = endsWith;
@@ -4679,6 +4857,7 @@ exports.exists = exists;
4679
4857
  exports.fileAccess = fileAccess;
4680
4858
  exports.ge = ge;
4681
4859
  exports.getAPIKey = getAPIKey;
4860
+ exports.getAuthorizationCode = getAuthorizationCode;
4682
4861
  exports.getBranch = getBranch;
4683
4862
  exports.getBranchDetails = getBranchDetails;
4684
4863
  exports.getBranchList = getBranchList;
@@ -4687,6 +4866,7 @@ exports.getBranchMigrationHistory = getBranchMigrationHistory;
4687
4866
  exports.getBranchMigrationPlan = getBranchMigrationPlan;
4688
4867
  exports.getBranchSchemaHistory = getBranchSchemaHistory;
4689
4868
  exports.getBranchStats = getBranchStats;
4869
+ exports.getCluster = getCluster;
4690
4870
  exports.getColumn = getColumn;
4691
4871
  exports.getDatabaseGithubSettings = getDatabaseGithubSettings;
4692
4872
  exports.getDatabaseList = getDatabaseList;
@@ -4700,18 +4880,24 @@ exports.getMigrationRequest = getMigrationRequest;
4700
4880
  exports.getMigrationRequestIsMerged = getMigrationRequestIsMerged;
4701
4881
  exports.getPreviewBranch = getPreviewBranch;
4702
4882
  exports.getRecord = getRecord;
4883
+ exports.getSchema = getSchema;
4703
4884
  exports.getTableColumns = getTableColumns;
4704
4885
  exports.getTableSchema = getTableSchema;
4705
4886
  exports.getUser = getUser;
4706
4887
  exports.getUserAPIKeys = getUserAPIKeys;
4888
+ exports.getUserOAuthAccessTokens = getUserOAuthAccessTokens;
4889
+ exports.getUserOAuthClients = getUserOAuthClients;
4707
4890
  exports.getWorkspace = getWorkspace;
4708
4891
  exports.getWorkspaceMembersList = getWorkspaceMembersList;
4709
4892
  exports.getWorkspacesList = getWorkspacesList;
4893
+ exports.grantAuthorizationCode = grantAuthorizationCode;
4710
4894
  exports.greaterEquals = greaterEquals;
4711
4895
  exports.greaterThan = greaterThan;
4712
4896
  exports.greaterThanEquals = greaterThanEquals;
4713
4897
  exports.gt = gt;
4714
4898
  exports.gte = gte;
4899
+ exports.iContains = iContains;
4900
+ exports.iPattern = iPattern;
4715
4901
  exports.includes = includes;
4716
4902
  exports.includesAll = includesAll;
4717
4903
  exports.includesAny = includesAny;
@@ -4725,11 +4911,14 @@ exports.isHostProviderAlias = isHostProviderAlias;
4725
4911
  exports.isHostProviderBuilder = isHostProviderBuilder;
4726
4912
  exports.isIdentifiable = isIdentifiable;
4727
4913
  exports.isNot = isNot;
4914
+ exports.isValidExpandedColumn = isValidExpandedColumn;
4915
+ exports.isValidSelectableColumns = isValidSelectableColumns;
4728
4916
  exports.isXataRecord = isXataRecord;
4729
4917
  exports.le = le;
4730
4918
  exports.lessEquals = lessEquals;
4731
4919
  exports.lessThan = lessThan;
4732
4920
  exports.lessThanEquals = lessThanEquals;
4921
+ exports.listClusters = listClusters;
4733
4922
  exports.listMigrationRequestsCommits = listMigrationRequestsCommits;
4734
4923
  exports.listRegions = listRegions;
4735
4924
  exports.lt = lt;
@@ -4758,12 +4947,15 @@ exports.setTableSchema = setTableSchema;
4758
4947
  exports.sqlQuery = sqlQuery;
4759
4948
  exports.startsWith = startsWith;
4760
4949
  exports.summarizeTable = summarizeTable;
4950
+ exports.transformImage = transformImage;
4761
4951
  exports.updateBranchMetadata = updateBranchMetadata;
4762
4952
  exports.updateBranchSchema = updateBranchSchema;
4953
+ exports.updateCluster = updateCluster;
4763
4954
  exports.updateColumn = updateColumn;
4764
4955
  exports.updateDatabaseGithubSettings = updateDatabaseGithubSettings;
4765
4956
  exports.updateDatabaseMetadata = updateDatabaseMetadata;
4766
4957
  exports.updateMigrationRequest = updateMigrationRequest;
4958
+ exports.updateOAuthAccessToken = updateOAuthAccessToken;
4767
4959
  exports.updateRecordWithID = updateRecordWithID;
4768
4960
  exports.updateTable = updateTable;
4769
4961
  exports.updateUser = updateUser;