@xata.io/client 0.0.0-next.v2c2c59b7ff457cfa05e0e8617936eccf628baba4 → 0.0.0-next.v3c98c9e18d38b282eb80381e4bd7bf95da9aabdb
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-build.log +2 -2
- package/CHANGELOG.md +3 -3
- package/dist/index.cjs +410 -211
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4081 -4059
- package/dist/index.mjs +409 -208
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -1924,132 +1924,6 @@ function promiseMap(inputValues, mapper) {
|
|
1924
1924
|
return inputValues.reduce(reducer, Promise.resolve([]));
|
1925
1925
|
}
|
1926
1926
|
|
1927
|
-
function getEnvironment() {
|
1928
|
-
try {
|
1929
|
-
if (isDefined(process) && isDefined(process.env)) {
|
1930
|
-
return {
|
1931
|
-
apiKey: process.env.XATA_API_KEY ?? getGlobalApiKey(),
|
1932
|
-
databaseURL: process.env.XATA_DATABASE_URL ?? getGlobalDatabaseURL(),
|
1933
|
-
branch: process.env.XATA_BRANCH ?? getGlobalBranch(),
|
1934
|
-
deployPreview: process.env.XATA_PREVIEW,
|
1935
|
-
deployPreviewBranch: process.env.XATA_PREVIEW_BRANCH,
|
1936
|
-
vercelGitCommitRef: process.env.VERCEL_GIT_COMMIT_REF,
|
1937
|
-
vercelGitRepoOwner: process.env.VERCEL_GIT_REPO_OWNER
|
1938
|
-
};
|
1939
|
-
}
|
1940
|
-
} catch (err) {
|
1941
|
-
}
|
1942
|
-
try {
|
1943
|
-
if (isObject(Deno) && isObject(Deno.env)) {
|
1944
|
-
return {
|
1945
|
-
apiKey: Deno.env.get("XATA_API_KEY") ?? getGlobalApiKey(),
|
1946
|
-
databaseURL: Deno.env.get("XATA_DATABASE_URL") ?? getGlobalDatabaseURL(),
|
1947
|
-
branch: Deno.env.get("XATA_BRANCH") ?? getGlobalBranch(),
|
1948
|
-
deployPreview: Deno.env.get("XATA_PREVIEW"),
|
1949
|
-
deployPreviewBranch: Deno.env.get("XATA_PREVIEW_BRANCH"),
|
1950
|
-
vercelGitCommitRef: Deno.env.get("VERCEL_GIT_COMMIT_REF"),
|
1951
|
-
vercelGitRepoOwner: Deno.env.get("VERCEL_GIT_REPO_OWNER")
|
1952
|
-
};
|
1953
|
-
}
|
1954
|
-
} catch (err) {
|
1955
|
-
}
|
1956
|
-
return {
|
1957
|
-
apiKey: getGlobalApiKey(),
|
1958
|
-
databaseURL: getGlobalDatabaseURL(),
|
1959
|
-
branch: getGlobalBranch(),
|
1960
|
-
deployPreview: void 0,
|
1961
|
-
deployPreviewBranch: void 0,
|
1962
|
-
vercelGitCommitRef: void 0,
|
1963
|
-
vercelGitRepoOwner: void 0
|
1964
|
-
};
|
1965
|
-
}
|
1966
|
-
function getEnableBrowserVariable() {
|
1967
|
-
try {
|
1968
|
-
if (isObject(process) && isObject(process.env) && process.env.XATA_ENABLE_BROWSER !== void 0) {
|
1969
|
-
return process.env.XATA_ENABLE_BROWSER === "true";
|
1970
|
-
}
|
1971
|
-
} catch (err) {
|
1972
|
-
}
|
1973
|
-
try {
|
1974
|
-
if (isObject(Deno) && isObject(Deno.env) && Deno.env.get("XATA_ENABLE_BROWSER") !== void 0) {
|
1975
|
-
return Deno.env.get("XATA_ENABLE_BROWSER") === "true";
|
1976
|
-
}
|
1977
|
-
} catch (err) {
|
1978
|
-
}
|
1979
|
-
try {
|
1980
|
-
return XATA_ENABLE_BROWSER === true || XATA_ENABLE_BROWSER === "true";
|
1981
|
-
} catch (err) {
|
1982
|
-
return void 0;
|
1983
|
-
}
|
1984
|
-
}
|
1985
|
-
function getGlobalApiKey() {
|
1986
|
-
try {
|
1987
|
-
return XATA_API_KEY;
|
1988
|
-
} catch (err) {
|
1989
|
-
return void 0;
|
1990
|
-
}
|
1991
|
-
}
|
1992
|
-
function getGlobalDatabaseURL() {
|
1993
|
-
try {
|
1994
|
-
return XATA_DATABASE_URL;
|
1995
|
-
} catch (err) {
|
1996
|
-
return void 0;
|
1997
|
-
}
|
1998
|
-
}
|
1999
|
-
function getGlobalBranch() {
|
2000
|
-
try {
|
2001
|
-
return XATA_BRANCH;
|
2002
|
-
} catch (err) {
|
2003
|
-
return void 0;
|
2004
|
-
}
|
2005
|
-
}
|
2006
|
-
function getDatabaseURL() {
|
2007
|
-
try {
|
2008
|
-
const { databaseURL } = getEnvironment();
|
2009
|
-
return databaseURL;
|
2010
|
-
} catch (err) {
|
2011
|
-
return void 0;
|
2012
|
-
}
|
2013
|
-
}
|
2014
|
-
function getAPIKey() {
|
2015
|
-
try {
|
2016
|
-
const { apiKey } = getEnvironment();
|
2017
|
-
return apiKey;
|
2018
|
-
} catch (err) {
|
2019
|
-
return void 0;
|
2020
|
-
}
|
2021
|
-
}
|
2022
|
-
function getBranch() {
|
2023
|
-
try {
|
2024
|
-
const { branch } = getEnvironment();
|
2025
|
-
return branch;
|
2026
|
-
} catch (err) {
|
2027
|
-
return void 0;
|
2028
|
-
}
|
2029
|
-
}
|
2030
|
-
function buildPreviewBranchName({ org, branch }) {
|
2031
|
-
return `preview-${org}-${branch}`;
|
2032
|
-
}
|
2033
|
-
function getPreviewBranch() {
|
2034
|
-
try {
|
2035
|
-
const { deployPreview, deployPreviewBranch, vercelGitCommitRef, vercelGitRepoOwner } = getEnvironment();
|
2036
|
-
if (deployPreviewBranch)
|
2037
|
-
return deployPreviewBranch;
|
2038
|
-
switch (deployPreview) {
|
2039
|
-
case "vercel": {
|
2040
|
-
if (!vercelGitCommitRef || !vercelGitRepoOwner) {
|
2041
|
-
console.warn("XATA_PREVIEW=vercel but VERCEL_GIT_COMMIT_REF or VERCEL_GIT_REPO_OWNER is not valid");
|
2042
|
-
return void 0;
|
2043
|
-
}
|
2044
|
-
return buildPreviewBranchName({ org: vercelGitRepoOwner, branch: vercelGitCommitRef });
|
2045
|
-
}
|
2046
|
-
}
|
2047
|
-
return void 0;
|
2048
|
-
} catch (err) {
|
2049
|
-
return void 0;
|
2050
|
-
}
|
2051
|
-
}
|
2052
|
-
|
2053
1927
|
var __accessCheck$6 = (obj, member, msg) => {
|
2054
1928
|
if (!member.has(obj))
|
2055
1929
|
throw TypeError("Cannot " + msg);
|
@@ -2655,7 +2529,12 @@ function parseUrl(url) {
|
|
2655
2529
|
|
2656
2530
|
const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
|
2657
2531
|
|
2658
|
-
const applyMigration = (variables, signal) => dataPlaneFetch({
|
2532
|
+
const applyMigration = (variables, signal) => dataPlaneFetch({
|
2533
|
+
url: "/db/{dbBranchName}/migrations/apply",
|
2534
|
+
method: "post",
|
2535
|
+
...variables,
|
2536
|
+
signal
|
2537
|
+
});
|
2659
2538
|
const adaptTable = (variables, signal) => dataPlaneFetch({
|
2660
2539
|
url: "/db/{dbBranchName}/migrations/adapt/{tableName}",
|
2661
2540
|
method: "post",
|
@@ -2668,9 +2547,24 @@ const adaptAllTables = (variables, signal) => dataPlaneFetch({
|
|
2668
2547
|
...variables,
|
2669
2548
|
signal
|
2670
2549
|
});
|
2671
|
-
const getBranchMigrationJobStatus = (variables, signal) => dataPlaneFetch({
|
2672
|
-
|
2673
|
-
|
2550
|
+
const getBranchMigrationJobStatus = (variables, signal) => dataPlaneFetch({
|
2551
|
+
url: "/db/{dbBranchName}/migrations/status",
|
2552
|
+
method: "get",
|
2553
|
+
...variables,
|
2554
|
+
signal
|
2555
|
+
});
|
2556
|
+
const getMigrationJobStatus = (variables, signal) => dataPlaneFetch({
|
2557
|
+
url: "/db/{dbBranchName}/migrations/jobs/{jobId}",
|
2558
|
+
method: "get",
|
2559
|
+
...variables,
|
2560
|
+
signal
|
2561
|
+
});
|
2562
|
+
const getMigrationHistory = (variables, signal) => dataPlaneFetch({
|
2563
|
+
url: "/db/{dbBranchName}/migrations/history",
|
2564
|
+
method: "get",
|
2565
|
+
...variables,
|
2566
|
+
signal
|
2567
|
+
});
|
2674
2568
|
const getBranchList = (variables, signal) => dataPlaneFetch({
|
2675
2569
|
url: "/dbs/{dbName}",
|
2676
2570
|
method: "get",
|
@@ -2729,12 +2623,42 @@ const getBranchStats = (variables, signal) => dataPlaneFetch({
|
|
2729
2623
|
});
|
2730
2624
|
const getGitBranchesMapping = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables, signal });
|
2731
2625
|
const addGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables, signal });
|
2732
|
-
const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({
|
2733
|
-
|
2734
|
-
|
2735
|
-
|
2736
|
-
|
2737
|
-
|
2626
|
+
const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({
|
2627
|
+
url: "/dbs/{dbName}/gitBranches",
|
2628
|
+
method: "delete",
|
2629
|
+
...variables,
|
2630
|
+
signal
|
2631
|
+
});
|
2632
|
+
const resolveBranch = (variables, signal) => dataPlaneFetch({
|
2633
|
+
url: "/dbs/{dbName}/resolveBranch",
|
2634
|
+
method: "get",
|
2635
|
+
...variables,
|
2636
|
+
signal
|
2637
|
+
});
|
2638
|
+
const getBranchMigrationHistory = (variables, signal) => dataPlaneFetch({
|
2639
|
+
url: "/db/{dbBranchName}/migrations",
|
2640
|
+
method: "get",
|
2641
|
+
...variables,
|
2642
|
+
signal
|
2643
|
+
});
|
2644
|
+
const getBranchMigrationPlan = (variables, signal) => dataPlaneFetch({
|
2645
|
+
url: "/db/{dbBranchName}/migrations/plan",
|
2646
|
+
method: "post",
|
2647
|
+
...variables,
|
2648
|
+
signal
|
2649
|
+
});
|
2650
|
+
const executeBranchMigrationPlan = (variables, signal) => dataPlaneFetch({
|
2651
|
+
url: "/db/{dbBranchName}/migrations/execute",
|
2652
|
+
method: "post",
|
2653
|
+
...variables,
|
2654
|
+
signal
|
2655
|
+
});
|
2656
|
+
const queryMigrationRequests = (variables, signal) => dataPlaneFetch({
|
2657
|
+
url: "/dbs/{dbName}/migrations/query",
|
2658
|
+
method: "post",
|
2659
|
+
...variables,
|
2660
|
+
signal
|
2661
|
+
});
|
2738
2662
|
const createMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
2739
2663
|
const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2740
2664
|
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
@@ -2742,23 +2666,78 @@ const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
|
2742
2666
|
...variables,
|
2743
2667
|
signal
|
2744
2668
|
});
|
2745
|
-
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2746
|
-
|
2747
|
-
|
2748
|
-
|
2669
|
+
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2670
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
2671
|
+
method: "patch",
|
2672
|
+
...variables,
|
2673
|
+
signal
|
2674
|
+
});
|
2675
|
+
const listMigrationRequestsCommits = (variables, signal) => dataPlaneFetch({
|
2676
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/commits",
|
2677
|
+
method: "post",
|
2678
|
+
...variables,
|
2679
|
+
signal
|
2680
|
+
});
|
2681
|
+
const compareMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2682
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/compare",
|
2683
|
+
method: "post",
|
2684
|
+
...variables,
|
2685
|
+
signal
|
2686
|
+
});
|
2687
|
+
const getMigrationRequestIsMerged = (variables, signal) => dataPlaneFetch({
|
2688
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
2689
|
+
method: "get",
|
2690
|
+
...variables,
|
2691
|
+
signal
|
2692
|
+
});
|
2749
2693
|
const mergeMigrationRequest = (variables, signal) => dataPlaneFetch({
|
2750
2694
|
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
2751
2695
|
method: "post",
|
2752
2696
|
...variables,
|
2753
2697
|
signal
|
2754
2698
|
});
|
2755
|
-
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({
|
2756
|
-
|
2757
|
-
|
2758
|
-
|
2759
|
-
|
2760
|
-
|
2761
|
-
const
|
2699
|
+
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({
|
2700
|
+
url: "/db/{dbBranchName}/schema/history",
|
2701
|
+
method: "post",
|
2702
|
+
...variables,
|
2703
|
+
signal
|
2704
|
+
});
|
2705
|
+
const compareBranchWithUserSchema = (variables, signal) => dataPlaneFetch({
|
2706
|
+
url: "/db/{dbBranchName}/schema/compare",
|
2707
|
+
method: "post",
|
2708
|
+
...variables,
|
2709
|
+
signal
|
2710
|
+
});
|
2711
|
+
const compareBranchSchemas = (variables, signal) => dataPlaneFetch({
|
2712
|
+
url: "/db/{dbBranchName}/schema/compare/{branchName}",
|
2713
|
+
method: "post",
|
2714
|
+
...variables,
|
2715
|
+
signal
|
2716
|
+
});
|
2717
|
+
const updateBranchSchema = (variables, signal) => dataPlaneFetch({
|
2718
|
+
url: "/db/{dbBranchName}/schema/update",
|
2719
|
+
method: "post",
|
2720
|
+
...variables,
|
2721
|
+
signal
|
2722
|
+
});
|
2723
|
+
const previewBranchSchemaEdit = (variables, signal) => dataPlaneFetch({
|
2724
|
+
url: "/db/{dbBranchName}/schema/preview",
|
2725
|
+
method: "post",
|
2726
|
+
...variables,
|
2727
|
+
signal
|
2728
|
+
});
|
2729
|
+
const applyBranchSchemaEdit = (variables, signal) => dataPlaneFetch({
|
2730
|
+
url: "/db/{dbBranchName}/schema/apply",
|
2731
|
+
method: "post",
|
2732
|
+
...variables,
|
2733
|
+
signal
|
2734
|
+
});
|
2735
|
+
const pushBranchMigrations = (variables, signal) => dataPlaneFetch({
|
2736
|
+
url: "/db/{dbBranchName}/schema/push",
|
2737
|
+
method: "post",
|
2738
|
+
...variables,
|
2739
|
+
signal
|
2740
|
+
});
|
2762
2741
|
const createTable = (variables, signal) => dataPlaneFetch({
|
2763
2742
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
2764
2743
|
method: "put",
|
@@ -2771,14 +2750,24 @@ const deleteTable = (variables, signal) => dataPlaneFetch({
|
|
2771
2750
|
...variables,
|
2772
2751
|
signal
|
2773
2752
|
});
|
2774
|
-
const updateTable = (variables, signal) => dataPlaneFetch({
|
2753
|
+
const updateTable = (variables, signal) => dataPlaneFetch({
|
2754
|
+
url: "/db/{dbBranchName}/tables/{tableName}",
|
2755
|
+
method: "patch",
|
2756
|
+
...variables,
|
2757
|
+
signal
|
2758
|
+
});
|
2775
2759
|
const getTableSchema = (variables, signal) => dataPlaneFetch({
|
2776
2760
|
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
2777
2761
|
method: "get",
|
2778
2762
|
...variables,
|
2779
2763
|
signal
|
2780
2764
|
});
|
2781
|
-
const setTableSchema = (variables, signal) => dataPlaneFetch({
|
2765
|
+
const setTableSchema = (variables, signal) => dataPlaneFetch({
|
2766
|
+
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
2767
|
+
method: "put",
|
2768
|
+
...variables,
|
2769
|
+
signal
|
2770
|
+
});
|
2782
2771
|
const getTableColumns = (variables, signal) => dataPlaneFetch({
|
2783
2772
|
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
2784
2773
|
method: "get",
|
@@ -2786,7 +2775,12 @@ const getTableColumns = (variables, signal) => dataPlaneFetch({
|
|
2786
2775
|
signal
|
2787
2776
|
});
|
2788
2777
|
const addTableColumn = (variables, signal) => dataPlaneFetch(
|
2789
|
-
{
|
2778
|
+
{
|
2779
|
+
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
2780
|
+
method: "post",
|
2781
|
+
...variables,
|
2782
|
+
signal
|
2783
|
+
}
|
2790
2784
|
);
|
2791
2785
|
const getColumn = (variables, signal) => dataPlaneFetch({
|
2792
2786
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
@@ -2794,15 +2788,30 @@ const getColumn = (variables, signal) => dataPlaneFetch({
|
|
2794
2788
|
...variables,
|
2795
2789
|
signal
|
2796
2790
|
});
|
2797
|
-
const updateColumn = (variables, signal) => dataPlaneFetch({
|
2791
|
+
const updateColumn = (variables, signal) => dataPlaneFetch({
|
2792
|
+
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
2793
|
+
method: "patch",
|
2794
|
+
...variables,
|
2795
|
+
signal
|
2796
|
+
});
|
2798
2797
|
const deleteColumn = (variables, signal) => dataPlaneFetch({
|
2799
2798
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
2800
2799
|
method: "delete",
|
2801
2800
|
...variables,
|
2802
2801
|
signal
|
2803
2802
|
});
|
2804
|
-
const branchTransaction = (variables, signal) => dataPlaneFetch({
|
2805
|
-
|
2803
|
+
const branchTransaction = (variables, signal) => dataPlaneFetch({
|
2804
|
+
url: "/db/{dbBranchName}/transaction",
|
2805
|
+
method: "post",
|
2806
|
+
...variables,
|
2807
|
+
signal
|
2808
|
+
});
|
2809
|
+
const insertRecord = (variables, signal) => dataPlaneFetch({
|
2810
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data",
|
2811
|
+
method: "post",
|
2812
|
+
...variables,
|
2813
|
+
signal
|
2814
|
+
});
|
2806
2815
|
const getFileItem = (variables, signal) => dataPlaneFetch({
|
2807
2816
|
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file/{fileId}",
|
2808
2817
|
method: "get",
|
@@ -2845,11 +2854,36 @@ const getRecord = (variables, signal) => dataPlaneFetch({
|
|
2845
2854
|
...variables,
|
2846
2855
|
signal
|
2847
2856
|
});
|
2848
|
-
const insertRecordWithID = (variables, signal) => dataPlaneFetch({
|
2849
|
-
|
2850
|
-
|
2851
|
-
|
2852
|
-
|
2857
|
+
const insertRecordWithID = (variables, signal) => dataPlaneFetch({
|
2858
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
2859
|
+
method: "put",
|
2860
|
+
...variables,
|
2861
|
+
signal
|
2862
|
+
});
|
2863
|
+
const updateRecordWithID = (variables, signal) => dataPlaneFetch({
|
2864
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
2865
|
+
method: "patch",
|
2866
|
+
...variables,
|
2867
|
+
signal
|
2868
|
+
});
|
2869
|
+
const upsertRecordWithID = (variables, signal) => dataPlaneFetch({
|
2870
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
2871
|
+
method: "post",
|
2872
|
+
...variables,
|
2873
|
+
signal
|
2874
|
+
});
|
2875
|
+
const deleteRecord = (variables, signal) => dataPlaneFetch({
|
2876
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
2877
|
+
method: "delete",
|
2878
|
+
...variables,
|
2879
|
+
signal
|
2880
|
+
});
|
2881
|
+
const bulkInsertTableRecords = (variables, signal) => dataPlaneFetch({
|
2882
|
+
url: "/db/{dbBranchName}/tables/{tableName}/bulk",
|
2883
|
+
method: "post",
|
2884
|
+
...variables,
|
2885
|
+
signal
|
2886
|
+
});
|
2853
2887
|
const queryTable = (variables, signal) => dataPlaneFetch({
|
2854
2888
|
url: "/db/{dbBranchName}/tables/{tableName}/query",
|
2855
2889
|
method: "post",
|
@@ -2868,16 +2902,36 @@ const searchTable = (variables, signal) => dataPlaneFetch({
|
|
2868
2902
|
...variables,
|
2869
2903
|
signal
|
2870
2904
|
});
|
2871
|
-
const vectorSearchTable = (variables, signal) => dataPlaneFetch({
|
2905
|
+
const vectorSearchTable = (variables, signal) => dataPlaneFetch({
|
2906
|
+
url: "/db/{dbBranchName}/tables/{tableName}/vectorSearch",
|
2907
|
+
method: "post",
|
2908
|
+
...variables,
|
2909
|
+
signal
|
2910
|
+
});
|
2872
2911
|
const askTable = (variables, signal) => dataPlaneFetch({
|
2873
2912
|
url: "/db/{dbBranchName}/tables/{tableName}/ask",
|
2874
2913
|
method: "post",
|
2875
2914
|
...variables,
|
2876
2915
|
signal
|
2877
2916
|
});
|
2878
|
-
const askTableSession = (variables, signal) => dataPlaneFetch({
|
2879
|
-
|
2880
|
-
|
2917
|
+
const askTableSession = (variables, signal) => dataPlaneFetch({
|
2918
|
+
url: "/db/{dbBranchName}/tables/{tableName}/ask/{sessionId}",
|
2919
|
+
method: "post",
|
2920
|
+
...variables,
|
2921
|
+
signal
|
2922
|
+
});
|
2923
|
+
const summarizeTable = (variables, signal) => dataPlaneFetch({
|
2924
|
+
url: "/db/{dbBranchName}/tables/{tableName}/summarize",
|
2925
|
+
method: "post",
|
2926
|
+
...variables,
|
2927
|
+
signal
|
2928
|
+
});
|
2929
|
+
const aggregateTable = (variables, signal) => dataPlaneFetch({
|
2930
|
+
url: "/db/{dbBranchName}/tables/{tableName}/aggregate",
|
2931
|
+
method: "post",
|
2932
|
+
...variables,
|
2933
|
+
signal
|
2934
|
+
});
|
2881
2935
|
const fileAccess = (variables, signal) => dataPlaneFetch({
|
2882
2936
|
url: "/file/{fileId}",
|
2883
2937
|
method: "get",
|
@@ -2963,7 +3017,16 @@ const operationsByTag$2 = {
|
|
2963
3017
|
deleteRecord,
|
2964
3018
|
bulkInsertTableRecords
|
2965
3019
|
},
|
2966
|
-
files: {
|
3020
|
+
files: {
|
3021
|
+
getFileItem,
|
3022
|
+
putFileItem,
|
3023
|
+
deleteFileItem,
|
3024
|
+
getFile,
|
3025
|
+
putFile,
|
3026
|
+
deleteFile,
|
3027
|
+
fileAccess,
|
3028
|
+
fileUpload
|
3029
|
+
},
|
2967
3030
|
searchAndFilter: {
|
2968
3031
|
queryTable,
|
2969
3032
|
searchBranch,
|
@@ -3041,7 +3104,12 @@ const deleteOAuthAccessToken = (variables, signal) => controlPlaneFetch({
|
|
3041
3104
|
...variables,
|
3042
3105
|
signal
|
3043
3106
|
});
|
3044
|
-
const updateOAuthAccessToken = (variables, signal) => controlPlaneFetch({
|
3107
|
+
const updateOAuthAccessToken = (variables, signal) => controlPlaneFetch({
|
3108
|
+
url: "/user/oauth/tokens/{token}",
|
3109
|
+
method: "patch",
|
3110
|
+
...variables,
|
3111
|
+
signal
|
3112
|
+
});
|
3045
3113
|
const getWorkspacesList = (variables, signal) => controlPlaneFetch({
|
3046
3114
|
url: "/workspaces",
|
3047
3115
|
method: "get",
|
@@ -3072,49 +3140,150 @@ const deleteWorkspace = (variables, signal) => controlPlaneFetch({
|
|
3072
3140
|
...variables,
|
3073
3141
|
signal
|
3074
3142
|
});
|
3075
|
-
const getWorkspaceSettings = (variables, signal) => controlPlaneFetch({
|
3076
|
-
|
3077
|
-
|
3078
|
-
|
3143
|
+
const getWorkspaceSettings = (variables, signal) => controlPlaneFetch({
|
3144
|
+
url: "/workspaces/{workspaceId}/settings",
|
3145
|
+
method: "get",
|
3146
|
+
...variables,
|
3147
|
+
signal
|
3148
|
+
});
|
3149
|
+
const updateWorkspaceSettings = (variables, signal) => controlPlaneFetch({
|
3150
|
+
url: "/workspaces/{workspaceId}/settings",
|
3151
|
+
method: "patch",
|
3152
|
+
...variables,
|
3153
|
+
signal
|
3154
|
+
});
|
3155
|
+
const getWorkspaceMembersList = (variables, signal) => controlPlaneFetch({
|
3156
|
+
url: "/workspaces/{workspaceId}/members",
|
3157
|
+
method: "get",
|
3158
|
+
...variables,
|
3159
|
+
signal
|
3160
|
+
});
|
3161
|
+
const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({
|
3162
|
+
url: "/workspaces/{workspaceId}/members/{userId}",
|
3163
|
+
method: "put",
|
3164
|
+
...variables,
|
3165
|
+
signal
|
3166
|
+
});
|
3079
3167
|
const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
3080
3168
|
url: "/workspaces/{workspaceId}/members/{userId}",
|
3081
3169
|
method: "delete",
|
3082
3170
|
...variables,
|
3083
3171
|
signal
|
3084
3172
|
});
|
3085
|
-
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
3086
|
-
|
3087
|
-
|
3088
|
-
|
3089
|
-
|
3090
|
-
|
3091
|
-
const
|
3173
|
+
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
3174
|
+
url: "/workspaces/{workspaceId}/invites",
|
3175
|
+
method: "post",
|
3176
|
+
...variables,
|
3177
|
+
signal
|
3178
|
+
});
|
3179
|
+
const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3180
|
+
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
3181
|
+
method: "patch",
|
3182
|
+
...variables,
|
3183
|
+
signal
|
3184
|
+
});
|
3185
|
+
const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3186
|
+
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
3187
|
+
method: "delete",
|
3188
|
+
...variables,
|
3189
|
+
signal
|
3190
|
+
});
|
3191
|
+
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3192
|
+
url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept",
|
3193
|
+
method: "post",
|
3194
|
+
...variables,
|
3195
|
+
signal
|
3196
|
+
});
|
3197
|
+
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({
|
3198
|
+
url: "/workspaces/{workspaceId}/invites/{inviteId}/resend",
|
3199
|
+
method: "post",
|
3200
|
+
...variables,
|
3201
|
+
signal
|
3202
|
+
});
|
3203
|
+
const listClusters = (variables, signal) => controlPlaneFetch({
|
3204
|
+
url: "/workspaces/{workspaceId}/clusters",
|
3205
|
+
method: "get",
|
3206
|
+
...variables,
|
3207
|
+
signal
|
3208
|
+
});
|
3209
|
+
const createCluster = (variables, signal) => controlPlaneFetch({
|
3210
|
+
url: "/workspaces/{workspaceId}/clusters",
|
3211
|
+
method: "post",
|
3212
|
+
...variables,
|
3213
|
+
signal
|
3214
|
+
});
|
3092
3215
|
const getCluster = (variables, signal) => controlPlaneFetch({
|
3093
3216
|
url: "/workspaces/{workspaceId}/clusters/{clusterId}",
|
3094
3217
|
method: "get",
|
3095
3218
|
...variables,
|
3096
3219
|
signal
|
3097
3220
|
});
|
3098
|
-
const updateCluster = (variables, signal) => controlPlaneFetch({
|
3221
|
+
const updateCluster = (variables, signal) => controlPlaneFetch({
|
3222
|
+
url: "/workspaces/{workspaceId}/clusters/{clusterId}",
|
3223
|
+
method: "patch",
|
3224
|
+
...variables,
|
3225
|
+
signal
|
3226
|
+
});
|
3227
|
+
const deleteCluster = (variables, signal) => controlPlaneFetch({
|
3228
|
+
url: "/workspaces/{workspaceId}/clusters/{clusterId}",
|
3229
|
+
method: "delete",
|
3230
|
+
...variables,
|
3231
|
+
signal
|
3232
|
+
});
|
3099
3233
|
const getDatabaseList = (variables, signal) => controlPlaneFetch({
|
3100
3234
|
url: "/workspaces/{workspaceId}/dbs",
|
3101
3235
|
method: "get",
|
3102
3236
|
...variables,
|
3103
3237
|
signal
|
3104
3238
|
});
|
3105
|
-
const createDatabase = (variables, signal) => controlPlaneFetch({
|
3239
|
+
const createDatabase = (variables, signal) => controlPlaneFetch({
|
3240
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3241
|
+
method: "put",
|
3242
|
+
...variables,
|
3243
|
+
signal
|
3244
|
+
});
|
3106
3245
|
const deleteDatabase = (variables, signal) => controlPlaneFetch({
|
3107
3246
|
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3108
3247
|
method: "delete",
|
3109
3248
|
...variables,
|
3110
3249
|
signal
|
3111
3250
|
});
|
3112
|
-
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({
|
3113
|
-
|
3114
|
-
|
3115
|
-
|
3116
|
-
|
3117
|
-
|
3251
|
+
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({
|
3252
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3253
|
+
method: "get",
|
3254
|
+
...variables,
|
3255
|
+
signal
|
3256
|
+
});
|
3257
|
+
const updateDatabaseMetadata = (variables, signal) => controlPlaneFetch({
|
3258
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
3259
|
+
method: "patch",
|
3260
|
+
...variables,
|
3261
|
+
signal
|
3262
|
+
});
|
3263
|
+
const renameDatabase = (variables, signal) => controlPlaneFetch({
|
3264
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/rename",
|
3265
|
+
method: "post",
|
3266
|
+
...variables,
|
3267
|
+
signal
|
3268
|
+
});
|
3269
|
+
const getDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({
|
3270
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/github",
|
3271
|
+
method: "get",
|
3272
|
+
...variables,
|
3273
|
+
signal
|
3274
|
+
});
|
3275
|
+
const updateDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({
|
3276
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/github",
|
3277
|
+
method: "put",
|
3278
|
+
...variables,
|
3279
|
+
signal
|
3280
|
+
});
|
3281
|
+
const deleteDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({
|
3282
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}/github",
|
3283
|
+
method: "delete",
|
3284
|
+
...variables,
|
3285
|
+
signal
|
3286
|
+
});
|
3118
3287
|
const listRegions = (variables, signal) => controlPlaneFetch({
|
3119
3288
|
url: "/workspaces/{workspaceId}/regions",
|
3120
3289
|
method: "get",
|
@@ -3152,7 +3321,13 @@ const operationsByTag$1 = {
|
|
3152
3321
|
acceptWorkspaceMemberInvite,
|
3153
3322
|
resendWorkspaceMemberInvite
|
3154
3323
|
},
|
3155
|
-
xbcontrolOther: {
|
3324
|
+
xbcontrolOther: {
|
3325
|
+
listClusters,
|
3326
|
+
createCluster,
|
3327
|
+
getCluster,
|
3328
|
+
updateCluster,
|
3329
|
+
deleteCluster
|
3330
|
+
},
|
3156
3331
|
databases: {
|
3157
3332
|
getDatabaseList,
|
3158
3333
|
createDatabase,
|
@@ -3172,7 +3347,7 @@ const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
|
|
3172
3347
|
const buildApiClient = () => class {
|
3173
3348
|
constructor(options = {}) {
|
3174
3349
|
const provider = options.host ?? "production";
|
3175
|
-
const apiKey = options.apiKey
|
3350
|
+
const apiKey = options.apiKey;
|
3176
3351
|
const trace = options.trace ?? defaultTrace;
|
3177
3352
|
const clientID = generateUUID();
|
3178
3353
|
if (!apiKey) {
|
@@ -5150,7 +5325,7 @@ const buildClient = (plugins) => {
|
|
5150
5325
|
return { databaseURL, branch };
|
5151
5326
|
}
|
5152
5327
|
}, _options = new WeakMap(), _parseOptions = new WeakSet(), parseOptions_fn = function(options) {
|
5153
|
-
const enableBrowser = options?.enableBrowser ??
|
5328
|
+
const enableBrowser = options?.enableBrowser ?? false;
|
5154
5329
|
const isBrowser = typeof window !== "undefined" && typeof Deno === "undefined";
|
5155
5330
|
if (isBrowser && !enableBrowser) {
|
5156
5331
|
throw new Error(
|
@@ -5158,8 +5333,9 @@ const buildClient = (plugins) => {
|
|
5158
5333
|
);
|
5159
5334
|
}
|
5160
5335
|
const fetch = getFetchImplementation(options?.fetch);
|
5161
|
-
const databaseURL = options?.databaseURL
|
5162
|
-
const apiKey = options?.apiKey
|
5336
|
+
const databaseURL = options?.databaseURL;
|
5337
|
+
const apiKey = options?.apiKey;
|
5338
|
+
const branch = options?.branch;
|
5163
5339
|
const trace = options?.trace ?? defaultTrace;
|
5164
5340
|
const clientName = options?.clientName;
|
5165
5341
|
const host = options?.host ?? "production";
|
@@ -5170,25 +5346,8 @@ const buildClient = (plugins) => {
|
|
5170
5346
|
if (!databaseURL) {
|
5171
5347
|
throw new Error("Option databaseURL is required");
|
5172
5348
|
}
|
5173
|
-
|
5174
|
-
|
5175
|
-
const branch = options?.branch || previewBranch || envBranch || "main";
|
5176
|
-
if (!!previewBranch && branch !== previewBranch) {
|
5177
|
-
console.warn(
|
5178
|
-
`Ignoring preview branch ${previewBranch} because branch option was passed to the client constructor with value ${branch}`
|
5179
|
-
);
|
5180
|
-
} else if (!!envBranch && branch !== envBranch) {
|
5181
|
-
console.warn(
|
5182
|
-
`Ignoring branch ${envBranch} because branch option was passed to the client constructor with value ${branch}`
|
5183
|
-
);
|
5184
|
-
} else if (!!previewBranch && !!envBranch && previewBranch !== envBranch) {
|
5185
|
-
console.warn(
|
5186
|
-
`Ignoring preview branch ${previewBranch} and branch ${envBranch} because branch option was passed to the client constructor with value ${branch}`
|
5187
|
-
);
|
5188
|
-
} else if (!previewBranch && !envBranch && options?.branch === void 0) {
|
5189
|
-
console.warn(
|
5190
|
-
`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.`
|
5191
|
-
);
|
5349
|
+
if (!branch) {
|
5350
|
+
throw new Error("Option branch is required");
|
5192
5351
|
}
|
5193
5352
|
return {
|
5194
5353
|
fetch,
|
@@ -5299,6 +5458,48 @@ const deserialize = (json) => {
|
|
5299
5458
|
return defaultSerializer.fromJSON(json);
|
5300
5459
|
};
|
5301
5460
|
|
5461
|
+
function parseEnvironment(environment) {
|
5462
|
+
try {
|
5463
|
+
if (typeof environment === "function") {
|
5464
|
+
return new Proxy(
|
5465
|
+
{},
|
5466
|
+
{
|
5467
|
+
get(target) {
|
5468
|
+
return environment(target);
|
5469
|
+
}
|
5470
|
+
}
|
5471
|
+
);
|
5472
|
+
}
|
5473
|
+
if (isObject(environment)) {
|
5474
|
+
return environment;
|
5475
|
+
}
|
5476
|
+
} catch (error) {
|
5477
|
+
}
|
5478
|
+
return {};
|
5479
|
+
}
|
5480
|
+
function buildPreviewBranchName({ org, branch }) {
|
5481
|
+
return `preview-${org}-${branch}`;
|
5482
|
+
}
|
5483
|
+
function getDeployPreviewBranch(environment) {
|
5484
|
+
try {
|
5485
|
+
const { deployPreview, deployPreviewBranch, vercelGitCommitRef, vercelGitRepoOwner } = parseEnvironment(environment);
|
5486
|
+
if (deployPreviewBranch)
|
5487
|
+
return deployPreviewBranch;
|
5488
|
+
switch (deployPreview) {
|
5489
|
+
case "vercel": {
|
5490
|
+
if (!vercelGitCommitRef || !vercelGitRepoOwner) {
|
5491
|
+
console.warn("XATA_PREVIEW=vercel but VERCEL_GIT_COMMIT_REF or VERCEL_GIT_REPO_OWNER is not valid");
|
5492
|
+
return void 0;
|
5493
|
+
}
|
5494
|
+
return buildPreviewBranchName({ org: vercelGitRepoOwner, branch: vercelGitCommitRef });
|
5495
|
+
}
|
5496
|
+
}
|
5497
|
+
return void 0;
|
5498
|
+
} catch (err) {
|
5499
|
+
return void 0;
|
5500
|
+
}
|
5501
|
+
}
|
5502
|
+
|
5302
5503
|
class XataError extends Error {
|
5303
5504
|
constructor(message, status) {
|
5304
5505
|
super(message);
|
@@ -5306,5 +5507,5 @@ class XataError extends Error {
|
|
5306
5507
|
}
|
5307
5508
|
}
|
5308
5509
|
|
5309
|
-
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, 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, contains, copyBranch, createBranch, createCluster, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteDatabaseGithubSettings, deleteFile, deleteFileItem, deleteOAuthAccessToken, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteUserOAuthClient, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, fileAccess, fileUpload, ge,
|
5510
|
+
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, 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, 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, getAuthorizationCode, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationJobStatus, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getCluster, getColumn, getDatabaseGithubSettings, getDatabaseList, getDatabaseMetadata, getDatabaseSettings, getDeployPreviewBranch, getFile, getFileItem, getGitBranchesMapping, getHostUrl, getMigrationHistory, getMigrationJobStatus, getMigrationRequest, getMigrationRequestIsMerged, 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, le, lessEquals, lessThan, lessThanEquals, listClusters, listMigrationRequestsCommits, listRegions, lt, lte, mergeMigrationRequest, notExists, operationsByTag, parseProviderString, parseWorkspacesUrlParts, pattern, previewBranchSchemaEdit, pushBranchMigrations, putFile, putFileItem, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, renameDatabase, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, sqlQuery, startsWith, summarizeTable, transformImage, updateBranchMetadata, updateBranchSchema, updateCluster, updateColumn, updateDatabaseGithubSettings, updateDatabaseMetadata, updateDatabaseSettings, updateMigrationRequest, updateOAuthAccessToken, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, updateWorkspaceSettings, upsertRecordWithID, vectorSearchTable };
|
5310
5511
|
//# sourceMappingURL=index.mjs.map
|