@openmrs/esm-context 8.0.1-pre.3783 → 8.0.1-pre.3786

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.
@@ -1,3 +1,3 @@
1
- [0] Successfully compiled: 3 files with swc (213.32ms)
1
+ [0] Successfully compiled: 3 files with swc (267.3ms)
2
2
  [0] swc --strip-leading-paths src -d dist exited with code 0
3
3
  [1] tsc --project tsconfig.build.json exited with code 0
package/dist/context.d.ts CHANGED
@@ -25,6 +25,7 @@ export declare function unregisterContext(namespace: string): void;
25
25
  *
26
26
  * @typeParam T The type of the value stored in the namespace
27
27
  * @param namespace The namespace to load properties from
28
+ * @returns The immutable state of the namespace, or `null` if the namespace is not registered.
28
29
  */
29
30
  export declare function getContext<T extends NonNullable<object> = NonNullable<object>>(namespace: string): Readonly<T> | null;
30
31
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAMA,UAAU,iBAAiB;IACzB,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;CAC1C;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,uDAA+C,CAAC;AAMzE;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,WAAW,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,EACjF,SAAS,EAAE,MAAM,EACjB,YAAY,GAAE,CAAW,QAW1B;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,QAOlD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,WAAW,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;AAqBvH;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,WAA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MAAM,CAAC,EAC/E,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,QAUxB;AAED,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,WAAW,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,IAAI,CACjF,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,KAClC,IAAI,CAAC;AAEV;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,WAAW,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,EACpF,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC,cAe7B"}
package/dist/context.js CHANGED
@@ -42,6 +42,7 @@ const nothing = Object();
42
42
  * @typeParam U The return type of this hook which is mostly relevant when using a selector
43
43
  * @param namespace The namespace to load properties from
44
44
  * @param selector An optional function which extracts the relevant part of the state
45
+ * @returns The immutable state (or selected portion) of the namespace, or `null` if the namespace is not registered.
45
46
  */ export function getContext(namespace, selector = (state)=>state) {
46
47
  const state = contextStore.getState();
47
48
  if (namespace in state) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-context",
3
- "version": "8.0.1-pre.3783",
3
+ "version": "8.0.1-pre.3786",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Utilities for managing the current execution context",
6
6
  "type": "module",
@@ -53,8 +53,8 @@
53
53
  "@openmrs/esm-state": "6.x"
54
54
  },
55
55
  "devDependencies": {
56
- "@openmrs/esm-globals": "8.0.1-pre.3783",
57
- "@openmrs/esm-state": "8.0.1-pre.3783",
56
+ "@openmrs/esm-globals": "8.0.1-pre.3786",
57
+ "@openmrs/esm-state": "8.0.1-pre.3786",
58
58
  "@swc/cli": "^0.7.7",
59
59
  "@swc/core": "^1.11.29",
60
60
  "concurrently": "^9.1.2",
package/src/context.ts CHANGED
@@ -59,6 +59,7 @@ export function unregisterContext(namespace: string) {
59
59
  *
60
60
  * @typeParam T The type of the value stored in the namespace
61
61
  * @param namespace The namespace to load properties from
62
+ * @returns The immutable state of the namespace, or `null` if the namespace is not registered.
62
63
  */
63
64
  export function getContext<T extends NonNullable<object> = NonNullable<object>>(namespace: string): Readonly<T> | null;
64
65
  /**
@@ -68,6 +69,7 @@ export function getContext<T extends NonNullable<object> = NonNullable<object>>(
68
69
  * @typeParam U The return type of this hook which is mostly relevant when using a selector
69
70
  * @param namespace The namespace to load properties from
70
71
  * @param selector An optional function which extracts the relevant part of the state
72
+ * @returns The immutable state (or selected portion) of the namespace, or `null` if the namespace is not registered.
71
73
  */
72
74
  export function getContext<T extends NonNullable<object> = NonNullable<object>, U extends NonNullable<object> = T>(
73
75
  namespace: string,