@xata.io/client 0.29.0 → 0.29.1

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.29.0";
531
+ const VERSION = "0.29.1";
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,30 @@ 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
+ }
1749
1773
  }
1750
1774
  class TableApi {
1751
1775
  constructor(extraProps) {
@@ -2559,6 +2583,17 @@ class MigrationsApi {
2559
2583
  ...this.extraProps
2560
2584
  });
2561
2585
  }
2586
+ getSchema({
2587
+ workspace,
2588
+ region,
2589
+ database,
2590
+ branch
2591
+ }) {
2592
+ return operationsByTag.migrations.getSchema({
2593
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
2594
+ ...this.extraProps
2595
+ });
2596
+ }
2562
2597
  }
2563
2598
  class DatabaseApi {
2564
2599
  constructor(extraProps) {
@@ -2864,7 +2899,7 @@ var __accessCheck$6 = (obj, member, msg) => {
2864
2899
  if (!member.has(obj))
2865
2900
  throw TypeError("Cannot " + msg);
2866
2901
  };
2867
- var __privateGet$6 = (obj, member, getter) => {
2902
+ var __privateGet$5 = (obj, member, getter) => {
2868
2903
  __accessCheck$6(obj, member, "read from private field");
2869
2904
  return getter ? getter.call(obj) : member.get(obj);
2870
2905
  };
@@ -2873,7 +2908,7 @@ var __privateAdd$6 = (obj, member, value) => {
2873
2908
  throw TypeError("Cannot add the same private member more than once");
2874
2909
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
2875
2910
  };
2876
- var __privateSet$6 = (obj, member, value, setter) => {
2911
+ var __privateSet$4 = (obj, member, value, setter) => {
2877
2912
  __accessCheck$6(obj, member, "write to private field");
2878
2913
  setter ? setter.call(obj, value) : member.set(obj, value);
2879
2914
  return value;
@@ -2882,9 +2917,9 @@ var _query, _page;
2882
2917
  class Page {
2883
2918
  constructor(query, meta, records = []) {
2884
2919
  __privateAdd$6(this, _query, void 0);
2885
- __privateSet$6(this, _query, query);
2920
+ __privateSet$4(this, _query, query);
2886
2921
  this.meta = meta;
2887
- this.records = new RecordArray(this, records);
2922
+ this.records = new PageRecordArray(this, records);
2888
2923
  }
2889
2924
  /**
2890
2925
  * Retrieves the next page of results.
@@ -2893,7 +2928,7 @@ class Page {
2893
2928
  * @returns The next page or results.
2894
2929
  */
2895
2930
  async nextPage(size, offset) {
2896
- return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, after: this.meta.page.cursor } });
2931
+ return __privateGet$5(this, _query).getPaginated({ pagination: { size, offset, after: this.meta.page.cursor } });
2897
2932
  }
2898
2933
  /**
2899
2934
  * Retrieves the previous page of results.
@@ -2902,7 +2937,7 @@ class Page {
2902
2937
  * @returns The previous page or results.
2903
2938
  */
2904
2939
  async previousPage(size, offset) {
2905
- return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, before: this.meta.page.cursor } });
2940
+ return __privateGet$5(this, _query).getPaginated({ pagination: { size, offset, before: this.meta.page.cursor } });
2906
2941
  }
2907
2942
  /**
2908
2943
  * Retrieves the start page of results.
@@ -2911,7 +2946,7 @@ class Page {
2911
2946
  * @returns The start page or results.
2912
2947
  */
2913
2948
  async startPage(size, offset) {
2914
- return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, start: this.meta.page.cursor } });
2949
+ return __privateGet$5(this, _query).getPaginated({ pagination: { size, offset, start: this.meta.page.cursor } });
2915
2950
  }
2916
2951
  /**
2917
2952
  * Retrieves the end page of results.
@@ -2920,7 +2955,7 @@ class Page {
2920
2955
  * @returns The end page or results.
2921
2956
  */
2922
2957
  async endPage(size, offset) {
2923
- return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, end: this.meta.page.cursor } });
2958
+ return __privateGet$5(this, _query).getPaginated({ pagination: { size, offset, end: this.meta.page.cursor } });
2924
2959
  }
2925
2960
  /**
2926
2961
  * Shortcut method to check if there will be additional results if the next page of results is retrieved.
@@ -2938,11 +2973,38 @@ const PAGINATION_DEFAULT_OFFSET = 0;
2938
2973
  function isCursorPaginationOptions(options) {
2939
2974
  return isDefined(options) && (isDefined(options.start) || isDefined(options.end) || isDefined(options.after) || isDefined(options.before));
2940
2975
  }
2941
- const _RecordArray = class _RecordArray extends Array {
2976
+ class RecordArray extends Array {
2942
2977
  constructor(...args) {
2943
- super(..._RecordArray.parseConstructorParams(...args));
2978
+ super(...RecordArray.parseConstructorParams(...args));
2979
+ }
2980
+ static parseConstructorParams(...args) {
2981
+ if (args.length === 1 && typeof args[0] === "number") {
2982
+ return new Array(args[0]);
2983
+ }
2984
+ if (args.length <= 1 && Array.isArray(args[0] ?? [])) {
2985
+ const result = args[0] ?? [];
2986
+ return new Array(...result);
2987
+ }
2988
+ return new Array(...args);
2989
+ }
2990
+ toArray() {
2991
+ return new Array(...this);
2992
+ }
2993
+ toSerializable() {
2994
+ return JSON.parse(this.toString());
2995
+ }
2996
+ toString() {
2997
+ return JSON.stringify(this.toArray());
2998
+ }
2999
+ map(callbackfn, thisArg) {
3000
+ return this.toArray().map(callbackfn, thisArg);
3001
+ }
3002
+ }
3003
+ const _PageRecordArray = class _PageRecordArray extends Array {
3004
+ constructor(...args) {
3005
+ super(..._PageRecordArray.parseConstructorParams(...args));
2944
3006
  __privateAdd$6(this, _page, void 0);
2945
- __privateSet$6(this, _page, isObject(args[0]?.meta) ? args[0] : { meta: { page: { cursor: "", more: false } }, records: [] });
3007
+ __privateSet$4(this, _page, isObject(args[0]?.meta) ? args[0] : { meta: { page: { cursor: "", more: false } }, records: [] });
2946
3008
  }
2947
3009
  static parseConstructorParams(...args) {
2948
3010
  if (args.length === 1 && typeof args[0] === "number") {
@@ -2972,8 +3034,8 @@ const _RecordArray = class _RecordArray extends Array {
2972
3034
  * @returns A new array of objects
2973
3035
  */
2974
3036
  async nextPage(size, offset) {
2975
- const newPage = await __privateGet$6(this, _page).nextPage(size, offset);
2976
- return new _RecordArray(newPage);
3037
+ const newPage = await __privateGet$5(this, _page).nextPage(size, offset);
3038
+ return new _PageRecordArray(newPage);
2977
3039
  }
