Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
fc5fe4c
feat: add protocol-v2 multivariate flag evaluation
roncohen Sep 16, 2026
7c28d1d
perf: prepare v2 flag lookups and percentage allocations once
roncohen Sep 16, 2026
1127ba8
refactor: use a simple loop for percentage allocation selection
roncohen Sep 16, 2026
fc5fa6f
refactor: preserve generic variant value types through evaluation
roncohen Sep 16, 2026
f05d37e
feat!: expose a v2-only prepared flag evaluator
roncohen Sep 16, 2026
03d9be5
build: prepare evaluator artifacts when packing the workspace
roncohen Sep 16, 2026
8d8bd97
docs: remove SDK rollout note from evaluator changeset
roncohen Sep 16, 2026
912f4fc
fix: distinguish v2 prerelease package identity from v1
roncohen Sep 16, 2026
c597521
build: use the registry v1 alias with distinct v2 package identity
roncohen Sep 16, 2026
1277a59
docs: simplify evaluator readme
roncohen Sep 22, 2026
c9a736d
feat(flag-evaluation): resolve flag and segment collection references
roncohen Oct 29, 2026
ad0d702
feat(flag-evaluation): expose batch and single evaluation methods
roncohen Oct 29, 2026
2448fca
feat(node-sdk): adopt collection values and Boolean-first reads
roncohen Nov 4, 2026
3cc369b
fix(node-sdk): check registered flag defaults
roncohen Nov 5, 2026
595758d
fix(node-sdk): keep internal helpers out of API docs
roncohen Nov 5, 2026
0809be2
Merge origin/main into feature/node-sdk-v2
roncohen Nov 14, 2026
ad516d7
docs: simplify Node v2 release notes
roncohen Nov 16, 2026
22527dc
chore: retrigger CI and security scans
roncohen Nov 18, 2026
956f266
refactor(node-sdk): address PR review feedback
roncohen Nov 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .changeset/node-sdk-collection-values.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
"@reflag/node-sdk": major
"@reflag/openfeature-node-provider": patch
---

Adopt protocol-v2, adding support for multivariate and JSON flags.

- `getFlag(context, key)` and bound `getFlag(key)` return direct values instead of flag wrappers. Reads without a default return Booleans, using `false` when unavailable. Replace `.isEnabled` and `.config` access with direct values.
- Pass a positional default to read strings, numbers, arrays, or objects. TypeScript infers the return type from the default without generated declarations. Missing values or values of a different top-level type use the default. Pass `null` to accept any JSON value, including null. Nested payload schemas are not validated at runtime.
- With optional `Flags` registration, TypeScript checks non-null defaults against each flag's value type for local, remote, and bound reads. Named-interface and readonly defaults are supported.
- Flag reads automatically record checks. Replace flag-level `.track()` calls with the client's separate `track()` API.
- `getFlags()` and `getFlagsRemote()` return records of direct values; unavailable flags may be `undefined`.
- `getFlagRemote(key, defaultValue, userId?, companyId?, context?)` now takes the default second, shifting existing user/company arguments one position to the right. Pass `undefined` for a Boolean read with explicit IDs. Bound clients use `getFlagRemote(key, defaultValue?)`.
- `getFlagDefinitions()` returns `{ flags, segments }` instead of an array.
- Saved fallback snapshots use a new format; v1 snapshots are not migrated automatically. Regenerate saved snapshots when upgrading. Built-in storage keeps v1 and v2 snapshots separate.
- `getFlagsForBootstrap()` produces protocol-v2 state. Upgrade Browser/framework consumers to compatible v2 SDKs before using this state; v1 bootstrap consumers are incompatible.
- Existing synchronization modes, bound contexts, and local overrides remain supported. Overrides and static fallbacks accept direct JSON values.

The OpenFeature Node provider continues to use Node SDK v1. Legacy remote configuration is not automatically converted into multivariate flag values.
2 changes: 1 addition & 1 deletion docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ do
echo "Processing $file..."

# Fix anchor links in globals.md files
if [[ "$file" == *"globals.md" ]]; then
if [ "${file##*/}" = "globals.md" ]; then
sed -r "$SEDCOMMAND" "$file" > "$file.fixed"
rm "$file"
mv "$file.fixed" "$file"
Expand Down
6 changes: 4 additions & 2 deletions packages/flag-evaluation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ V2 exports `newEvaluator(collection)`, `flattenContext`, and `hashInt`, plus the
public types. `newEvaluator` accepts a complete compiled collection, not value
rules or a single flag. It returns an object with `evaluateAll(context)` and
`evaluateFlag(context, flagKey)` methods, rather than a callable evaluator.
Publishers and consumers must adopt the collection/reference protocol together;
the unchanged Node SDK remains on the published v1 evaluator.
Publishers and consumers must adopt the collection/reference protocol together.
Node SDK v2 uses the collection evaluator. The OpenFeature Node provider and the
v1 React bootstrap demo remain pinned to published Node SDK 1.8.3 and its v1
evaluator.

V1's `evaluateFlagRules`, scalar `evaluate`, `flattenJSON`, `unflattenJSON`, and
value-rule types are removed. There is no v2 one-shot evaluation wrapper.
Expand Down
21 changes: 17 additions & 4 deletions packages/flag-evaluation/test/release.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { describe, expect, it } from "vitest";
import * as legacy from "@reflag/flag-evaluation-v1";

import nodeSdk from "../../node-sdk/package.json";
import openfeature from "../../openfeature-node-provider/package.json";

describe("v1/v2 release isolation", () => {
it("resolves the legacy alias to the published package, not this workspace", () => {
Expand All @@ -15,10 +16,22 @@ describe("v1/v2 release isolation", () => {
expect(typeof legacy.evaluateFlagRules).toBe("function");
});

it("keeps the unchanged Node SDK off the v2 workspace dependency", () => {
expect(nodeSdk.dependencies).not.toHaveProperty("@reflag/flag-evaluation");
expect(nodeSdk.dependencies["@reflag/flag-evaluation-v1"]).toBe(
"npm:@reflag/flag-evaluation@1.1.2",
it("moves the v2 Node SDK onto the collection evaluator", () => {
expect(nodeSdk.dependencies["@reflag/flag-evaluation"]).toBe("workspace:*");
expect(nodeSdk.dependencies).not.toHaveProperty(
"@reflag/flag-evaluation-v1",
);
});

it("keeps the unchanged OpenFeature provider on published Node SDK v1", () => {
// Matching the v2 workspace's version would silently link this alias locally.
expect(require.resolve("@reflag/node-sdk-v1/package.json")).not.toBe(
resolve(__dirname, "../../node-sdk/package.json"),
);
expect(require("@reflag/node-sdk-v1/package.json").version).toBe("1.8.3");
expect(openfeature.dependencies["@reflag/node-sdk-v1"]).toBe(
"npm:@reflag/node-sdk@1.8.3",
);
expect(openfeature.dependencies).not.toHaveProperty("@reflag/node-sdk");
});
});
Loading
Loading