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

126
node_modules/pretty-ms/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,126 @@
declare namespace prettyMilliseconds {
interface Options {
/**
Number of digits to appear after the seconds decimal point.
@default 1
*/
readonly secondsDecimalDigits?: number;
/**
Number of digits to appear after the milliseconds decimal point.
Useful in combination with [`process.hrtime()`](https://nodejs.org/api/process.html#process_process_hrtime).
@default 0
*/
readonly millisecondsDecimalDigits?: number;
/**
Keep milliseconds on whole seconds: `13s` → `13.0s`.
Useful when you are showing a number of seconds spent on an operation and don't want the width of the output to change when hitting a whole number.
@default false
*/
readonly keepDecimalsOnWholeSeconds?: boolean;
/**
Only show the first unit: `1h 10m` → `1h`.
Also ensures that `millisecondsDecimalDigits` and `secondsDecimalDigits` are both set to `0`.
@default false
*/
readonly compact?: boolean;
/**
Number of units to show. Setting `compact` to `true` overrides this option.
@default Infinity
*/
readonly unitCount?: number;
/**
Use full-length units: `5h 1m 45s` → `5 hours 1 minute 45 seconds`.
@default false
*/
readonly verbose?: boolean;
/**
Show milliseconds separately. This means they won't be included in the decimal part of the seconds.
@default false
*/
readonly separateMilliseconds?: boolean;
/**
Show microseconds and nanoseconds.
@default false
*/
readonly formatSubMilliseconds?: boolean;
/**
Display time using colon notation: `5h 1m 45s` → `5:01:45`. Always shows time in at least minutes: `1s` → `0:01`
Useful when you want to display time without the time units, similar to a digital watch.
Setting `colonNotation` to `true` overrides the following options to `false`:
- `compact`
- `formatSubMilliseconds`
- `separateMilliseconds`
- `verbose`
@default false
*/
readonly colonNotation?: boolean;
}
}
/**
Convert milliseconds to a human readable string: `1337000000` → `15d 11h 23m 20s`.
@param milliseconds - Milliseconds to humanize.
@example
```
import prettyMilliseconds = require('pretty-ms');
prettyMilliseconds(1337000000);
//=> '15d 11h 23m 20s'
prettyMilliseconds(1337);
//=> '1.3s'
prettyMilliseconds(133);
//=> '133ms'
// `compact` option
prettyMilliseconds(1337, {compact: true});
//=> '1s'
// `verbose` option
prettyMilliseconds(1335669000, {verbose: true});
//=> '15 days 11 hours 1 minute 9 seconds'
// `colonNotation` option
prettyMilliseconds(95500, {colonNotation: true});
//=> '1:35.5'
// `formatSubMilliseconds` option
prettyMilliseconds(100.400080, {formatSubMilliseconds: true})
//=> '100ms 400µs 80ns'
// Can be useful for time durations
prettyMilliseconds(new Date(2014, 0, 1, 10, 40) - new Date(2014, 0, 1, 10, 5))
//=> '35m'
```
*/
declare function prettyMilliseconds(
milliseconds: number,
options?: prettyMilliseconds.Options
): string;
export = prettyMilliseconds;

125
node_modules/pretty-ms/index.js generated vendored Normal file
View File