2978
3040
  /**
2979
3041
  * Retrieve previous page of records
@@ -2981,8 +3043,8 @@ const _RecordArray = class _RecordArray extends Array {
2981
3043
  * @returns A new array of objects
2982
3044
  */
2983
3045
  async previousPage(size, offset) {
2984
- const newPage = await __privateGet$6(this, _page).previousPage(size, offset);
2985
- return new _RecordArray(newPage);
3046
+ const newPage = await __privateGet$5(this, _page).previousPage(size, offset);
3047
+ return new _PageRecordArray(newPage);
2986
3048
  }
2987
3049
  /**
2988
3050
  * Retrieve start page of records
@@ -2990,8 +3052,8 @@ const _RecordArray = class _RecordArray extends Array {
2990
3052
  * @returns A new array of objects
2991
3053
  */
2992
3054
  async startPage(size, offset) {
2993
- const newPage = await __privateGet$6(this, _page).startPage(size, offset);
2994
- return new _RecordArray(newPage);
3055
+ const newPage = await __privateGet$5(this, _page).startPage(size, offset);
3056
+ return new _PageRecordArray(newPage);
2995
3057
  }
2996
3058
  /**
2997
3059
  * Retrieve end page of records
@@ -2999,24 +3061,24 @@ const _RecordArray = class _RecordArray extends Array {
2999
3061
  * @returns A new array of objects
3000
3062
  */
3001
3063
  async endPage(size, offset) {
3002
- const newPage = await __privateGet$6(this, _page).endPage(size, offset);
3003
- return new _RecordArray(newPage);
3064
+ const newPage = await __privateGet$5(this, _page).endPage(size, offset);
3065
+ return new _PageRecordArray(newPage);
3004
3066
  }
3005
3067
  /**
3006
3068
  * @returns Boolean indicating if there is a next page
3007
3069
  */
3008
3070
  hasNextPage() {
3009
- return __privateGet$6(this, _page).meta.page.more;
3071
+ return __privateGet$5(this, _page).meta.page.more;
3010
3072
  }
3011
3073
  };
3012
3074
  _page = new WeakMap();
3013
- let RecordArray = _RecordArray;
3075
+ let PageRecordArray = _PageRecordArray;
3014
3076
 
3015
3077
  var __accessCheck$5 = (obj, member, msg) => {
3016
3078
  if (!member.has(obj))
3017
3079
  throw TypeError("Cannot " + msg);
3018
3080
  };
3019
- var __privateGet$5 = (obj, member, getter) => {
3081
+ var __privateGet$4 = (obj, member, getter) => {
3020
3082
  __accessCheck$5(obj, member, "read from private field");
3021
3083
  return getter ? getter.call(obj) : member.get(obj);
3022
3084
  };
@@ -3025,7 +3087,7 @@ var __privateAdd$5 = (obj, member, value) => {
3025
3087
  throw TypeError("Cannot add the same private member more than once");
3026
3088
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
3027
3089
  };
3028
- var __privateSet$5 = (obj, member, value, setter) => {
3090
+ var __privateSet$3 = (obj, member, value, setter) => {
3029
3091
  __accessCheck$5(obj, member, "write to private field");
3030
3092
  setter ? setter.call(obj, value) : member.set(obj, value);
3031
3093
  return value;
@@ -3043,25 +3105,25 @@ const _Query = class _Query {
3043
3105
  __privateAdd$5(this, _data, { filter: {} });
3044
3106
  // Implements pagination
3045
3107
  this.meta = { page: { cursor: "start", more: true, size: PAGINATION_DEFAULT_SIZE } };
3046
- this.records = new RecordArray(this, []);
3047
- __privateSet$5(this, _table$1, table);
3108
+ this.records = new PageRecordArray(this, []);
3109
+ __privateSet$3(this, _table$1, table);
3048
3110
  if (repository) {
3049
- __privateSet$5(this, _repository, repository);
3111
+ __privateSet$3(this, _repository, repository);
3050
3112
  } else {
3051
- __privateSet$5(this, _repository, this);
3113
+ __privateSet$3(this, _repository, this);
3052
3114
  }
3053
3115
  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;
3116
+ __privateGet$4(this, _data).filter = data.filter ?? parent?.filter ?? {};
3117
+ __privateGet$4(this, _data).filter.$any = data.filter?.$any ?? parent?.filter?.$any;
3118
+ __privateGet$4(this, _data).filter.$all = data.filter?.$all ?? parent?.filter?.$all;
3119
+ __privateGet$4(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
3120
+ __privateGet$4(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
3121
+ __privateGet$4(this, _data).sort = data.sort ?? parent?.sort;
3122
+ __privateGet$4(this, _data).columns = data.columns ?? parent?.columns;
3123
+ __privateGet$4(this, _data).consistency = data.consistency ?? parent?.consistency;
3124
+ __privateGet$4(this, _data).pagination = data.pagination ?? parent?.pagination;
3125
+ __privateGet$4(this, _data).cache = data.cache ?? parent?.cache;
3126
+ __privateGet$4(this, _data).fetchOptions = data.fetchOptions ?? parent?.fetchOptions;
3065
3127
  this.any = this.any.bind(this);
3066
3128
  this.all = this.all.bind(this);
3067
3129
  this.not = this.not.bind(this);
@@ -3072,10 +3134,10 @@ const _Query = class _Query {
3072
3134
  Object.defineProperty(this, "repository", { enumerable: false });
3073
3135
  }
3074
3136
  getQueryOptions() {
3075
- return __privateGet$5(this, _data);
3137
+ return __privateGet$4(this, _data);
3076
3138
  }
3077
3139
  key() {
3078
- const { columns = [], filter = {}, sort = [], pagination = {} } = __privateGet$5(this, _data);
3140
+ const { columns = [], filter = {}, sort = [], pagination = {} } = __privateGet$4(this, _data);
3079
3141
  const key = JSON.stringify({ columns, filter, sort, pagination });
3080
3142
  return toBase64(key);
3081
3143
  }
@@ -3086,7 +3148,7 @@ const _Query = class _Query {
3086
3148
  */
3087
3149
  any(...queries) {
3088
3150
  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));
3151
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $any } }, __privateGet$4(this, _data));
3090
3152
  }
3091
3153
  /**
3092
3154
  * Builds a new query object representing a logical AND between the given subqueries.
@@ -3095,7 +3157,7 @@ const _Query = class _Query {
3095
3157
  */
3096
3158
  all(...queries) {
3097
3159
  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));
3160
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
3099
3161
  }
3100
3162
  /**
3101
3163
  * Builds a new query object representing a logical OR negating each subquery. In pseudo-code: !q1 OR !q2
@@ -3104,7 +3166,7 @@ const _Query = class _Query {
3104
3166
  */
3105
3167
  not(...queries) {
3106
3168
  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));
3169
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $not } }, __privateGet$4(this, _data));
3108
3170
  }
3109
3171
  /**
3110
3172
  * Builds a new query object representing a logical AND negating each subquery. In pseudo-code: !q1 AND !q2
@@ -3113,25 +3175,25 @@ const _Query = class _Query {
3113
3175
  */
