@openmrs/esm-routes 10.0.1-pre.5652 → 10.0.1-pre.5664

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: 7 files with swc (91.96ms)
1
+ [0] Successfully compiled: 7 files with swc (230ms)
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,4 +1,4 @@
1
- import { type ExtensionDefinition, type FeatureFlagDefinition, type ModalDefinition, type WorkspaceDefinition, type WorkspaceDefinition2, type WorkspaceGroupDefinition, type WorkspaceGroupDefinition2, type WorkspaceWindowDefinition2 } from '@openmrs/esm-globals';
1
+ import { type ExtensionDefinition, type FeatureFlagDefinition, type ModalDefinition, type WorkspaceDefinition2, type WorkspaceGroupDefinition2, type WorkspaceWindowDefinition2 } from '@openmrs/esm-globals';
2
2
  /**
3
3
  * This function registers an extension definition with the framework and will
4
4
  * attach the extension to any configured slots.
@@ -14,20 +14,6 @@ export declare function tryRegisterExtension(appName: string, extension: Extensi
14
14
  * @param modal An object that describes the modal, derived from `routes.json`
15
15
  */
16
16
  export declare function tryRegisterModal(appName: string, modal: ModalDefinition): void;
17
- /**
18
- * This function registers a workspace definition with the framework so that it can be launched.
19
- *
20
- * @param appName The name of the app defining this workspace
21
- * @param workspace An object that describes the workspace, derived from `routes.json`
22
- */
23
- export declare function tryRegisterWorkspace(appName: string, workspace: WorkspaceDefinition): void;
24
- /**
25
- * This function registers a workspace group definition with the framework so that it can be launched.
26
- *
27
- * @param appName The name of the app defining this workspace
28
- * @param workspace An object that describes the workspace, derived from `routes.json`
29
- */
30
- export declare function tryRegisterWorkspaceGroup(appName: string, workspaceGroup: WorkspaceGroupDefinition): void;
31
17
  export declare function tryRegisterWorkspaceGroups2(appName: string, workspaceGroupDefs: Array<WorkspaceGroupDefinition2>): void;
32
18
  export declare function tryRegisterWorkspace2(appName: string, workspaceDefs: Array<WorkspaceDefinition2>): void;
33
19
  export declare function tryRegisterWorkspaceWindows2(appName: string, workspaceWindowDefs: Array<WorkspaceWindowDefinition2>): void;
