@xata.io/client 0.0.0-alpha.vf28813b → 0.0.0-alpha.vf2ed8b7

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
@@ -1,3 +1,25 @@
1
+ const defaultTrace = async (_name, fn, _options) => {
2
+ return await fn({
3
+ setAttributes: () => {
4
+ return;
5
+ }
6
+ });
7
+ };
8
+ const TraceAttributes = {
9
+ KIND: "xata.trace.kind",
10
+ VERSION: "xata.sdk.version",
11
+ TABLE: "xata.table",
12
+ HTTP_REQUEST_ID: "http.request_id",
13
+ HTTP_STATUS_CODE: "http.status_code",
14
+ HTTP_HOST: "http.host",
15
+ HTTP_SCHEME: "http.scheme",
16
+ HTTP_USER_AGENT: "http.user_agent",
17
+ HTTP_METHOD: "http.method",
18
+ HTTP_URL: "http.url",
19
+ HTTP_ROUTE: "http.route",
20
+ HTTP_TARGET: "http.target"
21
+ };
22
+
1
23
  function notEmpty(value) {
2
24
  return value !== null && value !== void 0;
3
25
  }
@@ -122,13 +144,13 @@ function getFetchImplementation(userFetch) {
122
144
  const fetchImpl = userFetch ?? globalFetch;
123
145
  if (!fetchImpl) {
124
146
  throw new Error(
125
- `The \`fetch\` option passed to the Xata client is resolving to a falsy value and may not be correctly imported.`
147
+ `Couldn't find \`fetch\`. Install a fetch implementation such as \`node-fetch\` and pass it explicitly.`
126
148
  );
127
149
  }
128
150
  return fetchImpl;
129
151
  }
130
152
 
131
- const VERSION = "0.0.0-alpha.vf28813b";
153
+ const VERSION = "0.0.0-alpha.vf2ed8b7";
132
154
 
133
155
  class ErrorWithCause extends Error {
134
156
  constructor(message, options) {
@@ -179,7 +201,10 @@ const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
179
201
  }, {});
180
202
  const query = new URLSearchParams(cleanQueryParams).toString();
181
203
  const queryString = query.length > 0 ? `?${query}` : "";
182
- return url.replace(/\{\w*\}/g, (key) => pathParams[key.slice(1, -1)]) + queryString;
204
+ const cleanPathParams = Object.entries(pathParams).reduce((acc, [key, value]) => {
205
+ return { ...acc, [key]: encodeURIComponent(value).replace("%3A", ":") };
206
+ }, {});
207
+ return url.replace(/\{\w*\}/g, (key) => cleanPathParams[key.slice(1, -1)]) + queryString;
183
208
  };
