@knocklabs/client 0.21.9 → 0.21.11
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.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/api.js +1 -1
- package/dist/cjs/api.js.map +1 -1
- package/dist/cjs/clients/guide/client.js +1 -1
- package/dist/cjs/clients/guide/client.js.map +1 -1
- package/dist/cjs/clients/guide/types.js.map +1 -1
- package/dist/esm/api.mjs +1 -1
- package/dist/esm/clients/guide/client.mjs +20 -20
- package/dist/esm/clients/guide/client.mjs.map +1 -1
- package/dist/esm/clients/guide/types.mjs.map +1 -1
- package/dist/types/clients/guide/client.d.ts +3 -1
- package/dist/types/clients/guide/client.d.ts.map +1 -1
- package/dist/types/clients/guide/types.d.ts +2 -2
- package/dist/types/clients/guide/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/clients/guide/client.ts +10 -6
- package/src/clients/guide/types.ts +2 -2
package/package.json
CHANGED
|
@@ -629,11 +629,12 @@ export class KnockGuideClient {
|
|
|
629
629
|
`[Guide] Start debugging, refetching guides and resubscribing to the websocket channel`,
|
|
630
630
|
);
|
|
631
631
|
this.fetch({ force: true });
|
|
632
|
+
// Always subscribe while debugging.
|
|
632
633
|
this.subscribe();
|
|
633
634
|
}
|
|
634
635
|
}
|
|
635
636
|
|
|
636
|
-
unsetDebug() {
|
|
637
|
+
unsetDebug(opts?: { listenForUpdates?: boolean }) {
|
|
637
638
|
this.knock.log("[Guide] .unsetDebug()");
|
|
638
639
|
const shouldRefetch = this.store.state.debug?.debugging;
|
|
639
640
|
|
|
@@ -653,8 +654,11 @@ export class KnockGuideClient {
|
|
|
653
654
|
`[Guide] Stop debugging, refetching guides and resubscribing to the websocket channel`,
|
|
654
655
|
);
|
|
655
656
|
this.fetch({ force: true });
|
|
656
|
-
|
|
657
|
-
|
|
657
|
+
if (opts?.listenForUpdates) {
|
|
658
|
+
this.subscribe();
|
|
659
|
+
} else {
|
|
660
|
+
this.unsubscribe();
|
|
661
|
+
}
|
|
658
662
|
}
|
|
659
663
|
}
|
|
660
664
|
|
|
@@ -864,14 +868,14 @@ export class KnockGuideClient {
|
|
|
864
868
|
if (!this.stage || this.stage.status === "closed") return;
|
|
865
869
|
|
|
866
870
|
// Deep merge to accumulate the results.
|
|
867
|
-
const queriedByKey = this.stage.results.
|
|
871
|
+
const queriedByKey = this.stage.results.byKey || {};
|
|
868
872
|
if (filters.key) {
|
|
869
873
|
queriedByKey[filters.key] = {
|
|
870
874
|
...(queriedByKey[filters.key] || {}),
|
|
871
875
|
...{ [limit]: result },
|
|
872
876
|
};
|
|
873
877
|
}
|
|
874
|
-
const queriedByType = this.stage.results.
|
|
878
|
+
const queriedByType = this.stage.results.byType || {};
|
|
875
879
|
if (filters.type) {
|
|
876
880
|
queriedByType[filters.type] = {
|
|
877
881
|
...(queriedByType[filters.type] || {}),
|
|
@@ -881,7 +885,7 @@ export class KnockGuideClient {
|
|
|
881
885
|
|
|
882
886
|
this.stage = {
|
|
883
887
|
...this.stage,
|
|
884
|
-
results: {
|
|
888
|
+
results: { byKey: queriedByKey, byType: queriedByType },
|
|
885
889
|
};
|
|
886
890
|
}
|
|
887
891
|
|
|
@@ -296,8 +296,8 @@ type SelectionResultByLimit = {
|
|
|
296
296
|
};
|
|
297
297
|
|
|
298
298
|
type RecordedSelectionResults = {
|
|
299
|
-
|
|
300
|
-
|
|
299
|
+
byKey?: Record<KnockGuide["key"], SelectionResultByLimit>;
|
|
300
|
+
byType?: Record<KnockGuide["type"], SelectionResultByLimit>;
|
|
301
301
|
};
|
|
302
302
|
|
|
303
303
|
export type GroupStage = {
|