@velajs/cloudflare 1.30.0 → 1.32.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 (118) hide show
  1. package/CHANGELOG.md +174 -0
  2. package/README.md +407 -77
  3. package/dist/bindings.js +93 -0
  4. package/dist/bindings.js.map +1 -0
  5. package/dist/cloudflare-application-CXDy9C1R.d.ts +199 -0
  6. package/dist/cloudflare-application.js +15 -34
  7. package/dist/cloudflare-application.js.map +1 -1
  8. package/dist/cloudflare-factory-CuFNUJJD.d.ts +241 -0
  9. package/dist/cloudflare-factory.js +227 -38
  10. package/dist/cloudflare-factory.js.map +1 -1
  11. package/dist/diagnostics.js +18 -0
  12. package/dist/diagnostics.js.map +1 -0
  13. package/dist/durable-object/boot.js +76 -0
  14. package/dist/durable-object/boot.js.map +1 -0
  15. package/dist/durable-object/host-dispatch.js +134 -0
  16. package/dist/durable-object/host-dispatch.js.map +1 -0
  17. package/dist/durable-object/host-methods.js +47 -0
  18. package/dist/durable-object/host-methods.js.map +1 -0
  19. package/dist/durable-object/tokens.js +17 -0
  20. package/dist/durable-object/tokens.js.map +1 -0
  21. package/dist/durable-object/vela-durable-object.js +121 -0
  22. package/dist/durable-object/vela-durable-object.js.map +1 -0
  23. package/dist/durable-objects.d.ts +136 -10
  24. package/dist/durable-objects.js +3 -1
  25. package/dist/email/email-dispatch.js +65 -0
  26. package/dist/email/email-dispatch.js.map +1 -0
  27. package/dist/email/on-email.js +57 -0
  28. package/dist/email/on-email.js.map +1 -0
  29. package/dist/email.d.ts +51 -0
  30. package/dist/email.js +3 -0
  31. package/dist/entrypoint/vela-entrypoint.js +160 -0
  32. package/dist/entrypoint/vela-entrypoint.js.map +1 -0
  33. package/dist/entrypoints.d.ts +93 -0
  34. package/dist/entrypoints.js +2 -0
  35. package/dist/host/host-invoker.js +276 -0
  36. package/dist/host/host-invoker.js.map +1 -0
  37. package/dist/host/host-members.js +73 -0
  38. package/dist/host/host-members.js.map +1 -0
  39. package/dist/host-members-DECj_4yz.d.ts +13 -0
  40. package/dist/index.d.ts +211 -445
  41. package/dist/index.js +8 -13
  42. package/dist/{nonce.durable-object-Ci9AGssY.d.ts → nonce.durable-object-Bg1e0BMD.d.ts} +1 -11
  43. package/dist/platform.js +22 -0
  44. package/dist/platform.js.map +1 -0
  45. package/dist/queue/cloudflare-queues.js +7 -7
  46. package/dist/queue/cloudflare-queues.js.map +1 -1
  47. package/dist/rate-limit/cloudflare-rate-limit.store.js +66 -27
  48. package/dist/rate-limit/cloudflare-rate-limit.store.js.map +1 -1
  49. package/dist/root-module.js +19 -0
  50. package/dist/root-module.js.map +1 -0
  51. package/dist/rpc/entrypoint-error.js +145 -0
  52. package/dist/rpc/entrypoint-error.js.map +1 -0
  53. package/dist/schedule-diagnostics.js +8 -15
  54. package/dist/schedule-diagnostics.js.map +1 -1
  55. package/dist/services/kv-cache.store.js +33 -7
  56. package/dist/services/kv-cache.store.js.map +1 -1
  57. package/dist/storage/r2-storage.js +30 -0
  58. package/dist/storage/r2-storage.js.map +1 -0
  59. package/dist/storage.d.ts +28 -0
  60. package/dist/storage.js +2 -0
  61. package/dist/tail/on-tail.js +46 -0
  62. package/dist/tail/on-tail.js.map +1 -0
  63. package/dist/tail/tail-dispatch.js +67 -0
  64. package/dist/tail/tail-dispatch.js.map +1 -0
  65. package/dist/tail.d.ts +39 -0
  66. package/dist/tail.js +2 -0
  67. package/dist/testing.d.ts +148 -0
  68. package/dist/testing.js +188 -0
  69. package/dist/testing.js.map +1 -0
  70. package/dist/websocket/binding-gateways.js +33 -0
  71. package/dist/websocket/binding-gateways.js.map +1 -0
  72. package/dist/websocket/cf-room-registry.js +3 -1
  73. package/dist/websocket/cf-room-registry.js.map +1 -1
  74. package/dist/websocket/do-bootstrap.js +64 -40
  75. package/dist/websocket/do-bootstrap.js.map +1 -1
  76. package/dist/websocket/do-live.js +49 -90
  77. package/dist/websocket/do-live.js.map +1 -1
  78. package/dist/websocket/do-state.js.map +1 -1
  79. package/dist/websocket/live-driver.js +149 -0
  80. package/dist/websocket/live-driver.js.map +1 -0
  81. package/dist/websocket/room-id.js +11 -1
  82. package/dist/websocket/room-id.js.map +1 -1
  83. package/dist/websocket/websocket.durable-object.js +51 -18
  84. package/dist/websocket/websocket.durable-object.js.map +1 -1
  85. package/dist/websocket/worker-transport.js +80 -0
  86. package/dist/websocket/worker-transport.js.map +1 -0
  87. package/dist/worker-events.js +49 -0
  88. package/dist/worker-events.js.map +1 -0
  89. package/dist/workflow/vela-workflow.js +104 -0
  90. package/dist/workflow/vela-workflow.js.map +1 -0
  91. package/dist/workflows.d.ts +82 -0
  92. package/dist/workflows.js +2 -0
  93. package/package.json +39 -6
  94. package/dist/_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/decorate.js +0 -9
  95. package/dist/_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/decorateMetadata.js +0 -6
  96. package/dist/_virtual/_@oxc-project_runtime@0.150.0/helpers/esm/decorateParam.js +0 -8
  97. package/dist/storage/r2-storage.driver.js +0 -67
  98. package/dist/storage/r2-storage.driver.js.map +0 -1
  99. package/dist/storage/storage-key-claim.js +0 -74
  100. package/dist/storage/storage-key-claim.js.map +0 -1
  101. package/dist/storage/storage-manager.service.js +0 -38
  102. package/dist/storage/storage-manager.service.js.map +0 -1
  103. package/dist/storage/storage.controller.js +0 -64
  104. package/dist/storage/storage.controller.js.map +0 -1
  105. package/dist/storage/storage.module.js +0 -25
  106. package/dist/storage/storage.module.js.map +0 -1
  107. package/dist/storage/storage.service.js +0 -64
  108. package/dist/storage/storage.service.js.map +0 -1
  109. package/dist/storage/storage.tokens.js +0 -7
  110. package/dist/storage/storage.tokens.js.map +0 -1
  111. package/dist/websocket/broadcast.js +0 -32
  112. package/dist/websocket/broadcast.js.map +0 -1
  113. package/dist/websocket/cloudflare-websocket.module.js +0 -25
  114. package/dist/websocket/cloudflare-websocket.module.js.map +0 -1
  115. package/dist/websocket/websocket-routing.js +0 -133
  116. package/dist/websocket/websocket-routing.js.map +0 -1
  117. package/dist/websocket/ws-server-holder.js +0 -38
  118. package/dist/websocket/ws-server-holder.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,179 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.32.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 0dccc7f: Durable Objects are Vela entrypoints. `defineCloudflareApp(AppModule, options)` defines one application: its `worker` is the Worker's default export, and the Durable Object classes defined from it share its root module and options. `VelaDurableObject(app, Host, { rpc })` from `@velajs/cloudflare/durable-objects` returns a Durable Object class whose JS-RPC methods are the host methods `rpc` names:
