@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/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/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/latest/index.d.ts
CHANGED
|
@@ -10653,6 +10653,7 @@ declare abstract class AiGateway {
|
|
|
10653
10653
|
options?: {
|
|
10654
10654
|
gateway?: UniversalGatewayOptions;
|
|
10655
10655
|
extraHeaders?: object;
|
|
10656
|
+
signal?: AbortSignal;
|
|
10656
10657
|
},
|
|
10657
10658
|
): Promise<Response>;
|
|
10658
10659
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
@@ -12065,6 +12066,140 @@ declare module "cloudflare:email" {
|
|
|
12065
12066
|
};
|
|
12066
12067
|
export { _EmailMessage as EmailMessage };
|
|
12067
12068
|
}
|
|
12069
|
+
/**
|
|
12070
|
+
* Evaluation context for targeting rules.
|
|
12071
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
12072
|
+
*/
|
|
12073
|
+
type EvaluationContext = Record<string, string | number | boolean>;
|
|
12074
|
+
interface EvaluationDetails<T> {
|
|
12075
|
+
flagKey: string;
|
|
12076
|
+
value: T;
|
|
12077
|
+
variant?: string | undefined;
|
|
12078
|
+
reason?: string | undefined;
|
|
12079
|
+
errorCode?: string | undefined;
|
|
12080
|
+
errorMessage?: string | undefined;
|
|
12081
|
+
}
|
|
12082
|
+
interface FlagEvaluationError extends Error {}
|
|
12083
|
+
/**
|
|
12084
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
12085
|
+
*
|
|
12086
|
+
* @example
|
|
12087
|
+
* ```typescript
|
|
12088
|
+
* // Get a boolean flag value with a default
|
|
12089
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
12090
|
+
*
|
|
12091
|
+
* // Get a flag value with evaluation context for targeting
|
|
12092
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
12093
|
+
* userId: 'user-123',
|
|
12094
|
+
* country: 'US',
|
|
12095
|
+
* });
|
|
12096
|
+
*
|
|
12097
|
+
* // Get full evaluation details including variant and reason
|
|
12098
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
12099
|
+
* console.log(details.variant, details.reason);
|
|
12100
|
+
* ```
|
|
12101
|
+
*/
|
|
12102
|
+
declare abstract class Flags {
|
|
12103
|
+
/**
|
|
12104
|
+
* Get a flag value without type checking.
|
|
12105
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12106
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
12107
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12108
|
+
*/
|
|
12109
|
+
get(
|
|
12110
|
+
flagKey: string,
|
|
12111
|
+
defaultValue?: unknown,
|
|
12112
|
+
context?: EvaluationContext,
|
|
12113
|
+
): Promise<unknown>;
|
|
12114
|
+
/**
|
|
12115
|
+
* Get a boolean flag value.
|
|
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
|
+
getBooleanValue(
|
|
12121
|
+
flagKey: string,
|
|
12122
|
+
defaultValue: boolean,
|
|
12123
|
+
context?: EvaluationContext,
|
|
12124
|
+
): Promise<boolean>;
|
|
12125
|
+
/**
|
|
12126
|
+
* Get a string flag value.
|
|
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
|
+
getStringValue(
|
|
12132
|
+
flagKey: string,
|
|
12133
|
+
defaultValue: string,
|
|
12134
|
+
context?: EvaluationContext,
|
|
12135
|
+
): Promise<string>;
|
|
12136
|
+
/**
|
|
12137
|
+
* Get a number flag value.
|
|
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
|
+
getNumberValue(
|
|
12143
|
+
flagKey: string,
|
|
12144
|
+
defaultValue: number,
|
|
12145
|
+
context?: EvaluationContext,
|
|
12146
|
+
): Promise<number>;
|
|
12147
|
+
/**
|
|
12148
|
+
* Get an object flag value.
|
|
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
|
+
getObjectValue<T extends object>(
|
|
12154
|
+
flagKey: string,
|
|
12155
|
+
defaultValue: T,
|
|
12156
|
+
context?: EvaluationContext,
|
|
12157
|
+
): Promise<T>;
|
|
12158
|
+
/**
|
|
12159
|
+
* Get a boolean flag value with full evaluation details.
|
|
12160
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12161
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12162
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12163
|
+
*/
|
|
12164
|
+
getBooleanDetails(
|
|
12165
|
+
flagKey: string,
|
|
12166
|
+
defaultValue: boolean,
|
|
12167
|
+
context?: EvaluationContext,
|
|
12168
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12169
|
+
/**
|
|
12170
|
+
* Get a string flag value with full evaluation details.
|
|
12171
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12172
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12173
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12174
|
+
*/
|
|
12175
|
+
getStringDetails(
|
|
12176
|
+
flagKey: string,
|
|
12177
|
+
defaultValue: string,
|
|
12178
|
+
context?: EvaluationContext,
|
|
12179
|
+
): Promise<EvaluationDetails<string>>;
|
|
12180
|
+
/**
|
|
12181
|
+
* Get a number flag value with full evaluation details.
|
|
12182
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12183
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12184
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12185
|
+
*/
|
|
12186
|
+
getNumberDetails(
|
|
12187
|
+
flagKey: string,
|
|
12188
|
+
defaultValue: number,
|
|
12189
|
+
context?: EvaluationContext,
|
|
12190
|
+
): Promise<EvaluationDetails<number>>;
|
|
12191
|
+
/**
|
|
12192
|
+
* Get an object flag value with full evaluation details.
|
|
12193
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12194
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12195
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12196
|
+
*/
|
|
12197
|
+
getObjectDetails<T extends object>(
|
|
12198
|
+
flagKey: string,
|
|
12199
|
+
defaultValue: T,
|
|
12200
|
+
context?: EvaluationContext,
|
|
12201
|
+
): Promise<EvaluationDetails<T>>;
|
|
12202
|
+
}
|
|
12068
12203
|
/**
|
|
12069
12204
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
12070
12205
|
*/
|
|
@@ -12866,7 +13001,7 @@ declare namespace CloudflareWorkersModule {
|
|
|
12866
13001
|
email?(message: ForwardableEmailMessage): void | Promise<void>;
|
|
12867
13002
|
fetch?(request: Request): Response | Promise<Response>;
|
|
12868
13003
|
connect?(socket: Socket): void | Promise<void>;
|
|
12869
|
-
queue?(batch: MessageBatch
|
|
13004
|
+
queue?(batch: MessageBatch): void | Promise<void>;
|
|
12870
13005
|
scheduled?(controller: ScheduledController): void | Promise<void>;
|
|
12871
13006
|
tail?(events: TraceItem[]): void | Promise<void>;
|
|
12872
13007
|
tailStream?(
|
|
@@ -13903,6 +14038,11 @@ declare namespace TailStream {
|
|
|
13903
14038
|
readonly tag?: string;
|
|
13904
14039
|
readonly message?: string;
|
|
13905
14040
|
}
|
|
14041
|
+
interface TracePreviewInfo {
|
|
14042
|
+
readonly id: string;
|
|
14043
|
+
readonly slug: string;
|
|
14044
|
+
readonly name: string;
|
|
14045
|
+
}
|
|
13906
14046
|
interface Onset {
|
|
13907
14047
|
readonly type: "onset";
|
|
13908
14048
|
readonly attributes: Attribute[];
|
|
@@ -13914,6 +14054,7 @@ declare namespace TailStream {
|
|
|
13914
14054
|
readonly scriptName?: string;
|
|
13915
14055
|
readonly scriptTags?: string[];
|
|
13916
14056
|
readonly scriptVersion?: ScriptVersion;
|
|
14057
|
+
readonly preview?: TracePreviewInfo;
|
|
13917
14058
|
readonly info:
|
|
13918
14059
|
| FetchEventInfo
|
|
13919
14060
|
| ConnectEventInfo
|