@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.
@@ -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
  }
@@ -3833,6 +3853,8 @@ type LoopbackDurableObjectClass<
3833
3853
  (T extends CloudflareWorkersModule.DurableObject<any, infer Props>
3834
3854
  ? (opts: { props?: Props }) => DurableObjectClass<T>
3835
3855
  : (opts: { props?: any }) => DurableObjectClass<T>);
3856
+ interface LoopbackDurableObjectNamespace extends DurableObjectNamespace {}
3857
+ interface LoopbackColoLocalActorNamespace extends ColoLocalActorNamespace {}
3836
3858
  interface SyncKvStorage {
3837
3859
  get<T = unknown>(key: string): T | undefined;
3838
3860
  list<T = unknown>(options?: SyncKvListOptions): Iterable<[string, T]>;
@@ -3852,6 +3874,10 @@ interface WorkerStub {
3852
3874
  name?: string,
3853
3875
  options?: WorkerStubEntrypointOptions,
3854
3876
  ): Fetcher<T>;
3877
+ getDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined>(
3878
+ name?: string,
3879
+ options?: WorkerStubEntrypointOptions,
3880
+ ): DurableObjectClass<T>;
3855
3881
  }
3856
3882
  interface WorkerStubEntrypointOptions {
3857
3883
  props?: any;
@@ -11975,6 +12001,140 @@ declare module "cloudflare:email" {
11975
12001
  };
11976
12002
  export { _EmailMessage as EmailMessage };
11977
12003
  }
12004
+ /**
12005
+ * Evaluation context for targeting rules.
12006
+ * Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
12007
+ */
12008
+ type EvaluationContext = Record<string, string | number | boolean>;
12009
+ interface EvaluationDetails<T> {
12010
+ flagKey: string;
12011
+ value: T;
12012
+ variant?: string | undefined;
12013
+ reason?: string | undefined;
12014
+ errorCode?: string | undefined;
12015
+ errorMessage?: string | undefined;
12016
+ }
12017
+ interface FlagEvaluationError extends Error {}
12018
+ /**
12019
+ * Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
12020
+ *
12021
+ * @example
12022
+ * ```typescript
12023
+ * // Get a boolean flag value with a default
12024
+ * const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
12025
+ *
12026
+ * // Get a flag value with evaluation context for targeting
12027
+ * const variant = await env.FLAGS.getStringValue('experiment', 'control', {
12028
+ * userId: 'user-123',
12029
+ * country: 'US',
12030
+ * });
12031
+ *
12032
+ * // Get full evaluation details including variant and reason
12033
+ * const details = await env.FLAGS.getBooleanDetails('my-feature', false);
12034
+ * console.log(details.variant, details.reason);
12035
+ * ```
12036
+ */
12037
+ declare abstract class Flags {
12038
+ /**
12039
+ * Get a flag value without type checking.
12040
+ * @param flagKey The key of the flag to evaluate.
12041
+ * @param defaultValue Optional default value returned when evaluation fails.
12042
+ * @param context Optional evaluation context for targeting rules.
12043
+ */
12044
+ get(
12045
+ flagKey: string,
12046
+ defaultValue?: unknown,
12047
+ context?: EvaluationContext,
12048
+ ): Promise<unknown>;
12049
+ /**
12050
+ * Get a boolean flag value.
12051
+ * @param flagKey The key of the flag to evaluate.
12052
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12053
+ * @param context Optional evaluation context for targeting rules.
12054
+ */
12055
+ getBooleanValue(
12056
+ flagKey: string,
12057
+ defaultValue: boolean,
12058
+ context?: EvaluationContext,
12059
+ ): Promise<boolean>;
12060
+ /**
12061
+ * Get a string flag value.
12062
+ * @param flagKey The key of the flag to evaluate.
12063
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12064
+ * @param context Optional evaluation context for targeting rules.
12065
+ */
12066
+ getStringValue(
12067
+ flagKey: string,
12068
+ defaultValue: string,
12069
+ context?: EvaluationContext,
12070
+ ): Promise<string>;
12071
+ /**
12072
+ * Get a number flag value.
12073
+ * @param flagKey The key of the flag to evaluate.
12074
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12075
+ * @param context Optional evaluation context for targeting rules.
12076
+ */
12077
+ getNumberValue(
12078
+ flagKey: string,
12079
+ defaultValue: number,
12080
+ context?: EvaluationContext,
12081
+ ): Promise<number>;
12082
+ /**
12083
+ * Get an object flag value.
12084
+ * @param flagKey The key of the flag to evaluate.
12085
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12086
+ * @param context Optional evaluation context for targeting rules.
12087
+ */
12088
+ getObjectValue<T extends object>(
12089
+ flagKey: string,
12090
+ defaultValue: T,
12091
+ context?: EvaluationContext,
12092
+ ): Promise<T>;
12093
+ /**
12094
+ * Get a boolean flag value with full evaluation details.
12095
+ * @param flagKey The key of the flag to evaluate.
12096
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12097
+ * @param context Optional evaluation context for targeting rules.
12098
+ */
12099
+ getBooleanDetails(
12100
+ flagKey: string,
12101
+ defaultValue: boolean,
12102
+ context?: EvaluationContext,
12103
+ ): Promise<EvaluationDetails<boolean>>;
12104
+ /**
12105
+ * Get a string flag value with full evaluation details.
12106
+ * @param flagKey The key of the flag to evaluate.
12107
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12108
+ * @param context Optional evaluation context for targeting rules.
12109
+ */
12110
+ getStringDetails(
12111
+ flagKey: string,
12112
+ defaultValue: string,
12113
+ context?: EvaluationContext,
12114
+ ): Promise<EvaluationDetails<string>>;
12115
+ /**
12116
+ * Get a number flag value with full evaluation details.
12117
+ * @param flagKey The key of the flag to evaluate.
12118
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12119
+ * @param context Optional evaluation context for targeting rules.
12120
+ */
12121
+ getNumberDetails(
12122
+ flagKey: string,
12123
+ defaultValue: number,
12124
+ context?: EvaluationContext,
12125
+ ): Promise<EvaluationDetails<number>>;
12126
+ /**
12127
+ * Get an object flag value with full evaluation details.
12128
+ * @param flagKey The key of the flag to evaluate.
12129
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12130
+ * @param context Optional evaluation context for targeting rules.
12131
+ */
12132
+ getObjectDetails<T extends object>(
12133
+ flagKey: string,
12134
+ defaultValue: T,
12135
+ context?: EvaluationContext,
12136
+ ): Promise<EvaluationDetails<T>>;
12137
+ }
11978
12138
  /**
11979
12139
  * Hello World binding to serve as an explanatory example. DO NOT USE
11980
12140
  */
