@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
@@ -1,32 +1,32 @@
1
1
  /* eslint-disable complexity,max-statements */
2
2
 
3
- /**
4
- * file.js: Transport for outputting to a local log file.
5
- *
6
- * (C) 2010 Charlie Robbins
7
- * MIT LICENCE
3
+ /**
4
+ * file.js: Transport for outputting to a local log file.
5
+ *
6
+ * (C) 2010 Charlie Robbins
7
+ * MIT LICENCE
8
8
  */
9
9
  'use strict';
10
10
 
11
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
11
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
12
12
 
13
13
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
14
 
15
15
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
16
16
 
17
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
17
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
18
18
 
19
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
19
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
20
20
 
21
21
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
22
22
 
23
23
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
24
24
 
25
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
25
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
26
26
 
27
27
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
28
28
 
29
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
29
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
30
30
 
31
31
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
32
32
 
@@ -52,10 +52,10 @@ var debug = require('@dabh/diagnostics')('winston:file');
52
52
  var os = require('os');
53
53
 
54
54
  var tailFile = require('../tail-file');
55
- /**
56
- * Transport for outputting to a local log file.
57
- * @type {File}
58
- * @extends {TransportStream}
55
+ /**
56
+ * Transport for outputting to a local log file.
57
+ * @type {File}
58
+ * @extends {TransportStream}
59
59
  */
60
60
 
61
61
 
@@ -64,10 +64,10 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
64
64
 
65
65
  var _super = _createSuper(File);
66
66
 
67
- /**
68
- * Constructor function for the File transport object responsible for
69
- * persisting log messages and metadata to one or more files.
70
- * @param {Object} options - Options for this instance.
67
+ /**
68
+ * Constructor function for the File transport object responsible for
69
+ * persisting log messages and metadata to one or more files.
70
+ * @param {Object} options - Options for this instance.
71
71
  */
72
72
  function File() {
73
73
  var _this;
@@ -123,7 +123,7 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
123
123
  _this.rotationFormat = options.rotationFormat || false;
124
124
  _this.zippedArchive = options.zippedArchive || false;
125
125
  _this.maxFiles = options.maxFiles || null;
126
- _this.eol = options.eol || os.EOL;
126
+ _this.eol = typeof options.eol === 'string' ? options.eol : os.EOL;
127
127
  _this.tailable = options.tailable || false; // Internal state variables representing the number of files this instance
128
128
  // has created and the current size (in bytes) of the current logfile.
129
129
 
@@ -167,11 +167,11 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
167
167
  }
168
168
  }
169
169
  }
170
- /**
171
- * Core logging method exposed to Winston. Metadata is optional.
172
- * @param {Object} info - TODO: add param description.
173
- * @param {Function} callback - TODO: add param description.
174
- * @returns {undefined}
170
+ /**
171
+ * Core logging method exposed to Winston. Metadata is optional.
172
+ * @param {Object} info - TODO: add param description.
173
+ * @param {Function} callback - TODO: add param description.
174
+ * @returns {undefined}
175
175
  */
176
176
 
177
177
  }, {
@@ -271,11 +271,11 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
271
271
  this.finishIfEnding();
272
272
  return written;
273
273
  }
274
- /**
275
- * Query the transport. Options object is optional.
276
- * @param {Object} options - Loggly-like query options for this instance.
277
- * @param {function} callback - Continuation to respond to when complete.
278
- * TODO: Refactor me.
274
+ /**
275
+ * Query the transport. Options object is optional.
276
+ * @param {Object} options - Loggly-like query options for this instance.
277
+ * @param {function} callback - Continuation to respond to when complete.
278
+ * TODO: Refactor me.
279
279
  */
280
280
 
281
281
  }, {
@@ -415,11 +415,11 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
415
415
  return options;
416
416
  }
417
417
  }
418
- /**
419
- * Returns a log stream for this transport. Options object is optional.
420
- * @param {Object} options - Stream options for this instance.
421
- * @returns {Stream} - TODO: add return description.
422
- * TODO: Refactor me.
418
+ /**
419
+ * Returns a log stream for this transport. Options object is optional.
420
+ * @param {Object} options - Stream options for this instance.
421
+ * @returns {Stream} - TODO: add return description.
422
+ * TODO: Refactor me.
423
423
  */
424
424
 
425
425
  }, {
@@ -447,9 +447,9 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
447
447
  });
448
448
  return stream;
449
449
  }
450
- /**
451
- * Checks to see the filesize of.
452
- * @returns {undefined}
450
+ /**
451
+ * Checks to see the filesize of.
452
+ * @returns {undefined}
453
453
  */
