@squide/firefly 16.2.1 → 17.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/AppRouter.js +0 -9
- package/dist/AppRouter.js.map +1 -1
- package/dist/AppRouterContext.js +0 -3
- package/dist/AppRouterContext.js.map +1 -1
- package/dist/AppRouterReducer.d.ts +17 -0
- package/dist/AppRouterReducer.js +0 -6
- package/dist/AppRouterReducer.js.map +1 -1
- package/dist/AppRouterStore.js +0 -2
- package/dist/AppRouterStore.js.map +1 -1
- package/dist/FireflyPlugin.js +0 -2
- package/dist/FireflyPlugin.js.map +1 -1
- package/dist/FireflyProvider.js +0 -3
- package/dist/FireflyProvider.js.map +1 -1
- package/dist/FireflyRuntime.js +0 -6
- package/dist/FireflyRuntime.js.map +1 -1
- package/dist/GlobalDataQueriesError.js +0 -2
- package/dist/GlobalDataQueriesError.js.map +1 -1
- package/dist/RootRoute.js +0 -6
- package/dist/RootRoute.js.map +1 -1
- package/dist/honeycomb/activeSpan.js +0 -4
- package/dist/honeycomb/activeSpan.js.map +1 -1
- package/dist/honeycomb/createTraceContextId.js +0 -2
- package/dist/honeycomb/createTraceContextId.js.map +1 -1
- package/dist/honeycomb/initializeHoneycomb.js +0 -2
- package/dist/honeycomb/initializeHoneycomb.js.map +1 -1
- package/dist/honeycomb/registerHoneycombInstrumentation.d.ts +2 -2
- package/dist/honeycomb/registerHoneycombInstrumentation.js +13 -26
- package/dist/honeycomb/registerHoneycombInstrumentation.js.map +1 -1
- package/dist/honeycomb/tracer.js +0 -2
- package/dist/honeycomb/tracer.js.map +1 -1
- package/dist/honeycomb/utils.js +0 -3
- package/dist/honeycomb/utils.js.map +1 -1
- package/dist/index.js +4 -11
- package/dist/index.js.map +1 -1
- package/dist/initializeFirefly.d.ts +5 -0
- package/dist/initializeFirefly.js +0 -8
- package/dist/initializeFirefly.js.map +1 -1
- package/dist/internal.js +5 -13
- package/dist/internal.js.map +1 -1
- package/dist/useAppRouterStore.js +0 -2
- package/dist/useAppRouterStore.js.map +1 -1
- package/dist/useCanFetchProtectedData.js +0 -2
- package/dist/useCanFetchProtectedData.js.map +1 -1
- package/dist/useCanFetchPublicData.js +0 -2
- package/dist/useCanFetchPublicData.js.map +1 -1
- package/dist/useCanRegisterDeferredRegistrations.js +0 -2
- package/dist/useCanRegisterDeferredRegistrations.js.map +1 -1
- package/dist/useCanUpdateDeferredRegistrations.js +0 -2
- package/dist/useCanUpdateDeferredRegistrations.js.map +1 -1
- package/dist/useDeferredRegistrations.js +0 -7
- package/dist/useDeferredRegistrations.js.map +1 -1
- package/dist/useExecuteOnce.js +0 -2
- package/dist/useExecuteOnce.js.map +1 -1
- package/dist/useIsActiveRouteProtected.js +0 -3
- package/dist/useIsActiveRouteProtected.js.map +1 -1
- package/dist/useIsBootstrapping.js +0 -2
- package/dist/useIsBootstrapping.js.map +1 -1
- package/dist/useNavigationItems.js +0 -3
- package/dist/useNavigationItems.js.map +1 -1
- package/dist/useProtectedDataHandler.js +0 -3
- package/dist/useProtectedDataHandler.js.map +1 -1
- package/dist/useProtectedDataQueries.d.ts +6 -0
- package/dist/useProtectedDataQueries.js +0 -8
- package/dist/useProtectedDataQueries.js.map +1 -1
- package/dist/usePublicDataHandler.js +0 -3
- package/dist/usePublicDataHandler.js.map +1 -1
- package/dist/usePublicDataQueries.d.ts +6 -0
- package/dist/usePublicDataQueries.js +0 -8
- package/dist/usePublicDataQueries.js.map +1 -1
- package/dist/useRegisterDeferredRegistrations.js +0 -3
- package/dist/useRegisterDeferredRegistrations.js.map +1 -1
- package/dist/useStrictRegistrationMode.js +0 -3
- package/dist/useStrictRegistrationMode.js.map +1 -1
- package/dist/useUpdateDeferredRegistrations.d.ts +6 -0
- package/dist/useUpdateDeferredRegistrations.js +0 -4
- package/dist/useUpdateDeferredRegistrations.js.map +1 -1
- package/package.json +24 -23
- package/src/AppRouterReducer.ts +18 -0
- package/src/honeycomb/registerHoneycombInstrumentation.ts +30 -42
- package/src/initializeFirefly.ts +6 -0
- package/src/useProtectedDataQueries.ts +7 -0
- package/src/usePublicDataQueries.ts +7 -0
- package/src/useUpdateDeferredRegistrations.ts +7 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Span } from "@opentelemetry/api";
|
|
2
|
-
import { type AddListenerOptions, type EventCallbackFunction, type
|
|
2
|
+
import { type AddListenerOptions, type EventCallbackFunction, type EventMap, type EventMapKey } from "@squide/core";
|
|
3
3
|
import type { FireflyRuntime } from "../FireflyRuntime.tsx";
|
|
4
4
|
export interface AddProtectedListenerOptions extends AddListenerOptions {
|
|
5
5
|
onError?: (error: unknown) => void;
|
|
6
6
|
}
|
|
7
|
-
export declare function addProtectedListener(runtime: FireflyRuntime, eventName:
|
|
7
|
+
export declare function addProtectedListener<K extends EventMapKey>(runtime: FireflyRuntime, eventName: K, callback: EventCallbackFunction<EventMap[K]>, options?: AddProtectedListenerOptions): void;
|
|
8
8
|
export type GetSpanFunction = () => Span;
|
|
9
9
|
export type HoneycombTrackingUnmanagedErrorHandler = (error: unknown) => void;
|
|
10
10
|
export declare function reduceDataFetchEvents(runtime: FireflyRuntime, onDataFetchStarted: () => void, onDataReady: () => void, onPublicDataFetchStarted: () => void, onPublicDataReady: () => void, onProtectedDataFetchStarted: () => void, onProtectedDataReady: () => void, onDataFetchFailed: (queriesErrors: Error[]) => void, onUnmanagedError: (error: unknown) => void): void;
|
|
@@ -8,25 +8,15 @@ import { createOverrideFetchRequestSpanWithActiveSpanContext, registerActiveSpan
|
|
|
8
8
|
import { getTracer } from "./tracer.js";
|
|
9
9
|
import { endActiveSpan, startActiveChildSpan, startChildSpan, startSpan, traceError } from "./utils.js";
|
|
10
10
|
|
|
11
|
-
;// CONCATENATED MODULE: external "@squide/core"
|
|
12
11
|
|
|
13
|
-
;// CONCATENATED MODULE: external "../AppRouterReducer.js"
|
|
14
12
|
|
|
15
|
-
;// CONCATENATED MODULE: external "../initializeFirefly.js"
|
|
16
13
|
|
|
17
|
-
;// CONCATENATED MODULE: external "../useProtectedDataQueries.js"
|
|
18
14
|
|
|
19
|
-
;// CONCATENATED MODULE: external "../usePublicDataQueries.js"
|
|
20
15
|
|
|
21
|
-
;// CONCATENATED MODULE: external "../useUpdateDeferredRegistrations.js"
|
|
22
16
|
|
|
23
|
-
;// CONCATENATED MODULE: external "./activeSpan.js"
|
|
24
17
|
|
|
25
|
-
;// CONCATENATED MODULE: external "./tracer.js"
|
|
26
18
|
|
|
27
|
-
;// CONCATENATED MODULE: external "./utils.js"
|
|
28
19
|
|
|
29
|
-
;// CONCATENATED MODULE: ./src/honeycomb/registerHoneycombInstrumentation.ts
|
|
30
20
|
|
|
31
21
|
|
|
32
22
|
|
|
@@ -37,11 +27,11 @@ import { endActiveSpan, startActiveChildSpan, startChildSpan, startSpan, traceEr
|
|
|
37
27
|
|
|
38
28
|
|
|
39
29
|
function addProtectedListener(runtime, eventName, callback, options) {
|
|
40
|
-
const protectedCallback = (
|
|
30
|
+
const protectedCallback = (data)=>{
|
|
41
31
|
try {
|
|
42
|
-
callback(
|
|
32
|
+
callback(data);
|
|
43
33
|
} catch (error) {
|
|
44
|
-
runtime.logger.withText(`[squide] An unmanaged error occurred while handling event "${eventName
|
|
34
|
+
runtime.logger.withText(`[squide] An unmanaged error occurred while handling event "${String(eventName)}" for Honeycomb instrumentation:`).withError(error).error();
|
|
45
35
|
}
|
|
46
36
|
};
|
|
47
37
|
runtime.eventBus.addListener(eventName, protectedCallback, options);
|
|
@@ -105,7 +95,7 @@ function reduceDataFetchEvents(runtime, onDataFetchStarted, onDataReady, onPubli
|
|
|
105
95
|
const handleDataFetchFailed = (payload)=>{
|
|
106
96
|
if (dataFetchState !== "data-fetch-failed") {
|
|
107
97
|
dataFetchState = "data-fetch-failed";
|
|
108
|
-
onDataFetchFailed(payload);
|
|
98
|
+
onDataFetchFailed(payload ?? []);
|
|
109
99
|
}
|
|
110
100
|
};
|
|
111
101
|
addProtectedListener(runtime, PublicDataFetchFailedEvent, handleDataFetchFailed, {
|
|
@@ -176,7 +166,7 @@ function registerTrackingListeners(runtime) {
|
|
|
176
166
|
});
|
|
177
167
|
addProtectedListener(runtime, LocalModulesRegistrationStartedEvent, (payload)=>{
|
|
178
168
|
const attributes = {
|
|
179
|
-
"app.squide.module_count": payload
|
|
169
|
+
"app.squide.module_count": payload?.moduleCount
|
|
180
170
|
};
|
|
181
171
|
if (bootstrappingSpan) {
|
|
182
172
|
bootstrappingSpan.addEvent("local-module-registration-started", attributes);
|
|
@@ -194,7 +184,7 @@ function registerTrackingListeners(runtime) {
|
|
|
194
184
|
addProtectedListener(runtime, LocalModulesRegistrationCompletedEvent, (payload)=>{
|
|
195
185
|
if (bootstrappingSpan) {
|
|
196
186
|
bootstrappingSpan.addEvent("local-module-registration-completed", {
|
|
197
|
-
"app.squide.module_count": payload
|
|
187
|
+
"app.squide.module_count": payload?.moduleCount
|
|
198
188
|
});
|
|
199
189
|
}
|
|
200
190
|
if (localModuleRegistrationSpan) {
|
|
@@ -206,16 +196,15 @@ function registerTrackingListeners(runtime) {
|
|
|
206
196
|
});
|
|
207
197
|
// Can occur multiple times.
|
|
208
198
|
addProtectedListener(runtime, LocalModuleRegistrationFailedEvent, (payload)=>{
|
|
209
|
-
const registrationError = payload;
|
|
210
199
|
if (localModuleRegistrationSpan) {
|
|
211
|
-
traceError(localModuleRegistrationSpan,
|
|
200
|
+
traceError(localModuleRegistrationSpan, payload);
|
|
212
201
|
}
|
|
213
202
|
}, {
|
|
214
203
|
onError: handleUnmanagedError
|
|
215
204
|
});
|
|
216
205
|
addProtectedListener(runtime, LocalModulesDeferredRegistrationStartedEvent, (payload)=>{
|
|
217
206
|
const attributes = {
|
|
218
|
-
"app.squide.registration_count": payload
|
|
207
|
+
"app.squide.registration_count": payload?.registrationCount
|
|
219
208
|
};
|
|
220
209
|
if (bootstrappingSpan) {
|
|
221
210
|
bootstrappingSpan.addEvent("local-module-deferred-registration-started", attributes);
|
|
@@ -233,7 +222,7 @@ function registerTrackingListeners(runtime) {
|
|
|
233
222
|
addProtectedListener(runtime, LocalModulesDeferredRegistrationCompletedEvent, (payload)=>{
|
|
234
223
|
if (bootstrappingSpan) {
|
|
235
224
|
bootstrappingSpan.addEvent("local-module-deferred-registration-completed", {
|
|
236
|
-
"app.squide.registration_count": payload
|
|
225
|
+
"app.squide.registration_count": payload?.registrationCount
|
|
237
226
|
});
|
|
238
227
|
}
|
|
239
228
|
if (localModuleDeferredRegistrationSpan) {
|
|
@@ -245,9 +234,8 @@ function registerTrackingListeners(runtime) {
|
|
|
245
234
|
});
|
|
246
235
|
// Can occur multiple times.
|
|
247
236
|
addProtectedListener(runtime, LocalModuleDeferredRegistrationFailedEvent, (payload)=>{
|
|
248
|
-
const registrationError = payload;
|
|
249
237
|
if (localModuleDeferredRegistrationSpan) {
|
|
250
|
-
traceError(localModuleRegistrationSpan,
|
|
238
|
+
traceError(localModuleRegistrationSpan, payload);
|
|
251
239
|
}
|
|
252
240
|
}, {
|
|
253
241
|
onError: handleUnmanagedError
|
|
@@ -335,7 +323,7 @@ function registerTrackingListeners(runtime) {
|
|
|
335
323
|
// Can occur multiple times.
|
|
336
324
|
addProtectedListener(runtime, LocalModulesDeferredRegistrationsUpdateStartedEvent, (payload)=>{
|
|
337
325
|
const attributes = {
|
|
338
|
-
"app.squide.registration_count": payload
|
|
326
|
+
"app.squide.registration_count": payload?.registrationCount
|
|
339
327
|
};
|
|
340
328
|
if (deferredRegistrationsUpdateSpan) {
|
|
341
329
|
deferredRegistrationsUpdateSpan.addEvent("local-module-deferred-registrations-update-started", attributes);
|
|
@@ -358,7 +346,7 @@ function registerTrackingListeners(runtime) {
|
|
|
358
346
|
addProtectedListener(runtime, LocalModulesDeferredRegistrationsUpdateCompletedEvent, (payload)=>{
|
|
359
347
|
if (deferredRegistrationsUpdateSpan) {
|
|
360
348
|
deferredRegistrationsUpdateSpan.addEvent("local-module-deferred-registrations-update-completed", {
|
|
361
|
-
"app.squide.registration_count": payload
|
|
349
|
+
"app.squide.registration_count": payload?.registrationCount
|
|
362
350
|
});
|
|
363
351
|
}
|
|
364
352
|
if (localModuleDeferredRegistrationsUpdateSpan) {
|
|
@@ -369,9 +357,8 @@ function registerTrackingListeners(runtime) {
|
|
|
369
357
|
});
|
|
370
358
|
// Can occur multiple times.
|
|
371
359
|
addProtectedListener(runtime, LocalModuleDeferredRegistrationUpdateFailedEvent, (payload)=>{
|
|
372
|
-
const registrationError = payload;
|
|
373
360
|
if (localModuleDeferredRegistrationsUpdateSpan) {
|
|
374
|
-
traceError(localModuleDeferredRegistrationsUpdateSpan.instance,
|
|
361
|
+
traceError(localModuleDeferredRegistrationsUpdateSpan.instance, payload);
|
|
375
362
|
}
|
|
376
363
|
}, {
|
|
377
364
|
onError: handleUnmanagedError
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"honeycomb/registerHoneycombInstrumentation.js","sources":["../../src/honeycomb/registerHoneycombInstrumentation.ts"],"sourcesContent":["import type { Span } from \"@opentelemetry/api\";\nimport {\n type AddListenerOptions,\n type EventCallbackFunction,\n type EventName,\n LocalModuleDeferredRegistrationFailedEvent,\n LocalModuleDeferredRegistrationUpdateFailedEvent,\n LocalModuleRegistrationFailedEvent,\n LocalModulesDeferredRegistrationCompletedEvent,\n type LocalModulesDeferredRegistrationCompletedEventPayload,\n LocalModulesDeferredRegistrationStartedEvent,\n type LocalModulesDeferredRegistrationStartedEventPayload,\n LocalModulesDeferredRegistrationsUpdateCompletedEvent,\n type LocalModulesDeferredRegistrationsUpdateCompletedEventPayload,\n LocalModulesDeferredRegistrationsUpdateStartedEvent,\n type LocalModulesDeferredRegistrationsUpdateStartedEventPayload,\n LocalModulesRegistrationCompletedEvent,\n type LocalModulesRegistrationCompletedEventPayload,\n LocalModulesRegistrationStartedEvent,\n type LocalModulesRegistrationStartedEventPayload,\n type ModuleRegistrationError\n} from \"@squide/core\";\nimport { ApplicationBoostrappedEvent, type AppRouterWaitState, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, PublicDataReadyEvent } from \"../AppRouterReducer.ts\";\nimport { FireflyPlugin } from \"../FireflyPlugin.ts\";\nimport type { FireflyRuntime } from \"../FireflyRuntime.tsx\";\nimport { ApplicationBootstrappingStartedEvent } from \"../initializeFirefly.ts\";\nimport { ProtectedDataFetchFailedEvent, ProtectedDataFetchStartedEvent } from \"../useProtectedDataQueries.ts\";\nimport { PublicDataFetchFailedEvent, PublicDataFetchStartedEvent } from \"../usePublicDataQueries.ts\";\nimport { DeferredRegistrationsUpdateCompletedEvent, DeferredRegistrationsUpdateStartedEvent } from \"../useUpdateDeferredRegistrations.ts\";\nimport { type ActiveSpan, createOverrideFetchRequestSpanWithActiveSpanContext, registerActiveSpanStack } from \"./activeSpan.ts\";\nimport { getTracer } from \"./tracer.ts\";\nimport { endActiveSpan, startActiveChildSpan, startChildSpan, startSpan, traceError } from \"./utils.ts\";\n\n// TIPS:\n// To query those traces in Honeycomb, use the following query filter:\n// \"root.name = squide-bootstrapping\" and\n// \"root.name = squide-deferred-registrations-update\".\n\nexport interface AddProtectedListenerOptions extends AddListenerOptions {\n onError?: (error: unknown) => void;\n}\n\nexport function addProtectedListener(runtime: FireflyRuntime, eventName: EventName, callback: EventCallbackFunction, options?: AddProtectedListenerOptions) {\n const protectedCallback = (...args: unknown[]) => {\n try {\n callback(...args);\n } catch (error: unknown) {\n runtime.logger\n .withText(`[squide] An unmanaged error occurred while handling event \"${eventName.toString()}\" for Honeycomb instrumentation:`)\n .withError(error as Error)\n .error();\n }\n };\n\n runtime.eventBus.addListener(eventName, protectedCallback, options);\n}\n\nexport type GetSpanFunction = () => Span;\nexport type HoneycombTrackingUnmanagedErrorHandler = (error: unknown) => void;\n\ntype DataFetchState = \"none\" | \"fetching-data\" | \"public-data-ready\" | \"protected-data-ready\" | \"data-ready\" | \"data-fetch-failed\";\n\nexport function reduceDataFetchEvents(\n runtime: FireflyRuntime,\n onDataFetchStarted: () => void,\n onDataReady: () => void,\n onPublicDataFetchStarted: () => void,\n onPublicDataReady: () => void,\n onProtectedDataFetchStarted: () => void,\n onProtectedDataReady: () => void,\n onDataFetchFailed: (queriesErrors: Error[]) => void,\n onUnmanagedError: (error: unknown) => void\n) {\n let dataFetchState: DataFetchState = \"none\";\n\n addProtectedListener(runtime, PublicDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchStarted();\n }\n\n onPublicDataFetchStarted();\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, PublicDataReadyEvent, payload => {\n onPublicDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n if (payload && !(payload as AppRouterWaitState).waitForProtectedData) {\n dataFetchState = \"data-ready\";\n onDataReady();\n } else {\n dataFetchState = \"public-data-ready\";\n }\n } else if (dataFetchState === \"protected-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, ProtectedDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchStarted();\n }\n\n onProtectedDataFetchStarted();\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, ProtectedDataReadyEvent, payload => {\n onProtectedDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n if (payload && !(payload as AppRouterWaitState).waitForPublicData) {\n dataFetchState = \"data-ready\";\n onDataReady();\n } else {\n dataFetchState = \"protected-data-ready\";\n }\n } else if (dataFetchState === \"public-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n const handleDataFetchFailed = (payload: unknown) => {\n if (dataFetchState !== \"data-fetch-failed\") {\n dataFetchState = \"data-fetch-failed\";\n\n onDataFetchFailed(payload as Error[]);\n }\n };\n\n addProtectedListener(runtime, PublicDataFetchFailedEvent, handleDataFetchFailed, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, ProtectedDataFetchFailedEvent, handleDataFetchFailed, {\n once: true,\n onError: onUnmanagedError\n });\n}\n\nfunction registerTrackingListeners(runtime: FireflyRuntime) {\n let bootstrappingSpan: Span;\n let bootstrappingSpanHasEnded: boolean = false;\n let localModuleRegistrationSpan: Span;\n let localModuleDeferredRegistrationSpan: Span;\n let dataFetchSpan: ActiveSpan;\n let deferredRegistrationsUpdateSpan: Span;\n let localModuleDeferredRegistrationsUpdateSpan: ActiveSpan;\n\n const pluginsUnmanagedErrorHandlers: HoneycombTrackingUnmanagedErrorHandler[] = [];\n\n const handleUnmanagedError = (error: unknown) => {\n if (bootstrappingSpan && !bootstrappingSpanHasEnded) {\n traceError(bootstrappingSpan, error as Error);\n\n bootstrappingSpan.end();\n bootstrappingSpanHasEnded = true;\n }\n\n if (localModuleRegistrationSpan) {\n localModuleRegistrationSpan.end();\n }\n\n if (localModuleDeferredRegistrationSpan) {\n localModuleDeferredRegistrationSpan.end();\n }\n\n if (dataFetchSpan) {\n dataFetchSpan.instance.end();\n }\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.end();\n }\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n localModuleDeferredRegistrationsUpdateSpan.instance.end();\n }\n\n pluginsUnmanagedErrorHandlers.forEach(x => {\n x(error);\n });\n };\n\n addProtectedListener(runtime, ApplicationBootstrappingStartedEvent, () => {\n bootstrappingSpan = startSpan((options, context) => getTracer().startSpan(\"squide-bootstrapping\", options, context));\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, ApplicationBoostrappedEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.end();\n bootstrappingSpanHasEnded = true;\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, MswReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"msw-ready\");\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, LocalModulesRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.module_count\": (payload as LocalModulesRegistrationStartedEventPayload).moduleCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-registration-started\", attributes);\n }\n\n localModuleRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"local-module-registration\", { ...options, attributes }, context);\n });\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, LocalModulesRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-registration-completed\", {\n \"app.squide.module_count\": (payload as LocalModulesRegistrationCompletedEventPayload).moduleCount\n });\n }\n\n if (localModuleRegistrationSpan) {\n localModuleRegistrationSpan.end();\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModuleRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleRegistrationSpan) {\n traceError(localModuleRegistrationSpan, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, LocalModulesDeferredRegistrationStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationStartedEventPayload).registrationCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-deferred-registration-started\", attributes);\n }\n\n localModuleDeferredRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"local-module-deferred-registration\", { ...options, attributes }, context);\n });\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, LocalModulesDeferredRegistrationCompletedEvent, (payload: unknown) => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-deferred-registration-completed\", {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationCompletedEventPayload).registrationCount\n });\n }\n\n if (localModuleDeferredRegistrationSpan) {\n localModuleDeferredRegistrationSpan.end();\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModuleDeferredRegistrationFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleDeferredRegistrationSpan) {\n traceError(localModuleRegistrationSpan, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n const handleFetchDataStarted = () => {\n dataFetchSpan = startActiveChildSpan(bootstrappingSpan, (options, context) => {\n const name = \"data-fetch\";\n const span = getTracer().startSpan(name, options, context);\n\n return {\n name,\n span\n };\n });\n };\n\n const handleDataReady = () => {\n if (dataFetchSpan) {\n endActiveSpan(dataFetchSpan);\n }\n };\n\n const handlePublicDataFetchStarted = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"public-data-fetch-started\");\n }\n };\n\n const handlePublicDataReady = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"public-data-ready\");\n }\n };\n\n const handleProtectedDataFetchStarted = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"protected-data-fetch-started\");\n }\n };\n\n const handleProtectedDataReady = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"protected-data-ready\");\n }\n };\n\n const handleDataFetchFailed = (queriesErrors: Error[]) => {\n if (dataFetchSpan) {\n queriesErrors.forEach(x => {\n traceError(dataFetchSpan.instance, x);\n });\n\n endActiveSpan(dataFetchSpan);\n\n // Global data fetch errors are unmanaged, which mean the host application bootstrapping flow\n // will be aborted and a react-router error boundary will be rendered.\n if (bootstrappingSpan) {\n bootstrappingSpan.end();\n bootstrappingSpanHasEnded = true;\n }\n }\n };\n\n reduceDataFetchEvents(\n runtime,\n handleFetchDataStarted,\n handleDataReady,\n handlePublicDataFetchStarted,\n handlePublicDataReady,\n handleProtectedDataFetchStarted,\n handleProtectedDataReady,\n handleDataFetchFailed,\n handleUnmanagedError\n );\n\n addProtectedListener(runtime, ModulesRegisteredEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-registered\");\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, ModulesReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-ready\");\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, DeferredRegistrationsUpdateStartedEvent, () => {\n deferredRegistrationsUpdateSpan = startSpan((options, context) => getTracer().startSpan(\"squide-deferred-registrations-update\", options, context));\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, DeferredRegistrationsUpdateCompletedEvent, () => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.end();\n }\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModulesDeferredRegistrationsUpdateStartedEvent, (payload: unknown) => {\n const attributes = {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationsUpdateStartedEventPayload).registrationCount\n };\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"local-module-deferred-registrations-update-started\", attributes);\n }\n\n localModuleDeferredRegistrationsUpdateSpan = startActiveChildSpan(deferredRegistrationsUpdateSpan, (options, context) => {\n const name = \"local-module-deferred-registrations-update\";\n\n const span = getTracer().startSpan(name, {\n attributes,\n ...options\n }, context);\n\n return {\n name,\n span\n };\n });\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModulesDeferredRegistrationsUpdateCompletedEvent, (payload: unknown) => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"local-module-deferred-registrations-update-completed\", {\n \"app.squide.registration_count\": (payload as LocalModulesDeferredRegistrationsUpdateCompletedEventPayload).registrationCount\n });\n }\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n endActiveSpan(localModuleDeferredRegistrationsUpdateSpan);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModuleDeferredRegistrationUpdateFailedEvent, (payload: unknown) => {\n const registrationError = payload as ModuleRegistrationError;\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n traceError(localModuleDeferredRegistrationsUpdateSpan.instance, registrationError);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n const getBootstrappingSpan: GetSpanFunction = () => bootstrappingSpan;\n const getDeferredRegistrationsUpdateSpan: GetSpanFunction = () => deferredRegistrationsUpdateSpan;\n\n const handlePluginUnmanagedError: HoneycombTrackingUnmanagedErrorHandler = (error: unknown) => {\n handleUnmanagedError(error);\n };\n\n // Register plugins specific handlers for Honeycomb telemetry.\n runtime.plugins.forEach(x => {\n const plugin = x as FireflyPlugin;\n\n if (plugin.registerHoneycombTrackingListeners) {\n const unmanagedErrorHandler = plugin.registerHoneycombTrackingListeners(\n getBootstrappingSpan,\n getDeferredRegistrationsUpdateSpan,\n handlePluginUnmanagedError\n );\n\n pluginsUnmanagedErrorHandlers.push(unmanagedErrorHandler);\n }\n });\n}\n\nexport function registerHoneycombInstrumentation(runtime: FireflyRuntime) {\n try {\n registerActiveSpanStack();\n\n // Dynamically registering this request hook function to nest the HTTP requests\n // of squide bootstrapping under the appropriate Honeycomb span.\n runtime.honeycombInstrumentationClient?.registerFetchRequestHook(createOverrideFetchRequestSpanWithActiveSpanContext(runtime.logger));\n\n registerTrackingListeners(runtime);\n\n runtime.logger.information(\"[squide] Honeycomb instrumentation is registered.\");\n } catch (error: unknown) {\n runtime.logger\n .withText(\"[squide] An error occurred while registering Honeycomb instrumentation:\")\n .withError(error as Error)\n .error();\n }\n}\n"],"names":["LocalModuleDeferredRegistrationFailedEvent","LocalModuleDeferredRegistrationUpdateFailedEvent","LocalModuleRegistrationFailedEvent","LocalModulesDeferredRegistrationCompletedEvent","LocalModulesDeferredRegistrationStartedEvent","LocalModulesDeferredRegistrationsUpdateCompletedEvent","LocalModulesDeferredRegistrationsUpdateStartedEvent","LocalModulesRegistrationCompletedEvent","LocalModulesRegistrationStartedEvent","ApplicationBoostrappedEvent","ModulesReadyEvent","ModulesRegisteredEvent","MswReadyEvent","ProtectedDataReadyEvent","PublicDataReadyEvent","ApplicationBootstrappingStartedEvent","ProtectedDataFetchFailedEvent","ProtectedDataFetchStartedEvent","PublicDataFetchFailedEvent","PublicDataFetchStartedEvent","DeferredRegistrationsUpdateCompletedEvent","DeferredRegistrationsUpdateStartedEvent","createOverrideFetchRequestSpanWithActiveSpanContext","registerActiveSpanStack","getTracer","endActiveSpan","startActiveChildSpan","startChildSpan","startSpan","traceError","addProtectedListener","runtime","eventName","callback","options","protectedCallback","args","error","reduceDataFetchEvents","onDataFetchStarted","onDataReady","onPublicDataFetchStarted","onPublicDataReady","onProtectedDataFetchStarted","onProtectedDataReady","onDataFetchFailed","onUnmanagedError","dataFetchState","payload","handleDataFetchFailed","registerTrackingListeners","bootstrappingSpan","bootstrappingSpanHasEnded","localModuleRegistrationSpan","localModuleDeferredRegistrationSpan","dataFetchSpan","deferredRegistrationsUpdateSpan","localModuleDeferredRegistrationsUpdateSpan","pluginsUnmanagedErrorHandlers","handleUnmanagedError","x","context","attributes","registrationError","handleFetchDataStarted","name","span","handleDataReady","handlePublicDataFetchStarted","handlePublicDataReady","handleProtectedDataFetchStarted","handleProtectedDataReady","queriesErrors","getBootstrappingSpan","getDeferredRegistrationsUpdateSpan","handlePluginUnmanagedError","plugin","unmanagedErrorHandler","registerHoneycombInstrumentation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBsB;AACiL;AAGxH;AAC+B;AACT;AACqC;AACV;AACxF;AACgE;AAWjG,SAAS8B,qBAAqBC,OAAuB,EAAEC,SAAoB,EAAEC,QAA+B,EAAE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QAAQ,CAAC,2EACT,SAAS,CAACM,OACV,KAAK;IACd;AACJ"}
|
|
1
|
+
{"version":3,"file":"honeycomb/registerHoneycombInstrumentation.js","sources":["../../src/honeycomb/registerHoneycombInstrumentation.ts"],"sourcesContent":["import type { Span } from \"@opentelemetry/api\";\nimport {\n type AddListenerOptions,\n type EventCallbackFunction,\n type EventMap,\n type EventMapKey,\n LocalModuleDeferredRegistrationFailedEvent,\n LocalModuleDeferredRegistrationUpdateFailedEvent,\n LocalModuleRegistrationFailedEvent,\n LocalModulesDeferredRegistrationCompletedEvent,\n LocalModulesDeferredRegistrationStartedEvent,\n LocalModulesDeferredRegistrationsUpdateCompletedEvent,\n LocalModulesDeferredRegistrationsUpdateStartedEvent,\n LocalModulesRegistrationCompletedEvent,\n LocalModulesRegistrationStartedEvent\n} from \"@squide/core\";\nimport { ApplicationBoostrappedEvent, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, PublicDataReadyEvent } from \"../AppRouterReducer.ts\";\nimport { FireflyPlugin } from \"../FireflyPlugin.ts\";\nimport type { FireflyRuntime } from \"../FireflyRuntime.tsx\";\nimport { ApplicationBootstrappingStartedEvent } from \"../initializeFirefly.ts\";\nimport { ProtectedDataFetchFailedEvent, ProtectedDataFetchStartedEvent } from \"../useProtectedDataQueries.ts\";\nimport { PublicDataFetchFailedEvent, PublicDataFetchStartedEvent } from \"../usePublicDataQueries.ts\";\nimport { DeferredRegistrationsUpdateCompletedEvent, DeferredRegistrationsUpdateStartedEvent } from \"../useUpdateDeferredRegistrations.ts\";\nimport { type ActiveSpan, createOverrideFetchRequestSpanWithActiveSpanContext, registerActiveSpanStack } from \"./activeSpan.ts\";\nimport { getTracer } from \"./tracer.ts\";\nimport { endActiveSpan, startActiveChildSpan, startChildSpan, startSpan, traceError } from \"./utils.ts\";\n\n// TIPS:\n// To query those traces in Honeycomb, use the following query filter:\n// \"root.name = squide-bootstrapping\" and\n// \"root.name = squide-deferred-registrations-update\".\n\nexport interface AddProtectedListenerOptions extends AddListenerOptions {\n onError?: (error: unknown) => void;\n}\n\nexport function addProtectedListener<K extends EventMapKey>(runtime: FireflyRuntime, eventName: K, callback: EventCallbackFunction<EventMap[K]>, options?: AddProtectedListenerOptions) {\n const protectedCallback: EventCallbackFunction<EventMap[K]> = data => {\n try {\n callback(data);\n } catch (error: unknown) {\n runtime.logger\n .withText(`[squide] An unmanaged error occurred while handling event \"${String(eventName)}\" for Honeycomb instrumentation:`)\n .withError(error as Error)\n .error();\n }\n };\n\n runtime.eventBus.addListener(eventName, protectedCallback, options);\n}\n\nexport type GetSpanFunction = () => Span;\nexport type HoneycombTrackingUnmanagedErrorHandler = (error: unknown) => void;\n\ntype DataFetchState = \"none\" | \"fetching-data\" | \"public-data-ready\" | \"protected-data-ready\" | \"data-ready\" | \"data-fetch-failed\";\n\nexport function reduceDataFetchEvents(\n runtime: FireflyRuntime,\n onDataFetchStarted: () => void,\n onDataReady: () => void,\n onPublicDataFetchStarted: () => void,\n onPublicDataReady: () => void,\n onProtectedDataFetchStarted: () => void,\n onProtectedDataReady: () => void,\n onDataFetchFailed: (queriesErrors: Error[]) => void,\n onUnmanagedError: (error: unknown) => void\n) {\n let dataFetchState: DataFetchState = \"none\";\n\n addProtectedListener(runtime, PublicDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchStarted();\n }\n\n onPublicDataFetchStarted();\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, PublicDataReadyEvent, payload => {\n onPublicDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n if (payload && !payload.waitForProtectedData) {\n dataFetchState = \"data-ready\";\n onDataReady();\n } else {\n dataFetchState = \"public-data-ready\";\n }\n } else if (dataFetchState === \"protected-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, ProtectedDataFetchStartedEvent, () => {\n if (dataFetchState === \"none\") {\n dataFetchState = \"fetching-data\";\n onDataFetchStarted();\n }\n\n onProtectedDataFetchStarted();\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, ProtectedDataReadyEvent, payload => {\n onProtectedDataReady();\n\n if (dataFetchState === \"fetching-data\") {\n if (payload && !payload.waitForPublicData) {\n dataFetchState = \"data-ready\";\n onDataReady();\n } else {\n dataFetchState = \"protected-data-ready\";\n }\n } else if (dataFetchState === \"public-data-ready\") {\n dataFetchState = \"data-ready\";\n onDataReady();\n }\n }, {\n once: true,\n onError: onUnmanagedError\n });\n\n const handleDataFetchFailed: EventCallbackFunction<Error[]> = payload => {\n if (dataFetchState !== \"data-fetch-failed\") {\n dataFetchState = \"data-fetch-failed\";\n\n onDataFetchFailed(payload ?? []);\n }\n };\n\n addProtectedListener(runtime, PublicDataFetchFailedEvent, handleDataFetchFailed, {\n once: true,\n onError: onUnmanagedError\n });\n\n addProtectedListener(runtime, ProtectedDataFetchFailedEvent, handleDataFetchFailed, {\n once: true,\n onError: onUnmanagedError\n });\n}\n\nfunction registerTrackingListeners(runtime: FireflyRuntime) {\n let bootstrappingSpan: Span;\n let bootstrappingSpanHasEnded: boolean = false;\n let localModuleRegistrationSpan: Span;\n let localModuleDeferredRegistrationSpan: Span;\n let dataFetchSpan: ActiveSpan;\n let deferredRegistrationsUpdateSpan: Span;\n let localModuleDeferredRegistrationsUpdateSpan: ActiveSpan;\n\n const pluginsUnmanagedErrorHandlers: HoneycombTrackingUnmanagedErrorHandler[] = [];\n\n const handleUnmanagedError = (error: unknown) => {\n if (bootstrappingSpan && !bootstrappingSpanHasEnded) {\n traceError(bootstrappingSpan, error as Error);\n\n bootstrappingSpan.end();\n bootstrappingSpanHasEnded = true;\n }\n\n if (localModuleRegistrationSpan) {\n localModuleRegistrationSpan.end();\n }\n\n if (localModuleDeferredRegistrationSpan) {\n localModuleDeferredRegistrationSpan.end();\n }\n\n if (dataFetchSpan) {\n dataFetchSpan.instance.end();\n }\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.end();\n }\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n localModuleDeferredRegistrationsUpdateSpan.instance.end();\n }\n\n pluginsUnmanagedErrorHandlers.forEach(x => {\n x(error);\n });\n };\n\n addProtectedListener(runtime, ApplicationBootstrappingStartedEvent, () => {\n bootstrappingSpan = startSpan((options, context) => getTracer().startSpan(\"squide-bootstrapping\", options, context));\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, ApplicationBoostrappedEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.end();\n bootstrappingSpanHasEnded = true;\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, MswReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"msw-ready\");\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, LocalModulesRegistrationStartedEvent, payload => {\n const attributes = {\n \"app.squide.module_count\": payload?.moduleCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-registration-started\", attributes);\n }\n\n localModuleRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"local-module-registration\", { ...options, attributes }, context);\n });\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, LocalModulesRegistrationCompletedEvent, payload => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-registration-completed\", {\n \"app.squide.module_count\": payload?.moduleCount\n });\n }\n\n if (localModuleRegistrationSpan) {\n localModuleRegistrationSpan.end();\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModuleRegistrationFailedEvent, payload => {\n if (localModuleRegistrationSpan) {\n traceError(localModuleRegistrationSpan, payload as Error);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, LocalModulesDeferredRegistrationStartedEvent, payload => {\n const attributes = {\n \"app.squide.registration_count\": payload?.registrationCount\n };\n\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-deferred-registration-started\", attributes);\n }\n\n localModuleDeferredRegistrationSpan = startChildSpan(bootstrappingSpan, (options, context) => {\n return getTracer().startSpan(\"local-module-deferred-registration\", { ...options, attributes }, context);\n });\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, LocalModulesDeferredRegistrationCompletedEvent, payload => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"local-module-deferred-registration-completed\", {\n \"app.squide.registration_count\": payload?.registrationCount\n });\n }\n\n if (localModuleDeferredRegistrationSpan) {\n localModuleDeferredRegistrationSpan.end();\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModuleDeferredRegistrationFailedEvent, payload => {\n if (localModuleDeferredRegistrationSpan) {\n traceError(localModuleRegistrationSpan, payload as Error);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n const handleFetchDataStarted = () => {\n dataFetchSpan = startActiveChildSpan(bootstrappingSpan, (options, context) => {\n const name = \"data-fetch\";\n const span = getTracer().startSpan(name, options, context);\n\n return {\n name,\n span\n };\n });\n };\n\n const handleDataReady = () => {\n if (dataFetchSpan) {\n endActiveSpan(dataFetchSpan);\n }\n };\n\n const handlePublicDataFetchStarted = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"public-data-fetch-started\");\n }\n };\n\n const handlePublicDataReady = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"public-data-ready\");\n }\n };\n\n const handleProtectedDataFetchStarted = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"protected-data-fetch-started\");\n }\n };\n\n const handleProtectedDataReady = () => {\n if (dataFetchSpan) {\n dataFetchSpan.instance.addEvent(\"protected-data-ready\");\n }\n };\n\n const handleDataFetchFailed = (queriesErrors: Error[]) => {\n if (dataFetchSpan) {\n queriesErrors.forEach(x => {\n traceError(dataFetchSpan.instance, x);\n });\n\n endActiveSpan(dataFetchSpan);\n\n // Global data fetch errors are unmanaged, which mean the host application bootstrapping flow\n // will be aborted and a react-router error boundary will be rendered.\n if (bootstrappingSpan) {\n bootstrappingSpan.end();\n bootstrappingSpanHasEnded = true;\n }\n }\n };\n\n reduceDataFetchEvents(\n runtime,\n handleFetchDataStarted,\n handleDataReady,\n handlePublicDataFetchStarted,\n handlePublicDataReady,\n handleProtectedDataFetchStarted,\n handleProtectedDataReady,\n handleDataFetchFailed,\n handleUnmanagedError\n );\n\n addProtectedListener(runtime, ModulesRegisteredEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-registered\");\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n addProtectedListener(runtime, ModulesReadyEvent, () => {\n if (bootstrappingSpan) {\n bootstrappingSpan.addEvent(\"modules-ready\");\n }\n }, {\n once: true,\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, DeferredRegistrationsUpdateStartedEvent, () => {\n deferredRegistrationsUpdateSpan = startSpan((options, context) => getTracer().startSpan(\"squide-deferred-registrations-update\", options, context));\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, DeferredRegistrationsUpdateCompletedEvent, () => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.end();\n }\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModulesDeferredRegistrationsUpdateStartedEvent, payload => {\n const attributes = {\n \"app.squide.registration_count\": payload?.registrationCount\n };\n\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"local-module-deferred-registrations-update-started\", attributes);\n }\n\n localModuleDeferredRegistrationsUpdateSpan = startActiveChildSpan(deferredRegistrationsUpdateSpan, (options, context) => {\n const name = \"local-module-deferred-registrations-update\";\n\n const span = getTracer().startSpan(name, {\n attributes,\n ...options\n }, context);\n\n return {\n name,\n span\n };\n });\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModulesDeferredRegistrationsUpdateCompletedEvent, payload => {\n if (deferredRegistrationsUpdateSpan) {\n deferredRegistrationsUpdateSpan.addEvent(\"local-module-deferred-registrations-update-completed\", {\n \"app.squide.registration_count\": payload?.registrationCount\n });\n }\n\n if (localModuleDeferredRegistrationsUpdateSpan) {\n endActiveSpan(localModuleDeferredRegistrationsUpdateSpan);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n // Can occur multiple times.\n addProtectedListener(runtime, LocalModuleDeferredRegistrationUpdateFailedEvent, payload => {\n if (localModuleDeferredRegistrationsUpdateSpan) {\n traceError(localModuleDeferredRegistrationsUpdateSpan.instance, payload as Error);\n }\n }, {\n onError: handleUnmanagedError\n });\n\n const getBootstrappingSpan: GetSpanFunction = () => bootstrappingSpan;\n const getDeferredRegistrationsUpdateSpan: GetSpanFunction = () => deferredRegistrationsUpdateSpan;\n\n const handlePluginUnmanagedError: HoneycombTrackingUnmanagedErrorHandler = (error: unknown) => {\n handleUnmanagedError(error);\n };\n\n // Register plugins specific handlers for Honeycomb telemetry.\n runtime.plugins.forEach(x => {\n const plugin = x as FireflyPlugin;\n\n if (plugin.registerHoneycombTrackingListeners) {\n const unmanagedErrorHandler = plugin.registerHoneycombTrackingListeners(\n getBootstrappingSpan,\n getDeferredRegistrationsUpdateSpan,\n handlePluginUnmanagedError\n );\n\n pluginsUnmanagedErrorHandlers.push(unmanagedErrorHandler);\n }\n });\n}\n\nexport function registerHoneycombInstrumentation(runtime: FireflyRuntime) {\n try {\n registerActiveSpanStack();\n\n // Dynamically registering this request hook function to nest the HTTP requests\n // of squide bootstrapping under the appropriate Honeycomb span.\n runtime.honeycombInstrumentationClient?.registerFetchRequestHook(createOverrideFetchRequestSpanWithActiveSpanContext(runtime.logger));\n\n registerTrackingListeners(runtime);\n\n runtime.logger.information(\"[squide] Honeycomb instrumentation is registered.\");\n } catch (error: unknown) {\n runtime.logger\n .withText(\"[squide] An error occurred while registering Honeycomb instrumentation:\")\n .withError(error as Error)\n .error();\n }\n}\n"],"names":["LocalModuleDeferredRegistrationFailedEvent","LocalModuleDeferredRegistrationUpdateFailedEvent","LocalModuleRegistrationFailedEvent","LocalModulesDeferredRegistrationCompletedEvent","LocalModulesDeferredRegistrationStartedEvent","LocalModulesDeferredRegistrationsUpdateCompletedEvent","LocalModulesDeferredRegistrationsUpdateStartedEvent","LocalModulesRegistrationCompletedEvent","LocalModulesRegistrationStartedEvent","ApplicationBoostrappedEvent","ModulesReadyEvent","ModulesRegisteredEvent","MswReadyEvent","ProtectedDataReadyEvent","PublicDataReadyEvent","ApplicationBootstrappingStartedEvent","ProtectedDataFetchFailedEvent","ProtectedDataFetchStartedEvent","PublicDataFetchFailedEvent","PublicDataFetchStartedEvent","DeferredRegistrationsUpdateCompletedEvent","DeferredRegistrationsUpdateStartedEvent","createOverrideFetchRequestSpanWithActiveSpanContext","registerActiveSpanStack","getTracer","endActiveSpan","startActiveChildSpan","startChildSpan","startSpan","traceError","addProtectedListener","runtime","eventName","callback","options","protectedCallback","data","error","String","reduceDataFetchEvents","onDataFetchStarted","onDataReady","onPublicDataFetchStarted","onPublicDataReady","onProtectedDataFetchStarted","onProtectedDataReady","onDataFetchFailed","onUnmanagedError","dataFetchState","payload","handleDataFetchFailed","registerTrackingListeners","bootstrappingSpan","bootstrappingSpanHasEnded","localModuleRegistrationSpan","localModuleDeferredRegistrationSpan","dataFetchSpan","deferredRegistrationsUpdateSpan","localModuleDeferredRegistrationsUpdateSpan","pluginsUnmanagedErrorHandlers","handleUnmanagedError","x","context","attributes","handleFetchDataStarted","name","span","handleDataReady","handlePublicDataFetchStarted","handlePublicDataReady","handleProtectedDataFetchStarted","handleProtectedDataReady","queriesErrors","getBootstrappingSpan","getDeferredRegistrationsUpdateSpan","handlePluginUnmanagedError","plugin","unmanagedErrorHandler","registerHoneycombInstrumentation"],"mappings":";;;;;;;;;;;;;;;;;;;AAesB;AACwJ;AAG/F;AAC+B;AACT;AACqC;AACV;AACxF;AACgE;AAWjG,SAAS8B,oBAAoBA,CAAwBC,OAAuB,EAAEC,SAAY,EAAEC,QAA4C,EAAEC,OAAqC;IAClL,MAAMC,oBAAwDC,CAAAA;QAC1D,IAAI;YACAH,SAASG;QACb,EAAE,OAAOC,OAAgB;YACrBN,QAAQ,MAAM,CACT,QAAQ,CAAC,CAAC,2DAA2D,EAAEO,OAAON,WAAW,gCAAgC,CAAC,EAC1H,SAAS,CAACK,OACV,KAAK;QACd;IACJ;IAEAN,QAAQ,QAAQ,CAAC,WAAW,CAACC,WAAWG,mBAAmBD;AAC/D;AAOO,SAASK,qBAAqBA,CACjCR,OAAuB,EACvBS,kBAA8B,EAC9BC,WAAuB,EACvBC,wBAAoC,EACpCC,iBAA6B,EAC7BC,2BAAuC,EACvCC,oBAAgC,EAChCC,iBAAmD,EACnDC,gBAA0C;IAE1C,IAAIC,iBAAiC;IAErClB,oBAAoBA,CAACC,SAASZ,2BAA2BA,EAAE;QACvD,IAAI6B,mBAAmB,QAAQ;YAC3BA,iBAAiB;YACjBR;QACJ;QAEAE;IACJ,GAAG;QACC,MAAM;QACN,SAASK;IACb;IAEAjB,oBAAoBA,CAACC,SAASjB,oBAAoBA,EAAEmC,CAAAA;QAChDN;QAEA,IAAIK,mBAAmB,iBAAiB;YACpC,IAAIC,WAAW,CAACA,QAAQ,oBAAoB,EAAE;gBAC1CD,iBAAiB;gBACjBP;YACJ,OAAO;gBACHO,iBAAiB;YACrB;QACJ,OAAO,IAAIA,mBAAmB,wBAAwB;YAClDA,iBAAiB;YACjBP;QACJ;IACJ,GAAG;QACC,MAAM;QACN,SAASM;IACb;IAEAjB,oBAAoBA,CAACC,SAASd,8BAA8BA,EAAE;QAC1D,IAAI+B,mBAAmB,QAAQ;YA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ASC,gCAAgCA,CAAC/C,OAAuB;IACpE,IAAI;QACAR,uBAAuBA;QAEvB,+EAA+E;QAC/E,gEAAgE;QAChEQ,QAAQ,8BAA8B,EAAE,yBAAyBT,mDAAmDA,CAACS,QAAQ,MAAM;QAEnIoB,yBAAyBA,CAACpB;QAE1BA,QAAQ,MAAM,CAAC,WAAW,CAAC;IAC/B,EAAE,OAAOM,OAAgB;QACrBN,QAAQ,MAAM,CACT,QAAQ,CAAC,2EACT,SAAS,CAACM,OACV,KAAK;IACd;AACJ"}
|
package/dist/honeycomb/tracer.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"honeycomb/tracer.js","sources":["../../src/honeycomb/tracer.ts"],"sourcesContent":["import { trace } from \"@opentelemetry/api\";\n\nexport function getTracer() {\n // The tracer name is used as the \"library.name\" attribute.\n return trace.getTracer(\"@squide/honeycomb\");\n}\n"],"names":["trace","getTracer"],"mappings":"
|
|
1
|
+
{"version":3,"file":"honeycomb/tracer.js","sources":["../../src/honeycomb/tracer.ts"],"sourcesContent":["import { trace } from \"@opentelemetry/api\";\n\nexport function getTracer() {\n // The tracer name is used as the \"library.name\" attribute.\n return trace.getTracer(\"@squide/honeycomb\");\n}\n"],"names":["trace","getTracer"],"mappings":";;;AAA2C;AAEpC,SAASC,SAASA;IACrB,2DAA2D;IAC3D,OAAOD,eAAe,CAAC;AAC3B"}
|
package/dist/honeycomb/utils.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { SpanKind, SpanStatusCode, context as api_context, trace } from "@opentelemetry/api";
|
|
2
2
|
import { popActiveSpan, setActiveSpan } from "./activeSpan.js";
|
|
3
3
|
|
|
4
|
-
;// CONCATENATED MODULE: external "@opentelemetry/api"
|
|
5
4
|
|
|
6
|
-
;// CONCATENATED MODULE: external "./activeSpan.js"
|
|
7
5
|
|
|
8
|
-
;// CONCATENATED MODULE: ./src/honeycomb/utils.ts
|
|
9
6
|
|
|
10
7
|
|
|
11
8
|
function startSpan(factory) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"honeycomb/utils.js","sources":["../../src/honeycomb/utils.ts"],"sourcesContent":["import { type Context, type Exception, context as otelContext, trace as otelTrace, type Span, SpanKind, type SpanOptions, SpanStatusCode, type TimeInput } from \"@opentelemetry/api\";\nimport { type ActiveSpan, popActiveSpan, setActiveSpan } from \"./activeSpan.ts\";\n\nexport type StartSpanFactory = (options?: SpanOptions, context?: Context) => Span;\n\nexport function startSpan(factory: StartSpanFactory) {\n return factory({ kind: SpanKind.CLIENT });\n}\n\nexport type StartChildSpanFactory = (options?: SpanOptions, context?: Context) => Span;\n\nexport function startChildSpan(parent: Span, factory: StartChildSpanFactory) {\n const context = otelTrace.setSpan(otelContext.active(), parent);\n\n return factory({ kind: SpanKind.CLIENT }, context);\n}\n\nexport interface StartActiveSpanFactoryReturn {\n name: string;\n span: Span;\n}\n\nexport type StartActiveSpanFactory = (options?: SpanOptions, context?: Context) => StartActiveSpanFactoryReturn;\n\nexport function startActiveSpan(factory: StartActiveSpanFactory) {\n const { name, span } = factory({ kind: SpanKind.CLIENT });\n\n return setActiveSpan(name, span);\n}\n\nexport interface StartActiveChildSpanFactoryReturn {\n name: string;\n span: Span;\n}\n\nexport type StartActiveChildSpanFactory = (options?: SpanOptions, context?: Context) => StartActiveChildSpanFactoryReturn;\n\nexport function startActiveChildSpan(parent: Span, factory: StartActiveChildSpanFactory) {\n const context = otelTrace.setSpan(otelContext.active(), parent);\n\n const { name, span } = factory({ kind: SpanKind.CLIENT }, context);\n\n return setActiveSpan(name, span);\n}\n\nexport function endActiveSpan(span: ActiveSpan) {\n span.instance.end();\n\n popActiveSpan(span);\n}\n\nexport interface TraceErrorOptions {\n time?: TimeInput;\n}\n\nexport function traceError(span: Span, error: Exception, options: TraceErrorOptions = {}) {\n const { time } = options;\n\n span.recordException(error, time);\n\n span.setStatus({\n code: SpanStatusCode.ERROR\n });\n}\n"],"names":["context","otelContext","trace","otelTrace","SpanKind","SpanStatusCode","popActiveSpan","setActiveSpan","startSpan","factory","startChildSpan","parent","startActiveSpan","name","span","startActiveChildSpan","endActiveSpan","traceError","error","options","time"],"mappings":"
|
|
1
|
+
{"version":3,"file":"honeycomb/utils.js","sources":["../../src/honeycomb/utils.ts"],"sourcesContent":["import { type Context, type Exception, context as otelContext, trace as otelTrace, type Span, SpanKind, type SpanOptions, SpanStatusCode, type TimeInput } from \"@opentelemetry/api\";\nimport { type ActiveSpan, popActiveSpan, setActiveSpan } from \"./activeSpan.ts\";\n\nexport type StartSpanFactory = (options?: SpanOptions, context?: Context) => Span;\n\nexport function startSpan(factory: StartSpanFactory) {\n return factory({ kind: SpanKind.CLIENT });\n}\n\nexport type StartChildSpanFactory = (options?: SpanOptions, context?: Context) => Span;\n\nexport function startChildSpan(parent: Span, factory: StartChildSpanFactory) {\n const context = otelTrace.setSpan(otelContext.active(), parent);\n\n return factory({ kind: SpanKind.CLIENT }, context);\n}\n\nexport interface StartActiveSpanFactoryReturn {\n name: string;\n span: Span;\n}\n\nexport type StartActiveSpanFactory = (options?: SpanOptions, context?: Context) => StartActiveSpanFactoryReturn;\n\nexport function startActiveSpan(factory: StartActiveSpanFactory) {\n const { name, span } = factory({ kind: SpanKind.CLIENT });\n\n return setActiveSpan(name, span);\n}\n\nexport interface StartActiveChildSpanFactoryReturn {\n name: string;\n span: Span;\n}\n\nexport type StartActiveChildSpanFactory = (options?: SpanOptions, context?: Context) => StartActiveChildSpanFactoryReturn;\n\nexport function startActiveChildSpan(parent: Span, factory: StartActiveChildSpanFactory) {\n const context = otelTrace.setSpan(otelContext.active(), parent);\n\n const { name, span } = factory({ kind: SpanKind.CLIENT }, context);\n\n return setActiveSpan(name, span);\n}\n\nexport function endActiveSpan(span: ActiveSpan) {\n span.instance.end();\n\n popActiveSpan(span);\n}\n\nexport interface TraceErrorOptions {\n time?: TimeInput;\n}\n\nexport function traceError(span: Span, error: Exception, options: TraceErrorOptions = {}) {\n const { time } = options;\n\n span.recordException(error, time);\n\n span.setStatus({\n code: SpanStatusCode.ERROR\n });\n}\n"],"names":["context","otelContext","trace","otelTrace","SpanKind","SpanStatusCode","popActiveSpan","setActiveSpan","startSpan","factory","startChildSpan","parent","startActiveSpan","name","span","startActiveChildSpan","endActiveSpan","traceError","error","options","time"],"mappings":";;;;;AAAqL;AACrG;AAIzE,SAASQ,SAASA,CAACC,OAAyB;IAC/C,OAAOA,QAAQ;QAAE,MAAML,eAAe;IAAC;AAC3C;AAIO,SAASM,cAAcA,CAACC,MAAY,EAAEF,OAA8B;IACvE,MAAMT,UAAUG,aAAiB,CAACF,kBAAkB,IAAIU;IAExD,OAAOF,QAAQ;QAAE,MAAML,eAAe;IAAC,GAAGJ;AAC9C;AASO,SAASY,eAAeA,CAACH,OAA+B;IAC3D,MAAM,EAAEI,IAAI,EAAEC,IAAI,EAAE,GAAGL,QAAQ;QAAE,MAAML,eAAe;IAAC;IAEvD,OAAOG,aAAaA,CAACM,MAAMC;AAC/B;AASO,SAASC,oBAAoBA,CAACJ,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,aAAaA,CAACF,IAAgB;IAC1CA,KAAK,QAAQ,CAAC,GAAG;IAEjBR,aAAaA,CAACQ;AAClB;AAMO,SAASG,UAAUA,CAACH,IAAU,EAAEI,KAAgB,EAAEC,UAA6B,CAAC,CAAC;IACpF,MAAM,EAAEC,IAAI,EAAE,GAAGD;IAEjBL,KAAK,eAAe,CAACI,OAAOE;IAE5BN,KAAK,SAAS,CAAC;QACX,MAAMT,oBAAoB;IAC9B;AACJ"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import { EnvironmentVariablesPlugin, EnvironmentVariablesPluginName, getEnvironmentVariablesPlugin, useEnvironmentVariable, useEnvironmentVariables } from "@squide/env-vars";
|
|
2
|
-
import { FeatureFlagSetSnapshot, InMemoryLaunchDarklyClient, LaunchDarklyClientNotifier, LaunchDarklyClientTransaction, LaunchDarklyPlugin, LaunchDarklyPluginName, LocalStorageLaunchDarklyClient, createLocalStorageLaunchDarklyClient, getFeatureFlag, getLaunchDarklyPlugin, isEditableLaunchDarklyClient, useFeatureFlag, useFeatureFlags, useLaunchDarklyClient } from "@squide/launch-darkly";
|
|
3
|
-
import { MswPlugin, MswPluginName, MswState, getMswPlugin } from "@squide/msw";
|
|
4
|
-
import { ActiveRouteIsProtectedEvent, ActiveRouteIsPublicEvent, ApplicationBoostrappedEvent, DeferredRegistrationsUpdatedEvent, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, ProtectedDataUpdatedEvent, PublicDataReadyEvent, PublicDataUpdatedEvent } from "./AppRouterReducer.js";
|
|
5
1
|
export * from "@squide/core";
|
|
6
2
|
export * from "@squide/react-router";
|
|
7
3
|
export * from "./FireflyProvider.js";
|
|
@@ -26,15 +22,10 @@ export * from "./useStrictRegistrationMode.js";
|
|
|
26
22
|
export * from "./useUpdateDeferredRegistrations.js";
|
|
27
23
|
export * from "./initializeFirefly.js";
|
|
28
24
|
|
|
29
|
-
;// CONCATENATED MODULE: external "@squide/env-vars"
|
|
30
25
|
|
|
31
|
-
;// CONCATENATED MODULE: external "@squide/launch-darkly"
|
|
32
26
|
|
|
33
|
-
;// CONCATENATED MODULE: external "@squide/msw"
|
|
34
27
|
|
|
35
|
-
;// CONCATENATED MODULE: external "./AppRouterReducer.js"
|
|
36
28
|
|
|
37
|
-
;// CONCATENATED MODULE: ./src/index.ts
|
|
38
29
|
|
|
39
30
|
|
|
40
31
|
|
|
@@ -62,7 +53,9 @@ export * from "./initializeFirefly.js";
|
|
|
62
53
|
|
|
63
54
|
|
|
64
55
|
|
|
65
|
-
|
|
66
|
-
export {
|
|
56
|
+
export { EnvironmentVariablesPlugin, EnvironmentVariablesPluginName, getEnvironmentVariablesPlugin, useEnvironmentVariable, useEnvironmentVariables } from "@squide/env-vars";
|
|
57
|
+
export { FeatureFlagSetSnapshot, InMemoryLaunchDarklyClient, LaunchDarklyClientNotifier, LaunchDarklyClientTransaction, LaunchDarklyPlugin, LaunchDarklyPluginName, LocalStorageLaunchDarklyClient, createLocalStorageLaunchDarklyClient, getFeatureFlag, getLaunchDarklyPlugin, isEditableLaunchDarklyClient, useFeatureFlag, useFeatureFlags, useLaunchDarklyClient } from "@squide/launch-darkly";
|
|
58
|
+
export { MswPlugin, MswPluginName, MswState, getMswPlugin } from "@squide/msw";
|
|
59
|
+
export { ActiveRouteIsProtectedEvent, ActiveRouteIsPublicEvent, ApplicationBoostrappedEvent, DeferredRegistrationsUpdatedEvent, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, ProtectedDataUpdatedEvent, PublicDataReadyEvent, PublicDataUpdatedEvent } from "./AppRouterReducer.js";
|
|
67
60
|
|
|
68
61
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["export * from \"@squide/core\";\nexport {\n EnvironmentVariablesPlugin,\n EnvironmentVariablesPluginName,\n getEnvironmentVariablesPlugin,\n useEnvironmentVariable,\n useEnvironmentVariables,\n type EnvironmentVariableKey,\n type EnvironmentVariables,\n type EnvironmentVariablesPluginOptions\n} from \"@squide/env-vars\";\nexport {\n createLocalStorageLaunchDarklyClient,\n FeatureFlagSetSnapshot,\n getFeatureFlag,\n getLaunchDarklyPlugin,\n InMemoryLaunchDarklyClient,\n isEditableLaunchDarklyClient,\n LaunchDarklyClientNotifier,\n LaunchDarklyClientTransaction,\n LaunchDarklyPlugin,\n LaunchDarklyPluginName,\n LocalStorageLaunchDarklyClient,\n useFeatureFlag,\n useFeatureFlags,\n useLaunchDarklyClient,\n type CommitTransactionFunction,\n type EditableLaunchDarklyClient,\n type FeatureFlagKey,\n type FeatureFlags,\n type FeatureFlagSetSnapshotChangedListener,\n type InMemoryLaunchDarklyClientOptions,\n type LaunchDarklyClientListener,\n type LocalStorageLaunchDarklyClientOptions,\n type SetFeatureFlagOptions,\n type UndoTransactionFunction\n} from \"@squide/launch-darkly\";\nexport {\n getMswPlugin,\n MswPlugin,\n MswPluginName,\n MswState,\n type MswPluginOptions,\n type MswPluginRegisterRequestHandlersOptions,\n type MswReadyListener,\n type MswStateOptions\n} from \"@squide/msw\";\nexport * from \"@squide/react-router\";\n\nexport type { FireflyPlugin } from \"./FireflyPlugin.ts\";\nexport * from \"./FireflyProvider.tsx\";\nexport * from \"./FireflyRuntime.tsx\";\n\nexport * from \"./AppRouter.tsx\";\nexport {\n ActiveRouteIsProtectedEvent,\n ActiveRouteIsPublicEvent,\n ApplicationBoostrappedEvent,\n DeferredRegistrationsUpdatedEvent,\n ModulesReadyEvent,\n ModulesRegisteredEvent,\n MswReadyEvent,\n ProtectedDataReadyEvent,\n ProtectedDataUpdatedEvent,\n PublicDataReadyEvent,\n PublicDataUpdatedEvent\n} from \"./AppRouterReducer.ts\";\n\nexport * from \"./AppRouterStore.ts\";\nexport * from \"./GlobalDataQueriesError.ts\";\nexport * from \"./useCanFetchProtectedData.ts\";\nexport * from \"./useCanFetchPublicData.ts\";\nexport * from \"./useCanRegisterDeferredRegistrations.ts\";\nexport * from \"./useCanUpdateDeferredRegistrations.ts\";\nexport * from \"./useDeferredRegistrations.ts\";\nexport * from \"./useIsActiveRouteProtected.ts\";\nexport * from \"./useIsBootstrapping.ts\";\nexport * from \"./useNavigationItems.ts\";\nexport * from \"./useProtectedDataHandler.ts\";\nexport * from \"./useProtectedDataQueries.ts\";\nexport * from \"./usePublicDataHandler.ts\";\nexport * from \"./usePublicDataQueries.ts\";\nexport * from \"./useRegisterDeferredRegistrations.ts\";\nexport * from \"./useStrictRegistrationMode.ts\";\nexport * from \"./useUpdateDeferredRegistrations.ts\";\n\nexport * from \"./initializeFirefly.ts\";\n\n"],"names":["EnvironmentVariablesPlugin","EnvironmentVariablesPluginName","getEnvironmentVariablesPlugin","useEnvironmentVariable","useEnvironmentVariables","createLocalStorageLaunchDarklyClient","FeatureFlagSetSnapshot","getFeatureFlag","getLaunchDarklyPlugin","InMemoryLaunchDarklyClient","isEditableLaunchDarklyClient","LaunchDarklyClientNotifier","LaunchDarklyClientTransaction","LaunchDarklyPlugin","LaunchDarklyPluginName","LocalStorageLaunchDarklyClient","useFeatureFlag","useFeatureFlags","useLaunchDarklyClient","getMswPlugin","MswPlugin","MswPluginName","MswState","ActiveRouteIsProtectedEvent","ActiveRouteIsPublicEvent","ApplicationBoostrappedEvent","DeferredRegistrationsUpdatedEvent","ModulesReadyEvent","ModulesRegisteredEvent","MswReadyEvent","ProtectedDataReadyEvent","ProtectedDataUpdatedEvent","PublicDataReadyEvent","PublicDataUpdatedEvent"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["export * from \"@squide/core\";\nexport {\n EnvironmentVariablesPlugin,\n EnvironmentVariablesPluginName,\n getEnvironmentVariablesPlugin,\n useEnvironmentVariable,\n useEnvironmentVariables,\n type EnvironmentVariableKey,\n type EnvironmentVariables,\n type EnvironmentVariablesPluginOptions\n} from \"@squide/env-vars\";\nexport {\n createLocalStorageLaunchDarklyClient,\n FeatureFlagSetSnapshot,\n getFeatureFlag,\n getLaunchDarklyPlugin,\n InMemoryLaunchDarklyClient,\n isEditableLaunchDarklyClient,\n LaunchDarklyClientNotifier,\n LaunchDarklyClientTransaction,\n LaunchDarklyPlugin,\n LaunchDarklyPluginName,\n LocalStorageLaunchDarklyClient,\n useFeatureFlag,\n useFeatureFlags,\n useLaunchDarklyClient,\n type CommitTransactionFunction,\n type EditableLaunchDarklyClient,\n type FeatureFlagKey,\n type FeatureFlags,\n type FeatureFlagSetSnapshotChangedListener,\n type InMemoryLaunchDarklyClientOptions,\n type LaunchDarklyClientListener,\n type LocalStorageLaunchDarklyClientOptions,\n type SetFeatureFlagOptions,\n type UndoTransactionFunction\n} from \"@squide/launch-darkly\";\nexport {\n getMswPlugin,\n MswPlugin,\n MswPluginName,\n MswState,\n type MswPluginOptions,\n type MswPluginRegisterRequestHandlersOptions,\n type MswReadyListener,\n type MswStateOptions\n} from \"@squide/msw\";\nexport * from \"@squide/react-router\";\n\nexport type { FireflyPlugin } from \"./FireflyPlugin.ts\";\nexport * from \"./FireflyProvider.tsx\";\nexport * from \"./FireflyRuntime.tsx\";\n\nexport * from \"./AppRouter.tsx\";\nexport {\n ActiveRouteIsProtectedEvent,\n ActiveRouteIsPublicEvent,\n ApplicationBoostrappedEvent,\n DeferredRegistrationsUpdatedEvent,\n ModulesReadyEvent,\n ModulesRegisteredEvent,\n MswReadyEvent,\n ProtectedDataReadyEvent,\n ProtectedDataUpdatedEvent,\n PublicDataReadyEvent,\n PublicDataUpdatedEvent\n} from \"./AppRouterReducer.ts\";\n\nexport * from \"./AppRouterStore.ts\";\nexport * from \"./GlobalDataQueriesError.ts\";\nexport * from \"./useCanFetchProtectedData.ts\";\nexport * from \"./useCanFetchPublicData.ts\";\nexport * from \"./useCanRegisterDeferredRegistrations.ts\";\nexport * from \"./useCanUpdateDeferredRegistrations.ts\";\nexport * from \"./useDeferredRegistrations.ts\";\nexport * from \"./useIsActiveRouteProtected.ts\";\nexport * from \"./useIsBootstrapping.ts\";\nexport * from \"./useNavigationItems.ts\";\nexport * from \"./useProtectedDataHandler.ts\";\nexport * from \"./useProtectedDataQueries.ts\";\nexport * from \"./usePublicDataHandler.ts\";\nexport * from \"./usePublicDataQueries.ts\";\nexport * from \"./useRegisterDeferredRegistrations.ts\";\nexport * from \"./useStrictRegistrationMode.ts\";\nexport * from \"./useUpdateDeferredRegistrations.ts\";\n\nexport * from \"./initializeFirefly.ts\";\n\n"],"names":["EnvironmentVariablesPlugin","EnvironmentVariablesPluginName","getEnvironmentVariablesPlugin","useEnvironmentVariable","useEnvironmentVariables","createLocalStorageLaunchDarklyClient","FeatureFlagSetSnapshot","getFeatureFlag","getLaunchDarklyPlugin","InMemoryLaunchDarklyClient","isEditableLaunchDarklyClient","LaunchDarklyClientNotifier","LaunchDarklyClientTransaction","LaunchDarklyPlugin","LaunchDarklyPluginName","LocalStorageLaunchDarklyClient","useFeatureFlag","useFeatureFlags","useLaunchDarklyClient","getMswPlugin","MswPlugin","MswPluginName","MswState","ActiveRouteIsProtectedEvent","ActiveRouteIsPublicEvent","ApplicationBoostrappedEvent","DeferredRegistrationsUpdatedEvent","ModulesReadyEvent","ModulesRegisteredEvent","MswReadyEvent","ProtectedDataReadyEvent","ProtectedDataUpdatedEvent","PublicDataReadyEvent","PublicDataUpdatedEvent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAA6B;AAUH;AA0BK;AAUV;AACgB;AAGC;AACD;AAEL;AAaD;AAEK;AACQ;AACE;AACH;AACc;AACF;AACT;AACC;AACP;AACA;AACK;AACA;AACH;AACA;AACY;AACP;AACK;AAEb"}
|
|
@@ -4,6 +4,11 @@ import type { HoneycombInstrumentationPartialClient } from "@workleap-telemetry/
|
|
|
4
4
|
import { LDClient } from "launchdarkly-js-client-sdk";
|
|
5
5
|
import { FireflyRuntime, type FireflyRuntimeOptions } from "./FireflyRuntime.tsx";
|
|
6
6
|
export declare const ApplicationBootstrappingStartedEvent = "squide-app-bootstrapping-started";
|
|
7
|
+
declare module "@squide/core" {
|
|
8
|
+
interface EventMap {
|
|
9
|
+
"squide-app-bootstrapping-started": void;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
7
12
|
export type OnInitializationErrorFunction = (error: unknown) => void;
|
|
8
13
|
export type StartMswFunction<TRuntime = FireflyRuntime> = (runtime: TRuntime) => Promise<void>;
|
|
9
14
|
export interface InitializeFireflyOptions<TRuntime extends FireflyRuntime, TContext = unknown, TData = unknown> extends RegisterModulesOptions<TContext>, FireflyRuntimeOptions {
|
|
@@ -6,21 +6,13 @@ import { MswPlugin } from "@squide/msw";
|
|
|
6
6
|
import { FireflyRuntime } from "./FireflyRuntime.js";
|
|
7
7
|
import { initializeHoneycomb } from "./honeycomb/initializeHoneycomb.js";
|
|
8
8
|
|
|
9
|
-
;// CONCATENATED MODULE: external "@squide/core"
|
|
10
9
|
|
|
11
|
-
;// CONCATENATED MODULE: external "@squide/core/internal"
|
|
12
10
|
|
|
13
|
-
;// CONCATENATED MODULE: external "@squide/env-vars"
|
|
14
11
|
|
|
15
|
-
;// CONCATENATED MODULE: external "@squide/launch-darkly"
|
|
16
12
|
|
|
17
|
-
;// CONCATENATED MODULE: external "@squide/msw"
|
|
18
13
|
|
|
19
|
-
;// CONCATENATED MODULE: external "./FireflyRuntime.js"
|
|
20
14
|
|
|
21
|
-
;// CONCATENATED MODULE: external "./honeycomb/initializeHoneycomb.js"
|
|
22
15
|
|
|
23
|
-
;// CONCATENATED MODULE: ./src/initializeFirefly.ts
|
|
24
16
|
|
|
25
17
|
|
|
26
18
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initializeFirefly.js","sources":["../src/initializeFirefly.ts"],"sourcesContent":["import { ModuleDefinition, PluginFactory, toLocalModuleDefinitions, type ModuleRegisterFunction, type RegisterModulesOptions } from \"@squide/core\";\nimport { isFunction } from \"@squide/core/internal\";\nimport { EnvironmentVariables, EnvironmentVariablesPlugin } from \"@squide/env-vars\";\nimport { LaunchDarklyPlugin } from \"@squide/launch-darkly\";\nimport { MswPlugin } from \"@squide/msw\";\nimport type { HoneycombInstrumentationPartialClient } from \"@workleap-telemetry/core\";\nimport { RootLogger } from \"@workleap/logging\";\nimport { LDClient } from \"launchdarkly-js-client-sdk\";\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> | undefined)[];\n moduleDefinitions?: ModuleDefinition<TRuntime, TContext, TData>[];\n useMsw?: boolean;\n environmentVariables?: Partial<EnvironmentVariables>;\n honeycombInstrumentationClient?: HoneycombInstrumentationPartialClient;\n launchDarklyClient?: LDClient;\n startMsw?: StartMswFunction<FireflyRuntime>;\n onError?: OnInitializationErrorFunction;\n}\n\nexport function bootstrap<TRuntime extends FireflyRuntime = FireflyRuntime, TContext = unknown, TData = unknown>(\n runtime: TRuntime,\n modulesDefinitions: (ModuleDefinition<TRuntime, TContext, TData> | undefined)[],\n options: Omit<InitializeFireflyOptions<TRuntime, TContext, TData>, \"localModules\" | \"moduleDefinitions\"> = {}\n) {\n const {\n startMsw,\n onError,\n context\n } = options;\n\n runtime.eventBus.dispatch(ApplicationBootstrappingStartedEvent);\n\n runtime.moduleManager.registerModules(\n modulesDefinitions.filter((x): x is ModuleDefinition => Boolean(x)),\n { context }\n ).then(results => {\n if (runtime.isMswEnabled) {\n if (!isFunction(startMsw)) {\n throw new Error(\"[squide] When MSW is enabled, the \\\"startMsw\\\" function must be provided.\");\n }\n\n startMsw(runtime)\n .then(() => {\n if (runtime.isMswEnabled) {\n runtime.mswState.setAsReady();\n }\n })\n .catch((error: unknown) => {\n runtime.logger\n .withText(\"[squide] An error occured while starting MSW.\")\n .withError(error as Error)\n .error();\n });\n }\n\n if (onError) {\n results.forEach(error => {\n onError(error);\n });\n }\n });\n}\n\nfunction logInitializationState<TContext = unknown, TData = unknown>(\n runtime: FireflyRuntime,\n options: InitializeFireflyOptions<FireflyRuntime, TContext, TData>,\n plugins: PluginFactory<FireflyRuntime>[]\n) {\n const {\n mode,\n localModules,\n moduleDefinitions,\n useMsw,\n environmentVariables,\n honeycombInstrumentationClient,\n launchDarklyClient\n } = options;\n const scope = (runtime.logger as RootLogger).startScope(\"[squide] Initializing the application.\");\n\n try {\n scope.information(`[squide] Mode: ${mode ?? \"development\"}`);\n\n if (localModules) {\n scope\n .withText(\"[squide] Local modules:\")\n .withObject(localModules)\n .information();\n }\n\n if (moduleDefinitions) {\n scope\n .withText(\"[squide] Module definitions:\")\n .withObject(moduleDefinitions)\n .information();\n }\n\n scope.information(`[squide] Use MSW: ${useMsw ? \"Yes\" : \"No\"}`);\n\n if (environmentVariables && Object.keys(environmentVariables).length > 0) {\n scope\n .withText(\"[squide] Environment variables:\")\n .withObject(environmentVariables)\n .information();\n }\n\n if (honeycombInstrumentationClient) {\n scope\n .withText(\"[squide] Honeycomb instrumentation client:\")\n .withObject(honeycombInstrumentationClient)\n .information();\n }\n\n if (launchDarklyClient) {\n scope\n .withText(\"[squide] LaunchDarkly client:\")\n .withObject(launchDarklyClient)\n .information();\n }\n\n if (plugins.length > 0) {\n scope\n .withText(\"[squide] Plugins:\")\n .withObject(plugins)\n .information();\n }\n } finally {\n scope.end();\n }\n}\n\nlet hasExecuted = false;\n\n// Should only be used by tests.\nexport function __resetHasExecutedGuard() {\n hasExecuted = false;\n}\n\nexport function initializeFirefly<TContext = unknown, TData = unknown>(options: InitializeFireflyOptions<FireflyRuntime, TContext, TData> = {}) {\n const {\n mode,\n localModules = [],\n moduleDefinitions = [],\n useMsw,\n environmentVariables,\n honeycombInstrumentationClient,\n launchDarklyClient,\n plugins = [],\n loggers,\n onError\n } = options;\n\n if (hasExecuted) {\n throw new Error(\"[squide] A squide application can only be initialized once. Did you call the \\\"initializeSquide\\\" function twice?\");\n }\n\n hasExecuted = true;\n\n if (useMsw) {\n plugins.push(x => new MswPlugin(x));\n }\n\n if (launchDarklyClient) {\n plugins.push(x => new LaunchDarklyPlugin(x, launchDarklyClient));\n }\n\n const runtime = new FireflyRuntime({\n mode,\n honeycombInstrumentationClient,\n loggers,\n plugins: [\n x => new EnvironmentVariablesPlugin(x, {\n variables: environmentVariables\n }),\n ...plugins\n ]\n });\n\n logInitializationState(runtime, options, plugins);\n\n initializeHoneycomb(runtime)\n .catch((error: unknown) => {\n if (onError) {\n onError(error);\n }\n })\n .finally(() => {\n bootstrap(\n runtime,\n [...moduleDefinitions, ...toLocalModuleDefinitions(localModules)],\n options\n );\n });\n\n return runtime;\n}\n"],"names":["toLocalModuleDefinitions","isFunction","EnvironmentVariablesPlugin","LaunchDarklyPlugin","MswPlugin","FireflyRuntime","initializeHoneycomb","ApplicationBootstrappingStartedEvent","bootstrap","runtime","modulesDefinitions","options","startMsw","onError","context","x","Boolean","results","Error","error","logInitializationState","plugins","mode","localModules","moduleDefinitions","useMsw","environmentVariables","honeycombInstrumentationClient","launchDarklyClient","scope","Object","hasExecuted","__resetHasExecutedGuard","initializeFirefly","loggers"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAmJ;AAChG;AACiC;AACzB;AACnB;AAI0C;AACT;AAElE,MAAMO,uCAAuC,mCAAmC;AAiBhF,SAASC,UACZC,OAAiB,EACjBC,kBAA+E,EAC/EC,UAA2G,CAAC,CAAC;IAE7G,MAAM,EACFC,QAAQ,EACRC,OAAO,EACPC,OAAO,EACV,GAAGH;IAEJF,QAAQ,QAAQ,CAAC,QAAQ,CAACF;IAE1BE,QAAQ,aAAa,CAAC,eAAe,CACjCC,mBAAmB,MAAM,CAAC,CAACK,IAA6BC,QAAQD,KAChE;QAAED;IAAQ,GACZ,IAAI,CAACG,CAAAA;QACH,IAAIR,QAAQ,YAAY,EAAE;YACtB,IAAI,CAACR,UAAUA,CAACW,WAAW;gBACvB,MAAM,IAAIM,MAAM;YACpB;YAEAN,SAASH,SACJ,IAAI,CAAC;gBACF,IAAIA,QAAQ,YAAY,EAAE;oBACtBA,QAAQ,QAAQ,CAAC,UAAU;gBAC/B;YACJ,GACC,KAAK,CAAC,CAACU;gBACJV,QAAQ,M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AC1I,MAAM,EACFW,IAAI,EACJC,eAAe,EAAE,EACjBC,oBAAoB,EAAE,EACtBC,MAAM,EACNC,oBAAoB,EACpBC,8BAA8B,EAC9BC,kBAAkB,EAClBP,UAAU,EAAE,EACZa,OAAO,EACPrB,OAAO,EACV,GAAGF;IAEJ,IAAIoB,aAAa;QACb,MAAM,IAAIb,MAAM;IACpB;IAEAa,cAAc;IAEd,IAAIN,QAAQ;QACRJ,QAAQ,IAAI,CAACN,CAAAA,IAAK,IAAIX,SAASA,CAACW;IACpC;IAEA,IAAIa,oBAAoB;QACpBP,QAAQ,IAAI,CAACN,CAAAA,IAAK,IAAIZ,kBAAkBA,CAACY,GAAGa;IAChD;IAEA,MAAMnB,UAAU,IAAIJ,cAAcA,CAAC;QAC/BiB;QACAK;QACAO;QACA,SAAS;YACLnB,CAAAA,IAAK,IAAIb,0BAA0BA,CAACa,GAAG;oBACnC,WAAWW;gBACf;eACGL;SACN;IACL;IAEAD,uBAAuBX,SAASE,SAASU;IAEzCf,mBAAmBA,CAACG,SACf,KAAK,CAAC,CAACU;QACJ,IAAIN,SAAS;YACTA,QAAQM;QACZ;IACJ,GACC,OAAO,CAAC;QACLX,UACIC,SACA;eAAIe;eAAsBxB,wBAAwBA,CAACuB;SAAc,EACjEZ;IAER;IAEJ,OAAOF;AACX"}
|
|
1
|
+
{"version":3,"file":"initializeFirefly.js","sources":["../src/initializeFirefly.ts"],"sourcesContent":["import { ModuleDefinition, PluginFactory, toLocalModuleDefinitions, type ModuleRegisterFunction, type RegisterModulesOptions } from \"@squide/core\";\nimport { isFunction } from \"@squide/core/internal\";\nimport { EnvironmentVariables, EnvironmentVariablesPlugin } from \"@squide/env-vars\";\nimport { LaunchDarklyPlugin } from \"@squide/launch-darkly\";\nimport { MswPlugin } from \"@squide/msw\";\nimport type { HoneycombInstrumentationPartialClient } from \"@workleap-telemetry/core\";\nimport { RootLogger } from \"@workleap/logging\";\nimport { LDClient } from \"launchdarkly-js-client-sdk\";\nimport { FireflyRuntime, type FireflyRuntimeOptions } from \"./FireflyRuntime.tsx\";\nimport { initializeHoneycomb } from \"./honeycomb/initializeHoneycomb.ts\";\n\nexport const ApplicationBootstrappingStartedEvent = \"squide-app-bootstrapping-started\";\n\ndeclare module \"@squide/core\" {\n interface EventMap {\n \"squide-app-bootstrapping-started\": void;\n }\n}\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> | undefined)[];\n moduleDefinitions?: ModuleDefinition<TRuntime, TContext, TData>[];\n useMsw?: boolean;\n environmentVariables?: Partial<EnvironmentVariables>;\n honeycombInstrumentationClient?: HoneycombInstrumentationPartialClient;\n launchDarklyClient?: LDClient;\n startMsw?: StartMswFunction<FireflyRuntime>;\n onError?: OnInitializationErrorFunction;\n}\n\nexport function bootstrap<TRuntime extends FireflyRuntime = FireflyRuntime, TContext = unknown, TData = unknown>(\n runtime: TRuntime,\n modulesDefinitions: (ModuleDefinition<TRuntime, TContext, TData> | undefined)[],\n options: Omit<InitializeFireflyOptions<TRuntime, TContext, TData>, \"localModules\" | \"moduleDefinitions\"> = {}\n) {\n const {\n startMsw,\n onError,\n context\n } = options;\n\n runtime.eventBus.dispatch(ApplicationBootstrappingStartedEvent);\n\n runtime.moduleManager.registerModules(\n modulesDefinitions.filter((x): x is ModuleDefinition => Boolean(x)),\n { context }\n ).then(results => {\n if (runtime.isMswEnabled) {\n if (!isFunction(startMsw)) {\n throw new Error(\"[squide] When MSW is enabled, the \\\"startMsw\\\" function must be provided.\");\n }\n\n startMsw(runtime)\n .then(() => {\n if (runtime.isMswEnabled) {\n runtime.mswState.setAsReady();\n }\n })\n .catch((error: unknown) => {\n runtime.logger\n .withText(\"[squide] An error occured while starting MSW.\")\n .withError(error as Error)\n .error();\n });\n }\n\n if (onError) {\n results.forEach(error => {\n onError(error);\n });\n }\n });\n}\n\nfunction logInitializationState<TContext = unknown, TData = unknown>(\n runtime: FireflyRuntime,\n options: InitializeFireflyOptions<FireflyRuntime, TContext, TData>,\n plugins: PluginFactory<FireflyRuntime>[]\n) {\n const {\n mode,\n localModules,\n moduleDefinitions,\n useMsw,\n environmentVariables,\n honeycombInstrumentationClient,\n launchDarklyClient\n } = options;\n const scope = (runtime.logger as RootLogger).startScope(\"[squide] Initializing the application.\");\n\n try {\n scope.information(`[squide] Mode: ${mode ?? \"development\"}`);\n\n if (localModules) {\n scope\n .withText(\"[squide] Local modules:\")\n .withObject(localModules)\n .information();\n }\n\n if (moduleDefinitions) {\n scope\n .withText(\"[squide] Module definitions:\")\n .withObject(moduleDefinitions)\n .information();\n }\n\n scope.information(`[squide] Use MSW: ${useMsw ? \"Yes\" : \"No\"}`);\n\n if (environmentVariables && Object.keys(environmentVariables).length > 0) {\n scope\n .withText(\"[squide] Environment variables:\")\n .withObject(environmentVariables)\n .information();\n }\n\n if (honeycombInstrumentationClient) {\n scope\n .withText(\"[squide] Honeycomb instrumentation client:\")\n .withObject(honeycombInstrumentationClient)\n .information();\n }\n\n if (launchDarklyClient) {\n scope\n .withText(\"[squide] LaunchDarkly client:\")\n .withObject(launchDarklyClient)\n .information();\n }\n\n if (plugins.length > 0) {\n scope\n .withText(\"[squide] Plugins:\")\n .withObject(plugins)\n .information();\n }\n } finally {\n scope.end();\n }\n}\n\nlet hasExecuted = false;\n\n// Should only be used by tests.\nexport function __resetHasExecutedGuard() {\n hasExecuted = false;\n}\n\nexport function initializeFirefly<TContext = unknown, TData = unknown>(options: InitializeFireflyOptions<FireflyRuntime, TContext, TData> = {}) {\n const {\n mode,\n localModules = [],\n moduleDefinitions = [],\n useMsw,\n environmentVariables,\n honeycombInstrumentationClient,\n launchDarklyClient,\n plugins = [],\n loggers,\n onError\n } = options;\n\n if (hasExecuted) {\n throw new Error(\"[squide] A squide application can only be initialized once. Did you call the \\\"initializeSquide\\\" function twice?\");\n }\n\n hasExecuted = true;\n\n if (useMsw) {\n plugins.push(x => new MswPlugin(x));\n }\n\n if (launchDarklyClient) {\n plugins.push(x => new LaunchDarklyPlugin(x, launchDarklyClient));\n }\n\n const runtime = new FireflyRuntime({\n mode,\n honeycombInstrumentationClient,\n loggers,\n plugins: [\n x => new EnvironmentVariablesPlugin(x, {\n variables: environmentVariables\n }),\n ...plugins\n ]\n });\n\n logInitializationState(runtime, options, plugins);\n\n initializeHoneycomb(runtime)\n .catch((error: unknown) => {\n if (onError) {\n onError(error);\n }\n })\n .finally(() => {\n bootstrap(\n runtime,\n [...moduleDefinitions, ...toLocalModuleDefinitions(localModules)],\n options\n );\n });\n\n return runtime;\n}\n"],"names":["toLocalModuleDefinitions","isFunction","EnvironmentVariablesPlugin","LaunchDarklyPlugin","MswPlugin","FireflyRuntime","initializeHoneycomb","ApplicationBootstrappingStartedEvent","bootstrap","runtime","modulesDefinitions","options","startMsw","onError","context","x","Boolean","results","Error","error","logInitializationState","plugins","mode","localModules","moduleDefinitions","useMsw","environmentVariables","honeycombInstrumentationClient","launchDarklyClient","scope","Object","hasExecuted","__resetHasExecutedGuard","initializeFirefly","loggers"],"mappings":";;;;;;;;;;;;;;;AAAmJ;AAChG;AACiC;AACzB;AACnB;AAI0C;AACT;AAElE,MAAMO,oCAAoCA,GAAG,mCAAmC;AAuBhF,SAASC,SAASA,CACrBC,OAAiB,EACjBC,kBAA+E,EAC/EC,UAA2G,CAAC,CAAC;IAE7G,MAAM,EACFC,QAAQ,EACRC,OAAO,EACPC,OAAO,EACV,GAAGH;IAEJF,QAAQ,QAAQ,CAAC,QAAQ,CAACF,oCAAoCA;IAE9DE,QAAQ,aAAa,CAAC,eAAe,CACjCC,mBAAmB,MAAM,CAAC,CAACK,IAA6BC,QAAQD,KAChE;QAAED;IAAQ,GACZ,IAAI,CAACG,CAAAA;QACH,IAAIR,QAA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AEA,IAAIP,QAAQ,MAAM,GAAG,GAAG;YACpBQ,MACK,QAAQ,CAAC,qBACT,UAAU,CAACR,SACX,WAAW;QACpB;IACJ,SAAU;QACNQ,MAAM,GAAG;IACb;AACJ;AAEA,IAAIE,WAAWA,GAAG;AAElB,gCAAgC;AACzB,SAASC,uBAAuBA;IACnCD,WAAWA,GAAG;AAClB;AAEO,SAASE,iBAAiBA,CAAsCtB,UAAqE,CAAC,CAAC;IAC1I,MAAM,EACFW,IAAI,EACJC,eAAe,EAAE,EACjBC,oBAAoB,EAAE,EACtBC,MAAM,EACNC,oBAAoB,EACpBC,8BAA8B,EAC9BC,kBAAkB,EAClBP,UAAU,EAAE,EACZa,OAAO,EACPrB,OAAO,EACV,GAAGF;IAEJ,IAAIoB,WAAWA,EAAE;QACb,MAAM,IAAIb,MAAM;IACpB;IAEAa,WAAWA,GAAG;IAEd,IAAIN,QAAQ;QACRJ,QAAQ,IAAI,CAACN,CAAAA,IAAK,IAAIX,SAASA,CAACW;IACpC;IAEA,IAAIa,oBAAoB;QACpBP,QAAQ,IAAI,CAACN,CAAAA,IAAK,IAAIZ,kBAAkBA,CAACY,GAAGa;IAChD;IAEA,MAAMnB,UAAU,IAAIJ,cAAcA,CAAC;QAC/BiB;QACAK;QACAO;QACA,SAAS;YACLnB,CAAAA,IAAK,IAAIb,0BAA0BA,CAACa,GAAG;oBACnC,WAAWW;gBACf;eACGL;SACN;IACL;IAEAD,sBAAsBA,CAACX,SAASE,SAASU;IAEzCf,mBAAmBA,CAACG,SACf,KAAK,CAAC,CAACU;QACJ,IAAIN,SAAS;YACTA,QAAQM;QACZ;IACJ,GACC,OAAO,CAAC;QACLX,SAASA,CACLC,SACA;eAAIe;eAAsBxB,wBAAwBA,CAACuB;SAAc,EACjEZ;IAER;IAEJ,OAAOF;AACX"}
|
package/dist/internal.js
CHANGED
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
import { AppRouterDispatcherContext, AppRouterStateContext } from "./AppRouterContext.js";
|
|
2
|
-
import { __clearAppReducerDispatchProxy, __setAppReducerDispatchProxyFactory, useAppRouterReducer } from "./AppRouterReducer.js";
|
|
3
|
-
import { addProtectedListener } from "./honeycomb/registerHoneycombInstrumentation.js";
|
|
4
|
-
import { getTracer } from "./honeycomb/tracer.js";
|
|
5
|
-
import { endActiveSpan, startActiveChildSpan, startActiveSpan, startChildSpan, startSpan, traceError } from "./honeycomb/utils.js";
|
|
6
1
|
|
|
7
|
-
;// CONCATENATED MODULE: external "./AppRouterContext.js"
|
|
8
2
|
|
|
9
|
-
;// CONCATENATED MODULE: external "./AppRouterReducer.js"
|
|
10
3
|
|
|
11
|
-
;// CONCATENATED MODULE: external "./honeycomb/registerHoneycombInstrumentation.js"
|
|
12
4
|
|
|
13
|
-
;// CONCATENATED MODULE: external "./honeycomb/tracer.js"
|
|
14
5
|
|
|
15
|
-
;// CONCATENATED MODULE: external "./honeycomb/utils.js"
|
|
16
6
|
|
|
17
|
-
;// CONCATENATED MODULE: ./src/internal.ts
|
|
18
7
|
|
|
19
8
|
|
|
20
9
|
|
|
21
10
|
|
|
22
11
|
|
|
23
|
-
|
|
24
|
-
export {
|
|
12
|
+
export { AppRouterDispatcherContext, AppRouterStateContext } from "./AppRouterContext.js";
|
|
13
|
+
export { __clearAppReducerDispatchProxy, __setAppReducerDispatchProxyFactory, useAppRouterReducer } from "./AppRouterReducer.js";
|
|
14
|
+
export { addProtectedListener } from "./honeycomb/registerHoneycombInstrumentation.js";
|
|
15
|
+
export { getTracer } from "./honeycomb/tracer.js";
|
|
16
|
+
export { endActiveSpan, startActiveChildSpan, startActiveSpan, startChildSpan, startSpan, traceError } from "./honeycomb/utils.js";
|
|
25
17
|
|
|
26
18
|
//# sourceMappingURL=internal.js.map
|
package/dist/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sources":["../src/internal.ts"],"sourcesContent":["export { AppRouterDispatcherContext, AppRouterStateContext } from \"./AppRouterContext.ts\";\nexport { __clearAppReducerDispatchProxy, __setAppReducerDispatchProxyFactory, useAppRouterReducer, type AppRouterDispatch, type AppRouterState } from \"./AppRouterReducer.ts\";\n\nexport type { ActiveSpan, ActiveSpanId } from \"./honeycomb/activeSpan.ts\";\nexport { addProtectedListener, type AddProtectedListenerOptions, type GetSpanFunction, type HoneycombTrackingUnmanagedErrorHandler } from \"./honeycomb/registerHoneycombInstrumentation.ts\";\nexport { getTracer } from \"./honeycomb/tracer.ts\";\nexport {\n endActiveSpan,\n startActiveChildSpan,\n startActiveSpan,\n startChildSpan,\n startSpan,\n traceError,\n type StartActiveChildSpanFactory,\n type StartActiveChildSpanFactoryReturn,\n type StartActiveSpanFactory,\n type StartActiveSpanFactoryReturn,\n type StartChildSpanFactory,\n type StartSpanFactory,\n type TraceErrorOptions\n} from \"./honeycomb/utils.ts\";\n\n"],"names":["AppRouterDispatcherContext","AppRouterStateContext","__clearAppReducerDispatchProxy","__setAppReducerDispatchProxyFactory","useAppRouterReducer","addProtectedListener","getTracer","endActiveSpan","startActiveChildSpan","startActiveSpan","startChildSpan","startSpan","traceError"],"mappings":"
|
|
1
|
+
{"version":3,"file":"internal.js","sources":["../src/internal.ts"],"sourcesContent":["export { AppRouterDispatcherContext, AppRouterStateContext } from \"./AppRouterContext.ts\";\nexport { __clearAppReducerDispatchProxy, __setAppReducerDispatchProxyFactory, useAppRouterReducer, type AppRouterDispatch, type AppRouterState } from \"./AppRouterReducer.ts\";\n\nexport type { ActiveSpan, ActiveSpanId } from \"./honeycomb/activeSpan.ts\";\nexport { addProtectedListener, type AddProtectedListenerOptions, type GetSpanFunction, type HoneycombTrackingUnmanagedErrorHandler } from \"./honeycomb/registerHoneycombInstrumentation.ts\";\nexport { getTracer } from \"./honeycomb/tracer.ts\";\nexport {\n endActiveSpan,\n startActiveChildSpan,\n startActiveSpan,\n startChildSpan,\n startSpan,\n traceError,\n type StartActiveChildSpanFactory,\n type StartActiveChildSpanFactoryReturn,\n type StartActiveSpanFactory,\n type StartActiveSpanFactoryReturn,\n type StartChildSpanFactory,\n type StartSpanFactory,\n type TraceErrorOptions\n} from \"./honeycomb/utils.ts\";\n\n"],"names":["AppRouterDispatcherContext","AppRouterStateContext","__clearAppReducerDispatchProxy","__setAppReducerDispatchProxyFactory","useAppRouterReducer","addProtectedListener","getTracer","endActiveSpan","startActiveChildSpan","startActiveSpan","startChildSpan","startSpan","traceError"],"mappings":";;;;;AAA0F;AACoF;AAGc;AAC1I;AAepB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAppRouterStore.js","sources":["../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":"
|
|
1
|
+
{"version":3,"file":"useAppRouterStore.js","sources":["../src/useAppRouterStore.ts"],"sourcesContent":["import { useRuntime } from \"@squide/core\";\nimport type { FireflyRuntime } from \"./FireflyRuntime.tsx\";\n\nexport function useAppRouterStore() {\n const runtime = useRuntime() as FireflyRuntime;\n\n return runtime.appRouterStore;\n}\n"],"names":["useRuntime","useAppRouterStore","runtime"],"mappings":";;;AAA0C;AAGnC,SAASC,iBAAiBA;IAC7B,MAAMC,UAAUF,UAAUA;IAE1B,OAAOE,QAAQ,cAAc;AACjC"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { useAppRouterState } from "./AppRouterContext.js";
|
|
2
2
|
|
|
3
|
-
;// CONCATENATED MODULE: external "./AppRouterContext.js"
|
|
4
3
|
|
|
5
|
-
;// CONCATENATED MODULE: ./src/useCanFetchProtectedData.ts
|
|
6
4
|
|
|
7
5
|
// This function is exported for external integration, like the integration
|
|
8
6
|
// with the Platform Widgets. Do not remove.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCanFetchProtectedData.js","sources":["../src/useCanFetchProtectedData.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\nimport type { ActiveRouteVisiblity } from \"./AppRouterReducer.ts\";\n\n// This function is exported for external integration, like the integration\n// with the Platform Widgets. Do not remove.\nexport function canFetchProtectedData(\n waitForMsw: boolean,\n areModulesRegistered: boolean,\n areModulesReady: boolean,\n activeRouteVisibility: ActiveRouteVisiblity,\n isMswReady: boolean\n) {\n return (\n // Wait until the modules has been registered, but do not wait for the deferred registrations to be registered as they will probably\n // depends on the protected data.\n (areModulesRegistered || areModulesReady)\n // Only fetch the protected data for protected routes, aka do not fetch the protected data for public routes.\n && activeRouteVisibility === \"protected\"\n // Wait for MSW since the endpoints for the protected data might be an MSW endpoint when in development.\n && (!waitForMsw || isMswReady)\n );\n}\n\nexport function useCanFetchProtectedData() {\n const {\n waitForMsw,\n areModulesRegistered,\n areModulesReady,\n isMswReady,\n isProtectedDataReady,\n activeRouteVisibility\n } = useAppRouterState();\n\n // Always return true when the protected data has already been fetched sucessfully so TanStack Query can update the data in the background.\n return isProtectedDataReady || canFetchProtectedData(\n waitForMsw,\n areModulesRegistered,\n areModulesReady,\n activeRouteVisibility,\n isMswReady\n );\n}\n"],"names":["useAppRouterState","canFetchProtectedData","waitForMsw","areModulesRegistered","areModulesReady","activeRouteVisibility","isMswReady","useCanFetchProtectedData","isProtectedDataReady"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCanFetchProtectedData.js","sources":["../src/useCanFetchProtectedData.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\nimport type { ActiveRouteVisiblity } from \"./AppRouterReducer.ts\";\n\n// This function is exported for external integration, like the integration\n// with the Platform Widgets. Do not remove.\nexport function canFetchProtectedData(\n waitForMsw: boolean,\n areModulesRegistered: boolean,\n areModulesReady: boolean,\n activeRouteVisibility: ActiveRouteVisiblity,\n isMswReady: boolean\n) {\n return (\n // Wait until the modules has been registered, but do not wait for the deferred registrations to be registered as they will probably\n // depends on the protected data.\n (areModulesRegistered || areModulesReady)\n // Only fetch the protected data for protected routes, aka do not fetch the protected data for public routes.\n && activeRouteVisibility === \"protected\"\n // Wait for MSW since the endpoints for the protected data might be an MSW endpoint when in development.\n && (!waitForMsw || isMswReady)\n );\n}\n\nexport function useCanFetchProtectedData() {\n const {\n waitForMsw,\n areModulesRegistered,\n areModulesReady,\n isMswReady,\n isProtectedDataReady,\n activeRouteVisibility\n } = useAppRouterState();\n\n // Always return true when the protected data has already been fetched sucessfully so TanStack Query can update the data in the background.\n return isProtectedDataReady || canFetchProtectedData(\n waitForMsw,\n areModulesRegistered,\n areModulesReady,\n activeRouteVisibility,\n isMswReady\n );\n}\n"],"names":["useAppRouterState","canFetchProtectedData","waitForMsw","areModulesRegistered","areModulesReady","activeRouteVisibility","isMswReady","useCanFetchProtectedData","isProtectedDataReady"],"mappings":";;;AAA0D;AAG1D,2EAA2E;AAC3E,4CAA4C;AACrC,SAASC,qBAAqBA,CACjCC,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,wBAAwBA;IACpC,MAAM,EACFL,UAAU,EACVC,oBAAoB,EACpBC,eAAe,EACfE,UAAU,EACVE,oBAAoB,EACpBH,qBAAqB,EACxB,GAAGL,iBAAiBA;IAErB,2IAA2I;IAC3I,OAAOQ,wBAAwBP,qBAAqBA,CAChDC,YACAC,sBACAC,iBACAC,uBACAC;AAER"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { useAppRouterState } from "./AppRouterContext.js";
|
|
2
2
|
|
|
3
|
-
;// CONCATENATED MODULE: external "./AppRouterContext.js"
|
|
4
3
|
|
|
5
|
-
;// CONCATENATED MODULE: ./src/useCanFetchPublicData.ts
|
|
6
4
|
|
|
7
5
|
function useCanFetchPublicData() {
|
|
8
6
|
const { waitForMsw, areModulesRegistered, areModulesReady, isMswReady, isPublicDataReady } = useAppRouterState();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCanFetchPublicData.js","sources":["../src/useCanFetchPublicData.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\n\nexport function useCanFetchPublicData() {\n const {\n waitForMsw,\n areModulesRegistered,\n areModulesReady,\n isMswReady,\n isPublicDataReady\n } = useAppRouterState();\n\n return (\n // Always return true when the public data has already been fetched sucessfully so TanStack Query can update the data in the background.\n isPublicDataReady\n || (\n // Wait until the modules has been registered, but do not wait for the deferred registrations to be registered has they will probably\n // depends on the protected data.\n (areModulesRegistered || areModulesReady)\n // Wait for MSW since the endpoints for the protected data might be an MSW endpoint when in development.\n && (!waitForMsw || isMswReady)\n )\n );\n}\n"],"names":["useAppRouterState","useCanFetchPublicData","waitForMsw","areModulesRegistered","areModulesReady","isMswReady","isPublicDataReady"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useCanFetchPublicData.js","sources":["../src/useCanFetchPublicData.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\n\nexport function useCanFetchPublicData() {\n const {\n waitForMsw,\n areModulesRegistered,\n areModulesReady,\n isMswReady,\n isPublicDataReady\n } = useAppRouterState();\n\n return (\n // Always return true when the public data has already been fetched sucessfully so TanStack Query can update the data in the background.\n isPublicDataReady\n || (\n // Wait until the modules has been registered, but do not wait for the deferred registrations to be registered has they will probably\n // depends on the protected data.\n (areModulesRegistered || areModulesReady)\n // Wait for MSW since the endpoints for the protected data might be an MSW endpoint when in development.\n && (!waitForMsw || isMswReady)\n )\n );\n}\n"],"names":["useAppRouterState","useCanFetchPublicData","waitForMsw","areModulesRegistered","areModulesReady","isMswReady","isPublicDataReady"],"mappings":";;;AAA0D;AAEnD,SAASC,qBAAqBA;IACjC,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,8 +1,6 @@
|
|
|
1
1
|
import { useAppRouterState } from "./AppRouterContext.js";
|
|
2
2
|
|
|
3
|
-
;// CONCATENATED MODULE: external "./AppRouterContext.js"
|
|
4
3
|
|
|
5
|
-
;// CONCATENATED MODULE: ./src/useCanRegisterDeferredRegistrations.ts
|
|
6
4
|
|
|
7
5
|
function useCanRegisterDeferredRegistrations() {
|
|
8
6
|
const { waitForPublicData, waitForProtectedData, areModulesReady, areModulesRegistered, isPublicDataReady, isProtectedDataReady, activeRouteVisibility, isUnauthorized } = useAppRouterState();
|