@xata.io/client 0.28.4 → 0.29.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/.turbo/turbo-add-version.log +1 -1
- package/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +12 -0
- package/dist/index.cjs +14 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +43 -31
- package/dist/index.mjs +14 -6
- 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.
|
2
|
+
> @xata.io/client@0.29.0 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 [
|
7
|
+
[32mcreated [1mdist/index.cjs[22m in [1m1s[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 [1m739ms[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.1s[22m[39m
|
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# @xata.io/client
|
2
2
|
|
3
|
+
## 0.29.0
|
4
|
+
|
5
|
+
### Minor Changes
|
6
|
+
|
7
|
+
- [#1329](https://github.com/xataio/client-ts/pull/1329) [`0ec026a`](https://github.com/xataio/client-ts/commit/0ec026a92bdb1a405cb9d90cb1d506ff159f98e8) Thanks [@eemmiillyy](https://github.com/eemmiillyy)! - Remove object column type
|
8
|
+
|
9
|
+
### Patch Changes
|
10
|
+
|
11
|
+
- [#1334](https://github.com/xataio/client-ts/pull/1334) [`6414bd3`](https://github.com/xataio/client-ts/commit/6414bd3d8bdb84961e68968df4b0b025503f0d72) Thanks [@SferaDev](https://github.com/SferaDev)! - Expose columns in SQL query
|
12
|
+
|
13
|
+
- [#1328](https://github.com/xataio/client-ts/pull/1328) [`27773df`](https://github.com/xataio/client-ts/commit/27773df5addf0013d1a7238ac490904e7aad2334) Thanks [@SferaDev](https://github.com/SferaDev)! - Fix untagged scenario for SQL function
|
14
|
+
|
3
15
|
## 0.28.4
|
4
16
|
|
5
17
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
@@ -528,7 +528,7 @@ function defaultOnOpen(response) {
|
|
528
528
|
}
|
529
529
|
}
|
530
530
|
|
531
|
-
const VERSION = "0.
|
531
|
+
const VERSION = "0.29.0";
|
532
532
|
|
533
533
|
class ErrorWithCause extends Error {
|
534
534
|
constructor(message, options) {
|
@@ -3294,7 +3294,6 @@ const RecordColumnTypes = [
|
|
3294
3294
|
"email",
|
3295
3295
|
"multiple",
|
3296
3296
|
"link",
|
3297
|
-
"object",
|
3298
3297
|
"datetime",
|
3299
3298
|
"vector",
|
3300
3299
|
"file[]",
|
@@ -4565,17 +4564,26 @@ function prepareParams(param1, param2) {
|
|
4565
4564
|
|
4566
4565
|
class SQLPlugin extends XataPlugin {
|
4567
4566
|
build(pluginOptions) {
|
4568
|
-
return async (
|
4569
|
-
|
4570
|
-
|
4567
|
+
return async (query, ...parameters) => {
|
4568
|
+
if (!isParamsObject(query) && (!isTemplateStringsArray(query) || !Array.isArray(parameters))) {
|
4569
|
+
throw new Error("Invalid usage of `xata.sql`. Please use it as a tagged template or with an object.");
|
4570
|
+
}
|
4571
|
+
const { statement, params, consistency } = prepareParams(query, parameters);
|
4572
|
+
const { records, warning, columns } = await sqlQuery({
|
4571
4573
|
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
4572
4574
|
body: { statement, params, consistency },
|
4573
4575
|
...pluginOptions
|
4574
4576
|
});
|
4575
|
-
return { records, warning };
|
4577
|
+
return { records, warning, columns };
|
4576
4578
|
};
|
4577
4579
|
}
|
4578
4580
|
}
|
4581
|
+
function isTemplateStringsArray(strings) {
|
4582
|
+
return Array.isArray(strings) && "raw" in strings && Array.isArray(strings.raw);
|
4583
|
+
}
|
4584
|
+
function isParamsObject(params) {
|
4585
|
+
return isObject(params) && "statement" in params;
|
4586
|
+
}
|
4579
4587
|
|
4580
4588
|
class TransactionPlugin extends XataPlugin {
|
4581
4589
|
build(pluginOptions) {
|