@xata.io/client 0.0.0-alpha.vf55585d9b3ddcdd6254b3a79c108fa99863f7685 → 0.0.0-alpha.vf58a3c229cee57bd4c4c22a72c3826618cdc9b94

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.4";
531
+ const VERSION = "0.29.0";
532
532
 
533
533
  class ErrorWithCause extends Error {
534
534
  constructor(message, options) {
@@ -1349,7 +1349,7 @@ var __accessCheck$7 = (obj, member, msg) => {
1349
1349
  if (!member.has(obj))
1350
1350
  throw TypeError("Cannot " + msg);
1351
1351
  };
1352
- var __privateGet$7 = (obj, member, getter) => {
1352
+ var __privateGet$6 = (obj, member, getter) => {
1353
1353
  __accessCheck$7(obj, member, "read from private field");
1354
1354
  return getter ? getter.call(obj) : member.get(obj);
1355
1355
  };
@@ -1358,7 +1358,7 @@ var __privateAdd$7 = (obj, member, value) => {
1358
1358
  throw TypeError("Cannot add the same private member more than once");
1359
1359
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1360
1360
  };
1361
- var __privateSet$7 = (obj, member, value, setter) => {
1361
+ var __privateSet$5 = (obj, member, value, setter) => {
1362
1362
  __accessCheck$7(obj, member, "write to private field");
1363
1363
  setter ? setter.call(obj, value) : member.set(obj, value);
1364
1364
  return value;
@@ -1375,7 +1375,7 @@ class XataApiClient {
1375
1375
  if (!apiKey) {
1376
1376
  throw new Error("Could not resolve a valid apiKey");
1377
1377
  }
1378
- __privateSet$7(this, _extraProps, {
1378
+ __privateSet$5(this, _extraProps, {
1379
1379
  apiUrl: getHostUrl(provider, "main"),
1380
1380
  workspacesApiUrl: getHostUrl(provider, "workspaces"),
1381
1381
  fetch: getFetchImplementation(options.fetch),
@@ -1387,64 +1387,64 @@ class XataApiClient {
1387
1387
  });
1388
1388
  }
1389
1389
  get user() {
1390
- if (!__privateGet$7(this, _namespaces).user)
1391
- __privateGet$7(this, _namespaces).user = new UserApi(__privateGet$7(this, _extraProps));
1392
- return __privateGet$7(this, _namespaces).user;
1390
+ if (!__privateGet$6(this, _namespaces).user)
1391
+ __privateGet$6(this, _namespaces).user = new UserApi(__privateGet$6(this, _extraProps));
1392
+ return __privateGet$6(this, _namespaces).user;
1393
1393
  }
1394
1394
  get authentication() {
1395
- if (!__privateGet$7(this, _namespaces).authentication)
1396
- __privateGet$7(this, _namespaces).authentication = new AuthenticationApi(__privateGet$7(this, _extraProps));
1397
- return __privateGet$7(this, _namespaces).authentication;
1395
+ if (!__privateGet$6(this, _namespaces).authentication)
1396
+ __privateGet$6(this, _namespaces).authentication = new AuthenticationApi(__privateGet$6(this, _extraProps));
1397
+ return __privateGet$6(this, _namespaces).authentication;
1398
1398
  }
1399
1399
  get workspaces() {
1400
- if (!__privateGet$7(this, _namespaces).workspaces)
1401
- __privateGet$7(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$7(this, _extraProps));
1402
- return __privateGet$7(this, _namespaces).workspaces;
1400
+ if (!__privateGet$6(this, _namespaces).workspaces)
1401
+ __privateGet$6(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$6(this, _extraProps));
1402
+ return __privateGet$6(this, _namespaces).workspaces;
1403
1403
  }
1404
1404
  get invites() {
1405
- if (!__privateGet$7(this, _namespaces).invites)
1406
- __privateGet$7(this, _namespaces).invites = new InvitesApi(__privateGet$7(this, _extraProps));
1407
- return __privateGet$7(this, _namespaces).invites;
1405
+ if (!__privateGet$6(this, _namespaces).invites)
1406
+ __privateGet$6(this, _namespaces).invites = new InvitesApi(__privateGet$6(this, _extraProps));
1407
+ return __privateGet$6(this, _namespaces).invites;
1408
1408
  }
1409
1409
  get database() {
1410
- if (!__privateGet$7(this, _namespaces).database)
1411
- __privateGet$7(this, _namespaces).database = new DatabaseApi(__privateGet$7(this, _extraProps));
1412
- return __privateGet$7(this, _namespaces).database;
1410
+ if (!__privateGet$6(this, _namespaces).database)
1411
+ __privateGet$6(this, _namespaces).database = new DatabaseApi(__privateGet$6(this, _extraProps));
1412
+ return __privateGet$6(this, _namespaces).database;
1413
1413
  }
1414
1414
  get branches() {
1415
- if (!__privateGet$7(this, _namespaces).branches)
1416
- __privateGet$7(this, _namespaces).branches = new BranchApi(__privateGet$7(this, _extraProps));
1417
- return __privateGet$7(this, _namespaces).branches;
1415
+ if (!__privateGet$6(this, _namespaces).branches)
1416
+ __privateGet$6(this, _namespaces).branches = new BranchApi(__privateGet$6(this, _extraProps));
1417
+ return __privateGet$6(this, _namespaces).branches;
1418
1418
  }
1419
1419
  get migrations() {
1420
- if (!__privateGet$7(this, _namespaces).migrations)
1421
- __privateGet$7(this, _namespaces).migrations = new MigrationsApi(__privateGet$7(this, _extraProps));
1422
- return __privateGet$7(this, _namespaces).migrations;
1420
+ if (!__privateGet$6(this, _namespaces).migrations)
1421
+ __privateGet$6(this, _namespaces).migrations = new MigrationsApi(__privateGet$6(this, _extraProps));
1422
+ return __privateGet$6(this, _namespaces).migrations;
1423
1423
  }
1424
1424
  get migrationRequests() {
1425
- if (!__privateGet$7(this, _namespaces).migrationRequests)
1426
- __privateGet$7(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$7(this, _extraProps));
1427
- return __privateGet$7(this, _namespaces).migrationRequests;
1425
+ if (!__privateGet$6(this, _namespaces).migrationRequests)
1426
+ __privateGet$6(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$6(this, _extraProps));
1427
+ return __privateGet$6(this, _namespaces).migrationRequests;
1428
1428
  }
1429
1429
  get tables() {
1430
- if (!__privateGet$7(this, _namespaces).tables)
1431
- __privateGet$7(this, _namespaces).tables = new TableApi(__privateGet$7(this, _extraProps));
1432
- return __privateGet$7(this, _namespaces).tables;
1430
+ if (!__privateGet$6(this, _namespaces).tables)
1431
+ __privateGet$6(this, _namespaces).tables = new TableApi(__privateGet$6(this, _extraProps));
1432
+ return __privateGet$6(this, _namespaces).tables;
1433
1433
  }
1434
1434
  get records() {
1435
- if (!__privateGet$7(this, _namespaces).records)
1436
- __privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
1437
- return __privateGet$7(this, _namespaces).records;
1435
+ if (!__privateGet$6(this, _namespaces).records)
1436
+ __privateGet$6(this, _namespaces).records = new RecordsApi(__privateGet$6(this, _extraProps));
1437
+ return __privateGet$6(this, _namespaces).records;
1438
1438
  }
1439
1439
  get files() {
1440
- if (!__privateGet$7(this, _namespaces).files)
1441
- __privateGet$7(this, _namespaces).files = new FilesApi(__privateGet$7(this, _extraProps));
1442
- return __privateGet$7(this, _namespaces).files;
1440
+ if (!__privateGet$6(this, _namespaces).files)
1441
+ __privateGet$6(this, _namespaces).files = new FilesApi(__privateGet$6(this, _extraProps));
1442
+ return __privateGet$6(this, _namespaces).files;
1443
1443
  }
1444
1444
  get searchAndFilter() {
1445
- if (!__privateGet$7(this, _namespaces).searchAndFilter)
1446
- __privateGet$7(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$7(this, _extraProps));
1447
- return __privateGet$7(this, _namespaces).searchAndFilter;
1445
+ if (!__privateGet$6(this, _namespaces).searchAndFilter)
1446
+ __privateGet$6(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$6(this, _extraProps));
1447
+ return __privateGet$6(this, _namespaces).searchAndFilter;
1448
1448
  }
1449
1449
  }
1450
1450
  _extraProps = new WeakMap();
@@ -1746,6 +1746,53 @@ class BranchApi {
1746
1746
  ...this.extraProps
1747
1747
  });
1748
1748
  }
1749
+ pgRollMigrationHistory({
1750
+ workspace,
1751
+ region,
1752
+ database,
1753
+ branch
1754
+ }) {
1755
+ return operationsByTag.branch.pgRollMigrationHistory({
1756
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1757
+ ...this.extraProps
1758
+ });
1759
+ }
1760
+ applyMigration({
1761
+ workspace,
1762
+ region,
1763
+ database,
1764
+ branch,
1765
+ migration
1766
+ }) {
1767
+ return operationsByTag.branch.applyMigration({
1768
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1769
+ body: migration,
1770
+ ...this.extraProps
1771
+ });
1772
+ }
1773
+ pgRollStatus({
1774
+ workspace,
1775
+ region,
1776
+ database,
1777
+ branch
1778
+ }) {
1779
+ return operationsByTag.branch.pgRollStatus({
1780
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1781
+ ...this.extraProps
1782
+ });
1783
+ }
1784
+ pgRollJobStatus({
1785
+ workspace,
1786
+ region,
1787
+ database,
1788
+ branch,
1789
+ jobId
1790
+ }) {
1791
+ return operationsByTag.branch.pgRollJobStatus({
1792
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, jobId },
1793
+ ...this.extraProps
1794
+ });
1795
+ }
1749
1796
  }
1750
1797
  class TableApi {
1751
1798
  constructor(extraProps) {
@@ -2559,6 +2606,17 @@ class MigrationsApi {
2559
2606
  ...this.extraProps
2560
2607
  });
2561
2608
  }
2609
+ getSchema({
2610
+ workspace,
2611
+ region,
2612
+ database,
2613
+ branch
2614
+ }) {
2615
+ return operationsByTag.migrations.getSchema({
2616
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
2617
+ ...this.extraProps
2618
+ });
2619
+ }
2562
2620
  }
2563
2621
  class DatabaseApi {
2564
2622
  constructor(extraProps) {
@@ -2864,7 +2922,7 @@ var __accessCheck$6 = (obj, member, msg) => {
2864
2922
  if (!member.has(obj))
2865
2923
  throw TypeError("Cannot " + msg);
2866
2924
  };
2867
- var __privateGet$6 = (obj, member, getter) => {
2925
+ var __privateGet$5 = (obj, member, getter) => {
2868
2926
  __accessCheck$6(obj, member, "read from private field");
2869
2927
  return getter ? getter.call(obj) : member.get(obj);
2870
2928
  };
@@ -2873,7 +2931,7 @@ var __privateAdd$6 = (obj, member, value) => {
2873
2931
  throw TypeError("Cannot add the same private member more than once");
2874
2932
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
2875
2933
  };
2876
- var __privateSet$6 = (obj, member, value, setter) => {
2934
+ var __privateSet$4 = (obj, member, value, setter) => {
2877
2935
  __accessCheck$6(obj, member, "write to private field");
2878
2936
  setter ? setter.call(obj, value) : member.set(obj, value);
2879
2937
  return value;
@@ -2882,9 +2940,9 @@ var _query, _page;
2882
2940
  class Page {
2883
2941
  constructor(query, meta, records = []) {
2884
2942
  __privateAdd$6(this, _query, void 0);
2885
- __privateSet$6(this, _query, query);
2943
+ __privateSet$4(this, _query, query);
2886
2944
  this.meta = meta;
2887
- this.records = new RecordArray(this, records);
2945
+ this.records = new PageRecordArray(this, records);
2888
2946
  }
2889
2947
  /**
2890
2948
  * Retrieves the next page of results.
@@ -2893,7 +2951,7 @@ class Page {
2893
2951
  * @returns The next page or results.
2894
2952
  */
2895
2953
  async nextPage(size, offset) {
2896
- return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, after: this.meta.page.cursor } });
2954
+ return __privateGet$5(this, _query).getPaginated({ pagination: { size, offset, after: this.meta.page.cursor } });
2897
2955
  }
2898
2956
  /**
2899
2957
  * Retrieves the previous page of results.
@@ -2902,7 +2960,7 @@ class Page {
2902
2960
  * @returns The previous page or results.
2903
2961
  */
2904
2962
  async previousPage(size, offset) {
2905
- return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, before: this.meta.page.cursor } });
2963
+ return __privateGet$5(this, _query).getPaginated({ pagination: { size, offset, before: this.meta.page.cursor } });
2906
2964
  }
2907
2965
  /**
2908
2966
  * Retrieves the start page of results.
@@ -2911,7 +2969,7 @@ class Page {
2911
2969
  * @returns The start page or results.
2912
2970
  */
2913
2971
  async startPage(size, offset) {
2914
- return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, start: this.meta.page.cursor } });
2972
+ return __privateGet$5(this, _query).getPaginated({ pagination: { size, offset, start: this.meta.page.cursor } });
2915
2973
  }
