@contrast/agent 4.32.10 → 4.32.12

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 (228) hide show
  1. package/bin/VERSION +1 -1
  2. package/bin/contrast-service-darwin-arm64 +0 -0
  3. package/bin/contrast-service-darwin-x64 +0 -0
  4. package/bin/contrast-service-linux-arm64 +0 -0
  5. package/bin/contrast-service-linux-x64 +0 -0
  6. package/bin/contrast-service-win32-x64.exe +0 -0
  7. package/node_modules/file-stream-rotator/FileStreamRotator.js +200 -41
  8. package/node_modules/file-stream-rotator/LICENSE.txt +17 -0
  9. package/node_modules/file-stream-rotator/README.md +16 -1
  10. package/node_modules/file-stream-rotator/package.json +5 -5
  11. package/node_modules/file-stream-rotator/tests/every-minute-test.js +32 -15
  12. package/node_modules/file-stream-rotator/tests/every-second-test.js +16 -7
  13. package/node_modules/file-stream-rotator/tests/large-test.js +33 -0
  14. package/node_modules/file-stream-rotator/tests/rotate-on-size-without-date.js +103 -0
  15. package/node_modules/object-hash/dist/object_hash.js +1 -2
  16. package/node_modules/object-hash/index.js +33 -21
  17. package/node_modules/object-hash/package.json +20 -18
  18. package/node_modules/object-hash/readme.markdown +20 -5
  19. package/node_modules/winston-daily-rotate-file/README.md +81 -12
  20. package/node_modules/winston-daily-rotate-file/daily-rotate-file.js +69 -30
  21. package/node_modules/winston-daily-rotate-file/index.d.ts +119 -72
  22. package/node_modules/winston-daily-rotate-file/package.json +20 -19
  23. package/node_modules/winston-transport/.eslintrc +1 -1
  24. package/node_modules/winston-transport/.nyc_output/c3d7ddb9-cc26-466b-a4f6-993ad69e86f6.json +1 -0
  25. package/node_modules/winston-transport/.nyc_output/processinfo/c3d7ddb9-cc26-466b-a4f6-993ad69e86f6.json +1 -0
  26. package/node_modules/winston-transport/.nyc_output/processinfo/index.json +1 -1
  27. package/node_modules/winston-transport/CHANGELOG.md +11 -0
  28. package/node_modules/winston-transport/dist/index.js +2 -2
  29. package/node_modules/winston-transport/index.d.ts +2 -0
  30. package/node_modules/winston-transport/index.js +2 -2
  31. package/node_modules/winston-transport/node_modules/readable-stream/README.md +106 -0
  32. package/node_modules/winston-transport/node_modules/readable-stream/errors-browser.js +127 -0
  33. package/node_modules/winston-transport/node_modules/readable-stream/errors.js +116 -0
  34. package/node_modules/winston-transport/node_modules/readable-stream/experimentalWarning.js +17 -0
  35. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_duplex.js +41 -46
  36. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_passthrough.js +1 -11
  37. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_readable.js +271 -263
  38. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_transform.js +18 -42
  39. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_writable.js +101 -147
  40. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/async_iterator.js +180 -0
  41. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/buffer_list.js +183 -0
  42. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/destroy.js +96 -0
  43. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +86 -0
  44. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -0
  45. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/from.js +52 -0
  46. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/pipeline.js +86 -0
  47. package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/state.js +22 -0
  48. package/node_modules/winston-transport/node_modules/readable-stream/package.json +72 -0
  49. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/readable-browser.js +2 -0
  50. package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/readable.js +5 -8
  51. package/node_modules/winston-transport/package.json +16 -14
  52. package/package.json +6 -6
  53. package/node_modules/colors/LICENSE +0 -25
  54. package/node_modules/colors/README.md +0 -221
  55. package/node_modules/colors/examples/normal-usage.js +0 -82
  56. package/node_modules/colors/examples/safe-string.js +0 -79
  57. package/node_modules/colors/index.d.ts +0 -136
  58. package/node_modules/colors/lib/colors.js +0 -211
  59. package/node_modules/colors/lib/custom/trap.js +0 -46
  60. package/node_modules/colors/lib/custom/zalgo.js +0 -110
  61. package/node_modules/colors/lib/extendStringPrototype.js +0 -110
  62. package/node_modules/colors/lib/index.js +0 -13
  63. package/node_modules/colors/lib/maps/america.js +0 -10
  64. package/node_modules/colors/lib/maps/rainbow.js +0 -12
  65. package/node_modules/colors/lib/maps/random.js +0 -11
  66. package/node_modules/colors/lib/maps/zebra.js +0 -5
  67. package/node_modules/colors/lib/styles.js +0 -95
  68. package/node_modules/colors/lib/system/has-flag.js +0 -35
  69. package/node_modules/colors/lib/system/supports-colors.js +0 -151
  70. package/node_modules/colors/package.json +0 -49
  71. package/node_modules/colors/safe.d.ts +0 -48
  72. package/node_modules/colors/safe.js +0 -10
  73. package/node_modules/colors/themes/generic-logging.js +0 -12
  74. package/node_modules/core-util-is/LICENSE +0 -19
  75. package/node_modules/core-util-is/README.md +0 -3
  76. package/node_modules/core-util-is/float.patch +0 -604
  77. package/node_modules/core-util-is/lib/util.js +0 -107
  78. package/node_modules/core-util-is/package.json +0 -36
  79. package/node_modules/core-util-is/test.js +0 -68
  80. package/node_modules/cycle/README.md +0 -49
  81. package/node_modules/cycle/cycle.js +0 -170
  82. package/node_modules/cycle/package.json +0 -16
  83. package/node_modules/fast-safe-stringify/.travis.yml +0 -8
  84. package/node_modules/fast-safe-stringify/CHANGELOG.md +0 -17
  85. package/node_modules/fast-safe-stringify/LICENSE +0 -23
  86. package/node_modules/fast-safe-stringify/benchmark.js +0 -137
  87. package/node_modules/fast-safe-stringify/index.d.ts +0 -8
  88. package/node_modules/fast-safe-stringify/index.js +0 -161
  89. package/node_modules/fast-safe-stringify/package.json +0 -50
  90. package/node_modules/fast-safe-stringify/readme.md +0 -154
  91. package/node_modules/fast-safe-stringify/test-stable.js +0 -311
  92. package/node_modules/fast-safe-stringify/test.js +0 -304
  93. package/node_modules/isarray/.npmignore +0 -1
  94. package/node_modules/isarray/.travis.yml +0 -4
  95. package/node_modules/isarray/Makefile +0 -6
  96. package/node_modules/isarray/README.md +0 -60
  97. package/node_modules/isarray/component.json +0 -19
  98. package/node_modules/isarray/index.js +0 -5
  99. package/node_modules/isarray/package.json +0 -49
  100. package/node_modules/isarray/test.js +0 -20
  101. package/node_modules/object-hash/.jshintrc +0 -19
  102. package/node_modules/object-hash/.travis.yml +0 -35
  103. package/node_modules/object-hash/bower.json +0 -15
  104. package/node_modules/object-hash/dist/object_hash.js.map +0 -1
  105. package/node_modules/object-hash/dist/object_hash_test.js +0 -4737
  106. package/node_modules/object-hash/gulpfile.js +0 -97
  107. package/node_modules/object-hash/karma.conf.js +0 -69
  108. package/node_modules/object-hash/test/blob.js +0 -41
  109. package/node_modules/object-hash/test/index.js +0 -290
  110. package/node_modules/object-hash/test/object-classes.js +0 -106
  111. package/node_modules/object-hash/test/old-crypto.js +0 -60
  112. package/node_modules/object-hash/test/replacer.js +0 -36
  113. package/node_modules/object-hash/test/types.js +0 -174
  114. package/node_modules/object-hash/test/writeToStream.js +0 -27
  115. package/node_modules/process-nextick-args/index.js +0 -45
  116. package/node_modules/process-nextick-args/license.md +0 -19
  117. package/node_modules/process-nextick-args/package.json +0 -29
  118. package/node_modules/process-nextick-args/readme.md +0 -18
  119. package/node_modules/readable-stream/.travis.yml +0 -34
  120. package/node_modules/readable-stream/README.md +0 -58
  121. package/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
  122. package/node_modules/readable-stream/duplex-browser.js +0 -1
  123. package/node_modules/readable-stream/duplex.js +0 -1
  124. package/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -79
  125. package/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -74
  126. package/node_modules/readable-stream/package.json +0 -56
  127. package/node_modules/readable-stream/passthrough.js +0 -1
  128. package/node_modules/readable-stream/transform.js +0 -1
  129. package/node_modules/readable-stream/writable-browser.js +0 -1
  130. package/node_modules/readable-stream/writable.js +0 -8
  131. package/node_modules/winston-compat/.gitattributes +0 -1
  132. package/node_modules/winston-compat/.node-version +0 -1
  133. package/node_modules/winston-compat/CHANGELOG.md +0 -17
  134. package/node_modules/winston-compat/LICENSE +0 -22
  135. package/node_modules/winston-compat/README.md +0 -2
  136. package/node_modules/winston-compat/index.js +0 -295
  137. package/node_modules/winston-compat/lib/transport.js +0 -135
  138. package/node_modules/winston-compat/node_modules/fecha/CHANGELOG.md +0 -11
  139. package/node_modules/winston-compat/node_modules/fecha/LICENSE +0 -22
  140. package/node_modules/winston-compat/node_modules/fecha/README.md +0 -259
  141. package/node_modules/winston-compat/node_modules/fecha/fecha.d.ts +0 -47
  142. package/node_modules/winston-compat/node_modules/fecha/fecha.js +0 -334
  143. package/node_modules/winston-compat/node_modules/fecha/fecha.min.js +0 -1
  144. package/node_modules/winston-compat/node_modules/fecha/package.json +0 -44
  145. package/node_modules/winston-compat/node_modules/logform/.babelrc +0 -3
  146. package/node_modules/winston-compat/node_modules/logform/.eslintrc +0 -7
  147. package/node_modules/winston-compat/node_modules/logform/.gitattributes +0 -1
  148. package/node_modules/winston-compat/node_modules/logform/.travis.yml +0 -17
  149. package/node_modules/winston-compat/node_modules/logform/CHANGELOG.md +0 -103
  150. package/node_modules/winston-compat/node_modules/logform/LICENSE +0 -21
  151. package/node_modules/winston-compat/node_modules/logform/README.md +0 -170
  152. package/node_modules/winston-compat/node_modules/logform/align.js +0 -14
  153. package/node_modules/winston-compat/node_modules/logform/browser.js +0 -36
  154. package/node_modules/winston-compat/node_modules/logform/cli.js +0 -52
  155. package/node_modules/winston-compat/node_modules/logform/colorize.js +0 -118
  156. package/node_modules/winston-compat/node_modules/logform/combine.js +0 -66
  157. package/node_modules/winston-compat/node_modules/logform/dist/align.js +0 -14
  158. package/node_modules/winston-compat/node_modules/logform/dist/browser.js +0 -37
  159. package/node_modules/winston-compat/node_modules/logform/dist/cli.js +0 -75
  160. package/node_modules/winston-compat/node_modules/logform/dist/colorize.js +0 -147
  161. package/node_modules/winston-compat/node_modules/logform/dist/combine.js +0 -66
  162. package/node_modules/winston-compat/node_modules/logform/dist/format.js +0 -69
  163. package/node_modules/winston-compat/node_modules/logform/dist/index.js +0 -54
  164. package/node_modules/winston-compat/node_modules/logform/dist/json.js +0 -27
  165. package/node_modules/winston-compat/node_modules/logform/dist/label.js +0 -19
  166. package/node_modules/winston-compat/node_modules/logform/dist/levels.js +0 -15
  167. package/node_modules/winston-compat/node_modules/logform/dist/logstash.js +0 -32
  168. package/node_modules/winston-compat/node_modules/logform/dist/metadata.js +0 -63
  169. package/node_modules/winston-compat/node_modules/logform/dist/ms.js +0 -18
  170. package/node_modules/winston-compat/node_modules/logform/dist/pad-levels.js +0 -118
  171. package/node_modules/winston-compat/node_modules/logform/dist/pretty-print.js +0 -20
  172. package/node_modules/winston-compat/node_modules/logform/dist/printf.js +0 -40
  173. package/node_modules/winston-compat/node_modules/logform/dist/simple.js +0 -36
  174. package/node_modules/winston-compat/node_modules/logform/dist/splat.js +0 -147
  175. package/node_modules/winston-compat/node_modules/logform/dist/timestamp.js +0 -28
  176. package/node_modules/winston-compat/node_modules/logform/dist/uncolorize.js +0 -31
  177. package/node_modules/winston-compat/node_modules/logform/examples/combine.js +0 -14
  178. package/node_modules/winston-compat/node_modules/logform/examples/filter.js +0 -30
  179. package/node_modules/winston-compat/node_modules/logform/examples/invalid.js +0 -6
  180. package/node_modules/winston-compat/node_modules/logform/examples/metadata.js +0 -78
  181. package/node_modules/winston-compat/node_modules/logform/examples/padLevels.js +0 -39
  182. package/node_modules/winston-compat/node_modules/logform/examples/volume.js +0 -25
  183. package/node_modules/winston-compat/node_modules/logform/format.js +0 -52
  184. package/node_modules/winston-compat/node_modules/logform/index.d.ts +0 -53
  185. package/node_modules/winston-compat/node_modules/logform/index.js +0 -52
  186. package/node_modules/winston-compat/node_modules/logform/json.js +0 -26
  187. package/node_modules/winston-compat/node_modules/logform/label.js +0 -19
  188. package/node_modules/winston-compat/node_modules/logform/levels.js +0 -12
  189. package/node_modules/winston-compat/node_modules/logform/logstash.js +0 -29
  190. package/node_modules/winston-compat/node_modules/logform/metadata.js +0 -61
  191. package/node_modules/winston-compat/node_modules/logform/ms.js +0 -18
  192. package/node_modules/winston-compat/node_modules/logform/package.json +0 -51
  193. package/node_modules/winston-compat/node_modules/logform/pad-levels.js +0 -83
  194. package/node_modules/winston-compat/node_modules/logform/pretty-print.js +0 -16
  195. package/node_modules/winston-compat/node_modules/logform/printf.js +0 -26
  196. package/node_modules/winston-compat/node_modules/logform/simple.js +0 -33
  197. package/node_modules/winston-compat/node_modules/logform/splat.js +0 -125
  198. package/node_modules/winston-compat/node_modules/logform/timestamp.js +0 -30
  199. package/node_modules/winston-compat/node_modules/logform/tsconfig.json +0 -22
  200. package/node_modules/winston-compat/node_modules/logform/uncolorize.js +0 -27
  201. package/node_modules/winston-compat/package.json +0 -46
  202. package/node_modules/winston-compat/test/clone.test.js +0 -25
  203. package/node_modules/winston-compat/test/helpers.js +0 -256
  204. package/node_modules/winston-compat/test/timestamp.test.js +0 -14
  205. package/node_modules/winston-compat/test/transports/transport.js +0 -205
  206. package/node_modules/winston-compat/test/winston-compat.test.js +0 -18
  207. package/node_modules/winston-daily-rotate-file/.eslintrc.js +0 -11
  208. package/node_modules/winston-daily-rotate-file/.node-version +0 -1
  209. package/node_modules/winston-daily-rotate-file/.travis.yml +0 -15
  210. package/node_modules/winston-daily-rotate-file/node_modules/semver/CHANGELOG.md +0 -70
  211. package/node_modules/winston-daily-rotate-file/node_modules/semver/LICENSE +0 -15
  212. package/node_modules/winston-daily-rotate-file/node_modules/semver/README.md +0 -443
  213. package/node_modules/winston-daily-rotate-file/node_modules/semver/bin/semver.js +0 -174
  214. package/node_modules/winston-daily-rotate-file/node_modules/semver/package.json +0 -32
  215. package/node_modules/winston-daily-rotate-file/node_modules/semver/range.bnf +0 -16
  216. package/node_modules/winston-daily-rotate-file/node_modules/semver/semver.js +0 -1596
  217. package/node_modules/winston-daily-rotate-file/test/memory-stream.js +0 -38
  218. package/node_modules/winston-daily-rotate-file/test/random-string.js +0 -31
  219. package/node_modules/winston-daily-rotate-file/test/transport-tests.js +0 -250
  220. package/node_modules/winston-transport/.nyc_output/1c69f3e4-4c25-457d-9df5-dfa761729528.json +0 -1
  221. package/node_modules/winston-transport/.nyc_output/processinfo/1c69f3e4-4c25-457d-9df5-dfa761729528.json +0 -1
  222. package/node_modules/winston-transport/.travis.yml +0 -17
  223. package/node_modules/winston-transport/tsconfig.json +0 -22
  224. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/CONTRIBUTING.md +0 -0
  225. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/GOVERNANCE.md +0 -0
  226. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/LICENSE +0 -0
  227. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/internal/streams/stream-browser.js +0 -0
  228. /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/internal/streams/stream.js +0 -0
