ziex 0.1.0-dev.1466 → 0.1.0-dev.1568

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ziex",
3
- "version": "0.1.0-dev.1466",
3
+ "version": "0.1.0-dev.1568",
4
4
  "types": "index.d.ts",
5
5
  "description": "Ziex is a framework for building web applications with Zig.",
6
6
  "main": "index.js",
@@ -40,7 +40,7 @@
40
40
  "license": "MIT",
41
41
  "scripts": {},
42
42
  "dependencies": {
43
- "@ziex/cli": "0.1.0-dev.1466"
43
+ "@ziex/cli": "0.1.0-dev.1568"
44
44
  },
45
45
  "module": "index.js"
46
46
  }
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * @example API Gateway v2 (HTTP API)
7
7
  * ```ts
8
- * import { Ziex } from "ziex/cloudflare";
8
+ * import { Ziex } from "ziex";
9
9
  * import { handle } from "ziex/aws-lambda";
10
10
  * import module from "./app.wasm";
11
11
  *
@@ -1,2 +1,32 @@
1
+ import { Ziex, type StickyKey } from "../../app";
1
2
  export { Ziex, resolveModule } from "../../app";
2
- export type { WasmInput } from "../../app";
3
+ export type { WasmInput, ZiexOptions, StickyKey } from "../../app";
4
+ export type StatefulOptions<Env> = {
5
+ /** Env binding for sticky long-lived fetch (must match wrangler `durable_objects.bindings`). */
6
+ binding: StickyKey<Env>;
7
+ };
8
+ /**
9
+ * Sticky long-lived fetch class for Cloudflare (WebSocket upgrades + pub/sub).
10
+ *
11
+ * Reuses the app's module/kv/db/imports and registers the env binding for upgrade forwarding.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import { Ziex } from "ziex";
16
+ * import { stateful } from "ziex/cloudflare";
17
+ *
18
+ * const app = new Ziex<Env>({ module, kv: "KV", db: "DB" });
19
+ * export const ChatRoom = stateful(app, { binding: "CHAT_ROOM" });
20
+ * export default app;
21
+ * ```
22
+ */
23
+ export declare function stateful<Env>(app: Ziex<Env>, options: StatefulOptions<Env>): {
24
+ new (state: any, env: any): {
25
+ readonly state: any;
26
+ readonly env: any;
27
+ readonly connections: Map<WebSocket, import("./worker").WsState & {
28
+ topics: Set<string>;
29
+ }>;
30
+ fetch(request: Request): Promise<Response>;
31
+ };
32
+ };
@@ -1,4 +1,5 @@
1
- export * as worker from "../../runtime";
2
- export * as kv from "../../runtime/kv";
3
- export { Ziex } from "../../app";
4
- export { createWebSocketDO } from "./do";
1
+ export { createKVImports, createBrowserKVBindings, hasJspi, } from "../../runtime/kv";
2
+ export type { KVNamespace, SyncKVNamespace, BrowserKVOptions, } from "../../runtime/kv";
3
+ export { get, put, del, list } from "../../runtime/kv/memory";
4
+ export { Ziex, resolveModule, stateful } from "./app";
5
+ export type { WasmInput, ZiexOptions, StickyKey, StatefulOptions } from "./app";