@launchdarkly/js-server-sdk-common
Advanced tools
Comparing version 1.3.0-alpha to 1.4.0-alpha.1
export * from './LDFlagsStateOptions'; | ||
export * from './LDFlagsState'; | ||
export * from './LDMigrationStage'; | ||
export * from './LDMigrationOpEvent'; | ||
export * from './LDMigrationVariation'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -19,2 +19,5 @@ "use strict"; | ||
__exportStar(require("./LDFlagsState"), exports); | ||
__exportStar(require("./LDMigrationStage"), exports); | ||
__exportStar(require("./LDMigrationOpEvent"), exports); | ||
__exportStar(require("./LDMigrationVariation"), exports); | ||
//# sourceMappingURL=index.js.map |
import { LDContext, LDEvaluationDetail, LDFlagValue } from '@launchdarkly/js-sdk-common'; | ||
import { LDMigrationOpEvent, LDMigrationVariation } from './data'; | ||
import { LDFlagsState } from './data/LDFlagsState'; | ||
import { LDFlagsStateOptions } from './data/LDFlagsStateOptions'; | ||
import { LDMigrationStage } from './data/LDMigrationStage'; | ||
/** | ||
@@ -108,2 +110,18 @@ * The LaunchDarkly SDK client object. | ||
/** | ||
* Returns the migration stage of the migration feature flag for the given | ||
* evaluation context. | ||
* | ||
* If the evaluated value of the flag cannot be converted to an LDMigrationStage, then the default | ||
* value will be returned and error will be logged. | ||
* | ||
* @param key The unique key of the feature flag. | ||
* @param context The context requesting the flag. The client will generate an analytics event to | ||
* register this context with LaunchDarkly if the context does not already exist. | ||
* @param defaultValue The default value of the flag, to be used if the value is not available | ||
* from LaunchDarkly. | ||
* @returns | ||
* A Promise which will be resolved with the result (as an{@link LDMigrationVariation}). | ||
*/ | ||
variationMigration(key: string, context: LDContext, defaultValue: LDMigrationStage): Promise<LDMigrationVariation>; | ||
/** | ||
* Builds an object that encapsulates the state of all feature flags for a given context. | ||
@@ -177,2 +195,8 @@ * This includes the flag values and also metadata that can be used on the front end. This | ||
/** | ||
* Track the details of a migration. | ||
* | ||
* @param event Event containing information about the migration operation. | ||
*/ | ||
trackMigration(event: LDMigrationOpEvent): void; | ||
/** | ||
* Identifies a context to LaunchDarkly. | ||
@@ -179,0 +203,0 @@ * |
@@ -5,2 +5,3 @@ export * from './LDBigSegmentsOptions'; | ||
export * from './LDTLSOptions'; | ||
export * from './LDMigrationOptions'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -21,2 +21,3 @@ "use strict"; | ||
__exportStar(require("./LDTLSOptions"), exports); | ||
__exportStar(require("./LDMigrationOptions"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -5,5 +5,5 @@ import { ApplicationTags, Info } from '@launchdarkly/js-sdk-common'; | ||
} | ||
export default function defaultHeaders(sdkKey: string, config: DefaultHeaderOptions, info: Info, includeAuthorizationHeader?: boolean): { | ||
export default function defaultHeaders(sdkKey: string, config: DefaultHeaderOptions, info: Info): { | ||
[key: string]: string; | ||
}; | ||
//# sourceMappingURL=defaultHeaders.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function defaultHeaders(sdkKey, config, info, includeAuthorizationHeader = true) { | ||
function defaultHeaders(sdkKey, config, info) { | ||
const sdkData = info.sdkData(); | ||
const headers = { | ||
authorization: sdkKey, | ||
'user-agent': `${sdkData.userAgentBase ? sdkData.userAgentBase : 'NodeJSClient'}/${sdkData.version}`, | ||
}; | ||
// edge sdks sets this to false because they use the clientSideID | ||
// and they don't need the authorization header | ||
if (includeAuthorizationHeader) { | ||
headers.authorization = sdkKey; | ||
} | ||
if (sdkData.wrapperName) { | ||
@@ -14,0 +10,0 @@ headers['x-launchdarkly-wrapper'] = sdkData.wrapperVersion |
@@ -114,2 +114,8 @@ "use strict"; | ||
}); | ||
Object.keys(parsed.configurationOverrides || {}).forEach((key) => { | ||
this.addItem(VersionedDataKinds_1.default.ConfigurationOverrides, parsed.configurationOverrides[key]); | ||
}); | ||
Object.keys(parsed.metrics || {}).forEach((key) => { | ||
this.addItem(VersionedDataKinds_1.default.Metrics, parsed.metrics[key]); | ||
}); | ||
} | ||
@@ -116,0 +122,0 @@ } |
@@ -59,2 +59,4 @@ "use strict"; | ||
[VersionedDataKinds_1.default.Segments.namespace]: parsed.segments, | ||
[VersionedDataKinds_1.default.ConfigurationOverrides.namespace]: parsed.configurationOverrides || {}, | ||
[VersionedDataKinds_1.default.Metrics.namespace]: parsed.metrics || {}, | ||
}; | ||
@@ -61,0 +63,0 @@ this.featureStore.init(initData, () => { |
@@ -95,2 +95,4 @@ "use strict"; | ||
[VersionedDataKinds_1.default.Segments.namespace]: parsed.data.segments, | ||
[VersionedDataKinds_1.default.ConfigurationOverrides.namespace]: parsed.data.configurationOverrides || {}, | ||
[VersionedDataKinds_1.default.Metrics.namespace]: parsed.data.metrics || {}, | ||
}; | ||
@@ -97,0 +99,0 @@ this.featureStore.init(initData, () => fn === null || fn === void 0 ? void 0 : fn()); |
@@ -26,4 +26,9 @@ import { ClientSideAvailability } from './ClientSideAvailability'; | ||
debugEventsUntilDate?: number; | ||
excludeFromSummaries?: boolean; | ||
samplingRatio?: number; | ||
migration?: { | ||
checkRatio?: number; | ||
}; | ||
} | ||
export {}; | ||
//# sourceMappingURL=Flag.d.ts.map |
@@ -12,3 +12,3 @@ "use strict"; | ||
} | ||
evalEvent(flag, context, detail, defaultVal, prereqOfFlag) { | ||
evalEvent(flag, context, detail, defaultVal, prereqOfFlag, indexEventSamplingRatio) { | ||
var _a; | ||
@@ -18,14 +18,26 @@ const addExperimentData = (0, isExperiment_1.default)(flag, detail.reason); | ||
// Exclude null as a possibility. | ||
(_a = detail.variationIndex) !== null && _a !== void 0 ? _a : undefined, flag.trackEvents || addExperimentData, prereqOfFlag === null || prereqOfFlag === void 0 ? void 0 : prereqOfFlag.key, this.withReasons || addExperimentData ? detail.reason : undefined, flag.debugEventsUntilDate); | ||
(_a = detail.variationIndex) !== null && _a !== void 0 ? _a : undefined, flag.trackEvents || addExperimentData, prereqOfFlag === null || prereqOfFlag === void 0 ? void 0 : prereqOfFlag.key, this.withReasons || addExperimentData ? detail.reason : undefined, flag.debugEventsUntilDate, flag.excludeFromSummaries, flag.samplingRatio, indexEventSamplingRatio !== null && indexEventSamplingRatio !== void 0 ? indexEventSamplingRatio : 1); | ||
} | ||
unknownFlagEvent(key, context, detail) { | ||
return new js_sdk_common_1.internal.InputEvalEvent(this.withReasons, context, key, detail.value, detail); | ||
unknownFlagEvent(key, context, detail, indexEventSamplingRatio) { | ||
return new js_sdk_common_1.internal.InputEvalEvent(this.withReasons, context, key, detail.value, detail, | ||
// This isn't ideal, but the purpose of the factory is to at least | ||
// handle this situation. | ||
undefined, // version | ||
undefined, // variation index | ||
undefined, // track events | ||
undefined, // prereqOf | ||
undefined, // reason | ||
undefined, // debugEventsUntilDate | ||
undefined, // exclude from summaries | ||
undefined, // sampling ratio | ||
indexEventSamplingRatio); | ||
} | ||
/* eslint-disable-next-line class-methods-use-this */ | ||
identifyEvent(context) { | ||
return new js_sdk_common_1.internal.InputIdentifyEvent(context); | ||
// Currently sampling for identify events is always 1. | ||
return new js_sdk_common_1.internal.InputIdentifyEvent(context, 1); | ||
} | ||
/* eslint-disable-next-line class-methods-use-this */ | ||
customEvent(key, context, data, metricValue) { | ||
return new js_sdk_common_1.internal.InputCustomEvent(context, key, data !== null && data !== void 0 ? data : undefined, metricValue !== null && metricValue !== void 0 ? metricValue : undefined); | ||
customEvent(key, context, data, metricValue, samplingRatio = 1, indexSamplingRatio = 1) { | ||
return new js_sdk_common_1.internal.InputCustomEvent(context, key, data !== null && data !== void 0 ? data : undefined, metricValue !== null && metricValue !== void 0 ? metricValue : undefined, samplingRatio, indexSamplingRatio); | ||
} | ||
@@ -32,0 +44,0 @@ } |
@@ -9,8 +9,7 @@ "use strict"; | ||
constructor(config, clientContext) { | ||
const { basicConfiguration: { sdkKey, serviceEndpoints: { events, analyticsEventPath, diagnosticEventPath, includeAuthorizationHeader, }, }, platform: { info, requests, crypto }, } = clientContext; | ||
this.defaultHeaders = Object.assign({}, (0, defaultHeaders_1.default)(sdkKey, config, info, includeAuthorizationHeader)); | ||
this.eventsUri = `${events}${analyticsEventPath}`; | ||
this.diagnosticEventsUri = `${events}${diagnosticEventPath}`; | ||
this.requests = requests; | ||
this.crypto = crypto; | ||
this.defaultHeaders = Object.assign({}, (0, defaultHeaders_1.default)(clientContext.basicConfiguration.sdkKey, config, clientContext.platform.info)); | ||
this.eventsUri = `${clientContext.basicConfiguration.serviceEndpoints.events}/bulk`; | ||
this.diagnosticEventsUri = `${clientContext.basicConfiguration.serviceEndpoints.events}/diagnostic`; | ||
this.requests = clientContext.platform.requests; | ||
this.crypto = clientContext.platform.crypto; | ||
} | ||
@@ -17,0 +16,0 @@ async tryPostingEvents(events, uri, payloadId, canRetry) { |
import BigSegmentStoreStatusProviderImpl from './BigSegmentStatusProviderImpl'; | ||
import LDClientImpl from './LDClientImpl'; | ||
import Migration, { LDMigrationError, LDMigrationSuccess } from './Migration'; | ||
export * as integrations from './integrations'; | ||
@@ -9,3 +10,3 @@ export * as platform from '@launchdarkly/js-sdk-common'; | ||
export * from '@launchdarkly/js-sdk-common'; | ||
export { LDClientImpl, BigSegmentStoreStatusProviderImpl }; | ||
export { LDClientImpl, BigSegmentStoreStatusProviderImpl, LDMigrationError, LDMigrationSuccess, Migration, }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -17,3 +17,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BigSegmentStoreStatusProviderImpl = exports.LDClientImpl = exports.platform = exports.integrations = void 0; | ||
exports.Migration = exports.LDMigrationSuccess = exports.LDMigrationError = exports.BigSegmentStoreStatusProviderImpl = exports.LDClientImpl = exports.platform = exports.integrations = void 0; | ||
const BigSegmentStatusProviderImpl_1 = require("./BigSegmentStatusProviderImpl"); | ||
@@ -23,2 +23,7 @@ exports.BigSegmentStoreStatusProviderImpl = BigSegmentStatusProviderImpl_1.default; | ||
exports.LDClientImpl = LDClientImpl_1.default; | ||
// TODO: Maybe we have a factory? | ||
const Migration_1 = require("./Migration"); | ||
exports.Migration = Migration_1.default; | ||
Object.defineProperty(exports, "LDMigrationError", { enumerable: true, get: function () { return Migration_1.LDMigrationError; } }); | ||
Object.defineProperty(exports, "LDMigrationSuccess", { enumerable: true, get: function () { return Migration_1.LDMigrationSuccess; } }); | ||
exports.integrations = require("./integrations"); | ||
@@ -25,0 +30,0 @@ exports.platform = require("@launchdarkly/js-sdk-common"); |
@@ -189,3 +189,5 @@ import TestDataRuleBuilder from './TestDataRuleBuilder'; | ||
ifNotMatch(contextKind: string, attribute: string, ...values: any): TestDataRuleBuilder<TestDataFlagBuilder>; | ||
checkRatio(ratio: number): TestDataFlagBuilder; | ||
samplingRatio(ratio: number): TestDataFlagBuilder; | ||
} | ||
//# sourceMappingURL=TestDataFlagBuilder.d.ts.map |
@@ -314,2 +314,12 @@ "use strict"; | ||
} | ||
checkRatio(ratio) { | ||
var _a; | ||
this.data.migration = (_a = this.data.migration) !== null && _a !== void 0 ? _a : {}; | ||
this.data.migration.checkRatio = ratio; | ||
return this; | ||
} | ||
samplingRatio(ratio) { | ||
this.data.samplingRatio = ratio; | ||
return this; | ||
} | ||
/** | ||
@@ -337,2 +347,4 @@ * @internal | ||
variations: [...this.data.variations], | ||
migration: this.data.migration, | ||
samplingRatio: this.data.samplingRatio, | ||
}; | ||
@@ -339,0 +351,0 @@ if (this.data.targetsByVariation) { |
@@ -1,3 +0,3 @@ | ||
import { internal, LDContext, LDEvaluationDetail, Platform } from '@launchdarkly/js-sdk-common'; | ||
import { LDClient, LDFlagsState, LDFlagsStateOptions, LDOptions } from './api'; | ||
import { LDContext, LDEvaluationDetail, Platform } from '@launchdarkly/js-sdk-common'; | ||
import { LDClient, LDFlagsState, LDFlagsStateOptions, LDMigrationOpEvent, LDMigrationStage, LDMigrationVariation, LDOptions } from './api'; | ||
import BigSegmentStoreStatusProvider from './BigSegmentStatusProviderImpl'; | ||
@@ -35,2 +35,3 @@ export interface LDClientCallbacks { | ||
private diagnosticsManager?; | ||
private eventConfig; | ||
/** | ||
@@ -44,3 +45,3 @@ * Intended for use by platform specific client implementations. | ||
protected bigSegmentStatusProviderInternal: BigSegmentStoreStatusProvider; | ||
constructor(sdkKey: string, platform: Platform, options: LDOptions, callbacks: LDClientCallbacks, internalOptions?: internal.LDInternalOptions); | ||
constructor(sdkKey: string, platform: Platform, options: LDOptions, callbacks: LDClientCallbacks); | ||
initialized(): boolean; | ||
@@ -50,2 +51,3 @@ waitForInitialization(): Promise<LDClient>; | ||
variationDetail(key: string, context: LDContext, defaultValue: any, callback?: (err: any, res: LDEvaluationDetail) => void): Promise<LDEvaluationDetail>; | ||
variationMigration(key: string, context: LDContext, defaultValue: LDMigrationStage): Promise<LDMigrationVariation>; | ||
allFlagsState(context: LDContext, options?: LDFlagsStateOptions, callback?: (err: Error | null, res: LDFlagsState) => void): Promise<LDFlagsState>; | ||
@@ -56,2 +58,3 @@ secureModeHash(context: LDContext): string; | ||
track(key: string, context: LDContext, data?: any, metricValue?: number): void; | ||
trackMigration(event: LDMigrationOpEvent): void; | ||
identify(context: LDContext): void; | ||
@@ -58,0 +61,0 @@ flush(callback?: (err: Error | null, res: boolean) => void): Promise<void>; |
@@ -6,2 +6,3 @@ "use strict"; | ||
const js_sdk_common_1 = require("@launchdarkly/js-sdk-common"); | ||
const api_1 = require("./api"); | ||
const BigSegmentsManager_1 = require("./BigSegmentsManager"); | ||
@@ -26,4 +27,6 @@ const ClientMessages_1 = require("./ClientMessages"); | ||
const FlagsStateBuilder_1 = require("./FlagsStateBuilder"); | ||
const MigrationOpEventConversion_1 = require("./MigrationOpEventConversion"); | ||
const MigrationOpTracker_1 = require("./MigrationOpTracker"); | ||
const Configuration_1 = require("./options/Configuration"); | ||
const store_1 = require("./store"); | ||
const AsyncStoreFacade_1 = require("./store/AsyncStoreFacade"); | ||
const VersionedDataKinds_1 = require("./store/VersionedDataKinds"); | ||
@@ -40,3 +43,3 @@ var InitState; | ||
class LDClientImpl { | ||
constructor(sdkKey, platform, options, callbacks, internalOptions) { | ||
constructor(sdkKey, platform, options, callbacks) { | ||
var _a, _b, _c, _d, _e; | ||
@@ -52,3 +55,3 @@ this.sdkKey = sdkKey; | ||
const { onUpdate, hasEventListeners } = callbacks; | ||
const config = new Configuration_1.default(options, internalOptions); | ||
const config = new Configuration_1.default(options); | ||
if (!sdkKey && !config.offline) { | ||
@@ -61,3 +64,3 @@ throw new Error('You must configure the client with an SDK key'); | ||
const featureStore = config.featureStoreFactory(clientContext); | ||
this.asyncFeatureStore = new store_1.AsyncStoreFacade(featureStore); | ||
this.asyncFeatureStore = new AsyncStoreFacade_1.default(featureStore); | ||
const dataSourceUpdates = new DataSourceUpdates_1.default(featureStore, hasEventListeners, onUpdate); | ||
@@ -122,2 +125,20 @@ if (config.sendEvents && !config.offline && !config.diagnosticOptOut) { | ||
}); | ||
this.eventConfig = { | ||
samplingRatio: async (key) => { | ||
var _a; | ||
const ratioItem = await this.asyncFeatureStore.get(VersionedDataKinds_1.default.Metrics, key); | ||
if (ratioItem && !ratioItem.deleted) { | ||
return (_a = ratioItem.samplingRatio) !== null && _a !== void 0 ? _a : 1; | ||
} | ||
return 1; | ||
}, | ||
indexEventSamplingRatio: async () => { | ||
var _a; | ||
const indexSampling = await this.asyncFeatureStore.get(VersionedDataKinds_1.default.ConfigurationOverrides, 'indexSamplingRatio'); | ||
if (indexSampling && !indexSampling.deleted) { | ||
return (_a = indexSampling.value) !== null && _a !== void 0 ? _a : 1; | ||
} | ||
return 1; | ||
}, | ||
}; | ||
} | ||
@@ -155,2 +176,32 @@ initialized() { | ||
} | ||
async variationMigration(key, context, defaultValue) { | ||
const convertedContext = js_sdk_common_1.Context.fromLDContext(context); | ||
return new Promise((resolve) => { | ||
this.evaluateIfPossible(key, context, defaultValue, this.eventFactoryWithReasons, ({ detail }, flag) => { | ||
var _a; | ||
const contextKeys = convertedContext.valid ? convertedContext.kindsAndKeys : {}; | ||
const checkRatio = (_a = flag === null || flag === void 0 ? void 0 : flag.migration) === null || _a === void 0 ? void 0 : _a.checkRatio; | ||
const samplingRatio = flag === null || flag === void 0 ? void 0 : flag.samplingRatio; | ||
if (!(0, api_1.IsMigrationStage)(detail.value)) { | ||
const error = new Error(`Unrecognized MigrationState for "${key}"; returning default value.`); | ||
this.onError(error); | ||
const reason = { | ||
kind: 'ERROR', | ||
errorKind: 'WRONG_TYPE', | ||
}; | ||
resolve({ | ||
value: defaultValue, | ||
tracker: new MigrationOpTracker_1.default(key, contextKeys, defaultValue, defaultValue, reason, checkRatio, undefined, samplingRatio), | ||
}); | ||
return; | ||
} | ||
resolve({ | ||
value: detail.value, | ||
tracker: new MigrationOpTracker_1.default(key, contextKeys, defaultValue, detail.value, detail.reason, checkRatio, | ||
// Can be null for compatibility reasons. | ||
detail.variationIndex === null ? undefined : detail.variationIndex, samplingRatio), | ||
}); | ||
}); | ||
}); | ||
} | ||
allFlagsState(context, options, callback) { | ||
@@ -242,4 +293,15 @@ var _a, _b, _c; | ||
} | ||
this.eventProcessor.sendEvent(this.eventFactoryDefault.customEvent(key, checkedContext, data, metricValue)); | ||
// Async immediately invoking function expression to get the flag from the store | ||
// without requiring track to be async. | ||
(async () => { | ||
this.eventProcessor.sendEvent(this.eventFactoryDefault.customEvent(key, checkedContext, data, metricValue, await this.eventConfig.samplingRatio(key), await this.eventConfig.indexEventSamplingRatio())); | ||
})(); | ||
} | ||
trackMigration(event) { | ||
const converted = (0, MigrationOpEventConversion_1.default)(event); | ||
if (!converted) { | ||
return; | ||
} | ||
this.eventProcessor.sendEvent(converted); | ||
} | ||
identify(context) { | ||
@@ -282,3 +344,6 @@ var _a; | ||
const result = EvalResult_1.default.forError(ErrorKinds_1.default.FlagNotFound, undefined, defaultValue); | ||
this.eventProcessor.sendEvent(this.eventFactoryDefault.unknownFlagEvent(flagKey, evalContext, result.detail)); | ||
(async () => { | ||
const indexSamplingRatio = await this.eventConfig.indexEventSamplingRatio(); | ||
this.eventProcessor.sendEvent(this.eventFactoryDefault.unknownFlagEvent(flagKey, evalContext, result.detail, indexSamplingRatio)); | ||
})(); | ||
cb(result); | ||
@@ -288,3 +353,3 @@ return; | ||
this.evaluator.evaluateCb(flag, evalContext, (evalRes) => { | ||
var _a, _b; | ||
var _a; | ||
if (evalRes.detail.variationIndex === undefined || | ||
@@ -295,7 +360,13 @@ evalRes.detail.variationIndex === null) { | ||
} | ||
(_b = evalRes.events) === null || _b === void 0 ? void 0 : _b.forEach((event) => { | ||
this.eventProcessor.sendEvent(event); | ||
}); | ||
this.eventProcessor.sendEvent(eventFactory.evalEvent(flag, evalContext, evalRes.detail, defaultValue)); | ||
cb(evalRes); | ||
// Immediately invoked function expression to get the event out of the callback | ||
// path and allow access to async methods. | ||
(async () => { | ||
var _a; | ||
const indexSamplingRatio = await this.eventConfig.indexEventSamplingRatio(); | ||
(_a = evalRes.events) === null || _a === void 0 ? void 0 : _a.forEach((event) => { | ||
this.eventProcessor.sendEvent(Object.assign(Object.assign({}, event), { indexSamplingRatio })); | ||
}); | ||
this.eventProcessor.sendEvent(eventFactory.evalEvent(flag, evalContext, evalRes.detail, defaultValue, undefined, indexSamplingRatio)); | ||
})(); | ||
cb(evalRes, flag); | ||
}, eventFactory); | ||
@@ -302,0 +373,0 @@ }); |
@@ -130,3 +130,3 @@ "use strict"; | ||
class Configuration { | ||
constructor(options = {}, internalOptions = {}) { | ||
constructor(options = {}) { | ||
// The default will handle undefined, but not null. | ||
@@ -144,3 +144,3 @@ // Because we can be called from JS we need to be extra defensive. | ||
validateEndpoints(options, validatedOptions); | ||
this.serviceEndpoints = new js_sdk_common_1.ServiceEndpoints(validatedOptions.streamUri, validatedOptions.baseUri, validatedOptions.eventsUri, internalOptions.analyticsEventPath, internalOptions.diagnosticEventPath); | ||
this.serviceEndpoints = new js_sdk_common_1.ServiceEndpoints(validatedOptions.streamUri, validatedOptions.baseUri, validatedOptions.eventsUri); | ||
this.eventsCapacity = validatedOptions.capacity; | ||
@@ -147,0 +147,0 @@ this.timeout = validatedOptions.timeout; |
import { Flag } from '../evaluation/data/Flag'; | ||
import { Segment } from '../evaluation/data/Segment'; | ||
interface FlagsAndSegments { | ||
import { Metric } from './Metric'; | ||
import { Override } from './Override'; | ||
interface AllData { | ||
flags: { | ||
@@ -10,2 +12,8 @@ [name: string]: Flag; | ||
}; | ||
configurationOverrides?: { | ||
[name: string]: Override; | ||
}; | ||
metrics?: { | ||
[name: string]: Metric; | ||
}; | ||
} | ||
@@ -20,4 +28,4 @@ /** | ||
*/ | ||
export declare function deserializePoll(data: string): FlagsAndSegments | undefined; | ||
export declare function deserializePoll(data: string): AllData | undefined; | ||
export {}; | ||
//# sourceMappingURL=serialization.d.ts.map |
@@ -222,2 +222,8 @@ "use strict"; | ||
} | ||
else if (parsed.path.startsWith(VersionedDataKinds_1.default.ConfigurationOverrides.streamApiPath)) { | ||
parsed.kind = VersionedDataKinds_1.default.ConfigurationOverrides; | ||
} | ||
else if (parsed.path.startsWith(VersionedDataKinds_1.default.Metrics.streamApiPath)) { | ||
parsed.kind = VersionedDataKinds_1.default.Metrics; | ||
} | ||
return parsed; | ||
@@ -240,2 +246,8 @@ } | ||
} | ||
else if (parsed.path.startsWith(VersionedDataKinds_1.default.ConfigurationOverrides.streamApiPath)) { | ||
parsed.kind = VersionedDataKinds_1.default.ConfigurationOverrides; | ||
} | ||
else if (parsed.path.startsWith(VersionedDataKinds_1.default.Metrics.streamApiPath)) { | ||
parsed.kind = VersionedDataKinds_1.default.Metrics; | ||
} | ||
return parsed; | ||
@@ -242,0 +254,0 @@ } |
@@ -5,3 +5,2 @@ import { DataKind } from '../api/interfaces'; | ||
streamApiPath: string; | ||
requestPath: string; | ||
getDependencyKeys?: (item: any) => string[]; | ||
@@ -12,3 +11,5 @@ } | ||
static readonly Segments: VersionedDataKind; | ||
static readonly ConfigurationOverrides: VersionedDataKind; | ||
static readonly Metrics: VersionedDataKind; | ||
} | ||
//# sourceMappingURL=VersionedDataKinds.d.ts.map |
@@ -8,3 +8,2 @@ "use strict"; | ||
streamApiPath: '/flags/', | ||
requestPath: '/sdk/latest-flags/', | ||
}; | ||
@@ -14,5 +13,12 @@ VersionedDataKinds.Segments = { | ||
streamApiPath: '/segments/', | ||
requestPath: '/sdk/latest-segments/', | ||
}; | ||
VersionedDataKinds.ConfigurationOverrides = { | ||
namespace: 'configurationOverrides', | ||
streamApiPath: '/configurationOverrides/', | ||
}; | ||
VersionedDataKinds.Metrics = { | ||
namespace: 'metrics', | ||
streamApiPath: '/metrics/', | ||
}; | ||
exports.default = VersionedDataKinds; | ||
//# sourceMappingURL=VersionedDataKinds.js.map |
{ | ||
"name": "@launchdarkly/js-server-sdk-common", | ||
"version": "1.3.0-alpha", | ||
"version": "1.4.0-alpha.1", | ||
"type": "commonjs", | ||
@@ -26,7 +26,7 @@ "main": "./dist/index.js", | ||
"lint": "npx eslint . --ext .ts", | ||
"lint:fix": "yarn run lint -- --fix" | ||
"lint:fix": "yarn run lint --fix" | ||
}, | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"@launchdarkly/js-sdk-common": "1.2.0-alpha", | ||
"@launchdarkly/js-sdk-common": "1.3.0-alpha.1", | ||
"semver": "7.5.4" | ||
@@ -33,0 +33,0 @@ }, |
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
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
598808
476
8541
4
+ Added@launchdarkly/js-sdk-common@1.3.0-alpha.1(transitive)
- Removed@launchdarkly/js-sdk-common@1.2.0-alpha(transitive)