@cloudflare/workers-types 4.20260405.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.
@@ -546,6 +546,9 @@ export interface AlarmInvocationInfo {
546
546
  export interface Cloudflare {
547
547
  readonly compatibilityFlags: Record<string, boolean>;
548
548
  }
549
+ export declare abstract class ColoLocalActorNamespace {
550
+ get(actorId: string): Fetcher;
551
+ }
549
552
  export interface DurableObject {
550
553
  fetch(request: Request): Response | Promise<Response>;
551
554
  connect?(socket: Socket): void | Promise<void>;
@@ -625,6 +628,7 @@ export interface DurableObjectState<Props = unknown> {
625
628
  readonly id: DurableObjectId;
626
629
  readonly storage: DurableObjectStorage;
627
630
  container?: Container;
631
+ facets: DurableObjectFacets;
628
632
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
629
633
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
630
634
  getWebSockets(tag?: string): WebSocket[];
@@ -739,6 +743,22 @@ export declare class WebSocketRequestResponsePair {
739
743
  get request(): string;
740
744
  get response(): string;
741
745
  }
746
+ export interface DurableObjectFacets {
747
+ get<T extends Rpc.DurableObjectBranded | undefined = undefined>(
748
+ name: string,
749
+ getStartupOptions: () =>
750
+ | FacetStartupOptions<T>
751
+ | Promise<FacetStartupOptions<T>>,
752
+ ): Fetcher<T>;
753
+ abort(name: string, reason: any): void;
754
+ delete(name: string): void;
755
+ }
756
+ export interface FacetStartupOptions<
757
+ T extends Rpc.DurableObjectBranded | undefined = undefined,
758
+ > {
759
+ id?: DurableObjectId | string;
760
+ class: DurableObjectClass<T>;
761
+ }
742
762
  export interface AnalyticsEngineDataset {
743
763
  writeDataPoint(event?: AnalyticsEngineDataPoint): void;
744
764
  }
@@ -3830,6 +3850,8 @@ export type LoopbackDurableObjectClass<
3830
3850
  (T extends CloudflareWorkersModule.DurableObject<any, infer Props>
3831
3851
  ? (opts: { props?: Props }) => DurableObjectClass<T>
3832
3852
  : (opts: { props?: any }) => DurableObjectClass<T>);
3853
+ export interface LoopbackDurableObjectNamespace extends DurableObjectNamespace {}
3854
+ export interface LoopbackColoLocalActorNamespace extends ColoLocalActorNamespace {}
3833
3855
  export interface SyncKvStorage {
3834
3856
  get<T = unknown>(key: string): T | undefined;
3835
3857
  list<T = unknown>(options?: SyncKvListOptions): Iterable<[string, T]>;
@@ -3849,6 +3871,10 @@ export interface WorkerStub {
3849
3871
  name?: string,
3850
3872
  options?: WorkerStubEntrypointOptions,
3851
3873
  ): Fetcher<T>;
3874
+ getDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined>(
3875
+ name?: string,
3876
+ options?: WorkerStubEntrypointOptions,
3877
+ ): DurableObjectClass<T>;
3852
3878
  }
3853
3879
  export interface WorkerStubEntrypointOptions {
3854
3880
  props?: any;
@@ -11982,6 +12008,140 @@ export declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
11982
12008
  env: Env,
11983
12009
  ctx: ExecutionContext<Props>,
11984
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
+ }
11985
12145
  /**
11986
12146
  * Hello World binding to serve as an explanatory example. DO NOT USE
11987
12147
  */
@@ -13761,6 +13921,11 @@ export declare namespace TailStream {
13761
13921
  readonly tag?: string;
13762
13922
  readonly message?: string;
13763
13923
  }
13924
+ interface TracePreviewInfo {
13925
+ readonly id: string;
13926
+ readonly slug: string;
13927
+ readonly name: string;
13928
+ }
13764
13929
  interface Onset {
13765
13930
  readonly type: "onset";
13766
13931
  readonly attributes: Attribute[];
@@ -13772,6 +13937,7 @@ export declare namespace TailStream {
13772
13937
  readonly scriptName?: string;
13773
13938
  readonly scriptTags?: string[];
13774
13939
  readonly scriptVersion?: ScriptVersion;
13940
+ readonly preview?: TracePreviewInfo;
13775
13941
  readonly info:
13776
13942
  | FetchEventInfo
13777
13943
  | ConnectEventInfo
@@ -552,6 +552,9 @@ interface AlarmInvocationInfo {
552
552
  interface Cloudflare {
553
553
  readonly compatibilityFlags: Record<string, boolean>;
554
554
  }
555
+ declare abstract class ColoLocalActorNamespace {
556
+ get(actorId: string): Fetcher;
557
+ }
555
558
  interface DurableObject {
556
559
  fetch(request: Request): Response | Promise<Response>;
557
560
  connect?(socket: Socket): void | Promise<void>;
@@ -631,6 +634,7 @@ interface DurableObjectState<Props = unknown> {
631
634
  readonly id: DurableObjectId;
632
635
  readonly storage: DurableObjectStorage;
633
636
  container?: Container;
637
+ facets: DurableObjectFacets;
634
638
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
635
639
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
636
640
  getWebSockets(tag?: string): WebSocket[];
@@ -745,6 +749,22 @@ declare class WebSocketRequestResponsePair {
745
749
  get request(): string;
746
750
  get response(): string;
747
751
  }
752
+ interface DurableObjectFacets {
753
+ get<T extends Rpc.DurableObjectBranded | undefined = undefined>(
754
+ name: string,
755
+ getStartupOptions: () =>
756
+ | FacetStartupOptions<T>
757
+ | Promise<FacetStartupOptions<T>>,
758
+ ): Fetcher<T>;
759
+ abort(name: string, reason: any): void;
760
+ delete(name: string): void;
761
+ }
762
+ interface FacetStartupOptions<
763
+ T extends Rpc.DurableObjectBranded | undefined = undefined,
764
+ > {
765
+ id?: DurableObjectId | string;
766
+ class: DurableObjectClass<T>;
767
+ }
748
768
  interface AnalyticsEngineDataset {
749
769
  writeDataPoint(event?: AnalyticsEngineDataPoint): void;
750
770
  }
@@ -3832,6 +3852,8 @@ type LoopbackDurableObjectClass<
3832
3852
  (T extends CloudflareWorkersModule.DurableObject<any, infer Props>
3833
3853
  ? (opts: { props?: Props }) => DurableObjectClass<T>
3834
3854
  : (opts: { props?: any }) => DurableObjectClass<T>);
3855
+ interface LoopbackDurableObjectNamespace extends DurableObjectNamespace {}
3856
+ interface LoopbackColoLocalActorNamespace extends ColoLocalActorNamespace {}
3835
3857
  interface SyncKvStorage {
3836
3858
  get<T = unknown>(key: string): T | undefined;
3837
3859
  list<T = unknown>(options?: SyncKvListOptions): Iterable<[string, T]>;
@@ -3851,6 +3873,10 @@ interface WorkerStub {
3851
3873
  name?: string,
3852
3874
  options?: WorkerStubEntrypointOptions,
3853
3875
  ): Fetcher<T>;
3876
+ getDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined>(
3877
+ name?: string,
3878
+ options?: WorkerStubEntrypointOptions,
3879
+ ): DurableObjectClass<T>;
3854
3880
  }
3855
3881
  interface WorkerStubEntrypointOptions {
3856
3882
  props?: any;
@@ -11974,6 +12000,140 @@ declare module "cloudflare:email" {
11974
12000
  };
11975
12001
  export { _EmailMessage as EmailMessage };
11976
12002
  }
12003
+ /**
12004
+ * Evaluation context for targeting rules.
12005
+ * Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
12006
+ */
12007
+ type EvaluationContext = Record<string, string | number | boolean>;
12008
+ interface EvaluationDetails<T> {
12009
+ flagKey: string;
12010
+ value: T;
12011
+ variant?: string | undefined;
12012
+ reason?: string | undefined;
12013
+ errorCode?: string | undefined;
12014
+ errorMessage?: string | undefined;
12015
+ }
12016
+ interface FlagEvaluationError extends Error {}
12017
+ /**
12018
+ * Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
12019
+ *
12020
+ * @example
12021
+ * ```typescript
12022
+ * // Get a boolean flag value with a default
12023
+ * const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
12024
+ *
12025
+ * // Get a flag value with evaluation context for targeting
12026
+ * const variant = await env.FLAGS.getStringValue('experiment', 'control', {
12027
+ * userId: 'user-123',
12028
+ * country: 'US',
12029
+ * });
12030
+ *
12031
+ * // Get full evaluation details including variant and reason
12032
+ * const details = await env.FLAGS.getBooleanDetails('my-feature', false);
12033
+ * console.log(details.variant, details.reason);
12034
+ * ```
12035
+ */
12036
+ declare abstract class Flags {
12037
+ /**
12038
+ * Get a flag value without type checking.
12039
+ * @param flagKey The key of the flag to evaluate.
12040
+ * @param defaultValue Optional default value returned when evaluation fails.
12041
+ * @param context Optional evaluation context for targeting rules.
12042
+ */
12043
+ get(
12044
+ flagKey: string,
12045
+ defaultValue?: unknown,
12046
+ context?: EvaluationContext,
12047
+ ): Promise<unknown>;
12048
+ /**
12049
+ * Get a boolean flag value.
12050
+ * @param flagKey The key of the flag to evaluate.
12051
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12052
+ * @param context Optional evaluation context for targeting rules.
12053
+ */
12054
+ getBooleanValue(
12055
+ flagKey: string,
12056
+ defaultValue: boolean,
12057
+ context?: EvaluationContext,
12058
+ ): Promise<boolean>;
12059
+ /**
12060
+ * Get a string flag value.
12061
+ * @param flagKey The key of the flag to evaluate.
12062
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12063
+ * @param context Optional evaluation context for targeting rules.
12064
+ */
12065
+ getStringValue(
12066
+ flagKey: string,
12067
+ defaultValue: string,
12068
+ context?: EvaluationContext,
12069
+ ): Promise<string>;
12070
+ /**
12071
+ * Get a number 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
+ getNumberValue(
12077
+ flagKey: string,
12078
+ defaultValue: number,
12079
+ context?: EvaluationContext,
12080
+ ): Promise<number>;
12081
+ /**
12082
+ * Get an object 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
+ getObjectValue<T extends object>(
12088
+ flagKey: string,
12089
+ defaultValue: T,
12090
+ context?: EvaluationContext,
12091
+ ): Promise<T>;
12092
+ /**
12093
+ * Get a boolean flag value with full evaluation details.
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
+ getBooleanDetails(
12099
+ flagKey: string,
12100
+ defaultValue: boolean,
12101
+ context?: EvaluationContext,
12102
+ ): Promise<EvaluationDetails<boolean>>;
12103
+ /**
12104
+ * Get a string flag value with full evaluation details.
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
+ getStringDetails(
12110
+ flagKey: string,
12111
+ defaultValue: string,
12112
+ context?: EvaluationContext,
12113
+ ): Promise<EvaluationDetails<string>>;
12114
+ /**
12115
+ * Get a number 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
+ getNumberDetails(
12121
+ flagKey: string,
12122
+ defaultValue: number,
12123
+ context?: EvaluationContext,
12124
+ ): Promise<EvaluationDetails<number>>;
12125
+ /**
12126
+ * Get an object 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
+ getObjectDetails<T extends object>(
12132
+ flagKey: string,
12133
+ defaultValue: T,
12134
+ context?: EvaluationContext,
12135
+ ): Promise<EvaluationDetails<T>>;
12136
+ }
11977
12137
  /**
11978
12138
  * Hello World binding to serve as an explanatory example. DO NOT USE
11979
12139
  */
@@ -13812,6 +13972,11 @@ declare namespace TailStream {
13812
13972
  readonly tag?: string;
13813
13973
  readonly message?: string;
13814
13974
  }
13975
+ interface TracePreviewInfo {
13976
+ readonly id: string;
13977
+ readonly slug: string;
13978
+ readonly name: string;
13979
+ }
13815
13980
  interface Onset {
13816
13981
  readonly type: "onset";
13817
13982
  readonly attributes: Attribute[];
@@ -13823,6 +13988,7 @@ declare namespace TailStream {
13823
13988
  readonly scriptName?: string;
13824
13989
  readonly scriptTags?: string[];
13825
13990
  readonly scriptVersion?: ScriptVersion;
13991
+ readonly preview?: TracePreviewInfo;
13826
13992
  readonly info:
13827
13993
  | FetchEventInfo
13828
13994
  | ConnectEventInfo
@@ -554,6 +554,9 @@ export interface AlarmInvocationInfo {
554
554
  export interface Cloudflare {
555
555
  readonly compatibilityFlags: Record<string, boolean>;
556
556
  }
557
+ export declare abstract class ColoLocalActorNamespace {
558
+ get(actorId: string): Fetcher;
559
+ }
557
560
  export interface DurableObject {
558
561
  fetch(request: Request): Response | Promise<Response>;
559
562
  connect?(socket: Socket): void | Promise<void>;
@@ -633,6 +636,7 @@ export interface DurableObjectState<Props = unknown> {
633
636
  readonly id: DurableObjectId;
634
637
  readonly storage: DurableObjectStorage;
635
638
  container?: Container;
639
+ facets: DurableObjectFacets;
636
640
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
637
641
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
638
642
  getWebSockets(tag?: string): WebSocket[];
@@ -747,6 +751,22 @@ export declare class WebSocketRequestResponsePair {
747
751
  get request(): string;
748
752
  get response(): string;
749
753
  }
754
+ export interface DurableObjectFacets {
755
+ get<T extends Rpc.DurableObjectBranded | undefined = undefined>(
756
+ name: string,
757
+ getStartupOptions: () =>
758
+ | FacetStartupOptions<T>
759
+ | Promise<FacetStartupOptions<T>>,
760
+ ): Fetcher<T>;
761
+ abort(name: string, reason: any): void;
762
+ delete(name: string): void;
763
+ }
764
+ export interface FacetStartupOptions<
765
+ T extends Rpc.DurableObjectBranded | undefined = undefined,
766
+ > {
767
+ id?: DurableObjectId | string;
768
+ class: DurableObjectClass<T>;
769
+ }
750
770
  export interface AnalyticsEngineDataset {
751
771
  writeDataPoint(event?: AnalyticsEngineDataPoint): void;
752
772
  }
@@ -3838,6 +3858,8 @@ export type LoopbackDurableObjectClass<
3838
3858
  (T extends CloudflareWorkersModule.DurableObject<any, infer Props>
3839
3859
  ? (opts: { props?: Props }) => DurableObjectClass<T>
3840
3860
  : (opts: { props?: any }) => DurableObjectClass<T>);
3861
+ export interface LoopbackDurableObjectNamespace extends DurableObjectNamespace {}
3862
+ export interface LoopbackColoLocalActorNamespace extends ColoLocalActorNamespace {}
3841
3863
  export interface SyncKvStorage {
3842
3864
  get<T = unknown>(key: string): T | undefined;
3843
3865
  list<T = unknown>(options?: SyncKvListOptions): Iterable<[string, T]>;
@@ -3857,6 +3879,10 @@ export interface WorkerStub {
3857
3879
  name?: string,
3858
3880
  options?: WorkerStubEntrypointOptions,
3859
3881
  ): Fetcher<T>;
3882
+ getDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined>(
3883
+ name?: string,
3884
+ options?: WorkerStubEntrypointOptions,
3885
+ ): DurableObjectClass<T>;
3860
3886
  }
3861
3887
  export interface WorkerStubEntrypointOptions {
3862
3888
  props?: any;
@@ -11990,6 +12016,140 @@ export declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
11990
12016
  env: Env,
11991
12017
  ctx: ExecutionContext<Props>,
11992
12018
  ) => void | Promise<void>;
12019
+ /**
12020
+ * Evaluation context for targeting rules.
12021
+ * Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
12022
+ */
12023
+ export type EvaluationContext = Record<string, string | number | boolean>;
12024
+ export interface EvaluationDetails<T> {
12025
+ flagKey: string;
12026
+ value: T;
12027
+ variant?: string | undefined;
12028
+ reason?: string | undefined;
12029
+ errorCode?: string | undefined;
12030
+ errorMessage?: string | undefined;
12031
+ }
12032
+ export interface FlagEvaluationError extends Error {}
12033
+ /**
12034
+ * Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
12035
+ *
12036
+ * @example
12037
+ * ```typescript
12038
+ * // Get a boolean flag value with a default
12039
+ * const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
12040
+ *
12041
+ * // Get a flag value with evaluation context for targeting
12042
+ * const variant = await env.FLAGS.getStringValue('experiment', 'control', {
12043
+ * userId: 'user-123',
12044
+ * country: 'US',
12045
+ * });
12046
+ *
12047
+ * // Get full evaluation details including variant and reason
12048
+ * const details = await env.FLAGS.getBooleanDetails('my-feature', false);
12049
+ * console.log(details.variant, details.reason);
12050
+ * ```
12051
+ */
12052
+ export declare abstract class Flags {
12053
+ /**
12054
+ * Get a flag value without type checking.
12055
+ * @param flagKey The key of the flag to evaluate.
12056
+ * @param defaultValue Optional default value returned when evaluation fails.
12057
+ * @param context Optional evaluation context for targeting rules.
12058
+ */
12059
+ get(
12060
+ flagKey: string,
12061
+ defaultValue?: unknown,
12062
+ context?: EvaluationContext,
12063
+ ): Promise<unknown>;
12064
+ /**
12065
+ * Get a boolean flag value.
12066
+ * @param flagKey The key of the flag to evaluate.
12067
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12068
+ * @param context Optional evaluation context for targeting rules.
12069
+ */
12070
+ getBooleanValue(
12071
+ flagKey: string,
12072
+ defaultValue: boolean,
12073
+ context?: EvaluationContext,
12074
+ ): Promise<boolean>;
12075
+ /**
12076
+ * Get a string flag value.
12077
+ * @param flagKey The key of the flag to evaluate.
12078
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12079
+ * @param context Optional evaluation context for targeting rules.
12080
+ */
12081
+ getStringValue(
12082
+ flagKey: string,
12083
+ defaultValue: string,
12084
+ context?: EvaluationContext,
12085
+ ): Promise<string>;
12086
+ /**
12087
+ * Get a number flag value.
12088
+ * @param flagKey The key of the flag to evaluate.
12089
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12090
+ * @param context Optional evaluation context for targeting rules.
12091
+ */
12092
+ getNumberValue(
12093
+ flagKey: string,
12094
+ defaultValue: number,
12095
+ context?: EvaluationContext,
12096
+ ): Promise<number>;
12097
+ /**
12098
+ * Get an object 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
+ getObjectValue<T extends object>(
12104
+ flagKey: string,
12105
+ defaultValue: T,
12106
+ context?: EvaluationContext,
12107
+ ): Promise<T>;
12108
+ /**
12109
+ * Get a boolean flag value with full evaluation details.
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
+ getBooleanDetails(
12115
+ flagKey: string,
12116
+ defaultValue: boolean,
12117
+ context?: EvaluationContext,
12118
+ ): Promise<EvaluationDetails<boolean>>;
12119
+ /**
12120
+ * Get a string flag value with full evaluation details.
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
+ getStringDetails(
12126
+ flagKey: string,
12127
+ defaultValue: string,
12128
+ context?: EvaluationContext,
12129
+ ): Promise<EvaluationDetails<string>>;
12130
+ /**
12131
+ * Get a number flag value with full evaluation details.
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
+ getNumberDetails(
12137
+ flagKey: string,
12138
+ defaultValue: number,
12139
+ context?: EvaluationContext,
12140
+ ): Promise<EvaluationDetails<number>>;
12141
+ /**
12142
+ * Get an object 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
+ getObjectDetails<T extends object>(
12148
+ flagKey: string,
12149
+ defaultValue: T,
12150
+ context?: EvaluationContext,
12151
+ ): Promise<EvaluationDetails<T>>;
12152
+ }
11993
12153
  /**
11994
12154
  * Hello World binding to serve as an explanatory example. DO NOT USE
11995
12155
  */
@@ -13769,6 +13929,11 @@ export declare namespace TailStream {
13769
13929
  readonly tag?: string;
13770
13930
  readonly message?: string;
13771
13931
  }
13932
+ interface TracePreviewInfo {
13933
+ readonly id: string;
13934
+ readonly slug: string;
13935
+ readonly name: string;
13936
+ }
13772
13937
  interface Onset {
13773
13938
  readonly type: "onset";
13774
13939
  readonly attributes: Attribute[];
@@ -13780,6 +13945,7 @@ export declare namespace TailStream {
13780
13945
  readonly scriptName?: string;
13781
13946
  readonly scriptTags?: string[];
13782
13947
  readonly scriptVersion?: ScriptVersion;
13948
+ readonly preview?: TracePreviewInfo;
13783
13949
  readonly info:
13784
13950
  | FetchEventInfo
13785
13951
  | ConnectEventInfo