454
454
 
455
455
  }, {
@@ -482,10 +482,10 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
482
482
  });
483
483
  });
484
484
  }
485
- /**
486
- * Stat the file and assess information in order to create the proper stream.
487
- * @param {function} callback - TODO: add param description.
488
- * @returns {undefined}
485
+ /**
486
+ * Stat the file and assess information in order to create the proper stream.
487
+ * @param {function} callback - TODO: add param description.
488
+ * @returns {undefined}
489
489
  */
490
490
 
491
491
  }, {
@@ -523,10 +523,10 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
523
523
  callback(null, stat.size);
524
524
  });
525
525
  }
526
- /**
527
- * Closes the stream associated with this instance.
528
- * @param {function} cb - TODO: add param description.
529
- * @returns {undefined}
526
+ /**
527
+ * Closes the stream associated with this instance.
528
+ * @param {function} cb - TODO: add param description.
529
+ * @returns {undefined}
530
530
  */
531
531
 
532
532
  }, {
@@ -548,10 +548,10 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
548
548
  _this7.emit('closed');
549
549
  });
550
550
  }
551
- /**
552
- * TODO: add method description.
553
- * @param {number} size - TODO: add param description.
554
- * @returns {undefined}
551
+ /**
552
+ * TODO: add method description.
553
+ * @param {number} size - TODO: add param description.
554
+ * @returns {undefined}
555
555
  */
556
556
 
557
557
  }, {
@@ -560,10 +560,10 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
560
560
  size = size || this._size;
561
561
  return this.maxsize && size >= this.maxsize;
562
562
  }
563
- /**
564
- * TODO: add method description.
565
- * @param {Error} err - TODO: add param description.
566
- * @returns {undefined}
563
+ /**
564
+ * TODO: add method description.
565
+ * @param {Error} err - TODO: add param description.
566
+ * @returns {undefined}
567
567
  */
568
568
 
569
569
  }, {
@@ -571,10 +571,10 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
571
571
  value: function _onError(err) {
572
572
  this.emit('error', err);
573
573
  }
574
- /**
575
- * TODO: add method description.
576
- * @param {Stream} stream - TODO: add param description.
577
- * @returns {mixed} - TODO: add return description.
574
+ /**
575
+ * TODO: add method description.
576
+ * @param {Stream} stream - TODO: add param description.
577
+ * @returns {mixed} - TODO: add return description.
578
578
  */
579
579
 
580
580
  }, {
@@ -583,10 +583,10 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
583
583
  stream.on('error', this._onError);
584
584
  return stream;
585
585
  }
586
- /**
587
- * TODO: add method description.
588
- * @param {Stream} stream - TODO: add param description.
589
- * @returns {mixed} - TODO: add return description.
586
+ /**
587
+ * TODO: add method description.
588
+ * @param {Stream} stream - TODO: add param description.
589
+ * @returns {mixed} - TODO: add return description.
590
590
  */
591
591
 
592
592
  }, {
@@ -595,8 +595,8 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
595
595
  stream.removeListener('error', this._onError);
596
596
  return stream;
597
597
  }
598
- /**
599
- * TODO: add method description.
598
+ /**
599
+ * TODO: add method description.
600
600
  */
601
601
 
602
602
  }, {
@@ -608,12 +608,12 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
608
608
  return _this8.open();
609
609
  });
610
610
  }
611
- /**
612
- * Unpipe from the stream that has been marked as full and end it so it
613
- * flushes to disk.
614
- *
615
- * @param {function} callback - Callback for when the current file has closed.
616
- * @private
611
+ /**
612
+ * Unpipe from the stream that has been marked as full and end it so it
613
+ * flushes to disk.
614
+ *
615
+ * @param {function} callback - Callback for when the current file has closed.
616
+ * @private
617
617
  */
618
618
 
619
619
  }, {
@@ -635,12 +635,12 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
635
635
  callback(); // eslint-disable-line callback-return
636
636
  }
637
637
  }
638
- /**
639
- * Returns the WritableStream for the active file on this instance. If we
640
- * should gzip the file then a zlib stream is returned.
641
- *
642
- * @param {ReadableStream} source – PassThrough to pipe to the file when open.
643
- * @returns {WritableStream} Stream that writes to disk for the active file.
638
+ /**
639
+ * Returns the WritableStream for the active file on this instance. If we
640
+ * should gzip the file then a zlib stream is returned.
641
+ *
642
+ * @param {ReadableStream} source – PassThrough to pipe to the file when open.
643
+ * @returns {WritableStream} Stream that writes to disk for the active file.
644
644
  */