@@ -0,0 +1,125 @@
'use strict';
const parseMilliseconds = require('parse-ms');
const pluralize = (word, count) => count === 1 ? word : `${word}s`;
const SECOND_ROUNDING_EPSILON = 0.0000001;
module.exports = (milliseconds, options = {}) => {
if (!Number.isFinite(milliseconds)) {
throw new TypeError('Expected a finite number');
}
if (options.colonNotation) {
options.compact = false;
options.formatSubMilliseconds = false;
options.separateMilliseconds = false;
options.verbose = false;
}
if (options.compact) {
options.secondsDecimalDigits = 0;
options.millisecondsDecimalDigits = 0;
}
const result = [];
const floorDecimals = (value, decimalDigits) => {
const flooredInterimValue = Math.floor((value * (10 ** decimalDigits)) + SECOND_ROUNDING_EPSILON);
const flooredValue = Math.round(flooredInterimValue) / (10 ** decimalDigits);
return flooredValue.toFixed(decimalDigits);
};
const add = (value, long, short, valueString) => {
if ((result.length === 0 || !options.colonNotation) && value === 0 && !(options.colonNotation && short === 'm')) {
return;
}
valueString = (valueString || value || '0').toString();
let prefix;
let suffix;
if (options.colonNotation) {
prefix = result.length > 0 ? ':' : '';
suffix = '';
const wholeDigits = valueString.includes('.') ? valueString.split('.')[0].length : valueString.length;
const minLength = result.length > 0 ? 2 : 1;
valueString = '0'.repeat(Math.max(0, minLength - wholeDigits)) + valueString;
} else {
prefix = '';
suffix = options.verbose ? ' ' + pluralize(long, value) : short;
}
result.push(prefix + valueString + suffix);
};
const parsed = parseMilliseconds(milliseconds);
add(Math.trunc(parsed.days / 365), 'year', 'y');
add(parsed.days % 365, 'day', 'd');
add(parsed.hours, 'hour', 'h');
add(parsed.minutes, 'minute', 'm');
if (
options.separateMilliseconds ||
options.formatSubMilliseconds ||
(!options.colonNotation && milliseconds < 1000)
) {
add(parsed.seconds, 'second', 's');
if (options.formatSubMilliseconds) {
add(parsed.milliseconds, 'millisecond', 'ms');
add(parsed.microseconds, 'microsecond', 'µs');
add(parsed.nanoseconds, 'nanosecond', 'ns');
} else {
const millisecondsAndBelow =
parsed.milliseconds +
(parsed.microseconds / 1000) +
(parsed.nanoseconds / 1e6);
const millisecondsDecimalDigits =
typeof options.millisecondsDecimalDigits === 'number' ?
options.millisecondsDecimalDigits :
0;
const roundedMiliseconds = millisecondsAndBelow >= 1 ?
Math.round(millisecondsAndBelow) :
Math.ceil(millisecondsAndBelow);
const millisecondsString = millisecondsDecimalDigits ?
millisecondsAndBelow.toFixed(millisecondsDecimalDigits) :
roundedMiliseconds;
add(
Number.parseFloat(millisecondsString, 10),
'millisecond',
'ms',
millisecondsString
);
}
} else {
const seconds = (milliseconds / 1000) % 60;
const secondsDecimalDigits =
typeof options.secondsDecimalDigits === 'number' ?
options.secondsDecimalDigits :
1;
const secondsFixed = floorDecimals(seconds, secondsDecimalDigits);
const secondsString = options.keepDecimalsOnWholeSeconds ?
secondsFixed :
secondsFixed.replace(/\.0+$/, '');
add(Number.parseFloat(secondsString, 10), 'second', 's', secondsString);
}
if (result.length === 0) {
return '0' + (options.verbose ? ' milliseconds' : 'ms');
}
if (options.compact) {
return result[0];
}
if (typeof options.unitCount === 'number') {
const separator = options.colonNotation ? '' : ' ';
return result.slice(0, Math.max(options.unitCount, 1)).join(separator);
}
return options.colonNotation ? result.join('') : result.join(' ');
};

9
node_modules/pretty-ms/license generated vendored Normal file
View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

49
node_modules/pretty-ms/package.json generated vendored Normal file
View File

@@ -0,0 +1,49 @@
{
"name": "pretty-ms",
"version": "7.0.1",
"description": "Convert milliseconds to a human readable string: `1337000000` → `15d 11h 23m 20s`",
"license": "MIT",
"repository": "sindresorhus/pretty-ms",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=10"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"pretty",
"prettify",
"human",
"humanize",
"humanized",
"readable",
"time",
"ms",
"milliseconds",
"duration",
"period",
"range",
"text",
"string",
"number",
"hrtime"
],
"dependencies": {
"parse-ms": "^2.1.0"
},
"devDependencies": {
"ava": "^2.4.0",
"tsd": "^0.11.0",
"xo": "^0.30.0"
}
}

