@squide/firefly 13.0.1 → 13.0.2
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 +12 -0
- package/dist/AppRouter.js +17 -17
- package/dist/AppRouter.js.map +1 -1
- package/dist/AppRouterContext.js +8 -8
- package/dist/AppRouterContext.js.map +1 -1
- package/dist/AppRouterReducer.js +47 -47
- package/dist/AppRouterReducer.js.map +1 -1
- package/dist/FireflyProvider.js +3 -3
- package/dist/FireflyProvider.js.map +1 -1
- package/dist/FireflyRuntime.js +11 -11
- package/dist/FireflyRuntime.js.map +1 -1
- package/dist/RootRoute.js +10 -10
- package/dist/RootRoute.js.map +1 -1
- package/dist/honeycomb/activeSpan.js +6 -6
- package/dist/honeycomb/activeSpan.js.map +1 -1
- package/dist/honeycomb/initializeHoneycomb.js +2 -2
- package/dist/honeycomb/initializeHoneycomb.js.map +1 -1
- package/dist/honeycomb/registerHoneycombInstrumentation.d.ts +1 -1
- package/dist/honeycomb/registerHoneycombInstrumentation.js +103 -73
- package/dist/honeycomb/registerHoneycombInstrumentation.js.map +1 -1
- package/dist/honeycomb/tracer.js +2 -2
- package/dist/honeycomb/tracer.js.map +1 -1
- package/dist/honeycomb/utils.js +12 -12
- package/dist/honeycomb/utils.js.map +1 -1
- package/dist/initializeFirefly.js +11 -11
- package/dist/initializeFirefly.js.map +1 -1
- package/dist/useAppRouterStore.js +2 -2
- package/dist/useAppRouterStore.js.map +1 -1
- package/dist/useCanFetchProtectedData.js +2 -2
- package/dist/useCanFetchProtectedData.js.map +1 -1
- package/dist/useCanFetchPublicData.js +2 -2
- package/dist/useCanFetchPublicData.js.map +1 -1
- package/dist/useCanRegisterDeferredRegistrations.js +2 -2
- package/dist/useCanRegisterDeferredRegistrations.js.map +1 -1
- package/dist/useCanUpdateDeferredRegistrations.js +2 -2
- package/dist/useCanUpdateDeferredRegistrations.js.map +1 -1
- package/dist/useDeferredRegistrations.js +13 -13
- package/dist/useDeferredRegistrations.js.map +1 -1
- package/dist/useExecuteOnce.js +3 -3
- package/dist/useExecuteOnce.js.map +1 -1
- package/dist/useIsActiveRouteProtected.js +5 -5
- package/dist/useIsActiveRouteProtected.js.map +1 -1
- package/dist/useIsBootstrapping.js +2 -2
- package/dist/useIsBootstrapping.js.map +1 -1
- package/dist/useNavigationItems.js +4 -4
- package/dist/useNavigationItems.js.map +1 -1
- package/dist/useProtectedDataHandler.js +4 -4
- package/dist/useProtectedDataHandler.js.map +1 -1
- package/dist/useProtectedDataQueries.js +20 -20
- package/dist/useProtectedDataQueries.js.map +1 -1
- package/dist/usePublicDataHandler.js +4 -4
- package/dist/usePublicDataHandler.js.map +1 -1
- package/dist/usePublicDataQueries.js +19 -19
- package/dist/usePublicDataQueries.js.map +1 -1
- package/dist/useRegisterDeferredRegistrations.js +4 -4
- package/dist/useRegisterDeferredRegistrations.js.map +1 -1
- package/dist/useStrictRegistrationMode.js +12 -12
- package/dist/useStrictRegistrationMode.js.map +1 -1
- package/dist/useUpdateDeferredRegistrations.js +6 -6
- package/dist/useUpdateDeferredRegistrations.js.map +1 -1
- package/package.json +16 -16
- package/src/honeycomb/registerHoneycombInstrumentation.ts +43 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"honeycomb/registerHoneycombInstrumentation.js","sources":["webpack://@squide/firefly/./src/honeycomb/registerHoneycombInstrumentation.ts"],"sourcesContent":["import type { Span } from \"@opentelemetry/api\";\nimport {\n LocalModuleDeferredRegistrationFailedEvent,\n LocalModuleDeferredRegistrationUpdateFailedEvent,\n LocalModuleRegistrationFailedEvent,\n LocalModulesDeferredRegistrationCompletedEvent,\n type LocalModulesDeferredRegistrationCompletedEventPayload,\n LocalModulesDeferredRegistrationStartedEvent,\n type LocalModulesDeferredRegistrationStartedEventPayload,\n LocalModulesDeferredRegistrationsUpdateCompletedEvent,\n type LocalModulesDeferredRegistrationsUpdateCompletedEventPayload,\n LocalModulesDeferredRegistrationsUpdateStartedEvent,\n type LocalModulesDeferredRegistrationsUpdateStartedEventPayload,\n LocalModulesRegistrationCompletedEvent,\n type LocalModulesRegistrationCompletedEventPayload,\n LocalModulesRegistrationStartedEvent,\n type LocalModulesRegistrationStartedEventPayload,\n type ModuleRegistrationError\n} from \"@squide/core\";\nimport {\n DeferredRegistrationsUpdateCompletedEvent,\n DeferredRegistrationsUpdateStartedEvent,\n RemoteModuleDeferredRegistrationFailedEvent,\n RemoteModuleDeferredRegistrationUpdateFailedEvent,\n type RemoteModuleRegistrationError,\n RemoteModuleRegistrationFailedEvent,\n RemoteModulesDeferredRegistrationCompletedEvent,\n type RemoteModulesDeferredRegistrationCompletedEventPayload,\n RemoteModulesDeferredRegistrationStartedEvent,\n type RemoteModulesDeferredRegistrationStartedEventPayload,\n RemoteModulesDeferredRegistrationsUpdateCompletedEvent,\n type RemoteModulesDeferredRegistrationsUpdateCompletedEventPayload,\n RemoteModulesDeferredRegistrationsUpdateStartedEvent,\n type RemoteModulesDeferredRegistrationsUpdateStartedEventPayload,\n RemoteModulesRegistrationCompletedEvent,\n type RemoteModulesRegistrationCompletedEventPayload,\n RemoteModulesRegistrationStartedEvent,\n type RemoteModulesRegistrationStartedEventPayload\n} from \"@squide/module-federation\";\nimport { ApplicationBoostrappedEvent, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, PublicDataReadyEvent } from \"../AppRouterReducer.ts\";\nimport type { FireflyRuntime } from \"../FireflyRuntime.tsx\";\nimport { ApplicationBootstrappingStartedEvent } from \"../initializeFirefly.ts\";\nimport { ProtectedDataFetchStartedEvent } from \"../useProtectedDataQueries.ts\";\nimport { PublicDataFetchStartedEvent } from \"../usePublicDataQueries.ts\";\nimport { type ActiveSpan, createOverrideFetchRequestSpanWithActiveSpanContext, registerActiveSpanStack } from \"./activeSpan.ts\";\nimport { getTracer } from \"./tracer.ts\";\nimport { endActiveSpan, startActiveChildSpan, startChildSpan, startSpan, traceError } from \"./utils.ts\";\n\n// TIPS:\n// To query those traces in Honeycomb, use the following query filter: \"root.name = squide-bootstrapping\".\n\ntype DataFetchState = \"none\" | \"fetching-data\" | \"public-data-ready\" | \"protected-data-ready\" | \"data-ready\";\n\nexport function reduceDataFetchEvents(\n runtime: FireflyRuntime,\n onDataFetchingStarted: () => void,\n onDataReady: () => void,\n onPublicDataFetchStarted: () => void,\n onPublicDataReady: () => void,\n onProtectedDataFetchStarted: () => void,\n onProtectedDataReady: () => void\n) {\n let dataFetchState: DataFetchState = \"none\";\n\n // TODO: Validate if this handler should use { once: true }.\n runtime.eventBus.addListener(PublicDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchingStarted();\n }\n\n onPublicDataFetchStarted();\n });\n\n // TODO: Validate if this handler should use { once: true }.\n runtime.eventBus.addListener(PublicDataReadyEvent, () => {\n onPublicDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n dataFetchState = \"public-data-ready\";\n } else if (dataFetchState === \"protected-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n });\n\n // TODO: Validate if this handler should use { once: true }.\n runtime.eventBus.addListener(ProtectedDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchingStarted();\n }\n\n onProtectedDataFetchStarted();\n });\n\n // TODO: Validate if this handler should use { once: true }.\n runtime.eventBus.addListener(ProtectedDataReadyEvent, () => {\n onProtectedDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n dataFetchState = \"protected-data-ready\";\n } else if (dataFetchState === \"public-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n });\n}\n\nfunction registerTrackingListeners(runtime: FireflyRuntime) {\n let bootstrappingSpan: Span;\n let localModuleRegistrationSpan: Span;\n let localModuleDeferredRegistrationSpan: Span;\n let remoteModuleRegistrationSpan: Span;\n let remoteModuleDeferredRegistrationSpan: Span;\n let dataFetchSpan: ActiveSpan;\n let deferredRegistrationsUpdateSpan: Span;\n let localModuleDeferredRegistrationsUpdateSpan: ActiveSpan;\n let remoteModuleDeferredRegistrationsUpdateSpan: ActiveSpan;\n\n runtime.eventBus.addListener(ApplicationBootstrappingStartedEvent, () => {\n bootstrappingSpan = startSpan((options, context) => getTracer().startSpan(\"squide-bootstrapping\", options, context));\n }, { once: true });\n\n runtime.eventBus.addListener(ApplicationBoostrappedEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.end();\n }\n }, { once: true });\n\n runtime.eventBus.addListener(MswReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"msw-ready\");\n }\n }, { once: true });\n\n runtime.eventBus.addListener(LocalModulesRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.module_count\": (payload as LocalModulesRegistrationStartedEventPayload).moduleCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-registration-started\", attributes);\n }\n\n localModuleRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"local-module-registration\", { ...options, attributes }, context);\n });\n }, { once: true });\n\n runtime.eventBus.addListener(LocalModulesRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-registration-completed\", {\n \"app.squide.module_count\": (payload as LocalModulesRegistrationCompletedEventPayload).moduleCount\n });\n }\n\n if (localModuleRegistrationSpan) {\n localModuleRegistrationSpan.end();\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModuleRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleRegistrationSpan) {\n traceError(localModuleRegistrationSpan, registrationError);\n }\n });\n\n runtime.eventBus.addListener(LocalModulesDeferredRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationStartedEventPayload).registrationCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-deferred-registration-started\", attributes);\n }\n\n localModuleDeferredRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"local-module-deferred-registration\", { ...options, attributes }, context);\n });\n }, { once: true });\n\n runtime.eventBus.addListener(LocalModulesDeferredRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-deferred-registration-completed\", {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationCompletedEventPayload).registrationCount\n });\n }\n\n if (localModuleDeferredRegistrationSpan) {\n localModuleDeferredRegistrationSpan.end();\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModuleDeferredRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleDeferredRegistrationSpan) {\n traceError(localModuleRegistrationSpan, registrationError);\n }\n });\n\n runtime.eventBus.addListener(RemoteModulesRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.remote_count\": (payload as RemoteModulesRegistrationStartedEventPayload).remoteCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-registration-started\", attributes);\n }\n\n remoteModuleRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"remote-module-registration\", { ...options, attributes }, context);\n });\n }, { once: true });\n\n runtime.eventBus.addListener(RemoteModulesRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-registration-completed\", {\n \"app.squide.remote_count\": (payload as RemoteModulesRegistrationCompletedEventPayload).remoteCount\n });\n }\n\n if (remoteModuleRegistrationSpan) {\n remoteModuleRegistrationSpan.end();\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModuleRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleRegistrationSpan) {\n traceError(remoteModuleRegistrationSpan, registrationError);\n }\n });\n\n runtime.eventBus.addListener(RemoteModulesDeferredRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationStartedEventPayload).registrationCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-deferred-registration-started\", attributes);\n }\n\n remoteModuleDeferredRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"remote-module-deferred-registration\", { ...options, attributes }, context);\n });\n }, { once: true });\n\n runtime.eventBus.addListener(RemoteModulesDeferredRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-deferred-registration-completed\", {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationCompletedEventPayload).registrationCount\n });\n }\n\n if (remoteModuleDeferredRegistrationSpan) {\n remoteModuleDeferredRegistrationSpan.end();\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModuleDeferredRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleDeferredRegistrationSpan) {\n traceError(remoteModuleDeferredRegistrationSpan, registrationError);\n }\n });\n\n const handleFetchDataStarted = () => {\n dataFetchSpan = startActiveChildSpan(bootstrappingSpan, (options, context) => {\n const name = \"data-fetch\";\n const span = getTracer().startSpan(name, options, context);\n\n return {\n name,\n span\n };\n });\n };\n\n const handleDataReady = () => {\n if (dataFetchSpan) {\n endActiveSpan(dataFetchSpan);\n }\n };\n\n const handlePublicDataFetchStarted = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"public-data-fetch-started\");\n }\n };\n\n const handlePublicDataReady = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"public-data-ready\");\n }\n };\n\n const handleProtectedDataFetchStarted = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"protected-data-fetch-started\");\n }\n };\n\n const handleProtectedDataReady = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"protected-data-ready\");\n }\n };\n\n reduceDataFetchEvents(\n runtime,\n handleFetchDataStarted,\n handleDataReady,\n handlePublicDataFetchStarted,\n handlePublicDataReady,\n handleProtectedDataFetchStarted,\n handleProtectedDataReady\n );\n\n runtime.eventBus.addListener(ModulesRegisteredEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-registered\");\n }\n }, { once: true });\n\n runtime.eventBus.addListener(ModulesReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-ready\");\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(DeferredRegistrationsUpdateStartedEvent, () => {\n deferredRegistrationsUpdateSpan = startSpan((options, context) => getTracer().startSpan(\"squide-deferred-registrations-update\", options, context));\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(DeferredRegistrationsUpdateCompletedEvent, () => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.end();\n }\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModulesDeferredRegistrationsUpdateStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationsUpdateStartedEventPayload).registrationCount\n };\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"local-module-deferred-registrations-update-started\", attributes);\n }\n\n localModuleDeferredRegistrationsUpdateSpan = startActiveChildSpan(deferredRegistrationsUpdateSpan, (options, context) => {\n const name = \"local-module-deferred-registrations-update\";\n\n const span = getTracer().startSpan(name, {\n attributes,\n ...options\n }, context);\n\n return {\n name,\n span\n };\n });\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModulesDeferredRegistrationsUpdateCompletedEvent, (payload: unknown) => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"local-module-deferred-registrations-update-completed\", {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationsUpdateCompletedEventPayload).registrationCount\n });\n }\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n endActiveSpan(localModuleDeferredRegistrationsUpdateSpan);\n }\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModuleDeferredRegistrationUpdateFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n traceError(localModuleDeferredRegistrationsUpdateSpan.instance, registrationError);\n }\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModulesDeferredRegistrationsUpdateStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationsUpdateStartedEventPayload).registrationCount\n };\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"remote-module-deferred-registrations-update-started\", attributes);\n }\n\n remoteModuleDeferredRegistrationsUpdateSpan = startActiveChildSpan(deferredRegistrationsUpdateSpan, (options, context) => {\n const name = \"remote-module-deferred-registrations-update\";\n\n const span = getTracer().startSpan(name, {\n attributes,\n ...options\n }, context);\n\n return {\n name,\n span\n };\n });\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModulesDeferredRegistrationsUpdateCompletedEvent, (payload: unknown) => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"remote-module-deferred-registrations-update-completed\", {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationsUpdateCompletedEventPayload).registrationCount\n });\n }\n\n if (remoteModuleDeferredRegistrationsUpdateSpan) {\n endActiveSpan(remoteModuleDeferredRegistrationsUpdateSpan);\n }\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModuleDeferredRegistrationUpdateFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleDeferredRegistrationsUpdateSpan) {\n traceError(remoteModuleDeferredRegistrationsUpdateSpan.instance, registrationError);\n }\n });\n}\n\nfunction getRegisterFetchRequestHookFunction() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK;\n}\n\nexport function registerHoneycombInstrumentation(runtime: FireflyRuntime) {\n const registerFetchRequestHookFunction = getRegisterFetchRequestHookFunction();\n\n if (registerFetchRequestHookFunction) {\n registerActiveSpanStack();\n\n const activeSpanOverrideFunction = createOverrideFetchRequestSpanWithActiveSpanContext(runtime.logger);\n\n // Dynamically registering this request hook function to nest the HTTP requests\n // of squide bootstrapping under the appropriate Honeycomb span.\n registerFetchRequestHookFunction(activeSpanOverrideFunction);\n } else {\n runtime.logger.warning(\"[squide] Cannot register Honeycomb fetch request hook because \\\"globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK\\\" is not available. Honeycomb instrumentation is still functional but in degraded mode.\");\n }\n\n registerTrackingListeners(runtime);\n}\n"],"names":["LocalModuleDeferredRegistrationFailedEvent","LocalModuleDeferredRegistrationUpdateFailedEvent","LocalModuleRegistrationFailedEvent","LocalModulesDeferredRegistrationCompletedEvent","LocalModulesDeferredRegistrationStartedEvent","LocalModulesDeferredRegistrationsUpdateCompletedEvent","LocalModulesDeferredRegistrationsUpdateStartedEvent","LocalModulesRegistrationCompletedEvent","LocalModulesRegistrationStartedEvent","DeferredRegistrationsUpdateCompletedEvent","DeferredRegistrationsUpdateStartedEvent","RemoteModuleDeferredRegistrationFailedEvent","RemoteModuleDeferredRegistrationUpdateFailedEvent","RemoteModuleRegistrationFailedEvent","RemoteModulesDeferredRegistrationCompletedEvent","RemoteModulesDeferredRegistrationStartedEvent","RemoteModulesDeferredRegistrationsUpdateCompletedEvent","RemoteModulesDeferredRegistrationsUpdateStartedEvent","RemoteModulesRegistrationCompletedEvent","RemoteModulesRegistrationStartedEvent","ApplicationBoostrappedEvent","ModulesReadyEvent","ModulesRegisteredEvent","MswReadyEvent","ProtectedDataReadyEvent","PublicDataReadyEvent","ApplicationBootstrappingStartedEvent","ProtectedDataFetchStartedEvent","PublicDataFetchStartedEvent","createOverrideFetchRequestSpanWithActiveSpanContext","registerActiveSpanStack","getTracer","endActiveSpan","startActiveChildSpan","startChildSpan","startSpan","traceError","reduceDataFetchEvents","runtime","onDataFetchingStarted","onDataReady","onPublicDataFetchStarted","onPublicDataReady","onProtectedDataFetchStarted","onProtectedDataReady","dataFetchState","registerTrackingListeners","bootstrappingSpan","localModuleRegistrationSpan","localModuleDeferredRegistrationSpan","remoteModuleRegistrationSpan","remoteModuleDeferredRegistrationSpan","dataFetchSpan","deferredRegistrationsUpdateSpan","localModuleDeferredRegistrationsUpdateSpan","remoteModuleDeferredRegistrationsUpdateSpan","options","context","payload","attributes","registrationError","handleFetchDataStarted","name","span","handleDataReady","handlePublicDataFetchStarted","handlePublicDataReady","handleProtectedDataFetchStarted","handleProtectedDataReady","getRegisterFetchRequestHookFunction","globalThis","registerHoneycombInstrumentation","registerFetchRequestHookFunction","activeSpanOverrideFunction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBsB;AAoBa;AAC2I;AAE/F;AACA;AACN;AACuD;AACxF;AACgE;AAOjG,SAASqC,sBACZC,OAAuB,EACvBC,qBAAiC,EACjCC,WAAuB,EACvBC,wBAAoC,EACpCC,iBAA6B,EAC7BC,2BAAuC,EACvCC,oBAAgC;IAEhC,IAAIC,iBAAiC;IAErC,4DAA4D;IAC5DP,QAAQ,QAAQ,CAAC,WAAW,CAACV,yFAA2BA,EAAE;QACtD,IAAIiB,mBAAmB,QAAQ;YAC3BA,iBAAiB;YACjBN;QACJ;QAEAE;IACJ;IAEA,4DAA4D;IAC5DH,QAAQ,QAAQ,CAAC,WAAW,CAACb,8EAAoBA,EAAE;QAC/CiB;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AmCH;IAEzC,IAAIG,kCAAkC;QAClC1C,+EAAuBA;QAEvB,MAAM2C,6BAA6B5C,2GAAmDA,CAACS,QAAQ,MAAM;QAErG,+EAA+E;QAC/E,gEAAgE;QAChEkC,iCAAiCC;IACrC,OAAO;QACHnC,QAAQ,MAAM,CAAC,OAAO,CAAC;IAC3B;IAEAQ,0BAA0BR;AAC9B"}
|
|
1
|
+
{"version":3,"file":"honeycomb/registerHoneycombInstrumentation.js","sources":["webpack://@squide/firefly/./src/honeycomb/registerHoneycombInstrumentation.ts"],"sourcesContent":["import type { Span } from \"@opentelemetry/api\";\nimport {\n LocalModuleDeferredRegistrationFailedEvent,\n LocalModuleDeferredRegistrationUpdateFailedEvent,\n LocalModuleRegistrationFailedEvent,\n LocalModulesDeferredRegistrationCompletedEvent,\n type LocalModulesDeferredRegistrationCompletedEventPayload,\n LocalModulesDeferredRegistrationStartedEvent,\n type LocalModulesDeferredRegistrationStartedEventPayload,\n LocalModulesDeferredRegistrationsUpdateCompletedEvent,\n type LocalModulesDeferredRegistrationsUpdateCompletedEventPayload,\n LocalModulesDeferredRegistrationsUpdateStartedEvent,\n type LocalModulesDeferredRegistrationsUpdateStartedEventPayload,\n LocalModulesRegistrationCompletedEvent,\n type LocalModulesRegistrationCompletedEventPayload,\n LocalModulesRegistrationStartedEvent,\n type LocalModulesRegistrationStartedEventPayload,\n type ModuleRegistrationError\n} from \"@squide/core\";\nimport {\n DeferredRegistrationsUpdateCompletedEvent,\n DeferredRegistrationsUpdateStartedEvent,\n RemoteModuleDeferredRegistrationFailedEvent,\n RemoteModuleDeferredRegistrationUpdateFailedEvent,\n type RemoteModuleRegistrationError,\n RemoteModuleRegistrationFailedEvent,\n RemoteModulesDeferredRegistrationCompletedEvent,\n type RemoteModulesDeferredRegistrationCompletedEventPayload,\n RemoteModulesDeferredRegistrationStartedEvent,\n type RemoteModulesDeferredRegistrationStartedEventPayload,\n RemoteModulesDeferredRegistrationsUpdateCompletedEvent,\n type RemoteModulesDeferredRegistrationsUpdateCompletedEventPayload,\n RemoteModulesDeferredRegistrationsUpdateStartedEvent,\n type RemoteModulesDeferredRegistrationsUpdateStartedEventPayload,\n RemoteModulesRegistrationCompletedEvent,\n type RemoteModulesRegistrationCompletedEventPayload,\n RemoteModulesRegistrationStartedEvent,\n type RemoteModulesRegistrationStartedEventPayload\n} from \"@squide/module-federation\";\nimport { ApplicationBoostrappedEvent, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, PublicDataReadyEvent } from \"../AppRouterReducer.ts\";\nimport type { FireflyRuntime } from \"../FireflyRuntime.tsx\";\nimport { ApplicationBootstrappingStartedEvent } from \"../initializeFirefly.ts\";\nimport { 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\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) {\n let dataFetchState: DataFetchState = \"none\";\n\n runtime.eventBus.addListener(PublicDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchStarted();\n }\n\n onPublicDataFetchStarted();\n }, { once: true });\n\n runtime.eventBus.addListener(PublicDataReadyEvent, () => {\n onPublicDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n dataFetchState = \"public-data-ready\";\n } else if (dataFetchState === \"protected-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n }, { once: true });\n\n runtime.eventBus.addListener(ProtectedDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchStarted();\n }\n\n onProtectedDataFetchStarted();\n }, { once: true });\n\n runtime.eventBus.addListener(ProtectedDataReadyEvent, () => {\n onProtectedDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n dataFetchState = \"protected-data-ready\";\n } else if (dataFetchState === \"public-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n }, { once: true });\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 runtime.eventBus.addListener(PublicDataFetchFailedEvent, handleDataFetchFailed, { once: true });\n runtime.eventBus.addListener(ProtectedDataFetchFailedEvent, handleDataFetchFailed, { once: true });\n}\n\nfunction registerTrackingListeners(runtime: FireflyRuntime) {\n let bootstrappingSpan: Span;\n let localModuleRegistrationSpan: Span;\n let localModuleDeferredRegistrationSpan: Span;\n let remoteModuleRegistrationSpan: Span;\n let remoteModuleDeferredRegistrationSpan: Span;\n let dataFetchSpan: ActiveSpan;\n let deferredRegistrationsUpdateSpan: Span;\n let localModuleDeferredRegistrationsUpdateSpan: ActiveSpan;\n let remoteModuleDeferredRegistrationsUpdateSpan: ActiveSpan;\n\n runtime.eventBus.addListener(ApplicationBootstrappingStartedEvent, () => {\n bootstrappingSpan = startSpan((options, context) => getTracer().startSpan(\"squide-bootstrapping\", options, context));\n }, { once: true });\n\n runtime.eventBus.addListener(ApplicationBoostrappedEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.end();\n }\n }, { once: true });\n\n runtime.eventBus.addListener(MswReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"msw-ready\");\n }\n }, { once: true });\n\n runtime.eventBus.addListener(LocalModulesRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.module_count\": (payload as LocalModulesRegistrationStartedEventPayload).moduleCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-registration-started\", attributes);\n }\n\n localModuleRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"local-module-registration\", { ...options, attributes }, context);\n });\n }, { once: true });\n\n runtime.eventBus.addListener(LocalModulesRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-registration-completed\", {\n \"app.squide.module_count\": (payload as LocalModulesRegistrationCompletedEventPayload).moduleCount\n });\n }\n\n if (localModuleRegistrationSpan) {\n localModuleRegistrationSpan.end();\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModuleRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleRegistrationSpan) {\n traceError(localModuleRegistrationSpan, registrationError);\n }\n });\n\n runtime.eventBus.addListener(LocalModulesDeferredRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationStartedEventPayload).registrationCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-deferred-registration-started\", attributes);\n }\n\n localModuleDeferredRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"local-module-deferred-registration\", { ...options, attributes }, context);\n });\n }, { once: true });\n\n runtime.eventBus.addListener(LocalModulesDeferredRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-deferred-registration-completed\", {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationCompletedEventPayload).registrationCount\n });\n }\n\n if (localModuleDeferredRegistrationSpan) {\n localModuleDeferredRegistrationSpan.end();\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModuleDeferredRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleDeferredRegistrationSpan) {\n traceError(localModuleRegistrationSpan, registrationError);\n }\n });\n\n runtime.eventBus.addListener(RemoteModulesRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.remote_count\": (payload as RemoteModulesRegistrationStartedEventPayload).remoteCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-registration-started\", attributes);\n }\n\n remoteModuleRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"remote-module-registration\", { ...options, attributes }, context);\n });\n }, { once: true });\n\n runtime.eventBus.addListener(RemoteModulesRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-registration-completed\", {\n \"app.squide.remote_count\": (payload as RemoteModulesRegistrationCompletedEventPayload).remoteCount\n });\n }\n\n if (remoteModuleRegistrationSpan) {\n remoteModuleRegistrationSpan.end();\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModuleRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleRegistrationSpan) {\n traceError(remoteModuleRegistrationSpan, registrationError);\n }\n });\n\n runtime.eventBus.addListener(RemoteModulesDeferredRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationStartedEventPayload).registrationCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-deferred-registration-started\", attributes);\n }\n\n remoteModuleDeferredRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"remote-module-deferred-registration\", { ...options, attributes }, context);\n });\n }, { once: true });\n\n runtime.eventBus.addListener(RemoteModulesDeferredRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"remote-module-deferred-registration-completed\", {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationCompletedEventPayload).registrationCount\n });\n }\n\n if (remoteModuleDeferredRegistrationSpan) {\n remoteModuleDeferredRegistrationSpan.end();\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModuleDeferredRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleDeferredRegistrationSpan) {\n traceError(remoteModuleDeferredRegistrationSpan, registrationError);\n }\n });\n\n const handleFetchDataStarted = () => {\n dataFetchSpan = startActiveChildSpan(bootstrappingSpan, (options, context) => {\n const name = \"data-fetch\";\n const span = getTracer().startSpan(name, options, context);\n\n return {\n name,\n span\n };\n });\n };\n\n const handleDataReady = () => {\n if (dataFetchSpan) {\n endActiveSpan(dataFetchSpan);\n }\n };\n\n const handlePublicDataFetchStarted = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"public-data-fetch-started\");\n }\n };\n\n const handlePublicDataReady = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"public-data-ready\");\n }\n };\n\n const handleProtectedDataFetchStarted = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"protected-data-fetch-started\");\n }\n };\n\n const handleProtectedDataReady = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"protected-data-ready\");\n }\n };\n\n const handleDataFetchFailed = (queriesErrors: Error[]) => {\n if (dataFetchSpan) {\n queriesErrors.forEach(x => {\n traceError(dataFetchSpan.instance, x);\n });\n\n dataFetchSpan.instance.end();\n }\n\n if (bootstrappingSpan) {\n queriesErrors.forEach(x => {\n traceError(bootstrappingSpan, x);\n });\n\n bootstrappingSpan.end();\n }\n };\n\n reduceDataFetchEvents(\n runtime,\n handleFetchDataStarted,\n handleDataReady,\n handlePublicDataFetchStarted,\n handlePublicDataReady,\n handleProtectedDataFetchStarted,\n handleProtectedDataReady,\n handleDataFetchFailed\n );\n\n runtime.eventBus.addListener(ModulesRegisteredEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-registered\");\n }\n }, { once: true });\n\n runtime.eventBus.addListener(ModulesReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-ready\");\n }\n }, { once: true });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(DeferredRegistrationsUpdateStartedEvent, () => {\n deferredRegistrationsUpdateSpan = startSpan((options, context) => getTracer().startSpan(\"squide-deferred-registrations-update\", options, context));\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(DeferredRegistrationsUpdateCompletedEvent, () => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.end();\n }\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModulesDeferredRegistrationsUpdateStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationsUpdateStartedEventPayload).registrationCount\n };\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"local-module-deferred-registrations-update-started\", attributes);\n }\n\n localModuleDeferredRegistrationsUpdateSpan = startActiveChildSpan(deferredRegistrationsUpdateSpan, (options, context) => {\n const name = \"local-module-deferred-registrations-update\";\n\n const span = getTracer().startSpan(name, {\n attributes,\n ...options\n }, context);\n\n return {\n name,\n span\n };\n });\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModulesDeferredRegistrationsUpdateCompletedEvent, (payload: unknown) => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"local-module-deferred-registrations-update-completed\", {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationsUpdateCompletedEventPayload).registrationCount\n });\n }\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n endActiveSpan(localModuleDeferredRegistrationsUpdateSpan);\n }\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(LocalModuleDeferredRegistrationUpdateFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n traceError(localModuleDeferredRegistrationsUpdateSpan.instance, registrationError);\n }\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModulesDeferredRegistrationsUpdateStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationsUpdateStartedEventPayload).registrationCount\n };\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"remote-module-deferred-registrations-update-started\", attributes);\n }\n\n remoteModuleDeferredRegistrationsUpdateSpan = startActiveChildSpan(deferredRegistrationsUpdateSpan, (options, context) => {\n const name = \"remote-module-deferred-registrations-update\";\n\n const span = getTracer().startSpan(name, {\n attributes,\n ...options\n }, context);\n\n return {\n name,\n span\n };\n });\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModulesDeferredRegistrationsUpdateCompletedEvent, (payload: unknown) => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"remote-module-deferred-registrations-update-completed\", {\n \"app.squide.registration_count\": (payload as RemoteModulesDeferredRegistrationsUpdateCompletedEventPayload).registrationCount\n });\n }\n\n if (remoteModuleDeferredRegistrationsUpdateSpan) {\n endActiveSpan(remoteModuleDeferredRegistrationsUpdateSpan);\n }\n });\n\n // Can occur multiple times.\n runtime.eventBus.addListener(RemoteModuleDeferredRegistrationUpdateFailedEvent, (payload: unknown) => {\n const registrationError = payload as RemoteModuleRegistrationError;\n\n if (remoteModuleDeferredRegistrationsUpdateSpan) {\n traceError(remoteModuleDeferredRegistrationsUpdateSpan.instance, registrationError);\n }\n });\n}\n\nfunction getRegisterFetchRequestHookFunction() {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK;\n}\n\nexport function registerHoneycombInstrumentation(runtime: FireflyRuntime) {\n const registerFetchRequestHookFunction = getRegisterFetchRequestHookFunction();\n\n if (registerFetchRequestHookFunction) {\n registerActiveSpanStack();\n\n const activeSpanOverrideFunction = createOverrideFetchRequestSpanWithActiveSpanContext(runtime.logger);\n\n // Dynamically registering this request hook function to nest the HTTP requests\n // of squide bootstrapping under the appropriate Honeycomb span.\n registerFetchRequestHookFunction(activeSpanOverrideFunction);\n } else {\n runtime.logger.warning(\"[squide] Cannot register Honeycomb fetch request hook because \\\"globalThis.__WLP_HONEYCOMB_REGISTER_DYNAMIC_FETCH_REQUEST_HOOK\\\" is not available. Honeycomb instrumentation is still functional but in degraded mode.\");\n }\n\n registerTrackingListeners(runtime);\n}\n"],"names":["LocalModuleDeferredRegistrationFailedEvent","LocalModuleDeferredRegistrationUpdateFailedEvent","LocalModuleRegistrationFailedEvent","LocalModulesDeferredRegistrationCompletedEvent","LocalModulesDeferredRegistrationStartedEvent","LocalModulesDeferredRegistrationsUpdateCompletedEvent","LocalModulesDeferredRegistrationsUpdateStartedEvent","LocalModulesRegistrationCompletedEvent","LocalModulesRegistrationStartedEvent","DeferredRegistrationsUpdateCompletedEvent","DeferredRegistrationsUpdateStartedEvent","RemoteModuleDeferredRegistrationFailedEvent","RemoteModuleDeferredRegistrationUpdateFailedEvent","RemoteModuleRegistrationFailedEvent","RemoteModulesDeferredRegistrationCompletedEvent","RemoteModulesDeferredRegistrationStartedEvent","RemoteModulesDeferredRegistrationsUpdateCompletedEvent","RemoteModulesDeferredRegistrationsUpdateStartedEvent","RemoteModulesRegistrationCompletedEvent","RemoteModulesRegistrationStartedEvent","ApplicationBoostrappedEvent","ModulesReadyEvent","ModulesRegisteredEvent","MswReadyEvent","ProtectedDataReadyEvent","PublicDataReadyEvent","ApplicationBootstrappingStartedEvent","ProtectedDataFetchFailedEvent","ProtectedDataFetchStartedEvent","PublicDataFetchFailedEvent","PublicDataFetchStartedEvent","createOverrideFetchRequestSpanWithActiveSpanContext","registerActiveSpanStack","getTracer","endActiveSpan","startActiveChildSpan","startChildSpan","startSpan","traceError","reduceDataFetchEvents","runtime","onDataFetchStarted","onDataReady","onPublicDataFetchStarted","onPublicDataReady","onProtectedDataFetchStarted","onProtectedDataReady","onDataFetchFailed","dataFetchState","handleDataFetchFailed","payload","registerTrackingListeners","bootstrappingSpan","localModuleRegistrationSpan","localModuleDeferredRegistrationSpan","remoteModuleRegistrationSpan","remoteModuleDeferredRegistrationSpan","dataFetchSpan","deferredRegistrationsUpdateSpan","localModuleDeferredRegistrationsUpdateSpan","remoteModuleDeferredRegistrationsUpdateSpan","options","context","attributes","registrationError","handleFetchDataStarted","name","span","handleDataReady","handlePublicDataFetchStarted","handlePublicDataReady","handleProtectedDataFetchStarted","handleProtectedDataReady","queriesErrors","x","getRegisterFetchRequestHookFunction","globalThis","registerHoneycombInstrumentation","registerFetchRequestHookFunction","activeSpanOverrideFunction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBsB;AAoBa;AAC2I;AAE/F;AAC+B;AACT;AAC2B;AACxF;AACgE;AAOjG,SAASuC,sBACZC,OAAuB,EACvBC,kBAA8B,EAC9BC,WAAuB,EACvBC,wBAAoC,EACpCC,iBAA6B,EAC7BC,2BAAuC,EACvCC,oBAAgC,EAChCC,iBAAmD;IAEnD,IAAIC,iBAAiC;IAErCR,QAAQ,QAAQ,CAAC,WAAW,CAACV,2BAA2BA,EAAE;QACtD,IAAIkB,mBAAmB,QAAQ;YAC3BA,iBAAiB;YACjBP;QACJ;QAEAE;IACJ,GAAG;QAAE,MAAM;IAAK;IAEhBH,QAAQ,QAAQ,CAAC,WAAW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CAACiC,MAAM;gBACrCH;gBACA,GAAGF,OAAO;YACd,GAAGC;YAEH,OAAO;gBACHI;gBACAC;YACJ;QACJ;IACJ;IAEA,4BAA4B;IAC5B3B,QAAQ,QAAQ,CAAC,WAAW,CAACxB,sDAAsDA,EAAE,CAACkC;QAClF,IAAIQ,iCAAiC;YACjCA,gCAAgC,QAAQ,CAAC,yDAAyD;gBAC9F,iCAAkCR,QAA0E,iBAAiB;YACjI;QACJ;QAEA,IAAIU,6CAA6C;YAC7C1B,aAAaA,CAAC0B;QAClB;IACJ;IAEA,4BAA4B;IAC5BpB,QAAQ,QAAQ,CAAC,WAAW,CAAC5B,iDAAiDA,EAAE,CAACsC;QAC7E,MAAMc,oBAAoBd;QAE1B,IAAIU,6CAA6C;YAC7CtB,UAAUA,CAACsB,4CAA4C,QAAQ,EAAEI;QACrE;IACJ;AACJ;AAEA,SAASW;IACL,6DAA6D;IAC7D,aAAa;IACb,OAAOC,WAAW,mDAAmD;AACzE;AAEO,SAASC,iCAAiCrC,OAAuB;IACpE,MAAMsC,mCAAmCH;IAEzC,IAAIG,kCAAkC;QAClC9C,uBAAuBA;QAEvB,MAAM+C,6BAA6BhD,mDAAmDA,CAACS,QAAQ,MAAM;QAErG,+EAA+E;QAC/E,gEAAgE;QAChEsC,iCAAiCC;IACrC,OAAO;QACHvC,QAAQ,MAAM,CAAC,OAAO,CAAC;IAC3B;IAEAW,0BAA0BX;AAC9B"}
|
package/dist/honeycomb/tracer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { trace } from "@opentelemetry/api";
|
|
2
2
|
|
|
3
3
|
;// CONCATENATED MODULE: external "@opentelemetry/api"
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__opentelemetry_api_87359e78__ from "@opent
|
|
|
6
6
|
|
|
7
7
|
function getTracer() {
|
|
8
8
|
// The tracer name is used as the "library.name" attribute.
|
|
9
|
-
return
|
|
9
|
+
return trace.getTracer("@squide/honeycomb");
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export { getTracer };
|
|
@@ -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,
|
|
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"}
|
package/dist/honeycomb/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { SpanKind, SpanStatusCode, context as api_context, trace } from "@opentelemetry/api";
|
|
2
|
+
import { popActiveSpan, setActiveSpan } from "./activeSpan.js";
|
|
3
3
|
|
|
4
4
|
;// CONCATENATED MODULE: external "@opentelemetry/api"
|
|
5
5
|
|
|
@@ -10,37 +10,37 @@ import * as __WEBPACK_EXTERNAL_MODULE__activeSpan_js_fe031e6b__ from "./activeSp
|
|
|
10
10
|
|
|
11
11
|
function startSpan(factory) {
|
|
12
12
|
return factory({
|
|
13
|
-
kind:
|
|
13
|
+
kind: SpanKind.CLIENT
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
function startChildSpan(parent, factory) {
|
|
17
|
-
const context =
|
|
17
|
+
const context = trace.setSpan(api_context.active(), parent);
|
|
18
18
|
return factory({
|
|
19
|
-
kind:
|
|
19
|
+
kind: SpanKind.CLIENT
|
|
20
20
|
}, context);
|
|
21
21
|
}
|
|
22
22
|
function startActiveSpan(factory) {
|
|
23
23
|
const { name, span } = factory({
|
|
24
|
-
kind:
|
|
24
|
+
kind: SpanKind.CLIENT
|
|
25
25
|
});
|
|
26
|
-
return
|
|
26
|
+
return setActiveSpan(name, span);
|
|
27
27
|
}
|
|
28
28
|
function startActiveChildSpan(parent, factory) {
|
|
29
|
-
const context =
|
|
29
|
+
const context = trace.setSpan(api_context.active(), parent);
|
|
30
30
|
const { name, span } = factory({
|
|
31
|
-
kind:
|
|
31
|
+
kind: SpanKind.CLIENT
|
|
32
32
|
}, context);
|
|
33
|
-
return
|
|
33
|
+
return setActiveSpan(name, span);
|
|
34
34
|
}
|
|
35
35
|
function endActiveSpan(span) {
|
|
36
36
|
span.instance.end();
|
|
37
|
-
|
|
37
|
+
popActiveSpan(span);
|
|
38
38
|
}
|
|
39
39
|
function traceError(span, error, options = {}) {
|
|
40
40
|
const { time } = options;
|
|
41
41
|
span.recordException(error, time);
|
|
42
42
|
span.setStatus({
|
|
43
|
-
code:
|
|
43
|
+
code: SpanStatusCode.ERROR
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -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,
|
|
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,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { isFunction, registerLocalModules } from "@squide/core";
|
|
2
|
+
import { registerRemoteModules } from "@squide/module-federation";
|
|
3
|
+
import { setMswAsReady } from "@squide/msw";
|
|
4
|
+
import { FireflyRuntime } from "./FireflyRuntime.js";
|
|
5
|
+
import { initializeHoneycomb } from "./honeycomb/initializeHoneycomb.js";
|
|
6
6
|
|
|
7
7
|
;// CONCATENATED MODULE: external "@squide/core"
|
|
8
8
|
|
|
@@ -34,19 +34,19 @@ function bootstrap(runtime, options = {}) {
|
|
|
34
34
|
const { localModules = [], remotes = [], startMsw, onError, context } = options;
|
|
35
35
|
runtime.eventBus.dispatch(ApplicationBootstrappingStartedEvent);
|
|
36
36
|
Promise.allSettled([
|
|
37
|
-
|
|
37
|
+
registerLocalModules(localModules, runtime, {
|
|
38
38
|
context
|
|
39
39
|
}),
|
|
40
|
-
|
|
40
|
+
registerRemoteModules(remotes, runtime, {
|
|
41
41
|
context
|
|
42
42
|
})
|
|
43
43
|
]).then((results)=>{
|
|
44
44
|
if (runtime.isMswEnabled) {
|
|
45
|
-
if (!
|
|
45
|
+
if (!isFunction(startMsw)) {
|
|
46
46
|
throw new Error("[squide] When MSW is enabled, the \"startMsw\" function must be provided.");
|
|
47
47
|
}
|
|
48
48
|
startMsw(runtime).then(()=>{
|
|
49
|
-
|
|
49
|
+
setMswAsReady();
|
|
50
50
|
}).catch((error)=>{
|
|
51
51
|
runtime.logger.debug("[squide] An error occured while starting MSW.", error);
|
|
52
52
|
});
|
|
@@ -64,13 +64,13 @@ function initializeFirefly(options = {}) {
|
|
|
64
64
|
throw new Error("[squide] A squide application can only be initialized once. Did you call the \"initializeSquide\" function twice?");
|
|
65
65
|
}
|
|
66
66
|
hasExecuted = true;
|
|
67
|
-
const runtime = new
|
|
67
|
+
const runtime = new FireflyRuntime({
|
|
68
68
|
mode,
|
|
69
69
|
useMsw,
|
|
70
70
|
loggers,
|
|
71
71
|
plugins
|
|
72
72
|
});
|
|
73
|
-
|
|
73
|
+
initializeHoneycomb(runtime).catch((error)=>{
|
|
74
74
|
if (onError) {
|
|
75
75
|
onError(error);
|
|
76
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initializeFirefly.js","sources":["webpack://@squide/firefly/./src/initializeFirefly.ts"],"sourcesContent":["import { isFunction, registerLocalModules, type ModuleRegisterFunction, type RegisterModulesOptions } from \"@squide/core\";\nimport { registerRemoteModules, type RemoteDefinition } from \"@squide/module-federation\";\nimport { setMswAsReady } from \"@squide/msw\";\nimport { FireflyRuntime, type FireflyRuntimeOptions } from \"./FireflyRuntime.tsx\";\nimport { initializeHoneycomb } from \"./honeycomb/initializeHoneycomb.ts\";\n\nexport const ApplicationBootstrappingStartedEvent = \"squide-app-bootstrapping-started\";\n\nexport type OnInitializationErrorFunction = (error: unknown) => void;\n\nexport type StartMswFunction<TRuntime = FireflyRuntime> = (runtime: TRuntime) => Promise<void>;\n\nexport interface InitializeFireflyOptions<TRuntime extends FireflyRuntime, TContext = unknown, TData = unknown> extends RegisterModulesOptions<TContext>, FireflyRuntimeOptions {\n localModules?: ModuleRegisterFunction<TRuntime, TContext, TData>[];\n remotes?: RemoteDefinition[];\n startMsw?: StartMswFunction<FireflyRuntime>;\n onError?: OnInitializationErrorFunction;\n}\n\nfunction propagateRegistrationErrors(results: PromiseSettledResult<unknown[]>, onError: OnInitializationErrorFunction) {\n if (results) {\n if (results.status === \"fulfilled\") {\n results.value.forEach(x => {\n onError(x);\n });\n }\n }\n}\n\nexport function bootstrap<TRuntime extends FireflyRuntime = FireflyRuntime, TContext = unknown, TData = unknown>(runtime: TRuntime, options: InitializeFireflyOptions<TRuntime, TContext, TData> = {}) {\n const {\n localModules = [],\n remotes = [],\n startMsw,\n onError,\n context\n } = options;\n\n runtime.eventBus.dispatch(ApplicationBootstrappingStartedEvent);\n\n Promise.allSettled([\n registerLocalModules<TRuntime, TContext, TData>(localModules, runtime, { context }),\n registerRemoteModules(remotes, runtime, { context })\n ]).then(results => {\n if (runtime.isMswEnabled) {\n if (!isFunction(startMsw)) {\n throw new Error(\"[squide] When MSW is enabled, the \\\"startMsw\\\" function must be provided.\");\n }\n\n startMsw(runtime)\n .then(() => {\n setMswAsReady();\n })\n .catch((error: unknown) => {\n runtime.logger.debug(\"[squide] An error occured while starting MSW.\", error);\n });\n }\n\n if (onError) {\n propagateRegistrationErrors(results[0], onError);\n propagateRegistrationErrors(results[1], onError);\n }\n });\n}\n\nlet hasExecuted = false;\n\nexport function initializeFirefly<TContext = unknown, TData = unknown>(options: InitializeFireflyOptions<FireflyRuntime, TContext, TData> = {}) {\n const {\n mode,\n useMsw,\n loggers,\n plugins,\n onError\n } = options;\n\n if (hasExecuted) {\n throw new Error(\"[squide] A squide application can only be initialized once. Did you call the \\\"initializeSquide\\\" function twice?\");\n }\n\n hasExecuted = true;\n\n const runtime = new FireflyRuntime({\n mode,\n useMsw,\n loggers,\n plugins\n });\n\n initializeHoneycomb(runtime)\n .catch((error: unknown) => {\n if (onError) {\n onError(error);\n }\n })\n .finally(() => {\n bootstrap(runtime, options);\n });\n\n return runtime;\n}\n\nexport function __resetHasExecuteGuard() {\n hasExecuted = false;\n}\n"],"names":["isFunction","registerLocalModules","registerRemoteModules","setMswAsReady","FireflyRuntime","initializeHoneycomb","ApplicationBootstrappingStartedEvent","propagateRegistrationErrors","results","onError","x","bootstrap","runtime","options","localModules","remotes","startMsw","context","Promise","Error","error","hasExecuted","initializeFirefly","mode","useMsw","loggers","plugins","__resetHasExecuteGuard"],"mappings":";;;;;;;;;;;;;;;;;AAA0H;AACjC;AAC7C;AACsC;AACT;AAElE,MAAMM,uCAAuC,mCAAmC;AAavF,SAASC,4BAA4BC,OAAwC,EAAEC,OAAsC;IACjH,IAAID,SAAS;QACT,IAAIA,QAAQ,MAAM,KAAK,aAAa;YAChCA,QAAQ,KAAK,CAAC,OAAO,CAACE,CAAAA;gBAClBD,QAAQC;YACZ;QACJ;IACJ;AACJ;AAEO,SAASC,UAAiGC,OAAiB,EAAEC,UAA+D,CAAC,CAAC;IACjM,MAAM,EACFC,eAAe,EAAE,EACjBC,UAAU,EAAE,EACZC,QAAQ,EACRP,OAAO,EACPQ,OAAO,EACV,GAAGJ;IAEJD,QAAQ,QAAQ,CAAC,QAAQ,CAACN;IAE1BY,QAAQ,UAAU,CAAC;QACfjB,
|
|
1
|
+
{"version":3,"file":"initializeFirefly.js","sources":["webpack://@squide/firefly/./src/initializeFirefly.ts"],"sourcesContent":["import { isFunction, registerLocalModules, type ModuleRegisterFunction, type RegisterModulesOptions } from \"@squide/core\";\nimport { registerRemoteModules, type RemoteDefinition } from \"@squide/module-federation\";\nimport { setMswAsReady } from \"@squide/msw\";\nimport { FireflyRuntime, type FireflyRuntimeOptions } from \"./FireflyRuntime.tsx\";\nimport { initializeHoneycomb } from \"./honeycomb/initializeHoneycomb.ts\";\n\nexport const ApplicationBootstrappingStartedEvent = \"squide-app-bootstrapping-started\";\n\nexport type OnInitializationErrorFunction = (error: unknown) => void;\n\nexport type StartMswFunction<TRuntime = FireflyRuntime> = (runtime: TRuntime) => Promise<void>;\n\nexport interface InitializeFireflyOptions<TRuntime extends FireflyRuntime, TContext = unknown, TData = unknown> extends RegisterModulesOptions<TContext>, FireflyRuntimeOptions {\n localModules?: ModuleRegisterFunction<TRuntime, TContext, TData>[];\n remotes?: RemoteDefinition[];\n startMsw?: StartMswFunction<FireflyRuntime>;\n onError?: OnInitializationErrorFunction;\n}\n\nfunction propagateRegistrationErrors(results: PromiseSettledResult<unknown[]>, onError: OnInitializationErrorFunction) {\n if (results) {\n if (results.status === \"fulfilled\") {\n results.value.forEach(x => {\n onError(x);\n });\n }\n }\n}\n\nexport function bootstrap<TRuntime extends FireflyRuntime = FireflyRuntime, TContext = unknown, TData = unknown>(runtime: TRuntime, options: InitializeFireflyOptions<TRuntime, TContext, TData> = {}) {\n const {\n localModules = [],\n remotes = [],\n startMsw,\n onError,\n context\n } = options;\n\n runtime.eventBus.dispatch(ApplicationBootstrappingStartedEvent);\n\n Promise.allSettled([\n registerLocalModules<TRuntime, TContext, TData>(localModules, runtime, { context }),\n registerRemoteModules(remotes, runtime, { context })\n ]).then(results => {\n if (runtime.isMswEnabled) {\n if (!isFunction(startMsw)) {\n throw new Error(\"[squide] When MSW is enabled, the \\\"startMsw\\\" function must be provided.\");\n }\n\n startMsw(runtime)\n .then(() => {\n setMswAsReady();\n })\n .catch((error: unknown) => {\n runtime.logger.debug(\"[squide] An error occured while starting MSW.\", error);\n });\n }\n\n if (onError) {\n propagateRegistrationErrors(results[0], onError);\n propagateRegistrationErrors(results[1], onError);\n }\n });\n}\n\nlet hasExecuted = false;\n\nexport function initializeFirefly<TContext = unknown, TData = unknown>(options: InitializeFireflyOptions<FireflyRuntime, TContext, TData> = {}) {\n const {\n mode,\n useMsw,\n loggers,\n plugins,\n onError\n } = options;\n\n if (hasExecuted) {\n throw new Error(\"[squide] A squide application can only be initialized once. Did you call the \\\"initializeSquide\\\" function twice?\");\n }\n\n hasExecuted = true;\n\n const runtime = new FireflyRuntime({\n mode,\n useMsw,\n loggers,\n plugins\n });\n\n initializeHoneycomb(runtime)\n .catch((error: unknown) => {\n if (onError) {\n onError(error);\n }\n })\n .finally(() => {\n bootstrap(runtime, options);\n });\n\n return runtime;\n}\n\nexport function __resetHasExecuteGuard() {\n hasExecuted = false;\n}\n"],"names":["isFunction","registerLocalModules","registerRemoteModules","setMswAsReady","FireflyRuntime","initializeHoneycomb","ApplicationBootstrappingStartedEvent","propagateRegistrationErrors","results","onError","x","bootstrap","runtime","options","localModules","remotes","startMsw","context","Promise","Error","error","hasExecuted","initializeFirefly","mode","useMsw","loggers","plugins","__resetHasExecuteGuard"],"mappings":";;;;;;;;;;;;;;;;;AAA0H;AACjC;AAC7C;AACsC;AACT;AAElE,MAAMM,uCAAuC,mCAAmC;AAavF,SAASC,4BAA4BC,OAAwC,EAAEC,OAAsC;IACjH,IAAID,SAAS;QACT,IAAIA,QAAQ,MAAM,KAAK,aAAa;YAChCA,QAAQ,KAAK,CAAC,OAAO,CAACE,CAAAA;gBAClBD,QAAQC;YACZ;QACJ;IACJ;AACJ;AAEO,SAASC,UAAiGC,OAAiB,EAAEC,UAA+D,CAAC,CAAC;IACjM,MAAM,EACFC,eAAe,EAAE,EACjBC,UAAU,EAAE,EACZC,QAAQ,EACRP,OAAO,EACPQ,OAAO,EACV,GAAGJ;IAEJD,QAAQ,QAAQ,CAAC,QAAQ,CAACN;IAE1BY,QAAQ,UAAU,CAAC;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,CAAC,KAAK,CAAC,iDAAiDQ;YAC1E;QACR;QAEA,IAAIX,SAAS;YACTF,4BAA4BC,OAAO,CAAC,EAAE,EAAEC;YACxCF,4BAA4BC,OAAO,CAAC,EAAE,EAAEC;QAC5C;IACJ;AACJ;AAEA,IAAIY,cAAc;AAEX,SAASC,kBAAuDT,UAAqE,CAAC,CAAC;IAC1I,MAAM,EACFU,IAAI,EACJC,MAAM,EACNC,OAAO,EACPC,OAAO,EACPjB,OAAO,EACV,GAAGI;IAEJ,IAAIQ,aAAa;QACb,MAAM,IAAIF,MAAM;IACpB;IAEAE,cAAc;IAEd,MAAMT,UAAU,IAAIR,cAAcA,CAAC;QAC/BmB;QACAC;QACAC;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,SAASe;IACZN,cAAc;AAClB"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useRuntime } from "@squide/core";
|
|
2
2
|
|
|
3
3
|
;// CONCATENATED MODULE: external "@squide/core"
|
|
4
4
|
|
|
5
5
|
;// CONCATENATED MODULE: ./src/useAppRouterStore.ts
|
|
6
6
|
|
|
7
7
|
function useAppRouterStore() {
|
|
8
|
-
const runtime =
|
|
8
|
+
const runtime = useRuntime();
|
|
9
9
|
return runtime.appRouterStore;
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -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,
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useAppRouterState } from "./AppRouterContext.js";
|
|
2
2
|
|
|
3
3
|
;// CONCATENATED MODULE: external "./AppRouterContext.js"
|
|
4
4
|
|
|
@@ -12,7 +12,7 @@ function canFetchProtectedData(waitForMsw, areModulesRegistered, areModulesReady
|
|
|
12
12
|
(areModulesRegistered || areModulesReady) && activeRouteVisibility === "protected" && (!waitForMsw || isMswReady));
|
|
13
13
|
}
|
|
14
14
|
function useCanFetchProtectedData() {
|
|
15
|
-
const { waitForMsw, areModulesRegistered, areModulesReady, isMswReady, isProtectedDataReady, activeRouteVisibility } =
|
|
15
|
+
const { waitForMsw, areModulesRegistered, areModulesReady, isMswReady, isProtectedDataReady, activeRouteVisibility } = useAppRouterState();
|
|
16
16
|
// Always return true when the protected data has already been fetched sucessfully so TanStack Query can update the data in the background.
|
|
17
17
|
return isProtectedDataReady || canFetchProtectedData(waitForMsw, areModulesRegistered, areModulesReady, activeRouteVisibility, isMswReady);
|
|
18
18
|
}
|
|
@@ -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
|
|
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,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useAppRouterState } from "./AppRouterContext.js";
|
|
2
2
|
|
|
3
3
|
;// CONCATENATED MODULE: external "./AppRouterContext.js"
|
|
4
4
|
|
|
5
5
|
;// CONCATENATED MODULE: ./src/useCanFetchPublicData.ts
|
|
6
6
|
|
|
7
7
|
function useCanFetchPublicData() {
|
|
8
|
-
const { waitForMsw, areModulesRegistered, areModulesReady, isMswReady, isPublicDataReady } =
|
|
8
|
+
const { waitForMsw, areModulesRegistered, areModulesReady, isMswReady, isPublicDataReady } = useAppRouterState();
|
|
9
9
|
return(// Always return true when the public data has already been fetched sucessfully so TanStack Query can update the data in the background.
|
|
10
10
|
isPublicDataReady || // Wait until the modules has been registered, but do not wait for the deferred registrations to be registered has they will probably
|
|
11
11
|
// depends on the protected data.
|
|
@@ -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
|
|
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,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useAppRouterState } from "./AppRouterContext.js";
|
|
2
2
|
|
|
3
3
|
;// CONCATENATED MODULE: external "./AppRouterContext.js"
|
|
4
4
|
|
|
5
5
|
;// CONCATENATED MODULE: ./src/useCanRegisterDeferredRegistrations.ts
|
|
6
6
|
|
|
7
7
|
function useCanRegisterDeferredRegistrations() {
|
|
8
|
-
const { waitForPublicData, waitForProtectedData, areModulesReady, areModulesRegistered, isPublicDataReady, isProtectedDataReady, activeRouteVisibility, isUnauthorized } =
|
|
8
|
+
const { waitForPublicData, waitForProtectedData, areModulesReady, areModulesRegistered, isPublicDataReady, isProtectedDataReady, activeRouteVisibility, isUnauthorized } = useAppRouterState();
|
|
9
9
|
return !isUnauthorized && areModulesRegistered && !areModulesReady && (!waitForPublicData || isPublicDataReady) && (!waitForProtectedData || activeRouteVisibility === "public" || isProtectedDataReady);
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -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
|
|
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,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useAppRouterState } from "./AppRouterContext.js";
|
|
2
2
|
|
|
3
3
|
;// CONCATENATED MODULE: external "./AppRouterContext.js"
|
|
4
4
|
|
|
5
5
|
;// CONCATENATED MODULE: ./src/useCanUpdateDeferredRegistrations.ts
|
|
6
6
|
|
|
7
7
|
function useCanUpdateDeferredRegistrations() {
|
|
8
|
-
const { areModulesReady, publicDataUpdatedAt, protectedDataUpdatedAt, deferredRegistrationsUpdatedAt } =
|
|
8
|
+
const { areModulesReady, publicDataUpdatedAt, protectedDataUpdatedAt, deferredRegistrationsUpdatedAt } = useAppRouterState();
|
|
9
9
|
return(// Do not trigger an update if the deferred registrations has not been registered yet (if there are deferred registrations, once they are
|
|
10
10
|
// registered, the modules will be marked as ready).
|
|
11
11
|
areModulesReady && deferredRegistrationsUpdatedAt && (publicDataUpdatedAt && publicDataUpdatedAt > deferredRegistrationsUpdatedAt || protectedDataUpdatedAt && protectedDataUpdatedAt > deferredRegistrationsUpdatedAt));
|
|
@@ -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
|
|
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,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { useRuntime } from "@squide/core";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { useCanRegisterDeferredRegistrations } from "./useCanRegisterDeferredRegistrations.js";
|
|
4
|
+
import { useCanUpdateDeferredRegistrations } from "./useCanUpdateDeferredRegistrations.js";
|
|
5
|
+
import { useRegisterDeferredRegistrations } from "./useRegisterDeferredRegistrations.js";
|
|
6
|
+
import { useUpdateDeferredRegistrations } from "./useUpdateDeferredRegistrations.js";
|
|
7
7
|
|
|
8
8
|
;// CONCATENATED MODULE: external "@squide/core"
|
|
9
9
|
|
|
@@ -28,12 +28,12 @@ function hasError({ localModuleErrors, remoteModuleErrors }) {
|
|
|
28
28
|
return localModuleErrors.length > 0 || remoteModuleErrors.length > 0;
|
|
29
29
|
}
|
|
30
30
|
function useDeferredRegistrations(data, { onError } = {}) {
|
|
31
|
-
const runtime =
|
|
32
|
-
const canRegisterDeferredRegistrations =
|
|
33
|
-
const canUpdateDeferredRegistrations =
|
|
34
|
-
const registerDeferredRegistrations =
|
|
35
|
-
const updateDeferredRegistrations =
|
|
36
|
-
|
|
31
|
+
const runtime = useRuntime();
|
|
32
|
+
const canRegisterDeferredRegistrations = useCanRegisterDeferredRegistrations();
|
|
33
|
+
const canUpdateDeferredRegistrations = useCanUpdateDeferredRegistrations();
|
|
34
|
+
const registerDeferredRegistrations = useRegisterDeferredRegistrations();
|
|
35
|
+
const updateDeferredRegistrations = useUpdateDeferredRegistrations();
|
|
36
|
+
useEffect(()=>{
|
|
37
37
|
if (canRegisterDeferredRegistrations) {
|
|
38
38
|
const register = async ()=>{
|
|
39
39
|
const errors = await registerDeferredRegistrations(data, runtime);
|
|
@@ -50,7 +50,7 @@ function useDeferredRegistrations(data, { onError } = {}) {
|
|
|
50
50
|
onError,
|
|
51
51
|
runtime
|
|
52
52
|
]);
|
|
53
|
-
|
|
53
|
+
useEffect(()=>{
|
|
54
54
|
if (canUpdateDeferredRegistrations) {
|
|
55
55
|
const update = async ()=>{
|
|
56
56
|
const errors = await updateDeferredRegistrations(data, runtime);
|
|
@@ -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,
|
|
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"}
|
package/dist/useExecuteOnce.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useCallback, useRef } from "react";
|
|
2
2
|
|
|
3
3
|
;// CONCATENATED MODULE: external "react"
|
|
4
4
|
|
|
@@ -7,8 +7,8 @@ import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
|
7
7
|
// Not using useEffect or useLayoutEffect because this utility hook is often used to dispatch events
|
|
8
8
|
// and it messed with the events dispatch order.
|
|
9
9
|
function useExecuteOnce(fct, inline = false) {
|
|
10
|
-
const triggered =
|
|
11
|
-
const onceFct =
|
|
10
|
+
const triggered = useRef(false);
|
|
11
|
+
const onceFct = useCallback(()=>{
|
|
12
12
|
if (!triggered.current) {
|
|
13
13
|
const result = fct();
|
|
14
14
|
if (result) {
|
|
@@ -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,
|
|
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,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { useIsRouteProtected, useRouteMatch } from "@squide/react-router";
|
|
2
|
+
import { useLocation } from "react-router";
|
|
3
3
|
|
|
4
4
|
;// CONCATENATED MODULE: external "@squide/react-router"
|
|
5
5
|
|
|
@@ -10,12 +10,12 @@ import * as __WEBPACK_EXTERNAL_MODULE_react_router_65608a1a__ from "react-router
|
|
|
10
10
|
|
|
11
11
|
function useIsActiveRouteProtected(areModulesReady) {
|
|
12
12
|
// Using this hook instead of window.location to retrieve the current location because it triggers a re-render everytime the browser location change.
|
|
13
|
-
const location =
|
|
13
|
+
const location = useLocation();
|
|
14
14
|
// Only throw when there's no match if the modules are ready, otherwise it's expected that no route will be found since they are not all registered yet.
|
|
15
|
-
const activeRoute =
|
|
15
|
+
const activeRoute = useRouteMatch(location, {
|
|
16
16
|
throwWhenThereIsNoMatch: areModulesReady
|
|
17
17
|
});
|
|
18
|
-
return
|
|
18
|
+
return useIsRouteProtected(activeRoute);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export { useIsActiveRouteProtected };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsActiveRouteProtected.js","sources":["webpack://@squide/firefly/./src/useIsActiveRouteProtected.ts"],"sourcesContent":["import { useIsRouteProtected, useRouteMatch } from \"@squide/react-router\";\nimport { useLocation } from \"react-router\";\n\nexport function useIsActiveRouteProtected(areModulesReady: boolean) {\n // Using this hook instead of window.location to retrieve the current location because it triggers a re-render everytime the browser location change.\n const location = useLocation();\n\n // Only throw when there's no match if the modules are ready, otherwise it's expected that no route will be found since they are not all registered yet.\n const activeRoute = useRouteMatch(location, { throwWhenThereIsNoMatch: areModulesReady });\n\n return useIsRouteProtected(activeRoute);\n}\n"],"names":["useIsRouteProtected","useRouteMatch","useLocation","useIsActiveRouteProtected","areModulesReady","location","activeRoute"],"mappings":";;;;;;;;AAA0E;AAC/B;AAEpC,SAASG,0BAA0BC,eAAwB;IAC9D,qJAAqJ;IACrJ,MAAMC,WAAWH,
|
|
1
|
+
{"version":3,"file":"useIsActiveRouteProtected.js","sources":["webpack://@squide/firefly/./src/useIsActiveRouteProtected.ts"],"sourcesContent":["import { useIsRouteProtected, useRouteMatch } from \"@squide/react-router\";\nimport { useLocation } from \"react-router\";\n\nexport function useIsActiveRouteProtected(areModulesReady: boolean) {\n // Using this hook instead of window.location to retrieve the current location because it triggers a re-render everytime the browser location change.\n const location = useLocation();\n\n // Only throw when there's no match if the modules are ready, otherwise it's expected that no route will be found since they are not all registered yet.\n const activeRoute = useRouteMatch(location, { throwWhenThereIsNoMatch: areModulesReady });\n\n return useIsRouteProtected(activeRoute);\n}\n"],"names":["useIsRouteProtected","useRouteMatch","useLocation","useIsActiveRouteProtected","areModulesReady","location","activeRoute"],"mappings":";;;;;;;;AAA0E;AAC/B;AAEpC,SAASG,0BAA0BC,eAAwB;IAC9D,qJAAqJ;IACrJ,MAAMC,WAAWH,WAAWA;IAE5B,wJAAwJ;IACxJ,MAAMI,cAAcL,aAAaA,CAACI,UAAU;QAAE,yBAAyBD;IAAgB;IAEvF,OAAOJ,mBAAmBA,CAACM;AAC/B"}
|