@launchdarkly/js-server-sdk-common
Advanced tools
Comparing version
@@ -234,4 +234,4 @@ import { LDClientContext, LDLogger, subsystem, VoidFunction } from '@launchdarkly/js-sdk-common'; | ||
}; | ||
evaluationHooks?: Hook[]; | ||
hooks?: Hook[]; | ||
} | ||
//# sourceMappingURL=LDOptions.d.ts.map |
@@ -36,3 +36,3 @@ import { internal, LDContext, LDEvaluationDetail, LDEvaluationDetailTyped, Platform } from '@launchdarkly/js-sdk-common'; | ||
private diagnosticsManager?; | ||
private evaluationHooks?; | ||
private hooks?; | ||
/** | ||
@@ -54,3 +54,3 @@ * Intended for use by platform specific client implementations. | ||
private executeBeforeEvaluation; | ||
private prepareEvaluationHooks; | ||
private prepareHooks; | ||
private typedEval; | ||
@@ -57,0 +57,0 @@ boolVariation(key: string, context: LDContext, defaultValue: boolean): Promise<boolean>; |
@@ -59,3 +59,3 @@ "use strict"; | ||
// TODO: USE CONFIG | ||
this.evaluationHooks = options.evaluationHooks; | ||
this.hooks = options.hooks; | ||
if (!sdkKey && !config.offline) { | ||
@@ -165,3 +165,3 @@ throw new Error('You must configure the client with an SDK key'); | ||
async withHooks(key, context, defaultValue, methodName, method) { | ||
const { hooks, hookContext } = this.prepareEvaluationHooks(key, context, defaultValue, methodName); | ||
const { hooks, hookContext } = this.prepareHooks(key, context, defaultValue, methodName); | ||
const hookData = this.executeBeforeEvaluation(hooks, hookContext); | ||
@@ -178,4 +178,4 @@ const result = await method(); | ||
} | ||
prepareEvaluationHooks(key, context, defaultValue, methodName) { | ||
const hooks = [...(this.evaluationHooks || [])]; | ||
prepareHooks(key, context, defaultValue, methodName) { | ||
const hooks = [...(this.hooks || [])]; | ||
const hookContext = { | ||
@@ -234,3 +234,3 @@ key, | ||
async migrationVariation(key, context, defaultValue) { | ||
const { hooks, hookContext } = this.prepareEvaluationHooks(key, context, defaultValue, MIGRATION_VARIATION_METHOD_NAME); | ||
const { hooks, hookContext } = this.prepareHooks(key, context, defaultValue, MIGRATION_VARIATION_METHOD_NAME); | ||
const hookData = this.executeBeforeEvaluation(hooks, hookContext); | ||
@@ -237,0 +237,0 @@ const convertedContext = js_sdk_common_1.Context.fromLDContext(context); |
{ | ||
"name": "@launchdarkly/js-server-sdk-common", | ||
"version": "2.3.0-alpha.0", | ||
"version": "2.3.0-alpha.1", | ||
"type": "commonjs", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
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
599421
-0.02%