8
+
9
+ ```ts
10
+ const app = defineCloudflareApp(AppModule);
11
+ export class Counter extends VelaDurableObject(app, CounterHost, { rpc: ['increment'] }) {}
12
+ export default app.worker;
13
+ // await env.COUNTER.getByName('orders').increment(1)
14
+ ```
15
+
16
+ - Each instance boots one application context with `VelaFactory.createApplicationContext`, in its constructor under `blockConcurrencyWhile`. The host, an `@Injectable()`, is added to the root module's providers. The context injects the object's `ENV` and the new `DO_STATE`, `DO_STORAGE` and `DO_ID` tokens, and the app's runtime adapters configure its container (`configureContainer`) as they do the Worker's. Their other hooks (`onBootstrap`, `onRoutesBuilt`, `invocationTransport`, `getClientIp`, `requestMiddleware`) do not run in the object, which serves no HTTP routes. `VelaDurableObject(AppModule, Host, { rpc })` takes a bare root instead. A class uses the app when it is defined, so declare it in the module that defines the app: in the Worker entry, or beside an app defined in a module of its own that the entry imports.
17
+ - The RPC surface is explicit: exactly the host methods `rpc` names are RPC methods, and a `DurableObjectNamespace<Counter>` stub exposes exactly their signatures. No other method is reachable over RPC, even from plain JavaScript naming it on a stub: not an unlisted public method, a TypeScript `private` or `protected` helper, a lifecycle hook or the container's `dispose()` hook. Without `rpc`, the object serves only its event handlers. `rpc` is typed to the host's public methods (`DurableObjectRpcMethod<Host>`); when the class is defined, a name that is not a prototype method of the host (an accessor, or an instance field such as an arrow function), a hook (`onModuleInit`, ..., `dispose`, `collectEntrypoints`), an event handler, or `ctx`, `env`, `connect`, `dup`, `id`, `name` or `then` (which the class or its stubs own) throws, and so does a host whose prototype defines `then()`, since every instance would be a thenable and resolving it would hang. A host's `fetch`, `alarm`, `webSocketMessage`, `webSocketClose` and `webSocketError` become the object's handlers.
18
+ - Each RPC call and event runs in its own execution scope, so request-scoped providers are built per call, through the host's scoped guards, pipes (RPC arguments only), interceptors and filters. A `fetch()` response with a streamed body keeps its scope open, as the HTTP edge does, until the body is read, fails or is cancelled, under the object's `waitUntil`. Application-wide `APP_GUARD`, `APP_INTERCEPTOR`, `APP_PIPE` and `APP_FILTER` components do not apply; failures still reach the application's `ExceptionHandler`. `ExecutionContext.getType()` is `'rpc'`, `'cf:do:fetch'`, `'cf:do:alarm'` or `'cf:do:websocket'`, and `getPayload()` is the arguments.
19
+ - Failures are reported first. An RPC call rejects only with an `EntrypointError` (`EntrypointError`, `isEntrypointError()` and `EntrypointErrorInit` are exported from `@velajs/cloudflare`; service entrypoints share it). It carries what HTTP sends for the error, with server bodies redacted: its `status`, `code` and `message`, and its `details` below 500. A 4xx `HttpException` keeps its code, message and details, a branded `VelaError` keeps its code and message at any status, as over HTTP, and an unknown error becomes `500 internal`. Unlike HTTP, a branded `VelaError` with a 5xx status loses its details, and a 4xx `HttpException` constructed with an object response, which HTTP sends as it is, keeps only its status (code `error`, message `Entrypoint request failed`) unless that object is a canonical `{ error: { code, message, details } }` body. No stack frame, cause or other property of the original error crosses the RPC boundary. `isEntrypointError()` recognizes the plain `Error` workerd delivers to the caller. workerd keeps those properties across RPC only from `compatibility_date` 2026-04-21 or with the `enhanced_error_serialization` flag; on an older date the caller receives an `Error` whose message is `EntrypointError: <message>`, without its status, code or details. An `EntrypointError` a host rethrows, such as another object's failure, keeps its code, message and details for a client fault and only its status for a server fault, and a failure outside the pipeline is reported and becomes `500 internal`. `fetch()` renders the JSON error body; alarms and WebSocket events rethrow for the platform. A context that fails to start resets the object, and waiting callers receive only a redacted `500`.
20
+ - The Worker descriptor lists the Durable Object classes defined from the app (`durableObjects`), and each class carries a `CloudflareDurableObjectDescriptor` under the static `CLOUDFLARE_DURABLE_OBJECT` key, so tools know what each exported class serves. `isCloudflareApp()` recognizes an app definition.
21
+ - `createCloudflareWorker(AppModule, options)` is `defineCloudflareApp(AppModule, options).worker`.
22
+ - `CloudflareApp` types an app definition. `@velajs/cloudflare/durable-objects` exports `DurableObjectRoot`, `VelaDurableObjectOptions`, `VelaDurableObjectClass`, `DurableObjectRpc`, `DurableObjectRpcMethod`, and `DurableObjectExecutionContext`, the `ExecutionContext` that guards, interceptors and filters receive around an invocation, whose `getType()` values are `DurableObjectInvocationKind`.
23
+ - The host code lives in `@velajs/cloudflare/durable-objects`, and the Workflow, service entrypoint, email and tail code in their own subpaths: the minimal `createCloudflareWorker()` Worker (one controller, bundled by Wrangler with `--minify`) bundles none of it. It measures 163,895 bytes raw and 55,713 bytes gzipped in this release, against 155,636 and 52,363 for 1.31.0 (mostly the core's route contracts and application context, then the app definition and the Worker's optional `email` and `tail` handlers), within its unchanged ceiling.
24
+
25
+ **Behavior change:** `VelaWebSocketDurableObject(root)` boots through the same application context as `VelaDurableObject`, and also accepts the app from `defineCloudflareApp`, whose runtime adapters then configure its container (`configureContainer`). Its context injects `DO_STATE`, `DO_STORAGE` and `DO_ID`. When its application fails to start, a waiting caller receives a redacted `EntrypointError` (`500 internal`) instead of the startup error, which the object logs. An application that does not import `WebSocketModule` now fails after its lifecycle hooks ran, and its context is disposed.
26
+ - 8f3d0a6: Workflows, service entrypoints, email and tail are Vela entrypoints. Their classes are defined from the app of `defineCloudflareApp(AppModule, options)`, like Durable Objects, and run in the Worker's own application for the event's environment: the one the Worker's `fetch`, `queue` and `scheduled` handlers use, with its singletons, runtime adapters and `ENV`. Their hosts are added to the root module's providers. Application-wide `APP_GUARD`, `APP_INTERCEPTOR`, `APP_PIPE` and `APP_FILTER` components do not apply to Workflow runs, service entrypoint calls, or email and tail handlers, as for Durable Objects: their callers are the platform and other Workers, not HTTP requests. Declare guards on the host or handler class or method.
27
+
28
+ ```ts
29
+ const app = defineCloudflareApp(AppModule);
30
+ export class SignupWorkflow extends VelaWorkflow(app, SignupHost) {}
31
+ export class Billing extends VelaEntrypoint(app, BillingHost, { rpc: ['charge'] }) {}
32
+ export default app.worker;
33
+ ```
34
+
35
+ - **Workflows.** `VelaWorkflow(app, Host)` from the new `@velajs/cloudflare/workflows` subpath returns a `WorkflowEntrypoint` class whose `run(event, step)` calls the `run` method of `Host`, an `@Injectable()`. The engine's `event` and `step` pass through untouched, so `step.do`, `step.sleep` and `step.waitForEvent` keep their retry and replay semantics. Each run executes in its own execution scope (request-scoped providers per run) through the host's scoped guards, interceptors and filters, with `ExecutionContext.getType()` `'cf:workflow'` and `getPayload()` the event. A failure is reported (`edge: 'workflow'`) and rethrown as it is, so the engine honors `NonRetryableError`; a scoped filter that catches it settles the run with what it returns. The engine's own interruptions, an `Error` whose message starts with `Aborting engine:` that a step rejects with when the instance is paused, restarted or terminated, pass through as they are: they are not reported and no filter sees them, so a paused instance stays paused and can resume. The class type takes the params from the host's `run(event)`, so `wrangler types` types the binding (`Workflow<Readonly<SignupParams>>`), and `WorkflowParams<T>` reads them from a Workflow class or host. `workflow<Params>({ binding })`, a new binding reference of the root entry, creates and reads instances by binding name.
36
+ - **Service entrypoints.** `VelaEntrypoint(app, Host, { rpc })` from the new `@velajs/cloudflare/entrypoints` subpath returns a `WorkerEntrypoint` class whose JS-RPC methods are exactly the host methods `rpc` names, typed on a `Service<typeof Billing>` binding; nothing else is reachable over RPC. `ctx`, `env`, `dup`, `then`, the lifecycle hooks and the `WorkerEntrypoint` handlers (`fetch`, `connect`, `email`, `queue`, `scheduled`, `tail`, `tailStream`, `test`, `trace`) are rejected when the class is defined. Each call runs in its own execution scope through the host's scoped guards, pipes (the arguments), interceptors and filters (`getType()` `'rpc'`), with the caller's `ctx.props` injectable as the request-scoped `ENTRYPOINT_PROPS` token (`{}` when the caller attached none). Failures are reported (`edge: 'rpc'`) and reject only with an `EntrypointError`; a call to an application that fails to start rejects with a redacted `500`.
37
+ - **Email and tail.** `@OnEmail({ to? })` from the new `@velajs/cloudflare/email` subpath and `@OnTail()` from the new `@velajs/cloudflare/tail` subpath make provider methods Email Workers and Tail Workers handlers (entrypoint kinds `cf:email` and `cf:tail`); importing them gives the Worker (`app.worker`, `createCloudflareWorker()`) its `email` and `tail` handlers. An email goes to the handlers whose `to` lists its envelope recipient, compared without regard to case, else to those without `to`; each receives the native `ForwardableEmailMessage` in its own execution scope through its scoped guards, interceptors and filters. A message no handler accepts is rejected with `setReject(UNCLAIMED_EMAIL_REASON)` instead of dropped, and handler failures are reported (`edge: 'email'`) and rethrown unless a scoped filter handles them. Every `@OnTail()` handler receives every `TraceItem[]` batch; its failures are reported (`edge: 'tail'`) and never thrown into the platform's loop. When the application fails to start, the `tail` handler logs the error to the console and resolves, and the next batch retries.
38
+ - **Hosts.** A host whose prototype defines `then()`, as a method or an accessor, is rejected when a Workflow or service entrypoint class is defined from it, as for a Durable Object: every instance would be a thenable, and resolving the host would hang.
39
+ - **Descriptors.** The Worker descriptor and the app list the Workflow and service entrypoint classes defined from the app (`workflows`, `entrypoints`), and each class carries a `CloudflareWorkflowDescriptor` or `CloudflareEntrypointDescriptor` under the new static `CLOUDFLARE_WORKFLOW` or `CLOUDFLARE_ENTRYPOINT` key. The descriptor's `createApplication(env)` includes their hosts. A Workflow or service entrypoint class defined after the app started building its Worker application throws.
40
+ - **Testing.** `createTestingWorker()` drives `email(message)` and `tail(events)`. `emailMessage({ from, to, subject?, text?, headers?, raw? })` builds a `ForwardableEmailMessage` that records `setReject()`, `forward()` and `reply()` (`rejectReason`, `forwards`, `replies`), and `traceItem(overrides?)` builds a `TraceItem`.
41
+ - `CloudflareApplication.getContainer()` returns the application's container, for dispatch seams that take it with `entrypoints`.
42
+ - Types: `@velajs/cloudflare/workflows` exports `VelaWorkflowClass`, `WorkflowHost`, `WorkflowOutput`, `WorkflowParams` and `WorkflowExecutionContext`; `@velajs/cloudflare/entrypoints` exports `EntrypointRpc`, `EntrypointRpcMethod`, `VelaEntrypointClass`, `VelaEntrypointOptions` and `EntrypointRpcExecutionContext`; `@velajs/cloudflare/email` exports `OnEmailOptions`, `OnEmailDecorator` and `EmailExecutionContext`; `@velajs/cloudflare/tail` exports `OnTailDecorator` and `TailExecutionContext`; and `@velajs/cloudflare/testing` exports `TestingEmailMessage` and `TestingEmailInit`. Each `*ExecutionContext` is the `ExecutionContext` that guards, interceptors and filters receive around that kind of invocation.
43
+ - The new subpaths stay out of the minimal `createCloudflareWorker()` Worker.
44
+
45
+ ### Patch Changes
46
+
47
+ - Updated dependencies [9dea818]
48
+ - Updated dependencies [524e422]
49
+ - Updated dependencies [a7d0912]
50
+ - Updated dependencies [04e7ac5]
51
+ - Updated dependencies [ff98301]
52
+ - Updated dependencies [38ab1e5]
53
+ - Updated dependencies [ef18e04]
54
+ - Updated dependencies [38ab1e5]
55
+ - Updated dependencies [586be4f]
56
+ - Updated dependencies [9c1bd0b]
57
+ - Updated dependencies [e412fc8]
58
+ - Updated dependencies [bcdf5e3]
59
+ - Updated dependencies [d5a8c60]
60
+ - @velajs/vela@1.32.0
61
+ - @velajs/storage@1.32.0
62
+ - @velajs/testing@1.32.0
63
+ - @velajs/feature-flags@1.31.0
64
+
65
+ ## 1.31.0
66
+
67
+ ### Minor Changes
68
+
69
+ - 5f19b37: The Cloudflare adapter wires the core `WebSocketModule` and `LiveModule` itself, so an application imports the same modules on every runtime and one static `AppModule` boots in a Worker, in each `VelaWebSocketDurableObject` and on a node host. `cloudflareAdapter` registers the platform as the global `WS_TRANSPORT` and `LIVE_PLATFORM` tokens before modules load; it never replaces a module's providers.
70
+
71
+ - In the Worker, `WebSocketModule` serves an upgrade route for each gateway that names a `binding`. The route authenticates the upgrade before the Durable Object id is derived, reconciles it with the request's trusted identity, and forwards it to the gateway + room Durable Object as before. A gateway's `@WebSocketServer()` has no sockets in the Worker, so pushes from there throw with guidance to push with `Gateways` from `@velajs/vela/websocket`.
72
+ - Inside the Durable Object, the server gateways inject broadcasts to that object's hibernatable sockets. `LiveModule` delivers locally, and its cursor log is a `DoCursorLog` in the object's SQLite storage when the class is SQLite-backed (`new_sqlite_classes`), in memory otherwise (`new_classes`).
73
+ - `LiveModule` in the Worker defaults to `durableObjectLive()`: an invalidation goes to the room Durable Object of the application's single binding-backed gateway, and the namespace is read from `ENV` when an invalidation first needs it. The gateways come from their decorators, so an invalidation sent from `onModuleInit` or `onApplicationBootstrap` reaches the room as well. The first invalidation fails with an ambiguity error only when several binding-backed gateways could hold the subscriptions. `durableObjectLive({ binding, gatewayPath, defaultRoom })` chooses; every option is optional. A Worker configured with `localLive()` still warns once.
74
+ - `createCloudflareWorker(AppModule, { configure(app, env) {} })` finishes each application's HTTP surface, such as extra Hono routes, once per environment. It runs after the application is built and before any event, including concurrent cold events, reaches it. A throw fails that construction, and the next event retries. It must be synchronous and do no I/O; a `configure` that returns a promise fails construction.
75
+ - A minimal `createCloudflareWorker()` Worker no longer bundles the core WebSocket upgrade routes, the gateway dispatcher or the live protocol. It still carries the adapter's own wiring: the Worker transport that forwards upgrades to a room's Durable Object, the default `durableObjectLive()` driver and the check for gateways without `WebSocketModule`. The adapter reads the Cloudflare-attested `cf-connecting-ip` header directly, which also keeps Hono's WebSocket upgrade helper out. With the rest of this release, including the single HTTP error renderer, gateway scoping and framework CORS, a minimal `createCloudflareWorker()` Worker measures 155,636 bytes raw and 52,363 bytes gzipped, against 159,520 and 53,539 for 1.30.0.
76
+
77
+ **Behavior change:** `CloudflareWebSocketModule` is removed. Import `WebSocketModule.forRoot()` from `@velajs/vela/websocket` in the Worker and the Durable Object alike. Without it, the Worker mounts no upgrade route, so a binding-backed gateway's upgrades answer 404 instead of reaching its Durable Object; the adapter reports each such gateway through the diagnostics policy, a warning by default. The `WsGatewayRoute` type and `CloudflareApplication.scanInstances()` and `getWsGatewayRoutes()` are removed with it: the upgrade routes come from `WebSocketModule`.
78
+
79
+ **Behavior change:** `durableObjectLive()` takes the binding name, not the namespace object: replace `durableObjectLive({ namespace: env.ROOMS, gatewayPath })` with `durableObjectLive({ binding: 'ROOMS', gatewayPath })`, or drop the `driver` option to use the default. `LiveModule` no longer needs `forRootAsync({ inject: [ENV] })` for the driver. A Worker that imports `LiveModule` but declares no binding-backed gateway no longer falls back to `localLive()`: each invalidation rejects with "no @WebSocketGateway names a binding". A write through `@Crud({ live })`, or one that calls `LiveInvalidation.invalidate()` itself, commits and then returns that error; a `@LiveInvalidates` handler answers with its result, without commit headers, and reports the error through the application's error reporter (`edge: 'live'`). Declare the gateway, or configure `LiveModule.forRoot({ driver: () => localLive() })` explicitly. `durableObjectCursorLog()` is removed; drop the `log` option, since the adapter supplies the SQLite log inside the Durable Object. `new DoCursorLog(sql, maxRows?)` takes the SQLite handle.
80
+
81
+ **Behavior change:** the `middleware: (env) => handlers` option of `createCloudflareWorker` and `createCloudflareApp` is removed. Apply request middleware from a module with `configure(consumer)`; a consumer middleware class resolves through dependency injection, so it can inject `ENV` with `@InjectEnv()`. Use `configure(app, env)` for routes added to the Hono app. The `CloudflareAppOptions` type holds the options both entries share.
82
+ - 1011653: Bindings are referenced by name and resolved from each application's `ENV` when used. `@velajs/vela/module-kit` adds the seam: `BindingRef` (`{ binding: 'CACHE' }`), `BindingKind` (what a binding is and the configuration key that declares it), `resolveBinding(env, ref, kind)`, `defineBinding(kind)` for lower-camel binding factories, the `EnvFactory<T>` type for option values an application builds from its own `ENV`, and `readEnv(container)` for module providers. A missing binding fails with `ENV.CACHE is not set: declare the KV namespace binding 'CACHE' under kv_namespaces …`; a binding of another kind fails naming the same key.
83
+
84
+ `@velajs/cloudflare` exports the Workers binding factories built on it: `kv`, `r2`, `d1`, `queue`, `durableObject` and `rateLimit`. `kv({ binding: 'CACHE' })` reads no environment when declared; calling it with an application's `ENV` returns the typed native binding. The Cloudflare Queues driver and the Worker's gateway room objects (WebSocket upgrade forwarding, `Gateways` pushes, `durableObjectLive()` invalidations and `LiveInspector` reads) resolve their bindings through the same seam.
85
+
86
+ **Behavior change:** a send to a registered queue whose producer binding is missing or is not a producer rejects with `Queue 'email' cannot send: ENV.EMAIL_QUEUE is not set: …` (or `… is not a binding of type queue producer …`) instead of the previous wording. A WebSocket upgrade, `Gateways` push, `durableObjectLive()` invalidation or `LiveInspector` read whose gateway's Durable Object binding is missing or is not a namespace fails with `ENV.ROOMS is not set: declare the Durable Object namespace binding 'ROOMS' under durable_objects.bindings …` (or `… is not a binding of type Durable Object namespace …`); an upgrade reports that error through the application's error handler and answers with the redacted 500 body. Upgrades previously answered a plain-text 500 (`Durable Object binding 'ROOMS' is not configured`).
87
+ - 2c92243: `createCloudflareWorker()` attaches a descriptor under the symbol key `CLOUDFLARE_WORKER` (`Symbol.for('vela.cloudflare.worker')`) to the Worker it returns: `{ rootModule, options, createOptions(env), createApplication(env) }`. It is enumerable, so an entry that adds handlers with `{ ...worker, email }` keeps it; the platform reads only string-keyed handlers. `createOptions(env)` includes `env`, and `createApplication(env)` builds the application without the Worker handlers or the `configure(app, env)` hook, which receives the Workers application. Tools build the same application as the Worker from it without a platform event; `@velajs/cli` uses it to load a project without `vela.config`. The Worker is typed as the exported `CloudflareWorker` interface, and `CloudflareWorkerDescriptor` describes the descriptor.
88
+
89
+ The new `@velajs/cloudflare/testing` subpath runs inside the Workers Vitest pool. `createTestingWorker(AppModule, { env?, overrides?, ...workerOptions })` builds the module as `createCloudflareWorker(AppModule, workerOptions)` does, its adapters and then its `configure(app, env)` hook, through `@velajs/testing` (now an optional peer dependency), with `overrides` receiving the testing builder (`overrideProvider`, `overrideModule().useModule()`, `useMocker`). `worker.module` is the compiled `TestingModule`; its `fetch()` and `http` client send the Worker's environment as `c.env`. The returned worker's `fetch()`, `queue(queue, messages)` and `scheduled(cron)` drive the Worker handlers with `cloudflare:test`'s `createMessageBatch`, `getQueueResult` and `createScheduledController`: `queue()` reports the acknowledgements and whether the handler rejected, and `scheduled()` rejects a cron no `@Cron` job declares. `queueJob(queue, job, data)` builds the envelope `QueueClient.add()` sends, and `close()` cancels unread response bodies before waiting for background work. The subpath is not part of any Worker bundle.
90
+ - dfe925c: CORS is configured as in Nest. `app.enableCors(options?)` on `VelaApplication` and the `cors` create option (`VelaFactory.create(AppModule, { cors: true | CorsOptions })`) serve Hono's `cors` middleware ahead of body limits, routing and guards, so preflights are answered before any guard runs and refusals stay readable cross-origin. `enableCors` takes effect on the next request with no rebuild; a later call replaces the options. A credentialed `'*'` origin and a `maxAge` that is not a non-negative integer are rejected. `CorsOptions` is exported from `@velajs/vela`. On Workers, `createCloudflareWorker(AppModule, { cors })` and `createCloudflareApp(AppModule, { env, cors })` take the same option, and `CloudflareApplication.enableCors()` works inside `configure(app, env)`. Every application now carries Hono's `cors` middleware, and one pass-through middleware when CORS is off.
91
+
92
+ **Behavior change:** `CorsModule` and `CORS_OPTIONS` are removed from `@velajs/vela/security`, and `CorsOptions` moves from `@velajs/vela/security` to `@velajs/vela`. Replace `imports: [CorsModule.forRoot(options)]` with `app.enableCors(options)` or the `cors` create option; the options keep their shape (`origin`, `allowMethods`, `allowHeaders`, `exposeHeaders`, `credentials`, `maxAge`). Options `CorsModule` passed through unchecked now throw when CORS is enabled: `credentials: true` with a `'*'` origin (browsers refuse it) and a `maxAge` that is not a non-negative integer. CORS now runs ahead of the body and query limits and every global middleware instead of among the global middleware, so their refusals carry the CORS headers. Without `allowMethods`, a preflight now allows Nest's defaults (GET, HEAD, PUT, PATCH, POST, DELETE); `CorsModule` sent no `Access-Control-Allow-Methods` then, so browsers refused cross-origin PUT, PATCH and DELETE. `SecurityModule`'s exact-origin `cors` option is unchanged, but it can no longer be combined with framework CORS: while it is on (it is unless `cors: false`), the `cors` create option fails bootstrap and `app.enableCors()` throws, because that middleware would answer every preflight before `SecurityModule`'s method and header checks.
93
+ - fd11d20: Push to a gateway's rooms from anywhere with `Gateways`, injectable from `@velajs/vela/websocket` wherever `WebSocketModule` is imported: `gateways.of<ChatEvents>(ChatGateway).to(room).emit('message', data)`. The explicit event map (event name → payload) types each push; `to(room)` and `in(room)` chain rooms. The target comes from the gateway's `@WebSocketGateway` metadata (`path`, `binding`, `roomParam`), and each push is bounded by that gateway's `maxFrameBytes` before anything is resolved or sent. `emit()` without a room and `except()` throw with guidance, and a class without `@WebSocketGateway` is rejected. The handle types are `GatewayServer<Events>` and `GatewayBroadcastOperator<Events>`.
94
+
95
+ - A push reaches only that gateway's sockets on every runtime, so two gateways may use the same room id (such as an organization id) without one gateway's pushes reaching the other's sockets. `BroadcastCommand` gains an optional `gatewayPath`, which `Gateways` sets on every push and synchronized commands validate; `WsClient` gains an optional `path`, the gateway route the socket connected through (`NodeWsClient` and the Cloudflare client set it). The in-memory and Durable Object room registries deliver a command that names a gateway path only to sockets whose `path` matches, so a socket without one receives no gateway push or broadcast.
96
+ - A gateway's `@WebSocketServer()` is that gateway's own server, scoped the same way: on node, Bun and Deno its broadcasts, including a global `emit()`, carry the gateway path and reach only the sockets connected through that gateway, where they previously reached every gateway's sockets in the named rooms. This holds for `@Inject(WS_SERVER)` in a gateway's constructor and for a constructor inherited from a base class (each gateway gets its own server), and `afterInit(server)` receives the server that injected handle pushes through: pushes through either reach the same sockets, but they are not the same object. Each broadcast is bounded by the gateway's own `maxFrameBytes`. `WebSocketModule` connects each gateway's server while the application starts, before any lifecycle hook runs, from the `WS_SERVER` the gateway's module sees when it sees exactly one, including one provided by an async `useFactory`. When it sees none, or only the servers of several `WebSocketModule` instances it imports, a `WebSocketModule` instance's own server serves the gateway; a module that sees another module's `WS_SERVER` beside those fails bootstrap with an error naming each module that provides one. A test double provided as `WS_SERVER` in the gateway's module, or through `overrideProvider(WS_SERVER)` in a testing module, receives the gateway's pushes as long as `WebSocketModule.forRoot()` stays imported: a `WS_SERVER` without `WebSocketModule` connects nothing. `WS_SERVER` injected outside a gateway still addresses every gateway's sockets. `WsServer` gains an optional `forGateway(gatewayPath, maxFrameBytes)`, which `WsServerImpl` implements (and its constructor takes an optional `gatewayPath`); a transport server without it is shared by every gateway as before. On Cloudflare each Durable Object holds one gateway's room, so behavior there is unchanged.
97
+ - Presence rosters belong to one gateway room: heartbeats in a room of one gateway no longer appear in, or refresh, the `$presence.roster` of another gateway's room with the same id. `LiveQueryContext` gains `path`, the route path of the gateway the connection subscribed through, and a `@LiveQuery` tags function receives it as `(args, context)`. A `coalesceBy` partition is keyed by that path too, next to the query and its canonical args, so a resolver that answers per gateway never shares one run between subscribers of two gateways. `PresenceService.beat(gatewayPath, room, clientId, meta?)`, `PresenceService.roster(gatewayPath, room)` and `presenceTag(gatewayPath, room)` take the gateway path first; `inspectRooms()` still reports each room once, with the members of every gateway that uses its id. A roster's tag, `presenceTag(gatewayPath, room)`, is `$presence:` and the SHA-256 hex digest of the JSON `[gatewayPath, room]`, so every valid room id (up to 512 bytes) fits the 256-byte bound of an invalidation tag on any gateway path; room ids longer than 246 bytes previously failed the roster subscription. A heartbeat or departure whose roster invalidation the live driver fails to dispatch is reported through the application's error reporter instead of becoming an unhandled rejection.
98
+ - A custom `RoomRegistry` passed to `WebSocketModule.forRoot({ registry })` must skip sockets whose `path` differs from `cmd.gatewayPath` in `deliverLocal`, as the built-in registries do; one that ignores the field delivers every gateway push and broadcast to all gateways' sockets in the named rooms. With `redis()`, upgrade every instance together: instances on an earlier release ignore `gatewayPath` and deliver to every gateway's sockets in the room.
99
+ - Without a platform transport that delivers pushes, a push goes through the module's sync driver: in-process hosts (node, Bun, Deno) deliver it to the gateway's sockets in this process, and `redis()` fans it out to the gateway's sockets on every instance.
100
+ - A platform transport delivers pushes elsewhere with the new optional `WebSocketTransport.deliver(delivery)`, which receives one `GatewayDelivery` (`{ gatewayPath, binding?, room, command }`) per gateway room; a gateway without `roomParam` has one room, its path. A push delivered to several gateway rooms settles every delivery first; when some fail it rejects with an `AggregateError` whose message names the failed rooms (`2 of 3 ChatGateway room pushes failed: "b", "c"`; past ten rooms, the first ten and how many more) and whose `errors` hold one error per failed room with the transport's error as its `cause`, while a push delivered to one room rejects with the transport's own error. A transport that delivers pushes but builds no server gives gateways a `@WebSocketServer()` that keeps no sockets and refuses each push with guidance to `Gateways`. A transport that forwards upgrades (`forwardUpgrade`) but implements neither `deliver` nor `createServer` keeps a gateway with a `binding` out of this process's reach under the `local()` sync driver: a push to it, through `Gateways` or through its `@WebSocketServer()`, rejects with guidance instead of resolving without reaching anyone. A cross-instance sync driver such as `redis()` may reach the isolate that holds its sockets, so both push paths then hand it the command.
101
+ - On Cloudflare, a push from the Worker is a `broadcast` RPC to the gateway + room Durable Object, whose namespace is read by the gateway's `binding` from `ENV` when the push needs it. Inside a Durable Object, a push to its own room goes to its sockets, and a push to another room goes to that room's object instead of reaching no one. Pushing to a gateway without a `binding` fails with guidance.
102
+ - The `Gateways` service and the refusing server live in the core WebSocket entry, which a minimal `createCloudflareWorker()` Worker does not load, and upgrades, pushes and live invalidations share one gateway-room resolver.
103
+
104
+ **Behavior change:** a gateway's `@WebSocketServer()` no longer reaches other gateways' sockets, and it is no longer the `WS_SERVER` instance itself; a gateway that must address every gateway's sockets injects `WS_SERVER` into another provider. `WebSocketModule` connects a gateway's server: in an application or testing module without it, a `WS_SERVER` provided next to the gateway, or overridden with `overrideProvider(WS_SERVER)`, no longer reaches the gateway, whose pushes throw with guidance. Import `WebSocketModule.forRoot()`; a test double then serves the gateway when it is provided as `WS_SERVER` in the gateway's module or overridden in the testing module next to that import. A custom transport's `WsClient` must set `path` to its gateway's route: a socket without one receives no `Gateways` push and no broadcast from a gateway's `@WebSocketServer()`. `LiveQueryContext.path` is required, so code that builds a context, such as a resolver unit test, sets it; `PreparedLiveQuery.tags(context)` takes the subscribing connection's context. `PresenceService` methods and `presenceTag` take the gateway path first, and a presence tag is `$presence:` and a SHA-256 hex digest instead of the room id. `broadcastToRoom(namespace, gatewayPath, room, event, data, options?)` and its `BroadcastNamespace` type are removed from `@velajs/cloudflare`. Inject `Gateways` and call `gateways.of(Gateway).to(room).emit(event, data)`; the gateway's metadata supplies the namespace, path and frame limit.
105
+ - fd11d20: Add `@LiveInvalidates(tags, { room? })` to `@velajs/vela/live`. It runs as an interceptor on a handler: after the handler succeeds it invalidates the tags, static or derived from the result and the execution context (`(result, context) => tags`, where `[]` skips the invalidation), and stamps `Vela-Commit-Cursor` / `Vela-Commit-Epoch` on the handler's HTTP response through `switchToHttp().getResponse()`, or on a `Response` the handler returns. A mutation no longer needs `@Res()` and `stampCommitHeaders` to expose its commit. A handler that throws invalidates nothing. The interceptor resolves `LiveInvalidation` from the module that declares the controller before the handler runs, so a module that cannot reach `LiveModule` fails without committing the write. The tags callback's result type must match the handler's. An invalidation that fails after the handler has committed its write (a tags or room callback that throws, a live driver that cannot reach the room) does not fail the request: it is reported through the application's error reporter (`edge: 'live'`, `source` the handler's `Class.method`, note `invalidation failed after the handler succeeded`), and the request answers with the handler's result without commit headers, so the client drops its optimistic layer and subscribers catch up at the next invalidation of those tags. A failed response would invite a retry that repeats the committed write, which cannot repair the invalidation; keep write handlers idempotent, or accept an idempotency key, for clients that retry a request whose response they never received.
106
+
107
+ Add `LiveInspector`, provided and exported by `LiveModule`: `inspect(rooms)` returns the subscription and presence rows of the named rooms (there is no global room list), read where their subscriptions live. A runtime adapter reads a room through the new optional `LivePlatform.inspect(room)`; without it, the application's engine answers. On Cloudflare the Worker calls the room Durable Object's `inspectLive` RPC through the gateway binding its live driver delivers to. When several named rooms live in one object, each subscription is reported once and each room's members once. The `LiveInspection` type is unchanged. Studio's `livePanel({ rooms })` reads through it.
108
+
109
+ On Cloudflare, a gateway without `roomParam` keeps every socket in one room Durable Object, named by its path. Worker invalidations for such a gateway now go to that object whatever room they name, as upgrades and `Gateways` pushes do, instead of an object named by the room (`'default'` when none is named) that holds no sockets; `LiveInspector` reads follow the same rule. `liveInvalidateToRoom(namespace, gatewayPath, room, tags)` applies the same rule: for a gateway path without parameters it reaches the object named by the path. The Worker's live driver now validates the commit stamp a Durable Object returns before it reaches response headers.
110
+ - d51dbb3: `ThrottlerModule` takes Nest v5 named throttlers: `ThrottlerModule.forRoot({ throttlers: [{ name, ttl, limit }, ...], storage? })`. The global guard counts every request once per throttler, each in its own bucket (the key carries the throttler name), and answers 429 at the first one exceeded; later throttlers are not counted for that request. A throttler without `name` is `'default'`. Headers follow Nest: `X-RateLimit-Limit`, `-Remaining`, `-Reset` and `Retry-After` for `'default'`, suffixed `-<name>` for the others. The guard publishes its decisions under the `RATE_LIMIT` request-context key from `@velajs/vela/throttler`, one `RateLimitInfo` (`{ limit, remaining?, reset }`) per throttler name. `storage` also takes a function of the application's `ENV`, called once per application. Throttlers are validated when the application boots: at least one, unique names made of letters, digits, `_` or `-` (a Nest-style name such as `'per.minute'` fails), positive integer `ttl` (milliseconds) and `limit`. A store can check them too: `ThrottlerStore` gains an optional `validate(throttlers)`, called with the declared throttlers at bootstrap, so a store that cannot serve one fails the application instead of every request. The tracker is unchanged: the verified identity when one is published, else `getTracker` or the client IP.
111
+
112
+ `@velajs/cloudflare` adds `rateLimitStore({ binding })`, the `ThrottlerModule` storage over Workers Rate Limiting bindings resolved by name from each application's `ENV`: one binding for every throttler, or `{ binding: { burst: 'BURST_LIMITER', sustained: 'API_LIMITER' } }` per named throttler. Each binding's configured limit and period must equal its throttler's `limit` and `ttl` (10 or 60 seconds). The store declares `fixedLimits`, so a `@Throttle()` override that changes a throttler it serves fails the application at bootstrap instead of being silently ignored by the platform. One binding serves only throttlers that share a `limit` and `ttl`. The store checks the declared throttlers at bootstrap, before any binding is charged: a throttler whose `ttl` is not 10 or 60 seconds, throttlers with different values on one binding (the error names the per-throttler form), a throttler the per-name map leaves out, and a map entry naming no declared throttler each fail the application. Workers Rate Limiting counters are kept per Cloudflare location and are eventually consistent, so its limits are approximate, and `X-RateLimit-Reset` and `Retry-After` report the configured period rather than a measured reset.
113
+
114
+ **Behavior change:** `ThrottlerModule.forRoot({ limit, ttl })` is replaced by `forRoot({ throttlers: [{ limit, ttl }] })`. `@Throttle({ limit, ttl })` becomes `@Throttle({ default: { limit, ttl } })` (both fields optional, each a positive integer, checked when the decorator is applied), and `@SkipThrottle()` skips only the `'default'` throttler; use `@SkipThrottle({ name: true })` for a named one. As in Nest v5, `limit` and `ttl` override separately: a route's `@Throttle({ default: { limit } })` keeps its controller's `ttl`. A `@Throttle()` on a route or controller naming an undeclared throttler fails bootstrap. `ThrottlerStore.increment(key, ttl)` is now `increment(key, ttl, limit, throttlerName)`, `ThrottlerStorageRecord.enforcedLimit` is replaced by the store's `fixedLimits` flag, and `generateKey(tracker, { className, handlerName })` is now `generateKey(context, tracker, throttlerName)`. `THROTTLE_METADATA` and `SKIP_THROTTLE_METADATA` hold the whole decorator records.
115
+
116
+ **Behavior change:** `ThrottlerGuard` no longer sets the untyped `rateLimit` Hono variable. Its decisions are under the `RATE_LIMIT` request-context key, a record keyed by throttler name (`Readonly<Record<string, RateLimitInfo>>`): replace `c.get('rateLimit')` with `requestContext.get(RATE_LIMIT)?.default`. The default counter key gains the throttler name, `throttler:<Class>:<handler>:<name>:<tracker>` instead of `throttler:<Class>:<handler>:<tracker>`, so counts in a shared store restart after upgrading.
117
+
118
+ **Behavior change:** `cloudflareRateLimitStore(binding, { limit, periodSeconds })` and its `CloudflareRateLimitBinding` and `CloudflareRateLimitStoreOptions` types are removed. Use `storage: rateLimitStore({ binding: 'API_LIMITER' })` with a throttler whose `ttl` and `limit` match the binding.
119
+ - 4a06057: `CacheModule` from `@velajs/vela/cache` is the one cache module, asynchronous end to end and built on `defineModule` (`forRoot` and `forRootAsync`). `namespace` and the trusted `scope` resolver stay mandatory. `store` is optional: without it each application gets its own `MemoryCacheStore` of `max` entries (default 1000). `store` and `invalidation` also take a function of the application's `ENV`, called once per application, so a static registration serves every environment. `@CacheResponse({ ttl, tags, key })` caches GET routes and the injected `CacheService` serves `scope(trustedScope)` reads and post-commit invalidation over the same store. `CacheStore` is one interface whose methods may return values or promises, so memory, tiered and KV stores all fit it.
120
+
121
+ `@velajs/cloudflare` adds `kvCache({ binding })` and `kvCacheInvalidation({ binding })`: `CacheModule.forRoot({ namespace, scope, store: kvCache({ binding: 'CACHE' }), invalidation: kvCacheInvalidation({ binding: 'CACHE_GENERATIONS' }) })` reads each namespace from the application's `ENV` when an operation needs it, and names `kv_namespaces` when it is missing. `ErrorReportContext.edge` gains `'cache'`. `KVCacheStore` and `KVCacheInvalidationStore` accept a namespace or a function returning one.
122
+
123
+ **Behavior change:** the synchronous cache is removed: the former `CacheModule` (`ttl`, `max`, `isGlobal` registering its interceptor, `varyBy`, synchronous `store`), its `CacheService` (`get`/`set`/`del`/`clear`), `CacheInterceptor`, `@Cacheable()`, `@CacheKey()`, `@CacheTTL()`, `CACHE_MANAGER` and the `CACHEABLE_METADATA`, `CACHE_KEY_METADATA` and `CACHE_TTL_METADATA` keys. Replace `@Cacheable()` + `@CacheKey(key)` + `@CacheTTL(seconds)` with `@CacheResponse({ key, ttl })`, and manual `CacheService` calls with `cache.scope(scope).get/set/invalidateKey`. Credentialed routes that relied on `varyBy` select a private scope from trusted identity in `scope(context)` instead.
124
+
125
+ **Behavior change:** the asynchronous response cache takes the single names: `ResponseCacheModule` is `CacheModule`, `ResponseCacheService` is `CacheService`, `ResponseCacheInterceptor` is `CacheInterceptor`, `RESPONSE_CACHE_OPTIONS` is `CACHE_MODULE_OPTIONS`, and the types `ResponseCacheOptions`, `ResponseCacheScope`, `ResponseCacheEntryOptions` and `ScopedResponseCache` are `CacheModuleOptions`, `CacheScope`, `CacheEntryOptions` and `ScopedCache`. `AsyncCacheStore` and `AnyCacheStore` are replaced by `CacheStore`. Stored entries keep their keys, so existing KV caches stay valid. Configuring two `CacheModule`s in one application fails bootstrap, as two response-cache modules did.
126
+
127
+ **Behavior change:** a store, generation or scope failure the cache absorbs as a miss or a false outcome is now reported to the application's error reporter (edge `'cache'`, the operation as `source`): it is logged by default, or passed to the `ExceptionHandler`'s `report`. `onError` still receives it afterwards. A missing or misnamed KV binding is therefore visible on its first use instead of disabling the cache silently; match it in the handler's `dontReport` to mute it.
128
+ - 1bfc1c1: `StorageModule` from `@velajs/storage` is the one storage module. Its `driver` may be a function of the application's `ENV`, called on the first storage operation of each application, so one static `StorageModule.forRoot` serves every environment without reading a binding at boot. On Cloudflare Workers, `r2Storage({ binding: 'UPLOADS' })` from the new `@velajs/cloudflare/storage` subpath is its native R2 driver: the bucket is resolved by name from `ENV` and validated, and a missing binding fails the operation naming `r2_buckets`. `@velajs/storage` is an optional peer of `@velajs/cloudflare`, needed only by that subpath.
129
+
130
+ **Behavior change:** the Cloudflare `StorageModule` is removed, with `StorageService`, `StorageManagerService`, `StorageController`, `R2StorageDriver`, `STORAGE_OPTIONS` and the `StorageModuleOptions`, `DiskConfig` and `PresignedUrlConfig` types from `@velajs/cloudflare`. Register a `StorageModule.forRoot({ name, driver: r2Storage({ binding }) })` from `@velajs/storage` per former disk and inject its `StorageService` (`@InjectStorage(name)` for a named bucket). A disk's `root` becomes the bucket's `prefix`, which is static: the `{date}`, `{year}`, `{month}`, `{day}` and `{uuid}` tokens have no replacement, so build such keys in the application. Its HMAC presign-proxy route (`GET /storage/:disk`) is gone and URLs it issued stop working: serve downloads through `publicBaseUrl`, the authorized `http: { download: 'proxy' }` controller, or provider-signed URLs from the S3 or R2 HTTP/hybrid drivers.
131
+
132
+ **Behavior change:** the `@velajs/vela/storage` subpath is removed with the second `StorageDriver` contract, `expandPathTemplate` and `joinStoragePath` it held for that module, and `STORAGE_SIGNED_URL_PURPOSE` leaves `@velajs/vela/security`. Use `@velajs/storage`'s driver contract and key helpers (`joinKey`, `normalizePrefix`, `sanitizeKey`); `signUrl` and `verifySignedUrl` stay on `@velajs/vela/security` with an application-chosen `purpose`.
133
+ - f267c2f: Routes compose like Nest's `setGlobalPrefix(prefix, { exclude })` and URI versioning:
134
+
135
+ - `VelaFactory.create(AppModule, { globalPrefix: '/api', globalPrefixOptions: { exclude: ['health', { path: 'webhooks/:id', method: 'POST' }] } })` serves matching controller routes without the prefix. Targets use the middleware route grammar and match the controller path plus the route path. A relative middleware target resolves under the prefix, so startup fails when one also matches an excluded route that no absolute or controller target of the same middleware covers or excludes. `RouteManager.setGlobalPrefix(prefix, { exclude })` takes the same options, and `createCloudflareWorker`/`createCloudflareApp` pass them through.
136
+ - `VERSION_NEUTRAL` serves a controller or route without a version segment; combine it with numbers (`@Version([2, VERSION_NEUTRAL])`) to serve both.
137
+ - `versioning: { prefix }` sets the text before the version number (default `'v'`; `false` serves `/1/...`).
138
+ - `app.getRoutePathOptions()` returns this composition; pass it to `createOpenApiDocument(AppModule, app.getRoutePathOptions())` so documents match the served paths. The CLI's OpenAPI and client commands and Studio's OpenAPI view use it, and route contributors receive it as `routePathOptions`.
139
+
140
+ **Behavior change:** With a global prefix, startup fails for any relative `forRoutes()` target that reaches prefixed routes while its written path also matches a route registered outside the prefix, not only a route `exclude` serves unprefixed. An adapter's absolute route counts too: under `globalPrefix: '/api'`, `forRoutes(':resource')` also matches the `RpcModule` endpoint `POST /rpc`, so startup fails. Previously the build failed only when such a target reached no prefixed route at all. Cover the outside route in the same `forRoutes()` with an absolute target (`{ path: '/rpc', absolute: true }`) or its controller, or leave it out with an absolute `exclude()`. An absolute target or exclude accounts only for the outside routes it matches itself: with both `RpcModule` and an excluded `health` route, `forRoutes(':resource', { path: '/rpc', absolute: true })` still fails startup for `GET /health` until that route is covered or excluded too.
141
+
142
+ ### Patch Changes
143
+
144
+ - Updated dependencies [0b8c649]
145
+ - Updated dependencies [1011653]
146
+ - Updated dependencies [088f4d4]
147
+ - Updated dependencies [f267c2f]
148
+ - Updated dependencies [dfe925c]
149
+ - Updated dependencies [b227d22]
150
+ - Updated dependencies [fd11d20]
151
+ - Updated dependencies [748e4f8]
152
+ - Updated dependencies [096e259]
153
+ - Updated dependencies [3fc6f2b]
154
+ - Updated dependencies [fd11d20]
155
+ - Updated dependencies [3418c55]
156
+ - Updated dependencies [fd11d20]
157
+ - Updated dependencies [d51dbb3]
158
+ - Updated dependencies [f267c2f]
159
+ - Updated dependencies [4a06057]
160
+ - Updated dependencies [f267c2f]
161
+ - Updated dependencies [1bfc1c1]
162
+ - Updated dependencies [f267c2f]
163
+ - Updated dependencies [f267c2f]
164
+ - Updated dependencies [1ef55ac]
165
+ - Updated dependencies [b227d22]
166
+ - Updated dependencies [05bbfdf]
167
+ - Updated dependencies [3fc6f2b]
168
+ - Updated dependencies [2c92243]
169
+ - Updated dependencies [f267c2f]
170
+ - Updated dependencies [b227d22]
171
+ - Updated dependencies [2c92243]
172
+ - @velajs/vela@1.31.0
173
+ - @velajs/feature-flags@1.31.0
174
+ - @velajs/storage@1.31.0
175
+ - @velajs/testing@1.31.0
176
+
3
177
  ## 1.30.0
4
178
 
5
179
  ### Minor Changes