@lunora/codegen 1.0.0-alpha.241 → 1.0.0-alpha.243

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 (30) hide show
  1. package/dist/index.d.mts +108 -58
  2. package/dist/index.d.ts +108 -58
  3. package/dist/index.mjs +1 -1
  4. package/dist/packem_shared/AGENTS_FILENAME-Bb2jxbOa.mjs +1 -0
  5. package/dist/packem_shared/CONTAINERS_FILENAME-CGB4bqUr.mjs +1 -0
  6. package/dist/packem_shared/DEFAULT_TARGET-wK6-Tado.mjs +1 -0
  7. package/dist/packem_shared/QUEUES_FILENAME-BzOl92QK.mjs +1 -0
  8. package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-DX6sZtLG.mjs +9 -0
  9. package/dist/packem_shared/WORKFLOWS_FILENAME-DNaUHGS8.mjs +1 -0
  10. package/dist/packem_shared/{discoverCrons-MfKw7IFf.mjs → discoverCrons-0lNudk0S.mjs} +1 -1
  11. package/dist/packem_shared/emitAgents-C3ygr0M8.mjs +1 -0
  12. package/dist/packem_shared/{emitApi-CJ9ziZnP.mjs → emitApi-DdW9RyGG.mjs} +22 -22
  13. package/dist/packem_shared/{emitApp-CgXCWBms.mjs → emitApp-D_9NVcvv.mjs} +2 -2
  14. package/dist/packem_shared/{emitCrons-BP2xBXDJ.mjs → emitCrons-BRKXFGFu.mjs} +11 -11
  15. package/dist/packem_shared/{emitFunctions-BqAz1ssY.mjs → emitFunctions-BgNeOZt_.mjs} +1 -1
  16. package/dist/packem_shared/{emitServer-BEo_fCY8.mjs → emitServer-pF_fhA82.mjs} +54 -52
  17. package/dist/packem_shared/emitShard-DID_s1FK.mjs +1 -0
  18. package/dist/packem_shared/ir-DBSvhNa-.mjs +1 -0
  19. package/dist/packem_shared/{shard-BaHiawkc.mjs → shard-BVzXMtWg.mjs} +67 -67
  20. package/dist/packem_shared/{shard-runtime-B5SUfdZB.mjs → shard-runtime-oIXHEMU7.mjs} +53 -44
  21. package/package.json +10 -10
  22. package/dist/packem_shared/AGENTS_FILENAME-DoPI92Wu.mjs +0 -1
  23. package/dist/packem_shared/CONTAINERS_FILENAME-B6TFs82W.mjs +0 -1
  24. package/dist/packem_shared/DEFAULT_TARGET-DCpDuuUM.mjs +0 -1
  25. package/dist/packem_shared/QUEUES_FILENAME-CxkPcMH1.mjs +0 -1
  26. package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-CtkD-vQu.mjs +0 -9
  27. package/dist/packem_shared/WORKFLOWS_FILENAME-B_ZJxRSx.mjs +0 -1
  28. package/dist/packem_shared/emitAgents-CoNw0AKK.mjs +0 -1
  29. package/dist/packem_shared/emitShard-DFgzghbs.mjs +0 -1
  30. package/dist/packem_shared/ir-BgM8A3XV.mjs +0 -1
