@xata.io/client 0.0.0-alpha.vf2696e7 → 0.0.0-alpha.vf350c0a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -34,7 +34,10 @@ function getEnvVariable(name) {
34
34
  }
35
35
  async function getGitBranch() {
36
36
  try {
37
- return require("child_process").execSync("git branch --show-current", { encoding: "utf-8" }).trim();
37
+ if (typeof require === "function") {
38
+ const req = require;
39
+ return req("child_process").execSync("git branch --show-current", { encoding: "utf-8" }).trim();
40
+ }
38
41
  } catch (err) {
39
42
  }
40
43
  try {
@@ -248,6 +251,14 @@ const deleteDatabase = (variables) => fetch$1({
248
251
  method: "delete",
249
252
  ...variables
250
253
  });
254
+ const getGitBranchesMapping = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables });
255
+ const addGitBranchesEntry = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables });
256
+ const removeGitBranchesEntry = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables });
257
+ const resolveBranch = (variables) => fetch$1({
258
+ url: "/dbs/{dbName}/resolveBranch",
259
+ method: "get",
260
+ ...variables
261
+ });
251
262
  const getBranchDetails = (variables) => fetch$1({
252
263
  url: "/db/{dbBranchName}",
253
264
  method: "get",
@@ -376,7 +387,15 @@ const operationsByTag = {
376
387
  resendWorkspaceMemberInvite,
377
388
  acceptWorkspaceMemberInvite
378
389
  },
379
- database: { getDatabaseList, createDatabase, deleteDatabase },
390
+ database: {
391
+ getDatabaseList,
392
+ createDatabase,
393
+ deleteDatabase,
394
+ getGitBranchesMapping,
395
+ addGitBranchesEntry,
396
+ removeGitBranchesEntry,
397
+ resolveBranch
398
+ },
380
399
  branch: {
381
400
  getBranchList,
382
401
  getBranchDetails,
@@ -443,7 +462,7 @@ var __accessCheck$7 = (obj, member, msg) => {
443
462
  if (!member.has(obj))
444
463
  throw TypeError("Cannot " + msg);
445
464
  };
446
- var __privateGet$6 = (obj, member, getter) => {
465
+ var __privateGet$7 = (obj, member, getter) => {
447
466
  __accessCheck$7(obj, member, "read from private field");
448
467
  return getter ? getter.call(obj) : member.get(obj);
449
468
  };
@@ -452,7 +471,7 @@ var __privateAdd$7 = (obj, member, value) => {
452
471
  throw TypeError("Cannot add the same private member more than once");
453
472
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
454
473
  };
455
- var __privateSet$5 = (obj, member, value, setter) => {
474
+ var __privateSet$6 = (obj, member, value, setter) => {
456
475
  __accessCheck$7(obj, member, "write to private field");
457
476
  setter ? setter.call(obj, value) : member.set(obj, value);
458
477
  return value;
@@ -467,7 +486,7 @@ class XataApiClient {
467
486
  if (!apiKey) {
468
487
  throw new Error("Could not resolve a valid apiKey");
469
488
  }
470
- __privateSet$5(this, _extraProps, {
489
+ __privateSet$6(this, _extraProps, {
471
490
  apiUrl: getHostUrl(provider, "main"),
472
491
  workspacesApiUrl: getHostUrl(provider, "workspaces"),
473
492
  fetchImpl: getFetchImplementation(options.fetch),
@@ -475,34 +494,34 @@ class XataApiClient {
475
494
  });
476
495
  }
477
496
  get user() {
478
- if (!__privateGet$6(this, _namespaces).user)
479
- __privateGet$6(this, _namespaces).user = new UserApi(__privateGet$6(this, _extraProps));
480
- return __privateGet$6(this, _namespaces).user;
497
+ if (!__privateGet$7(this, _namespaces).user)
498
+ __privateGet$7(this, _namespaces).user = new UserApi(__privateGet$7(this, _extraProps));
499
+ return __privateGet$7(this, _namespaces).user;
481
500
  }
482
501
  get workspaces() {
483
- if (!__privateGet$6(this, _namespaces).workspaces)
484
- __privateGet$6(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$6(this, _extraProps));
485
- return __privateGet$6(this, _namespaces).workspaces;
502
+ if (!__privateGet$7(this, _namespaces).workspaces)
503
+ __privateGet$7(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$7(this, _extraProps));
504
+ return __privateGet$7(this, _namespaces).workspaces;
486
505
  }
487
506
  get databases() {
488
- if (!__privateGet$6(this, _namespaces).databases)
489
- __privateGet$6(this, _namespaces).databases = new DatabaseApi(__privateGet$6(this, _extraProps));
490
- return __privateGet$6(this, _namespaces).databases;
507
+ if (!__privateGet$7(this, _namespaces).databases)
508
+ __privateGet$7(this, _namespaces).databases = new DatabaseApi(__privateGet$7(this, _extraProps));
509
+ return __privateGet$7(this, _namespaces).databases;
491
510
  }
492
511
  get branches() {
493
- if (!__privateGet$6(this, _namespaces).branches)
494
- __privateGet$6(this, _namespaces).branches = new BranchApi(__privateGet$6(this, _extraProps));
495
- return __privateGet$6(this, _namespaces).branches;
512
+ if (!__privateGet$7(this, _namespaces).branches)
513
+ __privateGet$7(this, _namespaces).branches = new BranchApi(__privateGet$7(this, _extraProps));
514
+ return __privateGet$7(this, _namespaces).branches;
496
515
  }
497
516
  get tables() {
498
- if (!__privateGet$6(this, _namespaces).tables)
499
- __privateGet$6(this, _namespaces).tables = new TableApi(__privateGet$6(this, _extraProps));
500
- return __privateGet$6(this, _namespaces).tables;
517
+ if (!__privateGet$7(this, _namespaces).tables)
518
+ __privateGet$7(this, _namespaces).tables = new TableApi(__privateGet$7(this, _extraProps));
519
+ return __privateGet$7(this, _namespaces).tables;
501
520
  }
502
521
  get records() {
503
- if (!__privateGet$6(this, _namespaces).records)
504
- __privateGet$6(this, _namespaces).records = new RecordsApi(__privateGet$6(this, _extraProps));
505
- return __privateGet$6(this, _namespaces).records;
522
+ if (!__privateGet$7(this, _namespaces).records)
523
+ __privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
524
+ return __privateGet$7(this, _namespaces).records;
506
525
  }
507
526
  }
508
527
  _extraProps = new WeakMap();
@@ -636,6 +655,33 @@ class DatabaseApi {
636
655
  ...this.extraProps
637
656
  });
638
657
  }
658
+ getGitBranchesMapping(workspace, dbName) {
659
+ return operationsByTag.database.getGitBranchesMapping({
660
+ pathParams: { workspace, dbName },
661
+ ...this.extraProps
662
+ });
663
+ }
664
+ addGitBranchesEntry(workspace, dbName, body) {
665
+ return operationsByTag.database.addGitBranchesEntry({
666
+ pathParams: { workspace, dbName },
667
+ body,
668
+ ...this.extraProps
669
+ });
670
+ }
671
+ removeGitBranchesEntry(workspace, dbName, gitBranch) {
672
+ return operationsByTag.database.removeGitBranchesEntry({
673
+ pathParams: { workspace, dbName },
674
+ queryParams: { gitBranch },
675
+ ...this.extraProps
676
+ });
677
+ }
678
+ resolveBranch(workspace, dbName, gitBranch) {
679
+ return operationsByTag.database.resolveBranch({
680
+ pathParams: { workspace, dbName },
681
+ queryParams: { gitBranch },
682
+ ...this.extraProps
683
+ });
684
+ }
639
685
  }
640
686
  class BranchApi {
641
687
  constructor(extraProps) {
@@ -861,7 +907,7 @@ var __accessCheck$6 = (obj, member, msg) => {
861
907
  if (!member.has(obj))
862
908
  throw TypeError("Cannot " + msg);
863
909
  };
864
- var __privateGet$5 = (obj, member, getter) => {
910
+ var __privateGet$6 = (obj, member, getter) => {
865
911
  __accessCheck$6(obj, member, "read from private field");
866
912
  return getter ? getter.call(obj) : member.get(obj);
867
913
  };
@@ -870,7 +916,7 @@ var __privateAdd$6 = (obj, member, value) => {
870
916
  throw TypeError("Cannot add the same private member more than once");
871
917
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
872
918
  };
873
- var __privateSet$4 = (obj, member, value, setter) => {
919
+ var __privateSet$5 = (obj, member, value, setter) => {
874
920
  __accessCheck$6(obj, member, "write to private field");
875
921
  setter ? setter.call(obj, value) : member.set(obj, value);
876
922
  return value;
@@ -879,21 +925,21 @@ var _query;
879
925
  class Page {
880
926
  constructor(query, meta, records = []) {
881
927
  __privateAdd$6(this, _query, void 0);
882
- __privateSet$4(this, _query, query);
928
+ __privateSet$5(this, _query, query);
883
929
  this.meta = meta;
884
930
  this.records = records;
885
931
  }
886
932
  async nextPage(size, offset) {
887
- return __privateGet$5(this, _query).getPaginated({ page: { size, offset, after: this.meta.page.cursor } });
933
+ return __privateGet$6(this, _query).getPaginated({ page: { size, offset, after: this.meta.page.cursor } });
888
934
  }
889
935
  async previousPage(size, offset) {
890
- return __privateGet$5(this, _query).getPaginated({ page: { size, offset, before: this.meta.page.cursor } });
936
+ return __privateGet$6(this, _query).getPaginated({ page: { size, offset, before: this.meta.page.cursor } });
891
937
  }
892
938
  async firstPage(size, offset) {
893
- return __privateGet$5(this, _query).getPaginated({ page: { size, offset, first: this.meta.page.cursor } });
939
+ return __privateGet$6(this, _query).getPaginated({ page: { size, offset, first: this.meta.page.cursor } });
894
940
  }
895
941
  async lastPage(size, offset) {
896
- return __privateGet$5(this, _query).getPaginated({ page: { size, offset, last: this.meta.page.cursor } });
942
+ return __privateGet$6(this, _query).getPaginated({ page: { size, offset, last: this.meta.page.cursor } });
897
943
  }
898
944
  hasNextPage() {
899
945
  return this.meta.page.more;
@@ -909,7 +955,7 @@ var __accessCheck$5 = (obj, member, msg) => {
909
955
  if (!member.has(obj))
910
956
  throw TypeError("Cannot " + msg);
911
957
  };
912
- var __privateGet$4 = (obj, member, getter) => {
958
+ var __privateGet$5 = (obj, member, getter) => {
913
959
  __accessCheck$5(obj, member, "read from private field");
914
960
  return getter ? getter.call(obj) : member.get(obj);
915
961
  };
@@ -918,7 +964,7 @@ var __privateAdd$5 = (obj, member, value) => {
918
964
  throw TypeError("Cannot add the same private member more than once");
919
965
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
920
966
  };
921
- var __privateSet$3 = (obj, member, value, setter) => {
967
+ var __privateSet$4 = (obj, member, value, setter) => {
922
968
  __accessCheck$5(obj, member, "write to private field");
923
969
  setter ? setter.call(obj, value) : member.set(obj, value);
924
970
  return value;
@@ -931,21 +977,21 @@ const _Query = class {
931
977
  __privateAdd$5(this, _data, { filter: {} });
932
978
  this.meta = { page: { cursor: "start", more: true } };
933
979
  this.records = [];
934
- __privateSet$3(this, _table$1, table);
980
+ __privateSet$4(this, _table$1, table);
935
981
  if (repository) {
936
- __privateSet$3(this, _repository, repository);
982
+ __privateSet$4(this, _repository, repository);
937
983
  } else {
938
- __privateSet$3(this, _repository, this);
984
+ __privateSet$4(this, _repository, this);
939
985
  }
940
- __privateGet$4(this, _data).filter = data.filter ?? parent?.filter ?? {};
941
- __privateGet$4(this, _data).filter.$any = data.filter?.$any ?? parent?.filter?.$any;
942
- __privateGet$4(this, _data).filter.$all = data.filter?.$all ?? parent?.filter?.$all;
943
- __privateGet$4(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
944
- __privateGet$4(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
945
- __privateGet$4(this, _data).sort = data.sort ?? parent?.sort;
946
- __privateGet$4(this, _data).columns = data.columns ?? parent?.columns ?? ["*"];
947
- __privateGet$4(this, _data).page = data.page ?? parent?.page;
948
- __privateGet$4(this, _data).cache = data.cache ?? parent?.cache;
986
+ __privateGet$5(this, _data).filter = data.filter ?? parent?.filter ?? {};
987
+ __privateGet$5(this, _data).filter.$any = data.filter?.$any ?? parent?.filter?.$any;
988
+ __privateGet$5(this, _data).filter.$all = data.filter?.$all ?? parent?.filter?.$all;
989
+ __privateGet$5(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
990
+ __privateGet$5(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
991
+ __privateGet$5(this, _data).sort = data.sort ?? parent?.sort;
992
+ __privateGet$5(this, _data).columns = data.columns ?? parent?.columns ?? ["*"];
993
+ __privateGet$5(this, _data).page = data.page ?? parent?.page;
994
+ __privateGet$5(this, _data).cache = data.cache ?? parent?.cache;
949
995
  this.any = this.any.bind(this);
950
996
  this.all = this.all.bind(this);
951
997
  this.not = this.not.bind(this);
@@ -956,50 +1002,50 @@ const _Query = class {
956
1002
  Object.defineProperty(this, "repository", { enumerable: false });
957
1003
  }
958
1004
  getQueryOptions() {
959
- return __privateGet$4(this, _data);
1005
+ return __privateGet$5(this, _data);
960
1006
  }
961
1007
  key() {
962
- const { columns = [], filter = {}, sort = [], page = {} } = __privateGet$4(this, _data);
1008
+ const { columns = [], filter = {}, sort = [], page = {} } = __privateGet$5(this, _data);
963
1009
  const key = JSON.stringify({ columns, filter, sort, page });
964
1010
  return toBase64(key);
965
1011
  }
966
1012
  any(...queries) {
967
1013
  const $any = queries.map((query) => query.getQueryOptions().filter ?? {});
968
- return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $any } }, __privateGet$4(this, _data));
1014
+ return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $any } }, __privateGet$5(this, _data));
969
1015
  }
970
1016
  all(...queries) {
971
1017
  const $all = queries.map((query) => query.getQueryOptions().filter ?? {});
972
- return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
1018
+ return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
973
1019
  }
974
1020
  not(...queries) {
975
1021
  const $not = queries.map((query) => query.getQueryOptions().filter ?? {});
976
- return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $not } }, __privateGet$4(this, _data));
1022
+ return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $not } }, __privateGet$5(this, _data));
977
1023
  }
978
1024
  none(...queries) {
979
1025
  const $none = queries.map((query) => query.getQueryOptions().filter ?? {});
980
- return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $none } }, __privateGet$4(this, _data));
1026
+ return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $none } }, __privateGet$5(this, _data));
981
1027
  }
982
1028
  filter(a, b) {
983
1029
  if (arguments.length === 1) {
984
1030
  const constraints = Object.entries(a).map(([column, constraint]) => ({ [column]: constraint }));
985
- const $all = compact([__privateGet$4(this, _data).filter?.$all].flat().concat(constraints));
986
- return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
1031
+ const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
1032
+ return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
987
1033
  } else {
988
- const $all = compact([__privateGet$4(this, _data).filter?.$all].flat().concat([{ [a]: b }]));
989
- return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
1034
+ const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat([{ [a]: b }]));
1035
+ return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
990
1036
  }
991
1037
  }
992
1038
  sort(column, direction) {
993
- const originalSort = [__privateGet$4(this, _data).sort ?? []].flat();
1039
+ const originalSort = [__privateGet$5(this, _data).sort ?? []].flat();
994
1040
  const sort = [...originalSort, { column, direction }];
995
- return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { sort }, __privateGet$4(this, _data));
1041
+ return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { sort }, __privateGet$5(this, _data));
996
1042
  }
