@xata.io/client 0.26.9 → 0.28.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.26.9 add-version /home/runner/work/client-ts/client-ts/packages/client
2
+ > @xata.io/client@0.28.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.26.9 build /home/runner/work/client-ts/client-ts/packages/client
2
+ > @xata.io/client@0.28.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 734ms
8
8
  
9
9
  src/index.ts → dist/index.mjs...
10
- created dist/index.mjs in 721ms
10
+ created dist/index.mjs in 465ms
11
11
  
12
12
  src/index.ts → dist/index.d.ts...
13
- created dist/index.d.ts in 8.4s
13
+ created dist/index.d.ts in 5s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @xata.io/client
2
2
 
3
+ ## 0.28.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1251](https://github.com/xataio/client-ts/pull/1251) [`e97d1999`](https://github.com/xataio/client-ts/commit/e97d1999f3c25f149213ceca81958e1674624e05) Thanks [@SferaDev](https://github.com/SferaDev)! - Remove Xata Workers support
8
+
9
+ ## 0.27.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#1232](https://github.com/xataio/client-ts/pull/1232) [`d282d18f`](https://github.com/xataio/client-ts/commit/d282d18f025094e0729ade6009b34fc0d34ebbba) Thanks [@eemmiillyy](https://github.com/eemmiillyy)! - Add support for totalCount on search responses
14
+
15
+ ### Patch Changes
16
+
17
+ - [#1235](https://github.com/xataio/client-ts/pull/1235) [`19c5dd47`](https://github.com/xataio/client-ts/commit/19c5dd47e3a032fcb19d990527b8faaa9326d97d) Thanks [@eemmiillyy](https://github.com/eemmiillyy)! - Fix excessive depth on summarize
18
+
3
19
  ## 0.26.9
4
20
 
5
21
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -528,7 +528,7 @@ function defaultOnOpen(response) {
528
528
  }
529
529
  }
530
530
 
531
- const VERSION = "0.26.9";
531
+ const VERSION = "0.28.0";
532
532
 
