@squide/firefly 15.0.4 → 16.0.0

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.
Files changed (70) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/AppRouter.js.map +1 -1
  3. package/dist/AppRouterContext.js.map +1 -1
  4. package/dist/AppRouterReducer.d.ts +3 -4
  5. package/dist/AppRouterReducer.js +51 -82
  6. package/dist/AppRouterReducer.js.map +1 -1
  7. package/dist/AppRouterStore.js.map +1 -1
  8. package/dist/FireflyPlugin.d.ts +6 -0
  9. package/dist/FireflyPlugin.js +6 -0
  10. package/dist/FireflyPlugin.js.map +1 -0
  11. package/dist/FireflyProvider.js.map +1 -1
  12. package/dist/FireflyRuntime.d.ts +9 -7
  13. package/dist/FireflyRuntime.js +20 -28
  14. package/dist/FireflyRuntime.js.map +1 -1
  15. package/dist/GlobalDataQueriesError.js.map +1 -1
  16. package/dist/RootRoute.js.map +1 -1
  17. package/dist/honeycomb/activeSpan.js.map +1 -1
  18. package/dist/honeycomb/createTraceContextId.js.map +1 -1
  19. package/dist/honeycomb/initializeHoneycomb.js.map +1 -1
  20. package/dist/honeycomb/registerHoneycombInstrumentation.d.ts +8 -0
  21. package/dist/honeycomb/registerHoneycombInstrumentation.js +19 -136
  22. package/dist/honeycomb/registerHoneycombInstrumentation.js.map +1 -1
  23. package/dist/honeycomb/tracer.js.map +1 -1
  24. package/dist/honeycomb/utils.js.map +1 -1
  25. package/dist/index.d.ts +2 -3
  26. package/dist/index.js +4 -5
  27. package/dist/index.js.map +1 -1
  28. package/dist/initializeFirefly.d.ts +6 -6
  29. package/dist/initializeFirefly.js +26 -35
  30. package/dist/initializeFirefly.js.map +1 -1
  31. package/dist/internal.d.ts +6 -0
  32. package/dist/internal.js +26 -0
  33. package/dist/internal.js.map +1 -0
  34. package/dist/useAppRouterStore.js.map +1 -1
  35. package/dist/useCanFetchProtectedData.js.map +1 -1
  36. package/dist/useCanFetchPublicData.js.map +1 -1
  37. package/dist/useCanRegisterDeferredRegistrations.js.map +1 -1
  38. package/dist/useCanUpdateDeferredRegistrations.js.map +1 -1
  39. package/dist/useDeferredRegistrations.d.ts +1 -5
  40. package/dist/useDeferredRegistrations.js +2 -5
  41. package/dist/useDeferredRegistrations.js.map +1 -1
  42. package/dist/useExecuteOnce.js.map +1 -1
  43. package/dist/useIsActiveRouteProtected.js.map +1 -1
  44. package/dist/useIsBootstrapping.js.map +1 -1
  45. package/dist/useNavigationItems.js.map +1 -1
  46. package/dist/useProtectedDataHandler.js.map +1 -1
  47. package/dist/useProtectedDataQueries.js.map +1 -1
  48. package/dist/usePublicDataHandler.js.map +1 -1
  49. package/dist/usePublicDataQueries.js.map +1 -1
  50. package/dist/useRegisterDeferredRegistrations.d.ts +1 -4
  51. package/dist/useRegisterDeferredRegistrations.js +1 -5
  52. package/dist/useRegisterDeferredRegistrations.js.map +1 -1
  53. package/dist/useStrictRegistrationMode.js +10 -17
  54. package/dist/useStrictRegistrationMode.js.map +1 -1
  55. package/dist/useUpdateDeferredRegistrations.d.ts +3 -4
  56. package/dist/useUpdateDeferredRegistrations.js +6 -6
  57. package/dist/useUpdateDeferredRegistrations.js.map +1 -1
  58. package/package.json +30 -28
  59. package/src/AppRouterReducer.ts +62 -100
  60. package/src/FireflyPlugin.ts +11 -0
  61. package/src/FireflyRuntime.tsx +31 -34
  62. package/src/honeycomb/initializeHoneycomb.ts +0 -2
  63. package/src/honeycomb/registerHoneycombInstrumentation.ts +30 -169
  64. package/src/index.ts +14 -3
  65. package/src/initializeFirefly.ts +51 -48
  66. package/src/internal.ts +22 -0
  67. package/src/useDeferredRegistrations.ts +3 -12
  68. package/src/useRegisterDeferredRegistrations.ts +1 -2
  69. package/src/useStrictRegistrationMode.ts +10 -15
  70. package/src/useUpdateDeferredRegistrations.ts +8 -2
