@xata.io/client 0.0.0-alpha.vf2950db06c33bba882032c181cc784c0501526f1 → 0.0.0-alpha.vf2d4ede35f0fb2771332d1b20637a8546868103b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -248,7 +248,7 @@ var __accessCheck$8 = (obj, member, msg) => {
248
248
  if (!member.has(obj))
249
249
  throw TypeError("Cannot " + msg);
250
250
  };
251
- var __privateGet$8 = (obj, member, getter) => {
251
+ var __privateGet$7 = (obj, member, getter) => {
252
252
  __accessCheck$8(obj, member, "read from private field");
253
253
  return getter ? getter.call(obj) : member.get(obj);
254
254
  };
@@ -257,7 +257,7 @@ var __privateAdd$8 = (obj, member, value) => {
257
257
  throw TypeError("Cannot add the same private member more than once");
258
258
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
259
259
  };
260
- var __privateSet$8 = (obj, member, value, setter) => {
260
+ var __privateSet$6 = (obj, member, value, setter) => {
261
261
  __accessCheck$8(obj, member, "write to private field");
262
262
  setter ? setter.call(obj, value) : member.set(obj, value);
263
263
  return value;
@@ -283,19 +283,19 @@ class ApiRequestPool {
283
283
  __privateAdd$8(this, _fetch, void 0);
284
284
  __privateAdd$8(this, _queue, void 0);
285
285
  __privateAdd$8(this, _concurrency, void 0);
286
- __privateSet$8(this, _queue, []);
287
- __privateSet$8(this, _concurrency, concurrency);
286
+ __privateSet$6(this, _queue, []);
287
+ __privateSet$6(this, _concurrency, concurrency);
288
288
  this.running = 0;
289
289
  this.started = 0;
290
290
  }
291
291
  setFetch(fetch2) {
292
- __privateSet$8(this, _fetch, fetch2);
292
+ __privateSet$6(this, _fetch, fetch2);
293
293
  }
294
294
  getFetch() {
295
- if (!__privateGet$8(this, _fetch)) {
295
+ if (!__privateGet$7(this, _fetch)) {
296
296
  throw new Error("Fetch not set");
297
297
  }
298
- return __privateGet$8(this, _fetch);
298
+ return __privateGet$7(this, _fetch);
299
299
  }
300
300
  request(url, options) {
301
301
  const start = /* @__PURE__ */ new Date();
@@ -327,19 +327,19 @@ _queue = new WeakMap();
327
327
  _concurrency = new WeakMap();
328
328
  _enqueue = new WeakSet();
329
329
  enqueue_fn = function(task) {
330
- const promise = new Promise((resolve) => __privateGet$8(this, _queue).push(resolve)).finally(() => {
330
+ const promise = new Promise((resolve) => __privateGet$7(this, _queue).push(resolve)).finally(() => {
331
331
  this.started--;
332
332
  this.running++;
333
333
  }).then(() => task()).finally(() => {
334
334
  this.running--;
335
- const next = __privateGet$8(this, _queue).shift();
335
+ const next = __privateGet$7(this, _queue).shift();
336
336
  if (next !== void 0) {
337
337
  this.started++;
338
338
  next();
339
339
  }
340
340
  });
341
- if (this.running + this.started < __privateGet$8(this, _concurrency)) {
342
- const next = __privateGet$8(this, _queue).shift();
341
+ if (this.running + this.started < __privateGet$7(this, _concurrency)) {
342
+ const next = __privateGet$7(this, _queue).shift();
343
343
  if (next !== void 0) {
344
344
  this.started++;
345
345
  next();
@@ -528,7 +528,7 @@ function defaultOnOpen(response) {
528
528
  }
529
529
  }
530
530
 
531
- const VERSION = "0.28.3";
531
+ const VERSION = "0.29.2";
532
532
 
533
533
  class ErrorWithCause extends Error {
534
534
  constructor(message, options) {
@@ -847,26 +847,29 @@ function parseUrl(url) {
847
847
 
848
848
  const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
849
849
 
850
- const applyMigration = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/pgroll/apply", method: "post", ...variables, signal });
851
- const pgRollStatus = (variables, signal) => dataPlaneFetch({
852
- url: "/db/{dbBranchName}/pgroll/status",
853
- method: "get",
850
+ const applyMigration = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/apply", method: "post", ...variables, signal });
851
+ const adaptTable = (variables, signal) => dataPlaneFetch({
852
+ url: "/db/{dbBranchName}/migrations/adapt/{tableName}",
853
+ method: "post",
854
854
  ...variables,
855
855
  signal
856
856
  });
857
- const pgRollJobStatus = (variables, signal) => dataPlaneFetch({
858
- url: "/db/{dbBranchName}/pgroll/jobs/{jobId}",
857
+ const getBranchMigrationJobStatus = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/status", method: "get", ...variables, signal });
858
+ const getMigrationJobStatus = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/jobs/{jobId}", method: "get", ...variables, signal });
859
+ const getMigrationHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/history", method: "get", ...variables, signal });
860
+ const getBranchList = (variables, signal) => dataPlaneFetch({
861
+ url: "/dbs/{dbName}",
859
862
  method: "get",
860
863
  ...variables,
861
864
  signal
862
865
  });
863
- const pgRollMigrationHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/pgroll/migrations", method: "get", ...variables, signal });
864
- const getBranchList = (variables, signal) => dataPlaneFetch({
865
- url: "/dbs/{dbName}",
866
+ const getDatabaseSettings = (variables, signal) => dataPlaneFetch({
867
+ url: "/dbs/{dbName}/settings",
866
868
  method: "get",
867
869
  ...variables,
868
870
  signal
869
871
  });
872
+ const updateDatabaseSettings = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/settings", method: "patch", ...variables, signal });
870
873
  const getBranchDetails = (variables, signal) => dataPlaneFetch({
871
874
  url: "/db/{dbBranchName}",
872
875
  method: "get",
@@ -1080,11 +1083,25 @@ const sqlQuery = (variables, signal) => dataPlaneFetch({
1080
1083
  signal
1081
1084
  });
1082
1085
  const operationsByTag$2 = {
1083
- branch: {
1086
+ migrations: {
1084
1087
  applyMigration,
1085
- pgRollStatus,
1086
- pgRollJobStatus,
1087
- pgRollMigrationHistory,
1088
+ adaptTable,
1089
+ getBranchMigrationJobStatus,
1090
+ getMigrationJobStatus,
1091
+ getMigrationHistory,
1092
+ getSchema,
1093
+ getBranchMigrationHistory,
1094
+ getBranchMigrationPlan,
1095
+ executeBranchMigrationPlan,
1096
+ getBranchSchemaHistory,
1097
+ compareBranchWithUserSchema,
1098
+ compareBranchSchemas,
1099
+ updateBranchSchema,
1100
+ previewBranchSchemaEdit,
1101
+ applyBranchSchemaEdit,
1102
+ pushBranchMigrations
1103
+ },
1104
+ branch: {
1088
1105
  getBranchList,
1089
1106
  getBranchDetails,
1090
1107
  createBranch,
@@ -1098,19 +1115,7 @@ const operationsByTag$2 = {
1098
1115
  removeGitBranchesEntry,
1099
1116
  resolveBranch
1100
1117
  },
1101
- migrations: {
1102
- getSchema,
1103
- getBranchMigrationHistory,
1104
- getBranchMigrationPlan,
1105
- executeBranchMigrationPlan,
1106
- getBranchSchemaHistory,
1107
- compareBranchWithUserSchema,
1108
- compareBranchSchemas,
1109
- updateBranchSchema,
1110
- previewBranchSchemaEdit,
1111
- applyBranchSchemaEdit,
1112
- pushBranchMigrations
1113
- },
1118
+ database: { getDatabaseSettings, updateDatabaseSettings },
1114
1119
  migrationRequests: {
1115
1120
  queryMigrationRequests,
1116
1121
  createMigrationRequest,
@@ -1252,6 +1257,8 @@ const deleteWorkspace = (variables, signal) => controlPlaneFetch({
1252
1257
  ...variables,
1253
1258
  signal
1254
1259
  });
1260
+ const getWorkspaceSettings = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/settings", method: "get", ...variables, signal });
1261
+ const updateWorkspaceSettings = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/settings", method: "patch", ...variables, signal });
1255
1262
  const getWorkspaceMembersList = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members", method: "get", ...variables, signal });
1256
1263
  const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables, signal });
1257
1264
  const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
@@ -1265,12 +1272,7 @@ const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ u
1265
1272
  const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "delete", ...variables, signal });
1266
1273
  const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
1267
1274
  const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
1268
- const listClusters = (variables, signal) => controlPlaneFetch({
1269
- url: "/workspaces/{workspaceId}/clusters",
1270
- method: "get",
1271
- ...variables,
1272
- signal
1273
- });
1275
+ const listClusters = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters", method: "get", ...variables, signal });
1274
1276
  const createCluster = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters", method: "post", ...variables, signal });
1275
1277
  const getCluster = (variables, signal) => controlPlaneFetch({
1276
1278
  url: "/workspaces/{workspaceId}/clusters/{clusterId}",
@@ -1322,6 +1324,8 @@ const operationsByTag$1 = {
1322
1324
  getWorkspace,
1323
1325
  updateWorkspace,
1324
1326
  deleteWorkspace,
1327
+ getWorkspaceSettings,
1328
+ updateWorkspaceSettings,
1325
1329
  getWorkspaceMembersList,
1326
1330
  updateWorkspaceMemberRole,
1327
1331
  removeWorkspaceMember
@@ -1354,7 +1358,7 @@ var __accessCheck$7 = (obj, member, msg) => {
1354
1358
  if (!member.has(obj))
1355
1359
  throw TypeError("Cannot " + msg);
1356
1360
  };
1357
- var __privateGet$7 = (obj, member, getter) => {
1361
+ var __privateGet$6 = (obj, member, getter) => {
1358
1362
  __accessCheck$7(obj, member, "read from private field");
1359
1363
  return getter ? getter.call(obj) : member.get(obj);
1360
1364
  };
@@ -1363,7 +1367,7 @@ var __privateAdd$7 = (obj, member, value) => {
1363
1367
  throw TypeError("Cannot add the same private member more than once");
1364
1368
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1365
1369
  };
1366
- var __privateSet$7 = (obj, member, value, setter) => {
1370
+ var __privateSet$5 = (obj, member, value, setter) => {
1367
1371
  __accessCheck$7(obj, member, "write to private field");
1368
1372
  setter ? setter.call(obj, value) : member.set(obj, value);
1369
1373
  return value;
@@ -1380,7 +1384,7 @@ class XataApiClient {
1380
1384
  if (!apiKey) {
1381
1385
  throw new Error("Could not resolve a valid apiKey");
1382
1386
  }
1383
- __privateSet$7(this, _extraProps, {
1387
+ __privateSet$5(this, _extraProps, {
1384
1388
  apiUrl: getHostUrl(provider, "main"),
1385
1389
  workspacesApiUrl: getHostUrl(provider, "workspaces"),
1386
1390
  fetch: getFetchImplementation(options.fetch),
@@ -1392,64 +1396,64 @@ class XataApiClient {
1392
1396
  });
1393
1397
  }
1394
1398
  get user() {
1395
- if (!__privateGet$7(this, _namespaces).user)
1396
- __privateGet$7(this, _namespaces).user = new UserApi(__privateGet$7(this, _extraProps));
1397
- return __privateGet$7(this, _namespaces).user;
1399
+ if (!__privateGet$6(this, _namespaces).user)
1400
+ __privateGet$6(this, _namespaces).user = new UserApi(__privateGet$6(this, _extraProps));
1401
+ return __privateGet$6(this, _namespaces).user;
1398
1402
  }
1399
1403
  get authentication() {
1400
- if (!__privateGet$7(this, _namespaces).authentication)
1401
- __privateGet$7(this, _namespaces).authentication = new AuthenticationApi(__privateGet$7(this, _extraProps));
1402
- return __privateGet$7(this, _namespaces).authentication;
1404
+ if (!__privateGet$6(this, _namespaces).authentication)
1405
+ __privateGet$6(this, _namespaces).authentication = new AuthenticationApi(__privateGet$6(this, _extraProps));
1406
+ return __privateGet$6(this, _namespaces).authentication;
1403
1407
  }
1404
1408
  get workspaces() {
1405
- if (!__privateGet$7(this, _namespaces).workspaces)
1406
- __privateGet$7(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$7(this, _extraProps));
1407
- return __privateGet$7(this, _namespaces).workspaces;
1409
+ if (!__privateGet$6(this, _namespaces).workspaces)
1410
+ __privateGet$6(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$6(this, _extraProps));
1411
+ return __privateGet$6(this, _namespaces).workspaces;
1408
1412
  }
1409
1413
  get invites() {
1410
- if (!__privateGet$7(this, _namespaces).invites)
1411
- __privateGet$7(this, _namespaces).invites = new InvitesApi(__privateGet$7(this, _extraProps));
1412
- return __privateGet$7(this, _namespaces).invites;
1414
+ if (!__privateGet$6(this, _namespaces).invites)
1415
+ __privateGet$6(this, _namespaces).invites = new InvitesApi(__privateGet$6(this, _extraProps));
1416
+ return __privateGet$6(this, _namespaces).invites;
1413
1417
  }
1414
1418
  get database() {
1415
- if (!__privateGet$7(this, _namespaces).database)
1416
- __privateGet$7(this, _namespaces).database = new DatabaseApi(__privateGet$7(this, _extraProps));
1417
- return __privateGet$7(this, _namespaces).database;
1419
+ if (!__privateGet$6(this, _namespaces).database)
1420
+ __privateGet$6(this, _namespaces).database = new DatabaseApi(__privateGet$6(this, _extraProps));
1421
+ return __privateGet$6(this, _namespaces).database;
1418
1422
  }
1419
1423
  get branches() {
1420
- if (!__privateGet$7(this, _namespaces).branches)
1421
- __privateGet$7(this, _namespaces).branches = new BranchApi(__privateGet$7(this, _extraProps));
1422
- return __privateGet$7(this, _namespaces).branches;
1424
+ if (!__privateGet$6(this, _namespaces).branches)
1425
+ __privateGet$6(this, _namespaces).branches = new BranchApi(__privateGet$6(this, _extraProps));
1426
+ return __privateGet$6(this, _namespaces).branches;
1423
1427
  }
1424
1428
  get migrations() {
1425
- if (!__privateGet$7(this, _namespaces).migrations)
1426
- __privateGet$7(this, _namespaces).migrations = new MigrationsApi(__privateGet$7(this, _extraProps));
1427
- return __privateGet$7(this, _namespaces).migrations;
1429
+ if (!__privateGet$6(this, _namespaces).migrations)
1430
+ __privateGet$6(this, _namespaces).migrations = new MigrationsApi(__privateGet$6(this, _extraProps));
1431
+ return __privateGet$6(this, _namespaces).migrations;
1428
1432
  }
1429
1433
  get migrationRequests() {
1430
- if (!__privateGet$7(this, _namespaces).migrationRequests)
1431
- __privateGet$7(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$7(this, _extraProps));
1432
- return __privateGet$7(this, _namespaces).migrationRequests;
1434
+ if (!__privateGet$6(this, _namespaces).migrationRequests)
1435
+ __privateGet$6(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$6(this, _extraProps));
1436
+ return __privateGet$6(this, _namespaces).migrationRequests;
1433
1437
  }
1434
1438
  get tables() {
1435
- if (!__privateGet$7(this, _namespaces).tables)
1436
- __privateGet$7(this, _namespaces).tables = new TableApi(__privateGet$7(this, _extraProps));
1437
- return __privateGet$7(this, _namespaces).tables;
1439
+ if (!__privateGet$6(this, _namespaces).tables)
1440
+ __privateGet$6(this, _namespaces).tables = new TableApi(__privateGet$6(this, _extraProps));
1441
+ return __privateGet$6(this, _namespaces).tables;
1438
1442
  }
1439
1443
  get records() {
1440
- if (!__privateGet$7(this, _namespaces).records)
1441
- __privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
1442
- return __privateGet$7(this, _namespaces).records;
1444
+ if (!__privateGet$6(this, _namespaces).records)
1445
+ __privateGet$6(this, _namespaces).records = new RecordsApi(__privateGet$6(this, _extraProps));
1446
+ return __privateGet$6(this, _namespaces).records;
1443
1447
  }
1444
1448
  get files() {
1445
- if (!__privateGet$7(this, _namespaces).files)
1446
- __privateGet$7(this, _namespaces).files = new FilesApi(__privateGet$7(this, _extraProps));
1447
- return __privateGet$7(this, _namespaces).files;
1449
+ if (!__privateGet$6(this, _namespaces).files)
1450
+ __privateGet$6(this, _namespaces).files = new FilesApi(__privateGet$6(this, _extraProps));
1451
+ return __privateGet$6(this, _namespaces).files;
1448
1452
  }
1449
1453
  get searchAndFilter() {
1450
- if (!__privateGet$7(this, _namespaces).searchAndFilter)
1451
- __privateGet$7(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$7(this, _extraProps));
1452
- return __privateGet$7(this, _namespaces).searchAndFilter;
1454
+ if (!__privateGet$6(this, _namespaces).searchAndFilter)
1455
+ __privateGet$6(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$6(this, _extraProps));
1456
+ return __privateGet$6(this, _namespaces).searchAndFilter;
1453
1457
  }
1454
1458
  }
1455
1459
  _extraProps = new WeakMap();
@@ -1751,6 +1755,30 @@ class BranchApi {
1751
1755
  ...this.extraProps
1752
1756
  });
1753
1757
  }
1758
+ pgRollMigrationHistory({
1759
+ workspace,
1760
+ region,
1761
+ database,
1762
+ branch
1763
+ }) {
1764
+ return operationsByTag.migrations.getMigrationHistory({
1765
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1766
+ ...this.extraProps
1767
+ });
1768
+ }
1769
+ applyMigration({
1770
+ workspace,
1771
+ region,
1772
+ database,
1773
+ branch,
1774
+ migration
1775
+ }) {
1776
+ return operationsByTag.migrations.applyMigration({
1777
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1778
+ body: migration,
1779
+ ...this.extraProps
1780
+ });
1781
+ }
1754
1782
  }
1755
1783
  class TableApi {
1756
1784
  constructor(extraProps) {
@@ -2564,6 +2592,17 @@ class MigrationsApi {
2564
2592
  ...this.extraProps
2565
2593
  });
2566
2594
  }
2595
+ getSchema({
2596
+ workspace,
2597
+ region,
2598
+ database,
2599
+ branch
2600
+ }) {
2601
+ return operationsByTag.migrations.getSchema({
2602
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
2603
+ ...this.extraProps
2604
+ });
2605
+ }
2567
2606
  }
2568
2607
  class DatabaseApi {
2569
2608
  constructor(extraProps) {
@@ -2869,7 +2908,7 @@ var __accessCheck$6 = (obj, member, msg) => {
2869
2908
  if (!member.has(obj))
2870
2909
  throw TypeError("Cannot " + msg);
2871
2910
  };
2872
- var __privateGet$6 = (obj, member, getter) => {
2911
+ var __privateGet$5 = (obj, member, getter) => {
2873
2912
  __accessCheck$6(obj, member, "read from private field");
2874
2913
  return getter ? getter.call(obj) : member.get(obj);
2875
2914
  };
@@ -2878,7 +2917,7 @@ var __privateAdd$6 = (obj, member, value) => {
2878
2917
  throw TypeError("Cannot add the same private member more than once");
2879
2918
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
2880
2919
  };
2881
- var __privateSet$6 = (obj, member, value, setter) => {
2920
+ var __privateSet$4 = (obj, member, value, setter) => {
2882
2921
  __accessCheck$6(obj, member, "write to private field");
2883
2922
  setter ? setter.call(obj, value) : member.set(obj, value);
2884
2923
  return value;
@@ -2887,9 +2926,9 @@ var _query, _page;
2887
2926
  class Page {
2888
2927
  constructor(query, meta, records = []) {
2889
2928
  __privateAdd$6(this, _query, void 0);
2890
- __privateSet$6(this, _query, query);
2929
+ __privateSet$4(this, _query, query);
2891
2930
  this.meta = meta;
2892
- this.records = new RecordArray(this, records);
2931
+ this.records = new PageRecordArray(this, records);
2893
2932
  }
2894
2933
  /**
2895
2934
  * Retrieves the next page of results.
@@ -2898,7 +2937,7 @@ class Page {
2898
2937
  * @returns The next page or results.
2899
2938
  */
2900
2939
  async nextPage(size, offset) {
2901
- return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, after: this.meta.page.cursor } });
2940
+ return __privateGet$5(this, _query).getPaginated({ pagination: { size, offset, after: this.meta.page.cursor } });
2902
2941
  }
2903
2942
  /**
2904
2943
  * Retrieves the previous page of results.
@@ -2907,7 +2946,7 @@ class Page {
2907
2946
  * @returns The previous page or results.
2908
2947
  */
2909
2948
  async previousPage(size, offset) {
2910
- return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, before: this.meta.page.cursor } });
2949
+ return __privateGet$5(this, _query).getPaginated({ pagination: { size, offset, before: this.meta.page.cursor } });
2911
2950
  }
2912
2951
  /**
2913
2952
  * Retrieves the start page of results.
@@ -2916,7 +2955,7 @@ class Page {
2916
2955
  * @returns The start page or results.
2917
2956
  */
2918
2957
  async startPage(size, offset) {
2919
- return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, start: this.meta.page.cursor } });
2958
+ return __privateGet$5(this, _query).getPaginated({ pagination: { size, offset, start: this.meta.page.cursor } });
2920
2959
  }
2921
2960
  /**
2922
2961
  * Retrieves the end page of results.
@@ -2925,7 +2964,7 @@ class Page {
2925
2964
  * @returns The end page or results.
2926
2965
  */
2927
2966
  async endPage(size, offset) {
2928
- return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, end: this.meta.page.cursor } });
2967
+ return __privateGet$5(this, _query).getPaginated({ pagination: { size, offset, end: this.meta.page.cursor } });
2929
2968
  }
2930
2969
  /**
2931
2970
  * Shortcut method to check if there will be additional results if the next page of results is retrieved.
@@ -2943,11 +2982,38 @@ const PAGINATION_DEFAULT_OFFSET = 0;
2943
2982
  function isCursorPaginationOptions(options) {
2944
2983
  return isDefined(options) && (isDefined(options.start) || isDefined(options.end) || isDefined(options.after) || isDefined(options.before));
2945
2984
  }
2946
- const _RecordArray = class _RecordArray extends Array {
2985
+ class RecordArray extends Array {
2947
2986
  constructor(...args) {
2948
- super(..._RecordArray.parseConstructorParams(...args));
2987
+ super(...RecordArray.parseConstructorParams(...args));
2988
+ }
2989
+ static parseConstructorParams(...args) {
2990
+ if (args.length === 1 && typeof args[0] === "number") {
2991
+ return new Array(args[0]);
2992
+ }
2993
+ if (args.length <= 1 && Array.isArray(args[0] ?? [])) {
2994
+ const result = args[0] ?? [];
2995
+ return new Array(...result);
2996
+ }
2997
+ return new Array(...args);
2998
+ }
2999
+ toArray() {
3000
+ return new Array(...this);
3001
+ }
3002
+ toSerializable() {
3003
+ return JSON.parse(this.toString());
3004
+ }
3005
+ toString() {
3006
+ return JSON.stringify(this.toArray());
3007
+ }
3008
+ map(callbackfn, thisArg) {
3009
+ return this.toArray().map(callbackfn, thisArg);
3010
+ }
3011
+ }
3012
+ const _PageRecordArray = class _PageRecordArray extends Array {
3013
+ constructor(...args) {
3014
+ super(..._PageRecordArray.parseConstructorParams(...args));
2949
3015
  __privateAdd$6(this, _page, void 0);
2950
- __privateSet$6(this, _page, isObject(args[0]?.meta) ? args[0] : { meta: { page: { cursor: "", more: false } }, records: [] });
3016
+ __privateSet$4(this, _page, isObject(args[0]?.meta) ? args[0] : { meta: { page: { cursor: "", more: false } }, records: [] });
2951
3017
  }
2952
3018
  static parseConstructorParams(...args) {
2953
3019
  if (args.length === 1 && typeof args[0] === "number") {
@@ -2977,8 +3043,8 @@ const _RecordArray = class _RecordArray extends Array {
2977
3043
  * @returns A new array of objects
2978
3044
  */
2979
3045
  async nextPage(size, offset) {
2980
- const newPage = await __privateGet$6(this, _page).nextPage(size, offset);
2981
- return new _RecordArray(newPage);
3046
+ const newPage = await __privateGet$5(this, _page).nextPage(size, offset);
3047
+ return new _PageRecordArray(newPage);
2982
3048
  }
2983
3049
  /**
2984
3050
  * Retrieve previous page of records
@@ -2986,8 +3052,8 @@ const _RecordArray = class _RecordArray extends Array {
2986
3052
  * @returns A new array of objects
2987
3053
  */
2988
3054
  async previousPage(size, offset) {
2989
- const newPage = await __privateGet$6(this, _page).previousPage(size, offset);
2990
- return new _RecordArray(newPage);
3055
+ const newPage = await __privateGet$5(this, _page).previousPage(size, offset);
3056
+ return new _PageRecordArray(newPage);
2991
3057
  }
2992
3058
  /**
2993
3059
  * Retrieve start page of records
@@ -2995,8 +3061,8 @@ const _RecordArray = class _RecordArray extends Array {
2995
3061
  * @returns A new array of objects
2996
3062
  */
2997
3063
  async startPage(size, offset) {
2998
- const newPage = await __privateGet$6(this, _page).startPage(size, offset);
2999
- return new _RecordArray(newPage);
3064
+ const newPage = await __privateGet$5(this, _page).startPage(size, offset);
3065
+ return new _PageRecordArray(newPage);
3000
3066
  }
3001
3067
  /**
3002
3068
  * Retrieve end page of records
@@ -3004,24 +3070,24 @@ const _RecordArray = class _RecordArray extends Array {
3004
3070
  * @returns A new array of objects
3005
3071
  */
3006
3072
  async endPage(size, offset) {
3007
- const newPage = await __privateGet$6(this, _page).endPage(size, offset);
3008
- return new _RecordArray(newPage);
3073
+ const newPage = await __privateGet$5(this, _page).endPage(size, offset);
3074
+ return new _PageRecordArray(newPage);
3009
3075
  }
3010
3076
  /**
3011
3077
  * @returns Boolean indicating if there is a next page
3012
3078
  */
3013
3079
  hasNextPage() {
3014
- return __privateGet$6(this, _page).meta.page.more;
3080
+ return __privateGet$5(this, _page).meta.page.more;
3015
3081
  }
3016
3082
  };
3017
3083
  _page = new WeakMap();
3018
- let RecordArray = _RecordArray;
3084
+ let PageRecordArray = _PageRecordArray;
3019
3085
 
3020
3086
  var __accessCheck$5 = (obj, member, msg) => {
3021
3087
  if (!member.has(obj))
3022
3088
  throw TypeError("Cannot " + msg);
3023
3089
  };
3024
- var __privateGet$5 = (obj, member, getter) => {
3090
+ var __privateGet$4 = (obj, member, getter) => {
3025
3091
  __accessCheck$5(obj, member, "read from private field");
3026
3092
  return getter ? getter.call(obj) : member.get(obj);
3027
3093
  };
@@ -3030,7 +3096,7 @@ var __privateAdd$5 = (obj, member, value) => {
3030
3096
  throw TypeError("Cannot add the same private member more than once");
3031
3097
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
3032
3098
  };
3033
- var __privateSet$5 = (obj, member, value, setter) => {
3099
+ var __privateSet$3 = (obj, member, value, setter) => {
3034
3100
  __accessCheck$5(obj, member, "write to private field");
3035
3101
  setter ? setter.call(obj, value) : member.set(obj, value);
3036
3102
  return value;
@@ -3048,25 +3114,25 @@ const _Query = class _Query {
3048
3114
  __privateAdd$5(this, _data, { filter: {} });
3049
3115
  // Implements pagination
3050
3116
  this.meta = { page: { cursor: "start", more: true, size: PAGINATION_DEFAULT_SIZE } };
3051
- this.records = new RecordArray(this, []);
3052
- __privateSet$5(this, _table$1, table);
3117
+ this.records = new PageRecordArray(this, []);
3118
+ __privateSet$3(this, _table$1, table);
3053
3119
  if (repository) {
3054
- __privateSet$5(this, _repository, repository);
3120
+ __privateSet$3(this, _repository, repository);
3055
3121
  } else {
3056
- __privateSet$5(this, _repository, this);
3122
+ __privateSet$3(this, _repository, this);
3057
3123
  }
3058
3124
  const parent = cleanParent(data, rawParent);
3059
- __privateGet$5(this, _data).filter = data.filter ?? parent?.filter ?? {};
3060
- __privateGet$5(this, _data).filter.$any = data.filter?.$any ?? parent?.filter?.$any;
3061
- __privateGet$5(this, _data).filter.$all = data.filter?.$all ?? parent?.filter?.$all;
3062
- __privateGet$5(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
3063
- __privateGet$5(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
3064
- __privateGet$5(this, _data).sort = data.sort ?? parent?.sort;
3065
- __privateGet$5(this, _data).columns = data.columns ?? parent?.columns;
3066
- __privateGet$5(this, _data).consistency = data.consistency ?? parent?.consistency;
3067
- __privateGet$5(this, _data).pagination = data.pagination ?? parent?.pagination;
3068
- __privateGet$5(this, _data).cache = data.cache ?? parent?.cache;
3069
- __privateGet$5(this, _data).fetchOptions = data.fetchOptions ?? parent?.fetchOptions;
3125
+ __privateGet$4(this, _data).filter = data.filter ?? parent?.filter ?? {};
3126
+ __privateGet$4(this, _data).filter.$any = data.filter?.$any ?? parent?.filter?.$any;
3127
+ __privateGet$4(this, _data).filter.$all = data.filter?.$all ?? parent?.filter?.$all;
3128
+ __privateGet$4(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
3129
+ __privateGet$4(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
3130
+ __privateGet$4(this, _data).sort = data.sort ?? parent?.sort;
3131
+ __privateGet$4(this, _data).columns = data.columns ?? parent?.columns;
3132
+ __privateGet$4(this, _data).consistency = data.consistency ?? parent?.consistency;
3133
+ __privateGet$4(this, _data).pagination = data.pagination ?? parent?.pagination;
3134
+ __privateGet$4(this, _data).cache = data.cache ?? parent?.cache;
3135
+ __privateGet$4(this, _data).fetchOptions = data.fetchOptions ?? parent?.fetchOptions;
3070
3136
  this.any = this.any.bind(this);
3071
3137
  this.all = this.all.bind(this);
3072
3138
  this.not = this.not.bind(this);
@@ -3077,10 +3143,10 @@ const _Query = class _Query {
3077
3143
  Object.defineProperty(this, "repository", { enumerable: false });
3078
3144
  }
3079
3145
  getQueryOptions() {
3080
- return __privateGet$5(this, _data);
3146
+ return __privateGet$4(this, _data);
3081
3147
  }
3082
3148
  key() {
3083
- const { columns = [], filter = {}, sort = [], pagination = {} } = __privateGet$5(this, _data);
3149
+ const { columns = [], filter = {}, sort = [], pagination = {} } = __privateGet$4(this, _data);
3084
3150
  const key = JSON.stringify({ columns, filter, sort, pagination });
3085
3151
  return toBase64(key);
3086
3152
  }
@@ -3091,7 +3157,7 @@ const _Query = class _Query {
3091
3157
  */
3092
3158
  any(...queries) {
3093
3159
  const $any = queries.map((query) => query.getQueryOptions().filter ?? {});
3094
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $any } }, __privateGet$5(this, _data));
3160
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $any } }, __privateGet$4(this, _data));
3095
3161
  }
3096
3162
  /**
3097
3163
  * Builds a new query object representing a logical AND between the given subqueries.
@@ -3100,7 +3166,7 @@ const _Query = class _Query {
3100
3166
  */
3101
3167
  all(...queries) {
3102
3168
  const $all = queries.map((query) => query.getQueryOptions().filter ?? {});
3103
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
3169
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
3104
3170
  }
3105
3171
  /**
3106
3172
  * Builds a new query object representing a logical OR negating each subquery. In pseudo-code: !q1 OR !q2
@@ -3109,7 +3175,7 @@ const _Query = class _Query {
3109
3175
  */
3110
3176
  not(...queries) {
3111
3177
  const $not = queries.map((query) => query.getQueryOptions().filter ?? {});
3112
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $not } }, __privateGet$5(this, _data));
3178
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $not } }, __privateGet$4(this, _data));
3113
3179
  }
3114
3180
  /**
3115
3181
  * Builds a new query object representing a logical AND negating each subquery. In pseudo-code: !q1 AND !q2
@@ -3118,25 +3184,25 @@ const _Query = class _Query {
3118
3184
  */
3119
3185
  none(...queries) {
3120
3186
  const $none = queries.map((query) => query.getQueryOptions().filter ?? {});
3121
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $none } }, __privateGet$5(this, _data));
3187
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $none } }, __privateGet$4(this, _data));
3122
3188
  }
3123
3189
  filter(a, b) {
3124
3190
  if (arguments.length === 1) {
3125
3191
  const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
3126
3192
  [column]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, column, constraint)
3127
3193
  }));
3128
- const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
3129
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
3194
+ const $all = compact([__privateGet$4(this, _data).filter?.$all].flat().concat(constraints));
3195
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
3130
3196
  } else {
3131
3197
  const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, a, b) }] : void 0;
3132
- const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
3133
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
3198
+ const $all = compact([__privateGet$4(this, _data).filter?.$all].flat().concat(constraints));
3199
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
3134
3200
  }
3135
3201
  }
3136
3202
  sort(column, direction = "asc") {
3137
- const originalSort = [__privateGet$5(this, _data).sort ?? []].flat();
3203
+ const originalSort = [__privateGet$4(this, _data).sort ?? []].flat();
3138
3204
  const sort = [...originalSort, { column, direction }];
3139
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { sort }, __privateGet$5(this, _data));
3205
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { sort }, __privateGet$4(this, _data));
3140
3206
  }