@@ -1,97 +0,0 @@
1
- 'use strict';
2
-
3
- var gulp = require('gulp');
4
- var jshint = require('gulp-jshint');
5
- var exec = require('gulp-exec');
6
- var stylish = require('jshint-stylish');
7
- var browserify = require('gulp-browserify');
8
- var uglify = require('gulp-uglify');
9
- var rename = require('gulp-rename');
10
- var karma = require('karma');
11
- var coveralls = require('gulp-coveralls');
12
- var istanbul = require('gulp-istanbul');
13
- var mocha = require('gulp-mocha');
14
-
15
- var paths = {
16
- index: './index.js',
17
- tests: './test/**/*.js'
18
- };
19
-
20
- function preTest(src) {
21
- return gulp.src(src)
22
- .pipe(istanbul())
23
- .pipe(istanbul.hookRequire());
24
- }
25
-
26
- function test(src){
27
- return gulp.src(src)
28
- .pipe(mocha())
29
- .pipe(istanbul.writeReports());
30
- }
31
-
32
- function testKarma(done){
33
- new karma.Server({
34
- configFile: __dirname + '/karma.conf.js',
35
- singleRun: true
36
- }, done).start();
37
- }
38
-
39
- function lint(src){
40
- return gulp.src(src)
41
- .pipe(jshint('.jshintrc'))
42
- .pipe(jshint.reporter(stylish));
43
- }
44
-
45
- gulp.task('dist', function(){
46
- gulp.src([paths.index])
47
- .pipe(browserify({
48
- insertGlobals : true,
49
- debug: true,
50
- standalone: 'objectHash'
51
- }))
52
- .pipe(rename('object_hash.js'))
53
- .pipe(uglify({outSourceMap: true}))
54
- .pipe(gulp.dest('./dist'));
55
- // tests
56
- gulp.src([paths.tests])
57
- .pipe(browserify())
58
- .pipe(rename('object_hash_test.js'))
59
- .pipe(gulp.dest('./dist'));
60
- });
61
-
62
- gulp.task('pre-test', function() {
63
- preTest([paths.index]);
64
- });
65
-
66
- gulp.task('test', ['pre-test'], function() {
67
- test([paths.tests]);
68
- });
69
-
70
- gulp.task('karma', function() {
71
- testKarma();
72
- });
73
-
74
- gulp.task('coveralls', function() {
75
- gulp.src('coverage/**/lcov.info')
76
- .pipe(coveralls());
77
- });
78
-
79
- gulp.task('lint', function () {
80
- return lint([paths.index]);
81
- });
82
-
83
- gulp.task('watch', function () {
84
-
85
- // watch and lint any files that are added or changed
86
- gulp.watch([paths.index, paths.tests], function(event){
87
- if(event.type !== 'deleted') {
88
- lint([event.path]);
89
- }
90
- });
91
-
92
- // run the tests when something changes
93
- gulp.watch([paths.index, paths.tests], ['test', 'karma']);
94
-
95
- });
96
-
97
- gulp.task('default', ['watch']);
@@ -1,69 +0,0 @@
1
- // Karma configuration
2
- // Generated on Thu Dec 10 2015 03:01:27 GMT+0100 (CET)
3
-
4
- module.exports = function(config) {
5
- config.set({
6
-
7
- // base path that will be used to resolve all patterns (eg. files, exclude)
8
- basePath: '',
9
-
10
-
11
- // frameworks to use
12
- // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
13
- frameworks: ['mocha'],
14
-
15
-
16
- // list of files / patterns to load in the browser
17
- files: [
18
- 'dist/*.js'
19
- ],
20
-
21
-
22
- // list of files to exclude
23
- exclude: [
24
- ],
25
-
26
-
27
- // preprocess matching files before serving them to the browser
28
- // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
29
- preprocessors: {
30
- },
31
-
32
-
33
- // test results reporter to use
34
- // possible values: 'dots', 'progress'
35
- // available reporters: https://npmjs.org/browse/keyword/karma-reporter
36
- reporters: ['progress'],
37
-
38
-
39
- // web server port
40
- port: 9876,
41
-
42
-
43
- // enable / disable colors in the output (reporters and logs)
44
- colors: true,
45
-
46
-
47
- // level of logging
48
- // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
49
- logLevel: config.LOG_INFO,
50
-
51
-
52
- // enable / disable watching file and executing tests whenever any file changes
53
- autoWatch: true,
54
-
55
-
56
- // start these browsers
57
- // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
58
- browsers: ['PhantomJS', 'Firefox'],
59
-
60
-
61
- // Continuous Integration mode
62
- // if true, Karma captures browsers, runs the tests and exits
63
- singleRun: false,
64
-
65
- // Concurrency level
66
- // how many browser should be started simultanous
67
- concurrency: Infinity
68
- })
69
- }
@@ -1,41 +0,0 @@
1
- 'use strict';
2
-
3
- var assert = require('assert');
4
- var hash = require('../index');
5
-
6
- if (typeof Blob !== 'undefined') {
7
- describe('hash()ing Blob objects', function() {
8
- var blob;
9
- before('create blob', function() {
10
- try {
11
- blob = new Blob(['ABC']);
12
- } catch(e) {
13
- // https://github.com/ariya/phantomjs/issues/11013
14
- if (!e.message.match(/'\[object BlobConstructor\]' is not a constructor/)) {
15
- throw e;
16
- }
17
-
18
- var builder = new WebKitBlobBuilder();
19
- builder.append('ABC');
20
- blob = builder.getBlob();
21
- }
22
- });
23
-
24
- it('should throw when trying to hash a blob', function() {
25
- assert.throws(function() {
26
- hash(blob);
27
- }, /not supported/);
28
-
29
- assert.throws(function() {
30
- hash({abcdef: blob});
31
- }, /not supported/);
32
- });
33
-
34
- it('should not throw when trying to hash a blob with ignoreUnknown', function() {
35
- var opt = {ignoreUnknown: true};
36
-
37
- assert.ok(validSha1.test(hash(blob, opt)), 'ignore Blob');
38
- assert.ok(validSha1.test(hash({abcdef: blob}, opt)), 'ignore Blob');
39
- });
40
- });
41
- }
@@ -1,290 +0,0 @@
1
- 'use strict';
2
-
3
- var assert = require('assert');
4
- var crypto = require('crypto');
5
- var hash = require('../index');
6
- var validSha1 = /^[0-9a-f]{40}$/i;
7
-
8
- describe('hash', function() {
9
- it('throws when nothing to hash', function () {
10
- assert.throws(hash, 'no arguments');
11
- assert.throws(function() {
12
- hash(undefined, {algorithm: 'md5'});
13
- }, 'undefined');
14
- });
15
-
16
- it('throws when passed an invalid options', function() {
17
- assert.throws(function() {
18
- hash({foo: 'bar'}, {algorithm: 'shalala'});
19
- }, 'bad algorithm');
20
- assert.throws(function() {
21
- hash({foo: 'bar'}, {encoding: 'base16'});
22
- }, 'bad encoding');
23
- });
24
-
25
- it('hashes a simple object', function() {
26
- assert.ok(validSha1.test(hash({foo: 'bar', bar: 'baz'})), 'hash object');
27
- });
28
-
29
- if (typeof Buffer !== 'undefined') {
30
- it('can return buffers', function() {
31
- assert.ok(Buffer.isBuffer(hash({foo: 'bar', bar: 'baz'}, {encoding: 'buffer'})), 'hash object');
32
- });
33
- }
34
-
35
- it('hashes identical objects with different key ordering', function() {
36
- var hash1 = hash({foo: 'bar', bar: 'baz'});
37
- var hash2 = hash({bar: 'baz', foo: 'bar'});
38
- var hash3 = hash({bar: 'foo', foo: 'baz'});
39
- assert.equal(hash1, hash2, 'hashes are equal');
40
- assert.notEqual(hash1, hash3, 'different objects not equal');
41
- });
42
-
43
- it('respects object key ordering when unorderedObjects = false', function() {
44
- var hash1 = hash({foo: 'bar', bar: 'baz'}, { unorderedObjects: false });
45
- var hash2 = hash({bar: 'baz', foo: 'bar'}, { unorderedObjects: false });
46
- assert.notEqual(hash1, hash2, 'hashes are not equal');
47
- });
48
-
49
- it('hashes only object keys when excludeValues option is set', function() {
50
- var hash1 = hash({foo: false, bar: 'OK'}, { excludeValues: true });
51
- var hash2 = hash({foo: true, bar: 'NO'}, { excludeValues: true });
52
- var hash3 = hash({foo: true, bar: 'OK', baz: false}, { excludeValues: true });
53
- assert.equal(hash1, hash2, 'values not in hash digest');
54
- assert.notEqual(hash1, hash3, 'different keys not equal');
55
- });
56
-
57
- it('array values are hashed', function() {
58
- var hash1 = hash({foo: ['bar', 'baz'], bax: true });
59
- var hash2 = hash({foo: ['baz', 'bar'], bax: true });
60
- assert.notEqual(hash1, hash2, 'different array orders are unique');
61
- });
62
-
63
- it('nested object values are hashed', function() {
64
- var hash1 = hash({foo: {bar: true, bax: 1}});
65
- var hash2 = hash({foo: {bar: true, bax: 1}});
66
- var hash3 = hash({foo: {bar: false, bax: 1}});
67
- assert.equal(hash1, hash2, 'hashes are equal');
68
- assert.notEqual(hash1, hash3, 'different objects not equal');
69
- });
70
-
71
- it('sugar methods should be equivalent', function() {
72
- var obj = {foo: 'bar', baz: true};
73
- assert.equal(hash.keys(obj), hash(obj, {excludeValues: true}), 'keys');
74
- assert.equal(hash.sha1(obj), hash(obj, {algorithm: 'sha1'}), 'sha1');
75
- assert.equal(hash.MD5(obj), hash(obj, {algorithm: 'md5'}), 'md5');
76
- assert.equal(hash.keysMD5(obj),
77
- hash(obj, {algorithm: 'md5', excludeValues: true}), 'keys md5');
78
- });
79
-
80
- it('array of nested object values are hashed', function() {
81
- var hash1 = hash({foo: [ {bar: true, bax: 1}, {bar: false, bax: 2} ] });
82
- var hash2 = hash({foo: [ {bar: true, bax: 1}, {bar: false, bax: 2} ] });
83
- var hash3 = hash({foo: [ {bar: false, bax: 2} ] });
84
- assert.equal(hash1, hash2, 'hashes are equal');
85
- assert.notEqual(hash1, hash3, 'different objects not equal');
86
- });
87
-
88
- it("recursive objects don't blow up stack", function() {
89
- var hash1 = {foo: 'bar'};
90
- hash1.recursive = hash1;
91
- assert.doesNotThrow(function() {hash(hash1);}, /Maximum call stack size exceeded/, 'Should not throw an stack size exceeded exception');
92
- });
93
-
94
- it("recursive arrays don't blow up stack", function() {
95
- var hash1 = ['foo', 'bar'];
96
- hash1.push(hash1);
97
- assert.doesNotThrow(function() {hash(hash1);}, /Maximum call stack size exceeded/, 'Should not throw an stack size exceeded exception');
98
- });
99
-
100
- it("recursive arrays don't blow up stack with unorderedArrays", function() {
101
- var hash1 = ['foo', 'bar'];
102
- hash1.push(hash1);
103
- assert.doesNotThrow(function() {hash(hash1, {unorderedArrays: true});}, /Maximum call stack size exceeded/, 'Should not throw an stack size exceeded exception');
104
- });
105
-
106
- it("recursive handling tracks identity", function() {
107
- var hash1 = {k1: {k: 'v'}, k2: {k: 'k2'}};
108
- hash1.k1.r1 = hash1.k1;
109
- hash1.k2.r2 = hash1.k2;
110
- var hash2 = {k1: {k: 'v'}, k2: {k: 'k2'}};
111
- hash2.k1.r1 = hash2.k2;
112
- hash2.k2.r2 = hash2.k1;
113
- assert.notEqual(hash(hash1), hash(hash2), "order of recursive objects should matter");
114
- });
115
-
116
- it("object types are hashed", function() {
117
- var hash1 = hash({foo: 'bar'});
118
- var hash2 = hash(['foo', 'bar']);
119
- assert.notEqual(hash1, hash2, "arrays and objects should not produce identical hashes");
120
- });
121
-
122
- it("utf8 strings are hashed correctly", function() {
123
- var hash1 = hash('\u03c3'); // cf 83 in utf8
124
- var hash2 = hash('\u01c3'); // c7 83 in utf8
125
- assert.notEqual(hash1, hash2, "different strings with similar utf8 encodings should produce different hashes");
126
- });
127
-
128
- it("strings passed as new String are hashed correctly", function() {
129
- var hash1 = hash(new String('foo'));
130
- assert.equal(hash1, '7cd3edacc4c9dd43908177508c112608a398bb9a');
131
- var hash2 = hash({foo: new String('bar')});
132
- assert.equal(hash2, 'a75c05bdca7d704bdfcd761913e5a4e4636e956b');
133
- });
134
-
135
- it("various hashes in crypto.getHashes() should be supported", function() {
136
- var hashes = ['sha1', 'md5'];
137
-
138
- if (crypto.getHashes) {
139
- // take all hashes from crypto.getHashes() starting with MD or SHA
140
- hashes = crypto.getHashes().filter(RegExp.prototype.test.bind(/^(md|sha)/i));
141
- }
142
-
143
- var obj = {randomText: 'bananas'};
144
-
145
- for (var i = 0; i < hashes.length; i++) {
146
- assert.ok(hash(obj, {algorithm: hashes[i]}), 'Algorithm ' + hashes[i] + ' should be supported');
147
- }
148
- });
149
-
150
- it("null and 'Null' string produce different hashes", function() {
151
- var hash1 = hash({foo: null});
152
- var hash2 = hash({foo: 'Null'});
153
- assert.notEqual(hash1, hash2, "null and 'Null' should not produce identical hashes");
154
- });
155
-
156
- it('Distinguish functions based on their properties', function() {
157
-
158
- var a, b, c, d;
159
- function Foo() {}
160
- a = hash(Foo);
161
-
162
- Foo.foo = 22;
163
- b = hash(Foo);
164
-
165
- Foo.bar = "42";
166
- c = hash(Foo);
167
-
168
- Foo.foo = "22";
169
- d = hash(Foo);
170
-
171
- assert.notEqual(a,b, 'adding a property changes the hash');
172
- assert.notEqual(b,c, 'adding another property changes the hash');
173
- assert.notEqual(c,d, 'changing a property changes the hash');
174
- });
175
-
176
- it('respectFunctionProperties = false', function() {
177
-
178
- var a, b;
179
- function Foo() {}
180
- a = hash(Foo, {respectFunctionProperties: false});
181
-
182
- Foo.foo = 22;
183
- b = hash(Foo, {respectFunctionProperties: false});
184
-
185
- assert.equal(a,b, 'function properties are ignored');
186
- });
187
-
188
- it('Distinguish functions based on prototype properties', function() {
189
-
190
- var a, b, c, d;
191
- function Foo() {}
192
- a = hash(Foo);
193
-
194
- Foo.prototype.foo = 22;
195
- b = hash(Foo);
196
-
197
- Foo.prototype.bar = "42";
198
- c = hash(Foo);
199
-
200
- Foo.prototype.foo = "22";
201
- d = hash(Foo);
202
-
203
- assert.notEqual(a,b, 'adding a property to the prototype changes the hash');
204
- assert.notEqual(b,c, 'adding another property to the prototype changes the hash');
205
- assert.notEqual(c,d, 'changing a property in the prototype changes the hash');
206
- });
207
-
208
- it('Distinguish objects based on their type', function() {
209
-
210
- function Foo() {}
211
- function Bar() {}
212
-
213
- var f = new Foo(), b = new Bar();
214
-
215
- assert.notEqual(hash(Foo), hash(Bar), 'Functions with different names should produce a different Hash.');
216
- assert.notEqual(hash(f), hash(b), 'Objects with different constructor should have a different Hash.');
217
- });
218
-
219
- it('respectType = false', function() {
220
- var opt = { respectType: false };
221
-
222
-
223
- function Foo() {}
224
- function Bar() {}
225
-
226
- var f = new Foo(), b = new Bar();
227
- assert.equal(hash(f, opt), hash(b, opt), 'Hashing should disregard the different constructor');
228
-
229
-
230
- var ha, hb;
231
- function F() {}
232
- ha = hash(F, opt);
233
-
234
- F.prototype.meaningOfLife = 42;
235
- hb = hash(F, opt);
236
-
237
- assert.equal(ha, hb, 'Hashing should disregard changes in the function\'s prototype');
238
- });
239
-
240
- it('unorderedArrays = false', function() {
241
- var ha, hb;
242
- ha = hash([1, 2, 3]);
243
- hb = hash([3, 2, 1]);
244
-
245
- assert.notEqual(ha, hb, 'Hashing should respect the order of array entries');
246
- });
247
-
248
- it('unorderedArrays = true', function() {
249
- var opt = { unorderedArrays: true };
250
-
251
- var ha, hb;
252
- ha = hash([1, 2, 3], opt);
253
- hb = hash([3, 2, 1], opt);
254
-
255
- assert.equal(ha, hb, 'Hashing should not respect the order of array entries');
256
-
257
- ha = hash([{a: 1}, {a: 2}], opt);
258
- hb = hash([{a: 2}, {a: 1}], opt);
259
-
260
- assert.equal(ha, hb, 'Hashing should not respect the order of array entries');
261
- });
262
-
263
- it('excludeKeys works', function() {
264
- var ha, hb;
265
- ha = hash({a: 1, b: 4}, { excludeKeys: function(key) { return key === 'b' } });
266
- hb = hash({a: 1});
267
-
268
- assert.equal(ha, hb, 'Hashing should ignore key `b`');
269
- });
270
-
271
- if (typeof Set !== 'undefined') {
272
- it('unorderedSets = false', function() {
273
- var opt = { unorderedSets: false };
274
-
275
- var ha, hb;
276
- ha = hash(new Set([1, 2, 3]), opt);
277
- hb = hash(new Set([3, 2, 1]), opt);
278
-
279
- assert.notEqual(ha, hb, 'Hashing should respect the order of Set entries');
280
- });
281
-
282
- it('unorderedSets = true', function() {
283
- var ha, hb;
284
- ha = hash(new Set([1, 2, 3]));
285
- hb = hash(new Set([3, 2, 1]));
286
-
287
- assert.equal(ha, hb, 'Hashing should not respect the order of Set entries');
288
- });
289
- }
290
- });
@@ -1,106 +0,0 @@
1
- 'use strict';
2
-
3
- var assert = require('assert');
4
- var crypto = require('crypto');
5
- var stream = require('stream');
6
- var hash = require('../index');
7
- var validSha1 = /^[0-9a-f]{40}$/i;
8
-
9
- describe('hash() objects with custom class names', function() {
10
- var builtinToString;
11
- beforeEach(function() {
12
- builtinToString = Object.prototype.toString;
13
- Object.prototype.toString = function() {
14
- if (this && typeof this.__className !== 'undefined') {
15
- return this.__className;
16
- }
17
-
18
- return builtinToString.apply(this, arguments);
19
- };
20
- });
21
-
22
- afterEach(function() {
23
- Object.prototype.toString = builtinToString;
24
- });
25
-
26
- it('should throw when trying to hash an unknown object', function() {
27
- assert.throws(function() {
28
- hash({a:1, __className: '[object Foo]'});
29
- }, /Unknown object type "foo"/);
30
-
31
- assert.throws(function() {
32
- hash({a:1, __className: 'Foo'});
33
- }, /Unknown object type/);
34
- });
35
-
36
- it('should not throw when trying to hash an unknown object with ignoreUnknown', function() {
37
- var opt = {ignoreUnknown: true};
38
-
39
- assert.ok(validSha1.test(hash({a:1, __className: '[object Foo]'}, opt)));
40
- });
41
-
42
- it('should not throw when trying to hash a weirdly-named object with ignoreUnknown', function() {
43
- var opt = {ignoreUnknown: true};
44
-
45
- assert.ok(validSha1.test(hash({a:1, __className: 'Foo'}, opt)));
46
- });
47
-
48
- it('should not delve further into a number of native types', function() {
49
- var nativeTypes = [
50
- 'domwindow',
51
- 'process', 'timer', 'pipe', 'tcp', 'udp', 'tty', 'statwatcher',
52
- 'securecontext', 'connection', 'zlib', 'context', 'nodescript',
53
- 'httpparser', 'dataview', 'signal', 'fsevent', 'tlswrap'
54
- ];
55
-
56
- for (var i = 0; i < nativeTypes.length; i++) {
57
- var obj = { foobar: 1, __className: '[object ' + nativeTypes[i] + ']' };
58
- var serialized = hash(obj, { algorithm: 'passthrough', encoding: 'utf8' });
59
- assert.strictEqual(serialized, nativeTypes[i]);
60
- }
61
- });
62
-
63
- it('should hash xml based on its string representation', function() {
64
- var obj = {
65
- __className: '[object xml]',
66
- toString: function() { return 'Bananä' }
67
- };
68
-
69
- var serialized = hash(obj, { algorithm: 'passthrough', encoding: 'utf8' });
70
- assert.strictEqual(serialized, 'xml:Bananä');
71
- });
72
-
73
- it('should hash URLs based on its string representation', function() {
74
- var obj = {
75
- __className: '[object url]',
76
- toString: function() { return 'https://example.com/' }
77
- };
78
-
79
- var serialized = hash(obj, { algorithm: 'passthrough', encoding: 'utf8' });
80
- assert.strictEqual(serialized, 'url:https://example.com/');
81
- });
82
-
83
- it('should not hash blobs without ignoreUnknown', function() {
84
- var obj = {
85
- __className: '[object blob]'
86
- };
87
-
88
- assert.throws(function() {
89
- hash(obj);
90
- }, /not supported/);
91
- });
92
-
93
- it('should ignore blobs with ignoreUnknown', function() {
94
- var obj = {
95
- __className: '[object blob]'
96
- };
97
-
98
- var serialized = hash(obj, {
99
- algorithm: 'passthrough',
100
- encoding: 'utf8',
101
- ignoreUnknown: true
102
- });
103
-
104
- assert.strictEqual(serialized, '[blob]');
105
- });
106
- });
@@ -1,60 +0,0 @@
1
- 'use strict';
2
-
3
- var assert = require('assert');
4
- var crypto = require('crypto');
5
- var hash = require('../index');
6
- var validSha1 = /^[0-9a-f]{40}$/i;
7
- var validBase64 = /^([A-Za-z0-9+\/]{4})*([A-Za-z0-9+\/==]{4})$/;
8
-
9
- describe('hash() without crypto.getHashes', function() {
10
- var getHashes_;
11
- beforeEach(function() {
12
- getHashes_ = crypto.getHashes;
13
- delete crypto.getHashes;
14
- });
15
-
16
- afterEach(function() {
17
- crypto.getHashes = getHashes_;
18
- });
19
-
20
- it('should work fine for SHA1', function() {
21
- assert.ok(validSha1.test(hash(42)), 'hash some value');
22
- assert.ok(validSha1.test(hash(NaN)), 'hash some value');
23
- });
24
- });
25
-
26
- describe('hash() without Duplex streams', function() {
27
- var createHash_;
28
- beforeEach(function() {
29
- createHash_ = crypto.createHash;
30
- crypto.createHash = function(algorithm) {
31
- var strm = createHash_(algorithm);
32
-
33
- return {
34
- update: strm.write.bind(strm),
35
- digest: strm.digest.bind(strm)
36
- };
37
- };
38
- });
39
-
40
- afterEach(function() {
41
- crypto.createHash = createHash_;
42
- });
43
-
44
- it('should work fine for SHA1 without .write()/.read()', function() {
45
- assert.ok(validSha1.test(hash(42)), 'hash some value');
46
- assert.ok(validSha1.test(hash(NaN)), 'hash some value');
47
- });
48
-
49
- it('should work fine for SHA1 without .write()/.read() with base64', function() {
50
- assert.ok(validBase64.test(hash(42, {encoding: 'base64'})), 'hash some value');
51
- assert.ok(validBase64.test(hash(NaN, {encoding: 'base64'})), 'hash some value');
52
- });
53
-
54
- if (typeof Buffer !== 'undefined') {
55
- it('should work fine for SHA1 without .write()/.read() with buffer', function() {
56
- assert.ok(Buffer.isBuffer(hash(42, {encoding: 'buffer'})), 'hash some value');
57
- assert.ok(Buffer.isBuffer(hash(NaN, {encoding: 'buffer'})), 'hash some value');
58
- });
59
- }
60
- });
@@ -1,36 +0,0 @@
1
- 'use strict';
2
-
3
- var assert = require('assert');
4
- var stream = require('stream');
5
- var hash = require('../index');
6
-
7
- describe('replacer option', function() {
8
- it('should emit information about an object to a stream', function() {
9
- var strm = new stream.PassThrough();
10
-
11
- var replacer = function(value) {
12
- try {
13
- return JSON.stringify(value);
14
- } catch (e) {
15
- return value;
16
- }
17
- };
18
-
19
- var obj = {foo: 'bar'};
20
- hash.writeToStream(obj, {replacer: replacer}, strm);
21
- var result = strm.read().toString();
22
- assert.strictEqual(typeof result, 'string');
23
- assert.notStrictEqual(result.indexOf(JSON.stringify(obj)), -1);
24
- });
25
-
26
- it('should not reach property values when excludeValues = true', function() {
27
- var strm = new stream.PassThrough();
28
-
29
- var replacer = function(k) {
30
- assert.notStrictEqual(k, 'bar');
31
- return k;
32
- };
33
-
34
- hash.writeToStream({foo: 'bar'}, {excludeValues: true}, strm);
35
- });
36
- });