645
645
 
646
646
  }, {
@@ -688,10 +688,10 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
688
688
 
689
689
  return dest;
690
690
  }
691
- /**
692
- * TODO: add method description.
693
- * @param {function} callback - TODO: add param description.
694
- * @returns {undefined}
691
+ /**
692
+ * TODO: add method description.
693
+ * @param {function} callback - TODO: add param description.
694
+ * @returns {undefined}
695
695
  */
696
696
 
697
697
  }, {
@@ -709,11 +709,11 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
709
709
  this._checkMaxFilesTailable(ext, basename, callback);
710
710
  }
711
711
  }
712
- /**
713
- * Gets the next filename to use for this instance in the case that log
714
- * filesizes are being capped.
715
- * @returns {string} - TODO: add return description.
716
- * @private
712
+ /**
713
+ * Gets the next filename to use for this instance in the case that log
714
+ * filesizes are being capped.
715
+ * @returns {string} - TODO: add return description.
716
+ * @private
717
717
  */
718
718
 
719
719
  }, {
@@ -728,13 +728,13 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
728
728
  var target = !this.tailable && this._created ? "".concat(basename).concat(isRotation).concat(ext) : "".concat(basename).concat(ext);
729
729
  return this.zippedArchive && !this.tailable ? "".concat(target, ".gz") : target;
730
730
  }
731
- /**
732
- * Increment the number of files created or checked by this instance.
733
- * @param {mixed} ext - TODO: add param description.
734
- * @param {mixed} basename - TODO: add param description.
735
- * @param {mixed} callback - TODO: add param description.
736
- * @returns {undefined}
737
- * @private
731
+ /**
732
+ * Increment the number of files created or checked by this instance.
733
+ * @param {mixed} ext - TODO: add param description.
734
+ * @param {mixed} basename - TODO: add param description.
735
+ * @param {mixed} callback - TODO: add param description.
736
+ * @returns {undefined}
737
+ * @private
738
738
  */
739
739
 
740
740
  }, {
@@ -752,16 +752,16 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
752
752
  var target = path.join(this.dirname, filePath);
753
753
  fs.unlink(target, callback);
754
754
  }
755
- /**
756
- * Roll files forward based on integer, up to maxFiles. e.g. if base if
757
- * file.log and it becomes oversized, roll to file1.log, and allow file.log
758
- * to be re-used. If file is oversized again, roll file1.log to file2.log,
759
- * roll file.log to file1.log, and so on.
760
- * @param {mixed} ext - TODO: add param description.
761
- * @param {mixed} basename - TODO: add param description.
762
- * @param {mixed} callback - TODO: add param description.
763
- * @returns {undefined}
764
- * @private
755
+ /**
756
+ * Roll files forward based on integer, up to maxFiles. e.g. if base if
757
+ * file.log and it becomes oversized, roll to file1.log, and allow file.log
758
+ * to be re-used. If file is oversized again, roll file1.log to file2.log,
759
+ * roll file.log to file1.log, and so on.
760
+ * @param {mixed} ext - TODO: add param description.
761
+ * @param {mixed} basename - TODO: add param description.
762
+ * @param {mixed} callback - TODO: add param description.
763
+ * @returns {undefined}
764
+ * @private
765
765
  */
766
766
 
