@xata.io/client 0.28.3 → 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.3 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.3 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 742ms
7
+ created dist/index.cjs in 1s
8
8
  
9
9
  src/index.ts → dist/index.mjs...
10
- created dist/index.mjs in 472ms
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.2s
13
+ created dist/index.d.ts in 5.1s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
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
+
15
+ ## 0.28.4
16
+
17
+ ### Patch Changes
18
+
19
+ - [#1309](https://github.com/xataio/client-ts/pull/1309) [`adc961b`](https://github.com/xataio/client-ts/commit/adc961b886b789010e6512c17cb2377eceab665a) Thanks [@andrew-farries](https://github.com/andrew-farries)! - Add CLI support for running against local development environments
20
+
21
+ - [#1312](https://github.com/xataio/client-ts/pull/1312) [`6031a9d`](https://github.com/xataio/client-ts/commit/6031a9de63c264b7db5b031bb1795258c2bf8150) Thanks [@SferaDev](https://github.com/SferaDev)! - Add get to transactions
22
+
3
23
  ## 0.28.3
4
24
 
5
25
  ### 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.3";
531
+ const VERSION = "0.29.0";
532
532
 
533
533
  class ErrorWithCause extends Error {
534
534
  constructor(message, options) {
@@ -591,6 +591,10 @@ const providers = {
591
591
  dev: {
592
592
  main: "https://api.dev-xata.dev",
593
593
  workspaces: "https://{workspaceId}.{region}.dev-xata.dev"
594
+ },
595
+ local: {
596
+ main: "http://localhost:6001",
597
+ workspaces: "http://{workspaceId}.{region}.localhost:6001"
594
598
  }
595
599
  };
596
600
  function isHostProviderAlias(alias) {
@@ -619,7 +623,8 @@ function parseWorkspacesUrlParts(url) {
619
623
  const matches = {
620
624
  production: url.match(/(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.xata\.sh.*/),
621
625
  staging: url.match(/(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.staging-xata\.dev.*/),
622
- dev: url.match(/(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.dev-xata\.dev.*/)
626
+ dev: url.match(/(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.dev-xata\.dev.*/),
627
+ local: url.match(/(?:https?:\/\/)?([^.]+)(?:\.([^.]+))\.localhost:(\d+)/)
623
628
  };
624
629
  const [host, match] = Object.entries(matches).find(([, match2]) => match2 !== null) ?? [];
625
630
  if (!isHostProviderAlias(host) || !match)
@@ -718,7 +723,7 @@ async function fetch$1({
718
723
  async ({ setAttributes }) => {
719
724
  const baseUrl = buildBaseUrl({ method, endpoint, path, workspacesApiUrl, pathParams, apiUrl });
720
725
  const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
721
- const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
726
+ const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\.[^.]+\./, "http://") : fullUrl;
722
727
  setAttributes({
723
728
  [TraceAttributes.HTTP_URL]: url,
724
729
  [TraceAttributes.HTTP_TARGET]: resolveUrl(path, queryParams, pathParams)
@@ -855,6 +860,7 @@ const pgRollJobStatus = (variables, signal) => dataPlaneFetch({
855
860
  ...variables,
856
861
  signal
857
862
  });
863
+ const pgRollMigrationHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/pgroll/migrations", method: "get", ...variables, signal });
858
864
  const getBranchList = (variables, signal) => dataPlaneFetch({
859
865
  url: "/dbs/{dbName}",
860
866
  method: "get",
@@ -1078,6 +1084,7 @@ const operationsByTag$2 = {
1078
1084
  applyMigration,
1079
1085
  pgRollStatus,
1080
1086
  pgRollJobStatus,
1087
+ pgRollMigrationHistory,
1081
1088
  getBranchList,
1082
1089
  getBranchDetails,
1083
1090
  createBranch,
@@ -1258,12 +1265,7 @@ const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ u
1258
1265
  const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "delete", ...variables, signal });
1259
1266
  const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
1260
1267
  const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
1261
- const listClusters = (variables, signal) => controlPlaneFetch({
1262
- url: "/workspaces/{workspaceId}/clusters",
1263
- method: "get",
1264
- ...variables,
1265
- signal
1266
- });
1268
+ const listClusters = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters", method: "get", ...variables, signal });
1267
1269
  const createCluster = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters", method: "post", ...variables, signal });
1268
1270
  const getCluster = (variables, signal) => controlPlaneFetch({
1269
1271
  url: "/workspaces/{workspaceId}/clusters/{clusterId}",
@@ -3292,7 +3294,6 @@ const RecordColumnTypes = [
3292
3294
  "email",
3293
3295
  "multiple",
3294
3296
  "link",
3295
- "object",
3296
3297
  "datetime",
3297
3298
  "vector",
3298
3299
  "file[]",
@@ -4563,17 +4564,26 @@ function prepareParams(param1, param2) {
4563
4564
 
4564
4565
  class SQLPlugin extends XataPlugin {
4565
4566
  build(pluginOptions) {
4566
- return async (param1, ...param2) => {
4567
- const { statement, params, consistency } = prepareParams(param1, param2);
4568
- 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({
4569
4573
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4570
4574
  body: { statement, params, consistency },
4571
4575
  ...pluginOptions
4572
4576
  });
4573
- return { records, warning };
4577
+ return { records, warning, columns };
4574
4578
  };
4575
4579
  }
4576
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
+ }
4577
4587
 
4578
4588
  class TransactionPlugin extends XataPlugin {
4579
4589
  build(pluginOptions) {
@@ -4952,6 +4962,7 @@ exports.parseProviderString = parseProviderString;
4952
4962
  exports.parseWorkspacesUrlParts = parseWorkspacesUrlParts;
4953
4963
  exports.pattern = pattern;
4954
4964
  exports.pgRollJobStatus = pgRollJobStatus;
4965
+ exports.pgRollMigrationHistory = pgRollMigrationHistory;
4955
4966
  exports.pgRollStatus = pgRollStatus;
4956
4967
  exports.previewBranchSchemaEdit = previewBranchSchemaEdit;
4957
4968
  exports.pushBranchMigrations = pushBranchMigrations;