Launch Week Day 1: Socket for Jira Is Now Available.Learn More
Socket
Book a DemoSign in
Socket

tas-client

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tas-client - npm Package Compare versions

Comparing version
0.0.668
to
0.0.762
+8
-2
contracts/ExperimentationServiceConfig.d.ts

@@ -15,3 +15,3 @@ import { IExperimentationTelemetry } from './IExperimentationTelemetry';

/**
* A string containing the name for the telemetry option.
* A string containing the name for the features telemetry property.
* This option is implemented in IExperimentation Telemetry.

@@ -21,4 +21,10 @@ * This options posts to the implementation a list of

*/
telemetryPropertyName: string;
featuresTelemetryPropertyName: string;
/**
* A string containing the name for the assignment context telemetry property.
* This option is implemented in IExperimentation Telemetry.
* This options posts to the implementation the assignment context.
*/
assignmentContextTelemetryPropertyName: string;
/**
* The name for the telemetry event. This event will be posted every time a flight is queried.

@@ -25,0 +31,0 @@ */

+4
-3
{
"name": "tas-client",
"version": "0.0.668",
"version": "0.0.762",
"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.",

@@ -10,3 +10,3 @@ "main": "./out/src/index",

"watch": "tsc -watch -p ./",
"test": "npm run compile && mocha --require source-map-support/register out/src/tests/*.js",
"test": "npm run compile && mocha --require source-map-support/register out/test/*.js",
"clean-build-link": "npm install && npm run compile && npm link",

@@ -38,2 +38,3 @@ "format": "prettier --write \"src/**/*.{ts,tsx}\"",

"source-map-support": "^0.5.16",
"ts-node": "^8.10.1",
"tslint": "^5.17.0",

@@ -44,4 +45,4 @@ "tslint-microsoft-contrib": "^6.2.0",

"dependencies": {
"axios": "^0.18.0"
"axios": "^0.19.0"
}
}
import { IFeatureProvider } from './FeatureProvider/IFeatureProvider';
import { ExperimentationServiceState } from './ExperimentationServiceBase';
import { ExperimentationServiceConfig } from '../contracts/ExperimentationServiceConfig';

@@ -15,5 +14,4 @@ import { ExperimentationServiceAutoPolling } from './ExperimentationServiceAutoPolling';

protected featureProviders?: IFeatureProvider[];
protected state: ExperimentationServiceState;
constructor(options: ExperimentationServiceConfig);
protected init(): void;
}

@@ -5,3 +5,2 @@ "use strict";

const AxiosHttpClient_1 = require("./Util/AxiosHttpClient");
const ExperimentationServiceBase_1 = require("./ExperimentationServiceBase");
const ExperimentationServiceAutoPolling_1 = require("./ExperimentationServiceAutoPolling");

@@ -20,5 +19,4 @@ /**

: // If no fetch interval is provided, refetch functionality is turned off.
0, options.telemetryPropertyName, options.telemetryEventName, options.storageKey, options.keyValueStorage);
0, options.featuresTelemetryPropertyName, options.assignmentContextTelemetryPropertyName, options.telemetryEventName, options.storageKey, options.keyValueStorage);
this.options = options;
this.state = ExperimentationServiceBase_1.ExperimentationServiceState.None;
this.invokeInit();

@@ -31,2 +29,3 @@ }

this.addFeatureProvider(new TasApiFeatureProvider_1.TasApiFeatureProvider(new AxiosHttpClient_1.AxiosHttpClient(this.options.endpoint), this.telemetry, this.filterProviders));
// This will start polling the TAS.
super.init();

@@ -33,0 +32,0 @@ }

@@ -1,1 +0,1 @@

{"version":3,"file":"ExperimentationService.js","sourceRoot":"","sources":["../../../src/tas-client/ExperimentationService.ts"],"names":[],"mappings":";;AACA,mFAAgF;AAChF,4DAAyD;AACzD,6EAA2E;AAE3E,2FAAwF;AAExF;;;;;GAKG;AACH,MAAa,sBAAuB,SAAQ,qEAAiC;IAMzE,YAAoB,OAAqC;QACrD,KAAK,CACD,OAAO,CAAC,SAAS,EACjB,OAAO,CAAC,eAAe,IAAI,EAAE,EAAE,4BAA4B;QAC3D,OAAO,CAAC,eAAe,IAAI,IAAI;YAC3B,CAAC,CAAC,OAAO,CAAC,eAAe;YACzB,CAAC,CAAC,yEAAyE;gBACzE,CAAC,EACP,OAAO,CAAC,qBAAqB,EAC7B,OAAO,CAAC,kBAAkB,EAC1B,OAAO,CAAC,UAAU,EAClB,OAAO,CAAC,eAAe,CAC1B,CAAC;QAZc,YAAO,GAAP,OAAO,CAA8B;QAF/C,UAAK,GAAgC,wDAA2B,CAAC,IAAI,CAAC;QAe5E,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;IAES,IAAI;QACV,8CAA8C;QAC9C,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAE3B,+BAA+B;QAC/B,IAAI,CAAC,kBAAkB,CACnB,IAAI,6CAAqB,CACrB,IAAI,iCAAe,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAC1C,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,eAAe,CACvB,CACJ,CAAC;QAEF,KAAK,CAAC,IAAI,EAAE,CAAC;IACjB,CAAC;;AApCL,wDAqCC;AApCiB,8CAAuB,GAAW,EAAE,CAAC"}
{"version":3,"file":"ExperimentationService.js","sourceRoot":"","sources":["../../../src/tas-client/ExperimentationService.ts"],"names":[],"mappings":";;AACA,mFAAgF;AAChF,4DAAyD;AAEzD,2FAAwF;AAExF;;;;;GAKG;AACH,MAAa,sBAAuB,SAAQ,qEAAiC;IAKzE,YAAoB,OAAqC;QACrD,KAAK,CACD,OAAO,CAAC,SAAS,EACjB,OAAO,CAAC,eAAe,IAAI,EAAE,EAAE,4BAA4B;QAC3D,OAAO,CAAC,eAAe,IAAI,IAAI;YAC3B,CAAC,CAAC,OAAO,CAAC,eAAe;YACzB,CAAC,CAAC,yEAAyE;gBACzE,CAAC,EACP,OAAO,CAAC,6BAA6B,EACrC,OAAO,CAAC,sCAAsC,EAC9C,OAAO,CAAC,kBAAkB,EAC1B,OAAO,CAAC,UAAU,EAClB,OAAO,CAAC,eAAe,CAC1B,CAAC;QAbc,YAAO,GAAP,OAAO,CAA8B;QAcrD,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;IAES,IAAI;QACV,8CAA8C;QAC9C,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAE3B,+BAA+B;QAC/B,IAAI,CAAC,kBAAkB,CACnB,IAAI,6CAAqB,CACrB,IAAI,iCAAe,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAC1C,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,eAAe,CACvB,CACJ,CAAC;QAEF,mCAAmC;QACnC,KAAK,CAAC,IAAI,EAAE,CAAC;IACjB,CAAC;;AArCL,wDAsCC;AArCiB,8CAAuB,GAAW,EAAE,CAAC"}

@@ -5,2 +5,3 @@ import { ExperimentationServiceBase } from './ExperimentationServiceBase';

import { IKeyValueStorage } from '../contracts/IKeyValueStorage';
import { FeatureData } from './FeatureProvider/IFeatureProvider';
/**

@@ -13,3 +14,4 @@ * Implementation of Feature provider that provides a polling feature, where the source can be re-fetched every x time given.

protected refreshRateMs: number;
protected telemetryPropertyName: string;
protected featuresTelemetryPropertyName: string;
protected assignmentContextTelemetryPropertyName: string;
protected telemetryEventName: string;

@@ -19,4 +21,8 @@ protected storageKey?: string | undefined;

private pollingService?;
constructor(telemetry: IExperimentationTelemetry, filterProviders: IExperimentationFilterProvider[], refreshRateMs: number, telemetryPropertyName: string, telemetryEventName: string, storageKey?: string | undefined, storage?: IKeyValueStorage | undefined);
constructor(telemetry: IExperimentationTelemetry, filterProviders: IExperimentationFilterProvider[], refreshRateMs: number, featuresTelemetryPropertyName: string, assignmentContextTelemetryPropertyName: string, telemetryEventName: string, storageKey?: string | undefined, storage?: IKeyValueStorage | undefined);
protected init(): void;
/**
* Wrapper that will reset the polling intervals whenever the feature data is fetched manually.
*/
protected getFeaturesAsync(overrideInMemoryFeatures?: boolean): Promise<FeatureData>;
}

@@ -9,8 +9,9 @@ "use strict";

