@webex/plugin-meetings 3.12.0-task-refactor.1 → 3.12.0-webex-services-ready.2
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 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_internalMediaCore","require","SendSlotManager","exports","default","LoggerProxy","_classCallCheck2","_defineProperty2","_map","_createClass2","key","value","createSlot","mediaConnection","mediaType","active","arguments","length","undefined","slots","has","Error","concat","slot","createSendSlot","set","logger","info","getSlot","get","setNamedMediaGroups","namedMediaGroups","MediaType","AudioMain","setSourceStateOverride","state","VideoMain","currentStateOverride","getSourceStateOverride","sourceStateOverrides","clearSourceStateOverride","delete","_publishStream","_asyncToGenerator2","_regenerator","mark","_callee","stream","wrap","_context","prev","next","publishStream","label","muted","stop","_x","_x2","apply","_unpublishStream","_callee2","_context2","unpublishStream","_x3","setActive","_setCodecParameters","_callee3","codecParameters","_context3","setCodecParameters","_x4","_x5","_deleteCodecParameters","_callee4","parameters","_context4","deleteCodecParameters","_x6","_x7","reset","clear"],"sources":["sendSlotManager.ts"],"sourcesContent":["import {\n SendSlot,\n MediaType,\n LocalStream,\n MultistreamRoapMediaConnection,\n NamedMediaGroup,\n StreamState,\n} from '@webex/internal-media-core';\n\n/**\n * This class is used to manage the sendSlots for the given media types.\n */\nexport default class SendSlotManager {\n private readonly slots: Map<MediaType, SendSlot> = new Map();\n private readonly LoggerProxy: any;\n private readonly sourceStateOverrides: Map<MediaType, StreamState> = new Map();\n\n /**\n * Constructor for SendSlotManager\n *\n * @param {any} LoggerProxy is used to log the messages\n * @constructor\n */\n constructor(LoggerProxy: any) {\n this.LoggerProxy = LoggerProxy;\n }\n\n /**\n * This method is used to create a sendSlot for the given mediaType and returns the created sendSlot\n * @param {MultistreamRoapMediaConnection} mediaConnection MultistreamRoapMediaConnection for which a sendSlot needs to be created\n * @param {MediaType} mediaType MediaType for which a sendSlot needs to be created (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {boolean} active This is optional boolean to set the active state of the sendSlot. Default is true\n * @returns {SendSlot} slot The created sendSlot\n */\n public createSlot(\n mediaConnection: MultistreamRoapMediaConnection,\n mediaType: MediaType,\n active = true\n ): SendSlot {\n if (this.slots.has(mediaType)) {\n throw new Error(`Slot for ${mediaType} already exists`);\n }\n\n const slot: SendSlot = mediaConnection.createSendSlot(mediaType, active);\n\n this.slots.set(mediaType, slot);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->createSlot#Created slot for ${mediaType} with active ${active}`\n );\n\n return slot;\n }\n\n /**\n * This method is used to retrieve the sendSlot for the given mediaType\n * @param {MediaType} mediaType of which the slot needs to be retrieved\n * @returns {SendSlot}\n */\n public getSlot(mediaType: MediaType): SendSlot {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n return slot;\n }\n\n /**\n * Allow users to specify 'namedMediaGroups' to indicate which named media group its audio should be sent to.\n * @param {MediaType} mediaType MediaType of the sendSlot to which the audio stream needs to be send to the media group\n * @param {[]}namedMediaGroups - Allow users to specify 'namedMediaGroups'.If the value of 'namedMediaGroups' is zero,\n * named media group will be canceled and the audio stream will be sent to the floor.\n * @returns {void}\n */\n public setNamedMediaGroups(mediaType: MediaType, namedMediaGroups: NamedMediaGroup[]) {\n if (mediaType !== MediaType.AudioMain) {\n throw new Error(\n `sendSlotManager cannot set named media group which media type is ${mediaType}`\n );\n }\n\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n slot.setNamedMediaGroups(namedMediaGroups);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->setNamedMediaGroups#set named media group ${namedMediaGroups}`\n );\n }\n\n /**\n * Sets the source state override for the given media type.\n * @param {MediaType} mediaType - The type of media (must be MediaType.VideoMain to apply source state changes).\n * @param {StreamState | null} state - The state to set or null to clear the override value.\n * @returns {void}\n */\n public setSourceStateOverride(mediaType: MediaType, state: StreamState | null) {\n if (mediaType !== MediaType.VideoMain) {\n throw new Error(\n `Invalid media type '${mediaType}'. Source state overrides are only applicable to ${MediaType.VideoMain}.`\n );\n }\n\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n const currentStateOverride = this.getSourceStateOverride(mediaType);\n if (currentStateOverride === state) {\n return;\n }\n\n if (state) {\n slot.setSourceStateOverride(state);\n this.sourceStateOverrides.set(mediaType, state);\n } else {\n slot.clearSourceStateOverride();\n this.sourceStateOverrides.delete(mediaType);\n }\n\n this.LoggerProxy.logger.info(\n `SendSlotManager->setSourceStateOverride#set source state override for ${mediaType} to ${state}`\n );\n }\n\n /**\n * Gets the source state override for the given media type.\n * @param {MediaType} mediaType - The type of media to get the source state override for.\n * @returns {StreamState | null} - The current source state override or null if not set.\n */\n private getSourceStateOverride(mediaType: MediaType): StreamState | null {\n if (mediaType !== MediaType.VideoMain) {\n throw new Error(\n `Invalid media type '${mediaType}'. Source state overrides are only applicable to ${MediaType.VideoMain}.`\n );\n }\n\n return this.sourceStateOverrides.get(mediaType) || null;\n }\n\n /**\n * This method publishes the given stream to the sendSlot for the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot to which a stream needs to be published (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {LocalStream} stream LocalStream to be published\n * @returns {Promise<void>}\n */\n public async publishStream(mediaType: MediaType, stream: LocalStream): Promise<void> {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.publishStream(stream);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->publishStream#Published stream for ${mediaType} and stream with label ${stream.label} and muted ${stream.muted}`\n );\n }\n\n /**\n * This method unpublishes the stream from the sendSlot of the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot from which a stream needs to be unpublished (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @returns {Promise<void>}\n */\n public async unpublishStream(mediaType: MediaType): Promise<void> {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.unpublishStream();\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->unpublishStream#Unpublished stream for ${mediaType}`\n );\n }\n\n /**\n * This method is used to set the active state of the sendSlot for the given mediaType\n * @param {MediaType} mediaType The MediaType of the sendSlot for which the active state needs to be set (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {boolean} active The boolean to set the active state of the sendSlot. Default is true\n * @returns {void}\n */\n public setActive(mediaType: MediaType, active = true): void {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n slot.active = active;\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->setActive#Set active for ${mediaType} to ${active}`\n );\n }\n\n /**\n * This method is used to set the codec parameters for the sendSlot of the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot for which the codec parameters needs to be set (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {Object} codecParameters\n * @returns {Promise<void>}\n */\n public async setCodecParameters(\n mediaType: MediaType,\n codecParameters: {\n [key: string]: string | undefined; // As per ts-sdp undefined is considered as a valid value to be used for codec parameters\n }\n ): Promise<void> {\n // These codec parameter changes underneath are SDP value changes that are taken care by WCME automatically. So no need for any change in streams from the web sdk side\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.setCodecParameters(codecParameters);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->setCodecParameters#Set codec parameters for ${mediaType} to ${codecParameters}`\n );\n }\n\n /**\n * This method is used to delete the codec parameters for the sendSlot of the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot for which the codec parameters needs to be deleted (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {Array<String>} parameters Array of keys of the codec parameters to be deleted\n * @returns {Promise<void>}\n */\n public async deleteCodecParameters(mediaType: MediaType, parameters: string[]): Promise<void> {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.deleteCodecParameters(parameters);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->deleteCodecParameters#Deleted the following codec parameters -> ${parameters} for ${mediaType}`\n );\n }\n\n /**\n * This method is used to reset the SendSlotsManager by deleting all the sendSlots\n * @returns {undefined}\n */\n public reset(): void {\n this.slots.clear();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AASA;AACA;AACA;AAFA,IAGqBC,eAAe,GAAAC,OAAA,CAAAC,OAAA;EAKlC;AACF;AACA;AACA;AACA;AACA;EACE,SAAAF,gBAAYG,WAAgB,EAAE;IAAA,IAAAC,gBAAA,CAAAF,OAAA,QAAAF,eAAA;IAAA,IAAAK,gBAAA,CAAAH,OAAA,iBAVqB,IAAAI,IAAA,CAAAJ,OAAA,CAAQ,CAAC;IAAA,IAAAG,gBAAA,CAAAH,OAAA;IAAA,IAAAG,gBAAA,CAAAH,OAAA,gCAES,IAAAI,IAAA,CAAAJ,OAAA,CAAQ,CAAC;IAS5E,IAAI,CAACC,WAAW,GAAGA,WAAW;EAChC;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EANE,WAAAI,aAAA,CAAAL,OAAA,EAAAF,eAAA;IAAAQ,GAAA;IAAAC,KAAA,EAOA,SAAOC,UAAUA,CACfC,eAA+C,EAC/CC,SAAoB,EAEV;MAAA,IADVC,MAAM,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SA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lotManager","exports","default","LoggerProxy","_classCallCheck2","_defineProperty2","_map","_createClass2","key","value","createSlot","mediaConnection","mediaType","active","arguments","length","undefined","slots","has","Error","concat","slot","createSendSlot","set","logger","info","getSlot","get","setNamedMediaGroups","namedMediaGroups","MediaType","AudioMain","setSourceStateOverride","state","VideoMain","currentStateOverride","getSourceStateOverride","sourceStateOverrides","clearSourceStateOverride","delete","_publishStream","_asyncToGenerator2","_regenerator","mark","_callee","stream","wrap","_context","prev","next","publishStream","label","muted","stop","_x","_x2","apply","_unpublishStream","_callee2","_context2","unpublishStream","_x3","setActive","_setCodecParameters","_callee3","codecParameters","_context3","setCodecParameters","warn","Metrics","sendBehavioralMetric","BEHAVIORAL_METRICS","DEPRECATED_SET_CODEC_PARAMETERS_USED","_x4","_x5","_deleteCodecParameters","_callee4","parameters","_context4","deleteCodecParameters","DEPRECATED_DELETE_CODEC_PARAMETERS_USED","_x6","_x7","_setCustomCodecParameters","_callee5","codecMimeType","_t","_context5","setCustomCodecParameters","_stringify","error","SET_CUSTOM_CODEC_PARAMETERS_USED","finish","_x8","_x9","_x0","_markCustomCodecParametersForDeletion","_callee6","_context6","markCustomCodecParametersForDeletion","MARK_CUSTOM_CODEC_PARAMETERS_FOR_DELETION_USED","_x1","_x10","_x11","reset","clear"],"sources":["sendSlotManager.ts"],"sourcesContent":["import {\n SendSlot,\n MediaType,\n LocalStream,\n MultistreamRoapMediaConnection,\n NamedMediaGroup,\n StreamState,\n MediaCodecMimeType,\n CodecParameters,\n} from '@webex/internal-media-core';\nimport Metrics from '../metrics';\nimport BEHAVIORAL_METRICS from '../metrics/constants';\n\n/**\n * This class is used to manage the sendSlots for the given media types.\n */\nexport default class SendSlotManager {\n private readonly slots: Map<MediaType, SendSlot> = new Map();\n private readonly LoggerProxy: any;\n private readonly sourceStateOverrides: Map<MediaType, StreamState> = new Map();\n\n /**\n * Constructor for SendSlotManager\n *\n * @param {any} LoggerProxy is used to log the messages\n * @constructor\n */\n constructor(LoggerProxy: any) {\n this.LoggerProxy = LoggerProxy;\n }\n\n /**\n * This method is used to create a sendSlot for the given mediaType and returns the created sendSlot\n * @param {MultistreamRoapMediaConnection} mediaConnection MultistreamRoapMediaConnection for which a sendSlot needs to be created\n * @param {MediaType} mediaType MediaType for which a sendSlot needs to be created (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {boolean} active This is optional boolean to set the active state of the sendSlot. Default is true\n * @returns {SendSlot} slot The created sendSlot\n */\n public createSlot(\n mediaConnection: MultistreamRoapMediaConnection,\n mediaType: MediaType,\n active = true\n ): SendSlot {\n if (this.slots.has(mediaType)) {\n throw new Error(`Slot for ${mediaType} already exists`);\n }\n\n const slot: SendSlot = mediaConnection.createSendSlot(mediaType, active);\n\n this.slots.set(mediaType, slot);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->createSlot#Created slot for ${mediaType} with active ${active}`\n );\n\n return slot;\n }\n\n /**\n * This method is used to retrieve the sendSlot for the given mediaType\n * @param {MediaType} mediaType of which the slot needs to be retrieved\n * @returns {SendSlot}\n */\n public getSlot(mediaType: MediaType): SendSlot {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n return slot;\n }\n\n /**\n * Allow users to specify 'namedMediaGroups' to indicate which named media group its audio should be sent to.\n * @param {MediaType} mediaType MediaType of the sendSlot to which the audio stream needs to be send to the media group\n * @param {[]}namedMediaGroups - Allow users to specify 'namedMediaGroups'.If the value of 'namedMediaGroups' is zero,\n * named media group will be canceled and the audio stream will be sent to the floor.\n * @returns {void}\n */\n public setNamedMediaGroups(mediaType: MediaType, namedMediaGroups: NamedMediaGroup[]) {\n if (mediaType !== MediaType.AudioMain) {\n throw new Error(\n `sendSlotManager cannot set named media group which media type is ${mediaType}`\n );\n }\n\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n slot.setNamedMediaGroups(namedMediaGroups);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->setNamedMediaGroups#set named media group ${namedMediaGroups}`\n );\n }\n\n /**\n * Sets the source state override for the given media type.\n * @param {MediaType} mediaType - The type of media (must be MediaType.VideoMain to apply source state changes).\n * @param {StreamState | null} state - The state to set or null to clear the override value.\n * @returns {void}\n */\n public setSourceStateOverride(mediaType: MediaType, state: StreamState | null) {\n if (mediaType !== MediaType.VideoMain) {\n throw new Error(\n `Invalid media type '${mediaType}'. Source state overrides are only applicable to ${MediaType.VideoMain}.`\n );\n }\n\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n const currentStateOverride = this.getSourceStateOverride(mediaType);\n if (currentStateOverride === state) {\n return;\n }\n\n if (state) {\n slot.setSourceStateOverride(state);\n this.sourceStateOverrides.set(mediaType, state);\n } else {\n slot.clearSourceStateOverride();\n this.sourceStateOverrides.delete(mediaType);\n }\n\n this.LoggerProxy.logger.info(\n `SendSlotManager->setSourceStateOverride#set source state override for ${mediaType} to ${state}`\n );\n }\n\n /**\n * Gets the source state override for the given media type.\n * @param {MediaType} mediaType - The type of media to get the source state override for.\n * @returns {StreamState | null} - The current source state override or null if not set.\n */\n private getSourceStateOverride(mediaType: MediaType): StreamState | null {\n if (mediaType !== MediaType.VideoMain) {\n throw new Error(\n `Invalid media type '${mediaType}'. Source state overrides are only applicable to ${MediaType.VideoMain}.`\n );\n }\n\n return this.sourceStateOverrides.get(mediaType) || null;\n }\n\n /**\n * This method publishes the given stream to the sendSlot for the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot to which a stream needs to be published (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {LocalStream} stream LocalStream to be published\n * @returns {Promise<void>}\n */\n public async publishStream(mediaType: MediaType, stream: LocalStream): Promise<void> {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.publishStream(stream);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->publishStream#Published stream for ${mediaType} and stream with label ${stream.label} and muted ${stream.muted}`\n );\n }\n\n /**\n * This method unpublishes the stream from the sendSlot of the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot from which a stream needs to be unpublished (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @returns {Promise<void>}\n */\n public async unpublishStream(mediaType: MediaType): Promise<void> {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.unpublishStream();\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->unpublishStream#Unpublished stream for ${mediaType}`\n );\n }\n\n /**\n * This method is used to set the active state of the sendSlot for the given mediaType\n * @param {MediaType} mediaType The MediaType of the sendSlot for which the active state needs to be set (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {boolean} active The boolean to set the active state of the sendSlot. Default is true\n * @returns {void}\n */\n public setActive(mediaType: MediaType, active = true): void {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n slot.active = active;\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->setActive#Set active for ${mediaType} to ${active}`\n );\n }\n\n /**\n * @deprecated Use {@link setCustomCodecParameters} instead, which requires specifying the codec MIME type.\n *\n * This method is used to set the codec parameters for the sendSlot of the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot for which the codec parameters needs to be set (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {Object} codecParameters\n * @returns {Promise<void>}\n */\n public async setCodecParameters(\n mediaType: MediaType,\n codecParameters: {\n [key: string]: string | undefined; // As per ts-sdp undefined is considered as a valid value to be used for codec parameters\n }\n ): Promise<void> {\n // These codec parameter changes underneath are SDP value changes that are taken care by WCME automatically. So no need for any change in streams from the web sdk side\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.setCodecParameters(codecParameters);\n\n this.LoggerProxy.logger.warn(\n 'SendSlotsManager->setCodecParameters --> [DEPRECATION WARNING]: setCodecParameters has been deprecated, use setCustomCodecParameters instead'\n );\n\n Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DEPRECATED_SET_CODEC_PARAMETERS_USED, {\n mediaType,\n codecParameters,\n });\n }\n\n /**\n * @deprecated Use {@link markCustomCodecParametersForDeletion} instead, which requires specifying the codec MIME type.\n *\n * This method is used to delete the codec parameters for the sendSlot of the given mediaType\n * @param {MediaType} mediaType MediaType of the sendSlot for which the codec parameters needs to be deleted (AUDIO_MAIN/VIDEO_MAIN/AUDIO_SLIDES/VIDEO_SLIDES)\n * @param {Array<String>} parameters Array of keys of the codec parameters to be deleted\n * @returns {Promise<void>}\n */\n public async deleteCodecParameters(mediaType: MediaType, parameters: string[]): Promise<void> {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.deleteCodecParameters(parameters);\n\n this.LoggerProxy.logger.warn(\n 'SendSlotsManager->deleteCodecParameters --> [DEPRECATION WARNING]: deleteCodecParameters has been deprecated, use markCustomCodecParametersForDeletion instead'\n );\n\n Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.DEPRECATED_DELETE_CODEC_PARAMETERS_USED, {\n mediaType,\n parameters,\n });\n }\n\n /**\n * Sets custom codec parameters for the sendSlot of the given mediaType, scoped to a specific codec MIME type.\n * Delegates to WCME's setCustomCodecParameters API.\n * @param {MediaType} mediaType MediaType of the sendSlot\n * @param {MediaCodecMimeType} codecMimeType The codec MIME type to apply parameters to (e.g. OPUS, H264, AV1)\n * @param {CodecParameters} parameters Key-value pairs of codec parameters to set\n * @returns {Promise<void>}\n */\n public async setCustomCodecParameters(\n mediaType: MediaType,\n codecMimeType: MediaCodecMimeType,\n parameters: CodecParameters\n ): Promise<void> {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n try {\n await slot.setCustomCodecParameters(codecMimeType, parameters);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->setCustomCodecParameters#Set custom codec parameters for ${mediaType} (codec: ${codecMimeType}) to ${JSON.stringify(\n parameters\n )}`\n );\n } catch (error) {\n this.LoggerProxy.logger.error(\n `SendSlotsManager->setCustomCodecParameters#Failed to set custom codec parameters for ${mediaType} (codec: ${codecMimeType}): ${error}`\n );\n throw error;\n } finally {\n Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.SET_CUSTOM_CODEC_PARAMETERS_USED, {\n mediaType,\n codecMimeType,\n parameters,\n });\n }\n }\n\n /**\n * Marks custom codec parameters for deletion on the sendSlot of the given mediaType, scoped to a specific codec MIME type.\n * Delegates to WCME's markCustomCodecParametersForDeletion API.\n * @param {MediaType} mediaType MediaType of the sendSlot\n * @param {MediaCodecMimeType} codecMimeType The codec MIME type whose parameters should be deleted (e.g. OPUS, H264, AV1)\n * @param {string[]} parameters Array of parameter keys to delete\n * @returns {Promise<void>}\n */\n public async markCustomCodecParametersForDeletion(\n mediaType: MediaType,\n codecMimeType: MediaCodecMimeType,\n parameters: string[]\n ): Promise<void> {\n const slot = this.slots.get(mediaType);\n\n if (!slot) {\n throw new Error(`Slot for ${mediaType} does not exist`);\n }\n\n await slot.markCustomCodecParametersForDeletion(codecMimeType, parameters);\n\n this.LoggerProxy.logger.info(\n `SendSlotsManager->markCustomCodecParametersForDeletion#Marked codec parameters for deletion -> ${parameters} for ${mediaType} (codec: ${codecMimeType})`\n );\n\n Metrics.sendBehavioralMetric(\n BEHAVIORAL_METRICS.MARK_CUSTOM_CODEC_PARAMETERS_FOR_DELETION_USED,\n {\n mediaType,\n codecMimeType,\n parameters,\n }\n );\n }\n\n /**\n * This method is used to reset the SendSlotsManager by deleting all the sendSlots\n * @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BjD;AACF;AACA;AACA;IAHE;EAAA;IAAA3F,GAAA;IAAAC,KAAA,EAIA,SAAO+F,KAAKA,CAAA,EAAS;MACnB,IAAI,CAACvF,KAAK,CAACwF,KAAK,CAAC,CAAC;IACpB;EAAC;AAAA","ignoreList":[]}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
|
|
4
|
+
var _Array$from = require("@babel/runtime-corejs2/core-js/array/from");
|
|
5
|
+
var _Symbol = require("@babel/runtime-corejs2/core-js/symbol");
|
|
6
|
+
var _Symbol$iterator = require("@babel/runtime-corejs2/core-js/symbol/iterator");
|
|
7
|
+
var _Array$isArray = require("@babel/runtime-corejs2/core-js/array/is-array");
|
|
4
8
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
5
9
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
10
|
_Object$defineProperty(exports, "__esModule", {
|
|
@@ -9,6 +13,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
9
13
|
exports.Events = exports.ClusterReachability = void 0;
|
|
10
14
|
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
11
15
|
var _set = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/set"));
|
|
16
|
+
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
12
17
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
13
18
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
14
19
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
@@ -17,8 +22,12 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/he
|
|
|
17
22
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
|
|
18
23
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
19
24
|
var _eventsScope = _interopRequireDefault(require("../common/events/events-scope"));
|
|
25
|
+
var _loggerProxy = _interopRequireDefault(require("../common/logs/logger-proxy"));
|
|
20
26
|
var _reachability = require("./reachability.types");
|
|
21
27
|
var _reachabilityPeerConnection = require("./reachabilityPeerConnection");
|
|
28
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof _Symbol && r[_Symbol$iterator] || r["@@iterator"]; if (!t) { if (_Array$isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
29
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? _Array$from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
30
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
22
31
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
23
32
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
24
33
|
// data for the Events.resultReady event
|
|
@@ -34,71 +43,203 @@ var Events = exports.Events = {
|
|
|
34
43
|
};
|
|
35
44
|
/**
|
|
36
45
|
* A class that handles reachability checks for a single cluster.
|
|
37
|
-
* Creates and orchestrates
|
|
46
|
+
* Creates and orchestrates ReachabilityPeerConnection instance(s).
|
|
38
47
|
* Listens to events and emits them to consumers.
|
|
48
|
+
*
|
|
49
|
+
* When enablePerUdpUrlReachability is true:
|
|
50
|
+
* - Creates one ReachabilityPeerConnection for each UDP URL
|
|
51
|
+
* - Creates one ReachabilityPeerConnection for all TCP and TLS URLs together
|
|
52
|
+
* Otherwise:
|
|
53
|
+
* - Creates a single ReachabilityPeerConnection for all URLs
|
|
39
54
|
*/
|
|
40
55
|
var ClusterReachability = exports.ClusterReachability = /*#__PURE__*/function (_EventsScope) {
|
|
41
56
|
/**
|
|
42
57
|
* Constructor for ClusterReachability
|
|
43
58
|
* @param {string} name cluster name
|
|
44
59
|
* @param {ClusterNode} clusterInfo information about the media cluster
|
|
60
|
+
* @param {boolean} enablePerUdpUrlReachability whether to create separate peer connections per UDP URL
|
|
45
61
|
*/
|
|
46
62
|
function ClusterReachability(name, clusterInfo) {
|
|
47
63
|
var _this;
|
|
64
|
+
var enablePerUdpUrlReachability = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
48
65
|
(0, _classCallCheck2.default)(this, ClusterReachability);
|
|
49
66
|
_this = _callSuper(this, ClusterReachability);
|
|
50
|
-
(0, _defineProperty2.default)(_this, "reachabilityPeerConnection",
|
|
67
|
+
(0, _defineProperty2.default)(_this, "reachabilityPeerConnection", null);
|
|
68
|
+
(0, _defineProperty2.default)(_this, "reachabilityPeerConnectionsForUdp", []);
|
|
51
69
|
(0, _defineProperty2.default)(_this, "isVideoMesh", void 0);
|
|
52
70
|
(0, _defineProperty2.default)(_this, "name", void 0);
|
|
53
71
|
(0, _defineProperty2.default)(_this, "reachedSubnets", new _set.default());
|
|
72
|
+
(0, _defineProperty2.default)(_this, "enablePerUdpUrlReachability", void 0);
|
|
73
|
+
(0, _defineProperty2.default)(_this, "udpResultEmitted", false);
|
|
54
74
|
_this.name = name;
|
|
55
75
|
_this.isVideoMesh = clusterInfo.isVideoMesh;
|
|
56
|
-
_this.
|
|
57
|
-
_this.
|
|
76
|
+
_this.enablePerUdpUrlReachability = enablePerUdpUrlReachability;
|
|
77
|
+
if (_this.enablePerUdpUrlReachability) {
|
|
78
|
+
_this.initializePerUdpUrlReachabilityCheck(clusterInfo);
|
|
79
|
+
} else {
|
|
80
|
+
_this.initializeSingleReachabilityPeerConnection(clusterInfo);
|
|
81
|
+
}
|
|
58
82
|
return _this;
|
|
59
83
|
}
|
|
60
84
|
|
|
61
85
|
/**
|
|
62
|
-
*
|
|
86
|
+
* Initializes a single ReachabilityPeerConnection for all protocols
|
|
87
|
+
* @param {ClusterNode} clusterInfo information about the media cluster
|
|
63
88
|
* @returns {void}
|
|
64
89
|
*/
|
|
65
90
|
(0, _inherits2.default)(ClusterReachability, _EventsScope);
|
|
66
91
|
return (0, _createClass2.default)(ClusterReachability, [{
|
|
67
|
-
key: "
|
|
68
|
-
value: function
|
|
92
|
+
key: "initializeSingleReachabilityPeerConnection",
|
|
93
|
+
value: function initializeSingleReachabilityPeerConnection(clusterInfo) {
|
|
94
|
+
this.reachabilityPeerConnection = new _reachabilityPeerConnection.ReachabilityPeerConnection(this.name, clusterInfo);
|
|
95
|
+
this.setupReachabilityPeerConnectionEventListeners(this.reachabilityPeerConnection);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Initializes per-URL UDP reachability checks:
|
|
100
|
+
* - One ReachabilityPeerConnection per UDP URL
|
|
101
|
+
* - One ReachabilityPeerConnection for all TCP and TLS URLs together
|
|
102
|
+
* @param {ClusterNode} clusterInfo information about the media cluster
|
|
103
|
+
* @returns {void}
|
|
104
|
+
*/
|
|
105
|
+
}, {
|
|
106
|
+
key: "initializePerUdpUrlReachabilityCheck",
|
|
107
|
+
value: function initializePerUdpUrlReachabilityCheck(clusterInfo) {
|
|
69
108
|
var _this2 = this;
|
|
70
|
-
this.
|
|
71
|
-
|
|
109
|
+
_loggerProxy.default.logger.log("ClusterReachability#initializePerUdpUrlReachabilityCheck --> cluster: ".concat(this.name, ", performing per-URL UDP reachability for ").concat(clusterInfo.udp.length, " URLs"));
|
|
110
|
+
|
|
111
|
+
// Create one ReachabilityPeerConnection for each UDP URL
|
|
112
|
+
clusterInfo.udp.forEach(function (udpUrl) {
|
|
113
|
+
var singleUdpClusterInfo = {
|
|
114
|
+
isVideoMesh: clusterInfo.isVideoMesh,
|
|
115
|
+
udp: [udpUrl],
|
|
116
|
+
tcp: [],
|
|
117
|
+
xtls: []
|
|
118
|
+
};
|
|
119
|
+
var rpc = new _reachabilityPeerConnection.ReachabilityPeerConnection(_this2.name, singleUdpClusterInfo);
|
|
120
|
+
_this2.setupReachabilityPeerConnectionEventListeners(rpc, true);
|
|
121
|
+
_this2.reachabilityPeerConnectionsForUdp.push(rpc);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// Create one ReachabilityPeerConnection for all TCP and TLS URLs together
|
|
125
|
+
if (clusterInfo.tcp.length > 0 || clusterInfo.xtls.length > 0) {
|
|
126
|
+
var tcpTlsClusterInfo = {
|
|
127
|
+
isVideoMesh: clusterInfo.isVideoMesh,
|
|
128
|
+
udp: [],
|
|
129
|
+
tcp: clusterInfo.tcp,
|
|
130
|
+
xtls: clusterInfo.xtls
|
|
131
|
+
};
|
|
132
|
+
this.reachabilityPeerConnection = new _reachabilityPeerConnection.ReachabilityPeerConnection(this.name, tcpTlsClusterInfo);
|
|
133
|
+
this.setupReachabilityPeerConnectionEventListeners(this.reachabilityPeerConnection);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Sets up event listeners for a ReachabilityPeerConnection instance
|
|
139
|
+
* @param {ReachabilityPeerConnection} rpc the ReachabilityPeerConnection instance
|
|
140
|
+
* @param {boolean} isUdpPerUrl whether this is a per-URL UDP instance
|
|
141
|
+
* @returns {void}
|
|
142
|
+
*/
|
|
143
|
+
}, {
|
|
144
|
+
key: "setupReachabilityPeerConnectionEventListeners",
|
|
145
|
+
value: function setupReachabilityPeerConnectionEventListeners(rpc) {
|
|
146
|
+
var _this3 = this;
|
|
147
|
+
var isUdpPerUrl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
148
|
+
rpc.on(_reachability.ReachabilityPeerConnectionEvents.resultReady, function (data) {
|
|
149
|
+
// For per-URL UDP checks, only emit the first successful UDP result
|
|
150
|
+
if (isUdpPerUrl && data.protocol === 'udp') {
|
|
151
|
+
if (_this3.udpResultEmitted) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (data.result === 'reachable') {
|
|
155
|
+
_this3.udpResultEmitted = true;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
_this3.emit({
|
|
72
159
|
file: 'clusterReachability',
|
|
73
160
|
function: 'setupReachabilityPeerConnectionEventListeners'
|
|
74
161
|
}, Events.resultReady, data);
|
|
75
162
|
});
|
|
76
|
-
|
|
77
|
-
|
|
163
|
+
rpc.on(_reachability.ReachabilityPeerConnectionEvents.clientMediaIpsUpdated, function (data) {
|
|
164
|
+
_this3.emit({
|
|
78
165
|
file: 'clusterReachability',
|
|
79
166
|
function: 'setupReachabilityPeerConnectionEventListeners'
|
|
80
167
|
}, Events.clientMediaIpsUpdated, data);
|
|
81
168
|
});
|
|
82
|
-
|
|
83
|
-
|
|
169
|
+
rpc.on(_reachability.ReachabilityPeerConnectionEvents.natTypeUpdated, function (data) {
|
|
170
|
+
_this3.emit({
|
|
84
171
|
file: 'clusterReachability',
|
|
85
172
|
function: 'setupReachabilityPeerConnectionEventListeners'
|
|
86
173
|
}, Events.natTypeUpdated, data);
|
|
87
174
|
});
|
|
88
|
-
|
|
175
|
+
rpc.on(_reachability.ReachabilityPeerConnectionEvents.reachedSubnets, function (data) {
|
|
89
176
|
data.subnets.forEach(function (subnet) {
|
|
90
|
-
|
|
177
|
+
_this3.reachedSubnets.add(subnet);
|
|
91
178
|
});
|
|
92
179
|
});
|
|
93
180
|
}
|
|
94
181
|
|
|
95
182
|
/**
|
|
183
|
+
* Gets the aggregated reachability result for this cluster.
|
|
96
184
|
* @returns {ClusterReachabilityResult} reachability result for this cluster
|
|
97
185
|
*/
|
|
98
186
|
}, {
|
|
99
187
|
key: "getResult",
|
|
100
188
|
value: function getResult() {
|
|
101
|
-
|
|
189
|
+
if (!this.enablePerUdpUrlReachability) {
|
|
190
|
+
var _this$reachabilityPee, _this$reachabilityPee2;
|
|
191
|
+
return (_this$reachabilityPee = (_this$reachabilityPee2 = this.reachabilityPeerConnection) === null || _this$reachabilityPee2 === void 0 ? void 0 : _this$reachabilityPee2.getResult()) !== null && _this$reachabilityPee !== void 0 ? _this$reachabilityPee : {
|
|
192
|
+
udp: {
|
|
193
|
+
result: 'untested'
|
|
194
|
+
},
|
|
195
|
+
tcp: {
|
|
196
|
+
result: 'untested'
|
|
197
|
+
},
|
|
198
|
+
xtls: {
|
|
199
|
+
result: 'untested'
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
var result = {
|
|
204
|
+
udp: {
|
|
205
|
+
result: 'untested'
|
|
206
|
+
},
|
|
207
|
+
tcp: {
|
|
208
|
+
result: 'untested'
|
|
209
|
+
},
|
|
210
|
+
xtls: {
|
|
211
|
+
result: 'untested'
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
// Get the first reachable UDP result from per-URL instances
|
|
216
|
+
var _iterator = _createForOfIteratorHelper(this.reachabilityPeerConnectionsForUdp),
|
|
217
|
+
_step;
|
|
218
|
+
try {
|
|
219
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
220
|
+
var rpc = _step.value;
|
|
221
|
+
var rpcResult = rpc.getResult();
|
|
222
|
+
if (rpcResult.udp.result === 'reachable') {
|
|
223
|
+
result.udp = rpcResult.udp;
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
if (rpcResult.udp.result === 'unreachable' && result.udp.result === 'untested') {
|
|
227
|
+
result.udp = rpcResult.udp;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Get TCP and TLS results from the main peer connection
|
|
232
|
+
} catch (err) {
|
|
233
|
+
_iterator.e(err);
|
|
234
|
+
} finally {
|
|
235
|
+
_iterator.f();
|
|
236
|
+
}
|
|
237
|
+
if (this.reachabilityPeerConnection) {
|
|
238
|
+
var mainResult = this.reachabilityPeerConnection.getResult();
|
|
239
|
+
result.tcp = mainResult.tcp;
|
|
240
|
+
result.xtls = mainResult.xtls;
|
|
241
|
+
}
|
|
242
|
+
return result;
|
|
102
243
|
}
|
|
103
244
|
|
|
104
245
|
/**
|
|
@@ -109,11 +250,19 @@ var ClusterReachability = exports.ClusterReachability = /*#__PURE__*/function (_
|
|
|
109
250
|
key: "start",
|
|
110
251
|
value: (function () {
|
|
111
252
|
var _start = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
253
|
+
var startPromises;
|
|
112
254
|
return _regenerator.default.wrap(function (_context) {
|
|
113
255
|
while (1) switch (_context.prev = _context.next) {
|
|
114
256
|
case 0:
|
|
257
|
+
startPromises = [];
|
|
258
|
+
this.reachabilityPeerConnectionsForUdp.forEach(function (rpc) {
|
|
259
|
+
startPromises.push(rpc.start());
|
|
260
|
+
});
|
|
261
|
+
if (this.reachabilityPeerConnection) {
|
|
262
|
+
startPromises.push(this.reachabilityPeerConnection.start());
|
|
263
|
+
}
|
|
115
264
|
_context.next = 1;
|
|
116
|
-
return
|
|
265
|
+
return _promise.default.all(startPromises);
|
|
117
266
|
case 1:
|
|
118
267
|
return _context.abrupt("return", this.getResult());
|
|
119
268
|
case 2:
|
|
@@ -135,7 +284,11 @@ var ClusterReachability = exports.ClusterReachability = /*#__PURE__*/function (_
|
|
|
135
284
|
}, {
|
|
136
285
|
key: "abort",
|
|
137
286
|
value: function abort() {
|
|
138
|
-
|
|
287
|
+
var _this$reachabilityPee3;
|
|
288
|
+
this.reachabilityPeerConnectionsForUdp.forEach(function (rpc) {
|
|
289
|
+
return rpc.abort();
|
|
290
|
+
});
|
|
291
|
+
(_this$reachabilityPee3 = this.reachabilityPeerConnection) === null || _this$reachabilityPee3 === void 0 ? void 0 : _this$reachabilityPee3.abort();
|
|
139
292
|
}
|
|
140
293
|
}]);
|
|
141
294
|
}(_eventsScope.default);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_eventsScope","_interopRequireDefault","require","_reachability","_reachabilityPeerConnection","_callSuper","t","o","e","_getPrototypeOf2","default","_possibleConstructorReturn2","_isNativeReflectConstruct","_Reflect$construct","constructor","apply","Boolean","prototype","valueOf","call","Events","exports","resultReady","clientMediaIpsUpdated","natTypeUpdated","ClusterReachability","_EventsScope","name","clusterInfo","_this","_classCallCheck2","_defineProperty2","_set","isVideoMesh","reachabilityPeerConnection","ReachabilityPeerConnection","setupReachabilityPeerConnectionEventListeners","_inherits2","_createClass2","key","value","_this2","on","ReachabilityPeerConnectionEvents","data","emit","file","function","reachedSubnets","subnets","forEach","subnet","add","getResult","_start","_asyncToGenerator2","_regenerator","mark","_callee","wrap","_context","prev","next","start","abrupt","stop","arguments","abort","EventsScope"],"sources":["clusterReachability.ts"],"sourcesContent":["import {ClusterNode} from './request';\nimport EventsScope from '../common/events/events-scope';\n\nimport {Enum} from '../constants';\nimport {\n ClusterReachabilityResult,\n NatType,\n ReachabilityPeerConnectionEvents,\n} from './reachability.types';\nimport {ReachabilityPeerConnection} from './reachabilityPeerConnection';\n\n// data for the Events.resultReady event\nexport type ResultEventData = {\n protocol: 'udp' | 'tcp' | 'xtls';\n result: 'reachable' | 'unreachable' | 'untested';\n latencyInMilliseconds: number; // amount of time it took to get the ICE candidate\n clientMediaIPs?: string[];\n};\n\n// data for the Events.clientMediaIpsUpdated event\nexport type ClientMediaIpsUpdatedEventData = {\n protocol: 'udp' | 'tcp' | 'xtls';\n clientMediaIPs: string[];\n};\n\nexport type NatTypeUpdatedEventData = {\n natType: NatType;\n};\n\nexport const Events = {\n resultReady: 'resultReady', // emitted when a cluster is reached successfully using specific protocol\n clientMediaIpsUpdated: 'clientMediaIpsUpdated', // emitted when more public IPs are found after resultReady was already sent for a given protocol\n natTypeUpdated: 'natTypeUpdated', // emitted when NAT type is determined\n} as const;\n\nexport type Events = Enum<typeof Events>;\n\n/**\n * A class that handles reachability checks for a single cluster.\n * Creates and orchestrates a ReachabilityPeerConnection instance.\n * Listens to events and emits them to consumers.\n */\nexport class ClusterReachability extends EventsScope {\n private reachabilityPeerConnection: ReachabilityPeerConnection;\n public readonly isVideoMesh: boolean;\n public readonly name;\n public readonly reachedSubnets: Set<string> = new Set();\n\n /**\n * Constructor for ClusterReachability\n * @param {string} name cluster name\n * @param {ClusterNode} clusterInfo information about the media cluster\n */\n constructor(name: string, clusterInfo: ClusterNode) {\n super();\n this.name = name;\n this.isVideoMesh = clusterInfo.isVideoMesh;\n\n this.reachabilityPeerConnection = new ReachabilityPeerConnection(name, clusterInfo);\n\n this.setupReachabilityPeerConnectionEventListeners();\n }\n\n /**\n * Sets up event listeners for the ReachabilityPeerConnection instance\n * @returns {void}\n */\n private setupReachabilityPeerConnectionEventListeners() {\n this.reachabilityPeerConnection.on(ReachabilityPeerConnectionEvents.resultReady, (data) => {\n this.emit(\n {\n file: 'clusterReachability',\n function: 'setupReachabilityPeerConnectionEventListeners',\n },\n Events.resultReady,\n data\n );\n });\n\n this.reachabilityPeerConnection.on(\n ReachabilityPeerConnectionEvents.clientMediaIpsUpdated,\n (data) => {\n this.emit(\n {\n file: 'clusterReachability',\n function: 'setupReachabilityPeerConnectionEventListeners',\n },\n Events.clientMediaIpsUpdated,\n data\n );\n }\n );\n\n this.reachabilityPeerConnection.on(ReachabilityPeerConnectionEvents.natTypeUpdated, (data) => {\n this.emit(\n {\n file: 'clusterReachability',\n function: 'setupReachabilityPeerConnectionEventListeners',\n },\n Events.natTypeUpdated,\n data\n );\n });\n\n this.reachabilityPeerConnection.on(ReachabilityPeerConnectionEvents.reachedSubnets, (data) => {\n data.subnets.forEach((subnet) => {\n this.reachedSubnets.add(subnet);\n });\n });\n }\n\n /**\n * @returns {ClusterReachabilityResult} reachability result for this cluster\n */\n getResult(): ClusterReachabilityResult {\n return this.reachabilityPeerConnection.getResult();\n }\n\n /**\n * Starts the process of doing UDP, TCP, and XTLS reachability checks on the media cluster.\n * @returns {Promise<ClusterReachabilityResult>}\n */\n async start(): Promise<ClusterReachabilityResult> {\n await this.reachabilityPeerConnection.start();\n\n return this.getResult();\n }\n\n /**\n * Aborts the cluster reachability checks\n * @returns {void}\n */\n public abort() {\n this.reachabilityPeerConnection.abort();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AACA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,aAAA,GAAAD,OAAA;AAKA,IAAAE,2BAAA,GAAAF,OAAA;AAAwE,SAAAG,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,CAAAC,OAAA,EAAAH,CAAA,OAAAI,2BAAA,CAAAD,OAAA,EAAAJ,CAAA,EAAAM,yBAAA,KAAAC,kBAAA,CAAAN,CAAA,EAAAC,CAAA,YAAAC,gBAAA,CAAAC,OAAA,EAAAJ,CAAA,EAAAQ,WAAA,IAAAP,CAAA,CAAAQ,KAAA,CAAAT,CAAA,EAAAE,CAAA;AAAA,SAAAI,0BAAA,cAAAN,CAAA,IAAAU,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAA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AC,kBAAA,CAAA7C,OAAA,eAAA8C,YAAA,CAAA9C,OAAA,CAAA+C,IAAA,CAIA,SAAAC,QAAA;QAAA,OAAAF,YAAA,CAAA9C,OAAA,CAAAiD,IAAA,WAAAC,QAAA;UAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;YAAA;cAAAF,QAAA,CAAAE,IAAA;cAAA,OACQ,IAAI,CAAC5B,0BAA0B,CAAC6B,KAAK,CAAC,CAAC;YAAA;cAAA,OAAAH,QAAA,CAAAI,MAAA,WAEtC,IAAI,CAACX,SAAS,CAAC,CAAC;YAAA;YAAA;cAAA,OAAAO,QAAA,CAAAK,IAAA;UAAA;QAAA,GAAAP,OAAA;MAAA,CACxB;MAAA,SAJKK,KAAKA,CAAA;QAAA,OAAAT,MAAA,CAAAvC,KAAA,OAAAmD,SAAA;MAAA;MAAA,OAALH,KAAK;IAAA;IAMX;AACF;AACA;AACA;IAHE;EAAA;IAAAxB,GAAA;IAAAC,KAAA,EAIA,SAAO2B,KAAKA,CAAA,EAAG;MACb,IAAI,CAACjC,0BAA0B,CAACiC,KAAK,CAAC,CAAC;IACzC;EAAC;AAAA,EA5FsCC,oBAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_eventsScope","_interopRequireDefault","require","_loggerProxy","_reachability","_reachabilityPeerConnection","_createForOfIteratorHelper","r","e","t","_Symbol","_Symbol$iterator","_Array$isArray","_unsupportedIterableToArray","length","_n","F","s","n","done","value","f","TypeError","o","a","u","call","next","return","_arrayLikeToArray","toString","slice","constructor","name","_Array$from","test","Array","_callSuper","_getPrototypeOf2","default","_possibleConstructorReturn2","_isNativeReflectConstruct","_Reflect$construct","apply","Boolean","prototype","valueOf","Events","exports","resultReady","clientMediaIpsUpdated","natTypeUpdated","ClusterReachability","_EventsScope","clusterInfo","_this","enablePerUdpUrlReachability","arguments","undefined","_classCallCheck2","_defineProperty2","_set","isVideoMesh","initializePerUdpUrlReachabilityCheck","initializeSingleReachabilityPeerConnection","_inherits2","_createClass2","key","reachabilityPeerConnection","ReachabilityPeerConnection","setupReachabilityPeerConnectionEventListeners","_this2","LoggerProxy","logger","log","concat","udp","forEach","udpUrl","singleUdpClusterInfo","tcp","xtls","rpc","reachabilityPeerConnectionsForUdp","push","tcpTlsClusterInfo","_this3","isUdpPerUrl","on","ReachabilityPeerConnectionEvents","data","protocol","udpResultEmitted","result","emit","file","function","reachedSubnets","subnets","subnet","add","getResult","_this$reachabilityPee","_this$reachabilityPee2","_iterator","_step","rpcResult","err","mainResult","_start","_asyncToGenerator2","_regenerator","mark","_callee","startPromises","wrap","_context","prev","start","_promise","all","abrupt","stop","abort","_this$reachabilityPee3","EventsScope"],"sources":["clusterReachability.ts"],"sourcesContent":["import {ClusterNode} from './request';\nimport EventsScope from '../common/events/events-scope';\nimport LoggerProxy from '../common/logs/logger-proxy';\n\nimport {Enum} from '../constants';\nimport {\n ClusterReachabilityResult,\n NatType,\n Protocol,\n ReachabilityPeerConnectionEvents,\n} from './reachability.types';\nimport {ReachabilityPeerConnection} from './reachabilityPeerConnection';\n\n// data for the Events.resultReady event\nexport type ResultEventData = {\n protocol: Protocol;\n result: 'reachable' | 'unreachable' | 'untested';\n latencyInMilliseconds: number; // amount of time it took to get the ICE candidate\n clientMediaIPs?: string[];\n};\n\n// data for the Events.clientMediaIpsUpdated event\nexport type ClientMediaIpsUpdatedEventData = {\n protocol: Protocol;\n clientMediaIPs: string[];\n};\n\nexport type NatTypeUpdatedEventData = {\n natType: NatType;\n};\n\nexport const Events = {\n resultReady: 'resultReady', // emitted when a cluster is reached successfully using specific protocol\n clientMediaIpsUpdated: 'clientMediaIpsUpdated', // emitted when more public IPs are found after resultReady was already sent for a given protocol\n natTypeUpdated: 'natTypeUpdated', // emitted when NAT type is determined\n} as const;\n\nexport type Events = Enum<typeof Events>;\n\n/**\n * A class that handles reachability checks for a single cluster.\n * Creates and orchestrates ReachabilityPeerConnection instance(s).\n * Listens to events and emits them to consumers.\n *\n * When enablePerUdpUrlReachability is true:\n * - Creates one ReachabilityPeerConnection for each UDP URL\n * - Creates one ReachabilityPeerConnection for all TCP and TLS URLs together\n * Otherwise:\n * - Creates a single ReachabilityPeerConnection for all URLs\n */\nexport class ClusterReachability extends EventsScope {\n private reachabilityPeerConnection: ReachabilityPeerConnection | null = null;\n private reachabilityPeerConnectionsForUdp: ReachabilityPeerConnection[] = [];\n\n public readonly isVideoMesh: boolean;\n public readonly name;\n public readonly reachedSubnets: Set<string> = new Set();\n\n private enablePerUdpUrlReachability: boolean;\n private udpResultEmitted = false;\n\n /**\n * Constructor for ClusterReachability\n * @param {string} name cluster name\n * @param {ClusterNode} clusterInfo information about the media cluster\n * @param {boolean} enablePerUdpUrlReachability whether to create separate peer connections per UDP URL\n */\n constructor(name: string, clusterInfo: ClusterNode, enablePerUdpUrlReachability = false) {\n super();\n this.name = name;\n this.isVideoMesh = clusterInfo.isVideoMesh;\n this.enablePerUdpUrlReachability = enablePerUdpUrlReachability;\n\n if (this.enablePerUdpUrlReachability) {\n this.initializePerUdpUrlReachabilityCheck(clusterInfo);\n } else {\n this.initializeSingleReachabilityPeerConnection(clusterInfo);\n }\n }\n\n /**\n * Initializes a single ReachabilityPeerConnection for all protocols\n * @param {ClusterNode} clusterInfo information about the media cluster\n * @returns {void}\n */\n private initializeSingleReachabilityPeerConnection(clusterInfo: ClusterNode) {\n this.reachabilityPeerConnection = new ReachabilityPeerConnection(this.name, clusterInfo);\n this.setupReachabilityPeerConnectionEventListeners(this.reachabilityPeerConnection);\n }\n\n /**\n * Initializes per-URL UDP reachability checks:\n * - One ReachabilityPeerConnection per UDP URL\n * - One ReachabilityPeerConnection for all TCP and TLS URLs together\n * @param {ClusterNode} clusterInfo information about the media cluster\n * @returns {void}\n */\n private initializePerUdpUrlReachabilityCheck(clusterInfo: ClusterNode) {\n LoggerProxy.logger.log(\n `ClusterReachability#initializePerUdpUrlReachabilityCheck --> cluster: ${this.name}, performing per-URL UDP reachability for ${clusterInfo.udp.length} URLs`\n );\n\n // Create one ReachabilityPeerConnection for each UDP URL\n clusterInfo.udp.forEach((udpUrl) => {\n const singleUdpClusterInfo: ClusterNode = {\n isVideoMesh: clusterInfo.isVideoMesh,\n udp: [udpUrl],\n tcp: [],\n xtls: [],\n };\n const rpc = new ReachabilityPeerConnection(this.name, singleUdpClusterInfo);\n this.setupReachabilityPeerConnectionEventListeners(rpc, true);\n this.reachabilityPeerConnectionsForUdp.push(rpc);\n });\n\n // Create one ReachabilityPeerConnection for all TCP and TLS URLs together\n if (clusterInfo.tcp.length > 0 || clusterInfo.xtls.length > 0) {\n const tcpTlsClusterInfo: ClusterNode = {\n isVideoMesh: clusterInfo.isVideoMesh,\n udp: [],\n tcp: clusterInfo.tcp,\n xtls: clusterInfo.xtls,\n };\n this.reachabilityPeerConnection = new ReachabilityPeerConnection(\n this.name,\n tcpTlsClusterInfo\n );\n this.setupReachabilityPeerConnectionEventListeners(this.reachabilityPeerConnection);\n }\n }\n\n /**\n * Sets up event listeners for a ReachabilityPeerConnection instance\n * @param {ReachabilityPeerConnection} rpc the ReachabilityPeerConnection instance\n * @param {boolean} isUdpPerUrl whether this is a per-URL UDP instance\n * @returns {void}\n */\n private setupReachabilityPeerConnectionEventListeners(\n rpc: ReachabilityPeerConnection,\n isUdpPerUrl = false\n ) {\n rpc.on(ReachabilityPeerConnectionEvents.resultReady, (data) => {\n // For per-URL UDP checks, only emit the first successful UDP result\n if (isUdpPerUrl && data.protocol === 'udp') {\n if (this.udpResultEmitted) {\n return;\n }\n if (data.result === 'reachable') {\n this.udpResultEmitted = true;\n }\n }\n\n this.emit(\n {\n file: 'clusterReachability',\n function: 'setupReachabilityPeerConnectionEventListeners',\n },\n Events.resultReady,\n data\n );\n });\n\n rpc.on(ReachabilityPeerConnectionEvents.clientMediaIpsUpdated, (data) => {\n this.emit(\n {\n file: 'clusterReachability',\n function: 'setupReachabilityPeerConnectionEventListeners',\n },\n Events.clientMediaIpsUpdated,\n data\n );\n });\n\n rpc.on(ReachabilityPeerConnectionEvents.natTypeUpdated, (data) => {\n this.emit(\n {\n file: 'clusterReachability',\n function: 'setupReachabilityPeerConnectionEventListeners',\n },\n Events.natTypeUpdated,\n data\n );\n });\n\n rpc.on(ReachabilityPeerConnectionEvents.reachedSubnets, (data) => {\n data.subnets.forEach((subnet: string) => {\n this.reachedSubnets.add(subnet);\n });\n });\n }\n\n /**\n * Gets the aggregated reachability result for this cluster.\n * @returns {ClusterReachabilityResult} reachability result for this cluster\n */\n getResult(): ClusterReachabilityResult {\n if (!this.enablePerUdpUrlReachability) {\n return (\n this.reachabilityPeerConnection?.getResult() ?? {\n udp: {result: 'untested'},\n tcp: {result: 'untested'},\n xtls: {result: 'untested'},\n }\n );\n }\n\n const result: ClusterReachabilityResult = {\n udp: {result: 'untested'},\n tcp: {result: 'untested'},\n xtls: {result: 'untested'},\n };\n\n // Get the first reachable UDP result from per-URL instances\n for (const rpc of this.reachabilityPeerConnectionsForUdp) {\n const rpcResult = rpc.getResult();\n if (rpcResult.udp.result === 'reachable') {\n result.udp = rpcResult.udp;\n break;\n }\n if (rpcResult.udp.result === 'unreachable' && result.udp.result === 'untested') {\n result.udp = rpcResult.udp;\n }\n }\n\n // Get TCP and TLS results from the main peer connection\n if (this.reachabilityPeerConnection) {\n const mainResult = this.reachabilityPeerConnection.getResult();\n result.tcp = mainResult.tcp;\n result.xtls = mainResult.xtls;\n }\n\n return result;\n }\n\n /**\n * Starts the process of doing UDP, TCP, and XTLS reachability checks on the media cluster.\n * @returns {Promise<ClusterReachabilityResult>}\n */\n async start(): Promise<ClusterReachabilityResult> {\n const startPromises: Promise<ClusterReachabilityResult>[] = [];\n\n this.reachabilityPeerConnectionsForUdp.forEach((rpc) => {\n startPromises.push(rpc.start());\n });\n\n if (this.reachabilityPeerConnection) {\n startPromises.push(this.reachabilityPeerConnection.start());\n }\n\n await Promise.all(startPromises);\n\n return this.getResult();\n }\n\n /**\n * Aborts the cluster reachability checks\n * @returns {void}\n */\n public abort() {\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