@@ -13813,6 +13973,11 @@ declare namespace TailStream {
13813
13973
  readonly tag?: string;
13814
13974
  readonly message?: string;
13815
13975
  }
13976
+ interface TracePreviewInfo {
13977
+ readonly id: string;
13978
+ readonly slug: string;
13979
+ readonly name: string;
13980
+ }
13816
13981
  interface Onset {
13817
13982
  readonly type: "onset";
13818
13983
  readonly attributes: Attribute[];
@@ -13824,6 +13989,7 @@ declare namespace TailStream {
13824
13989
  readonly scriptName?: string;
13825
13990
  readonly scriptTags?: string[];
13826
13991
  readonly scriptVersion?: ScriptVersion;
13992
+ readonly preview?: TracePreviewInfo;
13827
13993
  readonly info:
13828
13994
  | FetchEventInfo
13829
13995
  | 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
  }
@@ -3839,6 +3859,8 @@ export type LoopbackDurableObjectClass<
3839
3859
  (T extends CloudflareWorkersModule.DurableObject<any, infer Props>
3840
3860
  ? (opts: { props?: Props }) => DurableObjectClass<T>
3841
3861
  : (opts: { props?: any }) => DurableObjectClass<T>);
3862
+ export interface LoopbackDurableObjectNamespace extends DurableObjectNamespace {}
3863
+ export interface LoopbackColoLocalActorNamespace extends ColoLocalActorNamespace {}
3842
3864
  export interface SyncKvStorage {
3843
3865
  get<T = unknown>(key: string): T | undefined;
3844
3866
  list<T = unknown>(options?: SyncKvListOptions): Iterable<[string, T]>;
@@ -3858,6 +3880,10 @@ export interface WorkerStub {
3858
3880
  name?: string,
3859
3881
  options?: WorkerStubEntrypointOptions,
3860
3882
  ): Fetcher<T>;
3883
+ getDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined>(
3884
+ name?: string,
3885
+ options?: WorkerStubEntrypointOptions,
3886
+ ): DurableObjectClass<T>;
3861
3887
  }
3862
3888
  export interface WorkerStubEntrypointOptions {
3863
3889
  props?: any;
@@ -11991,6 +12017,140 @@ export declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
11991
12017
  env: Env,
11992
12018
  ctx: ExecutionContext<Props>,
11993
12019
  ) => void | Promise<void>;
12020
+ /**
12021
+ * Evaluation context for targeting rules.
12022
+ * Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
12023
+ */
12024
+ export type EvaluationContext = Record<string, string | number | boolean>;
12025
+ export interface EvaluationDetails<T> {
12026
+ flagKey: string;
12027
+ value: T;
12028
+ variant?: string | undefined;
12029
+ reason?: string | undefined;
12030
+ errorCode?: string | undefined;
12031
+ errorMessage?: string | undefined;
12032
+ }
12033
+ export interface FlagEvaluationError extends Error {}
12034
+ /**
12035
+ * Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
12036
+ *
12037
+ * @example
12038
+ * ```typescript
12039
+ * // Get a boolean flag value with a default
12040
+ * const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
12041
+ *
12042
+ * // Get a flag value with evaluation context for targeting
12043
+ * const variant = await env.FLAGS.getStringValue('experiment', 'control', {
12044
+ * userId: 'user-123',
12045
+ * country: 'US',
12046
+ * });
12047
+ *
12048
+ * // Get full evaluation details including variant and reason
12049
+ * const details = await env.FLAGS.getBooleanDetails('my-feature', false);
12050
+ * console.log(details.variant, details.reason);
12051
+ * ```
12052
+ */
12053
+ export declare abstract class Flags {
12054
+ /**
12055
+ * Get a flag value without type checking.
12056
+ * @param flagKey The key of the flag to evaluate.
12057
+ * @param defaultValue Optional default value returned when evaluation fails.
12058
+ * @param context Optional evaluation context for targeting rules.
12059
+ */
12060
+ get(
12061
+ flagKey: string,
12062
+ defaultValue?: unknown,
12063
+ context?: EvaluationContext,
12064
+ ): Promise<unknown>;
12065
+ /**
12066
+ * Get a boolean flag value.
12067
+ * @param flagKey The key of the flag to evaluate.
12068
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12069
+ * @param context Optional evaluation context for targeting rules.
12070
+ */
12071
+ getBooleanValue(
12072
+ flagKey: string,
12073
+ defaultValue: boolean,
12074
+ context?: EvaluationContext,
12075
+ ): Promise<boolean>;
12076
+ /**
12077
+ * Get a string flag value.
12078
+ * @param flagKey The key of the flag to evaluate.
12079
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12080
+ * @param context Optional evaluation context for targeting rules.
12081
+ */
12082
+ getStringValue(
12083
+ flagKey: string,
12084
+ defaultValue: string,
12085
+ context?: EvaluationContext,
12086
+ ): Promise<string>;
12087
+ /**
12088
+ * Get a number flag value.
12089
+ * @param flagKey The key of the flag to evaluate.
12090
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12091
+ * @param context Optional evaluation context for targeting rules.
12092
+ */
12093
+ getNumberValue(
12094
+ flagKey: string,
12095
+ defaultValue: number,
12096
+ context?: EvaluationContext,
12097
+ ): Promise<number>;
12098
+ /**
12099
+ * Get an object flag value.
12100
+ * @param flagKey The key of the flag to evaluate.
12101
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12102
+ * @param context Optional evaluation context for targeting rules.
12103
+ */
12104
+ getObjectValue<T extends object>(
12105
+ flagKey: string,
12106
+ defaultValue: T,
12107
+ context?: EvaluationContext,
12108
+ ): Promise<T>;
12109
+ /**
12110
+ * Get a boolean flag value with full evaluation details.
12111
+ * @param flagKey The key of the flag to evaluate.
12112
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12113
+ * @param context Optional evaluation context for targeting rules.
12114
+ */
12115
+ getBooleanDetails(
12116
+ flagKey: string,
12117
+ defaultValue: boolean,
12118
+ context?: EvaluationContext,
12119
+ ): Promise<EvaluationDetails<boolean>>;
12120
+ /**
12121
+ * Get a string flag value with full evaluation details.
12122
+ * @param flagKey The key of the flag to evaluate.
12123
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12124
+ * @param context Optional evaluation context for targeting rules.
12125
+ */
12126
+ getStringDetails(
12127
+ flagKey: string,
12128
+ defaultValue: string,
12129
+ context?: EvaluationContext,
12130
+ ): Promise<EvaluationDetails<string>>;
12131
+ /**
12132
+ * Get a number flag value with full evaluation details.
12133
+ * @param flagKey The key of the flag to evaluate.
12134
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12135
+ * @param context Optional evaluation context for targeting rules.
12136
+ */
12137
+ getNumberDetails(
12138
+ flagKey: string,
12139
+ defaultValue: number,
12140
+ context?: EvaluationContext,
12141
+ ): Promise<EvaluationDetails<number>>;
12142
+ /**
12143
+ * Get an object flag value with full evaluation details.
12144
+ * @param flagKey The key of the flag to evaluate.
12145
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12146
+ * @param context Optional evaluation context for targeting rules.
12147
+ */
12148
+ getObjectDetails<T extends object>(
12149
+ flagKey: string,
12150
+ defaultValue: T,
12151
+ context?: EvaluationContext,
12152
+ ): Promise<EvaluationDetails<T>>;
12153
+ }
11994
12154
  /**
11995
12155
  * Hello World binding to serve as an explanatory example. DO NOT USE
11996
12156
  */
@@ -13770,6 +13930,11 @@ export declare namespace TailStream {
13770
13930
  readonly tag?: string;
13771
13931
  readonly message?: string;
13772
13932
  }
13933
+ interface TracePreviewInfo {
13934
+ readonly id: string;
13935
+ readonly slug: string;
13936
+ readonly name: string;
13937
+ }
13773
13938
  interface Onset {
13774
13939
  readonly type: "onset";
13775
13940
  readonly attributes: Attribute[];
@@ -13781,6 +13946,7 @@ export declare namespace TailStream {
13781
13946
  readonly scriptName?: string;
13782
13947
  readonly scriptTags?: string[];
13783
13948
  readonly scriptVersion?: ScriptVersion;
13949
+ readonly preview?: TracePreviewInfo;
13784
13950
  readonly info:
13785
13951
  | FetchEventInfo
13786
13952
  | 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
  }
@@ -3853,6 +3873,8 @@ type LoopbackDurableObjectClass<
3853
3873
  (T extends CloudflareWorkersModule.DurableObject<any, infer Props>
3854
3874
  ? (opts: { props?: Props }) => DurableObjectClass<T>
3855
3875
  : (opts: { props?: any }) => DurableObjectClass<T>);
3876
+ interface LoopbackDurableObjectNamespace extends DurableObjectNamespace {}
3877
+ interface LoopbackColoLocalActorNamespace extends ColoLocalActorNamespace {}
3856
3878
  interface SyncKvStorage {
3857
3879
  get<T = unknown>(key: string): T | undefined;
3858
3880
  list<T = unknown>(options?: SyncKvListOptions): Iterable<[string, T]>;
@@ -3872,6 +3894,10 @@ interface WorkerStub {
3872
3894
  name?: string,
3873
3895
  options?: WorkerStubEntrypointOptions,
3874
3896
  ): Fetcher<T>;
3897
+ getDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined>(
3898
+ name?: string,
3899
+ options?: WorkerStubEntrypointOptions,
3900
+ ): DurableObjectClass<T>;
3875
3901
  }
3876
3902
  interface WorkerStubEntrypointOptions {
3877
3903
  props?: any;
@@ -11995,6 +12021,140 @@ declare module "cloudflare:email" {
11995
12021
  };
11996
12022
  export { _EmailMessage as EmailMessage };
11997
12023
  }
12024
+ /**
12025
+ * Evaluation context for targeting rules.
12026
+ * Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
12027
+ */
12028
+ type EvaluationContext = Record<string, string | number | boolean>;
12029
+ interface EvaluationDetails<T> {
12030
+ flagKey: string;
12031
+ value: T;
12032
+ variant?: string | undefined;
12033
+ reason?: string | undefined;
12034
+ errorCode?: string | undefined;
12035
+ errorMessage?: string | undefined;
12036
+ }
12037
+ interface FlagEvaluationError extends Error {}
12038
+ /**
12039
+ * Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
12040
+ *
12041
+ * @example
12042
+ * ```typescript
12043
+ * // Get a boolean flag value with a default
12044
+ * const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
12045
+ *
12046
+ * // Get a flag value with evaluation context for targeting
12047
+ * const variant = await env.FLAGS.getStringValue('experiment', 'control', {
12048
+ * userId: 'user-123',
12049
+ * country: 'US',
12050
+ * });
12051
+ *
12052
+ * // Get full evaluation details including variant and reason
12053
+ * const details = await env.FLAGS.getBooleanDetails('my-feature', false);
12054
+ * console.log(details.variant, details.reason);
12055
+ * ```
12056
+ */
12057
+ declare abstract class Flags {
12058
+ /**
12059
+ * Get a flag value without type checking.
12060
+ * @param flagKey The key of the flag to evaluate.
12061
+ * @param defaultValue Optional default value returned when evaluation fails.
12062
+ * @param context Optional evaluation context for targeting rules.
12063
+ */
12064
+ get(
12065
+ flagKey: string,
12066
+ defaultValue?: unknown,
12067
+ context?: EvaluationContext,
12068
+ ): Promise<unknown>;
12069
+ /**
12070
+ * Get a boolean flag value.
12071
+ * @param flagKey The key of the flag to evaluate.
12072
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12073
+ * @param context Optional evaluation context for targeting rules.
12074
+ */
12075
+ getBooleanValue(
12076
+ flagKey: string,
12077
+ defaultValue: boolean,
12078
+ context?: EvaluationContext,
12079
+ ): Promise<boolean>;
12080
+ /**
12081
+ * Get a string flag value.
12082
+ * @param flagKey The key of the flag to evaluate.
12083
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12084
+ * @param context Optional evaluation context for targeting rules.
12085
+ */
12086
+ getStringValue(
12087
+ flagKey: string,
12088
+ defaultValue: string,
12089
+ context?: EvaluationContext,
12090
+ ): Promise<string>;
12091
+ /**
12092
+ * Get a number flag value.
12093
+ * @param flagKey The key of the flag to evaluate.
12094
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12095
+ * @param context Optional evaluation context for targeting rules.
12096
+ */
12097
+ getNumberValue(
12098
+ flagKey: string,
12099
+ defaultValue: number,
12100
+ context?: EvaluationContext,
12101
+ ): Promise<number>;
12102
+ /**
12103
+ * Get an object flag value.
12104
+ * @param flagKey The key of the flag to evaluate.
12105
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12106
+ * @param context Optional evaluation context for targeting rules.
12107
+ */
12108
+ getObjectValue<T extends object>(
12109
+ flagKey: string,
12110
+ defaultValue: T,
12111
+ context?: EvaluationContext,
12112
+ ): Promise<T>;
12113
+ /**
12114
+ * Get a boolean flag value with full evaluation details.
12115
+ * @param flagKey The key of the flag to evaluate.
12116
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12117
+ * @param context Optional evaluation context for targeting rules.
12118
+ */
12119
+ getBooleanDetails(
12120
+ flagKey: string,
12121
+ defaultValue: boolean,
12122
+ context?: EvaluationContext,
12123
+ ): Promise<EvaluationDetails<boolean>>;
12124
+ /**
12125
+ * Get a string flag value with full evaluation details.
12126
+ * @param flagKey The key of the flag to evaluate.
12127
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12128
+ * @param context Optional evaluation context for targeting rules.
12129
+ */
12130
+ getStringDetails(
12131
+ flagKey: string,
12132
+ defaultValue: string,
12133
+ context?: EvaluationContext,
12134
+ ): Promise<EvaluationDetails<string>>;
12135
+ /**
12136
+ * Get a number flag value with full evaluation details.
12137
+ * @param flagKey The key of the flag to evaluate.
12138
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12139
+ * @param context Optional evaluation context for targeting rules.
12140
+ */
12141
+ getNumberDetails(
12142
+ flagKey: string,
12143
+ defaultValue: number,
12144
+ context?: EvaluationContext,
12145
+ ): Promise<EvaluationDetails<number>>;
12146
+ /**
12147
+ * Get an object flag value with full evaluation details.
12148
+ * @param flagKey The key of the flag to evaluate.
12149
+ * @param defaultValue Default value returned when evaluation fails or the flag type does not match.
12150
+ * @param context Optional evaluation context for targeting rules.
12151
+ */
12152
+ getObjectDetails<T extends object>(
12153
+ flagKey: string,
12154
+ defaultValue: T,
12155
+ context?: EvaluationContext,
12156
+ ): Promise<EvaluationDetails<T>>;
12157
+ }
11998
12158
  /**
11999
12159
  * Hello World binding to serve as an explanatory example. DO NOT USE
12000
12160
  */
@@ -13833,6 +13993,11 @@ declare namespace TailStream {
13833
13993
  readonly tag?: string;
13834
13994
  readonly message?: string;
13835
13995
  }
13996
+ interface TracePreviewInfo {
13997
+ readonly id: string;
13998
+ readonly slug: string;
13999
+ readonly name: string;
14000
+ }
13836
14001
  interface Onset {
13837
14002
  readonly type: "onset";
13838
14003
  readonly attributes: Attribute[];
@@ -13844,6 +14009,7 @@ declare namespace TailStream {
13844
14009
  readonly scriptName?: string;
13845
14010
  readonly scriptTags?: string[];
13846
14011
  readonly scriptVersion?: ScriptVersion;
14012
+ readonly preview?: TracePreviewInfo;
13847
14013
  readonly info:
13848
14014
  | FetchEventInfo
13849
14015
  | ConnectEventInfo