@webex/plugin-meetings 3.12.0-llmrefactor.11 → 3.12.0-llmrefactor.12

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.
@@ -91,6 +91,12 @@ export default class LocusInfo extends EventsScope {
91
91
  * @returns {undefined}
92
92
  */
93
93
  constructor(callbacks: LocusInfoCallbacks, webex: any, meetingId: any);
94
+ /**
95
+ * Whether this meeting uses hash tree based Locus (as opposed to a classic, delta based Locus).
96
+ *
97
+ * @returns {boolean}
98
+ */
99
+ isUsingHashTrees(): boolean;
94
100
  /**
95
101
  * Does a Locus sync. It tries to get the latest delta DTO or if it can't, it falls back to getting the full Locus DTO.
96
102
  * WARNING: This function must not be used for hash tree based Locus meetings.
@@ -98,9 +104,41 @@ export default class LocusInfo extends EventsScope {
98
104
  * @param {Meeting} meeting
99
105
  * @param {boolean} isLocusUrlChanged
100
106
  * @param {Locus} locus
101
- * @returns {undefined}
107
+ * @param {Object} [options]
108
+ * @param {boolean} [options.destroyOnTransientFailure=true] controls what happens on a *transient*
109
+ * sync failure (a terminal failure, e.g. a 403 meaning the meeting has ended, always destroys
110
+ * the meeting regardless of this flag). When true, a transient failure destroys the meeting and
111
+ * the returned promise still resolves. When false, the meeting is preserved and the returned
112
+ * promise rejects so the caller can retry.
113
+ * @returns {Promise} resolves once the fetched DTO has been applied; see destroyOnTransientFailure
114
+ * for the failure behavior
102
115
  */
103
116
  private doLocusSync;
117
+ /**
118
+ * Syncs this meeting's Locus state (e.g. after a network reconnection), routing to whichever
119
+ * mechanism the meeting uses (a meeting only ever uses one): hash tree datasets via
120
+ * syncAllHashTreeDatasets() or a standalone Locus DTO fetch for classic meetings.
121
+ * A transient failure preserves the meeting (so the caller can retry); only a terminal failure
122
+ * (e.g. a 403 meaning the meeting has ended) destroys it.
123
+ *
124
+ * The classic path is only needed when Meetings#syncMeetings() can't do its usual
125
+ * getActiveMeetings() fetch (e.g. unverified guests, for whom Locus rejects that call); signed-in
126
+ * users resync classic meetings via getActiveMeetings() and pass canSyncClassicLocus as false.
127
+ *
128
+ * @param {Meeting} meeting
129
+ * @param {Object} options
130
+ * @param {boolean} options.canSyncClassicLocus - whether this sync is allowed to fetch a
131
+ * standalone Locus DTO for classic meetings
132
+ * @param {boolean} options.canSyncHashTree - whether this sync is allowed to sync hash tree
133
+ * datasets for hash tree based meetings
134
+ * @returns {Promise<void>} resolves once the sync (hash tree or classic) completes; for the
135
+ * classic path it rejects only on a transient failure, so the caller can retry (a terminal
136
+ * failure destroys the meeting and resolves)
137
+ */
138
+ sync(meeting: any, { canSyncClassicLocus, canSyncHashTree }: {
139
+ canSyncClassicLocus: boolean;
140
+ canSyncHashTree: boolean;
141
+ }): Promise<void>;
104
142
  /**
105
143
  * Apply locus delta data to meeting
106
144
  * @param {string} action Locus delta action
@@ -490,7 +490,8 @@ export default class Meetings extends WebexPlugin {
490
490
  */
491
491
  getAllMeetings(): any;
492
492
  /**
493
- * Syncs all the meetings from server. Does nothing and returns immediately if unverified guest.
493
+ * Syncs all the meetings from server. For unverified guests it skips the getActiveMeetings() call
494
+ * (which Locus rejects for them) and instead resyncs each meeting individually via LocusInfo#sync.
494
495
  * @param {boolean} keepOnlyLocusMeetings - whether the sync should keep only locus meetings or any other meeting in meetingCollection
495
496
  * @returns {Promise<void>}
496
497
  * @public
@@ -912,7 +912,7 @@ var Webinar = _webexCore.WebexPlugin.extend({
912
912
  }, _callee10);
913
913
  }))();
914
914
  },
915
- version: "3.12.0-llmrefactor.11"
915
+ version: "3.12.0-llmrefactor.12"
916
916
  });
917
917
  var _default = exports.default = Webinar;
918
918
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -43,7 +43,7 @@
43
43
  "@webex/eslint-config-legacy": "0.0.0",
44
44
  "@webex/jest-config-legacy": "0.0.0",
45
45
  "@webex/legacy-tools": "0.0.0",
46
- "@webex/plugin-rooms": "3.12.0-llmrefactor.7",
46
+ "@webex/plugin-rooms": "3.12.0-llmrefactor.8",
47
47
  "@webex/test-helper-chai": "3.12.0-llmrefactor.2",
48
48
  "@webex/test-helper-mocha": "3.12.0-llmrefactor.2",
49
49
  "@webex/test-helper-mock-webex": "3.12.0-llmrefactor.1",
@@ -62,21 +62,21 @@
62
62
  "dependencies": {
63
63
  "@webex/common": "3.12.0-llmrefactor.2",
64
64
  "@webex/event-dictionary-ts": "^1.0.2215",
65
- "@webex/internal-media-core": "2.29.2",
66
- "@webex/internal-plugin-conversation": "3.12.0-llmrefactor.7",
67
- "@webex/internal-plugin-device": "3.12.0-llmrefactor.5",
68
- "@webex/internal-plugin-llm": "3.12.0-llmrefactor.7",
69
- "@webex/internal-plugin-mercury": "3.12.0-llmrefactor.7",
70
- "@webex/internal-plugin-metrics": "3.12.0-llmrefactor.5",
71
- "@webex/internal-plugin-support": "3.12.0-llmrefactor.7",
72
- "@webex/internal-plugin-user": "3.12.0-llmrefactor.5",
73
- "@webex/internal-plugin-voicea": "3.12.0-llmrefactor.9",
74
- "@webex/media-helpers": "3.12.0-llmrefactor.4",
75
- "@webex/plugin-people": "3.12.0-llmrefactor.7",
76
- "@webex/plugin-rooms": "3.12.0-llmrefactor.7",
65
+ "@webex/internal-media-core": "2.30.1",
66
+ "@webex/internal-plugin-conversation": "3.12.0-llmrefactor.8",
67
+ "@webex/internal-plugin-device": "3.12.0-llmrefactor.6",
68
+ "@webex/internal-plugin-llm": "3.12.0-llmrefactor.8",
69
+ "@webex/internal-plugin-mercury": "3.12.0-llmrefactor.8",
70
+ "@webex/internal-plugin-metrics": "3.12.0-llmrefactor.6",
71
+ "@webex/internal-plugin-support": "3.12.0-llmrefactor.8",
72
+ "@webex/internal-plugin-user": "3.12.0-llmrefactor.6",
73
+ "@webex/internal-plugin-voicea": "3.12.0-llmrefactor.10",
74
+ "@webex/media-helpers": "3.12.0-llmrefactor.5",
75
+ "@webex/plugin-people": "3.12.0-llmrefactor.8",
76
+ "@webex/plugin-rooms": "3.12.0-llmrefactor.8",
77
77
  "@webex/ts-sdp": "^1.8.1",
78
- "@webex/web-capabilities": "^1.13.0",
79
- "@webex/webex-core": "3.12.0-llmrefactor.5",
78
+ "@webex/web-capabilities": "^1.13.1",
79
+ "@webex/webex-core": "3.12.0-llmrefactor.6",
80
80
  "ampersand-collection": "^2.0.2",
81
81
  "bowser": "^2.11.0",
82
82
  "btoa": "^1.2.1",
@@ -94,5 +94,5 @@
94
94
  "//": [
95
95
  "TODO: upgrade jwt-decode when moving to node 18"
96
96
  ],
97
- "version": "3.12.0-llmrefactor.11"
97
+ "version": "3.12.0-llmrefactor.12"
98
98
  }
@@ -320,6 +320,15 @@ export default class LocusInfo extends EventsScope {
320
320
  this.hashTreeObjectId2ParticipantId = new Map();
321
321
  }
322
322
 
323
+ /**
324
+ * Whether this meeting uses hash tree based Locus (as opposed to a classic, delta based Locus).
325
+ *
326
+ * @returns {boolean}
327
+ */
328
+ isUsingHashTrees(): boolean {
329
+ return this.hashTreeParsers.size > 0;
330
+ }
331
+
323
332
  /**
324
333
  * Does a Locus sync. It tries to get the latest delta DTO or if it can't, it falls back to getting the full Locus DTO.
325
334
  * WARNING: This function must not be used for hash tree based Locus meetings.
@@ -327,12 +336,26 @@ export default class LocusInfo extends EventsScope {
327
336
  * @param {Meeting} meeting
328
337
  * @param {boolean} isLocusUrlChanged
329
338
  * @param {Locus} locus
330
- * @returns {undefined}
339
+ * @param {Object} [options]
340
+ * @param {boolean} [options.destroyOnTransientFailure=true] controls what happens on a *transient*
341
+ * sync failure (a terminal failure, e.g. a 403 meaning the meeting has ended, always destroys
342
+ * the meeting regardless of this flag). When true, a transient failure destroys the meeting and
343
+ * the returned promise still resolves. When false, the meeting is preserved and the returned
344
+ * promise rejects so the caller can retry.
345
+ * @returns {Promise} resolves once the fetched DTO has been applied; see destroyOnTransientFailure
346
+ * for the failure behavior
331
347
  */
332
- private doLocusSync(meeting: any, isLocusUrlChanged: boolean, locus: any) {
348
+ private doLocusSync(
349
+ meeting: any,
350
+ isLocusUrlChanged: boolean,
351
+ locus: any,
352
+ {destroyOnTransientFailure = true}: {destroyOnTransientFailure?: boolean} = {}
353
+ ) {
333
354
  let url;
334
355
  let isDelta = false;
335
356
  let meetingDestroyed = false;
357
+ // whether the DTO fetch itself failed (as opposed to applying a successfully fetched DTO)
358
+ let fetchFailed = false;
336
359
 
337
360
  if (isLocusUrlChanged) {
338
361
  // for the locus url changed case from breakout to main session, we should always do a full sync, in this case, the url from locus is always on main session,
@@ -353,8 +376,30 @@ export default class LocusInfo extends EventsScope {
353
376
  } DTO)`
354
377
  );
355
378
 
356
- // return value ignored on purpose
357
- meeting.meetingRequest
379
+ // Called once the DTO fetch (delta plus any full-sync fallback) has failed and we're giving up.
380
+ // The meeting is destroyed when either the delta-processing path asked for it, or the failure is
381
+ // terminal (e.g. a 403 meaning the meeting has ended) - in both cases there's nothing left to
382
+ // sync or retry, so the trailing catch below swallows the rejection whenever meetingDestroyed is
383
+ // set. On the caller-driven reconnection path a non-terminal failure preserves the meeting and
384
+ // lets the rejection propagate so the caller can retry.
385
+ const onFetchFailure = (error: any, logMessage: string, {terminal = false} = {}) => {
386
+ // terminal failures always destroy the meeting; destroyOnTransientFailure only controls the
387
+ // non-terminal case
388
+ const destroyMeeting = terminal || destroyOnTransientFailure;
389
+ LoggerProxy.logger.info(
390
+ `Locus-info:index#doLocusSync --> ${logMessage}${
391
+ destroyMeeting ? ', destroying the meeting' : ''
392
+ }`
393
+ );
394
+ fetchFailed = true;
395
+ if (destroyMeeting) {
396
+ this.webex.meetings.destroy(meeting, MEETING_REMOVED_REASON.LOCUS_DTO_SYNC_FAILED);
397
+ meetingDestroyed = true;
398
+ }
399
+ throw error;
400
+ };
401
+
402
+ return meeting.meetingRequest
358
403
  .getLocusDTO({url})
359
404
  .catch((e) => {
360
405
  if (isDelta) {
@@ -375,26 +420,21 @@ export default class LocusInfo extends EventsScope {
375
420
 
376
421
  // Locus sometimes returns 403, for example if meeting has ended, no point trying the fallback to full sync in that case
377
422
  if (e.statusCode !== 403) {
378
- return meeting.meetingRequest.getLocusDTO({url: meeting.locusUrl}).catch((err) => {
379
- LoggerProxy.logger.info(
380
- 'Locus-info:index#doLocusSync --> fallback full sync failed, destroying the meeting'
381
- );
382
- this.webex.meetings.destroy(meeting, MEETING_REMOVED_REASON.LOCUS_DTO_SYNC_FAILED);
383
- meetingDestroyed = true;
384
- throw err;
385
- });
423
+ return meeting.meetingRequest.getLocusDTO({url: meeting.locusUrl}).catch((err) =>
424
+ // A 403 from the fallback full sync is also terminal (meeting has ended), so remove the
425
+ // meeting even on the reconnection path instead of preserving it and rejecting.
426
+ onFetchFailure(err, 'fallback full sync failed', {terminal: err.statusCode === 403})
427
+ );
386
428
  }
387
- LoggerProxy.logger.info(
388
- 'Locus-info:index#doLocusSync --> got 403 from Locus, skipping fallback to full sync, destroying the meeting'
389
- );
390
- } else {
391
- LoggerProxy.logger.info(
392
- 'Locus-info:index#doLocusSync --> fallback full sync failed, destroying the meeting'
393
- );
429
+
430
+ // A 403 means the meeting has ended - this is terminal, so remove the meeting even on the
431
+ // reconnection path (there's nothing to retry) instead of preserving it and rejecting.
432
+ return onFetchFailure(e, 'got 403 from Locus, skipping fallback to full sync', {
433
+ terminal: true,
434
+ });
394
435
  }
395
- this.webex.meetings.destroy(meeting, MEETING_REMOVED_REASON.LOCUS_DTO_SYNC_FAILED);
396
- meetingDestroyed = true;
397
- throw e;
436
+
437
+ return onFetchFailure(e, 'full sync failed', {terminal: e.statusCode === 403});
398
438
  })
399
439
  .then((res) => {
400
440
  if (isEmpty(res.body)) {
@@ -425,18 +465,32 @@ export default class LocusInfo extends EventsScope {
425
465
  meeting.locusInfo.onFullLocus('classic Locus sync', res.body);
426
466
  })
427
467
  .catch((e) => {
428
- LoggerProxy.logger.info(
429
- `Locus-info:index#doLocusSync --> getLocusDTO succeeded but failed to handle result, locus parser will resume but not all data may be synced (${e.toString()})`
430
- );
468
+ if (!fetchFailed) {
469
+ // The DTO was fetched successfully but applying it failed. Retrying wouldn't help - it
470
+ // would re-fetch and re-apply the same unprocessable DTO and fail identically - so log and
471
+ // resume (swallow the error) instead of propagating it. Propagating here would make the
472
+ // reconnection flow (which treats a rejection as retryable) retry indefinitely.
473
+ LoggerProxy.logger.info(
474
+ `Locus-info:index#doLocusSync --> getLocusDTO succeeded but failed to handle result, locus parser will resume but not all data may be synced (${e.toString()})`
475
+ );
431
476
 
432
- Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.LOCUS_SYNC_HANDLING_FAILED, {
433
- correlationId: meeting.correlationId,
434
- url,
435
- reason: e.message,
436
- errorName: e.name,
437
- stack: e.stack,
438
- code: e.code,
439
- });
477
+ Metrics.sendBehavioralMetric(BEHAVIORAL_METRICS.LOCUS_SYNC_HANDLING_FAILED, {
478
+ correlationId: meeting.correlationId,
479
+ url,
480
+ reason: e.message,
481
+ errorName: e.name,
482
+ stack: e.stack,
483
+ code: e.code,
484
+ });
485
+
486
+ return;
487
+ }
488
+
489
+ if (!destroyOnTransientFailure && !meetingDestroyed) {
490
+ // caller-driven sync (e.g. reconnection): propagate a transient fetch failure so it can be
491
+ // retried. If the meeting was destroyed (terminal failure), there's nothing to retry.
492
+ throw e;
493
+ }
440
494
  })