2916
2974
  /**
2917
2975
  * Retrieves the end page of results.
@@ -2920,7 +2978,7 @@ class Page {
2920
2978
  * @returns The end page or results.
2921
2979
  */
2922
2980
  async endPage(size, offset) {
2923
- return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, end: this.meta.page.cursor } });
2981
+ return __privateGet$5(this, _query).getPaginated({ pagination: { size, offset, end: this.meta.page.cursor } });
2924
2982
  }
2925
2983
  /**
2926
2984
  * Shortcut method to check if there will be additional results if the next page of results is retrieved.
@@ -2938,11 +2996,38 @@ const PAGINATION_DEFAULT_OFFSET = 0;
2938
2996
  function isCursorPaginationOptions(options) {
2939
2997
  return isDefined(options) && (isDefined(options.start) || isDefined(options.end) || isDefined(options.after) || isDefined(options.before));
2940
2998
  }
2941
- const _RecordArray = class _RecordArray extends Array {
2999
+ class RecordArray extends Array {
2942
3000
  constructor(...args) {
2943
- super(..._RecordArray.parseConstructorParams(...args));
3001
+ super(...RecordArray.parseConstructorParams(...args));
3002
+ }
3003
+ static parseConstructorParams(...args) {
3004
+ if (args.length === 1 && typeof args[0] === "number") {
3005
+ return new Array(args[0]);
3006
+ }
3007
+ if (args.length <= 1 && Array.isArray(args[0] ?? [])) {
3008
+ const result = args[0] ?? [];
3009
+ return new Array(...result);
3010
+ }
3011
+ return new Array(...args);
3012
+ }
3013
+ toArray() {
3014
+ return new Array(...this);
3015
+ }
3016
+ toSerializable() {
3017
+ return JSON.parse(this.toString());
3018
+ }
3019
+ toString() {
3020
+ return JSON.stringify(this.toArray());
3021
+ }
3022
+ map(callbackfn, thisArg) {
3023
+ return this.toArray().map(callbackfn, thisArg);
3024
+ }
3025
+ }
3026
+ const _PageRecordArray = class _PageRecordArray extends Array {
3027
+ constructor(...args) {
3028
+ super(..._PageRecordArray.parseConstructorParams(...args));
2944
3029
  __privateAdd$6(this, _page, void 0);
2945
- __privateSet$6(this, _page, isObject(args[0]?.meta) ? args[0] : { meta: { page: { cursor: "", more: false } }, records: [] });
3030
+ __privateSet$4(this, _page, isObject(args[0]?.meta) ? args[0] : { meta: { page: { cursor: "", more: false } }, records: [] });
2946
3031
  }
2947
3032
  static parseConstructorParams(...args) {
2948
3033
  if (args.length === 1 && typeof args[0] === "number") {
@@ -2972,8 +3057,8 @@ const _RecordArray = class _RecordArray extends Array {
2972
3057
  * @returns A new array of objects
2973
3058
  */
2974
3059
  async nextPage(size, offset) {
2975
- const newPage = await __privateGet$6(this, _page).nextPage(size, offset);
2976
- return new _RecordArray(newPage);
3060
+ const newPage = await __privateGet$5(this, _page).nextPage(size, offset);
3061
+ return new _PageRecordArray(newPage);
2977
3062
  }
2978
3063
  /**
2979
3064
  * Retrieve previous page of records
@@ -2981,8 +3066,8 @@ const _RecordArray = class _RecordArray extends Array {
2981
3066
  * @returns A new array of objects
2982
3067
  */
2983
3068
  async previousPage(size, offset) {
2984
- const newPage = await __privateGet$6(this, _page).previousPage(size, offset);
2985
- return new _RecordArray(newPage);
3069
+ const newPage = await __privateGet$5(this, _page).previousPage(size, offset);
3070
+ return new _PageRecordArray(newPage);
2986
3071
  }
2987
3072
  /**
2988
3073
  * Retrieve start page of records
@@ -2990,8 +3075,8 @@ const _RecordArray = class _RecordArray extends Array {
2990
3075
  * @returns A new array of objects
2991
3076
  */
2992
3077
  async startPage(size, offset) {
2993
- const newPage = await __privateGet$6(this, _page).startPage(size, offset);
2994
- return new _RecordArray(newPage);
3078
+ const newPage = await __privateGet$5(this, _page).startPage(size, offset);
3079
+ return new _PageRecordArray(newPage);
2995
3080
  }
