tas-client
Advanced tools
Comparing version 0.0.363 to 0.0.668
{ | ||
"name": "tas-client", | ||
"version": "0.0.363", | ||
"version": "0.0.668", | ||
"description": "This package is intended to be used as an endpoint client to query, refetch, and cache data from the Experimentation service (or any given endpoint). The endpoint result must follow the required structure for experimentation data.", | ||
@@ -5,0 +5,0 @@ "main": "./out/src/index", |
@@ -29,2 +29,3 @@ "use strict"; | ||
this.addFeatureProvider(new TasApiFeatureProvider_1.TasApiFeatureProvider(new AxiosHttpClient_1.AxiosHttpClient(this.options.endpoint), this.telemetry, this.filterProviders)); | ||
super.init(); | ||
} | ||
@@ -31,0 +32,0 @@ } |
@@ -18,6 +18,3 @@ import { ExperimentationServiceBase } from './ExperimentationServiceBase'; | ||
constructor(telemetry: IExperimentationTelemetry, filterProviders: IExperimentationFilterProvider[], refreshRateMs: number, telemetryPropertyName: string, telemetryEventName: string, storageKey?: string | undefined, storage?: IKeyValueStorage | undefined); | ||
/** | ||
* Wrapper that will reset the polling intervals whenever the feature data is fetched manually. | ||
*/ | ||
protected getFeaturesAsync(): Promise<string[]>; | ||
protected init(): void; | ||
} |
@@ -29,15 +29,5 @@ "use strict"; | ||
} | ||
/** | ||
* Wrapper that will reset the polling intervals whenever the feature data is fetched manually. | ||
*/ | ||
async getFeaturesAsync() { | ||
if (!this.pollingService) { | ||
return await super.getFeaturesAsync(); | ||
} | ||
else { | ||
this.pollingService.StopPolling(); | ||
let result = await super.getFeaturesAsync(); | ||
this.pollingService.StartPolling(); | ||
return result; | ||
} | ||
init() { | ||
var _a; | ||
(_a = this.pollingService) === null || _a === void 0 ? void 0 : _a.StartPolling(true); | ||
} | ||
@@ -44,0 +34,0 @@ } |
@@ -29,3 +29,3 @@ import { IExperimentationService } from '../contracts/IExperimentationService'; | ||
*/ | ||
protected getFeaturesAsync(): Promise<string[]>; | ||
protected getFeaturesAsync(override?: boolean): Promise<string[]>; | ||
/** | ||
@@ -35,3 +35,3 @@ * | ||
*/ | ||
protected updateFeatures(featureResults: string[][]): void; | ||
protected updateFeatures(featureResults: string[][], override?: boolean): void; | ||
private featuresChanged; | ||
@@ -38,0 +38,0 @@ private getFromCache; |
@@ -43,3 +43,3 @@ "use strict"; | ||
*/ | ||
async getFeaturesAsync() { | ||
async getFeaturesAsync(override = false) { | ||
/** | ||
@@ -68,3 +68,3 @@ * If there's already a fetching promise, there's no need to call it again. | ||
this.fetchPromise = undefined; | ||
this.updateFeatures(featureResults); | ||
this.updateFeatures(featureResults, override); | ||
this.setState(ExperimentationServiceState.FeaturesLoaded); | ||
@@ -81,3 +81,3 @@ /** | ||
*/ | ||
updateFeatures(featureResults) { | ||
updateFeatures(featureResults, override = false) { | ||
/** | ||
@@ -104,3 +104,5 @@ * if features comes as a null value, that is taken as if there aren't any features active, | ||
*/ | ||
this.features = features; | ||
if (override) { | ||
this.features = features; | ||
} | ||
/** | ||
@@ -110,3 +112,3 @@ * If we have storage, we cache the latest results into the storage. | ||
if (this.storage) { | ||
this.storage.setValue(this.storageKey, this.features); | ||
this.storage.setValue(this.storageKey, features); | ||
} | ||
@@ -142,3 +144,3 @@ } | ||
// If features haven't been loaded, we load the features in the cache, and save them into memory. | ||
if (this.isState(ExperimentationServiceState.None)) { | ||
if (!this.isState(ExperimentationServiceState.FeaturesLoaded)) { | ||
// Features will only be get from cache once, and only if IsFlightEnabledAsync hasn't been called yet. | ||
@@ -159,3 +161,3 @@ let cachedFeatures = await this.getFromCache(); | ||
async isFlightEnabledAsync(flight) { | ||
const features = await this.getFeaturesAsync(); | ||
const features = await this.getFeaturesAsync(true); | ||
this.PostEventToTelemetry(flight); | ||
@@ -162,0 +164,0 @@ return features.includes(flight); |
@@ -8,3 +8,3 @@ export declare class PollingService { | ||
OnPollTick(callback: () => Promise<void>): void; | ||
StartPolling(): void; | ||
StartPolling(initialPoll?: boolean): void; | ||
} |
@@ -14,3 +14,3 @@ "use strict"; | ||
} | ||
StartPolling() { | ||
StartPolling(initialPoll = false) { | ||
if (this.intervalHandle) { | ||
@@ -23,2 +23,5 @@ this.StopPolling(); | ||
} | ||
if (initialPoll) { | ||
this.onTick().then(() => { return; }).catch(() => { return; }); | ||
} | ||
/** | ||
@@ -25,0 +28,0 @@ * Set the interval to start running. |
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
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
88205
1293