@w3streamdev/plugin-core 1.0.0 → 1.0.3

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/dist/index.js CHANGED
@@ -512,7 +512,16 @@ async function fetchPluginsFromServer(config) {
512
512
  }
513
513
  async function patchMeeting(meeting, config) {
514
514
  const m = meeting;
515
- const serverPlugins = await fetchPluginsFromServer(config);
515
+ let serverPlugins;
516
+ try {
517
+ serverPlugins = await fetchPluginsFromServer(config);
518
+ } catch (err) {
519
+ console.warn(
520
+ "[plugin-core] Could not reach plugin server \u2014 meeting will work without custom plugins.",
521
+ err.message
522
+ );
523
+ serverPlugins = [];
524
+ }
516
525
  const storeSync = new StoreSyncManager(meeting);
517
526
  storeSync.listenForRemoteUpdates();
518
527
  const pluginObjects = serverPlugins.map(
@@ -521,15 +530,16 @@ async function patchMeeting(meeting, config) {
521
530
  const all = new PluginList();
522
531
  all._setItems(pluginObjects);
523
532
  const active = new PluginList();
524
- const pluginsProxy = {
525
- all,
526
- active
527
- };
528
- Object.defineProperty(m, "plugins", {
529
- value: pluginsProxy,
530
- writable: true,
531
- configurable: true
532
- });
533
+ const existingPlugins = m.plugins ?? {};
534
+ existingPlugins["all"] = all;
535
+ existingPlugins["active"] = active;
536
+ if (!m.plugins) {
537
+ Object.defineProperty(m, "plugins", {
538
+ value: existingPlugins,
539
+ writable: true,
540
+ configurable: true
541
+ });
542
+ }
533
543
  if (m.participants?.on) {
534
544
  const handleBroadcast = (...args) => {
535
545
  let data;
package/dist/index.mjs CHANGED
@@ -471,7 +471,16 @@ async function fetchPluginsFromServer(config) {
471
471
  }
472
472
  async function patchMeeting(meeting, config) {
473
473
  const m = meeting;
474
- const serverPlugins = await fetchPluginsFromServer(config);
474
+ let serverPlugins;
475
+ try {
476
+ serverPlugins = await fetchPluginsFromServer(config);
477
+ } catch (err) {
478
+ console.warn(
479
+ "[plugin-core] Could not reach plugin server \u2014 meeting will work without custom plugins.",
480
+ err.message
481
+ );
482
+ serverPlugins = [];
483
+ }
475
484
  const storeSync = new StoreSyncManager(meeting);
476
485
  storeSync.listenForRemoteUpdates();
477
486
  const pluginObjects = serverPlugins.map(
@@ -480,15 +489,16 @@ async function patchMeeting(meeting, config) {
480
489
  const all = new PluginList();
481
490
  all._setItems(pluginObjects);
482
491
  const active = new PluginList();
483
- const pluginsProxy = {
484
- all,
485
- active
486
- };
487
- Object.defineProperty(m, "plugins", {
488
- value: pluginsProxy,
489
- writable: true,
490
- configurable: true
491
- });
492
+ const existingPlugins = m.plugins ?? {};
493
+ existingPlugins["all"] = all;
494
+ existingPlugins["active"] = active;
495
+ if (!m.plugins) {
496
+ Object.defineProperty(m, "plugins", {
497
+ value: existingPlugins,
498
+ writable: true,
499
+ configurable: true
500
+ });
501
+ }
492
502
  if (m.participants?.on) {
493
503
  const handleBroadcast = (...args) => {
494
504
  let data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@w3streamdev/plugin-core",
3
- "version": "1.0.0",
3
+ "version": "1.0.3",
4
4
  "description": "Host-side patch layer — wires @cloudflare/realtimekit into your plugin infrastructure",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",