184
209
  function buildBaseUrl({
185
210
  path,
@@ -207,34 +232,61 @@ async function fetch$1({
207
232
  fetchImpl,
208
233
  apiKey,
209
234
  apiUrl,
210
- workspacesApiUrl
235
+ workspacesApiUrl,
236
+ trace
211
237
  }) {
212
- const baseUrl = buildBaseUrl({ path, workspacesApiUrl, pathParams, apiUrl });
213
- const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
214
- const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
215
- const response = await fetchImpl(url, {
216
- method: method.toUpperCase(),
217
- body: body ? JSON.stringify(body) : void 0,
218
- headers: {
219
- "Content-Type": "application/json",
220
- "User-Agent": `Xata client-ts/${VERSION}`,
221
- ...headers,
222
- ...hostHeader(fullUrl),
223
- Authorization: `Bearer ${apiKey}`
224
- }
225
- });
226
- if (response.status === 204) {
227
- return {};
228
- }
229
- const requestId = response.headers?.get("x-request-id") ?? void 0;
238
+ return trace(
239
+ `${method.toUpperCase()} ${path}`,
240
+ async ({ setAttributes }) => {
241
+ const baseUrl = buildBaseUrl({ path, workspacesApiUrl, pathParams, apiUrl });
242
+ const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
243
+ const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
244
+ setAttributes({
245
+ [TraceAttributes.HTTP_URL]: url,
246
+ [TraceAttributes.HTTP_TARGET]: resolveUrl(path, queryParams, pathParams)
247
+ });
248
+ const response = await fetchImpl(url, {
249
+ method: method.toUpperCase(),
250
+ body: body ? JSON.stringify(body) : void 0,
251
+ headers: {
252
+ "Content-Type": "application/json",
253
+ "User-Agent": `Xata client-ts/${VERSION}`,
254
+ ...headers,
255
+ ...hostHeader(fullUrl),
256
+ Authorization: `Bearer ${apiKey}`
257
+ }
258
+ });
259
+ if (response.status === 204) {
260
+ return {};
261
+ }
262
+ const { host, protocol } = parseUrl(response.url);
263
+ const requestId = response.headers?.get("x-request-id") ?? void 0;
264
+ setAttributes({
265
+ [TraceAttributes.KIND]: "http",
266
+ [TraceAttributes.HTTP_REQUEST_ID]: requestId,
267
+ [TraceAttributes.HTTP_STATUS_CODE]: response.status,
268
+ [TraceAttributes.HTTP_HOST]: host,
269
+ [TraceAttributes.HTTP_SCHEME]: protocol?.replace(":", "")
270
+ });
271
+ try {
272
+ const jsonResponse = await response.json();
273
+ if (response.ok) {
274
+ return jsonResponse;
275
+ }
276
+ throw new FetcherError(response.status, jsonResponse, requestId);
277
+ } catch (error) {
278
+ throw new FetcherError(response.status, error, requestId);
279
+ }
280
+ },
281
+ { [TraceAttributes.HTTP_METHOD]: method.toUpperCase(), [TraceAttributes.HTTP_ROUTE]: path }
282
+ );
283
+ }
284
+ function parseUrl(url) {
230
285
  try {
231
- const jsonResponse = await response.json();
232
- if (response.ok) {
233
- return jsonResponse;
234
- }
235
- throw new FetcherError(response.status, jsonResponse, requestId);
286
+ const { host, protocol } = new URL(url);
287
+ return { host, protocol };
236
288
  } catch (error) {
237
- throw new FetcherError(response.status, error, requestId);
289
+ return {};
238
290
  }
239
291
  }
240
292
 
@@ -472,6 +524,7 @@ const operationsByTag = {
472
524
  getDatabaseList,
473
525
  createDatabase,
474
526
  deleteDatabase,
527
+ getDatabaseMetadata,
475
528
  getGitBranchesMapping,
476
529
  addGitBranchesEntry,
477
530
  removeGitBranchesEntry,
@@ -479,7 +532,6 @@ const operationsByTag = {
479
532
  },
480
533
  branch: {
481
534
  getBranchList,
482
- getDatabaseMetadata,
483
535
  getBranchDetails,
484
536
  createBranch,
485
537
  deleteBranch,
@@ -517,9 +569,9 @@ const operationsByTag = {
517
569
  };
518
570
 
519
571
  function getHostUrl(provider, type) {
520
- if (isValidAlias(provider)) {
572
+ if (isHostProviderAlias(provider)) {
521
573
  return providers[provider][type];
522
- } else if (isValidBuilder(provider)) {
574
+ } else if (isHostProviderBuilder(provider)) {
523
575
  return provider[type];
524
576
  }
525
577
  throw new Error("Invalid API provider");
@@ -534,10 +586,10 @@ const providers = {
534
586
  workspaces: "https://{workspaceId}.staging.xatabase.co"
535
587
  }
536
588
  };
537
- function isValidAlias(alias) {
589
+ function isHostProviderAlias(alias) {
538
590
  return isString(alias) && Object.keys(providers).includes(alias);
539
591
  }
540
- function isValidBuilder(builder) {
592
+ function isHostProviderBuilder(builder) {
541
593
  return isObject(builder) && isString(builder.main) && isString(builder.workspaces);
542
594
  }
543
595
 
@@ -565,7 +617,8 @@ class XataApiClient {
565
617
  __privateAdd$7(this, _extraProps, void 0);
566
618
  __privateAdd$7(this, _namespaces, {});
567
619
  const provider = options.host ?? "production";
568
- const apiKey = options?.apiKey ?? getAPIKey();
620
+ const apiKey = options.apiKey ?? getAPIKey();
621
+ const trace = options.trace ?? defaultTrace;
569
622
  if (!apiKey) {
570
623
  throw new Error("Could not resolve a valid apiKey");
571
624
  }
@@ -573,7 +626,8 @@ class XataApiClient {
573
626
  apiUrl: getHostUrl(provider, "main"),
574
627
  workspacesApiUrl: getHostUrl(provider, "workspaces"),
575
628
  fetchImpl: getFetchImplementation(options.fetch),
576
- apiKey
629
+ apiKey,
630
+ trace
577
631
  });
578
632
  }
579
633
  get user() {
@@ -745,6 +799,12 @@ class DatabaseApi {
745
799
  ...this.extraProps
746
800
  });
747
801
  }
802
+ getDatabaseMetadata(workspace, dbName) {
803
+ return operationsByTag.database.getDatabaseMetadata({
804
+ pathParams: { workspace, dbName },
805
+ ...this.extraProps
806
+ });
807
+ }
748
808
  getGitBranchesMapping(workspace, dbName) {
749
809
  return operationsByTag.database.getGitBranchesMapping({
750
810
  pathParams: { workspace, dbName },
@@ -1176,15 +1236,23 @@ const _Query = class {
1176
1236
  }
1177
1237
  filter(a, b) {
1178
1238
  if (arguments.length === 1) {
1179
- const constraints = Object.entries(a).map(([column, constraint]) => ({ [column]: constraint }));
1239
+ const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({ [column]: constraint }));
1180
1240
  const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
1181
1241
  return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
1182
1242
  } else {
1183
- const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat([{ [a]: b }]));
1243
+ const constraints = isDefined(a) && isDefined(b) ? [{ [a]: this.defaultFilter(a, b) }] : void 0;
1244
+ const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
1184
1245
  return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
1185
1246
  }
1186
1247
  }
1187
- sort(column, direction) {
1248
+ defaultFilter(column, value) {
1249
+ const columnType = __privateGet$5(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
1250
+ if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
1251
+ return { $includes: value };
1252
+ }
1253
+ return value;
1254
+ }
1255
+ sort(column, direction = "asc") {
1188
1256
  const originalSort = [__privateGet$5(this, _data).sort ?? []].flat();
1189
1257
  const sort = [...originalSort, { column, direction }];
1190
1258
  return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { sort }, __privateGet$5(this, _data));
@@ -1320,12 +1388,16 @@ var __privateMethod$2 = (obj, member, method) => {
1320
1388
  __accessCheck$4(obj, member, "access private method");
1321
1389
  return method;
1322
1390
  };
1323
- var _table, _getFetchProps, _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;
1391
+ var _table, _getFetchProps, _db, _cache, _schemaTables$2, _trace, _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;
1324
1392
  class Repository extends Query {
1325
1393
  }
1326
1394
  class RestRepository extends Query {
1327
1395
  constructor(options) {
1328
- super(null, options.table, {});
1396
+ super(
1397
+ null,
1398
+ { name: options.table, schema: options.schemaTables?.find((table) => table.name === options.table) },
1399
+ {}
1400
+ );
1329
1401
  __privateAdd$4(this, _insertRecordWithoutId);
1330
1402
  __privateAdd$4(this, _insertRecordWithId);
1331
1403
  __privateAdd$4(this, _bulkInsertTableRecords);
@@ -1337,176 +1409,205 @@ class RestRepository extends Query {
1337
1409
  __privateAdd$4(this, _getSchemaTables$1);
1338
1410
  __privateAdd$4(this, _table, void 0);
1339
1411
  __privateAdd$4(this, _getFetchProps, void 0);
1412
+ __privateAdd$4(this, _db, void 0);
1340
1413
  __privateAdd$4(this, _cache, void 0);
1341
1414
  __privateAdd$4(this, _schemaTables$2, void 0);
1415
+ __privateAdd$4(this, _trace, void 0);
1342
1416
  __privateSet$4(this, _table, options.table);
1343
1417
  __privateSet$4(this, _getFetchProps, options.pluginOptions.getFetchProps);
1344
- this.db = options.db;
1418
+ __privateSet$4(this, _db, options.db);
1345
1419
  __privateSet$4(this, _cache, options.pluginOptions.cache);
1346
1420
  __privateSet$4(this, _schemaTables$2, options.schemaTables);
1421
+ const trace = options.pluginOptions.trace ?? defaultTrace;
1422
+ __privateSet$4(this, _trace, async (name, fn, options2 = {}) => {
1423
+ return trace(name, fn, {
1424
+ ...options2,
1425
+ [TraceAttributes.TABLE]: __privateGet$4(this, _table),
1426
+ [TraceAttributes.KIND]: "sdk-operation",
1427
+ [TraceAttributes.VERSION]: VERSION
1428
+ });
1429
+ });
1347
1430
  }
1348
1431
  async create(a, b, c) {
1349
- if (Array.isArray(a)) {
1350
- if (a.length === 0)
1351
- return [];
1352
- const columns = isStringArray(b) ? b : void 0;
1353
- return __privateMethod$2(this, _bulkInsertTableRecords, bulkInsertTableRecords_fn).call(this, a, columns);
1354
- }
1355
- if (isString(a) && isObject(b)) {
1356
- if (a === "")
1357
- throw new Error("The id can't be empty");
1358
- const columns = isStringArray(c) ? c : void 0;
1359
- return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns);
1360
- }
1361
- if (isObject(a) && isString(a.id)) {
1362
- if (a.id === "")
1363
- throw new Error("The id can't be empty");
1364
- const columns = isStringArray(b) ? b : void 0;
1365
- return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns);
1366
- }
1367
- if (isObject(a)) {
1368
- const columns = isStringArray(b) ? b : void 0;
1369
- return __privateMethod$2(this, _insertRecordWithoutId, insertRecordWithoutId_fn).call(this, a, columns);
1370
- }
1371
- throw new Error("Invalid arguments for create method");
1432
+ return __privateGet$4(this, _trace).call(this, "create", async () => {
1433
+ if (Array.isArray(a)) {
1434
+ if (a.length === 0)
1435
+ return [];
1436
+ const columns = isStringArray(b) ? b : void 0;
1437
+ return __privateMethod$2(this, _bulkInsertTableRecords, bulkInsertTableRecords_fn).call(this, a, columns);
1438
+ }
1439
+ if (isString(a) && isObject(b)) {
1440
+ if (a === "")
1441
+ throw new Error("The id can't be empty");
1442
+ const columns = isStringArray(c) ? c : void 0;
1443
+ return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns);
1444
+ }
1445
+ if (isObject(a) && isString(a.id)) {
1446
+ if (a.id === "")
1447
+ throw new Error("The id can't be empty");
1448
+ const columns = isStringArray(b) ? b : void 0;
1449
+ return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns);
1450
+ }
1451
+ if (isObject(a)) {
1452
+ const columns = isStringArray(b) ? b : void 0;
1453
+ return __privateMethod$2(this, _insertRecordWithoutId, insertRecordWithoutId_fn).call(this, a, columns);
1454
+ }
1455
+ throw new Error("Invalid arguments for create method");
1456
+ });
1372
1457
  }
1373
1458
  async read(a, b) {
1374
- const columns = isStringArray(b) ? b : ["*"];
1375
- if (Array.isArray(a)) {
1376
- if (a.length === 0)
1377
- return [];
1378
- const ids = a.map((item) => isString(item) ? item : item.id).filter((id2) => isString(id2));
1379
- const finalObjects = await this.getAll({ filter: { id: { $any: ids } }, columns });
1380
- const dictionary = finalObjects.reduce((acc, object) => {
1381
- acc[object.id] = object;
1382
- return acc;
1383
- }, {});
1384
- return ids.map((id2) => dictionary[id2] ?? null);
1385
- }
1386
- const id = isString(a) ? a : a.id;
1387
- if (isString(id)) {
1388
- const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1389
- try {
1390
- const response = await getRecord({
1391
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table), recordId: id },
1392
- queryParams: { columns },
1393
- ...fetchProps
1394
- });
1395
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
1396
- return initObject(this.db, schemaTables, __privateGet$4(this, _table), response);
1397
- } catch (e) {
1398
- if (isObject(e) && e.status === 404) {
1399
- return null;
1459
+ return __privateGet$4(this, _trace).call(this, "read", async () => {
1460
+ const columns = isStringArray(b) ? b : ["*"];
1461
+ if (Array.isArray(a)) {
1462
+ if (a.length === 0)
1463
+ return [];
1464
+ const ids = a.map((item) => extractId(item));
1465
+ const finalObjects = await this.getAll({ filter: { id: { $any: compact(ids) } }, columns });
1466
+ const dictionary = finalObjects.reduce((acc, object) => {
1467
+ acc[object.id] = object;
1468
+ return acc;
1469
+ }, {});
1470
+ return ids.map((id2) => dictionary[id2 ?? ""] ?? null);
1471
+ }
1472
+ const id = extractId(a);
1473
+ if (id) {
1474
+ const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1475
+ try {
1476
+ const response = await getRecord({
1477
+ pathParams: {
1478
+ workspace: "{workspaceId}",
1479
+ dbBranchName: "{dbBranch}",
1480
+ tableName: __privateGet$4(this, _table),
1481
+ recordId: id
1482
+ },
1483
+ queryParams: { columns },
1484
+ ...fetchProps
1485
+ });
1486
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
1487
+ return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
1488
+ } catch (e) {
1489
+ if (isObject(e) && e.status === 404) {
1490
+ return null;
1491
+ }
1492
+ throw e;
1400
1493
  }
1401
- throw e;
1402
1494
  }
1403
- }
1404
- return null;
1495
+ return null;
1496
+ });
1405
1497
  }
1406
1498
  async update(a, b, c) {
1407
- if (Array.isArray(a)) {
1408
- if (a.length === 0)
1409
- return [];
1410
- if (a.length > 100) {
1411
- console.warn("Bulk update operation is not optimized in the Xata API yet, this request might be slow");
1499
+ return __privateGet$4(this, _trace).call(this, "update", async () => {
1500
+ if (Array.isArray(a)) {
1501
+ if (a.length === 0)
1502
+ return [];
1503
+ if (a.length > 100) {
1504
+ console.warn("Bulk update operation is not optimized in the Xata API yet, this request might be slow");
1505
+ }
1506
+ const columns = isStringArray(b) ? b : ["*"];
1507
+ return Promise.all(a.map((object) => this.update(object, columns)));
1412
1508
  }
1413
- const columns = isStringArray(b) ? b : ["*"];
1414
- return Promise.all(a.map((object) => this.update(object, columns)));
1415
- }
1416
- if (isString(a) && isObject(b)) {
1417
- const columns = isStringArray(c) ? c : void 0;
1418
- return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns);
1419
- }
1420
- if (isObject(a) && isString(a.id)) {
1421
- const columns = isStringArray(b) ? b : void 0;
1422
- return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
1423
- }
1424
- throw new Error("Invalid arguments for update method");
1509
+ if (isString(a) && isObject(b)) {
1510
+ const columns = isStringArray(c) ? c : void 0;
1511
+ return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns);
1512
+ }
1513
+ if (isObject(a) && isString(a.id)) {
1514
+ const columns = isStringArray(b) ? b : void 0;
1515
+ return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
1516
+ }
1517
+ throw new Error("Invalid arguments for update method");
1518
+ });
1425
1519
  }
1426
1520
  async createOrUpdate(a, b, c) {
1427
- if (Array.isArray(a)) {
1428
- if (a.length === 0)
1429
- return [];
1430
- if (a.length > 100) {
1431
- console.warn("Bulk update operation is not optimized in the Xata API yet, this request might be slow");
1521
+ return __privateGet$4(this, _trace).call(this, "createOrUpdate", async () => {
1522
+ if (Array.isArray(a)) {
1523
+ if (a.length === 0)
1524
+ return [];
1525
+ if (a.length > 100) {
1526
+ console.warn("Bulk update operation is not optimized in the Xata API yet, this request might be slow");
1527
+ }
1528
+ const columns = isStringArray(b) ? b : ["*"];
1529
+ return Promise.all(a.map((object) => this.createOrUpdate(object, columns)));
1432
1530
  }
1433
- const columns = isStringArray(b) ? b : ["*"];
1434
- return Promise.all(a.map((object) => this.createOrUpdate(object, columns)));
1435
- }
1436
- if (isString(a) && isObject(b)) {
1437
- const columns = isStringArray(c) ? c : void 0;
1438
- return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns);
1439
- }
1440
- if (isObject(a) && isString(a.id)) {
1441
- const columns = isStringArray(c) ? c : void 0;
1442
- return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
1443
- }
1444
- throw new Error("Invalid arguments for createOrUpdate method");
1445
- }
1446
- async delete(a) {
1447
- if (Array.isArray(a)) {
1448
- if (a.length === 0)
1449
- return;
1450
- if (a.length > 100) {
1451
- console.warn("Bulk delete operation is not optimized in the Xata API yet, this request might be slow");
1531
+ if (isString(a) && isObject(b)) {
1532
+ const columns = isStringArray(c) ? c : void 0;
1533
+ return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns);
1452
1534
  }
1453
- await Promise.all(a.map((id) => this.delete(id)));
1454
- return;
1455
- }
1456
- if (isString(a)) {
1457
- await __privateMethod$2(this, _deleteRecord, deleteRecord_fn).call(this, a);
1458
- return;
1459
- }
1460
- if (isObject(a) && isString(a.id)) {
1461
- await __privateMethod$2(this, _deleteRecord, deleteRecord_fn).call(this, a.id);
1462
- return;
1463
- }
1464
- throw new Error("Invalid arguments for delete method");
1535
+ if (isObject(a) && isString(a.id)) {
1536
+ const columns = isStringArray(c) ? c : void 0;
1537
+ return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
1538
+ }
1539
+ throw new Error("Invalid arguments for createOrUpdate method");
1540
+ });
1541
+ }
1542
+ async delete(a, b) {
1543
+ return __privateGet$4(this, _trace).call(this, "delete", async () => {
1544
+ if (Array.isArray(a)) {
1545
+ if (a.length === 0)
1546
+ return [];
1547
+ if (a.length > 100) {
1548
+ console.warn("Bulk delete operation is not optimized in the Xata API yet, this request might be slow");
1549
+ }
1550
+ return Promise.all(a.map((id) => this.delete(id, b)));
1551
+ }
1552
+ if (isString(a)) {
1553
+ return __privateMethod$2(this, _deleteRecord, deleteRecord_fn).call(this, a, b);
1554
+ }
1555
+ if (isObject(a) && isString(a.id)) {
1556
+ return __privateMethod$2(this, _deleteRecord, deleteRecord_fn).call(this, a.id, b);
1557
+ }
1558
+ throw new Error("Invalid arguments for delete method");
1559
+ });
1465
1560
  }
1466
1561
  async search(query, options = {}) {
1467
- const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1468
- const { records } = await searchTable({
1469
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table) },
1470
- body: {
1471
- query,
1472
- fuzziness: options.fuzziness,
1473
- prefix: options.prefix,
1474
- highlight: options.highlight,
1475
- filter: options.filter,
1476
- boosters: options.boosters
1477
- },
1478
- ...fetchProps
1562
+ return __privateGet$4(this, _trace).call(this, "search", async () => {
1563
+ const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1564
+ const { records } = await searchTable({
1565
+ pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table) },
1566
+ body: {
1567
+ query,
1568
+ fuzziness: options.fuzziness,
1569
+ prefix: options.prefix,
1570
+ highlight: options.highlight,
1571
+ filter: options.filter,
1572
+ boosters: options.boosters
1573
+ },
1574
+ ...fetchProps
1575
+ });
1576
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
1577
+ return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item));
1479
1578
  });
1480
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
1481
- return records.map((item) => initObject(this.db, schemaTables, __privateGet$4(this, _table), item));
1482
1579
  }
