(msg: SyncInitFinishMsg)
| 692 | } |
| 693 | |
| 694 | public onSyncInitFinish(msg: SyncInitFinishMsg) { |
| 695 | const subscriptionId = msg['subscription-id']; |
| 696 | const hash = this.idToHash[subscriptionId]; |
| 697 | if (!hash) { |
| 698 | this.log.error('Missing hash for subscription', msg); |
| 699 | return; |
| 700 | } |
| 701 | this.subs.updateInPlace((prev) => { |
| 702 | const sub = prev[hash]; |
| 703 | if (!sub) { |
| 704 | this.log.error('Missing sub for hash', hash, msg); |
| 705 | return; |
| 706 | } |
| 707 | const state = sub.state; |
| 708 | if (!state) { |
| 709 | this.log.error('Sub never set init, missing result', sub, msg); |
| 710 | return prev; |
| 711 | } |
| 712 | state.txId = msg['tx-id']; |
| 713 | sub.updatedAt = Date.now(); |
| 714 | }); |
| 715 | |
| 716 | const sub = this.subs.currentValue[hash]; |
| 717 | |
| 718 | if (sub) { |
| 719 | this.notifyCbs(hash, { |
| 720 | type: CallbackEventType.InitialSyncComplete, |
| 721 | data: subData(sub, sub.values?.entities || []), |
| 722 | }); |
| 723 | } |
| 724 | } |
| 725 | |
| 726 | public onSyncUpdateTriples(msg: SyncUpdateTriplesMsg) { |
| 727 | const subscriptionId = msg['subscription-id']; |
no test coverage detected