@xata.io/client 0.0.0-alpha.vfbe46c7 → 0.0.0-alpha.vfc52d85

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
@@ -38,6 +38,9 @@ function isString(value) {
38
38
  function isStringArray(value) {
39
39
  return isDefined(value) && Array.isArray(value) && value.every(isString);
40
40
  }
41
+ function isNumber(value) {
42
+ return isDefined(value) && typeof value === "number";
43
+ }
41
44
  function toBase64(value) {
42
45
  try {
43
46
  return btoa(value);
@@ -46,6 +49,17 @@ function toBase64(value) {
46
49
  return buf.from(value).toString("base64");
47
50
  }
48
51
  }
52
+ function deepMerge(a, b) {
53
+ const result = { ...a };
54
+ for (const [key, value] of Object.entries(b)) {
55
+ if (isObject(value) && isObject(result[key])) {
56
+ result[key] = deepMerge(result[key], value);
57
+ } else {
58
+ result[key] = value;
59
+ }
60
+ }
61
+ return result;
62
+ }
49
63
 
50
64
  function getEnvironment() {
51
65
  try {
@@ -150,7 +164,7 @@ function getFetchImplementation(userFetch) {
150
164
  return fetchImpl;
151
165
  }
152
166
 
153
- const VERSION = "0.0.0-alpha.vfbe46c7";
167
+ const VERSION = "0.0.0-alpha.vfc52d85";
154
168
 
155
169
  class ErrorWithCause extends Error {
156
170
  constructor(message, options) {
@@ -207,15 +221,18 @@ const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
207
221
  return url.replace(/\{\w*\}/g, (key) => cleanPathParams[key.slice(1, -1)]) + queryString;
208
222
  };
209
223
  function buildBaseUrl({
224
+ endpoint,
210
225
  path,
211
226
  workspacesApiUrl,
212
227
  apiUrl,
213
- pathParams
228
+ pathParams = {}
214
229
  }) {
215
- if (pathParams?.workspace === void 0)
216
- return `${apiUrl}${path}`;
217
- const url = typeof workspacesApiUrl === "string" ? `${workspacesApiUrl}${path}` : workspacesApiUrl(path, pathParams);
218
- return url.replace("{workspaceId}", String(pathParams.workspace));
230
+ if (endpoint === "dataPlane") {
231
+ const url = isString(workspacesApiUrl) ? `${workspacesApiUrl}${path}` : workspacesApiUrl(path, pathParams);
232
+ const urlWithWorkspace = isString(pathParams.workspace) ? url.replace("{workspaceId}", String(pathParams.workspace)) : url;
233
+ return isString(pathParams.region) ? urlWithWorkspace.replace("{region}", String(pathParams.region)) : urlWithWorkspace;
234
+ }
235
+ return `${apiUrl}${path}`;
219
236
  }
220
237
  function hostHeader(url) {
221
238
  const pattern = /.*:\/\/(?<host>[^/]+).*/;
@@ -231,15 +248,18 @@ async function fetch$1({
231
248
  queryParams,
232
249
  fetchImpl,
233
250
  apiKey,
251
+ endpoint,
234
252
  apiUrl,
235
253
  workspacesApiUrl,
236
254
  trace,
237
- signal
255
+ signal,
256
+ clientID,
257
+ sessionID
238
258
  }) {
239
259
  return trace(
240
260
  `${method.toUpperCase()} ${path}`,
241
261
  async ({ setAttributes }) => {
242
- const baseUrl = buildBaseUrl({ path, workspacesApiUrl, pathParams, apiUrl });
262
+ const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
243
263
  const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
244
264
  const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
245
265
  setAttributes({
@@ -252,6 +272,8 @@ async function fetch$1({
252
272
  headers: {
253
273
  "Content-Type": "application/json",
254
274
  "User-Agent": `Xata client-ts/${VERSION}`,
275
+ "X-Xata-Client-ID": clientID ?? "",
276
+ "X-Xata-Session-ID": sessionID ?? "",
255
277
  ...headers,
256
278
  ...hostHeader(fullUrl),
257
279
  Authorization: `Bearer ${apiKey}`
@@ -292,390 +314,357 @@ function parseUrl(url) {
292
314
  }
293
315
  }
294
316
 
295
- const getUser = (variables, signal) => fetch$1({ url: "/user", method: "get", ...variables, signal });
296
- const updateUser = (variables, signal) => fetch$1({
297
- url: "/user",
298
- method: "put",
299
- ...variables,
300
- signal
301
- });
302
- const deleteUser = (variables, signal) => fetch$1({ url: "/user", method: "delete", ...variables, signal });
303
- const getUserAPIKeys = (variables, signal) => fetch$1({
304
- url: "/user/keys",
317
+ const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
318
+
319
+ const dEPRECATEDgetDatabaseList = (variables, signal) => dataPlaneFetch({ url: "/dbs", method: "get", ...variables, signal });
320
+ const getBranchList = (variables, signal) => dataPlaneFetch({
321
+ url: "/dbs/{dbName}",
305
322
  method: "get",
306
323
  ...variables,
307
324
  signal
308
325
  });
309
- const createUserAPIKey = (variables, signal) => fetch$1({
310
- url: "/user/keys/{keyName}",
311
- method: "post",
326
+ const dEPRECATEDcreateDatabase = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}", method: "put", ...variables, signal });
327
+ const dEPRECATEDdeleteDatabase = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}", method: "delete", ...variables, signal });
328
+ const dEPRECATEDgetDatabaseMetadata = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/metadata", method: "get", ...variables, signal });
329
+ const dEPRECATEDupdateDatabaseMetadata = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/metadata", method: "patch", ...variables, signal });
330
+ const getBranchDetails = (variables, signal) => dataPlaneFetch({
331
+ url: "/db/{dbBranchName}",
332
+ method: "get",
312
333
  ...variables,
313
334
  signal
314
335
  });
315
- const deleteUserAPIKey = (variables, signal) => fetch$1({
316
- url: "/user/keys/{keyName}",
336
+ const createBranch = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}", method: "put", ...variables, signal });
337
+ const deleteBranch = (variables, signal) => dataPlaneFetch({
338
+ url: "/db/{dbBranchName}",
317
339
  method: "delete",
318
340
  ...variables,
319
341
  signal
320
342
  });
321
- const createWorkspace = (variables, signal) => fetch$1({
322
- url: "/workspaces",
323
- method: "post",
343
+ const updateBranchMetadata = (variables, signal) => dataPlaneFetch({
344
+ url: "/db/{dbBranchName}/metadata",
345
+ method: "put",
324
346
  ...variables,
325
347
  signal
326
348
  });
327
- const getWorkspacesList = (variables, signal) => fetch$1({
328
- url: "/workspaces",
349
+ const getBranchMetadata = (variables, signal) => dataPlaneFetch({
350
+ url: "/db/{dbBranchName}/metadata",
329
351
  method: "get",
330
352
  ...variables,
331
353
  signal
332
354
  });
333
- const getWorkspace = (variables, signal) => fetch$1({
334
- url: "/workspaces/{workspaceId}",
355
+ const getBranchStats = (variables, signal) => dataPlaneFetch({
356
+ url: "/db/{dbBranchName}/stats",
335
357
  method: "get",
336
358
  ...variables,
337
359
  signal
338
360
  });
339
- const updateWorkspace = (variables, signal) => fetch$1({
340
- url: "/workspaces/{workspaceId}",
341
- method: "put",
342
- ...variables,
343
- signal
344
- });
345
- const deleteWorkspace = (variables, signal) => fetch$1({
346
- url: "/workspaces/{workspaceId}",
347
- method: "delete",
348
- ...variables,
349
- signal
350
- });
351
- const getWorkspaceMembersList = (variables, signal) => fetch$1({
352
- url: "/workspaces/{workspaceId}/members",
361
+ const getGitBranchesMapping = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables, signal });
362
+ const addGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables, signal });
363
+ const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables, signal });
364
+ const resolveBranch = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/resolveBranch", method: "get", ...variables, signal });
365
+ const getBranchMigrationHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations", method: "get", ...variables, signal });
366
+ const getBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables, signal });
367
+ const executeBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables, signal });
368
+ const branchTransaction = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/transaction", method: "post", ...variables, signal });
369
+ const queryMigrationRequests = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/query", method: "post", ...variables, signal });
370
+ const createMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
371
+ const getMigrationRequest = (variables, signal) => dataPlaneFetch({
372
+ url: "/dbs/{dbName}/migrations/{mrNumber}",
353
373
  method: "get",
354
374
  ...variables,
355
375
  signal
356
376
  });
357
- const updateWorkspaceMemberRole = (variables, signal) => fetch$1({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables, signal });
358
- const removeWorkspaceMember = (variables, signal) => fetch$1({
359
- url: "/workspaces/{workspaceId}/members/{userId}",
360
- method: "delete",
361
- ...variables,
362
- signal
363
- });
364
- const inviteWorkspaceMember = (variables, signal) => fetch$1({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables, signal });
365
- const updateWorkspaceMemberInvite = (variables, signal) => fetch$1({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables, signal });
366
- const cancelWorkspaceMemberInvite = (variables, signal) => fetch$1({
367
- url: "/workspaces/{workspaceId}/invites/{inviteId}",
368
- method: "delete",
369
- ...variables,
370
- signal
371
- });
372
- const resendWorkspaceMemberInvite = (variables, signal) => fetch$1({
373
- url: "/workspaces/{workspaceId}/invites/{inviteId}/resend",
374
- method: "post",
375
- ...variables,
376
- signal
377
- });
378
- const acceptWorkspaceMemberInvite = (variables, signal) => fetch$1({
379
- url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept",
377
+ const updateMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}", method: "patch", ...variables, signal });
378
+ const listMigrationRequestsCommits = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/commits", method: "post", ...variables, signal });
379
+ const compareMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/compare", method: "post", ...variables, signal });
380
+ const getMigrationRequestIsMerged = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/merge", method: "get", ...variables, signal });
381
+ const mergeMigrationRequest = (variables, signal) => dataPlaneFetch({
382
+ url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
380
383
  method: "post",
381
384
  ...variables,
382
385
  signal
383
386
  });
384
- const getDatabaseList = (variables, signal) => fetch$1({
385
- url: "/dbs",
386
- method: "get",
387
- ...variables,
388
- signal
389
- });
390
- const getBranchList = (variables, signal) => fetch$1({
391
- url: "/dbs/{dbName}",
392
- method: "get",
393
- ...variables,
394
- signal
395
- });
396
- const createDatabase = (variables, signal) => fetch$1({
397
- url: "/dbs/{dbName}",
387
+ const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/history", method: "post", ...variables, signal });
388
+ const compareBranchWithUserSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare", method: "post", ...variables, signal });
389
+ const compareBranchSchemas = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare/{branchName}", method: "post", ...variables, signal });
390
+ const updateBranchSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/update", method: "post", ...variables, signal });
391
+ const previewBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/preview", method: "post", ...variables, signal });
392
+ const applyBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/apply", method: "post", ...variables, signal });
393
+ const createTable = (variables, signal) => dataPlaneFetch({
394
+ url: "/db/{dbBranchName}/tables/{tableName}",
398
395
  method: "put",
399
396
  ...variables,
400
397
  signal
401
398
  });
402
- const deleteDatabase = (variables, signal) => fetch$1({
403
- url: "/dbs/{dbName}",
399
+ const deleteTable = (variables, signal) => dataPlaneFetch({
400
+ url: "/db/{dbBranchName}/tables/{tableName}",
404
401
  method: "delete",
405
402
  ...variables,
406
403
  signal
407
404
  });
408
- const getDatabaseMetadata = (variables, signal) => fetch$1({
409
- url: "/dbs/{dbName}/metadata",
405
+ const updateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}", method: "patch", ...variables, signal });
406
+ const getTableSchema = (variables, signal) => dataPlaneFetch({
407
+ url: "/db/{dbBranchName}/tables/{tableName}/schema",
410
408
  method: "get",
411
409
  ...variables,
412
410
  signal
413
411
  });
414
- const updateDatabaseMetadata = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/metadata", method: "patch", ...variables, signal });
415
- const getGitBranchesMapping = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables, signal });
416
- const addGitBranchesEntry = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables, signal });
417
- const removeGitBranchesEntry = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables, signal });
418
- const resolveBranch = (variables, signal) => fetch$1({
419
- url: "/dbs/{dbName}/resolveBranch",
412
+ const setTableSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/schema", method: "put", ...variables, signal });
413
+ const getTableColumns = (variables, signal) => dataPlaneFetch({
414
+ url: "/db/{dbBranchName}/tables/{tableName}/columns",
420
415
  method: "get",
421
416
  ...variables,
422
417
  signal
423
418
  });
424
- const queryMigrationRequests = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/query", method: "post", ...variables, signal });
425
- const createMigrationRequest = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
426
- const getMigrationRequest = (variables, signal) => fetch$1({
427
- url: "/dbs/{dbName}/migrations/{mrNumber}",
419
+ const addTableColumn = (variables, signal) => dataPlaneFetch(
420
+ { url: "/db/{dbBranchName}/tables/{tableName}/columns", method: "post", ...variables, signal }
421
+ );
422
+ const getColumn = (variables, signal) => dataPlaneFetch({
423
+ url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
428
424
  method: "get",
429
425
  ...variables,
430
426
  signal
431
427
  });
432
- const updateMigrationRequest = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}", method: "patch", ...variables, signal });
433
- const listMigrationRequestsCommits = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}/commits", method: "post", ...variables, signal });
434
- const compareMigrationRequest = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}/compare", method: "post", ...variables, signal });
435
- const getMigrationRequestIsMerged = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}/merge", method: "get", ...variables, signal });
436
- const mergeMigrationRequest = (variables, signal) => fetch$1({
437
- url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
438
- method: "post",
428
+ const updateColumn = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}", method: "patch", ...variables, signal });
429
+ const deleteColumn = (variables, signal) => dataPlaneFetch({
430
+ url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
431
+ method: "delete",
439
432
  ...variables,
440
433
  signal
441
434
  });
442
- const getBranchDetails = (variables, signal) => fetch$1({
443
- url: "/db/{dbBranchName}",
435
+ const insertRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables, signal });
436
+ const getRecord = (variables, signal) => dataPlaneFetch({
437
+ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
444
438
  method: "get",
445
439
  ...variables,
446
440
  signal
447
441
  });
448
- const createBranch = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}", method: "put", ...variables, signal });
449
- const deleteBranch = (variables, signal) => fetch$1({
450
- url: "/db/{dbBranchName}",
451
- method: "delete",
452
- ...variables,
453
- signal
454
- });
455
- const updateBranchMetadata = (variables, signal) => fetch$1({
456
- url: "/db/{dbBranchName}/metadata",
457
- method: "put",
442
+ const insertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables, signal });
443
+ const updateRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables, signal });
444
+ const upsertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables, signal });
445
+ const deleteRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "delete", ...variables, signal });
446
+ const bulkInsertTableRecords = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/bulk", method: "post", ...variables, signal });
447
+ const queryTable = (variables, signal) => dataPlaneFetch({
448
+ url: "/db/{dbBranchName}/tables/{tableName}/query",
449
+ method: "post",
458
450
  ...variables,
459
451
  signal
460
452
  });
461
- const getBranchMetadata = (variables, signal) => fetch$1({
462
- url: "/db/{dbBranchName}/metadata",
463
- method: "get",
453
+ const searchBranch = (variables, signal) => dataPlaneFetch({
454
+ url: "/db/{dbBranchName}/search",
455
+ method: "post",
464
456
  ...variables,
465
457
  signal
466
458
  });
467
- const getBranchMigrationHistory = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/migrations", method: "get", ...variables, signal });
468
- const executeBranchMigrationPlan = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables, signal });
469
- const getBranchMigrationPlan = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables, signal });
470
- const compareBranchWithUserSchema = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/schema/compare", method: "post", ...variables, signal });
471
- const compareBranchSchemas = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/schema/compare/{branchName}", method: "post", ...variables, signal });
472
- const updateBranchSchema = (variables, signal) => fetch$1({
473
- url: "/db/{dbBranchName}/schema/update",
459
+ const searchTable = (variables, signal) => dataPlaneFetch({
460
+ url: "/db/{dbBranchName}/tables/{tableName}/search",
474
461
  method: "post",
475
462
  ...variables,
476
463
  signal
477
464
  });
478
- const previewBranchSchemaEdit = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/schema/preview", method: "post", ...variables, signal });
479
- const applyBranchSchemaEdit = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/schema/apply", method: "post", ...variables, signal });
480
- const getBranchSchemaHistory = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/schema/history", method: "post", ...variables, signal });
481
- const getBranchStats = (variables, signal) => fetch$1({
482
- url: "/db/{dbBranchName}/stats",
465
+ const summarizeTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/summarize", method: "post", ...variables, signal });
466
+ const aggregateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/aggregate", method: "post", ...variables, signal });
467
+ const operationsByTag$2 = {
468
+ database: {
469
+ dEPRECATEDgetDatabaseList,
470
+ dEPRECATEDcreateDatabase,
471
+ dEPRECATEDdeleteDatabase,
472
+ dEPRECATEDgetDatabaseMetadata,
473
+ dEPRECATEDupdateDatabaseMetadata
474
+ },
475
+ branch: {
476
+ getBranchList,
477
+ getBranchDetails,
478
+ createBranch,
479
+ deleteBranch,
480
+ updateBranchMetadata,
481
+ getBranchMetadata,
482
+ getBranchStats,
483
+ getGitBranchesMapping,
484
+ addGitBranchesEntry,
485
+ removeGitBranchesEntry,
486
+ resolveBranch
487
+ },
488
+ migrations: {
489
+ getBranchMigrationHistory,
490
+ getBranchMigrationPlan,
491
+ executeBranchMigrationPlan,
492
+ getBranchSchemaHistory,
493
+ compareBranchWithUserSchema,
494
+ compareBranchSchemas,
495
+ updateBranchSchema,
496
+ previewBranchSchemaEdit,
497
+ applyBranchSchemaEdit
498
+ },
499
+ records: {
500
+ branchTransaction,
501
+ insertRecord,
502
+ getRecord,
503
+ insertRecordWithID,
504
+ updateRecordWithID,
505
+ upsertRecordWithID,
506
+ deleteRecord,
507
+ bulkInsertTableRecords
508
+ },
509
+ migrationRequests: {
510
+ queryMigrationRequests,
511
+ createMigrationRequest,
512
+ getMigrationRequest,
513
+ updateMigrationRequest,
514
+ listMigrationRequestsCommits,
515
+ compareMigrationRequest,
516
+ getMigrationRequestIsMerged,
517
+ mergeMigrationRequest
518
+ },
519
+ table: {
520
+ createTable,
521
+ deleteTable,
522
+ updateTable,
523
+ getTableSchema,
524
+ setTableSchema,
525
+ getTableColumns,
526
+ addTableColumn,
527
+ getColumn,
528
+ updateColumn,
529
+ deleteColumn
530
+ },
531
+ searchAndFilter: { queryTable, searchBranch, searchTable, summarizeTable, aggregateTable }
532
+ };
533
+
534
+ const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
535
+
536
+ const getUser = (variables, signal) => controlPlaneFetch({
537
+ url: "/user",
483
538
  method: "get",
484
539
  ...variables,
485
540
  signal
486
541
  });
487
- const createTable = (variables, signal) => fetch$1({
488
- url: "/db/{dbBranchName}/tables/{tableName}",
542
+ const updateUser = (variables, signal) => controlPlaneFetch({
543
+ url: "/user",
489
544
  method: "put",
490
545
  ...variables,
491
546
  signal
492
547
  });
493
- const deleteTable = (variables, signal) => fetch$1({
494
- url: "/db/{dbBranchName}/tables/{tableName}",
548
+ const deleteUser = (variables, signal) => controlPlaneFetch({
549
+ url: "/user",
495
550
  method: "delete",
496
551
  ...variables,
497
552
  signal
498
553
  });
499
- const updateTable = (variables, signal) => fetch$1({
500
- url: "/db/{dbBranchName}/tables/{tableName}",
501
- method: "patch",
554
+ const getUserAPIKeys = (variables, signal) => controlPlaneFetch({
555
+ url: "/user/keys",
556
+ method: "get",
502
557
  ...variables,
503
558
  signal
504
559
  });
505
- const getTableSchema = (variables, signal) => fetch$1({
506
- url: "/db/{dbBranchName}/tables/{tableName}/schema",
507
- method: "get",
560
+ const createUserAPIKey = (variables, signal) => controlPlaneFetch({
561
+ url: "/user/keys/{keyName}",
562
+ method: "post",
508
563
  ...variables,
509
564
  signal
510
565
  });
511
- const setTableSchema = (variables, signal) => fetch$1({
512
- url: "/db/{dbBranchName}/tables/{tableName}/schema",
513
- method: "put",
566
+ const deleteUserAPIKey = (variables, signal) => controlPlaneFetch({
567
+ url: "/user/keys/{keyName}",
568
+ method: "delete",
514
569
  ...variables,
515
570
  signal
516
571
  });
517
- const getTableColumns = (variables, signal) => fetch$1({
518
- url: "/db/{dbBranchName}/tables/{tableName}/columns",
572
+ const getWorkspacesList = (variables, signal) => controlPlaneFetch({
573
+ url: "/workspaces",
519
574
  method: "get",
520
575
  ...variables,
521
576
  signal
522
577
  });
523
- const addTableColumn = (variables, signal) => fetch$1({
524
- url: "/db/{dbBranchName}/tables/{tableName}/columns",
578
+ const createWorkspace = (variables, signal) => controlPlaneFetch({
579
+ url: "/workspaces",
525
580
  method: "post",
526
581
  ...variables,
527
582
  signal
528
583
  });
529
- const getColumn = (variables, signal) => fetch$1({
530
- url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
584
+ const getWorkspace = (variables, signal) => controlPlaneFetch({
585
+ url: "/workspaces/{workspaceId}",
531
586
  method: "get",
532
587
  ...variables,
533
588
  signal
534
589
  });
535
- const deleteColumn = (variables, signal) => fetch$1({
536
- url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
537
- method: "delete",
590
+ const updateWorkspace = (variables, signal) => controlPlaneFetch({
591
+ url: "/workspaces/{workspaceId}",
592
+ method: "put",
538
593
  ...variables,
539
594
  signal
540
595
  });
541
- const updateColumn = (variables, signal) => fetch$1({
542
- url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
543
- method: "patch",
596
+ const deleteWorkspace = (variables, signal) => controlPlaneFetch({
597
+ url: "/workspaces/{workspaceId}",
598
+ method: "delete",
544
599
  ...variables,
545
600
  signal
546
601
  });
547
- const insertRecord = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables, signal });
548
- const insertRecordWithID = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables, signal });
549
- const updateRecordWithID = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables, signal });
550
- const upsertRecordWithID = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables, signal });
551
- const deleteRecord = (variables, signal) => fetch$1({
552
- url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
602
+ const getWorkspaceMembersList = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members", method: "get", ...variables, signal });
603
+ const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables, signal });
604
+ const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
605
+ url: "/workspaces/{workspaceId}/members/{userId}",
553
606
  method: "delete",
554
607
  ...variables,
555
608
  signal
556
609
  });
557
- const getRecord = (variables, signal) => fetch$1({
558
- url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
610
+ const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables, signal });
611
+ const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables, signal });
612
+ const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "delete", ...variables, signal });
613
+ const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
614
+ const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
615
+ const getDatabaseList = (variables, signal) => controlPlaneFetch({
616
+ url: "/workspaces/{workspaceId}/dbs",
559
617
  method: "get",
560
618
  ...variables,
561
619
  signal
562
620
  });
563
- const bulkInsertTableRecords = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/bulk", method: "post", ...variables, signal });
564
- const queryTable = (variables, signal) => fetch$1({
565
- url: "/db/{dbBranchName}/tables/{tableName}/query",
566
- method: "post",
567
- ...variables,
568
- signal
569
- });
570
- const searchTable = (variables, signal) => fetch$1({
571
- url: "/db/{dbBranchName}/tables/{tableName}/search",
572
- method: "post",
573
- ...variables,
574
- signal
575
- });
576
- const searchBranch = (variables, signal) => fetch$1({
577
- url: "/db/{dbBranchName}/search",
578
- method: "post",
621
+ const createDatabase = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "put", ...variables, signal });
622
+ const deleteDatabase = (variables, signal) => controlPlaneFetch({
623
+ url: "/workspaces/{workspaceId}/dbs/{dbName}",
624
+ method: "delete",
579
625
  ...variables,
580
626
  signal
581
627
  });
582
- const summarizeTable = (variables, signal) => fetch$1({
583
- url: "/db/{dbBranchName}/tables/{tableName}/summarize",
584
- method: "post",
628
+ const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "get", ...variables, signal });
629
+ const updateDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "patch", ...variables, signal });
630
+ const listRegions = (variables, signal) => controlPlaneFetch({
631
+ url: "/workspaces/{workspaceId}/regions",
632
+ method: "get",
585
633
  ...variables,
586
634
  signal
587
635
  });
588
- const aggregateTable = (variables) => fetch$1({
589
- url: "/db/{dbBranchName}/tables/{tableName}/aggregate",
590
- method: "post",
591
- ...variables
592
- });
593
- const operationsByTag = {
594
- users: { getUser, updateUser, deleteUser, getUserAPIKeys, createUserAPIKey, deleteUserAPIKey },
636
+ const operationsByTag$1 = {
637
+ users: { getUser, updateUser, deleteUser },
638
+ authentication: { getUserAPIKeys, createUserAPIKey, deleteUserAPIKey },
595
639
  workspaces: {
596
- createWorkspace,
597
640
  getWorkspacesList,
641
+ createWorkspace,
598
642
  getWorkspace,
599
643
  updateWorkspace,
600
644
  deleteWorkspace,
601
645
  getWorkspaceMembersList,
602
646
  updateWorkspaceMemberRole,
603
- removeWorkspaceMember,
647
+ removeWorkspaceMember
648
+ },
649
+ invites: {
604
650
  inviteWorkspaceMember,
605
651
  updateWorkspaceMemberInvite,
606
652
  cancelWorkspaceMemberInvite,
607
- resendWorkspaceMemberInvite,
608
- acceptWorkspaceMemberInvite
653
+ acceptWorkspaceMemberInvite,
654
+ resendWorkspaceMemberInvite
609
655
  },
610
- database: {
656
+ databases: {
611
657
  getDatabaseList,
612
658
  createDatabase,
613
659
  deleteDatabase,
614
660
  getDatabaseMetadata,
615
661
  updateDatabaseMetadata,
616
- getGitBranchesMapping,
617
- addGitBranchesEntry,
618
- removeGitBranchesEntry,
619
- resolveBranch
620
- },
621
- branch: {
622
- getBranchList,
623
- getBranchDetails,
624
- createBranch,
625
- deleteBranch,
626
- updateBranchMetadata,
627
- getBranchMetadata,
628
- getBranchStats
629
- },
630
- migrationRequests: {
631
- queryMigrationRequests,
632
- createMigrationRequest,
633
- getMigrationRequest,
634
- updateMigrationRequest,
635
- listMigrationRequestsCommits,
636
- compareMigrationRequest,
637
- getMigrationRequestIsMerged,
638
- mergeMigrationRequest
639
- },
640
- branchSchema: {
641
- getBranchMigrationHistory,
642
- executeBranchMigrationPlan,
643
- getBranchMigrationPlan,
644
- compareBranchWithUserSchema,
645
- compareBranchSchemas,
646
- updateBranchSchema,
647
- previewBranchSchemaEdit,
648
- applyBranchSchemaEdit,
649
- getBranchSchemaHistory
650
- },
651
- table: {
652
- createTable,
653
- deleteTable,
654
- updateTable,
655
- getTableSchema,
656
- setTableSchema,
657
- getTableColumns,
658
- addTableColumn,
659
- getColumn,
660
- deleteColumn,
661
- updateColumn
662
- },
663
- records: {
664
- insertRecord,
665
- insertRecordWithID,
666
- updateRecordWithID,
667
- upsertRecordWithID,
668
- deleteRecord,
669
- getRecord,
670
- bulkInsertTableRecords,
671
- queryTable,
672
- searchTable,
673
- searchBranch,
674
- summarizeTable,
675
- aggregateTable
662
+ listRegions
676
663
  }
677
664
  };
678
665
 
666
+ const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
667
+
679
668
  function getHostUrl(provider, type) {
680
669
  if (isHostProviderAlias(provider)) {
681
670
  return providers[provider][type];
@@ -687,11 +676,11 @@ function getHostUrl(provider, type) {
687
676
  const providers = {
688
677
  production: {
689
678
  main: "https://api.xata.io",
690
- workspaces: "https://{workspaceId}.xata.sh"
679
+ workspaces: "https://{workspaceId}.{region}.xata.sh"
691
680
  },
692
681
  staging: {
693
682
  main: "https://staging.xatabase.co",
694
- workspaces: "https://{workspaceId}.staging.xatabase.co"
683
+ workspaces: "https://{workspaceId}.staging.{region}.xatabase.co"
695
684
  }
696
685
  };
697
686
  function isHostProviderAlias(alias) {
@@ -709,6 +698,16 @@ function parseProviderString(provider = "production") {
709
698
  return null;
710
699
  return { main, workspaces };
711
700
  }
701
+ function parseWorkspacesUrlParts(url) {
702
+ if (!isString(url))
703
+ return null;
704
+ const regex = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))?\.xata\.sh.*/;
705
+ const regexStaging = /(?:https:\/\/)?([^.]+)\.staging(?:\.([^.]+))?\.xatabase\.co.*/;
706
+ const match = url.match(regex) || url.match(regexStaging);
707
+ if (!match)
708
+ return null;
709
+ return { workspace: match[1], region: match[2] ?? "eu-west-1" };
710
+ }
712
711
 
713
712
  var __accessCheck$7 = (obj, member, msg) => {
714
713
  if (!member.has(obj))
@@ -752,21 +751,41 @@ class XataApiClient {
752
751
  __privateGet$7(this, _namespaces).user = new UserApi(__privateGet$7(this, _extraProps));
753
752
  return __privateGet$7(this, _namespaces).user;
754
753
  }
754
+ get authentication() {
755
+ if (!__privateGet$7(this, _namespaces).authentication)
756
+ __privateGet$7(this, _namespaces).authentication = new AuthenticationApi(__privateGet$7(this, _extraProps));
757
+ return __privateGet$7(this, _namespaces).authentication;
758
+ }
755
759
  get workspaces() {
756
760
  if (!__privateGet$7(this, _namespaces).workspaces)
757
761
  __privateGet$7(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$7(this, _extraProps));
758
762
  return __privateGet$7(this, _namespaces).workspaces;
759
763
  }
760
- get databases() {
761
- if (!__privateGet$7(this, _namespaces).databases)
762
- __privateGet$7(this, _namespaces).databases = new DatabaseApi(__privateGet$7(this, _extraProps));
763
- return __privateGet$7(this, _namespaces).databases;
764
+ get invites() {
765
+ if (!__privateGet$7(this, _namespaces).invites)
766
+ __privateGet$7(this, _namespaces).invites = new InvitesApi(__privateGet$7(this, _extraProps));
767
+ return __privateGet$7(this, _namespaces).invites;
768
+ }
769
+ get database() {
770
+ if (!__privateGet$7(this, _namespaces).database)
771
+ __privateGet$7(this, _namespaces).database = new DatabaseApi(__privateGet$7(this, _extraProps));
772
+ return __privateGet$7(this, _namespaces).database;
764
773
  }
765
774
  get branches() {
766
775
  if (!__privateGet$7(this, _namespaces).branches)
767
776
  __privateGet$7(this, _namespaces).branches = new BranchApi(__privateGet$7(this, _extraProps));
768
777
  return __privateGet$7(this, _namespaces).branches;
769
778
  }
779
+ get migrations() {
780
+ if (!__privateGet$7(this, _namespaces).migrations)
781
+ __privateGet$7(this, _namespaces).migrations = new MigrationsApi(__privateGet$7(this, _extraProps));
782
+ return __privateGet$7(this, _namespaces).migrations;
783
+ }
784
+ get migrationRequests() {
785
+ if (!__privateGet$7(this, _namespaces).migrationRequests)
786
+ __privateGet$7(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$7(this, _extraProps));
787
+ return __privateGet$7(this, _namespaces).migrationRequests;
788
+ }
770
789
  get tables() {
771
790
  if (!__privateGet$7(this, _namespaces).tables)
772
791
  __privateGet$7(this, _namespaces).tables = new TableApi(__privateGet$7(this, _extraProps));
@@ -777,15 +796,10 @@ class XataApiClient {
777
796
  __privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
778
797
  return __privateGet$7(this, _namespaces).records;
779
798
  }
780
- get migrationRequests() {
781
- if (!__privateGet$7(this, _namespaces).migrationRequests)
782
- __privateGet$7(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$7(this, _extraProps));
783
- return __privateGet$7(this, _namespaces).migrationRequests;
784
- }
785
- get branchSchema() {
786
- if (!__privateGet$7(this, _namespaces).branchSchema)
787
- __privateGet$7(this, _namespaces).branchSchema = new BranchSchemaApi(__privateGet$7(this, _extraProps));
788
- return __privateGet$7(this, _namespaces).branchSchema;
799
+ get searchAndFilter() {
800
+ if (!__privateGet$7(this, _namespaces).searchAndFilter)
801
+ __privateGet$7(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$7(this, _extraProps));
802
+ return __privateGet$7(this, _namespaces).searchAndFilter;
789
803
  }
790
804
  }
791
805
  _extraProps = new WeakMap();
@@ -797,24 +811,29 @@ class UserApi {
797
811
  getUser() {
798
812
  return operationsByTag.users.getUser({ ...this.extraProps });
799
813
  }
800
- updateUser(user) {
814
+ updateUser({ user }) {
801
815
  return operationsByTag.users.updateUser({ body: user, ...this.extraProps });
802
816
  }
803
817
  deleteUser() {
804
818
  return operationsByTag.users.deleteUser({ ...this.extraProps });
805
819
  }
820
+ }
821
+ class AuthenticationApi {
822
+ constructor(extraProps) {
823
+ this.extraProps = extraProps;
824
+ }
806
825
  getUserAPIKeys() {
807
- return operationsByTag.users.getUserAPIKeys({ ...this.extraProps });
826
+ return operationsByTag.authentication.getUserAPIKeys({ ...this.extraProps });
808
827
  }
809
- createUserAPIKey(keyName) {
810
- return operationsByTag.users.createUserAPIKey({
811
- pathParams: { keyName },
828
+ createUserAPIKey({ name }) {
829
+ return operationsByTag.authentication.createUserAPIKey({
830
+ pathParams: { keyName: name },
812
831
  ...this.extraProps
813
832
  });
814
833
  }
815
- deleteUserAPIKey(keyName) {
816
- return operationsByTag.users.deleteUserAPIKey({
817
- pathParams: { keyName },
834
+ deleteUserAPIKey({ name }) {
835
+ return operationsByTag.authentication.deleteUserAPIKey({
836
+ pathParams: { keyName: name },
818
837
  ...this.extraProps
819
838
  });
820
839
  }
@@ -823,196 +842,248 @@ class WorkspaceApi {
823
842
  constructor(extraProps) {
824
843
  this.extraProps = extraProps;
825
844
  }
826
- createWorkspace(workspaceMeta) {
845
+ getWorkspacesList() {
846
+ return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
847
+ }
848
+ createWorkspace({ data }) {
827
849
  return operationsByTag.workspaces.createWorkspace({
828
- body: workspaceMeta,
850
+ body: data,
829
851
  ...this.extraProps
830
852
  });
831
853
  }
832
- getWorkspacesList() {
833
- return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
834
- }
835
- getWorkspace(workspaceId) {
854
+ getWorkspace({ workspace }) {
836
855
  return operationsByTag.workspaces.getWorkspace({
837
- pathParams: { workspaceId },
856
+ pathParams: { workspaceId: workspace },
838
857
  ...this.extraProps
839
858
  });
840
859
  }
841
- updateWorkspace(workspaceId, workspaceMeta) {
860
+ updateWorkspace({
861
+ workspace,
862
+ update
863
+ }) {
842
864
  return operationsByTag.workspaces.updateWorkspace({
843
- pathParams: { workspaceId },
844
- body: workspaceMeta,
865
+ pathParams: { workspaceId: workspace },
866
+ body: update,
845
867
  ...this.extraProps
846
868
  });
847
869
  }
848
- deleteWorkspace(workspaceId) {
870
+ deleteWorkspace({ workspace }) {
849
871
  return operationsByTag.workspaces.deleteWorkspace({
850
- pathParams: { workspaceId },
872
+ pathParams: { workspaceId: workspace },
851
873
  ...this.extraProps
852
874
  });
853
875
  }
854
- getWorkspaceMembersList(workspaceId) {
876
+ getWorkspaceMembersList({ workspace }) {
855
877
  return operationsByTag.workspaces.getWorkspaceMembersList({
856
- pathParams: { workspaceId },
878
+ pathParams: { workspaceId: workspace },
857
879
  ...this.extraProps
858
880
  });
859
881
  }
860
- updateWorkspaceMemberRole(workspaceId, userId, role) {
882
+ updateWorkspaceMemberRole({
883
+ workspace,
884
+ user,
885
+ role
886
+ }) {
861
887
  return operationsByTag.workspaces.updateWorkspaceMemberRole({
862
- pathParams: { workspaceId, userId },
888
+ pathParams: { workspaceId: workspace, userId: user },
863
889
  body: { role },
864
890
  ...this.extraProps
865
891
  });
866
892
  }
867
- removeWorkspaceMember(workspaceId, userId) {
893
+ removeWorkspaceMember({
894
+ workspace,
895
+ user
896
+ }) {
868
897
  return operationsByTag.workspaces.removeWorkspaceMember({
869
- pathParams: { workspaceId, userId },
898
+ pathParams: { workspaceId: workspace, userId: user },
870
899
  ...this.extraProps
871
900
  });
872
901
  }
873
- inviteWorkspaceMember(workspaceId, email, role) {
874
- return operationsByTag.workspaces.inviteWorkspaceMember({
875
- pathParams: { workspaceId },
902
+ }
903
+ class InvitesApi {
904
+ constructor(extraProps) {
905
+ this.extraProps = extraProps;
906
+ }
907
+ inviteWorkspaceMember({
908
+ workspace,
909
+ email,
910
+ role
911
+ }) {
912
+ return operationsByTag.invites.inviteWorkspaceMember({
913
+ pathParams: { workspaceId: workspace },
876
914
  body: { email, role },
877
915
  ...this.extraProps
878
916
  });
879
917
  }
880
- updateWorkspaceMemberInvite(workspaceId, inviteId, role) {
881
- return operationsByTag.workspaces.updateWorkspaceMemberInvite({
882
- pathParams: { workspaceId, inviteId },
918
+ updateWorkspaceMemberInvite({
919
+ workspace,
920
+ invite,
921
+ role
922
+ }) {
923
+ return operationsByTag.invites.updateWorkspaceMemberInvite({
924
+ pathParams: { workspaceId: workspace, inviteId: invite },
883
925
  body: { role },
884
926
  ...this.extraProps
885
927
  });
886
928
  }
887
- cancelWorkspaceMemberInvite(workspaceId, inviteId) {
888
- return operationsByTag.workspaces.cancelWorkspaceMemberInvite({
889
- pathParams: { workspaceId, inviteId },
929
+ cancelWorkspaceMemberInvite({
930
+ workspace,
931
+ invite
932
+ }) {
933
+ return operationsByTag.invites.cancelWorkspaceMemberInvite({
934
+ pathParams: { workspaceId: workspace, inviteId: invite },
890
935
  ...this.extraProps
891
936
  });
892
937
  }
893
- resendWorkspaceMemberInvite(workspaceId, inviteId) {
894
- return operationsByTag.workspaces.resendWorkspaceMemberInvite({
895
- pathParams: { workspaceId, inviteId },
938
+ acceptWorkspaceMemberInvite({
939
+ workspace,
940
+ key
941
+ }) {
942
+ return operationsByTag.invites.acceptWorkspaceMemberInvite({
943
+ pathParams: { workspaceId: workspace, inviteKey: key },
896
944
  ...this.extraProps
897
945
  });
898
946
  }
899
- acceptWorkspaceMemberInvite(workspaceId, inviteKey) {
900
- return operationsByTag.workspaces.acceptWorkspaceMemberInvite({
901
- pathParams: { workspaceId, inviteKey },
947
+ resendWorkspaceMemberInvite({
948
+ workspace,
949
+ invite
950
+ }) {
951
+ return operationsByTag.invites.resendWorkspaceMemberInvite({
952
+ pathParams: { workspaceId: workspace, inviteId: invite },
902
953
  ...this.extraProps
903
954
  });
904
955
  }
905
956
  }
906
- class DatabaseApi {
957
+ class BranchApi {
907
958
  constructor(extraProps) {
908
959
  this.extraProps = extraProps;
909
960
  }
910
- getDatabaseList(workspace) {
911
- return operationsByTag.database.getDatabaseList({
912
- pathParams: { workspace },
913
- ...this.extraProps
914
- });
915
- }
916
- createDatabase(workspace, dbName, options = {}) {
917
- return operationsByTag.database.createDatabase({
918
- pathParams: { workspace, dbName },
919
- body: options,
920
- ...this.extraProps
921
- });
922
- }
923
- deleteDatabase(workspace, dbName) {
924
- return operationsByTag.database.deleteDatabase({
925
- pathParams: { workspace, dbName },
926
- ...this.extraProps
927
- });
928
- }
929
- getDatabaseMetadata(workspace, dbName) {
930
- return operationsByTag.database.getDatabaseMetadata({
931
- pathParams: { workspace, dbName },
932
- ...this.extraProps
933
- });
934
- }
935
- updateDatabaseMetadata(workspace, dbName, options = {}) {
936
- return operationsByTag.database.updateDatabaseMetadata({
937
- pathParams: { workspace, dbName },
938
- body: options,
939
- ...this.extraProps
940
- });
941
- }
942
- getGitBranchesMapping(workspace, dbName) {
943
- return operationsByTag.database.getGitBranchesMapping({
944
- pathParams: { workspace, dbName },
961
+ getBranchList({
962
+ workspace,
963
+ region,
964
+ database
965
+ }) {
966
+ return operationsByTag.branch.getBranchList({
967
+ pathParams: { workspace, region, dbName: database },
945
968
  ...this.extraProps
946
969
  });
947
970
  }
948
- addGitBranchesEntry(workspace, dbName, body) {
949
- return operationsByTag.database.addGitBranchesEntry({
950
- pathParams: { workspace, dbName },
951
- body,
971
+ getBranchDetails({
972
+ workspace,
973
+ region,
974
+ database,
975
+ branch
976
+ }) {
977
+ return operationsByTag.branch.getBranchDetails({
978
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
952
979
  ...this.extraProps
953
980
  });
954
981
  }
955
- removeGitBranchesEntry(workspace, dbName, gitBranch) {
956
- return operationsByTag.database.removeGitBranchesEntry({
957
- pathParams: { workspace, dbName },
958
- queryParams: { gitBranch },
982
+ createBranch({
983
+ workspace,
984
+ region,
985
+ database,
986
+ branch,
987
+ from,
988
+ metadata
989
+ }) {
990
+ return operationsByTag.branch.createBranch({
991
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
992
+ body: { from, metadata },
959
993
  ...this.extraProps
960
994
  });
961
995
  }
962
- resolveBranch(workspace, dbName, gitBranch, fallbackBranch) {
963
- return operationsByTag.database.resolveBranch({
964
- pathParams: { workspace, dbName },
965
- queryParams: { gitBranch, fallbackBranch },
996
+ deleteBranch({
997
+ workspace,
998
+ region,
999
+ database,
1000
+ branch
1001
+ }) {
1002
+ return operationsByTag.branch.deleteBranch({
1003
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
966
1004
  ...this.extraProps
967
1005
  });
968
1006
  }
969
- }
970
- class BranchApi {
971
- constructor(extraProps) {
972
- this.extraProps = extraProps;
973
- }
974
- getBranchList(workspace, dbName) {
975
- return operationsByTag.branch.getBranchList({
976
- pathParams: { workspace, dbName },
1007
+ updateBranchMetadata({
1008
+ workspace,
1009
+ region,
1010
+ database,
1011
+ branch,
1012
+ metadata
1013
+ }) {
1014
+ return operationsByTag.branch.updateBranchMetadata({
1015
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1016
+ body: metadata,
977
1017
  ...this.extraProps
978
1018
  });
979
1019
  }
980
- getBranchDetails(workspace, database, branch) {
981
- return operationsByTag.branch.getBranchDetails({
982
- pathParams: { workspace, dbBranchName: `${database}:${branch}` },
1020
+ getBranchMetadata({
1021
+ workspace,
1022
+ region,
1023
+ database,
1024
+ branch
1025
+ }) {
1026
+ return operationsByTag.branch.getBranchMetadata({
1027
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
983
1028
  ...this.extraProps
984
1029
  });
985
1030
  }
986
- createBranch(workspace, database, branch, from, options = {}) {
987
- return operationsByTag.branch.createBranch({
988
- pathParams: { workspace, dbBranchName: `${database}:${branch}` },
989
- queryParams: isString(from) ? { from } : void 0,
990
- body: options,
1031
+ getBranchStats({
1032
+ workspace,
1033
+ region,
1034
+ database,
1035
+ branch
1036
+ }) {
1037
+ return operationsByTag.branch.getBranchStats({
1038
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
991
1039
  ...this.extraProps
992
1040
  });
993
1041
  }
994
- deleteBranch(workspace, database, branch) {
995
- return operationsByTag.branch.deleteBranch({
996
- pathParams: { workspace, dbBranchName: `${database}:${branch}` },
1042
+ getGitBranchesMapping({
1043
+ workspace,
1044
+ region,
1045
+ database
1046
+ }) {
1047
+ return operationsByTag.branch.getGitBranchesMapping({
1048
+ pathParams: { workspace, region, dbName: database },
997
1049
  ...this.extraProps
998
1050
  });
999
1051
  }
1000
- updateBranchMetadata(workspace, database, branch, metadata = {}) {
1001
- return operationsByTag.branch.updateBranchMetadata({
1002
- pathParams: { workspace, dbBranchName: `${database}:${branch}` },
1003
- body: metadata,
1052
+ addGitBranchesEntry({
1053
+ workspace,
1054
+ region,
1055
+ database,
1056
+ gitBranch,
1057
+ xataBranch
1058
+ }) {
1059
+ return operationsByTag.branch.addGitBranchesEntry({
1060
+ pathParams: { workspace, region, dbName: database },
1061
+ body: { gitBranch, xataBranch },
1004
1062
  ...this.extraProps
1005
1063
  });
1006
1064
  }
1007
- getBranchMetadata(workspace, database, branch) {
1008
- return operationsByTag.branch.getBranchMetadata({
1009
- pathParams: { workspace, dbBranchName: `${database}:${branch}` },
1065
+ removeGitBranchesEntry({
1066
+ workspace,
1067
+ region,
1068
+ database,
1069
+ gitBranch
1070
+ }) {
1071
+ return operationsByTag.branch.removeGitBranchesEntry({
1072
+ pathParams: { workspace, region, dbName: database },
1073
+ queryParams: { gitBranch },
1010
1074
  ...this.extraProps
1011
1075
  });
1012
1076
  }
1013
- getBranchStats(workspace, database, branch) {
1014
- return operationsByTag.branch.getBranchStats({
1015
- pathParams: { workspace, dbBranchName: `${database}:${branch}` },
1077
+ resolveBranch({
1078
+ workspace,
1079
+ region,
1080
+ database,
1081
+ gitBranch,
1082
+ fallbackBranch
1083
+ }) {
1084
+ return operationsByTag.branch.resolveBranch({
1085
+ pathParams: { workspace, region, dbName: database },
1086
+ queryParams: { gitBranch, fallbackBranch },
1016
1087
  ...this.extraProps
1017
1088
  });
1018
1089
  }
@@ -1021,67 +1092,134 @@ class TableApi {
1021
1092
  constructor(extraProps) {
1022
1093
  this.extraProps = extraProps;
1023
1094
  }
1024
- createTable(workspace, database, branch, tableName) {
1095
+ createTable({
1096
+ workspace,
1097
+ region,
1098
+ database,
1099
+ branch,
1100
+ table
1101
+ }) {
1025
1102
  return operationsByTag.table.createTable({
1026
- pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
1103
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
1027
1104
  ...this.extraProps
1028
1105
  });
1029
1106
  }
1030
- deleteTable(workspace, database, branch, tableName) {
1107
+ deleteTable({
1108
+ workspace,
1109
+ region,
1110
+ database,
1111
+ branch,
1112
+ table
1113
+ }) {
1031
1114
  return operationsByTag.table.deleteTable({
1032
- pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
1115
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
1033
1116
  ...this.extraProps
1034
1117
  });
1035
1118
  }
1036
- updateTable(workspace, database, branch, tableName, options) {
1119
+ updateTable({
1120
+ workspace,
1121
+ region,
1122
+ database,
1123
+ branch,
1124
+ table,
1125
+ update
1126
+ }) {
1037
1127
  return operationsByTag.table.updateTable({
1038
- pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
1039
- body: options,
1128
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
1129
+ body: update,
1040
1130
  ...this.extraProps
1041
1131
  });
1042
1132
  }
1043
- getTableSchema(workspace, database, branch, tableName) {
1133
+ getTableSchema({
1134
+ workspace,
1135
+ region,
1136
+ database,
1137
+ branch,
1138
+ table
1139
+ }) {
1044
1140
  return operationsByTag.table.getTableSchema({
1045
- pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
1141
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
1046
1142
  ...this.extraProps
1047
1143
  });
1048
1144
  }
1049
- setTableSchema(workspace, database, branch, tableName, options) {
1145
+ setTableSchema({
1146
+ workspace,
1147
+ region,
1148
+ database,
1149
+ branch,
1150
+ table,
1151
+ schema
1152
+ }) {
1050
1153
  return operationsByTag.table.setTableSchema({
1051
- pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
1052
- body: options,
1154
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
1155
+ body: schema,
1053
1156
  ...this.extraProps
1054
1157
  });
1055
1158
  }
1056
- getTableColumns(workspace, database, branch, tableName) {
1159
+ getTableColumns({
1160
+ workspace,
1161
+ region,
1162
+ database,
1163
+ branch,
1164
+ table
1165
+ }) {
1057
1166
  return operationsByTag.table.getTableColumns({
1058
- pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
1167
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
1059
1168
  ...this.extraProps
1060
1169
  });
1061
1170
  }
1062
- addTableColumn(workspace, database, branch, tableName, column) {
1171
+ addTableColumn({
1172
+ workspace,
1173
+ region,
1174
+ database,
1175
+ branch,
1176
+ table,
1177
+ column
1178
+ }) {
1063
1179
  return operationsByTag.table.addTableColumn({
1064
- pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
1180
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
1065
1181
  body: column,
1066
1182
  ...this.extraProps
1067
1183
  });
1068
1184
  }
1069
- getColumn(workspace, database, branch, tableName, columnName) {
1185
+ getColumn({
1186
+ workspace,
1187
+ region,
1188
+ database,
1189
+ branch,
1190
+ table,
1191
+ column
1192
+ }) {
1070
1193
  return operationsByTag.table.getColumn({
1071
- pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, columnName },
1194
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
1072
1195
  ...this.extraProps
1073
1196
  });
1074
1197
  }
1075
- deleteColumn(workspace, database, branch, tableName, columnName) {
1076
- return operationsByTag.table.deleteColumn({
1077
- pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, columnName },
1198
+ updateColumn({
1199
+ workspace,
1200
+ region,
1201
+ database,
1202
+ branch,
1203
+ table,
1204
+ column,
1205
+ update
1206
+ }) {
1207
+ return operationsByTag.table.updateColumn({
1208
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
1209
+ body: update,
1078
1210
  ...this.extraProps
1079
1211
  });
1080
1212
  }
1081
- updateColumn(workspace, database, branch, tableName, columnName, options) {
1082
- return operationsByTag.table.updateColumn({
1083
- pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, columnName },
1084
- body: options,
1213
+ deleteColumn({
1214
+ workspace,
1215
+ region,
1216
+ database,
1217
+ branch,
1218
+ table,
1219
+ column
1220
+ }) {
1221
+ return operationsByTag.table.deleteColumn({
1222
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
1085
1223
  ...this.extraProps
1086
1224
  });
1087
1225
  }
@@ -1090,92 +1228,226 @@ class RecordsApi {
1090
1228
  constructor(extraProps) {
1091
1229
  this.extraProps = extraProps;
1092
1230
  }
1093
- insertRecord(workspace, database, branch, tableName, record, options = {}) {
1231
+ insertRecord({
1232
+ workspace,
1233
+ region,
1234
+ database,
1235
+ branch,
1236
+ table,
1237
+ record,
1238
+ columns
1239
+ }) {
1094
1240
  return operationsByTag.records.insertRecord({
1095
- pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
1096
- queryParams: options,
1241
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
1242
+ queryParams: { columns },
1097
1243
  body: record,
1098
1244
  ...this.extraProps
1099
1245
  });
1100
1246
  }
1101
- insertRecordWithID(workspace, database, branch, tableName, recordId, record, options = {}) {
1247
+ getRecord({
1248
+ workspace,
1249
+ region,
1250
+ database,
1251
+ branch,
1252
+ table,
1253
+ id,
1254
+ columns
1255
+ }) {
1256
+ return operationsByTag.records.getRecord({
1257
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
1258
+ queryParams: { columns },
1259
+ ...this.extraProps
1260
+ });
1261
+ }
1262
+ insertRecordWithID({
1263
+ workspace,
1264
+ region,
1265
+ database,
1266
+ branch,
1267
+ table,
1268
+ id,
1269
+ record,
1270
+ columns,
1271
+ createOnly,
1272
+ ifVersion
1273
+ }) {
1102
1274
  return operationsByTag.records.insertRecordWithID({
1103
- pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
1104
- queryParams: options,
1275
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
1276
+ queryParams: { columns, createOnly, ifVersion },
1105
1277
  body: record,
1106
1278
  ...this.extraProps
1107
1279
  });
1108
1280
  }
1109
- updateRecordWithID(workspace, database, branch, tableName, recordId, record, options = {}) {
1281
+ updateRecordWithID({
1282
+ workspace,
1283
+ region,
1284
+ database,
1285
+ branch,
1286
+ table,
1287
+ id,
1288
+ record,
1289
+ columns,
1290
+ ifVersion
1291
+ }) {
1110
1292
  return operationsByTag.records.updateRecordWithID({
1111
- pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
1112
- queryParams: options,
1293
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
1294
+ queryParams: { columns, ifVersion },
1113
1295
  body: record,
1114
1296
  ...this.extraProps
1115
1297
  });
1116
1298
  }
1117
- upsertRecordWithID(workspace, database, branch, tableName, recordId, record, options = {}) {
1299
+ upsertRecordWithID({
1300
+ workspace,
1301
+ region,
1302
+ database,
1303
+ branch,
1304
+ table,
1305
+ id,
1306
+ record,
1307
+ columns,
1308
+ ifVersion
1309
+ }) {
1118
1310
  return operationsByTag.records.upsertRecordWithID({
1119
- pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
1120
- queryParams: options,
1311
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
1312
+ queryParams: { columns, ifVersion },
1121
1313
  body: record,
1122
1314
  ...this.extraProps
1123
1315
  });
1124
1316
  }
1125
- deleteRecord(workspace, database, branch, tableName, recordId, options = {}) {
1317
+ deleteRecord({
1318
+ workspace,
1319
+ region,
1320
+ database,
1321
+ branch,
1322
+ table,
1323
+ id,
1324
+ columns
1325
+ }) {
1126
1326
  return operationsByTag.records.deleteRecord({
1127
- pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
1128
- queryParams: options,
1129
- ...this.extraProps
1130
- });
1131
- }
1132
- getRecord(workspace, database, branch, tableName, recordId, options = {}) {
1133
- return operationsByTag.records.getRecord({
1134
- pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
1135
- queryParams: options,
1327
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
1328
+ queryParams: { columns },
1136
1329
  ...this.extraProps
1137
1330
  });
1138
1331
  }
1139
- bulkInsertTableRecords(workspace, database, branch, tableName, records, options = {}) {
1332
+ bulkInsertTableRecords({
1333
+ workspace,
1334
+ region,
1335
+ database,
1336
+ branch,
1337
+ table,
1338
+ records,
1339
+ columns
1340
+ }) {
1140
1341
  return operationsByTag.records.bulkInsertTableRecords({
1141
- pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
1142
- queryParams: options,
1342
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
1343
+ queryParams: { columns },
1143
1344
  body: { records },
1144
1345
  ...this.extraProps
1145
1346
  });
1146
1347
  }
1147
- queryTable(workspace, database, branch, tableName, query) {
1148
- return operationsByTag.records.queryTable({
1149
- pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
1150
- body: query,
1151
- ...this.extraProps
1152
- });
1153
- }
1154
- searchTable(workspace, database, branch, tableName, query) {
1155
- return operationsByTag.records.searchTable({
1156
- pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
1157
- body: query,
1158
- ...this.extraProps
1159
- });
1160
- }
1161
- searchBranch(workspace, database, branch, query) {
1162
- return operationsByTag.records.searchBranch({
1163
- pathParams: { workspace, dbBranchName: `${database}:${branch}` },
1164
- body: query,
1348
+ branchTransaction({
1349
+ workspace,
1350
+ region,
1351
+ database,
1352
+ branch,
1353
+ operations
1354
+ }) {
1355
+ return operationsByTag.records.branchTransaction({
1356
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1357
+ body: { operations },
1165
1358
  ...this.extraProps
1166
1359
  });
1167
1360
  }
1168
- summarizeTable(workspace, database, branch, tableName, query) {
1169
- return operationsByTag.records.summarizeTable({
1170
- pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
1171
- body: query,
1172
- ...this.extraProps
1173
- });
1361
+ }
1362
+ class SearchAndFilterApi {
1363
+ constructor(extraProps) {
1364
+ this.extraProps = extraProps;
1174
1365
  }
1175
- aggregateTable(workspace, database, branch, tableName, query) {
1176
- return operationsByTag.records.aggregateTable({
1177
- pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
1178
- body: query,
1366
+ queryTable({
1367
+ workspace,
1368
+ region,
1369
+ database,
1370
+ branch,
1371
+ table,
1372
+ filter,
1373
+ sort,
1374
+ page,
1375
+ columns
1376
+ }) {
1377
+ return operationsByTag.searchAndFilter.queryTable({
1378
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
1379
+ body: { filter, sort, page, columns },
1380
+ ...this.extraProps
1381
+ });
1382
+ }
1383
+ searchTable({
1384
+ workspace,
1385
+ region,
1386
+ database,
1387
+ branch,
1388
+ table,
1389
+ query,
1390
+ fuzziness,
1391
+ target,
1392
+ prefix,
1393
+ filter,
1394
+ highlight,
1395
+ boosters
1396
+ }) {
1397
+ return operationsByTag.searchAndFilter.searchTable({
1398
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
1399
+ body: { query, fuzziness, target, prefix, filter, highlight, boosters },
1400
+ ...this.extraProps
1401
+ });
1402
+ }
1403
+ searchBranch({
1404
+ workspace,
1405
+ region,
1406
+ database,
1407
+ branch,
1408
+ tables,
1409
+ query,
1410
+ fuzziness,
1411
+ prefix,
1412
+ highlight
1413
+ }) {
1414
+ return operationsByTag.searchAndFilter.searchBranch({
1415
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1416
+ body: { tables, query, fuzziness, prefix, highlight },
1417
+ ...this.extraProps
1418
+ });
1419
+ }
1420
+ summarizeTable({
1421
+ workspace,
1422
+ region,
1423
+ database,
1424
+ branch,
1425
+ table,
1426
+ filter,
1427
+ columns,
1428
+ summaries,
1429
+ sort,
1430
+ summariesFilter,
1431
+ page
1432
+ }) {
1433
+ return operationsByTag.searchAndFilter.summarizeTable({
1434
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
1435
+ body: { filter, columns, summaries, sort, summariesFilter, page },
1436
+ ...this.extraProps
1437
+ });
1438
+ }
1439
+ aggregateTable({
1440
+ workspace,
1441
+ region,
1442
+ database,
1443
+ branch,
1444
+ table,
1445
+ filter,
1446
+ aggs
1447
+ }) {
1448
+ return operationsByTag.searchAndFilter.aggregateTable({
1449
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
1450
+ body: { filter, aggs },
1179
1451
  ...this.extraProps
1180
1452
  });
1181
1453
  }
@@ -1184,123 +1456,281 @@ class MigrationRequestsApi {
1184
1456
  constructor(extraProps) {
1185
1457
  this.extraProps = extraProps;
1186
1458
  }
1187
- queryMigrationRequests(workspace, database, options = {}) {
1459
+ queryMigrationRequests({
1460
+ workspace,
1461
+ region,
1462
+ database,
1463
+ filter,
1464
+ sort,
1465
+ page,
1466
+ columns
1467
+ }) {
1188
1468
  return operationsByTag.migrationRequests.queryMigrationRequests({
1189
- pathParams: { workspace, dbName: database },
1190
- body: options,
1469
+ pathParams: { workspace, region, dbName: database },
1470
+ body: { filter, sort, page, columns },
1191
1471
  ...this.extraProps
1192
1472
  });
1193
1473
  }
1194
- createMigrationRequest(workspace, database, options) {
1474
+ createMigrationRequest({
1475
+ workspace,
1476
+ region,
1477
+ database,
1478
+ migration
1479
+ }) {
1195
1480
  return operationsByTag.migrationRequests.createMigrationRequest({
1196
- pathParams: { workspace, dbName: database },
1197
- body: options,
1481
+ pathParams: { workspace, region, dbName: database },
1482
+ body: migration,
1198
1483
  ...this.extraProps
1199
1484
  });
1200
1485
  }
1201
- getMigrationRequest(workspace, database, migrationRequest) {
1486
+ getMigrationRequest({
1487
+ workspace,
1488
+ region,
1489
+ database,
1490
+ migrationRequest
1491
+ }) {
1202
1492
  return operationsByTag.migrationRequests.getMigrationRequest({
1203
- pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
1493
+ pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
1204
1494
  ...this.extraProps
1205
1495
  });
1206
1496
  }
1207
- updateMigrationRequest(workspace, database, migrationRequest, options) {
1497
+ updateMigrationRequest({
1498
+ workspace,
1499
+ region,
1500
+ database,
1501
+ migrationRequest,
1502
+ update
1503
+ }) {
1208
1504
  return operationsByTag.migrationRequests.updateMigrationRequest({
1209
- pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
1210
- body: options,
1505
+ pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
1506
+ body: update,
1211
1507
  ...this.extraProps
1212
1508
  });
1213
1509
  }
1214
- listMigrationRequestsCommits(workspace, database, migrationRequest, options = {}) {
1510
+ listMigrationRequestsCommits({
1511
+ workspace,
1512
+ region,
1513
+ database,
1514
+ migrationRequest,
1515
+ page
1516
+ }) {
1215
1517
  return operationsByTag.migrationRequests.listMigrationRequestsCommits({
1216
- pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
1217
- body: options,
1518
+ pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
1519
+ body: { page },
1218
1520
  ...this.extraProps
1219
1521
  });
1220
1522
  }
1221
- compareMigrationRequest(workspace, database, migrationRequest) {
1523
+ compareMigrationRequest({
1524
+ workspace,
1525
+ region,
1526
+ database,
1527
+ migrationRequest
1528
+ }) {
1222
1529
  return operationsByTag.migrationRequests.compareMigrationRequest({
1223
- pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
1530
+ pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
1224
1531
  ...this.extraProps
1225
1532
  });
1226
1533
  }
1227
- getMigrationRequestIsMerged(workspace, database, migrationRequest) {
1534
+ getMigrationRequestIsMerged({
1535
+ workspace,
1536
+ region,
1537
+ database,
1538
+ migrationRequest
1539
+ }) {
1228
1540
  return operationsByTag.migrationRequests.getMigrationRequestIsMerged({
1229
- pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
1541
+ pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
1230
1542
  ...this.extraProps
1231
1543
  });
1232
1544
  }
1233
- mergeMigrationRequest(workspace, database, migrationRequest) {
1545
+ mergeMigrationRequest({
1546
+ workspace,
1547
+ region,
1548
+ database,
1549
+ migrationRequest
1550
+ }) {
1234
1551
  return operationsByTag.migrationRequests.mergeMigrationRequest({
1235
- pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
1552
+ pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
1236
1553
  ...this.extraProps
1237
1554
  });
1238
1555
  }
1239
1556
  }
1240
- class BranchSchemaApi {
1557
+ class MigrationsApi {
1241
1558
  constructor(extraProps) {
1242
1559
  this.extraProps = extraProps;
1243
1560
  }
1244
- getBranchMigrationHistory(workspace, database, branch, options = {}) {
1245
- return operationsByTag.branchSchema.getBranchMigrationHistory({
1246
- pathParams: { workspace, dbBranchName: `${database}:${branch}` },
1247
- body: options,
1561
+ getBranchMigrationHistory({
1562
+ workspace,
1563
+ region,
1564
+ database,
1565
+ branch,
1566
+ limit,
1567
+ startFrom
1568
+ }) {
1569
+ return operationsByTag.migrations.getBranchMigrationHistory({
1570
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1571
+ body: { limit, startFrom },
1572
+ ...this.extraProps
1573
+ });
1574
+ }
1575
+ getBranchMigrationPlan({
1576
+ workspace,
1577
+ region,
1578
+ database,
1579
+ branch,
1580
+ schema
1581
+ }) {
1582
+ return operationsByTag.migrations.getBranchMigrationPlan({
1583
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1584
+ body: schema,
1248
1585
  ...this.extraProps
1249
1586
  });
1250
1587
  }
1251
- executeBranchMigrationPlan(workspace, database, branch, migrationPlan) {
1252
- return operationsByTag.branchSchema.executeBranchMigrationPlan({
1253
- pathParams: { workspace, dbBranchName: `${database}:${branch}` },
1254
- body: migrationPlan,
1588
+ executeBranchMigrationPlan({
1589
+ workspace,
1590
+ region,
1591
+ database,
1592
+ branch,
1593
+ plan
1594
+ }) {
1595
+ return operationsByTag.migrations.executeBranchMigrationPlan({
1596
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1597
+ body: plan,
1255
1598
  ...this.extraProps
1256
1599
  });
1257
1600
  }
1258
- getBranchMigrationPlan(workspace, database, branch, schema) {
1259
- return operationsByTag.branchSchema.getBranchMigrationPlan({
1260
- pathParams: { workspace, dbBranchName: `${database}:${branch}` },
1261
- body: schema,
1601
+ getBranchSchemaHistory({
1602
+ workspace,
1603
+ region,
1604
+ database,
1605
+ branch,
1606
+ page
1607
+ }) {
1608
+ return operationsByTag.migrations.getBranchSchemaHistory({
1609
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1610
+ body: { page },
1262
1611
  ...this.extraProps
1263
1612
  });
1264
1613
  }
1265
- compareBranchWithUserSchema(workspace, database, branch, schema) {
1266
- return operationsByTag.branchSchema.compareBranchWithUserSchema({
1267
- pathParams: { workspace, dbBranchName: `${database}:${branch}` },
1614
+ compareBranchWithUserSchema({
1615
+ workspace,
1616
+ region,
1617
+ database,
1618
+ branch,
1619
+ schema
1620
+ }) {
1621
+ return operationsByTag.migrations.compareBranchWithUserSchema({
1622
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1268
1623
  body: { schema },
1269
1624
  ...this.extraProps
1270
1625
  });
1271
1626
  }
1272
- compareBranchSchemas(workspace, database, branch, branchName, schema) {
1273
- return operationsByTag.branchSchema.compareBranchSchemas({
1274
- pathParams: { workspace, dbBranchName: `${database}:${branch}`, branchName },
1627
+ compareBranchSchemas({
1628
+ workspace,
1629
+ region,
1630
+ database,
1631
+ branch,
1632
+ compare,
1633
+ schema
1634
+ }) {
1635
+ return operationsByTag.migrations.compareBranchSchemas({
1636
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, branchName: compare },
1275
1637
  body: { schema },
1276
1638
  ...this.extraProps
1277
1639
  });
1278
1640
  }
1279
- updateBranchSchema(workspace, database, branch, migration) {
1280
- return operationsByTag.branchSchema.updateBranchSchema({
1281
- pathParams: { workspace, dbBranchName: `${database}:${branch}` },
1641
+ updateBranchSchema({
1642
+ workspace,
1643
+ region,
1644
+ database,
1645
+ branch,
1646
+ migration
1647
+ }) {
1648
+ return operationsByTag.migrations.updateBranchSchema({
1649
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1282
1650
  body: migration,
1283
1651
  ...this.extraProps
1284
1652
  });
1285
1653
  }
1286
- previewBranchSchemaEdit(workspace, database, branch, migration) {
1287
- return operationsByTag.branchSchema.previewBranchSchemaEdit({
1288
- pathParams: { workspace, dbBranchName: `${database}:${branch}` },
1289
- body: migration,
1654
+ previewBranchSchemaEdit({
1655
+ workspace,
1656
+ region,
1657
+ database,
1658
+ branch,
1659
+ data
1660
+ }) {
1661
+ return operationsByTag.migrations.previewBranchSchemaEdit({
1662
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1663
+ body: data,
1290
1664
  ...this.extraProps
1291
1665
  });
1292
1666
  }
1293
- applyBranchSchemaEdit(workspace, database, branch, edits) {
1294
- return operationsByTag.branchSchema.applyBranchSchemaEdit({
1295
- pathParams: { workspace, dbBranchName: `${database}:${branch}` },
1667
+ applyBranchSchemaEdit({
1668
+ workspace,
1669
+ region,
1670
+ database,
1671
+ branch,
1672
+ edits
1673
+ }) {
1674
+ return operationsByTag.migrations.applyBranchSchemaEdit({
1675
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1296
1676
  body: { edits },
1297
1677
  ...this.extraProps
1298
1678
  });
1299
1679
  }
1300
- getBranchSchemaHistory(workspace, database, branch, options = {}) {
1301
- return operationsByTag.branchSchema.getBranchSchemaHistory({
1302
- pathParams: { workspace, dbBranchName: `${database}:${branch}` },
1303
- body: options,
1680
+ }
1681
+ class DatabaseApi {
1682
+ constructor(extraProps) {
1683
+ this.extraProps = extraProps;
1684
+ }
1685
+ getDatabaseList({ workspace }) {
1686
+ return operationsByTag.databases.getDatabaseList({
1687
+ pathParams: { workspaceId: workspace },
1688
+ ...this.extraProps
1689
+ });
1690
+ }
1691
+ createDatabase({
1692
+ workspace,
1693
+ database,
1694
+ data
1695
+ }) {
1696
+ return operationsByTag.databases.createDatabase({
1697
+ pathParams: { workspaceId: workspace, dbName: database },
1698
+ body: data,
1699
+ ...this.extraProps
1700
+ });
1701
+ }
1702
+ deleteDatabase({
1703
+ workspace,
1704
+ database
1705
+ }) {
1706
+ return operationsByTag.databases.deleteDatabase({
1707
+ pathParams: { workspaceId: workspace, dbName: database },
1708
+ ...this.extraProps
1709
+ });
1710
+ }
1711
+ getDatabaseMetadata({
1712
+ workspace,
1713
+ database
1714
+ }) {
1715
+ return operationsByTag.databases.getDatabaseMetadata({
1716
+ pathParams: { workspaceId: workspace, dbName: database },
1717
+ ...this.extraProps
1718
+ });
1719
+ }
1720
+ updateDatabaseMetadata({
1721
+ workspace,
1722
+ database,
1723
+ metadata
1724
+ }) {
1725
+ return operationsByTag.databases.updateDatabaseMetadata({
1726
+ pathParams: { workspaceId: workspace, dbName: database },
1727
+ body: metadata,
1728
+ ...this.extraProps
1729
+ });
1730
+ }
1731
+ listRegions({ workspace }) {
1732
+ return operationsByTag.databases.listRegions({
1733
+ pathParams: { workspaceId: workspace },
1304
1734
  ...this.extraProps
1305
1735
  });
1306
1736
  }
@@ -1316,6 +1746,20 @@ class XataApiPlugin {
1316
1746
  class XataPlugin {
1317
1747
  }
1318
1748
 
1749
+ function generateUUID() {
1750
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
1751
+ const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
1752
+ return v.toString(16);
1753
+ });
1754
+ }
1755
+
1756
+ function cleanFilter(filter) {
1757
+ if (!filter)
1758
+ return void 0;
1759
+ const values = Object.values(filter).filter(Boolean).filter((value) => Array.isArray(value) ? value.length > 0 : true);
1760
+ return values.length > 0 ? filter : void 0;
1761
+ }
1762
+
1319
1763
  var __accessCheck$6 = (obj, member, msg) => {
1320
1764
  if (!member.has(obj))
1321
1765
  throw TypeError("Cannot " + msg);
@@ -1455,7 +1899,7 @@ const _Query = class {
1455
1899
  __privateGet$5(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
1456
1900
  __privateGet$5(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
1457
1901
  __privateGet$5(this, _data).sort = data.sort ?? parent?.sort;
1458
- __privateGet$5(this, _data).columns = data.columns ?? parent?.columns ?? ["*"];
1902
+ __privateGet$5(this, _data).columns = data.columns ?? parent?.columns;
1459
1903
  __privateGet$5(this, _data).pagination = data.pagination ?? parent?.pagination;
1460
1904
  __privateGet$5(this, _data).cache = data.cache ?? parent?.cache;
1461
1905
  this.any = this.any.bind(this);
@@ -1571,6 +2015,16 @@ const _Query = class {
1571
2015
  throw new Error("No results found.");
1572
2016
  return records[0];
1573
2017
  }
2018
+ async summarize(params = {}) {
2019
+ const { summaries, summariesFilter, ...options } = params;
2020
+ const query = new _Query(
2021
+ __privateGet$5(this, _repository),
2022
+ __privateGet$5(this, _table$1),
2023
+ options,
2024
+ __privateGet$5(this, _data)
2025
+ );
2026
+ return __privateGet$5(this, _repository).summarizeTable(query, summaries, summariesFilter);
2027
+ }
1574
2028
  cache(ttl) {
1575
2029
  return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
1576
2030
  }
@@ -1607,7 +2061,7 @@ cleanFilterConstraint_fn = function(column, value) {
1607
2061
  };
1608
2062
  function cleanParent(data, parent) {
1609
2063
  if (isCursorPaginationOptions(data.pagination)) {
1610
- return { ...parent, sorting: void 0, filter: void 0 };
2064
+ return { ...parent, sort: void 0, filter: void 0 };
1611
2065
  }
1612
2066
  return parent;
1613
2067
  }
@@ -1666,7 +2120,7 @@ var __privateMethod$2 = (obj, member, method) => {
1666
2120
  __accessCheck$4(obj, member, "access private method");
1667
2121
  return method;
1668
2122
  };
1669
- 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;
2123
+ 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, _deleteRecords, deleteRecords_fn, _setCacheQuery, setCacheQuery_fn, _getCacheQuery, getCacheQuery_fn, _getSchemaTables$1, getSchemaTables_fn$1;
1670
2124
  class Repository extends Query {
1671
2125
  }
1672
2126
  class RestRepository extends Query {
@@ -1682,6 +2136,7 @@ class RestRepository extends Query {
1682
2136
  __privateAdd$4(this, _updateRecordWithID);
1683
2137
  __privateAdd$4(this, _upsertRecordWithID);
1684
2138
  __privateAdd$4(this, _deleteRecord);
2139
+ __privateAdd$4(this, _deleteRecords);
1685
2140
  __privateAdd$4(this, _setCacheQuery);
1686
2141
  __privateAdd$4(this, _getCacheQuery);
1687
2142
  __privateAdd$4(this, _getSchemaTables$1);
@@ -1692,10 +2147,13 @@ class RestRepository extends Query {
1692
2147
  __privateAdd$4(this, _schemaTables$2, void 0);
1693
2148
  __privateAdd$4(this, _trace, void 0);
1694
2149
  __privateSet$4(this, _table, options.table);
1695
- __privateSet$4(this, _getFetchProps, options.pluginOptions.getFetchProps);
1696
2150
  __privateSet$4(this, _db, options.db);
1697
2151
  __privateSet$4(this, _cache, options.pluginOptions.cache);
1698
2152
  __privateSet$4(this, _schemaTables$2, options.schemaTables);
2153
+ __privateSet$4(this, _getFetchProps, async () => {
2154
+ const props = await options.pluginOptions.getFetchProps();
2155
+ return { ...props, sessionID: generateUUID() };
2156
+ });
1699
2157
  const trace = options.pluginOptions.trace ?? defaultTrace;
1700
2158
  __privateSet$4(this, _trace, async (name, fn, options2 = {}) => {
1701
2159
  return trace(name, fn, {
@@ -1706,8 +2164,9 @@ class RestRepository extends Query {
1706
2164
  });
1707
2165
  });
1708
2166
  }
1709
- async create(a, b, c) {
2167
+ async create(a, b, c, d) {
1710
2168
  return __privateGet$4(this, _trace).call(this, "create", async () => {
2169
+ const ifVersion = parseIfVersion(b, c, d);
1711
2170
  if (Array.isArray(a)) {
1712
2171
  if (a.length === 0)
1713
2172
  return [];
@@ -1718,13 +2177,13 @@ class RestRepository extends Query {
1718
2177
  if (a === "")
1719
2178
  throw new Error("The id can't be empty");
1720
2179
  const columns = isStringArray(c) ? c : void 0;
1721
- return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns);
2180
+ return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
1722
2181
  }
1723
2182
  if (isObject(a) && isString(a.id)) {
1724
2183
  if (a.id === "")
1725
2184
  throw new Error("The id can't be empty");
1726
2185
  const columns = isStringArray(b) ? b : void 0;
1727
- return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns);
2186
+ return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: true, ifVersion });
1728
2187
  }
1729
2188
  if (isObject(a)) {
1730
2189
  const columns = isStringArray(b) ? b : void 0;
@@ -1755,6 +2214,7 @@ class RestRepository extends Query {
1755
2214
  pathParams: {
1756
2215
  workspace: "{workspaceId}",
1757
2216
  dbBranchName: "{dbBranch}",
2217
+ region: "{region}",
1758
2218
  tableName: __privateGet$4(this, _table),
1759
2219
  recordId: id
1760
2220
  },
@@ -1792,8 +2252,9 @@ class RestRepository extends Query {
1792
2252
  return result;
1793
2253
  });
1794
2254
  }
1795
- async update(a, b, c) {
2255
+ async update(a, b, c, d) {
1796
2256
  return __privateGet$4(this, _trace).call(this, "update", async () => {
2257
+ const ifVersion = parseIfVersion(b, c, d);
1797
2258
  if (Array.isArray(a)) {
1798
2259
  if (a.length === 0)
1799
2260
  return [];
@@ -1805,18 +2266,18 @@ class RestRepository extends Query {
1805
2266
  }
1806
2267
  if (isString(a) && isObject(b)) {
1807
2268
  const columns = isStringArray(c) ? c : void 0;
1808
- return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns);
2269
+ return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
1809
2270
  }
1810
2271
  if (isObject(a) && isString(a.id)) {
1811
2272
  const columns = isStringArray(b) ? b : void 0;
1812
- return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
2273
+ return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
1813
2274
  }
1814
2275
  throw new Error("Invalid arguments for update method");
1815
2276
  });
1816
2277
  }
1817
- async updateOrThrow(a, b, c) {
2278
+ async updateOrThrow(a, b, c, d) {
1818
2279
  return __privateGet$4(this, _trace).call(this, "updateOrThrow", async () => {
1819
- const result = await this.update(a, b, c);
2280
+ const result = await this.update(a, b, c, d);
1820
2281
  if (Array.isArray(result)) {
1821
2282
  const missingIds = compact(
1822
2283
  a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
@@ -1833,8 +2294,9 @@ class RestRepository extends Query {
1833
2294
  return result;
1834
2295
  });
1835
2296
  }
1836
- async createOrUpdate(a, b, c) {
2297
+ async createOrUpdate(a, b, c, d) {
1837
2298
  return __privateGet$4(this, _trace).call(this, "createOrUpdate", async () => {
2299
+ const ifVersion = parseIfVersion(b, c, d);
1838
2300
  if (Array.isArray(a)) {
1839
2301
  if (a.length === 0)
1840
2302
  return [];
@@ -1846,24 +2308,48 @@ class RestRepository extends Query {
1846
2308
  }
1847
2309
  if (isString(a) && isObject(b)) {
1848
2310
  const columns = isStringArray(c) ? c : void 0;
1849
- return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns);
2311
+ return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
1850
2312
  }
1851
2313
  if (isObject(a) && isString(a.id)) {
1852
2314
  const columns = isStringArray(c) ? c : void 0;
1853
- return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
2315
+ return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
1854
2316
  }
1855
2317
  throw new Error("Invalid arguments for createOrUpdate method");
1856
2318
  });
1857
2319
  }
2320
+ async createOrReplace(a, b, c, d) {
2321
+ return __privateGet$4(this, _trace).call(this, "createOrReplace", async () => {
2322
+ const ifVersion = parseIfVersion(b, c, d);
2323
+ if (Array.isArray(a)) {
2324
+ if (a.length === 0)
2325
+ return [];
2326
+ const columns = isStringArray(b) ? b : ["*"];
2327
+ return __privateMethod$2(this, _bulkInsertTableRecords, bulkInsertTableRecords_fn).call(this, a, columns);
2328
+ }
2329
+ if (isString(a) && isObject(b)) {
2330
+ const columns = isStringArray(c) ? c : void 0;
2331
+ return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
2332
+ }
2333
+ if (isObject(a) && isString(a.id)) {
2334
+ const columns = isStringArray(c) ? c : void 0;
2335
+ return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
2336
+ }
2337
+ throw new Error("Invalid arguments for createOrReplace method");
2338
+ });
2339
+ }
1858
2340
  async delete(a, b) {
1859
2341
  return __privateGet$4(this, _trace).call(this, "delete", async () => {
1860
2342
  if (Array.isArray(a)) {
1861
2343
  if (a.length === 0)
1862
2344
  return [];
1863
- if (a.length > 100) {
1864
- console.warn("Bulk delete operation is not optimized in the Xata API yet, this request might be slow");
1865
- }
1866
- return Promise.all(a.map((id) => this.delete(id, b)));
2345
+ const ids = a.map((o) => {
2346
+ if (isString(o))
2347
+ return o;
2348
+ if (isString(o.id))
2349
+ return o.id;
2350
+ throw new Error("Invalid arguments for delete method");
2351
+ });
2352
+ return __privateMethod$2(this, _deleteRecords, deleteRecords_fn).call(this, ids, b);
1867
2353
  }
1868
2354
  if (isString(a)) {
1869
2355
  return __privateMethod$2(this, _deleteRecord, deleteRecord_fn).call(this, a, b);
@@ -1896,7 +2382,12 @@ class RestRepository extends Query {
1896
2382
  return __privateGet$4(this, _trace).call(this, "search", async () => {
1897
2383
  const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1898
2384
  const { records } = await searchTable({
1899
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table) },
2385
+ pathParams: {
2386
+ workspace: "{workspaceId}",
2387
+ dbBranchName: "{dbBranch}",
2388
+ region: "{region}",
2389
+ tableName: __privateGet$4(this, _table)
2390
+ },
1900
2391
  body: {
1901
2392
  query,
1902
2393
  fuzziness: options.fuzziness,
@@ -1915,7 +2406,12 @@ class RestRepository extends Query {
1915
2406
  return __privateGet$4(this, _trace).call(this, "aggregate", async () => {
1916
2407
  const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1917
2408
  const result = await aggregateTable({
1918
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table) },
2409
+ pathParams: {
2410
+ workspace: "{workspaceId}",
2411
+ dbBranchName: "{dbBranch}",
2412
+ region: "{region}",
2413
+ tableName: __privateGet$4(this, _table)
2414
+ },
1919
2415
  body: { aggs, filter },
1920
2416
  ...fetchProps
1921
2417
  });
@@ -1928,16 +2424,20 @@ class RestRepository extends Query {
1928
2424
  if (cacheQuery)
1929
2425
  return new Page(query, cacheQuery.meta, cacheQuery.records);
1930
2426
  const data = query.getQueryOptions();
1931
- const body = {
1932
- filter: cleanFilter(data.filter),
1933
- sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
1934
- page: data.pagination,
1935
- columns: data.columns
1936
- };
1937
2427
  const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1938
2428
  const { meta, records: objects } = await queryTable({
1939
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table) },
1940
- body,
2429
+ pathParams: {
2430
+ workspace: "{workspaceId}",
2431
+ dbBranchName: "{dbBranch}",
2432
+ region: "{region}",
2433
+ tableName: __privateGet$4(this, _table)
2434
+ },
2435
+ body: {
2436
+ filter: cleanFilter(data.filter),
2437
+ sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
2438
+ page: data.pagination,
2439
+ columns: data.columns ?? ["*"]
2440
+ },
1941
2441
  ...fetchProps
1942
2442
  });
1943
2443
  const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
@@ -1948,6 +2448,30 @@ class RestRepository extends Query {
1948
2448
  return new Page(query, meta, records);
1949
2449
  });
1950
2450
  }
2451
+ async summarizeTable(query, summaries, summariesFilter) {
2452
+ return __privateGet$4(this, _trace).call(this, "summarize", async () => {
2453
+ const data = query.getQueryOptions();
2454
+ const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
2455
+ const result = await summarizeTable({
2456
+ pathParams: {
2457
+ workspace: "{workspaceId}",
2458
+ dbBranchName: "{dbBranch}",
2459
+ region: "{region}",
2460
+ tableName: __privateGet$4(this, _table)
2461
+ },
2462
+ body: {
2463
+ filter: cleanFilter(data.filter),
2464
+ sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
2465
+ columns: data.columns,
2466
+ page: data.pagination?.size !== void 0 ? { size: data.pagination?.size } : void 0,
2467
+ summaries,
2468
+ summariesFilter
2469
+ },
2470
+ ...fetchProps
2471
+ });
2472
+ return result;
2473
+ });
2474
+ }
1951
2475
  }
1952
2476
  _table = new WeakMap();
1953
2477
  _getFetchProps = new WeakMap();
@@ -1963,6 +2487,7 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
1963
2487
  pathParams: {
1964
2488
  workspace: "{workspaceId}",
1965
2489
  dbBranchName: "{dbBranch}",
2490
+ region: "{region}",
1966
2491
  tableName: __privateGet$4(this, _table)
1967
2492
  },
1968
2493
  queryParams: { columns },
@@ -1973,18 +2498,19 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
1973
2498
  return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
1974
2499
  };
1975
2500
  _insertRecordWithId = new WeakSet();
1976
- insertRecordWithId_fn = async function(recordId, object, columns = ["*"]) {
2501
+ insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
1977
2502
  const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1978
2503
  const record = transformObjectLinks(object);
1979
2504
  const response = await insertRecordWithID({
1980
2505
  pathParams: {
1981
2506
  workspace: "{workspaceId}",
1982
2507
  dbBranchName: "{dbBranch}",
2508
+ region: "{region}",
1983
2509
  tableName: __privateGet$4(this, _table),
1984
2510
  recordId
1985
2511
  },
1986
2512
  body: record,
1987
- queryParams: { createOnly: true, columns },
2513
+ queryParams: { createOnly, columns, ifVersion },
1988
2514
  ...fetchProps
1989
2515
  });
1990
2516
  const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
@@ -1995,7 +2521,12 @@ bulkInsertTableRecords_fn = async function(objects, columns = ["*"]) {
1995
2521
  const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
1996
2522
  const records = objects.map((object) => transformObjectLinks(object));
1997
2523
  const response = await bulkInsertTableRecords({
1998
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table) },
2524
+ pathParams: {
2525
+ workspace: "{workspaceId}",
2526
+ dbBranchName: "{dbBranch}",
2527
+ region: "{region}",
2528
+ tableName: __privateGet$4(this, _table)
2529
+ },
1999
2530
  queryParams: { columns },
2000
2531
  body: { records },
2001
2532
  ...fetchProps
@@ -2007,13 +2538,19 @@ bulkInsertTableRecords_fn = async function(objects, columns = ["*"]) {
2007
2538
  return response.records?.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, columns));
2008
2539
  };
2009
2540
  _updateRecordWithID = new WeakSet();
2010
- updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
2541
+ updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
2011
2542
  const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
2012
2543
  const record = transformObjectLinks(object);
2013
2544
  try {
2014
2545
  const response = await updateRecordWithID({
2015
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table), recordId },
2016
- queryParams: { columns },
2546
+ pathParams: {
2547
+ workspace: "{workspaceId}",
2548
+ dbBranchName: "{dbBranch}",
2549
+ region: "{region}",
2550
+ tableName: __privateGet$4(this, _table),
2551
+ recordId
2552
+ },
2553
+ queryParams: { columns, ifVersion },
2017
2554
  body: record,
2018
2555
  ...fetchProps
2019
2556
  });
@@ -2027,11 +2564,17 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
2027
2564
  }
2028
2565
  };
2029
2566
  _upsertRecordWithID = new WeakSet();
2030
- upsertRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
2567
+ upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
2031
2568
  const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
2032
2569
  const response = await upsertRecordWithID({
2033
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table), recordId },
2034
- queryParams: { columns },
2570
+ pathParams: {
2571
+ workspace: "{workspaceId}",
2572
+ dbBranchName: "{dbBranch}",
2573
+ region: "{region}",
2574
+ tableName: __privateGet$4(this, _table),
2575
+ recordId
2576
+ },
2577
+ queryParams: { columns, ifVersion },
2035
2578
  body: object,
2036
2579
  ...fetchProps
2037
2580
  });
@@ -2043,7 +2586,13 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
2043
2586
  const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
2044
2587
  try {
2045
2588
  const response = await deleteRecord({
2046
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", tableName: __privateGet$4(this, _table), recordId },
2589
+ pathParams: {
2590
+ workspace: "{workspaceId}",
2591
+ dbBranchName: "{dbBranch}",
2592
+ region: "{region}",
2593
+ tableName: __privateGet$4(this, _table),
2594
+ recordId
2595
+ },
2047
2596
  queryParams: { columns },
2048
2597
  ...fetchProps
2049
2598
  });
@@ -2056,6 +2605,29 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
2056
2605
  throw e;
2057
2606
  }
2058
2607
  };
2608
+ _deleteRecords = new WeakSet();
2609
+ deleteRecords_fn = async function(recordIds, columns = ["*"]) {
2610
+ const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
2611
+ const operations = recordIds.map((id) => ({ delete: { table: __privateGet$4(this, _table), id } }));
2612
+ try {
2613
+ const objects = await this.read(recordIds, columns);
2614
+ await branchTransaction({
2615
+ pathParams: {
2616
+ workspace: "{workspaceId}",
2617
+ dbBranchName: "{dbBranch}",
2618
+ region: "{region}"
2619
+ },
2620
+ body: { operations },
2621
+ ...fetchProps
2622
+ });
2623
+ return objects;
2624
+ } catch (e) {
2625
+ if (isObject(e) && e.status === 404) {
2626
+ return null;
2627
+ }
2628
+ throw e;
2629
+ }
2630
+ };
2059
2631
  _setCacheQuery = new WeakSet();
2060
2632
  setCacheQuery_fn = async function(query, meta, records) {
2061
2633
  await __privateGet$4(this, _cache).set(`query_${__privateGet$4(this, _table)}:${query.key()}`, { date: new Date(), meta, records });
@@ -2078,7 +2650,7 @@ getSchemaTables_fn$1 = async function() {
2078
2650
  return __privateGet$4(this, _schemaTables$2);
2079
2651
  const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
2080
2652
  const { schema } = await getBranchDetails({
2081
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
2653
+ pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
2082
2654
  ...fetchProps
2083
2655
  });
2084
2656
  __privateSet$4(this, _schemaTables$2, schema.tables);
@@ -2144,8 +2716,15 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
2144
2716
  result.read = function(columns2) {
2145
2717
  return db[table].read(result["id"], columns2);
2146
2718
  };
2147
- result.update = function(data, columns2) {
2148
- return db[table].update(result["id"], data, columns2);
2719
+ result.update = function(data, b, c) {
2720
+ const columns2 = isStringArray(b) ? b : ["*"];
2721
+ const ifVersion = parseIfVersion(b, c);
2722
+ return db[table].update(result["id"], data, columns2, { ifVersion });
2723
+ };
2724
+ result.replace = function(data, b, c) {
2725
+ const columns2 = isStringArray(b) ? b : ["*"];
2726
+ const ifVersion = parseIfVersion(b, c);
2727
+ return db[table].createOrReplace(result["id"], data, columns2, { ifVersion });
2149
2728
  };
2150
2729
  result.delete = function() {
2151
2730
  return db[table].delete(result["id"]);
@@ -2153,7 +2732,7 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
2153
2732
  result.getMetadata = function() {
2154
2733
  return xata;
2155
2734
  };
2156
- for (const prop of ["read", "update", "delete", "getMetadata"]) {
2735
+ for (const prop of ["read", "update", "replace", "delete", "getMetadata"]) {
2157
2736
  Object.defineProperty(result, prop, { enumerable: false });
2158
2737
  }
2159
2738
  Object.freeze(result);
@@ -2169,12 +2748,6 @@ function extractId(value) {
2169
2748
  return value.id;
2170
2749
  return void 0;
2171
2750
  }
2172
- function cleanFilter(filter) {
2173
- if (!filter)
2174
- return void 0;
2175
- const values = Object.values(filter).filter(Boolean).filter((value) => Array.isArray(value) ? value.length > 0 : true);
2176
- return values.length > 0 ? filter : void 0;
2177
- }
2178
2751
  function isValidColumn(columns, column) {
2179
2752
  if (columns.includes("*"))
2180
2753
  return true;
@@ -2184,6 +2757,14 @@ function isValidColumn(columns, column) {
2184
2757
  }
2185
2758
  return columns.includes(column.name);
2186
2759
  }
2760
+ function parseIfVersion(...args) {
2761
+ for (const arg of args) {
2762
+ if (isObject(arg) && isNumber(arg.ifVersion)) {
2763
+ return arg.ifVersion;
2764
+ }
2765
+ }
2766
+ return void 0;
2767
+ }
2187
2768
 
2188
2769
  var __accessCheck$3 = (obj, member, msg) => {
2189
2770
  if (!member.has(obj))
@@ -2371,7 +2952,7 @@ search_fn = async function(query, options, getFetchProps) {
2371
2952
  const fetchProps = await getFetchProps();
2372
2953
  const { tables, fuzziness, highlight, prefix } = options ?? {};
2373
2954
  const { records } = await searchBranch({
2374
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
2955
+ pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
2375
2956
  body: { tables, query, fuzziness, prefix, highlight },
2376
2957
  ...fetchProps
2377
2958
  });
@@ -2383,7 +2964,7 @@ getSchemaTables_fn = async function(getFetchProps) {
2383
2964
  return __privateGet$1(this, _schemaTables);
2384
2965
  const fetchProps = await getFetchProps();
2385
2966
  const { schema } = await getBranchDetails({
2386
- pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
2967
+ pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
2387
2968
  ...fetchProps
2388
2969
  });
2389
2970
  __privateSet$1(this, _schemaTables, schema.tables);
@@ -2421,14 +3002,17 @@ async function resolveXataBranch(gitBranch, options) {
2421
3002
  "An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
2422
3003
  );
2423
3004
  const [protocol, , host, , dbName] = databaseURL.split("/");
2424
- const [workspace] = host.split(".");
3005
+ const urlParts = parseWorkspacesUrlParts(host);
3006
+ if (!urlParts)
3007
+ throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
3008
+ const { workspace, region } = urlParts;
2425
3009
  const { fallbackBranch } = getEnvironment();
2426
3010
  const { branch } = await resolveBranch({
2427
3011
  apiKey,
2428
3012
  apiUrl: databaseURL,
2429
3013
  fetchImpl: getFetchImplementation(options?.fetchImpl),
2430
3014
  workspacesApiUrl: `${protocol}//${host}`,
2431
- pathParams: { dbName, workspace },
3015
+ pathParams: { dbName, workspace, region },
2432
3016
  queryParams: { gitBranch, fallbackBranch },
2433
3017
  trace: defaultTrace
2434
3018
  });
@@ -2446,15 +3030,17 @@ async function getDatabaseBranch(branch, options) {
2446
3030
  "An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
2447
3031
  );
2448
3032
  const [protocol, , host, , database] = databaseURL.split("/");
2449
- const [workspace] = host.split(".");
2450
- const dbBranchName = `${database}:${branch}`;
3033
+ const urlParts = parseWorkspacesUrlParts(host);
3034
+ if (!urlParts)
3035
+ throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
3036
+ const { workspace, region } = urlParts;
2451
3037
  try {
2452
3038
  return await getBranchDetails({
2453
3039
  apiKey,
2454
3040
  apiUrl: databaseURL,
2455
3041
  fetchImpl: getFetchImplementation(options?.fetchImpl),
2456
3042
  workspacesApiUrl: `${protocol}//${host}`,
2457
- pathParams: { dbBranchName, workspace },
3043
+ pathParams: { dbBranchName: `${database}:${branch}`, workspace, region },
2458
3044
  trace: defaultTrace
2459
3045
  });
2460
3046
  } catch (err) {
@@ -2545,8 +3131,8 @@ const buildClient = (plugins) => {
2545
3131
  if (!databaseURL) {
2546
3132
  throw new Error("Option databaseURL is required");
2547
3133
  }
2548
- return { fetch, databaseURL, apiKey, branch, cache, trace };
2549
- }, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({ fetch, apiKey, databaseURL, branch, trace }) {
3134
+ return { fetch, databaseURL, apiKey, branch, cache, trace, clientID: generateUUID() };
3135
+ }, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({ fetch, apiKey, databaseURL, branch, trace, clientID }) {
2550
3136
  const branchValue = await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, branch);
2551
3137
  if (!branchValue)
2552
3138
  throw new Error("Unable to resolve branch value");
@@ -2559,7 +3145,8 @@ const buildClient = (plugins) => {
2559
3145
  const newPath = path.replace(/^\/db\/[^/]+/, hasBranch !== void 0 ? `:${branchValue}` : "");
2560
3146
  return databaseURL + newPath;
2561
3147
  },
2562
- trace
3148
+ trace,
3149
+ clientID
2563
3150
  };
2564
3151
  }, _evaluateBranch = new WeakSet(), evaluateBranch_fn = async function(param) {
2565
3152
  if (__privateGet(this, _branch))
@@ -2671,5 +3258,5 @@ class XataError extends Error {
2671
3258
  }
2672
3259
  }
2673
3260
 
2674
- 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, aggregateTable, applyBranchSchemaEdit, buildClient, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, createBranch, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getGitBranchesMapping, getHostUrl, getMigrationRequest, getMigrationRequestIsMerged, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isHostProviderAlias, isHostProviderBuilder, isIdentifiable, isNot, isXataRecord, le, lessEquals, lessThan, lessThanEquals, listMigrationRequestsCommits, lt, lte, mergeMigrationRequest, notExists, operationsByTag, parseProviderString, pattern, previewBranchSchemaEdit, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, startsWith, summarizeTable, updateBranchMetadata, updateBranchSchema, updateColumn, updateDatabaseMetadata, updateMigrationRequest, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };
3261
+ 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, aggregateTable, applyBranchSchemaEdit, branchTransaction, buildClient, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, createBranch, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, dEPRECATEDcreateDatabase, dEPRECATEDdeleteDatabase, dEPRECATEDgetDatabaseList, dEPRECATEDgetDatabaseMetadata, dEPRECATEDupdateDatabaseMetadata, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getGitBranchesMapping, getHostUrl, getMigrationRequest, getMigrationRequestIsMerged, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isHostProviderAlias, isHostProviderBuilder, isIdentifiable, isNot, isXataRecord, le, lessEquals, lessThan, lessThanEquals, listMigrationRequestsCommits, listRegions, lt, lte, mergeMigrationRequest, notExists, operationsByTag, parseProviderString, parseWorkspacesUrlParts, pattern, previewBranchSchemaEdit, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, startsWith, summarizeTable, updateBranchMetadata, updateBranchSchema, updateColumn, updateDatabaseMetadata, updateMigrationRequest, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };
2675
3262
  //# sourceMappingURL=index.mjs.map