@livequery/client 2.0.20 → 2.0.22

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.
@@ -24,6 +24,9 @@ export type CollectionStream<T extends LivequeryBaseEntity = LivequeryBaseEntity
24
24
  error?: boolean;
25
25
  code?: string;
26
26
  message?: string;
27
+ summary?: {
28
+ [key: string]: any;
29
+ };
27
30
  };
28
31
  export declare class CollectionObservable<T extends LivequeryBaseEntity = LivequeryBaseEntity> extends BehaviorSubject<CollectionStream<T>> {
29
32
  #private;
@@ -9,12 +9,6 @@ export class CollectionObservable extends BehaviorSubject {
9
9
  #sorters = new Array;
10
10
  #IdMap = new Map();
11
11
  #refs = [];
12
- // $: BehaviorSubject<CollectionStream<T>> = new BehaviorSubject<CollectionStream<T>>({
13
- // items: [] as SmartQueryItem<T>[],
14
- // loading: false,
15
- // options: {},
16
- // paging: {}
17
- // })
18
12
  unsubscribe() {
19
13
  super.unsubscribe();
20
14
  this.#queries.forEach(s => s.unsubscribe());
@@ -52,7 +46,7 @@ export class CollectionObservable extends BehaviorSubject {
52
46
  const state = this.getValue();
53
47
  const realtime = this.collection_options.realtime ?? true;
54
48
  const actions = { update: false, reindex: false };
55
- for (const { data, error, code, message } of stream) {
49
+ for (const { data, error, code, message, } of stream) {
56
50
  if (!from_local) {
57
51
  state.loading = false;
58
52
  actions.update = true;
@@ -64,6 +58,10 @@ export class CollectionObservable extends BehaviorSubject {
64
58
  state.message = message;
65
59
  actions.update = true;
66
60
  }
61
+ if (data?.summary) {
62
+ state.summary = data.summary;
63
+ actions.update = true;
64
+ }
67
65
  // Sync
68
66
  for (const change of data?.changes || []) {
69
67
  if (!change?.data?.id)
@@ -278,10 +276,6 @@ export class CollectionObservable extends BehaviorSubject {
278
276
  const { options } = this.getValue();
279
277
  this.fetch_data(options, 'backward');
280
278
  }
281
- // public fetch_around_cursor(cursor: string) {
282
- // const state = this.$.getValue()
283
- // this.fetch_data(state.options, 'both')
284
- // }
285
279
  filter(filters) {
286
280
  this.fetch_data(filters, 'forward', true);
287
281
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "repository": {
5
5
  "url": "https://github.com/livequery/client"
6
6
  },
7
- "version": "2.0.20",
7
+ "version": "2.0.22",
8
8
  "description": "",
9
9
  "main": "build/index.js",
10
10
  "types": "build/index.d.ts",
@@ -17,7 +17,7 @@
17
17
  "devDependencies": {
18
18
  "typescript": "^5.6.3",
19
19
  "rxjs": "^7.8.1",
20
- "@livequery/types": "^2.0.7"
20
+ "@livequery/types": "^2.0.22"
21
21
  },
22
22
  "scripts": {
23
23
  "test": "echo \"Error: no test specified\" && exit 1",