441
495
  .finally(() => {
442
496
  if (!meetingDestroyed) {
@@ -447,6 +501,52 @@ export default class LocusInfo extends EventsScope {
447
501
  });
448
502
  }
449
503
 
504
+ /**
505
+ * Syncs this meeting's Locus state (e.g. after a network reconnection), routing to whichever
506
+ * mechanism the meeting uses (a meeting only ever uses one): hash tree datasets via
507
+ * syncAllHashTreeDatasets() or a standalone Locus DTO fetch for classic meetings.
508
+ * A transient failure preserves the meeting (so the caller can retry); only a terminal failure
509
+ * (e.g. a 403 meaning the meeting has ended) destroys it.
510
+ *
511
+ * The classic path is only needed when Meetings#syncMeetings() can't do its usual
512
+ * getActiveMeetings() fetch (e.g. unverified guests, for whom Locus rejects that call); signed-in
513
+ * users resync classic meetings via getActiveMeetings() and pass canSyncClassicLocus as false.
514
+ *
515
+ * @param {Meeting} meeting
516
+ * @param {Object} options
517
+ * @param {boolean} options.canSyncClassicLocus - whether this sync is allowed to fetch a
518
+ * standalone Locus DTO for classic meetings
519
+ * @param {boolean} options.canSyncHashTree - whether this sync is allowed to sync hash tree
520
+ * datasets for hash tree based meetings
521
+ * @returns {Promise<void>} resolves once the sync (hash tree or classic) completes; for the
522
+ * classic path it rejects only on a transient failure, so the caller can retry (a terminal
523
+ * failure destroys the meeting and resolves)
524
+ */
525
+ async sync(
526
+ meeting: any,
527
+ {canSyncClassicLocus, canSyncHashTree}: {canSyncClassicLocus: boolean; canSyncHashTree: boolean}
528
+ ): Promise<void> {
529
+ if (this.isUsingHashTrees()) {
530
+ // hash tree based meeting: doLocusSync must not be used, sync the hash tree datasets instead
531
+ if (canSyncHashTree) {
532
+ await this.syncAllHashTreeDatasets();
533
+ }
534
+
535
+ return;
536
+ }
537
+
538
+ // classic (non hash tree) meeting: only sync if there's a Locus URL to fetch against, otherwise
539
+ // getLocusDTO() would reject and doLocusSync() would destroy the (e.g. not-yet-joined) meeting
540
+ if (canSyncClassicLocus && meeting.locusUrl) {
541
+ // Pause the parser so in-flight deltas don't race the DTO fetch; doLocusSync() resumes it.
542
+ this.locusParser.pause();
543
+ // destroyOnTransientFailure: false so a transient failure preserves the meeting and rejects,
544
+ // letting the reconnection flow retry instead of tearing the meeting down. A terminal failure
545
+ // (e.g. a 403 meaning the meeting has ended) still destroys the meeting.
546
+ await this.doLocusSync(meeting, false, undefined, {destroyOnTransientFailure: false});
547
+ }
548
+ }
549
+
450
550
  /**
451
551
  * Apply locus delta data to meeting
452
552
  * @param {string} action Locus delta action
@@ -769,7 +869,7 @@ export default class LocusInfo extends EventsScope {
769
869
  ? (responseBody as {locus: LocusDTO}).locus
770
870
  : (responseBody as LocusDTO);
771
871
 
772
- if (this.hashTreeParsers.size > 0) {
872
+ if (this.isUsingHashTrees()) {
773
873
  // We are in hash tree mode. Check if we need to create/reactivate a parser for this locusUrl.
774
874
  if (!hashTreeParserEntry || hashTreeParserEntry.parser.state === 'stopped') {
775
875
  if (!locusUrl) {
@@ -1414,7 +1514,7 @@ export default class LocusInfo extends EventsScope {
1414
1514
  * @memberof LocusInfo
1415
1515
  */
1416
1516
  parse(meeting: any, data: any) {
1417
- if (this.hashTreeParsers.size > 0) {
1517
+ if (this.isUsingHashTrees()) {
1418
1518
  if (data.eventType === LOCUSEVENT.SDK_LOCUS_FROM_SYNC_MEETINGS) {
1419
1519
  // sync meetings response follows the format of "not wrapped" locus API responses,
1420
1520
  // so has no dataSets nor Metadata
@@ -759,7 +759,14 @@ export default class Meetings extends WebexPlugin {
759
759
 
760
760
  // @ts-ignore
761
761
  this.webex.internal.mercury.on(ONLINE, () => {
762
- this.syncMeetings({keepOnlyLocusMeetings: false});
762
+ // Fire-and-forget sync on socket recovery. Unlike the reconnection manager (which awaits and
763
+ // retries), nothing consumes this promise, so catch its rejection to avoid an unhandled
764
+ // promise rejection (a transient guest classic-sync failure would otherwise crash Node hosts).
765
+ this.syncMeetings({keepOnlyLocusMeetings: false}).catch((error) => {
766
+ LoggerProxy.logger.warn(
767
+ `Meetings:index#listenForEvents --> syncMeetings after ONLINE event failed: ${error}`
768
+ );
769
+ });
763
770
  });
764
771
 
765
772
  // @ts-ignore
@@ -1956,7 +1963,8 @@ export default class Meetings extends WebexPlugin {
1956
1963
  }
1957
1964
 
1958
1965
  /**
1959
- * Syncs all the meetings from server. Does nothing and returns immediately if unverified guest.
1966
+ * Syncs all the meetings from server. For unverified guests it skips the getActiveMeetings() call
1967
+ * (which Locus rejects for them) and instead resyncs each meeting individually via LocusInfo#sync.
1960
1968
  * @param {boolean} keepOnlyLocusMeetings - whether the sync should keep only locus meetings or any other meeting in meetingCollection
1961
1969
  * @returns {Promise<void>}
1962
1970
  * @public
@@ -1967,10 +1975,15 @@ export default class Meetings extends WebexPlugin {
1967
1975
  skipHashTreeSync = false,
1968
1976
  } = {}): Promise<void> {
1969
1977
  // @ts-ignore
1970
- if (this.webex.credentials.isUnverifiedGuest) {
1978
+ const isUnverifiedGuest = Boolean(this.webex.credentials.isUnverifiedGuest);
1979
+
1980
+ if (isUnverifiedGuest) {
1971
1981
  LoggerProxy.logger.info(
1972
1982
  'Meetings:index#syncMeetings --> user is unverified guest, skipping calling Locus for meeting sync'
1973
1983
  );
1984
+
1985
+ // Locus rejects getActiveMeetings() for unverified guests, so the per-meeting sync below
1986
+ // (with canSyncClassicLocus enabled) resyncs each classic meeting individually instead.
1974
1987
  } else {
1975
1988
  try {
1976
1989
  const locusArray = await this.request.getActiveMeetings();
@@ -2025,20 +2038,24 @@ export default class Meetings extends WebexPlugin {
2025
2038
  }
2026
2039
  }
2027
2040
 
2028
- if (!skipHashTreeSync) {
2029
- // Trigger hash tree syncs for all remaining meetings
2030
- const remainingMeetings = this.meetingCollection.getAll();
2031
- const syncPromises = [];
2032
-
2033
- for (const meeting of Object.values(remainingMeetings) as any[]) {
2034
- if (meeting.locusInfo) {
2035
- syncPromises.push(meeting.locusInfo.syncAllHashTreeDatasets());
2036
- }
2041
+ // Resync each remaining meeting via LocusInfo#sync, which routes to hash tree or classic. For
2042
+ // signed-in users classic meetings were already synced above, so only the hash tree sync runs.
2043
+ const remainingMeetings = this.meetingCollection.getAll();
2044
+ const syncPromises = [];
2045
+
2046
+ for (const meeting of Object.values(remainingMeetings) as any[]) {
2047
+ if (meeting.locusInfo) {
2048
+ syncPromises.push(
2049
+ meeting.locusInfo.sync(meeting, {
2050
+ canSyncClassicLocus: isUnverifiedGuest,
2051
+ canSyncHashTree: !skipHashTreeSync,
2052
+ })
2053
+ );
2037
2054
  }
2055
+ }
2038
2056
 
2039
- if (syncPromises.length > 0) {
2040
- await Promise.all(syncPromises);
2041
- }
2057
+ if (syncPromises.length > 0) {
2058
+ await Promise.all(syncPromises);
2042
2059
  }
2043
2060
  }
2044
2061