@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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @xata.io/client@0.28.4 add-version /home/runner/work/client-ts/client-ts/packages/client
2
+ > @xata.io/client@0.29.0 add-version /home/runner/work/client-ts/client-ts/packages/client
3
3
  > node ../../scripts/add-version-file.mjs
4
4
 
@@ -1,13 +1,13 @@
1
1
 
2
- > @xata.io/client@0.28.4 build /home/runner/work/client-ts/client-ts/packages/client
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
  
6
6
  src/index.ts → dist/index.cjs...
7
- created dist/index.cjs in 1.1s
7
+ created dist/index.cjs in 1s
8
8
  
9
9
  src/index.ts → dist/index.mjs...
10
- created dist/index.mjs in 767ms
10
+ created dist/index.mjs in 739ms
11
11
  
12
12
  src/index.ts → dist/index.d.ts...
13
- created dist/index.d.ts in 5.3s
13
+ created dist/index.d.ts in 5.1s
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.28.4";
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 (param1, ...param2) => {
4569
- const { statement, params, consistency } = prepareParams(param1, param2);
4570
- const { records, warning } = await sqlQuery({
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) {