3114
3176
  none(...queries) {
3115
3177
  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));
3178
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $none } }, __privateGet$4(this, _data));
3117
3179
  }
3118
3180
  filter(a, b) {
3119
3181
  if (arguments.length === 1) {
3120
3182
  const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
3121
3183
  [column]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, column, constraint)
3122
3184
  }));
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));
3185
+ const $all = compact([__privateGet$4(this, _data).filter?.$all].flat().concat(constraints));
3186
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
3125
3187
  } else {
3126
3188
  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));
3189
+ const $all = compact([__privateGet$4(this, _data).filter?.$all].flat().concat(constraints));
3190
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
3129
3191
  }
3130
3192
  }
3131
3193
  sort(column, direction = "asc") {
3132
- const originalSort = [__privateGet$5(this, _data).sort ?? []].flat();
3194
+ const originalSort = [__privateGet$4(this, _data).sort ?? []].flat();
3133
3195
  const sort = [...originalSort, { column, direction }];
3134
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { sort }, __privateGet$5(this, _data));
3196
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { sort }, __privateGet$4(this, _data));
3135
3197
  }
3136
3198
  /**
3137
3199
  * Builds a new query specifying the set of columns to be returned in the query response.
@@ -3140,15 +3202,15 @@ const _Query = class _Query {
3140
3202
  */
3141
3203
  select(columns) {
3142
3204
  return new _Query(
3143
- __privateGet$5(this, _repository),
3144
- __privateGet$5(this, _table$1),
3205
+ __privateGet$4(this, _repository),
3206
+ __privateGet$4(this, _table$1),
3145
3207
  { columns },
3146
- __privateGet$5(this, _data)
3208
+ __privateGet$4(this, _data)
3147
3209
  );
3148
3210
  }
3149
3211
  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);
3212
+ const query = new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), options, __privateGet$4(this, _data));
3213
+ return __privateGet$4(this, _repository).query(query);
3152
3214
  }
3153
3215
  /**
3154
3216
  * Get results in an iterator
@@ -3185,7 +3247,7 @@ const _Query = class _Query {
3185
3247
  if (page.hasNextPage() && options.pagination?.size === void 0) {
3186
3248
  console.trace("Calling getMany does not return all results. Paginate to get all results or call getAll.");
3187
3249
  }
3188
- const array = new RecordArray(page, results.slice(0, size));
3250
+ const array = new PageRecordArray(page, results.slice(0, size));
3189
3251
  return array;
3190
3252
  }
3191
3253
  async getAll(options = {}) {
@@ -3194,7 +3256,7 @@ const _Query = class _Query {
3194
3256
  for await (const page of this.getIterator({ ...rest, batchSize })) {
3195
3257
  results.push(...page);
3196
3258
  }
3197
- return results;
3259
+ return new RecordArray(results);
3198
3260
  }
3199
3261
  async getFirst(options = {}) {
3200
3262
  const records = await this.getMany({ ...options, pagination: { size: 1 } });
@@ -3209,12 +3271,12 @@ const _Query = class _Query {
3209
3271
  async summarize(params = {}) {
3210
3272
  const { summaries, summariesFilter, ...options } = params;
3211
3273
  const query = new _Query(
3212
- __privateGet$5(this, _repository),
3213
- __privateGet$5(this, _table$1),
3274
+ __privateGet$4(this, _repository),
3275
+ __privateGet$4(this, _table$1),
3214
3276
  options,
3215
- __privateGet$5(this, _data)
3277
+ __privateGet$4(this, _data)
3216
3278
  );
3217
- return __privateGet$5(this, _repository).summarizeTable(query, summaries, summariesFilter);
3279
+ return __privateGet$4(this, _repository).summarizeTable(query, summaries, summariesFilter);
3218
3280
  }
3219
3281
  /**
3220
3282
  * Builds a new query object adding a cache TTL in milliseconds.
@@ -3222,7 +3284,7 @@ const _Query = class _Query {
3222
3284
  * @returns A new Query object.
3223
3285
  */
3224
3286
  cache(ttl) {
3225
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
3287
+ return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { cache: ttl }, __privateGet$4(this, _data));
3226
3288
  }
