@xata.io/client 0.0.0-next.vb1fd79681a510951394a3f7028704cbfba2e74b6 → 0.0.0-next.vc44339ec360519ae99dcb7a9bc6854c1f2dcc741
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/.turbo/turbo-add-version.log +1 -1
- package/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +5 -3
- package/dist/index.cjs +416 -217
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4081 -4059
- package/dist/index.mjs +415 -214
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -1926,132 +1926,6 @@ function promiseMap(inputValues, mapper) {
|
|
1926
1926
|
return inputValues.reduce(reducer, Promise.resolve([]));
|
1927
1927
|
}
|
1928
1928
|
|
1929
|
-
function getEnvironment() {
|
1930
|
-
try {
|
1931
|
-
if (isDefined(process) && isDefined(process.env)) {
|
1932
|
-
return {
|
1933
|
-
apiKey: process.env.XATA_API_KEY ?? getGlobalApiKey(),
|
1934
|
-
databaseURL: process.env.XATA_DATABASE_URL ?? getGlobalDatabaseURL(),
|
1935
|
-
branch: process.env.XATA_BRANCH ?? getGlobalBranch(),
|
1936
|
-
deployPreview: process.env.XATA_PREVIEW,
|
1937
|
-
deployPreviewBranch: process.env.XATA_PREVIEW_BRANCH,
|
1938
|
-
vercelGitCommitRef: process.env.VERCEL_GIT_COMMIT_REF,
|
1939
|
-
vercelGitRepoOwner: process.env.VERCEL_GIT_REPO_OWNER
|
1940
|
-
};
|
1941
|
-
}
|
1942
|
-
} catch (err) {
|
1943
|
-
}
|
1944
|
-
try {
|
1945
|
-
if (isObject(Deno) && isObject(Deno.env)) {
|
1946
|
-
return {
|
1947
|
-
apiKey: Deno.env.get("XATA_API_KEY") ?? getGlobalApiKey(),
|
1948
|
-
databaseURL: Deno.env.get("XATA_DATABASE_URL") ?? getGlobalDatabaseURL(),
|
1949
|
-
branch: Deno.env.get("XATA_BRANCH") ?? getGlobalBranch(),
|
1950
|
-
deployPreview: Deno.env.get("XATA_PREVIEW"),
|
1951
|
-
deployPreviewBranch: Deno.env.get("XATA_PREVIEW_BRANCH"),
|
1952
|
-
vercelGitCommitRef: Deno.env.get("VERCEL_GIT_COMMIT_REF"),
|
1953
|
-
vercelGitRepoOwner: Deno.env.get("VERCEL_GIT_REPO_OWNER")
|
1954
|
-
};
|
1955
|
-
}
|
1956
|
-
} catch (err) {
|
1957
|
-
}
|
1958
|
-
return {
|
1959
|
-
apiKey: getGlobalApiKey(),
|
1960
|
-
databaseURL: getGlobalDatabaseURL(),
|
1961
|
-
branch: getGlobalBranch(),
|
1962
|
-
deployPreview: void 0,
|
1963
|
-
deployPreviewBranch: void 0,
|
1964
|
-
vercelGitCommitRef: void 0,
|
1965
|
-
vercelGitRepoOwner: void 0
|
1966
|
-
};
|
1967
|
-
}
|
1968
|
-
function getEnableBrowserVariable() {
|
1969
|
-
try {
|
1970
|
-
if (isObject(process) && isObject(process.env) && process.env.XATA_ENABLE_BROWSER !== void 0) {
|
1971
|
-
return process.env.XATA_ENABLE_BROWSER === "true";
|
1972
|
-
}
|
1973
|
-
} catch (err) {
|
1974
|
-
}
|
1975
|
-
try {
|
1976
|
-
if (isObject(Deno) && isObject(Deno.env) && Deno.env.get("XATA_ENABLE_BROWSER") !== void 0) {
|
1977
|
-
return Deno.env.get("XATA_ENABLE_BROWSER") === "true";
|
1978
|
-
}
|
1979
|
-
} catch (err) {
|
1980
|
-
}
|
1981
|
-
try {
|
1982
|
-
return XATA_ENABLE_BROWSER === true || XATA_ENABLE_BROWSER === "true";
|
1983
|
-
} catch (err) {
|
1984
|
-
return void 0;
|
1985
|
-
}
|
1986
|
-
}
|
1987
|
-
function getGlobalApiKey() {
|
1988
|
-
try {
|
1989
|
-
return XATA_API_KEY;
|
1990
|
-
} catch (err) {
|
1991
|
-
return void 0;
|
1992
|
-
}
|
1993
|
-
}
|
1994
|
-
function getGlobalDatabaseURL() {
|
1995
|
-
try {
|
1996
|
-
return XATA_DATABASE_URL;
|
1997
|
-
} catch (err) {
|
1998
|
-
return void 0;
|
1999
|
-
}
|
2000
|
-
}
|
2001
|
-
function getGlobalBranch() {
|
2002
|
-
try {
|
2003
|
-
return XATA_BRANCH;
|
2004
|
-
} catch (err) {
|
2005
|
-
return void 0;
|
2006
|
-
}
|
2007
|
-
}
|
2008
|
-
function getDatabaseURL() {
|
2009
|
-
try {
|
2010
|
-
const { databaseURL } = getEnvironment();
|
2011
|
-
return databaseURL;
|
2012
|
-
} catch (err) {
|
2013
|
-
return void 0;
|
2014
|
-
}
|
2015
|
-
}
|
2016
|
-
function getAPIKey() {
|
2017
|
-
try {
|
2018
|
-
const { apiKey } = getEnvironment();
|
2019
|
-
return apiKey;
|
2020
|
-
} catch (err) {
|
2021
|
-
return void 0;
|
2022
|
-
}
|
2023
|
-
}
|
2024
|
-
function getBranch() {
|
2025
|
-
try {
|
2026
|
-
const { branch } = getEnvironment();
|
2027
|
-
return branch;
|
2028
|
-
} catch (err) {
|
2029
|
-
return void 0;
|
2030
|
-
}
|
2031
|
-
}
|
2032
|
-
function buildPreviewBranchName({ org, branch }) {
|
2033
|
-
return `preview-${org}-${branch}`;
|
2034
|
-
}
|
2035
|
-
function getPreviewBranch() {
|
2036
|
-
try {
|
2037
|
-
const { deployPreview, deployPreviewBranch, vercelGitCommitRef, vercelGitRepoOwner } = getEnvironment();
|
2038
|
-
if (deployPreviewBranch)
|
2039
|
-
return deployPreviewBranch;
|
2040
|
-
switch (deployPreview) {
|
2041
|
-
case "vercel": {
|
2042
|
-
if (!vercelGitCommitRef || !vercelGitRepoOwner) {
|
2043
|
-
console.warn("XATA_PREVIEW=vercel but VERCEL_GIT_COMMIT_REF or VERCEL_GIT_REPO_OWNER is not valid");
|
2044
|
-
return void 0;
|
2045
|
-
}
|
2046
|
-
return buildPreviewBranchName({ org: vercelGitRepoOwner, branch: vercelGitCommitRef });
|
2047
|
-
}
|
2048
|
-
}
|
2049
|
-
return void 0;
|
2050
|
-
} catch (err) {
|
2051
|
-
return void 0;
|
2052
|
-
}
|
2053
|
-
}
|
2054
|
-
|
2055
1929
|
var __accessCheck$6 = (obj, member, msg) => {
|
2056
1930
|
if (!member.has(obj))
|
2057
1931
|
throw TypeError("Cannot " + msg);
|
@@ -2067,7 +1941,7 @@ var __privateAdd$6 = (obj, member, value) => {
|
|
2067
1941
|
};
|
2068
1942
|
var __privateSet$4 = (obj, member, value, setter) => {
|
2069
1943
|
__accessCheck$6(obj, member, "write to private field");
|
2070
|
-
|
1944
|
+
member.set(obj, value);
|
2071
1945
|
return value;
|
2072
1946
|
};
|
2073
1947
|
var __privateMethod$4 = (obj, member, method) => {
|
@@ -2336,7 +2210,7 @@ function defaultOnOpen(response) {
|
|
2336
2210
|
}
|
2337
2211
|
}
|
2338
2212
|
|
2339
|
-
const VERSION = "0.29.
|
2213
|
+
const VERSION = "0.29.4";
|
2340
2214
|
|
2341
2215
|
class ErrorWithCause extends Error {
|
2342
2216
|
constructor(message, options) {
|
@@ -2657,7 +2531,12 @@ function parseUrl(url) {
|
|
2657
2531
|
|
2658
2532
|
const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
|
2659
2533
|
|
2660
|
-
const applyMigration = (variables, signal) => dataPlaneFetch({
|
2534
|
+
const applyMigration = (variables, signal) => dataPlaneFetch({
|
2535
|
+
url: "/db/{dbBranchName}/migrations/apply",
|
2536
|
+
method: "post",
|
2537
|
+
...variables,
|
2538
|
+
signal
|
2539
|
+
});
|
2661
2540
|
const adaptTable = (variables, signal) => dataPlaneFetch({
|
2662
2541
|
url: "/db/{dbBranchName}/migrations/adapt/{tableName}",
|
2663
2542
|
method: "post",
|
@@ -2670,9 +2549,24 @@ const adaptAllTables = (variables, signal) => dataPlaneFetch({
|
|
2670
2549
|
...variables,
|
2671
2550
|
signal
|
2672
2551
|
});
|
2673
|
-
const getBranchMigrationJobStatus = (variables, signal) => dataPlaneFetch({
|
2674
|
-
|
2675
|
-
|
2552
|
+
const getBranchMigrationJobStatus = (variables, signal) => dataPlaneFetch({
|
2553
|
+
url: "/db/{dbBranchName}/migrations/status",
|
2554
|
+
method: "get",
|
2555
|
+
...variables,
|
2556
|
+
signal
|
2557
|
+
});
|
2558
|
+
const getMigrationJobStatus = (variables, signal) => dataPlaneFetch({
|
2559
|
+
url: "/db/{dbBranchName}/migrations/jobs/{jobId}",
|
2560
|
+
method: "get",
|
2561
|
+
...variables,
|
2562
|
+
signal
|
2563
|
+
});
|
2564
|
+
const getMigrationHistory = (variables, signal) => dataPlaneFetch({
|
2565
|
+
url: "/db/{dbBranchName}/migrations/history",
|
2566
|
+
method: "get",
|
2567
|
+
...variables,
|
2568
|
+
signal
|
2569
|
+
});
|
2676
2570
|
const getBranchList = (variables, signal) => dataPlaneFetch({
|
2677
2571
|
url: "/dbs/{dbName}",
|
2678
2572
|
method: "get",
|
@@ -2731,12 +2625,42 @@ const getBranchStats = (variables, signal) => dataPlaneFetch({
|
|
2731
2625
|
});
|
2732
2626
|
const getGitBranchesMapping = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables, signal });
|
2733
2627
|
const addGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables, signal });
|
2734
|
-
const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({
|
2735
|
-
|
2736
|
-
|
2737
|
-
|
2738
|
-
|
2739
|
-
|
2628
|
+
const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({
|
2629
|
+
url: "/dbs/{dbName}/gitBranches",
|
2630
|
+
method: "delete",
|
2631
|
+
...variables,
|
2632
|
+
signal
|
2633
|
+
});
|
2634
|
+
const resolveBranch = (variables, signal) => dataPlaneFetch({
|
2635
|
+
url: "/dbs/{dbName}/resolveBranch",
|
2636
|
+
method: "get",
|
2637
|
+
...variables,
|
2638
|
+
signal
|
2639
|
+
});
|
2640
|
+
const getBranchMigrationHistory = (variables, signal) => dataPlaneFetch({
|
2641
|
+
url: "/db/{dbBranchName}/migrations",
|
2642
|
+
method: "get",
|
2643
|
+
...variables,
|
2644
|
+
signal
|
2645
|
+
});
|
2646
|
+
const getBranchMigrationPlan = (variables, signal) => dataPlaneFetch({
|
2647
|
+
url: "/db/{dbBranchName}/migrations/plan",
|
2648
|
+
method: "post",
|
2649
|
+
...variables,
|
2650
|
+
signal
|
2651
|
+
});
|
2652
|
+
const executeBranchMigrationPlan = (variables, signal) => dataPlaneFetch({
|
2653
|
+
url: "/db/{dbBranchName}/migrations/execute",
|
2654
|
+
method: "post",
|
2655
|
+
...variables,
|
2656
|
+
signal
|
2657
|
+
});
|
2658
|
+
const queryMigrationRequests = (variables, signal) => dataPlaneFetch({
|
2659
|
+
url: "/dbs/{dbName}/migrations/query",
|
2660
|
+
method: "post",
|
2661
|
+
...variables,
|
2662
|
+
signal
|
2663
|
+
});
|
2740
2664
|
const createMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
2741
2665
|
const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2742
2666
|
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
@@ -2744,23 +2668,78 @@ const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
|
2744
2668
|
...variables,
|
2745
2669
|
signal
|
2746
2670
|
});
|
2747
|
-
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2748
|
-
|
2749
|
-
|
2750
|
-
|
2671
|
+
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2672
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
2673
|
+
method: "patch",
|
2674
|
+
...variables,
|
2675
|
+
signal
|
2676
|
+
});
|
2677
|
+
const listMigrationRequestsCommits = (variables, signal) => dataPlaneFetch({
|
2678
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/commits",
|
2679
|
+
method: "post",
|
2680
|
+
...variables,
|
2681
|
+
signal
|
2682
|
+
});
|
2683
|
+
const compareMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2684
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/compare",
|
2685
|
+
method: "post",
|
2686
|
+
...variables,
|
2687
|
+
signal
|
2688
|
+
});
|
2689
|
+
const getMigrationRequestIsMerged = (variables, signal) => dataPlaneFetch({
|
2690
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
2691
|
+
method: "get",
|
2692
|
+
...variables,
|
2693
|
+
signal
|
2694
|
+
});
|
2751
2695
|
const mergeMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2752
2696
|
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
2753
2697
|
method: "post",
|
2754
2698
|
...variables,
|
2755
2699
|
signal
|
2756
2700
|
});
|
2757
|
-
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({
|
2758
|
-
|
2759
|
-
|
2760
|
-
|
2761
|
-
|
2762
|
-
|
2763
|
-
const
|
2701
|
+
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({
|
2702
|
+
url: "/db/{dbBranchName}/schema/history",
|
2703
|
+
method: "post",
|
2704
|
+
...variables,
|
2705
|
+
signal
|
2706
|
+
});
|
2707
|
+
const compareBranchWithUserSchema = (variables, signal) => dataPlaneFetch({
|
2708
|
+
url: "/db/{dbBranchName}/schema/compare",
|
2709
|
+
method: "post",
|
2710
|
+
...variables,
|
2711
|
+
signal
|
2712
|
+
});
|
2713
|
+
const compareBranchSchemas = (variables, signal) => dataPlaneFetch({
|
2714
|
+
url: "/db/{dbBranchName}/schema/compare/{branchName}",
|
2715
|
+
method: "post",
|
2716
|
+
...variables,
|
2717
|
+
signal
|
2718
|
+
});
|
2719
|
+
const updateBranchSchema = (variables, signal) => dataPlaneFetch({
|
2720
|
+
url: "/db/{dbBranchName}/schema/update",
|
2721
|
+
method: "post",
|
2722
|
+
...variables,
|
2723
|
+
signal
|
2724
|
+
});
|
2725
|
+
const previewBranchSchemaEdit = (variables, signal) => dataPlaneFetch({
|
2726
|
+
url: "/db/{dbBranchName}/schema/preview",
|
2727
|
+
method: "post",
|
2728
|
+
...variables,
|
2729
|
+
signal
|
2730
|
+
});
|
2731
|
+
const applyBranchSchemaEdit = (variables, signal) => dataPlaneFetch({
|
2732
|
+
url: "/db/{dbBranchName}/schema/apply",
|
2733
|
+
method: "post",
|
2734
|
+
...variables,
|
2735
|
+
signal
|
2736
|
+
});
|
2737
|
+
const pushBranchMigrations = (variables, signal) => dataPlaneFetch({
|
2738
|
+
url: "/db/{dbBranchName}/schema/push",
|
2739
|
+
method: "post",
|
2740
|
+
...variables,
|
2741
|
+
signal
|
2742
|
+
});
|
2764
2743
|
const createTable = (variables, signal) => dataPlaneFetch({
|
2765
2744
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
2766
2745
|
method: "put",
|
@@ -2773,14 +2752,24 @@ const deleteTable = (variables, signal) => dataPlaneFetch({
|
|
2773
2752
|
...variables,
|
2774
2753
|
signal
|
2775
2754
|
});
|
2776
|
-
const updateTable = (variables, signal) => dataPlaneFetch({
|
2755
|
+
const updateTable = (variables, signal) => dataPlaneFetch({
|
2756
|
+
url: "/db/{dbBranchName}/tables/{tableName}",
|
2757
|
+
method: "patch",
|
2758
|
+
...variables,
|
2759
|
+
signal
|
2760
|
+
});
|
2777
2761
|
const getTableSchema = (variables, signal) => dataPlaneFetch({
|
2778
2762
|
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
2779
2763
|
method: "get",
|
2780
2764
|
...variables,
|
2781
2765
|
signal
|
2782
2766
|
});
|
2783
|
-
const setTableSchema = (variables, signal) => dataPlaneFetch({
|
2767
|
+
const setTableSchema = (variables, signal) => dataPlaneFetch({
|
2768
|
+
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
2769
|
+
method: "put",
|
2770
|
+
...variables,
|
2771
|
+
signal
|
2772
|
+
});
|
2784
2773
|
const getTableColumns = (variables, signal) => dataPlaneFetch({
|
2785
2774
|
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
2786
2775
|
method: "get",
|
@@ -2788,7 +2777,12 @@ const getTableColumns = (variables, signal) => dataPlaneFetch({
|
|
2788
2777
|
signal
|
2789
2778
|
});
|
2790
2779
|
const addTableColumn = (variables, signal) => dataPlaneFetch(
|
2791
|
-
{
|
2780
|
+
{
|
2781
|
+
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
2782
|
+
method: "post",
|
2783
|
+
...variables,
|
2784
|
+
signal
|
2785
|
+
}
|
2792
2786
|
);
|
2793
2787
|
const getColumn = (variables, signal) => dataPlaneFetch({
|
2794
2788
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
@@ -2796,15 +2790,30 @@ const getColumn = (variables, signal) => dataPlaneFetch({
|
|
2796
2790
|
...variables,
|
2797
2791
|
signal
|
2798
2792
|
});
|
2799
|
-
const updateColumn = (variables, signal) => dataPlaneFetch({
|
2793
|
+
const updateColumn = (variables, signal) => dataPlaneFetch({
|
2794
|
+
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
2795
|
+
method: "patch",
|
2796
|
+
...variables,
|
2797
|
+
signal
|
2798
|
+
});
|
2800
2799
|
const deleteColumn = (variables, signal) => dataPlaneFetch({
|
2801
2800
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
2802
2801
|
method: "delete",
|
2803
2802
|
...variables,
|
2804
2803
|
signal
|
2805
2804
|
});
|
2806
|
-
const branchTransaction = (variables, signal) => dataPlaneFetch({
|
2807
|
-
|
2805
|
+
const branchTransaction = (variables, signal) => dataPlaneFetch({
|
2806
|
+
url: "/db/{dbBranchName}/transaction",
|
2807
|
+
method: "post",
|
2808
|
+
...variables,
|
2809
|
+
signal
|
2810
|
+
});
|
2811
|
+
const insertRecord = (variables, signal) => dataPlaneFetch({
|
2812
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data",
|
2813
|
+
method: "post",
|
2814
|
+
...variables,
|
2815
|
+
signal
|
2816
|
+
});
|
2808
2817
|
const getFileItem = (variables, signal) => dataPlaneFetch({
|
2809
2818
|
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file/{fileId}",
|
2810
2819
|
method: "get",
|
@@ -2847,11 +2856,36 @@ const getRecord = (variables, signal) => dataPlaneFetch({
|
|
2847
2856
|
...variables,
|
2848
2857
|
signal
|
2849
2858
|
});
|
2850
|
-
const insertRecordWithID = (variables, signal) => dataPlaneFetch({
|
2851
|
-
|
2852
|
-
|
2853
|
-
|
2854
|
-
|
2859
|
+
const insertRecordWithID = (variables, signal) => dataPlaneFetch({
|
2860
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
2861
|
+
method: "put",
|
2862
|
+
...variables,
|
2863
|
+
signal
|
2864
|
+
});
|
2865
|
+
const updateRecordWithID = (variables, signal) => dataPlaneFetch({
|
2866
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
2867
|
+
method: "patch",
|
2868
|
+
...variables,
|
2869
|
+
signal
|
2870
|
+
});
|
2871
|
+
const upsertRecordWithID = (variables, signal) => dataPlaneFetch({
|
2872
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
2873
|
+
method: "post",
|
2874
|
+
...variables,
|
2875
|
+
signal
|
2876
|
+
});
|
2877
|
+
const deleteRecord = (variables, signal) => dataPlaneFetch({
|
2878
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
2879
|
+
method: "delete",
|
2880
|
+
...variables,
|
2881
|
+
signal
|
2882
|
+
});
|
2883
|
+
const bulkInsertTableRecords = (variables, signal) => dataPlaneFetch({
|
2884
|
+
url: "/db/{dbBranchName}/tables/{tableName}/bulk",
|
2885
|
+
method: "post",
|
2886
|
+
...variables,
|
2887
|
+
signal
|
2888
|
+
});
|
2855
2889
|
const queryTable = (variables, signal) => dataPlaneFetch({
|
2856
2890
|
url: "/db/{dbBranchName}/tables/{tableName}/query",
|
2857
2891
|
method: "post",
|
@@ -2870,16 +2904,36 @@ const searchTable = (variables, signal) => dataPlaneFetch({
|
|
2870
2904
|
...variables,
|
2871
2905
|
signal
|
2872
2906
|
});
|
2873
|
-
const vectorSearchTable = (variables, signal) => dataPlaneFetch({
|
2907
|
+
const vectorSearchTable = (variables, signal) => dataPlaneFetch({
|
2908
|
+
url: "/db/{dbBranchName}/tables/{tableName}/vectorSearch",
|
2909
|
+
method: "post",
|
2910
|
+
...variables,
|
2911
|
+
signal
|
2912
|
+
});
|
2874
2913
|
const askTable = (variables, signal) => dataPlaneFetch({
|
2875
2914
|
url: "/db/{dbBranchName}/tables/{tableName}/ask",
|
2876
2915
|
method: "post",
|
2877
2916
|
...variables,
|
2878
2917
|
signal
|
2879
2918
|
});
|
2880
|
-
const askTableSession = (variables, signal) => dataPlaneFetch({
|
2881
|
-
|
2882
|
-
|
2919
|
+
const askTableSession = (variables, signal) => dataPlaneFetch({
|
2920
|
+
url: "/db/{dbBranchName}/tables/{tableName}/ask/{sessionId}",
|
2921
|
+
method: "post",
|
2922
|
+
...variables,
|
2923
|
+
signal
|
2924
|
+
});
|
2925
|
+
const summarizeTable = (variables, signal) => dataPlaneFetch({
|
2926
|
+
url: "/db/{dbBranchName}/tables/{tableName}/summarize",
|
2927
|
+
method: "post",
|
2928
|
+
...variables,
|
2929
|
+
signal
|
2930
|
+
});
|
2931
|
+
const aggregateTable = (variables, signal) => dataPlaneFetch({
|
2932
|
+
url: "/db/{dbBranchName}/tables/{tableName}/aggregate",
|
2933
|
+
method: "post",
|
2934
|
+
...variables,
|
2935
|
+
signal
|
2936
|
+
});
|
2883
2937
|
const fileAccess = (variables, signal) => dataPlaneFetch({
|
2884
2938
|
url: "/file/{fileId}",
|
2885
2939
|
method: "get",
|
@@ -2965,7 +3019,16 @@ const operationsByTag$2 = {
|
|
2965
3019
|
deleteRecord,
|
2966
3020
|
bulkInsertTableRecords
|
2967
3021
|
},
|
2968
|
-
files: {
|
3022
|
+
files: {
|
3023
|
+
getFileItem,
|
3024
|
+
putFileItem,
|
3025
|
+
deleteFileItem,
|
3026
|
+
getFile,
|
3027
|
+
putFile,
|
3028
|
+
deleteFile,
|
3029
|
+
fileAccess,
|
3030
|
+
fileUpload
|
3031
|
+
},
|
2969
3032
|
searchAndFilter: {
|
2970
3033
|
queryTable,
|
2971
3034
|
searchBranch,
|
@@ -3043,7 +3106,12 @@ const deleteOAuthAccessToken = (variables, signal) => controlPlaneFetch({
|
|
3043
3106
|
...variables,
|
3044
3107
|
signal
|
3045
3108
|
});
|
3046
|
-
const updateOAuthAccessToken = (variables, signal) => controlPlaneFetch({
|
3109
|
+
const updateOAuthAccessToken = (variables, signal) => controlPlaneFetch({
|
3110
|
+
url: "/user/oauth/tokens/{token}",
|
3111
|
+
method: "patch",
|
3112
|
+
...variables,
|
3113
|
+
signal
|
3114
|
+
});
|
3047
3115
|
const getWorkspacesList = (variables, signal) => controlPlaneFetch({
|
3048
3116
|
url: "/workspaces",
|
3049
3117
|
method: "get",
|
@@ -3074,49 +3142,150 @@ const deleteWorkspace = (variables, signal) => controlPlaneFetch({
|
|
3074
3142
|
...variables,
|
3075
3143
|
signal
|
3076
3144
|
});
|
3077
|
-
const getWorkspaceSettings = (variables, signal) => controlPlaneFetch({
|
3078
|
-
|
3079
|
-
|
3080
|
-
|
3145
|
+
const getWorkspaceSettings = (variables, signal) => controlPlaneFetch({
|
3146
|
+
url: "/workspaces/{workspaceId}/settings",
|
3147
|
+
method: "get",
|
3148
|
+
...variables,
|
3149
|
+
signal
|
3150
|
+
});
|
3151
|
+
const updateWorkspaceSettings = (variables, signal) => controlPlaneFetch({
|
3152
|
+
url: "/workspaces/{workspaceId}/settings",
|
3153
|
+
method: "patch",
|
3154
|
+
...variables,
|
3155
|
+
signal
|
3156
|
+
});
|
3157
|
+
const getWorkspaceMembersList = (variables, signal) => controlPlaneFetch({
|
3158
|
+
url: "/workspaces/{workspaceId}/members",
|
3159
|
+
method: "get",
|
3160
|
+
...variables,
|
3161
|
+
signal
|
3162
|
+
});
|
3163
|
+
const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({
|
3164
|
+
url: "/workspaces/{workspaceId}/members/{userId}",
|
3165
|
+
method: "put",
|
3166
|
+
...variables,
|
3167
|
+
signal
|
3168
|
+
});
|
3081
3169
|
const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
3082
3170
|
url: "/workspaces/{workspaceId}/members/{userId}",
|
3083
3171
|
method: "delete",
|
3084
3172
|
...variables,
|
3085
3173
|
signal
|
3086
3174
|
});
|
3087
|
-
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
3088
|
-
|
3089
|
-
|
3090
|
-
|
3091
|
-
|
3092
|
-
|
3093
|
-
const
|
3175
|
+
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
3176
|
+
url: "/workspaces/{workspaceId}/invites",
|
3177
|
+
method: "post",
|
3178
|
+
...variables,
|
3179
|
+
signal
|
3180
|
+
});
|
3181
|
+
const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3182
|
+
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
3183
|
+
method: "patch",
|
3184
|
+
...variables,
|
3185
|
+
signal
|
3186
|
+
});
|
3187
|
+
const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3188
|
+
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
3189
|
+
method: "delete",
|
3190
|
+
...variables,
|
3191
|
+
signal
|
3192
|
+
});
|
3193
|
+
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3194
|
+
url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept",
|
3195
|
+
method: "post",
|
3196
|
+
...variables,
|
3197
|
+
signal
|
3198
|
+
});
|
3199
|
+
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3200
|
+
url: "/workspaces/{workspaceId}/invites/{inviteId}/resend",
|
3201
|
+
method: "post",
|
3202
|
+
...variables,
|
3203
|
+
signal
|
3204
|
+
});
|
3205
|
+
const listClusters = (variables, signal) => controlPlaneFetch({
|
3206
|
+
url: "/workspaces/{workspaceId}/clusters",
|
3207
|
+
method: "get",
|
3208
|
+
...variables,
|
3209
|
+
signal
|
3210
|
+
});
|
3211
|
+
const createCluster = (variables, signal) => controlPlaneFetch({
|
3212
|
+
url: "/workspaces/{workspaceId}/clusters",
|
3213
|
+
method: "post",
|
3214
|
+
...variables,
|
3215
|
+
signal
|
3216
|
+
});
|
3094
3217
|
const getCluster = (variables, signal) => controlPlaneFetch({
|
3095
3218
|
url: "/workspaces/{workspaceId}/clusters/{clusterId}",
|
3096
3219
|
method: "get",
|
3097
3220
|
...variables,
|
3098
3221
|
signal
|
3099
3222
|
});
|
3100
|
-
const updateCluster = (variables, signal) => controlPlaneFetch({
|
3223
|
+
const updateCluster = (variables, signal) => controlPlaneFetch({
|
3224
|
+
url: "/workspaces/{workspaceId}/clusters/{clusterId}",
|
3225
|
+
method: "patch",
|
3226
|
+
...variables,
|
3227
|
+
signal
|
3228
|
+
});
|
3229
|
+
const deleteCluster = (variables, signal) => controlPlaneFetch({
|
3230
|
+
url: "/workspaces/{workspaceId}/clusters/{clusterId}",
|
3231
|
+
method: "delete",
|
3232
|
+
...variables,
|
3233
|
+
signal
|
3234
|
+
});
|
3101
3235
|
const getDatabaseList = (variables, signal) => controlPlaneFetch({
|
3102
3236
|
url: "/workspaces/{workspaceId}/dbs",
|
3103
3237
|
method: "get",
|
3104
3238
|
...variables,
|
3105
3239
|
signal
|
3106
3240
|
});
|
3107
|
-
const createDatabase = (variables, signal) => controlPlaneFetch({
|
3241
|
+
const createDatabase = (variables, signal) => controlPlaneFetch({
|
3242
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3243
|
+
method: "put",
|
3244
|
+
...variables,
|
3245
|
+
signal
|
3246
|
+
});
|
3108
3247
|
const deleteDatabase = (variables, signal) => controlPlaneFetch({
|
3109
3248
|
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3110
3249
|
method: "delete",
|
3111
3250
|
...variables,
|
3112
3251
|
signal
|
3113
3252
|
});
|
3114
|
-
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({
|
3115
|
-
|
3116
|
-
|
3117
|
-
|
3118
|
-
|
3119
|
-
|
3253
|
+
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({
|
3254
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3255
|
+
method: "get",
|
3256
|
+
...variables,
|
3257
|
+
signal
|
3258
|
+
});
|
3259
|
+
const updateDatabaseMetadata = (variables, signal) => controlPlaneFetch({
|
3260
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3261
|
+
method: "patch",
|
3262
|
+
...variables,
|
3263
|
+
signal
|
3264
|
+
});
|
3265
|
+
const renameDatabase = (variables, signal) => controlPlaneFetch({
|
3266
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/rename",
|
3267
|
+
method: "post",
|
3268
|
+
...variables,
|
3269
|
+
signal
|
3270
|
+
});
|
3271
|
+
const getDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({
|
3272
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/github",
|
3273
|
+
method: "get",
|
3274
|
+
...variables,
|
3275
|
+
signal
|
3276
|
+
});
|
3277
|
+
const updateDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({
|
3278
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/github",
|
3279
|
+
method: "put",
|
3280
|
+
...variables,
|
3281
|
+
signal
|
3282
|
+
});
|
3283
|
+
const deleteDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({
|
3284
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/github",
|
3285
|
+
method: "delete",
|
3286
|
+
...variables,
|
3287
|
+
signal
|
3288
|
+
});
|
3120
3289
|
const listRegions = (variables, signal) => controlPlaneFetch({
|
3121
3290
|
url: "/workspaces/{workspaceId}/regions",
|
3122
3291
|
method: "get",
|
@@ -3154,7 +3323,13 @@ const operationsByTag$1 = {
|
|
3154
3323
|
acceptWorkspaceMemberInvite,
|
3155
3324
|
resendWorkspaceMemberInvite
|
3156
3325
|
},
|
3157
|
-
xbcontrolOther: {
|
3326
|
+
xbcontrolOther: {
|
3327
|
+
listClusters,
|
3328
|
+
createCluster,
|
3329
|
+
getCluster,
|
3330
|
+
updateCluster,
|
3331
|
+
deleteCluster
|
3332
|
+
},
|
3158
3333
|
databases: {
|
3159
3334
|
getDatabaseList,
|
3160
3335
|
createDatabase,
|
@@ -3174,7 +3349,7 @@ const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
|
|
3174
3349
|
const buildApiClient = () => class {
|
3175
3350
|
constructor(options = {}) {
|
3176
3351
|
const provider = options.host ?? "production";
|
3177
|
-
const apiKey = options.apiKey
|
3352
|
+
const apiKey = options.apiKey;
|
3178
3353
|
const trace = options.trace ?? defaultTrace;
|
3179
3354
|
const clientID = generateUUID();
|
3180
3355
|
if (!apiKey) {
|
@@ -3431,7 +3606,7 @@ var __privateAdd$5 = (obj, member, value) => {
|
|
3431
3606
|
};
|
3432
3607
|
var __privateSet$3 = (obj, member, value, setter) => {
|
3433
3608
|
__accessCheck$5(obj, member, "write to private field");
|
3434
|
-
|
3609
|
+
member.set(obj, value);
|
3435
3610
|
return value;
|
3436
3611
|
};
|
3437
3612
|
var _query, _page;
|
@@ -3610,7 +3785,7 @@ var __privateAdd$4 = (obj, member, value) => {
|
|
3610
3785
|
};
|
3611
3786
|
var __privateSet$2 = (obj, member, value, setter) => {
|
3612
3787
|
__accessCheck$4(obj, member, "write to private field");
|
3613
|
-
|
3788
|
+
member.set(obj, value);
|
3614
3789
|
return value;
|
3615
3790
|
};
|
3616
3791
|
var __privateMethod$3 = (obj, member, method) => {
|
@@ -3938,7 +4113,7 @@ var __privateAdd$3 = (obj, member, value) => {
|
|
3938
4113
|
};
|
3939
4114
|
var __privateSet$1 = (obj, member, value, setter) => {
|
3940
4115
|
__accessCheck$3(obj, member, "write to private field");
|
3941
|
-
|
4116
|
+
member.set(obj, value);
|
3942
4117
|
return value;
|
3943
4118
|
};
|
3944
4119
|
var __privateMethod$2 = (obj, member, method) => {
|
@@ -5107,7 +5282,7 @@ var __privateAdd = (obj, member, value) => {
|
|
5107
5282
|
};
|
5108
5283
|
var __privateSet = (obj, member, value, setter) => {
|
5109
5284
|
__accessCheck(obj, member, "write to private field");
|
5110
|
-
|
5285
|
+
member.set(obj, value);
|
5111
5286
|
return value;
|
5112
5287
|
};
|
5113
5288
|
var __privateMethod = (obj, member, method) => {
|
@@ -5152,7 +5327,7 @@ const buildClient = (plugins) => {
|
|
5152
5327
|
return { databaseURL, branch };
|
5153
5328
|
}
|
5154
5329
|
}, _options = new WeakMap(), _parseOptions = new WeakSet(), parseOptions_fn = function(options) {
|
5155
|
-
const enableBrowser = options?.enableBrowser ??
|
5330
|
+
const enableBrowser = options?.enableBrowser ?? false;
|
5156
5331
|
const isBrowser = typeof window !== "undefined" && typeof Deno === "undefined";
|
5157
5332
|
if (isBrowser && !enableBrowser) {
|
5158
5333
|
throw new Error(
|
@@ -5160,8 +5335,9 @@ const buildClient = (plugins) => {
|
|
5160
5335
|
);
|
5161
5336
|
}
|
5162
5337
|
const fetch = getFetchImplementation(options?.fetch);
|
5163
|
-
const databaseURL = options?.databaseURL
|
5164
|
-
const apiKey = options?.apiKey
|
5338
|
+
const databaseURL = options?.databaseURL;
|
5339
|
+
const apiKey = options?.apiKey;
|
5340
|
+
const branch = options?.branch;
|
5165
5341
|
const trace = options?.trace ?? defaultTrace;
|
5166
5342
|
const clientName = options?.clientName;
|
5167
5343
|
const host = options?.host ?? "production";
|
@@ -5172,25 +5348,8 @@ const buildClient = (plugins) => {
|
|
5172
5348
|
if (!databaseURL) {
|
5173
5349
|
throw new Error("Option databaseURL is required");
|
5174
5350
|
}
|
5175
|
-
|
5176
|
-
|
5177
|
-
const branch = options?.branch || previewBranch || envBranch || "main";
|
5178
|
-
if (!!previewBranch && branch !== previewBranch) {
|
5179
|
-
console.warn(
|
5180
|
-
`Ignoring preview branch ${previewBranch} because branch option was passed to the client constructor with value ${branch}`
|
5181
|
-
);
|
5182
|
-
} else if (!!envBranch && branch !== envBranch) {
|
5183
|
-
console.warn(
|
5184
|
-
`Ignoring branch ${envBranch} because branch option was passed to the client constructor with value ${branch}`
|
5185
|
-
);
|
5186
|
-
} else if (!!previewBranch && !!envBranch && previewBranch !== envBranch) {
|
5187
|
-
console.warn(
|
5188
|
-
`Ignoring preview branch ${previewBranch} and branch ${envBranch} because branch option was passed to the client constructor with value ${branch}`
|
5189
|
-
);
|
5190
|
-
} else if (!previewBranch && !envBranch && options?.branch === void 0) {
|
5191
|
-
console.warn(
|
5192
|
-
`No branch was passed to the client constructor. Using default branch ${branch}. You can set the branch with the environment variable XATA_BRANCH or by passing the branch option to the client constructor.`
|
5193
|
-
);
|
5351
|
+
if (!branch) {
|
5352
|
+
throw new Error("Option branch is required");
|
5194
5353
|
}
|
5195
5354
|
return {
|
5196
5355
|
fetch,
|
@@ -5301,6 +5460,48 @@ const deserialize = (json) => {
|
|
5301
5460
|
return defaultSerializer.fromJSON(json);
|
5302
5461
|
};
|
5303
5462
|
|
5463
|
+
function parseEnvironment(environment) {
|
5464
|
+
try {
|
5465
|
+
if (typeof environment === "function") {
|
5466
|
+
return new Proxy(
|
5467
|
+
{},
|
5468
|
+
{
|
5469
|
+
get(target) {
|
5470
|
+
return environment(target);
|
5471
|
+
}
|
5472
|
+
}
|
5473
|
+
);
|
5474
|
+
}
|
5475
|
+
if (isObject(environment)) {
|
5476
|
+
return environment;
|
5477
|
+
}
|
5478
|
+
} catch (error) {
|
5479
|
+
}
|
5480
|
+
return {};
|
5481
|
+
}
|
5482
|
+
function buildPreviewBranchName({ org, branch }) {
|
5483
|
+
return `preview-${org}-${branch}`;
|
5484
|
+
}
|
5485
|
+
function getDeployPreviewBranch(environment) {
|
5486
|
+
try {
|
5487
|
+
const { deployPreview, deployPreviewBranch, vercelGitCommitRef, vercelGitRepoOwner } = parseEnvironment(environment);
|
5488
|
+
if (deployPreviewBranch)
|
5489
|
+
return deployPreviewBranch;
|
5490
|
+
switch (deployPreview) {
|
5491
|
+
case "vercel": {
|
5492
|
+
if (!vercelGitCommitRef || !vercelGitRepoOwner) {
|
5493
|
+
console.warn("XATA_PREVIEW=vercel but VERCEL_GIT_COMMIT_REF or VERCEL_GIT_REPO_OWNER is not valid");
|
5494
|
+
return void 0;
|
5495
|
+
}
|
5496
|
+
return buildPreviewBranchName({ org: vercelGitRepoOwner, branch: vercelGitCommitRef });
|
5497
|
+
}
|
5498
|
+
}
|
5499
|
+
return void 0;
|
5500
|
+
} catch (err) {
|
5501
|
+
return void 0;
|
5502
|
+
}
|
5503
|
+
}
|
5504
|
+
|
5304
5505
|
class XataError extends Error {
|
5305
5506
|
constructor(message, status) {
|
5306
5507
|
super(message);
|
@@ -5363,6 +5564,7 @@ exports.createTable = createTable;
|
|
5363
5564
|
exports.createUserAPIKey = createUserAPIKey;
|
5364
5565
|
exports.createWorkspace = createWorkspace;
|
5365
5566
|
exports.deleteBranch = deleteBranch;
|
5567
|
+
exports.deleteCluster = deleteCluster;
|
5366
5568
|
exports.deleteColumn = deleteColumn;
|
5367
5569
|
exports.deleteDatabase = deleteDatabase;
|
5368
5570
|
exports.deleteDatabaseGithubSettings = deleteDatabaseGithubSettings;
|
@@ -5383,9 +5585,7 @@ exports.exists = exists;
|
|
5383
5585
|
exports.fileAccess = fileAccess;
|
5384
5586
|
exports.fileUpload = fileUpload;
|
5385
5587
|
exports.ge = ge;
|
5386
|
-
exports.getAPIKey = getAPIKey;
|
5387
5588
|
exports.getAuthorizationCode = getAuthorizationCode;
|
5388
|
-
exports.getBranch = getBranch;
|
5389
5589
|
exports.getBranchDetails = getBranchDetails;
|
5390
5590
|
exports.getBranchList = getBranchList;
|
5391
5591
|
exports.getBranchMetadata = getBranchMetadata;
|
@@ -5400,7 +5600,7 @@ exports.getDatabaseGithubSettings = getDatabaseGithubSettings;
|
|
5400
5600
|
exports.getDatabaseList = getDatabaseList;
|
5401
5601
|
exports.getDatabaseMetadata = getDatabaseMetadata;
|
5402
5602
|
exports.getDatabaseSettings = getDatabaseSettings;
|
5403
|
-
exports.
|
5603
|
+
exports.getDeployPreviewBranch = getDeployPreviewBranch;
|
5404
5604
|
exports.getFile = getFile;
|
5405
5605
|
exports.getFileItem = getFileItem;
|
5406
5606
|
exports.getGitBranchesMapping = getGitBranchesMapping;
|
@@ -5409,7 +5609,6 @@ exports.getMigrationHistory = getMigrationHistory;
|
|
5409
5609
|
exports.getMigrationJobStatus = getMigrationJobStatus;
|
5410
5610
|
exports.getMigrationRequest = getMigrationRequest;
|
5411
5611
|
exports.getMigrationRequestIsMerged = getMigrationRequestIsMerged;
|
5412
|
-
exports.getPreviewBranch = getPreviewBranch;
|
5413
5612
|
exports.getRecord = getRecord;
|
5414
5613
|
exports.getSchema = getSchema;
|
5415
5614
|
exports.getTableColumns = getTableColumns;
|