@webex/plugin-meetings 3.12.0-task-refactor.1 → 3.12.0-webex-services-ready.1
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/AGENTS.md +9 -0
- package/dist/aiEnableRequest/index.js +197 -0
- package/dist/aiEnableRequest/index.js.map +1 -0
- package/dist/aiEnableRequest/utils.js +36 -0
- package/dist/aiEnableRequest/utils.js.map +1 -0
- package/dist/annotation/index.js +14 -5
- package/dist/annotation/index.js.map +1 -1
- package/dist/breakouts/breakout.js +8 -3
- package/dist/breakouts/breakout.js.map +1 -1
- package/dist/breakouts/index.js +26 -2
- package/dist/breakouts/index.js.map +1 -1
- package/dist/common/errors/webex-errors.js +49 -5
- package/dist/common/errors/webex-errors.js.map +1 -1
- package/dist/config.js +9 -3
- package/dist/config.js.map +1 -1
- package/dist/constants.js +59 -10
- package/dist/constants.js.map +1 -1
- package/dist/controls-options-manager/constants.js +11 -1
- package/dist/controls-options-manager/constants.js.map +1 -1
- package/dist/controls-options-manager/index.js +67 -29
- package/dist/controls-options-manager/index.js.map +1 -1
- package/dist/controls-options-manager/util.js +91 -0
- package/dist/controls-options-manager/util.js.map +1 -1
- package/dist/hashTree/constants.js +34 -0
- package/dist/hashTree/constants.js.map +1 -0
- package/dist/hashTree/hashTree.js +533 -0
- package/dist/hashTree/hashTree.js.map +1 -0
- package/dist/hashTree/hashTreeParser.js +2068 -36
- package/dist/hashTree/hashTreeParser.js.map +1 -1
- package/dist/hashTree/types.js +13 -3
- package/dist/hashTree/types.js.map +1 -1
- package/dist/hashTree/utils.js +111 -0
- package/dist/hashTree/utils.js.map +1 -0
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/dist/interceptors/constant.js +12 -0
- package/dist/interceptors/constant.js.map +1 -0
- package/dist/interceptors/dataChannelAuthToken.js +350 -0
- package/dist/interceptors/dataChannelAuthToken.js.map +1 -0
- package/dist/interceptors/index.js +7 -0
- package/dist/interceptors/index.js.map +1 -1
- package/dist/interceptors/locusRetry.js +23 -8
- package/dist/interceptors/locusRetry.js.map +1 -1
- package/dist/interceptors/locusRouteToken.js +27 -5
- package/dist/interceptors/locusRouteToken.js.map +1 -1
- package/dist/interceptors/utils.js +27 -0
- package/dist/interceptors/utils.js.map +1 -0
- package/dist/interpretation/index.js +11 -2
- package/dist/interpretation/index.js.map +1 -1
- package/dist/interpretation/interpretation.types.js +7 -0
- package/dist/interpretation/interpretation.types.js.map +1 -0
- package/dist/interpretation/siLanguage.js +1 -1
- package/dist/locus-info/controlsUtils.js +11 -4
- package/dist/locus-info/controlsUtils.js.map +1 -1
- package/dist/locus-info/index.js +896 -277
- package/dist/locus-info/index.js.map +1 -1
- package/dist/locus-info/infoUtils.js +36 -5
- package/dist/locus-info/infoUtils.js.map +1 -1
- package/dist/locus-info/selfUtils.js +1 -0
- package/dist/locus-info/selfUtils.js.map +1 -1
- package/dist/locus-info/types.js +19 -0
- package/dist/locus-info/types.js.map +1 -1
- package/dist/media/MediaConnectionAwaiter.js +72 -3
- package/dist/media/MediaConnectionAwaiter.js.map +1 -1
- package/dist/media/index.js +8 -2
- package/dist/media/index.js.map +1 -1
- package/dist/media/properties.js +5 -2
- package/dist/media/properties.js.map +1 -1
- package/dist/meeting/in-meeting-actions.js +11 -1
- package/dist/meeting/in-meeting-actions.js.map +1 -1
- package/dist/meeting/index.js +2075 -1096
- package/dist/meeting/index.js.map +1 -1
- package/dist/meeting/locusMediaRequest.js +229 -82
- package/dist/meeting/locusMediaRequest.js.map +1 -1
- package/dist/meeting/muteState.js +10 -1
- package/dist/meeting/muteState.js.map +1 -1
- package/dist/meeting/request.js +55 -2
- package/dist/meeting/request.js.map +1 -1
- package/dist/meeting/request.type.js.map +1 -1
- package/dist/meeting/util.js +168 -5
- package/dist/meeting/util.js.map +1 -1
- package/dist/meeting-info/meeting-info-v2.js +2 -2
- package/dist/meeting-info/meeting-info-v2.js.map +1 -1
- package/dist/meetings/index.js +369 -173
- package/dist/meetings/index.js.map +1 -1
- package/dist/meetings/meetings.types.js +6 -1
- package/dist/meetings/meetings.types.js.map +1 -1
- package/dist/meetings/request.js +39 -0
- package/dist/meetings/request.js.map +1 -1
- package/dist/meetings/util.js +127 -25
- package/dist/meetings/util.js.map +1 -1
- package/dist/member/index.js +20 -0
- package/dist/member/index.js.map +1 -1
- package/dist/member/types.js.map +1 -1
- package/dist/member/util.js +40 -0
- package/dist/member/util.js.map +1 -1
- package/dist/members/index.js +101 -43
- package/dist/members/index.js.map +1 -1
- package/dist/members/util.js +8 -1
- package/dist/members/util.js.map +1 -1
- package/dist/metrics/constants.js +11 -1
- package/dist/metrics/constants.js.map +1 -1
- package/dist/multistream/codec/constants.js +63 -0
- package/dist/multistream/codec/constants.js.map +1 -0
- package/dist/multistream/mediaRequestManager.js +64 -68
- package/dist/multistream/mediaRequestManager.js.map +1 -1
- package/dist/multistream/receiveSlot.js +9 -0
- package/dist/multistream/receiveSlot.js.map +1 -1
- package/dist/multistream/remoteMediaManager.js +11 -0
- package/dist/multistream/remoteMediaManager.js.map +1 -1
- package/dist/multistream/sendSlotManager.js +116 -2
- package/dist/multistream/sendSlotManager.js.map +1 -1
- package/dist/reachability/clusterReachability.js +171 -18
- package/dist/reachability/clusterReachability.js.map +1 -1
- package/dist/reachability/index.js +142 -94
- package/dist/reachability/index.js.map +1 -1
- package/dist/reachability/reachability.types.js +2 -0
- package/dist/reachability/reachability.types.js.map +1 -1
- package/dist/reachability/reachabilityPeerConnection.js +1 -1
- package/dist/reachability/reachabilityPeerConnection.js.map +1 -1
- package/dist/reachability/util.js +45 -0
- package/dist/reachability/util.js.map +1 -1
- package/dist/reactions/reactions.type.js.map +1 -1
- package/dist/reconnection-manager/index.js +0 -1
- package/dist/reconnection-manager/index.js.map +1 -1
- package/dist/recording-controller/index.js +1 -3
- package/dist/recording-controller/index.js.map +1 -1
- package/dist/types/aiEnableRequest/index.d.ts +5 -0
- package/dist/types/aiEnableRequest/utils.d.ts +2 -0
- package/dist/types/common/browser-detection.d.ts +1 -0
- package/dist/types/common/errors/webex-errors.d.ts +32 -2
- package/dist/types/common/events/events-scope.d.ts +1 -0
- package/dist/types/common/events/events.d.ts +1 -0
- package/dist/types/config.d.ts +7 -2
- package/dist/types/constants.d.ts +35 -1
- package/dist/types/controls-options-manager/constants.d.ts +6 -1
- package/dist/types/controls-options-manager/index.d.ts +16 -0
- package/dist/types/hashTree/constants.d.ts +11 -0
- package/dist/types/hashTree/hashTree.d.ts +136 -0
- package/dist/types/hashTree/hashTreeParser.d.ts +392 -14
- package/dist/types/hashTree/types.d.ts +20 -0
- package/dist/types/hashTree/utils.d.ts +40 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/interceptors/constant.d.ts +5 -0
- package/dist/types/interceptors/dataChannelAuthToken.d.ts +43 -0
- package/dist/types/interceptors/index.d.ts +2 -1
- package/dist/types/interceptors/locusRetry.d.ts +4 -4
- package/dist/types/interceptors/locusRouteToken.d.ts +2 -0
- package/dist/types/interceptors/utils.d.ts +1 -0
- package/dist/types/interpretation/interpretation.types.d.ts +10 -0
- package/dist/types/locus-info/index.d.ts +116 -51
- package/dist/types/locus-info/infoUtils.d.ts +8 -0
- package/dist/types/locus-info/types.d.ts +48 -12
- package/dist/types/media/MediaConnectionAwaiter.d.ts +20 -2
- package/dist/types/media/properties.d.ts +3 -1
- package/dist/types/meeting/in-meeting-actions.d.ts +10 -0
- package/dist/types/meeting/index.d.ts +196 -15
- package/dist/types/meeting/locusMediaRequest.d.ts +12 -0
- package/dist/types/meeting/request.d.ts +17 -1
- package/dist/types/meeting/request.type.d.ts +5 -0
- package/dist/types/meeting/util.d.ts +40 -0
- package/dist/types/meeting-info/util.d.ts +1 -0
- package/dist/types/meeting-info/utilv2.d.ts +1 -0
- package/dist/types/meetings/index.d.ts +34 -20
- package/dist/types/meetings/meetings.types.d.ts +15 -0
- package/dist/types/meetings/request.d.ts +14 -0
- package/dist/types/member/index.d.ts +2 -0
- package/dist/types/member/types.d.ts +5 -4
- package/dist/types/member/util.d.ts +14 -0
- package/dist/types/members/index.d.ts +15 -2
- package/dist/types/members/util.d.ts +1 -5
- package/dist/types/metrics/constants.d.ts +10 -0
- package/dist/types/multistream/codec/constants.d.ts +7 -0
- package/dist/types/multistream/mediaRequestManager.d.ts +20 -26
- package/dist/types/multistream/sendSlotManager.d.ts +23 -1
- package/dist/types/reachability/clusterReachability.d.ts +33 -6
- package/dist/types/reachability/index.d.ts +10 -3
- package/dist/types/reachability/reachability.types.d.ts +7 -0
- package/dist/types/reachability/util.d.ts +17 -0
- package/dist/types/reactions/reactions.type.d.ts +4 -0
- package/dist/types/recording-controller/util.d.ts +5 -5
- package/dist/types/roap/index.d.ts +1 -1
- package/dist/types/webinar/utils.d.ts +6 -0
- package/dist/webinar/index.js +585 -164
- package/dist/webinar/index.js.map +1 -1
- package/dist/webinar/utils.js +25 -0
- package/dist/webinar/utils.js.map +1 -0
- package/package.json +26 -24
- package/src/aiEnableRequest/README.md +84 -0
- package/src/aiEnableRequest/index.ts +186 -0
- package/src/aiEnableRequest/utils.ts +25 -0
- package/src/annotation/index.ts +27 -7
- package/src/breakouts/breakout.ts +3 -1
- package/src/breakouts/index.ts +31 -0
- package/src/common/errors/webex-errors.ts +50 -3
- package/src/config.ts +7 -2
- package/src/constants.ts +49 -3
- package/src/controls-options-manager/constants.ts +14 -1
- package/src/controls-options-manager/index.ts +87 -28
- package/src/controls-options-manager/util.ts +81 -1
- package/src/hashTree/constants.ts +26 -0
- package/src/hashTree/hashTree.ts +480 -0
- package/src/hashTree/hashTreeParser.ts +1911 -29
- package/src/hashTree/types.ts +24 -1
- package/src/hashTree/utils.ts +98 -0
- package/src/index.ts +14 -1
- package/src/interceptors/constant.ts +6 -0
- package/src/interceptors/dataChannelAuthToken.ts +246 -0
- package/src/interceptors/index.ts +2 -1
- package/src/interceptors/locusRetry.ts +25 -4
- package/src/interceptors/locusRouteToken.ts +22 -5
- package/src/interceptors/utils.ts +16 -0
- package/src/interpretation/index.ts +29 -11
- package/src/interpretation/interpretation.types.ts +11 -0
- package/src/locus-info/controlsUtils.ts +20 -1
- package/src/locus-info/index.ts +958 -250
- package/src/locus-info/infoUtils.ts +41 -6
- package/src/locus-info/selfUtils.ts +1 -0
- package/src/locus-info/types.ts +51 -12
- package/src/media/MediaConnectionAwaiter.ts +62 -5
- package/src/media/index.ts +10 -1
- package/src/media/properties.ts +4 -1
- package/src/meeting/in-meeting-actions.ts +20 -0
- package/src/meeting/index.ts +1025 -146
- package/src/meeting/locusMediaRequest.ts +106 -6
- package/src/meeting/muteState.ts +10 -1
- package/src/meeting/request.ts +53 -0
- package/src/meeting/request.type.ts +6 -0
- package/src/meeting/util.ts +207 -7
- package/src/meeting-info/meeting-info-v2.ts +4 -2
- package/src/meetings/index.ts +307 -132
- package/src/meetings/meetings.types.ts +19 -0
- package/src/meetings/request.ts +43 -0
- package/src/meetings/util.ts +127 -13
- package/src/member/index.ts +20 -0
- package/src/member/types.ts +1 -0
- package/src/member/util.ts +41 -0
- package/src/members/index.ts +70 -7
- package/src/members/util.ts +12 -4
- package/src/metrics/constants.ts +11 -0
- package/src/multistream/codec/constants.ts +58 -0
- package/src/multistream/mediaRequestManager.ts +117 -76
- package/src/multistream/receiveSlot.ts +18 -0
- package/src/multistream/remoteMediaManager.ts +13 -0
- package/src/multistream/sendSlotManager.ts +97 -3
- package/src/reachability/clusterReachability.ts +156 -29
- package/src/reachability/index.ts +62 -17
- package/src/reachability/reachability.types.ts +11 -0
- package/src/reachability/reachabilityPeerConnection.ts +3 -1
- package/src/reachability/util.ts +36 -0
- package/src/reactions/reactions.type.ts +4 -0
- package/src/reconnection-manager/index.ts +0 -1
- package/src/recording-controller/index.ts +1 -2
- package/src/webinar/index.ts +448 -11
- package/src/webinar/utils.ts +16 -0
- package/test/unit/spec/aiEnableRequest/index.ts +1067 -0
- package/test/unit/spec/aiEnableRequest/utils.ts +130 -0
- package/test/unit/spec/annotation/index.ts +69 -7
- package/test/unit/spec/breakouts/breakout.ts +9 -3
- package/test/unit/spec/breakouts/index.ts +49 -0
- package/test/unit/spec/common/errors/webex-errors.ts +78 -0
- package/test/unit/spec/controls-options-manager/index.js +244 -29
- package/test/unit/spec/controls-options-manager/util.js +165 -0
- package/test/unit/spec/hashTree/hashTree.ts +721 -0
- package/test/unit/spec/hashTree/hashTreeParser.ts +5328 -0
- package/test/unit/spec/hashTree/utils.ts +264 -0
- package/test/unit/spec/interceptors/dataChannelAuthToken.ts +406 -0
- package/test/unit/spec/interceptors/locusRetry.ts +205 -4
- package/test/unit/spec/interceptors/locusRouteToken.ts +44 -0
- package/test/unit/spec/interceptors/utils.ts +75 -0
- package/test/unit/spec/interpretation/index.ts +26 -4
- package/test/unit/spec/locus-info/controlsUtils.js +222 -52
- package/test/unit/spec/locus-info/index.js +2000 -171
- package/test/unit/spec/locus-info/infoUtils.js +184 -1
- package/test/unit/spec/media/MediaConnectionAwaiter.ts +96 -1
- package/test/unit/spec/media/index.ts +92 -0
- package/test/unit/spec/media/properties.ts +12 -3
- package/test/unit/spec/meeting/in-meeting-actions.ts +12 -2
- package/test/unit/spec/meeting/index.js +2925 -209
- package/test/unit/spec/meeting/locusMediaRequest.ts +406 -4
- package/test/unit/spec/meeting/muteState.js +81 -0
- package/test/unit/spec/meeting/request.js +82 -0
- package/test/unit/spec/meeting/utils.js +595 -27
- package/test/unit/spec/meeting-info/meetinginfov2.js +19 -10
- package/test/unit/spec/meetings/index.js +1214 -75
- package/test/unit/spec/meetings/request.js +141 -0
- package/test/unit/spec/meetings/utils.js +453 -52
- package/test/unit/spec/member/index.js +35 -4
- package/test/unit/spec/member/util.js +154 -27
- package/test/unit/spec/members/index.js +216 -0
- package/test/unit/spec/members/request.js +37 -1
- package/test/unit/spec/members/utils.js +63 -0
- package/test/unit/spec/multistream/mediaRequestManager.ts +503 -122
- package/test/unit/spec/multistream/remoteMediaManager.ts +30 -0
- package/test/unit/spec/multistream/sendSlotManager.ts +135 -36
- package/test/unit/spec/reachability/clusterReachability.ts +125 -1
- package/test/unit/spec/reachability/index.ts +154 -49
- package/test/unit/spec/reachability/util.ts +31 -0
- package/test/unit/spec/reconnection-manager/index.js +4 -8
- package/test/unit/spec/recording-controller/index.js +9 -8
- package/test/unit/spec/webinar/index.ts +837 -39
- package/test/unit/spec/webinar/utils.ts +39 -0
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
declare const ENABLED = "enabled";
|
|
2
2
|
declare const CAN_SET = "canSet";
|
|
3
3
|
declare const CAN_UNSET = "canUnset";
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Body keys that represent audio controls. These do not support cross-locus
|
|
6
|
+
* authorization and must be sent directly to the current locus URL.
|
|
7
|
+
*/
|
|
8
|
+
declare const AUDIO_CONTROL_BODY_KEYS: ReadonlySet<string>;
|
|
9
|
+
export { ENABLED, CAN_SET, CAN_UNSET, AUDIO_CONTROL_BODY_KEYS };
|
|
@@ -43,6 +43,8 @@ export default class ControlsOptionsManager {
|
|
|
43
43
|
* @memberof ControlsOptionsManager
|
|
44
44
|
*/
|
|
45
45
|
private mainLocusUrl;
|
|
46
|
+
private getControls;
|
|
47
|
+
private isWebinar;
|
|
46
48
|
/**
|
|
47
49
|
* @param {MeetingRequest} request
|
|
48
50
|
* @param {Object} options
|
|
@@ -52,6 +54,8 @@ export default class ControlsOptionsManager {
|
|
|
52
54
|
constructor(request: MeetingRequest, options?: {
|
|
53
55
|
locusUrl: string;
|
|
54
56
|
displayHints?: Array<string>;
|
|
57
|
+
getControls?: () => Record<string, any>;
|
|
58
|
+
isWebinar?: () => boolean;
|
|
55
59
|
});
|
|
56
60
|
/**
|
|
57
61
|
* @param {MeetingRequest} request
|
|
@@ -69,6 +73,8 @@ export default class ControlsOptionsManager {
|
|
|
69
73
|
set(options?: {
|
|
70
74
|
locusUrl: string;
|
|
71
75
|
displayHints?: Array<string>;
|
|
76
|
+
getControls?: () => Record<string, any>;
|
|
77
|
+
isWebinar?: () => boolean;
|
|
72
78
|
}): void;
|
|
73
79
|
/**
|
|
74
80
|
* @param {string} url
|
|
@@ -118,6 +124,16 @@ export default class ControlsOptionsManager {
|
|
|
118
124
|
* @returns {Promise}
|
|
119
125
|
*/
|
|
120
126
|
private setControls;
|
|
127
|
+
/**
|
|
128
|
+
* Sends a controls request to Locus. When authorizingLocusUrl is present in the body,
|
|
129
|
+
* we use a plain request() because the response contains the main session Locus DTO
|
|
130
|
+
* instead of the breakout we're in, so we don't want to parse it as a delta.
|
|
131
|
+
* Otherwise we use locusDeltaRequest() for normal delta processing.
|
|
132
|
+
*
|
|
133
|
+
* @param {Object} requestParams - The request parameters from getControlsRequestParams.
|
|
134
|
+
* @returns {Promise<any>}
|
|
135
|
+
*/
|
|
136
|
+
private sendControlsRequest;
|
|
121
137
|
/**
|
|
122
138
|
* @public
|
|
123
139
|
* @param {boolean} enabled
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const EMPTY_HASH = "99aa06d3014798d86001c324468d497f";
|
|
2
|
+
export declare const DataSetNames: {
|
|
3
|
+
MAIN: string;
|
|
4
|
+
ATTENDEES: string;
|
|
5
|
+
ATD_ACTIVE: string;
|
|
6
|
+
ATD_UNMUTED: string;
|
|
7
|
+
SELF: string;
|
|
8
|
+
UNJOINED: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const DATA_SET_INIT_PRIORITY: string[];
|
|
11
|
+
export declare const LLM_DATASET_NAMES: string[];
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { ObjectType } from './types';
|
|
2
|
+
export type LeafDataItem = {
|
|
3
|
+
type: ObjectType;
|
|
4
|
+
id: number;
|
|
5
|
+
version: number;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* HashTree is a data structure that organizes items into leaves based on their IDs,
|
|
9
|
+
*/
|
|
10
|
+
declare class HashTree {
|
|
11
|
+
leaves: Array<Record<string, Record<number, LeafDataItem>>>;
|
|
12
|
+
leafHashes: Array<string>;
|
|
13
|
+
readonly numLeaves: number;
|
|
14
|
+
/**
|
|
15
|
+
* Constructs a new HashTree.
|
|
16
|
+
* @param {LeafDataItem[]} leafData Initial data to populate the tree.
|
|
17
|
+
* @param {number} numLeaves The number of leaf nodes in the tree. Must be 0 or a power of 2.
|
|
18
|
+
* @throws {Error} If numLeaves is not 0 or a power of 2.
|
|
19
|
+
*/
|
|
20
|
+
constructor(leafData: LeafDataItem[], numLeaves: number);
|
|
21
|
+
/**
|
|
22
|
+
* Internal logic for adding or updating an item, without computing the leaf hash.
|
|
23
|
+
* @param {LeafDataItem} item The item to add or update.
|
|
24
|
+
* @returns {{put: boolean, index: (number|null)}} Object indicating if put and the leaf index.
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
private _putItemInternal;
|
|
28
|
+
/**
|
|
29
|
+
* Adds or updates a single item in the hash tree.
|
|
30
|
+
* @param {LeafDataItem} item The item to add or update.
|
|
31
|
+
* @returns {boolean} True if the item was added or updated, false otherwise (e.g., older version or tree has 0 leaves).
|
|
32
|
+
*/
|
|
33
|
+
putItem(item: LeafDataItem): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Adds or updates multiple items in the hash tree.
|
|
36
|
+
* @param {LeafDataItem[]} items The array of items to add or update.
|
|
37
|
+
* @returns {boolean[]} An array of booleans indicating success for each item.
|
|
38
|
+
*/
|
|
39
|
+
putItems(items: LeafDataItem[]): boolean[];
|
|
40
|
+
/**
|
|
41
|
+
* Internal logic for removing an item, without computing the leaf hash.
|
|
42
|
+
* @param {LeafDataItem} item The item to remove.
|
|
43
|
+
* @returns {{removed: boolean, index: (number|null)}} Object indicating if removed and the leaf index.
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
46
|
+
private _removeItemInternal;
|
|
47
|
+
/**
|
|
48
|
+
* Removes a single item from the hash tree.
|
|
49
|
+
* The removal is based on matching type, id, and the provided item's version
|
|
50
|
+
* being greater than or equal to the existing item's version.
|
|
51
|
+
* @param {LeafDataItem} item The item to remove.
|
|
52
|
+
* @returns {boolean} True if the item was removed, false otherwise.
|
|
53
|
+
*/
|
|
54
|
+
removeItem(item: LeafDataItem): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Removes multiple items from the hash tree.
|
|
57
|
+
* @param {LeafDataItem[]} items The array of items to remove.
|
|
58
|
+
* @returns {boolean[]} An array of booleans indicating success for each item.
|
|
59
|
+
*/
|
|
60
|
+
removeItems(items: LeafDataItem[]): boolean[];
|
|
61
|
+
/**
|
|
62
|
+
* Updates multiple items in the hash tree.
|
|
63
|
+
* This method can handle both updating and removing items based on the `operation` flag.
|
|
64
|
+
*
|
|
65
|
+
* @param {object[]} itemUpdates An array of objects containing `operation` flag and the `item` to update.
|
|
66
|
+
* @returns {boolean[]} An array of booleans indicating success for each operation.
|
|
67
|
+
*/
|
|
68
|
+
updateItems(itemUpdates: {
|
|
69
|
+
operation: 'update' | 'remove';
|
|
70
|
+
item: LeafDataItem;
|
|
71
|
+
}[]): boolean[];
|
|
72
|
+
/**
|
|
73
|
+
* Computes the hash for a specific leaf.
|
|
74
|
+
* The hash is based on the sorted items within the leaf.
|
|
75
|
+
* @param {number} index The index of the leaf to compute the hash for.
|
|
76
|
+
* @returns {void}
|
|
77
|
+
*/
|
|
78
|
+
computeLeafHash(index: number): void;
|
|
79
|
+
/**
|
|
80
|
+
* Computes all internal and leaf node hashes of the tree.
|
|
81
|
+
* Internal node hashes are computed bottom-up from the leaf hashes.
|
|
82
|
+
* @returns {string[]} An array of hash strings, with internal node hashes first, followed by leaf hashes.
|
|
83
|
+
* Returns `[EMPTY_HASH]` if the tree has 0 leaves.
|
|
84
|
+
*/
|
|
85
|
+
computeTreeHashes(): string[];
|
|
86
|
+
/**
|
|
87
|
+
* Returns all hashes in the tree (internal nodes then leaf nodes).
|
|
88
|
+
* @returns {string[]} An array of hash strings.
|
|
89
|
+
*/
|
|
90
|
+
getHashes(): string[];
|
|
91
|
+
/**
|
|
92
|
+
* Computes and returns the hash value of the root node.
|
|
93
|
+
* @returns {string} The root hash of the entire tree. Returns `EMPTY_HASH` if the tree has 0 leaves.
|
|
94
|
+
*/
|
|
95
|
+
getRootHash(): string;
|
|
96
|
+
/**
|
|
97
|
+
* Gets the number of leaves in the tree.
|
|
98
|
+
* @returns {number} The number of leaves.
|
|
99
|
+
*/
|
|
100
|
+
getLeafCount(): number;
|
|
101
|
+
/**
|
|
102
|
+
* Calculates the total number of items stored in the tree.
|
|
103
|
+
* @returns {number} The total number of items.
|
|
104
|
+
*/
|
|
105
|
+
getTotalItemCount(): number;
|
|
106
|
+
/**
|
|
107
|
+
* Retrieves all data items from a specific leaf.
|
|
108
|
+
* @param {number} leafIndex The index of the leaf.
|
|
109
|
+
* @returns {LeafDataItem[]} An array of LeafDataItem in the specified leaf, sorted by ID,
|
|
110
|
+
* or an empty array if the index is invalid or leaf is empty.
|
|
111
|
+
*/
|
|
112
|
+
getLeafData(leafIndex: number): LeafDataItem[];
|
|
113
|
+
/**
|
|
114
|
+
* Retrieves the version of a specific item by its id and type.
|
|
115
|
+
* @param {number} id The ID of the item.
|
|
116
|
+
* @param {ObjectType} type The type of the item.
|
|
117
|
+
* @returns {number | undefined} The version of the item if found, undefined otherwise.
|
|
118
|
+
*/
|
|
119
|
+
getItemVersion(id: number, type: ObjectType): number | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* Resizes the HashTree to have a new number of leaf nodes, redistributing all existing items.
|
|
122
|
+
* @param {number} newNumLeaves The new number of leaf nodes (must be 0 or a power of 2).
|
|
123
|
+
* @returns {boolean} true if the tree was resized, false if the size didn't change.
|
|
124
|
+
* @throws {Error} if newNumLeaves is not 0 or a power of 2.
|
|
125
|
+
*/
|
|
126
|
+
resize(newNumLeaves: number): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Compares the tree's leaf hashes with an external set of hashes and returns the indices of differing leaf nodes.
|
|
129
|
+
* The externalHashes array is expected to contain all node hashes (internal followed by leaves),
|
|
130
|
+
* similar to the output of getHashes().
|
|
131
|
+
* @param {string[]} externalHashes An array of hash strings (internal node hashes then leaf hashes).
|
|
132
|
+
* @returns {number[]} An array of indices of the leaf nodes that have different hashes.
|
|
133
|
+
*/
|
|
134
|
+
diffHashes(externalHashes: string[]): number[];
|
|
135
|
+
}
|
|
136
|
+
export default HashTree;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import HashTree from './hashTree';
|
|
1
2
|
import { Enum } from '../constants';
|
|
2
|
-
import { HtMeta } from './types';
|
|
3
|
+
import { HtMeta, HashTreeObject } from './types';
|
|
3
4
|
import { LocusDTO } from '../locus-info/types';
|
|
5
|
+
export declare enum SyncAllBackoffType {
|
|
6
|
+
NONE = "none",
|
|
7
|
+
ONLY_LLM = "onlyLLM",
|
|
8
|
+
ALL = "all"
|
|
9
|
+
}
|
|
4
10
|
export interface DataSet {
|
|
5
11
|
url: string;
|
|
6
12
|
root: string;
|
|
@@ -12,13 +18,11 @@ export interface DataSet {
|
|
|
12
18
|
maxMs: number;
|
|
13
19
|
exponent: number;
|
|
14
20
|
};
|
|
15
|
-
|
|
16
|
-
export interface HashTreeObject {
|
|
17
|
-
htMeta: HtMeta;
|
|
18
|
-
data: Record<string, any>;
|
|
21
|
+
heartbeatIntervalMs?: number;
|
|
19
22
|
}
|
|
20
23
|
export interface RootHashMessage {
|
|
21
24
|
dataSets: Array<DataSet>;
|
|
25
|
+
heartbeatIntervalMs?: number;
|
|
22
26
|
}
|
|
23
27
|
export interface HashTreeMessage {
|
|
24
28
|
dataSets: Array<DataSet>;
|
|
@@ -26,25 +30,56 @@ export interface HashTreeMessage {
|
|
|
26
30
|
locusStateElements?: Array<HashTreeObject>;
|
|
27
31
|
locusSessionId?: string;
|
|
28
32
|
locusUrl: string;
|
|
33
|
+
heartbeatIntervalMs?: number;
|
|
34
|
+
}
|
|
35
|
+
export interface VisibleDataSetInfo {
|
|
36
|
+
name: string;
|
|
37
|
+
url: string;
|
|
38
|
+
dataChannelUrl?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface Metadata {
|
|
41
|
+
htMeta: HtMeta;
|
|
42
|
+
visibleDataSets: VisibleDataSetInfo[];
|
|
29
43
|
}
|
|
30
44
|
interface InternalDataSet extends DataSet {
|
|
45
|
+
hashTree?: HashTree;
|
|
31
46
|
timer?: ReturnType<typeof setTimeout>;
|
|
47
|
+
heartbeatWatchdogTimer?: ReturnType<typeof setTimeout>;
|
|
48
|
+
syncAbortController?: AbortController;
|
|
32
49
|
}
|
|
33
50
|
type WebexRequestMethod = (options: Record<string, any>) => Promise<any>;
|
|
34
51
|
export declare const LocusInfoUpdateType: {
|
|
35
52
|
readonly OBJECTS_UPDATED: "OBJECTS_UPDATED";
|
|
36
53
|
readonly MEETING_ENDED: "MEETING_ENDED";
|
|
54
|
+
readonly LOCUS_NOT_FOUND: "LOCUS_NOT_FOUND";
|
|
37
55
|
};
|
|
38
56
|
export type LocusInfoUpdateType = Enum<typeof LocusInfoUpdateType>;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
57
|
+
interface LocusUpdatePayloads {
|
|
58
|
+
[LocusInfoUpdateType.OBJECTS_UPDATED]: {
|
|
59
|
+
updatedObjects: HashTreeObject[];
|
|
60
|
+
};
|
|
61
|
+
[LocusInfoUpdateType.MEETING_ENDED]: unknown;
|
|
62
|
+
[LocusInfoUpdateType.LOCUS_NOT_FOUND]: unknown;
|
|
63
|
+
}
|
|
64
|
+
export type LocusInfoUpdate = {
|
|
65
|
+
[K in keyof LocusUpdatePayloads]: {
|
|
66
|
+
updateType: K;
|
|
67
|
+
} & LocusUpdatePayloads[K];
|
|
68
|
+
}[keyof LocusUpdatePayloads];
|
|
69
|
+
export type LocusInfoUpdateCallback = (update: LocusInfoUpdate) => void;
|
|
42
70
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* @returns {boolean} True if the object is of type "self", false otherwise
|
|
71
|
+
* This error is thrown if we receive information that the meeting has ended while we're processing some hash messages.
|
|
72
|
+
* It's handled internally by HashTreeParser and results in MEETING_ENDED being sent up.
|
|
46
73
|
*/
|
|
47
|
-
export declare
|
|
74
|
+
export declare class MeetingEndedError extends Error {
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* This error is thrown when a 404 is received from Locus hash tree endpoints, indicating that the locus URL
|
|
78
|
+
* is no longer valid (e.g. participant moved to a breakout room, or meeting ended).
|
|
79
|
+
* It's handled internally by HashTreeParser and results in LOCUS_NOT_FOUND being sent up.
|
|
80
|
+
*/
|
|
81
|
+
export declare class LocusNotFoundError extends Error {
|
|
82
|
+
}
|
|
48
83
|
/**
|
|
49
84
|
* Parses hash tree eventing locus data
|
|
50
85
|
*/
|
|
@@ -53,8 +88,16 @@ declare class HashTreeParser {
|
|
|
53
88
|
visibleDataSetsUrl: string;
|
|
54
89
|
webexRequest: WebexRequestMethod;
|
|
55
90
|
locusInfoUpdateCallback: LocusInfoUpdateCallback;
|
|
56
|
-
visibleDataSets:
|
|
91
|
+
visibleDataSets: VisibleDataSetInfo[];
|
|
57
92
|
debugId: string;
|
|
93
|
+
private excludedDataSets;
|
|
94
|
+
state: 'active' | 'stopped';
|
|
95
|
+
private syncQueue;
|
|
96
|
+
private isSyncInProgress;
|
|
97
|
+
private syncAllBackoffType;
|
|
98
|
+
private dataSetsSyncedDuringBackoff;
|
|
99
|
+
private syncQueueProcessingPromise;
|
|
100
|
+
private topLevelHeartbeatIntervalMs?;
|
|
58
101
|
/**
|
|
59
102
|
* Constructor for HashTreeParser
|
|
60
103
|
* @param {Object} options
|
|
@@ -65,10 +108,55 @@ declare class HashTreeParser {
|
|
|
65
108
|
dataSets: Array<DataSet>;
|
|
66
109
|
locus: any;
|
|
67
110
|
};
|
|
111
|
+
metadata: Metadata | null;
|
|
68
112
|
webexRequest: WebexRequestMethod;
|
|
69
113
|
locusInfoUpdateCallback: LocusInfoUpdateCallback;
|
|
70
114
|
debugId: string;
|
|
115
|
+
excludedDataSets?: string[];
|
|
71
116
|
});
|
|
117
|
+
/**
|
|
118
|
+
* Sets the visible data sets list for the HashTreeParser. This method should be called only at the start, to initialize
|
|
119
|
+
* the visible data sets, before any message processsing, so for example from the constructor or when resuming the parser.
|
|
120
|
+
*
|
|
121
|
+
* @param {Array<VisibleDataSetInfo>} visibleDataSets - The visible data sets to set
|
|
122
|
+
* @param {Array<DataSet>} dataSets - The "dataSets" list from Locus (yes, Locus sends visibleDataSets and dataSets as separate lists and they can differ)
|
|
123
|
+
* @returns {void}
|
|
124
|
+
*/
|
|
125
|
+
private setVisibleDataSets;
|
|
126
|
+
/**
|
|
127
|
+
* Checks if the given data set name is in the list of visible data sets
|
|
128
|
+
* @param {string} dataSetName data set name to check
|
|
129
|
+
* @returns {Boolean} True if the data set is visible, false otherwise
|
|
130
|
+
*/
|
|
131
|
+
private isVisibleDataSet;
|
|
132
|
+
/**
|
|
133
|
+
* Checks if the given data set name is in the excluded list
|
|
134
|
+
* @param {string} dataSetName data set name to check
|
|
135
|
+
* @returns {boolean} True if the data set is excluded, false otherwise
|
|
136
|
+
*/
|
|
137
|
+
private isExcludedDataSet;
|
|
138
|
+
/**
|
|
139
|
+
* Adds a data set to the visible data sets list, unless it is in the excluded list.
|
|
140
|
+
* @param {VisibleDataSetInfo} dataSetInfo data set info to add
|
|
141
|
+
* @returns {boolean} True if the data set was added, false if it was excluded
|
|
142
|
+
*/
|
|
143
|
+
private addToVisibleDataSetsList;
|
|
144
|
+
/**
|
|
145
|
+
* Initializes a new visible data set by creating a hash tree for it, adding it to all the internal structures,
|
|
146
|
+
* and sending an initial sync request to Locus with empty leaf data - that will trigger Locus to gives us all the data
|
|
147
|
+
* from that dataset (in the response or via messages).
|
|
148
|
+
*
|
|
149
|
+
* @param {VisibleDataSetInfo} visibleDataSetInfo Information about the new visible data set
|
|
150
|
+
* @param {DataSet} dataSetInfo The new data set to be added
|
|
151
|
+
* @returns {Promise}
|
|
152
|
+
*/
|
|
153
|
+
private initializeNewVisibleDataSet;
|
|
154
|
+
/**
|
|
155
|
+
* Queries Locus for all up-to-date information about all visible data sets
|
|
156
|
+
*
|
|
157
|
+
* @returns {Promise}
|
|
158
|
+
*/
|
|
159
|
+
private getAllVisibleDataSetsFromLocus;
|
|
72
160
|
/**
|
|
73
161
|
* Initializes the hash tree parser from a message received from Locus.
|
|
74
162
|
*
|
|
@@ -86,6 +174,71 @@ declare class HashTreeParser {
|
|
|
86
174
|
* @returns {Promise}
|
|
87
175
|
*/
|
|
88
176
|
initializeFromGetLociResponse(locus: LocusDTO): Promise<void>;
|
|
177
|
+
/**
|
|
178
|
+
* Initializes data sets by doing an initialization sync on each visible data set that doesn't have a hash tree yet.
|
|
179
|
+
*
|
|
180
|
+
* @param {DataSet[]} visibleDataSets Array of visible DataSet objects to initialize
|
|
181
|
+
* @param {string} debugText Text to include in logs for debugging purposes
|
|
182
|
+
* @returns {Promise}
|
|
183
|
+
*/
|
|
184
|
+
private initializeDataSets;
|
|
185
|
+
/**
|
|
186
|
+
* Each dataset exists at a different place in the dto
|
|
187
|
+
* iterate recursively over the locus and if it has a htMeta key,
|
|
188
|
+
* create an object with the type, id and version and add it to the appropriate leafData array
|
|
189
|
+
*
|
|
190
|
+
* @param {any} locus - The current part of the locus being processed
|
|
191
|
+
* @param {Object} [options]
|
|
192
|
+
* @param {boolean} [options.copyData=false] - Whether to copy the data for each leaf into returned result
|
|
193
|
+
* @returns {any} - An object mapping dataset names to arrays of leaf data
|
|
194
|
+
*/
|
|
195
|
+
private analyzeLocusHtMeta;
|
|
196
|
+
/**
|
|
197
|
+
* Analyzes the Metadata object that is sent outside of Locus object, and appends its data to passed in leafInfo
|
|
198
|
+
* structure.
|
|
199
|
+
*
|
|
200
|
+
* @param {Record<string, LeafInfo[]>} leafInfo the structure to which the Metadata info will be appended
|
|
201
|
+
* @param {Metadata} metadata Metadata object
|
|
202
|
+
* @returns {void}
|
|
203
|
+
*/
|
|
204
|
+
private analyzeMetadata;
|
|
205
|
+
/**
|
|
206
|
+
* Checks if the provided hash tree message indicates the end of the meeting and that there won't be any more updates.
|
|
207
|
+
*
|
|
208
|
+
* @param {HashTreeMessage} message - The hash tree message to check
|
|
209
|
+
* @returns {boolean} - Returns true if the message indicates the end of the meeting, false otherwise
|
|
210
|
+
*/
|
|
211
|
+
private isEndMessage;
|
|
212
|
+
/**
|
|
213
|
+
* Handles the root hash heartbeat message
|
|
214
|
+
*
|
|
215
|
+
* @param {RootHashMessage} message - The root hash heartbeat message
|
|
216
|
+
* @returns {void}
|
|
217
|
+
*/
|
|
218
|
+
private handleRootHashHeartBeatMessage;
|
|
219
|
+
/**
|
|
220
|
+
* Handles known errors that can happen during syncs
|
|
221
|
+
*
|
|
222
|
+
* @param {any} error - The error to handle
|
|
223
|
+
* @returns {boolean} true if the error was recognized and handled, false otherwise
|
|
224
|
+
*/
|
|
225
|
+
private handleSyncErrors;
|
|
226
|
+
/**
|
|
227
|
+
* Asynchronously initializes new visible data sets
|
|
228
|
+
*
|
|
229
|
+
* @param {VisibleDataSetInfo[]} dataSetsRequiringInitialization list of datasets to initialize
|
|
230
|
+
* @returns {void}
|
|
231
|
+
*/
|
|
232
|
+
private queueInitForNewVisibleDataSets;
|
|
233
|
+
/**
|
|
234
|
+
* Handles updates to Metadata object that we receive from Locus via other means than messages. Right now
|
|
235
|
+
* that means only in the API response alongside locus object.
|
|
236
|
+
*
|
|
237
|
+
* @param {Metadata} metadata received in Locus update other than a message (for example in an API response)
|
|
238
|
+
* @param {HashTreeObject[]} updatedObjects a list of updated hash tree objects to which any updates resulting from new Metadata will be added
|
|
239
|
+
* @returns {void}
|
|
240
|
+
*/
|
|
241
|
+
handleMetadataUpdate(metadata: Metadata, updatedObjects: HashTreeObject[]): void;
|
|
89
242
|
/**
|
|
90
243
|
* This method should be called when we receive a partial locus DTO that contains dataSets and htMeta information
|
|
91
244
|
* It updates the hash trees with the new leaf data based on the received Locus
|
|
@@ -96,7 +249,67 @@ declare class HashTreeParser {
|
|
|
96
249
|
handleLocusUpdate(update: {
|
|
97
250
|
dataSets?: Array<DataSet>;
|
|
98
251
|
locus: any;
|
|
252
|
+
metadata?: Metadata;
|
|
99
253
|
}): void;
|
|
254
|
+
/**
|
|
255
|
+
* Updates the internal data set information based on the received data set from Locus.
|
|
256
|
+
*
|
|
257
|
+
* @param {DataSet} receivedDataSet - The latest data set information received from Locus to update the internal state.
|
|
258
|
+
* @returns {void}
|
|
259
|
+
*/
|
|
260
|
+
private updateDataSetInfo;
|
|
261
|
+
/**
|
|
262
|
+
* Updates the leaf count for a data set, resizing its hash tree accordingly.
|
|
263
|
+
*
|
|
264
|
+
* @param {InternalDataSet} dataSet - The data set to update
|
|
265
|
+
* @param {number} newLeafCount - The new leaf count
|
|
266
|
+
* @returns {void}
|
|
267
|
+
*/
|
|
268
|
+
private updateDataSetLeafCount;
|
|
269
|
+
/**
|
|
270
|
+
* Checks for changes in the visible data sets based on the updated objects.
|
|
271
|
+
* @param {HashTreeObject[]} updatedObjects - The list of updated hash tree objects.
|
|
272
|
+
* @returns {Object} An object containing the removed and added visible data sets.
|
|
273
|
+
*/
|
|
274
|
+
private checkForVisibleDataSetChanges;
|
|
275
|
+
/**
|
|
276
|
+
* Deletes the hash tree for the specified data set.
|
|
277
|
+
*
|
|
278
|
+
* @param {string} dataSetName name of the data set to delete
|
|
279
|
+
* @returns {void}
|
|
280
|
+
*/
|
|
281
|
+
private deleteHashTree;
|
|
282
|
+
/**
|
|
283
|
+
* Adds entries to the passed in updateObjects array
|
|
284
|
+
* for the changes that result from removing visible data sets and creates hash
|
|
285
|
+
* trees for the new visible data sets, but without populating the hash trees.
|
|
286
|
+
*
|
|
287
|
+
* This function is synchronous. If we are missing information about some new
|
|
288
|
+
* visible data sets and they require async initialization, the names of these data sets
|
|
289
|
+
* are returned in an array.
|
|
290
|
+
*
|
|
291
|
+
* @param {VisibleDataSetInfo[]} removedDataSets - The list of removed data sets.
|
|
292
|
+
* @param {VisibleDataSetInfo[]} addedDataSets - The list of added data sets.
|
|
293
|
+
* @param {HashTreeObject[]} updatedObjects - The list of updated hash tree objects to which changes will be added.
|
|
294
|
+
* @returns {VisibleDataSetInfo[]} list of data sets that couldn't be initialized synchronously
|
|
295
|
+
*/
|
|
296
|
+
private processVisibleDataSetChanges;
|
|
297
|
+
/**
|
|
298
|
+
* Adds entries to the passed in updateObjects array
|
|
299
|
+
* for the changes that result from adding and removing visible data sets.
|
|
300
|
+
*
|
|
301
|
+
* @param {VisibleDataSetInfo[]} addedDataSets - The list of added data sets.
|
|
302
|
+
* @returns {Promise<void>}
|
|
303
|
+
*/
|
|
304
|
+
private initializeNewVisibleDataSets;
|
|
305
|
+
/**
|
|
306
|
+
* Parses incoming hash tree messages, updates the hash trees and returns information about the changes
|
|
307
|
+
*
|
|
308
|
+
* @param {HashTreeMessage} message - The hash tree message containing data sets and objects to be processed
|
|
309
|
+
* @param {string} [debugText] - Optional debug text to include in logs
|
|
310
|
+
* @returns {HashTreeObject[]} list of hash tree objects that were updated as a result of processing the message
|
|
311
|
+
*/
|
|
312
|
+
private parseMessage;
|
|
100
313
|
/**
|
|
101
314
|
* Handles incoming hash tree messages, updates the hash trees and calls locusInfoUpdateCallback
|
|
102
315
|
*
|
|
@@ -104,6 +317,171 @@ declare class HashTreeParser {
|
|
|
104
317
|
* @param {string} [debugText] - Optional debug text to include in logs
|
|
105
318
|
* @returns {void}
|
|
106
319
|
*/
|
|
107
|
-
handleMessage(message: HashTreeMessage, debugText?: string):
|
|
320
|
+
handleMessage(message: HashTreeMessage, debugText?: string): void;
|
|
321
|
+
/**
|
|
322
|
+
* Calls the updateInfo callback if there are any updates to report
|
|
323
|
+
*
|
|
324
|
+
* @param {Object} updates parsed from a Locus message
|
|
325
|
+
* @returns {void}
|
|
326
|
+
*/
|
|
327
|
+
private callLocusInfoUpdateCallback;
|
|
328
|
+
/**
|
|
329
|
+
* Calculates a weighted backoff time that should be used for syncs
|
|
330
|
+
*
|
|
331
|
+
* @param {Object} backoff - The backoff configuration containing maxMs and exponent
|
|
332
|
+
* @returns {number} - A weighted backoff time based on the provided configuration, using algorithm supplied by Locus team
|
|
333
|
+
*/
|
|
334
|
+
private getWeightedBackoffTime;
|
|
335
|
+
/**
|
|
336
|
+
* Performs a sync for the given data set.
|
|
337
|
+
*
|
|
338
|
+
* @param {InternalDataSet} dataSet - The data set to sync
|
|
339
|
+
* @param {string} reason - The reason for the sync (used for logging)
|
|
340
|
+
* @param {boolean} [isInitialization] - Whether this is an initialization sync (sends empty leaves data instead of comparing hashes)
|
|
341
|
+
* @returns {Promise<void>}
|
|
342
|
+
*/
|
|
343
|
+
private performSync;
|
|
344
|
+
/**
|
|
345
|
+
* Cancels any pending or in-flight syncs for the specified data sets.
|
|
346
|
+
* This removes matching entries from the sync queue and aborts any in-flight sync HTTP requests.
|
|
347
|
+
*
|
|
348
|
+
* @param {string[]} dataSetNames - The names of the data sets to cancel syncs for
|
|
349
|
+
* @returns {void}
|
|
350
|
+
*/
|
|
351
|
+
private cancelPendingSyncsForDataSets;
|
|
352
|
+
/**
|
|
353
|
+
* If a syncAllDatasets backoff sleep is in progress, marks the given data sets to be skipped
|
|
354
|
+
* after the sleep completes.
|
|
355
|
+
*
|
|
356
|
+
* @param {string[]} dataSetNames - The names of the data sets to mark
|
|
357
|
+
* @returns {void}
|
|
358
|
+
*/
|
|
359
|
+
private markDataSetsForSyncAllBackoffSkip;
|
|
360
|
+
/**
|
|
361
|
+
* Aborts any in-flight sync HTTP requests for the specified data sets.
|
|
362
|
+
*
|
|
363
|
+
* @param {string[]} dataSetNames - The names of the data sets whose syncs should be aborted
|
|
364
|
+
* @returns {void}
|
|
365
|
+
*/
|
|
366
|
+
private abortInFlightSyncs;
|
|
367
|
+
/**
|
|
368
|
+
* Enqueues a sync for the given data set. If the data set is already in the queue, the request is ignored.
|
|
369
|
+
* This ensures that all syncs are executed sequentially and no more than 1 sync runs at a time.
|
|
370
|
+
*
|
|
371
|
+
* @param {string} dataSetName - The name of the data set to sync
|
|
372
|
+
* @param {string} reason - The reason for the sync (used for logging)
|
|
373
|
+
* @param {boolean} [isInitialization=false] - Whether this is an initialization sync (uses empty leaves data instead of hash comparison)
|
|
374
|
+
* @returns {void}
|
|
375
|
+
*/
|
|
376
|
+
private enqueueSyncForDataset;
|
|
377
|
+
/**
|
|
378
|
+
* Processes the sync queue sequentially. Only one instance of this method runs at a time.
|
|
379
|
+
*
|
|
380
|
+
* @returns {Promise<void>}
|
|
381
|
+
*/
|
|
382
|
+
private processSyncQueue;
|
|
383
|
+
/**
|
|
384
|
+
* sets the backoff type for syncAllDatasets calls, which determines the scope of datasets that will be synced after the backoff delay.
|
|
385
|
+
*
|
|
386
|
+
* @param {boolean} onlyLLM - Whether the backoff is for a syncAllDatasets call that is syncing only LLM datasets
|
|
387
|
+
* @returns {void}
|
|
388
|
+
*/
|
|
389
|
+
private setSyncAllBackoffType;
|
|
390
|
+
/**
|
|
391
|
+
* Checks if a syncAll backoff is already in progress. If so, upgrades the scope from
|
|
392
|
+
* onlyLLM to all datasets when the new call has a broader scope.
|
|
393
|
+
*
|
|
394
|
+
* @param {boolean} onlyLLM - Whether the current call is for LLM datasets only
|
|
395
|
+
* @returns {boolean} true if a backoff is already pending (caller should return early)
|
|
396
|
+
*/
|
|
397
|
+
private tryUpgradePendingBackoff;
|
|
398
|
+
/**
|
|
399
|
+
* Syncs all data sets that have hash trees, one by one in sequence, using the priority order
|
|
400
|
+
* provided by sortByInitPriority().
|
|
401
|
+
*
|
|
402
|
+
* If a call is already waiting in the backoff delay phase, a new call with a broader scope
|
|
403
|
+
* (onlyLLM=false) will upgrade the pending scope, and the dataset list will be computed after
|
|
404
|
+
* the backoff using the upgraded scope. After the backoff, the sync queue handles deduplication
|
|
405
|
+
* so no guard is needed.
|
|
406
|
+
*
|
|
407
|
+
* @param {Object} [options={}] - Options for syncing
|
|
408
|
+
* @param {boolean} [options.onlyLLM=false] - Whether to sync only LLM based data sets
|
|
409
|
+
* @returns {Promise<void>}
|
|
410
|
+
*/
|
|
411
|
+
syncAllDatasets(options?: {
|
|
412
|
+
onlyLLM?: boolean;
|
|
413
|
+
}): Promise<void>;
|
|
414
|
+
/**
|
|
415
|
+
* Returns the list of data sets that have hash trees, sorted by the priority order provided by sortByInitPriority().
|
|
416
|
+
*
|
|
417
|
+
* @param {boolean} onlyLLM - Whether to include only LLM based data sets
|
|
418
|
+
* @returns {Array<{name: string, backoff: {maxMs: number, exponent: number}}>} The sorted list of data sets with their backoff configurations
|
|
419
|
+
*/
|
|
420
|
+
private getSortedDataSetsWithHashTrees;
|
|
421
|
+
/**
|
|
422
|
+
* Runs the sync algorithm for the given data set.
|
|
423
|
+
*
|
|
424
|
+
* @param {DataSet} receivedDataSet - The data set to run the sync algorithm for.
|
|
425
|
+
* @returns {void}
|
|
426
|
+
*/
|
|
427
|
+
private runSyncAlgorithm;
|
|
428
|
+
/**
|
|
429
|
+
* Resets the heartbeat watchdog timers for the specified data sets. Each data set has its own
|
|
430
|
+
* watchdog timer that monitors whether heartbeats are being received within the expected interval.
|
|
431
|
+
* If a heartbeat is not received for a specific data set within heartbeatIntervalMs plus
|
|
432
|
+
* a backoff-calculated time, the sync algorithm is initiated for that data set
|
|
433
|
+
*
|
|
434
|
+
* @param {Array<DataSet>} receivedDataSets - The data sets from the received message for which watchdog timers should be reset
|
|
435
|
+
* @returns {void}
|
|
436
|
+
*/
|
|
437
|
+
private resetHeartbeatWatchdogs;
|
|
438
|
+
/**
|
|
439
|
+
* Stops all timers for the data sets to prevent any further sync attempts.
|
|
440
|
+
* @returns {void}
|
|
441
|
+
*/
|
|
442
|
+
private stopAllTimers;
|
|
443
|
+
/**
|
|
444
|
+
* Stops the HashTreeParser, preventing it from processing any further messages and clearing all timers.
|
|
445
|
+
* It also clears all the hash trees, so if the parser is resumed later, it will need to do a sync
|
|
446
|
+
* to be up-to-date.
|
|
447
|
+
* @returns {void}
|
|
448
|
+
*/
|
|
449
|
+
stop(): void;
|
|
450
|
+
/**
|
|
451
|
+
* Cleans up the HashTreeParser, stopping all timers and clearing all internal state.
|
|
452
|
+
* After calling this, the parser should not be used anymore.
|
|
453
|
+
* @returns {void}
|
|
454
|
+
*/
|
|
455
|
+
cleanUp(): void;
|
|
456
|
+
/**
|
|
457
|
+
* Resumes the HashTreeParser that was previously stopped, using a hash tree message.
|
|
458
|
+
* @param {HashTreeMessage} message - The message to resume with, it must contain metadata with visible data sets info
|
|
459
|
+
* @returns {void}
|
|
460
|
+
*/
|
|
461
|
+
resumeFromMessage(message: HashTreeMessage): void;
|
|
462
|
+
/**
|
|
463
|
+
* Resumes the HashTreeParser that was previously stopped, using a Locus API response.
|
|
464
|
+
* Unlike resumeFromMessage(), this does not require metadata/dataSets in the input,
|
|
465
|
+
* as it fetches all necessary information from Locus via initializeFromGetLociResponse.
|
|
466
|
+
* @param {LocusDTO} locus - locus object from an API response
|
|
467
|
+
* @returns {Promise}
|
|
468
|
+
*/
|
|
469
|
+
resumeFromApiResponse(locus: LocusDTO): Promise<void>;
|
|
470
|
+
private checkForSentinelHttpResponse;
|
|
471
|
+
/**
|
|
472
|
+
* Gets the current hashes from the locus for a specific data set.
|
|
473
|
+
* @param {string} dataSetName
|
|
474
|
+
* @param {string} currentRootHash
|
|
475
|
+
* @returns {Object|null} An object containing the hashes and leaf count, or null if the hashes match and no sync is needed
|
|
476
|
+
*/
|
|
477
|
+
private getHashesFromLocus;
|
|
478
|
+
/**
|
|
479
|
+
* Sends a sync request to Locus for the specified data set.
|
|
480
|
+
*
|
|
481
|
+
* @param {InternalDataSet} dataSet The data set to sync.
|
|
482
|
+
* @param {Object} options Either `{ isInitialization: true }` for init syncs (uses leafCount=1 with empty leaf data) or `{ mismatchedLeavesData }` for normal syncs.
|
|
483
|
+
* @returns {Promise<HashTreeMessage|null>}
|
|
484
|
+
*/
|
|
485
|
+
private sendSyncRequestToLocus;
|
|
108
486
|
}
|
|
109
487
|
export default HashTreeParser;
|