@pisell/pisellos 2.2.96 → 2.2.98

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.
@@ -34,7 +34,7 @@ import { ResourceHooks } from "./types";
34
34
  * SQLite 存储名称
35
35
  */
36
36
  var RESOURCE_STORE_NAME = 'resources';
37
- var BOOKING_STORE_NAME = 'resource_bookings';
37
+ // const BOOKING_STORE_NAME = 'resource_bookings'
38
38
 
39
39
  /**
40
40
  * 默认分页大小
@@ -145,7 +145,7 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
145
145
  value: function () {
146
146
  var _preload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
147
147
  var _this3 = this;
148
- var cachedResources, resources, cachedBookings;
148
+ var cachedResources, resources;
149
149
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
150
150
  while (1) switch (_context2.prev = _context2.next) {
151
151
  case 0:
@@ -182,15 +182,6 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
182
182
  _context2.next = 18;
183
183
  return this.safeEmit(ResourceHooks.onResourcesChanged, this.store.list);
184
184
  case 18:
185
- _context2.next = 20;
186
- return this.loadBookingsFromSQLite();
187
- case 20:
188
- cachedBookings = _context2.sent;
189
- if (cachedBookings.length > 0) {
190
- this.store.bookings = cloneDeep(cachedBookings);
191
- this.syncBookingsIndex();
192
- }
193
- case 22:
194
185
  case "end":
195
186
  return _context2.stop();
196
187
  }
@@ -329,65 +320,57 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
329
320
  /**
330
321
  * 创建预订
331
322
  */
