openmrs 3.1.15-pre.813 → 3.1.15-pre.829
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/dist/cli.js +12 -3
- package/dist/commands/debug.js +1 -0
- package/dist/commands/develop.js +8 -1
- package/dist/commands/start.js +8 -1
- package/dist/utils/config.js +3 -0
- package/package.json +3 -3
- package/src/cli.ts +16 -1
- package/src/commands/debug.ts +2 -0
- package/src/commands/develop.ts +9 -1
- package/src/commands/start.ts +9 -1
- package/src/utils/config.ts +5 -0
package/dist/cli.js
CHANGED
|
@@ -53,6 +53,9 @@ yargs.command("debug", "Starts a new debugging session of the OpenMRS app shell.
|
|
|
53
53
|
.string("backend")
|
|
54
54
|
.default("backend", "https://openmrs-spa.org/")
|
|
55
55
|
.describe("backend", "The backend to proxy API requests to.")
|
|
56
|
+
.string("add-cookie")
|
|
57
|
+
.default("add-cookie", "")
|
|
58
|
+
.describe("add-cookie", "Additional cookies to provide when proxying.")
|
|
56
59
|
.boolean("support-offline")
|
|
57
60
|
.describe("support-offline", "Determines if a service worker should be installed for offline support.")
|
|
58
61
|
.default("support-offline", true)
|
|
@@ -80,7 +83,7 @@ yargs.command("debug", "Starts a new debugging session of the OpenMRS app shell.
|
|
|
80
83
|
.string("importmap")
|
|
81
84
|
.default("importmap", "importmap.json")
|
|
82
85
|
.describe("importmap", "The import map to use. Can be a path to a valid import map to be taken literally, an URL, or a fixed JSON object."), (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
83
|
-
return runCommand("runDebug", Object.assign(Object.assign({ apiUrl: args["api-url"], spaPath: args["spa-path"], configUrls: args["config-url"], pageTitle: args["page-title"], supportOffline: args["support-offline"] }, args), { importmap: (0, utils_1.proxyImportmap)(yield (0, utils_1.mergeImportmap)(yield (0, utils_1.getImportmap)(args.importmap, args.port), (args["run-project"] || args.runProject) &&
|
|
86
|
+
return runCommand("runDebug", Object.assign(Object.assign({ apiUrl: args["api-url"], spaPath: args["spa-path"], configUrls: args["config-url"], pageTitle: args["page-title"], supportOffline: args["support-offline"], addCookie: args["add-cookie"] }, args), { importmap: (0, utils_1.proxyImportmap)(yield (0, utils_1.mergeImportmap)(yield (0, utils_1.getImportmap)(args.importmap, args.port), (args["run-project"] || args.runProject) &&
|
|
84
87
|
(yield (0, utils_1.runProject)(args.port, args["shared-dependencies"], args.sources))), args.backend, args.host, args.port) }));
|
|
85
88
|
}));
|
|
86
89
|
yargs.command("develop", "Starts a new frontend module development session with the OpenMRS app shell.", (argv) => argv
|
|
@@ -93,6 +96,9 @@ yargs.command("develop", "Starts a new frontend module development session with
|
|
|
93
96
|
.string("backend")
|
|
94
97
|
.default("backend", "https://openmrs-spa.org/")
|
|
95
98
|
.describe("backend", "The backend to proxy API requests to.")
|
|
99
|
+
.string("add-cookie")
|
|
100
|
+
.default("add-cookie", "")
|
|
101
|
+
.describe("add-cookie", "Additional cookies to provide when proxying.")
|
|
96
102
|
.string("spa-path")
|
|
97
103
|
.default("spa-path", "/openmrs/spa/")
|
|
98
104
|
.describe("spa-path", "The path of the application on the target server.")
|
|
@@ -114,7 +120,7 @@ yargs.command("develop", "Starts a new frontend module development session with
|
|
|
114
120
|
.string("importmap")
|
|
115
121
|
.default("importmap", "importmap.json")
|
|
116
122
|
.describe("importmap", "The import map to use. Can be a path to a valid import map to be taken literally, an URL, or a fixed JSON object."), (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
117
|
-
return runCommand("runDevelop", Object.assign(Object.assign({ apiUrl: args["api-url"], spaPath: args["spa-path"], configUrls: args["config-url"] }, args), { importmap: (0, utils_1.proxyImportmap)(yield (0, utils_1.mergeImportmap)(yield (0, utils_1.getImportmap)(args.importmap, args.port), args.sources[0] !== false &&
|
|
123
|
+
return runCommand("runDevelop", Object.assign(Object.assign({ apiUrl: args["api-url"], spaPath: args["spa-path"], configUrls: args["config-url"], addCookie: args["add-cookie"] }, args), { importmap: (0, utils_1.proxyImportmap)(yield (0, utils_1.mergeImportmap)(yield (0, utils_1.getImportmap)(args.importmap, args.port), args.sources[0] !== false &&
|
|
118
124
|
(yield (0, utils_1.runProject)(args.port, args["shared-dependencies"], args.sources))), args.backend, args.host, args.port) }));
|
|
119
125
|
}));
|
|
120
126
|
yargs.command("build", "Builds a new app shell.", (argv) => argv
|
|
@@ -180,9 +186,12 @@ yargs.command(["start", "$0"], "Starts the app shell using the provided configur
|
|
|
180
186
|
.string("backend")
|
|
181
187
|
.default("backend", "https://openmrs-spa.org/")
|
|
182
188
|
.describe("backend", "The backend to proxy API requests to.")
|
|
189
|
+
.string("add-cookie")
|
|
190
|
+
.default("add-cookie", "")
|
|
191
|
+
.describe("add-cookie", "Additional cookies to provide when proxying.")
|
|
183
192
|
.boolean("open")
|
|
184
193
|
.default("open", false)
|
|
185
|
-
.describe("open", "Immediately opens the SPA page URL in the browser."), (args) => runCommand("runStart", Object.assign({}, args)));
|
|
194
|
+
.describe("open", "Immediately opens the SPA page URL in the browser."), (args) => runCommand("runStart", Object.assign({ addCookie: args["add-cookie"] }, args)));
|
|
186
195
|
yargs
|
|
187
196
|
.epilog("The SPA build config JSON is a JSON file, typically `frontend.json`, which defines parameters for the `build` and `assemble` " +
|
|
188
197
|
"commands. The keys used by `build` are:\n" +
|
package/dist/commands/debug.js
CHANGED
package/dist/commands/develop.js
CHANGED
|
@@ -10,7 +10,7 @@ const path_1 = require("path");
|
|
|
10
10
|
const fs_1 = require("fs");
|
|
11
11
|
const utils_1 = require("../utils");
|
|
12
12
|
function runDevelop(args) {
|
|
13
|
-
const { backend, host, port, open, importmap, configUrls } = args;
|
|
13
|
+
const { backend, host, port, open, importmap, configUrls, addCookie } = args;
|
|
14
14
|
const apiUrl = (0, utils_1.removeTrailingSlash)(args.apiUrl);
|
|
15
15
|
const spaPath = (0, utils_1.removeTrailingSlash)(args.spaPath);
|
|
16
16
|
const app = (0, express_1.default)();
|
|
@@ -64,6 +64,13 @@ function runDevelop(args) {
|
|
|
64
64
|
}, {
|
|
65
65
|
target: backend,
|
|
66
66
|
changeOrigin: true,
|
|
67
|
+
onProxyReq(proxyReq) {
|
|
68
|
+
if (addCookie) {
|
|
69
|
+
const origCookie = proxyReq.getHeader("cookie");
|
|
70
|
+
const newCookie = `${origCookie};${addCookie}`;
|
|
71
|
+
proxyReq.setHeader("cookie", newCookie);
|
|
72
|
+
}
|
|
73
|
+
},
|
|
67
74
|
}));
|
|
68
75
|
app.listen(port, host, () => {
|
|
69
76
|
(0, utils_1.logInfo)(`Listening at http://${host}:${port}`);
|
package/dist/commands/start.js
CHANGED
|
@@ -9,7 +9,7 @@ const http_proxy_middleware_1 = require("http-proxy-middleware");
|
|
|
9
9
|
const path_1 = require("path");
|
|
10
10
|
const utils_1 = require("../utils");
|
|
11
11
|
function runStart(args) {
|
|
12
|
-
const { backend, host, port, open } = args;
|
|
12
|
+
const { backend, host, port, open, addCookie } = args;
|
|
13
13
|
const app = (0, express_1.default)();
|
|
14
14
|
const source = (0, path_1.resolve)(require.resolve("@openmrs/esm-app-shell/package.json"), "..", "dist");
|
|
15
15
|
const index = (0, path_1.resolve)(source, "index.html");
|
|
@@ -19,6 +19,13 @@ function runStart(args) {
|
|
|
19
19
|
app.use("/openmrs", (0, http_proxy_middleware_1.createProxyMiddleware)([`/openmrs/**`, `!${spaPath}/**`], {
|
|
20
20
|
target: backend,
|
|
21
21
|
changeOrigin: true,
|
|
22
|
+
onProxyReq(proxyReq) {
|
|
23
|
+
if (addCookie) {
|
|
24
|
+
const origCookie = proxyReq.getHeader("cookie");
|
|
25
|
+
const newCookie = `${origCookie};${addCookie}`;
|
|
26
|
+
proxyReq.setHeader("cookie", newCookie);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
22
29
|
}));
|
|
23
30
|
app.get("/*", (_, res) => res.sendFile(index));
|
|
24
31
|
app.listen(port, host, () => {
|
package/dist/utils/config.js
CHANGED
|
@@ -16,6 +16,9 @@ function loadWebpackConfig(options = {}) {
|
|
|
16
16
|
if (typeof options.pageTitle === "string") {
|
|
17
17
|
variables.OMRS_PAGE_TITLE = options.pageTitle;
|
|
18
18
|
}
|
|
19
|
+
if (typeof options.addCookie === "string") {
|
|
20
|
+
variables.OMRS_ADD_COOKIE = options.addCookie;
|
|
21
|
+
}
|
|
19
22
|
if (typeof options.supportOffline === "boolean") {
|
|
20
23
|
variables.OMRS_OFFLINE = options.supportOffline ? "enable" : "disable";
|
|
21
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openmrs",
|
|
3
|
-
"version": "3.1.15-pre.
|
|
3
|
+
"version": "3.1.15-pre.829",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@babel/preset-env": "^7.11.0",
|
|
36
36
|
"@babel/preset-react": "^7.10.4",
|
|
37
37
|
"@babel/preset-typescript": "^7.10.4",
|
|
38
|
-
"@openmrs/esm-app-shell": "3.1.15-pre.
|
|
38
|
+
"@openmrs/esm-app-shell": "3.1.15-pre.829",
|
|
39
39
|
"@types/react": "^16.9.46",
|
|
40
40
|
"@types/systemjs": "^6.1.0",
|
|
41
41
|
"autoprefixer": "^9.6.1",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"@types/rimraf": "^2.0.2",
|
|
79
79
|
"@types/tar": "^4.0.3"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "6e4d53c34706e20c2af0a6709845f050139d6979"
|
|
82
82
|
}
|
package/src/cli.ts
CHANGED
|
@@ -47,6 +47,9 @@ yargs.command(
|
|
|
47
47
|
.string("backend")
|
|
48
48
|
.default("backend", "https://openmrs-spa.org/")
|
|
49
49
|
.describe("backend", "The backend to proxy API requests to.")
|
|
50
|
+
.string("add-cookie")
|
|
51
|
+
.default("add-cookie", "")
|
|
52
|
+
.describe("add-cookie", "Additional cookies to provide when proxying.")
|
|
50
53
|
.boolean("support-offline")
|
|
51
54
|
.describe(
|
|
52
55
|
"support-offline",
|
|
@@ -105,6 +108,7 @@ yargs.command(
|
|
|
105
108
|
configUrls: args["config-url"],
|
|
106
109
|
pageTitle: args["page-title"],
|
|
107
110
|
supportOffline: args["support-offline"],
|
|
111
|
+
addCookie: args["add-cookie"],
|
|
108
112
|
...args,
|
|
109
113
|
importmap: proxyImportmap(
|
|
110
114
|
await mergeImportmap(
|
|
@@ -137,6 +141,9 @@ yargs.command(
|
|
|
137
141
|
.string("backend")
|
|
138
142
|
.default("backend", "https://openmrs-spa.org/")
|
|
139
143
|
.describe("backend", "The backend to proxy API requests to.")
|
|
144
|
+
.string("add-cookie")
|
|
145
|
+
.default("add-cookie", "")
|
|
146
|
+
.describe("add-cookie", "Additional cookies to provide when proxying.")
|
|
140
147
|
.string("spa-path")
|
|
141
148
|
.default("spa-path", "/openmrs/spa/")
|
|
142
149
|
.describe("spa-path", "The path of the application on the target server.")
|
|
@@ -178,6 +185,7 @@ yargs.command(
|
|
|
178
185
|
apiUrl: args["api-url"],
|
|
179
186
|
spaPath: args["spa-path"],
|
|
180
187
|
configUrls: args["config-url"],
|
|
188
|
+
addCookie: args["add-cookie"],
|
|
181
189
|
...args,
|
|
182
190
|
importmap: proxyImportmap(
|
|
183
191
|
await mergeImportmap(
|
|
@@ -331,10 +339,17 @@ yargs.command(
|
|
|
331
339
|
.string("backend")
|
|
332
340
|
.default("backend", "https://openmrs-spa.org/")
|
|
333
341
|
.describe("backend", "The backend to proxy API requests to.")
|
|
342
|
+
.string("add-cookie")
|
|
343
|
+
.default("add-cookie", "")
|
|
344
|
+
.describe("add-cookie", "Additional cookies to provide when proxying.")
|
|
334
345
|
.boolean("open")
|
|
335
346
|
.default("open", false)
|
|
336
347
|
.describe("open", "Immediately opens the SPA page URL in the browser."),
|
|
337
|
-
(args) =>
|
|
348
|
+
(args) =>
|
|
349
|
+
runCommand("runStart", {
|
|
350
|
+
addCookie: args["add-cookie"],
|
|
351
|
+
...args,
|
|
352
|
+
})
|
|
338
353
|
);
|
|
339
354
|
|
|
340
355
|
yargs
|
package/src/commands/debug.ts
CHANGED
|
@@ -15,6 +15,7 @@ export interface DebugArgs {
|
|
|
15
15
|
spaPath: string;
|
|
16
16
|
apiUrl: string;
|
|
17
17
|
configUrls: Array<string>;
|
|
18
|
+
addCookie: string;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export function runDebug(args: DebugArgs) {
|
|
@@ -28,6 +29,7 @@ export function runDebug(args: DebugArgs) {
|
|
|
28
29
|
supportOffline: args.supportOffline,
|
|
29
30
|
spaPath: args.spaPath,
|
|
30
31
|
configUrls: args.configUrls,
|
|
32
|
+
addCookie: args.addCookie,
|
|
31
33
|
env: "development",
|
|
32
34
|
});
|
|
33
35
|
|
package/src/commands/develop.ts
CHANGED
|
@@ -20,10 +20,11 @@ export interface DevelopArgs {
|
|
|
20
20
|
spaPath: string;
|
|
21
21
|
apiUrl: string;
|
|
22
22
|
configUrls: Array<string>;
|
|
23
|
+
addCookie: string;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
export function runDevelop(args: DevelopArgs) {
|
|
26
|
-
const { backend, host, port, open, importmap, configUrls } = args;
|
|
27
|
+
const { backend, host, port, open, importmap, configUrls, addCookie } = args;
|
|
27
28
|
const apiUrl = removeTrailingSlash(args.apiUrl);
|
|
28
29
|
const spaPath = removeTrailingSlash(args.spaPath);
|
|
29
30
|
const app = express();
|
|
@@ -100,6 +101,13 @@ export function runDevelop(args: DevelopArgs) {
|
|
|
100
101
|
{
|
|
101
102
|
target: backend,
|
|
102
103
|
changeOrigin: true,
|
|
104
|
+
onProxyReq(proxyReq) {
|
|
105
|
+
if (addCookie) {
|
|
106
|
+
const origCookie = proxyReq.getHeader("cookie");
|
|
107
|
+
const newCookie = `${origCookie};${addCookie}`;
|
|
108
|
+
proxyReq.setHeader("cookie", newCookie);
|
|
109
|
+
}
|
|
110
|
+
},
|
|
103
111
|
}
|
|
104
112
|
)
|
|
105
113
|
);
|
package/src/commands/start.ts
CHANGED
|
@@ -10,10 +10,11 @@ export interface StartArgs {
|
|
|
10
10
|
host: string;
|
|
11
11
|
open: boolean;
|
|
12
12
|
backend: string;
|
|
13
|
+
addCookie: string;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export function runStart(args: StartArgs) {
|
|
16
|
-
const { backend, host, port, open } = args;
|
|
17
|
+
const { backend, host, port, open, addCookie } = args;
|
|
17
18
|
const app = express();
|
|
18
19
|
const source = resolve(
|
|
19
20
|
require.resolve("@openmrs/esm-app-shell/package.json"),
|
|
@@ -30,6 +31,13 @@ export function runStart(args: StartArgs) {
|
|
|
30
31
|
createProxyMiddleware([`/openmrs/**`, `!${spaPath}/**`], {
|
|
31
32
|
target: backend,
|
|
32
33
|
changeOrigin: true,
|
|
34
|
+
onProxyReq(proxyReq) {
|
|
35
|
+
if (addCookie) {
|
|
36
|
+
const origCookie = proxyReq.getHeader("cookie");
|
|
37
|
+
const newCookie = `${origCookie};${addCookie}`;
|
|
38
|
+
proxyReq.setHeader("cookie", newCookie);
|
|
39
|
+
}
|
|
40
|
+
},
|
|
33
41
|
})
|
|
34
42
|
);
|
|
35
43
|
app.get("/*", (_, res) => res.sendFile(index));
|
package/src/utils/config.ts
CHANGED
|
@@ -11,6 +11,7 @@ export interface WebpackOptions {
|
|
|
11
11
|
configUrls?: Array<string>;
|
|
12
12
|
env?: string;
|
|
13
13
|
coreAppsDir?: string;
|
|
14
|
+
addCookie?: string;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export function loadWebpackConfig(options: WebpackOptions = {}) {
|
|
@@ -32,6 +33,10 @@ export function loadWebpackConfig(options: WebpackOptions = {}) {
|
|
|
32
33
|
variables.OMRS_PAGE_TITLE = options.pageTitle;
|
|
33
34
|
}
|
|
34
35
|
|
|
36
|
+
if (typeof options.addCookie === "string") {
|
|
37
|
+
variables.OMRS_ADD_COOKIE = options.addCookie;
|
|
38
|
+
}
|
|
39
|
+
|
|
35
40
|
if (typeof options.supportOffline === "boolean") {
|
|
36
41
|
variables.OMRS_OFFLINE = options.supportOffline ? "enable" : "disable";
|
|
37
42
|
}
|