3141
3207
  /**
3142
3208
  * Builds a new query specifying the set of columns to be returned in the query response.
@@ -3145,15 +3211,15 @@ const _Query = class _Query {
3145
3211
  */
3146
3212
  select(columns) {
3147
3213
  return new _Query(
3148
- __privateGet$5(this, _repository),
3149
- __privateGet$5(this, _table$1),
3214
+ __privateGet$4(this, _repository),
3215
+ __privateGet$4(this, _table$1),
3150
3216
  { columns },
3151
- __privateGet$5(this, _data)
3217
+ __privateGet$4(this, _data)
3152
3218
  );
3153
3219
  }
3154
3220
  getPaginated(options = {}) {
3155
- const query = new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), options, __privateGet$5(this, _data));
3156
- return __privateGet$5(this, _repository).query(query);
3221
+ const query = new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), options, __privateGet$4(this, _data));
3222
+ return __privateGet$4(this, _repository).query(query);
3157
3223
  }
3158
3224
  /**
3159
3225
  * Get results in an iterator
@@ -3190,7 +3256,7 @@ const _Query = class _Query {
3190
3256
  if (page.hasNextPage() && options.pagination?.size === void 0) {
3191
3257
  console.trace("Calling getMany does not return all results. Paginate to get all results or call getAll.");
3192
3258
  }
3193
- const array = new RecordArray(page, results.slice(0, size));
3259
+ const array = new PageRecordArray(page, results.slice(0, size));
3194
3260
  return array;
3195
3261
  }
3196
3262
  async getAll(options = {}) {
@@ -3199,7 +3265,7 @@ const _Query = class _Query {
3199
3265
  for await (const page of this.getIterator({ ...rest, batchSize })) {
3200
3266
  results.push(...page);
3201
3267
  }
3202
- return results;
3268
+ return new RecordArray(results);
3203
3269
  }
3204
3270
  async getFirst(options = {}) {
3205
3271
  const records = await this.getMany({ ...options, pagination: { size: 1 } });
@@ -3214,12 +3280,12 @@ const _Query = class _Query {
3214
3280
  async summarize(params = {}) {
3215
3281
  const { summaries, summariesFilter, ...options } = params;
3216
3282
  const query = new _Query(
3217
- __privateGet$5(this, _repository),
3218
- __privateGet$5(this, _table$1),
3283
+ __privateGet$4(this, _repository),
3284
+ __privateGet$4(this, _table$1),
3219
3285
  options,
3220
- __privateGet$5(this, _data)
3286
+ __privateGet$4(this, _data)
3221
3287
  );
3222
- return __privateGet$5(this, _repository).summarizeTable(query, summaries, summariesFilter);
3288
+ return __privateGet$4(this, _repository).summarizeTable(query, summaries, summariesFilter);
3223
3289
  }
3224
3290
  /**
3225
3291
  * Builds a new query object adding a cache TTL in milliseconds.
@@ -3227,7 +3293,7 @@ const _Query = class _Query {
3227
3293
  * @returns A new Query object.
3228
3294
  */