2996
3081
  /**
2997
3082
  * Retrieve end page of records
@@ -2999,24 +3084,24 @@ const _RecordArray = class _RecordArray extends Array {
2999
3084
  * @returns A new array of objects
3000
3085
  */
3001
3086
  async endPage(size, offset) {
3002
- const newPage = await __privateGet$6(this, _page).endPage(size, offset);
3003
- return new _RecordArray(newPage);
3087
+ const newPage = await __privateGet$5(this, _page).endPage(size, offset);
3088
+ return new _PageRecordArray(newPage);
3004
3089
  }
3005
3090
  /**
3006
3091
  * @returns Boolean indicating if there is a next page
3007
3092
  */
3008
3093
  hasNextPage() {
3009
- return __privateGet$6(this, _page).meta.page.more;
3094
+ return __privateGet$5(this, _page).meta.page.more;
3010
3095
  }
3011
3096
  };
3012
3097
  _page = new WeakMap();
3013
- let RecordArray = _RecordArray;
3098
+ let PageRecordArray = _PageRecordArray;
3014
3099
 
3015
3100
  var __accessCheck$5 = (obj, member, msg) => {
3016
3101
  if (!member.has(obj))
3017
3102
  throw TypeError("Cannot " + msg);
3018
3103
  };
3019
- var __privateGet$5 = (obj, member, getter) => {
3104
+ var __privateGet$4 = (obj, member, getter) => {
3020
3105
  __accessCheck$5(obj, member, "read from private field");
3021
3106
  return getter ? getter.call(obj) : member.get(obj);
3022
3107
  };
@@ -3025,7 +3110,7 @@ var __privateAdd$5 = (obj, member, value) => {
3025
3110
  throw TypeError("Cannot add the same private member more than once");
3026
3111
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
3027
3112
  };
3028
- var __privateSet$5 = (obj, member, value, setter) => {
3113
+ var __privateSet$3 = (obj, member, value, setter) => {
3029
3114
  __accessCheck$5(obj, member, "write to private field");
3030
3115
  setter ? setter.call(obj, value) : member.set(obj, value);
3031
3116
  return value;
@@ -3043,25 +3128,25 @@ const _Query = class _Query {
3043
3128
  __privateAdd$5(this, _data, { filter: {} });
3044
3129
  // Implements pagination
3045
3130
  this.meta = { page: { cursor: "start", more: true, size: PAGINATION_DEFAULT_SIZE } };
3046
- this.records = new RecordArray(this, []);
3047
- __privateSet$5(this, _table$1, table);
3131
+ this.records = new PageRecordArray(this, []);
3132
+ __privateSet$3(this, _table$1, table);
3048
3133
  if (repository) {
3049
- __privateSet$5(this, _repository, repository);
3134
+ __privateSet$3(this, _repository, repository);
3050
3135
  } else {
3051
- __privateSet$5(this, _repository, this);
3136
+ __privateSet$3(this, _repository, this);
3052
3137
  }
3053
3138
  const parent = cleanParent(data, rawParent);
3054
- __privateGet$5(this, _data).filter = data.filter ?? parent?.filter ?? {};
3055
- __privateGet$5(this, _data).filter.$any = data.filter?.$any ?? parent?.filter?.$any;
3056
- __privateGet$5(this, _data).filter.$all = data.filter?.$all ?? parent?.filter?.$all;
3057
- __privateGet$5(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
3058
- __privateGet$5(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
3059
- __privateGet$5(this, _data).sort = data.sort ?? parent?.sort;
3060
- __privateGet$5(this, _data).columns = data.columns ?? parent?.columns;
3061
- __privateGet$5(this, _data).consistency = data.consistency ?? parent?.consistency;
3062
- __privateGet$5(this, _data).pagination = data.pagination ?? parent?.pagination;
3063
- __privateGet$5(this, _data).cache = data.cache ?? parent?.cache;
3064
- __privateGet$5(this, _data).fetchOptions = data.fetchOptions ?? parent?.fetchOptions;
3139
+ __privateGet$4(this, _data).filter = data.filter ?? parent?.filter ?? {};
3140
+ __privateGet$4(this, _data).filter.$any = data.filter?.$any ?? parent?.filter?.$any;
3141
+ __privateGet$4(this, _data).filter.$all = data.filter?.$all ?? parent?.filter?.$all;
3142
+ __privateGet$4(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
3143
+ __privateGet$4(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
3144
+ __privateGet$4(this, _data).sort = data.sort ?? parent?.sort;
3145
+ __privateGet$4(this, _data).columns = data.columns ?? parent?.columns;
3146
+ __privateGet$4(this, _data).consistency = data.consistency ?? parent?.consistency;
3147
+ __privateGet$4(this, _data).pagination = data.pagination ?? parent?.pagination;
3148
+ __privateGet$4(this, _data).cache = data.cache ?? parent?.cache;
3149
+ __privateGet$4(this, _data).fetchOptions = data.fetchOptions ?? parent?.fetchOptions;
3065
3150
  this.any = this.any.bind(this);
3066
3151
  this.all = this.all.bind(this);
3067
3152
  this.not = this.not.bind(this);
@@ -3072,10 +3157,10 @@ const _Query = class _Query {
3072
3157
  Object.defineProperty(this, "repository", { enumerable: false });
3073
3158
  }
3074
3159
  getQueryOptions() {
3075
- return __privateGet$5(this, _data);
3160
+ return __privateGet$4(this, _data);
3076
3161
  }
3077
3162
  key() {
3078
- const { columns = [], filter = {}, sort = [], pagination = {} } = __privateGet$5(this, _data);
3163
+ const { columns = [], filter = {}, sort = [], pagination = {} } = __privateGet$4(this, _data);
3079
3164
  const key = JSON.stringify({ columns, filter, sort, pagination });
3080
3165
  return toBase64(key);
3081
3166
  }
@@ -3086,7 +3171,7 @@ const _Query = class _Query {
3086
3171
  */
3087
3172
  any(...queries) {
3088
3173
  const $any = queries.map((query) => query.getQueryOptions().filter ?? {});
3089
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $any } }, __privateGet$5(this, _data));
3174
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $any } }, __privateGet$4(this, _data));
3090
3175
  }
3091
3176
  /**
3092
3177
  * Builds a new query object representing a logical AND between the given subqueries.
@@ -3095,7 +3180,7 @@ const _Query = class _Query {
3095
3180
  */
3096
3181
  all(...queries) {
3097
3182
  const $all = queries.map((query) => query.getQueryOptions().filter ?? {});
3098
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
3183
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
3099
3184
  }
3100
3185
  /**
3101
3186
  * Builds a new query object representing a logical OR negating each subquery. In pseudo-code: !q1 OR !q2
@@ -3104,7 +3189,7 @@ const _Query = class _Query {
3104
3189
  */
3105
3190
  not(...queries) {
3106
3191
  const $not = queries.map((query) => query.getQueryOptions().filter ?? {});
3107
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $not } }, __privateGet$5(this, _data));
3192
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $not } }, __privateGet$4(this, _data));
3108
3193
  }
3109
3194
  /**
3110
3195
  * Builds a new query object representing a logical AND negating each subquery. In pseudo-code: !q1 AND !q2
@@ -3113,25 +3198,25 @@ const _Query = class _Query {
3113
3198
  */
3114
3199
  none(...queries) {
3115
3200
  const $none = queries.map((query) => query.getQueryOptions().filter ?? {});
3116
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $none } }, __privateGet$5(this, _data));
3201
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $none } }, __privateGet$4(this, _data));
3117
3202
  }
3118
3203
  filter(a, b) {
3119
3204
  if (arguments.length === 1) {
3120
3205
  const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
3121
3206
  [column]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, column, constraint)
3122
3207
  }));
3123
- const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
3124
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
3208
+ const $all = compact([__privateGet$4(this, _data).filter?.$all].flat().concat(constraints));
3209
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
3125
3210
  } else {
3126
3211
  const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, a, b) }] : void 0;
3127
- const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
3128
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
3212
+ const $all = compact([__privateGet$4(this, _data).filter?.$all].flat().concat(constraints));
3213
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
3129
3214
  }
3130
3215
  }
3131
3216
  sort(column, direction = "asc") {
3132
- const originalSort = [__privateGet$5(this, _data).sort ?? []].flat();
3217
+ const originalSort = [__privateGet$4(this, _data).sort ?? []].flat();
3133
3218
  const sort = [...originalSort, { column, direction }];
3134
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { sort }, __privateGet$5(this, _data));
3219
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { sort }, __privateGet$4(this, _data));
3135
3220
  }
3136
3221
  /**
3137
3222
  * Builds a new query specifying the set of columns to be returned in the query response.
@@ -3140,15 +3225,15 @@ const _Query = class _Query {
3140
3225
  */
3141
3226
  select(columns) {
3142
3227
  return new _Query(
3143
- __privateGet$5(this, _repository),
3144
- __privateGet$5(this, _table$1),
3228
+ __privateGet$4(this, _repository),
3229
+ __privateGet$4(this, _table$1),
3145
3230
  { columns },
3146
- __privateGet$5(this, _data)
3231
+ __privateGet$4(this, _data)
3147
3232
  );
3148
3233
  }
