1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-31 13:47:02 +02:00

fix: flag-resolver context type

This commit is contained in:
Ivar Conradi Østhus 2025-04-10 10:44:04 +02:00
parent 8f117ac18e
commit 3f5f43933a
No known key found for this signature in database
GPG Key ID: 14F51E4841AF1DE1
2 changed files with 6 additions and 5 deletions

View File

@ -1,6 +1,7 @@
import { PayloadType, type Variant } from 'unleash-client'; import { PayloadType, type Variant } from 'unleash-client';
import { parseEnvVarBoolean } from '../util'; import { parseEnvVarBoolean } from '../util';
import { getDefaultVariant } from 'unleash-client/lib/variant'; import { getDefaultVariant } from 'unleash-client/lib/variant';
import type { Context } from '../features/playground/feature-evaluator';
export type IFlagKey = export type IFlagKey =
| 'accessLogs' | 'accessLogs'
@ -345,9 +346,7 @@ export interface IExperimentalOptions {
externalResolver: IExternalFlagResolver; externalResolver: IExternalFlagResolver;
} }
export interface IFlagContext { export interface IFlagContext extends Context {}
[key: string]: string;
}
export interface IFlagResolver { export interface IFlagResolver {
getAll: (context?: IFlagContext) => IFlags; getAll: (context?: IFlagContext) => IFlags;

View File

@ -244,7 +244,7 @@ test('should call external resolver getStaticContext ', () => {
return getDefaultVariant(); return getDefaultVariant();
}, },
getStaticContext: () => { getStaticContext: () => {
return { clientId: 'red' }; return { properties: { clientId: 'red' } };
}, },
}; };
@ -264,5 +264,7 @@ test('should call external resolver getStaticContext ', () => {
const resolver = new FlagResolver(config as IExperimentalOptions); const resolver = new FlagResolver(config as IExperimentalOptions);
expect(resolver.getStaticContext()).toStrictEqual({ clientId: 'red' }); expect(resolver.getStaticContext()).toStrictEqual({
properties: { clientId: 'red' },
});
}); });