767
767
  }, {
@@ -1,16 +1,16 @@
1
- /**
2
- * http.js: Transport for outputting to a json-rpcserver.
3
- *
4
- * (C) 2010 Charlie Robbins
5
- * MIT LICENCE
1
+ /**
2
+ * http.js: Transport for outputting to a json-rpcserver.
3
+ *
4
+ * (C) 2010 Charlie Robbins
5
+ * MIT LICENCE
6
6
  */
7
7
  'use strict';
8
8
 
9
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
9
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
10
10
 
11
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
11
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12
12
 
13
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
13
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
14
14
 
15
15
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
16
 
@@ -18,19 +18,19 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
18
18
 
19
19
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
20
20
 
21
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
21
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
22
22
 
23
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
23
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
24
24
 
25
25
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
26
26
 
27
27
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
28
28
 
29
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
29
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
30
30
 
31
31
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
32
32
 
33
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
33
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
34
34
 
35
35
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
36
36
 
@@ -42,10 +42,12 @@ var _require = require('readable-stream'),
42
42
  Stream = _require.Stream;
43
43
 
44
44
  var TransportStream = require('winston-transport');
45
- /**
46
- * Transport for outputting to a json-rpc server.
47
- * @type {Stream}
48
- * @extends {TransportStream}
45
+
46
+ var jsonStringify = require('safe-stable-stringify');
47
+ /**
48
+ * Transport for outputting to a json-rpc server.
49
+ * @type {Stream}
50
+ * @extends {TransportStream}
49
51
  */
50
52
 
51
53
 
@@ -54,11 +56,12 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
54
56
 
55
57
  var _super = _createSuper(Http);
56
58
 
57
- /**
58
- * Constructor function for the Http transport object responsible for
59
- * persisting log messages and metadata to a terminal or TTY.
60
- * @param {!Object} [options={}] - Options for this instance.
59
+ /**
60
+ * Constructor function for the Http transport object responsible for
61
+ * persisting log messages and metadata to a terminal or TTY.
62
+ * @param {!Object} [options={}] - Options for this instance.
61
63
  */
64
+ // eslint-disable-next-line max-statements
62
65
  function Http() {
63
66
  var _this;
64
67
 
@@ -77,6 +80,12 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
77
80
  _this.agent = options.agent;
78
81
  _this.headers = options.headers || {};
79
82
  _this.headers['content-type'] = 'application/json';
83
+ _this.batch = options.batch || false;
84
+ _this.batchInterval = options.batchInterval || 5000;
85
+ _this.batchCount = options.batchCount || 10;
86
+ _this.batchOptions = [];
87
+ _this.batchTimeoutID = -1;
88
+ _this.batchCallback = {};
80
89
 
81
90
  if (!_this.port) {
82
91
  _this.port = _this.ssl ? 443 : 80;
@@ -84,11 +93,11 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
84
93
 
85
94
  return _this;
86
95
  }
87
- /**
88
- * Core logging method exposed to Winston.
89
- * @param {Object} info - TODO: add param description.
90
- * @param {function} callback - TODO: add param description.
91
- * @returns {undefined}
96
+ /**
97
+ * Core logging method exposed to Winston.
98
+ * @param {Object} info - TODO: add param description.
99
+ * @param {function} callback - TODO: add param description.
100
+ * @returns {undefined}
92
101
  */
93
102
 
94
103
 
@@ -115,11 +124,11 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
115
124
  setImmediate(callback);
116
125
  }
117
126
  }
118
- /**
119
- * Query the transport. Options object is optional.
120
- * @param {Object} options - Loggly-like query options for this instance.
121
- * @param {function} callback - Continuation to respond to when complete.
122
- * @returns {undefined}
127
+ /**
128
+ * Query the transport. Options object is optional.
129
+ * @param {Object} options - Loggly-like query options for this instance.
130
+ * @param {function} callback - Continuation to respond to when complete.
131
+ * @returns {undefined}
123
132
  */
124
133
 
125
134
  }, {
@@ -165,10 +174,10 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
165
174
  callback(null, body);
166
175
  });
167
176
  }
168
- /**
169
- * Returns a log stream for this transport. Options object is optional.
170
- * @param {Object} options - Stream options for this instance.
171
- * @returns {Stream} - TODO: add return description
177
+ /**
178
+ * Returns a log stream for this transport. Options object is optional.
179
+ * @param {Object} options - Stream options for this instance.
180
+ * @returns {Stream} - TODO: add return description
172
181
  */
173
182
 
174
183
  }, {
@@ -219,11 +228,11 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
219
228
  });
220
229
  return stream;
221
230
  }
222
- /**
223
- * Make a request to a winstond server or any http server which can
224
- * handle json-rpc.
225
- * @param {function} options - Options to sent the request.
226
- * @param {function} callback - Continuation to respond to when complete.
231
+ /**
232
+ * Make a request to a winstond server or any http server which can
233
+ * handle json-rpc.
234
+ * @param {function} options - Options to sent the request.
235
+ * @param {function} callback - Continuation to respond to when complete.
227
236
  */
228
237
 