533
533
  class ErrorWithCause extends Error {
534
534
  constructor(message, options) {
@@ -768,6 +768,13 @@ function parseUrl(url) {
768
768
 
769
769
  const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
770
770
 
771
+ const applyMigration = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/pgroll/apply", method: "post", ...variables, signal });
772
+ const pgRollStatus = (variables, signal) => dataPlaneFetch({
773
+ url: "/db/{dbBranchName}/pgroll/status",
774
+ method: "get",
775
+ ...variables,
776
+ signal
777
+ });
771
778
  const getBranchList = (variables, signal) => dataPlaneFetch({
772
779
  url: "/dbs/{dbName}",
773
780
  method: "get",
@@ -982,6 +989,8 @@ const sqlQuery = (variables, signal) => dataPlaneFetch({
982
989
  });
983
990
  const operationsByTag$2 = {
984
991
  branch: {
992
+ applyMigration,
993
+ pgRollStatus,
985
994
  getBranchList,
986
995
  getBranchDetails,
987
996
  createBranch,
@@ -3635,7 +3644,7 @@ class RestRepository extends Query {
3635
3644
  }
3636
3645
  async search(query, options = {}) {
3637
3646
  return __privateGet$4(this, _trace).call(this, "search", async () => {
3638
- const { records } = await searchTable({
3647
+ const { records, totalCount } = await searchTable({
3639
3648
  pathParams: {
3640
3649
  workspace: "{workspaceId}",
3641
3650
  dbBranchName: "{dbBranch}",
@@ -3655,12 +3664,15 @@ class RestRepository extends Query {
3655
3664
  ...__privateGet$4(this, _getFetchProps).call(this)
3656
3665
  });
3657
3666
  const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3658
- return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
3667
+ return {
3668
+ records: records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"])),
3669
+ totalCount
3670
+ };
3659
3671
  });
3660
3672
  }
3661
3673
  async vectorSearch(column, query, options) {
3662
3674
  return __privateGet$4(this, _trace).call(this, "vectorSearch", async () => {
3663
- const { records } = await vectorSearchTable({
3675
+ const { records, totalCount } = await vectorSearchTable({
3664
3676
  pathParams: {
3665
3677
  workspace: "{workspaceId}",
3666
3678
  dbBranchName: "{dbBranch}",
@@ -3677,7 +3689,10 @@ class RestRepository extends Query {
3677
3689
  ...__privateGet$4(this, _getFetchProps).call(this)
3678
3690
  });
3679
3691
  const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
3680
- return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
3692
+ return {
3693
+ records: records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"])),
3694
+ totalCount
3695
+ };
3681
3696
  });
3682
3697
  }
3683
3698
  async aggregate(aggs, filter) {
@@ -4405,22 +4420,26 @@ class SearchPlugin extends XataPlugin {
4405
4420
  build(pluginOptions) {
4406
4421
  return {
4407
4422
  all: async (query, options = {}) => {
4408
- const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4423
+ const { records, totalCount } = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4409
4424
  const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, pluginOptions);
4410
- return records.map((record) => {
4411
- const { table = "orphan" } = record.xata;
4412
- return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
4413
- });
4425
+ return {
4426
+ totalCount,
4427
+ records: records.map((record) => {
4428
+ const { table = "orphan" } = record.xata;
4429
+ return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
4430
+ })
4431
+ };
4414
4432
  },
4415
4433
  byTable: async (query, options = {}) => {
4416
- const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4434
+ const { records: rawRecords, totalCount } = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4417
4435
  const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, pluginOptions);
4418
- return records.reduce((acc, record) => {
4436
+ const records = rawRecords.reduce((acc, record) => {
4419
4437
  const { table = "orphan" } = record.xata;
4420
4438
  const items = acc[table] ?? [];
4421
4439
  const item = initObject(this.db, schemaTables, table, record, ["*"]);
4422
4440
  return { ...acc, [table]: [...items, item] };
4423
4441
  }, {});
4442
+ return { totalCount, records };
4424
4443
  }
4425
4444
  };
4426
4445
  }
@@ -4429,13 +4448,13 @@ _schemaTables = new WeakMap();
4429
4448
  _search = new WeakSet();
4430
4449
  search_fn = async function(query, options, pluginOptions) {
4431
4450
  const { tables, fuzziness, highlight, prefix, page } = options ?? {};
4432
- const { records } = await searchBranch({
4451
+ const { records, totalCount } = await searchBranch({
4433
4452
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4434
4453
  // @ts-ignore https://github.com/xataio/client-ts/issues/313
4435
4454
  body: { tables, query, fuzziness, prefix, highlight, page },
4436
4455
  ...pluginOptions
4437
4456
  });
4438
- return records;
4457
+ return { records, totalCount };
4439
4458
  };
4440
4459
  _getSchemaTables = new WeakSet();
4441
4460
  getSchemaTables_fn = async function(pluginOptions) {
@@ -4745,21 +4764,6 @@ const deserialize = (json) => {
4745
4764
  return defaultSerializer.fromJSON(json);
4746
4765
  };
4747
4766
 
4748
- function buildWorkerRunner(config) {
4749
- return function xataWorker(name, worker) {
4750
- return async (...args) => {
4751
- const url = process.env.NODE_ENV === "development" ? `http://localhost:64749/${name}` : `https://dispatcher.xata.workers.dev/${config.workspace}/${config.worker}/${name}`;
4752
- const result = await fetch(url, {
4753
- method: "POST",
4754
- headers: { "Content-Type": "application/json" },
4755
- body: serialize({ args })
4756
- });
4757
- const text = await result.text();
4758
- return deserialize(text);
4759
- };
4760
- };
4761
- }
4762
-
4763
4767
  class XataError extends Error {
4764
4768
  constructor(message, status) {
4765
4769
  super(message);
@@ -4797,13 +4801,13 @@ exports.addGitBranchesEntry = addGitBranchesEntry;
4797
4801
  exports.addTableColumn = addTableColumn;
4798
4802
  exports.aggregateTable = aggregateTable;
4799
4803
  exports.applyBranchSchemaEdit = applyBranchSchemaEdit;
4804
+ exports.applyMigration = applyMigration;
4800
4805
  exports.askTable = askTable;
4801
4806
  exports.askTableSession = askTableSession;
4802
4807
  exports.branchTransaction = branchTransaction;
4803
4808
  exports.buildClient = buildClient;
4804
4809
  exports.buildPreviewBranchName = buildPreviewBranchName;
4805
4810
  exports.buildProviderString = buildProviderString;
4806
- exports.buildWorkerRunner = buildWorkerRunner;
4807
4811
  exports.bulkInsertTableRecords = bulkInsertTableRecords;
4808
4812
  exports.cancelWorkspaceMemberInvite = cancelWorkspaceMemberInvite;
4809
4813
  exports.compareBranchSchemas = compareBranchSchemas;
@@ -4911,6 +4915,7 @@ exports.operationsByTag = operationsByTag;
4911
4915
  exports.parseProviderString = parseProviderString;
4912
4916
  exports.parseWorkspacesUrlParts = parseWorkspacesUrlParts;
4913
4917
  exports.pattern = pattern;
4918
+ exports.pgRollStatus = pgRollStatus;
4914
4919
  exports.previewBranchSchemaEdit = previewBranchSchemaEdit;
4915
4920
  exports.pushBranchMigrations = pushBranchMigrations;
4916
4921
  exports.putFile = putFile;