3229
3295
  cache(ttl) {
3230
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
3296
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { cache: ttl }, __privateGet$4(this, _data));
3231
3297
  }
3232
3298
  /**
3233
3299
  * Retrieve next page of records
@@ -3273,7 +3339,7 @@ _repository = new WeakMap();
3273
3339
  _data = new WeakMap();
3274
3340
  _cleanFilterConstraint = new WeakSet();
3275
3341
  cleanFilterConstraint_fn = function(column, value) {
3276
- const columnType = __privateGet$5(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
3342
+ const columnType = __privateGet$4(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
3277
3343
  if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
3278
3344
  return { $includes: value };
3279
3345
  }
@@ -3299,7 +3365,6 @@ const RecordColumnTypes = [
3299
3365
  "email",
3300
3366
  "multiple",
3301
3367
  "link",
3302
- "object",
3303
3368
  "datetime",
3304
3369
  "vector",
3305
3370
  "file[]",
@@ -3364,7 +3429,7 @@ var __accessCheck$4 = (obj, member, msg) => {
3364
3429
  if (!member.has(obj))
3365
3430
  throw TypeError("Cannot " + msg);
3366
3431
  };
3367
- var __privateGet$4 = (obj, member, getter) => {
3432
+ var __privateGet$3 = (obj, member, getter) => {
3368
3433
  __accessCheck$4(obj, member, "read from private field");
3369
3434
  return getter ? getter.call(obj) : member.get(obj);
3370
3435
  };
@@ -3373,7 +3438,7 @@ var __privateAdd$4 = (obj, member, value) => {
3373
3438
  throw TypeError("Cannot add the same private member more than once");
3374
3439
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
3375
3440
  };
3376
- var __privateSet$4 = (obj, member, value, setter) => {
3441
+ var __privateSet$2 = (obj, member, value, setter) => {
3377
3442
  __accessCheck$4(obj, member, "write to private field");
3378
3443
  setter ? setter.call(obj, value) : member.set(obj, value);
3379
3444
  return value;
@@ -3382,7 +3447,7 @@ var __privateMethod$2 = (obj, member, method) => {
3382
3447
  __accessCheck$4(obj, member, "access private method");
3383
3448
  return method;
3384
3449
  };
3385
- 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;
3450
+ 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;
3386
3451
  const BULK_OPERATION_MAX_SIZE = 1e3;
3387
3452
  class Repository extends Query {
3388
3453
  }
@@ -3403,31 +3468,31 @@ class RestRepository extends Query {
3403
3468
  __privateAdd$4(this, _deleteRecords);
3404
3469
  __privateAdd$4(this, _setCacheQuery);
3405
3470
  __privateAdd$4(this, _getCacheQuery);
3406
- __privateAdd$4(this, _getSchemaTables$1);
3471
+ __privateAdd$4(this, _getSchemaTables);
3407
3472
  __privateAdd$4(this, _transformObjectToApi);
3408
3473
  __privateAdd$4(this, _table, void 0);
3409
3474
  __privateAdd$4(this, _getFetchProps, void 0);
3410
3475
  __privateAdd$4(this, _db, void 0);
3411
3476
  __privateAdd$4(this, _cache, void 0);
3412
- __privateAdd$4(this, _schemaTables$2, void 0);
3477
+ __privateAdd$4(this, _schemaTables, void 0);
3413
3478
  __privateAdd$4(this, _trace, void 0);
3414
- __privateSet$4(this, _table, options.table);
3415
- __privateSet$4(this, _db, options.db);
3416
- __privateSet$4(this, _cache, options.pluginOptions.cache);
3417
- __privateSet$4(this, _schemaTables$2, options.schemaTables);
3418
- __privateSet$4(this, _getFetchProps, () => ({ ...options.pluginOptions, sessionID: generateUUID() }));
3479
+ __privateSet$2(this, _table, options.table);
3480
+ __privateSet$2(this, _db, options.db);
3481
+ __privateSet$2(this, _cache, options.pluginOptions.cache);
3482
+ __privateSet$2(this, _schemaTables, options.schemaTables);
3483
+ __privateSet$2(this, _getFetchProps, () => ({ ...options.pluginOptions, sessionID: generateUUID() }));
3419
3484
  const trace = options.pluginOptions.trace ?? defaultTrace;
3420
- __privateSet$4(this, _trace, async (name, fn, options2 = {}) => {
3485
+ __privateSet$2(this, _trace, async (name, fn, options2 = {}) => {
3421
3486
  return trace(name, fn, {
3422
3487
  ...options2,
3423
- [TraceAttributes.TABLE]: __privateGet$4(this, _table),
3488
+ [TraceAttributes.TABLE]: __privateGet$3(this, _table),
3424
3489
  [TraceAttributes.KIND]: "sdk-operation",
3425
3490
  [TraceAttributes.VERSION]: VERSION
3426
3491
  });
3427
3492
  });
3428
3493
  }
3429
3494
  async create(a, b, c, d) {
3430
- return __privateGet$4(this, _trace).call(this, "create", async () => {
3495
+ return __privateGet$3(this, _trace).call(this, "create", async () => {
3431
3496
  const ifVersion = parseIfVersion(b, c, d);
3432
3497
  if (Array.isArray(a)) {
3433
3498
  if (a.length === 0)
@@ -3457,7 +3522,7 @@ class RestRepository extends Query {
3457
3522
  });
3458
3523
  }
3459
3524
  async read(a, b) {
3460
- return __privateGet$4(this, _trace).call(this, "read", async () => {
3525
+ return __privateGet$3(this, _trace).call(this, "read", async () => {
3461
3526
  const columns = isValidSelectableColumns(b) ? b : ["*"];
3462
3527
  if (Array.isArray(a)) {
3463
3528
  if (a.length === 0)
@@ -3478,17 +3543,17 @@ class RestRepository extends Query {
3478
3543
  workspace: "{workspaceId}",
3479
3544
  dbBranchName: "{dbBranch}",
3480
3545
  region: "{region}",
3481
- tableName: __privateGet$4(this, _table),
3546
+ tableName: __privateGet$3(this, _table),
3482
3547
  recordId: id
3483
3548
  },
3484
3549
  queryParams: { columns },
3485
- ...__privateGet$4(this, _getFetchProps).call(this)
3550
+ ...__privateGet$3(this, _getFetchProps).call(this)
3486
3551
  });
3487
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3552
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3488
3553
  return initObject(
3489
- __privateGet$4(this, _db),
3554
+ __privateGet$3(this, _db),
3490
3555
  schemaTables,
3491
- __privateGet$4(this, _table),
3556
+ __privateGet$3(this, _table),
3492
3557
  response,
3493
3558
  columns
3494
3559
  );
@@ -3503,7 +3568,7 @@ class RestRepository extends Query {
3503
3568
  });
3504
3569
  }
3505
3570
  async readOrThrow(a, b) {
3506
- return __privateGet$4(this, _trace).call(this, "readOrThrow", async () => {
3571
+ return __privateGet$3(this, _trace).call(this, "readOrThrow", async () => {
3507
3572
  const result = await this.read(a, b);
3508
3573
  if (Array.isArray(result)) {
3509
3574
  const missingIds = compact(
@@ -3522,7 +3587,7 @@ class RestRepository extends Query {
3522
3587
  });
3523
3588
  }
3524
3589
  async update(a, b, c, d) {
3525
- return __privateGet$4(this, _trace).call(this, "update", async () => {
3590
+ return __privateGet$3(this, _trace).call(this, "update", async () => {
3526
3591
  const ifVersion = parseIfVersion(b, c, d);
3527
3592
  if (Array.isArray(a)) {
3528
3593
  if (a.length === 0)
@@ -3555,7 +3620,7 @@ class RestRepository extends Query {
3555
3620
  });
3556
3621
  }
3557
3622
  async updateOrThrow(a, b, c, d) {
3558
- return __privateGet$4(this, _trace).call(this, "updateOrThrow", async () => {
3623
+ return __privateGet$3(this, _trace).call(this, "updateOrThrow", async () => {
3559
3624
  const result = await this.update(a, b, c, d);
3560
3625
  if (Array.isArray(result)) {
3561
3626
  const missingIds = compact(
@@ -3574,7 +3639,7 @@ class RestRepository extends Query {
3574
3639
  });
3575
3640
  }
3576
3641
  async createOrUpdate(a, b, c, d) {
3577
- return __privateGet$4(this, _trace).call(this, "createOrUpdate", async () => {
3642
+ return __privateGet$3(this, _trace).call(this, "createOrUpdate", async () => {
3578
3643
  const ifVersion = parseIfVersion(b, c, d);
3579
3644
  if (Array.isArray(a)) {
3580
3645
  if (a.length === 0)
@@ -3609,7 +3674,7 @@ class RestRepository extends Query {
3609
3674
  });
3610
3675
  }
3611
3676
  async createOrReplace(a, b, c, d) {
3612
- return __privateGet$4(this, _trace).call(this, "createOrReplace", async () => {
3677
+ return __privateGet$3(this, _trace).call(this, "createOrReplace", async () => {
3613
3678
  const ifVersion = parseIfVersion(b, c, d);
3614
3679
  if (Array.isArray(a)) {
3615
3680
  if (a.length === 0)
@@ -3641,7 +3706,7 @@ class RestRepository extends Query {
3641
3706
  });
3642
3707
  }
3643
3708
  async delete(a, b) {
3644
- return __privateGet$4(this, _trace).call(this, "delete", async () => {
3709
+ return __privateGet$3(this, _trace).call(this, "delete", async () => {
3645
3710
  if (Array.isArray(a)) {
3646
3711
  if (a.length === 0)
3647
3712
  return [];
@@ -3667,7 +3732,7 @@ class RestRepository extends Query {
3667
3732
  });
3668
3733
  }
3669
3734
  async deleteOrThrow(a, b) {
3670
- return __privateGet$4(this, _trace).call(this, "deleteOrThrow", async () => {
3735
+ return __privateGet$3(this, _trace).call(this, "deleteOrThrow", async () => {
3671
3736
  const result = await this.delete(a, b);
3672
3737
  if (Array.isArray(result)) {
3673
3738
  const missingIds = compact(
@@ -3685,13 +3750,13 @@ class RestRepository extends Query {
3685
3750
  });
3686
3751
  }
3687
3752
  async search(query, options = {}) {
3688
- return __privateGet$4(this, _trace).call(this, "search", async () => {
3753
+ return __privateGet$3(this, _trace).call(this, "search", async () => {
3689
3754
  const { records, totalCount } = await searchTable({
3690
3755
  pathParams: {
3691
3756
  workspace: "{workspaceId}",
3692
3757
  dbBranchName: "{dbBranch}",
3693
3758
  region: "{region}",
3694
- tableName: __privateGet$4(this, _table)
3759
+ tableName: __privateGet$3(this, _table)
3695
3760
  },
3696
3761
  body: {
3697
3762
  query,
@@ -3703,23 +3768,23 @@ class RestRepository extends Query {
3703
3768
  page: options.page,
3704
3769
  target: options.target
3705
3770
  },
3706
- ...__privateGet$4(this, _getFetchProps).call(this)
3771
+ ...__privateGet$3(this, _getFetchProps).call(this)
3707
3772
  });
3708
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3773
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3709
3774
  return {
3710
- records: records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"])),
3775
+ records: records.map((item) => initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), item, ["*"])),
3711
3776
  totalCount
3712
3777
  };
3713
3778
  });
3714
3779
  }
3715
3780
  async vectorSearch(column, query, options) {
3716
- return __privateGet$4(this, _trace).call(this, "vectorSearch", async () => {
3781
+ return __privateGet$3(this, _trace).call(this, "vectorSearch", async () => {
3717
3782
  const { records, totalCount } = await vectorSearchTable({
3718
3783
  pathParams: {
3719
3784
  workspace: "{workspaceId}",
3720
3785
  dbBranchName: "{dbBranch}",
3721
3786
  region: "{region}",
3722
- tableName: __privateGet$4(this, _table)
3787
+ tableName: __privateGet$3(this, _table)
3723
3788
  },
3724
3789
  body: {
3725
3790
  column,
@@ -3728,32 +3793,32 @@ class RestRepository extends Query {
3728
3793
  size: options?.size,
3729
3794
  filter: options?.filter
3730
3795
  },
3731
- ...__privateGet$4(this, _getFetchProps).call(this)
3796
+ ...__privateGet$3(this, _getFetchProps).call(this)
3732
3797
  });
3733
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3798
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3734
3799
  return {
3735
- records: records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"])),
3800
+ records: records.map((item) => initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), item, ["*"])),
3736
3801
  totalCount
3737
3802
  };
3738
3803
  });
3739
3804
  }
3740
3805
  async aggregate(aggs, filter) {
3741
- return __privateGet$4(this, _trace).call(this, "aggregate", async () => {
3806
+ return __privateGet$3(this, _trace).call(this, "aggregate", async () => {
3742
3807
  const result = await aggregateTable({
3743
3808
  pathParams: {
3744
3809
  workspace: "{workspaceId}",
3745
3810
  dbBranchName: "{dbBranch}",
3746
3811
  region: "{region}",
3747
- tableName: __privateGet$4(this, _table)
3812
+ tableName: __privateGet$3(this, _table)
3748
3813
  },
3749
3814
  body: { aggs, filter },
3750
- ...__privateGet$4(this, _getFetchProps).call(this)
3815
+ ...__privateGet$3(this, _getFetchProps).call(this)
3751
3816
  });
3752
3817
  return result;
3753
3818
  });
3754
3819
  }
3755
3820
  async query(query) {
3756
- return __privateGet$4(this, _trace).call(this, "query", async () => {
3821
+ return __privateGet$3(this, _trace).call(this, "query", async () => {
3757
3822
  const cacheQuery = await __privateMethod$2(this, _getCacheQuery, getCacheQuery_fn).call(this, query);
3758
3823
  if (cacheQuery)
3759
3824
  return new Page(query, cacheQuery.meta, cacheQuery.records);
@@ -3763,7 +3828,7 @@ class RestRepository extends Query {
3763
3828
  workspace: "{workspaceId}",
3764
3829
  dbBranchName: "{dbBranch}",
3765
3830
  region: "{region}",
3766
- tableName: __privateGet$4(this, _table)
3831
+ tableName: __privateGet$3(this, _table)
3767
3832
  },
3768
3833
  body: {
3769
3834
  filter: cleanFilter(data.filter),
@@ -3773,14 +3838,14 @@ class RestRepository extends Query {
3773
3838
  consistency: data.consistency
3774
3839
  },
3775
3840
  fetchOptions: data.fetchOptions,
3776
- ...__privateGet$4(this, _getFetchProps).call(this)
3841
+ ...__privateGet$3(this, _getFetchProps).call(this)
3777
3842
  });
3778
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3843
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3779
3844
  const records = objects.map(
3780
3845
  (record) => initObject(
3781
- __privateGet$4(this, _db),
3846
+ __privateGet$3(this, _db),
3782
3847
  schemaTables,
3783
- __privateGet$4(this, _table),
3848
+ __privateGet$3(this, _table),
3784
3849
  record,
3785
3850
  data.columns ?? ["*"]
3786
3851
  )
@@ -3790,14 +3855,14 @@ class RestRepository extends Query {
3790
3855
  });
3791
3856
  }
3792
3857
  async summarizeTable(query, summaries, summariesFilter) {
3793
- return __privateGet$4(this, _trace).call(this, "summarize", async () => {
3858
+ return __privateGet$3(this, _trace).call(this, "summarize", async () => {
3794
3859
  const data = query.getQueryOptions();
3795
3860
  const result = await summarizeTable({
3796
3861
  pathParams: {
3797
3862
  workspace: "{workspaceId}",
3798
3863
  dbBranchName: "{dbBranch}",
3799
3864
  region: "{region}",
3800
- tableName: __privateGet$4(this, _table)
3865
+ tableName: __privateGet$3(this, _table)
3801
3866
  },
3802
3867
  body: {
3803
3868
  filter: cleanFilter(data.filter),
@@ -3808,13 +3873,13 @@ class RestRepository extends Query {
3808
3873
  summaries,
3809
3874
  summariesFilter
3810
3875
  },
3811
- ...__privateGet$4(this, _getFetchProps).call(this)
3876
+ ...__privateGet$3(this, _getFetchProps).call(this)
3812
3877
  });
3813
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3878
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3814
3879
  return {
3815
3880
  ...result,
3816
3881
  summaries: result.summaries.map(
3817
- (summary) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), summary, data.columns ?? [])
3882
+ (summary) => initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), summary, data.columns ?? [])
3818
3883
  )
3819
3884
  };
3820
3885
  });
@@ -3826,7 +3891,7 @@ class RestRepository extends Query {
3826
3891
  workspace: "{workspaceId}",
3827
3892
  dbBranchName: "{dbBranch}",
3828
3893
  region: "{region}",
3829
- tableName: __privateGet$4(this, _table),
3894
+ tableName: __privateGet$3(this, _table),
3830
3895
  sessionId: options?.sessionId
3831
3896
  },
3832
3897
  body: {
@@ -3836,7 +3901,7 @@ class RestRepository extends Query {
3836
3901
  search: options?.searchType === "keyword" ? options?.search : void 0,
3837
3902
  vectorSearch: options?.searchType === "vector" ? options?.vectorSearch : void 0
3838
3903
  },
3839
- ...__privateGet$4(this, _getFetchProps).call(this)
3904
+ ...__privateGet$3(this, _getFetchProps).call(this)
3840
3905
  };
3841
3906
  if (options?.onMessage) {
3842
3907
  fetchSSERequest({
@@ -3857,7 +3922,7 @@ _table = new WeakMap();
3857
3922
  _getFetchProps = new WeakMap();
3858
3923
  _db = new WeakMap();
3859
3924
  _cache = new WeakMap();
3860
- _schemaTables$2 = new WeakMap();
3925
+ _schemaTables = new WeakMap();
3861
3926
  _trace = new WeakMap();
3862
3927
  _insertRecordWithoutId = new WeakSet();
3863
3928
  insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
@@ -3867,14 +3932,14 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
3867
3932
  workspace: "{workspaceId}",
3868
3933
  dbBranchName: "{dbBranch}",
3869
3934
  region: "{region}",
3870
- tableName: __privateGet$4(this, _table)
3935
+ tableName: __privateGet$3(this, _table)
3871
3936
  },
3872
3937
  queryParams: { columns },
3873
3938
  body: record,
3874
- ...__privateGet$4(this, _getFetchProps).call(this)
3939
+ ...__privateGet$3(this, _getFetchProps).call(this)
3875
3940
  });
3876
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3877
- return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
3941
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3942
+ return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
3878
3943
  };
3879
3944
  _insertRecordWithId = new WeakSet();
3880
3945
  insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
@@ -3886,21 +3951,21 @@ insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { crea
3886
3951
  workspace: "{workspaceId}",
3887
3952
  dbBranchName: "{dbBranch}",
3888
3953
  region: "{region}",
3889
- tableName: __privateGet$4(this, _table),
3954
+ tableName: __privateGet$3(this, _table),
3890
3955
  recordId
3891
3956
  },
3892
3957
  body: record,
3893
3958
  queryParams: { createOnly, columns, ifVersion },
3894
- ...__privateGet$4(this, _getFetchProps).call(this)
3959
+ ...__privateGet$3(this, _getFetchProps).call(this)
3895
3960
  });
3896
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3897
- return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
3961
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3962
+ return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
3898
3963
  };
3899
3964
  _insertRecords = new WeakSet();
3900
3965
  insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
3901
3966
  const operations = await promiseMap(objects, async (object) => {
3902
3967
  const record = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
3903
- return { insert: { table: __privateGet$4(this, _table), record, createOnly, ifVersion } };
3968
+ return { insert: { table: __privateGet$3(this, _table), record, createOnly, ifVersion } };
3904
3969
  });
3905
3970
  const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
3906
3971
  const ids = [];
@@ -3912,7 +3977,7 @@ insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
3912
3977
  region: "{region}"
3913
3978
  },
3914
3979
  body: { operations: operations2 },
3915
- ...__privateGet$4(this, _getFetchProps).call(this)
3980
+ ...__privateGet$3(this, _getFetchProps).call(this)
3916
3981
  });
3917
3982
  for (const result of results) {
3918
3983
  if (result.operation === "insert") {
@@ -3935,15 +4000,15 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
3935
4000
  workspace: "{workspaceId}",
3936
4001
  dbBranchName: "{dbBranch}",
3937
4002
  region: "{region}",
3938
- tableName: __privateGet$4(this, _table),
4003
+ tableName: __privateGet$3(this, _table),
3939
4004
  recordId
3940
4005
  },
3941
4006
  queryParams: { columns, ifVersion },
3942
4007
  body: record,
3943
- ...__privateGet$4(this, _getFetchProps).call(this)
4008
+ ...__privateGet$3(this, _getFetchProps).call(this)
3944
4009
  });
3945
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3946
- return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
4010
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
4011
+ return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
3947
4012
  } catch (e) {
3948
4013
  if (isObject(e) && e.status === 404) {
3949
4014
  return null;
@@ -3955,7 +4020,7 @@ _updateRecords = new WeakSet();
3955
4020
  updateRecords_fn = async function(objects, { ifVersion, upsert }) {
3956
4021
  const operations = await promiseMap(objects, async ({ id, ...object }) => {
3957
4022
  const fields = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
3958
- return { update: { table: __privateGet$4(this, _table), id, ifVersion, upsert, fields } };
4023
+ return { update: { table: __privateGet$3(this, _table), id, ifVersion, upsert, fields } };
3959
4024
  });
3960
4025
  const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
3961
4026
  const ids = [];
@@ -3967,7 +4032,7 @@ updateRecords_fn = async function(objects, { ifVersion, upsert }) {
3967
4032
  region: "{region}"
3968
4033
  },
3969
4034
  body: { operations: operations2 },
3970
- ...__privateGet$4(this, _getFetchProps).call(this)
4035
+ ...__privateGet$3(this, _getFetchProps).call(this)
3971
4036
  });
3972
4037
  for (const result of results) {
3973
4038
  if (result.operation === "update") {
@@ -3988,15 +4053,15 @@ upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
3988
4053
  workspace: "{workspaceId}",
3989
4054
  dbBranchName: "{dbBranch}",
3990
4055
  region: "{region}",
3991
- tableName: __privateGet$4(this, _table),
4056
+ tableName: __privateGet$3(this, _table),
3992
4057
  recordId
3993
4058
  },
3994
4059
  queryParams: { columns, ifVersion },
3995
4060
  body: object,
3996
- ...__privateGet$4(this, _getFetchProps).call(this)
4061
+ ...__privateGet$3(this, _getFetchProps).call(this)
3997
4062
  });
3998
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3999
- return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
4063
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
4064
+ return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
4000
4065
  };
4001
4066
  _deleteRecord = new WeakSet();
4002
4067
  deleteRecord_fn = async function(recordId, columns = ["*"]) {
@@ -4008,14 +4073,14 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
4008
4073
  workspace: "{workspaceId}",
4009
4074
  dbBranchName: "{dbBranch}",
4010
4075
  region: "{region}",
4011
- tableName: __privateGet$4(this, _table),
4076
+ tableName: __privateGet$3(this, _table),
4012
4077
  recordId
4013
4078
  },
4014
4079
  queryParams: { columns },
4015
- ...__privateGet$4(this, _getFetchProps).call(this)
4080
+ ...__privateGet$3(this, _getFetchProps).call(this)
4016
4081
  });
4017
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
4018
- return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
4082
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
4083
+ return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
4019
4084
  } catch (e) {
4020
4085
  if (isObject(e) && e.status === 404) {
4021
4086
  return null;
@@ -4026,7 +4091,7 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
4026
4091
  _deleteRecords = new WeakSet();
4027
4092
  deleteRecords_fn = async function(recordIds) {
4028
4093
  const chunkedOperations = chunk(
4029
- compact(recordIds).map((id) => ({ delete: { table: __privateGet$4(this, _table), id } })),
4094
+ compact(recordIds).map((id) => ({ delete: { table: __privateGet$3(this, _table), id } })),
4030
4095
  BULK_OPERATION_MAX_SIZE
4031
4096
  );
4032
4097
  for (const operations of chunkedOperations) {
@@ -4037,44 +4102,44 @@ deleteRecords_fn = async function(recordIds) {
4037
4102
  region: "{region}"
4038
4103
  },
4039
4104
  body: { operations },
4040
- ...__privateGet$4(this, _getFetchProps).call(this)
4105
+ ...__privateGet$3(this, _getFetchProps).call(this)
4041
4106
  });
4042
4107
  }
4043
4108
  };
4044
4109
  _setCacheQuery = new WeakSet();
4045
4110
  setCacheQuery_fn = async function(query, meta, records) {
4046
- await __privateGet$4(this, _cache)?.set(`query_${__privateGet$4(this, _table)}:${query.key()}`, { date: /* @__PURE__ */ new Date(), meta, records });
4111
+ await __privateGet$3(this, _cache)?.set(`query_${__privateGet$3(this, _table)}:${query.key()}`, { date: /* @__PURE__ */ new Date(), meta, records });
4047
4112
  };