3149
3234
  getPaginated(options = {}) {
3150
- const query = new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), options, __privateGet$5(this, _data));
3151
- return __privateGet$5(this, _repository).query(query);
3235
+ const query = new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), options, __privateGet$4(this, _data));
3236
+ return __privateGet$4(this, _repository).query(query);
3152
3237
  }
3153
3238
  /**
3154
3239
  * Get results in an iterator
@@ -3185,7 +3270,7 @@ const _Query = class _Query {
3185
3270
  if (page.hasNextPage() && options.pagination?.size === void 0) {
3186
3271
  console.trace("Calling getMany does not return all results. Paginate to get all results or call getAll.");
3187
3272
  }
3188
- const array = new RecordArray(page, results.slice(0, size));
3273
+ const array = new PageRecordArray(page, results.slice(0, size));
3189
3274
  return array;
3190
3275
  }
3191
3276
  async getAll(options = {}) {
@@ -3194,7 +3279,7 @@ const _Query = class _Query {
3194
3279
  for await (const page of this.getIterator({ ...rest, batchSize })) {
3195
3280
  results.push(...page);
3196
3281
  }
3197
- return results;
3282
+ return new RecordArray(results);
3198
3283
  }
3199
3284
  async getFirst(options = {}) {
3200
3285
  const records = await this.getMany({ ...options, pagination: { size: 1 } });
@@ -3209,12 +3294,12 @@ const _Query = class _Query {
3209
3294
  async summarize(params = {}) {
3210
3295
  const { summaries, summariesFilter, ...options } = params;
3211
3296
  const query = new _Query(
3212
- __privateGet$5(this, _repository),
3213
- __privateGet$5(this, _table$1),
3297
+ __privateGet$4(this, _repository),
3298
+ __privateGet$4(this, _table$1),
3214
3299
  options,
3215
- __privateGet$5(this, _data)
3300
+ __privateGet$4(this, _data)
3216
3301
  );
3217
- return __privateGet$5(this, _repository).summarizeTable(query, summaries, summariesFilter);
3302
+ return __privateGet$4(this, _repository).summarizeTable(query, summaries, summariesFilter);
3218
3303
  }
3219
3304
  /**
3220
3305
  * Builds a new query object adding a cache TTL in milliseconds.
@@ -3222,7 +3307,7 @@ const _Query = class _Query {
3222
3307
  * @returns A new Query object.
3223
3308
  */
3224
3309
  cache(ttl) {
3225
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
3310
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { cache: ttl }, __privateGet$4(this, _data));
3226
3311
  }
