@di-framework/cli-plugin-platform 0.0.1 → 6.0.3

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 (169) hide show
  1. package/README.md +408 -0
  2. package/dist/actor-protocol.d.ts +4 -0
  3. package/dist/actor-protocol.js +162 -0
  4. package/dist/actors.d.ts +31 -0
  5. package/dist/actors.js +296 -0
  6. package/dist/args.d.ts +15 -0
  7. package/dist/args.js +66 -0
  8. package/dist/assets/http-adapter.js +876 -0
  9. package/dist/assets/platform/.gitignore.tmpl +6 -0
  10. package/dist/assets/platform/Pulumi.yaml.tmpl +6 -0
  11. package/dist/assets/platform/README.md +208 -0
  12. package/dist/assets/platform/index.ts.tmpl +2 -0
  13. package/dist/assets/platform/package.json.tmpl +18 -0
  14. package/dist/assets/platform/tsconfig.json +11 -0
  15. package/dist/assets/queue-adapter.js +60 -0
  16. package/dist/assets/sqlite/BUILD-INFO.txt +13 -0
  17. package/dist/assets/sqlite/SHA256SUMS +2 -0
  18. package/dist/assets/sqlite/di-framework-sqlite.wasm +0 -0
  19. package/dist/assets/sqlite/di-framework-sqlite.wit +337 -0
  20. package/dist/assets/wit/deps/LICENSE.md +8 -0
  21. package/dist/assets/wit/deps/di-framework-queues/package.wit +18 -0
  22. package/dist/assets/wit/deps/di-framework-sqlite/package.wit +211 -0
  23. package/dist/assets/wit/deps/wasi-cli/package.wit +70 -0
  24. package/dist/assets/wit/deps/wasi-clocks/package.wit +42 -0
  25. package/dist/assets/wit/deps/wasi-config/package.wit +15 -0
  26. package/dist/assets/wit/deps/wasi-filesystem/package.wit +184 -0
  27. package/dist/assets/wit/deps/wasi-http/package.wit +170 -0
  28. package/dist/assets/wit/deps/wasi-random/package.wit +17 -0
  29. package/dist/assets/wit/deps/wasi-sockets/package.wit +105 -0
  30. package/dist/assets/wit/deps/wasi-tls/package.wit +26 -0
  31. package/dist/assets/wit/deps/wasmcloud-blobstore/package.wit +153 -0
  32. package/dist/assets/wit/deps/wasmcloud-keyvalue/package.wit +370 -0
  33. package/dist/assets/wit/deps/wasmcloud-messaging/package.wit +125 -0
  34. package/dist/assets/wit/deps/wasmcloud-postgres/package.wit +435 -0
  35. package/dist/assets/wit/deps/wasmcloud-secrets/package.wit +80 -0
  36. package/dist/async-transform.d.ts +3 -0
  37. package/dist/async-transform.js +60 -0
  38. package/dist/bindings.d.ts +34 -0
  39. package/dist/bindings.js +307 -0
  40. package/dist/build.d.ts +29 -0
  41. package/dist/build.js +325 -0
  42. package/dist/command.d.ts +3 -0
  43. package/dist/command.js +141 -0
  44. package/dist/control/auth.d.ts +18 -0
  45. package/dist/control/auth.js +89 -0
  46. package/dist/control/cron.d.ts +7 -0
  47. package/dist/control/cron.js +86 -0
  48. package/dist/control/index.d.ts +4 -0
  49. package/dist/control/index.js +4 -0
  50. package/dist/control/network.d.ts +12 -0
  51. package/dist/control/network.js +49 -0
  52. package/dist/control/queues.d.ts +15 -0
  53. package/dist/control/queues.js +77 -0
  54. package/dist/cron.d.ts +26 -0
  55. package/dist/cron.js +239 -0
  56. package/dist/deploy.d.ts +29 -0
  57. package/dist/deploy.js +57 -0
  58. package/dist/deps.d.ts +96 -0
  59. package/dist/deps.js +303 -0
  60. package/dist/destroy.d.ts +3 -0
  61. package/dist/destroy.js +24 -0
  62. package/dist/dev-runner.d.ts +24 -0
  63. package/dist/dev-runner.js +83 -0
  64. package/dist/dev.d.ts +8 -0
  65. package/dist/dev.js +76 -0
  66. package/dist/discovery.d.ts +15 -0
  67. package/dist/discovery.js +182 -0
  68. package/dist/doctor.d.ts +8 -0
  69. package/dist/doctor.js +82 -0
  70. package/dist/guests.d.ts +9 -0
  71. package/dist/guests.js +56 -0
  72. package/dist/host-interface.d.ts +29 -0
  73. package/dist/host-interface.js +142 -0
  74. package/dist/index.d.ts +33 -0
  75. package/dist/index.js +39 -0
  76. package/dist/kubernetes.d.ts +9 -0
  77. package/dist/kubernetes.js +17 -0
  78. package/dist/managed-bindings.d.ts +9 -0
  79. package/dist/managed-bindings.js +150 -0
  80. package/dist/manifest.d.ts +36 -0
  81. package/dist/manifest.js +257 -0
  82. package/dist/namespace.d.ts +2 -0
  83. package/dist/namespace.js +4 -0
  84. package/dist/node-compat/async-hooks.d.ts +29 -0
  85. package/dist/node-compat/async-hooks.js +80 -0
  86. package/dist/node-compat/bootstrap.d.ts +1 -0
  87. package/dist/node-compat/bootstrap.js +9 -0
  88. package/dist/node-compat/bytes.d.ts +7 -0
  89. package/dist/node-compat/bytes.js +41 -0
  90. package/dist/node-compat/crypto-hash.d.ts +27 -0
  91. package/dist/node-compat/crypto-hash.js +108 -0
  92. package/dist/node-compat/crypto-subtle.d.ts +59 -0
  93. package/dist/node-compat/crypto-subtle.js +288 -0
  94. package/dist/node-compat/crypto.d.ts +136 -0
  95. package/dist/node-compat/crypto.js +142 -0
  96. package/dist/node-compat/dgram.d.ts +49 -0
  97. package/dist/node-compat/dgram.js +197 -0
  98. package/dist/node-compat/env.d.ts +6 -0
  99. package/dist/node-compat/env.js +88 -0
  100. package/dist/node-compat/fetch-runtime.d.ts +80 -0
  101. package/dist/node-compat/fetch-runtime.js +314 -0
  102. package/dist/node-compat/fs.d.ts +84 -0
  103. package/dist/node-compat/fs.js +285 -0
  104. package/dist/node-compat/http-parser.d.ts +40 -0
  105. package/dist/node-compat/http-parser.js +185 -0
  106. package/dist/node-compat/http.d.ts +130 -0
  107. package/dist/node-compat/http.js +688 -0
  108. package/dist/node-compat/https.d.ts +28 -0
  109. package/dist/node-compat/https.js +88 -0
  110. package/dist/node-compat/module.d.ts +11 -0
  111. package/dist/node-compat/module.js +35 -0
  112. package/dist/node-compat/net.d.ts +119 -0
  113. package/dist/node-compat/net.js +441 -0
  114. package/dist/node-compat/process.d.ts +25 -0
  115. package/dist/node-compat/process.js +63 -0
  116. package/dist/node-compat/runtime-application.d.ts +4 -0
  117. package/dist/node-compat/runtime-application.js +24 -0
  118. package/dist/node-compat/seed-virtual.d.ts +6 -0
  119. package/dist/node-compat/seed-virtual.js +6 -0
  120. package/dist/node-compat/seed.d.ts +20 -0
  121. package/dist/node-compat/seed.js +106 -0
  122. package/dist/node-compat/socket-address.d.ts +35 -0
  123. package/dist/node-compat/socket-address.js +162 -0
  124. package/dist/node-compat/timers.d.ts +32 -0
  125. package/dist/node-compat/timers.js +96 -0
  126. package/dist/node-compat/tls.d.ts +57 -0
  127. package/dist/node-compat/tls.js +290 -0
  128. package/dist/node-compat/wasi-random.d.ts +2 -0
  129. package/dist/node-compat/wasi-random.js +25 -0
  130. package/dist/node-compat/wasi-sockets.d.ts +47 -0
  131. package/dist/node-compat/wasi-sockets.js +134 -0
  132. package/dist/oci.d.ts +9 -0
  133. package/dist/oci.js +9 -0
  134. package/dist/paths.d.ts +7 -0
  135. package/dist/paths.js +13 -0
  136. package/dist/platform-init.d.ts +13 -0
  137. package/dist/platform-init.js +265 -0
  138. package/dist/platform.d.ts +22 -0
  139. package/dist/platform.js +170 -0
  140. package/dist/project.d.ts +39 -0
  141. package/dist/project.js +130 -0
  142. package/dist/publish.d.ts +15 -0
  143. package/dist/publish.js +57 -0
  144. package/dist/pulumi.d.ts +4 -0
  145. package/dist/pulumi.js +27 -0
  146. package/dist/queues-module.d.ts +4 -0
  147. package/dist/queues-module.js +89 -0
  148. package/dist/queues.d.ts +16 -0
  149. package/dist/queues.js +167 -0
  150. package/dist/registry.d.ts +16 -0
  151. package/dist/registry.js +27 -0
  152. package/dist/service.d.ts +162 -0
  153. package/dist/service.js +678 -0
  154. package/dist/support.d.ts +14 -0
  155. package/dist/support.js +37 -0
  156. package/dist/target.d.ts +18 -0
  157. package/dist/target.js +45 -0
  158. package/dist/toml.d.ts +6 -0
  159. package/dist/toml.js +245 -0
  160. package/dist/wash-dev.d.ts +18 -0
  161. package/dist/wash-dev.js +80 -0
  162. package/dist/wit.d.ts +76 -0
  163. package/dist/wit.js +248 -0
  164. package/dist/workload-members.d.ts +12 -0
  165. package/dist/workload-members.js +136 -0
  166. package/dist/workload.d.ts +45 -0
  167. package/dist/workload.js +457 -0
  168. package/package.json +55 -8
  169. package/src/index.ts +0 -2