@@ -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 type AddListenerOptions,\n type EventCallbackFunction,\n type EventName,\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, type AppRouterWaitState, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, PublicDataReadyEvent } from \"../AppRouterReducer.ts\";\nimport type { FireflyRuntime } from \"../FireflyRuntime.tsx\";\nimport { ApplicationBootstrappingStartedEvent } from \"../initializeFirefly.ts\";\nimport { ProtectedDataFetchFailedEvent, ProtectedDataFetchStartedEvent } from \"../useProtectedDataQueries.ts\";\nimport { PublicDataFetchFailedEvent, 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\ninterface AddProtectedListenerOptions extends AddListenerOptions {\n onError?: (error: unknown) => void;\n}\n\nfunction addProtectedListener(runtime: FireflyRuntime, eventName: EventName, callback: EventCallbackFunction, options?: AddProtectedListenerOptions) {\n const protectedCallback = (...args: unknown[]) => {\n try {\n callback(...args);\n } catch (error: unknown) {\n runtime.logger\n .withText(`[squide] An unmanaged error occurred while handling event \"${eventName.toString()}\" for Honeycomb instrumentation:`)\n .withError(error as Error)\n .error();\n }\n };\n\n runtime.eventBus.addListener(eventName, protectedCallback, options);\n}\n\ntype DataFetchState = \"none\" | \"fetching-data\" | \"public-data-ready\" | \"protected-data-ready\" | \"data-ready\" | \"data-fetch-failed\";\n\nexport function reduceDataFetchEvents(\n runtime: FireflyRuntime,\n onDataFetchStarted: () => void,\n onDataReady: () => void,\n onPublicDataFetchStarted: () => void,\n onPublicDataReady: () => void,\n onProtectedDataFetchStarted: () => void,\n onProtectedDataReady: () => void,\n onDataFetchFailed: (queriesErrors: Error[]) => void,\n onUnmanagedError: (error: unknown) => void\n) {\n let dataFetchState: DataFetchState = \"none\";\n\n addProtectedListener(runtime, PublicDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchStarted();\n }\n\n onPublicDataFetchStarted();\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, PublicDataReadyEvent, payload => {\n onPublicDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n if (payload && !(payload as AppRouterWaitState).waitForProtectedData) {\n dataFetchState = \"data-ready\";\n onDataReady();\n } else {\n dataFetchState = \"public-data-ready\";\n }\n } else if (dataFetchState === \"protected-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, ProtectedDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchStarted();\n }\n\n onProtectedDataFetchStarted();\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, ProtectedDataReadyEvent, payload => {\n onProtectedDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n if (payload && !(payload as AppRouterWaitState).waitForPublicData) {\n dataFetchState = \"data-ready\";\n onDataReady();\n } else {\n dataFetchState = \"protected-data-ready\";\n }\n } else if (dataFetchState === \"public-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n const handleDataFetchFailed = (payload: unknown) => {\n if (dataFetchState !== \"data-fetch-failed\") {\n dataFetchState = \"data-fetch-failed\";\n\n onDataFetchFailed(payload as Error[]);\n }\n };\n\n addProtectedListener(runtime, PublicDataFetchFailedEvent, handleDataFetchFailed, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, ProtectedDataFetchFailedEvent, handleDataFetchFailed, {\n once: true,\n onError: onUnmanagedError\n });\n}\n\nfunction registerTrackingListeners(runtime: FireflyRuntime) {\n let bootstrappingSpan: Span;\n let bootstrappingSpanHasEnded: boolean = false;\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 const handleUnmanagedError = (error: unknown) => {\n if (bootstrappingSpan && !bootstrappingSpanHasEnded) {\n traceError(bootstrappingSpan, error as Error);\n\n bootstrappingSpan.end();\n bootstrappingSpanHasEnded = true;\n }\n\n if (localModuleRegistrationSpan) {\n localModuleRegistrationSpan.end();\n }\n\n if (localModuleDeferredRegistrationSpan) {\n localModuleDeferredRegistrationSpan.end();\n }\n\n if (remoteModuleRegistrationSpan) {\n remoteModuleRegistrationSpan.end();\n }\n\n if (remoteModuleDeferredRegistrationSpan) {\n remoteModuleDeferredRegistrationSpan.end();\n }\n\n if (dataFetchSpan) {\n dataFetchSpan.instance.end();\n }\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.end();\n }\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n localModuleDeferredRegistrationsUpdateSpan.instance.end();\n }\n\n if (remoteModuleDeferredRegistrationsUpdateSpan) {\n remoteModuleDeferredRegistrationsUpdateSpan.instance.end();\n }\n };\n\n addProtectedListener(runtime, ApplicationBootstrappingStartedEvent, () => {\n bootstrappingSpan = startSpan((options, context) => getTracer().startSpan(\"squide-bootstrapping\", options, context));\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, ApplicationBoostrappedEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.end();\n bootstrappingSpanHasEnded = true;\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, MswReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"msw-ready\");\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, 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 }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, 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 }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModuleRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleRegistrationSpan) {\n traceError(localModuleRegistrationSpan, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, 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 }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, 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 }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModuleDeferredRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleDeferredRegistrationSpan) {\n traceError(localModuleRegistrationSpan, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, 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 }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, 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 }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, RemoteModuleRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleRegistrationSpan) {\n traceError(remoteModuleRegistrationSpan, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, 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 }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, 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 }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, RemoteModuleDeferredRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleDeferredRegistrationSpan) {\n traceError(remoteModuleDeferredRegistrationSpan, registrationError);\n }\n }, {\n onError: handleUnmanagedError\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 const handleDataFetchFailed = (queriesErrors: Error[]) => {\n if (dataFetchSpan) {\n queriesErrors.forEach(x => {\n traceError(dataFetchSpan.instance, x);\n });\n\n endActiveSpan(dataFetchSpan);\n\n // Global data fetch errors are unmanaged, which mean the host application bootstrapping flow\n // will be aborted and a react-router error boundary will be rendered.\n if (bootstrappingSpan) {\n bootstrappingSpan.end();\n bootstrappingSpanHasEnded = true;\n }\n }\n };\n\n reduceDataFetchEvents(\n runtime,\n handleFetchDataStarted,\n handleDataReady,\n handlePublicDataFetchStarted,\n handlePublicDataReady,\n handleProtectedDataFetchStarted,\n handleProtectedDataReady,\n handleDataFetchFailed,\n handleUnmanagedError\n );\n\n addProtectedListener(runtime, ModulesRegisteredEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-registered\");\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, ModulesReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-ready\");\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, DeferredRegistrationsUpdateStartedEvent, () => {\n deferredRegistrationsUpdateSpan = startSpan((options, context) => getTracer().startSpan(\"squide-deferred-registrations-update\", options, context));\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, DeferredRegistrationsUpdateCompletedEvent, () => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.end();\n }\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, 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 onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, 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 onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModuleDeferredRegistrationUpdateFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n traceError(localModuleDeferredRegistrationsUpdateSpan.instance, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, 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 onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, 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 onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, RemoteModuleDeferredRegistrationUpdateFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleDeferredRegistrationsUpdateSpan) {\n traceError(remoteModuleDeferredRegistrationsUpdateSpan.instance, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n}\n\nexport function registerHoneycombInstrumentation(runtime: FireflyRuntime) {\n try {\n registerActiveSpanStack();\n\n // Dynamically registering this request hook function to nest the HTTP requests\n // of squide bootstrapping under the appropriate Honeycomb span.\n runtime.honeycombInstrumentationClient?.registerFetchRequestHook(createOverrideFetchRequestSpanWithActiveSpanContext(runtime.logger));\n\n registerTrackingListeners(runtime);\n\n runtime.logger.information(\"[squide] Honeycomb instrumentation is registered.\");\n } catch (error: unknown) {\n runtime.logger\n .withText(\"[squide] An error occurred while registering Honeycomb instrumentation:\")\n .withError(error as Error)\n .error();\n }\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","ProtectedDataFetchFailedEvent","ProtectedDataFetchStartedEvent","PublicDataFetchFailedEvent","PublicDataFetchStartedEvent","createOverrideFetchRequestSpanWithActiveSpanContext","registerActiveSpanStack","getTracer","endActiveSpan","startActiveChildSpan","startChildSpan","startSpan","traceError","addProtectedListener","runtime","eventName","callback","options","protectedCallback","args","error","reduceDataFetchEvents","onDataFetchStarted","onDataReady","onPublicDataFetchStarted","onPublicDataReady","onProtectedDataFetchStarted","onProtectedDataReady","onDataFetchFailed","onUnmanagedError","dataFetchState","payload","handleDataFetchFailed","registerTrackingListeners","bootstrappingSpan","bootstrappingSpanHasEnded","localModuleRegistrationSpan","localModuleDeferredRegistrationSpan","remoteModuleRegistrationSpan","remoteModuleDeferredRegistrationSpan","dataFetchSpan","deferredRegistrationsUpdateSpan","localModuleDeferredRegistrationsUpdateSpan","remoteModuleDeferredRegistrationsUpdateSpan","handleUnmanagedError","context","attributes","registrationError","handleFetchDataStarted","name","span","handleDataReady","handlePublicDataFetchStarted","handlePublicDataReady","handleProtectedDataFetchStarted","handleProtectedDataReady","queriesErrors","x","registerHoneycombInstrumentation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBsB;AAoBa;AACoK;AAExH;AAC+B;AACT;AAC2B;AACxF;AACgE;AASxG,SAASuC,qBAAqBC,OAAuB,EAAEC,SAAoB,EAAEC,QAA+B,EAAEC,OAAqC;IAC/I,MAAMC,oBAAoB,CAAC,GAAGC;QAC1B,IAAI;YACAH,YAAYG;QAChB,EAAE,OAAOC,OAAgB;YACrBN,QAAQ,MAA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MC,OAAO3C,SAASA,GAAG,SAAS,CAAC0C,MAAM;gBACrCH;gBACA,GAAG7B,OAAO;YACd,GAAG4B;YAEH,OAAO;gBACHI;gBACAC;YACJ;QACJ;IACJ,GAAG;QACC,SAASN;IACb;IAEA,4BAA4B;IAC5B/B,qBAAqBC,SAASxB,sDAAsDA,EAAE,CAACyC;QACnF,IAAIU,iCAAiC;YACjCA,gCAAgC,QAAQ,CAAC,yDAAyD;gBAC9F,iCAAkCV,QAA0E,iBAAiB;YACjI;QACJ;QAEA,IAAIY,6CAA6C;YAC7CnC,aAAaA,CAACmC;QAClB;IACJ,GAAG;QACC,SAASC;IACb;IAEA,4BAA4B;IAC5B/B,qBAAqBC,SAAS5B,iDAAiDA,EAAE,CAAC6C;QAC9E,MAAMgB,oBAAoBhB;QAE1B,IAAIY,6CAA6C;YAC7C/B,UAAUA,CAAC+B,4CAA4C,QAAQ,EAAEI;QACrE;IACJ,GAAG;QACC,SAASH;IACb;AACJ;AAEO,SAASc,iCAAiC5C,OAAuB;IACpE,IAAI;QACAR,uBAAuBA;QAEvB,+EAA+E;QAC/E,gEAAgE;QAChEQ,QAAQ,8BAA8B,EAAE,yBAAyBT,mDAAmDA,CAACS,QAAQ,MAAM;QAEnImB,0BAA0BnB;QAE1BA,QAAQ,MAAM,CAAC,WAAW,CAAC;IAC/B,EAAE,OAAOM,OAAgB;QACrBN,QAAQ,MAAM,CACT,QAAQ,CAAC,2EACT,SAAS,CAACM,OACV,KAAK;IACd;AACJ"}
1
+ {"version":3,"file":"honeycomb/registerHoneycombInstrumentation.js","sources":["../../src/honeycomb/registerHoneycombInstrumentation.ts"],"sourcesContent":["import type { Span } from \"@opentelemetry/api\";\nimport {\n type AddListenerOptions,\n type EventCallbackFunction,\n type EventName,\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 { ApplicationBoostrappedEvent, type AppRouterWaitState, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, PublicDataReadyEvent } from \"../AppRouterReducer.ts\";\nimport { FireflyPlugin } from \"../FireflyPlugin.ts\";\nimport type { FireflyRuntime } from \"../FireflyRuntime.tsx\";\nimport { ApplicationBootstrappingStartedEvent } from \"../initializeFirefly.ts\";\nimport { ProtectedDataFetchFailedEvent, ProtectedDataFetchStartedEvent } from \"../useProtectedDataQueries.ts\";\nimport { PublicDataFetchFailedEvent, PublicDataFetchStartedEvent } from \"../usePublicDataQueries.ts\";\nimport { DeferredRegistrationsUpdateCompletedEvent, DeferredRegistrationsUpdateStartedEvent } from \"../useUpdateDeferredRegistrations.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:\n// \"root.name = squide-bootstrapping\" and\n// \"root.name = squide-deferred-registrations-update\".\n\nexport interface AddProtectedListenerOptions extends AddListenerOptions {\n onError?: (error: unknown) => void;\n}\n\nexport function addProtectedListener(runtime: FireflyRuntime, eventName: EventName, callback: EventCallbackFunction, options?: AddProtectedListenerOptions) {\n const protectedCallback = (...args: unknown[]) => {\n try {\n callback(...args);\n } catch (error: unknown) {\n runtime.logger\n .withText(`[squide] An unmanaged error occurred while handling event \"${eventName.toString()}\" for Honeycomb instrumentation:`)\n .withError(error as Error)\n .error();\n }\n };\n\n runtime.eventBus.addListener(eventName, protectedCallback, options);\n}\n\nexport type GetSpanFunction = () => Span;\nexport type HoneycombTrackingUnmanagedErrorHandler = (error: unknown) => void;\n\ntype DataFetchState = \"none\" | \"fetching-data\" | \"public-data-ready\" | \"protected-data-ready\" | \"data-ready\" | \"data-fetch-failed\";\n\nexport function reduceDataFetchEvents(\n runtime: FireflyRuntime,\n onDataFetchStarted: () => void,\n onDataReady: () => void,\n onPublicDataFetchStarted: () => void,\n onPublicDataReady: () => void,\n onProtectedDataFetchStarted: () => void,\n onProtectedDataReady: () => void,\n onDataFetchFailed: (queriesErrors: Error[]) => void,\n onUnmanagedError: (error: unknown) => void\n) {\n let dataFetchState: DataFetchState = \"none\";\n\n addProtectedListener(runtime, PublicDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchStarted();\n }\n\n onPublicDataFetchStarted();\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, PublicDataReadyEvent, payload => {\n onPublicDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n if (payload && !(payload as AppRouterWaitState).waitForProtectedData) {\n dataFetchState = \"data-ready\";\n onDataReady();\n } else {\n dataFetchState = \"public-data-ready\";\n }\n } else if (dataFetchState === \"protected-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, ProtectedDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchStarted();\n }\n\n onProtectedDataFetchStarted();\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, ProtectedDataReadyEvent, payload => {\n onProtectedDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n if (payload && !(payload as AppRouterWaitState).waitForPublicData) {\n dataFetchState = \"data-ready\";\n onDataReady();\n } else {\n dataFetchState = \"protected-data-ready\";\n }\n } else if (dataFetchState === \"public-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n const handleDataFetchFailed = (payload: unknown) => {\n if (dataFetchState !== \"data-fetch-failed\") {\n dataFetchState = \"data-fetch-failed\";\n\n onDataFetchFailed(payload as Error[]);\n }\n };\n\n addProtectedListener(runtime, PublicDataFetchFailedEvent, handleDataFetchFailed, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, ProtectedDataFetchFailedEvent, handleDataFetchFailed, {\n once: true,\n onError: onUnmanagedError\n });\n}\n\nfunction registerTrackingListeners(runtime: FireflyRuntime) {\n let bootstrappingSpan: Span;\n let bootstrappingSpanHasEnded: boolean = false;\n let localModuleRegistrationSpan: Span;\n let localModuleDeferredRegistrationSpan: Span;\n let dataFetchSpan: ActiveSpan;\n let deferredRegistrationsUpdateSpan: Span;\n let localModuleDeferredRegistrationsUpdateSpan: ActiveSpan;\n\n const pluginsUnmanagedErrorHandlers: HoneycombTrackingUnmanagedErrorHandler[] = [];\n\n const handleUnmanagedError = (error: unknown) => {\n if (bootstrappingSpan && !bootstrappingSpanHasEnded) {\n traceError(bootstrappingSpan, error as Error);\n\n bootstrappingSpan.end();\n bootstrappingSpanHasEnded = true;\n }\n\n if (localModuleRegistrationSpan) {\n localModuleRegistrationSpan.end();\n }\n\n if (localModuleDeferredRegistrationSpan) {\n localModuleDeferredRegistrationSpan.end();\n }\n\n if (dataFetchSpan) {\n dataFetchSpan.instance.end();\n }\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.end();\n }\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n localModuleDeferredRegistrationsUpdateSpan.instance.end();\n }\n\n pluginsUnmanagedErrorHandlers.forEach(x => {\n x(error);\n });\n };\n\n addProtectedListener(runtime, ApplicationBootstrappingStartedEvent, () => {\n bootstrappingSpan = startSpan((options, context) => getTracer().startSpan(\"squide-bootstrapping\", options, context));\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, ApplicationBoostrappedEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.end();\n bootstrappingSpanHasEnded = true;\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, MswReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"msw-ready\");\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, 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 }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, 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 }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModuleRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleRegistrationSpan) {\n traceError(localModuleRegistrationSpan, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, 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 }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, 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 }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModuleDeferredRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleDeferredRegistrationSpan) {\n traceError(localModuleRegistrationSpan, registrationError);\n }\n }, {\n onError: handleUnmanagedError\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 const handleDataFetchFailed = (queriesErrors: Error[]) => {\n if (dataFetchSpan) {\n queriesErrors.forEach(x => {\n traceError(dataFetchSpan.instance, x);\n });\n\n endActiveSpan(dataFetchSpan);\n\n // Global data fetch errors are unmanaged, which mean the host application bootstrapping flow\n // will be aborted and a react-router error boundary will be rendered.\n if (bootstrappingSpan) {\n bootstrappingSpan.end();\n bootstrappingSpanHasEnded = true;\n }\n }\n };\n\n reduceDataFetchEvents(\n runtime,\n handleFetchDataStarted,\n handleDataReady,\n handlePublicDataFetchStarted,\n handlePublicDataReady,\n handleProtectedDataFetchStarted,\n handleProtectedDataReady,\n handleDataFetchFailed,\n handleUnmanagedError\n );\n\n addProtectedListener(runtime, ModulesRegisteredEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-registered\");\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, ModulesReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-ready\");\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, DeferredRegistrationsUpdateStartedEvent, () => {\n deferredRegistrationsUpdateSpan = startSpan((options, context) => getTracer().startSpan(\"squide-deferred-registrations-update\", options, context));\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, DeferredRegistrationsUpdateCompletedEvent, () => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.end();\n }\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, 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 onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, 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 onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModuleDeferredRegistrationUpdateFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n traceError(localModuleDeferredRegistrationsUpdateSpan.instance, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n const getBootstrappingSpan: GetSpanFunction = () => bootstrappingSpan;\n const getDeferredRegistrationsUpdateSpan: GetSpanFunction = () => deferredRegistrationsUpdateSpan;\n\n const handlePluginUnmanagedError: HoneycombTrackingUnmanagedErrorHandler = (error: unknown) => {\n handleUnmanagedError(error);\n };\n\n // Register plugins specific handlers for Honeycomb telemetry.\n runtime.plugins.forEach(x => {\n const plugin = x as FireflyPlugin;\n\n if (plugin.registerHoneycombTrackingListeners) {\n const unmanagedErrorHandler = plugin.registerHoneycombTrackingListeners(\n getBootstrappingSpan,\n getDeferredRegistrationsUpdateSpan,\n handlePluginUnmanagedError\n );\n\n pluginsUnmanagedErrorHandlers.push(unmanagedErrorHandler);\n }\n });\n}\n\nexport function registerHoneycombInstrumentation(runtime: FireflyRuntime) {\n try {\n registerActiveSpanStack();\n\n // Dynamically registering this request hook function to nest the HTTP requests\n // of squide bootstrapping under the appropriate Honeycomb span.\n runtime.honeycombInstrumentationClient?.registerFetchRequestHook(createOverrideFetchRequestSpanWithActiveSpanContext(runtime.logger));\n\n registerTrackingListeners(runtime);\n\n runtime.logger.information(\"[squide] Honeycomb instrumentation is registered.\");\n } catch (error: unknown) {\n runtime.logger\n .withText(\"[squide] An error occurred while registering Honeycomb instrumentation:\")\n .withError(error as Error)\n .error();\n }\n}\n"],"names":["LocalModuleDeferredRegistrationFailedEvent","LocalModuleDeferredRegistrationUpdateFailedEvent","LocalModuleRegistrationFailedEvent","LocalModulesDeferredRegistrationCompletedEvent","LocalModulesDeferredRegistrationStartedEvent","LocalModulesDeferredRegistrationsUpdateCompletedEvent","LocalModulesDeferredRegistrationsUpdateStartedEvent","LocalModulesRegistrationCompletedEvent","LocalModulesRegistrationStartedEvent","ApplicationBoostrappedEvent","ModulesReadyEvent","ModulesRegisteredEvent","MswReadyEvent","ProtectedDataReadyEvent","PublicDataReadyEvent","ApplicationBootstrappingStartedEvent","ProtectedDataFetchFailedEvent","ProtectedDataFetchStartedEvent","PublicDataFetchFailedEvent","PublicDataFetchStartedEvent","DeferredRegistrationsUpdateCompletedEvent","DeferredRegistrationsUpdateStartedEvent","createOverrideFetchRequestSpanWithActiveSpanContext","registerActiveSpanStack","getTracer","endActiveSpan","startActiveChildSpan","startChildSpan","startSpan","traceError","addProtectedListener","runtime","eventName","callback","options","protectedCallback","args","error","reduceDataFetchEvents","onDataFetchStarted","onDataReady","onPublicDataFetchStarted","onPublicDataReady","onProtectedDataFetchStarted","onProtectedDataReady","onDataFetchFailed","onUnmanagedError","dataFetchState","payload","handleDataFetchFailed","registerTrackingListeners","bootstrappingSpan","bootstrappingSpanHasEnded","localModuleRegistrationSpan","localModuleDeferredRegistrationSpan","dataFetchSpan","deferredRegistrationsUpdateSpan","localModuleDeferredRegistrationsUpdateSpan","pluginsUnmanagedErrorHandlers","handleUnmanagedError","x","context","attributes","registrationError","handleFetchDataStarted","name","span","handleDataReady","handlePublicDataFetchStarted","handlePublicDataReady","handleProtectedDataFetchStarted","handleProtectedDataReady","queriesErrors","getBootstrappingSpan","getDeferredRegistrationsUpdateSpan","handlePluginUnmanagedError","plugin","unmanagedErrorHandler","registerHoneycombInstrumentation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBsB;AACiL;AAGxH;AAC+B;AACT;AACqC;AACV;AACxF;AACgE;AAWjG,SAAS8B,qBAAqBC,OAAuB,EAAEC,SAAoB,EAAEC,QAA+B,EAAEC,OAAqC;IACtJ,MAAMC,oBAAoB,CAAC,GAAGC;QAC1B,IAAI;YACAH,YAAYG;QAChB,EAAE,OAAOC,OAAgB;YACrBN,QAAQ,MAAM,CACT,QAAQ,CAAC,CAAC,2DAA2D,EAAEC,UAAU,QAAQ,GAAG,gCAAgC,CAAC,EAC7H,SAAS,CAACK,OACV,KAAK;QACd;IACJ;IAEAN,QAAQ,QAAQ,CAAC,WAAW,CAACC,WAAWG,mBAAmBD;AAC/D;AAOO,SAASI,sBACZP,OAAuB,EACvBQ,kBAA8B,EAC9BC,WAAuB,EACvBC,wBAAoC,EACpCC,iBAA6B,EAC7BC,2BAAuC,EACvCC,oBAAgC,EAChCC,iBAAmD,EACnDC,gBAA0C;IAE1C,IAAIC,iBAAiC;IAErCjB,qBAAqBC,SAASZ,2BAA2BA,EAAE;QACvD,IAAI4B,mBAAmB,QAAQ;YAC3BA,iBAAiB;YACjBR;QACJ;QAEAE;IACJ,GAAG;QACC,MAAM;QACN,SAASK;IACb;IAEAhB,qBAAqBC,SAASjB,oBAAoBA,EAAEkC,CAAAA;QAChDN;QAEA,IAAIK,mBAAmB,iBAAiB;YACpC,IAAIC,WAAW,CAAEA,QAA+B,oBAAoB,EAAE;gBAClED,iBAAiB;gBACjBP;YACJ,OAAO;gBACHO,iBAAiB;YACrB;QACJ,OAAO,IA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IgB,OAAO,kCAAkC,EAAE;YAC3C,MAAMC,wBAAwBD,OAAO,kCAAkC,CACnEH,sBACAC,oCACAC;YAGJjB,8BAA8B,IAAI,CAACmB;QACvC;IACJ;AACJ;AAEO,SAASC,iCAAiC/C,OAAuB;IACpE,IAAI;QACAR,uBAAuBA;QAEvB,+EAA+E;QAC/E,gEAAgE;QAChEQ,QAAQ,8BAA8B,EAAE,yBAAyBT,mDAAmDA,CAACS,QAAQ,MAAM;QAEnImB,0BAA0BnB;QAE1BA,QAAQ,MAAM,CAAC,WAAW,CAAC;IAC/B,EAAE,OAAOM,OAAgB;QACrBN,QAAQ,MAAM,CACT,QAAQ,CAAC,2EACT,SAAS,CAACM,OACV,KAAK;IACd;AACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"honeycomb/tracer.js","sources":["webpack://@squide/firefly/./src/honeycomb/tracer.ts"],"sourcesContent":["import { trace } from \"@opentelemetry/api\";\n\nexport function getTracer() {\n // The tracer name is used as the \"library.name\" attribute.\n return trace.getTracer(\"@squide/honeycomb\");\n}\n"],"names":["trace","getTracer"],"mappings":";;;;;AAA2C;AAEpC,SAASC;IACZ,2DAA2D;IAC3D,OAAOD,eAAe,CAAC;AAC3B"}
1
+ {"version":3,"file":"honeycomb/tracer.js","sources":["../../src/honeycomb/tracer.ts"],"sourcesContent":["import { trace } from \"@opentelemetry/api\";\n\nexport function getTracer() {\n // The tracer name is used as the \"library.name\" attribute.\n return trace.getTracer(\"@squide/honeycomb\");\n}\n"],"names":["trace","getTracer"],"mappings":";;;;;AAA2C;AAEpC,SAASC;IACZ,2DAA2D;IAC3D,OAAOD,eAAe,CAAC;AAC3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"honeycomb/utils.js","sources":["webpack://@squide/firefly/./src/honeycomb/utils.ts"],"sourcesContent":["import { type Context, type Exception, context as otelContext, trace as otelTrace, type Span, SpanKind, type SpanOptions, SpanStatusCode, type TimeInput } from \"@opentelemetry/api\";\nimport { type ActiveSpan, popActiveSpan, setActiveSpan } from \"./activeSpan.ts\";\n\nexport type StartSpanFactory = (options?: SpanOptions, context?: Context) => Span;\n\nexport function startSpan(factory: StartSpanFactory) {\n return factory({ kind: SpanKind.CLIENT });\n}\n\nexport type StartChildSpanFactory = (options?: SpanOptions, context?: Context) => Span;\n\nexport function startChildSpan(parent: Span, factory: StartChildSpanFactory) {\n const context = otelTrace.setSpan(otelContext.active(), parent);\n\n return factory({ kind: SpanKind.CLIENT }, context);\n}\n\nexport interface StartActiveSpanFactoryReturn {\n name: string;\n span: Span;\n}\n\nexport type StartActiveSpanFactory = (options?: SpanOptions, context?: Context) => StartActiveSpanFactoryReturn;\n\nexport function startActiveSpan(factory: StartActiveSpanFactory) {\n const { name, span } = factory({ kind: SpanKind.CLIENT });\n\n return setActiveSpan(name, span);\n}\n\nexport interface StartActiveChildSpanFactoryReturn {\n name: string;\n span: Span;\n}\n\nexport type StartActiveChildSpanFactory = (options?: SpanOptions, context?: Context) => StartActiveChildSpanFactoryReturn;\n\nexport function startActiveChildSpan(parent: Span, factory: StartActiveChildSpanFactory) {\n const context = otelTrace.setSpan(otelContext.active(), parent);\n\n const { name, span } = factory({ kind: SpanKind.CLIENT }, context);\n\n return setActiveSpan(name, span);\n}\n\nexport function endActiveSpan(span: ActiveSpan) {\n span.instance.end();\n\n popActiveSpan(span);\n}\n\nexport interface TraceErrorOptions {\n time?: TimeInput;\n}\n\nexport function traceError(span: Span, error: Exception, options: TraceErrorOptions = {}) {\n const { time } = options;\n\n span.recordException(error, time);\n\n span.setStatus({\n code: SpanStatusCode.ERROR\n });\n}\n"],"names":["context","otelContext","trace","otelTrace","SpanKind","SpanStatusCode","popActiveSpan","setActiveSpan","startSpan","factory","startChildSpan","parent","startActiveSpan","name","span","startActiveChildSpan","endActiveSpan","traceError","error","options","time"],"mappings":";;;;;;;;AAAqL;AACrG;AAIzE,SAASQ,UAAUC,OAAyB;IAC/C,OAAOA,QAAQ;QAAE,MAAML,eAAe;IAAC;AAC3C;AAIO,SAASM,eAAeC,MAAY,EAAEF,OAA8B;IACvE,MAAMT,UAAUG,aAAiB,CAACF,kBAAkB,IAAIU;IAExD,OAAOF,QAAQ;QAAE,MAAML,eAAe;IAAC,GAAGJ;AAC9C;AASO,SAASY,gBAAgBH,OAA+B;IAC3D,MAAM,EAAEI,IAAI,EAAEC,IAAI,EAAE,GAAGL,QAAQ;QAAE,MAAML,eAAe;IAAC;IAEvD,OAAOG,aAAaA,CAACM,MAAMC;AAC/B;AASO,SAASC,qBAAqBJ,MAAY,EAAEF,OAAoC;IACnF,MAAMT,UAAUG,aAAiB,CAACF,kBAAkB,IAAIU;IAExD,MAAM,EAAEE,IAAI,EAAEC,IAAI,EAAE,GAAGL,QAAQ;QAAE,MAAML,eAAe;IAAC,GAAGJ;IAE1D,OAAOO,aAAaA,CAACM,MAAMC;AAC/B;AAEO,SAASE,cAAcF,IAAgB;IAC1CA,KAAK,QAAQ,CAAC,GAAG;IAEjBR,aAAaA,CAACQ;AAClB;AAMO,SAASG,WAAWH,IAAU,EAAEI,KAAgB,EAAEC,UAA6B,CAAC,CAAC;IACpF,MAAM,EAAEC,IAAI,EAAE,GAAGD;IAEjBL,KAAK,eAAe,CAACI,OAAOE;IAE5BN,KAAK,SAAS,CAAC;QACX,MAAMT,oBAAoB;IAC9B;AACJ"}
1
+ {"version":3,"file":"honeycomb/utils.js","sources":["../../src/honeycomb/utils.ts"],"sourcesContent":["import { type Context, type Exception, context as otelContext, trace as otelTrace, type Span, SpanKind, type SpanOptions, SpanStatusCode, type TimeInput } from \"@opentelemetry/api\";\nimport { type ActiveSpan, popActiveSpan, setActiveSpan } from \"./activeSpan.ts\";\n\nexport type StartSpanFactory = (options?: SpanOptions, context?: Context) => Span;\n\nexport function startSpan(factory: StartSpanFactory) {\n return factory({ kind: SpanKind.CLIENT });\n}\n\nexport type StartChildSpanFactory = (options?: SpanOptions, context?: Context) => Span;\n\nexport function startChildSpan(parent: Span, factory: StartChildSpanFactory) {\n const context = otelTrace.setSpan(otelContext.active(), parent);\n\n return factory({ kind: SpanKind.CLIENT }, context);\n}\n\nexport interface StartActiveSpanFactoryReturn {\n name: string;\n span: Span;\n}\n\nexport type StartActiveSpanFactory = (options?: SpanOptions, context?: Context) => StartActiveSpanFactoryReturn;\n\nexport function startActiveSpan(factory: StartActiveSpanFactory) {\n const { name, span } = factory({ kind: SpanKind.CLIENT });\n\n return setActiveSpan(name, span);\n}\n\nexport interface StartActiveChildSpanFactoryReturn {\n name: string;\n span: Span;\n}\n\nexport type StartActiveChildSpanFactory = (options?: SpanOptions, context?: Context) => StartActiveChildSpanFactoryReturn;\n\nexport function startActiveChildSpan(parent: Span, factory: StartActiveChildSpanFactory) {\n const context = otelTrace.setSpan(otelContext.active(), parent);\n\n const { name, span } = factory({ kind: SpanKind.CLIENT }, context);\n\n return setActiveSpan(name, span);\n}\n\nexport function endActiveSpan(span: ActiveSpan) {\n span.instance.end();\n\n popActiveSpan(span);\n}\n\nexport interface TraceErrorOptions {\n time?: TimeInput;\n}\n\nexport function traceError(span: Span, error: Exception, options: TraceErrorOptions = {}) {\n const { time } = options;\n\n span.recordException(error, time);\n\n span.setStatus({\n code: SpanStatusCode.ERROR\n });\n}\n"],"names":["context","otelContext","trace","otelTrace","SpanKind","SpanStatusCode","popActiveSpan","setActiveSpan","startSpan","factory","startChildSpan","parent","startActiveSpan","name","span","startActiveChildSpan","endActiveSpan","traceError","error","options","time"],"mappings":";;;;;;;;AAAqL;AACrG;AAIzE,SAASQ,UAAUC,OAAyB;IAC/C,OAAOA,QAAQ;QAAE,MAAML,eAAe;IAAC;AAC3C;AAIO,SAASM,eAAeC,MAAY,EAAEF,OAA8B;IACvE,MAAMT,UAAUG,aAAiB,CAACF,kBAAkB,IAAIU;IAExD,OAAOF,QAAQ;QAAE,MAAML,eAAe;IAAC,GAAGJ;AAC9C;AASO,SAASY,gBAAgBH,OAA+B;IAC3D,MAAM,EAAEI,IAAI,EAAEC,IAAI,EAAE,GAAGL,QAAQ;QAAE,MAAML,eAAe;IAAC;IAEvD,OAAOG,aAAaA,CAACM,MAAMC;AAC/B;AASO,SAASC,qBAAqBJ,MAAY,EAAEF,OAAoC;IACnF,MAAMT,UAAUG,aAAiB,CAACF,kBAAkB,IAAIU;IAExD,MAAM,EAAEE,IAAI,EAAEC,IAAI,EAAE,GAAGL,QAAQ;QAAE,MAAML,eAAe;IAAC,GAAGJ;IAE1D,OAAOO,aAAaA,CAACM,MAAMC;AAC/B;AAEO,SAASE,cAAcF,IAAgB;IAC1CA,KAAK,QAAQ,CAAC,GAAG;IAEjBR,aAAaA,CAACQ;AAClB;AAMO,SAASG,WAAWH,IAAU,EAAEI,KAAgB,EAAEC,UAA6B,CAAC,CAAC;IACpF,MAAM,EAAEC,IAAI,EAAE,GAAGD;IAEjBL,KAAK,eAAe,CAACI,OAAOE;IAE5BN,KAAK,SAAS,CAAC;QACX,MAAMT,oBAAoB;IAC9B;AACJ"}
package/dist/index.d.ts CHANGED
@@ -1,12 +1,11 @@
1
1
  export * from "@squide/core";
2
- export * from "@squide/module-federation";
3
2
  export * from "@squide/msw";
4
3
  export * from "@squide/react-router";
4
+ export type { FireflyPlugin } from "./FireflyPlugin.ts";
5
5
  export * from "./FireflyProvider.tsx";
6
6
  export * from "./FireflyRuntime.tsx";
7
7
  export * from "./AppRouter.tsx";
8
- export * from "./AppRouterContext.ts";
9
- export * from "./AppRouterReducer.ts";
8
+ export { ActiveRouteIsProtectedEvent, ActiveRouteIsPublicEvent, ApplicationBoostrappedEvent, DeferredRegistrationsUpdatedEvent, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, ProtectedDataUpdatedEvent, PublicDataReadyEvent, PublicDataUpdatedEvent } from "./AppRouterReducer.ts";
10
9
  export * from "./AppRouterStore.ts";
11
10
  export * from "./GlobalDataQueriesError.ts";
12
11
  export * from "./useCanFetchProtectedData.ts";
package/dist/index.js CHANGED
@@ -1,12 +1,10 @@
1
+ import { ActiveRouteIsProtectedEvent, ActiveRouteIsPublicEvent, ApplicationBoostrappedEvent, DeferredRegistrationsUpdatedEvent, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, ProtectedDataUpdatedEvent, PublicDataReadyEvent, PublicDataUpdatedEvent } from "./AppRouterReducer.js";
1
2
  export * from "@squide/core";
2
- export * from "@squide/module-federation";
3
3
  export * from "@squide/msw";
4
4
  export * from "@squide/react-router";
5
5
  export * from "./FireflyProvider.js";
6
6
  export * from "./FireflyRuntime.js";
7
7
  export * from "./AppRouter.js";
8
- export * from "./AppRouterContext.js";
9
- export * from "./AppRouterReducer.js";
10
8
  export * from "./AppRouterStore.js";
11
9
  export * from "./GlobalDataQueriesError.js";
12
10
  export * from "./useCanFetchProtectedData.js";
@@ -26,9 +24,9 @@ export * from "./useStrictRegistrationMode.js";
26
24
  export * from "./useUpdateDeferredRegistrations.js";
27
25
  export * from "./initializeFirefly.js";
28
26
 
29
- ;// CONCATENATED MODULE: ./src/index.ts
30
-
27
+ ;// CONCATENATED MODULE: external "./AppRouterReducer.js"
31
28
 
29
+ ;// CONCATENATED MODULE: ./src/index.ts
32
30
 
33
31
 
34
32
 
@@ -55,5 +53,6 @@ export * from "./initializeFirefly.js";
55
53
 
56
54
 
57
55
 
56
+ export { ActiveRouteIsProtectedEvent, ActiveRouteIsPublicEvent, ApplicationBoostrappedEvent, DeferredRegistrationsUpdatedEvent, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, ProtectedDataUpdatedEvent, PublicDataReadyEvent, PublicDataUpdatedEvent };
58
57
 
59
58
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["webpack://@squide/firefly/./src/index.ts"],"sourcesContent":["export * from \"@squide/core\";\nexport * from \"@squide/module-federation\";\nexport * from \"@squide/msw\";\nexport * from \"@squide/react-router\";\n\nexport * from \"./FireflyProvider.tsx\";\nexport * from \"./FireflyRuntime.tsx\";\n\nexport * from \"./AppRouter.tsx\";\nexport * from \"./AppRouterContext.ts\";\nexport * from \"./AppRouterReducer.ts\";\n\nexport * from \"./AppRouterStore.ts\";\nexport * from \"./GlobalDataQueriesError.ts\";\nexport * from \"./useCanFetchProtectedData.ts\";\nexport * from \"./useCanFetchPublicData.ts\";\nexport * from \"./useCanRegisterDeferredRegistrations.ts\";\nexport * from \"./useCanUpdateDeferredRegistrations.ts\";\nexport * from \"./useDeferredRegistrations.ts\";\nexport * from \"./useIsActiveRouteProtected.ts\";\nexport * from \"./useIsBootstrapping.ts\";\nexport * from \"./useNavigationItems.ts\";\nexport * from \"./useProtectedDataHandler.ts\";\nexport * from \"./useProtectedDataQueries.ts\";\nexport * from \"./usePublicDataHandler.ts\";\nexport * from \"./usePublicDataQueries.ts\";\nexport * from \"./useRegisterDeferredRegistrations.ts\";\nexport * from \"./useStrictRegistrationMode.ts\";\nexport * from \"./useUpdateDeferredRegistrations.ts\";\n\nexport * from \"./initializeFirefly.ts\";\n\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAA6B;AACa;AACd;AACS;AAEC;AACD;AAEL;AACM;AACA;AAEF;AACQ;AACE;AACH;AACc;AACF;AACT;AACC;AACP;AACA;AACK;AACA;AACH;AACA;AACY;AACP;AACK;AAEb"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["export * from \"@squide/core\";\nexport * from \"@squide/msw\";\nexport * from \"@squide/react-router\";\n\nexport type { FireflyPlugin } from \"./FireflyPlugin.ts\";\nexport * from \"./FireflyProvider.tsx\";\nexport * from \"./FireflyRuntime.tsx\";\n\nexport * from \"./AppRouter.tsx\";\nexport {\n ActiveRouteIsProtectedEvent,\n ActiveRouteIsPublicEvent,\n ApplicationBoostrappedEvent,\n DeferredRegistrationsUpdatedEvent,\n ModulesReadyEvent,\n ModulesRegisteredEvent,\n MswReadyEvent,\n ProtectedDataReadyEvent,\n ProtectedDataUpdatedEvent,\n PublicDataReadyEvent,\n PublicDataUpdatedEvent\n} from \"./AppRouterReducer.ts\";\n\nexport * from \"./AppRouterStore.ts\";\nexport * from \"./GlobalDataQueriesError.ts\";\nexport * from \"./useCanFetchProtectedData.ts\";\nexport * from \"./useCanFetchPublicData.ts\";\nexport * from \"./useCanRegisterDeferredRegistrations.ts\";\nexport * from \"./useCanUpdateDeferredRegistrations.ts\";\nexport * from \"./useDeferredRegistrations.ts\";\nexport * from \"./useIsActiveRouteProtected.ts\";\nexport * from \"./useIsBootstrapping.ts\";\nexport * from \"./useNavigationItems.ts\";\nexport * from \"./useProtectedDataHandler.ts\";\nexport * from \"./useProtectedDataQueries.ts\";\nexport * from \"./usePublicDataHandler.ts\";\nexport * from \"./usePublicDataQueries.ts\";\nexport * from \"./useRegisterDeferredRegistrations.ts\";\nexport * from \"./useStrictRegistrationMode.ts\";\nexport * from \"./useUpdateDeferredRegistrations.ts\";\n\nexport * from \"./initializeFirefly.ts\";\n\n"],"names":["ActiveRouteIsProtectedEvent","ActiveRouteIsPublicEvent","ApplicationBoostrappedEvent","DeferredRegistrationsUpdatedEvent","ModulesReadyEvent","ModulesRegisteredEvent","MswReadyEvent","ProtectedDataReadyEvent","ProtectedDataUpdatedEvent","PublicDataReadyEvent","PublicDataUpdatedEvent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAA6B;AACD;AACS;AAGC;AACD;AAEL;AAaD;AAEK;AACQ;AACE;AACH;AACc;AACF;AACT;AACC;AACP;AACA;AACK;AACA;AACH;AACA;AACY;AACP;AACK;AAEb"}
@@ -1,5 +1,4 @@
1
- import { type ModuleRegisterFunction, type RegisterModulesOptions } from "@squide/core";
2
- import { type RemoteDefinition } from "@squide/module-federation";
1
+ import { ModuleDefinition, type ModuleRegisterFunction, type RegisterModulesOptions } from "@squide/core";
3
2
  import type { HoneycombInstrumentationPartialClient } from "@workleap-telemetry/core";
4
3
  import { FireflyRuntime, type FireflyRuntimeOptions } from "./FireflyRuntime.tsx";
5
4
  export declare const ApplicationBootstrappingStartedEvent = "squide-app-bootstrapping-started";
@@ -7,11 +6,12 @@ export type OnInitializationErrorFunction = (error: unknown) => void;
7
6
  export type StartMswFunction<TRuntime = FireflyRuntime> = (runtime: TRuntime) => Promise<void>;
8
7
  export interface InitializeFireflyOptions<TRuntime extends FireflyRuntime, TContext = unknown, TData = unknown> extends RegisterModulesOptions<TContext>, FireflyRuntimeOptions {
9
8
  localModules?: ModuleRegisterFunction<TRuntime, TContext, TData>[];
10
- remotes?: RemoteDefinition[];
9
+ moduleDefinitions?: ModuleDefinition<TRuntime, TContext, TData>[];
10
+ useMsw?: boolean;
11
11
  honeycombInstrumentationClient?: HoneycombInstrumentationPartialClient;
12
12
  startMsw?: StartMswFunction<FireflyRuntime>;
13
13
  onError?: OnInitializationErrorFunction;
14
14
  }
15
- export declare function bootstrap<TRuntime extends FireflyRuntime = FireflyRuntime, TContext = unknown, TData = unknown>(runtime: TRuntime, options?: InitializeFireflyOptions<TRuntime, TContext, TData>): void;
16
- export declare function initializeFirefly<TContext = unknown, TData = unknown>(options?: InitializeFireflyOptions<FireflyRuntime, TContext, TData>): FireflyRuntime;
17
- export declare function __resetHasExecuteGuard(): void;
15
+ export declare function bootstrap<TRuntime extends FireflyRuntime = FireflyRuntime, TContext = unknown, TData = unknown>(runtime: TRuntime, modulesDefinitions: ModuleDefinition<TRuntime, TContext, TData>[], options?: Omit<InitializeFireflyOptions<TRuntime, TContext, TData>, "localModules" | "moduleDefinitions">): void;
16
+ export declare function __resetHasExecutedGuard(): void;
17
+ export declare function initializeFirefly<TContext = unknown, TData = unknown>(options?: InitializeFireflyOptions<FireflyRuntime, TContext, TData>): FireflyRuntime<any>;
@@ -1,13 +1,10 @@
1
- import { isFunction, registerLocalModules } from "@squide/core";
2
- import { registerRemoteModules } from "@squide/module-federation";
3
- import { setMswAsReady } from "@squide/msw";
1
+ import { isFunction, toLocalModuleDefinitions } from "@squide/core";
2
+ import { MswPlugin } from "@squide/msw";
4
3
  import { FireflyRuntime } from "./FireflyRuntime.js";
5
4
  import { initializeHoneycomb } from "./honeycomb/initializeHoneycomb.js";
6
5
 
7
6
  ;// CONCATENATED MODULE: external "@squide/core"
8
7
 
9
- ;// CONCATENATED MODULE: external "@squide/module-federation"
10
-
11
8
  ;// CONCATENATED MODULE: external "@squide/msw"
12
9
 
13
10
  ;// CONCATENATED MODULE: external "./FireflyRuntime.js"
@@ -19,54 +16,48 @@ import { initializeHoneycomb } from "./honeycomb/initializeHoneycomb.js";
19
16
 
20
17
 
21
18
 
22
-
23
19
  const ApplicationBootstrappingStartedEvent = "squide-app-bootstrapping-started";
24
- function propagateRegistrationErrors(results, onError) {
25
- if (results) {
26
- if (results.status === "fulfilled") {
27
- results.value.forEach((x)=>{
28
- onError(x);
29
- });
30
- }
31
- }
32
- }
33
- function bootstrap(runtime, options = {}) {
34
- const { localModules = [], remotes = [], startMsw, onError, context } = options;
20
+ function bootstrap(runtime, modulesDefinitions, options = {}) {
21
+ const { startMsw, onError, context } = options;
35
22
  runtime.eventBus.dispatch(ApplicationBootstrappingStartedEvent);
36
- Promise.allSettled([
37
- registerLocalModules(localModules, runtime, {
38
- context
39
- }),
40
- registerRemoteModules(remotes, runtime, {
41
- context
42
- })
43
- ]).then((results)=>{
23
+ runtime.moduleManager.registerModules(modulesDefinitions, {
24
+ context
25
+ }).then((results)=>{
44
26
  if (runtime.isMswEnabled) {
45
27
  if (!isFunction(startMsw)) {
46
28
  throw new Error("[squide] When MSW is enabled, the \"startMsw\" function must be provided.");
47
29
  }
48
30
  startMsw(runtime).then(()=>{
49
- setMswAsReady();
31
+ if (runtime.isMswEnabled) {
32
+ runtime.getMswState().setAsReady();
33
+ }
50
34
  }).catch((error)=>{
51
35
  runtime.logger.withText("[squide] An error occured while starting MSW.").withError(error).error();
52
36
  });
53
37
  }
54
38
  if (onError) {
55
- propagateRegistrationErrors(results[0], onError);
56
- propagateRegistrationErrors(results[1], onError);
39
+ results.forEach((error)=>{
40
+ onError(error);
41
+ });
57
42
  }
58
43
  });
59
44
  }
60
45
  let hasExecuted = false;
46
+ // Should only be used by tests.
47
+ function __resetHasExecutedGuard() {
48
+ hasExecuted = false;
49
+ }
61
50
  function initializeFirefly(options = {}) {
62
- const { mode, useMsw, loggers, plugins, honeycombInstrumentationClient, onError } = options;
51
+ const { mode, localModules = [], moduleDefinitions = [], useMsw, plugins = [], honeycombInstrumentationClient, loggers, onError } = options;
63
52
  if (hasExecuted) {
64
53
  throw new Error("[squide] A squide application can only be initialized once. Did you call the \"initializeSquide\" function twice?");
65
54
  }
66
55
  hasExecuted = true;
56
+ if (useMsw) {
57
+ plugins.push((x)=>new MswPlugin(x));
58
+ }
67
59
  const runtime = new FireflyRuntime({
68
60
  mode,
69
- useMsw,
70
61
  honeycombInstrumentationClient,
71
62
  loggers,
72
63
  plugins
@@ -76,14 +67,14 @@ function initializeFirefly(options = {}) {
76
67
  onError(error);
77
68
  }
78
69
  }).finally(()=>{
79
- bootstrap(runtime, options);
70
+ bootstrap(runtime, [
71
+ ...moduleDefinitions,
72
+ ...toLocalModuleDefinitions(localModules)
73
+ ], options);
80
74
  });
81
75
  return runtime;
82
76
  }
83
- function __resetHasExecuteGuard() {
84
- hasExecuted = false;
85
- }
86
77
 
87
- export { ApplicationBootstrappingStartedEvent, __resetHasExecuteGuard, bootstrap, initializeFirefly };
78
+ export { ApplicationBootstrappingStartedEvent, __resetHasExecutedGuard, bootstrap, initializeFirefly };
88
79
 
89
80
  //# sourceMappingURL=initializeFirefly.js.map
@@ -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 type { HoneycombInstrumentationPartialClient } from \"@workleap-telemetry/core\";\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 honeycombInstrumentationClient?: HoneycombInstrumentationPartialClient;\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\n .withText(\"[squide] An error occured while starting MSW.\")\n .withError(error as Error)\n .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 honeycombInstrumentationClient,\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 honeycombInstrumentationClient,\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","useMsw","loggers","plugins","honeycombInstrumentationClient","__resetHasExecuteGuard"],"mappings":";;;;;;;;;;;;;;;;;AAA0H;AACjC;AAC7C;AAEsC;AACT;AAElE,MAAMM,uCAAuC,mCAAmC;AAcvF,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;QACfjB,oBAAoBA,CAA4Ba,cAAcF,SAAS;YAAEK;QAAQ;QACjFf,qBAAqBA,CAACa,SAASH,SAAS;YAAEK;QAAQ;KACrD,EAAE,IAAI,CAACT,CAAAA;QACJ,IAAII,QAAQ,YAAY,EAAE;YACtB,IAAI,CAACZ,UAAUA,CAACgB,WAAW;gBACvB,MAAM,IAAIG,MAAM;YACpB;YAEAH,SAASJ,SACJ,IAAI,CAAC;gBACFT,aAAaA;YACjB,GACC,KAAK,CAAC,CAACiB;gBACJR,QAAQ,MAAM,CACT,QAAQ,CAAC,iDACT,SAAS,CAACQ,OACV,KAAK;YACd;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,EACPC,8BAA8B,EAC9BlB,OAAO,EACV,GAAGI;IAEJ,IAAIQ,aAAa;QACb,MAAM,IAAIF,MAAM;IACpB;IAEAE,cAAc;IAEd,MAAMT,UAAU,IAAIR,cAAcA,CAAC;QAC/BmB;QACAC;QACAG;QACAF;QACAC;IACJ;IAEArB,mBAAmBA,CAACO,SACf,KAAK,CAAC,CAACQ;QACJ,IAAIX,SAAS;YACTA,QAAQW;QACZ;IACJ,GACC,OAAO,CAAC;QACLT,UAAUC,SAASC;IACvB;IAEJ,OAAOD;AACX;AAEO,SAASgB;IACZP,cAAc;AAClB"}
1
+ {"version":3,"file":"initializeFirefly.js","sources":["../src/initializeFirefly.ts"],"sourcesContent":["import { isFunction, ModuleDefinition, toLocalModuleDefinitions, type ModuleRegisterFunction, type RegisterModulesOptions } from \"@squide/core\";\nimport { MswPlugin } from \"@squide/msw\";\nimport type { HoneycombInstrumentationPartialClient } from \"@workleap-telemetry/core\";\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 moduleDefinitions?: ModuleDefinition<TRuntime, TContext, TData>[];\n useMsw?: boolean;\n honeycombInstrumentationClient?: HoneycombInstrumentationPartialClient;\n startMsw?: StartMswFunction<FireflyRuntime>;\n onError?: OnInitializationErrorFunction;\n}\n\nexport function bootstrap<TRuntime extends FireflyRuntime = FireflyRuntime, TContext = unknown, TData = unknown>(\n runtime: TRuntime,\n modulesDefinitions: ModuleDefinition<TRuntime, TContext, TData>[],\n options: Omit<InitializeFireflyOptions<TRuntime, TContext, TData>, \"localModules\" | \"moduleDefinitions\"> = {}\n) {\n const {\n startMsw,\n onError,\n context\n } = options;\n\n runtime.eventBus.dispatch(ApplicationBootstrappingStartedEvent);\n\n runtime.moduleManager.registerModules(modulesDefinitions, { 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 if (runtime.isMswEnabled) {\n runtime.getMswState().setAsReady();\n }\n })\n .catch((error: unknown) => {\n runtime.logger\n .withText(\"[squide] An error occured while starting MSW.\")\n .withError(error as Error)\n .error();\n });\n }\n\n if (onError) {\n results.forEach(error => {\n onError(error);\n });\n }\n });\n}\n\nlet hasExecuted = false;\n\n// Should only be used by tests.\nexport function __resetHasExecutedGuard() {\n hasExecuted = false;\n}\n\nexport function initializeFirefly<TContext = unknown, TData = unknown>(options: InitializeFireflyOptions<FireflyRuntime, TContext, TData> = {}) {\n const {\n mode,\n localModules = [],\n moduleDefinitions = [],\n useMsw,\n plugins = [],\n honeycombInstrumentationClient,\n loggers,\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 if (useMsw) {\n plugins.push(x => new MswPlugin(x));\n }\n\n const runtime = new FireflyRuntime({\n mode,\n honeycombInstrumentationClient,\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(\n runtime,\n [...moduleDefinitions, ...toLocalModuleDefinitions(localModules)],\n options\n );\n });\n\n return runtime;\n}\n"],"names":["isFunction","toLocalModuleDefinitions","MswPlugin","FireflyRuntime","initializeHoneycomb","ApplicationBootstrappingStartedEvent","bootstrap","runtime","modulesDefinitions","options","startMsw","onError","context","results","Error","error","hasExecuted","__resetHasExecutedGuard","initializeFirefly","mode","localModules","moduleDefinitions","useMsw","plugins","honeycombInstrumentationClient","loggers","x"],"mappings":";;;;;;;;;;;;;;AAAgJ;AACxG;AAE0C;AACT;AAElE,MAAMK,uCAAuC,mCAAmC;AAehF,SAASC,UACZC,OAAiB,EACjBC,kBAAiE,EACjEC,UAA2G,CAAC,CAAC;IAE7G,MAAM,EACFC,QAAQ,EACRC,OAAO,EACPC,OAAO,EACV,GAAGH;IAEJF,QAAQ,QAAQ,CAAC,QAAQ,CAACF;IAE1BE,QAAQ,aAAa,CAAC,eAAe,CAACC,oBAAoB;QAAEI;IAAQ,GAC/D,IAAI,CAACC,CAAAA;QACF,IAAIN,QAAQ,YAAY,EAAE;YACtB,IAAI,CAACP,UAAUA,CAACU,WAAW;gBACvB,MAAM,IAAII,MAAM;YACpB;YAEAJ,SAASH,SACJ,IAAI,CAAC;gBACF,IAAIA,QAAQ,YAAY,EAAE;oBACtBA,QAAQ,WAAW,GAAG,UAAU;gBACpC;YACJ,GACC,KAAK,CAAC,CAACQ;gBACJR,QAAQ,MAAM,CACT,QAAQ,CAAC,iDACT,SAAS,CAACQ,OACV,KAAK;YACd;QACR;QAEA,IAAIJ,SAAS;YACTE,QAAQ,OAAO,CAACE,CAAAA;gBACZJ,QAAQI;YACZ;QACJ;IACJ;AACR;AAEA,IAAIC,cAAc;AAElB,gCAAgC;AACzB,SAASC;IACZD,cAAc;AAClB;AAEO,SAASE,kBAAuDT,UAAqE,CAAC,CAAC;IAC1I,MAAM,EACFU,IAAI,EACJC,eAAe,EAAE,EACjBC,oBAAoB,EAAE,EACtBC,MAAM,EACNC,UAAU,EAAE,EACZC,8BAA8B,EAC9BC,OAAO,EACPd,OAAO,EACV,GAAGF;IAEJ,IAAIO,aAAa;QACb,MAAM,IAAIF,MAAM;IACpB;IAEAE,cAAc;IAEd,IAAIM,QAAQ;QACRC,QAAQ,IAAI,CAACG,CAAAA,IAAK,IAAIxB,SAASA,CAACwB;IACpC;IAEA,MAAMnB,UAAU,IAAIJ,cAAcA,CAAC;QAC/BgB;QACAK;QACAC;QACAF;IACJ;IAEAnB,mBAAmBA,CAACG,SACf,KAAK,CAAC,CAACQ;QACJ,IAAIJ,SAAS;YACTA,QAAQI;QACZ;IACJ,GACC,OAAO,CAAC;QACLT,UACIC,SACA;eAAIc;eAAsBpB,wBAAwBA,CAACmB;SAAc,EACjEX;IAER;IAEJ,OAAOF;AACX"}
@@ -0,0 +1,6 @@
1
+ export { AppRouterDispatcherContext, AppRouterStateContext } from "./AppRouterContext.ts";
2
+ export { __clearAppReducerDispatchProxy, __setAppReducerDispatchProxyFactory, useAppRouterReducer, type AppRouterDispatch, type AppRouterState } from "./AppRouterReducer.ts";
3
+ export type { ActiveSpan, ActiveSpanId } from "./honeycomb/activeSpan.ts";
4
+ export { addProtectedListener, type AddProtectedListenerOptions, type GetSpanFunction, type HoneycombTrackingUnmanagedErrorHandler } from "./honeycomb/registerHoneycombInstrumentation.ts";
5
+ export { getTracer } from "./honeycomb/tracer.ts";
6
+ export { endActiveSpan, startActiveChildSpan, startActiveSpan, startChildSpan, startSpan, traceError, type StartActiveChildSpanFactory, type StartActiveChildSpanFactoryReturn, type StartActiveSpanFactory, type StartActiveSpanFactoryReturn, type StartChildSpanFactory, type StartSpanFactory, type TraceErrorOptions } from "./honeycomb/utils.ts";
@@ -0,0 +1,26 @@
1
+ import { AppRouterDispatcherContext, AppRouterStateContext } from "./AppRouterContext.js";
2
+ import { __clearAppReducerDispatchProxy, __setAppReducerDispatchProxyFactory, useAppRouterReducer } from "./AppRouterReducer.js";
3
+ import { addProtectedListener } from "./honeycomb/registerHoneycombInstrumentation.js";
4
+ import { getTracer } from "./honeycomb/tracer.js";
5
+ import { endActiveSpan, startActiveChildSpan, startActiveSpan, startChildSpan, startSpan, traceError } from "./honeycomb/utils.js";
6
+
7
+ ;// CONCATENATED MODULE: external "./AppRouterContext.js"
8
+
9
+ ;// CONCATENATED MODULE: external "./AppRouterReducer.js"
10
+
11
+ ;// CONCATENATED MODULE: external "./honeycomb/registerHoneycombInstrumentation.js"
12
+
13
+ ;// CONCATENATED MODULE: external "./honeycomb/tracer.js"
14
+
15
+ ;// CONCATENATED MODULE: external "./honeycomb/utils.js"
16
+
17
+ ;// CONCATENATED MODULE: ./src/internal.ts
18
+
19
+
20
+
21
+
22
+
23
+
24
+ export { AppRouterDispatcherContext, AppRouterStateContext, __clearAppReducerDispatchProxy, __setAppReducerDispatchProxyFactory, addProtectedListener, endActiveSpan, getTracer, startActiveChildSpan, startActiveSpan, startChildSpan, startSpan, traceError, useAppRouterReducer };
25
+
26
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.js","sources":["../src/internal.ts"],"sourcesContent":["export { AppRouterDispatcherContext, AppRouterStateContext } from \"./AppRouterContext.ts\";\nexport { __clearAppReducerDispatchProxy, __setAppReducerDispatchProxyFactory, useAppRouterReducer, type AppRouterDispatch, type AppRouterState } from \"./AppRouterReducer.ts\";\n\nexport type { ActiveSpan, ActiveSpanId } from \"./honeycomb/activeSpan.ts\";\nexport { addProtectedListener, type AddProtectedListenerOptions, type GetSpanFunction, type HoneycombTrackingUnmanagedErrorHandler } from \"./honeycomb/registerHoneycombInstrumentation.ts\";\nexport { getTracer } from \"./honeycomb/tracer.ts\";\nexport {\n endActiveSpan,\n startActiveChildSpan,\n startActiveSpan,\n startChildSpan,\n startSpan,\n traceError,\n type StartActiveChildSpanFactory,\n type StartActiveChildSpanFactoryReturn,\n type StartActiveSpanFactory,\n type StartActiveSpanFactoryReturn,\n type StartChildSpanFactory,\n type StartSpanFactory,\n type TraceErrorOptions\n} from \"./honeycomb/utils.ts\";\n\n"],"names":["AppRouterDispatcherContext","AppRouterStateContext","__clearAppReducerDispatchProxy","__setAppReducerDispatchProxyFactory","useAppRouterReducer","addProtectedListener","getTracer","endActiveSpan","startActiveChildSpan","startActiveSpan","startChildSpan","startSpan","traceError"],"mappings":";;;;;;;;;;;;;;;;;AAA0F;AACoF;AAGc;AAC1I;AAepB"}
@@ -1 +1 @@
1
- {"version":3,"file":"useAppRouterStore.js","sources":["webpack://@squide/firefly/./src/useAppRouterStore.ts"],"sourcesContent":["import { useRuntime } from \"@squide/core\";\nimport type { FireflyRuntime } from \"./FireflyRuntime.tsx\";\n\nexport function useAppRouterStore() {\n const runtime = useRuntime() as FireflyRuntime;\n\n return runtime.appRouterStore;\n}\n"],"names":["useRuntime","useAppRouterStore","runtime"],"mappings":";;;;;AAA0C;AAGnC,SAASC;IACZ,MAAMC,UAAUF,UAAUA;IAE1B,OAAOE,QAAQ,cAAc;AACjC"}
1
+ {"version":3,"file":"useAppRouterStore.js","sources":["../src/useAppRouterStore.ts"],"sourcesContent":["import { useRuntime } from \"@squide/core\";\nimport type { FireflyRuntime } from \"./FireflyRuntime.tsx\";\n\nexport function useAppRouterStore() {\n const runtime = useRuntime() as FireflyRuntime;\n\n return runtime.appRouterStore;\n}\n"],"names":["useRuntime","useAppRouterStore","runtime"],"mappings":";;;;;AAA0C;AAGnC,SAASC;IACZ,MAAMC,UAAUF,UAAUA;IAE1B,OAAOE,QAAQ,cAAc;AACjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useCanFetchProtectedData.js","sources":["webpack://@squide/firefly/./src/useCanFetchProtectedData.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\nimport type { ActiveRouteVisiblity } from \"./AppRouterReducer.ts\";\n\n// This function is exported for external integration, like the integration\n// with the Platform Widgets. Do not remove.\nexport function canFetchProtectedData(\n waitForMsw: boolean,\n areModulesRegistered: boolean,\n areModulesReady: boolean,\n activeRouteVisibility: ActiveRouteVisiblity,\n isMswReady: boolean\n) {\n return (\n // Wait until the modules has been registered, but do not wait for the deferred registrations to be registered as they will probably\n // depends on the protected data.\n (areModulesRegistered || areModulesReady)\n // Only fetch the protected data for protected routes, aka do not fetch the protected data for public routes.\n && activeRouteVisibility === \"protected\"\n // Wait for MSW since the endpoints for the protected data might be an MSW endpoint when in development.\n && (!waitForMsw || isMswReady)\n );\n}\n\nexport function useCanFetchProtectedData() {\n const {\n waitForMsw,\n areModulesRegistered,\n areModulesReady,\n isMswReady,\n isProtectedDataReady,\n activeRouteVisibility\n } = useAppRouterState();\n\n // Always return true when the protected data has already been fetched sucessfully so TanStack Query can update the data in the background.\n return isProtectedDataReady || canFetchProtectedData(\n waitForMsw,\n areModulesRegistered,\n areModulesReady,\n activeRouteVisibility,\n isMswReady\n );\n}\n"],"names":["useAppRouterState","canFetchProtectedData","waitForMsw","areModulesRegistered","areModulesReady","activeRouteVisibility","isMswReady","useCanFetchProtectedData","isProtectedDataReady"],"mappings":";;;;;AAA0D;AAG1D,2EAA2E;AAC3E,4CAA4C;AACrC,SAASC,sBACZC,UAAmB,EACnBC,oBAA6B,EAC7BC,eAAwB,EACxBC,qBAA2C,EAC3CC,UAAmB;IAEnB,OACI,oIAAoI;IACpI,iCAAiC;IAChCH,CAAAA,wBAAwBC,eAAc,KAEpCC,0BAA0B,eAEzB,EAACH,cAAcI,UAAS;AAEpC;AAEO,SAASC;IACZ,MAAM,EACFL,UAAU,EACVC,oBAAoB,EACpBC,eAAe,EACfE,UAAU,EACVE,oBAAoB,EACpBH,qBAAqB,EACxB,GAAGL,iBAAiBA;IAErB,2IAA2I;IAC3I,OAAOQ,wBAAwBP,sBAC3BC,YACAC,sBACAC,iBACAC,uBACAC;AAER"}
1
+ {"version":3,"file":"useCanFetchProtectedData.js","sources":["../src/useCanFetchProtectedData.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\nimport type { ActiveRouteVisiblity } from \"./AppRouterReducer.ts\";\n\n// This function is exported for external integration, like the integration\n// with the Platform Widgets. Do not remove.\nexport function canFetchProtectedData(\n waitForMsw: boolean,\n areModulesRegistered: boolean,\n areModulesReady: boolean,\n activeRouteVisibility: ActiveRouteVisiblity,\n isMswReady: boolean\n) {\n return (\n // Wait until the modules has been registered, but do not wait for the deferred registrations to be registered as they will probably\n // depends on the protected data.\n (areModulesRegistered || areModulesReady)\n // Only fetch the protected data for protected routes, aka do not fetch the protected data for public routes.\n && activeRouteVisibility === \"protected\"\n // Wait for MSW since the endpoints for the protected data might be an MSW endpoint when in development.\n && (!waitForMsw || isMswReady)\n );\n}\n\nexport function useCanFetchProtectedData() {\n const {\n waitForMsw,\n areModulesRegistered,\n areModulesReady,\n isMswReady,\n isProtectedDataReady,\n activeRouteVisibility\n } = useAppRouterState();\n\n // Always return true when the protected data has already been fetched sucessfully so TanStack Query can update the data in the background.\n return isProtectedDataReady || canFetchProtectedData(\n waitForMsw,\n areModulesRegistered,\n areModulesReady,\n activeRouteVisibility,\n isMswReady\n );\n}\n"],"names":["useAppRouterState","canFetchProtectedData","waitForMsw","areModulesRegistered","areModulesReady","activeRouteVisibility","isMswReady","useCanFetchProtectedData","isProtectedDataReady"],"mappings":";;;;;AAA0D;AAG1D,2EAA2E;AAC3E,4CAA4C;AACrC,SAASC,sBACZC,UAAmB,EACnBC,oBAA6B,EAC7BC,eAAwB,EACxBC,qBAA2C,EAC3CC,UAAmB;IAEnB,OACI,oIAAoI;IACpI,iCAAiC;IAChCH,CAAAA,wBAAwBC,eAAc,KAEpCC,0BAA0B,eAEzB,EAACH,cAAcI,UAAS;AAEpC;AAEO,SAASC;IACZ,MAAM,EACFL,UAAU,EACVC,oBAAoB,EACpBC,eAAe,EACfE,UAAU,EACVE,oBAAoB,EACpBH,qBAAqB,EACxB,GAAGL,iBAAiBA;IAErB,2IAA2I;IAC3I,OAAOQ,wBAAwBP,sBAC3BC,YACAC,sBACAC,iBACAC,uBACAC;AAER"}
@@ -1 +1 @@
1
- {"version":3,"file":"useCanFetchPublicData.js","sources":["webpack://@squide/firefly/./src/useCanFetchPublicData.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\n\nexport function useCanFetchPublicData() {\n const {\n waitForMsw,\n areModulesRegistered,\n areModulesReady,\n isMswReady,\n isPublicDataReady\n } = useAppRouterState();\n\n return (\n // Always return true when the public data has already been fetched sucessfully so TanStack Query can update the data in the background.\n isPublicDataReady\n || (\n // Wait until the modules has been registered, but do not wait for the deferred registrations to be registered has they will probably\n // depends on the protected data.\n (areModulesRegistered || areModulesReady)\n // Wait for MSW since the endpoints for the protected data might be an MSW endpoint when in development.\n && (!waitForMsw || isMswReady)\n )\n );\n}\n"],"names":["useAppRouterState","useCanFetchPublicData","waitForMsw","areModulesRegistered","areModulesReady","isMswReady","isPublicDataReady"],"mappings":";;;;;AAA0D;AAEnD,SAASC;IACZ,MAAM,EACFC,UAAU,EACVC,oBAAoB,EACpBC,eAAe,EACfC,UAAU,EACVC,iBAAiB,EACpB,GAAGN,iBAAiBA;IAErB,OACI,wIAAwI;IACxIM,qBAEI,qIAAqI;IACrI,iCAAiC;IAChCH,CAAAA,wBAAwBC,eAAc,KAEnC,EAACF,cAAcG,UAAS;AAGxC"}
1
+ {"version":3,"file":"useCanFetchPublicData.js","sources":["../src/useCanFetchPublicData.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\n\nexport function useCanFetchPublicData() {\n const {\n waitForMsw,\n areModulesRegistered,\n areModulesReady,\n isMswReady,\n isPublicDataReady\n } = useAppRouterState();\n\n return (\n // Always return true when the public data has already been fetched sucessfully so TanStack Query can update the data in the background.\n isPublicDataReady\n || (\n // Wait until the modules has been registered, but do not wait for the deferred registrations to be registered has they will probably\n // depends on the protected data.\n (areModulesRegistered || areModulesReady)\n // Wait for MSW since the endpoints for the protected data might be an MSW endpoint when in development.\n && (!waitForMsw || isMswReady)\n )\n );\n}\n"],"names":["useAppRouterState","useCanFetchPublicData","waitForMsw","areModulesRegistered","areModulesReady","isMswReady","isPublicDataReady"],"mappings":";;;;;AAA0D;AAEnD,SAASC;IACZ,MAAM,EACFC,UAAU,EACVC,oBAAoB,EACpBC,eAAe,EACfC,UAAU,EACVC,iBAAiB,EACpB,GAAGN,iBAAiBA;IAErB,OACI,wIAAwI;IACxIM,qBAEI,qIAAqI;IACrI,iCAAiC;IAChCH,CAAAA,wBAAwBC,eAAc,KAEnC,EAACF,cAAcG,UAAS;AAGxC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useCanRegisterDeferredRegistrations.js","sources":["webpack://@squide/firefly/./src/useCanRegisterDeferredRegistrations.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\n\nexport function useCanRegisterDeferredRegistrations() {\n const {\n waitForPublicData,\n waitForProtectedData,\n areModulesReady,\n areModulesRegistered,\n isPublicDataReady,\n isProtectedDataReady,\n activeRouteVisibility,\n isUnauthorized\n } = useAppRouterState();\n\n return (\n !isUnauthorized\n // Wait for the modules to be registered but make sure the deferred registrations has not been registered yet (updates are handled by another hook).\n && areModulesRegistered && !areModulesReady\n // && (!waitForMsw || isMswReady)\n // Wait for the initial data to be ready since the deferred registrations will probably need that data.\n && (!waitForPublicData || isPublicDataReady)\n && (!waitForProtectedData || activeRouteVisibility === \"public\" || isProtectedDataReady)\n );\n}\n"],"names":["useAppRouterState","useCanRegisterDeferredRegistrations","waitForPublicData","waitForProtectedData","areModulesReady","areModulesRegistered","isPublicDataReady","isProtectedDataReady","activeRouteVisibility","isUnauthorized"],"mappings":";;;;;AAA0D;AAEnD,SAASC;IACZ,MAAM,EACFC,iBAAiB,EACjBC,oBAAoB,EACpBC,eAAe,EACfC,oBAAoB,EACpBC,iBAAiB,EACjBC,oBAAoB,EACpBC,qBAAqB,EACrBC,cAAc,EACjB,GAAGT,iBAAiBA;IAErB,OACI,CAACS,kBAEEJ,wBAAwB,CAACD,mBAGxB,EAACF,qBAAqBI,iBAAgB,KACtC,EAACH,wBAAwBK,0BAA0B,YAAYD,oBAAmB;AAE9F"}
1
+ {"version":3,"file":"useCanRegisterDeferredRegistrations.js","sources":["../src/useCanRegisterDeferredRegistrations.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\n\nexport function useCanRegisterDeferredRegistrations() {\n const {\n waitForPublicData,\n waitForProtectedData,\n areModulesReady,\n areModulesRegistered,\n isPublicDataReady,\n isProtectedDataReady,\n activeRouteVisibility,\n isUnauthorized\n } = useAppRouterState();\n\n return (\n !isUnauthorized\n // Wait for the modules to be registered but make sure the deferred registrations has not been registered yet (updates are handled by another hook).\n && areModulesRegistered && !areModulesReady\n // && (!waitForMsw || isMswReady)\n // Wait for the initial data to be ready since the deferred registrations will probably need that data.\n && (!waitForPublicData || isPublicDataReady)\n && (!waitForProtectedData || activeRouteVisibility === \"public\" || isProtectedDataReady)\n );\n}\n"],"names":["useAppRouterState","useCanRegisterDeferredRegistrations","waitForPublicData","waitForProtectedData","areModulesReady","areModulesRegistered","isPublicDataReady","isProtectedDataReady","activeRouteVisibility","isUnauthorized"],"mappings":";;;;;AAA0D;AAEnD,SAASC;IACZ,MAAM,EACFC,iBAAiB,EACjBC,oBAAoB,EACpBC,eAAe,EACfC,oBAAoB,EACpBC,iBAAiB,EACjBC,oBAAoB,EACpBC,qBAAqB,EACrBC,cAAc,EACjB,GAAGT,iBAAiBA;IAErB,OACI,CAACS,kBAEEJ,wBAAwB,CAACD,mBAGxB,EAACF,qBAAqBI,iBAAgB,KACtC,EAACH,wBAAwBK,0BAA0B,YAAYD,oBAAmB;AAE9F"}
@@ -1 +1 @@
1
- {"version":3,"file":"useCanUpdateDeferredRegistrations.js","sources":["webpack://@squide/firefly/./src/useCanUpdateDeferredRegistrations.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\n\nexport function useCanUpdateDeferredRegistrations() {\n const {\n areModulesReady,\n publicDataUpdatedAt,\n protectedDataUpdatedAt,\n deferredRegistrationsUpdatedAt\n } = useAppRouterState();\n\n return (\n // Do not trigger an update if the deferred registrations has not been registered yet (if there are deferred registrations, once they are\n // registered, the modules will be marked as ready).\n areModulesReady\n // Make sure the apps is actually having deferred registrations.\n && deferredRegistrationsUpdatedAt\n // If either the public data or the protected data has been updated, update the deferred registrations.\n && (\n (publicDataUpdatedAt && publicDataUpdatedAt > deferredRegistrationsUpdatedAt) ||\n (protectedDataUpdatedAt && protectedDataUpdatedAt > deferredRegistrationsUpdatedAt)\n )\n );\n}\n"],"names":["useAppRouterState","useCanUpdateDeferredRegistrations","areModulesReady","publicDataUpdatedAt","protectedDataUpdatedAt","deferredRegistrationsUpdatedAt"],"mappings":";;;;;AAA0D;AAEnD,SAASC;IACZ,MAAM,EACFC,eAAe,EACfC,mBAAmB,EACnBC,sBAAsB,EACtBC,8BAA8B,EACjC,GAAGL,iBAAiBA;IAErB,OACI,yIAAyI;IACzI,oDAAoD;IACpDE,mBAEGG,kCAGC,CAACF,uBAAuBA,sBAAsBE,kCAC7CD,0BAA0BA,yBAAyBC,8BAA8B;AAG9F"}
1
+ {"version":3,"file":"useCanUpdateDeferredRegistrations.js","sources":["../src/useCanUpdateDeferredRegistrations.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\n\nexport function useCanUpdateDeferredRegistrations() {\n const {\n areModulesReady,\n publicDataUpdatedAt,\n protectedDataUpdatedAt,\n deferredRegistrationsUpdatedAt\n } = useAppRouterState();\n\n return (\n // Do not trigger an update if the deferred registrations has not been registered yet (if there are deferred registrations, once they are\n // registered, the modules will be marked as ready).\n areModulesReady\n // Make sure the apps is actually having deferred registrations.\n && deferredRegistrationsUpdatedAt\n // If either the public data or the protected data has been updated, update the deferred registrations.\n && (\n (publicDataUpdatedAt && publicDataUpdatedAt > deferredRegistrationsUpdatedAt) ||\n (protectedDataUpdatedAt && protectedDataUpdatedAt > deferredRegistrationsUpdatedAt)\n )\n );\n}\n"],"names":["useAppRouterState","useCanUpdateDeferredRegistrations","areModulesReady","publicDataUpdatedAt","protectedDataUpdatedAt","deferredRegistrationsUpdatedAt"],"mappings":";;;;;AAA0D;AAEnD,SAASC;IACZ,MAAM,EACFC,eAAe,EACfC,mBAAmB,EACnBC,sBAAsB,EACtBC,8BAA8B,EACjC,GAAGL,iBAAiBA;IAErB,OACI,yIAAyI;IACzI,oDAAoD;IACpDE,mBAEGG,kCAGC,CAACF,uBAAuBA,sBAAsBE,kCAC7CD,0BAA0BA,yBAAyBC,8BAA8B;AAG9F"}
@@ -1,9 +1,5 @@
1
1
  import { type ModuleRegistrationError } from "@squide/core";
2
- export interface DeferredRegistrationsErrorsObject {
3
- localModuleErrors: ModuleRegistrationError[];
4
- remoteModuleErrors: ModuleRegistrationError[];
5
- }
6
- export type DeferredRegistrationsErrorCallback = (errorsObject: DeferredRegistrationsErrorsObject) => void;
2
+ export type DeferredRegistrationsErrorCallback = (errors: ModuleRegistrationError[]) => void;
7
3
  export interface UseDeferredRegistrationsOptions {
8
4
  onError?: DeferredRegistrationsErrorCallback;
9
5
  }
@@ -24,9 +24,6 @@ import { useUpdateDeferredRegistrations } from "./useUpdateDeferredRegistrations
24
24
 
25
25
 
26
26
 
27
- function hasError({ localModuleErrors, remoteModuleErrors }) {
28
- return localModuleErrors.length > 0 || remoteModuleErrors.length > 0;
29
- }
30
27
  function useDeferredRegistrations(data, { onError } = {}) {
31
28
  const runtime = useRuntime();
32
29
  const canRegisterDeferredRegistrations = useCanRegisterDeferredRegistrations();
@@ -37,7 +34,7 @@ function useDeferredRegistrations(data, { onError } = {}) {
37
34
  if (canRegisterDeferredRegistrations) {
38
35
  const register = async ()=>{
39
36
  const errors = await registerDeferredRegistrations(data, runtime);
40
- if (hasError(errors) && onError) {
37
+ if (errors.length > 0 && onError) {
41
38
  onError(errors);
42
39
  }
43
40
  };
@@ -54,7 +51,7 @@ function useDeferredRegistrations(data, { onError } = {}) {
54
51
  if (canUpdateDeferredRegistrations) {
55
52
  const update = async ()=>{
56
53
  const errors = await updateDeferredRegistrations(data, runtime);
57
- if (hasError(errors) && onError) {
54
+ if (errors.length > 0 && onError) {
58
55
  onError(errors);
59
56
  }
60
57
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useDeferredRegistrations.js","sources":["webpack://@squide/firefly/./src/useDeferredRegistrations.ts"],"sourcesContent":["import { useRuntime, type ModuleRegistrationError } from \"@squide/core\";\nimport { useEffect } from \"react\";\nimport { useCanRegisterDeferredRegistrations } from \"./useCanRegisterDeferredRegistrations.ts\";\nimport { useCanUpdateDeferredRegistrations } from \"./useCanUpdateDeferredRegistrations.ts\";\nimport { useRegisterDeferredRegistrations } from \"./useRegisterDeferredRegistrations.ts\";\nimport { useUpdateDeferredRegistrations } from \"./useUpdateDeferredRegistrations.ts\";\n\nexport interface DeferredRegistrationsErrorsObject {\n localModuleErrors: ModuleRegistrationError[];\n remoteModuleErrors: ModuleRegistrationError[];\n}\n\nexport type DeferredRegistrationsErrorCallback = (errorsObject: DeferredRegistrationsErrorsObject) => void;\n\nexport interface UseDeferredRegistrationsOptions {\n onError?: DeferredRegistrationsErrorCallback;\n}\n\nfunction hasError({ localModuleErrors, remoteModuleErrors }: DeferredRegistrationsErrorsObject) {\n return localModuleErrors.length > 0 || remoteModuleErrors.length > 0;\n}\n\nexport function useDeferredRegistrations(data: unknown, { onError }: UseDeferredRegistrationsOptions = {}) {\n const runtime = useRuntime();\n\n const canRegisterDeferredRegistrations = useCanRegisterDeferredRegistrations();\n const canUpdateDeferredRegistrations = useCanUpdateDeferredRegistrations();\n\n const registerDeferredRegistrations = useRegisterDeferredRegistrations();\n const updateDeferredRegistrations = useUpdateDeferredRegistrations();\n\n useEffect(() => {\n if (canRegisterDeferredRegistrations) {\n const register = async () => {\n const errors = await registerDeferredRegistrations(data, runtime);\n\n if (hasError(errors) && onError) {\n onError(errors);\n }\n };\n\n register();\n }\n }, [canRegisterDeferredRegistrations, registerDeferredRegistrations, data, onError, runtime]);\n\n useEffect(() => {\n if (canUpdateDeferredRegistrations) {\n const update = async () => {\n const errors = await updateDeferredRegistrations(data, runtime);\n\n if (hasError(errors) && onError) {\n onError(errors);\n }\n };\n\n update();\n }\n }, [canUpdateDeferredRegistrations, updateDeferredRegistrations, data, onError, runtime]);\n}\n"],"names":["useRuntime","useEffect","useCanRegisterDeferredRegistrations","useCanUpdateDeferredRegistrations","useRegisterDeferredRegistrations","useUpdateDeferredRegistrations","hasError","localModuleErrors","remoteModuleErrors","useDeferredRegistrations","data","onError","runtime","canRegisterDeferredRegistrations","canUpdateDeferredRegistrations","registerDeferredRegistrations","updateDeferredRegistrations","register","errors","update"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAwE;AACtC;AAC6D;AACJ;AACF;AACJ;AAarF,SAASM,SAAS,EAAEC,iBAAiB,EAAEC,kBAAkB,EAAqC;IAC1F,OAAOD,kBAAkB,MAAM,GAAG,KAAKC,mBAAmB,MAAM,GAAG;AACvE;AAEO,SAASC,yBAAyBC,IAAa,EAAE,EAAEC,OAAO,EAAmC,GAAG,CAAC,CAAC;IACrG,MAAMC,UAAUZ,UAAUA;IAE1B,MAAMa,mCAAmCX,mCAAmCA;IAC5E,MAAMY,iCAAiCX,iCAAiCA;IAExE,MAAMY,gCAAgCX,gCAAgCA;IACtE,MAAMY,8BAA8BX,8BAA8BA;IAElEJ,SAASA,CAAC;QACN,IAAIY,kCAAkC;YAClC,MAAMI,WAAW;gBACb,MAAMC,SAAS,MAAMH,8BAA8BL,MAAME;gBAEzD,IAAIN,SAASY,WAAWP,SAAS;oBAC7BA,QAAQO;gBACZ;YACJ;YAEAD;QACJ;IACJ,GAAG;QAACJ;QAAkCE;QAA+BL;QAAMC;QAASC;KAAQ;IAE5FX,SAASA,CAAC;QACN,IAAIa,gCAAgC;YAChC,MAAMK,SAAS;gBACX,MAAMD,SAAS,MAAMF,4BAA4BN,MAAME;gBAEvD,IAAIN,SAASY,WAAWP,SAAS;oBAC7BA,QAAQO;gBACZ;YACJ;YAEAC;QACJ;IACJ,GAAG;QAACL;QAAgCE;QAA6BN;QAAMC;QAASC;KAAQ;AAC5F"}
1
+ {"version":3,"file":"useDeferredRegistrations.js","sources":["../src/useDeferredRegistrations.ts"],"sourcesContent":["import { useRuntime, type ModuleRegistrationError } from \"@squide/core\";\nimport { useEffect } from \"react\";\nimport { useCanRegisterDeferredRegistrations } from \"./useCanRegisterDeferredRegistrations.ts\";\nimport { useCanUpdateDeferredRegistrations } from \"./useCanUpdateDeferredRegistrations.ts\";\nimport { useRegisterDeferredRegistrations } from \"./useRegisterDeferredRegistrations.ts\";\nimport { useUpdateDeferredRegistrations } from \"./useUpdateDeferredRegistrations.ts\";\n\nexport type DeferredRegistrationsErrorCallback = (errors: ModuleRegistrationError[]) => void;\n\nexport interface UseDeferredRegistrationsOptions {\n onError?: DeferredRegistrationsErrorCallback;\n}\n\nexport function useDeferredRegistrations(data: unknown, { onError }: UseDeferredRegistrationsOptions = {}) {\n const runtime = useRuntime();\n\n const canRegisterDeferredRegistrations = useCanRegisterDeferredRegistrations();\n const canUpdateDeferredRegistrations = useCanUpdateDeferredRegistrations();\n\n const registerDeferredRegistrations = useRegisterDeferredRegistrations();\n const updateDeferredRegistrations = useUpdateDeferredRegistrations();\n\n useEffect(() => {\n if (canRegisterDeferredRegistrations) {\n const register = async () => {\n const errors = await registerDeferredRegistrations(data, runtime);\n\n if (errors.length > 0 && onError) {\n onError(errors);\n }\n };\n\n register();\n }\n }, [canRegisterDeferredRegistrations, registerDeferredRegistrations, data, onError, runtime]);\n\n useEffect(() => {\n if (canUpdateDeferredRegistrations) {\n const update = async () => {\n const errors = await updateDeferredRegistrations(data, runtime);\n\n if (errors.length > 0 && onError) {\n onError(errors);\n }\n };\n\n update();\n }\n }, [canUpdateDeferredRegistrations, updateDeferredRegistrations, data, onError, runtime]);\n}\n"],"names":["useRuntime","useEffect","useCanRegisterDeferredRegistrations","useCanUpdateDeferredRegistrations","useRegisterDeferredRegistrations","useUpdateDeferredRegistrations","useDeferredRegistrations","data","onError","runtime","canRegisterDeferredRegistrations","canUpdateDeferredRegistrations","registerDeferredRegistrations","updateDeferredRegistrations","register","errors","update"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAwE;AACtC;AAC6D;AACJ;AACF;AACJ;AAQ9E,SAASM,yBAAyBC,IAAa,EAAE,EAAEC,OAAO,EAAmC,GAAG,CAAC,CAAC;IACrG,MAAMC,UAAUT,UAAUA;IAE1B,MAAMU,mCAAmCR,mCAAmCA;IAC5E,MAAMS,iCAAiCR,iCAAiCA;IAExE,MAAMS,gCAAgCR,gCAAgCA;IACtE,MAAMS,8BAA8BR,8BAA8BA;IAElEJ,SAASA,CAAC;QACN,IAAIS,kCAAkC;YAClC,MAAMI,WAAW;gBACb,MAAMC,SAAS,MAAMH,8BAA8BL,MAAME;gBAEzD,IAAIM,OAAO,MAAM,GAAG,KAAKP,SAAS;oBAC9BA,QAAQO;gBACZ;YACJ;YAEAD;QACJ;IACJ,GAAG;QAACJ;QAAkCE;QAA+BL;QAAMC;QAASC;KAAQ;IAE5FR,SAASA,CAAC;QACN,IAAIU,gCAAgC;YAChC,MAAMK,SAAS;gBACX,MAAMD,SAAS,MAAMF,4BAA4BN,MAAME;gBAEvD,IAAIM,OAAO,MAAM,GAAG,KAAKP,SAAS;oBAC9BA,QAAQO;gBACZ;YACJ;YAEAC;QACJ;IACJ,GAAG;QAACL;QAAgCE;QAA6BN;QAAMC;QAASC;KAAQ;AAC5F"}
@@ -1 +1 @@
1
- {"version":3,"file":"useExecuteOnce.js","sources":["webpack://@squide/firefly/./src/useExecuteOnce.ts"],"sourcesContent":["import { useCallback, useRef } from \"react\";\n\n// Not using useEffect or useLayoutEffect because this utility hook is often used to dispatch events\n// and it messed with the events dispatch order.\nexport function useExecuteOnce(fct: () => boolean, inline: boolean = false) {\n const triggered = useRef(false);\n\n const onceFct = useCallback(() => {\n if (!triggered.current) {\n const result = fct();\n\n if (result) {\n triggered.current = true;\n }\n }\n }, [fct]);\n\n if (inline) {\n onceFct();\n }\n\n return onceFct;\n}\n"],"names":["useCallback","useRef","useExecuteOnce","fct","inline","triggered","onceFct","result"],"mappings":";;;;;AAA4C;AAE5C,oGAAoG;AACpG,gDAAgD;AACzC,SAASE,eAAeC,GAAkB,EAAEC,SAAkB,KAAK;IACtE,MAAMC,YAAYJ,MAAMA,CAAC;IAEzB,MAAMK,UAAUN,WAAWA,CAAC;QACxB,IAAI,CAACK,UAAU,OAAO,EAAE;YACpB,MAAME,SAASJ;YAEf,IAAII,QAAQ;gBACRF,UAAU,OAAO,GAAG;YACxB;QACJ;IACJ,GAAG;QAACF;KAAI;IAER,IAAIC,QAAQ;QACRE;IACJ;IAEA,OAAOA;AACX"}
1
+ {"version":3,"file":"useExecuteOnce.js","sources":["../src/useExecuteOnce.ts"],"sourcesContent":["import { useCallback, useRef } from \"react\";\n\n// Not using useEffect or useLayoutEffect because this utility hook is often used to dispatch events\n// and it messed with the events dispatch order.\nexport function useExecuteOnce(fct: () => boolean, inline: boolean = false) {\n const triggered = useRef(false);\n\n const onceFct = useCallback(() => {\n if (!triggered.current) {\n const result = fct();\n\n if (result) {\n triggered.current = true;\n }\n }\n }, [fct]);\n\n if (inline) {\n onceFct();\n }\n\n return onceFct;\n}\n"],"names":["useCallback","useRef","useExecuteOnce","fct","inline","triggered","onceFct","result"],"mappings":";;;;;AAA4C;AAE5C,oGAAoG;AACpG,gDAAgD;AACzC,SAASE,eAAeC,GAAkB,EAAEC,SAAkB,KAAK;IACtE,MAAMC,YAAYJ,MAAMA,CAAC;IAEzB,MAAMK,UAAUN,WAAWA,CAAC;QACxB,IAAI,CAACK,UAAU,OAAO,EAAE;YACpB,MAAME,SAASJ;YAEf,IAAII,QAAQ;gBACRF,UAAU,OAAO,GAAG;YACxB;QACJ;IACJ,GAAG;QAACF;KAAI;IAER,IAAIC,QAAQ;QACRE;IACJ;IAEA,OAAOA;AACX"}