@configdirector/openfeature-server-provider 0.9.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ConfigDirector
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is furnished
10
+ to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # ConfigDirector OpenFeature Node.js Provider
2
+
3
+ This is the OpenFeature Node.js Provider for [ConfigDirector](https://www.configdirector.com).
4
+
5
+ ## Documentation
6
+
7
+ Refer to the [official documentation for the OpenFeature Node.js Provider](https://docs.configdirector.com/sdks/server/openfeature-node), and to the [official documentation for the OpenFeature Node.js SDK](https://openfeature.dev/docs/reference/sdks/server/javascript/).
8
+
9
+ There is also [a quickstart guide for ConfigDirector and any of our SDKs](https://docs.configdirector.com/getting-started/quickstart).
10
+
11
+ ## Getting Help
12
+
13
+ Reach out to us via https://www.configdirector.com/support
@@ -0,0 +1,5 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(e&&(t=e(e=0)),t),s=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),c=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,a)=>(a=n==null?{}:e(i(n)),l(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),d=e=>a.call(e,`module.exports`)?e[`module.exports`]:l(t({},`__esModule`,{value:!0}),e);let f=require(`@openfeature/server-sdk`),p=require(`node:events`);p=u(p);let m=require(`node:crypto`);var h=class e extends Error{constructor(t,n){super(t),this.name=`ConfigDirectorConnectionError`,this.status=n,Object.setPrototypeOf(this,e.prototype)}},g=class e extends Error{constructor(t){super(t),this.name=`ConfigDirectorValidationError`,Object.setPrototypeOf(this,e.prototype)}},_=class e extends Error{constructor(t){super(t),this.name=`StreamClosedError`,Object.setPrototypeOf(this,e.prototype)}},v=class e extends Error{constructor(t){super(t),this.name=`MissingResponseBodyError`,Object.setPrototypeOf(this,e.prototype)}},y=class e extends Error{constructor(t){super(t),this.name=`InvalidOptionError`,Object.setPrototypeOf(this,e.prototype)}},b=class e extends Error{constructor(t){super(t),this.name=`ValueOutOfRangeError`,Object.setPrototypeOf(this,e.prototype)}},ee=class{constructor(e){this.isFirstChunk=!0,this.bufferedInput=``,this.currentEvent={data:``},this.currentEvent={data:``},this.onEvent=e.onEvent??(()=>{}),this.onRetry=e.onRetry,this.onComment=e.onComment}parse(e){let t=e;this.isFirstChunk&&(this.isFirstChunk=!1,t.startsWith(``)?t=t.slice(1):t.startsWith(``)&&(t=t.slice(3)));let n=this.scanLines(this.bufferedInput+t);for(let e of n)this.dispatchLine(e)}finish(){this.bufferedInput=``}scanLines(e){let t=[],n=0,r=0;for(;r<e.length;){let i=e[r];i===`\r`||i===`
2
+ `?(t.push(e.slice(n,r)),i===`\r`&&e[r+1]===`
3
+ `&&r++,r++,n=r):r++}return this.bufferedInput=e.slice(n),t}dispatchLine(e){if(e.startsWith(`:`)){this.onComment?.(this.extractValue(e,1));return}if(e===``){this.emitEvent();return}this.applyField(this.parseField(e))}emitEvent(){let e=this.currentEvent.data.endsWith(`
4
+ `)?this.currentEvent.data.slice(0,-1):this.currentEvent.data;e!==``&&this.onEvent({...this.currentEvent,id:this.lastEventId,data:e}),this.currentEvent={data:``}}applyField(e){switch(e.field){case`event`:this.currentEvent.type=e.value;break;case`data`:this.currentEvent.data+=e.value+`
5
+ `;break;case`id`:e.value.includes(`\0`)||(this.lastEventId=e.value);break;case`retry`:/^\d+$/.test(e.value)&&this.onRetry?.(Number.parseInt(e.value,10));break;default:break}}parseField(e){let t=e.indexOf(`:`);return t===-1?{field:e,value:``}:{field:e.slice(0,t),value:this.extractValue(e,t+1)}}extractValue(e,t){return e[t]===` `?e.slice(t+1):e.slice(t)}};let x=function(e){return e.OPEN=`open`,e.CLOSED=`closed`,e.CONNECTING=`connecting`,e}({});var te=class{constructor(e){this.DEFAULT_SHOULD_RECONNECT=()=>!0,this.DEFAULT_CALCULATE_RECONNECT_DELAY=()=>this.serverReconnectionTime,this.reconnectAttempt=0,this.abortController=new AbortController,this._readyState=x.CLOSED,this.serverReconnectionTime=2e3,this.url=e.url.toString(),this.lastEventId=e.lastEventId,this.headers={Accept:`text/event-stream`,...e.headers},this.requestOptions={body:e.body,method:e.method??`GET`,mode:e.mode,credentials:e.credentials,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy},this._fetch=e.fetch??((e,t)=>fetch(e,t)),this._onError=this.resolveCallback(e.onError,()=>{},`onError`),this._onConnect=this.resolveCallback(e.onConnect,()=>{},`onConnect`),this._onDisconnect=this.resolveCallback(e.onDisconnect,()=>{},`onDisconnect`),this._onMessage=this.resolveCallback(e.onMessage,()=>{},`onMessage`),this._onComment=this.resolveCallback(e.onComment,()=>{},`onComment`),this._shouldReconnect=this.resolveCallback(e.shouldReconnect,this.DEFAULT_SHOULD_RECONNECT,`shouldReconnect`),this._calculateReconnectDelay=this.resolveCallback(e.calculateReconnectDelay,this.DEFAULT_CALCULATE_RECONNECT_DELAY,`calculateReconnectDelay`)}set onError(e){this._onError=this.resolveCallback(e,()=>{},`onError`)}set onMessage(e){this._onMessage=this.resolveCallback(e,()=>{},`onMessage`)}set onComment(e){this._onComment=this.resolveCallback(e,()=>{},`onComment`)}set onConnect(e){this._onConnect=this.resolveCallback(e,()=>{},`onConnect`)}set onDisconnect(e){this._onDisconnect=this.resolveCallback(e,()=>{},`onDisconnect`)}set shouldReconnect(e){this._shouldReconnect=this.resolveCallback(e,this.DEFAULT_SHOULD_RECONNECT,`shouldReconnect`)}set calculateReconnectDelay(e){this._calculateReconnectDelay=this.resolveCallback(e,this.DEFAULT_CALCULATE_RECONNECT_DELAY,`shouldReconnect`)}get readyState(){return this._readyState}connect(){this._readyState===x.CLOSED&&(this.reconnectAttempt=0,this.initiateConnection())}close(){clearTimeout(this.reconnectTimeout),this._readyState=x.CLOSED,this.abortController.abort()}initiateConnection(){this.abortController=new AbortController,this._readyState=x.CONNECTING,this._fetch(this.url,{...this.requestOptions,headers:this.buildRequestHeaders(),signal:this.abortController.signal,cache:`no-store`}).then(e=>this.handleFetchResponse(e)).catch(e=>{if(e.name===`AbortError`||this.abortController.signal.aborted){this.close();return}this._onError(e),this.scheduleReconnect({error:e})})}async handleFetchResponse(e){let{body:t,status:n}=e;if(n===204){this.disconnected();return}if(n>=400){this.scheduleReconnect({status:n});return}if(!t)throw new v(`The server response did not have a body`);this._readyState=x.OPEN,this._onConnect(),this.reconnectAttempt=0;let r=new ee({onEvent:e=>{typeof e.id==`string`&&(this.lastEventId=e.id),this._onMessage(e)},onComment:e=>this._onComment(e),onRetry:e=>this.serverReconnectionTime=e});await this.readResponseStream(t,r),this.scheduleReconnect({status:n,error:new _(`The server response stream was closed`)})}async readResponseStream(e,t){let n=e.getReader(),r=new TextDecoder,i=!1;for(;!i;){let e=await n.read();e.value&&t.parse(r.decode(e.value,{stream:!0})),i=e.done}t.finish()}disconnected(){clearTimeout(this.reconnectTimeout),this._readyState=x.CLOSED,this._onDisconnect()}buildRequestHeaders(){let e=this.lastEventId?{"Last-Event-ID":this.lastEventId}:void 0;return{...this.headers,...e}}scheduleReconnect(e){if(this.abortController.signal.aborted)return;clearTimeout(this.reconnectTimeout),this.reconnectAttempt+=1;let t={attempt:this.reconnectAttempt,status:e.status,error:e.error,serverReconnectionTime:this.serverReconnectionTime};if(!this._shouldReconnect(t)){this.disconnected();return}this._readyState=x.CONNECTING;let n=this._calculateReconnectDelay(t);(!Number.isFinite(n)||n<1||n>1e3*60*60)&&(this._onError(new b(`The calculated reconnect delay is out of range: ${n}. Defaulting to ${this.serverReconnectionTime}`)),n=this.serverReconnectionTime),this.reconnectTimeout=setTimeout(()=>this.initiateConnection(),n)}resolveCallback(e,t,n){if(e==null)return t;if(typeof e!=`function`)throw new y(`${n} must be a function`);return e}};const ne=e=>new te(e);var re=class{constructor(e){this.options=e,this.eventEmitter=new p.EventEmitter,this.options=e,this.logger=e.logger,this.url=new URL(`server/sse/v1`,e.baseUrl)}async connect(e){this.eventSource&&this.close();let t=new Promise((e,t)=>{this.eventSource=ne({url:this.url,method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({metaContext:this.options.metaContext,serverSdkKey:this.options.serverSdkKey}),onMessage:({data:e})=>{this.dispatchMessage(e)},onConnect:()=>{this.logger.debug(`[StreamingTransport] Connected`),e(this)},shouldReconnect:e=>{let n=!this.isStatusFatal(e.status);return n||t(this.prepareFatalError(e.status,e.error)),n},calculateReconnectDelay:e=>{let t=2**Math.min(e.attempt,9)*1e3,n=`[StreamingTransport] Scheduling reconnect attempt #${e.attempt} in ${t}ms.`;return e.attempt<=5?this.logger.info(n):this.logger.warn(n),t},onDisconnect:()=>{this.logger.debug(`[StreamingTransport] Disconnected`)}}),this.eventSource.connect()});return Promise.race([t,new Promise(t=>{setTimeout(()=>t(this),e)})])}dispatchMessage(e){try{let t=JSON.parse(e);this.eventEmitter.emit(`configBundleReceived`,t)}catch(e){this.logger.error(`[StreamingTransport] Error parsing and dispatching config data update: `,e)}}prepareFatalError(e,t){let n=e??0;return new h(`${`Connection failed with status: ${e??`unknown`}.`}${t?` Error: ${t}.`:``} This is an unrecoverable error, will not attempt to reconnect.`,n)}isStatusFatal(e){return!!e&&e>=400&&e<500}get isConnected(){return this.eventSource?.readyState==`open`}on(e,t){this.eventEmitter.on(e,t)}off(e,t){t?this.eventEmitter.off(e,t):this.eventEmitter.removeAllListeners(e)}clear(){this.eventEmitter.removeAllListeners()}close(){this.eventSource?.close()}dispose(){this.close(),this.clear()}},ie=class{constructor(){this.fatalError=!1,this.pollingIntervalSeconds=60}clearPollingInterval(){clearInterval(this.pollingInterval)}schedulePollingInterval(e){clearInterval(this.pollingInterval),!(this.pollingIntervalSeconds<=0)&&(this.pollingInterval=setInterval(e,this.pollingIntervalSeconds*1e3))}async handleNonOkResponse(e){if(!e.ok)throw this.isStatusFatal(e.status)?(this.fatalError=!0,this.prepareFatalResponseStatusError(e.status,await e.text())):new h(`Connection failed with status: ${e.status}`,e.status)}handleFetchError(e){throw this.isFetchErrorFatal(e)?(this.fatalError=!0,this.close(),new h(`Connection failed with fatal error: ${e}. This is an unrecoverable error, retry attempts will be ignored.`)):e instanceof SyntaxError?new h(`Failed to parse the response from the server: ${e}`):new h(`Connection failed with error: ${e}.`)}prepareFatalResponseStatusError(e,t){let n=e??0;return new h(`${`Connection failed with status: ${e??`unknown`}`}${(t?.trim()?.length??0)>0?` (${t})`:``}. This is an unrecoverable error, retry attempts will be ignored.`,n)}isStatusFatal(e){return!!e&&e>=400&&e<500}isFetchErrorFatal(e){return e?.name===`NotAllowedError`?!0:e instanceof TypeError}get isConnected(){return this.pollingInterval!==void 0}close(){clearInterval(this.pollingInterval),this.pollingInterval=void 0}dispose(){this.close(),this.clear()}};const S=async(e,t,n,r)=>{let i=new AbortController,a=setTimeout(()=>{r.debug(`[fetchWithTimeout] Reached timeout, aborting request`),i.abort()},e);try{let e=await fetch(typeof t==`string`||t instanceof Request?t:t.toString(),{...n,signal:i.signal});return clearTimeout(a),e}catch(e){throw r.warn(`[fetchWithTimeout] Fetch error: `,e),clearTimeout(a),e}};var C=class extends ie{constructor(e){super(),this.options=e,this.eventEmitter=new p.EventEmitter,this.options=e,this.logger=e.logger,this.url=new URL(`server/polling/v1`,e.baseUrl),this.pollingIntervalSeconds=e.pollingInterval??60}async connect(e){return this.clearPollingInterval(),await this.fetchConfigs(e),this.schedulePollingInterval(()=>{this.fetchConfigs(e).catch(e=>{this.logger.error(`[PollingTransport] Error during polling:`,e)})}),this}async fetchConfigs(e){if(this.fatalError){this.logger.warn(`[PollingTransport] There was a prior unrecoverable error. Ignoring attempt to reconnect.`);return}try{let t=await S(e,this.url,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({metaContext:this.options.metaContext,serverSdkKey:this.options.serverSdkKey,lastUpdateTimestamp:this.lastUpdateTimestamp})},this.logger);if(await this.handleNonOkResponse(t),t.status===200){let e=JSON.parse(await t.text());this.lastUpdateTimestamp=e.timestamp,this.eventEmitter.emit(`configBundleReceived`,e)}}catch(e){this.handleFetchError(e)}}on(e,t){this.eventEmitter.on(e,t)}off(e,t){t?this.eventEmitter.off(e,t):this.eventEmitter.removeAllListeners(e)}clear(){this.eventEmitter.removeAllListeners()}},ae=class extends C{constructor(e){super(e),this.pollingIntervalSeconds=0}},oe=c({__addDisposableResource:()=>je,__assign:()=>O,__asyncDelegator:()=>Ce,__asyncGenerator:()=>Se,__asyncValues:()=>we,__await:()=>E,__awaiter:()=>ge,__classPrivateFieldGet:()=>Oe,__classPrivateFieldIn:()=>Ae,__classPrivateFieldSet:()=>ke,__createBinding:()=>k,__decorate:()=>le,__disposeResources:()=>Me,__esDecorate:()=>de,__exportStar:()=>ve,__extends:()=>se,__generator:()=>_e,__importDefault:()=>De,__importStar:()=>Ee,__makeTemplateObject:()=>Te,__metadata:()=>he,__param:()=>ue,__propKey:()=>pe,__read:()=>T,__rest:()=>ce,__rewriteRelativeImportExtension:()=>Ne,__runInitializers:()=>fe,__setFunctionName:()=>me,__spread:()=>ye,__spreadArray:()=>xe,__spreadArrays:()=>be,__values:()=>w,default:()=>Ie});function se(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);D(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function ce(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function le(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function ue(e,t){return function(n,r){t(n,r,e)}}function de(e,t,n,r,i,a){function o(e){if(e!==void 0&&typeof e!=`function`)throw TypeError(`Function expected`);return e}for(var s=r.kind,c=s===`getter`?`get`:s===`setter`?`set`:`value`,l=!t&&e?r.static?e:e.prototype:null,u=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,f=!1,p=n.length-1;p>=0;p--){var m={};for(var h in r)m[h]=h===`access`?{}:r[h];for(var h in r.access)m.access[h]=r.access[h];m.addInitializer=function(e){if(f)throw TypeError(`Cannot add initializers after decoration has completed`);a.push(o(e||null))};var g=(0,n[p])(s===`accessor`?{get:u.get,set:u.set}:u[c],m);if(s===`accessor`){if(g===void 0)continue;if(typeof g!=`object`||!g)throw TypeError(`Object expected`);(d=o(g.get))&&(u.get=d),(d=o(g.set))&&(u.set=d),(d=o(g.init))&&i.unshift(d)}else (d=o(g))&&(s===`field`?i.unshift(d):u[c]=d)}l&&Object.defineProperty(l,r.name,u),f=!0}function fe(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0}function pe(e){return typeof e==`symbol`?e:`${e}`}function me(e,t,n){return typeof t==`symbol`&&(t=t.description?`[${t.description}]`:``),Object.defineProperty(e,`name`,{configurable:!0,value:n?`${n} ${t}`:t})}function he(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function ge(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function _e(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function ve(e,t){for(var n in e)n!==`default`&&!Object.prototype.hasOwnProperty.call(t,n)&&k(t,e,n)}function w(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function T(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function ye(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(T(arguments[t]));return e}function be(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r}function xe(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function E(e){return this instanceof E?(this.v=e,this):new E(e)}function Se(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof E?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function Ce(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:E(e[r](t)),done:!1}:i?i(t):t}:i}}function we(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof w==`function`?w(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function Te(e,t){return Object.defineProperty?Object.defineProperty(e,`raw`,{value:t}):e.raw=t,e}function Ee(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=A(e),r=0;r<n.length;r++)n[r]!==`default`&&k(t,e,n[r]);return Pe(t,e),t}function De(e){return e&&e.__esModule?e:{default:e}}function Oe(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}function ke(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function Ae(e,t){if(t===null||typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Cannot use 'in' operator on non-object`);return typeof e==`function`?t===e:e.has(t)}function je(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t}function Me(e){function t(t){e.error=e.hasError?new Fe(t,e.error,`An error was suppressed during disposal.`):t,e.hasError=!0}var n,r=0;function i(){for(;n=e.stack.pop();)try{if(!n.async&&r===1)return r=0,e.stack.push(n),Promise.resolve().then(i);if(n.dispose){var a=n.dispose.call(n.value);if(n.async)return r|=2,Promise.resolve(a).then(i,function(e){return t(e),i()})}else r|=1}catch(e){t(e)}if(r===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return i()}function Ne(e,t){return typeof e==`string`&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,n,r,i,a){return n?t?`.jsx`:`.js`:r&&(!i||!a)?e:r+i+`.`+a.toLowerCase()+`js`}):e}var D,O,k,Pe,A,Fe,Ie,Le=o((()=>{D=function(e,t){return D=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},D(e,t)},O=function(){return O=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},O.apply(this,arguments)},k=Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),Pe=Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t},A=function(e){return A=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},A(e)},Fe=typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r},Ie={__extends:se,__assign:O,__rest:ce,__decorate:le,__param:ue,__esDecorate:de,__runInitializers:fe,__propKey:pe,__setFunctionName:me,__metadata:he,__awaiter:ge,__generator:_e,__createBinding:k,__exportStar:ve,__values:w,__read:T,__spread:ye,__spreadArrays:be,__spreadArray:xe,__await:E,__asyncGenerator:Se,__asyncDelegator:Ce,__asyncValues:we,__makeTemplateObject:Te,__importStar:Ee,__importDefault:De,__classPrivateFieldGet:Oe,__classPrivateFieldSet:ke,__classPrivateFieldIn:Ae,__addDisposableResource:je,__disposeResources:Me,__rewriteRelativeImportExtension:Ne}})),Re=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0})})),ze=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isInteger=e.isRoot=e.toPath=void 0,e.unescapeComponent=a,e.escapeComponent=o,e.parseJsonPointer=s,e.formatJsonPointer=c,e.isChild=l,e.isPathEqual=u,e.parent=d,e.isValidIndex=f;let t=/~1/g,n=/~0/g,r=/~/g,i=/\//g;function a(e){return e.indexOf(`~`)===-1?e:e.replace(t,`/`).replace(n,`~`)}function o(e){return e.indexOf(`/`)===-1&&e.indexOf(`~`)===-1?e:e.replace(r,`~0`).replace(i,`~1`)}function s(e){return e?e.slice(1).split(`/`).map(a):[]}function c(t){return(0,e.isRoot)(t)?``:`/`+t.map(e=>o(String(e))).join(`/`)}e.toPath=e=>typeof e==`string`?s(e):e;function l(e,t){if(e.length>=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function u(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}e.isRoot=e=>!e.length;function d(e){if(e.length<1)throw Error(`NO_PARENT`);return e.slice(0,e.length-1)}function f(e){if(typeof e==`number`)return!0;let t=Number.parseInt(e,10);return String(t)===e&&t>=0}e.isInteger=e=>{let t=e.length,n=0,r;for(;n<t;){if(r=e.charCodeAt(n),r>=48&&r<=57){n++;continue}return!1}return!0}})),Be=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validatePath=e.validateJsonPointer=void 0,e.validateJsonPointer=t=>{if(typeof t==`string`){if(t){if(t[0]!==`/`)throw Error(`POINTER_INVALID`);if(t.length>1024)throw Error(`POINTER_TOO_LONG`)}}else (0,e.validatePath)(t)};let{isArray:t}=Array;e.validatePath=e=>{if(!t(e))throw Error(`Invalid path.`);if(e.length>256)throw Error(`Path too long.`);for(let t of e)switch(typeof t){case`string`:case`number`:continue;default:throw Error(`Invalid path step.`)}}})),j=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hasOwnProperty=n;let t=Object.prototype.hasOwnProperty;function n(e,n){return t.call(e,n)}})),Ve=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.get=void 0;let t=j();e.get=(e,n)=>{let r=n.length,i;if(!r)return e;for(let a=0;a<r;a++)if(i=n[a],e instanceof Array){if(typeof i!=`number`){if(i===`-`)return;let e=~~i;if(``+e!==i)return;i=e}e=e[i]}else if(typeof e==`object`){if(!e||!(0,t.hasOwnProperty)(e,i))return;e=e[i]}else return;return e}})),He=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isObjectReference=e.isArrayEnd=e.isArrayReference=e.find=void 0;let t=j(),{isArray:n}=Array;e.find=(e,r)=>{let i=r.length;if(!i)return{val:e};let a,o;for(let s=0;s<i;s++)if(a=e,o=r[s],n(a)){let t=a.length;if(o===`-`)o=t;else if(typeof o==`string`){let e=~~o;if(``+e!==o||(o=e,o<0))throw Error(`INVALID_INDEX`)}e=a[o]}else if(typeof a==`object`&&a)e=(0,t.hasOwnProperty)(a,o)?a[o]:void 0;else throw Error(`NOT_FOUND`);return{val:e,obj:a,key:o}},e.isArrayReference=e=>n(e.obj)&&typeof e.key==`number`,e.isArrayEnd=e=>e.obj.length===e.key,e.isObjectReference=e=>typeof e.obj==`object`&&typeof e.key==`string`})),Ue=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.findByPointer=void 0;let t=j(),n=ze(),{isArray:r}=Array;e.findByPointer=(e,i)=>{if(!e)return{val:i};let a,o,s=0,c=1;for(;s>-1;)if(s=e.indexOf(`/`,c),o=s>-1?e.substring(c,s):e.substring(c),c=s+1,a=i,r(a)){let e=a.length;if(o===`-`)o=e;else{let e=~~o;if(``+e!==o)throw Error(`INVALID_INDEX`);if(o=e,o<0)throw`INVALID_INDEX`}i=a[o]}else if(typeof a==`object`&&a)o=(0,n.unescapeComponent)(o),i=(0,t.hasOwnProperty)(a,o)?a[o]:void 0;else throw`NOT_FOUND`;return{val:i,obj:a,key:o}}})),We=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),(Le(),d(oe)).__exportStar(Ue(),e)})),Ge=s((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=(Le(),d(oe));t.__exportStar(Re(),e),t.__exportStar(ze(),e),t.__exportStar(Be(),e),t.__exportStar(Ve(),e),t.__exportStar(He(),e),t.__exportStar(We(),e)}))();const Ke=(e,t,n)=>{switch(t.toLowerCase()){case`=`:case`equals`:return e==n[0];case`!=`:case`does not equal`:return e!=n[0];case`is one of`:return n.includes(e);case`is not one of`:return!n.includes(e);case`starts with any of`:return n.findIndex(t=>e?.startsWith(t))>=0;case`does not start with any of`:return n.findIndex(t=>e?.startsWith(t))<0;case`ends with any of`:return n.findIndex(t=>e?.endsWith(t))>=0;case`does not end with any of`:return n.findIndex(t=>e?.endsWith(t))<0;case`matches regex`:return qe(n[0],e);case`does not match regex`:return!qe(n[0],e);default:return!1}},qe=(e,t)=>{try{return new RegExp(e).test(t)}catch{return!1}},Je=(e,t,n)=>{if(typeof e==`boolean`)return!1;let r=t.toLowerCase();if(e==null)return r==`!=`||r==`does not equal`;let{value:i,target:a}=Ye(e,n[0]);switch(r){case`=`:case`equals`:return i==a;case`!=`:case`does not equal`:return i!=a;case`<`:return i<a;case`<=`:return i<=a;case`>`:return i>a;case`>=`:return i>=a;default:return!1}},Ye=(e,t)=>typeof e==`number`?{value:e,target:M(t)}:typeof e==`bigint`?{value:e,target:BigInt(t)}:{value:M(e),target:M(t)},M=e=>{let t=Number.parseFloat(e.toString());if(isNaN(t)||!isFinite(t))throw TypeError(`Invalid numeric value: ${e}`);return t},Xe=(e,t,n)=>{if(e==null)return!1;try{let r=new Date(e),i=new Date(n[0]);switch(t){case`is after`:return r>i;case`is before`:return r<i;default:return!1}}catch{return!1}};var N=s(((e,t)=>{t.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}})),P=s(((e,t)=>{t.exports=typeof process==`object`&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{}})),F=s(((e,t)=>{let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=N(),a=P();e=t.exports={};let o=e.re=[],s=e.safeRe=[],c=e.src=[],l=e.safeSrc=[],u=e.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})),I=s(((e,t)=>{let n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),Ze=s(((e,t)=>{let n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};t.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}})),L=s(((e,t)=>{let n=P(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=N(),{safeRe:a,t:o}=F(),s=I(),{compareIdentifiers:c}=Ze();t.exports=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split(`.`):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(`.`)}`),this.version}toString(){return this.version}compare(t){if(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:this.patch>t.patch?1:0}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),c(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}})),R=s(((e,t)=>{let n=L();t.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}})),Qe=s(((e,t)=>{let n=R();t.exports=(e,t)=>{let r=n(e,t);return r?r.version:null}})),$e=s(((e,t)=>{let n=R();t.exports=(e,t)=>{let r=n(e.trim().replace(/^[=v]+/,``),t);return r?r.version:null}})),et=s(((e,t)=>{let n=L();t.exports=(e,t,r,i,a)=>{typeof r==`string`&&(a=i,i=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,i,a).version}catch{return null}}})),tt=s(((e,t)=>{let n=R();t.exports=(e,t)=>{let r=n(e,null,!0),i=n(t,null,!0),a=r.compare(i);if(a===0)return null;let o=a>0,s=o?r:i,c=o?i:r,l=!!s.prerelease.length;if(c.prerelease.length&&!l){if(!c.patch&&!c.minor)return`major`;if(c.compareMain(s)===0)return c.minor&&!c.patch?`minor`:`patch`}let u=l?`pre`:``;return r.major===i.major?r.minor===i.minor?r.patch===i.patch?`prerelease`:u+`patch`:u+`minor`:u+`major`}})),nt=s(((e,t)=>{let n=L();t.exports=(e,t)=>new n(e,t).major})),rt=s(((e,t)=>{let n=L();t.exports=(e,t)=>new n(e,t).minor})),it=s(((e,t)=>{let n=L();t.exports=(e,t)=>new n(e,t).patch})),at=s(((e,t)=>{let n=R();t.exports=(e,t)=>{let r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}})),z=s(((e,t)=>{let n=L();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),ot=s(((e,t)=>{let n=z();t.exports=(e,t,r)=>n(t,e,r)})),st=s(((e,t)=>{let n=z();t.exports=(e,t)=>n(e,t,!0)})),B=s(((e,t)=>{let n=L();t.exports=(e,t,r)=>{let i=new n(e,r),a=new n(t,r);return i.compare(a)||i.compareBuild(a)}})),ct=s(((e,t)=>{let n=B();t.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))})),lt=s(((e,t)=>{let n=B();t.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))})),V=s(((e,t)=>{let n=z();t.exports=(e,t,r)=>n(e,t,r)>0})),H=s(((e,t)=>{let n=z();t.exports=(e,t,r)=>n(e,t,r)<0})),ut=s(((e,t)=>{let n=z();t.exports=(e,t,r)=>n(e,t,r)===0})),dt=s(((e,t)=>{let n=z();t.exports=(e,t,r)=>n(e,t,r)!==0})),U=s(((e,t)=>{let n=z();t.exports=(e,t,r)=>n(e,t,r)>=0})),W=s(((e,t)=>{let n=z();t.exports=(e,t,r)=>n(e,t,r)<=0})),ft=s(((e,t)=>{let n=ut(),r=dt(),i=V(),a=U(),o=H(),s=W();t.exports=(e,t,c,l)=>{switch(t){case`===`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e===c;case`!==`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e!==c;case``:case`=`:case`==`:return n(e,c,l);case`!=`:return r(e,c,l);case`>`:return i(e,c,l);case`>=`:return a(e,c,l);case`<`:return o(e,c,l);case`<=`:return s(e,c,l);default:throw TypeError(`Invalid operator: ${t}`)}}})),pt=s(((e,t)=>{let n=L(),r=R(),{safeRe:i,t:a}=F();t.exports=(e,t)=>{if(e instanceof n)return e;if(typeof e==`number`&&(e=String(e)),typeof e!=`string`)return null;t||={};let o=null;if(!t.rtl)o=e.match(t.includePrerelease?i[a.COERCEFULL]:i[a.COERCE]);else{let n=t.includePrerelease?i[a.COERCERTLFULL]:i[a.COERCERTL],r;for(;(r=n.exec(e))&&(!o||o.index+o[0].length!==e.length);)(!o||r.index+r[0].length!==o.index+o[0].length)&&(o=r),n.lastIndex=r.index+r[1].length+r[2].length;n.lastIndex=-1}if(o===null)return null;let s=o[2];return r(`${s}.${o[3]||`0`}.${o[4]||`0`}${t.includePrerelease&&o[5]?`-${o[5]}`:``}${t.includePrerelease&&o[6]?`+${o[6]}`:``}`,t)}})),mt=s(((e,t)=>{t.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}})),G=s(((e,t)=>{let n=/\s+/g;t.exports=class e{constructor(t,r){if(r=i(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof a)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(n,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!h(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&g(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&p)|(this.options.loose&&m))+`:`+e,n=r.get(t);if(n)return n;let i=this.options.loose,s=i?c[l.HYPHENRANGELOOSE]:c[l.HYPHENRANGE];e=e.replace(s,C(this.options.includePrerelease)),o(`hyphen replace`,e),e=e.replace(c[l.COMPARATORTRIM],u),o(`comparator trim`,e),e=e.replace(c[l.TILDETRIM],d),o(`tilde trim`,e),e=e.replace(c[l.CARETTRIM],f),o(`caret trim`,e);let g=e.split(` `).map(e=>v(e,this.options)).join(` `).split(/\s+/).map(e=>S(e,this.options));i&&(g=g.filter(e=>(o(`loose invalid filter`,e,this.options),!!e.match(c[l.COMPARATORLOOSE])))),o(`range list`,g);let _=new Map,y=g.map(e=>new a(e,this.options));for(let e of y){if(h(e))return[e];_.set(e.value,e)}_.size>1&&_.has(``)&&_.delete(``);let b=[..._.values()];return r.set(t,b),b}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Range is required`);return this.set.some(e=>_(e,n)&&t.set.some(t=>_(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new s(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(ae(this.set[t],e,this.options))return!0;return!1}};let r=new(mt()),i=I(),a=K(),o=P(),s=L(),{safeRe:c,t:l,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:f}=F(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:m}=N(),h=e=>e.value===`<0.0.0-0`,g=e=>e.value===``,_=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},v=(e,t)=>(e=e.replace(c[l.BUILD],``),o(`comp`,e,t),e=x(e,t),o(`caret`,e),e=b(e,t),o(`tildes`,e),e=ne(e,t),o(`xrange`,e),e=ie(e,t),o(`stars`,e),e),y=e=>!e||e.toLowerCase()===`x`||e===`*`,b=(e,t)=>e.trim().split(/\s+/).map(e=>ee(e,t)).join(` `),ee=(e,t)=>{let n=t.loose?c[l.TILDELOOSE]:c[l.TILDE];return e.replace(n,(t,n,r,i,a)=>{o(`tilde`,e,t,n,r,i,a);let s;return y(n)?s=``:y(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:y(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o(`replaceTilde pr`,a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o(`tilde return`,s),s})},x=(e,t)=>e.trim().split(/\s+/).map(e=>te(e,t)).join(` `),te=(e,t)=>{o(`caret`,e,t);let n=t.loose?c[l.CARETLOOSE]:c[l.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,a,s)=>{o(`caret`,e,t,n,i,a,s);let c;return y(n)?c=``:y(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:y(a)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o(`caret return`,c),c})},ne=(e,t)=>(o(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>re(e,t)).join(` `)),re=(e,t)=>{e=e.trim();let n=t.loose?c[l.XRANGELOOSE]:c[l.XRANGE];return e.replace(n,(n,r,i,a,s,c)=>{o(`xRange`,e,n,r,i,a,s,c);let l=y(i),u=l||y(a),d=u||y(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(a=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:a=+a+1),r===`<`&&(c=`-0`),n=`${r+i}.${a}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),o(`xRange return`,n),n})},ie=(e,t)=>(o(`replaceStars`,e,t),e.trim().replace(c[l.STAR],``)),S=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?l.GTE0PRE:l.GTE0],``)),C=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=y(r)?``:y(i)?`>=${r}.0.0${e?`-0`:``}`:y(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=y(l)?``:y(u)?`<${+l+1}.0.0-0`:y(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),ae=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==a.ANY&&e[n].semver.prerelease.length>0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}})),K=s(((e,t)=>{let n=Symbol(`SemVer ANY`);t.exports=class e{static get ANY(){return n}constructor(t,i){if(i=r(i),t instanceof e){if(t.loose===!!i.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(` `),s(`comparator`,t,i),this.options=i,this.loose=!!i.loose,this.parse(t),this.semver===n?this.value=``:this.value=this.operator+this.semver.version,s(`comp`,this)}parse(e){let t=this.options.loose?i[a.COMPARATORLOOSE]:i[a.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=r[1]===void 0?``:r[1],this.operator===`=`&&(this.operator=``),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(s(`Comparator.test`,e,this.options.loose),this.semver===n||e===n)return!0;if(typeof e==`string`)try{e=new c(e,this.options)}catch{return!1}return o(e,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``?!0:new l(t.value,n).test(this.value):t.operator===``?t.value===``?!0:new l(this.value,n).test(t.semver):(n=r(n),n.includePrerelease&&(this.value===`<0.0.0-0`||t.value===`<0.0.0-0`)||!n.includePrerelease&&(this.value.startsWith(`<0.0.0`)||t.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&t.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&t.operator.startsWith(`<`)||this.semver.version===t.semver.version&&this.operator.includes(`=`)&&t.operator.includes(`=`)||o(this.semver,`<`,t.semver,n)&&this.operator.startsWith(`>`)&&t.operator.startsWith(`<`)||o(this.semver,`>`,t.semver,n)&&this.operator.startsWith(`<`)&&t.operator.startsWith(`>`)))}};let r=I(),{safeRe:i,t:a}=F(),o=ft(),s=P(),c=L(),l=G()})),q=s(((e,t)=>{let n=G();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),ht=s(((e,t)=>{let n=G();t.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(` `).trim().split(` `))})),gt=s(((e,t)=>{let n=L(),r=G();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===-1)&&(a=e,o=new n(a,i))}),a}})),_t=s(((e,t)=>{let n=L(),r=G();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===1)&&(a=e,o=new n(a,i))}),a}})),vt=s(((e,t)=>{let n=L(),r=G(),i=V();t.exports=(e,t)=>{e=new r(e,t);let a=new n(`0.0.0`);if(e.test(a)||(a=new n(`0.0.0-0`),e.test(a)))return a;a=null;for(let t=0;t<e.set.length;++t){let r=e.set[t],o=null;r.forEach(e=>{let t=new n(e.semver.version);switch(e.operator){case`>`:t.prerelease.length===0?t.patch++:t.prerelease.push(0),t.raw=t.format();case``:case`>=`:(!o||i(t,o))&&(o=t);break;case`<`:case`<=`:break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),o&&(!a||i(a,o))&&(a=o)}return a&&e.test(a)?a:null}})),yt=s(((e,t)=>{let n=G();t.exports=(e,t)=>{try{return new n(e,t).range||`*`}catch{return null}}})),J=s(((e,t)=>{let n=L(),r=K(),{ANY:i}=r,a=G(),o=q(),s=V(),c=H(),l=W(),u=U();t.exports=(e,t,d,f)=>{e=new n(e,f),t=new a(t,f);let p,m,h,g,_;switch(d){case`>`:p=s,m=l,h=c,g=`>`,_=`>=`;break;case`<`:p=c,m=u,h=s,g=`<`,_=`<=`;break;default:throw TypeError(`Must provide a hilo val of "<" or ">"`)}if(o(e,t,f))return!1;for(let n=0;n<t.set.length;++n){let a=t.set[n],o=null,s=null;if(a.forEach(e=>{e.semver===i&&(e=new r(`>=0.0.0`)),o||=e,s||=e,p(e.semver,o.semver,f)?o=e:h(e.semver,s.semver,f)&&(s=e)}),o.operator===g||o.operator===_||(!s.operator||s.operator===g)&&m(e,s.semver)||s.operator===_&&h(e,s.semver))return!1}return!0}})),bt=s(((e,t)=>{let n=J();t.exports=(e,t,r)=>n(e,t,`>`,r)})),xt=s(((e,t)=>{let n=J();t.exports=(e,t,r)=>n(e,t,`<`,r)})),St=s(((e,t)=>{let n=G();t.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))})),Ct=s(((e,t)=>{let n=q(),r=z();t.exports=(e,t,i)=>{let a=[],o=null,s=null,c=e.sort((e,t)=>r(e,t,i));for(let e of c)n(e,t,i)?(s=e,o||=e):(s&&a.push([o,s]),s=null,o=null);o&&a.push([o,null]);let l=[];for(let[e,t]of a)e===t?l.push(e):!t&&e===c[0]?l.push(`*`):t?e===c[0]?l.push(`<=${t}`):l.push(`${e} - ${t}`):l.push(`>=${e}`);let u=l.join(` || `),d=typeof t.raw==`string`?t.raw:String(t);return u.length<d.length?u:t}})),wt=s(((e,t)=>{let n=G(),r=K(),{ANY:i}=r,a=q(),o=z(),s=(e,t,r={})=>{if(e===t)return!0;e=new n(e,r),t=new n(t,r);let i=!1;OUTER:for(let n of e.set){for(let e of t.set){let t=u(n,e,r);if(i||=t!==null,t)continue OUTER}if(i)return!1}return!0},c=[new r(`>=0.0.0-0`)],l=[new r(`>=0.0.0`)],u=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===i){if(t.length===1&&t[0].semver===i)return!0;e=n.includePrerelease?c:l}if(t.length===1&&t[0].semver===i){if(n.includePrerelease)return!0;t=l}let r=new Set,s,u;for(let t of e)t.operator===`>`||t.operator===`>=`?s=d(s,t,n):t.operator===`<`||t.operator===`<=`?u=f(u,t,n):r.add(t.semver);if(r.size>1)return null;let p;if(s&&u&&(p=o(s.semver,u.semver,n),p>0||p===0&&(s.operator!==`>=`||u.operator!==`<=`)))return null;for(let e of r){if(s&&!a(e,String(s),n)||u&&!a(e,String(u),n))return null;for(let r of t)if(!a(e,String(r),n))return!1;return!0}let m,h,g,_,v=u&&!n.includePrerelease&&u.semver.prerelease.length?u.semver:!1,y=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1;v&&v.prerelease.length===1&&u.operator===`<`&&v.prerelease[0]===0&&(v=!1);for(let e of t){if(_=_||e.operator===`>`||e.operator===`>=`,g=g||e.operator===`<`||e.operator===`<=`,s){if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),e.operator===`>`||e.operator===`>=`){if(m=d(s,e,n),m===e&&m!==s)return!1}else if(s.operator===`>=`&&!a(s.semver,String(e),n))return!1}if(u){if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),e.operator===`<`||e.operator===`<=`){if(h=f(u,e,n),h===e&&h!==u)return!1}else if(u.operator===`<=`&&!a(u.semver,String(e),n))return!1}if(!e.operator&&(u||s)&&p!==0)return!1}return!(s&&g&&!u&&p!==0||u&&_&&!s&&p!==0||y||v)},d=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r>0?e:r<0||t.operator===`>`&&e.operator===`>=`?t:e},f=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r<0?e:r>0||t.operator===`<`&&e.operator===`<=`?t:e};t.exports=s})),Y=u(s(((e,t)=>{let n=F(),r=N(),i=L(),a=Ze();t.exports={parse:R(),valid:Qe(),clean:$e(),inc:et(),diff:tt(),major:nt(),minor:rt(),patch:it(),prerelease:at(),compare:z(),rcompare:ot(),compareLoose:st(),compareBuild:B(),sort:ct(),rsort:lt(),gt:V(),lt:H(),eq:ut(),neq:dt(),gte:U(),lte:W(),cmp:ft(),coerce:pt(),Comparator:K(),Range:G(),satisfies:q(),toComparators:ht(),maxSatisfying:gt(),minSatisfying:_t(),minVersion:vt(),validRange:yt(),outside:J(),gtr:bt(),ltr:xt(),intersects:St(),simplifyRange:Ct(),subset:wt(),SemVer:i,re:n.re,src:n.src,tokens:n.t,SEMVER_SPEC_VERSION:r.SEMVER_SPEC_VERSION,RELEASE_TYPES:r.RELEASE_TYPES,compareIdentifiers:a.compareIdentifiers,rcompareIdentifiers:a.rcompareIdentifiers}}))(),1);const Tt=(e,t,n)=>{let r=t.toLowerCase();if(e==null||e.trim().length==0)return r==`is not one of`;let i=Y.coerce(e)??e,a=n.map(e=>Y.coerce(e)??e);try{switch(r){case`=`:return X(i,a[0]);case`<`:return Y.lt(i,a[0]);case`<=`:return Y.lte(i,a[0]);case`>`:return Y.gt(i,a[0]);case`>=`:return Y.gte(i,a[0]);case`is one of`:return a.findIndex(e=>X(i,e))>=0;case`is not one of`:return a.findIndex(e=>X(i,e))<0;default:return!1}}catch{return!1}},X=(e,t)=>{try{return Y.eq(e,t)}catch{return!1}},Et=(e,t,n)=>{let r=t.toLowerCase();if(!Array.isArray(e))return r==`does not contain any of`;switch(r){case`contains any of`:return e.some(e=>n.includes(e));case`does not contain any of`:return!e.some(e=>n.includes(e));default:return!1}};var Dt=class{evaluate(e,t){if(!this.isConditionValidForComparison(e))return!1;switch(e.attribute){case`identifier`:return this.compare(t?.context?.id,e);case`name`:return this.compare(t?.context?.name,e);case`appName`:return this.compare(t?.metadata?.appName,e);case`appVersion`:return this.compare(t?.metadata?.appVersion,e);case`traits`:if(e.trait){let n=this.findTraitValue(t?.context?.traits,e.trait);return this.compare(n,e)}}return!1}compare(e,t){switch(t.targetType){case`text`:return Ke(e?.toString(),t.operator,t.targetValues);case`number`:return Je(e,t.operator,t.targetValues);case`datetime`:return Xe(e?.toString(),t.operator,t.targetValues);case`semver`:return Tt(e?.toString(),t.operator,t.targetValues);case`array`:return Et(e,t.operator,t.targetValues)}return!1}findTraitValue(e,t){try{return(0,Ge.findByPointer)(t,e).val}catch{return}}isConditionValidForComparison(e){return Array.isArray(e.targetValues)&&e.targetValues.length>0}};function Ot(e,t){let n=e*t;return BigInt.asUintN(64,n)^n>>64n}function kt(e,t){let n=e*t;return BigInt.asUintN(64,n)^n>>64n^e^t}new DataView(new Uint8Array(8).buffer);var At=new DataView(new Uint8Array(8).buffer);function jt(e,t){return At.setUint32(0,e.getUint32(t,!0),!0),At.getBigUint64(0,!0)}function Z(e,t){return e.getBigUint64(t,!0)}new DataView(new Uint8Array(8).buffer),new DataView(new Uint8Array(8).buffer);var Mt=new TextEncoder,Q=2048,Nt=Q/3,Pt=new Uint8Array(Q);function Ft(e){if(typeof e==`string`){if(e.length<=Nt){let{written:t}=Mt.encodeInto(e,Pt);return new DataView(Pt.buffer,0,t)}let t=Mt.encode(e);return new DataView(t.buffer,t.byteOffset,t.byteLength)}return e instanceof Uint8Array?new DataView(e.buffer,e.byteOffset,e.byteLength):e}var It=`fast`;function Lt(e){return e>=0n&&e<=18446744073709551615n}function Rt(e,t){let n={seed:t,rapidMumBehaviour:It};if(e===void 0)return n;if(e.seed!==void 0){if(!Lt(e.seed))throw Error(`seed must be a 64-bit unsigned bigint value: ${e.seed}`);n.seed=e.seed}return e.rapidMumBehaviour!==void 0&&(n.rapidMumBehaviour=e.rapidMumBehaviour),n}var zt=0n,Bt=[3257665815644502181n,10067880064238660809n,5418857496715711651n,5573817676018592327n,11562461410679940143n,16646288086500911323n,10443028834174122124n,12297829382473034410n],$=new Uint8Array(8),Vt=new DataView($.buffer);function Ht(e,t){let n=e.getUint8(0);return $[6]=n>>3,$[5]=n<<5,$[0]=e.getUint8(t-1),Vt.getBigUint64(0,!0)}function Ut(e,t,n,r){let i=e*t,a=(BigInt.asUintN(64,i)^n[7])*(i>>64n^n[1]^r);return BigInt.asUintN(64,a)^a>>64n}function Wt(e,t,n,r){let i=e*t,a=BigInt.asUintN(64,i)^n[7]^e,o=i>>64n^n[1]^r^t,s=a*o;return BigInt.asUintN(64,s)^s>>64n^a^o}var Gt={fast:{rapid_mix:Ot,rapidhash_epilogue:Ut},protected:{rapid_mix:kt,rapidhash_epilogue:Wt}};function Kt(e,t,n,r,i){let a=e.byteLength,o=BigInt(e.byteLength);t^=r(t^n[2],n[1]);let s,c,l=a,u;if(a<=16)if(u=o,a>=4)if(t^=o,a>=8){let t=a-8;s=Z(e,0),c=Z(e,t)}else{let t=a-4;s=jt(e,0),c=jt(e,t)}else a>0?(s=Ht(e,a),c=BigInt(e.getUint8(a>>1))):(s=0n,c=0n);else{let i=0;if(l>112){let a=t,o=t,s=t,c=t,u=t,d=t;do t=r(Z(e,i)^n[0],Z(e,i+8)^t),a=r(Z(e,i+16)^n[1],Z(e,i+24)^a),o=r(Z(e,i+32)^n[2],Z(e,i+40)^o),s=r(Z(e,i+48)^n[3],Z(e,i+56)^s),c=r(Z(e,i+64)^n[4],Z(e,i+72)^c),u=r(Z(e,i+80)^n[5],Z(e,i+88)^u),d=r(Z(e,i+96)^n[6],Z(e,i+104)^d),i+=112,l-=112;while(l>112);t^=a,o^=s,c^=u,t^=d,o^=c,t^=o}u=BigInt(l),l>16&&(t=r(Z(e,i)^n[2],Z(e,i+8)^t),l>32&&(t=r(Z(e,i+16)^n[2],Z(e,i+24)^t),l>48&&(t=r(Z(e,i+32)^n[1],Z(e,i+40)^t),l>64&&(t=r(Z(e,i+48)^n[1],Z(e,i+56)^t),l>80&&(t=r(Z(e,i+64)^n[2],Z(e,i+72)^t),l>96&&(t=r(Z(e,i+80)^n[1],Z(e,i+88)^t))))))),s=Z(e,i+l-16)^u,c=Z(e,i+l-8)}return s^=n[1],c^=t,i(s,c,n,u)}function qt(e,t){let{seed:n,rapidMumBehaviour:r}=Rt(t,zt),{rapid_mix:i,rapidhash_epilogue:a}=Gt[r];return Kt(Ft(e),n,Bt,i,a)}const Jt=e=>{let t=`${e.contextIdentifier}-${e.configId}`;return Number(qt(t,{seed:15426857351n})%1000n)/10};var Yt=class{constructor(e){if(this.logger=e,this.conditionEvaluator=new Dt,!e||!e.warn||!e.error||!e.info)throw TypeError(`The provided logger is not a valid 'ConfigDirectorLogger'`);this.logger=e}evaluate(e,t){return{id:e.id,key:e.key,type:e.type,value:this.getConfigValue(e,t)}}getConfigValue(e,t){let n=[...e.target?.rules??[]].sort((e,t)=>(e.order??2**53-1)-(t.order??2**53-1));for(let r of n){let n=this.evaluateRule(r,e,t);if(n.success)return n.value}return e.target?.defaultValue}evaluateRule(e,t,n){try{if(e.type==`percentage`)return this.evaluatePercentageRule(e,t,n);if(e.type==`conditional`)return this.evaluateConditionalRule(e,t,n)}catch(n){this.logger.warn(`There was an error while evaluating a targeting rule '${e?.id}' for '${t?.key}'. The rule will be disregarded.`,{error:n,configKey:t?.key,ruleId:e?.id})}return{success:!1}}evaluatePercentageRule(e,t,n){return this.evaluatePercentage(e.percentages??[],t,n)}evaluatePercentage(e,t,n){let r=Jt({configId:t.id,contextIdentifier:n?.context?.id??crypto.randomUUID()}),i=0,a=0,o;for(;!o&&i<e.length;)r<=e[i].percentage+a&&(o=e[i]),a+=e[i].percentage,i+=1;return o?.value==null?{success:!1}:{success:!0,value:o.value.toString()}}evaluateConditionalRule(e,t,n){let r=e.conditions??[],i=0,a;for(;!a&&i<r.length;)this.conditionEvaluator.evaluate(r[i],n)&&(a=r[i]),i+=1;return a&&e.target==`value`&&e.value!=null?{success:!0,value:e.value.toString()}:a&&e.target==`percentage`?this.evaluatePercentage(e.percentages??[],t,n):{success:!1}}};const Xt=e=>{let t=typeof e;if(t===`object`)try{return e.constructor?.name??t}catch{return t}else if(t===`function`)try{let n=e.name;return n?`function: ${n}`:t}catch{return t}return t},Zt=e=>e===`number`||e===`bigint`,Qt=(e,t)=>{let n=e.value,r=Xt(t);if(!n)return{parsedValue:t,parsedValueId:void 0,requestedType:r,usedDefault:!0,reason:`value-missing`};if(e.type===`json`)return nn(n,t,r,e.valueId);if(typeof t==`string`)return{parsedValue:n,parsedValueId:e.valueId,requestedType:r,usedDefault:!1,reason:`found-match`};if(typeof t==`boolean`&&(e.type===`boolean`||e.type===`string`)){let i=$t(n),a=typeof i==`boolean`;return{parsedValue:a?i:t,parsedValueId:a?e.valueId:void 0,requestedType:r,usedDefault:!a,reason:a?`found-match`:`invalid-boolean`}}if(Zt(typeof t)&&e.type===`integer`){let i=en(n),a=typeof i==`number`;return{parsedValue:a?i:t,parsedValueId:a?e.valueId:void 0,requestedType:r,usedDefault:!a,reason:a?`found-match`:`invalid-number`}}if(Zt(typeof t)&&(e.type===`float`||e.type===`enum`||e.type===`string`)){let i=tn(n),a=typeof i==`number`;return{parsedValue:a?i:t,parsedValueId:a?e.valueId:void 0,requestedType:r,usedDefault:!a,reason:a?`found-match`:`invalid-number`}}return{parsedValue:n,parsedValueId:e.valueId,requestedType:r,usedDefault:!1,reason:`found-match`}},$t=e=>{if(!e)return;let t=e.toLowerCase();if(!(t!=`true`&&t!=`false`))return t===`true`},en=e=>{if(!e)return;let t=Number.parseInt(e);if(!(isNaN(t)||!isFinite(t)))return t},tn=e=>{if(!e)return;let t=Number.parseFloat(e);if(!(isNaN(t)||!isFinite(t)))return t},nn=(e,t,n,r)=>{if(typeof t==`string`)return{parsedValue:e,parsedValueId:r,requestedType:n,usedDefault:!1,reason:`found-match`};try{return{parsedValue:JSON.parse(e),parsedValueId:r,requestedType:n,usedDefault:!1,reason:`found-match`}}catch{return{parsedValue:t,parsedValueId:void 0,requestedType:n,usedDefault:!0,reason:`invalid-json`}}},rn={off:-1,error:0,warn:1,info:2,debug:3},an=()=>{let e={year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,timeZoneName:`short`};try{return new Intl.DateTimeFormat(void 0,{...e,fractionalSecondDigits:3})}catch{return new Intl.DateTimeFormat(void 0,e)}};var on=class{constructor(e,t){this.level=e,this.decorator=t,this.level=e,this.decorator=t,this.dateFormatter=an()}debug(e,...t){this.log(console.debug,`debug`,e,...t)}info(e,...t){this.log(console.info,`info`,e,...t)}warn(e,...t){this.log(console.warn,`warn`,e,...t)}error(e,...t){this.log(console.error,`error`,e,...t)}log(e,t,n,...r){rn[this.level]>=rn[t]&&e(`[${this.dateFormatter.format(new Date)}] ${this.decorator?.decorateMessage(n)}`,...r)}},sn=class{decorateMessage(e){return`[ConfigDirector:js-server-sdk] ${e}`}};const cn=(e,t)=>new on(e??`warn`,t??new sn),ln=(e,t)=>new URL(e,t?.toString()),un=async(e,t)=>e.valueId?{valueId:e.valueId}:e.value?e.value.length<=500&&e.type!=`json`?{value:e.value}:{valueId:await t(e.value)}:e,dn=e=>{if(e.type===`json`||e.type==null&&typeof e.value==`object`){if(e.valueId)return{valueId:e.valueId,type:`json`};try{return{value:JSON.stringify(e.value),type:`json`}}catch{return{value:e.value.toString(),type:`json`}}}let t=e.value?.toString();return t&&t.length<=500?{value:t}:e.valueId?{valueId:e.valueId}:{value:t}},fn=e=>{let t=Object.keys(e);if(t.length==0)return!0;for(let n of t)if((e[n]?.length??0)>0)return!1;return!0},pn=e=>{if(!e)return!0;let t=Object.keys(e);if(t.length==0)return!0;for(let n of t)if((e[n]??0)>0)return!1;return!0};var mn=class{constructor(e){this.executeRequests=!0,this.sdkKey=e.sdkKey,this.logger=e.logger,this.url=new URL(`server/telemetry/v1`,e.baseUrl.toString())}async report({discreteEvents:e,aggregatedEvents:t,droppedEvents:n}){if(!this.executeRequests)return{success:!1,fatalError:!0};let r={serverSdkKey:this.sdkKey,discreteEvents:e,aggregatedEvents:t,droppedEvents:n};if(this.isReportEmpty(r))return{success:!0,fatalError:!1};let i=await this.sendReport(r);return i.fatalError&&(this.executeRequests=!1),i}isReportEmpty(e){return fn(e.discreteEvents)&&fn(e.aggregatedEvents)&&pn(e.droppedEvents)}async sendReport(e){try{let t=await S(5e3,this.url,{method:`POST`,body:JSON.stringify(e)},this.logger),n=this.isStatusFatal(t.status);return n&&this.logger.warn(`[EventReporter] Received a fatal status response (${t.status}) from the telemetry endpoint. No more telemetry data will be sent.`),{success:t.ok,fatalError:n}}catch(e){return this.logger.warn(`[EventReporter] Error attempting to send telemetry data: ${e}`,{error:e}),{success:!1,fatalError:!1}}}isStatusFatal(e){return!!e&&e>=400&&e<500}},hn=class{aggregate(e){if(e.events.length==0)return[];let t=new Map;for(let n of e.events){let e=JSON.stringify(n),r=t.get(e)?.count||0;t.set(e,{event:n,count:r+1})}return Array.from(t).map(([,t])=>({startTime:e.startTime,endTime:e.endTime,count:t.count,event:t.event}))}},gn=class{constructor(e){this._events=[],this._droppedEventCount=0,this.limit=e??1e3}get events(){return this._events}get reachedLimit(){return this._events.length>=this.limit}get droppedEventCount(){return this._droppedEventCount}push(...e){this.startTime||=new Date;let t=Math.max(0,e.length-this.limit),n=e.slice(t,e.length);if(this._droppedEventCount+=t,this._events.length+n.length>this.limit){let e=this._events.length+n.length-this.limit;this._events.splice(0,e),this._droppedEventCount+=e}return this._events.push(...n)}takeSnapshot(){let e=new Date,t=this.startTime??e,n=this._events.splice(0),r=this._droppedEventCount;return this.startTime=void 0,this._droppedEventCount=0,{startTime:t,endTime:e,events:n,droppedCount:r}}clear(){this._events=[],this.startTime=void 0,this._droppedEventCount=0}},_n=class{constructor(e){this.aggregator=new hn,this.collectEvents=!0,this.logger=e.logger,this.evaluationEventQueue=new gn(e.evaluationQueueLimit??1e3),this.flushIntervalDelay=e.flushIntervalDelay??3e4;let t=e.initialFlushIntervalDelay??5e3;this.flushTimeout=setTimeout(()=>this.flushAndScheduleNext(),t)}async flushAndScheduleNext(){(await this.flush()).fatalError?(this.collectEvents=!1,this.close(),this.logger.warn(`[TelemetryEventCollector] Received a fatal error from telemetry collection. No longer collecting events.`)):this.flushTimeout=setTimeout(()=>this.flushAndScheduleNext(),this.flushIntervalDelay)}cancelScheduledFlush(){clearTimeout(this.flushTimeout)}async close(){this.collectEvents=!1,clearTimeout(this.flushTimeout),await this.flush(),this.evaluationEventQueue.clear()}dispose(){this.close()}},vn=class extends Map{constructor(e,t){super(t),this._droppedCount=0,this.limit=e,this.enforceLimit()}set(e,t){return super.set(e,t),this.enforceLimit(),this}get droppedCount(){return this._droppedCount}clearAndReset(){this.clear(),this._droppedCount=0}enforceLimit(){for(;this.size>this.limit;){let e=this.keys().next().value;e!==void 0&&(this.delete(e),this._droppedCount+=1)}}},yn=class{constructor(e){this.valueIdGenerator=e,this.valueIdGenerator=e}async process(e){let t=await Promise.all(e.events.map(async e=>({...e,defaultValue:await un(e.defaultValue,this.valueIdGenerator),evaluatedValue:await un(e.evaluatedValue,this.valueIdGenerator)})));return{...e,events:t}}},bn=class extends _n{constructor(e){super(e),this.reporter=new mn(e),this.contexts=new vn(e.contextLimit??1e3),this.evaluationEventSnapshotPreprocessor=new yn(e.valueIdGenerator)}evaluatedConfig(e){if(!this.collectEvents)return;e.context?.id&&!e.context.anonymous&&this.contexts.set(e.context.id,e.context);let t={...e.evaluation,contextId:e.context?.anonymous?void 0:e.context?.id};this.evaluationEventQueue.push(this.sanitizeEvaluatedConfigEvent(t))}sanitizeEvaluatedConfigEvent(e){return{...e,defaultValue:dn({value:e.defaultValue,type:e.type}),evaluatedValue:dn({value:e.evaluatedValue,valueId:e.evaluatedValueId,type:e.type})}}snapshotContexts(){let e=Array.from(this.contexts.values()),t=this.contexts.droppedCount;return this.contexts.clearAndReset(),{contexts:e,droppedCount:t}}async flush(){if(!this.reporter)return{success:!1,fatalError:!1};let e=await this.evaluationEventSnapshotPreprocessor.process(this.evaluationEventQueue.takeSnapshot()),t=this.snapshotContexts();return await this.reporter?.report({context:this._context,discreteEvents:{capturedContexts:t.contexts},aggregatedEvents:{evaluatedConfig:this.aggregator.aggregate(e)},droppedEvents:{evaluatedConfig:e.droppedCount,capturedContexts:t.droppedCount}})}};const xn=(e,t)=>{let n=BigInt(0),r=BigInt(62),i=Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``),a=BigInt(`0x`+i),o=``;for(;a>n;)o=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`[Number(a%r)]+o,a/=r;return o.padStart(t,`0`)},Sn=Math.ceil(128/Math.log2(62)),Cn=async e=>xn((0,m.createHash)(`sha256`).update(e?.toString()??``).digest().subarray(0,16),Sn),wn=new URL(`https://server-sdk-api.configdirector.com`);var Tn=class{constructor(e,t,n){this.handlersMap=new Map,this.eventEmitter=new p.default,this.ready=!1,this.logger=n?.logger??cn(),this.timeout=n?.connection?.timeout??3e3,this.metaContext=n?.metadata??{},this.configEvaluator=new Yt(this.logger);let r=this.parseUrl(n?.connection?.url)??wn;this.connectionMode=n?.connection?.mode??`streaming`;let i=this.getTransportConstructor(this.connectionMode),a=n?.telemetry?.eventQueueLimit??5e3;this.usageEventCollector=new bn({sdkKey:e,logger:this.logger,baseUrl:r,flushIntervalDelay:n?.telemetry?.flushInterval??3e4,evaluationQueueLimit:Math.ceil(a*.7),contextLimit:Math.floor(a*.3),urlFactory:ln,valueIdGenerator:Cn}),this.transport=new i({serverSdkKey:e,baseUrl:r,metaContext:{...n?.metadata,sdkName:t.sdkName,sdkVersion:t.sdkVersion},logger:this.logger,pollingInterval:n?.connection?.pollingInterval}),this.transport.on(`configBundleReceived`,e=>{this.readyResolve?.();let t=Object.keys(e.configs);!this.configSet||e.kind==`full`?(this.configSet=e,this.eventEmitter.emit(`configsUpdated`,{keys:t}),this.updateWatchers(e.configs)):(this.configSet.configs={...this.configSet.configs,...e.configs},this.eventEmitter.emit(`configsUpdated`,{keys:t}),this.updateWatchers(e.configs)),this.logger.debug(`[ConfigDirectorClient] ConfigSet updated from server with ${t.length} key(s)`,{keys:t})}),this.registerHandler(`clientReady`,n?.hooks?.clientReady),this.registerHandler(`configEvaluated`,n?.hooks?.configEvaluated),this.registerHandler(`configsUpdated`,n?.hooks?.configsUpdated)}registerHandler(e,t){if(!t)return;let n=Array.isArray(t)?t:[t];for(let t of n)typeof t==`function`&&this.on(e,t)}async initialize(){try{this.ready=!1,this.readyPromise=new Promise(e=>{this.readyResolve=e}).then(()=>{this.ready=!0,this.eventEmitter.emit(`clientReady`),this.logger.debug(`[ConfigDirectorClient] Received initial payload from the server, client is ready`)});let e=new Date().getTime();await this.transport.connect(this.timeout);let t=new Date().getTime()-e,n=this.timeout-t;if(n>0&&await Promise.race([this.readyPromise,new Promise(e=>{setTimeout(()=>e(),n)})]),!this.ready){let e=this.connectionMode===`streaming`?`The client will continue to retry since there were no fatal errors detected. Configs will return the default value until the connection succeeds.`:`Since the client was configured without streaming, configs may not update and always return the default value.`;this.logger.warn(`[ConfigDirectorClient] Timed out waiting for initialization after ${this.timeout}ms. ${e}`)}}catch(e){this.logger.error(`[ConfigDirectorClient] An error occurred during initialization: `,e)}}getTransportConstructor(e){switch(e){case`one-time`:return ae;case`polling`:return C;default:return re}}updateWatchers(e){Object.values(e).forEach(e=>this.updateWatchersForConfig(e))}updateWatchersForConfig(e){this.handlersMap.get(e.key)?.forEach(t=>{let n=this.getValueFromConfigDefinition(e.key,e,t.defaultValue,t.context);t.handler(n)})}watch(e,t,n,r){this.validateDefaultValue(t);let i=this.handlersMap.get(e),a={handler:n,defaultValue:t,requestedType:typeof t,context:r};return i?i.push(a):this.handlersMap.set(e,[a]),()=>this.unwatch(e,n)}unwatch(e,t){let n=this.handlersMap.get(e);if(n)if(t){let e=n.findIndex(e=>e.handler==t);e>=0&&n?.splice(e,1)}else n.splice(0)}getValue(e,t,n){this.validateDefaultValue(t);let r=this.configSet?.configs[e];return this.getValueFromConfigDefinition(e,r,t,n)}getValueFromConfigDefinition(e,t,n,r){if(t){let i=this.configEvaluator.evaluate(t,{context:r,metadata:this.metaContext}),a=Qt(i,n);return this.usageEventCollector.evaluatedConfig({context:r,evaluation:{key:e,type:i.type,defaultValue:n,requestedType:a.requestedType,evaluatedValue:a.parsedValue,evaluatedValueId:a.parsedValueId,usedDefault:a.usedDefault,evaluationReason:a.reason}}),this.dispatchEvaluationEvent({key:e,value:a.parsedValue,valueId:a.parsedValueId??void 0,isDefaultValue:a.usedDefault,reason:a.reason,context:r}),this.logger.debug(`[ConfigDirectorClient] Evaluated '${e}' to '${a.parsedValue}'`),a.parsedValue}else{this.logger.debug(`[ConfigDirectorClient] No config state found for '${e}', returning default value '${n}'`);let t=this.isReady?`config-state-missing`:`client-not-ready`;return this.usageEventCollector.evaluatedConfig({context:r,evaluation:{key:e,defaultValue:n,requestedType:Xt(n),evaluatedValue:n,usedDefault:!0,evaluationReason:t}}),this.dispatchEvaluationEvent({key:e,value:n,isDefaultValue:!0,reason:t,context:r}),n}}dispatchEvaluationEvent(e){setTimeout(()=>this.eventEmitter.emit(`configEvaluated`,{evaluation:e}),0)}parseUrl(e){if(e)try{return new URL(e)}catch(t){throw new g(`Invalid base URL '${e}'. Parsing failed: ${t}`)}}validateDefaultValue(e){if(e==null)throw new g(`Invalid default value. The default value for a config must be defined and non-null.`);if(typeof e==`function`)throw new g(`Invalid default value. The default value for a config cannot be a function.`)}get isReady(){return this.ready}on(e,t){this.eventEmitter.on(e,t)}off(e,t){t?this.eventEmitter.off(e,t):this.eventEmitter.removeAllListeners(e)}removeAllObservers(){this.logger.debug(`[ConfigDirectorClient] removeAllObservers() has been called, removing all observers`),this.eventEmitter.removeAllListeners(),this.handlersMap.clear()}unwatchAll(){this.handlersMap.clear()}getAllConfigs(e){if(!this.configSet)return{};let t=Object.entries(this.configSet.configs),n=e?.configKeys?t.filter(([t])=>e.configKeys?.includes(t)):t;return Object.fromEntries(n.map(([t,n])=>[t,this.configEvaluator.evaluate(n,{context:e?.context,metadata:this.metaContext})]))}closeConnection(){this.logger.debug(`[ConfigDirectorClient] closeConnection() has been called, closing connection to server`),this.transport.close(),this.ready=!1}dispose(){this.removeAllObservers(),this.closeConnection()}},En=class e{constructor(t,n){this.metadata={name:e.name},this.runsOn=`server`,this.events=new f.OpenFeatureEventEmitter,this.client=new Tn(t,{sdkName:`js-openfeature-server-provider`,sdkVersion:`0.9.0`},n),this.readyHandler=()=>{this.events.emit(f.ProviderEvents.Ready)},this.client.on(`configsUpdated`,({keys:e})=>{this.events.emit(f.ProviderEvents.ConfigurationChanged,{flagsChanged:e})})}async initialize(){await this.client.initialize(),this.client.off(`clientReady`,this.readyHandler),this.client.on(`clientReady`,this.readyHandler)}resolveBooleanEvaluation(e,t,n){return Promise.resolve(this.evaluate(e,t,n))}resolveStringEvaluation(e,t,n){return Promise.resolve(this.evaluate(e,t,n))}resolveNumberEvaluation(e,t,n){return Promise.resolve(this.evaluate(e,t,n))}resolveObjectEvaluation(e,t,n){return Promise.resolve(this.evaluate(e,t,n))}onClose(){return this.client.dispose(),Promise.resolve()}evaluate(e,t,n){return{value:this.client.getValue(e,t,this.mapContext(n))}}mapContext(e){if(!e)return;let t=(e.targetingKey??e.id)?.toString(),n=e.name?.toString(),r=e?.traits||{},i=typeof r==`object`&&Object.keys(r).length>0,a=e.anonymous;return{id:t,name:n,traits:i?r:void 0,anonymous:typeof a==`boolean`?a:void 0}}};exports.ConfigDirectorProvider=En;
@@ -0,0 +1,211 @@
1
+ import { ConfigDirectorClient, ConfigDirectorClientOptions, ConfigDirectorContext, ConfigDirectorLogMessageDecorator, ConfigDirectorLogger, ConfigDirectorLoggingLevel, ConfigValueType } from "@js-client-core/index";
2
+ import { EvaluationContext, JsonValue, OpenFeatureEventEmitter, Paradigm, Provider, ProviderMetadata, ResolutionDetails } from "@openfeature/server-sdk";
3
+
4
+ //#region ../shared/src/types.d.ts
5
+ type ConfigEnumLikeType = {
6
+ [key: string]: string | number;
7
+ };
8
+ type ConfigValueType$1 = string | number | boolean | object | ConfigEnumLikeType;
9
+ interface ConfigDirectorLogger$1 {
10
+ debug(message: string, ...args: any): void;
11
+ info(message: string, ...args: any): void;
12
+ warn(message: string, ...args: any): void;
13
+ error(message: string, ...args: any): void;
14
+ }
15
+ type EvaluationReason = "found-match" | "config-state-missing" | "client-not-ready" | "type-mismatch" | "value-missing" | "invalid-number" | "invalid-json" | "invalid-boolean";
16
+ type ConfigEvaluation = {
17
+ key: string;
18
+ value: ConfigValueType$1;
19
+ valueId?: string;
20
+ isDefaultValue: boolean;
21
+ reason: EvaluationReason;
22
+ context?: ConfigDirectorContext$1;
23
+ };
24
+ /**
25
+ * The user's context to be sent to ConfigDirector. This context will be used for targeting
26
+ * rules evaluation.
27
+ */
28
+ type ConfigDirectorContext$1 = {
29
+ /**
30
+ * The user's identifier. This should be a value that uniquely identifies an application
31
+ * user.
32
+ * In the case of anonymous users, you could generate a UUID or alternatively not provide
33
+ * the {@link id} and the SDK will generate a random UUID. However, keep in mind that this
34
+ * value is used for segmenting users in percentage rollouts, and changes to the {@link id}
35
+ * could result in the user being assigned to a different percentile.
36
+ */
37
+ id?: string;
38
+ /**
39
+ * The user's display name. This will be shown in the ConfigDirector dashboard and may be
40
+ * used for targeting rules.
41
+ */
42
+ name?: string;
43
+ /**
44
+ * Any arbitrary traits for the current user. They will be shown in the ConfigDirector
45
+ * dashboard and may be used for targeting rules.
46
+ */
47
+ traits?: {
48
+ [key: string]: unknown;
49
+ };
50
+ /**
51
+ * Whether or not to treat the context as anonymous during evaluation. When `true`, the
52
+ * context values will be used for targeting rules evaluation but the context will not be
53
+ * persisted and will not appear in the dashboard.
54
+ *
55
+ * @default false
56
+ */
57
+ anonymous?: boolean;
58
+ };
59
+ /**
60
+ * Metadata about your application. It is recommended you include these values when configuring
61
+ * a ConfigDirector client so that you can use them in targeting rules.
62
+ */
63
+ type ConfigDirectorMetaContext = {
64
+ appVersion?: string;
65
+ appName?: string;
66
+ };
67
+ type ConnectionMode = "streaming" | "polling" | "one-time";
68
+ //#endregion
69
+ //#region ../js-server-sdk/src/types.d.ts
70
+ /**
71
+ * Configuration options for the {@link ConfigDirectorClient}
72
+ */
73
+ type ConfigDirectorClientOptions$1 = {
74
+ /**
75
+ * Application metadata that remains constant through the lifetime of the connection
76
+ */
77
+ metadata?: ConfigDirectorMetaContext;
78
+ /**
79
+ * Connection options
80
+ */
81
+ connection?: {
82
+ /**
83
+ * The connection mode to be used, one of `streaming` (default), `polling`, or `one-time`.
84
+ * If set to `streaming`, the connection will remain open and receive updates whenever
85
+ * config state is updated on the ConfigDirector dashboard.
86
+ * When set to `polling`, there will be an initial request to retrieve config state during
87
+ * initialization, and additional requests on a `pollingInterval`.
88
+ * The `one-time` connection mode will only retrieve config state during initialization. It
89
+ * will not poll for regular updates.
90
+ *
91
+ * Defaults to `streaming`
92
+ */
93
+ mode?: ConnectionMode;
94
+ /**
95
+ * The polling interval in _seconds_ when the `mode` is set to `polling`. This option has no
96
+ * effect when the `mode` is set to `streaming` or `one-time`.
97
+ *
98
+ * Defaults to 60 seconds
99
+ */
100
+ pollingInterval?: number;
101
+ /**
102
+ * The timeout, in milliseconds, to be used in initialization and when updating the context.
103
+ * If streaming is enabled, the operation (initialization or context update) may still succeed
104
+ * after it times out if no unrecoverable errors are encountered (like an invalid SDK key).
105
+ * If streaming is disabled, if the operation times out, it will not be retried.
106
+ *
107
+ * Defaults to 3,000 milliseconds (3 seconds)
108
+ */
109
+ timeout?: number;
110
+ /**
111
+ * The base URL to the ConfigDirector SDK server. To be used only when needing to route through a
112
+ * proxy to connect to the ConfigDirector SDK server. Please refer to the docs on how to configure
113
+ * a proxy for the client SDK.
114
+ */
115
+ url?: string;
116
+ };
117
+ /**
118
+ * A logger that implements {@link ConfigDirectorLogger}. It defaults to the ConfigDirector console
119
+ * logger set to 'warn' level.
120
+ *
121
+ * The log level of the default logger can be adjusted by creating a default logger with the desired
122
+ * level and providing it in this property:
123
+ * @example
124
+ * import { createClient, createConsoleLogger } from "@configdirector/server-sdk";
125
+ * const client = createClient(
126
+ * "YOUR-SERVER-SDK-KEY",
127
+ * { logger: createConsoleLogger("debug") },
128
+ * );
129
+ */
130
+ logger?: ConfigDirectorLogger$1;
131
+ /**
132
+ * Telemetry tunning. It is unlikely these settings need to be adjusted. However, in cases where
133
+ * your application has a large number of evaluations per second, you can adjust these settings
134
+ * to tune the memory footprint and frequency of telemetry requests.
135
+ * Keep in mind that ConfigDirector relies on these telemetry events to provide insights and features
136
+ * related to the configs being used.
137
+ */
138
+ telemetry?: {
139
+ /**
140
+ * The size limit of telemetry event queues. If the size limit is reached before the events are
141
+ * flushed to the network, older events will be dropped.
142
+ *
143
+ * ConfigDirector keeps a count of dropped events. If the number of dropped events is higher than
144
+ * 50% of the total events, ConfigDirector will issue a notification alert in the dashboard.
145
+ *
146
+ * A number between 100 and 100,000. Defaults to 5,000.
147
+ */
148
+ eventQueueLimit?: number;
149
+ /**
150
+ * How often events are flushed and sent over the network in milliseconds.
151
+ *
152
+ * Decrease this number if your application consistently captures a large number of events in short
153
+ * periods of time in order to reduce memory footprint from a large event queue.
154
+ *
155
+ * Defaults to 30,000 milliseconds (30 seconds)
156
+ */
157
+ flushInterval?: number;
158
+ };
159
+ /**
160
+ * Handlers for hooks/events emitted by the client. Each hook accepts either a single event handler or
161
+ * an array of event handlers.
162
+ *
163
+ * @example
164
+ * import { createClient, createConsoleLogger } from "@configdirector/server-sdk";
165
+ * const client = createClient(
166
+ * "YOUR-SERVER-SDK-KEY",
167
+ * {
168
+ * hooks: {
169
+ * configEvaluated: (event) => { console.log(event.evaluation); }
170
+ * },
171
+ * },
172
+ * );
173
+ */
174
+ hooks?: ClientHooks;
175
+ };
176
+ type ClientEvents = {
177
+ configsUpdated: {
178
+ keys: string[];
179
+ };
180
+ clientReady: undefined;
181
+ configEvaluated: {
182
+ evaluation: ConfigEvaluation;
183
+ };
184
+ };
185
+ type ClientHooks = {
186
+ clientReady?: HookHandler<"clientReady"> | HookHandler<"clientReady">[];
187
+ configsUpdated?: HookHandler<"configsUpdated"> | HookHandler<"configsUpdated">[];
188
+ configEvaluated?: HookHandler<"configEvaluated"> | HookHandler<"configEvaluated">[];
189
+ };
190
+ type HookHandler<TEvent extends keyof ClientEvents> = (payload: ClientEvents[TEvent]) => void;
191
+ //#endregion
192
+ //#region src/ConfigDirectorProvider.d.ts
193
+ declare class ConfigDirectorProvider implements Provider {
194
+ private readonly client;
195
+ private readonly readyHandler;
196
+ readonly metadata: ProviderMetadata;
197
+ readonly runsOn: Paradigm;
198
+ readonly events: OpenFeatureEventEmitter;
199
+ constructor(clientSdkKey: string, clientOptions?: ConfigDirectorClientOptions$1);
200
+ initialize(): Promise<void>;
201
+ resolveBooleanEvaluation(flagKey: string, defaultValue: boolean, context: EvaluationContext): Promise<ResolutionDetails<boolean>>;
202
+ resolveStringEvaluation(flagKey: string, defaultValue: string, context: EvaluationContext): Promise<ResolutionDetails<string>>;
203
+ resolveNumberEvaluation(flagKey: string, defaultValue: number, context: EvaluationContext): Promise<ResolutionDetails<number>>;
204
+ resolveObjectEvaluation<T extends JsonValue>(flagKey: string, defaultValue: T, context: EvaluationContext): Promise<ResolutionDetails<T>>;
205
+ onClose?(): Promise<void>;
206
+ private evaluate;
207
+ private mapContext;
208
+ }
209
+ //#endregion
210
+ export { type ConfigDirectorClient, type ConfigDirectorClientOptions, type ConfigDirectorContext, type ConfigDirectorLogMessageDecorator, type ConfigDirectorLogger, type ConfigDirectorLoggingLevel, ConfigDirectorProvider, type ConfigValueType };
211
+ //# sourceMappingURL=configdirector-openfeature-server-provider.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configdirector-openfeature-server-provider.d.cts","names":[],"sources":["../../shared/src/types.ts","../../js-server-sdk/src/types.ts","../src/ConfigDirectorProvider.ts"],"mappings":";;;;KAYY,kBAAA;EAAA,CAAwB,GAAA;AAAA;AAAA,KAExB,iBAAA,wCAAuD,kBAAA;AAAA,UAiBlD,sBAAA;EACf,KAAA,CAAM,OAAA,aAAoB,IAAA;EAE1B,IAAA,CAAK,OAAA,aAAoB,IAAA;EAEzB,IAAA,CAAK,OAAA,aAAoB,IAAA;EAEzB,KAAA,CAAM,OAAA,aAAoB,IAAA;AAAA;AAAA,KAOhB,gBAAA;AAAA,KAUA,gBAAA;EACV,GAAA;EACA,KAAA,EAAO,iBAAA;EACP,OAAA;EACA,cAAA;EACA,MAAA,EAAQ,gBAAA;EACR,OAAA,GAAU,uBAAA;AAAA;;AANZ;;;KAYY,uBAAA;EAPF;;;;;;;;EAgBR,EAAA;EAhBA;;;;EAsBA,IAAA;EArB+B;AAMjC;;;EAqBE,MAAA;IAAA,CAAY,GAAA;EAAA;EAAZ;;;;;AAgBF;;EAPE,SAAA;AAAA;;AAYF;;;KALY,yBAAA;EACV,UAAA;EACA,OAAA;AAAA;AAAA,KAGU,cAAA;;;;AAjGZ;;KCeY,6BAAA;EDfwB;;AAEpC;ECiBE,QAAA,GAAW,yBAAA;;;;EAIX,UAAA;IDJmC;;;;;;;;;;;ICgBjC,IAAA,GAAO,cAAA;IDTT;;;;;AAOF;ICSI,eAAA;IDTwB;;;AAU5B;;;;;ICQI,OAAA;IDF6B;;;;;ICQ7B,GAAA;EAAA;EDTF;;;;;;AAOF;;;;;;;ECiBE,MAAA,GAAS,sBAAA;EDaT;;;AAOF;;;;ECXE,SAAA;IDgBU;;;;;;;;AClFZ;IA4EI,eAAA;IA5EmC;;;;;;;;IAsFnC,aAAA;EAAA;EAlEA;;;;;;;;;;;;;;AAuFJ;EAHE,KAAA,GAAQ,WAAA;AAAA;AAAA,KAGE,YAAA;EACV,cAAA;IAAkB,IAAA;EAAA;EAClB,WAAA;EACA,eAAA;IAAmB,UAAA,EAAY,gBAAA;EAAA;AAAA;AAAA,KAGrB,WAAA;EACV,WAAA,GAAc,WAAA,kBAA6B,WAAA;EAC3C,cAAA,GAAiB,WAAA,qBAAgC,WAAA;EACjD,eAAA,GAAkB,WAAA,sBAAiC,WAAA;AAAA;AAAA,KAGzC,WAAA,sBAAiC,YAAA,KAAiB,OAAA,EAAS,YAAA,CAAa,MAAA;;;cCrIvE,sBAAA,YAAkC,QAAA;EAAA,iBAC5B,MAAA;EAAA,iBACA,YAAA;EAAA,SAER,QAAA,EAAU,gBAAA;EAAA,SAGV,MAAA,EAAQ,QAAA;EAAA,SACR,MAAA,EAAM,uBAAA;cAEI,YAAA,UAAsB,aAAA,GAAgB,6BAAA;EAiBnD,UAAA,CAAA,GAAU,OAAA;EAMhB,wBAAA,CACE,OAAA,UACA,YAAA,WACA,OAAA,EAAS,iBAAA,GACR,OAAA,CAAQ,iBAAA;EAIX,uBAAA,CACE,OAAA,UACA,YAAA,UACA,OAAA,EAAS,iBAAA,GACR,OAAA,CAAQ,iBAAA;EAIX,uBAAA,CACE,OAAA,UACA,YAAA,UACA,OAAA,EAAS,iBAAA,GACR,OAAA,CAAQ,iBAAA;EAIX,uBAAA,WAAkC,SAAA,CAAA,CAChC,OAAA,UACA,YAAA,EAAc,CAAA,EACd,OAAA,EAAS,iBAAA,GACR,OAAA,CAAQ,iBAAA,CAAkB,CAAA;EAM7B,OAAA,CAAA,CAAA,GAAY,OAAA;EAAA,QAKJ,QAAA;EAAA,QAWA,UAAA;AAAA"}
@@ -0,0 +1,211 @@
1
+ import { EvaluationContext, JsonValue, OpenFeatureEventEmitter, Paradigm, Provider, ProviderMetadata, ResolutionDetails } from "@openfeature/server-sdk";
2
+ import { ConfigDirectorClient, ConfigDirectorClientOptions, ConfigDirectorContext, ConfigDirectorLogMessageDecorator, ConfigDirectorLogger, ConfigDirectorLoggingLevel, ConfigValueType } from "@js-client-core/index";
3
+
4
+ //#region ../shared/src/types.d.ts
5
+ type ConfigEnumLikeType = {
6
+ [key: string]: string | number;
7
+ };
8
+ type ConfigValueType$1 = string | number | boolean | object | ConfigEnumLikeType;
9
+ interface ConfigDirectorLogger$1 {
10
+ debug(message: string, ...args: any): void;
11
+ info(message: string, ...args: any): void;
12
+ warn(message: string, ...args: any): void;
13
+ error(message: string, ...args: any): void;
14
+ }
15
+ type EvaluationReason = "found-match" | "config-state-missing" | "client-not-ready" | "type-mismatch" | "value-missing" | "invalid-number" | "invalid-json" | "invalid-boolean";
16
+ type ConfigEvaluation = {
17
+ key: string;
18
+ value: ConfigValueType$1;
19
+ valueId?: string;
20
+ isDefaultValue: boolean;
21
+ reason: EvaluationReason;
22
+ context?: ConfigDirectorContext$1;
23
+ };
24
+ /**
25
+ * The user's context to be sent to ConfigDirector. This context will be used for targeting
26
+ * rules evaluation.
27
+ */
28
+ type ConfigDirectorContext$1 = {
29
+ /**
30
+ * The user's identifier. This should be a value that uniquely identifies an application
31
+ * user.
32
+ * In the case of anonymous users, you could generate a UUID or alternatively not provide
33
+ * the {@link id} and the SDK will generate a random UUID. However, keep in mind that this
34
+ * value is used for segmenting users in percentage rollouts, and changes to the {@link id}
35
+ * could result in the user being assigned to a different percentile.
36
+ */
37
+ id?: string;
38
+ /**
39
+ * The user's display name. This will be shown in the ConfigDirector dashboard and may be
40
+ * used for targeting rules.
41
+ */
42
+ name?: string;
43
+ /**
44
+ * Any arbitrary traits for the current user. They will be shown in the ConfigDirector
45
+ * dashboard and may be used for targeting rules.
46
+ */
47
+ traits?: {
48
+ [key: string]: unknown;
49
+ };
50
+ /**
51
+ * Whether or not to treat the context as anonymous during evaluation. When `true`, the
52
+ * context values will be used for targeting rules evaluation but the context will not be
53
+ * persisted and will not appear in the dashboard.
54
+ *
55
+ * @default false
56
+ */
57
+ anonymous?: boolean;
58
+ };
59
+ /**
60
+ * Metadata about your application. It is recommended you include these values when configuring
61
+ * a ConfigDirector client so that you can use them in targeting rules.
62
+ */
63
+ type ConfigDirectorMetaContext = {
64
+ appVersion?: string;
65
+ appName?: string;
66
+ };
67
+ type ConnectionMode = "streaming" | "polling" | "one-time";
68
+ //#endregion
69
+ //#region ../js-server-sdk/src/types.d.ts
70
+ /**
71
+ * Configuration options for the {@link ConfigDirectorClient}
72
+ */
73
+ type ConfigDirectorClientOptions$1 = {
74
+ /**
75
+ * Application metadata that remains constant through the lifetime of the connection
76
+ */
77
+ metadata?: ConfigDirectorMetaContext;
78
+ /**
79
+ * Connection options
80
+ */
81
+ connection?: {
82
+ /**
83
+ * The connection mode to be used, one of `streaming` (default), `polling`, or `one-time`.
84
+ * If set to `streaming`, the connection will remain open and receive updates whenever
85
+ * config state is updated on the ConfigDirector dashboard.
86
+ * When set to `polling`, there will be an initial request to retrieve config state during
87
+ * initialization, and additional requests on a `pollingInterval`.
88
+ * The `one-time` connection mode will only retrieve config state during initialization. It
89
+ * will not poll for regular updates.
90
+ *
91
+ * Defaults to `streaming`
92
+ */
93
+ mode?: ConnectionMode;
94
+ /**
95
+ * The polling interval in _seconds_ when the `mode` is set to `polling`. This option has no
96
+ * effect when the `mode` is set to `streaming` or `one-time`.
97
+ *
98
+ * Defaults to 60 seconds
99
+ */
100
+ pollingInterval?: number;
101
+ /**
102
+ * The timeout, in milliseconds, to be used in initialization and when updating the context.
103
+ * If streaming is enabled, the operation (initialization or context update) may still succeed
104
+ * after it times out if no unrecoverable errors are encountered (like an invalid SDK key).
105
+ * If streaming is disabled, if the operation times out, it will not be retried.
106
+ *
107
+ * Defaults to 3,000 milliseconds (3 seconds)
108
+ */
109
+ timeout?: number;
110
+ /**
111
+ * The base URL to the ConfigDirector SDK server. To be used only when needing to route through a
112
+ * proxy to connect to the ConfigDirector SDK server. Please refer to the docs on how to configure
113
+ * a proxy for the client SDK.
114
+ */
115
+ url?: string;
116
+ };
117
+ /**
118
+ * A logger that implements {@link ConfigDirectorLogger}. It defaults to the ConfigDirector console
119
+ * logger set to 'warn' level.
120
+ *
121
+ * The log level of the default logger can be adjusted by creating a default logger with the desired
122
+ * level and providing it in this property:
123
+ * @example
124
+ * import { createClient, createConsoleLogger } from "@configdirector/server-sdk";
125
+ * const client = createClient(
126
+ * "YOUR-SERVER-SDK-KEY",
127
+ * { logger: createConsoleLogger("debug") },
128
+ * );
129
+ */
130
+ logger?: ConfigDirectorLogger$1;
131
+ /**
132
+ * Telemetry tunning. It is unlikely these settings need to be adjusted. However, in cases where
133
+ * your application has a large number of evaluations per second, you can adjust these settings
134
+ * to tune the memory footprint and frequency of telemetry requests.
135
+ * Keep in mind that ConfigDirector relies on these telemetry events to provide insights and features
136
+ * related to the configs being used.
137
+ */
138
+ telemetry?: {
139
+ /**
140
+ * The size limit of telemetry event queues. If the size limit is reached before the events are
141
+ * flushed to the network, older events will be dropped.
142
+ *
143
+ * ConfigDirector keeps a count of dropped events. If the number of dropped events is higher than
144
+ * 50% of the total events, ConfigDirector will issue a notification alert in the dashboard.
145
+ *
146
+ * A number between 100 and 100,000. Defaults to 5,000.
147
+ */
148
+ eventQueueLimit?: number;
149
+ /**
150
+ * How often events are flushed and sent over the network in milliseconds.
151
+ *
152
+ * Decrease this number if your application consistently captures a large number of events in short
153
+ * periods of time in order to reduce memory footprint from a large event queue.
154
+ *
155
+ * Defaults to 30,000 milliseconds (30 seconds)
156
+ */
157
+ flushInterval?: number;
158
+ };
159
+ /**
160
+ * Handlers for hooks/events emitted by the client. Each hook accepts either a single event handler or
161
+ * an array of event handlers.
162
+ *
163
+ * @example
164
+ * import { createClient, createConsoleLogger } from "@configdirector/server-sdk";
165
+ * const client = createClient(
166
+ * "YOUR-SERVER-SDK-KEY",
167
+ * {
168
+ * hooks: {
169
+ * configEvaluated: (event) => { console.log(event.evaluation); }
170
+ * },
171
+ * },
172
+ * );
173
+ */
174
+ hooks?: ClientHooks;
175
+ };
176
+ type ClientEvents = {
177
+ configsUpdated: {
178
+ keys: string[];
179
+ };
180
+ clientReady: undefined;
181
+ configEvaluated: {
182
+ evaluation: ConfigEvaluation;
183
+ };
184
+ };
185
+ type ClientHooks = {
186
+ clientReady?: HookHandler<"clientReady"> | HookHandler<"clientReady">[];
187
+ configsUpdated?: HookHandler<"configsUpdated"> | HookHandler<"configsUpdated">[];
188
+ configEvaluated?: HookHandler<"configEvaluated"> | HookHandler<"configEvaluated">[];
189
+ };
190
+ type HookHandler<TEvent extends keyof ClientEvents> = (payload: ClientEvents[TEvent]) => void;
191
+ //#endregion
192
+ //#region src/ConfigDirectorProvider.d.ts
193
+ declare class ConfigDirectorProvider implements Provider {
194
+ private readonly client;
195
+ private readonly readyHandler;
196
+ readonly metadata: ProviderMetadata;
197
+ readonly runsOn: Paradigm;
198
+ readonly events: OpenFeatureEventEmitter;
199
+ constructor(clientSdkKey: string, clientOptions?: ConfigDirectorClientOptions$1);
200
+ initialize(): Promise<void>;
201
+ resolveBooleanEvaluation(flagKey: string, defaultValue: boolean, context: EvaluationContext): Promise<ResolutionDetails<boolean>>;
202
+ resolveStringEvaluation(flagKey: string, defaultValue: string, context: EvaluationContext): Promise<ResolutionDetails<string>>;
203
+ resolveNumberEvaluation(flagKey: string, defaultValue: number, context: EvaluationContext): Promise<ResolutionDetails<number>>;
204
+ resolveObjectEvaluation<T extends JsonValue>(flagKey: string, defaultValue: T, context: EvaluationContext): Promise<ResolutionDetails<T>>;
205
+ onClose?(): Promise<void>;
206
+ private evaluate;
207
+ private mapContext;
208
+ }
209
+ //#endregion
210
+ export { type ConfigDirectorClient, type ConfigDirectorClientOptions, type ConfigDirectorContext, type ConfigDirectorLogMessageDecorator, type ConfigDirectorLogger, type ConfigDirectorLoggingLevel, ConfigDirectorProvider, type ConfigValueType };
211
+ //# sourceMappingURL=configdirector-openfeature-server-provider.d.mts.map