@vercel/flags-core 1.10.3 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +12 -0
- package/dist/{chunk-2P2UTT7O.js → chunk-755SFCGD.js} +23 -5
- package/dist/chunk-755SFCGD.js.map +1 -0
- package/dist/{chunk-BEQ3MX7Z.cjs → chunk-EMMJNPVW.cjs} +23 -5
- package/dist/chunk-EMMJNPVW.cjs.map +1 -0
- package/dist/{chunk-OIOT7N7A.js → chunk-OI7WI6QP.js} +23 -5
- package/dist/chunk-OI7WI6QP.js.map +1 -0
- package/dist/{chunk-EGGUENXP.cjs → chunk-SDWWHUKB.cjs} +23 -5
- package/dist/chunk-SDWWHUKB.cjs.map +1 -0
- package/dist/index.default.cjs +2 -2
- package/dist/index.default.d.cts +6 -0
- package/dist/index.default.d.ts +6 -0
- package/dist/index.default.js +1 -1
- package/dist/index.next-js.cjs +2 -2
- package/dist/index.next-js.d.cts +6 -0
- package/dist/index.next-js.d.ts +6 -0
- package/dist/index.next-js.js +1 -1
- package/dist/openfeature.default.cjs +2 -2
- package/dist/openfeature.default.js +1 -1
- package/dist/openfeature.next-js.cjs +2 -2
- package/dist/openfeature.next-js.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2P2UTT7O.js.map +0 -1
- package/dist/chunk-BEQ3MX7Z.cjs.map +0 -1
- package/dist/chunk-EGGUENXP.cjs.map +0 -1
- package/dist/chunk-OIOT7N7A.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @vercel/flags-core
|
|
2
2
|
|
|
3
|
+
## 1.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#539](https://github.com/vercel/flags/pull/539) [`24983f9`](https://github.com/vercel/flags/commit/24983f90eec9789fbed1a7a556d41070218aecb6) Thanks [@vincent-derks](https://github.com/vincent-derks)! - Prepare for upcoming Vercel Flags Project Connections with a new `projectId` option.
|
|
8
|
+
|
|
3
9
|
## 1.10.3
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -33,6 +33,18 @@ export default app;
|
|
|
33
33
|
|
|
34
34
|
Outside Vercel, pass an SDK key explicitly: `createClient(process.env.FLAGS)`.
|
|
35
35
|
|
|
36
|
+
### Read a connected project's flags
|
|
37
|
+
|
|
38
|
+
Grant your project access from the source project's **Flags → Connections** page, then create a client with the source project's ID:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
const sharedClient = createClient({ projectId: 'prj_source' });
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The client uses your project's OIDC token. Both projects must belong to the same team. Connections apply across environments; the token selects the source environment, with custom environments mapped to preview. Run `vercel env pull` in your project for local development. The `projectId` option cannot be combined with an SDK key.
|
|
45
|
+
|
|
46
|
+
See [Project Connections](https://vercel.com/docs/flags/vercel-flags/project-connections) for permissions and setup.
|
|
47
|
+
|
|
36
48
|
## Header-driven reads on Vercel
|
|
37
49
|
|
|
38
50
|
When `VERCEL=1`, the client defaults to `vercel: true`. Initialization loads provided
|
|
@@ -576,7 +576,7 @@ function bulkEvaluate(flags, shared) {
|
|
|
576
576
|
}
|
|
577
577
|
|
|
578
578
|
// package.json
|
|
579
|
-
var version = "1.
|
|
579
|
+
var version = "1.11.0";
|
|
580
580
|
|
|
581
581
|
// src/lib/report-value.ts
|
|
582
582
|
function internalReportValue(key, value, data) {
|
|
@@ -1080,6 +1080,10 @@ import { getVercelOidcToken } from "@vercel/oidc";
|
|
|
1080
1080
|
|
|
1081
1081
|
// src/utils/sdk-keys.ts
|
|
1082
1082
|
var SDK_KEY_REGEX = /^vf_(?:server|client)_/;
|
|
1083
|
+
var PROJECT_ID_REGEX = /^[A-Za-z0-9_]{1,64}$/;
|
|
1084
|
+
function isValidProjectId(value) {
|
|
1085
|
+
return PROJECT_ID_REGEX.test(value);
|
|
1086
|
+
}
|
|
1083
1087
|
function parseSdkKeyFromFlagsConnectionString(text) {
|
|
1084
1088
|
if (SDK_KEY_REGEX.test(text)) return text;
|
|
1085
1089
|
try {
|
|
@@ -1146,7 +1150,21 @@ function getProjectIdFromOidcToken(oidcToken) {
|
|
|
1146
1150
|
var Authentication = class {
|
|
1147
1151
|
sdkKey;
|
|
1148
1152
|
sourceProjectId;
|
|
1149
|
-
constructor(sdkKeyOrConnectionString) {
|
|
1153
|
+
constructor(sdkKeyOrConnectionString, options = {}) {
|
|
1154
|
+
if (options.projectId !== void 0) {
|
|
1155
|
+
if (typeof options.projectId !== "string" || !isValidProjectId(options.projectId)) {
|
|
1156
|
+
throw new Error(
|
|
1157
|
+
`@vercel/flags-core: Invalid projectId "${options.projectId}". Expected a project id like "prj_\u2026" (letters, digits and underscores, up to 64 characters)`
|
|
1158
|
+
);
|
|
1159
|
+
}
|
|
1160
|
+
if (sdkKeyOrConnectionString !== void 0) {
|
|
1161
|
+
throw new Error(
|
|
1162
|
+
"@vercel/flags-core: projectId cannot be combined with an SDK key. Connected projects are read with the OIDC token of this deployment."
|
|
1163
|
+
);
|
|
1164
|
+
}
|
|
1165
|
+
this.sourceProjectId = options.projectId;
|
|
1166
|
+
return;
|
|
1167
|
+
}
|
|
1150
1168
|
if (sdkKeyOrConnectionString !== void 0) {
|
|
1151
1169
|
if (typeof sdkKeyOrConnectionString !== "string") {
|
|
1152
1170
|
throw new Error(
|
|
@@ -3721,8 +3739,8 @@ function make(createRawClient, defaults) {
|
|
|
3721
3739
|
const optionsOnly = typeof sdkKeyOrConnectionStringOrOptions === "object" && sdkKeyOrConnectionStringOrOptions !== null;
|
|
3722
3740
|
const sdkKeyOrConnectionString = optionsOnly ? void 0 : sdkKeyOrConnectionStringOrOptions;
|
|
3723
3741
|
const createClientOptions = optionsOnly ? sdkKeyOrConnectionStringOrOptions : options;
|
|
3724
|
-
const { experimental_reportExposures, ...controllerOptions } = createClientOptions ?? {};
|
|
3725
|
-
const auth = new Authentication(sdkKeyOrConnectionString);
|
|
3742
|
+
const { experimental_reportExposures, projectId, ...controllerOptions } = createClientOptions ?? {};
|
|
3743
|
+
const auth = new Authentication(sdkKeyOrConnectionString, { projectId });
|
|
3726
3744
|
const waitUntil3 = controllerOptions.waitUntil ?? defaults.waitUntil;
|
|
3727
3745
|
const controller = new Controller({
|
|
3728
3746
|
auth,
|
|
@@ -3787,4 +3805,4 @@ export {
|
|
|
3787
3805
|
resetDefaultFlagsClient,
|
|
3788
3806
|
createClient
|
|
3789
3807
|
};
|
|
3790
|
-
//# sourceMappingURL=chunk-
|
|
3808
|
+
//# sourceMappingURL=chunk-755SFCGD.js.map
|