@xata.io/client 0.29.1 → 0.29.2

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.29.1 add-version /home/runner/work/client-ts/client-ts/packages/client
2
+ > @xata.io/client@0.29.2 add-version /home/runner/work/client-ts/client-ts/packages/client
3
3
  > node ../../scripts/add-version-file.mjs
4
4
 
@@ -1,5 +1,5 @@
1
1
 
2
- > @xata.io/client@0.29.1 build /home/runner/work/client-ts/client-ts/packages/client
2
+ > @xata.io/client@0.29.2 build /home/runner/work/client-ts/client-ts/packages/client
3
3
  > rimraf dist && rollup -c
4
4
 
5
5
  
@@ -7,7 +7,7 @@
7
7
  created dist/index.cjs in 1.1s
8
8
  
9
9
  src/index.ts → dist/index.mjs...
10
- created dist/index.mjs in 807ms
10
+ created dist/index.mjs in 698ms
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,11 @@
1
1
  # @xata.io/client
2
2
 
3
+ ## 0.29.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1380](https://github.com/xataio/client-ts/pull/1380) [`e8db1cd`](https://github.com/xataio/client-ts/commit/e8db1cd394ccbed32403548bf9d09a5c3973d850) Thanks [@richardgill](https://github.com/richardgill)! - Link to our docs to explain how to resolve the 'api key in browser' error message
8
+
3
9
  ## 0.29.1
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -528,7 +528,7 @@ function defaultOnOpen(response) {
528
528
  }
529
529
  }
530
530
 
531
- const VERSION = "0.29.1";
531
+ const VERSION = "0.29.2";
532
532
 
