@openmrs/esm-extensions 6.3.1-pre.3106 → 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 +1 -1
- package/dist/extensions.js +5 -3
- package/dist/store.d.ts +2 -2
- package/package.json +7 -7
- package/src/extensions.ts +9 -5
- package/src/store.ts +2 -2
package/.turbo/turbo-build.log
CHANGED
package/dist/extensions.js
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
* - assigned (computed from attached and configured)
|
|
7
7
|
* - connected (computed from assigned using connectivity and online / offline)
|
|
8
8
|
*/ import { sessionStore, userHasAccess } from "@openmrs/esm-api";
|
|
9
|
-
import { getExtensionConfigFromStore, getExtensionsConfigStore, getExtensionSlotConfig, getExtensionSlotConfigFromStore, getExtensionSlotsConfigStore } from "@openmrs/esm-config";
|
|
9
|
+
import { getExtensionConfigFromStore, getExtensionsConfigStore, getExtensionSlotConfig, getExtensionConfigFromExtensionSlotStore, getExtensionSlotConfigFromStore, getExtensionSlotsConfigStore } from "@openmrs/esm-config";
|
|
10
10
|
import { evaluateAsBoolean } from "@openmrs/esm-expression-evaluator";
|
|
11
11
|
import { featureFlagsStore } from "@openmrs/esm-feature-flags";
|
|
12
12
|
import { subscribeConnectivityChanged } from "@openmrs/esm-globals";
|
|
13
13
|
import { isOnline as isOnlineFn } from "@openmrs/esm-utils";
|
|
14
|
-
import { isEqual } from "lodash-es";
|
|
14
|
+
import { isEqual, merge } from "lodash-es";
|
|
15
15
|
import { checkStatusFor } from "./helpers.js";
|
|
16
16
|
import { getExtensionStore, getExtensionInternalStore, updateInternalExtensionStore } from "./store.js";
|
|
17
17
|
const extensionInternalStore = getExtensionInternalStore();
|
|
@@ -221,7 +221,9 @@ function getAssignedExtensionsFromSlotData(slotName, internalState, config, exte
|
|
|
221
221
|
const assignedIds = calculateAssignedIds(config, attachedIds);
|
|
222
222
|
const extensions = [];
|
|
223
223
|
for (let id of assignedIds){
|
|
224
|
-
const { config:
|
|
224
|
+
const { config: rawExtensionConfig } = getExtensionConfigFromStore(extensionConfigStoreState, slotName, id);
|
|
225
|
+
const rawExtensionSlotExtensionConfig = getExtensionConfigFromExtensionSlotStore(config, slotName, id);
|
|
226
|
+
const extensionConfig = merge(rawExtensionConfig, rawExtensionSlotExtensionConfig);
|
|
225
227
|
const name = getExtensionNameFromId(id);
|
|
226
228
|
const extension = internalState.extensions[name];
|
|
227
229
|
// if the extension has not been registered yet, do not include it
|
package/dist/store.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ConfigObject,
|
|
1
|
+
import type { ConfigObject, ExtensionSlotConfig } from '@openmrs/esm-config';
|
|
2
2
|
import { type LifeCycles } from 'single-spa';
|
|
3
3
|
export interface ExtensionMeta {
|
|
4
4
|
[_: string]: any;
|
|
@@ -49,7 +49,7 @@ export interface ExtensionSlotInfo {
|
|
|
49
49
|
*/
|
|
50
50
|
attachedIds: Array<string>;
|
|
51
51
|
/** The configuration provided for this slot. `null` if not yet loaded. */
|
|
52
|
-
config:
|
|
52
|
+
config: Omit<ExtensionSlotConfig, 'configuration'> | null;
|
|
53
53
|
}
|
|
54
54
|
export interface ExtensionStore {
|
|
55
55
|
slots: Record<string, ExtensionSlotState>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-extensions",
|
|
3
|
-
"version": "6.3.1-pre.
|
|
3
|
+
"version": "6.3.1-pre.3124",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "Coordinates extensions and extension points in the OpenMRS Frontend",
|
|
6
6
|
"type": "module",
|
|
@@ -64,12 +64,12 @@
|
|
|
64
64
|
"single-spa": "6.x"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@openmrs/esm-api": "6.3.1-pre.
|
|
68
|
-
"@openmrs/esm-config": "6.3.1-pre.
|
|
69
|
-
"@openmrs/esm-expression-evaluator": "6.3.1-pre.
|
|
70
|
-
"@openmrs/esm-feature-flags": "6.3.1-pre.
|
|
71
|
-
"@openmrs/esm-state": "6.3.1-pre.
|
|
72
|
-
"@openmrs/esm-utils": "6.3.1-pre.
|
|
67
|
+
"@openmrs/esm-api": "6.3.1-pre.3124",
|
|
68
|
+
"@openmrs/esm-config": "6.3.1-pre.3124",
|
|
69
|
+
"@openmrs/esm-expression-evaluator": "6.3.1-pre.3124",
|
|
70
|
+
"@openmrs/esm-feature-flags": "6.3.1-pre.3124",
|
|
71
|
+
"@openmrs/esm-state": "6.3.1-pre.3124",
|
|
72
|
+
"@openmrs/esm-utils": "6.3.1-pre.3124",
|
|
73
73
|
"@swc/cli": "^0.7.7",
|
|
74
74
|
"@swc/core": "^1.11.29",
|
|
75
75
|
"concurrently": "^9.1.2",
|
package/src/extensions.ts
CHANGED
|
@@ -11,11 +11,12 @@
|
|
|
11
11
|
import { type Session, type SessionStore, sessionStore, userHasAccess } from '@openmrs/esm-api';
|
|
12
12
|
import {
|
|
13
13
|
type ExtensionsConfigStore,
|
|
14
|
-
type
|
|
14
|
+
type ExtensionSlotConfig,
|
|
15
15
|
type ExtensionSlotsConfigStore,
|
|
16
16
|
getExtensionConfigFromStore,
|
|
17
17
|
getExtensionsConfigStore,
|
|
18
18
|
getExtensionSlotConfig,
|
|
19
|
+
getExtensionConfigFromExtensionSlotStore,
|
|
19
20
|
getExtensionSlotConfigFromStore,
|
|
20
21
|
getExtensionSlotsConfigStore,
|
|
21
22
|
} from '@openmrs/esm-config';
|
|
@@ -23,7 +24,7 @@ import { evaluateAsBoolean } from '@openmrs/esm-expression-evaluator';
|
|
|
23
24
|
import { type FeatureFlagsStore, featureFlagsStore } from '@openmrs/esm-feature-flags';
|
|
24
25
|
import { subscribeConnectivityChanged } from '@openmrs/esm-globals';
|
|
25
26
|
import { isOnline as isOnlineFn } from '@openmrs/esm-utils';
|
|
26
|
-
import { isEqual } from 'lodash-es';
|
|
27
|
+
import { isEqual, merge } from 'lodash-es';
|
|
27
28
|
import { checkStatusFor } from './helpers';
|
|
28
29
|
import {
|
|
29
30
|
type AssignedExtension,
|
|
@@ -322,7 +323,7 @@ function getOrder(
|
|
|
322
323
|
function getAssignedExtensionsFromSlotData(
|
|
323
324
|
slotName: string,
|
|
324
325
|
internalState: ExtensionInternalStore,
|
|
325
|
-
config:
|
|
326
|
+
config: ExtensionSlotConfig,
|
|
326
327
|
extensionConfigStoreState: ExtensionsConfigStore,
|
|
327
328
|
enabledFeatureFlags: Array<string>,
|
|
328
329
|
isOnline: boolean,
|
|
@@ -333,7 +334,10 @@ function getAssignedExtensionsFromSlotData(
|
|
|
333
334
|
const extensions: Array<AssignedExtension> = [];
|
|
334
335
|
|
|
335
336
|
for (let id of assignedIds) {
|
|
336
|
-
const { config:
|
|
337
|
+
const { config: rawExtensionConfig } = getExtensionConfigFromStore(extensionConfigStoreState, slotName, id);
|
|
338
|
+
const rawExtensionSlotExtensionConfig = getExtensionConfigFromExtensionSlotStore(config, slotName, id);
|
|
339
|
+
const extensionConfig = merge(rawExtensionConfig, rawExtensionSlotExtensionConfig);
|
|
340
|
+
|
|
337
341
|
const name = getExtensionNameFromId(id);
|
|
338
342
|
const extension = internalState.extensions[name];
|
|
339
343
|
|
|
@@ -418,7 +422,7 @@ export function getAssignedExtensions(slotName: string): Array<AssignedExtension
|
|
|
418
422
|
);
|
|
419
423
|
}
|
|
420
424
|
|
|
421
|
-
function calculateAssignedIds(config:
|
|
425
|
+
function calculateAssignedIds(config: ExtensionSlotConfig, attachedIds: Array<string>) {
|
|
422
426
|
const addedIds = config.add || [];
|
|
423
427
|
const removedIds = config.remove || [];
|
|
424
428
|
const idOrder = config.order || [];
|
package/src/store.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @module @category Extension */
|
|
2
2
|
import { isEqual } from 'lodash-es';
|
|
3
|
-
import type { ConfigExtensionStoreElement, ConfigObject,
|
|
3
|
+
import type { ConfigExtensionStoreElement, ConfigObject, ExtensionSlotConfig } from '@openmrs/esm-config';
|
|
4
4
|
import { configExtensionStore } from '@openmrs/esm-config';
|
|
5
5
|
import { createGlobalStore, getGlobalStore } from '@openmrs/esm-state';
|
|
6
6
|
import { type LifeCycles } from 'single-spa';
|
|
@@ -57,7 +57,7 @@ export interface ExtensionSlotInfo {
|
|
|
57
57
|
*/
|
|
58
58
|
attachedIds: Array<string>;
|
|
59
59
|
/** The configuration provided for this slot. `null` if not yet loaded. */
|
|
60
|
-
config:
|
|
60
|
+
config: Omit<ExtensionSlotConfig, 'configuration'> | null;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
export interface ExtensionStore {
|