@equinor/fusion-framework-react 8.0.0 → 8.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/esm/app/useAppProvider.js +1 -0
  3. package/dist/esm/app/useAppProvider.js.map +1 -1
  4. package/dist/esm/app/useCurrentApp.js +1 -0
  5. package/dist/esm/app/useCurrentApp.js.map +1 -1
  6. package/dist/esm/app/useCurrentAppModule.js +13 -6
  7. package/dist/esm/app/useCurrentAppModule.js.map +1 -1
  8. package/dist/esm/context.js +1 -20
  9. package/dist/esm/context.js.map +1 -1
  10. package/dist/esm/create-framework-provider.js +1 -1
  11. package/dist/esm/create-framework-provider.js.map +1 -1
  12. package/dist/esm/feature-flag/useFeature.js +4 -1
  13. package/dist/esm/feature-flag/useFeature.js.map +1 -1
  14. package/dist/esm/feature-flag/useFeatures.js +10 -1
  15. package/dist/esm/feature-flag/useFeatures.js.map +1 -1
  16. package/dist/esm/feature-flag/useFrameworkFeature.js +1 -0
  17. package/dist/esm/feature-flag/useFrameworkFeature.js.map +1 -1
  18. package/dist/esm/feature-flag/useFrameworkFeatures.js +1 -0
  19. package/dist/esm/feature-flag/useFrameworkFeatures.js.map +1 -1
  20. package/dist/esm/framework-provider.js +21 -0
  21. package/dist/esm/framework-provider.js.map +1 -0
  22. package/dist/esm/hooks/index.js +2 -2
  23. package/dist/esm/hooks/index.js.map +1 -1
  24. package/dist/esm/hooks/{use-current-user.js → useCurrentUser.js} +1 -1
  25. package/dist/esm/hooks/useCurrentUser.js.map +1 -0
  26. package/dist/esm/hooks/{use-http-client.js → useHttpClient.js} +3 -2
  27. package/dist/esm/hooks/useHttpClient.js.map +1 -0
  28. package/dist/esm/http/index.js +1 -1
  29. package/dist/esm/http/index.js.map +1 -1
  30. package/dist/esm/index.js +1 -1
  31. package/dist/esm/index.js.map +1 -1
  32. package/dist/esm/signalr/index.js +1 -31
  33. package/dist/esm/signalr/index.js.map +1 -1
  34. package/dist/esm/signalr/useSignalR.js +33 -0
  35. package/dist/esm/signalr/useSignalR.js.map +1 -0
  36. package/dist/esm/useFramework.js +2 -0
  37. package/dist/esm/useFramework.js.map +1 -1
  38. package/dist/esm/useFrameworkModule.js +3 -2
  39. package/dist/esm/useFrameworkModule.js.map +1 -1
  40. package/dist/esm/version.js +1 -1
  41. package/dist/tsconfig.tsbuildinfo +1 -1
  42. package/dist/types/Framework.d.ts +1 -1
  43. package/dist/types/app/useAppProvider.d.ts +1 -1
  44. package/dist/types/context.d.ts +1 -20
  45. package/dist/types/framework-provider.d.ts +19 -0
  46. package/dist/types/hooks/index.d.ts +2 -2
  47. package/dist/types/http/index.d.ts +1 -1
  48. package/dist/types/index.d.ts +1 -1
  49. package/dist/types/signalr/index.d.ts +1 -24
  50. package/dist/types/signalr/useSignalR.d.ts +24 -0
  51. package/dist/types/version.d.ts +1 -1
  52. package/package.json +15 -15
  53. package/src/app/useAppProvider.ts +1 -0
  54. package/src/app/useCurrentApp.ts +1 -0
  55. package/src/app/useCurrentAppModule.ts +13 -7
  56. package/src/context.ts +1 -21
  57. package/src/create-framework-provider.tsx +2 -2
  58. package/src/feature-flag/useFeature.ts +8 -1
  59. package/src/feature-flag/useFeatures.ts +10 -1
  60. package/src/feature-flag/useFrameworkFeature.ts +1 -0
  61. package/src/feature-flag/useFrameworkFeatures.ts +1 -0
  62. package/src/framework-provider.ts +21 -0
  63. package/src/hooks/index.ts +2 -2
  64. package/src/hooks/{use-http-client.ts → useHttpClient.ts} +2 -1
  65. package/src/http/index.ts +1 -1
  66. package/src/index.tsx +1 -1
  67. package/src/signalr/index.ts +1 -39
  68. package/src/signalr/useSignalR.ts +40 -0
  69. package/src/useFramework.ts +2 -0
  70. package/src/useFrameworkModule.ts +3 -2
  71. package/src/version.ts +1 -1
  72. package/dist/esm/hooks/use-current-user.js.map +0 -1
  73. package/dist/esm/hooks/use-http-client.js.map +0 -1
  74. /package/dist/types/hooks/{use-current-user.d.ts → useCurrentUser.d.ts} +0 -0
  75. /package/dist/types/hooks/{use-http-client.d.ts → useHttpClient.d.ts} +0 -0
  76. /package/src/hooks/{use-current-user.ts → useCurrentUser.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Change Log
2
2
 
3
+ ## 8.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 80c3e4a: Internal: resolve `noExplicitAny` Biome warnings in the framework React context, `createFrameworkProvider`'s `TRef` generic default, and `useCurrentAppModule`'s dynamic module-key lookup, using explanatory `biome-ignore` comments. No public API or behavior change.
8
+ - 80c3e4a: Internal: Reference tracking issues #5082 and #5085 in TODO comments, resolving `fusion-lint` `no-todo-without-issue` warnings.
9
+ - 80c3e4a: Internal: align framework hook filenames with their exports while preserving public entrypoints; no public API changes.
10
+ - 80c3e4a: Internal: add intent comments to `.pipe()` operator chains in `useFeature.ts` and `useFeatures.ts` to satisfy the `require-intent-comment/rxjs` lint rule. No functional change.
11
+ - 80c3e4a: Internal: add missing intent comments for `as`/`as unknown as` type assertions and inline separate re-exports at their definition site, per `fusion-lint`'s `require-intent-comment/type-assertion` and `no-separate-export` rules. No behavior changes.
12
+ - 80c3e4a: Internal: add intent comments to control-flow statements and iterator calls across several hooks to satisfy the `require-intent-comment/flow` and `require-intent-comment/iterators` lint rules. No functional change.
13
+ - 80c3e4a: Internal: split multi-export files into one export per file and convert pure interop re-exports to `export { X } from 'y'` syntax, per `fusion-lint`'s `single-export-per-file` rule. Also removed `modules/event/src/EventProvider.tsx`, a fully dead duplicate of `eventContext.ts`/`useEventProvider.ts`/`useModulesEventProvider.ts` with no remaining consumers. No behavior changes.
14
+
3
15
  ## 8.0.0
4
16
 
5
17
  ### Major Changes
@@ -14,6 +14,7 @@ import { useFramework } from '../useFramework';
14
14
  */
15
15
  export const useAppProvider = () => {
16
16
  const provider = useFramework().modules.app;
17
+ // Fail fast when the AppModule has not been configured on the framework
17
18
  if (!provider) {
18
19
  throw Error('Current framework does not have AppModule configured');
19
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useAppProvider.js","sourceRoot":"","sources":["../../../src/app/useAppProvider.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,GAA8C,EAAE;IAC5E,MAAM,QAAQ,GAAG,YAAY,EAAe,CAAC,OAAO,CAAC,GAAG,CAAC;IACzD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,KAAK,CAAC,sDAAsD,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"useAppProvider.js","sourceRoot":"","sources":["../../../src/app/useAppProvider.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,GAA8C,EAAE;IAC5E,MAAM,QAAQ,GAAG,YAAY,EAAe,CAAC,OAAO,CAAC,GAAG,CAAC;IACzD,wEAAwE;IACxE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,KAAK,CAAC,sDAAsD,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -32,6 +32,7 @@ import { useFramework } from '../useFramework';
32
32
  */
33
33
  export const useCurrentApp = () => {
34
34
  const provider = useFramework().modules.app;
35
+ // Fail fast when the AppModule has not been configured on the framework
35
36
  if (!provider) {
36
37
  throw Error('Current framework does not have AppModule configured');
37
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useCurrentApp.js","sourceRoot":"","sources":["../../../src/app/useCurrentApp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAA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;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAQ3B,EAAE;IACF,MAAM,QAAQ,GAAG,YAAY,EAAe,CAAC,OAAO,CAAC,GAAG,CAAC;IACzD,wEAAwE;IACxE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,KAAK,CAAC,sDAAsD,CAAC,CAAC;IACtE,CAAC;IACD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IACjE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,kBAAkB,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACxF,OAAO;QACL,UAAU,EAAE,KAAmC;QAC/C,aAAa,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;QAC/E,eAAe,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;QACnF,KAAK;KACN,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -17,12 +17,19 @@ import useCurrentAppModules from './useCurrentAppModules';
17
17
  */
18
18
  export const useCurrentAppModule = (moduleKey) => {
19
19
  const { modules, error, complete } = useCurrentAppModules();
20
- const module = modules === null
21
- ? null
22
- : modules === undefined
23
- ? undefined
24
- : // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
- modules[moduleKey];
20
+ const module = (() => {
21
+ // Preserve an explicit null (modules not applicable) distinct from undefined (not yet loaded)
22
+ if (modules === null) {
23
+ return null;
24
+ }
25
+ // Modules are still loading; propagate undefined rather than throwing
26
+ if (modules === undefined) {
27
+ return undefined;
28
+ }
29
+ // Module lookup by dynamic key can't be statically narrowed to the exact module type; cast to any.
30
+ // biome-ignore lint/suspicious/noExplicitAny: dynamic key lookup can't be statically narrowed to the exact module type
31
+ return modules[moduleKey];
32
+ })();
26
33
  return { module, error, complete };
27
34
  };
28
35
  export default useCurrentAppModule;
@@ -1 +1 @@
1
- {"version":3,"file":"useCurrentAppModule.js","sourceRoot":"","sources":["../../../src/app/useCurrentAppModule.ts"],"names":[],"mappings":"AAOA,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAE1D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAIjC,SAAe,EASf,EAAE;IACF,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAC5D,MAAM,MAAM,GACV,OAAO,KAAK,IAAI;QACd,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,OAAO,KAAK,SAAS;YACrB,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,8DAA8D;gBAC7D,OAAO,CAAC,SAAiC,CAAS,CAAC;IAC5D,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACrC,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"useCurrentAppModule.js","sourceRoot":"","sources":["../../../src/app/useCurrentAppModule.ts"],"names":[],"mappings":"AAOA,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAE1D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAIjC,SAAe,EASf,EAAE;IACF,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAC5D,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE;QACnB,8FAA8F;QAC9F,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACrB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,sEAAsE;QACtE,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,mGAAmG;QACnG,uHAAuH;QACvH,OAAO,OAAO,CAAC,SAAiC,CAAQ,CAAC;IAC3D,CAAC,CAAC,EAAE,CAAC;IACL,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACrC,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -8,25 +8,6 @@ import { createContext } from 'react';
8
8
  *
9
9
  * @internal
10
10
  */
11
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
+ // biome-ignore lint/suspicious/noExplicitAny: `Fusion<any>` widens the context to accept a Fusion instance with any concrete module set
12
12
  export const context = createContext(null);
13
- /**
14
- * Component for providing framework.
15
- *
16
- * @remarks
17
- * Should be created by {@link createFrameworkProvider}
18
- *
19
- * @example
20
- * ```tsx
21
- * import {FrameworkProvider} from '@equinor/fusion-framework-react';
22
- * export const Component = (args: React.PropsWithChildren<{framework: Fusion}>) => {
23
- * return (
24
- * <FrameworkProvider value={args.framework}>
25
- * {args.children}
26
- * </FrameworkProvider>
27
- * );
28
- * }
29
- * ```
30
- */
31
- export const FrameworkProvider = context.Provider;
32
13
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC;;;;;;;;GAQG;AACH,8DAA8D;AAC9D,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAqB,IAAI,CAAC,CAAC;AAE/D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC"}
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC;;;;;;;;GAQG;AACH,wIAAwI;AACxI,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAqB,IAAI,CAAC,CAAC"}
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { lazy } from 'react';
3
3
  import initFusion from '@equinor/fusion-framework';
4
4
  import { FrameworkConfigurator } from '@equinor/fusion-framework';
5
- import { FrameworkProvider } from './context';
5
+ import { FrameworkProvider } from './framework-provider';
6
6
  import { ModuleProvider } from '@equinor/fusion-framework-react-module';
7
7
  /**
8
8
  * Creates a lazy-loaded React component that initialises a Fusion Framework
@@ -1 +1 @@
1
- {"version":3,"file":"create-framework-provider.js","sourceRoot":"","sources":["../../src/create-framework-provider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAKrC,EAAuF,EACvF,GAAU,EAC4E,EAAE,CACxF,IAAI,CAAC,KAAK,IAAI,EAAE;IACd,MAAM,YAAY,GAAG,IAAI,qBAAqB,EAAY,CAAC;IAC3D,MAAM,EAAE,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;IAC5B,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;IACtD,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAkC,EAAE,EAAE,CAAC,CACzD,KAAC,iBAAiB,IAAC,KAAK,EAAE,SAAS,YACjC,KAAC,cAAc,IAAC,KAAK,EAAE,SAAS,CAAC,OAAO,YAAG,QAAQ,GAAkB,GACnD,CACrB;KACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"create-framework-provider.js","sourceRoot":"","sources":["../../src/create-framework-provider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAKrC,EAAuF,EACvF,GAAU,EAC4E,EAAE,CACxF,IAAI,CAAC,KAAK,IAAI,EAAE;IACd,MAAM,YAAY,GAAG,IAAI,qBAAqB,EAAY,CAAC;IAC3D,MAAM,EAAE,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;IAC5B,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;IACtD,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAkC,EAAE,EAAE,CAAC,CACzD,KAAC,iBAAiB,IAAC,KAAK,EAAE,SAAS,YACjC,KAAC,cAAc,IAAC,KAAK,EAAE,SAAS,CAAC,OAAO,YAAG,QAAQ,GAAkB,GACnD,CACrB;KACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -18,7 +18,10 @@ import { findFeature } from '@equinor/fusion-framework-module-feature-flag/selec
18
18
  * ```
19
19
  */
20
20
  export const useFeature = (provider, key) => {
21
- const feature$ = useMemo(() => provider.features$.pipe(findFeature(key)), [provider, key]);
21
+ // Narrow the features stream down to just the one matching feature by key.
22
+ const feature$ = useMemo(() => provider.features$
23
+ // Keep the observable scoped to the requested feature key.
24
+ .pipe(findFeature(key)), [provider, key]);
22
25
  const { value: feature, error } = useObservableState(feature$ ?? EMPTY);
23
26
  const toggleFeature = useCallback((enable) => {
24
27
  const enabled = enable === undefined ? !provider.getFeature(key)?.enabled : enable;
@@ -1 +1 @@
1
- {"version":3,"file":"useFeature.js","sourceRoot":"","sources":["../../../src/feature-flag/useFeature.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAO7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,yDAAyD,CAAC;AAqBtF;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,QAA8B,EAC9B,GAAW,EACU,EAAE;IACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAI,GAAG,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC;IAC9F,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,kBAAkB,CAAC,QAAQ,IAAI,KAAK,CAAC,CAAC;IACxE,MAAM,aAAa,GAAG,WAAW,CAC/B,CAAC,MAAgB,EAAE,EAAE;QACnB,MAAM,OAAO,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;QACnF,QAAQ,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;IAC3C,CAAC,EACD,CAAC,QAAQ,EAAE,GAAG,CAAC,CAChB,CAAC;IACF,OAAO,EAAE,OAAO,EAAE,aAAa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+26,18 @@ export const useFeatures = (provider, selector) => {
26
26
  * @returns An object containing the features and any error that occurred while retrieving them.
27
27
  */
28
28
  const { value: features, error } = useObservableState(useMemo(() => {
29
+ // Only compute the feature list when a provider is available; otherwise there's nothing to observe
29
30
  if (provider) {
31
+ // Map the feature dictionary to a list, optionally narrowed by the caller-provided selector
30
32
  return provider?.features$.pipe(map((x) => {
31
33
  const values = Object.values(x);
32
- return selector ? values.filter(selector) : values;
34
+ // Return everything when no selector is provided
35
+ if (!selector) {
36
+ return values;
37
+ }
38
+ // Apply the caller-provided selector to narrow down the feature list
39
+ const filtered = values.filter(selector);
40
+ return filtered;
33
41
  }));
34
42
  }
35
43
  return of([]);
@@ -42,6 +50,7 @@ export const useFeatures = (provider, selector) => {
42
50
  * @throws Error if IFeatureFlagProvider is missing.
43
51
  */
44
52
  const toggleFeature = useCallback((key, enable) => {
53
+ // Cannot toggle a feature without a provider to persist the change
45
54
  if (!provider) {
46
55
  throw new Error('Missing IFeatureFlagProvider.');
47
56
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useFeatures.js","sourceRoot":"","sources":["../../../src/feature-flag/useFeatures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AASrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAoBtE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,QAAsC,EACtC,QAA4B,EACT,EAAE;IACrB;;;;OAIG;IACH,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,kBAAkB,CACnD,OAAO,CAAC,GAAG,EAAE;QACX,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,QAAQ,EAAE,SAAS,CAAC,IAAI,CA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,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;QAEnF,QAAQ,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;IAC3C,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IACF,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AAC5C,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -17,6 +17,7 @@ import { useFeature } from './useFeature';
17
17
  */
18
18
  export const useFrameworkFeature = (key) => {
19
19
  const provider = useFrameworkModule('featureFlag');
20
+ // Fail fast when the FeatureFlagModule has not been enabled on the framework
20
21
  if (!provider) {
21
22
  throw Error('Feature flagging is not enabled in the framework');
22
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useFrameworkFeature.js","sourceRoot":"","sources":["../../../src/feature-flag/useFrameworkFeature.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAI,GAAW,EAAoC,EAAE;IACtF,MAAM,QAAQ,GAAG,kBAAkB,CAAoB,aAAa,CAAC,CAAC;IACtE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,KAAK,CAAC,kDAAkD,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,UAAU,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"useFrameworkFeature.js","sourceRoot":"","sources":["../../../src/feature-flag/useFrameworkFeature.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAI,GAAW,EAAoC,EAAE;IACtF,MAAM,QAAQ,GAAG,kBAAkB,CAAoB,aAAa,CAAC,CAAC;IACtE,6EAA6E;IAC7E,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,KAAK,CAAC,kDAAkD,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,UAAU,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -15,6 +15,7 @@ import { useFeatures } from './useFeatures';
15
15
  */
16
16
  export const useFrameworkFeatures = () => {
17
17
  const provider = useFrameworkModule('featureFlag');
18
+ // Fail fast when the FeatureFlagModule has not been enabled on the framework
18
19
  if (!provider) {
19
20
  throw Error('Feature flagging is not enabled in the framework');
20
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useFrameworkFeatures.js","sourceRoot":"","sources":["../../../src/feature-flag/useFrameworkFeatures.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAmC,EAAE;IACvE,MAAM,QAAQ,GAAG,kBAAkB,CAAoB,aAAa,CAAC,CAAC;IACtE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,KAAK,CAAC,kDAAkD,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,WAAW,CAAC,QAAQ,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"useFrameworkFeatures.js","sourceRoot":"","sources":["../../../src/feature-flag/useFrameworkFeatures.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAmC,EAAE;IACvE,MAAM,QAAQ,GAAG,kBAAkB,CAAoB,aAAa,CAAC,CAAC;IACtE,6EAA6E;IAC7E,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,KAAK,CAAC,kDAAkD,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,WAAW,CAAC,QAAQ,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { context } from './context';
2
+ /**
3
+ * Component for providing framework.
4
+ *
5
+ * @remarks
6
+ * Should be created by {@link createFrameworkProvider}
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * import {FrameworkProvider} from '@equinor/fusion-framework-react';
11
+ * export const Component = (args: React.PropsWithChildren<{framework: Fusion}>) => {
12
+ * return (
13
+ * <FrameworkProvider value={args.framework}>
14
+ * {args.children}
15
+ * </FrameworkProvider>
16
+ * );
17
+ * }
18
+ * ```
19
+ */
20
+ export const FrameworkProvider = context.Provider;
21
+ //# sourceMappingURL=framework-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"framework-provider.js","sourceRoot":"","sources":["../../src/framework-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC"}
@@ -6,6 +6,6 @@
6
6
  *
7
7
  * @module
8
8
  */
9
- export { useCurrentUser } from './use-current-user';
10
- export { useHttpClient } from './use-http-client';
9
+ export { useCurrentUser } from './useCurrentUser';
10
+ export { useHttpClient } from './useHttpClient';
11
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
@@ -17,4 +17,4 @@ export const useCurrentUser = () => {
17
17
  const framework = useFramework();
18
18
  return framework.modules.auth.account || undefined;
19
19
  };
20
- //# sourceMappingURL=use-current-user.js.map
20
+ //# sourceMappingURL=useCurrentUser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCurrentUser.js","sourceRoot":"","sources":["../../../src/hooks/useCurrentUser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,GAA4B,EAAE;IAC1D,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IACjC,OAAO,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,IAAI,SAAS,CAAC;AACrD,CAAC,CAAC"}
@@ -16,12 +16,13 @@ import { useFramework } from '../useFramework';
16
16
  export const useHttpClient = (name) => {
17
17
  const framework = useFramework();
18
18
  const client = useMemo(() => {
19
+ // Reuse an already-configured client for this key when one exists
19
20
  if (framework.modules.http.hasClient(name)) {
20
21
  return framework.modules.http.createClient(name);
21
22
  }
22
23
  throw Error(`no configured client for key [${name}]`);
23
24
  }, [framework, name]);
24
- // TODO - abort on unmount?
25
+ // TODO(#5085): abort on unmount?
25
26
  return client;
26
27
  };
27
- //# sourceMappingURL=use-http-client.js.map
28
+ //# sourceMappingURL=useHttpClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useHttpClient.js","sourceRoot":"","sources":["../../../src/hooks/useHttpClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAQ/C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAyB,EAAc,EAAE;IACrE,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IAEjC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE;QAC1B,kEAAkE;QAClE,IAAI,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3C,OAAO,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACnD,CAAC;QACD,MAAM,KAAK,CAAC,iCAAiC,IAAI,GAAG,CAAC,CAAC;IACxD,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IACtB,iCAAiC;IACjC,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
@@ -8,6 +8,6 @@
8
8
  *
9
9
  * @module
10
10
  */
11
- export { useHttpClient as useFrameworkHttpClient } from '../hooks/use-http-client';
11
+ export { useHttpClient as useFrameworkHttpClient } from '../hooks/useHttpClient';
12
12
  export * from '@equinor/fusion-framework-react-module-http';
13
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/http/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,aAAa,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAEnF,cAAc,6CAA6C,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/http/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,aAAa,IAAI,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEjF,cAAc,6CAA6C,CAAC"}
package/dist/esm/index.js CHANGED
@@ -12,7 +12,7 @@
12
12
  */
13
13
  export { FusionConfigurator } from '@equinor/fusion-framework';
14
14
  export { createFrameworkProvider } from './create-framework-provider';
15
- export { FrameworkProvider } from './context';
15
+ export { FrameworkProvider } from './framework-provider';
16
16
  export { useFramework } from './useFramework';
17
17
  export { useFrameworkModule } from './useFrameworkModule';
18
18
  export { default, Framework } from './Framework';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
@@ -1,32 +1,2 @@
1
- import { useFramework } from '../useFramework';
2
- import { useProviderTopic, } from '@equinor/fusion-framework-react-module-signalr';
3
- /**
4
- * hook for subscribing to a topic of a SignalR hub
5
- *
6
- * @example
7
- ```ts
8
- // config.ts
9
- import {enableSignalR} from '@equinor/fusion-framework-react-module-signalr';
10
- (configurator) => enableSignalR(configurator, 'notifications');
11
-
12
- // myHook.ts
13
- const myHook = () => {
14
- const topic = useSignalR('notifications', 'foo');
15
- return useObservableState(topic).next;
16
- }
17
- ```
18
- *
19
- * @see {@link [module signalr](https://equinor.github.io/fusion-framework/modules/signalr)}
20
- *
21
- * @param hubId identifier of connection hub (must be configured)
22
- * @param topicId identifier of topic to connect to
23
- * @returns Topic
24
- */
25
- export const useSignalR = (hubId, topicId) => {
26
- const provider = useFramework().modules.signalR;
27
- if (!provider) {
28
- throw Error('SignalR is not configured, see @equinor/fusion-framework-react-module-signalr');
29
- }
30
- return useProviderTopic(provider, hubId, topicId);
31
- };
1
+ export { useSignalR } from './useSignalR.js';
32
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/signalr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAEL,gBAAgB,GACjB,MAAM,gDAAgD,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,KAAa,EACb,OAAe,EACyB,EAAE;IAC1C,MAAM,QAAQ,GAAG,YAAY,EAAmB,CAAC,OAAO,CAAC,OAAO,CAAC;IACjE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,KAAK,CAAC,+EAA+E,CAAC,CAAC;IAC/F,CAAC;IACD,OAAO,gBAAgB,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/signalr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { useFramework } from '../useFramework';
2
+ import { useProviderTopic, } from '@equinor/fusion-framework-react-module-signalr';
3
+ /**
4
+ * hook for subscribing to a topic of a SignalR hub
5
+ *
6
+ * @example
7
+ ```ts
8
+ // config.ts
9
+ import {enableSignalR} from '@equinor/fusion-framework-react-module-signalr';
10
+ (configurator) => enableSignalR(configurator, 'notifications');
11
+
12
+ // myHook.ts
13
+ const myHook = () => {
14
+ const topic = useSignalR('notifications', 'foo');
15
+ return useObservableState(topic).next;
16
+ }
17
+ ```
18
+ *
19
+ * @see {@link [module signalr](https://equinor.github.io/fusion-framework/modules/signalr)}
20
+ *
21
+ * @param hubId identifier of connection hub (must be configured)
22
+ * @param topicId identifier of topic to connect to
23
+ * @returns Topic
24
+ */
25
+ export const useSignalR = (hubId, topicId) => {
26
+ const provider = useFramework().modules.signalR;
27
+ // Fail fast when the SignalRModule has not been configured on the framework
28
+ if (!provider) {
29
+ throw Error('SignalR is not configured, see @equinor/fusion-framework-react-module-signalr');
30
+ }
31
+ return useProviderTopic(provider, hubId, topicId);
32
+ };
33
+ //# sourceMappingURL=useSignalR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSignalR.js","sourceRoot":"","sources":["../../../src/signalr/useSignalR.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAEL,gBAAgB,GACjB,MAAM,gDAAgD,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,KAAa,EACb,OAAe,EACyB,EAAE;IAC1C,MAAM,QAAQ,GAAG,YAAY,EAAmB,CAAC,OAAO,CAAC,OAAO,CAAC;IACjE,4EAA4E;IAC5E,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,KAAK,CAAC,+EAA+E,CAAC,CAAC;IAC/F,CAAC;IACD,OAAO,gBAAgB,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC,CAAC"}
@@ -23,10 +23,12 @@ import { context } from './context';
23
23
  */
24
24
  export const useFramework = () => {
25
25
  let framework = useContext(context);
26
+ // Warn loudly when the framework context is missing so integrators notice the misuse
26
27
  if (!framework) {
27
28
  console.warn('could not locate fusion in context!');
28
29
  }
29
30
  framework ??= window.Fusion;
31
+ // Surface an error when neither context nor the global fallback has the framework instance
30
32
  if (!framework) {
31
33
  console.error('Could not load framework, might not be initiated?');
32
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useFramework.js","sourceRoot":"","sources":["../../src/useFramework.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,GAA6D,EAAE;IACzF,IAAI,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;IACtD,CAAC;IACD,SAAS,KAAK,MAAM,CAAC,MAAM,CAAC;IAC5B,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"useFramework.js","sourceRoot":"","sources":["../../src/useFramework.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,GAA6D,EAAE;IACzF,IAAI,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,qFAAqF;IACrF,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;IACtD,CAAC;IACD,SAAS,KAAK,MAAM,CAAC,MAAM,CAAC;IAC5B,2FAA2F;IAC3F,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -17,10 +17,11 @@ import { useFramework } from './useFramework';
17
17
  */
18
18
  export const useFrameworkModule = (name) => {
19
19
  const framework = useFramework();
20
- // TODO
20
+ // TODO(#5082): tighten generics so this indexed lookup no longer needs @ts-expect-error
21
21
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
22
- // @ts-ignore
22
+ // @ts-expect-error
23
23
  const module = framework.modules[name];
24
+ // Warn when the requested module key does not resolve to a registered module
24
25
  if (!module) {
25
26
  console.warn(`the requested module [${module}] is not included in the framework instance`);
26
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useFrameworkModule.js","sourceRoot":"","sources":["../../src/useFrameworkModule.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAQ9C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAIhC,IAAU,EAGsE,EAAE;IAClF,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IACjC,OAAO;IACP,6DAA6D;IAC7D,aAAa;IACb,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,IAAI,CAAC,yBAAyB,MAAM,6CAA6C,CAAC,CAAC;IAC7F,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
1
+ {"version":3,"file":"useFrameworkModule.js","sourceRoot":"","sources":["../../src/useFrameworkModule.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAQ9C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAIhC,IAAU,EAGsE,EAAE;IAClF,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IACjC,wFAAwF;IACxF,6DAA6D;IAC7D,mBAAmB;IACnB,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,6EAA6E;IAC7E,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,IAAI,CAAC,yBAAyB,MAAM,6CAA6C,CAAC,CAAC;IAC7F,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
@@ -1,3 +1,3 @@
1
1
  // Generated by genversion.
2
- export const version = '8.0.0';
2
+ export const version = '8.0.1';
3
3
  //# sourceMappingURL=version.js.map