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

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 (205.63ms)
1
+ [0] Successfully compiled: 8 files with swc (193.04ms)
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
@@ -1,5 +1,5 @@
1
1
  import { type StoreApi } from 'zustand';
2
- import type { Config, ConfigObject, ConfigSchema, ExtensionSlotConfigObject, ProvidedConfig } from '../types';
2
+ import type { Config, ConfigObject, ConfigSchema, ExtensionSlotConfig, ProvidedConfig } from '../types';
3
3
  /**
4
4
  * Internal store
5
5
  * A store of the inputs and internal state
@@ -70,7 +70,7 @@ export declare function getConfigStore(moduleName: string): StoreApi<ConfigStore
70
70
  export interface ExtensionSlotsConfigStore {
71
71
  slots: {
72
72
  [slotName: string]: {
73
- config: ExtensionSlotConfigObject;
73
+ config: ExtensionSlotConfig;
74
74
  loaded: boolean;
75
75
  };
76
76
  };
@@ -79,12 +79,12 @@ export interface ExtensionSlotsConfigStore {
79
79
  export declare function getExtensionSlotsConfigStore(): StoreApi<ExtensionSlotsConfigStore>;
80
80
  /** @internal */
81
81
  export declare function getExtensionSlotConfig(slotName: string): {
82
- config: ExtensionSlotConfigObject;
82
+ config: ExtensionSlotConfig;
83
83
  loaded: boolean;
84
84
  };
85
85
  /** @internal */
86
86
  export declare function getExtensionSlotConfigFromStore(state: ExtensionSlotsConfigStore, slotName: string): {
87
- config: ExtensionSlotConfigObject;
87
+ config: ExtensionSlotConfig;
88
88
  loaded: boolean;
89
89
  };
90
90
  /** @internal */
@@ -104,6 +104,8 @@ export declare function getExtensionsConfigStore(): StoreApi<ExtensionsConfigSto
104
104
  export declare function getExtensionConfig(slotName: string, extensionId: string): StoreApi<Omit<ConfigStore, 'translationOverridesLoaded'>>;
105
105
  /** @internal */
106
106
  export declare function getExtensionConfigFromStore(state: ExtensionsConfigStore, slotName: string, extensionId: string): ConfigStore;
107
+ /** @internal */
108
+ export declare function getExtensionConfigFromExtensionSlotStore(state: ExtensionSlotConfig, slotName: string, extensionId: string): object | null;
107
109
  /**
108
110
  * A store of the implementer tools output config
109
111
  * @internal
@@ -1,4 +1,4 @@
1
- /** @module @category Config */ import { createGlobalStore, getGlobalStore } from "@openmrs/esm-state";
1
+ import { createGlobalStore, getGlobalStore } from "@openmrs/esm-state";
2
2
  import { shallowEqual } from "@openmrs/esm-utils";
3
3
  const configInternalStoreInitialValue = {
4
4
  providedConfigs: [],
@@ -111,6 +111,10 @@ function initializeConfigStore() {
111
111
  config: null
112
112
  };
113
113
  }
114
+ /** @internal */ export function getExtensionConfigFromExtensionSlotStore(state, slotName, extensionId) {
115
+ const extensionConfig = state.configure?.[extensionId];
116
+ return extensionConfig ?? null;
117
+ }
114
118
  /** @internal */ export const implementerToolsConfigStore = createGlobalStore('config-implementer-tools', {
115
119
  config: {}
116
120
  });
package/dist/types.d.ts CHANGED
@@ -38,22 +38,17 @@ export interface DisplayConditionsConfigObject {
38
38
  }
39
39
  export type ConfigValue = string | number | boolean | void | Array<any> | object;
40
40
  export interface ExtensionSlotConfig {
41
+ /** Additional extension IDs to assign to this slot, in addition to those `attach`ed in code. */
41
42
  add?: Array<string>;
43
+ /** Extension IDs which were `attach`ed to the slot but which should not be assigned. */
42
44
  remove?: Array<string>;
45
+ /** Overrides the default ordering of extensions. */
43
46
  order?: Array<string>;
44
47
  configure?: ExtensionSlotConfigureValueObject;
45
48
  }
46
49
  export interface ExtensionSlotConfigureValueObject {
47
50
  [key: string]: object;
48
51
  }
