@cloudflare/workers-types 4.20260408.1 → 4.20260409.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/2021-11-03/index.d.ts +140 -0
- package/2021-11-03/index.ts +140 -0
- package/2022-01-31/index.d.ts +140 -0
- package/2022-01-31/index.ts +140 -0
- package/2022-03-21/index.d.ts +140 -0
- package/2022-03-21/index.ts +140 -0
- package/2022-08-04/index.d.ts +140 -0
- package/2022-08-04/index.ts +140 -0
- package/2022-10-31/index.d.ts +140 -0
- package/2022-10-31/index.ts +140 -0
- package/2022-11-30/index.d.ts +140 -0
- package/2022-11-30/index.ts +140 -0
- package/2023-03-01/index.d.ts +140 -0
- package/2023-03-01/index.ts +140 -0
- package/2023-07-01/index.d.ts +140 -0
- package/2023-07-01/index.ts +140 -0
- package/experimental/index.d.ts +140 -0
- package/experimental/index.ts +140 -0
- package/index.d.ts +140 -0
- package/index.ts +140 -0
- package/latest/index.d.ts +140 -0
- package/latest/index.ts +140 -0
- package/oldest/index.d.ts +140 -0
- package/oldest/index.ts +140 -0
- package/package.json +1 -1
package/2021-11-03/index.d.ts
CHANGED
|
@@ -11925,6 +11925,140 @@ declare module "cloudflare:email" {
|
|
|
11925
11925
|
};
|
|
11926
11926
|
export { _EmailMessage as EmailMessage };
|
|
11927
11927
|
}
|
|
11928
|
+
/**
|
|
11929
|
+
* Evaluation context for targeting rules.
|
|
11930
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
11931
|
+
*/
|
|
11932
|
+
type EvaluationContext = Record<string, string | number | boolean>;
|
|
11933
|
+
interface EvaluationDetails<T> {
|
|
11934
|
+
flagKey: string;
|
|
11935
|
+
value: T;
|
|
11936
|
+
variant?: string | undefined;
|
|
11937
|
+
reason?: string | undefined;
|
|
11938
|
+
errorCode?: string | undefined;
|
|
11939
|
+
errorMessage?: string | undefined;
|
|
11940
|
+
}
|
|
11941
|
+
interface FlagEvaluationError extends Error {}
|
|
11942
|
+
/**
|
|
11943
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
11944
|
+
*
|
|
11945
|
+
* @example
|
|
11946
|
+
* ```typescript
|
|
11947
|
+
* // Get a boolean flag value with a default
|
|
11948
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
11949
|
+
*
|
|
11950
|
+
* // Get a flag value with evaluation context for targeting
|
|
11951
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
11952
|
+
* userId: 'user-123',
|
|
11953
|
+
* country: 'US',
|
|
11954
|
+
* });
|
|
11955
|
+
*
|
|
11956
|
+
* // Get full evaluation details including variant and reason
|
|
11957
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
11958
|
+
* console.log(details.variant, details.reason);
|
|
11959
|
+
* ```
|
|
11960
|
+
*/
|
|
11961
|
+
declare abstract class Flags {
|
|
11962
|
+
/**
|
|
11963
|
+
* Get a flag value without type checking.
|
|
11964
|
+
* @param flagKey The key of the flag to evaluate.
|
|
11965
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
11966
|
+
* @param context Optional evaluation context for targeting rules.
|
|
11967
|
+
*/
|
|
11968
|
+
get(
|
|
11969
|
+
flagKey: string,
|
|
11970
|
+
defaultValue?: unknown,
|
|
11971
|
+
context?: EvaluationContext,
|
|
11972
|
+
): Promise<unknown>;
|
|
11973
|
+
/**
|
|
11974
|
+
* Get a boolean flag value.
|
|
11975
|
+
* @param flagKey The key of the flag to evaluate.
|
|
11976
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
11977
|
+
* @param context Optional evaluation context for targeting rules.
|
|
11978
|
+
*/
|
|
11979
|
+
getBooleanValue(
|
|
11980
|
+
flagKey: string,
|
|
11981
|
+
defaultValue: boolean,
|
|
11982
|
+
context?: EvaluationContext,
|
|
11983
|
+
): Promise<boolean>;
|
|
11984
|
+
/**
|
|
11985
|
+
* Get a string flag value.
|
|
11986
|
+
* @param flagKey The key of the flag to evaluate.
|
|
11987
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
11988
|
+
* @param context Optional evaluation context for targeting rules.
|
|
11989
|
+
*/
|
|
11990
|
+
getStringValue(
|
|
11991
|
+
flagKey: string,
|
|
11992
|
+
defaultValue: string,
|
|
11993
|
+
context?: EvaluationContext,
|
|
11994
|
+
): Promise<string>;
|
|
11995
|
+
/**
|
|
11996
|
+
* Get a number flag value.
|
|
11997
|
+
* @param flagKey The key of the flag to evaluate.
|
|
11998
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
11999
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12000
|
+
*/
|
|
12001
|
+
getNumberValue(
|
|
12002
|
+
flagKey: string,
|
|
12003
|
+
defaultValue: number,
|
|
12004
|
+
context?: EvaluationContext,
|
|
12005
|
+
): Promise<number>;
|
|
12006
|
+
/**
|
|
12007
|
+
* Get an object flag value.
|
|
12008
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12009
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12010
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12011
|
+
*/
|
|
12012
|
+
getObjectValue<T extends object>(
|
|
12013
|
+
flagKey: string,
|
|
12014
|
+
defaultValue: T,
|
|
12015
|
+
context?: EvaluationContext,
|
|
12016
|
+
): Promise<T>;
|
|
12017
|
+
/**
|
|
12018
|
+
* Get a boolean flag value with full evaluation details.
|
|
12019
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12020
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12021
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12022
|
+
*/
|
|
12023
|
+
getBooleanDetails(
|
|
12024
|
+
flagKey: string,
|
|
12025
|
+
defaultValue: boolean,
|
|
12026
|
+
context?: EvaluationContext,
|
|
12027
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12028
|
+
/**
|
|
12029
|
+
* Get a string flag value with full evaluation details.
|
|
12030
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12031
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12032
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12033
|
+
*/
|
|
12034
|
+
getStringDetails(
|
|
12035
|
+
flagKey: string,
|
|
12036
|
+
defaultValue: string,
|
|
12037
|
+
context?: EvaluationContext,
|
|
12038
|
+
): Promise<EvaluationDetails<string>>;
|
|
12039
|
+
/**
|
|
12040
|
+
* Get a number flag value with full evaluation details.
|
|
12041
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12042
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12043
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12044
|
+
*/
|
|
12045
|
+
getNumberDetails(
|
|
12046
|
+
flagKey: string,
|
|
12047
|
+
defaultValue: number,
|
|
12048
|
+
context?: EvaluationContext,
|
|
12049
|
+
): Promise<EvaluationDetails<number>>;
|
|
12050
|
+
/**
|
|
12051
|
+
* Get an object flag value with full evaluation details.
|
|
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
|
+
getObjectDetails<T extends object>(
|
|
12057
|
+
flagKey: string,
|
|
12058
|
+
defaultValue: T,
|
|
12059
|
+
context?: EvaluationContext,
|
|
12060
|
+
): Promise<EvaluationDetails<T>>;
|
|
12061
|
+
}
|
|
11928
12062
|
/**
|
|
11929
12063
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
11930
12064
|
*/
|
|
@@ -13763,6 +13897,11 @@ declare namespace TailStream {
|
|
|
13763
13897
|
readonly tag?: string;
|
|
13764
13898
|
readonly message?: string;
|
|
13765
13899
|
}
|
|
13900
|
+
interface TracePreviewInfo {
|
|
13901
|
+
readonly id: string;
|
|
13902
|
+
readonly slug: string;
|
|
13903
|
+
readonly name: string;
|
|
13904
|
+
}
|
|
13766
13905
|
interface Onset {
|
|
13767
13906
|
readonly type: "onset";
|
|
13768
13907
|
readonly attributes: Attribute[];
|
|
@@ -13774,6 +13913,7 @@ declare namespace TailStream {
|
|
|
13774
13913
|
readonly scriptName?: string;
|
|
13775
13914
|
readonly scriptTags?: string[];
|
|
13776
13915
|
readonly scriptVersion?: ScriptVersion;
|
|
13916
|
+
readonly preview?: TracePreviewInfo;
|
|
13777
13917
|
readonly info:
|
|
13778
13918
|
| FetchEventInfo
|
|
13779
13919
|
| ConnectEventInfo
|
package/2021-11-03/index.ts
CHANGED
|
@@ -11941,6 +11941,140 @@ export declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
|
|
|
11941
11941
|
env: Env,
|
|
11942
11942
|
ctx: ExecutionContext<Props>,
|
|
11943
11943
|
) => void | Promise<void>;
|
|
11944
|
+
/**
|
|
11945
|
+
* Evaluation context for targeting rules.
|
|
11946
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
11947
|
+
*/
|
|
11948
|
+
export type EvaluationContext = Record<string, string | number | boolean>;
|
|
11949
|
+
export interface EvaluationDetails<T> {
|
|
11950
|
+
flagKey: string;
|
|
11951
|
+
value: T;
|
|
11952
|
+
variant?: string | undefined;
|
|
11953
|
+
reason?: string | undefined;
|
|
11954
|
+
errorCode?: string | undefined;
|
|
11955
|
+
errorMessage?: string | undefined;
|
|
11956
|
+
}
|
|
11957
|
+
export interface FlagEvaluationError extends Error {}
|
|
11958
|
+
/**
|
|
11959
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
11960
|
+
*
|
|
11961
|
+
* @example
|
|
11962
|
+
* ```typescript
|
|
11963
|
+
* // Get a boolean flag value with a default
|
|
11964
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
11965
|
+
*
|
|
11966
|
+
* // Get a flag value with evaluation context for targeting
|
|
11967
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
11968
|
+
* userId: 'user-123',
|
|
11969
|
+
* country: 'US',
|
|
11970
|
+
* });
|
|
11971
|
+
*
|
|
11972
|
+
* // Get full evaluation details including variant and reason
|
|
11973
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
11974
|
+
* console.log(details.variant, details.reason);
|
|
11975
|
+
* ```
|
|
11976
|
+
*/
|
|
11977
|
+
export declare abstract class Flags {
|
|
11978
|
+
/**
|
|
11979
|
+
* Get a flag value without type checking.
|
|
11980
|
+
* @param flagKey The key of the flag to evaluate.
|
|
11981
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
11982
|
+
* @param context Optional evaluation context for targeting rules.
|
|
11983
|
+
*/
|
|
11984
|
+
get(
|
|
11985
|
+
flagKey: string,
|
|
11986
|
+
defaultValue?: unknown,
|
|
11987
|
+
context?: EvaluationContext,
|
|
11988
|
+
): Promise<unknown>;
|
|
11989
|
+
/**
|
|
11990
|
+
* Get a boolean flag value.
|
|
11991
|
+
* @param flagKey The key of the flag to evaluate.
|
|
11992
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
11993
|
+
* @param context Optional evaluation context for targeting rules.
|
|
11994
|
+
*/
|
|
11995
|
+
getBooleanValue(
|
|
11996
|
+
flagKey: string,
|
|
11997
|
+
defaultValue: boolean,
|
|
11998
|
+
context?: EvaluationContext,
|
|
11999
|
+
): Promise<boolean>;
|
|
12000
|
+
/**
|
|
12001
|
+
* Get a string flag value.
|
|
12002
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12003
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12004
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12005
|
+
*/
|
|
12006
|
+
getStringValue(
|
|
12007
|
+
flagKey: string,
|
|
12008
|
+
defaultValue: string,
|
|
12009
|
+
context?: EvaluationContext,
|
|
12010
|
+
): Promise<string>;
|
|
12011
|
+
/**
|
|
12012
|
+
* Get a number flag value.
|
|
12013
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12014
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12015
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12016
|
+
*/
|
|
12017
|
+
getNumberValue(
|
|
12018
|
+
flagKey: string,
|
|
12019
|
+
defaultValue: number,
|
|
12020
|
+
context?: EvaluationContext,
|
|
12021
|
+
): Promise<number>;
|
|
12022
|
+
/**
|
|
12023
|
+
* Get an object flag value.
|
|
12024
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12025
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12026
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12027
|
+
*/
|
|
12028
|
+
getObjectValue<T extends object>(
|
|
12029
|
+
flagKey: string,
|
|
12030
|
+
defaultValue: T,
|
|
12031
|
+
context?: EvaluationContext,
|
|
12032
|
+
): Promise<T>;
|
|
12033
|
+
/**
|
|
12034
|
+
* Get a boolean flag value with full evaluation details.
|
|
12035
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12036
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12037
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12038
|
+
*/
|
|
12039
|
+
getBooleanDetails(
|
|
12040
|
+
flagKey: string,
|
|
12041
|
+
defaultValue: boolean,
|
|
12042
|
+
context?: EvaluationContext,
|
|
12043
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12044
|
+
/**
|
|
12045
|
+
* Get a string flag value with full evaluation details.
|
|
12046
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12047
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12048
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12049
|
+
*/
|
|
12050
|
+
getStringDetails(
|
|
12051
|
+
flagKey: string,
|
|
12052
|
+
defaultValue: string,
|
|
12053
|
+
context?: EvaluationContext,
|
|
12054
|
+
): Promise<EvaluationDetails<string>>;
|
|
12055
|
+
/**
|
|
12056
|
+
* Get a number flag value with full evaluation details.
|
|
12057
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12058
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12059
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12060
|
+
*/
|
|
12061
|
+
getNumberDetails(
|
|
12062
|
+
flagKey: string,
|
|
12063
|
+
defaultValue: number,
|
|
12064
|
+
context?: EvaluationContext,
|
|
12065
|
+
): Promise<EvaluationDetails<number>>;
|
|
12066
|
+
/**
|
|
12067
|
+
* Get an object flag value with full evaluation details.
|
|
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
|
+
getObjectDetails<T extends object>(
|
|
12073
|
+
flagKey: string,
|
|
12074
|
+
defaultValue: T,
|
|
12075
|
+
context?: EvaluationContext,
|
|
12076
|
+
): Promise<EvaluationDetails<T>>;
|
|
12077
|
+
}
|
|
11944
12078
|
/**
|
|
11945
12079
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
11946
12080
|
*/
|
|
@@ -13720,6 +13854,11 @@ export declare namespace TailStream {
|
|
|
13720
13854
|
readonly tag?: string;
|
|
13721
13855
|
readonly message?: string;
|
|
13722
13856
|
}
|
|
13857
|
+
interface TracePreviewInfo {
|
|
13858
|
+
readonly id: string;
|
|
13859
|
+
readonly slug: string;
|
|
13860
|
+
readonly name: string;
|
|
13861
|
+
}
|
|
13723
13862
|
interface Onset {
|
|
13724
13863
|
readonly type: "onset";
|
|
13725
13864
|
readonly attributes: Attribute[];
|
|
@@ -13731,6 +13870,7 @@ export declare namespace TailStream {
|
|
|
13731
13870
|
readonly scriptName?: string;
|
|
13732
13871
|
readonly scriptTags?: string[];
|
|
13733
13872
|
readonly scriptVersion?: ScriptVersion;
|
|
13873
|
+
readonly preview?: TracePreviewInfo;
|
|
13734
13874
|
readonly info:
|
|
13735
13875
|
| FetchEventInfo
|
|
13736
13876
|
| ConnectEventInfo
|
package/2022-01-31/index.d.ts
CHANGED
|
@@ -11992,6 +11992,140 @@ declare module "cloudflare:email" {
|
|
|
11992
11992
|
};
|
|
11993
11993
|
export { _EmailMessage as EmailMessage };
|
|
11994
11994
|
}
|
|
11995
|
+
/**
|
|
11996
|
+
* Evaluation context for targeting rules.
|
|
11997
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
11998
|
+
*/
|
|
11999
|
+
type EvaluationContext = Record<string, string | number | boolean>;
|
|
12000
|
+
interface EvaluationDetails<T> {
|
|
12001
|
+
flagKey: string;
|
|
12002
|
+
value: T;
|
|
12003
|
+
variant?: string | undefined;
|
|
12004
|
+
reason?: string | undefined;
|
|
12005
|
+
errorCode?: string | undefined;
|
|
12006
|
+
errorMessage?: string | undefined;
|
|
12007
|
+
}
|
|
12008
|
+
interface FlagEvaluationError extends Error {}
|
|
12009
|
+
/**
|
|
12010
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
12011
|
+
*
|
|
12012
|
+
* @example
|
|
12013
|
+
* ```typescript
|
|
12014
|
+
* // Get a boolean flag value with a default
|
|
12015
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
12016
|
+
*
|
|
12017
|
+
* // Get a flag value with evaluation context for targeting
|
|
12018
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
12019
|
+
* userId: 'user-123',
|
|
12020
|
+
* country: 'US',
|
|
12021
|
+
* });
|
|
12022
|
+
*
|
|
12023
|
+
* // Get full evaluation details including variant and reason
|
|
12024
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
12025
|
+
* console.log(details.variant, details.reason);
|
|
12026
|
+
* ```
|
|
12027
|
+
*/
|
|
12028
|
+
declare abstract class Flags {
|
|
12029
|
+
/**
|
|
12030
|
+
* Get a flag value without type checking.
|
|
12031
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12032
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
12033
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12034
|
+
*/
|
|
12035
|
+
get(
|
|
12036
|
+
flagKey: string,
|
|
12037
|
+
defaultValue?: unknown,
|
|
12038
|
+
context?: EvaluationContext,
|
|
12039
|
+
): Promise<unknown>;
|
|
12040
|
+
/**
|
|
12041
|
+
* Get a boolean flag value.
|
|
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
|
+
getBooleanValue(
|
|
12047
|
+
flagKey: string,
|
|
12048
|
+
defaultValue: boolean,
|
|
12049
|
+
context?: EvaluationContext,
|
|
12050
|
+
): Promise<boolean>;
|
|
12051
|
+
/**
|
|
12052
|
+
* Get a string flag value.
|
|
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
|
+
getStringValue(
|
|
12058
|
+
flagKey: string,
|
|
12059
|
+
defaultValue: string,
|
|
12060
|
+
context?: EvaluationContext,
|
|
12061
|
+
): Promise<string>;
|
|
12062
|
+
/**
|
|
12063
|
+
* Get a number flag value.
|
|
12064
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12065
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12066
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12067
|
+
*/
|
|
12068
|
+
getNumberValue(
|
|
12069
|
+
flagKey: string,
|
|
12070
|
+
defaultValue: number,
|
|
12071
|
+
context?: EvaluationContext,
|
|
12072
|
+
): Promise<number>;
|
|
12073
|
+
/**
|
|
12074
|
+
* Get an object flag value.
|
|
12075
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12076
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12077
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12078
|
+
*/
|
|
12079
|
+
getObjectValue<T extends object>(
|
|
12080
|
+
flagKey: string,
|
|
12081
|
+
defaultValue: T,
|
|
12082
|
+
context?: EvaluationContext,
|
|
12083
|
+
): Promise<T>;
|
|
12084
|
+
/**
|
|
12085
|
+
* Get a boolean flag value with full evaluation details.
|
|
12086
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12087
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12088
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12089
|
+
*/
|
|
12090
|
+
getBooleanDetails(
|
|
12091
|
+
flagKey: string,
|
|
12092
|
+
defaultValue: boolean,
|
|
12093
|
+
context?: EvaluationContext,
|
|
12094
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12095
|
+
/**
|
|
12096
|
+
* Get a string flag value with full evaluation details.
|
|
12097
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12098
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12099
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12100
|
+
*/
|
|
12101
|
+
getStringDetails(
|
|
12102
|
+
flagKey: string,
|
|
12103
|
+
defaultValue: string,
|
|
12104
|
+
context?: EvaluationContext,
|
|
12105
|
+
): Promise<EvaluationDetails<string>>;
|
|
12106
|
+
/**
|
|
12107
|
+
* Get a number flag value with full evaluation details.
|
|
12108
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12109
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12110
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12111
|
+
*/
|
|
12112
|
+
getNumberDetails(
|
|
12113
|
+
flagKey: string,
|
|
12114
|
+
defaultValue: number,
|
|
12115
|
+
context?: EvaluationContext,
|
|
12116
|
+
): Promise<EvaluationDetails<number>>;
|
|
12117
|
+
/**
|
|
12118
|
+
* Get an object flag value with full evaluation details.
|
|
12119
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12120
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12121
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12122
|
+
*/
|
|
12123
|
+
getObjectDetails<T extends object>(
|
|
12124
|
+
flagKey: string,
|
|
12125
|
+
defaultValue: T,
|
|
12126
|
+
context?: EvaluationContext,
|
|
12127
|
+
): Promise<EvaluationDetails<T>>;
|
|
12128
|
+
}
|
|
11995
12129
|
/**
|
|
11996
12130
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
11997
12131
|
*/
|
|
@@ -13830,6 +13964,11 @@ declare namespace TailStream {
|
|
|
13830
13964
|
readonly tag?: string;
|
|
13831
13965
|
readonly message?: string;
|
|
13832
13966
|
}
|
|
13967
|
+
interface TracePreviewInfo {
|
|
13968
|
+
readonly id: string;
|
|
13969
|
+
readonly slug: string;
|
|
13970
|
+
readonly name: string;
|
|
13971
|
+
}
|
|
13833
13972
|
interface Onset {
|
|
13834
13973
|
readonly type: "onset";
|
|
13835
13974
|
readonly attributes: Attribute[];
|
|
@@ -13841,6 +13980,7 @@ declare namespace TailStream {
|
|
|
13841
13980
|
readonly scriptName?: string;
|
|
13842
13981
|
readonly scriptTags?: string[];
|
|
13843
13982
|
readonly scriptVersion?: ScriptVersion;
|
|
13983
|
+
readonly preview?: TracePreviewInfo;
|
|
13844
13984
|
readonly info:
|
|
13845
13985
|
| FetchEventInfo
|
|
13846
13986
|
| ConnectEventInfo
|
package/2022-01-31/index.ts
CHANGED
|
@@ -12008,6 +12008,140 @@ export declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
|
|
|
12008
12008
|
env: Env,
|
|
12009
12009
|
ctx: ExecutionContext<Props>,
|
|
12010
12010
|
) => void | Promise<void>;
|
|
12011
|
+
/**
|
|
12012
|
+
* Evaluation context for targeting rules.
|
|
12013
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
12014
|
+
*/
|
|
12015
|
+
export type EvaluationContext = Record<string, string | number | boolean>;
|
|
12016
|
+
export interface EvaluationDetails<T> {
|
|
12017
|
+
flagKey: string;
|
|
12018
|
+
value: T;
|
|
12019
|
+
variant?: string | undefined;
|
|
12020
|
+
reason?: string | undefined;
|
|
12021
|
+
errorCode?: string | undefined;
|
|
12022
|
+
errorMessage?: string | undefined;
|
|
12023
|
+
}
|
|
12024
|
+
export interface FlagEvaluationError extends Error {}
|
|
12025
|
+
/**
|
|
12026
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
12027
|
+
*
|
|
12028
|
+
* @example
|
|
12029
|
+
* ```typescript
|
|
12030
|
+
* // Get a boolean flag value with a default
|
|
12031
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
12032
|
+
*
|
|
12033
|
+
* // Get a flag value with evaluation context for targeting
|
|
12034
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
12035
|
+
* userId: 'user-123',
|
|
12036
|
+
* country: 'US',
|
|
12037
|
+
* });
|
|
12038
|
+
*
|
|
12039
|
+
* // Get full evaluation details including variant and reason
|
|
12040
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
12041
|
+
* console.log(details.variant, details.reason);
|
|
12042
|
+
* ```
|
|
12043
|
+
*/
|
|
12044
|
+
export declare abstract class Flags {
|
|
12045
|
+
/**
|
|
12046
|
+
* Get a flag value without type checking.
|
|
12047
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12048
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
12049
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12050
|
+
*/
|
|
12051
|
+
get(
|
|
12052
|
+
flagKey: string,
|
|
12053
|
+
defaultValue?: unknown,
|
|
12054
|
+
context?: EvaluationContext,
|
|
12055
|
+
): Promise<unknown>;
|
|
12056
|
+
/**
|
|
12057
|
+
* Get a boolean flag value.
|
|
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
|
+
getBooleanValue(
|
|
12063
|
+
flagKey: string,
|
|
12064
|
+
defaultValue: boolean,
|
|
12065
|
+
context?: EvaluationContext,
|
|
12066
|
+
): Promise<boolean>;
|
|
12067
|
+
/**
|
|
12068
|
+
* Get a string flag value.
|
|
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
|
+
getStringValue(
|
|
12074
|
+
flagKey: string,
|
|
12075
|
+
defaultValue: string,
|
|
12076
|
+
context?: EvaluationContext,
|
|
12077
|
+
): Promise<string>;
|
|
12078
|
+
/**
|
|
12079
|
+
* Get a number flag value.
|
|
12080
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12081
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12082
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12083
|
+
*/
|
|
12084
|
+
getNumberValue(
|
|
12085
|
+
flagKey: string,
|
|
12086
|
+
defaultValue: number,
|
|
12087
|
+
context?: EvaluationContext,
|
|
12088
|
+
): Promise<number>;
|
|
12089
|
+
/**
|
|
12090
|
+
* Get an object flag value.
|
|
12091
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12092
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12093
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12094
|
+
*/
|
|
12095
|
+
getObjectValue<T extends object>(
|
|
12096
|
+
flagKey: string,
|
|
12097
|
+
defaultValue: T,
|
|
12098
|
+
context?: EvaluationContext,
|
|
12099
|
+
): Promise<T>;
|
|
12100
|
+
/**
|
|
12101
|
+
* Get a boolean flag value with full evaluation details.
|
|
12102
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12103
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12104
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12105
|
+
*/
|
|
12106
|
+
getBooleanDetails(
|
|
12107
|
+
flagKey: string,
|
|
12108
|
+
defaultValue: boolean,
|
|
12109
|
+
context?: EvaluationContext,
|
|
12110
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12111
|
+
/**
|
|
12112
|
+
* Get a string flag value with full evaluation details.
|
|
12113
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12114
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12115
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12116
|
+
*/
|
|
12117
|
+
getStringDetails(
|
|
12118
|
+
flagKey: string,
|
|
12119
|
+
defaultValue: string,
|
|
12120
|
+
context?: EvaluationContext,
|
|
12121
|
+
): Promise<EvaluationDetails<string>>;
|
|
12122
|
+
/**
|
|
12123
|
+
* Get a number flag value with full evaluation details.
|
|
12124
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12125
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12126
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12127
|
+
*/
|
|
12128
|
+
getNumberDetails(
|
|
12129
|
+
flagKey: string,
|
|
12130
|
+
defaultValue: number,
|
|
12131
|
+
context?: EvaluationContext,
|
|
12132
|
+
): Promise<EvaluationDetails<number>>;
|
|
12133
|
+
/**
|
|
12134
|
+
* Get an object flag value with full evaluation details.
|
|
12135
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12136
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12137
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12138
|
+
*/
|
|
12139
|
+
getObjectDetails<T extends object>(
|
|
12140
|
+
flagKey: string,
|
|
12141
|
+
defaultValue: T,
|
|
12142
|
+
context?: EvaluationContext,
|
|
12143
|
+
): Promise<EvaluationDetails<T>>;
|
|
12144
|
+
}
|
|
12011
12145
|
/**
|
|
12012
12146
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
12013
12147
|
*/
|
|
@@ -13787,6 +13921,11 @@ export declare namespace TailStream {
|
|
|
13787
13921
|
readonly tag?: string;
|
|
13788
13922
|
readonly message?: string;
|
|
13789
13923
|
}
|
|
13924
|
+
interface TracePreviewInfo {
|
|
13925
|
+
readonly id: string;
|
|
13926
|
+
readonly slug: string;
|
|
13927
|
+
readonly name: string;
|
|
13928
|
+
}
|
|
13790
13929
|
interface Onset {
|
|
13791
13930
|
readonly type: "onset";
|
|
13792
13931
|
readonly attributes: Attribute[];
|
|
@@ -13798,6 +13937,7 @@ export declare namespace TailStream {
|
|
|
13798
13937
|
readonly scriptName?: string;
|
|
13799
13938
|
readonly scriptTags?: string[];
|
|
13800
13939
|
readonly scriptVersion?: ScriptVersion;
|
|
13940
|
+
readonly preview?: TracePreviewInfo;
|
|
13801
13941
|
readonly info:
|
|
13802
13942
|
| FetchEventInfo
|
|
13803
13943
|
| ConnectEventInfo
|