@cloudflare/workers-types 4.20260408.1 → 4.20260409.1
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/2021-11-03/index.d.ts +140 -0
- package/2021-11-03/index.ts +140 -0
- package/2022-01-31/index.d.ts +140 -0
- package/2022-01-31/index.ts +140 -0
- package/2022-03-21/index.d.ts +140 -0
- package/2022-03-21/index.ts +140 -0
- package/2022-08-04/index.d.ts +140 -0
- package/2022-08-04/index.ts +140 -0
- package/2022-10-31/index.d.ts +140 -0
- package/2022-10-31/index.ts +140 -0
- package/2022-11-30/index.d.ts +140 -0
- package/2022-11-30/index.ts +140 -0
- package/2023-03-01/index.d.ts +140 -0
- package/2023-03-01/index.ts +140 -0
- package/2023-07-01/index.d.ts +140 -0
- package/2023-07-01/index.ts +140 -0
- package/experimental/index.d.ts +140 -0
- package/experimental/index.ts +140 -0
- package/index.d.ts +140 -0
- package/index.ts +140 -0
- package/latest/index.d.ts +140 -0
- package/latest/index.ts +140 -0
- package/oldest/index.d.ts +140 -0
- package/oldest/index.ts +140 -0
- package/package.json +1 -1
package/latest/index.d.ts
CHANGED
|
@@ -12065,6 +12065,140 @@ declare module "cloudflare:email" {
|
|
|
12065
12065
|
};
|
|
12066
12066
|
export { _EmailMessage as EmailMessage };
|
|
12067
12067
|
}
|
|
12068
|
+
/**
|
|
12069
|
+
* Evaluation context for targeting rules.
|
|
12070
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
12071
|
+
*/
|
|
12072
|
+
type EvaluationContext = Record<string, string | number | boolean>;
|
|
12073
|
+
interface EvaluationDetails<T> {
|
|
12074
|
+
flagKey: string;
|
|
12075
|
+
value: T;
|
|
12076
|
+
variant?: string | undefined;
|
|
12077
|
+
reason?: string | undefined;
|
|
12078
|
+
errorCode?: string | undefined;
|
|
12079
|
+
errorMessage?: string | undefined;
|
|
12080
|
+
}
|
|
12081
|
+
interface FlagEvaluationError extends Error {}
|
|
12082
|
+
/**
|
|
12083
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
12084
|
+
*
|
|
12085
|
+
* @example
|
|
12086
|
+
* ```typescript
|
|
12087
|
+
* // Get a boolean flag value with a default
|
|
12088
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
12089
|
+
*
|
|
12090
|
+
* // Get a flag value with evaluation context for targeting
|
|
12091
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
12092
|
+
* userId: 'user-123',
|
|
12093
|
+
* country: 'US',
|
|
12094
|
+
* });
|
|
12095
|
+
*
|
|
12096
|
+
* // Get full evaluation details including variant and reason
|
|
12097
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
12098
|
+
* console.log(details.variant, details.reason);
|
|
12099
|
+
* ```
|
|
12100
|
+
*/
|
|
12101
|
+
declare abstract class Flags {
|
|
12102
|
+
/**
|
|
12103
|
+
* Get a flag value without type checking.
|
|
12104
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12105
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
12106
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12107
|
+
*/
|
|
12108
|
+
get(
|
|
12109
|
+
flagKey: string,
|
|
12110
|
+
defaultValue?: unknown,
|
|
12111
|
+
context?: EvaluationContext,
|
|
12112
|
+
): Promise<unknown>;
|
|
12113
|
+
/**
|
|
12114
|
+
* Get a boolean flag value.
|
|
12115
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12116
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12117
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12118
|
+
*/
|
|
12119
|
+
getBooleanValue(
|
|
12120
|
+
flagKey: string,
|
|
12121
|
+
defaultValue: boolean,
|
|
12122
|
+
context?: EvaluationContext,
|
|
12123
|
+
): Promise<boolean>;
|
|
12124
|
+
/**
|
|
12125
|
+
* Get a string flag value.
|
|
12126
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12127
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12128
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12129
|
+
*/
|
|
12130
|
+
getStringValue(
|
|
12131
|
+
flagKey: string,
|
|
12132
|
+
defaultValue: string,
|
|
12133
|
+
context?: EvaluationContext,
|
|
12134
|
+
): Promise<string>;
|
|
12135
|
+
/**
|
|
12136
|
+
* Get a number flag value.
|
|
12137
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12138
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12139
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12140
|
+
*/
|
|
12141
|
+
getNumberValue(
|
|
12142
|
+
flagKey: string,
|
|
12143
|
+
defaultValue: number,
|
|
12144
|
+
context?: EvaluationContext,
|
|
12145
|
+
): Promise<number>;
|
|
12146
|
+
/**
|
|
12147
|
+
* Get an object flag value.
|
|
12148
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12149
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12150
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12151
|
+
*/
|
|
12152
|
+
getObjectValue<T extends object>(
|
|
12153
|
+
flagKey: string,
|
|
12154
|
+
defaultValue: T,
|
|
12155
|
+
context?: EvaluationContext,
|
|
12156
|
+
): Promise<T>;
|
|
12157
|
+
/**
|
|
12158
|
+
* Get a boolean flag value with full evaluation details.
|
|
12159
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12160
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12161
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12162
|
+
*/
|
|
12163
|
+
getBooleanDetails(
|
|
12164
|
+
flagKey: string,
|
|
12165
|
+
defaultValue: boolean,
|
|
12166
|
+
context?: EvaluationContext,
|
|
12167
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12168
|
+
/**
|
|
12169
|
+
* Get a string flag value with full evaluation details.
|
|
12170
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12171
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12172
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12173
|
+
*/
|
|
12174
|
+
getStringDetails(
|
|
12175
|
+
flagKey: string,
|
|
12176
|
+
defaultValue: string,
|
|
12177
|
+
context?: EvaluationContext,
|
|
12178
|
+
): Promise<EvaluationDetails<string>>;
|
|
12179
|
+
/**
|
|
12180
|
+
* Get a number flag value with full evaluation details.
|
|
12181
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12182
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12183
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12184
|
+
*/
|
|
12185
|
+
getNumberDetails(
|
|
12186
|
+
flagKey: string,
|
|
12187
|
+
defaultValue: number,
|
|
12188
|
+
context?: EvaluationContext,
|
|
12189
|
+
): Promise<EvaluationDetails<number>>;
|
|
12190
|
+
/**
|
|
12191
|
+
* Get an object flag value with full evaluation details.
|
|
12192
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12193
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12194
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12195
|
+
*/
|
|
12196
|
+
getObjectDetails<T extends object>(
|
|
12197
|
+
flagKey: string,
|
|
12198
|
+
defaultValue: T,
|
|
12199
|
+
context?: EvaluationContext,
|
|
12200
|
+
): Promise<EvaluationDetails<T>>;
|
|
12201
|
+
}
|
|
12068
12202
|
/**
|
|
12069
12203
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
12070
12204
|
*/
|
|
@@ -13903,6 +14037,11 @@ declare namespace TailStream {
|
|
|
13903
14037
|
readonly tag?: string;
|
|
13904
14038
|
readonly message?: string;
|
|
13905
14039
|
}
|
|
14040
|
+
interface TracePreviewInfo {
|
|
14041
|
+
readonly id: string;
|
|
14042
|
+
readonly slug: string;
|
|
14043
|
+
readonly name: string;
|
|
14044
|
+
}
|
|
13906
14045
|
interface Onset {
|
|
13907
14046
|
readonly type: "onset";
|
|
13908
14047
|
readonly attributes: Attribute[];
|
|
@@ -13914,6 +14053,7 @@ declare namespace TailStream {
|
|
|
13914
14053
|
readonly scriptName?: string;
|
|
13915
14054
|
readonly scriptTags?: string[];
|
|
13916
14055
|
readonly scriptVersion?: ScriptVersion;
|
|
14056
|
+
readonly preview?: TracePreviewInfo;
|
|
13917
14057
|
readonly info:
|
|
13918
14058
|
| FetchEventInfo
|
|
13919
14059
|
| ConnectEventInfo
|
package/latest/index.ts
CHANGED
|
@@ -12081,6 +12081,140 @@ export declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
|
|
|
12081
12081
|
env: Env,
|
|
12082
12082
|
ctx: ExecutionContext<Props>,
|
|
12083
12083
|
) => void | Promise<void>;
|
|
12084
|
+
/**
|
|
12085
|
+
* Evaluation context for targeting rules.
|
|
12086
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
12087
|
+
*/
|
|
12088
|
+
export type EvaluationContext = Record<string, string | number | boolean>;
|
|
12089
|
+
export interface EvaluationDetails<T> {
|
|
12090
|
+
flagKey: string;
|
|
12091
|
+
value: T;
|
|
12092
|
+
variant?: string | undefined;
|
|
12093
|
+
reason?: string | undefined;
|
|
12094
|
+
errorCode?: string | undefined;
|
|
12095
|
+
errorMessage?: string | undefined;
|
|
12096
|
+
}
|
|
12097
|
+
export interface FlagEvaluationError extends Error {}
|
|
12098
|
+
/**
|
|
12099
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
12100
|
+
*
|
|
12101
|
+
* @example
|
|
12102
|
+
* ```typescript
|
|
12103
|
+
* // Get a boolean flag value with a default
|
|
12104
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
12105
|
+
*
|
|
12106
|
+
* // Get a flag value with evaluation context for targeting
|
|
12107
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
12108
|
+
* userId: 'user-123',
|
|
12109
|
+
* country: 'US',
|
|
12110
|
+
* });
|
|
12111
|
+
*
|
|
12112
|
+
* // Get full evaluation details including variant and reason
|
|
12113
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
12114
|
+
* console.log(details.variant, details.reason);
|
|
12115
|
+
* ```
|
|
12116
|
+
*/
|
|
12117
|
+
export declare abstract class Flags {
|
|
12118
|
+
/**
|
|
12119
|
+
* Get a flag value without type checking.
|
|
12120
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12121
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
12122
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12123
|
+
*/
|
|
12124
|
+
get(
|
|
12125
|
+
flagKey: string,
|
|
12126
|
+
defaultValue?: unknown,
|
|
12127
|
+
context?: EvaluationContext,
|
|
12128
|
+
): Promise<unknown>;
|
|
12129
|
+
/**
|
|
12130
|
+
* Get a boolean flag value.
|
|
12131
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12132
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12133
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12134
|
+
*/
|
|
12135
|
+
getBooleanValue(
|
|
12136
|
+
flagKey: string,
|
|
12137
|
+
defaultValue: boolean,
|
|
12138
|
+
context?: EvaluationContext,
|
|
12139
|
+
): Promise<boolean>;
|
|
12140
|
+
/**
|
|
12141
|
+
* Get a string flag value.
|
|
12142
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12143
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12144
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12145
|
+
*/
|
|
12146
|
+
getStringValue(
|
|
12147
|
+
flagKey: string,
|
|
12148
|
+
defaultValue: string,
|
|
12149
|
+
context?: EvaluationContext,
|
|
12150
|
+
): Promise<string>;
|
|
12151
|
+
/**
|
|
12152
|
+
* Get a number flag value.
|
|
12153
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12154
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12155
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12156
|
+
*/
|
|
12157
|
+
getNumberValue(
|
|
12158
|
+
flagKey: string,
|
|
12159
|
+
defaultValue: number,
|
|
12160
|
+
context?: EvaluationContext,
|
|
12161
|
+
): Promise<number>;
|
|
12162
|
+
/**
|
|
12163
|
+
* Get an object flag value.
|
|
12164
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12165
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12166
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12167
|
+
*/
|
|
12168
|
+
getObjectValue<T extends object>(
|
|
12169
|
+
flagKey: string,
|
|
12170
|
+
defaultValue: T,
|
|
12171
|
+
context?: EvaluationContext,
|
|
12172
|
+
): Promise<T>;
|
|
12173
|
+
/**
|
|
12174
|
+
* Get a boolean flag value with full evaluation details.
|
|
12175
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12176
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12177
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12178
|
+
*/
|
|
12179
|
+
getBooleanDetails(
|
|
12180
|
+
flagKey: string,
|
|
12181
|
+
defaultValue: boolean,
|
|
12182
|
+
context?: EvaluationContext,
|
|
12183
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12184
|
+
/**
|
|
12185
|
+
* Get a string flag value with full evaluation details.
|
|
12186
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12187
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12188
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12189
|
+
*/
|
|
12190
|
+
getStringDetails(
|
|
12191
|
+
flagKey: string,
|
|
12192
|
+
defaultValue: string,
|
|
12193
|
+
context?: EvaluationContext,
|
|
12194
|
+
): Promise<EvaluationDetails<string>>;
|
|
12195
|
+
/**
|
|
12196
|
+
* Get a number flag value with full evaluation details.
|
|
12197
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12198
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12199
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12200
|
+
*/
|
|
12201
|
+
getNumberDetails(
|
|
12202
|
+
flagKey: string,
|
|
12203
|
+
defaultValue: number,
|
|
12204
|
+
context?: EvaluationContext,
|
|
12205
|
+
): Promise<EvaluationDetails<number>>;
|
|
12206
|
+
/**
|
|
12207
|
+
* Get an object flag value with full evaluation details.
|
|
12208
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12209
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12210
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12211
|
+
*/
|
|
12212
|
+
getObjectDetails<T extends object>(
|
|
12213
|
+
flagKey: string,
|
|
12214
|
+
defaultValue: T,
|
|
12215
|
+
context?: EvaluationContext,
|
|
12216
|
+
): Promise<EvaluationDetails<T>>;
|
|
12217
|
+
}
|
|
12084
12218
|
/**
|
|
12085
12219
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
12086
12220
|
*/
|
|
@@ -13860,6 +13994,11 @@ export declare namespace TailStream {
|
|
|
13860
13994
|
readonly tag?: string;
|
|
13861
13995
|
readonly message?: string;
|
|
13862
13996
|
}
|
|
13997
|
+
interface TracePreviewInfo {
|
|
13998
|
+
readonly id: string;
|
|
13999
|
+
readonly slug: string;
|
|
14000
|
+
readonly name: string;
|
|
14001
|
+
}
|
|
13863
14002
|
interface Onset {
|
|
13864
14003
|
readonly type: "onset";
|
|
13865
14004
|
readonly attributes: Attribute[];
|
|
@@ -13871,6 +14010,7 @@ export declare namespace TailStream {
|
|
|
13871
14010
|
readonly scriptName?: string;
|
|
13872
14011
|
readonly scriptTags?: string[];
|
|
13873
14012
|
readonly scriptVersion?: ScriptVersion;
|
|
14013
|
+
readonly preview?: TracePreviewInfo;
|
|
13874
14014
|
readonly info:
|
|
13875
14015
|
| FetchEventInfo
|
|
13876
14016
|
| ConnectEventInfo
|
package/oldest/index.d.ts
CHANGED
|
@@ -11925,6 +11925,140 @@ declare module "cloudflare:email" {
|
|
|
11925
11925
|
};
|
|
11926
11926
|
export { _EmailMessage as EmailMessage };
|
|
11927
11927
|
}
|
|
11928
|
+
/**
|
|
11929
|
+
* Evaluation context for targeting rules.
|
|
11930
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
11931
|
+
*/
|
|
11932
|
+
type EvaluationContext = Record<string, string | number | boolean>;
|
|
11933
|
+
interface EvaluationDetails<T> {
|
|
11934
|
+
flagKey: string;
|
|
11935
|
+
value: T;
|
|
11936
|
+
variant?: string | undefined;
|
|
11937
|
+
reason?: string | undefined;
|
|
11938
|
+
errorCode?: string | undefined;
|
|
11939
|
+
errorMessage?: string | undefined;
|
|
11940
|
+
}
|
|
11941
|
+
interface FlagEvaluationError extends Error {}
|
|
11942
|
+
/**
|
|
11943
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
11944
|
+
*
|
|
11945
|
+
* @example
|
|
11946
|
+
* ```typescript
|
|
11947
|
+
* // Get a boolean flag value with a default
|
|
11948
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
11949
|
+
*
|
|
11950
|
+
* // Get a flag value with evaluation context for targeting
|
|
11951
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
11952
|
+
* userId: 'user-123',
|
|
11953
|
+
* country: 'US',
|
|
11954
|
+
* });
|
|
11955
|
+
*
|
|
11956
|
+
* // Get full evaluation details including variant and reason
|
|
11957
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
11958
|
+
* console.log(details.variant, details.reason);
|
|
11959
|
+
* ```
|
|
11960
|
+
*/
|
|
11961
|
+
declare abstract class Flags {
|
|
11962
|
+
/**
|
|
11963
|
+
* Get a flag value without type checking.
|
|
11964
|
+
* @param flagKey The key of the flag to evaluate.
|
|
11965
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
11966
|
+
* @param context Optional evaluation context for targeting rules.
|
|
11967
|
+
*/
|
|
11968
|
+
get(
|
|
11969
|
+
flagKey: string,
|
|
11970
|
+
defaultValue?: unknown,
|
|
11971
|
+
context?: EvaluationContext,
|
|
11972
|
+
): Promise<unknown>;
|
|
11973
|
+
/**
|
|
11974
|
+
* Get a boolean flag value.
|
|
11975
|
+
* @param flagKey The key of the flag to evaluate.
|
|
11976
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
11977
|
+
* @param context Optional evaluation context for targeting rules.
|
|
11978
|
+
*/
|
|
11979
|
+
getBooleanValue(
|
|
11980
|
+
flagKey: string,
|
|
11981
|
+
defaultValue: boolean,
|
|
11982
|
+
context?: EvaluationContext,
|
|
11983
|
+
): Promise<boolean>;
|
|
11984
|
+
/**
|
|
11985
|
+
* Get a string flag value.
|
|
11986
|
+
* @param flagKey The key of the flag to evaluate.
|
|
11987
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
11988
|
+
* @param context Optional evaluation context for targeting rules.
|
|
11989
|
+
*/
|
|
11990
|
+
getStringValue(
|
|
11991
|
+
flagKey: string,
|
|
11992
|
+
defaultValue: string,
|
|
11993
|
+
context?: EvaluationContext,
|
|
11994
|
+
): Promise<string>;
|
|
11995
|
+
/**
|
|
11996
|
+
* Get a number flag value.
|
|
11997
|
+
* @param flagKey The key of the flag to evaluate.
|
|
11998
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
11999
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12000
|
+
*/
|
|
12001
|
+
getNumberValue(
|
|
12002
|
+
flagKey: string,
|
|
12003
|
+
defaultValue: number,
|
|
12004
|
+
context?: EvaluationContext,
|
|
12005
|
+
): Promise<number>;
|
|
12006
|
+
/**
|
|
12007
|
+
* Get an object flag value.
|
|
12008
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12009
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12010
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12011
|
+
*/
|
|
12012
|
+
getObjectValue<T extends object>(
|
|
12013
|
+
flagKey: string,
|
|
12014
|
+
defaultValue: T,
|
|
12015
|
+
context?: EvaluationContext,
|
|
12016
|
+
): Promise<T>;
|
|
12017
|
+
/**
|
|
12018
|
+
* Get a boolean flag value with full evaluation details.
|
|
12019
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12020
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12021
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12022
|
+
*/
|
|
12023
|
+
getBooleanDetails(
|
|
12024
|
+
flagKey: string,
|
|
12025
|
+
defaultValue: boolean,
|
|
12026
|
+
context?: EvaluationContext,
|
|
12027
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12028
|
+
/**
|
|
12029
|
+
* Get a string flag value with full evaluation details.
|
|
12030
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12031
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12032
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12033
|
+
*/
|
|
12034
|
+
getStringDetails(
|
|
12035
|
+
flagKey: string,
|
|
12036
|
+
defaultValue: string,
|
|
12037
|
+
context?: EvaluationContext,
|
|
12038
|
+
): Promise<EvaluationDetails<string>>;
|
|
12039
|
+
/**
|
|
12040
|
+
* Get a number flag value with full evaluation details.
|
|
12041
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12042
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12043
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12044
|
+
*/
|
|
12045
|
+
getNumberDetails(
|
|
12046
|
+
flagKey: string,
|
|
12047
|
+
defaultValue: number,
|
|
12048
|
+
context?: EvaluationContext,
|
|
12049
|
+
): Promise<EvaluationDetails<number>>;
|
|
12050
|
+
/**
|
|
12051
|
+
* Get an object flag value with full evaluation details.
|
|
12052
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12053
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12054
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12055
|
+
*/
|
|
12056
|
+
getObjectDetails<T extends object>(
|
|
12057
|
+
flagKey: string,
|
|
12058
|
+
defaultValue: T,
|
|
12059
|
+
context?: EvaluationContext,
|
|
12060
|
+
): Promise<EvaluationDetails<T>>;
|
|
12061
|
+
}
|
|
11928
12062
|
/**
|
|
11929
12063
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
11930
12064
|
*/
|
|
@@ -13763,6 +13897,11 @@ declare namespace TailStream {
|
|
|
13763
13897
|
readonly tag?: string;
|
|
13764
13898
|
readonly message?: string;
|
|
13765
13899
|
}
|
|
13900
|
+
interface TracePreviewInfo {
|
|
13901
|
+
readonly id: string;
|
|
13902
|
+
readonly slug: string;
|
|
13903
|
+
readonly name: string;
|
|
13904
|
+
}
|
|
13766
13905
|
interface Onset {
|
|
13767
13906
|
readonly type: "onset";
|
|
13768
13907
|
readonly attributes: Attribute[];
|
|
@@ -13774,6 +13913,7 @@ declare namespace TailStream {
|
|
|
13774
13913
|
readonly scriptName?: string;
|
|
13775
13914
|
readonly scriptTags?: string[];
|
|
13776
13915
|
readonly scriptVersion?: ScriptVersion;
|
|
13916
|
+
readonly preview?: TracePreviewInfo;
|
|
13777
13917
|
readonly info:
|
|
13778
13918
|
| FetchEventInfo
|
|
13779
13919
|
| ConnectEventInfo
|
package/oldest/index.ts
CHANGED
|
@@ -11941,6 +11941,140 @@ export declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
|
|
|
11941
11941
|
env: Env,
|
|
11942
11942
|
ctx: ExecutionContext<Props>,
|
|
11943
11943
|
) => void | Promise<void>;
|
|
11944
|
+
/**
|
|
11945
|
+
* Evaluation context for targeting rules.
|
|
11946
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
11947
|
+
*/
|
|
11948
|
+
export type EvaluationContext = Record<string, string | number | boolean>;
|
|
11949
|
+
export interface EvaluationDetails<T> {
|
|
11950
|
+
flagKey: string;
|
|
11951
|
+
value: T;
|
|
11952
|
+
variant?: string | undefined;
|
|
11953
|
+
reason?: string | undefined;
|
|
11954
|
+
errorCode?: string | undefined;
|
|
11955
|
+
errorMessage?: string | undefined;
|
|
11956
|
+
}
|
|
11957
|
+
export interface FlagEvaluationError extends Error {}
|
|
11958
|
+
/**
|
|
11959
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
11960
|
+
*
|
|
11961
|
+
* @example
|
|
11962
|
+
* ```typescript
|
|
11963
|
+
* // Get a boolean flag value with a default
|
|
11964
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
11965
|
+
*
|
|
11966
|
+
* // Get a flag value with evaluation context for targeting
|
|
11967
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
11968
|
+
* userId: 'user-123',
|
|
11969
|
+
* country: 'US',
|
|
11970
|
+
* });
|
|
11971
|
+
*
|
|
11972
|
+
* // Get full evaluation details including variant and reason
|
|
11973
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
11974
|
+
* console.log(details.variant, details.reason);
|
|
11975
|
+
* ```
|
|
11976
|
+
*/
|
|
11977
|
+
export declare abstract class Flags {
|
|
11978
|
+
/**
|
|
11979
|
+
* Get a flag value without type checking.
|
|
11980
|
+
* @param flagKey The key of the flag to evaluate.
|
|
11981
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
11982
|
+
* @param context Optional evaluation context for targeting rules.
|
|
11983
|
+
*/
|
|
11984
|
+
get(
|
|
11985
|
+
flagKey: string,
|
|
11986
|
+
defaultValue?: unknown,
|
|
11987
|
+
context?: EvaluationContext,
|
|
11988
|
+
): Promise<unknown>;
|
|
11989
|
+
/**
|
|
11990
|
+
* Get a boolean flag value.
|
|
11991
|
+
* @param flagKey The key of the flag to evaluate.
|
|
11992
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
11993
|
+
* @param context Optional evaluation context for targeting rules.
|
|
11994
|
+
*/
|
|
11995
|
+
getBooleanValue(
|
|
11996
|
+
flagKey: string,
|
|
11997
|
+
defaultValue: boolean,
|
|
11998
|
+
context?: EvaluationContext,
|
|
11999
|
+
): Promise<boolean>;
|
|
12000
|
+
/**
|
|
12001
|
+
* Get a string flag value.
|
|
12002
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12003
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12004
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12005
|
+
*/
|
|
12006
|
+
getStringValue(
|
|
12007
|
+
flagKey: string,
|
|
12008
|
+
defaultValue: string,
|
|
12009
|
+
context?: EvaluationContext,
|
|
12010
|
+
): Promise<string>;
|
|
12011
|
+
/**
|
|
12012
|
+
* Get a number flag value.
|
|
12013
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12014
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12015
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12016
|
+
*/
|
|
12017
|
+
getNumberValue(
|
|
12018
|
+
flagKey: string,
|
|
12019
|
+
defaultValue: number,
|
|
12020
|
+
context?: EvaluationContext,
|
|
12021
|
+
): Promise<number>;
|
|
12022
|
+
/**
|
|
12023
|
+
* Get an object flag value.
|
|
12024
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12025
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12026
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12027
|
+
*/
|
|
12028
|
+
getObjectValue<T extends object>(
|
|
12029
|
+
flagKey: string,
|
|
12030
|
+
defaultValue: T,
|
|
12031
|
+
context?: EvaluationContext,
|
|
12032
|
+
): Promise<T>;
|
|
12033
|
+
/**
|
|
12034
|
+
* Get a boolean flag value with full evaluation details.
|
|
12035
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12036
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12037
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12038
|
+
*/
|
|
12039
|
+
getBooleanDetails(
|
|
12040
|
+
flagKey: string,
|
|
12041
|
+
defaultValue: boolean,
|
|
12042
|
+
context?: EvaluationContext,
|
|
12043
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12044
|
+
/**
|
|
12045
|
+
* Get a string flag value with full evaluation details.
|
|
12046
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12047
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12048
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12049
|
+
*/
|
|
12050
|
+
getStringDetails(
|
|
12051
|
+
flagKey: string,
|
|
12052
|
+
defaultValue: string,
|
|
12053
|
+
context?: EvaluationContext,
|
|
12054
|
+
): Promise<EvaluationDetails<string>>;
|
|
12055
|
+
/**
|
|
12056
|
+
* Get a number flag value with full evaluation details.
|
|
12057
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12058
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12059
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12060
|
+
*/
|
|
12061
|
+
getNumberDetails(
|
|
12062
|
+
flagKey: string,
|
|
12063
|
+
defaultValue: number,
|
|
12064
|
+
context?: EvaluationContext,
|
|
12065
|
+
): Promise<EvaluationDetails<number>>;
|
|
12066
|
+
/**
|
|
12067
|
+
* Get an object flag value with full evaluation details.
|
|
12068
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12069
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12070
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12071
|
+
*/
|
|
12072
|
+
getObjectDetails<T extends object>(
|
|
12073
|
+
flagKey: string,
|
|
12074
|
+
defaultValue: T,
|
|
12075
|
+
context?: EvaluationContext,
|
|
12076
|
+
): Promise<EvaluationDetails<T>>;
|
|
12077
|
+
}
|
|
11944
12078
|
/**
|
|
11945
12079
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
11946
12080
|
*/
|
|
@@ -13720,6 +13854,11 @@ export declare namespace TailStream {
|
|
|
13720
13854
|
readonly tag?: string;
|
|
13721
13855
|
readonly message?: string;
|
|
13722
13856
|
}
|
|
13857
|
+
interface TracePreviewInfo {
|
|
13858
|
+
readonly id: string;
|
|
13859
|
+
readonly slug: string;
|
|
13860
|
+
readonly name: string;
|
|
13861
|
+
}
|
|
13723
13862
|
interface Onset {
|
|
13724
13863
|
readonly type: "onset";
|
|
13725
13864
|
readonly attributes: Attribute[];
|
|
@@ -13731,6 +13870,7 @@ export declare namespace TailStream {
|
|
|
13731
13870
|
readonly scriptName?: string;
|
|
13732
13871
|
readonly scriptTags?: string[];
|
|
13733
13872
|
readonly scriptVersion?: ScriptVersion;
|
|
13873
|
+
readonly preview?: TracePreviewInfo;
|
|
13734
13874
|
readonly info:
|
|
13735
13875
|
| FetchEventInfo
|
|
13736
13876
|
| ConnectEventInfo
|
package/package.json
CHANGED