Skip to content

Commit 1961a6a

Browse files
Version Packages (#48)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 14353e1 commit 1961a6a

File tree

4 files changed

+47
-47
lines changed

4 files changed

+47
-47
lines changed

.changeset/few-wombats-reply.md

-14
This file was deleted.

.changeset/light-shirts-fix.md

-32
This file was deleted.

packages/flags/CHANGELOG.md

+46
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,51 @@
11
# @vercel/flags
22

3+
## 3.1.0
4+
5+
### Minor Changes
6+
7+
- 76feb16: Add `mergeProviderData` function to `@vercel/flags`.
8+
9+
This function allows merging ProviderData from multiple sources.
10+
11+
This is handy when you declare feature flags in code, and want to extend those definitions with data loaded from your feature flag provider.
12+
13+
```ts
14+
import { verifyAccess, mergeProviderData, type ApiData } from '@vercel/flags';
15+
import { getProviderData } from '@vercel/flags/next';
16+
import { NextResponse, type NextRequest } from 'next/server';
17+
import { getProviderData as getStatsigProviderData } from '@flags-sdk/statsig';
18+
import * as flagsA from '../../../../flags-a'; // your feature flags file(s)
19+
import * as flagsB from '../../../../flags-b'; // your feature flags file(s)
20+
21+
export async function GET(request: NextRequest) {
22+
const access = await verifyAccess(request.headers.get('Authorization'));
23+
if (!access) return NextResponse.json(null, { status: 401 });
24+
25+
const providerData = await mergeProviderData([
26+
// expose flags declared in code first
27+
getProviderData({ ...flagsA, ...flagsB }),
28+
// then enhance them with metadata from your flag provider
29+
getStatsigProviderData({ consoleApiKey: '', projectId: '' }),
30+
]);
31+
32+
return NextResponse.json<ApiData>(providerData);
33+
}
34+
```
35+
36+
### Patch Changes
37+
38+
- 2713ea7: Handle `undefined` values
39+
40+
- fix: Fall back to `defaultValue` when a feature flag returns `undefined`
41+
- fix: Throw error when a flag resolves to `undefined` and no `defaultValue` is present
42+
43+
The value `undefined` can not be serialized so feature flags should never resolve to `undefined`. Use `null` instead.
44+
45+
Fix exports
46+
47+
- fix: Export `Identify` and `Decide` types
48+
349
## 3.0.2
450

551
### Patch Changes

packages/flags/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vercel/flags",
3-
"version": "3.0.2",
3+
"version": "3.1.0",
44
"description": "Flags SDK by Vercel - The feature flags toolkit for Next.js and SvelteKit",
55
"keywords": [
66
"feature flags",

0 commit comments

Comments
 (0)