@livequery/client 1.0.35 → 1.0.36

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.
@@ -67,7 +67,7 @@ class CollectionObservable extends rxjs_1.Observable {
67
67
  this.document_id = this.is_collection_ref ? null : refs[refs.length - 1];
68
68
  }
69
69
  sync(stream) {
70
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
70
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
71
71
  const realtime = (_a = this.collection_options.realtime) !== null && _a !== void 0 ? _a : true;
72
72
  const actions = { update: false, reindex: false };
73
73
  for (const { data, error } of stream) {
@@ -81,15 +81,15 @@ class CollectionObservable extends rxjs_1.Observable {
81
81
  }
82
82
  // Sync
83
83
  for (const change of (data === null || data === void 0 ? void 0 : data.changes) || []) {
84
- if (!change.data.id)
84
+ if (!((_e = change === null || change === void 0 ? void 0 : change.data) === null || _e === void 0 ? void 0 : _e.id))
85
85
  continue;
86
86
  const { data: payload, type } = change;
87
87
  this.$changes.next(change);
88
- const index = (_e = __classPrivateFieldGet(this, _CollectionObservable_IdMap, "f").get(payload.id)) !== null && _e !== void 0 ? _e : -1;
88
+ const index = (_f = __classPrivateFieldGet(this, _CollectionObservable_IdMap, "f").get(payload.id)) !== null && _f !== void 0 ? _f : -1;
89
89
  if (index == -1 && type == 'added') {
90
90
  if (
91
91
  // Is first value from HTTP query
92
- ((_f = data === null || data === void 0 ? void 0 : data.paging) === null || _f === void 0 ? void 0 : _f.n) == 0
92
+ ((_g = data === null || data === void 0 ? void 0 : data.paging) === null || _g === void 0 ? void 0 : _g.n) == 0
93
93
  || (
94
94
  // Is realtime update that match filters
95
95
  realtime && Object
@@ -153,7 +153,7 @@ class CollectionObservable extends rxjs_1.Observable {
153
153
  }
154
154
  }
155
155
  if (actions.reindex) {
156
- __classPrivateFieldGet(this, _CollectionObservable_state, "f").items = __classPrivateFieldGet(this, _CollectionObservable_state, "f").items.sort((0, get_sort_function_1.get_sort_function)(__classPrivateFieldGet(this, _CollectionObservable_state, "f").items[0], ((_h = (_g = this.collection_options) === null || _g === void 0 ? void 0 : _g.filters) === null || _h === void 0 ? void 0 : _h._order_by) || 'created_at', (_k = (_j = this.collection_options) === null || _j === void 0 ? void 0 : _j.filters) === null || _k === void 0 ? void 0 : _k._sort));
156
+ __classPrivateFieldGet(this, _CollectionObservable_state, "f").items = __classPrivateFieldGet(this, _CollectionObservable_state, "f").items.sort((0, get_sort_function_1.get_sort_function)(__classPrivateFieldGet(this, _CollectionObservable_state, "f").items[0], ((_j = (_h = this.collection_options) === null || _h === void 0 ? void 0 : _h.filters) === null || _j === void 0 ? void 0 : _j._order_by) || 'created_at', (_l = (_k = this.collection_options) === null || _k === void 0 ? void 0 : _k.filters) === null || _l === void 0 ? void 0 : _l._sort));
157
157
  __classPrivateFieldGet(this, _CollectionObservable_IdMap, "f").clear();
158
158
  __classPrivateFieldGet(this, _CollectionObservable_state, "f").items.map((item, index) => __classPrivateFieldGet(this, _CollectionObservable_IdMap, "f").set(item.id, index));
159
159
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "repository": {
4
4
  "url": "https://github.com/livequery/client"
5
5
  },
6
- "version": "1.0.35",
6
+ "version": "1.0.36",
7
7
  "description": "",
8
8
  "main": "build/index.js",
9
9
  "types": "build/index.d.ts",