@xata.io/client 0.0.0-alpha.vf90263d → 0.0.0-alpha.vf9117073fa2d41de1cd4690157c24c67ca3a6650

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
@@ -242,26 +242,26 @@ function getPreviewBranch() {
242
242
  }
243
243
  }
244
244
 
245
- var __accessCheck$8 = (obj, member, msg) => {
245
+ var __accessCheck$7 = (obj, member, msg) => {
246
246
  if (!member.has(obj))
247
247
  throw TypeError("Cannot " + msg);
248
248
  };
249
- var __privateGet$8 = (obj, member, getter) => {
250
- __accessCheck$8(obj, member, "read from private field");
249
+ var __privateGet$7 = (obj, member, getter) => {
250
+ __accessCheck$7(obj, member, "read from private field");
251
251
  return getter ? getter.call(obj) : member.get(obj);
252
252
  };
253
- var __privateAdd$8 = (obj, member, value) => {
253
+ var __privateAdd$7 = (obj, member, value) => {
254
254
  if (member.has(obj))
255
255
  throw TypeError("Cannot add the same private member more than once");
256
256
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
257
257
  };
258
- var __privateSet$8 = (obj, member, value, setter) => {
259
- __accessCheck$8(obj, member, "write to private field");
258
+ var __privateSet$7 = (obj, member, value, setter) => {
259
+ __accessCheck$7(obj, member, "write to private field");
260
260
  setter ? setter.call(obj, value) : member.set(obj, value);
261
261
  return value;
262
262
  };
263
263
  var __privateMethod$4 = (obj, member, method) => {
264
- __accessCheck$8(obj, member, "access private method");
264
+ __accessCheck$7(obj, member, "access private method");
265
265
  return method;
266
266
  };
267
267
  var _fetch, _queue, _concurrency, _enqueue, enqueue_fn;
@@ -277,23 +277,23 @@ function getFetchImplementation(userFetch) {
277
277
  }
278
278
  class ApiRequestPool {
279
279
  constructor(concurrency = 10) {
280
- __privateAdd$8(this, _enqueue);
281
- __privateAdd$8(this, _fetch, void 0);
282
- __privateAdd$8(this, _queue, void 0);
283
- __privateAdd$8(this, _concurrency, void 0);
284
- __privateSet$8(this, _queue, []);
285
- __privateSet$8(this, _concurrency, concurrency);
280
+ __privateAdd$7(this, _enqueue);
281
+ __privateAdd$7(this, _fetch, void 0);
282
+ __privateAdd$7(this, _queue, void 0);
283
+ __privateAdd$7(this, _concurrency, void 0);
284
+ __privateSet$7(this, _queue, []);
285
+ __privateSet$7(this, _concurrency, concurrency);
286
286
  this.running = 0;
287
287
  this.started = 0;
288
288
  }
289
289
  setFetch(fetch2) {
290
- __privateSet$8(this, _fetch, fetch2);
290
+ __privateSet$7(this, _fetch, fetch2);
291
291
  }
292
292
  getFetch() {
293
- if (!__privateGet$8(this, _fetch)) {
293
+ if (!__privateGet$7(this, _fetch)) {
294
294
  throw new Error("Fetch not set");
295
295
  }
296
- return __privateGet$8(this, _fetch);
296
+ return __privateGet$7(this, _fetch);
297
297
  }
298
298
  request(url, options) {
299
299
  const start = /* @__PURE__ */ new Date();
@@ -325,19 +325,19 @@ _queue = new WeakMap();
325
325
  _concurrency = new WeakMap();
326
326
  _enqueue = new WeakSet();
327
327
  enqueue_fn = function(task) {
328
- const promise = new Promise((resolve) => __privateGet$8(this, _queue).push(resolve)).finally(() => {
328
+ const promise = new Promise((resolve) => __privateGet$7(this, _queue).push(resolve)).finally(() => {
329
329
  this.started--;
330
330
  this.running++;
331
331
  }).then(() => task()).finally(() => {
332
332
  this.running--;
333
- const next = __privateGet$8(this, _queue).shift();
333
+ const next = __privateGet$7(this, _queue).shift();
334
334
  if (next !== void 0) {
335
335
  this.started++;
336
336
  next();
337
337
  }
338
338
  });
339
- if (this.running + this.started < __privateGet$8(this, _concurrency)) {
340
- const next = __privateGet$8(this, _queue).shift();
339
+ if (this.running + this.started < __privateGet$7(this, _concurrency)) {
340
+ const next = __privateGet$7(this, _queue).shift();
341
341
  if (next !== void 0) {
342
342
  this.started++;
343
343
  next();
@@ -526,7 +526,7 @@ function defaultOnOpen(response) {
526
526
  }
527
527
  }
528
528
 
529
- const VERSION = "0.27.0";
529
+ const VERSION = "0.28.1";
530
530
 
531
531
  class ErrorWithCause extends Error {
532
532
  constructor(message, options) {
@@ -766,9 +766,16 @@ function parseUrl(url) {
766
766
 
767
767
  const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
768
768
 
769
- const applyMigration = (variables, signal) => dataPlaneFetch({
770
- url: "/db/{dbBranchName}/pgroll/apply",
771
- method: "post",
769
+ const applyMigration = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/pgroll/apply", method: "post", ...variables, signal });
770
+ const pgRollStatus = (variables, signal) => dataPlaneFetch({
771
+ url: "/db/{dbBranchName}/pgroll/status",
772
+ method: "get",
773
+ ...variables,
774
+ signal
775
+ });
776
+ const pgRollJobStatus = (variables, signal) => dataPlaneFetch({
777
+ url: "/db/{dbBranchName}/pgroll/jobs/{jobId}",
778
+ method: "get",
772
779
  ...variables,
773
780
  signal
774
781
  });
@@ -987,6 +994,8 @@ const sqlQuery = (variables, signal) => dataPlaneFetch({
987
994
  const operationsByTag$2 = {
988
995
  branch: {
989
996
  applyMigration,
997
+ pgRollStatus,
998
+ pgRollJobStatus,
990
999
  getBranchList,
991
1000
  getBranchDetails,
992
1001
  createBranch,
@@ -1307,29 +1316,8 @@ function parseWorkspacesUrlParts(url) {
1307
1316
  return { workspace: match[1], region: match[2] };
1308
1317
  }
1309
1318
 
1310
- var __accessCheck$7 = (obj, member, msg) => {
1311
- if (!member.has(obj))
1312
- throw TypeError("Cannot " + msg);
1313
- };
1314
- var __privateGet$7 = (obj, member, getter) => {
1315
- __accessCheck$7(obj, member, "read from private field");
1316
- return getter ? getter.call(obj) : member.get(obj);
1317
- };
1318
- var __privateAdd$7 = (obj, member, value) => {
1319
- if (member.has(obj))
1320
- throw TypeError("Cannot add the same private member more than once");
1321
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1322
- };
1323
- var __privateSet$7 = (obj, member, value, setter) => {
1324
- __accessCheck$7(obj, member, "write to private field");
1325
- setter ? setter.call(obj, value) : member.set(obj, value);
1326
- return value;
1327
- };
1328
- var _extraProps, _namespaces;
1329
- class XataApiClient {
1319
+ const buildApiClient = () => class {
1330
1320
  constructor(options = {}) {
1331
- __privateAdd$7(this, _extraProps, void 0);
1332
- __privateAdd$7(this, _namespaces, {});
1333
1321
  const provider = options.host ?? "production";
1334
1322
  const apiKey = options.apiKey ?? getAPIKey();
1335
1323
  const trace = options.trace ?? defaultTrace;
@@ -1337,7 +1325,7 @@ class XataApiClient {
1337
1325
  if (!apiKey) {
1338
1326
  throw new Error("Could not resolve a valid apiKey");
1339
1327
  }
1340
- __privateSet$7(this, _extraProps, {
1328
+ const extraProps = {
1341
1329
  apiUrl: getHostUrl(provider, "main"),
1342
1330
  workspacesApiUrl: getHostUrl(provider, "workspaces"),
1343
1331
  fetch: getFetchImplementation(options.fetch),
@@ -1346,1280 +1334,31 @@ class XataApiClient {
1346
1334
  clientName: options.clientName,
1347
1335
  xataAgentExtra: options.xataAgentExtra,
1348
1336
  clientID
1337
+ };
1338
+ return new Proxy(this, {
1339
+ get: (_target, namespace) => {
1340
+ if (operationsByTag[namespace] === void 0) {
1341
+ return void 0;
1342
+ }
1343
+ return new Proxy(
1344
+ {},
1345
+ {
1346
+ get: (_target2, operation) => {
1347
+ if (operationsByTag[namespace][operation] === void 0) {
1348
+ return void 0;
1349
+ }
1350
+ const method = operationsByTag[namespace][operation];
1351
+ return async (params) => {
1352
+ return await method({ ...params, ...extraProps });
1353
+ };
1354
+ }
1355
+ }
1356
+ );
1357
+ }
1349
1358
  });
1350
1359
  }
1351
- get user() {
1352
- if (!__privateGet$7(this, _namespaces).user)
1353
- __privateGet$7(this, _namespaces).user = new UserApi(__privateGet$7(this, _extraProps));
1354
- return __privateGet$7(this, _namespaces).user;
1355
- }
1356
- get authentication() {
1357
- if (!__privateGet$7(this, _namespaces).authentication)
1358
- __privateGet$7(this, _namespaces).authentication = new AuthenticationApi(__privateGet$7(this, _extraProps));
1359
- return __privateGet$7(this, _namespaces).authentication;
1360
- }
1361
- get workspaces() {
1362
- if (!__privateGet$7(this, _namespaces).workspaces)
1363
- __privateGet$7(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$7(this, _extraProps));
1364
- return __privateGet$7(this, _namespaces).workspaces;
1365
- }
1366
- get invites() {
1367
- if (!__privateGet$7(this, _namespaces).invites)
1368
- __privateGet$7(this, _namespaces).invites = new InvitesApi(__privateGet$7(this, _extraProps));
1369
- return __privateGet$7(this, _namespaces).invites;
1370
- }
1371
- get database() {
1372
- if (!__privateGet$7(this, _namespaces).database)
1373
- __privateGet$7(this, _namespaces).database = new DatabaseApi(__privateGet$7(this, _extraProps));
1374
- return __privateGet$7(this, _namespaces).database;
1375
- }
1376
- get branches() {
1377
- if (!__privateGet$7(this, _namespaces).branches)
1378
- __privateGet$7(this, _namespaces).branches = new BranchApi(__privateGet$7(this, _extraProps));
1379
- return __privateGet$7(this, _namespaces).branches;
1380
- }
1381
- get migrations() {
1382
- if (!__privateGet$7(this, _namespaces).migrations)
1383
- __privateGet$7(this, _namespaces).migrations = new MigrationsApi(__privateGet$7(this, _extraProps));
1384
- return __privateGet$7(this, _namespaces).migrations;
1385
- }
1386
- get migrationRequests() {
1387
- if (!__privateGet$7(this, _namespaces).migrationRequests)
1388
- __privateGet$7(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$7(this, _extraProps));
1389
- return __privateGet$7(this, _namespaces).migrationRequests;
1390
- }
1391
- get tables() {
1392
- if (!__privateGet$7(this, _namespaces).tables)
1393
- __privateGet$7(this, _namespaces).tables = new TableApi(__privateGet$7(this, _extraProps));
1394
- return __privateGet$7(this, _namespaces).tables;
1395
- }
1396
- get records() {
1397
- if (!__privateGet$7(this, _namespaces).records)
1398
- __privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
1399
- return __privateGet$7(this, _namespaces).records;
1400
- }
1401
- get files() {
1402
- if (!__privateGet$7(this, _namespaces).files)
1403
- __privateGet$7(this, _namespaces).files = new FilesApi(__privateGet$7(this, _extraProps));
1404
- return __privateGet$7(this, _namespaces).files;
1405
- }
1406
- get searchAndFilter() {
1407
- if (!__privateGet$7(this, _namespaces).searchAndFilter)
1408
- __privateGet$7(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$7(this, _extraProps));
1409
- return __privateGet$7(this, _namespaces).searchAndFilter;
1410
- }
1411
- }
1412
- _extraProps = new WeakMap();
1413
- _namespaces = new WeakMap();
1414
- class UserApi {
1415
- constructor(extraProps) {
1416
- this.extraProps = extraProps;
1417
- }
1418
- getUser() {
1419
- return operationsByTag.users.getUser({ ...this.extraProps });
1420
- }
1421
- updateUser({ user }) {
1422
- return operationsByTag.users.updateUser({ body: user, ...this.extraProps });
1423
- }
1424
- deleteUser() {
1425
- return operationsByTag.users.deleteUser({ ...this.extraProps });
1426
- }
1427
- }
1428
- class AuthenticationApi {
1429
- constructor(extraProps) {
1430
- this.extraProps = extraProps;
1431
- }
1432
- getUserAPIKeys() {
1433
- return operationsByTag.authentication.getUserAPIKeys({ ...this.extraProps });
1434
- }
1435
- createUserAPIKey({ name }) {
1436
- return operationsByTag.authentication.createUserAPIKey({
1437
- pathParams: { keyName: name },
1438
- ...this.extraProps
1439
- });
1440
- }
1441
- deleteUserAPIKey({ name }) {
1442
- return operationsByTag.authentication.deleteUserAPIKey({
1443
- pathParams: { keyName: name },
1444
- ...this.extraProps
1445
- });
1446
- }
1447
- }
1448
- class WorkspaceApi {
1449
- constructor(extraProps) {
1450
- this.extraProps = extraProps;
1451
- }
1452
- getWorkspacesList() {
1453
- return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
1454
- }
1455
- createWorkspace({ data }) {
1456
- return operationsByTag.workspaces.createWorkspace({
1457
- body: data,
1458
- ...this.extraProps
1459
- });
1460
- }
1461
- getWorkspace({ workspace }) {
1462
- return operationsByTag.workspaces.getWorkspace({
1463
- pathParams: { workspaceId: workspace },
1464
- ...this.extraProps
1465
- });
1466
- }
1467
- updateWorkspace({
1468
- workspace,
1469
- update
1470
- }) {
1471
- return operationsByTag.workspaces.updateWorkspace({
1472
- pathParams: { workspaceId: workspace },
1473
- body: update,
1474
- ...this.extraProps
1475
- });
1476
- }
1477
- deleteWorkspace({ workspace }) {
1478
- return operationsByTag.workspaces.deleteWorkspace({
1479
- pathParams: { workspaceId: workspace },
1480
- ...this.extraProps
1481
- });
1482
- }
1483
- getWorkspaceMembersList({ workspace }) {
1484
- return operationsByTag.workspaces.getWorkspaceMembersList({
1485
- pathParams: { workspaceId: workspace },
1486
- ...this.extraProps
1487
- });
1488
- }
1489
- updateWorkspaceMemberRole({
1490
- workspace,
1491
- user,
1492
- role
1493
- }) {
1494
- return operationsByTag.workspaces.updateWorkspaceMemberRole({
1495
- pathParams: { workspaceId: workspace, userId: user },
1496
- body: { role },
1497
- ...this.extraProps
1498
- });
1499
- }
1500
- removeWorkspaceMember({
1501
- workspace,
1502
- user
1503
- }) {
1504
- return operationsByTag.workspaces.removeWorkspaceMember({
1505
- pathParams: { workspaceId: workspace, userId: user },
1506
- ...this.extraProps
1507
- });
1508
- }
1509
- }
1510
- class InvitesApi {
1511
- constructor(extraProps) {
1512
- this.extraProps = extraProps;
1513
- }
1514
- inviteWorkspaceMember({
1515
- workspace,
1516
- email,
1517
- role
1518
- }) {
1519
- return operationsByTag.invites.inviteWorkspaceMember({
1520
- pathParams: { workspaceId: workspace },
1521
- body: { email, role },
1522
- ...this.extraProps
1523
- });
1524
- }
1525
- updateWorkspaceMemberInvite({
1526
- workspace,
1527
- invite,
1528
- role
1529
- }) {
1530
- return operationsByTag.invites.updateWorkspaceMemberInvite({
1531
- pathParams: { workspaceId: workspace, inviteId: invite },
1532
- body: { role },
1533
- ...this.extraProps
1534
- });
1535
- }
1536
- cancelWorkspaceMemberInvite({
1537
- workspace,
1538
- invite
1539
- }) {
1540
- return operationsByTag.invites.cancelWorkspaceMemberInvite({
1541
- pathParams: { workspaceId: workspace, inviteId: invite },
1542
- ...this.extraProps
1543
- });
1544
- }
1545
- acceptWorkspaceMemberInvite({
1546
- workspace,
1547
- key
1548
- }) {
1549
- return operationsByTag.invites.acceptWorkspaceMemberInvite({
1550
- pathParams: { workspaceId: workspace, inviteKey: key },
1551
- ...this.extraProps
1552
- });
1553
- }
1554
- resendWorkspaceMemberInvite({
1555
- workspace,
1556
- invite
1557
- }) {
1558
- return operationsByTag.invites.resendWorkspaceMemberInvite({
1559
- pathParams: { workspaceId: workspace, inviteId: invite },
1560
- ...this.extraProps
1561
- });
1562
- }
1563
- }
1564
- class BranchApi {
1565
- constructor(extraProps) {
1566
- this.extraProps = extraProps;
1567
- }
1568
- getBranchList({
1569
- workspace,
1570
- region,
1571
- database
1572
- }) {
1573
- return operationsByTag.branch.getBranchList({
1574
- pathParams: { workspace, region, dbName: database },
1575
- ...this.extraProps
1576
- });
1577
- }
1578
- getBranchDetails({
1579
- workspace,
1580
- region,
1581
- database,
1582
- branch
1583
- }) {
1584
- return operationsByTag.branch.getBranchDetails({
1585
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1586
- ...this.extraProps
1587
- });
1588
- }
1589
- createBranch({
1590
- workspace,
1591
- region,
1592
- database,
1593
- branch,
1594
- from,
1595
- metadata
1596
- }) {
1597
- return operationsByTag.branch.createBranch({
1598
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1599
- body: { from, metadata },
1600
- ...this.extraProps
1601
- });
1602
- }
1603
- deleteBranch({
1604
- workspace,
1605
- region,
1606
- database,
1607
- branch
1608
- }) {
1609
- return operationsByTag.branch.deleteBranch({
1610
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1611
- ...this.extraProps
1612
- });
1613
- }
1614
- copyBranch({
1615
- workspace,
1616
- region,
1617
- database,
1618
- branch,
1619
- destinationBranch,
1620
- limit
1621
- }) {
1622
- return operationsByTag.branch.copyBranch({
1623
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1624
- body: { destinationBranch, limit },
1625
- ...this.extraProps
1626
- });
1627
- }
1628
- updateBranchMetadata({
1629
- workspace,
1630
- region,
1631
- database,
1632
- branch,
1633
- metadata
1634
- }) {
1635
- return operationsByTag.branch.updateBranchMetadata({
1636
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1637
- body: metadata,
1638
- ...this.extraProps
1639
- });
1640
- }
1641
- getBranchMetadata({
1642
- workspace,
1643
- region,
1644
- database,
1645
- branch
1646
- }) {
1647
- return operationsByTag.branch.getBranchMetadata({
1648
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1649
- ...this.extraProps
1650
- });
1651
- }
1652
- getBranchStats({
1653
- workspace,
1654
- region,
1655
- database,
1656
- branch
1657
- }) {
1658
- return operationsByTag.branch.getBranchStats({
1659
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1660
- ...this.extraProps
1661
- });
1662
- }
1663
- getGitBranchesMapping({
1664
- workspace,
1665
- region,
1666
- database
1667
- }) {
1668
- return operationsByTag.branch.getGitBranchesMapping({
1669
- pathParams: { workspace, region, dbName: database },
1670
- ...this.extraProps
1671
- });
1672
- }
1673
- addGitBranchesEntry({
1674
- workspace,
1675
- region,
1676
- database,
1677
- gitBranch,
1678
- xataBranch
1679
- }) {
1680
- return operationsByTag.branch.addGitBranchesEntry({
1681
- pathParams: { workspace, region, dbName: database },
1682
- body: { gitBranch, xataBranch },
1683
- ...this.extraProps
1684
- });
1685
- }
1686
- removeGitBranchesEntry({
1687
- workspace,
1688
- region,
1689
- database,
1690
- gitBranch
1691
- }) {
1692
- return operationsByTag.branch.removeGitBranchesEntry({
1693
- pathParams: { workspace, region, dbName: database },
1694
- queryParams: { gitBranch },
1695
- ...this.extraProps
1696
- });
1697
- }
1698
- resolveBranch({
1699
- workspace,
1700
- region,
1701
- database,
1702
- gitBranch,
1703
- fallbackBranch
1704
- }) {
1705
- return operationsByTag.branch.resolveBranch({
1706
- pathParams: { workspace, region, dbName: database },
1707
- queryParams: { gitBranch, fallbackBranch },
1708
- ...this.extraProps
1709
- });
1710
- }
1711
- }
1712
- class TableApi {
1713
- constructor(extraProps) {
1714
- this.extraProps = extraProps;
1715
- }
1716
- createTable({
1717
- workspace,
1718
- region,
1719
- database,
1720
- branch,
1721
- table
1722
- }) {
1723
- return operationsByTag.table.createTable({
1724
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
1725
- ...this.extraProps
1726
- });
1727
- }
1728
- deleteTable({
1729
- workspace,
1730
- region,
1731
- database,
1732
- branch,
1733
- table
1734
- }) {
1735
- return operationsByTag.table.deleteTable({
1736
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
1737
- ...this.extraProps
1738
- });
1739
- }
1740
- updateTable({
1741
- workspace,
1742
- region,
1743
- database,
1744
- branch,
1745
- table,
1746
- update
1747
- }) {
1748
- return operationsByTag.table.updateTable({
1749
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
1750
- body: update,
1751
- ...this.extraProps
1752
- });
1753
- }
1754
- getTableSchema({
1755
- workspace,
1756
- region,
1757
- database,
1758
- branch,
1759
- table
1760
- }) {
1761
- return operationsByTag.table.getTableSchema({
1762
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
1763
- ...this.extraProps
1764
- });
1765
- }
1766
- setTableSchema({
1767
- workspace,
1768
- region,
1769
- database,
1770
- branch,
1771
- table,
1772
- schema
1773
- }) {
1774
- return operationsByTag.table.setTableSchema({
1775
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
1776
- body: schema,
1777
- ...this.extraProps
1778
- });
1779
- }
1780
- getTableColumns({
1781
- workspace,
1782
- region,
1783
- database,
1784
- branch,
1785
- table
1786
- }) {
1787
- return operationsByTag.table.getTableColumns({
1788
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
1789
- ...this.extraProps
1790
- });
1791
- }
1792
- addTableColumn({
1793
- workspace,
1794
- region,
1795
- database,
1796
- branch,
1797
- table,
1798
- column
1799
- }) {
1800
- return operationsByTag.table.addTableColumn({
1801
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
1802
- body: column,
1803
- ...this.extraProps
1804
- });
1805
- }
1806
- getColumn({
1807
- workspace,
1808
- region,
1809
- database,
1810
- branch,
1811
- table,
1812
- column
1813
- }) {
1814
- return operationsByTag.table.getColumn({
1815
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
1816
- ...this.extraProps
1817
- });
1818
- }
1819
- updateColumn({
1820
- workspace,
1821
- region,
1822
- database,
1823
- branch,
1824
- table,
1825
- column,
1826
- update
1827
- }) {
1828
- return operationsByTag.table.updateColumn({
1829
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
1830
- body: update,
1831
- ...this.extraProps
1832
- });
1833
- }
1834
- deleteColumn({
1835
- workspace,
1836
- region,
1837
- database,
1838
- branch,
1839
- table,
1840
- column
1841
- }) {
1842
- return operationsByTag.table.deleteColumn({
1843
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
1844
- ...this.extraProps
1845
- });
1846
- }
1847
- }
1848
- class RecordsApi {
1849
- constructor(extraProps) {
1850
- this.extraProps = extraProps;
1851
- }
1852
- insertRecord({
1853
- workspace,
1854
- region,
1855
- database,
1856
- branch,
1857
- table,
1858
- record,
1859
- columns
1860
- }) {
1861
- return operationsByTag.records.insertRecord({
1862
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
1863
- queryParams: { columns },
1864
- body: record,
1865
- ...this.extraProps
1866
- });
1867
- }
1868
- getRecord({
1869
- workspace,
1870
- region,
1871
- database,
1872
- branch,
1873
- table,
1874
- id,
1875
- columns
1876
- }) {
1877
- return operationsByTag.records.getRecord({
1878
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
1879
- queryParams: { columns },
1880
- ...this.extraProps
1881
- });
1882
- }
1883
- insertRecordWithID({
1884
- workspace,
1885
- region,
1886
- database,
1887
- branch,
1888
- table,
1889
- id,
1890
- record,
1891
- columns,
1892
- createOnly,
1893
- ifVersion
1894
- }) {
1895
- return operationsByTag.records.insertRecordWithID({
1896
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
1897
- queryParams: { columns, createOnly, ifVersion },
1898
- body: record,
1899
- ...this.extraProps
1900
- });
1901
- }
1902
- updateRecordWithID({
1903
- workspace,
1904
- region,
1905
- database,
1906
- branch,
1907
- table,
1908
- id,
1909
- record,
1910
- columns,
1911
- ifVersion
1912
- }) {
1913
- return operationsByTag.records.updateRecordWithID({
1914
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
1915
- queryParams: { columns, ifVersion },
1916
- body: record,
1917
- ...this.extraProps
1918
- });
1919
- }
1920
- upsertRecordWithID({
1921
- workspace,
1922
- region,
1923
- database,
1924
- branch,
1925
- table,
1926
- id,
1927
- record,
1928
- columns,
1929
- ifVersion
1930
- }) {
1931
- return operationsByTag.records.upsertRecordWithID({
1932
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
1933
- queryParams: { columns, ifVersion },
1934
- body: record,
1935
- ...this.extraProps
1936
- });
1937
- }
1938
- deleteRecord({
1939
- workspace,
1940
- region,
1941
- database,
1942
- branch,
1943
- table,
1944
- id,
1945
- columns
1946
- }) {
1947
- return operationsByTag.records.deleteRecord({
1948
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
1949
- queryParams: { columns },
1950
- ...this.extraProps
1951
- });
1952
- }
1953
- bulkInsertTableRecords({
1954
- workspace,
1955
- region,
1956
- database,
1957
- branch,
1958
- table,
1959
- records,
1960
- columns
1961
- }) {
1962
- return operationsByTag.records.bulkInsertTableRecords({
1963
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
1964
- queryParams: { columns },
1965
- body: { records },
1966
- ...this.extraProps
1967
- });
1968
- }
1969
- branchTransaction({
1970
- workspace,
1971
- region,
1972
- database,
1973
- branch,
1974
- operations
1975
- }) {
1976
- return operationsByTag.records.branchTransaction({
1977
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1978
- body: { operations },
1979
- ...this.extraProps
1980
- });
1981
- }
1982
- }
1983
- class FilesApi {
1984
- constructor(extraProps) {
1985
- this.extraProps = extraProps;
1986
- }
1987
- getFileItem({
1988
- workspace,
1989
- region,
1990
- database,
1991
- branch,
1992
- table,
1993
- record,
1994
- column,
1995
- fileId
1996
- }) {
1997
- return operationsByTag.files.getFileItem({
1998
- pathParams: {
1999
- workspace,
2000
- region,
2001
- dbBranchName: `${database}:${branch}`,
2002
- tableName: table,
2003
- recordId: record,
2004
- columnName: column,
2005
- fileId
2006
- },
2007
- ...this.extraProps
2008
- });
2009
- }
2010
- putFileItem({
2011
- workspace,
2012
- region,
2013
- database,
2014
- branch,
2015
- table,
2016
- record,
2017
- column,
2018
- fileId,
2019
- file
2020
- }) {
2021
- return operationsByTag.files.putFileItem({
2022
- pathParams: {
2023
- workspace,
2024
- region,
2025
- dbBranchName: `${database}:${branch}`,
2026
- tableName: table,
2027
- recordId: record,
2028
- columnName: column,
2029
- fileId
2030
- },
2031
- // @ts-ignore
2032
- body: file,
2033
- ...this.extraProps
2034
- });
2035
- }
2036
- deleteFileItem({
2037
- workspace,
2038
- region,
2039
- database,
2040
- branch,
2041
- table,
2042
- record,
2043
- column,
2044
- fileId
2045
- }) {
2046
- return operationsByTag.files.deleteFileItem({
2047
- pathParams: {
2048
- workspace,
2049
- region,
2050
- dbBranchName: `${database}:${branch}`,
2051
- tableName: table,
2052
- recordId: record,
2053
- columnName: column,
2054
- fileId
2055
- },
2056
- ...this.extraProps
2057
- });
2058
- }
2059
- getFile({
2060
- workspace,
2061
- region,
2062
- database,
2063
- branch,
2064
- table,
2065
- record,
2066
- column
2067
- }) {
2068
- return operationsByTag.files.getFile({
2069
- pathParams: {
2070
- workspace,
2071
- region,
2072
- dbBranchName: `${database}:${branch}`,
2073
- tableName: table,
2074
- recordId: record,
2075
- columnName: column
2076
- },
2077
- ...this.extraProps
2078
- });
2079
- }
2080
- putFile({
2081
- workspace,
2082
- region,
2083
- database,
2084
- branch,
2085
- table,
2086
- record,
2087
- column,
2088
- file
2089
- }) {
2090
- return operationsByTag.files.putFile({
2091
- pathParams: {
2092
- workspace,
2093
- region,
2094
- dbBranchName: `${database}:${branch}`,
2095
- tableName: table,
2096
- recordId: record,
2097
- columnName: column
2098
- },
2099
- body: file,
2100
- ...this.extraProps
2101
- });
2102
- }
2103
- deleteFile({
2104
- workspace,
2105
- region,
2106
- database,
2107
- branch,
2108
- table,
2109
- record,
2110
- column
2111
- }) {
2112
- return operationsByTag.files.deleteFile({
2113
- pathParams: {
2114
- workspace,
2115
- region,
2116
- dbBranchName: `${database}:${branch}`,
2117
- tableName: table,
2118
- recordId: record,
2119
- columnName: column
2120
- },
2121
- ...this.extraProps
2122
- });
2123
- }
2124
- fileAccess({
2125
- workspace,
2126
- region,
2127
- fileId,
2128
- verify
2129
- }) {
2130
- return operationsByTag.files.fileAccess({
2131
- pathParams: {
2132
- workspace,
2133
- region,
2134
- fileId
2135
- },
2136
- queryParams: { verify },
2137
- ...this.extraProps
2138
- });
2139
- }
2140
- }
2141
- class SearchAndFilterApi {
2142
- constructor(extraProps) {
2143
- this.extraProps = extraProps;
2144
- }
2145
- queryTable({
2146
- workspace,
2147
- region,
2148
- database,
2149
- branch,
2150
- table,
2151
- filter,
2152
- sort,
2153
- page,
2154
- columns,
2155
- consistency
2156
- }) {
2157
- return operationsByTag.searchAndFilter.queryTable({
2158
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
2159
- body: { filter, sort, page, columns, consistency },
2160
- ...this.extraProps
2161
- });
2162
- }
2163
- searchTable({
2164
- workspace,
2165
- region,
2166
- database,
2167
- branch,
2168
- table,
2169
- query,
2170
- fuzziness,
2171
- target,
2172
- prefix,
2173
- filter,
2174
- highlight,
2175
- boosters
2176
- }) {
2177
- return operationsByTag.searchAndFilter.searchTable({
2178
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
2179
- body: { query, fuzziness, target, prefix, filter, highlight, boosters },
2180
- ...this.extraProps
2181
- });
2182
- }
2183
- searchBranch({
2184
- workspace,
2185
- region,
2186
- database,
2187
- branch,
2188
- tables,
2189
- query,
2190
- fuzziness,
2191
- prefix,
2192
- highlight
2193
- }) {
2194
- return operationsByTag.searchAndFilter.searchBranch({
2195
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
2196
- body: { tables, query, fuzziness, prefix, highlight },
2197
- ...this.extraProps
2198
- });
2199
- }
2200
- vectorSearchTable({
2201
- workspace,
2202
- region,
2203
- database,
2204
- branch,
2205
- table,
2206
- queryVector,
2207
- column,
2208
- similarityFunction,
2209
- size,
2210
- filter
2211
- }) {
2212
- return operationsByTag.searchAndFilter.vectorSearchTable({
2213
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
2214
- body: { queryVector, column, similarityFunction, size, filter },
2215
- ...this.extraProps
2216
- });
2217
- }
2218
- askTable({
2219
- workspace,
2220
- region,
2221
- database,
2222
- branch,
2223
- table,
2224
- options
2225
- }) {
2226
- return operationsByTag.searchAndFilter.askTable({
2227
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
2228
- body: { ...options },
2229
- ...this.extraProps
2230
- });
2231
- }
2232
- askTableSession({
2233
- workspace,
2234
- region,
2235
- database,
2236
- branch,
2237
- table,
2238
- sessionId,
2239
- message
2240
- }) {
2241
- return operationsByTag.searchAndFilter.askTableSession({
2242
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, sessionId },
2243
- body: { message },
2244
- ...this.extraProps
2245
- });
2246
- }
2247
- summarizeTable({
2248
- workspace,
2249
- region,
2250
- database,
2251
- branch,
2252
- table,
2253
- filter,
2254
- columns,
2255
- summaries,
2256
- sort,
2257
- summariesFilter,
2258
- page,
2259
- consistency
2260
- }) {
2261
- return operationsByTag.searchAndFilter.summarizeTable({
2262
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
2263
- body: { filter, columns, summaries, sort, summariesFilter, page, consistency },
2264
- ...this.extraProps
2265
- });
2266
- }
2267
- aggregateTable({
2268
- workspace,
2269
- region,
2270
- database,
2271
- branch,
2272
- table,
2273
- filter,
2274
- aggs
2275
- }) {
2276
- return operationsByTag.searchAndFilter.aggregateTable({
2277
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
2278
- body: { filter, aggs },
2279
- ...this.extraProps
2280
- });
2281
- }
2282
- }
2283
- class MigrationRequestsApi {
2284
- constructor(extraProps) {
2285
- this.extraProps = extraProps;
2286
- }
2287
- queryMigrationRequests({
2288
- workspace,
2289
- region,
2290
- database,
2291
- filter,
2292
- sort,
2293
- page,
2294
- columns
2295
- }) {
2296
- return operationsByTag.migrationRequests.queryMigrationRequests({
2297
- pathParams: { workspace, region, dbName: database },
2298
- body: { filter, sort, page, columns },
2299
- ...this.extraProps
2300
- });
2301
- }
2302
- createMigrationRequest({
2303
- workspace,
2304
- region,
2305
- database,
2306
- migration
2307
- }) {
2308
- return operationsByTag.migrationRequests.createMigrationRequest({
2309
- pathParams: { workspace, region, dbName: database },
2310
- body: migration,
2311
- ...this.extraProps
2312
- });
2313
- }
2314
- getMigrationRequest({
2315
- workspace,
2316
- region,
2317
- database,
2318
- migrationRequest
2319
- }) {
2320
- return operationsByTag.migrationRequests.getMigrationRequest({
2321
- pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
2322
- ...this.extraProps
2323
- });
2324
- }
2325
- updateMigrationRequest({
2326
- workspace,
2327
- region,
2328
- database,
2329
- migrationRequest,
2330
- update
2331
- }) {
2332
- return operationsByTag.migrationRequests.updateMigrationRequest({
2333
- pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
2334
- body: update,
2335
- ...this.extraProps
2336
- });
2337
- }
2338
- listMigrationRequestsCommits({
2339
- workspace,
2340
- region,
2341
- database,
2342
- migrationRequest,
2343
- page
2344
- }) {
2345
- return operationsByTag.migrationRequests.listMigrationRequestsCommits({
2346
- pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
2347
- body: { page },
2348
- ...this.extraProps
2349
- });
2350
- }
2351
- compareMigrationRequest({
2352
- workspace,
2353
- region,
2354
- database,
2355
- migrationRequest
2356
- }) {
2357
- return operationsByTag.migrationRequests.compareMigrationRequest({
2358
- pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
2359
- ...this.extraProps
2360
- });
2361
- }
2362
- getMigrationRequestIsMerged({
2363
- workspace,
2364
- region,
2365
- database,
2366
- migrationRequest
2367
- }) {
2368
- return operationsByTag.migrationRequests.getMigrationRequestIsMerged({
2369
- pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
2370
- ...this.extraProps
2371
- });
2372
- }
2373
- mergeMigrationRequest({
2374
- workspace,
2375
- region,
2376
- database,
2377
- migrationRequest
2378
- }) {
2379
- return operationsByTag.migrationRequests.mergeMigrationRequest({
2380
- pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
2381
- ...this.extraProps
2382
- });
2383
- }
2384
- }
2385
- class MigrationsApi {
2386
- constructor(extraProps) {
2387
- this.extraProps = extraProps;
2388
- }
2389
- getBranchMigrationHistory({
2390
- workspace,
2391
- region,
2392
- database,
2393
- branch,
2394
- limit,
2395
- startFrom
2396
- }) {
2397
- return operationsByTag.migrations.getBranchMigrationHistory({
2398
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
2399
- body: { limit, startFrom },
2400
- ...this.extraProps
2401
- });
2402
- }
2403
- getBranchMigrationPlan({
2404
- workspace,
2405
- region,
2406
- database,
2407
- branch,
2408
- schema
2409
- }) {
2410
- return operationsByTag.migrations.getBranchMigrationPlan({
2411
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
2412
- body: schema,
2413
- ...this.extraProps
2414
- });
2415
- }
2416
- executeBranchMigrationPlan({
2417
- workspace,
2418
- region,
2419
- database,
2420
- branch,
2421
- plan
2422
- }) {
2423
- return operationsByTag.migrations.executeBranchMigrationPlan({
2424
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
2425
- body: plan,
2426
- ...this.extraProps
2427
- });
2428
- }
2429
- getBranchSchemaHistory({
2430
- workspace,
2431
- region,
2432
- database,
2433
- branch,
2434
- page
2435
- }) {
2436
- return operationsByTag.migrations.getBranchSchemaHistory({
2437
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
2438
- body: { page },
2439
- ...this.extraProps
2440
- });
2441
- }
2442
- compareBranchWithUserSchema({
2443
- workspace,
2444
- region,
2445
- database,
2446
- branch,
2447
- schema,
2448
- schemaOperations,
2449
- branchOperations
2450
- }) {
2451
- return operationsByTag.migrations.compareBranchWithUserSchema({
2452
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
2453
- body: { schema, schemaOperations, branchOperations },
2454
- ...this.extraProps
2455
- });
2456
- }
2457
- compareBranchSchemas({
2458
- workspace,
2459
- region,
2460
- database,
2461
- branch,
2462
- compare,
2463
- sourceBranchOperations,
2464
- targetBranchOperations
2465
- }) {
2466
- return operationsByTag.migrations.compareBranchSchemas({
2467
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, branchName: compare },
2468
- body: { sourceBranchOperations, targetBranchOperations },
2469
- ...this.extraProps
2470
- });
2471
- }
2472
- updateBranchSchema({
2473
- workspace,
2474
- region,
2475
- database,
2476
- branch,
2477
- migration
2478
- }) {
2479
- return operationsByTag.migrations.updateBranchSchema({
2480
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
2481
- body: migration,
2482
- ...this.extraProps
2483
- });
2484
- }
2485
- previewBranchSchemaEdit({
2486
- workspace,
2487
- region,
2488
- database,
2489
- branch,
2490
- data
2491
- }) {
2492
- return operationsByTag.migrations.previewBranchSchemaEdit({
2493
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
2494
- body: data,
2495
- ...this.extraProps
2496
- });
2497
- }
2498
- applyBranchSchemaEdit({
2499
- workspace,
2500
- region,
2501
- database,
2502
- branch,
2503
- edits
2504
- }) {
2505
- return operationsByTag.migrations.applyBranchSchemaEdit({
2506
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
2507
- body: { edits },
2508
- ...this.extraProps
2509
- });
2510
- }
2511
- pushBranchMigrations({
2512
- workspace,
2513
- region,
2514
- database,
2515
- branch,
2516
- migrations
2517
- }) {
2518
- return operationsByTag.migrations.pushBranchMigrations({
2519
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
2520
- body: { migrations },
2521
- ...this.extraProps
2522
- });
2523
- }
2524
- }
2525
- class DatabaseApi {
2526
- constructor(extraProps) {
2527
- this.extraProps = extraProps;
2528
- }
2529
- getDatabaseList({ workspace }) {
2530
- return operationsByTag.databases.getDatabaseList({
2531
- pathParams: { workspaceId: workspace },
2532
- ...this.extraProps
2533
- });
2534
- }
2535
- createDatabase({
2536
- workspace,
2537
- database,
2538
- data,
2539
- headers
2540
- }) {
2541
- return operationsByTag.databases.createDatabase({
2542
- pathParams: { workspaceId: workspace, dbName: database },
2543
- body: data,
2544
- headers,
2545
- ...this.extraProps
2546
- });
2547
- }
2548
- deleteDatabase({
2549
- workspace,
2550
- database
2551
- }) {
2552
- return operationsByTag.databases.deleteDatabase({
2553
- pathParams: { workspaceId: workspace, dbName: database },
2554
- ...this.extraProps
2555
- });
2556
- }
2557
- getDatabaseMetadata({
2558
- workspace,
2559
- database
2560
- }) {
2561
- return operationsByTag.databases.getDatabaseMetadata({
2562
- pathParams: { workspaceId: workspace, dbName: database },
2563
- ...this.extraProps
2564
- });
2565
- }
2566
- updateDatabaseMetadata({
2567
- workspace,
2568
- database,
2569
- metadata
2570
- }) {
2571
- return operationsByTag.databases.updateDatabaseMetadata({
2572
- pathParams: { workspaceId: workspace, dbName: database },
2573
- body: metadata,
2574
- ...this.extraProps
2575
- });
2576
- }
2577
- renameDatabase({
2578
- workspace,
2579
- database,
2580
- newName
2581
- }) {
2582
- return operationsByTag.databases.renameDatabase({
2583
- pathParams: { workspaceId: workspace, dbName: database },
2584
- body: { newName },
2585
- ...this.extraProps
2586
- });
2587
- }
2588
- getDatabaseGithubSettings({
2589
- workspace,
2590
- database
2591
- }) {
2592
- return operationsByTag.databases.getDatabaseGithubSettings({
2593
- pathParams: { workspaceId: workspace, dbName: database },
2594
- ...this.extraProps
2595
- });
2596
- }
2597
- updateDatabaseGithubSettings({
2598
- workspace,
2599
- database,
2600
- settings
2601
- }) {
2602
- return operationsByTag.databases.updateDatabaseGithubSettings({
2603
- pathParams: { workspaceId: workspace, dbName: database },
2604
- body: settings,
2605
- ...this.extraProps
2606
- });
2607
- }
2608
- deleteDatabaseGithubSettings({
2609
- workspace,
2610
- database
2611
- }) {
2612
- return operationsByTag.databases.deleteDatabaseGithubSettings({
2613
- pathParams: { workspaceId: workspace, dbName: database },
2614
- ...this.extraProps
2615
- });
2616
- }
2617
- listRegions({ workspace }) {
2618
- return operationsByTag.databases.listRegions({
2619
- pathParams: { workspaceId: workspace },
2620
- ...this.extraProps
2621
- });
2622
- }
1360
+ };
1361
+ class XataApiClient extends buildApiClient() {
2623
1362
  }
2624
1363
 
2625
1364
  class XataApiPlugin {
@@ -2662,16 +1401,16 @@ function transformImage(url, ...transformations) {
2662
1401
  class XataFile {
2663
1402
  constructor(file) {
2664
1403
  this.id = file.id;
2665
- this.name = file.name || "";
2666
- this.mediaType = file.mediaType || "application/octet-stream";
1404
+ this.name = file.name;
1405
+ this.mediaType = file.mediaType;
2667
1406
  this.base64Content = file.base64Content;
2668
- this.enablePublicUrl = file.enablePublicUrl ?? false;
2669
- this.signedUrlTimeout = file.signedUrlTimeout ?? 300;
2670
- this.size = file.size ?? 0;
2671
- this.version = file.version ?? 1;
2672
- this.url = file.url || "";
1407
+ this.enablePublicUrl = file.enablePublicUrl;
1408
+ this.signedUrlTimeout = file.signedUrlTimeout;
1409
+ this.size = file.size;
1410
+ this.version = file.version;
1411
+ this.url = file.url;
2673
1412
  this.signedUrl = file.signedUrl;
2674
- this.attributes = file.attributes || {};
1413
+ this.attributes = file.attributes;
2675
1414
  }
2676
1415
  static fromBuffer(buffer, options = {}) {
2677
1416
  const base64Content = buffer.toString("base64");
@@ -4368,7 +3107,7 @@ function getContentType(file) {
4368
3107
  if (typeof file === "string") {
4369
3108
  return "text/plain";
4370
3109
  }
4371
- if ("mediaType" in file) {
3110
+ if ("mediaType" in file && file.mediaType !== void 0) {
4372
3111
  return file.mediaType;
4373
3112
  }
4374
3113
  if (isBlob(file)) {
@@ -4760,21 +3499,6 @@ const deserialize = (json) => {
4760
3499
  return defaultSerializer.fromJSON(json);
4761
3500
  };
4762
3501
 
4763
- function buildWorkerRunner(config) {
4764
- return function xataWorker(name, worker) {
4765
- return async (...args) => {
4766
- const url = process.env.NODE_ENV === "development" ? `http://localhost:64749/${name}` : `https://dispatcher.xata.workers.dev/${config.workspace}/${config.worker}/${name}`;
4767
- const result = await fetch(url, {
4768
- method: "POST",
4769
- headers: { "Content-Type": "application/json" },
4770
- body: serialize({ args })
4771
- });
4772
- const text = await result.text();
4773
- return deserialize(text);
4774
- };
4775
- };
4776
- }
4777
-
4778
3502
  class XataError extends Error {
4779
3503
  constructor(message, status) {
4780
3504
  super(message);
@@ -4782,5 +3506,5 @@ class XataError extends Error {
4782
3506
  }
4783
3507
  }
4784
3508
 
4785
- export { BaseClient, FetcherError, FilesPlugin, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, RecordColumnTypes, Repository, RestRepository, SQLPlugin, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, TransactionPlugin, XataApiClient, XataApiPlugin, XataError, XataFile, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, applyMigration, askTable, askTableSession, branchTransaction, buildClient, buildPreviewBranchName, buildProviderString, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, copyBranch, createBranch, createCluster, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteDatabaseGithubSettings, deleteFile, deleteFileItem, deleteOAuthAccessToken, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteUserOAuthClient, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, fileAccess, ge, getAPIKey, getAuthorizationCode, getBranch, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getCluster, getColumn, getDatabaseGithubSettings, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getFile, getFileItem, getGitBranchesMapping, getHostUrl, getMigrationRequest, getMigrationRequestIsMerged, getPreviewBranch, getRecord, getSchema, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getUserOAuthAccessTokens, getUserOAuthClients, getWorkspace, getWorkspaceMembersList, getWorkspacesList, grantAuthorizationCode, greaterEquals, greaterThan, greaterThanEquals, gt, gte, iContains, iPattern, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isHostProviderAlias, isHostProviderBuilder, isIdentifiable, isNot, isValidExpandedColumn, isValidSelectableColumns, isXataRecord, le, lessEquals, lessThan, lessThanEquals, listClusters, listMigrationRequestsCommits, listRegions, lt, lte, mergeMigrationRequest, notExists, operationsByTag, parseProviderString, parseWorkspacesUrlParts, pattern, previewBranchSchemaEdit, pushBranchMigrations, putFile, putFileItem, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, renameDatabase, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, sqlQuery, startsWith, summarizeTable, transformImage, updateBranchMetadata, updateBranchSchema, updateCluster, updateColumn, updateDatabaseGithubSettings, updateDatabaseMetadata, updateMigrationRequest, updateOAuthAccessToken, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID, vectorSearchTable };
3509
+ export { BaseClient, FetcherError, FilesPlugin, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, RecordColumnTypes, Repository, RestRepository, SQLPlugin, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, TransactionPlugin, XataApiClient, XataApiPlugin, XataError, XataFile, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, applyMigration, askTable, askTableSession, branchTransaction, buildClient, buildPreviewBranchName, buildProviderString, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, copyBranch, createBranch, createCluster, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteDatabaseGithubSettings, deleteFile, deleteFileItem, deleteOAuthAccessToken, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteUserOAuthClient, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, fileAccess, ge, getAPIKey, getAuthorizationCode, getBranch, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getCluster, getColumn, getDatabaseGithubSettings, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getFile, getFileItem, getGitBranchesMapping, getHostUrl, getMigrationRequest, getMigrationRequestIsMerged, getPreviewBranch, getRecord, getSchema, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getUserOAuthAccessTokens, getUserOAuthClients, getWorkspace, getWorkspaceMembersList, getWorkspacesList, grantAuthorizationCode, greaterEquals, greaterThan, greaterThanEquals, gt, gte, iContains, iPattern, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isHostProviderAlias, isHostProviderBuilder, isIdentifiable, isNot, isValidExpandedColumn, isValidSelectableColumns, isXataRecord, le, lessEquals, lessThan, lessThanEquals, listClusters, listMigrationRequestsCommits, listRegions, lt, lte, mergeMigrationRequest, notExists, operationsByTag, parseProviderString, parseWorkspacesUrlParts, pattern, pgRollJobStatus, pgRollStatus, previewBranchSchemaEdit, pushBranchMigrations, putFile, putFileItem, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, renameDatabase, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, sqlQuery, startsWith, summarizeTable, transformImage, updateBranchMetadata, updateBranchSchema, updateCluster, updateColumn, updateDatabaseGithubSettings, updateDatabaseMetadata, updateMigrationRequest, updateOAuthAccessToken, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID, vectorSearchTable };
4786
3510
  //# sourceMappingURL=index.mjs.map