@contrast/common 1.30.0 → 1.31.0
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 +12 -0
- package/lib/index.js +21 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -5,6 +5,14 @@ export * from './primordials';
|
|
|
5
5
|
interface TraverseCallback {
|
|
6
6
|
(path: any[], type: 'Key' | 'Value', value: any, obj: any): unknown;
|
|
7
7
|
}
|
|
8
|
+
export declare const empties: {
|
|
9
|
+
OBJECT: Readonly<{}>;
|
|
10
|
+
ARRAY: readonly never[];
|
|
11
|
+
UNTRACKED_VALUE_OBJ: Readonly<{
|
|
12
|
+
value: null;
|
|
13
|
+
tracked: false;
|
|
14
|
+
}>;
|
|
15
|
+
};
|
|
8
16
|
/**
|
|
9
17
|
* Returns true if the value passed is either a primitive string or a
|
|
10
18
|
* String object.
|
|
@@ -25,4 +33,8 @@ export declare function groupResultsMap(resultsMap: Partial<ResultMap>): {
|
|
|
25
33
|
};
|
|
26
34
|
export declare function get(obj: any, name: string): any;
|
|
27
35
|
export declare function set(obj: Record<string, any>, name: string, value: any): void;
|
|
36
|
+
/** Suppresses output to stderr when installed by the universal agent */
|
|
37
|
+
export declare function safeConsoleError(...args: Parameters<typeof console.error>): void;
|
|
38
|
+
/** Suppresses output to stderr when installed by the universal agent */
|
|
39
|
+
export declare function safeConsoleWarn(...args: Parameters<typeof console.warn>): void;
|
|
28
40
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
CHANGED
|
@@ -28,13 +28,19 @@ 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.set = exports.get = exports.groupResultsMap = exports.callChildComponentMethods = exports.callChildComponentMethodsSync = exports.traverseKeys = exports.traverseValues = exports.traverseKeysAndValues = exports.encodeString = exports.isNonEmptyObject = exports.isString = void 0;
|
|
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;
|
|
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
|
+
const { CONTRAST_INSTALLATION_TOOL = 'NONE' } = process.env;
|
|
37
38
|
const { StringPrototypeSplit, BufferFrom, BufferPrototypeToString } = primordials_1.primordials;
|
|
39
|
+
exports.empties = {
|
|
40
|
+
OBJECT: Object.freeze({}),
|
|
41
|
+
ARRAY: Object.freeze([]),
|
|
42
|
+
UNTRACKED_VALUE_OBJ: Object.freeze({ value: null, tracked: false })
|
|
43
|
+
};
|
|
38
44
|
/**
|
|
39
45
|
* Returns true if the value passed is either a primitive string or a
|
|
40
46
|
* String object.
|
|
@@ -205,4 +211,18 @@ function set(obj, name, value) {
|
|
|
205
211
|
obj[lastProp] = value;
|
|
206
212
|
}
|
|
207
213
|
exports.set = set;
|
|
214
|
+
/** Suppresses output to stderr when installed by the universal agent */
|
|
215
|
+
function safeConsoleError(...args) {
|
|
216
|
+
if (CONTRAST_INSTALLATION_TOOL === 'NONE') {
|
|
217
|
+
console.error(...args);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
exports.safeConsoleError = safeConsoleError;
|
|
221
|
+
/** Suppresses output to stderr when installed by the universal agent */
|
|
222
|
+
function safeConsoleWarn(...args) {
|
|
223
|
+
if (CONTRAST_INSTALLATION_TOOL === 'NONE') {
|
|
224
|
+
console.warn(...args);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
exports.safeConsoleWarn = safeConsoleWarn;
|
|
208
228
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.0",
|
|
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)",
|