@xata.io/client 0.29.5 → 0.30.1

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
@@ -2024,14 +2024,14 @@ function getPreviewBranch() {
2024
2024
  }
2025
2025
  }
2026
2026
 
2027
- var __typeError$8 = (msg) => {
2027
+ var __typeError$7 = (msg) => {
2028
2028
  throw TypeError(msg);
2029
2029
  };
2030
- var __accessCheck$8 = (obj, member, msg) => member.has(obj) || __typeError$8("Cannot " + msg);
2031
- var __privateGet$7 = (obj, member, getter) => (__accessCheck$8(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
2032
- var __privateAdd$8 = (obj, member, value) => member.has(obj) ? __typeError$8("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
2033
- var __privateSet$6 = (obj, member, value, setter) => (__accessCheck$8(obj, member, "write to private field"), member.set(obj, value), value);
2034
- var __privateMethod$4 = (obj, member, method) => (__accessCheck$8(obj, member, "access private method"), method);
2030
+ var __accessCheck$7 = (obj, member, msg) => member.has(obj) || __typeError$7("Cannot " + msg);
2031
+ var __privateGet$6 = (obj, member, getter) => (__accessCheck$7(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
2032
+ var __privateAdd$7 = (obj, member, value) => member.has(obj) ? __typeError$7("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
2033
+ var __privateSet$5 = (obj, member, value, setter) => (__accessCheck$7(obj, member, "write to private field"), member.set(obj, value), value);
2034
+ var __privateMethod$4 = (obj, member, method) => (__accessCheck$7(obj, member, "access private method"), method);
2035
2035
  var _fetch, _queue, _concurrency, _ApiRequestPool_instances, enqueue_fn;
2036
2036
  const REQUEST_TIMEOUT = 5 * 60 * 1e3;
2037
2037
  function getFetchImplementation(userFetch) {
@@ -2045,23 +2045,23 @@ function getFetchImplementation(userFetch) {
2045
2045
  }
2046
2046
  class ApiRequestPool {
2047
2047
  constructor(concurrency = 10) {
2048
- __privateAdd$8(this, _ApiRequestPool_instances);
2049
- __privateAdd$8(this, _fetch);
2050
- __privateAdd$8(this, _queue);
2051
- __privateAdd$8(this, _concurrency);
2052
- __privateSet$6(this, _queue, []);
2053
- __privateSet$6(this, _concurrency, concurrency);
2048
+ __privateAdd$7(this, _ApiRequestPool_instances);
2049
+ __privateAdd$7(this, _fetch);
2050
+ __privateAdd$7(this, _queue);
2051
+ __privateAdd$7(this, _concurrency);
2052
+ __privateSet$5(this, _queue, []);
2053
+ __privateSet$5(this, _concurrency, concurrency);
2054
2054
  this.running = 0;
2055
2055
  this.started = 0;
2056
2056
  }
2057
2057
  setFetch(fetch2) {
2058
- __privateSet$6(this, _fetch, fetch2);
2058
+ __privateSet$5(this, _fetch, fetch2);
2059
2059
  }
2060
2060
  getFetch() {
2061
- if (!__privateGet$7(this, _fetch)) {
2061
+ if (!__privateGet$6(this, _fetch)) {
2062
2062
  throw new Error("Fetch not set");
2063
2063
  }
2064
- return __privateGet$7(this, _fetch);
2064
+ return __privateGet$6(this, _fetch);
2065
2065
  }
2066
2066
  request(url, options) {
2067
2067
  const start = /* @__PURE__ */ new Date();
@@ -2093,19 +2093,19 @@ _queue = new WeakMap();
2093
2093
  _concurrency = new WeakMap();
2094
2094
  _ApiRequestPool_instances = new WeakSet();
2095
2095
  enqueue_fn = function(task) {
2096
- const promise = new Promise((resolve) => __privateGet$7(this, _queue).push(resolve)).finally(() => {
2096
+ const promise = new Promise((resolve) => __privateGet$6(this, _queue).push(resolve)).finally(() => {
2097
2097
  this.started--;
2098
2098
  this.running++;
2099
2099
  }).then(() => task()).finally(() => {
2100
2100
  this.running--;
2101
- const next = __privateGet$7(this, _queue).shift();
2101
+ const next = __privateGet$6(this, _queue).shift();
2102
2102
  if (next !== void 0) {
2103
2103
  this.started++;
2104
2104
  next();
2105
2105
  }
2106
2106
  });
2107
- if (this.running + this.started < __privateGet$7(this, _concurrency)) {
2108
- const next = __privateGet$7(this, _queue).shift();
2107
+ if (this.running + this.started < __privateGet$6(this, _concurrency)) {
2108
+ const next = __privateGet$6(this, _queue).shift();
2109
2109
  if (next !== void 0) {
2110
2110
  this.started++;
2111
2111
  next();
@@ -2158,6 +2158,7 @@ function getLines(onLine) {
2158
2158
  fieldLength = position - lineStart;
2159
2159
  }
2160
2160
  break;
2161
+ // @ts-ignore:7029 \r case below should fallthrough to \n:
2161
2162
  case 13 /* CarriageReturn */:
2162
2163
  discardTrailingNewline = true;
2163
2164
  case 10 /* NewLine */:
@@ -2294,7 +2295,7 @@ function defaultOnOpen(response) {
2294
2295
  }
2295
2296
  }
2296
2297
 
2297
- const VERSION = "0.29.5";
2298
+ const VERSION = "0.30.1";
2298
2299
 
2299
2300
  class ErrorWithCause extends Error {
2300
2301
  constructor(message, options) {
@@ -2403,7 +2404,7 @@ const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
2403
2404
  const query = new URLSearchParams(cleanQueryParams).toString();
2404
2405
  const queryString = query.length > 0 ? `?${query}` : "";
2405
2406
  const cleanPathParams = Object.entries(pathParams).reduce((acc, [key, value]) => {
2406
- return { ...acc, [key]: encodeURIComponent(String(value ?? "")).replace("%3A", ":") };
2407
+ return { ...acc, [key]: encodeURIComponent(String(value ?? "")).replace(/%3A/g, ":") };
2407
2408
  }, {});
2408
2409
  return url.replace(/\{\w*\}/g, (key) => cleanPathParams[key.slice(1, -1)]) + queryString;
2409
2410
  };
@@ -2606,6 +2607,48 @@ function parseUrl(url) {
2606
2607
 
2607
2608
  const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
2608
2609
 
2610
+ const getTasks = (variables, signal) => dataPlaneFetch({
2611
+ url: "/tasks",
2612
+ method: "get",
2613
+ ...variables,
2614
+ signal
2615
+ });
2616
+ const getTaskStatus = (variables, signal) => dataPlaneFetch({
2617
+ url: "/tasks/{taskId}",
2618
+ method: "get",
2619
+ ...variables,
2620
+ signal
2621
+ });
2622
+ const listClusterBranches = (variables, signal) => dataPlaneFetch({
2623
+ url: "/cluster/{clusterId}/branches",
2624
+ method: "get",
2625
+ ...variables,
2626
+ signal
2627
+ });
2628
+ const listClusterExtensions = (variables, signal) => dataPlaneFetch({
2629
+ url: "/cluster/{clusterId}/extensions",
2630
+ method: "get",
2631
+ ...variables,
2632
+ signal
2633
+ });
2634
+ const installClusterExtension = (variables, signal) => dataPlaneFetch({
2635
+ url: "/cluster/{clusterId}/extensions",
2636
+ method: "post",
2637
+ ...variables,
2638
+ signal
2639
+ });
2640
+ const dropClusterExtension = (variables, signal) => dataPlaneFetch({
2641
+ url: "/cluster/{clusterId}/extensions",
2642
+ method: "delete",
2643
+ ...variables,
2644
+ signal
2645
+ });
2646
+ const getClusterMetrics = (variables, signal) => dataPlaneFetch({
2647
+ url: "/cluster/{clusterId}/metrics",
2648
+ method: "get",
2649
+ ...variables,
2650
+ signal
2651
+ });
2609
2652
  const applyMigration = (variables, signal) => dataPlaneFetch({
2610
2653
  url: "/db/{dbBranchName}/migrations/apply",
2611
2654
  method: "post",
@@ -2648,6 +2691,12 @@ const getBranchMigrationJobStatus = (variables, signal) => dataPlaneFetch({
2648
2691
  ...variables,
2649
2692
  signal
2650
2693
  });
2694
+ const getMigrationJobs = (variables, signal) => dataPlaneFetch({
2695
+ url: "/db/{dbBranchName}/migrations/jobs",
2696
+ method: "get",
2697
+ ...variables,
2698
+ signal
2699
+ });
2651
2700
  const getMigrationJobStatus = (variables, signal) => dataPlaneFetch({
2652
2701
  url: "/db/{dbBranchName}/migrations/jobs/{jobId}",
2653
2702
  method: "get",
@@ -2673,6 +2722,7 @@ const getDatabaseSettings = (variables, signal) => dataPlaneFetch({
2673
2722
  signal
2674
2723
  });
2675
2724
  const updateDatabaseSettings = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/settings", method: "patch", ...variables, signal });
2725
+ const createBranchAsync = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/async", method: "put", ...variables, signal });
2676
2726
  const getBranchDetails = (variables, signal) => dataPlaneFetch({
2677
2727
  url: "/db/{dbBranchName}",
2678
2728
  method: "get",
@@ -2692,12 +2742,25 @@ const getSchema = (variables, signal) => dataPlaneFetch({
2692
2742
  ...variables,
2693
2743
  signal
2694
2744
  });
2745
+ const getSchemas = (variables, signal) => dataPlaneFetch({
2746
+ url: "/db/{dbBranchName}/schemas",
2747
+ method: "get",
2748
+ ...variables,
2749
+ signal
2750
+ });
2695
2751
  const copyBranch = (variables, signal) => dataPlaneFetch({
2696
2752
  url: "/db/{dbBranchName}/copy",
2697
2753
  method: "post",
2698
2754
  ...variables,
2699
2755
  signal
2700
2756
  });
2757
+ const getBranchMoveStatus = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/move", method: "get", ...variables, signal });
2758
+ const moveBranch = (variables, signal) => dataPlaneFetch({
2759
+ url: "/db/{dbBranchName}/move",
2760
+ method: "put",
2761
+ ...variables,
2762
+ signal
2763
+ });
2701
2764
  const updateBranchMetadata = (variables, signal) => dataPlaneFetch({
2702
2765
  url: "/db/{dbBranchName}/metadata",
2703
2766
  method: "put",
@@ -3052,6 +3115,14 @@ const sqlBatchQuery = (variables, signal) => dataPlaneFetch({
3052
3115
  signal
3053
3116
  });
3054
3117
  const operationsByTag$2 = {
3118
+ tasks: { getTasks, getTaskStatus },
3119
+ cluster: {
3120
+ listClusterBranches,
3121
+ listClusterExtensions,
3122
+ installClusterExtension,
3123
+ dropClusterExtension,
3124
+ getClusterMetrics
3125
+ },
3055
3126
  migrations: {
3056
3127
  applyMigration,
3057
3128
  startMigration,
@@ -3060,9 +3131,11 @@ const operationsByTag$2 = {
3060
3131
  adaptTable,
3061
3132
  adaptAllTables,
3062
3133
  getBranchMigrationJobStatus,
3134
+ getMigrationJobs,
3063
3135
  getMigrationJobStatus,
3064
3136
  getMigrationHistory,
3065
3137
  getSchema,
3138
+ getSchemas,
3066
3139
  getBranchMigrationHistory,
3067
3140
  getBranchMigrationPlan,
3068
3141
  executeBranchMigrationPlan,
@@ -3076,10 +3149,13 @@ const operationsByTag$2 = {
3076
3149
  },
3077
3150
  branch: {
3078
3151
  getBranchList,
3152
+ createBranchAsync,
3079
3153
  getBranchDetails,
3080
3154
  createBranch,
3081
3155
  deleteBranch,
3082
3156
  copyBranch,
3157
+ getBranchMoveStatus,
3158
+ moveBranch,
3083
3159
  updateBranchMetadata,
3084
3160
  getBranchMetadata,
3085
3161
  getBranchStats,
@@ -3448,18 +3524,8 @@ const operationsByTag$1 = {
3448
3524
 
3449
3525
  const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
3450
3526
 
3451
- var __typeError$7 = (msg) => {
3452
- throw TypeError(msg);
3453
- };
3454
- var __accessCheck$7 = (obj, member, msg) => member.has(obj) || __typeError$7("Cannot " + msg);
3455
- var __privateGet$6 = (obj, member, getter) => (__accessCheck$7(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
3456
- var __privateAdd$7 = (obj, member, value) => member.has(obj) ? __typeError$7("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
3457
- var __privateSet$5 = (obj, member, value, setter) => (__accessCheck$7(obj, member, "write to private field"), member.set(obj, value), value);
3458
- var _extraProps, _namespaces;
3459
- class XataApiClient {
3527
+ const buildApiClient = () => class {
3460
3528
  constructor(options = {}) {
3461
- __privateAdd$7(this, _extraProps);
3462
- __privateAdd$7(this, _namespaces, {});
3463
3529
  const provider = options.host ?? "production";
3464
3530
  const apiKey = options.apiKey ?? getAPIKey();
3465
3531
  const trace = options.trace ?? defaultTrace;
@@ -3467,7 +3533,7 @@ class XataApiClient {
3467
3533
  if (!apiKey) {
3468
3534
  throw new Error("Could not resolve a valid apiKey");
3469
3535
  }
3470
- __privateSet$5(this, _extraProps, {
3536
+ const extraProps = {
3471
3537
  apiUrl: getHostUrl(provider, "main"),
3472
3538
  workspacesApiUrl: getHostUrl(provider, "workspaces"),
3473
3539
  fetch: getFetchImplementation(options.fetch),
@@ -3476,1304 +3542,31 @@ class XataApiClient {
3476
3542
  clientName: options.clientName,
3477
3543
  xataAgentExtra: options.xataAgentExtra,
3478
3544
  clientID
3545
+ };
3546
+ return new Proxy(this, {
3547
+ get: (_target, namespace) => {
3548
+ if (operationsByTag[namespace] === void 0) {
3549
+ return void 0;
3550
+ }
3551
+ return new Proxy(
3552
+ {},
3553
+ {
3554
+ get: (_target2, operation) => {
3555
+ if (operationsByTag[namespace][operation] === void 0) {
3556
+ return void 0;
3557
+ }
3558
+ const method = operationsByTag[namespace][operation];
3559
+ return async (params) => {
3560
+ return await method({ ...params, ...extraProps });
3561
+ };
3562
+ }
3563
+ }
3564
+ );
3565
+ }
3479
3566
  });
3480
3567
  }
3481
- get user() {
3482
- if (!__privateGet$6(this, _namespaces).user) __privateGet$6(this, _namespaces).user = new UserApi(__privateGet$6(this, _extraProps));
3483
- return __privateGet$6(this, _namespaces).user;
3484
- }
3485
- get authentication() {
3486
- if (!__privateGet$6(this, _namespaces).authentication) __privateGet$6(this, _namespaces).authentication = new AuthenticationApi(__privateGet$6(this, _extraProps));
3487
- return __privateGet$6(this, _namespaces).authentication;
3488
- }
3489
- get workspaces() {
3490
- if (!__privateGet$6(this, _namespaces).workspaces) __privateGet$6(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$6(this, _extraProps));
3491
- return __privateGet$6(this, _namespaces).workspaces;
3492
- }
3493
- get invites() {
3494
- if (!__privateGet$6(this, _namespaces).invites) __privateGet$6(this, _namespaces).invites = new InvitesApi(__privateGet$6(this, _extraProps));
3495
- return __privateGet$6(this, _namespaces).invites;
3496
- }
3497
- get database() {
3498
- if (!__privateGet$6(this, _namespaces).database) __privateGet$6(this, _namespaces).database = new DatabaseApi(__privateGet$6(this, _extraProps));
3499
- return __privateGet$6(this, _namespaces).database;
3500
- }
3501
- get branches() {
3502
- if (!__privateGet$6(this, _namespaces).branches) __privateGet$6(this, _namespaces).branches = new BranchApi(__privateGet$6(this, _extraProps));
3503
- return __privateGet$6(this, _namespaces).branches;
3504
- }
3505
- get migrations() {
3506
- if (!__privateGet$6(this, _namespaces).migrations) __privateGet$6(this, _namespaces).migrations = new MigrationsApi(__privateGet$6(this, _extraProps));
3507
- return __privateGet$6(this, _namespaces).migrations;
3508
- }
3509
- get migrationRequests() {
3510
- if (!__privateGet$6(this, _namespaces).migrationRequests)
3511
- __privateGet$6(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$6(this, _extraProps));
3512
- return __privateGet$6(this, _namespaces).migrationRequests;
3513
- }
3514
- get tables() {
3515
- if (!__privateGet$6(this, _namespaces).tables) __privateGet$6(this, _namespaces).tables = new TableApi(__privateGet$6(this, _extraProps));
3516
- return __privateGet$6(this, _namespaces).tables;
3517
- }
3518
- get records() {
3519
- if (!__privateGet$6(this, _namespaces).records) __privateGet$6(this, _namespaces).records = new RecordsApi(__privateGet$6(this, _extraProps));
3520
- return __privateGet$6(this, _namespaces).records;
3521
- }
3522
- get files() {
3523
- if (!__privateGet$6(this, _namespaces).files) __privateGet$6(this, _namespaces).files = new FilesApi(__privateGet$6(this, _extraProps));
3524
- return __privateGet$6(this, _namespaces).files;
3525
- }
3526
- get searchAndFilter() {
3527
- if (!__privateGet$6(this, _namespaces).searchAndFilter) __privateGet$6(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$6(this, _extraProps));
3528
- return __privateGet$6(this, _namespaces).searchAndFilter;
3529
- }
3530
- }
3531
- _extraProps = new WeakMap();
3532
- _namespaces = new WeakMap();
3533
- class UserApi {
3534
- constructor(extraProps) {
3535
- this.extraProps = extraProps;
3536
- }
3537
- getUser() {
3538
- return operationsByTag.users.getUser({ ...this.extraProps });
3539
- }
3540
- updateUser({ user }) {
3541
- return operationsByTag.users.updateUser({ body: user, ...this.extraProps });
3542
- }
3543
- deleteUser() {
3544
- return operationsByTag.users.deleteUser({ ...this.extraProps });
3545
- }
3546
- }
3547
- class AuthenticationApi {
3548
- constructor(extraProps) {
3549
- this.extraProps = extraProps;
3550
- }
3551
- getUserAPIKeys() {
3552
- return operationsByTag.authentication.getUserAPIKeys({ ...this.extraProps });
3553
- }
3554
- createUserAPIKey({ name }) {
3555
- return operationsByTag.authentication.createUserAPIKey({
3556
- pathParams: { keyName: name },
3557
- ...this.extraProps
3558
- });
3559
- }
3560
- deleteUserAPIKey({ name }) {
3561
- return operationsByTag.authentication.deleteUserAPIKey({
3562
- pathParams: { keyName: name },
3563
- ...this.extraProps
3564
- });
3565
- }
3566
- }
3567
- class WorkspaceApi {
3568
- constructor(extraProps) {
3569
- this.extraProps = extraProps;
3570
- }
3571
- getWorkspacesList() {
3572
- return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
3573
- }
3574
- createWorkspace({ data }) {
3575
- return operationsByTag.workspaces.createWorkspace({
3576
- body: data,
3577
- ...this.extraProps
3578
- });
3579
- }
3580
- getWorkspace({ workspace }) {
3581
- return operationsByTag.workspaces.getWorkspace({
3582
- pathParams: { workspaceId: workspace },
3583
- ...this.extraProps
3584
- });
3585
- }
3586
- updateWorkspace({
3587
- workspace,
3588
- update
3589
- }) {
3590
- return operationsByTag.workspaces.updateWorkspace({
3591
- pathParams: { workspaceId: workspace },
3592
- body: update,
3593
- ...this.extraProps
3594
- });
3595
- }
3596
- deleteWorkspace({ workspace }) {
3597
- return operationsByTag.workspaces.deleteWorkspace({
3598
- pathParams: { workspaceId: workspace },
3599
- ...this.extraProps
3600
- });
3601
- }
3602
- getWorkspaceMembersList({ workspace }) {
3603
- return operationsByTag.workspaces.getWorkspaceMembersList({
3604
- pathParams: { workspaceId: workspace },
3605
- ...this.extraProps
3606
- });
3607
- }
3608
- updateWorkspaceMemberRole({
3609
- workspace,
3610
- user,
3611
- role
3612
- }) {
3613
- return operationsByTag.workspaces.updateWorkspaceMemberRole({
3614
- pathParams: { workspaceId: workspace, userId: user },
3615
- body: { role },
3616
- ...this.extraProps
3617
- });
3618
- }
3619
- removeWorkspaceMember({
3620
- workspace,
3621
- user
3622
- }) {
3623
- return operationsByTag.workspaces.removeWorkspaceMember({
3624
- pathParams: { workspaceId: workspace, userId: user },
3625
- ...this.extraProps
3626
- });
3627
- }
3628
- }
3629
- class InvitesApi {
3630
- constructor(extraProps) {
3631
- this.extraProps = extraProps;
3632
- }
3633
- inviteWorkspaceMember({
3634
- workspace,
3635
- email,
3636
- role
3637
- }) {
3638
- return operationsByTag.invites.inviteWorkspaceMember({
3639
- pathParams: { workspaceId: workspace },
3640
- body: { email, role },
3641
- ...this.extraProps
3642
- });
3643
- }
3644
- updateWorkspaceMemberInvite({
3645
- workspace,
3646
- invite,
3647
- role
3648
- }) {
3649
- return operationsByTag.invites.updateWorkspaceMemberInvite({
3650
- pathParams: { workspaceId: workspace, inviteId: invite },
3651
- body: { role },
3652
- ...this.extraProps
3653
- });
3654
- }
3655
- cancelWorkspaceMemberInvite({
3656
- workspace,
3657
- invite
3658
- }) {
3659
- return operationsByTag.invites.cancelWorkspaceMemberInvite({
3660
- pathParams: { workspaceId: workspace, inviteId: invite },
3661
- ...this.extraProps
3662
- });
3663
- }
3664
- acceptWorkspaceMemberInvite({
3665
- workspace,
3666
- key
3667
- }) {
3668
- return operationsByTag.invites.acceptWorkspaceMemberInvite({
3669
- pathParams: { workspaceId: workspace, inviteKey: key },
3670
- ...this.extraProps
3671
- });
3672
- }
3673
- resendWorkspaceMemberInvite({
3674
- workspace,
3675
- invite
3676
- }) {
3677
- return operationsByTag.invites.resendWorkspaceMemberInvite({
3678
- pathParams: { workspaceId: workspace, inviteId: invite },
3679
- ...this.extraProps
3680
- });
3681
- }
3682
- }
3683
- class BranchApi {
3684
- constructor(extraProps) {
3685
- this.extraProps = extraProps;
3686
- }
3687
- getBranchList({
3688
- workspace,
3689
- region,
3690
- database
3691
- }) {
3692
- return operationsByTag.branch.getBranchList({
3693
- pathParams: { workspace, region, dbName: database },
3694
- ...this.extraProps
3695
- });
3696
- }
3697
- getBranchDetails({
3698
- workspace,
3699
- region,
3700
- database,
3701
- branch
3702
- }) {
3703
- return operationsByTag.branch.getBranchDetails({
3704
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
3705
- ...this.extraProps
3706
- });
3707
- }
3708
- createBranch({
3709
- workspace,
3710
- region,
3711
- database,
3712
- branch,
3713
- from,
3714
- metadata
3715
- }) {
3716
- return operationsByTag.branch.createBranch({
3717
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
3718
- body: { from, metadata },
3719
- ...this.extraProps
3720
- });
3721
- }
3722
- deleteBranch({
3723
- workspace,
3724
- region,
3725
- database,
3726
- branch
3727
- }) {
3728
- return operationsByTag.branch.deleteBranch({
3729
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
3730
- ...this.extraProps
3731
- });
3732
- }
3733
- copyBranch({
3734
- workspace,
3735
- region,
3736
- database,
3737
- branch,
3738
- destinationBranch,
3739
- limit
3740
- }) {
3741
- return operationsByTag.branch.copyBranch({
3742
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
3743
- body: { destinationBranch, limit },
3744
- ...this.extraProps
3745
- });
3746
- }
3747
- updateBranchMetadata({
3748
- workspace,
3749
- region,
3750
- database,
3751
- branch,
3752
- metadata
3753
- }) {
3754
- return operationsByTag.branch.updateBranchMetadata({
3755
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
3756
- body: metadata,
3757
- ...this.extraProps
3758
- });
3759
- }
3760
- getBranchMetadata({
3761
- workspace,
3762
- region,
3763
- database,
3764
- branch
3765
- }) {
3766
- return operationsByTag.branch.getBranchMetadata({
3767
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
3768
- ...this.extraProps
3769
- });
3770
- }
3771
- getBranchStats({
3772
- workspace,
3773
- region,
3774
- database,
3775
- branch
3776
- }) {
3777
- return operationsByTag.branch.getBranchStats({
3778
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
3779
- ...this.extraProps
3780
- });
3781
- }
3782
- getGitBranchesMapping({
3783
- workspace,
3784
- region,
3785
- database
3786
- }) {
3787
- return operationsByTag.branch.getGitBranchesMapping({
3788
- pathParams: { workspace, region, dbName: database },
3789
- ...this.extraProps
3790
- });
3791
- }
3792
- addGitBranchesEntry({
3793
- workspace,
3794
- region,
3795
- database,
3796
- gitBranch,
3797
- xataBranch
3798
- }) {
3799
- return operationsByTag.branch.addGitBranchesEntry({
3800
- pathParams: { workspace, region, dbName: database },
3801
- body: { gitBranch, xataBranch },
3802
- ...this.extraProps
3803
- });
3804
- }
3805
- removeGitBranchesEntry({
3806
- workspace,
3807
- region,
3808
- database,
3809
- gitBranch
3810
- }) {
3811
- return operationsByTag.branch.removeGitBranchesEntry({
3812
- pathParams: { workspace, region, dbName: database },
3813
- queryParams: { gitBranch },
3814
- ...this.extraProps
3815
- });
3816
- }
3817
- resolveBranch({
3818
- workspace,
3819
- region,
3820
- database,
3821
- gitBranch,
3822
- fallbackBranch
3823
- }) {
3824
- return operationsByTag.branch.resolveBranch({
3825
- pathParams: { workspace, region, dbName: database },
3826
- queryParams: { gitBranch, fallbackBranch },
3827
- ...this.extraProps
3828
- });
3829
- }
3830
- pgRollMigrationHistory({
3831
- workspace,
3832
- region,
3833
- database,
3834
- branch
3835
- }) {
3836
- return operationsByTag.migrations.getMigrationHistory({
3837
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
3838
- ...this.extraProps
3839
- });
3840
- }
3841
- applyMigration({
3842
- workspace,
3843
- region,
3844
- database,
3845
- branch,
3846
- migration
3847
- }) {
3848
- return operationsByTag.migrations.applyMigration({
3849
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
3850
- body: migration,
3851
- ...this.extraProps
3852
- });
3853
- }
3854
- }
3855
- class TableApi {
3856
- constructor(extraProps) {
3857
- this.extraProps = extraProps;
3858
- }
3859
- createTable({
3860
- workspace,
3861
- region,
3862
- database,
3863
- branch,
3864
- table
3865
- }) {
3866
- return operationsByTag.table.createTable({
3867
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
3868
- ...this.extraProps
3869
- });
3870
- }
3871
- deleteTable({
3872
- workspace,
3873
- region,
3874
- database,
3875
- branch,
3876
- table
3877
- }) {
3878
- return operationsByTag.table.deleteTable({
3879
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
3880
- ...this.extraProps
3881
- });
3882
- }
3883
- updateTable({
3884
- workspace,
3885
- region,
3886
- database,
3887
- branch,
3888
- table,
3889
- update
3890
- }) {
3891
- return operationsByTag.table.updateTable({
3892
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
3893
- body: update,
3894
- ...this.extraProps
3895
- });
3896
- }
3897
- getTableSchema({
3898
- workspace,
3899
- region,
3900
- database,
3901
- branch,
3902
- table
3903
- }) {
3904
- return operationsByTag.table.getTableSchema({
3905
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
3906
- ...this.extraProps
3907
- });
3908
- }
3909
- setTableSchema({
3910
- workspace,
3911
- region,
3912
- database,
3913
- branch,
3914
- table,
3915
- schema
3916
- }) {
3917
- return operationsByTag.table.setTableSchema({
3918
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
3919
- body: schema,
3920
- ...this.extraProps
3921
- });
3922
- }
3923
- getTableColumns({
3924
- workspace,
3925
- region,
3926
- database,
3927
- branch,
3928
- table
3929
- }) {
3930
- return operationsByTag.table.getTableColumns({
3931
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
3932
- ...this.extraProps
3933
- });
3934
- }
3935
- addTableColumn({
3936
- workspace,
3937
- region,
3938
- database,
3939
- branch,
3940
- table,
3941
- column
3942
- }) {
3943
- return operationsByTag.table.addTableColumn({
3944
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
3945
- body: column,
3946
- ...this.extraProps
3947
- });
3948
- }
3949
- getColumn({
3950
- workspace,
3951
- region,
3952
- database,
3953
- branch,
3954
- table,
3955
- column
3956
- }) {
3957
- return operationsByTag.table.getColumn({
3958
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
3959
- ...this.extraProps
3960
- });
3961
- }
3962
- updateColumn({
3963
- workspace,
3964
- region,
3965
- database,
3966
- branch,
3967
- table,
3968
- column,
3969
- update
3970
- }) {
3971
- return operationsByTag.table.updateColumn({
3972
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
3973
- body: update,
3974
- ...this.extraProps
3975
- });
3976
- }
3977
- deleteColumn({
3978
- workspace,
3979
- region,
3980
- database,
3981
- branch,
3982
- table,
3983
- column
3984
- }) {
3985
- return operationsByTag.table.deleteColumn({
3986
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
3987
- ...this.extraProps
3988
- });
3989
- }
3990
- }
3991
- class RecordsApi {
3992
- constructor(extraProps) {
3993
- this.extraProps = extraProps;
3994
- }
3995
- insertRecord({
3996
- workspace,
3997
- region,
3998
- database,
3999
- branch,
4000
- table,
4001
- record,
4002
- columns
4003
- }) {
4004
- return operationsByTag.records.insertRecord({
4005
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
4006
- queryParams: { columns },
4007
- body: record,
4008
- ...this.extraProps
4009
- });
4010
- }
4011
- getRecord({
4012
- workspace,
4013
- region,
4014
- database,
4015
- branch,
4016
- table,
4017
- id,
4018
- columns
4019
- }) {
4020
- return operationsByTag.records.getRecord({
4021
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
4022
- queryParams: { columns },
4023
- ...this.extraProps
4024
- });
4025
- }
4026
- insertRecordWithID({
4027
- workspace,
4028
- region,
4029
- database,
4030
- branch,
4031
- table,
4032
- id,
4033
- record,
4034
- columns,
4035
- createOnly,
4036
- ifVersion
4037
- }) {
4038
- return operationsByTag.records.insertRecordWithID({
4039
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
4040
- queryParams: { columns, createOnly, ifVersion },
4041
- body: record,
4042
- ...this.extraProps
4043
- });
4044
- }
4045
- updateRecordWithID({
4046
- workspace,
4047
- region,
4048
- database,
4049
- branch,
4050
- table,
4051
- id,
4052
- record,
4053
- columns,
4054
- ifVersion
4055
- }) {
4056
- return operationsByTag.records.updateRecordWithID({
4057
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
4058
- queryParams: { columns, ifVersion },
4059
- body: record,
4060
- ...this.extraProps
4061
- });
4062
- }
4063
- upsertRecordWithID({
4064
- workspace,
4065
- region,
4066
- database,
4067
- branch,
4068
- table,
4069
- id,
4070
- record,
4071
- columns,
4072
- ifVersion
4073
- }) {
4074
- return operationsByTag.records.upsertRecordWithID({
4075
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
4076
- queryParams: { columns, ifVersion },
4077
- body: record,
4078
- ...this.extraProps
4079
- });
4080
- }
4081
- deleteRecord({
4082
- workspace,
4083
- region,
4084
- database,
4085
- branch,
4086
- table,
4087
- id,
4088
- columns
4089
- }) {
4090
- return operationsByTag.records.deleteRecord({
4091
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
4092
- queryParams: { columns },
4093
- ...this.extraProps
4094
- });
4095
- }
4096
- bulkInsertTableRecords({
4097
- workspace,
4098
- region,
4099
- database,
4100
- branch,
4101
- table,
4102
- records,
4103
- columns
4104
- }) {
4105
- return operationsByTag.records.bulkInsertTableRecords({
4106
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
4107
- queryParams: { columns },
4108
- body: { records },
4109
- ...this.extraProps
4110
- });
4111
- }
4112
- branchTransaction({
4113
- workspace,
4114
- region,
4115
- database,
4116
- branch,
4117
- operations
4118
- }) {
4119
- return operationsByTag.records.branchTransaction({
4120
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
4121
- body: { operations },
4122
- ...this.extraProps
4123
- });
4124
- }
4125
- }
4126
- class FilesApi {
4127
- constructor(extraProps) {
4128
- this.extraProps = extraProps;
4129
- }
4130
- getFileItem({
4131
- workspace,
4132
- region,
4133
- database,
4134
- branch,
4135
- table,
4136
- record,
4137
- column,
4138
- fileId
4139
- }) {
4140
- return operationsByTag.files.getFileItem({
4141
- pathParams: {
4142
- workspace,
4143
- region,
4144
- dbBranchName: `${database}:${branch}`,
4145
- tableName: table,
4146
- recordId: record,
4147
- columnName: column,
4148
- fileId
4149
- },
4150
- ...this.extraProps
4151
- });
4152
- }
4153
- putFileItem({
4154
- workspace,
4155
- region,
4156
- database,
4157
- branch,
4158
- table,
4159
- record,
4160
- column,
4161
- fileId,
4162
- file
4163
- }) {
4164
- return operationsByTag.files.putFileItem({
4165
- pathParams: {
4166
- workspace,
4167
- region,
4168
- dbBranchName: `${database}:${branch}`,
4169
- tableName: table,
4170
- recordId: record,
4171
- columnName: column,
4172
- fileId
4173
- },
4174
- // @ts-ignore
4175
- body: file,
4176
- ...this.extraProps
4177
- });
4178
- }
4179
- deleteFileItem({
4180
- workspace,
4181
- region,
4182
- database,
4183
- branch,
4184
- table,
4185
- record,
4186
- column,
4187
- fileId
4188
- }) {
4189
- return operationsByTag.files.deleteFileItem({
4190
- pathParams: {
4191
- workspace,
4192
- region,
4193
- dbBranchName: `${database}:${branch}`,
4194
- tableName: table,
4195
- recordId: record,
4196
- columnName: column,
4197
- fileId
4198
- },
4199
- ...this.extraProps
4200
- });
4201
- }
4202
- getFile({
4203
- workspace,
4204
- region,
4205
- database,
4206
- branch,
4207
- table,
4208
- record,
4209
- column
4210
- }) {
4211
- return operationsByTag.files.getFile({
4212
- pathParams: {
4213
- workspace,
4214
- region,
4215
- dbBranchName: `${database}:${branch}`,
4216
- tableName: table,
4217
- recordId: record,
4218
- columnName: column
4219
- },
4220
- ...this.extraProps
4221
- });
4222
- }
4223
- putFile({
4224
- workspace,
4225
- region,
4226
- database,
4227
- branch,
4228
- table,
4229
- record,
4230
- column,
4231
- file
4232
- }) {
4233
- return operationsByTag.files.putFile({
4234
- pathParams: {
4235
- workspace,
4236
- region,
4237
- dbBranchName: `${database}:${branch}`,
4238
- tableName: table,
4239
- recordId: record,
4240
- columnName: column
4241
- },
4242
- body: file,
4243
- ...this.extraProps
4244
- });
4245
- }
4246
- deleteFile({
4247
- workspace,
4248
- region,
4249
- database,
4250
- branch,
4251
- table,
4252
- record,
4253
- column
4254
- }) {
4255
- return operationsByTag.files.deleteFile({
4256
- pathParams: {
4257
- workspace,
4258
- region,
4259
- dbBranchName: `${database}:${branch}`,
4260
- tableName: table,
4261
- recordId: record,
4262
- columnName: column
4263
- },
4264
- ...this.extraProps
4265
- });
4266
- }
4267
- fileAccess({
4268
- workspace,
4269
- region,
4270
- fileId,
4271
- verify
4272
- }) {
4273
- return operationsByTag.files.fileAccess({
4274
- pathParams: {
4275
- workspace,
4276
- region,
4277
- fileId
4278
- },
4279
- queryParams: { verify },
4280
- ...this.extraProps
4281
- });
4282
- }
4283
- }
4284
- class SearchAndFilterApi {
4285
- constructor(extraProps) {
4286
- this.extraProps = extraProps;
4287
- }
4288
- queryTable({
4289
- workspace,
4290
- region,
4291
- database,
4292
- branch,
4293
- table,
4294
- filter,
4295
- sort,
4296
- page,
4297
- columns,
4298
- consistency
4299
- }) {
4300
- return operationsByTag.searchAndFilter.queryTable({
4301
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
4302
- body: { filter, sort, page, columns, consistency },
4303
- ...this.extraProps
4304
- });
4305
- }
4306
- searchTable({
4307
- workspace,
4308
- region,
4309
- database,
4310
- branch,
4311
- table,
4312
- query,
4313
- fuzziness,
4314
- target,
4315
- prefix,
4316
- filter,
4317
- highlight,
4318
- boosters
4319
- }) {
4320
- return operationsByTag.searchAndFilter.searchTable({
4321
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
4322
- body: { query, fuzziness, target, prefix, filter, highlight, boosters },
4323
- ...this.extraProps
4324
- });
4325
- }
4326
- searchBranch({
4327
- workspace,
4328
- region,
4329
- database,
4330
- branch,
4331
- tables,
4332
- query,
4333
- fuzziness,
4334
- prefix,
4335
- highlight
4336
- }) {
4337
- return operationsByTag.searchAndFilter.searchBranch({
4338
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
4339
- body: { tables, query, fuzziness, prefix, highlight },
4340
- ...this.extraProps
4341
- });
4342
- }
4343
- vectorSearchTable({
4344
- workspace,
4345
- region,
4346
- database,
4347
- branch,
4348
- table,
4349
- queryVector,
4350
- column,
4351
- similarityFunction,
4352
- size,
4353
- filter
4354
- }) {
4355
- return operationsByTag.searchAndFilter.vectorSearchTable({
4356
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
4357
- body: { queryVector, column, similarityFunction, size, filter },
4358
- ...this.extraProps
4359
- });
4360
- }
4361
- askTable({
4362
- workspace,
4363
- region,
4364
- database,
4365
- branch,
4366
- table,
4367
- options
4368
- }) {
4369
- return operationsByTag.searchAndFilter.askTable({
4370
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
4371
- body: { ...options },
4372
- ...this.extraProps
4373
- });
4374
- }
4375
- askTableSession({
4376
- workspace,
4377
- region,
4378
- database,
4379
- branch,
4380
- table,
4381
- sessionId,
4382
- message
4383
- }) {
4384
- return operationsByTag.searchAndFilter.askTableSession({
4385
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, sessionId },
4386
- body: { message },
4387
- ...this.extraProps
4388
- });
4389
- }
4390
- summarizeTable({
4391
- workspace,
4392
- region,
4393
- database,
4394
- branch,
4395
- table,
4396
- filter,
4397
- columns,
4398
- summaries,
4399
- sort,
4400
- summariesFilter,
4401
- page,
4402
- consistency
4403
- }) {
4404
- return operationsByTag.searchAndFilter.summarizeTable({
4405
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
4406
- body: { filter, columns, summaries, sort, summariesFilter, page, consistency },
4407
- ...this.extraProps
4408
- });
4409
- }
4410
- aggregateTable({
4411
- workspace,
4412
- region,
4413
- database,
4414
- branch,
4415
- table,
4416
- filter,
4417
- aggs
4418
- }) {
4419
- return operationsByTag.searchAndFilter.aggregateTable({
4420
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
4421
- body: { filter, aggs },
4422
- ...this.extraProps
4423
- });
4424
- }
4425
- }
4426
- class MigrationRequestsApi {
4427
- constructor(extraProps) {
4428
- this.extraProps = extraProps;
4429
- }
4430
- queryMigrationRequests({
4431
- workspace,
4432
- region,
4433
- database,
4434
- filter,
4435
- sort,
4436
- page,
4437
- columns
4438
- }) {
4439
- return operationsByTag.migrationRequests.queryMigrationRequests({
4440
- pathParams: { workspace, region, dbName: database },
4441
- body: { filter, sort, page, columns },
4442
- ...this.extraProps
4443
- });
4444
- }
4445
- createMigrationRequest({
4446
- workspace,
4447
- region,
4448
- database,
4449
- migration
4450
- }) {
4451
- return operationsByTag.migrationRequests.createMigrationRequest({
4452
- pathParams: { workspace, region, dbName: database },
4453
- body: migration,
4454
- ...this.extraProps
4455
- });
4456
- }
4457
- getMigrationRequest({
4458
- workspace,
4459
- region,
4460
- database,
4461
- migrationRequest
4462
- }) {
4463
- return operationsByTag.migrationRequests.getMigrationRequest({
4464
- pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
4465
- ...this.extraProps
4466
- });
4467
- }
4468
- updateMigrationRequest({
4469
- workspace,
4470
- region,
4471
- database,
4472
- migrationRequest,
4473
- update
4474
- }) {
4475
- return operationsByTag.migrationRequests.updateMigrationRequest({
4476
- pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
4477
- body: update,
4478
- ...this.extraProps
4479
- });
4480
- }
4481
- listMigrationRequestsCommits({
4482
- workspace,
4483
- region,
4484
- database,
4485
- migrationRequest,
4486
- page
4487
- }) {
4488
- return operationsByTag.migrationRequests.listMigrationRequestsCommits({
4489
- pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
4490
- body: { page },
4491
- ...this.extraProps
4492
- });
4493
- }
4494
- compareMigrationRequest({
4495
- workspace,
4496
- region,
4497
- database,
4498
- migrationRequest
4499
- }) {
4500
- return operationsByTag.migrationRequests.compareMigrationRequest({
4501
- pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
4502
- ...this.extraProps
4503
- });
4504
- }
4505
- getMigrationRequestIsMerged({
4506
- workspace,
4507
- region,
4508
- database,
4509
- migrationRequest
4510
- }) {
4511
- return operationsByTag.migrationRequests.getMigrationRequestIsMerged({
4512
- pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
4513
- ...this.extraProps
4514
- });
4515
- }
4516
- mergeMigrationRequest({
4517
- workspace,
4518
- region,
4519
- database,
4520
- migrationRequest
4521
- }) {
4522
- return operationsByTag.migrationRequests.mergeMigrationRequest({
4523
- pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
4524
- ...this.extraProps
4525
- });
4526
- }
4527
- }
4528
- class MigrationsApi {
4529
- constructor(extraProps) {
4530
- this.extraProps = extraProps;
4531
- }
4532
- getBranchMigrationHistory({
4533
- workspace,
4534
- region,
4535
- database,
4536
- branch,
4537
- limit,
4538
- startFrom
4539
- }) {
4540
- return operationsByTag.migrations.getBranchMigrationHistory({
4541
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
4542
- body: { limit, startFrom },
4543
- ...this.extraProps
4544
- });
4545
- }
4546
- getBranchMigrationPlan({
4547
- workspace,
4548
- region,
4549
- database,
4550
- branch,
4551
- schema
4552
- }) {
4553
- return operationsByTag.migrations.getBranchMigrationPlan({
4554
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
4555
- body: schema,
4556
- ...this.extraProps
4557
- });
4558
- }
4559
- executeBranchMigrationPlan({
4560
- workspace,
4561
- region,
4562
- database,
4563
- branch,
4564
- plan
4565
- }) {
4566
- return operationsByTag.migrations.executeBranchMigrationPlan({
4567
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
4568
- body: plan,
4569
- ...this.extraProps
4570
- });
4571
- }
4572
- getBranchSchemaHistory({
4573
- workspace,
4574
- region,
4575
- database,
4576
- branch,
4577
- page
4578
- }) {
4579
- return operationsByTag.migrations.getBranchSchemaHistory({
4580
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
4581
- body: { page },
4582
- ...this.extraProps
4583
- });
4584
- }
4585
- compareBranchWithUserSchema({
4586
- workspace,
4587
- region,
4588
- database,
4589
- branch,
4590
- schema,
4591
- schemaOperations,
4592
- branchOperations
4593
- }) {
4594
- return operationsByTag.migrations.compareBranchWithUserSchema({
4595
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
4596
- body: { schema, schemaOperations, branchOperations },
4597
- ...this.extraProps
4598
- });
4599
- }
4600
- compareBranchSchemas({
4601
- workspace,
4602
- region,
4603
- database,
4604
- branch,
4605
- compare,
4606
- sourceBranchOperations,
4607
- targetBranchOperations
4608
- }) {
4609
- return operationsByTag.migrations.compareBranchSchemas({
4610
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, branchName: compare },
4611
- body: { sourceBranchOperations, targetBranchOperations },
4612
- ...this.extraProps
4613
- });
4614
- }
4615
- updateBranchSchema({
4616
- workspace,
4617
- region,
4618
- database,
4619
- branch,
4620
- migration
4621
- }) {
4622
- return operationsByTag.migrations.updateBranchSchema({
4623
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
4624
- body: migration,
4625
- ...this.extraProps
4626
- });
4627
- }
4628
- previewBranchSchemaEdit({
4629
- workspace,
4630
- region,
4631
- database,
4632
- branch,
4633
- data
4634
- }) {
4635
- return operationsByTag.migrations.previewBranchSchemaEdit({
4636
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
4637
- body: data,
4638
- ...this.extraProps
4639
- });
4640
- }
4641
- applyBranchSchemaEdit({
4642
- workspace,
4643
- region,
4644
- database,
4645
- branch,
4646
- edits
4647
- }) {
4648
- return operationsByTag.migrations.applyBranchSchemaEdit({
4649
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
4650
- body: { edits },
4651
- ...this.extraProps
4652
- });
4653
- }
4654
- pushBranchMigrations({
4655
- workspace,
4656
- region,
4657
- database,
4658
- branch,
4659
- migrations
4660
- }) {
4661
- return operationsByTag.migrations.pushBranchMigrations({
4662
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
4663
- body: { migrations },
4664
- ...this.extraProps
4665
- });
4666
- }
4667
- getSchema({
4668
- workspace,
4669
- region,
4670
- database,
4671
- branch
4672
- }) {
4673
- return operationsByTag.migrations.getSchema({
4674
- pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
4675
- ...this.extraProps
4676
- });
4677
- }
4678
- }
4679
- class DatabaseApi {
4680
- constructor(extraProps) {
4681
- this.extraProps = extraProps;
4682
- }
4683
- getDatabaseList({ workspace }) {
4684
- return operationsByTag.databases.getDatabaseList({
4685
- pathParams: { workspaceId: workspace },
4686
- ...this.extraProps
4687
- });
4688
- }
4689
- createDatabase({
4690
- workspace,
4691
- database,
4692
- data,
4693
- headers
4694
- }) {
4695
- return operationsByTag.databases.createDatabase({
4696
- pathParams: { workspaceId: workspace, dbName: database },
4697
- body: data,
4698
- headers,
4699
- ...this.extraProps
4700
- });
4701
- }
4702
- deleteDatabase({
4703
- workspace,
4704
- database
4705
- }) {
4706
- return operationsByTag.databases.deleteDatabase({
4707
- pathParams: { workspaceId: workspace, dbName: database },
4708
- ...this.extraProps
4709
- });
4710
- }
4711
- getDatabaseMetadata({
4712
- workspace,
4713
- database
4714
- }) {
4715
- return operationsByTag.databases.getDatabaseMetadata({
4716
- pathParams: { workspaceId: workspace, dbName: database },
4717
- ...this.extraProps
4718
- });
4719
- }
4720
- updateDatabaseMetadata({
4721
- workspace,
4722
- database,
4723
- metadata
4724
- }) {
4725
- return operationsByTag.databases.updateDatabaseMetadata({
4726
- pathParams: { workspaceId: workspace, dbName: database },
4727
- body: metadata,
4728
- ...this.extraProps
4729
- });
4730
- }
4731
- renameDatabase({
4732
- workspace,
4733
- database,
4734
- newName
4735
- }) {
4736
- return operationsByTag.databases.renameDatabase({
4737
- pathParams: { workspaceId: workspace, dbName: database },
4738
- body: { newName },
4739
- ...this.extraProps
4740
- });
4741
- }
4742
- getDatabaseGithubSettings({
4743
- workspace,
4744
- database
4745
- }) {
4746
- return operationsByTag.databases.getDatabaseGithubSettings({
4747
- pathParams: { workspaceId: workspace, dbName: database },
4748
- ...this.extraProps
4749
- });
4750
- }
4751
- updateDatabaseGithubSettings({
4752
- workspace,
4753
- database,
4754
- settings
4755
- }) {
4756
- return operationsByTag.databases.updateDatabaseGithubSettings({
4757
- pathParams: { workspaceId: workspace, dbName: database },
4758
- body: settings,
4759
- ...this.extraProps
4760
- });
4761
- }
4762
- deleteDatabaseGithubSettings({
4763
- workspace,
4764
- database
4765
- }) {
4766
- return operationsByTag.databases.deleteDatabaseGithubSettings({
4767
- pathParams: { workspaceId: workspace, dbName: database },
4768
- ...this.extraProps
4769
- });
4770
- }
4771
- listRegions({ workspace }) {
4772
- return operationsByTag.databases.listRegions({
4773
- pathParams: { workspaceId: workspace },
4774
- ...this.extraProps
4775
- });
4776
- }
3568
+ };
3569
+ class XataApiClient extends buildApiClient() {
4777
3570
  }
4778
3571
 
4779
3572
  class XataApiPlugin {
@@ -6287,7 +5080,7 @@ class SimpleCache {
6287
5080
  __privateGet$2(this, _map).set(key, value);
6288
5081
  if (__privateGet$2(this, _map).size > this.capacity) {
6289
5082
  const leastRecentlyUsed = __privateGet$2(this, _map).keys().next().value;
6290
- await this.delete(leastRecentlyUsed);
5083
+ if (leastRecentlyUsed) await this.delete(leastRecentlyUsed);
6291
5084
  }
6292
5085
  }
6293
5086
  async delete(key) {
@@ -6549,16 +5342,13 @@ class SQLPlugin extends XataPlugin {
6549
5342
  throw new Error("Invalid usage of `xata.sql`. Please use it as a tagged template or with an object.");
6550
5343
  }
6551
5344
  const { statement, params, consistency, responseType } = prepareParams(query, parameters);
6552
- const {
6553
- records,
6554
- rows,
6555
- warning,
6556
- columns = []
6557
- } = await sqlQuery({
5345
+ const { warning, columns, ...response } = await sqlQuery({
6558
5346
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
6559
5347
  body: { statement, params, consistency, responseType },
6560
5348
  ...pluginOptions
6561
5349
  });
5350
+ const records = "records" in response ? response.records : void 0;
5351
+ const rows = "rows" in response ? response.rows : void 0;
6562
5352
  return { records, rows, warning, columns };
6563
5353
  };
6564
5354
  sqlFunction.connectionString = buildConnectionString(pluginOptions);
@@ -6816,5 +5606,5 @@ class XataError extends Error {
6816
5606
  }
6817
5607
  }
6818
5608
 
6819
- export { BaseClient, Buffer, FetcherError, FilesPlugin, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, PageRecordArray, Query, RecordArray, RecordColumnTypes, Repository, RestRepository, SQLPlugin, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, TransactionPlugin, XataApiClient, XataApiPlugin, XataError, XataFile, XataPlugin, acceptWorkspaceMemberInvite, adaptAllTables, adaptTable, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, applyMigration, askTable, askTableSession, branchTransaction, buildClient, buildPreviewBranchName, buildProviderString, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, completeMigration, contains, copyBranch, createBranch, createCluster, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteCluster, deleteColumn, deleteDatabase, deleteDatabaseGithubSettings, deleteFile, deleteFileItem, deleteOAuthAccessToken, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteUserOAuthClient, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, fileAccess, fileUpload, ge, getAPIKey, getAuthorizationCode, getBranch, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationJobStatus, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getCluster, getColumn, getDatabaseGithubSettings, getDatabaseList, getDatabaseMetadata, getDatabaseSettings, getDatabaseURL, getFile, getFileItem, getGitBranchesMapping, getHostUrl, getMigrationHistory, getMigrationJobStatus, getMigrationRequest, getMigrationRequestIsMerged, getPreviewBranch, getRecord, getSchema, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getUserOAuthAccessTokens, getUserOAuthClients, getWorkspace, getWorkspaceMembersList, getWorkspaceSettings, 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, rollbackMigration, searchBranch, searchTable, serialize, setTableSchema, sqlBatchQuery, sqlQuery, startMigration, startsWith, summarizeTable, transformImage, updateBranchMetadata, updateBranchSchema, updateCluster, updateColumn, updateDatabaseGithubSettings, updateDatabaseMetadata, updateDatabaseSettings, updateMigrationRequest, updateOAuthAccessToken, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, updateWorkspaceSettings, upsertRecordWithID, vectorSearchTable };
5609
+ export { BaseClient, Buffer, FetcherError, FilesPlugin, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, PageRecordArray, Query, RecordArray, RecordColumnTypes, Repository, RestRepository, SQLPlugin, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, TransactionPlugin, XataApiClient, XataApiPlugin, XataError, XataFile, XataPlugin, acceptWorkspaceMemberInvite, adaptAllTables, adaptTable, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, applyMigration, askTable, askTableSession, branchTransaction, buildClient, buildPreviewBranchName, buildProviderString, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, completeMigration, contains, copyBranch, createBranch, createBranchAsync, createCluster, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteCluster, deleteColumn, deleteDatabase, deleteDatabaseGithubSettings, deleteFile, deleteFileItem, deleteOAuthAccessToken, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteUserOAuthClient, deleteWorkspace, deserialize, dropClusterExtension, endsWith, equals, executeBranchMigrationPlan, exists, fileAccess, fileUpload, ge, getAPIKey, getAuthorizationCode, getBranch, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationJobStatus, getBranchMigrationPlan, getBranchMoveStatus, getBranchSchemaHistory, getBranchStats, getCluster, getClusterMetrics, getColumn, getDatabaseGithubSettings, getDatabaseList, getDatabaseMetadata, getDatabaseSettings, getDatabaseURL, getFile, getFileItem, getGitBranchesMapping, getHostUrl, getMigrationHistory, getMigrationJobStatus, getMigrationJobs, getMigrationRequest, getMigrationRequestIsMerged, getPreviewBranch, getRecord, getSchema, getSchemas, getTableColumns, getTableSchema, getTaskStatus, getTasks, getUser, getUserAPIKeys, getUserOAuthAccessTokens, getUserOAuthClients, getWorkspace, getWorkspaceMembersList, getWorkspaceSettings, getWorkspacesList, grantAuthorizationCode, greaterEquals, greaterThan, greaterThanEquals, gt, gte, iContains, iPattern, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, installClusterExtension, inviteWorkspaceMember, is, isCursorPaginationOptions, isHostProviderAlias, isHostProviderBuilder, isIdentifiable, isNot, isValidExpandedColumn, isValidSelectableColumns, isXataRecord, le, lessEquals, lessThan, lessThanEquals, listClusterBranches, listClusterExtensions, listClusters, listMigrationRequestsCommits, listRegions, lt, lte, mergeMigrationRequest, moveBranch, notExists, operationsByTag, parseProviderString, parseWorkspacesUrlParts, pattern, previewBranchSchemaEdit, pushBranchMigrations, putFile, putFileItem, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, renameDatabase, resendWorkspaceMemberInvite, resolveBranch, rollbackMigration, searchBranch, searchTable, serialize, setTableSchema, sqlBatchQuery, sqlQuery, startMigration, startsWith, summarizeTable, transformImage, updateBranchMetadata, updateBranchSchema, updateCluster, updateColumn, updateDatabaseGithubSettings, updateDatabaseMetadata, updateDatabaseSettings, updateMigrationRequest, updateOAuthAccessToken, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, updateWorkspaceSettings, upsertRecordWithID, vectorSearchTable };
6820
5610
  //# sourceMappingURL=index.mjs.map