@openmrs/esm-config 6.3.1-pre.3105 → 6.3.1-pre.3119

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: 8 files with swc (201.19ms)
1
+ [0] Successfully compiled: 8 files with swc (205.63ms)
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
@@ -254,7 +254,9 @@ export function provide(config, sourceName = 'provided') {
254
254
  'Translation overrides'
255
255
  ], state.config);
256
256
  resolve(config);
257
- unsubscribe && unsubscribe();
257
+ if (unsubscribe) {
258
+ unsubscribe();
259
+ }
258
260
  }
259
261
  }
260
262
  update(store.getState());
@@ -269,7 +271,9 @@ export function provide(config, sourceName = 'provided') {
269
271
  if (state.translationOverridesLoaded && state.config) {
270
272
  const translationOverrides = state.config['Translation overrides'] ?? {};
271
273
  resolve(translationOverrides);
272
- unsubscribe && unsubscribe();
274
+ if (unsubscribe) {
275
+ unsubscribe();
276
+ }
273
277
  }
274
278
  }
275
279
  update(configStore.getState());
@@ -283,7 +287,9 @@ export function provide(config, sourceName = 'provided') {
283
287
  if (state.loaded && state.config) {
284
288
  const translationOverrides = state.config['Translation overrides'] ?? {};
285
289
  resolve(translationOverrides);
286
- unsubscribe && unsubscribe();
290
+ if (unsubscribe) {
291
+ unsubscribe();
292
+ }
287
293
  }
288
294
  }
289
295
  update(configStore.getState());
@@ -624,6 +630,7 @@ function validateArrayStructure(arraySchema, value, keyPath) {
624
630
  * @returns true if validation passes, false otherwise
625
631
  */ function checkType(keyPath, _type, value) {
626
632
  if (_type) {
633
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
627
634
  const validator = {
628
635
  Array: isArray,
629
636
  Boolean: isBoolean,
@@ -644,7 +651,8 @@ function validateArrayStructure(arraySchema, value, keyPath) {
644
651
  /**
645
652
  * Runs validators, logging errors.
646
653
  * @returns true if all pass, false otherwise.
647
- */ function runValidators(keyPath, validators, value) {
654
+ */ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
655
+ function runValidators(keyPath, validators, value) {
648
656
  let returnValue = true;
649
657
  if (validators) {
650
658
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-config",
3
- "version": "6.3.1-pre.3105",
3
+ "version": "6.3.1-pre.3119",
4
4
  "license": "MPL-2.0",
5
5
  "description": "A configuration library for the OpenMRS Single-Spa framework.",
6
6
  "type": "module",
@@ -61,9 +61,9 @@
61
61
  "single-spa": "6.x"
62
62
  },
63
63
  "devDependencies": {
64
- "@openmrs/esm-globals": "6.3.1-pre.3105",
65
- "@openmrs/esm-state": "6.3.1-pre.3105",
66
- "@openmrs/esm-utils": "6.3.1-pre.3105",
64
+ "@openmrs/esm-globals": "6.3.1-pre.3119",
65
+ "@openmrs/esm-state": "6.3.1-pre.3119",
66
+ "@openmrs/esm-utils": "6.3.1-pre.3119",
67
67
  "@swc/cli": "^0.7.7",
68
68
  "@swc/core": "^1.11.29",
69
69
  "@types/ramda": "^0.26.44",
@@ -281,7 +281,10 @@ export function getConfig<T = Record<string, any>>(moduleName: string): Promise<
281
281
  if (state.loaded && state.config) {
282
282
  const config = omit(['Display conditions', 'Translation overrides'], state.config);
283
283
  resolve(config as T);
284
- unsubscribe && unsubscribe();
284
+
285
+ if (unsubscribe) {
286
+ unsubscribe();
287
+ }
285
288
  }
286
289
  }
287
290
  update(store.getState());
@@ -302,7 +305,10 @@ export function getTranslationOverrides(
302
305
  if (state.translationOverridesLoaded && state.config) {
303
306
  const translationOverrides = state.config['Translation overrides'] ?? {};
304
307
  resolve(translationOverrides);
305
- unsubscribe && unsubscribe();
308
+
309
+ if (unsubscribe) {
310
+ unsubscribe();
311
+ }
306
312
  }
307
313
  }
308
314
  update(configStore.getState());
@@ -318,7 +324,10 @@ export function getTranslationOverrides(
318
324
  if (state.loaded && state.config) {
319
325
  const translationOverrides = state.config['Translation overrides'] ?? {};
320
326
  resolve(translationOverrides);
321
- unsubscribe && unsubscribe();
327
+
328
+ if (unsubscribe) {
329
+ unsubscribe();
330
+ }
322
331
  }
323
332
  }
324
333
  update(configStore.getState());
@@ -715,6 +724,7 @@ function runAllValidatorsInConfigTree(schema: ConfigSchema, config: ConfigObject
715
724
  */
716
725
  function checkType(keyPath: string, _type: Type | undefined, value: any) {
717
726
  if (_type) {
727
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
718
728
  const validator: Record<string, Function> = {
719
729
  Array: isArray,
720
730
  Boolean: isBoolean,
@@ -735,6 +745,7 @@ function checkType(keyPath: string, _type: Type | undefined, value: any) {
735
745
  * Runs validators, logging errors.
736
746
  * @returns true if all pass, false otherwise.
737
747
  */
748
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
738
749
  function runValidators(keyPath: string, validators: Array<Function> | undefined, value: any) {
739
750
  let returnValue = true;
740
751
  if (validators) {
@@ -811,7 +822,7 @@ const setDefaults = (schema: ConfigSchema, inputConfig: Config) => {
811
822
  return config;
812
823
  };
813
824
 
814
- function hasObjectSchema(elementsSchema: Object | undefined): elementsSchema is ConfigSchema {
825
+ function hasObjectSchema(elementsSchema: unknown): elementsSchema is ConfigSchema {
815
826
  return (
816
827
  !!elementsSchema && Object.keys(elementsSchema).filter((e) => !['_default', '_validators'].includes(e)).length > 0
817
828
  );