49
- export interface ExtensionSlotConfigObject {
50
- /** Additional extension IDs to assign to this slot, in addition to those `attach`ed in code. */
51
- add?: Array<string>;
52
- /** Extension IDs which were `attach`ed to the slot but which should not be assigned. */
53
- remove?: Array<string>;
54
- /** Overrides the default ordering of extensions. */
55
- order?: Array<string>;
56
- }
57
52
  export type ProvidedConfig = {
58
53
  source: string;
59
54
  config: Config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-config",
3
- "version": "6.3.1-pre.3119",
3
+ "version": "6.3.1-pre.3127",
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.3119",
65
- "@openmrs/esm-state": "6.3.1-pre.3119",
66
- "@openmrs/esm-utils": "6.3.1-pre.3119",
64
+ "@openmrs/esm-globals": "6.3.1-pre.3127",
65
+ "@openmrs/esm-state": "6.3.1-pre.3127",
66
+ "@openmrs/esm-utils": "6.3.1-pre.3127",
67
67
  "@swc/cli": "^0.7.7",
68
68
  "@swc/core": "^1.11.29",
69
69
  "@types/ramda": "^0.26.44",
@@ -1,6 +1,6 @@
1
1
  /** @module @category Config */
2
2
  import { clone, reduce, mergeDeepRight, equals, omit } from 'ramda';
3
- import type { Config, ConfigObject, ConfigSchema, ExtensionSlotConfig, ExtensionSlotConfigObject } from '../types';
3
+ import type { Config, ConfigObject, ConfigSchema, ExtensionSlotConfig } from '../types';
4
4
  import { Type } from '../types';
5
5
  import { isArray, isBoolean, isUuid, isNumber, isObject, isString } from '../validators/type-validators';
6
6
  import { validator } from '../validators/validator';
@@ -440,7 +440,7 @@ function createValuesAndSourcesTree(config: ConfigObject, source: string) {
440
440
  function getExtensionSlotConfigs(
441
441
  configState: ConfigInternalStore,
442
442
  tempConfigState: TemporaryConfigStore,
443
- ): Record<string, ExtensionSlotConfigObject> {
443
+ ): Record<string, ExtensionSlotConfig> {
444
444
  const allConfigs = mergeConfigs(getProvidedConfigs(configState, tempConfigState));
445
445
  const slotConfigPerModule: Record<string, Record<string, ExtensionSlotConfig>> = Object.keys(allConfigs).reduce(
446
446
  (obj, key) => {
@@ -1,8 +1,7 @@
1
- /** @module @category Config */
2
1
  import { createGlobalStore, getGlobalStore } from '@openmrs/esm-state';
3
2
  import { shallowEqual } from '@openmrs/esm-utils';
4
3
  import { type StoreApi } from 'zustand';
5
- import type { Config, ConfigObject, ConfigSchema, ExtensionSlotConfigObject, ProvidedConfig } from '../types';
4
+ import type { Config, ConfigObject, ConfigSchema, ExtensionSlotConfig, ProvidedConfig } from '../types';
6
5
 
7
6
  /**
8
7
  * Internal store
@@ -123,7 +122,7 @@ export function getConfigStore(moduleName: string) {
123
122
  export interface ExtensionSlotsConfigStore {
124
123
  slots: {
125
124
  [slotName: string]: {
126
- config: ExtensionSlotConfigObject;
125
+ config: ExtensionSlotConfig;
127
126
  loaded: boolean;
128
127
  };
129
128
  };
@@ -235,6 +234,16 @@ export function getExtensionConfigFromStore(state: ExtensionsConfigStore, slotNa
235
234
  return extensionConfig ?? { loaded: false, config: null };
236
235
  }
237
236
 
237
+ /** @internal */
238
+ export function getExtensionConfigFromExtensionSlotStore(
239
+ state: ExtensionSlotConfig,
240
+ slotName: string,
241
+ extensionId: string,
242
+ ) {
243
+ const extensionConfig = state.configure?.[extensionId];
244
+ return extensionConfig ?? null;
245
+ }
246
+
238
247
  /**
239
248
  * A store of the implementer tools output config
240
249
  * @internal
package/src/types.ts CHANGED
@@ -46,8 +46,11 @@ export interface DisplayConditionsConfigObject {
46
46
  export type ConfigValue = string | number | boolean | void | Array<any> | object;
47
47
 
48
48
  export interface ExtensionSlotConfig {
49
+ /** Additional extension IDs to assign to this slot, in addition to those `attach`ed in code. */
49
50
  add?: Array<string>;
51
+ /** Extension IDs which were `attach`ed to the slot but which should not be assigned. */
50
52
  remove?: Array<string>;
53
+ /** Overrides the default ordering of extensions. */
51
54
  order?: Array<string>;
52
55
  configure?: ExtensionSlotConfigureValueObject;
53
56
  }
@@ -56,15 +59,6 @@ export interface ExtensionSlotConfigureValueObject {
56
59
  [key: string]: object;
57
60
  }
58
61
 
59
- export interface ExtensionSlotConfigObject {
60
- /** Additional extension IDs to assign to this slot, in addition to those `attach`ed in code. */
61
- add?: Array<string>;
62
- /** Extension IDs which were `attach`ed to the slot but which should not be assigned. */
63
- remove?: Array<string>;
64
- /** Overrides the default ordering of extensions. */
65
- order?: Array<string>;
66
- }
67
-
68
62
  export type ProvidedConfig = {
69
63
  source: string;
70
64
  config: Config;