@xata.io/client 0.29.5 → 0.30.0

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