1
- declare function markAsBackgroundTask < T > ( promise : Promise < T > ) : Promise < T > ;
1
+ type DecoratorType = "tc39" | "typescript" | "typescript_with_metadata" ;
2
+
3
+ interface JsxImportBaseConfig {
4
+ defaultSpecifier ?: string | null ;
5
+ module ?: string | null ;
6
+ baseUrl ?: string | null ;
7
+ }
8
+
9
+ // TODO(Nyannyacha): These two type defs will be provided later.
10
+
11
+ // deno-lint-ignore no-explicit-any
12
+ type S3FsConfig = any ;
13
+
14
+ // deno-lint-ignore no-explicit-any
15
+ type TmpFsConfig = any ;
16
+
17
+ interface UserWorkerFetchOptions {
18
+ signal ?: AbortSignal ;
19
+ }
20
+
21
+ interface UserWorkerCreateOptions {
22
+ servicePath ?: string | null ;
23
+ envVars ?: string [ ] [ ] | [ string , string ] [ ] | null ;
24
+ noModuleCache ?: boolean | null ;
25
+ importMapPath ?: string | null ;
26
+
27
+ forceCreate ?: boolean | null ;
28
+ netAccessDisabled ?: boolean | null ;
29
+ allowNet ?: string [ ] | null ;
30
+ allowRemoteModules ?: boolean | null ;
31
+ customModuleRoot ?: string | null ;
32
+
33
+ maybeEszip ?: Uint8Array | null ;
34
+ maybeEntrypoint ?: string | null ;
35
+ maybeModuleCode ?: string | null ;
36
+
37
+ memoryLimitMb ?: number | null ;
38
+ lowMemoryMultiplier ?: number | null ;
39
+ workerTimeoutMs ?: number | null ;
40
+ cpuTimeSoftLimitMs ?: number | null ;
41
+ cpuTimeHardLimitMs ?: number | null ;
42
+
43
+ decoratorType ?: DecoratorType | null ;
44
+ jsxImportSourceConfig ?: JsxImportBaseConfig | null ;
45
+
46
+ s3FsConfig ?: S3FsConfig | null ;
47
+ tmpFsConfig ?: TmpFsConfig | null ;
48
+
49
+ context ?: { [ key : string ] : unknown } | null ;
50
+ }
51
+
52
+ interface HeapStatistics {
53
+ totalHeapSize : number ;
54
+ totalHeapSizeExecutable : number ;
55
+ totalPhysicalSize : number ;
56
+ totalAvailableSize : number ;
57
+ totalGlobalHandlesSize : number ;
58
+ usedGlobalHandlesSize : number ;
59
+ usedHeapSize : number ;
60
+ mallocedMemory : number ;
61
+ externalMemory : number ;
62
+ peakMallocedMemory : number ;
63
+ }
64
+
65
+ interface RuntimeMetrics {
66
+ mainWorkerHeapStats : HeapStatistics ;
67
+ eventWorkerHeapStats ?: HeapStatistics ;
68
+ }
69
+
70
+ interface MemInfo {
71
+ total : number ;
72
+ free : number ;
73
+ available : number ;
74
+ buffers : number ;
75
+ cached : number ;
76
+ swapTotal : number ;
77
+ swapFree : number ;
78
+ }
79
+
80
+ declare namespace EdgeRuntime {
81
+ export namespace ai {
82
+ function tryCleanupUnusedSession ( ) : Promise < void > ;
83
+ }
84
+
85
+ class UserWorker {
86
+ constructor ( key : string ) ;
87
+
88
+ fetch ( request : Request , options ?: UserWorkerFetchOptions ) : Promise < Response > ;
89
+ static create ( opts : UserWorkerCreateOptions ) : Promise < UserWorker > ;
90
+ }
91
+
92
+ export function waitUntil < T > ( promise : Promise < T > ) : Promise < T > ;
93
+ export function getRuntimeMetrics ( ) : Promise < RuntimeMetrics > ;
94
+ export function applySupabaseTag ( src : Request , dest : Request ) : void ;
95
+ export function systemMemoryInfo ( ) : MemInfo ;
96
+ export function raiseSegfault ( ) : void ;
97
+
98
+ export { UserWorker as userWorkers } ;
99
+ }
100
+
101
+ declare namespace Deno {
102
+ export namespace errors {
103
+ class WorkerRequestCancelled extends Error { }
104
+ }
105
+ }
0 commit comments