@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/2022-08-04/index.d.ts
CHANGED
|
@@ -10589,6 +10589,7 @@ declare abstract class AiGateway {
|
|
|
10589
10589
|
options?: {
|
|
10590
10590
|
gateway?: UniversalGatewayOptions;
|
|
10591
10591
|
extraHeaders?: object;
|
|
10592
|
+
signal?: AbortSignal;
|
|
10592
10593
|
},
|
|
10593
10594
|
): Promise<Response>;
|
|
10594
10595
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
@@ -12001,6 +12002,140 @@ declare module "cloudflare:email" {
|
|
|
12001
12002
|
};
|
|
12002
12003
|
export { _EmailMessage as EmailMessage };
|
|
12003
12004
|
}
|
|
12005
|
+
/**
|
|
12006
|
+
* Evaluation context for targeting rules.
|
|
12007
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
12008
|
+
*/
|
|
12009
|
+
type EvaluationContext = Record<string, string | number | boolean>;
|
|
12010
|
+
interface EvaluationDetails<T> {
|
|
12011
|
+
flagKey: string;
|
|
12012
|
+
value: T;
|
|
12013
|
+
variant?: string | undefined;
|
|
12014
|
+
reason?: string | undefined;
|
|
12015
|
+
errorCode?: string | undefined;
|
|
12016
|
+
errorMessage?: string | undefined;
|
|
12017
|
+
}
|
|
12018
|
+
interface FlagEvaluationError extends Error {}
|
|
12019
|
+
/**
|
|
12020
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
12021
|
+
*
|
|
12022
|
+
* @example
|
|
12023
|
+
* ```typescript
|
|
12024
|
+
* // Get a boolean flag value with a default
|
|
12025
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
12026
|
+
*
|
|
12027
|
+
* // Get a flag value with evaluation context for targeting
|
|
12028
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
12029
|
+
* userId: 'user-123',
|
|
12030
|
+
* country: 'US',
|
|
12031
|
+
* });
|
|
12032
|
+
*
|
|
12033
|
+
* // Get full evaluation details including variant and reason
|
|
12034
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
12035
|
+
* console.log(details.variant, details.reason);
|
|
12036
|
+
* ```
|
|
12037
|
+
*/
|
|
12038
|
+
declare abstract class Flags {
|
|
12039
|
+
/**
|
|
12040
|
+
* Get a flag value without type checking.
|
|
12041
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12042
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
12043
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12044
|
+
*/
|
|
12045
|
+
get(
|
|
12046
|
+
flagKey: string,
|
|
12047
|
+
defaultValue?: unknown,
|
|
12048
|
+
context?: EvaluationContext,
|
|
12049
|
+
): Promise<unknown>;
|
|
12050
|
+
/**
|
|
12051
|
+
* Get a boolean flag value.
|
|
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
|
+
getBooleanValue(
|
|
12057
|
+
flagKey: string,
|
|
12058
|
+
defaultValue: boolean,
|
|
12059
|
+
context?: EvaluationContext,
|
|
12060
|
+
): Promise<boolean>;
|
|
12061
|
+
/**
|
|
12062
|
+
* Get a string flag value.
|
|
12063
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12064
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12065
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12066
|
+
*/
|
|
12067
|
+
getStringValue(
|
|
12068
|
+
flagKey: string,
|
|
12069
|
+
defaultValue: string,
|
|
12070
|
+
context?: EvaluationContext,
|
|
12071
|
+
): Promise<string>;
|
|
12072
|
+
/**
|
|
12073
|
+
* Get a number flag value.
|
|
12074
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12075
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12076
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12077
|
+
*/
|
|
12078
|
+
getNumberValue(
|
|
12079
|
+
flagKey: string,
|
|
12080
|
+
defaultValue: number,
|
|
12081
|
+
context?: EvaluationContext,
|
|
12082
|
+
): Promise<number>;
|
|
12083
|
+
/**
|
|
12084
|
+
* Get an object flag value.
|
|
12085
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12086
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12087
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12088
|
+
*/
|
|
12089
|
+
getObjectValue<T extends object>(
|
|
12090
|
+
flagKey: string,
|
|
12091
|
+
defaultValue: T,
|
|
12092
|
+
context?: EvaluationContext,
|
|
12093
|
+
): Promise<T>;
|
|
12094
|
+
/**
|
|
12095
|
+
* Get a boolean flag value with full evaluation details.
|
|
12096
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12097
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12098
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12099
|
+
*/
|
|
12100
|
+
getBooleanDetails(
|
|
12101
|
+
flagKey: string,
|
|
12102
|
+
defaultValue: boolean,
|
|
12103
|
+
context?: EvaluationContext,
|
|
12104
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12105
|
+
/**
|
|
12106
|
+
* Get a string flag value with full evaluation details.
|
|
12107
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12108
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12109
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12110
|
+
*/
|
|
12111
|
+
getStringDetails(
|
|
12112
|
+
flagKey: string,
|
|
12113
|
+
defaultValue: string,
|
|
12114
|
+
context?: EvaluationContext,
|
|
12115
|
+
): Promise<EvaluationDetails<string>>;
|
|
12116
|
+
/**
|
|
12117
|
+
* Get a number flag value with full evaluation details.
|
|
12118
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12119
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12120
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12121
|
+
*/
|
|
12122
|
+
getNumberDetails(
|
|
12123
|
+
flagKey: string,
|
|
12124
|
+
defaultValue: number,
|
|
12125
|
+
context?: EvaluationContext,
|
|
12126
|
+
): Promise<EvaluationDetails<number>>;
|
|
12127
|
+
/**
|
|
12128
|
+
* Get an object flag value with full evaluation details.
|
|
12129
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12130
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12131
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12132
|
+
*/
|
|
12133
|
+
getObjectDetails<T extends object>(
|
|
12134
|
+
flagKey: string,
|
|
12135
|
+
defaultValue: T,
|
|
12136
|
+
context?: EvaluationContext,
|
|
12137
|
+
): Promise<EvaluationDetails<T>>;
|
|
12138
|
+
}
|
|
12004
12139
|
/**
|
|
12005
12140
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
12006
12141
|
*/
|
|
@@ -12802,7 +12937,7 @@ declare namespace CloudflareWorkersModule {
|
|
|
12802
12937
|
email?(message: ForwardableEmailMessage): void | Promise<void>;
|
|
12803
12938
|
fetch?(request: Request): Response | Promise<Response>;
|
|
12804
12939
|
connect?(socket: Socket): void | Promise<void>;
|
|
12805
|
-
queue?(batch: MessageBatch
|
|
12940
|
+
queue?(batch: MessageBatch): void | Promise<void>;
|
|
12806
12941
|
scheduled?(controller: ScheduledController): void | Promise<void>;
|
|
12807
12942
|
tail?(events: TraceItem[]): void | Promise<void>;
|
|
12808
12943
|
tailStream?(
|
|
@@ -13839,6 +13974,11 @@ declare namespace TailStream {
|
|
|
13839
13974
|
readonly tag?: string;
|
|
13840
13975
|
readonly message?: string;
|
|
13841
13976
|
}
|
|
13977
|
+
interface TracePreviewInfo {
|
|
13978
|
+
readonly id: string;
|
|
13979
|
+
readonly slug: string;
|
|
13980
|
+
readonly name: string;
|
|
13981
|
+
}
|
|
13842
13982
|
interface Onset {
|
|
13843
13983
|
readonly type: "onset";
|
|
13844
13984
|
readonly attributes: Attribute[];
|
|
@@ -13850,6 +13990,7 @@ declare namespace TailStream {
|
|
|
13850
13990
|
readonly scriptName?: string;
|
|
13851
13991
|
readonly scriptTags?: string[];
|
|
13852
13992
|
readonly scriptVersion?: ScriptVersion;
|
|
13993
|
+
readonly preview?: TracePreviewInfo;
|
|
13853
13994
|
readonly info:
|
|
13854
13995
|
| FetchEventInfo
|
|
13855
13996
|
| ConnectEventInfo
|
package/2022-08-04/index.ts
CHANGED
|
@@ -10600,6 +10600,7 @@ export declare abstract class AiGateway {
|
|
|
10600
10600
|
options?: {
|
|
10601
10601
|
gateway?: UniversalGatewayOptions;
|
|
10602
10602
|
extraHeaders?: object;
|
|
10603
|
+
signal?: AbortSignal;
|
|
10603
10604
|
},
|
|
10604
10605
|
): Promise<Response>;
|
|
10605
10606
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
@@ -12017,6 +12018,140 @@ export declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
|
|
|
12017
12018
|
env: Env,
|
|
12018
12019
|
ctx: ExecutionContext<Props>,
|
|
12019
12020
|
) => void | Promise<void>;
|
|
12021
|
+
/**
|
|
12022
|
+
* Evaluation context for targeting rules.
|
|
12023
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
12024
|
+
*/
|
|
12025
|
+
export type EvaluationContext = Record<string, string | number | boolean>;
|
|
12026
|
+
export interface EvaluationDetails<T> {
|
|
12027
|
+
flagKey: string;
|
|
12028
|
+
value: T;
|
|
12029
|
+
variant?: string | undefined;
|
|
12030
|
+
reason?: string | undefined;
|
|
12031
|
+
errorCode?: string | undefined;
|
|
12032
|
+
errorMessage?: string | undefined;
|
|
12033
|
+
}
|
|
12034
|
+
export interface FlagEvaluationError extends Error {}
|
|
12035
|
+
/**
|
|
12036
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
12037
|
+
*
|
|
12038
|
+
* @example
|
|
12039
|
+
* ```typescript
|
|
12040
|
+
* // Get a boolean flag value with a default
|
|
12041
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
12042
|
+
*
|
|
12043
|
+
* // Get a flag value with evaluation context for targeting
|
|
12044
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
12045
|
+
* userId: 'user-123',
|
|
12046
|
+
* country: 'US',
|
|
12047
|
+
* });
|
|
12048
|
+
*
|
|
12049
|
+
* // Get full evaluation details including variant and reason
|
|
12050
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
12051
|
+
* console.log(details.variant, details.reason);
|
|
12052
|
+
* ```
|
|
12053
|
+
*/
|
|
12054
|
+
export declare abstract class Flags {
|
|
12055
|
+
/**
|
|
12056
|
+
* Get a flag value without type checking.
|
|
12057
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12058
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
12059
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12060
|
+
*/
|
|
12061
|
+
get(
|
|
12062
|
+
flagKey: string,
|
|
12063
|
+
defaultValue?: unknown,
|
|
12064
|
+
context?: EvaluationContext,
|
|
12065
|
+
): Promise<unknown>;
|
|
12066
|
+
/**
|
|
12067
|
+
* Get a boolean flag value.
|
|
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
|
+
getBooleanValue(
|
|
12073
|
+
flagKey: string,
|
|
12074
|
+
defaultValue: boolean,
|
|
12075
|
+
context?: EvaluationContext,
|
|
12076
|
+
): Promise<boolean>;
|
|
12077
|
+
/**
|
|
12078
|
+
* Get a string flag value.
|
|
12079
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12080
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12081
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12082
|
+
*/
|
|
12083
|
+
getStringValue(
|
|
12084
|
+
flagKey: string,
|
|
12085
|
+
defaultValue: string,
|
|
12086
|
+
context?: EvaluationContext,
|
|
12087
|
+
): Promise<string>;
|
|
12088
|
+
/**
|
|
12089
|
+
* Get a number flag value.
|
|
12090
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12091
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12092
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12093
|
+
*/
|
|
12094
|
+
getNumberValue(
|
|
12095
|
+
flagKey: string,
|
|
12096
|
+
defaultValue: number,
|
|
12097
|
+
context?: EvaluationContext,
|
|
12098
|
+
): Promise<number>;
|
|
12099
|
+
/**
|
|
12100
|
+
* Get an object flag value.
|
|
12101
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12102
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12103
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12104
|
+
*/
|
|
12105
|
+
getObjectValue<T extends object>(
|
|
12106
|
+
flagKey: string,
|
|
12107
|
+
defaultValue: T,
|
|
12108
|
+
context?: EvaluationContext,
|
|
12109
|
+
): Promise<T>;
|
|
12110
|
+
/**
|
|
12111
|
+
* Get a boolean flag value with full evaluation details.
|
|
12112
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12113
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12114
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12115
|
+
*/
|
|
12116
|
+
getBooleanDetails(
|
|
12117
|
+
flagKey: string,
|
|
12118
|
+
defaultValue: boolean,
|
|
12119
|
+
context?: EvaluationContext,
|
|
12120
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12121
|
+
/**
|
|
12122
|
+
* Get a string flag value with full evaluation details.
|
|
12123
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12124
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12125
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12126
|
+
*/
|
|
12127
|
+
getStringDetails(
|
|
12128
|
+
flagKey: string,
|
|
12129
|
+
defaultValue: string,
|
|
12130
|
+
context?: EvaluationContext,
|
|
12131
|
+
): Promise<EvaluationDetails<string>>;
|
|
12132
|
+
/**
|
|
12133
|
+
* Get a number flag value with full evaluation details.
|
|
12134
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12135
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12136
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12137
|
+
*/
|
|
12138
|
+
getNumberDetails(
|
|
12139
|
+
flagKey: string,
|
|
12140
|
+
defaultValue: number,
|
|
12141
|
+
context?: EvaluationContext,
|
|
12142
|
+
): Promise<EvaluationDetails<number>>;
|
|
12143
|
+
/**
|
|
12144
|
+
* Get an object flag value with full evaluation details.
|
|
12145
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12146
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12147
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12148
|
+
*/
|
|
12149
|
+
getObjectDetails<T extends object>(
|
|
12150
|
+
flagKey: string,
|
|
12151
|
+
defaultValue: T,
|
|
12152
|
+
context?: EvaluationContext,
|
|
12153
|
+
): Promise<EvaluationDetails<T>>;
|
|
12154
|
+
}
|
|
12020
12155
|
/**
|
|
12021
12156
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
12022
12157
|
*/
|
|
@@ -12769,7 +12904,7 @@ export declare namespace CloudflareWorkersModule {
|
|
|
12769
12904
|
email?(message: ForwardableEmailMessage): void | Promise<void>;
|
|
12770
12905
|
fetch?(request: Request): Response | Promise<Response>;
|
|
12771
12906
|
connect?(socket: Socket): void | Promise<void>;
|
|
12772
|
-
queue?(batch: MessageBatch
|
|
12907
|
+
queue?(batch: MessageBatch): void | Promise<void>;
|
|
12773
12908
|
scheduled?(controller: ScheduledController): void | Promise<void>;
|
|
12774
12909
|
tail?(events: TraceItem[]): void | Promise<void>;
|
|
12775
12910
|
tailStream?(
|
|
@@ -13796,6 +13931,11 @@ export declare namespace TailStream {
|
|
|
13796
13931
|
readonly tag?: string;
|
|
13797
13932
|
readonly message?: string;
|
|
13798
13933
|
}
|
|
13934
|
+
interface TracePreviewInfo {
|
|
13935
|
+
readonly id: string;
|
|
13936
|
+
readonly slug: string;
|
|
13937
|
+
readonly name: string;
|
|
13938
|
+
}
|
|
13799
13939
|
interface Onset {
|
|
13800
13940
|
readonly type: "onset";
|
|
13801
13941
|
readonly attributes: Attribute[];
|
|
@@ -13807,6 +13947,7 @@ export declare namespace TailStream {
|
|
|
13807
13947
|
readonly scriptName?: string;
|
|
13808
13948
|
readonly scriptTags?: string[];
|
|
13809
13949
|
readonly scriptVersion?: ScriptVersion;
|
|
13950
|
+
readonly preview?: TracePreviewInfo;
|
|
13810
13951
|
readonly info:
|
|
13811
13952
|
| FetchEventInfo
|
|
13812
13953
|
| ConnectEventInfo
|
package/2022-10-31/index.d.ts
CHANGED
|
@@ -10609,6 +10609,7 @@ declare abstract class AiGateway {
|
|
|
10609
10609
|
options?: {
|
|
10610
10610
|
gateway?: UniversalGatewayOptions;
|
|
10611
10611
|
extraHeaders?: object;
|
|
10612
|
+
signal?: AbortSignal;
|
|
10612
10613
|
},
|
|
10613
10614
|
): Promise<Response>;
|
|
10614
10615
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
@@ -12021,6 +12022,140 @@ declare module "cloudflare:email" {
|
|
|
12021
12022
|
};
|
|
12022
12023
|
export { _EmailMessage as EmailMessage };
|
|
12023
12024
|
}
|
|
12025
|
+
/**
|
|
12026
|
+
* Evaluation context for targeting rules.
|
|
12027
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
12028
|
+
*/
|
|
12029
|
+
type EvaluationContext = Record<string, string | number | boolean>;
|
|
12030
|
+
interface EvaluationDetails<T> {
|
|
12031
|
+
flagKey: string;
|
|
12032
|
+
value: T;
|
|
12033
|
+
variant?: string | undefined;
|
|
12034
|
+
reason?: string | undefined;
|
|
12035
|
+
errorCode?: string | undefined;
|
|
12036
|
+
errorMessage?: string | undefined;
|
|
12037
|
+
}
|
|
12038
|
+
interface FlagEvaluationError extends Error {}
|
|
12039
|
+
/**
|
|
12040
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
12041
|
+
*
|
|
12042
|
+
* @example
|
|
12043
|
+
* ```typescript
|
|
12044
|
+
* // Get a boolean flag value with a default
|
|
12045
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
12046
|
+
*
|
|
12047
|
+
* // Get a flag value with evaluation context for targeting
|
|
12048
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
12049
|
+
* userId: 'user-123',
|
|
12050
|
+
* country: 'US',
|
|
12051
|
+
* });
|
|
12052
|
+
*
|
|
12053
|
+
* // Get full evaluation details including variant and reason
|
|
12054
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
12055
|
+
* console.log(details.variant, details.reason);
|
|
12056
|
+
* ```
|
|
12057
|
+
*/
|
|
12058
|
+
declare abstract class Flags {
|
|
12059
|
+
/**
|
|
12060
|
+
* Get a flag value without type checking.
|
|
12061
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12062
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
12063
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12064
|
+
*/
|
|
12065
|
+
get(
|
|
12066
|
+
flagKey: string,
|
|
12067
|
+
defaultValue?: unknown,
|
|
12068
|
+
context?: EvaluationContext,
|
|
12069
|
+
): Promise<unknown>;
|
|
12070
|
+
/**
|
|
12071
|
+
* Get a boolean 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
|
+
getBooleanValue(
|
|
12077
|
+
flagKey: string,
|
|
12078
|
+
defaultValue: boolean,
|
|
12079
|
+
context?: EvaluationContext,
|
|
12080
|
+
): Promise<boolean>;
|
|
12081
|
+
/**
|
|
12082
|
+
* Get a string 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
|
+
getStringValue(
|
|
12088
|
+
flagKey: string,
|
|
12089
|
+
defaultValue: string,
|
|
12090
|
+
context?: EvaluationContext,
|
|
12091
|
+
): Promise<string>;
|
|
12092
|
+
/**
|
|
12093
|
+
* Get a number flag value.
|
|
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
|
+
getNumberValue(
|
|
12099
|
+
flagKey: string,
|
|
12100
|
+
defaultValue: number,
|
|
12101
|
+
context?: EvaluationContext,
|
|
12102
|
+
): Promise<number>;
|
|
12103
|
+
/**
|
|
12104
|
+
* Get an object flag value.
|
|
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
|
+
getObjectValue<T extends object>(
|
|
12110
|
+
flagKey: string,
|
|
12111
|
+
defaultValue: T,
|
|
12112
|
+
context?: EvaluationContext,
|
|
12113
|
+
): Promise<T>;
|
|
12114
|
+
/**
|
|
12115
|
+
* Get a boolean 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
|
+
getBooleanDetails(
|
|
12121
|
+
flagKey: string,
|
|
12122
|
+
defaultValue: boolean,
|
|
12123
|
+
context?: EvaluationContext,
|
|
12124
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12125
|
+
/**
|
|
12126
|
+
* Get a string 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
|
+
getStringDetails(
|
|
12132
|
+
flagKey: string,
|
|
12133
|
+
defaultValue: string,
|
|
12134
|
+
context?: EvaluationContext,
|
|
12135
|
+
): Promise<EvaluationDetails<string>>;
|
|
12136
|
+
/**
|
|
12137
|
+
* Get a number flag value with full evaluation details.
|
|
12138
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12139
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12140
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12141
|
+
*/
|
|
12142
|
+
getNumberDetails(
|
|
12143
|
+
flagKey: string,
|
|
12144
|
+
defaultValue: number,
|
|
12145
|
+
context?: EvaluationContext,
|
|
12146
|
+
): Promise<EvaluationDetails<number>>;
|
|
12147
|
+
/**
|
|
12148
|
+
* Get an object flag value with full evaluation details.
|
|
12149
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12150
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12151
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12152
|
+
*/
|
|
12153
|
+
getObjectDetails<T extends object>(
|
|
12154
|
+
flagKey: string,
|
|
12155
|
+
defaultValue: T,
|
|
12156
|
+
context?: EvaluationContext,
|
|
12157
|
+
): Promise<EvaluationDetails<T>>;
|
|
12158
|
+
}
|
|
12024
12159
|
/**
|
|
12025
12160
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
12026
12161
|
*/
|
|
@@ -12822,7 +12957,7 @@ declare namespace CloudflareWorkersModule {
|
|
|
12822
12957
|
email?(message: ForwardableEmailMessage): void | Promise<void>;
|
|
12823
12958
|
fetch?(request: Request): Response | Promise<Response>;
|
|
12824
12959
|
connect?(socket: Socket): void | Promise<void>;
|
|
12825
|
-
queue?(batch: MessageBatch
|
|
12960
|
+
queue?(batch: MessageBatch): void | Promise<void>;
|
|
12826
12961
|
scheduled?(controller: ScheduledController): void | Promise<void>;
|
|
12827
12962
|
tail?(events: TraceItem[]): void | Promise<void>;
|
|
12828
12963
|
tailStream?(
|
|
@@ -13859,6 +13994,11 @@ declare namespace TailStream {
|
|
|
13859
13994
|
readonly tag?: string;
|
|
13860
13995
|
readonly message?: string;
|
|
13861
13996
|
}
|
|
13997
|
+
interface TracePreviewInfo {
|
|
13998
|
+
readonly id: string;
|
|
13999
|
+
readonly slug: string;
|
|
14000
|
+
readonly name: string;
|
|
14001
|
+
}
|
|
13862
14002
|
interface Onset {
|
|
13863
14003
|
readonly type: "onset";
|
|
13864
14004
|
readonly attributes: Attribute[];
|
|
@@ -13870,6 +14010,7 @@ declare namespace TailStream {
|
|
|
13870
14010
|
readonly scriptName?: string;
|
|
13871
14011
|
readonly scriptTags?: string[];
|
|
13872
14012
|
readonly scriptVersion?: ScriptVersion;
|
|
14013
|
+
readonly preview?: TracePreviewInfo;
|
|
13873
14014
|
readonly info:
|
|
13874
14015
|
| FetchEventInfo
|
|
13875
14016
|
| ConnectEventInfo
|