Skip to content

Commit 0809be2

Browse files
committed
Merge origin/main into feature/node-sdk-v2
Keep published evaluator 2.0.0 and main's dependency updates, port ETag revalidation and initialization diagnostics to complete collections, preserve application-owned shutdown, and address the three Node migration review regressions. Keep OpenFeature and the v1 bootstrap demo isolated on published Node 1.8.3.
2 parents 595758d + 1adfced commit 0809be2

139 files changed

Lines changed: 10163 additions & 12471 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.changeset/multivariate-evaluation.md‎

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@reflag/cli": patch
3+
---
4+
5+
Update Express and Zod to patched versions. Preserve CLI schema parsing behavior when migrating to Zod 4.

‎.github/dependabot.yml‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
version: 2
2+
updates:
3+
# All Yarn workspaces share this lockfile. Do not add workspace directories:
4+
# manifest-only updates there fail the root immutable installation.
5+
- package-ecosystem: npm
6+
directory: /
7+
schedule:
8+
interval: weekly
9+
# Keep automated updates security-only, without adding routine version PRs.
10+
open-pull-requests-limit: 0
11+
groups:
12+
vitest:
13+
applies-to: security-updates
14+
patterns:
15+
- vitest
16+
- "@vitest/*"
17+
18+
# These examples are standalone projects with their own lockfiles.
19+
- package-ecosystem: npm
20+
directory: /packages/node-sdk/examples/cloudflare-worker
21+
schedule:
22+
interval: weekly
23+
open-pull-requests-limit: 0
24+
25+
- package-ecosystem: npm
26+
directory: /packages/openfeature-node-provider/example
27+
schedule:
28+
interval: weekly
29+
open-pull-requests-limit: 0

‎.github/workflows/package-ci.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ jobs:
4040
- id: test
4141
name: Test the project
4242
run: yarn test:ci
43+
- name: Check standalone examples
44+
run: |
45+
for example in packages/node-sdk/examples/cloudflare-worker packages/openfeature-node-provider/example; do
46+
(cd "$example" && yarn install --immutable && yarn build && yarn test:ci)
47+
done
4348
- name: Report test results
4449
uses: dorny/test-reporter@v1.6.0
4550
with:

‎.nvmrc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
24.13.0
1+
24.22.0

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ Client side React SDK
88

99
[Read the docs](packages/react-sdk/README.md)
1010

11-
## React Native SDK (beta)
11+
## React Native SDK
1212

1313
React Native SDK for mobile apps
1414

1515
[Read the docs](packages/react-native-sdk/README.md)
1616

17-
## Vue SDK (beta)
17+
## Vue SDK
1818

1919
Client side Vue SDK
2020

@@ -33,7 +33,7 @@ Use this for Cloudflare Workers as well.
3333

3434
[Read the docs](packages/node-sdk/README.md)
3535

36-
## Management SDK (beta)
36+
## Management SDK
3737

3838
Typed SDK for Reflag's REST API.
3939

‎docs.sh‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ do
2828
sed -r "$SEDCOMMAND" "$file" > "$file.fixed"
2929
rm "$file"
3030
mv "$file.fixed" "$file"
31+
node ./scripts/fix-opt-in-docs.mjs "$file"
3132
fi
3233

3334
# Create a temporary file for processing

