diff --git a/.changeset/auto-feedback-late-user.md b/.changeset/auto-feedback-late-user.md deleted file mode 100644 index 1d81ec071..000000000 --- a/.changeset/auto-feedback-late-user.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"@reflag/browser-sdk": patch -"@reflag/openfeature-browser-provider": patch ---- - -Start automatic feedback surveys when a user ID is first set after the client was created without one, for example with `setContext()` or `updateUser()` after sign-in. Previously, surveys only worked if the client was created with a user. The OpenFeature Browser provider now updates its client's context instead of starting a new client when the first user ID arrives. diff --git a/.changeset/bootstrap-public-flags-only.md b/.changeset/bootstrap-public-flags-only.md deleted file mode 100644 index 24e1200e1..000000000 --- a/.changeset/bootstrap-public-flags-only.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@reflag/node-sdk": patch ---- - -Keep secret flags out of browser data returned by `getFlagsForBootstrap()`, including bound clients. Server-side reads still work, including public flags that depend on secret flags. Remove dependency names from error details sent to the browser. diff --git a/.changeset/browser-framework-collection-values.md b/.changeset/browser-framework-collection-values.md deleted file mode 100644 index 56e2af6aa..000000000 --- a/.changeset/browser-framework-collection-values.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -"@reflag/browser-sdk": major -"@reflag/react-sdk": major -"@reflag/vue-sdk": major ---- - -Adopt protocol-v2, adding support for multivariate and JSON flags in Browser, React and Vue. - -- Browser `getFlag()` and React `useFlag()` return direct values instead of flag wrappers. Vue `useFlag()` returns a ref to the direct value. Replace `.isEnabled` and `.config` access with direct values, using `.value` for Vue refs in script. -- Reads without a default return Booleans, using `false` when unavailable. Pass a positional default to read strings, numbers, arrays, or objects, with TypeScript inferring the return type. 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. -- React and Vue's optional `Flags` registration checks non-null defaults against each flag's value type, including React Suspense reads. Named-interface and readonly defaults are supported across Browser, React and Vue without losing their inferred value types. -- React `useFlag()` never suspends. Replace `useFlag(key, { suspense: true })` with `useFlagSuspense(key)` to wait for initialization. Use `useIsLoading()` for loading state; existing provider and `useOptInFlags` Suspense options continue to control opt-in loading only. -- Flag reads automatically record checks. Replace flag-level `.track()` and `.requestFeedback()` calls with the client's separate methods or the framework's tracking and feedback hooks/composables. -- Browser `getFlags()` returns a record of direct values; unavailable flags may be `undefined`. Use `getFlagResults()` for diagnostic access without recording checks. -- Bootstrap data must come from Node SDK v2 and be consumed by matching v2 SDKs. Legacy v1 payloads are incompatible. Replace the Browser client's `bootstrappedFlags` option with `bootstrappedState` and pass the complete bootstrap payload. -- Overrides accept direct JSON values: `undefined` clears an override, while `null` is a value. Saved v1 caches and overrides are not reused. -- Bootstrapped clients load opt-in metadata when requested, without replacing server-provided flag values. Successful opt-in changes update both membership and flag values. - -The OpenFeature Browser provider continues to use Browser SDK v1. Legacy remote configuration is not automatically converted into multivariate flag values. diff --git a/.changeset/browser-opt-in-value.md b/.changeset/browser-opt-in-value.md deleted file mode 100644 index adb3ca08f..000000000 --- a/.changeset/browser-opt-in-value.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@reflag/browser-sdk": major ---- - -Opt-in entries from `getOptInFlags()` now have a Boolean `value` instead of `isEnabled`. The deprecated `getFeatures()` alias is removed; use `getFlags()`. diff --git a/.changeset/cli-multi-org.md b/.changeset/cli-multi-org.md deleted file mode 100644 index 676681925..000000000 --- a/.changeset/cli-multi-org.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@reflag/cli": patch ---- - -Fix app discovery for users who belong to multiple organizations. `reflag apps list` shows each app's organization, `reflag init` lets you choose an organization, and existing configs resolve their `appId` without requiring an `orgId`. Use `orgId` or `--org-id` to restrict the CLI to one organization. API keys remain scoped to their app. diff --git a/.changeset/cli-rules-openfeature.md b/.changeset/cli-rules-openfeature.md deleted file mode 100644 index e1a061af7..000000000 --- a/.changeset/cli-rules-openfeature.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@reflag/cli": patch ---- - -The coding-agent rules no longer say the OpenFeature providers use SDK v1. diff --git a/.changeset/cli-rules-plain-wording.md b/.changeset/cli-rules-plain-wording.md deleted file mode 100644 index 68fd3d0bc..000000000 --- a/.changeset/cli-rules-plain-wording.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@reflag/cli": patch ---- - -Rewrite the coding-agent rules from `reflag rules` in plain language, cover React Native, and note that `fallbackFlags` is replaced by read defaults. diff --git a/.changeset/fix-published-workspace-dependencies.md b/.changeset/fix-published-workspace-dependencies.md deleted file mode 100644 index c0e39618c..000000000 --- a/.changeset/fix-published-workspace-dependencies.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -"@reflag/node-sdk": patch -"@reflag/react-sdk": patch -"@reflag/vue-sdk": patch -"@reflag/react-native-sdk": patch ---- - -Replace workspace-only dependency ranges with registry-compatible versions so the published SDKs can be installed outside the monorepo. Keep local workspace linking and the existing v1 OpenFeature dependencies unchanged. diff --git a/.changeset/node-sdk-collection-values.md b/.changeset/node-sdk-collection-values.md deleted file mode 100644 index 43948018d..000000000 --- a/.changeset/node-sdk-collection-values.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -"@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. diff --git a/.changeset/openfeature-node-esm.md b/.changeset/openfeature-node-esm.md deleted file mode 100644 index e91257f31..000000000 --- a/.changeset/openfeature-node-esm.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@reflag/openfeature-node-provider": patch ---- - -Allow ES modules to import the Node.js OpenFeature provider through its existing CommonJS build. CommonJS imports and TypeScript declarations are unchanged. diff --git a/.changeset/openfeature-sdk-v2.md b/.changeset/openfeature-sdk-v2.md deleted file mode 100644 index ca0ad733b..000000000 --- a/.changeset/openfeature-sdk-v2.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"@reflag/openfeature-browser-provider": major -"@reflag/openfeature-node-provider": major ---- - -Use Reflag SDK v2. Boolean flags resolve with `getBooleanValue()`, and multivariate flags resolve with the method that matches their value's type: `getStringValue()`, `getNumberValue()` or `getObjectValue()`. String and object reads no longer return a Boolean flag's Remote config key or payload; move Remote config to a multivariate flag first. Number reads now work. A read returns your default with `TYPE_MISMATCH` when the value has a different JSON type, and with `DEFAULT` when the flag has no value. The Browser provider reports the selected variant's key as `variant`, and updates the client's context on context changes instead of creating a new client. diff --git a/.changeset/opt-in-set-from-hook.md b/.changeset/opt-in-set-from-hook.md deleted file mode 100644 index 116161d42..000000000 --- a/.changeset/opt-in-set-from-hook.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"@reflag/react-sdk": major -"@reflag/vue-sdk": major -"@reflag/react-native-sdk": major ---- - -`useOptInFlags()` now returns `setOptIn` along with `flags` and `isLoading`. `useSetOptIn()` still works but is deprecated. Opt-in entries now have a Boolean `value` instead of `isEnabled`. The deprecated `useFeature()` alias is removed from React and React Native; use `useFlag()`. diff --git a/.changeset/pre.json b/.changeset/pre.json deleted file mode 100644 index 9b9724ba8..000000000 --- a/.changeset/pre.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "mode": "exit", - "tag": "next", - "initialVersions": { - "@reflag/browser-sdk": "2.0.0-next.0", - "@reflag/cli": "1.0.4", - "@reflag/flag-evaluation": "2.0.0", - "@reflag/management-sdk": "0.1.0", - "customer-admin-panel": "0.0.1", - "@reflag/node-sdk": "2.0.0-next.0", - "@reflag/openfeature-browser-provider": "1.3.17", - "nextjs-openfeature-example": "0.2.0", - "@reflag/openfeature-node-provider": "1.2.8", - "@reflag/react-native-sdk": "2.0.0-next.0", - "reflag-react-native-sdk-bare-rn": "0.0.0", - "reflag-react-sdk-expo": "0.0.0", - "@reflag/react-sdk": "2.0.0-next.0", - "nextjs-bootstrap-demo": "0.2.0", - "nextjs-flag-demo": "0.2.0", - "@reflag/rest-api-sdk": "0.0.6", - "@reflag/tsconfig": "0.0.2", - "@reflag/vue-sdk": "2.0.0-next.0" - }, - "changesets": [ - "bootstrap-public-flags-only", - "browser-framework-collection-values", - "fix-published-workspace-dependencies", - "node-sdk-collection-values", - "react-native-collection-values", - "registered-defaults-cli-v2", - "tidy-dependency-scanning" - ] -} diff --git a/.changeset/react-native-collection-values.md b/.changeset/react-native-collection-values.md deleted file mode 100644 index b15368c15..000000000 --- a/.changeset/react-native-collection-values.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -"@reflag/react-native-sdk": major ---- - -Adopt protocol-v2, adding support for multivariate and JSON flags in React Native. - -- `useFlag()` returns 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, with TypeScript inferring the return type. 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. -- `useFlag()` never suspends. Replace `useFlag(key, { suspense: true })` with `useFlagSuspense(key)` to wait for initialization, and use `useIsLoading()` for loading state. -- Flag reads automatically record checks. Replace flag-level tracking and feedback methods with `useTrack()` and `useSendFeedback()`, using your own Native feedback UI. -- Optional flag typing uses React's `Flags` registration in `@reflag/react-sdk`. Non-null defaults are checked against each registered flag's value type, and named-interface and readonly defaults are supported. Regenerate legacy wrapper-shaped declarations before upgrading. -- Bootstrap data must come from Node SDK v2. Pass the complete payload to `ReflagBootstrappedProvider`; legacy v1 payloads are incompatible. -- AsyncStorage persistence, native live updates and custom storage/SSE adapters remain supported. Live updates are enabled by default; the web toolbar and automatic feedback UI are disabled by default. -- Offline fallbacks accept direct JSON value maps. Arrays of enabled Boolean flag keys remain supported. -- Requires React 17 or later, compatible with your React Native runtime, and matching v2 React/Browser SDKs. - -Legacy wrapper and remote-config types are removed. Legacy remote configuration is not automatically converted into multivariate flag values. diff --git a/.changeset/registered-defaults-cli-v2.md b/.changeset/registered-defaults-cli-v2.md deleted file mode 100644 index dacaf01d8..000000000 --- a/.changeset/registered-defaults-cli-v2.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@reflag/cli": major ---- - -Generate flag types for SDK v2. Boolean flags are typed as `boolean`, and multivariate flags are typed from their values in the production environment. Add type generation for Vue, and update the coding-agent rules for the v2 SDKs. CLI 2.0 works with SDK v2 only; keep using CLI 1.x for apps on SDK v1. diff --git a/.changeset/remove-fallback-flags.md b/.changeset/remove-fallback-flags.md deleted file mode 100644 index e336a351e..000000000 --- a/.changeset/remove-fallback-flags.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -"@reflag/browser-sdk": major -"@reflag/react-sdk": major -"@reflag/vue-sdk": major -"@reflag/react-native-sdk": major -"@reflag/node-sdk": major ---- - -Remove the `fallbackFlags` option. Pass a default to each flag read instead, for example `useFlag("huddles", true)` or `getFlag("model", "quick")`; it's returned whenever the flag has no value. On the server, use a fallback provider to keep evaluating flags when Reflag can't be reached. diff --git a/.changeset/shared-dependency-memoization.md b/.changeset/shared-dependency-memoization.md deleted file mode 100644 index 18d6e498b..000000000 --- a/.changeset/shared-dependency-memoization.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@reflag/flag-evaluation": patch ---- - -Memoize flag and segment results within each evaluation to avoid repeated work in shared dependency graphs. Batch evaluation shares these results across roots, but separate calls and contexts never share cached results. Preserve variant-key matching, rule traces, diagnostic provenance and deduplication, and fail-closed handling of cached dependency errors. diff --git a/.changeset/tidy-dependency-scanning.md b/.changeset/tidy-dependency-scanning.md deleted file mode 100644 index 7f420f61a..000000000 --- a/.changeset/tidy-dependency-scanning.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@reflag/cli": patch ---- - -Update Express and Zod to patched versions. Preserve CLI schema parsing behavior when migrating to Zod 4. diff --git a/packages/browser-sdk/CHANGELOG.md b/packages/browser-sdk/CHANGELOG.md index 45870b79b..ee60427d7 100644 --- a/packages/browser-sdk/CHANGELOG.md +++ b/packages/browser-sdk/CHANGELOG.md @@ -1,5 +1,29 @@ # @reflag/browser-sdk +## 2.0.0 + +### Major Changes + +- 1716cae: Adopt protocol-v2, adding support for multivariate and JSON flags in Browser, React and Vue. + - Browser `getFlag()` and React `useFlag()` return direct values instead of flag wrappers. Vue `useFlag()` returns a ref to the direct value. Replace `.isEnabled` and `.config` access with direct values, using `.value` for Vue refs in script. + - Reads without a default return Booleans, using `false` when unavailable. Pass a positional default to read strings, numbers, arrays, or objects, with TypeScript inferring the return type. 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. + - React and Vue's optional `Flags` registration checks non-null defaults against each flag's value type, including React Suspense reads. Named-interface and readonly defaults are supported across Browser, React and Vue without losing their inferred value types. + - React `useFlag()` never suspends. Replace `useFlag(key, { suspense: true })` with `useFlagSuspense(key)` to wait for initialization. Use `useIsLoading()` for loading state; existing provider and `useOptInFlags` Suspense options continue to control opt-in loading only. + - Flag reads automatically record checks. Replace flag-level `.track()` and `.requestFeedback()` calls with the client's separate methods or the framework's tracking and feedback hooks/composables. + - Browser `getFlags()` returns a record of direct values; unavailable flags may be `undefined`. Use `getFlagResults()` for diagnostic access without recording checks. + - Bootstrap data must come from Node SDK v2 and be consumed by matching v2 SDKs. Legacy v1 payloads are incompatible. Replace the Browser client's `bootstrappedFlags` option with `bootstrappedState` and pass the complete bootstrap payload. + - Overrides accept direct JSON values: `undefined` clears an override, while `null` is a value. Saved v1 caches and overrides are not reused. + - Bootstrapped clients load opt-in metadata when requested, without replacing server-provided flag values. Successful opt-in changes update both membership and flag values. + + Legacy remote configuration is not automatically converted into multivariate flag values. + +- 56bedb7: Opt-in entries from `getOptInFlags()` now have a Boolean `value` instead of `isEnabled`. The deprecated `getFeatures()` alias is removed; use `getFlags()`. +- 7e5d5a8: Remove the `fallbackFlags` option. Pass a default to each flag read instead, for example `useFlag("huddles", true)` or `getFlag("model", "quick")`; it's returned whenever the flag has no value. On the server, use a fallback provider to keep evaluating flags when Reflag can't be reached. + +### Patch Changes + +- c4b6b44: Start automatic feedback surveys when a user ID is first set after the client was created without one, for example with `setContext()` or `updateUser()` after sign-in. Previously, surveys only worked if the client was created with a user. The OpenFeature Browser provider now updates its client's context instead of starting a new client when the first user ID arrives. + ## 2.0.0-next.1 ### Major Changes diff --git a/packages/browser-sdk/package.json b/packages/browser-sdk/package.json index 90bb978ae..17b8b0ea0 100644 --- a/packages/browser-sdk/package.json +++ b/packages/browser-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@reflag/browser-sdk", - "version": "2.0.0-next.1", + "version": "2.0.0", "license": "MIT", "repository": { "type": "git", diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 466cff170..68df2f2dd 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -1,5 +1,18 @@ # @reflag/cli +## 2.0.0 + +### Major Changes + +- 0fe8795: Generate flag types for SDK v2. Boolean flags are typed as `boolean`, and multivariate flags are typed from their values in the production environment. Add type generation for Vue, and update the coding-agent rules for the v2 SDKs. CLI 2.0 works with SDK v2 only; keep using CLI 1.x for apps on SDK v1. + +### Patch Changes + +- e438bad: Fix app discovery for users who belong to multiple organizations. `reflag apps list` shows each app's organization, `reflag init` lets you choose an organization, and existing configs resolve their `appId` without requiring an `orgId`. Use `orgId` or `--org-id` to restrict the CLI to one organization. API keys remain scoped to their app. +- 347d4d5: The coding-agent rules no longer say the OpenFeature providers use SDK v1. +- efc1695: Rewrite the coding-agent rules from `reflag rules` in plain language, cover React Native, and note that `fallbackFlags` is replaced by read defaults. +- 1adfced: Update Express and Zod to patched versions. Preserve CLI schema parsing behavior when migrating to Zod 4. + ## 2.0.0-next.1 ### Major Changes diff --git a/packages/cli/package.json b/packages/cli/package.json index 561387f1f..a25c5e39d 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@reflag/cli", - "version": "2.0.0-next.1", + "version": "2.0.0", "description": "CLI for Reflag service", "homepage": "https://docs.reflag.com/", "license": "MIT", diff --git a/packages/flag-evaluation/CHANGELOG.md b/packages/flag-evaluation/CHANGELOG.md index 7a74def8d..1972f99c8 100644 --- a/packages/flag-evaluation/CHANGELOG.md +++ b/packages/flag-evaluation/CHANGELOG.md @@ -1,5 +1,11 @@ # @reflag/flag-evaluation +## 2.0.1 + +### Patch Changes + +- a1bd963: Memoize flag and segment results within each evaluation to avoid repeated work in shared dependency graphs. Batch evaluation shares these results across roots, but separate calls and contexts never share cached results. Preserve variant-key matching, rule traces, diagnostic provenance and deduplication, and fail-closed handling of cached dependency errors. + ## 2.0.0 ### Major Changes diff --git a/packages/flag-evaluation/package.json b/packages/flag-evaluation/package.json index 687d9925b..ed9d38776 100644 --- a/packages/flag-evaluation/package.json +++ b/packages/flag-evaluation/package.json @@ -1,6 +1,6 @@ { "name": "@reflag/flag-evaluation", - "version": "2.0.0", + "version": "2.0.1", "license": "MIT", "repository": { "type": "git", diff --git a/packages/node-sdk/CHANGELOG.md b/packages/node-sdk/CHANGELOG.md index e82ed4989..d2f0ab743 100644 --- a/packages/node-sdk/CHANGELOG.md +++ b/packages/node-sdk/CHANGELOG.md @@ -1,5 +1,32 @@ # @reflag/node-sdk +## 2.0.0 + +### Major Changes + +- 521de2f: 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. + + Legacy remote configuration is not automatically converted into multivariate flag values. + +- 7e5d5a8: Remove the `fallbackFlags` option. Pass a default to each flag read instead, for example `useFlag("huddles", true)` or `getFlag("model", "quick")`; it's returned whenever the flag has no value. On the server, use a fallback provider to keep evaluating flags when Reflag can't be reached. + +### Patch Changes + +- 49355be: Keep secret flags out of browser data returned by `getFlagsForBootstrap()`, including bound clients. Server-side reads still work, including public flags that depend on secret flags. Remove dependency names from error details sent to the browser. +- 9654308: Replace workspace-only dependency ranges with registry-compatible versions so the published SDKs can be installed outside the monorepo. Keep local workspace linking and the existing v1 OpenFeature dependencies unchanged. +- Updated dependencies [a1bd963] + - @reflag/flag-evaluation@2.0.1 + ## 2.0.0-next.3 ### Patch Changes diff --git a/packages/node-sdk/package.json b/packages/node-sdk/package.json index 39a19d248..d4af0eb99 100644 --- a/packages/node-sdk/package.json +++ b/packages/node-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@reflag/node-sdk", - "version": "2.0.0-next.3", + "version": "2.0.0", "license": "MIT", "repository": { "type": "git", @@ -35,7 +35,7 @@ "@aws-sdk/client-s3": "^3.888.0", "@googleapis/storage": "21.2.0", "@redis/client": "^5.11.0", - "@reflag/flag-evaluation": "2.0.0" + "@reflag/flag-evaluation": "2.0.1" }, "devDependencies": { "@babel/core": "~7.29.6", diff --git a/packages/openfeature-browser-provider/CHANGELOG.md b/packages/openfeature-browser-provider/CHANGELOG.md index 650aabd98..bd5516c9f 100644 --- a/packages/openfeature-browser-provider/CHANGELOG.md +++ b/packages/openfeature-browser-provider/CHANGELOG.md @@ -1,5 +1,20 @@ # @reflag/openfeature-browser-provider +## 2.0.0 + +### Major Changes + +- 347d4d5: Use Reflag SDK v2. Boolean flags resolve with `getBooleanValue()`, and multivariate flags resolve with the method that matches their value's type: `getStringValue()`, `getNumberValue()` or `getObjectValue()`. String and object reads no longer return a Boolean flag's Remote config key or payload; move Remote config to a multivariate flag first. Number reads now work. A read returns your default with `TYPE_MISMATCH` when the value has a different JSON type, and with `DEFAULT` when the flag has no value. The Browser provider reports the selected variant's key as `variant`, and updates the client's context on context changes instead of creating a new client. + +### Patch Changes + +- c4b6b44: Start automatic feedback surveys when a user ID is first set after the client was created without one, for example with `setContext()` or `updateUser()` after sign-in. Previously, surveys only worked if the client was created with a user. The OpenFeature Browser provider now updates its client's context instead of starting a new client when the first user ID arrives. +- Updated dependencies [c4b6b44] +- Updated dependencies [1716cae] +- Updated dependencies [56bedb7] +- Updated dependencies [7e5d5a8] + - @reflag/browser-sdk@2.0.0 + ## 1.3.17 ### Patch Changes diff --git a/packages/openfeature-browser-provider/package.json b/packages/openfeature-browser-provider/package.json index 51819f01d..fac2286b6 100644 --- a/packages/openfeature-browser-provider/package.json +++ b/packages/openfeature-browser-provider/package.json @@ -1,6 +1,6 @@ { "name": "@reflag/openfeature-browser-provider", - "version": "1.3.17", + "version": "2.0.0", "license": "MIT", "repository": { "type": "git", @@ -36,7 +36,7 @@ "fmt:fix": "oxfmt --write ." }, "dependencies": { - "@reflag/browser-sdk": "^2.0.0-next.1" + "@reflag/browser-sdk": "^2.0.0" }, "devDependencies": { "@openfeature/core": "1.5.0", diff --git a/packages/openfeature-node-provider/CHANGELOG.md b/packages/openfeature-node-provider/CHANGELOG.md index c4f53adcc..7f3da42f2 100644 --- a/packages/openfeature-node-provider/CHANGELOG.md +++ b/packages/openfeature-node-provider/CHANGELOG.md @@ -1,5 +1,34 @@ # @reflag/openfeature-node-provider +## 2.0.0 + +### Major Changes + +- 347d4d5: Use Reflag SDK v2. Boolean flags resolve with `getBooleanValue()`, and multivariate flags resolve with the method that matches their value's type: `getStringValue()`, `getNumberValue()` or `getObjectValue()`. String and object reads no longer return a Boolean flag's Remote config key or payload; move Remote config to a multivariate flag first. Number reads now work. A read returns your default with `TYPE_MISMATCH` when the value has a different JSON type, and with `DEFAULT` when the flag has no value. The Browser provider reports the selected variant's key as `variant`, and updates the client's context on context changes instead of creating a new client. + +### Patch Changes + +- 521de2f: 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. + + Legacy remote configuration is not automatically converted into multivariate flag values. + +- c0dd5ec: Allow ES modules to import the Node.js OpenFeature provider through its existing CommonJS build. CommonJS imports and TypeScript declarations are unchanged. +- Updated dependencies [49355be] +- Updated dependencies [9654308] +- Updated dependencies [521de2f] +- Updated dependencies [7e5d5a8] + - @reflag/node-sdk@2.0.0 + ## 1.2.9-next.0 ### Patch Changes diff --git a/packages/openfeature-node-provider/package.json b/packages/openfeature-node-provider/package.json index cf39adfa8..c0eb27c4e 100644 --- a/packages/openfeature-node-provider/package.json +++ b/packages/openfeature-node-provider/package.json @@ -1,6 +1,6 @@ { "name": "@reflag/openfeature-node-provider", - "version": "1.2.9-next.0", + "version": "2.0.0", "license": "MIT", "repository": { "type": "git", @@ -37,7 +37,7 @@ "fmt:fix": "oxfmt --write ." }, "dependencies": { - "@reflag/node-sdk": "^2.0.0-next.3" + "@reflag/node-sdk": "^2.0.0" }, "devDependencies": { "@babel/core": "~7.29.6", diff --git a/packages/react-native-sdk/CHANGELOG.md b/packages/react-native-sdk/CHANGELOG.md index b6f8a10bd..09a05478f 100644 --- a/packages/react-native-sdk/CHANGELOG.md +++ b/packages/react-native-sdk/CHANGELOG.md @@ -1,5 +1,34 @@ # @reflag/react-native-sdk +## 2.0.0 + +### Major Changes + +- 56bedb7: `useOptInFlags()` now returns `setOptIn` along with `flags` and `isLoading`. `useSetOptIn()` still works but is deprecated. Opt-in entries now have a Boolean `value` instead of `isEnabled`. The deprecated `useFeature()` alias is removed from React and React Native; use `useFlag()`. +- 1716cae: Adopt protocol-v2, adding support for multivariate and JSON flags in React Native. + - `useFlag()` returns 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, with TypeScript inferring the return type. 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. + - `useFlag()` never suspends. Replace `useFlag(key, { suspense: true })` with `useFlagSuspense(key)` to wait for initialization, and use `useIsLoading()` for loading state. + - Flag reads automatically record checks. Replace flag-level tracking and feedback methods with `useTrack()` and `useSendFeedback()`, using your own Native feedback UI. + - Optional flag typing uses React's `Flags` registration in `@reflag/react-sdk`. Non-null defaults are checked against each registered flag's value type, and named-interface and readonly defaults are supported. Regenerate legacy wrapper-shaped declarations before upgrading. + - Bootstrap data must come from Node SDK v2. Pass the complete payload to `ReflagBootstrappedProvider`; legacy v1 payloads are incompatible. + - AsyncStorage persistence, native live updates and custom storage/SSE adapters remain supported. Live updates are enabled by default; the web toolbar and automatic feedback UI are disabled by default. + - Offline fallbacks accept direct JSON value maps. Arrays of enabled Boolean flag keys remain supported. + - Requires React 17 or later, compatible with your React Native runtime, and matching v2 React/Browser SDKs. + + Legacy wrapper and remote-config types are removed. Legacy remote configuration is not automatically converted into multivariate flag values. + +- 7e5d5a8: Remove the `fallbackFlags` option. Pass a default to each flag read instead, for example `useFlag("huddles", true)` or `getFlag("model", "quick")`; it's returned whenever the flag has no value. On the server, use a fallback provider to keep evaluating flags when Reflag can't be reached. + +### Patch Changes + +- 9654308: Replace workspace-only dependency ranges with registry-compatible versions so the published SDKs can be installed outside the monorepo. Keep local workspace linking and the existing v1 OpenFeature dependencies unchanged. +- Updated dependencies [1716cae] +- Updated dependencies [9654308] +- Updated dependencies [56bedb7] +- Updated dependencies [7e5d5a8] + - @reflag/react-sdk@2.0.0 + ## 2.0.0-next.2 ### Patch Changes diff --git a/packages/react-native-sdk/package.json b/packages/react-native-sdk/package.json index 8c89b7449..0169f74af 100644 --- a/packages/react-native-sdk/package.json +++ b/packages/react-native-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@reflag/react-native-sdk", - "version": "2.0.0-next.2", + "version": "2.0.0", "license": "MIT", "repository": { "type": "git", @@ -37,11 +37,11 @@ }, "dependencies": { "@react-native-async-storage/async-storage": "^2.2.0", - "@reflag/react-sdk": "^2.0.0-next.2", + "@reflag/react-sdk": "^2.0.0", "react-native-sse": "^1.2.1" }, "devDependencies": { - "@reflag/node-sdk": "2.0.0-next.3", + "@reflag/node-sdk": "2.0.0", "@reflag/tsconfig": "^0.0.2", "@types/node": "^22.12.0", "@types/react": "^19.0.12", diff --git a/packages/react-sdk/CHANGELOG.md b/packages/react-sdk/CHANGELOG.md index 3450469bb..cce94b1e3 100644 --- a/packages/react-sdk/CHANGELOG.md +++ b/packages/react-sdk/CHANGELOG.md @@ -1,5 +1,34 @@ # @reflag/react-sdk +## 2.0.0 + +### Major Changes + +- 1716cae: Adopt protocol-v2, adding support for multivariate and JSON flags in Browser, React and Vue. + - Browser `getFlag()` and React `useFlag()` return direct values instead of flag wrappers. Vue `useFlag()` returns a ref to the direct value. Replace `.isEnabled` and `.config` access with direct values, using `.value` for Vue refs in script. + - Reads without a default return Booleans, using `false` when unavailable. Pass a positional default to read strings, numbers, arrays, or objects, with TypeScript inferring the return type. 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. + - React and Vue's optional `Flags` registration checks non-null defaults against each flag's value type, including React Suspense reads. Named-interface and readonly defaults are supported across Browser, React and Vue without losing their inferred value types. + - React `useFlag()` never suspends. Replace `useFlag(key, { suspense: true })` with `useFlagSuspense(key)` to wait for initialization. Use `useIsLoading()` for loading state; existing provider and `useOptInFlags` Suspense options continue to control opt-in loading only. + - Flag reads automatically record checks. Replace flag-level `.track()` and `.requestFeedback()` calls with the client's separate methods or the framework's tracking and feedback hooks/composables. + - Browser `getFlags()` returns a record of direct values; unavailable flags may be `undefined`. Use `getFlagResults()` for diagnostic access without recording checks. + - Bootstrap data must come from Node SDK v2 and be consumed by matching v2 SDKs. Legacy v1 payloads are incompatible. Replace the Browser client's `bootstrappedFlags` option with `bootstrappedState` and pass the complete bootstrap payload. + - Overrides accept direct JSON values: `undefined` clears an override, while `null` is a value. Saved v1 caches and overrides are not reused. + - Bootstrapped clients load opt-in metadata when requested, without replacing server-provided flag values. Successful opt-in changes update both membership and flag values. + + Legacy remote configuration is not automatically converted into multivariate flag values. + +- 56bedb7: `useOptInFlags()` now returns `setOptIn` along with `flags` and `isLoading`. `useSetOptIn()` still works but is deprecated. Opt-in entries now have a Boolean `value` instead of `isEnabled`. The deprecated `useFeature()` alias is removed from React and React Native; use `useFlag()`. +- 7e5d5a8: Remove the `fallbackFlags` option. Pass a default to each flag read instead, for example `useFlag("huddles", true)` or `getFlag("model", "quick")`; it's returned whenever the flag has no value. On the server, use a fallback provider to keep evaluating flags when Reflag can't be reached. + +### Patch Changes + +- 9654308: Replace workspace-only dependency ranges with registry-compatible versions so the published SDKs can be installed outside the monorepo. Keep local workspace linking and the existing v1 OpenFeature dependencies unchanged. +- Updated dependencies [c4b6b44] +- Updated dependencies [1716cae] +- Updated dependencies [56bedb7] +- Updated dependencies [7e5d5a8] + - @reflag/browser-sdk@2.0.0 + ## 2.0.0-next.2 ### Patch Changes diff --git a/packages/react-sdk/package.json b/packages/react-sdk/package.json index 1b2d3d7f5..c8f89cf5d 100644 --- a/packages/react-sdk/package.json +++ b/packages/react-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@reflag/react-sdk", - "version": "2.0.0-next.2", + "version": "2.0.0", "license": "MIT", "repository": { "type": "git", @@ -40,7 +40,7 @@ "fmt:fix": "oxfmt --write ." }, "dependencies": { - "@reflag/browser-sdk": "^2.0.0-next.1", + "@reflag/browser-sdk": "^2.0.0", "fast-equals": "^5.2.2" }, "devDependencies": { diff --git a/packages/vue-sdk/CHANGELOG.md b/packages/vue-sdk/CHANGELOG.md index b3c14fdaf..2fc240aaf 100644 --- a/packages/vue-sdk/CHANGELOG.md +++ b/packages/vue-sdk/CHANGELOG.md @@ -1,5 +1,34 @@ # @reflag/vue-sdk +## 2.0.0 + +### Major Changes + +- 1716cae: Adopt protocol-v2, adding support for multivariate and JSON flags in Browser, React and Vue. + - Browser `getFlag()` and React `useFlag()` return direct values instead of flag wrappers. Vue `useFlag()` returns a ref to the direct value. Replace `.isEnabled` and `.config` access with direct values, using `.value` for Vue refs in script. + - Reads without a default return Booleans, using `false` when unavailable. Pass a positional default to read strings, numbers, arrays, or objects, with TypeScript inferring the return type. 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. + - React and Vue's optional `Flags` registration checks non-null defaults against each flag's value type, including React Suspense reads. Named-interface and readonly defaults are supported across Browser, React and Vue without losing their inferred value types. + - React `useFlag()` never suspends. Replace `useFlag(key, { suspense: true })` with `useFlagSuspense(key)` to wait for initialization. Use `useIsLoading()` for loading state; existing provider and `useOptInFlags` Suspense options continue to control opt-in loading only. + - Flag reads automatically record checks. Replace flag-level `.track()` and `.requestFeedback()` calls with the client's separate methods or the framework's tracking and feedback hooks/composables. + - Browser `getFlags()` returns a record of direct values; unavailable flags may be `undefined`. Use `getFlagResults()` for diagnostic access without recording checks. + - Bootstrap data must come from Node SDK v2 and be consumed by matching v2 SDKs. Legacy v1 payloads are incompatible. Replace the Browser client's `bootstrappedFlags` option with `bootstrappedState` and pass the complete bootstrap payload. + - Overrides accept direct JSON values: `undefined` clears an override, while `null` is a value. Saved v1 caches and overrides are not reused. + - Bootstrapped clients load opt-in metadata when requested, without replacing server-provided flag values. Successful opt-in changes update both membership and flag values. + + Legacy remote configuration is not automatically converted into multivariate flag values. + +- 56bedb7: `useOptInFlags()` now returns `setOptIn` along with `flags` and `isLoading`. `useSetOptIn()` still works but is deprecated. Opt-in entries now have a Boolean `value` instead of `isEnabled`. The deprecated `useFeature()` alias is removed from React and React Native; use `useFlag()`. +- 7e5d5a8: Remove the `fallbackFlags` option. Pass a default to each flag read instead, for example `useFlag("huddles", true)` or `getFlag("model", "quick")`; it's returned whenever the flag has no value. On the server, use a fallback provider to keep evaluating flags when Reflag can't be reached. + +### Patch Changes + +- 9654308: Replace workspace-only dependency ranges with registry-compatible versions so the published SDKs can be installed outside the monorepo. Keep local workspace linking and the existing v1 OpenFeature dependencies unchanged. +- Updated dependencies [c4b6b44] +- Updated dependencies [1716cae] +- Updated dependencies [56bedb7] +- Updated dependencies [7e5d5a8] + - @reflag/browser-sdk@2.0.0 + ## 2.0.0-next.2 ### Patch Changes diff --git a/packages/vue-sdk/package.json b/packages/vue-sdk/package.json index 1c9c8836c..aa8e605c3 100644 --- a/packages/vue-sdk/package.json +++ b/packages/vue-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@reflag/vue-sdk", - "version": "2.0.0-next.2", + "version": "2.0.0", "license": "MIT", "repository": { "type": "git", @@ -38,7 +38,7 @@ "fmt:fix": "oxfmt --write ." }, "dependencies": { - "@reflag/browser-sdk": "^2.0.0-next.1" + "@reflag/browser-sdk": "^2.0.0" }, "devDependencies": { "@reflag/tsconfig": "^0.0.2", diff --git a/yarn.lock b/yarn.lock index fc829ca09..065720840 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6050,7 +6050,7 @@ __metadata: languageName: node linkType: hard -"@reflag/browser-sdk@npm:^2.0.0-next.1, @reflag/browser-sdk@workspace:packages/browser-sdk": +"@reflag/browser-sdk@npm:^2.0.0, @reflag/browser-sdk@workspace:packages/browser-sdk": version: 0.0.0-use.local resolution: "@reflag/browser-sdk@workspace:packages/browser-sdk" dependencies: @@ -6119,7 +6119,7 @@ __metadata: languageName: node linkType: hard -"@reflag/flag-evaluation@npm:2.0.0, @reflag/flag-evaluation@workspace:packages/flag-evaluation": +"@reflag/flag-evaluation@npm:2.0.1, @reflag/flag-evaluation@workspace:packages/flag-evaluation": version: 0.0.0-use.local resolution: "@reflag/flag-evaluation@workspace:packages/flag-evaluation" dependencies: @@ -6162,7 +6162,7 @@ __metadata: languageName: unknown linkType: soft -"@reflag/node-sdk@npm:2.0.0-next.3, @reflag/node-sdk@npm:^2.0.0-next.3, @reflag/node-sdk@workspace:*, @reflag/node-sdk@workspace:^, @reflag/node-sdk@workspace:packages/node-sdk": +"@reflag/node-sdk@npm:2.0.0, @reflag/node-sdk@npm:^2.0.0, @reflag/node-sdk@workspace:*, @reflag/node-sdk@workspace:^, @reflag/node-sdk@workspace:packages/node-sdk": version: 0.0.0-use.local resolution: "@reflag/node-sdk@workspace:packages/node-sdk" dependencies: @@ -6170,7 +6170,7 @@ __metadata: "@babel/core": "npm:~7.29.6" "@googleapis/storage": "npm:21.2.0" "@redis/client": "npm:^5.11.0" - "@reflag/flag-evaluation": "npm:2.0.0" + "@reflag/flag-evaluation": "npm:2.0.1" "@reflag/tsconfig": "npm:~0.0.2" "@types/node": "npm:^22.12.0" "@vitest/coverage-v8": "npm:4.1.12" @@ -6190,7 +6190,7 @@ __metadata: dependencies: "@openfeature/core": "npm:1.5.0" "@openfeature/web-sdk": "npm:^1.3.0" - "@reflag/browser-sdk": "npm:^2.0.0-next.1" + "@reflag/browser-sdk": "npm:^2.0.0" "@reflag/tsconfig": "npm:0.0.2" "@types/node": "npm:^22.12.0" jsdom: "npm:^24.1.0" @@ -6210,7 +6210,7 @@ __metadata: "@babel/core": "npm:~7.29.6" "@openfeature/core": "npm:^1.5.0" "@openfeature/server-sdk": "npm:>=1.16.1" - "@reflag/node-sdk": "npm:^2.0.0-next.3" + "@reflag/node-sdk": "npm:^2.0.0" "@reflag/tsconfig": "npm:~0.0.2" "@types/node": "npm:^22.12.0" flush-promises: "npm:~1.0.2" @@ -6229,8 +6229,8 @@ __metadata: resolution: "@reflag/react-native-sdk@workspace:packages/react-native-sdk" dependencies: "@react-native-async-storage/async-storage": "npm:^2.2.0" - "@reflag/node-sdk": "npm:2.0.0-next.3" - "@reflag/react-sdk": "npm:^2.0.0-next.2" + "@reflag/node-sdk": "npm:2.0.0" + "@reflag/react-sdk": "npm:^2.0.0" "@reflag/tsconfig": "npm:^0.0.2" "@types/node": "npm:^22.12.0" "@types/react": "npm:^19.0.12" @@ -6245,11 +6245,11 @@ __metadata: languageName: unknown linkType: soft -"@reflag/react-sdk@npm:^2.0.0-next.2, @reflag/react-sdk@workspace:^, @reflag/react-sdk@workspace:packages/react-sdk": +"@reflag/react-sdk@npm:^2.0.0, @reflag/react-sdk@workspace:^, @reflag/react-sdk@workspace:packages/react-sdk": version: 0.0.0-use.local resolution: "@reflag/react-sdk@workspace:packages/react-sdk" dependencies: - "@reflag/browser-sdk": "npm:^2.0.0-next.1" + "@reflag/browser-sdk": "npm:^2.0.0" "@reflag/tsconfig": "npm:^0.0.2" "@testing-library/react": "npm:^15.0.7" "@types/jsdom": "npm:^21.1.6" @@ -6299,7 +6299,7 @@ __metadata: version: 0.0.0-use.local resolution: "@reflag/vue-sdk@workspace:packages/vue-sdk" dependencies: - "@reflag/browser-sdk": "npm:^2.0.0-next.1" + "@reflag/browser-sdk": "npm:^2.0.0" "@reflag/tsconfig": "npm:^0.0.2" "@types/jsdom": "npm:^21.1.6" "@types/node": "npm:^22.12.0"