@stackone/transport 1.9.0 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -787,4 +787,4 @@ type LockEntry = {
787
787
  unlock: Unlock;
788
788
  };
789
789
  //#endregion
790
- export { CUSTOM_ERROR_CONFIG_SCHEMA, ConcurrencyManager, CustomErrorConfig, ErrorMappingFn, EventClient, HttpClient, HttpClientManager, HttpErrorMessages, HttpHeaders, HttpMethod, HttpMethods, HttpParameters, HttpQueryParams, HttpResponse, HttpResponseError, HttpTransportFactory, ICacheClient, IHttpClient, InstanceManager, Lock, LockEntry, LockManager, MemoryStore, MemoryStoreConfig, PruneCount, PubSubListener, QueueManager, RateLimitManager, RedisClient, RequestClientFactory, RequestContext, RequestParameter, RequestParameterLocations, ScriptManager, SubscriptionManager, Unlock, createAuthorizationHeaders, getTransportInstance, isFailedStatusCode, isInfoStatusCode, isSuccessStatusCode, parseRequestParameters };
790
+ export { CUSTOM_ERROR_CONFIG_SCHEMA, ConcurrencyManager, CustomErrorConfig, ErrorMappingFn, EventClient, HttpClient, HttpClientManager, HttpErrorMessages, HttpHeaders, HttpMethod, HttpMethods, HttpParameters, HttpQueryParams, HttpResponse, HttpResponseError, HttpTransportFactory, ICacheClient, IHttpClient, InstanceManager, Lock, LockEntry, LockManager, MemoryStore, MemoryStoreConfig, PruneCount, PubSubListener, QueueManager, RateLimitManager, RedisClient, RedisClientConfig, RedisClientType, RequestClientFactory, RequestContext, RequestParameter, RequestParameterLocations, ScriptManager, SubscriptionManager, Unlock, buildHttpClientInstance, createAuthorizationHeaders, getTransportInstance, isFailedStatusCode, isInfoStatusCode, isSuccessStatusCode, parseRequestParameters };
package/dist/index.d.ts CHANGED
@@ -787,4 +787,4 @@ type LockEntry = {
787
787
  unlock: Unlock;
788
788
  };
789
789
  //#endregion
