@squide/firefly 13.0.0 → 13.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @squide/firefly
2
2
 
3
+ ## 13.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#279](https://github.com/workleap/wl-squide/pull/279) [`9d15afc`](https://github.com/workleap/wl-squide/commit/9d15afc8b75c69dc3f0239876fb25a1d72ed9b29) Thanks [@patricklafrance](https://github.com/patricklafrance)! - The `opentelemetry/api` package has been moved from an optional peer dependency to a regular peer dependency.
8
+
3
9
  ## 13.0.0
4
10
 
5
11
  ### Major Changes
@@ -0,0 +1 @@
1
+ export declare function canRegisterHoneycombInstrumentation(): boolean;
@@ -0,0 +1,11 @@
1
+
2
+ ;// CONCATENATED MODULE: ./src/honeycomb/canRegisterHoneycombInstrumentation.ts
3
+ function canRegisterHoneycombInstrumentation() {
4
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
5
+ // @ts-ignore
6
+ return globalThis.__WLP_HONEYCOMB_INSTRUMENTATION_IS_REGISTERED__ === true;
7
+ }
8
+
9
+ export { canRegisterHoneycombInstrumentation };
10
+
11
+ //# sourceMappingURL=canRegisterHoneycombInstrumentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"honeycomb/canRegisterHoneycombInstrumentation.js","sources":["webpack://@squide/firefly/./src/honeycomb/canRegisterHoneycombInstrumentation.ts"],"sourcesContent":["export function canRegisterHoneycombInstrumentation() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return globalThis.__WLP_HONEYCOMB_INSTRUMENTATION_IS_REGISTERED__ === true;\n}\n"],"names":["canRegisterHoneycombInstrumentation","globalThis"],"mappings":";;AAAO,SAASA;IACZ,6DAA6D;IAC7D,aAAa;IACb,OAAOC,WAAW,+CAA+C,KAAK;AAC1E"}
@@ -0,0 +1,2 @@
1
+ import type { FireflyRuntime } from "../FireflyRuntime.tsx";
2
+ export declare function initializeHoneycomb(runtime: FireflyRuntime): Promise<void>;
@@ -0,0 +1,25 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE__canRegisterHoneycombInstrumentation_js_50e78485__ from "./canRegisterHoneycombInstrumentation.js";
2
+
3
+ ;// CONCATENATED MODULE: external "./canRegisterHoneycombInstrumentation.js"
4
+
5
+ ;// CONCATENATED MODULE: ./src/honeycomb/initializeHoneycomb.ts
6
+
7
+ async function initializeHoneycomb(runtime) {
8
+ if ((0,__WEBPACK_EXTERNAL_MODULE__canRegisterHoneycombInstrumentation_js_50e78485__.canRegisterHoneycombInstrumentation)()) {
9
+ try {
10
+ // Dynamically import the Honeycomb instrumentation to prevent loading all the Honeycomb libraries
11
+ // if Honeycomb instrumentation is not registered by the hosting application.
12
+ const mod = await import("./registerHoneycombInstrumentation.js");
13
+ mod.registerHoneycombInstrumentation(runtime);
14
+ } catch (error) {
15
+ runtime.logger.error("[squide] Failed to register Honeycomb instrumentation. The \"./registerHoneycombInstrumentation.ts\" cannot be imported.");
16
+ throw error;
17
+ }
18
+ } else {
19
+ runtime.logger.debug("[squide] Cannot register Honeycomb instrumentation because the host application is not using the \"@workleap/honeycomb\" package.");
20
+ }
21
+ }
22
+
23
+ export { initializeHoneycomb };
24
+
25
+ //# sourceMappingURL=initializeHoneycomb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"honeycomb/initializeHoneycomb.js","sources":["webpack://@squide/firefly/./src/honeycomb/initializeHoneycomb.ts"],"sourcesContent":["import type { FireflyRuntime } from \"../FireflyRuntime.tsx\";\nimport { canRegisterHoneycombInstrumentation } from \"./canRegisterHoneycombInstrumentation.ts\";\n\nexport async function initializeHoneycomb(runtime: FireflyRuntime) {\n if (canRegisterHoneycombInstrumentation()) {\n try {\n // Dynamically import the Honeycomb instrumentation to prevent loading all the Honeycomb libraries\n // if Honeycomb instrumentation is not registered by the hosting application.\n const mod = await import(\"./registerHoneycombInstrumentation.ts\");\n\n mod.registerHoneycombInstrumentation(runtime);\n } catch (error: unknown) {\n runtime.logger.error(\"[squide] Failed to register Honeycomb instrumentation. The \\\"./registerHoneycombInstrumentation.ts\\\" cannot be imported.\");\n\n throw error;\n }\n } else {\n runtime.logger.debug(\"[squide] Cannot register Honeycomb instrumentation because the host application is not using the \\\"@workleap/honeycomb\\\" package.\");\n }\n}\n\n\n"],"names":["canRegisterHoneycombInstrumentation","initializeHoneycomb","runtime","mod","error"],"mappings":";;;;;AAC+F;AAExF,eAAeC,oBAAoBC,OAAuB;IAC7D,IAAIF,oHAAmCA,IAAI;QACvC,IAAI;YACA,kGAAkG;YAClG,6EAA6E;YAC7E,MAAMG,MAAM,MAAM,+CAA+C;YAEjEA,IAAI,gCAAgC,CAACD;QACzC,EAAE,OAAOE,OAAgB;YACrBF,QAAQ,MAAM,CAAC,KAAK,CAAC;YAErB,MAAME;QACV;IACJ,OAAO;QACHF,QAAQ,MAAM,CAAC,KAAK,CAAC;IACzB;AACJ"}
@@ -1,4 +1,3 @@
1
1
  import type { FireflyRuntime } from "../FireflyRuntime.tsx";
2
2
  export declare function reduceDataFetchEvents(runtime: FireflyRuntime, onDataFetchingStarted: () => void, onDataReady: () => void, onPublicDataFetchStarted: () => void, onPublicDataReady: () => void, onProtectedDataFetchStarted: () => void, onProtectedDataReady: () => void): void;
3
3
  export declare function registerHoneycombInstrumentation(runtime: FireflyRuntime): void;
4
- export declare function canRegisterHoneycombInstrumentation(): boolean;
@@ -398,33 +398,8 @@ function registerHoneycombInstrumentation(runtime) {
398
398
  runtime.logger.warning("[squide] Cannot register Honeycomb fetch request hook because \"globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK\" is not available. Honeycomb instrumentation is still functional but in degraded mode.");
399
399
  }
400
400
  registerTrackingListeners(runtime);
401
- // try {
402
- // const registerFetchRequestHookFunction = getRegisterFetchRequestHookFunction();
403
- // if (registerFetchRequestHookFunction) {
404
- // const overrideFetchRequestHook = createOverrideFetchRequestWithManifestSectionSpanContext(runtime.logger);
405
- // // Dynamically registering this request hook function to nest the HTTP requests
406
- // // of the widgets initialization under the appropriate Honeycomb span.
407
- // registerFetchRequestHookFunction(overrideFetchRequestHook);
408
- // } else {
409
- // runtime.logger.warning("[wlp-widgets] Cannot register Honeycomb fetch request hook because \"globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK\" is not available. Honeycomb instrumentation is still functional but in degraded mode.");
410
- // }
411
- // registerTrackingListeners(runtime);
412
- // } catch (error: unknown) {
413
- // runtime.logger.error("[wlp-widgets] An error occured while registering Honeycomb instrumentation.", error);
414
- // runtime.errorPropagator.propagate(error as Error);
415
- // }
416
401
  }
417
- function canRegisterHoneycombInstrumentation() {
418
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
419
- // @ts-ignore
420
- return globalThis.__WLP_HONEYCOMB_INSTRUMENTATION_IS_REGISTERED__ === true;
421
- } // export function registerHoneycombInstrumentation(runtime: FireflyRuntime, namespace: string, serviceName: NonNullable<HoneycombSdkOptions["serviceName"]>, apiServiceUrls: PropagateTraceHeaderCorsUrls, options?: RegisterHoneycombInstrumentationOptions) {
422
- // const augmentedOptions = getInstrumentationOptions(runtime, options);
423
- // registerWorkleapHoneycombInstrumentation(namespace, serviceName, apiServiceUrls, augmentedOptions);
424
- // registerTrackingListeners(runtime);
425
- // registerActiveSpanStack();
426
- // }
427
402
 
