@squide/firefly 13.0.1 → 13.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/AppRouter.js +17 -17
- package/dist/AppRouter.js.map +1 -1
- package/dist/AppRouterContext.js +8 -8
- package/dist/AppRouterContext.js.map +1 -1
- package/dist/AppRouterReducer.js +47 -47
- package/dist/AppRouterReducer.js.map +1 -1
- package/dist/FireflyProvider.js +3 -3
- package/dist/FireflyProvider.js.map +1 -1
- package/dist/FireflyRuntime.js +11 -11
- package/dist/FireflyRuntime.js.map +1 -1
- package/dist/RootRoute.js +10 -10
- package/dist/RootRoute.js.map +1 -1
- package/dist/honeycomb/activeSpan.js +6 -6
- package/dist/honeycomb/activeSpan.js.map +1 -1
- package/dist/honeycomb/initializeHoneycomb.js +2 -2
- package/dist/honeycomb/initializeHoneycomb.js.map +1 -1
- package/dist/honeycomb/registerHoneycombInstrumentation.d.ts +1 -1
- package/dist/honeycomb/registerHoneycombInstrumentation.js +103 -73
- package/dist/honeycomb/registerHoneycombInstrumentation.js.map +1 -1
- package/dist/honeycomb/tracer.js +2 -2
- package/dist/honeycomb/tracer.js.map +1 -1
- package/dist/honeycomb/utils.js +12 -12
- package/dist/honeycomb/utils.js.map +1 -1
- package/dist/initializeFirefly.js +11 -11
- package/dist/initializeFirefly.js.map +1 -1
- package/dist/useAppRouterStore.js +2 -2
- package/dist/useAppRouterStore.js.map +1 -1
- package/dist/useCanFetchProtectedData.js +2 -2
- package/dist/useCanFetchProtectedData.js.map +1 -1
- package/dist/useCanFetchPublicData.js +2 -2
- package/dist/useCanFetchPublicData.js.map +1 -1
- package/dist/useCanRegisterDeferredRegistrations.js +2 -2
- package/dist/useCanRegisterDeferredRegistrations.js.map +1 -1
- package/dist/useCanUpdateDeferredRegistrations.js +2 -2
- package/dist/useCanUpdateDeferredRegistrations.js.map +1 -1
- package/dist/useDeferredRegistrations.js +13 -13
- package/dist/useDeferredRegistrations.js.map +1 -1
- package/dist/useExecuteOnce.js +3 -3
- package/dist/useExecuteOnce.js.map +1 -1
- package/dist/useIsActiveRouteProtected.js +5 -5
- package/dist/useIsActiveRouteProtected.js.map +1 -1
- package/dist/useIsBootstrapping.js +2 -2
- package/dist/useIsBootstrapping.js.map +1 -1
- package/dist/useNavigationItems.js +4 -4
- package/dist/useNavigationItems.js.map +1 -1
- package/dist/useProtectedDataHandler.js +4 -4
- package/dist/useProtectedDataHandler.js.map +1 -1
- package/dist/useProtectedDataQueries.js +20 -20
- package/dist/useProtectedDataQueries.js.map +1 -1
- package/dist/usePublicDataHandler.js +4 -4
- package/dist/usePublicDataHandler.js.map +1 -1
- package/dist/usePublicDataQueries.js +19 -19
- package/dist/usePublicDataQueries.js.map +1 -1
- package/dist/useRegisterDeferredRegistrations.js +4 -4
- package/dist/useRegisterDeferredRegistrations.js.map +1 -1
- package/dist/useStrictRegistrationMode.js +12 -12
- package/dist/useStrictRegistrationMode.js.map +1 -1
- package/dist/useUpdateDeferredRegistrations.js +6 -6
- package/dist/useUpdateDeferredRegistrations.js.map +1 -1
- package/package.json +16 -16
- package/src/honeycomb/registerHoneycombInstrumentation.ts +43 -16
|
@@ -40,8 +40,8 @@ import {
|
|
|
40
40
|
import { ApplicationBoostrappedEvent, ModulesReadyEvent, ModulesRegisteredEvent, MswReadyEvent, ProtectedDataReadyEvent, PublicDataReadyEvent } from "../AppRouterReducer.ts";
|
|
41
41
|
import type { FireflyRuntime } from "../FireflyRuntime.tsx";
|
|
42
42
|
import { ApplicationBootstrappingStartedEvent } from "../initializeFirefly.ts";
|
|
43
|
-
import { ProtectedDataFetchStartedEvent } from "../useProtectedDataQueries.ts";
|
|
44
|
-
import { PublicDataFetchStartedEvent } from "../usePublicDataQueries.ts";
|
|
43
|
+
import { ProtectedDataFetchFailedEvent, ProtectedDataFetchStartedEvent } from "../useProtectedDataQueries.ts";
|
|
44
|
+
import { PublicDataFetchFailedEvent, PublicDataFetchStartedEvent } from "../usePublicDataQueries.ts";
|
|
45
45
|
import { type ActiveSpan, createOverrideFetchRequestSpanWithActiveSpanContext, registerActiveSpanStack } from "./activeSpan.ts";
|
|
46
46
|
import { getTracer } from "./tracer.ts";
|
|
47
47
|
import { endActiveSpan, startActiveChildSpan, startChildSpan, startSpan, traceError } from "./utils.ts";
|
|
@@ -49,30 +49,29 @@ import { endActiveSpan, startActiveChildSpan, startChildSpan, startSpan, traceEr
|
|
|
49
49
|
// TIPS:
|
|
50
50
|
// To query those traces in Honeycomb, use the following query filter: "root.name = squide-bootstrapping".
|
|
51
51
|
|
|
52
|
-
type DataFetchState = "none" | "fetching-data" | "public-data-ready" | "protected-data-ready" | "data-ready";
|
|
52
|
+
type DataFetchState = "none" | "fetching-data" | "public-data-ready" | "protected-data-ready" | "data-ready" | "data-fetch-failed";
|
|
53
53
|
|
|
54
54
|
export function reduceDataFetchEvents(
|
|
55
55
|
runtime: FireflyRuntime,
|
|
56
|
-
|
|
56
|
+
onDataFetchStarted: () => void,
|
|
57
57
|
onDataReady: () => void,
|
|
58
58
|
onPublicDataFetchStarted: () => void,
|
|
59
59
|
onPublicDataReady: () => void,
|
|
60
60
|
onProtectedDataFetchStarted: () => void,
|
|
61
|
-
onProtectedDataReady: () => void
|
|
61
|
+
onProtectedDataReady: () => void,
|
|
62
|
+
onDataFetchFailed: (queriesErrors: Error[]) => void
|
|
62
63
|
) {
|
|
63
64
|
let dataFetchState: DataFetchState = "none";
|
|
64
65
|
|
|
65
|
-
// TODO: Validate if this handler should use { once: true }.
|
|
66
66
|
runtime.eventBus.addListener(PublicDataFetchStartedEvent, () => {
|
|
67
67
|
if (dataFetchState === "none") {
|
|
68
68
|
dataFetchState = "fetching-data";
|
|
69
|
-
|
|
69
|
+
onDataFetchStarted();
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
onPublicDataFetchStarted();
|
|
73
|
-
});
|
|
73
|
+
}, { once: true });
|
|
74
74
|
|
|
75
|
-
// TODO: Validate if this handler should use { once: true }.
|
|
76
75
|
runtime.eventBus.addListener(PublicDataReadyEvent, () => {
|
|
77
76
|
onPublicDataReady();
|
|
78
77
|
|
|
@@ -82,19 +81,17 @@ export function reduceDataFetchEvents(
|
|
|
82
81
|
dataFetchState = "data-ready";
|
|
83
82
|
onDataReady();
|
|
84
83
|
}
|
|
85
|
-
});
|
|
84
|
+
}, { once: true });
|
|
86
85
|
|
|
87
|
-
// TODO: Validate if this handler should use { once: true }.
|
|
88
86
|
runtime.eventBus.addListener(ProtectedDataFetchStartedEvent, () => {
|
|
89
87
|
if (dataFetchState === "none") {
|
|
90
88
|
dataFetchState = "fetching-data";
|
|
91
|
-
|
|
89
|
+
onDataFetchStarted();
|
|
92
90
|
}
|
|
93
91
|
|
|
94
92
|
onProtectedDataFetchStarted();
|
|
95
|
-
});
|
|
93
|
+
}, { once: true });
|
|
96
94
|
|
|
97
|
-
// TODO: Validate if this handler should use { once: true }.
|
|
98
95
|
runtime.eventBus.addListener(ProtectedDataReadyEvent, () => {
|
|
99
96
|
onProtectedDataReady();
|
|
100
97
|
|
|
@@ -104,7 +101,18 @@ export function reduceDataFetchEvents(
|
|
|
104
101
|
dataFetchState = "data-ready";
|
|
105
102
|
onDataReady();
|
|
106
103
|
}
|
|
107
|
-
});
|
|
104
|
+
}, { once: true });
|
|
105
|
+
|
|
106
|
+
const handleDataFetchFailed = (payload: unknown) => {
|
|
107
|
+
if (dataFetchState !== "data-fetch-failed") {
|
|
108
|
+
dataFetchState = "data-fetch-failed";
|
|
109
|
+
|
|
110
|
+
onDataFetchFailed(payload as Error[]);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
runtime.eventBus.addListener(PublicDataFetchFailedEvent, handleDataFetchFailed, { once: true });
|
|
115
|
+
runtime.eventBus.addListener(ProtectedDataFetchFailedEvent, handleDataFetchFailed, { once: true });
|
|
108
116
|
}
|
|
109
117
|
|
|
110
118
|
function registerTrackingListeners(runtime: FireflyRuntime) {
|
|
@@ -316,6 +324,24 @@ function registerTrackingListeners(runtime: FireflyRuntime) {
|
|
|
316
324
|
}
|
|
317
325
|
};
|
|
318
326
|
|
|
327
|
+
const handleDataFetchFailed = (queriesErrors: Error[]) => {
|
|
328
|
+
if (dataFetchSpan) {
|
|
329
|
+
queriesErrors.forEach(x => {
|
|
330
|
+
traceError(dataFetchSpan.instance, x);
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
dataFetchSpan.instance.end();
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
if (bootstrappingSpan) {
|
|
337
|
+
queriesErrors.forEach(x => {
|
|
338
|
+
traceError(bootstrappingSpan, x);
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
bootstrappingSpan.end();
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
|
|
319
345
|
reduceDataFetchEvents(
|
|
320
346
|
runtime,
|
|
321
347
|
handleFetchDataStarted,
|
|
@@ -323,7 +349,8 @@ function registerTrackingListeners(runtime: FireflyRuntime) {
|
|
|
323
349
|
handlePublicDataFetchStarted,
|
|
324
350
|
handlePublicDataReady,
|
|
325
351
|
handleProtectedDataFetchStarted,
|
|
326
|
-
handleProtectedDataReady
|
|
352
|
+
handleProtectedDataReady,
|
|
353
|
+
handleDataFetchFailed
|
|
327
354
|
);
|
|
328
355
|
|
|
329
356
|
runtime.eventBus.addListener(ModulesRegisteredEvent, () => {
|