@rivetkit/cloudflare-workers 0.9.8 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mod.cjs +59 -66
- package/dist/mod.cjs.map +1 -1
- package/dist/mod.d.cts +19 -6
- package/dist/mod.d.ts +19 -6
- package/dist/mod.js +59 -66
- package/dist/mod.js.map +1 -1
- package/package.json +2 -2
- package/src/actor-driver.ts +4 -5
- package/src/actor-handler-do.ts +44 -49
- package/src/handler.ts +3 -8
- package/src/manager-driver.ts +0 -1
- package/src/mod.ts +1 -0
package/src/handler.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { env } from "cloudflare:workers";
|
|
2
2
|
import type { Registry, RunConfig } from "@rivetkit/core";
|
|
3
3
|
import type { Client } from "@rivetkit/core/client";
|
|
4
4
|
import { Hono } from "hono";
|
|
5
|
-
import invariant from "invariant";
|
|
6
5
|
import {
|
|
7
6
|
type ActorHandlerInterface,
|
|
8
7
|
createActorDurableObject,
|
|
@@ -23,12 +22,8 @@ export interface Bindings {
|
|
|
23
22
|
*
|
|
24
23
|
* Use getCloudflareAmbientEnv unless using CF_AMBIENT_ENV.run.
|
|
25
24
|
*/
|
|
26
|
-
export const CF_AMBIENT_ENV = new AsyncLocalStorage<Bindings>();
|
|
27
|
-
|
|
28
25
|
export function getCloudflareAmbientEnv(): Bindings {
|
|
29
|
-
|
|
30
|
-
invariant(env, "missing CF_AMBIENT_ENV");
|
|
31
|
-
return env;
|
|
26
|
+
return env as unknown as Bindings;
|
|
32
27
|
}
|
|
33
28
|
|
|
34
29
|
interface Handler {
|
|
@@ -87,7 +82,7 @@ export function createServer<R extends Registry<any>>(
|
|
|
87
82
|
// Create Cloudflare handler
|
|
88
83
|
const handler = {
|
|
89
84
|
fetch: (request, env, ctx) => {
|
|
90
|
-
return
|
|
85
|
+
return app.fetch(request, env, ctx);
|
|
91
86
|
},
|
|
92
87
|
} satisfies ExportedHandler<Bindings>;
|
|
93
88
|
|
package/src/manager-driver.ts
CHANGED
package/src/mod.ts
CHANGED