class ExperimentationServiceAutoPolling extends ExperimentationServiceBase_1.ExperimentationServiceBase {
constructor(telemetry, filterProviders, refreshRateMs, telemetryPropertyName, telemetryEventName, storageKey, storage) {
super(telemetry, telemetryPropertyName, telemetryEventName, storageKey, storage);
constructor(telemetry, filterProviders, refreshRateMs, featuresTelemetryPropertyName, assignmentContextTelemetryPropertyName, telemetryEventName, storageKey, storage) {
super(telemetry, featuresTelemetryPropertyName, assignmentContextTelemetryPropertyName, telemetryEventName, storageKey, storage);
this.telemetry = telemetry;
this.filterProviders = filterProviders;
this.refreshRateMs = refreshRateMs;
this.telemetryPropertyName = telemetryPropertyName;
this.featuresTelemetryPropertyName = featuresTelemetryPropertyName;
this.assignmentContextTelemetryPropertyName = assignmentContextTelemetryPropertyName;
this.telemetryEventName = telemetryEventName;

@@ -34,4 +35,18 @@ this.storageKey = storageKey;

}
/**
* Wrapper that will reset the polling intervals whenever the feature data is fetched manually.
*/
async getFeaturesAsync(overrideInMemoryFeatures = false) {
if (!this.pollingService) {
return await super.getFeaturesAsync(overrideInMemoryFeatures);
}
else {
this.pollingService.StopPolling();
let result = await super.getFeaturesAsync(overrideInMemoryFeatures);
this.pollingService.StartPolling();
return result;
}
}
}
exports.ExperimentationServiceAutoPolling = ExperimentationServiceAutoPolling;
//# sourceMappingURL=ExperimentationServiceAutoPolling.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"ExperimentationServiceAutoPolling.js","sourceRoot":"","sources":["../../../src/tas-client/ExperimentationServiceAutoPolling.ts"],"names":[],"mappings":";;AAAA,6EAA0E;AAE1E,0DAAuD;AAIvD;;GAEG;AACH,MAAsB,iCAAkC,SAAQ,uDAA0B;IAGtF,YACc,SAAoC,EACpC,eAAiD,EACjD,aAAqB,EACrB,qBAA6B,EAC7B,kBAA0B,EAC1B,UAAmB,EACnB,OAA0B;QAEpC,KAAK,CAAC,SAAS,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;QARvE,cAAS,GAAT,SAAS,CAA2B;QACpC,oBAAe,GAAf,eAAe,CAAkC;QACjD,kBAAa,GAAb,aAAa,CAAQ;QACrB,0BAAqB,GAArB,qBAAqB,CAAQ;QAC7B,uBAAkB,GAAlB,kBAAkB,CAAQ;QAC1B,eAAU,GAAV,UAAU,CAAS;QACnB,YAAO,GAAP,OAAO,CAAmB;QAGpC,IAAI,aAAa,IAAI,IAAI,EAAE;YACvB,IAAI,CAAC,cAAc,GAAG,IAAI,+BAAc,CAAC,aAAa,CAAC,CAAC;YACxD,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,KAAK,IAAI,EAAE;gBACtC,MAAM,KAAK,CAAC,gBAAgB,EAAE,CAAC;YACnC,CAAC,CAAC,CAAC;SACN;QAED,4DAA4D;QAC5D,IAAI,aAAa,GAAG,IAAI,IAAI,aAAa,KAAK,CAAC,EAAE;YAC7C,MAAM,IAAI,KAAK,CACX,yHAAyH,CAC5H,CAAC;SACL;IACL,CAAC;IAES,IAAI;;QACV,MAAA,IAAI,CAAC,cAAc,0CAAE,YAAY,CAAC,IAAI,EAAE;IAC5C,CAAC;CAEJ;AAhCD,8EAgCC"}
{"version":3,"file":"ExperimentationServiceAutoPolling.js","sourceRoot":"","sources":["../../../src/tas-client/ExperimentationServiceAutoPolling.ts"],"names":[],"mappings":";;AAAA,6EAA0E;AAE1E,0DAAuD;AAKvD;;GAEG;AACH,MAAsB,iCAAkC,SAAQ,uDAA0B;IAGtF,YACc,SAAoC,EACpC,eAAiD,EACjD,aAAqB,EACrB,6BAAqC,EACrC,sCAA8C,EAC9C,kBAA0B,EAC1B,UAAmB,EACnB,OAA0B;QAEpC,KAAK,CAAC,SAAS,EAAE,6BAA6B,EAAE,sCAAsC,EAAE,kBAAkB,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;QATvH,cAAS,GAAT,SAAS,CAA2B;QACpC,oBAAe,GAAf,eAAe,CAAkC;QACjD,kBAAa,GAAb,aAAa,CAAQ;QACrB,kCAA6B,GAA7B,6BAA6B,CAAQ;QACrC,2CAAsC,GAAtC,sCAAsC,CAAQ;QAC9C,uBAAkB,GAAlB,kBAAkB,CAAQ;QAC1B,eAAU,GAAV,UAAU,CAAS;QACnB,YAAO,GAAP,OAAO,CAAmB;QAGpC,IAAI,aAAa,IAAI,IAAI,EAAE;YACvB,IAAI,CAAC,cAAc,GAAG,IAAI,+BAAc,CAAC,aAAa,CAAC,CAAC;YACxD,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,KAAK,IAAI,EAAE;gBACtC,MAAM,KAAK,CAAC,gBAAgB,EAAE,CAAC;YACnC,CAAC,CAAC,CAAC;SACN;QAED,4DAA4D;QAC5D,IAAI,aAAa,GAAG,IAAI,IAAI,aAAa,KAAK,CAAC,EAAE;YAC7C,MAAM,IAAI,KAAK,CACX,yHAAyH,CAC5H,CAAC;SACL;IACL,CAAC;IAES,IAAI;;QACV,MAAA,IAAI,CAAC,cAAc,0CAAE,YAAY,CAAC,IAAI,EAAE;IAC5C,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,gBAAgB,CAAC,wBAAwB,GAAG,KAAK;QAC7D,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;YACtB,OAAO,MAAM,KAAK,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,CAAC;SACjE;aAAM;YACH,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC;YAClC,IAAI,MAAM,GAAG,MAAM,KAAK,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,CAAC;YACpE,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC;YACnC,OAAO,MAAM,CAAC;SACjB;IACL,CAAC;CACJ;AA9CD,8EA8CC"}
import { IExperimentationService } from '../contracts/IExperimentationService';
import { IExperimentationTelemetry } from '../contracts/IExperimentationTelemetry';
import { IKeyValueStorage } from '../contracts/IKeyValueStorage';
import { IFeatureProvider } from './FeatureProvider/IFeatureProvider';
import { IFeatureProvider, FeatureData } from './FeatureProvider/IFeatureProvider';
/**

@@ -13,3 +13,4 @@ * Experimentation service to provide functionality of A/B experiments:

protected telemetry: IExperimentationTelemetry;
protected telemetryPropertyName: string;
protected featuresTelemetryPropertyName: string;
protected assignmentContextTelemetryPropertyName: string;
protected telemetryEventName: string;

@@ -19,4 +20,4 @@ protected storageKey?: string | undefined;

protected featureProviders?: IFeatureProvider[];
protected fetchPromise?: Promise<string[][]>;
protected state: ExperimentationServiceState;
protected fetchPromise?: Promise<FeatureData[]>;
protected featuresConsumed: boolean;
private cachedTelemetryEvents;

@@ -26,3 +27,3 @@ private _features;

private set features(value);
constructor(telemetry: IExperimentationTelemetry, telemetryPropertyName: string, telemetryEventName: string, storageKey?: string | undefined, storage?: IKeyValueStorage | undefined);
constructor(telemetry: IExperimentationTelemetry, featuresTelemetryPropertyName: string, assignmentContextTelemetryPropertyName: string, telemetryEventName: string, storageKey?: string | undefined, storage?: IKeyValueStorage | undefined);
/**

@@ -32,3 +33,3 @@ * Gets all the features from the provider sources (not cache).

*/
protected getFeaturesAsync(override?: boolean): Promise<string[]>;
protected getFeaturesAsync(overrideInMemoryFeatures?: boolean): Promise<FeatureData>;
/**

@@ -38,4 +39,3 @@ *

*/
protected updateFeatures(featureResults: string[][], override?: boolean): void;
private featuresChanged;
protected updateFeatures(featureResults: FeatureData[], overrideInMemoryFeatures?: boolean): void;
private getFromCache;

@@ -55,4 +55,2 @@ /**

private PostEventToTelemetry;
private setState;
private isState;
protected invokeInit(): void;

@@ -68,6 +66,1 @@ /**

}
export declare enum ExperimentationServiceState {
None = 0,
Fetching = 1,
FeaturesLoaded = 2
}

@@ -11,11 +11,15 @@ "use strict";

class ExperimentationServiceBase {
constructor(telemetry, telemetryPropertyName, telemetryEventName, storageKey, storage) {
constructor(telemetry, featuresTelemetryPropertyName, assignmentContextTelemetryPropertyName, telemetryEventName, storageKey, storage) {
this.telemetry = telemetry;
this.telemetryPropertyName = telemetryPropertyName;
this.featuresTelemetryPropertyName = featuresTelemetryPropertyName;
this.assignmentContextTelemetryPropertyName = assignmentContextTelemetryPropertyName;
this.telemetryEventName = telemetryEventName;
this.storageKey = storageKey;
this.storage = storage;
this.state = ExperimentationServiceState.None;
this.featuresConsumed = false;
this.cachedTelemetryEvents = [];
this._features = [];
this._features = {
features: [],
assignmentContext: ''
};
if (!this.storageKey) {

@@ -37,3 +41,4 @@ this.storageKey = 'ABExp.Features';

if (this.telemetry) {
this.telemetry.setSharedProperty(this.telemetryPropertyName, this.features.join(';'));
this.telemetry.setSharedProperty(this.featuresTelemetryPropertyName, this.features.features.join(';'));
this.telemetry.setSharedProperty(this.assignmentContextTelemetryPropertyName, this.features.assignmentContext);
}

@@ -45,3 +50,3 @@ }

*/
async getFeaturesAsync(override = false) {
async getFeaturesAsync(overrideInMemoryFeatures = false) {
/**

@@ -51,3 +56,3 @@ * If there's already a fetching promise, there's no need to call it again.

*/
if (this.isState(ExperimentationServiceState.Fetching) && this.fetchPromise != null) {
if (this.fetchPromise != null) {
await this.fetchPromise;

@@ -57,9 +62,8 @@ return this.features;

if (!this.featureProviders || this.featureProviders.length === 0) {
return Promise.resolve([]);
return Promise.resolve({
features: [],
assignmentContext: ''
});
}
/**
* Refetching all data from all providers.
*/
this.setState(ExperimentationServiceState.Fetching);
/**
* Fetch all from providers.

@@ -72,4 +76,3 @@ */

this.fetchPromise = undefined;
this.updateFeatures(featureResults, override);
this.setState(ExperimentationServiceState.FeaturesLoaded);
this.updateFeatures(featureResults, overrideInMemoryFeatures);
/**

@@ -85,3 +88,3 @@ * At this point all features have been re-fetched and cache has been updated.

*/
updateFeatures(featureResults, override = false) {
updateFeatures(featureResults, overrideInMemoryFeatures = false) {
/**

@@ -91,20 +94,18 @@ * if features comes as a null value, that is taken as if there aren't any features active,

*/
let features = [];
let features = {
features: [],
assignmentContext: ''
};
for (let result of featureResults) {
for (let feature of result) {
if (!features.includes(feature)) {
features.push(feature);
for (let feature of result.features) {
if (!features.features.includes(feature)) {
features.features.push(feature);
}
}
features.assignmentContext += result.assignmentContext;
}
/**
* If features haven't changed, we return.
*/
if (!this.featuresChanged(features)) {
return;
}
/**
* Set the obtained feature values to the global features variable. This stores them in memory.
*/
if (override) {
if (overrideInMemoryFeatures || !this.featuresConsumed) {
this.features = features;

@@ -119,16 +120,2 @@ }

}
featuresChanged(features) {
if (features.length !== this.features.length) {
return true;
}
// Since we have checked the array and removed repeated results before this step,
// we can now just take the old features and check if there's any feature in there that isn't
// included in the new features array.
for (let feature of features) {
if (!this.features.includes(feature)) {
return true;
}
}
return false;
}
async getFromCache() {

@@ -148,11 +135,11 @@ if (!this.storage) {

// If features haven't been loaded, we load the features in the cache, and save them into memory.
if (!this.isState(ExperimentationServiceState.FeaturesLoaded)) {
if (!this.featuresConsumed) {
// Features will only be get from cache once, and only if IsFlightEnabledAsync hasn't been called yet.
let cachedFeatures = await this.getFromCache();
this.features = cachedFeatures || [];
this.setState(ExperimentationServiceState.FeaturesLoaded);
this.features = cachedFeatures || { features: [], assignmentContext: '' };
this.featuresConsumed = true;
}
this.PostEventToTelemetry(flight);
// Use memory features to check if a flight is enabled.
return this.features.includes(flight);
return this.features.features.includes(flight);
}

@@ -166,4 +153,5 @@ /**

const features = await this.getFeaturesAsync(true);
this.featuresConsumed = true;
this.PostEventToTelemetry(flight);
return features.includes(flight);
return features.features.includes(flight);
}

@@ -183,13 +171,2 @@ PostEventToTelemetry(flight) {

}
setState(state) {
this.state = state;
}
isState(...states) {
for (let st of states) {
if (this.state === st) {
return true;
}
}
return false;
}
invokeInit() {

@@ -208,8 +185,2 @@ this.init();

exports.ExperimentationServiceBase = ExperimentationServiceBase;
var ExperimentationServiceState;
(function (ExperimentationServiceState) {
ExperimentationServiceState[ExperimentationServiceState["None"] = 0] = "None";
ExperimentationServiceState[ExperimentationServiceState["Fetching"] = 1] = "Fetching";
ExperimentationServiceState[ExperimentationServiceState["FeaturesLoaded"] = 2] = "FeaturesLoaded";
})(ExperimentationServiceState = exports.ExperimentationServiceState || (exports.ExperimentationServiceState = {}));
//# sourceMappingURL=ExperimentationServiceBase.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"ExperimentationServiceBase.js","sourceRoot":"","sources":["../../../src/tas-client/ExperimentationServiceBase.ts"],"names":[],"mappings":";;AAIA,wEAAqE;AAErE;;;;;GAKG;AACH,MAAsB,0BAA0B;IAoB5C,YACc,SAAoC,EACpC,qBAA6B,EAC7B,kBAA0B,EAC1B,UAAmB,E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,mCAA2B,KAA3B,mCAA2B,QAItC"}
{"version":3,"file":"ExperimentationServiceBase.js","sourceRoot":"","sources":["../../../src/tas-client/ExperimentationServiceBase.ts"],"names":[],"mappings":";;AAIA,wEAAqE;AAErE;;;;;GAKG;AACH,MAAsB,0BAA0B;IAwB5C,YACc,SAAoC,EACpC,6BAAqC,EACrC,sCAA8C,EAC9C,kBAA0B,EAC1B,UAAmB,EACnB,OAA0B;QAL1B,cAAS,GAAT,SAAS,CAA2B;QACpC,kCAA6B,GAA7B,6BAA6B,CAAQ;QACrC,2CAAsC,GAAtC,sCAAsC,CAAQ;QAC9C,uBAAkB,GAAlB,kBAAkB,CAAQ;QAC1B,eAAU,GAAV,UAAU,CAAS;QACnB,YAAO,GAAP,OAAO,CAAmB;QA3B9B,qBAAgB,GAAG,KAAK,CAAC;QAE3B,0BAAqB,GAAa,EAAE,CAAC;QACrC,cAAS,GAAgB;YAC7B,QAAQ,EAAE,EAAE;YACZ,iBAAiB,EAAE,EAAE;SACxB,CAAC;QAuBE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YAClB,IAAI,CAAC,UAAU,GAAG,gBAAgB,CAAC;SACtC;QAED,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACf,OAAO,GAAG,IAAI,6CAAqB,EAAE,CAAC;SACzC;IACL,CAAC;IA7BD,IAAY,QAAQ;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IACD,IAAY,QAAQ,CAAC,KAAkB;QACnC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB;;WAEG;QACH,IAAI,IAAI,CAAC,SAAS,EAAE;YAChB,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,IAAI,CAAC,6BAA6B,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YACvG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,IAAI,CAAC,sCAAsC,EAAE,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Ac;QAC5C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACnD,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;QAClC,OAAO,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAEO,oBAAoB,CAAC,MAAc;QACvC;;WAEG;QACH,IAAI,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YAC7C,OAAO;SACV;QACD,IAAI,CAAC,SAAS,CAAC,SAAS,CACpB,IAAI,CAAC,kBAAkB,EACvB,IAAI,GAAG,CAAiB,CAAC,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC,CAAC,CAC9D,CAAC;QAEF;;WAEG;QACH,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAES,UAAU;QAChB,IAAI,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;IAUS,kBAAkB,CAAC,GAAG,SAA6B;QACzD,IAAI,SAAS,IAAI,IAAI,IAAI,IAAI,CAAC,gBAAgB,IAAI,IAAI,EAAE;YACpD,OAAO;SACV;QACD,KAAK,IAAI,QAAQ,IAAI,SAAS,EAAE;YAC5B,IAAI,CAAC,gBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACzC;IACL,CAAC;CACJ;AAxMD,gEAwMC"}

@@ -1,2 +0,2 @@

import { IFeatureProvider } from './IFeatureProvider';
import { IFeatureProvider, FeatureData } from './IFeatureProvider';
import { IExperimentationTelemetry } from 'src/contracts/IExperimentationTelemetry';

@@ -18,7 +18,7 @@ /**

*/
getFeatures(): Promise<string[]>;
getFeatures(): Promise<FeatureData>;
/**
* Fetch method that retrieves asynchronously the required feature data.
*/
protected abstract fetch(): Promise<string[]>;
protected abstract fetch(): Promise<FeatureData>;
}

@@ -0,1 +1,5 @@

export interface FeatureData {
features: string[];
assignmentContext: string;
}
export interface IFeatureProvider {

@@ -5,3 +9,3 @@ /**

*/
getFeatures(): Promise<string[]>;
getFeatures(): Promise<FeatureData>;
}

@@ -5,2 +5,3 @@ import { IExperimentationFilterProvider } from '../../contracts/IExperimentationFilterProvider';

import { FilteredFeatureProvider } from './FilteredFeatureProvider';
import { FeatureData } from './IFeatureProvider';
/**

@@ -17,5 +18,5 @@ * Feature provider implementation that calls the TAS web service to get the most recent active features.

*/
fetch(): Promise<string[]>;
fetch(): Promise<FeatureData>;
}
export interface FeatureData {
export interface TASFeatureData {
Features: any[];

@@ -22,0 +23,0 @@ Flights: any[];

@@ -48,7 +48,6 @@ "use strict";

}
// Assignment Context will also be logged to telemetry.
if (responseData.AssignmentContext) {
this.telemetry.setSharedProperty('abexp.assignmentcontext', responseData.AssignmentContext);
}
return features;
return {
features,
assignmentContext: responseData.AssignmentContext
};
}

@@ -55,0 +54,0 @@ }

@@ -1,1 +0,1 @@

{"version":3,"file":"TasApiFeatureProvider.js","sourceRoot":"","sources":["../../../../src/tas-client/FeatureProvider/TasApiFeatureProvider.ts"],"names":[],"mappings":";;AAIA,uEAAoE;AAEpE;;GAEG;AACH,MAAa,qBAAsB,SAAQ,iDAAuB;IAC9D,YACc,UAA2B,EAC3B,SAAoC,EACpC,eAAiD;QAE3D,KAAK,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;QAJxB,eAAU,GAAV,UAAU,CAAiB;QAC3B,cAAS,GAAT,SAAS,CAA2B;QACpC,oBAAe,GAAf,eAAe,CAAkC;IAG/D,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,KAAK;QACd,mDAAmD;QACnD,IAAI,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAChC,IAAI,OAAO,GAAQ,EAAE,CAAC;QAEtB,iEAAiE;QACjE,kEAAkE;QAClE,KAAK,IAAI,GAAG,IAAI,OAAO,CAAC,IAAI,EAAE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G,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE;gBACvC,MAAM,WAAW,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;gBAC1D,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;oBACjC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;iBAC9B;aACJ;SACJ;QAED,OAAO;YACH,QAAQ;YACR,iBAAiB,EAAE,YAAY,CAAC,iBAAiB;SACpD,CAAC;IACN,CAAC;CACJ;AAvDD,sDAuDC"}

@@ -9,3 +9,3 @@ "use strict";

get(config) {
return axios_1.default.get(this.endpoint, config);
return axios_1.default.get(this.endpoint, Object.assign(Object.assign({}, config), { proxy: false }));
}

@@ -12,0 +12,0 @@ }

@@ -1,1 +0,1 @@

{"version":3,"file":"AxiosHttpClient.js","sourceRoot":"","sources":["../../../../src/tas-client/Util/AxiosHttpClient.ts"],"names":[],"mappings":";;AAAA,iCAAgE;AAEhE,MAAa,eAAe;IACxB,YAAoB,QAAgB;QAAhB,aAAQ,GAAR,QAAQ,CAAQ;IAAG,CAAC;IAEjC,GAAG,CAAC,MAAuC;QAC9C,OAAO,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;CACJ;AAND,0CAMC"}
{"version":3,"file":"AxiosHttpClient.js","sourceRoot":"","sources":["../../../../src/tas-client/Util/AxiosHttpClient.ts"],"names":[],"mappings":";;AAAA,iCAAgE;AAEhE,MAAa,eAAe;IACxB,YAAoB,QAAgB;QAAhB,aAAQ,GAAR,QAAQ,CAAQ;IAAG,CAAC;IAEjC,GAAG,CAAC,MAAuC;QAC9C,OAAO,eAAK,CAAC,GAAG,CACZ,IAAI,CAAC,QAAQ,kCAEN,MAAM,KACT,KAAK,EAAE,KAAK,IACd,CAAC;IACX,CAAC;CACJ;AAXD,0CAWC"}

@@ -8,3 +8,3 @@ export declare class PollingService {

OnPollTick(callback: () => Promise<void>): void;
StartPolling(initialPoll?: boolean): void;
StartPolling(pollImmediately?: boolean): void;
}

@@ -14,3 +14,3 @@ "use strict";

}
StartPolling(initialPoll = false) {
StartPolling(pollImmediately = false) {
if (this.intervalHandle) {

@@ -23,3 +23,3 @@ this.StopPolling();

}
if (initialPoll) {
if (pollImmediately) {
this.onTick().then(() => { return; }).catch(() => { return; });

@@ -26,0 +26,0 @@ }

@@ -1,1 +0,1 @@

{"version":3,"file":"PollingService.js","sourceRoot":"","sources":["../../../../src/tas-client/Util/PollingService.ts"],"names":[],"mappings":";;AAAA,MAAa,cAAc;IAIvB,YAAoB,aAAqB;QAArB,kBAAa,GAAb,aAAa,CAAQ;IAAG,CAAC;IAEtC,WAAW;QACd,aAAa,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACnC,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;IACpC,CAAC;IAEM,UAAU,CAAC,QAA6B;QAC3C,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAEM,YAAY,CAAC,WAAW,GAAG,KAAK;QACnC,IAAI,IAAI,CAAC,cAAc,EAAE;YACrB,IAAI,CAAC,WAAW,EAAE,CAAC;SACtB;QAED,6DAA6D;QAC7D,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE;YACrB,OAAO;SACV;QAED,IAAI,WAAW,EAAE;YACb,IAAI,CAAC,MAAO,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;SACnE;QAED;;WAEG;QACH,IAAI,CAAC,cAAc,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;YACzC,MAAM,IAAI,CAAC,MAAO,EAAE,CAAC;QACzB,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A+E;SAC/G;IACL,CAAC;CACJ;AAvCD,wCAuCC"}
export {};
/** Other possible tests to do: */
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const chai_1 = require("chai");
const ExperimentationServiceMock_1 = require("./mocks/ExperimentationServiceMock");
const FetchResolver_1 = require("./mocks/FetchResolver");
const FilteredExperimentationServiceMock_1 = require("./mocks/FilteredExperimentationServiceMock");
const ExperimentationFilterProviderMock_1 = require("./mocks/ExperimentationFilterProviderMock");
const ExperimentationTelemetryMock_1 = require("./mocks/ExperimentationTelemetryMock");
const KeyValueStorageMock_1 = require("./mocks/KeyValueStorageMock");
let defaultEndpoint = 'https://visualstudio-devdiv-c2s.msedge.net/ab';
/**
* Multiple feature providers.
* Scenarios covered:
* 1) An Experimentation Service Provider that has more than 1 Feature Provider.
* 2) These feature providers have different fetch durations. The current architecture has a bottleneck in this part, in a way that
* re-fetching will always take as long as the slowest of the members.
* 3) Data obtained from the feature providers changes on each call (three different results).
* 4) In these differences features get added, deleted, and unchanged. (sometimes both)
* 5) In the updates, some providers provide repeated feature ids.
* 6) In these updates, sometimes features get deleted in a provider, but added in another one (so they're not fully deleted.)
*/
describe('Get features from multiple providers that differ in polling intervals and fetch delay.', () => {
let testSpecs = [
{
fetchDelay: 200,
fetchResolver: new FetchResolver_1.FetchResolver(['kirby', 'falco', 'fox', 'joker'], // First fetch will return this array.
['joker', 'palutena', 'fox'], // second fetch will return this array.
['falco']),
},
{
fetchDelay: 50,
fetchResolver: new FetchResolver_1.FetchResolver(['lucario', 'kirby', 'ness'], // First fetch will return this array.
['kirby'], // Second fetch will return this array.
['kirby']),
},
{
fetchDelay: 100,
fetchResolver: new FetchResolver_1.FetchResolver(['mario', 'kingdedede', 'lucario'], // First fetch will return this array.
['falco', 'ness', 'mario', 'lucario', 'kingdedede'], // Second fetch will return this array.
['ness', 'mario', 'lucario', 'ike']),
},
];
let service = new ExperimentationServiceMock_1.ExperimentationServiceMock(testSpecs, 1000);
// The current result will be:
// ['kirby', 'falco', 'fox', 'joker'] from provider 1
// ['lucario', 'kirby', 'ness'] from provider 2
// ['mario', 'kingdedede', 'lucario'] from provider 3
// it's total 10 but we subtract two because kirby and lucario are repeated.
it('should fetch elements from all providers, and save them in to cache.', async () => {
//evaluate
let kirby = await service.isFlightEnabledAsync('kirby');
let falco = await service.isCachedFlightEnabled('falco');
let fox = await service.isCachedFlightEnabled('fox');
let joker = await service.isCachedFlightEnabled('joker');
let lucario = await service.isCachedFlightEnabled('lucario');
let ness = await service.isCachedFlightEnabled('ness');
let mario = await service.isCachedFlightEnabled('mario');
let kingdedede = await service.isCachedFlightEnabled('kingdedede');
// validate that all the correct elements are inside the array.
chai_1.expect(kirby).to.equal(true);
chai_1.expect(falco).to.equal(true);
chai_1.expect(fox).to.equal(true);
chai_1.expect(joker).to.equal(true);
chai_1.expect(lucario).to.equal(true);
chai_1.expect(ness).to.equal(true);
chai_1.expect(mario).to.equal(true);
chai_1.expect(kingdedede).to.equal(true);
});
// The second result should be:
// ['joker', 'palutena', 'fox'] from provider 1 +
// ['kirby'] from provider 2 +
// ['falco', 'ness', 'mario', 'lucario', 'kingdedede'] from provider 3
it('should update the cache (and reset the polling clock) if isFlightEnabledAsync is called again.', async () => {
// evaluate
let joker = await service.isFlightEnabledAsync('joker');
let palutena = await service.isCachedFlightEnabled('palutena');
let fox = await service.isCachedFlightEnabled('fox');
let kirby = await service.isCachedFlightEnabled('kirby');
let falco = await service.isCachedFlightEnabled('falco');
let ness = await service.isCachedFlightEnabled('ness');
let mario = await service.isCachedFlightEnabled('mario');
let lucario = await service.isCachedFlightEnabled('lucario');
let kingdedede = await service.isCachedFlightEnabled('kingdedede');
// validate that all the correct elements are inside the array.
chai_1.expect(joker).to.equal(true);
chai_1.expect(palutena).to.equal(true);
chai_1.expect(fox).to.equal(true);
chai_1.expect(kirby).to.equal(true);
chai_1.expect(falco).to.equal(true);
chai_1.expect(ness).to.equal(true);
chai_1.expect(mario).to.equal(true);
chai_1.expect(lucario).to.equal(true);
chai_1.expect(kingdedede).to.equal(true);
});
// Third result should be: ['ness', 'mario', 'lucario', 'ike', 'kirby', 'falco'],
it('should automatically refetch the third result and update cache.', async () => {
await new Promise((resolve) => {
setTimeout(() => resolve(), 1200); // 1200 ms, because it takes 1000 ms to do the polling, and 200ms to complete the fetch.
});
// evaluate
// No need to call first the IsFlightEnabledAsync this time, as this was updated via polling.
let ness = await service.isCachedFlightEnabled('ness');
let mario = await service.isCachedFlightEnabled('mario');
let lucario = await service.isCachedFlightEnabled('lucario');
let ike = await service.isCachedFlightEnabled('ike');
let kirby = await service.isCachedFlightEnabled('kirby');
let falco = await service.isCachedFlightEnabled('falco');
// validate that all the correct elements are inside the array.
chai_1.expect(ness).to.equal(true);
chai_1.expect(mario).to.equal(true);
chai_1.expect(lucario).to.equal(true);
chai_1.expect(ike).to.equal(true);
chai_1.expect(kirby).to.equal(true);
chai_1.expect(falco).to.equal(true);
});
});
describe('Experimentation Service general tests', () => {
it('should throw if Ms are less than 1000 and different from 0', (done) => {
chai_1.assert.throws(() => new ExperimentationServiceMock_1.ExperimentationServiceMock([{ fetchDelay: 200, fetchResolver: new FetchResolver_1.FetchResolver(['result']) }], 500));
done();
});
it('should combine filters from filter providers', async () => {
let service = new FilteredExperimentationServiceMock_1.FilteredExperimentationServiceMock([
new ExperimentationFilterProviderMock_1.ExperimentationFilterProviderOneFilterMock(),
new ExperimentationFilterProviderMock_1.ExperimentationFilterProviderTwoFilterMock(),
]);
service.isFlightEnabledAsync('anyflight');
let filters = service.featureProvider.lastFilters;
chai_1.expect(filters.size).to.equal(3);
});
});
describe('Telemetry tests', () => {
it('Shared properties should be set on isCachedFlightEnabled', async () => {
const experimentationTelemetryMock = new ExperimentationTelemetryMock_1.ExperimentationTelemetryMock();
const keyValueStorageMock = new KeyValueStorageMock_1.KeyValueStorageMock();
keyValueStorageMock.setValue('StorageKey', ['testFlight']);
const service = new ExperimentationServiceMock_1.ExperimentationServiceMock([], 10000, experimentationTelemetryMock, keyValueStorageMock);
await service.isCachedFlightEnabled('testFlight');
chai_1.expect('testFlight').to.equal(experimentationTelemetryMock.sharedProperties.get('TelemetryName'));
chai_1.expect('testFlight').to.equal(experimentationTelemetryMock.postedEvents[0].sharedProperties.get('TelemetryName'));
});
});
/** Other possible tests to do: */
//- Test wether the promise for fetch is re-used.
//- Test that intervals stop when update is force requested, and starts once it finishes.
//- Test that intervals work individually.
//# sourceMappingURL=ExperimentationService.test.js.map
{"version":3,"file":"ExperimentationService.test.js","sourceRoot":"","sources":["../../../src/tests/ExperimentationService.test.ts"],"names":[],"mappings":";;AAAA,+BAAsC;AACtC,mFAG4C;AAC5C,yDAAsD;AACtD,mGAAgG;AAChG,iGAGmD;AACnD,uFAAoF;AACpF,qEAAkE;AAElE,IAAI,eAAe,GAAG,+CAA+C,CAAC;AAEtE;;;;;;;;;;GAUG;AACH,QAAQ,CAAC,wFAAwF,EAAE,GAAG,EAAE;IACpG,IAAI,SAAS,GAA8B;QACvC;YACI,UAAU,EAAE,GAAG;YACf,aAAa,EAAE,IAAI,6BAAa,CAC5B,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,sCAAsC;YAC1E,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,uCAAuC;YACrE,CAAC,OAAO,CAAC,CACZ;SACJ;QACD;YACI,UAAU,EAAE,EAAE;YACd,aAAa,EAAE,IAAI,6BAAa,CAC5B,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,sCAAsC;YACpE,CAAC,OAAO,CAAC,EAAE,uCAAuC;YAClD,CAAC,OAAO,CAAC,CACZ;SACJ;QACD;YACI,UAAU,EAAE,GAAG;YACf,aAAa,EAAE,IAAI,6BAAa,CAC5B,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,CAAC,EAAE,sCAAsC;YAC1E,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,CAAC,EAAE,uCAAu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AC,CAAC;QAC1C,IAAI,OAAO,GAAG,OAAO,CAAC,eAAgB,CAAC,WAAY,CAAC;QACpD,aAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,0DAA0D,EAAE,KAAK,IAAI,EAAE;QACtE,MAAM,4BAA4B,GAAG,IAAI,2DAA4B,EAAE,CAAC;QACxE,MAAM,mBAAmB,GAAG,IAAI,yCAAmB,EAAE,CAAC;QACtD,mBAAmB,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;QAC3D,MAAM,OAAO,GAAG,IAAI,uDAA0B,CAAC,EAAE,EAAE,KAAK,EAAE,4BAA4B,EAAE,mBAAmB,CAAC,CAAC;QAE7G,MAAM,OAAO,CAAC,qBAAqB,CAAC,YAAY,CAAC,CAAC;QAElD,aAAM,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,4BAA4B,CAAC,gBAAgB,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC;QAClG,aAAM,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,4BAA4B,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC;IACtH,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH,kCAAkC;AAClC,iDAAiD;AACjD,yFAAyF;AACzF,0CAA0C"}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const KeyValueStorageMock_1 = require("./mocks/KeyValueStorageMock");
const ExperimentationFilterProviderMock_1 = require("./mocks/ExperimentationFilterProviderMock");
const chai_1 = require("chai");
const FetchResolver_1 = require("./mocks/FetchResolver");
const BaseFeatureProviderMock_1 = require("./mocks/BaseFeatureProviderMock");
const ExperimentationTelemetryMock_1 = require("./mocks/ExperimentationTelemetryMock");
const MockFilteredFeatureProvider_1 = require("./mocks/MockFilteredFeatureProvider");
let mockKeyValueStorage = new KeyValueStorageMock_1.KeyValueStorageMock();
let mockFilterProvider = new ExperimentationFilterProviderMock_1.ExperimentationFilterProviderMock();
let defaultEndpoint = 'https://visualstudio-devdiv-c2s.msedge.net/ab';
/**
* For this test we want to ensure the unique capability of a Feature provider, which is to call the fetch method everytime it's called.
*/
describe('Feature Provider tests', () => {
/**
* Resolver that is expected to be called three times (two by auto-polling).
* First time it will return both features.
* Second time it will return just feature 1.
* Third time it will return feature 2.
*/
let resolver = new FetchResolver_1.FetchResolver(['feature1', 'feature2'], ['feature1'], ['feature2']);
//setup
let featureProvider = new BaseFeatureProviderMock_1.BaseFeatureProviderMock(new ExperimentationTelemetryMock_1.ExperimentationTelemetryMock(), resolver);
/**
* A feature provider will be started by calling the getFeatures method.
* This will retrieve the first set of data.
* Consecuentially, all other getFeatures that are called, will re-fectch, as a feature provider does not hold cache.
*/
it('Feature provider should always run fetch whenever features are accessed. They do not hold cache.', async () => {
//evaluate
let features = await featureProvider.getFeatures();
chai_1.expect(features).to.eql(['feature1', 'feature2']);
features = await featureProvider.getFeatures();
chai_1.expect(features).to.eql(['feature1']);
features = await featureProvider.getFeatures();
chai_1.expect(features).to.eql(['feature2']);
});
it('Feature provider should post headers to telemetry.', async () => {
const telemetryMock = new ExperimentationTelemetryMock_1.ExperimentationTelemetryMock();
const filteredFeatureProvider = new MockFilteredFeatureProvider_1.MockFilteredFeatureProvider(telemetryMock, [new ExperimentationFilterProviderMock_1.ExperimentationFilterProviderTwoFilterMock()]);
// In the fetch method we're posting the headers.
await filteredFeatureProvider.fetch();
chai_1.expect(telemetryMock.postedEvents.length).to.be.greaterThan(0);
const postedEvent = telemetryMock.postedEvents[0];
const postedEventArgs = postedEvent.args.get('ABExp.headers');
chai_1.expect(postedEventArgs).to.be.equal('{"lucario":true,"wario":false}');
});
});
//# sourceMappingURL=FeatureProvider.test.js.map
{"version":3,"file":"FeatureProvider.test.js","sourceRoot":"","sources":["../../../src/tests/FeatureProvider.test.ts"],"names":[],"mappings":";;AAAA,qEAAkE;AAClE,iGAA0I;AAC1I,+BAA8B;AAC9B,yDAAsD;AACtD,6EAA0E;AAC1E,uFAAoF;AACpF,qFAAkF;AAElF,IAAI,mBAAmB,GAAG,IAAI,yCAAmB,EAAE,CAAC;AACpD,IAAI,kBAAkB,GAAG,IAAI,qEAAiC,EAAE,CAAC;AAEjE,IAAI,eAAe,GAAG,+CAA+C,CAAC;AAEtE;;GAEG;AACH,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACpC;;;;;OAKG;IACH,IAAI,QAAQ,GAAG,IAAI,6BAAa,CAAC,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IACvF,OAAO;IACP,IAAI,eAAe,GAAwC,IAAI,iDAAuB,CAClF,IAAI,2DAA4B,EAAE,EAClC,QAAQ,CACX,CAAC;IAEF;;;;OAIG;IACH,EAAE,CAAC,kGAAkG,EAAE,KAAK,IAAI,EAAE;QAC9G,UAAU;QACV,IAAI,QAAQ,GAAG,MAAM,eAAgB,CAAC,WAAW,EAAE,CAAC;QACpD,aAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;QAElD,QAAQ,GAAG,MAAM,eAAgB,CAAC,WAAW,EAAE,CAAC;QAChD,aAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;QAEtC,QAAQ,GAAG,MAAM,eAAgB,CAAC,WAAW,EAAE,CAAC;QAChD,aAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oDAAoD,EAAE,KAAK,IAAI,EAAE;QAChE,MAAM,aAAa,GAAG,IAAI,2DAA4B,EAAE,CAAC;QACzD,MAAM,uBAAuB,GAAG,IAAI,yDAA2B,CAC3D,aAAa,EACb,CAAC,IAAI,8EAA0C,EAAE,CAAC,CACrD,CAAC;QAEF,iDAAiD;QACjD,MAAM,uBAAuB,CAAC,KAAK,EAAE,CAAC;QAEtC,aAAM,CAAC,aAAa,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAC/D,MAAM,WAAW,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAClD,MAAM,eAAe,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QAC9D,aAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
import { IExperimentationFilterProvider } from '../../contracts/IExperimentationFilterProvider';
import { BaseFeatureProvider } from '../../tas-client/FeatureProvider/BaseFeatureProvider';
import { FetchResolver } from './FetchResolver';
import { IExperimentationTelemetry } from '../../contracts/IExperimentationTelemetry';
import { FilteredFeatureProvider } from '../../tas-client/FeatureProvider/FilteredFeatureProvider';
/**
* If there's no cached data (which there isn't) an initial fetch will be executed.
*/
export declare class BaseFeatureProviderMock extends BaseFeatureProvider {
protected telemetry: IExperimentationTelemetry;
protected resolver: FetchResolver;
protected fetchDelay: number;
constructor(telemetry: IExperimentationTelemetry, resolver: FetchResolver, fetchDelay?: number);
protected fetch(): Promise<string[]>;
}
export declare class FilteredFeatureProviderMock extends FilteredFeatureProvider {
protected telemetry: IExperimentationTelemetry;
protected filterProviders: IExperimentationFilterProvider[];
constructor(telemetry: IExperimentationTelemetry, filterProviders: IExperimentationFilterProvider[]);
lastFilters: Map<string, any> | undefined;
protected fetch(): Promise<string[]>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const BaseFeatureProvider_1 = require("../../tas-client/FeatureProvider/BaseFeatureProvider");
const FilteredFeatureProvider_1 = require("../../tas-client/FeatureProvider/FilteredFeatureProvider");
/**
* If there's no cached data (which there isn't) an initial fetch will be executed.
*/
class BaseFeatureProviderMock extends BaseFeatureProvider_1.BaseFeatureProvider {
constructor(telemetry, resolver, fetchDelay = 200) {
super(telemetry);
this.telemetry = telemetry;
this.resolver = resolver;
this.fetchDelay = fetchDelay;
}
fetch() {
return new Promise((resolve) => {
setTimeout(() => resolve(this.resolver.nextResult()), this.fetchDelay);
});
}
}
exports.BaseFeatureProviderMock = BaseFeatureProviderMock;
class FilteredFeatureProviderMock extends FilteredFeatureProvider_1.FilteredFeatureProvider {
constructor(telemetry, filterProviders) {
super(telemetry, filterProviders);
this.telemetry = telemetry;
this.filterProviders = filterProviders;
}
fetch() {
this.lastFilters = this.getFilters();
return Promise.resolve([]);
}
}
exports.FilteredFeatureProviderMock = FilteredFeatureProviderMock;
//# sourceMappingURL=BaseFeatureProviderMock.js.map
{"version":3,"file":"BaseFeatureProviderMock.js","sourceRoot":"","sources":["../../../../src/tests/mocks/BaseFeatureProviderMock.ts"],"names":[],"mappings":";;AACA,8FAA2F;AAG3F,sGAAmG;AAEnG;;GAEG;AACH,MAAa,uBAAwB,SAAQ,yCAAmB;IAC5D,YACc,SAAoC,EACpC,QAAuB,EACvB,aAAqB,GAAG;QAElC,KAAK,CAAC,SAAS,CAAC,CAAC;QAJP,cAAS,GAAT,SAAS,CAA2B;QACpC,aAAQ,GAAR,QAAQ,CAAe;QACvB,eAAU,GAAV,UAAU,CAAc;IAGtC,CAAC;IAES,KAAK;QACX,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC3B,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3E,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAdD,0DAcC;AAED,MAAa,2BAA4B,SAAQ,iDAAuB;IACpE,YACc,SAAoC,EACpC,eAAiD;QAE3D,KAAK,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;QAHxB,cAAS,GAAT,SAAS,CAA2B;QACpC,oBAAe,GAAf,eAAe,CAAkC;IAG/D,CAAC;IAIS,KAAK;QACX,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QACrC,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC/B,CAAC;CACJ;AAdD,kEAcC"}
import { IExperimentationFilterProvider } from '../../contracts/IExperimentationFilterProvider';
export declare class ExperimentationFilterProviderMock implements IExperimentationFilterProvider {
getFilters(): Map<string, any>;
}
export declare class ExperimentationFilterProviderOneFilterMock implements IExperimentationFilterProvider {
getFilters(): Map<string, any>;
}
export declare class ExperimentationFilterProviderTwoFilterMock implements IExperimentationFilterProvider {
getFilters(): Map<string, any>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class ExperimentationFilterProviderMock {
getFilters() {
return new Map();
}
}
exports.ExperimentationFilterProviderMock = ExperimentationFilterProviderMock;
class ExperimentationFilterProviderOneFilterMock {
getFilters() {
const filters = new Map();
filters.set('joker', true);
return filters;
}
}
exports.ExperimentationFilterProviderOneFilterMock = ExperimentationFilterProviderOneFilterMock;
class ExperimentationFilterProviderTwoFilterMock {
getFilters() {
const filters = new Map();
filters.set('lucario', true);
filters.set('wario', false);
return filters;
}
}
exports.ExperimentationFilterProviderTwoFilterMock = ExperimentationFilterProviderTwoFilterMock;
//# sourceMappingURL=ExperimentationFilterProviderMock.js.map
{"version":3,"file":"ExperimentationFilterProviderMock.js","sourceRoot":"","sources":["../../../../src/tests/mocks/ExperimentationFilterProviderMock.ts"],"names":[],"mappings":";;AAEA,MAAa,iCAAiC;IACnC,UAAU;QACb,OAAO,IAAI,GAAG,EAAe,CAAC;IAClC,CAAC;CACJ;AAJD,8EAIC;AAED,MAAa,0CAA0C;IAC5C,UAAU;QACb,MAAM,OAAO,GAAG,IAAI,GAAG,EAAe,CAAC;QACvC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC3B,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAND,gGAMC;AAED,MAAa,0CAA0C;IAC5C,UAAU;QACb,MAAM,OAAO,GAAG,IAAI,GAAG,EAAe,CAAC;QACvC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAC7B,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC5B,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAPD,gGAOC"}
import { FetchResolver } from './FetchResolver';
import { ExperimentationServiceAutoPolling } from '../../tas-client/ExperimentationServiceAutoPolling';
import { IExperimentationTelemetry } from 'src/contracts/IExperimentationTelemetry';
import { IKeyValueStorage } from 'src/contracts/IKeyValueStorage';
export declare class ExperimentationServiceMock extends ExperimentationServiceAutoPolling {
private testSpecs;
private pollingInterval;
constructor(testSpecs: FeatureProviderTestSpec[], pollingInterval?: number, experimentationTelemetry?: IExperimentationTelemetry, keyValueStorage?: IKeyValueStorage);
protected init(): void;
}
export interface FeatureProviderTestSpec {
fetchDelay: number;
fetchResolver: FetchResolver;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ExperimentationTelemetryMock_1 = require("./ExperimentationTelemetryMock");
const ExperimentationFilterProviderMock_1 = require("./ExperimentationFilterProviderMock");
const KeyValueStorageMock_1 = require("./KeyValueStorageMock");
const BaseFeatureProviderMock_1 = require("./BaseFeatureProviderMock");
const ExperimentationServiceAutoPolling_1 = require("../../tas-client/ExperimentationServiceAutoPolling");
class ExperimentationServiceMock extends ExperimentationServiceAutoPolling_1.ExperimentationServiceAutoPolling {
constructor(testSpecs, pollingInterval = 1000, experimentationTelemetry, keyValueStorage) {
super(experimentationTelemetry || new ExperimentationTelemetryMock_1.ExperimentationTelemetryMock(), [new ExperimentationFilterProviderMock_1.ExperimentationFilterProviderMock()], pollingInterval, 'TelemetryName', 'TelemetryEventName', 'StorageKey', keyValueStorage || new KeyValueStorageMock_1.KeyValueStorageMock());
this.testSpecs = testSpecs;
this.pollingInterval = pollingInterval;
this.invokeInit();
}
init() {
// set feature providers to be an empty array.
this.featureProviders = [];
for (let spec of this.testSpecs) {
this.addFeatureProvider(new BaseFeatureProviderMock_1.BaseFeatureProviderMock(this.telemetry, spec.fetchResolver, spec.fetchDelay));
}
if (this.telemetryPropertyName == null) {
this.telemetryPropertyName = 'MockTelemetryProperty';
}
}
}
exports.ExperimentationServiceMock = ExperimentationServiceMock;
//# sourceMappingURL=ExperimentationServiceMock.js.map
{"version":3,"file":"ExperimentationServiceMock.js","sourceRoot":"","sources":["../../../../src/tests/mocks/ExperimentationServiceMock.ts"],"names":[],"mappings":";;AAAA,iFAA8E;AAC9E,2FAAwF;AACxF,+DAA4D;AAE5D,uEAAoE;AACpE,0GAAuG;AAIvG,MAAa,0BAA2B,SAAQ,qEAAiC;IAC7E,YACY,SAAoC,EACpC,kBAA0B,IAAI,EACtC,wBAAoD,EACpD,eAAkC;QAElC,KAAK,CACD,wBAAwB,IAAI,IAAI,2DAA4B,EAAE,EAC9D,CAAC,IAAI,qEAAiC,EAAE,CAAC,EACzC,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,eAAe,IAAI,IAAI,yCAAmB,EAAE,CAC/C,CAAC;QAbM,cAAS,GAAT,SAAS,CAA2B;QACpC,oBAAe,GAAf,eAAe,CAAe;QAatC,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;IAES,IAAI;QACV,8CAA8C;QAC9C,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAE3B,KAAK,IAAI,IAAI,IAAI,IAAI,CAAC,SAAS,EAAE;YAC7B,IAAI,CAAC,kBAAkB,CACnB,IAAI,iDAAuB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC,CACnF,CAAC;SACL;QAED,IAAI,IAAI,CAAC,qBAAqB,IAAI,IAAI,EAAE;YACpC,IAAI,CAAC,qBAAqB,GAAG,uBAAuB,CAAC;SACxD;IACL,CAAC;CACJ;AAjCD,gEAiCC"}
import { IExperimentationTelemetry } from '../../contracts/IExperimentationTelemetry';
export declare class ExperimentationTelemetryMock implements IExperimentationTelemetry {
postedEvents: {
eventName: string;
args: any;
sharedProperties: Map<string, string>;
}[];
postEvent(eventName: string, args: any): void;
sharedProperties: Map<string, string>;
setSharedProperty(name: string, value: string): void;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class ExperimentationTelemetryMock {
constructor() {
this.postedEvents = [];
this.sharedProperties = new Map();
}
postEvent(eventName, args) {
console.log(`Post Event: ${eventName}`);
console.log(args);
this.postedEvents.push({ eventName, args, sharedProperties: new Map(this.sharedProperties) });
}
setSharedProperty(name, value) {
this.sharedProperties.set(name, value);
}
}
exports.ExperimentationTelemetryMock = ExperimentationTelemetryMock;
//# sourceMappingURL=ExperimentationTelemetryMock.js.map
{"version":3,"file":"ExperimentationTelemetryMock.js","sourceRoot":"","sources":["../../../../src/tests/mocks/ExperimentationTelemetryMock.ts"],"names":[],"mappings":";;AAEA,MAAa,4BAA4B;IAAzC;QACW,iBAAY,GAA8E,EAAE,CAAC;QAO7F,qBAAgB,GAAwB,IAAI,GAAG,EAAkB,CAAC;IAK7E,CAAC;IAXU,SAAS,CAAC,SAAiB,EAAE,IAAS;QACzC,OAAO,CAAC,GAAG,CAAC,eAAe,SAAS,EAAE,CAAC,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;IAClG,CAAC;IAIM,iBAAiB,CAAC,IAAY,EAAE,KAAa;QAChD,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC;CACJ;AAbD,oEAaC"}
export declare class FetchResolver {
private availableResults;
private lastServed;
constructor(...result: string[][]);
nextResult(): string[];
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class FetchResolver {
constructor(...result) {
this.availableResults = [];
this.lastServed = 0;
this.availableResults = result;
}
nextResult() {
if (this.lastServed >= this.availableResults.length) {
this.lastServed = 0;
}
let nextResult = this.availableResults[this.lastServed];
this.lastServed++;
return nextResult;
}
}
exports.FetchResolver = FetchResolver;
//# sourceMappingURL=FetchResolver.js.map
{"version":3,"file":"FetchResolver.js","sourceRoot":"","sources":["../../../../src/tests/mocks/FetchResolver.ts"],"names":[],"mappings":";;AAAA,MAAa,aAAa;IAGtB,YAAY,GAAG,MAAkB;QAFzB,qBAAgB,GAAe,EAAE,CAAC;QAClC,eAAU,GAAW,CAAC,CAAC;QAE3B,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC;IACnC,CAAC;IAEM,UAAU;QACb,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE;YACjD,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;SACvB;QAED,IAAI,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACxD,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,OAAO,UAAU,CAAC;IACtB,CAAC;CACJ;AAhBD,sCAgBC"}
import { FilteredFeatureProviderMock } from './BaseFeatureProviderMock';
import { ExperimentationServiceAutoPolling } from '../../tas-client/ExperimentationServiceAutoPolling';
import { IExperimentationFilterProvider } from 'src/contracts/IExperimentationFilterProvider';
export declare class FilteredExperimentationServiceMock extends ExperimentationServiceAutoPolling {
protected filterProviders: IExperimentationFilterProvider[];
constructor(filterProviders: IExperimentationFilterProvider[]);
featureProvider: FilteredFeatureProviderMock | undefined;
protected init(): void;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ExperimentationTelemetryMock_1 = require("./ExperimentationTelemetryMock");
const KeyValueStorageMock_1 = require("./KeyValueStorageMock");
const BaseFeatureProviderMock_1 = require("./BaseFeatureProviderMock");
const ExperimentationServiceAutoPolling_1 = require("../../tas-client/ExperimentationServiceAutoPolling");
class FilteredExperimentationServiceMock extends ExperimentationServiceAutoPolling_1.ExperimentationServiceAutoPolling {
constructor(filterProviders) {
super(new ExperimentationTelemetryMock_1.ExperimentationTelemetryMock(), filterProviders, 0, 'TelemetryName', 'TelemetryEventName', 'StorageKey', new KeyValueStorageMock_1.KeyValueStorageMock());
this.filterProviders = filterProviders;
this.invokeInit();
}
init() {
// set feature providers to be an empty array.
this.featureProviders = [];
this.featureProvider = new BaseFeatureProviderMock_1.FilteredFeatureProviderMock(this.telemetry, this.filterProviders);
this.addFeatureProvider(this.featureProvider);
if (this.telemetryPropertyName == null) {
this.telemetryPropertyName = 'MockTelemetryProperty';
}
}
}
exports.FilteredExperimentationServiceMock = FilteredExperimentationServiceMock;
//# sourceMappingURL=FilteredExperimentationServiceMock.js.map
{"version":3,"file":"FilteredExperimentationServiceMock.js","sourceRoot":"","sources":["../../../../src/tests/mocks/FilteredExperimentationServiceMock.ts"],"names":[],"mappings":";;AAAA,iFAA8E;AAK9E,+DAA4D;AAE5D,uEAAiG;AACjG,0GAAuG;AAGvG,MAAa,kCAAmC,SAAQ,qEAAiC;IACrF,YAAsB,eAAiD;QACnE,KAAK,CACD,IAAI,2DAA4B,EAAE,EAClC,eAAe,EACf,CAAC,EACD,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,IAAI,yCAAmB,EAAE,CAC5B,CAAC;QATgB,oBAAe,GAAf,eAAe,CAAkC;QAUnE,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;IAIS,IAAI;QACV,8CAA8C;QAC9C,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,eAAe,GAAG,IAAI,qDAA2B,CAClD,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,eAAe,CACvB,CAAC;QACF,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAE9C,IAAI,IAAI,CAAC,qBAAqB,IAAI,IAAI,EAAE;YACpC,IAAI,CAAC,qBAAqB,GAAG,uBAAuB,CAAC;SACxD;IACL,CAAC;CACJ;AA7BD,gFA6BC"}
import { IKeyValueStorage } from '../../contracts/IKeyValueStorage';
export declare class KeyValueStorageMock implements IKeyValueStorage {
private storage;
getValue<T>(key: string, defaultValue?: T): Promise<T | undefined>;
setValue<T>(key: string, value: T): void;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class KeyValueStorageMock {
constructor() {
this.storage = new Map();
}
async getValue(key, defaultValue) {
if (this.storage.has(key)) {
return await Promise.resolve(this.storage.get(key));
}
return await Promise.resolve(defaultValue || undefined);
}
setValue(key, value) {
this.storage.set(key, value);
}
}
exports.KeyValueStorageMock = KeyValueStorageMock;
//# sourceMappingURL=KeyValueStorageMock.js.map
{"version":3,"file":"KeyValueStorageMock.js","sourceRoot":"","sources":["../../../../src/tests/mocks/KeyValueStorageMock.ts"],"names":[],"mappings":";;AACA,MAAa,mBAAmB;IAAhC;QACY,YAAO,GAAqB,IAAI,GAAG,EAAe,CAAC;IAa/D,CAAC;IAXU,KAAK,CAAC,QAAQ,CAAI,GAAW,EAAE,YAAgB;QAClD,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YACvB,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;SACvD;QAED,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,YAAY,IAAI,SAAS,CAAC,CAAC;IAC5D,CAAC;IAEM,QAAQ,CAAI,GAAW,EAAE,KAAQ;QACpC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACjC,CAAC;CACJ;AAdD,kDAcC"}
import { FilteredFeatureProvider } from "../../tas-client/FeatureProvider/FilteredFeatureProvider";
export declare class MockFilteredFeatureProvider extends FilteredFeatureProvider {
fetch(): Promise<string[]>;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const FilteredFeatureProvider_1 = require("../../tas-client/FeatureProvider/FilteredFeatureProvider");
class MockFilteredFeatureProvider extends FilteredFeatureProvider_1.FilteredFeatureProvider {
fetch() {
const filters = this.getFilters();
const headers = {};
// Filters are handled using Map<string,any> therefore we need to
// convert these filters into something axios can take as headers.
for (let key of filters.keys()) {
const filterValue = filters.get(key);
headers[key] = filterValue;
}
this.PostEventToTelemetry(headers);
return Promise.resolve([]);
}
}
exports.MockFilteredFeatureProvider = MockFilteredFeatureProvider;
//# sourceMappingURL=MockFilteredFeatureProvider.js.map
{"version":3,"file":"MockFilteredFeatureProvider.js","sourceRoot":"","sources":["../../../../src/tests/mocks/MockFilteredFeatureProvider.ts"],"names":[],"mappings":";;AAAA,sGAAmG;AAEnG,MAAa,2BAA4B,SAAQ,iDAAuB;IAE7D,KAAK;QACR,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAClC,MAAM,OAAO,GAAQ,EAAE,CAAC;QAExB,iEAAiE;QACjE,kEAAkE;QAClE,KAAK,IAAI,GAAG,IAAI,OAAO,CAAC,IAAI,EAAE,EAAE;YAC5B,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACrC,OAAO,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC;SAC9B;QAED,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAEnC,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC/B,CAAC;CAEJ;AAlBD,kEAkBC"}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const KeyValueStorageMock_1 = require("./mocks/KeyValueStorageMock");
const ExperimentationFilterProviderMock_1 = require("./mocks/ExperimentationFilterProviderMock");
const ExperimentationService_1 = require("../tas-client/ExperimentationService");
const ExperimentationTelemetryMock_1 = require("./mocks/ExperimentationTelemetryMock");
/**
* For this test we want to ensure the polling interval works properly when set.
*/
describe('Web Api Test', () => {
/**
* Experimentation service example instantiation.
*/
let experimentationService = new ExperimentationService_1.ExperimentationService({
telemetry: new ExperimentationTelemetryMock_1.ExperimentationTelemetryMock(),
filterProviders: [new ExperimentationFilterProviderMock_1.ExperimentationFilterProviderMock()],
keyValueStorage: new KeyValueStorageMock_1.KeyValueStorageMock(),
storageKey: 'test_features',
endpoint: 'https://default.exp-tas.com/vscode/ab',
refetchInterval: 0,
telemetryPropertyName: 'TelemetryName',
telemetryEventName: 'feature_queried',
});
/**
* Experimentation service without filters.
*/
let experimentationServiceWithoutFilters = new ExperimentationService_1.ExperimentationService({
telemetry: new ExperimentationTelemetryMock_1.ExperimentationTelemetryMock(),
endpoint: 'https://default.exp-tas.com/vscode/ab',
telemetryPropertyName: 'TelemetryName',
telemetryEventName: 'event',
});
/**
* Used to test the TAS endpoint.
* This is only useful for testing purposes, and not for CI tests, as we don't want to attach an automatic unit
* test to an actual endpoint.
it('Should be able to fetch flights properly.', async () => {
let enabled = await experimentationServiceWithoutFilters.isFlightEnabledAsync('pythondeeplearning');
if (enabled) {
console.log("It's enabled.");
} else {
console.log('not enabled.');
}
});
*/
});
//# sourceMappingURL=WebApi.test.js.map
{"version":3,"file":"WebApi.test.js","sourceRoot":"","sources":["../../../src/tests/WebApi.test.ts"],"names":[],"mappings":";;AAAA,qEAAkE;AAClE,iGAA8F;AAC9F,iFAA8E;AAC9E,uFAAoF;AAEpF;;GAEG;AACH,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC1B;;OAEG;IACH,IAAI,sBAAsB,GAAG,IAAI,+CAAsB,CAAC;QACpD,SAAS,EAAE,IAAI,2DAA4B,EAAE;QAC7C,eAAe,EAAE,CAAC,IAAI,qEAAiC,EAAE,CAAC;QAC1D,eAAe,EAAE,IAAI,yCAAmB,EAAE;QAC1C,UAAU,EAAE,eAAe;QAC3B,QAAQ,EAAE,uCAAuC;QACjD,eAAe,EAAE,CAAC;QAClB,qBAAqB,EAAE,eAAe;QACtC,kBAAkB,EAAE,iBAAiB;KACxC,CAAC,CAAC;IAEH;;OAEG;IACH,IAAI,oCAAoC,GAAG,IAAI,+CAAsB,CAAC;QAClE,SAAS,EAAE,IAAI,2DAA4B,EAAE;QAC7C,QAAQ,EAAE,uCAAuC;QACjD,qBAAqB,EAAE,eAAe;QACtC,kBAAkB,EAAE,OAAO;KAC9B,CAAC,CAAC;IAEH;;;;;;;;;;;;;MAaE;AACN,CAAC,CAAC,CAAC"}