@xata.io/client 0.26.8 → 0.27.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.8 add-version /home/runner/work/client-ts/client-ts/packages/client
2
+ > @xata.io/client@0.27.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.8 build /home/runner/work/client-ts/client-ts/packages/client
2
+ > @xata.io/client@0.27.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.4s
7
+ created dist/index.cjs in 1.1s
8
8
  
9
9
  src/index.ts → dist/index.mjs...
10
- created dist/index.mjs in 1s
10
+ created dist/index.mjs in 743ms
11
11
  
12
12
  src/index.ts → dist/index.d.ts...
13
- created dist/index.d.ts in 11s
13
+ created dist/index.d.ts in 7.1s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @xata.io/client
2
2
 
3
+ ## 0.27.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#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
8
+
9
+ ### Patch Changes
10
+
11
+ - [#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
12
+
13
+ ## 0.26.9
14
+
15
+ ### Patch Changes
16
+
17
+ - [#1224](https://github.com/xataio/client-ts/pull/1224) [`302798e8`](https://github.com/xataio/client-ts/commit/302798e8d210c89f420a5c927e0f836a27dbaed9) Thanks [@SferaDev](https://github.com/SferaDev)! - Export transaction types
18
+
3
19
  ## 0.26.8
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.8";
531
+ const VERSION = "0.27.0";
532
532
 
533
533
  class ErrorWithCause extends Error {
534
534
  constructor(message, options) {
@@ -3635,7 +3635,7 @@ class RestRepository extends Query {
3635
3635
  }
3636
3636
  async search(query, options = {}) {
3637
3637
  return __privateGet$4(this, _trace).call(this, "search", async () => {
3638
- const { records } = await searchTable({
3638
+ const { records, totalCount } = await searchTable({
3639
3639
  pathParams: {
3640
3640
  workspace: "{workspaceId}",
3641
3641
  dbBranchName: "{dbBranch}",
@@ -3655,12 +3655,15 @@ class RestRepository extends Query {
3655
3655
  ...__privateGet$4(this, _getFetchProps).call(this)
3656
3656
  });
3657
3657
  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, ["*"]));
3658
+ return {
3659
+ records: records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"])),
3660
+ totalCount
3661
+ };
3659
3662
  });
3660
3663
  }
3661
3664
  async vectorSearch(column, query, options) {
3662
3665
  return __privateGet$4(this, _trace).call(this, "vectorSearch", async () => {
3663
- const { records } = await vectorSearchTable({
3666
+ const { records, totalCount } = await vectorSearchTable({
3664
3667
  pathParams: {
3665
3668
  workspace: "{workspaceId}",
3666
3669
  dbBranchName: "{dbBranch}",
@@ -3677,7 +3680,10 @@ class RestRepository extends Query {
3677
3680
  ...__privateGet$4(this, _getFetchProps).call(this)
3678
3681
  });
3679
3682
  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, ["*"]));
3683
+ return {
3684
+ records: records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"])),
3685
+ totalCount
3686
+ };
3681
3687
  });
3682
3688
  }
3683
3689
  async aggregate(aggs, filter) {
@@ -4405,22 +4411,26 @@ class SearchPlugin extends XataPlugin {
4405
4411
  build(pluginOptions) {
4406
4412
  return {
4407
4413
  all: async (query, options = {}) => {
4408
- const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4414
+ const { records, totalCount } = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4409
4415
  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
- });
4416
+ return {
4417
+ totalCount,
4418
+ records: records.map((record) => {
4419
+ const { table = "orphan" } = record.xata;
4420
+ return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
4421
+ })
4422
+ };
4414
4423
  },
4415
4424
  byTable: async (query, options = {}) => {
4416
- const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4425
+ const { records: rawRecords, totalCount } = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
4417
4426
  const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, pluginOptions);
4418
- return records.reduce((acc, record) => {
4427
+ const records = rawRecords.reduce((acc, record) => {
4419
4428
  const { table = "orphan" } = record.xata;
4420
4429
  const items = acc[table] ?? [];
4421
4430
  const item = initObject(this.db, schemaTables, table, record, ["*"]);
4422
4431
  return { ...acc, [table]: [...items, item] };
4423
4432
  }, {});
4433
+ return { totalCount, records };
4424
4434
  }
4425
4435
  };
4426
4436
  }
@@ -4429,13 +4439,13 @@ _schemaTables = new WeakMap();
4429
4439
  _search = new WeakSet();
4430
4440
  search_fn = async function(query, options, pluginOptions) {
4431
4441
  const { tables, fuzziness, highlight, prefix, page } = options ?? {};
4432
- const { records } = await searchBranch({
4442
+ const { records, totalCount } = await searchBranch({
4433
4443
  pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
4434
4444
  // @ts-ignore https://github.com/xataio/client-ts/issues/313
4435
4445
  body: { tables, query, fuzziness, prefix, highlight, page },
4436
4446
  ...pluginOptions
4437
4447
  });
4438
- return records;
4448
+ return { records, totalCount };
4439
4449
  };
4440
4450
  _getSchemaTables = new WeakSet();
4441
4451
  getSchemaTables_fn = async function(pluginOptions) {
@@ -4786,6 +4796,7 @@ exports.SchemaPlugin = SchemaPlugin;
4786
4796
  exports.SearchPlugin = SearchPlugin;
4787
4797
  exports.Serializer = Serializer;
4788
4798
  exports.SimpleCache = SimpleCache;
4799
+ exports.TransactionPlugin = TransactionPlugin;
4789
4800
  exports.XataApiClient = XataApiClient;
4790
4801
  exports.XataApiPlugin = XataApiPlugin;
4791
4802
  exports.XataError = XataError;