3227
3289
  /**
3228
3290
  * Retrieve next page of records
@@ -3268,7 +3330,7 @@ _repository = new WeakMap();
3268
3330
  _data = new WeakMap();
3269
3331
  _cleanFilterConstraint = new WeakSet();
3270
3332
  cleanFilterConstraint_fn = function(column, value) {
3271
- const columnType = __privateGet$5(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
3333
+ const columnType = __privateGet$4(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
3272
3334
  if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
3273
3335
  return { $includes: value };
3274
3336
  }
@@ -3358,7 +3420,7 @@ var __accessCheck$4 = (obj, member, msg) => {
3358
3420
  if (!member.has(obj))
3359
3421
  throw TypeError("Cannot " + msg);
3360
3422
  };
3361
- var __privateGet$4 = (obj, member, getter) => {
3423
+ var __privateGet$3 = (obj, member, getter) => {
3362
3424
  __accessCheck$4(obj, member, "read from private field");
3363
3425
  return getter ? getter.call(obj) : member.get(obj);
3364
3426
  };
@@ -3367,7 +3429,7 @@ var __privateAdd$4 = (obj, member, value) => {
3367
3429
  throw TypeError("Cannot add the same private member more than once");
3368
3430
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
3369
3431
  };
3370
- var __privateSet$4 = (obj, member, value, setter) => {
3432
+ var __privateSet$2 = (obj, member, value, setter) => {
3371
3433
  __accessCheck$4(obj, member, "write to private field");
3372
3434
  setter ? setter.call(obj, value) : member.set(obj, value);
3373
3435
  return value;
@@ -3376,7 +3438,7 @@ var __privateMethod$2 = (obj, member, method) => {
3376
3438
  __accessCheck$4(obj, member, "access private method");
3377
3439
  return method;
3378
3440
  };
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;
3441
+ 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
3442
  const BULK_OPERATION_MAX_SIZE = 1e3;
3381
3443
  class Repository extends Query {
3382
3444
  }
@@ -3397,31 +3459,31 @@ class RestRepository extends Query {
3397
3459
  __privateAdd$4(this, _deleteRecords);
3398
3460
  __privateAdd$4(this, _setCacheQuery);
3399
3461
  __privateAdd$4(this, _getCacheQuery);
3400
- __privateAdd$4(this, _getSchemaTables$1);
3462
+ __privateAdd$4(this, _getSchemaTables);
3401
3463
  __privateAdd$4(this, _transformObjectToApi);
3402
3464
  __privateAdd$4(this, _table, void 0);
3403
3465
  __privateAdd$4(this, _getFetchProps, void 0);
3404
3466
  __privateAdd$4(this, _db, void 0);
3405
3467
  __privateAdd$4(this, _cache, void 0);
3406
- __privateAdd$4(this, _schemaTables$2, void 0);
3468
+ __privateAdd$4(this, _schemaTables, void 0);
3407
3469
  __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() }));
3470
+ __privateSet$2(this, _table, options.table);
3471
+ __privateSet$2(this, _db, options.db);
3472
+ __privateSet$2(this, _cache, options.pluginOptions.cache);
3473
+ __privateSet$2(this, _schemaTables, options.schemaTables);
3474
+ __privateSet$2(this, _getFetchProps, () => ({ ...options.pluginOptions, sessionID: generateUUID() }));
3413
3475
  const trace = options.pluginOptions.trace ?? defaultTrace;
3414
- __privateSet$4(this, _trace, async (name, fn, options2 = {}) => {
3476
+ __privateSet$2(this, _trace, async (name, fn, options2 = {}) => {
3415
3477
  return trace(name, fn, {
3416
3478
  ...options2,
3417
- [TraceAttributes.TABLE]: __privateGet$4(this, _table),
3479
+ [TraceAttributes.TABLE]: __privateGet$3(this, _table),
3418
3480
  [TraceAttributes.KIND]: "sdk-operation",
3419
3481
  [TraceAttributes.VERSION]: VERSION
3420
3482
  });
3421
3483
  });
3422
3484
  }
3423
3485
  async create(a, b, c, d) {
3424
- return __privateGet$4(this, _trace).call(this, "create", async () => {
3486
+ return __privateGet$3(this, _trace).call(this, "create", async () => {
3425
3487
  const ifVersion = parseIfVersion(b, c, d);
3426
3488
  if (Array.isArray(a)) {
3427
3489
  if (a.length === 0)
@@ -3451,7 +3513,7 @@ class RestRepository extends Query {
3451
3513
  });
3452
3514
  }
3453
3515
  async read(a, b) {
3454
- return __privateGet$4(this, _trace).call(this, "read", async () => {
3516
+ return __privateGet$3(this, _trace).call(this, "read", async () => {
3455
3517
  const columns = isValidSelectableColumns(b) ? b : ["*"];
3456
3518
  if (Array.isArray(a)) {
3457
3519
  if (a.length === 0)
@@ -3472,17 +3534,17 @@ class RestRepository extends Query {
3472
3534
  workspace: "{workspaceId}",
3473
3535
  dbBranchName: "{dbBranch}",
3474
3536
  region: "{region}",
3475
- tableName: __privateGet$4(this, _table),
3537
+ tableName: __privateGet$3(this, _table),
3476
3538
  recordId: id
3477
3539
  },
3478
3540
  queryParams: { columns },
3479
- ...__privateGet$4(this, _getFetchProps).call(this)
3541
+ ...__privateGet$3(this, _getFetchProps).call(this)
3480
3542
  });
3481
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3543
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3482
3544
  return initObject(
3483
- __privateGet$4(this, _db),
3545
+ __privateGet$3(this, _db),
3484
3546
  schemaTables,
3485
- __privateGet$4(this, _table),
3547
+ __privateGet$3(this, _table),
3486
3548
  response,
3487
3549
  columns
3488
3550
  );
@@ -3497,7 +3559,7 @@ class RestRepository extends Query {
3497
3559
  });
3498
3560
  }
3499
3561
  async readOrThrow(a, b) {
3500
- return __privateGet$4(this, _trace).call(this, "readOrThrow", async () => {
3562
+ return __privateGet$3(this, _trace).call(this, "readOrThrow", async () => {
3501
3563
  const result = await this.read(a, b);
3502
3564
  if (Array.isArray(result)) {
3503
3565
  const missingIds = compact(
@@ -3516,7 +3578,7 @@ class RestRepository extends Query {
3516
3578
  });
3517
3579
  }
3518
3580
  async update(a, b, c, d) {
3519
- return __privateGet$4(this, _trace).call(this, "update", async () => {
3581
+ return __privateGet$3(this, _trace).call(this, "update", async () => {
3520
3582
  const ifVersion = parseIfVersion(b, c, d);
3521
3583
  if (Array.isArray(a)) {
3522
3584
  if (a.length === 0)
@@ -3549,7 +3611,7 @@ class RestRepository extends Query {
3549
3611
  });
3550
3612
  }
3551
3613
  async updateOrThrow(a, b, c, d) {
3552
- return __privateGet$4(this, _trace).call(this, "updateOrThrow", async () => {
3614
+ return __privateGet$3(this, _trace).call(this, "updateOrThrow", async () => {
3553
3615
  const result = await this.update(a, b, c, d);
3554
3616
  if (Array.isArray(result)) {
3555
3617
  const missingIds = compact(
@@ -3568,7 +3630,7 @@ class RestRepository extends Query {
3568
3630
  });
3569
3631
  }
3570
3632
  async createOrUpdate(a, b, c, d) {
3571
- return __privateGet$4(this, _trace).call(this, "createOrUpdate", async () => {
3633
+ return __privateGet$3(this, _trace).call(this, "createOrUpdate", async () => {
3572
3634
  const ifVersion = parseIfVersion(b, c, d);
3573
3635
  if (Array.isArray(a)) {
3574
3636
  if (a.length === 0)
@@ -3603,7 +3665,7 @@ class RestRepository extends Query {
3603
3665
  });
3604
3666
  }
3605
3667
  async createOrReplace(a, b, c, d) {
3606
- return __privateGet$4(this, _trace).call(this, "createOrReplace", async () => {
3668
+ return __privateGet$3(this, _trace).call(this, "createOrReplace", async () => {
3607
3669
  const ifVersion = parseIfVersion(b, c, d);
3608
3670
  if (Array.isArray(a)) {
3609
3671
  if (a.length === 0)
@@ -3635,7 +3697,7 @@ class RestRepository extends Query {
3635
3697
  });
3636
3698
  }
3637
3699
  async delete(a, b) {
3638
- return __privateGet$4(this, _trace).call(this, "delete", async () => {
3700
+ return __privateGet$3(this, _trace).call(this, "delete", async () => {
3639
3701
  if (Array.isArray(a)) {
3640
3702
  if (a.length === 0)
3641
3703
  return [];
@@ -3661,7 +3723,7 @@ class RestRepository extends Query {
3661
3723
  });
3662
3724
  }
3663
3725
  async deleteOrThrow(a, b) {
3664
- return __privateGet$4(this, _trace).call(this, "deleteOrThrow", async () => {
3726
+ return __privateGet$3(this, _trace).call(this, "deleteOrThrow", async () => {
3665
3727
  const result = await this.delete(a, b);
3666
3728
  if (Array.isArray(result)) {
3667
3729
  const missingIds = compact(
@@ -3679,13 +3741,13 @@ class RestRepository extends Query {
3679
3741
  });
3680
3742
  }
3681
3743
  async search(query, options = {}) {
3682
- return __privateGet$4(this, _trace).call(this, "search", async () => {
3744
+ return __privateGet$3(this, _trace).call(this, "search", async () => {
3683
3745
  const { records, totalCount } = await searchTable({
3684
3746
  pathParams: {
3685
3747
  workspace: "{workspaceId}",
3686
3748
  dbBranchName: "{dbBranch}",
3687
3749
  region: "{region}",
3688
- tableName: __privateGet$4(this, _table)
3750
+ tableName: __privateGet$3(this, _table)
3689
3751
  },
3690
3752
  body: {
3691
3753
  query,
@@ -3697,23 +3759,23 @@ class RestRepository extends Query {
3697
3759
  page: options.page,
3698
3760
  target: options.target
3699
3761
  },
3700
- ...__privateGet$4(this, _getFetchProps).call(this)
3762
+ ...__privateGet$3(this, _getFetchProps).call(this)
3701
3763
  });
3702
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3764
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3703
3765
  return {
3704
- records: records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"])),
3766
+ records: records.map((item) => initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), item, ["*"])),
3705
3767
  totalCount
3706
3768
  };
3707
3769
  });
3708
3770
  }
3709
3771
  async vectorSearch(column, query, options) {
3710
- return __privateGet$4(this, _trace).call(this, "vectorSearch", async () => {
3772
+ return __privateGet$3(this, _trace).call(this, "vectorSearch", async () => {
3711
3773
  const { records, totalCount } = await vectorSearchTable({
3712
3774
  pathParams: {
3713
3775
  workspace: "{workspaceId}",
3714
3776
  dbBranchName: "{dbBranch}",
3715
3777
  region: "{region}",
3716
- tableName: __privateGet$4(this, _table)
3778
+ tableName: __privateGet$3(this, _table)
3717
3779
  },
3718
3780
  body: {
3719
3781
  column,
@@ -3722,32 +3784,32 @@ class RestRepository extends Query {
3722
3784
  size: options?.size,
3723
3785
  filter: options?.filter
3724
3786
  },
3725
- ...__privateGet$4(this, _getFetchProps).call(this)
3787
+ ...__privateGet$3(this, _getFetchProps).call(this)
3726
3788
  });
3727
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3789
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3728
3790
  return {
3729
- records: records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"])),
3791
+ records: records.map((item) => initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), item, ["*"])),
3730
3792
  totalCount
3731
3793
  };
3732
3794
  });
3733
3795
  }
3734
3796
  async aggregate(aggs, filter) {
3735
- return __privateGet$4(this, _trace).call(this, "aggregate", async () => {
3797
+ return __privateGet$3(this, _trace).call(this, "aggregate", async () => {
3736
3798
  const result = await aggregateTable({
3737
3799
  pathParams: {
3738
3800
  workspace: "{workspaceId}",
3739
3801
  dbBranchName: "{dbBranch}",
3740
3802
  region: "{region}",
3741
- tableName: __privateGet$4(this, _table)
3803
+ tableName: __privateGet$3(this, _table)
3742
3804
  },
3743
3805
  body: { aggs, filter },
3744
- ...__privateGet$4(this, _getFetchProps).call(this)
3806
+ ...__privateGet$3(this, _getFetchProps).call(this)
3745
3807
  });
3746
3808
  return result;
3747
3809
  });
3748
3810
  }
3749
3811
  async query(query) {
3750
- return __privateGet$4(this, _trace).call(this, "query", async () => {
3812
+ return __privateGet$3(this, _trace).call(this, "query", async () => {
3751
3813
  const cacheQuery = await __privateMethod$2(this, _getCacheQuery, getCacheQuery_fn).call(this, query);
3752
3814
  if (cacheQuery)
3753
3815
  return new Page(query, cacheQuery.meta, cacheQuery.records);
@@ -3757,7 +3819,7 @@ class RestRepository extends Query {
3757
3819
  workspace: "{workspaceId}",
3758
3820
  dbBranchName: "{dbBranch}",
3759
3821
  region: "{region}",
3760
- tableName: __privateGet$4(this, _table)
3822
+ tableName: __privateGet$3(this, _table)
3761
3823
  },
3762
3824
  body: {
3763
3825
  filter: cleanFilter(data.filter),
@@ -3767,14 +3829,14 @@ class RestRepository extends Query {
3767
3829
  consistency: data.consistency
3768
3830
  },
3769
3831
  fetchOptions: data.fetchOptions,
3770
- ...__privateGet$4(this, _getFetchProps).call(this)
3832
+ ...__privateGet$3(this, _getFetchProps).call(this)
3771
3833
  });
3772
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3834
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3773
3835
  const records = objects.map(
3774
3836
  (record) => initObject(
3775
- __privateGet$4(this, _db),
3837
+ __privateGet$3(this, _db),
3776
3838
  schemaTables,
3777
- __privateGet$4(this, _table),
3839
+ __privateGet$3(this, _table),
3778
3840
  record,
3779
3841
  data.columns ?? ["*"]
3780
3842
  )
@@ -3784,14 +3846,14 @@ class RestRepository extends Query {
3784
3846
  });
3785
3847
  }
3786
3848
  async summarizeTable(query, summaries, summariesFilter) {
3787
- return __privateGet$4(this, _trace).call(this, "summarize", async () => {
3849
+ return __privateGet$3(this, _trace).call(this, "summarize", async () => {
3788
3850
  const data = query.getQueryOptions();
3789
3851
  const result = await summarizeTable({
3790
3852
  pathParams: {
3791
3853
  workspace: "{workspaceId}",
3792
3854
  dbBranchName: "{dbBranch}",
3793
3855
  region: "{region}",
3794
- tableName: __privateGet$4(this, _table)
3856
+ tableName: __privateGet$3(this, _table)
3795
3857
  },
3796
3858
  body: {
3797
3859
  filter: cleanFilter(data.filter),
@@ -3802,13 +3864,13 @@ class RestRepository extends Query {
3802
3864
  summaries,
3803
3865
  summariesFilter
3804
3866
  },
3805
- ...__privateGet$4(this, _getFetchProps).call(this)
3867
+ ...__privateGet$3(this, _getFetchProps).call(this)
3806
3868
  });
3807
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3869
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3808
3870
  return {
3809
3871
  ...result,
3810
3872
  summaries: result.summaries.map(
3811
- (summary) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), summary, data.columns ?? [])
3873
+ (summary) => initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), summary, data.columns ?? [])
3812
3874
  )
3813
3875
  };
3814
3876
  });
@@ -3820,7 +3882,7 @@ class RestRepository extends Query {
3820
3882
  workspace: "{workspaceId}",
3821
3883
  dbBranchName: "{dbBranch}",
3822
3884
  region: "{region}",
3823
- tableName: __privateGet$4(this, _table),
3885
+ tableName: __privateGet$3(this, _table),
3824
3886
  sessionId: options?.sessionId
3825
3887
  },
3826
3888
  body: {
@@ -3830,7 +3892,7 @@ class RestRepository extends Query {
3830
3892
  search: options?.searchType === "keyword" ? options?.search : void 0,
3831
3893
  vectorSearch: options?.searchType === "vector" ? options?.vectorSearch : void 0
3832
3894
  },
3833
- ...__privateGet$4(this, _getFetchProps).call(this)
3895
+ ...__privateGet$3(this, _getFetchProps).call(this)
3834
3896
  };
3835
3897
  if (options?.onMessage) {
3836
3898
  fetchSSERequest({
@@ -3851,7 +3913,7 @@ _table = new WeakMap();
3851
3913
  _getFetchProps = new WeakMap();
3852
3914
  _db = new WeakMap();
3853
3915
  _cache = new WeakMap();
3854
- _schemaTables$2 = new WeakMap();
3916
+ _schemaTables = new WeakMap();
3855
3917
  _trace = new WeakMap();
3856
3918
  _insertRecordWithoutId = new WeakSet();
3857
3919
  insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
@@ -3861,14 +3923,14 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
3861
3923
  workspace: "{workspaceId}",
3862
3924
  dbBranchName: "{dbBranch}",
3863
3925
  region: "{region}",
3864
- tableName: __privateGet$4(this, _table)
3926
+ tableName: __privateGet$3(this, _table)
3865
3927
  },
3866
3928
  queryParams: { columns },
3867
3929
  body: record,
3868
- ...__privateGet$4(this, _getFetchProps).call(this)
3930
+ ...__privateGet$3(this, _getFetchProps).call(this)
3869
3931
  });
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);
3932
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3933
+ return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
3872
3934
  };
3873
3935
  _insertRecordWithId = new WeakSet();
3874
3936
  insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
@@ -3880,21 +3942,21 @@ insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { crea
3880
3942
  workspace: "{workspaceId}",
3881
3943
  dbBranchName: "{dbBranch}",
3882
3944
  region: "{region}",
3883
- tableName: __privateGet$4(this, _table),
3945
+ tableName: __privateGet$3(this, _table),
3884
3946
  recordId
3885
3947
  },
3886
3948
  body: record,
3887
3949
  queryParams: { createOnly, columns, ifVersion },
3888
- ...__privateGet$4(this, _getFetchProps).call(this)
3950
+ ...__privateGet$3(this, _getFetchProps).call(this)
3889
3951
  });
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);
3952
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
3953
+ return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
3892
3954
  };
3893
3955
  _insertRecords = new WeakSet();
3894
3956
  insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
3895
3957
  const operations = await promiseMap(objects, async (object) => {
3896
3958
  const record = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
3897
- return { insert: { table: __privateGet$4(this, _table), record, createOnly, ifVersion } };
3959
+ return { insert: { table: __privateGet$3(this, _table), record, createOnly, ifVersion } };
3898
3960
  });
3899
3961
  const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
3900
3962
  const ids = [];
@@ -3906,7 +3968,7 @@ insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
3906
3968
  region: "{region}"
3907
3969
  },
3908
3970
  body: { operations: operations2 },
3909
- ...__privateGet$4(this, _getFetchProps).call(this)
3971
+ ...__privateGet$3(this, _getFetchProps).call(this)
3910
3972
  });
3911
3973
  for (const result of results) {
3912
3974
  if (result.operation === "insert") {
@@ -3929,15 +3991,15 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
3929
3991
  workspace: "{workspaceId}",
3930
3992
  dbBranchName: "{dbBranch}",
3931
3993
  region: "{region}",
3932
- tableName: __privateGet$4(this, _table),
3994
+ tableName: __privateGet$3(this, _table),
3933
3995
  recordId
3934
3996
  },
3935
3997
  queryParams: { columns, ifVersion },
3936
3998
  body: record,
3937
- ...__privateGet$4(this, _getFetchProps).call(this)
3999
+ ...__privateGet$3(this, _getFetchProps).call(this)
3938
4000
  });
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);
4001
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
4002
+ return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
3941
4003
  } catch (e) {
3942
4004
  if (isObject(e) && e.status === 404) {
3943
4005
  return null;
@@ -3949,7 +4011,7 @@ _updateRecords = new WeakSet();
3949
4011
  updateRecords_fn = async function(objects, { ifVersion, upsert }) {
3950
4012
  const operations = await promiseMap(objects, async ({ id, ...object }) => {
3951
4013
  const fields = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
3952
- return { update: { table: __privateGet$4(this, _table), id, ifVersion, upsert, fields } };
4014
+ return { update: { table: __privateGet$3(this, _table), id, ifVersion, upsert, fields } };
3953
4015
  });
3954
4016
  const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
3955
4017
  const ids = [];
@@ -3961,7 +4023,7 @@ updateRecords_fn = async function(objects, { ifVersion, upsert }) {
3961
4023
  region: "{region}"
3962
4024
  },
3963
4025
  body: { operations: operations2 },
3964
- ...__privateGet$4(this, _getFetchProps).call(this)
4026
+ ...__privateGet$3(this, _getFetchProps).call(this)
3965
4027
  });
3966
4028
  for (const result of results) {
3967
4029
  if (result.operation === "update") {
@@ -3982,15 +4044,15 @@ upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
3982
4044
  workspace: "{workspaceId}",
3983
4045
  dbBranchName: "{dbBranch}",
3984
4046
  region: "{region}",
3985
- tableName: __privateGet$4(this, _table),
4047
+ tableName: __privateGet$3(this, _table),
3986
4048
  recordId
3987
4049
  },
3988
4050
  queryParams: { columns, ifVersion },
3989
4051
  body: object,
3990
- ...__privateGet$4(this, _getFetchProps).call(this)
4052
+ ...__privateGet$3(this, _getFetchProps).call(this)
3991
4053
  });
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);
4054
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
4055
+ return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
3994
4056
  };
3995
4057
  _deleteRecord = new WeakSet();
3996
4058
  deleteRecord_fn = async function(recordId, columns = ["*"]) {
@@ -4002,14 +4064,14 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
4002
4064
  workspace: "{workspaceId}",
4003
4065
  dbBranchName: "{dbBranch}",
4004
4066
  region: "{region}",
4005
- tableName: __privateGet$4(this, _table),
4067
+ tableName: __privateGet$3(this, _table),
4006
4068
  recordId
4007
4069
  },
4008
4070
  queryParams: { columns },
4009
- ...__privateGet$4(this, _getFetchProps).call(this)
4071
+ ...__privateGet$3(this, _getFetchProps).call(this)
4010
4072
  });
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);
4073
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
4074
+ return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
4013
4075
  } catch (e) {
4014
4076
  if (isObject(e) && e.status === 404) {
4015
4077
  return null;
@@ -4020,7 +4082,7 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
4020
4082
  _deleteRecords = new WeakSet();
4021
4083
  deleteRecords_fn = async function(recordIds) {
4022
4084
  const chunkedOperations = chunk(
4023
- compact(recordIds).map((id) => ({ delete: { table: __privateGet$4(this, _table), id } })),
4085
+ compact(recordIds).map((id) => ({ delete: { table: __privateGet$3(this, _table), id } })),
4024
4086
  BULK_OPERATION_MAX_SIZE
4025
4087
  );
4026
4088
  for (const operations of chunkedOperations) {
@@ -4031,44 +4093,44 @@ deleteRecords_fn = async function(recordIds) {
4031
4093
  region: "{region}"
4032
4094
  },
4033
4095
  body: { operations },
4034
- ...__privateGet$4(this, _getFetchProps).call(this)
4096
+ ...__privateGet$3(this, _getFetchProps).call(this)
4035
4097
  });
4036
4098
  }
4037
4099
  };
4038
4100
  _setCacheQuery = new WeakSet();
4039
4101
  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 });
4102
+ await __privateGet$3(this, _cache)?.set(`query_${__privateGet$3(this, _table)}:${query.key()}`, { date: /* @__PURE__ */ new Date(), meta, records });
4041
4103
  };
