@spotify-confidence/openfeature-server-provider
Advanced tools
Comparing version 0.0.5 to 0.1.0
import { EvaluationContext, JsonValue, Logger, Provider, ProviderMetadata, ProviderStatus, ResolutionDetails } from '@openfeature/js-sdk'; | ||
import { ConfidenceClient } from '@spotify-confidence/client-http'; | ||
interface ConfidenceServerProviderOptions { | ||
apply?: { | ||
timeout?: number; | ||
}; | ||
} | ||
export declare class ConfidenceServerProvider implements Provider { | ||
@@ -12,4 +7,3 @@ readonly metadata: ProviderMetadata; | ||
private readonly client; | ||
private readonly applyManager; | ||
constructor(client: ConfidenceClient, options?: ConfidenceServerProviderOptions); | ||
constructor(client: ConfidenceClient); | ||
private convertContext; | ||
@@ -23,3 +17,2 @@ private getFlag; | ||
} | ||
export {}; | ||
//# sourceMappingURL=ConfidenceServerProvider.d.ts.map |
@@ -27,4 +27,3 @@ "use strict"; | ||
class ConfidenceServerProvider { | ||
constructor(client, options) { | ||
var _a; | ||
constructor(client) { | ||
this.metadata = { | ||
@@ -35,3 +34,2 @@ name: 'ConfidenceServerProvider', | ||
this.client = client; | ||
this.applyManager = new client_http_1.ApplyManager({ client, timeout: ((_a = options === null || options === void 0 ? void 0 : options.apply) === null || _a === void 0 ? void 0 : _a.timeout) || 250 }); | ||
} | ||
@@ -87,3 +85,2 @@ convertContext(context) { | ||
} | ||
this.applyManager.apply(configuration.resolveToken, flagName); | ||
return { | ||
@@ -90,0 +87,0 @@ value: flagValue.value, |
@@ -7,5 +7,3 @@ import { Provider } from '@openfeature/js-sdk'; | ||
baseUrl?: string; | ||
apply?: { | ||
timeout: number; | ||
}; | ||
timeout: number; | ||
}; | ||
@@ -12,0 +10,0 @@ export declare function createConfidenceServerProvider(options: ConfidenceProviderFactoryOptions): Provider; |
@@ -7,8 +7,6 @@ "use strict"; | ||
function createConfidenceServerProvider(options) { | ||
const confidenceClient = new client_http_1.ConfidenceClient(Object.assign(Object.assign({}, options), { apply: !options.apply })); | ||
return new ConfidenceServerProvider_1.ConfidenceServerProvider(confidenceClient, { | ||
apply: options.apply, | ||
}); | ||
const confidenceClient = new client_http_1.ConfidenceClient(Object.assign(Object.assign({}, options), { apply: true })); | ||
return new ConfidenceServerProvider_1.ConfidenceServerProvider(confidenceClient); | ||
} | ||
exports.createConfidenceServerProvider = createConfidenceServerProvider; | ||
//# sourceMappingURL=factory.js.map |
import { EvaluationContext, JsonValue, Logger, Provider, ProviderMetadata, ProviderStatus, ResolutionDetails } from '@openfeature/js-sdk'; | ||
import { ConfidenceClient } from '@spotify-confidence/client-http'; | ||
interface ConfidenceServerProviderOptions { | ||
apply?: { | ||
timeout?: number; | ||
}; | ||
} | ||
export declare class ConfidenceServerProvider implements Provider { | ||
@@ -12,4 +7,3 @@ readonly metadata: ProviderMetadata; | ||
private readonly client; | ||
private readonly applyManager; | ||
constructor(client: ConfidenceClient, options?: ConfidenceServerProviderOptions); | ||
constructor(client: ConfidenceClient); | ||
private convertContext; | ||
@@ -23,3 +17,2 @@ private getFlag; | ||
} | ||
export {}; | ||
//# sourceMappingURL=ConfidenceServerProvider.d.ts.map |
@@ -22,6 +22,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { ErrorCode, ProviderStatus, } from '@openfeature/js-sdk'; | ||
import { ApplyManager, Configuration } from '@spotify-confidence/client-http'; | ||
import { Configuration } from '@spotify-confidence/client-http'; | ||
export class ConfidenceServerProvider { | ||
constructor(client, options) { | ||
var _a; | ||
constructor(client) { | ||
this.metadata = { | ||
@@ -32,3 +31,2 @@ name: 'ConfidenceServerProvider', | ||
this.client = client; | ||
this.applyManager = new ApplyManager({ client, timeout: ((_a = options === null || options === void 0 ? void 0 : options.apply) === null || _a === void 0 ? void 0 : _a.timeout) || 250 }); | ||
} | ||
@@ -84,3 +82,2 @@ convertContext(context) { | ||
} | ||
this.applyManager.apply(configuration.resolveToken, flagName); | ||
return { | ||
@@ -87,0 +84,0 @@ value: flagValue.value, |
@@ -7,5 +7,3 @@ import { Provider } from '@openfeature/js-sdk'; | ||
baseUrl?: string; | ||
apply?: { | ||
timeout: number; | ||
}; | ||
timeout: number; | ||
}; | ||
@@ -12,0 +10,0 @@ export declare function createConfidenceServerProvider(options: ConfidenceProviderFactoryOptions): Provider; |
import { ConfidenceClient } from '@spotify-confidence/client-http'; | ||
import { ConfidenceServerProvider } from './ConfidenceServerProvider'; | ||
export function createConfidenceServerProvider(options) { | ||
const confidenceClient = new ConfidenceClient(Object.assign(Object.assign({}, options), { apply: !options.apply })); | ||
return new ConfidenceServerProvider(confidenceClient, { | ||
apply: options.apply, | ||
}); | ||
const confidenceClient = new ConfidenceClient(Object.assign(Object.assign({}, options), { apply: true })); | ||
return new ConfidenceServerProvider(confidenceClient); | ||
} | ||
//# sourceMappingURL=factory.js.map |
import { EvaluationContext, JsonValue, Logger, Provider, ProviderMetadata, ProviderStatus, ResolutionDetails } from '@openfeature/js-sdk'; | ||
import { ConfidenceClient } from '@spotify-confidence/client-http'; | ||
interface ConfidenceServerProviderOptions { | ||
apply?: { | ||
timeout?: number; | ||
}; | ||
} | ||
export declare class ConfidenceServerProvider implements Provider { | ||
@@ -12,4 +7,3 @@ readonly metadata: ProviderMetadata; | ||
private readonly client; | ||
private readonly applyManager; | ||
constructor(client: ConfidenceClient, options?: ConfidenceServerProviderOptions); | ||
constructor(client: ConfidenceClient); | ||
private convertContext; | ||
@@ -23,3 +17,2 @@ private getFlag; | ||
} | ||
export {}; | ||
//# sourceMappingURL=ConfidenceServerProvider.d.ts.map |
@@ -22,6 +22,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { ErrorCode, ProviderStatus, } from '@openfeature/js-sdk'; | ||
import { ApplyManager, Configuration } from '@spotify-confidence/client-http'; | ||
import { Configuration } from '@spotify-confidence/client-http'; | ||
export class ConfidenceServerProvider { | ||
constructor(client, options) { | ||
var _a; | ||
constructor(client) { | ||
this.metadata = { | ||
@@ -32,3 +31,2 @@ name: 'ConfidenceServerProvider', | ||
this.client = client; | ||
this.applyManager = new ApplyManager({ client, timeout: ((_a = options === null || options === void 0 ? void 0 : options.apply) === null || _a === void 0 ? void 0 : _a.timeout) || 250 }); | ||
} | ||
@@ -84,3 +82,2 @@ convertContext(context) { | ||
} | ||
this.applyManager.apply(configuration.resolveToken, flagName); | ||
return { | ||
@@ -87,0 +84,0 @@ value: flagValue.value, |
@@ -7,5 +7,3 @@ import { Provider } from '@openfeature/js-sdk'; | ||
baseUrl?: string; | ||
apply?: { | ||
timeout: number; | ||
}; | ||
timeout: number; | ||
}; | ||
@@ -12,0 +10,0 @@ export declare function createConfidenceServerProvider(options: ConfidenceProviderFactoryOptions): Provider; |
import { ConfidenceClient } from '@spotify-confidence/client-http'; | ||
import { ConfidenceServerProvider } from './ConfidenceServerProvider'; | ||
export function createConfidenceServerProvider(options) { | ||
const confidenceClient = new ConfidenceClient(Object.assign(Object.assign({}, options), { apply: !options.apply })); | ||
return new ConfidenceServerProvider(confidenceClient, { | ||
apply: options.apply, | ||
}); | ||
const confidenceClient = new ConfidenceClient(Object.assign(Object.assign({}, options), { apply: true })); | ||
return new ConfidenceServerProvider(confidenceClient); | ||
} | ||
//# sourceMappingURL=factory.js.map |
# Changelog | ||
## [0.1.0](https://github.com/spotify/confidence-openfeature-provider-js/compare/openfeature-server-provider-v0.0.5...openfeature-server-provider-v0.1.0) (2023-11-15) | ||
### ⚠ BREAKING CHANGES | ||
* **client-http,web,server,react,examples:** new required option: timeout | ||
### 🐛 Bug Fixes | ||
* **server:** remove access apply, add docs ([b2926c8](https://github.com/spotify/confidence-openfeature-provider-js/commit/b2926c8bf80d0e18f87e0d2191a537e517a17c9c)) | ||
### ✨ New Features | ||
* **client-http,web,server,react,examples:** add timeout for network request ([f460b97](https://github.com/spotify/confidence-openfeature-provider-js/commit/f460b97ec4e1c56375de52fd1eb664c7b9be1f35)) | ||
### 🔄 Refactoring | ||
* **web:** set access apply to default, add docs ([91d9ebf](https://github.com/spotify/confidence-openfeature-provider-js/commit/91d9ebff2ee826d6549587406e0ab61584ce0263)) | ||
## [0.0.5](https://github.com/spotify/confidence-openfeature-provider-js/compare/openfeature-server-provider-v0.0.4...openfeature-server-provider-v0.0.5) (2023-10-26) | ||
@@ -4,0 +25,0 @@ |
{ | ||
"name": "@spotify-confidence/openfeature-server-provider", | ||
"license": "Apache-2.0", | ||
"version": "0.0.5", | ||
"version": "0.1.0", | ||
"module": "build/esm/index.js", | ||
@@ -23,3 +23,3 @@ "main": "build/cjs/index.js", | ||
}, | ||
"gitHead": "6066377a115fb694a7af12ee1a7dc60f73b2fee3" | ||
"gitHead": "2bf37b7bab49dfe95fe753ad28689827d9885743" | ||
} |
@@ -28,2 +28,3 @@ # OpenFeature JS SDK JavaScript Confidence Provider | ||
fetchImplementation: fetch, | ||
timeout: 1000, | ||
}); | ||
@@ -43,1 +44,11 @@ | ||
``` | ||
## Timeout | ||
The timeout option is used to set the timeout for the network request to the Confidence backend. When the timeout is reached, default values will be returned. | ||
## Configuring Apply | ||
See [apply concept](../../concepts/apply.md). | ||
Backend apply is the only supported method in the `ConfidenceServerProvider`. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
53
166006
532