@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-03-21/index.d.ts
CHANGED
|
@@ -12000,6 +12000,140 @@ declare module "cloudflare:email" {
|
|
|
12000
12000
|
};
|
|
12001
12001
|
export { _EmailMessage as EmailMessage };
|
|
12002
12002
|
}
|
|
12003
|
+
/**
|
|
12004
|
+
* Evaluation context for targeting rules.
|
|
12005
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
12006
|
+
*/
|
|
12007
|
+
type EvaluationContext = Record<string, string | number | boolean>;
|
|
12008
|
+
interface EvaluationDetails<T> {
|
|
12009
|
+
flagKey: string;
|
|
12010
|
+
value: T;
|
|
12011
|
+
variant?: string | undefined;
|
|
12012
|
+
reason?: string | undefined;
|
|
12013
|
+
errorCode?: string | undefined;
|
|
12014
|
+
errorMessage?: string | undefined;
|
|
12015
|
+
}
|
|
12016
|
+
interface FlagEvaluationError extends Error {}
|
|
12017
|
+
/**
|
|
12018
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
12019
|
+
*
|
|
12020
|
+
* @example
|
|
12021
|
+
* ```typescript
|
|
12022
|
+
* // Get a boolean flag value with a default
|
|
12023
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
12024
|
+
*
|
|
12025
|
+
* // Get a flag value with evaluation context for targeting
|
|
12026
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
12027
|
+
* userId: 'user-123',
|
|
12028
|
+
* country: 'US',
|
|
12029
|
+
* });
|
|
12030
|
+
*
|
|
12031
|
+
* // Get full evaluation details including variant and reason
|
|
12032
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
12033
|
+
* console.log(details.variant, details.reason);
|
|
12034
|
+
* ```
|
|
12035
|
+
*/
|
|
12036
|
+
declare abstract class Flags {
|
|
12037
|
+
/**
|
|
12038
|
+
* Get a flag value without type checking.
|
|
12039
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12040
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
12041
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12042
|
+
*/
|
|
12043
|
+
get(
|
|
12044
|
+
flagKey: string,
|
|
12045
|
+
defaultValue?: unknown,
|
|
12046
|
+
context?: EvaluationContext,
|
|
12047
|
+
): Promise<unknown>;
|
|
12048
|
+
/**
|
|
12049
|
+
* Get a boolean flag value.
|
|
12050
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12051
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12052
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12053
|
+
*/
|
|
12054
|
+
getBooleanValue(
|
|
12055
|
+
flagKey: string,
|
|
12056
|
+
defaultValue: boolean,
|
|
12057
|
+
context?: EvaluationContext,
|
|
12058
|
+
): Promise<boolean>;
|
|
12059
|
+
/**
|
|
12060
|
+
* Get a string flag value.
|
|
12061
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12062
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12063
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12064
|
+
*/
|
|
12065
|
+
getStringValue(
|
|
12066
|
+
flagKey: string,
|
|
12067
|
+
defaultValue: string,
|
|
12068
|
+
context?: EvaluationContext,
|
|
12069
|
+
): Promise<string>;
|
|
12070
|
+
/**
|
|
12071
|
+
* Get a number flag value.
|
|
12072
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12073
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12074
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12075
|
+
*/
|
|
12076
|
+
getNumberValue(
|
|
12077
|
+
flagKey: string,
|
|
12078
|
+
defaultValue: number,
|
|
12079
|
+
context?: EvaluationContext,
|
|
12080
|
+
): Promise<number>;
|
|
12081
|
+
/**
|
|
12082
|
+
* Get an object flag value.
|
|
12083
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12084
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12085
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12086
|
+
*/
|
|
12087
|
+
getObjectValue<T extends object>(
|
|
12088
|
+
flagKey: string,
|
|
12089
|
+
defaultValue: T,
|
|
12090
|
+
context?: EvaluationContext,
|
|
12091
|
+
): Promise<T>;
|
|
12092
|
+
/**
|
|
12093
|
+
* Get a boolean flag value with full evaluation details.
|
|
12094
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12095
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12096
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12097
|
+
*/
|
|
12098
|
+
getBooleanDetails(
|
|
12099
|
+
flagKey: string,
|
|
12100
|
+
defaultValue: boolean,
|
|
12101
|
+
context?: EvaluationContext,
|
|
12102
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12103
|
+
/**
|
|
12104
|
+
* Get a string flag value with full evaluation details.
|
|
12105
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12106
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12107
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12108
|
+
*/
|
|
12109
|
+
getStringDetails(
|
|
12110
|
+
flagKey: string,
|
|
12111
|
+
defaultValue: string,
|
|
12112
|
+
context?: EvaluationContext,
|
|
12113
|
+
): Promise<EvaluationDetails<string>>;
|
|
12114
|
+
/**
|
|
12115
|
+
* Get a number flag value with full evaluation details.
|
|
12116
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12117
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12118
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12119
|
+
*/
|
|
12120
|
+
getNumberDetails(
|
|
12121
|
+
flagKey: string,
|
|
12122
|
+
defaultValue: number,
|
|
12123
|
+
context?: EvaluationContext,
|
|
12124
|
+
): Promise<EvaluationDetails<number>>;
|
|
12125
|
+
/**
|
|
12126
|
+
* Get an object flag value with full evaluation details.
|
|
12127
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12128
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12129
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12130
|
+
*/
|
|
12131
|
+
getObjectDetails<T extends object>(
|
|
12132
|
+
flagKey: string,
|
|
12133
|
+
defaultValue: T,
|
|
12134
|
+
context?: EvaluationContext,
|
|
12135
|
+
): Promise<EvaluationDetails<T>>;
|
|
12136
|
+
}
|
|
12003
12137
|
/**
|
|
12004
12138
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
12005
12139
|
*/
|
|
@@ -13838,6 +13972,11 @@ declare namespace TailStream {
|
|
|
13838
13972
|
readonly tag?: string;
|
|
13839
13973
|
readonly message?: string;
|
|
13840
13974
|
}
|
|
13975
|
+
interface TracePreviewInfo {
|
|
13976
|
+
readonly id: string;
|
|
13977
|
+
readonly slug: string;
|
|
13978
|
+
readonly name: string;
|
|
13979
|
+
}
|
|
13841
13980
|
interface Onset {
|
|
13842
13981
|
readonly type: "onset";
|
|
13843
13982
|
readonly attributes: Attribute[];
|
|
@@ -13849,6 +13988,7 @@ declare namespace TailStream {
|
|
|
13849
13988
|
readonly scriptName?: string;
|
|
13850
13989
|
readonly scriptTags?: string[];
|
|
13851
13990
|
readonly scriptVersion?: ScriptVersion;
|
|
13991
|
+
readonly preview?: TracePreviewInfo;
|
|
13852
13992
|
readonly info:
|
|
13853
13993
|
| FetchEventInfo
|
|
13854
13994
|
| ConnectEventInfo
|
package/2022-03-21/index.ts
CHANGED
|
@@ -12016,6 +12016,140 @@ export declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
|
|
|
12016
12016
|
env: Env,
|
|
12017
12017
|
ctx: ExecutionContext<Props>,
|
|
12018
12018
|
) => void | Promise<void>;
|
|
12019
|
+
/**
|
|
12020
|
+
* Evaluation context for targeting rules.
|
|
12021
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
12022
|
+
*/
|
|
12023
|
+
export type EvaluationContext = Record<string, string | number | boolean>;
|
|
12024
|
+
export interface EvaluationDetails<T> {
|
|
12025
|
+
flagKey: string;
|
|
12026
|
+
value: T;
|
|
12027
|
+
variant?: string | undefined;
|
|
12028
|
+
reason?: string | undefined;
|
|
12029
|
+
errorCode?: string | undefined;
|
|
12030
|
+
errorMessage?: string | undefined;
|
|
12031
|
+
}
|
|
12032
|
+
export interface FlagEvaluationError extends Error {}
|
|
12033
|
+
/**
|
|
12034
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
12035
|
+
*
|
|
12036
|
+
* @example
|
|
12037
|
+
* ```typescript
|
|
12038
|
+
* // Get a boolean flag value with a default
|
|
12039
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
12040
|
+
*
|
|
12041
|
+
* // Get a flag value with evaluation context for targeting
|
|
12042
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
12043
|
+
* userId: 'user-123',
|
|
12044
|
+
* country: 'US',
|
|
12045
|
+
* });
|
|
12046
|
+
*
|
|
12047
|
+
* // Get full evaluation details including variant and reason
|
|
12048
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
12049
|
+
* console.log(details.variant, details.reason);
|
|
12050
|
+
* ```
|
|
12051
|
+
*/
|
|
12052
|
+
export declare abstract class Flags {
|
|
12053
|
+
/**
|
|
12054
|
+
* Get a flag value without type checking.
|
|
12055
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12056
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
12057
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12058
|
+
*/
|
|
12059
|
+
get(
|
|
12060
|
+
flagKey: string,
|
|
12061
|
+
defaultValue?: unknown,
|
|
12062
|
+
context?: EvaluationContext,
|
|
12063
|
+
): Promise<unknown>;
|
|
12064
|
+
/**
|
|
12065
|
+
* Get a boolean flag value.
|
|
12066
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12067
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12068
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12069
|
+
*/
|
|
12070
|
+
getBooleanValue(
|
|
12071
|
+
flagKey: string,
|
|
12072
|
+
defaultValue: boolean,
|
|
12073
|
+
context?: EvaluationContext,
|
|
12074
|
+
): Promise<boolean>;
|
|
12075
|
+
/**
|
|
12076
|
+
* Get a string flag value.
|
|
12077
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12078
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12079
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12080
|
+
*/
|
|
12081
|
+
getStringValue(
|
|
12082
|
+
flagKey: string,
|
|
12083
|
+
defaultValue: string,
|
|
12084
|
+
context?: EvaluationContext,
|
|
12085
|
+
): Promise<string>;
|
|
12086
|
+
/**
|
|
12087
|
+
* Get a number flag value.
|
|
12088
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12089
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12090
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12091
|
+
*/
|
|
12092
|
+
getNumberValue(
|
|
12093
|
+
flagKey: string,
|
|
12094
|
+
defaultValue: number,
|
|
12095
|
+
context?: EvaluationContext,
|
|
12096
|
+
): Promise<number>;
|
|
12097
|
+
/**
|
|
12098
|
+
* Get an object flag value.
|
|
12099
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12100
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12101
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12102
|
+
*/
|
|
12103
|
+
getObjectValue<T extends object>(
|
|
12104
|
+
flagKey: string,
|
|
12105
|
+
defaultValue: T,
|
|
12106
|
+
context?: EvaluationContext,
|
|
12107
|
+
): Promise<T>;
|
|
12108
|
+
/**
|
|
12109
|
+
* Get a boolean flag value with full evaluation details.
|
|
12110
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12111
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12112
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12113
|
+
*/
|
|
12114
|
+
getBooleanDetails(
|
|
12115
|
+
flagKey: string,
|
|
12116
|
+
defaultValue: boolean,
|
|
12117
|
+
context?: EvaluationContext,
|
|
12118
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12119
|
+
/**
|
|
12120
|
+
* Get a string flag value with full evaluation details.
|
|
12121
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12122
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12123
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12124
|
+
*/
|
|
12125
|
+
getStringDetails(
|
|
12126
|
+
flagKey: string,
|
|
12127
|
+
defaultValue: string,
|
|
12128
|
+
context?: EvaluationContext,
|
|
12129
|
+
): Promise<EvaluationDetails<string>>;
|
|
12130
|
+
/**
|
|
12131
|
+
* Get a number flag value with full evaluation details.
|
|
12132
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12133
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12134
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12135
|
+
*/
|
|
12136
|
+
getNumberDetails(
|
|
12137
|
+
flagKey: string,
|
|
12138
|
+
defaultValue: number,
|
|
12139
|
+
context?: EvaluationContext,
|
|
12140
|
+
): Promise<EvaluationDetails<number>>;
|
|
12141
|
+
/**
|
|
12142
|
+
* Get an object flag value with full evaluation details.
|
|
12143
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12144
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12145
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12146
|
+
*/
|
|
12147
|
+
getObjectDetails<T extends object>(
|
|
12148
|
+
flagKey: string,
|
|
12149
|
+
defaultValue: T,
|
|
12150
|
+
context?: EvaluationContext,
|
|
12151
|
+
): Promise<EvaluationDetails<T>>;
|
|
12152
|
+
}
|
|
12019
12153
|
/**
|
|
12020
12154
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
12021
12155
|
*/
|
|
@@ -13795,6 +13929,11 @@ export declare namespace TailStream {
|
|
|
13795
13929
|
readonly tag?: string;
|
|
13796
13930
|
readonly message?: string;
|
|
13797
13931
|
}
|
|
13932
|
+
interface TracePreviewInfo {
|
|
13933
|
+
readonly id: string;
|
|
13934
|
+
readonly slug: string;
|
|
13935
|
+
readonly name: string;
|
|
13936
|
+
}
|
|
13798
13937
|
interface Onset {
|
|
13799
13938
|
readonly type: "onset";
|
|
13800
13939
|
readonly attributes: Attribute[];
|
|
@@ -13806,6 +13945,7 @@ export declare namespace TailStream {
|
|
|
13806
13945
|
readonly scriptName?: string;
|
|
13807
13946
|
readonly scriptTags?: string[];
|
|
13808
13947
|
readonly scriptVersion?: ScriptVersion;
|
|
13948
|
+
readonly preview?: TracePreviewInfo;
|
|
13809
13949
|
readonly info:
|
|
13810
13950
|
| FetchEventInfo
|
|
13811
13951
|
| ConnectEventInfo
|
package/2022-08-04/index.d.ts
CHANGED
|
@@ -12001,6 +12001,140 @@ declare module "cloudflare:email" {
|
|
|
12001
12001
|
};
|
|
12002
12002
|
export { _EmailMessage as EmailMessage };
|
|
12003
12003
|
}
|
|
12004
|
+
/**
|
|
12005
|
+
* Evaluation context for targeting rules.
|
|
12006
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
12007
|
+
*/
|
|
12008
|
+
type EvaluationContext = Record<string, string | number | boolean>;
|
|
12009
|
+
interface EvaluationDetails<T> {
|
|
12010
|
+
flagKey: string;
|
|
12011
|
+
value: T;
|
|
12012
|
+
variant?: string | undefined;
|
|
12013
|
+
reason?: string | undefined;
|
|
12014
|
+
errorCode?: string | undefined;
|
|
12015
|
+
errorMessage?: string | undefined;
|
|
12016
|
+
}
|
|
12017
|
+
interface FlagEvaluationError extends Error {}
|
|
12018
|
+
/**
|
|
12019
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
12020
|
+
*
|
|
12021
|
+
* @example
|
|
12022
|
+
* ```typescript
|
|
12023
|
+
* // Get a boolean flag value with a default
|
|
12024
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
12025
|
+
*
|
|
12026
|
+
* // Get a flag value with evaluation context for targeting
|
|
12027
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
12028
|
+
* userId: 'user-123',
|
|
12029
|
+
* country: 'US',
|
|
12030
|
+
* });
|
|
12031
|
+
*
|
|
12032
|
+
* // Get full evaluation details including variant and reason
|
|
12033
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
12034
|
+
* console.log(details.variant, details.reason);
|
|
12035
|
+
* ```
|
|
12036
|
+
*/
|
|
12037
|
+
declare abstract class Flags {
|
|
12038
|
+
/**
|
|
12039
|
+
* Get a flag value without type checking.
|
|
12040
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12041
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
12042
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12043
|
+
*/
|
|
12044
|
+
get(
|
|
12045
|
+
flagKey: string,
|
|
12046
|
+
defaultValue?: unknown,
|
|
12047
|
+
context?: EvaluationContext,
|
|
12048
|
+
): Promise<unknown>;
|
|
12049
|
+
/**
|
|
12050
|
+
* Get a boolean flag value.
|
|
12051
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12052
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12053
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12054
|
+
*/
|
|
12055
|
+
getBooleanValue(
|
|
12056
|
+
flagKey: string,
|
|
12057
|
+
defaultValue: boolean,
|
|
12058
|
+
context?: EvaluationContext,
|
|
12059
|
+
): Promise<boolean>;
|
|
12060
|
+
/**
|
|
12061
|
+
* Get a string flag value.
|
|
12062
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12063
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12064
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12065
|
+
*/
|
|
12066
|
+
getStringValue(
|
|
12067
|
+
flagKey: string,
|
|
12068
|
+
defaultValue: string,
|
|
12069
|
+
context?: EvaluationContext,
|
|
12070
|
+
): Promise<string>;
|
|
12071
|
+
/**
|
|
12072
|
+
* Get a number flag value.
|
|
12073
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12074
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12075
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12076
|
+
*/
|
|
12077
|
+
getNumberValue(
|
|
12078
|
+
flagKey: string,
|
|
12079
|
+
defaultValue: number,
|
|
12080
|
+
context?: EvaluationContext,
|
|
12081
|
+
): Promise<number>;
|
|
12082
|
+
/**
|
|
12083
|
+
* Get an object flag value.
|
|
12084
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12085
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12086
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12087
|
+
*/
|
|
12088
|
+
getObjectValue<T extends object>(
|
|
12089
|
+
flagKey: string,
|
|
12090
|
+
defaultValue: T,
|
|
12091
|
+
context?: EvaluationContext,
|
|
12092
|
+
): Promise<T>;
|
|
12093
|
+
/**
|
|
12094
|
+
* Get a boolean flag value with full evaluation details.
|
|
12095
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12096
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12097
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12098
|
+
*/
|
|
12099
|
+
getBooleanDetails(
|
|
12100
|
+
flagKey: string,
|
|
12101
|
+
defaultValue: boolean,
|
|
12102
|
+
context?: EvaluationContext,
|
|
12103
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12104
|
+
/**
|
|
12105
|
+
* Get a string flag value with full evaluation details.
|
|
12106
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12107
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12108
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12109
|
+
*/
|
|
12110
|
+
getStringDetails(
|
|
12111
|
+
flagKey: string,
|
|
12112
|
+
defaultValue: string,
|
|
12113
|
+
context?: EvaluationContext,
|
|
12114
|
+
): Promise<EvaluationDetails<string>>;
|
|
12115
|
+
/**
|
|
12116
|
+
* Get a number flag value with full evaluation details.
|
|
12117
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12118
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12119
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12120
|
+
*/
|
|
12121
|
+
getNumberDetails(
|
|
12122
|
+
flagKey: string,
|
|
12123
|
+
defaultValue: number,
|
|
12124
|
+
context?: EvaluationContext,
|
|
12125
|
+
): Promise<EvaluationDetails<number>>;
|
|
12126
|
+
/**
|
|
12127
|
+
* Get an object flag value with full evaluation details.
|
|
12128
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12129
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12130
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12131
|
+
*/
|
|
12132
|
+
getObjectDetails<T extends object>(
|
|
12133
|
+
flagKey: string,
|
|
12134
|
+
defaultValue: T,
|
|
12135
|
+
context?: EvaluationContext,
|
|
12136
|
+
): Promise<EvaluationDetails<T>>;
|
|
12137
|
+
}
|
|
12004
12138
|
/**
|
|
12005
12139
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
12006
12140
|
*/
|
|
@@ -13839,6 +13973,11 @@ declare namespace TailStream {
|
|
|
13839
13973
|
readonly tag?: string;
|
|
13840
13974
|
readonly message?: string;
|
|
13841
13975
|
}
|
|
13976
|
+
interface TracePreviewInfo {
|
|
13977
|
+
readonly id: string;
|
|
13978
|
+
readonly slug: string;
|
|
13979
|
+
readonly name: string;
|
|
13980
|
+
}
|
|
13842
13981
|
interface Onset {
|
|
13843
13982
|
readonly type: "onset";
|
|
13844
13983
|
readonly attributes: Attribute[];
|
|
@@ -13850,6 +13989,7 @@ declare namespace TailStream {
|
|
|
13850
13989
|
readonly scriptName?: string;
|
|
13851
13990
|
readonly scriptTags?: string[];
|
|
13852
13991
|
readonly scriptVersion?: ScriptVersion;
|
|
13992
|
+
readonly preview?: TracePreviewInfo;
|
|
13853
13993
|
readonly info:
|
|
13854
13994
|
| FetchEventInfo
|
|
13855
13995
|
| ConnectEventInfo
|
package/2022-08-04/index.ts
CHANGED
|
@@ -12017,6 +12017,140 @@ export declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
|
|
|
12017
12017
|
env: Env,
|
|
12018
12018
|
ctx: ExecutionContext<Props>,
|
|
12019
12019
|
) => void | Promise<void>;
|
|
12020
|
+
/**
|
|
12021
|
+
* Evaluation context for targeting rules.
|
|
12022
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
12023
|
+
*/
|
|
12024
|
+
export type EvaluationContext = Record<string, string | number | boolean>;
|
|
12025
|
+
export interface EvaluationDetails<T> {
|
|
12026
|
+
flagKey: string;
|
|
12027
|
+
value: T;
|
|
12028
|
+
variant?: string | undefined;
|
|
12029
|
+
reason?: string | undefined;
|
|
12030
|
+
errorCode?: string | undefined;
|
|
12031
|
+
errorMessage?: string | undefined;
|
|
12032
|
+
}
|
|
12033
|
+
export interface FlagEvaluationError extends Error {}
|
|
12034
|
+
/**
|
|
12035
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
12036
|
+
*
|
|
12037
|
+
* @example
|
|
12038
|
+
* ```typescript
|
|
12039
|
+
* // Get a boolean flag value with a default
|
|
12040
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
12041
|
+
*
|
|
12042
|
+
* // Get a flag value with evaluation context for targeting
|
|
12043
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
12044
|
+
* userId: 'user-123',
|
|
12045
|
+
* country: 'US',
|
|
12046
|
+
* });
|
|
12047
|
+
*
|
|
12048
|
+
* // Get full evaluation details including variant and reason
|
|
12049
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
12050
|
+
* console.log(details.variant, details.reason);
|
|
12051
|
+
* ```
|
|
12052
|
+
*/
|
|
12053
|
+
export declare abstract class Flags {
|
|
12054
|
+
/**
|
|
12055
|
+
* Get a flag value without type checking.
|
|
12056
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12057
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
12058
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12059
|
+
*/
|
|
12060
|
+
get(
|
|
12061
|
+
flagKey: string,
|
|
12062
|
+
defaultValue?: unknown,
|
|
12063
|
+
context?: EvaluationContext,
|
|
12064
|
+
): Promise<unknown>;
|
|
12065
|
+
/**
|
|
12066
|
+
* Get a boolean flag value.
|
|
12067
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12068
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12069
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12070
|
+
*/
|
|
12071
|
+
getBooleanValue(
|
|
12072
|
+
flagKey: string,
|
|
12073
|
+
defaultValue: boolean,
|
|
12074
|
+
context?: EvaluationContext,
|
|
12075
|
+
): Promise<boolean>;
|
|
12076
|
+
/**
|
|
12077
|
+
* Get a string flag value.
|
|
12078
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12079
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12080
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12081
|
+
*/
|
|
12082
|
+
getStringValue(
|
|
12083
|
+
flagKey: string,
|
|
12084
|
+
defaultValue: string,
|
|
12085
|
+
context?: EvaluationContext,
|
|
12086
|
+
): Promise<string>;
|
|
12087
|
+
/**
|
|
12088
|
+
* Get a number flag value.
|
|
12089
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12090
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12091
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12092
|
+
*/
|
|
12093
|
+
getNumberValue(
|
|
12094
|
+
flagKey: string,
|
|
12095
|
+
defaultValue: number,
|
|
12096
|
+
context?: EvaluationContext,
|
|
12097
|
+
): Promise<number>;
|
|
12098
|
+
/**
|
|
12099
|
+
* Get an object flag value.
|
|
12100
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12101
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12102
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12103
|
+
*/
|
|
12104
|
+
getObjectValue<T extends object>(
|
|
12105
|
+
flagKey: string,
|
|
12106
|
+
defaultValue: T,
|
|
12107
|
+
context?: EvaluationContext,
|
|
12108
|
+
): Promise<T>;
|
|
12109
|
+
/**
|
|
12110
|
+
* Get a boolean flag value with full evaluation details.
|
|
12111
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12112
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12113
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12114
|
+
*/
|
|
12115
|
+
getBooleanDetails(
|
|
12116
|
+
flagKey: string,
|
|
12117
|
+
defaultValue: boolean,
|
|
12118
|
+
context?: EvaluationContext,
|
|
12119
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12120
|
+
/**
|
|
12121
|
+
* Get a string flag value with full evaluation details.
|
|
12122
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12123
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12124
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12125
|
+
*/
|
|
12126
|
+
getStringDetails(
|
|
12127
|
+
flagKey: string,
|
|
12128
|
+
defaultValue: string,
|
|
12129
|
+
context?: EvaluationContext,
|
|
12130
|
+
): Promise<EvaluationDetails<string>>;
|
|
12131
|
+
/**
|
|
12132
|
+
* Get a number flag value with full evaluation details.
|
|
12133
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12134
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12135
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12136
|
+
*/
|
|
12137
|
+
getNumberDetails(
|
|
12138
|
+
flagKey: string,
|
|
12139
|
+
defaultValue: number,
|
|
12140
|
+
context?: EvaluationContext,
|
|
12141
|
+
): Promise<EvaluationDetails<number>>;
|
|
12142
|
+
/**
|
|
12143
|
+
* Get an object flag value with full evaluation details.
|
|
12144
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12145
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12146
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12147
|
+
*/
|
|
12148
|
+
getObjectDetails<T extends object>(
|
|
12149
|
+
flagKey: string,
|
|
12150
|
+
defaultValue: T,
|
|
12151
|
+
context?: EvaluationContext,
|
|
12152
|
+
): Promise<EvaluationDetails<T>>;
|
|
12153
|
+
}
|
|
12020
12154
|
/**
|
|
12021
12155
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
12022
12156
|
*/
|
|
@@ -13796,6 +13930,11 @@ export declare namespace TailStream {
|
|
|
13796
13930
|
readonly tag?: string;
|
|
13797
13931
|
readonly message?: string;
|
|
13798
13932
|
}
|
|
13933
|
+
interface TracePreviewInfo {
|
|
13934
|
+
readonly id: string;
|
|
13935
|
+
readonly slug: string;
|
|
13936
|
+
readonly name: string;
|
|
13937
|
+
}
|
|
13799
13938
|
interface Onset {
|
|
13800
13939
|
readonly type: "onset";
|
|
13801
13940
|
readonly attributes: Attribute[];
|
|
@@ -13807,6 +13946,7 @@ export declare namespace TailStream {
|
|
|
13807
13946
|
readonly scriptName?: string;
|
|
13808
13947
|
readonly scriptTags?: string[];
|
|
13809
13948
|
readonly scriptVersion?: ScriptVersion;
|
|
13949
|
+
readonly preview?: TracePreviewInfo;
|
|
13810
13950
|
readonly info:
|
|
13811
13951
|
| FetchEventInfo
|
|
13812
13952
|
| ConnectEventInfo
|