@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/2023-07-01/index.ts
CHANGED
|
@@ -10631,6 +10631,7 @@ export declare abstract class AiGateway {
|
|
|
10631
10631
|
options?: {
|
|
10632
10632
|
gateway?: UniversalGatewayOptions;
|
|
10633
10633
|
extraHeaders?: object;
|
|
10634
|
+
signal?: AbortSignal;
|
|
10634
10635
|
},
|
|
10635
10636
|
): Promise<Response>;
|
|
10636
10637
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
@@ -12048,6 +12049,140 @@ export declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
|
|
|
12048
12049
|
env: Env,
|
|
12049
12050
|
ctx: ExecutionContext<Props>,
|
|
12050
12051
|
) => void | Promise<void>;
|
|
12052
|
+
/**
|
|
12053
|
+
* Evaluation context for targeting rules.
|
|
12054
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
12055
|
+
*/
|
|
12056
|
+
export type EvaluationContext = Record<string, string | number | boolean>;
|
|
12057
|
+
export interface EvaluationDetails<T> {
|
|
12058
|
+
flagKey: string;
|
|
12059
|
+
value: T;
|
|
12060
|
+
variant?: string | undefined;
|
|
12061
|
+
reason?: string | undefined;
|
|
12062
|
+
errorCode?: string | undefined;
|
|
12063
|
+
errorMessage?: string | undefined;
|
|
12064
|
+
}
|
|
12065
|
+
export interface FlagEvaluationError extends Error {}
|
|
12066
|
+
/**
|
|
12067
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
12068
|
+
*
|
|
12069
|
+
* @example
|
|
12070
|
+
* ```typescript
|
|
12071
|
+
* // Get a boolean flag value with a default
|
|
12072
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
12073
|
+
*
|
|
12074
|
+
* // Get a flag value with evaluation context for targeting
|
|
12075
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
12076
|
+
* userId: 'user-123',
|
|
12077
|
+
* country: 'US',
|
|
12078
|
+
* });
|
|
12079
|
+
*
|
|
12080
|
+
* // Get full evaluation details including variant and reason
|
|
12081
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
12082
|
+
* console.log(details.variant, details.reason);
|
|
12083
|
+
* ```
|
|
12084
|
+
*/
|
|
12085
|
+
export declare abstract class Flags {
|
|
12086
|
+
/**
|
|
12087
|
+
* Get a flag value without type checking.
|
|
12088
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12089
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
12090
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12091
|
+
*/
|
|
12092
|
+
get(
|
|
12093
|
+
flagKey: string,
|
|
12094
|
+
defaultValue?: unknown,
|
|
12095
|
+
context?: EvaluationContext,
|
|
12096
|
+
): Promise<unknown>;
|
|
12097
|
+
/**
|
|
12098
|
+
* Get a boolean 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
|
+
getBooleanValue(
|
|
12104
|
+
flagKey: string,
|
|
12105
|
+
defaultValue: boolean,
|
|
12106
|
+
context?: EvaluationContext,
|
|
12107
|
+
): Promise<boolean>;
|
|
12108
|
+
/**
|
|
12109
|
+
* Get a string flag value.
|
|
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
|
+
getStringValue(
|
|
12115
|
+
flagKey: string,
|
|
12116
|
+
defaultValue: string,
|
|
12117
|
+
context?: EvaluationContext,
|
|
12118
|
+
): Promise<string>;
|
|
12119
|
+
/**
|
|
12120
|
+
* Get a number flag value.
|
|
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
|
+
getNumberValue(
|
|
12126
|
+
flagKey: string,
|
|
12127
|
+
defaultValue: number,
|
|
12128
|
+
context?: EvaluationContext,
|
|
12129
|
+
): Promise<number>;
|
|
12130
|
+
/**
|
|
12131
|
+
* Get an object 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
|
+
getObjectValue<T extends object>(
|
|
12137
|
+
flagKey: string,
|
|
12138
|
+
defaultValue: T,
|
|
12139
|
+
context?: EvaluationContext,
|
|
12140
|
+
): Promise<T>;
|
|
12141
|
+
/**
|
|
12142
|
+
* Get a boolean 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
|
+
getBooleanDetails(
|
|
12148
|
+
flagKey: string,
|
|
12149
|
+
defaultValue: boolean,
|
|
12150
|
+
context?: EvaluationContext,
|
|
12151
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12152
|
+
/**
|
|
12153
|
+
* Get a string flag value with full evaluation details.
|
|
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
|
+
getStringDetails(
|
|
12159
|
+
flagKey: string,
|
|
12160
|
+
defaultValue: string,
|
|
12161
|
+
context?: EvaluationContext,
|
|
12162
|
+
): Promise<EvaluationDetails<string>>;
|
|
12163
|
+
/**
|
|
12164
|
+
* Get a number flag value with full evaluation details.
|
|
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
|
+
getNumberDetails(
|
|
12170
|
+
flagKey: string,
|
|
12171
|
+
defaultValue: number,
|
|
12172
|
+
context?: EvaluationContext,
|
|
12173
|
+
): Promise<EvaluationDetails<number>>;
|
|
12174
|
+
/**
|
|
12175
|
+
* Get an object 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
|
+
getObjectDetails<T extends object>(
|
|
12181
|
+
flagKey: string,
|
|
12182
|
+
defaultValue: T,
|
|
12183
|
+
context?: EvaluationContext,
|
|
12184
|
+
): Promise<EvaluationDetails<T>>;
|
|
12185
|
+
}
|
|
12051
12186
|
/**
|
|
12052
12187
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
12053
12188
|
*/
|
|
@@ -12800,7 +12935,7 @@ export declare namespace CloudflareWorkersModule {
|
|
|
12800
12935
|
email?(message: ForwardableEmailMessage): void | Promise<void>;
|
|
12801
12936
|
fetch?(request: Request): Response | Promise<Response>;
|
|
12802
12937
|
connect?(socket: Socket): void | Promise<void>;
|
|
12803
|
-
queue?(batch: MessageBatch
|
|
12938
|
+
queue?(batch: MessageBatch): void | Promise<void>;
|
|
12804
12939
|
scheduled?(controller: ScheduledController): void | Promise<void>;
|
|
12805
12940
|
tail?(events: TraceItem[]): void | Promise<void>;
|
|
12806
12941
|
tailStream?(
|
|
@@ -13827,6 +13962,11 @@ export declare namespace TailStream {
|
|
|
13827
13962
|
readonly tag?: string;
|
|
13828
13963
|
readonly message?: string;
|
|
13829
13964
|
}
|
|
13965
|
+
interface TracePreviewInfo {
|
|
13966
|
+
readonly id: string;
|
|
13967
|
+
readonly slug: string;
|
|
13968
|
+
readonly name: string;
|
|
13969
|
+
}
|
|
13830
13970
|
interface Onset {
|
|
13831
13971
|
readonly type: "onset";
|
|
13832
13972
|
readonly attributes: Attribute[];
|
|
@@ -13838,6 +13978,7 @@ export declare namespace TailStream {
|
|
|
13838
13978
|
readonly scriptName?: string;
|
|
13839
13979
|
readonly scriptTags?: string[];
|
|
13840
13980
|
readonly scriptVersion?: ScriptVersion;
|
|
13981
|
+
readonly preview?: TracePreviewInfo;
|
|
13841
13982
|
readonly info:
|
|
13842
13983
|
| FetchEventInfo
|
|
13843
13984
|
| ConnectEventInfo
|
package/experimental/index.d.ts
CHANGED
|
@@ -11345,6 +11345,7 @@ declare abstract class AiGateway {
|
|
|
11345
11345
|
options?: {
|
|
11346
11346
|
gateway?: UniversalGatewayOptions;
|
|
11347
11347
|
extraHeaders?: object;
|
|
11348
|
+
signal?: AbortSignal;
|
|
11348
11349
|
},
|
|
11349
11350
|
): Promise<Response>;
|
|
11350
11351
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
@@ -12757,6 +12758,140 @@ declare module "cloudflare:email" {
|
|
|
12757
12758
|
};
|
|
12758
12759
|
export { _EmailMessage as EmailMessage };
|
|
12759
12760
|
}
|
|
12761
|
+
/**
|
|
12762
|
+
* Evaluation context for targeting rules.
|
|
12763
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
12764
|
+
*/
|
|
12765
|
+
type EvaluationContext = Record<string, string | number | boolean>;
|
|
12766
|
+
interface EvaluationDetails<T> {
|
|
12767
|
+
flagKey: string;
|
|
12768
|
+
value: T;
|
|
12769
|
+
variant?: string | undefined;
|
|
12770
|
+
reason?: string | undefined;
|
|
12771
|
+
errorCode?: string | undefined;
|
|
12772
|
+
errorMessage?: string | undefined;
|
|
12773
|
+
}
|
|
12774
|
+
interface FlagEvaluationError extends Error {}
|
|
12775
|
+
/**
|
|
12776
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
12777
|
+
*
|
|
12778
|
+
* @example
|
|
12779
|
+
* ```typescript
|
|
12780
|
+
* // Get a boolean flag value with a default
|
|
12781
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
12782
|
+
*
|
|
12783
|
+
* // Get a flag value with evaluation context for targeting
|
|
12784
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
12785
|
+
* userId: 'user-123',
|
|
12786
|
+
* country: 'US',
|
|
12787
|
+
* });
|
|
12788
|
+
*
|
|
12789
|
+
* // Get full evaluation details including variant and reason
|
|
12790
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
12791
|
+
* console.log(details.variant, details.reason);
|
|
12792
|
+
* ```
|
|
12793
|
+
*/
|
|
12794
|
+
declare abstract class Flags {
|
|
12795
|
+
/**
|
|
12796
|
+
* Get a flag value without type checking.
|
|
12797
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12798
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
12799
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12800
|
+
*/
|
|
12801
|
+
get(
|
|
12802
|
+
flagKey: string,
|
|
12803
|
+
defaultValue?: unknown,
|
|
12804
|
+
context?: EvaluationContext,
|
|
12805
|
+
): Promise<unknown>;
|
|
12806
|
+
/**
|
|
12807
|
+
* Get a boolean flag value.
|
|
12808
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12809
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12810
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12811
|
+
*/
|
|
12812
|
+
getBooleanValue(
|
|
12813
|
+
flagKey: string,
|
|
12814
|
+
defaultValue: boolean,
|
|
12815
|
+
context?: EvaluationContext,
|
|
12816
|
+
): Promise<boolean>;
|
|
12817
|
+
/**
|
|
12818
|
+
* Get a string flag value.
|
|
12819
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12820
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12821
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12822
|
+
*/
|
|
12823
|
+
getStringValue(
|
|
12824
|
+
flagKey: string,
|
|
12825
|
+
defaultValue: string,
|
|
12826
|
+
context?: EvaluationContext,
|
|
12827
|
+
): Promise<string>;
|
|
12828
|
+
/**
|
|
12829
|
+
* Get a number flag value.
|
|
12830
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12831
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12832
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12833
|
+
*/
|
|
12834
|
+
getNumberValue(
|
|
12835
|
+
flagKey: string,
|
|
12836
|
+
defaultValue: number,
|
|
12837
|
+
context?: EvaluationContext,
|
|
12838
|
+
): Promise<number>;
|
|
12839
|
+
/**
|
|
12840
|
+
* Get an object flag value.
|
|
12841
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12842
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12843
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12844
|
+
*/
|
|
12845
|
+
getObjectValue<T extends object>(
|
|
12846
|
+
flagKey: string,
|
|
12847
|
+
defaultValue: T,
|
|
12848
|
+
context?: EvaluationContext,
|
|
12849
|
+
): Promise<T>;
|
|
12850
|
+
/**
|
|
12851
|
+
* Get a boolean flag value with full evaluation details.
|
|
12852
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12853
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12854
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12855
|
+
*/
|
|
12856
|
+
getBooleanDetails(
|
|
12857
|
+
flagKey: string,
|
|
12858
|
+
defaultValue: boolean,
|
|
12859
|
+
context?: EvaluationContext,
|
|
12860
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12861
|
+
/**
|
|
12862
|
+
* Get a string flag value with full evaluation details.
|
|
12863
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12864
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12865
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12866
|
+
*/
|
|
12867
|
+
getStringDetails(
|
|
12868
|
+
flagKey: string,
|
|
12869
|
+
defaultValue: string,
|
|
12870
|
+
context?: EvaluationContext,
|
|
12871
|
+
): Promise<EvaluationDetails<string>>;
|
|
12872
|
+
/**
|
|
12873
|
+
* Get a number flag value with full evaluation details.
|
|
12874
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12875
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12876
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12877
|
+
*/
|
|
12878
|
+
getNumberDetails(
|
|
12879
|
+
flagKey: string,
|
|
12880
|
+
defaultValue: number,
|
|
12881
|
+
context?: EvaluationContext,
|
|
12882
|
+
): Promise<EvaluationDetails<number>>;
|
|
12883
|
+
/**
|
|
12884
|
+
* Get an object flag value with full evaluation details.
|
|
12885
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12886
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12887
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12888
|
+
*/
|
|
12889
|
+
getObjectDetails<T extends object>(
|
|
12890
|
+
flagKey: string,
|
|
12891
|
+
defaultValue: T,
|
|
12892
|
+
context?: EvaluationContext,
|
|
12893
|
+
): Promise<EvaluationDetails<T>>;
|
|
12894
|
+
}
|
|
12760
12895
|
/**
|
|
12761
12896
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
12762
12897
|
*/
|
|
@@ -13558,7 +13693,7 @@ declare namespace CloudflareWorkersModule {
|
|
|
13558
13693
|
email?(message: ForwardableEmailMessage): void | Promise<void>;
|
|
13559
13694
|
fetch?(request: Request): Response | Promise<Response>;
|
|
13560
13695
|
connect?(socket: Socket): void | Promise<void>;
|
|
13561
|
-
queue?(batch: MessageBatch
|
|
13696
|
+
queue?(batch: MessageBatch): void | Promise<void>;
|
|
13562
13697
|
scheduled?(controller: ScheduledController): void | Promise<void>;
|
|
13563
13698
|
tail?(events: TraceItem[]): void | Promise<void>;
|
|
13564
13699
|
tailStream?(
|
|
@@ -14595,6 +14730,11 @@ declare namespace TailStream {
|
|
|
14595
14730
|
readonly tag?: string;
|
|
14596
14731
|
readonly message?: string;
|
|
14597
14732
|
}
|
|
14733
|
+
interface TracePreviewInfo {
|
|
14734
|
+
readonly id: string;
|
|
14735
|
+
readonly slug: string;
|
|
14736
|
+
readonly name: string;
|
|
14737
|
+
}
|
|
14598
14738
|
interface Onset {
|
|
14599
14739
|
readonly type: "onset";
|
|
14600
14740
|
readonly attributes: Attribute[];
|
|
@@ -14606,6 +14746,7 @@ declare namespace TailStream {
|
|
|
14606
14746
|
readonly scriptName?: string;
|
|
14607
14747
|
readonly scriptTags?: string[];
|
|
14608
14748
|
readonly scriptVersion?: ScriptVersion;
|
|
14749
|
+
readonly preview?: TracePreviewInfo;
|
|
14609
14750
|
readonly info:
|
|
14610
14751
|
| FetchEventInfo
|
|
14611
14752
|
| ConnectEventInfo
|
package/experimental/index.ts
CHANGED
|
@@ -11356,6 +11356,7 @@ export declare abstract class AiGateway {
|
|
|
11356
11356
|
options?: {
|
|
11357
11357
|
gateway?: UniversalGatewayOptions;
|
|
11358
11358
|
extraHeaders?: object;
|
|
11359
|
+
signal?: AbortSignal;
|
|
11359
11360
|
},
|
|
11360
11361
|
): Promise<Response>;
|
|
11361
11362
|
getUrl(provider?: AIGatewayProviders | string): Promise<string>; // eslint-disable-line
|
|
@@ -12773,6 +12774,140 @@ export declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
|
|
|
12773
12774
|
env: Env,
|
|
12774
12775
|
ctx: ExecutionContext<Props>,
|
|
12775
12776
|
) => void | Promise<void>;
|
|
12777
|
+
/**
|
|
12778
|
+
* Evaluation context for targeting rules.
|
|
12779
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
12780
|
+
*/
|
|
12781
|
+
export type EvaluationContext = Record<string, string | number | boolean>;
|
|
12782
|
+
export interface EvaluationDetails<T> {
|
|
12783
|
+
flagKey: string;
|
|
12784
|
+
value: T;
|
|
12785
|
+
variant?: string | undefined;
|
|
12786
|
+
reason?: string | undefined;
|
|
12787
|
+
errorCode?: string | undefined;
|
|
12788
|
+
errorMessage?: string | undefined;
|
|
12789
|
+
}
|
|
12790
|
+
export interface FlagEvaluationError extends Error {}
|
|
12791
|
+
/**
|
|
12792
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
12793
|
+
*
|
|
12794
|
+
* @example
|
|
12795
|
+
* ```typescript
|
|
12796
|
+
* // Get a boolean flag value with a default
|
|
12797
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
12798
|
+
*
|
|
12799
|
+
* // Get a flag value with evaluation context for targeting
|
|
12800
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
12801
|
+
* userId: 'user-123',
|
|
12802
|
+
* country: 'US',
|
|
12803
|
+
* });
|
|
12804
|
+
*
|
|
12805
|
+
* // Get full evaluation details including variant and reason
|
|
12806
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
12807
|
+
* console.log(details.variant, details.reason);
|
|
12808
|
+
* ```
|
|
12809
|
+
*/
|
|
12810
|
+
export declare abstract class Flags {
|
|
12811
|
+
/**
|
|
12812
|
+
* Get a flag value without type checking.
|
|
12813
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12814
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
12815
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12816
|
+
*/
|
|
12817
|
+
get(
|
|
12818
|
+
flagKey: string,
|
|
12819
|
+
defaultValue?: unknown,
|
|
12820
|
+
context?: EvaluationContext,
|
|
12821
|
+
): Promise<unknown>;
|
|
12822
|
+
/**
|
|
12823
|
+
* Get a boolean flag value.
|
|
12824
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12825
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12826
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12827
|
+
*/
|
|
12828
|
+
getBooleanValue(
|
|
12829
|
+
flagKey: string,
|
|
12830
|
+
defaultValue: boolean,
|
|
12831
|
+
context?: EvaluationContext,
|
|
12832
|
+
): Promise<boolean>;
|
|
12833
|
+
/**
|
|
12834
|
+
* Get a string flag value.
|
|
12835
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12836
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12837
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12838
|
+
*/
|
|
12839
|
+
getStringValue(
|
|
12840
|
+
flagKey: string,
|
|
12841
|
+
defaultValue: string,
|
|
12842
|
+
context?: EvaluationContext,
|
|
12843
|
+
): Promise<string>;
|
|
12844
|
+
/**
|
|
12845
|
+
* Get a number flag value.
|
|
12846
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12847
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12848
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12849
|
+
*/
|
|
12850
|
+
getNumberValue(
|
|
12851
|
+
flagKey: string,
|
|
12852
|
+
defaultValue: number,
|
|
12853
|
+
context?: EvaluationContext,
|
|
12854
|
+
): Promise<number>;
|
|
12855
|
+
/**
|
|
12856
|
+
* Get an object flag value.
|
|
12857
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12858
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12859
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12860
|
+
*/
|
|
12861
|
+
getObjectValue<T extends object>(
|
|
12862
|
+
flagKey: string,
|
|
12863
|
+
defaultValue: T,
|
|
12864
|
+
context?: EvaluationContext,
|
|
12865
|
+
): Promise<T>;
|
|
12866
|
+
/**
|
|
12867
|
+
* Get a boolean flag value with full evaluation details.
|
|
12868
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12869
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12870
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12871
|
+
*/
|
|
12872
|
+
getBooleanDetails(
|
|
12873
|
+
flagKey: string,
|
|
12874
|
+
defaultValue: boolean,
|
|
12875
|
+
context?: EvaluationContext,
|
|
12876
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12877
|
+
/**
|
|
12878
|
+
* Get a string flag value with full evaluation details.
|
|
12879
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12880
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12881
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12882
|
+
*/
|
|
12883
|
+
getStringDetails(
|
|
12884
|
+
flagKey: string,
|
|
12885
|
+
defaultValue: string,
|
|
12886
|
+
context?: EvaluationContext,
|
|
12887
|
+
): Promise<EvaluationDetails<string>>;
|
|
12888
|
+
/**
|
|
12889
|
+
* Get a number flag value with full evaluation details.
|
|
12890
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12891
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12892
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12893
|
+
*/
|
|
12894
|
+
getNumberDetails(
|
|
12895
|
+
flagKey: string,
|
|
12896
|
+
defaultValue: number,
|
|
12897
|
+
context?: EvaluationContext,
|
|
12898
|
+
): Promise<EvaluationDetails<number>>;
|
|
12899
|
+
/**
|
|
12900
|
+
* Get an object flag value with full evaluation details.
|
|
12901
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12902
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12903
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12904
|
+
*/
|
|
12905
|
+
getObjectDetails<T extends object>(
|
|
12906
|
+
flagKey: string,
|
|
12907
|
+
defaultValue: T,
|
|
12908
|
+
context?: EvaluationContext,
|
|
12909
|
+
): Promise<EvaluationDetails<T>>;
|
|
12910
|
+
}
|
|
12776
12911
|
/**
|
|
12777
12912
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
12778
12913
|
*/
|
|
@@ -13525,7 +13660,7 @@ export declare namespace CloudflareWorkersModule {
|
|
|
13525
13660
|
email?(message: ForwardableEmailMessage): void | Promise<void>;
|
|
13526
13661
|
fetch?(request: Request): Response | Promise<Response>;
|
|
13527
13662
|
connect?(socket: Socket): void | Promise<void>;
|
|
13528
|
-
queue?(batch: MessageBatch
|
|
13663
|
+
queue?(batch: MessageBatch): void | Promise<void>;
|
|
13529
13664
|
scheduled?(controller: ScheduledController): void | Promise<void>;
|
|
13530
13665
|
tail?(events: TraceItem[]): void | Promise<void>;
|
|
13531
13666
|
tailStream?(
|
|
@@ -14552,6 +14687,11 @@ export declare namespace TailStream {
|
|
|
14552
14687
|
readonly tag?: string;
|
|
14553
14688
|
readonly message?: string;
|
|
14554
14689
|
}
|
|
14690
|
+
interface TracePreviewInfo {
|
|
14691
|
+
readonly id: string;
|
|
14692
|
+
readonly slug: string;
|
|
14693
|
+
readonly name: string;
|
|
14694
|
+
}
|
|
14555
14695
|
interface Onset {
|
|
14556
14696
|
readonly type: "onset";
|
|
14557
14697
|
readonly attributes: Attribute[];
|
|
@@ -14563,6 +14703,7 @@ export declare namespace TailStream {
|
|
|
14563
14703
|
readonly scriptName?: string;
|
|
14564
14704
|
readonly scriptTags?: string[];
|
|
14565
14705
|
readonly scriptVersion?: ScriptVersion;
|
|
14706
|
+
readonly preview?: TracePreviewInfo;
|
|
14566
14707
|
readonly info:
|
|
14567
14708
|
| FetchEventInfo
|
|
14568
14709
|
| ConnectEventInfo
|