790
- export { CUSTOM_ERROR_CONFIG_SCHEMA, ConcurrencyManager, CustomErrorConfig, ErrorMappingFn, EventClient, HttpClient, HttpClientManager, HttpErrorMessages, HttpHeaders, HttpMethod, HttpMethods, HttpParameters, HttpQueryParams, HttpResponse, HttpResponseError, HttpTransportFactory, ICacheClient, IHttpClient, InstanceManager, Lock, LockEntry, LockManager, MemoryStore, MemoryStoreConfig, PruneCount, PubSubListener, QueueManager, RateLimitManager, RedisClient, RequestClientFactory, RequestContext, RequestParameter, RequestParameterLocations, ScriptManager, SubscriptionManager, Unlock, createAuthorizationHeaders, getTransportInstance, isFailedStatusCode, isInfoStatusCode, isSuccessStatusCode, parseRequestParameters };
790
+ export { CUSTOM_ERROR_CONFIG_SCHEMA, ConcurrencyManager, CustomErrorConfig, ErrorMappingFn, EventClient, HttpClient, HttpClientManager, HttpErrorMessages, HttpHeaders, HttpMethod, HttpMethods, HttpParameters, HttpQueryParams, HttpResponse, HttpResponseError, HttpTransportFactory, ICacheClient, IHttpClient, InstanceManager, Lock, LockEntry, LockManager, MemoryStore, MemoryStoreConfig, PruneCount, PubSubListener, QueueManager, RateLimitManager, RedisClient, RedisClientConfig, RedisClientType, RequestClientFactory, RequestContext, RequestParameter, RequestParameterLocations, ScriptManager, SubscriptionManager, Unlock, buildHttpClientInstance, createAuthorizationHeaders, getTransportInstance, isFailedStatusCode, isInfoStatusCode, isSuccessStatusCode, parseRequestParameters };
package/dist/index.js CHANGED
@@ -211,7 +211,7 @@ var $c=9e15,el=1e9,tl=`0123456789abcdef`,nl=`2.302585092994045684017991454684364
211
211
  * Copyright (c) 2023, Robert Eisele (robert@raw.org)
212
212
  * Dual licensed under the MIT or GPL Version 2 licenses.
213
213
  **/
214
- (function(n){"use strict";var r=2e3,i={s:1,n:0,d:1};function a(e,t){if(isNaN(e=parseInt(e,10)))throw h();return e*t}function o(e,t){if(t===0)throw m();var n=Object.create(p.prototype);n.s=e<0?-1:1,e=e<0?-e:e;var r=f(e,t);return n.n=e/r,n.d=t/r,n}function s(e){for(var t={},n=e,r=2,i=4;i<=n;){for(;n%r===0;)n/=r,t[r]=(t[r]||0)+1;i+=1+2*r++}return n===e?t[e]=(t[e]||0)+1:n>1&&(t[n]=(t[n]||0)+1),t}var c=function(e,t){var n=0,r=1,o=1,s=0,c=0,l=0,u=1,d=1,f=0,p=1,_=1,v=1,y=1e7,b;if(e!=null)if(t!==void 0){if(n=e,r=t,o=n*r,n%1!=0||r%1!=0)throw g()}else switch(typeof e){case`object`:if(`d`in e&&`n`in e)n=e.n,r=e.d,`s`in e&&(n*=e.s);else if(0 in e)n=e[0],1 in e&&(r=e[1]);else throw h();o=n*r;break;case`number`:if(e<0&&(o=e,e=-e),e%1==0)n=e;else if(e>0){for(e>=1&&(d=10**Math.floor(1+Math.log(e)/Math.LN10),e/=d);p<=y&&v<=y;)if(b=(f+_)/(p+v),e===b){p+v<=y?(n=f+_,r=p+v):v>p?(n=_,r=v):(n=f,r=p);break}else e>b?(f+=_,p+=v):(_+=f,v+=p),p>y?(n=_,r=v):(n=f,r=p);n*=d}else (isNaN(e)||isNaN(t))&&(r=n=NaN);break;case`string`:if(p=e.match(/\d+|./g),p===null)throw h();if(p[f]===`-`?(o=-1,f++):p[f]===`+`&&f++,p.length===f+1?c=a(p[f++],o):p[f+1]===`.`||p[f]===`.`?(p[f]!==`.`&&(s=a(p[f++],o)),f++,(f+1===p.length||p[f+1]===`(`&&p[f+3]===`)`||p[f+1]===`'`&&p[f+3]===`'`)&&(c=a(p[f],o),u=10**p[f].length,f++),(p[f]===`(`&&p[f+2]===`)`||p[f]===`'`&&p[f+2]===`'`)&&(l=a(p[f+1],o),d=10**p[f+1].length-1,f+=3)):p[f+1]===`/`||p[f+1]===`:`?(c=a(p[f],o),u=a(p[f+2],1),f+=3):p[f+3]===`/`&&p[f+1]===` `&&(s=a(p[f],o),c=a(p[f+2],o),u=a(p[f+4],1),f+=5),p.length<=f){r=u*d,o=n=l+r*s+d*c;break}default:throw h()}if(r===0)throw m();i.s=o<0?-1:1,i.n=Math.abs(n),i.d=Math.abs(r)};function l(e,t,n){for(var r=1;t>0;e=e*e%n,t>>=1)t&1&&(r=r*e%n);return r}function u(e,t){for(;t%2==0;t/=2);for(;t%5==0;t/=5);if(t===1)return 0;for(var n=10%t,i=1;n!==1;i++)if(n=n*10%t,i>r)return 0;return i}function d(e,t,n){for(var r=1,i=l(10,n,t),a=0;a<300;a++){if(r===i)return a;r=r*10%t,i=i*10%t}return 0}function f(e,t){if(!e)return t;if(!t)return e;for(;;){if(e%=t,!e)return t;if(t%=e,!t)return e}}function p(e,t){if(c(e,t),this instanceof p)e=f(i.d,i.n),this.s=i.s,this.n=i.n/e,this.d=i.d/e;else return o(i.s*i.n,i.d)}var m=function(){return Error(`Division by Zero`)},h=function(){return Error(`Invalid argument`)},g=function(){return Error(`Parameters must be integer`)};p.prototype={s:1,n:0,d:1,abs:function(){return o(this.n,this.d)},neg:function(){return o(-this.s*this.n,this.d)},add:function(e,t){return c(e,t),o(this.s*this.n*i.d+i.s*this.d*i.n,this.d*i.d)},sub:function(e,t){return c(e,t),o(this.s*this.n*i.d-i.s*this.d*i.n,this.d*i.d)},mul:function(e,t){return c(e,t),o(this.s*i.s*this.n*i.n,this.d*i.d)},div:function(e,t){return c(e,t),o(this.s*i.s*this.n*i.d,this.d*i.n)},clone:function(){return o(this.s*this.n,this.d)},mod:function(e,t){if(isNaN(this.n)||isNaN(this.d))return new p(NaN);if(e===void 0)return o(this.s*this.n%this.d,1);if(c(e,t),i.n===0&&this.d===0)throw m();return o(this.s*(i.d*this.n)%(i.n*this.d),i.d*this.d)},gcd:function(e,t){return c(e,t),o(f(i.n,this.n)*f(i.d,this.d),i.d*this.d)},lcm:function(e,t){return c(e,t),i.n===0&&this.n===0?o(0,1):o(i.n*this.n,f(i.n,this.n)*f(i.d,this.d))},ceil:function(e){return e=10**(e||0),isNaN(this.n)||isNaN(this.d)?new p(NaN):o(Math.ceil(e*this.s*this.n/this.d),e)},floor:function(e){return e=10**(e||0),isNaN(this.n)||isNaN(this.d)?new p(NaN):o(Math.floor(e*this.s*this.n/this.d),e)},round:function(e){return e=10**(e||0),isNaN(this.n)||isNaN(this.d)?new p(NaN):o(Math.round(e*this.s*this.n/this.d),e)},inverse:function(){return o(this.s*this.d,this.n)},pow:function(e,t){if(c(e,t),i.d===1)return i.s<0?o((this.s*this.d)**+i.n,this.n**+i.n):o((this.s*this.n)**+i.n,this.d**+i.n);if(this.s<0)return null;var n=s(this.n),r=s(this.d),a=1,l=1;for(var u in n){if(u===`1`)continue;if(u===`0`){a=0;break}if(n[u]*=i.n,n[u]%i.d===0)n[u]/=i.d;else return null;a*=u**+n[u]}for(var u in r){if(u===`1`)continue;if(r[u]*=i.n,r[u]%i.d===0)r[u]/=i.d;else return null;l*=u**+r[u]}return i.s<0?o(l,a):o(a,l)},equals:function(e,t){return c(e,t),this.s*this.n*i.d===i.s*i.n*this.d},compare:function(e,t){c(e,t);var n=this.s*this.n*i.d-i.s*i.n*this.d;return(0<n)-(n<0)},simplify:function(e){if(isNaN(this.n)||isNaN(this.d))return this;e||=.001;for(var t=this.abs(),n=t.toContinued(),r=1;r<n.length;r++){for(var i=o(n[r-1],1),a=r-2;a>=0;a--)i=i.inverse().add(n[a]);if(Math.abs(i.sub(t).valueOf())<e)return i.mul(this.s)}return this},divisible:function(e,t){return c(e,t),!(!(i.n*this.d)||this.n*i.d%(i.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(e){var t,n=``,r=this.n,i=this.d;return this.s<0&&(n+=`-`),i===1?n+=r:(e&&(t=Math.floor(r/i))>0&&(n+=t,n+=` `,r%=i),n+=r,n+=`/`,n+=i),n},toLatex:function(e){var t,n=``,r=this.n,i=this.d;return this.s<0&&(n+=`-`),i===1?n+=r:(e&&(t=Math.floor(r/i))>0&&(n+=t,r%=i),n+=`\\frac{`,n+=r,n+=`}{`,n+=i,n+=`}`),n},toContinued:function(){var e,t=this.n,n=this.d,r=[];if(isNaN(t)||isNaN(n))return r;do r.push(Math.floor(t/n)),e=t%n,t=n,n=e;while(t!==1);return r},toString:function(e){var t=this.n,n=this.d;if(isNaN(t)||isNaN(n))return`NaN`;e||=15;var r=u(t,n),i=d(t,n,r),a=this.s<0?`-`:``;if(a+=t/n|0,t%=n,t*=10,t&&(a+=`.`),r){for(var o=i;o--;)a+=t/n|0,t%=n,t*=10;a+=`(`;for(var o=r;o--;)a+=t/n|0,t%=n,t*=10;a+=`)`}else for(var o=e;t&&o--;)a+=t/n|0,t%=n,t*=10;return a}},typeof exports==`object`?(Object.defineProperty(p,`__esModule`,{value:!0}),p.default=p,p.Fraction=p,t.exports=p):n.Fraction=p})(void 0)}),Gu=c(Wu(),1),Ku=`Fraction`,qu=[],Ju=jc(Ku,qu,()=>(Object.defineProperty(Gu.default,`name`,{value:`Fraction`}),Gu.default.prototype.constructor=Gu.default,Gu.default.prototype.type=`Fraction`,Gu.default.prototype.isFraction=!0,Gu.default.prototype.toJSON=function(){return{mathjs:`Fraction`,n:this.s*this.n,d:this.d}},Gu.default.fromJSON=function(e){return new Gu.default(e)},Gu.default),{isClass:!0}),Yu=`Matrix`,Xu=[],Zu=jc(Yu,Xu,()=>{function e(){if(!(this instanceof e))throw SyntaxError(`Constructor must be called with the new operator`)}return e.prototype.type=`Matrix`,e.prototype.isMatrix=!0,e.prototype.storage=function(){throw Error(`Cannot invoke storage on a Matrix interface`)},e.prototype.datatype=function(){throw Error(`Cannot invoke datatype on a Matrix interface`)},e.prototype.create=function(e,t){throw Error(`Cannot invoke create on a Matrix interface`)},e.prototype.subset=function(e,t,n){throw Error(`Cannot invoke subset on a Matrix interface`)},e.prototype.get=function(e){throw Error(`Cannot invoke get on a Matrix interface`)},e.prototype.set=function(e,t,n){throw Error(`Cannot invoke set on a Matrix interface`)},e.prototype.resize=function(e,t){throw Error(`Cannot invoke resize on a Matrix interface`)},e.prototype.reshape=function(e,t){throw Error(`Cannot invoke reshape on a Matrix interface`)},e.prototype.clone=function(){throw Error(`Cannot invoke clone on a Matrix interface`)},e.prototype.size=function(){throw Error(`Cannot invoke size on a Matrix interface`)},e.prototype.map=function(e,t){throw Error(`Cannot invoke map on a Matrix interface`)},e.prototype.forEach=function(e){throw Error(`Cannot invoke forEach on a Matrix interface`)},e.prototype[Symbol.iterator]=function(){throw Error(`Cannot iterate a Matrix interface`)},e.prototype.toArray=function(){throw Error(`Cannot invoke toArray on a Matrix interface`)},e.prototype.valueOf=function(){throw Error(`Cannot invoke valueOf on a Matrix interface`)},e.prototype.format=function(e){throw Error(`Cannot invoke format on a Matrix interface`)},e.prototype.toString=function(){throw Error(`Cannot invoke toString on a Matrix interface`)},e},{isClass:!0});function Qu(e){return Object.keys(e.signatures||{}).reduce(function(e,t){var n=(t.match(/,/g)||[]).length+1;return Math.max(e,n)},-1)}var $u=`DenseMatrix`,ed=[`Matrix`],td=jc($u,ed,e=>{var{Matrix:t}=e;function n(e,t){if(!(this instanceof n))throw SyntaxError(`Constructor must be called with the new operator`);if(t&&!Jo(t))throw Error(`Invalid datatype: `+t);if(Yo(e))e.type===`DenseMatrix`?(this._data=As(e._data),this._size=As(e._size),this._datatype=t||e._datatype):(this._data=e.toArray(),this._size=e.size(),this._datatype=t||e._datatype);else if(e&&z(e.data)&&z(e.size))this._data=e.data,this._size=e.size,pc(this._data,this._size),this._datatype=t||e.datatype;else if(z(e))this._data=l(e),this._size=dc(this._data),pc(this._data,this._size),this._datatype=t;else if(e)throw TypeError(`Unsupported type of data (`+ks(e)+`)`);else this._data=[],this._size=[0],this._datatype=t}n.prototype=new t,n.prototype.createDenseMatrix=function(e,t){return new n(e,t)},Object.defineProperty(n,`name`,{value:`DenseMatrix`}),n.prototype.constructor=n,n.prototype.type=`DenseMatrix`,n.prototype.isDenseMatrix=!0,n.prototype.getDataType=function(){return Cc(this._data,ks)},n.prototype.storage=function(){return`dense`},n.prototype.datatype=function(){return this._datatype},n.prototype.create=function(e,t){return new n(e,t)},n.prototype.subset=function(e,t,n){switch(arguments.length){case 1:return r(this,e);case 2:case 3:return a(this,e,t,n);default:throw SyntaxError(`Wrong number of arguments`)}},n.prototype.get=function(e){if(!z(e))throw TypeError(`Array expected`);if(e.length!==this._size.length)throw new B(e.length,this._size.length);for(var t=0;t<e.length;t++)V(e[t],this._size[t]);for(var n=this._data,r=0,i=e.length;r<i;r++){var a=e[r];V(a,n.length),n=n[a]}return n},n.prototype.set=function(e,t,n){if(!z(e))throw TypeError(`Array expected`);if(e.length<this._size.length)throw new B(e.length,this._size.length,`<`);var r,i,a,o=e.map(function(e){return e+1});c(this,o,n);var s=this._data;for(r=0,i=e.length-1;r<i;r++)a=e[r],V(a,s.length),s=s[a];return a=e[e.length-1],V(a,s.length),s[a]=t,this};function r(e,t){if(!es(t))throw TypeError(`Invalid index`);var r=t.isScalar();if(r)return e.get(t.min());var a=t.size();if(a.length!==e._size.length)throw new B(a.length,e._size.length);for(var o=t.min(),s=t.max(),c=0,l=e._size.length;c<l;c++)V(o[c],e._size[c]),V(s[c],e._size[c]);return new n(i(e._data,t,a.length,0),e._datatype)}function i(e,t,n,r){var a=r===n-1,o=t.dimension(r);return a?o.map(function(t){return V(t,e.length),e[t]}).valueOf():o.map(function(a){V(a,e.length);var o=e[a];return i(o,t,n,r+1)}).valueOf()}function a(e,t,n,r){if(!t||t.isIndex!==!0)throw TypeError(`Invalid index`);var i=t.size(),a=t.isScalar(),s;if(Yo(n)?(s=n.size(),n=n.valueOf()):s=dc(n),a){if(s.length!==0)throw TypeError(`Scalar expected`);e.set(t.min(),n,r)}else{if(!Ms(s,i))try{n=s.length===0?Oc([n],i):Oc(n,i),s=dc(n)}catch{}if(i.length<e._size.length)throw new B(i.length,e._size.length,`<`);if(s.length<i.length){for(var l=0,u=0;i[l]===1&&s[l]===1;)l++;for(;i[l]===1;)u++,l++;n=bc(n,i.length,u,s)}if(!Ms(i,s))throw new B(i,s,`>`);var d=t.max().map(function(e){return e+1});c(e,d,r);var f=i.length,p=0;o(e._data,t,n,f,p)}return e}function o(e,t,n,r,i){var a=i===r-1,s=t.dimension(i);a?s.forEach(function(t,r){V(t),e[t]=n[r[0]]}):s.forEach(function(a,s){V(a),o(e[a],t,n[s[0]],r,i+1)})}n.prototype.resize=function(e,t,n){if(!Xo(e))throw TypeError(`Array or Matrix expected`);var r=e.valueOf().map(e=>Array.isArray(e)&&e.length===1?e[0]:e),i=n?this.clone():this;return s(i,r,t)};function s(e,t,n){if(t.length===0){for(var r=e._data;z(r);)r=r[0];return r}return e._size=t.slice(0),e._data=mc(e._data,e._size,n),e}n.prototype.reshape=function(e,t){var n=t?this.clone():this;n._data=gc(n._data,e);var r=n._size.reduce((e,t)=>e*t);return n._size=_c(e,r),n};function c(e,t,n){for(var r=e._size.slice(0),i=!1;r.length<t.length;)r.push(0),i=!0;for(var a=0,o=t.length;a<o;a++)t[a]>r[a]&&(r[a]=t[a],i=!0);i&&s(e,r,n)}n.prototype.clone=function(){var e=new n({data:As(this._data),size:As(this._size),datatype:this._datatype});return e},n.prototype.size=function(){return this._size.slice(0)},n.prototype.map=function(e){var t=this,r=Qu(e),i=function n(i,a){return z(i)?i.map(function(e,t){return n(e,a.concat(t))}):r===1?e(i):r===2?e(i,a):e(i,a,t)},a=i(this._data,[]),o=this._datatype===void 0?void 0:Cc(a,ks);return new n(a,o)},n.prototype.forEach=function(e){var t=this,n=function n(r,i){z(r)?r.forEach(function(e,t){n(e,i.concat(t))}):e(r,i,t)};n(this._data,[])},n.prototype[Symbol.iterator]=function*(){var e=function*e(t,n){if(z(t))for(var r=0;r<t.length;r++)yield*e(t[r],n.concat(r));else yield{value:t,index:n}};yield*e(this._data,[])},n.prototype.rows=function(){var e=[],t=this.size();if(t.length!==2)throw TypeError(`Rows can only be returned for a 2D matrix.`);var r=this._data;for(var i of r)e.push(new n([i],this._datatype));return e},n.prototype.columns=function(){var e=this,t=[],r=this.size();if(r.length!==2)throw TypeError(`Rows can only be returned for a 2D matrix.`);for(var i=this._data,a=function(r){var a=i.map(e=>[e[r]]);t.push(new n(a,e._datatype))},o=0;o<r[1];o++)a(o);return t},n.prototype.toArray=function(){return As(this._data)},n.prototype.valueOf=function(){return this._data},n.prototype.format=function(e){return rc(this._data,e)},n.prototype.toString=function(){return rc(this._data)},n.prototype.toJSON=function(){return{mathjs:`DenseMatrix`,data:this._data,size:this._size,datatype:this._datatype}},n.prototype.diagonal=function(e){if(e){if(Wo(e)&&(e=e.toNumber()),!R(e)||!Bs(e))throw TypeError(`The parameter k must be an integer number`)}else e=0;for(var t=e>0?e:0,r=e<0?-e:0,i=this._size[0],a=this._size[1],o=Math.min(i-r,a-t),s=[],c=0;c<o;c++)s[c]=this._data[c+r][c+t];return new n({data:s,size:[o],datatype:this._datatype})},n.diagonal=function(e,t,r,i){if(!z(e))throw TypeError(`Array expected, size parameter`);if(e.length!==2)throw Error(`Only two dimensions matrix are supported`);if(e=e.map(function(e){if(Wo(e)&&(e=e.toNumber()),!R(e)||!Bs(e)||e<1)throw Error(`Size values must be positive integers`);return e}),r){if(Wo(r)&&(r=r.toNumber()),!R(r)||!Bs(r))throw TypeError(`The parameter k must be an integer number`)}else r=0;var a=r>0?r:0,o=r<0?-r:0,s=e[0],c=e[1],l=Math.min(s-o,c-a),u;if(z(t)){if(t.length!==l)throw Error(`Invalid value array length`);u=function(e){return t[e]}}else if(Yo(t)){var d=t.size();if(d.length!==1||d[0]!==l)throw Error(`Invalid matrix length`);u=function(e){return t.get([e])}}else u=function(){return t};i||=Wo(u(0))?u(0).mul(0):0;var f=[];if(e.length>0){f=mc(f,e,i);for(var p=0;p<l;p++)f[p+o][p+a]=u(p)}return new n({data:f,size:[s,c]})},n.fromJSON=function(e){return new n(e)},n.prototype.swapRows=function(e,t){if(!R(e)||!Bs(e)||!R(t)||!Bs(t))throw Error(`Row index must be positive integers`);if(this._size.length!==2)throw Error(`Only two dimensional matrix is supported`);return V(e,this._size[0]),V(t,this._size[0]),n._swapRows(e,t,this._data),this},n._swapRows=function(e,t,n){var r=n[e];n[e]=n[t],n[t]=r};function l(e){return Yo(e)?l(e.valueOf()):z(e)?e.map(l):e}return n},{isClass:!0});function nd(e,t,n){return e&&typeof e.map==`function`?e.map(function(e){return nd(e,t,n)}):t(e)}var rd=`isNumeric`,id=[`typed`],ad=jc(rd,id,e=>{var{typed:t}=e;return t(rd,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":t.referToSelf(e=>t=>nd(t,e))})}),od=`hasNumericValue`,sd=[`typed`,`isNumeric`],cd=jc(od,sd,e=>{var{typed:t,isNumeric:n}=e;return t(od,{boolean:()=>!0,string:function(e){return e.trim().length>0&&!isNaN(Number(e))},any:function(e){return n(e)}})}),ld=Pu({config:Rs}),ud=Uu({}),dd=Ju({}),fd=Zu({}),pd=td({Matrix:fd}),md=Jc({BigNumber:ld,Complex:ud,DenseMatrix:pd,Fraction:dd}),hd=ad({typed:md}),gd=cd({isNumeric:hd,typed:md});const _d=e=>{let t=Number(e);return Number.isNaN(t)?!1:t>=120&&t<=36e4},vd=e=>{let t=Number(e),n=Date.now();if(Number.isNaN(t))return n+Bo;if(!_d(t)&&(0,l.isFutureUnixTimestamp)(t))return Vo(t);if(_d(t))return n+t;{let e=t*Ro;return n+e}},yd=`ratelimitlimit`,bd=`ratelimitremaining`,xd=`ratelimitreset`,Sd=`ratelimitconcurrencylimit`,Cd=`ratelimitconcurrencyremaining`,wd=`ratelimitconcurrencyreset`,Td=e=>{let t={};for(let[n,r]of Object.entries(e)){let e=n.toLowerCase().replace(/^x-/,``).replace(/concurren.+-/g,`concurrency-`).replace(/-/g,``),i=gd(r)?Number(r):null;t[e]=i}return t},Ed=e=>{let t=Td(e);return{rateLimitLimit:t[yd],rateLimitRemaining:t[bd],rateLimitReset:vd(t[xd]),concurrencyLimit:t[Sd],concurrencyRemaining:t[Cd],concurrencyReset:vd(t[wd])}},Dd=e=>{let{accountSecureId:t,service:n,resource:r,subResource:i,childResource:a,action:o,behaviours:s}=e??{};return[t,n,r,o].some(l.isMissing)?null:[t,n,r,i,a,o,...s??[]].filter(Boolean).join(`-`)},Od=(e,t=Fo,n=Po)=>{let r=Date.now();return(0,l.isFutureUnixTimestamp)(e)||(0,l.isNumber)(e)?kd(Number(e),r,t,n):Jo(e)&&e!==``?Ad(e,r,t,n):n},kd=(e,t,n=Fo,r=Po)=>{if(e<n)return e;let i=Vo(e);if(i>t){let e=Math.floor((i-t)/Ro);return e>0&&e<n?e:r}return r},Ad=(e,t,n=Fo,r=Po)=>{if(zo.test(e)){let t=parseFloat(e);return t>0&&t<n?t:r}let i=new Date(e);if(Number.isNaN(i.getTime()))return r;let a=i.getTime();if(a>t){let e=Math.floor((a-t)/Ro);return e>0&&e<n?e:r}return r};let jd=function(e){return e.RateLimiterReleaseRequestFailed=`RateLimiterReleaseRequestFailed`,e}({});const Md=({axiosInstance:e,logger:t,requestConfig:n,context:r})=>{let i=async i=>{let{response:a,config:o}=i,s=o?.signal;if(s?.aborted)return Promise.reject(Ao(`Request aborted`,o,`ERR_CANCELED`,a));let{status:c,retryAfter:u}=Nd(a,r,n,t);if(c===429&&(0,l.notMissing)(o)){let n=Od(u);if(o._retryCount>=Io)return t?.warning({category:`http-transport`,message:`Max retries exceeded for ${o?.url}. Aborting.`,context:{...r??{},retryAfterHeader:u,retryAfterAsNumber:n}}),Promise.reject(i);let s=o._retryCount??0,c={...o,_retryCount:s+1},d=u?n*Ro:(0,l.exponentialBackoffInMS)(c._retryCount);return t?.debug({category:`http-transport`,message:`Received 429 error from ${o?.url}`,context:{...r??{},retryAfterHeader:u,calculatedRetryAfter:d}}),await jo(d*1e3,o,a),e?.request(c)}return Promise.reject(i)};return i},Nd=(e,t,n,r)=>{let{provider:i}=t??{},{status:a,headers:o,data:s}=e??{},{retryafter:c}=Td(o??{});if((0,l.isMissing)(i)||(0,l.isMissing)(e))return r?.warning({category:`http-transport`,message:`Invalid parameters for convertError`,context:{...t,responseIsMissing:(0,l.isMissing)(e),providerIsMissing:(0,l.isMissing)(i),status:e?.status??`undefined`,statusText:e?.statusText??`undefined`,retryafter:c??`undefined`}}),{status:a,retryAfter:c};let u=n?.rateLimits?.mappedRateLimitErrors;if((0,l.notMissing)(u)&&(0,l.notMissing)(s))for(let e of u){let{errorStatus:t,errorMessagePath:n,errorMessage:r,retryAfterPath:i,retryAfterUnit:u,retryAfterValue:d}=e;if(t!==a)continue;let f=n??`message`,p=(0,l.isObject)(s)?h.default.query(s,f)[0]:s,m=Pd(p,r);if(t===a&&m){let e=d??Fd(o,i),t=Id(e,u);return{status:429,retryAfter:c??t}}}return{status:a,retryAfter:c}},Pd=(e,t)=>t instanceof RegExp?t.test(e??``):e?.includes(t)??!1,Fd=(e,t)=>(0,l.notMissing)(t)&&(0,l.notMissing)(e)?h.default.query(e,t)[0]:null,Id=(e,t=`seconds`)=>(0,l.notMissing)(e)?Ld(e,t):null,Ld=(e,t)=>{if(t===`seconds`)return typeof e==`string`?parseFloat(e):e;if(t===`milliseconds`){let t=typeof e==`string`?parseFloat(e):e;return t/Ro}if(t===`date`){let t=typeof e==`string`&&!isNaN(Number(e))?parseFloat(e):e,n=new Date(t);if(isNaN(n.getTime()))throw Error(`Invalid date value`);return n.getTime()}throw Error(`Invalid type`)},Rd=`rateLimitErrorInterceptor`,zd=({axiosInstance:e,logger:t,requestConfig:n,context:r})=>{let i=async i=>{let{response:a,config:o}=i,s=o?.signal;if((0,l.isMissing)(r)||(0,l.isMissing)(o))return t?.warning({category:`HttpClient`,message:`No context or config for this response - that doesn't seem right.`,context:{interceptor:Rd,...o,headers:void 0}}),Promise.reject(i);let{requestId:c,targetConcurrencyKey:u,leaseSubscription:d,setRemovalSubscription:f}=o?.requestMetadata??{},p=await Ge.getInstance(),m=(0,l.notMissing)(c)&&(0,l.notMissing)(u)?await p.releaseRequest(c,u):!1;if(!m&&(0,l.notMissing)(o?.requestMetadata)&&t?.error({category:`HttpClient`,message:`Failed to release request from concurrency manager`,context:{...r,interceptor:Rd,requestId:c,targetConcurrencyKey:u,leaseSubscription:d,setRemovalSubscription:f},code:jd.RateLimiterReleaseRequestFailed}),s?.aborted)return Promise.reject(Ao(`Request aborted`,o,`ERR_CANCELED`,a));let{status:h,retryAfter:g}=Nd(a,r,n,t);if(h===429&&(0,l.notMissing)(o)){let n=Od(g);if(o._retryCount>=Io)return t?.warning({category:`HttpClient`,message:`Max retries exceeded for ${o.url}. Aborting.`,context:{...r??{},...o.requestMetadata??{},retryAfterHeader:g,retryAfterAsNumber:n}}),Promise.reject(i);let s=o?._retryCount??0,c={...o,_retryCount:s+1},u=g?n*Ro:(0,l.exponentialBackoffInMS)(c._retryCount);return t?.debug({category:`HttpClient`,message:`Received 429 error from ${o.url}`,context:{...r,retryAfterHeader:g,calculatedRetryAfter:u}}),await jo(u*1e3,o,a),e?.request(c)}return Promise.reject(i)};return i},Bd=`rateLimitResponseInterceptor`,Vd=({logger:e,context:t})=>{let n=async n=>{let r=n?.config,i=r?.signal;if((0,l.isMissing)(t))e?.warning({category:`HttpClient`,message:`No context for this response - that doesn't seem right.`,context:{...r,interceptor:Bd,headers:void 0}});else{let t=n?.headers;if((0,l.notMissing)(t)){let n=Ed(t);e?.debug({category:`HttpClient`,message:`Rate limit headers extracted`,context:{interceptor:Bd,rateLimitHeaders:n}})}let{requestId:a,targetConcurrencyKey:o,leaseSubscription:s,setRemovalSubscription:c}=r?.requestMetadata??{},u=await Ge.getInstance(),d=await u.releaseRequest(a,o);if(d||e?.error({category:`HttpClient`,message:`Failed to release request from concurrency manager`,context:{interceptor:Bd,requestId:a,targetConcurrencyKey:o,leaseSubscription:s,setRemovalSubscription:c},code:jd.RateLimiterReleaseRequestFailed}),i?.aborted)return Promise.reject(Ao(`Request aborted`,r,`ERR_CANCELED`,n))}return n};return n},Hd=e=>(e.validateStatus??=e=>e>=200&&e<300,e),Ud=[{onFulfilled:Hd,onRejected:null,options:void 0}],Wd=[{onFulfilled:null,onRejected:Md},{onFulfilled:null,onRejected:_o}],Gd=[{onFulfilled:Hd,onRejected:null,options:void 0},{onFulfilled:No,onRejected:null,options:void 0}],Kd=[{onFulfilled:Vd,onRejected:zd},{onFulfilled:null,onRejected:_o}];let qd=function(e){return e.HttpTransportInstanceCreateError=`HttpTransportInstanceCreateError`,e}({});const Jd=async({logger:e,redisClientConfig:t,context:n}={})=>{let r,{NODE_ENV:i}=process.env,a=n?.behaviours??[`CONCURRENCY`,`RETRY`];try{if(r=a.includes(`RETRY`)?Xd(e,n):Yd(e,n),(0,l.isMissing)(n?.service)||(0,l.isMissing)(n?.organizationId)||i===`test`||(0,l.isMissing)(t)||(0,l.isMissing)(e))return r;let o=await Ge.getInstance(t,e),s=await o.isRedisConfigured(),c=[],u=[];if(a.includes(`CONCURRENCY`)){if(!s)throw Error(`Concurrency Manager cannot connect to Redis. Cannot create advanced transport instance.`);c.push(...Gd),u.push(...Kd)}let d=Dd(n);if((0,l.isMissing)(d))return e?.warning({category:`http-transport`,message:`Unable to create a key for transport instance - Invalid state. Using base default instance.`,context:{...n,defaultInstanceInitialized:(0,l.notMissing)(r)}}),r;let f=await go.get(d);if((0,l.notMissing)(f))return f;let p={interceptors:{requestConfigs:c,responseConfigs:u},instanceConfig:{maxBodyLength:1/0},logger:e,context:n},m=po.createInstance(p);return e?.debug({category:`http-transport`,message:`Creating new Axios instance and caching it for key: [${d}]`,context:{...n}}),await go.set(d,m),m}catch(t){return e?.error({category:`http-transport`,message:`Failed to create advanced transport instance. Using default instance.`,context:{...n,usingDefaultInstance:(0,l.notMissing)(r)},error:t,code:qd.HttpTransportInstanceCreateError}),(0,l.notMissing)(r)?r:Zd()}},Yd=(e,t)=>{let n={instanceConfig:{maxBodyLength:1/0},logger:e,context:t};return po.createInstance(n)??Zd()},Xd=(e,t)=>{let n={interceptors:{requestConfigs:Ud,responseConfigs:Wd},instanceConfig:{maxBodyLength:1/0},logger:e,context:t};return po.createInstance(n)??Zd()},Zd=()=>{let e=d.default.create({maxBodyLength:1/0});return e};var Qd=o((exports,t)=>{t.exports=n;function n(e={}){let{ERR_PATHS_MUST_BE_STRINGS:t=()=>`fast-redact - Paths must be (non-empty) strings`,ERR_INVALID_PATH:n=e=>`fast-redact – Invalid path (${e})`}=e;return function({paths:e}){e.forEach(e=>{if(typeof e!=`string`)throw Error(t());try{if(/〇/.test(e))throw Error();let t=(e[0]===`[`?``:`.`)+e.replace(/^\*/,`〇`).replace(/\.\*/g,`.〇`).replace(/\[\*\]/g,`[〇]`);if(/\n|\r|;/.test(t)||/\/\*/.test(t))throw Error();Function(`
214
+ (function(n){"use strict";var r=2e3,i={s:1,n:0,d:1};function a(e,t){if(isNaN(e=parseInt(e,10)))throw h();return e*t}function o(e,t){if(t===0)throw m();var n=Object.create(p.prototype);n.s=e<0?-1:1,e=e<0?-e:e;var r=f(e,t);return n.n=e/r,n.d=t/r,n}function s(e){for(var t={},n=e,r=2,i=4;i<=n;){for(;n%r===0;)n/=r,t[r]=(t[r]||0)+1;i+=1+2*r++}return n===e?t[e]=(t[e]||0)+1:n>1&&(t[n]=(t[n]||0)+1),t}var c=function(e,t){var n=0,r=1,o=1,s=0,c=0,l=0,u=1,d=1,f=0,p=1,_=1,v=1,y=1e7,b;if(e!=null)if(t!==void 0){if(n=e,r=t,o=n*r,n%1!=0||r%1!=0)throw g()}else switch(typeof e){case`object`:if(`d`in e&&`n`in e)n=e.n,r=e.d,`s`in e&&(n*=e.s);else if(0 in e)n=e[0],1 in e&&(r=e[1]);else throw h();o=n*r;break;case`number`:if(e<0&&(o=e,e=-e),e%1==0)n=e;else if(e>0){for(e>=1&&(d=10**Math.floor(1+Math.log(e)/Math.LN10),e/=d);p<=y&&v<=y;)if(b=(f+_)/(p+v),e===b){p+v<=y?(n=f+_,r=p+v):v>p?(n=_,r=v):(n=f,r=p);break}else e>b?(f+=_,p+=v):(_+=f,v+=p),p>y?(n=_,r=v):(n=f,r=p);n*=d}else (isNaN(e)||isNaN(t))&&(r=n=NaN);break;case`string`:if(p=e.match(/\d+|./g),p===null)throw h();if(p[f]===`-`?(o=-1,f++):p[f]===`+`&&f++,p.length===f+1?c=a(p[f++],o):p[f+1]===`.`||p[f]===`.`?(p[f]!==`.`&&(s=a(p[f++],o)),f++,(f+1===p.length||p[f+1]===`(`&&p[f+3]===`)`||p[f+1]===`'`&&p[f+3]===`'`)&&(c=a(p[f],o),u=10**p[f].length,f++),(p[f]===`(`&&p[f+2]===`)`||p[f]===`'`&&p[f+2]===`'`)&&(l=a(p[f+1],o),d=10**p[f+1].length-1,f+=3)):p[f+1]===`/`||p[f+1]===`:`?(c=a(p[f],o),u=a(p[f+2],1),f+=3):p[f+3]===`/`&&p[f+1]===` `&&(s=a(p[f],o),c=a(p[f+2],o),u=a(p[f+4],1),f+=5),p.length<=f){r=u*d,o=n=l+r*s+d*c;break}default:throw h()}if(r===0)throw m();i.s=o<0?-1:1,i.n=Math.abs(n),i.d=Math.abs(r)};function l(e,t,n){for(var r=1;t>0;e=e*e%n,t>>=1)t&1&&(r=r*e%n);return r}function u(e,t){for(;t%2==0;t/=2);for(;t%5==0;t/=5);if(t===1)return 0;for(var n=10%t,i=1;n!==1;i++)if(n=n*10%t,i>r)return 0;return i}function d(e,t,n){for(var r=1,i=l(10,n,t),a=0;a<300;a++){if(r===i)return a;r=r*10%t,i=i*10%t}return 0}function f(e,t){if(!e)return t;if(!t)return e;for(;;){if(e%=t,!e)return t;if(t%=e,!t)return e}}function p(e,t){if(c(e,t),this instanceof p)e=f(i.d,i.n),this.s=i.s,this.n=i.n/e,this.d=i.d/e;else return o(i.s*i.n,i.d)}var m=function(){return Error(`Division by Zero`)},h=function(){return Error(`Invalid argument`)},g=function(){return Error(`Parameters must be integer`)};p.prototype={s:1,n:0,d:1,abs:function(){return o(this.n,this.d)},neg:function(){return o(-this.s*this.n,this.d)},add:function(e,t){return c(e,t),o(this.s*this.n*i.d+i.s*this.d*i.n,this.d*i.d)},sub:function(e,t){return c(e,t),o(this.s*this.n*i.d-i.s*this.d*i.n,this.d*i.d)},mul:function(e,t){return c(e,t),o(this.s*i.s*this.n*i.n,this.d*i.d)},div:function(e,t){return c(e,t),o(this.s*i.s*this.n*i.d,this.d*i.n)},clone:function(){return o(this.s*this.n,this.d)},mod:function(e,t){if(isNaN(this.n)||isNaN(this.d))return new p(NaN);if(e===void 0)return o(this.s*this.n%this.d,1);if(c(e,t),i.n===0&&this.d===0)throw m();return o(this.s*(i.d*this.n)%(i.n*this.d),i.d*this.d)},gcd:function(e,t){return c(e,t),o(f(i.n,this.n)*f(i.d,this.d),i.d*this.d)},lcm:function(e,t){return c(e,t),i.n===0&&this.n===0?o(0,1):o(i.n*this.n,f(i.n,this.n)*f(i.d,this.d))},ceil:function(e){return e=10**(e||0),isNaN(this.n)||isNaN(this.d)?new p(NaN):o(Math.ceil(e*this.s*this.n/this.d),e)},floor:function(e){return e=10**(e||0),isNaN(this.n)||isNaN(this.d)?new p(NaN):o(Math.floor(e*this.s*this.n/this.d),e)},round:function(e){return e=10**(e||0),isNaN(this.n)||isNaN(this.d)?new p(NaN):o(Math.round(e*this.s*this.n/this.d),e)},inverse:function(){return o(this.s*this.d,this.n)},pow:function(e,t){if(c(e,t),i.d===1)return i.s<0?o((this.s*this.d)**+i.n,this.n**+i.n):o((this.s*this.n)**+i.n,this.d**+i.n);if(this.s<0)return null;var n=s(this.n),r=s(this.d),a=1,l=1;for(var u in n){if(u===`1`)continue;if(u===`0`){a=0;break}if(n[u]*=i.n,n[u]%i.d===0)n[u]/=i.d;else return null;a*=u**+n[u]}for(var u in r){if(u===`1`)continue;if(r[u]*=i.n,r[u]%i.d===0)r[u]/=i.d;else return null;l*=u**+r[u]}return i.s<0?o(l,a):o(a,l)},equals:function(e,t){return c(e,t),this.s*this.n*i.d===i.s*i.n*this.d},compare:function(e,t){c(e,t);var n=this.s*this.n*i.d-i.s*i.n*this.d;return(0<n)-(n<0)},simplify:function(e){if(isNaN(this.n)||isNaN(this.d))return this;e||=.001;for(var t=this.abs(),n=t.toContinued(),r=1;r<n.length;r++){for(var i=o(n[r-1],1),a=r-2;a>=0;a--)i=i.inverse().add(n[a]);if(Math.abs(i.sub(t).valueOf())<e)return i.mul(this.s)}return this},divisible:function(e,t){return c(e,t),!(!(i.n*this.d)||this.n*i.d%(i.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(e){var t,n=``,r=this.n,i=this.d;return this.s<0&&(n+=`-`),i===1?n+=r:(e&&(t=Math.floor(r/i))>0&&(n+=t,n+=` `,r%=i),n+=r,n+=`/`,n+=i),n},toLatex:function(e){var t,n=``,r=this.n,i=this.d;return this.s<0&&(n+=`-`),i===1?n+=r:(e&&(t=Math.floor(r/i))>0&&(n+=t,r%=i),n+=`\\frac{`,n+=r,n+=`}{`,n+=i,n+=`}`),n},toContinued:function(){var e,t=this.n,n=this.d,r=[];if(isNaN(t)||isNaN(n))return r;do r.push(Math.floor(t/n)),e=t%n,t=n,n=e;while(t!==1);return r},toString:function(e){var t=this.n,n=this.d;if(isNaN(t)||isNaN(n))return`NaN`;e||=15;var r=u(t,n),i=d(t,n,r),a=this.s<0?`-`:``;if(a+=t/n|0,t%=n,t*=10,t&&(a+=`.`),r){for(var o=i;o--;)a+=t/n|0,t%=n,t*=10;a+=`(`;for(var o=r;o--;)a+=t/n|0,t%=n,t*=10;a+=`)`}else for(var o=e;t&&o--;)a+=t/n|0,t%=n,t*=10;return a}},typeof exports==`object`?(Object.defineProperty(p,`__esModule`,{value:!0}),p.default=p,p.Fraction=p,t.exports=p):n.Fraction=p})(void 0)}),Gu=c(Wu(),1),Ku=`Fraction`,qu=[],Ju=jc(Ku,qu,()=>(Object.defineProperty(Gu.default,`name`,{value:`Fraction`}),Gu.default.prototype.constructor=Gu.default,Gu.default.prototype.type=`Fraction`,Gu.default.prototype.isFraction=!0,Gu.default.prototype.toJSON=function(){return{mathjs:`Fraction`,n:this.s*this.n,d:this.d}},Gu.default.fromJSON=function(e){return new Gu.default(e)},Gu.default),{isClass:!0}),Yu=`Matrix`,Xu=[],Zu=jc(Yu,Xu,()=>{function e(){if(!(this instanceof e))throw SyntaxError(`Constructor must be called with the new operator`)}return e.prototype.type=`Matrix`,e.prototype.isMatrix=!0,e.prototype.storage=function(){throw Error(`Cannot invoke storage on a Matrix interface`)},e.prototype.datatype=function(){throw Error(`Cannot invoke datatype on a Matrix interface`)},e.prototype.create=function(e,t){throw Error(`Cannot invoke create on a Matrix interface`)},e.prototype.subset=function(e,t,n){throw Error(`Cannot invoke subset on a Matrix interface`)},e.prototype.get=function(e){throw Error(`Cannot invoke get on a Matrix interface`)},e.prototype.set=function(e,t,n){throw Error(`Cannot invoke set on a Matrix interface`)},e.prototype.resize=function(e,t){throw Error(`Cannot invoke resize on a Matrix interface`)},e.prototype.reshape=function(e,t){throw Error(`Cannot invoke reshape on a Matrix interface`)},e.prototype.clone=function(){throw Error(`Cannot invoke clone on a Matrix interface`)},e.prototype.size=function(){throw Error(`Cannot invoke size on a Matrix interface`)},e.prototype.map=function(e,t){throw Error(`Cannot invoke map on a Matrix interface`)},e.prototype.forEach=function(e){throw Error(`Cannot invoke forEach on a Matrix interface`)},e.prototype[Symbol.iterator]=function(){throw Error(`Cannot iterate a Matrix interface`)},e.prototype.toArray=function(){throw Error(`Cannot invoke toArray on a Matrix interface`)},e.prototype.valueOf=function(){throw Error(`Cannot invoke valueOf on a Matrix interface`)},e.prototype.format=function(e){throw Error(`Cannot invoke format on a Matrix interface`)},e.prototype.toString=function(){throw Error(`Cannot invoke toString on a Matrix interface`)},e},{isClass:!0});function Qu(e){return Object.keys(e.signatures||{}).reduce(function(e,t){var n=(t.match(/,/g)||[]).length+1;return Math.max(e,n)},-1)}var $u=`DenseMatrix`,ed=[`Matrix`],td=jc($u,ed,e=>{var{Matrix:t}=e;function n(e,t){if(!(this instanceof n))throw SyntaxError(`Constructor must be called with the new operator`);if(t&&!Jo(t))throw Error(`Invalid datatype: `+t);if(Yo(e))e.type===`DenseMatrix`?(this._data=As(e._data),this._size=As(e._size),this._datatype=t||e._datatype):(this._data=e.toArray(),this._size=e.size(),this._datatype=t||e._datatype);else if(e&&z(e.data)&&z(e.size))this._data=e.data,this._size=e.size,pc(this._data,this._size),this._datatype=t||e.datatype;else if(z(e))this._data=l(e),this._size=dc(this._data),pc(this._data,this._size),this._datatype=t;else if(e)throw TypeError(`Unsupported type of data (`+ks(e)+`)`);else this._data=[],this._size=[0],this._datatype=t}n.prototype=new t,n.prototype.createDenseMatrix=function(e,t){return new n(e,t)},Object.defineProperty(n,`name`,{value:`DenseMatrix`}),n.prototype.constructor=n,n.prototype.type=`DenseMatrix`,n.prototype.isDenseMatrix=!0,n.prototype.getDataType=function(){return Cc(this._data,ks)},n.prototype.storage=function(){return`dense`},n.prototype.datatype=function(){return this._datatype},n.prototype.create=function(e,t){return new n(e,t)},n.prototype.subset=function(e,t,n){switch(arguments.length){case 1:return r(this,e);case 2:case 3:return a(this,e,t,n);default:throw SyntaxError(`Wrong number of arguments`)}},n.prototype.get=function(e){if(!z(e))throw TypeError(`Array expected`);if(e.length!==this._size.length)throw new B(e.length,this._size.length);for(var t=0;t<e.length;t++)V(e[t],this._size[t]);for(var n=this._data,r=0,i=e.length;r<i;r++){var a=e[r];V(a,n.length),n=n[a]}return n},n.prototype.set=function(e,t,n){if(!z(e))throw TypeError(`Array expected`);if(e.length<this._size.length)throw new B(e.length,this._size.length,`<`);var r,i,a,o=e.map(function(e){return e+1});c(this,o,n);var s=this._data;for(r=0,i=e.length-1;r<i;r++)a=e[r],V(a,s.length),s=s[a];return a=e[e.length-1],V(a,s.length),s[a]=t,this};function r(e,t){if(!es(t))throw TypeError(`Invalid index`);var r=t.isScalar();if(r)return e.get(t.min());var a=t.size();if(a.length!==e._size.length)throw new B(a.length,e._size.length);for(var o=t.min(),s=t.max(),c=0,l=e._size.length;c<l;c++)V(o[c],e._size[c]),V(s[c],e._size[c]);return new n(i(e._data,t,a.length,0),e._datatype)}function i(e,t,n,r){var a=r===n-1,o=t.dimension(r);return a?o.map(function(t){return V(t,e.length),e[t]}).valueOf():o.map(function(a){V(a,e.length);var o=e[a];return i(o,t,n,r+1)}).valueOf()}function a(e,t,n,r){if(!t||t.isIndex!==!0)throw TypeError(`Invalid index`);var i=t.size(),a=t.isScalar(),s;if(Yo(n)?(s=n.size(),n=n.valueOf()):s=dc(n),a){if(s.length!==0)throw TypeError(`Scalar expected`);e.set(t.min(),n,r)}else{if(!Ms(s,i))try{n=s.length===0?Oc([n],i):Oc(n,i),s=dc(n)}catch{}if(i.length<e._size.length)throw new B(i.length,e._size.length,`<`);if(s.length<i.length){for(var l=0,u=0;i[l]===1&&s[l]===1;)l++;for(;i[l]===1;)u++,l++;n=bc(n,i.length,u,s)}if(!Ms(i,s))throw new B(i,s,`>`);var d=t.max().map(function(e){return e+1});c(e,d,r);var f=i.length,p=0;o(e._data,t,n,f,p)}return e}function o(e,t,n,r,i){var a=i===r-1,s=t.dimension(i);a?s.forEach(function(t,r){V(t),e[t]=n[r[0]]}):s.forEach(function(a,s){V(a),o(e[a],t,n[s[0]],r,i+1)})}n.prototype.resize=function(e,t,n){if(!Xo(e))throw TypeError(`Array or Matrix expected`);var r=e.valueOf().map(e=>Array.isArray(e)&&e.length===1?e[0]:e),i=n?this.clone():this;return s(i,r,t)};function s(e,t,n){if(t.length===0){for(var r=e._data;z(r);)r=r[0];return r}return e._size=t.slice(0),e._data=mc(e._data,e._size,n),e}n.prototype.reshape=function(e,t){var n=t?this.clone():this;n._data=gc(n._data,e);var r=n._size.reduce((e,t)=>e*t);return n._size=_c(e,r),n};function c(e,t,n){for(var r=e._size.slice(0),i=!1;r.length<t.length;)r.push(0),i=!0;for(var a=0,o=t.length;a<o;a++)t[a]>r[a]&&(r[a]=t[a],i=!0);i&&s(e,r,n)}n.prototype.clone=function(){var e=new n({data:As(this._data),size:As(this._size),datatype:this._datatype});return e},n.prototype.size=function(){return this._size.slice(0)},n.prototype.map=function(e){var t=this,r=Qu(e),i=function n(i,a){return z(i)?i.map(function(e,t){return n(e,a.concat(t))}):r===1?e(i):r===2?e(i,a):e(i,a,t)},a=i(this._data,[]),o=this._datatype===void 0?void 0:Cc(a,ks);return new n(a,o)},n.prototype.forEach=function(e){var t=this,n=function n(r,i){z(r)?r.forEach(function(e,t){n(e,i.concat(t))}):e(r,i,t)};n(this._data,[])},n.prototype[Symbol.iterator]=function*(){var e=function*e(t,n){if(z(t))for(var r=0;r<t.length;r++)yield*e(t[r],n.concat(r));else yield{value:t,index:n}};yield*e(this._data,[])},n.prototype.rows=function(){var e=[],t=this.size();if(t.length!==2)throw TypeError(`Rows can only be returned for a 2D matrix.`);var r=this._data;for(var i of r)e.push(new n([i],this._datatype));return e},n.prototype.columns=function(){var e=this,t=[],r=this.size();if(r.length!==2)throw TypeError(`Rows can only be returned for a 2D matrix.`);for(var i=this._data,a=function(r){var a=i.map(e=>[e[r]]);t.push(new n(a,e._datatype))},o=0;o<r[1];o++)a(o);return t},n.prototype.toArray=function(){return As(this._data)},n.prototype.valueOf=function(){return this._data},n.prototype.format=function(e){return rc(this._data,e)},n.prototype.toString=function(){return rc(this._data)},n.prototype.toJSON=function(){return{mathjs:`DenseMatrix`,data:this._data,size:this._size,datatype:this._datatype}},n.prototype.diagonal=function(e){if(e){if(Wo(e)&&(e=e.toNumber()),!R(e)||!Bs(e))throw TypeError(`The parameter k must be an integer number`)}else e=0;for(var t=e>0?e:0,r=e<0?-e:0,i=this._size[0],a=this._size[1],o=Math.min(i-r,a-t),s=[],c=0;c<o;c++)s[c]=this._data[c+r][c+t];return new n({data:s,size:[o],datatype:this._datatype})},n.diagonal=function(e,t,r,i){if(!z(e))throw TypeError(`Array expected, size parameter`);if(e.length!==2)throw Error(`Only two dimensions matrix are supported`);if(e=e.map(function(e){if(Wo(e)&&(e=e.toNumber()),!R(e)||!Bs(e)||e<1)throw Error(`Size values must be positive integers`);return e}),r){if(Wo(r)&&(r=r.toNumber()),!R(r)||!Bs(r))throw TypeError(`The parameter k must be an integer number`)}else r=0;var a=r>0?r:0,o=r<0?-r:0,s=e[0],c=e[1],l=Math.min(s-o,c-a),u;if(z(t)){if(t.length!==l)throw Error(`Invalid value array length`);u=function(e){return t[e]}}else if(Yo(t)){var d=t.size();if(d.length!==1||d[0]!==l)throw Error(`Invalid matrix length`);u=function(e){return t.get([e])}}else u=function(){return t};i||=Wo(u(0))?u(0).mul(0):0;var f=[];if(e.length>0){f=mc(f,e,i);for(var p=0;p<l;p++)f[p+o][p+a]=u(p)}return new n({data:f,size:[s,c]})},n.fromJSON=function(e){return new n(e)},n.prototype.swapRows=function(e,t){if(!R(e)||!Bs(e)||!R(t)||!Bs(t))throw Error(`Row index must be positive integers`);if(this._size.length!==2)throw Error(`Only two dimensional matrix is supported`);return V(e,this._size[0]),V(t,this._size[0]),n._swapRows(e,t,this._data),this},n._swapRows=function(e,t,n){var r=n[e];n[e]=n[t],n[t]=r};function l(e){return Yo(e)?l(e.valueOf()):z(e)?e.map(l):e}return n},{isClass:!0});function nd(e,t,n){return e&&typeof e.map==`function`?e.map(function(e){return nd(e,t,n)}):t(e)}var rd=`isNumeric`,id=[`typed`],ad=jc(rd,id,e=>{var{typed:t}=e;return t(rd,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":t.referToSelf(e=>t=>nd(t,e))})}),od=`hasNumericValue`,sd=[`typed`,`isNumeric`],cd=jc(od,sd,e=>{var{typed:t,isNumeric:n}=e;return t(od,{boolean:()=>!0,string:function(e){return e.trim().length>0&&!isNaN(Number(e))},any:function(e){return n(e)}})}),ld=Pu({config:Rs}),ud=Uu({}),dd=Ju({}),fd=Zu({}),pd=td({Matrix:fd}),md=Jc({BigNumber:ld,Complex:ud,DenseMatrix:pd,Fraction:dd}),hd=ad({typed:md}),gd=cd({isNumeric:hd,typed:md});const _d=e=>{let t=Number(e);return Number.isNaN(t)?!1:t>=120&&t<=36e4},vd=e=>{let t=Number(e),n=Date.now();if(Number.isNaN(t))return n+Bo;if(!_d(t)&&(0,l.isFutureUnixTimestamp)(t))return Vo(t);if(_d(t))return n+t;{let e=t*Ro;return n+e}},yd=`ratelimitlimit`,bd=`ratelimitremaining`,xd=`ratelimitreset`,Sd=`ratelimitconcurrencylimit`,Cd=`ratelimitconcurrencyremaining`,wd=`ratelimitconcurrencyreset`,Td=e=>{let t={};for(let[n,r]of Object.entries(e)){let e=n.toLowerCase().replace(/^x-/,``).replace(/concurren.+-/g,`concurrency-`).replace(/-/g,``),i=gd(r)?Number(r):null;t[e]=i}return t},Ed=e=>{let t=Td(e);return{rateLimitLimit:t[yd],rateLimitRemaining:t[bd],rateLimitReset:vd(t[xd]),concurrencyLimit:t[Sd],concurrencyRemaining:t[Cd],concurrencyReset:vd(t[wd])}},Dd=e=>{let{accountSecureId:t,service:n,resource:r,subResource:i,childResource:a,action:o,behaviours:s}=e??{};return[t,n,r,o].some(l.isMissing)?null:[t,n,r,i,a,o,...s??[]].filter(Boolean).join(`-`)},Od=(e,t=Fo,n=Po)=>{let r=Date.now();return(0,l.isFutureUnixTimestamp)(e)||(0,l.isNumber)(e)?kd(Number(e),r,t,n):Jo(e)&&e!==``?Ad(e,r,t,n):n},kd=(e,t,n=Fo,r=Po)=>{if(e<n)return e;let i=Vo(e);if(i>t){let e=Math.floor((i-t)/Ro);return e>0&&e<n?e:r}return r},Ad=(e,t,n=Fo,r=Po)=>{if(zo.test(e)){let t=parseFloat(e);return t>0&&t<n?t:r}let i=new Date(e);if(Number.isNaN(i.getTime()))return r;let a=i.getTime();if(a>t){let e=Math.floor((a-t)/Ro);return e>0&&e<n?e:r}return r};let jd=function(e){return e.RateLimiterReleaseRequestFailed=`RateLimiterReleaseRequestFailed`,e}({});const Md=({axiosInstance:e,logger:t,requestConfig:n,context:r})=>{let i=async i=>{let{response:a,config:o}=i,s=o?.signal;if(s?.aborted)return Promise.reject(Ao(`Request aborted`,o,`ERR_CANCELED`,a));let{status:c,retryAfter:u}=Nd(a,r,n,t);if(c===429&&(0,l.notMissing)(o)){let n=Od(u);if(o._retryCount>=Io)return t?.warning({category:`http-transport`,message:`Max retries exceeded for ${o?.url}. Aborting.`,context:{...r??{},retryAfterHeader:u,retryAfterAsNumber:n}}),Promise.reject(i);let s=o._retryCount??0,c={...o,_retryCount:s+1},d=u?n*Ro:(0,l.exponentialBackoffInMS)(c._retryCount);return t?.debug({category:`http-transport`,message:`Received 429 error from ${o?.url}`,context:{...r??{},retryAfterHeader:u,calculatedRetryAfter:d}}),await jo(d*1e3,o,a),e?.request(c)}return Promise.reject(i)};return i},Nd=(e,t,n,r)=>{let{provider:i}=t??{},{status:a,headers:o,data:s}=e??{},{retryafter:c}=Td(o??{});if((0,l.isMissing)(i)||(0,l.isMissing)(e))return r?.warning({category:`http-transport`,message:`Invalid parameters for convertError`,context:{...t,responseIsMissing:(0,l.isMissing)(e),providerIsMissing:(0,l.isMissing)(i),status:e?.status??`undefined`,statusText:e?.statusText??`undefined`,retryafter:c??`undefined`}}),{status:a,retryAfter:c};let u=n?.rateLimits?.mappedRateLimitErrors;if((0,l.notMissing)(u)&&(0,l.notMissing)(s))for(let e of u){let{errorStatus:t,errorMessagePath:n,errorMessage:r,retryAfterPath:i,retryAfterUnit:u,retryAfterValue:d}=e;if(t!==a)continue;let f=n??`message`,p=(0,l.isObject)(s)?h.default.query(s,f)[0]:s,m=Pd(p,r);if(t===a&&m){let e=d??Fd(o,i),t=Id(e,u);return{status:429,retryAfter:c??t}}}return{status:a,retryAfter:c}},Pd=(e,t)=>t instanceof RegExp?t.test(e??``):e?.includes(t)??!1,Fd=(e,t)=>(0,l.notMissing)(t)&&(0,l.notMissing)(e)?h.default.query(e,t)[0]:null,Id=(e,t=`seconds`)=>(0,l.notMissing)(e)?Ld(e,t):null,Ld=(e,t)=>{if(t===`seconds`)return typeof e==`string`?parseFloat(e):e;if(t===`milliseconds`){let t=typeof e==`string`?parseFloat(e):e;return t/Ro}if(t===`date`){let t=typeof e==`string`&&!isNaN(Number(e))?parseFloat(e):e,n=new Date(t);if(isNaN(n.getTime()))throw Error(`Invalid date value`);return n.getTime()}throw Error(`Invalid type`)},Rd=`rateLimitErrorInterceptor`,zd=({axiosInstance:e,logger:t,requestConfig:n,context:r})=>{let i=async i=>{let{response:a,config:o}=i,s=o?.signal;if((0,l.isMissing)(r)||(0,l.isMissing)(o))return t?.warning({category:`HttpClient`,message:`No context or config for this response - that doesn't seem right.`,context:{interceptor:Rd,...o,headers:void 0}}),Promise.reject(i);let{requestId:c,targetConcurrencyKey:u,leaseSubscription:d,setRemovalSubscription:f}=o?.requestMetadata??{},p=await Ge.getInstance(),m=(0,l.notMissing)(c)&&(0,l.notMissing)(u)?await p.releaseRequest(c,u):!1;if(!m&&(0,l.notMissing)(o?.requestMetadata)&&t?.error({category:`HttpClient`,message:`Failed to release request from concurrency manager`,context:{...r,interceptor:Rd,requestId:c,targetConcurrencyKey:u,leaseSubscription:d,setRemovalSubscription:f},code:jd.RateLimiterReleaseRequestFailed}),s?.aborted)return Promise.reject(Ao(`Request aborted`,o,`ERR_CANCELED`,a));let{status:h,retryAfter:g}=Nd(a,r,n,t);if(h===429&&(0,l.notMissing)(o)){let n=Od(g);if(o._retryCount>=Io)return t?.warning({category:`HttpClient`,message:`Max retries exceeded for ${o.url}. Aborting.`,context:{...r??{},...o.requestMetadata??{},retryAfterHeader:g,retryAfterAsNumber:n}}),Promise.reject(i);let s=o?._retryCount??0,c={...o,_retryCount:s+1},u=g?n*Ro:(0,l.exponentialBackoffInMS)(c._retryCount);return t?.debug({category:`HttpClient`,message:`Received 429 error from ${o.url}`,context:{...r,retryAfterHeader:g,calculatedRetryAfter:u}}),await jo(u*1e3,o,a),e?.request(c)}return Promise.reject(i)};return i},Bd=`rateLimitResponseInterceptor`,Vd=({logger:e,context:t})=>{let n=async n=>{let r=n?.config,i=r?.signal;if((0,l.isMissing)(t))e?.warning({category:`HttpClient`,message:`No context for this response - that doesn't seem right.`,context:{...r,interceptor:Bd,headers:void 0}});else{let t=n?.headers;if((0,l.notMissing)(t)){let n=Ed(t);e?.debug({category:`HttpClient`,message:`Rate limit headers extracted`,context:{interceptor:Bd,rateLimitHeaders:n}})}let{requestId:a,targetConcurrencyKey:o,leaseSubscription:s,setRemovalSubscription:c}=r?.requestMetadata??{},u=await Ge.getInstance(),d=await u.releaseRequest(a,o);if(d||e?.error({category:`HttpClient`,message:`Failed to release request from concurrency manager`,context:{interceptor:Bd,requestId:a,targetConcurrencyKey:o,leaseSubscription:s,setRemovalSubscription:c},code:jd.RateLimiterReleaseRequestFailed}),i?.aborted)return Promise.reject(Ao(`Request aborted`,r,`ERR_CANCELED`,n))}return n};return n},Hd=e=>(e.validateStatus??=e=>e>=200&&e<300,e),Ud=[{onFulfilled:Hd,onRejected:null,options:void 0}],Wd=[{onFulfilled:null,onRejected:Md},{onFulfilled:null,onRejected:_o}],Gd=[{onFulfilled:Hd,onRejected:null,options:void 0},{onFulfilled:No,onRejected:null,options:void 0}],Kd=[{onFulfilled:Vd,onRejected:zd},{onFulfilled:null,onRejected:_o}];let qd=function(e){return e.HttpTransportInstanceCreateError=`HttpTransportInstanceCreateError`,e}({});const Jd=async({logger:e,redisClientConfig:t,context:n}={})=>{let r,{NODE_ENV:i}=process.env,a=n?.behaviours??[`CONCURRENCY`,`RETRY`];try{if(r=a.includes(`RETRY`)?Xd(e,n):Yd(e,n),(0,l.isMissing)(n?.service)||(0,l.isMissing)(n?.organizationId)||i===`test`||(0,l.isMissing)(t)||(0,l.isMissing)(e))return r;await ko.getInstance(t,e);let o=await ko.isReady(),s=await Ge.getInstance(t,e),c=await s.isRedisConfigured(),u=[],d=[];if(a.includes(`CONCURRENCY`)){if(!c)throw Error(`Concurrency Manager cannot connect to Redis. Cannot create advanced transport instance.`);if(!o)throw Error(`RateLimitManager is not ready. Cannot create advanced transport instance.`);u.push(...Gd),d.push(...Kd)}let f=Dd(n);if((0,l.isMissing)(f))return e?.warning({category:`http-transport`,message:`Unable to create a key for transport instance - Invalid state. Using base default instance.`,context:{...n,defaultInstanceInitialized:(0,l.notMissing)(r)}}),r;let p=await go.get(f);if((0,l.notMissing)(p))return p;let m={interceptors:{requestConfigs:u,responseConfigs:d},instanceConfig:{maxBodyLength:1/0},logger:e,context:n},h=po.createInstance(m);return e?.debug({category:`http-transport`,message:`Creating new Axios instance and caching it for key: [${f}]`,context:{...n}}),await go.set(f,h),h}catch(t){return e?.error({category:`http-transport`,message:`Failed to create advanced transport instance. Using default instance.`,context:{...n,usingDefaultInstance:(0,l.notMissing)(r)},error:t,code:qd.HttpTransportInstanceCreateError}),(0,l.notMissing)(r)?r:Zd()}},Yd=(e,t)=>{let n={instanceConfig:{maxBodyLength:1/0},logger:e,context:t};return po.createInstance(n)??Zd()},Xd=(e,t)=>{let n={interceptors:{requestConfigs:Ud,responseConfigs:Wd},instanceConfig:{maxBodyLength:1/0},logger:e,context:t};return po.createInstance(n)??Zd()},Zd=()=>{let e=d.default.create({maxBodyLength:1/0});return e};var Qd=o((exports,t)=>{t.exports=n;function n(e={}){let{ERR_PATHS_MUST_BE_STRINGS:t=()=>`fast-redact - Paths must be (non-empty) strings`,ERR_INVALID_PATH:n=e=>`fast-redact – Invalid path (${e})`}=e;return function({paths:e}){e.forEach(e=>{if(typeof e!=`string`)throw Error(t());try{if(/〇/.test(e))throw Error();let t=(e[0]===`[`?``:`.`)+e.replace(/^\*/,`〇`).replace(/\.\*/g,`.〇`).replace(/\[\*\]/g,`[〇]`);if(/\n|\r|;/.test(t)||/\/\*/.test(t))throw Error();Function(`
215
215
  'use strict'
216
216
  const o = new Proxy({}, { get: () => o, set: () => { throw Error() } });
217
217
  const 〇 = null;
@@ -290,4 +290,4 @@ var $c=9e15,el=1e9,tl=`0123456789abcdef`,nl=`2.302585092994045684017991454684364
290
290
  ${r}
291
291
  ${e}
292
292
  return o
293
- `}}),af=o((exports,t)=>{t.exports=n;function n(e){let{secret:t,censor:n,compileRestore:r,serialize:i,groupRedact:a,nestedRedact:o,wildcards:s,wcLen:c}=e,l=[{secret:t,censor:n,compileRestore:r}];return i!==!1&&l.push({serialize:i}),c>0&&l.push({groupRedact:a,nestedRedact:o,wildcards:s,wcLen:c}),Object.assign(...l)}}),sf=o((exports,t)=>{let n=Qd(),r=ef(),i=tf(),a=rf(),{groupRedact:o,nestedRedact:s}=nf(),c=af(),l=$d(),u=n(),d=e=>e;d.restore=d;let f=`[REDACTED]`;p.rx=l,p.validator=n,t.exports=p;function p(e={}){let t=Array.from(new Set(e.paths||[])),n=`serialize`in e&&(e.serialize===!1||typeof e.serialize==`function`)?e.serialize:JSON.stringify,l=e.remove;if(l===!0&&n!==JSON.stringify)throw Error(`fast-redact – remove option may only be set when serializer is JSON.stringify`);let p=l===!0?void 0:`censor`in e?e.censor:f,m=typeof p==`function`,h=m&&p.length>1;if(t.length===0)return n||d;u({paths:t,serialize:n,censor:p});let{wildcards:g,wcLen:_,secret:v}=r({paths:t,censor:p}),y=a(),b=`strict`in e?e.strict:!0;return i({secret:v,wcLen:_,serialize:n,strict:b,isCensorFct:m,censorFctTakesPath:h},c({secret:v,censor:p,compileRestore:y,serialize:n,groupRedact:o,nestedRedact:s,wildcards:g,wcLen:_}))}}),cf=c(sf(),1);const lf=[`client_secret`,`access_token`,`refresh_token`,`api_key`,`password`,`job_board_token`,`private_key`,`certificate`,`service_user_token`,`key_id`,`secret_key`,`provhash`,`admin_key`,`session_key`,`id_token`,`authorization`,`bh_rest_token`,`external_trigger_token`,`tempauth`],uf=[`req.headers.authorization`,`req.headers.cookie`,`req.headers.cookies`,`req.headers["set-cookie"]`,`req.headers["set-cookies"]`,`req.headers.httpsAgent.options.cert`,`req.headers.httpsAgent.options.key`,`req.headers["x-stackone-external-trigger-token"]`,`error.config.headers.authorization`,`error.config.data`,`error.config.headers.cookie`,`error.config.headers.cookies`,`error.config.headers["set-cookie"]`,`error.config.headers["set-cookies"]`,`error.config.httpsAgent.options.cert`,`error.config.httpsAgent.options.key`,`err.config.headers.authorization`,`err.config.data`,`err.config.headers.cookie`,`err.config.headers.cookies`,`err.config.headers["set-cookie"]`,`err.config.headers["set-cookies"]`,`err.config.httpsAgent.options.cert`,`err.config.httpsAgent.options.key`,`res.headers.authorization`,`res.headers.cookie`,`res.headers.cookies`,`res.headers["set-cookie"]`,`res.headers["set-cookies"]`,`res.headers.httpsAgent.options.cert`,`res.headers.httpsAgent.options.key`,`context.credentials`,...lf],df=`**redacted**`;let ff=function(e){return e.FULL=`FULL`,e.PARTIAL=`PARTIAL`,e}({});const pf=e=>df,mf=e=>typeof e==`string`?e.startsWith(df)?e:e.length<10?df:`${df}${e.slice(-5)}`:df,hf=(e=[],t=!0)=>{if(!t)return[];let n=e.map(e=>_f(e));return[...e,...n]},gf=(e=[],t=!0)=>{if(!t)return[];let n=new Set;return e.forEach(e=>{if(n.add(e),e.includes(`_`)){let t=e.replace(/_([a-z])/g,(e,t)=>t.toUpperCase());n.add(t)}else{let t=e.replace(/([A-Z])/g,`_$1`).toLowerCase();n.add(t)}}),Array.from(n)},_f=e=>{let t=yf(e);return t||vf(e)},vf=e=>{let t=e.split(`.`);if(t.length<2)return bf(e);let n=t.pop()??``,r=bf(n);return[...t,r].join(`.`)},yf=e=>{let t=e.lastIndexOf(`[`),n=e.indexOf(`]`,t);if(t===-1||n===-1)return;let r=e.slice(t,n+1),i=r.replace(/(["'])([^"']*)(["'])/g,(e,t,n)=>n?t+bf(n)+t:t+t);return`${e.slice(0,t)}${i}${e.slice(n+1)}`},bf=e=>`${e.charAt(0).toUpperCase()}${e.slice(1)}`,xf=hf(uf),Sf=gf(lf),Cf={[ff.FULL]:pf,[ff.PARTIAL]:mf},wf={[ff.FULL]:(0,cf.default)({paths:xf,serialize:!1,censor:Cf[ff.FULL]}),[ff.PARTIAL]:(0,cf.default)({paths:xf,serialize:!1,censor:Cf[ff.PARTIAL]})},Tf=(e,t=ff.FULL)=>(0,l.isMissing)(e)||typeof e!=`object`||!e?e:wf[t]((0,l.deepCopy)(e)),Ef=(e,t=ff.FULL,n)=>{if(!(0,l.isMissing)(e))try{let n=new URL(e),r=[...n.searchParams].reduce((e,[n,r])=>{let i=n.toLowerCase();return e.set(n,Sf.some(e=>e.toLowerCase()===i)?Cf[t](r):r),e},new URLSearchParams);return`${n.origin}${n.pathname}${r.toString()?`?`+r:``}${n.hash}`}catch(t){return n?.warning({message:`Invalid URL provided, unable to redact`,context:{value:e,error:t},category:`redactUrl`}),e}},Df=(e,t=ff.FULL,n)=>{if(!(0,l.isMissing)(e))try{let[n,r]=e.split(`?`);if(!r)return e;let i=[...new URLSearchParams(r)].reduce((e,[n,r])=>{let i=n.toLowerCase();return e.set(n,Sf.some(e=>e.toLowerCase()===i)?Cf[t](r):r),e},new URLSearchParams);return`${n}?${i}`}catch(t){return n?.warning({message:`Invalid path provided, unable to redact`,context:{value:e,error:t},category:`redactPath`}),e}},Of=(e,t=ff.FULL)=>{if(!(0,l.isMissing)(e))return typeof e==`string`?Cf[t](e):Object.entries(e).reduce((e,[n,r])=>(e[n]=Sf.some(e=>e.toLowerCase()===n.toLowerCase())?Cf[t](r):r,e),{})};var kf=class e{#transportFactory;#getRedisClient;#logger;#redisClientConfig;#errorMappingFn;#redisClient;constructor({transportFactory:e=Jd,getRedisClient:t=ce,logger:n,redisClientConfig:r,errorMappingFn:i}={}){this.#transportFactory=e,this.#getRedisClient=t,this.#logger=n,this.#redisClientConfig=r,this.#errorMappingFn=i}#generateCacheKey({url:e,payload:t,method:n,context:r}){let i=20;if(!r?.accountSecureId||r.accountSecureId.length<i||!e||!n)return null;let a=t?(0,l.getContentHash)(t):``;return`${r.accountSecureId}-${n.toUpperCase()}${a}-${e}`}async#getCachedResponse({url:t,payload:n,method:r,cacheTTL:i,context:a}){if(!this.#redisClient||!i||i<=0)return null;let o=this.#generateCacheKey({url:t,payload:n,method:r,context:a});if(!o)return null;let s=await this.#redisClient.getData(o);return s?(this.#logger?.debug({category:e.name,message:`Cache hit for key [${o}].`}),s):(this.#logger?.debug({category:e.name,message:`Cache miss for key [${o}].`}),null)}async#cacheResponse({url:t,payload:n,method:r,cacheTTL:i,context:a,response:o}){if(!this.#redisClient||!i||i<=0)return!1;let s=this.#generateCacheKey({url:t,payload:n,method:r,context:a});return s?(this.#logger?.debug({category:e.name,message:`Caching result for key [${s}].`}),this.#redisClient.setData({key:s,value:o,cacheTTL:i*60})):!1}async request({headers:t={},url:n,method:r=`get`,maxRedirects:i=0,responseType:a,cacheTTL:o,context:s,traceId:c,payload:u,httpsAgent:d,httpAgent:f}){try{(0,l.notMissing)(this.#redisClientConfig)&&(0,l.isMissing)(this.#redisClient)&&(this.#redisClient=await this.#getRedisClient(this.#redisClientConfig,this.#logger));let e=this.#normalizeHeaders(t),p=await this.#getCachedResponse({url:n,payload:u,method:r,cacheTTL:o,context:s});if(p)return{...p,responseTime:new Date};let m=ho.getInstance(),h=(0,l.notMissing)(c)?await m.get(c):null,g=h?.signal,_=await this.#transportFactory({redisClientConfig:this.#redisClientConfig,logger:this.#logger,context:s}),v=await _.request({headers:e,url:n,method:r,maxRedirects:i,responseType:a,data:this.#getSafePayload(u,e),httpsAgent:d,httpAgent:f,signal:g}),y={data:v.data,status:v.status,body:u,method:r,headers:this.#extractAxiosHeaders(v.headers),requestUrl:n,responseType:v?.config?.responseType,responseTime:new Date};return await this.#cacheResponse({url:n,payload:u,method:r,cacheTTL:o,context:s,response:y}),y}catch(t){let i=t;i.url=Ef(n),this.#logger?.warning({category:e.name,message:`Request error [${r?.toUpperCase()} ${i.url}]: ${i.message}.`,error:i});let a=this.#mapErrorToHttpException(i);throw(0,l.notMissing)(a)?a:t}}async get({headers:e,url:t,maxRedirects:n,cacheTTL:r,context:i,traceId:a}){return this.request({url:t,method:`get`,headers:e,maxRedirects:n,cacheTTL:r,context:i,traceId:a})}async post({headers:e,url:t,maxRedirects:n,cacheTTL:r,context:i,traceId:a,payload:o}){return this.request({url:t,method:`post`,headers:e,maxRedirects:n,cacheTTL:r,context:i,traceId:a,payload:o})}#normalizeHeaders(e){if(!e)return{};let t={};return Object.keys(e).forEach(n=>{t[n.toLowerCase()]=e[n]||``}),t}#extractAxiosHeaders(e){if(!e)return{};let t={};return Object.keys(e).forEach(n=>{t[n]=e[n]||``}),t}#isFormUrlEncoded(e){return e[`content-type`]===`application/x-www-form-urlencoded`}#getSafePayload(e,t){if(e)return this.#isFormUrlEncoded(t)?g.default.stringify(e):e}#mapErrorToHttpException(e){if((0,d.isAxiosError)(e)&&this.#errorMappingFn)return this.#errorMappingFn(e)}};const Af=(e,t,n)=>new kf({redisClientConfig:e,logger:t,errorMappingFn:n});var jf=class{static httpClientInstance=null;static async getInstance({getHttpClient:e=Af,redisClientConfig:t,logger:n,errorMappingFn:r}){return this.httpClientInstance??=e(t,n,r),this.httpClientInstance}static resetInstance(){this.httpClientInstance=null}};const Mf=[`get`,`post`,`put`,`delete`,`patch`],Nf=e=>e.reduce((e,t)=>(Array.isArray(e[t.in][t.name])?e[t.in][t.name]=e[t.in][t.name].concat(t.value):typeof e[t.in][t.name]==`object`&&typeof t.value==`object`?e[t.in][t.name]={...e[t.in][t.name],...t.value}:e[t.in][t.name]=t.in===`body`?t.value:String(t.value),e),{query:{},body:{},headers:{}}),Pf=[`query`,`body`,`headers`],Ff=(e,t)=>{if((0,l.isMissing)(t)||t?.length===0||(0,l.isMissing)(e))return{data:e.data,status:e.status,headers:e.headers,requestUrl:e.requestUrl,responseType:e.responseType,responseTime:e.responseTime,message:e.message};let n=t?.filter(t=>t.receivedStatus===e.status);if(n?.length)for(let t of n){let n=t.condition,r=(0,_.safeEvaluate)(n,e)===!0;if((0,l.isMissing)(n)||r)return{data:e.data,headers:e.headers,requestUrl:e.requestUrl,responseType:e.responseType,responseTime:e.responseTime,status:t.targetStatus,message:t?.message??uo[t.targetStatus]??`Unknown error`}}return e},If=e=>(0,l.notMissing)(e)&&e>=200&&e<=299,Lf=e=>(0,l.notMissing)(e)&&e>=400&&e<=599,Rf=e=>(0,l.notMissing)(e)&&e>=100&&e<=199;var zf=class{async performRequest({httpClient:e,url:t,method:n,headers:r,body:i,customErrorConfigs:a}){let o;try{o=await e?.request({method:n,url:t,headers:r,maxRedirects:0,payload:i})}catch(e){if((0,l.isMissing)(e?.response))throw e;o=e.response}let s=Ff(o,a);if(Lf(s?.status))throw new fo(s,s.message);return s}},Bf=class{static build(e=`rest`){if(e===`rest`)return new zf;throw Error(`Unknown request client type: ${e}`)}};exports.CUSTOM_ERROR_CONFIG_SCHEMA=lo,exports.ConcurrencyManager=Ge,exports.EventClient=se,exports.HttpClient=kf,exports.HttpClientManager=jf,exports.HttpErrorMessages=uo,exports.HttpMethods=Mf,exports.HttpResponseError=fo,exports.HttpTransportFactory=po,exports.InstanceManager=ho,exports.LockManager=x,exports.MemoryStore=O,exports.QueueManager=Te,exports.RateLimitManager=ko,exports.RedisClient=le,exports.RequestClientFactory=Bf,exports.RequestParameterLocations=Pf,exports.ScriptManager=pe,exports.SubscriptionManager=me,exports.createAuthorizationHeaders=v,exports.getTransportInstance=Jd,exports.isFailedStatusCode=Lf,exports.isInfoStatusCode=Rf,exports.isSuccessStatusCode=If,exports.parseRequestParameters=Nf;
293
+ `}}),af=o((exports,t)=>{t.exports=n;function n(e){let{secret:t,censor:n,compileRestore:r,serialize:i,groupRedact:a,nestedRedact:o,wildcards:s,wcLen:c}=e,l=[{secret:t,censor:n,compileRestore:r}];return i!==!1&&l.push({serialize:i}),c>0&&l.push({groupRedact:a,nestedRedact:o,wildcards:s,wcLen:c}),Object.assign(...l)}}),sf=o((exports,t)=>{let n=Qd(),r=ef(),i=tf(),a=rf(),{groupRedact:o,nestedRedact:s}=nf(),c=af(),l=$d(),u=n(),d=e=>e;d.restore=d;let f=`[REDACTED]`;p.rx=l,p.validator=n,t.exports=p;function p(e={}){let t=Array.from(new Set(e.paths||[])),n=`serialize`in e&&(e.serialize===!1||typeof e.serialize==`function`)?e.serialize:JSON.stringify,l=e.remove;if(l===!0&&n!==JSON.stringify)throw Error(`fast-redact – remove option may only be set when serializer is JSON.stringify`);let p=l===!0?void 0:`censor`in e?e.censor:f,m=typeof p==`function`,h=m&&p.length>1;if(t.length===0)return n||d;u({paths:t,serialize:n,censor:p});let{wildcards:g,wcLen:_,secret:v}=r({paths:t,censor:p}),y=a(),b=`strict`in e?e.strict:!0;return i({secret:v,wcLen:_,serialize:n,strict:b,isCensorFct:m,censorFctTakesPath:h},c({secret:v,censor:p,compileRestore:y,serialize:n,groupRedact:o,nestedRedact:s,wildcards:g,wcLen:_}))}}),cf=c(sf(),1);const lf=[`client_secret`,`access_token`,`refresh_token`,`api_key`,`password`,`job_board_token`,`private_key`,`certificate`,`service_user_token`,`key_id`,`secret_key`,`provhash`,`admin_key`,`session_key`,`id_token`,`authorization`,`bh_rest_token`,`external_trigger_token`,`tempauth`],uf=[`req.headers.authorization`,`req.headers.cookie`,`req.headers.cookies`,`req.headers["set-cookie"]`,`req.headers["set-cookies"]`,`req.headers.httpsAgent.options.cert`,`req.headers.httpsAgent.options.key`,`req.headers["x-stackone-external-trigger-token"]`,`error.config.headers.authorization`,`error.config.data`,`error.config.headers.cookie`,`error.config.headers.cookies`,`error.config.headers["set-cookie"]`,`error.config.headers["set-cookies"]`,`error.config.httpsAgent.options.cert`,`error.config.httpsAgent.options.key`,`err.config.headers.authorization`,`err.config.data`,`err.config.headers.cookie`,`err.config.headers.cookies`,`err.config.headers["set-cookie"]`,`err.config.headers["set-cookies"]`,`err.config.httpsAgent.options.cert`,`err.config.httpsAgent.options.key`,`res.headers.authorization`,`res.headers.cookie`,`res.headers.cookies`,`res.headers["set-cookie"]`,`res.headers["set-cookies"]`,`res.headers.httpsAgent.options.cert`,`res.headers.httpsAgent.options.key`,`context.credentials`,...lf],df=`**redacted**`;let ff=function(e){return e.FULL=`FULL`,e.PARTIAL=`PARTIAL`,e}({});const pf=e=>df,mf=e=>typeof e==`string`?e.startsWith(df)?e:e.length<10?df:`${df}${e.slice(-5)}`:df,hf=(e=[],t=!0)=>{if(!t)return[];let n=e.map(e=>_f(e));return[...e,...n]},gf=(e=[],t=!0)=>{if(!t)return[];let n=new Set;return e.forEach(e=>{if(n.add(e),e.includes(`_`)){let t=e.replace(/_([a-z])/g,(e,t)=>t.toUpperCase());n.add(t)}else{let t=e.replace(/([A-Z])/g,`_$1`).toLowerCase();n.add(t)}}),Array.from(n)},_f=e=>{let t=yf(e);return t||vf(e)},vf=e=>{let t=e.split(`.`);if(t.length<2)return bf(e);let n=t.pop()??``,r=bf(n);return[...t,r].join(`.`)},yf=e=>{let t=e.lastIndexOf(`[`),n=e.indexOf(`]`,t);if(t===-1||n===-1)return;let r=e.slice(t,n+1),i=r.replace(/(["'])([^"']*)(["'])/g,(e,t,n)=>n?t+bf(n)+t:t+t);return`${e.slice(0,t)}${i}${e.slice(n+1)}`},bf=e=>`${e.charAt(0).toUpperCase()}${e.slice(1)}`,xf=hf(uf),Sf=gf(lf),Cf={[ff.FULL]:pf,[ff.PARTIAL]:mf},wf={[ff.FULL]:(0,cf.default)({paths:xf,serialize:!1,censor:Cf[ff.FULL]}),[ff.PARTIAL]:(0,cf.default)({paths:xf,serialize:!1,censor:Cf[ff.PARTIAL]})},Tf=(e,t=ff.FULL)=>(0,l.isMissing)(e)||typeof e!=`object`||!e?e:wf[t]((0,l.deepCopy)(e)),Ef=(e,t=ff.FULL,n)=>{if(!(0,l.isMissing)(e))try{let n=new URL(e),r=[...n.searchParams].reduce((e,[n,r])=>{let i=n.toLowerCase();return e.set(n,Sf.some(e=>e.toLowerCase()===i)?Cf[t](r):r),e},new URLSearchParams);return`${n.origin}${n.pathname}${r.toString()?`?`+r:``}${n.hash}`}catch(t){return n?.warning({message:`Invalid URL provided, unable to redact`,context:{value:e,error:t},category:`redactUrl`}),e}},Df=(e,t=ff.FULL,n)=>{if(!(0,l.isMissing)(e))try{let[n,r]=e.split(`?`);if(!r)return e;let i=[...new URLSearchParams(r)].reduce((e,[n,r])=>{let i=n.toLowerCase();return e.set(n,Sf.some(e=>e.toLowerCase()===i)?Cf[t](r):r),e},new URLSearchParams);return`${n}?${i}`}catch(t){return n?.warning({message:`Invalid path provided, unable to redact`,context:{value:e,error:t},category:`redactPath`}),e}},Of=(e,t=ff.FULL)=>{if(!(0,l.isMissing)(e))return typeof e==`string`?Cf[t](e):Object.entries(e).reduce((e,[n,r])=>(e[n]=Sf.some(e=>e.toLowerCase()===n.toLowerCase())?Cf[t](r):r,e),{})};var kf=class e{#transportFactory;#getRedisClient;#logger;#redisClientConfig;#errorMappingFn;#redisClient;constructor({transportFactory:e=Jd,getRedisClient:t=ce,logger:n,redisClientConfig:r,errorMappingFn:i}={}){this.#transportFactory=e,this.#getRedisClient=t,this.#logger=n,this.#redisClientConfig=r,this.#errorMappingFn=i}#generateCacheKey({url:e,payload:t,method:n,context:r}){let i=20;if(!r?.accountSecureId||r.accountSecureId.length<i||!e||!n)return null;let a=t?(0,l.getContentHash)(t):``;return`${r.accountSecureId}-${n.toUpperCase()}${a}-${e}`}async#getCachedResponse({url:t,payload:n,method:r,cacheTTL:i,context:a}){if(!this.#redisClient||!i||i<=0)return null;let o=this.#generateCacheKey({url:t,payload:n,method:r,context:a});if(!o)return null;let s=await this.#redisClient.getData(o);return s?(this.#logger?.debug({category:e.name,message:`Cache hit for key [${o}].`}),s):(this.#logger?.debug({category:e.name,message:`Cache miss for key [${o}].`}),null)}async#cacheResponse({url:t,payload:n,method:r,cacheTTL:i,context:a,response:o}){if(!this.#redisClient||!i||i<=0)return!1;let s=this.#generateCacheKey({url:t,payload:n,method:r,context:a});return s?(this.#logger?.debug({category:e.name,message:`Caching result for key [${s}].`}),this.#redisClient.setData({key:s,value:o,cacheTTL:i*60})):!1}async request({headers:t={},url:n,method:r=`get`,maxRedirects:i=0,responseType:a,cacheTTL:o,context:s,traceId:c,payload:u,httpsAgent:d,httpAgent:f}){try{(0,l.notMissing)(this.#redisClientConfig)&&(0,l.isMissing)(this.#redisClient)&&(this.#redisClient=await this.#getRedisClient(this.#redisClientConfig,this.#logger));let e=this.#normalizeHeaders(t),p=await this.#getCachedResponse({url:n,payload:u,method:r,cacheTTL:o,context:s});if(p)return{...p,responseTime:new Date};let m=ho.getInstance(),h=(0,l.notMissing)(c)?await m.get(c):null,g=h?.signal,_=await this.#transportFactory({redisClientConfig:this.#redisClientConfig,logger:this.#logger,context:s}),v=await _.request({headers:e,url:n,method:r,maxRedirects:i,responseType:a,data:this.#getSafePayload(u,e),httpsAgent:d,httpAgent:f,signal:g}),y={data:v.data,status:v.status,body:u,method:r,headers:this.#extractAxiosHeaders(v.headers),requestUrl:n,responseType:v?.config?.responseType,responseTime:new Date};return await this.#cacheResponse({url:n,payload:u,method:r,cacheTTL:o,context:s,response:y}),y}catch(t){let i=t;i.url=Ef(n),this.#logger?.warning({category:e.name,message:`Request error [${r?.toUpperCase()} ${i.url}]: ${i.message}.`,error:i});let a=this.#mapErrorToHttpException(i);throw(0,l.notMissing)(a)?a:t}}async get({headers:e,url:t,maxRedirects:n,cacheTTL:r,context:i,traceId:a}){return this.request({url:t,method:`get`,headers:e,maxRedirects:n,cacheTTL:r,context:i,traceId:a})}async post({headers:e,url:t,maxRedirects:n,cacheTTL:r,context:i,traceId:a,payload:o}){return this.request({url:t,method:`post`,headers:e,maxRedirects:n,cacheTTL:r,context:i,traceId:a,payload:o})}#normalizeHeaders(e){if(!e)return{};let t={};return Object.keys(e).forEach(n=>{t[n.toLowerCase()]=e[n]||``}),t}#extractAxiosHeaders(e){if(!e)return{};let t={};return Object.keys(e).forEach(n=>{t[n]=e[n]||``}),t}#isFormUrlEncoded(e){return e[`content-type`]===`application/x-www-form-urlencoded`}#getSafePayload(e,t){if(e)return this.#isFormUrlEncoded(t)?g.default.stringify(e):e}#mapErrorToHttpException(e){if((0,d.isAxiosError)(e)&&this.#errorMappingFn)return this.#errorMappingFn(e)}};const Af=(e,t,n)=>new kf({redisClientConfig:e,logger:t,errorMappingFn:n});var jf=class{static httpClientInstance=null;static async getInstance({getHttpClient:e=Af,redisClientConfig:t,logger:n,errorMappingFn:r}){return this.httpClientInstance??=e(t,n,r),this.httpClientInstance}static resetInstance(){this.httpClientInstance=null}};const Mf=[`get`,`post`,`put`,`delete`,`patch`],Nf=e=>e.reduce((e,t)=>(Array.isArray(e[t.in][t.name])?e[t.in][t.name]=e[t.in][t.name].concat(t.value):typeof e[t.in][t.name]==`object`&&typeof t.value==`object`?e[t.in][t.name]={...e[t.in][t.name],...t.value}:e[t.in][t.name]=t.in===`body`?t.value:String(t.value),e),{query:{},body:{},headers:{}}),Pf=[`query`,`body`,`headers`],Ff=(e,t)=>{if((0,l.isMissing)(t)||t?.length===0||(0,l.isMissing)(e))return{data:e.data,status:e.status,headers:e.headers,requestUrl:e.requestUrl,responseType:e.responseType,responseTime:e.responseTime,message:e.message};let n=t?.filter(t=>t.receivedStatus===e.status);if(n?.length)for(let t of n){let n=t.condition,r=(0,_.safeEvaluate)(n,e)===!0;if((0,l.isMissing)(n)||r)return{data:e.data,headers:e.headers,requestUrl:e.requestUrl,responseType:e.responseType,responseTime:e.responseTime,status:t.targetStatus,message:t?.message??uo[t.targetStatus]??`Unknown error`}}return e},If=e=>(0,l.notMissing)(e)&&e>=200&&e<=299,Lf=e=>(0,l.notMissing)(e)&&e>=400&&e<=599,Rf=e=>(0,l.notMissing)(e)&&e>=100&&e<=199;var zf=class{async performRequest({httpClient:e,url:t,method:n,headers:r,body:i,customErrorConfigs:a}){let o;try{o=await e?.request({method:n,url:t,headers:r,maxRedirects:0,payload:i})}catch(e){if((0,l.isMissing)(e?.response))throw e;o=e.response}let s=Ff(o,a);if(Lf(s?.status))throw new fo(s,s.message);return s}},Bf=class{static build(e=`rest`){if(e===`rest`)return new zf;throw Error(`Unknown request client type: ${e}`)}};exports.CUSTOM_ERROR_CONFIG_SCHEMA=lo,exports.ConcurrencyManager=Ge,exports.EventClient=se,exports.HttpClient=kf,exports.HttpClientManager=jf,exports.HttpErrorMessages=uo,exports.HttpMethods=Mf,exports.HttpResponseError=fo,exports.HttpTransportFactory=po,exports.InstanceManager=ho,exports.LockManager=x,exports.MemoryStore=O,exports.QueueManager=Te,exports.RateLimitManager=ko,exports.RedisClient=le,exports.RequestClientFactory=Bf,exports.RequestParameterLocations=Pf,exports.ScriptManager=pe,exports.SubscriptionManager=me,exports.buildHttpClientInstance=Af,exports.createAuthorizationHeaders=v,exports.getTransportInstance=Jd,exports.isFailedStatusCode=Lf,exports.isInfoStatusCode=Rf,exports.isSuccessStatusCode=If,exports.parseRequestParameters=Nf;
package/dist/index.mjs CHANGED
@@ -211,7 +211,7 @@ var ul=9e15,dl=1e9,fl=`0123456789abcdef`,pl=`2.302585092994045684017991454684364
211
211
  * Copyright (c) 2023, Robert Eisele (robert@raw.org)
212
212
  * Dual licensed under the MIT or GPL Version 2 licenses.
213
213
  **/
214
- (function(n){"use strict";var r=2e3,i={s:1,n:0,d:1};function a(e,t){if(isNaN(e=parseInt(e,10)))throw h();return e*t}function o(e,t){if(t===0)throw m();var n=Object.create(p.prototype);n.s=e<0?-1:1,e=e<0?-e:e;var r=f(e,t);return n.n=e/r,n.d=t/r,n}function s(e){for(var t={},n=e,r=2,i=4;i<=n;){for(;n%r===0;)n/=r,t[r]=(t[r]||0)+1;i+=1+2*r++}return n===e?t[e]=(t[e]||0)+1:n>1&&(t[n]=(t[n]||0)+1),t}var c=function(e,t){var n=0,r=1,o=1,s=0,c=0,l=0,u=1,d=1,f=0,p=1,_=1,v=1,y=1e7,b;if(e!=null)if(t!==void 0){if(n=e,r=t,o=n*r,n%1!=0||r%1!=0)throw g()}else switch(typeof e){case`object`:if(`d`in e&&`n`in e)n=e.n,r=e.d,`s`in e&&(n*=e.s);else if(0 in e)n=e[0],1 in e&&(r=e[1]);else throw h();o=n*r;break;case`number`:if(e<0&&(o=e,e=-e),e%1==0)n=e;else if(e>0){for(e>=1&&(d=10**Math.floor(1+Math.log(e)/Math.LN10),e/=d);p<=y&&v<=y;)if(b=(f+_)/(p+v),e===b){p+v<=y?(n=f+_,r=p+v):v>p?(n=_,r=v):(n=f,r=p);break}else e>b?(f+=_,p+=v):(_+=f,v+=p),p>y?(n=_,r=v):(n=f,r=p);n*=d}else (isNaN(e)||isNaN(t))&&(r=n=NaN);break;case`string`:if(p=e.match(/\d+|./g),p===null)throw h();if(p[f]===`-`?(o=-1,f++):p[f]===`+`&&f++,p.length===f+1?c=a(p[f++],o):p[f+1]===`.`||p[f]===`.`?(p[f]!==`.`&&(s=a(p[f++],o)),f++,(f+1===p.length||p[f+1]===`(`&&p[f+3]===`)`||p[f+1]===`'`&&p[f+3]===`'`)&&(c=a(p[f],o),u=10**p[f].length,f++),(p[f]===`(`&&p[f+2]===`)`||p[f]===`'`&&p[f+2]===`'`)&&(l=a(p[f+1],o),d=10**p[f+1].length-1,f+=3)):p[f+1]===`/`||p[f+1]===`:`?(c=a(p[f],o),u=a(p[f+2],1),f+=3):p[f+3]===`/`&&p[f+1]===` `&&(s=a(p[f],o),c=a(p[f+2],o),u=a(p[f+4],1),f+=5),p.length<=f){r=u*d,o=n=l+r*s+d*c;break}default:throw h()}if(r===0)throw m();i.s=o<0?-1:1,i.n=Math.abs(n),i.d=Math.abs(r)};function l(e,t,n){for(var r=1;t>0;e=e*e%n,t>>=1)t&1&&(r=r*e%n);return r}function u(e,t){for(;t%2==0;t/=2);for(;t%5==0;t/=5);if(t===1)return 0;for(var n=10%t,i=1;n!==1;i++)if(n=n*10%t,i>r)return 0;return i}function d(e,t,n){for(var r=1,i=l(10,n,t),a=0;a<300;a++){if(r===i)return a;r=r*10%t,i=i*10%t}return 0}function f(e,t){if(!e)return t;if(!t)return e;for(;;){if(e%=t,!e)return t;if(t%=e,!t)return e}}function p(e,t){if(c(e,t),this instanceof p)e=f(i.d,i.n),this.s=i.s,this.n=i.n/e,this.d=i.d/e;else return o(i.s*i.n,i.d)}var m=function(){return Error(`Division by Zero`)},h=function(){return Error(`Invalid argument`)},g=function(){return Error(`Parameters must be integer`)};p.prototype={s:1,n:0,d:1,abs:function(){return o(this.n,this.d)},neg:function(){return o(-this.s*this.n,this.d)},add:function(e,t){return c(e,t),o(this.s*this.n*i.d+i.s*this.d*i.n,this.d*i.d)},sub:function(e,t){return c(e,t),o(this.s*this.n*i.d-i.s*this.d*i.n,this.d*i.d)},mul:function(e,t){return c(e,t),o(this.s*i.s*this.n*i.n,this.d*i.d)},div:function(e,t){return c(e,t),o(this.s*i.s*this.n*i.d,this.d*i.n)},clone:function(){return o(this.s*this.n,this.d)},mod:function(e,t){if(isNaN(this.n)||isNaN(this.d))return new p(NaN);if(e===void 0)return o(this.s*this.n%this.d,1);if(c(e,t),i.n===0&&this.d===0)throw m();return o(this.s*(i.d*this.n)%(i.n*this.d),i.d*this.d)},gcd:function(e,t){return c(e,t),o(f(i.n,this.n)*f(i.d,this.d),i.d*this.d)},lcm:function(e,t){return c(e,t),i.n===0&&this.n===0?o(0,1):o(i.n*this.n,f(i.n,this.n)*f(i.d,this.d))},ceil:function(e){return e=10**(e||0),isNaN(this.n)||isNaN(this.d)?new p(NaN):o(Math.ceil(e*this.s*this.n/this.d),e)},floor:function(e){return e=10**(e||0),isNaN(this.n)||isNaN(this.d)?new p(NaN):o(Math.floor(e*this.s*this.n/this.d),e)},round:function(e){return e=10**(e||0),isNaN(this.n)||isNaN(this.d)?new p(NaN):o(Math.round(e*this.s*this.n/this.d),e)},inverse:function(){return o(this.s*this.d,this.n)},pow:function(e,t){if(c(e,t),i.d===1)return i.s<0?o((this.s*this.d)**+i.n,this.n**+i.n):o((this.s*this.n)**+i.n,this.d**+i.n);if(this.s<0)return null;var n=s(this.n),r=s(this.d),a=1,l=1;for(var u in n){if(u===`1`)continue;if(u===`0`){a=0;break}if(n[u]*=i.n,n[u]%i.d===0)n[u]/=i.d;else return null;a*=u**+n[u]}for(var u in r){if(u===`1`)continue;if(r[u]*=i.n,r[u]%i.d===0)r[u]/=i.d;else return null;l*=u**+r[u]}return i.s<0?o(l,a):o(a,l)},equals:function(e,t){return c(e,t),this.s*this.n*i.d===i.s*i.n*this.d},compare:function(e,t){c(e,t);var n=this.s*this.n*i.d-i.s*i.n*this.d;return(0<n)-(n<0)},simplify:function(e){if(isNaN(this.n)||isNaN(this.d))return this;e||=.001;for(var t=this.abs(),n=t.toContinued(),r=1;r<n.length;r++){for(var i=o(n[r-1],1),a=r-2;a>=0;a--)i=i.inverse().add(n[a]);if(Math.abs(i.sub(t).valueOf())<e)return i.mul(this.s)}return this},divisible:function(e,t){return c(e,t),!(!(i.n*this.d)||this.n*i.d%(i.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(e){var t,n=``,r=this.n,i=this.d;return this.s<0&&(n+=`-`),i===1?n+=r:(e&&(t=Math.floor(r/i))>0&&(n+=t,n+=` `,r%=i),n+=r,n+=`/`,n+=i),n},toLatex:function(e){var t,n=``,r=this.n,i=this.d;return this.s<0&&(n+=`-`),i===1?n+=r:(e&&(t=Math.floor(r/i))>0&&(n+=t,r%=i),n+=`\\frac{`,n+=r,n+=`}{`,n+=i,n+=`}`),n},toContinued:function(){var e,t=this.n,n=this.d,r=[];if(isNaN(t)||isNaN(n))return r;do r.push(Math.floor(t/n)),e=t%n,t=n,n=e;while(t!==1);return r},toString:function(e){var t=this.n,n=this.d;if(isNaN(t)||isNaN(n))return`NaN`;e||=15;var r=u(t,n),i=d(t,n,r),a=this.s<0?`-`:``;if(a+=t/n|0,t%=n,t*=10,t&&(a+=`.`),r){for(var o=i;o--;)a+=t/n|0,t%=n,t*=10;a+=`(`;for(var o=r;o--;)a+=t/n|0,t%=n,t*=10;a+=`)`}else for(var o=e;t&&o--;)a+=t/n|0,t%=n,t*=10;return a}},typeof exports==`object`?(Object.defineProperty(p,`__esModule`,{value:!0}),p.default=p,p.Fraction=p,t.exports=p):n.Fraction=p})(void 0)}),rd=E(nd(),1),id=`Fraction`,ad=[],od=Hc(id,ad,()=>(Object.defineProperty(rd.default,`name`,{value:`Fraction`}),rd.default.prototype.constructor=rd.default,rd.default.prototype.type=`Fraction`,rd.default.prototype.isFraction=!0,rd.default.prototype.toJSON=function(){return{mathjs:`Fraction`,n:this.s*this.n,d:this.d}},rd.default.fromJSON=function(e){return new rd.default(e)},rd.default),{isClass:!0}),sd=`Matrix`,cd=[],ld=Hc(sd,cd,()=>{function e(){if(!(this instanceof e))throw SyntaxError(`Constructor must be called with the new operator`)}return e.prototype.type=`Matrix`,e.prototype.isMatrix=!0,e.prototype.storage=function(){throw Error(`Cannot invoke storage on a Matrix interface`)},e.prototype.datatype=function(){throw Error(`Cannot invoke datatype on a Matrix interface`)},e.prototype.create=function(e,t){throw Error(`Cannot invoke create on a Matrix interface`)},e.prototype.subset=function(e,t,n){throw Error(`Cannot invoke subset on a Matrix interface`)},e.prototype.get=function(e){throw Error(`Cannot invoke get on a Matrix interface`)},e.prototype.set=function(e,t,n){throw Error(`Cannot invoke set on a Matrix interface`)},e.prototype.resize=function(e,t){throw Error(`Cannot invoke resize on a Matrix interface`)},e.prototype.reshape=function(e,t){throw Error(`Cannot invoke reshape on a Matrix interface`)},e.prototype.clone=function(){throw Error(`Cannot invoke clone on a Matrix interface`)},e.prototype.size=function(){throw Error(`Cannot invoke size on a Matrix interface`)},e.prototype.map=function(e,t){throw Error(`Cannot invoke map on a Matrix interface`)},e.prototype.forEach=function(e){throw Error(`Cannot invoke forEach on a Matrix interface`)},e.prototype[Symbol.iterator]=function(){throw Error(`Cannot iterate a Matrix interface`)},e.prototype.toArray=function(){throw Error(`Cannot invoke toArray on a Matrix interface`)},e.prototype.valueOf=function(){throw Error(`Cannot invoke valueOf on a Matrix interface`)},e.prototype.format=function(e){throw Error(`Cannot invoke format on a Matrix interface`)},e.prototype.toString=function(){throw Error(`Cannot invoke toString on a Matrix interface`)},e},{isClass:!0});function ud(e){return Object.keys(e.signatures||{}).reduce(function(e,t){var n=(t.match(/,/g)||[]).length+1;return Math.max(e,n)},-1)}var dd=`DenseMatrix`,fd=[`Matrix`],pd=Hc(dd,fd,e=>{var{Matrix:t}=e;function n(e,t){if(!(this instanceof n))throw SyntaxError(`Constructor must be called with the new operator`);if(t&&!ss(t))throw Error(`Invalid datatype: `+t);if(cs(e))e.type===`DenseMatrix`?(this._data=Vs(e._data),this._size=Vs(e._size),this._datatype=t||e._datatype):(this._data=e.toArray(),this._size=e.size(),this._datatype=t||e._datatype);else if(e&&B(e.data)&&B(e.size))this._data=e.data,this._size=e.size,wc(this._data,this._size),this._datatype=t||e.datatype;else if(B(e))this._data=l(e),this._size=Sc(this._data),wc(this._data,this._size),this._datatype=t;else if(e)throw TypeError(`Unsupported type of data (`+Bs(e)+`)`);else this._data=[],this._size=[0],this._datatype=t}n.prototype=new t,n.prototype.createDenseMatrix=function(e,t){return new n(e,t)},Object.defineProperty(n,`name`,{value:`DenseMatrix`}),n.prototype.constructor=n,n.prototype.type=`DenseMatrix`,n.prototype.isDenseMatrix=!0,n.prototype.getDataType=function(){return Pc(this._data,Bs)},n.prototype.storage=function(){return`dense`},n.prototype.datatype=function(){return this._datatype},n.prototype.create=function(e,t){return new n(e,t)},n.prototype.subset=function(e,t,n){switch(arguments.length){case 1:return r(this,e);case 2:case 3:return a(this,e,t,n);default:throw SyntaxError(`Wrong number of arguments`)}},n.prototype.get=function(e){if(!B(e))throw TypeError(`Array expected`);if(e.length!==this._size.length)throw new V(e.length,this._size.length);for(var t=0;t<e.length;t++)H(e[t],this._size[t]);for(var n=this._data,r=0,i=e.length;r<i;r++){var a=e[r];H(a,n.length),n=n[a]}return n},n.prototype.set=function(e,t,n){if(!B(e))throw TypeError(`Array expected`);if(e.length<this._size.length)throw new V(e.length,this._size.length,`<`);var r,i,a,o=e.map(function(e){return e+1});c(this,o,n);var s=this._data;for(r=0,i=e.length-1;r<i;r++)a=e[r],H(a,s.length),s=s[a];return a=e[e.length-1],H(a,s.length),s[a]=t,this};function r(e,t){if(!ps(t))throw TypeError(`Invalid index`);var r=t.isScalar();if(r)return e.get(t.min());var a=t.size();if(a.length!==e._size.length)throw new V(a.length,e._size.length);for(var o=t.min(),s=t.max(),c=0,l=e._size.length;c<l;c++)H(o[c],e._size[c]),H(s[c],e._size[c]);return new n(i(e._data,t,a.length,0),e._datatype)}function i(e,t,n,r){var a=r===n-1,o=t.dimension(r);return a?o.map(function(t){return H(t,e.length),e[t]}).valueOf():o.map(function(a){H(a,e.length);var o=e[a];return i(o,t,n,r+1)}).valueOf()}function a(e,t,n,r){if(!t||t.isIndex!==!0)throw TypeError(`Invalid index`);var i=t.size(),a=t.isScalar(),s;if(cs(n)?(s=n.size(),n=n.valueOf()):s=Sc(n),a){if(s.length!==0)throw TypeError(`Scalar expected`);e.set(t.min(),n,r)}else{if(!Us(s,i))try{n=s.length===0?zc([n],i):zc(n,i),s=Sc(n)}catch{}if(i.length<e._size.length)throw new V(i.length,e._size.length,`<`);if(s.length<i.length){for(var l=0,u=0;i[l]===1&&s[l]===1;)l++;for(;i[l]===1;)u++,l++;n=jc(n,i.length,u,s)}if(!Us(i,s))throw new V(i,s,`>`);var d=t.max().map(function(e){return e+1});c(e,d,r);var f=i.length,p=0;o(e._data,t,n,f,p)}return e}function o(e,t,n,r,i){var a=i===r-1,s=t.dimension(i);a?s.forEach(function(t,r){H(t),e[t]=n[r[0]]}):s.forEach(function(a,s){H(a),o(e[a],t,n[s[0]],r,i+1)})}n.prototype.resize=function(e,t,n){if(!ls(e))throw TypeError(`Array or Matrix expected`);var r=e.valueOf().map(e=>Array.isArray(e)&&e.length===1?e[0]:e),i=n?this.clone():this;return s(i,r,t)};function s(e,t,n){if(t.length===0){for(var r=e._data;B(r);)r=r[0];return r}return e._size=t.slice(0),e._data=Tc(e._data,e._size,n),e}n.prototype.reshape=function(e,t){var n=t?this.clone():this;n._data=Dc(n._data,e);var r=n._size.reduce((e,t)=>e*t);return n._size=Oc(e,r),n};function c(e,t,n){for(var r=e._size.slice(0),i=!1;r.length<t.length;)r.push(0),i=!0;for(var a=0,o=t.length;a<o;a++)t[a]>r[a]&&(r[a]=t[a],i=!0);i&&s(e,r,n)}n.prototype.clone=function(){var e=new n({data:Vs(this._data),size:Vs(this._size),datatype:this._datatype});return e},n.prototype.size=function(){return this._size.slice(0)},n.prototype.map=function(e){var t=this,r=ud(e),i=function n(i,a){return B(i)?i.map(function(e,t){return n(e,a.concat(t))}):r===1?e(i):r===2?e(i,a):e(i,a,t)},a=i(this._data,[]),o=this._datatype===void 0?void 0:Pc(a,Bs);return new n(a,o)},n.prototype.forEach=function(e){var t=this,n=function n(r,i){B(r)?r.forEach(function(e,t){n(e,i.concat(t))}):e(r,i,t)};n(this._data,[])},n.prototype[Symbol.iterator]=function*(){var e=function*e(t,n){if(B(t))for(var r=0;r<t.length;r++)yield*e(t[r],n.concat(r));else yield{value:t,index:n}};yield*e(this._data,[])},n.prototype.rows=function(){var e=[],t=this.size();if(t.length!==2)throw TypeError(`Rows can only be returned for a 2D matrix.`);var r=this._data;for(var i of r)e.push(new n([i],this._datatype));return e},n.prototype.columns=function(){var e=this,t=[],r=this.size();if(r.length!==2)throw TypeError(`Rows can only be returned for a 2D matrix.`);for(var i=this._data,a=function(r){var a=i.map(e=>[e[r]]);t.push(new n(a,e._datatype))},o=0;o<r[1];o++)a(o);return t},n.prototype.toArray=function(){return Vs(this._data)},n.prototype.valueOf=function(){return this._data},n.prototype.format=function(e){return mc(this._data,e)},n.prototype.toString=function(){return mc(this._data)},n.prototype.toJSON=function(){return{mathjs:`DenseMatrix`,data:this._data,size:this._size,datatype:this._datatype}},n.prototype.diagonal=function(e){if(e){if(ts(e)&&(e=e.toNumber()),!z(e)||!Zs(e))throw TypeError(`The parameter k must be an integer number`)}else e=0;for(var t=e>0?e:0,r=e<0?-e:0,i=this._size[0],a=this._size[1],o=Math.min(i-r,a-t),s=[],c=0;c<o;c++)s[c]=this._data[c+r][c+t];return new n({data:s,size:[o],datatype:this._datatype})},n.diagonal=function(e,t,r,i){if(!B(e))throw TypeError(`Array expected, size parameter`);if(e.length!==2)throw Error(`Only two dimensions matrix are supported`);if(e=e.map(function(e){if(ts(e)&&(e=e.toNumber()),!z(e)||!Zs(e)||e<1)throw Error(`Size values must be positive integers`);return e}),r){if(ts(r)&&(r=r.toNumber()),!z(r)||!Zs(r))throw TypeError(`The parameter k must be an integer number`)}else r=0;var a=r>0?r:0,o=r<0?-r:0,s=e[0],c=e[1],l=Math.min(s-o,c-a),u;if(B(t)){if(t.length!==l)throw Error(`Invalid value array length`);u=function(e){return t[e]}}else if(cs(t)){var d=t.size();if(d.length!==1||d[0]!==l)throw Error(`Invalid matrix length`);u=function(e){return t.get([e])}}else u=function(){return t};i||=ts(u(0))?u(0).mul(0):0;var f=[];if(e.length>0){f=Tc(f,e,i);for(var p=0;p<l;p++)f[p+o][p+a]=u(p)}return new n({data:f,size:[s,c]})},n.fromJSON=function(e){return new n(e)},n.prototype.swapRows=function(e,t){if(!z(e)||!Zs(e)||!z(t)||!Zs(t))throw Error(`Row index must be positive integers`);if(this._size.length!==2)throw Error(`Only two dimensional matrix is supported`);return H(e,this._size[0]),H(t,this._size[0]),n._swapRows(e,t,this._data),this},n._swapRows=function(e,t,n){var r=n[e];n[e]=n[t],n[t]=r};function l(e){return cs(e)?l(e.valueOf()):B(e)?e.map(l):e}return n},{isClass:!0});function md(e,t,n){return e&&typeof e.map==`function`?e.map(function(e){return md(e,t,n)}):t(e)}var hd=`isNumeric`,gd=[`typed`],_d=Hc(hd,gd,e=>{var{typed:t}=e;return t(hd,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":t.referToSelf(e=>t=>md(t,e))})}),vd=`hasNumericValue`,yd=[`typed`,`isNumeric`],bd=Hc(vd,yd,e=>{var{typed:t,isNumeric:n}=e;return t(vd,{boolean:()=>!0,string:function(e){return e.trim().length>0&&!isNaN(Number(e))},any:function(e){return n(e)}})}),xd=Gu({config:Ys}),Sd=td({}),Cd=od({}),wd=ld({}),Td=pd({Matrix:wd}),Ed=al({BigNumber:xd,Complex:Sd,DenseMatrix:Td,Fraction:Cd}),Dd=_d({typed:Ed}),Od=bd({isNumeric:Dd,typed:Ed});const kd=e=>{let t=Number(e);return Number.isNaN(t)?!1:t>=120&&t<=36e4},Ad=e=>{let t=Number(e),n=Date.now();if(Number.isNaN(t))return n+Zo;if(!kd(t)&&o(t))return Qo(t);if(kd(t))return n+t;{let e=t*Yo;return n+e}},jd=`ratelimitlimit`,Md=`ratelimitremaining`,Nd=`ratelimitreset`,Pd=`ratelimitconcurrencylimit`,Fd=`ratelimitconcurrencyremaining`,Id=`ratelimitconcurrencyreset`,Ld=e=>{let t={};for(let[n,r]of Object.entries(e)){let e=n.toLowerCase().replace(/^x-/,``).replace(/concurren.+-/g,`concurrency-`).replace(/-/g,``),i=Od(r)?Number(r):null;t[e]=i}return t},Rd=e=>{let t=Ld(e);return{rateLimitLimit:t[jd],rateLimitRemaining:t[Md],rateLimitReset:Ad(t[Nd]),concurrencyLimit:t[Pd],concurrencyRemaining:t[Fd],concurrencyReset:Ad(t[Id])}},zd=e=>{let{accountSecureId:t,service:n,resource:r,subResource:i,childResource:a,action:o,behaviours:c}=e??{};return[t,n,r,o].some(s)?null:[t,n,r,i,a,o,...c??[]].filter(Boolean).join(`-`)},Bd=(e,t=Ko,n=Go)=>{let r=Date.now();return o(e)||c(e)?Vd(Number(e),r,t,n):ss(e)&&e!==``?Hd(e,r,t,n):n},Vd=(e,t,n=Ko,r=Go)=>{if(e<n)return e;let i=Qo(e);if(i>t){let e=Math.floor((i-t)/Yo);return e>0&&e<n?e:r}return r},Hd=(e,t,n=Ko,r=Go)=>{if(Xo.test(e)){let t=parseFloat(e);return t>0&&t<n?t:r}let i=new Date(e);if(Number.isNaN(i.getTime()))return r;let a=i.getTime();if(a>t){let e=Math.floor((a-t)/Yo);return e>0&&e<n?e:r}return r};let Ud=function(e){return e.RateLimiterReleaseRequestFailed=`RateLimiterReleaseRequestFailed`,e}({});const Wd=({axiosInstance:e,logger:t,requestConfig:r,context:i})=>{let a=async a=>{let{response:o,config:s}=a,c=s?.signal;if(c?.aborted)return Promise.reject(Vo(`Request aborted`,s,`ERR_CANCELED`,o));let{status:l,retryAfter:u}=Gd(o,i,r,t);if(l===429&&d(s)){let r=Bd(u);if(s._retryCount>=qo)return t?.warning({category:`http-transport`,message:`Max retries exceeded for ${s?.url}. Aborting.`,context:{...i??{},retryAfterHeader:u,retryAfterAsNumber:r}}),Promise.reject(a);let c=s._retryCount??0,l={...s,_retryCount:c+1},d=u?r*Yo:n(l._retryCount);return t?.debug({category:`http-transport`,message:`Received 429 error from ${s?.url}`,context:{...i??{},retryAfterHeader:u,calculatedRetryAfter:d}}),await Ho(d*1e3,s,o),e?.request(l)}return Promise.reject(a)};return a},Gd=(e,t,n,r)=>{let{provider:i}=t??{},{status:a,headers:o,data:c}=e??{},{retryafter:u}=Ld(o??{});if(s(i)||s(e))return r?.warning({category:`http-transport`,message:`Invalid parameters for convertError`,context:{...t,responseIsMissing:s(e),providerIsMissing:s(i),status:e?.status??`undefined`,statusText:e?.statusText??`undefined`,retryafter:u??`undefined`}}),{status:a,retryAfter:u};let f=n?.rateLimits?.mappedRateLimitErrors;if(d(f)&&d(c))for(let e of f){let{errorStatus:t,errorMessagePath:n,errorMessage:r,retryAfterPath:i,retryAfterUnit:s,retryAfterValue:d}=e;if(t!==a)continue;let f=n??`message`,p=l(c)?v.query(c,f)[0]:c,m=Kd(p,r);if(t===a&&m){let e=d??qd(o,i),t=Jd(e,s);return{status:429,retryAfter:u??t}}}return{status:a,retryAfter:u}},Kd=(e,t)=>t instanceof RegExp?t.test(e??``):e?.includes(t)??!1,qd=(e,t)=>d(t)&&d(e)?v.query(e,t)[0]:null,Jd=(e,t=`seconds`)=>d(e)?Yd(e,t):null,Yd=(e,t)=>{if(t===`seconds`)return typeof e==`string`?parseFloat(e):e;if(t===`milliseconds`){let t=typeof e==`string`?parseFloat(e):e;return t/Yo}if(t===`date`){let t=typeof e==`string`&&!isNaN(Number(e))?parseFloat(e):e,n=new Date(t);if(isNaN(n.getTime()))throw Error(`Invalid date value`);return n.getTime()}throw Error(`Invalid type`)},Xd=`rateLimitErrorInterceptor`,Zd=({axiosInstance:e,logger:t,requestConfig:r,context:i})=>{let a=async a=>{let{response:o,config:c}=a,l=c?.signal;if(s(i)||s(c))return t?.warning({category:`HttpClient`,message:`No context or config for this response - that doesn't seem right.`,context:{interceptor:Xd,...c,headers:void 0}}),Promise.reject(a);let{requestId:u,targetConcurrencyKey:f,leaseSubscription:p,setRemovalSubscription:m}=c?.requestMetadata??{},h=await nt.getInstance(),g=d(u)&&d(f)?await h.releaseRequest(u,f):!1;if(!g&&d(c?.requestMetadata)&&t?.error({category:`HttpClient`,message:`Failed to release request from concurrency manager`,context:{...i,interceptor:Xd,requestId:u,targetConcurrencyKey:f,leaseSubscription:p,setRemovalSubscription:m},code:Ud.RateLimiterReleaseRequestFailed}),l?.aborted)return Promise.reject(Vo(`Request aborted`,c,`ERR_CANCELED`,o));let{status:_,retryAfter:v}=Gd(o,i,r,t);if(_===429&&d(c)){let r=Bd(v);if(c._retryCount>=qo)return t?.warning({category:`HttpClient`,message:`Max retries exceeded for ${c.url}. Aborting.`,context:{...i??{},...c.requestMetadata??{},retryAfterHeader:v,retryAfterAsNumber:r}}),Promise.reject(a);let s=c?._retryCount??0,l={...c,_retryCount:s+1},u=v?r*Yo:n(l._retryCount);return t?.debug({category:`HttpClient`,message:`Received 429 error from ${c.url}`,context:{...i,retryAfterHeader:v,calculatedRetryAfter:u}}),await Ho(u*1e3,c,o),e?.request(l)}return Promise.reject(a)};return a},Qd=`rateLimitResponseInterceptor`,$d=({logger:e,context:t})=>{let n=async n=>{let r=n?.config,i=r?.signal;if(s(t))e?.warning({category:`HttpClient`,message:`No context for this response - that doesn't seem right.`,context:{...r,interceptor:Qd,headers:void 0}});else{let t=n?.headers;if(d(t)){let n=Rd(t);e?.debug({category:`HttpClient`,message:`Rate limit headers extracted`,context:{interceptor:Qd,rateLimitHeaders:n}})}let{requestId:a,targetConcurrencyKey:o,leaseSubscription:s,setRemovalSubscription:c}=r?.requestMetadata??{},l=await nt.getInstance(),u=await l.releaseRequest(a,o);if(u||e?.error({category:`HttpClient`,message:`Failed to release request from concurrency manager`,context:{interceptor:Qd,requestId:a,targetConcurrencyKey:o,leaseSubscription:s,setRemovalSubscription:c},code:Ud.RateLimiterReleaseRequestFailed}),i?.aborted)return Promise.reject(Vo(`Request aborted`,r,`ERR_CANCELED`,n))}return n};return n},ef=e=>(e.validateStatus??=e=>e>=200&&e<300,e),tf=[{onFulfilled:ef,onRejected:null,options:void 0}],nf=[{onFulfilled:null,onRejected:Wd},{onFulfilled:null,onRejected:Oo}],rf=[{onFulfilled:ef,onRejected:null,options:void 0},{onFulfilled:Wo,onRejected:null,options:void 0}],af=[{onFulfilled:$d,onRejected:Zd},{onFulfilled:null,onRejected:Oo}];let sf=function(e){return e.HttpTransportInstanceCreateError=`HttpTransportInstanceCreateError`,e}({});const cf=async({logger:e,redisClientConfig:t,context:n}={})=>{let r,{NODE_ENV:i}=process.env,a=n?.behaviours??[`CONCURRENCY`,`RETRY`];try{if(r=a.includes(`RETRY`)?uf(e,n):lf(e,n),s(n?.service)||s(n?.organizationId)||i===`test`||s(t)||s(e))return r;let o=await nt.getInstance(t,e),c=await o.isRedisConfigured(),l=[],u=[];if(a.includes(`CONCURRENCY`)){if(!c)throw Error(`Concurrency Manager cannot connect to Redis. Cannot create advanced transport instance.`);l.push(...rf),u.push(...af)}let f=zd(n);if(s(f))return e?.warning({category:`http-transport`,message:`Unable to create a key for transport instance - Invalid state. Using base default instance.`,context:{...n,defaultInstanceInitialized:d(r)}}),r;let p=await Do.get(f);if(d(p))return p;let m={interceptors:{requestConfigs:l,responseConfigs:u},instanceConfig:{maxBodyLength:1/0},logger:e,context:n},h=wo.createInstance(m);return e?.debug({category:`http-transport`,message:`Creating new Axios instance and caching it for key: [${f}]`,context:{...n}}),await Do.set(f,h),h}catch(t){return e?.error({category:`http-transport`,message:`Failed to create advanced transport instance. Using default instance.`,context:{...n,usingDefaultInstance:d(r)},error:t,code:sf.HttpTransportInstanceCreateError}),d(r)?r:df()}},lf=(e,t)=>{let n={instanceConfig:{maxBodyLength:1/0},logger:e,context:t};return wo.createInstance(n)??df()},uf=(e,t)=>{let n={interceptors:{requestConfigs:tf,responseConfigs:nf},instanceConfig:{maxBodyLength:1/0},logger:e,context:t};return wo.createInstance(n)??df()},df=()=>{let e=p.create({maxBodyLength:1/0});return e};var ff=T((exports,t)=>{t.exports=n;function n(e={}){let{ERR_PATHS_MUST_BE_STRINGS:t=()=>`fast-redact - Paths must be (non-empty) strings`,ERR_INVALID_PATH:n=e=>`fast-redact – Invalid path (${e})`}=e;return function({paths:e}){e.forEach(e=>{if(typeof e!=`string`)throw Error(t());try{if(/〇/.test(e))throw Error();let t=(e[0]===`[`?``:`.`)+e.replace(/^\*/,`〇`).replace(/\.\*/g,`.〇`).replace(/\[\*\]/g,`[〇]`);if(/\n|\r|;/.test(t)||/\/\*/.test(t))throw Error();Function(`
214
+ (function(n){"use strict";var r=2e3,i={s:1,n:0,d:1};function a(e,t){if(isNaN(e=parseInt(e,10)))throw h();return e*t}function o(e,t){if(t===0)throw m();var n=Object.create(p.prototype);n.s=e<0?-1:1,e=e<0?-e:e;var r=f(e,t);return n.n=e/r,n.d=t/r,n}function s(e){for(var t={},n=e,r=2,i=4;i<=n;){for(;n%r===0;)n/=r,t[r]=(t[r]||0)+1;i+=1+2*r++}return n===e?t[e]=(t[e]||0)+1:n>1&&(t[n]=(t[n]||0)+1),t}var c=function(e,t){var n=0,r=1,o=1,s=0,c=0,l=0,u=1,d=1,f=0,p=1,_=1,v=1,y=1e7,b;if(e!=null)if(t!==void 0){if(n=e,r=t,o=n*r,n%1!=0||r%1!=0)throw g()}else switch(typeof e){case`object`:if(`d`in e&&`n`in e)n=e.n,r=e.d,`s`in e&&(n*=e.s);else if(0 in e)n=e[0],1 in e&&(r=e[1]);else throw h();o=n*r;break;case`number`:if(e<0&&(o=e,e=-e),e%1==0)n=e;else if(e>0){for(e>=1&&(d=10**Math.floor(1+Math.log(e)/Math.LN10),e/=d);p<=y&&v<=y;)if(b=(f+_)/(p+v),e===b){p+v<=y?(n=f+_,r=p+v):v>p?(n=_,r=v):(n=f,r=p);break}else e>b?(f+=_,p+=v):(_+=f,v+=p),p>y?(n=_,r=v):(n=f,r=p);n*=d}else (isNaN(e)||isNaN(t))&&(r=n=NaN);break;case`string`:if(p=e.match(/\d+|./g),p===null)throw h();if(p[f]===`-`?(o=-1,f++):p[f]===`+`&&f++,p.length===f+1?c=a(p[f++],o):p[f+1]===`.`||p[f]===`.`?(p[f]!==`.`&&(s=a(p[f++],o)),f++,(f+1===p.length||p[f+1]===`(`&&p[f+3]===`)`||p[f+1]===`'`&&p[f+3]===`'`)&&(c=a(p[f],o),u=10**p[f].length,f++),(p[f]===`(`&&p[f+2]===`)`||p[f]===`'`&&p[f+2]===`'`)&&(l=a(p[f+1],o),d=10**p[f+1].length-1,f+=3)):p[f+1]===`/`||p[f+1]===`:`?(c=a(p[f],o),u=a(p[f+2],1),f+=3):p[f+3]===`/`&&p[f+1]===` `&&(s=a(p[f],o),c=a(p[f+2],o),u=a(p[f+4],1),f+=5),p.length<=f){r=u*d,o=n=l+r*s+d*c;break}default:throw h()}if(r===0)throw m();i.s=o<0?-1:1,i.n=Math.abs(n),i.d=Math.abs(r)};function l(e,t,n){for(var r=1;t>0;e=e*e%n,t>>=1)t&1&&(r=r*e%n);return r}function u(e,t){for(;t%2==0;t/=2);for(;t%5==0;t/=5);if(t===1)return 0;for(var n=10%t,i=1;n!==1;i++)if(n=n*10%t,i>r)return 0;return i}function d(e,t,n){for(var r=1,i=l(10,n,t),a=0;a<300;a++){if(r===i)return a;r=r*10%t,i=i*10%t}return 0}function f(e,t){if(!e)return t;if(!t)return e;for(;;){if(e%=t,!e)return t;if(t%=e,!t)return e}}function p(e,t){if(c(e,t),this instanceof p)e=f(i.d,i.n),this.s=i.s,this.n=i.n/e,this.d=i.d/e;else return o(i.s*i.n,i.d)}var m=function(){return Error(`Division by Zero`)},h=function(){return Error(`Invalid argument`)},g=function(){return Error(`Parameters must be integer`)};p.prototype={s:1,n:0,d:1,abs:function(){return o(this.n,this.d)},neg:function(){return o(-this.s*this.n,this.d)},add:function(e,t){return c(e,t),o(this.s*this.n*i.d+i.s*this.d*i.n,this.d*i.d)},sub:function(e,t){return c(e,t),o(this.s*this.n*i.d-i.s*this.d*i.n,this.d*i.d)},mul:function(e,t){return c(e,t),o(this.s*i.s*this.n*i.n,this.d*i.d)},div:function(e,t){return c(e,t),o(this.s*i.s*this.n*i.d,this.d*i.n)},clone:function(){return o(this.s*this.n,this.d)},mod:function(e,t){if(isNaN(this.n)||isNaN(this.d))return new p(NaN);if(e===void 0)return o(this.s*this.n%this.d,1);if(c(e,t),i.n===0&&this.d===0)throw m();return o(this.s*(i.d*this.n)%(i.n*this.d),i.d*this.d)},gcd:function(e,t){return c(e,t),o(f(i.n,this.n)*f(i.d,this.d),i.d*this.d)},lcm:function(e,t){return c(e,t),i.n===0&&this.n===0?o(0,1):o(i.n*this.n,f(i.n,this.n)*f(i.d,this.d))},ceil:function(e){return e=10**(e||0),isNaN(this.n)||isNaN(this.d)?new p(NaN):o(Math.ceil(e*this.s*this.n/this.d),e)},floor:function(e){return e=10**(e||0),isNaN(this.n)||isNaN(this.d)?new p(NaN):o(Math.floor(e*this.s*this.n/this.d),e)},round:function(e){return e=10**(e||0),isNaN(this.n)||isNaN(this.d)?new p(NaN):o(Math.round(e*this.s*this.n/this.d),e)},inverse:function(){return o(this.s*this.d,this.n)},pow:function(e,t){if(c(e,t),i.d===1)return i.s<0?o((this.s*this.d)**+i.n,this.n**+i.n):o((this.s*this.n)**+i.n,this.d**+i.n);if(this.s<0)return null;var n=s(this.n),r=s(this.d),a=1,l=1;for(var u in n){if(u===`1`)continue;if(u===`0`){a=0;break}if(n[u]*=i.n,n[u]%i.d===0)n[u]/=i.d;else return null;a*=u**+n[u]}for(var u in r){if(u===`1`)continue;if(r[u]*=i.n,r[u]%i.d===0)r[u]/=i.d;else return null;l*=u**+r[u]}return i.s<0?o(l,a):o(a,l)},equals:function(e,t){return c(e,t),this.s*this.n*i.d===i.s*i.n*this.d},compare:function(e,t){c(e,t);var n=this.s*this.n*i.d-i.s*i.n*this.d;return(0<n)-(n<0)},simplify:function(e){if(isNaN(this.n)||isNaN(this.d))return this;e||=.001;for(var t=this.abs(),n=t.toContinued(),r=1;r<n.length;r++){for(var i=o(n[r-1],1),a=r-2;a>=0;a--)i=i.inverse().add(n[a]);if(Math.abs(i.sub(t).valueOf())<e)return i.mul(this.s)}return this},divisible:function(e,t){return c(e,t),!(!(i.n*this.d)||this.n*i.d%(i.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(e){var t,n=``,r=this.n,i=this.d;return this.s<0&&(n+=`-`),i===1?n+=r:(e&&(t=Math.floor(r/i))>0&&(n+=t,n+=` `,r%=i),n+=r,n+=`/`,n+=i),n},toLatex:function(e){var t,n=``,r=this.n,i=this.d;return this.s<0&&(n+=`-`),i===1?n+=r:(e&&(t=Math.floor(r/i))>0&&(n+=t,r%=i),n+=`\\frac{`,n+=r,n+=`}{`,n+=i,n+=`}`),n},toContinued:function(){var e,t=this.n,n=this.d,r=[];if(isNaN(t)||isNaN(n))return r;do r.push(Math.floor(t/n)),e=t%n,t=n,n=e;while(t!==1);return r},toString:function(e){var t=this.n,n=this.d;if(isNaN(t)||isNaN(n))return`NaN`;e||=15;var r=u(t,n),i=d(t,n,r),a=this.s<0?`-`:``;if(a+=t/n|0,t%=n,t*=10,t&&(a+=`.`),r){for(var o=i;o--;)a+=t/n|0,t%=n,t*=10;a+=`(`;for(var o=r;o--;)a+=t/n|0,t%=n,t*=10;a+=`)`}else for(var o=e;t&&o--;)a+=t/n|0,t%=n,t*=10;return a}},typeof exports==`object`?(Object.defineProperty(p,`__esModule`,{value:!0}),p.default=p,p.Fraction=p,t.exports=p):n.Fraction=p})(void 0)}),rd=E(nd(),1),id=`Fraction`,ad=[],od=Hc(id,ad,()=>(Object.defineProperty(rd.default,`name`,{value:`Fraction`}),rd.default.prototype.constructor=rd.default,rd.default.prototype.type=`Fraction`,rd.default.prototype.isFraction=!0,rd.default.prototype.toJSON=function(){return{mathjs:`Fraction`,n:this.s*this.n,d:this.d}},rd.default.fromJSON=function(e){return new rd.default(e)},rd.default),{isClass:!0}),sd=`Matrix`,cd=[],ld=Hc(sd,cd,()=>{function e(){if(!(this instanceof e))throw SyntaxError(`Constructor must be called with the new operator`)}return e.prototype.type=`Matrix`,e.prototype.isMatrix=!0,e.prototype.storage=function(){throw Error(`Cannot invoke storage on a Matrix interface`)},e.prototype.datatype=function(){throw Error(`Cannot invoke datatype on a Matrix interface`)},e.prototype.create=function(e,t){throw Error(`Cannot invoke create on a Matrix interface`)},e.prototype.subset=function(e,t,n){throw Error(`Cannot invoke subset on a Matrix interface`)},e.prototype.get=function(e){throw Error(`Cannot invoke get on a Matrix interface`)},e.prototype.set=function(e,t,n){throw Error(`Cannot invoke set on a Matrix interface`)},e.prototype.resize=function(e,t){throw Error(`Cannot invoke resize on a Matrix interface`)},e.prototype.reshape=function(e,t){throw Error(`Cannot invoke reshape on a Matrix interface`)},e.prototype.clone=function(){throw Error(`Cannot invoke clone on a Matrix interface`)},e.prototype.size=function(){throw Error(`Cannot invoke size on a Matrix interface`)},e.prototype.map=function(e,t){throw Error(`Cannot invoke map on a Matrix interface`)},e.prototype.forEach=function(e){throw Error(`Cannot invoke forEach on a Matrix interface`)},e.prototype[Symbol.iterator]=function(){throw Error(`Cannot iterate a Matrix interface`)},e.prototype.toArray=function(){throw Error(`Cannot invoke toArray on a Matrix interface`)},e.prototype.valueOf=function(){throw Error(`Cannot invoke valueOf on a Matrix interface`)},e.prototype.format=function(e){throw Error(`Cannot invoke format on a Matrix interface`)},e.prototype.toString=function(){throw Error(`Cannot invoke toString on a Matrix interface`)},e},{isClass:!0});function ud(e){return Object.keys(e.signatures||{}).reduce(function(e,t){var n=(t.match(/,/g)||[]).length+1;return Math.max(e,n)},-1)}var dd=`DenseMatrix`,fd=[`Matrix`],pd=Hc(dd,fd,e=>{var{Matrix:t}=e;function n(e,t){if(!(this instanceof n))throw SyntaxError(`Constructor must be called with the new operator`);if(t&&!ss(t))throw Error(`Invalid datatype: `+t);if(cs(e))e.type===`DenseMatrix`?(this._data=Vs(e._data),this._size=Vs(e._size),this._datatype=t||e._datatype):(this._data=e.toArray(),this._size=e.size(),this._datatype=t||e._datatype);else if(e&&B(e.data)&&B(e.size))this._data=e.data,this._size=e.size,wc(this._data,this._size),this._datatype=t||e.datatype;else if(B(e))this._data=l(e),this._size=Sc(this._data),wc(this._data,this._size),this._datatype=t;else if(e)throw TypeError(`Unsupported type of data (`+Bs(e)+`)`);else this._data=[],this._size=[0],this._datatype=t}n.prototype=new t,n.prototype.createDenseMatrix=function(e,t){return new n(e,t)},Object.defineProperty(n,`name`,{value:`DenseMatrix`}),n.prototype.constructor=n,n.prototype.type=`DenseMatrix`,n.prototype.isDenseMatrix=!0,n.prototype.getDataType=function(){return Pc(this._data,Bs)},n.prototype.storage=function(){return`dense`},n.prototype.datatype=function(){return this._datatype},n.prototype.create=function(e,t){return new n(e,t)},n.prototype.subset=function(e,t,n){switch(arguments.length){case 1:return r(this,e);case 2:case 3:return a(this,e,t,n);default:throw SyntaxError(`Wrong number of arguments`)}},n.prototype.get=function(e){if(!B(e))throw TypeError(`Array expected`);if(e.length!==this._size.length)throw new V(e.length,this._size.length);for(var t=0;t<e.length;t++)H(e[t],this._size[t]);for(var n=this._data,r=0,i=e.length;r<i;r++){var a=e[r];H(a,n.length),n=n[a]}return n},n.prototype.set=function(e,t,n){if(!B(e))throw TypeError(`Array expected`);if(e.length<this._size.length)throw new V(e.length,this._size.length,`<`);var r,i,a,o=e.map(function(e){return e+1});c(this,o,n);var s=this._data;for(r=0,i=e.length-1;r<i;r++)a=e[r],H(a,s.length),s=s[a];return a=e[e.length-1],H(a,s.length),s[a]=t,this};function r(e,t){if(!ps(t))throw TypeError(`Invalid index`);var r=t.isScalar();if(r)return e.get(t.min());var a=t.size();if(a.length!==e._size.length)throw new V(a.length,e._size.length);for(var o=t.min(),s=t.max(),c=0,l=e._size.length;c<l;c++)H(o[c],e._size[c]),H(s[c],e._size[c]);return new n(i(e._data,t,a.length,0),e._datatype)}function i(e,t,n,r){var a=r===n-1,o=t.dimension(r);return a?o.map(function(t){return H(t,e.length),e[t]}).valueOf():o.map(function(a){H(a,e.length);var o=e[a];return i(o,t,n,r+1)}).valueOf()}function a(e,t,n,r){if(!t||t.isIndex!==!0)throw TypeError(`Invalid index`);var i=t.size(),a=t.isScalar(),s;if(cs(n)?(s=n.size(),n=n.valueOf()):s=Sc(n),a){if(s.length!==0)throw TypeError(`Scalar expected`);e.set(t.min(),n,r)}else{if(!Us(s,i))try{n=s.length===0?zc([n],i):zc(n,i),s=Sc(n)}catch{}if(i.length<e._size.length)throw new V(i.length,e._size.length,`<`);if(s.length<i.length){for(var l=0,u=0;i[l]===1&&s[l]===1;)l++;for(;i[l]===1;)u++,l++;n=jc(n,i.length,u,s)}if(!Us(i,s))throw new V(i,s,`>`);var d=t.max().map(function(e){return e+1});c(e,d,r);var f=i.length,p=0;o(e._data,t,n,f,p)}return e}function o(e,t,n,r,i){var a=i===r-1,s=t.dimension(i);a?s.forEach(function(t,r){H(t),e[t]=n[r[0]]}):s.forEach(function(a,s){H(a),o(e[a],t,n[s[0]],r,i+1)})}n.prototype.resize=function(e,t,n){if(!ls(e))throw TypeError(`Array or Matrix expected`);var r=e.valueOf().map(e=>Array.isArray(e)&&e.length===1?e[0]:e),i=n?this.clone():this;return s(i,r,t)};function s(e,t,n){if(t.length===0){for(var r=e._data;B(r);)r=r[0];return r}return e._size=t.slice(0),e._data=Tc(e._data,e._size,n),e}n.prototype.reshape=function(e,t){var n=t?this.clone():this;n._data=Dc(n._data,e);var r=n._size.reduce((e,t)=>e*t);return n._size=Oc(e,r),n};function c(e,t,n){for(var r=e._size.slice(0),i=!1;r.length<t.length;)r.push(0),i=!0;for(var a=0,o=t.length;a<o;a++)t[a]>r[a]&&(r[a]=t[a],i=!0);i&&s(e,r,n)}n.prototype.clone=function(){var e=new n({data:Vs(this._data),size:Vs(this._size),datatype:this._datatype});return e},n.prototype.size=function(){return this._size.slice(0)},n.prototype.map=function(e){var t=this,r=ud(e),i=function n(i,a){return B(i)?i.map(function(e,t){return n(e,a.concat(t))}):r===1?e(i):r===2?e(i,a):e(i,a,t)},a=i(this._data,[]),o=this._datatype===void 0?void 0:Pc(a,Bs);return new n(a,o)},n.prototype.forEach=function(e){var t=this,n=function n(r,i){B(r)?r.forEach(function(e,t){n(e,i.concat(t))}):e(r,i,t)};n(this._data,[])},n.prototype[Symbol.iterator]=function*(){var e=function*e(t,n){if(B(t))for(var r=0;r<t.length;r++)yield*e(t[r],n.concat(r));else yield{value:t,index:n}};yield*e(this._data,[])},n.prototype.rows=function(){var e=[],t=this.size();if(t.length!==2)throw TypeError(`Rows can only be returned for a 2D matrix.`);var r=this._data;for(var i of r)e.push(new n([i],this._datatype));return e},n.prototype.columns=function(){var e=this,t=[],r=this.size();if(r.length!==2)throw TypeError(`Rows can only be returned for a 2D matrix.`);for(var i=this._data,a=function(r){var a=i.map(e=>[e[r]]);t.push(new n(a,e._datatype))},o=0;o<r[1];o++)a(o);return t},n.prototype.toArray=function(){return Vs(this._data)},n.prototype.valueOf=function(){return this._data},n.prototype.format=function(e){return mc(this._data,e)},n.prototype.toString=function(){return mc(this._data)},n.prototype.toJSON=function(){return{mathjs:`DenseMatrix`,data:this._data,size:this._size,datatype:this._datatype}},n.prototype.diagonal=function(e){if(e){if(ts(e)&&(e=e.toNumber()),!z(e)||!Zs(e))throw TypeError(`The parameter k must be an integer number`)}else e=0;for(var t=e>0?e:0,r=e<0?-e:0,i=this._size[0],a=this._size[1],o=Math.min(i-r,a-t),s=[],c=0;c<o;c++)s[c]=this._data[c+r][c+t];return new n({data:s,size:[o],datatype:this._datatype})},n.diagonal=function(e,t,r,i){if(!B(e))throw TypeError(`Array expected, size parameter`);if(e.length!==2)throw Error(`Only two dimensions matrix are supported`);if(e=e.map(function(e){if(ts(e)&&(e=e.toNumber()),!z(e)||!Zs(e)||e<1)throw Error(`Size values must be positive integers`);return e}),r){if(ts(r)&&(r=r.toNumber()),!z(r)||!Zs(r))throw TypeError(`The parameter k must be an integer number`)}else r=0;var a=r>0?r:0,o=r<0?-r:0,s=e[0],c=e[1],l=Math.min(s-o,c-a),u;if(B(t)){if(t.length!==l)throw Error(`Invalid value array length`);u=function(e){return t[e]}}else if(cs(t)){var d=t.size();if(d.length!==1||d[0]!==l)throw Error(`Invalid matrix length`);u=function(e){return t.get([e])}}else u=function(){return t};i||=ts(u(0))?u(0).mul(0):0;var f=[];if(e.length>0){f=Tc(f,e,i);for(var p=0;p<l;p++)f[p+o][p+a]=u(p)}return new n({data:f,size:[s,c]})},n.fromJSON=function(e){return new n(e)},n.prototype.swapRows=function(e,t){if(!z(e)||!Zs(e)||!z(t)||!Zs(t))throw Error(`Row index must be positive integers`);if(this._size.length!==2)throw Error(`Only two dimensional matrix is supported`);return H(e,this._size[0]),H(t,this._size[0]),n._swapRows(e,t,this._data),this},n._swapRows=function(e,t,n){var r=n[e];n[e]=n[t],n[t]=r};function l(e){return cs(e)?l(e.valueOf()):B(e)?e.map(l):e}return n},{isClass:!0});function md(e,t,n){return e&&typeof e.map==`function`?e.map(function(e){return md(e,t,n)}):t(e)}var hd=`isNumeric`,gd=[`typed`],_d=Hc(hd,gd,e=>{var{typed:t}=e;return t(hd,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":t.referToSelf(e=>t=>md(t,e))})}),vd=`hasNumericValue`,yd=[`typed`,`isNumeric`],bd=Hc(vd,yd,e=>{var{typed:t,isNumeric:n}=e;return t(vd,{boolean:()=>!0,string:function(e){return e.trim().length>0&&!isNaN(Number(e))},any:function(e){return n(e)}})}),xd=Gu({config:Ys}),Sd=td({}),Cd=od({}),wd=ld({}),Td=pd({Matrix:wd}),Ed=al({BigNumber:xd,Complex:Sd,DenseMatrix:Td,Fraction:Cd}),Dd=_d({typed:Ed}),Od=bd({isNumeric:Dd,typed:Ed});const kd=e=>{let t=Number(e);return Number.isNaN(t)?!1:t>=120&&t<=36e4},Ad=e=>{let t=Number(e),n=Date.now();if(Number.isNaN(t))return n+Zo;if(!kd(t)&&o(t))return Qo(t);if(kd(t))return n+t;{let e=t*Yo;return n+e}},jd=`ratelimitlimit`,Md=`ratelimitremaining`,Nd=`ratelimitreset`,Pd=`ratelimitconcurrencylimit`,Fd=`ratelimitconcurrencyremaining`,Id=`ratelimitconcurrencyreset`,Ld=e=>{let t={};for(let[n,r]of Object.entries(e)){let e=n.toLowerCase().replace(/^x-/,``).replace(/concurren.+-/g,`concurrency-`).replace(/-/g,``),i=Od(r)?Number(r):null;t[e]=i}return t},Rd=e=>{let t=Ld(e);return{rateLimitLimit:t[jd],rateLimitRemaining:t[Md],rateLimitReset:Ad(t[Nd]),concurrencyLimit:t[Pd],concurrencyRemaining:t[Fd],concurrencyReset:Ad(t[Id])}},zd=e=>{let{accountSecureId:t,service:n,resource:r,subResource:i,childResource:a,action:o,behaviours:c}=e??{};return[t,n,r,o].some(s)?null:[t,n,r,i,a,o,...c??[]].filter(Boolean).join(`-`)},Bd=(e,t=Ko,n=Go)=>{let r=Date.now();return o(e)||c(e)?Vd(Number(e),r,t,n):ss(e)&&e!==``?Hd(e,r,t,n):n},Vd=(e,t,n=Ko,r=Go)=>{if(e<n)return e;let i=Qo(e);if(i>t){let e=Math.floor((i-t)/Yo);return e>0&&e<n?e:r}return r},Hd=(e,t,n=Ko,r=Go)=>{if(Xo.test(e)){let t=parseFloat(e);return t>0&&t<n?t:r}let i=new Date(e);if(Number.isNaN(i.getTime()))return r;let a=i.getTime();if(a>t){let e=Math.floor((a-t)/Yo);return e>0&&e<n?e:r}return r};let Ud=function(e){return e.RateLimiterReleaseRequestFailed=`RateLimiterReleaseRequestFailed`,e}({});const Wd=({axiosInstance:e,logger:t,requestConfig:r,context:i})=>{let a=async a=>{let{response:o,config:s}=a,c=s?.signal;if(c?.aborted)return Promise.reject(Vo(`Request aborted`,s,`ERR_CANCELED`,o));let{status:l,retryAfter:u}=Gd(o,i,r,t);if(l===429&&d(s)){let r=Bd(u);if(s._retryCount>=qo)return t?.warning({category:`http-transport`,message:`Max retries exceeded for ${s?.url}. Aborting.`,context:{...i??{},retryAfterHeader:u,retryAfterAsNumber:r}}),Promise.reject(a);let c=s._retryCount??0,l={...s,_retryCount:c+1},d=u?r*Yo:n(l._retryCount);return t?.debug({category:`http-transport`,message:`Received 429 error from ${s?.url}`,context:{...i??{},retryAfterHeader:u,calculatedRetryAfter:d}}),await Ho(d*1e3,s,o),e?.request(l)}return Promise.reject(a)};return a},Gd=(e,t,n,r)=>{let{provider:i}=t??{},{status:a,headers:o,data:c}=e??{},{retryafter:u}=Ld(o??{});if(s(i)||s(e))return r?.warning({category:`http-transport`,message:`Invalid parameters for convertError`,context:{...t,responseIsMissing:s(e),providerIsMissing:s(i),status:e?.status??`undefined`,statusText:e?.statusText??`undefined`,retryafter:u??`undefined`}}),{status:a,retryAfter:u};let f=n?.rateLimits?.mappedRateLimitErrors;if(d(f)&&d(c))for(let e of f){let{errorStatus:t,errorMessagePath:n,errorMessage:r,retryAfterPath:i,retryAfterUnit:s,retryAfterValue:d}=e;if(t!==a)continue;let f=n??`message`,p=l(c)?v.query(c,f)[0]:c,m=Kd(p,r);if(t===a&&m){let e=d??qd(o,i),t=Jd(e,s);return{status:429,retryAfter:u??t}}}return{status:a,retryAfter:u}},Kd=(e,t)=>t instanceof RegExp?t.test(e??``):e?.includes(t)??!1,qd=(e,t)=>d(t)&&d(e)?v.query(e,t)[0]:null,Jd=(e,t=`seconds`)=>d(e)?Yd(e,t):null,Yd=(e,t)=>{if(t===`seconds`)return typeof e==`string`?parseFloat(e):e;if(t===`milliseconds`){let t=typeof e==`string`?parseFloat(e):e;return t/Yo}if(t===`date`){let t=typeof e==`string`&&!isNaN(Number(e))?parseFloat(e):e,n=new Date(t);if(isNaN(n.getTime()))throw Error(`Invalid date value`);return n.getTime()}throw Error(`Invalid type`)},Xd=`rateLimitErrorInterceptor`,Zd=({axiosInstance:e,logger:t,requestConfig:r,context:i})=>{let a=async a=>{let{response:o,config:c}=a,l=c?.signal;if(s(i)||s(c))return t?.warning({category:`HttpClient`,message:`No context or config for this response - that doesn't seem right.`,context:{interceptor:Xd,...c,headers:void 0}}),Promise.reject(a);let{requestId:u,targetConcurrencyKey:f,leaseSubscription:p,setRemovalSubscription:m}=c?.requestMetadata??{},h=await nt.getInstance(),g=d(u)&&d(f)?await h.releaseRequest(u,f):!1;if(!g&&d(c?.requestMetadata)&&t?.error({category:`HttpClient`,message:`Failed to release request from concurrency manager`,context:{...i,interceptor:Xd,requestId:u,targetConcurrencyKey:f,leaseSubscription:p,setRemovalSubscription:m},code:Ud.RateLimiterReleaseRequestFailed}),l?.aborted)return Promise.reject(Vo(`Request aborted`,c,`ERR_CANCELED`,o));let{status:_,retryAfter:v}=Gd(o,i,r,t);if(_===429&&d(c)){let r=Bd(v);if(c._retryCount>=qo)return t?.warning({category:`HttpClient`,message:`Max retries exceeded for ${c.url}. Aborting.`,context:{...i??{},...c.requestMetadata??{},retryAfterHeader:v,retryAfterAsNumber:r}}),Promise.reject(a);let s=c?._retryCount??0,l={...c,_retryCount:s+1},u=v?r*Yo:n(l._retryCount);return t?.debug({category:`HttpClient`,message:`Received 429 error from ${c.url}`,context:{...i,retryAfterHeader:v,calculatedRetryAfter:u}}),await Ho(u*1e3,c,o),e?.request(l)}return Promise.reject(a)};return a},Qd=`rateLimitResponseInterceptor`,$d=({logger:e,context:t})=>{let n=async n=>{let r=n?.config,i=r?.signal;if(s(t))e?.warning({category:`HttpClient`,message:`No context for this response - that doesn't seem right.`,context:{...r,interceptor:Qd,headers:void 0}});else{let t=n?.headers;if(d(t)){let n=Rd(t);e?.debug({category:`HttpClient`,message:`Rate limit headers extracted`,context:{interceptor:Qd,rateLimitHeaders:n}})}let{requestId:a,targetConcurrencyKey:o,leaseSubscription:s,setRemovalSubscription:c}=r?.requestMetadata??{},l=await nt.getInstance(),u=await l.releaseRequest(a,o);if(u||e?.error({category:`HttpClient`,message:`Failed to release request from concurrency manager`,context:{interceptor:Qd,requestId:a,targetConcurrencyKey:o,leaseSubscription:s,setRemovalSubscription:c},code:Ud.RateLimiterReleaseRequestFailed}),i?.aborted)return Promise.reject(Vo(`Request aborted`,r,`ERR_CANCELED`,n))}return n};return n},ef=e=>(e.validateStatus??=e=>e>=200&&e<300,e),tf=[{onFulfilled:ef,onRejected:null,options:void 0}],nf=[{onFulfilled:null,onRejected:Wd},{onFulfilled:null,onRejected:Oo}],rf=[{onFulfilled:ef,onRejected:null,options:void 0},{onFulfilled:Wo,onRejected:null,options:void 0}],af=[{onFulfilled:$d,onRejected:Zd},{onFulfilled:null,onRejected:Oo}];let sf=function(e){return e.HttpTransportInstanceCreateError=`HttpTransportInstanceCreateError`,e}({});const cf=async({logger:e,redisClientConfig:t,context:n}={})=>{let r,{NODE_ENV:i}=process.env,a=n?.behaviours??[`CONCURRENCY`,`RETRY`];try{if(r=a.includes(`RETRY`)?uf(e,n):lf(e,n),s(n?.service)||s(n?.organizationId)||i===`test`||s(t)||s(e))return r;await Bo.getInstance(t,e);let o=await Bo.isReady(),c=await nt.getInstance(t,e),l=await c.isRedisConfigured(),u=[],f=[];if(a.includes(`CONCURRENCY`)){if(!l)throw Error(`Concurrency Manager cannot connect to Redis. Cannot create advanced transport instance.`);if(!o)throw Error(`RateLimitManager is not ready. Cannot create advanced transport instance.`);u.push(...rf),f.push(...af)}let p=zd(n);if(s(p))return e?.warning({category:`http-transport`,message:`Unable to create a key for transport instance - Invalid state. Using base default instance.`,context:{...n,defaultInstanceInitialized:d(r)}}),r;let m=await Do.get(p);if(d(m))return m;let h={interceptors:{requestConfigs:u,responseConfigs:f},instanceConfig:{maxBodyLength:1/0},logger:e,context:n},g=wo.createInstance(h);return e?.debug({category:`http-transport`,message:`Creating new Axios instance and caching it for key: [${p}]`,context:{...n}}),await Do.set(p,g),g}catch(t){return e?.error({category:`http-transport`,message:`Failed to create advanced transport instance. Using default instance.`,context:{...n,usingDefaultInstance:d(r)},error:t,code:sf.HttpTransportInstanceCreateError}),d(r)?r:df()}},lf=(e,t)=>{let n={instanceConfig:{maxBodyLength:1/0},logger:e,context:t};return wo.createInstance(n)??df()},uf=(e,t)=>{let n={interceptors:{requestConfigs:tf,responseConfigs:nf},instanceConfig:{maxBodyLength:1/0},logger:e,context:t};return wo.createInstance(n)??df()},df=()=>{let e=p.create({maxBodyLength:1/0});return e};var ff=T((exports,t)=>{t.exports=n;function n(e={}){let{ERR_PATHS_MUST_BE_STRINGS:t=()=>`fast-redact - Paths must be (non-empty) strings`,ERR_INVALID_PATH:n=e=>`fast-redact – Invalid path (${e})`}=e;return function({paths:e}){e.forEach(e=>{if(typeof e!=`string`)throw Error(t());try{if(/〇/.test(e))throw Error();let t=(e[0]===`[`?``:`.`)+e.replace(/^\*/,`〇`).replace(/\.\*/g,`.〇`).replace(/\[\*\]/g,`[〇]`);if(/\n|\r|;/.test(t)||/\/\*/.test(t))throw Error();Function(`
215
215
  'use strict'
216
216
  const o = new Proxy({}, { get: () => o, set: () => { throw Error() } });
217
217
  const 〇 = null;
@@ -290,4 +290,4 @@ var ul=9e15,dl=1e9,fl=`0123456789abcdef`,pl=`2.302585092994045684017991454684364
290
290
  ${r}
291
291
  ${e}
292
292
  return o
293
- `}}),vf=T((exports,t)=>{t.exports=n;function n(e){let{secret:t,censor:n,compileRestore:r,serialize:i,groupRedact:a,nestedRedact:o,wildcards:s,wcLen:c}=e,l=[{secret:t,censor:n,compileRestore:r}];return i!==!1&&l.push({serialize:i}),c>0&&l.push({groupRedact:a,nestedRedact:o,wildcards:s,wcLen:c}),Object.assign(...l)}}),yf=T((exports,t)=>{let n=ff(),r=mf(),i=hf(),a=_f(),{groupRedact:o,nestedRedact:s}=gf(),c=vf(),l=pf(),u=n(),d=e=>e;d.restore=d;let f=`[REDACTED]`;p.rx=l,p.validator=n,t.exports=p;function p(e={}){let t=Array.from(new Set(e.paths||[])),n=`serialize`in e&&(e.serialize===!1||typeof e.serialize==`function`)?e.serialize:JSON.stringify,l=e.remove;if(l===!0&&n!==JSON.stringify)throw Error(`fast-redact – remove option may only be set when serializer is JSON.stringify`);let p=l===!0?void 0:`censor`in e?e.censor:f,m=typeof p==`function`,h=m&&p.length>1;if(t.length===0)return n||d;u({paths:t,serialize:n,censor:p});let{wildcards:g,wcLen:_,secret:v}=r({paths:t,censor:p}),y=a(),b=`strict`in e?e.strict:!0;return i({secret:v,wcLen:_,serialize:n,strict:b,isCensorFct:m,censorFctTakesPath:h},c({secret:v,censor:p,compileRestore:y,serialize:n,groupRedact:o,nestedRedact:s,wildcards:g,wcLen:_}))}}),bf=E(yf(),1);const xf=[`client_secret`,`access_token`,`refresh_token`,`api_key`,`password`,`job_board_token`,`private_key`,`certificate`,`service_user_token`,`key_id`,`secret_key`,`provhash`,`admin_key`,`session_key`,`id_token`,`authorization`,`bh_rest_token`,`external_trigger_token`,`tempauth`],Sf=[`req.headers.authorization`,`req.headers.cookie`,`req.headers.cookies`,`req.headers["set-cookie"]`,`req.headers["set-cookies"]`,`req.headers.httpsAgent.options.cert`,`req.headers.httpsAgent.options.key`,`req.headers["x-stackone-external-trigger-token"]`,`error.config.headers.authorization`,`error.config.data`,`error.config.headers.cookie`,`error.config.headers.cookies`,`error.config.headers["set-cookie"]`,`error.config.headers["set-cookies"]`,`error.config.httpsAgent.options.cert`,`error.config.httpsAgent.options.key`,`err.config.headers.authorization`,`err.config.data`,`err.config.headers.cookie`,`err.config.headers.cookies`,`err.config.headers["set-cookie"]`,`err.config.headers["set-cookies"]`,`err.config.httpsAgent.options.cert`,`err.config.httpsAgent.options.key`,`res.headers.authorization`,`res.headers.cookie`,`res.headers.cookies`,`res.headers["set-cookie"]`,`res.headers["set-cookies"]`,`res.headers.httpsAgent.options.cert`,`res.headers.httpsAgent.options.key`,`context.credentials`,...xf],Cf=`**redacted**`;let wf=function(e){return e.FULL=`FULL`,e.PARTIAL=`PARTIAL`,e}({});const Tf=e=>Cf,Ef=e=>typeof e==`string`?e.startsWith(Cf)?e:e.length<10?Cf:`${Cf}${e.slice(-5)}`:Cf,Df=(e=[],t=!0)=>{if(!t)return[];let n=e.map(e=>kf(e));return[...e,...n]},Of=(e=[],t=!0)=>{if(!t)return[];let n=new Set;return e.forEach(e=>{if(n.add(e),e.includes(`_`)){let t=e.replace(/_([a-z])/g,(e,t)=>t.toUpperCase());n.add(t)}else{let t=e.replace(/([A-Z])/g,`_$1`).toLowerCase();n.add(t)}}),Array.from(n)},kf=e=>{let t=jf(e);return t||Af(e)},Af=e=>{let t=e.split(`.`);if(t.length<2)return Mf(e);let n=t.pop()??``,r=Mf(n);return[...t,r].join(`.`)},jf=e=>{let t=e.lastIndexOf(`[`),n=e.indexOf(`]`,t);if(t===-1||n===-1)return;let r=e.slice(t,n+1),i=r.replace(/(["'])([^"']*)(["'])/g,(e,t,n)=>n?t+Mf(n)+t:t+t);return`${e.slice(0,t)}${i}${e.slice(n+1)}`},Mf=e=>`${e.charAt(0).toUpperCase()}${e.slice(1)}`,Nf=Df(Sf),Pf=Of(xf),Ff={[wf.FULL]:Tf,[wf.PARTIAL]:Ef},If={[wf.FULL]:(0,bf.default)({paths:Nf,serialize:!1,censor:Ff[wf.FULL]}),[wf.PARTIAL]:(0,bf.default)({paths:Nf,serialize:!1,censor:Ff[wf.PARTIAL]})},Lf=(t,n=wf.FULL)=>s(t)||typeof t!=`object`||!t?t:If[n](e(t)),Rf=(e,t=wf.FULL,n)=>{if(!s(e))try{let n=new URL(e),r=[...n.searchParams].reduce((e,[n,r])=>{let i=n.toLowerCase();return e.set(n,Pf.some(e=>e.toLowerCase()===i)?Ff[t](r):r),e},new URLSearchParams);return`${n.origin}${n.pathname}${r.toString()?`?`+r:``}${n.hash}`}catch(t){return n?.warning({message:`Invalid URL provided, unable to redact`,context:{value:e,error:t},category:`redactUrl`}),e}},zf=(e,t=wf.FULL,n)=>{if(!s(e))try{let[n,r]=e.split(`?`);if(!r)return e;let i=[...new URLSearchParams(r)].reduce((e,[n,r])=>{let i=n.toLowerCase();return e.set(n,Pf.some(e=>e.toLowerCase()===i)?Ff[t](r):r),e},new URLSearchParams);return`${n}?${i}`}catch(t){return n?.warning({message:`Invalid path provided, unable to redact`,context:{value:e,error:t},category:`redactPath`}),e}},Bf=(e,t=wf.FULL)=>{if(!s(e))return typeof e==`string`?Ff[t](e):Object.entries(e).reduce((e,[n,r])=>(e[n]=Pf.some(e=>e.toLowerCase()===n.toLowerCase())?Ff[t](r):r,e),{})};var Vf=class e{#transportFactory;#getRedisClient;#logger;#redisClientConfig;#errorMappingFn;#redisClient;constructor({transportFactory:e=cf,getRedisClient:t=A,logger:n,redisClientConfig:r,errorMappingFn:i}={}){this.#transportFactory=e,this.#getRedisClient=t,this.#logger=n,this.#redisClientConfig=r,this.#errorMappingFn=i}#generateCacheKey({url:e,payload:t,method:n,context:r}){let a=20;if(!r?.accountSecureId||r.accountSecureId.length<a||!e||!n)return null;let o=t?i(t):``;return`${r.accountSecureId}-${n.toUpperCase()}${o}-${e}`}async#getCachedResponse({url:t,payload:n,method:r,cacheTTL:i,context:a}){if(!this.#redisClient||!i||i<=0)return null;let o=this.#generateCacheKey({url:t,payload:n,method:r,context:a});if(!o)return null;let s=await this.#redisClient.getData(o);return s?(this.#logger?.debug({category:e.name,message:`Cache hit for key [${o}].`}),s):(this.#logger?.debug({category:e.name,message:`Cache miss for key [${o}].`}),null)}async#cacheResponse({url:t,payload:n,method:r,cacheTTL:i,context:a,response:o}){if(!this.#redisClient||!i||i<=0)return!1;let s=this.#generateCacheKey({url:t,payload:n,method:r,context:a});return s?(this.#logger?.debug({category:e.name,message:`Caching result for key [${s}].`}),this.#redisClient.setData({key:s,value:o,cacheTTL:i*60})):!1}async request({headers:t={},url:n,method:r=`get`,maxRedirects:i=0,responseType:a,cacheTTL:o,context:c,traceId:l,payload:u,httpsAgent:f,httpAgent:p}){try{d(this.#redisClientConfig)&&s(this.#redisClient)&&(this.#redisClient=await this.#getRedisClient(this.#redisClientConfig,this.#logger));let e=this.#normalizeHeaders(t),m=await this.#getCachedResponse({url:n,payload:u,method:r,cacheTTL:o,context:c});if(m)return{...m,responseTime:new Date};let h=Eo.getInstance(),g=d(l)?await h.get(l):null,_=g?.signal,v=await this.#transportFactory({redisClientConfig:this.#redisClientConfig,logger:this.#logger,context:c}),y=await v.request({headers:e,url:n,method:r,maxRedirects:i,responseType:a,data:this.#getSafePayload(u,e),httpsAgent:f,httpAgent:p,signal:_}),b={data:y.data,status:y.status,body:u,method:r,headers:this.#extractAxiosHeaders(y.headers),requestUrl:n,responseType:y?.config?.responseType,responseTime:new Date};return await this.#cacheResponse({url:n,payload:u,method:r,cacheTTL:o,context:c,response:b}),b}catch(t){let i=t;i.url=Rf(n),this.#logger?.warning({category:e.name,message:`Request error [${r?.toUpperCase()} ${i.url}]: ${i.message}.`,error:i});let a=this.#mapErrorToHttpException(i);throw d(a)?a:t}}async get({headers:e,url:t,maxRedirects:n,cacheTTL:r,context:i,traceId:a}){return this.request({url:t,method:`get`,headers:e,maxRedirects:n,cacheTTL:r,context:i,traceId:a})}async post({headers:e,url:t,maxRedirects:n,cacheTTL:r,context:i,traceId:a,payload:o}){return this.request({url:t,method:`post`,headers:e,maxRedirects:n,cacheTTL:r,context:i,traceId:a,payload:o})}#normalizeHeaders(e){if(!e)return{};let t={};return Object.keys(e).forEach(n=>{t[n.toLowerCase()]=e[n]||``}),t}#extractAxiosHeaders(e){if(!e)return{};let t={};return Object.keys(e).forEach(n=>{t[n]=e[n]||``}),t}#isFormUrlEncoded(e){return e[`content-type`]===`application/x-www-form-urlencoded`}#getSafePayload(e,t){if(e)return this.#isFormUrlEncoded(t)?y.stringify(e):e}#mapErrorToHttpException(e){if(m(e)&&this.#errorMappingFn)return this.#errorMappingFn(e)}};const Hf=(e,t,n)=>new Vf({redisClientConfig:e,logger:t,errorMappingFn:n});var Uf=class{static httpClientInstance=null;static async getInstance({getHttpClient:e=Hf,redisClientConfig:t,logger:n,errorMappingFn:r}){return this.httpClientInstance??=e(t,n,r),this.httpClientInstance}static resetInstance(){this.httpClientInstance=null}};const Wf=[`get`,`post`,`put`,`delete`,`patch`],Gf=e=>e.reduce((e,t)=>(Array.isArray(e[t.in][t.name])?e[t.in][t.name]=e[t.in][t.name].concat(t.value):typeof e[t.in][t.name]==`object`&&typeof t.value==`object`?e[t.in][t.name]={...e[t.in][t.name],...t.value}:e[t.in][t.name]=t.in===`body`?t.value:String(t.value),e),{query:{},body:{},headers:{}}),Kf=[`query`,`body`,`headers`],qf=(e,t)=>{if(s(t)||t?.length===0||s(e))return{data:e.data,status:e.status,headers:e.headers,requestUrl:e.requestUrl,responseType:e.responseType,responseTime:e.responseTime,message:e.message};let n=t?.filter(t=>t.receivedStatus===e.status);if(n?.length)for(let t of n){let n=t.condition,r=b(n,e)===!0;if(s(n)||r)return{data:e.data,headers:e.headers,requestUrl:e.requestUrl,responseType:e.responseType,responseTime:e.responseTime,status:t.targetStatus,message:t?.message??So[t.targetStatus]??`Unknown error`}}return e},Jf=e=>d(e)&&e>=200&&e<=299,Yf=e=>d(e)&&e>=400&&e<=599,Xf=e=>d(e)&&e>=100&&e<=199;var Zf=class{async performRequest({httpClient:e,url:t,method:n,headers:r,body:i,customErrorConfigs:a}){let o;try{o=await e?.request({method:n,url:t,headers:r,maxRedirects:0,payload:i})}catch(e){if(s(e?.response))throw e;o=e.response}let c=qf(o,a);if(Yf(c?.status))throw new Co(c,c.message);return c}},Qf=class{static build(e=`rest`){if(e===`rest`)return new Zf;throw Error(`Unknown request client type: ${e}`)}};export{xo as CUSTOM_ERROR_CONFIG_SCHEMA,nt as ConcurrencyManager,ye as EventClient,Vf as HttpClient,Uf as HttpClientManager,So as HttpErrorMessages,Wf as HttpMethods,Co as HttpResponseError,wo as HttpTransportFactory,Eo as InstanceManager,ie as LockManager,he as MemoryStore,Ie as QueueManager,Bo as RateLimitManager,be as RedisClient,Qf as RequestClientFactory,Kf as RequestParameterLocations,we as ScriptManager,Te as SubscriptionManager,re as createAuthorizationHeaders,cf as getTransportInstance,Yf as isFailedStatusCode,Xf as isInfoStatusCode,Jf as isSuccessStatusCode,Gf as parseRequestParameters};
293
+ `}}),vf=T((exports,t)=>{t.exports=n;function n(e){let{secret:t,censor:n,compileRestore:r,serialize:i,groupRedact:a,nestedRedact:o,wildcards:s,wcLen:c}=e,l=[{secret:t,censor:n,compileRestore:r}];return i!==!1&&l.push({serialize:i}),c>0&&l.push({groupRedact:a,nestedRedact:o,wildcards:s,wcLen:c}),Object.assign(...l)}}),yf=T((exports,t)=>{let n=ff(),r=mf(),i=hf(),a=_f(),{groupRedact:o,nestedRedact:s}=gf(),c=vf(),l=pf(),u=n(),d=e=>e;d.restore=d;let f=`[REDACTED]`;p.rx=l,p.validator=n,t.exports=p;function p(e={}){let t=Array.from(new Set(e.paths||[])),n=`serialize`in e&&(e.serialize===!1||typeof e.serialize==`function`)?e.serialize:JSON.stringify,l=e.remove;if(l===!0&&n!==JSON.stringify)throw Error(`fast-redact – remove option may only be set when serializer is JSON.stringify`);let p=l===!0?void 0:`censor`in e?e.censor:f,m=typeof p==`function`,h=m&&p.length>1;if(t.length===0)return n||d;u({paths:t,serialize:n,censor:p});let{wildcards:g,wcLen:_,secret:v}=r({paths:t,censor:p}),y=a(),b=`strict`in e?e.strict:!0;return i({secret:v,wcLen:_,serialize:n,strict:b,isCensorFct:m,censorFctTakesPath:h},c({secret:v,censor:p,compileRestore:y,serialize:n,groupRedact:o,nestedRedact:s,wildcards:g,wcLen:_}))}}),bf=E(yf(),1);const xf=[`client_secret`,`access_token`,`refresh_token`,`api_key`,`password`,`job_board_token`,`private_key`,`certificate`,`service_user_token`,`key_id`,`secret_key`,`provhash`,`admin_key`,`session_key`,`id_token`,`authorization`,`bh_rest_token`,`external_trigger_token`,`tempauth`],Sf=[`req.headers.authorization`,`req.headers.cookie`,`req.headers.cookies`,`req.headers["set-cookie"]`,`req.headers["set-cookies"]`,`req.headers.httpsAgent.options.cert`,`req.headers.httpsAgent.options.key`,`req.headers["x-stackone-external-trigger-token"]`,`error.config.headers.authorization`,`error.config.data`,`error.config.headers.cookie`,`error.config.headers.cookies`,`error.config.headers["set-cookie"]`,`error.config.headers["set-cookies"]`,`error.config.httpsAgent.options.cert`,`error.config.httpsAgent.options.key`,`err.config.headers.authorization`,`err.config.data`,`err.config.headers.cookie`,`err.config.headers.cookies`,`err.config.headers["set-cookie"]`,`err.config.headers["set-cookies"]`,`err.config.httpsAgent.options.cert`,`err.config.httpsAgent.options.key`,`res.headers.authorization`,`res.headers.cookie`,`res.headers.cookies`,`res.headers["set-cookie"]`,`res.headers["set-cookies"]`,`res.headers.httpsAgent.options.cert`,`res.headers.httpsAgent.options.key`,`context.credentials`,...xf],Cf=`**redacted**`;let wf=function(e){return e.FULL=`FULL`,e.PARTIAL=`PARTIAL`,e}({});const Tf=e=>Cf,Ef=e=>typeof e==`string`?e.startsWith(Cf)?e:e.length<10?Cf:`${Cf}${e.slice(-5)}`:Cf,Df=(e=[],t=!0)=>{if(!t)return[];let n=e.map(e=>kf(e));return[...e,...n]},Of=(e=[],t=!0)=>{if(!t)return[];let n=new Set;return e.forEach(e=>{if(n.add(e),e.includes(`_`)){let t=e.replace(/_([a-z])/g,(e,t)=>t.toUpperCase());n.add(t)}else{let t=e.replace(/([A-Z])/g,`_$1`).toLowerCase();n.add(t)}}),Array.from(n)},kf=e=>{let t=jf(e);return t||Af(e)},Af=e=>{let t=e.split(`.`);if(t.length<2)return Mf(e);let n=t.pop()??``,r=Mf(n);return[...t,r].join(`.`)},jf=e=>{let t=e.lastIndexOf(`[`),n=e.indexOf(`]`,t);if(t===-1||n===-1)return;let r=e.slice(t,n+1),i=r.replace(/(["'])([^"']*)(["'])/g,(e,t,n)=>n?t+Mf(n)+t:t+t);return`${e.slice(0,t)}${i}${e.slice(n+1)}`},Mf=e=>`${e.charAt(0).toUpperCase()}${e.slice(1)}`,Nf=Df(Sf),Pf=Of(xf),Ff={[wf.FULL]:Tf,[wf.PARTIAL]:Ef},If={[wf.FULL]:(0,bf.default)({paths:Nf,serialize:!1,censor:Ff[wf.FULL]}),[wf.PARTIAL]:(0,bf.default)({paths:Nf,serialize:!1,censor:Ff[wf.PARTIAL]})},Lf=(t,n=wf.FULL)=>s(t)||typeof t!=`object`||!t?t:If[n](e(t)),Rf=(e,t=wf.FULL,n)=>{if(!s(e))try{let n=new URL(e),r=[...n.searchParams].reduce((e,[n,r])=>{let i=n.toLowerCase();return e.set(n,Pf.some(e=>e.toLowerCase()===i)?Ff[t](r):r),e},new URLSearchParams);return`${n.origin}${n.pathname}${r.toString()?`?`+r:``}${n.hash}`}catch(t){return n?.warning({message:`Invalid URL provided, unable to redact`,context:{value:e,error:t},category:`redactUrl`}),e}},zf=(e,t=wf.FULL,n)=>{if(!s(e))try{let[n,r]=e.split(`?`);if(!r)return e;let i=[...new URLSearchParams(r)].reduce((e,[n,r])=>{let i=n.toLowerCase();return e.set(n,Pf.some(e=>e.toLowerCase()===i)?Ff[t](r):r),e},new URLSearchParams);return`${n}?${i}`}catch(t){return n?.warning({message:`Invalid path provided, unable to redact`,context:{value:e,error:t},category:`redactPath`}),e}},Bf=(e,t=wf.FULL)=>{if(!s(e))return typeof e==`string`?Ff[t](e):Object.entries(e).reduce((e,[n,r])=>(e[n]=Pf.some(e=>e.toLowerCase()===n.toLowerCase())?Ff[t](r):r,e),{})};var Vf=class e{#transportFactory;#getRedisClient;#logger;#redisClientConfig;#errorMappingFn;#redisClient;constructor({transportFactory:e=cf,getRedisClient:t=A,logger:n,redisClientConfig:r,errorMappingFn:i}={}){this.#transportFactory=e,this.#getRedisClient=t,this.#logger=n,this.#redisClientConfig=r,this.#errorMappingFn=i}#generateCacheKey({url:e,payload:t,method:n,context:r}){let a=20;if(!r?.accountSecureId||r.accountSecureId.length<a||!e||!n)return null;let o=t?i(t):``;return`${r.accountSecureId}-${n.toUpperCase()}${o}-${e}`}async#getCachedResponse({url:t,payload:n,method:r,cacheTTL:i,context:a}){if(!this.#redisClient||!i||i<=0)return null;let o=this.#generateCacheKey({url:t,payload:n,method:r,context:a});if(!o)return null;let s=await this.#redisClient.getData(o);return s?(this.#logger?.debug({category:e.name,message:`Cache hit for key [${o}].`}),s):(this.#logger?.debug({category:e.name,message:`Cache miss for key [${o}].`}),null)}async#cacheResponse({url:t,payload:n,method:r,cacheTTL:i,context:a,response:o}){if(!this.#redisClient||!i||i<=0)return!1;let s=this.#generateCacheKey({url:t,payload:n,method:r,context:a});return s?(this.#logger?.debug({category:e.name,message:`Caching result for key [${s}].`}),this.#redisClient.setData({key:s,value:o,cacheTTL:i*60})):!1}async request({headers:t={},url:n,method:r=`get`,maxRedirects:i=0,responseType:a,cacheTTL:o,context:c,traceId:l,payload:u,httpsAgent:f,httpAgent:p}){try{d(this.#redisClientConfig)&&s(this.#redisClient)&&(this.#redisClient=await this.#getRedisClient(this.#redisClientConfig,this.#logger));let e=this.#normalizeHeaders(t),m=await this.#getCachedResponse({url:n,payload:u,method:r,cacheTTL:o,context:c});if(m)return{...m,responseTime:new Date};let h=Eo.getInstance(),g=d(l)?await h.get(l):null,_=g?.signal,v=await this.#transportFactory({redisClientConfig:this.#redisClientConfig,logger:this.#logger,context:c}),y=await v.request({headers:e,url:n,method:r,maxRedirects:i,responseType:a,data:this.#getSafePayload(u,e),httpsAgent:f,httpAgent:p,signal:_}),b={data:y.data,status:y.status,body:u,method:r,headers:this.#extractAxiosHeaders(y.headers),requestUrl:n,responseType:y?.config?.responseType,responseTime:new Date};return await this.#cacheResponse({url:n,payload:u,method:r,cacheTTL:o,context:c,response:b}),b}catch(t){let i=t;i.url=Rf(n),this.#logger?.warning({category:e.name,message:`Request error [${r?.toUpperCase()} ${i.url}]: ${i.message}.`,error:i});let a=this.#mapErrorToHttpException(i);throw d(a)?a:t}}async get({headers:e,url:t,maxRedirects:n,cacheTTL:r,context:i,traceId:a}){return this.request({url:t,method:`get`,headers:e,maxRedirects:n,cacheTTL:r,context:i,traceId:a})}async post({headers:e,url:t,maxRedirects:n,cacheTTL:r,context:i,traceId:a,payload:o}){return this.request({url:t,method:`post`,headers:e,maxRedirects:n,cacheTTL:r,context:i,traceId:a,payload:o})}#normalizeHeaders(e){if(!e)return{};let t={};return Object.keys(e).forEach(n=>{t[n.toLowerCase()]=e[n]||``}),t}#extractAxiosHeaders(e){if(!e)return{};let t={};return Object.keys(e).forEach(n=>{t[n]=e[n]||``}),t}#isFormUrlEncoded(e){return e[`content-type`]===`application/x-www-form-urlencoded`}#getSafePayload(e,t){if(e)return this.#isFormUrlEncoded(t)?y.stringify(e):e}#mapErrorToHttpException(e){if(m(e)&&this.#errorMappingFn)return this.#errorMappingFn(e)}};const Hf=(e,t,n)=>new Vf({redisClientConfig:e,logger:t,errorMappingFn:n});var Uf=class{static httpClientInstance=null;static async getInstance({getHttpClient:e=Hf,redisClientConfig:t,logger:n,errorMappingFn:r}){return this.httpClientInstance??=e(t,n,r),this.httpClientInstance}static resetInstance(){this.httpClientInstance=null}};const Wf=[`get`,`post`,`put`,`delete`,`patch`],Gf=e=>e.reduce((e,t)=>(Array.isArray(e[t.in][t.name])?e[t.in][t.name]=e[t.in][t.name].concat(t.value):typeof e[t.in][t.name]==`object`&&typeof t.value==`object`?e[t.in][t.name]={...e[t.in][t.name],...t.value}:e[t.in][t.name]=t.in===`body`?t.value:String(t.value),e),{query:{},body:{},headers:{}}),Kf=[`query`,`body`,`headers`],qf=(e,t)=>{if(s(t)||t?.length===0||s(e))return{data:e.data,status:e.status,headers:e.headers,requestUrl:e.requestUrl,responseType:e.responseType,responseTime:e.responseTime,message:e.message};let n=t?.filter(t=>t.receivedStatus===e.status);if(n?.length)for(let t of n){let n=t.condition,r=b(n,e)===!0;if(s(n)||r)return{data:e.data,headers:e.headers,requestUrl:e.requestUrl,responseType:e.responseType,responseTime:e.responseTime,status:t.targetStatus,message:t?.message??So[t.targetStatus]??`Unknown error`}}return e},Jf=e=>d(e)&&e>=200&&e<=299,Yf=e=>d(e)&&e>=400&&e<=599,Xf=e=>d(e)&&e>=100&&e<=199;var Zf=class{async performRequest({httpClient:e,url:t,method:n,headers:r,body:i,customErrorConfigs:a}){let o;try{o=await e?.request({method:n,url:t,headers:r,maxRedirects:0,payload:i})}catch(e){if(s(e?.response))throw e;o=e.response}let c=qf(o,a);if(Yf(c?.status))throw new Co(c,c.message);return c}},Qf=class{static build(e=`rest`){if(e===`rest`)return new Zf;throw Error(`Unknown request client type: ${e}`)}};export{xo as CUSTOM_ERROR_CONFIG_SCHEMA,nt as ConcurrencyManager,ye as EventClient,Vf as HttpClient,Uf as HttpClientManager,So as HttpErrorMessages,Wf as HttpMethods,Co as HttpResponseError,wo as HttpTransportFactory,Eo as InstanceManager,ie as LockManager,he as MemoryStore,Ie as QueueManager,Bo as RateLimitManager,be as RedisClient,Qf as RequestClientFactory,Kf as RequestParameterLocations,we as ScriptManager,Te as SubscriptionManager,Hf as buildHttpClientInstance,re as createAuthorizationHeaders,cf as getTransportInstance,Yf as isFailedStatusCode,Xf as isInfoStatusCode,Jf as isSuccessStatusCode,Gf as parseRequestParameters};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackone/transport",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",