1483
1580
  async query(query) {
1484
- const cacheQuery = await __privateMethod$2(this, _getCacheQuery, getCacheQuery_fn).call(this, query);
1485
- if (cacheQuery)
1486
- return new Page(query, cacheQuery.meta, cacheQuery.records);
1487
- const data = query.getQueryOptions();
1488
- const body = {
1489
- filter: Object.values(data.filter ?? {}).some(Boolean) ? data.filter : void 0,
1490
- sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
1491
- page: data.pagination,
1492
- columns: data.columns
1493
- };
1494
- const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1495
- const { meta, records: objects } = await queryTable({
1496
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table) },
1497
- body,
1498
- ...fetchProps
1581
+ return __privateGet$4(this, _trace).call(this, "query", async () => {
1582
+ const cacheQuery = await __privateMethod$2(this, _getCacheQuery, getCacheQuery_fn).call(this, query);
1583
+ if (cacheQuery)
1584
+ return new Page(query, cacheQuery.meta, cacheQuery.records);
1585
+ const data = query.getQueryOptions();
1586
+ const body = {
1587
+ filter: cleanFilter(data.filter),
1588
+ sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
1589
+ page: data.pagination,
1590
+ columns: data.columns
1591
+ };
1592
+ const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1593
+ const { meta, records: objects } = await queryTable({
1594
+ pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table) },
1595
+ body,
1596
+ ...fetchProps
1597
+ });
1598
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
1599
+ const records = objects.map((record) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), record));
1600
+ await __privateMethod$2(this, _setCacheQuery, setCacheQuery_fn).call(this, query, meta, records);
1601
+ return new Page(query, meta, records);
1499
1602
  });