@@ -1,4 +1,4 @@
1
- import{A as w}from"./capabilities-DJJWVEtk.mjs";import{i as k}from"./ir-BgM8A3XV.mjs";import{G as S}from"./shared-DjUziztz.mjs";const E=e=>`has${e.charAt(0).toUpperCase()}${e.slice(1)}`,g=w.map(({appMethod:e,key:t})=>[E(t),e.method,e.configKey,e.doc]),m=e=>g.some(([t])=>e[t]),D=e=>e?['import * as lunoraIdentityContract from "../identity.js";']:[],R=(e,t)=>e?['import type { CreateAccessResolverOptions } from "@lunora/cloudflare-access";',`import { createAccessResolver${t?", composeResolvers":""} } from "@lunora/cloudflare-access";`]:[],x=e=>e?['import { createKvIntrospectorFromEnv } from "@lunora/bindings/kv";']:[],A=e=>e?['import { createVectorAdminIntrospector } from "@lunora/bindings/vectors";']:[],C=e=>e?['import type { D1CtxDbOptions, D1DatabaseLike, D1Exec } from "@lunora/d1";','import { applyCdcChanges, createD1CtxDb, emitD1QueryCost, exportGlobalRows, facetGlobalColumn, importGlobalRows, listGlobalTables, readD1CdcChanges, readGlobalTablePage, retryingExec } from "@lunora/d1";']:[],O=e=>e?['import notifyConfig from "../notify.js";']:[],v=e=>(e.emailAgents?.length??0)>0,T=e=>v(e)?['import { dispatchAgentEmail } from "@lunora/agent/inbound";']:[],N=e=>v(e)?['import * as lunoraAgentDefinitions from "../agents.js";']:[],d=e=>e.tables.some(t=>k(t)),I=e=>{const{hasFramework:t,hasGlobal:r,hasHyperdriveGlobal:a,hasQueue:n,useUmbrella:i}=e,o=i?"lunorash/runtime":"@lunora/runtime",l=["ExecutionContextLike","HttpRouterLike","LunoraWorker","Route","ScheduledControllerLike","ShardNamespaceLike","WorkerOptions",...n?["TriggerTrace"]:[],...r?["GlobalIntrospector"]:[],...e.tables.length>0?["ShardingInfo"]:[],...t?["FrameworkHostHandler"]:[]],s=[...r||a?["createCrossShardRelationCapabilities"]:[],...d(e)?["createDynamicShardRegistry","createQueryCoordinator"]:[],"createWorker",...e.jurisdiction?["declareAppJurisdiction"]:[],"resolveLogArchiveFromEnv",...t?["withFrameworkWorker"]:[]].join(", ");return[`import type { ${[...l].toSorted((c,h)=>c.localeCompare(h)).join(", ")} } from "${o}";`,`import { ${s} } from "${o}";`]},L=e=>{const{hasAccess:t,hasAuth:r,hasGlobal:a,hasHyperdriveGlobal:n,hasKvIntrospector:i,hasQueue:o,hasScheduler:l,hasStorage:s,hasWorkflow:c,wantsOpenApi:h,wantsOpenRpc:u}=e;return[...r?['import type { AuthNamespaceLike, LunoraAuth, LunoraAuthOptions } from "@lunora/auth";','import { createAuth, createAuthAdmin, createAuthAuditReader, createDoAuthWiring, d1Executor, ensureMigrated, handleAuthRequest, lunoraD1Adapter } from "@lunora/auth";']:[],...R(t,r),...C(a),...n?['import type { HyperdriveEngine } from "@lunora/hyperdrive/global";','import { createHyperdriveGlobalCtxDb } from "@lunora/hyperdrive/global";','import type { SqlCtxDbOptions, SqlExec } from "@lunora/sql-store";']:[],...x(i),...A(e.hasVectors===!0),...l?['import type { DurableObjectNamespaceLike } from "@lunora/scheduler";','import { createScheduler } from "@lunora/scheduler";']:[],...s?['import type { R2BucketLike, R2S3Credentials, Storage } from "@lunora/storage";','import { createBucketStorage, createStorage } from "@lunora/storage";']:[],...c?['import { createWorkflowsRestClient } from "@lunora/workflow";']:[],...T(e),...I(e),"",...D(e.identity),...N(e),...a||n?['import schema from "../schema.js";']:[],...O(e.hasNotify),'import { LUNORA_CRONS } from "./crons.js";','import { LUNORA_FUNCTIONS } from "./functions.js";',...o?['import { createQueueCaptureSink, dispatchQueueBatch, shouldCaptureQueue } from "@lunora/queue";','import { LUNORA_QUEUE_REGISTRY } from "./queues.js";']:[],...h?['import { openApiSpec } from "./openapi.js";']:[],...u?['import { openRpcSpec } from "./openrpc.js";']:[],'import { createShardDO } from "./shard.js";',...e.hasVectors===!0?['import { LUNORA_VECTOR_INDEXES } from "./vectors.js";']:[]]},q=e=>[...e.hasStorage?["/** `.storage(...)` declaration — one bucket (required) plus optional extra named buckets and signed-URL config. Backs `ctx.storage` AND the studio file browser. */\ninterface StorageDeclaration<Env> {\n /** The default R2 bucket binding (the bare `ctx.storage`). */\n bucket: Selector<Env, R2BucketLike>;\n /** Extra named buckets, reached via `ctx.storage.bucket(\"name\")` and the studio's bucket picker. */\n buckets?: Record<string, Selector<Env, R2BucketLike>>;\n /** Public base URL signed/public object URLs resolve against. Omit it and `ctx.storage` in a mutation, action or HTTP handler (and the studio's copy-URL) signs against the origin the request reached the worker on — no per-environment value to ship. Queries get no such fallback (a live query re-runs with no request behind it), so a query that signs URLs needs this set. */\n publicBaseUrl?: Selector<Env, string>;\n /** R2 S3-API credentials (`{ accountId, accessKeyId, secretAccessKey, bucket, jurisdiction? }`) enabling `ctx.storage.getPresignedUrl` — native S3 presigned URLs that hit R2 directly, bypassing the worker. Omit to use only the worker-signed `getSignedUrl` path. */\n s3?: Selector<Env, R2S3Credentials>;\n /** HMAC secret for signed URLs. */\n signingSecret?: Selector<Env, string>;\n}"]:[],...e.hasScheduler?["/** `.scheduler(...)` declaration — the `SchedulerDO` namespace. Backs `ctx.scheduler` AND the studio's scheduled-jobs view. The origin its callbacks dispatch back to is not declared here: the DO reads `env.LUNORA_ORIGIN_URL` at fire time, because a caller-supplied dispatch target would be an SSRF vector. */\ninterface SchedulerDeclaration<Env> {\n /** The `SchedulerDO` namespace binding (typically `env.SCHEDULER`). */\n namespace: Selector<Env, DurableObjectNamespaceLike & ShardNamespaceLike>;\n}"]:[],...e.hasGlobal?["/** `.global(...)` declaration — the D1 binding backing `.global()` tables. Backs cross-tenant `ctx.db` reads/writes AND the studio's global data browser. */\ninterface GlobalDeclaration<Env> {\n /** The D1 binding (typically `env.DB`). */\n d1: Selector<Env, D1DatabaseLike>;\n /** The worker origin used to fan reverse cross-backend relations across shards. Without it, such a relation throws a clear error. */\n origin?: Selector<Env, string>;\n}"]:[],...e.hasHyperdriveGlobal?['/** `.hyperdriveGlobal(...)` declaration — backs `.global({ backend: "hyperdrive" })` tables on a Postgres/MySQL database via Hyperdrive. Stays reactive: the writer is injected as `globalDb` and the broadcast hook drives live queries. */\ninterface HyperdriveGlobalDeclaration<Env> {\n /** The Hyperdrive engine — selects the Postgres or MySQL dialect. */\n engine: HyperdriveEngine;\n /** Build the `SqlExec` from `env` — e.g. `buildPgExec(fromPostgresJs(postgres(env.HYPERDRIVE.connectionString)))`. Cache the driver on the DO instance; rebuild lazily after hibernation. */\n exec: (env: Env) => SqlExec;\n /** The worker origin used to fan reverse cross-backend relations across shards. Without it, such a relation throws a clear error. */\n origin?: Selector<Env, string>;\n}']:[],...e.hasAuth?['/** `.auth(...)` declaration — better-auth options plus the storage the adapter reads. Give it `d1` (the default) or `namespace` (a Durable Object that hosts the auth tables), never both. The builder owns the lazy build + `ensureMigrated` dance and wires `authHandler` / `resolveIdentity` / `authAdmin`. */\ninterface AuthDeclaration<Env> {\n /** The D1 binding the auth SQL adapter is wired over (via `lunoraD1Adapter`). Omit only when using `namespace`. */\n d1?: Selector<Env, unknown>;\n /** Shared secret the worker presents on the object\'s internal session route. REQUIRED with `namespace`: the binding is reachable from any worker bound to it, so the secret — not the binding — is the authorization boundary. Without it identity resolution fails closed. */\n internalSecret?: Selector<Env, string>;\n /** Name of the Durable Object instance holding the auth tables. Defaults to `"auth"`. Set it to run separate auth objects (per deployment, per tenant) off one namespace. */\n objectName?: Selector<Env, string>;\n /** The auth Durable Object namespace — the DO-backed mode. Needed for `@better-auth/scim`, which requires native transactions that D1 has none of. The object owns the auth tables, so `/api/auth/*` and identity resolution both go through it. Typed as `AuthNamespaceLike` because `createDoAuthWiring` resolves through `idFromName` + `get` and has no `getByName` fallback — both members are load-bearing here, and `ShardNamespaceLike` leaves both optional. */\n namespace?: Selector<Env, AuthNamespaceLike>;\n /** Build the better-auth options from `env` (secret, plugins, email/password, …). */\n options: (env: Env) => LunoraAuthOptions;\n}']:[]],j=e=>[...e.hasAccess?[" private accessSelector?: Selector<Env, CreateAccessResolverOptions | undefined>;"]:[]," private adminToken?: Selector<Env, string>;",...e.hasAuth?[" private authDeclaration?: AuthDeclaration<Env>;"]:[]," private cdcEnabled = false;"," private reactiveCacheConfig: boolean | { maxBytes?: number; maxEntries?: number } = false;",' private maxRelationKeysLimit?: ShardConfig["maxRelationKeys"];',' private observabilitySink?: ShardConfig["observability"];',' private relationExistsPushDownMode?: ShardConfig["relationExistsPushDown"];'," private readonly extendFns: ((env: Env, derived: Readonly<WorkerOptions>) => Partial<WorkerOptions>)[] = [];",...e.hasGlobal?[" private globalDeclaration?: GlobalDeclaration<Env>;"]:[],...e.hasHyperdriveGlobal?[" private hyperdriveGlobalDeclaration?: HyperdriveGlobalDeclaration<Env>;"]:[]," private httpRouterApp?: HttpRouterLike;"," private readonly routeMap: Record<string, Route> = {};",...e.hasScheduler?[" private schedulerDeclaration?: SchedulerDeclaration<Env>;"]:[],...m(e)?[" private readonly shardExtras: Partial<ShardConfig> = {};"]:[],...d(e)?[" private shardRegistrySelector?: Selector<Env, ShardNamespaceLike>;"]:[]," private shardSelector?: Selector<Env, ShardNamespaceLike>;",...e.hasSourcedTables?[' private sourceClientFactory?: NonNullable<ShardConfig["sourceClient"]>;']:[],...e.hasStorage?[" private storageDeclaration?: StorageDeclaration<Env>;"]:[]],G=e=>g.filter(([t])=>e[t]).map(([,t,r,a])=>` /** ${a} */
1
+ import{A as w}from"./capabilities-DJJWVEtk.mjs";import{i as k}from"./ir-DBSvhNa-.mjs";import{G as S}from"./shared-DjUziztz.mjs";const E=e=>`has${e.charAt(0).toUpperCase()}${e.slice(1)}`,g=w.map(({appMethod:e,key:t})=>[E(t),e.method,e.configKey,e.doc]),m=e=>g.some(([t])=>e[t]),D=e=>e?['import * as lunoraIdentityContract from "../identity.js";']:[],R=(e,t)=>e?['import type { CreateAccessResolverOptions } from "@lunora/cloudflare-access";',`import { createAccessResolver${t?", composeResolvers":""} } from "@lunora/cloudflare-access";`]:[],x=e=>e?['import { createKvIntrospectorFromEnv } from "@lunora/bindings/kv";']:[],A=e=>e?['import { createVectorAdminIntrospector } from "@lunora/bindings/vectors";']:[],C=e=>e?['import type { D1CtxDbOptions, D1DatabaseLike, D1Exec } from "@lunora/d1";','import { applyCdcChanges, createD1CtxDb, emitD1QueryCost, exportGlobalRows, facetGlobalColumn, importGlobalRows, listGlobalTables, readD1CdcChanges, readGlobalTablePage, retryingExec } from "@lunora/d1";']:[],O=e=>e?['import notifyConfig from "../notify.js";']:[],v=e=>(e.emailAgents?.length??0)>0,T=e=>v(e)?['import { dispatchAgentEmail } from "@lunora/agent/inbound";']:[],N=e=>v(e)?['import * as lunoraAgentDefinitions from "../agents.js";']:[],d=e=>e.tables.some(t=>k(t)),I=e=>{const{hasFramework:t,hasGlobal:r,hasHyperdriveGlobal:a,hasQueue:n,useUmbrella:i}=e,o=i?"lunorash/runtime":"@lunora/runtime",l=["ExecutionContextLike","HttpRouterLike","LunoraWorker","Route","ScheduledControllerLike","ShardNamespaceLike","WorkerOptions",...n?["TriggerTrace"]:[],...r?["GlobalIntrospector"]:[],...e.tables.length>0?["ShardingInfo"]:[],...t?["FrameworkHostHandler"]:[]],s=[...r||a?["createCrossShardRelationCapabilities"]:[],...d(e)?["createDynamicShardRegistry","createQueryCoordinator"]:[],"createWorker",...e.jurisdiction?["declareAppJurisdiction"]:[],"resolveLogArchiveFromEnv",...t?["withFrameworkWorker"]:[]].join(", ");return[`import type { ${[...l].toSorted((c,h)=>c.localeCompare(h)).join(", ")} } from "${o}";`,`import { ${s} } from "${o}";`]},L=e=>{const{hasAccess:t,hasAuth:r,hasGlobal:a,hasHyperdriveGlobal:n,hasKvIntrospector:i,hasQueue:o,hasScheduler:l,hasStorage:s,hasWorkflow:c,wantsOpenApi:h,wantsOpenRpc:u}=e;return[...r?['import type { AuthNamespaceLike, LunoraAuth, LunoraAuthOptions } from "@lunora/auth";','import { createAuth, createAuthAdmin, createAuthAuditReader, createDoAuthWiring, d1Executor, ensureMigrated, handleAuthRequest, lunoraD1Adapter } from "@lunora/auth";']:[],...R(t,r),...C(a),...n?['import type { HyperdriveEngine } from "@lunora/hyperdrive/global";','import { createHyperdriveGlobalCtxDb } from "@lunora/hyperdrive/global";','import type { SqlCtxDbOptions, SqlExec } from "@lunora/sql-store";']:[],...x(i),...A(e.hasVectors===!0),...l?['import type { DurableObjectNamespaceLike } from "@lunora/scheduler";','import { createScheduler } from "@lunora/scheduler";']:[],...s?['import type { R2BucketLike, R2S3Credentials, Storage } from "@lunora/storage";','import { createBucketStorage, createStorage } from "@lunora/storage";']:[],...c?['import { createWorkflowsRestClient } from "@lunora/workflow";']:[],...T(e),...I(e),"",...D(e.identity),...N(e),...a||n?['import schema from "../schema.js";']:[],...O(e.hasNotify),'import { LUNORA_CRONS } from "./crons.js";','import { LUNORA_FUNCTIONS } from "./functions.js";',...o?['import { createQueueCaptureSink, dispatchQueueBatch, shouldCaptureQueue } from "@lunora/queue";','import { LUNORA_QUEUE_REGISTRY } from "./queues.js";']:[],...h?['import { openApiSpec } from "./openapi.js";']:[],...u?['import { openRpcSpec } from "./openrpc.js";']:[],'import { createShardDO } from "./shard.js";',...e.hasVectors===!0?['import { LUNORA_VECTOR_INDEXES } from "./vectors.js";']:[]]},q=e=>[...e.hasStorage?["/** `.storage(...)` declaration — one bucket (required) plus optional extra named buckets and signed-URL config. Backs `ctx.storage` AND the studio file browser. */\ninterface StorageDeclaration<Env> {\n /** The default R2 bucket binding (the bare `ctx.storage`). */\n bucket: Selector<Env, R2BucketLike>;\n /** Extra named buckets, reached via `ctx.storage.bucket(\"name\")` and the studio's bucket picker. */\n buckets?: Record<string, Selector<Env, R2BucketLike>>;\n /** Public base URL signed/public object URLs resolve against. Omit it and `ctx.storage` in a mutation, action or HTTP handler (and the studio's copy-URL) signs against the origin the request reached the worker on — no per-environment value to ship. Queries get no such fallback (a live query re-runs with no request behind it), so a query that signs URLs needs this set. */\n publicBaseUrl?: Selector<Env, string>;\n /** R2 S3-API credentials (`{ accountId, accessKeyId, secretAccessKey, bucket, jurisdiction? }`) enabling `ctx.storage.getPresignedUrl` — native S3 presigned URLs that hit R2 directly, bypassing the worker. Omit to use only the worker-signed `getSignedUrl` path. */\n s3?: Selector<Env, R2S3Credentials>;\n /** HMAC secret for signed URLs. */\n signingSecret?: Selector<Env, string>;\n}"]:[],...e.hasScheduler?["/** `.scheduler(...)` declaration — the `SchedulerDO` namespace. Backs `ctx.scheduler` AND the studio's scheduled-jobs view. The origin its callbacks dispatch back to is not declared here: the DO reads `env.LUNORA_ORIGIN_URL` at fire time, because a caller-supplied dispatch target would be an SSRF vector. */\ninterface SchedulerDeclaration<Env> {\n /** The `SchedulerDO` namespace binding (typically `env.SCHEDULER`). */\n namespace: Selector<Env, DurableObjectNamespaceLike & ShardNamespaceLike>;\n}"]:[],...e.hasGlobal?["/** `.global(...)` declaration — the D1 binding backing `.global()` tables. Backs cross-tenant `ctx.db` reads/writes AND the studio's global data browser. */\ninterface GlobalDeclaration<Env> {\n /** The D1 binding (typically `env.DB`). */\n d1: Selector<Env, D1DatabaseLike>;\n /** The worker origin used to fan reverse cross-backend relations across shards. Without it, such a relation throws a clear error. */\n origin?: Selector<Env, string>;\n}"]:[],...e.hasHyperdriveGlobal?['/** `.hyperdriveGlobal(...)` declaration — backs `.global({ backend: "hyperdrive" })` tables on a Postgres/MySQL database via Hyperdrive. Stays reactive: the writer is injected as `globalDb` and the broadcast hook drives live queries. */\ninterface HyperdriveGlobalDeclaration<Env> {\n /** The Hyperdrive engine — selects the Postgres or MySQL dialect. */\n engine: HyperdriveEngine;\n /** Build the `SqlExec` from `env` — e.g. `buildPgExec(fromPostgresJs(postgres(env.HYPERDRIVE.connectionString)))`. Cache the driver on the DO instance; rebuild lazily after hibernation. */\n exec: (env: Env) => SqlExec;\n /** The worker origin used to fan reverse cross-backend relations across shards. Without it, such a relation throws a clear error. */\n origin?: Selector<Env, string>;\n}']:[],...e.hasAuth?['/** `.auth(...)` declaration — better-auth options plus the storage the adapter reads. Give it `d1` (the default) or `namespace` (a Durable Object that hosts the auth tables), never both. The builder owns the lazy build + `ensureMigrated` dance and wires `authHandler` / `resolveIdentity` / `authAdmin`. */\ninterface AuthDeclaration<Env> {\n /** The D1 binding the auth SQL adapter is wired over (via `lunoraD1Adapter`). Omit only when using `namespace`. */\n d1?: Selector<Env, unknown>;\n /** Shared secret the worker presents on the object\'s internal session route. REQUIRED with `namespace`: the binding is reachable from any worker bound to it, so the secret — not the binding — is the authorization boundary. Without it identity resolution fails closed. */\n internalSecret?: Selector<Env, string>;\n /** Name of the Durable Object instance holding the auth tables. Defaults to `"auth"`. Set it to run separate auth objects (per deployment, per tenant) off one namespace. */\n objectName?: Selector<Env, string>;\n /** The auth Durable Object namespace — the DO-backed mode. Needed for `@better-auth/scim`, which requires native transactions that D1 has none of. The object owns the auth tables, so `/api/auth/*` and identity resolution both go through it. Typed as `AuthNamespaceLike` because `createDoAuthWiring` resolves through `idFromName` + `get` and has no `getByName` fallback — both members are load-bearing here, and `ShardNamespaceLike` leaves both optional. */\n namespace?: Selector<Env, AuthNamespaceLike>;\n /** Build the better-auth options from `env` (secret, plugins, email/password, …). */\n options: (env: Env) => LunoraAuthOptions;\n}']:[]],j=e=>[...e.hasAccess?[" private accessSelector?: Selector<Env, CreateAccessResolverOptions | undefined>;"]:[]," private adminToken?: Selector<Env, string>;",...e.hasAuth?[" private authDeclaration?: AuthDeclaration<Env>;"]:[]," private cdcEnabled = false;"," private reactiveCacheConfig: boolean | { maxBytes?: number; maxEntries?: number } = false;",' private maxRelationKeysLimit?: ShardConfig["maxRelationKeys"];',' private observabilitySink?: ShardConfig["observability"];',' private relationExistsPushDownMode?: ShardConfig["relationExistsPushDown"];'," private readonly extendFns: ((env: Env, derived: Readonly<WorkerOptions>) => Partial<WorkerOptions>)[] = [];",...e.hasGlobal?[" private globalDeclaration?: GlobalDeclaration<Env>;"]:[],...e.hasHyperdriveGlobal?[" private hyperdriveGlobalDeclaration?: HyperdriveGlobalDeclaration<Env>;"]:[]," private httpRouterApp?: HttpRouterLike;"," private readonly routeMap: Record<string, Route> = {};",...e.hasScheduler?[" private schedulerDeclaration?: SchedulerDeclaration<Env>;"]:[],...m(e)?[" private readonly shardExtras: Partial<ShardConfig> = {};"]:[],...d(e)?[" private shardRegistrySelector?: Selector<Env, ShardNamespaceLike>;"]:[]," private shardSelector?: Selector<Env, ShardNamespaceLike>;",...e.hasSourcedTables?[' private sourceClientFactory?: NonNullable<ShardConfig["sourceClient"]>;']:[],...e.hasStorage?[" private storageDeclaration?: StorageDeclaration<Env>;"]:[]],G=e=>g.filter(([t])=>e[t]).map(([,t,r,a])=>` /** ${a} */
2
2
  public ${t}(factory: (env: Env) => ReturnType<NonNullable<ShardConfig["${r}"]>>): this {
3
3
  this.shardExtras.${r} = factory as NonNullable<ShardConfig["${r}"]>;
4
4
 
@@ -677,7 +677,7 @@ const buildGlobalCdcApplier =
677
677
  `:"",l=r?`
678
678
  await ensureAuth(env);`:"",s=r?"() => auth":"() => null",c=r?"getAuth: () => LunoraAuth | null":"_getAuth: () => null",h=t.hasFramework?` const buildWorker = (env: Env): LunoraWorker =>
679
679
  host ? withFrameworkWorker(host, (hostEnv) => this.buildWorkerOptions(hostEnv as Env, ${s})) : createWorker(this.buildWorkerOptions(env, ${s}));`:` const buildWorker = (env: Env): LunoraWorker => createWorker(this.buildWorkerOptions(env, ${s}));`,u=t.hasFramework?"host?: FrameworkHostHandler":"",p=t.emailAgents??[],y=p.length>0?` composed.email = dispatchAgentEmail([
680
- ${p.map(b=>` { agent: lunoraAgentDefinitions.${b.exportName}, binding: ${JSON.stringify(b.bindingName)} },`).join(`
680
+ ${p.map(b=>` { agent: lunoraAgentDefinitions.${b.exportName}, className: ${JSON.stringify(b.className)} },`).join(`
681
681
  `)}
682
682
  ]);
