From bdd0f19b14296e33070beaa8766f95a8f47d73c7 Mon Sep 17 00:00:00 2001 From: Johan Suleiko Allansson Date: Wed, 24 Jul 2024 13:14:18 +0200 Subject: [PATCH 1/8] add async check function --- babel.config.json | 5 +- build/index.js | 2 +- build/index.js.map | 2 +- build/index.min.js | 2 - build/index.min.js.map | 1 - package-lock.json | 791 +++++++++++++++++++++++++---------------- package.json | 4 +- src/check.ts | 66 ++++ src/index.js | 3 + tests/check.ts | 97 +++++ webpack.config.js | 10 +- 11 files changed, 661 insertions(+), 322 deletions(-) delete mode 100644 build/index.min.js delete mode 100644 build/index.min.js.map create mode 100644 src/check.ts create mode 100644 tests/check.ts diff --git a/babel.config.json b/babel.config.json index fb9e49a..ff00482 100644 --- a/babel.config.json +++ b/babel.config.json @@ -2,7 +2,10 @@ "presets": [ [ "@babel/preset-env" - ] + ], + [ + "@babel/preset-typescript" + ] ], "plugins": [ "@babel/plugin-transform-block-scoping"] } diff --git a/build/index.js b/build/index.js index 9545b56..51983c1 100644 --- a/build/index.js +++ b/build/index.js @@ -1,2 +1,2 @@ -(()=>{"use strict";var t={n:r=>{var e=r&&r.__esModule?()=>r.default:()=>r;return t.d(e,{a:e}),e},d:(r,e)=>{for(var n in e)t.o(e,n)&&!t.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:e[n]})},o:(t,r)=>Object.prototype.hasOwnProperty.call(t,r),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},r={};t.r(r),t.d(r,{findBetween:()=>x,getCurrentStageIndex:()=>i,normalDistributionStages:()=>m,parseDuration:()=>o,randomIntBetween:()=>d,randomItem:()=>h,randomString:()=>p,tagWithCurrentStageIndex:()=>u,tagWithCurrentStageProfile:()=>s,uuidv4:()=>g});const e=require("k6/execution");var n=t.n(e);function o(t){if(null==t||t.length<1)throw new Error("str is empty");for(var r=0,e="",n={},o=0;o0&&(r+=parseFloat(e,10)),r}function a(t){return t>="0"&&t<="9"}function i(){if(null==n()||null==n().test||null==n().test.options)throw new Error("k6/execution.test.options is undefined - getCurrentStageIndex requires a k6 v0.38.0 or later. Please, upgrade for getting k6/execution.test.options supported.");var t=n().test.options.scenarios[n().scenario.name];if(null==t)throw new Error("the exec.test.options object doesn't contain the current scenario ".concat(n().scenario.name));if(null==t.stages)throw new Error("only ramping-vus or ramping-arravial-rate supports stages, it is not possible to get a stage index on other executors.");if(t.stages.length<1)throw new Error("the current scenario ".concat(t.name," doesn't contain any stage"));for(var r=0,e=new Date-n().scenario.startTime,a=0;ao.target?"ramp-up":o.target==e.target?"steady":"ramp-down"}()}const l=require("k6/crypto");function c(t){return function(t){if(Array.isArray(t))return f(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,r){if(!t)return;if("string"==typeof t)return f(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)return Array.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return f(t,r)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e0&&void 0!==arguments[0]&&arguments[0];return t?y():v()}function d(t,r){return Math.floor(Math.random()*(r-t+1)+t)}function h(t){return t[Math.floor(Math.random()*t.length)]}function p(t){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"abcdefghijklmnopqrstuvwxyz",e="";t--;)e+=r[Math.random()*r.length|0];return e}function x(t,r,e){for(var n,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=[],i=!0,u=0;i&&-1!=(n=t.indexOf(r))&&(n+=r.length,-1!=(u=t.indexOf(e,n)));){var s=t.substring(n,u);if(!o)return s;a.push(s),t=t.substring(u+e.length)}return a.length?a:null}function m(t,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;function n(t,r,e){return Math.exp(-.5*Math.pow((e-t)/r,2))/(r*Math.sqrt(2*Math.PI))}for(var o=0,a=1,i=new Array(e+2).fill(0),u=new Array(e+2).fill(Math.ceil(r/6)),s=[],l=0;l<=e;l++)i[l]=n(o,a,-2*a+4*a*l/e);for(var f=Math.max.apply(Math,c(i)),g=i.map((function(r){return Math.round(r*t/f)})),d=1;d<=e;d++)u[d]=Math.ceil(4*r/(6*e));for(var h=0;h<=e+1;h++)s.push({duration:"".concat(u[h],"s"),target:g[h]});return s}function v(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var r=16*Math.random()|0;return("x"===t?r:3&r|8).toString(16)}))}function y(){for(var t=[],r=0;r<256;++r)t.push((r+256).toString(16).slice(1));var e=new Uint8Array((0,l.randomBytes)(16));return e[6]=15&e[6]|64,e[8]=63&e[8]|128,(t[e[0]]+t[e[1]]+t[e[2]]+t[e[3]]+"-"+t[e[4]]+t[e[5]]+"-"+t[e[6]]+t[e[7]]+"-"+t[e[8]]+t[e[9]]+"-"+t[e[10]]+t[e[11]]+t[e[12]]+t[e[13]]+t[e[14]]+t[e[15]]).toLowerCase()}var w=exports;for(var b in r)w[b]=r[b];r.__esModule&&Object.defineProperty(w,"__esModule",{value:!0})})(); +(()=>{"use strict";var r={n:t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},d:(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o:(r,t)=>Object.prototype.hasOwnProperty.call(r,t),r:r=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})}},t={};r.r(t),r.d(t,{check:()=>S,findBetween:()=>p,getCurrentStageIndex:()=>i,normalDistributionStages:()=>y,parseDuration:()=>o,randomIntBetween:()=>g,randomItem:()=>d,randomString:()=>m,tagWithCurrentStageIndex:()=>u,tagWithCurrentStageProfile:()=>s,uuidv4:()=>h});const e=require("k6/execution");var n=r.n(e);function o(r){if(null==r||r.length<1)throw new Error("str is empty");for(var t=0,e="",n={},o=0;o0&&(t+=parseFloat(e,10)),t}function a(r){return r>="0"&&r<="9"}function i(){var r=n().test.options.scenarios[n().scenario.name];if(null==r)throw new Error("the exec.test.options object doesn't contain the current scenario ".concat(n().scenario.name));if(null==r.stages)throw new Error("only ramping-vus or ramping-arravial-rate supports stages, it is not possible to get a stage index on other executors.");if(r.stages.length<1)throw new Error("the current scenario ".concat(r.name," doesn't contain any stage"));for(var t=0,e=new Date-n().scenario.startTime,a=0;ao.target?"ramp-up":o.target==e.target?"steady":"ramp-down"}()}const c=require("k6/crypto");function l(r){return function(r){if(Array.isArray(r))return f(r)}(r)||function(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}(r)||function(r,t){if(!r)return;if("string"==typeof r)return f(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);"Object"===e&&r.constructor&&(e=r.constructor.name);if("Map"===e||"Set"===e)return Array.from(r);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return f(r,t)}(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e0&&void 0!==arguments[0]&&arguments[0];return r?x():v()}function g(r,t){return Math.floor(Math.random()*(t-r+1)+r)}function d(r){return r[Math.floor(Math.random()*r.length)]}function m(r){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"abcdefghijklmnopqrstuvwxyz",e="";r--;)e+=t[Math.random()*t.length|0];return e}function p(r,t,e){for(var n,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=[],i=!0,u=0;i&&-1!=(n=r.indexOf(t))&&(n+=t.length,-1!=(u=r.indexOf(e,n)));){var s=r.substring(n,u);if(!o)return s;a.push(s),r=r.substring(u+e.length)}return a.length?a:null}function y(r,t){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;function n(r,t,e){return Math.exp(-.5*Math.pow((e-r)/t,2))/(t*Math.sqrt(2*Math.PI))}for(var o=0,a=1,i=new Array(e+2).fill(0),u=new Array(e+2).fill(Math.ceil(t/6)),s=[],c=0;c<=e;c++)i[c]=n(o,a,-2*a+4*a*c/e);for(var f=Math.max.apply(Math,l(i)),h=i.map((function(t){return Math.round(t*r/f)})),g=1;g<=e;g++)u[g]=Math.ceil(4*t/(6*e));for(var d=0;d<=e+1;d++)s.push({duration:"".concat(u[d],"s"),target:h[d]});return s}function v(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(r){var t=16*Math.random()|0;return("x"===r?t:3&t|8).toString(16)}))}function x(){for(var r=[],t=0;t<256;++t)r.push((t+256).toString(16).slice(1));var e=new Uint8Array((0,c.randomBytes)(16));return e[6]=15&e[6]|64,e[8]=63&e[8]|128,(r[e[0]]+r[e[1]]+r[e[2]]+r[e[3]]+"-"+r[e[4]]+r[e[5]]+"-"+r[e[6]]+r[e[7]]+"-"+r[e[8]]+r[e[9]]+"-"+r[e[10]]+r[e[11]]+r[e[12]]+r[e[13]]+r[e[14]]+r[e[15]]).toLowerCase()}function b(r,t){return function(r){if(Array.isArray(r))return r}(r)||function(r,t){var e=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null==e)return;var n,o,a=[],i=!0,u=!1;try{for(e=e.call(r);!(i=(n=e.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(r){u=!0,o=r}finally{try{i||null==e.return||e.return()}finally{if(u)throw o}}return a}(r,t)||function(r,t){if(!r)return;if("string"==typeof r)return w(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);"Object"===e&&r.constructor&&(e=r.constructor.name);if("Map"===e||"Set"===e)return Array.from(r);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return w(r,t)}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/execution\");","import exec from 'k6/execution'\n\n// parseDuration parses the provided string as an Integer number\n// in millisecond precision\nfunction parseDuration(str) {\n\tif (str == null || str.length < 1) {\n\t\tthrow new Error('str is empty')\n\t}\n\n\t// the sum in millisecond of the parsed duration\n\tlet d = 0;\n\n\t// current contains the partial seen number\n\t// it's reset when a time unit is found\n\tlet current = '';\n\n\t\n\t// it tracks the seen time units\n\t// and it denies eventual duplicated\n\tlet seen = {}\n\n\tfor (let i = 0; i < str.length; i++) {\n\t\t// append the current char if it's a number or a decimal separator\n\t\tif (isNumber(str[i]) || str[i] == '.') {\n\t\t\tcurrent += str[i]\n\t\t}\n\n\t\t// return if the next char is not a time unit \n\t\tif (str[i+1] == null || isNumber(str[i+1]) || str[i+1] == '.') {\n\t\t\tcontinue\n\t\t}\n\t\n\t\tlet v = parseFloat(current, 10)\n\t\tlet next = str[i+1]\n\t\t\n\t\tswitch (next) {\n\t\t\tcase 'd':\n\t\t\t\td += v*24*60*60*1000\n\t\t\t\tbreak;\n\t\t\tcase 'h':\n\t\t\t\td += v*60*60*1000\n\t\t\t\tbreak;\n\t\t\tcase 'm':\n\t\t\t\tif (i + 2 < str.length && str[i+2] == 's') {\n\t\t\t\t\t// millisecond is the maximum precision\n\t\t\t\t\t// truncate eventual decimal\n\t\t\t\t\td += Math.trunc(v)\n\t\t\t\t\ti++\n\t\t\t\t\tnext = 'ms'\n\t\t\t\t} else {\n\t\t\t\t\td += v*60*1000\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\td += v*1000\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`${next} is an unsupported time unit`)\n\t\t}\n\t\tif (seen[next]) {\n\t\t\tthrow new Error(`${next} time unit is provided multiple times`)\n\t\t}\n\t\tseen[next] = true\n\t\ti++\n\t\tcurrent = ''\n\t}\n\t// flush in case no time unit has been provided\n\t// for the latest group\n\tif (current.length > 0) {\n\t\td += parseFloat(current, 10)\n\t}\n\treturn d \n}\n\n// isNumber return true if the c character is a number\nfunction isNumber(c) {\n\treturn c >= '0' && c <= '9'\n}\n\n// getCurrentStageIndex returns the computed index of the running stage.\nfunction getCurrentStageIndex() {\n\tif (exec == undefined || exec.test == undefined || exec.test.options == undefined) {\n\t\tthrow new Error(`k6/execution.test.options is undefined - getCurrentStageIndex requires a k6 v0.38.0 or later. Please, upgrade for getting k6/execution.test.options supported.`)\n\n\t}\n\n\tlet scenario = exec.test.options.scenarios[exec.scenario.name]\n\tif (scenario == null)\t{\n\t\tthrow new Error(`the exec.test.options object doesn't contain the current scenario ${exec.scenario.name}`)\n\t}\n\tif (scenario.stages == null) {\n\t\tthrow new Error(`only ramping-vus or ramping-arravial-rate supports stages, it is not possible to get a stage index on other executors.`)\n\t}\n\n\tif (scenario.stages.length < 1) {\n\t\tthrow new Error(`the current scenario ${scenario.name} doesn't contain any stage`)\n\t}\n\n\tlet sum = 0;\n\tlet elapsed = new Date() - exec.scenario.startTime\n\tfor (let i = 0; i < scenario.stages.length; i++) {\n\t\tsum += parseDuration(scenario.stages[i].duration)\n\t\tif (elapsed < sum) {\n\t\t\treturn i\n\t\t}\n\t}\n\n\treturn scenario.stages.length-1\n}\n\n// tagWithCurrentStageIndex adds a tag with a `stage` key\n// and the index of the current running stage as value.\nfunction tagWithCurrentStageIndex() {\n exec.vu.tags['stage'] = getCurrentStageIndex()\n}\n\n// tagWithCurrentStageProfile adds a tag with a `stage` key\n// and the profile (ramp-up, steady or ramp-down) computed\n// from the current running stage.\nfunction tagWithCurrentStageProfile() {\n //ramp-up when previous.target < current.target\n //ramp-down when previous.target > current.target\n //steady when prevuious.target = current.target\n\t\n\tlet getStageProfile = function() {\t\n\t\tlet currentIndex = getCurrentStageIndex()\n\t\tif (currentIndex < 1) {\n\t\t\treturn 'ramp-up'\n\t\t}\n\n\t\tlet stages = exec.test.options.scenarios[exec.scenario.name].stages\n\t\tlet current = stages[currentIndex]\n\t\tlet previous = stages[currentIndex-1] \n\n\t\tif (current.target > previous.target) {\n\t\t\treturn 'ramp-up'\n\t\t}\n\t\t\n\t\tif (previous.target == current.target) {\n\t\t\treturn 'steady'\n\t\t}\n\n\t\treturn 'ramp-down'\n\t}\n\n exec.vu.tags['stage_profile'] = getStageProfile()\n}\n\nexport {\n\tparseDuration,\n\tgetCurrentStageIndex,\n\ttagWithCurrentStageIndex,\n\ttagWithCurrentStageProfile,\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/crypto\");","import { randomBytes } from \"k6/crypto\";\n\n/**\n * Produces a Universal Unique Identifier version 4\n *\n * @param {boolean} secure - whether a cryptographically secure generation function should be used\n * @returns {String} - 16 characters hexadecimal representation of the UUID v4\n */\nexport function uuidv4(secure = false) {\n return secure ? secureUUIDv4() : insecureUUIDv4();\n}\n\nexport function randomIntBetween(min, max) { // min and max included\n return Math.floor(Math.random() * (max - min + 1) + min);\n}\n\nexport function randomItem(arrayOfItems){\n return arrayOfItems[Math.floor(Math.random() * arrayOfItems.length)];\n}\n\nexport function randomString(length, charset='abcdefghijklmnopqrstuvwxyz') {\n let res = '';\n while (length--) res += charset[(Math.random() * charset.length) | 0];\n return res;\n}\n\nexport function findBetween(content, left, right, repeat = false) {\n const extracted = [];\n let doSearch = true;\n let start, end = 0;\n \n while (doSearch) {\n start = content.indexOf(left);\n if (start == -1) {\n break; // no more matches\n }\n\n start += left.length;\n end = content.indexOf(right, start);\n if (end == -1) {\n break; // no more matches\n }\n let extractedContent = content.substring(start, end);\n\n // stop here if only extracting one match (default behavior)\n if (!repeat) {\n return extractedContent; \n }\n\n // otherwise, add it to the array\n extracted.push(extractedContent);\n \n // update the \"cursor\" position to the end of the previous match\n content = content.substring(end + right.length);\n }\n\n return extracted.length ? extracted : null; // return all matches as an array or null\n}\n\nexport function normalDistributionStages(maxVus, durationSeconds, numberOfStages=10) {\n function normalDensity(mean, scale, x) {\n return Math.exp(-1 / 2 * Math.pow((x - mean) / scale, 2)) / (scale * Math.sqrt(2 * Math.PI));\n }\n\n const mean = 0;\n const scale = 1;\n let curve = new Array(numberOfStages + 2).fill(0);\n let durations = new Array(numberOfStages + 2).fill(Math.ceil(durationSeconds / 6));\n let k6stages = [];\n\n for (let i = 0; i <= numberOfStages; i++) {\n curve[i] = normalDensity(mean, scale, -2 * scale + 4 * scale * i / numberOfStages);\n }\n\n let peakDistribution = Math.max(...curve);\n\n let vus = curve.map(x => Math.round(x * maxVus / peakDistribution));\n\n for (let j = 1; j <= numberOfStages; j++) {\n durations[j] = Math.ceil(4 * durationSeconds / (6 * numberOfStages));\n }\n\n for (let k = 0; k <= numberOfStages + 1; k++) {\n k6stages.push({duration: `${durations[k]}s`, target: vus[k]});\n }\n\n return k6stages;\n}\n\n/**\n * Fast UUID v4 producer\n *\n * Note that this function does not produce cryptographically\n * secure UUIDs. If you need safe UUIDs, use the secureUUIDv4\n * implementation instead.\n *\n * @returns {String} - 16 characters hexadecimal representation of the UUID v4\n */\nfunction insecureUUIDv4() {\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function (c) {\n let r = (Math.random() * 16) | 0,\n v = c === \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n\n/**\n * Cryptographically secure UUID v4 producer\n *\n * Note that this implementation involves a computation\n * overhead.\n *\n * @returns {String} - 16 characters hexadecimal representation of the UUID v4\n */\nfunction secureUUIDv4() {\n /**\n * bytes conversion table used to convert UUIDs bytes\n * to string form.\n */\n const byteToHex = [];\n for (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n }\n\n /**\n * produce 16 random bytes, and set UUID v4's specific\n * version and `clock_seq_hi_and_reserved` bits.\n */\n const rnds = new Uint8Array(randomBytes(16));\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n\n /**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n return (\n byteToHex[rnds[0]] +\n byteToHex[rnds[1]] +\n byteToHex[rnds[2]] +\n byteToHex[rnds[3]] +\n \"-\" +\n byteToHex[rnds[4]] +\n byteToHex[rnds[5]] +\n \"-\" +\n byteToHex[rnds[6]] +\n byteToHex[rnds[7]] +\n \"-\" +\n byteToHex[rnds[8]] +\n byteToHex[rnds[9]] +\n \"-\" +\n byteToHex[rnds[10]] +\n byteToHex[rnds[11]] +\n byteToHex[rnds[12]] +\n byteToHex[rnds[13]] +\n byteToHex[rnds[14]] +\n byteToHex[rnds[15]]\n ).toLowerCase();\n}\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","require","parseDuration","str","length","Error","current","seen","i","isNumber","v","parseFloat","next","Math","trunc","c","getCurrentStageIndex","undefined","exec","scenario","stages","name","sum","elapsed","Date","duration","tagWithCurrentStageIndex","tagWithCurrentStageProfile","currentIndex","previous","target","getStageProfile","uuidv4","secure","secureUUIDv4","insecureUUIDv4","randomIntBetween","min","max","floor","random","randomItem","arrayOfItems","randomString","charset","res","findBetween","content","left","right","start","repeat","extracted","doSearch","end","indexOf","extractedContent","substring","push","normalDistributionStages","maxVus","durationSeconds","numberOfStages","normalDensity","mean","scale","x","exp","pow","sqrt","PI","curve","Array","fill","durations","ceil","k6stages","peakDistribution","vus","map","round","j","k","replace","r","toString","byteToHex","slice","rnds","Uint8Array","randomBytes","toLowerCase"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.js","mappings":"mBACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,GCLRF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3ER,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,M,yQCLvD,MAAM,EAA+BC,QAAQ,gB,aCI7C,SAASC,EAAcC,GACnB,GAAW,MAAPA,GAAeA,EAA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uB,mBAAZ0G,EAAwB,CAC/B,IAAMG,EAASH,EAAQ1G,GAEvB,OAAI6G,aAAkBC,QACXD,EAAOE,KAAKJ,GAGhBA,EAAaE,GAGxB,OAAIH,aAAmBI,QACZJ,EAAQK,KAAKJ,GAGjBA,EAAaD,MAGxB,OAAIL,EAAQW,MAAK,SAACH,GAAM,OAAKA,aAAkBC,WACpCA,QAAQG,IAAIZ,GAASU,MAAK,SAACV,GAAO,OAAKA,EAAQa,MAAMC,YAGzDd,EAAQa,MAAMC,S","sources":["webpack://k6-jslib-utils/webpack/bootstrap","webpack://k6-jslib-utils/webpack/runtime/compat get default export","webpack://k6-jslib-utils/webpack/runtime/define property getters","webpack://k6-jslib-utils/webpack/runtime/hasOwnProperty shorthand","webpack://k6-jslib-utils/webpack/runtime/make namespace object","webpack://k6-jslib-utils/external commonjs \"k6/execution\"","webpack://k6-jslib-utils/./src/stages.js","webpack://k6-jslib-utils/external commonjs \"k6/crypto\"","webpack://k6-jslib-utils/./src/utils.js","webpack://k6-jslib-utils/./src/check.ts","webpack://k6-jslib-utils/external commonjs \"k6/metrics\""],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/execution\");","import exec from 'k6/execution'\n\n// parseDuration parses the provided string as an Integer number\n// in millisecond precision\nfunction parseDuration(str) {\n if (str == null || str.length < 1) {\n throw new Error('str is empty')\n }\n\n // the sum in millisecond of the parsed duration\n let d = 0\n\n // current contains the partial seen number\n // it's reset when a time unit is found\n let current = ''\n\n // it tracks the seen time units\n // and it denies eventual duplicated\n let seen = {}\n\n for (let i = 0; i < str.length; i++) {\n // append the current char if it's a number or a decimal separator\n if (isNumber(str[i]) || str[i] == '.') {\n current += str[i]\n }\n\n // return if the next char is not a time unit\n if (str[i + 1] == null || isNumber(str[i + 1]) || str[i + 1] == '.') {\n continue\n }\n\n let v = parseFloat(current, 10)\n let next = str[i + 1]\n\n switch (next) {\n case 'd':\n d += v * 24 * 60 * 60 * 1000\n break\n case 'h':\n d += v * 60 * 60 * 1000\n break\n case 'm':\n if (i + 2 < str.length && str[i + 2] == 's') {\n // millisecond is the maximum precision\n // truncate eventual decimal\n d += Math.trunc(v)\n i++\n next = 'ms'\n } else {\n d += v * 60 * 1000\n }\n break\n case 's':\n d += v * 1000\n break\n default:\n throw new Error(`${next} is an unsupported time unit`)\n }\n if (seen[next]) {\n throw new Error(`${next} time unit is provided multiple times`)\n }\n seen[next] = true\n i++\n current = ''\n }\n // flush in case no time unit has been provided\n // for the latest group\n if (current.length > 0) {\n d += parseFloat(current, 10)\n }\n return d\n}\n\n// isNumber return true if the c character is a number\nfunction isNumber(c) {\n return c >= '0' && c <= '9'\n}\n\n// getCurrentStageIndex returns the computed index of the running stage.\nfunction getCurrentStageIndex() {\n let scenario = exec.test.options.scenarios[exec.scenario.name]\n if (scenario == null) {\n throw new Error(\n `the exec.test.options object doesn't contain the current scenario ${exec.scenario.name}`\n )\n }\n if (scenario.stages == null) {\n throw new Error(\n `only ramping-vus or ramping-arravial-rate supports stages, it is not possible to get a stage index on other executors.`\n )\n }\n\n if (scenario.stages.length < 1) {\n throw new Error(`the current scenario ${scenario.name} doesn't contain any stage`)\n }\n\n let sum = 0\n let elapsed = new Date() - exec.scenario.startTime\n for (let i = 0; i < scenario.stages.length; i++) {\n sum += parseDuration(scenario.stages[i].duration)\n if (elapsed < sum) {\n return i\n }\n }\n\n return scenario.stages.length - 1\n}\n\n// tagWithCurrentStageIndex adds a tag with a `stage` key\n// and the index of the current running stage as value.\nfunction tagWithCurrentStageIndex() {\n exec.vu.tags['stage'] = getCurrentStageIndex()\n}\n\n// tagWithCurrentStageProfile adds a tag with a `stage` key\n// and the profile (ramp-up, steady or ramp-down) computed\n// from the current running stage.\nfunction tagWithCurrentStageProfile() {\n //ramp-up when previous.target < current.target\n //ramp-down when previous.target > current.target\n //steady when prevuious.target = current.target\n\n let getStageProfile = function () {\n let currentIndex = getCurrentStageIndex()\n if (currentIndex < 1) {\n return 'ramp-up'\n }\n\n let stages = exec.test.options.scenarios[exec.scenario.name].stages\n let current = stages[currentIndex]\n let previous = stages[currentIndex - 1]\n\n if (current.target > previous.target) {\n return 'ramp-up'\n }\n\n if (previous.target == current.target) {\n return 'steady'\n }\n\n return 'ramp-down'\n }\n\n exec.vu.tags['stage_profile'] = getStageProfile()\n}\n\nexport { parseDuration, getCurrentStageIndex, tagWithCurrentStageIndex, tagWithCurrentStageProfile }\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/crypto\");","import { randomBytes } from 'k6/crypto'\n\n/**\n * Produces a Universal Unique Identifier version 4\n *\n * @param {boolean} secure - whether a cryptographically secure generation function should be used\n * @returns {String} - 16 characters hexadecimal representation of the UUID v4\n */\nexport function uuidv4(secure = false) {\n return secure ? secureUUIDv4() : insecureUUIDv4()\n}\n\nexport function randomIntBetween(min, max) {\n // min and max included\n return Math.floor(Math.random() * (max - min + 1) + min)\n}\n\nexport function randomItem(arrayOfItems) {\n return arrayOfItems[Math.floor(Math.random() * arrayOfItems.length)]\n}\n\nexport function randomString(length, charset = 'abcdefghijklmnopqrstuvwxyz') {\n let res = ''\n while (length--) res += charset[(Math.random() * charset.length) | 0]\n return res\n}\n\nexport function findBetween(content, left, right, repeat = false) {\n const extracted = []\n let doSearch = true\n let start,\n end = 0\n\n while (doSearch) {\n start = content.indexOf(left)\n if (start == -1) {\n break // no more matches\n }\n\n start += left.length\n end = content.indexOf(right, start)\n if (end == -1) {\n break // no more matches\n }\n let extractedContent = content.substring(start, end)\n\n // stop here if only extracting one match (default behavior)\n if (!repeat) {\n return extractedContent\n }\n\n // otherwise, add it to the array\n extracted.push(extractedContent)\n\n // update the \"cursor\" position to the end of the previous match\n content = content.substring(end + right.length)\n }\n\n return extracted.length ? extracted : null // return all matches as an array or null\n}\n\nexport function normalDistributionStages(maxVus, durationSeconds, numberOfStages = 10) {\n function normalDensity(mean, scale, x) {\n return (\n Math.exp((-1 / 2) * Math.pow((x - mean) / scale, 2)) / (scale * Math.sqrt(2 * Math.PI))\n )\n }\n\n const mean = 0\n const scale = 1\n let curve = new Array(numberOfStages + 2).fill(0)\n let durations = new Array(numberOfStages + 2).fill(Math.ceil(durationSeconds / 6))\n let k6stages = []\n\n for (let i = 0; i <= numberOfStages; i++) {\n curve[i] = normalDensity(mean, scale, -2 * scale + (4 * scale * i) / numberOfStages)\n }\n\n let peakDistribution = Math.max(...curve)\n\n let vus = curve.map((x) => Math.round((x * maxVus) / peakDistribution))\n\n for (let j = 1; j <= numberOfStages; j++) {\n durations[j] = Math.ceil((4 * durationSeconds) / (6 * numberOfStages))\n }\n\n for (let k = 0; k <= numberOfStages + 1; k++) {\n k6stages.push({ duration: `${durations[k]}s`, target: vus[k] })\n }\n\n return k6stages\n}\n\n/**\n * Fast UUID v4 producer\n *\n * Note that this function does not produce cryptographically\n * secure UUIDs. If you need safe UUIDs, use the secureUUIDv4\n * implementation instead.\n *\n * @returns {String} - 16 characters hexadecimal representation of the UUID v4\n */\nfunction insecureUUIDv4() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n let r = (Math.random() * 16) | 0,\n v = c === 'x' ? r : (r & 0x3) | 0x8\n return v.toString(16)\n })\n}\n\n/**\n * Cryptographically secure UUID v4 producer\n *\n * Note that this implementation involves a computation\n * overhead.\n *\n * @returns {String} - 16 characters hexadecimal representation of the UUID v4\n */\nfunction secureUUIDv4() {\n /**\n * bytes conversion table used to convert UUIDs bytes\n * to string form.\n */\n const byteToHex = []\n for (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1))\n }\n\n /**\n * produce 16 random bytes, and set UUID v4's specific\n * version and `clock_seq_hi_and_reserved` bits.\n */\n const rnds = new Uint8Array(randomBytes(16))\n rnds[6] = (rnds[6] & 0x0f) | 0x40\n rnds[8] = (rnds[8] & 0x3f) | 0x80\n\n /**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n return (\n byteToHex[rnds[0]] +\n byteToHex[rnds[1]] +\n byteToHex[rnds[2]] +\n byteToHex[rnds[3]] +\n '-' +\n byteToHex[rnds[4]] +\n byteToHex[rnds[5]] +\n '-' +\n byteToHex[rnds[6]] +\n byteToHex[rnds[7]] +\n '-' +\n byteToHex[rnds[8]] +\n byteToHex[rnds[9]] +\n '-' +\n byteToHex[rnds[10]] +\n byteToHex[rnds[11]] +\n byteToHex[rnds[12]] +\n byteToHex[rnds[13]] +\n byteToHex[rnds[14]] +\n byteToHex[rnds[15]]\n ).toLowerCase()\n}\n","import { Rate } from 'k6/metrics'\n\ntype FalsyCheckValue =\n | Array\n | Record\n | boolean\n | string\n | number\n | null\n | undefined\n\ntype Checker =\n | ((value: T) => FalsyCheckValue)\n | ((value: T) => Promise)\n | FalsyCheckValue\n | Promise\n\ninterface CheckMap {\n [key: string]: Checker\n}\n\ninterface SyncCheckMap {\n [key: string]: ((value: any) => FalsyCheckValue) | FalsyCheckValue\n}\n\ntype CheckResult> = C extends SyncCheckMap ? boolean : Promise\n\nconst checkRate = new Rate('checks')\n\nexport function check>(checkers: C): CheckResult\nexport function check>(value: T, checkers: C): CheckResult\nexport function check>(value: T | C, checkers?: C): CheckResult {\n const checkMap = checkers || (value as C)\n\n const results = Object.entries(checkMap).map(([key, checker]) => {\n function reportResult(value: FalsyCheckValue): FalsyCheckValue {\n checkRate.add(value ? 1 : 0, {\n check: key,\n })\n\n return value\n }\n\n if (typeof checker === 'function') {\n const result = checker(value as T)\n\n if (result instanceof Promise) {\n return result.then(reportResult)\n }\n\n return reportResult(result)\n }\n\n if (checker instanceof Promise) {\n return checker.then(reportResult)\n }\n\n return reportResult(checker)\n })\n\n if (results.some((result) => result instanceof Promise)) {\n return Promise.all(results).then((results) => results.every(Boolean)) as CheckResult\n }\n\n return results.every(Boolean) as CheckResult\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/metrics\");"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","require","parseDuration","str","length","Error","current","seen","i","isNumber","v","parseFloat","next","Math","trunc","concat","c","getCurrentStageIndex","scenario","exec","stages","name","sum","elapsed","Date","duration","tagWithCurrentStageIndex","tagWithCurrentStageProfile","currentIndex","previous","target","getStageProfile","uuidv4","secure","arguments","undefined","secureUUIDv4","insecureUUIDv4","randomIntBetween","min","max","floor","random","randomItem","arrayOfItems","randomString","charset","res","findBetween","content","left","right","start","repeat","extracted","doSearch","end","indexOf","extractedContent","substring","push","normalDistributionStages","maxVus","durationSeconds","numberOfStages","normalDensity","mean","scale","x","exp","pow","sqrt","PI","curve","Array","fill","durations","ceil","k6stages","peakDistribution","apply","_toConsumableArray","vus","map","round","j","k","replace","r","toString","byteToHex","slice","rnds","Uint8Array","randomBytes","toLowerCase","checkRate","Rate","check","checkers","checkMap","results","entries","_ref","_ref2","_slicedToArray","checker","reportResult","add","result","Promise","then","some","all","every","Boolean"],"sourceRoot":""} \ No newline at end of file diff --git a/build/index.min.js b/build/index.min.js deleted file mode 100644 index b719a29..0000000 --- a/build/index.min.js +++ /dev/null @@ -1,2 +0,0 @@ -(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};require("k6/crypto"),(()=>{e.r(t),e.d(t,{getCurrentStageIndex:()=>s,parseDuration:()=>a,tagWithCurrentStageIndex:()=>i,tagWithCurrentStageProfile:()=>u});const r=require("k6/execution");var n=e.n(r);function a(e){if(null==e||e.length<1)throw new Error("str is empty");for(var t=0,r="",n={},a=0;a0&&(t+=parseFloat(r,10)),t}function o(e){return e>="0"&&e<="9"}function s(){var e=n().test.options.scenarios[n().scenario.name];if(null==e)throw new Error("the exec.test.options object doesn't contain the current scenario ".concat(n().scenario.name));if(null==e.stages)throw new Error("only ramping-vus or ramping-arravial-rate supports stages, it is not possible to get a stage index on other executors.");if(e.stages.length<1)throw new Error("the current scenario ".concat(e.name," doesn't contain any stage"));for(var t=0,r=new Date-n().scenario.startTime,o=0;oa.target?"ramp-up":a.target==r.target?"steady":"ramp-down"}()}})();var r=exports;for(var n in t)r[n]=t[n];t.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})})(); -//# sourceMappingURL=index.min.js.map \ No newline at end of file diff --git a/build/index.min.js.map b/build/index.min.js.map deleted file mode 100644 index 09bf568..0000000 --- a/build/index.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.min.js","mappings":"mBACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IA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MACD,QACC,MAAM,IAAIL,MAAJ,UAAaO,EAAb,iCAER,GAAIL,EAAKK,GACR,MAAM,IAAIP,MAAJ,UAAaO,EAAb,0CAEPL,EAAKK,IAAQ,EACbJ,IACAF,EAAU,GAOX,OAHIA,EAAQF,OAAS,IACpBrB,GAAK4B,WAAWL,EAAS,KAEnBvB,EAIR,SAAS0B,EAASM,GACjB,OAAOA,GAAK,KAAOA,GAAK,IAIzB,SAASC,IACR,IAAIC,EAAWC,IAAAA,KAAAA,QAAAA,UAA4BA,IAAAA,SAAAA,MAC3C,GAAgB,MAAZD,EACH,MAAM,IAAIZ,MAAJ,4EAA+Ea,IAAAA,SAAAA,OAEtF,GAAuB,MAAnBD,EAASE,OACZ,MAAM,IAAId,MAAJ,0HAGP,GAAIY,EAASE,OAAOf,OAAS,EAC5B,MAAM,IAAIC,MAAJ,+BAAkCY,EAASG,KAA3C,+BAKP,IAFA,IAAIC,EAAM,EACNC,EAAU,IAAIC,KAASL,IAAAA,SAAAA,UAClBV,EAAI,EAAGA,EAAIS,EAASE,OAAOf,OAAQI,IAE3C,GAAIc,GADJD,GAAOnB,EAAce,EAASE,OAAOX,GAAGgB,WAEvC,OAAOhB,EAIT,OAAOS,EAASE,OAAOf,OAAO,EAK/B,SAASqB,IACPP,IAAAA,GAAAA,KAAAA,MAAwBF,IAM1B,SAASU,IA0BPR,IAAAA,GAAAA,KAAAA,cArBqB,WACrB,IAAIS,EAAeX,IACnB,GAAIW,EAAe,EAClB,MAAO,UAGR,IAAIR,EAASD,IAAAA,KAAAA,QAAAA,UAA4BA,IAAAA,SAAAA,MAAoBC,OACzDb,EAAUa,EAAOQ,GACjBC,EAAWT,EAAOQ,EAAa,GAEnC,OAAIrB,EAAQuB,OAAUD,EAASC,OACvB,UAGJD,EAASC,QAAUvB,EAAQuB,OACvB,SAGD,YAGyBC,K","sources":["webpack://k6-jslib-utils/webpack/bootstrap","webpack://k6-jslib-utils/webpack/runtime/compat get default export","webpack://k6-jslib-utils/webpack/runtime/define property getters","webpack://k6-jslib-utils/webpack/runtime/hasOwnProperty shorthand","webpack://k6-jslib-utils/webpack/runtime/make namespace object","webpack://k6-jslib-utils/external commonjs \"k6/crypto\"","webpack://k6-jslib-utils/external commonjs \"k6/execution\"","webpack://k6-jslib-utils/./src/stages.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/crypto\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/execution\");","import exec from 'k6/execution'\n\n// parseDuration parses the provided string as an Integer number\n// in millisecond precision\nfunction parseDuration(str) {\n\tif (str == null || str.length < 1) {\n\t\tthrow new Error('str is empty')\n\t}\n\n\t// the sum in millisecond of the parsed duration\n\tlet d = 0;\n\n\t// current contains the partial seen number\n\t// it's reset when a time unit is found\n\tlet current = '';\n\n\t\n\t// it tracks the seen time units\n\t// and it denies eventual duplicated\n\tlet seen = {}\n\n\tfor (let i = 0; i < str.length; i++) {\n\t\t// append the current char if it's a number or a decimal separator\n\t\tif (isNumber(str[i]) || str[i] == '.') {\n\t\t\tcurrent += str[i]\n\t\t}\n\n\t\t// return if the next char is not a time unit \n\t\tif (str[i+1] == null || isNumber(str[i+1]) || str[i+1] == '.') {\n\t\t\tcontinue\n\t\t}\n\t\n\t\tlet v = parseFloat(current, 10)\n\t\tlet next = str[i+1]\n\t\t\n\t\tswitch (next) {\n\t\t\tcase 'd':\n\t\t\t\td += v*24*60*60*1000\n\t\t\t\tbreak;\n\t\t\tcase 'h':\n\t\t\t\td += v*60*60*1000\n\t\t\t\tbreak;\n\t\t\tcase 'm':\n\t\t\t\tif (i + 2 < str.length && str[i+2] == 's') {\n\t\t\t\t\t// millisecond is the maximum precision\n\t\t\t\t\t// truncate eventual decimal\n\t\t\t\t\td += Math.trunc(v)\n\t\t\t\t\ti++\n\t\t\t\t\tnext = 'ms'\n\t\t\t\t} else {\n\t\t\t\t\td += v*60*1000\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 's':\n\t\t\t\td += v*1000\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`${next} is an unsupported time unit`)\n\t\t}\n\t\tif (seen[next]) {\n\t\t\tthrow new Error(`${next} time unit is provided multiple times`)\n\t\t}\n\t\tseen[next] = true\n\t\ti++\n\t\tcurrent = ''\n\t}\n\t// flush in case no time unit has been provided\n\t// for the latest group\n\tif (current.length > 0) {\n\t\td += parseFloat(current, 10)\n\t}\n\treturn d \n}\n\n// isNumber return true if the c character is a number\nfunction isNumber(c) {\n\treturn c >= '0' && c <= '9'\n}\n\n// getCurrentStageIndex returns the computed index of the running stage.\nfunction getCurrentStageIndex() {\n\tlet scenario = exec.test.options.scenarios[exec.scenario.name]\n\tif (scenario == null)\t{\n\t\tthrow new Error(`the exec.test.options object doesn't contain the current scenario ${exec.scenario.name}`)\n\t}\n\tif (scenario.stages == null) {\n\t\tthrow new Error(`only ramping-vus or ramping-arravial-rate supports stages, it is not possible to get a stage index on other executors.`)\n\t}\n\n\tif (scenario.stages.length < 1) {\n\t\tthrow new Error(`the current scenario ${scenario.name} doesn't contain any stage`)\n\t}\n\n\tlet sum = 0;\n\tlet elapsed = new Date() - exec.scenario.startTime\n\tfor (let i = 0; i < scenario.stages.length; i++) {\n\t\tsum += parseDuration(scenario.stages[i].duration)\n\t\tif (elapsed < sum) {\n\t\t\treturn i\n\t\t}\n\t}\n\n\treturn scenario.stages.length-1\n}\n\n// tagWithCurrentStageIndex adds a tag with a `stage` key\n// and the index of the current running stage as value.\nfunction tagWithCurrentStageIndex() {\n exec.vu.tags['stage'] = getCurrentStageIndex()\n}\n\n// tagWithCurrentStageProfile adds a tag with a `stage` key\n// and the profile (ramp-up, steady or ramp-down) computed\n// from the current running stage.\nfunction tagWithCurrentStageProfile() {\n //ramp-up when previous.target < current.target\n //ramp-down when previous.target > current.target\n //steady when prevuious.target = current.target\n\t\n\tlet getStageProfile = function() {\t\n\t\tlet currentIndex = getCurrentStageIndex()\n\t\tif (currentIndex < 1) {\n\t\t\treturn 'ramp-up'\n\t\t}\n\n\t\tlet stages = exec.test.options.scenarios[exec.scenario.name].stages\n\t\tlet current = stages[currentIndex]\n\t\tlet previous = stages[currentIndex-1] \n\n\t\tif (current.target > previous.target) {\n\t\t\treturn 'ramp-up'\n\t\t}\n\t\t\n\t\tif (previous.target == current.target) {\n\t\t\treturn 'steady'\n\t\t}\n\n\t\treturn 'ramp-down'\n\t}\n\n exec.vu.tags['stage_profile'] = getStageProfile()\n}\n\nexport {\n\tparseDuration,\n\tgetCurrentStageIndex,\n\ttagWithCurrentStageIndex,\n\ttagWithCurrentStageProfile,\n}\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","require","parseDuration","str","length","Error","current","seen","i","isNumber","v","parseFloat","next","Math","trunc","c","getCurrentStageIndex","scenario","exec","stages","name","sum","elapsed","Date","duration","tagWithCurrentStageIndex","tagWithCurrentStageProfile","currentIndex","previous","target","getStageProfile"],"sourceRoot":""} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 1807579..cc2eaef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,8 @@ "@babel/core": "^7.4.4", "@babel/plugin-transform-block-scoping": "^7.14.1", "@babel/preset-env": "^7.4.4", + "@babel/preset-typescript": "^7.24.7", + "@types/k6": "^0.52.0", "@types/webpack": "^5.28.0", "babel-loader": "^8.0.6", "clean-webpack-plugin": "^4.0.0", @@ -38,12 +40,13 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", - "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", + "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==", "dev": true, "dependencies": { - "@babel/highlight": "^7.16.7" + "@babel/highlight": "^7.24.7", + "picocolors": "^1.0.0" }, "engines": { "node": ">=6.9.0" @@ -89,26 +92,41 @@ } }, "node_modules/@babel/generator": { - "version": "7.17.9", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.9.tgz", - "integrity": "sha512-rAdDousTwxbIxbz5I7GEQ3lUip+xVCXooZNbsydCWs3xA7ZsYOv+CFRdzGxRX78BmQHu9B1Eso59AOZQOJDEdQ==", + "version": "7.24.10", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.10.tgz", + "integrity": "sha512-o9HBZL1G2129luEUlG1hB4N/nlYNWHnpwlND9eOMclRqqu1YDy2sSYVCFUZwl8I1Gxh+QSRrP2vD7EpUmFVXxg==", "dev": true, "dependencies": { - "@babel/types": "^7.17.0", - "jsesc": "^2.5.1", - "source-map": "^0.5.0" + "@babel/types": "^7.24.9", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^2.5.1" }, "engines": { "node": ">=6.9.0" } }, + "node_modules/@babel/generator/node_modules/@jridgewell/gen-mapping": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/@babel/helper-annotate-as-pure": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.16.7.tgz", - "integrity": "sha512-s6t2w/IPQVTAET1HitoowRGXooX8mCgtuP5195wD/QJPV6wYjpujCGF7JuMODVX2ZAJOf1GT6DT9MHEZvLOFSw==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.24.7.tgz", + "integrity": "sha512-BaDeOonYvhdKw+JoMVkAixAAJzG2jVPIwWoKBPdYuY9b452e2rPuI9QPYh3KpofZ3pW2akOmwZLOiOsHMiqRAg==", "dev": true, "dependencies": { - "@babel/types": "^7.16.7" + "@babel/types": "^7.24.7" }, "engines": { "node": ">=6.9.0" @@ -146,18 +164,20 @@ } }, "node_modules/@babel/helper-create-class-features-plugin": { - "version": "7.17.9", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.17.9.tgz", - "integrity": "sha512-kUjip3gruz6AJKOq5i3nC6CoCEEF/oHH3cp6tOZhB+IyyyPyW0g1Gfsxn3mkk6S08pIA2y8GQh609v9G/5sHVQ==", + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.24.8.tgz", + "integrity": "sha512-4f6Oqnmyp2PP3olgUMmOwC3akxSm5aBYraQ6YDdKy7NcAMkDECHWG0DEnV6M2UAkERgIBhYt8S27rURPg7SxWA==", "dev": true, "dependencies": { - "@babel/helper-annotate-as-pure": "^7.16.7", - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-function-name": "^7.17.9", - "@babel/helper-member-expression-to-functions": "^7.17.7", - "@babel/helper-optimise-call-expression": "^7.16.7", - "@babel/helper-replace-supers": "^7.16.7", - "@babel/helper-split-export-declaration": "^7.16.7" + "@babel/helper-annotate-as-pure": "^7.24.7", + "@babel/helper-environment-visitor": "^7.24.7", + "@babel/helper-function-name": "^7.24.7", + "@babel/helper-member-expression-to-functions": "^7.24.8", + "@babel/helper-optimise-call-expression": "^7.24.7", + "@babel/helper-replace-supers": "^7.24.7", + "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7", + "@babel/helper-split-export-declaration": "^7.24.7", + "semver": "^6.3.1" }, "engines": { "node": ">=6.9.0" @@ -202,12 +222,12 @@ } }, "node_modules/@babel/helper-environment-visitor": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.7.tgz", - "integrity": "sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.24.7.tgz", + "integrity": "sha512-DoiN84+4Gnd0ncbBOM9AZENV4a5ZiL39HYMyZJGZ/AZEykHYdJw0wW3kdcsh9/Kn+BRXHLkkklZ51ecPKmI1CQ==", "dev": true, "dependencies": { - "@babel/types": "^7.16.7" + "@babel/types": "^7.24.7" }, "engines": { "node": ">=6.9.0" @@ -226,89 +246,91 @@ } }, "node_modules/@babel/helper-function-name": { - "version": "7.17.9", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.17.9.tgz", - "integrity": "sha512-7cRisGlVtiVqZ0MW0/yFB4atgpGLWEHUVYnb448hZK4x+vih0YO5UoS11XIYtZYqHd0dIPMdUSv8q5K4LdMnIg==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.24.7.tgz", + "integrity": "sha512-FyoJTsj/PEUWu1/TYRiXTIHc8lbw+TDYkZuoE43opPS5TrI7MyONBE1oNvfguEXAD9yhQRrVBnXdXzSLQl9XnA==", "dev": true, "dependencies": { - "@babel/template": "^7.16.7", - "@babel/types": "^7.17.0" + "@babel/template": "^7.24.7", + "@babel/types": "^7.24.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-hoist-variables": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz", - "integrity": "sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.24.7.tgz", + "integrity": "sha512-MJJwhkoGy5c4ehfoRyrJ/owKeMl19U54h27YYftT0o2teQ3FJ3nQUf/I3LlJsX4l3qlw7WRXUmiyajvHXoTubQ==", "dev": true, "dependencies": { - "@babel/types": "^7.16.7" + "@babel/types": "^7.24.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-member-expression-to-functions": { - "version": "7.17.7", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.17.7.tgz", - "integrity": "sha512-thxXgnQ8qQ11W2wVUObIqDL4p148VMxkt5T/qpN5k2fboRyzFGFmKsTGViquyM5QHKUy48OZoca8kw4ajaDPyw==", + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.24.8.tgz", + "integrity": "sha512-LABppdt+Lp/RlBxqrh4qgf1oEH/WxdzQNDJIu5gC/W1GyvPVrOBiItmmM8wan2fm4oYqFuFfkXmlGpLQhPY8CA==", "dev": true, "dependencies": { - "@babel/types": "^7.17.0" + "@babel/traverse": "^7.24.8", + "@babel/types": "^7.24.8" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-imports": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz", - "integrity": "sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.24.7.tgz", + "integrity": "sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA==", "dev": true, "dependencies": { - "@babel/types": "^7.16.7" + "@babel/traverse": "^7.24.7", + "@babel/types": "^7.24.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.17.7", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.17.7.tgz", - "integrity": "sha512-VmZD99F3gNTYB7fJRDTi+u6l/zxY0BE6OIxPSU7a50s6ZUQkHwSDmV92FfM+oCG0pZRVojGYhkR8I0OGeCVREw==", + "version": "7.24.9", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.24.9.tgz", + "integrity": "sha512-oYbh+rtFKj/HwBQkFlUzvcybzklmVdVV3UU+mN7n2t/q3yGHbuVdNxyFvSBO1tfvjyArpHNcWMAzsSPdyI46hw==", "dev": true, "dependencies": { - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-module-imports": "^7.16.7", - "@babel/helper-simple-access": "^7.17.7", - "@babel/helper-split-export-declaration": "^7.16.7", - "@babel/helper-validator-identifier": "^7.16.7", - "@babel/template": "^7.16.7", - "@babel/traverse": "^7.17.3", - "@babel/types": "^7.17.0" + "@babel/helper-environment-visitor": "^7.24.7", + "@babel/helper-module-imports": "^7.24.7", + "@babel/helper-simple-access": "^7.24.7", + "@babel/helper-split-export-declaration": "^7.24.7", + "@babel/helper-validator-identifier": "^7.24.7" }, "engines": { "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" } }, "node_modules/@babel/helper-optimise-call-expression": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.16.7.tgz", - "integrity": "sha512-EtgBhg7rd/JcnpZFXpBy0ze1YRfdm7BnBX4uKMBd3ixa3RGAE002JZB66FJyNH7g0F38U05pXmA5P8cBh7z+1w==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.24.7.tgz", + "integrity": "sha512-jKiTsW2xmWwxT1ixIdfXUZp+P5yURx2suzLZr5Hi64rURpDYdMW0pv+Uf17EYk2Rd428Lx4tLsnjGJzYKDM/6A==", "dev": true, "dependencies": { - "@babel/types": "^7.16.7" + "@babel/types": "^7.24.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.7.tgz", - "integrity": "sha512-Qg3Nk7ZxpgMrsox6HreY1ZNKdBq7K72tDSliA6dCl5f007jR4ne8iD5UzuNnCJH2xBf2BEEVGr+/OL6Gdp7RxA==", + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.8.tgz", + "integrity": "sha512-FFWx5142D8h2Mgr/iPVGH5G7w6jDn4jUSpZTyDnQO0Yn7Ks2Kuz6Pci8H6MPCoUJegd/UZQ3tAvfLCxQSnWWwg==", "dev": true, "engines": { "node": ">=6.9.0" @@ -329,70 +351,82 @@ } }, "node_modules/@babel/helper-replace-supers": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.16.7.tgz", - "integrity": "sha512-y9vsWilTNaVnVh6xiJfABzsNpgDPKev9HnAgz6Gb1p6UUwf9NepdlsV7VXGCftJM+jqD5f7JIEubcpLjZj5dBw==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.24.7.tgz", + "integrity": "sha512-qTAxxBM81VEyoAY0TtLrx1oAEJc09ZK67Q9ljQToqCnA+55eNwCORaxlKyu+rNfX86o8OXRUSNUnrtsAZXM9sg==", "dev": true, "dependencies": { - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-member-expression-to-functions": "^7.16.7", - "@babel/helper-optimise-call-expression": "^7.16.7", - "@babel/traverse": "^7.16.7", - "@babel/types": "^7.16.7" + "@babel/helper-environment-visitor": "^7.24.7", + "@babel/helper-member-expression-to-functions": "^7.24.7", + "@babel/helper-optimise-call-expression": "^7.24.7" }, "engines": { "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" } }, "node_modules/@babel/helper-simple-access": { - "version": "7.17.7", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.17.7.tgz", - "integrity": "sha512-txyMCGroZ96i+Pxr3Je3lzEJjqwaRC9buMUgtomcrLe5Nd0+fk1h0LLA+ixUF5OW7AhHuQ7Es1WcQJZmZsz2XA==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.24.7.tgz", + "integrity": "sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg==", "dev": true, "dependencies": { - "@babel/types": "^7.17.0" + "@babel/traverse": "^7.24.7", + "@babel/types": "^7.24.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-skip-transparent-expression-wrappers": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.16.0.tgz", - "integrity": "sha512-+il1gTy0oHwUsBQZyJvukbB4vPMdcYBrFHa0Uc4AizLxbq6BOYC51Rv4tWocX9BLBDLZ4kc6qUFpQ6HRgL+3zw==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.24.7.tgz", + "integrity": "sha512-IO+DLT3LQUElMbpzlatRASEyQtfhSE0+m465v++3jyyXeBTBUjtVZg28/gHeV5mrTJqvEKhKroBGAvhW+qPHiQ==", "dev": true, "dependencies": { - "@babel/types": "^7.16.0" + "@babel/traverse": "^7.24.7", + "@babel/types": "^7.24.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-split-export-declaration": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz", - "integrity": "sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.7.tgz", + "integrity": "sha512-oy5V7pD+UvfkEATUKvIjvIAH/xCzfsFVw7ygW2SI6NClZzquT+mwdTfgfdbUiceh6iQO0CHtCPsyze/MZ2YbAA==", "dev": true, "dependencies": { - "@babel/types": "^7.16.7" + "@babel/types": "^7.24.7" }, "engines": { "node": ">=6.9.0" } }, + "node_modules/@babel/helper-string-parser": { + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz", + "integrity": "sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", - "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", + "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-option": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz", - "integrity": "sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ==", + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.24.8.tgz", + "integrity": "sha512-xb8t9tD1MHLungh/AIoWYN+gVHaB9kwlu8gffXGSt3FFEIT7RjS+xWbc2vUD1UTZdIpKj/ab3rdqJ7ufngyi2Q==", "dev": true, "engines": { "node": ">=6.9.0" @@ -428,23 +462,24 @@ } }, "node_modules/@babel/highlight": { - "version": "7.17.9", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.17.9.tgz", - "integrity": "sha512-J9PfEKCbFIv2X5bjTMiZu6Vf341N05QIY+d6FvVKynkG1S7G0j3I0QoRtWIrXhZ+/Nlb5Q0MzqL7TokEJ5BNHg==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz", + "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.16.7", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" + "@babel/helper-validator-identifier": "^7.24.7", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.17.9", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.17.9.tgz", - "integrity": "sha512-vqUSBLP8dQHFPdPi9bc5GK9vRkYHJ49fsZdtoJ8EQ8ibpwk5rPKfvNIwChB0KVXcIjcepEBBd2VHC5r9Gy8ueg==", + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.8.tgz", + "integrity": "sha512-WzfbgXOkGzZiXXCqk43kKwZjzwx4oulxZi3nq2TYL9mOjQv6kYwul9mz6ID36njuL7Xkp6nJEfok848Zj10j/w==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -808,6 +843,21 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-syntax-jsx": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.24.7.tgz", + "integrity": "sha512-6ddciUPe/mpMnOKv/U+RSd2vvVy+Yw/JfBB0ZHYjEZt9NLHmCUylNYlsbqCCS1Bffjlb0fCwC9Vqz+sBz6PsiQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-syntax-logical-assignment-operators": { "version": "7.10.4", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", @@ -910,6 +960,21 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-syntax-typescript": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.24.7.tgz", + "integrity": "sha512-c/+fVeJBB0FeKsFvwytYiUD+LBvhHjGSI0g446PRGdSVGZLRNArBUno2PETbAly3tpiNAQR5XaZ+JslxkotsbA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-transform-arrow-functions": { "version": "7.16.7", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.16.7.tgz", @@ -1151,15 +1216,14 @@ } }, "node_modules/@babel/plugin-transform-modules-commonjs": { - "version": "7.17.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.17.9.tgz", - "integrity": "sha512-2TBFd/r2I6VlYn0YRTz2JdazS+FoUuQ2rIFHoAxtyP/0G3D82SBLaRq9rnUkpqlLg03Byfl/+M32mpxjO6KaPw==", + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.24.8.tgz", + "integrity": "sha512-WHsk9H8XxRs3JXKWFiqtQebdh9b/pTk4EgueygFzYlTKAg0Ud985mSevdNjdXdFBATSKVJGQXP1tv6aGbssLKA==", "dev": true, "dependencies": { - "@babel/helper-module-transforms": "^7.17.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-simple-access": "^7.17.7", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-module-transforms": "^7.24.8", + "@babel/helper-plugin-utils": "^7.24.8", + "@babel/helper-simple-access": "^7.24.7" }, "engines": { "node": ">=6.9.0" @@ -1385,6 +1449,24 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-transform-typescript": { + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.24.8.tgz", + "integrity": "sha512-CgFgtN61BbdOGCP4fLaAMOPkzWUh6yQZNMr5YSt8uz2cZSSiQONCQFWqsE4NeVfOIhqDOlS9CR3WD91FzMeB2Q==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.24.7", + "@babel/helper-create-class-features-plugin": "^7.24.8", + "@babel/helper-plugin-utils": "^7.24.8", + "@babel/plugin-syntax-typescript": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-transform-unicode-escapes": { "version": "7.16.7", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.16.7.tgz", @@ -1520,6 +1602,25 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/preset-typescript": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.24.7.tgz", + "integrity": "sha512-SyXRe3OdWwIwalxDg5UtJnJQO+YPcTfwiIY2B0Xlddh9o7jpWLvv8X1RthIeDOxQ+O1ML5BLPCONToObyVQVuQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7", + "@babel/helper-validator-option": "^7.24.7", + "@babel/plugin-syntax-jsx": "^7.24.7", + "@babel/plugin-transform-modules-commonjs": "^7.24.7", + "@babel/plugin-transform-typescript": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/runtime": { "version": "7.17.9", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.17.9.tgz", @@ -1533,34 +1634,34 @@ } }, "node_modules/@babel/template": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.7.tgz", - "integrity": "sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.7.tgz", + "integrity": "sha512-jYqfPrU9JTF0PmPy1tLYHW4Mp4KlgxJD9l2nP9fD6yT/ICi554DmrWBAEYpIelzjHf1msDP3PxJIRt/nFNfBig==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.16.7", - "@babel/parser": "^7.16.7", - "@babel/types": "^7.16.7" + "@babel/code-frame": "^7.24.7", + "@babel/parser": "^7.24.7", + "@babel/types": "^7.24.7" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.17.9", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.17.9.tgz", - "integrity": "sha512-PQO8sDIJ8SIwipTPiR71kJQCKQYB5NGImbOviK8K+kg5xkNSYXLBupuX9QhatFowrsvo9Hj8WgArg3W7ijNAQw==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.17.9", - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-function-name": "^7.17.9", - "@babel/helper-hoist-variables": "^7.16.7", - "@babel/helper-split-export-declaration": "^7.16.7", - "@babel/parser": "^7.17.9", - "@babel/types": "^7.17.0", - "debug": "^4.1.0", + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.24.8.tgz", + "integrity": "sha512-t0P1xxAPzEDcEPmjprAQq19NWum4K0EQPjMwZQZbHt+GiZqvjCHjj755Weq1YRPVzBI+3zSfvScfpnuIecVFJQ==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.24.7", + "@babel/generator": "^7.24.8", + "@babel/helper-environment-visitor": "^7.24.7", + "@babel/helper-function-name": "^7.24.7", + "@babel/helper-hoist-variables": "^7.24.7", + "@babel/helper-split-export-declaration": "^7.24.7", + "@babel/parser": "^7.24.8", + "@babel/types": "^7.24.8", + "debug": "^4.3.1", "globals": "^11.1.0" }, "engines": { @@ -1568,12 +1669,13 @@ } }, "node_modules/@babel/types": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.17.0.tgz", - "integrity": "sha512-TmKSNO4D5rzhL5bjWFcVHHLETzfQ/AmbKpKPOSjlP0WoHZ6L911fgoOKY4Alp/emzG4cHJdyN49zpgkbXFEHHw==", + "version": "7.24.9", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.9.tgz", + "integrity": "sha512-xm8XrMKz0IlUdocVbYJe0Z9xEgidU7msskG8BbhnTPK/HZ2z/7FP7ykqPgrUH+C+r414mNfNWam1f2vqOjqjYQ==", "dev": true, "dependencies": { - "@babel/helper-validator-identifier": "^7.16.7", + "@babel/helper-string-parser": "^7.24.8", + "@babel/helper-validator-identifier": "^7.24.7", "to-fast-properties": "^2.0.0" }, "engines": { @@ -1603,37 +1705,37 @@ } }, "node_modules/@jridgewell/resolve-uri": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.6.tgz", - "integrity": "sha512-R7xHtBSNm+9SyvpJkdQl+qrM3Hm2fea3Ef197M3mUug+v+yR+Rhfbs7PBtcBUVnIWJ4JcAdjvij+c8hXS9p5aw==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", "dev": true, "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/set-array": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.0.tgz", - "integrity": "sha512-SfJxIxNVYLTsKwzB3MoOQ1yxf4w/E6MdkvTgrgAt1bfxjSrLUoHMKrDOykwN14q65waezZIdqDneUIPh4/sKxg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "dev": true, "engines": { "node": ">=6.0.0" } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.11", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.11.tgz", - "integrity": "sha512-Fg32GrJo61m+VqYSdRSjRXMjQ06j8YIYfcTqndLYVAaHmroZHLJZCydsWBOTDqXS2v+mjxohBWEMfg97GXmYQg==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", "dev": true, "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, "node_modules/@types/eslint": { @@ -1678,6 +1780,12 @@ "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", "dev": true }, + "node_modules/@types/k6": { + "version": "0.52.0", + "resolved": "https://registry.npmjs.org/@types/k6/-/k6-0.52.0.tgz", + "integrity": "sha512-yaw2wg61nKQtToDML+nngzgXVjZ6wNA4R0Q3jKDTeadG5EqfZgis5a1Q2hwY7kjuGuXmu8eM6gHg3tgnOj4vNw==", + "dev": true + }, "node_modules/@types/minimatch": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", @@ -2292,7 +2400,7 @@ "node_modules/color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true }, "node_modules/colorette": { @@ -2486,7 +2594,7 @@ "node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dev": true, "engines": { "node": ">=0.8.0" @@ -2764,7 +2872,7 @@ "node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", "dev": true, "engines": { "node": ">=4" @@ -4025,9 +4133,9 @@ } }, "node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "bin": { "semver": "bin/semver.js" @@ -4109,15 +4217,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/source-map-support": { "version": "0.5.21", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", @@ -4757,12 +4856,13 @@ } }, "@babel/code-frame": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", - "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz", + "integrity": "sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==", "dev": true, "requires": { - "@babel/highlight": "^7.16.7" + "@babel/highlight": "^7.24.7", + "picocolors": "^1.0.0" } }, "@babel/compat-data": { @@ -4795,23 +4895,37 @@ } }, "@babel/generator": { - "version": "7.17.9", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.9.tgz", - "integrity": "sha512-rAdDousTwxbIxbz5I7GEQ3lUip+xVCXooZNbsydCWs3xA7ZsYOv+CFRdzGxRX78BmQHu9B1Eso59AOZQOJDEdQ==", + "version": "7.24.10", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.10.tgz", + "integrity": "sha512-o9HBZL1G2129luEUlG1hB4N/nlYNWHnpwlND9eOMclRqqu1YDy2sSYVCFUZwl8I1Gxh+QSRrP2vD7EpUmFVXxg==", "dev": true, "requires": { - "@babel/types": "^7.17.0", - "jsesc": "^2.5.1", - "source-map": "^0.5.0" + "@babel/types": "^7.24.9", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^2.5.1" + }, + "dependencies": { + "@jridgewell/gen-mapping": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "dev": true, + "requires": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + } + } } }, "@babel/helper-annotate-as-pure": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.16.7.tgz", - "integrity": "sha512-s6t2w/IPQVTAET1HitoowRGXooX8mCgtuP5195wD/QJPV6wYjpujCGF7JuMODVX2ZAJOf1GT6DT9MHEZvLOFSw==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.24.7.tgz", + "integrity": "sha512-BaDeOonYvhdKw+JoMVkAixAAJzG2jVPIwWoKBPdYuY9b452e2rPuI9QPYh3KpofZ3pW2akOmwZLOiOsHMiqRAg==", "dev": true, "requires": { - "@babel/types": "^7.16.7" + "@babel/types": "^7.24.7" } }, "@babel/helper-builder-binary-assignment-operator-visitor": { @@ -4837,18 +4951,20 @@ } }, "@babel/helper-create-class-features-plugin": { - "version": "7.17.9", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.17.9.tgz", - "integrity": "sha512-kUjip3gruz6AJKOq5i3nC6CoCEEF/oHH3cp6tOZhB+IyyyPyW0g1Gfsxn3mkk6S08pIA2y8GQh609v9G/5sHVQ==", + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.24.8.tgz", + "integrity": "sha512-4f6Oqnmyp2PP3olgUMmOwC3akxSm5aBYraQ6YDdKy7NcAMkDECHWG0DEnV6M2UAkERgIBhYt8S27rURPg7SxWA==", "dev": true, "requires": { - "@babel/helper-annotate-as-pure": "^7.16.7", - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-function-name": "^7.17.9", - "@babel/helper-member-expression-to-functions": "^7.17.7", - "@babel/helper-optimise-call-expression": "^7.16.7", - "@babel/helper-replace-supers": "^7.16.7", - "@babel/helper-split-export-declaration": "^7.16.7" + "@babel/helper-annotate-as-pure": "^7.24.7", + "@babel/helper-environment-visitor": "^7.24.7", + "@babel/helper-function-name": "^7.24.7", + "@babel/helper-member-expression-to-functions": "^7.24.8", + "@babel/helper-optimise-call-expression": "^7.24.7", + "@babel/helper-replace-supers": "^7.24.7", + "@babel/helper-skip-transparent-expression-wrappers": "^7.24.7", + "@babel/helper-split-export-declaration": "^7.24.7", + "semver": "^6.3.1" } }, "@babel/helper-create-regexp-features-plugin": { @@ -4878,12 +4994,12 @@ } }, "@babel/helper-environment-visitor": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.7.tgz", - "integrity": "sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.24.7.tgz", + "integrity": "sha512-DoiN84+4Gnd0ncbBOM9AZENV4a5ZiL39HYMyZJGZ/AZEykHYdJw0wW3kdcsh9/Kn+BRXHLkkklZ51ecPKmI1CQ==", "dev": true, "requires": { - "@babel/types": "^7.16.7" + "@babel/types": "^7.24.7" } }, "@babel/helper-explode-assignable-expression": { @@ -4896,71 +5012,70 @@ } }, "@babel/helper-function-name": { - "version": "7.17.9", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.17.9.tgz", - "integrity": "sha512-7cRisGlVtiVqZ0MW0/yFB4atgpGLWEHUVYnb448hZK4x+vih0YO5UoS11XIYtZYqHd0dIPMdUSv8q5K4LdMnIg==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.24.7.tgz", + "integrity": "sha512-FyoJTsj/PEUWu1/TYRiXTIHc8lbw+TDYkZuoE43opPS5TrI7MyONBE1oNvfguEXAD9yhQRrVBnXdXzSLQl9XnA==", "dev": true, "requires": { - "@babel/template": "^7.16.7", - "@babel/types": "^7.17.0" + "@babel/template": "^7.24.7", + "@babel/types": "^7.24.7" } }, "@babel/helper-hoist-variables": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz", - "integrity": "sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.24.7.tgz", + "integrity": "sha512-MJJwhkoGy5c4ehfoRyrJ/owKeMl19U54h27YYftT0o2teQ3FJ3nQUf/I3LlJsX4l3qlw7WRXUmiyajvHXoTubQ==", "dev": true, "requires": { - "@babel/types": "^7.16.7" + "@babel/types": "^7.24.7" } }, "@babel/helper-member-expression-to-functions": { - "version": "7.17.7", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.17.7.tgz", - "integrity": "sha512-thxXgnQ8qQ11W2wVUObIqDL4p148VMxkt5T/qpN5k2fboRyzFGFmKsTGViquyM5QHKUy48OZoca8kw4ajaDPyw==", + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.24.8.tgz", + "integrity": "sha512-LABppdt+Lp/RlBxqrh4qgf1oEH/WxdzQNDJIu5gC/W1GyvPVrOBiItmmM8wan2fm4oYqFuFfkXmlGpLQhPY8CA==", "dev": true, "requires": { - "@babel/types": "^7.17.0" + "@babel/traverse": "^7.24.8", + "@babel/types": "^7.24.8" } }, "@babel/helper-module-imports": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz", - "integrity": "sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.24.7.tgz", + "integrity": "sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA==", "dev": true, "requires": { - "@babel/types": "^7.16.7" + "@babel/traverse": "^7.24.7", + "@babel/types": "^7.24.7" } }, "@babel/helper-module-transforms": { - "version": "7.17.7", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.17.7.tgz", - "integrity": "sha512-VmZD99F3gNTYB7fJRDTi+u6l/zxY0BE6OIxPSU7a50s6ZUQkHwSDmV92FfM+oCG0pZRVojGYhkR8I0OGeCVREw==", + "version": "7.24.9", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.24.9.tgz", + "integrity": "sha512-oYbh+rtFKj/HwBQkFlUzvcybzklmVdVV3UU+mN7n2t/q3yGHbuVdNxyFvSBO1tfvjyArpHNcWMAzsSPdyI46hw==", "dev": true, "requires": { - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-module-imports": "^7.16.7", - "@babel/helper-simple-access": "^7.17.7", - "@babel/helper-split-export-declaration": "^7.16.7", - "@babel/helper-validator-identifier": "^7.16.7", - "@babel/template": "^7.16.7", - "@babel/traverse": "^7.17.3", - "@babel/types": "^7.17.0" + "@babel/helper-environment-visitor": "^7.24.7", + "@babel/helper-module-imports": "^7.24.7", + "@babel/helper-simple-access": "^7.24.7", + "@babel/helper-split-export-declaration": "^7.24.7", + "@babel/helper-validator-identifier": "^7.24.7" } }, "@babel/helper-optimise-call-expression": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.16.7.tgz", - "integrity": "sha512-EtgBhg7rd/JcnpZFXpBy0ze1YRfdm7BnBX4uKMBd3ixa3RGAE002JZB66FJyNH7g0F38U05pXmA5P8cBh7z+1w==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.24.7.tgz", + "integrity": "sha512-jKiTsW2xmWwxT1ixIdfXUZp+P5yURx2suzLZr5Hi64rURpDYdMW0pv+Uf17EYk2Rd428Lx4tLsnjGJzYKDM/6A==", "dev": true, "requires": { - "@babel/types": "^7.16.7" + "@babel/types": "^7.24.7" } }, "@babel/helper-plugin-utils": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.7.tgz", - "integrity": "sha512-Qg3Nk7ZxpgMrsox6HreY1ZNKdBq7K72tDSliA6dCl5f007jR4ne8iD5UzuNnCJH2xBf2BEEVGr+/OL6Gdp7RxA==", + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.8.tgz", + "integrity": "sha512-FFWx5142D8h2Mgr/iPVGH5G7w6jDn4jUSpZTyDnQO0Yn7Ks2Kuz6Pci8H6MPCoUJegd/UZQ3tAvfLCxQSnWWwg==", "dev": true }, "@babel/helper-remap-async-to-generator": { @@ -4975,55 +5090,61 @@ } }, "@babel/helper-replace-supers": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.16.7.tgz", - "integrity": "sha512-y9vsWilTNaVnVh6xiJfABzsNpgDPKev9HnAgz6Gb1p6UUwf9NepdlsV7VXGCftJM+jqD5f7JIEubcpLjZj5dBw==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.24.7.tgz", + "integrity": "sha512-qTAxxBM81VEyoAY0TtLrx1oAEJc09ZK67Q9ljQToqCnA+55eNwCORaxlKyu+rNfX86o8OXRUSNUnrtsAZXM9sg==", "dev": true, "requires": { - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-member-expression-to-functions": "^7.16.7", - "@babel/helper-optimise-call-expression": "^7.16.7", - "@babel/traverse": "^7.16.7", - "@babel/types": "^7.16.7" + "@babel/helper-environment-visitor": "^7.24.7", + "@babel/helper-member-expression-to-functions": "^7.24.7", + "@babel/helper-optimise-call-expression": "^7.24.7" } }, "@babel/helper-simple-access": { - "version": "7.17.7", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.17.7.tgz", - "integrity": "sha512-txyMCGroZ96i+Pxr3Je3lzEJjqwaRC9buMUgtomcrLe5Nd0+fk1h0LLA+ixUF5OW7AhHuQ7Es1WcQJZmZsz2XA==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.24.7.tgz", + "integrity": "sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg==", "dev": true, "requires": { - "@babel/types": "^7.17.0" + "@babel/traverse": "^7.24.7", + "@babel/types": "^7.24.7" } }, "@babel/helper-skip-transparent-expression-wrappers": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.16.0.tgz", - "integrity": "sha512-+il1gTy0oHwUsBQZyJvukbB4vPMdcYBrFHa0Uc4AizLxbq6BOYC51Rv4tWocX9BLBDLZ4kc6qUFpQ6HRgL+3zw==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.24.7.tgz", + "integrity": "sha512-IO+DLT3LQUElMbpzlatRASEyQtfhSE0+m465v++3jyyXeBTBUjtVZg28/gHeV5mrTJqvEKhKroBGAvhW+qPHiQ==", "dev": true, "requires": { - "@babel/types": "^7.16.0" + "@babel/traverse": "^7.24.7", + "@babel/types": "^7.24.7" } }, "@babel/helper-split-export-declaration": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz", - "integrity": "sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.24.7.tgz", + "integrity": "sha512-oy5V7pD+UvfkEATUKvIjvIAH/xCzfsFVw7ygW2SI6NClZzquT+mwdTfgfdbUiceh6iQO0CHtCPsyze/MZ2YbAA==", "dev": true, "requires": { - "@babel/types": "^7.16.7" + "@babel/types": "^7.24.7" } }, + "@babel/helper-string-parser": { + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.24.8.tgz", + "integrity": "sha512-pO9KhhRcuUyGnJWwyEgnRJTSIZHiT+vMD0kPeD+so0l7mxkMT19g3pjY9GTnHySck/hDzq+dtW/4VgnMkippsQ==", + "dev": true + }, "@babel/helper-validator-identifier": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", - "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz", + "integrity": "sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w==", "dev": true }, "@babel/helper-validator-option": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz", - "integrity": "sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ==", + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.24.8.tgz", + "integrity": "sha512-xb8t9tD1MHLungh/AIoWYN+gVHaB9kwlu8gffXGSt3FFEIT7RjS+xWbc2vUD1UTZdIpKj/ab3rdqJ7ufngyi2Q==", "dev": true }, "@babel/helper-wrap-function": { @@ -5050,20 +5171,21 @@ } }, "@babel/highlight": { - "version": "7.17.9", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.17.9.tgz", - "integrity": "sha512-J9PfEKCbFIv2X5bjTMiZu6Vf341N05QIY+d6FvVKynkG1S7G0j3I0QoRtWIrXhZ+/Nlb5Q0MzqL7TokEJ5BNHg==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz", + "integrity": "sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.16.7", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" + "@babel/helper-validator-identifier": "^7.24.7", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" } }, "@babel/parser": { - "version": "7.17.9", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.17.9.tgz", - "integrity": "sha512-vqUSBLP8dQHFPdPi9bc5GK9vRkYHJ49fsZdtoJ8EQ8ibpwk5rPKfvNIwChB0KVXcIjcepEBBd2VHC5r9Gy8ueg==", + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.8.tgz", + "integrity": "sha512-WzfbgXOkGzZiXXCqk43kKwZjzwx4oulxZi3nq2TYL9mOjQv6kYwul9mz6ID36njuL7Xkp6nJEfok848Zj10j/w==", "dev": true }, "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { @@ -5298,6 +5420,15 @@ "@babel/helper-plugin-utils": "^7.8.0" } }, + "@babel/plugin-syntax-jsx": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.24.7.tgz", + "integrity": "sha512-6ddciUPe/mpMnOKv/U+RSd2vvVy+Yw/JfBB0ZHYjEZt9NLHmCUylNYlsbqCCS1Bffjlb0fCwC9Vqz+sBz6PsiQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.24.7" + } + }, "@babel/plugin-syntax-logical-assignment-operators": { "version": "7.10.4", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", @@ -5370,6 +5501,15 @@ "@babel/helper-plugin-utils": "^7.14.5" } }, + "@babel/plugin-syntax-typescript": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.24.7.tgz", + "integrity": "sha512-c/+fVeJBB0FeKsFvwytYiUD+LBvhHjGSI0g446PRGdSVGZLRNArBUno2PETbAly3tpiNAQR5XaZ+JslxkotsbA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.24.7" + } + }, "@babel/plugin-transform-arrow-functions": { "version": "7.16.7", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.16.7.tgz", @@ -5521,15 +5661,14 @@ } }, "@babel/plugin-transform-modules-commonjs": { - "version": "7.17.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.17.9.tgz", - "integrity": "sha512-2TBFd/r2I6VlYn0YRTz2JdazS+FoUuQ2rIFHoAxtyP/0G3D82SBLaRq9rnUkpqlLg03Byfl/+M32mpxjO6KaPw==", + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.24.8.tgz", + "integrity": "sha512-WHsk9H8XxRs3JXKWFiqtQebdh9b/pTk4EgueygFzYlTKAg0Ud985mSevdNjdXdFBATSKVJGQXP1tv6aGbssLKA==", "dev": true, "requires": { - "@babel/helper-module-transforms": "^7.17.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-simple-access": "^7.17.7", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-module-transforms": "^7.24.8", + "@babel/helper-plugin-utils": "^7.24.8", + "@babel/helper-simple-access": "^7.24.7" } }, "@babel/plugin-transform-modules-systemjs": { @@ -5665,6 +5804,18 @@ "@babel/helper-plugin-utils": "^7.16.7" } }, + "@babel/plugin-transform-typescript": { + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.24.8.tgz", + "integrity": "sha512-CgFgtN61BbdOGCP4fLaAMOPkzWUh6yQZNMr5YSt8uz2cZSSiQONCQFWqsE4NeVfOIhqDOlS9CR3WD91FzMeB2Q==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.24.7", + "@babel/helper-create-class-features-plugin": "^7.24.8", + "@babel/helper-plugin-utils": "^7.24.8", + "@babel/plugin-syntax-typescript": "^7.24.7" + } + }, "@babel/plugin-transform-unicode-escapes": { "version": "7.16.7", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.16.7.tgz", @@ -5779,6 +5930,19 @@ "esutils": "^2.0.2" } }, + "@babel/preset-typescript": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.24.7.tgz", + "integrity": "sha512-SyXRe3OdWwIwalxDg5UtJnJQO+YPcTfwiIY2B0Xlddh9o7jpWLvv8X1RthIeDOxQ+O1ML5BLPCONToObyVQVuQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.24.7", + "@babel/helper-validator-option": "^7.24.7", + "@babel/plugin-syntax-jsx": "^7.24.7", + "@babel/plugin-transform-modules-commonjs": "^7.24.7", + "@babel/plugin-transform-typescript": "^7.24.7" + } + }, "@babel/runtime": { "version": "7.17.9", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.17.9.tgz", @@ -5789,41 +5953,42 @@ } }, "@babel/template": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.7.tgz", - "integrity": "sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w==", + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.7.tgz", + "integrity": "sha512-jYqfPrU9JTF0PmPy1tLYHW4Mp4KlgxJD9l2nP9fD6yT/ICi554DmrWBAEYpIelzjHf1msDP3PxJIRt/nFNfBig==", "dev": true, "requires": { - "@babel/code-frame": "^7.16.7", - "@babel/parser": "^7.16.7", - "@babel/types": "^7.16.7" + "@babel/code-frame": "^7.24.7", + "@babel/parser": "^7.24.7", + "@babel/types": "^7.24.7" } }, "@babel/traverse": { - "version": "7.17.9", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.17.9.tgz", - "integrity": "sha512-PQO8sDIJ8SIwipTPiR71kJQCKQYB5NGImbOviK8K+kg5xkNSYXLBupuX9QhatFowrsvo9Hj8WgArg3W7ijNAQw==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.17.9", - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-function-name": "^7.17.9", - "@babel/helper-hoist-variables": "^7.16.7", - "@babel/helper-split-export-declaration": "^7.16.7", - "@babel/parser": "^7.17.9", - "@babel/types": "^7.17.0", - "debug": "^4.1.0", + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.24.8.tgz", + "integrity": "sha512-t0P1xxAPzEDcEPmjprAQq19NWum4K0EQPjMwZQZbHt+GiZqvjCHjj755Weq1YRPVzBI+3zSfvScfpnuIecVFJQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.24.7", + "@babel/generator": "^7.24.8", + "@babel/helper-environment-visitor": "^7.24.7", + "@babel/helper-function-name": "^7.24.7", + "@babel/helper-hoist-variables": "^7.24.7", + "@babel/helper-split-export-declaration": "^7.24.7", + "@babel/parser": "^7.24.8", + "@babel/types": "^7.24.8", + "debug": "^4.3.1", "globals": "^11.1.0" } }, "@babel/types": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.17.0.tgz", - "integrity": "sha512-TmKSNO4D5rzhL5bjWFcVHHLETzfQ/AmbKpKPOSjlP0WoHZ6L911fgoOKY4Alp/emzG4cHJdyN49zpgkbXFEHHw==", + "version": "7.24.9", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.9.tgz", + "integrity": "sha512-xm8XrMKz0IlUdocVbYJe0Z9xEgidU7msskG8BbhnTPK/HZ2z/7FP7ykqPgrUH+C+r414mNfNWam1f2vqOjqjYQ==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.16.7", + "@babel/helper-string-parser": "^7.24.8", + "@babel/helper-validator-identifier": "^7.24.7", "to-fast-properties": "^2.0.0" } }, @@ -5844,31 +6009,31 @@ } }, "@jridgewell/resolve-uri": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.6.tgz", - "integrity": "sha512-R7xHtBSNm+9SyvpJkdQl+qrM3Hm2fea3Ef197M3mUug+v+yR+Rhfbs7PBtcBUVnIWJ4JcAdjvij+c8hXS9p5aw==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", "dev": true }, "@jridgewell/set-array": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.0.tgz", - "integrity": "sha512-SfJxIxNVYLTsKwzB3MoOQ1yxf4w/E6MdkvTgrgAt1bfxjSrLUoHMKrDOykwN14q65waezZIdqDneUIPh4/sKxg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "dev": true }, "@jridgewell/sourcemap-codec": { - "version": "1.4.11", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.11.tgz", - "integrity": "sha512-Fg32GrJo61m+VqYSdRSjRXMjQ06j8YIYfcTqndLYVAaHmroZHLJZCydsWBOTDqXS2v+mjxohBWEMfg97GXmYQg==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", "dev": true }, "@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", "dev": true, "requires": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, "@types/eslint": { @@ -5913,6 +6078,12 @@ "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", "dev": true }, + "@types/k6": { + "version": "0.52.0", + "resolved": "https://registry.npmjs.org/@types/k6/-/k6-0.52.0.tgz", + "integrity": "sha512-yaw2wg61nKQtToDML+nngzgXVjZ6wNA4R0Q3jKDTeadG5EqfZgis5a1Q2hwY7kjuGuXmu8eM6gHg3tgnOj4vNw==", + "dev": true + }, "@types/minimatch": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", @@ -6395,7 +6566,7 @@ "color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true }, "colorette": { @@ -6549,7 +6720,7 @@ "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dev": true }, "eslint-scope": { @@ -6762,7 +6933,7 @@ "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", "dev": true }, "has-property-descriptors": { @@ -7673,9 +7844,9 @@ } }, "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true }, "serialize-javascript": { @@ -7735,12 +7906,6 @@ } } }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - }, "source-map-support": { "version": "0.5.21", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", diff --git a/package.json b/package.json index d1a0c63..040ee61 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,8 @@ "@babel/core": "^7.4.4", "@babel/plugin-transform-block-scoping": "^7.14.1", "@babel/preset-env": "^7.4.4", + "@babel/preset-typescript": "^7.24.7", + "@types/k6": "^0.52.0", "@types/webpack": "^5.28.0", "babel-loader": "^8.0.6", "clean-webpack-plugin": "^4.0.0", @@ -21,7 +23,7 @@ "engines": {}, "scripts": { "webpack": "webpack", - "test": "./k6 run tests/", + "test": "k6 run --compatibility-mode=experimental_enhanced tests/", "prepare": "husky install" }, "keywords": [ diff --git a/src/check.ts b/src/check.ts new file mode 100644 index 0000000..9fadded --- /dev/null +++ b/src/check.ts @@ -0,0 +1,66 @@ +import { Rate } from 'k6/metrics' + +type FalsyCheckValue = + | Array + | Record + | boolean + | string + | number + | null + | undefined + +type Checker = + | ((value: T) => FalsyCheckValue) + | ((value: T) => Promise) + | FalsyCheckValue + | Promise + +interface CheckMap { + [key: string]: Checker +} + +interface SyncCheckMap { + [key: string]: ((value: any) => FalsyCheckValue) | FalsyCheckValue +} + +type CheckResult> = C extends SyncCheckMap ? boolean : Promise + +const checkRate = new Rate('checks') + +export function check>(checkers: C): CheckResult +export function check>(value: T, checkers: C): CheckResult +export function check>(value: T | C, checkers?: C): CheckResult { + const checkMap = checkers || (value as C) + + const results = Object.entries(checkMap).map(([key, checker]) => { + function reportResult(value: FalsyCheckValue): FalsyCheckValue { + checkRate.add(value ? 1 : 0, { + check: key, + }) + + return value + } + + if (typeof checker === 'function') { + const result = checker(value as T) + + if (result instanceof Promise) { + return result.then(reportResult) + } + + return reportResult(result) + } + + if (checker instanceof Promise) { + return checker.then(reportResult) + } + + return reportResult(checker) + }) + + if (results.some((result) => result instanceof Promise)) { + return Promise.all(results).then((results) => results.every(Boolean)) as CheckResult + } + + return results.every(Boolean) as CheckResult +} diff --git a/src/index.js b/src/index.js index a502521..c2f3ae0 100644 --- a/src/index.js +++ b/src/index.js @@ -14,7 +14,10 @@ import { uuidv4, } from './utils.js' +import { check } from './check.ts' + export { + check, parseDuration, getCurrentStageIndex, tagWithCurrentStageIndex, diff --git a/tests/check.ts b/tests/check.ts new file mode 100644 index 0000000..1e5d520 --- /dev/null +++ b/tests/check.ts @@ -0,0 +1,97 @@ +import { check } from 'k6' +import { check as asyncCheck } from '../src/check.ts' + +export const options = { + iterations: 1, +} + +function later(value: () => T, delay = 100) { + return new Promise(resolve => { + setTimeout(() => { + resolve(value()) + }, delay) + }) +} + +export default async function () { + const syncFnFailed = asyncCheck({ + "I should always fail": () => false, + }) satisfies boolean + + const syncFnPassed = asyncCheck({ + "I should always pass": () => true, + }) satisfies boolean + + const asyncFnFailedPromise = asyncCheck({ + "I should always fail": () => later(() => false), + }) satisfies Promise + + const asyncFnPassedPromise = asyncCheck({ + "I should always pass": () => later(() => true), + }) satisfies Promise + + const asyncFnFailed = await asyncFnFailedPromise + const asyncFnPassed = await asyncFnPassedPromise + + const syncValueFailed = asyncCheck({ + "I should always fail": 0, + }) satisfies boolean + + const syncValuePassed = asyncCheck({ + "I should always pass": 1, + }) satisfies boolean + + const asyncValueFailedPromise = asyncCheck({ + "I should always fail": later(() => 0), + }) satisfies Promise + + const asyncValuePassedPromise = asyncCheck({ + "I should always pass": later(() => 1), + }) satisfies Promise + + const asyncValueFailed = await asyncValueFailedPromise + const asyncValuePassed = await asyncValuePassedPromise + + const passesValueToChecker = asyncCheck("this is the value", { + a: (value: string) => value === "this is the value", + }) satisfies boolean + + let executedAsync = true + + asyncCheck({ + "I should always pass": later(() => { + executedAsync = false + + return true + }, 1000), + }) + + const failsIfAnyFail = await asyncCheck({ + "I should always fail": () => later(() => false), + "I should always pass": later(() => true), + "I should also always fail": () => null, + "I should also always pass": 1, + }) + + const passIfAllPass = await asyncCheck({ + "I should always pass": () => later(() => true), + "I should also always pass": later(() => true), + "This should pass too": () => "null", + "And this should pass": 1 + }) + + check(0, { + "Function: sync check failed": () => syncFnFailed === false, + "Function: sync check passed": () => syncFnPassed === true, + "Function: async check failed": () => asyncFnFailed === false, + "Function: async check succeeded": () => asyncFnPassed === true, + "Value: sync check failed": () => syncValueFailed === false, + "Value: sync check passed": () => syncValuePassed === true, + "Value: async check failed": () => asyncValueFailed === false, + "Value: async check passed": () => asyncValuePassed === true, + "Passes value to checker": () => passesValueToChecker === true, + "Executes check asynchronously": () => executedAsync === true, + "Fail if any check fails": () => failsIfAnyFail === false, + "Pass if all checks pass": () => passIfAllPass === true, + }) +} diff --git a/webpack.config.js b/webpack.config.js index d740f9b..869c091 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,6 +2,9 @@ const path = require('path'); const TerserPlugin = require("terser-webpack-plugin"); const { CleanWebpackPlugin } = require('clean-webpack-plugin') +/** + * @type {import("webpack").Configuration} + */ module.exports = { mode: 'production', entry: { @@ -15,15 +18,18 @@ module.exports = { module: { rules: [ { - test: /\.js$/, + test: /\.(j|t)s$/, loader: 'babel-loader', exclude: /node_modules/, - }, + }, ], }, stats: { colors: true, }, + externals: [ + "k6/metrics" + ], target: 'web', externals: /^(k6|https?\:\/\/)(\/.*)?/, devtool: 'source-map', From 099c612a921a6a1d6ca296a4576f7832c0daf5aa Mon Sep 17 00:00:00 2001 From: Johan Suleiko Allansson Date: Wed, 24 Jul 2024 14:15:54 +0200 Subject: [PATCH 2/8] test checks using the build output --- build/check.d.ts | 12 +++ build/index.d.ts | 12 +++ build/index.js | 2 +- build/index.js.map | 2 +- build/stages.d.ts | 4 + build/utils.d.ts | 15 ++++ package-lock.json | 209 +++++++++++++++++++++++++++++++++++++++++++++ package.json | 4 +- tests/check.ts | 2 +- tsconfig.json | 15 ++++ webpack.config.js | 9 +- 11 files changed, 279 insertions(+), 7 deletions(-) create mode 100644 build/check.d.ts create mode 100644 build/index.d.ts create mode 100644 build/stages.d.ts create mode 100644 build/utils.d.ts create mode 100644 tsconfig.json diff --git a/build/check.d.ts b/build/check.d.ts new file mode 100644 index 0000000..622e800 --- /dev/null +++ b/build/check.d.ts @@ -0,0 +1,12 @@ +type FalsyCheckValue = Array | Record | boolean | string | number | null | undefined; +type Checker = ((value: T) => FalsyCheckValue) | ((value: T) => Promise) | FalsyCheckValue | Promise; +interface CheckMap { + [key: string]: Checker; +} +interface SyncCheckMap { + [key: string]: ((value: any) => FalsyCheckValue) | FalsyCheckValue; +} +type CheckResult> = C extends SyncCheckMap ? boolean : Promise; +export declare function check>(checkers: C): CheckResult; +export declare function check>(value: T, checkers: C): CheckResult; +export {}; diff --git a/build/index.d.ts b/build/index.d.ts new file mode 100644 index 0000000..ab6acc1 --- /dev/null +++ b/build/index.d.ts @@ -0,0 +1,12 @@ +import { check } from './check.ts'; +import { parseDuration } from './stages.js'; +import { getCurrentStageIndex } from './stages.js'; +import { tagWithCurrentStageIndex } from './stages.js'; +import { tagWithCurrentStageProfile } from './stages.js'; +import { findBetween } from './utils.js'; +import { normalDistributionStages } from './utils.js'; +import { randomIntBetween } from './utils.js'; +import { randomItem } from './utils.js'; +import { randomString } from './utils.js'; +import { uuidv4 } from './utils.js'; +export { check, parseDuration, getCurrentStageIndex, tagWithCurrentStageIndex, tagWithCurrentStageProfile, findBetween, normalDistributionStages, randomIntBetween, randomItem, randomString, uuidv4 }; diff --git a/build/index.js b/build/index.js index 51983c1..09b1218 100644 --- a/build/index.js +++ b/build/index.js @@ -1,2 +1,2 @@ -(()=>{"use strict";var r={n:t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},d:(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o:(r,t)=>Object.prototype.hasOwnProperty.call(r,t),r:r=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})}},t={};r.r(t),r.d(t,{check:()=>S,findBetween:()=>p,getCurrentStageIndex:()=>i,normalDistributionStages:()=>y,parseDuration:()=>o,randomIntBetween:()=>g,randomItem:()=>d,randomString:()=>m,tagWithCurrentStageIndex:()=>u,tagWithCurrentStageProfile:()=>s,uuidv4:()=>h});const e=require("k6/execution");var n=r.n(e);function o(r){if(null==r||r.length<1)throw new Error("str is empty");for(var t=0,e="",n={},o=0;o0&&(t+=parseFloat(e,10)),t}function a(r){return r>="0"&&r<="9"}function i(){var r=n().test.options.scenarios[n().scenario.name];if(null==r)throw new Error("the exec.test.options object doesn't contain the current scenario ".concat(n().scenario.name));if(null==r.stages)throw new Error("only ramping-vus or ramping-arravial-rate supports stages, it is not possible to get a stage index on other executors.");if(r.stages.length<1)throw new Error("the current scenario ".concat(r.name," doesn't contain any stage"));for(var t=0,e=new Date-n().scenario.startTime,a=0;ao.target?"ramp-up":o.target==e.target?"steady":"ramp-down"}()}const c=require("k6/crypto");function l(r){return function(r){if(Array.isArray(r))return f(r)}(r)||function(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}(r)||function(r,t){if(!r)return;if("string"==typeof r)return f(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);"Object"===e&&r.constructor&&(e=r.constructor.name);if("Map"===e||"Set"===e)return Array.from(r);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return f(r,t)}(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e0&&void 0!==arguments[0]&&arguments[0];return r?x():v()}function g(r,t){return Math.floor(Math.random()*(t-r+1)+r)}function d(r){return r[Math.floor(Math.random()*r.length)]}function m(r){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"abcdefghijklmnopqrstuvwxyz",e="";r--;)e+=t[Math.random()*t.length|0];return e}function p(r,t,e){for(var n,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=[],i=!0,u=0;i&&-1!=(n=r.indexOf(t))&&(n+=t.length,-1!=(u=r.indexOf(e,n)));){var s=r.substring(n,u);if(!o)return s;a.push(s),r=r.substring(u+e.length)}return a.length?a:null}function y(r,t){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;function n(r,t,e){return Math.exp(-.5*Math.pow((e-r)/t,2))/(t*Math.sqrt(2*Math.PI))}for(var o=0,a=1,i=new Array(e+2).fill(0),u=new Array(e+2).fill(Math.ceil(t/6)),s=[],c=0;c<=e;c++)i[c]=n(o,a,-2*a+4*a*c/e);for(var f=Math.max.apply(Math,l(i)),h=i.map((function(t){return Math.round(t*r/f)})),g=1;g<=e;g++)u[g]=Math.ceil(4*t/(6*e));for(var d=0;d<=e+1;d++)s.push({duration:"".concat(u[d],"s"),target:h[d]});return s}function v(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(r){var t=16*Math.random()|0;return("x"===r?t:3&t|8).toString(16)}))}function x(){for(var r=[],t=0;t<256;++t)r.push((t+256).toString(16).slice(1));var e=new Uint8Array((0,c.randomBytes)(16));return e[6]=15&e[6]|64,e[8]=63&e[8]|128,(r[e[0]]+r[e[1]]+r[e[2]]+r[e[3]]+"-"+r[e[4]]+r[e[5]]+"-"+r[e[6]]+r[e[7]]+"-"+r[e[8]]+r[e[9]]+"-"+r[e[10]]+r[e[11]]+r[e[12]]+r[e[13]]+r[e[14]]+r[e[15]]).toLowerCase()}function b(r,t){return function(r){if(Array.isArray(r))return r}(r)||function(r,t){var e=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null==e)return;var n,o,a=[],i=!0,u=!1;try{for(e=e.call(r);!(i=(n=e.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(r){u=!0,o=r}finally{try{i||null==e.return||e.return()}finally{if(u)throw o}}return a}(r,t)||function(r,t){if(!r)return;if("string"==typeof r)return w(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);"Object"===e&&r.constructor&&(e=r.constructor.name);if("Map"===e||"Set"===e)return Array.from(r);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return w(r,t)}(r,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e{"use strict";var e={184:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.check=function(e,t){var r=t||e,a=Object.entries(r).map((function(t){var r=t[0],a=t[1];function o(e){return n.add(e?1:0,{check:r}),e}if("function"==typeof a){var i=a(e);return i instanceof Promise?i.then(o):o(i)}return a instanceof Promise?a.then(o):o(a)}));if(a.some((function(e){return e instanceof Promise})))return Promise.all(a).then((function(e){return e.every(Boolean)}));return a.every(Boolean)};var n=new(r(610).Rate)("checks")},664:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.parseDuration=o,t.getCurrentStageIndex=u,t.tagWithCurrentStageIndex=function(){a.default.vu.tags.stage=u()},t.tagWithCurrentStageProfile=function(){a.default.vu.tags.stage_profile=function(){var e=u();if(e<1)return"ramp-up";var t=a.default.test.options.scenarios[a.default.scenario.name].stages,r=t[e],n=t[e-1];return r.target>n.target?"ramp-up":n.target==r.target?"steady":"ramp-down"}()};var a=n(r(744));function o(e){if(null==e||e.length<1)throw new Error("str is empty");for(var t=0,r="",n={},a=0;a0&&(t+=parseFloat(r,10)),t}function i(e){return e>="0"&&e<="9"}function u(){var e=a.default.test.options.scenarios[a.default.scenario.name];if(null==e)throw new Error("the exec.test.options object doesn't contain the current scenario ".concat(a.default.scenario.name));if(null==e.stages)throw new Error("only ramping-vus or ramping-arravial-rate supports stages, it is not possible to get a stage index on other executors.");if(e.stages.length<1)throw new Error("the current scenario ".concat(e.name," doesn't contain any stage"));for(var t=0,r=new Date-a.default.scenario.startTime,n=0;n{Object.defineProperty(t,"__esModule",{value:!0}),t.uuidv4=function(e){void 0===e&&(e=!1);return e?function(){for(var e=[],t=0;t<256;++t)e.push((t+256).toString(16).slice(1));var r=new Uint8Array((0,n.randomBytes)(16));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,(e[r[0]]+e[r[1]]+e[r[2]]+e[r[3]]+"-"+e[r[4]]+e[r[5]]+"-"+e[r[6]]+e[r[7]]+"-"+e[r[8]]+e[r[9]]+"-"+e[r[10]]+e[r[11]]+e[r[12]]+e[r[13]]+e[r[14]]+e[r[15]]).toLowerCase()}():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},t.randomIntBetween=function(e,t){return Math.floor(Math.random()*(t-e+1)+e)},t.randomItem=function(e){return e[Math.floor(Math.random()*e.length)]},t.randomString=function(e,t){void 0===t&&(t="abcdefghijklmnopqrstuvwxyz");var r="";for(;e--;)r+=t[Math.random()*t.length|0];return r},t.findBetween=function(e,t,r,n){void 0===n&&(n=!1);var a,o=[],i=0;for(;-1!=(a=e.indexOf(t))&&(a+=t.length,-1!=(i=e.indexOf(r,a)));){var u=e.substring(a,i);if(!n)return u;o.push(u),e=e.substring(i+r.length)}return o.length?o:null},t.normalDistributionStages=function(e,t,r){void 0===r&&(r=10);function n(e,t,r){return Math.exp(-.5*Math.pow((r-e)/t,2))/(t*Math.sqrt(2*Math.PI))}for(var a=new Array(r+2).fill(0),o=new Array(r+2).fill(Math.ceil(t/6)),i=[],u=0;u<=r;u++)a[u]=n(0,1,4*u/r-2);for(var s=Math.max.apply(Math,a),c=a.map((function(t){return Math.round(t*e/s)})),f=1;f<=r;f++)o[f]=Math.ceil(4*t/(6*r));for(var l=0;l<=r+1;l++)i.push({duration:"".concat(o[l],"s"),target:c[l]});return i};var n=r(400)},400:e=>{e.exports=require("k6/crypto")},744:e=>{e.exports=require("k6/execution")},610:e=>{e.exports=require("k6/metrics")}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}var n={};(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.uuidv4=e.randomString=e.randomItem=e.randomIntBetween=e.normalDistributionStages=e.findBetween=e.tagWithCurrentStageProfile=e.tagWithCurrentStageIndex=e.getCurrentStageIndex=e.parseDuration=e.check=void 0;var t=r(664);Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return t.parseDuration}}),Object.defineProperty(e,"getCurrentStageIndex",{enumerable:!0,get:function(){return t.getCurrentStageIndex}}),Object.defineProperty(e,"tagWithCurrentStageIndex",{enumerable:!0,get:function(){return t.tagWithCurrentStageIndex}}),Object.defineProperty(e,"tagWithCurrentStageProfile",{enumerable:!0,get:function(){return t.tagWithCurrentStageProfile}});var a=r(599);Object.defineProperty(e,"findBetween",{enumerable:!0,get:function(){return a.findBetween}}),Object.defineProperty(e,"normalDistributionStages",{enumerable:!0,get:function(){return a.normalDistributionStages}}),Object.defineProperty(e,"randomIntBetween",{enumerable:!0,get:function(){return a.randomIntBetween}}),Object.defineProperty(e,"randomItem",{enumerable:!0,get:function(){return a.randomItem}}),Object.defineProperty(e,"randomString",{enumerable:!0,get:function(){return a.randomString}}),Object.defineProperty(e,"uuidv4",{enumerable:!0,get:function(){return a.uuidv4}});var o=r(184);Object.defineProperty(e,"check",{enumerable:!0,get:function(){return o.check}})})();var a=exports;for(var o in n)a[o]=n[o];n.__esModule&&Object.defineProperty(a,"__esModule",{value:!0})})(); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/build/index.js.map b/build/index.js.map index a79fb4f..a90fbd8 100644 --- a/build/index.js.map +++ b/build/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","mappings":"mBACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,GCLRF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3ER,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,M,yQCLvD,MAAM,EAA+BC,QAAQ,gB,aCI7C,SAASC,EAAcC,GACnB,GAAW,MAAPA,GAAeA,EAAIC,OAAS,EAC5B,MAAM,IAAIC,MAAM,gBAcpB,IAVA,IAAItB,EAAI,EAIJuB,EAAU,GAIVC,EAAO,GAEFC,EAAI,EAAGA,EAAIL,EAAIC,OAAQI,IAO5B,IALIC,EAASN,EAAIK,KAAiB,KAAVL,EAAIK,MACxBF,GAAWH,EAAIK,IAID,MAAdL,EAAIK,EAAI,K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WACpCA,QAAQG,IAAIZ,GAASU,MAAK,SAACV,GAAO,OAAKA,EAAQa,MAAMC,YAGzDd,EAAQa,MAAMC,S","sources":["webpack://k6-jslib-utils/webpack/bootstrap","webpack://k6-jslib-utils/webpack/runtime/compat get default export","webpack://k6-jslib-utils/webpack/runtime/define property getters","webpack://k6-jslib-utils/webpack/runtime/hasOwnProperty shorthand","webpack://k6-jslib-utils/webpack/runtime/make namespace object","webpack://k6-jslib-utils/external commonjs \"k6/execution\"","webpack://k6-jslib-utils/./src/stages.js","webpack://k6-jslib-utils/external commonjs \"k6/crypto\"","webpack://k6-jslib-utils/./src/utils.js","webpack://k6-jslib-utils/./src/check.ts","webpack://k6-jslib-utils/external commonjs \"k6/metrics\""],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/execution\");","import exec from 'k6/execution'\n\n// parseDuration parses the provided string as an Integer number\n// in millisecond precision\nfunction parseDuration(str) {\n if (str == null || str.length < 1) {\n throw new Error('str is empty')\n }\n\n // the sum in millisecond of the parsed duration\n let d = 0\n\n // current contains the partial seen number\n // it's reset when a time unit is found\n let current = ''\n\n // it tracks the seen time units\n // and it denies eventual duplicated\n let seen = {}\n\n for (let i = 0; i < str.length; i++) {\n // append the current char if it's a number or a decimal separator\n if (isNumber(str[i]) || str[i] == '.') {\n current += str[i]\n }\n\n // return if the next char is not a time unit\n if (str[i + 1] == null || isNumber(str[i + 1]) || str[i + 1] == '.') {\n continue\n }\n\n let v = parseFloat(current, 10)\n let next = str[i + 1]\n\n switch (next) {\n case 'd':\n d += v * 24 * 60 * 60 * 1000\n break\n case 'h':\n d += v * 60 * 60 * 1000\n break\n case 'm':\n if (i + 2 < str.length && str[i + 2] == 's') {\n // millisecond is the maximum precision\n // truncate eventual decimal\n d += Math.trunc(v)\n i++\n next = 'ms'\n } else {\n d += v * 60 * 1000\n }\n break\n case 's':\n d += v * 1000\n break\n default:\n throw new Error(`${next} is an unsupported time unit`)\n }\n if (seen[next]) {\n throw new Error(`${next} time unit is provided multiple times`)\n }\n seen[next] = true\n i++\n current = ''\n }\n // flush in case no time unit has been provided\n // for the latest group\n if (current.length > 0) {\n d += parseFloat(current, 10)\n }\n return d\n}\n\n// isNumber return true if the c character is a number\nfunction isNumber(c) {\n return c >= '0' && c <= '9'\n}\n\n// getCurrentStageIndex returns the computed index of the running stage.\nfunction getCurrentStageIndex() {\n let scenario = exec.test.options.scenarios[exec.scenario.name]\n if (scenario == null) {\n throw new Error(\n `the exec.test.options object doesn't contain the current scenario ${exec.scenario.name}`\n )\n }\n if (scenario.stages == null) {\n throw new Error(\n `only ramping-vus or ramping-arravial-rate supports stages, it is not possible to get a stage index on other executors.`\n )\n }\n\n if (scenario.stages.length < 1) {\n throw new Error(`the current scenario ${scenario.name} doesn't contain any stage`)\n }\n\n let sum = 0\n let elapsed = new Date() - exec.scenario.startTime\n for (let i = 0; i < scenario.stages.length; i++) {\n sum += parseDuration(scenario.stages[i].duration)\n if (elapsed < sum) {\n return i\n }\n }\n\n return scenario.stages.length - 1\n}\n\n// tagWithCurrentStageIndex adds a tag with a `stage` key\n// and the index of the current running stage as value.\nfunction tagWithCurrentStageIndex() {\n exec.vu.tags['stage'] = getCurrentStageIndex()\n}\n\n// tagWithCurrentStageProfile adds a tag with a `stage` key\n// and the profile (ramp-up, steady or ramp-down) computed\n// from the current running stage.\nfunction tagWithCurrentStageProfile() {\n //ramp-up when previous.target < current.target\n //ramp-down when previous.target > current.target\n //steady when prevuious.target = current.target\n\n let getStageProfile = function () {\n let currentIndex = getCurrentStageIndex()\n if (currentIndex < 1) {\n return 'ramp-up'\n }\n\n let stages = exec.test.options.scenarios[exec.scenario.name].stages\n let current = stages[currentIndex]\n let previous = stages[currentIndex - 1]\n\n if (current.target > previous.target) {\n return 'ramp-up'\n }\n\n if (previous.target == current.target) {\n return 'steady'\n }\n\n return 'ramp-down'\n }\n\n exec.vu.tags['stage_profile'] = getStageProfile()\n}\n\nexport { parseDuration, getCurrentStageIndex, tagWithCurrentStageIndex, tagWithCurrentStageProfile }\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/crypto\");","import { randomBytes } from 'k6/crypto'\n\n/**\n * Produces a Universal Unique Identifier version 4\n *\n * @param {boolean} secure - whether a cryptographically secure generation function should be used\n * @returns {String} - 16 characters hexadecimal representation of the UUID v4\n */\nexport function uuidv4(secure = false) {\n return secure ? secureUUIDv4() : insecureUUIDv4()\n}\n\nexport function randomIntBetween(min, max) {\n // min and max included\n return Math.floor(Math.random() * (max - min + 1) + min)\n}\n\nexport function randomItem(arrayOfItems) {\n return arrayOfItems[Math.floor(Math.random() * arrayOfItems.length)]\n}\n\nexport function randomString(length, charset = 'abcdefghijklmnopqrstuvwxyz') {\n let res = ''\n while (length--) res += charset[(Math.random() * charset.length) | 0]\n return res\n}\n\nexport function findBetween(content, left, right, repeat = false) {\n const extracted = []\n let doSearch = true\n let start,\n end = 0\n\n while (doSearch) {\n start = content.indexOf(left)\n if (start == -1) {\n break // no more matches\n }\n\n start += left.length\n end = content.indexOf(right, start)\n if (end == -1) {\n break // no more matches\n }\n let extractedContent = content.substring(start, end)\n\n // stop here if only extracting one match (default behavior)\n if (!repeat) {\n return extractedContent\n }\n\n // otherwise, add it to the array\n extracted.push(extractedContent)\n\n // update the \"cursor\" position to the end of the previous match\n content = content.substring(end + right.length)\n }\n\n return extracted.length ? extracted : null // return all matches as an array or null\n}\n\nexport function normalDistributionStages(maxVus, durationSeconds, numberOfStages = 10) {\n function normalDensity(mean, scale, x) {\n return (\n Math.exp((-1 / 2) * Math.pow((x - mean) / scale, 2)) / (scale * Math.sqrt(2 * Math.PI))\n )\n }\n\n const mean = 0\n const scale = 1\n let curve = new Array(numberOfStages + 2).fill(0)\n let durations = new Array(numberOfStages + 2).fill(Math.ceil(durationSeconds / 6))\n let k6stages = []\n\n for (let i = 0; i <= numberOfStages; i++) {\n curve[i] = normalDensity(mean, scale, -2 * scale + (4 * scale * i) / numberOfStages)\n }\n\n let peakDistribution = Math.max(...curve)\n\n let vus = curve.map((x) => Math.round((x * maxVus) / peakDistribution))\n\n for (let j = 1; j <= numberOfStages; j++) {\n durations[j] = Math.ceil((4 * durationSeconds) / (6 * numberOfStages))\n }\n\n for (let k = 0; k <= numberOfStages + 1; k++) {\n k6stages.push({ duration: `${durations[k]}s`, target: vus[k] })\n }\n\n return k6stages\n}\n\n/**\n * Fast UUID v4 producer\n *\n * Note that this function does not produce cryptographically\n * secure UUIDs. If you need safe UUIDs, use the secureUUIDv4\n * implementation instead.\n *\n * @returns {String} - 16 characters hexadecimal representation of the UUID v4\n */\nfunction insecureUUIDv4() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n let r = (Math.random() * 16) | 0,\n v = c === 'x' ? r : (r & 0x3) | 0x8\n return v.toString(16)\n })\n}\n\n/**\n * Cryptographically secure UUID v4 producer\n *\n * Note that this implementation involves a computation\n * overhead.\n *\n * @returns {String} - 16 characters hexadecimal representation of the UUID v4\n */\nfunction secureUUIDv4() {\n /**\n * bytes conversion table used to convert UUIDs bytes\n * to string form.\n */\n const byteToHex = []\n for (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1))\n }\n\n /**\n * produce 16 random bytes, and set UUID v4's specific\n * version and `clock_seq_hi_and_reserved` bits.\n */\n const rnds = new Uint8Array(randomBytes(16))\n rnds[6] = (rnds[6] & 0x0f) | 0x40\n rnds[8] = (rnds[8] & 0x3f) | 0x80\n\n /**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n return (\n byteToHex[rnds[0]] +\n byteToHex[rnds[1]] +\n byteToHex[rnds[2]] +\n byteToHex[rnds[3]] +\n '-' +\n byteToHex[rnds[4]] +\n byteToHex[rnds[5]] +\n '-' +\n byteToHex[rnds[6]] +\n byteToHex[rnds[7]] +\n '-' +\n byteToHex[rnds[8]] +\n byteToHex[rnds[9]] +\n '-' +\n byteToHex[rnds[10]] +\n byteToHex[rnds[11]] +\n byteToHex[rnds[12]] +\n byteToHex[rnds[13]] +\n byteToHex[rnds[14]] +\n byteToHex[rnds[15]]\n ).toLowerCase()\n}\n","import { Rate } from 'k6/metrics'\n\ntype FalsyCheckValue =\n | Array\n | Record\n | boolean\n | string\n | number\n | null\n | undefined\n\ntype Checker =\n | ((value: T) => FalsyCheckValue)\n | ((value: T) => Promise)\n | FalsyCheckValue\n | Promise\n\ninterface CheckMap {\n [key: string]: Checker\n}\n\ninterface SyncCheckMap {\n [key: string]: ((value: any) => FalsyCheckValue) | FalsyCheckValue\n}\n\ntype CheckResult> = C extends SyncCheckMap ? boolean : Promise\n\nconst checkRate = new Rate('checks')\n\nexport function check>(checkers: C): CheckResult\nexport function check>(value: T, checkers: C): CheckResult\nexport function check>(value: T | C, checkers?: C): CheckResult {\n const checkMap = checkers || (value as C)\n\n const results = Object.entries(checkMap).map(([key, checker]) => {\n function reportResult(value: FalsyCheckValue): FalsyCheckValue {\n checkRate.add(value ? 1 : 0, {\n check: key,\n })\n\n return value\n }\n\n if (typeof checker === 'function') {\n const result = checker(value as T)\n\n if (result instanceof Promise) {\n return result.then(reportResult)\n }\n\n return reportResult(result)\n }\n\n if (checker instanceof Promise) {\n return checker.then(reportResult)\n }\n\n return reportResult(checker)\n })\n\n if (results.some((result) => result instanceof Promise)) {\n return Promise.all(results).then((results) => results.every(Boolean)) as CheckResult\n }\n\n return results.every(Boolean) as CheckResult\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/metrics\");"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","require","parseDuration","str","length","Error","current","seen","i","isNumber","v","parseFloat","next","Math","trunc","concat","c","getCurrentStageIndex","scenario","exec","stages","name","sum","elapsed","Date","duration","tagWithCurrentStageIndex","tagWithCurrentStageProfile","currentIndex","previous","target","getStageProfile","uuidv4","secure","arguments","undefined","secureUUIDv4","insecureUUIDv4","randomIntBetween","min","max","floor","random","randomItem","arrayOfItems","randomString","charset","res","findBetween","content","left","right","start","repeat","extracted","doSearch","end","indexOf","extractedContent","substring","push","normalDistributionStages","maxVus","durationSeconds","numberOfStages","normalDensity","mean","scale","x","exp","pow","sqrt","PI","curve","Array","fill","durations","ceil","k6stages","peakDistribution","apply","_toConsumableArray","vus","map","round","j","k","replace","r","toString","byteToHex","slice","rnds","Uint8Array","randomBytes","toLowerCase","checkRate","Rate","check","checkers","checkMap","results","entries","_ref","_ref2","_slicedToArray","checker","reportResult","add","result","Promise","then","some","all","every","Boolean"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.js","mappings":"wCACAA,OAAOC,eAAeC,EAAS,aAAc,CAAEC,OAAO,IACtDD,EAAQE,MAGR,SAAeD,EAAOE,GAClB,IAAIC,EAAWD,GAAYF,EACvBI,EAAUP,OAAOQ,QAAQF,GAAUG,KAAI,SAAUC,GACjD,IAAIC,EAAMD,EAAG,GAAIE,EAAUF,EAAG,GAC9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EAAMC,IAAK,WAAc,OAAOF,EAAYxG,4BACrH9B,OAAOC,eAAeC,EAAS,6BAA8B,CAAEqI,YAAY,EAAMC,IAAK,WAAc,OAAOF,EAAYnG,8BACvH,IAAIsG,EAAa,EAAQ,KACzBzI,OAAOC,eAAeC,EAAS,cAAe,CAAEqI,YAAY,EAAMC,IAAK,WAAc,OAAOC,EAAW/C,eACvG1F,OAAOC,eAAeC,EAAS,2BAA4B,CAAEqI,YAAY,EAAMC,IAAK,WAAc,OAAOC,EAAWpC,4BACpHrG,OAAOC,eAAeC,EAAS,mBAAoB,CAAEqI,YAAY,EAAMC,IAAK,WAAc,OAAOC,EAAWxD,oBAC5GjF,OAAOC,eAAeC,EAAS,aAAc,CAAEqI,YAAY,EAAMC,IAAK,WAAc,OAAOC,EAAWpD,cACtGrF,OAAOC,eAAeC,EAAS,eAAgB,CAAEqI,YAAY,EAAMC,IAAK,WAAc,OAAOC,EAAWlD,gBACxGvF,OAAOC,eAAeC,EAAS,SAAU,CAAEqI,YAAY,EAAMC,IAAK,WAAc,OAAOC,EAAWvE,UAClG,IAAIwE,EAAa,EAAQ,KACzB1I,OAAOC,eAAeC,EAAS,QAAS,CAAEqI,YAAY,EAAMC,IAAK,WAAc,OAAOE,EAAWtI,U","sources":["webpack://k6-jslib-utils/./src/check.ts","webpack://k6-jslib-utils/./src/stages.js","webpack://k6-jslib-utils/./src/utils.js","webpack://k6-jslib-utils/external commonjs \"k6/crypto\"","webpack://k6-jslib-utils/external commonjs \"k6/execution\"","webpack://k6-jslib-utils/external commonjs \"k6/metrics\"","webpack://k6-jslib-utils/webpack/bootstrap","webpack://k6-jslib-utils/./src/index.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.check = check;\nvar metrics_1 = require(\"k6/metrics\");\nvar checkRate = new metrics_1.Rate('checks');\nfunction check(value, checkers) {\n var checkMap = checkers || value;\n var results = Object.entries(checkMap).map(function (_a) {\n var key = _a[0], checker = _a[1];\n function reportResult(value) {\n checkRate.add(value ? 1 : 0, {\n check: key,\n });\n return value;\n }\n if (typeof checker === 'function') {\n var result = checker(value);\n if (result instanceof Promise) {\n return result.then(reportResult);\n }\n return reportResult(result);\n }\n if (checker instanceof Promise) {\n return checker.then(reportResult);\n }\n return reportResult(checker);\n });\n if (results.some(function (result) { return result instanceof Promise; })) {\n return Promise.all(results).then(function (results) { return results.every(Boolean); });\n }\n return results.every(Boolean);\n}\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parseDuration = parseDuration;\nexports.getCurrentStageIndex = getCurrentStageIndex;\nexports.tagWithCurrentStageIndex = tagWithCurrentStageIndex;\nexports.tagWithCurrentStageProfile = tagWithCurrentStageProfile;\nvar execution_1 = __importDefault(require(\"k6/execution\"));\n// parseDuration parses the provided string as an Integer number\n// in millisecond precision\nfunction parseDuration(str) {\n if (str == null || str.length < 1) {\n throw new Error('str is empty');\n }\n // the sum in millisecond of the parsed duration\n var d = 0;\n // current contains the partial seen number\n // it's reset when a time unit is found\n var current = '';\n // it tracks the seen time units\n // and it denies eventual duplicated\n var seen = {};\n for (var i = 0; i < str.length; i++) {\n // append the current char if it's a number or a decimal separator\n if (isNumber(str[i]) || str[i] == '.') {\n current += str[i];\n }\n // return if the next char is not a time unit\n if (str[i + 1] == null || isNumber(str[i + 1]) || str[i + 1] == '.') {\n continue;\n }\n var v = parseFloat(current, 10);\n var next = str[i + 1];\n switch (next) {\n case 'd':\n d += v * 24 * 60 * 60 * 1000;\n break;\n case 'h':\n d += v * 60 * 60 * 1000;\n break;\n case 'm':\n if (i + 2 < str.length && str[i + 2] == 's') {\n // millisecond is the maximum precision\n // truncate eventual decimal\n d += Math.trunc(v);\n i++;\n next = 'ms';\n }\n else {\n d += v * 60 * 1000;\n }\n break;\n case 's':\n d += v * 1000;\n break;\n default:\n throw new Error(\"\".concat(next, \" is an unsupported time unit\"));\n }\n if (seen[next]) {\n throw new Error(\"\".concat(next, \" time unit is provided multiple times\"));\n }\n seen[next] = true;\n i++;\n current = '';\n }\n // flush in case no time unit has been provided\n // for the latest group\n if (current.length > 0) {\n d += parseFloat(current, 10);\n }\n return d;\n}\n// isNumber return true if the c character is a number\nfunction isNumber(c) {\n return c >= '0' && c <= '9';\n}\n// getCurrentStageIndex returns the computed index of the running stage.\nfunction getCurrentStageIndex() {\n var scenario = execution_1.default.test.options.scenarios[execution_1.default.scenario.name];\n if (scenario == null) {\n throw new Error(\"the exec.test.options object doesn't contain the current scenario \".concat(execution_1.default.scenario.name));\n }\n if (scenario.stages == null) {\n throw new Error(\"only ramping-vus or ramping-arravial-rate supports stages, it is not possible to get a stage index on other executors.\");\n }\n if (scenario.stages.length < 1) {\n throw new Error(\"the current scenario \".concat(scenario.name, \" doesn't contain any stage\"));\n }\n var sum = 0;\n var elapsed = new Date() - execution_1.default.scenario.startTime;\n for (var i = 0; i < scenario.stages.length; i++) {\n sum += parseDuration(scenario.stages[i].duration);\n if (elapsed < sum) {\n return i;\n }\n }\n return scenario.stages.length - 1;\n}\n// tagWithCurrentStageIndex adds a tag with a `stage` key\n// and the index of the current running stage as value.\nfunction tagWithCurrentStageIndex() {\n execution_1.default.vu.tags['stage'] = getCurrentStageIndex();\n}\n// tagWithCurrentStageProfile adds a tag with a `stage` key\n// and the profile (ramp-up, steady or ramp-down) computed\n// from the current running stage.\nfunction tagWithCurrentStageProfile() {\n //ramp-up when previous.target < current.target\n //ramp-down when previous.target > current.target\n //steady when prevuious.target = current.target\n var getStageProfile = function () {\n var currentIndex = getCurrentStageIndex();\n if (currentIndex < 1) {\n return 'ramp-up';\n }\n var stages = execution_1.default.test.options.scenarios[execution_1.default.scenario.name].stages;\n var current = stages[currentIndex];\n var previous = stages[currentIndex - 1];\n if (current.target > previous.target) {\n return 'ramp-up';\n }\n if (previous.target == current.target) {\n return 'steady';\n }\n return 'ramp-down';\n };\n execution_1.default.vu.tags['stage_profile'] = getStageProfile();\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.uuidv4 = uuidv4;\nexports.randomIntBetween = randomIntBetween;\nexports.randomItem = randomItem;\nexports.randomString = randomString;\nexports.findBetween = findBetween;\nexports.normalDistributionStages = normalDistributionStages;\nvar crypto_1 = require(\"k6/crypto\");\n/**\n * Produces a Universal Unique Identifier version 4\n *\n * @param {boolean} secure - whether a cryptographically secure generation function should be used\n * @returns {String} - 16 characters hexadecimal representation of the UUID v4\n */\nfunction uuidv4(secure) {\n if (secure === void 0) { secure = false; }\n return secure ? secureUUIDv4() : insecureUUIDv4();\n}\nfunction randomIntBetween(min, max) {\n // min and max included\n return Math.floor(Math.random() * (max - min + 1) + min);\n}\nfunction randomItem(arrayOfItems) {\n return arrayOfItems[Math.floor(Math.random() * arrayOfItems.length)];\n}\nfunction randomString(length, charset) {\n if (charset === void 0) { charset = 'abcdefghijklmnopqrstuvwxyz'; }\n var res = '';\n while (length--)\n res += charset[(Math.random() * charset.length) | 0];\n return res;\n}\nfunction findBetween(content, left, right, repeat) {\n if (repeat === void 0) { repeat = false; }\n var extracted = [];\n var doSearch = true;\n var start, end = 0;\n while (doSearch) {\n start = content.indexOf(left);\n if (start == -1) {\n break; // no more matches\n }\n start += left.length;\n end = content.indexOf(right, start);\n if (end == -1) {\n break; // no more matches\n }\n var extractedContent = content.substring(start, end);\n // stop here if only extracting one match (default behavior)\n if (!repeat) {\n return extractedContent;\n }\n // otherwise, add it to the array\n extracted.push(extractedContent);\n // update the \"cursor\" position to the end of the previous match\n content = content.substring(end + right.length);\n }\n return extracted.length ? extracted : null; // return all matches as an array or null\n}\nfunction normalDistributionStages(maxVus, durationSeconds, numberOfStages) {\n if (numberOfStages === void 0) { numberOfStages = 10; }\n function normalDensity(mean, scale, x) {\n return (Math.exp((-1 / 2) * Math.pow((x - mean) / scale, 2)) / (scale * Math.sqrt(2 * Math.PI)));\n }\n var mean = 0;\n var scale = 1;\n var curve = new Array(numberOfStages + 2).fill(0);\n var durations = new Array(numberOfStages + 2).fill(Math.ceil(durationSeconds / 6));\n var k6stages = [];\n for (var i = 0; i <= numberOfStages; i++) {\n curve[i] = normalDensity(mean, scale, -2 * scale + (4 * scale * i) / numberOfStages);\n }\n var peakDistribution = Math.max.apply(Math, curve);\n var vus = curve.map(function (x) { return Math.round((x * maxVus) / peakDistribution); });\n for (var j = 1; j <= numberOfStages; j++) {\n durations[j] = Math.ceil((4 * durationSeconds) / (6 * numberOfStages));\n }\n for (var k = 0; k <= numberOfStages + 1; k++) {\n k6stages.push({ duration: \"\".concat(durations[k], \"s\"), target: vus[k] });\n }\n return k6stages;\n}\n/**\n * Fast UUID v4 producer\n *\n * Note that this function does not produce cryptographically\n * secure UUIDs. If you need safe UUIDs, use the secureUUIDv4\n * implementation instead.\n *\n * @returns {String} - 16 characters hexadecimal representation of the UUID v4\n */\nfunction insecureUUIDv4() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = (Math.random() * 16) | 0, v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n/**\n * Cryptographically secure UUID v4 producer\n *\n * Note that this implementation involves a computation\n * overhead.\n *\n * @returns {String} - 16 characters hexadecimal representation of the UUID v4\n */\nfunction secureUUIDv4() {\n /**\n * bytes conversion table used to convert UUIDs bytes\n * to string form.\n */\n var byteToHex = [];\n for (var i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n }\n /**\n * produce 16 random bytes, and set UUID v4's specific\n * version and `clock_seq_hi_and_reserved` bits.\n */\n var rnds = new Uint8Array((0, crypto_1.randomBytes)(16));\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n /**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n return (byteToHex[rnds[0]] +\n byteToHex[rnds[1]] +\n byteToHex[rnds[2]] +\n byteToHex[rnds[3]] +\n '-' +\n byteToHex[rnds[4]] +\n byteToHex[rnds[5]] +\n '-' +\n byteToHex[rnds[6]] +\n byteToHex[rnds[7]] +\n '-' +\n byteToHex[rnds[8]] +\n byteToHex[rnds[9]] +\n '-' +\n byteToHex[rnds[10]] +\n byteToHex[rnds[11]] +\n byteToHex[rnds[12]] +\n byteToHex[rnds[13]] +\n byteToHex[rnds[14]] +\n byteToHex[rnds[15]]).toLowerCase();\n}\n","module.exports = require(\"k6/crypto\");","module.exports = require(\"k6/execution\");","module.exports = require(\"k6/metrics\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.uuidv4 = exports.randomString = exports.randomItem = exports.randomIntBetween = exports.normalDistributionStages = exports.findBetween = exports.tagWithCurrentStageProfile = exports.tagWithCurrentStageIndex = exports.getCurrentStageIndex = exports.parseDuration = exports.check = void 0;\nvar stages_js_1 = require(\"./stages.js\");\nObject.defineProperty(exports, \"parseDuration\", { enumerable: true, get: function () { return stages_js_1.parseDuration; } });\nObject.defineProperty(exports, \"getCurrentStageIndex\", { enumerable: true, get: function () { return stages_js_1.getCurrentStageIndex; } });\nObject.defineProperty(exports, \"tagWithCurrentStageIndex\", { enumerable: true, get: function () { return stages_js_1.tagWithCurrentStageIndex; } });\nObject.defineProperty(exports, \"tagWithCurrentStageProfile\", { enumerable: true, get: function () { return stages_js_1.tagWithCurrentStageProfile; } });\nvar utils_js_1 = require(\"./utils.js\");\nObject.defineProperty(exports, \"findBetween\", { enumerable: true, get: function () { return utils_js_1.findBetween; } });\nObject.defineProperty(exports, \"normalDistributionStages\", { enumerable: true, get: function () { return utils_js_1.normalDistributionStages; } });\nObject.defineProperty(exports, \"randomIntBetween\", { enumerable: true, get: function () { return utils_js_1.randomIntBetween; } });\nObject.defineProperty(exports, \"randomItem\", { enumerable: true, get: function () { return utils_js_1.randomItem; } });\nObject.defineProperty(exports, \"randomString\", { enumerable: true, get: function () { return utils_js_1.randomString; } });\nObject.defineProperty(exports, \"uuidv4\", { enumerable: true, get: function () { return utils_js_1.uuidv4; } });\nvar check_ts_1 = require(\"./check.ts\");\nObject.defineProperty(exports, \"check\", { enumerable: true, get: function () { return check_ts_1.check; } });\n"],"names":["Object","defineProperty","exports","value","check","checkers","checkMap","results","entries","map","_a","key","checker","reportResult","checkRate","add","result","Promise","then","some","all","every","Boolean","Rate","__importDefault","this","mod","__esModule","parseDuration","getCurrentStageIndex","tagWithCurrentStageIndex","execution_1","default","vu","tags","tagWithCurrentStageProfile","currentIndex","stages","test","options","scenarios","scenario","name","current","previous","target","getStageProfile","str","length","Error","d","seen","i","isNumber","v","parseFloat","next","Math","trunc","concat","c","sum","elapsed","Date","startTime","duration","uuidv4","secure","byteToHex","push","toString","slice","rnds","Uint8Array","crypto_1","randomBytes","toLowerCase","secureUUIDv4","replace","r","random","randomIntBetween","min","max","floor","randomItem","arrayOfItems","randomString","charset","res","findBetween","content","left","right","repeat","start","extracted","end","indexOf","extractedContent","substring","normalDistributionStages","maxVus","durationSeconds","numberOfStages","normalDensity","mean","scale","x","exp","pow","sqrt","PI","curve","Array","fill","durations","ceil","k6stages","peakDistribution","apply","vus","round","j","k","module","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","call","stages_js_1","enumerable","get","utils_js_1","check_ts_1"],"sourceRoot":""} \ No newline at end of file diff --git a/build/stages.d.ts b/build/stages.d.ts new file mode 100644 index 0000000..f4c1c8b --- /dev/null +++ b/build/stages.d.ts @@ -0,0 +1,4 @@ +export function parseDuration(str: any): number; +export function getCurrentStageIndex(): number; +export function tagWithCurrentStageIndex(): void; +export function tagWithCurrentStageProfile(): void; diff --git a/build/utils.d.ts b/build/utils.d.ts new file mode 100644 index 0000000..d3be2e0 --- /dev/null +++ b/build/utils.d.ts @@ -0,0 +1,15 @@ +/** + * Produces a Universal Unique Identifier version 4 + * + * @param {boolean} secure - whether a cryptographically secure generation function should be used + * @returns {String} - 16 characters hexadecimal representation of the UUID v4 + */ +export function uuidv4(secure?: boolean): string; +export function randomIntBetween(min: any, max: any): number; +export function randomItem(arrayOfItems: any): any; +export function randomString(length: any, charset?: string): string; +export function findBetween(content: any, left: any, right: any, repeat?: boolean): any; +export function normalDistributionStages(maxVus: any, durationSeconds: any, numberOfStages?: number): { + duration: string; + target: number; +}[]; diff --git a/package-lock.json b/package-lock.json index cc2eaef..3d87b60 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,7 @@ "lint-staged": "^12.4.1", "prettier": "2.6.2", "terser-webpack-plugin": "^5.3.1", + "ts-loader": "^9.5.1", "webpack": "^5.72.0", "webpack-cli": "^4.9.2", "webpack-glob-entries": "^1.0.1" @@ -4217,6 +4218,15 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, "node_modules/source-map-support": { "version": "0.5.21", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", @@ -4446,6 +4456,108 @@ "punycode": "^2.1.0" } }, + "node_modules/ts-loader": { + "version": "9.5.1", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.1.tgz", + "integrity": "sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.0", + "enhanced-resolve": "^5.0.0", + "micromatch": "^4.0.0", + "semver": "^7.3.4", + "source-map": "^0.7.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "typescript": "*", + "webpack": "^5.0.0" + } + }, + "node_modules/ts-loader/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/ts-loader/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/ts-loader/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/ts-loader/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/ts-loader/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ts-loader/node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ts-loader/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/tslib": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", @@ -4464,6 +4576,20 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/typescript": { + "version": "5.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", + "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", + "dev": true, + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "node_modules/unicode-canonical-property-names-ecmascript": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", @@ -7906,6 +8032,12 @@ } } }, + "source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "dev": true + }, "source-map-support": { "version": "0.5.21", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", @@ -8062,6 +8194,76 @@ "punycode": "^2.1.0" } }, + "ts-loader": { + "version": "9.5.1", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.1.tgz", + "integrity": "sha512-rNH3sK9kGZcH9dYzC7CewQm4NtxJTjSEVRJ2DyBZR7f8/wcta+iV44UPCXc5+nzDzivKtlzV6c9P4e+oFhDLYg==", + "dev": true, + "requires": { + "chalk": "^4.1.0", + "enhanced-resolve": "^5.0.0", + "micromatch": "^4.0.0", + "semver": "^7.3.4", + "source-map": "^0.7.4" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "tslib": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", @@ -8074,6 +8276,13 @@ "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", "dev": true }, + "typescript": { + "version": "5.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", + "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", + "dev": true, + "peer": true + }, "unicode-canonical-property-names-ecmascript": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", diff --git a/package.json b/package.json index 040ee61..a2ff20f 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,6 @@ "@babel/core": "^7.4.4", "@babel/plugin-transform-block-scoping": "^7.14.1", "@babel/preset-env": "^7.4.4", - "@babel/preset-typescript": "^7.24.7", "@types/k6": "^0.52.0", "@types/webpack": "^5.28.0", "babel-loader": "^8.0.6", @@ -16,6 +15,7 @@ "lint-staged": "^12.4.1", "prettier": "2.6.2", "terser-webpack-plugin": "^5.3.1", + "ts-loader": "^9.5.1", "webpack": "^5.72.0", "webpack-cli": "^4.9.2", "webpack-glob-entries": "^1.0.1" @@ -23,7 +23,7 @@ "engines": {}, "scripts": { "webpack": "webpack", - "test": "k6 run --compatibility-mode=experimental_enhanced tests/", + "test": "k6 run tests/", "prepare": "husky install" }, "keywords": [ diff --git a/tests/check.ts b/tests/check.ts index 1e5d520..6fa1eb2 100644 --- a/tests/check.ts +++ b/tests/check.ts @@ -1,5 +1,5 @@ import { check } from 'k6' -import { check as asyncCheck } from '../src/check.ts' +import { check as asyncCheck } from '../build/index.js' export const options = { iterations: 1, diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..d687279 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "outDir": "./dist", + "rootDir": "./src", + "strict": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "declaration": true, + "declarationDir": "./build", + "allowJs": true + }, + "include": ["src/**/*.ts", "src/**/*.js"] +} diff --git a/webpack.config.js b/webpack.config.js index 869c091..8137d7a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -17,11 +17,16 @@ module.exports = { }, module: { rules: [ + // { + // test: /\.js$/, + // loader: 'babel-loader', + // exclude: /node_modules/, + // }, { test: /\.(j|t)s$/, - loader: 'babel-loader', + loader: 'ts-loader', exclude: /node_modules/, - }, + } ], }, stats: { From 25b540dbcc5c7eaec47d85e8f94d7945adec1066 Mon Sep 17 00:00:00 2001 From: Johan Suleiko Allansson Date: Tue, 13 Aug 2024 10:17:46 +0200 Subject: [PATCH 3/8] remove built type definitions --- build/check.d.ts | 12 ------------ build/index.d.ts | 12 ------------ build/stages.d.ts | 4 ---- build/utils.d.ts | 15 --------------- tsconfig.json | 2 -- 5 files changed, 45 deletions(-) delete mode 100644 build/check.d.ts delete mode 100644 build/index.d.ts delete mode 100644 build/stages.d.ts delete mode 100644 build/utils.d.ts diff --git a/build/check.d.ts b/build/check.d.ts deleted file mode 100644 index 622e800..0000000 --- a/build/check.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -type FalsyCheckValue = Array | Record | boolean | string | number | null | undefined; -type Checker = ((value: T) => FalsyCheckValue) | ((value: T) => Promise) | FalsyCheckValue | Promise; -interface CheckMap { - [key: string]: Checker; -} -interface SyncCheckMap { - [key: string]: ((value: any) => FalsyCheckValue) | FalsyCheckValue; -} -type CheckResult> = C extends SyncCheckMap ? boolean : Promise; -export declare function check>(checkers: C): CheckResult; -export declare function check>(value: T, checkers: C): CheckResult; -export {}; diff --git a/build/index.d.ts b/build/index.d.ts deleted file mode 100644 index ab6acc1..0000000 --- a/build/index.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { check } from './check.ts'; -import { parseDuration } from './stages.js'; -import { getCurrentStageIndex } from './stages.js'; -import { tagWithCurrentStageIndex } from './stages.js'; -import { tagWithCurrentStageProfile } from './stages.js'; -import { findBetween } from './utils.js'; -import { normalDistributionStages } from './utils.js'; -import { randomIntBetween } from './utils.js'; -import { randomItem } from './utils.js'; -import { randomString } from './utils.js'; -import { uuidv4 } from './utils.js'; -export { check, parseDuration, getCurrentStageIndex, tagWithCurrentStageIndex, tagWithCurrentStageProfile, findBetween, normalDistributionStages, randomIntBetween, randomItem, randomString, uuidv4 }; diff --git a/build/stages.d.ts b/build/stages.d.ts deleted file mode 100644 index f4c1c8b..0000000 --- a/build/stages.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export function parseDuration(str: any): number; -export function getCurrentStageIndex(): number; -export function tagWithCurrentStageIndex(): void; -export function tagWithCurrentStageProfile(): void; diff --git a/build/utils.d.ts b/build/utils.d.ts deleted file mode 100644 index d3be2e0..0000000 --- a/build/utils.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Produces a Universal Unique Identifier version 4 - * - * @param {boolean} secure - whether a cryptographically secure generation function should be used - * @returns {String} - 16 characters hexadecimal representation of the UUID v4 - */ -export function uuidv4(secure?: boolean): string; -export function randomIntBetween(min: any, max: any): number; -export function randomItem(arrayOfItems: any): any; -export function randomString(length: any, charset?: string): string; -export function findBetween(content: any, left: any, right: any, repeat?: boolean): any; -export function normalDistributionStages(maxVus: any, durationSeconds: any, numberOfStages?: number): { - duration: string; - target: number; -}[]; diff --git a/tsconfig.json b/tsconfig.json index d687279..6346000 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,8 +7,6 @@ "strict": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, - "declaration": true, - "declarationDir": "./build", "allowJs": true }, "include": ["src/**/*.ts", "src/**/*.js"] From fa74d495868666d44d94573a1f5ecf61b588e387 Mon Sep 17 00:00:00 2001 From: Johan Suleiko Allansson Date: Tue, 13 Aug 2024 11:30:53 +0200 Subject: [PATCH 4/8] Revert "remove built type definitions" This reverts commit 25b540dbcc5c7eaec47d85e8f94d7945adec1066. --- build/check.d.ts | 12 ++++++++++++ build/index.d.ts | 12 ++++++++++++ build/stages.d.ts | 4 ++++ build/utils.d.ts | 15 +++++++++++++++ tsconfig.json | 2 ++ 5 files changed, 45 insertions(+) create mode 100644 build/check.d.ts create mode 100644 build/index.d.ts create mode 100644 build/stages.d.ts create mode 100644 build/utils.d.ts diff --git a/build/check.d.ts b/build/check.d.ts new file mode 100644 index 0000000..622e800 --- /dev/null +++ b/build/check.d.ts @@ -0,0 +1,12 @@ +type FalsyCheckValue = Array | Record | boolean | string | number | null | undefined; +type Checker = ((value: T) => FalsyCheckValue) | ((value: T) => Promise) | FalsyCheckValue | Promise; +interface CheckMap { + [key: string]: Checker; +} +interface SyncCheckMap { + [key: string]: ((value: any) => FalsyCheckValue) | FalsyCheckValue; +} +type CheckResult> = C extends SyncCheckMap ? boolean : Promise; +export declare function check>(checkers: C): CheckResult; +export declare function check>(value: T, checkers: C): CheckResult; +export {}; diff --git a/build/index.d.ts b/build/index.d.ts new file mode 100644 index 0000000..ab6acc1 --- /dev/null +++ b/build/index.d.ts @@ -0,0 +1,12 @@ +import { check } from './check.ts'; +import { parseDuration } from './stages.js'; +import { getCurrentStageIndex } from './stages.js'; +import { tagWithCurrentStageIndex } from './stages.js'; +import { tagWithCurrentStageProfile } from './stages.js'; +import { findBetween } from './utils.js'; +import { normalDistributionStages } from './utils.js'; +import { randomIntBetween } from './utils.js'; +import { randomItem } from './utils.js'; +import { randomString } from './utils.js'; +import { uuidv4 } from './utils.js'; +export { check, parseDuration, getCurrentStageIndex, tagWithCurrentStageIndex, tagWithCurrentStageProfile, findBetween, normalDistributionStages, randomIntBetween, randomItem, randomString, uuidv4 }; diff --git a/build/stages.d.ts b/build/stages.d.ts new file mode 100644 index 0000000..f4c1c8b --- /dev/null +++ b/build/stages.d.ts @@ -0,0 +1,4 @@ +export function parseDuration(str: any): number; +export function getCurrentStageIndex(): number; +export function tagWithCurrentStageIndex(): void; +export function tagWithCurrentStageProfile(): void; diff --git a/build/utils.d.ts b/build/utils.d.ts new file mode 100644 index 0000000..d3be2e0 --- /dev/null +++ b/build/utils.d.ts @@ -0,0 +1,15 @@ +/** + * Produces a Universal Unique Identifier version 4 + * + * @param {boolean} secure - whether a cryptographically secure generation function should be used + * @returns {String} - 16 characters hexadecimal representation of the UUID v4 + */ +export function uuidv4(secure?: boolean): string; +export function randomIntBetween(min: any, max: any): number; +export function randomItem(arrayOfItems: any): any; +export function randomString(length: any, charset?: string): string; +export function findBetween(content: any, left: any, right: any, repeat?: boolean): any; +export function normalDistributionStages(maxVus: any, durationSeconds: any, numberOfStages?: number): { + duration: string; + target: number; +}[]; diff --git a/tsconfig.json b/tsconfig.json index 6346000..d687279 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,6 +7,8 @@ "strict": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, + "declaration": true, + "declarationDir": "./build", "allowJs": true }, "include": ["src/**/*.ts", "src/**/*.js"] From 9eff4c95bdbf0d9b2b484c84621e0bd63d16bd37 Mon Sep 17 00:00:00 2001 From: Johan Suleiko Allansson Date: Wed, 14 Aug 2024 15:26:52 +0200 Subject: [PATCH 5/8] support tags in async check function --- src/check.ts | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/check.ts b/src/check.ts index 9fadded..92be4cb 100644 --- a/src/check.ts +++ b/src/check.ts @@ -27,22 +27,25 @@ type CheckResult> = C extends SyncCheckMap ? boolean : P const checkRate = new Rate('checks') -export function check>(checkers: C): CheckResult -export function check>(value: T, checkers: C): CheckResult -export function check>(value: T | C, checkers?: C): CheckResult { - const checkMap = checkers || (value as C) - - const results = Object.entries(checkMap).map(([key, checker]) => { +export function check>( + value: T, + checkers: C, + tags?: Record +): CheckResult { + const results = Object.entries(checkers).map(([key, checker]) => { function reportResult(value: FalsyCheckValue): FalsyCheckValue { - checkRate.add(value ? 1 : 0, { - check: key, - }) + checkRate.add( + value ? 1 : 0, + Object.assign({}, tags, { + check: key, + }) + ) return value } if (typeof checker === 'function') { - const result = checker(value as T) + const result = checker(value) if (result instanceof Promise) { return result.then(reportResult) From d1884876254325bdaf0ba04aa942faddd5b1e602 Mon Sep 17 00:00:00 2001 From: Johan Suleiko Allansson Date: Fri, 16 Aug 2024 09:55:24 +0200 Subject: [PATCH 6/8] build files --- build/check.d.ts | 3 +-- build/index.js | 2 +- build/index.js.map | 2 +- tests/check.ts | 26 +++++++++++++------------- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/build/check.d.ts b/build/check.d.ts index 622e800..63b396a 100644 --- a/build/check.d.ts +++ b/build/check.d.ts @@ -7,6 +7,5 @@ interface SyncCheckMap { [key: string]: ((value: any) => FalsyCheckValue) | FalsyCheckValue; } type CheckResult> = C extends SyncCheckMap ? boolean : Promise; -export declare function check>(checkers: C): CheckResult; -export declare function check>(value: T, checkers: C): CheckResult; +export declare function check>(value: T, checkers: C, tags?: Record): CheckResult; export {}; diff --git a/build/index.js b/build/index.js index 09b1218..a9c3079 100644 --- a/build/index.js +++ b/build/index.js @@ -1,2 +1,2 @@ -(()=>{"use strict";var e={184:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.check=function(e,t){var r=t||e,a=Object.entries(r).map((function(t){var r=t[0],a=t[1];function o(e){return n.add(e?1:0,{check:r}),e}if("function"==typeof a){var i=a(e);return i instanceof Promise?i.then(o):o(i)}return a instanceof Promise?a.then(o):o(a)}));if(a.some((function(e){return e instanceof Promise})))return Promise.all(a).then((function(e){return e.every(Boolean)}));return a.every(Boolean)};var n=new(r(610).Rate)("checks")},664:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.parseDuration=o,t.getCurrentStageIndex=u,t.tagWithCurrentStageIndex=function(){a.default.vu.tags.stage=u()},t.tagWithCurrentStageProfile=function(){a.default.vu.tags.stage_profile=function(){var e=u();if(e<1)return"ramp-up";var t=a.default.test.options.scenarios[a.default.scenario.name].stages,r=t[e],n=t[e-1];return r.target>n.target?"ramp-up":n.target==r.target?"steady":"ramp-down"}()};var a=n(r(744));function o(e){if(null==e||e.length<1)throw new Error("str is empty");for(var t=0,r="",n={},a=0;a0&&(t+=parseFloat(r,10)),t}function i(e){return e>="0"&&e<="9"}function u(){var e=a.default.test.options.scenarios[a.default.scenario.name];if(null==e)throw new Error("the exec.test.options object doesn't contain the current scenario ".concat(a.default.scenario.name));if(null==e.stages)throw new Error("only ramping-vus or ramping-arravial-rate supports stages, it is not possible to get a stage index on other executors.");if(e.stages.length<1)throw new Error("the current scenario ".concat(e.name," doesn't contain any stage"));for(var t=0,r=new Date-a.default.scenario.startTime,n=0;n{Object.defineProperty(t,"__esModule",{value:!0}),t.uuidv4=function(e){void 0===e&&(e=!1);return e?function(){for(var e=[],t=0;t<256;++t)e.push((t+256).toString(16).slice(1));var r=new Uint8Array((0,n.randomBytes)(16));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,(e[r[0]]+e[r[1]]+e[r[2]]+e[r[3]]+"-"+e[r[4]]+e[r[5]]+"-"+e[r[6]]+e[r[7]]+"-"+e[r[8]]+e[r[9]]+"-"+e[r[10]]+e[r[11]]+e[r[12]]+e[r[13]]+e[r[14]]+e[r[15]]).toLowerCase()}():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},t.randomIntBetween=function(e,t){return Math.floor(Math.random()*(t-e+1)+e)},t.randomItem=function(e){return e[Math.floor(Math.random()*e.length)]},t.randomString=function(e,t){void 0===t&&(t="abcdefghijklmnopqrstuvwxyz");var r="";for(;e--;)r+=t[Math.random()*t.length|0];return r},t.findBetween=function(e,t,r,n){void 0===n&&(n=!1);var a,o=[],i=0;for(;-1!=(a=e.indexOf(t))&&(a+=t.length,-1!=(i=e.indexOf(r,a)));){var u=e.substring(a,i);if(!n)return u;o.push(u),e=e.substring(i+r.length)}return o.length?o:null},t.normalDistributionStages=function(e,t,r){void 0===r&&(r=10);function n(e,t,r){return Math.exp(-.5*Math.pow((r-e)/t,2))/(t*Math.sqrt(2*Math.PI))}for(var a=new Array(r+2).fill(0),o=new Array(r+2).fill(Math.ceil(t/6)),i=[],u=0;u<=r;u++)a[u]=n(0,1,4*u/r-2);for(var s=Math.max.apply(Math,a),c=a.map((function(t){return Math.round(t*e/s)})),f=1;f<=r;f++)o[f]=Math.ceil(4*t/(6*r));for(var l=0;l<=r+1;l++)i.push({duration:"".concat(o[l],"s"),target:c[l]});return i};var n=r(400)},400:e=>{e.exports=require("k6/crypto")},744:e=>{e.exports=require("k6/execution")},610:e=>{e.exports=require("k6/metrics")}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}var n={};(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.uuidv4=e.randomString=e.randomItem=e.randomIntBetween=e.normalDistributionStages=e.findBetween=e.tagWithCurrentStageProfile=e.tagWithCurrentStageIndex=e.getCurrentStageIndex=e.parseDuration=e.check=void 0;var t=r(664);Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return t.parseDuration}}),Object.defineProperty(e,"getCurrentStageIndex",{enumerable:!0,get:function(){return t.getCurrentStageIndex}}),Object.defineProperty(e,"tagWithCurrentStageIndex",{enumerable:!0,get:function(){return t.tagWithCurrentStageIndex}}),Object.defineProperty(e,"tagWithCurrentStageProfile",{enumerable:!0,get:function(){return t.tagWithCurrentStageProfile}});var a=r(599);Object.defineProperty(e,"findBetween",{enumerable:!0,get:function(){return a.findBetween}}),Object.defineProperty(e,"normalDistributionStages",{enumerable:!0,get:function(){return a.normalDistributionStages}}),Object.defineProperty(e,"randomIntBetween",{enumerable:!0,get:function(){return a.randomIntBetween}}),Object.defineProperty(e,"randomItem",{enumerable:!0,get:function(){return a.randomItem}}),Object.defineProperty(e,"randomString",{enumerable:!0,get:function(){return a.randomString}}),Object.defineProperty(e,"uuidv4",{enumerable:!0,get:function(){return a.uuidv4}});var o=r(184);Object.defineProperty(e,"check",{enumerable:!0,get:function(){return o.check}})})();var a=exports;for(var o in n)a[o]=n[o];n.__esModule&&Object.defineProperty(a,"__esModule",{value:!0})})(); +(()=>{"use strict";var e={184:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.check=function(e,t,r){var a=Object.entries(t).map((function(t){var a=t[0],o=t[1];function i(e){return n.add(e?1:0,Object.assign({},r,{check:a})),e}if("function"==typeof o){var u=o(e);return u instanceof Promise?u.then(i):i(u)}return o instanceof Promise?o.then(i):i(o)}));if(a.some((function(e){return e instanceof Promise})))return Promise.all(a).then((function(e){return e.every(Boolean)}));return a.every(Boolean)};var n=new(r(610).Rate)("checks")},664:function(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.parseDuration=o,t.getCurrentStageIndex=u,t.tagWithCurrentStageIndex=function(){a.default.vu.tags.stage=u()},t.tagWithCurrentStageProfile=function(){a.default.vu.tags.stage_profile=function(){var e=u();if(e<1)return"ramp-up";var t=a.default.test.options.scenarios[a.default.scenario.name].stages,r=t[e],n=t[e-1];return r.target>n.target?"ramp-up":n.target==r.target?"steady":"ramp-down"}()};var a=n(r(744));function o(e){if(null==e||e.length<1)throw new Error("str is empty");for(var t=0,r="",n={},a=0;a0&&(t+=parseFloat(r,10)),t}function i(e){return e>="0"&&e<="9"}function u(){var e=a.default.test.options.scenarios[a.default.scenario.name];if(null==e)throw new Error("the exec.test.options object doesn't contain the current scenario ".concat(a.default.scenario.name));if(null==e.stages)throw new Error("only ramping-vus or ramping-arravial-rate supports stages, it is not possible to get a stage index on other executors.");if(e.stages.length<1)throw new Error("the current scenario ".concat(e.name," doesn't contain any stage"));for(var t=0,r=new Date-a.default.scenario.startTime,n=0;n{Object.defineProperty(t,"__esModule",{value:!0}),t.uuidv4=function(e){void 0===e&&(e=!1);return e?function(){for(var e=[],t=0;t<256;++t)e.push((t+256).toString(16).slice(1));var r=new Uint8Array((0,n.randomBytes)(16));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,(e[r[0]]+e[r[1]]+e[r[2]]+e[r[3]]+"-"+e[r[4]]+e[r[5]]+"-"+e[r[6]]+e[r[7]]+"-"+e[r[8]]+e[r[9]]+"-"+e[r[10]]+e[r[11]]+e[r[12]]+e[r[13]]+e[r[14]]+e[r[15]]).toLowerCase()}():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},t.randomIntBetween=function(e,t){return Math.floor(Math.random()*(t-e+1)+e)},t.randomItem=function(e){return e[Math.floor(Math.random()*e.length)]},t.randomString=function(e,t){void 0===t&&(t="abcdefghijklmnopqrstuvwxyz");var r="";for(;e--;)r+=t[Math.random()*t.length|0];return r},t.findBetween=function(e,t,r,n){void 0===n&&(n=!1);var a,o=[],i=0;for(;-1!=(a=e.indexOf(t))&&(a+=t.length,-1!=(i=e.indexOf(r,a)));){var u=e.substring(a,i);if(!n)return u;o.push(u),e=e.substring(i+r.length)}return o.length?o:null},t.normalDistributionStages=function(e,t,r){void 0===r&&(r=10);function n(e,t,r){return Math.exp(-.5*Math.pow((r-e)/t,2))/(t*Math.sqrt(2*Math.PI))}for(var a=new Array(r+2).fill(0),o=new Array(r+2).fill(Math.ceil(t/6)),i=[],u=0;u<=r;u++)a[u]=n(0,1,4*u/r-2);for(var s=Math.max.apply(Math,a),c=a.map((function(t){return Math.round(t*e/s)})),f=1;f<=r;f++)o[f]=Math.ceil(4*t/(6*r));for(var l=0;l<=r+1;l++)i.push({duration:"".concat(o[l],"s"),target:c[l]});return i};var n=r(400)},400:e=>{e.exports=require("k6/crypto")},744:e=>{e.exports=require("k6/execution")},610:e=>{e.exports=require("k6/metrics")}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}var n={};(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.uuidv4=e.randomString=e.randomItem=e.randomIntBetween=e.normalDistributionStages=e.findBetween=e.tagWithCurrentStageProfile=e.tagWithCurrentStageIndex=e.getCurrentStageIndex=e.parseDuration=e.check=void 0;var t=r(664);Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return t.parseDuration}}),Object.defineProperty(e,"getCurrentStageIndex",{enumerable:!0,get:function(){return t.getCurrentStageIndex}}),Object.defineProperty(e,"tagWithCurrentStageIndex",{enumerable:!0,get:function(){return t.tagWithCurrentStageIndex}}),Object.defineProperty(e,"tagWithCurrentStageProfile",{enumerable:!0,get:function(){return t.tagWithCurrentStageProfile}});var a=r(599);Object.defineProperty(e,"findBetween",{enumerable:!0,get:function(){return a.findBetween}}),Object.defineProperty(e,"normalDistributionStages",{enumerable:!0,get:function(){return a.normalDistributionStages}}),Object.defineProperty(e,"randomIntBetween",{enumerable:!0,get:function(){return a.randomIntBetween}}),Object.defineProperty(e,"randomItem",{enumerable:!0,get:function(){return a.randomItem}}),Object.defineProperty(e,"randomString",{enumerable:!0,get:function(){return a.randomString}}),Object.defineProperty(e,"uuidv4",{enumerable:!0,get:function(){return a.uuidv4}});var o=r(184);Object.defineProperty(e,"check",{enumerable:!0,get:function(){return o.check}})})();var a=exports;for(var o in n)a[o]=n[o];n.__esModule&&Object.defineProperty(a,"__esModule",{value:!0})})(); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/build/index.js.map b/build/index.js.map index a90fbd8..e36ea0d 100644 --- a/build/index.js.map +++ b/build/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","mappings":"wCACAA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EAAS,gBAAiB,CAAEqI,YAAY,EAAMC,IAAK,WAAc,OAAOF,EAAY1G,iBAC1G5B,OAAOC,eAAeC,EAAS,uBAAwB,CAAEqI,YAAY,EAAMC,IAAK,WAAc,OAAOF,EAAYzG,wBACjH7B,OAAOC,eAAeC,EAAS,2BAA4B,CAAEqI,YAAY,EAAMC,IAAK,WAAc,OAAOF,EAAYxG,4BACrH9B,OAAOC,eAAeC,EAAS,6BAA8B,CAAEqI,YAAY,EAAMC,IAAK,WAAc,OAAOF,EAAYnG,8BACvH,IAAIsG,EAAa,EAAQ,KACzBzI,OAAOC,eAAeC,EAAS,cAAe,CAAEqI,YAAY,EAAMC,IAAK,WAAc,OAAOC,EAAW/C,eACvG1F,OAAOC,eAAeC,EAAS,2BAA4B,CAAEqI,YAAY,EAAMC,IAAK,WAAc,OAAOC,EAAWpC,4BACpHrG,OAAOC,eAAeC,EAAS,mBAAoB,CAAEqI,YAAY,EAAMC,IAAK,WAAc,OAAOC,EAAWxD,oBAC5GjF,OAAOC,eAAeC,EAAS,aAAc,CAAEqI,YAAY,EAAMC,IAAK,WAAc,OAAOC,EAAWpD,cACtGrF,OAAOC,eAAeC,EAAS,eAAgB,CAAEqI,YAAY,EAAMC,IAAK,WAAc,OAAOC,EAAWlD,gBACxGvF,OAAOC,eAAeC,EAAS,SAAU,CAAEqI,YAAY,EAAMC,IAAK,WAAc,OAAOC,EAAWvE,UAClG,IAAIwE,EAAa,EAAQ,KACzB1I,OAAOC,eAAeC,EAAS,QAAS,CAAEqI,YAAY,EAAMC,IAAK,WAAc,OAAOE,EAAWtI,U","sources":["webpack://k6-jslib-utils/./src/check.ts","webpack://k6-jslib-utils/./src/stages.js","webpack://k6-jslib-utils/./src/utils.js","webpack://k6-jslib-utils/external commonjs \"k6/crypto\"","webpack://k6-jslib-utils/external commonjs \"k6/execution\"","webpack://k6-jslib-utils/external commonjs \"k6/metrics\"","webpack://k6-jslib-utils/webpack/bootstrap","webpack://k6-jslib-utils/./src/index.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.check = check;\nvar metrics_1 = require(\"k6/metrics\");\nvar checkRate = new metrics_1.Rate('checks');\nfunction check(value, checkers) {\n var checkMap = checkers || value;\n var results = Object.entries(checkMap).map(function (_a) {\n var key = _a[0], checker = _a[1];\n function reportResult(value) {\n checkRate.add(value ? 1 : 0, {\n check: key,\n });\n return value;\n }\n if (typeof checker === 'function') {\n var result = checker(value);\n if (result instanceof Promise) {\n return result.then(reportResult);\n }\n return reportResult(result);\n }\n if (checker instanceof Promise) {\n return checker.then(reportResult);\n }\n return reportResult(checker);\n });\n if (results.some(function (result) { return result instanceof Promise; })) {\n return Promise.all(results).then(function (results) { return results.every(Boolean); });\n }\n return results.every(Boolean);\n}\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parseDuration = parseDuration;\nexports.getCurrentStageIndex = getCurrentStageIndex;\nexports.tagWithCurrentStageIndex = tagWithCurrentStageIndex;\nexports.tagWithCurrentStageProfile = tagWithCurrentStageProfile;\nvar execution_1 = __importDefault(require(\"k6/execution\"));\n// parseDuration parses the provided string as an Integer number\n// in millisecond precision\nfunction parseDuration(str) {\n if (str == null || str.length < 1) {\n throw new Error('str is empty');\n }\n // the sum in millisecond of the parsed duration\n var d = 0;\n // current contains the partial seen number\n // it's reset when a time unit is found\n var current = '';\n // it tracks the seen time units\n // and it denies eventual duplicated\n var seen = {};\n for (var i = 0; i < str.length; i++) {\n // append the current char if it's a number or a decimal separator\n if (isNumber(str[i]) || str[i] == '.') {\n current += str[i];\n }\n // return if the next char is not a time unit\n if (str[i + 1] == null || isNumber(str[i + 1]) || str[i + 1] == '.') {\n continue;\n }\n var v = parseFloat(current, 10);\n var next = str[i + 1];\n switch (next) {\n case 'd':\n d += v * 24 * 60 * 60 * 1000;\n break;\n case 'h':\n d += v * 60 * 60 * 1000;\n break;\n case 'm':\n if (i + 2 < str.length && str[i + 2] == 's') {\n // millisecond is the maximum precision\n // truncate eventual decimal\n d += Math.trunc(v);\n i++;\n next = 'ms';\n }\n else {\n d += v * 60 * 1000;\n }\n break;\n case 's':\n d += v * 1000;\n break;\n default:\n throw new Error(\"\".concat(next, \" is an unsupported time unit\"));\n }\n if (seen[next]) {\n throw new Error(\"\".concat(next, \" time unit is provided multiple times\"));\n }\n seen[next] = true;\n i++;\n current = '';\n }\n // flush in case no time unit has been provided\n // for the latest group\n if (current.length > 0) {\n d += parseFloat(current, 10);\n }\n return d;\n}\n// isNumber return true if the c character is a number\nfunction isNumber(c) {\n return c >= '0' && c <= '9';\n}\n// getCurrentStageIndex returns the computed index of the running stage.\nfunction getCurrentStageIndex() {\n var scenario = execution_1.default.test.options.scenarios[execution_1.default.scenario.name];\n if (scenario == null) {\n throw new Error(\"the exec.test.options object doesn't contain the current scenario \".concat(execution_1.default.scenario.name));\n }\n if (scenario.stages == null) {\n throw new Error(\"only ramping-vus or ramping-arravial-rate supports stages, it is not possible to get a stage index on other executors.\");\n }\n if (scenario.stages.length < 1) {\n throw new Error(\"the current scenario \".concat(scenario.name, \" doesn't contain any stage\"));\n }\n var sum = 0;\n var elapsed = new Date() - execution_1.default.scenario.startTime;\n for (var i = 0; i < scenario.stages.length; i++) {\n sum += parseDuration(scenario.stages[i].duration);\n if (elapsed < sum) {\n return i;\n }\n }\n return scenario.stages.length - 1;\n}\n// tagWithCurrentStageIndex adds a tag with a `stage` key\n// and the index of the current running stage as value.\nfunction tagWithCurrentStageIndex() {\n execution_1.default.vu.tags['stage'] = getCurrentStageIndex();\n}\n// tagWithCurrentStageProfile adds a tag with a `stage` key\n// and the profile (ramp-up, steady or ramp-down) computed\n// from the current running stage.\nfunction tagWithCurrentStageProfile() {\n //ramp-up when previous.target < current.target\n //ramp-down when previous.target > current.target\n //steady when prevuious.target = current.target\n var getStageProfile = function () {\n var currentIndex = getCurrentStageIndex();\n if (currentIndex < 1) {\n return 'ramp-up';\n }\n var stages = execution_1.default.test.options.scenarios[execution_1.default.scenario.name].stages;\n var current = stages[currentIndex];\n var previous = stages[currentIndex - 1];\n if (current.target > previous.target) {\n return 'ramp-up';\n }\n if (previous.target == current.target) {\n return 'steady';\n }\n return 'ramp-down';\n };\n execution_1.default.vu.tags['stage_profile'] = getStageProfile();\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.uuidv4 = uuidv4;\nexports.randomIntBetween = randomIntBetween;\nexports.randomItem = randomItem;\nexports.randomString = randomString;\nexports.findBetween = findBetween;\nexports.normalDistributionStages = normalDistributionStages;\nvar crypto_1 = require(\"k6/crypto\");\n/**\n * Produces a Universal Unique Identifier version 4\n *\n * @param {boolean} secure - whether a cryptographically secure generation function should be used\n * @returns {String} - 16 characters hexadecimal representation of the UUID v4\n */\nfunction uuidv4(secure) {\n if (secure === void 0) { secure = false; }\n return secure ? secureUUIDv4() : insecureUUIDv4();\n}\nfunction randomIntBetween(min, max) {\n // min and max included\n return Math.floor(Math.random() * (max - min + 1) + min);\n}\nfunction randomItem(arrayOfItems) {\n return arrayOfItems[Math.floor(Math.random() * arrayOfItems.length)];\n}\nfunction randomString(length, charset) {\n if (charset === void 0) { charset = 'abcdefghijklmnopqrstuvwxyz'; }\n var res = '';\n while (length--)\n res += charset[(Math.random() * charset.length) | 0];\n return res;\n}\nfunction findBetween(content, left, right, repeat) {\n if (repeat === void 0) { repeat = false; }\n var extracted = [];\n var doSearch = true;\n var start, end = 0;\n while (doSearch) {\n start = content.indexOf(left);\n if (start == -1) {\n break; // no more matches\n }\n start += left.length;\n end = content.indexOf(right, start);\n if (end == -1) {\n break; // no more matches\n }\n var extractedContent = content.substring(start, end);\n // stop here if only extracting one match (default behavior)\n if (!repeat) {\n return extractedContent;\n }\n // otherwise, add it to the array\n extracted.push(extractedContent);\n // update the \"cursor\" position to the end of the previous match\n content = content.substring(end + right.length);\n }\n return extracted.length ? extracted : null; // return all matches as an array or null\n}\nfunction normalDistributionStages(maxVus, durationSeconds, numberOfStages) {\n if (numberOfStages === void 0) { numberOfStages = 10; }\n function normalDensity(mean, scale, x) {\n return (Math.exp((-1 / 2) * Math.pow((x - mean) / scale, 2)) / (scale * Math.sqrt(2 * Math.PI)));\n }\n var mean = 0;\n var scale = 1;\n var curve = new Array(numberOfStages + 2).fill(0);\n var durations = new Array(numberOfStages + 2).fill(Math.ceil(durationSeconds / 6));\n var k6stages = [];\n for (var i = 0; i <= numberOfStages; i++) {\n curve[i] = normalDensity(mean, scale, -2 * scale + (4 * scale * i) / numberOfStages);\n }\n var peakDistribution = Math.max.apply(Math, curve);\n var vus = curve.map(function (x) { return Math.round((x * maxVus) / peakDistribution); });\n for (var j = 1; j <= numberOfStages; j++) {\n durations[j] = Math.ceil((4 * durationSeconds) / (6 * numberOfStages));\n }\n for (var k = 0; k <= numberOfStages + 1; k++) {\n k6stages.push({ duration: \"\".concat(durations[k], \"s\"), target: vus[k] });\n }\n return k6stages;\n}\n/**\n * Fast UUID v4 producer\n *\n * Note that this function does not produce cryptographically\n * secure UUIDs. If you need safe UUIDs, use the secureUUIDv4\n * implementation instead.\n *\n * @returns {String} - 16 characters hexadecimal representation of the UUID v4\n */\nfunction insecureUUIDv4() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = (Math.random() * 16) | 0, v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n/**\n * Cryptographically secure UUID v4 producer\n *\n * Note that this implementation involves a computation\n * overhead.\n *\n * @returns {String} - 16 characters hexadecimal representation of the UUID v4\n */\nfunction secureUUIDv4() {\n /**\n * bytes conversion table used to convert UUIDs bytes\n * to string form.\n */\n var byteToHex = [];\n for (var i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n }\n /**\n * produce 16 random bytes, and set UUID v4's specific\n * version and `clock_seq_hi_and_reserved` bits.\n */\n var rnds = new Uint8Array((0, crypto_1.randomBytes)(16));\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n /**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n return (byteToHex[rnds[0]] +\n byteToHex[rnds[1]] +\n byteToHex[rnds[2]] +\n byteToHex[rnds[3]] +\n '-' +\n byteToHex[rnds[4]] +\n byteToHex[rnds[5]] +\n '-' +\n byteToHex[rnds[6]] +\n byteToHex[rnds[7]] +\n '-' +\n byteToHex[rnds[8]] +\n byteToHex[rnds[9]] +\n '-' +\n byteToHex[rnds[10]] +\n byteToHex[rnds[11]] +\n byteToHex[rnds[12]] +\n byteToHex[rnds[13]] +\n byteToHex[rnds[14]] +\n byteToHex[rnds[15]]).toLowerCase();\n}\n","module.exports = require(\"k6/crypto\");","module.exports = require(\"k6/execution\");","module.exports = require(\"k6/metrics\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.uuidv4 = exports.randomString = exports.randomItem = exports.randomIntBetween = exports.normalDistributionStages = exports.findBetween = exports.tagWithCurrentStageProfile = exports.tagWithCurrentStageIndex = exports.getCurrentStageIndex = exports.parseDuration = exports.check = void 0;\nvar stages_js_1 = require(\"./stages.js\");\nObject.defineProperty(exports, \"parseDuration\", { enumerable: true, get: function () { return stages_js_1.parseDuration; } });\nObject.defineProperty(exports, \"getCurrentStageIndex\", { enumerable: true, get: function () { return stages_js_1.getCurrentStageIndex; } });\nObject.defineProperty(exports, \"tagWithCurrentStageIndex\", { enumerable: true, get: function () { return stages_js_1.tagWithCurrentStageIndex; } });\nObject.defineProperty(exports, \"tagWithCurrentStageProfile\", { enumerable: true, get: function () { return stages_js_1.tagWithCurrentStageProfile; } });\nvar utils_js_1 = require(\"./utils.js\");\nObject.defineProperty(exports, \"findBetween\", { enumerable: true, get: function () { return utils_js_1.findBetween; } });\nObject.defineProperty(exports, \"normalDistributionStages\", { enumerable: true, get: function () { return utils_js_1.normalDistributionStages; } });\nObject.defineProperty(exports, \"randomIntBetween\", { enumerable: true, get: function () { return utils_js_1.randomIntBetween; } });\nObject.defineProperty(exports, \"randomItem\", { enumerable: true, get: function () { return utils_js_1.randomItem; } });\nObject.defineProperty(exports, \"randomString\", { enumerable: true, get: function () { return utils_js_1.randomString; } });\nObject.defineProperty(exports, \"uuidv4\", { enumerable: true, get: function () { return utils_js_1.uuidv4; } });\nvar check_ts_1 = require(\"./check.ts\");\nObject.defineProperty(exports, \"check\", { enumerable: true, get: function () { return check_ts_1.check; } });\n"],"names":["Object","defineProperty","exports","value","check","checkers","checkMap","results","entries","map","_a","key","checker","reportResult","checkRate","add","result","Promise","then","some","all","every","Boolean","Rate","__importDefault","this","mod","__esModule","parseDuration","getCurrentStageIndex","tagWithCurrentStageIndex","execution_1","default","vu","tags","tagWithCurrentStageProfile","currentIndex","stages","test","options","scenarios","scenario","name","current","previous","target","getStageProfile","str","length","Error","d","seen","i","isNumber","v","parseFloat","next","Math","trunc","concat","c","sum","elapsed","Date","startTime","duration","uuidv4","secure","byteToHex","push","toString","slice","rnds","Uint8Array","crypto_1","randomBytes","toLowerCase","secureUUIDv4","replace","r","random","randomIntBetween","min","max","floor","randomItem","arrayOfItems","randomString","charset","res","findBetween","content","left","right","repeat","start","extracted","end","indexOf","extractedContent","substring","normalDistributionStages","maxVus","durationSeconds","numberOfStages","normalDensity","mean","scale","x","exp","pow","sqrt","PI","curve","Array","fill","durations","ceil","k6stages","peakDistribution","apply","vus","round","j","k","module","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","call","stages_js_1","enumerable","get","utils_js_1","check_ts_1"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.js","mappings":"wCACAA,OAAOC,eAAeC,EAAS,aAAc,CAAEC,OAAO,IACtDD,EAAQE,MAGR,SAAeD,EAAOE,EAAUC,GAC5B,IAAIC,EAAUP,OAAOQ,QAAQH,GAAUI,KAAI,SAAUC,GACjD,IAAIC,EAAMD,EAAG,GAAIE,EAAUF,EAAG,GAC9B,SAASG,EAAaV,GAIlB,OAHAW,EAAUC,IAAIZ,EAAQ,EAAI,EAAGH,OAAOgB,OAAO,GAAIV,EAAM,CACjDF,MAAOO,KAEJR,EAEX,GAAuB,mBAAZS,EAAwB,CAC/B,IAAIK,EAASL,EAAQT,GACrB,OAAIc,aAAkBC,QACXD,EAAOE,KAAKN,GAEhBA,EAAaI,GAExB,OAAIL,aAAmBM,QACZN,EAAQO,KAAKN,GAEjBA,EAAaD,MAExB,GAAIL,EAAQa,MAAK,SAAUH,GAAU,OAAOA,aAAkBC,WAC1D,OAAOA,QAAQG,IAAId,GAASY,MAAK,SAAUZ,GAAW,OAAOA,EAAQe,MAAMC,YAE/E,OAAOhB,EAAQe,MAAMC,UA1BzB,IACIT,EAAY,IADA,EAAQ,KACMU,MAAK,W,oBCHnC,IAAIC,EAAmBC,MAAQA,KAAKD,iBAAoB,SAAUE,GAC9D,OAAQA,GAAOA,EAAIC,WAAcD,EAAM,CAAE,QAAWA,IAExD3B,OAAOC,eAAeC,EAAS,aAAc,CAAEC,OAAO,IACtDD,EAAQ2B,cAAgBA,EACxB3B,EAAQ4B,qBAAuBA,EAC/B5B,EAAQ6B,yBA+FR,WACIC,EAAYC,QAAQC,GAAG5B,KAAY,MAAIw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,YAAY,EAAMC,IAAK,WAAc,OAAOE,EAAWtI,U","sources":["webpack://k6-jslib-utils/./src/check.ts","webpack://k6-jslib-utils/./src/stages.js","webpack://k6-jslib-utils/./src/utils.js","webpack://k6-jslib-utils/external commonjs \"k6/crypto\"","webpack://k6-jslib-utils/external commonjs \"k6/execution\"","webpack://k6-jslib-utils/external commonjs \"k6/metrics\"","webpack://k6-jslib-utils/webpack/bootstrap","webpack://k6-jslib-utils/./src/index.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.check = check;\nvar metrics_1 = require(\"k6/metrics\");\nvar checkRate = new metrics_1.Rate('checks');\nfunction check(value, checkers, tags) {\n var results = Object.entries(checkers).map(function (_a) {\n var key = _a[0], checker = _a[1];\n function reportResult(value) {\n checkRate.add(value ? 1 : 0, Object.assign({}, tags, {\n check: key,\n }));\n return value;\n }\n if (typeof checker === 'function') {\n var result = checker(value);\n if (result instanceof Promise) {\n return result.then(reportResult);\n }\n return reportResult(result);\n }\n if (checker instanceof Promise) {\n return checker.then(reportResult);\n }\n return reportResult(checker);\n });\n if (results.some(function (result) { return result instanceof Promise; })) {\n return Promise.all(results).then(function (results) { return results.every(Boolean); });\n }\n return results.every(Boolean);\n}\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parseDuration = parseDuration;\nexports.getCurrentStageIndex = getCurrentStageIndex;\nexports.tagWithCurrentStageIndex = tagWithCurrentStageIndex;\nexports.tagWithCurrentStageProfile = tagWithCurrentStageProfile;\nvar execution_1 = __importDefault(require(\"k6/execution\"));\n// parseDuration parses the provided string as an Integer number\n// in millisecond precision\nfunction parseDuration(str) {\n if (str == null || str.length < 1) {\n throw new Error('str is empty');\n }\n // the sum in millisecond of the parsed duration\n var d = 0;\n // current contains the partial seen number\n // it's reset when a time unit is found\n var current = '';\n // it tracks the seen time units\n // and it denies eventual duplicated\n var seen = {};\n for (var i = 0; i < str.length; i++) {\n // append the current char if it's a number or a decimal separator\n if (isNumber(str[i]) || str[i] == '.') {\n current += str[i];\n }\n // return if the next char is not a time unit\n if (str[i + 1] == null || isNumber(str[i + 1]) || str[i + 1] == '.') {\n continue;\n }\n var v = parseFloat(current, 10);\n var next = str[i + 1];\n switch (next) {\n case 'd':\n d += v * 24 * 60 * 60 * 1000;\n break;\n case 'h':\n d += v * 60 * 60 * 1000;\n break;\n case 'm':\n if (i + 2 < str.length && str[i + 2] == 's') {\n // millisecond is the maximum precision\n // truncate eventual decimal\n d += Math.trunc(v);\n i++;\n next = 'ms';\n }\n else {\n d += v * 60 * 1000;\n }\n break;\n case 's':\n d += v * 1000;\n break;\n default:\n throw new Error(\"\".concat(next, \" is an unsupported time unit\"));\n }\n if (seen[next]) {\n throw new Error(\"\".concat(next, \" time unit is provided multiple times\"));\n }\n seen[next] = true;\n i++;\n current = '';\n }\n // flush in case no time unit has been provided\n // for the latest group\n if (current.length > 0) {\n d += parseFloat(current, 10);\n }\n return d;\n}\n// isNumber return true if the c character is a number\nfunction isNumber(c) {\n return c >= '0' && c <= '9';\n}\n// getCurrentStageIndex returns the computed index of the running stage.\nfunction getCurrentStageIndex() {\n var scenario = execution_1.default.test.options.scenarios[execution_1.default.scenario.name];\n if (scenario == null) {\n throw new Error(\"the exec.test.options object doesn't contain the current scenario \".concat(execution_1.default.scenario.name));\n }\n if (scenario.stages == null) {\n throw new Error(\"only ramping-vus or ramping-arravial-rate supports stages, it is not possible to get a stage index on other executors.\");\n }\n if (scenario.stages.length < 1) {\n throw new Error(\"the current scenario \".concat(scenario.name, \" doesn't contain any stage\"));\n }\n var sum = 0;\n var elapsed = new Date() - execution_1.default.scenario.startTime;\n for (var i = 0; i < scenario.stages.length; i++) {\n sum += parseDuration(scenario.stages[i].duration);\n if (elapsed < sum) {\n return i;\n }\n }\n return scenario.stages.length - 1;\n}\n// tagWithCurrentStageIndex adds a tag with a `stage` key\n// and the index of the current running stage as value.\nfunction tagWithCurrentStageIndex() {\n execution_1.default.vu.tags['stage'] = getCurrentStageIndex();\n}\n// tagWithCurrentStageProfile adds a tag with a `stage` key\n// and the profile (ramp-up, steady or ramp-down) computed\n// from the current running stage.\nfunction tagWithCurrentStageProfile() {\n //ramp-up when previous.target < current.target\n //ramp-down when previous.target > current.target\n //steady when prevuious.target = current.target\n var getStageProfile = function () {\n var currentIndex = getCurrentStageIndex();\n if (currentIndex < 1) {\n return 'ramp-up';\n }\n var stages = execution_1.default.test.options.scenarios[execution_1.default.scenario.name].stages;\n var current = stages[currentIndex];\n var previous = stages[currentIndex - 1];\n if (current.target > previous.target) {\n return 'ramp-up';\n }\n if (previous.target == current.target) {\n return 'steady';\n }\n return 'ramp-down';\n };\n execution_1.default.vu.tags['stage_profile'] = getStageProfile();\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.uuidv4 = uuidv4;\nexports.randomIntBetween = randomIntBetween;\nexports.randomItem = randomItem;\nexports.randomString = randomString;\nexports.findBetween = findBetween;\nexports.normalDistributionStages = normalDistributionStages;\nvar crypto_1 = require(\"k6/crypto\");\n/**\n * Produces a Universal Unique Identifier version 4\n *\n * @param {boolean} secure - whether a cryptographically secure generation function should be used\n * @returns {String} - 16 characters hexadecimal representation of the UUID v4\n */\nfunction uuidv4(secure) {\n if (secure === void 0) { secure = false; }\n return secure ? secureUUIDv4() : insecureUUIDv4();\n}\nfunction randomIntBetween(min, max) {\n // min and max included\n return Math.floor(Math.random() * (max - min + 1) + min);\n}\nfunction randomItem(arrayOfItems) {\n return arrayOfItems[Math.floor(Math.random() * arrayOfItems.length)];\n}\nfunction randomString(length, charset) {\n if (charset === void 0) { charset = 'abcdefghijklmnopqrstuvwxyz'; }\n var res = '';\n while (length--)\n res += charset[(Math.random() * charset.length) | 0];\n return res;\n}\nfunction findBetween(content, left, right, repeat) {\n if (repeat === void 0) { repeat = false; }\n var extracted = [];\n var doSearch = true;\n var start, end = 0;\n while (doSearch) {\n start = content.indexOf(left);\n if (start == -1) {\n break; // no more matches\n }\n start += left.length;\n end = content.indexOf(right, start);\n if (end == -1) {\n break; // no more matches\n }\n var extractedContent = content.substring(start, end);\n // stop here if only extracting one match (default behavior)\n if (!repeat) {\n return extractedContent;\n }\n // otherwise, add it to the array\n extracted.push(extractedContent);\n // update the \"cursor\" position to the end of the previous match\n content = content.substring(end + right.length);\n }\n return extracted.length ? extracted : null; // return all matches as an array or null\n}\nfunction normalDistributionStages(maxVus, durationSeconds, numberOfStages) {\n if (numberOfStages === void 0) { numberOfStages = 10; }\n function normalDensity(mean, scale, x) {\n return (Math.exp((-1 / 2) * Math.pow((x - mean) / scale, 2)) / (scale * Math.sqrt(2 * Math.PI)));\n }\n var mean = 0;\n var scale = 1;\n var curve = new Array(numberOfStages + 2).fill(0);\n var durations = new Array(numberOfStages + 2).fill(Math.ceil(durationSeconds / 6));\n var k6stages = [];\n for (var i = 0; i <= numberOfStages; i++) {\n curve[i] = normalDensity(mean, scale, -2 * scale + (4 * scale * i) / numberOfStages);\n }\n var peakDistribution = Math.max.apply(Math, curve);\n var vus = curve.map(function (x) { return Math.round((x * maxVus) / peakDistribution); });\n for (var j = 1; j <= numberOfStages; j++) {\n durations[j] = Math.ceil((4 * durationSeconds) / (6 * numberOfStages));\n }\n for (var k = 0; k <= numberOfStages + 1; k++) {\n k6stages.push({ duration: \"\".concat(durations[k], \"s\"), target: vus[k] });\n }\n return k6stages;\n}\n/**\n * Fast UUID v4 producer\n *\n * Note that this function does not produce cryptographically\n * secure UUIDs. If you need safe UUIDs, use the secureUUIDv4\n * implementation instead.\n *\n * @returns {String} - 16 characters hexadecimal representation of the UUID v4\n */\nfunction insecureUUIDv4() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = (Math.random() * 16) | 0, v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n/**\n * Cryptographically secure UUID v4 producer\n *\n * Note that this implementation involves a computation\n * overhead.\n *\n * @returns {String} - 16 characters hexadecimal representation of the UUID v4\n */\nfunction secureUUIDv4() {\n /**\n * bytes conversion table used to convert UUIDs bytes\n * to string form.\n */\n var byteToHex = [];\n for (var i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n }\n /**\n * produce 16 random bytes, and set UUID v4's specific\n * version and `clock_seq_hi_and_reserved` bits.\n */\n var rnds = new Uint8Array((0, crypto_1.randomBytes)(16));\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n /**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n return (byteToHex[rnds[0]] +\n byteToHex[rnds[1]] +\n byteToHex[rnds[2]] +\n byteToHex[rnds[3]] +\n '-' +\n byteToHex[rnds[4]] +\n byteToHex[rnds[5]] +\n '-' +\n byteToHex[rnds[6]] +\n byteToHex[rnds[7]] +\n '-' +\n byteToHex[rnds[8]] +\n byteToHex[rnds[9]] +\n '-' +\n byteToHex[rnds[10]] +\n byteToHex[rnds[11]] +\n byteToHex[rnds[12]] +\n byteToHex[rnds[13]] +\n byteToHex[rnds[14]] +\n byteToHex[rnds[15]]).toLowerCase();\n}\n","module.exports = require(\"k6/crypto\");","module.exports = require(\"k6/execution\");","module.exports = require(\"k6/metrics\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.uuidv4 = exports.randomString = exports.randomItem = exports.randomIntBetween = exports.normalDistributionStages = exports.findBetween = exports.tagWithCurrentStageProfile = exports.tagWithCurrentStageIndex = exports.getCurrentStageIndex = exports.parseDuration = exports.check = void 0;\nvar stages_js_1 = require(\"./stages.js\");\nObject.defineProperty(exports, \"parseDuration\", { enumerable: true, get: function () { return stages_js_1.parseDuration; } });\nObject.defineProperty(exports, \"getCurrentStageIndex\", { enumerable: true, get: function () { return stages_js_1.getCurrentStageIndex; } });\nObject.defineProperty(exports, \"tagWithCurrentStageIndex\", { enumerable: true, get: function () { return stages_js_1.tagWithCurrentStageIndex; } });\nObject.defineProperty(exports, \"tagWithCurrentStageProfile\", { enumerable: true, get: function () { return stages_js_1.tagWithCurrentStageProfile; } });\nvar utils_js_1 = require(\"./utils.js\");\nObject.defineProperty(exports, \"findBetween\", { enumerable: true, get: function () { return utils_js_1.findBetween; } });\nObject.defineProperty(exports, \"normalDistributionStages\", { enumerable: true, get: function () { return utils_js_1.normalDistributionStages; } });\nObject.defineProperty(exports, \"randomIntBetween\", { enumerable: true, get: function () { return utils_js_1.randomIntBetween; } });\nObject.defineProperty(exports, \"randomItem\", { enumerable: true, get: function () { return utils_js_1.randomItem; } });\nObject.defineProperty(exports, \"randomString\", { enumerable: true, get: function () { return utils_js_1.randomString; } });\nObject.defineProperty(exports, \"uuidv4\", { enumerable: true, get: function () { return utils_js_1.uuidv4; } });\nvar check_ts_1 = require(\"./check.ts\");\nObject.defineProperty(exports, \"check\", { enumerable: true, get: function () { return check_ts_1.check; } });\n"],"names":["Object","defineProperty","exports","value","check","checkers","tags","results","entries","map","_a","key","checker","reportResult","checkRate","add","assign","result","Promise","then","some","all","every","Boolean","Rate","__importDefault","this","mod","__esModule","parseDuration","getCurrentStageIndex","tagWithCurrentStageIndex","execution_1","default","vu","tagWithCurrentStageProfile","currentIndex","stages","test","options","scenarios","scenario","name","current","previous","target","getStageProfile","str","length","Error","d","seen","i","isNumber","v","parseFloat","next","Math","trunc","concat","c","sum","elapsed","Date","startTime","duration","uuidv4","secure","byteToHex","push","toString","slice","rnds","Uint8Array","crypto_1","randomBytes","toLowerCase","secureUUIDv4","replace","r","random","randomIntBetween","min","max","floor","randomItem","arrayOfItems","randomString","charset","res","findBetween","content","left","right","repeat","start","extracted","end","indexOf","extractedContent","substring","normalDistributionStages","maxVus","durationSeconds","numberOfStages","normalDensity","mean","scale","x","exp","pow","sqrt","PI","curve","Array","fill","durations","ceil","k6stages","peakDistribution","apply","vus","round","j","k","module","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","call","stages_js_1","enumerable","get","utils_js_1","check_ts_1"],"sourceRoot":""} \ No newline at end of file diff --git a/tests/check.ts b/tests/check.ts index 6fa1eb2..8f9b22a 100644 --- a/tests/check.ts +++ b/tests/check.ts @@ -14,38 +14,38 @@ function later(value: () => T, delay = 100) { } export default async function () { - const syncFnFailed = asyncCheck({ + const syncFnFailed = asyncCheck("", { "I should always fail": () => false, }) satisfies boolean - const syncFnPassed = asyncCheck({ + const syncFnPassed = asyncCheck("", { "I should always pass": () => true, }) satisfies boolean - const asyncFnFailedPromise = asyncCheck({ + const asyncFnFailedPromise = asyncCheck("", { "I should always fail": () => later(() => false), }) satisfies Promise - - const asyncFnPassedPromise = asyncCheck({ + + const asyncFnPassedPromise = asyncCheck("", { "I should always pass": () => later(() => true), }) satisfies Promise const asyncFnFailed = await asyncFnFailedPromise const asyncFnPassed = await asyncFnPassedPromise - const syncValueFailed = asyncCheck({ + const syncValueFailed = asyncCheck("", { "I should always fail": 0, }) satisfies boolean - const syncValuePassed = asyncCheck({ + const syncValuePassed = asyncCheck("", { "I should always pass": 1, }) satisfies boolean - const asyncValueFailedPromise = asyncCheck({ + const asyncValueFailedPromise = asyncCheck("", { "I should always fail": later(() => 0), }) satisfies Promise - const asyncValuePassedPromise = asyncCheck({ + const asyncValuePassedPromise = asyncCheck("", { "I should always pass": later(() => 1), }) satisfies Promise @@ -58,7 +58,7 @@ export default async function () { let executedAsync = true - asyncCheck({ + asyncCheck("", { "I should always pass": later(() => { executedAsync = false @@ -66,14 +66,14 @@ export default async function () { }, 1000), }) - const failsIfAnyFail = await asyncCheck({ + const failsIfAnyFail = await asyncCheck("", { "I should always fail": () => later(() => false), "I should always pass": later(() => true), "I should also always fail": () => null, "I should also always pass": 1, }) - - const passIfAllPass = await asyncCheck({ + + const passIfAllPass = await asyncCheck("", { "I should always pass": () => later(() => true), "I should also always pass": later(() => true), "This should pass too": () => "null", From 8cd5ebad8e5c0cf91ab09a37e28bdb71a2e8ffcd Mon Sep 17 00:00:00 2001 From: Johan Suleiko Allansson Date: Fri, 16 Aug 2024 10:43:53 +0200 Subject: [PATCH 7/8] rename FalsyCheckValue to just CheckValue --- src/check.ts | 14 +++++++------- tests/check.ts | 9 +++++++-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/check.ts b/src/check.ts index 92be4cb..b9aa5ae 100644 --- a/src/check.ts +++ b/src/check.ts @@ -1,6 +1,6 @@ import { Rate } from 'k6/metrics' -type FalsyCheckValue = +type CheckValue = | Array | Record | boolean @@ -10,17 +10,17 @@ type FalsyCheckValue = | undefined type Checker = - | ((value: T) => FalsyCheckValue) - | ((value: T) => Promise) - | FalsyCheckValue - | Promise + | ((value: T) => CheckValue) + | ((value: T) => Promise) + | CheckValue + | Promise interface CheckMap { [key: string]: Checker } interface SyncCheckMap { - [key: string]: ((value: any) => FalsyCheckValue) | FalsyCheckValue + [key: string]: ((value: any) => CheckValue) | CheckValue } type CheckResult> = C extends SyncCheckMap ? boolean : Promise @@ -33,7 +33,7 @@ export function check>( tags?: Record ): CheckResult { const results = Object.entries(checkers).map(([key, checker]) => { - function reportResult(value: FalsyCheckValue): FalsyCheckValue { + function reportResult(value: CheckValue): CheckValue { checkRate.add( value ? 1 : 0, Object.assign({}, tags, { diff --git a/tests/check.ts b/tests/check.ts index 8f9b22a..dd11272 100644 --- a/tests/check.ts +++ b/tests/check.ts @@ -79,7 +79,11 @@ export default async function () { "This should pass too": () => "null", "And this should pass": 1 }) - + + const tagged = asyncCheck("", { + "I have tags": () => true, + }, { hello: "world" }) satisfies boolean + check(0, { "Function: sync check failed": () => syncFnFailed === false, "Function: sync check passed": () => syncFnPassed === true, @@ -93,5 +97,6 @@ export default async function () { "Executes check asynchronously": () => executedAsync === true, "Fail if any check fails": () => failsIfAnyFail === false, "Pass if all checks pass": () => passIfAllPass === true, - }) + "Could use tags": () => tagged === true, + }) } From f01e1f05ca5beda8647f960f38e544848a0ee77a Mon Sep 17 00:00:00 2001 From: Johan Suleiko Allansson Date: Fri, 16 Aug 2024 11:12:36 +0200 Subject: [PATCH 8/8] build files --- build/check.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/check.d.ts b/build/check.d.ts index 63b396a..212031f 100644 --- a/build/check.d.ts +++ b/build/check.d.ts @@ -1,10 +1,10 @@ -type FalsyCheckValue = Array | Record | boolean | string | number | null | undefined; -type Checker = ((value: T) => FalsyCheckValue) | ((value: T) => Promise) | FalsyCheckValue | Promise; +type CheckValue = Array | Record | boolean | string | number | null | undefined; +type Checker = ((value: T) => CheckValue) | ((value: T) => Promise) | CheckValue | Promise; interface CheckMap { [key: string]: Checker; } interface SyncCheckMap { - [key: string]: ((value: any) => FalsyCheckValue) | FalsyCheckValue; + [key: string]: ((value: any) => CheckValue) | CheckValue; } type CheckResult> = C extends SyncCheckMap ? boolean : Promise; export declare function check>(value: T, checkers: C, tags?: Record): CheckResult;