533
533
  class ErrorWithCause extends Error {
534
534
  constructor(message, options) {
@@ -847,26 +847,29 @@ function parseUrl(url) {
847
847
 
848
848
  const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
849
849
 
850
- const applyMigration = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/pgroll/apply", method: "post", ...variables, signal });
851
- const pgRollStatus = (variables, signal) => dataPlaneFetch({
852
- url: "/db/{dbBranchName}/pgroll/status",
853
- method: "get",
850
+ const applyMigration = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/apply", method: "post", ...variables, signal });
851
+ const adaptTable = (variables, signal) => dataPlaneFetch({
852
+ url: "/db/{dbBranchName}/migrations/adapt/{tableName}",
853
+ method: "post",
854
854
  ...variables,
855
855
  signal
856
856
  });
857
- const pgRollJobStatus = (variables, signal) => dataPlaneFetch({
858
- url: "/db/{dbBranchName}/pgroll/jobs/{jobId}",
857
+ const getBranchMigrationJobStatus = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/status", method: "get", ...variables, signal });
858
+ const getMigrationJobStatus = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/jobs/{jobId}", method: "get", ...variables, signal });
859
+ const getMigrationHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/history", method: "get", ...variables, signal });
860
+ const getBranchList = (variables, signal) => dataPlaneFetch({
861
+ url: "/dbs/{dbName}",
859
862
  method: "get",
860
863
  ...variables,
861
864
  signal
862
865
  });
863
- const pgRollMigrationHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/pgroll/migrations", method: "get", ...variables, signal });
864
- const getBranchList = (variables, signal) => dataPlaneFetch({
865
- url: "/dbs/{dbName}",
866
+ const getDatabaseSettings = (variables, signal) => dataPlaneFetch({
867
+ url: "/dbs/{dbName}/settings",
866
868
  method: "get",
867
869
  ...variables,
868
870
  signal
869
871
  });
872
+ const updateDatabaseSettings = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/settings", method: "patch", ...variables, signal });
870
873
  const getBranchDetails = (variables, signal) => dataPlaneFetch({
871
874
  url: "/db/{dbBranchName}",
872
875
  method: "get",
@@ -1080,11 +1083,25 @@ const sqlQuery = (variables, signal) => dataPlaneFetch({
1080
1083
  signal
1081
1084
  });
1082
1085
  const operationsByTag$2 = {
1083
- branch: {
1086
+ migrations: {
1084
1087
  applyMigration,
1085
- pgRollStatus,
1086
- pgRollJobStatus,
1087
- pgRollMigrationHistory,
1088
+ adaptTable,
1089
+ getBranchMigrationJobStatus,
1090
+ getMigrationJobStatus,
1091
+ getMigrationHistory,
1092
+ getSchema,
1093
+ getBranchMigrationHistory,
1094
+ getBranchMigrationPlan,
1095
+ executeBranchMigrationPlan,
1096
+ getBranchSchemaHistory,
1097
+ compareBranchWithUserSchema,
1098
+ compareBranchSchemas,
1099
+ updateBranchSchema,
1100
+ previewBranchSchemaEdit,
1101
+ applyBranchSchemaEdit,
1102
+ pushBranchMigrations
1103
+ },
1104
+ branch: {
1088
1105
  getBranchList,
1089
1106
  getBranchDetails,
1090
1107
  createBranch,
@@ -1098,19 +1115,7 @@ const operationsByTag$2 = {
1098
1115
  removeGitBranchesEntry,
1099
1116
  resolveBranch
1100
1117
  },
1101
- migrations: {
1102
- getSchema,
1103
- getBranchMigrationHistory,
1104
- getBranchMigrationPlan,
1105
- executeBranchMigrationPlan,
1106
- getBranchSchemaHistory,
1107
- compareBranchWithUserSchema,
1108
- compareBranchSchemas,
1109
- updateBranchSchema,
1110
- previewBranchSchemaEdit,
1111
- applyBranchSchemaEdit,
1112
- pushBranchMigrations
1113
- },
1118
+ database: { getDatabaseSettings, updateDatabaseSettings },
1114
1119
  migrationRequests: {
1115
1120
  queryMigrationRequests,
1116
1121
  createMigrationRequest,
@@ -1752,7 +1757,7 @@ class BranchApi {
1752
1757
  database,
1753
1758
  branch
1754
1759
  }) {
1755
- return operationsByTag.branch.pgRollMigrationHistory({
1760
+ return operationsByTag.migrations.getMigrationHistory({
1756
1761
  pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1757
1762
  ...this.extraProps
1758
1763
  });
@@ -1764,7 +1769,7 @@ class BranchApi {
1764
1769
  branch,
1765
1770
  migration
1766
1771
  }) {
1767
- return operationsByTag.branch.applyMigration({
1772
+ return operationsByTag.migrations.applyMigration({
1768
1773
  pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
1769
1774
  body: migration,
1770
1775
  ...this.extraProps
@@ -4597,12 +4602,17 @@ class SQLPlugin extends XataPlugin {
4597
4602
  throw new Error("Invalid usage of `xata.sql`. Please use it as a tagged template or with an object.");
4598
4603
  }
4599
4604
  const { statement, params, consistency } = prepareParams(query, parameters);
4600
- const { records, warning, columns } = await sqlQuery({
4605
+ const {
4606
+ records,
4607
+ rows,
4608
+ warning,
4609
+ columns = []
4610
+ } = await sqlQuery({
4601
4611
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4602
4612
  body: { statement, params, consistency },
4603
4613
  ...pluginOptions
4604
4614
  });
4605
- return { records, warning, columns };
4615
+ return { records, rows, warning, columns };
4606
4616
  };
4607
4617
  }
4608
4618
  }
@@ -4692,7 +4702,7 @@ const buildClient = (plugins) => {
4692
4702
  const isBrowser = typeof window !== "undefined" && typeof Deno === "undefined";
4693
4703
  if (isBrowser && !enableBrowser) {
4694
4704
  throw new Error(
4695
- "You are trying to use Xata from the browser, which is potentially a non-secure environment. If you understand the security concerns, such as leaking your credentials, pass `enableBrowser: true` to the client options to remove this error."
4705
+ "You are trying to use Xata from the browser, which is potentially a non-secure environment. How to fix: https://xata.io/docs/messages/api-key-browser-error"
4696
4706
  );
4697
4707
  }
4698
4708
  const fetch = getFetchImplementation(options?.fetch);
@@ -4873,6 +4883,7 @@ exports.XataError = XataError;
4873
4883
  exports.XataFile = XataFile;
4874
4884
  exports.XataPlugin = XataPlugin;
4875
4885
  exports.acceptWorkspaceMemberInvite = acceptWorkspaceMemberInvite;
4886
+ exports.adaptTable = adaptTable;
4876
4887
  exports.addGitBranchesEntry = addGitBranchesEntry;
4877
4888
  exports.addTableColumn = addTableColumn;
4878
4889
  exports.aggregateTable = aggregateTable;
@@ -4926,6 +4937,7 @@ exports.getBranchDetails = getBranchDetails;
4926
4937
  exports.getBranchList = getBranchList;
4927
4938
  exports.getBranchMetadata = getBranchMetadata;
4928
4939
  exports.getBranchMigrationHistory = getBranchMigrationHistory;
4940
+ exports.getBranchMigrationJobStatus = getBranchMigrationJobStatus;
4929
4941
  exports.getBranchMigrationPlan = getBranchMigrationPlan;
4930
4942
  exports.getBranchSchemaHistory = getBranchSchemaHistory;
4931
4943
  exports.getBranchStats = getBranchStats;
@@ -4934,11 +4946,14 @@ exports.getColumn = getColumn;
4934
4946
  exports.getDatabaseGithubSettings = getDatabaseGithubSettings;
4935
4947
  exports.getDatabaseList = getDatabaseList;
4936
4948
  exports.getDatabaseMetadata = getDatabaseMetadata;
4949
+ exports.getDatabaseSettings = getDatabaseSettings;
4937
4950
  exports.getDatabaseURL = getDatabaseURL;
4938
4951
  exports.getFile = getFile;
4939
4952
  exports.getFileItem = getFileItem;
4940
4953
  exports.getGitBranchesMapping = getGitBranchesMapping;
4941
4954
  exports.getHostUrl = getHostUrl;
4955
+ exports.getMigrationHistory = getMigrationHistory;
4956
+ exports.getMigrationJobStatus = getMigrationJobStatus;
4942
4957
  exports.getMigrationRequest = getMigrationRequest;
4943
4958
  exports.getMigrationRequestIsMerged = getMigrationRequestIsMerged;
4944
4959
  exports.getPreviewBranch = getPreviewBranch;
@@ -4992,9 +5007,6 @@ exports.operationsByTag = operationsByTag;
4992
5007
  exports.parseProviderString = parseProviderString;
4993
5008
  exports.parseWorkspacesUrlParts = parseWorkspacesUrlParts;
4994
5009
  exports.pattern = pattern;
4995
- exports.pgRollJobStatus = pgRollJobStatus;
4996
- exports.pgRollMigrationHistory = pgRollMigrationHistory;
4997
- exports.pgRollStatus = pgRollStatus;
4998
5010
  exports.previewBranchSchemaEdit = previewBranchSchemaEdit;
4999
5011
  exports.pushBranchMigrations = pushBranchMigrations;
5000
5012
  exports.putFile = putFile;
@@ -5020,6 +5032,7 @@ exports.updateCluster = updateCluster;
5020
5032
  exports.updateColumn = updateColumn;
5021
5033
  exports.updateDatabaseGithubSettings = updateDatabaseGithubSettings;
5022
5034
  exports.updateDatabaseMetadata = updateDatabaseMetadata;
5035
+ exports.updateDatabaseSettings = updateDatabaseSettings;
5023
5036
  exports.updateMigrationRequest = updateMigrationRequest;
5024
5037
  exports.updateOAuthAccessToken = updateOAuthAccessToken;
5025
5038
  exports.updateRecordWithID = updateRecordWithID;