@contrast/core 1.31.0 → 1.31.1
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/lib/app-info.js +19 -1
- package/package.json +3 -3
package/lib/app-info.js
CHANGED
|
@@ -36,12 +36,14 @@ module.exports = function (core) {
|
|
|
36
36
|
let cmd;
|
|
37
37
|
let entrypoint;
|
|
38
38
|
let pkgInfo;
|
|
39
|
+
let name;
|
|
39
40
|
let err;
|
|
40
41
|
|
|
41
42
|
try {
|
|
42
43
|
cmd = getCommand();
|
|
43
44
|
pkgInfo = getPackageInfo();
|
|
44
45
|
entrypoint = getEntrypoint();
|
|
46
|
+
name = getApplicationName();
|
|
45
47
|
} catch (_err) {
|
|
46
48
|
err = _err;
|
|
47
49
|
}
|
|
@@ -59,7 +61,7 @@ module.exports = function (core) {
|
|
|
59
61
|
indexFile: entrypoint,
|
|
60
62
|
path: pkgInfo.packageFile,
|
|
61
63
|
pkg: pkgInfo.packageData,
|
|
62
|
-
name
|
|
64
|
+
name,
|
|
63
65
|
app_dir: pkgInfo.dir,
|
|
64
66
|
version: config.application.version || pkgInfo.packageData.version,
|
|
65
67
|
serverVersion: config.server.version,
|
|
@@ -197,4 +199,20 @@ module.exports = function (core) {
|
|
|
197
199
|
packageFile,
|
|
198
200
|
};
|
|
199
201
|
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* The name field is required e.g. reporting, rewrite caching, etc.
|
|
205
|
+
* @throws {Error} if there is no name identified
|
|
206
|
+
*/
|
|
207
|
+
function getApplicationName() {
|
|
208
|
+
name = config.application.name || pkgInfo.packageData.name;
|
|
209
|
+
if (!name) {
|
|
210
|
+
throw new Error(
|
|
211
|
+
'The application\'s name was not identified. ' +
|
|
212
|
+
'Please provide name in package.json field or with the agent\'s application.name config option.'
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return name;
|
|
217
|
+
}
|
|
200
218
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/core",
|
|
3
|
-
"version": "1.31.
|
|
3
|
+
"version": "1.31.1",
|
|
4
4
|
"description": "Preconfigured Contrast agent core services and models",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
"types": "lib/index.d.ts",
|
|
11
11
|
"engines": {
|
|
12
12
|
"npm": ">=6.13.7 <7 || >= 8.3.1",
|
|
13
|
-
"node": ">= 14.
|
|
13
|
+
"node": ">= 14.18.0"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
16
|
"test": "../scripts/test.sh"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@contrast/common": "1.20.
|
|
19
|
+
"@contrast/common": "1.20.1",
|
|
20
20
|
"@contrast/find-package-json": "^1.0.0",
|
|
21
21
|
"@contrast/fn-inspect": "^4.0.0"
|
|
22
22
|
}
|