428
- export { canRegisterHoneycombInstrumentation, reduceDataFetchEvents, registerHoneycombInstrumentation };
403
+ export { reduceDataFetchEvents, registerHoneycombInstrumentation };
429
404
 
430
405
  //# sourceMappingURL=registerHoneycombInstrumentation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"honeycomb/registerHoneycombInstrumentation.js","sources":["webpack://@squide/firefly/./src/honeycomb/registerHoneycombInstrumentation.ts"],"sourcesContent":["import type { Span } from \"@opentelemetry/api\";\nimport {\n LocalModuleDeferredRegistrationFailedEvent,\n LocalModuleDeferredRegistrationUpdateFailedEvent,\n LocalModuleRegistrationFailedEvent,\n LocalModulesDeferredRegistrationCompletedEvent,\n type LocalModulesDeferredRegistrationCompletedEventPayload,\n LocalModulesDeferredRegistrationStartedEvent,\n type LocalModulesDeferredRegistrationStartedEventPayload,\n LocalModulesDeferredRegistrationsUpdateCompletedEvent,\n type LocalModulesDeferredRegistrationsUpdateCompletedEventPayload,\n LocalModulesDeferredRegistrationsUpdateStartedEvent,\n type LocalModulesDeferredRegistrationsUpdateStartedEventPayload,\n LocalModulesRegistrationCompletedEvent,\n type LocalModulesRegistrationCompletedEventPayload,\n LocalModulesRegistrationStartedEvent,\n type LocalModulesRegistrationStartedEventPayload,\n type ModuleRegistrationError\n} from \"@squide/core\";\nimport {\n DeferredRegistrationsUpdateCompletedEvent,\n DeferredRegistrationsUpdateStartedEvent,\n RemoteModuleDeferredRegistrationFailedEvent,\n RemoteModuleDeferredRegistrationUpdateFailedEvent,\n type RemoteModuleRegistrationError,\n RemoteModuleRegistrationFailedEvent,\n RemoteModulesDeferredRegistrationCompletedEvent,\n type RemoteModulesDeferredRegistrationCompletedEventPayload,\n RemoteModulesDeferredRegistrationStartedEvent,\n type RemoteModulesDeferredRegistrationStartedEventPayload,\n RemoteModulesDeferredRegistrationsUpdateCompletedEvent,\n type RemoteModulesDeferredRegistrationsUpdateCompletedEventPayload,\n RemoteModulesDeferredRegistrationsUpdateStartedEvent,\n type RemoteModulesDeferredRegistrationsUpdateStartedEventPayload,\n RemoteModulesRegistrationCompletedEvent,\n type RemoteModulesRegistrationCompletedEventPayload,\n RemoteModulesRegistrationStartedEvent,\n type RemoteModulesRegistrationStartedEventPayload\n} from \"@squide/module-federation\";\nimport { ApplicationBoostrappedEvent, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, PublicDataReadyEvent } from \"../AppRouterReducer.ts\";\nimport type { FireflyRuntime } from \"../FireflyRuntime.tsx\";\nimport { ApplicationBootstrappingStartedEvent } from \"../initializeFirefly.ts\";\nimport { ProtectedDataFetchStartedEvent } from \"../useProtectedDataQueries.ts\";\nimport { PublicDataFetchStartedEvent } from \"../usePublicDataQueries.ts\";\nimport { type ActiveSpan, createOverrideFetchRequestSpanWithActiveSpanContext, registerActiveSpanStack } from \"./activeSpan.ts\";\nimport { getTracer } from \"./tracer.ts\";\nimport { endActiveSpan, startActiveChildSpan, startChildSpan, startSpan, traceError } from \"./utils.ts\";\n\n// TIPS:\n// To query those traces in Honeycomb, use the following query filter: \"root.name = squide-bootstrapping\".\n\ntype DataFetchState = \"none\" | \"fetching-data\" | \"public-data-ready\" | \"protected-data-ready\" | \"data-ready\";\n\nexport function reduceDataFetchEvents(\n runtime: FireflyRuntime,\n onDataFetchingStarted: () => void,\n onDataReady: () => void,\n onPublicDataFetchStarted: () => void,\n onPublicDataReady: () => void,\n onProtectedDataFetchStarted: () => void,\n onProtectedDataReady: () => void\n) {\n let dataFetchState: DataFetchState = \"none\";\n\n // TODO: Validate if this handler should use { once: true }.\n runtime.eventBus.addListener(PublicDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchingStarted();\n }\n\n onPublicDataFetchStarted();\n });\n\n // TODO: Validate if this handler should use { once: true }.\n runtime.eventBus.addListener(PublicDataReadyEvent, () => {\n onPublicDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n dataFetchState = \"public-data-ready\";\n } else if (dataFetchState === \"protected-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n });\n\n // TODO: Validate if this handler should use { once: true }.\n runtime.eventBus.addListener(ProtectedDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchingStarted();\n }\n\n onProtectedDataFetchStarted();\n });\n\n // TODO: Validate if this handler should use { once: true }.\n runtime.eventBus.addListener(ProtectedDataReadyEvent, () => {\n onProtectedDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n dataFetchState = \"protected-data-ready\";\n } else if (dataFetchState === \"public-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n });\n}\n\nfunction registerTrackingListeners(runtime: FireflyRuntime) {\n let bootstrappingSpan: Span;\n let localModuleRegistrationSpan: Span;\n let localModuleDeferredRegistrationSpan: Span;\n let remoteModuleRegistrationSpan: Span;\n let remoteModuleDeferredRegistrationSpan: Span;\n let dataFetchSpan: ActiveSpan;\n let deferredRegistrationsUpdateSpan: Span;\n let localModuleDeferredRegistrationsUpdateSpan: ActiveSpan;\n let remoteModuleDeferredRegistrationsUpdateSpan: ActiveSpan;\n\n runtime.eventBus.addListener(ApplicationBootstrappingStartedEvent, () => {\n bootstrappingSpan = startSpan((options, context) => getTracer().startSpan(\"squide-bootstrapping\", options, context));\n }, { once: true });\n\n runtime.eventBus.addListener(ApplicationBoostrappedEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.end();\n }\n }, { once: true });\n\n runtime.eventBus.addListener(MswReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"msw-ready\");\n }\n }, { once: true });\n\n runtime.eventBus.addListener(LocalModulesRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.module_count\": (payload as LocalModulesRegistrationStartedEventPayload).moduleCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-registration-started\", attributes);\n }\n\n localModuleRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"local-module-registration\", { ...options, attributes }, context);\n });\n }, { once: true });\n\n runtime.eventBus.addListener(LocalModulesRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-registration-completed\", {\n \"app.squide.module_count\": (payload as LocalModulesRegistrationCompletedEventPayload).moduleCount\n });\n }\n\n if (localModuleRegistrationSpan) {\n localModuleRegistrationSpan.end();\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModuleRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleRegistrationSpan) {\n traceError(localModuleRegistrationSpan, registrationError);\n }\n });\n\n runtime.eventBus.addListener(LocalModulesDeferredRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationStartedEventPayload).registrationCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-deferred-registration-started\", attributes);\n }\n\n localModuleDeferredRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"local-module-deferred-registration\", { ...options, attributes }, context);\n });\n }, { once: true });\n\n runtime.eventBus.addListener(LocalModulesDeferredRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-deferred-registration-completed\", {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationCompletedEventPayload).registrationCount\n });\n }\n\n if (localModuleDeferredRegistrationSpan) {\n localModuleDeferredRegistrationSpan.end();\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModuleDeferredRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleDeferredRegistrationSpan) {\n traceError(localModuleRegistrationSpan, registrationError);\n }\n });\n\n runtime.eventBus.addListener(RemoteModulesRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.remote_count\": (payload as RemoteModulesRegistrationStartedEventPayload).remoteCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-registration-started\", attributes);\n }\n\n remoteModuleRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"remote-module-registration\", { ...options, attributes }, context);\n });\n }, { once: true });\n\n runtime.eventBus.addListener(RemoteModulesRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-registration-completed\", {\n \"app.squide.remote_count\": (payload as RemoteModulesRegistrationCompletedEventPayload).remoteCount\n });\n }\n\n if (remoteModuleRegistrationSpan) {\n remoteModuleRegistrationSpan.end();\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModuleRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleRegistrationSpan) {\n traceError(remoteModuleRegistrationSpan, registrationError);\n }\n });\n\n runtime.eventBus.addListener(RemoteModulesDeferredRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationStartedEventPayload).registrationCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-deferred-registration-started\", attributes);\n }\n\n remoteModuleDeferredRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"remote-module-deferred-registration\", { ...options, attributes }, context);\n });\n }, { once: true });\n\n runtime.eventBus.addListener(RemoteModulesDeferredRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-deferred-registration-completed\", {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationCompletedEventPayload).registrationCount\n });\n }\n\n if (remoteModuleDeferredRegistrationSpan) {\n remoteModuleDeferredRegistrationSpan.end();\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModuleDeferredRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleDeferredRegistrationSpan) {\n traceError(remoteModuleDeferredRegistrationSpan, registrationError);\n }\n });\n\n const handleFetchDataStarted = () => {\n dataFetchSpan = startActiveChildSpan(bootstrappingSpan, (options, context) => {\n const name = \"data-fetch\";\n const span = getTracer().startSpan(name, options, context);\n\n return {\n name,\n span\n };\n });\n };\n\n const handleDataReady = () => {\n if (dataFetchSpan) {\n endActiveSpan(dataFetchSpan);\n }\n };\n\n const handlePublicDataFetchStarted = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"public-data-fetch-started\");\n }\n };\n\n const handlePublicDataReady = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"public-data-ready\");\n }\n };\n\n const handleProtectedDataFetchStarted = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"protected-data-fetch-started\");\n }\n };\n\n const handleProtectedDataReady = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"protected-data-ready\");\n }\n };\n\n reduceDataFetchEvents(\n runtime,\n handleFetchDataStarted,\n handleDataReady,\n handlePublicDataFetchStarted,\n handlePublicDataReady,\n handleProtectedDataFetchStarted,\n handleProtectedDataReady\n );\n\n runtime.eventBus.addListener(ModulesRegisteredEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-registered\");\n }\n }, { once: true });\n\n runtime.eventBus.addListener(ModulesReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-ready\");\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(DeferredRegistrationsUpdateStartedEvent, () => {\n deferredRegistrationsUpdateSpan = startSpan((options, context) => getTracer().startSpan(\"squide-deferred-registrations-update\", options, context));\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(DeferredRegistrationsUpdateCompletedEvent, () => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.end();\n }\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModulesDeferredRegistrationsUpdateStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationsUpdateStartedEventPayload).registrationCount\n };\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"local-module-deferred-registrations-update-started\", attributes);\n }\n\n localModuleDeferredRegistrationsUpdateSpan = startActiveChildSpan(deferredRegistrationsUpdateSpan, (options, context) => {\n const name = \"local-module-deferred-registrations-update\";\n\n const span = getTracer().startSpan(name, {\n attributes,\n ...options\n }, context);\n\n return {\n name,\n span\n };\n });\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModulesDeferredRegistrationsUpdateCompletedEvent, (payload: unknown) => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"local-module-deferred-registrations-update-completed\", {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationsUpdateCompletedEventPayload).registrationCount\n });\n }\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n endActiveSpan(localModuleDeferredRegistrationsUpdateSpan);\n }\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModuleDeferredRegistrationUpdateFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n traceError(localModuleDeferredRegistrationsUpdateSpan.instance, registrationError);\n }\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModulesDeferredRegistrationsUpdateStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationsUpdateStartedEventPayload).registrationCount\n };\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"remote-module-deferred-registrations-update-started\", attributes);\n }\n\n remoteModuleDeferredRegistrationsUpdateSpan = startActiveChildSpan(deferredRegistrationsUpdateSpan, (options, context) => {\n const name = \"remote-module-deferred-registrations-update\";\n\n const span = getTracer().startSpan(name, {\n attributes,\n ...options\n }, context);\n\n return {\n name,\n span\n };\n });\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModulesDeferredRegistrationsUpdateCompletedEvent, (payload: unknown) => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"remote-module-deferred-registrations-update-completed\", {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationsUpdateCompletedEventPayload).registrationCount\n });\n }\n\n if (remoteModuleDeferredRegistrationsUpdateSpan) {\n endActiveSpan(remoteModuleDeferredRegistrationsUpdateSpan);\n }\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModuleDeferredRegistrationUpdateFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleDeferredRegistrationsUpdateSpan) {\n traceError(remoteModuleDeferredRegistrationsUpdateSpan.instance, registrationError);\n }\n });\n}\n\nfunction getRegisterFetchRequestHookFunction() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK;\n}\n\nexport function registerHoneycombInstrumentation(runtime: FireflyRuntime) {\n const registerFetchRequestHookFunction = getRegisterFetchRequestHookFunction();\n\n if (registerFetchRequestHookFunction) {\n registerActiveSpanStack();\n\n const activeSpanOverrideFunction = createOverrideFetchRequestSpanWithActiveSpanContext(runtime.logger);\n\n // Dynamically registering this request hook function to nest the HTTP requests\n // of squide bootstrapping under the appropriate Honeycomb span.\n registerFetchRequestHookFunction(activeSpanOverrideFunction);\n } else {\n runtime.logger.warning(\"[squide] Cannot register Honeycomb fetch request hook because \\\"globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK\\\" is not available. Honeycomb instrumentation is still functional but in degraded mode.\");\n }\n\n registerTrackingListeners(runtime);\n\n // try {\n // const registerFetchRequestHookFunction = getRegisterFetchRequestHookFunction();\n\n // if (registerFetchRequestHookFunction) {\n // const overrideFetchRequestHook = createOverrideFetchRequestWithManifestSectionSpanContext(runtime.logger);\n\n // // Dynamically registering this request hook function to nest the HTTP requests\n // // of the widgets initialization under the appropriate Honeycomb span.\n // registerFetchRequestHookFunction(overrideFetchRequestHook);\n // } else {\n // runtime.logger.warning(\"[wlp-widgets] Cannot register Honeycomb fetch request hook because \\\"globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK\\\" is not available. Honeycomb instrumentation is still functional but in degraded mode.\");\n // }\n\n // registerTrackingListeners(runtime);\n // } catch (error: unknown) {\n // runtime.logger.error(\"[wlp-widgets] An error occured while registering Honeycomb instrumentation.\", error);\n // runtime.errorPropagator.propagate(error as Error);\n // }\n}\n\nexport function canRegisterHoneycombInstrumentation() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return globalThis.__WLP_HONEYCOMB_INSTRUMENTATION_IS_REGISTERED__ === true;\n}\n\n// export function registerHoneycombInstrumentation(runtime: FireflyRuntime, namespace: string, serviceName: NonNullable<HoneycombSdkOptions[\"serviceName\"]>, apiServiceUrls: PropagateTraceHeaderCorsUrls, options?: RegisterHoneycombInstrumentationOptions) {\n// const augmentedOptions = getInstrumentationOptions(runtime, options);\n\n// registerWorkleapHoneycombInstrumentation(namespace, serviceName, apiServiceUrls, augmentedOptions);\n\n// registerTrackingListeners(runtime);\n// registerActiveSpanStack();\n// }\n"],"names":["LocalModuleDeferredRegistrationFailedEvent","LocalModuleDeferredRegistrationUpdateFailedEvent","LocalModuleRegistrationFailedEvent","LocalModulesDeferredRegistrationCompletedEvent","LocalModulesDeferredRegistrationStartedEvent","LocalModulesDeferredRegistrationsUpdateCompletedEvent","LocalModulesDeferredRegistrationsUpdateStartedEvent","LocalModulesRegistrationCompletedEvent","LocalModulesRegistrationStartedEvent","DeferredRegistrationsUpdateCompletedEvent","DeferredRegistrationsUpdateStartedEvent","RemoteModuleDeferredRegistrationFailedEvent","RemoteModuleDeferredRegistrationUpdateFailedEvent","RemoteModuleRegistrationFailedEvent","RemoteModulesDeferredRegistrationCompletedEvent","RemoteModulesDeferredRegistrationStartedEvent","RemoteModulesDeferredRegistrationsUpdateCompletedEvent","RemoteModulesDeferredRegistrationsUpdateStartedEvent","RemoteModulesRegistrationCompletedEvent","RemoteModulesRegistrationStartedEvent","ApplicationBoostrappedEvent","ModulesReadyEvent","ModulesRegisteredEvent","MswReadyEvent","ProtectedDataReadyEvent","PublicDataReadyEvent","ApplicationBootstrappingStartedEvent","ProtectedDataFetchStartedEvent","PublicDataFetchStartedEvent","createOverrideFetchRequestSpanWithActiveSpanContext","registerActiveSpanStack","getTracer","endActiveSpan","startActiveChildSpan","startChildSpan","startSpan","traceError","reduceDataFetchEvents","runtime","onDataFetchingStarted","onDataReady","onPublicDataFetchStarted","onPublicDataReady","onProtectedDataFetchStarted","onProtectedDataReady","dataFetchState","registerTrackingListeners","bootstrappingSpan","localModuleRegistrationSpan","localModuleDeferredRegistrationSpan","remoteModuleRegistrationSpan","remoteModuleDeferredRegistrationSpan","dataFetchSpan","deferredRegistrationsUpdateSpan","localModuleDeferredRegistrationsUpdateSpan","remoteModuleDeferredRegistrationsUpdateSpan","options","context","payload","attributes","registrationError","handleFetchDataStarted","name","span","handleDataReady","handlePublicDataFetchStarted","handlePublicDataReady","handleProtectedDataFetchStarted","handleProtectedDataReady","getRegisterFetchRequestHookFunction","globalThis","registerHoneycombInstrumentation","registerFetchRequestHookFunction","activeSpanOverrideFunction","canRegisterHoneycombInstrumentation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBsB;AAoBa;AAC2I;AAE/F;AACA;AACN;AACuD;AACxF;AACgE;AAOjG,SAASqC,sBACZC,OAAuB,EACvBC,qBAAiC,EACjCC,WAAuB,EACvBC,wBAAoC,EACpCC,iBAA6B,EAC7BC,2BAAuC,EACvCC,oBAAgC;IAEhC,IAAIC,iBAAiC;IAErC,4DAA4D;IAC5DP,QAAQ,QAAQ,CAAC,WAAW,CAACV,yFAA2BA,EAAE;QACtD,IAAIiB,mBAAmB,QAAQ;YAC3BA,iBAAiB;YACjBN;QACJ;QAEAE;IACJ;IAEA,4DAA4D;IAC5DH,QAAQ,QAAQ,CAAC,WAAW,CAACb,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OAAuB;IACpE,MAAMkC,mCAAmCH;IAEzC,IAAIG,kCAAkC;QAClC1C,+EAAuBA;QAEvB,MAAM2C,6BAA6B5C,2GAAmDA,CAACS,QAAQ,MAAM;QAErG,+EAA+E;QAC/E,gEAAgE;QAChEkC,iCAAiCC;IACrC,OAAO;QACHnC,QAAQ,MAAM,CAAC,OAAO,CAAC;IAC3B;IAEAQ,0BAA0BR;AAE1B,QAAQ;AACR,sFAAsF;AAEtF,8CAA8C;AAC9C,qHAAqH;AAErH,0FAA0F;AAC1F,iFAAiF;AACjF,sEAAsE;AACtE,eAAe;AACf,iQAAiQ;AACjQ,QAAQ;AAER,0CAA0C;AAC1C,6BAA6B;AAC7B,kHAAkH;AAClH,yDAAyD;AACzD,IAAI;AACR;AAEO,SAASoC;IACZ,6DAA6D;IAC7D,aAAa;IACb,OAAOJ,WAAW,+CAA+C,KAAK;AAC1E,EAEA,gQAAgQ;CAChQ,4EAA4E;CAE5E,0GAA0G;CAE1G,0CAA0C;CAC1C,iCAAiC;CACjC,IAAI"}
