From 39d4a0311ed442636b3866e822e2ced7aaef5df5 Mon Sep 17 00:00:00 2001 From: kwasniew Date: Wed, 7 Feb 2024 08:59:03 +0100 Subject: [PATCH 1/2] feat: sdk with double start prevention --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 217a52476379..9f7b25090b44 100644 --- a/package.json +++ b/package.json @@ -145,7 +145,7 @@ "stoppable": "^1.1.0", "ts-toolbelt": "^9.6.0", "type-is": "^1.6.18", - "unleash-client": "5.3.2", + "unleash-client": "5.5.0-beta.0", "uuid": "^9.0.0" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index d68d4cb81edd..1fbb815f4363 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7152,10 +7152,10 @@ universalify@^0.2.0: resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== -unleash-client@5.3.2: - version "5.3.2" - resolved "https://registry.yarnpkg.com/unleash-client/-/unleash-client-5.3.2.tgz#d4612d6893b2175fd23a038c85c9deaf2d60a1af" - integrity sha512-0iR0bzvWoJSuLPr9VKQhu1qr2jV3UeXcnMJylTzeeZWNhD6dxQSYS1bVl1wGhTRo/ucXnk5Lx66zmreIqojp8Q== +unleash-client@5.5.0-beta.0: + version "5.5.0-beta.0" + resolved "https://registry.yarnpkg.com/unleash-client/-/unleash-client-5.5.0-beta.0.tgz#8e9b8778fa2027fa282dcc9d31e0306a44bbb763" + integrity sha512-/HwClfmGKl6Pl+X8LTe4xCjxjRzgolx9DXBQFVSN6FDLGUHqf7BJWeYbZ5DSu5AaNVG/9dvksmrdjMXDiPSejQ== dependencies: ip "^1.1.8" make-fetch-happen "^10.2.1" From 5d222111b82aeae0b7f0a430171fd4bb5983d9c2 Mon Sep 17 00:00:00 2001 From: kwasniew Date: Wed, 7 Feb 2024 09:26:02 +0100 Subject: [PATCH 2/2] feat: prevent double start --- src/lib/proxy/proxy-repository.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib/proxy/proxy-repository.ts b/src/lib/proxy/proxy-repository.ts index 144f9d2e56bc..e55ec91815de 100644 --- a/src/lib/proxy/proxy-repository.ts +++ b/src/lib/proxy/proxy-repository.ts @@ -1,7 +1,10 @@ import EventEmitter from 'events'; import { RepositoryInterface } from 'unleash-client/lib/repository'; import { Segment } from 'unleash-client/lib/strategy/strategy'; -import { FeatureInterface } from 'unleash-client/lib/feature'; +import { + EnhancedFeatureInterface, + FeatureInterface, +} from 'unleash-client/lib/feature'; import { IApiUser } from '../types/api-user'; import { IUnleashConfig, IUnleashServices, IUnleashStores } from '../types'; import { @@ -68,6 +71,11 @@ export class ProxyRepository this.interval = config.frontendApi.refreshIntervalInMs; } + getTogglesWithSegmentData(): EnhancedFeatureInterface[] { + // TODO: add real implementation + return []; + } + getSegment(id: number): Segment | undefined { return this.segments.find((segment) => segment.id === id); }