From 9e00eb6e3abc8959c5506eb95e7d5404f0c3cae3 Mon Sep 17 00:00:00 2001 From: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Date: Fri, 27 Sep 2024 10:38:04 -0700 Subject: [PATCH] chore: Remove unused function in common client-side LDClientImpl. (#597) This code was orphaned in some refactoring and should be removed. --- .../shared/sdk-client/src/LDClientImpl.ts | 62 ------------------- 1 file changed, 62 deletions(-) diff --git a/packages/shared/sdk-client/src/LDClientImpl.ts b/packages/shared/sdk-client/src/LDClientImpl.ts index 71f65d7df..7802bbbcf 100644 --- a/packages/shared/sdk-client/src/LDClientImpl.ts +++ b/packages/shared/sdk-client/src/LDClientImpl.ts @@ -11,8 +11,6 @@ import { LDHeaders, LDLogger, Platform, - ProcessStreamResponse, - EventName as StreamEventName, subsystem, timedPromise, TypeValidators, @@ -33,9 +31,7 @@ import { import createEventProcessor from './events/createEventProcessor'; import EventFactory from './events/EventFactory'; import DefaultFlagManager, { FlagManager } from './flag-manager/FlagManager'; -import { ItemDescriptor } from './flag-manager/ItemDescriptor'; import LDEmitter, { EventName } from './LDEmitter'; -import { DeleteFlag, Flags, PatchFlag } from './types'; const { ClientMessages, ErrorKinds } = internal; @@ -170,64 +166,6 @@ export default class LDClientImpl implements LDClient { return this.checkedContext; } - private createStreamListeners( - context: Context, - identifyResolve: any, - ): Map { - const listeners = new Map(); - - listeners.set('put', { - deserializeData: JSON.parse, - processJson: async (evalResults: Flags) => { - this.logger.debug(`Stream PUT: ${Object.keys(evalResults)}`); - - // mapping flags to item descriptors - const descriptors = Object.entries(evalResults).reduce( - (acc: { [k: string]: ItemDescriptor }, [key, flag]) => { - acc[key] = { version: flag.version, flag }; - return acc; - }, - {}, - ); - await this.flagManager.init(context, descriptors).then(identifyResolve()); - }, - }); - - listeners.set('patch', { - deserializeData: JSON.parse, - processJson: async (patchFlag: PatchFlag) => { - this.logger.debug(`Stream PATCH ${JSON.stringify(patchFlag, null, 2)}`); - this.flagManager.upsert(context, patchFlag.key, { - version: patchFlag.version, - flag: patchFlag, - }); - }, - }); - - listeners.set('delete', { - deserializeData: JSON.parse, - processJson: async (deleteFlag: DeleteFlag) => { - this.logger.debug(`Stream DELETE ${JSON.stringify(deleteFlag, null, 2)}`); - - this.flagManager.upsert(context, deleteFlag.key, { - version: deleteFlag.version, - flag: { - ...deleteFlag, - deleted: true, - // props below are set to sensible defaults. they are irrelevant - // because this flag has been deleted. - flagVersion: 0, - value: undefined, - variation: 0, - trackEvents: false, - }, - }); - }, - }); - - return listeners; - } - private createIdentifyPromise(timeout: number): { identifyPromise: Promise; identifyResolve: () => void;