File
Blob: src/cloudflare/internal/workers.d.ts
| 1 | // Copyright (c) 2026 Cloudflare, Inc. |
| 2 | // Licensed under the Apache 2.0 license found in the LICENSE file or at: |
| 3 | // https://opensource.org/licenses/Apache-2.0 |
| 4 | |
| 5 | export class DurableObject { |
| 6 | constructor(ctx: unknown, env: unknown); |
| 7 | |
| 8 | ctx: unknown; |
| 9 | env: unknown; |
| 10 | } |
| 11 | |
| 12 | export class WorkerEntrypoint { |
| 13 | constructor(ctx: unknown, env: unknown); |
| 14 | |
| 15 | ctx: unknown; |
| 16 | env: unknown; |
| 17 | } |
| 18 | |
| 19 | export class WorkflowEntrypoint { |
| 20 | constructor(ctx: unknown, env: unknown); |
| 21 | |
| 22 | ctx: unknown; |
| 23 | env: unknown; |
| 24 | } |
| 25 | |
| 26 | export class RpcStub { |
| 27 | constructor(server: object); |
| 28 | } |
| 29 | |
| 30 | export class RpcPromise {} |
| 31 | |
| 32 | export class RpcProperty {} |
| 33 | |
| 34 | export class RpcTarget {} |
| 35 | |
| 36 | export class ServiceStub {} |
| 37 | |
| 38 | export function waitUntil(promise: Promise<unknown>): void; |
| 39 | |
| 40 | // Stubs for the C++ CacheContext types (see src/workerd/api/global-scope.h). |
| 41 | // The full interface is also generated in types/generated-snapshot/ from C++ RTTI. |
| 42 | // If you change the C++ types, update these to match. |
| 43 | export interface CachePurgeError { |
| 44 | code: number; |
| 45 | message: string; |
| 46 | } |
| 47 | |
| 48 | export interface CachePurgeResult { |
| 49 | success: boolean; |
| 50 | errors: CachePurgeError[]; |
| 51 | } |
| 52 | |
| 53 | export interface CachePurgeOptions { |
| 54 | tags?: string[]; |
| 55 | pathPrefixes?: string[]; |
| 56 | purgeEverything?: boolean; |
| 57 | } |
| 58 | |
| 59 | export interface CacheContext { |
| 60 | purge(options: CachePurgeOptions): Promise<CachePurgeResult>; |
| 61 | } |
| 62 | |
| 63 | export function getCtxCache(): CacheContext | undefined; |
| 64 | |
| 65 | export function abortIsolate(reason?: string): never; |
| 66 | |
| 67 | // True when the workerd_experimental compat flag is enabled. Use this for gating experimental |
| 68 | // re-exports in user-facing wrappers; Cloudflare.compatibilityFlags filters out experimental |
| 69 | // flags themselves so it cannot be used to detect this. |
| 70 | export const isExperimental: boolean; |