1500
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
1501
- const records = objects.map((record) => initObject(this.db, schemaTables, __privateGet$4(this, _table), record));
1502
- await __privateMethod$2(this, _setCacheQuery, setCacheQuery_fn).call(this, query, meta, records);
1503
- return new Page(query, meta, records);
1504
1603
  }
1505
1604
  }
1506
1605
  _table = new WeakMap();
1507
1606
  _getFetchProps = new WeakMap();
1607
+ _db = new WeakMap();
1508
1608
  _cache = new WeakMap();
1509
1609
  _schemaTables$2 = new WeakMap();
1610
+ _trace = new WeakMap();
1510
1611
  _insertRecordWithoutId = new WeakSet();
1511
1612
  insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
1512
1613
  const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
@@ -1522,7 +1623,7 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
1522
1623
  ...fetchProps
1523
1624
  });
1524
1625
  const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
1525
- return initObject(this.db, schemaTables, __privateGet$4(this, _table), response);
1626
+ return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
1526
1627
  };
1527
1628
  _insertRecordWithId = new WeakSet();
1528
1629
  insertRecordWithId_fn = async function(recordId, object, columns = ["*"]) {
@@ -1540,7 +1641,7 @@ insertRecordWithId_fn = async function(recordId, object, columns = ["*"]) {
1540
1641
  ...fetchProps
1541
1642
  });