683
683
 
@@ -1,4 +1,4 @@
1
- import{i as f}from"./ir-BgM8A3XV.mjs";import{G as c,d as m}from"./shared-DjUziztz.mjs";const u=n=>n?`${c}/**
1
+ import{i as f}from"./ir-DBSvhNa-.mjs";import{G as c,d as m}from"./shared-DjUziztz.mjs";const u=n=>n?`${c}/**
2
2
  * The \`SchedulerDO\` Durable Object class, re-exported so a worker entry can
3
3
  * forward it — wrangler binds only what the entry exports:
4
4
  *
@@ -8,7 +8,7 @@ import{i as f}from"./ir-BgM8A3XV.mjs";import{G as c,d as m}from"./shared-DjUzizt
8
8
  * forwards this module for you whenever it exists.
9
9
  */
10
10
  export { SchedulerDO } from "@lunora/scheduler";
11
- `:"",y=(n,r)=>n.some(s=>f(s))?`${c}/**
11
+ `:"",y=(n,r)=>n.some(o=>f(o))?`${c}/**
12
12
  * The \`ShardRegistryDO\` Durable Object class — the live set of shard keys per
13
13
  * \`.shardBy()\` table, which cross-shard export, CDC sync and migrations fan out
14
14
  * to. Re-exported so a worker entry can forward it (wrangler binds only what the
@@ -22,19 +22,19 @@ export { SchedulerDO } from "@lunora/scheduler";
22
22
  * worker entry does both whenever this module exists.
23
23
  */
