@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.
Files changed (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +487 -0
  3. package/dist/alarms.d.ts +134 -0
  4. package/dist/alarms.d.ts.map +1 -0
  5. package/dist/alarms.js +214 -0
  6. package/dist/bindings.d.ts +316 -0
  7. package/dist/bindings.d.ts.map +1 -0
  8. package/dist/bindings.js +678 -0
  9. package/dist/ctx-exports.d.ts +47 -0
  10. package/dist/ctx-exports.d.ts.map +1 -0
  11. package/dist/ctx-exports.js +54 -0
  12. package/dist/facet-image-store.d.ts +112 -0
  13. package/dist/facet-image-store.d.ts.map +1 -0
  14. package/dist/facet-image-store.js +181 -0
  15. package/dist/fanout-pool.d.ts +223 -0
  16. package/dist/fanout-pool.d.ts.map +1 -0
  17. package/dist/fanout-pool.js +368 -0
  18. package/dist/index.d.ts +26 -0
  19. package/dist/index.d.ts.map +1 -0
  20. package/dist/index.js +25 -0
  21. package/dist/inner-do-registry.d.ts +41 -0
  22. package/dist/inner-do-registry.d.ts.map +1 -0
  23. package/dist/inner-do-registry.js +51 -0
  24. package/dist/launch-journal.d.ts +170 -0
  25. package/dist/launch-journal.d.ts.map +1 -0
  26. package/dist/launch-journal.js +154 -0
  27. package/dist/launch-pacer.d.ts +173 -0
  28. package/dist/launch-pacer.d.ts.map +1 -0
  29. package/dist/launch-pacer.js +193 -0
  30. package/dist/loader-ledger.d.ts +57 -0
  31. package/dist/loader-ledger.d.ts.map +1 -0
  32. package/dist/loader-ledger.js +91 -0
  33. package/dist/loader-pool.d.ts +315 -0
  34. package/dist/loader-pool.d.ts.map +1 -0
  35. package/dist/loader-pool.js +666 -0
  36. package/dist/process-fabric.d.ts +524 -0
  37. package/dist/process-fabric.d.ts.map +1 -0
  38. package/dist/process-fabric.js +388 -0
  39. package/dist/process-host.d.ts +132 -0
  40. package/dist/process-host.d.ts.map +1 -0
  41. package/dist/process-host.js +444 -0
  42. package/dist/vendor/errors.d.ts +24 -0
  43. package/dist/vendor/errors.d.ts.map +1 -0
  44. package/dist/vendor/errors.js +46 -0
  45. package/dist/vendor/serialize.d.ts +3 -0
  46. package/dist/vendor/serialize.d.ts.map +1 -0
  47. package/dist/vendor/serialize.js +25 -0
  48. package/dist/vendor/types.d.ts +69 -0
  49. package/dist/vendor/types.d.ts.map +1 -0
  50. package/dist/vendor/types.js +4 -0
  51. package/dist/workerd-facet-host.d.ts +207 -0
  52. package/dist/workerd-facet-host.d.ts.map +1 -0
  53. package/dist/workerd-facet-host.js +508 -0
  54. package/dist/ws-hibernation-config.d.ts +73 -0
  55. package/dist/ws-hibernation-config.d.ts.map +1 -0
  56. package/dist/ws-hibernation-config.js +93 -0
  57. package/package.json +62 -0
  58. package/src/alarms.ts +275 -0
  59. package/src/bindings.ts +871 -0
  60. package/src/ctx-exports.ts +77 -0
  61. package/src/facet-image-store.ts +196 -0
  62. package/src/fanout-pool.ts +503 -0
  63. package/src/index.ts +26 -0
  64. package/src/inner-do-registry.ts +58 -0
  65. package/src/launch-journal.ts +229 -0
  66. package/src/launch-pacer.ts +231 -0
  67. package/src/loader-ledger.ts +112 -0
  68. package/src/loader-pool.ts +984 -0
  69. package/src/process-fabric.ts +729 -0
  70. package/src/process-host.ts +566 -0
  71. package/src/vendor/errors.ts +56 -0
  72. package/src/vendor/serialize.ts +37 -0
  73. package/src/vendor/types.ts +75 -0
  74. package/src/workerd-facet-host.ts +694 -0
  75. 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
+ }