@xata.io/client 0.0.0-alpha.vfb0d929 → 0.0.0-alpha.vfb40563bcd4dc861559eae895dc85719e3688c57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -18,7 +18,8 @@ const TraceAttributes = {
18
18
  HTTP_METHOD: "http.method",
19
19
  HTTP_URL: "http.url",
20
20
  HTTP_ROUTE: "http.route",
21
- HTTP_TARGET: "http.target"
21
+ HTTP_TARGET: "http.target",
22
+ CLOUDFLARE_RAY_ID: "cf.ray"
22
23
  };
23
24
 
24
25
  function notEmpty(value) {
@@ -30,8 +31,15 @@ function compact(arr) {
30
31
  function compactObject(obj) {
31
32
  return Object.fromEntries(Object.entries(obj).filter(([, value]) => notEmpty(value)));
32
33
  }
34
+ function isBlob(value) {
35
+ try {
36
+ return value instanceof Blob;
37
+ } catch (error) {
38
+ return false;
39
+ }
40
+ }
33
41
  function isObject(value) {
34
- return Boolean(value) && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date);
42
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date) && !isBlob(value);
35
43
  }
36
44
  function isDefined(value) {
37
45
  return value !== null && value !== void 0;
@@ -234,12 +242,6 @@ function getPreviewBranch() {
234
242
  }
235
243
  }
236
244
 