1542
1643
  const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
1543
- return initObject(this.db, schemaTables, __privateGet$4(this, _table), response);
1644
+ return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
1544
1645
  };
1545
1646
  _bulkInsertTableRecords = new WeakSet();
1546
1647
  bulkInsertTableRecords_fn = async function(objects, columns = ["*"]) {
@@ -1556,20 +1657,27 @@ bulkInsertTableRecords_fn = async function(objects, columns = ["*"]) {
1556
1657
  throw new Error("Request included columns but server didn't include them");
1557
1658
  }
1558
1659
  const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
1559
- return response.records?.map((item) => initObject(this.db, schemaTables, __privateGet$4(this, _table), item));
1660
+ return response.records?.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item));
1560
1661
  };
1561
1662
  _updateRecordWithID = new WeakSet();
1562
1663
  updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
1563
1664
  const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1564
1665
  const record = transformObjectLinks(object);
1565
- const response = await updateRecordWithID({
1566
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table), recordId },
1567
- queryParams: { columns },
1568
- body: record,
1569
- ...fetchProps
1570
- });
1571
- const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
1572
- return initObject(this.db, schemaTables, __privateGet$4(this, _table), response);
1666
+ try {
1667
+ const response = await updateRecordWithID({
1668
+ pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table), recordId },
1669
+ queryParams: { columns },
1670
+ body: record,
1671
+ ...fetchProps
1672
+ });
1673
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
1674
+ return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
1675
+ } catch (e) {
1676
+ if (isObject(e) && e.status === 404) {
1677
+ return null;
1678
+ }
1679
+ throw e;
1680
+ }
1573
1681
  };
