@xata.io/client 0.0.0-alpha.vfdc5c07 → 0.0.0-alpha.vfdd84a8886de0780cc9d446ebf507207840c325b

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
@@ -246,7 +246,7 @@ var __accessCheck$8 = (obj, member, msg) => {
246
246
  if (!member.has(obj))
247
247
  throw TypeError("Cannot " + msg);
248
248
  };
249
- var __privateGet$8 = (obj, member, getter) => {
249
+ var __privateGet$7 = (obj, member, getter) => {
250
250
  __accessCheck$8(obj, member, "read from private field");
251
251
  return getter ? getter.call(obj) : member.get(obj);
252
252
  };
@@ -255,7 +255,7 @@ var __privateAdd$8 = (obj, member, value) => {
255
255
  throw TypeError("Cannot add the same private member more than once");
256
256
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
257
257
  };
258
- var __privateSet$8 = (obj, member, value, setter) => {
258
+ var __privateSet$6 = (obj, member, value, setter) => {
259
259
  __accessCheck$8(obj, member, "write to private field");
260
260
  setter ? setter.call(obj, value) : member.set(obj, value);
261
261
  return value;
@@ -281,19 +281,19 @@ class ApiRequestPool {
281
281
  __privateAdd$8(this, _fetch, void 0);
282
282
  __privateAdd$8(this, _queue, void 0);
283
283
  __privateAdd$8(this, _concurrency, void 0);
284
- __privateSet$8(this, _queue, []);
285
- __privateSet$8(this, _concurrency, concurrency);
284
+ __privateSet$6(this, _queue, []);
285
+ __privateSet$6(this, _concurrency, concurrency);
286
286
  this.running = 0;
287
287
  this.started = 0;
288
288
  }
289
289
  setFetch(fetch2) {
290
- __privateSet$8(this, _fetch, fetch2);
290
+ __privateSet$6(this, _fetch, fetch2);
291
291
  }
292
292
  getFetch() {
293
- if (!__privateGet$8(this, _fetch)) {
293
+ if (!__privateGet$7(this, _fetch)) {
294
294
  throw new Error("Fetch not set");
295
295
  }
296
- return __privateGet$8(this, _fetch);
296
+ return __privateGet$7(this, _fetch);
297
297
  }
298
298
  request(url, options) {
299
299
  const start = /* @__PURE__ */ new Date();
@@ -325,19 +325,19 @@ _queue = new WeakMap();
325
325
  _concurrency = new WeakMap();
326
326
  _enqueue = new WeakSet();
327
327
  enqueue_fn = function(task) {
328
- const promise = new Promise((resolve) => __privateGet$8(this, _queue).push(resolve)).finally(() => {
328
+ const promise = new Promise((resolve) => __privateGet$7(this, _queue).push(resolve)).finally(() => {
329
329
  this.started--;
330
330
  this.running++;
331
331
  }).then(() => task()).finally(() => {
332
332
  this.running--;
333
- const next = __privateGet$8(this, _queue).shift();
333
+ const next = __privateGet$7(this, _queue).shift();
334
334
  if (next !== void 0) {
335
335
  this.started++;
336
336
  next();
337
337
  }
338
338
  });
339
- if (this.running + this.started < __privateGet$8(this, _concurrency)) {
340
- const next = __privateGet$8(this, _queue).shift();
339
+ if (this.running + this.started < __privateGet$7(this, _concurrency)) {
340
+ const next = __privateGet$7(this, _queue).shift();
341
341
  if (next !== void 0) {
342
342
  this.started++;
343
343
  next();
@@ -526,7 +526,7 @@ function defaultOnOpen(response) {
526
526
  }
527
527
  }
528
528
 
529
- const VERSION = "0.26.8";
529
+ const VERSION = "0.29.0";
530
530
 
531
531
  class ErrorWithCause extends Error {
532
532
  constructor(message, options) {
@@ -569,6 +569,67 @@ function getMessage(data) {
569
569
  }
570
570
  }
571
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
+
572
633
  const pool = new ApiRequestPool();
573
634
  const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
574
635
  const cleanQueryParams = Object.entries(queryParams).reduce((acc, [key, value]) => {
@@ -584,6 +645,7 @@ const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
584
645
  return url.replace(/\{\w*\}/g, (key) => cleanPathParams[key.slice(1, -1)]) + queryString;
585
646
  };
586
647
  function buildBaseUrl({
648
+ method,
587
649
  endpoint,
588
650
  path,
589
651
  workspacesApiUrl,
@@ -591,7 +653,24 @@ function buildBaseUrl({
591
653
  pathParams = {}
592
654
  }) {
593
655
  if (endpoint === "dataPlane") {
594
- 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
+ }
595
674
  const urlWithWorkspace = isString(pathParams.workspace) ? url.replace("{workspaceId}", String(pathParams.workspace)) : url;
596
675
  return isString(pathParams.region) ? urlWithWorkspace.replace("{region}", String(pathParams.region)) : urlWithWorkspace;
597
676
  }
@@ -640,9 +719,9 @@ async function fetch$1({
640
719
  return await trace(
641
720
  `${method.toUpperCase()} ${path}`,
642
721
  async ({ setAttributes }) => {
643
- const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
722
+ const baseUrl = buildBaseUrl({ method, endpoint, path, workspacesApiUrl, pathParams, apiUrl });
644
723
  const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
645
- const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
724
+ const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\.[^.]+\./, "http://") : fullUrl;
646
725
  setAttributes({
647
726
  [TraceAttributes.HTTP_URL]: url,
648
727
  [TraceAttributes.HTTP_TARGET]: resolveUrl(path, queryParams, pathParams)
@@ -723,7 +802,7 @@ function fetchSSERequest({
723
802
  clientName,
724
803
  xataAgentExtra
725
804
  }) {
726
- const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
805
+ const baseUrl = buildBaseUrl({ method, endpoint, path, workspacesApiUrl, pathParams, apiUrl });
727
806
  const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
728
807
  const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
729
808
  void fetchEventSource(url, {
@@ -766,6 +845,20 @@ function parseUrl(url) {
766
845
 
767
846
  const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
768
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 });
769
862
  const getBranchList = (variables, signal) => dataPlaneFetch({
770
863
  url: "/dbs/{dbName}",
771
864
  method: "get",
@@ -972,6 +1065,12 @@ const fileAccess = (variables, signal) => dataPlaneFetch({
972
1065
  ...variables,
973
1066
  signal
974
1067
  });
1068
+ const fileUpload = (variables, signal) => dataPlaneFetch({
1069
+ url: "/file/{fileId}",
1070
+ method: "put",
1071
+ ...variables,
1072
+ signal
1073
+ });
975
1074
  const sqlQuery = (variables, signal) => dataPlaneFetch({
976
1075
  url: "/db/{dbBranchName}/sql",
977
1076
  method: "post",
@@ -980,6 +1079,10 @@ const sqlQuery = (variables, signal) => dataPlaneFetch({
980
1079
  });
981
1080
  const operationsByTag$2 = {
982
1081
  branch: {
1082
+ applyMigration,
1083
+ pgRollStatus,
1084
+ pgRollJobStatus,
1085
+ pgRollMigrationHistory,
983
1086
  getBranchList,
984
1087
  getBranchDetails,
985
1088
  createBranch,
@@ -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,
@@ -1160,12 +1263,7 @@ const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ u
1160
1263
  const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "delete", ...variables, signal });
1161
1264
  const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
1162
1265
  const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
1163
- const listClusters = (variables, signal) => controlPlaneFetch({
1164
- url: "/workspaces/{workspaceId}/clusters",
1165
- method: "get",
1166
- ...variables,
1167
- signal
1168
- });
1266
+ const listClusters = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters", method: "get", ...variables, signal });
1169
1267
  const createCluster = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters", method: "post", ...variables, signal });
1170
1268
  const getCluster = (variables, signal) => controlPlaneFetch({
1171
1269
  url: "/workspaces/{workspaceId}/clusters/{clusterId}",
@@ -1245,66 +1343,11 @@ const operationsByTag$1 = {
1245
1343
 
1246
1344
  const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
1247
1345
 
1248
- function getHostUrl(provider, type) {
1249
- if (isHostProviderAlias(provider)) {
1250
- return providers[provider][type];
1251
- } else if (isHostProviderBuilder(provider)) {
1252
- return provider[type];
1253
- }
1254
- throw new Error("Invalid API provider");
1255
- }
1256
- const providers = {
1257
- production: {
1258
- main: "https://api.xata.io",
1259
- workspaces: "https://{workspaceId}.{region}.xata.sh"
1260
- },
1261
- staging: {
1262
- main: "https://api.staging-xata.dev",
1263
- workspaces: "https://{workspaceId}.{region}.staging-xata.dev"
1264
- },
1265
- dev: {
1266
- main: "https://api.dev-xata.dev",
1267
- workspaces: "https://{workspaceId}.{region}.dev-xata.dev"
1268
- }
1269
- };
1270
- function isHostProviderAlias(alias) {
1271
- return isString(alias) && Object.keys(providers).includes(alias);
1272
- }
1273
- function isHostProviderBuilder(builder) {
1274
- return isObject(builder) && isString(builder.main) && isString(builder.workspaces);
1275
- }
1276
- function parseProviderString(provider = "production") {
1277
- if (isHostProviderAlias(provider)) {
1278
- return provider;
1279
- }
1280
- const [main, workspaces] = provider.split(",");
1281
- if (!main || !workspaces)
1282
- return null;
1283
- return { main, workspaces };
1284
- }
1285
- function buildProviderString(provider) {
1286
- if (isHostProviderAlias(provider))
1287
- return provider;
1288
- return `${provider.main},${provider.workspaces}`;
1289
- }
1290
- function parseWorkspacesUrlParts(url) {
1291
- if (!isString(url))
1292
- return null;
1293
- const regex = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.xata\.sh.*/;
1294
- const regexDev = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.dev-xata\.dev.*/;
1295
- const regexStaging = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.staging-xata\.dev.*/;
1296
- const regexProdTesting = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.xata\.tech.*/;
1297
- const match = url.match(regex) || url.match(regexDev) || url.match(regexStaging) || url.match(regexProdTesting);
1298
- if (!match)
1299
- return null;
1300
- return { workspace: match[1], region: match[2] };
1301
- }
1302
-
1303
1346
  var __accessCheck$7 = (obj, member, msg) => {
1304
1347
  if (!member.has(obj))
1305
1348
  throw TypeError("Cannot " + msg);
1306
1349
  };
1307
- var __privateGet$7 = (obj, member, getter) => {
1350
+ var __privateGet$6 = (obj, member, getter) => {
1308
1351
  __accessCheck$7(obj, member, "read from private field");
1309
1352
  return getter ? getter.call(obj) : member.get(obj);
1310
1353
  };
@@ -1313,7 +1356,7 @@ var __privateAdd$7 = (obj, member, value) => {
1313
1356
  throw TypeError("Cannot add the same private member more than once");
1314
1357
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1315
1358
  };
1316
- var __privateSet$7 = (obj, member, value, setter) => {
1359
+ var __privateSet$5 = (obj, member, value, setter) => {
1317
1360
  __accessCheck$7(obj, member, "write to private field");
1318
1361
  setter ? setter.call(obj, value) : member.set(obj, value);
1319
1362
  return value;
@@ -1330,7 +1373,7 @@ class XataApiClient {
1330
1373
  if (!apiKey) {
1331
1374
  throw new Error("Could not resolve a valid apiKey");
1332
1375
  }
1333
- __privateSet$7(this, _extraProps, {
1376
+ __privateSet$5(this, _extraProps, {
1334
1377
  apiUrl: getHostUrl(provider, "main"),
1335
1378
  workspacesApiUrl: getHostUrl(provider, "workspaces"),
1336
1379
  fetch: getFetchImplementation(options.fetch),
@@ -1342,64 +1385,64 @@ class XataApiClient {
1342
1385
  });
1343
1386
  }
1344
1387
  get user() {
1345
- if (!__privateGet$7(this, _namespaces).user)
1346
- __privateGet$7(this, _namespaces).user = new UserApi(__privateGet$7(this, _extraProps));
1347
- return __privateGet$7(this, _namespaces).user;
1388
+ if (!__privateGet$6(this, _namespaces).user)
1389
+ __privateGet$6(this, _namespaces).user = new UserApi(__privateGet$6(this, _extraProps));
1390
+ return __privateGet$6(this, _namespaces).user;
1348
1391
  }
1349
1392
  get authentication() {
1350
- if (!__privateGet$7(this, _namespaces).authentication)
1351
- __privateGet$7(this, _namespaces).authentication = new AuthenticationApi(__privateGet$7(this, _extraProps));
1352
- return __privateGet$7(this, _namespaces).authentication;
1393
+ if (!__privateGet$6(this, _namespaces).authentication)
1394
+ __privateGet$6(this, _namespaces).authentication = new AuthenticationApi(__privateGet$6(this, _extraProps));
1395
+ return __privateGet$6(this, _namespaces).authentication;
1353
1396
  }
1354
1397
  get workspaces() {
1355
- if (!__privateGet$7(this, _namespaces).workspaces)
1356
- __privateGet$7(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$7(this, _extraProps));
1357
- return __privateGet$7(this, _namespaces).workspaces;
1398
+ if (!__privateGet$6(this, _namespaces).workspaces)
1399
+ __privateGet$6(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$6(this, _extraProps));
1400
+ return __privateGet$6(this, _namespaces).workspaces;
1358
1401
  }
1359
1402
  get invites() {
1360
- if (!__privateGet$7(this, _namespaces).invites)
1361
- __privateGet$7(this, _namespaces).invites = new InvitesApi(__privateGet$7(this, _extraProps));
1362
- return __privateGet$7(this, _namespaces).invites;
1403
+ if (!__privateGet$6(this, _namespaces).invites)
1404
+ __privateGet$6(this, _namespaces).invites = new InvitesApi(__privateGet$6(this, _extraProps));
1405
+ return __privateGet$6(this, _namespaces).invites;
1363
1406
  }
1364
1407
  get database() {
1365
- if (!__privateGet$7(this, _namespaces).database)
1366
- __privateGet$7(this, _namespaces).database = new DatabaseApi(__privateGet$7(this, _extraProps));
1367
- return __privateGet$7(this, _namespaces).database;
1408
+ if (!__privateGet$6(this, _namespaces).database)
1409
+ __privateGet$6(this, _namespaces).database = new DatabaseApi(__privateGet$6(this, _extraProps));
1410
+ return __privateGet$6(this, _namespaces).database;
1368
1411
  }
1369
1412
  get branches() {
1370
- if (!__privateGet$7(this, _namespaces).branches)
1371
- __privateGet$7(this, _namespaces).branches = new BranchApi(__privateGet$7(this, _extraProps));
1372
- return __privateGet$7(this, _namespaces).branches;
1413
+ if (!__privateGet$6(this, _namespaces).branches)
1414
+ __privateGet$6(this, _namespaces).branches = new BranchApi(__privateGet$6(this, _extraProps));
1415
+ return __privateGet$6(this, _namespaces).branches;
1373
1416
  }
1374
1417
  get migrations() {
1375
- if (!__privateGet$7(this, _namespaces).migrations)
1376
- __privateGet$7(this, _namespaces).migrations = new MigrationsApi(__privateGet$7(this, _extraProps));
1377
- return __privateGet$7(this, _namespaces).migrations;
1418
+ if (!__privateGet$6(this, _namespaces).migrations)
1419
+ __privateGet$6(this, _namespaces).migrations = new MigrationsApi(__privateGet$6(this, _extraProps));
1420
+ return __privateGet$6(this, _namespaces).migrations;
1378
1421
  }
1379
1422
  get migrationRequests() {
1380
- if (!__privateGet$7(this, _namespaces).migrationRequests)
1381
- __privateGet$7(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$7(this, _extraProps));
1382
- return __privateGet$7(this, _namespaces).migrationRequests;
1423
+ if (!__privateGet$6(this, _namespaces).migrationRequests)
1424
+ __privateGet$6(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$6(this, _extraProps));
1425
+ return __privateGet$6(this, _namespaces).migrationRequests;
1383
1426
  }
1384
1427
  get tables() {
1385
- if (!__privateGet$7(this, _namespaces).tables)
1386
- __privateGet$7(this, _namespaces).tables = new TableApi(__privateGet$7(this, _extraProps));
1387
- return __privateGet$7(this, _namespaces).tables;
1428
+ if (!__privateGet$6(this, _namespaces).tables)
1429
+ __privateGet$6(this, _namespaces).tables = new TableApi(__privateGet$6(this, _extraProps));
1430
+ return __privateGet$6(this, _namespaces).tables;
1388
1431
  }
1389
1432
  get records() {
1390
- if (!__privateGet$7(this, _namespaces).records)
1391
- __privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
1392
- return __privateGet$7(this, _namespaces).records;
1433
+ if (!__privateGet$6(this, _namespaces).records)
1434
+ __privateGet$6(this, _namespaces).records = new RecordsApi(__privateGet$6(this, _extraProps));
1435
+ return __privateGet$6(this, _namespaces).records;
1393
1436
  }
1394
1437
  get files() {
1395
- if (!__privateGet$7(this, _namespaces).files)
1396
- __privateGet$7(this, _namespaces).files = new FilesApi(__privateGet$7(this, _extraProps));
1397
- return __privateGet$7(this, _namespaces).files;
1438
+ if (!__privateGet$6(this, _namespaces).files)
1439
+ __privateGet$6(this, _namespaces).files = new FilesApi(__privateGet$6(this, _extraProps));
1440
+ return __privateGet$6(this, _namespaces).files;
1398
1441
  }
1399
1442
  get searchAndFilter() {
1400
- if (!__privateGet$7(this, _namespaces).searchAndFilter)
1401
- __privateGet$7(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$7(this, _extraProps));
1402
- return __privateGet$7(this, _namespaces).searchAndFilter;
1443
+ if (!__privateGet$6(this, _namespaces).searchAndFilter)
1444
+ __privateGet$6(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$6(this, _extraProps));
1445
+ return __privateGet$6(this, _namespaces).searchAndFilter;
1403
1446
  }
1404
1447
  }
1405
1448
  _extraProps = new WeakMap();
@@ -1701,6 +1744,30 @@ class BranchApi {
1701
1744
  ...this.extraProps
1702
1745
  });
1703
1746
  }
1747
+ pgRollMigrationHistory({
1748
+ workspace,
1749
+ region,
1750
+ database,
1751
+ branch
1752
+ }) {
1753
+ return operationsByTag.branch.pgRollMigrationHistory({
1754
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1755
+ ...this.extraProps
1756
+ });
1757
+ }
1758
+ applyMigration({
1759
+ workspace,
1760
+ region,
1761
+ database,
1762
+ branch,
1763
+ migration
1764
+ }) {
1765
+ return operationsByTag.branch.applyMigration({
1766
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1767
+ body: migration,
1768
+ ...this.extraProps
1769
+ });
1770
+ }
1704
1771
  }
1705
1772
  class TableApi {
1706
1773
  constructor(extraProps) {
@@ -2514,6 +2581,17 @@ class MigrationsApi {
2514
2581
  ...this.extraProps
2515
2582
  });
2516
2583
  }
2584
+ getSchema({
2585
+ workspace,
2586
+ region,
2587
+ database,
2588
+ branch
2589
+ }) {
2590
+ return operationsByTag.migrations.getSchema({
2591
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
2592
+ ...this.extraProps
2593
+ });
2594
+ }
2517
2595
  }
2518
2596
  class DatabaseApi {
2519
2597
  constructor(extraProps) {
@@ -2655,16 +2733,18 @@ function transformImage(url, ...transformations) {
2655
2733
  class XataFile {
2656
2734
  constructor(file) {
2657
2735
  this.id = file.id;
2658
- this.name = file.name || "";
2659
- this.mediaType = file.mediaType || "application/octet-stream";
2736
+ this.name = file.name;
2737
+ this.mediaType = file.mediaType;
2660
2738
  this.base64Content = file.base64Content;
2661
- this.enablePublicUrl = file.enablePublicUrl ?? false;
2662
- this.signedUrlTimeout = file.signedUrlTimeout ?? 300;
2663
- this.size = file.size ?? 0;
2664
- this.version = file.version ?? 1;
2665
- this.url = file.url || "";
2739
+ this.enablePublicUrl = file.enablePublicUrl;
2740
+ this.signedUrlTimeout = file.signedUrlTimeout;
2741
+ this.uploadUrlTimeout = file.uploadUrlTimeout;
2742
+ this.size = file.size;
2743
+ this.version = file.version;
2744
+ this.url = file.url;
2666
2745
  this.signedUrl = file.signedUrl;
2667
- this.attributes = file.attributes || {};
2746
+ this.uploadUrl = file.uploadUrl;
2747
+ this.attributes = file.attributes;
2668
2748
  }
2669
2749
  static fromBuffer(buffer, options = {}) {
2670
2750
  const base64Content = buffer.toString("base64");
@@ -2754,7 +2834,7 @@ class XataFile {
2754
2834
  const parseInputFileEntry = async (entry) => {
2755
2835
  if (!isDefined(entry))
2756
2836
  return null;
2757
- const { id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout } = await entry;
2837
+ const { id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout, uploadUrlTimeout } = await entry;
2758
2838
  return compactObject({
2759
2839
  id,
2760
2840
  // Name cannot be an empty string in our API
@@ -2762,7 +2842,8 @@ const parseInputFileEntry = async (entry) => {
2762
2842
  mediaType,
2763
2843
  base64Content,
2764
2844
  enablePublicUrl,
2765
- signedUrlTimeout
2845
+ signedUrlTimeout,
2846
+ uploadUrlTimeout
2766
2847
  });
2767
2848
  };
2768
2849
 
@@ -2816,7 +2897,7 @@ var __accessCheck$6 = (obj, member, msg) => {
2816
2897
  if (!member.has(obj))
2817
2898
  throw TypeError("Cannot " + msg);
2818
2899
  };
2819
- var __privateGet$6 = (obj, member, getter) => {
2900
+ var __privateGet$5 = (obj, member, getter) => {
2820
2901
  __accessCheck$6(obj, member, "read from private field");
2821
2902
  return getter ? getter.call(obj) : member.get(obj);
2822
2903
  };
@@ -2825,7 +2906,7 @@ var __privateAdd$6 = (obj, member, value) => {
2825
2906
  throw TypeError("Cannot add the same private member more than once");
2826
2907
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
2827
2908
  };
2828
- var __privateSet$6 = (obj, member, value, setter) => {
2909
+ var __privateSet$4 = (obj, member, value, setter) => {
2829
2910
  __accessCheck$6(obj, member, "write to private field");
2830
2911
  setter ? setter.call(obj, value) : member.set(obj, value);
2831
2912
  return value;
@@ -2834,7 +2915,7 @@ var _query, _page;
2834
2915
  class Page {
2835
2916
  constructor(query, meta, records = []) {
2836
2917
  __privateAdd$6(this, _query, void 0);
2837
- __privateSet$6(this, _query, query);
2918
+ __privateSet$4(this, _query, query);
2838
2919
  this.meta = meta;
2839
2920
  this.records = new RecordArray(this, records);
2840
2921
  }
@@ -2845,7 +2926,7 @@ class Page {
2845
2926
  * @returns The next page or results.
2846
2927
  */
2847
2928
  async nextPage(size, offset) {
2848
- return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, after: this.meta.page.cursor } });
2929
+ return __privateGet$5(this, _query).getPaginated({ pagination: { size, offset, after: this.meta.page.cursor } });
2849
2930
  }
2850
2931
  /**
2851
2932
  * Retrieves the previous page of results.
@@ -2854,7 +2935,7 @@ class Page {
2854
2935
  * @returns The previous page or results.
2855
2936
  */
2856
2937
  async previousPage(size, offset) {
2857
- return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, before: this.meta.page.cursor } });
2938
+ return __privateGet$5(this, _query).getPaginated({ pagination: { size, offset, before: this.meta.page.cursor } });
2858
2939
  }
2859
2940
  /**
2860
2941
  * Retrieves the start page of results.
@@ -2863,7 +2944,7 @@ class Page {
2863
2944
  * @returns The start page or results.
2864
2945
  */
2865
2946
  async startPage(size, offset) {
2866
- return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, start: this.meta.page.cursor } });
2947
+ return __privateGet$5(this, _query).getPaginated({ pagination: { size, offset, start: this.meta.page.cursor } });
2867
2948
  }
2868
2949
  /**
2869
2950
  * Retrieves the end page of results.
@@ -2872,7 +2953,7 @@ class Page {
2872
2953
  * @returns The end page or results.
2873
2954
  */
2874
2955
  async endPage(size, offset) {
2875
- return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, end: this.meta.page.cursor } });
2956
+ return __privateGet$5(this, _query).getPaginated({ pagination: { size, offset, end: this.meta.page.cursor } });
2876
2957
  }
2877
2958
  /**
2878
2959
  * Shortcut method to check if there will be additional results if the next page of results is retrieved.
@@ -2894,7 +2975,7 @@ const _RecordArray = class _RecordArray extends Array {
2894
2975
  constructor(...args) {
2895
2976
  super(..._RecordArray.parseConstructorParams(...args));
2896
2977
  __privateAdd$6(this, _page, void 0);
2897
- __privateSet$6(this, _page, isObject(args[0]?.meta) ? args[0] : { meta: { page: { cursor: "", more: false } }, records: [] });
2978
+ __privateSet$4(this, _page, isObject(args[0]?.meta) ? args[0] : { meta: { page: { cursor: "", more: false } }, records: [] });
2898
2979
  }
2899
2980
  static parseConstructorParams(...args) {
2900
2981
  if (args.length === 1 && typeof args[0] === "number") {
@@ -2924,7 +3005,7 @@ const _RecordArray = class _RecordArray extends Array {
2924
3005
  * @returns A new array of objects
2925
3006
  */
2926
3007
  async nextPage(size, offset) {
2927
- const newPage = await __privateGet$6(this, _page).nextPage(size, offset);
3008
+ const newPage = await __privateGet$5(this, _page).nextPage(size, offset);
2928
3009
  return new _RecordArray(newPage);
2929
3010
  }
2930
3011
  /**
@@ -2933,7 +3014,7 @@ const _RecordArray = class _RecordArray extends Array {
2933
3014
  * @returns A new array of objects
2934
3015
  */
2935
3016
  async previousPage(size, offset) {
2936
- const newPage = await __privateGet$6(this, _page).previousPage(size, offset);
3017
+ const newPage = await __privateGet$5(this, _page).previousPage(size, offset);
2937
3018
  return new _RecordArray(newPage);
2938
3019
  }
2939
3020
  /**
@@ -2942,7 +3023,7 @@ const _RecordArray = class _RecordArray extends Array {
2942
3023
  * @returns A new array of objects
2943
3024
  */
2944
3025
  async startPage(size, offset) {
2945
- const newPage = await __privateGet$6(this, _page).startPage(size, offset);
3026
+ const newPage = await __privateGet$5(this, _page).startPage(size, offset);
2946
3027
  return new _RecordArray(newPage);
2947
3028
  }
2948
3029
  /**
@@ -2951,14 +3032,14 @@ const _RecordArray = class _RecordArray extends Array {
2951
3032
  * @returns A new array of objects
2952
3033
  */
2953
3034
  async endPage(size, offset) {
2954
- const newPage = await __privateGet$6(this, _page).endPage(size, offset);
3035
+ const newPage = await __privateGet$5(this, _page).endPage(size, offset);
2955
3036
  return new _RecordArray(newPage);
2956
3037
  }
2957
3038
  /**
2958
3039
  * @returns Boolean indicating if there is a next page
2959
3040
  */
2960
3041
  hasNextPage() {
2961
- return __privateGet$6(this, _page).meta.page.more;
3042
+ return __privateGet$5(this, _page).meta.page.more;
2962
3043
  }
2963
3044
  };
2964
3045
  _page = new WeakMap();
@@ -2968,7 +3049,7 @@ var __accessCheck$5 = (obj, member, msg) => {
2968
3049
  if (!member.has(obj))
2969
3050
  throw TypeError("Cannot " + msg);
2970
3051
  };
2971
- var __privateGet$5 = (obj, member, getter) => {
3052
+ var __privateGet$4 = (obj, member, getter) => {
2972
3053
  __accessCheck$5(obj, member, "read from private field");
2973
3054
  return getter ? getter.call(obj) : member.get(obj);
2974
3055
  };
@@ -2977,7 +3058,7 @@ var __privateAdd$5 = (obj, member, value) => {
2977
3058
  throw TypeError("Cannot add the same private member more than once");
2978
3059
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
2979
3060
  };
2980
- var __privateSet$5 = (obj, member, value, setter) => {
3061
+ var __privateSet$3 = (obj, member, value, setter) => {
2981
3062
  __accessCheck$5(obj, member, "write to private field");
2982
3063
  setter ? setter.call(obj, value) : member.set(obj, value);
2983
3064
  return value;
@@ -2996,24 +3077,24 @@ const _Query = class _Query {
2996
3077
  // Implements pagination
2997
3078
  this.meta = { page: { cursor: "start", more: true, size: PAGINATION_DEFAULT_SIZE } };
2998
3079
  this.records = new RecordArray(this, []);
2999
- __privateSet$5(this, _table$1, table);
3080
+ __privateSet$3(this, _table$1, table);
3000
3081
  if (repository) {
3001
- __privateSet$5(this, _repository, repository);
3082
+ __privateSet$3(this, _repository, repository);
3002
3083
  } else {
3003
- __privateSet$5(this, _repository, this);
3084
+ __privateSet$3(this, _repository, this);
3004
3085
  }
3005
3086
  const parent = cleanParent(data, rawParent);
3006
- __privateGet$5(this, _data).filter = data.filter ?? parent?.filter ?? {};
3007
- __privateGet$5(this, _data).filter.$any = data.filter?.$any ?? parent?.filter?.$any;
3008
- __privateGet$5(this, _data).filter.$all = data.filter?.$all ?? parent?.filter?.$all;
3009
- __privateGet$5(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
3010
- __privateGet$5(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
3011
- __privateGet$5(this, _data).sort = data.sort ?? parent?.sort;
3012
- __privateGet$5(this, _data).columns = data.columns ?? parent?.columns;
3013
- __privateGet$5(this, _data).consistency = data.consistency ?? parent?.consistency;
3014
- __privateGet$5(this, _data).pagination = data.pagination ?? parent?.pagination;
3015
- __privateGet$5(this, _data).cache = data.cache ?? parent?.cache;
3016
- __privateGet$5(this, _data).fetchOptions = data.fetchOptions ?? parent?.fetchOptions;
3087
+ __privateGet$4(this, _data).filter = data.filter ?? parent?.filter ?? {};
3088
+ __privateGet$4(this, _data).filter.$any = data.filter?.$any ?? parent?.filter?.$any;
3089
+ __privateGet$4(this, _data).filter.$all = data.filter?.$all ?? parent?.filter?.$all;
3090
+ __privateGet$4(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
3091
+ __privateGet$4(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
3092
+ __privateGet$4(this, _data).sort = data.sort ?? parent?.sort;
3093
+ __privateGet$4(this, _data).columns = data.columns ?? parent?.columns;
3094
+ __privateGet$4(this, _data).consistency = data.consistency ?? parent?.consistency;
3095
+ __privateGet$4(this, _data).pagination = data.pagination ?? parent?.pagination;
3096
+ __privateGet$4(this, _data).cache = data.cache ?? parent?.cache;
3097
+ __privateGet$4(this, _data).fetchOptions = data.fetchOptions ?? parent?.fetchOptions;
3017
3098
  this.any = this.any.bind(this);
3018
3099
  this.all = this.all.bind(this);
3019
3100
  this.not = this.not.bind(this);
@@ -3024,10 +3105,10 @@ const _Query = class _Query {
3024
3105
  Object.defineProperty(this, "repository", { enumerable: false });
3025
3106
  }
3026
3107
  getQueryOptions() {
3027
- return __privateGet$5(this, _data);
3108
+ return __privateGet$4(this, _data);
3028
3109
  }
3029
3110
  key() {
3030
- const { columns = [], filter = {}, sort = [], pagination = {} } = __privateGet$5(this, _data);
3111
+ const { columns = [], filter = {}, sort = [], pagination = {} } = __privateGet$4(this, _data);
3031
3112
  const key = JSON.stringify({ columns, filter, sort, pagination });
3032
3113
  return toBase64(key);
3033
3114
  }
@@ -3038,7 +3119,7 @@ const _Query = class _Query {
3038
3119
  */
3039
3120
  any(...queries) {
3040
3121
  const $any = queries.map((query) => query.getQueryOptions().filter ?? {});
3041
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $any } }, __privateGet$5(this, _data));
3122
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $any } }, __privateGet$4(this, _data));
3042
3123
  }
3043
3124
  /**
3044
3125
  * Builds a new query object representing a logical AND between the given subqueries.
@@ -3047,7 +3128,7 @@ const _Query = class _Query {
3047
3128
  */
3048
3129
  all(...queries) {
3049
3130
  const $all = queries.map((query) => query.getQueryOptions().filter ?? {});
3050
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
3131
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
3051
3132
  }
3052
3133
  /**
3053
3134
  * Builds a new query object representing a logical OR negating each subquery. In pseudo-code: !q1 OR !q2
@@ -3056,7 +3137,7 @@ const _Query = class _Query {
3056
3137
  */
3057
3138
  not(...queries) {
3058
3139
  const $not = queries.map((query) => query.getQueryOptions().filter ?? {});
3059
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $not } }, __privateGet$5(this, _data));
3140
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $not } }, __privateGet$4(this, _data));
3060
3141
  }
3061
3142
  /**
3062
3143
  * Builds a new query object representing a logical AND negating each subquery. In pseudo-code: !q1 AND !q2
@@ -3065,25 +3146,25 @@ const _Query = class _Query {
3065
3146
  */
3066
3147
  none(...queries) {
3067
3148
  const $none = queries.map((query) => query.getQueryOptions().filter ?? {});
3068
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $none } }, __privateGet$5(this, _data));
3149
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $none } }, __privateGet$4(this, _data));
3069
3150
  }
3070
3151
  filter(a, b) {
3071
3152
  if (arguments.length === 1) {
3072
3153
  const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
3073
3154
  [column]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, column, constraint)
3074
3155
  }));
3075
- const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
3076
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
3156
+ const $all = compact([__privateGet$4(this, _data).filter?.$all].flat().concat(constraints));
3157
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
3077
3158
  } else {
3078
3159
  const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, a, b) }] : void 0;
3079
- const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
3080
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
3160
+ const $all = compact([__privateGet$4(this, _data).filter?.$all].flat().concat(constraints));
3161
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
3081
3162
  }
3082
3163
  }
3083
3164
  sort(column, direction = "asc") {
3084
- const originalSort = [__privateGet$5(this, _data).sort ?? []].flat();
3165
+ const originalSort = [__privateGet$4(this, _data).sort ?? []].flat();
3085
3166
  const sort = [...originalSort, { column, direction }];
3086
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { sort }, __privateGet$5(this, _data));
3167
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { sort }, __privateGet$4(this, _data));
3087
3168
  }
3088
3169
  /**
3089
3170
  * Builds a new query specifying the set of columns to be returned in the query response.
@@ -3092,15 +3173,15 @@ const _Query = class _Query {
3092
3173
  */
3093
3174
  select(columns) {
3094
3175
  return new _Query(
3095
- __privateGet$5(this, _repository),
3096
- __privateGet$5(this, _table$1),
3176
+ __privateGet$4(this, _repository),
3177
+ __privateGet$4(this, _table$1),
3097
3178
  { columns },
3098
- __privateGet$5(this, _data)
3179
+ __privateGet$4(this, _data)
3099
3180
  );
3100
3181
  }
3101
3182
  getPaginated(options = {}) {
3102
- const query = new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), options, __privateGet$5(this, _data));
3103
- return __privateGet$5(this, _repository).query(query);
3183
+ const query = new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), options, __privateGet$4(this, _data));
3184
+ return __privateGet$4(this, _repository).query(query);
3104
3185
  }
3105
3186
  /**
3106
3187
  * Get results in an iterator
@@ -3161,12 +3242,12 @@ const _Query = class _Query {
3161
3242
  async summarize(params = {}) {
3162
3243
  const { summaries, summariesFilter, ...options } = params;
3163
3244
  const query = new _Query(
3164
- __privateGet$5(this, _repository),
3165
- __privateGet$5(this, _table$1),
3245
+ __privateGet$4(this, _repository),
3246
+ __privateGet$4(this, _table$1),
3166
3247
  options,
3167
- __privateGet$5(this, _data)
3248
+ __privateGet$4(this, _data)
3168
3249
  );
3169
- return __privateGet$5(this, _repository).summarizeTable(query, summaries, summariesFilter);
3250
+ return __privateGet$4(this, _repository).summarizeTable(query, summaries, summariesFilter);
3170
3251
  }
3171
3252
  /**
3172
3253
  * Builds a new query object adding a cache TTL in milliseconds.
@@ -3174,7 +3255,7 @@ const _Query = class _Query {
3174
3255
  * @returns A new Query object.
3175
3256
  */
3176
3257
  cache(ttl) {
3177
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
3258
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { cache: ttl }, __privateGet$4(this, _data));
3178
3259
  }
3179
3260
  /**
3180
3261
  * Retrieve next page of records
@@ -3220,7 +3301,7 @@ _repository = new WeakMap();
3220
3301
  _data = new WeakMap();
3221
3302
  _cleanFilterConstraint = new WeakSet();
3222
3303
  cleanFilterConstraint_fn = function(column, value) {
3223
- const columnType = __privateGet$5(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
3304
+ const columnType = __privateGet$4(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
3224
3305
  if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
3225
3306
  return { $includes: value };
3226
3307
  }
@@ -3246,7 +3327,6 @@ const RecordColumnTypes = [
3246
3327
  "email",
3247
3328
  "multiple",
3248
3329
  "link",
3249
- "object",
3250
3330
  "datetime",
3251
3331
  "vector",
3252
3332
  "file[]",
@@ -3311,7 +3391,7 @@ var __accessCheck$4 = (obj, member, msg) => {
3311
3391
  if (!member.has(obj))
3312
3392
  throw TypeError("Cannot " + msg);
3313
3393
  };
3314
- var __privateGet$4 = (obj, member, getter) => {
3394
+ var __privateGet$3 = (obj, member, getter) => {
3315
3395
  __accessCheck$4(obj, member, "read from private field");
3316
3396
  return getter ? getter.call(obj) : member.get(obj);
3317
3397
  };
@@ -3320,7 +3400,7 @@ var __privateAdd$4 = (obj, member, value) => {
3320
3400
  throw TypeError("Cannot add the same private member more than once");
3321
3401
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
3322
3402
  };
3323
- var __privateSet$4 = (obj, member, value, setter) => {
3403
+ var __privateSet$2 = (obj, member, value, setter) => {
3324
3404
  __accessCheck$4(obj, member, "write to private field");
3325
3405
  setter ? setter.call(obj, value) : member.set(obj, value);
3326
3406
  return value;
@@ -3329,7 +3409,7 @@ var __privateMethod$2 = (obj, member, method) => {
3329
3409
  __accessCheck$4(obj, member, "access private method");
3330
3410
  return method;
3331
3411
  };
3332
- var _table, _getFetchProps, _db, _cache, _schemaTables$2, _trace, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn, _insertRecords, insertRecords_fn, _updateRecordWithID, updateRecordWithID_fn, _updateRecords, updateRecords_fn, _upsertRecordWithID, upsertRecordWithID_fn, _deleteRecord, deleteRecord_fn, _deleteRecords, deleteRecords_fn, _setCacheQuery, setCacheQuery_fn, _getCacheQuery, getCacheQuery_fn, _getSchemaTables$1, getSchemaTables_fn$1, _transformObjectToApi, transformObjectToApi_fn;
3412
+ var _table, _getFetchProps, _db, _cache, _schemaTables, _trace, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn, _insertRecords, insertRecords_fn, _updateRecordWithID, updateRecordWithID_fn, _updateRecords, updateRecords_fn, _upsertRecordWithID, upsertRecordWithID_fn, _deleteRecord, deleteRecord_fn, _deleteRecords, deleteRecords_fn, _setCacheQuery, setCacheQuery_fn, _getCacheQuery, getCacheQuery_fn, _getSchemaTables, getSchemaTables_fn, _transformObjectToApi, transformObjectToApi_fn;
3333
3413
  const BULK_OPERATION_MAX_SIZE = 1e3;
3334
3414
  class Repository extends Query {
3335
3415
  }
@@ -3350,31 +3430,31 @@ class RestRepository extends Query {
3350
3430
  __privateAdd$4(this, _deleteRecords);
3351
3431
  __privateAdd$4(this, _setCacheQuery);
3352
3432
  __privateAdd$4(this, _getCacheQuery);
3353
- __privateAdd$4(this, _getSchemaTables$1);
3433
+ __privateAdd$4(this, _getSchemaTables);
3354
3434
  __privateAdd$4(this, _transformObjectToApi);
3355
3435
  __privateAdd$4(this, _table, void 0);
3356
3436
  __privateAdd$4(this, _getFetchProps, void 0);
3357
3437
  __privateAdd$4(this, _db, void 0);
3358
3438
  __privateAdd$4(this, _cache, void 0);
3359
- __privateAdd$4(this, _schemaTables$2, void 0);
3439
+ __privateAdd$4(this, _schemaTables, void 0);
3360
3440
  __privateAdd$4(this, _trace, void 0);
3361
- __privateSet$4(this, _table, options.table);
3362
- __privateSet$4(this, _db, options.db);
3363
- __privateSet$4(this, _cache, options.pluginOptions.cache);
3364
- __privateSet$4(this, _schemaTables$2, options.schemaTables);
3365
- __privateSet$4(this, _getFetchProps, () => ({ ...options.pluginOptions, sessionID: generateUUID() }));
3441
+ __privateSet$2(this, _table, options.table);
3442
+ __privateSet$2(this, _db, options.db);
3443
+ __privateSet$2(this, _cache, options.pluginOptions.cache);
3444
+ __privateSet$2(this, _schemaTables, options.schemaTables);
3445
+ __privateSet$2(this, _getFetchProps, () => ({ ...options.pluginOptions, sessionID: generateUUID() }));
3366
3446
  const trace = options.pluginOptions.trace ?? defaultTrace;
3367
- __privateSet$4(this, _trace, async (name, fn, options2 = {}) => {
3447
+ __privateSet$2(this, _trace, async (name, fn, options2 = {}) => {
3368
3448
  return trace(name, fn, {
3369
3449
  ...options2,
3370
- [TraceAttributes.TABLE]: __privateGet$4(this, _table),
3450
+ [TraceAttributes.TABLE]: __privateGet$3(this, _table),
3371
3451
  [TraceAttributes.KIND]: "sdk-operation",
3372
3452
  [TraceAttributes.VERSION]: VERSION
3373
3453
  });
3374
3454
  });
3375
3455
  }
3376
3456
  async create(a, b, c, d) {
3377
- return __privateGet$4(this, _trace).call(this, "create", async () => {
3457
+ return __privateGet$3(this, _trace).call(this, "create", async () => {
3378
3458
  const ifVersion = parseIfVersion(b, c, d);
3379
3459
  if (Array.isArray(a)) {
3380
3460
  if (a.length === 0)
@@ -3404,7 +3484,7 @@ class RestRepository extends Query {
3404
3484
  });
3405
3485
  }
3406
3486
  async read(a, b) {
3407
- return __privateGet$4(this, _trace).call(this, "read", async () => {
3487
+ return __privateGet$3(this, _trace).call(this, "read", async () => {
3408
3488
  const columns = isValidSelectableColumns(b) ? b : ["*"];
3409
3489
  if (Array.isArray(a)) {
3410
3490
  if (a.length === 0)
@@ -3425,17 +3505,17 @@ class RestRepository extends Query {
3425
3505
  workspace: "{workspaceId}",
3426
3506
  dbBranchName: "{dbBranch}",
3427
3507
  region: "{region}",
3428
- tableName: __privateGet$4(this, _table),
3508
+ tableName: __privateGet$3(this, _table),
3429
3509
  recordId: id
3430
3510
  },
3431
3511
  queryParams: { columns },
3432
- ...__privateGet$4(this, _getFetchProps).call(this)
3512
+ ...__privateGet$3(this, _getFetchProps).call(this)
3433
3513
  });
3434
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3514
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3435
3515
  return initObject(
3436
- __privateGet$4(this, _db),
3516
+ __privateGet$3(this, _db),
3437
3517
  schemaTables,
3438
- __privateGet$4(this, _table),
3518
+ __privateGet$3(this, _table),
3439
3519
  response,
3440
3520
  columns
3441
3521
  );
@@ -3450,7 +3530,7 @@ class RestRepository extends Query {
3450
3530
  });
3451
3531
  }
3452
3532
  async readOrThrow(a, b) {
3453
- return __privateGet$4(this, _trace).call(this, "readOrThrow", async () => {
3533
+ return __privateGet$3(this, _trace).call(this, "readOrThrow", async () => {
3454
3534
  const result = await this.read(a, b);
3455
3535
  if (Array.isArray(result)) {
3456
3536
  const missingIds = compact(
@@ -3469,7 +3549,7 @@ class RestRepository extends Query {
3469
3549
  });
3470
3550
  }
3471
3551
  async update(a, b, c, d) {
3472
- return __privateGet$4(this, _trace).call(this, "update", async () => {
3552
+ return __privateGet$3(this, _trace).call(this, "update", async () => {
3473
3553
  const ifVersion = parseIfVersion(b, c, d);
3474
3554
  if (Array.isArray(a)) {
3475
3555
  if (a.length === 0)
@@ -3502,7 +3582,7 @@ class RestRepository extends Query {
3502
3582
  });
3503
3583
  }
3504
3584
  async updateOrThrow(a, b, c, d) {
3505
- return __privateGet$4(this, _trace).call(this, "updateOrThrow", async () => {
3585
+ return __privateGet$3(this, _trace).call(this, "updateOrThrow", async () => {
3506
3586
  const result = await this.update(a, b, c, d);
3507
3587
  if (Array.isArray(result)) {
3508
3588
  const missingIds = compact(
@@ -3521,7 +3601,7 @@ class RestRepository extends Query {
3521
3601
  });
3522
3602
  }
3523
3603
  async createOrUpdate(a, b, c, d) {
3524
- return __privateGet$4(this, _trace).call(this, "createOrUpdate", async () => {
3604
+ return __privateGet$3(this, _trace).call(this, "createOrUpdate", async () => {
3525
3605
  const ifVersion = parseIfVersion(b, c, d);
3526
3606
  if (Array.isArray(a)) {
3527
3607
  if (a.length === 0)
@@ -3556,7 +3636,7 @@ class RestRepository extends Query {
3556
3636
  });
3557
3637
  }
3558
3638
  async createOrReplace(a, b, c, d) {
3559
- return __privateGet$4(this, _trace).call(this, "createOrReplace", async () => {
3639
+ return __privateGet$3(this, _trace).call(this, "createOrReplace", async () => {
3560
3640
  const ifVersion = parseIfVersion(b, c, d);
3561
3641
  if (Array.isArray(a)) {
3562
3642
  if (a.length === 0)
@@ -3588,7 +3668,7 @@ class RestRepository extends Query {
3588
3668
  });
3589
3669
  }
3590
3670
  async delete(a, b) {
3591
- return __privateGet$4(this, _trace).call(this, "delete", async () => {
3671
+ return __privateGet$3(this, _trace).call(this, "delete", async () => {
3592
3672
  if (Array.isArray(a)) {
3593
3673
  if (a.length === 0)
3594
3674
  return [];
@@ -3614,7 +3694,7 @@ class RestRepository extends Query {
3614
3694
  });
3615
3695
  }
3616
3696
  async deleteOrThrow(a, b) {
3617
- return __privateGet$4(this, _trace).call(this, "deleteOrThrow", async () => {
3697
+ return __privateGet$3(this, _trace).call(this, "deleteOrThrow", async () => {
3618
3698
  const result = await this.delete(a, b);
3619
3699
  if (Array.isArray(result)) {
3620
3700
  const missingIds = compact(
@@ -3632,13 +3712,13 @@ class RestRepository extends Query {
3632
3712
  });
3633
3713
  }
3634
3714
  async search(query, options = {}) {
3635
- return __privateGet$4(this, _trace).call(this, "search", async () => {
3636
- const { records } = await searchTable({
3715
+ return __privateGet$3(this, _trace).call(this, "search", async () => {
3716
+ const { records, totalCount } = await searchTable({
3637
3717
  pathParams: {
3638
3718
  workspace: "{workspaceId}",
3639
3719
  dbBranchName: "{dbBranch}",
3640
3720
  region: "{region}",
3641
- tableName: __privateGet$4(this, _table)
3721
+ tableName: __privateGet$3(this, _table)
3642
3722
  },
3643
3723
  body: {
3644
3724
  query,
@@ -3650,20 +3730,23 @@ class RestRepository extends Query {
3650
3730
  page: options.page,
3651
3731
  target: options.target
3652
3732
  },
3653
- ...__privateGet$4(this, _getFetchProps).call(this)
3733
+ ...__privateGet$3(this, _getFetchProps).call(this)
3654
3734
  });
3655
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3656
- return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
3735
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3736
+ return {
3737
+ records: records.map((item) => initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), item, ["*"])),
3738
+ totalCount
3739
+ };
3657
3740
  });
3658
3741
  }
3659
3742
  async vectorSearch(column, query, options) {
3660
- return __privateGet$4(this, _trace).call(this, "vectorSearch", async () => {
3661
- const { records } = await vectorSearchTable({
3743
+ return __privateGet$3(this, _trace).call(this, "vectorSearch", async () => {
3744
+ const { records, totalCount } = await vectorSearchTable({
3662
3745
  pathParams: {
3663
3746
  workspace: "{workspaceId}",
3664
3747
  dbBranchName: "{dbBranch}",
3665
3748
  region: "{region}",
3666
- tableName: __privateGet$4(this, _table)
3749
+ tableName: __privateGet$3(this, _table)
3667
3750
  },
3668
3751
  body: {
3669
3752
  column,
@@ -3672,29 +3755,32 @@ class RestRepository extends Query {
3672
3755
  size: options?.size,
3673
3756
  filter: options?.filter
3674
3757
  },
3675
- ...__privateGet$4(this, _getFetchProps).call(this)
3758
+ ...__privateGet$3(this, _getFetchProps).call(this)
3676
3759
  });
3677
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3678
- return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
3760
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3761
+ return {
3762
+ records: records.map((item) => initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), item, ["*"])),
3763
+ totalCount
3764
+ };
3679
3765
  });
3680
3766
  }
3681
3767
  async aggregate(aggs, filter) {
3682
- return __privateGet$4(this, _trace).call(this, "aggregate", async () => {
3768
+ return __privateGet$3(this, _trace).call(this, "aggregate", async () => {
3683
3769
  const result = await aggregateTable({
3684
3770
  pathParams: {
3685
3771
  workspace: "{workspaceId}",
3686
3772
  dbBranchName: "{dbBranch}",
3687
3773
  region: "{region}",
3688
- tableName: __privateGet$4(this, _table)
3774
+ tableName: __privateGet$3(this, _table)
3689
3775
  },
3690
3776
  body: { aggs, filter },
3691
- ...__privateGet$4(this, _getFetchProps).call(this)
3777
+ ...__privateGet$3(this, _getFetchProps).call(this)
3692
3778
  });
3693
3779
  return result;
3694
3780
  });
3695
3781
  }
3696
3782
  async query(query) {
3697
- return __privateGet$4(this, _trace).call(this, "query", async () => {
3783
+ return __privateGet$3(this, _trace).call(this, "query", async () => {
3698
3784
  const cacheQuery = await __privateMethod$2(this, _getCacheQuery, getCacheQuery_fn).call(this, query);
3699
3785
  if (cacheQuery)
3700
3786
  return new Page(query, cacheQuery.meta, cacheQuery.records);
@@ -3704,7 +3790,7 @@ class RestRepository extends Query {
3704
3790
  workspace: "{workspaceId}",
3705
3791
  dbBranchName: "{dbBranch}",
3706
3792
  region: "{region}",
3707
- tableName: __privateGet$4(this, _table)
3793
+ tableName: __privateGet$3(this, _table)
3708
3794
  },
3709
3795
  body: {
3710
3796
  filter: cleanFilter(data.filter),
@@ -3714,14 +3800,14 @@ class RestRepository extends Query {
3714
3800
  consistency: data.consistency
3715
3801
  },
3716
3802
  fetchOptions: data.fetchOptions,
3717
- ...__privateGet$4(this, _getFetchProps).call(this)
3803
+ ...__privateGet$3(this, _getFetchProps).call(this)
3718
3804
  });
3719
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3805
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3720
3806
  const records = objects.map(
3721
3807
  (record) => initObject(
3722
- __privateGet$4(this, _db),
3808
+ __privateGet$3(this, _db),
3723
3809
  schemaTables,
3724
- __privateGet$4(this, _table),
3810
+ __privateGet$3(this, _table),
3725
3811
  record,
3726
3812
  data.columns ?? ["*"]
3727
3813
  )
@@ -3731,14 +3817,14 @@ class RestRepository extends Query {
3731
3817
  });
3732
3818
  }
3733
3819
  async summarizeTable(query, summaries, summariesFilter) {
3734
- return __privateGet$4(this, _trace).call(this, "summarize", async () => {
3820
+ return __privateGet$3(this, _trace).call(this, "summarize", async () => {
3735
3821
  const data = query.getQueryOptions();
3736
3822
  const result = await summarizeTable({
3737
3823
  pathParams: {
3738
3824
  workspace: "{workspaceId}",
3739
3825
  dbBranchName: "{dbBranch}",
3740
3826
  region: "{region}",
3741
- tableName: __privateGet$4(this, _table)
3827
+ tableName: __privateGet$3(this, _table)
3742
3828
  },
3743
3829
  body: {
3744
3830
  filter: cleanFilter(data.filter),
@@ -3749,13 +3835,13 @@ class RestRepository extends Query {
3749
3835
  summaries,
3750
3836
  summariesFilter
3751
3837
  },
3752
- ...__privateGet$4(this, _getFetchProps).call(this)
3838
+ ...__privateGet$3(this, _getFetchProps).call(this)
3753
3839
  });
3754
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3840
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3755
3841
  return {
3756
3842
  ...result,
3757
3843
  summaries: result.summaries.map(
3758
- (summary) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), summary, data.columns ?? [])
3844
+ (summary) => initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), summary, data.columns ?? [])
3759
3845
  )
3760
3846
  };
3761
3847
  });
@@ -3767,7 +3853,7 @@ class RestRepository extends Query {
3767
3853
  workspace: "{workspaceId}",
3768
3854
  dbBranchName: "{dbBranch}",
3769
3855
  region: "{region}",
3770
- tableName: __privateGet$4(this, _table),
3856
+ tableName: __privateGet$3(this, _table),
3771
3857
  sessionId: options?.sessionId
3772
3858
  },
3773
3859
  body: {
@@ -3777,7 +3863,7 @@ class RestRepository extends Query {
3777
3863
  search: options?.searchType === "keyword" ? options?.search : void 0,
3778
3864
  vectorSearch: options?.searchType === "vector" ? options?.vectorSearch : void 0
3779
3865
  },
3780
- ...__privateGet$4(this, _getFetchProps).call(this)
3866
+ ...__privateGet$3(this, _getFetchProps).call(this)
3781
3867
  };
3782
3868
  if (options?.onMessage) {
3783
3869
  fetchSSERequest({
@@ -3798,7 +3884,7 @@ _table = new WeakMap();
3798
3884
  _getFetchProps = new WeakMap();
3799
3885
  _db = new WeakMap();
3800
3886
  _cache = new WeakMap();
3801
- _schemaTables$2 = new WeakMap();
3887
+ _schemaTables = new WeakMap();
3802
3888
  _trace = new WeakMap();
3803
3889
  _insertRecordWithoutId = new WeakSet();
3804
3890
  insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
@@ -3808,14 +3894,14 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
3808
3894
  workspace: "{workspaceId}",
3809
3895
  dbBranchName: "{dbBranch}",
3810
3896
  region: "{region}",
3811
- tableName: __privateGet$4(this, _table)
3897
+ tableName: __privateGet$3(this, _table)
3812
3898
  },
3813
3899
  queryParams: { columns },
3814
3900
  body: record,
3815
- ...__privateGet$4(this, _getFetchProps).call(this)
3901
+ ...__privateGet$3(this, _getFetchProps).call(this)
3816
3902
  });
3817
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3818
- return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
3903
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3904
+ return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
3819
3905
  };
3820
3906
  _insertRecordWithId = new WeakSet();
3821
3907
  insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
@@ -3827,21 +3913,21 @@ insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { crea
3827
3913
  workspace: "{workspaceId}",
3828
3914
  dbBranchName: "{dbBranch}",
3829
3915
  region: "{region}",
3830
- tableName: __privateGet$4(this, _table),
3916
+ tableName: __privateGet$3(this, _table),
3831
3917
  recordId
3832
3918
  },
3833
3919
  body: record,
3834
3920
  queryParams: { createOnly, columns, ifVersion },
3835
- ...__privateGet$4(this, _getFetchProps).call(this)
3921
+ ...__privateGet$3(this, _getFetchProps).call(this)
3836
3922
  });
3837
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3838
- return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
3923
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3924
+ return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
3839
3925
  };
3840
3926
  _insertRecords = new WeakSet();
3841
3927
  insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
3842
3928
  const operations = await promiseMap(objects, async (object) => {
3843
3929
  const record = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
3844
- return { insert: { table: __privateGet$4(this, _table), record, createOnly, ifVersion } };
3930
+ return { insert: { table: __privateGet$3(this, _table), record, createOnly, ifVersion } };
3845
3931
  });
3846
3932
  const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
3847
3933
  const ids = [];
@@ -3853,7 +3939,7 @@ insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
3853
3939
  region: "{region}"
3854
3940
  },
3855
3941
  body: { operations: operations2 },
3856
- ...__privateGet$4(this, _getFetchProps).call(this)
3942
+ ...__privateGet$3(this, _getFetchProps).call(this)
3857
3943
  });
3858
3944
  for (const result of results) {
3859
3945
  if (result.operation === "insert") {
@@ -3876,15 +3962,15 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
3876
3962
  workspace: "{workspaceId}",
3877
3963
  dbBranchName: "{dbBranch}",
3878
3964
  region: "{region}",
3879
- tableName: __privateGet$4(this, _table),
3965
+ tableName: __privateGet$3(this, _table),
3880
3966
  recordId
3881
3967
  },
3882
3968
  queryParams: { columns, ifVersion },
3883
3969
  body: record,
3884
- ...__privateGet$4(this, _getFetchProps).call(this)
3970
+ ...__privateGet$3(this, _getFetchProps).call(this)
3885
3971
  });
3886
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3887
- return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
3972
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3973
+ return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
3888
3974
  } catch (e) {
3889
3975
  if (isObject(e) && e.status === 404) {
3890
3976
  return null;
@@ -3896,7 +3982,7 @@ _updateRecords = new WeakSet();
3896
3982
  updateRecords_fn = async function(objects, { ifVersion, upsert }) {
3897
3983
  const operations = await promiseMap(objects, async ({ id, ...object }) => {
3898
3984
  const fields = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
3899
- return { update: { table: __privateGet$4(this, _table), id, ifVersion, upsert, fields } };
3985
+ return { update: { table: __privateGet$3(this, _table), id, ifVersion, upsert, fields } };
3900
3986
  });
3901
3987
  const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
3902
3988
  const ids = [];
@@ -3908,7 +3994,7 @@ updateRecords_fn = async function(objects, { ifVersion, upsert }) {
3908
3994
  region: "{region}"
3909
3995
  },
3910
3996
  body: { operations: operations2 },
3911
- ...__privateGet$4(this, _getFetchProps).call(this)
3997
+ ...__privateGet$3(this, _getFetchProps).call(this)
3912
3998
  });
3913
3999
  for (const result of results) {
3914
4000
  if (result.operation === "update") {
@@ -3929,15 +4015,15 @@ upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
3929
4015
  workspace: "{workspaceId}",
3930
4016
  dbBranchName: "{dbBranch}",
3931
4017
  region: "{region}",
3932
- tableName: __privateGet$4(this, _table),
4018
+ tableName: __privateGet$3(this, _table),
3933
4019
  recordId
3934
4020
  },
3935
4021
  queryParams: { columns, ifVersion },
3936
4022
  body: object,
3937
- ...__privateGet$4(this, _getFetchProps).call(this)
4023
+ ...__privateGet$3(this, _getFetchProps).call(this)
3938
4024
  });
3939
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3940
- return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
4025
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
4026
+ return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
3941
4027
  };
3942
4028
  _deleteRecord = new WeakSet();
3943
4029
  deleteRecord_fn = async function(recordId, columns = ["*"]) {
@@ -3949,14 +4035,14 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
3949
4035
  workspace: "{workspaceId}",
3950
4036
  dbBranchName: "{dbBranch}",
3951
4037
  region: "{region}",
3952
- tableName: __privateGet$4(this, _table),
4038
+ tableName: __privateGet$3(this, _table),
3953
4039
  recordId
3954
4040
  },
3955
4041
  queryParams: { columns },
3956
- ...__privateGet$4(this, _getFetchProps).call(this)
4042
+ ...__privateGet$3(this, _getFetchProps).call(this)
3957
4043
  });
3958
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3959
- return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
4044
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
4045
+ return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
3960
4046
  } catch (e) {
3961
4047
  if (isObject(e) && e.status === 404) {
3962
4048
  return null;
@@ -3967,7 +4053,7 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
3967
4053
  _deleteRecords = new WeakSet();
3968
4054
  deleteRecords_fn = async function(recordIds) {
3969
4055
  const chunkedOperations = chunk(
3970
- compact(recordIds).map((id) => ({ delete: { table: __privateGet$4(this, _table), id } })),
4056
+ compact(recordIds).map((id) => ({ delete: { table: __privateGet$3(this, _table), id } })),
3971
4057
  BULK_OPERATION_MAX_SIZE
3972
4058
  );
3973
4059
  for (const operations of chunkedOperations) {
@@ -3978,44 +4064,44 @@ deleteRecords_fn = async function(recordIds) {
3978
4064
  region: "{region}"
3979
4065
  },
3980
4066
  body: { operations },
3981
- ...__privateGet$4(this, _getFetchProps).call(this)
4067
+ ...__privateGet$3(this, _getFetchProps).call(this)
3982
4068
  });
3983
4069
  }
3984
4070
  };
3985
4071
  _setCacheQuery = new WeakSet();
3986
4072
  setCacheQuery_fn = async function(query, meta, records) {
3987
- await __privateGet$4(this, _cache)?.set(`query_${__privateGet$4(this, _table)}:${query.key()}`, { date: /* @__PURE__ */ new Date(), meta, records });
4073
+ await __privateGet$3(this, _cache)?.set(`query_${__privateGet$3(this, _table)}:${query.key()}`, { date: /* @__PURE__ */ new Date(), meta, records });
3988
4074
  };
3989
4075
  _getCacheQuery = new WeakSet();
3990
4076
  getCacheQuery_fn = async function(query) {
3991
- const key = `query_${__privateGet$4(this, _table)}:${query.key()}`;
3992
- const result = await __privateGet$4(this, _cache)?.get(key);
4077
+ const key = `query_${__privateGet$3(this, _table)}:${query.key()}`;
4078
+ const result = await __privateGet$3(this, _cache)?.get(key);
3993
4079
  if (!result)
3994
4080
  return null;
3995
- const defaultTTL = __privateGet$4(this, _cache)?.defaultQueryTTL ?? -1;
4081
+ const defaultTTL = __privateGet$3(this, _cache)?.defaultQueryTTL ?? -1;
3996
4082
  const { cache: ttl = defaultTTL } = query.getQueryOptions();
3997
4083
  if (ttl < 0)
3998
4084
  return null;
3999
4085
  const hasExpired = result.date.getTime() + ttl < Date.now();
4000
4086
  return hasExpired ? null : result;
4001
4087
  };
4002
- _getSchemaTables$1 = new WeakSet();
4003
- getSchemaTables_fn$1 = async function() {
4004
- if (__privateGet$4(this, _schemaTables$2))
4005
- return __privateGet$4(this, _schemaTables$2);
4088
+ _getSchemaTables = new WeakSet();
4089
+ getSchemaTables_fn = async function() {
4090
+ if (__privateGet$3(this, _schemaTables))
4091
+ return __privateGet$3(this, _schemaTables);
4006
4092
  const { schema } = await getBranchDetails({
4007
4093
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4008
- ...__privateGet$4(this, _getFetchProps).call(this)
4094
+ ...__privateGet$3(this, _getFetchProps).call(this)
4009
4095
  });
4010
- __privateSet$4(this, _schemaTables$2, schema.tables);
4096
+ __privateSet$2(this, _schemaTables, schema.tables);
4011
4097
  return schema.tables;
4012
4098
  };
4013
4099
  _transformObjectToApi = new WeakSet();
4014
4100
  transformObjectToApi_fn = async function(object) {
4015
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
4016
- const schema = schemaTables.find((table) => table.name === __privateGet$4(this, _table));
4101
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
4102
+ const schema = schemaTables.find((table) => table.name === __privateGet$3(this, _table));
4017
4103
  if (!schema)
4018
- throw new Error(`Table ${__privateGet$4(this, _table)} not found in schema`);
4104
+ throw new Error(`Table ${__privateGet$3(this, _table)} not found in schema`);
4019
4105
  const result = {};
4020
4106
  for (const [key, value] of Object.entries(object)) {
4021
4107
  if (key === "xata")
@@ -4171,7 +4257,7 @@ var __accessCheck$3 = (obj, member, msg) => {
4171
4257
  if (!member.has(obj))
4172
4258
  throw TypeError("Cannot " + msg);
4173
4259
  };
4174
- var __privateGet$3 = (obj, member, getter) => {
4260
+ var __privateGet$2 = (obj, member, getter) => {
4175
4261
  __accessCheck$3(obj, member, "read from private field");
4176
4262
  return getter ? getter.call(obj) : member.get(obj);
4177
4263
  };
@@ -4180,7 +4266,7 @@ var __privateAdd$3 = (obj, member, value) => {
4180
4266
  throw TypeError("Cannot add the same private member more than once");
4181
4267
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
4182
4268
  };
4183
- var __privateSet$3 = (obj, member, value, setter) => {
4269
+ var __privateSet$1 = (obj, member, value, setter) => {
4184
4270
  __accessCheck$3(obj, member, "write to private field");
4185
4271
  setter ? setter.call(obj, value) : member.set(obj, value);
4186
4272
  return value;
@@ -4189,29 +4275,29 @@ var _map;
4189
4275
  class SimpleCache {
4190
4276
  constructor(options = {}) {
4191
4277
  __privateAdd$3(this, _map, void 0);
4192
- __privateSet$3(this, _map, /* @__PURE__ */ new Map());
4278
+ __privateSet$1(this, _map, /* @__PURE__ */ new Map());
4193
4279
  this.capacity = options.max ?? 500;
4194
4280
  this.defaultQueryTTL = options.defaultQueryTTL ?? 60 * 1e3;
4195
4281
  }
4196
4282
  async getAll() {
4197
- return Object.fromEntries(__privateGet$3(this, _map));
4283
+ return Object.fromEntries(__privateGet$2(this, _map));
4198
4284
  }
4199
4285
  async get(key) {
4200
- return __privateGet$3(this, _map).get(key) ?? null;
4286
+ return __privateGet$2(this, _map).get(key) ?? null;
4201
4287
  }
4202
4288
  async set(key, value) {
4203
4289
  await this.delete(key);
4204
- __privateGet$3(this, _map).set(key, value);
4205
- if (__privateGet$3(this, _map).size > this.capacity) {
4206
- const leastRecentlyUsed = __privateGet$3(this, _map).keys().next().value;
4290
+ __privateGet$2(this, _map).set(key, value);
4291
+ if (__privateGet$2(this, _map).size > this.capacity) {
4292
+ const leastRecentlyUsed = __privateGet$2(this, _map).keys().next().value;
4207
4293
  await this.delete(leastRecentlyUsed);
4208
4294
  }
4209
4295
  }
4210
4296
  async delete(key) {
4211
- __privateGet$3(this, _map).delete(key);
4297
+ __privateGet$2(this, _map).delete(key);
4212
4298
  }
4213
4299
  async clear() {
4214
- return __privateGet$3(this, _map).clear();
4300
+ return __privateGet$2(this, _map).clear();
4215
4301
  }
4216
4302
  }
4217
4303
  _map = new WeakMap();
@@ -4248,7 +4334,7 @@ var __accessCheck$2 = (obj, member, msg) => {
4248
4334
  if (!member.has(obj))
4249
4335
  throw TypeError("Cannot " + msg);
4250
4336
  };
4251
- var __privateGet$2 = (obj, member, getter) => {
4337
+ var __privateGet$1 = (obj, member, getter) => {
4252
4338
  __accessCheck$2(obj, member, "read from private field");
4253
4339
  return getter ? getter.call(obj) : member.get(obj);
4254
4340
  };
@@ -4257,18 +4343,11 @@ var __privateAdd$2 = (obj, member, value) => {
4257
4343
  throw TypeError("Cannot add the same private member more than once");
4258
4344
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
4259
4345
  };
4260
- var __privateSet$2 = (obj, member, value, setter) => {
4261
- __accessCheck$2(obj, member, "write to private field");
4262
- setter ? setter.call(obj, value) : member.set(obj, value);
4263
- return value;
4264
- };
4265
- var _tables, _schemaTables$1;
4346
+ var _tables;
4266
4347
  class SchemaPlugin extends XataPlugin {
4267
- constructor(schemaTables) {
4348
+ constructor() {
4268
4349
  super();
4269
4350
  __privateAdd$2(this, _tables, {});
4270
- __privateAdd$2(this, _schemaTables$1, void 0);
4271
- __privateSet$2(this, _schemaTables$1, schemaTables);
4272
4351
  }
4273
4352
  build(pluginOptions) {
4274
4353
  const db = new Proxy(
@@ -4277,22 +4356,21 @@ class SchemaPlugin extends XataPlugin {
4277
4356
  get: (_target, table) => {
4278
4357
  if (!isString(table))
4279
4358
  throw new Error("Invalid table name");
4280
- if (__privateGet$2(this, _tables)[table] === void 0) {
4281
- __privateGet$2(this, _tables)[table] = new RestRepository({ db, pluginOptions, table, schemaTables: __privateGet$2(this, _schemaTables$1) });
4359
+ if (__privateGet$1(this, _tables)[table] === void 0) {
4360
+ __privateGet$1(this, _tables)[table] = new RestRepository({ db, pluginOptions, table, schemaTables: pluginOptions.tables });
4282
4361
  }
4283
- return __privateGet$2(this, _tables)[table];
4362
+ return __privateGet$1(this, _tables)[table];
4284
4363
  }
4285
4364
  }
4286
4365
  );
4287
- const tableNames = __privateGet$2(this, _schemaTables$1)?.map(({ name }) => name) ?? [];
4366
+ const tableNames = pluginOptions.tables?.map(({ name }) => name) ?? [];
4288
4367
  for (const table of tableNames) {
4289
- db[table] = new RestRepository({ db, pluginOptions, table, schemaTables: __privateGet$2(this, _schemaTables$1) });
4368
+ db[table] = new RestRepository({ db, pluginOptions, table, schemaTables: pluginOptions.tables });
4290
4369
  }
4291
4370
  return db;
4292
4371
  }
4293
4372
  }
4294
4373
  _tables = new WeakMap();
4295
- _schemaTables$1 = new WeakMap();
4296
4374
 
4297
4375
  class FilesPlugin extends XataPlugin {
4298
4376
  build(pluginOptions) {
@@ -4355,7 +4433,7 @@ function getContentType(file) {
4355
4433
  if (typeof file === "string") {
4356
4434
  return "text/plain";
4357
4435
  }
4358
- if ("mediaType" in file) {
4436
+ if ("mediaType" in file && file.mediaType !== void 0) {
4359
4437
  return file.mediaType;
4360
4438
  }
4361
4439
  if (isBlob(file)) {
@@ -4372,79 +4450,57 @@ var __accessCheck$1 = (obj, member, msg) => {
4372
4450
  if (!member.has(obj))
4373
4451
  throw TypeError("Cannot " + msg);
4374
4452
  };
4375
- var __privateGet$1 = (obj, member, getter) => {
4376
- __accessCheck$1(obj, member, "read from private field");
4377
- return getter ? getter.call(obj) : member.get(obj);
4378
- };
4379
4453
  var __privateAdd$1 = (obj, member, value) => {
4380
4454
  if (member.has(obj))
4381
4455
  throw TypeError("Cannot add the same private member more than once");
4382
4456
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
4383
4457
  };
4384
- var __privateSet$1 = (obj, member, value, setter) => {
4385
- __accessCheck$1(obj, member, "write to private field");
4386
- setter ? setter.call(obj, value) : member.set(obj, value);
4387
- return value;
4388
- };
4389
4458
  var __privateMethod$1 = (obj, member, method) => {
4390
4459
  __accessCheck$1(obj, member, "access private method");
4391
4460
  return method;
4392
4461
  };
4393
- var _schemaTables, _search, search_fn, _getSchemaTables, getSchemaTables_fn;
4462
+ var _search, search_fn;
4394
4463
  class SearchPlugin extends XataPlugin {
4395
- constructor(db, schemaTables) {
4464
+ constructor(db) {
4396
4465
  super();
4397
4466
  this.db = db;
4398
4467
  __privateAdd$1(this, _search);
4399
- __privateAdd$1(this, _getSchemaTables);
4400
- __privateAdd$1(this, _schemaTables, void 0);
4401
- __privateSet$1(this, _schemaTables, schemaTables);
4402
4468
  }
4403
4469
  build(pluginOptions) {
4404
4470
  return {
4405
4471
  all: async (query, options = {}) => {
4406
- const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4407
- const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, pluginOptions);
4408
- return records.map((record) => {
4409
- const { table = "orphan" } = record.xata;
4410
- return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
4411
- });
4472
+ const { records, totalCount } = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4473
+ return {
4474
+ totalCount,
4475
+ records: records.map((record) => {
4476
+ const { table = "orphan" } = record.xata;
4477
+ return { table, record: initObject(this.db, pluginOptions.tables, table, record, ["*"]) };
4478
+ })
4479
+ };
4412
4480
  },
4413
4481
  byTable: async (query, options = {}) => {
4414
- const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4415
- const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, pluginOptions);
4416
- return records.reduce((acc, record) => {
4482
+ const { records: rawRecords, totalCount } = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4483
+ const records = rawRecords.reduce((acc, record) => {
4417
4484
  const { table = "orphan" } = record.xata;
4418
4485
  const items = acc[table] ?? [];
4419
- const item = initObject(this.db, schemaTables, table, record, ["*"]);
4486
+ const item = initObject(this.db, pluginOptions.tables, table, record, ["*"]);
4420
4487
  return { ...acc, [table]: [...items, item] };
4421
4488
  }, {});
4489
+ return { totalCount, records };
4422
4490
  }
4423
4491
  };
4424
4492
  }
4425
4493
  }
4426
- _schemaTables = new WeakMap();
4427
4494
  _search = new WeakSet();
4428
4495
  search_fn = async function(query, options, pluginOptions) {
4429
4496
  const { tables, fuzziness, highlight, prefix, page } = options ?? {};
4430
- const { records } = await searchBranch({
4497
+ const { records, totalCount } = await searchBranch({
4431
4498
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4432
- // @ts-ignore https://github.com/xataio/client-ts/issues/313
4499
+ // @ts-expect-error Filter properties do not match inferred type
4433
4500
  body: { tables, query, fuzziness, prefix, highlight, page },
4434
4501
  ...pluginOptions
4435
4502
  });
4436
- return records;
4437
- };
4438
- _getSchemaTables = new WeakSet();
4439
- getSchemaTables_fn = async function(pluginOptions) {
4440
- if (__privateGet$1(this, _schemaTables))
4441
- return __privateGet$1(this, _schemaTables);
4442
- const { schema } = await getBranchDetails({
4443
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4444
- ...pluginOptions
4445
- });
4446
- __privateSet$1(this, _schemaTables, schema.tables);
4447
- return schema.tables;
4503
+ return { records, totalCount };
4448
4504
  };
4449
4505
 
4450
4506
  function escapeElement(elementRepresentation) {
@@ -4507,17 +4563,26 @@ function prepareParams(param1, param2) {
4507
4563
 
4508
4564
  class SQLPlugin extends XataPlugin {
4509
4565
  build(pluginOptions) {
4510
- return async (param1, ...param2) => {
4511
- const { statement, params, consistency } = prepareParams(param1, param2);
4512
- const { records, warning } = await sqlQuery({
4566
+ return async (query, ...parameters) => {
4567
+ if (!isParamsObject(query) && (!isTemplateStringsArray(query) || !Array.isArray(parameters))) {
4568
+ throw new Error("Invalid usage of `xata.sql`. Please use it as a tagged template or with an object.");
4569
+ }
4570
+ const { statement, params, consistency } = prepareParams(query, parameters);
4571
+ const { records, warning, columns } = await sqlQuery({
4513
4572
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4514
4573
  body: { statement, params, consistency },
4515
4574
  ...pluginOptions
4516
4575
  });
4517
- return { records, warning };
4576
+ return { records, warning, columns };
4518
4577
  };
4519
4578
  }
4520
4579
  }
4580
+ function isTemplateStringsArray(strings) {
4581
+ return Array.isArray(strings) && "raw" in strings && Array.isArray(strings.raw);
4582
+ }
4583
+ function isParamsObject(params) {
4584
+ return isObject(params) && "statement" in params;
4585
+ }
4521
4586
 
4522
4587
  class TransactionPlugin extends XataPlugin {
4523
4588
  build(pluginOptions) {
@@ -4559,7 +4624,7 @@ var __privateMethod = (obj, member, method) => {
4559
4624
  const buildClient = (plugins) => {
4560
4625
  var _options, _parseOptions, parseOptions_fn, _getFetchProps, getFetchProps_fn, _a;
4561
4626
  return _a = class {
4562
- constructor(options = {}, schemaTables) {
4627
+ constructor(options = {}, tables) {
4563
4628
  __privateAdd(this, _parseOptions);
4564
4629
  __privateAdd(this, _getFetchProps);
4565
4630
  __privateAdd(this, _options, void 0);
@@ -4568,13 +4633,15 @@ const buildClient = (plugins) => {
4568
4633
  const pluginOptions = {
4569
4634
  ...__privateMethod(this, _getFetchProps, getFetchProps_fn).call(this, safeOptions),
4570
4635
  cache: safeOptions.cache,
4571
- host: safeOptions.host
4636
+ host: safeOptions.host,
4637
+ tables
4572
4638
  };
4573
- const db = new SchemaPlugin(schemaTables).build(pluginOptions);
4574
- const search = new SearchPlugin(db, schemaTables).build(pluginOptions);
4639
+ const db = new SchemaPlugin().build(pluginOptions);
4640
+ const search = new SearchPlugin(db).build(pluginOptions);
4575
4641
  const transactions = new TransactionPlugin().build(pluginOptions);
4576
4642
  const sql = new SQLPlugin().build(pluginOptions);
4577
4643
  const files = new FilesPlugin().build(pluginOptions);
4644
+ this.schema = { tables };
4578
4645
  this.db = db;
4579
4646
  this.search = search;
4580
4647
  this.transactions = transactions;
@@ -4743,21 +4810,6 @@ const deserialize = (json) => {
4743
4810
  return defaultSerializer.fromJSON(json);
4744
4811
  };
4745
4812
 
4746
- function buildWorkerRunner(config) {
4747
- return function xataWorker(name, worker) {
4748
- return async (...args) => {
4749
- const url = process.env.NODE_ENV === "development" ? `http://localhost:64749/${name}` : `https://dispatcher.xata.workers.dev/${config.workspace}/${config.worker}/${name}`;
4750
- const result = await fetch(url, {
4751
- method: "POST",
4752
- headers: { "Content-Type": "application/json" },
4753
- body: serialize({ args })
4754
- });
4755
- const text = await result.text();
4756
- return deserialize(text);
4757
- };
4758
- };
4759
- }
4760
-
4761
4813
  class XataError extends Error {
4762
4814
  constructor(message, status) {
4763
4815
  super(message);
@@ -4765,5 +4817,5 @@ class XataError extends Error {
4765
4817
  }
4766
4818
  }
4767
4819
 
4768
- 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, askTable, askTableSession, branchTransaction, buildClient, buildPreviewBranchName, buildProviderString, buildWorkerRunner, 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, 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, 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 };
4820
+ 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 };
4769
4821
  //# sourceMappingURL=index.mjs.map