@contrast/agent 4.16.2 → 4.17.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.
Files changed (141) hide show
  1. package/esm.mjs +21 -11
  2. package/lib/assess/policy/propagators.json +4 -0
  3. package/lib/assess/policy/signatures.json +5 -0
  4. package/lib/assess/propagators/fastify-static/allowed-path.js +85 -0
  5. package/lib/contrast.js +1 -1
  6. package/lib/core/rewrite/index.js +2 -2
  7. package/node_modules/@colors/colors/LICENSE +26 -0
  8. package/node_modules/@colors/colors/README.md +219 -0
  9. package/node_modules/@colors/colors/examples/normal-usage.js +83 -0
  10. package/node_modules/@colors/colors/examples/safe-string.js +80 -0
  11. package/node_modules/@colors/colors/index.d.ts +136 -0
  12. package/node_modules/@colors/colors/lib/colors.js +211 -0
  13. package/node_modules/@colors/colors/lib/custom/trap.js +46 -0
  14. package/node_modules/@colors/colors/lib/custom/zalgo.js +110 -0
  15. package/node_modules/@colors/colors/lib/extendStringPrototype.js +110 -0
  16. package/node_modules/@colors/colors/lib/index.js +13 -0
  17. package/node_modules/@colors/colors/lib/maps/america.js +10 -0
  18. package/node_modules/@colors/colors/lib/maps/rainbow.js +12 -0
  19. package/node_modules/@colors/colors/lib/maps/random.js +11 -0
  20. package/node_modules/@colors/colors/lib/maps/zebra.js +5 -0
  21. package/node_modules/@colors/colors/lib/styles.js +95 -0
  22. package/node_modules/@colors/colors/lib/system/has-flag.js +35 -0
  23. package/node_modules/@colors/colors/lib/system/supports-colors.js +151 -0
  24. package/node_modules/@colors/colors/package.json +49 -0
  25. package/node_modules/@colors/colors/safe.d.ts +48 -0
  26. package/node_modules/@colors/colors/safe.js +10 -0
  27. package/node_modules/@colors/colors/themes/generic-logging.js +12 -0
  28. package/node_modules/@dabh/diagnostics/README.md +16 -16
  29. package/node_modules/@dabh/diagnostics/package.json +9 -9
  30. package/node_modules/color/README.md +9 -0
  31. package/node_modules/color/index.js +4 -1
  32. package/node_modules/color/package.json +8 -8
  33. package/node_modules/color-string/README.md +6 -2
  34. package/node_modules/color-string/index.js +21 -13
  35. package/node_modules/color-string/package.json +4 -4
  36. package/node_modules/colorspace/package.json +5 -5
  37. package/node_modules/fecha/dist/fecha.min.js +1 -1
  38. package/node_modules/fecha/dist/fecha.min.js.map +1 -0
  39. package/node_modules/fecha/lib/fecha.d.ts +2 -2
  40. package/node_modules/fecha/lib/fecha.js +35 -18
  41. package/node_modules/fecha/lib/fecha.js.map +1 -0
  42. package/node_modules/fecha/lib/fecha.umd.js +35 -18
  43. package/node_modules/fecha/lib/fecha.umd.js.map +1 -0
  44. package/node_modules/fecha/package.json +9 -10
  45. package/node_modules/fecha/src/fecha.ts +524 -0
  46. package/node_modules/logform/.eslintrc +1 -1
  47. package/node_modules/logform/CHANGELOG.md +24 -0
  48. package/node_modules/logform/README.md +15 -17
  49. package/node_modules/logform/browser.js +3 -1
  50. package/node_modules/logform/cli.js +1 -1
  51. package/node_modules/logform/colorize.js +2 -2
  52. package/node_modules/logform/dist/browser.js +8 -2
  53. package/node_modules/logform/dist/cli.js +2 -2
  54. package/node_modules/logform/dist/colorize.js +5 -5
  55. package/node_modules/logform/dist/errors.js +1 -1
  56. package/node_modules/logform/dist/format.js +9 -5
  57. package/node_modules/logform/dist/index.js +53 -20
  58. package/node_modules/logform/dist/json.js +7 -6
  59. package/node_modules/logform/dist/logstash.js +1 -1
  60. package/node_modules/logform/dist/pad-levels.js +4 -4
  61. package/node_modules/logform/dist/printf.js +1 -1
  62. package/node_modules/logform/dist/simple.js +1 -1
  63. package/node_modules/logform/dist/splat.js +2 -2
  64. package/node_modules/logform/dist/uncolorize.js +1 -1
  65. package/node_modules/logform/errors.js +1 -1
  66. package/node_modules/logform/index.d.ts +36 -0
  67. package/node_modules/logform/index.js +19 -20
  68. package/node_modules/logform/json.js +7 -7
  69. package/node_modules/logform/logstash.js +1 -1
  70. package/node_modules/logform/package.json +10 -9
  71. package/node_modules/logform/simple.js +1 -1
  72. package/node_modules/logform/uncolorize.js +1 -1
  73. package/node_modules/safe-stable-stringify/CHANGELOG.md +75 -0
  74. package/node_modules/safe-stable-stringify/LICENSE +21 -0
  75. package/node_modules/safe-stable-stringify/esm/package.json +4 -0
  76. package/node_modules/safe-stable-stringify/esm/wrapper.js +6 -0
  77. package/node_modules/safe-stable-stringify/index.d.ts +18 -0
  78. package/node_modules/safe-stable-stringify/index.js +618 -0
  79. package/node_modules/safe-stable-stringify/package.json +69 -0
  80. package/node_modules/safe-stable-stringify/readme.md +170 -0
  81. package/node_modules/safe-stable-stringify/tsconfig.json +22 -0
  82. package/node_modules/winston/LICENSE +18 -18
  83. package/node_modules/winston/README.md +1231 -1230
  84. package/node_modules/winston/dist/winston/common.js +10 -10
  85. package/node_modules/winston/dist/winston/config/index.js +17 -17
  86. package/node_modules/winston/dist/winston/container.js +46 -46
  87. package/node_modules/winston/dist/winston/create-logger.js +28 -24
  88. package/node_modules/winston/dist/winston/exception-handler.js +49 -49
  89. package/node_modules/winston/dist/winston/exception-stream.js +27 -27
  90. package/node_modules/winston/dist/winston/logger.js +152 -138
  91. package/node_modules/winston/dist/winston/profiler.js +22 -22
  92. package/node_modules/winston/dist/winston/rejection-handler.js +54 -54
  93. package/node_modules/winston/dist/winston/tail-file.js +14 -14
  94. package/node_modules/winston/dist/winston/transports/console.js +31 -31
  95. package/node_modules/winston/dist/winston/transports/file.js +101 -101
  96. package/node_modules/winston/dist/winston/transports/http.js +119 -41
  97. package/node_modules/winston/dist/winston/transports/index.js +17 -17
  98. package/node_modules/winston/dist/winston/transports/stream.js +24 -24
  99. package/node_modules/winston/dist/winston.js +91 -97
  100. package/node_modules/winston/index.d.ts +213 -193
  101. package/node_modules/winston/lib/winston/common.js +61 -61
  102. package/node_modules/winston/lib/winston/config/index.d.ts +99 -98
  103. package/node_modules/winston/lib/winston/config/index.js +35 -35
  104. package/node_modules/winston/lib/winston/container.js +114 -114
  105. package/node_modules/winston/lib/winston/create-logger.js +104 -104
  106. package/node_modules/winston/lib/winston/exception-handler.js +245 -245
  107. package/node_modules/winston/lib/winston/exception-stream.js +54 -54
  108. package/node_modules/winston/lib/winston/logger.js +676 -667
  109. package/node_modules/winston/lib/winston/profiler.js +51 -51
  110. package/node_modules/winston/lib/winston/rejection-handler.js +251 -251
  111. package/node_modules/winston/lib/winston/tail-file.js +124 -124
  112. package/node_modules/winston/lib/winston/transports/console.js +117 -117
  113. package/node_modules/winston/lib/winston/transports/file.js +695 -695
  114. package/node_modules/winston/lib/winston/transports/http.js +267 -202
  115. package/node_modules/winston/lib/winston/transports/index.d.ts +103 -100
  116. package/node_modules/winston/lib/winston/transports/index.js +56 -56
  117. package/node_modules/winston/lib/winston/transports/stream.js +63 -63
  118. package/node_modules/winston/lib/winston.js +176 -182
  119. package/node_modules/winston/node_modules/winston-transport/.babelrc +3 -0
  120. package/node_modules/winston/node_modules/winston-transport/.eslintrc +7 -0
  121. package/node_modules/winston/node_modules/winston-transport/.gitattributes +1 -0
  122. package/node_modules/winston/node_modules/winston-transport/.nyc_output/c3d7ddb9-cc26-466b-a4f6-993ad69e86f6.json +1 -0
  123. package/node_modules/winston/node_modules/winston-transport/.nyc_output/processinfo/c3d7ddb9-cc26-466b-a4f6-993ad69e86f6.json +1 -0
  124. package/node_modules/winston/node_modules/winston-transport/.nyc_output/processinfo/index.json +1 -0
  125. package/node_modules/winston/node_modules/winston-transport/CHANGELOG.md +126 -0
  126. package/node_modules/winston/node_modules/winston-transport/LICENSE +22 -0
  127. package/node_modules/winston/node_modules/winston-transport/README.md +50 -0
  128. package/node_modules/winston/node_modules/winston-transport/dist/index.js +215 -0
  129. package/node_modules/winston/node_modules/winston-transport/dist/legacy.js +116 -0
  130. package/node_modules/winston/node_modules/winston-transport/index.d.ts +39 -0
  131. package/node_modules/winston/node_modules/winston-transport/index.js +215 -0
  132. package/node_modules/winston/node_modules/winston-transport/legacy.js +119 -0
  133. package/node_modules/winston/node_modules/winston-transport/package.json +56 -0
  134. package/node_modules/winston/package.json +76 -75
  135. package/package.json +6 -4
  136. package/node_modules/@dabh/diagnostics/example.png +0 -0
  137. package/node_modules/color-string/CHANGELOG.md +0 -18
  138. package/node_modules/colorspace/test.js +0 -14
  139. package/node_modules/fecha/CHANGELOG.md +0 -67
  140. package/node_modules/logform/.travis.yml +0 -17
  141. package/node_modules/winston/CHANGELOG.md +0 -560