‎package.json‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"devDependencies": {
3333
"@changesets/cli": "^2.29.6",
3434
"husky": "^9.1.7",
35-
"lerna": "^8.1.3",
35+
"lerna": "^10.1.1",
3636
"lint-staged": "^16.2.7",
3737
"oxfmt": "^0.27.0",
3838
"oxlint": "^1.42.0",
@@ -45,8 +45,13 @@
4545
"typescript": "^5.7.3"
4646
},
4747
"resolutions": {
48+
"minimatch@npm:9.0.1": "npm:9.0.9",
49+
"postcss@npm:8.4.31": "npm:8.5.32",
50+
"postcss@npm:~8.4.32": "npm:8.5.32",
4851
"react": "19.1.0",
49-
"react-dom": "19.1.0"
52+
"react-dom": "19.1.0",
53+
"tinypool@npm:2.0.0": "npm:2.2.0",
54+
"undici@npm:7.29.0": "npm:7.30.2"
5055
},
5156
"lint-staged": {
5257
"*.{ts,tsx,js,jsx,mjs,cjs,mts,cts,vue}": [

‎packages/browser-sdk/CHANGELOG.md‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# @reflag/browser-sdk
22

3+
## 1.7.4
4+
5+
### Patch Changes
6+
7+
- 0840683: Avoid reporting `CLIENT_NOT_INITIALIZED` when a flag is evaluated from the initial flag state while client initialization is completing.
8+
9+
## 1.7.3
10+
11+
### Patch Changes
12+
13+
- e8a0e10: Unsubscribe toolbar flag listeners when the toolbar is unmounted or switches clients.
14+
15+
## 1.7.2
16+
17+
### Patch Changes
18+
19+
- 4649418: Preserve the response body returned by `setOptIn()` on HTTP errors so callers can read error details. Clarify opt-in loading, retry, and mutation result handling in the SDK documentation.
20+
21+
## 1.7.1
22+
23+
### Patch Changes
24+
25+
- df37a58: Include non-fatal flag evaluation diagnostics in check events sent by the Node, browser, React, and Vue SDKs, including when flags are evaluated before client initialization.
26+
327
## 1.7.0
428

529
### Minor Changes

‎packages/browser-sdk/README.md‎

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -212,30 +212,37 @@ If a flag has end-user opt-in enabled in Reflag, you can list the opt-in options
212212

213213
```ts
214214
const optInFlags = reflagClient.getOptInFlags();
215-
const isLoadingOptInFlags = reflagClient.getIsLoadingOptInFlags();
216215
// [{ key, name, description, isEnabled, userOptedIn, companyOptedIn, isOptedIn }]
217216

218-
await reflagClient.setOptIn("huddle", { optedIn: true });
219-
await reflagClient.setOptIn("huddle", { optedIn: false });
220-
221-
await reflagClient.setOptIn("huddle", {
222-
optedIn: true,
223-
scope: "company",
224-
});
217+
try {
218+
const response = await reflagClient.setOptIn("huddle", {
219+
optedIn: true, // Use false to cancel this scope's opt-in.
220+
scope: "user", // Use "company" to change the current company's opt-in.
221+
});
222+
if (!response?.ok) {
223+
console.error("Could not update opt-in");
224+
}
225+
} catch (error) {
226+
console.error("Could not update opt-in", error);
227+
}
225228
```
226229

227230
By default, `setOptIn()` changes the opt-in for the current user, so the current context must include a `user.id`. To manage the current company's opt-in instead, pass `scope: "company"`; the context must then include a `company.id`.
228231

229232
User and company opt-ins are managed independently. Setting `optedIn` to `false` removes the opt-in only for the selected scope. For example, cancelling a user's opt-in does not change the company's opt-in for the same flag.
230233

231-
`setOptIn` returns a promise so you can wait for the new membership state to be synchronized. It resolves after the latest flag state has been applied locally, the requested membership change has been confirmed, and `flagsUpdated` listeners have been notified.
234+
`setOptIn` returns a promise so you can wait for the new membership state to be synchronized. On success, it resolves after the refreshed flag state has been applied locally, the requested membership change has been confirmed, and `flagsUpdated` listeners have been notified when flags change.
235+
236+
The promise resolves to a `Response`, or `undefined` if skipped due to invalid input, offline mode etc. Check `response?.ok` for success.
232237

233238
The `description` comes from the dedicated SDK-facing opt-in description configured in Reflag.
234239

235-
For a bootstrapped client, the first `getOptInFlags()` or `getIsLoadingOptInFlags()` call starts one flags refresh. The list call returns the currently available list synchronously, and the loading getter returns `true` until the refresh succeeds or fails. Normal initialization already exposes loading through the client's state.
240+
When using bootstrapped flags, the first `getOptInFlags()` or `getIsLoadingOptInFlags()` call requests a flags refresh. The list call returns the currently available list synchronously, and the loading getter returns `true` until that refresh succeeds or fails. Normal initialization also exposes loading through the client's state.
236241

237242
Listen for `optInFlagsLoadingUpdated` to update UI when this loading state changes. `flagsUpdated` is emitted when a successful refresh updates the list.
238243

244+
If fetching opt-in metadata fails, loading ends without exposing an error. Call `reflagClient.refresh()` to retry.
245+
239246
## Remote config
240247

241248
Remote config is a dynamic and flexible approach to configuring flag behavior outside of your app – without needing to re-deploy it.
@@ -358,6 +365,8 @@ const client = new ReflagClient({
358365

359366
> [!NOTE]
360367
> After bootstrapping, any live flag updates are fetched directly by the browser SDK from Reflag using the browser-visible context. If your bootstrapped snapshot depends on server-only or secret context that is not available in the browser, later live refreshes may differ. In that case, keep `enableLiveFlagUpdates` disabled.
368+
>
369+
> Requesting opt-in flags also triggers a browser-side refresh, even when `enableLiveFlagUpdates` is disabled.
361370
362371
This eliminates loading states and removes the initial render's dependency on the flags API.
363372

0 commit comments

Comments
 (0)