@squide/firefly 16.2.1 → 16.2.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 +13 -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.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.js +0 -10
- 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.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.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.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.js +0 -4
- package/dist/useUpdateDeferredRegistrations.js.map +1 -1
- package/package.json +24 -23
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsBootstrapping.js","sources":["../src/useIsBootstrapping.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\nimport type { AppRouterState } from \"./AppRouterReducer.ts\";\n\nexport function useIsBootstrapping() {\n const state = useAppRouterState();\n\n return isBootstrapping(state);\n}\n\nexport function isBootstrapping(state: AppRouterState) {\n const {\n waitForMsw,\n waitForPublicData,\n waitForProtectedData,\n areModulesReady,\n isMswReady,\n isPublicDataReady,\n isProtectedDataReady,\n activeRouteVisibility,\n isUnauthorized\n } = state;\n\n const isAppReady = (\n !isUnauthorized\n // Wait until the modules has been registered and the deferred registrations has been registered if any.\n && areModulesReady\n // Not required but can sometimes prevent a re-render when the state value is somehow updated after the initial data is ready.\n && (!waitForMsw || isMswReady)\n // Wait for the initial data to be ready.\n && (!waitForPublicData || isPublicDataReady)\n && (!waitForProtectedData || activeRouteVisibility === \"public\" || isProtectedDataReady)\n );\n\n // When an API request returns a 401, the bootstrapping should be bypassed to render the login page.\n const flush = (\n // Only applicable when there's a unauthorized request while fetching the initial data.\n isUnauthorized\n // Not required but can sometimes prevent a re-render when the state value is somehow updated after the public data is ready.\n && (!waitForMsw || isMswReady)\n // If the application is loading public data, we want to wait for this data to be ready to prevent a re-render.\n && (!waitForPublicData || isPublicDataReady)\n );\n\n return !isAppReady && !flush;\n}\n"],"names":["useAppRouterState","useIsBootstrapping","state","isBootstrapping","waitForMsw","waitForPublicData","waitForProtectedData","areModulesReady","isMswReady","isPublicDataReady","isProtectedDataReady","activeRouteVisibility","isUnauthorized","isAppReady","flush"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useIsBootstrapping.js","sources":["../src/useIsBootstrapping.ts"],"sourcesContent":["import { useAppRouterState } from \"./AppRouterContext.ts\";\nimport type { AppRouterState } from \"./AppRouterReducer.ts\";\n\nexport function useIsBootstrapping() {\n const state = useAppRouterState();\n\n return isBootstrapping(state);\n}\n\nexport function isBootstrapping(state: AppRouterState) {\n const {\n waitForMsw,\n waitForPublicData,\n waitForProtectedData,\n areModulesReady,\n isMswReady,\n isPublicDataReady,\n isProtectedDataReady,\n activeRouteVisibility,\n isUnauthorized\n } = state;\n\n const isAppReady = (\n !isUnauthorized\n // Wait until the modules has been registered and the deferred registrations has been registered if any.\n && areModulesReady\n // Not required but can sometimes prevent a re-render when the state value is somehow updated after the initial data is ready.\n && (!waitForMsw || isMswReady)\n // Wait for the initial data to be ready.\n && (!waitForPublicData || isPublicDataReady)\n && (!waitForProtectedData || activeRouteVisibility === \"public\" || isProtectedDataReady)\n );\n\n // When an API request returns a 401, the bootstrapping should be bypassed to render the login page.\n const flush = (\n // Only applicable when there's a unauthorized request while fetching the initial data.\n isUnauthorized\n // Not required but can sometimes prevent a re-render when the state value is somehow updated after the public data is ready.\n && (!waitForMsw || isMswReady)\n // If the application is loading public data, we want to wait for this data to be ready to prevent a re-render.\n && (!waitForPublicData || isPublicDataReady)\n );\n\n return !isAppReady && !flush;\n}\n"],"names":["useAppRouterState","useIsBootstrapping","state","isBootstrapping","waitForMsw","waitForPublicData","waitForProtectedData","areModulesReady","isMswReady","isPublicDataReady","isProtectedDataReady","activeRouteVisibility","isUnauthorized","isAppReady","flush"],"mappings":";;;AAA0D;AAGnD,SAASC,kBAAkBA;IAC9B,MAAMC,QAAQF,iBAAiBA;IAE/B,OAAOG,eAAeA,CAACD;AAC3B;AAEO,SAASC,eAAeA,CAACD,KAAqB;IACjD,MAAM,EACFE,UAAU,EACVC,iBAAiB,EACjBC,oBAAoB,EACpBC,eAAe,EACfC,UAAU,EACVC,iBAAiB,EACjBC,oBAAoB,EACpBC,qBAAqB,EACrBC,cAAc,EACjB,GAAGV;IAEJ,MAAMW,aACF,CAACD,kBAEEL,mBAEC,EAACH,cAAcI,UAAS,KAExB,EAACH,qBAAqBI,iBAAgB,KACtC,EAACH,wBAAwBK,0BAA0B,YAAYD,oBAAmB;IAG1F,oGAAoG;IACpG,MAAMI,QACF,uFAAuF;IACvFF,kBAEI,EAACR,cAAcI,UAAS,KAExB,EAACH,qBAAqBI,iBAAgB;IAG9C,OAAO,CAACI,cAAc,CAACC;AAC3B"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { useRuntimeNavigationItems } from "@squide/react-router";
|
|
2
2
|
import { useAppRouterState } from "./AppRouterContext.js";
|
|
3
3
|
|
|
4
|
-
;// CONCATENATED MODULE: external "@squide/react-router"
|
|
5
4
|
|
|
6
|
-
;// CONCATENATED MODULE: external "./AppRouterContext.js"
|
|
7
5
|
|
|
8
|
-
;// CONCATENATED MODULE: ./src/useNavigationItems.ts
|
|
9
6
|
|
|
10
7
|
|
|
11
8
|
function useNavigationItems(options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNavigationItems.js","sources":["../src/useNavigationItems.ts"],"sourcesContent":["import { useRuntimeNavigationItems, type UseRuntimeNavigationItemsOptions } from \"@squide/react-router\";\nimport { useAppRouterState } from \"./AppRouterContext.ts\";\n\nexport type UseNavigationItemsOptions = UseRuntimeNavigationItemsOptions;\n\nexport function useNavigationItems(options?: UseNavigationItemsOptions) {\n // This is not the most sophisticated strategy but it seems to be good enough for now.\n // The idea is that when deferred registrations are used by the consumer applications, the deferred registrations could\n // be updated when the global data is updated. If the deferred registrations are updated, it means that the registered\n // navigation items might have been updated and a re-render must happens to display the new navigation items.\n // Since the \"deferredRegistrationsUpdatedAt\" state value of the AppRouterReducer is updated everytime the deferred registrations\n // are updated, subscribing to the state with useAppRouterState ensure that the navigation items will be re-rendered.\n // A more sophisticated strategy could be implemented later on if needed, something involving a subscription to the \"runtime\" changes, or\n // even introducing new module states.\n useAppRouterState();\n\n return useRuntimeNavigationItems(options);\n}\n"],"names":["useRuntimeNavigationItems","useAppRouterState","useNavigationItems","options"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useNavigationItems.js","sources":["../src/useNavigationItems.ts"],"sourcesContent":["import { useRuntimeNavigationItems, type UseRuntimeNavigationItemsOptions } from \"@squide/react-router\";\nimport { useAppRouterState } from \"./AppRouterContext.ts\";\n\nexport type UseNavigationItemsOptions = UseRuntimeNavigationItemsOptions;\n\nexport function useNavigationItems(options?: UseNavigationItemsOptions) {\n // This is not the most sophisticated strategy but it seems to be good enough for now.\n // The idea is that when deferred registrations are used by the consumer applications, the deferred registrations could\n // be updated when the global data is updated. If the deferred registrations are updated, it means that the registered\n // navigation items might have been updated and a re-render must happens to display the new navigation items.\n // Since the \"deferredRegistrationsUpdatedAt\" state value of the AppRouterReducer is updated everytime the deferred registrations\n // are updated, subscribing to the state with useAppRouterState ensure that the navigation items will be re-rendered.\n // A more sophisticated strategy could be implemented later on if needed, something involving a subscription to the \"runtime\" changes, or\n // even introducing new module states.\n useAppRouterState();\n\n return useRuntimeNavigationItems(options);\n}\n"],"names":["useRuntimeNavigationItems","useAppRouterState","useNavigationItems","options"],"mappings":";;;;;AAAwG;AAC9C;AAInD,SAASE,kBAAkBA,CAACC,OAAmC;IAClE,sFAAsF;IACtF,uHAAuH;IACvH,sHAAsH;IACtH,6GAA6G;IAC7G,iIAAiI;IACjI,qHAAqH;IACrH,yIAAyI;IACzI,sCAAsC;IACtCF,iBAAiBA;IAEjB,OAAOD,yBAAyBA,CAACG;AACrC"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { useEffect } from "react";
|
|
2
2
|
import { useCanFetchProtectedData } from "./useCanFetchProtectedData.js";
|
|
3
3
|
|
|
4
|
-
;// CONCATENATED MODULE: external "react"
|
|
5
4
|
|
|
6
|
-
;// CONCATENATED MODULE: external "./useCanFetchProtectedData.js"
|
|
7
5
|
|
|
8
|
-
;// CONCATENATED MODULE: ./src/useProtectedDataHandler.ts
|
|
9
6
|
|
|
10
7
|
|
|
11
8
|
function useProtectedDataHandler(handler) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProtectedDataHandler.js","sources":["../src/useProtectedDataHandler.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useCanFetchProtectedData } from \"./useCanFetchProtectedData.ts\";\n\nexport function useProtectedDataHandler(handler: () => void) {\n const canFetchProtectedData = useCanFetchProtectedData();\n\n useEffect(() => {\n if (canFetchProtectedData) {\n handler();\n }\n }, [canFetchProtectedData, handler]);\n}\n"],"names":["useEffect","useCanFetchProtectedData","useProtectedDataHandler","handler","canFetchProtectedData"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useProtectedDataHandler.js","sources":["../src/useProtectedDataHandler.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useCanFetchProtectedData } from \"./useCanFetchProtectedData.ts\";\n\nexport function useProtectedDataHandler(handler: () => void) {\n const canFetchProtectedData = useCanFetchProtectedData();\n\n useEffect(() => {\n if (canFetchProtectedData) {\n handler();\n }\n }, [canFetchProtectedData, handler]);\n}\n"],"names":["useEffect","useCanFetchProtectedData","useProtectedDataHandler","handler","canFetchProtectedData"],"mappings":";;;;;AAAkC;AACuC;AAElE,SAASE,uBAAuBA,CAACC,OAAmB;IACvD,MAAMC,wBAAwBH,wBAAwBA;IAEtDD,SAASA,CAAC;QACN,IAAII,uBAAuB;YACvBD;QACJ;IACJ,GAAG;QAACC;QAAuBD;KAAQ;AACvC"}
|
|
@@ -6,21 +6,13 @@ import { GlobalDataQueriesError } from "./GlobalDataQueriesError.js";
|
|
|
6
6
|
import { useCanFetchProtectedData } from "./useCanFetchProtectedData.js";
|
|
7
7
|
import { useExecuteOnce } from "./useExecuteOnce.js";
|
|
8
8
|
|
|
9
|
-
;// CONCATENATED MODULE: external "@squide/core"
|
|
10
9
|
|
|
11
|
-
;// CONCATENATED MODULE: external "@tanstack/react-query"
|
|
12
10
|
|
|
13
|
-
;// CONCATENATED MODULE: external "react"
|
|
14
11
|
|
|
15
|
-
;// CONCATENATED MODULE: external "./AppRouterContext.js"
|
|
16
12
|
|
|
17
|
-
;// CONCATENATED MODULE: external "./GlobalDataQueriesError.js"
|
|
18
13
|
|
|
19
|
-
;// CONCATENATED MODULE: external "./useCanFetchProtectedData.js"
|
|
20
14
|
|
|
21
|
-
;// CONCATENATED MODULE: external "./useExecuteOnce.js"
|
|
22
15
|
|
|
23
|
-
;// CONCATENATED MODULE: ./src/useProtectedDataQueries.ts
|
|
24
16
|
|
|
25
17
|
|
|
26
18
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProtectedDataQueries.js","sources":["../src/useProtectedDataQueries.ts"],"sourcesContent":["import { useEventBus } from \"@squide/core\";\nimport { useQueries, type QueriesOptions, type QueriesResults, type UseQueryResult } from \"@tanstack/react-query\";\nimport { useCallback, useEffect, useRef } from \"react\";\nimport { useAppRouterDispatcher, useAppRouterState } from \"./AppRouterContext.ts\";\nimport { GlobalDataQueriesError } from \"./GlobalDataQueriesError.ts\";\nimport { useCanFetchProtectedData } from \"./useCanFetchProtectedData.ts\";\nimport { useExecuteOnce } from \"./useExecuteOnce.ts\";\n\nexport const ProtectedDataFetchStartedEvent = \"squide-protected-data-fetch-started\";\nexport const ProtectedDataFetchFailedEvent = \"squide-protected-data-fetch-failed\";\n\nexport type IsUnauthorizedErrorCallback = (error: unknown) => boolean;\n\n// This converts an array of UseQueryResult to an array of the data type of each query result.\n// For more information, view: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-1.html#mapped-types-on-tuples-and-arrays.\ntype MapUseQueryResultToData<T> = { [K in keyof T]: T[K] extends UseQueryResult<infer U> ? U : never };\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useProtectedDataQueries<T extends Array<any>>(queries: QueriesOptions<T>, isUnauthorizedError: IsUnauthorizedErrorCallback): MapUseQueryResultToData<QueriesResults<T>> {\n const canFetchProtectedData = useCanFetchProtectedData();\n const eventBus = useEventBus();\n\n const dispatch = useAppRouterDispatcher();\n\n const combineResults = useCallback((results: UseQueryResult<unknown, unknown>[]) => {\n const errors = results.filter(x => x.error).map(x => x.error) as Error[];\n const hasErrors = errors.length > 0;\n\n return {\n data: results.map(x => x.data) as MapUseQueryResultToData<QueriesResults<T>>,\n errors,\n hasErrors,\n isReady: !hasErrors && !results.some(x => x.isPending)\n };\n }, []);\n\n const { data, errors: queriesErrors, hasErrors, isReady } = useQueries({\n queries: queries.map(x => ({\n enabled: canFetchProtectedData,\n ...x\n })),\n combine: combineResults\n });\n\n const { isProtectedDataReady, isUnauthorized } = useAppRouterState();\n\n useExecuteOnce(useCallback(() => {\n if (canFetchProtectedData) {\n eventBus.dispatch(ProtectedDataFetchStartedEvent);\n\n return true;\n }\n\n return false;\n }, [canFetchProtectedData, eventBus]), true);\n\n // Using a ref seems to be the only way to prevent starting two deferred registrations scope.\n const isReadyRef = useRef(false);\n\n const dispatchReady = useExecuteOnce(useCallback(() => {\n if (isReady) {\n isReadyRef.current = true;\n\n dispatch({ type: \"protected-data-ready\" });\n\n return true;\n }\n\n return false;\n }, [isReady, dispatch]));\n\n useEffect(() => {\n // State update must be executed in useEffect.\n dispatchReady();\n }, [dispatchReady]);\n\n useEffect(() => {\n if (isReadyRef.current && data) {\n dispatch({ type: \"protected-data-updated\" });\n }\n }, [data, dispatch]);\n\n useEffect(() => {\n if (hasErrors) {\n if (!isProtectedDataReady && !isUnauthorized && queriesErrors.some(x => isUnauthorizedError(x))) {\n // Will transition the state to allow the routes to render even if the bootstrapping is not complete, because otherwise\n // a login page for example could not be rendered.\n dispatch({ type: \"is-unauthorized\" });\n }\n\n // Otherwise, when a user is logged off, a refetch might throws a 401.\n if (!queriesErrors.every(x => isUnauthorizedError(x))) {\n eventBus.dispatch(ProtectedDataFetchFailedEvent, queriesErrors);\n\n throw new GlobalDataQueriesError(\"[squide] Global protected data queries failed.\", queriesErrors);\n }\n }\n }, [hasErrors, queriesErrors, isProtectedDataReady, isUnauthorized, isUnauthorizedError, dispatch, eventBus]);\n\n return data;\n}\n"],"names":["useEventBus","useQueries","useCallback","useEffect","useRef","useAppRouterDispatcher","useAppRouterState","GlobalDataQueriesError","useCanFetchProtectedData","useExecuteOnce","ProtectedDataFetchStartedEvent","ProtectedDataFetchFailedEvent","useProtectedDataQueries","queries","isUnauthorizedError","canFetchProtectedData","eventBus","dispatch","combineResults","results","errors","x","hasErrors","data","queriesErrors","isReady","isProtectedDataReady","isUnauthorized","isReadyRef","dispatchReady"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useProtectedDataQueries.js","sources":["../src/useProtectedDataQueries.ts"],"sourcesContent":["import { useEventBus } from \"@squide/core\";\nimport { useQueries, type QueriesOptions, type QueriesResults, type UseQueryResult } from \"@tanstack/react-query\";\nimport { useCallback, useEffect, useRef } from \"react\";\nimport { useAppRouterDispatcher, useAppRouterState } from \"./AppRouterContext.ts\";\nimport { GlobalDataQueriesError } from \"./GlobalDataQueriesError.ts\";\nimport { useCanFetchProtectedData } from \"./useCanFetchProtectedData.ts\";\nimport { useExecuteOnce } from \"./useExecuteOnce.ts\";\n\nexport const ProtectedDataFetchStartedEvent = \"squide-protected-data-fetch-started\";\nexport const ProtectedDataFetchFailedEvent = \"squide-protected-data-fetch-failed\";\n\nexport type IsUnauthorizedErrorCallback = (error: unknown) => boolean;\n\n// This converts an array of UseQueryResult to an array of the data type of each query result.\n// For more information, view: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-1.html#mapped-types-on-tuples-and-arrays.\ntype MapUseQueryResultToData<T> = { [K in keyof T]: T[K] extends UseQueryResult<infer U> ? U : never };\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useProtectedDataQueries<T extends Array<any>>(queries: QueriesOptions<T>, isUnauthorizedError: IsUnauthorizedErrorCallback): MapUseQueryResultToData<QueriesResults<T>> {\n const canFetchProtectedData = useCanFetchProtectedData();\n const eventBus = useEventBus();\n\n const dispatch = useAppRouterDispatcher();\n\n const combineResults = useCallback((results: UseQueryResult<unknown, unknown>[]) => {\n const errors = results.filter(x => x.error).map(x => x.error) as Error[];\n const hasErrors = errors.length > 0;\n\n return {\n data: results.map(x => x.data) as MapUseQueryResultToData<QueriesResults<T>>,\n errors,\n hasErrors,\n isReady: !hasErrors && !results.some(x => x.isPending)\n };\n }, []);\n\n const { data, errors: queriesErrors, hasErrors, isReady } = useQueries({\n queries: queries.map(x => ({\n enabled: canFetchProtectedData,\n ...x\n })),\n combine: combineResults\n });\n\n const { isProtectedDataReady, isUnauthorized } = useAppRouterState();\n\n useExecuteOnce(useCallback(() => {\n if (canFetchProtectedData) {\n eventBus.dispatch(ProtectedDataFetchStartedEvent);\n\n return true;\n }\n\n return false;\n }, [canFetchProtectedData, eventBus]), true);\n\n // Using a ref seems to be the only way to prevent starting two deferred registrations scope.\n const isReadyRef = useRef(false);\n\n const dispatchReady = useExecuteOnce(useCallback(() => {\n if (isReady) {\n isReadyRef.current = true;\n\n dispatch({ type: \"protected-data-ready\" });\n\n return true;\n }\n\n return false;\n }, [isReady, dispatch]));\n\n useEffect(() => {\n // State update must be executed in useEffect.\n dispatchReady();\n }, [dispatchReady]);\n\n useEffect(() => {\n if (isReadyRef.current && data) {\n dispatch({ type: \"protected-data-updated\" });\n }\n }, [data, dispatch]);\n\n useEffect(() => {\n if (hasErrors) {\n if (!isProtectedDataReady && !isUnauthorized && queriesErrors.some(x => isUnauthorizedError(x))) {\n // Will transition the state to allow the routes to render even if the bootstrapping is not complete, because otherwise\n // a login page for example could not be rendered.\n dispatch({ type: \"is-unauthorized\" });\n }\n\n // Otherwise, when a user is logged off, a refetch might throws a 401.\n if (!queriesErrors.every(x => isUnauthorizedError(x))) {\n eventBus.dispatch(ProtectedDataFetchFailedEvent, queriesErrors);\n\n throw new GlobalDataQueriesError(\"[squide] Global protected data queries failed.\", queriesErrors);\n }\n }\n }, [hasErrors, queriesErrors, isProtectedDataReady, isUnauthorized, isUnauthorizedError, dispatch, eventBus]);\n\n return data;\n}\n"],"names":["useEventBus","useQueries","useCallback","useEffect","useRef","useAppRouterDispatcher","useAppRouterState","GlobalDataQueriesError","useCanFetchProtectedData","useExecuteOnce","ProtectedDataFetchStartedEvent","ProtectedDataFetchFailedEvent","useProtectedDataQueries","queries","isUnauthorizedError","canFetchProtectedData","eventBus","dispatch","combineResults","results","errors","x","hasErrors","data","queriesErrors","isReady","isProtectedDataReady","isUnauthorized","isReadyRef","dispatchReady"],"mappings":";;;;;;;;;;;;;;;AAA2C;AACuE;AAC3D;AAC2B;AACb;AACI;AACpB;AAE9C,MAAMU,8BAA8BA,GAAG,sCAAsC;AAC7E,MAAMC,6BAA6BA,GAAG,qCAAqC;AAQlF,8DAA8D;AACvD,SAASC,uBAAuBA,CAAuBC,OAA0B,EAAEC,mBAAgD;IACtI,MAAMC,wBAAwBP,wBAAwBA;IACtD,MAAMQ,WAAWhB,WAAWA;IAE5B,MAAMiB,WAAWZ,sBAAsBA;IAEvC,MAAMa,iBAAiBhB,WAAWA,CAAC,CAACiB;QAChC,MAAMC,SAASD,QAAQ,MAAM,CAACE,CAAAA,IAAKA,EAAE,KAAK,EAAE,GAAG,CAACA,CAAAA,IAAKA,EAAE,KAAK;QAC5D,MAAMC,YAAYF,OAAO,MAAM,GAAG;QAElC,OAAO;YACH,MAAMD,QAAQ,GAAG,CAACE,CAAAA,IAAKA,EAAE,IAAI;YAC7BD;YACAE;YACA,SAAS,CAACA,aAAa,CAACH,QAAQ,IAAI,CAACE,CAAAA,IAAKA,EAAE,SAAS;QACzD;IACJ,GAAG,EAAE;IAEL,MAAM,EAAEE,IAAI,EAAE,QAAQC,aAAa,EAAEF,SAAS,EAAEG,OAAO,EAAE,GAAGxB,UAAUA,CAAC;QACnE,SAASY,QAAQ,GAAG,CAACQ,CAAAA,IAAM;gBACvB,SAASN;gBACT,GAAGM,CAAC;YACR;QACA,SAASH;IACb;IAEA,MAAM,EAAEQ,oBAAoB,EAAEC,cAAc,EAAE,GAAGrB,iBAAiBA;IAElEG,cAAcA,CAACP,WAAWA,CAAC;QACvB,IAAIa,uBAAuB;YACvBC,SAAS,QAAQ,CAACN,8BAA8BA;YAEhD,OAAO;QACX;QAEA,OAAO;IACX,GAAG;QAACK;QAAuBC;KAAS,GAAG;IAEvC,6FAA6F;IAC7F,MAAMY,aAAaxB,MAAMA,CAAC;IAE1B,MAAMyB,gBAAgBpB,cAAcA,CAACP,WAAWA,CAAC;QAC7C,IAAIuB,SAAS;YACTG,WAAW,OAAO,GAAG;YAErBX,SAAS;gBAAE,MAAM;YAAuB;YAExC,OAAO;QACX;QAEA,OAAO;IACX,GAAG;QAACQ;QAASR;KAAS;IAEtBd,SAASA,CAAC;QACN,8CAA8C;QAC9C0B;IACJ,GAAG;QAACA;KAAc;IAElB1B,SAASA,CAAC;QACN,IAAIyB,WAAW,OAAO,IAAIL,MAAM;YAC5BN,SAAS;gBAAE,MAAM;YAAyB;QAC9C;IACJ,GAAG;QAACM;QAAMN;KAAS;IAEnBd,SAASA,CAAC;QACN,IAAImB,WAAW;YACX,IAAI,CAACI,wBAAwB,CAACC,kBAAkBH,cAAc,IAAI,CAACH,CAAAA,IAAKP,oBAAoBO,KAAK;gBAC7F,uHAAuH;gBACvH,kDAAkD;gBAClDJ,SAAS;oBAAE,MAAM;gBAAkB;YACvC;YAEA,sEAAsE;YACtE,IAAI,CAACO,cAAc,KAAK,CAACH,CAAAA,IAAKP,oBAAoBO,KAAK;gBACnDL,SAAS,QAAQ,CAACL,6BAA6BA,EAAEa;gBAEjD,MAAM,IAAIjB,sBAAsBA,CAAC,kDAAkDiB;YACvF;QACJ;IACJ,GAAG;QAACF;QAAWE;QAAeE;QAAsBC;QAAgBb;QAAqBG;QAAUD;KAAS;IAE5G,OAAOO;AACX"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { useEffect } from "react";
|
|
2
2
|
import { useCanFetchPublicData } from "./useCanFetchPublicData.js";
|
|
3
3
|
|
|
4
|
-
;// CONCATENATED MODULE: external "react"
|
|
5
4
|
|
|
6
|
-
;// CONCATENATED MODULE: external "./useCanFetchPublicData.js"
|
|
7
5
|
|
|
8
|
-
;// CONCATENATED MODULE: ./src/usePublicDataHandler.ts
|
|
9
6
|
|
|
10
7
|
|
|
11
8
|
function usePublicDataHandler(handler) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePublicDataHandler.js","sources":["../src/usePublicDataHandler.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useCanFetchPublicData } from \"./useCanFetchPublicData.ts\";\n\nexport function usePublicDataHandler(handler: () => void) {\n const canFetchPublicData = useCanFetchPublicData();\n\n useEffect(() => {\n if (canFetchPublicData) {\n handler();\n }\n }, [canFetchPublicData, handler]);\n}\n"],"names":["useEffect","useCanFetchPublicData","usePublicDataHandler","handler","canFetchPublicData"],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePublicDataHandler.js","sources":["../src/usePublicDataHandler.ts"],"sourcesContent":["import { useEffect } from \"react\";\nimport { useCanFetchPublicData } from \"./useCanFetchPublicData.ts\";\n\nexport function usePublicDataHandler(handler: () => void) {\n const canFetchPublicData = useCanFetchPublicData();\n\n useEffect(() => {\n if (canFetchPublicData) {\n handler();\n }\n }, [canFetchPublicData, handler]);\n}\n"],"names":["useEffect","useCanFetchPublicData","usePublicDataHandler","handler","canFetchPublicData"],"mappings":";;;;;AAAkC;AACiC;AAE5D,SAASE,oBAAoBA,CAACC,OAAmB;IACpD,MAAMC,qBAAqBH,qBAAqBA;IAEhDD,SAASA,CAAC;QACN,IAAII,oBAAoB;YACpBD;QACJ;IACJ,GAAG;QAACC;QAAoBD;KAAQ;AACpC"}
|
|
@@ -6,21 +6,13 @@ import { GlobalDataQueriesError } from "./GlobalDataQueriesError.js";
|
|
|
6
6
|
import { useCanFetchPublicData } from "./useCanFetchPublicData.js";
|
|
7
7
|
import { useExecuteOnce } from "./useExecuteOnce.js";
|
|
8
8
|
|
|
9
|
-
;// CONCATENATED MODULE: external "@squide/core"
|
|
10
9
|
|
|
11
|
-
;// CONCATENATED MODULE: external "@tanstack/react-query"
|
|
12
10
|
|
|
13
|
-
;// CONCATENATED MODULE: external "react"
|
|
14
11
|
|
|
15
|
-
;// CONCATENATED MODULE: external "./AppRouterContext.js"
|
|
16
12
|
|
|
17
|
-
;// CONCATENATED MODULE: external "./GlobalDataQueriesError.js"
|
|
18
13
|
|
|
19
|
-
;// CONCATENATED MODULE: external "./useCanFetchPublicData.js"
|
|
20
14
|
|
|
21
|
-
;// CONCATENATED MODULE: external "./useExecuteOnce.js"
|
|
22
15
|
|
|
23
|
-
;// CONCATENATED MODULE: ./src/usePublicDataQueries.ts
|
|
24
16
|
|
|
25
17
|
|
|
26
18
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePublicDataQueries.js","sources":["../src/usePublicDataQueries.ts"],"sourcesContent":["import { useEventBus } from \"@squide/core\";\nimport { useQueries, type QueriesOptions, type QueriesResults, type UseQueryResult } from \"@tanstack/react-query\";\nimport { useCallback, useEffect, useRef } from \"react\";\nimport { useAppRouterDispatcher } from \"./AppRouterContext.ts\";\nimport { GlobalDataQueriesError } from \"./GlobalDataQueriesError.ts\";\nimport { useCanFetchPublicData } from \"./useCanFetchPublicData.ts\";\nimport { useExecuteOnce } from \"./useExecuteOnce.ts\";\n\nexport const PublicDataFetchStartedEvent = \"squide-public-data-fetch-started\";\nexport const PublicDataFetchFailedEvent = \"squide-public-data-fetch-failed\";\n\n// This converts an array of UseQueryResult to an array of the data type of each query result.\n// For more information, view: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-1.html#mapped-types-on-tuples-and-arrays.\ntype MapUseQueryResultToData<T> = { [K in keyof T]: T[K] extends UseQueryResult<infer U> ? U : never };\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function usePublicDataQueries<T extends Array<any>>(queries: QueriesOptions<T>): MapUseQueryResultToData<QueriesResults<T>> {\n const canFetchPublicData = useCanFetchPublicData();\n const eventBus = useEventBus();\n\n const dispatch = useAppRouterDispatcher();\n\n const combineResults = useCallback((results: UseQueryResult<unknown, unknown>[]) => {\n const errors = results.filter(x => x.error).map(x => x.error) as Error[];\n const hasErrors = errors.length > 0;\n\n return {\n data: results.map(x => x.data) as MapUseQueryResultToData<QueriesResults<T>>,\n errors,\n hasErrors,\n isReady: !hasErrors && !results.some(x => x.isPending)\n };\n }, []);\n\n const { data, errors: queriesErrors, hasErrors, isReady } = useQueries({\n queries: queries.map(x => ({\n enabled: canFetchPublicData,\n ...x\n })),\n combine: combineResults\n });\n\n useExecuteOnce(useCallback(() => {\n if (canFetchPublicData) {\n eventBus.dispatch(PublicDataFetchStartedEvent);\n\n return true;\n }\n\n return false;\n }, [canFetchPublicData, eventBus]), true);\n\n // Using a ref seems to be the only way to prevent starting two deferred registrations scope.\n const isReadyRef = useRef(false);\n\n const dispatchReady = useExecuteOnce(useCallback(() => {\n if (isReady) {\n isReadyRef.current = true;\n\n dispatch({ type: \"public-data-ready\" });\n\n return true;\n }\n\n return false;\n }, [isReady, dispatch]));\n\n useEffect(() => {\n // State update must be executed in useEffect.\n dispatchReady();\n }, [dispatchReady]);\n\n useEffect(() => {\n if (isReadyRef.current && data) {\n dispatch({ type: \"public-data-updated\" });\n }\n }, [data, dispatch]);\n\n useEffect(() => {\n if (hasErrors) {\n eventBus.dispatch(PublicDataFetchFailedEvent, queriesErrors);\n\n throw new GlobalDataQueriesError(\"[squide] Global public data queries failed.\", queriesErrors);\n }\n }, [hasErrors, queriesErrors, eventBus]);\n\n return data;\n}\n"],"names":["useEventBus","useQueries","useCallback","useEffect","useRef","useAppRouterDispatcher","GlobalDataQueriesError","useCanFetchPublicData","useExecuteOnce","PublicDataFetchStartedEvent","PublicDataFetchFailedEvent","usePublicDataQueries","queries","canFetchPublicData","eventBus","dispatch","combineResults","results","errors","x","hasErrors","data","queriesErrors","isReady","isReadyRef","dispatchReady"],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePublicDataQueries.js","sources":["../src/usePublicDataQueries.ts"],"sourcesContent":["import { useEventBus } from \"@squide/core\";\nimport { useQueries, type QueriesOptions, type QueriesResults, type UseQueryResult } from \"@tanstack/react-query\";\nimport { useCallback, useEffect, useRef } from \"react\";\nimport { useAppRouterDispatcher } from \"./AppRouterContext.ts\";\nimport { GlobalDataQueriesError } from \"./GlobalDataQueriesError.ts\";\nimport { useCanFetchPublicData } from \"./useCanFetchPublicData.ts\";\nimport { useExecuteOnce } from \"./useExecuteOnce.ts\";\n\nexport const PublicDataFetchStartedEvent = \"squide-public-data-fetch-started\";\nexport const PublicDataFetchFailedEvent = \"squide-public-data-fetch-failed\";\n\n// This converts an array of UseQueryResult to an array of the data type of each query result.\n// For more information, view: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-1.html#mapped-types-on-tuples-and-arrays.\ntype MapUseQueryResultToData<T> = { [K in keyof T]: T[K] extends UseQueryResult<infer U> ? U : never };\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function usePublicDataQueries<T extends Array<any>>(queries: QueriesOptions<T>): MapUseQueryResultToData<QueriesResults<T>> {\n const canFetchPublicData = useCanFetchPublicData();\n const eventBus = useEventBus();\n\n const dispatch = useAppRouterDispatcher();\n\n const combineResults = useCallback((results: UseQueryResult<unknown, unknown>[]) => {\n const errors = results.filter(x => x.error).map(x => x.error) as Error[];\n const hasErrors = errors.length > 0;\n\n return {\n data: results.map(x => x.data) as MapUseQueryResultToData<QueriesResults<T>>,\n errors,\n hasErrors,\n isReady: !hasErrors && !results.some(x => x.isPending)\n };\n }, []);\n\n const { data, errors: queriesErrors, hasErrors, isReady } = useQueries({\n queries: queries.map(x => ({\n enabled: canFetchPublicData,\n ...x\n })),\n combine: combineResults\n });\n\n useExecuteOnce(useCallback(() => {\n if (canFetchPublicData) {\n eventBus.dispatch(PublicDataFetchStartedEvent);\n\n return true;\n }\n\n return false;\n }, [canFetchPublicData, eventBus]), true);\n\n // Using a ref seems to be the only way to prevent starting two deferred registrations scope.\n const isReadyRef = useRef(false);\n\n const dispatchReady = useExecuteOnce(useCallback(() => {\n if (isReady) {\n isReadyRef.current = true;\n\n dispatch({ type: \"public-data-ready\" });\n\n return true;\n }\n\n return false;\n }, [isReady, dispatch]));\n\n useEffect(() => {\n // State update must be executed in useEffect.\n dispatchReady();\n }, [dispatchReady]);\n\n useEffect(() => {\n if (isReadyRef.current && data) {\n dispatch({ type: \"public-data-updated\" });\n }\n }, [data, dispatch]);\n\n useEffect(() => {\n if (hasErrors) {\n eventBus.dispatch(PublicDataFetchFailedEvent, queriesErrors);\n\n throw new GlobalDataQueriesError(\"[squide] Global public data queries failed.\", queriesErrors);\n }\n }, [hasErrors, queriesErrors, eventBus]);\n\n return data;\n}\n"],"names":["useEventBus","useQueries","useCallback","useEffect","useRef","useAppRouterDispatcher","GlobalDataQueriesError","useCanFetchPublicData","useExecuteOnce","PublicDataFetchStartedEvent","PublicDataFetchFailedEvent","usePublicDataQueries","queries","canFetchPublicData","eventBus","dispatch","combineResults","results","errors","x","hasErrors","data","queriesErrors","isReady","isReadyRef","dispatchReady"],"mappings":";;;;;;;;;;;;;;;AAA2C;AACuE;AAC3D;AACQ;AACM;AACF;AACd;AAE9C,MAAMS,2BAA2BA,GAAG,mCAAmC;AACvE,MAAMC,0BAA0BA,GAAG,kCAAkC;AAM5E,8DAA8D;AACvD,SAASC,oBAAoBA,CAAuBC,OAA0B;IACjF,MAAMC,qBAAqBN,qBAAqBA;IAChD,MAAMO,WAAWd,WAAWA;IAE5B,MAAMe,WAAWV,sBAAsBA;IAEvC,MAAMW,iBAAiBd,WAAWA,CAAC,CAACe;QAChC,MAAMC,SAASD,QAAQ,MAAM,CAACE,CAAAA,IAAKA,EAAE,KAAK,EAAE,GAAG,CAACA,CAAAA,IAAKA,EAAE,KAAK;QAC5D,MAAMC,YAAYF,OAAO,MAAM,GAAG;QAElC,OAAO;YACH,MAAMD,QAAQ,GAAG,CAACE,CAAAA,IAAKA,EAAE,IAAI;YAC7BD;YACAE;YACA,SAAS,CAACA,aAAa,CAACH,QAAQ,IAAI,CAACE,CAAAA,IAAKA,EAAE,SAAS;QACzD;IACJ,GAAG,EAAE;IAEL,MAAM,EAAEE,IAAI,EAAE,QAAQC,aAAa,EAAEF,SAAS,EAAEG,OAAO,EAAE,GAAGtB,UAAUA,CAAC;QACnE,SAASW,QAAQ,GAAG,CAACO,CAAAA,IAAM;gBACvB,SAASN;gBACT,GAAGM,CAAC;YACR;QACA,SAASH;IACb;IAEAR,cAAcA,CAACN,WAAWA,CAAC;QACvB,IAAIW,oBAAoB;YACpBC,SAAS,QAAQ,CAACL,2BAA2BA;YAE7C,OAAO;QACX;QAEA,OAAO;IACX,GAAG;QAACI;QAAoBC;KAAS,GAAG;IAEpC,6FAA6F;IAC7F,MAAMU,aAAapB,MAAMA,CAAC;IAE1B,MAAMqB,gBAAgBjB,cAAcA,CAACN,WAAWA,CAAC;QAC7C,IAAIqB,SAAS;YACTC,WAAW,OAAO,GAAG;YAErBT,SAAS;gBAAE,MAAM;YAAoB;YAErC,OAAO;QACX;QAEA,OAAO;IACX,GAAG;QAACQ;QAASR;KAAS;IAEtBZ,SAASA,CAAC;QACN,8CAA8C;QAC9CsB;IACJ,GAAG;QAACA;KAAc;IAElBtB,SAASA,CAAC;QACN,IAAIqB,WAAW,OAAO,IAAIH,MAAM;YAC5BN,SAAS;gBAAE,MAAM;YAAsB;QAC3C;IACJ,GAAG;QAACM;QAAMN;KAAS;IAEnBZ,SAASA,CAAC;QACN,IAAIiB,WAAW;YACXN,SAAS,QAAQ,CAACJ,0BAA0BA,EAAEY;YAE9C,MAAM,IAAIhB,sBAAsBA,CAAC,+CAA+CgB;QACpF;IACJ,GAAG;QAACF;QAAWE;QAAeR;KAAS;IAEvC,OAAOO;AACX"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { useRuntime } from "@squide/core";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
|
|
4
|
-
;// CONCATENATED MODULE: external "@squide/core"
|
|
5
4
|
|
|
6
|
-
;// CONCATENATED MODULE: external "react"
|
|
7
5
|
|
|
8
|
-
;// CONCATENATED MODULE: ./src/useRegisterDeferredRegistrations.ts
|
|
9
6
|
|
|
10
7
|
|
|
11
8
|
function useRegisterDeferredRegistrations() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRegisterDeferredRegistrations.js","sources":["../src/useRegisterDeferredRegistrations.ts"],"sourcesContent":["import { useRuntime } from \"@squide/core\";\nimport { useCallback } from \"react\";\n\nexport function useRegisterDeferredRegistrations() {\n const runtime = useRuntime();\n\n return useCallback(<TData = unknown>(data?: TData) => {\n return runtime.moduleManager.registerDeferredRegistrations(data);\n }, [runtime]);\n}\n"],"names":["useRuntime","useCallback","useRegisterDeferredRegistrations","runtime","data"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useRegisterDeferredRegistrations.js","sources":["../src/useRegisterDeferredRegistrations.ts"],"sourcesContent":["import { useRuntime } from \"@squide/core\";\nimport { useCallback } from \"react\";\n\nexport function useRegisterDeferredRegistrations() {\n const runtime = useRuntime();\n\n return useCallback(<TData = unknown>(data?: TData) => {\n return runtime.moduleManager.registerDeferredRegistrations(data);\n }, [runtime]);\n}\n"],"names":["useRuntime","useCallback","useRegisterDeferredRegistrations","runtime","data"],"mappings":";;;;;AAA0C;AACN;AAE7B,SAASE,gCAAgCA;IAC5C,MAAMC,UAAUH,UAAUA;IAE1B,OAAOC,WAAWA,CAAC,CAAkBG;QACjC,OAAOD,QAAQ,aAAa,CAAC,6BAA6B,CAACC;IAC/D,GAAG;QAACD;KAAQ;AAChB"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { useRuntime } from "@squide/core";
|
|
2
2
|
import { useCallback, useEffect, useSyncExternalStore } from "react";
|
|
3
3
|
|
|
4
|
-
;// CONCATENATED MODULE: external "@squide/core"
|
|
5
4
|
|
|
6
|
-
;// CONCATENATED MODULE: external "react"
|
|
7
5
|
|
|
8
|
-
;// CONCATENATED MODULE: ./src/useStrictRegistrationMode.ts
|
|
9
6
|
|
|
10
7
|
|
|
11
8
|
function useStrictRegistrationMode(options = {}) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStrictRegistrationMode.js","sources":["../src/useStrictRegistrationMode.ts"],"sourcesContent":["import { useRuntime } from \"@squide/core\";\nimport { useCallback, useEffect, useSyncExternalStore } from \"react\";\n\nexport interface UseStrictRegistrationModeOptions {\n isEnabled?: boolean;\n}\n\nexport function useStrictRegistrationMode(options: UseStrictRegistrationModeOptions = {}) {\n const {\n isEnabled = true\n } = options;\n\n const runtime = useRuntime();\n\n const subscribe = useCallback((callback: () => void) => {\n runtime.moduleManager.registerModulesReadyListener(callback);\n\n return () => {\n runtime.moduleManager.removeModulesReadyListener(callback);\n };\n }, [runtime]);\n\n // This listener is only executed if the modules are ready.\n const areModulesReady = useSyncExternalStore(subscribe, () => runtime.moduleManager.getAreModulesReady());\n\n useEffect(() => {\n if (areModulesReady && isEnabled) {\n runtime._validateRegistrations();\n }\n }, [runtime, areModulesReady, isEnabled]);\n}\n"],"names":["useRuntime","useCallback","useEffect","useSyncExternalStore","useStrictRegistrationMode","options","isEnabled","runtime","subscribe","callback","areModulesReady"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useStrictRegistrationMode.js","sources":["../src/useStrictRegistrationMode.ts"],"sourcesContent":["import { useRuntime } from \"@squide/core\";\nimport { useCallback, useEffect, useSyncExternalStore } from \"react\";\n\nexport interface UseStrictRegistrationModeOptions {\n isEnabled?: boolean;\n}\n\nexport function useStrictRegistrationMode(options: UseStrictRegistrationModeOptions = {}) {\n const {\n isEnabled = true\n } = options;\n\n const runtime = useRuntime();\n\n const subscribe = useCallback((callback: () => void) => {\n runtime.moduleManager.registerModulesReadyListener(callback);\n\n return () => {\n runtime.moduleManager.removeModulesReadyListener(callback);\n };\n }, [runtime]);\n\n // This listener is only executed if the modules are ready.\n const areModulesReady = useSyncExternalStore(subscribe, () => runtime.moduleManager.getAreModulesReady());\n\n useEffect(() => {\n if (areModulesReady && isEnabled) {\n runtime._validateRegistrations();\n }\n }, [runtime, areModulesReady, isEnabled]);\n}\n"],"names":["useRuntime","useCallback","useEffect","useSyncExternalStore","useStrictRegistrationMode","options","isEnabled","runtime","subscribe","callback","areModulesReady"],"mappings":";;;;;AAA0C;AAC2B;AAM9D,SAASI,yBAAyBA,CAACC,UAA4C,CAAC,CAAC;IACpF,MAAM,EACFC,YAAY,IAAI,EACnB,GAAGD;IAEJ,MAAME,UAAUP,UAAUA;IAE1B,MAAMQ,YAAYP,WAAWA,CAAC,CAACQ;QAC3BF,QAAQ,aAAa,CAAC,4BAA4B,CAACE;QAEnD,OAAO;YACHF,QAAQ,aAAa,CAAC,0BAA0B,CAACE;QACrD;IACJ,GAAG;QAACF;KAAQ;IAEZ,2DAA2D;IAC3D,MAAMG,kBAAkBP,oBAAoBA,CAACK,WAAW,IAAMD,QAAQ,aAAa,CAAC,kBAAkB;IAEtGL,SAASA,CAAC;QACN,IAAIQ,mBAAmBJ,WAAW;YAC9BC,QAAQ,sBAAsB;QAClC;IACJ,GAAG;QAACA;QAASG;QAAiBJ;KAAU;AAC5C"}
|
|
@@ -2,13 +2,9 @@ import { useRuntime } from "@squide/core";
|
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { useAppRouterDispatcher } from "./AppRouterContext.js";
|
|
4
4
|
|
|
5
|
-
;// CONCATENATED MODULE: external "@squide/core"
|
|
6
5
|
|
|
7
|
-
;// CONCATENATED MODULE: external "react"
|
|
8
6
|
|
|
9
|
-
;// CONCATENATED MODULE: external "./AppRouterContext.js"
|
|
10
7
|
|
|
11
|
-
;// CONCATENATED MODULE: ./src/useUpdateDeferredRegistrations.ts
|
|
12
8
|
|
|
13
9
|
|
|
14
10
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUpdateDeferredRegistrations.js","sources":["../src/useUpdateDeferredRegistrations.ts"],"sourcesContent":["import { useRuntime } from \"@squide/core\";\nimport { useCallback } from \"react\";\nimport { useAppRouterDispatcher } from \"./AppRouterContext.ts\";\n\nexport const DeferredRegistrationsUpdateStartedEvent = \"squide-deferred-registrations-update-started\";\nexport const DeferredRegistrationsUpdateCompletedEvent = \"squide-deferred-registrations-update-completed-started\";\n\nexport function useUpdateDeferredRegistrations() {\n const runtime = useRuntime();\n const dispatch = useAppRouterDispatcher();\n\n return useCallback(async <TData = unknown>(data?: TData) => {\n runtime.eventBus.dispatch(DeferredRegistrationsUpdateStartedEvent);\n\n const errors = await runtime.moduleManager.updateDeferredRegistrations(data);\n\n dispatch({ type: \"deferred-registrations-updated\" });\n\n runtime.eventBus.dispatch(DeferredRegistrationsUpdateCompletedEvent);\n\n return errors;\n }, [runtime, dispatch]);\n}\n"],"names":["useRuntime","useCallback","useAppRouterDispatcher","DeferredRegistrationsUpdateStartedEvent","DeferredRegistrationsUpdateCompletedEvent","useUpdateDeferredRegistrations","runtime","dispatch","data","errors"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useUpdateDeferredRegistrations.js","sources":["../src/useUpdateDeferredRegistrations.ts"],"sourcesContent":["import { useRuntime } from \"@squide/core\";\nimport { useCallback } from \"react\";\nimport { useAppRouterDispatcher } from \"./AppRouterContext.ts\";\n\nexport const DeferredRegistrationsUpdateStartedEvent = \"squide-deferred-registrations-update-started\";\nexport const DeferredRegistrationsUpdateCompletedEvent = \"squide-deferred-registrations-update-completed-started\";\n\nexport function useUpdateDeferredRegistrations() {\n const runtime = useRuntime();\n const dispatch = useAppRouterDispatcher();\n\n return useCallback(async <TData = unknown>(data?: TData) => {\n runtime.eventBus.dispatch(DeferredRegistrationsUpdateStartedEvent);\n\n const errors = await runtime.moduleManager.updateDeferredRegistrations(data);\n\n dispatch({ type: \"deferred-registrations-updated\" });\n\n runtime.eventBus.dispatch(DeferredRegistrationsUpdateCompletedEvent);\n\n return errors;\n }, [runtime, dispatch]);\n}\n"],"names":["useRuntime","useCallback","useAppRouterDispatcher","DeferredRegistrationsUpdateStartedEvent","DeferredRegistrationsUpdateCompletedEvent","useUpdateDeferredRegistrations","runtime","dispatch","data","errors"],"mappings":";;;;;;;AAA0C;AACN;AAC2B;AAExD,MAAMG,uCAAuCA,GAAG,+CAA+C;AAC/F,MAAMC,yCAAyCA,GAAG,yDAAyD;AAE3G,SAASC,8BAA8BA;IAC1C,MAAMC,UAAUN,UAAUA;IAC1B,MAAMO,WAAWL,sBAAsBA;IAEvC,OAAOD,WAAWA,CAAC,OAAwBO;QACvCF,QAAQ,QAAQ,CAAC,QAAQ,CAACH,uCAAuCA;QAEjE,MAAMM,SAAS,MAAMH,QAAQ,aAAa,CAAC,2BAA2B,CAACE;QAEvED,SAAS;YAAE,MAAM;QAAiC;QAElDD,QAAQ,QAAQ,CAAC,QAAQ,CAACF,yCAAyCA;QAEnE,OAAOK;IACX,GAAG;QAACH;QAASC;KAAS;AAC1B"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squide/firefly",
|
|
3
3
|
"author": "Workleap",
|
|
4
|
-
"version": "16.2.
|
|
4
|
+
"version": "16.2.2",
|
|
5
5
|
"description": "Squide bundle for the firefly technology stack.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
"CHANGELOG.md"
|
|
33
33
|
],
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@opentelemetry/api": "^1.9.
|
|
36
|
-
"@tanstack/react-query": "^5.
|
|
35
|
+
"@opentelemetry/api": "^1.9.1",
|
|
36
|
+
"@tanstack/react-query": "^5.96.0",
|
|
37
37
|
"launchdarkly-js-client-sdk": "^3.9.0",
|
|
38
|
-
"msw": "^2.12.
|
|
38
|
+
"msw": "^2.12.14",
|
|
39
39
|
"react": "^18.0.0 || ^19.0.0",
|
|
40
40
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
41
|
-
"react-router": "^7.13.
|
|
41
|
+
"react-router": "^7.13.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependenciesMeta": {
|
|
44
44
|
"@opentelemetry/api": {
|
|
@@ -46,33 +46,34 @@
|
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@workleap-telemetry/core": "^2.0.
|
|
50
|
-
"@workleap/logging": "^1.3.
|
|
49
|
+
"@workleap-telemetry/core": "^2.0.1",
|
|
50
|
+
"@workleap/logging": "^1.3.7",
|
|
51
51
|
"uuid": "^13.0.0",
|
|
52
|
-
"@squide/
|
|
53
|
-
"@squide/
|
|
54
|
-
"@squide/
|
|
55
|
-
"@squide/
|
|
56
|
-
"@squide/react-router": "^8.1.
|
|
52
|
+
"@squide/core": "^6.1.15",
|
|
53
|
+
"@squide/env-vars": "^1.4.20",
|
|
54
|
+
"@squide/launch-darkly": "^1.0.11",
|
|
55
|
+
"@squide/msw": "^4.0.18",
|
|
56
|
+
"@squide/react-router": "^8.1.18"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@eslint/js": "9.39.2",
|
|
60
|
-
"@rsbuild/core": "1.7.
|
|
61
|
-
"@rslib/core": "0.
|
|
60
|
+
"@rsbuild/core": "1.7.5",
|
|
61
|
+
"@rslib/core": "0.20.2",
|
|
62
62
|
"@testing-library/react": "16.3.2",
|
|
63
|
+
"@types/node": "25.5.0",
|
|
63
64
|
"@types/react": "19.2.14",
|
|
64
65
|
"@types/react-dom": "19.2.3",
|
|
65
|
-
"@typescript-eslint/parser": "8.
|
|
66
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
67
|
-
"@vitejs/plugin-react": "
|
|
68
|
-
"@workleap/eslint-configs": "
|
|
69
|
-
"@workleap/rslib-configs": "1.1.
|
|
70
|
-
"@workleap/typescript-configs": "
|
|
66
|
+
"@typescript-eslint/parser": "8.58.0",
|
|
67
|
+
"@typescript/native-preview": "7.0.0-dev.20260331.1",
|
|
68
|
+
"@vitejs/plugin-react": "6.0.1",
|
|
69
|
+
"@workleap/eslint-configs": "2.0.1",
|
|
70
|
+
"@workleap/rslib-configs": "1.1.11",
|
|
71
|
+
"@workleap/typescript-configs": "4.0.0",
|
|
71
72
|
"eslint": "9.39.2",
|
|
72
|
-
"happy-dom": "20.8.
|
|
73
|
-
"typescript": "
|
|
73
|
+
"happy-dom": "20.8.9",
|
|
74
|
+
"typescript": "6.0.2",
|
|
74
75
|
"typescript-eslint": "8.54.0",
|
|
75
|
-
"vitest": "4.
|
|
76
|
+
"vitest": "4.1.2"
|
|
76
77
|
},
|
|
77
78
|
"sideEffects": false,
|
|
78
79
|
"scripts": {
|