feat: Created a mini nodeJS server with NewMan for testing without PostMan GUI.

This will mimic a run in a CD/CI environment or docker container.
This commit is contained in:
Simon Priet
2021-09-08 14:01:19 +02:00
parent 5fbd7c88fa
commit e69a613a37
5610 changed files with 740417 additions and 3 deletions

33
node_modules/intel/lib/handlers/console.js generated vendored Normal file
View File

@@ -0,0 +1,33 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const util = require('util');
const Handler = require('./handler');
const StreamHandler = require('./stream');
const LEVELS = require('../levels');
function ConsoleHandler(options) {
options = options || {};
options.stream = process.stdout;
this._out = new StreamHandler(options);
options.stream = process.stderr;
this._err = new StreamHandler(options);
Handler.call(this, options);
}
util.inherits(ConsoleHandler, Handler);
ConsoleHandler.prototype.emit = function consoleEmit(record) {
var handler = (record.level >= LEVELS.WARN) ? this._err : this._out;
handler.emit(record);
};
ConsoleHandler.prototype.setFormatter = function setFormatter(formatter) {
Handler.prototype.setFormatter.call(this, formatter);
this._out.setFormatter(formatter);
this._err.setFormatter(formatter);
};
module.exports = ConsoleHandler;

25
node_modules/intel/lib/handlers/file.js generated vendored Normal file
View File

@@ -0,0 +1,25 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const fs = require('fs');
const util = require('util');
const StreamHandler = require('./stream');
function FileHandler(options) {
if (typeof options === 'string') {
options = { file: options };
}
this._file = options.file;
options.stream = this._open();
StreamHandler.call(this, options);
}
util.inherits(FileHandler, StreamHandler);
FileHandler.prototype._open = function open() {
return fs.createWriteStream(this._file, { flags: 'a' });
};
module.exports = FileHandler;

79
node_modules/intel/lib/handlers/handler.js generated vendored Normal file
View File

@@ -0,0 +1,79 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const Formatter = require('../formatter');
const Filterer = require('../filterer');
const klass = require('../utils/klass');
const LEVELS = require('../levels');
const _defaultFormatter = new Formatter();
function emit(record) {
return this._emit(record);
}
function handleFilter(record) {
if (this.filter(record)) {
this.__emit(record);
}
}
function Handler(options) {
if (typeof options !== 'object') {
options = { level: options };
}
var level = options.level;
this.setLevel((level !== undefined) ? LEVELS.getLevel(level) : LEVELS.NOTSET);
this.setFormatter(options.formatter || _defaultFormatter);
this.handle = this.__emit;
Filterer.call(this, options);
}
klass(Handler).inherit(Filterer).mixin({
level: null,
_formatter: null,
__toggleFilter: function handlerToggleFilter() {
Filterer.prototype.__toggleFilter.call(this);
this.handle = this.handle === this.__emit ? handleFilter : this.__emit;
},
// sub-classes should override emit, not handle
_emit: function emit(/*record*/) {
throw new Error('Handler.emit must be implemented by sub-classes');
},
__emit: emit,
format: function format(record) {
return this._formatter.format(record);
},
setFormatter: function setFormatter(formatter) {
this._formatter = formatter;
return this;
},
setLevel: function setLevel(level) {
this.level = LEVELS.getLevel(level);
return this;
}
});
Object.defineProperty(Handler.prototype, 'emit', {
get: function() {
return this._emit;
},
set: function(val) {
if (typeof val !== 'function') {
throw new TypeError('emit must be a function');
}
this._emit = val;
}
});
module.exports = Handler;

20
node_modules/intel/lib/handlers/index.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const fs = require('fs');
fs.readdirSync(__dirname).forEach(function(file) {
if (file === 'index.js' || file === 'handler.js') {
return;
}
var handler = file.replace('.js', '');
var capital = handler[0].toUpperCase() + handler.substring(1);
Object.defineProperty(exports, capital, {
get: function() {
return require('./' + handler);
}
});
});

16
node_modules/intel/lib/handlers/null.js generated vendored Normal file
View File

@@ -0,0 +1,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const util = require('util');
const Handler = require('./handler');
function NullHandler() {
Handler.apply(this, arguments);
}
util.inherits(NullHandler, Handler);
NullHandler.prototype.emit = function nullEmit(){};
module.exports = NullHandler;

24
node_modules/intel/lib/handlers/stream.js generated vendored Normal file
View File

@@ -0,0 +1,24 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const util = require('util');
const Handler = require('./handler');
function StreamHandler(options) {
options = options || {};
if (!options.stream) {
options = { stream: options };
}
Handler.call(this, options);
this._stream = options.stream;
}
util.inherits(StreamHandler, Handler);
StreamHandler.prototype.emit = function streamEmit(record) {
this._stream.write(this.format(record) + '\n');
};
module.exports = StreamHandler;