@lokalise/fastify-extras
Version:
Opinionated set of fastify plugins, commonly used in Lokalise
25 lines (24 loc) • 1.13 kB
TypeScript
import type { Attributes, Properties, SplitIO, SplitKey, Treatment, TreatmentWithConfig } from '@splitsoftware/splitio/types/splitio';
import type { FastifyPluginAsync } from 'fastify';
declare module 'fastify' {
interface FastifyInstance {
splitIOFeatureManager: SplitIOFeatureManager;
}
}
export interface SplitIOOptions {
isEnabled: boolean;
apiKey: string;
debugMode: boolean;
localhostFilePath?: string;
}
export declare class SplitIOFeatureManager {
private readonly isEnabled;
private readonly splitIOClient?;
constructor(isSplitIOEnabled: boolean, apiKey: string, debugMode: boolean, localhostFilePath?: string);
init(): Promise<void>;
getTreatment(key: SplitKey, splitName: string, attributes?: Attributes): Treatment;
getTreatmentWithConfig(key: SplitKey, splitName: string, attributes?: Attributes): TreatmentWithConfig;
track(key: SplitIO.SplitKey, trafficType: string, eventType: string, value?: number, properties?: Properties): boolean;
shutdown(): Promise<void>;
}
export declare const splitIOFeatureManagerPlugin: FastifyPluginAsync<SplitIOOptions>;