@workers-community/workers-types 4.20260404.1 → 4.20260408.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/index.d.ts +26 -0
- package/index.ts +26 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -557,6 +557,9 @@ interface AlarmInvocationInfo {
|
|
|
557
557
|
interface Cloudflare {
|
|
558
558
|
readonly compatibilityFlags: Record<string, boolean>;
|
|
559
559
|
}
|
|
560
|
+
declare abstract class ColoLocalActorNamespace {
|
|
561
|
+
get(actorId: string): Fetcher;
|
|
562
|
+
}
|
|
560
563
|
interface DurableObject {
|
|
561
564
|
fetch(request: Request): Response | Promise<Response>;
|
|
562
565
|
connect?(socket: Socket): void | Promise<void>;
|
|
@@ -636,6 +639,7 @@ interface DurableObjectState<Props = unknown> {
|
|
|
636
639
|
readonly id: DurableObjectId;
|
|
637
640
|
readonly storage: DurableObjectStorage;
|
|
638
641
|
container?: Container;
|
|
642
|
+
facets: DurableObjectFacets;
|
|
639
643
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
640
644
|
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
641
645
|
getWebSockets(tag?: string): WebSocket[];
|
|
@@ -750,6 +754,22 @@ declare class WebSocketRequestResponsePair {
|
|
|
750
754
|
get request(): string;
|
|
751
755
|
get response(): string;
|
|
752
756
|
}
|
|
757
|
+
interface DurableObjectFacets {
|
|
758
|
+
get<T extends Rpc.DurableObjectBranded | undefined = undefined>(
|
|
759
|
+
name: string,
|
|
760
|
+
getStartupOptions: () =>
|
|
761
|
+
| FacetStartupOptions<T>
|
|
762
|
+
| Promise<FacetStartupOptions<T>>,
|
|
763
|
+
): Fetcher<T>;
|
|
764
|
+
abort(name: string, reason: any): void;
|
|
765
|
+
delete(name: string): void;
|
|
766
|
+
}
|
|
767
|
+
interface FacetStartupOptions<
|
|
768
|
+
T extends Rpc.DurableObjectBranded | undefined = undefined,
|
|
769
|
+
> {
|
|
770
|
+
id?: DurableObjectId | string;
|
|
771
|
+
class: DurableObjectClass<T>;
|
|
772
|
+
}
|
|
753
773
|
interface AnalyticsEngineDataset {
|
|
754
774
|
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
|
|
755
775
|
}
|
|
@@ -3864,6 +3884,8 @@ type LoopbackDurableObjectClass<
|
|
|
3864
3884
|
(T extends CloudflareWorkersModule.DurableObject<any, infer Props>
|
|
3865
3885
|
? (opts: { props?: Props }) => DurableObjectClass<T>
|
|
3866
3886
|
: (opts: { props?: any }) => DurableObjectClass<T>);
|
|
3887
|
+
interface LoopbackDurableObjectNamespace extends DurableObjectNamespace {}
|
|
3888
|
+
interface LoopbackColoLocalActorNamespace extends ColoLocalActorNamespace {}
|
|
3867
3889
|
interface SyncKvStorage {
|
|
3868
3890
|
get<T = unknown>(key: string): T | undefined;
|
|
3869
3891
|
list<T = unknown>(options?: SyncKvListOptions): Iterable<[string, T]>;
|
|
@@ -3883,6 +3905,10 @@ interface WorkerStub {
|
|
|
3883
3905
|
name?: string,
|
|
3884
3906
|
options?: WorkerStubEntrypointOptions,
|
|
3885
3907
|
): Fetcher<T>;
|
|
3908
|
+
getDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined>(
|
|
3909
|
+
name?: string,
|
|
3910
|
+
options?: WorkerStubEntrypointOptions,
|
|
3911
|
+
): DurableObjectClass<T>;
|
|
3886
3912
|
}
|
|
3887
3913
|
interface WorkerStubEntrypointOptions {
|
|
3888
3914
|
props?: any;
|
package/index.ts
CHANGED
|
@@ -559,6 +559,9 @@ export interface AlarmInvocationInfo {
|
|
|
559
559
|
export interface Cloudflare {
|
|
560
560
|
readonly compatibilityFlags: Record<string, boolean>;
|
|
561
561
|
}
|
|
562
|
+
export declare abstract class ColoLocalActorNamespace {
|
|
563
|
+
get(actorId: string): Fetcher;
|
|
564
|
+
}
|
|
562
565
|
export interface DurableObject {
|
|
563
566
|
fetch(request: Request): Response | Promise<Response>;
|
|
564
567
|
connect?(socket: Socket): void | Promise<void>;
|
|
@@ -638,6 +641,7 @@ export interface DurableObjectState<Props = unknown> {
|
|
|
638
641
|
readonly id: DurableObjectId;
|
|
639
642
|
readonly storage: DurableObjectStorage;
|
|
640
643
|
container?: Container;
|
|
644
|
+
facets: DurableObjectFacets;
|
|
641
645
|
blockConcurrencyWhile<T>(callback: () => Promise<T>): Promise<T>;
|
|
642
646
|
acceptWebSocket(ws: WebSocket, tags?: string[]): void;
|
|
643
647
|
getWebSockets(tag?: string): WebSocket[];
|
|
@@ -752,6 +756,22 @@ export declare class WebSocketRequestResponsePair {
|
|
|
752
756
|
get request(): string;
|
|
753
757
|
get response(): string;
|
|
754
758
|
}
|
|
759
|
+
export interface DurableObjectFacets {
|
|
760
|
+
get<T extends Rpc.DurableObjectBranded | undefined = undefined>(
|
|
761
|
+
name: string,
|
|
762
|
+
getStartupOptions: () =>
|
|
763
|
+
| FacetStartupOptions<T>
|
|
764
|
+
| Promise<FacetStartupOptions<T>>,
|
|
765
|
+
): Fetcher<T>;
|
|
766
|
+
abort(name: string, reason: any): void;
|
|
767
|
+
delete(name: string): void;
|
|
768
|
+
}
|
|
769
|
+
export interface FacetStartupOptions<
|
|
770
|
+
T extends Rpc.DurableObjectBranded | undefined = undefined,
|
|
771
|
+
> {
|
|
772
|
+
id?: DurableObjectId | string;
|
|
773
|
+
class: DurableObjectClass<T>;
|
|
774
|
+
}
|
|
755
775
|
export interface AnalyticsEngineDataset {
|
|
756
776
|
writeDataPoint(event?: AnalyticsEngineDataPoint): void;
|
|
757
777
|
}
|
|
@@ -3870,6 +3890,8 @@ export type LoopbackDurableObjectClass<
|
|
|
3870
3890
|
(T extends CloudflareWorkersModule.DurableObject<any, infer Props>
|
|
3871
3891
|
? (opts: { props?: Props }) => DurableObjectClass<T>
|
|
3872
3892
|
: (opts: { props?: any }) => DurableObjectClass<T>);
|
|
3893
|
+
export interface LoopbackDurableObjectNamespace extends DurableObjectNamespace {}
|
|
3894
|
+
export interface LoopbackColoLocalActorNamespace extends ColoLocalActorNamespace {}
|
|
3873
3895
|
export interface SyncKvStorage {
|
|
3874
3896
|
get<T = unknown>(key: string): T | undefined;
|
|
3875
3897
|
list<T = unknown>(options?: SyncKvListOptions): Iterable<[string, T]>;
|
|
@@ -3889,6 +3911,10 @@ export interface WorkerStub {
|
|
|
3889
3911
|
name?: string,
|
|
3890
3912
|
options?: WorkerStubEntrypointOptions,
|
|
3891
3913
|
): Fetcher<T>;
|
|
3914
|
+
getDurableObjectClass<T extends Rpc.DurableObjectBranded | undefined>(
|
|
3915
|
+
name?: string,
|
|
3916
|
+
options?: WorkerStubEntrypointOptions,
|
|
3917
|
+
): DurableObjectClass<T>;
|
|
3892
3918
|
}
|
|
3893
3919
|
export interface WorkerStubEntrypointOptions {
|
|
3894
3920
|
props?: any;
|