1574
1682
  _upsertRecordWithID = new WeakSet();
1575
1683
  upsertRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
@@ -1581,15 +1689,25 @@ upsertRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
1581
1689
  ...fetchProps
1582
1690
  });
1583
1691
  const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
1584
- return initObject(this.db, schemaTables, __privateGet$4(this, _table), response);
1692
+ return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
1585
1693
  };
1586
1694
  _deleteRecord = new WeakSet();
1587
- deleteRecord_fn = async function(recordId) {
1695
+ deleteRecord_fn = async function(recordId, columns = ["*"]) {
1588
1696
  const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1589
- await deleteRecord({
1590
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table), recordId },
1591
- ...fetchProps
1592
- });
1697
+ try {
1698
+ const response = await deleteRecord({
1699
+ pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table), recordId },
1700
+ queryParams: { columns },
1701
+ ...fetchProps
1702
+ });
1703
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
1704
+ return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
1705
+ } catch (e) {
1706
+ if (isObject(e) && e.status === 404) {
1707
+ return null;
1708
+ }
1709
+ throw e;
1710
+ }
1593
1711
  };
1594
1712
  _setCacheQuery = new WeakSet();
1595
1713
  setCacheQuery_fn = async function(query, meta, records) {
@@ -1677,6 +1795,19 @@ const initObject = (db, schemaTables, table, object) => {
1677
1795
  function isResponseWithRecords(value) {
1678
1796
  return isObject(value) && Array.isArray(value.records);
1679
1797
  }
1798
+ function extractId(value) {
1799
+ if (isString(value))
1800
+ return value;
1801
+ if (isObject(value) && isString(value.id))
1802
+ return value.id;
1803
+ return void 0;
1804
+ }
1805
+ function cleanFilter(filter) {
1806
+ if (!filter)
1807
+ return void 0;
1808
+ const values = Object.values(filter).filter(Boolean).filter((value) => Array.isArray(value) ? value.length > 0 : true);
1809
+ return values.length > 0 ? filter : void 0;
1810
+ }
1680
1811
 
1681
1812
  var __accessCheck$3 = (obj, member, msg) => {
1682
1813
  if (!member.has(obj))
@@ -1727,18 +1858,25 @@ class SimpleCache {
1727
1858
  }
1728
1859
  _map = new WeakMap();
1729
1860
 
1730
- const gt = (value) => ({ $gt: value });
1731
- const ge = (value) => ({ $ge: value });
1732
- const gte = (value) => ({ $ge: value });
1733
- const lt = (value) => ({ $lt: value });
1734
- const lte = (value) => ({ $le: value });
1735
- const le = (value) => ({ $le: value });
1861
+ const greaterThan = (value) => ({ $gt: value });
1862
+ const gt = greaterThan;
1863
+ const greaterThanEquals = (value) => ({ $ge: value });
1864
+ const greaterEquals = greaterThanEquals;
1865
+ const gte = greaterThanEquals;
1866
+ const ge = greaterThanEquals;
1867
+ const lessThan = (value) => ({ $lt: value });
1868
+ const lt = lessThan;
1869
+ const lessThanEquals = (value) => ({ $le: value });
1870
+ const lessEquals = lessThanEquals;
1871
+ const lte = lessThanEquals;
1872
+ const le = lessThanEquals;
1736
1873
  const exists = (column) => ({ $exists: column });
1737
1874
  const notExists = (column) => ({ $notExists: column });
1738
1875
  const startsWith = (value) => ({ $startsWith: value });
1739
1876
  const endsWith = (value) => ({ $endsWith: value });
1740
1877
  const pattern = (value) => ({ $pattern: value });
1741
1878
  const is = (value) => ({ $is: value });
1879
+ const equals = is;
1742
1880
  const isNot = (value) => ({ $isNot: value });
1743
1881
  const contains = (value) => ({ $contains: value });
1744
1882
  const includes = (value) => ({ $includes: value });
@@ -1915,7 +2053,8 @@ async function resolveXataBranch(gitBranch, options) {
1915
2053
  fetchImpl: getFetchImplementation(options?.fetchImpl),
1916
2054
  workspacesApiUrl: `${protocol}//${host}`,
1917
2055
  pathParams: { dbName, workspace },
1918
- queryParams: { gitBranch, fallbackBranch }
2056
+ queryParams: { gitBranch, fallbackBranch },
2057
+ trace: defaultTrace
1919
2058
  });
1920
2059
  return branch;
1921
2060
  }
@@ -1939,7 +2078,8 @@ async function getDatabaseBranch(branch, options) {
1939
2078
  apiUrl: databaseURL,
1940
2079
  fetchImpl: getFetchImplementation(options?.fetchImpl),
1941
2080
  workspacesApiUrl: `${protocol}//${host}`,
1942
- pathParams: { dbBranchName, workspace }
2081
+ pathParams: { dbBranchName, workspace },
2082
+ trace: defaultTrace
1943
2083
  });