@@ -1 +1 @@
1
- {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/loaders/components.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAChC,MAAM,sBAAsB,CAAC;AAI9B;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,QA2CnF;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,QA0BvE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,QAkDnF;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,wBAAwB,QAelG;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,KAAK,CAAC,yBAAyB,CAAC,QAEhH;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,CAAC,oBAAoB,CAAC,QAEhG;AAED,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,KAAK,CAAC,0BAA0B,CAAC,QAiBnH;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,qBAAqB,QAgCzF"}
1
+ {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/loaders/components.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAChC,MAAM,sBAAsB,CAAC;AAI9B;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,QA2CnF;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,QA0BvE;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,KAAK,CAAC,yBAAyB,CAAC,QAEhH;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,CAAC,oBAAoB,CAAC,QAEhG;AAED,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,KAAK,CAAC,0BAA0B,CAAC,QAiBnH;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,qBAAqB,QAgCzF"}
@@ -1,4 +1,4 @@
1
- import { attach, registerExtension, registerModal, registerWorkspace, registerWorkspaceGroup, registerWorkspaceGroups2, registerWorkspaces2, registerWorkspaceWindows2 } from "@openmrs/esm-extensions";
1
+ import { attach, registerExtension, registerModal, registerWorkspaceGroups2, registerWorkspaces2, registerWorkspaceWindows2 } from "@openmrs/esm-extensions";
2
2
  import { registerFeatureFlag } from "@openmrs/esm-feature-flags";
3
3
  import { loadLifeCycles } from "./load-lifecycles.js";
4
4
  /**
@@ -65,68 +65,6 @@ To fix this, ensure that you define a 'component' field inside the modal definit
65
65
  load: ()=>loadLifeCycles(appName, modal.component)
66
66
  });
67
67
  }
68
- /**
69
- * This function registers a workspace definition with the framework so that it can be launched.
70
- *
71
- * @param appName The name of the app defining this workspace
72
- * @param workspace An object that describes the workspace, derived from `routes.json`
73
- */ export function tryRegisterWorkspace(appName, workspace) {
74
- const name = workspace.name;
75
- if (!name) {
76
- console.error(`A workspace definition in ${appName} is missing a name and thus cannot be registered.
77
- To fix this, ensure that you define the "name" field inside the workspace definition.`, workspace);
78
- return;
79
- }
80
- const title = workspace.title;
81
- if (!title) {
82
- console.error(`A workspace definition in ${appName} is missing a title and thus cannot be registered.
83
- To fix this, ensure that you define the "title" field inside the workspace definition.`, workspace);
84
- return;
85
- }
86
- if (!workspace.component) {
87
- console.error(`The workspace ${name} from ${appName} is missing a 'component' entry and thus cannot be registered.
88
- To fix this, ensure that you define a 'component' field inside the workspace definition.`, workspace);
89
- return;
90
- }
91
- registerWorkspace({
92
- name,
93
- title,
94
- component: workspace.component,
95
- moduleName: appName,
96
- type: workspace.type,
97
- canHide: workspace.canHide,
98
- canMaximize: workspace.canMaximize,
99
- width: workspace.width,
100
- preferredWindowSize: workspace.preferredWindowSize,
101
- groups: workspace.groups,
102
- load: ()=>loadLifeCycles(appName, workspace.component)
103
- });
104
- for (const group of workspace.groups || []){
105
- registerWorkspaceGroup({
106
- name: group,
107
- members: [
108
- name
109
- ]
110
- });
111
- }
112
- }
113
- /**
114
- * This function registers a workspace group definition with the framework so that it can be launched.
115
- *
116
- * @param appName The name of the app defining this workspace
117
- * @param workspace An object that describes the workspace, derived from `routes.json`
118
- */ export function tryRegisterWorkspaceGroup(appName, workspaceGroup) {
119
- const name = workspaceGroup.name;
120
- if (!name) {
121
- console.error(`A workspace group definition in ${appName} is missing a name and thus cannot be registered.
122
- To fix this, ensure that you define the "name" field inside the workspace definition.`, workspaceGroup);
123
- return;
124
- }
125
- registerWorkspaceGroup({
126
- name,
127
- members: workspaceGroup.members ?? []
128
- });
129
- }
130
68
  export function tryRegisterWorkspaceGroups2(appName, workspaceGroupDefs) {
131
69
  registerWorkspaceGroups2(appName, workspaceGroupDefs);
132
70
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../src/loaders/pages.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,KAAK,gBAAgB,EAItB,MAAM,sBAAsB,CAAC;AA8D9B;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,QAIpE;AAmGD;;;;GAIG;AACH,wBAAgB,wBAAwB,SAoCvC"}
1
+ {"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../src/loaders/pages.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,gBAAgB,EAGtB,MAAM,sBAAsB,CAAC;AA4D9B;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,QAIpE;AA4ED;;;;GAIG;AACH,wBAAgB,wBAAwB,SAoCvC"}
@@ -3,7 +3,7 @@ import { registerModuleWithConfigSystem } from "@openmrs/esm-config";
3
3
  import { batchExtensionUpdates } from "@openmrs/esm-extensions";
4
4
  import { getFeatureFlag } from "@openmrs/esm-feature-flags";
5
5
  import { routeRegex } from "./helpers.js";
6
- import { tryRegisterExtension, tryRegisterFeatureFlag, tryRegisterModal, tryRegisterWorkspace, tryRegisterWorkspace2, tryRegisterWorkspaceGroup, tryRegisterWorkspaceGroups2, tryRegisterWorkspaceWindows2 } from "./components.js";
6
+ import { tryRegisterExtension, tryRegisterFeatureFlag, tryRegisterModal, tryRegisterWorkspace2, tryRegisterWorkspaceGroups2, tryRegisterWorkspaceWindows2 } from "./components.js";
7
7
  import { loadLifeCycles } from "./load-lifecycles.js";
8
8
  // this is the global holder of all pages registered in the app
9
9
  const pages = [];
@@ -63,8 +63,6 @@ function registerAppRoutes(appName, routes) {
63
63
  registerModuleWithConfigSystem(appName);
64
64
  const availableExtensions = routes.extensions ?? [];
65
65
  const availableModals = routes.modals ?? [];
66
- const availableWorkspaces = routes.workspaces ?? [];
67
- const availableWorkspaceGroups = routes.workspaceGroups ?? [];
68
66
  const availableFeatureFlags = routes.featureFlags ?? [];
69
67
  const availableWorkspaceGroups2 = routes.workspaceGroups2 ?? [];
70
68
  const availableWorkspaceWindows2 = routes.workspaceWindows2 ?? [];
@@ -93,20 +91,9 @@ function registerAppRoutes(appName, routes) {
93
91
  console.warn(`A modal for ${appName} could not be registered as it does not appear to have the required properties`, modal);
94
92
  }
95
93
  });
96
- availableWorkspaces.forEach((workspace)=>{
97
- if (workspace && typeof workspace === 'object' && Object.hasOwn(workspace, 'name') && Object.hasOwn(workspace, 'component')) {
98
- tryRegisterWorkspace(appName, workspace);
99
- } else {
100
- console.warn(`A workspace for ${appName} could not be registered as it does not appear to have the required properties`, workspace);
101
- }
102
- });
103
- availableWorkspaceGroups.forEach((workspaceGroup)=>{
104
- if (workspaceGroup && typeof workspaceGroup === 'object' && Object.hasOwn(workspaceGroup, 'name')) {
105
- tryRegisterWorkspaceGroup(appName, workspaceGroup);
106
- } else {
107
- console.warn(`A workspace group for ${appName} could not be registered as it does not appear to have the required properties`, workspaceGroup);
108
- }
109
- });
94
+ if (Object.hasOwn(routes, 'workspaces') || Object.hasOwn(routes, 'workspaceGroups')) {
95
+ console.warn(`${appName} defines workspaces or workspaceGroups in its routes.json, which are no longer supported and won't be registered. Use workspaces2, workspaceWindows2 and workspaceGroups2 instead.`);
96
+ }
110
97
  tryRegisterWorkspaceGroups2(appName, availableWorkspaceGroups2);
111
98
  tryRegisterWorkspaceWindows2(appName, availableWorkspaceWindows2);
112
99
  tryRegisterWorkspace2(appName, availableWorkspaces2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-routes",
3
- "version": "10.0.1-pre.5652",
3
+ "version": "10.0.1-pre.5664",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Utilities for working with the routes registry",
6
6
  "type": "module",
@@ -47,21 +47,21 @@
47
47
  "access": "public"
48
48
  },
49
49
  "peerDependencies": {
50
- "@openmrs/esm-config": "^10.0.1-pre.5652",
51
- "@openmrs/esm-dynamic-loading": "^10.0.1-pre.5652",
52
- "@openmrs/esm-extensions": "^10.0.1-pre.5652",
53
- "@openmrs/esm-feature-flags": "^10.0.1-pre.5652",
54
- "@openmrs/esm-globals": "^10.0.1-pre.5652",
55
- "@openmrs/esm-utils": "^10.0.1-pre.5652",
50
+ "@openmrs/esm-config": "^10.0.1-pre.5664",
51
+ "@openmrs/esm-dynamic-loading": "^10.0.1-pre.5664",
52
+ "@openmrs/esm-extensions": "^10.0.1-pre.5664",
53
+ "@openmrs/esm-feature-flags": "^10.0.1-pre.5664",
54
+ "@openmrs/esm-globals": "^10.0.1-pre.5664",
55
+ "@openmrs/esm-utils": "^10.0.1-pre.5664",
56
56
  "single-spa": "6.x"
57
57
  },
58
58
  "devDependencies": {
59
- "@openmrs/esm-config": "10.0.1-pre.5652",
60
- "@openmrs/esm-dynamic-loading": "10.0.1-pre.5652",
61
- "@openmrs/esm-extensions": "10.0.1-pre.5652",
62
- "@openmrs/esm-feature-flags": "10.0.1-pre.5652",
63
- "@openmrs/esm-globals": "10.0.1-pre.5652",
64
- "@openmrs/esm-utils": "10.0.1-pre.5652",
59
+ "@openmrs/esm-config": "10.0.1-pre.5664",
60
+ "@openmrs/esm-dynamic-loading": "10.0.1-pre.5664",
61
+ "@openmrs/esm-extensions": "10.0.1-pre.5664",
62
+ "@openmrs/esm-feature-flags": "10.0.1-pre.5664",
63
+ "@openmrs/esm-globals": "10.0.1-pre.5664",
64
+ "@openmrs/esm-utils": "10.0.1-pre.5664",
65
65
  "@swc/cli": "0.8.1",
66
66
  "@swc/core": "1.15.21",
67
67
  "@vitest/coverage-v8": "^4.1.2",
@@ -2,8 +2,6 @@ import {
2
2
  attach,
3
3
  registerExtension,
4
4
  registerModal,
5
- registerWorkspace,
6
- registerWorkspaceGroup,
7
5
  registerWorkspaceGroups2,
8
6
  registerWorkspaces2,
9
7
  registerWorkspaceWindows2,
@@ -12,9 +10,7 @@ import {
12
10
  type ExtensionDefinition,
13
11
  type FeatureFlagDefinition,
14
12
  type ModalDefinition,
15
- type WorkspaceDefinition,
16
13
  type WorkspaceDefinition2,
17
- type WorkspaceGroupDefinition,
18
14
  type WorkspaceGroupDefinition2,
19
15
  type WorkspaceWindowDefinition2,
20
16
  } from '@openmrs/esm-globals';
@@ -107,87 +103,6 @@ To fix this, ensure that you define a 'component' field inside the modal definit
107
103
  });
108
104
  }
109
105
 
110
- /**
111
- * This function registers a workspace definition with the framework so that it can be launched.
112
- *
113
- * @param appName The name of the app defining this workspace
114
- * @param workspace An object that describes the workspace, derived from `routes.json`
115
- */
116
- export function tryRegisterWorkspace(appName: string, workspace: WorkspaceDefinition) {
117
- const name = workspace.name;
118
- if (!name) {
119
- console.error(
120
- `A workspace definition in ${appName} is missing a name and thus cannot be registered.
121
- To fix this, ensure that you define the "name" field inside the workspace definition.`,
122
- workspace,
123
- );
124
- return;
125
- }
126
-
127
- const title = workspace.title;
128
- if (!title) {
129
- console.error(
130
- `A workspace definition in ${appName} is missing a title and thus cannot be registered.
131
- To fix this, ensure that you define the "title" field inside the workspace definition.`,
132
- workspace,
133
- );
134
- return;
135
- }
136
-
137
- if (!workspace.component) {
138
- console.error(
139
- `The workspace ${name} from ${appName} is missing a 'component' entry and thus cannot be registered.
140
- To fix this, ensure that you define a 'component' field inside the workspace definition.`,
141
- workspace,
142
- );
143
- return;
144
- }
145
-
146
- registerWorkspace({
147
- name,
148
- title,
149
- component: workspace.component,
150
- moduleName: appName,
151
- type: workspace.type,
152
- canHide: workspace.canHide,
153
- canMaximize: workspace.canMaximize,
154
- width: workspace.width,
155
- preferredWindowSize: workspace.preferredWindowSize,
156
- groups: workspace.groups,
157
- load: () => loadLifeCycles(appName, workspace.component),
158
- });
159
-
160
- for (const group of workspace.groups || []) {
161
- registerWorkspaceGroup({
162
- name: group,
163
- members: [name],
164
- });
165
- }
166
- }
167
-
168
- /**
169
- * This function registers a workspace group definition with the framework so that it can be launched.
170
- *
171
- * @param appName The name of the app defining this workspace
172
- * @param workspace An object that describes the workspace, derived from `routes.json`
173
- */
174
- export function tryRegisterWorkspaceGroup(appName: string, workspaceGroup: WorkspaceGroupDefinition) {
175
- const name = workspaceGroup.name;
176
- if (!name) {
177
- console.error(
178
- `A workspace group definition in ${appName} is missing a name and thus cannot be registered.
179
- To fix this, ensure that you define the "name" field inside the workspace definition.`,
180
- workspaceGroup,
181
- );
182
- return;
183
- }
184
-
185
- registerWorkspaceGroup({
186
- name,
187
- members: workspaceGroup.members ?? [],
188
- });
189
- }
190
-
191
106
  export function tryRegisterWorkspaceGroups2(appName: string, workspaceGroupDefs: Array<WorkspaceGroupDefinition2>) {
192
107
  registerWorkspaceGroups2(appName, workspaceGroupDefs);
193
108
  }
@@ -2,14 +2,12 @@ import { type ActivityFn, pathToActiveWhen, registerApplication } from 'single-s
2
2
  import { registerModuleWithConfigSystem } from '@openmrs/esm-config';
3
3
  import { batchExtensionUpdates } from '@openmrs/esm-extensions';
4
4
  import {
5
- type WorkspaceGroupDefinition,
6
5
  type ExtensionDefinition,
7
6
  type FeatureFlagDefinition,
8
7
  type ModalDefinition,
9
8
  type OpenmrsAppRoutes,
10
9
  type RegisteredPageDefinition,
11
10
  type RouteDefinition,
12
- type WorkspaceDefinition,
13
11
  } from '@openmrs/esm-globals';
14
12
  import { getFeatureFlag } from '@openmrs/esm-feature-flags';
15
13
  import { routeRegex } from './helpers';
@@ -17,9 +15,7 @@ import {
17
15
  tryRegisterExtension,
18
16
  tryRegisterFeatureFlag,
19
17
  tryRegisterModal,
20
- tryRegisterWorkspace,
21
18
  tryRegisterWorkspace2,
22
- tryRegisterWorkspaceGroup,
23
19
  tryRegisterWorkspaceGroups2,
24
20
  tryRegisterWorkspaceWindows2,
25
21
  } from './components';
@@ -93,8 +89,6 @@ function registerAppRoutes(appName: string, routes: OpenmrsAppRoutes) {
93
89
 
94
90
  const availableExtensions: Array<ExtensionDefinition> = routes.extensions ?? [];
95
91
  const availableModals: Array<ModalDefinition> = routes.modals ?? [];
96
- const availableWorkspaces: Array<WorkspaceDefinition> = routes.workspaces ?? [];
97
- const availableWorkspaceGroups: Array<WorkspaceGroupDefinition> = routes.workspaceGroups ?? [];
98
92
  const availableFeatureFlags: Array<FeatureFlagDefinition> = routes.featureFlags ?? [];
99
93
  const availableWorkspaceGroups2 = routes.workspaceGroups2 ?? [];
100
94
  const availableWorkspaceWindows2 = routes.workspaceWindows2 ?? [];
@@ -141,32 +135,11 @@ function registerAppRoutes(appName: string, routes: OpenmrsAppRoutes) {
141
135
  }
142
136
  });