4042
4104
  _getCacheQuery = new WeakSet();
4043
4105
  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);
4106
+ const key = `query_${__privateGet$3(this, _table)}:${query.key()}`;
4107
+ const result = await __privateGet$3(this, _cache)?.get(key);
4046
4108
  if (!result)
4047
4109
  return null;
4048
- const defaultTTL = __privateGet$4(this, _cache)?.defaultQueryTTL ?? -1;
4110
+ const defaultTTL = __privateGet$3(this, _cache)?.defaultQueryTTL ?? -1;
4049
4111
  const { cache: ttl = defaultTTL } = query.getQueryOptions();
4050
4112
  if (ttl < 0)
4051
4113
  return null;
4052
4114
  const hasExpired = result.date.getTime() + ttl < Date.now();
4053
4115
  return hasExpired ? null : result;
4054
4116
  };
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);
4117
+ _getSchemaTables = new WeakSet();
4118
+ getSchemaTables_fn = async function() {
4119
+ if (__privateGet$3(this, _schemaTables))
4120
+ return __privateGet$3(this, _schemaTables);
4059
4121
  const { schema } = await getBranchDetails({
4060
4122
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4061
- ...__privateGet$4(this, _getFetchProps).call(this)
4123
+ ...__privateGet$3(this, _getFetchProps).call(this)
4062
4124
  });
4063
- __privateSet$4(this, _schemaTables$2, schema.tables);
4125
+ __privateSet$2(this, _schemaTables, schema.tables);
4064
4126
  return schema.tables;
4065
4127
  };
