@xata.io/client 0.28.4 → 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.28.4";
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 {
2977
+ constructor(...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 {
2942
3004
  constructor(...args) {
2943
- super(..._RecordArray.parseConstructorParams(...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
  }
@@ -3294,7 +3356,6 @@ const RecordColumnTypes = [
3294
3356
  "email",
3295
3357
  "multiple",
3296
3358
  "link",
3297
- "object",
3298
3359
  "datetime",
3299
3360
  "vector",
3300
3361
  "file[]",
@@ -3359,7 +3420,7 @@ var __accessCheck$4 = (obj, member, msg) => {
3359
3420
  if (!member.has(obj))
3360
3421
  throw TypeError("Cannot " + msg);
3361
3422
  };
3362
- var __privateGet$4 = (obj, member, getter) => {
3423
+ var __privateGet$3 = (obj, member, getter) => {
3363
3424
  __accessCheck$4(obj, member, "read from private field");
3364
3425
  return getter ? getter.call(obj) : member.get(obj);
3365
3426
  };
@@ -3368,7 +3429,7 @@ var __privateAdd$4 = (obj, member, value) => {
3368
3429
  throw TypeError("Cannot add the same private member more than once");
3369
3430
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
3370
3431
  };
3371
- var __privateSet$4 = (obj, member, value, setter) => {
3432
+ var __privateSet$2 = (obj, member, value, setter) => {
3372
3433
  __accessCheck$4(obj, member, "write to private field");
3373
3434
  setter ? setter.call(obj, value) : member.set(obj, value);
3374
3435
  return value;
@@ -3377,7 +3438,7 @@ var __privateMethod$2 = (obj, member, method) => {
3377
3438
  __accessCheck$4(obj, member, "access private method");
3378
3439
  return method;
3379
3440
  };
3380
- 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;
3381
3442
  const BULK_OPERATION_MAX_SIZE = 1e3;
3382
3443
  class Repository extends Query {
3383
3444
  }
@@ -3398,31 +3459,31 @@ class RestRepository extends Query {
3398
3459
  __privateAdd$4(this, _deleteRecords);
3399
3460
  __privateAdd$4(this, _setCacheQuery);
3400
3461
  __privateAdd$4(this, _getCacheQuery);
3401
- __privateAdd$4(this, _getSchemaTables$1);
3462
+ __privateAdd$4(this, _getSchemaTables);
3402
3463
  __privateAdd$4(this, _transformObjectToApi);
3403
3464
  __privateAdd$4(this, _table, void 0);
3404
3465
  __privateAdd$4(this, _getFetchProps, void 0);
3405
3466
  __privateAdd$4(this, _db, void 0);
3406
3467
  __privateAdd$4(this, _cache, void 0);
3407
- __privateAdd$4(this, _schemaTables$2, void 0);
3468
+ __privateAdd$4(this, _schemaTables, void 0);
3408
3469
  __privateAdd$4(this, _trace, void 0);
3409
- __privateSet$4(this, _table, options.table);
3410
- __privateSet$4(this, _db, options.db);
3411
- __privateSet$4(this, _cache, options.pluginOptions.cache);
3412
- __privateSet$4(this, _schemaTables$2, options.schemaTables);
3413
- __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() }));
3414
3475
  const trace = options.pluginOptions.trace ?? defaultTrace;
3415
- __privateSet$4(this, _trace, async (name, fn, options2 = {}) => {
3476
+ __privateSet$2(this, _trace, async (name, fn, options2 = {}) => {
3416
3477
  return trace(name, fn, {
3417
3478
  ...options2,
3418
- [TraceAttributes.TABLE]: __privateGet$4(this, _table),
3479
+ [TraceAttributes.TABLE]: __privateGet$3(this, _table),
3419
3480
  [TraceAttributes.KIND]: "sdk-operation",
3420
3481
  [TraceAttributes.VERSION]: VERSION
3421
3482
  });
3422
3483
  });
3423
3484
  }
3424
3485
  async create(a, b, c, d) {
3425
- return __privateGet$4(this, _trace).call(this, "create", async () => {
3486
+ return __privateGet$3(this, _trace).call(this, "create", async () => {
3426
3487
  const ifVersion = parseIfVersion(b, c, d);
3427
3488
  if (Array.isArray(a)) {
3428
3489
  if (a.length === 0)
@@ -3452,7 +3513,7 @@ class RestRepository extends Query {
3452
3513
  });
3453
3514
  }
3454
3515
  async read(a, b) {
3455
- return __privateGet$4(this, _trace).call(this, "read", async () => {
3516
+ return __privateGet$3(this, _trace).call(this, "read", async () => {
3456
3517
  const columns = isValidSelectableColumns(b) ? b : ["*"];
3457
3518
  if (Array.isArray(a)) {
3458
3519
  if (a.length === 0)
@@ -3473,17 +3534,17 @@ class RestRepository extends Query {
3473
3534
  workspace: "{workspaceId}",
3474
3535
  dbBranchName: "{dbBranch}",
3475
3536
  region: "{region}",
3476
- tableName: __privateGet$4(this, _table),
3537
+ tableName: __privateGet$3(this, _table),
3477
3538
  recordId: id
3478
3539
  },
3479
3540
  queryParams: { columns },
3480
- ...__privateGet$4(this, _getFetchProps).call(this)
3541
+ ...__privateGet$3(this, _getFetchProps).call(this)
3481
3542
  });
3482
- 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);
3483
3544
  return initObject(
3484
- __privateGet$4(this, _db),
3545
+ __privateGet$3(this, _db),
3485
3546
  schemaTables,
3486
- __privateGet$4(this, _table),
3547
+ __privateGet$3(this, _table),
3487
3548
  response,
3488
3549
  columns
3489
3550
  );
@@ -3498,7 +3559,7 @@ class RestRepository extends Query {
3498
3559
  });
3499
3560
  }
3500
3561
  async readOrThrow(a, b) {
3501
- return __privateGet$4(this, _trace).call(this, "readOrThrow", async () => {
3562
+ return __privateGet$3(this, _trace).call(this, "readOrThrow", async () => {
3502
3563
  const result = await this.read(a, b);
3503
3564
  if (Array.isArray(result)) {
3504
3565
  const missingIds = compact(
@@ -3517,7 +3578,7 @@ class RestRepository extends Query {
3517
3578
  });
3518
3579
  }
3519
3580
  async update(a, b, c, d) {
3520
- return __privateGet$4(this, _trace).call(this, "update", async () => {
3581
+ return __privateGet$3(this, _trace).call(this, "update", async () => {
3521
3582
  const ifVersion = parseIfVersion(b, c, d);
3522
3583
  if (Array.isArray(a)) {
3523
3584
  if (a.length === 0)
@@ -3550,7 +3611,7 @@ class RestRepository extends Query {
3550
3611
  });
3551
3612
  }
3552
3613
  async updateOrThrow(a, b, c, d) {
3553
- return __privateGet$4(this, _trace).call(this, "updateOrThrow", async () => {
3614
+ return __privateGet$3(this, _trace).call(this, "updateOrThrow", async () => {
3554
3615
  const result = await this.update(a, b, c, d);
3555
3616
  if (Array.isArray(result)) {
3556
3617
  const missingIds = compact(
@@ -3569,7 +3630,7 @@ class RestRepository extends Query {
3569
3630
  });
3570
3631
  }
3571
3632
  async createOrUpdate(a, b, c, d) {
3572
- return __privateGet$4(this, _trace).call(this, "createOrUpdate", async () => {
3633
+ return __privateGet$3(this, _trace).call(this, "createOrUpdate", async () => {
3573
3634
  const ifVersion = parseIfVersion(b, c, d);
3574
3635
  if (Array.isArray(a)) {
3575
3636
  if (a.length === 0)
@@ -3604,7 +3665,7 @@ class RestRepository extends Query {
3604
3665
  });
3605
3666
  }
3606
3667
  async createOrReplace(a, b, c, d) {
3607
- return __privateGet$4(this, _trace).call(this, "createOrReplace", async () => {
3668
+ return __privateGet$3(this, _trace).call(this, "createOrReplace", async () => {
3608
3669
  const ifVersion = parseIfVersion(b, c, d);
3609
3670
  if (Array.isArray(a)) {
3610
3671
  if (a.length === 0)
@@ -3636,7 +3697,7 @@ class RestRepository extends Query {
3636
3697
  });
3637
3698
  }
3638
3699
  async delete(a, b) {
3639
- return __privateGet$4(this, _trace).call(this, "delete", async () => {
3700
+ return __privateGet$3(this, _trace).call(this, "delete", async () => {
3640
3701
  if (Array.isArray(a)) {
3641
3702
  if (a.length === 0)
3642
3703
  return [];
@@ -3662,7 +3723,7 @@ class RestRepository extends Query {
3662
3723
  });
3663
3724
  }
3664
3725
  async deleteOrThrow(a, b) {
3665
- return __privateGet$4(this, _trace).call(this, "deleteOrThrow", async () => {
3726
+ return __privateGet$3(this, _trace).call(this, "deleteOrThrow", async () => {
3666
3727
  const result = await this.delete(a, b);
3667
3728
  if (Array.isArray(result)) {
3668
3729
  const missingIds = compact(
@@ -3680,13 +3741,13 @@ class RestRepository extends Query {
3680
3741
  });
3681
3742
  }
3682
3743
  async search(query, options = {}) {
3683
- return __privateGet$4(this, _trace).call(this, "search", async () => {
3744
+ return __privateGet$3(this, _trace).call(this, "search", async () => {
3684
3745
  const { records, totalCount } = await searchTable({
3685
3746
  pathParams: {
3686
3747
  workspace: "{workspaceId}",
3687
3748
  dbBranchName: "{dbBranch}",
3688
3749
  region: "{region}",
3689
- tableName: __privateGet$4(this, _table)
3750
+ tableName: __privateGet$3(this, _table)
3690
3751
  },
3691
3752
  body: {
3692
3753
  query,
@@ -3698,23 +3759,23 @@ class RestRepository extends Query {
3698
3759
  page: options.page,
3699
3760
  target: options.target
3700
3761
  },
3701
- ...__privateGet$4(this, _getFetchProps).call(this)
3762
+ ...__privateGet$3(this, _getFetchProps).call(this)
3702
3763
  });
3703
- 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);
3704
3765
  return {
3705
- 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, ["*"])),
3706
3767
  totalCount
3707
3768
  };
3708
3769
  });
3709
3770
  }
3710
3771
  async vectorSearch(column, query, options) {
3711
- return __privateGet$4(this, _trace).call(this, "vectorSearch", async () => {
3772
+ return __privateGet$3(this, _trace).call(this, "vectorSearch", async () => {
3712
3773
  const { records, totalCount } = await vectorSearchTable({
3713
3774
  pathParams: {
3714
3775
  workspace: "{workspaceId}",
3715
3776
  dbBranchName: "{dbBranch}",
3716
3777
  region: "{region}",
3717
- tableName: __privateGet$4(this, _table)
3778
+ tableName: __privateGet$3(this, _table)
3718
3779
  },
3719
3780
  body: {
3720
3781
  column,
@@ -3723,32 +3784,32 @@ class RestRepository extends Query {
3723
3784
  size: options?.size,
3724
3785
  filter: options?.filter
3725
3786
  },
3726
- ...__privateGet$4(this, _getFetchProps).call(this)
3787
+ ...__privateGet$3(this, _getFetchProps).call(this)
3727
3788
  });
3728
- 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);
3729
3790
  return {
3730
- 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, ["*"])),
3731
3792
  totalCount
3732
3793
  };
3733
3794
  });
3734
3795
  }
3735
3796
  async aggregate(aggs, filter) {
3736
- return __privateGet$4(this, _trace).call(this, "aggregate", async () => {
3797
+ return __privateGet$3(this, _trace).call(this, "aggregate", async () => {
3737
3798
  const result = await aggregateTable({
3738
3799
  pathParams: {
3739
3800
  workspace: "{workspaceId}",
3740
3801
  dbBranchName: "{dbBranch}",
3741
3802
  region: "{region}",
3742
- tableName: __privateGet$4(this, _table)
3803
+ tableName: __privateGet$3(this, _table)
3743
3804
  },
3744
3805
  body: { aggs, filter },
3745
- ...__privateGet$4(this, _getFetchProps).call(this)
3806
+ ...__privateGet$3(this, _getFetchProps).call(this)
3746
3807
  });
3747
3808
  return result;
3748
3809
  });
3749
3810
  }
3750
3811
  async query(query) {
3751
- return __privateGet$4(this, _trace).call(this, "query", async () => {
3812
+ return __privateGet$3(this, _trace).call(this, "query", async () => {
3752
3813
  const cacheQuery = await __privateMethod$2(this, _getCacheQuery, getCacheQuery_fn).call(this, query);
3753
3814
  if (cacheQuery)
3754
3815
  return new Page(query, cacheQuery.meta, cacheQuery.records);
@@ -3758,7 +3819,7 @@ class RestRepository extends Query {
3758
3819
  workspace: "{workspaceId}",
3759
3820
  dbBranchName: "{dbBranch}",
3760
3821
  region: "{region}",
3761
- tableName: __privateGet$4(this, _table)
3822
+ tableName: __privateGet$3(this, _table)
3762
3823
  },
3763
3824
  body: {
3764
3825
  filter: cleanFilter(data.filter),
@@ -3768,14 +3829,14 @@ class RestRepository extends Query {
3768
3829
  consistency: data.consistency
3769
3830
  },
3770
3831
  fetchOptions: data.fetchOptions,
3771
- ...__privateGet$4(this, _getFetchProps).call(this)
3832
+ ...__privateGet$3(this, _getFetchProps).call(this)
3772
3833
  });
3773
- 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);
3774
3835
  const records = objects.map(
3775
3836
  (record) => initObject(
3776
- __privateGet$4(this, _db),
3837
+ __privateGet$3(this, _db),
3777
3838
  schemaTables,
3778
- __privateGet$4(this, _table),
3839
+ __privateGet$3(this, _table),
3779
3840
  record,
3780
3841
  data.columns ?? ["*"]
3781
3842
  )
@@ -3785,14 +3846,14 @@ class RestRepository extends Query {
3785
3846
  });
3786
3847
  }
3787
3848
  async summarizeTable(query, summaries, summariesFilter) {
3788
- return __privateGet$4(this, _trace).call(this, "summarize", async () => {
3849
+ return __privateGet$3(this, _trace).call(this, "summarize", async () => {
3789
3850
  const data = query.getQueryOptions();
3790
3851
  const result = await summarizeTable({
3791
3852
  pathParams: {
3792
3853
  workspace: "{workspaceId}",
3793
3854
  dbBranchName: "{dbBranch}",
3794
3855
  region: "{region}",
3795
- tableName: __privateGet$4(this, _table)
3856
+ tableName: __privateGet$3(this, _table)
3796
3857
  },
3797
3858
  body: {
3798
3859
  filter: cleanFilter(data.filter),
@@ -3803,13 +3864,13 @@ class RestRepository extends Query {
3803
3864
  summaries,
3804
3865
  summariesFilter
3805
3866
  },
3806
- ...__privateGet$4(this, _getFetchProps).call(this)
3867
+ ...__privateGet$3(this, _getFetchProps).call(this)
3807
3868
  });
3808
- 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);
3809
3870
  return {
3810
3871
  ...result,
3811
3872
  summaries: result.summaries.map(
3812
- (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 ?? [])
3813
3874
  )
3814
3875
  };
3815
3876
  });
@@ -3821,7 +3882,7 @@ class RestRepository extends Query {
3821
3882
  workspace: "{workspaceId}",
3822
3883
  dbBranchName: "{dbBranch}",
3823
3884
  region: "{region}",
3824
- tableName: __privateGet$4(this, _table),
3885
+ tableName: __privateGet$3(this, _table),
3825
3886
  sessionId: options?.sessionId
3826
3887
  },
3827
3888
  body: {
@@ -3831,7 +3892,7 @@ class RestRepository extends Query {
3831
3892
  search: options?.searchType === "keyword" ? options?.search : void 0,
3832
3893
  vectorSearch: options?.searchType === "vector" ? options?.vectorSearch : void 0
3833
3894
  },
3834
- ...__privateGet$4(this, _getFetchProps).call(this)
3895
+ ...__privateGet$3(this, _getFetchProps).call(this)
3835
3896
  };
3836
3897
  if (options?.onMessage) {
3837
3898
  fetchSSERequest({
@@ -3852,7 +3913,7 @@ _table = new WeakMap();
3852
3913
  _getFetchProps = new WeakMap();
3853
3914
  _db = new WeakMap();
3854
3915
  _cache = new WeakMap();
3855
- _schemaTables$2 = new WeakMap();
3916
+ _schemaTables = new WeakMap();
3856
3917
  _trace = new WeakMap();
3857
3918
  _insertRecordWithoutId = new WeakSet();
3858
3919
  insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
@@ -3862,14 +3923,14 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
3862
3923
  workspace: "{workspaceId}",
3863
3924
  dbBranchName: "{dbBranch}",
3864
3925
  region: "{region}",
3865
- tableName: __privateGet$4(this, _table)
3926
+ tableName: __privateGet$3(this, _table)
3866
3927
  },
3867
3928
  queryParams: { columns },
3868
3929
  body: record,
3869
- ...__privateGet$4(this, _getFetchProps).call(this)
3930
+ ...__privateGet$3(this, _getFetchProps).call(this)
3870
3931
  });
3871
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3872
- 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);
3873
3934
  };
3874
3935
  _insertRecordWithId = new WeakSet();
3875
3936
  insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
@@ -3881,21 +3942,21 @@ insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { crea
3881
3942
  workspace: "{workspaceId}",
3882
3943
  dbBranchName: "{dbBranch}",
3883
3944
  region: "{region}",
3884
- tableName: __privateGet$4(this, _table),
3945
+ tableName: __privateGet$3(this, _table),
3885
3946
  recordId
3886
3947
  },
3887
3948
  body: record,
3888
3949
  queryParams: { createOnly, columns, ifVersion },
3889
- ...__privateGet$4(this, _getFetchProps).call(this)
3950
+ ...__privateGet$3(this, _getFetchProps).call(this)
3890
3951
  });
3891
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3892
- 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);
3893
3954
  };
3894
3955
  _insertRecords = new WeakSet();
3895
3956
  insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
3896
3957
  const operations = await promiseMap(objects, async (object) => {
3897
3958
  const record = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
3898
- return { insert: { table: __privateGet$4(this, _table), record, createOnly, ifVersion } };
3959
+ return { insert: { table: __privateGet$3(this, _table), record, createOnly, ifVersion } };
3899
3960
  });
3900
3961
  const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
3901
3962
  const ids = [];
@@ -3907,7 +3968,7 @@ insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
3907
3968
  region: "{region}"
3908
3969
  },
3909
3970
  body: { operations: operations2 },
3910
- ...__privateGet$4(this, _getFetchProps).call(this)
3971
+ ...__privateGet$3(this, _getFetchProps).call(this)
3911
3972
  });
3912
3973
  for (const result of results) {
3913
3974
  if (result.operation === "insert") {
@@ -3930,15 +3991,15 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
3930
3991
  workspace: "{workspaceId}",
3931
3992
  dbBranchName: "{dbBranch}",
3932
3993
  region: "{region}",
3933
- tableName: __privateGet$4(this, _table),
3994
+ tableName: __privateGet$3(this, _table),
3934
3995
  recordId
3935
3996
  },
3936
3997
  queryParams: { columns, ifVersion },
3937
3998
  body: record,
3938
- ...__privateGet$4(this, _getFetchProps).call(this)
3999
+ ...__privateGet$3(this, _getFetchProps).call(this)
3939
4000
  });
3940
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3941
- 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);
3942
4003
  } catch (e) {
3943
4004
  if (isObject(e) && e.status === 404) {
3944
4005
  return null;
@@ -3950,7 +4011,7 @@ _updateRecords = new WeakSet();
3950
4011
  updateRecords_fn = async function(objects, { ifVersion, upsert }) {
3951
4012
  const operations = await promiseMap(objects, async ({ id, ...object }) => {
3952
4013
  const fields = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
3953
- return { update: { table: __privateGet$4(this, _table), id, ifVersion, upsert, fields } };
4014
+ return { update: { table: __privateGet$3(this, _table), id, ifVersion, upsert, fields } };
3954
4015
  });
3955
4016
  const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
3956
4017
  const ids = [];
@@ -3962,7 +4023,7 @@ updateRecords_fn = async function(objects, { ifVersion, upsert }) {
3962
4023
  region: "{region}"
3963
4024
  },
3964
4025
  body: { operations: operations2 },
3965
- ...__privateGet$4(this, _getFetchProps).call(this)
4026
+ ...__privateGet$3(this, _getFetchProps).call(this)
3966
4027
  });
3967
4028
  for (const result of results) {
3968
4029
  if (result.operation === "update") {
@@ -3983,15 +4044,15 @@ upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
3983
4044
  workspace: "{workspaceId}",
3984
4045
  dbBranchName: "{dbBranch}",
3985
4046
  region: "{region}",
3986
- tableName: __privateGet$4(this, _table),
4047
+ tableName: __privateGet$3(this, _table),
3987
4048
  recordId
3988
4049
  },
3989
4050
  queryParams: { columns, ifVersion },
3990
4051
  body: object,
3991
- ...__privateGet$4(this, _getFetchProps).call(this)
4052
+ ...__privateGet$3(this, _getFetchProps).call(this)
3992
4053
  });
3993
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3994
- 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);
3995
4056
  };
3996
4057
  _deleteRecord = new WeakSet();
3997
4058
  deleteRecord_fn = async function(recordId, columns = ["*"]) {
@@ -4003,14 +4064,14 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
4003
4064
  workspace: "{workspaceId}",
4004
4065
  dbBranchName: "{dbBranch}",
4005
4066
  region: "{region}",
4006
- tableName: __privateGet$4(this, _table),
4067
+ tableName: __privateGet$3(this, _table),
4007
4068
  recordId
4008
4069
  },
4009
4070
  queryParams: { columns },
4010
- ...__privateGet$4(this, _getFetchProps).call(this)
4071
+ ...__privateGet$3(this, _getFetchProps).call(this)
4011
4072
  });
4012
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
4013
- 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);
4014
4075
  } catch (e) {
4015
4076
  if (isObject(e) && e.status === 404) {
4016
4077
  return null;
@@ -4021,7 +4082,7 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
4021
4082
  _deleteRecords = new WeakSet();
4022
4083
  deleteRecords_fn = async function(recordIds) {
4023
4084
  const chunkedOperations = chunk(
4024
- compact(recordIds).map((id) => ({ delete: { table: __privateGet$4(this, _table), id } })),
4085
+ compact(recordIds).map((id) => ({ delete: { table: __privateGet$3(this, _table), id } })),
4025
4086
  BULK_OPERATION_MAX_SIZE
4026
4087
  );
4027
4088
  for (const operations of chunkedOperations) {
@@ -4032,44 +4093,44 @@ deleteRecords_fn = async function(recordIds) {
4032
4093
  region: "{region}"
4033
4094
  },
4034
4095
  body: { operations },
4035
- ...__privateGet$4(this, _getFetchProps).call(this)
4096
+ ...__privateGet$3(this, _getFetchProps).call(this)
4036
4097
  });
4037
4098
  }
4038
4099
  };
4039
4100
  _setCacheQuery = new WeakSet();
4040
4101
  setCacheQuery_fn = async function(query, meta, records) {
4041
- 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 });
4042
4103
  };
4043
4104
  _getCacheQuery = new WeakSet();
4044
4105
  getCacheQuery_fn = async function(query) {
4045
- const key = `query_${__privateGet$4(this, _table)}:${query.key()}`;
4046
- 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);
4047
4108
  if (!result)
4048
4109
  return null;
4049
- const defaultTTL = __privateGet$4(this, _cache)?.defaultQueryTTL ?? -1;
4110
+ const defaultTTL = __privateGet$3(this, _cache)?.defaultQueryTTL ?? -1;
4050
4111
  const { cache: ttl = defaultTTL } = query.getQueryOptions();
4051
4112
  if (ttl < 0)
4052
4113
  return null;
4053
4114
  const hasExpired = result.date.getTime() + ttl < Date.now();
4054
4115
  return hasExpired ? null : result;
4055
4116
  };
4056
- _getSchemaTables$1 = new WeakSet();
4057
- getSchemaTables_fn$1 = async function() {
4058
- if (__privateGet$4(this, _schemaTables$2))
4059
- 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);
4060
4121
  const { schema } = await getBranchDetails({
4061
4122
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4062
- ...__privateGet$4(this, _getFetchProps).call(this)
4123
+ ...__privateGet$3(this, _getFetchProps).call(this)
4063
4124
  });
4064
- __privateSet$4(this, _schemaTables$2, schema.tables);
4125
+ __privateSet$2(this, _schemaTables, schema.tables);
4065
4126
  return schema.tables;
4066
4127
  };
4067
4128
  _transformObjectToApi = new WeakSet();
4068
4129
  transformObjectToApi_fn = async function(object) {
4069
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
4070
- 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));
4071
4132
  if (!schema)
4072
- 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`);
4073
4134
  const result = {};
4074
4135
  for (const [key, value] of Object.entries(object)) {
4075
4136
  if (key === "xata")
@@ -4225,7 +4286,7 @@ var __accessCheck$3 = (obj, member, msg) => {
4225
4286
  if (!member.has(obj))
4226
4287
  throw TypeError("Cannot " + msg);
4227
4288
  };
4228
- var __privateGet$3 = (obj, member, getter) => {
4289
+ var __privateGet$2 = (obj, member, getter) => {
4229
4290
  __accessCheck$3(obj, member, "read from private field");
4230
4291
  return getter ? getter.call(obj) : member.get(obj);
4231
4292
  };
@@ -4234,7 +4295,7 @@ var __privateAdd$3 = (obj, member, value) => {
4234
4295
  throw TypeError("Cannot add the same private member more than once");
4235
4296
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
4236
4297
  };
4237
- var __privateSet$3 = (obj, member, value, setter) => {
4298
+ var __privateSet$1 = (obj, member, value, setter) => {
4238
4299
  __accessCheck$3(obj, member, "write to private field");
4239
4300
  setter ? setter.call(obj, value) : member.set(obj, value);
4240
4301
  return value;
@@ -4243,29 +4304,29 @@ var _map;
4243
4304
  class SimpleCache {
4244
4305
  constructor(options = {}) {
4245
4306
  __privateAdd$3(this, _map, void 0);
4246
- __privateSet$3(this, _map, /* @__PURE__ */ new Map());
4307
+ __privateSet$1(this, _map, /* @__PURE__ */ new Map());
4247
4308
  this.capacity = options.max ?? 500;
4248
4309
  this.defaultQueryTTL = options.defaultQueryTTL ?? 60 * 1e3;
4249
4310
  }
4250
4311
  async getAll() {
4251
- return Object.fromEntries(__privateGet$3(this, _map));
4312
+ return Object.fromEntries(__privateGet$2(this, _map));
4252
4313
  }
4253
4314
  async get(key) {
4254
- return __privateGet$3(this, _map).get(key) ?? null;
4315
+ return __privateGet$2(this, _map).get(key) ?? null;
4255
4316
  }
4256
4317
  async set(key, value) {
4257
4318
  await this.delete(key);
4258
- __privateGet$3(this, _map).set(key, value);
4259
- if (__privateGet$3(this, _map).size > this.capacity) {
4260
- 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;
4261
4322
  await this.delete(leastRecentlyUsed);
4262
4323
  }
4263
4324
  }
4264
4325
  async delete(key) {
4265
- __privateGet$3(this, _map).delete(key);
4326
+ __privateGet$2(this, _map).delete(key);
4266
4327
  }
4267
4328
  async clear() {
4268
- return __privateGet$3(this, _map).clear();
4329
+ return __privateGet$2(this, _map).clear();
4269
4330
  }
4270
4331
  }
4271
4332
  _map = new WeakMap();
@@ -4302,7 +4363,7 @@ var __accessCheck$2 = (obj, member, msg) => {
4302
4363
  if (!member.has(obj))
4303
4364
  throw TypeError("Cannot " + msg);
4304
4365
  };
4305
- var __privateGet$2 = (obj, member, getter) => {
4366
+ var __privateGet$1 = (obj, member, getter) => {
4306
4367
  __accessCheck$2(obj, member, "read from private field");
4307
4368
  return getter ? getter.call(obj) : member.get(obj);
4308
4369
  };
@@ -4311,18 +4372,11 @@ var __privateAdd$2 = (obj, member, value) => {
4311
4372
  throw TypeError("Cannot add the same private member more than once");
4312
4373
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
4313
4374
  };
4314
- var __privateSet$2 = (obj, member, value, setter) => {
4315
- __accessCheck$2(obj, member, "write to private field");
4316
- setter ? setter.call(obj, value) : member.set(obj, value);
4317
- return value;
4318
- };
4319
- var _tables, _schemaTables$1;
4375
+ var _tables;
4320
4376
  class SchemaPlugin extends XataPlugin {
4321
- constructor(schemaTables) {
4377
+ constructor() {
4322
4378
  super();
4323
4379
  __privateAdd$2(this, _tables, {});
4324
- __privateAdd$2(this, _schemaTables$1, void 0);
4325
- __privateSet$2(this, _schemaTables$1, schemaTables);
4326
4380
  }
4327
4381
  build(pluginOptions) {
4328
4382
  const db = new Proxy(
@@ -4331,22 +4385,21 @@ class SchemaPlugin extends XataPlugin {
4331
4385
  get: (_target, table) => {
4332
4386
  if (!isString(table))
4333
4387
  throw new Error("Invalid table name");
4334
- if (__privateGet$2(this, _tables)[table] === void 0) {
4335
- __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 });
4336
4390
  }
4337
- return __privateGet$2(this, _tables)[table];
4391
+ return __privateGet$1(this, _tables)[table];
4338
4392
  }
4339
4393
  }
4340
4394
  );
4341
- const tableNames = __privateGet$2(this, _schemaTables$1)?.map(({ name }) => name) ?? [];
4395
+ const tableNames = pluginOptions.tables?.map(({ name }) => name) ?? [];
4342
4396
  for (const table of tableNames) {
4343
- db[table] = new RestRepository({ db, pluginOptions, table, schemaTables: __privateGet$2(this, _schemaTables$1) });
4397
+ db[table] = new RestRepository({ db, pluginOptions, table, schemaTables: pluginOptions.tables });
4344
4398
  }
4345
4399
  return db;
4346
4400
  }
4347
4401
  }
4348
4402
  _tables = new WeakMap();
4349
- _schemaTables$1 = new WeakMap();
4350
4403
 
4351
4404
  class FilesPlugin extends XataPlugin {
4352
4405
  build(pluginOptions) {
@@ -4426,54 +4479,40 @@ var __accessCheck$1 = (obj, member, msg) => {
4426
4479
  if (!member.has(obj))
4427
4480
  throw TypeError("Cannot " + msg);
4428
4481
  };
4429
- var __privateGet$1 = (obj, member, getter) => {
4430
- __accessCheck$1(obj, member, "read from private field");
4431
- return getter ? getter.call(obj) : member.get(obj);
4432
- };
4433
4482
  var __privateAdd$1 = (obj, member, value) => {
4434
4483
  if (member.has(obj))
4435
4484
  throw TypeError("Cannot add the same private member more than once");
4436
4485
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
4437
4486
  };
4438
- var __privateSet$1 = (obj, member, value, setter) => {
4439
- __accessCheck$1(obj, member, "write to private field");
4440
- setter ? setter.call(obj, value) : member.set(obj, value);
4441
- return value;
4442
- };
4443
4487
  var __privateMethod$1 = (obj, member, method) => {
4444
4488
  __accessCheck$1(obj, member, "access private method");
4445
4489
  return method;
4446
4490
  };
4447
- var _schemaTables, _search, search_fn, _getSchemaTables, getSchemaTables_fn;
4491
+ var _search, search_fn;
4448
4492
  class SearchPlugin extends XataPlugin {
4449
- constructor(db, schemaTables) {
4493
+ constructor(db) {
4450
4494
  super();
4451
4495
  this.db = db;
4452
4496
  __privateAdd$1(this, _search);
4453
- __privateAdd$1(this, _getSchemaTables);
4454
- __privateAdd$1(this, _schemaTables, void 0);
4455
- __privateSet$1(this, _schemaTables, schemaTables);
4456
4497
  }
4457
4498
  build(pluginOptions) {
4458
4499
  return {
4459
4500
  all: async (query, options = {}) => {
4460
4501
  const { records, totalCount } = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4461
- const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, pluginOptions);
4462
4502
  return {
4463
4503
  totalCount,
4464
4504
  records: records.map((record) => {
4465
4505
  const { table = "orphan" } = record.xata;
4466
- return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
4506
+ return { table, record: initObject(this.db, pluginOptions.tables, table, record, ["*"]) };
4467
4507
  })
4468
4508
  };
4469
4509
  },
4470
4510
  byTable: async (query, options = {}) => {
4471
4511
  const { records: rawRecords, totalCount } = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4472
- const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, pluginOptions);
4473
4512
  const records = rawRecords.reduce((acc, record) => {
4474
4513
  const { table = "orphan" } = record.xata;
4475
4514
  const items = acc[table] ?? [];
4476
- const item = initObject(this.db, schemaTables, table, record, ["*"]);
4515
+ const item = initObject(this.db, pluginOptions.tables, table, record, ["*"]);
4477
4516
  return { ...acc, [table]: [...items, item] };
4478
4517
  }, {});
4479
4518
  return { totalCount, records };
@@ -4481,29 +4520,17 @@ class SearchPlugin extends XataPlugin {
4481
4520
  };
4482
4521
  }
4483
4522
  }
4484
- _schemaTables = new WeakMap();
4485
4523
  _search = new WeakSet();
4486
4524
  search_fn = async function(query, options, pluginOptions) {
4487
4525
  const { tables, fuzziness, highlight, prefix, page } = options ?? {};
4488
4526
  const { records, totalCount } = await searchBranch({
4489
4527
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4490
- // @ts-ignore https://github.com/xataio/client-ts/issues/313
4528
+ // @ts-expect-error Filter properties do not match inferred type
4491
4529
  body: { tables, query, fuzziness, prefix, highlight, page },
4492
4530
  ...pluginOptions
4493
4531
  });
4494
4532
  return { records, totalCount };
4495
4533
  };
4496
- _getSchemaTables = new WeakSet();
4497
- getSchemaTables_fn = async function(pluginOptions) {
4498
- if (__privateGet$1(this, _schemaTables))
4499
- return __privateGet$1(this, _schemaTables);
4500
- const { schema } = await getBranchDetails({
4501
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4502
- ...pluginOptions
4503
- });
4504
- __privateSet$1(this, _schemaTables, schema.tables);
4505
- return schema.tables;
4506
- };
4507
4534
 
4508
4535
  function escapeElement(elementRepresentation) {
4509
4536
  const escaped = elementRepresentation.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
@@ -4565,17 +4592,26 @@ function prepareParams(param1, param2) {
4565
4592
 
4566
4593
  class SQLPlugin extends XataPlugin {
4567
4594
  build(pluginOptions) {
4568
- return async (param1, ...param2) => {
4569
- const { statement, params, consistency } = prepareParams(param1, param2);
4570
- const { records, warning } = await sqlQuery({
4595
+ return async (query, ...parameters) => {
4596
+ if (!isParamsObject(query) && (!isTemplateStringsArray(query) || !Array.isArray(parameters))) {
4597
+ throw new Error("Invalid usage of `xata.sql`. Please use it as a tagged template or with an object.");
4598
+ }
4599
+ const { statement, params, consistency } = prepareParams(query, parameters);
4600
+ const { records, warning, columns } = await sqlQuery({
4571
4601
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4572
4602
  body: { statement, params, consistency },
4573
4603
  ...pluginOptions
4574
4604
  });
4575
- return { records, warning };
4605
+ return { records, warning, columns };
4576
4606
  };
4577
4607
  }
4578
4608
  }
4609
+ function isTemplateStringsArray(strings) {
4610
+ return Array.isArray(strings) && "raw" in strings && Array.isArray(strings.raw);
4611
+ }
4612
+ function isParamsObject(params) {
4613
+ return isObject(params) && "statement" in params;
4614
+ }
4579
4615
 
4580
4616
  class TransactionPlugin extends XataPlugin {
4581
4617
  build(pluginOptions) {
@@ -4617,7 +4653,7 @@ var __privateMethod = (obj, member, method) => {
4617
4653
  const buildClient = (plugins) => {
4618
4654
  var _options, _parseOptions, parseOptions_fn, _getFetchProps, getFetchProps_fn, _a;
4619
4655
  return _a = class {
4620
- constructor(options = {}, schemaTables) {
4656
+ constructor(options = {}, tables) {
4621
4657
  __privateAdd(this, _parseOptions);
4622
4658
  __privateAdd(this, _getFetchProps);
4623
4659
  __privateAdd(this, _options, void 0);
@@ -4626,13 +4662,15 @@ const buildClient = (plugins) => {
4626
4662
  const pluginOptions = {
4627
4663
  ...__privateMethod(this, _getFetchProps, getFetchProps_fn).call(this, safeOptions),
4628
4664
  cache: safeOptions.cache,
4629
- host: safeOptions.host
4665
+ host: safeOptions.host,
4666
+ tables
4630
4667
  };
4631
- const db = new SchemaPlugin(schemaTables).build(pluginOptions);
4632
- const search = new SearchPlugin(db, schemaTables).build(pluginOptions);
4668
+ const db = new SchemaPlugin().build(pluginOptions);
4669
+ const search = new SearchPlugin(db).build(pluginOptions);
4633
4670
  const transactions = new TransactionPlugin().build(pluginOptions);
4634
4671
  const sql = new SQLPlugin().build(pluginOptions);
4635
4672
  const files = new FilesPlugin().build(pluginOptions);
4673
+ this.schema = { tables };
4636
4674
  this.db = db;
4637
4675
  this.search = search;
4638
4676
  this.transactions = transactions;
@@ -4817,6 +4855,7 @@ exports.PAGINATION_DEFAULT_SIZE = PAGINATION_DEFAULT_SIZE;
4817
4855
  exports.PAGINATION_MAX_OFFSET = PAGINATION_MAX_OFFSET;
4818
4856
  exports.PAGINATION_MAX_SIZE = PAGINATION_MAX_SIZE;
4819
4857
  exports.Page = Page;
4858
+ exports.PageRecordArray = PageRecordArray;
4820
4859
  exports.Query = Query;
4821
4860
  exports.RecordArray = RecordArray;
4822
4861
  exports.RecordColumnTypes = RecordColumnTypes;