24
24
  export { ShardRegistryDO } from "${m(r).do}";
25
- `:"",w=n=>{const r=new Map;for(const o of n){const a=r.get(o.cron);a?a.push(o):r.set(o.cron,[o])}const s=[...r.keys()].map(o=>` ${JSON.stringify(o)},`).join(`
26
- `),e=s.length>0?`
27
- ${s}
28
- `:"",t=[...r.entries()].map(([o,a])=>{const h=a.map(i=>{const l=i.workflow?`workflow: ${JSON.stringify(i.workflow.binding)}`:`functionPath: ${JSON.stringify(i.functionPath)}`;return` { name: ${JSON.stringify(i.name)}, ${l}, args: ${JSON.stringify(i.args)} },`}).join(`
29
- `);return` ${JSON.stringify(o)}: [
30
- ${h}
25
+ `:"",w=n=>{const r=new Map;for(const s of n){const a=r.get(s.cron);a?a.push(s):r.set(s.cron,[s])}const o=[...r.keys()].map(s=>` ${JSON.stringify(s)},`).join(`
26
+ `),e=o.length>0?`
27
+ ${o}
28
+ `:"",t=[...r.entries()].map(([s,a])=>{const l=a.map(i=>{const h=i.workflow?`workflow: ${JSON.stringify(i.workflow.className)}`:`functionPath: ${JSON.stringify(i.functionPath)}`;return` { name: ${JSON.stringify(i.name)}, ${h}, args: ${JSON.stringify(i.args)} },`}).join(`
29
+ `);return` ${JSON.stringify(s)}: [
30
+ ${l}
31
31
  ],`}).join(`
32
32
  `),d=t.length>0?`
33
33
  ${t}
34
34
  `:"";return`${c}/**
35
35
  * One scheduled cron invocation. Exactly one target is set: \`functionPath\` is
36
36
  * the \`namespace:fn\` dispatch ref (matches \`__lunoraRef\`), invoked on the
37
- * shard; \`workflow\` is a \`WORKFLOW_*\` binding name whose durable workflow is
37
+ * shard; \`workflow\` is a workflow class name (its \`ctx.exports\` key) whose durable workflow is
38
38
  * started fresh per fire. \`args\` are forwarded verbatim (a workflow's become
39
39
  * its \`params\`).
40
40
  */
@@ -57,7 +57,7 @@ export const LUNORA_CRON_TRIGGERS: ReadonlyArray<string> = [${e}];
57
57
  */
58
58
  export const LUNORA_CRONS: Record<string, ReadonlyArray<LunoraCronJob>> = {${d}};
59
59
  `},S=n=>{const r=[...n].toSorted((e,t)=>e.name.localeCompare(t.name)).map(e=>{const t=[`name: ${JSON.stringify(e.name)}`,`table: ${JSON.stringify(e.table)}`];return e.field!==void 0&&t.push(`field: ${JSON.stringify(e.field)}`),e.dimensions!==void 0&&t.push(`dimensions: ${JSON.stringify(e.dimensions)}`),e.metric!==void 0&&t.push(`metric: ${JSON.stringify(e.metric)}`),e.metadata!==void 0&&t.push(`metadata: ${JSON.stringify(e.metadata)}`),` { ${t.join(", ")} },`}).join(`
60
- `),s=r.length>0?`
60
+ `),o=r.length>0?`
61
61
  ${r}
62
62
  `:"";return`${c}/**
63
63
  * One vector index declared in \`schema.ts\` — an inline \`.vectorize()\` column
@@ -79,5 +79,5 @@ export interface LunoraVectorIndex {
79
79
  * Vectorize cannot enumerate indexes at runtime, so the worker passes this to
80
80
  * \`createWorker({ vectorIntrospector })\` to back the studio's vector browser.
81
81
  */
82
- export const LUNORA_VECTOR_INDEXES: ReadonlyArray<LunoraVectorIndex> = [${s}];
82
+ export const LUNORA_VECTOR_INDEXES: ReadonlyArray<LunoraVectorIndex> = [${o}];
83
83
  `},R=n=>[...new Set(n.map(r=>r.cron))];export{w as emitCrons,u as emitScheduler,y as emitShardRegistry,S as emitVectors,R as emitWranglerCronTriggers};
@@ -1,4 +1,4 @@
1
- import{LunoraError as B}from"@lunora/errors";import{L as H,G as q,I as J,d as Q,r as G,b as z,c as x}from"./shared-DjUziztz.mjs";import{s as p}from"./paths-C-9fwEgQ.mjs";import{renderAgentFunctionRegistry as V,renderSandboxFunctionRegistry as W,groupByFileSorted as K}from"./emitApi-CJ9ziZnP.mjs";import{r as Y,a as X,b as O,c as Z}from"./qualifiers-BhOL15WZ.mjs";const ee=new Set(["any","bigint","boolean","date","id","null","number","storage","string","timestamp"]),A=n=>n.column!==void 0,te=(n,e)=>{switch(n){case"bigint":return`if (typeof ${e} !== "bigint") return DEFER;
1
+ import{LunoraError as B}from"@lunora/errors";import{L as H,G as q,I as J,d as Q,r as G,b as z,c as x}from"./shared-DjUziztz.mjs";import{s as p}from"./paths-C-9fwEgQ.mjs";import{renderAgentFunctionRegistry as V,renderSandboxFunctionRegistry as W,groupByFileSorted as K}from"./emitApi-DdW9RyGG.mjs";import{r as Y,a as X,b as O,c as Z}from"./qualifiers-BhOL15WZ.mjs";const ee=new Set(["any","bigint","boolean","date","id","null","number","storage","string","timestamp"]),A=n=>n.column!==void 0,te=(n,e)=>{switch(n){case"bigint":return`if (typeof ${e} !== "bigint") return DEFER;
2
2
  `;case"boolean":return`if (typeof ${e} !== "boolean") return DEFER;
3
3
  `;case"date":case"number":case"timestamp":return`if (typeof ${e} !== "number" || !Number.isFinite(${e})) return DEFER;
4
4
  `;case"null":return`if (${e} !== null) return DEFER;
@@ -1,19 +1,17 @@
1
- import{LunoraError as Ie}from"@lunora/errors";import{S as $e}from"./capabilities-DJJWVEtk.mjs";import{a as c,G as Re,u as Be,d as Oe}from"./shared-DjUziztz.mjs";const De=(l,s=[])=>{const t=new Set;for(const a of l.tables)for(const n of Object.values(a.shape)){const i=Be(n);i.kind==="storage"&&typeof i.bucket=="string"&&i.bucket!==""&&t.add(i.bucket)}for(const a of s)a!==""&&a!=="default"&&t.add(a);return["default",...[...t].toSorted((a,n)=>a.localeCompare(n))]},Fe=({agents:l=[],containers:s=[],env:t,hasAccessFacade:a=!1,hasAi:n=!1,hasAnalytics:i=!1,hasBrowser:E=!1,hasVectors:P=!0,hasFlags:j=!1,hasHyperdrive:q=!1,hasImages:L=!1,hasKv:V=!1,hasNotify:G=!1,hasPayments:O=!1,hasPipelines:_=!1,hasR2sql:H=!1,hasX402:D=!1,identity:d,queues:m=[],schema:M,storageRuleBuckets:z=[],useUmbrella:U=!1,workflows:b=[]}={})=>{const r=Oe(U),K=De(M??{tables:[]},z).map(e=>JSON.stringify(e)).join(" | "),X=n?`import type { LunoraAi } from "@lunora/ai";
2
- `:"",J=n?`
3
- readonly ai: LunoraAi;`:"",Y=O?`import type { LunoraPayment } from "@lunora/payment";
4
- `:"",Z=O?`
5
- readonly payments: LunoraPayment;`:"",ee=D?`import type { X402Pay } from "@lunora/x402/pay";
6
- `:"",te=D?`
7
- readonly x402: X402Pay;`:"",ae=s.length>0?`import type { ContainerAccessor } from "@lunora/container";
8
- `:"",re=s.length>0?`
1
+ import{LunoraError as Ce}from"@lunora/errors";import{S as Ne}from"./capabilities-DJJWVEtk.mjs";import{p as Fe}from"./ir-DBSvhNa-.mjs";import{a as R,G as Se,u as We,d as Qe}from"./shared-DjUziztz.mjs";const Pe=(l,s=[])=>{const t=new Set;for(const a of l.tables)for(const o of Object.values(a.shape)){const i=We(o);i.kind==="storage"&&typeof i.bucket=="string"&&i.bucket!==""&&t.add(i.bucket)}for(const a of s)a!==""&&a!=="default"&&t.add(a);return["default",...[...t].toSorted((a,o)=>a.localeCompare(o))]},Ge=({agents:l=[],containers:s=[],env:t,hasAccessFacade:a=!1,hasAi:o=!1,hasAnalytics:i=!1,hasBrowser:V=!1,hasVectors:G=!0,hasFlags:_=!1,hasHyperdrive:H=!1,hasImages:z=!1,hasKv:U=!1,hasNotify:K=!1,hasPayments:O=!1,hasPipelines:X=!1,hasR2sql:J=!1,hasX402:D=!1,identity:d,queues:M=[],schema:A,storageRuleBuckets:Y=[],topics:C=[],useUmbrella:Z=!1,workflows:N=[]}={})=>{const r=Qe(Z),ee=Pe(A??{tables:[]},Y).map(e=>JSON.stringify(e)).join(" | "),te=o?`import type { LunoraAi } from "@lunora/ai";
2
+ `:"",ae=o?`
3
+ readonly ai: LunoraAi;`:"",re=O?`import type { LunoraPayment } from "@lunora/payment";
4
+ `:"",oe=O?`
5
+ readonly payments: LunoraPayment;`:"",ne=D?`import type { X402Pay } from "@lunora/x402/pay";
6
+ `:"",se=D?`
7
+ readonly x402: X402Pay;`:"",ie=s.length>0?`import type { ContainerAccessor } from "@lunora/container";
8
+ `:"",de=s.length>0?`
9
9
  readonly containers: {${s.map(e=>`
10
10
  readonly ${e.exportName}: ContainerAccessor;`).join("")}
11
- };`:"",N=[...n?[" /** Workers AI binding (the conventional `env.AI`), narrowing `ctx.ai`. */\n readonly AI?: unknown;"]:[],...s.map(e=>(c(e.bindingName,`container binding "${e.bindingName}"`),` /** Durable Object namespace for the \`${e.exportName}\` container. */
12
- readonly ${e.bindingName}?: unknown;`)),...b.map(e=>(c(e.bindingName,`workflow binding "${e.bindingName}"`),` /** Workflow binding for the \`${e.exportName}\` workflow. */
13
- readonly ${e.bindingName}?: unknown;`)),...m.map(e=>(c(e.bindingName,`queue binding "${e.bindingName}"`),` /** Queue producer binding for the \`${e.exportName}\` queue. */
14
- readonly ${e.bindingName}?: unknown;`)),...l.map(e=>(c(e.bindingName,`agent binding "${e.bindingName}"`),` /** Workflow binding for the \`${e.exportName}\` agent. */
11
+ };`:"",F=[...o?[" /** Workers AI binding (the conventional `env.AI`), narrowing `ctx.ai`. */\n readonly AI?: unknown;"]:[],...s.map(e=>(R(e.bindingName,`container binding "${e.bindingName}"`),` /** Durable Object namespace for the \`${e.exportName}\` container. */
12
+ readonly ${e.bindingName}?: unknown;`)),...M.map(e=>(R(e.bindingName,`queue binding "${e.bindingName}"`),` /** Queue producer binding for the \`${e.exportName}\` queue. */
15
13
  readonly ${e.bindingName}?: unknown;`))].join(`
16
- `),ne=`
14
+ `),le=`
17
15
 
18
16
  /**
19
17
  * This project's Cloudflare bindings, as far as codegen can discover them from
@@ -26,26 +24,26 @@ import{LunoraError as Ie}from"@lunora/errors";import{S as $e}from"./capabilities
26
24
  * surface, so treat them as \`Fetcher\`/\`Service<unknown>\` and cast.
27
25
  */
28
26
  export interface CloudflareBindings {
29
- readonly [binding: string]: unknown;${N?`
30
- ${N}`:""}
27
+ readonly [binding: string]: unknown;${F?`
28
+ ${F}`:""}
31
29
  }
32
30
 
33
31
  /** Alias for {@link CloudflareBindings} — the typed shape of \`env\`. */
34
- export type Env = CloudflareBindings;`,o=(e,we,Q)=>{const y=$e.get(e);if(y!==void 0&&y.tier!==Q)throw new Ie("INTERNAL",`@lunora/codegen: capability "${e}" declares tier "${y.tier}" in SERVER_CTX_FIELDS but is emitted onto the "${Q}" context — update whichever is wrong.`);return we?y?.field??"":""},h=o("kv",V,"every"),f=o("analytics",i,"every"),oe=o("hyperdrive",q,"action"),se=o("browser",E,"action"),ie=o("images",L,"action"),de=o("pipelines",_,"action"),le=o("r2sql",H,"action"),u=P&&(M?.vectorIndexes.length??0)>0,x=u?' | "vectors"':"",A=u?`
35
- readonly vectors: VectorSearch<VectorIndexName>;`:"",ce=u?`
36
- readonly vectors: VectorSearchReader<VectorIndexName>;`:"",ue=u?`import type { VectorSearch, VectorSearchReader } from "${r.server}";
32
+ export type Env = CloudflareBindings;`,n=(e,Ae,L)=>{const p=Ne.get(e);if(p!==void 0&&p.tier!==L)throw new Ce("INTERNAL",`@lunora/codegen: capability "${e}" declares tier "${p.tier}" in SERVER_CTX_FIELDS but is emitted onto the "${L}" context — update whichever is wrong.`);return Ae?p?.field??"":""},y=n("kv",U,"every"),m=n("analytics",i,"every"),ce=n("hyperdrive",H,"action"),ue=n("browser",V,"action"),pe=n("images",z,"action"),ye=n("pipelines",X,"action"),me=n("r2sql",J,"action"),c=G&&(A?.vectorIndexes.length??0)>0,b=c?' | "vectors"':"",S=c?`
33
+ readonly vectors: VectorSearch<VectorIndexName>;`:"",be=c?`
34
+ readonly vectors: VectorSearchReader<VectorIndexName>;`:"",he=c?`import type { VectorSearch, VectorSearchReader } from "${r.server}";
37
35
  import type { VectorIndexName } from "./dataModel.js";
38
- `:"",g=a?`
36
+ `:"",h=a?`
39
37
  /** Verified Cloudflare Access identity — a synchronous facade over the resolved claims (email / groups / hasGroup / claims). Anonymous when no Access token is present. */
40
- readonly access: import("@lunora/cloudflare-access/context").AccessFacade;`:"",T=j?`
38
+ readonly access: import("@lunora/cloudflare-access/context").AccessFacade;`:"",f=_?`
41
39
  /** Feature-flag evaluation (OpenFeature). Reads are memoized per request; evaluations never throw — a provider error resolves to the supplied default. */
42
- readonly flags: import("${r.flags}").LunoraFlags;`:"",v=G?`
40
+ readonly flags: import("${r.flags}").LunoraFlags;`:"",x=K?`
43
41
  /** Multi-channel notifications (@lunora/notify): send / chat / inApp / webhook plus the push device sub-facade. Sends are external I/O — confine them to action handlers. */
44
42
  readonly notify: import("@lunora/notify").LunoraNotify;
45
43
  /** Device push sub-facade — the same object as ctx.notify.push (register / send / broadcast). Sends belong in action handlers. */
46
- readonly push: import("@lunora/notify").LunoraPush;`:"",p=b.length>0,pe=p?`import type { WorkflowHandle } from "@lunora/workflow";
44
+ readonly push: import("@lunora/notify").LunoraPush;`:"",u=N.length>0,fe=u?`import type { WorkflowHandle } from "@lunora/workflow";
47
45
  import type * as lunoraWorkflowDefinitions from "../workflows.js";
48
- `:"",ye=p?`
46
+ `:"",xe=u?`
49
47
 
50
48
  /** Params type carried by a \`defineWorkflow\` definition (its phantom \`__params\`). */
51
49
  type WorkflowParamsOf<Definition> = Definition extends { __params?: infer Params }
@@ -56,43 +54,47 @@ type WorkflowParamsOf<Definition> = Definition extends { __params?: infer Params
56
54
 
57
55
  /** This project's declared workflows, addressable from \`ctx.workflows\` by their \`lunora/workflows.ts\` export name. */
58
56
  export interface LunoraWorkflows {
59
- ${b.map(e=>` get(name: ${JSON.stringify(e.exportName)}): WorkflowHandle<WorkflowParamsOf<typeof lunoraWorkflowDefinitions.${e.exportName}>>;`).join(`
57
+ ${N.map(e=>` get(name: ${JSON.stringify(e.exportName)}): WorkflowHandle<WorkflowParamsOf<typeof lunoraWorkflowDefinitions.${e.exportName}>>;`).join(`
60
58
  `)}
61
- }`:"",C=p?' | "workflows"':"",F=p?`
62
- readonly workflows: LunoraWorkflows;`:"",k=m.length>0,me=k?`import type { QueueProducer } from "@lunora/queue";
59
+ }`:"",W=u?' | "workflows"':"",Q=u?`
60
+ readonly workflows: LunoraWorkflows;`:"",P=Fe(M),g=P.length>0,T=C.length>0,v=[...g?["QueueProducer"]:[],...T?["TopicPublisher"]:[]],ge=v.length>0?`import type { ${v.join(", ")} } from "@lunora/queue";
63
61
  import type * as lunoraQueueDefinitions from "../queues.js";
64
- `:"",be=k?`
65
-
66
- /** Message body type carried by a \`defineQueue\` definition (its phantom \`__lunoraBody\`). */
67
- type QueueBodyOf<Definition> = Definition extends { __lunoraBody?: infer Body } ? (unknown extends Body ? unknown : NonNullable<Body>) : unknown;
62
+ `:"",Te=v.length>0?"\n\n/** Message body type carried by a `defineQueue` / `defineTopic` definition (its phantom `__lunoraBody`). */\ntype QueueBodyOf<Definition> = Definition extends { __lunoraBody?: infer Body } ? (unknown extends Body ? unknown : NonNullable<Body>) : unknown;":"",ve=g?`
68
63
 
69
64
  /** This project's declared queues, addressable from \`ctx.queues\` by their \`lunora/queues.ts\` export name. */
70
65
  export interface LunoraQueues {
71
- ${m.map(e=>` readonly ${e.exportName}: QueueProducer<QueueBodyOf<typeof lunoraQueueDefinitions.${e.exportName}>>;`).join(`
66
+ ${P.map(e=>` readonly ${e.exportName}: QueueProducer<QueueBodyOf<typeof lunoraQueueDefinitions.${e.exportName}>>;`).join(`
67
+ `)}
68
+ }`:"",ke=T?`
69
+
70
+ /** This project's declared topics, addressable from \`ctx.topics\` by their \`lunora/queues.ts\` export name. */
71
+ export interface LunoraTopics {
72
+ ${C.map(e=>` readonly ${e.exportName}: TopicPublisher<QueueBodyOf<typeof lunoraQueueDefinitions.${e.exportName}>>;`).join(`
72
73
  `)}
73
- }`:"",S=k?`
74
- readonly queues: LunoraQueues;`:"",w=l.length>0,he=w?`import type { AgentHandle } from "@lunora/agent";
75
- `:"",fe=w?`
74
+ }`:"",we=`${Te}${ve}${ke}`,q=g?`
75
+ readonly queues: LunoraQueues;`:"",E=T?`
76
+ readonly topics: LunoraTopics;`:"",k=l.length>0,Ie=k?`import type { AgentHandle } from "@lunora/agent";
77
+ `:"",$e=k?`
76
78
 
77
79
  /** This project's declared agents, addressable from \`ctx.agents\` by their \`lunora/agents.ts\` export name. */
78
80
  export interface LunoraAgents {
79
- ${l.map(e=>(c(e.exportName,`agent export "${e.exportName}"`),` readonly ${e.exportName}: AgentHandle;`)).join(`
81
+ ${l.map(e=>(R(e.exportName,`agent export "${e.exportName}"`),` readonly ${e.exportName}: AgentHandle;`)).join(`
80
82
  `)}
81
- }`:"",W=w?`
82
- readonly agents: LunoraAgents;`:"",xe=d?`import type { InferIdentity } from "${r.server}";
83
+ }`:"",j=k?`
84
+ readonly agents: LunoraAgents;`:"",Be=d?`import type { InferIdentity } from "${r.server}";
83
85
  import type * as lunoraIdentityContract from "../identity.js";
84
- `:"",ge=d?`
86
+ `:"",Re=d?`
85
87
 
86
88
  /** This app's declared identity claim contract (\`defineIdentity\` in \`lunora/identity.ts\`) — the typed shape of \`ctx.auth.getIdentity()\`, the RLS policy \`ctx.auth.identity\`, and the \`authorizeShard\`/\`authorizeFanOut\` identity argument. */
87
89
  export type Identity = InferIdentity<typeof lunoraIdentityContract.${d.exportName}>;
88
90
 
89
91
  /** \`ctx.auth\` narrowed so \`getIdentity()\` resolves the declared {@link Identity} contract instead of the untyped claim bag. */
90
- type NarrowedAuth = Omit<QueryCtxBase["auth"], "getIdentity"> & { getIdentity: () => Promise<Identity | null> };`:"",I=d?' | "auth"':"",$=d?`
91
- readonly auth: NarrowedAuth;`:"",Te=d?", Identity":"",ve=t?`import type * as lunoraEnvContract from "../env.js";
92
- `:"",ke=t?`
92
+ type NarrowedAuth = Omit<QueryCtxBase["auth"], "getIdentity"> & { getIdentity: () => Promise<Identity | null> };`:"",w=d?' | "auth"':"",I=d?`
93
+ readonly auth: NarrowedAuth;`:"",Oe=d?", Identity":"",De=t?`import type * as lunoraEnvContract from "../env.js";
94
+ `:"",Me=t?`
93
95
 
94
96
  /** This app's declared env contract (\`defineEnv\` in \`lunora/env.ts\`) — the validated, coercion-aware shape of \`ctx.env\`. */
95
- export type LunoraEnv = ReturnType<typeof lunoraEnvContract.${t.exportName}>;`:"",R=t?' | "env"':"",B=t?"\n /** Validated, typed environment declared by `defineEnv` in `lunora/env.ts` — parsed & coercion-aware config values (`ctx.env.STRIPE_KEY`); a missing or invalid value throws at read time. */\n readonly env: LunoraEnv;":"";return`${Re}import { createPolicyDsl, defineMutator as defineMutatorBase, initLunora, v as vBase } from "${r.server}";
97
+ export type LunoraEnv = ReturnType<typeof lunoraEnvContract.${t.exportName}>;`:"",$=t?' | "env"':"",B=t?"\n /** Validated, typed environment declared by `defineEnv` in `lunora/env.ts` — parsed & coercion-aware config values (`ctx.env.STRIPE_KEY`); a missing or invalid value throws at read time. */\n readonly env: LunoraEnv;":"";return`${Se}import { createPolicyDsl, defineMutator as defineMutatorBase, initLunora, v as vBase } from "${r.server}";
96
98
  import type {
97
99
  ActionBuilder,
98
100
  ActionCtx as ActionCtxBase,
@@ -149,7 +151,7 @@ export type {
149
151
  } from "${r.serverDataModel}";
150
152
 
151
153
  import type { DataModel, Doc, GeoIndexNamesByTable, Id as IdOfTable, IndexNamesByTable, Insert, InsertModel, RankIndexNamesByTable, Relations, SearchIndexNamesByTable, TableName } from "./dataModel.js";
152
- ${ue}${X}${Y}${ee}${ae}${pe}${me}${he}${xe}${ve}
154
+ ${he}${te}${re}${ne}${ie}${fe}${ge}${Ie}${Be}${De}
153
155
  export type { AppTableName, DataModel, Doc, Id, TableName } from "./dataModel.js";
154
156
 
155
157
  /**
@@ -209,7 +211,7 @@ export interface OrmWriter extends OrmReader {
209
211
  }
210
212
 
211
213
  /** Storage buckets this schema declares (\`v.storage("name")\`), narrowing \`ctx.storage.bucket(name)\`. */
212
- export type StorageBucketName = ${K};${ne}${ye}${be}${fe}${ge}${ke}
214
+ export type StorageBucketName = ${ee};${le}${xe}${we}${$e}${Re}${Me}
213
215
 
214
216
  /**
215
217
  * Project-typed contexts. The base contexts from \`@lunora/server\` are
@@ -272,22 +274,22 @@ type AsIdTable<T extends string> = T extends TableName ? T : string extends T ?
272
274
  */
273
275
  type TypedAsId = <T extends string>(tableName: AsIdTable<T>, id: string) => IdOfTable<T & TableName>;
274
276
 
275
- export interface QueryCtx extends Omit<QueryCtxBase, "db" | "storage"${x}${I}${R}> {
277
+ export interface QueryCtx extends Omit<QueryCtxBase, "db" | "storage"${b}${w}${$}> {
276
278
  readonly db: Omit<DatabaseReader, "asId" | "query" | "get"> & DatabaseReaderFacade & { asId: TypedAsId; query: TypedTableQuery; get: TypedTableGet };
277
279
  readonly orm: OrmReader;
278
- readonly storage: ReadOnlyStorage<StorageBucketName>;${ce}${g}${h}${T}${v}${f}${B}${$}
280
+ readonly storage: ReadOnlyStorage<StorageBucketName>;${be}${h}${y}${f}${x}${m}${B}${I}
279
281
  }
280
282
 
281
- export interface MutationCtx extends Omit<MutationCtxBase, "db" | "storage"${x}${C}${I}${R}> {
283
+ export interface MutationCtx extends Omit<MutationCtxBase, "db" | "storage"${b}${W}${w}${$}> {
282
284
  readonly db: Omit<DatabaseWriter, "asId" | "query" | "get"> & DatabaseWriterFacade & { asId: TypedAsId; query: TypedTableQuery; get: TypedTableGet };
283
285
  readonly orm: OrmWriter;
284
- readonly storage: MutationStorage<StorageBucketName>;${A}${g}${h}${T}${v}${f}${B}${F}${S}${W}${$}
286
+ readonly storage: MutationStorage<StorageBucketName>;${S}${h}${y}${f}${x}${m}${B}${Q}${q}${E}${j}${I}
285
287
  }
286
288
 
287
- export interface ActionCtx extends Omit<ActionCtxBase, "db" | "storage"${x}${C}${I}${R}> {
289
+ export interface ActionCtx extends Omit<ActionCtxBase, "db" | "storage"${b}${W}${w}${$}> {
288
290
  readonly db: Omit<DatabaseWriter, "asId" | "query" | "get"> & DatabaseWriterFacade & { asId: TypedAsId; query: TypedTableQuery; get: TypedTableGet };
289
291
  readonly orm: OrmWriter;
290
- readonly storage: StorageBase<StorageBucketName>;${A}${g}${J}${Z}${te}${re}${h}${T}${v}${oe}${se}${ie}${f}${de}${le}${B}${F}${S}${W}${$}
292
+ readonly storage: StorageBase<StorageBucketName>;${S}${h}${ae}${oe}${se}${de}${y}${f}${x}${ce}${ue}${pe}${m}${ye}${me}${B}${Q}${q}${E}${j}${I}
291
293
  }
292
294
 
293
295
  /**
@@ -345,7 +347,7 @@ export const defineMutator = defineMutatorBase as unknown as <Args extends Recor
345
347
  * Runtime-identical to \`@lunora/server\`'s \`definePolicy\`; only the types narrow,
346
348
  * so the \`rls()\` chain discovers a policy authored either way the same.
347
349
  */
348
- export const definePolicy = createPolicyDsl<DataModel, Relations${Te}>();
350
+ export const definePolicy = createPolicyDsl<DataModel, Relations${Oe}>();
349
351
 
350
352
  /**
351
353
  * The validator builder \`v\`, with \`v.id(...)\` constrained to THIS schema's
@@ -362,4 +364,4 @@ export const definePolicy = createPolicyDsl<DataModel, Relations${Te}>();
362
364
  export const v = vBase as unknown as Omit<typeof vBase, "id"> & {
363
365
  id: <T extends TableName>(table: T) => ColumnValidator<IdOfTable<T>, IdOfTable<T>>;
364
366
  };
365
- `};export{Fe as default};
367
+ `};export{Ge as default};
@@ -0,0 +1 @@
1
+ import"./SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import"./isD1GlobalTable-udvHAAzD.mjs";import"./ir-DBSvhNa-.mjs";import"./json-data-Chfs2Cz5.mjs";import{e as f}from"./shard-BVzXMtWg.mjs";import"./shard-runtime-oIXHEMU7.mjs";import"./shared-DjUziztz.mjs";export{f as default};
@@ -0,0 +1 @@
1
+ const t=s=>s.filter(o=>o.topic===void 0),e=(s,o)=>s.filter(i=>i.topic===o),a=s=>typeof s.shardMode=="object"&&s.shardMode.kind==="shardBy";export{a as i,t as p,e as s};