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