@contrast/common 1.33.0 → 1.34.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/constants.d.ts +10 -0
- package/lib/constants.js +15 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +12 -2
- package/lib/types.d.ts +18 -2
- package/package.json +1 -1
package/lib/constants.d.ts
CHANGED
|
@@ -382,4 +382,14 @@ export declare enum agentLibIDListTypes {
|
|
|
382
382
|
export declare const symbols: {
|
|
383
383
|
readonly kMetrics: symbol;
|
|
384
384
|
};
|
|
385
|
+
export declare const URI_REGEXES: readonly [{
|
|
386
|
+
readonly rx: RegExp;
|
|
387
|
+
readonly rp: "{uuid}";
|
|
388
|
+
}, {
|
|
389
|
+
readonly rx: RegExp;
|
|
390
|
+
readonly rp: "{hash}";
|
|
391
|
+
}, {
|
|
392
|
+
readonly rx: RegExp;
|
|
393
|
+
readonly rp: "{n}";
|
|
394
|
+
}];
|
|
385
395
|
//# sourceMappingURL=constants.d.ts.map
|
package/lib/constants.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* way not consistent with the End User License Agreement.
|
|
15
15
|
*/
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.symbols = exports.agentLibIDListTypes = exports.FS_METHODS = exports.BLOCKING_MODES = exports.DataflowTag = exports.ExclusionType = exports.InputType = exports.SessionConfigurationRule = exports.ResponseScanningRule = exports.Rule = exports.ProtectRuleMode = exports.Event = void 0;
|
|
17
|
+
exports.URI_REGEXES = exports.symbols = exports.agentLibIDListTypes = exports.FS_METHODS = exports.BLOCKING_MODES = exports.DataflowTag = exports.ExclusionType = exports.InputType = exports.SessionConfigurationRule = exports.ResponseScanningRule = exports.Rule = exports.ProtectRuleMode = exports.Event = void 0;
|
|
18
18
|
var Event;
|
|
19
19
|
(function (Event) {
|
|
20
20
|
// lifecycle
|
|
@@ -267,4 +267,18 @@ var agentLibIDListTypes;
|
|
|
267
267
|
exports.symbols = {
|
|
268
268
|
kMetrics: Symbol('contrast.metrics'),
|
|
269
269
|
};
|
|
270
|
+
exports.URI_REGEXES = [
|
|
271
|
+
{
|
|
272
|
+
rx: /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/g,
|
|
273
|
+
rp: '{uuid}'
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
rx: /([a-fA-F0-9]{2}){16,}/g,
|
|
277
|
+
rp: '{hash}'
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
rx: /(\d+)/g,
|
|
281
|
+
rp: '{n}'
|
|
282
|
+
},
|
|
283
|
+
];
|
|
270
284
|
//# sourceMappingURL=constants.js.map
|
package/lib/index.d.ts
CHANGED
|
@@ -37,4 +37,5 @@ export declare function set(obj: Record<string, any>, name: string, value: any):
|
|
|
37
37
|
export declare function safeConsoleError(...args: Parameters<typeof console.error>): void;
|
|
38
38
|
/** Suppresses output to stderr when installed by the universal agent */
|
|
39
39
|
export declare function safeConsoleWarn(...args: Parameters<typeof console.warn>): void;
|
|
40
|
+
export declare function normalizeURI(uri: string): string;
|
|
40
41
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
CHANGED
|
@@ -28,14 +28,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
28
28
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
29
29
|
};
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.safeConsoleWarn = exports.safeConsoleError = exports.set = exports.get = exports.groupResultsMap = exports.callChildComponentMethods = exports.callChildComponentMethodsSync = exports.traverseKeys = exports.traverseValues = exports.traverseKeysAndValues = exports.encodeString = exports.isNonEmptyObject = exports.isString = exports.empties = void 0;
|
|
31
|
+
exports.normalizeURI = exports.safeConsoleWarn = exports.safeConsoleError = exports.set = exports.get = exports.groupResultsMap = exports.callChildComponentMethods = exports.callChildComponentMethodsSync = exports.traverseKeys = exports.traverseValues = exports.traverseKeysAndValues = exports.encodeString = exports.isNonEmptyObject = exports.isString = exports.empties = void 0;
|
|
32
32
|
const constants_1 = require("./constants");
|
|
33
33
|
const primordials_1 = require("./primordials");
|
|
34
34
|
__exportStar(require("./constants"), exports);
|
|
35
35
|
__exportStar(require("./types"), exports);
|
|
36
36
|
__exportStar(require("./primordials"), exports);
|
|
37
37
|
const { CONTRAST_INSTALLATION_TOOL = 'NONE' } = process.env;
|
|
38
|
-
const { StringPrototypeSplit, BufferFrom, BufferPrototypeToString } = primordials_1.primordials;
|
|
38
|
+
const { StringPrototypeReplaceAll, StringPrototypeSplit, BufferFrom, BufferPrototypeToString } = primordials_1.primordials;
|
|
39
39
|
exports.empties = {
|
|
40
40
|
OBJECT: Object.freeze({}),
|
|
41
41
|
ARRAY: Object.freeze([]),
|
|
@@ -225,4 +225,14 @@ function safeConsoleWarn(...args) {
|
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
exports.safeConsoleWarn = safeConsoleWarn;
|
|
228
|
+
function normalizeURI(uri) {
|
|
229
|
+
let normalizedUri = uri;
|
|
230
|
+
constants_1.URI_REGEXES.forEach(({ rx, rp }) => {
|
|
231
|
+
//@ts-ignore
|
|
232
|
+
normalizedUri = StringPrototypeReplaceAll.call(normalizedUri, rx, rp);
|
|
233
|
+
});
|
|
234
|
+
return normalizedUri;
|
|
235
|
+
}
|
|
236
|
+
exports.normalizeURI = normalizeURI;
|
|
237
|
+
;
|
|
228
238
|
//# sourceMappingURL=index.js.map
|
package/lib/types.d.ts
CHANGED
|
@@ -81,14 +81,21 @@ export interface SystemInfo {
|
|
|
81
81
|
version: string;
|
|
82
82
|
memory: {
|
|
83
83
|
total: string;
|
|
84
|
+
totalBytes: number;
|
|
84
85
|
free: string;
|
|
86
|
+
freeBytes: number;
|
|
85
87
|
used: string;
|
|
88
|
+
usedBytes: number;
|
|
86
89
|
};
|
|
87
90
|
};
|
|
88
91
|
os: {
|
|
92
|
+
/** `os.arch()` */
|
|
89
93
|
architecture: string;
|
|
94
|
+
/** `os.type()` */
|
|
90
95
|
name: string;
|
|
96
|
+
/** `os.release()` */
|
|
91
97
|
version: string;
|
|
98
|
+
/** `os.version()` */
|
|
92
99
|
kernelVersion: string;
|
|
93
100
|
cpu: {
|
|
94
101
|
type: string;
|
|
@@ -96,9 +103,17 @@ export interface SystemInfo {
|
|
|
96
103
|
};
|
|
97
104
|
memory: {
|
|
98
105
|
total: string;
|
|
106
|
+
totalBytes: number;
|
|
99
107
|
};
|
|
100
|
-
|
|
101
|
-
|
|
108
|
+
linuxInfo: {
|
|
109
|
+
file: string;
|
|
110
|
+
[key: string]: string;
|
|
111
|
+
} | null;
|
|
112
|
+
macOsInfo: {
|
|
113
|
+
productName: string;
|
|
114
|
+
productVersion: string;
|
|
115
|
+
buildVersion: string;
|
|
116
|
+
} | null;
|
|
102
117
|
};
|
|
103
118
|
host: {
|
|
104
119
|
docker: {
|
|
@@ -114,6 +129,7 @@ export interface SystemInfo {
|
|
|
114
129
|
};
|
|
115
130
|
memory: {
|
|
116
131
|
total: string;
|
|
132
|
+
totalBytes: number;
|
|
117
133
|
};
|
|
118
134
|
};
|
|
119
135
|
application: object;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.34.1",
|
|
4
4
|
"description": "Shared constants and utilities for all Contrast Agent modules",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
|