142
node_modules/pretty-ms/readme.md generated vendored Normal file
View File

@@ -0,0 +1,142 @@
# pretty-ms [![Build Status](https://travis-ci.com/sindresorhus/pretty-ms.svg?branch=master)](https://travis-ci.com/sindresorhus/pretty-ms)
> Convert milliseconds to a human readable string: `1337000000` → `15d 11h 23m 20s`
## Install
```
$ npm install pretty-ms
```
## Usage
```js
const prettyMilliseconds = require('pretty-ms');
prettyMilliseconds(1337000000);
//=> '15d 11h 23m 20s'
prettyMilliseconds(1337);
//=> '1.3s'
prettyMilliseconds(133);
//=> '133ms'
// `compact` option
prettyMilliseconds(1337, {compact: true});
//=> '1s'
// `verbose` option
prettyMilliseconds(1335669000, {verbose: true});
//=> '15 days 11 hours 1 minute 9 seconds'
// `colonNotation` option
prettyMilliseconds(95500, {colonNotation: true});
//=> '1:35.5'
// `formatSubMilliseconds` option
prettyMilliseconds(100.400080, {formatSubMilliseconds: true})
//=> '100ms 400µs 80ns'
// Can be useful for time durations
prettyMilliseconds(new Date(2014, 0, 1, 10, 40) - new Date(2014, 0, 1, 10, 5))
//=> '35m'
```
## API
### prettyMilliseconds(milliseconds, options?)
#### milliseconds
Type: `number`
Milliseconds to humanize.
#### options
Type: `object`
##### secondsDecimalDigits
Type: `number`\
Default: `1`
Number of digits to appear after the seconds decimal point.
##### millisecondsDecimalDigits
Type: `number`\
Default: `0`
Number of digits to appear after the milliseconds decimal point.
Useful in combination with [`process.hrtime()`](https://nodejs.org/api/process.html#process_process_hrtime_time).
##### keepDecimalsOnWholeSeconds
Type: `boolean`\
Default: `false`
Keep milliseconds on whole seconds: `13s``13.0s`.
Useful when you are showing a number of seconds spent on an operation and don't want the width of the output to change when hitting a whole number.
##### compact
Type: `boolean`\
Default: `false`
Only show the first unit: `1h 10m``1h`.
Also ensures that `millisecondsDecimalDigits` and `secondsDecimalDigits` are both set to `0`.
##### unitCount
Type: `number`\
Default: `Infinity`
Number of units to show. Setting `compact` to `true` overrides this option.
##### verbose
Type: `boolean`\
Default: `false`
Use full-length units: `5h 1m 45s``5 hours 1 minute 45 seconds`
##### separateMilliseconds
Type: `boolean`\
Default: `false`
Show milliseconds separately. This means they won't be included in the decimal part of the seconds.
##### formatSubMilliseconds
Type: `boolean`\
Default: `false`
Show microseconds and nanoseconds.
##### colonNotation
Type: `boolean`\
Default: `false`
Display time using colon notation: `5h 1m 45s``5:01:45`. Always shows time in at least minutes: `1s``0:01`
Useful when you want to display time without the time units, similar to a digital watch.
Setting `colonNotation` to `true` overrides the following options to `false`:
- `compact`
- `formatSubMilliseconds`
- `separateMilliseconds`
- `verbose`
## Related
- [pretty-ms-cli](https://github.com/sindresorhus/pretty-ms-cli) - CLI for this module
- [parse-ms](https://github.com/sindresorhus/parse-ms) - Parse milliseconds into an object
- [to-milliseconds](https://github.com/sindresorhus/to-milliseconds) - Convert an object of time properties to milliseconds
- [pretty-bytes](https://github.com/sindresorhus/pretty-bytes) - Convert bytes to a human readable string