@@ -0,0 +1,6 @@
1
+ node_modules/
2
+ bin/
3
+ .pulumi/
4
+ .pulumi-state/
5
+ .di-framework/
6
+ .kubeconfig-*
@@ -0,0 +1,6 @@
1
+ name: {{DI_FRAMEWORK_PLATFORM_PROJECT}}
2
+ runtime:
3
+ name: nodejs
4
+ options:
5
+ typescript: true
6
+ description: Isolated local wasmCloud platform. Application resources are owned by the DI Framework CLI.
@@ -0,0 +1,208 @@
1
+ # Local wasmCloud platform
2
+
3
+ This generated Pulumi project provisions platform resources only:
4
+
5
+ - a pinned k0s controller/worker in a stack- and workspace-scoped Docker network;
6
+ - stack-scoped Docker volumes for k0s state and pod logs;
7
+ - an in-cluster, pinned OCI registry exposed to the host only through loopback;
8
+ - wasmCloud runtime operator 2.8.0 and its default HTTP host group;
9
+ - a generic loopback HTTP entrypoint.
10
+
11
+ Application components, Services, and WorkloadDeployments remain owned by
12
+ `di-framework platform deploy`. No application name is stored here.
13
+
14
+ `di-framework platform cluster up local --yes` runs `pulumi install`
15
+ before selecting the stack, so this directory does not need a manual package
16
+ manager install and does not need to belong to a root workspace.
17
+
18
+ ## Ports
19
+
20
+ The safe high defaults bind only to `127.0.0.1`:
21
+
22
+ | Pulumi setting | Default | Purpose |
23
+ | --- | ---: | --- |
24
+ | `apiPort` | `26443` | Kubernetes API |
25
+ | `registryPort` | `25000` | host-side ORAS push endpoint |
26
+ | `httpPort` | `28180` | wasmCloud HTTP entrypoint |
27
+
28
+ Each must be a distinct integer from 1024 through 65535. Override one before
29
+ deployment from this directory, for example:
30
+
31
+ ```sh
32
+ pulumi config set httpPort 28181
33
+ ```
34
+
35
+ Internal NodePorts are fixed inside the isolated k0s container. The registry
36
+ push address (`http://127.0.0.1:25000` by default) and cluster pull address
37
+ (`di-framework-registry.wasmcloud.svc.cluster.local:5000`) reach the same
38
+ registry content.
39
+
40
+ ## Output contract
41
+
42
+ | Output | Meaning |
43
+ | --- | --- |
44
+ | `schemaVersion` | output contract version (`2`) |
45
+ | `kubeconfig` | absolute path to a generated mode-0600 kubeconfig |
46
+ | `namespace` | Kubernetes namespace (`wasmcloud`) |
47
+ | `registry.push` | host-side registry URL used by ORAS |
48
+ | `registry.pull` | cluster-side registry address used by workloads |
49
+ | `registry.insecure` | whether ORAS must use plain HTTP |
50
+ | `endpoints.kubernetes` | loopback API server URL |
51
+ | `endpoints.registry` | loopback registry URL |
52
+ | `endpoints.http` | loopback HTTP URL |
53
+
54
+ ## Lifecycle
55
+
56
+ From the workspace root:
57
+
58
+ ```sh
59
+ di-framework platform cluster up local --yes
60
+ di-framework platform deploy <configured-project-name>
61
+ di-framework platform destroy <configured-project-name>
62
+ di-framework platform cluster destroy local --yes
63
+ ```
64
+
65
+ Send the configured project name as the HTTP `Host` header, for example:
66
+
67
+ ```sh
68
+ curl -H 'Host: greeter' http://127.0.0.1:28180/
69
+ ```
70
+
71
+ Platform destroy removes only Docker and Kubernetes resources bearing this
72
+ project/stack scope, along with the generated kubeconfig. It refuses to adopt
73
+ or replace an already-existing Docker resource with the same name. Teardown
74
+ uses the `kubectl` bundled in the scoped k0s container, so no host-side
75
+ `kubectl` installation is needed for platform lifecycle commands.
76
+
77
+
78
+ ## Users and tenants
79
+
80
+ Declare tenants and users in the stack's `Pulumi.<stack>.yaml`. Replace the
81
+ `<project>` prefix with the name in `Pulumi.yaml`:
82
+
83
+ ```yaml
84
+ config:
85
+ <project>:tenants:
86
+ - name: warehouse
87
+ deletionPolicy: Retain
88
+ <project>:users:
89
+ - name: alice
90
+ memberships:
91
+ - tenant: warehouse
92
+ role: developer
93
+ - name: reviewer
94
+ memberships:
95
+ - tenant: warehouse
96
+ role: viewer
97
+ ```
98
+
99
+ Run the existing `di-framework platform cluster up local --yes` command.
100
+ Pulumi installs the cluster-scoped `Tenant` and `User` CRDs in
101
+ `platform.di-framework.dev/v1alpha1`, admission policies, a TypeScript controller,
102
+ and the declared custom resources. It waits for their `Ready` conditions. There
103
+ are no additional platform CLI subcommands. Controller TypeScript is compiled to
104
+ JavaScript when Pulumi builds its ConfigMap; no custom container build is needed.
105
+ Run `bun run check` in this directory to check all generated TypeScript.
106
+
107
+ Each tenant gets `di-tenant-<name>` for workloads and `di-runtime-<name>` for its
108
+ host pool, Redis, and NATS. Host environments match the workload namespace, and
109
+ `allowSharedHosts` is false. Runtime certificates remain in the runtime namespace.
110
+ Pulumi seeds these namespaces before Helm so the wasmCloud operator can watch
111
+ host pods there; the controller then manages their resources and lifecycle.
112
+ Add tenants through stack configuration so Helm's `hostNamespaces` stays current.
113
+ A tenant defaults to one runtime, a 2-CPU/4-GiB runtime-namespace quota, 20
114
+ WorkloadDeployments, 10 `BackingService` objects, and 40 `ServiceBinding`
115
+ objects. Increase `resources.cpu` and `resources.memory` when increasing
116
+ `runtime.replicas`; these quotas cover runtime pods and aggregate
117
+ `requests.storage` (50Gi hard) for stock and future `di-bs-*` backends, not
118
+ individual Wasm invocations. Override concurrent service/binding counts with
119
+ `resources.backingServices` / `resources.serviceBindings`.
120
+
121
+ Users get a ServiceAccount in `wasmcloud` and tenant RoleBindings. Developers
122
+ can manage WorkloadDeployments, `BackingService`, `ServiceBinding`, ConfigMaps,
123
+ Secrets, and ClusterIP Services, read runtime logs, and port-forward runtime pods.
124
+ Viewers can read workloads, `BackingService` / `ServiceBinding` status, and
125
+ runtime logs. Neither role can manage Kubernetes pods, RBAC, tenant declarations,
126
+ `BackingServiceClass`, or read runtime Secrets. Missing or suspended tenants
127
+ receive no grants.
128
+
129
+ **Authorization boundary (v1):** tenant-level only — not per-user or per-workload.
130
+ Developers in a tenant can read Secrets and port-forward runtime pods in that
131
+ tenant; the platform does **not** claim finer credential isolation. Admission
132
+ still blocks CLI/API bypass for forged hostInterfaces and mutation of
133
+ controller-managed config (see `@di-framework/platform` README).
134
+
135
+ As administrator, use the platform kubeconfig to issue an expiring user token:
136
+
137
+ ```sh
138
+ export KUBECONFIG="$(pulumi stack output kubeconfig)"
139
+ kubectl create token di-user-alice -n wasmcloud --duration=8h
140
+ ```
141
+
142
+ Build the user's kubeconfig with the same cluster server and CA from the admin
143
+ kubeconfig, this token as its **only** credential, and the tenant workload namespace
144
+ as its context namespace. Do not distribute the admin kubeconfig or its client
145
+ certificate/key. Kubernetes may shorten the requested token lifetime. Tokens are
146
+ never stored in User status or Pulumi outputs. The `users` output identifies the
147
+ ServiceAccount; `tenants` identifies the namespaces and host group.
148
+
149
+ Configure a deployment target with the user's kubeconfig,
150
+ `namespace = "di-tenant-warehouse"` and `hostgroup = "tenant-warehouse"`.
151
+ Port-forward `service/di-http` in `di-runtime-warehouse` to reach its HTTP routes.
152
+ The default platform HTTP entrypoint continues to target the default host group.
153
+ For shared tenant keyvalue storage, reference the controller-managed ConfigMap
154
+ `di-tenant-stock` in the native keyvalue host interface (transitional). Independent
155
+ services use ConfigMaps named `di-bs-*` and binding-projected Secrets/ConfigMaps
156
+ named `di-binding-*` (#450/#451). The warehouse's HTTP, Redis, and NATS sync flow
157
+ has been verified on the stock `ghcr.io/wasmcloud/wash:2.8.0` image; native
158
+ keyvalue needs no custom image. The warehouse uses this same ConfigMap reference
159
+ in its external-cluster setup. Messaging uses the tenant's dedicated NATS backend.
160
+ Tenant admission restricts native interfaces, forbids host volumes and guest
161
+ network capabilities, and reserves `di-tenant-stock`, `di-bs-*`, and
162
+ `di-binding-*` ConfigMaps/Secrets against tenant-user create/update/delete.
163
+ Workloads needing additional capabilities require administrator review and a
164
+ corresponding policy change.
165
+
166
+ Set `suspended: true` on a User to revoke bindings and delete its ServiceAccount;
167
+ previous tokens remain invalid after unsuspension creates a new account. Membership
168
+ changes remove obsolete bindings, including when downgrading developer to viewer.
169
+ Set `suspended: true` on a Tenant to revoke access and stop its runtimes/backends.
170
+ Changes converge through the controller; existing connections are not forcibly
171
+ terminated by RBAC revocation.
172
+
173
+ Tenant deletion defaults to `Retain`: access is revoked, deployments stop, and
174
+ namespaces/data stay labelled with the original UID. The controller refuses to
175
+ adopt those resources if the name is reused. `deletionPolicy: Delete` removes both
176
+ namespaces. Backend data uses tenant-UID-specific directories on the local k0s
177
+ volume; deleting namespaces does not erase those directories. Destroying the
178
+ entire platform removes that volume and **all** retained data. Back up data before
179
+ platform destruction. This storage layout targets the generated single-node
180
+ local platform, not a multi-node production cluster.
181
+
182
+ This is a local development platform. Its registry is shared and unauthenticated,
183
+ and its published ports bind to loopback. Remote access, authenticated tenant
184
+ registries, production storage, and stronger resource accounting are separate
185
+ work. Namespace NetworkPolicies require an enforcing CNI (the generated k0s
186
+ cluster uses kube-router). `tenantHostImage` and `tenantHostImagePullPolicy` can
187
+ select a compatible custom wasmCloud runtime image when needed.
188
+
189
+ ## Shared implementation
190
+
191
+ This generated project imports an exact version of `@di-framework/platform/local`.
192
+ The same package provides the Kubernetes platform used by `di-framework-kube`.
193
+ Configure this project through Pulumi configuration; infrastructure implementation
194
+ changes belong in the shared package rather than copied tenancy files.
195
+
196
+ Backing-service CRD contracts (`BackingServiceClass`, `BackingService`,
197
+ `ServiceBinding`), authorization boundaries, and runtime feasibility notes live in
198
+ the `@di-framework/platform` package README. Platform install seeds the approved
199
+ default classes (`keyvalue-redis`, `messaging-nats`), retains CRDs on stack destroy,
200
+ ships compiled controller scripts including `backing-services.js`, and enforces
201
+ tenant RBAC / admission / quotas / backend NetworkPolicy isolation (#452).
202
+
203
+ For projects generated before this extraction, preserve the existing project name,
204
+ backend, stack, and configuration when updating the import/dependency. Review
205
+ `pulumi preview` before applying. The shared local entrypoint preserves existing
206
+ logical resource names. Any old `tenancy.ts` and `tenancy/` copies are unused by the
207
+ new entrypoint; migrate customizations before removing them. Publishing the shared
208
+ package is required before installing its pinned version from npm.
@@ -0,0 +1,2 @@
1
+ // Platform implementation is shared with di-framework-kube.
2
+ export { schemaVersion, kubeconfig, namespace, registry, endpoints, tenants, users } from '@di-framework/platform/local';
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "di-framework-wasmcloud-platform",
3
+ "private": true,
4
+ "main": "index.ts",
5
+ "dependencies": {
6
+ "@pulumi/command": "1.2.1",
7
+ "@pulumi/kubernetes": "4.34.0",
8
+ "@pulumi/pulumi": "3.261.0",
9
+ "typescript": "5.9.3",
10
+ "@di-framework/platform": "{{DI_FRAMEWORK_PLATFORM_VERSION}}"
11
+ },
12
+ "devDependencies": {
13
+ "@types/node": "22.18.0"
14
+ },
15
+ "scripts": {
16
+ "check": "tsc --noEmit"
17
+ }
18
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "commonjs",
5
+ "moduleResolution": "node",
6
+ "strict": true,
7
+ "esModuleInterop": true,
8
+ "skipLibCheck": true
9
+ },
10
+ "include": ["index.ts", "tenancy.ts", "tenancy/**/*.ts"]
11
+ }
@@ -0,0 +1,60 @@
1
+ // assets/queue-adapter.ts
2
+ import"virtual:di-framework-wasmcloud-guests";
3
+ import application from "virtual:di-framework-application";
4
+ import { guests as wasmcloudGuests } from "virtual:di-framework-wasmcloud-guests";
5
+ function requireGuestsObject(value) {
6
+ if (typeof value !== "object" || value === null) {
7
+ throw new TypeError("wasmCloud guests module must export a guests object");
8
+ }
9
+ }
10
+ requireGuestsObject(wasmcloudGuests);
11
+ async function dispatchJob(job, app = application) {
12
+ try {
13
+ let parsedPayload = job.payload;
14
+ if (typeof job.payload === "string") {
15
+ try {
16
+ parsedPayload = JSON.parse(job.payload);
17
+ } catch {
18
+ parsedPayload = job.payload;
19
+ }
20
+ }
21
+ const jobObject = {
22
+ id: job.id,
23
+ queueName: job.queue,
24
+ payload: parsedPayload,
25
+ attempts: Number(job.attempt ?? 1),
26
+ maxRetries: 3,
27
+ enqueuedAt: Number(job.createdAt ?? Date.now()),
28
+ availableAt: Number(job.createdAt ?? Date.now()),
29
+ priority: 0,
30
+ backoffMs: 1000,
31
+ timeoutMs: 30000,
32
+ status: "processing"
33
+ };
34
+ if (typeof app?.dispatch === "function") {
35
+ await app.dispatch(job.queue, jobObject);
36
+ } else if (typeof app?.execute === "function") {
37
+ await app.execute(jobObject);
38
+ } else if (typeof app === "function") {
39
+ await app(jobObject);
40
+ } else {
41
+ throw new Error("No dispatcher found on default application export");
42
+ }
43
+ return { tag: "ok", val: undefined };
44
+ } catch (error) {
45
+ console.error("Unhandled DI Framework queue dispatch error", error);
46
+ return { tag: "err", val: "Queue dispatch failed" };
47
+ }
48
+ }
49
+ var dispatch = {
50
+ async dispatch(job) {
51
+ const result = await dispatchJob(job);
52
+ if (result.tag === "err")
53
+ throw result.val;
54
+ }
55
+ };
56
+ export {
57
+ dispatch,
58
+ dispatchJob,
59
+ requireGuestsObject
60
+ };
@@ -0,0 +1,13 @@
1
+ component: di-framework:sqlite@0.1.0
2
+ profile: release
3
+ built: 2026-09-29T20:51:34Z
4
+ rustc: rustc 1.97.1 (8bab26f4f 2026-07-14)
5
+ target: wasm32-wasip2
6
+ wasi-sdk: 34.0
7
+ wasm-tools: wasm-tools 1.258.0 (5c6d31c78 2026-08-24)
8
+ rusqlite: 0.40.2
9
+ libsqlite3-sys: 0.38.2 (SQLite 3.53.2)
10
+ wit-bindgen: 0.61.1
11
+ LIBSQLITE3_FLAGS: -DSQLITE_OS_OTHER=1 -DSQLITE_TEMP_STORE=3 -DSQLITE_STMTJRNL_SPILL=-1 -DSQLITE_OMIT_WAL -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_DEFAULT_SYNCHRONOUS=2 -DSQLITE_MAX_MMAP_SIZE=0 -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_DEFAULT_MEMSTATUS=0
12
+ CFLAGS_wasm32_wasip2: --target=wasm32-wasip2 -Os
13
+ size: 1247483 bytes
@@ -0,0 +1,2 @@
1
+ 9eb8d3b7c962dfbe681dc175db8e8eb4d31b99e4699c99ea247cd662fa4c73a8 di-framework-sqlite.wasm
2
+ 877486e879456243bfcdcbf0bd518ec4d728b6e3d5afa159e266f4e16ba8dd1d di-framework-sqlite.wit
@@ -0,0 +1,337 @@
1
+ package root:component;
2
+
3
+ world root {
4
+ import wasi:io/poll@0.2.9;
5
+ import wasi:clocks/monotonic-clock@0.2.9;
6
+ import wasi:clocks/wall-clock@0.2.9;
7
+ import wasi:random/random@0.2.9;
8
+ import wasi:io/error@0.2.9;
9
+ import wasi:io/streams@0.2.9;
10
+ import wasi:cli/stdout@0.2.9;
11
+ import wasi:cli/stderr@0.2.9;
12
+ import wasi:cli/stdin@0.2.9;
13
+ import wasi:cli/environment@0.2.9;
14
+ import wasi:cli/exit@0.2.9;
15
+ import wasi:cli/terminal-input@0.2.9;
16
+ import wasi:cli/terminal-output@0.2.9;
17
+ import wasi:cli/terminal-stdin@0.2.9;
18
+ import wasi:cli/terminal-stdout@0.2.9;
19
+ import wasi:cli/terminal-stderr@0.2.9;
20
+ import wasi:filesystem/types@0.2.9;
21
+ import wasi:filesystem/preopens@0.2.9;
22
+
23
+ export di-framework:sqlite/types@0.1.0;
24
+ export di-framework:sqlite/database@0.1.0;
25
+ }
26
+ package wasi:io@0.2.9 {
27
+ interface poll {
28
+ resource pollable {
29
+ block: func();
30
+ }
31
+
32
+ poll: func(in: list<borrow<pollable>>) -> list<u32>;
33
+ }
34
+ interface error {
35
+ resource error;
36
+ }
37
+ interface streams {
38
+ use error.{error};
39
+ use poll.{pollable};
40
+
41
+ resource input-stream;
42
+
43
+ resource output-stream {
44
+ check-write: func() -> result<u64, stream-error>;
45
+ write: func(contents: list<u8>) -> result<_, stream-error>;
46
+ blocking-flush: func() -> result<_, stream-error>;
47
+ subscribe: func() -> pollable;
48
+ }
49
+
50
+ variant stream-error {
51
+ last-operation-failed(error),
52
+ closed,
53
+ }
54
+ }
55
+ }
56
+
57
+
58
+ package wasi:clocks@0.2.9 {
59
+ interface monotonic-clock {
60
+ use wasi:io/poll@0.2.9.{pollable};
61
+
62
+ type instant = u64;
63
+
64
+ type duration = u64;
65
+
66
+ now: func() -> instant;
67
+
68
+ subscribe-instant: func(when: instant) -> pollable;
69
+
70
+ subscribe-duration: func(when: duration) -> pollable;
71
+ }
72
+ interface wall-clock {
73
+ record datetime {
74
+ seconds: u64,
75
+ nanoseconds: u32,
76
+ }
77
+
78
+ now: func() -> datetime;
79
+ }
80
+ }
81
+
82
+
83
+ package wasi:random@0.2.9 {
84
+ interface random {
85
+ get-random-bytes: func(len: u64) -> list<u8>;
86
+ }
87
+ }
88
+
89
+
90
+ package wasi:cli@0.2.9 {
91
+ interface stdout {
92
+ use wasi:io/streams@0.2.9.{output-stream};
93
+
94
+ get-stdout: func() -> output-stream;
95
+ }
96
+ interface stderr {
97
+ use wasi:io/streams@0.2.9.{output-stream};
98
+
99
+ get-stderr: func() -> output-stream;
100
+ }
101
+ interface stdin {
102
+ use wasi:io/streams@0.2.9.{input-stream};
103
+
104
+ get-stdin: func() -> input-stream;
105
+ }
106
+ interface environment {
107
+ get-environment: func() -> list<tuple<string, string>>;
108
+ }
109
+ interface exit {
110
+ exit: func(status: result);
111
+ }
112
+ interface terminal-input {
113
+ resource terminal-input;
114
+ }
115
+ interface terminal-output {
116
+ resource terminal-output;
117
+ }
118
+ interface terminal-stdin {
119
+ use terminal-input.{terminal-input};
120
+
121
+ get-terminal-stdin: func() -> option<terminal-input>;
122
+ }
123
+ interface terminal-stdout {
124
+ use terminal-output.{terminal-output};
125
+
126
+ get-terminal-stdout: func() -> option<terminal-output>;
127
+ }
128
+ interface terminal-stderr {
129
+ use terminal-output.{terminal-output};
130
+
131
+ get-terminal-stderr: func() -> option<terminal-output>;
132
+ }
133
+ }
134
+
135
+
136
+ package wasi:filesystem@0.2.9 {
137
+ interface types {
138
+ use wasi:io/streams@0.2.9.{input-stream, output-stream};
139
+ use wasi:clocks/wall-clock@0.2.9.{datetime};
140
+
141
+ resource descriptor {
142
+ read-via-stream: func(offset: filesize) -> result<input-stream, error-code>;
143
+ write-via-stream: func(offset: filesize) -> result<output-stream, error-code>;
144
+ append-via-stream: func() -> result<output-stream, error-code>;
145
+ get-flags: func() -> result<descriptor-flags, error-code>;
146
+ set-size: func(size: filesize) -> result<_, error-code>;
147
+ read: func(length: filesize, offset: filesize) -> result<tuple<list<u8>, bool>, error-code>;
148
+ write: func(buffer: list<u8>, offset: filesize) -> result<filesize, error-code>;
149
+ sync: func() -> result<_, error-code>;
150
+ create-directory-at: func(path: string) -> result<_, error-code>;
151
+ stat: func() -> result<descriptor-stat, error-code>;
152
+ stat-at: func(path-flags: path-flags, path: string) -> result<descriptor-stat, error-code>;
153
+ open-at: func(path-flags: path-flags, path: string, open-flags: open-flags, %flags: descriptor-flags) -> result<descriptor, error-code>;
154
+ unlink-file-at: func(path: string) -> result<_, error-code>;
155
+ metadata-hash: func() -> result<metadata-hash-value, error-code>;
156
+ metadata-hash-at: func(path-flags: path-flags, path: string) -> result<metadata-hash-value, error-code>;
157
+ }
158
+
159
+ type filesize = u64;
160
+
161
+ enum error-code {
162
+ access,
163
+ would-block,
164
+ already,
165
+ bad-descriptor,
166
+ busy,
167
+ deadlock,
168
+ quota,
169
+ exist,
170
+ file-too-large,
171
+ illegal-byte-sequence,
172
+ in-progress,
173
+ interrupted,
174
+ invalid,
175
+ io,
176
+ is-directory,
177
+ loop,
178
+ too-many-links,
179
+ message-size,
180
+ name-too-long,
181
+ no-device,
182
+ no-entry,
183
+ no-lock,
184
+ insufficient-memory,
185
+ insufficient-space,
186
+ not-directory,
187
+ not-empty,
188
+ not-recoverable,
189
+ unsupported,
190
+ no-tty,
191
+ no-such-device,
192
+ overflow,
193
+ not-permitted,
194
+ pipe,
195
+ read-only,
196
+ invalid-seek,
197
+ text-file-busy,
198
+ cross-device,
199
+ }
200
+
201
+ flags descriptor-flags {
202
+ read,
203
+ write,
204
+ file-integrity-sync,
205
+ data-integrity-sync,
206
+ requested-write-sync,
207
+ mutate-directory,
208
+ }
209
+
210
+ enum descriptor-type {
211
+ unknown,
212
+ block-device,
213
+ character-device,
214
+ directory,
215
+ fifo,
216
+ symbolic-link,
217
+ regular-file,
218
+ socket,
219
+ }
220
+
221
+ type link-count = u64;
222
+
223
+ record descriptor-stat {
224
+ %type: descriptor-type,
225
+ link-count: link-count,
226
+ size: filesize,
227
+ data-access-timestamp: option<datetime>,
228
+ data-modification-timestamp: option<datetime>,
229
+ status-change-timestamp: option<datetime>,
230
+ }
231
+
232
+ flags path-flags {
233
+ symlink-follow,
234
+ }
235
+
236
+ flags open-flags {
237
+ create,
238
+ directory,
239
+ exclusive,
240
+ truncate,
241
+ }
242
+
243
+ record metadata-hash-value {
244
+ lower: u64,
245
+ upper: u64,
246
+ }
247
+ }
248
+ interface preopens {
249
+ use types.{descriptor};
250
+
251
+ get-directories: func() -> list<tuple<descriptor, string>>;
252
+ }
253
+ }
254
+
255
+
256
+ package di-framework:sqlite@0.1.0 {
257
+ interface types {
258
+ record sqlite-error {
259
+ code: s32,
260
+ extended-code: s32,
261
+ message: string,
262
+ }
263
+
264
+ variant error {
265
+ open-failed(string),
266
+ closed,
267
+ invalid-sql(string),
268
+ invalid-params(string),
269
+ execution-failed(sqlite-error),
270
+ value-conversion-failed(string),
271
+ busy,
272
+ invalid-transaction-state(string),
273
+ other(string),
274
+ }
275
+
276
+ variant value {
277
+ null,
278
+ integer(s64),
279
+ real(f64),
280
+ text(string),
281
+ blob(list<u8>),
282
+ }
283
+
284
+ type row = list<tuple<string, value>>;
285
+
286
+ enum sync-mode {
287
+ off,
288
+ normal,
289
+ full,
290
+ }
291
+
292
+ enum journal-mode {
293
+ delete,
294
+ persist,
295
+ memory,
296
+ }
297
+
298
+ enum transaction-behavior {
299
+ deferred,
300
+ immediate,
301
+ exclusive,
302
+ }
303
+
304
+ record open-options {
305
+ create: option<bool>,
306
+ read-only: option<bool>,
307
+ synchronous: option<sync-mode>,
308
+ journal-mode: option<journal-mode>,
309
+ busy-timeout-ms: option<u32>,
310
+ foreign-keys: option<bool>,
311
+ }
312
+ }
313
+ interface database {
314
+ use types.{error, value, row, open-options, transaction-behavior};
315
+
316
+ resource connection {
317
+ exec: func(sql: string) -> result<_, error>;
318
+ run: func(sql: string, params: list<value>) -> result<u64, error>;
319
+ query: func(sql: string, params: list<value>) -> result<list<row>, error>;
320
+ first: func(sql: string, params: list<value>) -> result<option<row>, error>;
321
+ begin: func(behavior: option<transaction-behavior>) -> result<_, error>;
322
+ commit: func() -> result<_, error>;
323
+ rollback: func() -> result<_, error>;
324
+ savepoint: func(name: string) -> result<_, error>;
325
+ release-savepoint: func(name: string) -> result<_, error>;
326
+ rollback-to-savepoint: func(name: string) -> result<_, error>;
327
+ in-transaction: func() -> bool;
328
+ changes: func() -> u64;
329
+ last-insert-rowid: func() -> s64;
330
+ close: func() -> result<_, error>;
331
+ }
332
+
333
+ open: func(path: string, options: option<open-options>) -> result<connection, error>;
334
+
335
+ sqlite-version: func() -> string;
336
+ }
337
+ }
@@ -0,0 +1,8 @@
1
+ Copyright © 2019-2023 the Contributors to the WASI Specification, published
2
+ by the [WebAssembly Community Group][cg] under the
3
+ [W3C Community Contributor License Agreement (CLA)][cla]. A human-readable
4
+ [summary][summary] is available.
5
+
6
+ [cg]: https://www.w3.org/community/webassembly/
7
+ [cla]: https://www.w3.org/community/about/agreements/cla/
8
+ [summary]: https://www.w3.org/community/about/agreements/cla-deed/