4048
4113
  _getCacheQuery = new WeakSet();
4049
4114
  getCacheQuery_fn = async function(query) {
4050
- const key = `query_${__privateGet$4(this, _table)}:${query.key()}`;
4051
- const result = await __privateGet$4(this, _cache)?.get(key);
4115
+ const key = `query_${__privateGet$3(this, _table)}:${query.key()}`;
4116
+ const result = await __privateGet$3(this, _cache)?.get(key);
4052
4117
  if (!result)
4053
4118
  return null;
4054
- const defaultTTL = __privateGet$4(this, _cache)?.defaultQueryTTL ?? -1;
4119
+ const defaultTTL = __privateGet$3(this, _cache)?.defaultQueryTTL ?? -1;
4055
4120
  const { cache: ttl = defaultTTL } = query.getQueryOptions();
4056
4121
  if (ttl < 0)
4057
4122
  return null;
4058
4123
  const hasExpired = result.date.getTime() + ttl < Date.now();
4059
4124
  return hasExpired ? null : result;
4060
4125
  };
4061
- _getSchemaTables$1 = new WeakSet();
4062
- getSchemaTables_fn$1 = async function() {
4063
- if (__privateGet$4(this, _schemaTables$2))
4064
- return __privateGet$4(this, _schemaTables$2);
4126
+ _getSchemaTables = new WeakSet();
4127
+ getSchemaTables_fn = async function() {
4128
+ if (__privateGet$3(this, _schemaTables))
4129
+ return __privateGet$3(this, _schemaTables);
4065
4130
  const { schema } = await getBranchDetails({
4066
4131
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4067
- ...__privateGet$4(this, _getFetchProps).call(this)
4132
+ ...__privateGet$3(this, _getFetchProps).call(this)
4068
4133
  });
4069
- __privateSet$4(this, _schemaTables$2, schema.tables);
4134
+ __privateSet$2(this, _schemaTables, schema.tables);
4070
4135
  return schema.tables;
4071
4136
  };
4072
4137
  _transformObjectToApi = new WeakSet();
4073
4138
  transformObjectToApi_fn = async function(object) {
4074
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
4075
- const schema = schemaTables.find((table) => table.name === __privateGet$4(this, _table));
4139
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
4140
+ const schema = schemaTables.find((table) => table.name === __privateGet$3(this, _table));
4076
4141
  if (!schema)
4077
- throw new Error(`Table ${__privateGet$4(this, _table)} not found in schema`);
4142
+ throw new Error(`Table ${__privateGet$3(this, _table)} not found in schema`);
4078
4143
  const result = {};
4079
4144
  for (const [key, value] of Object.entries(object)) {
4080
4145
  if (key === "xata")
@@ -4230,7 +4295,7 @@ var __accessCheck$3 = (obj, member, msg) => {
4230
4295
  if (!member.has(obj))
4231
4296
  throw TypeError("Cannot " + msg);
4232
4297
  };
4233
- var __privateGet$3 = (obj, member, getter) => {
4298
+ var __privateGet$2 = (obj, member, getter) => {
4234
4299
  __accessCheck$3(obj, member, "read from private field");
4235
4300
  return getter ? getter.call(obj) : member.get(obj);
4236
4301
  };
@@ -4239,7 +4304,7 @@ var __privateAdd$3 = (obj, member, value) => {
4239
4304
  throw TypeError("Cannot add the same private member more than once");
4240
4305
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
4241
4306
  };
4242
- var __privateSet$3 = (obj, member, value, setter) => {
4307
+ var __privateSet$1 = (obj, member, value, setter) => {
4243
4308
  __accessCheck$3(obj, member, "write to private field");
4244
4309
  setter ? setter.call(obj, value) : member.set(obj, value);
4245
4310
  return value;
@@ -4248,29 +4313,29 @@ var _map;
4248
4313
  class SimpleCache {
4249
4314
  constructor(options = {}) {
4250
4315
  __privateAdd$3(this, _map, void 0);
4251
- __privateSet$3(this, _map, /* @__PURE__ */ new Map());
4316
+ __privateSet$1(this, _map, /* @__PURE__ */ new Map());
4252
4317
  this.capacity = options.max ?? 500;
4253
4318
  this.defaultQueryTTL = options.defaultQueryTTL ?? 60 * 1e3;
4254
4319
  }
4255
4320
  async getAll() {
4256
- return Object.fromEntries(__privateGet$3(this, _map));
4321
+ return Object.fromEntries(__privateGet$2(this, _map));
4257
4322
  }
4258
4323
  async get(key) {
4259
- return __privateGet$3(this, _map).get(key) ?? null;
4324
+ return __privateGet$2(this, _map).get(key) ?? null;
4260
4325
  }
4261
4326
  async set(key, value) {
4262
4327
  await this.delete(key);
4263
- __privateGet$3(this, _map).set(key, value);
4264
- if (__privateGet$3(this, _map).size > this.capacity) {
4265
- const leastRecentlyUsed = __privateGet$3(this, _map).keys().next().value;
4328
+ __privateGet$2(this, _map).set(key, value);
4329
+ if (__privateGet$2(this, _map).size > this.capacity) {
4330
+ const leastRecentlyUsed = __privateGet$2(this, _map).keys().next().value;
4266
4331
  await this.delete(leastRecentlyUsed);
4267
4332
  }
4268
4333
  }
4269
4334
  async delete(key) {
4270
- __privateGet$3(this, _map).delete(key);
4335
+ __privateGet$2(this, _map).delete(key);
4271
4336
  }
4272
4337
  async clear() {
4273
- return __privateGet$3(this, _map).clear();
4338
+ return __privateGet$2(this, _map).clear();
4274
4339
  }
4275
4340
  }
4276
4341
  _map = new WeakMap();
@@ -4307,7 +4372,7 @@ var __accessCheck$2 = (obj, member, msg) => {
4307
4372
  if (!member.has(obj))
4308
4373
  throw TypeError("Cannot " + msg);
4309
4374
  };
4310
- var __privateGet$2 = (obj, member, getter) => {
4375
+ var __privateGet$1 = (obj, member, getter) => {
4311
4376
  __accessCheck$2(obj, member, "read from private field");
4312
4377
  return getter ? getter.call(obj) : member.get(obj);
4313
4378
  };
@@ -4316,18 +4381,11 @@ var __privateAdd$2 = (obj, member, value) => {
4316
4381
  throw TypeError("Cannot add the same private member more than once");
4317
4382
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
4318
4383
  };
4319
- var __privateSet$2 = (obj, member, value, setter) => {
4320
- __accessCheck$2(obj, member, "write to private field");
4321
- setter ? setter.call(obj, value) : member.set(obj, value);
4322
- return value;
4323
- };
4324
- var _tables, _schemaTables$1;
4384
+ var _tables;
4325
4385
  class SchemaPlugin extends XataPlugin {
4326
- constructor(schemaTables) {
4386
+ constructor() {
4327
4387
  super();
4328
4388
  __privateAdd$2(this, _tables, {});
4329
- __privateAdd$2(this, _schemaTables$1, void 0);
4330
- __privateSet$2(this, _schemaTables$1, schemaTables);
4331
4389
  }
4332
4390
  build(pluginOptions) {
4333
4391
  const db = new Proxy(
@@ -4336,22 +4394,21 @@ class SchemaPlugin extends XataPlugin {
4336
4394
  get: (_target, table) => {
4337
4395
  if (!isString(table))
4338
4396
  throw new Error("Invalid table name");
4339
- if (__privateGet$2(this, _tables)[table] === void 0) {
4340
- __privateGet$2(this, _tables)[table] = new RestRepository({ db, pluginOptions, table, schemaTables: __privateGet$2(this, _schemaTables$1) });
4397
+ if (__privateGet$1(this, _tables)[table] === void 0) {
4398
+ __privateGet$1(this, _tables)[table] = new RestRepository({ db, pluginOptions, table, schemaTables: pluginOptions.tables });
4341
4399
  }
4342
- return __privateGet$2(this, _tables)[table];
4400
+ return __privateGet$1(this, _tables)[table];
4343
4401
  }
4344
4402
  }
4345
4403
  );
4346
- const tableNames = __privateGet$2(this, _schemaTables$1)?.map(({ name }) => name) ?? [];
4404
+ const tableNames = pluginOptions.tables?.map(({ name }) => name) ?? [];
4347
4405
  for (const table of tableNames) {
4348
- db[table] = new RestRepository({ db, pluginOptions, table, schemaTables: __privateGet$2(this, _schemaTables$1) });
4406
+ db[table] = new RestRepository({ db, pluginOptions, table, schemaTables: pluginOptions.tables });
4349
4407
  }
4350
4408
  return db;
4351
4409
  }
4352
4410
  }
4353
4411
  _tables = new WeakMap();
4354
- _schemaTables$1 = new WeakMap();
4355
4412
 
4356
4413
  class FilesPlugin extends XataPlugin {
4357
4414
  build(pluginOptions) {
@@ -4431,54 +4488,40 @@ var __accessCheck$1 = (obj, member, msg) => {
4431
4488
  if (!member.has(obj))
4432
4489
  throw TypeError("Cannot " + msg);
4433
4490
  };
4434
- var __privateGet$1 = (obj, member, getter) => {
4435
- __accessCheck$1(obj, member, "read from private field");
4436
- return getter ? getter.call(obj) : member.get(obj);
4437
- };
4438
4491
  var __privateAdd$1 = (obj, member, value) => {
4439
4492
  if (member.has(obj))
4440
4493
  throw TypeError("Cannot add the same private member more than once");
4441
4494
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
4442
4495
  };
4443
- var __privateSet$1 = (obj, member, value, setter) => {
4444
- __accessCheck$1(obj, member, "write to private field");
4445
- setter ? setter.call(obj, value) : member.set(obj, value);
4446
- return value;
4447
- };
4448
4496
  var __privateMethod$1 = (obj, member, method) => {
4449
4497
  __accessCheck$1(obj, member, "access private method");
4450
4498
  return method;
4451
4499
  };
4452
- var _schemaTables, _search, search_fn, _getSchemaTables, getSchemaTables_fn;
4500
+ var _search, search_fn;
4453
4501
  class SearchPlugin extends XataPlugin {
4454
- constructor(db, schemaTables) {
4502
+ constructor(db) {
4455
4503
  super();
4456
4504
  this.db = db;
4457
4505
  __privateAdd$1(this, _search);
4458
- __privateAdd$1(this, _getSchemaTables);
4459
- __privateAdd$1(this, _schemaTables, void 0);
4460
- __privateSet$1(this, _schemaTables, schemaTables);
4461
4506
  }
4462
4507
  build(pluginOptions) {
4463
4508
  return {
4464
4509
  all: async (query, options = {}) => {
4465
4510
  const { records, totalCount } = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4466
- const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, pluginOptions);
4467
4511
  return {
4468
4512
  totalCount,
4469
4513
  records: records.map((record) => {
4470
4514
  const { table = "orphan" } = record.xata;
4471
- return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
4515
+ return { table, record: initObject(this.db, pluginOptions.tables, table, record, ["*"]) };
4472
4516
  })
4473
4517
  };
4474
4518
  },
4475
4519
  byTable: async (query, options = {}) => {
4476
4520
  const { records: rawRecords, totalCount } = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4477
- const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, pluginOptions);
4478
4521
  const records = rawRecords.reduce((acc, record) => {
4479
4522
  const { table = "orphan" } = record.xata;
4480
4523
  const items = acc[table] ?? [];
4481
- const item = initObject(this.db, schemaTables, table, record, ["*"]);
4524
+ const item = initObject(this.db, pluginOptions.tables, table, record, ["*"]);
4482
4525
  return { ...acc, [table]: [...items, item] };
4483
4526
  }, {});
4484
4527
  return { totalCount, records };
@@ -4486,29 +4529,17 @@ class SearchPlugin extends XataPlugin {
4486
4529
  };
4487
4530
  }
4488
4531
  }
4489
- _schemaTables = new WeakMap();
4490
4532
  _search = new WeakSet();
4491
4533
  search_fn = async function(query, options, pluginOptions) {
4492
4534
  const { tables, fuzziness, highlight, prefix, page } = options ?? {};
4493
4535
  const { records, totalCount } = await searchBranch({
4494
4536
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4495
- // @ts-ignore https://github.com/xataio/client-ts/issues/313
4537
+ // @ts-expect-error Filter properties do not match inferred type
4496
4538
  body: { tables, query, fuzziness, prefix, highlight, page },
4497
4539
  ...pluginOptions
4498
4540
  });
4499
4541
  return { records, totalCount };
4500
4542
  };
4501
- _getSchemaTables = new WeakSet();
4502
- getSchemaTables_fn = async function(pluginOptions) {
4503
- if (__privateGet$1(this, _schemaTables))
4504
- return __privateGet$1(this, _schemaTables);
4505
- const { schema } = await getBranchDetails({
4506
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4507
- ...pluginOptions
4508
- });
4509
- __privateSet$1(this, _schemaTables, schema.tables);
4510
- return schema.tables;
4511
- };
4512
4543
 
4513
4544
  function escapeElement(elementRepresentation) {
4514
4545
  const escaped = elementRepresentation.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
@@ -4562,25 +4593,39 @@ function prepareParams(param1, param2) {
4562
4593
  return { statement, params: param2?.map((value) => prepareValue(value)) };
4563
4594
  }
4564
4595
  if (isObject(param1)) {
4565
- const { statement, params, consistency } = param1;
4566
- return { statement, params: params?.map((value) => prepareValue(value)), consistency };
4596
+ const { statement, params, consistency, responseType } = param1;
4597
+ return { statement, params: params?.map((value) => prepareValue(value)), consistency, responseType };
4567
4598
  }
4568
4599
  throw new Error("Invalid query");
4569
4600
  }
4570
4601
 
4571
4602
  class SQLPlugin extends XataPlugin {
4572
4603
  build(pluginOptions) {
4573
- return async (param1, ...param2) => {
4574
- const { statement, params, consistency } = prepareParams(param1, param2);
4575
- const { records, warning } = await sqlQuery({
4604
+ return async (query, ...parameters) => {
4605
+ if (!isParamsObject(query) && (!isTemplateStringsArray(query) || !Array.isArray(parameters))) {
4606
+ throw new Error("Invalid usage of `xata.sql`. Please use it as a tagged template or with an object.");
4607
+ }
4608
+ const { statement, params, consistency, responseType } = prepareParams(query, parameters);
4609
+ const {
4610
+ records,
4611
+ rows,
4612
+ warning,
4613
+ columns = []
4614
+ } = await sqlQuery({
4576
4615
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4577
- body: { statement, params, consistency },
4616
+ body: { statement, params, consistency, responseType },
4578
4617
  ...pluginOptions
4579
4618
  });
4580
- return { records, warning };
4619
+ return { records, rows, warning, columns };
4581
4620
  };
4582
4621
  }
4583
4622
  }
4623
+ function isTemplateStringsArray(strings) {
4624
+ return Array.isArray(strings) && "raw" in strings && Array.isArray(strings.raw);
4625
+ }
4626
+ function isParamsObject(params) {
4627
+ return isObject(params) && "statement" in params;
4628
+ }
4584
4629
 
4585
4630
  class TransactionPlugin extends XataPlugin {
4586
4631
  build(pluginOptions) {
@@ -4622,7 +4667,7 @@ var __privateMethod = (obj, member, method) => {
4622
4667
  const buildClient = (plugins) => {
4623
4668
  var _options, _parseOptions, parseOptions_fn, _getFetchProps, getFetchProps_fn, _a;
4624
4669
  return _a = class {
4625
- constructor(options = {}, schemaTables) {
4670
+ constructor(options = {}, tables) {
4626
4671
  __privateAdd(this, _parseOptions);
4627
4672
  __privateAdd(this, _getFetchProps);
4628
4673
  __privateAdd(this, _options, void 0);
@@ -4631,13 +4676,15 @@ const buildClient = (plugins) => {
4631
4676
  const pluginOptions = {
4632
4677
  ...__privateMethod(this, _getFetchProps, getFetchProps_fn).call(this, safeOptions),
4633
4678
  cache: safeOptions.cache,
4634
- host: safeOptions.host
4679
+ host: safeOptions.host,
4680
+ tables
4635
4681
  };
4636
- const db = new SchemaPlugin(schemaTables).build(pluginOptions);
4637
- const search = new SearchPlugin(db, schemaTables).build(pluginOptions);
4682
+ const db = new SchemaPlugin().build(pluginOptions);
4683
+ const search = new SearchPlugin(db).build(pluginOptions);
4638
4684
  const transactions = new TransactionPlugin().build(pluginOptions);
4639
4685
  const sql = new SQLPlugin().build(pluginOptions);
4640
4686
  const files = new FilesPlugin().build(pluginOptions);
4687
+ this.schema = { tables };
4641
4688
  this.db = db;
4642
4689
  this.search = search;
4643
4690
  this.transactions = transactions;
@@ -4659,7 +4706,7 @@ const buildClient = (plugins) => {
4659
4706
  const isBrowser = typeof window !== "undefined" && typeof Deno === "undefined";
4660
4707
  if (isBrowser && !enableBrowser) {
4661
4708
  throw new Error(
4662
- "You are trying to use Xata from the browser, which is potentially a non-secure environment. If you understand the security concerns, such as leaking your credentials, pass `enableBrowser: true` to the client options to remove this error."
4709
+ "You are trying to use Xata from the browser, which is potentially a non-secure environment. How to fix: https://xata.io/docs/messages/api-key-browser-error"
4663
4710
  );
4664
4711
  }
4665
4712
  const fetch = getFetchImplementation(options?.fetch);
@@ -4822,6 +4869,7 @@ exports.PAGINATION_DEFAULT_SIZE = PAGINATION_DEFAULT_SIZE;
4822
4869
  exports.PAGINATION_MAX_OFFSET = PAGINATION_MAX_OFFSET;
4823
4870
  exports.PAGINATION_MAX_SIZE = PAGINATION_MAX_SIZE;
4824
4871
  exports.Page = Page;
4872
+ exports.PageRecordArray = PageRecordArray;
4825
4873
  exports.Query = Query;
4826
4874
  exports.RecordArray = RecordArray;
4827
4875
  exports.RecordColumnTypes = RecordColumnTypes;
@@ -4839,6 +4887,7 @@ exports.XataError = XataError;
4839
4887
  exports.XataFile = XataFile;
4840
4888
  exports.XataPlugin = XataPlugin;
4841
4889
  exports.acceptWorkspaceMemberInvite = acceptWorkspaceMemberInvite;
4890
+ exports.adaptTable = adaptTable;
4842
4891
  exports.addGitBranchesEntry = addGitBranchesEntry;
4843
4892
  exports.addTableColumn = addTableColumn;
4844
4893
  exports.aggregateTable = aggregateTable;
@@ -4892,6 +4941,7 @@ exports.getBranchDetails = getBranchDetails;
4892
4941
  exports.getBranchList = getBranchList;
4893
4942
  exports.getBranchMetadata = getBranchMetadata;
4894
4943
  exports.getBranchMigrationHistory = getBranchMigrationHistory;
4944
+ exports.getBranchMigrationJobStatus = getBranchMigrationJobStatus;
4895
4945
  exports.getBranchMigrationPlan = getBranchMigrationPlan;
4896
4946
  exports.getBranchSchemaHistory = getBranchSchemaHistory;
4897
4947
  exports.getBranchStats = getBranchStats;
@@ -4900,11 +4950,14 @@ exports.getColumn = getColumn;
4900
4950
  exports.getDatabaseGithubSettings = getDatabaseGithubSettings;
4901
4951
  exports.getDatabaseList = getDatabaseList;
4902
4952
  exports.getDatabaseMetadata = getDatabaseMetadata;
4953
+ exports.getDatabaseSettings = getDatabaseSettings;
4903
4954
  exports.getDatabaseURL = getDatabaseURL;
4904
4955
  exports.getFile = getFile;
4905
4956
  exports.getFileItem = getFileItem;
4906
4957
  exports.getGitBranchesMapping = getGitBranchesMapping;
4907
4958
  exports.getHostUrl = getHostUrl;
4959
+ exports.getMigrationHistory = getMigrationHistory;
4960
+ exports.getMigrationJobStatus = getMigrationJobStatus;
4908
4961
  exports.getMigrationRequest = getMigrationRequest;
4909
4962
  exports.getMigrationRequestIsMerged = getMigrationRequestIsMerged;
4910
4963
  exports.getPreviewBranch = getPreviewBranch;
@@ -4918,6 +4971,7 @@ exports.getUserOAuthAccessTokens = getUserOAuthAccessTokens;
4918
4971
  exports.getUserOAuthClients = getUserOAuthClients;
4919
4972
  exports.getWorkspace = getWorkspace;
4920
4973
  exports.getWorkspaceMembersList = getWorkspaceMembersList;
4974
+ exports.getWorkspaceSettings = getWorkspaceSettings;
4921
4975
  exports.getWorkspacesList = getWorkspacesList;
4922
4976
  exports.grantAuthorizationCode = grantAuthorizationCode;
4923
4977
  exports.greaterEquals = greaterEquals;
@@ -4958,9 +5012,6 @@ exports.operationsByTag = operationsByTag;
4958
5012
  exports.parseProviderString = parseProviderString;
4959
5013
  exports.parseWorkspacesUrlParts = parseWorkspacesUrlParts;
4960
5014
  exports.pattern = pattern;
4961
- exports.pgRollJobStatus = pgRollJobStatus;
4962
- exports.pgRollMigrationHistory = pgRollMigrationHistory;
4963
- exports.pgRollStatus = pgRollStatus;
4964
5015
  exports.previewBranchSchemaEdit = previewBranchSchemaEdit;
4965
5016
  exports.pushBranchMigrations = pushBranchMigrations;
4966
5017
  exports.putFile = putFile;
@@ -4986,6 +5037,7 @@ exports.updateCluster = updateCluster;
4986
5037
  exports.updateColumn = updateColumn;
4987
5038
  exports.updateDatabaseGithubSettings = updateDatabaseGithubSettings;
4988
5039
  exports.updateDatabaseMetadata = updateDatabaseMetadata;
5040
+ exports.updateDatabaseSettings = updateDatabaseSettings;
4989
5041
  exports.updateMigrationRequest = updateMigrationRequest;
4990
5042
  exports.updateOAuthAccessToken = updateOAuthAccessToken;
4991
5043
  exports.updateRecordWithID = updateRecordWithID;
@@ -4994,6 +5046,7 @@ exports.updateUser = updateUser;
4994
5046
  exports.updateWorkspace = updateWorkspace;
4995
5047
  exports.updateWorkspaceMemberInvite = updateWorkspaceMemberInvite;
4996
5048
  exports.updateWorkspaceMemberRole = updateWorkspaceMemberRole;
5049
+ exports.updateWorkspaceSettings = updateWorkspaceSettings;
4997
5050
  exports.upsertRecordWithID = upsertRecordWithID;
4998
5051
  exports.vectorSearchTable = vectorSearchTable;
4999
5052
  //# sourceMappingURL=index.cjs.map