237
- var __defProp$8 = Object.defineProperty;
238
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
239
- var __publicField$8 = (obj, key, value) => {
240
- __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
241
- return value;
242
- };
243
245
  var __accessCheck$8 = (obj, member, msg) => {
244
246
  if (!member.has(obj))
245
247
  throw TypeError("Cannot " + msg);
@@ -263,14 +265,13 @@ var __privateMethod$4 = (obj, member, method) => {
263
265
  return method;
264
266
  };
265
267
  var _fetch, _queue, _concurrency, _enqueue, enqueue_fn;
266
- const REQUEST_TIMEOUT = 3e4;
268
+ const REQUEST_TIMEOUT = 5 * 60 * 1e3;
267
269
  function getFetchImplementation(userFetch) {
268
270
  const globalFetch = typeof fetch !== "undefined" ? fetch : void 0;
269
- const fetchImpl = userFetch ?? globalFetch;
271
+ const globalThisFetch = typeof globalThis !== "undefined" ? globalThis.fetch : void 0;
272
+ const fetchImpl = userFetch ?? globalFetch ?? globalThisFetch;
270
273
  if (!fetchImpl) {
271
- throw new Error(
272
- `Couldn't find \`fetch\`. Install a fetch implementation such as \`node-fetch\` and pass it explicitly.`
273
- );
274
+ throw new Error(`Couldn't find a global \`fetch\`. Pass a fetch implementation explicitly.`);
274
275
  }
275
276
  return fetchImpl;
276
277
  }
@@ -280,8 +281,6 @@ class ApiRequestPool {
280
281
  __privateAdd$8(this, _fetch, void 0);
281
282
  __privateAdd$8(this, _queue, void 0);
282
283
  __privateAdd$8(this, _concurrency, void 0);
283
- __publicField$8(this, "running");
284
- __publicField$8(this, "started");
285
284
  __privateSet$8(this, _queue, []);
286
285
  __privateSet$8(this, _concurrency, concurrency);
287
286
  this.running = 0;
@@ -527,26 +526,16 @@ function defaultOnOpen(response) {
527
526
  }
528
527
  }
529
528
 
530
- const VERSION = "0.25.2";
529
+ const VERSION = "0.28.4";
531
530
 
532
- var __defProp$7 = Object.defineProperty;
533
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
534
- var __publicField$7 = (obj, key, value) => {
535
- __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
536
- return value;
537
- };
538
531
  class ErrorWithCause extends Error {
539
532
  constructor(message, options) {
540
533
  super(message, options);
541
- __publicField$7(this, "cause");
542
534
  }
543
535
  }
544
536
  class FetcherError extends ErrorWithCause {
545
537
  constructor(status, data, requestId) {
546
538
  super(getMessage(data));
547
- __publicField$7(this, "status");
548
- __publicField$7(this, "requestId");
549
- __publicField$7(this, "errors");
550
539
  this.status = status;
551
540
  this.errors = isBulkError(data) ? data.errors : [{ message: getMessage(data), status }];
552
541
  this.requestId = requestId;
@@ -580,6 +569,67 @@ function getMessage(data) {
580
569
  }
581
570
  }
582
571
 
572
+ function getHostUrl(provider, type) {
573
+ if (isHostProviderAlias(provider)) {
574
+ return providers[provider][type];
575
+ } else if (isHostProviderBuilder(provider)) {
576
+ return provider[type];
577
+ }
578
+ throw new Error("Invalid API provider");
579
+ }
580
+ const providers = {
581
+ production: {
582
+ main: "https://api.xata.io",
583
+ workspaces: "https://{workspaceId}.{region}.xata.sh"
584
+ },
585
+ staging: {
586
+ main: "https://api.staging-xata.dev",
587
+ workspaces: "https://{workspaceId}.{region}.staging-xata.dev"
588
+ },
589
+ dev: {
590
+ main: "https://api.dev-xata.dev",
591
+ workspaces: "https://{workspaceId}.{region}.dev-xata.dev"
592
+ },
593
+ local: {
594
+ main: "http://localhost:6001",
595
+ workspaces: "http://{workspaceId}.{region}.localhost:6001"
596
+ }
597
+ };
598
+ function isHostProviderAlias(alias) {
599
+ return isString(alias) && Object.keys(providers).includes(alias);
600
+ }
601
+ function isHostProviderBuilder(builder) {
602
+ return isObject(builder) && isString(builder.main) && isString(builder.workspaces);
603
+ }
604
+ function parseProviderString(provider = "production") {
605
+ if (isHostProviderAlias(provider)) {
606
+ return provider;
607
+ }
608
+ const [main, workspaces] = provider.split(",");
609
+ if (!main || !workspaces)
610
+ return null;
611
+ return { main, workspaces };
612
+ }
613
+ function buildProviderString(provider) {
614
+ if (isHostProviderAlias(provider))
615
+ return provider;
616
+ return `${provider.main},${provider.workspaces}`;
617
+ }
618
+ function parseWorkspacesUrlParts(url) {
619
+ if (!isString(url))
620
+ return null;
621
+ const matches = {
622
+ production: url.match(/(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.xata\.sh.*/),
623
+ staging: url.match(/(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.staging-xata\.dev.*/),
624
+ dev: url.match(/(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.dev-xata\.dev.*/),
625
+ local: url.match(/(?:https?:\/\/)?([^.]+)(?:\.([^.]+))\.localhost:(\d+)/)
626
+ };
627
+ const [host, match] = Object.entries(matches).find(([, match2]) => match2 !== null) ?? [];
628
+ if (!isHostProviderAlias(host) || !match)
629
+ return null;
630
+ return { workspace: match[1], region: match[2], host };
631
+ }
632
+
583
633
  const pool = new ApiRequestPool();
584
634
  const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
585
635
  const cleanQueryParams = Object.entries(queryParams).reduce((acc, [key, value]) => {
@@ -595,6 +645,7 @@ const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
595
645
  return url.replace(/\{\w*\}/g, (key) => cleanPathParams[key.slice(1, -1)]) + queryString;
596
646
  };
597
647
  function buildBaseUrl({
648
+ method,
598
649
  endpoint,
599
650
  path,
600
651
  workspacesApiUrl,
@@ -602,7 +653,24 @@ function buildBaseUrl({
602
653
  pathParams = {}
603
654
  }) {
604
655
  if (endpoint === "dataPlane") {
605
- const url = isString(workspacesApiUrl) ? `${workspacesApiUrl}${path}` : workspacesApiUrl(path, pathParams);
656
+ let url = isString(workspacesApiUrl) ? `${workspacesApiUrl}${path}` : workspacesApiUrl(path, pathParams);
657
+ if (method.toUpperCase() === "PUT" && [
658
+ "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file",
659
+ "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file/{fileId}"
660
+ ].includes(path)) {
661
+ const { host } = parseWorkspacesUrlParts(url) ?? {};
662
+ switch (host) {
663
+ case "production":
664
+ url = url.replace("xata.sh", "upload.xata.sh");
665
+ break;
666
+ case "staging":
667
+ url = url.replace("staging-xata.dev", "upload.staging-xata.dev");
668
+ break;
669
+ case "dev":
670
+ url = url.replace("dev-xata.dev", "upload.dev-xata.dev");
671
+ break;
672
+ }
673
+ }
606
674
  const urlWithWorkspace = isString(pathParams.workspace) ? url.replace("{workspaceId}", String(pathParams.workspace)) : url;
607
675
  return isString(pathParams.region) ? urlWithWorkspace.replace("{region}", String(pathParams.region)) : urlWithWorkspace;
608
676
  }
@@ -613,11 +681,14 @@ function hostHeader(url) {
613
681
  const { groups } = pattern.exec(url) ?? {};
614
682
  return groups?.host ? { Host: groups.host } : {};
615
683
  }
616
- function parseBody(body, headers) {
684
+ async function parseBody(body, headers) {
617
685
  if (!isDefined(body))
618
686
  return void 0;
687
+ if (isBlob(body) || typeof body.text === "function") {
688
+ return body;
689
+ }
619
690
  const { "Content-Type": contentType } = headers ?? {};
620
- if (String(contentType).toLowerCase() === "application/json") {
691
+ if (String(contentType).toLowerCase() === "application/json" && isObject(body)) {
621
692
  return JSON.stringify(body);
622
693
  }
623
694
  return body;
@@ -648,9 +719,9 @@ async function fetch$1({
648
719
  return await trace(
649
720
  `${method.toUpperCase()} ${path}`,
650
721
  async ({ setAttributes }) => {
651
- const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
722
+ const baseUrl = buildBaseUrl({ method, endpoint, path, workspacesApiUrl, pathParams, apiUrl });
652
723
  const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
653
- const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
724
+ const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\.[^.]+\./, "http://") : fullUrl;
654
725
  setAttributes({
655
726
  [TraceAttributes.HTTP_URL]: url,
656
727
  [TraceAttributes.HTTP_TARGET]: resolveUrl(path, queryParams, pathParams)
@@ -674,7 +745,7 @@ async function fetch$1({
674
745
  const response = await pool.request(url, {
675
746
  ...fetchOptions,
676
747
  method: method.toUpperCase(),
677
- body: parseBody(body, headers),
748
+ body: await parseBody(body, headers),
678
749
  headers,
679
750
  signal
680
751
  });
@@ -685,7 +756,8 @@ async function fetch$1({
685
756
  [TraceAttributes.HTTP_REQUEST_ID]: requestId,
686
757
  [TraceAttributes.HTTP_STATUS_CODE]: response.status,
687
758
  [TraceAttributes.HTTP_HOST]: host,
688
- [TraceAttributes.HTTP_SCHEME]: protocol?.replace(":", "")
759
+ [TraceAttributes.HTTP_SCHEME]: protocol?.replace(":", ""),
760
+ [TraceAttributes.CLOUDFLARE_RAY_ID]: response.headers?.get("cf-ray") ?? void 0
689
761
  });
690
762
  const message = response.headers?.get("x-xata-message");
691
763
  if (message)
@@ -730,7 +802,7 @@ function fetchSSERequest({
730
802
  clientName,
731
803
  xataAgentExtra
732
804
  }) {
733
- const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
805
+ const baseUrl = buildBaseUrl({ method, endpoint, path, workspacesApiUrl, pathParams, apiUrl });
734
806
  const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
735
807
  const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
736
808
  void fetchEventSource(url, {
@@ -773,6 +845,20 @@ function parseUrl(url) {
773
845
 
774
846
  const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
775
847
 
848
+ const applyMigration = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/pgroll/apply", method: "post", ...variables, signal });
849
+ const pgRollStatus = (variables, signal) => dataPlaneFetch({
850
+ url: "/db/{dbBranchName}/pgroll/status",
851
+ method: "get",
852
+ ...variables,
853
+ signal
854
+ });
855
+ const pgRollJobStatus = (variables, signal) => dataPlaneFetch({
856
+ url: "/db/{dbBranchName}/pgroll/jobs/{jobId}",
857
+ method: "get",
858
+ ...variables,
859
+ signal
860
+ });
861
+ const pgRollMigrationHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/pgroll/migrations", method: "get", ...variables, signal });
776
862
  const getBranchList = (variables, signal) => dataPlaneFetch({
777
863
  url: "/dbs/{dbName}",
778
864
  method: "get",
@@ -792,6 +878,12 @@ const deleteBranch = (variables, signal) => dataPlaneFetch({
792
878
  ...variables,
793
879
  signal
794
880
  });
881
+ const getSchema = (variables, signal) => dataPlaneFetch({
882
+ url: "/db/{dbBranchName}/schema",
883
+ method: "get",
884
+ ...variables,
885
+ signal
886
+ });
795
887
  const copyBranch = (variables, signal) => dataPlaneFetch({
796
888
  url: "/db/{dbBranchName}/copy",
797
889
  method: "post",
@@ -973,6 +1065,12 @@ const fileAccess = (variables, signal) => dataPlaneFetch({
973
1065
  ...variables,
974
1066
  signal
975
1067
  });
1068
+ const fileUpload = (variables, signal) => dataPlaneFetch({
1069
+ url: "/file/{fileId}",
1070
+ method: "put",
1071
+ ...variables,
1072
+ signal
1073
+ });
976
1074
  const sqlQuery = (variables, signal) => dataPlaneFetch({
977
1075
  url: "/db/{dbBranchName}/sql",
978
1076
  method: "post",
@@ -981,6 +1079,10 @@ const sqlQuery = (variables, signal) => dataPlaneFetch({
981
1079
  });
982
1080
  const operationsByTag$2 = {
983
1081
  branch: {
1082
+ applyMigration,
1083
+ pgRollStatus,
1084
+ pgRollJobStatus,
1085
+ pgRollMigrationHistory,
984
1086
  getBranchList,
985
1087
  getBranchDetails,
986
1088
  createBranch,
@@ -995,6 +1097,7 @@ const operationsByTag$2 = {
995
1097
  resolveBranch
996
1098
  },
997
1099
  migrations: {
1100
+ getSchema,
998
1101
  getBranchMigrationHistory,
999
1102
  getBranchMigrationPlan,
1000
1103
  executeBranchMigrationPlan,
@@ -1038,7 +1141,7 @@ const operationsByTag$2 = {
1038
1141
  deleteRecord,
1039
1142
  bulkInsertTableRecords
1040
1143
  },
1041
- files: { getFileItem, putFileItem, deleteFileItem, getFile, putFile, deleteFile, fileAccess },
1144
+ files: { getFileItem, putFileItem, deleteFileItem, getFile, putFile, deleteFile, fileAccess, fileUpload },
1042
1145
  searchAndFilter: {
1043
1146
  queryTable,
1044
1147
  searchBranch,
@@ -1098,6 +1201,12 @@ const getUserOAuthClients = (variables, signal) => controlPlaneFetch({
1098
1201
  ...variables,
1099
1202
  signal
1100
1203
  });
1204
+ const deleteUserOAuthClient = (variables, signal) => controlPlaneFetch({
1205
+ url: "/user/oauth/clients/{clientId}",
1206
+ method: "delete",
1207
+ ...variables,
1208
+ signal
1209
+ });
1101
1210
  const getUserOAuthAccessTokens = (variables, signal) => controlPlaneFetch({
1102
1211
  url: "/user/oauth/tokens",
1103
1212
  method: "get",
@@ -1154,6 +1263,15 @@ const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ u
1154
1263
  const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "delete", ...variables, signal });
1155
1264
  const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
1156
1265
  const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
1266
+ const listClusters = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters", method: "get", ...variables, signal });
1267
+ const createCluster = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters", method: "post", ...variables, signal });
1268
+ const getCluster = (variables, signal) => controlPlaneFetch({
1269
+ url: "/workspaces/{workspaceId}/clusters/{clusterId}",
1270
+ method: "get",
1271
+ ...variables,
1272
+ signal
1273
+ });
1274
+ const updateCluster = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters/{clusterId}", method: "patch", ...variables, signal });
1157
1275
  const getDatabaseList = (variables, signal) => controlPlaneFetch({
1158
1276
  url: "/workspaces/{workspaceId}/dbs",
1159
1277
  method: "get",
@@ -1180,9 +1298,17 @@ const listRegions = (variables, signal) => controlPlaneFetch({
1180
1298
  signal
1181
1299
  });
1182
1300
  const operationsByTag$1 = {
1183
- authOther: { getAuthorizationCode, grantAuthorizationCode, deleteOAuthAccessToken, updateOAuthAccessToken },
1301
+ oAuth: {
1302
+ getAuthorizationCode,
1303
+ grantAuthorizationCode,
1304
+ getUserOAuthClients,
1305
+ deleteUserOAuthClient,
1306
+ getUserOAuthAccessTokens,
1307
+ deleteOAuthAccessToken,
1308
+ updateOAuthAccessToken
1309
+ },
1184
1310
  users: { getUser, updateUser, deleteUser },
1185
- authentication: { getUserAPIKeys, createUserAPIKey, deleteUserAPIKey, getUserOAuthClients, getUserOAuthAccessTokens },
1311
+ authentication: { getUserAPIKeys, createUserAPIKey, deleteUserAPIKey },
1186
1312
  workspaces: {
1187
1313
  getWorkspacesList,
1188
1314
  createWorkspace,
@@ -1200,6 +1326,7 @@ const operationsByTag$1 = {
1200
1326
  acceptWorkspaceMemberInvite,
1201
1327
  resendWorkspaceMemberInvite
1202
1328
  },
1329
+ xbcontrolOther: { listClusters, createCluster, getCluster, updateCluster },
1203
1330
  databases: {
1204
1331
  getDatabaseList,
1205
1332
  createDatabase,
@@ -1216,61 +1343,6 @@ const operationsByTag$1 = {
1216
1343
 
1217
1344
  const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
1218
1345
 
1219
- function getHostUrl(provider, type) {
1220
- if (isHostProviderAlias(provider)) {
1221
- return providers[provider][type];
1222
- } else if (isHostProviderBuilder(provider)) {
1223
- return provider[type];
1224
- }
1225
- throw new Error("Invalid API provider");
1226
- }
1227
- const providers = {
1228
- production: {
1229
- main: "https://api.xata.io",
1230
- workspaces: "https://{workspaceId}.{region}.xata.sh"
1231
- },
1232
- staging: {
1233
- main: "https://api.staging-xata.dev",
1234
- workspaces: "https://{workspaceId}.{region}.staging-xata.dev"
1235
- },
1236
- dev: {
1237
- main: "https://api.dev-xata.dev",
1238
- workspaces: "https://{workspaceId}.{region}.dev-xata.dev"
1239
- }
1240
- };
1241
- function isHostProviderAlias(alias) {
1242
- return isString(alias) && Object.keys(providers).includes(alias);
1243
- }
1244
- function isHostProviderBuilder(builder) {
1245
- return isObject(builder) && isString(builder.main) && isString(builder.workspaces);
1246
- }
1247
- function parseProviderString(provider = "production") {
1248
- if (isHostProviderAlias(provider)) {
1249
- return provider;
1250
- }
1251
- const [main, workspaces] = provider.split(",");
1252
- if (!main || !workspaces)
1253
- return null;
1254
- return { main, workspaces };
1255
- }
1256
- function buildProviderString(provider) {
1257
- if (isHostProviderAlias(provider))
1258
- return provider;
1259
- return `${provider.main},${provider.workspaces}`;
1260
- }
1261
- function parseWorkspacesUrlParts(url) {
1262
- if (!isString(url))
1263
- return null;
1264
- const regex = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.xata\.sh.*/;
1265
- const regexDev = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.dev-xata\.dev.*/;
1266
- const regexStaging = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.staging-xata\.dev.*/;
1267
- const regexProdTesting = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.xata\.tech.*/;
1268
- const match = url.match(regex) || url.match(regexDev) || url.match(regexStaging) || url.match(regexProdTesting);
1269
- if (!match)
1270
- return null;
1271
- return { workspace: match[1], region: match[2] };
1272
- }
1273
-
1274
1346
  var __accessCheck$7 = (obj, member, msg) => {
1275
1347
  if (!member.has(obj))
1276
1348
  throw TypeError("Cannot " + msg);
@@ -2595,60 +2667,6 @@ class XataApiPlugin {
2595
2667
  class XataPlugin {
2596
2668
  }
2597
2669
 
2598
- class FilesPlugin extends XataPlugin {
2599
- build(pluginOptions) {
2600
- return {
2601
- download: async (location) => {
2602
- const { table, record, column, fileId = "" } = location ?? {};
2603
- return await getFileItem({
2604
- pathParams: {
2605
- workspace: "{workspaceId}",
2606
- dbBranchName: "{dbBranch}",
2607
- region: "{region}",
2608
- tableName: table ?? "",
2609
- recordId: record ?? "",
2610
- columnName: column ?? "",
2611
- fileId
2612
- },
2613
- ...pluginOptions,
2614
- rawResponse: true
2615
- });
2616
- },
2617
- upload: async (location, file) => {
2618
- const { table, record, column, fileId = "" } = location ?? {};
2619
- return await putFileItem({
2620
- pathParams: {
2621
- workspace: "{workspaceId}",
2622
- dbBranchName: "{dbBranch}",
2623
- region: "{region}",
2624
- tableName: table ?? "",
2625
- recordId: record ?? "",
2626
- columnName: column ?? "",
2627
- fileId
2628
- },
2629
- body: file,
2630
- ...pluginOptions
2631
- });
2632
- },
2633
- delete: async (location) => {
2634
- const { table, record, column, fileId = "" } = location ?? {};
2635
- return await deleteFileItem({
2636
- pathParams: {
2637
- workspace: "{workspaceId}",
2638
- dbBranchName: "{dbBranch}",
2639
- region: "{region}",
2640
- tableName: table ?? "",
2641
- recordId: record ?? "",
2642
- columnName: column ?? "",
2643
- fileId
2644
- },
2645
- ...pluginOptions
2646
- });
2647
- }
2648
- };
2649
- }
2650
- }
2651
-
2652
2670
  function buildTransformString(transformations) {
2653
2671
  return transformations.flatMap(
2654
2672
  (t) => Object.entries(t).map(([key, value]) => {
@@ -2664,71 +2682,33 @@ function buildTransformString(transformations) {
2664
2682
  })
2665
2683
  ).join(",");
2666
2684
  }
2667
- function transformImage(url, transformations) {
2685
+ function transformImage(url, ...transformations) {
2668
2686
  if (!isDefined(url))
2669
2687
  return void 0;
2670
- const transformationsString = buildTransformString(transformations);
2688
+ const newTransformations = buildTransformString(transformations);
2671
2689
  const { hostname, pathname, search } = new URL(url);
2672
- return `https://${hostname}/transform/${transformationsString}${pathname}${search}`;
2690
+ const pathParts = pathname.split("/");
2691
+ const transformIndex = pathParts.findIndex((part) => part === "transform");
2692
+ const removedItems = transformIndex >= 0 ? pathParts.splice(transformIndex, 2) : [];
2693
+ const transform = `/transform/${[removedItems[1], newTransformations].filter(isDefined).join(",")}`;
2694
+ const path = pathParts.join("/");
2695
+ return `https://${hostname}${transform}${path}${search}`;
2673
2696
  }
2674
2697
 
2675
- var __defProp$6 = Object.defineProperty;
2676
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2677
- var __publicField$6 = (obj, key, value) => {
2678
- __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
2679
- return value;
2680
- };
2681
2698
  class XataFile {
2682
2699
  constructor(file) {
2683
- /**
2684
- * Name of this file.
2685
- */
2686
- __publicField$6(this, "name");
2687
- /**
2688
- * Media type of this file.
2689
- */
2690
- __publicField$6(this, "mediaType");
2691
- /**
2692
- * Base64 encoded content of this file.
2693
- */
2694
- __publicField$6(this, "base64Content");
2695
- /**
2696
- * Whether to enable public url for this file.
2697
- */
2698
- __publicField$6(this, "enablePublicUrl");
2699
- /**
2700
- * Timeout for the signed url.
2701
- */
2702
- __publicField$6(this, "signedUrlTimeout");
2703
- /**
2704
- * Size of this file.
2705
- */
2706
- __publicField$6(this, "size");
2707
- /**
2708
- * Version of this file.
2709
- */
2710
- __publicField$6(this, "version");
2711
- /**
2712
- * Url of this file.
2713
- */
2714
- __publicField$6(this, "url");
2715
- /**
2716
- * Signed url of this file.
2717
- */
2718
- __publicField$6(this, "signedUrl");
2719
- /**
2720
- * Attributes of this file.
2721
- */
2722
- __publicField$6(this, "attributes");
2700
+ this.id = file.id;
2723
2701
  this.name = file.name;
2724
- this.mediaType = file.mediaType || "application/octet-stream";
2702
+ this.mediaType = file.mediaType;
2725
2703
  this.base64Content = file.base64Content;
2726
2704
  this.enablePublicUrl = file.enablePublicUrl;
2727
2705
  this.signedUrlTimeout = file.signedUrlTimeout;
2706
+ this.uploadUrlTimeout = file.uploadUrlTimeout;
2728
2707
  this.size = file.size;
2729
2708
  this.version = file.version;
2730
2709
  this.url = file.url;
2731
2710
  this.signedUrl = file.signedUrl;
2711
+ this.uploadUrl = file.uploadUrl;
2732
2712
  this.attributes = file.attributes;
2733
2713
  }
2734
2714
  static fromBuffer(buffer, options = {}) {
@@ -2781,8 +2761,12 @@ class XataFile {
2781
2761
  if (!this.base64Content) {
2782
2762
  throw new Error(`File content is not available, please select property "base64Content" when querying the file`);
2783
2763
  }
2784
- const arrayBuffer = this.toArrayBuffer();
2785
- return new Blob([arrayBuffer], { type: this.mediaType });
2764
+ const binary = atob(this.base64Content);
2765
+ const uint8Array = new Uint8Array(binary.length);
2766
+ for (let i = 0; i < binary.length; i++) {
2767
+ uint8Array[i] = binary.charCodeAt(i);
2768
+ }
2769
+ return new Blob([uint8Array], { type: this.mediaType });
2786
2770
  }
2787
2771
  static fromString(string, options = {}) {
2788
2772
  const base64Content = btoa(string);
@@ -2805,16 +2789,27 @@ class XataFile {
2805
2789
  }
2806
2790
  transform(...options) {
2807
2791
  return {
2808
- url: transformImage(this.url, options),
2809
- signedUrl: transformImage(this.signedUrl, options)
2792
+ url: transformImage(this.url, ...options),
2793
+ signedUrl: transformImage(this.signedUrl, ...options),
2794
+ metadataUrl: transformImage(this.url, ...options, { format: "json" }),
2795
+ metadataSignedUrl: transformImage(this.signedUrl, ...options, { format: "json" })
2810
2796
  };
2811
2797
  }
2812
2798
  }
2813
2799
  const parseInputFileEntry = async (entry) => {
2814
2800
  if (!isDefined(entry))
2815
2801
  return null;
2816
- const { id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout } = await entry;
2817
- return compactObject({ id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout });
2802
+ const { id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout, uploadUrlTimeout } = await entry;
2803
+ return compactObject({
2804
+ id,
2805
+ // Name cannot be an empty string in our API
2806
+ name: name ? name : void 0,
2807
+ mediaType,
2808
+ base64Content,
2809
+ enablePublicUrl,
2810
+ signedUrlTimeout,
2811
+ uploadUrlTimeout
2812
+ });
2818
2813
  };
2819
2814
 
2820
2815
  function cleanFilter(filter) {
@@ -2844,12 +2839,25 @@ function cleanFilter(filter) {
2844
2839
  return Object.keys(values).length > 0 ? values : void 0;
2845
2840
  }
2846
2841
 
2847
- var __defProp$5 = Object.defineProperty;
2848
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2849
- var __publicField$5 = (obj, key, value) => {
2850
- __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
2851
- return value;
2852
- };
2842
+ function stringifyJson(value) {
2843
+ if (!isDefined(value))
2844
+ return value;
2845
+ if (isString(value))
2846
+ return value;
2847
+ try {
2848
+ return JSON.stringify(value);
2849
+ } catch (e) {
2850
+ return value;
2851
+ }
2852
+ }
2853
+ function parseJson(value) {
2854
+ try {
2855
+ return JSON.parse(value);
2856
+ } catch (e) {
2857
+ return value;
2858
+ }
2859
+ }
2860
+
2853
2861
  var __accessCheck$6 = (obj, member, msg) => {
2854
2862
  if (!member.has(obj))
2855
2863
  throw TypeError("Cannot " + msg);
@@ -2872,14 +2880,6 @@ var _query, _page;
2872
2880
  class Page {
2873
2881
  constructor(query, meta, records = []) {
2874
2882
  __privateAdd$6(this, _query, void 0);
2875
- /**
2876
- * Page metadata, required to retrieve additional records.
2877
- */
2878
- __publicField$5(this, "meta");
2879
- /**
2880
- * The set of results for this page.
2881
- */
2882
- __publicField$5(this, "records");
2883
2883
  __privateSet$6(this, _query, query);
2884
2884
  this.meta = meta;
2885
2885
  this.records = new RecordArray(this, records);
@@ -2929,9 +2929,9 @@ class Page {
2929
2929
  }
2930
2930
  }
2931
2931
  _query = new WeakMap();
2932
- const PAGINATION_MAX_SIZE = 200;
2932
+ const PAGINATION_MAX_SIZE = 1e3;
2933
2933
  const PAGINATION_DEFAULT_SIZE = 20;
2934
- const PAGINATION_MAX_OFFSET = 800;
2934
+ const PAGINATION_MAX_OFFSET = 49e3;
2935
2935
  const PAGINATION_DEFAULT_OFFSET = 0;
2936
2936
  function isCursorPaginationOptions(options) {
2937
2937
  return isDefined(options) && (isDefined(options.start) || isDefined(options.end) || isDefined(options.after) || isDefined(options.before));
@@ -3010,12 +3010,6 @@ const _RecordArray = class _RecordArray extends Array {
3010
3010
  _page = new WeakMap();
3011
3011
  let RecordArray = _RecordArray;
3012
3012
 
3013
- var __defProp$4 = Object.defineProperty;
3014
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3015
- var __publicField$4 = (obj, key, value) => {
3016
- __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
3017
- return value;
3018
- };
3019
3013
  var __accessCheck$5 = (obj, member, msg) => {
3020
3014
  if (!member.has(obj))
3021
3015
  throw TypeError("Cannot " + msg);
@@ -3046,8 +3040,8 @@ const _Query = class _Query {
3046
3040
  __privateAdd$5(this, _repository, void 0);
3047
3041
  __privateAdd$5(this, _data, { filter: {} });
3048
3042
  // Implements pagination
3049
- __publicField$4(this, "meta", { page: { cursor: "start", more: true, size: PAGINATION_DEFAULT_SIZE } });
3050
- __publicField$4(this, "records", new RecordArray(this, []));
3043
+ this.meta = { page: { cursor: "start", more: true, size: PAGINATION_DEFAULT_SIZE } };
3044
+ this.records = new RecordArray(this, []);
3051
3045
  __privateSet$5(this, _table$1, table);
3052
3046
  if (repository) {
3053
3047
  __privateSet$5(this, _repository, repository);
@@ -3302,7 +3296,8 @@ const RecordColumnTypes = [
3302
3296
  "datetime",
3303
3297
  "vector",
3304
3298
  "file[]",
3305
- "file"
3299
+ "file",
3300
+ "json"
3306
3301
  ];
3307
3302
  function isIdentifiable(x) {
3308
3303
  return isObject(x) && isString(x?.id);
@@ -3313,6 +3308,24 @@ function isXataRecord(x) {
3313
3308
  return isIdentifiable(x) && isObject(metadata) && typeof metadata.version === "number";
3314
3309
  }
3315
3310
 
3311
+ function isValidExpandedColumn(column) {
3312
+ return isObject(column) && isString(column.name);
3313
+ }
3314
+ function isValidSelectableColumns(columns) {
3315
+ if (!Array.isArray(columns)) {
3316
+ return false;
3317
+ }
3318
+ return columns.every((column) => {
3319
+ if (typeof column === "string") {
3320
+ return true;
3321
+ }
3322
+ if (typeof column === "object") {
3323
+ return isValidExpandedColumn(column);
3324
+ }
3325
+ return false;
3326
+ });
3327
+ }
3328
+
3316
3329
  function isSortFilterString(value) {
3317
3330
  return isString(value);
3318
3331
  }
@@ -3413,24 +3426,24 @@ class RestRepository extends Query {
3413
3426
  if (a.length === 0)
3414
3427
  return [];
3415
3428
  const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: true });
3416
- const columns = isStringArray(b) ? b : ["*"];
3429
+ const columns = isValidSelectableColumns(b) ? b : ["*"];
3417
3430
  const result = await this.read(ids, columns);
3418
3431
  return result;
3419
3432
  }
3420
3433
  if (isString(a) && isObject(b)) {
3421
3434
  if (a === "")
3422
3435
  throw new Error("The id can't be empty");
3423
- const columns = isStringArray(c) ? c : void 0;
3436
+ const columns = isValidSelectableColumns(c) ? c : void 0;
3424
3437
  return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
3425
3438
  }
3426
3439
  if (isObject(a) && isString(a.id)) {
3427
3440
  if (a.id === "")
3428
3441
  throw new Error("The id can't be empty");
3429
- const columns = isStringArray(b) ? b : void 0;
3442
+ const columns = isValidSelectableColumns(b) ? b : void 0;
3430
3443
  return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: true, ifVersion });
3431
3444
  }
3432
3445
  if (isObject(a)) {
3433
- const columns = isStringArray(b) ? b : void 0;
3446
+ const columns = isValidSelectableColumns(b) ? b : void 0;
3434
3447
  return __privateMethod$2(this, _insertRecordWithoutId, insertRecordWithoutId_fn).call(this, a, columns);
3435
3448
  }
3436
3449
  throw new Error("Invalid arguments for create method");
@@ -3438,7 +3451,7 @@ class RestRepository extends Query {
3438
3451
  }
3439
3452
  async read(a, b) {
3440
3453
  return __privateGet$4(this, _trace).call(this, "read", async () => {
3441
- const columns = isStringArray(b) ? b : ["*"];
3454
+ const columns = isValidSelectableColumns(b) ? b : ["*"];
3442
3455
  if (Array.isArray(a)) {
3443
3456
  if (a.length === 0)
3444
3457
  return [];
@@ -3465,7 +3478,13 @@ class RestRepository extends Query {
3465
3478
  ...__privateGet$4(this, _getFetchProps).call(this)
3466
3479
  });
3467
3480
  const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3468
- return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
3481
+ return initObject(
3482
+ __privateGet$4(this, _db),
3483
+ schemaTables,
3484
+ __privateGet$4(this, _table),
3485
+ response,
3486
+ columns
3487
+ );
3469
3488
  } catch (e) {
3470
3489
  if (isObject(e) && e.status === 404) {
3471
3490
  return null;
@@ -3507,17 +3526,17 @@ class RestRepository extends Query {
3507
3526
  ifVersion,
3508
3527
  upsert: false
3509
3528
  });
3510
- const columns = isStringArray(b) ? b : ["*"];
3529
+ const columns = isValidSelectableColumns(b) ? b : ["*"];
3511
3530
  const result = await this.read(a, columns);
3512
3531
  return result;
3513
3532
  }
3514
3533
  try {
3515
3534
  if (isString(a) && isObject(b)) {
3516
- const columns = isStringArray(c) ? c : void 0;
3535
+ const columns = isValidSelectableColumns(c) ? c : void 0;
3517
3536
  return await __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
3518
3537
  }
3519
3538
  if (isObject(a) && isString(a.id)) {
3520
- const columns = isStringArray(b) ? b : void 0;
3539
+ const columns = isValidSelectableColumns(b) ? b : void 0;
3521
3540
  return await __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
3522
3541
  }
3523
3542
  } catch (error) {
@@ -3557,20 +3576,20 @@ class RestRepository extends Query {
3557
3576
  ifVersion,
3558
3577
  upsert: true
3559
3578
  });
3560
- const columns = isStringArray(b) ? b : ["*"];
3579
+ const columns = isValidSelectableColumns(b) ? b : ["*"];
3561
3580
  const result = await this.read(a, columns);
3562
3581
  return result;
3563
3582
  }
3564
3583
  if (isString(a) && isObject(b)) {
3565
3584
  if (a === "")
3566
3585
  throw new Error("The id can't be empty");
3567
- const columns = isStringArray(c) ? c : void 0;
3586
+ const columns = isValidSelectableColumns(c) ? c : void 0;
3568
3587
  return await __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
3569
3588
  }
3570
3589
  if (isObject(a) && isString(a.id)) {
3571
3590
  if (a.id === "")
3572
3591
  throw new Error("The id can't be empty");
3573
- const columns = isStringArray(c) ? c : void 0;
3592
+ const columns = isValidSelectableColumns(c) ? c : void 0;
3574
3593
  return await __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
3575
3594
  }
3576
3595
  if (!isDefined(a) && isObject(b)) {
@@ -3589,20 +3608,20 @@ class RestRepository extends Query {
3589
3608
  if (a.length === 0)
3590
3609
  return [];
3591
3610
  const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: false });
3592
- const columns = isStringArray(b) ? b : ["*"];
3611
+ const columns = isValidSelectableColumns(b) ? b : ["*"];
3593
3612
  const result = await this.read(ids, columns);
3594
3613
  return result;
3595
3614
  }
3596
3615
  if (isString(a) && isObject(b)) {
3597
3616
  if (a === "")
3598
3617
  throw new Error("The id can't be empty");
3599
- const columns = isStringArray(c) ? c : void 0;
3618
+ const columns = isValidSelectableColumns(c) ? c : void 0;
3600
3619
  return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
3601
3620
  }
3602
3621
  if (isObject(a) && isString(a.id)) {
3603
3622
  if (a.id === "")
3604
3623
  throw new Error("The id can't be empty");
3605
- const columns = isStringArray(c) ? c : void 0;
3624
+ const columns = isValidSelectableColumns(c) ? c : void 0;
3606
3625
  return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
3607
3626
  }
3608
3627
  if (!isDefined(a) && isObject(b)) {
@@ -3626,7 +3645,7 @@ class RestRepository extends Query {
3626
3645
  return o.id;
3627
3646
  throw new Error("Invalid arguments for delete method");
3628
3647
  });
3629
- const columns = isStringArray(b) ? b : ["*"];
3648
+ const columns = isValidSelectableColumns(b) ? b : ["*"];
3630
3649
  const result = await this.read(a, columns);
3631
3650
  await __privateMethod$2(this, _deleteRecords, deleteRecords_fn).call(this, ids);
3632
3651
  return result;
@@ -3660,7 +3679,7 @@ class RestRepository extends Query {
3660
3679
  }
3661
3680
  async search(query, options = {}) {
3662
3681
  return __privateGet$4(this, _trace).call(this, "search", async () => {
3663
- const { records } = await searchTable({
3682
+ const { records, totalCount } = await searchTable({
3664
3683
  pathParams: {
3665
3684
  workspace: "{workspaceId}",
3666
3685
  dbBranchName: "{dbBranch}",
@@ -3680,12 +3699,15 @@ class RestRepository extends Query {
3680
3699
  ...__privateGet$4(this, _getFetchProps).call(this)
3681
3700
  });
3682
3701
  const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3683
- return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
3702
+ return {
3703
+ records: records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"])),
3704
+ totalCount
3705
+ };
3684
3706
  });
3685
3707
  }
3686
3708
  async vectorSearch(column, query, options) {
3687
3709
  return __privateGet$4(this, _trace).call(this, "vectorSearch", async () => {
3688
- const { records } = await vectorSearchTable({
3710
+ const { records, totalCount } = await vectorSearchTable({
3689
3711
  pathParams: {
3690
3712
  workspace: "{workspaceId}",
3691
3713
  dbBranchName: "{dbBranch}",
@@ -3702,7 +3724,10 @@ class RestRepository extends Query {
3702
3724
  ...__privateGet$4(this, _getFetchProps).call(this)
3703
3725
  });
3704
3726
  const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3705
- return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
3727
+ return {
3728
+ records: records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"])),
3729
+ totalCount
3730
+ };
3706
3731
  });
3707
3732
  }
3708
3733
  async aggregate(aggs, filter) {
@@ -3745,7 +3770,13 @@ class RestRepository extends Query {
3745
3770
  });
3746
3771
  const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3747
3772
  const records = objects.map(
3748
- (record) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), record, data.columns ?? ["*"])
3773
+ (record) => initObject(
3774
+ __privateGet$4(this, _db),
3775
+ schemaTables,
3776
+ __privateGet$4(this, _table),
3777
+ record,
3778
+ data.columns ?? ["*"]
3779
+ )
3749
3780
  );
3750
3781
  await __privateMethod$2(this, _setCacheQuery, setCacheQuery_fn).call(this, query, meta, records);
3751
3782
  return new Page(query, meta, records);
@@ -3772,7 +3803,13 @@ class RestRepository extends Query {
3772
3803
  },
3773
3804
  ...__privateGet$4(this, _getFetchProps).call(this)
3774
3805
  });
3775
- return result;
3806
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3807
+ return {
3808
+ ...result,
3809
+ summaries: result.summaries.map(
3810
+ (summary) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), summary, data.columns ?? [])
3811
+ )
3812
+ };
3776
3813
  });
3777
3814
  }
3778
3815
  ask(question, options) {
@@ -4051,19 +4088,15 @@ transformObjectToApi_fn = async function(object) {
4051
4088
  case "file[]":
4052
4089
  result[key] = await promiseMap(value, (item) => parseInputFileEntry(item));
4053
4090
  break;
4091
+ case "json":
4092
+ result[key] = stringifyJson(value);
4093
+ break;
4054
4094
  default:
4055
4095
  result[key] = value;
4056
4096
  }
4057
4097
  }
4058
4098
  return result;
4059
4099
  };
4060
- const removeLinksFromObject = (object) => {
4061
- return Object.entries(object).reduce((acc, [key, value]) => {
4062
- if (key === "xata")
4063
- return acc;
4064
- return { ...acc, [key]: isIdentifiable(value) ? value.id : value };
4065
- }, {});
4066
- };
4067
4100
  const initObject = (db, schemaTables, table, object, selectedColumns) => {
4068
4101
  const data = {};
4069
4102
  const { xata, ...rest } = object ?? {};
@@ -4094,13 +4127,19 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
4094
4127
  if (item === column.name) {
4095
4128
  return [...acc, "*"];
4096
4129
  }
4097
- if (item.startsWith(`${column.name}.`)) {
4130
+ if (isString(item) && item.startsWith(`${column.name}.`)) {
4098
4131
  const [, ...path] = item.split(".");
4099
4132
  return [...acc, path.join(".")];
4100
4133
  }
4101
4134
  return acc;
4102
4135
  }, []);
4103
- data[column.name] = initObject(db, schemaTables, linkTable, value, selectedLinkColumns);
4136
+ data[column.name] = initObject(
4137
+ db,
4138
+ schemaTables,
4139
+ linkTable,
4140
+ value,
4141
+ selectedLinkColumns
4142
+ );
4104
4143
  } else {
4105
4144
  data[column.name] = null;
4106
4145
  }
@@ -4112,6 +4151,9 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
4112
4151
  case "file[]":
4113
4152
  data[column.name] = value?.map((item) => new XataFile(item)) ?? null;
4114
4153
  break;
4154
+ case "json":
4155
+ data[column.name] = parseJson(value);
4156
+ break;
4115
4157
  default:
4116
4158
  data[column.name] = value ?? null;
4117
4159
  if (column.notNull === true && value === null) {
@@ -4121,33 +4163,34 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
4121
4163
  }
4122
4164
  }
4123
4165
  const record = { ...data };
4124
- const serializable = { xata, ...removeLinksFromObject(data) };
4125
4166
  const metadata = xata !== void 0 ? { ...xata, createdAt: new Date(xata.createdAt), updatedAt: new Date(xata.updatedAt) } : void 0;
4126
4167
  record.read = function(columns2) {
4127
4168
  return db[table].read(record["id"], columns2);
4128
4169
  };
4129
4170
  record.update = function(data2, b, c) {
4130
- const columns2 = isStringArray(b) ? b : ["*"];
4171
+ const columns2 = isValidSelectableColumns(b) ? b : ["*"];
4131
4172
  const ifVersion = parseIfVersion(b, c);
4132
4173
  return db[table].update(record["id"], data2, columns2, { ifVersion });
4133
4174
  };
4134
4175
  record.replace = function(data2, b, c) {
4135
- const columns2 = isStringArray(b) ? b : ["*"];
4176
+ const columns2 = isValidSelectableColumns(b) ? b : ["*"];
4136
4177
  const ifVersion = parseIfVersion(b, c);
4137
4178
  return db[table].createOrReplace(record["id"], data2, columns2, { ifVersion });
4138
4179
  };
4139
4180
  record.delete = function() {
4140
4181
  return db[table].delete(record["id"]);
4141
4182
  };
4142
- record.xata = Object.freeze(metadata);
4183
+ if (metadata !== void 0) {
4184
+ record.xata = Object.freeze(metadata);
4185
+ }
4143
4186
  record.getMetadata = function() {
4144
4187
  return record.xata;
4145
4188
  };
4146
4189
  record.toSerializable = function() {
4147
- return JSON.parse(JSON.stringify(serializable));
4190
+ return JSON.parse(JSON.stringify(record));
4148
4191
  };
4149
4192
  record.toString = function() {
4150
- return JSON.stringify(serializable);
4193
+ return JSON.stringify(record);
4151
4194
  };
4152
4195
  for (const prop of ["read", "update", "replace", "delete", "getMetadata", "toSerializable", "toString"]) {
4153
4196
  Object.defineProperty(record, prop, { enumerable: false });
@@ -4165,7 +4208,7 @@ function extractId(value) {
4165
4208
  function isValidColumn(columns, column) {
4166
4209
  if (columns.includes("*"))
4167
4210
  return true;
4168
- return columns.filter((item) => item.startsWith(column.name)).length > 0;
4211
+ return columns.filter((item) => isString(item) && item.startsWith(column.name)).length > 0;
4169
4212
  }
4170
4213
  function parseIfVersion(...args) {
4171
4214
  for (const arg of args) {
@@ -4176,12 +4219,6 @@ function parseIfVersion(...args) {
4176
4219
  return void 0;
4177
4220
  }
4178
4221
 
4179
- var __defProp$3 = Object.defineProperty;
4180
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4181
- var __publicField$3 = (obj, key, value) => {
4182
- __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
4183
- return value;
4184
- };
4185
4222
  var __accessCheck$3 = (obj, member, msg) => {
4186
4223
  if (!member.has(obj))
4187
4224
  throw TypeError("Cannot " + msg);
@@ -4204,8 +4241,6 @@ var _map;
4204
4241
  class SimpleCache {
4205
4242
  constructor(options = {}) {
4206
4243
  __privateAdd$3(this, _map, void 0);
4207
- __publicField$3(this, "capacity");
4208
- __publicField$3(this, "defaultQueryTTL");
4209
4244
  __privateSet$3(this, _map, /* @__PURE__ */ new Map());
4210
4245
  this.capacity = options.max ?? 500;
4211
4246
  this.defaultQueryTTL = options.defaultQueryTTL ?? 60 * 1e3;
@@ -4250,10 +4285,12 @@ const notExists = (column) => ({ $notExists: column });
4250
4285
  const startsWith = (value) => ({ $startsWith: value });
4251
4286
  const endsWith = (value) => ({ $endsWith: value });
4252
4287
  const pattern = (value) => ({ $pattern: value });
4288
+ const iPattern = (value) => ({ $iPattern: value });
4253
4289
  const is = (value) => ({ $is: value });
4254
4290
  const equals = is;
4255
4291
  const isNot = (value) => ({ $isNot: value });
4256
4292
  const contains = (value) => ({ $contains: value });
4293
+ const iContains = (value) => ({ $iContains: value });
4257
4294
  const includes = (value) => ({ $includes: value });
4258
4295
  const includesAll = (value) => ({ $includesAll: value });
4259
4296
  const includesNone = (value) => ({ $includesNone: value });
@@ -4309,6 +4346,80 @@ class SchemaPlugin extends XataPlugin {
4309
4346
  _tables = new WeakMap();
4310
4347
  _schemaTables$1 = new WeakMap();
4311
4348
 
4349
+ class FilesPlugin extends XataPlugin {
4350
+ build(pluginOptions) {
4351
+ return {
4352
+ download: async (location) => {
4353
+ const { table, record, column, fileId = "" } = location ?? {};
4354
+ return await getFileItem({
4355
+ pathParams: {
4356
+ workspace: "{workspaceId}",
4357
+ dbBranchName: "{dbBranch}",
4358
+ region: "{region}",
4359
+ tableName: table ?? "",
4360
+ recordId: record ?? "",
4361
+ columnName: column ?? "",
4362
+ fileId
4363
+ },
4364
+ ...pluginOptions,
4365
+ rawResponse: true
4366
+ });
4367
+ },
4368
+ upload: async (location, file, options) => {
4369
+ const { table, record, column, fileId = "" } = location ?? {};
4370
+ const resolvedFile = await file;
4371
+ const contentType = options?.mediaType || getContentType(resolvedFile);
4372
+ const body = resolvedFile instanceof XataFile ? resolvedFile.toBlob() : resolvedFile;
4373
+ return await putFileItem({
4374
+ ...pluginOptions,
4375
+ pathParams: {
4376
+ workspace: "{workspaceId}",
4377
+ dbBranchName: "{dbBranch}",
4378
+ region: "{region}",
4379
+ tableName: table ?? "",
4380
+ recordId: record ?? "",
4381
+ columnName: column ?? "",
4382
+ fileId
4383
+ },
4384
+ body,
4385
+ headers: { "Content-Type": contentType }
4386
+ });
4387
+ },
4388
+ delete: async (location) => {
4389
+ const { table, record, column, fileId = "" } = location ?? {};
4390
+ return await deleteFileItem({
4391
+ pathParams: {
4392
+ workspace: "{workspaceId}",
4393
+ dbBranchName: "{dbBranch}",
4394
+ region: "{region}",
4395
+ tableName: table ?? "",
4396
+ recordId: record ?? "",
4397
+ columnName: column ?? "",
4398
+ fileId
4399
+ },
4400
+ ...pluginOptions
4401
+ });
4402
+ }
4403
+ };
4404
+ }
4405
+ }
4406
+ function getContentType(file) {
4407
+ if (typeof file === "string") {
4408
+ return "text/plain";
4409
+ }
4410
+ if ("mediaType" in file && file.mediaType !== void 0) {
4411
+ return file.mediaType;
4412
+ }
4413
+ if (isBlob(file)) {
4414
+ return file.type;
4415
+ }
4416
+ try {
4417
+ return file.type;
4418
+ } catch (e) {
4419
+ }
4420
+ return "application/octet-stream";
4421
+ }
4422
+
4312
4423
  var __accessCheck$1 = (obj, member, msg) => {
4313
4424
  if (!member.has(obj))
4314
4425
  throw TypeError("Cannot " + msg);
@@ -4344,22 +4455,26 @@ class SearchPlugin extends XataPlugin {
4344
4455
  build(pluginOptions) {
4345
4456
  return {
4346
4457
  all: async (query, options = {}) => {
4347
- const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4458
+ const { records, totalCount } = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4348
4459
  const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, pluginOptions);
4349
- return records.map((record) => {
4350
- const { table = "orphan" } = record.xata;
4351
- return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
4352
- });
4460
+ return {
4461
+ totalCount,
4462
+ records: records.map((record) => {
4463
+ const { table = "orphan" } = record.xata;
4464
+ return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
4465
+ })
4466
+ };
4353
4467
  },
4354
4468
  byTable: async (query, options = {}) => {
4355
- const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4469
+ const { records: rawRecords, totalCount } = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4356
4470
  const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, pluginOptions);
4357
- return records.reduce((acc, record) => {
4471
+ const records = rawRecords.reduce((acc, record) => {
4358
4472
  const { table = "orphan" } = record.xata;
4359
4473
  const items = acc[table] ?? [];
4360
4474
  const item = initObject(this.db, schemaTables, table, record, ["*"]);
4361
4475
  return { ...acc, [table]: [...items, item] };
4362
4476
  }, {});
4477
+ return { totalCount, records };
4363
4478
  }
4364
4479
  };
4365
4480
  }
@@ -4368,13 +4483,13 @@ _schemaTables = new WeakMap();
4368
4483
  _search = new WeakSet();
4369
4484
  search_fn = async function(query, options, pluginOptions) {
4370
4485
  const { tables, fuzziness, highlight, prefix, page } = options ?? {};
4371
- const { records } = await searchBranch({
4486
+ const { records, totalCount } = await searchBranch({
4372
4487
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4373
4488
  // @ts-ignore https://github.com/xataio/client-ts/issues/313
4374
4489
  body: { tables, query, fuzziness, prefix, highlight, page },
4375
4490
  ...pluginOptions
4376
4491
  });
4377
- return records;
4492
+ return { records, totalCount };
4378
4493
  };
4379
4494
  _getSchemaTables = new WeakSet();
4380
4495
  getSchemaTables_fn = async function(pluginOptions) {
@@ -4388,6 +4503,78 @@ getSchemaTables_fn = async function(pluginOptions) {
4388
4503
  return schema.tables;
4389
4504
  };
4390
4505
 
4506
+ function escapeElement(elementRepresentation) {
4507
+ const escaped = elementRepresentation.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
4508
+ return '"' + escaped + '"';
4509
+ }
4510
+ function arrayString(val) {
4511
+ let result = "{";
4512
+ for (let i = 0; i < val.length; i++) {
4513
+ if (i > 0) {
4514
+ result = result + ",";
4515
+ }
4516
+ if (val[i] === null || typeof val[i] === "undefined") {
4517
+ result = result + "NULL";
4518
+ } else if (Array.isArray(val[i])) {
4519
+ result = result + arrayString(val[i]);
4520
+ } else if (val[i] instanceof Buffer) {
4521
+ result += "\\\\x" + val[i].toString("hex");
4522
+ } else {
4523
+ result += escapeElement(prepareValue(val[i]));
4524
+ }
4525
+ }
4526
+ result = result + "}";
4527
+ return result;
4528
+ }
4529
+ function prepareValue(value) {
4530
+ if (!isDefined(value))
4531
+ return null;
4532
+ if (value instanceof Date) {
4533
+ return value.toISOString();
4534
+ }
4535
+ if (Array.isArray(value)) {
4536
+ return arrayString(value);
4537
+ }
4538
+ if (isObject(value)) {
4539
+ return JSON.stringify(value);
4540
+ }
4541
+ try {
4542
+ return value.toString();
4543
+ } catch (e) {
4544
+ return value;
4545
+ }
4546
+ }
4547
+ function prepareParams(param1, param2) {
4548
+ if (isString(param1)) {
4549
+ return { statement: param1, params: param2?.map((value) => prepareValue(value)) };
4550
+ }
4551
+ if (isStringArray(param1)) {
4552
+ const statement = param1.reduce((acc, curr, index) => {
4553
+ return acc + curr + (index < (param2?.length ?? 0) ? "$" + (index + 1) : "");
4554
+ }, "");
4555
+ return { statement, params: param2?.map((value) => prepareValue(value)) };
4556
+ }
4557
+ if (isObject(param1)) {
4558
+ const { statement, params, consistency } = param1;
4559
+ return { statement, params: params?.map((value) => prepareValue(value)), consistency };
4560
+ }
4561
+ throw new Error("Invalid query");
4562
+ }
4563
+
4564
+ class SQLPlugin extends XataPlugin {
4565
+ build(pluginOptions) {
4566
+ return async (param1, ...param2) => {
4567
+ const { statement, params, consistency } = prepareParams(param1, param2);
4568
+ const { records, warning } = await sqlQuery({
4569
+ pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4570
+ body: { statement, params, consistency },
4571
+ ...pluginOptions
4572
+ });
4573
+ return { records, warning };
4574
+ };
4575
+ }
4576
+ }
4577
+
4391
4578
  class TransactionPlugin extends XataPlugin {
4392
4579
  build(pluginOptions) {
4393
4580
  return {
@@ -4403,12 +4590,6 @@ class TransactionPlugin extends XataPlugin {
4403
4590
  }
4404
4591
  }
4405
4592
 
4406
- var __defProp$2 = Object.defineProperty;
4407
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4408
- var __publicField$2 = (obj, key, value) => {
4409
- __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
4410
- return value;
4411
- };
4412
4593
  var __accessCheck = (obj, member, msg) => {
4413
4594
  if (!member.has(obj))
4414
4595
  throw TypeError("Cannot " + msg);
@@ -4438,10 +4619,6 @@ const buildClient = (plugins) => {
4438
4619
  __privateAdd(this, _parseOptions);
4439
4620
  __privateAdd(this, _getFetchProps);
4440
4621
  __privateAdd(this, _options, void 0);
4441
- __publicField$2(this, "db");
4442
- __publicField$2(this, "search");
4443
- __publicField$2(this, "transactions");
4444
- __publicField$2(this, "files");
4445
4622
  const safeOptions = __privateMethod(this, _parseOptions, parseOptions_fn).call(this, options);
4446
4623
  __privateSet(this, _options, safeOptions);
4447
4624
  const pluginOptions = {
@@ -4452,10 +4629,12 @@ const buildClient = (plugins) => {
4452
4629
  const db = new SchemaPlugin(schemaTables).build(pluginOptions);
4453
4630
  const search = new SearchPlugin(db, schemaTables).build(pluginOptions);
4454
4631
  const transactions = new TransactionPlugin().build(pluginOptions);
4632
+ const sql = new SQLPlugin().build(pluginOptions);
4455
4633
  const files = new FilesPlugin().build(pluginOptions);
4456
4634
  this.db = db;
4457
4635
  this.search = search;
4458
4636
  this.transactions = transactions;
4637
+ this.sql = sql;
4459
4638
  this.files = files;
4460
4639
  for (const [key, namespace] of Object.entries(plugins ?? {})) {
4461
4640
  if (namespace === void 0)
@@ -4553,17 +4732,11 @@ const buildClient = (plugins) => {
4553
4732
  class BaseClient extends buildClient() {
4554
4733
  }
4555
4734
 
4556
- var __defProp$1 = Object.defineProperty;
4557
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4558
- var __publicField$1 = (obj, key, value) => {
4559
- __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
4560
- return value;
4561
- };
4562
4735
  const META = "__";
4563
4736
  const VALUE = "___";
4564
4737
  class Serializer {
4565
4738
  constructor() {
4566
- __publicField$1(this, "classes", {});
4739
+ this.classes = {};
4567
4740
  }
4568
4741
  add(clazz) {
4569
4742
  this.classes[clazz.name] = clazz;
@@ -4626,34 +4799,12 @@ const deserialize = (json) => {
4626
4799
  return defaultSerializer.fromJSON(json);
4627
4800
  };
4628
4801
 
4629
- function buildWorkerRunner(config) {
4630
- return function xataWorker(name, worker) {
4631
- return async (...args) => {
4632
- const url = process.env.NODE_ENV === "development" ? `http://localhost:64749/${name}` : `https://dispatcher.xata.workers.dev/${config.workspace}/${config.worker}/${name}`;
4633
- const result = await fetch(url, {
4634
- method: "POST",
4635
- headers: { "Content-Type": "application/json" },
4636
- body: serialize({ args })
4637
- });
4638
- const text = await result.text();
4639
- return deserialize(text);
4640
- };
4641
- };
4642
- }
4643
-
4644
- var __defProp = Object.defineProperty;
4645
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4646
- var __publicField = (obj, key, value) => {
4647
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4648
- return value;
4649
- };
4650
4802
  class XataError extends Error {
4651
4803
  constructor(message, status) {
4652
4804
  super(message);
4653
- __publicField(this, "status");
4654
4805
  this.status = status;
4655
4806
  }
4656
4807
  }
4657
4808
 
4658
- export { BaseClient, FetcherError, FilesPlugin, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, RecordColumnTypes, Repository, RestRepository, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, XataApiClient, XataApiPlugin, XataError, XataFile, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, askTable, askTableSession, branchTransaction, buildClient, buildPreviewBranchName, buildProviderString, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, copyBranch, createBranch, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteDatabaseGithubSettings, deleteFile, deleteFileItem, deleteOAuthAccessToken, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, fileAccess, ge, getAPIKey, getAuthorizationCode, getBranch, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getColumn, getDatabaseGithubSettings, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getFile, getFileItem, getGitBranchesMapping, getHostUrl, getMigrationRequest, getMigrationRequestIsMerged, getPreviewBranch, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getUserOAuthAccessTokens, getUserOAuthClients, getWorkspace, getWorkspaceMembersList, getWorkspacesList, grantAuthorizationCode, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isHostProviderAlias, isHostProviderBuilder, isIdentifiable, isNot, isXataRecord, le, lessEquals, lessThan, lessThanEquals, listMigrationRequestsCommits, listRegions, lt, lte, mergeMigrationRequest, notExists, operationsByTag, parseProviderString, parseWorkspacesUrlParts, pattern, previewBranchSchemaEdit, pushBranchMigrations, putFile, putFileItem, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, renameDatabase, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, sqlQuery, startsWith, summarizeTable, transformImage, updateBranchMetadata, updateBranchSchema, updateColumn, updateDatabaseGithubSettings, updateDatabaseMetadata, updateMigrationRequest, updateOAuthAccessToken, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID, vectorSearchTable };
4809
+ export { BaseClient, FetcherError, FilesPlugin, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, RecordColumnTypes, Repository, RestRepository, SQLPlugin, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, TransactionPlugin, XataApiClient, XataApiPlugin, XataError, XataFile, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, applyMigration, askTable, askTableSession, branchTransaction, buildClient, buildPreviewBranchName, buildProviderString, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, copyBranch, createBranch, createCluster, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteDatabaseGithubSettings, deleteFile, deleteFileItem, deleteOAuthAccessToken, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteUserOAuthClient, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, fileAccess, fileUpload, ge, getAPIKey, getAuthorizationCode, getBranch, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getCluster, getColumn, getDatabaseGithubSettings, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getFile, getFileItem, getGitBranchesMapping, getHostUrl, getMigrationRequest, getMigrationRequestIsMerged, getPreviewBranch, getRecord, getSchema, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getUserOAuthAccessTokens, getUserOAuthClients, getWorkspace, getWorkspaceMembersList, getWorkspacesList, grantAuthorizationCode, greaterEquals, greaterThan, greaterThanEquals, gt, gte, iContains, iPattern, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isHostProviderAlias, isHostProviderBuilder, isIdentifiable, isNot, isValidExpandedColumn, isValidSelectableColumns, isXataRecord, le, lessEquals, lessThan, lessThanEquals, listClusters, listMigrationRequestsCommits, listRegions, lt, lte, mergeMigrationRequest, notExists, operationsByTag, parseProviderString, parseWorkspacesUrlParts, pattern, pgRollJobStatus, pgRollMigrationHistory, pgRollStatus, previewBranchSchemaEdit, pushBranchMigrations, putFile, putFileItem, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, renameDatabase, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, sqlQuery, startsWith, summarizeTable, transformImage, updateBranchMetadata, updateBranchSchema, updateCluster, updateColumn, updateDatabaseGithubSettings, updateDatabaseMetadata, updateMigrationRequest, updateOAuthAccessToken, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID, vectorSearchTable };
4659
4810
  //# sourceMappingURL=index.mjs.map