332
- }, {
333
- key: "createBooking",
334
- value: function createBooking(booking) {
335
- var _booking$id, _normalized$resource_;
336
- var id = (_booking$id = booking === null || booking === void 0 ? void 0 : booking.id) !== null && _booking$id !== void 0 ? _booking$id : Date.now();
337
- var normalized = _objectSpread({
338
- id: id
339
- }, booking);
340
- this.store.bookings.push(normalized);
341
- var rid = (_normalized$resource_ = normalized.resource_id) !== null && _normalized$resource_ !== void 0 ? _normalized$resource_ : normalized.resourceId;
342
- if (rid !== undefined) {
343
- var existing = this.resourceIdIndex.get(rid) || [];
344
- existing.push(normalized);
345
- this.resourceIdIndex.set(rid, existing);
346
- }
347
- this.saveBookingsToSQLite(this.store.bookings).catch(function () {});
348
- this.safeEmit(ResourceHooks.onBookingsChanged, this.store.bookings);
349
- return normalized;
350
- }
323
+ // createBooking(booking: Partial<ResourceBooking>): ResourceBooking {
324
+ // const id = booking?.id ?? Date.now()
325
+ // const normalized: ResourceBooking = {
326
+ // id,
327
+ // ...booking,
328
+ // } as ResourceBooking
329
+
330
+ // this.store.bookings.push(normalized)
331
+
332
+ // const rid = normalized.resource_id ?? normalized.resourceId
333
+ // if (rid !== undefined) {
334
+ // const existing = this.resourceIdIndex.get(rid) || []
335
+ // existing.push(normalized)
336
+ // this.resourceIdIndex.set(rid, existing)
337
+ // }
338
+
339
+ // this.saveBookingsToSQLite(this.store.bookings).catch(() => {})
340
+ // this.safeEmit(ResourceHooks.onBookingsChanged, this.store.bookings)
341
+ // return normalized
342
+ // }
351
343
 
352
344
  /**
353
345
  * 更新预订
354
346
  */
355
- }, {
356
- key: "updateBooking",
357
- value: function updateBooking(id, data) {
358
- var _this7 = this;
359
- var index = this.store.bookings.findIndex(function (b) {
360
- return _this7.getIdKey(b.id) === _this7.getIdKey(id);
361
- });
362
- if (index === -1) return undefined;
363
- var old = this.store.bookings[index];
364
- var updated = _objectSpread(_objectSpread(_objectSpread({}, old), data), {}, {
365
- id: old.id
366
- });
367
- this.store.bookings[index] = updated;
368
- this.rebuildBookingsIndex();
369
- this.saveBookingsToSQLite(this.store.bookings).catch(function () {});
370
- this.safeEmit(ResourceHooks.onBookingsChanged, this.store.bookings);
371
- return updated;
372
- }
347
+ // updateBooking(id: ResourceId, data: Partial<ResourceBooking>): ResourceBooking | undefined {
348
+ // const index = this.store.bookings.findIndex(b => this.getIdKey(b.id) === this.getIdKey(id))
349
+ // if (index === -1) return undefined
350
+
351
+ // const old = this.store.bookings[index]
352
+ // const updated: ResourceBooking = { ...old, ...data, id: old.id } as ResourceBooking
353
+ // this.store.bookings[index] = updated
354
+
355
+ // this.rebuildBookingsIndex()
356
+ // this.saveBookingsToSQLite(this.store.bookings).catch(() => {})
357
+ // this.safeEmit(ResourceHooks.onBookingsChanged, this.store.bookings)
358
+ // return updated
359
+ // }
373
360
 
374
361
  /**
375
362
  * 删除预订
376
363
  */
377
- }, {
378
- key: "deleteBooking",
379
- value: function deleteBooking(id) {
380
- var _this8 = this;
381
- var index = this.store.bookings.findIndex(function (b) {
382
- return _this8.getIdKey(b.id) === _this8.getIdKey(id);
383
- });
384
- if (index === -1) return false;
385
- this.store.bookings.splice(index, 1);
386
- this.rebuildBookingsIndex();
387
- this.saveBookingsToSQLite(this.store.bookings).catch(function () {});
388
- this.safeEmit(ResourceHooks.onBookingsChanged, this.store.bookings);
389
- return true;
390
- }
364
+ // deleteBooking(id: ResourceId): boolean {
365
+ // const index = this.store.bookings.findIndex(b => this.getIdKey(b.id) === this.getIdKey(id))
366
+ // if (index === -1) return false
367
+
368
+ // this.store.bookings.splice(index, 1)
369
+ // this.rebuildBookingsIndex()
370
+ // this.saveBookingsToSQLite(this.store.bookings).catch(() => {})
371
+ // this.safeEmit(ResourceHooks.onBookingsChanged, this.store.bookings)
372
+ // return true
373
+ // }
391
374
 
392
375
  /**
393
376
  * 清空缓存
@@ -448,7 +431,7 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
448
431
  value: function normalizeResource(resource) {
449
432
  var _ref2,
450
433
  _resource$id,
451
- _this9 = this;
434
+ _this7 = this;
452
435
  var normalized = _objectSpread(_objectSpread({}, resource), {}, {
453
436
  id: (_ref2 = (_resource$id = resource === null || resource === void 0 ? void 0 : resource.id) !== null && _resource$id !== void 0 ? _resource$id : resource === null || resource === void 0 ? void 0 : resource.form_record_id) !== null && _ref2 !== void 0 ? _ref2 : ''
454
437
  });
@@ -477,7 +460,7 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
477
460
  }
478
461
  if (Array.isArray(normalized.children)) {
479
462
  normalized.children = normalized.children.map(function (child) {
480
- return _this9.normalizeResource(child);
463
+ return _this7.normalizeResource(child);
481
464
  });
482
465
  }
483
466
  return normalized;
@@ -568,7 +551,7 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
568
551
  key: "loadResourcesByServer",
569
552
  value: function () {
570
553
  var _loadResourcesByServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
571
- var _this10 = this;
554
+ var _this8 = this;
572
555
  var response, resourceList, normalizedList;
573
556
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
574
557
  while (1) switch (_context5.prev = _context5.next) {
@@ -589,7 +572,7 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
589
572
  response = _context5.sent;
590
573
  resourceList = Array.isArray(response === null || response === void 0 ? void 0 : response.list) ? response.list : [];
591
574
  normalizedList = resourceList.map(function (item) {
592
- return _this10.normalizeResource(item);
575
+ return _this8.normalizeResource(item);
593
576
  });
594
577
  _context5.next = 10;
595
578
  return this.saveResourcesToSQLite(normalizedList);
@@ -654,7 +637,7 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
654
637
  key: "saveResourcesToSQLite",
655
638
  value: function () {
656
639
  var _saveResourcesToSQLite = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(resourceList) {
657
- var _this11 = this;
640
+ var _this9 = this;
658
641
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
659
642
  while (1) switch (_context7.prev = _context7.next) {
660
643
  case 0:
@@ -685,7 +668,7 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
685
668
  case 11:
686
669
  _context7.next = 13;
687
670
  return Promise.all(resourceList.map(function (r) {
688
- return _this11.dbManager.add(RESOURCE_STORE_NAME, r);
671
+ return _this9.dbManager.add(RESOURCE_STORE_NAME, r);
689
672
  }));
690
673
  case 13:
691
674
  _context7.next = 19;
@@ -708,96 +691,30 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
708
691
  return _saveResourcesToSQLite.apply(this, arguments);
709
692
  }
710
693
  return saveResourcesToSQLite;
711
- }()
712
- }, {
713
- key: "loadBookingsFromSQLite",
714
- value: function () {
715
- var _loadBookingsFromSQLite = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
716
- var bookings;
717
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
718
- while (1) switch (_context8.prev = _context8.next) {
719
- case 0:
720
- if (this.dbManager) {
721
- _context8.next = 2;
722
- break;
723
- }
724
- return _context8.abrupt("return", []);
725
- case 2:
726
- _context8.prev = 2;
727
- _context8.next = 5;
728
- return this.dbManager.getAll(BOOKING_STORE_NAME);
729
- case 5:
730
- bookings = _context8.sent;
731
- return _context8.abrupt("return", bookings || []);
732
- case 9:
733
- _context8.prev = 9;
734
- _context8.t0 = _context8["catch"](2);
735
- return _context8.abrupt("return", []);
736
- case 12:
737
- case "end":
738
- return _context8.stop();
739
- }
740
- }, _callee8, this, [[2, 9]]);
741
- }));
742
- function loadBookingsFromSQLite() {
743
- return _loadBookingsFromSQLite.apply(this, arguments);
744
- }
745
- return loadBookingsFromSQLite;
746
- }()
747
- }, {
748
- key: "saveBookingsToSQLite",
749
- value: function () {
750
- var _saveBookingsToSQLite = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(bookings) {
751
- var _this12 = this;
752
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
753
- while (1) switch (_context9.prev = _context9.next) {
754
- case 0:
755
- if (this.dbManager) {
756
- _context9.next = 2;
757
- break;
758
- }
759
- return _context9.abrupt("return");
760
- case 2:
761
- _context9.prev = 2;
762
- _context9.next = 5;
763
- return this.dbManager.clear(BOOKING_STORE_NAME);
764
- case 5:
765
- if (!(bookings.length === 0)) {
766
- _context9.next = 7;
767
- break;
768
- }
769
- return _context9.abrupt("return");
770
- case 7:
771
- if (!this.dbManager.bulkAdd) {
772
- _context9.next = 11;
773
- break;
774
- }
775
- _context9.next = 10;
776
- return this.dbManager.bulkAdd(BOOKING_STORE_NAME, bookings);
777
- case 10:
778
- return _context9.abrupt("return");
779
- case 11:
780
- _context9.next = 13;
781
- return Promise.all(bookings.map(function (b) {
782
- return _this12.dbManager.add(BOOKING_STORE_NAME, b);
783
- }));
784
- case 13:
785
- _context9.next = 17;
786
- break;
787
- case 15:
788
- _context9.prev = 15;
789
- _context9.t0 = _context9["catch"](2);
790
- case 17:
791
- case "end":
792
- return _context9.stop();
793
- }
794
- }, _callee9, this, [[2, 15]]);
795
- }));
796
- function saveBookingsToSQLite(_x6) {
797
- return _saveBookingsToSQLite.apply(this, arguments);
798
- }
799
- return saveBookingsToSQLite;
800
- }() // ─────────────────────────────────────────────────────────────────
694
+ }() // private async loadBookingsFromSQLite(): Promise<ResourceBooking[]> {
695
+ // if (!this.dbManager) return []
696
+ // try {
697
+ // const bookings = await this.dbManager.getAll(BOOKING_STORE_NAME)
698
+ // return bookings || []
699
+ // } catch {
700
+ // return []
701
+ // }
702
+ // }
703
+ // private async saveBookingsToSQLite(bookings: ResourceBooking[]): Promise<void> {
704
+ // if (!this.dbManager) return
705
+ // try {
706
+ // await this.dbManager.clear(BOOKING_STORE_NAME)
707
+ // if (bookings.length === 0) return
708
+ // if (this.dbManager.bulkAdd) {
709
+ // await this.dbManager.bulkAdd(BOOKING_STORE_NAME, bookings)
710
+ // return
711
+ // }
712
+ // await Promise.all(bookings.map(b => this.dbManager.add(BOOKING_STORE_NAME, b)))
713
+ // } catch {
714
+ // // 忽略 SQLite 异常
715
+ // }
716
+ // }
717
+ // ─────────────────────────────────────────────────────────────────
801
718
  // pubsub 同步
802
719
  // ─────────────────────────────────────────────────────────────────
803
720
  }, {
@@ -811,32 +728,32 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
811
728
  }, {
812
729
  key: "setupResourceSync",
813
730
  value: function () {
814
- var _setupResourceSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
815
- var _this13 = this,
731
+ var _setupResourceSync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
732
+ var _this10 = this,
816
733
  _result$data;
817
734
  var result, _result$data2;
818
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
819
- while (1) switch (_context10.prev = _context10.next) {
735
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
736
+ while (1) switch (_context8.prev = _context8.next) {
820
737
  case 0:
821
738
  if (this.resourceDataSource) {
822
- _context10.next = 2;
739
+ _context8.next = 2;
823
740
  break;
824
741
  }
825
- return _context10.abrupt("return");
742
+ return _context8.abrupt("return");
826
743
  case 2:
827
- _context10.next = 4;
744
+ _context8.next = 4;
828
745
  return this.resourceDataSource.run({
829
746
  pubsub: {
830
747
  callback: function callback(res) {
831
748
  var data = (res === null || res === void 0 ? void 0 : res.data) || res;
832
749
  if (!data) return;
833
750
  var channelKey = data.module || 'resource';
834
- _this13.pendingSyncMessages.push(_objectSpread(_objectSpread({}, data), {}, {
751
+ _this10.pendingSyncMessages.push(_objectSpread(_objectSpread({}, data), {}, {
835
752
  _channelKey: channelKey
836
753
  }));
837
- if (_this13.syncTimer) clearTimeout(_this13.syncTimer);
838
- _this13.syncTimer = setTimeout(function () {
839
- _this13.processSyncMessages();
754
+ if (_this10.syncTimer) clearTimeout(_this10.syncTimer);
755
+ _this10.syncTimer = setTimeout(function () {
756
+ _this10.processSyncMessages();
840
757
  }, RESOURCE_SYNC_DEBOUNCE_MS);
841
758
  }
842
759
  }
@@ -844,19 +761,19 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
844
761
  // 忽略同步初始化异常
845
762
  });
846
763
  case 4:
847
- result = _context10.sent;
764
+ result = _context8.sent;
848
765
  console.log('result', result);
849
766
  if (!(result !== null && result !== void 0 && (_result$data = result.data) !== null && _result$data !== void 0 && (_result$data = _result$data.list) !== null && _result$data !== void 0 && _result$data.length)) {
850
- _context10.next = 9;
767
+ _context8.next = 9;
851
768
  break;
852
769
  }
853
- _context10.next = 9;
770
+ _context8.next = 9;
854
771
  return this.mergeResourcesToStore(result === null || result === void 0 || (_result$data2 = result.data) === null || _result$data2 === void 0 ? void 0 : _result$data2.list);
855
772
  case 9:
856
773
  case "end":
857
- return _context10.stop();
774
+ return _context8.stop();
858
775
  }
859
- }, _callee10, this);
776
+ }, _callee8, this);
860
777
  }));
861
778
  function setupResourceSync() {
862
779
  return _setupResourceSync.apply(this, arguments);
@@ -866,53 +783,53 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
866
783
  }, {
867
784
  key: "processSyncMessages",
868
785
  value: function () {
869
- var _processSyncMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
786
+ var _processSyncMessages = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
870
787
  var messages, deleteIds, bodyUpdates, sseRefreshIds, _iterator3, _step3, _msg$ids2, _msg$relation_resourc, msg, _msg$ids, _msg$body$id, bodyId, uniqueDeleteIds, uniqueSSEIds, bodyList, freshResources;
871
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
872
- while (1) switch (_context11.prev = _context11.next) {
788
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
789
+ while (1) switch (_context9.prev = _context9.next) {
873
790
  case 0:
874
791
  messages = _toConsumableArray(this.pendingSyncMessages);
875
792
  this.pendingSyncMessages = [];
876
793
  if (!(messages.length === 0)) {
877
- _context11.next = 4;
794
+ _context9.next = 4;
878
795
  break;
879
796
  }
880
- return _context11.abrupt("return");
797
+ return _context9.abrupt("return");
881
798
  case 4:
882
799
  deleteIds = [];
883
800
  bodyUpdates = new Map();
884
801
  sseRefreshIds = [];
885
802
  _iterator3 = _createForOfIteratorHelper(messages);
886
- _context11.prev = 8;
803
+ _context9.prev = 8;
887
804
  _iterator3.s();
888
805
  case 10:
889
806
  if ((_step3 = _iterator3.n()).done) {
890
- _context11.next = 24;
807
+ _context9.next = 24;
891
808
  break;
892
809
  }
893
810
  msg = _step3.value;
894
811
  if (!(msg.operation === 'delete' || msg.action === 'delete')) {
895
- _context11.next = 15;
812
+ _context9.next = 15;
896
813
  break;
897
814
  }
898
815
  if ((_msg$ids = msg.ids) !== null && _msg$ids !== void 0 && _msg$ids.length) deleteIds.push.apply(deleteIds, _toConsumableArray(msg.ids));else if (msg.id !== undefined) deleteIds.push(msg.id);
899
- return _context11.abrupt("continue", 22);
816
+ return _context9.abrupt("continue", 22);
900
817
  case 15:
901
818
  if (!msg.body) {
902
- _context11.next = 21;
819
+ _context9.next = 21;
903
820
  break;
904
821
  }
905
822
  bodyId = (_msg$body$id = msg.body.id) !== null && _msg$body$id !== void 0 ? _msg$body$id : msg.id;
906
823
  if (!(bodyId === undefined)) {
907
- _context11.next = 19;
824
+ _context9.next = 19;
908
825
  break;
909
826
  }
910
- return _context11.abrupt("continue", 22);
827
+ return _context9.abrupt("continue", 22);
911
828
  case 19:
912
829
  bodyUpdates.set(this.getIdKey(bodyId), _objectSpread(_objectSpread({}, msg.body), {}, {
913
830
  id: bodyId
914
831
  }));
915
- return _context11.abrupt("continue", 22);
832
+ return _context9.abrupt("continue", 22);
916
833
  case 21:
917
834
  if ((_msg$ids2 = msg.ids) !== null && _msg$ids2 !== void 0 && _msg$ids2.length) {
918
835
  sseRefreshIds.push.apply(sseRefreshIds, _toConsumableArray(msg.ids));
@@ -922,65 +839,65 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
922
839
  sseRefreshIds.push.apply(sseRefreshIds, _toConsumableArray(msg.relation_resource_ids));
923
840
  }
924
841
  case 22:
925
- _context11.next = 10;
842
+ _context9.next = 10;
926
843
  break;
927
844
  case 24:
928
- _context11.next = 29;
845
+ _context9.next = 29;
929
846
  break;
930
847
  case 26:
931
- _context11.prev = 26;
932
- _context11.t0 = _context11["catch"](8);
933
- _iterator3.e(_context11.t0);
848
+ _context9.prev = 26;
849
+ _context9.t0 = _context9["catch"](8);
850
+ _iterator3.e(_context9.t0);
934
851
  case 29:
935
- _context11.prev = 29;
852
+ _context9.prev = 29;
936
853
  _iterator3.f();
937
- return _context11.finish(29);
854
+ return _context9.finish(29);
938
855
  case 32:
939
856
  uniqueDeleteIds = this.uniqueResourceIds(deleteIds);
940
857
  uniqueSSEIds = this.uniqueResourceIds(sseRefreshIds);
941
858
  bodyList = _toConsumableArray(bodyUpdates.values());
942
859
  if (!(uniqueDeleteIds.length > 0)) {
943
- _context11.next = 38;
860
+ _context9.next = 38;
944
861
  break;
945
862
  }
946
- _context11.next = 38;
863
+ _context9.next = 38;
947
864
  return this.removeResourcesByIds(uniqueDeleteIds);
948
865
  case 38:
949
866
  if (!(bodyList.length > 0)) {
950
- _context11.next = 41;
867
+ _context9.next = 41;
951
868
  break;
952
869
  }
953
- _context11.next = 41;
870
+ _context9.next = 41;
954
871
  return this.mergeResourcesToStore(bodyList);
955
872
  case 41:
956
873
  if (!(uniqueSSEIds.length > 0)) {
957
- _context11.next = 48;
874
+ _context9.next = 48;
958
875
  break;
959
876
  }
960
- _context11.next = 44;
877
+ _context9.next = 44;
961
878
  return this.fetchResourcesBySSE(uniqueSSEIds);
962
879
  case 44:
963
- freshResources = _context11.sent;
880
+ freshResources = _context9.sent;
964
881
  if (!(freshResources.length > 0)) {
965
- _context11.next = 48;
882
+ _context9.next = 48;
966
883
  break;
967
884
  }
968
- _context11.next = 48;
885
+ _context9.next = 48;
969
886
  return this.mergeResourcesToStore(freshResources);
970
887
  case 48:
971
888
  if (!(uniqueDeleteIds.length === 0 && bodyList.length === 0 && uniqueSSEIds.length === 0)) {
972
- _context11.next = 50;
889
+ _context9.next = 50;
973
890
  break;
974
891
  }
975
- return _context11.abrupt("return");
892
+ return _context9.abrupt("return");
976
893
  case 50:
977
- _context11.next = 52;
894
+ _context9.next = 52;
978
895
  return this.core.effects.emit(ResourceHooks.onResourcesSyncCompleted, null);
979
896
  case 52:
980
897
  case "end":
981
- return _context11.stop();
898
+ return _context9.stop();
982
899
  }
983
- }, _callee11, this, [[8, 26, 29, 32]]);
900
+ }, _callee9, this, [[8, 26, 29, 32]]);
984
901
  }));
985
902
  function processSyncMessages() {
986
903
  return _processSyncMessages.apply(this, arguments);
@@ -990,19 +907,19 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
990
907
  }, {
991
908
  key: "fetchResourcesBySSE",
992
909
  value: function () {
993
- var _fetchResourcesBySSE = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(ids) {
910
+ var _fetchResourcesBySSE = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(ids) {
994
911
  var list;
995
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
996
- while (1) switch (_context12.prev = _context12.next) {
912
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
913
+ while (1) switch (_context10.prev = _context10.next) {
997
914
  case 0:
998
915
  if (this.resourceDataSource) {
999
- _context12.next = 2;
916
+ _context10.next = 2;
1000
917
  break;
1001
918
  }
1002
- return _context12.abrupt("return", []);
919
+ return _context10.abrupt("return", []);
1003
920
  case 2:
1004
- _context12.prev = 2;
1005
- _context12.next = 5;
921
+ _context10.prev = 2;
922
+ _context10.next = 5;
1006
923
  return this.resourceDataSource.run({
1007
924
  sse: {
1008
925
  query: {
@@ -1012,19 +929,19 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
1012
929
  }
1013
930
  });
1014
931
  case 5:
1015
- list = _context12.sent;
1016
- return _context12.abrupt("return", list || []);
932
+ list = _context10.sent;
933
+ return _context10.abrupt("return", list || []);
1017
934
  case 9:
1018
- _context12.prev = 9;
1019
- _context12.t0 = _context12["catch"](2);
1020
- return _context12.abrupt("return", []);
935
+ _context10.prev = 9;
936
+ _context10.t0 = _context10["catch"](2);
937
+ return _context10.abrupt("return", []);
1021
938
  case 12:
1022
939
  case "end":
1023
- return _context12.stop();
940
+ return _context10.stop();
1024
941
  }
1025
- }, _callee12, this, [[2, 9]]);
942
+ }, _callee10, this, [[2, 9]]);
1026
943
  }));
1027
- function fetchResourcesBySSE(_x7) {
944
+ function fetchResourcesBySSE(_x6) {
1028
945
  return _fetchResourcesBySSE.apply(this, arguments);
1029
946
  }
1030
947
  return fetchResourcesBySSE;
@@ -1032,65 +949,65 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
1032
949
  }, {
1033
950
  key: "removeResourcesByIds",
1034
951
  value: function () {
1035
- var _removeResourcesByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(ids) {
1036
- var _this14 = this;
952
+ var _removeResourcesByIds = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(ids) {
953
+ var _this11 = this;
1037
954
  var keySet, _iterator4, _step4, id;
1038
- return _regeneratorRuntime().wrap(function _callee13$(_context13) {
1039
- while (1) switch (_context13.prev = _context13.next) {
955
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
956
+ while (1) switch (_context11.prev = _context11.next) {
1040
957
  case 0:
1041
958
  keySet = new Set(ids.map(function (id) {
1042
- return _this14.getIdKey(id);
959
+ return _this11.getIdKey(id);
1043
960
  }));
1044
961
  this.store.list = this.store.list.filter(function (r) {
1045
- return !keySet.has(_this14.getIdKey(r.id));
962
+ return !keySet.has(_this11.getIdKey(r.id));
1046
963
  });
1047
964
  this.syncResourcesMap();
1048
965
  if (!this.dbManager) {
1049
- _context13.next = 26;
966
+ _context11.next = 26;
1050
967
  break;
1051
968
  }
1052
- _context13.prev = 4;
969
+ _context11.prev = 4;
1053
970
  _iterator4 = _createForOfIteratorHelper(ids);
1054
- _context13.prev = 6;
971
+ _context11.prev = 6;
1055
972
  _iterator4.s();
1056
973
  case 8:
1057
974
  if ((_step4 = _iterator4.n()).done) {
1058
- _context13.next = 14;
975
+ _context11.next = 14;
1059
976
  break;
1060
977
  }
1061
978
  id = _step4.value;
1062
- _context13.next = 12;
979
+ _context11.next = 12;
1063
980
  return this.dbManager.delete(RESOURCE_STORE_NAME, id);
1064
981
  case 12:
1065
- _context13.next = 8;
982
+ _context11.next = 8;
1066
983
  break;
1067
984
  case 14:
1068
- _context13.next = 19;
985
+ _context11.next = 19;
1069
986
  break;
1070
987
  case 16:
1071
- _context13.prev = 16;
1072
- _context13.t0 = _context13["catch"](6);
1073
- _iterator4.e(_context13.t0);
988
+ _context11.prev = 16;
989
+ _context11.t0 = _context11["catch"](6);
990
+ _iterator4.e(_context11.t0);
1074
991
  case 19:
1075
- _context13.prev = 19;
992
+ _context11.prev = 19;
1076
993
  _iterator4.f();
1077
- return _context13.finish(19);
994
+ return _context11.finish(19);
1078
995
  case 22:
1079
- _context13.next = 26;
996
+ _context11.next = 26;
1080
997
  break;
1081
998
  case 24:
1082
- _context13.prev = 24;
1083
- _context13.t1 = _context13["catch"](4);
999
+ _context11.prev = 24;
1000
+ _context11.t1 = _context11["catch"](4);
1084
1001
  case 26:
1085
- _context13.next = 28;
1002
+ _context11.next = 28;
1086
1003
  return this.safeEmit(ResourceHooks.onResourcesChanged, this.store.list);
1087
1004
  case 28:
1088
1005
  case "end":
1089
- return _context13.stop();
1006
+ return _context11.stop();
1090
1007
  }
1091
- }, _callee13, this, [[4, 24], [6, 16, 19, 22]]);
1008
+ }, _callee11, this, [[4, 24], [6, 16, 19, 22]]);
1092
1009
  }));
1093
- function removeResourcesByIds(_x8) {
1010
+ function removeResourcesByIds(_x7) {
1094
1011
  return _removeResourcesByIds.apply(this, arguments);
1095
1012
  }
1096
1013
  return removeResourcesByIds;
@@ -1098,46 +1015,46 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
1098
1015
  }, {
1099
1016
  key: "mergeResourcesToStore",
1100
1017
  value: function () {
1101
- var _mergeResourcesToStore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(freshResources) {
1102
- var _this15 = this;
1018
+ var _mergeResourcesToStore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(freshResources) {
1019
+ var _this12 = this;
1103
1020
  var freshMap, _iterator5, _step5, r, updatedList, _iterator6, _step6, _r;
1104
- return _regeneratorRuntime().wrap(function _callee14$(_context14) {
1105
- while (1) switch (_context14.prev = _context14.next) {
1021
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
1022
+ while (1) switch (_context12.prev = _context12.next) {
1106
1023
  case 0:
1107
1024
  freshMap = new Map();
1108
1025
  _iterator5 = _createForOfIteratorHelper(freshResources);
1109
- _context14.prev = 2;
1026
+ _context12.prev = 2;
1110
1027
  _iterator5.s();
1111
1028
  case 4:
1112
1029
  if ((_step5 = _iterator5.n()).done) {
1113
- _context14.next = 11;
1030
+ _context12.next = 11;
1114
1031
  break;
1115
1032
  }
1116
1033
  r = _step5.value;
1117
1034
  if (!((r === null || r === void 0 ? void 0 : r.id) === undefined)) {
1118
- _context14.next = 8;
1035
+ _context12.next = 8;
1119
1036
  break;
1120
1037
  }
1121
- return _context14.abrupt("continue", 9);
1038
+ return _context12.abrupt("continue", 9);
1122
1039
  case 8:
1123
1040
  freshMap.set(this.getIdKey(r.id), this.normalizeResource(r));
1124
1041
  case 9:
1125
- _context14.next = 4;
1042
+ _context12.next = 4;
1126
1043
  break;
1127
1044
  case 11:
1128
- _context14.next = 16;
1045
+ _context12.next = 16;
1129
1046
  break;
1130
1047
  case 13:
1131
- _context14.prev = 13;
1132
- _context14.t0 = _context14["catch"](2);
1133
- _iterator5.e(_context14.t0);
1048
+ _context12.prev = 13;
1049
+ _context12.t0 = _context12["catch"](2);
1050
+ _iterator5.e(_context12.t0);
1134
1051
  case 16:
1135
- _context14.prev = 16;
1052
+ _context12.prev = 16;
1136
1053
  _iterator5.f();
1137
- return _context14.finish(16);
1054
+ return _context12.finish(16);
1138
1055
  case 19:
1139
1056
  updatedList = this.store.list.map(function (r) {
1140
- var key = _this15.getIdKey(r.id);
1057
+ var key = _this12.getIdKey(r.id);
1141
1058
  if (!freshMap.has(key)) return r;
1142
1059
  var fresh = freshMap.get(key);
1143
1060
  freshMap.delete(key);
@@ -1156,18 +1073,18 @@ export var ResourceModule = /*#__PURE__*/function (_BaseModule) {
1156
1073
  }
1157
1074
  this.store.list = updatedList;
1158
1075
  this.syncResourcesMap();
1159
- _context14.next = 26;
1076
+ _context12.next = 26;
1160
1077
  return this.saveResourcesToSQLite(this.store.list);
1161
1078
  case 26:
1162
- _context14.next = 28;
1079
+ _context12.next = 28;
1163
1080
  return this.safeEmit(ResourceHooks.onResourcesChanged, this.store.list);
1164
1081
  case 28:
1165
1082
  case "end":
1166
- return _context14.stop();
1083
+ return _context12.stop();
1167
1084
  }
1168
- }, _callee14, this, [[2, 13, 16, 19]]);
1085
+ }, _callee12, this, [[2, 13, 16, 19]]);
1169
1086
  }));
1170
- function mergeResourcesToStore(_x9) {
1087
+ function mergeResourcesToStore(_x8) {
1171
1088
  return _mergeResourcesToStore.apply(this, arguments);
1172
1089
  }
1173
1090
  return mergeResourcesToStore;