@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.
@@ -544,6 +544,9 @@ interface AlarmInvocationInfo {
544
544
  interface Cloudflare {
545
545
  readonly compatibilityFlags: Record<string, boolean>;
546
546
  }
547
+ declare abstract class ColoLocalActorNamespace {
548
+ get(actorId: string): Fetcher;
549
+ }
547
550
  interface DurableObject {
548
551
  fetch(request: Request): Response | Promise<Response>;
549
552
  connect?(socket: Socket): void | Promise<void>;
@@ -623,6 +626,7 @@ interface DurableObjectState<Props = unknown> {
623
626
  readonly id: DurableObjectId;
624
627
  readonly storage: DurableObjectStorage;
625
628
  container?: Container;
629
+ facets: DurableObjectFacets;
626
630
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
627
631
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
628
632
  getWebSockets(tag?: string): WebSocket[];
@@ -737,6 +741,22 @@ declare class WebSocketRequestResponsePair {
737
741
  get request(): string;
738
742
  get response(): string;
739
743
  }
744
+ interface DurableObjectFacets {
745
+ get<T extends Rpc.DurableObjectBranded | undefined = undefined>(
746
+ name: string,
747
+ getStartupOptions: () =>
748
+ | FacetStartupOptions<T>
749
+ | Promise<FacetStartupOptions<T>>,
750
+ ): Fetcher<T>;
751
+ abort(name: string, reason: any): void;
752
+ delete(name: string): void;
753
+ }
754
+ interface FacetStartupOptions<
755
+ T extends Rpc.DurableObjectBranded | undefined = undefined,
756
+ > {
757
+ id?: DurableObjectId | string;
758
+ class: DurableObjectClass<T>;
759
+ }
740
760
  interface AnalyticsEngineDataset {
741
761
  writeDataPoint(event?: AnalyticsEngineDataPoint): void;
742
762
  }
@@ -3757,6 +3777,8 @@ type LoopbackDurableObjectClass<
3757
3777
  (T extends CloudflareWorkersModule.DurableObject<any, infer Props>
3758
3778
  ? (opts: { props?: Props }) => DurableObjectClass<T>
3759
3779
  : (opts: { props?: any }) => DurableObjectClass<T>);
3780
+ interface LoopbackDurableObjectNamespace extends DurableObjectNamespace {}
3781
+ interface LoopbackColoLocalActorNamespace extends ColoLocalActorNamespace {}
3760
3782
  interface SyncKvStorage {
3761
3783
  get<T = unknown>(key: string): T | undefined;
3762
3784
  list<T = unknown>(options?: SyncKvListOptions): Iterable<[string, T]>;
@@ -3776,6 +3798,10 @@ interface WorkerStub {
3776
3798
  name?: string,
3777
3799
  options?: WorkerStubEntrypointOptions,
3778
3800
  ): Fetcher<T>;
3801
+ getDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined>(
3802
+ name?: string,
3803
+ options?: WorkerStubEntrypointOptions,
3804
+ ): DurableObjectClass<T>;
3779
3805
  }
3780
3806
  interface WorkerStubEntrypointOptions {
3781
3807
  props?: any;
@@ -11899,6 +11925,140 @@ declare module "cloudflare:email" {
11899
11925
  };
11900
11926
  export { _EmailMessage as EmailMessage };
11901
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
+ }
11902
12062
  /**
11903
12063
  * Hello World binding to serve as an explanatory example. DO NOT USE
11904
12064
  */
@@ -13737,6 +13897,11 @@ declare namespace TailStream {
13737
13897
  readonly tag?: string;
13738
13898
  readonly message?: string;
13739
13899
  }
13900
+ interface TracePreviewInfo {
13901
+ readonly id: string;
13902
+ readonly slug: string;
13903
+ readonly name: string;
13904
+ }
13740
13905
  interface Onset {
13741
13906
  readonly type: "onset";
13742
13907
  readonly attributes: Attribute[];
@@ -13748,6 +13913,7 @@ declare namespace TailStream {
13748
13913
  readonly scriptName?: string;
13749
13914
  readonly scriptTags?: string[];
13750
13915
  readonly scriptVersion?: ScriptVersion;
13916
+ readonly preview?: TracePreviewInfo;
13751
13917
  readonly info:
13752
13918
  | FetchEventInfo
13753
13919
  | ConnectEventInfo
@@ -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
  }
@@ -3763,6 +3783,8 @@ export type LoopbackDurableObjectClass<
3763
3783
  (T extends CloudflareWorkersModule.DurableObject<any, infer Props>
3764
3784
  ? (opts: { props?: Props }) => DurableObjectClass<T>
3765
3785
  : (opts: { props?: any }) => DurableObjectClass<T>);
3786
+ export interface LoopbackDurableObjectNamespace extends DurableObjectNamespace {}
3787
+ export interface LoopbackColoLocalActorNamespace extends ColoLocalActorNamespace {}
3766
3788
  export interface SyncKvStorage {
3767
3789
  get<T = unknown>(key: string): T | undefined;
3768
3790
  list<T = unknown>(options?: SyncKvListOptions): Iterable<[string, T]>;
@@ -3782,6 +3804,10 @@ export interface WorkerStub {
3782
3804
  name?: string,
3783
3805
  options?: WorkerStubEntrypointOptions,
3784
3806
  ): Fetcher<T>;
3807
+ getDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined>(
3808
+ name?: string,
3809
+ options?: WorkerStubEntrypointOptions,
3810
+ ): DurableObjectClass<T>;
3785
3811
  }
3786
3812
  export interface WorkerStubEntrypointOptions {
3787
3813
  props?: any;
@@ -11915,6 +11941,140 @@ export declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
11915
11941
  env: Env,
11916
11942
  ctx: ExecutionContext<Props>,
11917
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
+ }
11918
12078
  /**
11919
12079
  * Hello World binding to serve as an explanatory example. DO NOT USE
11920
12080
  */
@@ -13694,6 +13854,11 @@ export declare namespace TailStream {
13694
13854
  readonly tag?: string;
13695
13855
  readonly message?: string;
13696
13856
  }
13857
+ interface TracePreviewInfo {
13858
+ readonly id: string;
13859
+ readonly slug: string;
13860
+ readonly name: string;
13861
+ }
13697
13862
  interface Onset {
13698
13863
  readonly type: "onset";
13699
13864
  readonly attributes: Attribute[];
@@ -13705,6 +13870,7 @@ export declare namespace TailStream {
13705
13870
  readonly scriptName?: string;
13706
13871
  readonly scriptTags?: string[];
13707
13872
  readonly scriptVersion?: ScriptVersion;
13873
+ readonly preview?: TracePreviewInfo;
13708
13874
  readonly info:
13709
13875
  | FetchEventInfo
13710
13876
  | ConnectEventInfo
@@ -544,6 +544,9 @@ interface AlarmInvocationInfo {
544
544
  interface Cloudflare {
545
545
  readonly compatibilityFlags: Record<string, boolean>;
546
546
  }
547
+ declare abstract class ColoLocalActorNamespace {
548
+ get(actorId: string): Fetcher;
549
+ }
547
550
  interface DurableObject {
548
551
  fetch(request: Request): Response | Promise<Response>;
549
552
  connect?(socket: Socket): void | Promise<void>;
@@ -623,6 +626,7 @@ interface DurableObjectState<Props = unknown> {
623
626
  readonly id: DurableObjectId;
624
627
  readonly storage: DurableObjectStorage;
625
628
  container?: Container;
629
+ facets: DurableObjectFacets;
626
630
  blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
627
631
  acceptWebSocket(ws: WebSocket, tags?: string[]): void;
628
632
  getWebSockets(tag?: string): WebSocket[];
@@ -737,6 +741,22 @@ declare class WebSocketRequestResponsePair {
737
741
  get request(): string;
738
742
  get response(): string;
739
743
  }
744
+ interface DurableObjectFacets {
745
+ get<T extends Rpc.DurableObjectBranded | undefined = undefined>(
746
+ name: string,
747
+ getStartupOptions: () =>
748
+ | FacetStartupOptions<T>
749
+ | Promise<FacetStartupOptions<T>>,
750
+ ): Fetcher<T>;
751
+ abort(name: string, reason: any): void;
752
+ delete(name: string): void;
753
+ }
754
+ interface FacetStartupOptions<
755
+ T extends Rpc.DurableObjectBranded | undefined = undefined,
756
+ > {
757
+ id?: DurableObjectId | string;
758
+ class: DurableObjectClass<T>;
759
+ }
740
760
  interface AnalyticsEngineDataset {
741
761
  writeDataPoint(event?: AnalyticsEngineDataPoint): void;
742
762
  }
@@ -3824,6 +3844,8 @@ type LoopbackDurableObjectClass<
3824
3844
  (T extends CloudflareWorkersModule.DurableObject<any, infer Props>
3825
3845
  ? (opts: { props?: Props }) => DurableObjectClass<T>
3826
3846
  : (opts: { props?: any }) => DurableObjectClass<T>);
3847
+ interface LoopbackDurableObjectNamespace extends DurableObjectNamespace {}
3848
+ interface LoopbackColoLocalActorNamespace extends ColoLocalActorNamespace {}
3827
3849
  interface SyncKvStorage {
3828
3850
  get<T = unknown>(key: string): T | undefined;
3829
3851
  list<T = unknown>(options?: SyncKvListOptions): Iterable<[string, T]>;
@@ -3843,6 +3865,10 @@ interface WorkerStub {
3843
3865
  name?: string,
3844
3866
  options?: WorkerStubEntrypointOptions,
3845
3867
  ): Fetcher<T>;
3868
+ getDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined>(
3869
+ name?: string,
3870
+ options?: WorkerStubEntrypointOptions,
3871
+ ): DurableObjectClass<T>;
3846
3872
  }
3847
3873
  interface WorkerStubEntrypointOptions {
3848
3874
  props?: any;
@@ -11966,6 +11992,140 @@ declare module "cloudflare:email" {
11966
11992
  };
11967
11993
  export { _EmailMessage as EmailMessage };
11968
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
+ }
11969
12129
  /**
11970
12130
  * Hello World binding to serve as an explanatory example. DO NOT USE
11971
12131
  */
@@ -13804,6 +13964,11 @@ declare namespace TailStream {
13804
13964
  readonly tag?: string;
13805
13965
  readonly message?: string;
13806
13966
  }
13967
+ interface TracePreviewInfo {
13968
+ readonly id: string;
13969
+ readonly slug: string;
13970
+ readonly name: string;
13971
+ }
13807
13972
  interface Onset {
13808
13973
  readonly type: "onset";
13809
13974
  readonly attributes: Attribute[];
@@ -13815,6 +13980,7 @@ declare namespace TailStream {
13815
13980
  readonly scriptName?: string;
13816
13981
  readonly scriptTags?: string[];
13817
13982
  readonly scriptVersion?: ScriptVersion;
13983
+ readonly preview?: TracePreviewInfo;
13818
13984
  readonly info:
13819
13985
  | FetchEventInfo
13820
13986
  | ConnectEventInfo