229
238
  }, {
@@ -233,8 +242,77 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
233
242
  var auth = options.auth || this.auth;
234
243
  var path = options.path || this.path || '';
235
244
  delete options.auth;
236
- delete options.path; // Prepare options for outgoing HTTP request
245
+ delete options.path;
246
+
247
+ if (this.batch) {
248
+ this._doBatch(options, callback, auth, path);
249
+ } else {
250
+ this._doRequest(options, callback, auth, path);
251
+ }
252
+ }
253
+ /**
254
+ * Send or memorize the options according to batch configuration
255
+ * @param {function} options - Options to sent the request.
256
+ * @param {function} callback - Continuation to respond to when complete.
257
+ * @param {Object?} auth - authentication options
258
+ * @param {string} path - request path
259
+ */
260
+
261
+ }, {
262
+ key: "_doBatch",
263
+ value: function _doBatch(options, callback, auth, path) {
264
+ this.batchOptions.push(options);
265
+
266
+ if (this.batchOptions.length === 1) {
267
+ // First message stored, it's time to start the timeout!
268
+ var me = this;
269
+ this.batchCallback = callback;
270
+ this.batchTimeoutID = setTimeout(function () {
271
+ // timeout is reached, send all messages to endpoint
272
+ me.batchTimeoutID = -1;
273
+
274
+ me._doBatchRequest(me.batchCallback, auth, path);
275
+ }, this.batchInterval);
276
+ }
277
+
278
+ if (this.batchOptions.length === this.batchCount) {
279
+ // max batch count is reached, send all messages to endpoint
280
+ this._doBatchRequest(this.batchCallback, auth, path);
281
+ }
282
+ }
283
+ /**
284
+ * Initiate a request with the memorized batch options, stop the batch timeout
285
+ * @param {function} callback - Continuation to respond to when complete.
286
+ * @param {Object?} auth - authentication options
287
+ * @param {string} path - request path
288
+ */
289
+
290
+ }, {
291
+ key: "_doBatchRequest",
292
+ value: function _doBatchRequest(callback, auth, path) {
293
+ if (this.batchTimeoutID > 0) {
294
+ clearTimeout(this.batchTimeoutID);
295
+ this.batchTimeoutID = -1;
296
+ }
237
297
 
298
+ var batchOptionsCopy = this.batchOptions.slice();
299
+ this.batchOptions = [];
300
+
301
+ this._doRequest(batchOptionsCopy, callback, auth, path);
302
+ }
303
+ /**
304
+ * Make a request to a winstond server or any http server which can
305
+ * handle json-rpc.
306
+ * @param {function} options - Options to sent the request.
307
+ * @param {function} callback - Continuation to respond to when complete.
308
+ * @param {Object?} auth - authentication options
309
+ * @param {string} path - request path
310
+ */
311
+
312
+ }, {
313
+ key: "_doRequest",
314
+ value: function _doRequest(options, callback, auth, path) {
315
+ // Prepare options for outgoing HTTP request
238
316
  var headers = Object.assign({}, this.headers);
239
317
 
240
318
  if (auth && auth.bearer) {
@@ -256,7 +334,7 @@ module.exports = /*#__PURE__*/function (_TransportStream) {
256
334
  return callback(null, res);
257
335
  }).resume();
258
336
  });
259
- req.end(Buffer.from(JSON.stringify(options), 'utf8'));
337
+ req.end(Buffer.from(jsonStringify(options), 'utf8'));
260
338
  }
261
339
  }]);
262
340
 
@@ -1,13 +1,13 @@
1
- /**
2
- * transports.js: Set of all transports Winston knows about.
3
- *
4
- * (C) 2010 Charlie Robbins
5
- * MIT LICENCE
1
+ /**
2
+ * transports.js: Set of all transports Winston knows about.
3
+ *
4
+ * (C) 2010 Charlie Robbins
5
+ * MIT LICENCE
6
6
  */
7
7
  'use strict';
8
- /**
9
- * TODO: add property description.
10
- * @type {Console}
8
+ /**
9
+ * TODO: add property description.
10
+ * @type {Console}
11
11
  */
12
12
 
13
13
  Object.defineProperty(exports, 'Console', {
@@ -17,9 +17,9 @@ Object.defineProperty(exports, 'Console', {
17
17
  return require('./console');
18
18
  }
19
19
  });
20
- /**
21
- * TODO: add property description.
22
- * @type {File}
20
+ /**
21
+ * TODO: add property description.
22
+ * @type {File}
23
23
  */
24
24
 
25
25
  Object.defineProperty(exports, 'File', {
@@ -29,9 +29,9 @@ Object.defineProperty(exports, 'File', {
29
29
  return require('./file');
30
30
  }
31
31
  });
32
- /**
33
- * TODO: add property description.
34
- * @type {Http}
32
+ /**
33
+ * TODO: add property description.
34
+ * @type {Http}
35
35
  */
36
36
 
37
37
  Object.defineProperty(exports, 'Http', {
@@ -41,9 +41,9 @@ Object.defineProperty(exports, 'Http', {
41
41
  return require('./http');
42
42
  }
43
43
  });
44
- /**
45
- * TODO: add property description.
46
- * @type {Stream}
44
+ /**
45
+ * TODO: add property description.
46
+ * @type {Stream}
47
47
  */
48
48
 
49
49
  Object.defineProperty(exports, 'Stream', {