@squide/firefly 15.0.5 → 16.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/dist/AppRouter.js.map +1 -1
- package/dist/AppRouterContext.js.map +1 -1
- package/dist/AppRouterReducer.d.ts +3 -4
- package/dist/AppRouterReducer.js +51 -82
- package/dist/AppRouterReducer.js.map +1 -1
- package/dist/AppRouterStore.js.map +1 -1
- package/dist/FireflyPlugin.d.ts +6 -0
- package/dist/FireflyPlugin.js +6 -0
- package/dist/FireflyPlugin.js.map +1 -0
- package/dist/FireflyProvider.js.map +1 -1
- package/dist/FireflyRuntime.d.ts +26 -11
- package/dist/FireflyRuntime.js +61 -45
- package/dist/FireflyRuntime.js.map +1 -1
- package/dist/GlobalDataQueriesError.js.map +1 -1
- package/dist/RootRoute.js.map +1 -1
- package/dist/honeycomb/activeSpan.js.map +1 -1
- package/dist/honeycomb/createTraceContextId.js.map +1 -1
- package/dist/honeycomb/initializeHoneycomb.js.map +1 -1
- package/dist/honeycomb/registerHoneycombInstrumentation.d.ts +8 -0
- package/dist/honeycomb/registerHoneycombInstrumentation.js +19 -136
- package/dist/honeycomb/registerHoneycombInstrumentation.js.map +1 -1
- package/dist/honeycomb/tracer.js.map +1 -1
- package/dist/honeycomb/utils.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +10 -5
- package/dist/index.js.map +1 -1
- package/dist/initializeFirefly.d.ts +8 -6
- package/dist/initializeFirefly.js +34 -34
- package/dist/initializeFirefly.js.map +1 -1
- package/dist/internal.d.ts +6 -0
- package/dist/internal.js +26 -0
- package/dist/internal.js.map +1 -0
- package/dist/useAppRouterStore.js.map +1 -1
- package/dist/useCanFetchProtectedData.js.map +1 -1
- package/dist/useCanFetchPublicData.js.map +1 -1
- package/dist/useCanRegisterDeferredRegistrations.js.map +1 -1
- package/dist/useCanUpdateDeferredRegistrations.js.map +1 -1
- package/dist/useDeferredRegistrations.d.ts +1 -5
- package/dist/useDeferredRegistrations.js +2 -5
- package/dist/useDeferredRegistrations.js.map +1 -1
- package/dist/useExecuteOnce.js.map +1 -1
- package/dist/useIsActiveRouteProtected.js.map +1 -1
- package/dist/useIsBootstrapping.js.map +1 -1
- package/dist/useNavigationItems.js.map +1 -1
- package/dist/useProtectedDataHandler.js.map +1 -1
- package/dist/useProtectedDataQueries.js.map +1 -1
- package/dist/usePublicDataHandler.js.map +1 -1
- package/dist/usePublicDataQueries.js.map +1 -1
- package/dist/useRegisterDeferredRegistrations.d.ts +1 -4
- package/dist/useRegisterDeferredRegistrations.js +1 -5
- package/dist/useRegisterDeferredRegistrations.js.map +1 -1
- package/dist/useStrictRegistrationMode.js +10 -17
- package/dist/useStrictRegistrationMode.js.map +1 -1
- package/dist/useUpdateDeferredRegistrations.d.ts +3 -4
- package/dist/useUpdateDeferredRegistrations.js +6 -6
- package/dist/useUpdateDeferredRegistrations.js.map +1 -1
- package/package.json +33 -23
- package/src/AppRouterReducer.ts +51 -89
- package/src/FireflyPlugin.ts +11 -0
- package/src/FireflyRuntime.tsx +89 -55
- package/src/honeycomb/registerHoneycombInstrumentation.ts +30 -169
- package/src/index.ts +31 -4
- package/src/initializeFirefly.ts +60 -49
- package/src/internal.ts +22 -0
- package/src/useDeferredRegistrations.ts +3 -12
- package/src/useRegisterDeferredRegistrations.ts +1 -2
- package/src/useStrictRegistrationMode.ts +10 -15
- 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,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;AAIO,SAASI,sBACZP,OAA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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","handlePluginUnm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B,+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":["
|
|
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":["
|
|
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,12 @@
|
|
|
1
1
|
export * from "@squide/core";
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export { EnvironmentVariablesPlugin, useEnvironmentVariable, useEnvironmentVariables, type EnvironmentVariableKey, type EnvironmentVariables, type EnvironmentVariablesPluginOptions, type EnvironmentVariableValue } from "@squide/env-vars";
|
|
3
|
+
export { MswPlugin, MswState, type MswPluginOptions, type MswPluginRegisterRequestHandlersOptions, type MswReadyListener, type MswStateOptions } from "@squide/msw";
|
|
4
4
|
export * from "@squide/react-router";
|
|
5
|
+
export type { FireflyPlugin } from "./FireflyPlugin.ts";
|
|
5
6
|
export * from "./FireflyProvider.tsx";
|
|
6
7
|
export * from "./FireflyRuntime.tsx";
|
|
7
8
|
export * from "./AppRouter.tsx";
|
|
8
|
-
export
|
|
9
|
-
export * from "./AppRouterReducer.ts";
|
|
9
|
+
export { ActiveRouteIsProtectedEvent, ActiveRouteIsPublicEvent, ApplicationBoostrappedEvent, DeferredRegistrationsUpdatedEvent, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, ProtectedDataUpdatedEvent, PublicDataReadyEvent, PublicDataUpdatedEvent } from "./AppRouterReducer.ts";
|
|
10
10
|
export * from "./AppRouterStore.ts";
|
|
11
11
|
export * from "./GlobalDataQueriesError.ts";
|
|
12
12
|
export * from "./useCanFetchProtectedData.ts";
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
+
import { EnvironmentVariablesPlugin, useEnvironmentVariable, useEnvironmentVariables } from "@squide/env-vars";
|
|
2
|
+
import { MswPlugin, MswState } from "@squide/msw";
|
|
3
|
+
import { ActiveRouteIsProtectedEvent, ActiveRouteIsPublicEvent, ApplicationBoostrappedEvent, DeferredRegistrationsUpdatedEvent, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, ProtectedDataUpdatedEvent, PublicDataReadyEvent, PublicDataUpdatedEvent } from "./AppRouterReducer.js";
|
|
1
4
|
export * from "@squide/core";
|
|
2
|
-
export * from "@squide/module-federation";
|
|
3
|
-
export * from "@squide/msw";
|
|
4
5
|
export * from "@squide/react-router";
|
|
5
6
|
export * from "./FireflyProvider.js";
|
|
6
7
|
export * from "./FireflyRuntime.js";
|
|
7
8
|
export * from "./AppRouter.js";
|
|
8
|
-
export * from "./AppRouterContext.js";
|
|
9
|
-
export * from "./AppRouterReducer.js";
|
|
10
9
|
export * from "./AppRouterStore.js";
|
|
11
10
|
export * from "./GlobalDataQueriesError.js";
|
|
12
11
|
export * from "./useCanFetchProtectedData.js";
|
|
@@ -26,8 +25,13 @@ export * from "./useStrictRegistrationMode.js";
|
|
|
26
25
|
export * from "./useUpdateDeferredRegistrations.js";
|
|
27
26
|
export * from "./initializeFirefly.js";
|
|
28
27
|
|
|
29
|
-
;// CONCATENATED MODULE:
|
|
28
|
+
;// CONCATENATED MODULE: external "@squide/env-vars"
|
|
29
|
+
|
|
30
|
+
;// CONCATENATED MODULE: external "@squide/msw"
|
|
30
31
|
|
|
32
|
+
;// CONCATENATED MODULE: external "./AppRouterReducer.js"
|
|
33
|
+
|
|
34
|
+
;// CONCATENATED MODULE: ./src/index.ts
|
|
31
35
|
|
|
32
36
|
|
|
33
37
|
|
|
@@ -55,5 +59,6 @@ export * from "./initializeFirefly.js";
|
|
|
55
59
|
|
|
56
60
|
|
|
57
61
|
|
|
62
|
+
export { ActiveRouteIsProtectedEvent, ActiveRouteIsPublicEvent, ApplicationBoostrappedEvent, DeferredRegistrationsUpdatedEvent, EnvironmentVariablesPlugin, ModulesReadyEvent, ModulesRegisteredEvent, MswPlugin, MswReadyEvent, MswState, ProtectedDataReadyEvent, ProtectedDataUpdatedEvent, PublicDataReadyEvent, PublicDataUpdatedEvent, useEnvironmentVariable, useEnvironmentVariables };
|
|
58
63
|
|
|
59
64
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["export * from \"@squide/core\";\nexport {\n EnvironmentVariablesPlugin,\n useEnvironmentVariable,\n useEnvironmentVariables,\n type EnvironmentVariableKey,\n type EnvironmentVariables,\n type EnvironmentVariablesPluginOptions,\n type EnvironmentVariableValue\n} from \"@squide/env-vars\";\nexport {\n MswPlugin,\n MswState,\n type MswPluginOptions,\n type MswPluginRegisterRequestHandlersOptions,\n type MswReadyListener,\n type MswStateOptions\n} 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":["EnvironmentVariablesPlugin","useEnvironmentVariable","useEnvironmentVariables","MswPlugin","MswState","ActiveRouteIsProtectedEvent","ActiveRouteIsPublicEvent","ApplicationBoostrappedEvent","DeferredRegistrationsUpdatedEvent","ModulesReadyEvent","ModulesRegisteredEvent","MswReadyEvent","ProtectedDataReadyEvent","ProtectedDataUpdatedEvent","PublicDataReadyEvent","PublicDataUpdatedEvent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAA6B;AASH;AAQL;AACgB;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,5 @@
|
|
|
1
|
-
import { type ModuleRegisterFunction, type RegisterModulesOptions } from "@squide/core";
|
|
2
|
-
import {
|
|
1
|
+
import { ModuleDefinition, type ModuleRegisterFunction, type RegisterModulesOptions } from "@squide/core";
|
|
2
|
+
import { EnvironmentVariables } from "@squide/env-vars";
|
|
3
3
|
import type { HoneycombInstrumentationPartialClient } from "@workleap-telemetry/core";
|
|
4
4
|
import { FireflyRuntime, type FireflyRuntimeOptions } from "./FireflyRuntime.tsx";
|
|
5
5
|
export declare const ApplicationBootstrappingStartedEvent = "squide-app-bootstrapping-started";
|
|
@@ -7,11 +7,13 @@ export type OnInitializationErrorFunction = (error: unknown) => void;
|
|
|
7
7
|
export type StartMswFunction<TRuntime = FireflyRuntime> = (runtime: TRuntime) => Promise<void>;
|
|
8
8
|
export interface InitializeFireflyOptions<TRuntime extends FireflyRuntime, TContext = unknown, TData = unknown> extends RegisterModulesOptions<TContext>, FireflyRuntimeOptions {
|
|
9
9
|
localModules?: ModuleRegisterFunction<TRuntime, TContext, TData>[];
|
|
10
|
-
|
|
10
|
+
moduleDefinitions?: ModuleDefinition<TRuntime, TContext, TData>[];
|
|
11
|
+
useMsw?: boolean;
|
|
12
|
+
environmentVariables?: Partial<EnvironmentVariables>;
|
|
11
13
|
honeycombInstrumentationClient?: HoneycombInstrumentationPartialClient;
|
|
12
14
|
startMsw?: StartMswFunction<FireflyRuntime>;
|
|
13
15
|
onError?: OnInitializationErrorFunction;
|
|
14
16
|
}
|
|
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
|
|
17
|
-
export declare function
|
|
17
|
+
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;
|
|
18
|
+
export declare function __resetHasExecutedGuard(): void;
|
|
19
|
+
export declare function initializeFirefly<TContext = unknown, TData = unknown>(options?: InitializeFireflyOptions<FireflyRuntime, TContext, TData>): FireflyRuntime<any>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { isFunction,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { isFunction, toLocalModuleDefinitions } from "@squide/core";
|
|
2
|
+
import { EnvironmentVariablesPlugin } from "@squide/env-vars";
|
|
3
|
+
import { MswPlugin } from "@squide/msw";
|
|
4
4
|
import { FireflyRuntime } from "./FireflyRuntime.js";
|
|
5
5
|
import { initializeHoneycomb } from "./honeycomb/initializeHoneycomb.js";
|
|
6
6
|
|
|
7
7
|
;// CONCATENATED MODULE: external "@squide/core"
|
|
8
8
|
|
|
9
|
-
;// CONCATENATED MODULE: external "@squide/
|
|
9
|
+
;// CONCATENATED MODULE: external "@squide/env-vars"
|
|
10
10
|
|
|
11
11
|
;// CONCATENATED MODULE: external "@squide/msw"
|
|
12
12
|
|
|
@@ -21,69 +21,69 @@ import { initializeHoneycomb } from "./honeycomb/initializeHoneycomb.js";
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
const ApplicationBootstrappingStartedEvent = "squide-app-bootstrapping-started";
|
|
24
|
-
function
|
|
25
|
-
|
|
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;
|
|
24
|
+
function bootstrap(runtime, modulesDefinitions, options = {}) {
|
|
25
|
+
const { startMsw, onError, context } = options;
|
|
35
26
|
runtime.eventBus.dispatch(ApplicationBootstrappingStartedEvent);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}),
|
|
40
|
-
registerRemoteModules(remotes, runtime, {
|
|
41
|
-
context
|
|
42
|
-
})
|
|
43
|
-
]).then((results)=>{
|
|
27
|
+
runtime.moduleManager.registerModules(modulesDefinitions, {
|
|
28
|
+
context
|
|
29
|
+
}).then((results)=>{
|
|
44
30
|
if (runtime.isMswEnabled) {
|
|
45
31
|
if (!isFunction(startMsw)) {
|
|
46
32
|
throw new Error("[squide] When MSW is enabled, the \"startMsw\" function must be provided.");
|
|
47
33
|
}
|
|
48
34
|
startMsw(runtime).then(()=>{
|
|
49
|
-
|
|
35
|
+
if (runtime.isMswEnabled) {
|
|
36
|
+
runtime.getMswState().setAsReady();
|
|
37
|
+
}
|
|
50
38
|
}).catch((error)=>{
|
|
51
39
|
runtime.logger.withText("[squide] An error occured while starting MSW.").withError(error).error();
|
|
52
40
|
});
|
|
53
41
|
}
|
|
54
42
|
if (onError) {
|
|
55
|
-
|
|
56
|
-
|
|
43
|
+
results.forEach((error)=>{
|
|
44
|
+
onError(error);
|
|
45
|
+
});
|
|
57
46
|
}
|
|
58
47
|
});
|
|
59
48
|
}
|
|
60
49
|
let hasExecuted = false;
|
|
50
|
+
// Should only be used by tests.
|
|
51
|
+
function __resetHasExecutedGuard() {
|
|
52
|
+
hasExecuted = false;
|
|
53
|
+
}
|
|
61
54
|
function initializeFirefly(options = {}) {
|
|
62
|
-
const { mode,
|
|
55
|
+
const { mode, localModules = [], moduleDefinitions = [], useMsw, plugins = [], environmentVariables, honeycombInstrumentationClient, loggers, onError } = options;
|
|
63
56
|
if (hasExecuted) {
|
|
64
57
|
throw new Error("[squide] A squide application can only be initialized once. Did you call the \"initializeSquide\" function twice?");
|
|
65
58
|
}
|
|
66
59
|
hasExecuted = true;
|
|
60
|
+
if (useMsw) {
|
|
61
|
+
plugins.push((x)=>new MswPlugin(x));
|
|
62
|
+
}
|
|
67
63
|
const runtime = new FireflyRuntime({
|
|
68
64
|
mode,
|
|
69
|
-
useMsw,
|
|
70
65
|
honeycombInstrumentationClient,
|
|
71
66
|
loggers,
|
|
72
|
-
plugins
|
|
67
|
+
plugins: [
|
|
68
|
+
(x)=>new EnvironmentVariablesPlugin(x, {
|
|
69
|
+
variables: environmentVariables
|
|
70
|
+
}),
|
|
71
|
+
...plugins
|
|
72
|
+
]
|
|
73
73
|
});
|
|
74
74
|
initializeHoneycomb(runtime).catch((error)=>{
|
|
75
75
|
if (onError) {
|
|
76
76
|
onError(error);
|
|
77
77
|
}
|
|
78
78
|
}).finally(()=>{
|
|
79
|
-
bootstrap(runtime,
|
|
79
|
+
bootstrap(runtime, [
|
|
80
|
+
...moduleDefinitions,
|
|
81
|
+
...toLocalModuleDefinitions(localModules)
|
|
82
|
+
], options);
|
|
80
83
|
});
|
|
81
84
|
return runtime;
|
|
82
85
|
}
|
|
83
|
-
function __resetHasExecuteGuard() {
|
|
84
|
-
hasExecuted = false;
|
|
85
|
-
}
|
|
86
86
|
|
|
87
|
-
export { ApplicationBootstrappingStartedEvent,
|
|
87
|
+
export { ApplicationBootstrappingStartedEvent, __resetHasExecutedGuard, bootstrap, initializeFirefly };
|
|
88
88
|
|
|
89
89
|
//# sourceMappingURL=initializeFirefly.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initializeFirefly.js","sources":["
|
|
1
|
+
{"version":3,"file":"initializeFirefly.js","sources":["../src/initializeFirefly.ts"],"sourcesContent":["import { isFunction, ModuleDefinition, toLocalModuleDefinitions, type ModuleRegisterFunction, type RegisterModulesOptions } from \"@squide/core\";\nimport { EnvironmentVariables, EnvironmentVariablesPlugin } from \"@squide/env-vars\";\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 environmentVariables?: Partial<EnvironmentVariables>;\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 environmentVariables,\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 x => new EnvironmentVariablesPlugin(x, {\n variables: environmentVariables\n }),\n ...plugins\n ]\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","EnvironmentVariablesPlugin","MswPlugin","FireflyRuntime","initializeHoneycomb","ApplicationBootstrappingStartedEvent","bootstrap","runtime","modulesDefinitions","options","startMsw","onError","context","results","Error","error","hasExecuted","__resetHasExecutedGuard","initializeFirefly","mode","localModules","moduleDefinitions","useMsw","plugins","environmentVariables","honeycombInstrumentationClient","loggers","x"],"mappings":";;;;;;;;;;;;;;;;;AAAgJ;AAC5D;AAC5C;AAE0C;AACT;AAElE,MAAMM,uCAAuC,mCAAmC;AAgBhF,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,CAACR,UAAUA,CAACW,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,oBAAoB,EACpBC,8BAA8B,EAC9BC,OAAO,EACPf,OAAO,EACV,GAAGF;IAEJ,IAAIO,aAAa;QACb,MAAM,IAAIF,MAAM;IACpB;IAEAE,cAAc;IAEd,IAAIM,QAAQ;QACRC,QAAQ,IAAI,CAACI,CAAAA,IAAK,IAAIzB,SAASA,CAACyB;IACpC;IAEA,MAAMpB,UAAU,IAAIJ,cAAcA,CAAC;QAC/BgB;QACAM;QACAC;QACA,SAAS;YACLC,CAAAA,IAAK,IAAI1B,0BAA0BA,CAAC0B,GAAG;oBACnC,WAAWH;gBACf;eACGD;SACN;IACL;IAEAnB,mBAAmBA,CAACG,SACf,KAAK,CAAC,CAACQ;QACJ,IAAIJ,SAAS;YACTA,QAAQI;QACZ;IACJ,GACC,OAAO,CAAC;QACLT,UACIC,SACA;eAAIc;eAAsBrB,wBAAwBA,CAACoB;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";
|
package/dist/internal.js
ADDED
|
@@ -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":["
|
|
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":["
|
|
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":["
|
|
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":["
|
|
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":["
|
|
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
|
|
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 (
|
|
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 (
|
|
54
|
+
if (errors.length > 0 && onError) {
|
|
58
55
|
onError(errors);
|
|
59
56
|
}
|
|
60
57
|
};
|