@junejs/server 0.1.0 → 0.1.1

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.
@@ -2,12 +2,13 @@ import { Channel, ChannelFactory } from "@junejs/core/agent-config";
2
2
  import { Model, Msg, SessionStore, Tool } from "@junejs/core/agent-runtime";
3
3
  import { Resources } from "@junejs/core/resources";
4
4
  //#region src/agent-durable.d.ts
5
- interface SqlStorageCursor<T = Record<string, unknown>> {
5
+ type SqlStorageValue = ArrayBuffer | string | number | null;
6
+ interface SqlStorageCursor<T extends Record<string, SqlStorageValue> = Record<string, SqlStorageValue>> {
6
7
  toArray(): T[];
7
8
  one(): T;
8
9
  }
9
10
  interface SqlStorage {
10
- exec<T = Record<string, unknown>>(query: string, ...bindings: unknown[]): SqlStorageCursor<T>;
11
+ exec<T extends Record<string, SqlStorageValue> = Record<string, SqlStorageValue>>(query: string, ...bindings: unknown[]): SqlStorageCursor<T>;
11
12
  }
12
13
  interface DurableStorage {
13
14
  sql: SqlStorage;
@@ -69,4 +70,4 @@ declare function durableChannelSurface(getNamespace: () => DurableObjectNamespac
69
70
  waitUntil?: (p: Promise<unknown>) => void;
70
71
  }): (req: Request) => Promise<Response | null>;
71
72
  //#endregion
72
- export { AgentDurableObject, DoAgentDef, DoSessionStore, DurableObjectNamespace, DurableObjectState, DurableObjectStub, DurableStorage, SqlStorage, SqlStorageCursor, durableAgentSurface, durableChannelSurface, durableFetch };
73
+ export { AgentDurableObject, DoAgentDef, DoSessionStore, DurableObjectNamespace, DurableObjectState, DurableObjectStub, DurableStorage, SqlStorage, SqlStorageCursor, SqlStorageValue, durableAgentSurface, durableChannelSurface, durableFetch };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junejs/server",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "June host adapters + dev server. Host-coupled; depends on the pure @junejs/core contract layer.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -37,12 +37,23 @@ import {
37
37
  import { ensureScope, runInScope } from "@junejs/db";
38
38
 
39
39
  // ── minimal structural Cloudflare surface (no @cloudflare/workers-types dep) ──
40
- export interface SqlStorageCursor<T = Record<string, unknown>> {
40
+ // SqlStorage row values are exactly what workerd's SQLite returns. Mirroring
41
+ // @cloudflare/workers-types' `T extends Record<string, SqlStorageValue>` constraint
42
+ // STRUCTURALLY (not importing it) makes `this.ctx.storage` directly assignable to
43
+ // these interfaces, so a DO shell needs no `as unknown as JuneDoState` cast. The
44
+ // constraint (not just a default) is what lets the two `exec` signatures unify:
45
+ // an unconstrained `T` promises `toArray(): T[]` for arbitrary T, which workerd's
46
+ // cursor — only ever `Record<string, SqlStorageValue>` rows — cannot satisfy.
47
+ export type SqlStorageValue = ArrayBuffer | string | number | null;
48
+ export interface SqlStorageCursor<T extends Record<string, SqlStorageValue> = Record<string, SqlStorageValue>> {
41
49
  toArray(): T[];
42
50
  one(): T;
43
51
  }
44
52
  export interface SqlStorage {
45
- exec<T = Record<string, unknown>>(query: string, ...bindings: unknown[]): SqlStorageCursor<T>;
53
+ exec<T extends Record<string, SqlStorageValue> = Record<string, SqlStorageValue>>(
54
+ query: string,
55
+ ...bindings: unknown[]
56
+ ): SqlStorageCursor<T>;
46
57
  }
47
58
  export interface DurableStorage {
48
59
  sql: SqlStorage;