@spotify-confidence/openfeature-web-provider
Advanced tools
Comparing version 0.2.7 to 0.2.8
@@ -9,2 +9,9 @@ # Changelog | ||
## [0.2.8](https://github.com/spotify/confidence-sdk-js/compare/openfeature-web-provider-v0.2.7...openfeature-web-provider-v0.2.8) (2024-06-04) | ||
### ๐ Bug Fixes | ||
* cache timeouts ([#157](https://github.com/spotify/confidence-sdk-js/issues/157)) ([357bb02](https://github.com/spotify/confidence-sdk-js/commit/357bb025b02183f26700fa5df857d3528a51f747)), closes [#155](https://github.com/spotify/confidence-sdk-js/issues/155) | ||
## [0.2.7](https://github.com/spotify/confidence-sdk-js/compare/openfeature-web-provider-v0.2.5...openfeature-web-provider-v0.2.7) (2024-06-03) | ||
@@ -11,0 +18,0 @@ |
@@ -19,3 +19,3 @@ import { Confidence } from '@spotify-confidence/sdk'; | ||
onContextChange(oldContext: EvaluationContext, newContext: EvaluationContext): Promise<void>; | ||
private expectReadyOrTimeout; | ||
private expectReadyOrError; | ||
private evaluateFlag; | ||
@@ -22,0 +22,0 @@ private mapErrorCode; |
@@ -78,3 +78,3 @@ import { ErrorCode, OpenFeatureEventEmitter, ProviderEvents } from '@openfeature/web-sdk'; | ||
}); | ||
return _this.expectReadyOrTimeout(); | ||
return _this.expectReadyOrError(); | ||
})(); | ||
@@ -97,16 +97,13 @@ } | ||
_this.confidence.setContext(convertContext(changes)); | ||
return _this.expectReadyOrTimeout(); | ||
return _this.expectReadyOrError(); | ||
})(); | ||
} | ||
expectReadyOrTimeout() { | ||
const timeout = this.confidence.config.timeout; | ||
expectReadyOrError() { | ||
let close; | ||
return new Promise((resolve, reject)=>{ | ||
const timeoutId = setTimeout(()=>{ | ||
reject(new Error(`Resolve timed out after ${timeout}ms`)); | ||
}, timeout); | ||
close = this.confidence.subscribe((state)=>{ | ||
if (state === 'READY') { | ||
resolve(); | ||
clearTimeout(timeoutId); | ||
} else if (state === 'ERROR') { | ||
reject(new Error('Provider initialization failed')); | ||
} | ||
@@ -113,0 +110,0 @@ }); |
{ | ||
"name": "@spotify-confidence/openfeature-web-provider", | ||
"license": "Apache-2.0", | ||
"version": "0.2.7", | ||
"version": "0.2.8", | ||
"type": "module", | ||
@@ -18,3 +18,3 @@ "types": "dist/index.d.ts", | ||
"@openfeature/web-sdk": "^1.0.3", | ||
"@spotify-confidence/sdk": "0.1.2" | ||
"@spotify-confidence/sdk": "0.1.3" | ||
}, | ||
@@ -28,4 +28,5 @@ "publishConfig": { | ||
"scripts": { | ||
"build": "tsc", | ||
"bundle": "rollup -c && api-extractor run" | ||
"build": "tsc -b", | ||
"bundle": "rollup -c && api-extractor run", | ||
"prepack": "yarn build && yarn bundle" | ||
}, | ||
@@ -32,0 +33,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
35752
260