@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/2022-10-31/index.d.ts
CHANGED
|
@@ -12021,6 +12021,140 @@ declare module "cloudflare:email" {
|
|
|
12021
12021
|
};
|
|
12022
12022
|
export { _EmailMessage as EmailMessage };
|
|
12023
12023
|
}
|
|
12024
|
+
/**
|
|
12025
|
+
* Evaluation context for targeting rules.
|
|
12026
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
12027
|
+
*/
|
|
12028
|
+
type EvaluationContext = Record<string, string | number | boolean>;
|
|
12029
|
+
interface EvaluationDetails<T> {
|
|
12030
|
+
flagKey: string;
|
|
12031
|
+
value: T;
|
|
12032
|
+
variant?: string | undefined;
|
|
12033
|
+
reason?: string | undefined;
|
|
12034
|
+
errorCode?: string | undefined;
|
|
12035
|
+
errorMessage?: string | undefined;
|
|
12036
|
+
}
|
|
12037
|
+
interface FlagEvaluationError extends Error {}
|
|
12038
|
+
/**
|
|
12039
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
12040
|
+
*
|
|
12041
|
+
* @example
|
|
12042
|
+
* ```typescript
|
|
12043
|
+
* // Get a boolean flag value with a default
|
|
12044
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
12045
|
+
*
|
|
12046
|
+
* // Get a flag value with evaluation context for targeting
|
|
12047
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
12048
|
+
* userId: 'user-123',
|
|
12049
|
+
* country: 'US',
|
|
12050
|
+
* });
|
|
12051
|
+
*
|
|
12052
|
+
* // Get full evaluation details including variant and reason
|
|
12053
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
12054
|
+
* console.log(details.variant, details.reason);
|
|
12055
|
+
* ```
|
|
12056
|
+
*/
|
|
12057
|
+
declare abstract class Flags {
|
|
12058
|
+
/**
|
|
12059
|
+
* Get a flag value without type checking.
|
|
12060
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12061
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
12062
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12063
|
+
*/
|
|
12064
|
+
get(
|
|
12065
|
+
flagKey: string,
|
|
12066
|
+
defaultValue?: unknown,
|
|
12067
|
+
context?: EvaluationContext,
|
|
12068
|
+
): Promise<unknown>;
|
|
12069
|
+
/**
|
|
12070
|
+
* Get a boolean flag value.
|
|
12071
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12072
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12073
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12074
|
+
*/
|
|
12075
|
+
getBooleanValue(
|
|
12076
|
+
flagKey: string,
|
|
12077
|
+
defaultValue: boolean,
|
|
12078
|
+
context?: EvaluationContext,
|
|
12079
|
+
): Promise<boolean>;
|
|
12080
|
+
/**
|
|
12081
|
+
* Get a string flag value.
|
|
12082
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12083
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12084
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12085
|
+
*/
|
|
12086
|
+
getStringValue(
|
|
12087
|
+
flagKey: string,
|
|
12088
|
+
defaultValue: string,
|
|
12089
|
+
context?: EvaluationContext,
|
|
12090
|
+
): Promise<string>;
|
|
12091
|
+
/**
|
|
12092
|
+
* Get a number flag value.
|
|
12093
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12094
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12095
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12096
|
+
*/
|
|
12097
|
+
getNumberValue(
|
|
12098
|
+
flagKey: string,
|
|
12099
|
+
defaultValue: number,
|
|
12100
|
+
context?: EvaluationContext,
|
|
12101
|
+
): Promise<number>;
|
|
12102
|
+
/**
|
|
12103
|
+
* Get an object flag value.
|
|
12104
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12105
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12106
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12107
|
+
*/
|
|
12108
|
+
getObjectValue<T extends object>(
|
|
12109
|
+
flagKey: string,
|
|
12110
|
+
defaultValue: T,
|
|
12111
|
+
context?: EvaluationContext,
|
|
12112
|
+
): Promise<T>;
|
|
12113
|
+
/**
|
|
12114
|
+
* Get a boolean flag value with full evaluation details.
|
|
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
|
+
getBooleanDetails(
|
|
12120
|
+
flagKey: string,
|
|
12121
|
+
defaultValue: boolean,
|
|
12122
|
+
context?: EvaluationContext,
|
|
12123
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12124
|
+
/**
|
|
12125
|
+
* Get a string flag value with full evaluation details.
|
|
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
|
+
getStringDetails(
|
|
12131
|
+
flagKey: string,
|
|
12132
|
+
defaultValue: string,
|
|
12133
|
+
context?: EvaluationContext,
|
|
12134
|
+
): Promise<EvaluationDetails<string>>;
|
|
12135
|
+
/**
|
|
12136
|
+
* Get a number flag value with full evaluation details.
|
|
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
|
+
getNumberDetails(
|
|
12142
|
+
flagKey: string,
|
|
12143
|
+
defaultValue: number,
|
|
12144
|
+
context?: EvaluationContext,
|
|
12145
|
+
): Promise<EvaluationDetails<number>>;
|
|
12146
|
+
/**
|
|
12147
|
+
* Get an object flag value with full evaluation details.
|
|
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
|
+
getObjectDetails<T extends object>(
|
|
12153
|
+
flagKey: string,
|
|
12154
|
+
defaultValue: T,
|
|
12155
|
+
context?: EvaluationContext,
|
|
12156
|
+
): Promise<EvaluationDetails<T>>;
|
|
12157
|
+
}
|
|
12024
12158
|
/**
|
|
12025
12159
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
12026
12160
|
*/
|
|
@@ -13859,6 +13993,11 @@ declare namespace TailStream {
|
|
|
13859
13993
|
readonly tag?: string;
|
|
13860
13994
|
readonly message?: string;
|
|
13861
13995
|
}
|
|
13996
|
+
interface TracePreviewInfo {
|
|
13997
|
+
readonly id: string;
|
|
13998
|
+
readonly slug: string;
|
|
13999
|
+
readonly name: string;
|
|
14000
|
+
}
|
|
13862
14001
|
interface Onset {
|
|
13863
14002
|
readonly type: "onset";
|
|
13864
14003
|
readonly attributes: Attribute[];
|
|
@@ -13870,6 +14009,7 @@ declare namespace TailStream {
|
|
|
13870
14009
|
readonly scriptName?: string;
|
|
13871
14010
|
readonly scriptTags?: string[];
|
|
13872
14011
|
readonly scriptVersion?: ScriptVersion;
|
|
14012
|
+
readonly preview?: TracePreviewInfo;
|
|
13873
14013
|
readonly info:
|
|
13874
14014
|
| FetchEventInfo
|
|
13875
14015
|
| ConnectEventInfo
|
package/2022-10-31/index.ts
CHANGED
|
@@ -12037,6 +12037,140 @@ export declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
|
|
|
12037
12037
|
env: Env,
|
|
12038
12038
|
ctx: ExecutionContext<Props>,
|
|
12039
12039
|
) => void | Promise<void>;
|
|
12040
|
+
/**
|
|
12041
|
+
* Evaluation context for targeting rules.
|
|
12042
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
12043
|
+
*/
|
|
12044
|
+
export type EvaluationContext = Record<string, string | number | boolean>;
|
|
12045
|
+
export interface EvaluationDetails<T> {
|
|
12046
|
+
flagKey: string;
|
|
12047
|
+
value: T;
|
|
12048
|
+
variant?: string | undefined;
|
|
12049
|
+
reason?: string | undefined;
|
|
12050
|
+
errorCode?: string | undefined;
|
|
12051
|
+
errorMessage?: string | undefined;
|
|
12052
|
+
}
|
|
12053
|
+
export interface FlagEvaluationError extends Error {}
|
|
12054
|
+
/**
|
|
12055
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
12056
|
+
*
|
|
12057
|
+
* @example
|
|
12058
|
+
* ```typescript
|
|
12059
|
+
* // Get a boolean flag value with a default
|
|
12060
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
12061
|
+
*
|
|
12062
|
+
* // Get a flag value with evaluation context for targeting
|
|
12063
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
12064
|
+
* userId: 'user-123',
|
|
12065
|
+
* country: 'US',
|
|
12066
|
+
* });
|
|
12067
|
+
*
|
|
12068
|
+
* // Get full evaluation details including variant and reason
|
|
12069
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
12070
|
+
* console.log(details.variant, details.reason);
|
|
12071
|
+
* ```
|
|
12072
|
+
*/
|
|
12073
|
+
export declare abstract class Flags {
|
|
12074
|
+
/**
|
|
12075
|
+
* Get a flag value without type checking.
|
|
12076
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12077
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
12078
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12079
|
+
*/
|
|
12080
|
+
get(
|
|
12081
|
+
flagKey: string,
|
|
12082
|
+
defaultValue?: unknown,
|
|
12083
|
+
context?: EvaluationContext,
|
|
12084
|
+
): Promise<unknown>;
|
|
12085
|
+
/**
|
|
12086
|
+
* Get a boolean flag value.
|
|
12087
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12088
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12089
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12090
|
+
*/
|
|
12091
|
+
getBooleanValue(
|
|
12092
|
+
flagKey: string,
|
|
12093
|
+
defaultValue: boolean,
|
|
12094
|
+
context?: EvaluationContext,
|
|
12095
|
+
): Promise<boolean>;
|
|
12096
|
+
/**
|
|
12097
|
+
* Get a string flag value.
|
|
12098
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12099
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12100
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12101
|
+
*/
|
|
12102
|
+
getStringValue(
|
|
12103
|
+
flagKey: string,
|
|
12104
|
+
defaultValue: string,
|
|
12105
|
+
context?: EvaluationContext,
|
|
12106
|
+
): Promise<string>;
|
|
12107
|
+
/**
|
|
12108
|
+
* Get a number flag value.
|
|
12109
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12110
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12111
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12112
|
+
*/
|
|
12113
|
+
getNumberValue(
|
|
12114
|
+
flagKey: string,
|
|
12115
|
+
defaultValue: number,
|
|
12116
|
+
context?: EvaluationContext,
|
|
12117
|
+
): Promise<number>;
|
|
12118
|
+
/**
|
|
12119
|
+
* Get an object flag value.
|
|
12120
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12121
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12122
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12123
|
+
*/
|
|
12124
|
+
getObjectValue<T extends object>(
|
|
12125
|
+
flagKey: string,
|
|
12126
|
+
defaultValue: T,
|
|
12127
|
+
context?: EvaluationContext,
|
|
12128
|
+
): Promise<T>;
|
|
12129
|
+
/**
|
|
12130
|
+
* Get a boolean flag value with full evaluation details.
|
|
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
|
+
getBooleanDetails(
|
|
12136
|
+
flagKey: string,
|
|
12137
|
+
defaultValue: boolean,
|
|
12138
|
+
context?: EvaluationContext,
|
|
12139
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12140
|
+
/**
|
|
12141
|
+
* Get a string flag value with full evaluation details.
|
|
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
|
+
getStringDetails(
|
|
12147
|
+
flagKey: string,
|
|
12148
|
+
defaultValue: string,
|
|
12149
|
+
context?: EvaluationContext,
|
|
12150
|
+
): Promise<EvaluationDetails<string>>;
|
|
12151
|
+
/**
|
|
12152
|
+
* Get a number flag value with full evaluation details.
|
|
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
|
+
getNumberDetails(
|
|
12158
|
+
flagKey: string,
|
|
12159
|
+
defaultValue: number,
|
|
12160
|
+
context?: EvaluationContext,
|
|
12161
|
+
): Promise<EvaluationDetails<number>>;
|
|
12162
|
+
/**
|
|
12163
|
+
* Get an object flag value with full evaluation details.
|
|
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
|
+
getObjectDetails<T extends object>(
|
|
12169
|
+
flagKey: string,
|
|
12170
|
+
defaultValue: T,
|
|
12171
|
+
context?: EvaluationContext,
|
|
12172
|
+
): Promise<EvaluationDetails<T>>;
|
|
12173
|
+
}
|
|
12040
12174
|
/**
|
|
12041
12175
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
12042
12176
|
*/
|
|
@@ -13816,6 +13950,11 @@ export declare namespace TailStream {
|
|
|
13816
13950
|
readonly tag?: string;
|
|
13817
13951
|
readonly message?: string;
|
|
13818
13952
|
}
|
|
13953
|
+
interface TracePreviewInfo {
|
|
13954
|
+
readonly id: string;
|
|
13955
|
+
readonly slug: string;
|
|
13956
|
+
readonly name: string;
|
|
13957
|
+
}
|
|
13819
13958
|
interface Onset {
|
|
13820
13959
|
readonly type: "onset";
|
|
13821
13960
|
readonly attributes: Attribute[];
|
|
@@ -13827,6 +13966,7 @@ export declare namespace TailStream {
|
|
|
13827
13966
|
readonly scriptName?: string;
|
|
13828
13967
|
readonly scriptTags?: string[];
|
|
13829
13968
|
readonly scriptVersion?: ScriptVersion;
|
|
13969
|
+
readonly preview?: TracePreviewInfo;
|
|
13830
13970
|
readonly info:
|
|
13831
13971
|
| FetchEventInfo
|
|
13832
13972
|
| ConnectEventInfo
|
package/2022-11-30/index.d.ts
CHANGED
|
@@ -12026,6 +12026,140 @@ declare module "cloudflare:email" {
|
|
|
12026
12026
|
};
|
|
12027
12027
|
export { _EmailMessage as EmailMessage };
|
|
12028
12028
|
}
|
|
12029
|
+
/**
|
|
12030
|
+
* Evaluation context for targeting rules.
|
|
12031
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
12032
|
+
*/
|
|
12033
|
+
type EvaluationContext = Record<string, string | number | boolean>;
|
|
12034
|
+
interface EvaluationDetails<T> {
|
|
12035
|
+
flagKey: string;
|
|
12036
|
+
value: T;
|
|
12037
|
+
variant?: string | undefined;
|
|
12038
|
+
reason?: string | undefined;
|
|
12039
|
+
errorCode?: string | undefined;
|
|
12040
|
+
errorMessage?: string | undefined;
|
|
12041
|
+
}
|
|
12042
|
+
interface FlagEvaluationError extends Error {}
|
|
12043
|
+
/**
|
|
12044
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
12045
|
+
*
|
|
12046
|
+
* @example
|
|
12047
|
+
* ```typescript
|
|
12048
|
+
* // Get a boolean flag value with a default
|
|
12049
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
12050
|
+
*
|
|
12051
|
+
* // Get a flag value with evaluation context for targeting
|
|
12052
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
12053
|
+
* userId: 'user-123',
|
|
12054
|
+
* country: 'US',
|
|
12055
|
+
* });
|
|
12056
|
+
*
|
|
12057
|
+
* // Get full evaluation details including variant and reason
|
|
12058
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
12059
|
+
* console.log(details.variant, details.reason);
|
|
12060
|
+
* ```
|
|
12061
|
+
*/
|
|
12062
|
+
declare abstract class Flags {
|
|
12063
|
+
/**
|
|
12064
|
+
* Get a flag value without type checking.
|
|
12065
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12066
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
12067
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12068
|
+
*/
|
|
12069
|
+
get(
|
|
12070
|
+
flagKey: string,
|
|
12071
|
+
defaultValue?: unknown,
|
|
12072
|
+
context?: EvaluationContext,
|
|
12073
|
+
): Promise<unknown>;
|
|
12074
|
+
/**
|
|
12075
|
+
* Get a boolean flag value.
|
|
12076
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12077
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12078
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12079
|
+
*/
|
|
12080
|
+
getBooleanValue(
|
|
12081
|
+
flagKey: string,
|
|
12082
|
+
defaultValue: boolean,
|
|
12083
|
+
context?: EvaluationContext,
|
|
12084
|
+
): Promise<boolean>;
|
|
12085
|
+
/**
|
|
12086
|
+
* Get a string flag value.
|
|
12087
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12088
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12089
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12090
|
+
*/
|
|
12091
|
+
getStringValue(
|
|
12092
|
+
flagKey: string,
|
|
12093
|
+
defaultValue: string,
|
|
12094
|
+
context?: EvaluationContext,
|
|
12095
|
+
): Promise<string>;
|
|
12096
|
+
/**
|
|
12097
|
+
* Get a number flag value.
|
|
12098
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12099
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12100
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12101
|
+
*/
|
|
12102
|
+
getNumberValue(
|
|
12103
|
+
flagKey: string,
|
|
12104
|
+
defaultValue: number,
|
|
12105
|
+
context?: EvaluationContext,
|
|
12106
|
+
): Promise<number>;
|
|
12107
|
+
/**
|
|
12108
|
+
* Get an object flag value.
|
|
12109
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12110
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12111
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12112
|
+
*/
|
|
12113
|
+
getObjectValue<T extends object>(
|
|
12114
|
+
flagKey: string,
|
|
12115
|
+
defaultValue: T,
|
|
12116
|
+
context?: EvaluationContext,
|
|
12117
|
+
): Promise<T>;
|
|
12118
|
+
/**
|
|
12119
|
+
* Get a boolean flag value with full evaluation details.
|
|
12120
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12121
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12122
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12123
|
+
*/
|
|
12124
|
+
getBooleanDetails(
|
|
12125
|
+
flagKey: string,
|
|
12126
|
+
defaultValue: boolean,
|
|
12127
|
+
context?: EvaluationContext,
|
|
12128
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12129
|
+
/**
|
|
12130
|
+
* Get a string flag value with full evaluation details.
|
|
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
|
+
getStringDetails(
|
|
12136
|
+
flagKey: string,
|
|
12137
|
+
defaultValue: string,
|
|
12138
|
+
context?: EvaluationContext,
|
|
12139
|
+
): Promise<EvaluationDetails<string>>;
|
|
12140
|
+
/**
|
|
12141
|
+
* Get a number flag value with full evaluation details.
|
|
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
|
+
getNumberDetails(
|
|
12147
|
+
flagKey: string,
|
|
12148
|
+
defaultValue: number,
|
|
12149
|
+
context?: EvaluationContext,
|
|
12150
|
+
): Promise<EvaluationDetails<number>>;
|
|
12151
|
+
/**
|
|
12152
|
+
* Get an object flag value with full evaluation details.
|
|
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
|
+
getObjectDetails<T extends object>(
|
|
12158
|
+
flagKey: string,
|
|
12159
|
+
defaultValue: T,
|
|
12160
|
+
context?: EvaluationContext,
|
|
12161
|
+
): Promise<EvaluationDetails<T>>;
|
|
12162
|
+
}
|
|
12029
12163
|
/**
|
|
12030
12164
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
12031
12165
|
*/
|
|
@@ -13864,6 +13998,11 @@ declare namespace TailStream {
|
|
|
13864
13998
|
readonly tag?: string;
|
|
13865
13999
|
readonly message?: string;
|
|
13866
14000
|
}
|
|
14001
|
+
interface TracePreviewInfo {
|
|
14002
|
+
readonly id: string;
|
|
14003
|
+
readonly slug: string;
|
|
14004
|
+
readonly name: string;
|
|
14005
|
+
}
|
|
13867
14006
|
interface Onset {
|
|
13868
14007
|
readonly type: "onset";
|
|
13869
14008
|
readonly attributes: Attribute[];
|
|
@@ -13875,6 +14014,7 @@ declare namespace TailStream {
|
|
|
13875
14014
|
readonly scriptName?: string;
|
|
13876
14015
|
readonly scriptTags?: string[];
|
|
13877
14016
|
readonly scriptVersion?: ScriptVersion;
|
|
14017
|
+
readonly preview?: TracePreviewInfo;
|
|
13878
14018
|
readonly info:
|
|
13879
14019
|
| FetchEventInfo
|
|
13880
14020
|
| ConnectEventInfo
|
package/2022-11-30/index.ts
CHANGED
|
@@ -12042,6 +12042,140 @@ export declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
|
|
|
12042
12042
|
env: Env,
|
|
12043
12043
|
ctx: ExecutionContext<Props>,
|
|
12044
12044
|
) => void | Promise<void>;
|
|
12045
|
+
/**
|
|
12046
|
+
* Evaluation context for targeting rules.
|
|
12047
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
12048
|
+
*/
|
|
12049
|
+
export type EvaluationContext = Record<string, string | number | boolean>;
|
|
12050
|
+
export interface EvaluationDetails<T> {
|
|
12051
|
+
flagKey: string;
|
|
12052
|
+
value: T;
|
|
12053
|
+
variant?: string | undefined;
|
|
12054
|
+
reason?: string | undefined;
|
|
12055
|
+
errorCode?: string | undefined;
|
|
12056
|
+
errorMessage?: string | undefined;
|
|
12057
|
+
}
|
|
12058
|
+
export interface FlagEvaluationError extends Error {}
|
|
12059
|
+
/**
|
|
12060
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
12061
|
+
*
|
|
12062
|
+
* @example
|
|
12063
|
+
* ```typescript
|
|
12064
|
+
* // Get a boolean flag value with a default
|
|
12065
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
12066
|
+
*
|
|
12067
|
+
* // Get a flag value with evaluation context for targeting
|
|
12068
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
12069
|
+
* userId: 'user-123',
|
|
12070
|
+
* country: 'US',
|
|
12071
|
+
* });
|
|
12072
|
+
*
|
|
12073
|
+
* // Get full evaluation details including variant and reason
|
|
12074
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
12075
|
+
* console.log(details.variant, details.reason);
|
|
12076
|
+
* ```
|
|
12077
|
+
*/
|
|
12078
|
+
export declare abstract class Flags {
|
|
12079
|
+
/**
|
|
12080
|
+
* Get a flag value without type checking.
|
|
12081
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12082
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
12083
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12084
|
+
*/
|
|
12085
|
+
get(
|
|
12086
|
+
flagKey: string,
|
|
12087
|
+
defaultValue?: unknown,
|
|
12088
|
+
context?: EvaluationContext,
|
|
12089
|
+
): Promise<unknown>;
|
|
12090
|
+
/**
|
|
12091
|
+
* Get a boolean flag value.
|
|
12092
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12093
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12094
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12095
|
+
*/
|
|
12096
|
+
getBooleanValue(
|
|
12097
|
+
flagKey: string,
|
|
12098
|
+
defaultValue: boolean,
|
|
12099
|
+
context?: EvaluationContext,
|
|
12100
|
+
): Promise<boolean>;
|
|
12101
|
+
/**
|
|
12102
|
+
* Get a string flag value.
|
|
12103
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12104
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12105
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12106
|
+
*/
|
|
12107
|
+
getStringValue(
|
|
12108
|
+
flagKey: string,
|
|
12109
|
+
defaultValue: string,
|
|
12110
|
+
context?: EvaluationContext,
|
|
12111
|
+
): Promise<string>;
|
|
12112
|
+
/**
|
|
12113
|
+
* Get a number flag value.
|
|
12114
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12115
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12116
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12117
|
+
*/
|
|
12118
|
+
getNumberValue(
|
|
12119
|
+
flagKey: string,
|
|
12120
|
+
defaultValue: number,
|
|
12121
|
+
context?: EvaluationContext,
|
|
12122
|
+
): Promise<number>;
|
|
12123
|
+
/**
|
|
12124
|
+
* Get an object flag value.
|
|
12125
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12126
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12127
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12128
|
+
*/
|
|
12129
|
+
getObjectValue<T extends object>(
|
|
12130
|
+
flagKey: string,
|
|
12131
|
+
defaultValue: T,
|
|
12132
|
+
context?: EvaluationContext,
|
|
12133
|
+
): Promise<T>;
|
|
12134
|
+
/**
|
|
12135
|
+
* Get a boolean flag value with full evaluation details.
|
|
12136
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12137
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12138
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12139
|
+
*/
|
|
12140
|
+
getBooleanDetails(
|
|
12141
|
+
flagKey: string,
|
|
12142
|
+
defaultValue: boolean,
|
|
12143
|
+
context?: EvaluationContext,
|
|
12144
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12145
|
+
/**
|
|
12146
|
+
* Get a string flag value with full evaluation details.
|
|
12147
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12148
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12149
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12150
|
+
*/
|
|
12151
|
+
getStringDetails(
|
|
12152
|
+
flagKey: string,
|
|
12153
|
+
defaultValue: string,
|
|
12154
|
+
context?: EvaluationContext,
|
|
12155
|
+
): Promise<EvaluationDetails<string>>;
|
|
12156
|
+
/**
|
|
12157
|
+
* Get a number flag value with full evaluation details.
|
|
12158
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12159
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12160
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12161
|
+
*/
|
|
12162
|
+
getNumberDetails(
|
|
12163
|
+
flagKey: string,
|
|
12164
|
+
defaultValue: number,
|
|
12165
|
+
context?: EvaluationContext,
|
|
12166
|
+
): Promise<EvaluationDetails<number>>;
|
|
12167
|
+
/**
|
|
12168
|
+
* Get an object flag value with full evaluation details.
|
|
12169
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12170
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12171
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12172
|
+
*/
|
|
12173
|
+
getObjectDetails<T extends object>(
|
|
12174
|
+
flagKey: string,
|
|
12175
|
+
defaultValue: T,
|
|
12176
|
+
context?: EvaluationContext,
|
|
12177
|
+
): Promise<EvaluationDetails<T>>;
|
|
12178
|
+
}
|
|
12045
12179
|
/**
|
|
12046
12180
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
12047
12181
|
*/
|
|
@@ -13821,6 +13955,11 @@ export declare namespace TailStream {
|
|
|
13821
13955
|
readonly tag?: string;
|
|
13822
13956
|
readonly message?: string;
|
|
13823
13957
|
}
|
|
13958
|
+
interface TracePreviewInfo {
|
|
13959
|
+
readonly id: string;
|
|
13960
|
+
readonly slug: string;
|
|
13961
|
+
readonly name: string;
|
|
13962
|
+
}
|
|
13824
13963
|
interface Onset {
|
|
13825
13964
|
readonly type: "onset";
|
|
13826
13965
|
readonly attributes: Attribute[];
|
|
@@ -13832,6 +13971,7 @@ export declare namespace TailStream {
|
|
|
13832
13971
|
readonly scriptName?: string;
|
|
13833
13972
|
readonly scriptTags?: string[];
|
|
13834
13973
|
readonly scriptVersion?: ScriptVersion;
|
|
13974
|
+
readonly preview?: TracePreviewInfo;
|
|
13835
13975
|
readonly info:
|
|
13836
13976
|
| FetchEventInfo
|
|
13837
13977
|
| ConnectEventInfo
|