@breadstone/archipel-platform-feature-flags 0.0.32
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/README.md +10 -0
- package/package.json +100 -0
- package/src/FeatureFlagModule.d.ts +20 -0
- package/src/FeatureFlagModule.js +59 -0
- package/src/azure/AzureFeatureFlagReader.d.ts +46 -0
- package/src/azure/AzureFeatureFlagReader.js +190 -0
- package/src/azure/AzureFeatureFlagWriter.d.ts +43 -0
- package/src/azure/AzureFeatureFlagWriter.js +231 -0
- package/src/azure/env.d.ts +11 -0
- package/src/azure/env.js +44 -0
- package/src/azure/index.d.ts +3 -0
- package/src/azure/index.js +14 -0
- package/src/contracts/FeatureFlagReaderPort.d.ts +54 -0
- package/src/contracts/FeatureFlagReaderPort.js +27 -0
- package/src/contracts/FeatureFlagWriterPort.d.ts +64 -0
- package/src/contracts/FeatureFlagWriterPort.js +31 -0
- package/src/contracts/index.d.ts +2 -0
- package/src/contracts/index.js +8 -0
- package/src/decorators/FeatureFlag.d.ts +11 -0
- package/src/decorators/FeatureFlag.js +18 -0
- package/src/decorators/index.d.ts +1 -0
- package/src/decorators/index.js +7 -0
- package/src/env.d.ts +5 -0
- package/src/env.js +35 -0
- package/src/errors/FeatureFlagError.d.ts +10 -0
- package/src/errors/FeatureFlagError.js +21 -0
- package/src/errors/index.d.ts +1 -0
- package/src/errors/index.js +6 -0
- package/src/guards/FeatureFlagGuard.d.ts +30 -0
- package/src/guards/FeatureFlagGuard.js +69 -0
- package/src/guards/index.d.ts +1 -0
- package/src/guards/index.js +6 -0
- package/src/index.d.ts +11 -0
- package/src/index.js +19 -0
- package/src/models/IFeatureFlagContext.d.ts +13 -0
- package/src/models/IFeatureFlagContext.js +3 -0
- package/src/models/IFeatureFlagDefinition.d.ts +17 -0
- package/src/models/IFeatureFlagDefinition.js +3 -0
- package/src/models/IFeatureFlagEvaluation.d.ts +13 -0
- package/src/models/IFeatureFlagEvaluation.js +3 -0
- package/src/models/IFeatureFlagModuleOptions.d.ts +30 -0
- package/src/models/IFeatureFlagModuleOptions.js +4 -0
- package/src/models/index.d.ts +4 -0
- package/src/models/index.js +3 -0
- package/src/vercel/VercelFeatureFlagReader.d.ts +54 -0
- package/src/vercel/VercelFeatureFlagReader.js +158 -0
- package/src/vercel/VercelFeatureFlagWriter.d.ts +71 -0
- package/src/vercel/VercelFeatureFlagWriter.js +308 -0
- package/src/vercel/env.d.ts +17 -0
- package/src/vercel/env.js +69 -0
- package/src/vercel/index.d.ts +3 -0
- package/src/vercel/index.js +17 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
var VercelFeatureFlagWriter_1;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.VercelFeatureFlagWriter = void 0;
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
const archipel_platform_configuration_1 = require("@breadstone/archipel-platform-configuration");
|
|
8
|
+
const common_1 = require("@nestjs/common");
|
|
9
|
+
const FeatureFlagWriterPort_1 = require("../contracts/FeatureFlagWriterPort");
|
|
10
|
+
const FeatureFlagError_1 = require("../errors/FeatureFlagError");
|
|
11
|
+
const env_1 = require("./env");
|
|
12
|
+
// #endregion
|
|
13
|
+
/** Base URL for the Vercel REST API. */
|
|
14
|
+
const VERCEL_API_BASE = 'https://api.vercel.com';
|
|
15
|
+
/** Default prefix for feature flag keys in Edge Config. */
|
|
16
|
+
const DEFAULT_FLAG_PREFIX = 'featureFlags';
|
|
17
|
+
/** Default request timeout in milliseconds. */
|
|
18
|
+
const DEFAULT_TIMEOUT_MS = 3_000;
|
|
19
|
+
/**
|
|
20
|
+
* Vercel Edge Config implementation of the {@link FeatureFlagWriterPort}.
|
|
21
|
+
* Uses the Vercel REST API to manage feature flags stored in a Vercel Edge Config store.
|
|
22
|
+
*
|
|
23
|
+
* @remarks
|
|
24
|
+
* The Vercel admin client stores feature flags as a single object under the configured
|
|
25
|
+
* prefix key (default: `featureFlags`). Each flag key maps to a {@link IFeatureFlagDefinition}
|
|
26
|
+
* serialized as JSON.
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
let VercelFeatureFlagWriter = VercelFeatureFlagWriter_1 = class VercelFeatureFlagWriter extends FeatureFlagWriterPort_1.FeatureFlagWriterPort {
|
|
31
|
+
// #endregion
|
|
32
|
+
// #region Ctor
|
|
33
|
+
constructor(configService) {
|
|
34
|
+
super();
|
|
35
|
+
this._logger = new common_1.Logger(VercelFeatureFlagWriter_1.name);
|
|
36
|
+
this._flagPrefix = DEFAULT_FLAG_PREFIX;
|
|
37
|
+
this._configService = configService;
|
|
38
|
+
}
|
|
39
|
+
// #endregion
|
|
40
|
+
// #region Methods
|
|
41
|
+
/**
|
|
42
|
+
* Initializes the Vercel admin client by reading configuration.
|
|
43
|
+
*
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
|
+
async onModuleInit() {
|
|
47
|
+
try {
|
|
48
|
+
this._apiToken = this._configService.get(env_1.VERCEL_API_TOKEN.key);
|
|
49
|
+
this._edgeConfigId = this._configService.get(env_1.VERCEL_EDGE_CONFIG_ID.key);
|
|
50
|
+
this._teamId = this._configService.get(env_1.VERCEL_TEAM_ID.key);
|
|
51
|
+
this._flagPrefix = this._configService.get(env_1.VERCEL_FEATURE_FLAG_PREFIX.key) ?? DEFAULT_FLAG_PREFIX;
|
|
52
|
+
if (!this._apiToken) {
|
|
53
|
+
throw new FeatureFlagError_1.FeatureFlagError('vercel', 'VERCEL_API_TOKEN must be configured for the Vercel admin client.');
|
|
54
|
+
}
|
|
55
|
+
if (!this._edgeConfigId) {
|
|
56
|
+
throw new FeatureFlagError_1.FeatureFlagError('vercel', 'VERCEL_EDGE_CONFIG_ID must be configured for the Vercel admin client.');
|
|
57
|
+
}
|
|
58
|
+
this._logger.log('[VercelFeatureFlagWriter] Initialized successfully');
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
if (error instanceof FeatureFlagError_1.FeatureFlagError) {
|
|
62
|
+
throw error;
|
|
63
|
+
}
|
|
64
|
+
throw new FeatureFlagError_1.FeatureFlagError('vercel', 'Failed to initialize Vercel admin client', error);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/** @inheritdoc */
|
|
68
|
+
async getFlag(key) {
|
|
69
|
+
this.ensureInitialized();
|
|
70
|
+
try {
|
|
71
|
+
const flags = await this.readFlagsFromEdgeConfig();
|
|
72
|
+
if (!flags || !(key in flags)) {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
return this.toDefinition(key, flags[key]);
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
if (error instanceof FeatureFlagError_1.FeatureFlagError) {
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
this._logger.error(`[VercelFeatureFlagWriter] getFlag failed for "${key}"`, {
|
|
82
|
+
key,
|
|
83
|
+
error: error.message,
|
|
84
|
+
});
|
|
85
|
+
throw new FeatureFlagError_1.FeatureFlagError('vercel', `Failed to get feature flag "${key}"`, error);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** @inheritdoc */
|
|
89
|
+
async listFlags() {
|
|
90
|
+
this.ensureInitialized();
|
|
91
|
+
try {
|
|
92
|
+
const flags = await this.readFlagsFromEdgeConfig();
|
|
93
|
+
if (!flags) {
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
return Object.entries(flags).map(([key, value]) => this.toDefinition(key, value));
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
if (error instanceof FeatureFlagError_1.FeatureFlagError) {
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
102
|
+
this._logger.error('[VercelFeatureFlagWriter] listFlags failed', {
|
|
103
|
+
error: error.message,
|
|
104
|
+
});
|
|
105
|
+
throw new FeatureFlagError_1.FeatureFlagError('vercel', 'Failed to list feature flags', error);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/** @inheritdoc */
|
|
109
|
+
async createFlag(definition) {
|
|
110
|
+
this.ensureInitialized();
|
|
111
|
+
try {
|
|
112
|
+
const flags = (await this.readFlagsFromEdgeConfig()) ?? {};
|
|
113
|
+
if (definition.key in flags) {
|
|
114
|
+
throw new FeatureFlagError_1.FeatureFlagError('vercel', `Feature flag "${definition.key}" already exists.`);
|
|
115
|
+
}
|
|
116
|
+
flags[definition.key] = this.toStoredValue(definition);
|
|
117
|
+
await this.writeFlagsToEdgeConfig(flags);
|
|
118
|
+
this._logger.log(`[VercelFeatureFlagWriter] Created flag "${definition.key}"`);
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
if (error instanceof FeatureFlagError_1.FeatureFlagError) {
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
124
|
+
this._logger.error(`[VercelFeatureFlagWriter] createFlag failed for "${definition.key}"`, {
|
|
125
|
+
key: definition.key,
|
|
126
|
+
error: error.message,
|
|
127
|
+
});
|
|
128
|
+
throw new FeatureFlagError_1.FeatureFlagError('vercel', `Failed to create feature flag "${definition.key}"`, error);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/** @inheritdoc */
|
|
132
|
+
async updateFlag(key, updates) {
|
|
133
|
+
this.ensureInitialized();
|
|
134
|
+
try {
|
|
135
|
+
const flags = (await this.readFlagsFromEdgeConfig()) ?? {};
|
|
136
|
+
if (!(key in flags)) {
|
|
137
|
+
throw new FeatureFlagError_1.FeatureFlagError('vercel', `Feature flag "${key}" does not exist.`);
|
|
138
|
+
}
|
|
139
|
+
const existing = this.toDefinition(key, flags[key]);
|
|
140
|
+
const updated = {
|
|
141
|
+
key,
|
|
142
|
+
enabled: updates.enabled ?? existing.enabled,
|
|
143
|
+
description: updates.description ?? existing.description,
|
|
144
|
+
label: updates.label ?? existing.label,
|
|
145
|
+
variant: updates.variant ?? existing.variant,
|
|
146
|
+
};
|
|
147
|
+
flags[key] = this.toStoredValue(updated);
|
|
148
|
+
await this.writeFlagsToEdgeConfig(flags);
|
|
149
|
+
this._logger.log(`[VercelFeatureFlagWriter] Updated flag "${key}"`);
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
if (error instanceof FeatureFlagError_1.FeatureFlagError) {
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
this._logger.error(`[VercelFeatureFlagWriter] updateFlag failed for "${key}"`, {
|
|
156
|
+
key,
|
|
157
|
+
error: error.message,
|
|
158
|
+
});
|
|
159
|
+
throw new FeatureFlagError_1.FeatureFlagError('vercel', `Failed to update feature flag "${key}"`, error);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/** @inheritdoc */
|
|
163
|
+
async deleteFlag(key) {
|
|
164
|
+
this.ensureInitialized();
|
|
165
|
+
try {
|
|
166
|
+
const flags = (await this.readFlagsFromEdgeConfig()) ?? {};
|
|
167
|
+
if (!(key in flags)) {
|
|
168
|
+
throw new FeatureFlagError_1.FeatureFlagError('vercel', `Feature flag "${key}" does not exist.`);
|
|
169
|
+
}
|
|
170
|
+
delete flags[key];
|
|
171
|
+
await this.writeFlagsToEdgeConfig(flags);
|
|
172
|
+
this._logger.log(`[VercelFeatureFlagWriter] Deleted flag "${key}"`);
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
if (error instanceof FeatureFlagError_1.FeatureFlagError) {
|
|
176
|
+
throw error;
|
|
177
|
+
}
|
|
178
|
+
this._logger.error(`[VercelFeatureFlagWriter] deleteFlag failed for "${key}"`, {
|
|
179
|
+
key,
|
|
180
|
+
error: error.message,
|
|
181
|
+
});
|
|
182
|
+
throw new FeatureFlagError_1.FeatureFlagError('vercel', `Failed to delete feature flag "${key}"`, error);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/** @inheritdoc */
|
|
186
|
+
async ping() {
|
|
187
|
+
try {
|
|
188
|
+
this.ensureInitialized();
|
|
189
|
+
await this.readFlagsFromEdgeConfig();
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Reads the current flags object from Edge Config via the Vercel REST API.
|
|
198
|
+
*/
|
|
199
|
+
async readFlagsFromEdgeConfig() {
|
|
200
|
+
const url = this.buildUrl(`/v1/edge-config/${this._edgeConfigId}/item/${this._flagPrefix}`);
|
|
201
|
+
const response = await this.request(url, 'GET');
|
|
202
|
+
if (response.status === 404) {
|
|
203
|
+
return undefined;
|
|
204
|
+
}
|
|
205
|
+
if (!response.ok) {
|
|
206
|
+
throw new FeatureFlagError_1.FeatureFlagError('vercel', `Failed to read Edge Config (HTTP ${response.status}): ${await response.text()}`);
|
|
207
|
+
}
|
|
208
|
+
const body = (await response.json());
|
|
209
|
+
return body.value ?? undefined;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Writes the flags object to Edge Config via the Vercel REST API.
|
|
213
|
+
*/
|
|
214
|
+
async writeFlagsToEdgeConfig(flags) {
|
|
215
|
+
const url = this.buildUrl(`/v1/edge-config/${this._edgeConfigId}/items`);
|
|
216
|
+
const response = await this.request(url, 'PATCH', {
|
|
217
|
+
items: [
|
|
218
|
+
{
|
|
219
|
+
operation: 'upsert',
|
|
220
|
+
key: this._flagPrefix,
|
|
221
|
+
value: flags,
|
|
222
|
+
},
|
|
223
|
+
],
|
|
224
|
+
});
|
|
225
|
+
if (!response.ok) {
|
|
226
|
+
throw new FeatureFlagError_1.FeatureFlagError('vercel', `Failed to write Edge Config (HTTP ${response.status}): ${await response.text()}`);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Builds a full Vercel API URL, appending the team ID query parameter if configured.
|
|
231
|
+
*/
|
|
232
|
+
buildUrl(path) {
|
|
233
|
+
const url = new URL(path, VERCEL_API_BASE);
|
|
234
|
+
if (this._teamId) {
|
|
235
|
+
url.searchParams.set('teamId', this._teamId);
|
|
236
|
+
}
|
|
237
|
+
return url.toString();
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Performs an HTTP request to the Vercel REST API with timeout and authorization.
|
|
241
|
+
*/
|
|
242
|
+
async request(url, method, body) {
|
|
243
|
+
const controller = new AbortController();
|
|
244
|
+
const timeout = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT_MS);
|
|
245
|
+
try {
|
|
246
|
+
return await fetch(url, {
|
|
247
|
+
method,
|
|
248
|
+
headers: {
|
|
249
|
+
Authorization: `Bearer ${this._apiToken}`,
|
|
250
|
+
'Content-Type': 'application/json',
|
|
251
|
+
},
|
|
252
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
253
|
+
signal: controller.signal,
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
finally {
|
|
257
|
+
clearTimeout(timeout);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Converts a stored value into an {@link IFeatureFlagDefinition}.
|
|
262
|
+
*/
|
|
263
|
+
toDefinition(key, value) {
|
|
264
|
+
if (typeof value === 'boolean') {
|
|
265
|
+
return { key, enabled: value };
|
|
266
|
+
}
|
|
267
|
+
if (typeof value === 'object' && value !== null) {
|
|
268
|
+
const obj = value;
|
|
269
|
+
return {
|
|
270
|
+
key,
|
|
271
|
+
enabled: Boolean(obj['enabled'] ?? true),
|
|
272
|
+
description: typeof obj['description'] === 'string' ? obj['description'] : undefined,
|
|
273
|
+
label: typeof obj['label'] === 'string' ? obj['label'] : undefined,
|
|
274
|
+
variant: obj['variant'],
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
return { key, enabled: Boolean(value) };
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Converts an {@link IFeatureFlagDefinition} into the stored value shape.
|
|
281
|
+
* Simple boolean flags are stored as booleans; flags with metadata are stored as objects.
|
|
282
|
+
*/
|
|
283
|
+
toStoredValue(definition) {
|
|
284
|
+
if (!definition.description && !definition.label && definition.variant === undefined) {
|
|
285
|
+
return definition.enabled;
|
|
286
|
+
}
|
|
287
|
+
return {
|
|
288
|
+
enabled: definition.enabled,
|
|
289
|
+
description: definition.description,
|
|
290
|
+
label: definition.label,
|
|
291
|
+
variant: definition.variant,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Ensures the admin client has been initialized.
|
|
296
|
+
*/
|
|
297
|
+
ensureInitialized() {
|
|
298
|
+
if (!this._apiToken || !this._edgeConfigId) {
|
|
299
|
+
throw new FeatureFlagError_1.FeatureFlagError('vercel', 'VercelFeatureFlagWriter has not been initialized. Ensure onModuleInit() ran.');
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
exports.VercelFeatureFlagWriter = VercelFeatureFlagWriter;
|
|
304
|
+
exports.VercelFeatureFlagWriter = VercelFeatureFlagWriter = VercelFeatureFlagWriter_1 = tslib_1.__decorate([
|
|
305
|
+
(0, common_1.Injectable)(),
|
|
306
|
+
tslib_1.__metadata("design:paramtypes", [archipel_platform_configuration_1.ConfigService])
|
|
307
|
+
], VercelFeatureFlagWriter);
|
|
308
|
+
//# sourceMappingURL=VercelFeatureFlagWriter.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type IConfigRegistryEntry } from '@breadstone/archipel-platform-configuration';
|
|
2
|
+
/** Vercel Edge Config connection string (includes store ID and token). */
|
|
3
|
+
export declare const VERCEL_EDGE_CONFIG: import("@breadstone/archipel-platform-configuration").IConfigKey<string>;
|
|
4
|
+
/** Optional: Vercel Edge Config read access token (when not embedded in connection string). */
|
|
5
|
+
export declare const VERCEL_EDGE_CONFIG_TOKEN: import("@breadstone/archipel-platform-configuration").IConfigKey<string>;
|
|
6
|
+
/** Optional: Prefix for feature flag keys in Edge Config. Defaults to `featureFlags`. */
|
|
7
|
+
export declare const VERCEL_FEATURE_FLAG_PREFIX: import("@breadstone/archipel-platform-configuration").IConfigKey<string>;
|
|
8
|
+
/** Vercel API token with write access to Edge Config. Required for write operations. */
|
|
9
|
+
export declare const VERCEL_API_TOKEN: import("@breadstone/archipel-platform-configuration").IConfigKey<string>;
|
|
10
|
+
/** Vercel Edge Config store ID. Required for write operations. */
|
|
11
|
+
export declare const VERCEL_EDGE_CONFIG_ID: import("@breadstone/archipel-platform-configuration").IConfigKey<string>;
|
|
12
|
+
/** Optional: Vercel Team ID for team-scoped API calls. */
|
|
13
|
+
export declare const VERCEL_TEAM_ID: import("@breadstone/archipel-platform-configuration").IConfigKey<string>;
|
|
14
|
+
/** Configuration entries required by the Vercel feature flag provider (read-only). */
|
|
15
|
+
export declare const VERCEL_FEATURE_FLAG_CONFIG_ENTRIES: ReadonlyArray<Omit<IConfigRegistryEntry, 'module'>>;
|
|
16
|
+
/** Configuration entries required by the Vercel feature flag writer provider. */
|
|
17
|
+
export declare const VERCEL_FEATURE_FLAG_WRITER_CONFIG_ENTRIES: ReadonlyArray<Omit<IConfigRegistryEntry, 'module'>>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.VERCEL_FEATURE_FLAG_WRITER_CONFIG_ENTRIES = exports.VERCEL_FEATURE_FLAG_CONFIG_ENTRIES = exports.VERCEL_TEAM_ID = exports.VERCEL_EDGE_CONFIG_ID = exports.VERCEL_API_TOKEN = exports.VERCEL_FEATURE_FLAG_PREFIX = exports.VERCEL_EDGE_CONFIG_TOKEN = exports.VERCEL_EDGE_CONFIG = void 0;
|
|
5
|
+
const archipel_platform_configuration_1 = require("@breadstone/archipel-platform-configuration");
|
|
6
|
+
// #endregion
|
|
7
|
+
// ──────────────────────────────────────────────────────────────
|
|
8
|
+
// Vercel Edge Config
|
|
9
|
+
// ──────────────────────────────────────────────────────────────
|
|
10
|
+
/** Vercel Edge Config connection string (includes store ID and token). */
|
|
11
|
+
exports.VERCEL_EDGE_CONFIG = (0, archipel_platform_configuration_1.createConfigKey)('EDGE_CONFIG');
|
|
12
|
+
/** Optional: Vercel Edge Config read access token (when not embedded in connection string). */
|
|
13
|
+
exports.VERCEL_EDGE_CONFIG_TOKEN = (0, archipel_platform_configuration_1.createConfigKey)('VERCEL_EDGE_CONFIG_TOKEN');
|
|
14
|
+
/** Optional: Prefix for feature flag keys in Edge Config. Defaults to `featureFlags`. */
|
|
15
|
+
exports.VERCEL_FEATURE_FLAG_PREFIX = (0, archipel_platform_configuration_1.createConfigKey)('VERCEL_FEATURE_FLAG_PREFIX');
|
|
16
|
+
// ──────────────────────────────────────────────────────────────
|
|
17
|
+
// Vercel Edge Config Writer
|
|
18
|
+
// ──────────────────────────────────────────────────────────────
|
|
19
|
+
/** Vercel API token with write access to Edge Config. Required for write operations. */
|
|
20
|
+
exports.VERCEL_API_TOKEN = (0, archipel_platform_configuration_1.createConfigKey)('VERCEL_API_TOKEN');
|
|
21
|
+
/** Vercel Edge Config store ID. Required for write operations. */
|
|
22
|
+
exports.VERCEL_EDGE_CONFIG_ID = (0, archipel_platform_configuration_1.createConfigKey)('VERCEL_EDGE_CONFIG_ID');
|
|
23
|
+
/** Optional: Vercel Team ID for team-scoped API calls. */
|
|
24
|
+
exports.VERCEL_TEAM_ID = (0, archipel_platform_configuration_1.createConfigKey)('VERCEL_TEAM_ID');
|
|
25
|
+
// ──────────────────────────────────────────────────────────────
|
|
26
|
+
// Registry entries
|
|
27
|
+
// ──────────────────────────────────────────────────────────────
|
|
28
|
+
/** Configuration entries required by the Vercel feature flag provider (read-only). */
|
|
29
|
+
exports.VERCEL_FEATURE_FLAG_CONFIG_ENTRIES = [
|
|
30
|
+
{
|
|
31
|
+
key: exports.VERCEL_EDGE_CONFIG,
|
|
32
|
+
required: true,
|
|
33
|
+
description: 'Vercel Edge Config connection string.',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
key: exports.VERCEL_EDGE_CONFIG_TOKEN,
|
|
37
|
+
required: false,
|
|
38
|
+
description: 'Vercel Edge Config read access token (when not embedded in connection string).',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
key: exports.VERCEL_FEATURE_FLAG_PREFIX,
|
|
42
|
+
required: false,
|
|
43
|
+
description: 'Prefix for feature flag keys in Edge Config. Defaults to featureFlags.',
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
/** Configuration entries required by the Vercel feature flag writer provider. */
|
|
47
|
+
exports.VERCEL_FEATURE_FLAG_WRITER_CONFIG_ENTRIES = [
|
|
48
|
+
{
|
|
49
|
+
key: exports.VERCEL_API_TOKEN,
|
|
50
|
+
required: true,
|
|
51
|
+
description: 'Vercel API token with write access to Edge Config.',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
key: exports.VERCEL_EDGE_CONFIG_ID,
|
|
55
|
+
required: true,
|
|
56
|
+
description: 'Vercel Edge Config store ID.',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
key: exports.VERCEL_TEAM_ID,
|
|
60
|
+
required: false,
|
|
61
|
+
description: 'Vercel Team ID for team-scoped API calls.',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
key: exports.VERCEL_FEATURE_FLAG_PREFIX,
|
|
65
|
+
required: false,
|
|
66
|
+
description: 'Prefix for feature flag keys in Edge Config. Defaults to featureFlags.',
|
|
67
|
+
},
|
|
68
|
+
];
|
|
69
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { VERCEL_API_TOKEN, VERCEL_EDGE_CONFIG, VERCEL_EDGE_CONFIG_ID, VERCEL_EDGE_CONFIG_TOKEN, VERCEL_FEATURE_FLAG_CONFIG_ENTRIES, VERCEL_FEATURE_FLAG_PREFIX, VERCEL_FEATURE_FLAG_WRITER_CONFIG_ENTRIES, VERCEL_TEAM_ID, } from './env';
|
|
2
|
+
export { VercelFeatureFlagReader } from './VercelFeatureFlagReader';
|
|
3
|
+
export { VercelFeatureFlagWriter } from './VercelFeatureFlagWriter';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VercelFeatureFlagWriter = exports.VercelFeatureFlagReader = exports.VERCEL_TEAM_ID = exports.VERCEL_FEATURE_FLAG_WRITER_CONFIG_ENTRIES = exports.VERCEL_FEATURE_FLAG_PREFIX = exports.VERCEL_FEATURE_FLAG_CONFIG_ENTRIES = exports.VERCEL_EDGE_CONFIG_TOKEN = exports.VERCEL_EDGE_CONFIG_ID = exports.VERCEL_EDGE_CONFIG = exports.VERCEL_API_TOKEN = void 0;
|
|
4
|
+
var env_1 = require("./env");
|
|
5
|
+
Object.defineProperty(exports, "VERCEL_API_TOKEN", { enumerable: true, get: function () { return env_1.VERCEL_API_TOKEN; } });
|
|
6
|
+
Object.defineProperty(exports, "VERCEL_EDGE_CONFIG", { enumerable: true, get: function () { return env_1.VERCEL_EDGE_CONFIG; } });
|
|
7
|
+
Object.defineProperty(exports, "VERCEL_EDGE_CONFIG_ID", { enumerable: true, get: function () { return env_1.VERCEL_EDGE_CONFIG_ID; } });
|
|
8
|
+
Object.defineProperty(exports, "VERCEL_EDGE_CONFIG_TOKEN", { enumerable: true, get: function () { return env_1.VERCEL_EDGE_CONFIG_TOKEN; } });
|
|
9
|
+
Object.defineProperty(exports, "VERCEL_FEATURE_FLAG_CONFIG_ENTRIES", { enumerable: true, get: function () { return env_1.VERCEL_FEATURE_FLAG_CONFIG_ENTRIES; } });
|
|
10
|
+
Object.defineProperty(exports, "VERCEL_FEATURE_FLAG_PREFIX", { enumerable: true, get: function () { return env_1.VERCEL_FEATURE_FLAG_PREFIX; } });
|
|
11
|
+
Object.defineProperty(exports, "VERCEL_FEATURE_FLAG_WRITER_CONFIG_ENTRIES", { enumerable: true, get: function () { return env_1.VERCEL_FEATURE_FLAG_WRITER_CONFIG_ENTRIES; } });
|
|
12
|
+
Object.defineProperty(exports, "VERCEL_TEAM_ID", { enumerable: true, get: function () { return env_1.VERCEL_TEAM_ID; } });
|
|
13
|
+
var VercelFeatureFlagReader_1 = require("./VercelFeatureFlagReader");
|
|
14
|
+
Object.defineProperty(exports, "VercelFeatureFlagReader", { enumerable: true, get: function () { return VercelFeatureFlagReader_1.VercelFeatureFlagReader; } });
|
|
15
|
+
var VercelFeatureFlagWriter_1 = require("./VercelFeatureFlagWriter");
|
|
16
|
+
Object.defineProperty(exports, "VercelFeatureFlagWriter", { enumerable: true, get: function () { return VercelFeatureFlagWriter_1.VercelFeatureFlagWriter; } });
|
|
17
|
+
//# sourceMappingURL=index.js.map
|