@contrast/common 1.31.0 → 1.33.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.
@@ -1,6 +1,9 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
+ /// <reference types="node" />
4
+ /// <reference types="node" />
3
5
  import { inspect } from 'util';
6
+ import fs from 'fs';
4
7
  export declare const primordials: {
5
8
  ArrayPrototypeJoin: (separator?: string | undefined) => string;
6
9
  ArrayPrototypeSlice: (start?: number | undefined, end?: number | undefined) => any[];
@@ -52,5 +55,11 @@ export declare const primordials: {
52
55
  };
53
56
  UtilInspect: typeof inspect;
54
57
  PathBasename: (path: string, ext?: string | undefined) => string;
58
+ FsOpen: typeof fs.open;
59
+ FsOpenSync: typeof fs.openSync;
60
+ FsReadFile: typeof fs.readFile;
61
+ FsReadFileSync: typeof fs.readFileSync;
62
+ FsPromisesOpen: typeof fs.promises.open;
63
+ FsPromiseReadFile: typeof fs.promises.readFile;
55
64
  };
56
65
  //# sourceMappingURL=primordials.d.ts.map
@@ -13,10 +13,15 @@
13
13
  * engineered, modified, repackaged, sold, redistributed or otherwise used in a
14
14
  * way not consistent with the End User License Agreement.
15
15
  */
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
16
19
  Object.defineProperty(exports, "__esModule", { value: true });
17
20
  exports.primordials = void 0;
18
21
  const util_1 = require("util");
19
22
  const path_1 = require("path");
23
+ const fs_1 = __importDefault(require("fs"));
24
+ const promises_1 = __importDefault(require("fs/promises"));
20
25
  exports.primordials = {
21
26
  // arrays
22
27
  ArrayPrototypeJoin: Array.prototype.join,
@@ -48,6 +53,14 @@ exports.primordials = {
48
53
  JSONParse: JSON.parse,
49
54
  JSONStringify: JSON.stringify,
50
55
  UtilInspect: util_1.inspect,
51
- PathBasename: path_1.basename
56
+ PathBasename: path_1.basename,
57
+ // fs
58
+ FsOpen: fs_1.default.open,
59
+ FsOpenSync: fs_1.default.openSync,
60
+ FsReadFile: fs_1.default.readFile,
61
+ FsReadFileSync: fs_1.default.readFileSync,
62
+ // fs/promises
63
+ FsPromisesOpen: promises_1.default.open,
64
+ FsPromiseReadFile: promises_1.default.readFile,
52
65
  };
53
66
  //# sourceMappingURL=primordials.js.map
package/lib/types.d.ts CHANGED
@@ -60,58 +60,66 @@ export interface AppInfo {
60
60
  buildId: string;
61
61
  }
62
62
  export interface SystemInfo {
63
- ReportDate: string;
64
- MachineName: string;
65
- Contrast: {
66
- Url: string | null;
67
- Proxy: {
63
+ reportDate: string;
64
+ hostname: string;
65
+ contrast: {
66
+ url: string | null;
67
+ proxy: {
68
68
  enable: boolean;
69
69
  url: string | null;
70
70
  };
71
- Server: {
72
- Name: string;
71
+ server: {
72
+ name: string;
73
73
  };
74
- Agent: {
75
- Name: string;
76
- Version: string;
74
+ agent: {
75
+ name: string;
76
+ version: string;
77
77
  };
78
78
  };
79
- Node: {
80
- Path: string;
81
- Version: string;
79
+ node: {
80
+ path: string;
81
+ version: string;
82
+ memory: {
83
+ total: string;
84
+ free: string;
85
+ used: string;
86
+ };
82
87
  };
83
- OperatingSystem: {
84
- Architecture: string;
85
- Name: string;
86
- Version: string;
87
- KernelVersion: string;
88
- CPU: {
89
- Type: string;
90
- Count: number;
88
+ os: {
89
+ architecture: string;
90
+ name: string;
91
+ version: string;
92
+ kernelVersion: string;
93
+ cpu: {
94
+ type: string;
95
+ count: number;
96
+ };
97
+ memory: {
98
+ total: string;
91
99
  };
100
+ id: string | undefined;
101
+ versionId: string | undefined;
92
102
  };
93
- Host: {
94
- Docker: {
103
+ host: {
104
+ docker: {
95
105
  isDocker: boolean;
96
- containerID: string | null;
106
+ containerId: string | null;
97
107
  };
98
- Kubernetes: {
108
+ kubernetes: {
99
109
  isKubernetes: boolean;
100
110
  };
101
- PM2: {
111
+ pm2: {
102
112
  used: boolean;
103
113
  version: string | null;
104
114
  };
105
- Memory: {
106
- Total: string;
107
- Free: string;
108
- Used: string;
115
+ memory: {
116
+ total: string;
109
117
  };
110
118
  };
111
- Application: object;
112
- Cloud: {
113
- Provider: string | null;
114
- ResourceID: string | null;
119
+ application: object;
120
+ cloud: {
121
+ provider: string | null;
122
+ resourceId: string | null;
115
123
  };
116
124
  }
117
125
  export type CommonRules = Rule.SQL_INJECTION | Rule.CMD_INJECTION | Rule.PATH_TRAVERSAL | Rule.REFLECTED_XSS | Rule.SSJS_INJECTION | Rule.NOSQL_INJECTION_MONGO | Rule.UNSAFE_FILE_UPLOAD | Rule.NOSQL_INJECTION | Rule.METHOD_TAMPERING | Rule.BOT_BLOCKER;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/common",
3
- "version": "1.31.0",
3
+ "version": "1.33.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)",
@@ -18,6 +18,6 @@
18
18
  },
19
19
  "scripts": {
20
20
  "build": "tsc --build src/",
21
- "test": "../scripts/test.sh"
21
+ "test": "bash ../scripts/test.sh"
22
22
  }
23
23
  }