143
137
 
144
- availableWorkspaces.forEach((workspace) => {
145
- if (
146
- workspace &&
147
- typeof workspace === 'object' &&
148
- Object.hasOwn(workspace, 'name') &&
149
- Object.hasOwn(workspace, 'component')
150
- ) {
151
- tryRegisterWorkspace(appName, workspace);
152
- } else {
153
- console.warn(
154
- `A workspace for ${appName} could not be registered as it does not appear to have the required properties`,
155
- workspace,
156
- );
157
- }
158
- });
159
-
160
- availableWorkspaceGroups.forEach((workspaceGroup) => {
161
- if (workspaceGroup && typeof workspaceGroup === 'object' && Object.hasOwn(workspaceGroup, 'name')) {
162
- tryRegisterWorkspaceGroup(appName, workspaceGroup);
163
- } else {
164
- console.warn(
165
- `A workspace group for ${appName} could not be registered as it does not appear to have the required properties`,
166
- workspaceGroup,
167
- );
168
- }
169
- });
138
+ if (Object.hasOwn(routes, 'workspaces') || Object.hasOwn(routes, 'workspaceGroups')) {
139
+ console.warn(
140
+ `${appName} defines workspaces or workspaceGroups in its routes.json, which are no longer supported and won't be registered. Use workspaces2, workspaceWindows2 and workspaceGroups2 instead.`,
141
+ );
142
+ }
170
143
  tryRegisterWorkspaceGroups2(appName, availableWorkspaceGroups2);
171
144
  tryRegisterWorkspaceWindows2(appName, availableWorkspaceWindows2);
172
145
  tryRegisterWorkspace2(appName, availableWorkspaces2);