1944
2084
  } catch (err) {
1945
2085
  if (isObject(err) && err.status === 404)
@@ -1979,17 +2119,20 @@ var __privateMethod = (obj, member, method) => {
1979
2119
  return method;
1980
2120
  };
1981
2121
  const buildClient = (plugins) => {
1982
- var _branch, _parseOptions, parseOptions_fn, _getFetchProps, getFetchProps_fn, _evaluateBranch, evaluateBranch_fn, _a;
2122
+ var _branch, _options, _parseOptions, parseOptions_fn, _getFetchProps, getFetchProps_fn, _evaluateBranch, evaluateBranch_fn, _a;
1983
2123
  return _a = class {
1984
2124
  constructor(options = {}, schemaTables) {
1985
2125
  __privateAdd(this, _parseOptions);
1986
2126
  __privateAdd(this, _getFetchProps);
1987
2127
  __privateAdd(this, _evaluateBranch);
1988
2128
  __privateAdd(this, _branch, void 0);
2129
+ __privateAdd(this, _options, void 0);
1989
2130
  const safeOptions = __privateMethod(this, _parseOptions, parseOptions_fn).call(this, options);
2131
+ __privateSet(this, _options, safeOptions);
1990
2132
  const pluginOptions = {
1991
2133
  getFetchProps: () => __privateMethod(this, _getFetchProps, getFetchProps_fn).call(this, safeOptions),
1992
- cache: safeOptions.cache
2134
+ cache: safeOptions.cache,
2135
+ trace: safeOptions.trace
1993
2136
  };
1994
2137
  const db = new SchemaPlugin(schemaTables).build(pluginOptions);
1995
2138
  const search = new SearchPlugin(db, schemaTables).build(pluginOptions);
@@ -2008,22 +2151,26 @@ const buildClient = (plugins) => {
2008
2151
  }
2009
2152
  }
2010
2153
  }
2011
- }, _branch = new WeakMap(), _parseOptions = new WeakSet(), parseOptions_fn = function(options) {
2154
+ async getConfig() {
2155
+ const databaseURL = __privateGet(this, _options).databaseURL;
2156
+ const branch = await __privateGet(this, _options).branch();
2157
+ return { databaseURL, branch };
2158
+ }
2159
+ }, _branch = new WeakMap(), _options = new WeakMap(), _parseOptions = new WeakSet(), parseOptions_fn = function(options) {
2012
2160
  const fetch = getFetchImplementation(options?.fetch);
2013
2161
  const databaseURL = options?.databaseURL || getDatabaseURL();
2014
2162
  const apiKey = options?.apiKey || getAPIKey();
2015
2163
  const cache = options?.cache ?? new SimpleCache({ defaultQueryTTL: 0 });
2164
+ const trace = options?.trace ?? defaultTrace;
2016
2165
  const branch = async () => options?.branch !== void 0 ? await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, options.branch) : await getCurrentBranchName({ apiKey, databaseURL, fetchImpl: options?.fetch });
2017
- if (!databaseURL || !apiKey) {
2018
- throw new Error("Options databaseURL and apiKey are required");
2166
+ if (!apiKey) {
2167
+ throw new Error("Option apiKey is required");
2019
2168
  }
2020
- return { fetch, databaseURL, apiKey, branch, cache };
2021
- }, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({
2022
- fetch,
2023
- apiKey,
2024
- databaseURL,
2025
- branch
2026
- }) {
2169
+ if (!databaseURL) {
2170
+ throw new Error("Option databaseURL is required");
2171
+ }
2172
+ return { fetch, databaseURL, apiKey, branch, cache, trace };
2173
+ }, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({ fetch, apiKey, databaseURL, branch, trace }) {
2027
2174
  const branchValue = await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, branch);
2028
2175
  if (!branchValue)
2029
2176
  throw new Error("Unable to resolve branch value");
@@ -2035,7 +2182,8 @@ const buildClient = (plugins) => {
2035
2182
  const hasBranch = params.dbBranchName ?? params.branch;
2036
2183
  const newPath = path.replace(/^\/db\/[^/]+/, hasBranch ? `:${branchValue}` : "");
2037
2184
  return databaseURL + newPath;
2038
- }
2185
+ },
2186
+ trace
2039
2187
  };