3227
3312
  /**
3228
3313
  * Retrieve next page of records
@@ -3268,7 +3353,7 @@ _repository = new WeakMap();
3268
3353
  _data = new WeakMap();
3269
3354
  _cleanFilterConstraint = new WeakSet();
3270
3355
  cleanFilterConstraint_fn = function(column, value) {
3271
- const columnType = __privateGet$5(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
3356
+ const columnType = __privateGet$4(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
3272
3357
  if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
3273
3358
  return { $includes: value };
3274
3359
  }
@@ -3358,7 +3443,7 @@ var __accessCheck$4 = (obj, member, msg) => {
3358
3443
  if (!member.has(obj))
3359
3444
  throw TypeError("Cannot " + msg);
3360
3445
  };
3361
- var __privateGet$4 = (obj, member, getter) => {
3446
+ var __privateGet$3 = (obj, member, getter) => {
3362
3447
  __accessCheck$4(obj, member, "read from private field");
3363
3448
  return getter ? getter.call(obj) : member.get(obj);
3364
3449
  };
@@ -3367,7 +3452,7 @@ var __privateAdd$4 = (obj, member, value) => {
3367
3452
  throw TypeError("Cannot add the same private member more than once");
3368
3453
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
3369
3454
  };
3370
- var __privateSet$4 = (obj, member, value, setter) => {
3455
+ var __privateSet$2 = (obj, member, value, setter) => {
3371
3456
  __accessCheck$4(obj, member, "write to private field");
3372
3457
  setter ? setter.call(obj, value) : member.set(obj, value);
3373
3458
  return value;
@@ -3376,7 +3461,7 @@ var __privateMethod$2 = (obj, member, method) => {
3376
3461
  __accessCheck$4(obj, member, "access private method");
3377
3462
  return method;
3378
3463
  };
3379
- 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;
3464
+ 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;
3380
3465
  const BULK_OPERATION_MAX_SIZE = 1e3;
3381
3466
  class Repository extends Query {
3382
3467
  }
@@ -3397,31 +3482,31 @@ class RestRepository extends Query {
3397
3482
  __privateAdd$4(this, _deleteRecords);
3398
3483
  __privateAdd$4(this, _setCacheQuery);
3399
3484
  __privateAdd$4(this, _getCacheQuery);
3400
- __privateAdd$4(this, _getSchemaTables$1);
3485
+ __privateAdd$4(this, _getSchemaTables);
3401
3486
  __privateAdd$4(this, _transformObjectToApi);
3402
3487
  __privateAdd$4(this, _table, void 0);
3403
3488
  __privateAdd$4(this, _getFetchProps, void 0);
3404
3489
  __privateAdd$4(this, _db, void 0);
3405
3490
  __privateAdd$4(this, _cache, void 0);
3406
- __privateAdd$4(this, _schemaTables$2, void 0);
3491
+ __privateAdd$4(this, _schemaTables, void 0);
3407
3492
  __privateAdd$4(this, _trace, void 0);
3408
- __privateSet$4(this, _table, options.table);
3409
- __privateSet$4(this, _db, options.db);
3410
- __privateSet$4(this, _cache, options.pluginOptions.cache);
3411
- __privateSet$4(this, _schemaTables$2, options.schemaTables);
3412
- __privateSet$4(this, _getFetchProps, () => ({ ...options.pluginOptions, sessionID: generateUUID() }));
3493
+ __privateSet$2(this, _table, options.table);
3494
+ __privateSet$2(this, _db, options.db);
3495
+ __privateSet$2(this, _cache, options.pluginOptions.cache);
3496
+ __privateSet$2(this, _schemaTables, options.schemaTables);
3497
+ __privateSet$2(this, _getFetchProps, () => ({ ...options.pluginOptions, sessionID: generateUUID() }));
3413
3498
  const trace = options.pluginOptions.trace ?? defaultTrace;
3414
- __privateSet$4(this, _trace, async (name, fn, options2 = {}) => {
3499
+ __privateSet$2(this, _trace, async (name, fn, options2 = {}) => {
3415
3500
  return trace(name, fn, {
3416
3501
  ...options2,
3417
- [TraceAttributes.TABLE]: __privateGet$4(this, _table),
3502
+ [TraceAttributes.TABLE]: __privateGet$3(this, _table),
3418
3503
  [TraceAttributes.KIND]: "sdk-operation",
3419
3504
  [TraceAttributes.VERSION]: VERSION
3420
3505
  });
3421
3506
  });
3422
3507
  }
3423
3508
  async create(a, b, c, d) {
3424
- return __privateGet$4(this, _trace).call(this, "create", async () => {
3509
+ return __privateGet$3(this, _trace).call(this, "create", async () => {
3425
3510
  const ifVersion = parseIfVersion(b, c, d);
3426
3511
  if (Array.isArray(a)) {
3427
3512
  if (a.length === 0)
@@ -3451,7 +3536,7 @@ class RestRepository extends Query {
3451
3536
  });
3452
3537
  }
3453
3538
  async read(a, b) {
3454
- return __privateGet$4(this, _trace).call(this, "read", async () => {
3539
+ return __privateGet$3(this, _trace).call(this, "read", async () => {
3455
3540
  const columns = isValidSelectableColumns(b) ? b : ["*"];
3456
3541
  if (Array.isArray(a)) {
3457
3542
  if (a.length === 0)
@@ -3472,17 +3557,17 @@ class RestRepository extends Query {
3472
3557
  workspace: "{workspaceId}",
3473
3558
  dbBranchName: "{dbBranch}",
3474
3559
  region: "{region}",
3475
- tableName: __privateGet$4(this, _table),
3560
+ tableName: __privateGet$3(this, _table),
3476
3561
  recordId: id
3477
3562
  },
3478
3563
  queryParams: { columns },
3479
- ...__privateGet$4(this, _getFetchProps).call(this)
3564
+ ...__privateGet$3(this, _getFetchProps).call(this)
3480
3565
  });
3481
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3566
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3482
3567
  return initObject(
3483
- __privateGet$4(this, _db),
3568
+ __privateGet$3(this, _db),
3484
3569
  schemaTables,
3485
- __privateGet$4(this, _table),
3570
+ __privateGet$3(this, _table),
3486
3571
  response,
3487
3572
  columns
3488
3573
  );
@@ -3497,7 +3582,7 @@ class RestRepository extends Query {
3497
3582
  });
3498
3583
  }
3499
3584
  async readOrThrow(a, b) {
3500
- return __privateGet$4(this, _trace).call(this, "readOrThrow", async () => {
3585
+ return __privateGet$3(this, _trace).call(this, "readOrThrow", async () => {
3501
3586
  const result = await this.read(a, b);
3502
3587
  if (Array.isArray(result)) {
3503
3588
  const missingIds = compact(
@@ -3516,7 +3601,7 @@ class RestRepository extends Query {
3516
3601
  });
3517
3602
  }
3518
3603
  async update(a, b, c, d) {
3519
- return __privateGet$4(this, _trace).call(this, "update", async () => {
3604
+ return __privateGet$3(this, _trace).call(this, "update", async () => {
3520
3605
  const ifVersion = parseIfVersion(b, c, d);
3521
3606
  if (Array.isArray(a)) {
3522
3607
  if (a.length === 0)
@@ -3549,7 +3634,7 @@ class RestRepository extends Query {
3549
3634
  });
3550
3635
  }
3551
3636
  async updateOrThrow(a, b, c, d) {
3552
- return __privateGet$4(this, _trace).call(this, "updateOrThrow", async () => {
3637
+ return __privateGet$3(this, _trace).call(this, "updateOrThrow", async () => {
3553
3638
  const result = await this.update(a, b, c, d);
3554
3639
  if (Array.isArray(result)) {
3555
3640
  const missingIds = compact(
@@ -3568,7 +3653,7 @@ class RestRepository extends Query {
3568
3653
  });
3569
3654
  }
3570
3655
  async createOrUpdate(a, b, c, d) {
3571
- return __privateGet$4(this, _trace).call(this, "createOrUpdate", async () => {
3656
+ return __privateGet$3(this, _trace).call(this, "createOrUpdate", async () => {
3572
3657
  const ifVersion = parseIfVersion(b, c, d);
3573
3658
  if (Array.isArray(a)) {
3574
3659
  if (a.length === 0)
@@ -3603,7 +3688,7 @@ class RestRepository extends Query {
3603
3688
  });
3604
3689
  }
3605
3690
  async createOrReplace(a, b, c, d) {
3606
- return __privateGet$4(this, _trace).call(this, "createOrReplace", async () => {
3691
+ return __privateGet$3(this, _trace).call(this, "createOrReplace", async () => {
3607
3692
  const ifVersion = parseIfVersion(b, c, d);
3608
3693
  if (Array.isArray(a)) {
3609
3694
  if (a.length === 0)
@@ -3635,7 +3720,7 @@ class RestRepository extends Query {
3635
3720
  });
3636
3721
  }
3637
3722
  async delete(a, b) {
3638
- return __privateGet$4(this, _trace).call(this, "delete", async () => {
3723
+ return __privateGet$3(this, _trace).call(this, "delete", async () => {
3639
3724
  if (Array.isArray(a)) {
3640
3725
  if (a.length === 0)
3641
3726
  return [];
@@ -3661,7 +3746,7 @@ class RestRepository extends Query {
3661
3746
  });
3662
3747
  }
3663
3748
  async deleteOrThrow(a, b) {
3664
- return __privateGet$4(this, _trace).call(this, "deleteOrThrow", async () => {
3749
+ return __privateGet$3(this, _trace).call(this, "deleteOrThrow", async () => {
3665
3750
  const result = await this.delete(a, b);
3666
3751
  if (Array.isArray(result)) {
3667
3752
  const missingIds = compact(
@@ -3679,13 +3764,13 @@ class RestRepository extends Query {
3679
3764
  });
3680
3765
  }
3681
3766
  async search(query, options = {}) {
3682
- return __privateGet$4(this, _trace).call(this, "search", async () => {
3767
+ return __privateGet$3(this, _trace).call(this, "search", async () => {
3683
3768
  const { records, totalCount } = await searchTable({
3684
3769
  pathParams: {
3685
3770
  workspace: "{workspaceId}",
3686
3771
  dbBranchName: "{dbBranch}",
3687
3772
  region: "{region}",
3688
- tableName: __privateGet$4(this, _table)
3773
+ tableName: __privateGet$3(this, _table)
3689
3774
  },
3690
3775
  body: {
3691
3776
  query,
@@ -3697,23 +3782,23 @@ class RestRepository extends Query {
3697
3782
  page: options.page,
3698
3783
  target: options.target
3699
3784
  },
3700
- ...__privateGet$4(this, _getFetchProps).call(this)
3785
+ ...__privateGet$3(this, _getFetchProps).call(this)
3701
3786
  });
3702
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3787
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3703
3788
  return {
3704
- records: records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"])),
3789
+ records: records.map((item) => initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), item, ["*"])),
3705
3790
  totalCount
3706
3791
  };
3707
3792
  });
3708
3793
  }
3709
3794
  async vectorSearch(column, query, options) {
3710
- return __privateGet$4(this, _trace).call(this, "vectorSearch", async () => {
3795
+ return __privateGet$3(this, _trace).call(this, "vectorSearch", async () => {
3711
3796
  const { records, totalCount } = await vectorSearchTable({
3712
3797
  pathParams: {
3713
3798
  workspace: "{workspaceId}",
3714
3799
  dbBranchName: "{dbBranch}",
3715
3800
  region: "{region}",
3716
- tableName: __privateGet$4(this, _table)
3801
+ tableName: __privateGet$3(this, _table)
3717
3802
  },
3718
3803
  body: {
3719
3804
  column,
@@ -3722,32 +3807,32 @@ class RestRepository extends Query {
3722
3807
  size: options?.size,
3723
3808
  filter: options?.filter
3724
3809
  },
3725
- ...__privateGet$4(this, _getFetchProps).call(this)
3810
+ ...__privateGet$3(this, _getFetchProps).call(this)
3726
3811
  });
3727
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3812
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3728
3813
  return {
3729
- records: records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"])),
3814
+ records: records.map((item) => initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), item, ["*"])),
3730
3815
  totalCount
3731
3816
  };
3732
3817
  });
3733
3818
  }
3734
3819
  async aggregate(aggs, filter) {
3735
- return __privateGet$4(this, _trace).call(this, "aggregate", async () => {
3820
+ return __privateGet$3(this, _trace).call(this, "aggregate", async () => {
3736
3821
  const result = await aggregateTable({
3737
3822
  pathParams: {
3738
3823
  workspace: "{workspaceId}",
3739
3824
  dbBranchName: "{dbBranch}",
3740
3825
  region: "{region}",
3741
- tableName: __privateGet$4(this, _table)
3826
+ tableName: __privateGet$3(this, _table)
3742
3827
  },
3743
3828
  body: { aggs, filter },
3744
- ...__privateGet$4(this, _getFetchProps).call(this)
3829
+ ...__privateGet$3(this, _getFetchProps).call(this)
3745
3830
  });
3746
3831
  return result;
3747
3832
  });
3748
3833
  }
3749
3834
  async query(query) {
3750
- return __privateGet$4(this, _trace).call(this, "query", async () => {
3835
+ return __privateGet$3(this, _trace).call(this, "query", async () => {
3751
3836
  const cacheQuery = await __privateMethod$2(this, _getCacheQuery, getCacheQuery_fn).call(this, query);
3752
3837
  if (cacheQuery)
3753
3838
  return new Page(query, cacheQuery.meta, cacheQuery.records);
@@ -3757,7 +3842,7 @@ class RestRepository extends Query {
3757
3842
  workspace: "{workspaceId}",
3758
3843
  dbBranchName: "{dbBranch}",
3759
3844
  region: "{region}",
3760
- tableName: __privateGet$4(this, _table)
3845
+ tableName: __privateGet$3(this, _table)
3761
3846
  },
3762
3847
  body: {
3763
3848
  filter: cleanFilter(data.filter),
@@ -3767,14 +3852,14 @@ class RestRepository extends Query {
3767
3852
  consistency: data.consistency
3768
3853
  },
3769
3854
  fetchOptions: data.fetchOptions,
3770
- ...__privateGet$4(this, _getFetchProps).call(this)
3855
+ ...__privateGet$3(this, _getFetchProps).call(this)
3771
3856
  });
3772
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3857
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3773
3858
  const records = objects.map(
3774
3859
  (record) => initObject(
3775
- __privateGet$4(this, _db),
3860
+ __privateGet$3(this, _db),
3776
3861
  schemaTables,
3777
- __privateGet$4(this, _table),
3862
+ __privateGet$3(this, _table),
3778
3863
  record,
3779
3864
  data.columns ?? ["*"]
3780
3865
  )
@@ -3784,14 +3869,14 @@ class RestRepository extends Query {
3784
3869
  });
3785
3870
  }
3786
3871
  async summarizeTable(query, summaries, summariesFilter) {
3787
- return __privateGet$4(this, _trace).call(this, "summarize", async () => {
3872
+ return __privateGet$3(this, _trace).call(this, "summarize", async () => {
3788
3873
  const data = query.getQueryOptions();
3789
3874
  const result = await summarizeTable({
3790
3875
  pathParams: {
3791
3876
  workspace: "{workspaceId}",
3792
3877
  dbBranchName: "{dbBranch}",
3793
3878
  region: "{region}",
3794
- tableName: __privateGet$4(this, _table)
3879
+ tableName: __privateGet$3(this, _table)
3795
3880
  },
3796
3881
  body: {
3797
3882
  filter: cleanFilter(data.filter),
@@ -3802,13 +3887,13 @@ class RestRepository extends Query {
3802
3887
  summaries,
3803
3888
  summariesFilter
3804
3889
  },
3805
- ...__privateGet$4(this, _getFetchProps).call(this)
3890
+ ...__privateGet$3(this, _getFetchProps).call(this)
3806
3891
  });
3807
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3892
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3808
3893
  return {
3809
3894
  ...result,
3810
3895
  summaries: result.summaries.map(
3811
- (summary) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), summary, data.columns ?? [])
3896
+ (summary) => initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), summary, data.columns ?? [])
3812
3897
  )
3813
3898
  };
3814
3899
  });
@@ -3820,7 +3905,7 @@ class RestRepository extends Query {
3820
3905
  workspace: "{workspaceId}",
3821
3906
  dbBranchName: "{dbBranch}",
3822
3907
  region: "{region}",
3823
- tableName: __privateGet$4(this, _table),
3908
+ tableName: __privateGet$3(this, _table),
3824
3909
  sessionId: options?.sessionId
3825
3910
  },
3826
3911
  body: {
@@ -3830,7 +3915,7 @@ class RestRepository extends Query {
3830
3915
  search: options?.searchType === "keyword" ? options?.search : void 0,
3831
3916
  vectorSearch: options?.searchType === "vector" ? options?.vectorSearch : void 0
3832
3917
  },
3833
- ...__privateGet$4(this, _getFetchProps).call(this)
3918
+ ...__privateGet$3(this, _getFetchProps).call(this)
3834
3919
  };
3835
3920
  if (options?.onMessage) {
3836
3921
  fetchSSERequest({
@@ -3851,7 +3936,7 @@ _table = new WeakMap();
3851
3936
  _getFetchProps = new WeakMap();
3852
3937
  _db = new WeakMap();
3853
3938
  _cache = new WeakMap();
3854
- _schemaTables$2 = new WeakMap();
3939
+ _schemaTables = new WeakMap();
3855
3940
  _trace = new WeakMap();
3856
3941
  _insertRecordWithoutId = new WeakSet();
3857
3942
  insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
@@ -3861,14 +3946,14 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
3861
3946
  workspace: "{workspaceId}",
3862
3947
  dbBranchName: "{dbBranch}",
3863
3948
  region: "{region}",
3864
- tableName: __privateGet$4(this, _table)
3949
+ tableName: __privateGet$3(this, _table)
3865
3950
  },
3866
3951
  queryParams: { columns },
3867
3952
  body: record,
3868
- ...__privateGet$4(this, _getFetchProps).call(this)
3953
+ ...__privateGet$3(this, _getFetchProps).call(this)
3869
3954
  });
3870
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3871
- return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
3955
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3956
+ return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
3872
3957
  };
3873
3958
  _insertRecordWithId = new WeakSet();
3874
3959
  insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
@@ -3880,21 +3965,21 @@ insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { crea
3880
3965
  workspace: "{workspaceId}",
3881
3966
  dbBranchName: "{dbBranch}",
3882
3967
  region: "{region}",
3883
- tableName: __privateGet$4(this, _table),
3968
+ tableName: __privateGet$3(this, _table),
3884
3969
  recordId
3885
3970
  },
3886
3971
  body: record,
3887
3972
  queryParams: { createOnly, columns, ifVersion },
3888
- ...__privateGet$4(this, _getFetchProps).call(this)
3973
+ ...__privateGet$3(this, _getFetchProps).call(this)
3889
3974
  });
3890
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3891
- return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
3975
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3976
+ return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
3892
3977
  };
3893
3978
  _insertRecords = new WeakSet();
3894
3979
  insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
3895
3980
  const operations = await promiseMap(objects, async (object) => {
3896
3981
  const record = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
3897
- return { insert: { table: __privateGet$4(this, _table), record, createOnly, ifVersion } };
3982
+ return { insert: { table: __privateGet$3(this, _table), record, createOnly, ifVersion } };
3898
3983
  });
3899
3984
  const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
3900
3985
  const ids = [];
@@ -3906,7 +3991,7 @@ insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
3906
3991
  region: "{region}"
3907
3992
  },
3908
3993
  body: { operations: operations2 },
3909
- ...__privateGet$4(this, _getFetchProps).call(this)
3994
+ ...__privateGet$3(this, _getFetchProps).call(this)
3910
3995
  });
3911
3996
  for (const result of results) {
3912
3997
  if (result.operation === "insert") {
@@ -3929,15 +4014,15 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
3929
4014
  workspace: "{workspaceId}",
3930
4015
  dbBranchName: "{dbBranch}",
3931
4016
  region: "{region}",
3932
- tableName: __privateGet$4(this, _table),
4017
+ tableName: __privateGet$3(this, _table),
3933
4018
  recordId
3934
4019
  },
3935
4020
  queryParams: { columns, ifVersion },
3936
4021
  body: record,
3937
- ...__privateGet$4(this, _getFetchProps).call(this)
4022
+ ...__privateGet$3(this, _getFetchProps).call(this)
3938
4023
  });
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);
4024
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
4025
+ return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
3941
4026
  } catch (e) {
3942
4027
  if (isObject(e) && e.status === 404) {
3943
4028
  return null;
@@ -3949,7 +4034,7 @@ _updateRecords = new WeakSet();
3949
4034
  updateRecords_fn = async function(objects, { ifVersion, upsert }) {
3950
4035
  const operations = await promiseMap(objects, async ({ id, ...object }) => {
3951
4036
  const fields = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
3952
- return { update: { table: __privateGet$4(this, _table), id, ifVersion, upsert, fields } };
4037
+ return { update: { table: __privateGet$3(this, _table), id, ifVersion, upsert, fields } };
3953
4038
  });
3954
4039
  const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
3955
4040
  const ids = [];
@@ -3961,7 +4046,7 @@ updateRecords_fn = async function(objects, { ifVersion, upsert }) {
3961
4046
  region: "{region}"
3962
4047
  },
3963
4048
  body: { operations: operations2 },
3964
- ...__privateGet$4(this, _getFetchProps).call(this)
4049
+ ...__privateGet$3(this, _getFetchProps).call(this)
3965
4050
  });
3966
4051
  for (const result of results) {
3967
4052
  if (result.operation === "update") {
@@ -3982,15 +4067,15 @@ upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
3982
4067
  workspace: "{workspaceId}",
3983
4068
  dbBranchName: "{dbBranch}",
3984
4069
  region: "{region}",
3985
- tableName: __privateGet$4(this, _table),
4070
+ tableName: __privateGet$3(this, _table),
3986
4071
  recordId
3987
4072
  },
3988
4073
  queryParams: { columns, ifVersion },
3989
4074
  body: object,
3990
- ...__privateGet$4(this, _getFetchProps).call(this)
4075
+ ...__privateGet$3(this, _getFetchProps).call(this)
3991
4076
  });
3992
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3993
- return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
4077
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
4078
+ return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
3994
4079
  };
3995
4080
  _deleteRecord = new WeakSet();
3996
4081
  deleteRecord_fn = async function(recordId, columns = ["*"]) {
@@ -4002,14 +4087,14 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
4002
4087
  workspace: "{workspaceId}",
4003
4088
  dbBranchName: "{dbBranch}",
4004
4089
  region: "{region}",
4005
- tableName: __privateGet$4(this, _table),
4090
+ tableName: __privateGet$3(this, _table),
4006
4091
  recordId
4007
4092
  },
4008
4093
  queryParams: { columns },
4009
- ...__privateGet$4(this, _getFetchProps).call(this)
4094
+ ...__privateGet$3(this, _getFetchProps).call(this)
4010
4095
  });
4011
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
4012
- return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
4096
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
4097
+ return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
4013
4098
  } catch (e) {
4014
4099
  if (isObject(e) && e.status === 404) {
4015
4100
  return null;
@@ -4020,7 +4105,7 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
4020
4105
  _deleteRecords = new WeakSet();
4021
4106
  deleteRecords_fn = async function(recordIds) {
4022
4107
  const chunkedOperations = chunk(
4023
- compact(recordIds).map((id) => ({ delete: { table: __privateGet$4(this, _table), id } })),
4108
+ compact(recordIds).map((id) => ({ delete: { table: __privateGet$3(this, _table), id } })),
4024
4109
  BULK_OPERATION_MAX_SIZE
4025
4110
  );
4026
4111
  for (const operations of chunkedOperations) {
@@ -4031,44 +4116,44 @@ deleteRecords_fn = async function(recordIds) {
4031
4116
  region: "{region}"
4032
4117
  },
4033
4118
  body: { operations },
4034
- ...__privateGet$4(this, _getFetchProps).call(this)
4119
+ ...__privateGet$3(this, _getFetchProps).call(this)
4035
4120
  });
4036
4121
  }
4037
4122
  };
4038
4123
  _setCacheQuery = new WeakSet();
4039
4124
  setCacheQuery_fn = async function(query, meta, records) {
4040
- await __privateGet$4(this, _cache)?.set(`query_${__privateGet$4(this, _table)}:${query.key()}`, { date: /* @__PURE__ */ new Date(), meta, records });
4125
+ await __privateGet$3(this, _cache)?.set(`query_${__privateGet$3(this, _table)}:${query.key()}`, { date: /* @__PURE__ */ new Date(), meta, records });
4041
4126
  };
