From 19b3d04324fd1ad4ff7824621b6768e2da85ef15 Mon Sep 17 00:00:00 2001 From: oleiade Date: Wed, 13 Apr 2022 11:45:39 +0200 Subject: [PATCH] Switch initial js code to typescript --- babel.config.json | 16 +- build/aws.min.js | 2 +- build/aws.min.js.map | 2 +- examples/secrets-manager.js | 4 +- package-lock.json | 1521 ++++++++++++++++- package.json | 12 +- src/{index.js => index.ts} | 8 +- src/internal/{client.js => client.ts} | 31 +- src/internal/{config.js => config.ts} | 10 +- src/internal/{error.js => error.ts} | 6 +- src/internal/http.ts | 10 + src/internal/{s3.js => s3.ts} | 190 +- ...{secrets-manager.js => secrets-manager.ts} | 201 ++- src/internal/{signature.js => signature.ts} | 164 +- src/internal/uuid.js | 218 --- tsconfig.json | 26 + webpack.config.js | 50 +- 17 files changed, 2004 insertions(+), 467 deletions(-) rename src/{index.js => index.ts} (87%) rename src/internal/{client.js => client.ts} (67%) rename src/internal/{config.js => config.ts} (86%) rename src/internal/{error.js => error.ts} (88%) create mode 100644 src/internal/http.ts rename src/internal/{s3.js => s3.ts} (60%) rename src/internal/{secrets-manager.js => secrets-manager.ts} (64%) rename src/internal/{signature.js => signature.ts} (81%) delete mode 100644 src/internal/uuid.js create mode 100644 tsconfig.json diff --git a/babel.config.json b/babel.config.json index fb9e49a..e8b797d 100644 --- a/babel.config.json +++ b/babel.config.json @@ -1,8 +1,10 @@ { - "presets": [ - [ - "@babel/preset-env" - ] - ], - "plugins": [ "@babel/plugin-transform-block-scoping"] -} + "presets": ["@babel/env", "@babel/typescript"], + "plugins": [ + "@babel/proposal-class-properties", + + "@babel/proposal-object-rest-spread", + + "@babel/plugin-transform-block-scoping" + ] +} \ No newline at end of file diff --git a/build/aws.min.js b/build/aws.min.js index bb69540..86a7537 100644 --- a/build/aws.min.js +++ b/build/aws.min.js @@ -1,2 +1,2 @@ -(()=>{var e={41:(e,t)=>{var r,n,o,i;function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}i=function(){return function e(t,r,n){function o(c,a){if(!r[c]){if(!t[c]){if(i)return i(c,!0);var u=new Error("Cannot find module '"+c+"'");throw u.code="MODULE_NOT_FOUND",u}var s=r[c]={exports:{}};t[c][0].call(s.exports,(function(e){return o(t[c][1][e]||e)}),s,s.exports,e,t,r,n)}return r[c].exports}for(var i=void 0,c=0;c>>((3&t)<<3)&255;return i}}},{}],4:[function(e,t,r){var n,o,i=e("./lib/rng"),c=e("./lib/bytesToUuid"),a=0,u=0;t.exports=function(e,t,r){var s=t&&r||0,f=t||[],l=(e=e||{}).node||n,p=void 0!==e.clockseq?e.clockseq:o;if(null==l||null==p){var y=i();null==l&&(l=n=[1|y[0],y[1],y[2],y[3],y[4],y[5]]),null==p&&(p=o=16383&(y[6]<<8|y[7]))}var h=void 0!==e.msecs?e.msecs:(new Date).getTime(),d=void 0!==e.nsecs?e.nsecs:u+1,b=h-a+(d-u)/1e4;if(b<0&&void 0===e.clockseq&&(p=p+1&16383),(b<0||h>a)&&void 0===e.nsecs&&(d=0),d>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=h,u=d,o=p;var v=(1e4*(268435455&(h+=122192928e5))+d)%4294967296;f[s++]=v>>>24&255,f[s++]=v>>>16&255,f[s++]=v>>>8&255,f[s++]=255&v;var m=h/4294967296*1e4&268435455;f[s++]=m>>>8&255,f[s++]=255&m,f[s++]=m>>>24&15|16,f[s++]=m>>>16&255,f[s++]=p>>>8|128,f[s++]=255&p;for(var g=0;g<6;++g)f[s+g]=l[g];return t||c(f)}},{"./lib/bytesToUuid":2,"./lib/rng":3}],5:[function(e,t,r){var n=e("./lib/rng"),o=e("./lib/bytesToUuid");t.exports=function(e,t,r){var i=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var c=(e=e||{}).random||(e.rng||n)();if(c[6]=15&c[6]|64,c[8]=63&c[8]|128,t)for(var a=0;a<16;++a)t[i+a]=c[a];return t||o(c)}},{"./lib/bytesToUuid":2,"./lib/rng":3}]},{},[1])(1)},"object"===c(t)?e.exports=i():(n=[],void 0===(o="function"==typeof(r=i)?r.apply(t,n):r)||(e.exports=o))}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{AWSConfig:()=>h,InvalidAWSConfigError:()=>d,InvalidSignatureError:()=>H,S3Bucket:()=>ue,S3Client:()=>ae,S3Object:()=>se,S3ServiceError:()=>fe,Secret:()=>Ce,SecretsManagerClient:()=>Pe,SecretsManagerError:()=>Te,URIEncodingConfig:()=>X,signHeaders:()=>q});const e=require("k6/crypto");var t=r.n(e);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){if(t&&("object"===o(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function c(e){var t="function"==typeof Map?new Map:void 0;return c=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return a(e,arguments,f(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s(n,e)},c(e)}function a(e,t,r){return a=u()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&s(o,r.prototype),o},a.apply(null,arguments)}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function l(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r="A"&&r<="Z"||r>="a"&&r<="z"||function(e){return e>="0"&&e<="9"}(e)||"-._~".includes(e)?e:" "==e?"%20":"/"==e&&t?"/":"%"+e.charCodeAt(0).toString(16).toUpperCase();var r})).join("")}var X=A((function e(t,r){x(this,e),this.double=t,this.path=r}));function W(e){return new Date(e).toISOString().replace(/[:\-]|\.\d{3}/g,"")}function J(e){return W(e).substring(0,8)}const V=require("k6/http");var Y=r.n(V);function G(e,t){for(var r=0;r5&&void 0!==arguments[5]?arguments[5]:null;Z(this,e),this.key=t,this.lastModified=r,this.etag=n,this.size=o,this.storageClass=i||"",this.data=c})),fe=function(e){re(r,e);var t=oe(r);function r(e,n,o){var i;return Z(this,r),(i=t.call(this,e,n)).name="S3ServiceError",i.operation=o,i}return Q(r)}(R),le=r(41);function pe(e){return pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pe(e)}function ye(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function he(e){for(var t=1;t3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[];o=o||(0,le.v4)();var c=JSON.stringify({Name:e,Description:n,SecretString:t,ClientRequestToken:o,Tags:i}),a=ge(Re(r.prototype),"buildRequest",this).call(this,this.method,this.host,"/","",c,he(he({},this.commonHeaders),{},{"X-Amz-Target":"".concat(this.serviceName,".CreateSecret")})),u=a.url,s=a.headers,f=Y().request(this.method,u,c,{headers:s});return this._handle_error("CreateSecret",f),Ce.fromJSON(f.json())}},{key:"putSecretValue",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;n=n||(0,le.v4)();var o=JSON.stringify({SecretId:e,SecretString:t,ClientRequestToken:n}),i=ge(Re(r.prototype),"buildRequest",this).call(this,this.method,this.host,"/","",o,he(he({},this.commonHeaders),{},{"X-Amz-Target":"".concat(this.serviceName,".PutSecretValue")})),c=i.url,a=i.headers,u=Y().request(this.method,c,o,{headers:a});return this._handle_error("PutSecretValue",u),Ce.fromJSON(u.json())}},{key:"deleteSecret",value:function(e,t){var n=t.recoveryWindow,o=void 0===n?30:n,i=t.noRecovery,c={SecretId:e};!0===(void 0!==i&&i)?c.ForceDeleteWithoutRecovery=!0:c.RecoveryWindowInDays=o;var a=JSON.stringify(c),u=ge(Re(r.prototype),"buildRequest",this).call(this,this.method,this.host,"/","",a,he(he({},this.commonHeaders),{},{"X-Amz-Target":"".concat(this.serviceName,".DeleteSecret")})),s=u.url,f=u.headers,l=Y().request(this.method,s,a,{headers:f});this._handle_error("DeleteSecret",l)}},{key:"host",get:function(){return"".concat(this.serviceName,".").concat(this.awsConfig.region,".amazonaws.com")}},{key:"_handle_error",value:function(e,t){var r=t.error_code;if(0!==r){var n=t.json();if(r>=1400&&r<=1499){var o=n.Message||n.message||n.__type;if("InvalidSignatureException"===n.__type)throw new H(o,n.__type);throw new Te(o,n.__type,e)}if(1500===r)throw new Te("An error occured on the server side","InternalServiceError",e)}}}]),r}(F),Ce=function(){function e(t,r,n,o,i,c){var a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:[];be(this,e),this.name=t,this.arn=r,this.secretString=n,this.createdDate=o,this.lastAccessedDate=i,this.lastChangedDate=c,this.tags=a}return me(e,null,[{key:"fromJSON",value:function(t){return new e(t.Name,t.ARN,t.SecretString,t.CreatedDate,t.LastAccessedDate,t.LastChangeddAt,t.Tags)}}]),e}(),Te=function(e){Oe(r,e);var t=je(r);function r(e,n,o){var i;return be(this,r),(i=t.call(this,e,n)).name="SecretsManagerServiceError",i.operation=o,i}return me(r)}(R)})();var o=exports;for(var i in n)o[i]=n[i];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})(); +(()=>{var e={877:(e,t,r)=>{var n=r(570),o=r(171),i=o;i.v1=n,i.v4=o,e.exports=i},327:e=>{for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);e.exports=function(e,r){var n=r||0,o=t;return[o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]]].join("")}},217:e=>{var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var r=new Uint8Array(16);e.exports=function(){return t(r),r}}else{var n=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}}},570:(e,t,r)=>{var n,o,i=r(217),c=r(327),a=0,u=0;e.exports=function(e,t,r){var s=t&&r||0,f=t||[],l=(e=e||{}).node||n,p=void 0!==e.clockseq?e.clockseq:o;if(null==l||null==p){var h=i();null==l&&(l=n=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==p&&(p=o=16383&(h[6]<<8|h[7]))}var y=void 0!==e.msecs?e.msecs:(new Date).getTime(),d=void 0!==e.nsecs?e.nsecs:u+1,b=y-a+(d-u)/1e4;if(b<0&&void 0===e.clockseq&&(p=p+1&16383),(b<0||y>a)&&void 0===e.nsecs&&(d=0),d>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=y,u=d,o=p;var v=(1e4*(268435455&(y+=122192928e5))+d)%4294967296;f[s++]=v>>>24&255,f[s++]=v>>>16&255,f[s++]=v>>>8&255,f[s++]=255&v;var m=y/4294967296*1e4&268435455;f[s++]=m>>>8&255,f[s++]=255&m,f[s++]=m>>>24&15|16,f[s++]=m>>>16&255,f[s++]=p>>>8|128,f[s++]=255&p;for(var g=0;g<6;++g)f[s+g]=l[g];return t||c(f)}},171:(e,t,r)=>{var n=r(217),o=r(327);e.exports=function(e,t,r){var i=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var c=(e=e||{}).random||(e.rng||n)();if(c[6]=15&c[6]|64,c[8]=63&c[8]|128,t)for(var a=0;a<16;++a)t[i+a]=c[a];return t||o(c)}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{AWSConfig:()=>V,InvalidAWSConfigError:()=>F,InvalidSignatureError:()=>R,S3Bucket:()=>ye,S3Client:()=>he,S3Object:()=>de,S3ServiceError:()=>be,Secret:()=>Ne,SecretsManagerClient:()=>De,SecretsManagerError:()=>qe,URIEncodingConfig:()=>D,signHeaders:()=>C});const e=require("k6/crypto");var t=r.n(e);const o=require("k6/html");function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function c(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r="A"&&r<="Z"||r>="a"&&r<="z"||function(e){return e>="0"&&e<="9"}(e)||"-._~".includes(e)?e:" "==e?"%20":"/"==e&&t?"/":"%"+e.charCodeAt(0).toString(16).toUpperCase();var r})).join("")}var D=w((function e(t,r){O(this,e),b(this,"double",void 0),b(this,"path",void 0),this.double=t,this.path=r}));function N(e){return new Date(e).toISOString().replace(/[:\-]|\.\d{3}/g,"")}function q(e){return N(e).substring(0,8)}function I(e){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I(e)}function M(e,t){if(t&&("object"===I(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function z(e){var t="function"==typeof Map?new Map:void 0;return z=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return H(e,arguments,B(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),U(n,e)},z(e)}function H(e,t,r){return H=L()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&U(o,r.prototype),o},H.apply(null,arguments)}function L(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function U(e,t){return U=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},U(e,t)}function B(e){return B=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},B(e)}function X(e,t){for(var r=0;r=1400&&r<=1499){var o=n.Message||n.message||n.__type;if("InvalidSignatureException"===n.__type)throw new R(o,n.__type);throw new qe(o,n.__type,e)}if(1500===r)throw new qe("An error occured on the server side","InternalServiceError",e)}}}]),r}(Q),Ne=function(){function e(t,r,n,o,i,c){var a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:[];Oe(this,e),xe(this,"name",void 0),xe(this,"arn",void 0),xe(this,"secret",void 0),xe(this,"createdDate",void 0),xe(this,"lastAccessedDate",void 0),xe(this,"lastChangedDate",void 0),xe(this,"tags",void 0),this.name=t,this.arn=r,this.secret=n,this.createdDate=o,this.lastAccessedDate=i,this.lastChangedDate=c,this.tags=a}return Se(e,null,[{key:"fromJSON",value:function(t){return new e(t.Name,t.ARN,t.SecretString,t.CreatedDate,t.LastAccessedDate,t.LastChangedDate,t.Tags)}}]),e}(),qe=function(e){Ce(r,e);var t=Ee(r);function r(e,n,o){var i;return Oe(this,r),xe(Te(i=t.call(this,e,n)),"operation",void 0),i.name="SecretsManagerServiceError",i.operation=o,i}return Se(r)}(y)})();var o=exports;for(var i in n)o[i]=n[i];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})(); //# sourceMappingURL=aws.min.js.map \ No newline at end of file diff --git a/build/aws.min.js.map b/build/aws.min.js.map index ae04e5b..c5b491c 100644 --- a/build/aws.min.js.map +++ b/build/aws.min.js.map @@ -1 +1 @@ -{"version":3,"file":"aws.min.js","mappings":"kCAAUA,E,sOAA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M,CAAEL,QAASA,IAC5DX,KAAKqG,cAAc,eAAgBF,KApL3C,gBAuLI,WACI,gBAAUnG,KAAK8F,YAAf,YAA8B9F,KAAKiB,UAAUrB,OAA7C,oBAxLR,2BA2LI,SAAc6I,EAAWuB,GACrB,IAAMC,EAAYD,EAAS1D,WAC3B,GAAkB,IAAd2D,EAAJ,CAIA,IAAM1D,EAAQyD,EAASlB,OACvB,GAAImB,GAAa,MAAQA,GAAa,KAAM,CAGxC,IAAMC,EAAe3D,EAAM4D,SAAW5D,EAAMpG,SAAWoG,EAAM6D,OAG7D,GAAqB,8BAAjB7D,EAAM6D,OACN,MAAM,IAAInF,EAAsBiF,EAAc3D,EAAM6D,QAIxD,MAAM,IAAIC,GAAoBH,EAAc3D,EAAM6D,OAAQ3B,GAG9D,GAAkB,OAAdwB,EACA,MAAM,IAAII,GACN,sCACA,uBACA5B,QApNhB,GAA0C5C,GA6N7BmD,GAAb,WAYI,WACI5I,EACAkK,EACAlB,EACAmB,EACAC,EACAC,GAEF,IADElB,EACF,uDADS,GACT,WACEvJ,KAAKI,KAAOA,EACZJ,KAAKsK,IAAMA,EACXtK,KAAKoJ,aAAeA,EACpBpJ,KAAKuK,YAAcA,EACnBvK,KAAKwK,iBAAmBA,EACxBxK,KAAKyK,gBAAkBA,EACvBzK,KAAKuJ,KAAOA,EA3BpB,wCAsCI,SAAgBT,GACZ,OAAO,IAAIE,EACPF,EAAKW,KACLX,EAAK4B,IACL5B,EAAKa,aACLb,EAAK6B,YACL7B,EAAK8B,iBACL9B,EAAK+B,eACL/B,EAAKe,UA9CjB,KAoDaQ,GAAb,gCAQI,WAAYlK,EAAS9E,EAAMoN,GAAW,yBAClC,cAAMtI,EAAS9E,IACV+E,KAAO,6BACZ,EAAKqI,UAAYA,EAHiB,EAR1C,cAAyCvI,I","sources":["webpack://k6-jslib-aws/./src/internal/uuid.js","webpack://k6-jslib-aws/webpack/bootstrap","webpack://k6-jslib-aws/webpack/runtime/compat get default export","webpack://k6-jslib-aws/webpack/runtime/define property getters","webpack://k6-jslib-aws/webpack/runtime/hasOwnProperty shorthand","webpack://k6-jslib-aws/webpack/runtime/make namespace object","webpack://k6-jslib-aws/external commonjs \"k6/crypto\"","webpack://k6-jslib-aws/./src/internal/config.js","webpack://k6-jslib-aws/external commonjs \"k6/html\"","webpack://k6-jslib-aws/./src/internal/error.js","webpack://k6-jslib-aws/./src/internal/signature.js","webpack://k6-jslib-aws/external commonjs \"k6/http\"","webpack://k6-jslib-aws/./src/internal/client.js","webpack://k6-jslib-aws/./src/internal/s3.js","webpack://k6-jslib-aws/./src/internal/secrets-manager.js"],"sourcesContent":["(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.uuid = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i>> ((i & 0x03) << 3) & 0xff;\n }\n\n return rnds;\n };\n}\n\n},{}],4:[function(require,module,exports){\nvar rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\n\nvar _nodeId;\nvar _clockseq;\n\n// Previous uuid creation time\nvar _lastMSecs = 0;\nvar _lastNSecs = 0;\n\n// See https://github.com/uuidjs/uuid for API details\nfunction v1(options, buf, offset) {\n var i = buf && offset || 0;\n var b = buf || [];\n\n options = options || {};\n var node = options.node || _nodeId;\n var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;\n\n // node and clockseq need to be initialized to random values if they're not\n // specified. We do this lazily to minimize issues related to insufficient\n // system entropy. See #189\n if (node == null || clockseq == null) {\n var seedBytes = rng();\n if (node == null) {\n // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n node = _nodeId = [\n seedBytes[0] | 0x01,\n seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]\n ];\n }\n if (clockseq == null) {\n // Per 4.2.2, randomize (14 bit) clockseq\n clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n }\n }\n\n // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();\n\n // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;\n\n // Time since last uuid creation (in msecs)\n var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;\n\n // Per 4.2.1.2, Bump clockseq on clock regression\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n }\n\n // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n }\n\n // Per 4.2.1.2 Throw error if too many uuids are requested\n if (nsecs >= 10000) {\n throw new Error('uuid.v1(): Can\\'t create more than 10M uuids/sec');\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq;\n\n // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n msecs += 12219292800000;\n\n // `time_low`\n var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff;\n\n // `time_mid`\n var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff;\n\n // `time_high_and_version`\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n b[i++] = tmh >>> 16 & 0xff;\n\n // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n b[i++] = clockseq >>> 8 | 0x80;\n\n // `clock_seq_low`\n b[i++] = clockseq & 0xff;\n\n // `node`\n for (var n = 0; n < 6; ++n) {\n b[i + n] = node[n];\n }\n\n return buf ? buf : bytesToUuid(b);\n}\n\nmodule.exports = v1;\n\n},{\"./lib/bytesToUuid\":2,\"./lib/rng\":3}],5:[function(require,module,exports){\nvar rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\nfunction v4(options, buf, offset) {\n var i = buf && offset || 0;\n\n if (typeof(options) == 'string') {\n buf = options === 'binary' ? new Array(16) : null;\n options = null;\n }\n options = options || {};\n\n var rnds = options.random || (options.rng || rng)();\n\n // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n\n // Copy bytes to buffer, if provided\n if (buf) {\n for (var ii = 0; ii < 16; ++ii) {\n buf[i + ii] = rnds[ii];\n }\n }\n\n return buf || bytesToUuid(rnds);\n}\n\nmodule.exports = v4;\n\n},{\"./lib/bytesToUuid\":2,\"./lib/rng\":3}]},{},[1])(1)\n});\n","// 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](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\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\");","/** Class holding an AWS connection information */\nexport class AWSConfig {\n /**\n * Create an AWSConfig.\n *\n * @param {string} region - the AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n * @param {string} accessKeyID - Your user's AWS access key id credential\n * @param {string} secretAccessKey - Your user's AWS secret access key credential\n * @throws {InvalidArgumentException}\n */\n constructor(region, accessKeyID, secretAccessKey) {\n if (typeof region !== 'string' || region === '') {\n throw new InvalidAWSConfigError(\n 'invalid AWS region; reason: should be a non empty string'\n )\n }\n\n if (typeof accessKeyID !== 'string' || accessKeyID === '') {\n throw new InvalidAWSConfigError(\n 'invalid AWS access key ID; reason: should be a non empty string'\n )\n }\n\n if (typeof secretAccessKey !== 'string' || secretAccessKey === '') {\n throw new InvalidAWSConfigError(\n 'invalid AWS secret access key; reason: should be a non empty string'\n )\n }\n\n this.region = region\n this.accessKeyID = accessKeyID\n this.secretAccessKey = secretAccessKey\n }\n}\n\n/** Class representing an invalid AWS configuration */\nexport class InvalidAWSConfigError extends Error {\n constructor(...params) {\n super(...params)\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/html\");","import { parseHTML } from 'k6/html'\n\n/**\n * Base class to derive errors from\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class AWSError extends Error {\n /**\n * Create an AWSError\n *\n * @param {string} message - A longer human readable error message.\n * @param {string} code - A unique short code representing the error that was emitted\n */\n constructor(message, code) {\n super(message)\n this.name = 'AWSError'\n this.code = code\n }\n\n /**\n * Parse an AWSError from an XML document\n *\n * @param {string} xmlDocument - Serialized XML document to parse the error from\n */\n static parseXML(xmlDocument) {\n const doc = parseHTML(xmlDocument)\n return new AWSError(doc.find('Message').text(), doc.find('Code').text())\n }\n}\n","'use strict'\n\nimport crypto, { hmac, sha256 } from 'k6/crypto'\nimport { AWSConfig } from './config'\nimport { AWSError } from './error'\n\n/**\n * Includes AWS v4 signing information to the provided HTTP headers object.\n *\n * This function will compute the `Authorization` header signature for the\n * provided request components, and add it to `header`. It will do so by following\n * the procedure detailled AWS' API docs: https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n *\n * The resulting `Authorization` header value is computed for the provided\n * headers object. Thus, any modification of the headers past a call to `signHeaders`\n * would effectively invalidate their signature, and the function should be\n * called again to recompute it.\n *\n * @param {object} headers - HTTP headers request to sign.\n * @param {number} requestTimestamp - Timestamp of the request\n * @param {string} method - HTTP method used\n * @param {string} path - HTTP request URL's path\n * @param {string} queryString - HTTP request URL's querystring\n * @param {string | ArrayBuffer} body - HTTP request's payload\n * @param {AWSConfig} - AWS configuration\n * @param {string} service - AWS service name\n * @param {URIEncodingConfig} - URI encoding configuration\n */\nexport function signHeaders(\n headers,\n requestTimestamp,\n method,\n path,\n queryString,\n body,\n awsConfig,\n service,\n URIencodingConfig\n) {\n const derivedSigningKey = deriveSigningKey(\n awsConfig.secretAccessKey,\n requestTimestamp,\n awsConfig.region,\n service\n )\n\n const canonicalRequest = createCanonicalRequest(\n method,\n path,\n queryString,\n headers,\n body,\n URIencodingConfig\n )\n\n const stringToSign = createStringToSign(\n requestTimestamp,\n awsConfig.region,\n service,\n sha256(canonicalRequest, 'hex')\n )\n\n const credentialScope = createCredentialScope(requestTimestamp, awsConfig.region, service)\n const signedHeaders = createSignedHeaders(headers)\n const signature = calculateSignature(derivedSigningKey, stringToSign)\n const authorizationHeader = `${HashingAlgorithm} Credential=${awsConfig.accessKeyID}/${credentialScope}, SignedHeaders=${signedHeaders}, Signature=${signature}`\n\n headers['Authorization'] = authorizationHeader\n\n return headers\n}\n\n/**\n * Error indicating an Invalid signature has been sent to AWS services\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class InvalidSignatureError extends AWSError {\n /**\n * Constructs an InvalidSignatureError\n *\n * @param {string} message - human readable error message\n */\n constructor(message, code) {\n super(message, code)\n this.name = 'InvalidSignatureError'\n }\n}\n\n/**\n * Calculte the signature for AWS signature version 4\n *\n * @param {string} derivedSigningKey - dervied signing key as computed by `deriveSigningKey`\n * @param {string} stringToSign - String to sign as computed by `createStringToSign`\n * @return {string}\n */\nexport function calculateSignature(derivedSigningKey, stringToSign) {\n return hmac('sha256', derivedSigningKey, stringToSign, 'hex')\n}\n/**\n * Derives the signing key for authenticating requests signed with\n * the Signature version 4 authentication protocol.\n *\n * deriveSigningKey produces a signing key by creating a series of\n * hash-based message authentication codes (HMACs) represented in\n * a binary format.\n *\n * The derived signing key is specific to the date it's made at, as well as\n * the service and region it targets.\n *\n * @param {string} secretAccessKey - the AWS secret access key to derive the signing key for\n * @param {number} time - timestamp of the request\n * @param {string} region - targeted AWS region. MUST be UTF-8 encoded.\n * @param {string} service - targeted AWS service. MUST be UTF-8 encoded.\n * @return {string}\n */\nexport function deriveSigningKey(secretAccessKey, time, region, service) {\n const kSecret = secretAccessKey\n const date = toDate(time)\n\n const kDate = hmac('sha256', 'AWS4' + kSecret, date, 'binary')\n const kRegion = hmac('sha256', kDate, region, 'binary')\n const kService = hmac('sha256', kRegion, service, 'binary')\n const kSigning = hmac('sha256', kService, 'aws4_request', 'binary')\n\n return kSigning\n}\n\n// Hashing Algorithm to use in the signature process\nexport const HashingAlgorithm = 'AWS4-HMAC-SHA256'\n\n/**\n * Certain services, such as S3, allow for unsigned payloads. If\n * producing a signed canonical request for such service, pass\n * the `UnsignedPayload` constant value as the payload parameter.\n */\nexport const UnsignedPayload = 'UNSIGNED-PAYLOAD'\n\n/**\n * Create the \"string to sign\" part of the signature Version 4 protocol.\n *\n * The \"string to sign\" includes meta information about your request and\n * about the canonical request that you created with `createCanonicalRequest`.\n * It is used hand in hand with the signing key to create the request signature.\n *\n * @param {number} requestTimestamp - timestamp of the request\n * @param {string} region - targeted AWS region. MUST be UTF-8 encoded.\n * @param {string} service - targeted AWS service name. MUST be UTF-8 encoded.\n * @param {string} hashedCanonicalRequest - canonical request as produced by calling the createCanonicalRequest function,\n * hashed using the SHA256 algorithm (encoded in hexadecimal format).\n * @return {string}\n */\nexport function createStringToSign(requestTimestamp, region, service, hashedCanonicalRequest) {\n // the request date specified in ISO8601 format: YYYYMMDD'T'HHMMSS'Z'\n const requestDateTime = toTime(requestTimestamp)\n\n // The credential scope value, consisting of the date in YYYYMMDD format,\n // the targeted region, the targeted service, and a termination string.\n // Note that the region and service MUST be UTF-8 encoded.\n const credentialScope = createCredentialScope(requestTimestamp, region, service)\n\n const stringToSign = [\n // Algorithm\n HashingAlgorithm,\n\n // RequestDateTime\n requestDateTime,\n\n // CredentialScope\n credentialScope,\n\n // HashedCanonicalRequest\n hashedCanonicalRequest,\n ].join('\\n')\n\n return stringToSign\n}\n\n/**\n *\n * Helper function creating a credential scope string to use in the signature\n * version 4 process. A credential scope consists of the date of the request\n * in YYYYMMDD format, the targeted region, the targeted service, and a\n * termination string.\n *\n * Note that the region and service MUST be UTF-8 encoded.\n *\n * @param {number} requestTimestamp - timestamp of the request\n * @param {string} region - targeted AWS region. MUST be UTF-8 encoded.\n * @param {string} service - targeted AWS service name. MUST be UTF-8 encoded.\n * @return {string}\n */\nexport function createCredentialScope(requestTimestamp, region, service) {\n return [toDate(requestTimestamp), region, service, 'aws4_request'].join('/')\n}\n\n/**\n * Create a string that includes information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * @param {string} method - the HTTP request method\n * @param {string} uri - URI-encoded version of the absolute path component of the URI\n * @param {string} query - request's query string\n * @param {Object} headers - all the HTTP headers that you wish to include with the signed request\n * @param {String | ArrayBuffer} payload - payload to include as the body of the request\n * @param {URIEncodingConfig} - URI encoding configuration\n * @return {string}\n */\nexport function createCanonicalRequest(method, uri, query, headers, payload, URIencodingConfig) {\n const httpRequestMethod = method.toUpperCase()\n const canonicalURI = createCanonicalURI(uri, URIencodingConfig)\n const canonicalQueryString = createCanonicalQueryString(query)\n const canonicalHeaders = createCanonicalHeaders(headers)\n const signedHeaders = createSignedHeaders(headers)\n const requestPayload = createCanonicalPayload(payload)\n\n const canonicalRequest = [\n httpRequestMethod,\n canonicalURI,\n canonicalQueryString,\n canonicalHeaders,\n signedHeaders,\n requestPayload,\n ].join('\\n')\n\n return canonicalRequest\n}\n\n/**\n * Creates the (canonical) URI-encoded version of the\n * absolute path component of the URI: everything in the URI\n * from the HTTP host to the question mark character (\"?\")\n * that begins the query string parameters (if any).\n *\n * @param {string} uri - URI to canonize\n * @param {URIEncodingConfig} - URI encoding configuration\n * @return {string} - canonical URL\n */\nexport function createCanonicalURI(uri, URIencodingConfig) {\n if (uri == '/') {\n return uri\n }\n\n let canonicalURI = uri\n if (uri[uri.length - 1] == '/' && canonicalURI[canonicalURI.length - 1] != '/') {\n canonicalURI += '/'\n }\n\n canonicalURI = URIEncode(canonicalURI, URIencodingConfig.path)\n\n return URIencodingConfig.double ? URIEncode(canonicalURI, URIencodingConfig.path) : canonicalURI\n}\n\n/**\n * Creates the canonical form of the request's query\n * string. If the request does not include a query string,\n * provide an empty string.\n *\n * @param {String | Object} qs - query string to canonize\n * @return {string}\n */\nexport function createCanonicalQueryString(qs) {\n if (!qs) {\n return ''\n }\n\n if (typeof qs == 'string') {\n qs = parseQueryString(qs)\n }\n\n return Object.keys(qs)\n .sort()\n .map((key) => {\n const values = Array.isArray(qs[key]) ? qs[key] : [qs[key]]\n return values\n .sort()\n .map((val) => encodeURIComponent(key) + '=' + encodeURIComponent(val))\n .join('&')\n })\n .join('&')\n}\n/**\n * Create the canonical form of the request's headers.\n * Canonical headers consist of all the HTTP headers you\n * are including with the signed request.\n *\n * Note that:\n * * for HTTP/1.1 requests, the headers should at least\n * contain the `host` header.\n * * for HTTP/2, the `:authority` header must be used instead\n * of `host`.\n *\n * @param {Object} headers\n * @return {string}\n */\nexport function createCanonicalHeaders(headers) {\n if (headers.constructor !== Object || Object.entries(headers).length === 0) {\n return ''\n }\n\n const canonicalHeaders = Object.entries(headers)\n .map(([name, values]) => {\n const canonicalName = name.toLowerCase().trim()\n const normalizedValues = Array.isArray(values) ? values : [values]\n\n // Note that we do not need to sort values\n const canonicalValues = normalizedValues\n .map((v) => {\n // convert sequential spaces to a single space\n return v.replace(/\\s+/g, ' ').replace(/^\\s+|\\s+$/g, '')\n })\n .join(',') // standard for multiple values in a HTTP header\n\n return canonicalName + ':' + canonicalValues + '\\n'\n })\n .sort()\n .join('')\n\n return canonicalHeaders\n}\n\n/**\n * Create the canonical request's signed headers.\n *\n * The signed headers part of the request contains the\n * list of headers included in the request's signing process.\n *\n * Note that:\n * * for HTTP/1.1 requests, the `host` header must be included.\n * * for HTTP/2 requests, the `:authority` header must be included instead\n * of host.\n * * if used, the `x-amz-date` header must be included.\n *\n * @param {Object} headers\n * @return {string}\n * @throws {TypeError} - on headers not being an Object, or being empty.\n */\nexport function createSignedHeaders(headers) {\n if (headers.constructor !== Object) {\n throw new TypeError('headers should be an object')\n }\n\n if (Object.entries(headers).length === 0) {\n throw 'headers should at least contain either the Host (HTTP 1.1) or :authority (HTTP 2) parameter'\n }\n\n // To create the signed headers list, convert\n // all header names to lowercase, sort them by\n // character code, and use a semicolon to separate\n // the header names.\n const result = Object.keys(headers)\n .map((name) => name.toLowerCase().trim())\n .sort()\n .join(';')\n\n return result\n}\n\n/**\n * Create the canonical form of the request's payload.\n *\n * The canonical payload consists in a lowercased, hex encoded,\n * SHA256 hash of the requests body/payload.\n *\n * Certain services, such as S3, allow for unsigned payload. If\n * producing a signed canonical request for such service, pass\n * the `UnsignedPayload` constant value as the payload parameter.\n *\n * @param {String | ArrayBuffer} payload\n * @return {string}\n */\nexport function createCanonicalPayload(payload) {\n if (payload === UnsignedPayload) {\n return payload\n }\n\n // Note that if the paylaod is null, we convert it\n // to an empty string.\n // TODO: Should switching to empty string if null impact headers?\n return crypto.sha256(payload || '', 'hex').toLowerCase()\n}\n\n/**\n * URIEncodes encodes every bytes of a URI to be URL-safe.\n *\n * This implementation is specific to AWS; who intended to make it as\n * close as possible to the underlying RFC 3946. It:\n * * URI encode every byte except the unreserved characters: 'A'-'Z', 'a'-'z', '0'-'9',\n * '-', '.', '_', and '~'.\n * * considers the space character as a reserved character and must URI encodes\n * encodes it as \"%20\" (and not as \"+\").\n * * URI encodes every byte by prefixing with '%' the two-digit hexadecimal value of the byte.\n * * If the `path` argument is set, forward slashes are not encoded, to fit with\n * S3 requirements.\n *\n * N.B: this implementation differs with ES6' mainly in that it does\n * encode the \"'\" character.\n *\n * Based on AWS implementation: https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-core/src/main/java/com/amazonaws/util/SdkHttpUtils.java#L66\n * Encoding specs: https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html\n *\n * @param {string} uri - uri to encode\n * @param {boolean} path - slash characters should be encoded everywhere,\n * but in paths, set to false when encoding a path\n * @return {string} the URI encoded result\n */\nexport function URIEncode(uri, path) {\n if (uri == '') {\n return uri\n }\n\n return uri\n .split('') // to be able to map over a string, because... javascript...\n .map((letter) => {\n if (isAlpha(letter) || isNumeric(letter) || '-._~'.includes(letter)) {\n return letter\n }\n\n // Space should be explicitly encoded to as %20.\n if (letter == ' ') {\n return '%20'\n }\n\n // If the URI is a path, the forward slash shouldn't\n // be encoded.\n if (letter == '/' && path) {\n return '/'\n }\n\n return '%' + letter.charCodeAt(0).toString(16).toUpperCase()\n })\n .join('')\n}\n\n/**\n * Class holding URI encoding configuration\n */\nexport class URIEncodingConfig {\n /**\n *\n * @param {boolean} double - should the URI be double encoded?\n * @param {boolean} path - is the URI a path? If so, its forward\n * slashes won't be URIencoded.\n */\n constructor(double, path) {\n this.double = double\n this.path = path\n }\n}\n\n/**\n * Compute the request time value as specified by the ISO8601\n * format: YYYYMMDD'T'HHMMSS'Z'\n *\n * @param {number} timestamp\n * @return {string}\n */\nexport function toTime(timestamp) {\n return new Date(timestamp).toISOString().replace(/[:\\-]|\\.\\d{3}/g, '')\n}\n/**\n * Computethe request date value in the format: YYYMMDD\n *\n * @param {number} timestamp\n * @return {string}\n */\nexport function toDate(timestamp) {\n return toTime(timestamp).substring(0, 8)\n}\n/**\n * Parse a HTTP request URL's querystring into an object\n * containing its `key=value` pairs.\n *\n * @param {string} qs\n * @return {object}\n */\nexport function parseQueryString(qs) {\n if (typeof qs !== 'string' || qs.length === 0) {\n return {}\n }\n\n var result = {}\n var split = qs.split('&').filter((e) => e) // filter drops empty elements\n\n for (let i = 0; i < split.length; i++) {\n let parts = split[i].split('=')\n\n if (parts.length === 2) {\n result[decodeURIComponent(parts[0])] = decodeURIComponent(parts[1])\n } else {\n result[decodeURIComponent(split[i])] = ''\n }\n }\n\n return result\n}\n\nfunction isAlpha(c) {\n return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')\n}\n\nfunction isNumeric(c) {\n return c >= '0' && c <= '9'\n}\n\n// FIXME: finish implementation when needed\n// See the following for more details:\n// * https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n// * https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html\n// export function signQueryString(\n// queryString,\n// requestTimestamp,\n// accessKeyID,\n// secretAccessKey,\n// region,\n// service,\n// ttl, // in seconds\n// headers,\n// doubleURIEncoding = true\n// ) {\n// const credential = [accessKeyID, toDate(requestTimestamp), region, service].join('/')\n//\n// const canonicalRequest = createCanonicalRequest(\n// method,\n// path,\n// queryString,\n// headers,\n// body,\n// doubleURIEncoding\n// )\n//\n// const derivedSigningKey = deriveSigningKey(secretAccessKey, requestTimestamp, region, service)\n//\n// const stringToSign = createStringToSign(\n// requestTimestamp,\n// region,\n// service,\n// sha256(canonicalRequest, 'hex')\n// )\n//\n// const signedHeaders = createSignedHeaders(headers)\n// const signature = calculateSignature(derivedSigningKey, stringToSign)\n//\n// return [\n// `X-Amz-Algorithm=${HashingAlgorithm}`,\n// `X-Amz-Credential=${crediental}`,\n// `X-Amz-Date=${toTime(requestTimestamp)}`,\n// `X-Amz-Expires=${ttl}`,\n// `X-Amz-SignedHeaders=${signedHeaders}`,\n// `X-Amz-Signature=${signature}`,\n//`X-Amz-Security-Token=`, // TODO: optional\n// ].join('&')\n// }\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/http\");","import { signHeaders, toTime } from './signature.js'\n\n/**\n * Class allowing to build requests targeting AWS APIs\n *\n * This class is meant to be used as a base class for specific\n * services clients. See S3Client or SecretsManagerClient for\n * usage examples.\n */\nexport class AWSClient {\n /**\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n * @param {string} serviceName - name of the service to target.\n * @param {URIEncodingConfig} URIencodingConfig - configures how requests URIs should be encoded.\n */\n constructor(awsConfig, serviceName, URIencodingConfig) {\n this.awsConfig = awsConfig\n this.serviceName = serviceName\n this.URIencodingConfig = URIencodingConfig\n }\n\n buildRequest(method, host, path, queryString, body, headers) {\n const requestTimestamp = Date.now()\n const date = toTime(requestTimestamp)\n\n headers['Host'] = host\n headers['X-Amz-Date'] = date\n\n headers = signHeaders(\n // headers\n headers,\n\n // requestTimestamp\n requestTimestamp,\n\n // method\n method,\n\n // path\n path,\n\n // querystring\n queryString,\n\n // body\n body,\n\n // AWS configuration\n this.awsConfig,\n\n // AwS target service name\n this.serviceName,\n\n // doubleEncoding: S3 does single-encoding of the uri component\n // pathURIEncoding: S3 manipulates object keys, and forward slashes\n // shouldn't be URI encoded\n this.URIencodingConfig\n )\n\n // '?' should not be part of the querystring when we sign the headers\n path = path !== '' ? path : '/'\n let url = `https://${host}${path}`\n if (queryString !== '') {\n url += `?${queryString}`\n }\n\n return { url: url, headers: headers }\n }\n}\n","import http from 'k6/http'\nimport { parseHTML } from 'k6/html'\nimport { sha256 } from 'k6/crypto'\n\nimport { signHeaders, InvalidSignatureError, URIEncodingConfig, toTime } from './signature.js'\nimport { AWSClient } from './client.js'\nimport { AWSError } from './error.js'\nimport { AWSConfig } from './config.js'\n\n/** Class allowing to interact with Amazon AWS's S3 service */\nexport class S3Client extends AWSClient {\n /**\n * Create a S3Client\n *\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig) {\n const URIencodingConfig = new URIEncodingConfig(false, true)\n super(awsConfig, 's3', URIencodingConfig)\n }\n\n /**\n * Returns a list of all buckets owned by the authenticated sender of the request.\n * To use this operation, you must have the s3:ListAllMyBuckets permission.\n *\n * @return {Array.} buckets - An array of objects describing S3 buckets\n * with the following fields: name, and creationDate.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n listBuckets() {\n // Prepare request\n const method = 'GET'\n const host = `${this.serviceName}.${this.awsConfig.region}.amazonaws.com`\n const body = ''\n const { url, headers } = super.buildRequest(method, host, '/', '', body, {\n 'X-Amz-Content-SHA256': sha256(body, 'hex'),\n })\n\n const res = http.request(method, url, body, { headers: headers })\n this._handle_error(res.error_code, res.error, res.body)\n\n let buckets = []\n\n const doc = parseHTML(res.body)\n\n doc.find('Buckets')\n .children()\n .each((_, bucketDefinition) => {\n let bucket = new S3Bucket()\n\n bucketDefinition.children().forEach((child) => {\n switch (child.nodeName()) {\n case 'name':\n Object.assign(bucket, { name: child.textContent() })\n case 'creationdate':\n const parsed = Date.parse(\n child.textContent(),\n 'YYYY-MM-ddTHH:mm:ss.sssZ'\n )\n Object.assign(bucket, { creationDate: parsed })\n }\n })\n\n buckets.push(bucket)\n })\n\n return buckets\n }\n\n /**\n * Returns some or all (up to 1,000) of the objects in a bucket.\n *\n * @param {string} bucketName - Bucket name to list.\n * @param {string} prefix='' - Limits the response to keys that begin with the specified prefix.\n * @return {Array.} - returns an array of objects describing S3 objects\n * with the following fields: key, lastModified, etag, size and storageClass.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n listObjects(bucketName, prefix = '') {\n // Prepare request\n const method = 'GET'\n const host = `${bucketName}.${this.serviceName}.${this.awsConfig.region}.amazonaws.com`\n const body = ''\n const { url, headers } = super.buildRequest(method, host, '/', 'list-type=2', body, {\n 'X-Amz-Content-SHA256': sha256(body, 'hex'),\n })\n\n const res = http.request(method, url, body, { headers: headers })\n this._handle_error(res.error_code, res.error, res.body)\n\n let objects = []\n\n // Extract the objects definition from\n // the XML response\n parseHTML(res.body)\n .find('Contents')\n .each((_, objectDefinition) => {\n let obj = new S3Object()\n\n objectDefinition.children().forEach((child) => {\n switch (child.nodeName()) {\n case 'key':\n Object.assign(obj, { key: child.textContent() })\n case 'lastmodified':\n const parsed = Date.parse(\n child.textContent(),\n 'YYYY-MM-ddTHH:mm:ss.sssZ'\n )\n Object.assign(obj, { lastModified: parsed })\n case 'etag':\n Object.assign(obj, { etag: child.textContent() })\n case 'size':\n Object.assign(obj, { size: parseInt(child.textContent()) })\n case 'storageclass':\n Object.assign(obj, { storageClass: child.textContent() })\n }\n })\n\n objects.push(obj)\n })\n\n return objects\n }\n /**\n * Retrieves an Object from Amazon S3.\n *\n * To use getObject, you must have `READ` access to the object.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to get.\n * @return {S3Object} - returns the content of the fetched S3 Object.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n getObject(bucketName, objectKey) {\n // Prepare request\n const method = 'GET'\n const host = `${bucketName}.${this.serviceName}.${this.awsConfig.region}.amazonaws.com`\n const path = `/${objectKey}`\n const body = ''\n const { url, headers } = super.buildRequest(method, host, path, '', body, {\n 'X-Amz-Content-SHA256': sha256(body, 'hex'),\n })\n\n const res = http.request(method, url, body, { headers: headers })\n this._handle_error(res.error_code, res.error, res.body)\n\n return new S3Object(\n objectKey,\n res.headers['Last-Modified'],\n res.headers['ETag'],\n res.headers['Content-Length'],\n '', // GetObject response doesn't contain the storage class\n res.body\n )\n }\n /**\n * Adds an object to a bucket.\n *\n * You must have WRITE permissions on a bucket to add an object to it.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to put.\n * @param {string | ArrayBuffer} data - the content of the S3 Object to upload.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n putObject(bucketName, objectKey, data) {\n // Prepare request\n const method = 'PUT'\n const host = `${bucketName}.${this.serviceName}.${this.awsConfig.region}.amazonaws.com`\n const path = `/${objectKey}`\n const queryString = ''\n const body = data\n const { url, headers } = super.buildRequest(method, host, path, queryString, body, {\n 'X-Amz-Content-SHA256': sha256(body, 'hex'),\n })\n\n const res = http.request(method, url, body, { headers: headers })\n this._handle_error(res.error_code, res.error, res.body)\n }\n\n /**\n * Removes the null version (if there is one) of an object and inserts a delete marker,\n * which becomes the latest version of the object.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n deleteObject(bucketName, objectKey) {\n // Prepare request\n const method = 'DELETE'\n const host = `${bucketName}.${this.serviceName}.${this.awsConfig.region}.amazonaws.com`\n const path = `/${objectKey}`\n const queryString = ''\n const body = ''\n const { url, headers } = super.buildRequest(method, host, path, queryString, body, {\n 'X-Amz-Content-SHA256': sha256(body, 'hex'),\n })\n\n const res = http.request(method, url, body, { headers: headers })\n this._handle_error(res.error_code, res.error, res.body)\n }\n\n // FIXME: remove dependency to `error_message`\n // FIXME: just pass it the response?\n _handle_error(error_code, error_message, error_body) {\n if (error_message == '' || error_code === 0) {\n return\n }\n\n // FIXME: should be error_code === 1301 instead\n // See: https://github.com/grafana/k6/issues/2474\n // See: https://github.com/golang/go/issues/49281\n if (error_message && error_message.startsWith('301')) {\n // Bucket not found\n throw new S3ServiceError('Resource not found', 'ResourceNotFound', 'getObject')\n }\n\n const awsError = AWSError.parseXML(error_body)\n switch (awsError.code) {\n case 'AuthorizationHeaderMalformed':\n throw new InvalidSignatureError(awsError.message, awsError.code)\n default:\n throw new S3ServiceError(awsError.message, awsError.code, 'listObjects')\n }\n }\n}\n\n/** Class representing a S3 Bucket */\nexport class S3Bucket {\n /**\n * Create an S3 Bucket\n *\n * @param {string} name - S3 bucket's name\n * @param {Date} creationDate - S3 bucket's creation date\n */\n constructor(name, creationDate) {\n this.name = name\n this.creationDate = creationDate\n }\n}\n\n/** Class representing an S3 Object */\nexport class S3Object {\n /**\n * Create an S3 Object\n *\n * @param {string} key - S3 object's key\n * @param {Date} lastModified - S3 object last modification date\n * @param {string} etag - S3 object's etag\n * @param {number} size - S3 object's size\n * @param {string} storageClass - S3 object's storage class\n * @param {string} data=null - S3 Object's data\n */\n constructor(key, lastModified, etag, size, storageClass, data = null) {\n this.key = key\n this.lastModified = lastModified\n this.etag = etag\n this.size = size\n this.storageClass = storageClass || ''\n this.data = data\n }\n}\n\n/**\n * Error indicating a S3 operation failed\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class S3ServiceError extends AWSError {\n /**\n * Constructs a S3ServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {string} operation - Name of the failed Operation\n */\n constructor(message, code, operation) {\n super(message, code)\n this.name = 'S3ServiceError'\n this.operation = operation\n }\n}\n","import http, { head } from 'k6/http'\nimport { AWSClient } from './client.js'\nimport { AWSError } from './error.js'\nimport { InvalidSignatureError, URIEncodingConfig } from './signature.js'\nimport { v4 as uuidv4 } from './uuid.js'\n\n/**\n * Class allowing to interact with Amazon AWS's SecretsManager service\n */\nexport class SecretsManagerClient extends AWSClient {\n /**\n * Create a SecretsManagerClient\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig) {\n const URIencodingConfig = new URIEncodingConfig(true, false)\n super(awsConfig, 'secretsmanager', URIencodingConfig)\n\n // this.serviceName = 'secretsmanager'\n\n // All interactions with the Secrets Manager service\n // are made via the GET or POST method.\n this.method = 'POST'\n\n this.commonHeaders = {\n 'Accept-Encoding': 'identity',\n 'Content-Type': 'application/x-amz-json-1.1',\n }\n }\n\n /**\n * Returns a list of all secrets owned by the authenticated sender of the request.\n * To use this operation, you must have the secretsmanager:ListSecrets permission.\n *\n * @return {Array.} secrets - An array of objects describing Secret Manager's secrets\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n listSecrets() {\n const body = JSON.stringify({})\n\n // Ensure to include the desired 'Action' in the X-Amz-Target\n // header field, as documented by the AWS API docs.\n const { url, headers } = super.buildRequest(this.method, this.host, '/', '', body, {\n ...this.commonHeaders,\n 'X-Amz-Target': `${this.serviceName}.ListSecrets`,\n })\n\n const res = http.request(this.method, url, body, { headers: headers })\n this._handle_error('ListSecrets', res)\n\n return res.json('SecretList').map((s) => Secret.fromJSON(s))\n }\n\n /**\n * Retrieves a secret from Amazon Sercets Manager\n *\n * @param {string} secretID - The ARN or name of the secret to retrieve.\n * @returns {Secret} - returns the content of the fetched Secret object.\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n getSecret(secretID) {\n const body = JSON.stringify({ SecretId: secretID })\n\n // Ensure to include the desired 'Action' in the X-Amz-Target\n // header field, as documented by the AWS API docs.\n const { url, headers } = super.buildRequest(this.method, this.host, '/', '', body, {\n ...this.commonHeaders,\n 'X-Amz-Target': `${this.serviceName}.GetSecretValue`,\n })\n\n const res = http.request(this.method, url, body, { headers: headers })\n this._handle_error('GetSecretValue', res)\n\n return Secret.fromJSON(res.json())\n }\n\n /**\n * Creates a new secret\n *\n * Note that this method only supports string-based values at the moment.\n *\n * @param {string} name - The name of the new secret.\n * The secret name can contain ASCII letters, numbers, and the following characters: /_+=.@\n * @param {string} secretString - The text data to encrypt and store in this new version of the secret.\n * @param {string} description - The description of the secret.\n * @param {string} versionID=null - Version of the secret. This value helps ensure idempotency.\n * As a default, if no versionID is provided, one will be created for you using the UUID v4\n * algorithm.\n * @param {Array.} tags=[] - A list of tags to attach to the secret. Each tag is a key and\n * value pair of strings in a JSON text string. Note that tag key names are case sensitive.\n * @returns {Secret} - returns the created secret\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n createSecret(name, secretString, description, versionID = null, tags = []) {\n versionID = versionID || uuidv4()\n\n const body = JSON.stringify({\n Name: name,\n Description: description,\n SecretString: secretString,\n ClientRequestToken: versionID,\n Tags: tags,\n })\n\n const { url, headers } = super.buildRequest(this.method, this.host, '/', '', body, {\n ...this.commonHeaders,\n 'X-Amz-Target': `${this.serviceName}.CreateSecret`,\n })\n\n // Ensure to include the desired 'Action' in the X-Amz-Target\n // header field, as documented by the AWS API docs.\n // headers['X-Amz-Target'] = `${this.serviceName}.CreateSecret`\n\n const res = http.request(this.method, url, body, { headers: headers })\n this._handle_error('CreateSecret', res)\n\n return Secret.fromJSON(res.json())\n }\n /**\n * Update a secret's value.\n *\n * Note that this method only support string-based values at the moment.\n *\n * @param {string} secretID - The ARN or name of the secret to update.\n * @param {string} secretString - The text data to encrypt and store in this new version of the secret.\n * @param {} versionID=null - A unique identifier for the new version of the secret. This value helps ensure idempotency.\n * As a default, if no versionID is provided, one will be created for you using the UUID v4\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n putSecretValue(secretID, secretString, versionID = null) {\n versionID = versionID || uuidv4()\n\n const body = JSON.stringify({\n SecretId: secretID,\n SecretString: secretString,\n ClientRequestToken: versionID,\n })\n\n // Ensure to include the desired 'Action' in the X-Amz-Target\n // header field, as documented by the AWS API docs.\n const { url, headers } = super.buildRequest(this.method, this.host, '/', '', body, {\n ...this.commonHeaders,\n 'X-Amz-Target': `${this.serviceName}.PutSecretValue`,\n })\n\n const res = http.request(this.method, url, body, { headers: headers })\n this._handle_error('PutSecretValue', res)\n\n return Secret.fromJSON(res.json())\n }\n\n /**\n * Deletes a secret and all of its versions.\n *\n * You can specify a recovery window during which you can restore the secret.\n * The minimum recovery window is 7 days. The default recovery window is 30 days.\n *\n * @param {string} secretID - The ARN or name of the secret to delete.\n * @param {number} recoveryWindow - The number of days from 7 to 30 that Secrets Manager\n * waits before permanently deleting the secret.\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n deleteSecret(secretID, { recoveryWindow = 30, noRecovery = false }) {\n const payload = {\n SecretId: secretID,\n }\n\n // noRecovery and recoveryWindow are exclusive parameters\n if (noRecovery === true) {\n payload['ForceDeleteWithoutRecovery'] = true\n } else {\n payload['RecoveryWindowInDays'] = recoveryWindow\n }\n\n const body = JSON.stringify(payload)\n\n // Ensure to include the desired 'Action' in the X-Amz-Target\n // header field, as documented by the AWS API docs.\n const { url, headers } = super.buildRequest(this.method, this.host, '/', '', body, {\n ...this.commonHeaders,\n 'X-Amz-Target': `${this.serviceName}.DeleteSecret`,\n })\n\n const res = http.request(this.method, url, body, { headers: headers })\n this._handle_error('DeleteSecret', res)\n }\n\n get host() {\n return `${this.serviceName}.${this.awsConfig.region}.amazonaws.com`\n }\n\n _handle_error(operation, response) {\n const errorCode = response.error_code\n if (errorCode === 0) {\n return\n }\n\n const error = response.json()\n if (errorCode >= 1400 && errorCode <= 1499) {\n // In the event of certain errors, the message is not set.\n // Also, note the inconsistency in casing...\n const errorMessage = error.Message || error.message || error.__type\n\n // Handle specifically the case of an invalid signature\n if (error.__type === 'InvalidSignatureException') {\n throw new InvalidSignatureError(errorMessage, error.__type)\n }\n\n // Otherwise throw a standard service error\n throw new SecretsManagerError(errorMessage, error.__type, operation)\n }\n\n if (errorCode === 1500) {\n throw new SecretsManagerError(\n 'An error occured on the server side',\n 'InternalServiceError',\n operation\n )\n }\n }\n}\n\n/**\n * Class representing a Secret Manager's secret\n */\nexport class Secret {\n /**\n * Constructs a Secret Manager's Secret\n *\n * @param {string} name - The friendly name of the secret.\n * @param {string} arn - The ARN of the secret.\n * @param {number} createdDate - The date and time that this version of the secret was created.\n * @param {number} lastAccessedDate - The last date that this secret was accessed. This value is\n * truncated to midnight of the date and therefore shows only the date, not the time.\n * @param {number} lastChangedDate - The last date and time that this secret was modified in any way.\n * @param {Array.} tags - The list of user-defined tags associated with the secret.\n */\n constructor(\n name,\n arn,\n secretString,\n createdDate,\n lastAccessedDate,\n lastChangedDate,\n tags = []\n ) {\n this.name = name\n this.arn = arn\n this.secretString = secretString\n this.createdDate = createdDate\n this.lastAccessedDate = lastAccessedDate\n this.lastChangedDate = lastChangedDate\n this.tags = tags\n }\n\n /**\n * Parses and constructs a Secret Manager's Secret from the content\n * of a JSON response returned by the AWS service\n *\n * @param {Object} json - JSON object as returned and parsed from\n * the AWS service's API call.\n * @returns {Secret}\n */\n static fromJSON(json) {\n return new Secret(\n json.Name,\n json.ARN,\n json.SecretString,\n json.CreatedDate,\n json.LastAccessedDate,\n json.LastChangeddAt,\n json.Tags\n )\n }\n}\n\n// TODO: derive a AWSServiceError to extend instead? (to save kb of code?)\nexport class SecretsManagerError extends AWSError {\n /**\n * Constructs a SecretsManagerError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {string} operation - Name of the failed Operation\n */\n constructor(message, code, operation) {\n super(message, code)\n this.name = 'SecretsManagerServiceError'\n this.operation = operation\n }\n}\n"],"names":["f","r","e","n","t","o","i","u","a","Error","code","p","exports","call","length","require","module","v1","v4","uuid","byteToHex","toString","substr","buf","offset","bth","join","getRandomValues","crypto","bind","msCrypto","window","rnds8","Uint8Array","rnds","Array","Math","random","_nodeId","_clockseq","rng","bytesToUuid","_lastMSecs","_lastNSecs","options","b","node","clockseq","undefined","seedBytes","msecs","Date","getTime","nsecs","dt","tl","tmh","ii","define","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","getter","__esModule","d","definition","key","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","Symbol","toStringTag","value","AWSConfig","region","accessKeyID","secretAccessKey","InvalidAWSConfigError","this","params","AWSError","message","name","xmlDocument","doc","parseHTML","find","text","signHeaders","headers","requestTimestamp","method","path","queryString","body","awsConfig","service","URIencodingConfig","derivedSigningKey","time","kSecret","date","toDate","kDate","hmac","kRegion","kService","deriveSigningKey","canonicalRequest","uri","query","payload","httpRequestMethod","toUpperCase","canonicalURI","URIEncode","createCanonicalURI","canonicalQueryString","qs","result","split","filter","parts","decodeURIComponent","parseQueryString","keys","sort","map","isArray","val","encodeURIComponent","createCanonicalQueryString","canonicalHeaders","constructor","entries","values","toLowerCase","trim","v","replace","createCanonicalHeaders","signedHeaders","createSignedHeaders","requestPayload","UnsignedPayload","createCanonicalPayload","createCanonicalRequest","stringToSign","hashedCanonicalRequest","requestDateTime","toTime","credentialScope","createCredentialScope","HashingAlgorithm","createStringToSign","sha256","signature","calculateSignature","authorizationHeader","InvalidSignatureError","TypeError","letter","c","isNumeric","includes","charCodeAt","URIEncodingConfig","double","timestamp","toISOString","substring","AWSClient","serviceName","host","now","url","S3Client","res","http","_handle_error","error_code","error","buckets","children","each","_","bucketDefinition","bucket","S3Bucket","forEach","child","nodeName","assign","textContent","parsed","parse","creationDate","push","bucketName","objects","objectDefinition","S3Object","lastModified","etag","size","parseInt","storageClass","objectKey","data","error_message","error_body","startsWith","S3ServiceError","awsError","parseXML","operation","SecretsManagerClient","commonHeaders","JSON","stringify","json","s","Secret","fromJSON","secretID","SecretId","secretString","description","versionID","tags","uuidv4","Name","Description","SecretString","ClientRequestToken","Tags","recoveryWindow","noRecovery","response","errorCode","errorMessage","Message","__type","SecretsManagerError","arn","createdDate","lastAccessedDate","lastChangedDate","ARN","CreatedDate","LastAccessedDate","LastChangeddAt"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"aws.min.js","mappings":"2BAAA,IAAIA,EAAK,EAAQ,KACbC,EAAK,EAAQ,KAEbC,EAAOD,EACXC,EAAKF,GAAKA,EACVE,EAAKD,GAAKA,EAEVE,EAAOC,QAAUF,G,QCFjB,IADA,IAAIG,EAAY,GACPC,EAAI,EAAGA,EAAI,MAAOA,EACzBD,EAAUC,IAAMA,EAAI,KAAOC,SAAS,IAAIC,OAAO,GAmBjDL,EAAOC,QAhBP,SAAqBK,EAAKC,GACxB,IAAIJ,EAAII,GAAU,EACdC,EAAMN,EAEV,MAAO,CACLM,EAAIF,EAAIH,MAAOK,EAAIF,EAAIH,MACvBK,EAAIF,EAAIH,MAAOK,EAAIF,EAAIH,MAAO,IAC9BK,EAAIF,EAAIH,MAAOK,EAAIF,EAAIH,MAAO,IAC9BK,EAAIF,EAAIH,MAAOK,EAAIF,EAAIH,MAAO,IAC9BK,EAAIF,EAAIH,MAAOK,EAAIF,EAAIH,MAAO,IAC9BK,EAAIF,EAAIH,MAAOK,EAAIF,EAAIH,MACvBK,EAAIF,EAAIH,MAAOK,EAAIF,EAAIH,MACvBK,EAAIF,EAAIH,MAAOK,EAAIF,EAAIH,OACtBM,KAAK,M,QCfV,IAAIC,EAAqC,oBAAZ,QAA2BC,O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,8BAC1D,cAAM/I,EAASC,IAD2C,oBAE1D,EAAKC,KAAO,6BACZ,EAAK6I,UAAYA,EAHyC,EAVlE,cAAyChJ,I","sources":["webpack://k6-jslib-aws/./node_modules/uuid/index.js","webpack://k6-jslib-aws/./node_modules/uuid/lib/bytesToUuid.js","webpack://k6-jslib-aws/./node_modules/uuid/lib/rng-browser.js","webpack://k6-jslib-aws/./node_modules/uuid/v1.js","webpack://k6-jslib-aws/./node_modules/uuid/v4.js","webpack://k6-jslib-aws/webpack/bootstrap","webpack://k6-jslib-aws/webpack/runtime/compat get default export","webpack://k6-jslib-aws/webpack/runtime/define property getters","webpack://k6-jslib-aws/webpack/runtime/hasOwnProperty shorthand","webpack://k6-jslib-aws/webpack/runtime/make namespace object","webpack://k6-jslib-aws/external commonjs \"k6/crypto\"","webpack://k6-jslib-aws/external commonjs \"k6/html\"","webpack://k6-jslib-aws/./src/internal/error.ts","webpack://k6-jslib-aws/./src/internal/signature.ts","webpack://k6-jslib-aws/./src/internal/config.ts","webpack://k6-jslib-aws/external commonjs \"k6/http\"","webpack://k6-jslib-aws/./src/internal/client.ts","webpack://k6-jslib-aws/./src/internal/s3.ts","webpack://k6-jslib-aws/./src/internal/secrets-manager.ts"],"sourcesContent":["var v1 = require('./v1');\nvar v4 = require('./v4');\n\nvar uuid = v4;\nuuid.v1 = v1;\nuuid.v4 = v4;\n\nmodule.exports = uuid;\n","/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nvar byteToHex = [];\nfor (var i = 0; i < 256; ++i) {\n byteToHex[i] = (i + 0x100).toString(16).substr(1);\n}\n\nfunction bytesToUuid(buf, offset) {\n var i = offset || 0;\n var bth = byteToHex;\n // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4\n return ([\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]]\n ]).join('');\n}\n\nmodule.exports = bytesToUuid;\n","// Unique ID creation requires a high quality random # generator. In the\n// browser this is a little complicated due to unknown quality of Math.random()\n// and inconsistent support for the `crypto` API. We do the best we can via\n// feature-detection\n\n// getRandomValues needs to be invoked in a context where \"this\" is a Crypto\n// implementation. Also, find the complete implementation of crypto on IE11.\nvar getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||\n (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));\n\nif (getRandomValues) {\n // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto\n var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef\n\n module.exports = function whatwgRNG() {\n getRandomValues(rnds8);\n return rnds8;\n };\n} else {\n // Math.random()-based (RNG)\n //\n // If all else fails, use Math.random(). It's fast, but is of unspecified\n // quality.\n var rnds = new Array(16);\n\n module.exports = function mathRNG() {\n for (var i = 0, r; i < 16; i++) {\n if ((i & 0x03) === 0) r = Math.random() * 0x100000000;\n rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;\n }\n\n return rnds;\n };\n}\n","var rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\n\nvar _nodeId;\nvar _clockseq;\n\n// Previous uuid creation time\nvar _lastMSecs = 0;\nvar _lastNSecs = 0;\n\n// See https://github.com/uuidjs/uuid for API details\nfunction v1(options, buf, offset) {\n var i = buf && offset || 0;\n var b = buf || [];\n\n options = options || {};\n var node = options.node || _nodeId;\n var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;\n\n // node and clockseq need to be initialized to random values if they're not\n // specified. We do this lazily to minimize issues related to insufficient\n // system entropy. See #189\n if (node == null || clockseq == null) {\n var seedBytes = rng();\n if (node == null) {\n // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n node = _nodeId = [\n seedBytes[0] | 0x01,\n seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]\n ];\n }\n if (clockseq == null) {\n // Per 4.2.2, randomize (14 bit) clockseq\n clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n }\n }\n\n // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();\n\n // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;\n\n // Time since last uuid creation (in msecs)\n var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;\n\n // Per 4.2.1.2, Bump clockseq on clock regression\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n }\n\n // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n }\n\n // Per 4.2.1.2 Throw error if too many uuids are requested\n if (nsecs >= 10000) {\n throw new Error('uuid.v1(): Can\\'t create more than 10M uuids/sec');\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq;\n\n // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n msecs += 12219292800000;\n\n // `time_low`\n var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff;\n\n // `time_mid`\n var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff;\n\n // `time_high_and_version`\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n b[i++] = tmh >>> 16 & 0xff;\n\n // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n b[i++] = clockseq >>> 8 | 0x80;\n\n // `clock_seq_low`\n b[i++] = clockseq & 0xff;\n\n // `node`\n for (var n = 0; n < 6; ++n) {\n b[i + n] = node[n];\n }\n\n return buf ? buf : bytesToUuid(b);\n}\n\nmodule.exports = v1;\n","var rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\nfunction v4(options, buf, offset) {\n var i = buf && offset || 0;\n\n if (typeof(options) == 'string') {\n buf = options === 'binary' ? new Array(16) : null;\n options = null;\n }\n options = options || {};\n\n var rnds = options.random || (options.rng || rng)();\n\n // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n\n // Copy bytes to buffer, if provided\n if (buf) {\n for (var ii = 0; ii < 16; ++ii) {\n buf[i + ii] = rnds[ii];\n }\n }\n\n return buf || bytesToUuid(rnds);\n}\n\nmodule.exports = v4;\n","// 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](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\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/html\");","import { parseHTML } from 'k6/html'\n\n/**\n * Base class to derive errors from\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class AWSError extends Error {\n code: string\n\n /**\n * Create an AWSError\n *\n * @param {string} message - A longer human readable error message.\n * @param {string} code - A unique short code representing the error that was emitted\n */\n constructor(message: string, code: string) {\n super(message)\n this.name = 'AWSError'\n this.code = code\n }\n\n /**\n * Parse an AWSError from an XML document\n *\n * @param {string} xmlDocument - Serialized XML document to parse the error from\n */\n static parseXML(xmlDocument: string): AWSError {\n const doc = parseHTML(xmlDocument)\n return new AWSError(doc.find('Message').text(), doc.find('Code').text())\n }\n}\n","import crypto, { hmac, sha256 } from 'k6/crypto'\nimport { HTTPMethod, HTTPHeaders } from './http'\nimport { AWSConfig } from './config'\nimport { AWSError } from './error'\n\n/**\n * Includes AWS v4 signing information to the provided HTTP headers object.\n *\n * This function will compute the `Authorization` header signature for the\n * provided request components, and add it to `header`. It will do so by following\n * the procedure detailled AWS' API docs: https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n *\n * The resulting `Authorization` header value is computed for the provided\n * headers object. Thus, any modification of the headers past a call to `signHeaders`\n * would effectively invalidate their signature, and the function should be\n * called again to recompute it.\n *\n * @param {object} headers - HTTP headers request to sign.\n * @param {number} requestTimestamp - Timestamp of the request\n * @param {string} method - HTTP method used\n * @param {string} path - HTTP request URL's path\n * @param {string} queryString - HTTP request URL's querystring\n * @param {string | ArrayBuffer} body - HTTP request's payload\n * @param {AWSConfig} - AWS configuration\n * @param {string} service - AWS service name\n * @param {URIEncodingConfig} - URI encoding configuration\n */\nexport function signHeaders(\n headers: HTTPHeaders,\n requestTimestamp: number,\n method: HTTPMethod,\n path: string,\n queryString: string,\n body: string | ArrayBuffer,\n awsConfig: AWSConfig,\n service: string,\n URIencodingConfig: URIEncodingConfig\n): HTTPHeaders {\n const derivedSigningKey = deriveSigningKey(\n awsConfig.secretAccessKey,\n requestTimestamp,\n awsConfig.region,\n service\n )\n\n const canonicalRequest = createCanonicalRequest(\n method,\n path,\n queryString,\n headers,\n body,\n URIencodingConfig\n )\n\n const stringToSign = createStringToSign(\n requestTimestamp,\n awsConfig.region,\n service,\n sha256(canonicalRequest, 'hex')\n )\n\n const credentialScope = createCredentialScope(requestTimestamp, awsConfig.region, service)\n const signedHeaders = createSignedHeaders(headers)\n const signature = calculateSignature(derivedSigningKey, stringToSign)\n const authorizationHeader = `${HashingAlgorithm} Credential=${awsConfig.accessKeyID}/${credentialScope}, SignedHeaders=${signedHeaders}, Signature=${signature}`\n\n headers['Authorization'] = authorizationHeader\n\n return headers\n}\n\n/**\n * Error indicating an Invalid signature has been sent to AWS services\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class InvalidSignatureError extends AWSError {\n /**\n * Constructs an InvalidSignatureError\n *\n * @param {string} message - human readable error message\n */\n constructor(message: string, code: string) {\n super(message, code)\n this.name = 'InvalidSignatureError'\n }\n}\n\n/**\n * Calculte the signature for AWS signature version 4\n *\n * @param {string} derivedSigningKey - dervied signing key as computed by `deriveSigningKey`\n * @param {string} stringToSign - String to sign as computed by `createStringToSign`\n * @return {string}\n */\nexport function calculateSignature(derivedSigningKey: ArrayBuffer, stringToSign: string): string {\n return hmac('sha256', derivedSigningKey, stringToSign, 'hex')\n}\n/**\n * Derives the signing key for authenticating requests signed with\n * the Signature version 4 authentication protocol.\n *\n * deriveSigningKey produces a signing key by creating a series of\n * hash-based message authentication codes (HMACs) represented in\n * a binary format.\n *\n * The derived signing key is specific to the date it's made at, as well as\n * the service and region it targets.\n *\n * @param {string} secretAccessKey - the AWS secret access key to derive the signing key for\n * @param {number} time - timestamp of the request\n * @param {string} region - targeted AWS region. MUST be UTF-8 encoded.\n * @param {string} service - targeted AWS service. MUST be UTF-8 encoded.\n * @return {string}\n */\nexport function deriveSigningKey(\n secretAccessKey: string,\n time: number,\n region: string,\n service: string\n): ArrayBuffer {\n const kSecret = secretAccessKey\n const date = toDate(time)\n\n // FIXME: hmac takes ArrayBuffer as input, but returns bytes (number[]).\n // How does one convert from one to the other?\n const kDate: any = hmac('sha256', 'AWS4' + kSecret, date, 'binary')\n const kRegion: any = hmac('sha256', kDate, region, 'binary')\n const kService: any = hmac('sha256', kRegion, service, 'binary')\n const kSigning: any = hmac('sha256', kService, 'aws4_request', 'binary')\n\n return kSigning\n}\n\n// Hashing Algorithm to use in the signature process\nexport const HashingAlgorithm = 'AWS4-HMAC-SHA256'\n\n/**\n * Certain services, such as S3, allow for unsigned payloads. If\n * producing a signed canonical request for such service, pass\n * the `UnsignedPayload` constant value as the payload parameter.\n */\nexport const UnsignedPayload = 'UNSIGNED-PAYLOAD'\n\n/**\n * Create the \"string to sign\" part of the signature Version 4 protocol.\n *\n * The \"string to sign\" includes meta information about your request and\n * about the canonical request that you created with `createCanonicalRequest`.\n * It is used hand in hand with the signing key to create the request signature.\n *\n * @param {number} requestTimestamp - timestamp of the request\n * @param {string} region - targeted AWS region. MUST be UTF-8 encoded.\n * @param {string} service - targeted AWS service name. MUST be UTF-8 encoded.\n * @param {string} hashedCanonicalRequest - canonical request as produced by calling the createCanonicalRequest function,\n * hashed using the SHA256 algorithm (encoded in hexadecimal format).\n * @return {string}\n */\nexport function createStringToSign(\n requestTimestamp: number,\n region: string,\n service: string,\n hashedCanonicalRequest: string\n): string {\n // the request date specified in ISO8601 format: YYYYMMDD'T'HHMMSS'Z'\n const requestDateTime = toTime(requestTimestamp)\n\n // The credential scope value, consisting of the date in YYYYMMDD format,\n // the targeted region, the targeted service, and a termination string.\n // Note that the region and service MUST be UTF-8 encoded.\n const credentialScope = createCredentialScope(requestTimestamp, region, service)\n\n const stringToSign = [\n // Algorithm\n HashingAlgorithm,\n\n // RequestDateTime\n requestDateTime,\n\n // CredentialScope\n credentialScope,\n\n // HashedCanonicalRequest\n hashedCanonicalRequest,\n ].join('\\n')\n\n return stringToSign\n}\n\n/**\n *\n * Helper function creating a credential scope string to use in the signature\n * version 4 process. A credential scope consists of the date of the request\n * in YYYYMMDD format, the targeted region, the targeted service, and a\n * termination string.\n *\n * Note that the region and service MUST be UTF-8 encoded.\n *\n * @param {number} requestTimestamp - timestamp of the request\n * @param {string} region - targeted AWS region. MUST be UTF-8 encoded.\n * @param {string} service - targeted AWS service name. MUST be UTF-8 encoded.\n * @return {string}\n */\nexport function createCredentialScope(\n requestTimestamp: number,\n region: string,\n service: string\n): string {\n return [toDate(requestTimestamp), region, service, 'aws4_request'].join('/')\n}\n\n/**\n * Create a string that includes information from your request\n * in a AWS signature v4 standardized (canonical) format.\n *\n * @param {string} method - the HTTP request method\n * @param {string} uri - URI-encoded version of the absolute path component of the URI\n * @param {string} query - request's query string\n * @param {Object} headers - all the HTTP headers that you wish to include with the signed request\n * @param {string | ArrayBuffer} payload - payload to include as the body of the request\n * @param {URIEncodingConfig} URIencodingConfig- URI encoding configuration\n * @return {string}\n */\nexport function createCanonicalRequest(\n method: HTTPMethod,\n uri: string,\n query: string,\n headers: HTTPHeaders,\n payload: string | ArrayBuffer,\n URIencodingConfig: URIEncodingConfig\n): string {\n const httpRequestMethod = method.toUpperCase()\n const canonicalURI = createCanonicalURI(uri, URIencodingConfig)\n const canonicalQueryString = createCanonicalQueryString(query)\n const canonicalHeaders = createCanonicalHeaders(headers)\n const signedHeaders = createSignedHeaders(headers)\n const requestPayload = createCanonicalPayload(payload)\n\n const canonicalRequest = [\n httpRequestMethod,\n canonicalURI,\n canonicalQueryString,\n canonicalHeaders,\n signedHeaders,\n requestPayload,\n ].join('\\n')\n\n return canonicalRequest\n}\n\n/**\n * Creates the (canonical) URI-encoded version of the\n * absolute path component of the URI: everything in the URI\n * from the HTTP host to the question mark character (\"?\")\n * that begins the query string parameters (if any).\n *\n * @param {string} uri - URI to canonize\n * @param {URIEncodingConfig} - URI encoding configuration\n * @return {string} - canonical URL\n */\nexport function createCanonicalURI(uri: string, URIencodingConfig: URIEncodingConfig): string {\n if (uri == '/') {\n return uri\n }\n\n let canonicalURI = uri\n if (uri[uri.length - 1] == '/' && canonicalURI[canonicalURI.length - 1] != '/') {\n canonicalURI += '/'\n }\n\n canonicalURI = URIEncode(canonicalURI, URIencodingConfig.path)\n\n return URIencodingConfig.double ? URIEncode(canonicalURI, URIencodingConfig.path) : canonicalURI\n}\n\n// FIXME: does it work as expected?\n/**\n * Creates the canonical form of the request's query\n * string. If the request does not include a query string,\n * provide an empty string.\n *\n * @param {String | Object} qs - query string to canonize\n * @return {string}\n */\nexport function createCanonicalQueryString(qs: string): string {\n if (qs === '') {\n return ''\n }\n\n // const intermediary: { [key: string]: string } = parseQueryString(qs)\n\n // return Object.keys(intermediary)\n // .sort()\n // .map((key: string) => {\n // // const values: string[] = Array.isArray(intermediary[key])\n // // ? intermediary[key]\n // // : [intermediary[key]]\n // const values = intermediary[key]\n\n // return values\n // .sort()\n // .map((val: string) => encodeURIComponent(key) + '=' + encodeURIComponent(val))\n // .join('&')\n // })\n // .join('&')\n\n return parseQueryString(qs)\n .map(([key, value]: [string, string]): string => {\n return encodeURIComponent(key) + '=' + encodeURIComponent(value)\n })\n .join('&')\n}\n/**\n * Create the canonical form of the request's headers.\n * Canonical headers consist of all the HTTP headers you\n * are including with the signed request.\n *\n * Note that:\n * * for HTTP/1.1 requests, the headers should at least\n * contain the `host` header.\n * * for HTTP/2, the `:authority` header must be used instead\n * of `host`.\n *\n * @param {Object} headers\n * @return {string}\n */\nexport function createCanonicalHeaders(headers: HTTPHeaders) {\n if (headers.constructor !== Object || Object.entries(headers).length === 0) {\n return ''\n }\n\n const canonicalHeaders = Object.entries(headers)\n .map(([name, values]) => {\n const canonicalName = name.toLowerCase().trim()\n const normalizedValues = Array.isArray(values) ? values : [values]\n\n // Note that we do not need to sort values\n const canonicalValues = normalizedValues\n .map((v) => {\n // convert sequential spaces to a single space\n return v.replace(/\\s+/g, ' ').replace(/^\\s+|\\s+$/g, '')\n })\n .join(',') // standard for multiple values in a HTTP header\n\n return canonicalName + ':' + canonicalValues + '\\n'\n })\n .sort()\n .join('')\n\n return canonicalHeaders\n}\n\n/**\n * Create the canonical request's signed headers.\n *\n * The signed headers part of the request contains the\n * list of headers included in the request's signing process.\n *\n * Note that:\n * * for HTTP/1.1 requests, the `host` header must be included.\n * * for HTTP/2 requests, the `:authority` header must be included instead\n * of host.\n * * if used, the `x-amz-date` header must be included.\n *\n * @param {Object} headers\n * @return {string}\n * @throws {TypeError} - on headers not being an Object, or being empty.\n */\nexport function createSignedHeaders(headers: { [key: string]: string }) {\n if (headers.constructor !== Object) {\n throw new TypeError('headers should be an object')\n }\n\n if (Object.entries(headers).length === 0) {\n throw 'headers should at least contain either the Host (HTTP 1.1) or :authority (HTTP 2) parameter'\n }\n\n // To create the signed headers list, convert\n // all header names to lowercase, sort them by\n // character code, and use a semicolon to separate\n // the header names.\n const result = Object.keys(headers)\n .map((name) => name.toLowerCase().trim())\n .sort()\n .join(';')\n\n return result\n}\n\n/**\n * Create the canonical form of the request's payload.\n *\n * The canonical payload consists in a lowercased, hex encoded,\n * SHA256 hash of the requests body/payload.\n *\n * Certain services, such as S3, allow for unsigned payload. If\n * producing a signed canonical request for such service, pass\n * the `UnsignedPayload` constant value as the payload parameter.\n *\n * @param {String | ArrayBuffer} payload\n * @return {string}\n */\nexport function createCanonicalPayload(payload: string | ArrayBuffer) {\n if (payload === UnsignedPayload) {\n return payload\n }\n\n // Note that if the paylaod is null, we convert it\n // to an empty string.\n // TODO: Should switching to empty string if null impact headers?\n return crypto.sha256(payload || '', 'hex').toLowerCase()\n}\n\n/**\n * URIEncodes encodes every bytes of a URI to be URL-safe.\n *\n * This implementation is specific to AWS; who intended to make it as\n * close as possible to the underlying RFC 3946. It:\n * * URI encode every byte except the unreserved characters: 'A'-'Z', 'a'-'z', '0'-'9',\n * '-', '.', '_', and '~'.\n * * considers the space character as a reserved character and must URI encodes\n * encodes it as \"%20\" (and not as \"+\").\n * * URI encodes every byte by prefixing with '%' the two-digit hexadecimal value of the byte.\n * * If the `path` argument is set, forward slashes are not encoded, to fit with\n * S3 requirements.\n *\n * N.B: this implementation differs with ES6' mainly in that it does\n * encode the \"'\" character.\n *\n * Based on AWS implementation: https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-core/src/main/java/com/amazonaws/util/SdkHttpUtils.java#L66\n * Encoding specs: https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html\n *\n * @param {string} uri - uri to encode\n * @param {boolean} path - slash characters should be encoded everywhere,\n * but in paths, set to false when encoding a path\n * @return {string} the URI encoded result\n */\nexport function URIEncode(uri: string, path: boolean): string {\n if (uri == '') {\n return uri\n }\n\n return uri\n .split('') // to be able to map over a string, because... javascript...\n .map((letter: string) => {\n if (isAlpha(letter) || isNumeric(letter) || '-._~'.includes(letter)) {\n return letter\n }\n\n // Space should be explicitly encoded to as %20.\n if (letter == ' ') {\n return '%20'\n }\n\n // If the URI is a path, the forward slash shouldn't\n // be encoded.\n if (letter == '/' && path) {\n return '/'\n }\n\n return '%' + letter.charCodeAt(0).toString(16).toUpperCase()\n })\n .join('')\n}\n\n/**\n * Class holding URI encoding configuration\n */\nexport class URIEncodingConfig {\n double: boolean\n path: boolean\n\n /**\n *\n * @param {boolean} double - should the URI be double encoded?\n * @param {boolean} path - is the URI a path? If so, its forward\n * slashes won't be URIencoded.\n */\n constructor(double: boolean, path: boolean) {\n this.double = double\n this.path = path\n }\n}\n\n/**\n * Compute the request time value as specified by the ISO8601\n * format: YYYYMMDD'T'HHMMSS'Z'\n *\n * @param {number} timestamp\n * @return {string}\n */\nexport function toTime(timestamp: number): string {\n return new Date(timestamp).toISOString().replace(/[:\\-]|\\.\\d{3}/g, '')\n}\n/**\n * Computethe request date value in the format: YYYMMDD\n *\n * @param {number} timestamp\n * @return {string}\n */\nexport function toDate(timestamp: number): string {\n return toTime(timestamp).substring(0, 8)\n}\n\n// FIXME: does it work as expected?\n/**\n * Parse a HTTP request URL's querystring into an object\n * containing its `key=value` pairs.\n *\n * @param {string} qs\n * @return {object}\n */\nexport function parseQueryString(qs: string): Array<[string, string]> {\n if (qs.length === 0) {\n return []\n }\n\n return qs\n .split('&')\n .filter((e) => e)\n .map((v: string): [string, string] => {\n const parts = v.split('=', 2) as [string, string]\n return [decodeURIComponent(parts[0]), decodeURIComponent(parts[1])]\n })\n .sort((a: [string, string], b: [string, string]) => {\n return a[0].localeCompare(b[0])\n })\n}\n\nfunction isAlpha(c: string): boolean {\n return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')\n}\n\nfunction isNumeric(c: string): boolean {\n return c >= '0' && c <= '9'\n}\n\n// FIXME: finish implementation when needed\n// See the following for more details:\n// * https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html\n// * https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html\n// export function signQueryString(\n// queryString,\n// requestTimestamp,\n// accessKeyID,\n// secretAccessKey,\n// region,\n// service,\n// ttl, // in seconds\n// headers,\n// doubleURIEncoding = true\n// ) {\n// const credential = [accessKeyID, toDate(requestTimestamp), region, service].join('/')\n//\n// const canonicalRequest = createCanonicalRequest(\n// method,\n// path,\n// queryString,\n// headers,\n// body,\n// doubleURIEncoding\n// )\n//\n// const derivedSigningKey = deriveSigningKey(secretAccessKey, requestTimestamp, region, service)\n//\n// const stringToSign = createStringToSign(\n// requestTimestamp,\n// region,\n// service,\n// sha256(canonicalRequest, 'hex')\n// )\n//\n// const signedHeaders = createSignedHeaders(headers)\n// const signature = calculateSignature(derivedSigningKey, stringToSign)\n//\n// return [\n// `X-Amz-Algorithm=${HashingAlgorithm}`,\n// `X-Amz-Credential=${crediental}`,\n// `X-Amz-Date=${toTime(requestTimestamp)}`,\n// `X-Amz-Expires=${ttl}`,\n// `X-Amz-SignedHeaders=${signedHeaders}`,\n// `X-Amz-Signature=${signature}`,\n//`X-Amz-Security-Token=`, // TODO: optional\n// ].join('&')\n// }\n","/** Class holding an AWS connection information */\nexport class AWSConfig {\n region: string\n accessKeyID: string\n secretAccessKey: string\n\n /**\n * Create an AWSConfig.\n *\n * @param {string} region - the AWS region to connect to, as listed: https://docs.aws.amazon.com/general/latest/gr/rande.html\n * @param {string} accessKeyID - Your user's AWS access key id credential\n * @param {string} secretAccessKey - Your user's AWS secret access key credential\n * @throws {InvalidArgumentException}\n */\n constructor(region: string, accessKeyID: string, secretAccessKey: string) {\n if (typeof region !== 'string' || region === '') {\n throw new InvalidAWSConfigError(\n 'invalid AWS region; reason: should be a non empty string'\n )\n }\n\n if (typeof accessKeyID !== 'string' || accessKeyID === '') {\n throw new InvalidAWSConfigError(\n 'invalid AWS access key ID; reason: should be a non empty string'\n )\n }\n\n if (typeof secretAccessKey !== 'string' || secretAccessKey === '') {\n throw new InvalidAWSConfigError(\n 'invalid AWS secret access key; reason: should be a non empty string'\n )\n }\n\n this.region = region\n this.accessKeyID = accessKeyID\n this.secretAccessKey = secretAccessKey\n }\n}\n\n/** Class representing an invalid AWS configuration */\nexport class InvalidAWSConfigError extends Error {\n constructor(message: string) {\n super(message)\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"k6/http\");","import { HTTPMethod, HTTPHeaders } from './http'\nimport { AWSConfig } from './config'\nimport { signHeaders, URIEncodingConfig, toTime } from './signature'\n\n/**\n * Class allowing to build requests targeting AWS APIs\n *\n * This class is meant to be used as a base class for specific\n * services clients. See S3Client or SecretsManagerClient for\n * usage examples.\n */\nexport class AWSClient {\n awsConfig: AWSConfig\n serviceName: string\n URIencodingConfig: URIEncodingConfig\n\n /**\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n * @param {string} serviceName - name of the service to target.\n * @param {URIEncodingConfig} URIencodingConfig - configures how requests URIs should be encoded.\n */\n constructor(awsConfig: AWSConfig, serviceName: string, URIencodingConfig: URIEncodingConfig) {\n this.awsConfig = awsConfig\n this.serviceName = serviceName\n this.URIencodingConfig = URIencodingConfig\n }\n\n buildRequest(\n method: HTTPMethod,\n host: string,\n path: string,\n queryString: string,\n body: string | ArrayBuffer,\n headers: HTTPHeaders\n ): AWSRequest {\n const requestTimestamp: number = Date.now()\n const date: string = toTime(requestTimestamp)\n\n headers['Host'] = host\n headers['X-Amz-Date'] = date\n\n headers = signHeaders(\n // headers\n headers,\n\n // requestTimestamp\n requestTimestamp,\n\n // method\n method,\n\n // path\n path,\n\n // querystring\n queryString,\n\n // body\n body,\n\n // AWS configuration\n this.awsConfig,\n\n // AwS target service name\n this.serviceName,\n\n // doubleEncoding: S3 does single-encoding of the uri component\n // pathURIEncoding: S3 manipulates object keys, and forward slashes\n // shouldn't be URI encoded\n this.URIencodingConfig\n )\n\n // '?' should not be part of the querystring when we sign the headers\n path = path !== '' ? path : '/'\n let url = `https://${host}${path}`\n if (queryString !== '') {\n url += `?${queryString}`\n }\n\n return { url: url, headers: headers }\n }\n}\n\n/**\n * Type alias representing the result of an AWSClient.buildRequest call\n */\nexport interface AWSRequest {\n url: string\n headers: HTTPHeaders\n}\n","import { bytes } from 'k6'\nimport http from 'k6/http'\nimport { parseHTML } from 'k6/html'\nimport { sha256 } from 'k6/crypto'\n\nimport { InvalidSignatureError, URIEncodingConfig } from './signature'\nimport { AWSClient, AWSRequest } from './client'\nimport { AWSError } from './error'\nimport { AWSConfig } from './config'\n\n/** Class allowing to interact with Amazon AWS's S3 service */\nexport class S3Client extends AWSClient {\n /**\n * Create a S3Client\n *\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n const URIencodingConfig = new URIEncodingConfig(false, true)\n super(awsConfig, 's3', URIencodingConfig)\n }\n\n /**\n * Returns a list of all buckets owned by the authenticated sender of the request.\n * To use this operation, you must have the s3:ListAllMyBuckets permission.\n *\n * @return {Array.} buckets - An array of objects describing S3 buckets\n * with the following fields: name, and creationDate.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n listBuckets(): Array {\n // Prepare request\n const method = 'GET'\n const host = `${this.serviceName}.${this.awsConfig.region}.amazonaws.com`\n const body = ''\n const signedRequest: AWSRequest = super.buildRequest(method, host, '/', '', body, {\n 'X-Amz-Content-SHA256': sha256(body, 'hex'),\n })\n\n const res = http.request(method, signedRequest.url, body, {\n headers: signedRequest.headers,\n })\n this._handle_error(res.error_code, res.error, res.body as string)\n\n let buckets: Array = []\n\n const doc = parseHTML(res.body as string)\n\n doc.find('Buckets')\n .children()\n .each((_, bucketDefinition) => {\n let bucket = {}\n\n bucketDefinition.children().forEach((child) => {\n switch (child.nodeName()) {\n case 'name':\n Object.assign(bucket, { name: child.textContent() })\n break\n case 'creationdate':\n Object.assign(bucket, {\n creationDate: Date.parse(child.textContent()),\n })\n }\n })\n\n buckets.push(bucket as S3Bucket)\n })\n\n return buckets\n }\n\n /**\n * Returns some or all (up to 1,000) of the objects in a bucket.\n *\n * @param {string} bucketName - Bucket name to list.\n * @param {string?} prefix='' - Limits the response to keys that begin with the specified prefix.\n * @return {Array.} - returns an array of objects describing S3 objects\n * with the following fields: key, lastModified, etag, size and storageClass.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n listObjects(bucketName: string, prefix?: string): Array {\n // Prepare request\n const method = 'GET'\n const host = `${bucketName}.${this.serviceName}.${this.awsConfig.region}.amazonaws.com`\n const body = ''\n const signedRequest: AWSRequest = super.buildRequest(\n method,\n host,\n '/',\n 'list-type=2',\n body,\n {\n 'X-Amz-Content-SHA256': sha256(body, 'hex'),\n }\n )\n\n const res = http.request(method, signedRequest.url, body, {\n headers: signedRequest.headers,\n })\n this._handle_error(res.error_code, res.error, res.body as string)\n\n let objects: Array = []\n\n // Extract the objects definition from\n // the XML response\n parseHTML(res.body as string)\n .find('Contents')\n .each((_, objectDefinition) => {\n let obj = {}\n\n objectDefinition.children().forEach((child) => {\n switch (child.nodeName()) {\n case 'key':\n Object.assign(obj, { key: child.textContent() })\n break\n case 'lastmodified':\n // const parsed = Date.parse(\n // child.textContent(),\n // 'YYYY-MM-ddTHH:mm:ss.sssZ'\n // )\n Object.assign(obj, { lastModified: Date.parse(child.textContent()) })\n break\n case 'etag':\n Object.assign(obj, { etag: child.textContent() })\n break\n case 'size':\n Object.assign(obj, { size: parseInt(child.textContent()) })\n break\n case 'storageclass':\n Object.assign(obj, { storageClass: child.textContent() })\n }\n })\n\n objects.push(obj as S3Object)\n })\n\n return objects\n }\n /**\n * Retrieves an Object from Amazon S3.\n *\n * To use getObject, you must have `READ` access to the object.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to get.\n * @return {S3Object} - returns the content of the fetched S3 Object.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n getObject(bucketName: string, objectKey: string): S3Object {\n // Prepare request\n const method = 'GET'\n const host = `${bucketName}.${this.serviceName}.${this.awsConfig.region}.amazonaws.com`\n const path = `/${objectKey}`\n const body = ''\n const signedRequest: AWSRequest = super.buildRequest(method, host, path, '', body, {\n 'X-Amz-Content-SHA256': sha256(body, 'hex'),\n })\n\n const res = http.request(method, signedRequest.url, body, {\n headers: signedRequest.headers,\n })\n this._handle_error(res.error_code, res.error, res.body as string)\n\n return new S3Object(\n objectKey,\n Date.parse(res.headers['Last-Modified']),\n res.headers['ETag'],\n parseInt(res.headers['Content-Length']),\n undefined, // GetObject response doesn't contain the storage class\n res.body\n )\n }\n /**\n * Adds an object to a bucket.\n *\n * You must have WRITE permissions on a bucket to add an object to it.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to put.\n * @param {string | ArrayBuffer} data - the content of the S3 Object to upload.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n putObject(bucketName: string, objectKey: string, data: string | ArrayBuffer) {\n // Prepare request\n const method = 'PUT'\n const host = `${bucketName}.${this.serviceName}.${this.awsConfig.region}.amazonaws.com`\n const path = `/${objectKey}`\n const queryString = ''\n const body = data\n const signedRequest: AWSRequest = super.buildRequest(\n method,\n host,\n path,\n queryString,\n body,\n {\n 'X-Amz-Content-SHA256': sha256(body, 'hex'),\n }\n )\n\n const res = http.request(method, signedRequest.url, body, {\n headers: signedRequest.headers,\n })\n this._handle_error(res.error_code, res.error, res.body as string)\n }\n\n /**\n * Removes the null version (if there is one) of an object and inserts a delete marker,\n * which becomes the latest version of the object.\n *\n * @param {string} bucketName - The bucket name containing the object.\n * @param {string} objectKey - Key of the object to delete.\n * @throws {S3ServiceError}\n * @throws {InvalidSignatureError}\n */\n deleteObject(bucketName: string, objectKey: string): void {\n // Prepare request\n const method = 'DELETE'\n const host = `${bucketName}.${this.serviceName}.${this.awsConfig.region}.amazonaws.com`\n const path = `/${objectKey}`\n const queryString = ''\n const body = ''\n const signedRequest: AWSRequest = super.buildRequest(\n method,\n host,\n path,\n queryString,\n body,\n {\n 'X-Amz-Content-SHA256': sha256(body, 'hex'),\n }\n )\n\n const res = http.request(method, signedRequest.url, body, {\n headers: signedRequest.headers,\n })\n this._handle_error(res.error_code, res.error, res.body as string)\n }\n\n // FIXME: remove dependency to `error_message`\n // FIXME: just pass it the response?\n _handle_error(error_code: number, error_message: string, error_body: string) {\n if (error_message == '' || error_code === 0) {\n return\n }\n\n // FIXME: should be error_code === 1301 instead\n // See: https://github.com/grafana/k6/issues/2474\n // See: https://github.com/golang/go/issues/49281\n if (error_message && error_message.startsWith('301')) {\n // Bucket not found\n throw new S3ServiceError('Resource not found', 'ResourceNotFound', 'getObject')\n }\n\n const awsError = AWSError.parseXML(error_body)\n switch (awsError.code) {\n case 'AuthorizationHeaderMalformed':\n throw new InvalidSignatureError(awsError.message, awsError.code)\n default:\n throw new S3ServiceError(awsError.message, awsError.code, 'listObjects')\n }\n }\n}\n\n// TODO: use interface instead?\n/** Class representing a S3 Bucket */\nexport class S3Bucket {\n name: string\n creationDate: Date\n\n /**\n * Create an S3 Bucket\n *\n * @param {string} name - S3 bucket's name\n * @param {Date} creationDate - S3 bucket's creation date\n */\n constructor(name: string, creationDate: Date) {\n this.name = name\n this.creationDate = creationDate\n }\n}\n\n// TODO: use interface instead?\n/** Class representing an S3 Object */\nexport class S3Object {\n key: string\n lastModified: number\n etag: string\n size: number\n storageClass: StorageClass\n data?: string | bytes | null\n\n /**\n * Create an S3 Object\n *\n * @param {string} key - S3 object's key\n * @param {Date} lastModified - S3 object last modification date\n * @param {string} etag - S3 object's etag\n * @param {number} size - S3 object's size\n * @param {StorageClass} storageClass - S3 object's storage class\n * @param {string | bytes | null} data=null - S3 Object's data\n */\n constructor(\n key: string,\n lastModified: number,\n etag: string,\n size: number,\n storageClass: StorageClass,\n data?: string | bytes | null\n ) {\n this.key = key\n this.lastModified = lastModified\n this.etag = etag\n this.size = size\n this.storageClass = storageClass\n this.data = data\n }\n}\n\n/**\n * Error indicating a S3 operation failed\n *\n * Inspired from AWS official error types, as\n * described in:\n * * https://aws.amazon.com/blogs/developer/service-error-handling-modular-aws-sdk-js/\n * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts\n */\nexport class S3ServiceError extends AWSError {\n operation: string\n\n /**\n * Constructs a S3ServiceError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {string} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: string) {\n super(message, code)\n this.name = 'S3ServiceError'\n this.operation = operation\n }\n}\n\n/**\n * Describes the class of storage used to store a S3 object.\n */\ntype StorageClass =\n | 'STANDARD'\n | 'REDUCED_REDUNDANCY'\n | 'GLACIER'\n | 'STANDARD_IA'\n | 'INTELLIGENT_TIERING'\n | 'DEEP_ARCHIVE'\n | 'OUTPOSTS'\n | 'GLACIER_IR'\n | undefined\n","import { JSONArray, JSONObject } from 'k6'\nimport http, { RefinedResponse, ResponseType } from 'k6/http'\n\nimport { AWSClient, AWSRequest } from './client'\nimport { AWSError } from './error'\nimport { AWSConfig } from './config'\nimport { InvalidSignatureError, URIEncodingConfig } from './signature'\nimport { v4 as uuidv4 } from 'uuid'\nimport { HTTPMethod, HTTPHeaders } from './http'\n\n/**\n * Class allowing to interact with Amazon AWS's SecretsManager service\n */\nexport class SecretsManagerClient extends AWSClient {\n method: HTTPMethod\n commonHeaders: HTTPHeaders\n\n /**\n * Create a SecretsManagerClient\n * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs\n */\n constructor(awsConfig: AWSConfig) {\n const URIencodingConfig = new URIEncodingConfig(true, false)\n super(awsConfig, 'secretsmanager', URIencodingConfig)\n\n // this.serviceName = 'secretsmanager'\n\n // All interactions with the Secrets Manager service\n // are made via the GET or POST method.\n this.method = 'POST'\n\n this.commonHeaders = {\n 'Accept-Encoding': 'identity',\n 'Content-Type': 'application/x-amz-json-1.1',\n }\n }\n\n /**\n * Returns a list of all secrets owned by the authenticated sender of the request.\n * To use this operation, you must have the secretsmanager:ListSecrets permission.\n *\n * @return {Array.} secrets - An array of objects describing Secret Manager's secrets\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n listSecrets(): Array {\n const body = JSON.stringify({})\n\n // Ensure to include the desired 'Action' in the X-Amz-Target\n // header field, as documented by the AWS API docs.\n const signedRequest: AWSRequest = super.buildRequest(\n this.method,\n this.host,\n '/',\n '',\n body,\n {\n ...this.commonHeaders,\n 'X-Amz-Target': `${this.serviceName}.ListSecrets`,\n }\n )\n\n const res = http.request(this.method, signedRequest.url, body, {\n headers: signedRequest.headers,\n })\n this._handle_error('ListSecrets', res)\n const json: JSONArray = res.json('SecretList') as JSONArray\n\n return json.map((s) => Secret.fromJSON(s as JSONObject))\n }\n\n /**\n * Retrieves a secret from Amazon Sercets Manager\n *\n * @param {string} secretID - The ARN or name of the secret to retrieve.\n * @returns {Secret} - returns the content of the fetched Secret object.\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n getSecret(secretID: string): Secret | undefined {\n const body = JSON.stringify({ SecretId: secretID })\n\n // Ensure to include the desired 'Action' in the X-Amz-Target\n // header field, as documented by the AWS API docs.\n const signedRequest: AWSRequest = super.buildRequest(\n this.method,\n this.host,\n '/',\n '',\n body,\n {\n ...this.commonHeaders,\n 'X-Amz-Target': `${this.serviceName}.GetSecretValue`,\n }\n )\n\n const res = http.request(this.method, signedRequest.url, body, {\n headers: signedRequest.headers,\n })\n this._handle_error('GetSecretValue', res)\n\n return Secret.fromJSON(res.json() as JSONObject)\n }\n\n /**\n * Creates a new secret\n *\n * Note that this method only supports string-based values at the moment.\n *\n * @param {string} name - The name of the new secret.\n * The secret name can contain ASCII letters, numbers, and the following characters: /_+=.@\n * @param {string} secretString - The text data to encrypt and store in this new version of the secret.\n * @param {string} description - The description of the secret.\n * @param {string} versionID=null - Version of the secret. This value helps ensure idempotency.\n * As a default, if no versionID is provided, one will be created for you using the UUID v4\n * algorithm.\n * @param {Array.} tags=[] - A list of tags to attach to the secret. Each tag is a key and\n * value pair of strings in a JSON text string. Note that tag key names are case sensitive.\n * @returns {Secret} - returns the created secret\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n createSecret(\n name: string,\n secretString: string,\n description: string,\n versionID?: string,\n tags?: Array\n ): Secret {\n versionID = versionID || uuidv4()\n\n const body = JSON.stringify({\n Name: name,\n Description: description,\n SecretString: secretString,\n ClientRequestToken: versionID,\n Tags: tags,\n })\n\n const signedRequest: AWSRequest = super.buildRequest(\n this.method,\n this.host,\n '/',\n '',\n body,\n {\n ...this.commonHeaders,\n 'X-Amz-Target': `${this.serviceName}.CreateSecret`,\n }\n )\n\n // Ensure to include the desired 'Action' in the X-Amz-Target\n // header field, as documented by the AWS API docs.\n // headers['X-Amz-Target'] = `${this.serviceName}.CreateSecret`\n\n const res = http.request(this.method, signedRequest.url, body, {\n headers: signedRequest.headers,\n })\n this._handle_error('CreateSecret', res)\n\n return Secret.fromJSON(res.json() as JSONObject)\n }\n /**\n * Update a secret's value.\n *\n * Note that this method only support string-based values at the moment.\n *\n * @param {string} secretID - The ARN or name of the secret to update.\n * @param {string} secretString - The text data to encrypt and store in this new version of the secret.\n * @param {} versionID=null - A unique identifier for the new version of the secret. This value helps ensure idempotency.\n * As a default, if no versionID is provided, one will be created for you using the UUID v4\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n putSecretValue(secretID: string, secretString: string, versionID?: string): Secret {\n versionID = versionID || uuidv4()\n\n const body = JSON.stringify({\n SecretId: secretID,\n SecretString: secretString,\n ClientRequestToken: versionID,\n })\n\n // Ensure to include the desired 'Action' in the X-Amz-Target\n // header field, as documented by the AWS API docs.\n const signedRequest: AWSRequest = super.buildRequest(\n this.method,\n this.host,\n '/',\n '',\n body,\n {\n ...this.commonHeaders,\n 'X-Amz-Target': `${this.serviceName}.PutSecretValue`,\n }\n )\n\n const res = http.request(this.method, signedRequest.url, body, {\n headers: signedRequest.headers,\n })\n this._handle_error('PutSecretValue', res)\n\n return Secret.fromJSON(res.json() as JSONObject)\n }\n\n /**\n * Deletes a secret and all of its versions.\n *\n * You can specify a recovery window during which you can restore the secret.\n * The minimum recovery window is 7 days. The default recovery window is 30 days.\n *\n * @param {string} secretID - The ARN or name of the secret to delete.\n * @param {number} recoveryWindow - The number of days from 7 to 30 that Secrets Manager\n * waits before permanently deleting the secret.\n * @throws {SecretsManagerServiceError}\n * @throws {InvalidSignatureError}\n */\n deleteSecret(\n secretID: string,\n { recoveryWindow = 30, noRecovery = false }: { recoveryWindow: number; noRecovery: boolean }\n ) {\n const payload: { [key: string]: string | boolean | number } = {\n SecretId: secretID,\n }\n\n // noRecovery and recoveryWindow are exclusive parameters\n if (noRecovery === true) {\n payload['ForceDeleteWithoutRecovery'] = true\n } else {\n payload['RecoveryWindowInDays'] = recoveryWindow\n }\n\n const body = JSON.stringify(payload)\n\n // Ensure to include the desired 'Action' in the X-Amz-Target\n // header field, as documented by the AWS API docs.\n const signedRequest: AWSRequest = super.buildRequest(\n this.method,\n this.host,\n '/',\n '',\n body,\n {\n ...this.commonHeaders,\n 'X-Amz-Target': `${this.serviceName}.DeleteSecret`,\n }\n )\n\n const res = http.request(this.method, signedRequest.url, body, {\n headers: signedRequest.headers,\n })\n this._handle_error('DeleteSecret', res)\n }\n\n get host() {\n return `${this.serviceName}.${this.awsConfig.region}.amazonaws.com`\n }\n\n // TODO: operation should be an enum\n _handle_error(operation: string, response: RefinedResponse) {\n const errorCode = response.error_code\n if (errorCode === 0) {\n return\n }\n\n const error = response.json() as JSONObject\n if (errorCode >= 1400 && errorCode <= 1499) {\n // In the event of certain errors, the message is not set.\n // Also, note the inconsistency in casing...\n const errorMessage: string =\n (error.Message as string) || (error.message as string) || (error.__type as string)\n\n // Handle specifically the case of an invalid signature\n if (error.__type === 'InvalidSignatureException') {\n throw new InvalidSignatureError(errorMessage, error.__type)\n }\n\n // Otherwise throw a standard service error\n throw new SecretsManagerError(errorMessage, error.__type as string, operation)\n }\n\n if (errorCode === 1500) {\n throw new SecretsManagerError(\n 'An error occured on the server side',\n 'InternalServiceError',\n operation\n )\n }\n }\n}\n\n// TODO: create a Tags type\n\n/**\n * Class representing a Secret Manager's secret\n */\nexport class Secret {\n name: string\n arn: string\n secret: string\n createdDate: number\n lastAccessedDate: number\n lastChangedDate: number\n tags: Array<{ [key: string]: string }>\n\n /**\n * Constructs a Secret Manager's Secret\n *\n * @param {string} name - The friendly name of the secret.\n * @param {string} arn - The ARN of the secret.\n * @param {number} createdDate - The date and time that this version of the secret was created.\n * @param {number} lastAccessedDate - The last date that this secret was accessed. This value is\n * truncated to midnight of the date and therefore shows only the date, not the time.\n * @param {number} lastChangedDate - The last date and time that this secret was modified in any way.\n * @param {Array.} tags - The list of user-defined tags associated with the secret.\n */\n constructor(\n name: string,\n arn: string,\n secretString: string,\n createdDate: number,\n lastAccessedDate: number,\n lastChangedDate: number,\n tags: Array<{ [key: string]: string }> = []\n ) {\n this.name = name\n this.arn = arn\n this.secret = secretString\n this.createdDate = createdDate\n this.lastAccessedDate = lastAccessedDate\n this.lastChangedDate = lastChangedDate\n this.tags = tags\n }\n\n /**\n * Parses and constructs a Secret Manager's Secret from the content\n * of a JSON response returned by the AWS service\n *\n * @param {Object} json - JSON object as returned and parsed from\n * the AWS service's API call.\n * @returns {Secret}\n */\n static fromJSON(json: JSONObject) {\n return new Secret(\n json.Name as string,\n json.ARN as string,\n json.SecretString as string,\n json.CreatedDate as number,\n json.LastAccessedDate as number,\n json.LastChangedDate as number,\n json.Tags as Array<{ [key: string]: string }>\n )\n }\n}\n\nexport class SecretsManagerError extends AWSError {\n operation: string\n\n /**\n * Constructs a SecretsManagerError\n *\n * @param {string} message - human readable error message\n * @param {string} code - A unique short code representing the error that was emitted\n * @param {string} operation - Name of the failed Operation\n */\n constructor(message: string, code: string, operation: string) {\n super(message, code)\n this.name = 'SecretsManagerServiceError'\n this.operation = operation\n }\n}\n"],"names":["v1","v4","uuid","module","exports","byteToHex","i","toString","substr","buf","offset","bth","join","getRandomValues","crypto","bind","window","msCrypto","rnds8","Uint8Array","rnds","Array","r","Math","random","_nodeId","_clockseq","rng","bytesToUuid","_lastMSecs","_lastNSecs","options","b","node","clockseq","undefined","seedBytes","msecs","Date","getTime","nsecs","dt","Error","tl","tmh","n","ii","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","require","AWSError","message","code","name","xmlDocument","doc","parseHTML","find","text","signHeaders","headers","requestTimestamp","method","path","queryString","body","awsConfig","service","URIencodingConfig","derivedSigningKey","secretAccessKey","time","region","kSecret","date","toDate","kDate","hmac","kRegion","kService","deriveSigningKey","canonicalRequest","uri","query","payload","httpRequestMethod","toUpperCase","canonicalURI","length","URIEncode","createCanonicalURI","canonicalQueryString","qs","split","filter","e","map","v","parts","decodeURIComponent","sort","localeCompare","parseQueryString","encodeURIComponent","createCanonicalQueryString","canonicalHeaders","constructor","entries","values","toLowerCase","trim","isArray","replace","createCanonicalHeaders","signedHeaders","createSignedHeaders","requestPayload","UnsignedPayload","createCanonicalPayload","createCanonicalRequest","stringToSign","hashedCanonicalRequest","requestDateTime","toTime","credentialScope","createCredentialScope","HashingAlgorithm","createStringToSign","sha256","signature","calculateSignature","authorizationHeader","accessKeyID","InvalidSignatureError","TypeError","keys","letter","c","isNumeric","includes","charCodeAt","URIEncodingConfig","double","this","timestamp","toISOString","substring","AWSConfig","InvalidAWSConfigError","AWSClient","serviceName","host","now","url","S3Client","signedRequest","res","http","_handle_error","error_code","error","buckets","children","each","_","bucketDefinition","bucket","forEach","child","nodeName","assign","textContent","creationDate","parse","push","bucketName","prefix","objects","objectDefinition","lastModified","etag","size","parseInt","storageClass","objectKey","S3Object","data","error_message","error_body","startsWith","S3ServiceError","awsError","parseXML","S3Bucket","operation","SecretsManagerClient","commonHeaders","JSON","stringify","json","s","Secret","fromJSON","secretID","SecretId","secretString","description","versionID","tags","uuidv4","Name","Description","SecretString","ClientRequestToken","Tags","recoveryWindow","noRecovery","response","errorCode","errorMessage","Message","__type","SecretsManagerError","arn","createdDate","lastAccessedDate","lastChangedDate","secret","ARN","CreatedDate","LastAccessedDate","LastChangedDate"],"sourceRoot":""} \ No newline at end of file diff --git a/examples/secrets-manager.js b/examples/secrets-manager.js index 3e1e32d..f61b13c 100644 --- a/examples/secrets-manager.js +++ b/examples/secrets-manager.js @@ -29,11 +29,11 @@ export default function () { // Now that we know the secret exist, let's update its value const newTestSecretValue = 'new-test-value' - secretsManager.putSecretValue(testSecretName, newTestSecretValue) + const u = secretsManager.putSecretValue(testSecretName, newTestSecretValue) // Let's get its value and verify it was indeed updated const updatedSecret = secretsManager.getSecret(testSecretName) - if (updatedSecret.secretString !== newTestSecretValue) { + if (updatedSecret.secret !== newTestSecretValue) { exec.test.abort('unable to update test secret') } diff --git a/package-lock.json b/package-lock.json index 45009cc..a3c0005 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,14 +10,24 @@ "license": "MIT", "devDependencies": { "@babel/core": "^7.4.4", + "@babel/plugin-proposal-class-properties": "^7.16.7", + "@babel/plugin-proposal-object-rest-spread": "^7.17.3", "@babel/plugin-transform-block-scoping": "^7.14.1", "@babel/preset-env": "^7.4.4", + "@babel/preset-typescript": "^7.16.7", "@types/k6": "^0.37.0", + "@types/uuid": "^3.4.0", + "@types/webpack": "^5.28.0", "babel-loader": "^8.0.6", "chai": "4.3.4", + "clean-webpack-plugin": "^4.0.0", + "copy-webpack-plugin": "^10.2.4", "terser-webpack-plugin": "^5.3.1", + "typescript": "^4.6.3", + "uuid": "^3.4.0", "webpack": "^5.72.0", - "webpack-cli": "^4.9.2" + "webpack-cli": "^4.9.2", + "webpack-glob-entries": "^1.0.1" } }, "node_modules/@ampproject/remapping": { @@ -905,6 +915,21 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-syntax-typescript": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.16.7.tgz", + "integrity": "sha512-YhUIJHHGkqPgEcMYkPCKTyGUdoGKWtopIycQyjJH8OjvRgOYsXsaKehLVPScKJWAULPxMa4N1vCe6szREFlZ7A==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.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", @@ -1380,6 +1405,23 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-transform-typescript": { + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.16.8.tgz", + "integrity": "sha512-bHdQ9k7YpBDO2d0NVfkj51DpQcvwIzIusJ7mEUaMlbZq3Kt/U47j24inXZHQ5MDiYpCs+oZiwnXyKedE8+q7AQ==", + "dev": true, + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-typescript": "^7.16.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", @@ -1515,6 +1557,23 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/preset-typescript": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.16.7.tgz", + "integrity": "sha512-WbVEmgXdIyvzB77AQjGBEyYPZx+8tTsO50XtfozQrkW8QB2rLJpH2lgx0TRw5EJrBxOZQ+wCcyPVQvS8tjEHpQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-validator-option": "^7.16.7", + "@babel/plugin-transform-typescript": "^7.16.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", @@ -1609,6 +1668,41 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@types/eslint": { "version": "8.4.1", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.4.1.tgz", @@ -1635,6 +1729,16 @@ "integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==", "dev": true }, + "node_modules/@types/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==", + "dev": true, + "dependencies": { + "@types/minimatch": "*", + "@types/node": "*" + } + }, "node_modules/@types/json-schema": { "version": "7.0.11", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", @@ -1647,12 +1751,38 @@ "integrity": "sha512-8ou8tK3i/8HJFiyxz9ktrT1CWvtdItlq5ybaysnnwX7wSNLZv3TdR28Q2kW9byYVJKNhuwOnoecB2oM/NytN2Q==", "dev": true }, + "node_modules/@types/minimatch": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", + "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==", + "dev": true + }, "node_modules/@types/node": { "version": "17.0.23", "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz", "integrity": "sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw==", "dev": true }, + "node_modules/@types/uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-Vd+WmnrQKrrfVJ+9LWyOWqlBQJFsfi8rhKRm3ag3ZrOjY5SmzZkGmxbkgRIk9jpZt4dpvE21cmbBSp1dCV7/fw==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/webpack": { + "version": "5.28.0", + "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-5.28.0.tgz", + "integrity": "sha512-8cP0CzcxUiFuA9xGJkfeVpqmWTk9nx6CWwamRGCj95ph1SmlRRk9KlCZ6avhCbZd4L68LvYT6l1kpdEnQXrF8w==", + "dev": true, + "dependencies": { + "@types/node": "*", + "tapable": "^2.2.0", + "webpack": "^5" + } + }, "node_modules/@webassemblyjs/ast": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz", @@ -1884,6 +2014,45 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "dev": true, + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/ajv-formats/node_modules/ajv": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, "node_modules/ajv-keywords": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", @@ -1905,6 +2074,27 @@ "node": ">=4" } }, + "node_modules/array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "dev": true, + "dependencies": { + "array-uniq": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", @@ -1981,6 +2171,12 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, "node_modules/big.js": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", @@ -1990,6 +2186,28 @@ "node": "*" } }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/browserslist": { "version": "4.20.2", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.20.2.tgz", @@ -2103,6 +2321,21 @@ "node": ">=6.0" } }, + "node_modules/clean-webpack-plugin": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/clean-webpack-plugin/-/clean-webpack-plugin-4.0.0.tgz", + "integrity": "sha512-WuWE1nyTNAyW5T7oNyys2EN0cfP2fdRxhxnIQWiAp0bMabPdHhoGxM8A6YL2GhqwgrPnnaemVE7nv5XJ2Fhh2w==", + "dev": true, + "dependencies": { + "del": "^4.1.1" + }, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "webpack": ">=4.0.0 <6.0.0" + } + }, "node_modules/clone-deep": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", @@ -2150,6 +2383,12 @@ "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", "dev": true }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, "node_modules/convert-source-map": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", @@ -2159,6 +2398,115 @@ "safe-buffer": "~5.1.1" } }, + "node_modules/copy-webpack-plugin": { + "version": "10.2.4", + "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-10.2.4.tgz", + "integrity": "sha512-xFVltahqlsRcyyJqQbDY6EYTtyQZF9rf+JPjwHObLdPFMEISqkFkr7mFoVOC6BfYS/dNThyoQKvziugm+OnwBg==", + "dev": true, + "dependencies": { + "fast-glob": "^3.2.7", + "glob-parent": "^6.0.1", + "globby": "^12.0.2", + "normalize-path": "^3.0.0", + "schema-utils": "^4.0.0", + "serialize-javascript": "^6.0.0" + }, + "engines": { + "node": ">= 12.20.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + } + }, + "node_modules/copy-webpack-plugin/node_modules/ajv": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/copy-webpack-plugin/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/copy-webpack-plugin/node_modules/array-union": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-3.0.1.tgz", + "integrity": "sha512-1OvF9IbWwaeiM9VhzYXVQacMibxpXOMYVNIvMtKRyX9SImBXpKcFr8XvFDeEslCyuH/t6KRt7HEO94AlP8Iatw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/copy-webpack-plugin/node_modules/globby": { + "version": "12.2.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-12.2.0.tgz", + "integrity": "sha512-wiSuFQLZ+urS9x2gGPl1H5drc5twabmm4m2gTR27XDFyjUHJUNsS8o/2aKyIF6IoBaR630atdher0XJ5g6OMmA==", + "dev": true, + "dependencies": { + "array-union": "^3.0.1", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.7", + "ignore": "^5.1.9", + "merge2": "^1.4.1", + "slash": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/copy-webpack-plugin/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/copy-webpack-plugin/node_modules/schema-utils": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.0.tgz", + "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.8.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.0.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, "node_modules/core-js-compat": { "version": "3.21.1", "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.21.1.tgz", @@ -2237,6 +2585,36 @@ "node": ">= 0.4" } }, + "node_modules/del": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/del/-/del-4.1.1.tgz", + "integrity": "sha512-QwGuEUouP2kVwQenAsOof5Fv8K9t3D8Ca8NxcXKrIpEHjTXK5J2nXLdP+ALI1cgv8wj7KuwBhTwBkOZSJKM5XQ==", + "dev": true, + "dependencies": { + "@types/glob": "^7.1.1", + "globby": "^6.1.0", + "is-path-cwd": "^2.0.0", + "is-path-in-cwd": "^2.0.0", + "p-map": "^2.0.0", + "pify": "^4.0.1", + "rimraf": "^2.6.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/electron-to-chromium": { "version": "1.4.107", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.107.tgz", @@ -2391,6 +2769,34 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, + "node_modules/fast-glob": { + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", + "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -2403,6 +2809,27 @@ "integrity": "sha512-On2N+BpYJ15xIC974QNVuYGMOlEVt4s0EOI3wwMqOmK1fdDY+FN/zltPV8vosq4ad4c/gJ1KHScUn/6AWIgiow==", "dev": true }, + "node_modules/fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/find-cache-dir": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", @@ -2433,6 +2860,12 @@ "node": ">=8" } }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -2483,20 +2916,77 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/glob-to-regexp": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", - "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", - "dev": true - }, - "node_modules/globals": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", - "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "node_modules/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, "engines": { - "node": ">=4" - } + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", + "dev": true + }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/globby": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", + "dev": true, + "dependencies": { + "array-union": "^1.0.1", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/globby/node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, "node_modules/graceful-fs": { "version": "4.2.10", @@ -2546,6 +3036,15 @@ "node": ">=10.17.0" } }, + "node_modules/ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, "node_modules/import-local": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", @@ -2565,6 +3064,22 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, "node_modules/interpret": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", @@ -2586,6 +3101,69 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-path-cwd": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz", + "integrity": "sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/is-path-in-cwd": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-2.1.0.tgz", + "integrity": "sha512-rNocXHgipO+rvnP6dk3zI20RpOtrAM/kzbB258Uw5BWr3TpXi861yzjo16Dn4hUox07iw5AyeMLHWsujkjzvRQ==", + "dev": true, + "dependencies": { + "is-path-inside": "^2.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/is-path-inside": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-2.1.0.tgz", + "integrity": "sha512-wiyhTzfDWsvwAW53OBWF5zuvaOGlZ6PwYxAbPVDhpm+gM09xKQGjBq/8uYN12aDvMxnAnq3dxTyoSoRNmg5YFg==", + "dev": true, + "dependencies": { + "path-is-inside": "^1.0.2" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", @@ -2776,6 +3354,28 @@ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", "dev": true }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -2806,6 +3406,18 @@ "node": ">=6" } }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -2824,6 +3436,15 @@ "integrity": "sha512-maHFz6OLqYxz+VQyCAtA3PTX4UP/53pa05fyDNc9CwjvJ0yEh6+xBwKsgCxMNhS8taUKBFYxfuiaD9U/55iFaw==", "dev": true }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", @@ -2836,6 +3457,15 @@ "node": ">=8" } }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", @@ -2863,6 +3493,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, "node_modules/onetime": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", @@ -2905,6 +3544,15 @@ "node": ">=8" } }, + "node_modules/p-map": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz", + "integrity": "sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", @@ -2923,6 +3571,21 @@ "node": ">=8" } }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, "node_modules/path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", @@ -2938,6 +3601,15 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/pathval": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", @@ -2953,6 +3625,48 @@ "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", "dev": true }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "dependencies": { + "pinkie": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/pkg-dir": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", @@ -2974,6 +3688,26 @@ "node": ">=6" } }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -3072,6 +3806,15 @@ "jsesc": "bin/jsesc" } }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/resolve": { "version": "1.22.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", @@ -3110,6 +3853,51 @@ "node": ">=8" } }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, "node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -3191,6 +3979,18 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, + "node_modules/slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", @@ -3358,6 +4158,18 @@ "node": ">=4" } }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -3367,6 +4179,19 @@ "node": ">=4" } }, + "node_modules/typescript": { + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", + "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "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", @@ -3416,6 +4241,16 @@ "punycode": "^2.1.0" } }, + "node_modules/uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", + "dev": true, + "bin": { + "uuid": "bin/uuid" + } + }, "node_modules/watchpack": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.3.1.tgz", @@ -3528,6 +4363,31 @@ "node": ">= 10" } }, + "node_modules/webpack-glob-entries": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/webpack-glob-entries/-/webpack-glob-entries-1.0.1.tgz", + "integrity": "sha1-79JexiicDIBcefBx/THxlaxDeJU=", + "dev": true, + "dependencies": { + "glob": "^5.0.15" + } + }, + "node_modules/webpack-glob-entries/node_modules/glob": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "dev": true, + "dependencies": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + } + }, "node_modules/webpack-merge": { "version": "5.8.0", "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.8.0.tgz", @@ -3588,6 +4448,12 @@ "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.0.tgz", "integrity": "sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==", "dev": true + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true } }, "dependencies": { @@ -4214,9 +5080,18 @@ "@babel/helper-plugin-utils": "^7.14.5" } }, - "@babel/plugin-transform-arrow-functions": { + "@babel/plugin-syntax-typescript": { "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.16.7.tgz", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.16.7.tgz", + "integrity": "sha512-YhUIJHHGkqPgEcMYkPCKTyGUdoGKWtopIycQyjJH8OjvRgOYsXsaKehLVPScKJWAULPxMa4N1vCe6szREFlZ7A==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.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", "integrity": "sha512-9ffkFFMbvzTvv+7dTp/66xvZAWASuPD5Tl9LK3Z9vhOmANo6j94rik+5YMBt4CwHVMWLWpMsriIc2zsa3WW3xQ==", "dev": true, "requires": { @@ -4509,6 +5384,17 @@ "@babel/helper-plugin-utils": "^7.16.7" } }, + "@babel/plugin-transform-typescript": { + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.16.8.tgz", + "integrity": "sha512-bHdQ9k7YpBDO2d0NVfkj51DpQcvwIzIusJ7mEUaMlbZq3Kt/U47j24inXZHQ5MDiYpCs+oZiwnXyKedE8+q7AQ==", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-typescript": "^7.16.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", @@ -4623,6 +5509,17 @@ "esutils": "^2.0.2" } }, + "@babel/preset-typescript": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.16.7.tgz", + "integrity": "sha512-WbVEmgXdIyvzB77AQjGBEyYPZx+8tTsO50XtfozQrkW8QB2rLJpH2lgx0TRw5EJrBxOZQ+wCcyPVQvS8tjEHpQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-validator-option": "^7.16.7", + "@babel/plugin-transform-typescript": "^7.16.7" + } + }, "@babel/runtime": { "version": "7.17.9", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.17.9.tgz", @@ -4699,6 +5596,32 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, "@types/eslint": { "version": "8.4.1", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.4.1.tgz", @@ -4725,6 +5648,16 @@ "integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==", "dev": true }, + "@types/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==", + "dev": true, + "requires": { + "@types/minimatch": "*", + "@types/node": "*" + } + }, "@types/json-schema": { "version": "7.0.11", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", @@ -4737,12 +5670,38 @@ "integrity": "sha512-8ou8tK3i/8HJFiyxz9ktrT1CWvtdItlq5ybaysnnwX7wSNLZv3TdR28Q2kW9byYVJKNhuwOnoecB2oM/NytN2Q==", "dev": true }, + "@types/minimatch": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", + "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==", + "dev": true + }, "@types/node": { "version": "17.0.23", "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz", "integrity": "sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw==", "dev": true }, + "@types/uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-Vd+WmnrQKrrfVJ+9LWyOWqlBQJFsfi8rhKRm3ag3ZrOjY5SmzZkGmxbkgRIk9jpZt4dpvE21cmbBSp1dCV7/fw==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/webpack": { + "version": "5.28.0", + "resolved": "https://registry.npmjs.org/@types/webpack/-/webpack-5.28.0.tgz", + "integrity": "sha512-8cP0CzcxUiFuA9xGJkfeVpqmWTk9nx6CWwamRGCj95ph1SmlRRk9KlCZ6avhCbZd4L68LvYT6l1kpdEnQXrF8w==", + "dev": true, + "requires": { + "@types/node": "*", + "tapable": "^2.2.0", + "webpack": "^5" + } + }, "@webassemblyjs/ast": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz", @@ -4949,6 +5908,35 @@ "uri-js": "^4.2.2" } }, + "ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "dev": true, + "requires": { + "ajv": "^8.0.0" + }, + "dependencies": { + "ajv": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + } + } + }, "ajv-keywords": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", @@ -4965,6 +5953,21 @@ "color-convert": "^1.9.0" } }, + "array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "dev": true, + "requires": { + "array-uniq": "^1.0.1" + } + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true + }, "assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", @@ -5022,12 +6025,37 @@ "@babel/helper-define-polyfill-provider": "^0.3.1" } }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, "big.js": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", "dev": true }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, "browserslist": { "version": "4.20.2", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.20.2.tgz", @@ -5100,6 +6128,15 @@ "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==", "dev": true }, + "clean-webpack-plugin": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/clean-webpack-plugin/-/clean-webpack-plugin-4.0.0.tgz", + "integrity": "sha512-WuWE1nyTNAyW5T7oNyys2EN0cfP2fdRxhxnIQWiAp0bMabPdHhoGxM8A6YL2GhqwgrPnnaemVE7nv5XJ2Fhh2w==", + "dev": true, + "requires": { + "del": "^4.1.1" + } + }, "clone-deep": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", @@ -5144,6 +6181,12 @@ "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", "dev": true }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, "convert-source-map": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", @@ -5153,6 +6196,81 @@ "safe-buffer": "~5.1.1" } }, + "copy-webpack-plugin": { + "version": "10.2.4", + "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-10.2.4.tgz", + "integrity": "sha512-xFVltahqlsRcyyJqQbDY6EYTtyQZF9rf+JPjwHObLdPFMEISqkFkr7mFoVOC6BfYS/dNThyoQKvziugm+OnwBg==", + "dev": true, + "requires": { + "fast-glob": "^3.2.7", + "glob-parent": "^6.0.1", + "globby": "^12.0.2", + "normalize-path": "^3.0.0", + "schema-utils": "^4.0.0", + "serialize-javascript": "^6.0.0" + }, + "dependencies": { + "ajv": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.3" + } + }, + "array-union": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-3.0.1.tgz", + "integrity": "sha512-1OvF9IbWwaeiM9VhzYXVQacMibxpXOMYVNIvMtKRyX9SImBXpKcFr8XvFDeEslCyuH/t6KRt7HEO94AlP8Iatw==", + "dev": true + }, + "globby": { + "version": "12.2.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-12.2.0.tgz", + "integrity": "sha512-wiSuFQLZ+urS9x2gGPl1H5drc5twabmm4m2gTR27XDFyjUHJUNsS8o/2aKyIF6IoBaR630atdher0XJ5g6OMmA==", + "dev": true, + "requires": { + "array-union": "^3.0.1", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.7", + "ignore": "^5.1.9", + "merge2": "^1.4.1", + "slash": "^4.0.0" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "schema-utils": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.0.tgz", + "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.8.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.0.0" + } + } + } + }, "core-js-compat": { "version": "3.21.1", "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.21.1.tgz", @@ -5209,6 +6327,30 @@ "object-keys": "^1.0.12" } }, + "del": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/del/-/del-4.1.1.tgz", + "integrity": "sha512-QwGuEUouP2kVwQenAsOof5Fv8K9t3D8Ca8NxcXKrIpEHjTXK5J2nXLdP+ALI1cgv8wj7KuwBhTwBkOZSJKM5XQ==", + "dev": true, + "requires": { + "@types/glob": "^7.1.1", + "globby": "^6.1.0", + "is-path-cwd": "^2.0.0", + "is-path-in-cwd": "^2.0.0", + "p-map": "^2.0.0", + "pify": "^4.0.1", + "rimraf": "^2.6.3" + } + }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, "electron-to-chromium": { "version": "1.4.107", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.107.tgz", @@ -5323,6 +6465,30 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, + "fast-glob": { + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", + "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "dependencies": { + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + } + } + }, "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -5335,6 +6501,24 @@ "integrity": "sha512-On2N+BpYJ15xIC974QNVuYGMOlEVt4s0EOI3wwMqOmK1fdDY+FN/zltPV8vosq4ad4c/gJ1KHScUn/6AWIgiow==", "dev": true }, + "fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, "find-cache-dir": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", @@ -5356,6 +6540,12 @@ "path-exists": "^4.0.0" } }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", @@ -5391,6 +6581,29 @@ "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", "dev": true }, + "glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "requires": { + "is-glob": "^4.0.3" + } + }, "glob-to-regexp": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", @@ -5403,6 +6616,27 @@ "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true }, + "globby": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", + "dev": true, + "requires": { + "array-union": "^1.0.1", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } + }, "graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", @@ -5436,6 +6670,12 @@ "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", "dev": true }, + "ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "dev": true + }, "import-local": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", @@ -5446,6 +6686,22 @@ "resolve-cwd": "^3.0.0" } }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, "interpret": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", @@ -5461,6 +6717,51 @@ "has": "^1.0.3" } }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-path-cwd": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz", + "integrity": "sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==", + "dev": true + }, + "is-path-in-cwd": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-2.1.0.tgz", + "integrity": "sha512-rNocXHgipO+rvnP6dk3zI20RpOtrAM/kzbB258Uw5BWr3TpXi861yzjo16Dn4hUox07iw5AyeMLHWsujkjzvRQ==", + "dev": true, + "requires": { + "is-path-inside": "^2.1.0" + } + }, + "is-path-inside": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-2.1.0.tgz", + "integrity": "sha512-wiyhTzfDWsvwAW53OBWF5zuvaOGlZ6PwYxAbPVDhpm+gM09xKQGjBq/8uYN12aDvMxnAnq3dxTyoSoRNmg5YFg==", + "dev": true, + "requires": { + "path-is-inside": "^1.0.2" + } + }, "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", @@ -5599,6 +6900,22 @@ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", "dev": true }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, + "micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "requires": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + } + }, "mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -5620,6 +6937,15 @@ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -5638,6 +6964,12 @@ "integrity": "sha512-maHFz6OLqYxz+VQyCAtA3PTX4UP/53pa05fyDNc9CwjvJ0yEh6+xBwKsgCxMNhS8taUKBFYxfuiaD9U/55iFaw==", "dev": true }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, "npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", @@ -5647,6 +6979,12 @@ "path-key": "^3.0.0" } }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, "object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", @@ -5665,6 +7003,15 @@ "object-keys": "^1.1.1" } }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, "onetime": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", @@ -5692,6 +7039,12 @@ "p-limit": "^2.2.0" } }, + "p-map": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz", + "integrity": "sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==", + "dev": true + }, "p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", @@ -5704,6 +7057,18 @@ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, "path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", @@ -5716,6 +7081,12 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, "pathval": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", @@ -5728,6 +7099,33 @@ "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", "dev": true }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "^2.0.0" + } + }, "pkg-dir": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", @@ -5743,6 +7141,12 @@ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", "dev": true }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -5828,6 +7232,12 @@ } } }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true + }, "resolve": { "version": "1.22.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", @@ -5854,6 +7264,30 @@ "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", "dev": true }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", @@ -5916,6 +7350,12 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, + "slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true + }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", @@ -6025,12 +7465,27 @@ "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", "dev": true }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, "type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true }, + "typescript": { + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", + "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", + "dev": 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", @@ -6068,6 +7523,12 @@ "punycode": "^2.1.0" } }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "dev": true + }, "watchpack": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.3.1.tgz", @@ -6151,6 +7612,30 @@ } } }, + "webpack-glob-entries": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/webpack-glob-entries/-/webpack-glob-entries-1.0.1.tgz", + "integrity": "sha1-79JexiicDIBcefBx/THxlaxDeJU=", + "dev": true, + "requires": { + "glob": "^5.0.15" + }, + "dependencies": { + "glob": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "dev": true, + "requires": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + } + } + }, "webpack-merge": { "version": "5.8.0", "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.8.0.tgz", @@ -6181,6 +7666,12 @@ "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.0.tgz", "integrity": "sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==", "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true } } } diff --git a/package.json b/package.json index 9767128..8b6c958 100644 --- a/package.json +++ b/package.json @@ -6,14 +6,24 @@ "main": "src/index.js", "devDependencies": { "@babel/core": "^7.4.4", + "@babel/plugin-proposal-class-properties": "^7.16.7", + "@babel/plugin-proposal-object-rest-spread": "^7.17.3", "@babel/plugin-transform-block-scoping": "^7.14.1", "@babel/preset-env": "^7.4.4", + "@babel/preset-typescript": "^7.16.7", "@types/k6": "^0.37.0", + "@types/uuid": "^3.4.0", + "@types/webpack": "^5.28.0", "babel-loader": "^8.0.6", "chai": "4.3.4", + "clean-webpack-plugin": "^4.0.0", + "copy-webpack-plugin": "^10.2.4", "terser-webpack-plugin": "^5.3.1", + "typescript": "^4.6.3", + "uuid": "^3.4.0", "webpack": "^5.72.0", - "webpack-cli": "^4.9.2" + "webpack-cli": "^4.9.2", + "webpack-glob-entries": "^1.0.1" }, "engines": {}, "scripts": { diff --git a/src/index.js b/src/index.ts similarity index 87% rename from src/index.js rename to src/index.ts index e1484eb..8e98c1f 100644 --- a/src/index.js +++ b/src/index.ts @@ -1,8 +1,8 @@ // Import only symbols we wish to re-export publicly -import { signHeaders, InvalidSignatureError, URIEncodingConfig } from './internal/signature.js' -import { AWSConfig, InvalidAWSConfigError } from './internal/config.js' -import { S3Client, S3Bucket, S3Object, S3ServiceError } from './internal/s3.js' -import { SecretsManagerClient, Secret, SecretsManagerError } from './internal/secrets-manager.js' +import { signHeaders, InvalidSignatureError, URIEncodingConfig } from './internal/signature' +import { AWSConfig, InvalidAWSConfigError } from './internal/config' +import { S3Client, S3Bucket, S3Object, S3ServiceError } from './internal/s3' +import { SecretsManagerClient, Secret, SecretsManagerError } from './internal/secrets-manager' // Re-Export public symbols export { diff --git a/src/internal/client.js b/src/internal/client.ts similarity index 67% rename from src/internal/client.js rename to src/internal/client.ts index af04191..4d7399d 100644 --- a/src/internal/client.js +++ b/src/internal/client.ts @@ -1,4 +1,6 @@ -import { signHeaders, toTime } from './signature.js' +import { HTTPMethod, HTTPHeaders } from './http' +import { AWSConfig } from './config' +import { signHeaders, URIEncodingConfig, toTime } from './signature' /** * Class allowing to build requests targeting AWS APIs @@ -8,20 +10,31 @@ import { signHeaders, toTime } from './signature.js' * usage examples. */ export class AWSClient { + awsConfig: AWSConfig + serviceName: string + URIencodingConfig: URIEncodingConfig + /** * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs * @param {string} serviceName - name of the service to target. * @param {URIEncodingConfig} URIencodingConfig - configures how requests URIs should be encoded. */ - constructor(awsConfig, serviceName, URIencodingConfig) { + constructor(awsConfig: AWSConfig, serviceName: string, URIencodingConfig: URIEncodingConfig) { this.awsConfig = awsConfig this.serviceName = serviceName this.URIencodingConfig = URIencodingConfig } - buildRequest(method, host, path, queryString, body, headers) { - const requestTimestamp = Date.now() - const date = toTime(requestTimestamp) + buildRequest( + method: HTTPMethod, + host: string, + path: string, + queryString: string, + body: string | ArrayBuffer, + headers: HTTPHeaders + ): AWSRequest { + const requestTimestamp: number = Date.now() + const date: string = toTime(requestTimestamp) headers['Host'] = host headers['X-Amz-Date'] = date @@ -67,3 +80,11 @@ export class AWSClient { return { url: url, headers: headers } } } + +/** + * Type alias representing the result of an AWSClient.buildRequest call + */ +export interface AWSRequest { + url: string + headers: HTTPHeaders +} diff --git a/src/internal/config.js b/src/internal/config.ts similarity index 86% rename from src/internal/config.js rename to src/internal/config.ts index 7a842a4..24d0edd 100644 --- a/src/internal/config.js +++ b/src/internal/config.ts @@ -1,5 +1,9 @@ /** Class holding an AWS connection information */ export class AWSConfig { + region: string + accessKeyID: string + secretAccessKey: string + /** * Create an AWSConfig. * @@ -8,7 +12,7 @@ export class AWSConfig { * @param {string} secretAccessKey - Your user's AWS secret access key credential * @throws {InvalidArgumentException} */ - constructor(region, accessKeyID, secretAccessKey) { + constructor(region: string, accessKeyID: string, secretAccessKey: string) { if (typeof region !== 'string' || region === '') { throw new InvalidAWSConfigError( 'invalid AWS region; reason: should be a non empty string' @@ -35,7 +39,7 @@ export class AWSConfig { /** Class representing an invalid AWS configuration */ export class InvalidAWSConfigError extends Error { - constructor(...params) { - super(...params) + constructor(message: string) { + super(message) } } diff --git a/src/internal/error.js b/src/internal/error.ts similarity index 88% rename from src/internal/error.js rename to src/internal/error.ts index 6a07773..70c6980 100644 --- a/src/internal/error.js +++ b/src/internal/error.ts @@ -9,13 +9,15 @@ import { parseHTML } from 'k6/html' * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts */ export class AWSError extends Error { + code: string + /** * Create an AWSError * * @param {string} message - A longer human readable error message. * @param {string} code - A unique short code representing the error that was emitted */ - constructor(message, code) { + constructor(message: string, code: string) { super(message) this.name = 'AWSError' this.code = code @@ -26,7 +28,7 @@ export class AWSError extends Error { * * @param {string} xmlDocument - Serialized XML document to parse the error from */ - static parseXML(xmlDocument) { + static parseXML(xmlDocument: string): AWSError { const doc = parseHTML(xmlDocument) return new AWSError(doc.find('Message').text(), doc.find('Code').text()) } diff --git a/src/internal/http.ts b/src/internal/http.ts new file mode 100644 index 0000000..8f94e66 --- /dev/null +++ b/src/internal/http.ts @@ -0,0 +1,10 @@ +/** + * Type representing HTTP Methods + * + */ +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' + +/** + * Type alias representing HTTP Headers + */ +export type HTTPHeaders = { [key: string]: string } diff --git a/src/internal/s3.js b/src/internal/s3.ts similarity index 60% rename from src/internal/s3.js rename to src/internal/s3.ts index 157d168..7ad6ed7 100644 --- a/src/internal/s3.js +++ b/src/internal/s3.ts @@ -1,11 +1,12 @@ +import { bytes } from 'k6' import http from 'k6/http' import { parseHTML } from 'k6/html' import { sha256 } from 'k6/crypto' -import { signHeaders, InvalidSignatureError, URIEncodingConfig, toTime } from './signature.js' -import { AWSClient } from './client.js' -import { AWSError } from './error.js' -import { AWSConfig } from './config.js' +import { InvalidSignatureError, URIEncodingConfig } from './signature' +import { AWSClient, AWSRequest } from './client' +import { AWSError } from './error' +import { AWSConfig } from './config' /** Class allowing to interact with Amazon AWS's S3 service */ export class S3Client extends AWSClient { @@ -14,7 +15,7 @@ export class S3Client extends AWSClient { * * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs */ - constructor(awsConfig) { + constructor(awsConfig: AWSConfig) { const URIencodingConfig = new URIEncodingConfig(false, true) super(awsConfig, 's3', URIencodingConfig) } @@ -28,41 +29,42 @@ export class S3Client extends AWSClient { * @throws {S3ServiceError} * @throws {InvalidSignatureError} */ - listBuckets() { + listBuckets(): Array { // Prepare request const method = 'GET' const host = `${this.serviceName}.${this.awsConfig.region}.amazonaws.com` const body = '' - const { url, headers } = super.buildRequest(method, host, '/', '', body, { + const signedRequest: AWSRequest = super.buildRequest(method, host, '/', '', body, { 'X-Amz-Content-SHA256': sha256(body, 'hex'), }) - const res = http.request(method, url, body, { headers: headers }) - this._handle_error(res.error_code, res.error, res.body) + const res = http.request(method, signedRequest.url, body, { + headers: signedRequest.headers, + }) + this._handle_error(res.error_code, res.error, res.body as string) - let buckets = [] + let buckets: Array = [] - const doc = parseHTML(res.body) + const doc = parseHTML(res.body as string) doc.find('Buckets') .children() .each((_, bucketDefinition) => { - let bucket = new S3Bucket() + let bucket = {} bucketDefinition.children().forEach((child) => { switch (child.nodeName()) { case 'name': Object.assign(bucket, { name: child.textContent() }) + break case 'creationdate': - const parsed = Date.parse( - child.textContent(), - 'YYYY-MM-ddTHH:mm:ss.sssZ' - ) - Object.assign(bucket, { creationDate: parsed }) + Object.assign(bucket, { + creationDate: Date.parse(child.textContent()), + }) } }) - buckets.push(bucket) + buckets.push(bucket as S3Bucket) }) return buckets @@ -72,53 +74,66 @@ export class S3Client extends AWSClient { * Returns some or all (up to 1,000) of the objects in a bucket. * * @param {string} bucketName - Bucket name to list. - * @param {string} prefix='' - Limits the response to keys that begin with the specified prefix. + * @param {string?} prefix='' - Limits the response to keys that begin with the specified prefix. * @return {Array.} - returns an array of objects describing S3 objects * with the following fields: key, lastModified, etag, size and storageClass. * @throws {S3ServiceError} * @throws {InvalidSignatureError} */ - listObjects(bucketName, prefix = '') { + listObjects(bucketName: string, prefix?: string): Array { // Prepare request const method = 'GET' const host = `${bucketName}.${this.serviceName}.${this.awsConfig.region}.amazonaws.com` const body = '' - const { url, headers } = super.buildRequest(method, host, '/', 'list-type=2', body, { - 'X-Amz-Content-SHA256': sha256(body, 'hex'), - }) + const signedRequest: AWSRequest = super.buildRequest( + method, + host, + '/', + 'list-type=2', + body, + { + 'X-Amz-Content-SHA256': sha256(body, 'hex'), + } + ) - const res = http.request(method, url, body, { headers: headers }) - this._handle_error(res.error_code, res.error, res.body) + const res = http.request(method, signedRequest.url, body, { + headers: signedRequest.headers, + }) + this._handle_error(res.error_code, res.error, res.body as string) - let objects = [] + let objects: Array = [] // Extract the objects definition from // the XML response - parseHTML(res.body) + parseHTML(res.body as string) .find('Contents') .each((_, objectDefinition) => { - let obj = new S3Object() + let obj = {} objectDefinition.children().forEach((child) => { switch (child.nodeName()) { case 'key': Object.assign(obj, { key: child.textContent() }) + break case 'lastmodified': - const parsed = Date.parse( - child.textContent(), - 'YYYY-MM-ddTHH:mm:ss.sssZ' - ) - Object.assign(obj, { lastModified: parsed }) + // const parsed = Date.parse( + // child.textContent(), + // 'YYYY-MM-ddTHH:mm:ss.sssZ' + // ) + Object.assign(obj, { lastModified: Date.parse(child.textContent()) }) + break case 'etag': Object.assign(obj, { etag: child.textContent() }) + break case 'size': Object.assign(obj, { size: parseInt(child.textContent()) }) + break case 'storageclass': Object.assign(obj, { storageClass: child.textContent() }) } }) - objects.push(obj) + objects.push(obj as S3Object) }) return objects @@ -134,25 +149,27 @@ export class S3Client extends AWSClient { * @throws {S3ServiceError} * @throws {InvalidSignatureError} */ - getObject(bucketName, objectKey) { + getObject(bucketName: string, objectKey: string): S3Object { // Prepare request const method = 'GET' const host = `${bucketName}.${this.serviceName}.${this.awsConfig.region}.amazonaws.com` const path = `/${objectKey}` const body = '' - const { url, headers } = super.buildRequest(method, host, path, '', body, { + const signedRequest: AWSRequest = super.buildRequest(method, host, path, '', body, { 'X-Amz-Content-SHA256': sha256(body, 'hex'), }) - const res = http.request(method, url, body, { headers: headers }) - this._handle_error(res.error_code, res.error, res.body) + const res = http.request(method, signedRequest.url, body, { + headers: signedRequest.headers, + }) + this._handle_error(res.error_code, res.error, res.body as string) return new S3Object( objectKey, - res.headers['Last-Modified'], + Date.parse(res.headers['Last-Modified']), res.headers['ETag'], - res.headers['Content-Length'], - '', // GetObject response doesn't contain the storage class + parseInt(res.headers['Content-Length']), + undefined, // GetObject response doesn't contain the storage class res.body ) } @@ -167,19 +184,28 @@ export class S3Client extends AWSClient { * @throws {S3ServiceError} * @throws {InvalidSignatureError} */ - putObject(bucketName, objectKey, data) { + putObject(bucketName: string, objectKey: string, data: string | ArrayBuffer) { // Prepare request const method = 'PUT' const host = `${bucketName}.${this.serviceName}.${this.awsConfig.region}.amazonaws.com` const path = `/${objectKey}` const queryString = '' const body = data - const { url, headers } = super.buildRequest(method, host, path, queryString, body, { - 'X-Amz-Content-SHA256': sha256(body, 'hex'), - }) + const signedRequest: AWSRequest = super.buildRequest( + method, + host, + path, + queryString, + body, + { + 'X-Amz-Content-SHA256': sha256(body, 'hex'), + } + ) - const res = http.request(method, url, body, { headers: headers }) - this._handle_error(res.error_code, res.error, res.body) + const res = http.request(method, signedRequest.url, body, { + headers: signedRequest.headers, + }) + this._handle_error(res.error_code, res.error, res.body as string) } /** @@ -191,24 +217,33 @@ export class S3Client extends AWSClient { * @throws {S3ServiceError} * @throws {InvalidSignatureError} */ - deleteObject(bucketName, objectKey) { + deleteObject(bucketName: string, objectKey: string): void { // Prepare request const method = 'DELETE' const host = `${bucketName}.${this.serviceName}.${this.awsConfig.region}.amazonaws.com` const path = `/${objectKey}` const queryString = '' const body = '' - const { url, headers } = super.buildRequest(method, host, path, queryString, body, { - 'X-Amz-Content-SHA256': sha256(body, 'hex'), - }) + const signedRequest: AWSRequest = super.buildRequest( + method, + host, + path, + queryString, + body, + { + 'X-Amz-Content-SHA256': sha256(body, 'hex'), + } + ) - const res = http.request(method, url, body, { headers: headers }) - this._handle_error(res.error_code, res.error, res.body) + const res = http.request(method, signedRequest.url, body, { + headers: signedRequest.headers, + }) + this._handle_error(res.error_code, res.error, res.body as string) } // FIXME: remove dependency to `error_message` // FIXME: just pass it the response? - _handle_error(error_code, error_message, error_body) { + _handle_error(error_code: number, error_message: string, error_body: string) { if (error_message == '' || error_code === 0) { return } @@ -231,22 +266,34 @@ export class S3Client extends AWSClient { } } +// TODO: use interface instead? /** Class representing a S3 Bucket */ export class S3Bucket { + name: string + creationDate: Date + /** * Create an S3 Bucket * * @param {string} name - S3 bucket's name * @param {Date} creationDate - S3 bucket's creation date */ - constructor(name, creationDate) { + constructor(name: string, creationDate: Date) { this.name = name this.creationDate = creationDate } } +// TODO: use interface instead? /** Class representing an S3 Object */ export class S3Object { + key: string + lastModified: number + etag: string + size: number + storageClass: StorageClass + data?: string | bytes | null + /** * Create an S3 Object * @@ -254,15 +301,22 @@ export class S3Object { * @param {Date} lastModified - S3 object last modification date * @param {string} etag - S3 object's etag * @param {number} size - S3 object's size - * @param {string} storageClass - S3 object's storage class - * @param {string} data=null - S3 Object's data + * @param {StorageClass} storageClass - S3 object's storage class + * @param {string | bytes | null} data=null - S3 Object's data */ - constructor(key, lastModified, etag, size, storageClass, data = null) { + constructor( + key: string, + lastModified: number, + etag: string, + size: number, + storageClass: StorageClass, + data?: string | bytes | null + ) { this.key = key this.lastModified = lastModified this.etag = etag this.size = size - this.storageClass = storageClass || '' + this.storageClass = storageClass this.data = data } } @@ -276,6 +330,8 @@ export class S3Object { * * https://github.com/aws/aws-sdk-js/blob/master/lib/error.d.ts */ export class S3ServiceError extends AWSError { + operation: string + /** * Constructs a S3ServiceError * @@ -283,9 +339,23 @@ export class S3ServiceError extends AWSError { * @param {string} code - A unique short code representing the error that was emitted * @param {string} operation - Name of the failed Operation */ - constructor(message, code, operation) { + constructor(message: string, code: string, operation: string) { super(message, code) this.name = 'S3ServiceError' this.operation = operation } } + +/** + * Describes the class of storage used to store a S3 object. + */ +type StorageClass = + | 'STANDARD' + | 'REDUCED_REDUNDANCY' + | 'GLACIER' + | 'STANDARD_IA' + | 'INTELLIGENT_TIERING' + | 'DEEP_ARCHIVE' + | 'OUTPOSTS' + | 'GLACIER_IR' + | undefined diff --git a/src/internal/secrets-manager.js b/src/internal/secrets-manager.ts similarity index 64% rename from src/internal/secrets-manager.js rename to src/internal/secrets-manager.ts index 4f6a868..b7dbe45 100644 --- a/src/internal/secrets-manager.js +++ b/src/internal/secrets-manager.ts @@ -1,18 +1,25 @@ -import http, { head } from 'k6/http' -import { AWSClient } from './client.js' -import { AWSError } from './error.js' -import { InvalidSignatureError, URIEncodingConfig } from './signature.js' -import { v4 as uuidv4 } from './uuid.js' +import { JSONArray, JSONObject } from 'k6' +import http, { RefinedResponse, ResponseType } from 'k6/http' + +import { AWSClient, AWSRequest } from './client' +import { AWSError } from './error' +import { AWSConfig } from './config' +import { InvalidSignatureError, URIEncodingConfig } from './signature' +import { v4 as uuidv4 } from 'uuid' +import { HTTPMethod, HTTPHeaders } from './http' /** * Class allowing to interact with Amazon AWS's SecretsManager service */ export class SecretsManagerClient extends AWSClient { + method: HTTPMethod + commonHeaders: HTTPHeaders + /** * Create a SecretsManagerClient * @param {AWSConfig} awsConfig - configuration attributes to use when interacting with AWS' APIs */ - constructor(awsConfig) { + constructor(awsConfig: AWSConfig) { const URIencodingConfig = new URIEncodingConfig(true, false) super(awsConfig, 'secretsmanager', URIencodingConfig) @@ -36,20 +43,30 @@ export class SecretsManagerClient extends AWSClient { * @throws {SecretsManagerServiceError} * @throws {InvalidSignatureError} */ - listSecrets() { + listSecrets(): Array { const body = JSON.stringify({}) // Ensure to include the desired 'Action' in the X-Amz-Target // header field, as documented by the AWS API docs. - const { url, headers } = super.buildRequest(this.method, this.host, '/', '', body, { - ...this.commonHeaders, - 'X-Amz-Target': `${this.serviceName}.ListSecrets`, - }) + const signedRequest: AWSRequest = super.buildRequest( + this.method, + this.host, + '/', + '', + body, + { + ...this.commonHeaders, + 'X-Amz-Target': `${this.serviceName}.ListSecrets`, + } + ) - const res = http.request(this.method, url, body, { headers: headers }) + const res = http.request(this.method, signedRequest.url, body, { + headers: signedRequest.headers, + }) this._handle_error('ListSecrets', res) + const json: JSONArray = res.json('SecretList') as JSONArray - return res.json('SecretList').map((s) => Secret.fromJSON(s)) + return json.map((s) => Secret.fromJSON(s as JSONObject)) } /** @@ -60,20 +77,29 @@ export class SecretsManagerClient extends AWSClient { * @throws {SecretsManagerServiceError} * @throws {InvalidSignatureError} */ - getSecret(secretID) { + getSecret(secretID: string): Secret | undefined { const body = JSON.stringify({ SecretId: secretID }) // Ensure to include the desired 'Action' in the X-Amz-Target // header field, as documented by the AWS API docs. - const { url, headers } = super.buildRequest(this.method, this.host, '/', '', body, { - ...this.commonHeaders, - 'X-Amz-Target': `${this.serviceName}.GetSecretValue`, - }) + const signedRequest: AWSRequest = super.buildRequest( + this.method, + this.host, + '/', + '', + body, + { + ...this.commonHeaders, + 'X-Amz-Target': `${this.serviceName}.GetSecretValue`, + } + ) - const res = http.request(this.method, url, body, { headers: headers }) + const res = http.request(this.method, signedRequest.url, body, { + headers: signedRequest.headers, + }) this._handle_error('GetSecretValue', res) - return Secret.fromJSON(res.json()) + return Secret.fromJSON(res.json() as JSONObject) } /** @@ -94,7 +120,13 @@ export class SecretsManagerClient extends AWSClient { * @throws {SecretsManagerServiceError} * @throws {InvalidSignatureError} */ - createSecret(name, secretString, description, versionID = null, tags = []) { + createSecret( + name: string, + secretString: string, + description: string, + versionID?: string, + tags?: Array + ): Secret { versionID = versionID || uuidv4() const body = JSON.stringify({ @@ -105,19 +137,28 @@ export class SecretsManagerClient extends AWSClient { Tags: tags, }) - const { url, headers } = super.buildRequest(this.method, this.host, '/', '', body, { - ...this.commonHeaders, - 'X-Amz-Target': `${this.serviceName}.CreateSecret`, - }) + const signedRequest: AWSRequest = super.buildRequest( + this.method, + this.host, + '/', + '', + body, + { + ...this.commonHeaders, + 'X-Amz-Target': `${this.serviceName}.CreateSecret`, + } + ) // Ensure to include the desired 'Action' in the X-Amz-Target // header field, as documented by the AWS API docs. // headers['X-Amz-Target'] = `${this.serviceName}.CreateSecret` - const res = http.request(this.method, url, body, { headers: headers }) + const res = http.request(this.method, signedRequest.url, body, { + headers: signedRequest.headers, + }) this._handle_error('CreateSecret', res) - return Secret.fromJSON(res.json()) + return Secret.fromJSON(res.json() as JSONObject) } /** * Update a secret's value. @@ -131,7 +172,7 @@ export class SecretsManagerClient extends AWSClient { * @throws {SecretsManagerServiceError} * @throws {InvalidSignatureError} */ - putSecretValue(secretID, secretString, versionID = null) { + putSecretValue(secretID: string, secretString: string, versionID?: string): Secret { versionID = versionID || uuidv4() const body = JSON.stringify({ @@ -142,15 +183,24 @@ export class SecretsManagerClient extends AWSClient { // Ensure to include the desired 'Action' in the X-Amz-Target // header field, as documented by the AWS API docs. - const { url, headers } = super.buildRequest(this.method, this.host, '/', '', body, { - ...this.commonHeaders, - 'X-Amz-Target': `${this.serviceName}.PutSecretValue`, - }) + const signedRequest: AWSRequest = super.buildRequest( + this.method, + this.host, + '/', + '', + body, + { + ...this.commonHeaders, + 'X-Amz-Target': `${this.serviceName}.PutSecretValue`, + } + ) - const res = http.request(this.method, url, body, { headers: headers }) + const res = http.request(this.method, signedRequest.url, body, { + headers: signedRequest.headers, + }) this._handle_error('PutSecretValue', res) - return Secret.fromJSON(res.json()) + return Secret.fromJSON(res.json() as JSONObject) } /** @@ -165,8 +215,11 @@ export class SecretsManagerClient extends AWSClient { * @throws {SecretsManagerServiceError} * @throws {InvalidSignatureError} */ - deleteSecret(secretID, { recoveryWindow = 30, noRecovery = false }) { - const payload = { + deleteSecret( + secretID: string, + { recoveryWindow = 30, noRecovery = false }: { recoveryWindow: number; noRecovery: boolean } + ) { + const payload: { [key: string]: string | boolean | number } = { SecretId: secretID, } @@ -181,12 +234,21 @@ export class SecretsManagerClient extends AWSClient { // Ensure to include the desired 'Action' in the X-Amz-Target // header field, as documented by the AWS API docs. - const { url, headers } = super.buildRequest(this.method, this.host, '/', '', body, { - ...this.commonHeaders, - 'X-Amz-Target': `${this.serviceName}.DeleteSecret`, - }) + const signedRequest: AWSRequest = super.buildRequest( + this.method, + this.host, + '/', + '', + body, + { + ...this.commonHeaders, + 'X-Amz-Target': `${this.serviceName}.DeleteSecret`, + } + ) - const res = http.request(this.method, url, body, { headers: headers }) + const res = http.request(this.method, signedRequest.url, body, { + headers: signedRequest.headers, + }) this._handle_error('DeleteSecret', res) } @@ -194,17 +256,19 @@ export class SecretsManagerClient extends AWSClient { return `${this.serviceName}.${this.awsConfig.region}.amazonaws.com` } - _handle_error(operation, response) { + // TODO: operation should be an enum + _handle_error(operation: string, response: RefinedResponse) { const errorCode = response.error_code if (errorCode === 0) { return } - const error = response.json() + const error = response.json() as JSONObject if (errorCode >= 1400 && errorCode <= 1499) { // In the event of certain errors, the message is not set. // Also, note the inconsistency in casing... - const errorMessage = error.Message || error.message || error.__type + const errorMessage: string = + (error.Message as string) || (error.message as string) || (error.__type as string) // Handle specifically the case of an invalid signature if (error.__type === 'InvalidSignatureException') { @@ -212,7 +276,7 @@ export class SecretsManagerClient extends AWSClient { } // Otherwise throw a standard service error - throw new SecretsManagerError(errorMessage, error.__type, operation) + throw new SecretsManagerError(errorMessage, error.__type as string, operation) } if (errorCode === 1500) { @@ -225,10 +289,20 @@ export class SecretsManagerClient extends AWSClient { } } +// TODO: create a Tags type + /** * Class representing a Secret Manager's secret */ export class Secret { + name: string + arn: string + secret: string + createdDate: number + lastAccessedDate: number + lastChangedDate: number + tags: Array<{ [key: string]: string }> + /** * Constructs a Secret Manager's Secret * @@ -241,17 +315,17 @@ export class Secret { * @param {Array.} tags - The list of user-defined tags associated with the secret. */ constructor( - name, - arn, - secretString, - createdDate, - lastAccessedDate, - lastChangedDate, - tags = [] + name: string, + arn: string, + secretString: string, + createdDate: number, + lastAccessedDate: number, + lastChangedDate: number, + tags: Array<{ [key: string]: string }> = [] ) { this.name = name this.arn = arn - this.secretString = secretString + this.secret = secretString this.createdDate = createdDate this.lastAccessedDate = lastAccessedDate this.lastChangedDate = lastChangedDate @@ -266,21 +340,22 @@ export class Secret { * the AWS service's API call. * @returns {Secret} */ - static fromJSON(json) { + static fromJSON(json: JSONObject) { return new Secret( - json.Name, - json.ARN, - json.SecretString, - json.CreatedDate, - json.LastAccessedDate, - json.LastChangeddAt, - json.Tags + json.Name as string, + json.ARN as string, + json.SecretString as string, + json.CreatedDate as number, + json.LastAccessedDate as number, + json.LastChangedDate as number, + json.Tags as Array<{ [key: string]: string }> ) } } -// TODO: derive a AWSServiceError to extend instead? (to save kb of code?) export class SecretsManagerError extends AWSError { + operation: string + /** * Constructs a SecretsManagerError * @@ -288,7 +363,7 @@ export class SecretsManagerError extends AWSError { * @param {string} code - A unique short code representing the error that was emitted * @param {string} operation - Name of the failed Operation */ - constructor(message, code, operation) { + constructor(message: string, code: string, operation: string) { super(message, code) this.name = 'SecretsManagerServiceError' this.operation = operation diff --git a/src/internal/signature.js b/src/internal/signature.ts similarity index 81% rename from src/internal/signature.js rename to src/internal/signature.ts index 796d3be..65827e2 100644 --- a/src/internal/signature.js +++ b/src/internal/signature.ts @@ -1,6 +1,5 @@ -'use strict' - import crypto, { hmac, sha256 } from 'k6/crypto' +import { HTTPMethod, HTTPHeaders } from './http' import { AWSConfig } from './config' import { AWSError } from './error' @@ -27,16 +26,16 @@ import { AWSError } from './error' * @param {URIEncodingConfig} - URI encoding configuration */ export function signHeaders( - headers, - requestTimestamp, - method, - path, - queryString, - body, - awsConfig, - service, - URIencodingConfig -) { + headers: HTTPHeaders, + requestTimestamp: number, + method: HTTPMethod, + path: string, + queryString: string, + body: string | ArrayBuffer, + awsConfig: AWSConfig, + service: string, + URIencodingConfig: URIEncodingConfig +): HTTPHeaders { const derivedSigningKey = deriveSigningKey( awsConfig.secretAccessKey, requestTimestamp, @@ -84,7 +83,7 @@ export class InvalidSignatureError extends AWSError { * * @param {string} message - human readable error message */ - constructor(message, code) { + constructor(message: string, code: string) { super(message, code) this.name = 'InvalidSignatureError' } @@ -97,7 +96,7 @@ export class InvalidSignatureError extends AWSError { * @param {string} stringToSign - String to sign as computed by `createStringToSign` * @return {string} */ -export function calculateSignature(derivedSigningKey, stringToSign) { +export function calculateSignature(derivedSigningKey: ArrayBuffer, stringToSign: string): string { return hmac('sha256', derivedSigningKey, stringToSign, 'hex') } /** @@ -117,14 +116,21 @@ export function calculateSignature(derivedSigningKey, stringToSign) { * @param {string} service - targeted AWS service. MUST be UTF-8 encoded. * @return {string} */ -export function deriveSigningKey(secretAccessKey, time, region, service) { +export function deriveSigningKey( + secretAccessKey: string, + time: number, + region: string, + service: string +): ArrayBuffer { const kSecret = secretAccessKey const date = toDate(time) - const kDate = hmac('sha256', 'AWS4' + kSecret, date, 'binary') - const kRegion = hmac('sha256', kDate, region, 'binary') - const kService = hmac('sha256', kRegion, service, 'binary') - const kSigning = hmac('sha256', kService, 'aws4_request', 'binary') + // FIXME: hmac takes ArrayBuffer as input, but returns bytes (number[]). + // How does one convert from one to the other? + const kDate: any = hmac('sha256', 'AWS4' + kSecret, date, 'binary') + const kRegion: any = hmac('sha256', kDate, region, 'binary') + const kService: any = hmac('sha256', kRegion, service, 'binary') + const kSigning: any = hmac('sha256', kService, 'aws4_request', 'binary') return kSigning } @@ -153,7 +159,12 @@ export const UnsignedPayload = 'UNSIGNED-PAYLOAD' * hashed using the SHA256 algorithm (encoded in hexadecimal format). * @return {string} */ -export function createStringToSign(requestTimestamp, region, service, hashedCanonicalRequest) { +export function createStringToSign( + requestTimestamp: number, + region: string, + service: string, + hashedCanonicalRequest: string +): string { // the request date specified in ISO8601 format: YYYYMMDD'T'HHMMSS'Z' const requestDateTime = toTime(requestTimestamp) @@ -193,7 +204,11 @@ export function createStringToSign(requestTimestamp, region, service, hashedCano * @param {string} service - targeted AWS service name. MUST be UTF-8 encoded. * @return {string} */ -export function createCredentialScope(requestTimestamp, region, service) { +export function createCredentialScope( + requestTimestamp: number, + region: string, + service: string +): string { return [toDate(requestTimestamp), region, service, 'aws4_request'].join('/') } @@ -205,11 +220,18 @@ export function createCredentialScope(requestTimestamp, region, service) { * @param {string} uri - URI-encoded version of the absolute path component of the URI * @param {string} query - request's query string * @param {Object} headers - all the HTTP headers that you wish to include with the signed request - * @param {String | ArrayBuffer} payload - payload to include as the body of the request - * @param {URIEncodingConfig} - URI encoding configuration + * @param {string | ArrayBuffer} payload - payload to include as the body of the request + * @param {URIEncodingConfig} URIencodingConfig- URI encoding configuration * @return {string} */ -export function createCanonicalRequest(method, uri, query, headers, payload, URIencodingConfig) { +export function createCanonicalRequest( + method: HTTPMethod, + uri: string, + query: string, + headers: HTTPHeaders, + payload: string | ArrayBuffer, + URIencodingConfig: URIEncodingConfig +): string { const httpRequestMethod = method.toUpperCase() const canonicalURI = createCanonicalURI(uri, URIencodingConfig) const canonicalQueryString = createCanonicalQueryString(query) @@ -239,7 +261,7 @@ export function createCanonicalRequest(method, uri, query, headers, payload, URI * @param {URIEncodingConfig} - URI encoding configuration * @return {string} - canonical URL */ -export function createCanonicalURI(uri, URIencodingConfig) { +export function createCanonicalURI(uri: string, URIencodingConfig: URIEncodingConfig): string { if (uri == '/') { return uri } @@ -254,6 +276,7 @@ export function createCanonicalURI(uri, URIencodingConfig) { return URIencodingConfig.double ? URIEncode(canonicalURI, URIencodingConfig.path) : canonicalURI } +// FIXME: does it work as expected? /** * Creates the canonical form of the request's query * string. If the request does not include a query string, @@ -262,23 +285,31 @@ export function createCanonicalURI(uri, URIencodingConfig) { * @param {String | Object} qs - query string to canonize * @return {string} */ -export function createCanonicalQueryString(qs) { - if (!qs) { +export function createCanonicalQueryString(qs: string): string { + if (qs === '') { return '' } - if (typeof qs == 'string') { - qs = parseQueryString(qs) - } - - return Object.keys(qs) - .sort() - .map((key) => { - const values = Array.isArray(qs[key]) ? qs[key] : [qs[key]] - return values - .sort() - .map((val) => encodeURIComponent(key) + '=' + encodeURIComponent(val)) - .join('&') + // const intermediary: { [key: string]: string } = parseQueryString(qs) + + // return Object.keys(intermediary) + // .sort() + // .map((key: string) => { + // // const values: string[] = Array.isArray(intermediary[key]) + // // ? intermediary[key] + // // : [intermediary[key]] + // const values = intermediary[key] + + // return values + // .sort() + // .map((val: string) => encodeURIComponent(key) + '=' + encodeURIComponent(val)) + // .join('&') + // }) + // .join('&') + + return parseQueryString(qs) + .map(([key, value]: [string, string]): string => { + return encodeURIComponent(key) + '=' + encodeURIComponent(value) }) .join('&') } @@ -296,7 +327,7 @@ export function createCanonicalQueryString(qs) { * @param {Object} headers * @return {string} */ -export function createCanonicalHeaders(headers) { +export function createCanonicalHeaders(headers: HTTPHeaders) { if (headers.constructor !== Object || Object.entries(headers).length === 0) { return '' } @@ -338,7 +369,7 @@ export function createCanonicalHeaders(headers) { * @return {string} * @throws {TypeError} - on headers not being an Object, or being empty. */ -export function createSignedHeaders(headers) { +export function createSignedHeaders(headers: { [key: string]: string }) { if (headers.constructor !== Object) { throw new TypeError('headers should be an object') } @@ -372,7 +403,7 @@ export function createSignedHeaders(headers) { * @param {String | ArrayBuffer} payload * @return {string} */ -export function createCanonicalPayload(payload) { +export function createCanonicalPayload(payload: string | ArrayBuffer) { if (payload === UnsignedPayload) { return payload } @@ -407,14 +438,14 @@ export function createCanonicalPayload(payload) { * but in paths, set to false when encoding a path * @return {string} the URI encoded result */ -export function URIEncode(uri, path) { +export function URIEncode(uri: string, path: boolean): string { if (uri == '') { return uri } return uri .split('') // to be able to map over a string, because... javascript... - .map((letter) => { + .map((letter: string) => { if (isAlpha(letter) || isNumeric(letter) || '-._~'.includes(letter)) { return letter } @@ -439,13 +470,16 @@ export function URIEncode(uri, path) { * Class holding URI encoding configuration */ export class URIEncodingConfig { + double: boolean + path: boolean + /** * * @param {boolean} double - should the URI be double encoded? * @param {boolean} path - is the URI a path? If so, its forward * slashes won't be URIencoded. */ - constructor(double, path) { + constructor(double: boolean, path: boolean) { this.double = double this.path = path } @@ -458,7 +492,7 @@ export class URIEncodingConfig { * @param {number} timestamp * @return {string} */ -export function toTime(timestamp) { +export function toTime(timestamp: number): string { return new Date(timestamp).toISOString().replace(/[:\-]|\.\d{3}/g, '') } /** @@ -467,9 +501,11 @@ export function toTime(timestamp) { * @param {number} timestamp * @return {string} */ -export function toDate(timestamp) { +export function toDate(timestamp: number): string { return toTime(timestamp).substring(0, 8) } + +// FIXME: does it work as expected? /** * Parse a HTTP request URL's querystring into an object * containing its `key=value` pairs. @@ -477,32 +513,28 @@ export function toDate(timestamp) { * @param {string} qs * @return {object} */ -export function parseQueryString(qs) { - if (typeof qs !== 'string' || qs.length === 0) { - return {} +export function parseQueryString(qs: string): Array<[string, string]> { + if (qs.length === 0) { + return [] } - var result = {} - var split = qs.split('&').filter((e) => e) // filter drops empty elements - - for (let i = 0; i < split.length; i++) { - let parts = split[i].split('=') - - if (parts.length === 2) { - result[decodeURIComponent(parts[0])] = decodeURIComponent(parts[1]) - } else { - result[decodeURIComponent(split[i])] = '' - } - } - - return result + return qs + .split('&') + .filter((e) => e) + .map((v: string): [string, string] => { + const parts = v.split('=', 2) as [string, string] + return [decodeURIComponent(parts[0]), decodeURIComponent(parts[1])] + }) + .sort((a: [string, string], b: [string, string]) => { + return a[0].localeCompare(b[0]) + }) } -function isAlpha(c) { +function isAlpha(c: string): boolean { return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') } -function isNumeric(c) { +function isNumeric(c: string): boolean { return c >= '0' && c <= '9' } diff --git a/src/internal/uuid.js b/src/internal/uuid.js deleted file mode 100644 index 95883e5..0000000 --- a/src/internal/uuid.js +++ /dev/null @@ -1,218 +0,0 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.uuid = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i>> ((i & 0x03) << 3) & 0xff; - } - - return rnds; - }; -} - -},{}],4:[function(require,module,exports){ -var rng = require('./lib/rng'); -var bytesToUuid = require('./lib/bytesToUuid'); - -// **`v1()` - Generate time-based UUID** -// -// Inspired by https://github.com/LiosK/UUID.js -// and http://docs.python.org/library/uuid.html - -var _nodeId; -var _clockseq; - -// Previous uuid creation time -var _lastMSecs = 0; -var _lastNSecs = 0; - -// See https://github.com/uuidjs/uuid for API details -function v1(options, buf, offset) { - var i = buf && offset || 0; - var b = buf || []; - - options = options || {}; - var node = options.node || _nodeId; - var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; - - // node and clockseq need to be initialized to random values if they're not - // specified. We do this lazily to minimize issues related to insufficient - // system entropy. See #189 - if (node == null || clockseq == null) { - var seedBytes = rng(); - if (node == null) { - // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) - node = _nodeId = [ - seedBytes[0] | 0x01, - seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5] - ]; - } - if (clockseq == null) { - // Per 4.2.2, randomize (14 bit) clockseq - clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; - } - } - - // UUID timestamps are 100 nano-second units since the Gregorian epoch, - // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so - // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' - // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. - var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime(); - - // Per 4.2.1.2, use count of uuid's generated during the current clock - // cycle to simulate higher resolution clock - var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; - - // Time since last uuid creation (in msecs) - var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000; - - // Per 4.2.1.2, Bump clockseq on clock regression - if (dt < 0 && options.clockseq === undefined) { - clockseq = clockseq + 1 & 0x3fff; - } - - // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new - // time interval - if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { - nsecs = 0; - } - - // Per 4.2.1.2 Throw error if too many uuids are requested - if (nsecs >= 10000) { - throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec'); - } - - _lastMSecs = msecs; - _lastNSecs = nsecs; - _clockseq = clockseq; - - // Per 4.1.4 - Convert from unix epoch to Gregorian epoch - msecs += 12219292800000; - - // `time_low` - var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; - b[i++] = tl >>> 24 & 0xff; - b[i++] = tl >>> 16 & 0xff; - b[i++] = tl >>> 8 & 0xff; - b[i++] = tl & 0xff; - - // `time_mid` - var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff; - b[i++] = tmh >>> 8 & 0xff; - b[i++] = tmh & 0xff; - - // `time_high_and_version` - b[i++] = tmh >>> 24 & 0xf | 0x10; // include version - b[i++] = tmh >>> 16 & 0xff; - - // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) - b[i++] = clockseq >>> 8 | 0x80; - - // `clock_seq_low` - b[i++] = clockseq & 0xff; - - // `node` - for (var n = 0; n < 6; ++n) { - b[i + n] = node[n]; - } - - return buf ? buf : bytesToUuid(b); -} - -module.exports = v1; - -},{"./lib/bytesToUuid":2,"./lib/rng":3}],5:[function(require,module,exports){ -var rng = require('./lib/rng'); -var bytesToUuid = require('./lib/bytesToUuid'); - -function v4(options, buf, offset) { - var i = buf && offset || 0; - - if (typeof(options) == 'string') { - buf = options === 'binary' ? new Array(16) : null; - options = null; - } - options = options || {}; - - var rnds = options.random || (options.rng || rng)(); - - // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` - rnds[6] = (rnds[6] & 0x0f) | 0x40; - rnds[8] = (rnds[8] & 0x3f) | 0x80; - - // Copy bytes to buffer, if provided - if (buf) { - for (var ii = 0; ii < 16; ++ii) { - buf[i + ii] = rnds[ii]; - } - } - - return buf || bytesToUuid(rnds); -} - -module.exports = v4; - -},{"./lib/bytesToUuid":2,"./lib/rng":3}]},{},[1])(1) -}); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..08f3527 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "target": "es5", + "moduleResolution": "node", + "module": "commonjs", + "noEmit": true, + "allowJs": true, + "removeComments": false, + + "strict": true, + "noImplicitAny": true, + "noImplicitThis": true, + + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + + "skipLibCheck": true + } + } \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index fb70165..3c52e4e 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,41 +1,53 @@ -var webpack = require('webpack') -var path = require('path') - +const path = require('path') +const { CleanWebpackPlugin } = require('clean-webpack-plugin') +const CopyPlugin = require('copy-webpack-plugin') +const GlobEntries = require('webpack-glob-entries') const TerserPlugin = require('terser-webpack-plugin') module.exports = { mode: 'production', - entry: './src/index.js', + // entry: './src/index.js', + entry: GlobEntries('./src/index.ts'), output: { - filename: 'aws.min.js', path: path.resolve(__dirname, 'build'), libraryTarget: 'commonjs', + filename: 'aws.min.js', + }, + resolve: { + extensions: ['.ts', '.js'], }, module: { rules: [ { - test: /\.js$/, - loader: 'babel-loader', + test: /\.ts$/, + use: 'babel-loader', + exclude: /node_modules/, }, ], }, - stats: { - colors: true, - }, target: 'web', externals: /^(k6|https?\:\/\/)(\/.*)?/, + // Generate map files for compiled scripts devtool: 'source-map', + stats: { + colors: true, + }, + plugins: [ + new CleanWebpackPlugin(), + + // Copy assets to the destination folder + // see `src/post-file-test.ts` for an test example using an asset + new CopyPlugin({ + patterns: [ + { + from: path.resolve(__dirname, 'assets'), + noErrorOnMissing: true, + }, + ], + }), + ], optimization: { minimize: true, minimizer: [new TerserPlugin()], - // minimizer: [ - // new UglifyJsPlugin({ - // uglifyOptions: { - // output: { - // comments: false, - // }, - // }, - // }), - // ], }, }