@xata.io/client 0.0.0-alpha.vf3081bb → 0.0.0-alpha.vf38b6da

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
@@ -2,6 +2,24 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ function _interopNamespace(e) {
6
+ if (e && e.__esModule) return e;
7
+ var n = Object.create(null);
8
+ if (e) {
9
+ Object.keys(e).forEach(function (k) {
10
+ if (k !== 'default') {
11
+ var d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: function () { return e[k]; }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n["default"] = e;
20
+ return Object.freeze(n);
21
+ }
22
+
5
23
  function notEmpty(value) {
6
24
  return value !== null && value !== void 0;
7
25
  }
@@ -17,43 +35,95 @@ function isDefined(value) {
17
35
  function isString(value) {
18
36
  return isDefined(value) && typeof value === "string";
19
37
  }
38
+ function isStringArray(value) {
39
+ return isDefined(value) && Array.isArray(value) && value.every(isString);
40
+ }
20
41
  function toBase64(value) {
21
42
  try {
22
43
  return btoa(value);
23
44
  } catch (err) {
24
- return Buffer.from(value).toString("base64");
45
+ const buf = Buffer;
46
+ return buf.from(value).toString("base64");
25
47
  }
26
48
  }
27
49
 
28
- function getEnvVariable(name) {
50
+ function getEnvironment() {
29
51
  try {
30
- if (isObject(process) && isString(process?.env?.[name])) {
31
- return process.env[name];
52
+ if (isObject(process) && isObject(process.env)) {
53
+ return {
54
+ apiKey: process.env.XATA_API_KEY ?? getGlobalApiKey(),
55
+ databaseURL: process.env.XATA_DATABASE_URL ?? getGlobalDatabaseURL(),
56
+ branch: process.env.XATA_BRANCH ?? getGlobalBranch(),
57
+ envBranch: process.env.VERCEL_GIT_COMMIT_REF ?? process.env.CF_PAGES_BRANCH ?? process.env.BRANCH,
58
+ fallbackBranch: process.env.XATA_FALLBACK_BRANCH ?? getGlobalFallbackBranch()
59
+ };
32
60
  }
33
61
  } catch (err) {
34
62
  }
35
63
  try {
36
- if (isObject(Deno) && isString(Deno?.env?.get(name))) {
37
- return Deno.env.get(name);
64
+ if (isObject(Deno) && isObject(Deno.env)) {
65
+ return {
66
+ apiKey: Deno.env.get("XATA_API_KEY") ?? getGlobalApiKey(),
67
+ databaseURL: Deno.env.get("XATA_DATABASE_URL") ?? getGlobalDatabaseURL(),
68
+ branch: Deno.env.get("XATA_BRANCH") ?? getGlobalBranch(),
69
+ envBranch: Deno.env.get("VERCEL_GIT_COMMIT_REF") ?? Deno.env.get("CF_PAGES_BRANCH") ?? Deno.env.get("BRANCH"),
70
+ fallbackBranch: Deno.env.get("XATA_FALLBACK_BRANCH") ?? getGlobalFallbackBranch()
71
+ };
38
72
  }
39
73
  } catch (err) {
40
74
  }
75
+ return {
76
+ apiKey: getGlobalApiKey(),
77
+ databaseURL: getGlobalDatabaseURL(),
78
+ branch: getGlobalBranch(),
79
+ envBranch: void 0,
80
+ fallbackBranch: getGlobalFallbackBranch()
81
+ };
82
+ }
83
+ function getGlobalApiKey() {
84
+ try {
85
+ return XATA_API_KEY;
86
+ } catch (err) {
87
+ return void 0;
88
+ }
89
+ }
90
+ function getGlobalDatabaseURL() {
91
+ try {
92
+ return XATA_DATABASE_URL;
93
+ } catch (err) {
94
+ return void 0;
95
+ }
96
+ }
97
+ function getGlobalBranch() {
98
+ try {
99
+ return XATA_BRANCH;
100
+ } catch (err) {
101
+ return void 0;
102
+ }
103
+ }
104
+ function getGlobalFallbackBranch() {
105
+ try {
106
+ return XATA_FALLBACK_BRANCH;
107
+ } catch (err) {
108
+ return void 0;
109
+ }
41
110
  }
42
111
  async function getGitBranch() {
112
+ const cmd = ["git", "branch", "--show-current"];
113
+ const fullCmd = cmd.join(" ");
114
+ const nodeModule = ["child", "process"].join("_");
115
+ const execOptions = { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] };
43
116
  try {
44
117
  if (typeof require === "function") {
45
- const req = require;
46
- return req("child_process").execSync("git branch --show-current", { encoding: "utf-8" }).trim();
118
+ return require(nodeModule).execSync(fullCmd, execOptions).trim();
47
119
  }
120
+ const { execSync } = await (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(nodeModule);
121
+ return execSync(fullCmd, execOptions).toString().trim();
48
122
  } catch (err) {
49
123
  }
50
124
  try {
51
125
  if (isObject(Deno)) {
52
- const process2 = Deno.run({
53
- cmd: ["git", "branch", "--show-current"],
54
- stdout: "piped",
55
- stderr: "piped"
56
- });
126
+ const process2 = Deno.run({ cmd, stdout: "piped", stderr: "null" });
57
127
  return new TextDecoder().decode(await process2.output()).trim();
58
128
  }
59
129
  } catch (err) {
@@ -62,7 +132,8 @@ async function getGitBranch() {
62
132
 
63
133
  function getAPIKey() {
64
134
  try {
65
- return getEnvVariable("XATA_API_KEY") ?? XATA_API_KEY;
135
+ const { apiKey } = getEnvironment();
136
+ return apiKey;
66
137
  } catch (err) {
67
138
  return void 0;
68
139
  }
@@ -72,26 +143,35 @@ function getFetchImplementation(userFetch) {
72
143
  const globalFetch = typeof fetch !== "undefined" ? fetch : void 0;
73
144
  const fetchImpl = userFetch ?? globalFetch;
74
145
  if (!fetchImpl) {
75
- throw new Error(`The \`fetch\` option passed to the Xata client is resolving to a falsy value and may not be correctly imported.`);
146
+ throw new Error(
147
+ `The \`fetch\` option passed to the Xata client is resolving to a falsy value and may not be correctly imported.`
148
+ );
76
149
  }
77
150
  return fetchImpl;
78
151
  }
79
152
 
153
+ const VERSION = "0.0.0-alpha.vf38b6da";
154
+
80
155
  class ErrorWithCause extends Error {
81
156
  constructor(message, options) {
82
157
  super(message, options);
83
158
  }
84
159
  }
85
160
  class FetcherError extends ErrorWithCause {
86
- constructor(status, data) {
161
+ constructor(status, data, requestId) {
87
162
  super(getMessage(data));
88
163
  this.status = status;
89
164
  this.errors = isBulkError(data) ? data.errors : void 0;
165
+ this.requestId = requestId;
90
166
  if (data instanceof Error) {
91
167
  this.stack = data.stack;
92
168
  this.cause = data.cause;
93
169
  }
94
170
  }
171
+ toString() {
172
+ const error = super.toString();
173
+ return `[${this.status}] (${this.requestId ?? "Unknown"}): ${error}`;
174
+ }
95
175
  }
96
176
  function isBulkError(error) {
97
177
  return isObject(error) && Array.isArray(error.errors);
@@ -114,7 +194,12 @@ function getMessage(data) {
114
194
  }
115
195
 
116
196
  const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
117
- const query = new URLSearchParams(queryParams).toString();
197
+ const cleanQueryParams = Object.entries(queryParams).reduce((acc, [key, value]) => {
198
+ if (value === void 0 || value === null)
199
+ return acc;
200
+ return { ...acc, [key]: value };
201
+ }, {});
202
+ const query = new URLSearchParams(cleanQueryParams).toString();
118
203
  const queryString = query.length > 0 ? `?${query}` : "";
119
204
  return url.replace(/\{\w*\}/g, (key) => pathParams[key.slice(1, -1)]) + queryString;
120
205
  };
@@ -154,6 +239,7 @@ async function fetch$1({
154
239
  body: body ? JSON.stringify(body) : void 0,
155
240
  headers: {
156
241
  "Content-Type": "application/json",
242
+ "User-Agent": `Xata client-ts/${VERSION}`,
157
243
  ...headers,
158
244
  ...hostHeader(fullUrl),
159
245
  Authorization: `Bearer ${apiKey}`
@@ -162,14 +248,15 @@ async function fetch$1({
162
248
  if (response.status === 204) {
163
249
  return {};
164
250
  }
251
+ const requestId = response.headers?.get("x-request-id") ?? void 0;
165
252
  try {
166
253
  const jsonResponse = await response.json();
167
254
  if (response.ok) {
168
255
  return jsonResponse;
169
256
  }
170
- throw new FetcherError(response.status, jsonResponse);
257
+ throw new FetcherError(response.status, jsonResponse, requestId);
171
258
  } catch (error) {
172
- throw new FetcherError(response.status, error);
259
+ throw new FetcherError(response.status, error, requestId);
173
260
  }
174
261
  }
175
262
 
@@ -228,6 +315,7 @@ const removeWorkspaceMember = (variables) => fetch$1({
228
315
  ...variables
229
316
  });
230
317
  const inviteWorkspaceMember = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables });
318
+ const updateWorkspaceMemberInvite = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables });
231
319
  const cancelWorkspaceMemberInvite = (variables) => fetch$1({
232
320
  url: "/workspaces/{workspaceId}/invites/{inviteId}",
233
321
  method: "delete",
@@ -263,6 +351,11 @@ const deleteDatabase = (variables) => fetch$1({
263
351
  method: "delete",
264
352
  ...variables
265
353
  });
354
+ const getDatabaseMetadata = (variables) => fetch$1({
355
+ url: "/dbs/{dbName}/metadata",
356
+ method: "get",
357
+ ...variables
358
+ });
266
359
  const getGitBranchesMapping = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables });
267
360
  const addGitBranchesEntry = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables });
268
361
  const removeGitBranchesEntry = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables });
@@ -276,11 +369,7 @@ const getBranchDetails = (variables) => fetch$1({
276
369
  method: "get",
277
370
  ...variables
278
371
  });
279
- const createBranch = (variables) => fetch$1({
280
- url: "/db/{dbBranchName}",
281
- method: "put",
282
- ...variables
283
- });
372
+ const createBranch = (variables) => fetch$1({ url: "/db/{dbBranchName}", method: "put", ...variables });
284
373
  const deleteBranch = (variables) => fetch$1({
285
374
  url: "/db/{dbBranchName}",
286
375
  method: "delete",
@@ -354,11 +443,7 @@ const updateColumn = (variables) => fetch$1({
354
443
  method: "patch",
355
444
  ...variables
356
445
  });
357
- const insertRecord = (variables) => fetch$1({
358
- url: "/db/{dbBranchName}/tables/{tableName}/data",
359
- method: "post",
360
- ...variables
361
- });
446
+ const insertRecord = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables });
362
447
  const insertRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables });
363
448
  const updateRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables });
364
449
  const upsertRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables });
@@ -400,6 +485,7 @@ const operationsByTag = {
400
485
  updateWorkspaceMemberRole,
401
486
  removeWorkspaceMember,
402
487
  inviteWorkspaceMember,
488
+ updateWorkspaceMemberInvite,
403
489
  cancelWorkspaceMemberInvite,
404
490
  resendWorkspaceMemberInvite,
405
491
  acceptWorkspaceMemberInvite
@@ -408,6 +494,7 @@ const operationsByTag = {
408
494
  getDatabaseList,
409
495
  createDatabase,
410
496
  deleteDatabase,
497
+ getDatabaseMetadata,
411
498
  getGitBranchesMapping,
412
499
  addGitBranchesEntry,
413
500
  removeGitBranchesEntry,
@@ -489,7 +576,7 @@ var __privateAdd$7 = (obj, member, value) => {
489
576
  throw TypeError("Cannot add the same private member more than once");
490
577
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
491
578
  };
492
- var __privateSet$6 = (obj, member, value, setter) => {
579
+ var __privateSet$7 = (obj, member, value, setter) => {
493
580
  __accessCheck$7(obj, member, "write to private field");
494
581
  setter ? setter.call(obj, value) : member.set(obj, value);
495
582
  return value;
@@ -504,7 +591,7 @@ class XataApiClient {
504
591
  if (!apiKey) {
505
592
  throw new Error("Could not resolve a valid apiKey");
506
593
  }
507
- __privateSet$6(this, _extraProps, {
594
+ __privateSet$7(this, _extraProps, {
508
595
  apiUrl: getHostUrl(provider, "main"),
509
596
  workspacesApiUrl: getHostUrl(provider, "workspaces"),
510
597
  fetchImpl: getFetchImplementation(options.fetch),
@@ -631,6 +718,13 @@ class WorkspaceApi {
631
718
  ...this.extraProps
632
719
  });
633
720
  }
721
+ updateWorkspaceMemberInvite(workspaceId, inviteId, role) {
722
+ return operationsByTag.workspaces.updateWorkspaceMemberInvite({
723
+ pathParams: { workspaceId, inviteId },
724
+ body: { role },
725
+ ...this.extraProps
726
+ });
727
+ }
634
728
  cancelWorkspaceMemberInvite(workspaceId, inviteId) {
635
729
  return operationsByTag.workspaces.cancelWorkspaceMemberInvite({
636
730
  pathParams: { workspaceId, inviteId },
@@ -673,6 +767,12 @@ class DatabaseApi {
673
767
  ...this.extraProps
674
768
  });
675
769
  }
770
+ getDatabaseMetadata(workspace, dbName) {
771
+ return operationsByTag.database.getDatabaseMetadata({
772
+ pathParams: { workspace, dbName },
773
+ ...this.extraProps
774
+ });
775
+ }
676
776
  getGitBranchesMapping(workspace, dbName) {
677
777
  return operationsByTag.database.getGitBranchesMapping({
678
778
  pathParams: { workspace, dbName },
@@ -693,10 +793,10 @@ class DatabaseApi {
693
793
  ...this.extraProps
694
794
  });
695
795
  }
696
- resolveBranch(workspace, dbName, gitBranch) {
796
+ resolveBranch(workspace, dbName, gitBranch, fallbackBranch) {
697
797
  return operationsByTag.database.resolveBranch({
698
798
  pathParams: { workspace, dbName },
699
- queryParams: { gitBranch },
799
+ queryParams: { gitBranch, fallbackBranch },
700
800
  ...this.extraProps
701
801
  });
702
802
  }
@@ -845,9 +945,10 @@ class RecordsApi {
845
945
  constructor(extraProps) {
846
946
  this.extraProps = extraProps;
847
947
  }
848
- insertRecord(workspace, database, branch, tableName, record) {
948
+ insertRecord(workspace, database, branch, tableName, record, options = {}) {
849
949
  return operationsByTag.records.insertRecord({
850
950
  pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
951
+ queryParams: options,
851
952
  body: record,
852
953
  ...this.extraProps
853
954
  });
@@ -876,21 +977,24 @@ class RecordsApi {
876
977
  ...this.extraProps
877
978
  });
878
979
  }
879
- deleteRecord(workspace, database, branch, tableName, recordId) {
980
+ deleteRecord(workspace, database, branch, tableName, recordId, options = {}) {
880
981
  return operationsByTag.records.deleteRecord({
881
982
  pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
983
+ queryParams: options,
882
984
  ...this.extraProps
883
985
  });
884
986
  }
885
987
  getRecord(workspace, database, branch, tableName, recordId, options = {}) {
886
988
  return operationsByTag.records.getRecord({
887
989
  pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
990
+ queryParams: options,
888
991
  ...this.extraProps
889
992
  });
890
993
  }
891
- bulkInsertTableRecords(workspace, database, branch, tableName, records) {
994
+ bulkInsertTableRecords(workspace, database, branch, tableName, records, options = {}) {
892
995
  return operationsByTag.records.bulkInsertTableRecords({
893
996
  pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
997
+ queryParams: options,
894
998
  body: { records },
895
999
  ...this.extraProps
896
1000
  });
@@ -941,7 +1045,7 @@ var __privateAdd$6 = (obj, member, value) => {
941
1045
  throw TypeError("Cannot add the same private member more than once");
942
1046
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
943
1047
  };
944
- var __privateSet$5 = (obj, member, value, setter) => {
1048
+ var __privateSet$6 = (obj, member, value, setter) => {
945
1049
  __accessCheck$6(obj, member, "write to private field");
946
1050
  setter ? setter.call(obj, value) : member.set(obj, value);
947
1051
  return value;
@@ -950,7 +1054,7 @@ var _query, _page;
950
1054
  class Page {
951
1055
  constructor(query, meta, records = []) {
952
1056
  __privateAdd$6(this, _query, void 0);
953
- __privateSet$5(this, _query, query);
1057
+ __privateSet$6(this, _query, query);
954
1058
  this.meta = meta;
955
1059
  this.records = new RecordArray(this, records);
956
1060
  }
@@ -979,10 +1083,26 @@ function isCursorPaginationOptions(options) {
979
1083
  return isDefined(options) && (isDefined(options.first) || isDefined(options.last) || isDefined(options.after) || isDefined(options.before));
980
1084
  }
981
1085
  const _RecordArray = class extends Array {
982
- constructor(page, overrideRecords) {
983
- super(...overrideRecords ?? page.records);
1086
+ constructor(...args) {
1087
+ super(..._RecordArray.parseConstructorParams(...args));
984
1088
  __privateAdd$6(this, _page, void 0);
985
- __privateSet$5(this, _page, page);
1089
+ __privateSet$6(this, _page, isObject(args[0]?.meta) ? args[0] : { meta: { page: { cursor: "", more: false } }, records: [] });
1090
+ }
1091
+ static parseConstructorParams(...args) {
1092
+ if (args.length === 1 && typeof args[0] === "number") {
1093
+ return new Array(args[0]);
1094
+ }
1095
+ if (args.length <= 2 && isObject(args[0]?.meta) && Array.isArray(args[1] ?? [])) {
1096
+ const result = args[1] ?? args[0].records ?? [];
1097
+ return new Array(...result);
1098
+ }
1099
+ return new Array(...args);
1100
+ }
1101
+ toArray() {
1102
+ return new Array(...this);
1103
+ }
1104
+ map(callbackfn, thisArg) {
1105
+ return this.toArray().map(callbackfn, thisArg);
986
1106
  }
987
1107
  async nextPage(size, offset) {
988
1108
  const newPage = await __privateGet$6(this, _page).nextPage(size, offset);
@@ -1020,7 +1140,7 @@ var __privateAdd$5 = (obj, member, value) => {
1020
1140
  throw TypeError("Cannot add the same private member more than once");
1021
1141
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1022
1142
  };
1023
- var __privateSet$4 = (obj, member, value, setter) => {
1143
+ var __privateSet$5 = (obj, member, value, setter) => {
1024
1144
  __accessCheck$5(obj, member, "write to private field");
1025
1145
  setter ? setter.call(obj, value) : member.set(obj, value);
1026
1146
  return value;
@@ -1033,11 +1153,11 @@ const _Query = class {
1033
1153
  __privateAdd$5(this, _data, { filter: {} });
1034
1154
  this.meta = { page: { cursor: "start", more: true } };
1035
1155
  this.records = new RecordArray(this, []);
1036
- __privateSet$4(this, _table$1, table);
1156
+ __privateSet$5(this, _table$1, table);
1037
1157
  if (repository) {
1038
- __privateSet$4(this, _repository, repository);
1158
+ __privateSet$5(this, _repository, repository);
1039
1159
  } else {
1040
- __privateSet$4(this, _repository, this);
1160
+ __privateSet$5(this, _repository, this);
1041
1161
  }
1042
1162
  const parent = cleanParent(data, rawParent);
1043
1163
  __privateGet$5(this, _data).filter = data.filter ?? parent?.filter ?? {};
@@ -1092,13 +1212,18 @@ const _Query = class {
1092
1212
  return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
1093
1213
  }
1094
1214
  }
1095
- sort(column, direction) {
1215
+ sort(column, direction = "asc") {
1096
1216
  const originalSort = [__privateGet$5(this, _data).sort ?? []].flat();
1097
1217
  const sort = [...originalSort, { column, direction }];
1098
1218
  return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { sort }, __privateGet$5(this, _data));
1099
1219
  }
1100
1220
  select(columns) {
1101
- return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { columns }, __privateGet$5(this, _data));
1221
+ return new _Query(
1222
+ __privateGet$5(this, _repository),
1223
+ __privateGet$5(this, _table$1),
1224
+ { columns },
1225
+ __privateGet$5(this, _data)
1226
+ );
1102
1227
  }
1103
1228
  getPaginated(options = {}) {
1104
1229
  const query = new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), options, __privateGet$5(this, _data));
@@ -1214,7 +1339,7 @@ var __privateAdd$4 = (obj, member, value) => {
1214
1339
  throw TypeError("Cannot add the same private member more than once");
1215
1340
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1216
1341
  };
1217
- var __privateSet$3 = (obj, member, value, setter) => {
1342
+ var __privateSet$4 = (obj, member, value, setter) => {
1218
1343
  __accessCheck$4(obj, member, "write to private field");
1219
1344
  setter ? setter.call(obj, value) : member.set(obj, value);
1220
1345
  return value;
@@ -1223,7 +1348,7 @@ var __privateMethod$2 = (obj, member, method) => {
1223
1348
  __accessCheck$4(obj, member, "access private method");
1224
1349
  return method;
1225
1350
  };
1226
- var _table, _getFetchProps, _cache, _schema$1, _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, _getSchema$1, getSchema_fn$1;
1351
+ var _table, _getFetchProps, _db, _cache, _schemaTables$2, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn, _bulkInsertTableRecords, bulkInsertTableRecords_fn, _updateRecordWithID, updateRecordWithID_fn, _upsertRecordWithID, upsertRecordWithID_fn, _deleteRecord, deleteRecord_fn, _setCacheQuery, setCacheQuery_fn, _getCacheQuery, getCacheQuery_fn, _getSchemaTables$1, getSchemaTables_fn$1;
1227
1352
  class Repository extends Query {
1228
1353
  }
1229
1354
  class RestRepository extends Query {
@@ -1235,68 +1360,69 @@ class RestRepository extends Query {
1235
1360
  __privateAdd$4(this, _updateRecordWithID);
1236
1361
  __privateAdd$4(this, _upsertRecordWithID);
1237
1362
  __privateAdd$4(this, _deleteRecord);
1238
- __privateAdd$4(this, _invalidateCache);
1239
- __privateAdd$4(this, _setCacheRecord);
1240
- __privateAdd$4(this, _getCacheRecord);
1241
1363
  __privateAdd$4(this, _setCacheQuery);
1242
1364
  __privateAdd$4(this, _getCacheQuery);
1243
- __privateAdd$4(this, _getSchema$1);
1365
+ __privateAdd$4(this, _getSchemaTables$1);
1244
1366
  __privateAdd$4(this, _table, void 0);
1245
1367
  __privateAdd$4(this, _getFetchProps, void 0);
1368
+ __privateAdd$4(this, _db, void 0);
1246
1369
  __privateAdd$4(this, _cache, void 0);
1247
- __privateAdd$4(this, _schema$1, void 0);
1248
- __privateSet$3(this, _table, options.table);
1249
- __privateSet$3(this, _getFetchProps, options.pluginOptions.getFetchProps);
1250
- this.db = options.db;
1251
- __privateSet$3(this, _cache, options.pluginOptions.cache);
1252
- }
1253
- async create(a, b) {
1370
+ __privateAdd$4(this, _schemaTables$2, void 0);
1371
+ __privateSet$4(this, _table, options.table);
1372
+ __privateSet$4(this, _getFetchProps, options.pluginOptions.getFetchProps);
1373
+ __privateSet$4(this, _db, options.db);
1374
+ __privateSet$4(this, _cache, options.pluginOptions.cache);
1375
+ __privateSet$4(this, _schemaTables$2, options.schemaTables);
1376
+ }
1377
+ async create(a, b, c) {
1254
1378
  if (Array.isArray(a)) {
1255
1379
  if (a.length === 0)
1256
1380
  return [];
1257
- const records = await __privateMethod$2(this, _bulkInsertTableRecords, bulkInsertTableRecords_fn).call(this, a);
1258
- await Promise.all(records.map((record) => __privateMethod$2(this, _setCacheRecord, setCacheRecord_fn).call(this, record)));
1259
- return records;
1381
+ const columns = isStringArray(b) ? b : void 0;
1382
+ return __privateMethod$2(this, _bulkInsertTableRecords, bulkInsertTableRecords_fn).call(this, a, columns);
1260
1383
  }
1261
1384
  if (isString(a) && isObject(b)) {
1262
1385
  if (a === "")
1263
1386
  throw new Error("The id can't be empty");
1264
- const record = await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b);
1265
- await __privateMethod$2(this, _setCacheRecord, setCacheRecord_fn).call(this, record);
1266
- return record;
1387
+ const columns = isStringArray(c) ? c : void 0;
1388
+ return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns);
1267
1389
  }
1268
1390
  if (isObject(a) && isString(a.id)) {
1269
1391
  if (a.id === "")
1270
1392
  throw new Error("The id can't be empty");
1271
- const record = await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 });
1272
- await __privateMethod$2(this, _setCacheRecord, setCacheRecord_fn).call(this, record);
1273
- return record;
1393
+ const columns = isStringArray(b) ? b : void 0;
1394
+ return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns);
1274
1395
  }
1275
1396
  if (isObject(a)) {
1276
- const record = await __privateMethod$2(this, _insertRecordWithoutId, insertRecordWithoutId_fn).call(this, a);
1277
- await __privateMethod$2(this, _setCacheRecord, setCacheRecord_fn).call(this, record);
1278
- return record;
1397
+ const columns = isStringArray(b) ? b : void 0;
1398
+ return __privateMethod$2(this, _insertRecordWithoutId, insertRecordWithoutId_fn).call(this, a, columns);
1279
1399
  }
1280
1400
  throw new Error("Invalid arguments for create method");
1281
1401
  }
1282
- async read(a) {
1402
+ async read(a, b) {
1403
+ const columns = isStringArray(b) ? b : ["*"];
1283
1404
  if (Array.isArray(a)) {
1284
1405
  if (a.length === 0)
1285
1406
  return [];
1286
- return this.getAll({ filter: { id: { $any: a } } });
1407
+ const ids = a.map((item) => isString(item) ? item : item.id).filter((id2) => isString(id2));
1408
+ const finalObjects = await this.getAll({ filter: { id: { $any: ids } }, columns });
1409
+ const dictionary = finalObjects.reduce((acc, object) => {
1410
+ acc[object.id] = object;
1411
+ return acc;
1412
+ }, {});
1413
+ return ids.map((id2) => dictionary[id2] ?? null);
1287
1414
  }
1288
- if (isString(a)) {
1289
- const cacheRecord = await __privateMethod$2(this, _getCacheRecord, getCacheRecord_fn).call(this, a);
1290
- if (cacheRecord)
1291
- return cacheRecord;
1415
+ const id = isString(a) ? a : a.id;
1416
+ if (isString(id)) {
1292
1417
  const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1293
1418
  try {
1294
1419
  const response = await getRecord({
1295
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table), recordId: a },
1420
+ pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table), recordId: id },
1421
+ queryParams: { columns },
1296
1422
  ...fetchProps
1297
1423
  });
1298
- const schema = await __privateMethod$2(this, _getSchema$1, getSchema_fn$1).call(this);
1299
- return initObject(this.db, schema, __privateGet$4(this, _table), response);
1424
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
1425
+ return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
1300
1426
  } catch (e) {
1301
1427
  if (isObject(e) && e.status === 404) {
1302
1428
  return null;
@@ -1304,50 +1430,45 @@ class RestRepository extends Query {
1304
1430
  throw e;
1305
1431
  }
1306
1432
  }
1433
+ return null;
1307
1434
  }
1308
- async update(a, b) {
1435
+ async update(a, b, c) {
1309
1436
  if (Array.isArray(a)) {
1310
1437
  if (a.length === 0)
1311
1438
  return [];
1312
1439
  if (a.length > 100) {
1313
1440
  console.warn("Bulk update operation is not optimized in the Xata API yet, this request might be slow");
1314
1441
  }
1315
- return Promise.all(a.map((object) => this.update(object)));
1442
+ const columns = isStringArray(b) ? b : ["*"];
1443
+ return Promise.all(a.map((object) => this.update(object, columns)));
1316
1444
  }
1317
1445
  if (isString(a) && isObject(b)) {
1318
- await __privateMethod$2(this, _invalidateCache, invalidateCache_fn).call(this, a);
1319
- const record = await __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b);
1320
- await __privateMethod$2(this, _setCacheRecord, setCacheRecord_fn).call(this, record);
1321
- return record;
1446
+ const columns = isStringArray(c) ? c : void 0;
1447
+ return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns);
1322
1448
  }
1323
1449
  if (isObject(a) && isString(a.id)) {
1324
- await __privateMethod$2(this, _invalidateCache, invalidateCache_fn).call(this, a.id);
1325
- const record = await __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 });
1326
- await __privateMethod$2(this, _setCacheRecord, setCacheRecord_fn).call(this, record);
1327
- return record;
1450
+ const columns = isStringArray(b) ? b : void 0;
1451
+ return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
1328
1452
  }
1329
1453
  throw new Error("Invalid arguments for update method");
1330
1454
  }
1331
- async createOrUpdate(a, b) {
1455
+ async createOrUpdate(a, b, c) {
1332
1456
  if (Array.isArray(a)) {
1333
1457
  if (a.length === 0)
1334
1458
  return [];
1335
1459
  if (a.length > 100) {
1336
1460
  console.warn("Bulk update operation is not optimized in the Xata API yet, this request might be slow");
1337
1461
  }
1338
- return Promise.all(a.map((object) => this.createOrUpdate(object)));
1462
+ const columns = isStringArray(b) ? b : ["*"];
1463
+ return Promise.all(a.map((object) => this.createOrUpdate(object, columns)));
1339
1464
  }
1340
1465
  if (isString(a) && isObject(b)) {
1341
- await __privateMethod$2(this, _invalidateCache, invalidateCache_fn).call(this, a);
1342
- const record = await __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b);
1343
- await __privateMethod$2(this, _setCacheRecord, setCacheRecord_fn).call(this, record);
1344
- return record;
1466
+ const columns = isStringArray(c) ? c : void 0;
1467
+ return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns);
1345
1468
  }
1346
1469
  if (isObject(a) && isString(a.id)) {
1347
- await __privateMethod$2(this, _invalidateCache, invalidateCache_fn).call(this, a.id);
1348
- const record = await __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 });
1349
- await __privateMethod$2(this, _setCacheRecord, setCacheRecord_fn).call(this, record);
1350
- return record;
1470
+ const columns = isStringArray(c) ? c : void 0;
1471
+ return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
1351
1472
  }
1352
1473
  throw new Error("Invalid arguments for createOrUpdate method");
1353
1474
  }
@@ -1363,12 +1484,10 @@ class RestRepository extends Query {
1363
1484
  }
1364
1485
  if (isString(a)) {
1365
1486
  await __privateMethod$2(this, _deleteRecord, deleteRecord_fn).call(this, a);
1366
- await __privateMethod$2(this, _invalidateCache, invalidateCache_fn).call(this, a);
1367
1487
  return;
1368
1488
  }
1369
1489
  if (isObject(a) && isString(a.id)) {
1370
1490
  await __privateMethod$2(this, _deleteRecord, deleteRecord_fn).call(this, a.id);
1371
- await __privateMethod$2(this, _invalidateCache, invalidateCache_fn).call(this, a.id);
1372
1491
  return;
1373
1492
  }
1374
1493
  throw new Error("Invalid arguments for delete method");
@@ -1380,13 +1499,15 @@ class RestRepository extends Query {
1380
1499
  body: {
1381
1500
  query,
1382
1501
  fuzziness: options.fuzziness,
1502
+ prefix: options.prefix,
1383
1503
  highlight: options.highlight,
1384
- filter: options.filter
1504
+ filter: options.filter,
1505
+ boosters: options.boosters
1385
1506
  },
1386
1507
  ...fetchProps
1387
1508
  });
1388
- const schema = await __privateMethod$2(this, _getSchema$1, getSchema_fn$1).call(this);
1389
- return records.map((item) => initObject(this.db, schema, __privateGet$4(this, _table), item));
1509
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
1510
+ return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item));
1390
1511
  }
1391
1512
  async query(query) {
1392
1513
  const cacheQuery = await __privateMethod$2(this, _getCacheQuery, getCacheQuery_fn).call(this, query);
@@ -1405,18 +1526,19 @@ class RestRepository extends Query {
1405
1526
  body,
1406
1527
  ...fetchProps
1407
1528
  });
1408
- const schema = await __privateMethod$2(this, _getSchema$1, getSchema_fn$1).call(this);
1409
- const records = objects.map((record) => initObject(this.db, schema, __privateGet$4(this, _table), record));
1529
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
1530
+ const records = objects.map((record) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), record));
1410
1531
  await __privateMethod$2(this, _setCacheQuery, setCacheQuery_fn).call(this, query, meta, records);
1411
1532
  return new Page(query, meta, records);
1412
1533
  }
1413
1534
  }
1414
1535
  _table = new WeakMap();
1415
1536
  _getFetchProps = new WeakMap();
1537
+ _db = new WeakMap();
1416
1538
  _cache = new WeakMap();
1417
- _schema$1 = new WeakMap();
1539
+ _schemaTables$2 = new WeakMap();
1418
1540
  _insertRecordWithoutId = new WeakSet();
1419
- insertRecordWithoutId_fn = async function(object) {
1541
+ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
1420
1542
  const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1421
1543
  const record = transformObjectLinks(object);
1422
1544
  const response = await insertRecord({
@@ -1425,17 +1547,15 @@ insertRecordWithoutId_fn = async function(object) {
1425
1547
  dbBranchName: "{dbBranch}",
1426
1548
  tableName: __privateGet$4(this, _table)
1427
1549
  },
1550
+ queryParams: { columns },
1428
1551
  body: record,
1429
1552
  ...fetchProps
1430
1553
  });
1431
- const finalObject = await this.read(response.id);
1432
- if (!finalObject) {
1433
- throw new Error("The server failed to save the record");
1434
- }
1435
- return finalObject;
1554
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
1555
+ return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
1436
1556
  };
1437
1557
  _insertRecordWithId = new WeakSet();
1438
- insertRecordWithId_fn = async function(recordId, object) {
1558
+ insertRecordWithId_fn = async function(recordId, object, columns = ["*"]) {
1439
1559
  const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1440
1560
  const record = transformObjectLinks(object);
1441
1561
  const response = await insertRecordWithID({
@@ -1446,56 +1566,52 @@ insertRecordWithId_fn = async function(recordId, object) {
1446
1566
  recordId
1447
1567
  },
1448
1568
  body: record,
1449
- queryParams: { createOnly: true },
1569
+ queryParams: { createOnly: true, columns },
1450
1570
  ...fetchProps
1451
1571
  });
1452
- const finalObject = await this.read(response.id);
1453
- if (!finalObject) {
1454
- throw new Error("The server failed to save the record");
1455
- }
1456
- return finalObject;
1572
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
1573
+ return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
1457
1574
  };
1458
1575
  _bulkInsertTableRecords = new WeakSet();
1459
- bulkInsertTableRecords_fn = async function(objects) {
1576
+ bulkInsertTableRecords_fn = async function(objects, columns = ["*"]) {
1460
1577
  const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1461
1578
  const records = objects.map((object) => transformObjectLinks(object));
1462
1579
  const response = await bulkInsertTableRecords({
1463
1580
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table) },
1581
+ queryParams: { columns },
1464
1582
  body: { records },
1465
1583
  ...fetchProps
1466
1584
  });
1467
- const finalObjects = await this.any(...response.recordIDs.map((id) => this.filter("id", id))).getAll();
1468
- if (finalObjects.length !== objects.length) {
1469
- throw new Error("The server failed to save some records");
1585
+ if (!isResponseWithRecords(response)) {
1586
+ throw new Error("Request included columns but server didn't include them");
1470
1587
  }
1471
- return finalObjects;
1588
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
1589
+ return response.records?.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item));
1472
1590
  };
1473
1591
  _updateRecordWithID = new WeakSet();
1474
- updateRecordWithID_fn = async function(recordId, object) {
1592
+ updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
1475
1593
  const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1476
1594
  const record = transformObjectLinks(object);
1477
1595
  const response = await updateRecordWithID({
1478
1596
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table), recordId },
1597
+ queryParams: { columns },
1479
1598
  body: record,
1480
1599
  ...fetchProps
1481
1600
  });
1482
- const item = await this.read(response.id);
1483
- if (!item)
1484
- throw new Error("The server failed to save the record");
1485
- return item;
1601
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
1602
+ return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
1486
1603
  };
1487
1604
  _upsertRecordWithID = new WeakSet();
1488
- upsertRecordWithID_fn = async function(recordId, object) {
1605
+ upsertRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
1489
1606
  const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1490
1607
  const response = await upsertRecordWithID({
1491
1608
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table), recordId },
1609
+ queryParams: { columns },
1492
1610
  body: object,
1493
1611
  ...fetchProps
1494
1612
  });
1495
- const item = await this.read(response.id);
1496
- if (!item)
1497
- throw new Error("The server failed to save the record");
1498
- return item;
1613
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
1614
+ return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
1499
1615
  };
1500
1616
  _deleteRecord = new WeakSet();
1501
1617
  deleteRecord_fn = async function(recordId) {
@@ -1505,29 +1621,6 @@ deleteRecord_fn = async function(recordId) {
1505
1621
  ...fetchProps
1506
1622
  });
1507
1623
  };
1508
- _invalidateCache = new WeakSet();
1509
- invalidateCache_fn = async function(recordId) {
1510
- await __privateGet$4(this, _cache).delete(`rec_${__privateGet$4(this, _table)}:${recordId}`);
1511
- const cacheItems = await __privateGet$4(this, _cache).getAll();
1512
- const queries = Object.entries(cacheItems).filter(([key]) => key.startsWith("query_"));
1513
- for (const [key, value] of queries) {
1514
- const ids = getIds(value);
1515
- if (ids.includes(recordId))
1516
- await __privateGet$4(this, _cache).delete(key);
1517
- }
1518
- };
1519
- _setCacheRecord = new WeakSet();
1520
- setCacheRecord_fn = async function(record) {
1521
- if (!__privateGet$4(this, _cache).cacheRecords)
1522
- return;
1523
- await __privateGet$4(this, _cache).set(`rec_${__privateGet$4(this, _table)}:${record.id}`, record);
1524
- };
1525
- _getCacheRecord = new WeakSet();
1526
- getCacheRecord_fn = async function(recordId) {
1527
- if (!__privateGet$4(this, _cache).cacheRecords)
1528
- return null;
1529
- return __privateGet$4(this, _cache).get(`rec_${__privateGet$4(this, _table)}:${recordId}`);
1530
- };
1531
1624
  _setCacheQuery = new WeakSet();
1532
1625
  setCacheQuery_fn = async function(query, meta, records) {
1533
1626
  await __privateGet$4(this, _cache).set(`query_${__privateGet$4(this, _table)}:${query.key()}`, { date: new Date(), meta, records });
@@ -1544,17 +1637,17 @@ getCacheQuery_fn = async function(query) {
1544
1637
  const hasExpired = result.date.getTime() + ttl < Date.now();
1545
1638
  return hasExpired ? null : result;
1546
1639
  };
1547
- _getSchema$1 = new WeakSet();
1548
- getSchema_fn$1 = async function() {
1549
- if (__privateGet$4(this, _schema$1))
1550
- return __privateGet$4(this, _schema$1);
1640
+ _getSchemaTables$1 = new WeakSet();
1641
+ getSchemaTables_fn$1 = async function() {
1642
+ if (__privateGet$4(this, _schemaTables$2))
1643
+ return __privateGet$4(this, _schemaTables$2);
1551
1644
  const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1552
1645
  const { schema } = await getBranchDetails({
1553
1646
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
1554
1647
  ...fetchProps
1555
1648
  });
1556
- __privateSet$3(this, _schema$1, schema);
1557
- return schema;
1649
+ __privateSet$4(this, _schemaTables$2, schema.tables);
1650
+ return schema.tables;
1558
1651
  };
1559
1652
  const transformObjectLinks = (object) => {
1560
1653
  return Object.entries(object).reduce((acc, [key, value]) => {
@@ -1563,11 +1656,11 @@ const transformObjectLinks = (object) => {
1563
1656
  return { ...acc, [key]: isIdentifiable(value) ? value.id : value };
1564
1657
  }, {});
1565
1658
  };
1566
- const initObject = (db, schema, table, object) => {
1659
+ const initObject = (db, schemaTables, table, object) => {
1567
1660
  const result = {};
1568
1661
  const { xata, ...rest } = object ?? {};
1569
1662
  Object.assign(result, rest);
1570
- const { columns } = schema.tables.find(({ name }) => name === table) ?? {};
1663
+ const { columns } = schemaTables.find(({ name }) => name === table) ?? {};
1571
1664
  if (!columns)
1572
1665
  console.error(`Table ${table} not found in schema`);
1573
1666
  for (const column of columns ?? []) {
@@ -1587,17 +1680,17 @@ const initObject = (db, schema, table, object) => {
1587
1680
  if (!linkTable) {
1588
1681
  console.error(`Failed to parse link for field ${column.name}`);
1589
1682
  } else if (isObject(value)) {
1590
- result[column.name] = initObject(db, schema, linkTable, value);
1683
+ result[column.name] = initObject(db, schemaTables, linkTable, value);
1591
1684
  }
1592
1685
  break;
1593
1686
  }
1594
1687
  }
1595
1688
  }
1596
- result.read = function() {
1597
- return db[table].read(result["id"]);
1689
+ result.read = function(columns2) {
1690
+ return db[table].read(result["id"], columns2);
1598
1691
  };
1599
- result.update = function(data) {
1600
- return db[table].update(result["id"], data);
1692
+ result.update = function(data, columns2) {
1693
+ return db[table].update(result["id"], data, columns2);
1601
1694
  };
1602
1695
  result.delete = function() {
1603
1696
  return db[table].delete(result["id"]);
@@ -1611,14 +1704,8 @@ const initObject = (db, schema, table, object) => {
1611
1704
  Object.freeze(result);
1612
1705
  return result;
1613
1706
  };
1614
- function getIds(value) {
1615
- if (Array.isArray(value)) {
1616
- return value.map((item) => getIds(item)).flat();
1617
- }
1618
- if (!isObject(value))
1619
- return [];
1620
- const nestedIds = Object.values(value).map((item) => getIds(item)).flat();
1621
- return isString(value.id) ? [value.id, ...nestedIds] : nestedIds;
1707
+ function isResponseWithRecords(value) {
1708
+ return isObject(value) && Array.isArray(value.records);
1622
1709
  }
1623
1710
 
1624
1711
  var __accessCheck$3 = (obj, member, msg) => {
@@ -1634,7 +1721,7 @@ var __privateAdd$3 = (obj, member, value) => {
1634
1721
  throw TypeError("Cannot add the same private member more than once");
1635
1722
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1636
1723
  };
1637
- var __privateSet$2 = (obj, member, value, setter) => {
1724
+ var __privateSet$3 = (obj, member, value, setter) => {
1638
1725
  __accessCheck$3(obj, member, "write to private field");
1639
1726
  setter ? setter.call(obj, value) : member.set(obj, value);
1640
1727
  return value;
@@ -1643,9 +1730,8 @@ var _map;
1643
1730
  class SimpleCache {
1644
1731
  constructor(options = {}) {
1645
1732
  __privateAdd$3(this, _map, void 0);
1646
- __privateSet$2(this, _map, /* @__PURE__ */ new Map());
1733
+ __privateSet$3(this, _map, /* @__PURE__ */ new Map());
1647
1734
  this.capacity = options.max ?? 500;
1648
- this.cacheRecords = options.cacheRecords ?? true;
1649
1735
  this.defaultQueryTTL = options.defaultQueryTTL ?? 60 * 1e3;
1650
1736
  }
1651
1737
  async getAll() {
@@ -1703,31 +1789,42 @@ var __privateAdd$2 = (obj, member, value) => {
1703
1789
  throw TypeError("Cannot add the same private member more than once");
1704
1790
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1705
1791
  };
1706
- var _tables;
1792
+ var __privateSet$2 = (obj, member, value, setter) => {
1793
+ __accessCheck$2(obj, member, "write to private field");
1794
+ setter ? setter.call(obj, value) : member.set(obj, value);
1795
+ return value;
1796
+ };
1797
+ var _tables, _schemaTables$1;
1707
1798
  class SchemaPlugin extends XataPlugin {
1708
- constructor(tableNames) {
1799
+ constructor(schemaTables) {
1709
1800
  super();
1710
- this.tableNames = tableNames;
1711
1801
  __privateAdd$2(this, _tables, {});
1802
+ __privateAdd$2(this, _schemaTables$1, void 0);
1803
+ __privateSet$2(this, _schemaTables$1, schemaTables);
1712
1804
  }
1713
1805
  build(pluginOptions) {
1714
- const db = new Proxy({}, {
1715
- get: (_target, table) => {
1716
- if (!isString(table))
1717
- throw new Error("Invalid table name");
1718
- if (__privateGet$2(this, _tables)[table] === void 0) {
1719
- __privateGet$2(this, _tables)[table] = new RestRepository({ db, pluginOptions, table });
1806
+ const db = new Proxy(
1807
+ {},
1808
+ {
1809
+ get: (_target, table) => {
1810
+ if (!isString(table))
1811
+ throw new Error("Invalid table name");
1812
+ if (__privateGet$2(this, _tables)[table] === void 0) {
1813
+ __privateGet$2(this, _tables)[table] = new RestRepository({ db, pluginOptions, table, schemaTables: __privateGet$2(this, _schemaTables$1) });
1814
+ }
1815
+ return __privateGet$2(this, _tables)[table];
1720
1816
  }
1721
- return __privateGet$2(this, _tables)[table];
1722
1817
  }
1723
- });
1724
- for (const table of this.tableNames ?? []) {
1725
- db[table] = new RestRepository({ db, pluginOptions, table });
1818
+ );
1819
+ const tableNames = __privateGet$2(this, _schemaTables$1)?.map(({ name }) => name) ?? [];
1820
+ for (const table of tableNames) {
1821
+ db[table] = new RestRepository({ db, pluginOptions, table, schemaTables: __privateGet$2(this, _schemaTables$1) });
1726
1822
  }
1727
1823
  return db;
1728
1824
  }
1729
1825
  }
1730
1826
  _tables = new WeakMap();
1827
+ _schemaTables$1 = new WeakMap();
1731
1828
 
1732
1829
  var __accessCheck$1 = (obj, member, msg) => {
1733
1830
  if (!member.has(obj))
@@ -1751,82 +1848,77 @@ var __privateMethod$1 = (obj, member, method) => {
1751
1848
  __accessCheck$1(obj, member, "access private method");
1752
1849
  return method;
1753
1850
  };
1754
- var _schema, _search, search_fn, _getSchema, getSchema_fn;
1851
+ var _schemaTables, _search, search_fn, _getSchemaTables, getSchemaTables_fn;
1755
1852
  class SearchPlugin extends XataPlugin {
1756
- constructor(db) {
1853
+ constructor(db, schemaTables) {
1757
1854
  super();
1758
1855
  this.db = db;
1759
1856
  __privateAdd$1(this, _search);
1760
- __privateAdd$1(this, _getSchema);
1761
- __privateAdd$1(this, _schema, void 0);
1857
+ __privateAdd$1(this, _getSchemaTables);
1858
+ __privateAdd$1(this, _schemaTables, void 0);
1859
+ __privateSet$1(this, _schemaTables, schemaTables);
1762
1860
  }
1763
1861
  build({ getFetchProps }) {
1764
1862
  return {
1765
1863
  all: async (query, options = {}) => {
1766
1864
  const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options, getFetchProps);
1767
- const schema = await __privateMethod$1(this, _getSchema, getSchema_fn).call(this, getFetchProps);
1865
+ const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, getFetchProps);
1768
1866
  return records.map((record) => {
1769
1867
  const { table = "orphan" } = record.xata;
1770
- return { table, record: initObject(this.db, schema, table, record) };
1868
+ return { table, record: initObject(this.db, schemaTables, table, record) };
1771
1869
  });
1772
1870
  },
1773
1871
  byTable: async (query, options = {}) => {
1774
1872
  const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options, getFetchProps);
1775
- const schema = await __privateMethod$1(this, _getSchema, getSchema_fn).call(this, getFetchProps);
1873
+ const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, getFetchProps);
1776
1874
  return records.reduce((acc, record) => {
1777
1875
  const { table = "orphan" } = record.xata;
1778
1876
  const items = acc[table] ?? [];
1779
- const item = initObject(this.db, schema, table, record);
1877
+ const item = initObject(this.db, schemaTables, table, record);
1780
1878
  return { ...acc, [table]: [...items, item] };
1781
1879
  }, {});
1782
1880
  }
1783
1881
  };
1784
1882
  }
1785
1883
  }
1786
- _schema = new WeakMap();
1884
+ _schemaTables = new WeakMap();
1787
1885
  _search = new WeakSet();
1788
1886
  search_fn = async function(query, options, getFetchProps) {
1789
1887
  const fetchProps = await getFetchProps();
1790
- const { tables, fuzziness, highlight } = options ?? {};
1888
+ const { tables, fuzziness, highlight, prefix } = options ?? {};
1791
1889
  const { records } = await searchBranch({
1792
1890
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
1793
- body: { tables, query, fuzziness, highlight },
1891
+ body: { tables, query, fuzziness, prefix, highlight },
1794
1892
  ...fetchProps
1795
1893
  });
1796
1894
  return records;
1797
1895
  };
1798
- _getSchema = new WeakSet();
1799
- getSchema_fn = async function(getFetchProps) {
1800
- if (__privateGet$1(this, _schema))
1801
- return __privateGet$1(this, _schema);
1896
+ _getSchemaTables = new WeakSet();
1897
+ getSchemaTables_fn = async function(getFetchProps) {
1898
+ if (__privateGet$1(this, _schemaTables))
1899
+ return __privateGet$1(this, _schemaTables);
1802
1900
  const fetchProps = await getFetchProps();
1803
1901
  const { schema } = await getBranchDetails({
1804
1902
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
1805
1903
  ...fetchProps
1806
1904
  });
1807
- __privateSet$1(this, _schema, schema);
1808
- return schema;
1905
+ __privateSet$1(this, _schemaTables, schema.tables);
1906
+ return schema.tables;
1809
1907
  };
1810
1908
 
1811
1909
  const isBranchStrategyBuilder = (strategy) => {
1812
1910
  return typeof strategy === "function";
1813
1911
  };
1814
1912
 
1815
- const envBranchNames = [
1816
- "XATA_BRANCH",
1817
- "VERCEL_GIT_COMMIT_REF",
1818
- "CF_PAGES_BRANCH",
1819
- "BRANCH"
1820
- ];
1821
1913
  async function getCurrentBranchName(options) {
1822
- const env = getBranchByEnvVariable();
1823
- if (env) {
1824
- const details = await getDatabaseBranch(env, options);
1914
+ const { branch, envBranch } = getEnvironment();
1915
+ if (branch) {
1916
+ const details = await getDatabaseBranch(branch, options);
1825
1917
  if (details)
1826
- return env;
1827
- console.warn(`Branch ${env} not found in Xata. Ignoring...`);
1918
+ return branch;
1919
+ console.warn(`Branch ${branch} not found in Xata. Ignoring...`);
1828
1920
  }
1829
- const gitBranch = await getGitBranch();
1921
+ const gitBranch = envBranch || await getGitBranch();
1830
1922
  return resolveXataBranch(gitBranch, options);
1831
1923
  }
1832
1924
  async function getCurrentBranchDetails(options) {
@@ -1837,18 +1929,23 @@ async function resolveXataBranch(gitBranch, options) {
1837
1929
  const databaseURL = options?.databaseURL || getDatabaseURL();
1838
1930
  const apiKey = options?.apiKey || getAPIKey();
1839
1931
  if (!databaseURL)
1840
- throw new Error("A databaseURL was not defined. Either set the XATA_DATABASE_URL env variable or pass the argument explicitely");
1932
+ throw new Error(
1933
+ "A databaseURL was not defined. Either set the XATA_DATABASE_URL env variable or pass the argument explicitely"
1934
+ );
1841
1935
  if (!apiKey)
1842
- throw new Error("An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely");
1936
+ throw new Error(
1937
+ "An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
1938
+ );
1843
1939
  const [protocol, , host, , dbName] = databaseURL.split("/");
1844
1940
  const [workspace] = host.split(".");
1941
+ const { fallbackBranch } = getEnvironment();
1845
1942
  const { branch } = await resolveBranch({
1846
1943
  apiKey,
1847
1944
  apiUrl: databaseURL,
1848
1945
  fetchImpl: getFetchImplementation(options?.fetchImpl),
1849
1946
  workspacesApiUrl: `${protocol}//${host}`,
1850
1947
  pathParams: { dbName, workspace },
1851
- queryParams: { gitBranch, fallbackBranch: getEnvVariable("XATA_FALLBACK_BRANCH") }
1948
+ queryParams: { gitBranch, fallbackBranch }
1852
1949
  });
1853
1950
  return branch;
1854
1951
  }
@@ -1856,9 +1953,13 @@ async function getDatabaseBranch(branch, options) {
1856
1953
  const databaseURL = options?.databaseURL || getDatabaseURL();
1857
1954
  const apiKey = options?.apiKey || getAPIKey();
1858
1955
  if (!databaseURL)
1859
- throw new Error("A databaseURL was not defined. Either set the XATA_DATABASE_URL env variable or pass the argument explicitely");
1956
+ throw new Error(
1957
+ "A databaseURL was not defined. Either set the XATA_DATABASE_URL env variable or pass the argument explicitely"
1958
+ );
1860
1959
  if (!apiKey)
1861
- throw new Error("An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely");
1960
+ throw new Error(
1961
+ "An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
1962
+ );
1862
1963
  const [protocol, , host, , database] = databaseURL.split("/");
1863
1964
  const [workspace] = host.split(".");
1864
1965
  const dbBranchName = `${database}:${branch}`;
@@ -1868,10 +1969,7 @@ async function getDatabaseBranch(branch, options) {
1868
1969
  apiUrl: databaseURL,
1869
1970
  fetchImpl: getFetchImplementation(options?.fetchImpl),
1870
1971
  workspacesApiUrl: `${protocol}//${host}`,
1871
- pathParams: {
1872
- dbBranchName,
1873
- workspace
1874
- }
1972
+ pathParams: { dbBranchName, workspace }
1875
1973
  });
1876
1974
  } catch (err) {
1877
1975
  if (isObject(err) && err.status === 404)
@@ -1879,21 +1977,10 @@ async function getDatabaseBranch(branch, options) {
1879
1977
  throw err;
1880
1978
  }
1881
1979
  }
1882
- function getBranchByEnvVariable() {
1883
- for (const name of envBranchNames) {
1884
- const value = getEnvVariable(name);
1885
- if (value) {
1886
- return value;
1887
- }
1888
- }
1889
- try {
1890
- return XATA_BRANCH;
1891
- } catch (err) {
1892
- }
1893
- }
1894
1980
  function getDatabaseURL() {
1895
1981
  try {
1896
- return getEnvVariable("XATA_DATABASE_URL") ?? XATA_DATABASE_URL;
1982
+ const { databaseURL } = getEnvironment();
1983
+ return databaseURL;
1897
1984
  } catch (err) {
1898
1985
  return void 0;
1899
1986
  }
@@ -1922,20 +2009,22 @@ var __privateMethod = (obj, member, method) => {
1922
2009
  return method;
1923
2010
  };
1924
2011
  const buildClient = (plugins) => {
1925
- var _branch, _parseOptions, parseOptions_fn, _getFetchProps, getFetchProps_fn, _evaluateBranch, evaluateBranch_fn, _a;
2012
+ var _branch, _options, _parseOptions, parseOptions_fn, _getFetchProps, getFetchProps_fn, _evaluateBranch, evaluateBranch_fn, _a;
1926
2013
  return _a = class {
1927
- constructor(options = {}, tables) {
2014
+ constructor(options = {}, schemaTables) {
1928
2015
  __privateAdd(this, _parseOptions);
1929
2016
  __privateAdd(this, _getFetchProps);
1930
2017
  __privateAdd(this, _evaluateBranch);
1931
2018
  __privateAdd(this, _branch, void 0);
2019
+ __privateAdd(this, _options, void 0);
1932
2020
  const safeOptions = __privateMethod(this, _parseOptions, parseOptions_fn).call(this, options);
2021
+ __privateSet(this, _options, safeOptions);
1933
2022
  const pluginOptions = {
1934
2023
  getFetchProps: () => __privateMethod(this, _getFetchProps, getFetchProps_fn).call(this, safeOptions),
1935
2024
  cache: safeOptions.cache
1936
2025
  };
1937
- const db = new SchemaPlugin(tables).build(pluginOptions);
1938
- const search = new SearchPlugin(db).build(pluginOptions);
2026
+ const db = new SchemaPlugin(schemaTables).build(pluginOptions);
2027
+ const search = new SearchPlugin(db, schemaTables).build(pluginOptions);
1939
2028
  this.db = db;
1940
2029
  this.search = search;
1941
2030
  for (const [key, namespace] of Object.entries(plugins ?? {})) {
@@ -1951,22 +2040,22 @@ const buildClient = (plugins) => {
1951
2040
  }
1952
2041
  }
1953
2042
  }
1954
- }, _branch = new WeakMap(), _parseOptions = new WeakSet(), parseOptions_fn = function(options) {
2043
+ async getConfig() {
2044
+ const databaseURL = __privateGet(this, _options).databaseURL;
2045
+ const branch = await __privateGet(this, _options).branch();
2046
+ return { databaseURL, branch };
2047
+ }
2048
+ }, _branch = new WeakMap(), _options = new WeakMap(), _parseOptions = new WeakSet(), parseOptions_fn = function(options) {
1955
2049
  const fetch = getFetchImplementation(options?.fetch);
1956
2050
  const databaseURL = options?.databaseURL || getDatabaseURL();
1957
2051
  const apiKey = options?.apiKey || getAPIKey();
1958
- const cache = options?.cache ?? new SimpleCache({ cacheRecords: false, defaultQueryTTL: 0 });
2052
+ const cache = options?.cache ?? new SimpleCache({ defaultQueryTTL: 0 });
1959
2053
  const branch = async () => options?.branch !== void 0 ? await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, options.branch) : await getCurrentBranchName({ apiKey, databaseURL, fetchImpl: options?.fetch });
1960
2054
  if (!databaseURL || !apiKey) {
1961
2055
  throw new Error("Options databaseURL and apiKey are required");
1962
2056
  }
1963
2057
  return { fetch, databaseURL, apiKey, branch, cache };
1964
- }, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({
1965
- fetch,
1966
- apiKey,
1967
- databaseURL,
1968
- branch
1969
- }) {
2058
+ }, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({ fetch, apiKey, databaseURL, branch }) {
1970
2059
  const branchValue = await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, branch);
1971
2060
  if (!branchValue)
1972
2061
  throw new Error("Unable to resolve branch value");
@@ -2001,6 +2090,88 @@ const buildClient = (plugins) => {
2001
2090
  class BaseClient extends buildClient() {
2002
2091
  }
2003
2092
 
2093
+ const META = "__";
2094
+ const VALUE = "___";
2095
+ class Serializer {
2096
+ constructor() {
2097
+ this.classes = {};
2098
+ }
2099
+ add(clazz) {
2100
+ this.classes[clazz.name] = clazz;
2101
+ }
2102
+ toJSON(data) {
2103
+ function visit(obj) {
2104
+ if (Array.isArray(obj))
2105
+ return obj.map(visit);
2106
+ const type = typeof obj;
2107
+ if (type === "undefined")
2108
+ return { [META]: "undefined" };
2109
+ if (type === "bigint")
2110
+ return { [META]: "bigint", [VALUE]: obj.toString() };
2111
+ if (obj === null || type !== "object")
2112
+ return obj;
2113
+ const constructor = obj.constructor;
2114
+ const o = { [META]: constructor.name };
2115
+ for (const [key, value] of Object.entries(obj)) {
2116
+ o[key] = visit(value);
2117
+ }
2118
+ if (constructor === Date)
2119
+ o[VALUE] = obj.toISOString();
2120
+ if (constructor === Map)
2121
+ o[VALUE] = Object.fromEntries(obj);
2122
+ if (constructor === Set)
2123
+ o[VALUE] = [...obj];
2124
+ return o;
2125
+ }
2126
+ return JSON.stringify(visit(data));
2127
+ }
2128
+ fromJSON(json) {
2129
+ return JSON.parse(json, (key, value) => {
2130
+ if (value && typeof value === "object" && !Array.isArray(value)) {
2131
+ const { [META]: clazz, [VALUE]: val, ...rest } = value;
2132
+ const constructor = this.classes[clazz];
2133
+ if (constructor) {
2134
+ return Object.assign(Object.create(constructor.prototype), rest);
2135
+ }
2136
+ if (clazz === "Date")
2137
+ return new Date(val);
2138
+ if (clazz === "Set")
2139
+ return new Set(val);
2140
+ if (clazz === "Map")
2141
+ return new Map(Object.entries(val));
2142
+ if (clazz === "bigint")
2143
+ return BigInt(val);
2144
+ if (clazz === "undefined")
2145
+ return void 0;
2146
+ return rest;
2147
+ }
2148
+ return value;
2149
+ });
2150
+ }
2151
+ }
2152
+ const defaultSerializer = new Serializer();
2153
+ const serialize = (data) => {
2154
+ return defaultSerializer.toJSON(data);
2155
+ };
2156
+ const deserialize = (json) => {
2157
+ return defaultSerializer.fromJSON(json);
2158
+ };
2159
+
2160
+ function buildWorkerRunner(config) {
2161
+ return function xataWorker(name, _worker) {
2162
+ return async (...args) => {
2163
+ const url = process.env.NODE_ENV === "development" ? `http://localhost:64749/${name}` : `https://dispatcher.xata.workers.dev/${config.workspace}/${config.worker}/${name}`;
2164
+ const result = await fetch(url, {
2165
+ method: "POST",
2166
+ headers: { "Content-Type": "application/json" },
2167
+ body: serialize({ args })
2168
+ });
2169
+ const text = await result.text();
2170
+ return deserialize(text);
2171
+ };
2172
+ };
2173
+ }
2174
+
2004
2175
  class XataError extends Error {
2005
2176
  constructor(message, status) {
2006
2177
  super(message);
@@ -2021,6 +2192,7 @@ exports.Repository = Repository;
2021
2192
  exports.RestRepository = RestRepository;
2022
2193
  exports.SchemaPlugin = SchemaPlugin;
2023
2194
  exports.SearchPlugin = SearchPlugin;
2195
+ exports.Serializer = Serializer;
2024
2196
  exports.SimpleCache = SimpleCache;
2025
2197
  exports.XataApiClient = XataApiClient;
2026
2198
  exports.XataApiPlugin = XataApiPlugin;
@@ -2030,6 +2202,7 @@ exports.acceptWorkspaceMemberInvite = acceptWorkspaceMemberInvite;
2030
2202
  exports.addGitBranchesEntry = addGitBranchesEntry;
2031
2203
  exports.addTableColumn = addTableColumn;
2032
2204
  exports.buildClient = buildClient;
2205
+ exports.buildWorkerRunner = buildWorkerRunner;
2033
2206
  exports.bulkInsertTableRecords = bulkInsertTableRecords;
2034
2207
  exports.cancelWorkspaceMemberInvite = cancelWorkspaceMemberInvite;
2035
2208
  exports.contains = contains;
@@ -2046,6 +2219,7 @@ exports.deleteTable = deleteTable;
2046
2219
  exports.deleteUser = deleteUser;
2047
2220
  exports.deleteUserAPIKey = deleteUserAPIKey;
2048
2221
  exports.deleteWorkspace = deleteWorkspace;
2222
+ exports.deserialize = deserialize;
2049
2223
  exports.endsWith = endsWith;
2050
2224
  exports.executeBranchMigrationPlan = executeBranchMigrationPlan;
2051
2225
  exports.exists = exists;
@@ -2061,6 +2235,7 @@ exports.getColumn = getColumn;
2061
2235
  exports.getCurrentBranchDetails = getCurrentBranchDetails;
2062
2236
  exports.getCurrentBranchName = getCurrentBranchName;
2063
2237
  exports.getDatabaseList = getDatabaseList;
2238
+ exports.getDatabaseMetadata = getDatabaseMetadata;
2064
2239
  exports.getDatabaseURL = getDatabaseURL;
2065
2240
  exports.getGitBranchesMapping = getGitBranchesMapping;
2066
2241
  exports.getRecord = getRecord;
@@ -2098,6 +2273,7 @@ exports.resendWorkspaceMemberInvite = resendWorkspaceMemberInvite;
2098
2273
  exports.resolveBranch = resolveBranch;
2099
2274
  exports.searchBranch = searchBranch;
2100
2275
  exports.searchTable = searchTable;
2276
+ exports.serialize = serialize;
2101
2277
  exports.setTableSchema = setTableSchema;
2102
2278
  exports.startsWith = startsWith;
2103
2279
  exports.updateBranchMetadata = updateBranchMetadata;
@@ -2106,6 +2282,7 @@ exports.updateRecordWithID = updateRecordWithID;
2106
2282
  exports.updateTable = updateTable;
2107
2283
  exports.updateUser = updateUser;
2108
2284
  exports.updateWorkspace = updateWorkspace;
2285
+ exports.updateWorkspaceMemberInvite = updateWorkspaceMemberInvite;
2109
2286
  exports.updateWorkspaceMemberRole = updateWorkspaceMemberRole;
2110
2287
  exports.upsertRecordWithID = upsertRecordWithID;
2111
2288
  //# sourceMappingURL=index.cjs.map