1
+ {"version":3,"file":"honeycomb/registerHoneycombInstrumentation.js","sources":["webpack://@squide/firefly/./src/honeycomb/registerHoneycombInstrumentation.ts"],"sourcesContent":["import type { Span } from \"@opentelemetry/api\";\nimport {\n LocalModuleDeferredRegistrationFailedEvent,\n LocalModuleDeferredRegistrationUpdateFailedEvent,\n LocalModuleRegistrationFailedEvent,\n LocalModulesDeferredRegistrationCompletedEvent,\n type LocalModulesDeferredRegistrationCompletedEventPayload,\n LocalModulesDeferredRegistrationStartedEvent,\n type LocalModulesDeferredRegistrationStartedEventPayload,\n LocalModulesDeferredRegistrationsUpdateCompletedEvent,\n type LocalModulesDeferredRegistrationsUpdateCompletedEventPayload,\n LocalModulesDeferredRegistrationsUpdateStartedEvent,\n type LocalModulesDeferredRegistrationsUpdateStartedEventPayload,\n LocalModulesRegistrationCompletedEvent,\n type LocalModulesRegistrationCompletedEventPayload,\n LocalModulesRegistrationStartedEvent,\n type LocalModulesRegistrationStartedEventPayload,\n type ModuleRegistrationError\n} from \"@squide/core\";\nimport {\n DeferredRegistrationsUpdateCompletedEvent,\n DeferredRegistrationsUpdateStartedEvent,\n RemoteModuleDeferredRegistrationFailedEvent,\n RemoteModuleDeferredRegistrationUpdateFailedEvent,\n type RemoteModuleRegistrationError,\n RemoteModuleRegistrationFailedEvent,\n RemoteModulesDeferredRegistrationCompletedEvent,\n type RemoteModulesDeferredRegistrationCompletedEventPayload,\n RemoteModulesDeferredRegistrationStartedEvent,\n type RemoteModulesDeferredRegistrationStartedEventPayload,\n RemoteModulesDeferredRegistrationsUpdateCompletedEvent,\n type RemoteModulesDeferredRegistrationsUpdateCompletedEventPayload,\n RemoteModulesDeferredRegistrationsUpdateStartedEvent,\n type RemoteModulesDeferredRegistrationsUpdateStartedEventPayload,\n RemoteModulesRegistrationCompletedEvent,\n type RemoteModulesRegistrationCompletedEventPayload,\n RemoteModulesRegistrationStartedEvent,\n type RemoteModulesRegistrationStartedEventPayload\n} from \"@squide/module-federation\";\nimport { ApplicationBoostrappedEvent, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, PublicDataReadyEvent } from \"../AppRouterReducer.ts\";\nimport type { FireflyRuntime } from \"../FireflyRuntime.tsx\";\nimport { ApplicationBootstrappingStartedEvent } from \"../initializeFirefly.ts\";\nimport { ProtectedDataFetchStartedEvent } from \"../useProtectedDataQueries.ts\";\nimport { PublicDataFetchStartedEvent } from \"../usePublicDataQueries.ts\";\nimport { type ActiveSpan, createOverrideFetchRequestSpanWithActiveSpanContext, registerActiveSpanStack } from \"./activeSpan.ts\";\nimport { getTracer } from \"./tracer.ts\";\nimport { endActiveSpan, startActiveChildSpan, startChildSpan, startSpan, traceError } from \"./utils.ts\";\n\n// TIPS:\n// To query those traces in Honeycomb, use the following query filter: \"root.name = squide-bootstrapping\".\n\ntype DataFetchState = \"none\" | \"fetching-data\" | \"public-data-ready\" | \"protected-data-ready\" | \"data-ready\";\n\nexport function reduceDataFetchEvents(\n runtime: FireflyRuntime,\n onDataFetchingStarted: () => void,\n onDataReady: () => void,\n onPublicDataFetchStarted: () => void,\n onPublicDataReady: () => void,\n onProtectedDataFetchStarted: () => void,\n onProtectedDataReady: () => void\n) {\n let dataFetchState: DataFetchState = \"none\";\n\n // TODO: Validate if this handler should use { once: true }.\n runtime.eventBus.addListener(PublicDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchingStarted();\n }\n\n onPublicDataFetchStarted();\n });\n\n // TODO: Validate if this handler should use { once: true }.\n runtime.eventBus.addListener(PublicDataReadyEvent, () => {\n onPublicDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n dataFetchState = \"public-data-ready\";\n } else if (dataFetchState === \"protected-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n });\n\n // TODO: Validate if this handler should use { once: true }.\n runtime.eventBus.addListener(ProtectedDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchingStarted();\n }\n\n onProtectedDataFetchStarted();\n });\n\n // TODO: Validate if this handler should use { once: true }.\n runtime.eventBus.addListener(ProtectedDataReadyEvent, () => {\n onProtectedDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n dataFetchState = \"protected-data-ready\";\n } else if (dataFetchState === \"public-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n });\n}\n\nfunction registerTrackingListeners(runtime: FireflyRuntime) {\n let bootstrappingSpan: Span;\n let localModuleRegistrationSpan: Span;\n let localModuleDeferredRegistrationSpan: Span;\n let remoteModuleRegistrationSpan: Span;\n let remoteModuleDeferredRegistrationSpan: Span;\n let dataFetchSpan: ActiveSpan;\n let deferredRegistrationsUpdateSpan: Span;\n let localModuleDeferredRegistrationsUpdateSpan: ActiveSpan;\n let remoteModuleDeferredRegistrationsUpdateSpan: ActiveSpan;\n\n runtime.eventBus.addListener(ApplicationBootstrappingStartedEvent, () => {\n bootstrappingSpan = startSpan((options, context) => getTracer().startSpan(\"squide-bootstrapping\", options, context));\n }, { once: true });\n\n runtime.eventBus.addListener(ApplicationBoostrappedEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.end();\n }\n }, { once: true });\n\n runtime.eventBus.addListener(MswReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"msw-ready\");\n }\n }, { once: true });\n\n runtime.eventBus.addListener(LocalModulesRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.module_count\": (payload as LocalModulesRegistrationStartedEventPayload).moduleCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-registration-started\", attributes);\n }\n\n localModuleRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"local-module-registration\", { ...options, attributes }, context);\n });\n }, { once: true });\n\n runtime.eventBus.addListener(LocalModulesRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-registration-completed\", {\n \"app.squide.module_count\": (payload as LocalModulesRegistrationCompletedEventPayload).moduleCount\n });\n }\n\n if (localModuleRegistrationSpan) {\n localModuleRegistrationSpan.end();\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModuleRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleRegistrationSpan) {\n traceError(localModuleRegistrationSpan, registrationError);\n }\n });\n\n runtime.eventBus.addListener(LocalModulesDeferredRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationStartedEventPayload).registrationCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-deferred-registration-started\", attributes);\n }\n\n localModuleDeferredRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"local-module-deferred-registration\", { ...options, attributes }, context);\n });\n }, { once: true });\n\n runtime.eventBus.addListener(LocalModulesDeferredRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-deferred-registration-completed\", {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationCompletedEventPayload).registrationCount\n });\n }\n\n if (localModuleDeferredRegistrationSpan) {\n localModuleDeferredRegistrationSpan.end();\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModuleDeferredRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleDeferredRegistrationSpan) {\n traceError(localModuleRegistrationSpan, registrationError);\n }\n });\n\n runtime.eventBus.addListener(RemoteModulesRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.remote_count\": (payload as RemoteModulesRegistrationStartedEventPayload).remoteCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-registration-started\", attributes);\n }\n\n remoteModuleRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"remote-module-registration\", { ...options, attributes }, context);\n });\n }, { once: true });\n\n runtime.eventBus.addListener(RemoteModulesRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-registration-completed\", {\n \"app.squide.remote_count\": (payload as RemoteModulesRegistrationCompletedEventPayload).remoteCount\n });\n }\n\n if (remoteModuleRegistrationSpan) {\n remoteModuleRegistrationSpan.end();\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModuleRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleRegistrationSpan) {\n traceError(remoteModuleRegistrationSpan, registrationError);\n }\n });\n\n runtime.eventBus.addListener(RemoteModulesDeferredRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationStartedEventPayload).registrationCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-deferred-registration-started\", attributes);\n }\n\n remoteModuleDeferredRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"remote-module-deferred-registration\", { ...options, attributes }, context);\n });\n }, { once: true });\n\n runtime.eventBus.addListener(RemoteModulesDeferredRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-deferred-registration-completed\", {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationCompletedEventPayload).registrationCount\n });\n }\n\n if (remoteModuleDeferredRegistrationSpan) {\n remoteModuleDeferredRegistrationSpan.end();\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModuleDeferredRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleDeferredRegistrationSpan) {\n traceError(remoteModuleDeferredRegistrationSpan, registrationError);\n }\n });\n\n const handleFetchDataStarted = () => {\n dataFetchSpan = startActiveChildSpan(bootstrappingSpan, (options, context) => {\n const name = \"data-fetch\";\n const span = getTracer().startSpan(name, options, context);\n\n return {\n name,\n span\n };\n });\n };\n\n const handleDataReady = () => {\n if (dataFetchSpan) {\n endActiveSpan(dataFetchSpan);\n }\n };\n\n const handlePublicDataFetchStarted = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"public-data-fetch-started\");\n }\n };\n\n const handlePublicDataReady = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"public-data-ready\");\n }\n };\n\n const handleProtectedDataFetchStarted = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"protected-data-fetch-started\");\n }\n };\n\n const handleProtectedDataReady = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"protected-data-ready\");\n }\n };\n\n reduceDataFetchEvents(\n runtime,\n handleFetchDataStarted,\n handleDataReady,\n handlePublicDataFetchStarted,\n handlePublicDataReady,\n handleProtectedDataFetchStarted,\n handleProtectedDataReady\n );\n\n runtime.eventBus.addListener(ModulesRegisteredEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-registered\");\n }\n }, { once: true });\n\n runtime.eventBus.addListener(ModulesReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-ready\");\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(DeferredRegistrationsUpdateStartedEvent, () => {\n deferredRegistrationsUpdateSpan = startSpan((options, context) => getTracer().startSpan(\"squide-deferred-registrations-update\", options, context));\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(DeferredRegistrationsUpdateCompletedEvent, () => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.end();\n }\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModulesDeferredRegistrationsUpdateStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationsUpdateStartedEventPayload).registrationCount\n };\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"local-module-deferred-registrations-update-started\", attributes);\n }\n\n localModuleDeferredRegistrationsUpdateSpan = startActiveChildSpan(deferredRegistrationsUpdateSpan, (options, context) => {\n const name = \"local-module-deferred-registrations-update\";\n\n const span = getTracer().startSpan(name, {\n attributes,\n ...options\n }, context);\n\n return {\n name,\n span\n };\n });\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModulesDeferredRegistrationsUpdateCompletedEvent, (payload: unknown) => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"local-module-deferred-registrations-update-completed\", {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationsUpdateCompletedEventPayload).registrationCount\n });\n }\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n endActiveSpan(localModuleDeferredRegistrationsUpdateSpan);\n }\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModuleDeferredRegistrationUpdateFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n traceError(localModuleDeferredRegistrationsUpdateSpan.instance, registrationError);\n }\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModulesDeferredRegistrationsUpdateStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationsUpdateStartedEventPayload).registrationCount\n };\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"remote-module-deferred-registrations-update-started\", attributes);\n }\n\n remoteModuleDeferredRegistrationsUpdateSpan = startActiveChildSpan(deferredRegistrationsUpdateSpan, (options, context) => {\n const name = \"remote-module-deferred-registrations-update\";\n\n const span = getTracer().startSpan(name, {\n attributes,\n ...options\n }, context);\n\n return {\n name,\n span\n };\n });\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModulesDeferredRegistrationsUpdateCompletedEvent, (payload: unknown) => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"remote-module-deferred-registrations-update-completed\", {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationsUpdateCompletedEventPayload).registrationCount\n });\n }\n\n if (remoteModuleDeferredRegistrationsUpdateSpan) {\n endActiveSpan(remoteModuleDeferredRegistrationsUpdateSpan);\n }\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModuleDeferredRegistrationUpdateFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleDeferredRegistrationsUpdateSpan) {\n traceError(remoteModuleDeferredRegistrationsUpdateSpan.instance, registrationError);\n }\n });\n}\n\nfunction getRegisterFetchRequestHookFunction() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK;\n}\n\nexport function registerHoneycombInstrumentation(runtime: FireflyRuntime) {\n const registerFetchRequestHookFunction = getRegisterFetchRequestHookFunction();\n\n if (registerFetchRequestHookFunction) {\n registerActiveSpanStack();\n\n const activeSpanOverrideFunction = createOverrideFetchRequestSpanWithActiveSpanContext(runtime.logger);\n\n // Dynamically registering this request hook function to nest the HTTP requests\n // of squide bootstrapping under the appropriate Honeycomb span.\n registerFetchRequestHookFunction(activeSpanOverrideFunction);\n } else {\n runtime.logger.warning(\"[squide] Cannot register Honeycomb fetch request hook because \\\"globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK\\\" is not available. Honeycomb instrumentation is still functional but in degraded mode.\");\n }\n\n registerTrackingListeners(runtime);\n}\n"],"names":["LocalModuleDeferredRegistrationFailedEvent","LocalModuleDeferredRegistrationUpdateFailedEvent","LocalModuleRegistrationFailedEvent","LocalModulesDeferredRegistrationCompletedEvent","LocalModulesDeferredRegistrationStartedEvent","LocalModulesDeferredRegistrationsUpdateCompletedEvent","LocalModulesDeferredRegistrationsUpdateStartedEvent","LocalModulesRegistrationCompletedEvent","LocalModulesRegistrationStartedEvent","DeferredRegistrationsUpdateCompletedEvent","DeferredRegistrationsUpdateStartedEvent","RemoteModuleDeferredRegistrationFailedEvent","RemoteModuleDeferredRegistrationUpdateFailedEvent","RemoteModuleRegistrationFailedEvent","RemoteModulesDeferredRegistrationCompletedEvent","RemoteModulesDeferredRegistrationStartedEvent","RemoteModulesDeferredRegistrationsUpdateCompletedEvent","RemoteModulesDeferredRegistrationsUpdateStartedEvent","RemoteModulesRegistrationCompletedEvent","RemoteModulesRegistrationStartedEvent","ApplicationBoostrappedEvent","ModulesReadyEvent","ModulesRegisteredEvent","MswReadyEvent","ProtectedDataReadyEvent","PublicDataReadyEvent","ApplicationBootstrappingStartedEvent","ProtectedDataFetchStartedEvent","PublicDataFetchStartedEvent","createOverrideFetchRequestSpanWithActiveSpanContext","registerActiveSpanStack","getTracer","endActiveSpan","startActiveChildSpan","startChildSpan","startSpan","traceError","reduceDataFetchEvents","runtime","onDataFetchingStarted","onDataReady","onPublicDataFetchStarted","onPublicDataReady","onProtectedDataFetchStarted","onProtectedDataReady","dataFetchState","registerTrackingListeners","bootstrappingSpan","localModuleRegistrationSpan","localModuleDeferredRegistrationSpan","remoteModuleRegistrationSpan","remoteModuleDeferredRegistrationSpan","dataFetchSpan","deferredRegistrationsUpdateSpan","localModuleDeferredRegistrationsUpdateSpan","remoteModuleDeferredRegistrationsUpdateSpan","options","context","payload","attributes","registrationError","handleFetchDataStarted","name","span","handleDataReady","handlePublicDataFetchStarted","handlePublicDataReady","handleProtectedDataFetchStarted","handleProtectedDataReady","getRegisterFetchRequestHookFunction","globalThis","registerHoneycombInstrumentation","registerFetchRequestHookFunction","activeSpanOverrideFunction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBsB;AAoBa;AAC2I;AAE/F;AACA;AACN;AACuD;AACxF;AACgE;AAOjG,SAASqC,sBACZC,OAAuB,EACvBC,qBAAiC,EACjCC,WAAuB,EACvBC,wBAAoC,EACpCC,iBAA6B,EAC7BC,2BAAuC,EACvCC,oBAAgC;IAEhC,IAAIC,iBAAiC;IAErC,4DAA4D;IAC5DP,QAAQ,QAAQ,CAAC,WAAW,CAACV,yFAA2BA,EAAE;QACtD,IAAIiB,mBAAmB,QAAQ;YAC3BA,iBAAiB;YACjBN;QACJ;QAEAE;IACJ;IAEA,4DAA4D;IAC5DH,QAAQ,QAAQ,CAAC,WAAW,CAACb,8EAAoBA,EAAE;QAC/CiB;QAEA,IAAIG,mBAAmB,iBAAiB;YACpCA,iBAAiB;QACrB,OAAO,IAAIA,mBAAmB,wBAAwB;YAClDA,iBAAiB;YACjBL;QACJ;IACJ;IAEA,4DAA4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gE;QAChEkC,iCAAiCC;IACrC,OAAO;QACHnC,QAAQ,MAAM,CAAC,OAAO,CAAC;IAC3B;IAEAQ,0BAA0BR;AAC9B"}
@@ -2,7 +2,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__squide_core_7a405b8f__ from "@squide/core
2
2
  import * as __WEBPACK_EXTERNAL_MODULE__squide_module_federation_054d2ec6__ from "@squide/module-federation";
3
3
  import * as __WEBPACK_EXTERNAL_MODULE__squide_msw_9f7e76df__ from "@squide/msw";
4
4
  import * as __WEBPACK_EXTERNAL_MODULE__FireflyRuntime_js_318ddfd4__ from "./FireflyRuntime.js";
5
- import * as __WEBPACK_EXTERNAL_MODULE__honeycomb_registerHoneycombInstrumentation_js_7e4b567c__ from "./honeycomb/registerHoneycombInstrumentation.js";
5
+ import * as __WEBPACK_EXTERNAL_MODULE__honeycomb_initializeHoneycomb_js_8415d7e6__ from "./honeycomb/initializeHoneycomb.js";
6
6
 
7
7
  ;// CONCATENATED MODULE: external "@squide/core"
8
8
 
@@ -12,7 +12,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__honeycomb_registerHoneycombInstrumentatio
12
12
 
13
13
  ;// CONCATENATED MODULE: external "./FireflyRuntime.js"
14
14
 
15
- ;// CONCATENATED MODULE: external "./honeycomb/registerHoneycombInstrumentation.js"
15
+ ;// CONCATENATED MODULE: external "./honeycomb/initializeHoneycomb.js"
16
16
 
17
17
  ;// CONCATENATED MODULE: ./src/initializeFirefly.ts
18
18
 
@@ -59,7 +59,7 @@ function bootstrap(runtime, options = {}) {
59
59
  }
60
60
  let hasExecuted = false;
61
61
  function initializeFirefly(options = {}) {
62
- const { mode, useMsw, loggers, plugins } = options;
62
+ const { mode, useMsw, loggers, plugins, onError } = options;
63
63
  if (hasExecuted) {
64
64
  throw new Error("[squide] A squide application can only be initialized once. Did you call the \"initializeSquide\" function twice?");
65
65
  }
@@ -70,12 +70,13 @@ function initializeFirefly(options = {}) {
70
70
  loggers,
71
71
  plugins
72
72
  });
73
- if ((0,__WEBPACK_EXTERNAL_MODULE__honeycomb_registerHoneycombInstrumentation_js_7e4b567c__.canRegisterHoneycombInstrumentation)()) {
74
- (0,__WEBPACK_EXTERNAL_MODULE__honeycomb_registerHoneycombInstrumentation_js_7e4b567c__.registerHoneycombInstrumentation)(runtime);
75
- } else {
76
- runtime.logger.debug("[squide] Cannot register Honeycomb instrumentation because the host application is not using the \"@workleap/honeycomb\" package.");
77
- }
78
- bootstrap(runtime, options);
73
+ (0,__WEBPACK_EXTERNAL_MODULE__honeycomb_initializeHoneycomb_js_8415d7e6__.initializeHoneycomb)(runtime).catch((error)=>{
74
+ if (onError) {
75
+ onError(error);
76
+ }
77
+ }).finally(()=>{
78
+ bootstrap(runtime, options);
79
+ });
79
80
  return runtime;
80
81
  }
