From 44198501b9d8b3dc8ba553c436772757e1a880cf Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 29 Oct 2026 19:53:27 +0000 Subject: [PATCH 1/2] deps: update dependency flagsmith/sdk-spec to v0.7.0 --- .github/workflows/sdk-spec.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sdk-spec.yml b/.github/workflows/sdk-spec.yml index cfb2ea1..e132b92 100644 --- a/.github/workflows/sdk-spec.yml +++ b/.github/workflows/sdk-spec.yml @@ -11,7 +11,7 @@ permissions: jobs: sdk-spec: # Keep the ref in `uses:` and `spec-ref` in sync. - uses: Flagsmith/sdk-spec/.github/workflows/run-spec.yml@v0.3.0 + uses: Flagsmith/sdk-spec/.github/workflows/run-spec.yml@v0.7.0 with: - spec-ref: v0.3.0 + spec-ref: v0.7.0 language: nodejs From 1f669f4a5fd4c4beea6a2bbeb99c57d717b2061f Mon Sep 17 00:00:00 2001 From: "flagsmithsmith[bot]" <346993984+flagsmithsmith[bot]@users.noreply.github.com> Date: Thu, 29 Oct 2026 11:39:01 +0000 Subject: [PATCH 2/2] test(sdk-spec): Wire experiment flag and event tracking steps for spec v0.6.0 Spec v0.6.0 adds @events scenarios for getExperimentFlag, trackEvent and trackExposureEvent, plus a "Create the SDK client with events enabled" step. The SDK has supported these since 9.1.0, so the steps call the existing public API. Co-Authored-By: Claude Opus 5.5 (cherry picked from commit 6a108ea08fb51c154fdf9ca7ed7782bc7feedb35) --- sdk-spec/steps.mts | 47 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/sdk-spec/steps.mts b/sdk-spec/steps.mts index 9d4b3c8..0137822 100644 --- a/sdk-spec/steps.mts +++ b/sdk-spec/steps.mts @@ -19,6 +19,20 @@ export function createClient(environmentKey: string, apiUrl: string) { return new Flagsmith({ environmentKey, apiUrl }); } +// Create the SDK client with events enabled +export function createClientWithEvents( + environmentKey: string, + apiUrl: string, + eventsApiUrl: string +) { + return new Flagsmith({ + environmentKey, + apiUrl, + enableEvents: true, + eventProcessorConfig: { eventsApiUrl } + }); +} + // When the application gets the environment flags export async function getEnvironmentFlags(flagsmith: Flagsmith) { return asSpecFlags(await flagsmith.getEnvironmentFlags()); @@ -32,3 +46,36 @@ export async function getIdentityFlags( ) { return asSpecFlags(await flagsmith.getIdentityFlags(identifier, traits)); } + +// When the application gets the experiment flag "{feature}" for identity "{identifier}" with traits: +export async function getExperimentFlag( + flagsmith: Flagsmith, + feature: string, + identifier: string, + traits: Record +) { + const flag = await flagsmith.getExperimentFlag(feature, identifier, traits); + return [{ feature, enabled: flag.enabled, value: flag.value }]; +} + +// When the application tracks event "{event}" for identity "{identifier}" with value {value} and metadata: +export function trackEvent( + flagsmith: Flagsmith, + event: string, + identifier: string, + value: FlagsmithValue, + metadata: Record +) { + flagsmith.trackEvent(event, { identifier, value, metadata }); +} + +// When the application tracks an exposure of feature "{feature}" for identity "{identifier}" with value {value} and metadata: +export function trackExposureEvent( + flagsmith: Flagsmith, + feature: string, + identifier: string, + value: FlagsmithValue, + metadata: Record +) { + flagsmith.trackExposureEvent(feature, { identifier, value, metadata }); +}