@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.
- package/2021-11-03/index.d.ts +166 -0
- package/2021-11-03/index.ts +166 -0
- package/2022-01-31/index.d.ts +166 -0
- package/2022-01-31/index.ts +166 -0
- package/2022-03-21/index.d.ts +166 -0
- package/2022-03-21/index.ts +166 -0
- package/2022-08-04/index.d.ts +166 -0
- package/2022-08-04/index.ts +166 -0
- package/2022-10-31/index.d.ts +166 -0
- package/2022-10-31/index.ts +166 -0
- package/2022-11-30/index.d.ts +166 -0
- package/2022-11-30/index.ts +166 -0
- package/2023-03-01/index.d.ts +166 -0
- package/2023-03-01/index.ts +166 -0
- package/2023-07-01/index.d.ts +166 -0
- package/2023-07-01/index.ts +166 -0
- package/experimental/index.d.ts +140 -0
- package/experimental/index.ts +140 -0
- package/index.d.ts +166 -0
- package/index.ts +166 -0
- package/latest/index.d.ts +166 -0
- package/latest/index.ts +166 -0
- package/oldest/index.d.ts +166 -0
- package/oldest/index.ts +166 -0
- package/package.json +1 -1
package/latest/index.ts
CHANGED
|
@@ -564,6 +564,9 @@ export interface AlarmInvocationInfo {
|
|
|
564
564
|
export interface Cloudflare {
|
|
565
565
|
readonly compatibilityFlags: Record<string, boolean>;
|
|
566
566
|
}
|
|
567
|
+
export declare abstract class ColoLocalActorNamespace {
|
|
568
|
+
get(actorId: string): Fetcher;
|
|
569
|
+
}
|
|
567
570
|
export interface DurableObject {
|
|
568
571
|
fetch(request: Request): Response | Promise<Response>;
|
|
569
572
|
connect?(socket: Socket): void | Promise<void>;
|
|
@@ -644,6 +647,7 @@ export interface DurableObjectState<Props = unknown> {
|
|
|
644
647
|
readonly id: DurableObjectId;
|
|
645
648
|
readonly storage: DurableObjectStorage;
|
|
646
649
|
container?: Container;
|
|
650
|
+
facets: DurableObjectFacets;
|
|
647
651
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
648
652
|
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
649
653
|
getWebSockets(tag?: string): WebSocket[];
|
|
@@ -758,6 +762,22 @@ export declare class WebSocketRequestResponsePair {
|
|
|
758
762
|
get request(): string;
|
|
759
763
|
get response(): string;
|
|
760
764
|
}
|
|
765
|
+
export interface DurableObjectFacets {
|
|
766
|
+
get<T extends Rpc.DurableObjectBranded | undefined = undefined>(
|
|
767
|
+
name: string,
|
|
768
|
+
getStartupOptions: () =>
|
|
769
|
+
| FacetStartupOptions<T>
|
|
770
|
+
| Promise<FacetStartupOptions<T>>,
|
|
771
|
+
): Fetcher<T>;
|
|
772
|
+
abort(name: string, reason: any): void;
|
|
773
|
+
delete(name: string): void;
|
|
774
|
+
}
|
|
775
|
+
export interface FacetStartupOptions<
|
|
776
|
+
T extends Rpc.DurableObjectBranded | undefined = undefined,
|
|
777
|
+
> {
|
|
778
|
+
id?: DurableObjectId | string;
|
|
779
|
+
class: DurableObjectClass<T>;
|
|
780
|
+
}
|
|
761
781
|
export interface AnalyticsEngineDataset {
|
|
762
782
|
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
|
|
763
783
|
}
|
|
@@ -3903,6 +3923,8 @@ export type LoopbackDurableObjectClass<
|
|
|
3903
3923
|
(T extends CloudflareWorkersModule.DurableObject<any, infer Props>
|
|
3904
3924
|
? (opts: { props?: Props }) => DurableObjectClass<T>
|
|
3905
3925
|
: (opts: { props?: any }) => DurableObjectClass<T>);
|
|
3926
|
+
export interface LoopbackDurableObjectNamespace extends DurableObjectNamespace {}
|
|
3927
|
+
export interface LoopbackColoLocalActorNamespace extends ColoLocalActorNamespace {}
|
|
3906
3928
|
export interface SyncKvStorage {
|
|
3907
3929
|
get<T = unknown>(key: string): T | undefined;
|
|
3908
3930
|
list<T = unknown>(options?: SyncKvListOptions): Iterable<[string, T]>;
|
|
@@ -3922,6 +3944,10 @@ export interface WorkerStub {
|
|
|
3922
3944
|
name?: string,
|
|
3923
3945
|
options?: WorkerStubEntrypointOptions,
|
|
3924
3946
|
): Fetcher<T>;
|
|
3947
|
+
getDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined>(
|
|
3948
|
+
name?: string,
|
|
3949
|
+
options?: WorkerStubEntrypointOptions,
|
|
3950
|
+
): DurableObjectClass<T>;
|
|
3925
3951
|
}
|
|
3926
3952
|
export interface WorkerStubEntrypointOptions {
|
|
3927
3953
|
props?: any;
|
|
@@ -12055,6 +12081,140 @@ export declare type EmailExportedHandler<Env = unknown, Props = unknown> = (
|
|
|
12055
12081
|
env: Env,
|
|
12056
12082
|
ctx: ExecutionContext<Props>,
|
|
12057
12083
|
) => void | Promise<void>;
|
|
12084
|
+
/**
|
|
12085
|
+
* Evaluation context for targeting rules.
|
|
12086
|
+
* Keys are attribute names (e.g. "userId", "country"), values are the attribute values.
|
|
12087
|
+
*/
|
|
12088
|
+
export type EvaluationContext = Record<string, string | number | boolean>;
|
|
12089
|
+
export interface EvaluationDetails<T> {
|
|
12090
|
+
flagKey: string;
|
|
12091
|
+
value: T;
|
|
12092
|
+
variant?: string | undefined;
|
|
12093
|
+
reason?: string | undefined;
|
|
12094
|
+
errorCode?: string | undefined;
|
|
12095
|
+
errorMessage?: string | undefined;
|
|
12096
|
+
}
|
|
12097
|
+
export interface FlagEvaluationError extends Error {}
|
|
12098
|
+
/**
|
|
12099
|
+
* Feature flags binding for evaluating feature flags from a Cloudflare Workers script.
|
|
12100
|
+
*
|
|
12101
|
+
* @example
|
|
12102
|
+
* ```typescript
|
|
12103
|
+
* // Get a boolean flag value with a default
|
|
12104
|
+
* const enabled = await env.FLAGS.getBooleanValue('my-feature', false);
|
|
12105
|
+
*
|
|
12106
|
+
* // Get a flag value with evaluation context for targeting
|
|
12107
|
+
* const variant = await env.FLAGS.getStringValue('experiment', 'control', {
|
|
12108
|
+
* userId: 'user-123',
|
|
12109
|
+
* country: 'US',
|
|
12110
|
+
* });
|
|
12111
|
+
*
|
|
12112
|
+
* // Get full evaluation details including variant and reason
|
|
12113
|
+
* const details = await env.FLAGS.getBooleanDetails('my-feature', false);
|
|
12114
|
+
* console.log(details.variant, details.reason);
|
|
12115
|
+
* ```
|
|
12116
|
+
*/
|
|
12117
|
+
export declare abstract class Flags {
|
|
12118
|
+
/**
|
|
12119
|
+
* Get a flag value without type checking.
|
|
12120
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12121
|
+
* @param defaultValue Optional default value returned when evaluation fails.
|
|
12122
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12123
|
+
*/
|
|
12124
|
+
get(
|
|
12125
|
+
flagKey: string,
|
|
12126
|
+
defaultValue?: unknown,
|
|
12127
|
+
context?: EvaluationContext,
|
|
12128
|
+
): Promise<unknown>;
|
|
12129
|
+
/**
|
|
12130
|
+
* Get a boolean flag value.
|
|
12131
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12132
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12133
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12134
|
+
*/
|
|
12135
|
+
getBooleanValue(
|
|
12136
|
+
flagKey: string,
|
|
12137
|
+
defaultValue: boolean,
|
|
12138
|
+
context?: EvaluationContext,
|
|
12139
|
+
): Promise<boolean>;
|
|
12140
|
+
/**
|
|
12141
|
+
* Get a string flag value.
|
|
12142
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12143
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12144
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12145
|
+
*/
|
|
12146
|
+
getStringValue(
|
|
12147
|
+
flagKey: string,
|
|
12148
|
+
defaultValue: string,
|
|
12149
|
+
context?: EvaluationContext,
|
|
12150
|
+
): Promise<string>;
|
|
12151
|
+
/**
|
|
12152
|
+
* Get a number flag value.
|
|
12153
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12154
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12155
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12156
|
+
*/
|
|
12157
|
+
getNumberValue(
|
|
12158
|
+
flagKey: string,
|
|
12159
|
+
defaultValue: number,
|
|
12160
|
+
context?: EvaluationContext,
|
|
12161
|
+
): Promise<number>;
|
|
12162
|
+
/**
|
|
12163
|
+
* Get an object flag value.
|
|
12164
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12165
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12166
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12167
|
+
*/
|
|
12168
|
+
getObjectValue<T extends object>(
|
|
12169
|
+
flagKey: string,
|
|
12170
|
+
defaultValue: T,
|
|
12171
|
+
context?: EvaluationContext,
|
|
12172
|
+
): Promise<T>;
|
|
12173
|
+
/**
|
|
12174
|
+
* Get a boolean flag value with full evaluation details.
|
|
12175
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12176
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12177
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12178
|
+
*/
|
|
12179
|
+
getBooleanDetails(
|
|
12180
|
+
flagKey: string,
|
|
12181
|
+
defaultValue: boolean,
|
|
12182
|
+
context?: EvaluationContext,
|
|
12183
|
+
): Promise<EvaluationDetails<boolean>>;
|
|
12184
|
+
/**
|
|
12185
|
+
* Get a string flag value with full evaluation details.
|
|
12186
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12187
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12188
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12189
|
+
*/
|
|
12190
|
+
getStringDetails(
|
|
12191
|
+
flagKey: string,
|
|
12192
|
+
defaultValue: string,
|
|
12193
|
+
context?: EvaluationContext,
|
|
12194
|
+
): Promise<EvaluationDetails<string>>;
|
|
12195
|
+
/**
|
|
12196
|
+
* Get a number flag value with full evaluation details.
|
|
12197
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12198
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12199
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12200
|
+
*/
|
|
12201
|
+
getNumberDetails(
|
|
12202
|
+
flagKey: string,
|
|
12203
|
+
defaultValue: number,
|
|
12204
|
+
context?: EvaluationContext,
|
|
12205
|
+
): Promise<EvaluationDetails<number>>;
|
|
12206
|
+
/**
|
|
12207
|
+
* Get an object flag value with full evaluation details.
|
|
12208
|
+
* @param flagKey The key of the flag to evaluate.
|
|
12209
|
+
* @param defaultValue Default value returned when evaluation fails or the flag type does not match.
|
|
12210
|
+
* @param context Optional evaluation context for targeting rules.
|
|
12211
|
+
*/
|
|
12212
|
+
getObjectDetails<T extends object>(
|
|
12213
|
+
flagKey: string,
|
|
12214
|
+
defaultValue: T,
|
|
12215
|
+
context?: EvaluationContext,
|
|
12216
|
+
): Promise<EvaluationDetails<T>>;
|
|
12217
|
+
}
|
|
12058
12218
|
/**
|
|
12059
12219
|
* Hello World binding to serve as an explanatory example. DO NOT USE
|
|
12060
12220
|
*/
|
|
@@ -13834,6 +13994,11 @@ export declare namespace TailStream {
|
|
|
13834
13994
|
readonly tag?: string;
|
|
13835
13995
|
readonly message?: string;
|
|
13836
13996
|
}
|
|
13997
|
+
interface TracePreviewInfo {
|
|
13998
|
+
readonly id: string;
|
|
13999
|
+
readonly slug: string;
|
|
14000
|
+
readonly name: string;
|
|
14001
|
+
}
|
|
13837
14002
|
interface Onset {
|
|
13838
14003
|
readonly type: "onset";
|
|
13839
14004
|
readonly attributes: Attribute[];
|
|
@@ -13845,6 +14010,7 @@ export declare namespace TailStream {
|
|
|
13845
14010
|
readonly scriptName?: string;
|
|
13846
14011
|
readonly scriptTags?: string[];
|
|
13847
14012
|
readonly scriptVersion?: ScriptVersion;
|
|
14013
|
+
readonly preview?: TracePreviewInfo;
|
|
13848
14014
|
readonly info:
|
|
13849
14015
|
| FetchEventInfo
|
|
13850
14016
|
| ConnectEventInfo
|
package/oldest/index.d.ts
CHANGED
|
@@ -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
|
package/oldest/index.ts
CHANGED
|
@@ -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
|
package/package.json
CHANGED