@openmrs/esm-config 6.3.1-pre.3119 → 6.3.1-pre.3124
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/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type StoreApi } from 'zustand';
|
|
2
|
-
import type { Config, ConfigObject, ConfigSchema,
|
|
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:
|
|
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:
|
|
82
|
+
config: ExtensionSlotConfig;
|
|
83
83
|
loaded: boolean;
|
|
84
84
|
};
|
|
85
85
|
/** @internal */
|
|
86
86
|
export declare function getExtensionSlotConfigFromStore(state: ExtensionSlotsConfigStore, slotName: string): {
|
|
87
|
-
config:
|
|
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
|
|
@@ -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.
|
|
3
|
+
"version": "6.3.1-pre.3124",
|
|
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.
|
|
65
|
-
"@openmrs/esm-state": "6.3.1-pre.
|
|
66
|
-
"@openmrs/esm-utils": "6.3.1-pre.
|
|
64
|
+
"@openmrs/esm-globals": "6.3.1-pre.3124",
|
|
65
|
+
"@openmrs/esm-state": "6.3.1-pre.3124",
|
|
66
|
+
"@openmrs/esm-utils": "6.3.1-pre.3124",
|
|
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
|
|
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,
|
|
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) => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createGlobalStore, getGlobalStore } from '@openmrs/esm-state';
|
|
3
3
|
import { shallowEqual } from '@openmrs/esm-utils';
|
|
4
4
|
import { type StoreApi } from 'zustand';
|
|
5
|
-
import type { Config, ConfigObject, ConfigSchema,
|
|
5
|
+
import type { Config, ConfigObject, ConfigSchema, ExtensionSlotConfig, ProvidedConfig } from '../types';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Internal store
|
|
@@ -123,7 +123,7 @@ export function getConfigStore(moduleName: string) {
|
|
|
123
123
|
export interface ExtensionSlotsConfigStore {
|
|
124
124
|
slots: {
|
|
125
125
|
[slotName: string]: {
|
|
126
|
-
config:
|
|
126
|
+
config: ExtensionSlotConfig;
|
|
127
127
|
loaded: boolean;
|
|
128
128
|
};
|
|
129
129
|
};
|
|
@@ -235,6 +235,16 @@ export function getExtensionConfigFromStore(state: ExtensionsConfigStore, slotNa
|
|
|
235
235
|
return extensionConfig ?? { loaded: false, config: null };
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
+
/** @internal */
|
|
239
|
+
export function getExtensionConfigFromExtensionSlotStore(
|
|
240
|
+
state: ExtensionSlotConfig,
|
|
241
|
+
slotName: string,
|
|
242
|
+
extensionId: string,
|
|
243
|
+
) {
|
|
244
|
+
const extensionConfig = state.configure?.[extensionId];
|
|
245
|
+
return extensionConfig ?? null;
|
|
246
|
+
}
|
|
247
|
+
|
|
238
248
|
/**
|
|
239
249
|
* A store of the implementer tools output config
|
|
240
250
|
* @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;
|