@openmrs/esm-extensions 7.0.1-pre.3273 → 7.0.1-pre.3279
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/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/workspaces.d.ts +1 -1
- package/dist/workspaces.js +1 -1
- package/package.json +7 -7
- package/src/index.ts +0 -1
- package/src/workspaces.ts +1 -1
- package/dist/workspaces2.d.ts +0 -51
- package/dist/workspaces2.js +0 -112
- package/src/workspaces2.ts +0 -149
package/.turbo/turbo-build.log
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/workspaces.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ export declare function registerWorkspaceGroup(workspaceGroup: WorkspaceGroupReg
|
|
|
52
52
|
*/
|
|
53
53
|
export declare function getWorkspaceRegistration(name: string): WorkspaceRegistration;
|
|
54
54
|
/**
|
|
55
|
-
* This provides the workspace group registration and is also
|
|
55
|
+
* This provides the workspace group registration and is also compatibile with the
|
|
56
56
|
* old way of registering workspace groups (as extensions), but isn't recommended.
|
|
57
57
|
*
|
|
58
58
|
* @param name of the workspace
|
package/dist/workspaces.js
CHANGED
|
@@ -99,7 +99,7 @@ const workspaceExtensionWarningsIssued = new Set();
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
|
-
* This provides the workspace group registration and is also
|
|
102
|
+
* This provides the workspace group registration and is also compatibile with the
|
|
103
103
|
* old way of registering workspace groups (as extensions), but isn't recommended.
|
|
104
104
|
*
|
|
105
105
|
* @param name of the workspace
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-extensions",
|
|
3
|
-
"version": "7.0.1-pre.
|
|
3
|
+
"version": "7.0.1-pre.3279",
|
|
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": "7.0.1-pre.
|
|
68
|
-
"@openmrs/esm-config": "7.0.1-pre.
|
|
69
|
-
"@openmrs/esm-expression-evaluator": "7.0.1-pre.
|
|
70
|
-
"@openmrs/esm-feature-flags": "7.0.1-pre.
|
|
71
|
-
"@openmrs/esm-state": "7.0.1-pre.
|
|
72
|
-
"@openmrs/esm-utils": "7.0.1-pre.
|
|
67
|
+
"@openmrs/esm-api": "7.0.1-pre.3279",
|
|
68
|
+
"@openmrs/esm-config": "7.0.1-pre.3279",
|
|
69
|
+
"@openmrs/esm-expression-evaluator": "7.0.1-pre.3279",
|
|
70
|
+
"@openmrs/esm-feature-flags": "7.0.1-pre.3279",
|
|
71
|
+
"@openmrs/esm-state": "7.0.1-pre.3279",
|
|
72
|
+
"@openmrs/esm-utils": "7.0.1-pre.3279",
|
|
73
73
|
"@swc/cli": "^0.7.7",
|
|
74
74
|
"@swc/core": "^1.11.29",
|
|
75
75
|
"concurrently": "^9.1.2",
|
package/src/index.ts
CHANGED
package/src/workspaces.ts
CHANGED
|
@@ -152,7 +152,7 @@ export function getWorkspaceRegistration(name: string): WorkspaceRegistration {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
/**
|
|
155
|
-
* This provides the workspace group registration and is also
|
|
155
|
+
* This provides the workspace group registration and is also compatibile with the
|
|
156
156
|
* old way of registering workspace groups (as extensions), but isn't recommended.
|
|
157
157
|
*
|
|
158
158
|
* @param name of the workspace
|
package/dist/workspaces2.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { type WorkspaceDefinition2, type WorkspaceGroupDefinition2, type WorkspaceWindowDefinition2 } from '@openmrs/esm-globals';
|
|
2
|
-
export interface OpenedWorkspace {
|
|
3
|
-
workspaceName: string;
|
|
4
|
-
props: Record<string, any> | null;
|
|
5
|
-
hasUnsavedChanges: boolean;
|
|
6
|
-
/** Unique identifier for the workspace instance, used to track unique instances of the same workspace */
|
|
7
|
-
uuid: string;
|
|
8
|
-
}
|
|
9
|
-
export interface OpenedWindow {
|
|
10
|
-
windowName: string;
|
|
11
|
-
/** Root workspace at index 0, child workspaces follow */
|
|
12
|
-
openedWorkspaces: Array<OpenedWorkspace>;
|
|
13
|
-
props: Record<string, any> | null;
|
|
14
|
-
maximized: boolean;
|
|
15
|
-
hidden: boolean;
|
|
16
|
-
}
|
|
17
|
-
export interface WorkspaceStoreState2 {
|
|
18
|
-
registeredGroupsByName: Record<string, WorkspaceGroupDefinition2>;
|
|
19
|
-
registeredWindowsByName: Record<string, WorkspaceWindowDefinition2 & {
|
|
20
|
-
moduleName: string;
|
|
21
|
-
}>;
|
|
22
|
-
registeredWorkspacesByName: Record<string, WorkspaceDefinition2 & {
|
|
23
|
-
moduleName: string;
|
|
24
|
-
}>;
|
|
25
|
-
openedGroup: {
|
|
26
|
-
groupName: string;
|
|
27
|
-
props: Record<string, any> | null;
|
|
28
|
-
} | null;
|
|
29
|
-
/** Most recently opened window at the end of array. Each element has a unique windowName */
|
|
30
|
-
openedWindows: Array<OpenedWindow>;
|
|
31
|
-
workspaceTitleByWorkspaceName: Record<string, string>;
|
|
32
|
-
}
|
|
33
|
-
export declare const workspace2Store: import("zustand").StoreApi<WorkspaceStoreState2>;
|
|
34
|
-
/**
|
|
35
|
-
* Given a workspace name, return the window that the workspace belongs to
|
|
36
|
-
* @param workspaceName
|
|
37
|
-
* @returns
|
|
38
|
-
*/
|
|
39
|
-
export declare function getWindowByWorkspaceName(workspaceName: string): WorkspaceWindowDefinition2 & {
|
|
40
|
-
moduleName: string;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Given a window name, return the group that the window belongs to
|
|
44
|
-
* @param windowName
|
|
45
|
-
* @returns
|
|
46
|
-
*/
|
|
47
|
-
export declare function getGroupByWindowName(windowName: string): WorkspaceGroupDefinition2;
|
|
48
|
-
export declare function getOpenedWindowIndexByWorkspace(workspaceName: string): number;
|
|
49
|
-
export declare function registerWorkspaceGroups2(workspaceGroupDefs: Array<WorkspaceGroupDefinition2>): void;
|
|
50
|
-
export declare function registerWorkspaceWindows2(appName: string, workspaceWindowDefs: Array<WorkspaceWindowDefinition2>): void;
|
|
51
|
-
export declare function registerWorkspaces2(moduleName: string, workspaceDefs: Array<WorkspaceDefinition2>): void;
|
package/dist/workspaces2.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { createGlobalStore } from "@openmrs/esm-state";
|
|
2
|
-
const initialState = {
|
|
3
|
-
registeredGroupsByName: {},
|
|
4
|
-
registeredWindowsByName: {},
|
|
5
|
-
registeredWorkspacesByName: {},
|
|
6
|
-
openedGroup: null,
|
|
7
|
-
openedWindows: [],
|
|
8
|
-
workspaceTitleByWorkspaceName: {}
|
|
9
|
-
};
|
|
10
|
-
export const workspace2Store = createGlobalStore('workspace2', initialState);
|
|
11
|
-
/**
|
|
12
|
-
* Given a workspace name, return the window that the workspace belongs to
|
|
13
|
-
* @param workspaceName
|
|
14
|
-
* @returns
|
|
15
|
-
*/ export function getWindowByWorkspaceName(workspaceName) {
|
|
16
|
-
const { registeredWorkspacesByName, registeredWindowsByName } = workspace2Store.getState();
|
|
17
|
-
const workspace = registeredWorkspacesByName[workspaceName];
|
|
18
|
-
if (!workspace) {
|
|
19
|
-
throw new Error(`No workspace found with name: ${workspaceName}`);
|
|
20
|
-
} else {
|
|
21
|
-
const workspaceWindow = registeredWindowsByName[workspace.window];
|
|
22
|
-
if (!workspaceWindow) {
|
|
23
|
-
throw new Error(`No workspace window found with name: ${workspace.window} for workspace: ${workspaceName}`);
|
|
24
|
-
} else {
|
|
25
|
-
return workspaceWindow;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Given a window name, return the group that the window belongs to
|
|
31
|
-
* @param windowName
|
|
32
|
-
* @returns
|
|
33
|
-
*/ export function getGroupByWindowName(windowName) {
|
|
34
|
-
const { registeredGroupsByName, registeredWindowsByName } = workspace2Store.getState();
|
|
35
|
-
const workspaceWindow = registeredWindowsByName[windowName];
|
|
36
|
-
if (!workspaceWindow) {
|
|
37
|
-
throw new Error(`No workspace window found with name: ${windowName}`);
|
|
38
|
-
} else {
|
|
39
|
-
const group = registeredGroupsByName[workspaceWindow.group];
|
|
40
|
-
if (!group) {
|
|
41
|
-
throw new Error(`No workspace group found with name: ${workspaceWindow.group} for window: ${windowName}`);
|
|
42
|
-
} else {
|
|
43
|
-
return group;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
export function getOpenedWindowIndexByWorkspace(workspaceName) {
|
|
48
|
-
const { openedWindows } = workspace2Store.getState();
|
|
49
|
-
return openedWindows.findIndex((a)=>a.openedWorkspaces.find((openedWorkspace)=>openedWorkspace.workspaceName === workspaceName));
|
|
50
|
-
}
|
|
51
|
-
export function registerWorkspaceGroups2(workspaceGroupDefs) {
|
|
52
|
-
if (workspaceGroupDefs.length == 0) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
const { registeredGroupsByName } = workspace2Store.getState();
|
|
56
|
-
const newRegisteredGroupsByName = {
|
|
57
|
-
...registeredGroupsByName
|
|
58
|
-
};
|
|
59
|
-
for (const workspaceGroupDef of workspaceGroupDefs){
|
|
60
|
-
if (newRegisteredGroupsByName[workspaceGroupDef.name]) {
|
|
61
|
-
throw new Error(`Cannot register workspace group ${workspaceGroupDef.name} more than once`);
|
|
62
|
-
}
|
|
63
|
-
newRegisteredGroupsByName[workspaceGroupDef.name] = workspaceGroupDef;
|
|
64
|
-
}
|
|
65
|
-
workspace2Store.setState({
|
|
66
|
-
registeredGroupsByName: newRegisteredGroupsByName
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
export function registerWorkspaceWindows2(appName, workspaceWindowDefs) {
|
|
70
|
-
if (workspaceWindowDefs.length == 0) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
const { registeredWindowsByName } = workspace2Store.getState();
|
|
74
|
-
const newRegisteredWindowsByName = {
|
|
75
|
-
...registeredWindowsByName
|
|
76
|
-
};
|
|
77
|
-
for (const windowDef of workspaceWindowDefs){
|
|
78
|
-
if (newRegisteredWindowsByName[windowDef.name]) {
|
|
79
|
-
throw new Error(`Cannot register workspace window ${windowDef.name} more than once`);
|
|
80
|
-
}
|
|
81
|
-
const registeredWindowDef = {
|
|
82
|
-
...windowDef,
|
|
83
|
-
moduleName: appName
|
|
84
|
-
};
|
|
85
|
-
newRegisteredWindowsByName[windowDef.name] = registeredWindowDef;
|
|
86
|
-
}
|
|
87
|
-
workspace2Store.setState({
|
|
88
|
-
registeredWindowsByName: newRegisteredWindowsByName
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
export function registerWorkspaces2(moduleName, workspaceDefs) {
|
|
92
|
-
if (workspaceDefs.length == 0) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const { registeredWorkspacesByName } = workspace2Store.getState();
|
|
96
|
-
const newRegisteredWorkspacesByName = {
|
|
97
|
-
...registeredWorkspacesByName
|
|
98
|
-
};
|
|
99
|
-
for (const workspaceDef of workspaceDefs){
|
|
100
|
-
if (newRegisteredWorkspacesByName[workspaceDef.name]) {
|
|
101
|
-
throw new Error(`Cannot register workspace ${workspaceDef.name} more than once`);
|
|
102
|
-
}
|
|
103
|
-
const workspaceDefWithLoader = {
|
|
104
|
-
...workspaceDef,
|
|
105
|
-
moduleName
|
|
106
|
-
};
|
|
107
|
-
newRegisteredWorkspacesByName[workspaceDef.name] = workspaceDefWithLoader;
|
|
108
|
-
}
|
|
109
|
-
workspace2Store.setState({
|
|
110
|
-
registeredWorkspacesByName: newRegisteredWorkspacesByName
|
|
111
|
-
});
|
|
112
|
-
}
|
package/src/workspaces2.ts
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type WorkspaceDefinition2,
|
|
3
|
-
type WorkspaceGroupDefinition2,
|
|
4
|
-
type WorkspaceWindowDefinition2,
|
|
5
|
-
} from '@openmrs/esm-globals';
|
|
6
|
-
import { createGlobalStore } from '@openmrs/esm-state';
|
|
7
|
-
|
|
8
|
-
export interface OpenedWorkspace {
|
|
9
|
-
workspaceName: string;
|
|
10
|
-
props: Record<string, any> | null;
|
|
11
|
-
hasUnsavedChanges: boolean;
|
|
12
|
-
/** Unique identifier for the workspace instance, used to track unique instances of the same workspace */
|
|
13
|
-
uuid: string;
|
|
14
|
-
}
|
|
15
|
-
export interface OpenedWindow {
|
|
16
|
-
windowName: string;
|
|
17
|
-
/** Root workspace at index 0, child workspaces follow */
|
|
18
|
-
openedWorkspaces: Array<OpenedWorkspace>;
|
|
19
|
-
props: Record<string, any> | null;
|
|
20
|
-
maximized: boolean;
|
|
21
|
-
hidden: boolean;
|
|
22
|
-
}
|
|
23
|
-
export interface WorkspaceStoreState2 {
|
|
24
|
-
registeredGroupsByName: Record<string, WorkspaceGroupDefinition2>;
|
|
25
|
-
registeredWindowsByName: Record<string, WorkspaceWindowDefinition2 & { moduleName: string }>;
|
|
26
|
-
registeredWorkspacesByName: Record<string, WorkspaceDefinition2 & { moduleName: string }>;
|
|
27
|
-
openedGroup: {
|
|
28
|
-
groupName: string;
|
|
29
|
-
props: Record<string, any> | null;
|
|
30
|
-
} | null;
|
|
31
|
-
/** Most recently opened window at the end of array. Each element has a unique windowName */
|
|
32
|
-
openedWindows: Array<OpenedWindow>;
|
|
33
|
-
|
|
34
|
-
workspaceTitleByWorkspaceName: Record<string, string>;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const initialState: WorkspaceStoreState2 = {
|
|
38
|
-
registeredGroupsByName: {},
|
|
39
|
-
registeredWindowsByName: {},
|
|
40
|
-
registeredWorkspacesByName: {},
|
|
41
|
-
openedGroup: null,
|
|
42
|
-
openedWindows: [],
|
|
43
|
-
workspaceTitleByWorkspaceName: {},
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const workspace2Store = createGlobalStore<WorkspaceStoreState2>('workspace2', initialState);
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Given a workspace name, return the window that the workspace belongs to
|
|
50
|
-
* @param workspaceName
|
|
51
|
-
* @returns
|
|
52
|
-
*/
|
|
53
|
-
export function getWindowByWorkspaceName(workspaceName: string) {
|
|
54
|
-
const { registeredWorkspacesByName, registeredWindowsByName } = workspace2Store.getState();
|
|
55
|
-
const workspace = registeredWorkspacesByName[workspaceName];
|
|
56
|
-
if (!workspace) {
|
|
57
|
-
throw new Error(`No workspace found with name: ${workspaceName}`);
|
|
58
|
-
} else {
|
|
59
|
-
const workspaceWindow = registeredWindowsByName[workspace.window];
|
|
60
|
-
if (!workspaceWindow) {
|
|
61
|
-
throw new Error(`No workspace window found with name: ${workspace.window} for workspace: ${workspaceName}`);
|
|
62
|
-
} else {
|
|
63
|
-
return workspaceWindow;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Given a window name, return the group that the window belongs to
|
|
70
|
-
* @param windowName
|
|
71
|
-
* @returns
|
|
72
|
-
*/
|
|
73
|
-
export function getGroupByWindowName(windowName: string) {
|
|
74
|
-
const { registeredGroupsByName, registeredWindowsByName } = workspace2Store.getState();
|
|
75
|
-
const workspaceWindow = registeredWindowsByName[windowName];
|
|
76
|
-
if (!workspaceWindow) {
|
|
77
|
-
throw new Error(`No workspace window found with name: ${windowName}`);
|
|
78
|
-
} else {
|
|
79
|
-
const group = registeredGroupsByName[workspaceWindow.group];
|
|
80
|
-
if (!group) {
|
|
81
|
-
throw new Error(`No workspace group found with name: ${workspaceWindow.group} for window: ${windowName}`);
|
|
82
|
-
} else {
|
|
83
|
-
return group;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export function getOpenedWindowIndexByWorkspace(workspaceName: string) {
|
|
89
|
-
const { openedWindows } = workspace2Store.getState();
|
|
90
|
-
return openedWindows.findIndex((a) =>
|
|
91
|
-
a.openedWorkspaces.find((openedWorkspace) => openedWorkspace.workspaceName === workspaceName),
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export function registerWorkspaceGroups2(workspaceGroupDefs: Array<WorkspaceGroupDefinition2>) {
|
|
96
|
-
if (workspaceGroupDefs.length == 0) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
const { registeredGroupsByName } = workspace2Store.getState();
|
|
100
|
-
const newRegisteredGroupsByName = { ...registeredGroupsByName };
|
|
101
|
-
for (const workspaceGroupDef of workspaceGroupDefs) {
|
|
102
|
-
if (newRegisteredGroupsByName[workspaceGroupDef.name]) {
|
|
103
|
-
throw new Error(`Cannot register workspace group ${workspaceGroupDef.name} more than once`);
|
|
104
|
-
}
|
|
105
|
-
newRegisteredGroupsByName[workspaceGroupDef.name] = workspaceGroupDef;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
workspace2Store.setState({
|
|
109
|
-
registeredGroupsByName: newRegisteredGroupsByName,
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export function registerWorkspaceWindows2(appName: string, workspaceWindowDefs: Array<WorkspaceWindowDefinition2>) {
|
|
114
|
-
if (workspaceWindowDefs.length == 0) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
const { registeredWindowsByName } = workspace2Store.getState();
|
|
118
|
-
const newRegisteredWindowsByName = { ...registeredWindowsByName };
|
|
119
|
-
for (const windowDef of workspaceWindowDefs) {
|
|
120
|
-
if (newRegisteredWindowsByName[windowDef.name]) {
|
|
121
|
-
throw new Error(`Cannot register workspace window ${windowDef.name} more than once`);
|
|
122
|
-
}
|
|
123
|
-
const registeredWindowDef = { ...windowDef, moduleName: appName };
|
|
124
|
-
newRegisteredWindowsByName[windowDef.name] = registeredWindowDef;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
workspace2Store.setState({
|
|
128
|
-
registeredWindowsByName: newRegisteredWindowsByName,
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export function registerWorkspaces2(moduleName: string, workspaceDefs: Array<WorkspaceDefinition2>) {
|
|
133
|
-
if (workspaceDefs.length == 0) {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
const { registeredWorkspacesByName } = workspace2Store.getState();
|
|
137
|
-
const newRegisteredWorkspacesByName = { ...registeredWorkspacesByName };
|
|
138
|
-
for (const workspaceDef of workspaceDefs) {
|
|
139
|
-
if (newRegisteredWorkspacesByName[workspaceDef.name]) {
|
|
140
|
-
throw new Error(`Cannot register workspace ${workspaceDef.name} more than once`);
|
|
141
|
-
}
|
|
142
|
-
const workspaceDefWithLoader = { ...workspaceDef, moduleName };
|
|
143
|
-
newRegisteredWorkspacesByName[workspaceDef.name] = workspaceDefWithLoader;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
workspace2Store.setState({
|
|
147
|
-
registeredWorkspacesByName: newRegisteredWorkspacesByName,
|
|
148
|
-
});
|
|
149
|
-
}
|