4042
4127
  _getCacheQuery = new WeakSet();
4043
4128
  getCacheQuery_fn = async function(query) {
4044
- const key = `query_${__privateGet$4(this, _table)}:${query.key()}`;
4045
- const result = await __privateGet$4(this, _cache)?.get(key);
4129
+ const key = `query_${__privateGet$3(this, _table)}:${query.key()}`;
4130
+ const result = await __privateGet$3(this, _cache)?.get(key);
4046
4131
  if (!result)
4047
4132
  return null;
4048
- const defaultTTL = __privateGet$4(this, _cache)?.defaultQueryTTL ?? -1;
4133
+ const defaultTTL = __privateGet$3(this, _cache)?.defaultQueryTTL ?? -1;
4049
4134
  const { cache: ttl = defaultTTL } = query.getQueryOptions();
4050
4135
  if (ttl < 0)
4051
4136
  return null;
4052
4137
  const hasExpired = result.date.getTime() + ttl < Date.now();
4053
4138
  return hasExpired ? null : result;
4054
4139
  };
4055
- _getSchemaTables$1 = new WeakSet();
4056
- getSchemaTables_fn$1 = async function() {
4057
- if (__privateGet$4(this, _schemaTables$2))
4058
- return __privateGet$4(this, _schemaTables$2);
4140
+ _getSchemaTables = new WeakSet();
4141
+ getSchemaTables_fn = async function() {
4142
+ if (__privateGet$3(this, _schemaTables))
4143
+ return __privateGet$3(this, _schemaTables);
4059
4144
  const { schema } = await getBranchDetails({
4060
4145
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4061
- ...__privateGet$4(this, _getFetchProps).call(this)
4146
+ ...__privateGet$3(this, _getFetchProps).call(this)
4062
4147
  });
4063
- __privateSet$4(this, _schemaTables$2, schema.tables);
4148
+ __privateSet$2(this, _schemaTables, schema.tables);
4064
4149
  return schema.tables;
4065
4150
  };
4066
4151
  _transformObjectToApi = new WeakSet();
4067
4152
  transformObjectToApi_fn = async function(object) {
4068
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
4069
- const schema = schemaTables.find((table) => table.name === __privateGet$4(this, _table));
4153
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
4154
+ const schema = schemaTables.find((table) => table.name === __privateGet$3(this, _table));
4070
4155
  if (!schema)
4071
- throw new Error(`Table ${__privateGet$4(this, _table)} not found in schema`);
4156
+ throw new Error(`Table ${__privateGet$3(this, _table)} not found in schema`);
4072
4157
  const result = {};
4073
4158
  for (const [key, value] of Object.entries(object)) {
4074
4159
  if (key === "xata")
@@ -4224,7 +4309,7 @@ var __accessCheck$3 = (obj, member, msg) => {
4224
4309
  if (!member.has(obj))
4225
4310
  throw TypeError("Cannot " + msg);
4226
4311
  };
4227
- var __privateGet$3 = (obj, member, getter) => {
4312
+ var __privateGet$2 = (obj, member, getter) => {
4228
4313
  __accessCheck$3(obj, member, "read from private field");
4229
4314
  return getter ? getter.call(obj) : member.get(obj);
4230
4315
  };
@@ -4233,7 +4318,7 @@ var __privateAdd$3 = (obj, member, value) => {
4233
4318
  throw TypeError("Cannot add the same private member more than once");
4234
4319
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
4235
4320
  };
4236
- var __privateSet$3 = (obj, member, value, setter) => {
4321
+ var __privateSet$1 = (obj, member, value, setter) => {
4237
4322
  __accessCheck$3(obj, member, "write to private field");
4238
4323
  setter ? setter.call(obj, value) : member.set(obj, value);
4239
4324
  return value;
@@ -4242,29 +4327,29 @@ var _map;
4242
4327
  class SimpleCache {
4243
4328
  constructor(options = {}) {
4244
4329
  __privateAdd$3(this, _map, void 0);
4245
- __privateSet$3(this, _map, /* @__PURE__ */ new Map());
4330
+ __privateSet$1(this, _map, /* @__PURE__ */ new Map());
4246
4331
  this.capacity = options.max ?? 500;
4247
4332
  this.defaultQueryTTL = options.defaultQueryTTL ?? 60 * 1e3;
4248
4333
  }
4249
4334
  async getAll() {
4250
- return Object.fromEntries(__privateGet$3(this, _map));
4335
+ return Object.fromEntries(__privateGet$2(this, _map));
4251
4336
  }
4252
4337
  async get(key) {
4253
- return __privateGet$3(this, _map).get(key) ?? null;
4338
+ return __privateGet$2(this, _map).get(key) ?? null;
4254
4339
  }
4255
4340
  async set(key, value) {
4256
4341
  await this.delete(key);
4257
- __privateGet$3(this, _map).set(key, value);
4258
- if (__privateGet$3(this, _map).size > this.capacity) {
4259
- const leastRecentlyUsed = __privateGet$3(this, _map).keys().next().value;
4342
+ __privateGet$2(this, _map).set(key, value);
4343
+ if (__privateGet$2(this, _map).size > this.capacity) {
4344
+ const leastRecentlyUsed = __privateGet$2(this, _map).keys().next().value;
4260
4345
  await this.delete(leastRecentlyUsed);
4261
4346
  }
4262
4347
  }
4263
4348
  async delete(key) {
4264
- __privateGet$3(this, _map).delete(key);
4349
+ __privateGet$2(this, _map).delete(key);
4265
4350
  }
4266
4351
  async clear() {
4267
- return __privateGet$3(this, _map).clear();
4352
+ return __privateGet$2(this, _map).clear();
4268
4353
  }
4269
4354
  }
4270
4355
  _map = new WeakMap();
@@ -4301,7 +4386,7 @@ var __accessCheck$2 = (obj, member, msg) => {
4301
4386
  if (!member.has(obj))
4302
4387
  throw TypeError("Cannot " + msg);
4303
4388
  };
4304
- var __privateGet$2 = (obj, member, getter) => {
4389
+ var __privateGet$1 = (obj, member, getter) => {
4305
4390
  __accessCheck$2(obj, member, "read from private field");
4306
4391
  return getter ? getter.call(obj) : member.get(obj);
4307
4392
  };
@@ -4310,18 +4395,11 @@ var __privateAdd$2 = (obj, member, value) => {
4310
4395
  throw TypeError("Cannot add the same private member more than once");
4311
4396
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
4312
4397
  };
4313
- var __privateSet$2 = (obj, member, value, setter) => {
4314
- __accessCheck$2(obj, member, "write to private field");
4315
- setter ? setter.call(obj, value) : member.set(obj, value);
4316
- return value;
4317
- };
4318
- var _tables, _schemaTables$1;
4398
+ var _tables;
4319
4399
  class SchemaPlugin extends XataPlugin {
4320
- constructor(schemaTables) {
4400
+ constructor() {
4321
4401
  super();
4322
4402
  __privateAdd$2(this, _tables, {});
4323
- __privateAdd$2(this, _schemaTables$1, void 0);
4324
- __privateSet$2(this, _schemaTables$1, schemaTables);
4325
4403
  }
4326
4404
  build(pluginOptions) {
4327
4405
  const db = new Proxy(
@@ -4330,22 +4408,21 @@ class SchemaPlugin extends XataPlugin {
4330
4408
  get: (_target, table) => {
4331
4409
  if (!isString(table))
4332
4410
  throw new Error("Invalid table name");
4333
- if (__privateGet$2(this, _tables)[table] === void 0) {
4334
- __privateGet$2(this, _tables)[table] = new RestRepository({ db, pluginOptions, table, schemaTables: __privateGet$2(this, _schemaTables$1) });
4411
+ if (__privateGet$1(this, _tables)[table] === void 0) {
4412
+ __privateGet$1(this, _tables)[table] = new RestRepository({ db, pluginOptions, table, schemaTables: pluginOptions.tables });
4335
4413
  }
4336
- return __privateGet$2(this, _tables)[table];
4414
+ return __privateGet$1(this, _tables)[table];
4337
4415
  }
4338
4416
  }
4339
4417
  );
4340
- const tableNames = __privateGet$2(this, _schemaTables$1)?.map(({ name }) => name) ?? [];
4418
+ const tableNames = pluginOptions.tables?.map(({ name }) => name) ?? [];
4341
4419
  for (const table of tableNames) {
4342
- db[table] = new RestRepository({ db, pluginOptions, table, schemaTables: __privateGet$2(this, _schemaTables$1) });
4420
+ db[table] = new RestRepository({ db, pluginOptions, table, schemaTables: pluginOptions.tables });
4343
4421
  }
4344
4422
  return db;
4345
4423
  }
4346
4424
  }
4347
4425
  _tables = new WeakMap();
4348
- _schemaTables$1 = new WeakMap();
4349
4426
 
4350
4427
  class FilesPlugin extends XataPlugin {
4351
4428
  build(pluginOptions) {
@@ -4425,54 +4502,40 @@ var __accessCheck$1 = (obj, member, msg) => {
4425
4502
  if (!member.has(obj))
4426
4503
  throw TypeError("Cannot " + msg);
4427
4504
  };
4428
- var __privateGet$1 = (obj, member, getter) => {
4429
- __accessCheck$1(obj, member, "read from private field");
4430
- return getter ? getter.call(obj) : member.get(obj);
4431
- };
4432
4505
  var __privateAdd$1 = (obj, member, value) => {
4433
4506
  if (member.has(obj))
4434
4507
  throw TypeError("Cannot add the same private member more than once");
4435
4508
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
4436
4509
  };
4437
- var __privateSet$1 = (obj, member, value, setter) => {
4438
- __accessCheck$1(obj, member, "write to private field");
4439
- setter ? setter.call(obj, value) : member.set(obj, value);
4440
- return value;
4441
- };
4442
4510
  var __privateMethod$1 = (obj, member, method) => {
4443
4511
  __accessCheck$1(obj, member, "access private method");
4444
4512
  return method;
4445
4513
  };
4446
- var _schemaTables, _search, search_fn, _getSchemaTables, getSchemaTables_fn;
4514
+ var _search, search_fn;
4447
4515
  class SearchPlugin extends XataPlugin {
4448
- constructor(db, schemaTables) {
4516
+ constructor(db) {
4449
4517
  super();
4450
4518
  this.db = db;
4451
4519
  __privateAdd$1(this, _search);
4452
- __privateAdd$1(this, _getSchemaTables);
4453
- __privateAdd$1(this, _schemaTables, void 0);
4454
- __privateSet$1(this, _schemaTables, schemaTables);
4455
4520
  }
4456
4521
  build(pluginOptions) {
4457
4522
  return {
4458
4523
  all: async (query, options = {}) => {
4459
4524
  const { records, totalCount } = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4460
- const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, pluginOptions);
4461
4525
  return {
4462
4526
  totalCount,
4463
4527
  records: records.map((record) => {
4464
4528
  const { table = "orphan" } = record.xata;
4465
- return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
4529
+ return { table, record: initObject(this.db, pluginOptions.tables, table, record, ["*"]) };
4466
4530
  })
4467
4531
  };
4468
4532
  },
4469
4533
  byTable: async (query, options = {}) => {
4470
4534
  const { records: rawRecords, totalCount } = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4471
- const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, pluginOptions);
4472
4535
  const records = rawRecords.reduce((acc, record) => {
4473
4536
  const { table = "orphan" } = record.xata;
4474
4537
  const items = acc[table] ?? [];
4475
- const item = initObject(this.db, schemaTables, table, record, ["*"]);
4538
+ const item = initObject(this.db, pluginOptions.tables, table, record, ["*"]);
4476
4539
  return { ...acc, [table]: [...items, item] };
4477
4540
  }, {});
4478
4541
  return { totalCount, records };
@@ -4480,29 +4543,17 @@ class SearchPlugin extends XataPlugin {
4480
4543
  };
4481
4544
  }
4482
4545
  }
4483
- _schemaTables = new WeakMap();
4484
4546
  _search = new WeakSet();
4485
4547
  search_fn = async function(query, options, pluginOptions) {
4486
4548
  const { tables, fuzziness, highlight, prefix, page } = options ?? {};
4487
4549
  const { records, totalCount } = await searchBranch({
4488
4550
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4489
- // @ts-ignore https://github.com/xataio/client-ts/issues/313
4551
+ // @ts-expect-error Filter properties do not match inferred type
4490
4552
  body: { tables, query, fuzziness, prefix, highlight, page },
4491
4553
  ...pluginOptions
4492
4554
  });
4493
4555
  return { records, totalCount };
4494
4556
  };
4495
- _getSchemaTables = new WeakSet();
4496
- getSchemaTables_fn = async function(pluginOptions) {
4497
- if (__privateGet$1(this, _schemaTables))
4498
- return __privateGet$1(this, _schemaTables);
4499
- const { schema } = await getBranchDetails({
4500
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4501
- ...pluginOptions
4502
- });
4503
- __privateSet$1(this, _schemaTables, schema.tables);
4504
- return schema.tables;
4505
- };
4506
4557
 
4507
4558
  function escapeElement(elementRepresentation) {
4508
4559
  const escaped = elementRepresentation.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
@@ -4564,19 +4615,17 @@ function prepareParams(param1, param2) {
4564
4615
 
4565
4616
  class SQLPlugin extends XataPlugin {
4566
4617
  build(pluginOptions) {
4567
- return async (param1, ...param2) => {
4568
- if (!isParamsObject(param1) && (!isTemplateStringsArray(param1) || !Array.isArray(param2))) {
4569
- throw new Error(
4570
- "Calling `xata.sql` as a function is not safe. Make sure to use it as a tagged template or with an object."
4571
- );
4618
+ return async (query, ...parameters) => {
4619
+ if (!isParamsObject(query) && (!isTemplateStringsArray(query) || !Array.isArray(parameters))) {
4620
+ throw new Error("Invalid usage of `xata.sql`. Please use it as a tagged template or with an object.");
4572
4621
  }
4573
- const { statement, params, consistency } = prepareParams(param1, param2);
4574
- const { records, warning } = await sqlQuery({
4622
+ const { statement, params, consistency } = prepareParams(query, parameters);
4623
+ const { records, warning, columns } = await sqlQuery({
4575
4624
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4576
4625
  body: { statement, params, consistency },
4577
4626
  ...pluginOptions
4578
4627
  });
4579
- return { records, warning };
4628
+ return { records, warning, columns };
4580
4629
  };
4581
4630
  }
4582
4631
  }
@@ -4627,7 +4676,7 @@ var __privateMethod = (obj, member, method) => {
4627
4676
  const buildClient = (plugins) => {
4628
4677
  var _options, _parseOptions, parseOptions_fn, _getFetchProps, getFetchProps_fn, _a;
4629
4678
  return _a = class {
4630
- constructor(options = {}, schemaTables) {
4679
+ constructor(options = {}, tables) {
4631
4680
  __privateAdd(this, _parseOptions);
4632
4681
  __privateAdd(this, _getFetchProps);
4633
4682
  __privateAdd(this, _options, void 0);
@@ -4636,13 +4685,15 @@ const buildClient = (plugins) => {
4636
4685
  const pluginOptions = {
4637
4686
  ...__privateMethod(this, _getFetchProps, getFetchProps_fn).call(this, safeOptions),
4638
4687
  cache: safeOptions.cache,
4639
- host: safeOptions.host
4688
+ host: safeOptions.host,
4689
+ tables
4640
4690
  };
4641
- const db = new SchemaPlugin(schemaTables).build(pluginOptions);
4642
- const search = new SearchPlugin(db, schemaTables).build(pluginOptions);
4691
+ const db = new SchemaPlugin().build(pluginOptions);
4692
+ const search = new SearchPlugin(db).build(pluginOptions);
4643
4693
  const transactions = new TransactionPlugin().build(pluginOptions);
4644
4694
  const sql = new SQLPlugin().build(pluginOptions);
4645
4695
  const files = new FilesPlugin().build(pluginOptions);
4696
+ this.schema = { tables };
4646
4697
  this.db = db;
4647
4698
  this.search = search;
4648
4699
  this.transactions = transactions;
@@ -4827,6 +4878,7 @@ exports.PAGINATION_DEFAULT_SIZE = PAGINATION_DEFAULT_SIZE;
4827
4878
  exports.PAGINATION_MAX_OFFSET = PAGINATION_MAX_OFFSET;
4828
4879
  exports.PAGINATION_MAX_SIZE = PAGINATION_MAX_SIZE;
4829
4880
  exports.Page = Page;
4881
+ exports.PageRecordArray = PageRecordArray;
4830
4882
  exports.Query = Query;
4831
4883
  exports.RecordArray = RecordArray;
4832
4884
  exports.RecordColumnTypes = RecordColumnTypes;