@nimbus-sh/fabric 0.1.0
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/LICENSE +21 -0
- package/README.md +487 -0
- package/dist/alarms.d.ts +134 -0
- package/dist/alarms.d.ts.map +1 -0
- package/dist/alarms.js +214 -0
- package/dist/bindings.d.ts +316 -0
- package/dist/bindings.d.ts.map +1 -0
- package/dist/bindings.js +678 -0
- package/dist/ctx-exports.d.ts +47 -0
- package/dist/ctx-exports.d.ts.map +1 -0
- package/dist/ctx-exports.js +54 -0
- package/dist/facet-image-store.d.ts +112 -0
- package/dist/facet-image-store.d.ts.map +1 -0
- package/dist/facet-image-store.js +181 -0
- package/dist/fanout-pool.d.ts +223 -0
- package/dist/fanout-pool.d.ts.map +1 -0
- package/dist/fanout-pool.js +368 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/inner-do-registry.d.ts +41 -0
- package/dist/inner-do-registry.d.ts.map +1 -0
- package/dist/inner-do-registry.js +51 -0
- package/dist/launch-journal.d.ts +170 -0
- package/dist/launch-journal.d.ts.map +1 -0
- package/dist/launch-journal.js +154 -0
- package/dist/launch-pacer.d.ts +173 -0
- package/dist/launch-pacer.d.ts.map +1 -0
- package/dist/launch-pacer.js +193 -0
- package/dist/loader-ledger.d.ts +57 -0
- package/dist/loader-ledger.d.ts.map +1 -0
- package/dist/loader-ledger.js +91 -0
- package/dist/loader-pool.d.ts +315 -0
- package/dist/loader-pool.d.ts.map +1 -0
- package/dist/loader-pool.js +666 -0
- package/dist/process-fabric.d.ts +524 -0
- package/dist/process-fabric.d.ts.map +1 -0
- package/dist/process-fabric.js +388 -0
- package/dist/process-host.d.ts +132 -0
- package/dist/process-host.d.ts.map +1 -0
- package/dist/process-host.js +444 -0
- package/dist/vendor/errors.d.ts +24 -0
- package/dist/vendor/errors.d.ts.map +1 -0
- package/dist/vendor/errors.js +46 -0
- package/dist/vendor/serialize.d.ts +3 -0
- package/dist/vendor/serialize.d.ts.map +1 -0
- package/dist/vendor/serialize.js +25 -0
- package/dist/vendor/types.d.ts +69 -0
- package/dist/vendor/types.d.ts.map +1 -0
- package/dist/vendor/types.js +4 -0
- package/dist/workerd-facet-host.d.ts +207 -0
- package/dist/workerd-facet-host.d.ts.map +1 -0
- package/dist/workerd-facet-host.js +508 -0
- package/dist/ws-hibernation-config.d.ts +73 -0
- package/dist/ws-hibernation-config.d.ts.map +1 -0
- package/dist/ws-hibernation-config.js +93 -0
- package/package.json +62 -0
- package/src/alarms.ts +275 -0
- package/src/bindings.ts +871 -0
- package/src/ctx-exports.ts +77 -0
- package/src/facet-image-store.ts +196 -0
- package/src/fanout-pool.ts +503 -0
- package/src/index.ts +26 -0
- package/src/inner-do-registry.ts +58 -0
- package/src/launch-journal.ts +229 -0
- package/src/launch-pacer.ts +231 -0
- package/src/loader-ledger.ts +112 -0
- package/src/loader-pool.ts +984 -0
- package/src/process-fabric.ts +729 -0
- package/src/process-host.ts +566 -0
- package/src/vendor/errors.ts +56 -0
- package/src/vendor/serialize.ts +37 -0
- package/src/vendor/types.ts +75 -0
- package/src/workerd-facet-host.ts +694 -0
- package/src/ws-hibernation-config.ts +123 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Types for the Cloudflare Worker Loader API (closed beta).
|
|
2
|
+
// Not yet in @cloudflare/workers-types. Remove this file when they ship.
|
|
3
|
+
// https://developers.cloudflare.com/workers/runtime-apis/bindings/worker-loader/
|
|
4
|
+
|
|
5
|
+
export interface JsModule { js: string }
|
|
6
|
+
export interface CjsModule { cjs: string }
|
|
7
|
+
export interface PyModule { py: string }
|
|
8
|
+
export interface TextModule { text: string }
|
|
9
|
+
export interface DataModule { data: ArrayBuffer }
|
|
10
|
+
export interface JsonModule { json: unknown }
|
|
11
|
+
/**
|
|
12
|
+
* A compiled WebAssembly module, importable from a facet by module name.
|
|
13
|
+
* Nimbus ships these on every path — sql.js for node:sqlite, the interpreter
|
|
14
|
+
* images for python and ruby — so the omission here was the type lagging the
|
|
15
|
+
* API, not a kind the loader lacks.
|
|
16
|
+
*/
|
|
17
|
+
export interface WasmModule { wasm: ArrayBuffer }
|
|
18
|
+
|
|
19
|
+
/** Plain string = type inferred from file extension (.js or .py). */
|
|
20
|
+
export type ModuleContent =
|
|
21
|
+
| string
|
|
22
|
+
| JsModule
|
|
23
|
+
| CjsModule
|
|
24
|
+
| PyModule
|
|
25
|
+
| TextModule
|
|
26
|
+
| DataModule
|
|
27
|
+
| JsonModule
|
|
28
|
+
| WasmModule;
|
|
29
|
+
|
|
30
|
+
export interface WorkerCode {
|
|
31
|
+
compatibilityDate: string;
|
|
32
|
+
compatibilityFlags?: string[];
|
|
33
|
+
allowExperimental?: boolean;
|
|
34
|
+
mainModule: string;
|
|
35
|
+
modules: Record<string, ModuleContent>;
|
|
36
|
+
env?: Record<string, unknown>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Network access control:
|
|
40
|
+
* - `undefined`: inherit parent's network access.
|
|
41
|
+
* - `null`: block all outbound (fetch/connect throw).
|
|
42
|
+
* - A service stub: redirect outbound through that binding.
|
|
43
|
+
*/
|
|
44
|
+
globalOutbound?: ServiceStub | null;
|
|
45
|
+
tails?: ServiceStub[];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface ServiceStub {
|
|
49
|
+
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface EntrypointOptions {
|
|
53
|
+
props?: Record<string, unknown>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface WorkerStub {
|
|
57
|
+
getEntrypoint(): EntrypointStub;
|
|
58
|
+
getEntrypoint(name: string, opts?: EntrypointOptions): EntrypointStub;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface EntrypointStub {
|
|
62
|
+
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
63
|
+
execute(...args: unknown[]): Promise<unknown>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export type GetCodeCallback = () => Promise<WorkerCode>;
|
|
67
|
+
|
|
68
|
+
export interface WorkerLoader {
|
|
69
|
+
/**
|
|
70
|
+
* Load or reuse an isolate by ID. Same ID + same code may reuse an isolate;
|
|
71
|
+
* different IDs always get fresh isolates. `getCodeCallback` must return
|
|
72
|
+
* the same content for the same ID.
|
|
73
|
+
*/
|
|
74
|
+
get(id: string, getCodeCallback: GetCodeCallback): WorkerStub;
|
|
75
|
+
}
|