@xata.io/client 0.23.1 → 0.23.3
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 +4 -4
- package/CHANGELOG.md +14 -0
- package/dist/index.cjs +67 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +59 -4
- package/dist/index.mjs +65 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/.turbo/turbo-build.log
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
|
2
|
-
> @xata.io/client@0.23.
|
2
|
+
> @xata.io/client@0.23.3 build /home/runner/work/client-ts/client-ts/packages/client
|
3
3
|
> rimraf dist && rollup -c
|
4
4
|
|
5
5
|
[36m
|
6
6
|
[1msrc/index.ts[22m → [1mdist/index.cjs[22m...[39m
|
7
|
-
[32mcreated [1mdist/index.cjs[22m in [1m1.
|
7
|
+
[32mcreated [1mdist/index.cjs[22m in [1m1.1s[22m[39m
|
8
8
|
[36m
|
9
9
|
[1msrc/index.ts[22m → [1mdist/index.mjs[22m...[39m
|
10
|
-
[32mcreated [1mdist/index.mjs[22m in [
|
10
|
+
[32mcreated [1mdist/index.mjs[22m in [1m906ms[22m[39m
|
11
11
|
[36m
|
12
12
|
[1msrc/index.ts[22m → [1mdist/index.d.ts[22m...[39m
|
13
|
-
[32mcreated [1mdist/index.d.ts[22m in [1m5.
|
13
|
+
[32mcreated [1mdist/index.d.ts[22m in [1m5.7s[22m[39m
|
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# @xata.io/client
|
2
2
|
|
3
|
+
## 0.23.3
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#947](https://github.com/xataio/client-ts/pull/947) [`344b0d68`](https://github.com/xataio/client-ts/commit/344b0d687962d569872d1e90d59818d28df7579c) Thanks [@SferaDev](https://github.com/SferaDev)! - Add numeric operators
|
8
|
+
|
9
|
+
## 0.23.2
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- [#939](https://github.com/xataio/client-ts/pull/939) [`c477c177`](https://github.com/xataio/client-ts/commit/c477c17795c01cbf945be413217944a5a38655a5) Thanks [@SferaDev](https://github.com/SferaDev)! - Add deploy preview branch env variable loading
|
14
|
+
|
15
|
+
- [#945](https://github.com/xataio/client-ts/pull/945) [`ecdc6553`](https://github.com/xataio/client-ts/commit/ecdc6553d4628289e88953ab6296b80f60e8f757) Thanks [@xata-bot](https://github.com/xata-bot)! - Add new types
|
16
|
+
|
3
17
|
## 0.23.1
|
4
18
|
|
5
19
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
@@ -93,7 +93,10 @@ function getEnvironment() {
|
|
93
93
|
apiKey: process.env.XATA_API_KEY ?? getGlobalApiKey(),
|
94
94
|
databaseURL: process.env.XATA_DATABASE_URL ?? getGlobalDatabaseURL(),
|
95
95
|
branch: process.env.XATA_BRANCH ?? getGlobalBranch(),
|
96
|
-
|
96
|
+
deployPreview: process.env.XATA_PREVIEW,
|
97
|
+
deployPreviewBranch: process.env.XATA_PREVIEW_BRANCH,
|
98
|
+
vercelGitCommitRef: process.env.VERCEL_GIT_COMMIT_REF,
|
99
|
+
vercelGitRepoOwner: process.env.VERCEL_GIT_REPO_OWNER
|
97
100
|
};
|
98
101
|
}
|
99
102
|
} catch (err) {
|
@@ -104,7 +107,10 @@ function getEnvironment() {
|
|
104
107
|
apiKey: Deno.env.get("XATA_API_KEY") ?? getGlobalApiKey(),
|
105
108
|
databaseURL: Deno.env.get("XATA_DATABASE_URL") ?? getGlobalDatabaseURL(),
|
106
109
|
branch: Deno.env.get("XATA_BRANCH") ?? getGlobalBranch(),
|
107
|
-
|
110
|
+
deployPreview: Deno.env.get("XATA_PREVIEW"),
|
111
|
+
deployPreviewBranch: Deno.env.get("XATA_PREVIEW_BRANCH"),
|
112
|
+
vercelGitCommitRef: Deno.env.get("VERCEL_GIT_COMMIT_REF"),
|
113
|
+
vercelGitRepoOwner: Deno.env.get("VERCEL_GIT_REPO_OWNER")
|
108
114
|
};
|
109
115
|
}
|
110
116
|
} catch (err) {
|
@@ -113,7 +119,10 @@ function getEnvironment() {
|
|
113
119
|
apiKey: getGlobalApiKey(),
|
114
120
|
databaseURL: getGlobalDatabaseURL(),
|
115
121
|
branch: getGlobalBranch(),
|
116
|
-
|
122
|
+
deployPreview: void 0,
|
123
|
+
deployPreviewBranch: void 0,
|
124
|
+
vercelGitCommitRef: void 0,
|
125
|
+
vercelGitRepoOwner: void 0
|
117
126
|
};
|
118
127
|
}
|
119
128
|
function getEnableBrowserVariable() {
|
@@ -174,8 +183,30 @@ function getAPIKey() {
|
|
174
183
|
}
|
175
184
|
function getBranch() {
|
176
185
|
try {
|
177
|
-
const { branch
|
178
|
-
return branch ??
|
186
|
+
const { branch } = getEnvironment();
|
187
|
+
return branch ?? "main";
|
188
|
+
} catch (err) {
|
189
|
+
return void 0;
|
190
|
+
}
|
191
|
+
}
|
192
|
+
function buildPreviewBranchName({ org, branch }) {
|
193
|
+
return `preview-${org}-${branch}`;
|
194
|
+
}
|
195
|
+
function getPreviewBranch() {
|
196
|
+
try {
|
197
|
+
const { deployPreview, deployPreviewBranch, vercelGitCommitRef, vercelGitRepoOwner } = getEnvironment();
|
198
|
+
if (deployPreviewBranch)
|
199
|
+
return deployPreviewBranch;
|
200
|
+
switch (deployPreview) {
|
201
|
+
case "vercel": {
|
202
|
+
if (!vercelGitCommitRef || !vercelGitRepoOwner) {
|
203
|
+
console.warn("XATA_PREVIEW=vercel but VERCEL_GIT_COMMIT_REF or VERCEL_GIT_REPO_OWNER is not valid");
|
204
|
+
return void 0;
|
205
|
+
}
|
206
|
+
return buildPreviewBranchName({ org: vercelGitRepoOwner, branch: vercelGitCommitRef });
|
207
|
+
}
|
208
|
+
}
|
209
|
+
return void 0;
|
179
210
|
} catch (err) {
|
180
211
|
return void 0;
|
181
212
|
}
|
@@ -461,7 +492,7 @@ function defaultOnOpen(response) {
|
|
461
492
|
}
|
462
493
|
}
|
463
494
|
|
464
|
-
const VERSION = "0.23.
|
495
|
+
const VERSION = "0.23.3";
|
465
496
|
|
466
497
|
class ErrorWithCause extends Error {
|
467
498
|
constructor(message, options) {
|
@@ -832,6 +863,12 @@ const searchTable = (variables, signal) => dataPlaneFetch({
|
|
832
863
|
...variables,
|
833
864
|
signal
|
834
865
|
});
|
866
|
+
const sqlQuery = (variables, signal) => dataPlaneFetch({
|
867
|
+
url: "/db/{dbBranchName}/sql",
|
868
|
+
method: "post",
|
869
|
+
...variables,
|
870
|
+
signal
|
871
|
+
});
|
835
872
|
const vectorSearchTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/vectorSearch", method: "post", ...variables, signal });
|
836
873
|
const askTable = (variables, signal) => dataPlaneFetch({
|
837
874
|
url: "/db/{dbBranchName}/tables/{tableName}/ask",
|
@@ -904,6 +941,7 @@ const operationsByTag$2 = {
|
|
904
941
|
queryTable,
|
905
942
|
searchBranch,
|
906
943
|
searchTable,
|
944
|
+
sqlQuery,
|
907
945
|
vectorSearchTable,
|
908
946
|
askTable,
|
909
947
|
summarizeTable,
|
@@ -3640,7 +3678,6 @@ const buildClient = (plugins) => {
|
|
3640
3678
|
}
|
3641
3679
|
const fetch = getFetchImplementation(options?.fetch);
|
3642
3680
|
const databaseURL = options?.databaseURL || getDatabaseURL();
|
3643
|
-
const branch = options?.branch || getBranch() || "main";
|
3644
3681
|
const apiKey = options?.apiKey || getAPIKey();
|
3645
3682
|
const cache = options?.cache ?? new SimpleCache({ defaultQueryTTL: 0 });
|
3646
3683
|
const trace = options?.trace ?? defaultTrace;
|
@@ -3653,6 +3690,26 @@ const buildClient = (plugins) => {
|
|
3653
3690
|
if (!databaseURL) {
|
3654
3691
|
throw new Error("Option databaseURL is required");
|
3655
3692
|
}
|
3693
|
+
const envBranch = getBranch();
|
3694
|
+
const previewBranch = getPreviewBranch();
|
3695
|
+
const branch = options?.branch || previewBranch || envBranch || "main";
|
3696
|
+
if (!!previewBranch && branch !== previewBranch) {
|
3697
|
+
console.warn(
|
3698
|
+
`Ignoring preview branch ${previewBranch} because branch option was passed to the client constructor with value ${branch}`
|
3699
|
+
);
|
3700
|
+
} else if (!!envBranch && branch !== envBranch) {
|
3701
|
+
console.warn(
|
3702
|
+
`Ignoring branch ${envBranch} because branch option was passed to the client constructor with value ${branch}`
|
3703
|
+
);
|
3704
|
+
} else if (!!previewBranch && !!envBranch && previewBranch !== envBranch) {
|
3705
|
+
console.warn(
|
3706
|
+
`Ignoring preview branch ${previewBranch} and branch ${envBranch} because branch option was passed to the client constructor with value ${branch}`
|
3707
|
+
);
|
3708
|
+
} else if (!previewBranch && !envBranch && options?.branch === void 0) {
|
3709
|
+
console.warn(
|
3710
|
+
`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.`
|
3711
|
+
);
|
3712
|
+
}
|
3656
3713
|
return {
|
3657
3714
|
fetch,
|
3658
3715
|
databaseURL,
|
@@ -3812,6 +3869,7 @@ exports.applyBranchSchemaEdit = applyBranchSchemaEdit;
|
|
3812
3869
|
exports.askTable = askTable;
|
3813
3870
|
exports.branchTransaction = branchTransaction;
|
3814
3871
|
exports.buildClient = buildClient;
|
3872
|
+
exports.buildPreviewBranchName = buildPreviewBranchName;
|
3815
3873
|
exports.buildProviderString = buildProviderString;
|
3816
3874
|
exports.buildWorkerRunner = buildWorkerRunner;
|
3817
3875
|
exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
@@ -3860,6 +3918,7 @@ exports.getGitBranchesMapping = getGitBranchesMapping;
|
|
3860
3918
|
exports.getHostUrl = getHostUrl;
|
3861
3919
|
exports.getMigrationRequest = getMigrationRequest;
|
3862
3920
|
exports.getMigrationRequestIsMerged = getMigrationRequestIsMerged;
|
3921
|
+
exports.getPreviewBranch = getPreviewBranch;
|
3863
3922
|
exports.getRecord = getRecord;
|
3864
3923
|
exports.getTableColumns = getTableColumns;
|
3865
3924
|
exports.getTableSchema = getTableSchema;
|
@@ -3913,6 +3972,7 @@ exports.searchBranch = searchBranch;
|
|
3913
3972
|
exports.searchTable = searchTable;
|
3914
3973
|
exports.serialize = serialize;
|
3915
3974
|
exports.setTableSchema = setTableSchema;
|
3975
|
+
exports.sqlQuery = sqlQuery;
|
3916
3976
|
exports.startsWith = startsWith;
|
3917
3977
|
exports.summarizeTable = summarizeTable;
|
3918
3978
|
exports.updateBranchMetadata = updateBranchMetadata;
|