997
1043
  select(columns) {
998
- return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { columns }, __privateGet$4(this, _data));
1044
+ return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { columns }, __privateGet$5(this, _data));
999
1045
  }
1000
1046
  getPaginated(options = {}) {
1001
- const query = new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), options, __privateGet$4(this, _data));
1002
- return __privateGet$4(this, _repository).query(query);
1047
+ const query = new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), options, __privateGet$5(this, _data));
1048
+ return __privateGet$5(this, _repository).query(query);
1003
1049
  }
1004
1050
  async *[Symbol.asyncIterator]() {
1005
1051
  for await (const [record] of this.getIterator(1)) {
@@ -1032,7 +1078,7 @@ const _Query = class {
1032
1078
  return records[0] || null;
1033
1079
  }
1034
1080
  cache(ttl) {
1035
- return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { cache: ttl }, __privateGet$4(this, _data));
1081
+ return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
1036
1082
  }
1037
1083
  nextPage(size, offset) {
1038
1084
  return this.firstPage(size, offset);
@@ -1089,7 +1135,7 @@ var __accessCheck$4 = (obj, member, msg) => {
1089
1135
  if (!member.has(obj))
1090
1136
  throw TypeError("Cannot " + msg);
1091
1137
  };
1092
- var __privateGet$3 = (obj, member, getter) => {
1138
+ var __privateGet$4 = (obj, member, getter) => {
1093
1139
  __accessCheck$4(obj, member, "read from private field");
1094
1140
  return getter ? getter.call(obj) : member.get(obj);
1095
1141
  };
@@ -1098,7 +1144,7 @@ var __privateAdd$4 = (obj, member, value) => {
1098
1144
  throw TypeError("Cannot add the same private member more than once");
1099
1145
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1100
1146
  };
1101
- var __privateSet$2 = (obj, member, value, setter) => {
1147
+ var __privateSet$3 = (obj, member, value, setter) => {
1102
1148
  __accessCheck$4(obj, member, "write to private field");
1103
1149
  setter ? setter.call(obj, value) : member.set(obj, value);
1104
1150
  return value;
@@ -1107,7 +1153,7 @@ var __privateMethod$2 = (obj, member, method) => {
1107
1153
  __accessCheck$4(obj, member, "access private method");
1108
1154
  return method;
1109
1155
  };
1110
- var _table, _links, _getFetchProps, _cache, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn, _bulkInsertTableRecords, bulkInsertTableRecords_fn, _updateRecordWithID, updateRecordWithID_fn, _upsertRecordWithID, upsertRecordWithID_fn, _deleteRecord, deleteRecord_fn, _invalidateCache, invalidateCache_fn, _setCacheRecord, setCacheRecord_fn, _getCacheRecord, getCacheRecord_fn, _setCacheQuery, setCacheQuery_fn, _getCacheQuery, getCacheQuery_fn;
1156
+ var _table, _getFetchProps, _cache, _schemaColumns, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn, _bulkInsertTableRecords, bulkInsertTableRecords_fn, _updateRecordWithID, updateRecordWithID_fn, _upsertRecordWithID, upsertRecordWithID_fn, _deleteRecord, deleteRecord_fn, _invalidateCache, invalidateCache_fn, _setCacheRecord, setCacheRecord_fn, _getCacheRecord, getCacheRecord_fn, _setCacheQuery, setCacheQuery_fn, _getCacheQuery, getCacheQuery_fn, _getSchemaColumns, getSchemaColumns_fn;
1111
1157
  class Repository extends Query {
1112
1158
  }
1113
1159
  class RestRepository extends Query {
@@ -1124,15 +1170,15 @@ class RestRepository extends Query {
1124
1170
  __privateAdd$4(this, _getCacheRecord);
1125
1171
  __privateAdd$4(this, _setCacheQuery);
1126
1172
  __privateAdd$4(this, _getCacheQuery);
1173
+ __privateAdd$4(this, _getSchemaColumns);
1127
1174
  __privateAdd$4(this, _table, void 0);
1128
- __privateAdd$4(this, _links, void 0);
1129
1175
  __privateAdd$4(this, _getFetchProps, void 0);
1130
1176
  __privateAdd$4(this, _cache, void 0);
1131
- __privateSet$2(this, _table, options.table);
1132
- __privateSet$2(this, _links, options.links ?? {});
1133
- __privateSet$2(this, _getFetchProps, options.pluginOptions.getFetchProps);
1177
+ __privateAdd$4(this, _schemaColumns, void 0);
1178
+ __privateSet$3(this, _table, options.table);
1179
+ __privateSet$3(this, _getFetchProps, options.pluginOptions.getFetchProps);
1134
1180
  this.db = options.db;
1135
- __privateSet$2(this, _cache, options.pluginOptions.cache);
1181
+ __privateSet$3(this, _cache, options.pluginOptions.cache);
1136
1182
  }
1137
1183
  async create(a, b) {
1138
1184
  if (Array.isArray(a)) {
@@ -1165,13 +1211,14 @@ class RestRepository extends Query {
1165
1211
  const cacheRecord = await __privateMethod$2(this, _getCacheRecord, getCacheRecord_fn).call(this, recordId);
1166
1212
  if (cacheRecord)
1167
1213
  return cacheRecord;
1168
- const fetchProps = await __privateGet$3(this, _getFetchProps).call(this);
1214
+ const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1169
1215
  try {
1170
1216
  const response = await getRecord({
1171
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$3(this, _table), recordId },
1217
+ pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table), recordId },
1172
1218
  ...fetchProps
1173
1219
  });
1174
- return initObject(this.db, __privateGet$3(this, _links), __privateGet$3(this, _table), response);
1220
+ const columns = await __privateMethod$2(this, _getSchemaColumns, getSchemaColumns_fn).call(this);
1221
+ return initObject(this.db, columns, __privateGet$4(this, _table), response);
1175
1222
  } catch (e) {
1176
1223
  if (isObject(e) && e.status === 404) {
1177
1224
  return null;
@@ -1242,13 +1289,14 @@ class RestRepository extends Query {
1242
1289
  throw new Error("Invalid arguments for delete method");
1243
1290
  }
1244
1291
  async search(query, options = {}) {
1245
- const fetchProps = await __privateGet$3(this, _getFetchProps).call(this);
1292
+ const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1246
1293
  const { records } = await searchBranch({
1247
1294
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
1248
- body: { tables: [__privateGet$3(this, _table)], query, fuzziness: options.fuzziness },
1295
+ body: { tables: [__privateGet$4(this, _table)], query, fuzziness: options.fuzziness },
1249
1296
  ...fetchProps
1250
1297
  });
1251
- return records.map((item) => initObject(this.db, __privateGet$3(this, _links), __privateGet$3(this, _table), item));
1298
+ const columns = await __privateMethod$2(this, _getSchemaColumns, getSchemaColumns_fn).call(this);
1299
+ return records.map((item) => initObject(this.db, columns, __privateGet$4(this, _table), item));
1252
1300
  }
1253
1301
  async query(query) {
1254
1302
  const cacheQuery = await __privateMethod$2(this, _getCacheQuery, getCacheQuery_fn).call(this, query);
@@ -1261,30 +1309,31 @@ class RestRepository extends Query {
1261
1309
  page: data.page,
1262
1310
  columns: data.columns
1263
1311
  };
1264
- const fetchProps = await __privateGet$3(this, _getFetchProps).call(this);
1312
+ const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1265
1313
  const { meta, records: objects } = await queryTable({
1266
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$3(this, _table) },
1314
+ pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table) },
1267
1315
  body,
1268
1316
  ...fetchProps
1269
1317
  });
1270
- const records = objects.map((record) => initObject(this.db, __privateGet$3(this, _links), __privateGet$3(this, _table), record));
1318
+ const columns = await __privateMethod$2(this, _getSchemaColumns, getSchemaColumns_fn).call(this);
1319
+ const records = objects.map((record) => initObject(this.db, columns, __privateGet$4(this, _table), record));
1271
1320
  await __privateMethod$2(this, _setCacheQuery, setCacheQuery_fn).call(this, query, meta, records);
1272
1321
  return new Page(query, meta, records);
1273
1322
  }
1274
1323
  }
1275
1324
  _table = new WeakMap();
1276
- _links = new WeakMap();
1277
1325
  _getFetchProps = new WeakMap();
1278
1326
  _cache = new WeakMap();
1327
+ _schemaColumns = new WeakMap();
1279
1328
  _insertRecordWithoutId = new WeakSet();
1280
1329
  insertRecordWithoutId_fn = async function(object) {
1281
- const fetchProps = await __privateGet$3(this, _getFetchProps).call(this);
1330
+ const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1282
1331
  const record = transformObjectLinks(object);
1283
1332
  const response = await insertRecord({
1284
1333
  pathParams: {
1285
1334
  workspace: "{workspaceId}",
1286
1335
  dbBranchName: "{dbBranch}",
1287
- tableName: __privateGet$3(this, _table)
1336
+ tableName: __privateGet$4(this, _table)
1288
1337
  },
1289
1338
  body: record,
1290
1339
  ...fetchProps
@@ -1297,13 +1346,13 @@ insertRecordWithoutId_fn = async function(object) {
1297
1346
  };
1298
1347
  _insertRecordWithId = new WeakSet();
1299
1348
  insertRecordWithId_fn = async function(recordId, object) {
1300
- const fetchProps = await __privateGet$3(this, _getFetchProps).call(this);
1349
+ const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1301
1350
  const record = transformObjectLinks(object);
1302
1351
  const response = await insertRecordWithID({
1303
1352
  pathParams: {
1304
1353
  workspace: "{workspaceId}",
1305
1354
  dbBranchName: "{dbBranch}",
1306
- tableName: __privateGet$3(this, _table),
1355
+ tableName: __privateGet$4(this, _table),
1307
1356
  recordId
1308
1357
  },
1309
1358
  body: record,
@@ -1318,10 +1367,10 @@ insertRecordWithId_fn = async function(recordId, object) {
1318
1367
  };
1319
1368
  _bulkInsertTableRecords = new WeakSet();
1320
1369
  bulkInsertTableRecords_fn = async function(objects) {
1321
- const fetchProps = await __privateGet$3(this, _getFetchProps).call(this);
1370
+ const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1322
1371
  const records = objects.map((object) => transformObjectLinks(object));
1323
1372
  const response = await bulkInsertTableRecords({
1324
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$3(this, _table) },
1373
+ pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table) },
1325
1374
  body: { records },
1326
1375
  ...fetchProps
1327
1376
  });
@@ -1333,10 +1382,10 @@ bulkInsertTableRecords_fn = async function(objects) {
1333
1382
  };
1334
1383
  _updateRecordWithID = new WeakSet();
1335
1384
  updateRecordWithID_fn = async function(recordId, object) {
1336
- const fetchProps = await __privateGet$3(this, _getFetchProps).call(this);
1385
+ const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1337
1386
  const record = transformObjectLinks(object);
1338
1387
  const response = await updateRecordWithID({
1339
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$3(this, _table), recordId },
1388
+ pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table), recordId },
1340
1389
  body: record,
1341
1390
  ...fetchProps
1342
1391
  });
@@ -1347,9 +1396,9 @@ updateRecordWithID_fn = async function(recordId, object) {
1347
1396
  };
1348
1397
  _upsertRecordWithID = new WeakSet();
1349
1398
  upsertRecordWithID_fn = async function(recordId, object) {
1350
- const fetchProps = await __privateGet$3(this, _getFetchProps).call(this);
1399
+ const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1351
1400
  const response = await upsertRecordWithID({
1352
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$3(this, _table), recordId },
1401
+ pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table), recordId },
1353
1402
  body: object,
1354
1403
  ...fetchProps
1355
1404
  });
@@ -1360,51 +1409,62 @@ upsertRecordWithID_fn = async function(recordId, object) {
1360
1409
  };
1361
1410
  _deleteRecord = new WeakSet();
1362
1411
  deleteRecord_fn = async function(recordId) {
1363
- const fetchProps = await __privateGet$3(this, _getFetchProps).call(this);
1412
+ const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1364
1413
  await deleteRecord({
1365
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$3(this, _table), recordId },
1414
+ pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table), recordId },
1366
1415
  ...fetchProps
1367
1416
  });
1368
1417
  };
1369
1418
  _invalidateCache = new WeakSet();
1370
1419
  invalidateCache_fn = async function(recordId) {
1371
- await __privateGet$3(this, _cache).delete(`rec_${__privateGet$3(this, _table)}:${recordId}`);
1372
- const cacheItems = await __privateGet$3(this, _cache).getAll();
1420
+ await __privateGet$4(this, _cache).delete(`rec_${__privateGet$4(this, _table)}:${recordId}`);
1421
+ const cacheItems = await __privateGet$4(this, _cache).getAll();
1373
1422
  const queries = Object.entries(cacheItems).filter(([key]) => key.startsWith("query_"));
1374
1423
  for (const [key, value] of queries) {
1375
1424
  const ids = getIds(value);
1376
1425
  if (ids.includes(recordId))
1377
- await __privateGet$3(this, _cache).delete(key);
1426
+ await __privateGet$4(this, _cache).delete(key);
1378
1427
  }
1379
1428
  };
1380
1429
  _setCacheRecord = new WeakSet();
1381
1430
  setCacheRecord_fn = async function(record) {
1382
- if (!__privateGet$3(this, _cache).cacheRecords)
1431
+ if (!__privateGet$4(this, _cache).cacheRecords)
1383
1432
  return;
1384
- await __privateGet$3(this, _cache).set(`rec_${__privateGet$3(this, _table)}:${record.id}`, record);
1433
+ await __privateGet$4(this, _cache).set(`rec_${__privateGet$4(this, _table)}:${record.id}`, record);
1385
1434
  };
1386
1435
  _getCacheRecord = new WeakSet();
1387
1436
  getCacheRecord_fn = async function(recordId) {
1388
- if (!__privateGet$3(this, _cache).cacheRecords)
1437
+ if (!__privateGet$4(this, _cache).cacheRecords)
1389
1438
  return null;
1390
- return __privateGet$3(this, _cache).get(`rec_${__privateGet$3(this, _table)}:${recordId}`);
1439
+ return __privateGet$4(this, _cache).get(`rec_${__privateGet$4(this, _table)}:${recordId}`);
1391
1440
  };
1392
1441
  _setCacheQuery = new WeakSet();
1393
1442
  setCacheQuery_fn = async function(query, meta, records) {
1394
- await __privateGet$3(this, _cache).set(`query_${__privateGet$3(this, _table)}:${query.key()}`, { date: new Date(), meta, records });
1443
+ await __privateGet$4(this, _cache).set(`query_${__privateGet$4(this, _table)}:${query.key()}`, { date: new Date(), meta, records });
1395
1444
  };
1396
1445
  _getCacheQuery = new WeakSet();
1397
1446
  getCacheQuery_fn = async function(query) {
1398
- const key = `query_${__privateGet$3(this, _table)}:${query.key()}`;
1399
- const result = await __privateGet$3(this, _cache).get(key);
1447
+ const key = `query_${__privateGet$4(this, _table)}:${query.key()}`;
1448
+ const result = await __privateGet$4(this, _cache).get(key);
1400
1449
  if (!result)
1401
1450
  return null;
1402
- const { cache: ttl = __privateGet$3(this, _cache).defaultQueryTTL } = query.getQueryOptions();
1451
+ const { cache: ttl = __privateGet$4(this, _cache).defaultQueryTTL } = query.getQueryOptions();
1403
1452
  if (!ttl || ttl < 0)
1404
1453
  return result;
1405
1454
  const hasExpired = result.date.getTime() + ttl < Date.now();
1406
1455
  return hasExpired ? null : result;
1407
1456
  };
1457
+ _getSchemaColumns = new WeakSet();
1458
+ getSchemaColumns_fn = async function() {
1459
+ if (__privateGet$4(this, _schemaColumns))
1460
+ return __privateGet$4(this, _schemaColumns);
1461
+ const { columns } = await getTableSchema({
1462
+ pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table) },
1463
+ ...await __privateGet$4(this, _getFetchProps).call(this)
1464
+ });
1465
+ __privateSet$3(this, _schemaColumns, columns);
1466
+ return columns;
1467
+ };
1408
1468
  const transformObjectLinks = (object) => {
1409
1469
  return Object.entries(object).reduce((acc, [key, value]) => {
1410
1470
  if (key === "xata")
@@ -1412,15 +1472,30 @@ const transformObjectLinks = (object) => {
1412
1472
  return { ...acc, [key]: isIdentifiable(value) ? value.id : value };
1413
1473
  }, {});
1414
1474
  };
1415
- const initObject = (db, links, table, object) => {
1475
+ const initObject = (db, columns, table, object) => {
1416
1476
  const result = {};
1417
1477
  Object.assign(result, object);
1418
- const tableLinks = links[table] || [];
1419
- for (const link of tableLinks) {
1420
- const [field, linkTable] = link;
1421
- const value = result[field];
1422
- if (value && isObject(value)) {
1423
- result[field] = initObject(db, links, linkTable, value);
1478
+ for (const column of columns) {
1479
+ const value = result[column.name];
1480
+ switch (column.type) {
1481
+ case "datetime": {
1482
+ const date = new Date(value);
1483
+ if (isNaN(date.getTime())) {
1484
+ console.error(`Failed to parse date ${value} for field ${column.name}`);
1485
+ } else {
1486
+ result[column.name] = date;
1487
+ }
1488
+ break;
1489
+ }
1490
+ case "link": {
1491
+ const linkTable = column.link?.table;
1492
+ if (!linkTable) {
1493
+ console.error(`Failed to parse link for field ${column.name}`);
1494
+ } else if (value && isObject(value)) {
1495
+ result[column.name] = initObject(db, columns, linkTable, value);
1496
+ }
1497
+ break;
1498
+ }
1424
1499
  }
1425
1500
  }
1426
1501
  result.read = function() {
@@ -1452,7 +1527,7 @@ var __accessCheck$3 = (obj, member, msg) => {
1452
1527
  if (!member.has(obj))
1453
1528
  throw TypeError("Cannot " + msg);
1454
1529
  };
1455
- var __privateGet$2 = (obj, member, getter) => {
1530
+ var __privateGet$3 = (obj, member, getter) => {
1456
1531
  __accessCheck$3(obj, member, "read from private field");
1457
1532
  return getter ? getter.call(obj) : member.get(obj);
1458
1533
  };
@@ -1461,7 +1536,7 @@ var __privateAdd$3 = (obj, member, value) => {
1461
1536
  throw TypeError("Cannot add the same private member more than once");
1462
1537
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1463
1538
  };
1464
- var __privateSet$1 = (obj, member, value, setter) => {
1539
+ var __privateSet$2 = (obj, member, value, setter) => {
1465
1540
  __accessCheck$3(obj, member, "write to private field");
1466
1541
  setter ? setter.call(obj, value) : member.set(obj, value);
1467
1542
  return value;
@@ -1470,30 +1545,30 @@ var _map;
1470
1545
  class SimpleCache {
1471
1546
  constructor(options = {}) {
1472
1547
  __privateAdd$3(this, _map, void 0);
1473
- __privateSet$1(this, _map, /* @__PURE__ */ new Map());
1548
+ __privateSet$2(this, _map, /* @__PURE__ */ new Map());
1474
1549
  this.capacity = options.max ?? 500;
1475
1550
  this.cacheRecords = options.cacheRecords ?? true;
1476
1551
  this.defaultQueryTTL = options.defaultQueryTTL ?? 60 * 1e3;
1477
1552
  }
1478
1553
  async getAll() {
1479
- return Object.fromEntries(__privateGet$2(this, _map));
1554
+ return Object.fromEntries(__privateGet$3(this, _map));
1480
1555
  }
1481
1556
  async get(key) {
1482
- return __privateGet$2(this, _map).get(key) ?? null;
1557
+ return __privateGet$3(this, _map).get(key) ?? null;
1483
1558
  }
1484
1559
  async set(key, value) {
1485
1560
  await this.delete(key);
1486
- __privateGet$2(this, _map).set(key, value);
1487
- if (__privateGet$2(this, _map).size > this.capacity) {
1488
- const leastRecentlyUsed = __privateGet$2(this, _map).keys().next().value;
1561
+ __privateGet$3(this, _map).set(key, value);
1562
+ if (__privateGet$3(this, _map).size > this.capacity) {
1563
+ const leastRecentlyUsed = __privateGet$3(this, _map).keys().next().value;
1489
1564
  await this.delete(leastRecentlyUsed);
1490
1565
  }
1491
1566
  }
1492
1567
  async delete(key) {
1493
- __privateGet$2(this, _map).delete(key);
1568
+ __privateGet$3(this, _map).delete(key);
1494
1569
  }
1495
1570
  async clear() {
1496
- return __privateGet$2(this, _map).clear();
1571
+ return __privateGet$3(this, _map).clear();
1497
1572
  }
1498
1573
  }
1499
1574
  _map = new WeakMap();
@@ -1521,7 +1596,7 @@ var __accessCheck$2 = (obj, member, msg) => {
1521
1596
  if (!member.has(obj))
1522
1597
  throw TypeError("Cannot " + msg);
1523
1598
  };
1524
- var __privateGet$1 = (obj, member, getter) => {
1599
+ var __privateGet$2 = (obj, member, getter) => {
1525
1600
  __accessCheck$2(obj, member, "read from private field");
1526
1601
  return getter ? getter.call(obj) : member.get(obj);
1527
1602
  };
@@ -1532,26 +1607,24 @@ var __privateAdd$2 = (obj, member, value) => {
1532
1607
  };
1533
1608
  var _tables;
1534
1609
  class SchemaPlugin extends XataPlugin {
1535
- constructor(links, tableNames) {
1610
+ constructor(tableNames) {
1536
1611
  super();
1537
- this.links = links;
1538
1612
  this.tableNames = tableNames;
1539
1613
  __privateAdd$2(this, _tables, {});
1540
1614
  }
1541
1615
  build(pluginOptions) {
1542
- const links = this.links;
1543
1616
  const db = new Proxy({}, {
1544
1617
  get: (_target, table) => {
1545
1618
  if (!isString(table))
1546
1619
  throw new Error("Invalid table name");
1547
- if (!__privateGet$1(this, _tables)[table]) {
1548
- __privateGet$1(this, _tables)[table] = new RestRepository({ db, pluginOptions, table, links });
1620
+ if (!__privateGet$2(this, _tables)[table]) {
1621
+ __privateGet$2(this, _tables)[table] = new RestRepository({ db, pluginOptions, table });
1549
1622
  }
1550
- return __privateGet$1(this, _tables)[table];
1623
+ return __privateGet$2(this, _tables)[table];
1551
1624
  }
1552
1625
  });
1553
1626
  for (const table of this.tableNames ?? []) {
1554
- db[table] = new RestRepository({ db, pluginOptions, table, links });
1627
+ db[table] = new RestRepository({ db, pluginOptions, table });
1555
1628
  }
1556
1629
  return db;
1557
1630
  }
@@ -1562,44 +1635,65 @@ var __accessCheck$1 = (obj, member, msg) => {
1562
1635
  if (!member.has(obj))
1563
1636
  throw TypeError("Cannot " + msg);
1564
1637
  };
1638
+ var __privateGet$1 = (obj, member, getter) => {
1639
+ __accessCheck$1(obj, member, "read from private field");
1640
+ return getter ? getter.call(obj) : member.get(obj);
1641
+ };
1565
1642
  var __privateAdd$1 = (obj, member, value) => {
1566
1643
  if (member.has(obj))
1567
1644
  throw TypeError("Cannot add the same private member more than once");
1568
1645
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1569
1646
  };
1647
+ var __privateSet$1 = (obj, member, value, setter) => {
1648
+ __accessCheck$1(obj, member, "write to private field");
1649
+ setter ? setter.call(obj, value) : member.set(obj, value);
1650
+ return value;
1651
+ };
1570
1652
  var __privateMethod$1 = (obj, member, method) => {
1571
1653
  __accessCheck$1(obj, member, "access private method");
1572
1654
  return method;
1573
1655
  };
1574
- var _search, search_fn;
1656
+ var _schema, _search, search_fn, _getSchema, getSchema_fn;
1575
1657
  class SearchPlugin extends XataPlugin {
1576
- constructor(db, links) {
1658
+ constructor(db) {
1577
1659
  super();
1578
1660
  this.db = db;
1579
- this.links = links;
1580
1661
  __privateAdd$1(this, _search);
1662
+ __privateAdd$1(this, _getSchema);
1663
+ __privateAdd$1(this, _schema, void 0);
1581
1664
  }
1582
1665
  build({ getFetchProps }) {
1583
1666
  return {
1584
1667
  all: async (query, options = {}) => {
1585
1668
  const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options, getFetchProps);
1669
+ const schema = await __privateMethod$1(this, _getSchema, getSchema_fn).call(this, getFetchProps);
1586
1670
  return records.map((record) => {
1587
1671
  const { table = "orphan" } = record.xata;
1588
- return { table, record: initObject(this.db, this.links, table, record) };
1672
+ const columns = schema.tables.find((t) => t.name === table)?.columns;
1673
+ if (!columns) {
1674
+ console.error(`No schema columns found for table ${table}`);
1675
+ }
1676
+ return { table, record: initObject(this.db, columns ?? [], table, record) };
1589
1677
  });
1590
1678
  },
1591
1679
  byTable: async (query, options = {}) => {
1592
1680
  const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options, getFetchProps);
1681
+ const schema = await __privateMethod$1(this, _getSchema, getSchema_fn).call(this, getFetchProps);
1593
1682
  return records.reduce((acc, record) => {
1594
1683
  const { table = "orphan" } = record.xata;
1684
+ const columns = schema.tables.find((t) => t.name === table)?.columns;
1685
+ if (!columns) {
1686
+ console.error(`No schema columns found for table ${table}`);
1687
+ }
1595
1688
  const items = acc[table] ?? [];
1596
- const item = initObject(this.db, this.links, table, record);
1689
+ const item = initObject(this.db, columns ?? [], table, record);
1597
1690
  return { ...acc, [table]: [...items, item] };
1598
1691
  }, {});
1599
1692
  }
1600
1693
  };
1601
1694
  }
1602
1695
  }
1696
+ _schema = new WeakMap();
1603
1697
  _search = new WeakSet();
1604
1698
  search_fn = async function(query, options, getFetchProps) {
1605
1699
  const fetchProps = await getFetchProps();
@@ -1611,6 +1705,18 @@ search_fn = async function(query, options, getFetchProps) {
1611
1705
  });
1612
1706
  return records;
1613
1707
  };
1708
+ _getSchema = new WeakSet();
1709
+ getSchema_fn = async function(getFetchProps) {
1710
+ if (__privateGet$1(this, _schema))
1711
+ return __privateGet$1(this, _schema);
1712
+ const fetchProps = await getFetchProps();
1713
+ const { schema } = await getBranchDetails({
1714
+ pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
1715
+ ...fetchProps
1716
+ });
1717
+ __privateSet$1(this, _schema, schema);
1718
+ return schema;
1719
+ };
1614
1720
 
1615
1721
  const isBranchStrategyBuilder = (strategy) => {
1616
1722
  return typeof strategy === "function";
@@ -1719,7 +1825,7 @@ var __privateMethod = (obj, member, method) => {
1719
1825
  const buildClient = (plugins) => {
1720
1826
  var _branch, _parseOptions, parseOptions_fn, _getFetchProps, getFetchProps_fn, _evaluateBranch, evaluateBranch_fn, _a;
1721
1827
  return _a = class {
1722
- constructor(options = {}, links, tables) {
1828
+ constructor(options = {}, tables) {
1723
1829
  __privateAdd(this, _parseOptions);
1724
1830
  __privateAdd(this, _getFetchProps);
1725
1831
  __privateAdd(this, _evaluateBranch);
@@ -1729,8 +1835,8 @@ const buildClient = (plugins) => {
1729
1835
  getFetchProps: () => __privateMethod(this, _getFetchProps, getFetchProps_fn).call(this, safeOptions),
1730
1836
  cache: safeOptions.cache
1731
1837
  };
1732
- const db = new SchemaPlugin(links, tables).build(pluginOptions);
1733
- const search = new SearchPlugin(db, links ?? {}).build(pluginOptions);
1838
+ const db = new SchemaPlugin(tables).build(pluginOptions);
1839
+ const search = new SearchPlugin(db).build(pluginOptions);
1734
1840
  this.db = db;
1735
1841
  this.search = search;
1736
1842
  for (const [key, namespace] of Object.entries(plugins ?? {})) {
@@ -1803,5 +1909,5 @@ class XataError extends Error {
1803
1909
  }
1804
1910
  }
1805
1911
 
1806
- export { BaseClient, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, Repository, RestRepository, SchemaPlugin, SearchPlugin, SimpleCache, XataApiClient, XataApiPlugin, XataError, XataPlugin, acceptWorkspaceMemberInvite, addTableColumn, buildClient, bulkInsertTableRecords, cancelWorkspaceMemberInvite, contains, createBranch, createDatabase, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, endsWith, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseURL, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isIdentifiable, isNot, isXataRecord, le, lt, lte, notExists, operationsByTag, pattern, queryTable, removeWorkspaceMember, resendWorkspaceMemberInvite, searchBranch, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberRole, upsertRecordWithID };
1912
+ export { BaseClient, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, Repository, RestRepository, SchemaPlugin, SearchPlugin, SimpleCache, XataApiClient, XataApiPlugin, XataError, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, buildClient, bulkInsertTableRecords, cancelWorkspaceMemberInvite, contains, createBranch, createDatabase, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, endsWith, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseURL, getGitBranchesMapping, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isIdentifiable, isNot, isXataRecord, le, lt, lte, notExists, operationsByTag, pattern, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberRole, upsertRecordWithID };
1807
1913
  //# sourceMappingURL=index.mjs.map