81
82
  function __resetHasExecuteGuard() {
@@ -1 +1 @@
1
- {"version":3,"file":"initializeFirefly.js","sources":["webpack://@squide/firefly/./src/initializeFirefly.ts"],"sourcesContent":["import { isFunction, registerLocalModules, type ModuleRegisterFunction, type RegisterModulesOptions } from \"@squide/core\";\nimport { registerRemoteModules, type RemoteDefinition } from \"@squide/module-federation\";\nimport { setMswAsReady } from \"@squide/msw\";\nimport { FireflyRuntime, type FireflyRuntimeOptions } from \"./FireflyRuntime.tsx\";\nimport { canRegisterHoneycombInstrumentation, registerHoneycombInstrumentation } from \"./honeycomb/registerHoneycombInstrumentation.ts\";\n\nexport const ApplicationBootstrappingStartedEvent = \"squide-app-bootstrapping-started\";\n\nexport type OnInitializationErrorFunction = (error: unknown) => void;\n\nexport type StartMswFunction<TRuntime = FireflyRuntime> = (runtime: TRuntime) => Promise<void>;\n\nexport interface InitializeFireflyOptions<TRuntime extends FireflyRuntime, TContext = unknown, TData = unknown> extends RegisterModulesOptions<TContext>, FireflyRuntimeOptions {\n localModules?: ModuleRegisterFunction<TRuntime, TContext, TData>[];\n remotes?: RemoteDefinition[];\n startMsw?: StartMswFunction<FireflyRuntime>;\n onError?: OnInitializationErrorFunction;\n}\n\nfunction propagateRegistrationErrors(results: PromiseSettledResult<unknown[]>, onError: OnInitializationErrorFunction) {\n if (results) {\n if (results.status === \"fulfilled\") {\n results.value.forEach(x => {\n onError(x);\n });\n }\n }\n}\n\nexport function bootstrap<TRuntime extends FireflyRuntime = FireflyRuntime, TContext = unknown, TData = unknown>(runtime: TRuntime, options: InitializeFireflyOptions<TRuntime, TContext, TData> = {}) {\n const {\n localModules = [],\n remotes = [],\n startMsw,\n onError,\n context\n } = options;\n\n runtime.eventBus.dispatch(ApplicationBootstrappingStartedEvent);\n\n Promise.allSettled([\n registerLocalModules<TRuntime, TContext, TData>(localModules, runtime, { context }),\n registerRemoteModules(remotes, runtime, { context })\n ]).then(results => {\n if (runtime.isMswEnabled) {\n if (!isFunction(startMsw)) {\n throw new Error(\"[squide] When MSW is enabled, the \\\"startMsw\\\" function must be provided.\");\n }\n\n startMsw(runtime)\n .then(() => {\n setMswAsReady();\n })\n .catch((error: unknown) => {\n runtime.logger.debug(\"[squide] An error occured while starting MSW.\", error);\n });\n }\n\n if (onError) {\n propagateRegistrationErrors(results[0], onError);\n propagateRegistrationErrors(results[1], onError);\n }\n });\n}\n\nlet hasExecuted = false;\n\nexport function initializeFirefly<TContext = unknown, TData = unknown>(options: InitializeFireflyOptions<FireflyRuntime, TContext, TData> = {}) {\n const {\n mode,\n useMsw,\n loggers,\n plugins\n } = options;\n\n if (hasExecuted) {\n throw new Error(\"[squide] A squide application can only be initialized once. Did you call the \\\"initializeSquide\\\" function twice?\");\n }\n\n hasExecuted = true;\n\n const runtime = new FireflyRuntime({\n mode,\n useMsw,\n loggers,\n plugins\n });\n\n if (canRegisterHoneycombInstrumentation()) {\n registerHoneycombInstrumentation(runtime);\n } else {\n runtime.logger.debug(\"[squide] Cannot register Honeycomb instrumentation because the host application is not using the \\\"@workleap/honeycomb\\\" package.\");\n }\n\n bootstrap(runtime, options);\n\n return runtime;\n}\n\nexport function __resetHasExecuteGuard() {\n hasExecuted = false;\n}\n"],"names":["isFunction","registerLocalModules","registerRemoteModules","setMswAsReady","FireflyRuntime","canRegisterHoneycombInstrumentation","registerHoneycombInstrumentation","ApplicationBootstrappingStartedEvent","propagateRegistrationErrors","results","onError","x","bootstrap","runtime","options","localModules","remotes","startMsw","context","Promise","Error","error","hasExecuted","initializeFirefly","mode","useMsw","loggers","plugins","__resetHasExecuteGuard"],"mappings":";;;;;;;;;;;;;;;;;AAA0H;AACjC;AAC7C;AACsC;AACsD;AAEjI,MAAMO,uCAAuC,mCAAmC;AAavF,SAASC,4BAA4BC,OAAwC,EAAEC,OAAsC;IACjH,IAAID,SAAS;QACT,IAAIA,QAAQ,MAAM,KAAK,aAAa;YAChCA,QAAQ,KAAK,CAAC,OAAO,CAACE,CAAAA;gBAClBD,QAAQC;YACZ;QACJ;IACJ;AACJ;AAEO,SAASC,UAAiGC,OAAiB,EAAEC,UAA+D,CAAC,CAAC;IACjM,MAAM,EACFC,eAAe,EAAE,EACjBC,UAAU,EAAE,EACZC,QAAQ,EACRP,OAAO,EACPQ,OAAO,EACV,GAAGJ;IAEJD,QAAQ,QAAQ,CAAC,QAAQ,CAACN;IAE1BY,QAAQ,UAAU,CAAC;QACflB,0EAAoBA,CAA4Bc,cAAcF,SAAS;YAAEK;QAAQ;QACjFhB,wFAAqBA,CAACc,SAASH,SAAS;YAAEK;QAAQ;KACrD,EAAE,IAAI,CAACT,CAAAA;QACJ,IAAII,QAAQ,YAAY,EAAE;YACtB,IAAI,CAACb,gEAAUA,CAACiB,WAAW;gBACvB,MAAM,IAAIG,MAAM;YACpB;YAEAH,SAASJ,SACJ,IAAI,CAAC;gBACFV,kEAAaA;YACjB,GACC,KAAK,CAAC,CAACkB;gBACJR,QAAQ,MAAM,CAAC,KAAK,CAAC,iDAAiDQ;YAC1E;QACR;QAEA,IAAIX,SAAS;YACTF,4BAA4BC,OAAO,CAAC,EAAE,EAAEC;YACxCF,4BAA4BC,OAAO,CAAC,EAAE,EAAEC;QAC5C;IACJ;AACJ;AAEA,IAAIY,cAAc;AAEX,SAASC,kBAAuDT,UAAqE,CAAC,CAAC;IAC1I,MAAM,EACFU,IAAI,EACJC,MAAM,EACNC,OAAO,EACPC,OAAO,EACV,GAAGb;IAEJ,IAAIQ,aAAa;QACb,MAAM,IAAIF,MAAM;IACpB;IAEAE,cAAc;IAEd,MAAMT,UAAU,IAAIT,sEAAcA,CAAC;QAC/BoB;QACAC;QACAC;QACAC;IACJ;IAEA,IAAItB,2HAAmCA,IAAI;QACvCC,wHAAgCA,CAACO;IACrC,OAAO;QACHA,QAAQ,MAAM,CAAC,KAAK,CAAC;IACzB;IAEAD,UAAUC,SAASC;IAEnB,OAAOD;AACX;AAEO,SAASe;IACZN,cAAc;AAClB"}
1
+ {"version":3,"file":"initializeFirefly.js","sources":["webpack://@squide/firefly/./src/initializeFirefly.ts"],"sourcesContent":["import { isFunction, registerLocalModules, type ModuleRegisterFunction, type RegisterModulesOptions } from \"@squide/core\";\nimport { registerRemoteModules, type RemoteDefinition } from \"@squide/module-federation\";\nimport { setMswAsReady } from \"@squide/msw\";\nimport { FireflyRuntime, type FireflyRuntimeOptions } from \"./FireflyRuntime.tsx\";\nimport { initializeHoneycomb } from \"./honeycomb/initializeHoneycomb.ts\";\n\nexport const ApplicationBootstrappingStartedEvent = \"squide-app-bootstrapping-started\";\n\nexport type OnInitializationErrorFunction = (error: unknown) => void;\n\nexport type StartMswFunction<TRuntime = FireflyRuntime> = (runtime: TRuntime) => Promise<void>;\n\nexport interface InitializeFireflyOptions<TRuntime extends FireflyRuntime, TContext = unknown, TData = unknown> extends RegisterModulesOptions<TContext>, FireflyRuntimeOptions {\n localModules?: ModuleRegisterFunction<TRuntime, TContext, TData>[];\n remotes?: RemoteDefinition[];\n startMsw?: StartMswFunction<FireflyRuntime>;\n onError?: OnInitializationErrorFunction;\n}\n\nfunction propagateRegistrationErrors(results: PromiseSettledResult<unknown[]>, onError: OnInitializationErrorFunction) {\n if (results) {\n if (results.status === \"fulfilled\") {\n results.value.forEach(x => {\n onError(x);\n });\n }\n }\n}\n\nexport function bootstrap<TRuntime extends FireflyRuntime = FireflyRuntime, TContext = unknown, TData = unknown>(runtime: TRuntime, options: InitializeFireflyOptions<TRuntime, TContext, TData> = {}) {\n const {\n localModules = [],\n remotes = [],\n startMsw,\n onError,\n context\n } = options;\n\n runtime.eventBus.dispatch(ApplicationBootstrappingStartedEvent);\n\n Promise.allSettled([\n registerLocalModules<TRuntime, TContext, TData>(localModules, runtime, { context }),\n registerRemoteModules(remotes, runtime, { context })\n ]).then(results => {\n if (runtime.isMswEnabled) {\n if (!isFunction(startMsw)) {\n throw new Error(\"[squide] When MSW is enabled, the \\\"startMsw\\\" function must be provided.\");\n }\n\n startMsw(runtime)\n .then(() => {\n setMswAsReady();\n })\n .catch((error: unknown) => {\n runtime.logger.debug(\"[squide] An error occured while starting MSW.\", error);\n });\n }\n\n if (onError) {\n propagateRegistrationErrors(results[0], onError);\n propagateRegistrationErrors(results[1], onError);\n }\n });\n}\n\nlet hasExecuted = false;\n\nexport function initializeFirefly<TContext = unknown, TData = unknown>(options: InitializeFireflyOptions<FireflyRuntime, TContext, TData> = {}) {\n const {\n mode,\n useMsw,\n loggers,\n plugins,\n onError\n } = options;\n\n if (hasExecuted) {\n throw new Error(\"[squide] A squide application can only be initialized once. Did you call the \\\"initializeSquide\\\" function twice?\");\n }\n\n hasExecuted = true;\n\n const runtime = new FireflyRuntime({\n mode,\n useMsw,\n loggers,\n plugins\n });\n\n initializeHoneycomb(runtime)\n .catch((error: unknown) => {\n if (onError) {\n onError(error);\n }\n })\n .finally(() => {\n bootstrap(runtime, options);\n });\n\n return runtime;\n}\n\nexport function __resetHasExecuteGuard() {\n hasExecuted = false;\n}\n"],"names":["isFunction","registerLocalModules","registerRemoteModules","setMswAsReady","FireflyRuntime","initializeHoneycomb","ApplicationBootstrappingStartedEvent","propagateRegistrationErrors","results","onError","x","bootstrap","runtime","options","localModules","remotes","startMsw","context","Promise","Error","error","hasExecuted","initializeFirefly","mode","useMs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AAc;IAEd,MAAMT,UAAU,IAAIR,sEAAcA,CAAC;QAC/BmB;QACAC;QACAC;QACAC;IACJ;IAEArB,8FAAmBA,CAACO,SACf,KAAK,CAAC,CAACQ;QACJ,IAAIX,SAAS;YACTA,QAAQW;QACZ;IACJ,GACC,OAAO,CAAC;QACLT,UAAUC,SAASC;IACvB;IAEJ,OAAOD;AACX;AAEO,SAASe;IACZN,cAAc;AAClB"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@squide/firefly",
3
3
  "author": "Workleap",
4
- "version": "13.0.0",
4
+ "version": "13.0.1",
5
5
  "description": "Helpers to facilitate the creation of an application with the Squide firefly technology stack.",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -35,17 +35,12 @@
35
35
  "react-dom": "^18.0.0 || ^19.0.0",
36
36
  "react-router": "^7.6.1"
37
37
  },
38
- "peerDependenciesMeta": {
39
- "@opentelemetry/api": {
40
- "optional": true
41
- }
42
- },
43
38
  "dependencies": {
44
39
  "uuid": "^11.1.0",
45
40
  "@squide/core": "5.4.8",
41
+ "@squide/module-federation": "6.2.8",
46
42
  "@squide/msw": "3.2.8",
47
- "@squide/react-router": "7.0.6",
48
- "@squide/module-federation": "6.2.8"
43
+ "@squide/react-router": "7.0.6"
49
44
  },
50
45
  "devDependencies": {
51
46
  "@rsbuild/core": "1.3.21",
@@ -0,0 +1,5 @@
1
+ export function canRegisterHoneycombInstrumentation() {
2
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3
+ // @ts-ignore
4
+ return globalThis.__WLP_HONEYCOMB_INSTRUMENTATION_IS_REGISTERED__ === true;
5
+ }
@@ -0,0 +1,22 @@
1
+ import type { FireflyRuntime } from "../FireflyRuntime.tsx";
2
+ import { canRegisterHoneycombInstrumentation } from "./canRegisterHoneycombInstrumentation.ts";
3
+
4
+ export async function initializeHoneycomb(runtime: FireflyRuntime) {
5
+ if (canRegisterHoneycombInstrumentation()) {
6
+ try {
7
+ // Dynamically import the Honeycomb instrumentation to prevent loading all the Honeycomb libraries
8
+ // if Honeycomb instrumentation is not registered by the hosting application.
9
+ const mod = await import("./registerHoneycombInstrumentation.ts");
10
+
11
+ mod.registerHoneycombInstrumentation(runtime);
12
+ } catch (error: unknown) {
13
+ runtime.logger.error("[squide] Failed to register Honeycomb instrumentation. The \"./registerHoneycombInstrumentation.ts\" cannot be imported.");
14
+
15
+ throw error;
16
+ }
17
+ } else {
18
+ runtime.logger.debug("[squide] Cannot register Honeycomb instrumentation because the host application is not using the \"@workleap/honeycomb\" package.");
19
+ }
20
+ }
21
+
22
+
@@ -467,38 +467,4 @@ export function registerHoneycombInstrumentation(runtime: FireflyRuntime) {
467
467
  }
468
468
 
469
469
  registerTrackingListeners(runtime);
470
-
471
- // try {
472
- // const registerFetchRequestHookFunction = getRegisterFetchRequestHookFunction();
473
-
474
- // if (registerFetchRequestHookFunction) {
475
- // const overrideFetchRequestHook = createOverrideFetchRequestWithManifestSectionSpanContext(runtime.logger);
476
-
477
- // // Dynamically registering this request hook function to nest the HTTP requests
478
- // // of the widgets initialization under the appropriate Honeycomb span.
479
- // registerFetchRequestHookFunction(overrideFetchRequestHook);
480
- // } else {
481
- // runtime.logger.warning("[wlp-widgets] Cannot register Honeycomb fetch request hook because \"globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK\" is not available. Honeycomb instrumentation is still functional but in degraded mode.");
482
- // }
483
-
484
- // registerTrackingListeners(runtime);
485
- // } catch (error: unknown) {
486
- // runtime.logger.error("[wlp-widgets] An error occured while registering Honeycomb instrumentation.", error);
487
- // runtime.errorPropagator.propagate(error as Error);
488
- // }
489
470
  }
490
-
491
- export function canRegisterHoneycombInstrumentation() {
492
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
493
- // @ts-ignore
494
- return globalThis.__WLP_HONEYCOMB_INSTRUMENTATION_IS_REGISTERED__ === true;
495
- }
496
-
497
- // export function registerHoneycombInstrumentation(runtime: FireflyRuntime, namespace: string, serviceName: NonNullable<HoneycombSdkOptions["serviceName"]>, apiServiceUrls: PropagateTraceHeaderCorsUrls, options?: RegisterHoneycombInstrumentationOptions) {
498
- // const augmentedOptions = getInstrumentationOptions(runtime, options);
499
-
500
- // registerWorkleapHoneycombInstrumentation(namespace, serviceName, apiServiceUrls, augmentedOptions);
501
-
502
- // registerTrackingListeners(runtime);
503
- // registerActiveSpanStack();
504
- // }
@@ -2,7 +2,7 @@ import { isFunction, registerLocalModules, type ModuleRegisterFunction, type Reg
2
2
  import { registerRemoteModules, type RemoteDefinition } from "@squide/module-federation";
3
3
  import { setMswAsReady } from "@squide/msw";
4
4
  import { FireflyRuntime, type FireflyRuntimeOptions } from "./FireflyRuntime.tsx";
5
- import { canRegisterHoneycombInstrumentation, registerHoneycombInstrumentation } from "./honeycomb/registerHoneycombInstrumentation.ts";
5
+ import { initializeHoneycomb } from "./honeycomb/initializeHoneycomb.ts";
6
6
 
7
7
  export const ApplicationBootstrappingStartedEvent = "squide-app-bootstrapping-started";
8
8
 
@@ -70,7 +70,8 @@ export function initializeFirefly<TContext = unknown, TData = unknown>(options:
70
70
  mode,
71
71
  useMsw,
72
72
  loggers,
73
- plugins
73
+ plugins,
74
+ onError
74
75
  } = options;
75
76
 
76
77
  if (hasExecuted) {
@@ -86,13 +87,15 @@ export function initializeFirefly<TContext = unknown, TData = unknown>(options:
86
87
  plugins
87
88
  });
88
89
 
89
- if (canRegisterHoneycombInstrumentation()) {
90
- registerHoneycombInstrumentation(runtime);
91
- } else {
92
- runtime.logger.debug("[squide] Cannot register Honeycomb instrumentation because the host application is not using the \"@workleap/honeycomb\" package.");
93
- }
94
-
95
- bootstrap(runtime, options);
90
+ initializeHoneycomb(runtime)
91
+ .catch((error: unknown) => {
92
+ if (onError) {
93
+ onError(error);
94
+ }
95
+ })
96
+ .finally(() => {
97
+ bootstrap(runtime, options);
98
+ });
96
99
 
97
100
  return runtime;
98
101
  }