4066
4128
  _transformObjectToApi = new WeakSet();
4067
4129
  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));
4130
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
4131
+ const schema = schemaTables.find((table) => table.name === __privateGet$3(this, _table));
4070
4132
  if (!schema)
4071
- throw new Error(`Table ${__privateGet$4(this, _table)} not found in schema`);
4133
+ throw new Error(`Table ${__privateGet$3(this, _table)} not found in schema`);
4072
4134
  const result = {};
4073
4135
  for (const [key, value] of Object.entries(object)) {
4074
4136
  if (key === "xata")
@@ -4224,7 +4286,7 @@ var __accessCheck$3 = (obj, member, msg) => {
4224
4286
  if (!member.has(obj))
4225
4287
  throw TypeError("Cannot " + msg);
4226
4288
  };
4227
- var __privateGet$3 = (obj, member, getter) => {
4289
+ var __privateGet$2 = (obj, member, getter) => {
4228
4290
  __accessCheck$3(obj, member, "read from private field");
4229
4291
  return getter ? getter.call(obj) : member.get(obj);
4230
4292
  };
@@ -4233,7 +4295,7 @@ var __privateAdd$3 = (obj, member, value) => {
4233
4295
  throw TypeError("Cannot add the same private member more than once");
4234
4296
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
4235
4297
  };
4236
- var __privateSet$3 = (obj, member, value, setter) => {
4298
+ var __privateSet$1 = (obj, member, value, setter) => {
4237
4299
  __accessCheck$3(obj, member, "write to private field");
4238
4300
  setter ? setter.call(obj, value) : member.set(obj, value);
4239
4301
  return value;
@@ -4242,29 +4304,29 @@ var _map;
4242
4304
  class SimpleCache {
4243
4305
  constructor(options = {}) {
4244
4306
  __privateAdd$3(this, _map, void 0);
4245
- __privateSet$3(this, _map, /* @__PURE__ */ new Map());
4307
+ __privateSet$1(this, _map, /* @__PURE__ */ new Map());
4246
4308
  this.capacity = options.max ?? 500;
4247
4309
  this.defaultQueryTTL = options.defaultQueryTTL ?? 60 * 1e3;
4248
4310
  }
4249
4311
  async getAll() {
4250
- return Object.fromEntries(__privateGet$3(this, _map));
4312
+ return Object.fromEntries(__privateGet$2(this, _map));
4251
4313
  }
4252
4314
  async get(key) {
4253
- return __privateGet$3(this, _map).get(key) ?? null;
4315
+ return __privateGet$2(this, _map).get(key) ?? null;
4254
4316
  }
4255
4317
  async set(key, value) {
4256
4318
  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;
4319
+ __privateGet$2(this, _map).set(key, value);
4320
+ if (__privateGet$2(this, _map).size > this.capacity) {
4321
+ const leastRecentlyUsed = __privateGet$2(this, _map).keys().next().value;
4260
4322
  await this.delete(leastRecentlyUsed);
4261
4323
  }
4262
4324
  }
4263
4325
  async delete(key) {
4264
- __privateGet$3(this, _map).delete(key);
4326
+ __privateGet$2(this, _map).delete(key);
4265
4327
  }
4266
4328
  async clear() {
4267
- return __privateGet$3(this, _map).clear();
4329
+ return __privateGet$2(this, _map).clear();
4268
4330
  }
4269
4331
  }
4270
4332
  _map = new WeakMap();
@@ -4301,7 +4363,7 @@ var __accessCheck$2 = (obj, member, msg) => {
4301
4363
  if (!member.has(obj))
4302
4364
  throw TypeError("Cannot " + msg);
4303
4365
  };
4304
- var __privateGet$2 = (obj, member, getter) => {
4366
+ var __privateGet$1 = (obj, member, getter) => {
4305
4367
  __accessCheck$2(obj, member, "read from private field");
4306
4368
  return getter ? getter.call(obj) : member.get(obj);
4307
4369
  };
@@ -4310,18 +4372,11 @@ var __privateAdd$2 = (obj, member, value) => {
4310
4372
  throw TypeError("Cannot add the same private member more than once");
4311
4373
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
4312
4374
  };
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;
4375
+ var _tables;
4319
4376
  class SchemaPlugin extends XataPlugin {
4320
- constructor(schemaTables) {
4377
+ constructor() {
4321
4378
  super();
4322
4379
  __privateAdd$2(this, _tables, {});
4323
- __privateAdd$2(this, _schemaTables$1, void 0);
4324
- __privateSet$2(this, _schemaTables$1, schemaTables);
4325
4380
  }
4326
4381
  build(pluginOptions) {
4327
4382
  const db = new Proxy(
@@ -4330,22 +4385,21 @@ class SchemaPlugin extends XataPlugin {
4330
4385
  get: (_target, table) => {
4331
4386
  if (!isString(table))
4332
4387
  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) });
4388
+ if (__privateGet$1(this, _tables)[table] === void 0) {
4389
+ __privateGet$1(this, _tables)[table] = new RestRepository({ db, pluginOptions, table, schemaTables: pluginOptions.tables });
4335
4390
  }
4336
- return __privateGet$2(this, _tables)[table];
4391
+ return __privateGet$1(this, _tables)[table];
4337
4392
  }
4338
4393
  }
4339
4394
  );
4340
- const tableNames = __privateGet$2(this, _schemaTables$1)?.map(({ name }) => name) ?? [];
4395
+ const tableNames = pluginOptions.tables?.map(({ name }) => name) ?? [];
4341
4396
  for (const table of tableNames) {
4342
- db[table] = new RestRepository({ db, pluginOptions, table, schemaTables: __privateGet$2(this, _schemaTables$1) });
4397
+ db[table] = new RestRepository({ db, pluginOptions, table, schemaTables: pluginOptions.tables });
4343
4398
  }
4344
4399
  return db;
4345
4400
  }
4346
4401
  }
4347
4402
  _tables = new WeakMap();
4348
- _schemaTables$1 = new WeakMap();
4349
4403
 
4350
4404
  class FilesPlugin extends XataPlugin {
4351
4405
  build(pluginOptions) {
@@ -4425,54 +4479,40 @@ var __accessCheck$1 = (obj, member, msg) => {
4425
4479
  if (!member.has(obj))
4426
4480
  throw TypeError("Cannot " + msg);
4427
4481
  };
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
4482
  var __privateAdd$1 = (obj, member, value) => {
4433
4483
  if (member.has(obj))
4434
4484
  throw TypeError("Cannot add the same private member more than once");
4435
4485
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
4436
4486
  };
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
4487
  var __privateMethod$1 = (obj, member, method) => {
4443
4488
  __accessCheck$1(obj, member, "access private method");
4444
4489
  return method;
4445
4490
  };
4446
- var _schemaTables, _search, search_fn, _getSchemaTables, getSchemaTables_fn;
4491
+ var _search, search_fn;
4447
4492
  class SearchPlugin extends XataPlugin {
4448
- constructor(db, schemaTables) {
4493
+ constructor(db) {
4449
4494
  super();
4450
4495
  this.db = db;
4451
4496
  __privateAdd$1(this, _search);
4452
- __privateAdd$1(this, _getSchemaTables);
4453
- __privateAdd$1(this, _schemaTables, void 0);
4454
- __privateSet$1(this, _schemaTables, schemaTables);
4455
4497
  }
4456
4498
  build(pluginOptions) {
4457
4499
  return {
4458
4500
  all: async (query, options = {}) => {
4459
4501
  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
4502
  return {
4462
4503
  totalCount,
4463
4504
  records: records.map((record) => {
4464
4505
  const { table = "orphan" } = record.xata;
4465
- return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
4506
+ return { table, record: initObject(this.db, pluginOptions.tables, table, record, ["*"]) };
4466
4507
  })
4467
4508
  };
4468
4509
  },
4469
4510
  byTable: async (query, options = {}) => {
4470
4511
  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
4512
  const records = rawRecords.reduce((acc, record) => {
4473
4513
  const { table = "orphan" } = record.xata;
4474
4514
  const items = acc[table] ?? [];
4475
- const item = initObject(this.db, schemaTables, table, record, ["*"]);
4515
+ const item = initObject(this.db, pluginOptions.tables, table, record, ["*"]);
4476
4516
  return { ...acc, [table]: [...items, item] };
4477
4517
  }, {});
4478
4518
  return { totalCount, records };
@@ -4480,29 +4520,17 @@ class SearchPlugin extends XataPlugin {
4480
4520
  };
4481
4521
  }
4482
4522
  }
4483
- _schemaTables = new WeakMap();
4484
4523
  _search = new WeakSet();
4485
4524
  search_fn = async function(query, options, pluginOptions) {
4486
4525
  const { tables, fuzziness, highlight, prefix, page } = options ?? {};
4487
4526
  const { records, totalCount } = await searchBranch({
4488
4527
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4489
- // @ts-ignore https://github.com/xataio/client-ts/issues/313
4528
+ // @ts-expect-error Filter properties do not match inferred type
4490
4529
  body: { tables, query, fuzziness, prefix, highlight, page },
4491
4530
  ...pluginOptions
4492
4531
  });
4493
4532
  return { records, totalCount };
4494
4533
  };
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
4534
 
4507
4535
  function escapeElement(elementRepresentation) {
4508
4536
  const escaped = elementRepresentation.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
@@ -4625,7 +4653,7 @@ var __privateMethod = (obj, member, method) => {
4625
4653
  const buildClient = (plugins) => {
4626
4654
  var _options, _parseOptions, parseOptions_fn, _getFetchProps, getFetchProps_fn, _a;
4627
4655
  return _a = class {
4628
- constructor(options = {}, schemaTables) {
4656
+ constructor(options = {}, tables) {
4629
4657
  __privateAdd(this, _parseOptions);
4630
4658
  __privateAdd(this, _getFetchProps);
4631
4659
  __privateAdd(this, _options, void 0);
@@ -4634,13 +4662,15 @@ const buildClient = (plugins) => {
4634
4662
  const pluginOptions = {
4635
4663
  ...__privateMethod(this, _getFetchProps, getFetchProps_fn).call(this, safeOptions),
4636
4664
  cache: safeOptions.cache,
4637
- host: safeOptions.host
4665
+ host: safeOptions.host,
4666
+ tables
4638
4667
  };
4639
- const db = new SchemaPlugin(schemaTables).build(pluginOptions);
4640
- const search = new SearchPlugin(db, schemaTables).build(pluginOptions);
4668
+ const db = new SchemaPlugin().build(pluginOptions);
4669
+ const search = new SearchPlugin(db).build(pluginOptions);
4641
4670
  const transactions = new TransactionPlugin().build(pluginOptions);
4642
4671
  const sql = new SQLPlugin().build(pluginOptions);
4643
4672
  const files = new FilesPlugin().build(pluginOptions);
4673
+ this.schema = { tables };
4644
4674
  this.db = db;
4645
4675
  this.search = search;
4646
4676
  this.transactions = transactions;
@@ -4825,6 +4855,7 @@ exports.PAGINATION_DEFAULT_SIZE = PAGINATION_DEFAULT_SIZE;
4825
4855
  exports.PAGINATION_MAX_OFFSET = PAGINATION_MAX_OFFSET;
4826
4856
  exports.PAGINATION_MAX_SIZE = PAGINATION_MAX_SIZE;
4827
4857
  exports.Page = Page;
4858
+ exports.PageRecordArray = PageRecordArray;
4828
4859
  exports.Query = Query;
4829
4860
  exports.RecordArray = RecordArray;
4830
4861
  exports.RecordColumnTypes = RecordColumnTypes;