2040
2188
  }, _evaluateBranch = new WeakSet(), evaluateBranch_fn = async function(param) {
2041
2189
  if (__privateGet(this, _branch))
@@ -2058,6 +2206,88 @@ const buildClient = (plugins) => {
2058
2206
  class BaseClient extends buildClient() {
2059
2207
  }
2060
2208
 
2209
+ const META = "__";
2210
+ const VALUE = "___";
2211
+ class Serializer {
2212
+ constructor() {
2213
+ this.classes = {};
2214
+ }
2215
+ add(clazz) {
2216
+ this.classes[clazz.name] = clazz;
2217
+ }
2218
+ toJSON(data) {
2219
+ function visit(obj) {
2220
+ if (Array.isArray(obj))
2221
+ return obj.map(visit);
2222
+ const type = typeof obj;
2223
+ if (type === "undefined")
2224
+ return { [META]: "undefined" };
2225
+ if (type === "bigint")
2226
+ return { [META]: "bigint", [VALUE]: obj.toString() };
2227
+ if (obj === null || type !== "object")
2228
+ return obj;
2229
+ const constructor = obj.constructor;
2230
+ const o = { [META]: constructor.name };
2231
+ for (const [key, value] of Object.entries(obj)) {
2232
+ o[key] = visit(value);
2233
+ }
2234
+ if (constructor === Date)
2235
+ o[VALUE] = obj.toISOString();
2236
+ if (constructor === Map)
2237
+ o[VALUE] = Object.fromEntries(obj);
2238
+ if (constructor === Set)
2239
+ o[VALUE] = [...obj];
2240
+ return o;
2241
+ }
2242
+ return JSON.stringify(visit(data));
2243
+ }
2244
+ fromJSON(json) {
2245
+ return JSON.parse(json, (key, value) => {
2246
+ if (value && typeof value === "object" && !Array.isArray(value)) {
2247
+ const { [META]: clazz, [VALUE]: val, ...rest } = value;
2248
+ const constructor = this.classes[clazz];
2249
+ if (constructor) {
2250
+ return Object.assign(Object.create(constructor.prototype), rest);
2251
+ }
2252
+ if (clazz === "Date")
2253
+ return new Date(val);
2254
+ if (clazz === "Set")
2255
+ return new Set(val);
2256
+ if (clazz === "Map")
2257
+ return new Map(Object.entries(val));
2258
+ if (clazz === "bigint")
2259
+ return BigInt(val);
2260
+ if (clazz === "undefined")
2261
+ return void 0;
2262
+ return rest;
2263
+ }
2264
+ return value;
2265
+ });
2266
+ }
2267
+ }
2268
+ const defaultSerializer = new Serializer();
2269
+ const serialize = (data) => {
2270
+ return defaultSerializer.toJSON(data);
2271
+ };
2272
+ const deserialize = (json) => {
2273
+ return defaultSerializer.fromJSON(json);
2274
+ };
2275
+
2276
+ function buildWorkerRunner(config) {
2277
+ return function xataWorker(name, _worker) {
2278
+ return async (...args) => {
2279
+ const url = process.env.NODE_ENV === "development" ? `http://localhost:64749/${name}` : `https://dispatcher.xata.workers.dev/${config.workspace}/${config.worker}/${name}`;
2280
+ const result = await fetch(url, {
2281
+ method: "POST",
2282
+ headers: { "Content-Type": "application/json" },
2283
+ body: serialize({ args })
2284
+ });
2285
+ const text = await result.text();
2286
+ return deserialize(text);
2287
+ };
2288
+ };
2289
+ }
2290
+
2061
2291
  class XataError extends Error {
2062
2292
  constructor(message, status) {
2063
2293
  super(message);
@@ -2065,5 +2295,5 @@ class XataError extends Error {
2065
2295
  }
2066
2296
  }
2067
2297
 
2068
- export { BaseClient, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, 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, getDatabaseMetadata, getDatabaseURL, getGitBranchesMapping, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isIdentifiable, isNot, isXataRecord, le, lt, lte, notExists, operationsByTag, pattern, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };
2298
+ export { BaseClient, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, Repository, RestRepository, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, XataApiClient, XataApiPlugin, XataError, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, buildClient, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, contains, createBranch, createDatabase, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getGitBranchesMapping, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isIdentifiable, isNot, isXataRecord, le, lessEquals, lessThan, lessThanEquals, lt, lte, notExists, operationsByTag, pattern, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };
2069
2299
  //# sourceMappingURL=index.mjs.map