@contrast/common 1.20.1 → 1.21.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/index.d.ts +1 -13
- package/lib/index.js +9 -78
- package/lib/index.js.map +1 -1
- package/lib/primordials.d.ts +41 -0
- package/lib/primordials.js +41 -0
- package/lib/primordials.js.map +1 -0
- package/lib/types.d.ts +9 -0
- package/lib/types.js +9 -0
- package/lib/types.js.map +1 -1
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CommonRulesResultsMap, HardeningResultsMap, ResultMap, SemanticAnalysisResultsMap, ServerFeaturePreliminaryResultsMap } from './types';
|
|
2
2
|
export * from './constants';
|
|
3
3
|
export * from './types';
|
|
4
|
+
export * from './primordials';
|
|
4
5
|
interface TraverseCallback {
|
|
5
6
|
(path: any[], type: 'Key' | 'Value', value: any, obj: any): unknown;
|
|
6
7
|
}
|
|
@@ -24,17 +25,4 @@ export declare function groupResultsMap(resultsMap: Partial<ResultMap>): {
|
|
|
24
25
|
};
|
|
25
26
|
export declare function get(obj: any, name: string): any;
|
|
26
27
|
export declare function set(obj: Record<string, any>, name: string, value: any): void;
|
|
27
|
-
export declare function join(arr: Array<any>, ...args: []): string;
|
|
28
|
-
export declare function substring(str: string, ...args: any[]): string;
|
|
29
|
-
export declare function substr(str: string, ...args: any[]): string;
|
|
30
|
-
export declare function toLowerCase(str: string): string;
|
|
31
|
-
export declare function toUpperCase(str: string): string;
|
|
32
|
-
export declare function split(str: string, ...args: any[]): string[];
|
|
33
|
-
export declare function trim(str: string, ...args: []): string;
|
|
34
|
-
export declare function replace(str: string, pattern: any, replacement: any): string;
|
|
35
|
-
export declare function match(str: string, pattern: any): RegExpMatchArray | null;
|
|
36
|
-
export declare function matchAll(str: string, pattern: any): IterableIterator<RegExpMatchArray>;
|
|
37
|
-
export declare function slice(str: string, ...args: any[]): string;
|
|
38
|
-
export declare function inspect(...args: any): string;
|
|
39
|
-
export declare function stringify(value: any): string;
|
|
40
28
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
CHANGED
|
@@ -28,10 +28,12 @@ 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.
|
|
31
|
+
exports.set = exports.get = exports.groupResultsMap = exports.callChildComponentMethods = exports.callChildComponentMethodsSync = exports.traverseKeys = exports.traverseValues = exports.traverseKeysAndValues = exports.encodeString = exports.isNonEmptyObject = exports.isString = void 0;
|
|
32
32
|
const constants_1 = require("./constants");
|
|
33
33
|
__exportStar(require("./constants"), exports);
|
|
34
34
|
__exportStar(require("./types"), exports);
|
|
35
|
+
__exportStar(require("./primordials"), exports);
|
|
36
|
+
const primordials_1 = require("./primordials");
|
|
35
37
|
/**
|
|
36
38
|
* Returns true if the value passed is either a primitive string or a
|
|
37
39
|
* String object.
|
|
@@ -178,7 +180,9 @@ function groupResultsMap(resultsMap) {
|
|
|
178
180
|
exports.groupResultsMap = groupResultsMap;
|
|
179
181
|
function get(obj, name) {
|
|
180
182
|
let target = obj;
|
|
181
|
-
|
|
183
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
184
|
+
// @ts-ignore
|
|
185
|
+
const props = primordials_1.StringPrototypeSplit.call(name, '.');
|
|
182
186
|
for (const prop of props) {
|
|
183
187
|
target = target?.[prop];
|
|
184
188
|
if (target === undefined)
|
|
@@ -188,7 +192,9 @@ function get(obj, name) {
|
|
|
188
192
|
}
|
|
189
193
|
exports.get = get;
|
|
190
194
|
function set(obj, name, value) {
|
|
191
|
-
|
|
195
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
196
|
+
// @ts-ignore
|
|
197
|
+
const props = primordials_1.StringPrototypeSplit.call(name, '.');
|
|
192
198
|
const lastProp = props.pop();
|
|
193
199
|
for (const p of props) {
|
|
194
200
|
if (!obj[p])
|
|
@@ -198,79 +204,4 @@ function set(obj, name, value) {
|
|
|
198
204
|
obj[lastProp] = value;
|
|
199
205
|
}
|
|
200
206
|
exports.set = set;
|
|
201
|
-
const { join: origJoin } = Array.prototype;
|
|
202
|
-
function join(arr, ...args) {
|
|
203
|
-
return origJoin.call(arr, ...args);
|
|
204
|
-
}
|
|
205
|
-
exports.join = join;
|
|
206
|
-
const { substring: origSubstring } = String.prototype;
|
|
207
|
-
function substring(str, ...args) {
|
|
208
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
209
|
-
// @ts-ignore
|
|
210
|
-
return origSubstring.call(str, ...args);
|
|
211
|
-
}
|
|
212
|
-
exports.substring = substring;
|
|
213
|
-
const { substr: origSubstr } = String.prototype;
|
|
214
|
-
function substr(str, ...args) {
|
|
215
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
216
|
-
// @ts-ignore
|
|
217
|
-
return origSubstr.call(str, ...args);
|
|
218
|
-
}
|
|
219
|
-
exports.substr = substr;
|
|
220
|
-
const { toLowerCase: origToLowerCase } = String.prototype;
|
|
221
|
-
function toLowerCase(str) {
|
|
222
|
-
return origToLowerCase.call(str);
|
|
223
|
-
}
|
|
224
|
-
exports.toLowerCase = toLowerCase;
|
|
225
|
-
const { toUpperCase: origToUpperCase } = String.prototype;
|
|
226
|
-
function toUpperCase(str) {
|
|
227
|
-
return origToUpperCase.call(str);
|
|
228
|
-
}
|
|
229
|
-
exports.toUpperCase = toUpperCase;
|
|
230
|
-
const { split: origSplit } = String.prototype;
|
|
231
|
-
function split(str, ...args) {
|
|
232
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
233
|
-
// @ts-ignore
|
|
234
|
-
return origSplit.call(str, ...args);
|
|
235
|
-
}
|
|
236
|
-
exports.split = split;
|
|
237
|
-
const { trim: origTrim } = String.prototype;
|
|
238
|
-
function trim(str, ...args) {
|
|
239
|
-
return origTrim.call(str, ...args);
|
|
240
|
-
}
|
|
241
|
-
exports.trim = trim;
|
|
242
|
-
const { replace: origReplace } = String.prototype;
|
|
243
|
-
function replace(str, pattern, replacement) {
|
|
244
|
-
return origReplace.call(str, pattern, replacement);
|
|
245
|
-
}
|
|
246
|
-
exports.replace = replace;
|
|
247
|
-
const { match: origMatch } = String.prototype;
|
|
248
|
-
function match(str, pattern) {
|
|
249
|
-
return origMatch.call(str, pattern);
|
|
250
|
-
}
|
|
251
|
-
exports.match = match;
|
|
252
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
253
|
-
// @ts-ignore
|
|
254
|
-
const { matchAll: origMatchAll } = String.prototype;
|
|
255
|
-
function matchAll(str, pattern) {
|
|
256
|
-
return origMatchAll.call(str, pattern);
|
|
257
|
-
}
|
|
258
|
-
exports.matchAll = matchAll;
|
|
259
|
-
const { slice: origSlice } = String.prototype;
|
|
260
|
-
function slice(str, ...args) {
|
|
261
|
-
return origSlice.call(str, ...args);
|
|
262
|
-
}
|
|
263
|
-
exports.slice = slice;
|
|
264
|
-
const util_1 = require("util");
|
|
265
|
-
function inspect(...args) {
|
|
266
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
267
|
-
// @ts-ignore
|
|
268
|
-
return util_1.inspect.call(null, ...args);
|
|
269
|
-
}
|
|
270
|
-
exports.inspect = inspect;
|
|
271
|
-
const { stringify: origStringify } = JSON;
|
|
272
|
-
function stringify(value) {
|
|
273
|
-
return origStringify(value);
|
|
274
|
-
}
|
|
275
|
-
exports.stringify = stringify;
|
|
276
207
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;AAEH,2CAAmC;AAGnC,8CAA4B;AAC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IAEnD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC;QACxB,IAAI,MAAM,KAAK,SAAS;YAAE,MAAM;IAClC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAZD,kBAYC;AAED,SAAgB,GAAG,CAAC,GAAwB,EAAE,IAAY,EAAE,KAAU;IACpE,6DAA6D;IAC7D,aAAa;IACb,MAAM,KAAK,GAAG,kCAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACnD,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,EAAY,CAAC;IACvC,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YAAE,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;QACzB,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IACf,CAAC;IACD,GAAG,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;AACxB,CAAC;AAVD,kBAUC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare const ArrayPrototypeJoin: (separator?: string | undefined) => string;
|
|
3
|
+
export declare const ArrayPrototypeSlice: (start?: number | undefined, end?: number | undefined) => any[];
|
|
4
|
+
export declare const StringPrototypeSubstring: (start: number, end?: number | undefined) => string;
|
|
5
|
+
export declare const StringPrototypeSubstr: (from: number, length?: number | undefined) => string;
|
|
6
|
+
export declare const StringPrototypeToLowerCase: () => string;
|
|
7
|
+
export declare const StringPrototypeToUpperCase: () => string;
|
|
8
|
+
export declare const StringPrototypeSplit: {
|
|
9
|
+
(separator: string | RegExp, limit?: number | undefined): string[];
|
|
10
|
+
(splitter: {
|
|
11
|
+
[Symbol.split](string: string, limit?: number | undefined): string[];
|
|
12
|
+
}, limit?: number | undefined): string[];
|
|
13
|
+
};
|
|
14
|
+
export declare const StringPrototypeTrim: () => string;
|
|
15
|
+
export declare const StringPrototypeReplace: {
|
|
16
|
+
(searchValue: string | RegExp, replaceValue: string): string;
|
|
17
|
+
(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string;
|
|
18
|
+
(searchValue: {
|
|
19
|
+
[Symbol.replace](string: string, replaceValue: string): string;
|
|
20
|
+
}, replaceValue: string): string;
|
|
21
|
+
(searchValue: {
|
|
22
|
+
[Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string;
|
|
23
|
+
}, replacer: (substring: string, ...args: any[]) => string): string;
|
|
24
|
+
};
|
|
25
|
+
export declare const StringPrototypeMatch: {
|
|
26
|
+
(regexp: string | RegExp): RegExpMatchArray | null;
|
|
27
|
+
(matcher: {
|
|
28
|
+
[Symbol.match](string: string): RegExpMatchArray | null;
|
|
29
|
+
}): RegExpMatchArray | null;
|
|
30
|
+
};
|
|
31
|
+
export declare const StringPrototypeMatchAll: (regexp: RegExp) => IterableIterator<RegExpMatchArray>;
|
|
32
|
+
export declare const StringPrototypeSlice: (start?: number | undefined, end?: number | undefined) => string;
|
|
33
|
+
export declare const RegExpPrototypeTest: (string: string) => boolean;
|
|
34
|
+
export declare const RegExpPrototypeExec: (string: string) => RegExpExecArray | null;
|
|
35
|
+
export declare const JSONStringify: {
|
|
36
|
+
(value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string;
|
|
37
|
+
(value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string;
|
|
38
|
+
};
|
|
39
|
+
import { inspect } from 'util';
|
|
40
|
+
export declare const UtilInspect: typeof inspect;
|
|
41
|
+
//# sourceMappingURL=primordials.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright: 2024 Contrast Security, Inc
|
|
4
|
+
* Contact: support@contrastsecurity.com
|
|
5
|
+
* License: Commercial
|
|
6
|
+
|
|
7
|
+
* NOTICE: This Software and the patented inventions embodied within may only be
|
|
8
|
+
* used as part of Contrast Security’s commercial offerings. Even though it is
|
|
9
|
+
* made available through public repositories, use of this Software is subject to
|
|
10
|
+
* the applicable End User Licensing Agreement found at
|
|
11
|
+
* https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
|
|
12
|
+
* between Contrast Security and the End User. The Software may not be reverse
|
|
13
|
+
* engineered, modified, repackaged, sold, redistributed or otherwise used in a
|
|
14
|
+
* way not consistent with the End User License Agreement.
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.UtilInspect = exports.JSONStringify = exports.RegExpPrototypeExec = exports.RegExpPrototypeTest = exports.StringPrototypeSlice = exports.StringPrototypeMatchAll = exports.StringPrototypeMatch = exports.StringPrototypeReplace = exports.StringPrototypeTrim = exports.StringPrototypeSplit = exports.StringPrototypeToUpperCase = exports.StringPrototypeToLowerCase = exports.StringPrototypeSubstr = exports.StringPrototypeSubstring = exports.ArrayPrototypeSlice = exports.ArrayPrototypeJoin = void 0;
|
|
18
|
+
// arrays
|
|
19
|
+
exports.ArrayPrototypeJoin = Array.prototype.join;
|
|
20
|
+
exports.ArrayPrototypeSlice = Array.prototype.slice;
|
|
21
|
+
// strings
|
|
22
|
+
exports.StringPrototypeSubstring = String.prototype.substring;
|
|
23
|
+
exports.StringPrototypeSubstr = String.prototype.substr;
|
|
24
|
+
exports.StringPrototypeToLowerCase = String.prototype.toLowerCase;
|
|
25
|
+
exports.StringPrototypeToUpperCase = String.prototype.toUpperCase;
|
|
26
|
+
exports.StringPrototypeSplit = String.prototype.split;
|
|
27
|
+
exports.StringPrototypeTrim = String.prototype.trim;
|
|
28
|
+
exports.StringPrototypeReplace = String.prototype.replace;
|
|
29
|
+
exports.StringPrototypeMatch = String.prototype.match;
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
exports.StringPrototypeMatchAll = String.prototype.matchAll;
|
|
33
|
+
exports.StringPrototypeSlice = String.prototype.slice;
|
|
34
|
+
// regex
|
|
35
|
+
exports.RegExpPrototypeTest = RegExp.prototype.test;
|
|
36
|
+
exports.RegExpPrototypeExec = RegExp.prototype.exec;
|
|
37
|
+
// misc
|
|
38
|
+
exports.JSONStringify = JSON.stringify;
|
|
39
|
+
const util_1 = require("util");
|
|
40
|
+
exports.UtilInspect = util_1.inspect;
|
|
41
|
+
//# sourceMappingURL=primordials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primordials.js","sourceRoot":"","sources":["../src/primordials.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAEH,SAAS;AACI,QAAA,kBAAkB,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC;AAC1C,QAAA,mBAAmB,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC;AAEzD,UAAU;AACG,QAAA,wBAAwB,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC;AACtD,QAAA,qBAAqB,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC;AAChD,QAAA,0BAA0B,GAAG,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC;AAC1D,QAAA,0BAA0B,GAAG,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC;AAC1D,QAAA,oBAAoB,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;AAC9C,QAAA,mBAAmB,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC;AAC5C,QAAA,sBAAsB,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC;AAClD,QAAA,oBAAoB,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;AAC3D,6DAA6D;AAC7D,aAAa;AACA,QAAA,uBAAuB,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC;AACpD,QAAA,oBAAoB,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;AAE3D,QAAQ;AACK,QAAA,mBAAmB,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC;AAC5C,QAAA,mBAAmB,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC;AAEzD,OAAO;AACM,QAAA,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC;AAC5C,+BAA+B;AAClB,QAAA,WAAW,GAAG,cAAO,CAAC"}
|
package/lib/types.d.ts
CHANGED
|
@@ -278,6 +278,15 @@ export interface Messages extends EventEmitter {
|
|
|
278
278
|
on(event: Event.SERVER_SETTINGS_UPDATE, listener: (msg: Record<string, any>) => void): this;
|
|
279
279
|
on(event: Event, listener: (...args: any[]) => void): this;
|
|
280
280
|
}
|
|
281
|
+
/**
|
|
282
|
+
* IntentionalError is used when code wants to cause no-instrumentation in cases
|
|
283
|
+
* when no actual programmatic error has occurred. E.g., if the api is enabled
|
|
284
|
+
* but not all required api settings are present.
|
|
285
|
+
*
|
|
286
|
+
* It is expected that the code throwing an IntentionalError logs any pertinent
|
|
287
|
+
* information because the try/catch block will not output any error or message
|
|
288
|
+
* when it catches an IntentionalError.
|
|
289
|
+
*/
|
|
281
290
|
export declare class IntentionalError extends Error {
|
|
282
291
|
}
|
|
283
292
|
//# sourceMappingURL=types.d.ts.map
|
package/lib/types.js
CHANGED
|
@@ -15,6 +15,15 @@
|
|
|
15
15
|
*/
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.IntentionalError = void 0;
|
|
18
|
+
/**
|
|
19
|
+
* IntentionalError is used when code wants to cause no-instrumentation in cases
|
|
20
|
+
* when no actual programmatic error has occurred. E.g., if the api is enabled
|
|
21
|
+
* but not all required api settings are present.
|
|
22
|
+
*
|
|
23
|
+
* It is expected that the code throwing an IntentionalError logs any pertinent
|
|
24
|
+
* information because the try/catch block will not output any error or message
|
|
25
|
+
* when it catches an IntentionalError.
|
|
26
|
+
*/
|
|
18
27
|
class IntentionalError extends Error {
|
|
19
28
|
}
|
|
20
29
|
exports.IntentionalError = IntentionalError;
|
package/lib/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAqUH,MAAa,gBAAiB,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAqUH;;;;;;;;GAQG;AACH,MAAa,gBAAiB,SAAQ,KAAK;CAAG;AAA9C,4CAA8C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.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)",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"types": "lib/index.d.ts",
|
|
12
12
|
"engines": {
|
|
13
13
|
"npm": ">=6.13.7 <7 || >= 8.3.1",
|
|
14
|
-
"node": ">=
|
|
14
|
+
"node": ">= 16.9.1"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "tsc --build src/",
|