@@ -0,0 +1,170 @@
1
+ # safe-stable-stringify
2
+
3
+ Safe, deterministic and fast serialization alternative to [JSON.stringify][]. Zero dependencies. ESM and CJS. 100% coverage.
4
+
5
+ Gracefully handles circular structures and bigint instead of throwing.
6
+
7
+ Optional custom circular values and deterministic behavior.
8
+
9
+ ## stringify(value[, replacer[, space]])
10
+
11
+ The same as [JSON.stringify][].
12
+
13
+ * `value` {any}
14
+ * `replacer` {string[]|function|null}
15
+ * `space` {number|string}
16
+ * Returns: {string}
17
+
18
+ ```js
19
+ const stringify = require('safe-stable-stringify')
20
+
21
+ const bigint = { a: 0, c: 2n, b: 1 }
22
+
23
+ stringify(bigint)
24
+ // '{"a":0,"b":1,"c":2}'
25
+ JSON.stringify(bigint)
26
+ // TypeError: Do not know how to serialize a BigInt
27
+
28
+ const circular = { b: 1, a: 0 }
29
+ circular.circular = circular
30
+
31
+ stringify(circular)
32
+ // '{"a":0,"b":1,"circular":"[Circular]"}'
33
+ JSON.stringify(circular)
34
+ // TypeError: Converting circular structure to JSON
35
+
36
+ stringify(circular, ['a', 'b'], 2)
37
+ // {
38
+ // "a": 0,
39
+ // "b": 1
40
+ // }
41
+ ```
42
+
43
+ ## stringify.configure(options)
44
+
45
+ * `bigint` {boolean} If `true`, bigint values are converted to a number. Otherwise
46
+ they are ignored. **Default:** `true`.
47
+ * `circularValue` {string|null|undefined|ErrorConstructor} Defines the value for
48
+ circular references. Set to `undefined`, circular properties are not
49
+ serialized (array entries are replaced with `null`). Set to `Error`, to throw
50
+ on circular references. **Default:** `[Circular]`.
51
+ * `deterministic` {boolean} If `true`, guarantee a deterministic key order
52
+ instead of relying on the insertion order. **Default:** `true`.
53
+ * `maximumBreadth` {number} Maximum number of entries to serialize per object
54
+ (at least one). The serialized output contains information about how many
55
+ entries have not been serialized. Ignored properties are counted as well
56
+ (e.g., properties with symbol values). Using the array replacer overrules this
57
+ option. **Default:** `Infinity`
58
+ * `maximumDepth` {number} Maximum number of object nesting levels (at least 1)
59
+ that will be serialized. Objects at the maximum level are serialized as
60
+ `'[Object]'` and arrays as `'[Array]'`. **Default:** `Infinity`
61
+ * Returns: {function} A stringify function with the options applied.
62
+
63
+ ```js
64
+ import { configure } from 'safe-stable-stringify'
65
+
66
+ const stringify = configure({
67
+ bigint: true,
68
+ circularValue: 'Magic circle!',
69
+ deterministic: false,
70
+ maximumDepth: 1,
71
+ maximumBreadth: 4
72
+ })
73
+
74
+ const circular = {
75
+ bigint: 999_999_999_999_999_999n,
76
+ typed: new Uint8Array(3),
77
+ deterministic: "I don't think so",
78
+ }
79
+ circular.circular = circular
80
+ circular.ignored = true
81
+ circular.alsoIgnored = 'Yes!'
82
+
83
+ const stringified = stringify(circular, null, 4)
84
+
85
+ console.log(stringified)
86
+ // {
87
+ // "bigint": 999999999999999999,
88
+ // "typed": "[Object]",
89
+ // "deterministic": "I don't think so",
90
+ // "circular": "Magic circle!",
91
+ // "...": "2 items not stringified"
92
+ // }
93
+
94
+ const throwOnCircular = configure({
95
+ circularValue: Error
96
+ })
97
+
98
+ throwOnCircular(circular);
99
+ // TypeError: Converting circular structure to JSON
100
+ ```
101
+
102
+ ## Differences to JSON.stringify
103
+
104
+ 1. _Circular values_ are replaced with the string `[Circular]` (the value may be changed).
105
+ 1. _Object keys_ are sorted instead of using the insertion order (it is possible to deactivate this).
106
+ 1. _BigInt_ values are stringified as regular number instead of throwing a TypeError.
107
+ 1. _Boxed primitives_ (e.g., `Number(5)`) are not unboxed and are handled as
108
+ regular object.
109
+
110
+ Those are the only differences to `JSON.stringify()`. This is a side effect free
111
+ variant and [`toJSON`][], [`replacer`][] and the [`spacer`][] work the same as
112
+ with `JSON.stringify()`.
113
+
114
+ ## Performance / Benchmarks
115
+
116
+ Currently this is by far the fastest known stable (deterministic) stringify
117
+ implementation. This is especially important for big objects and TypedArrays.
118
+
119
+ (Dell Precision 5540, i7-9850H CPU @ 2.60GHz, Node.js 16.11.1)
120
+
121
+ ```md
122
+ simple: simple object x 3,463,894 ops/sec ±0.44% (98 runs sampled)
123
+ simple: circular x 1,236,007 ops/sec ±0.46% (99 runs sampled)
124
+ simple: deep x 18,942 ops/sec ±0.41% (93 runs sampled)
125
+ simple: deep circular x 18,690 ops/sec ±0.72% (96 runs sampled)
126
+
127
+ replacer: simple object x 2,664,940 ops/sec ±0.31% (98 runs sampled)
128
+ replacer: circular x 1,015,981 ops/sec ±0.09% (99 runs sampled)
129
+ replacer: deep x 17,328 ops/sec ±0.38% (97 runs sampled)
130
+ replacer: deep circular x 17,071 ops/sec ±0.21% (98 runs sampled)
131
+
132
+ array: simple object x 3,869,608 ops/sec ±0.22% (98 runs sampled)
133
+ array: circular x 3,853,943 ops/sec ±0.45% (96 runs sampled)
134
+ array: deep x 3,563,227 ops/sec ±0.20% (100 runs sampled)
135
+ array: deep circular x 3,286,475 ops/sec ±0.07% (100 runs sampled)
136
+
137
+ indentation: simple object x 2,183,162 ops/sec ±0.66% (97 runs sampled)
138
+ indentation: circular x 872,538 ops/sec ±0.57% (98 runs sampled)
139
+ indentation: deep x 16,795 ops/sec ±0.48% (93 runs sampled)
140
+ indentation: deep circular x 16,443 ops/sec ±0.40% (97 runs sampled)
141
+ ```
142
+
143
+ Comparing `safe-stable-stringify` with known alternatives:
144
+
145
+ ```md
146
+ fast-json-stable-stringify x 18,765 ops/sec ±0.71% (94 runs sampled)
147
+ json-stable-stringify x 13,870 ops/sec ±0.72% (94 runs sampled)
148
+ fast-stable-stringify x 21,343 ops/sec ±0.33% (95 runs sampled)
149
+ faster-stable-stringify x 17,707 ops/sec ±0.44% (97 runs sampled)
150
+ json-stringify-deterministic x 11,208 ops/sec ±0.57% (98 runs sampled)
151
+ fast-safe-stringify x 21,460 ops/sec ±0.75% (99 runs sampled)
152
+ this x 30,367 ops/sec ±0.39% (96 runs sampled)
153
+
154
+ The fastest is this
155
+ ```
156
+
157
+ The `fast-safe-stringify` comparison uses the modules stable implementation.
158
+
159
+ ## Acknowledgements
160
+
161
+ Sponsored by [MaibornWolff](https://www.maibornwolff.de/) and [nearForm](http://nearform.com)
162
+
163
+ ## License
164
+
165
+ MIT
166
+
167
+ [`replacer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The%20replacer%20parameter
168
+ [`spacer`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The%20space%20argument
169
+ [`toJSON`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON()_behavior
170
+ [JSON.stringify]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
@@ -0,0 +1,22 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": "./",
4
+ "allowJs": true,
5
+ "checkJs": true,
6
+ "sourceMap": false,
7
+ "declaration": false,
8
+ "noEmit": true,
9
+ "downlevelIteration": false,
10
+ "experimentalDecorators": false,
11
+ "moduleResolution": "node",
12
+ "importHelpers": false,
13
+ "target": "esnext",
14
+ "module": "CommonJS",
15
+ "lib": [
16
+ "esnext",
17
+ "dom"
18
+ ]
19
+ },
20
+ "include": ["**/*.js", "**/*.ts"],
21
+ "exclude": ["compare.js", "benchmark.js", "./coverage"]
22
+ }
@@ -1,19 +1,19 @@
1
- Copyright (c) 2010 Charlie Robbins
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in
11
- all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1
+ Copyright (c) 2010 Charlie Robbins
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  THE SOFTWARE.