@lunora/codegen 1.0.0-alpha.224 → 1.0.0-alpha.226
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/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/{SCHEMA_SNAPSHOT_FILENAME-Dz-I9yuA.mjs → SCHEMA_SNAPSHOT_FILENAME-CeVjGkFN.mjs} +1 -1
- package/dist/packem_shared/{SDK_LANGUAGES-CFyux-74.mjs → SDK_LANGUAGES-Cmn8nq91.mjs} +1 -1
- package/dist/packem_shared/{emitApp-Pd7CNFXQ.mjs → emitApp-BiATunRA.mjs} +7 -2
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -3454,7 +3454,7 @@ interface EmitAppOptions {
|
|
|
3454
3454
|
hasX402: boolean;
|
|
3455
3455
|
/** The single `defineIdentity(...)` contract in `lunora/identity.ts` (Plan 080) → import it as a VALUE and wire `options.identity`, so the runtime trust boundary validates every resolved identity before it becomes `ctx.auth`. `undefined` ⇒ no wiring, byte-identical output. */
|
|
3456
3456
|
identity?: IdentityIR;
|
|
3457
|
-
/** Schema declares `.jurisdiction("…")` → pin every DO the worker reaches (shards, fan-out, scheduler, containers, voice sessions, DO-backed auth) to the Cloudflare data-residency jurisdiction. */
|
|
3457
|
+
/** Schema declares `.jurisdiction("…")` → pin every DO the worker reaches (shards, fan-out, scheduler, containers, voice sessions, DO-backed auth, `@lunora/mail` shard RPC) to the Cloudflare data-residency jurisdiction. */
|
|
3458
3458
|
jurisdiction?: JurisdictionIR;
|
|
3459
3459
|
/**
|
|
3460
3460
|
* `.jurisdiction("…", { pinAuth: true })`. DO-backed auth is pinned only
|
package/dist/index.d.ts
CHANGED
|
@@ -3454,7 +3454,7 @@ interface EmitAppOptions {
|
|
|
3454
3454
|
hasX402: boolean;
|
|
3455
3455
|
/** The single `defineIdentity(...)` contract in `lunora/identity.ts` (Plan 080) → import it as a VALUE and wire `options.identity`, so the runtime trust boundary validates every resolved identity before it becomes `ctx.auth`. `undefined` ⇒ no wiring, byte-identical output. */
|
|
3456
3456
|
identity?: IdentityIR;
|
|
3457
|
-
/** Schema declares `.jurisdiction("…")` → pin every DO the worker reaches (shards, fan-out, scheduler, containers, voice sessions, DO-backed auth) to the Cloudflare data-residency jurisdiction. */
|
|
3457
|
+
/** Schema declares `.jurisdiction("…")` → pin every DO the worker reaches (shards, fan-out, scheduler, containers, voice sessions, DO-backed auth, `@lunora/mail` shard RPC) to the Cloudflare data-residency jurisdiction. */
|
|
3458
3458
|
jurisdiction?: JurisdictionIR;
|
|
3459
3459
|
/**
|
|
3460
3460
|
* `.jurisdiction("…", { pinAuth: true })`. DO-backed auth is pinned only
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as s,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{formatAdvisories as m,lintSchema as d,toAdvisorContext as f}from"./packem_shared/formatAdvisories-DwmUKYuc.mjs";import{describeErrorLevelFindings as c,errorAdvisoryNames as n,errorPlatformDiagnosticNames as l}from"./packem_shared/describeErrorLevelFindings-D23VSkFP.mjs";import{CodegenDiagnosticError as x,diagnosticAt as E}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as u,discoverAgents as v}from"./packem_shared/AGENTS_FILENAME-DoPI92Wu.mjs";import{listLunoraSourceFiles as g}from"./packem_shared/listLunoraSourceFiles-DP-5e-RE.mjs";import{default as O}from"./packem_shared/discoverAuthApiCalls-FxrdBeVt.mjs";import{CONTAINERS_FILENAME as M,discoverContainers as T}from"./packem_shared/CONTAINERS_FILENAME-B6TFs82W.mjs";import{default as h}from"./packem_shared/discoverCrons-MfKw7IFf.mjs";import{FLAGS_FILENAME as F,discoverFlags as I}from"./packem_shared/FLAGS_FILENAME-BedPDCsR.mjs";import{default as D}from"./packem_shared/discoverFunctions-BsmX-sEq.mjs";import{default as U}from"./packem_shared/discoverHttpRoutes-BcXI9CNt.mjs";import{default as H}from"./packem_shared/discoverHyperdriveCalls-D9qXqTq3.mjs";import{default as y}from"./packem_shared/discoverInserts-CFJ3IVeI.mjs";import{d as W}from"./packem_shared/index-BoaHhVtM.mjs";import{default as V}from"./packem_shared/discoverMigrations-DbrHwcGE.mjs";import{MUTATORS_FILENAME as Q,discoverMutators as w}from"./packem_shared/MUTATORS_FILENAME-B6cKrN_m.mjs";import{default as q}from"./packem_shared/discoverNondeterministicCalls-CSQ_GDcA.mjs";import{NOTIFY_FILENAME as Y,discoverNotifyCalls as X,discoverNotifyConfig as Z}from"./packem_shared/NOTIFY_FILENAME-Cri3NT5U.mjs";import{default as ee}from"./packem_shared/readPackageDependencies-C6h6FZuP.mjs";import{d as oe}from"./packem_shared/queries-B-f4jO-x.mjs";import{QUEUES_FILENAME as se,discoverQueues as ae}from"./packem_shared/QUEUES_FILENAME-CxkPcMH1.mjs";import{default as me}from"./packem_shared/discoverR2sqlCalls-fu7fC0i_.mjs";import{default as fe}from"./packem_shared/discoverRlsProcedures-BO4qC77y.mjs";import{default as ce}from"./packem_shared/discoverRlsMetadata-CPmAGL0W.mjs";import{discoverSandboxUsage as le}from"./packem_shared/discoverSandboxUsage-CgmfgDTS.mjs";import{default as xe}from"./packem_shared/discoverSchema-QO1eQYjw.mjs";import{SHAPES_FILENAME as Ae,discoverShapes as ue}from"./packem_shared/SHAPES_FILENAME-zJgzynXR.mjs";import{default as Ne}from"./packem_shared/discoverStorageRulesMetadata-D8VYflWt.mjs";import{WORKFLOWS_FILENAME as Ce,discoverWorkflows as Oe}from"./packem_shared/WORKFLOWS_FILENAME-B_ZJxRSx.mjs";import{G as Me,e as Te,a as _e,b as he,c as Le,d as Fe,f as Ie,g as Pe,h as De,i as Ge,j as Ue,k as be,l as He,m as je,n as ye}from"./packem_shared/emit-6YJU3YbV.mjs";import{emitApp as We}from"./packem_shared/emitApp-
|
|
1
|
+
import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as s,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{formatAdvisories as m,lintSchema as d,toAdvisorContext as f}from"./packem_shared/formatAdvisories-DwmUKYuc.mjs";import{describeErrorLevelFindings as c,errorAdvisoryNames as n,errorPlatformDiagnosticNames as l}from"./packem_shared/describeErrorLevelFindings-D23VSkFP.mjs";import{CodegenDiagnosticError as x,diagnosticAt as E}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as u,discoverAgents as v}from"./packem_shared/AGENTS_FILENAME-DoPI92Wu.mjs";import{listLunoraSourceFiles as g}from"./packem_shared/listLunoraSourceFiles-DP-5e-RE.mjs";import{default as O}from"./packem_shared/discoverAuthApiCalls-FxrdBeVt.mjs";import{CONTAINERS_FILENAME as M,discoverContainers as T}from"./packem_shared/CONTAINERS_FILENAME-B6TFs82W.mjs";import{default as h}from"./packem_shared/discoverCrons-MfKw7IFf.mjs";import{FLAGS_FILENAME as F,discoverFlags as I}from"./packem_shared/FLAGS_FILENAME-BedPDCsR.mjs";import{default as D}from"./packem_shared/discoverFunctions-BsmX-sEq.mjs";import{default as U}from"./packem_shared/discoverHttpRoutes-BcXI9CNt.mjs";import{default as H}from"./packem_shared/discoverHyperdriveCalls-D9qXqTq3.mjs";import{default as y}from"./packem_shared/discoverInserts-CFJ3IVeI.mjs";import{d as W}from"./packem_shared/index-BoaHhVtM.mjs";import{default as V}from"./packem_shared/discoverMigrations-DbrHwcGE.mjs";import{MUTATORS_FILENAME as Q,discoverMutators as w}from"./packem_shared/MUTATORS_FILENAME-B6cKrN_m.mjs";import{default as q}from"./packem_shared/discoverNondeterministicCalls-CSQ_GDcA.mjs";import{NOTIFY_FILENAME as Y,discoverNotifyCalls as X,discoverNotifyConfig as Z}from"./packem_shared/NOTIFY_FILENAME-Cri3NT5U.mjs";import{default as ee}from"./packem_shared/readPackageDependencies-C6h6FZuP.mjs";import{d as oe}from"./packem_shared/queries-B-f4jO-x.mjs";import{QUEUES_FILENAME as se,discoverQueues as ae}from"./packem_shared/QUEUES_FILENAME-CxkPcMH1.mjs";import{default as me}from"./packem_shared/discoverR2sqlCalls-fu7fC0i_.mjs";import{default as fe}from"./packem_shared/discoverRlsProcedures-BO4qC77y.mjs";import{default as ce}from"./packem_shared/discoverRlsMetadata-CPmAGL0W.mjs";import{discoverSandboxUsage as le}from"./packem_shared/discoverSandboxUsage-CgmfgDTS.mjs";import{default as xe}from"./packem_shared/discoverSchema-QO1eQYjw.mjs";import{SHAPES_FILENAME as Ae,discoverShapes as ue}from"./packem_shared/SHAPES_FILENAME-zJgzynXR.mjs";import{default as Ne}from"./packem_shared/discoverStorageRulesMetadata-D8VYflWt.mjs";import{WORKFLOWS_FILENAME as Ce,discoverWorkflows as Oe}from"./packem_shared/WORKFLOWS_FILENAME-B_ZJxRSx.mjs";import{G as Me,e as Te,a as _e,b as he,c as Le,d as Fe,f as Ie,g as Pe,h as De,i as Ge,j as Ue,k as be,l as He,m as je,n as ye}from"./packem_shared/emit-6YJU3YbV.mjs";import{emitApp as We}from"./packem_shared/emitApp-BiATunRA.mjs";import{isD1GlobalTable as Ve,isHyperdriveGlobalTable as ze}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as we,emitOpenApi as Je,emitOpenApiModule as qe}from"./packem_shared/buildOpenApiDocument-D1dd4rBh.mjs";import{OPENRPC_VERSION as Ye,buildOpenRpcDocument as Xe,emitOpenRpc as Ze,emitOpenRpcModule as $e}from"./packem_shared/OPENRPC_VERSION-DAxS0CaZ.mjs";import{DEFAULT_TARGET as rr,platformMatrixIds as or,readProjectTarget as tr,resolveCodegenTarget as sr}from"./packem_shared/DEFAULT_TARGET-CkKqxaOb.mjs";import{loadProjectConfig as ir,readProjectConfigLiterals as mr}from"./packem_shared/loadProjectConfig-CKsFNgn3.mjs";import{SCHEMA_SNAPSHOT_FILENAME as fr,createCodegenProject as pr,findTsconfig as cr,refreshCodegenProject as nr,runCodegen as lr}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-CeVjGkFN.mjs";import{SchemaSnapshotParseError as xr,buildSchemaSnapshot as Er,evaluateSchemaDrift as Ar,parseSchemaSnapshot as ur}from"./packem_shared/SchemaSnapshotParseError-lUWe6lPo.mjs";import{schemaFromIr as Nr}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as Cr,validatorIrToJsonSchema as Or}from"./packem_shared/LUNORA_ERROR_CODES-C2s0xWQD.mjs";import{SDK_LANGUAGES as Mr,SDK_TARGETS as Tr,generateSdk as _r}from"./packem_shared/SDK_LANGUAGES-Cmn8nq91.mjs";import{redact as Lr,secretKindOf as Fr}from"./packem_shared/redact-Cy14LEnc.mjs";import{MESSAGE_SOLUTIONS as Pr,findSolutionByMessage as Dr}from"@lunora/errors";import{PROJECT_CONFIG_FILENAMES as Ur,findProjectConfigFile as br}from"./packem_shared/PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs";import{isTypedSchema as jr}from"./packem_shared/isTypedSchema-B_qlBbE-.mjs";const e="0.0.0";export{u as AGENTS_FILENAME,M as CONTAINERS_FILENAME,x as CodegenDiagnosticError,rr as DEFAULT_TARGET,F as FLAGS_FILENAME,Me as GENERATED_HEADER,Cr as LUNORA_ERROR_CODES,Pr as LUNORA_SOLUTION_RULES,Q as MUTATORS_FILENAME,Y as NOTIFY_FILENAME,Ye as OPENRPC_VERSION,Ur as PROJECT_CONFIG_FILENAMES,se as QUEUES_FILENAME,fr as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Mr as SDK_LANGUAGES,Tr as SDK_TARGETS,Ae as SHAPES_FILENAME,xr as SchemaSnapshotParseError,e as VERSION,Ce as WORKFLOWS_FILENAME,we as buildOpenApiDocument,Xe as buildOpenRpcDocument,Er as buildSchemaSnapshot,pr as createCodegenProject,c as describeErrorLevelFindings,E as diagnosticAt,s as diffSchemaSnapshots,v as discoverAgents,O as discoverAuthApiCalls,T as discoverContainers,h as discoverCrons,I as discoverFlags,D as discoverFunctions,U as discoverHttpRoutes,H as discoverHyperdriveCalls,y as discoverInserts,W as discoverMaskProcedures,V as discoverMigrations,w as discoverMutators,q as discoverNondeterministicCalls,X as discoverNotifyCalls,Z as discoverNotifyConfig,oe as discoverQueries,ae as discoverQueues,me as discoverR2sqlCalls,ce as discoverRlsMetadata,fe as discoverRlsProcedures,le as discoverSandboxUsage,xe as discoverSchema,ue as discoverShapes,Ne as discoverStorageRulesMetadata,Oe as discoverWorkflows,Te as emitAgents,_e as emitApi,We as emitApp,he as emitCollections,Le as emitContainers,Fe as emitCrons,Ie as emitDataModel,Pe as emitDrizzleSchema,De as emitFunctions,Je as emitOpenApi,qe as emitOpenApiModule,Ze as emitOpenRpc,$e as emitOpenRpcModule,Ge as emitScheduler,Ue as emitServer,be as emitShard,He as emitVectors,je as emitWorkflows,ye as emitWranglerCronTriggers,n as errorAdvisoryNames,l as errorPlatformDiagnosticNames,Ar as evaluateSchemaDrift,Dr as findLunoraSolution,br as findProjectConfigFile,cr as findTsconfig,m as formatAdvisories,_r as generateSdk,Ve as isD1GlobalTable,ze as isHyperdriveGlobalTable,jr as isTypedSchema,d as lintSchema,g as listLunoraSourceFiles,ir as loadProjectConfig,ur as parseSchemaSnapshot,or as platformMatrixIds,ee as readPackageDependencies,mr as readProjectConfigLiterals,tr as readProjectTarget,Lr as redact,nr as refreshCodegenProject,sr as resolveCodegenTarget,lr as runCodegen,Nr as schemaFromIr,Fr as secretKindOf,a as serializeSchemaSnapshot,f as toAdvisorContext,Or as validatorIrToJsonSchema};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync as w,mkdirSync as Rs,readFileSync as $t,writeFileSync as Ls,rmSync as Ds}from"node:fs";import{join as y,dirname as ae}from"node:path";import{performance as we}from"node:perf_hooks";import{runAdvisor as ks}from"@lunora/advisor";import{LunoraError as K}from"@lunora/errors";import{SyntaxKind as l,Node as o,VariableDeclarationKind as Ms,Project as dt}from"ts-morph";import{serializeSchemaSnapshot as Ks}from"./SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{toAdvisorContext as _s}from"./formatAdvisories-DwmUKYuc.mjs";import{readProjectConfigLiterals as zs}from"./loadProjectConfig-CKsFNgn3.mjs";import{s as $s}from"./paths-C-9fwEgQ.mjs";import{C as ce,o as Ut,j as Us,f as qs,k as Bs,b as js,c as Vs,m as Ws,e as Hs,p as Gs,d as Ys,i as Qs,l as Xs,g as Zs,q as Js,n as en,a as tn,h as sn}from"./emit-6YJU3YbV.mjs";import{isD1GlobalTable as qt,isHyperdriveGlobalTable as Bt}from"./isD1GlobalTable-udvHAAzD.mjs";import{discoverAgents as nn}from"./AGENTS_FILENAME-DoPI92Wu.mjs";import{discoverContainers as rn}from"./CONTAINERS_FILENAME-B6TFs82W.mjs";import on from"./discoverCrons-MfKw7IFf.mjs";import{diagnosticAt as ee}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{b as pe}from"./module-specifiers-WF8iAydP.mjs";import{listLunoraSourceFiles as p,bindingKeyName as Q,propertyKeyName as E,unwrapExpression as X,listSecurityScanFiles as me,objectLiteralFromCallbackBody as jt,propertyInitializer as b,lunoraRelativePath as x,collectCallRows as F,findObjectProperty as C,collectSecurityCallRows as an,limitNameOf as Vt,optionsObjectLiteral as Wt,isContextIdentifier as Fe,handlerOf as cn,isDatabaseAccessor as _,readTargetOf as Ht,enclosingExportName as ln}from"./listLunoraSourceFiles-DP-5e-RE.mjs";import un from"./readPackageDependencies-C6h6FZuP.mjs";import{discoverQueues as dn}from"./QUEUES_FILENAME-CxkPcMH1.mjs";import{discoverSandboxUsage as fn}from"./discoverSandboxUsage-CgmfgDTS.mjs";import gn from"./discoverStorageRulesMetadata-D8VYflWt.mjs";import{a as A,c as z,d as Gt,e as pn}from"./classify-procedure-call-BztLe76A.mjs";import{discoverWorkflows as mn}from"./WORKFLOWS_FILENAME-B_ZJxRSx.mjs";import{gatePlatformFeatures as hn,resolveCodegenTarget as vn,readTargetDiagnostics as xn}from"./DEFAULT_TARGET-CkKqxaOb.mjs";import{i as k,a as U,e as S,r as En,b as Sn,s as he,c as yn,f as An,d as bn}from"./queries-B-f4jO-x.mjs";import{r as ve,s as Nn}from"./parse-validator-C94Yiabo.mjs";import Pn from"./discoverAuthApiCalls-FxrdBeVt.mjs";import{i as wn,a as In,e as Tn,b as Cn,d as Fn,c as On}from"./unwrap-handler-return-CoV_GK33.mjs";import Rn from"./discoverFunctions-BsmX-sEq.mjs";import Ln from"./discoverHttpRoutes-BcXI9CNt.mjs";import Dn from"./discoverHyperdriveCalls-D9qXqTq3.mjs";import kn from"./discoverInserts-CFJ3IVeI.mjs";import{m as Me,a as ue,s as Yt,d as Mn}from"./index-BoaHhVtM.mjs";import{e as Qt}from"./exported-procedure-chains-CmCDiPBV.mjs";import Kn from"./discoverMigrations-DbrHwcGE.mjs";import{MUTATORS_FILENAME as _n,isDefineMutatorCallee as zn,discoverMutators as $n}from"./MUTATORS_FILENAME-B6cKrN_m.mjs";import Un from"./discoverNondeterministicCalls-CSQ_GDcA.mjs";import{discoverNotifyConfig as qn,discoverNotifyCalls as Bn}from"./NOTIFY_FILENAME-Cri3NT5U.mjs";import jn from"./discoverR2sqlCalls-fu7fC0i_.mjs";import Vn from"./discoverRlsProcedures-BO4qC77y.mjs";import Wn from"./discoverRlsMetadata-CPmAGL0W.mjs";import Hn from"./discoverSchema-QO1eQYjw.mjs";import{secretKindOf as Gn,redact as Yn,isHeuristicSecretKind as Qn,isSecretishName as Xn}from"./redact-Cy14LEnc.mjs";import{discoverShapes as Zn}from"./SHAPES_FILENAME-zJgzynXR.mjs";import{emitApp as Jn}from"./emitApp-
|
|
1
|
+
import{existsSync as w,mkdirSync as Rs,readFileSync as $t,writeFileSync as Ls,rmSync as Ds}from"node:fs";import{join as y,dirname as ae}from"node:path";import{performance as we}from"node:perf_hooks";import{runAdvisor as ks}from"@lunora/advisor";import{LunoraError as K}from"@lunora/errors";import{SyntaxKind as l,Node as o,VariableDeclarationKind as Ms,Project as dt}from"ts-morph";import{serializeSchemaSnapshot as Ks}from"./SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{toAdvisorContext as _s}from"./formatAdvisories-DwmUKYuc.mjs";import{readProjectConfigLiterals as zs}from"./loadProjectConfig-CKsFNgn3.mjs";import{s as $s}from"./paths-C-9fwEgQ.mjs";import{C as ce,o as Ut,j as Us,f as qs,k as Bs,b as js,c as Vs,m as Ws,e as Hs,p as Gs,d as Ys,i as Qs,l as Xs,g as Zs,q as Js,n as en,a as tn,h as sn}from"./emit-6YJU3YbV.mjs";import{isD1GlobalTable as qt,isHyperdriveGlobalTable as Bt}from"./isD1GlobalTable-udvHAAzD.mjs";import{discoverAgents as nn}from"./AGENTS_FILENAME-DoPI92Wu.mjs";import{discoverContainers as rn}from"./CONTAINERS_FILENAME-B6TFs82W.mjs";import on from"./discoverCrons-MfKw7IFf.mjs";import{diagnosticAt as ee}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{b as pe}from"./module-specifiers-WF8iAydP.mjs";import{listLunoraSourceFiles as p,bindingKeyName as Q,propertyKeyName as E,unwrapExpression as X,listSecurityScanFiles as me,objectLiteralFromCallbackBody as jt,propertyInitializer as b,lunoraRelativePath as x,collectCallRows as F,findObjectProperty as C,collectSecurityCallRows as an,limitNameOf as Vt,optionsObjectLiteral as Wt,isContextIdentifier as Fe,handlerOf as cn,isDatabaseAccessor as _,readTargetOf as Ht,enclosingExportName as ln}from"./listLunoraSourceFiles-DP-5e-RE.mjs";import un from"./readPackageDependencies-C6h6FZuP.mjs";import{discoverQueues as dn}from"./QUEUES_FILENAME-CxkPcMH1.mjs";import{discoverSandboxUsage as fn}from"./discoverSandboxUsage-CgmfgDTS.mjs";import gn from"./discoverStorageRulesMetadata-D8VYflWt.mjs";import{a as A,c as z,d as Gt,e as pn}from"./classify-procedure-call-BztLe76A.mjs";import{discoverWorkflows as mn}from"./WORKFLOWS_FILENAME-B_ZJxRSx.mjs";import{gatePlatformFeatures as hn,resolveCodegenTarget as vn,readTargetDiagnostics as xn}from"./DEFAULT_TARGET-CkKqxaOb.mjs";import{i as k,a as U,e as S,r as En,b as Sn,s as he,c as yn,f as An,d as bn}from"./queries-B-f4jO-x.mjs";import{r as ve,s as Nn}from"./parse-validator-C94Yiabo.mjs";import Pn from"./discoverAuthApiCalls-FxrdBeVt.mjs";import{i as wn,a as In,e as Tn,b as Cn,d as Fn,c as On}from"./unwrap-handler-return-CoV_GK33.mjs";import Rn from"./discoverFunctions-BsmX-sEq.mjs";import Ln from"./discoverHttpRoutes-BcXI9CNt.mjs";import Dn from"./discoverHyperdriveCalls-D9qXqTq3.mjs";import kn from"./discoverInserts-CFJ3IVeI.mjs";import{m as Me,a as ue,s as Yt,d as Mn}from"./index-BoaHhVtM.mjs";import{e as Qt}from"./exported-procedure-chains-CmCDiPBV.mjs";import Kn from"./discoverMigrations-DbrHwcGE.mjs";import{MUTATORS_FILENAME as _n,isDefineMutatorCallee as zn,discoverMutators as $n}from"./MUTATORS_FILENAME-B6cKrN_m.mjs";import Un from"./discoverNondeterministicCalls-CSQ_GDcA.mjs";import{discoverNotifyConfig as qn,discoverNotifyCalls as Bn}from"./NOTIFY_FILENAME-Cri3NT5U.mjs";import jn from"./discoverR2sqlCalls-fu7fC0i_.mjs";import Vn from"./discoverRlsProcedures-BO4qC77y.mjs";import Wn from"./discoverRlsMetadata-CPmAGL0W.mjs";import Hn from"./discoverSchema-QO1eQYjw.mjs";import{secretKindOf as Gn,redact as Yn,isHeuristicSecretKind as Qn,isSecretishName as Xn}from"./redact-Cy14LEnc.mjs";import{discoverShapes as Zn}from"./SHAPES_FILENAME-zJgzynXR.mjs";import{emitApp as Jn}from"./emitApp-BiATunRA.mjs";import{buildOpenApiDocument as er,emitOpenApiModule as tr}from"./buildOpenApiDocument-D1dd4rBh.mjs";import{buildOpenRpcDocument as sr,emitOpenRpcModule as nr}from"./OPENRPC_VERSION-DAxS0CaZ.mjs";import{buildSchemaSnapshot as rr}from"./SchemaSnapshotParseError-lUWe6lPo.mjs";const ft={error:"ERROR",info:"INFO",warn:"WARN"},gt={ERROR:2,INFO:0,WARN:1},ir=e=>({cacheKey:"advisor_min_severity_invalid",categories:["SCHEMA"],description:"`advisor.minSeverity` in `lunora.config.*` sets the lowest advisory level codegen reports and writes into `_generated/shard.ts`. Codegen reads it by parsing the file, so it has to be a string literal.",detail:e,facing:"INTERNAL",level:"WARN",metadata:{},name:"advisor_min_severity_invalid",remediation:'Set `advisor: { minSeverity: "info" | "warn" | "error" }` as a literal on the config\'s default export.',title:"`advisor.minSeverity` is not a level codegen can read, so every advisory was reported"}),or=(e,t)=>{const{advisor:s}=zs(e);if(s===void 0||s.minSeverity===void 0&&s.unreadable!==!0)return[...t];const{minSeverity:n}=s,i=n!==void 0&&Object.hasOwn(ft,n)?ft[n]:void 0;return i===void 0?[...t,ir(n===void 0?"`advisor.minSeverity` is not a string literal codegen can read without evaluating the config: a computed value or key, or a spread that could set or override it.":`\`advisor.minSeverity\` is "${n}", which is not one of "info", "warn" or "error".`)]:t.filter(r=>gt[r.level]>=gt[i])},pt=(e,t="api")=>{const s=new Map;for(const n of e){const i=$s(n),r=s.get(i);if(r===void 0){s.set(i,n);continue}if(r!==n){const a=t==="api"?`the generated api.ts would declare "${i}" twice and the dispatch key "${i}:<fn>" would be ambiguous`:`the generated api.ts would declare "${i}" twice in HttpStreamsRef and again in the httpStreams object literal`;throw new K("INTERNAL",`@lunora/codegen: "${r}" and "${n}" both map to the ${t} namespace "${i}" — ${a}. Rename one file so the two differ by more than a non-identifier character (\`-\`, \`.\`, \`/\` and \`_\` all sanitize to \`_\`).`,{status:500})}}},ar=(e,t={})=>{const{hasVectors:s=!0,scheduler:n=!1,storage:i=!1,usage:r}=t,a=[];e.tables.some(c=>qt(c))&&a.push({name:"@lunora/d1",reason:"`.global()` tables are D1-backed, so `_generated/app.ts` imports the D1 `ctx.db` adapter"}),e.tables.some(c=>Bt(c))&&a.push({name:"@lunora/hyperdrive",reason:'`.global({ backend: "hyperdrive" })` tables route through `@lunora/hyperdrive/global`'},{name:"@lunora/sql-store",reason:'`.global({ backend: "hyperdrive" })` makes `_generated/app.ts` import the `SqlCtxDbOptions` / `SqlExec` types'}),n&&a.push({name:"@lunora/scheduler",reason:"a declared cron (or `ctx.scheduler` use) makes `_generated/app.ts` import `createScheduler`"}),i&&a.push({name:"@lunora/storage",reason:"a `v.storage()` column, a storage access rule (or `ctx.storage` use) makes `_generated/app.ts` import `createStorage`"}),e.vectorIndexes.length>0&&s&&a.push({name:"@lunora/bindings",reason:"`.vectorize()` indexes make `_generated/shard.ts` import `@lunora/bindings/vectors`"});for(const c of r===void 0?[]:ce)c.requiredPackage!==void 0&&r?.[c.key]===!0&&a.push({name:c.requiredPackage,reason:`\`ctx.${c.contextProperty??c.key}\` usage makes \`_generated/\` import \`${c.moduleSpecifier}\``});return a.filter((c,u)=>a.findIndex(d=>d.name===c.name)===u)},cr=(e,t,s={})=>{if(t===void 0)return;const n=ar(e,s).filter(r=>!t.has(r.name));if(n.length===0)return;const i=n.map(r=>` - ${r.name} — ${r.reason}`).join(`
|
|
2
2
|
`);throw new K("INTERNAL",`@lunora/codegen: this schema's generated code imports packages the project does not declare:
|
|
3
3
|
${i}
|
|
4
4
|
|
|
@@ -338,7 +338,7 @@ let package = Package(
|
|
|
338
338
|
.target(name: "LunoraApi", dependencies: ["Lunora"]),
|
|
339
339
|
]
|
|
340
340
|
)
|
|
341
|
-
`,sr=new Set(["as","associatedtype","borrowing","break","case","catch","class","consuming","continue","default","defer","deinit","do","else","enum","extension","fallthrough","false","fileprivate","for","func","guard","if","import","in","init","inout","internal","is","let","nil","nonisolated","open","operator","precedencegroup","private","protocol","public","repeat","rethrows","return","self","static","struct","subscript","super","switch","throw","throws","true","try","typealias","var","where","while"]),G=e=>{const n=o(e),r=n.charAt(0).toLowerCase()+n.slice(1);return sr.has(r)?`\`${r}\``:r},or=e=>`[${e.map(n=>`["${n.map(r=>$(r)).join('", "')}"]`).join(", ")}]`,Ee=e=>p(e,{none:"nil",typed:()=>{const{nullable:n}=e.argsNullPaths;return n.length===0?"try LunoraClient.wireValue(args)":`try LunoraClient.wireValue(args, nullablePaths: ${or(n)})`},untyped:"args"}),ue=e=>{const n=p(e,{none:"shardKey: String? = nil",typed:s=>`_ args: ${s}, shardKey: String? = nil`,untyped:"_ args: Any, shardKey: String? = nil"}),r=Ee(e),t=e.resultType??"Any",a=`try client.${e.verb}("${$(e.functionPath)}", args: ${r}, shardKey: shardKey)`,i=e.resultType===void 0?`return ${a}`:[`let raw = ${a}`," let data =
|
|
341
|
+
`,sr=new Set(["as","associatedtype","borrowing","break","case","catch","class","consuming","continue","default","defer","deinit","do","else","enum","extension","fallthrough","false","fileprivate","for","func","guard","if","import","in","init","inout","internal","is","let","nil","nonisolated","open","operator","precedencegroup","private","protocol","public","repeat","rethrows","return","self","static","struct","subscript","super","switch","throw","throws","true","try","typealias","var","where","while"]),G=e=>{const n=o(e),r=n.charAt(0).toLowerCase()+n.slice(1);return sr.has(r)?`\`${r}\``:r},or=e=>`[${e.map(n=>`["${n.map(r=>$(r)).join('", "')}"]`).join(", ")}]`,Ee=e=>p(e,{none:"nil",typed:()=>{const{nullable:n}=e.argsNullPaths;return n.length===0?"try LunoraClient.wireValue(args)":`try LunoraClient.wireValue(args, nullablePaths: ${or(n)})`},untyped:"args"}),ue=e=>{const n=p(e,{none:"shardKey: String? = nil",typed:s=>`_ args: ${s}, shardKey: String? = nil`,untyped:"_ args: Any, shardKey: String? = nil"}),r=Ee(e),t=e.resultType??"Any",a=`try client.${e.verb}("${$(e.functionPath)}", args: ${r}, shardKey: shardKey)`,i=e.resultType===void 0?`return ${a}`:[`let raw = ${a}`," let data = Data(Wire.stableStringify(raw).utf8)",` return try JSONDecoder().decode(${e.resultType}.self, from: data)`].join(`
|
|
342
342
|
`);return[` /// ${l(e.summary)}`,` public func ${G(e.functionName)}(${n}) throws -> ${t} {`,` ${i}`," }"].join(`
|
|
343
343
|
`)},lr=e=>{const n=p(e,{none:"",typed:t=>`_ args: ${t}, `,untyped:"_ args: Any, "}),r=Ee(e);return[` /// live ${l(e.summary)} — re-runs on every write to the tables it reads.`," @discardableResult",` public func subscribe${o(e.functionName)}(`,` ${n}onData: ((Any) -> Void)?,`," onError: ((LunoraSubscriptionError) -> Void)? = nil,"," shardKey: String? = nil"," ) throws -> LunoraUnsubscribe {",` client.subscribe("${$(e.functionPath)}", args: ${r}, onData: onData, onError: onError, shardKey: shardKey)`," }"].join(`
|
|
344
344
|
`)},ur=e=>{const n=`${o(e.name)}API`,r=e.methods.map(t=>t.verb==="query"?`${ue(t)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as w,G as y}from"./emit-6YJU3YbV.mjs";const k=e=>`has${e.charAt(0).toUpperCase()}${e.slice(1)}`,b=w.map(({appMethod:e,key:t})=>[k(t),e.method,e.configKey,e.doc]),m=e=>b.some(([t])=>e[t]),S=e=>e?['import * as lunoraIdentityContract from "../identity.js";']:[],E=(e,t)=>e?['import type { CreateAccessResolverOptions } from "@lunora/cloudflare-access";',`import { createAccessResolver${t?", composeResolvers":""} } from "@lunora/cloudflare-access";`]:[],D=e=>e?['import { createKvIntrospectorFromEnv } from "@lunora/bindings/kv";']:[],x=e=>e?['import { createVectorAdminIntrospector } from "@lunora/bindings/vectors";']:[],R=e=>e?['import type { D1CtxDbOptions, D1DatabaseLike, D1Exec } from "@lunora/d1";','import { applyCdcChanges, createD1CtxDb, emitD1QueryCost, exportGlobalRows, facetGlobalColumn, importGlobalRows, listGlobalTables, readD1CdcChanges, readGlobalTablePage, retryingExec } from "@lunora/d1";']:[],A=e=>e?['import notifyConfig from "../notify.js";']:[],g=e=>(e.emailAgents?.length??0)>0,C=e=>g(e)?['import { dispatchAgentEmail } from "@lunora/agent/inbound";']:[],O=e=>g(e)?['import * as lunoraAgentDefinitions from "../agents.js";']:[],T=e=>{const{hasFramework:t,hasGlobal:a,hasHyperdriveGlobal:r,hasQueue:n,useUmbrella:i}=e,o=i?"lunorash/runtime":"@lunora/runtime",l=["ExecutionContextLike","HttpRouterLike","LunoraWorker","Route","ScheduledControllerLike","ShardNamespaceLike","WorkerOptions",...n?["TriggerTrace"]:[],...a?["GlobalIntrospector","AdminTableResolver"]:[],...t?["FrameworkHostHandler"]:[]],s=[...a||r?["createCrossShardRelationCapabilities"]:[],"createWorker","resolveLogArchiveFromEnv",...t?["withFrameworkWorker"]:[]].join(", ");return[`import type { ${[...l].toSorted((c,d)=>c.localeCompare(d)).join(", ")} } from "${o}";`,`import { ${s} } from "${o}";`]},I=e=>{const{hasAccess:t,hasAuth:a,hasGlobal:r,hasHyperdriveGlobal:n,hasKvIntrospector:i,hasQueue:o,hasScheduler:l,hasStorage:s,hasWorkflow:c,wantsOpenApi:d,wantsOpenRpc:h}=e;return[...a?['import type { AuthNamespaceLike, LunoraAuth, LunoraAuthOptions } from "@lunora/auth";','import { createAuth, createAuthAdmin, createAuthAuditReader, createDoAuthWiring, d1Executor, ensureMigrated, handleAuthRequest, lunoraD1Adapter } from "@lunora/auth";']:[],...E(t,a),...R(r),...n?['import type { HyperdriveEngine } from "@lunora/hyperdrive/global";','import { createHyperdriveGlobalCtxDb } from "@lunora/hyperdrive/global";','import type { SqlCtxDbOptions, SqlExec } from "@lunora/sql-store";']:[],...D(i),...x(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";']:[],...C(e),...T(e),"",...S(e.identity),...O(e),...r||n?['import schema from "../schema.js";']:[],...A(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";']:[],...d?['import { openApiSpec } from "./openapi.js";']:[],...h?['import { openRpcSpec } from "./openrpc.js";']:[],'import { createShardDO } from "./shard.js";',...e.hasVectors===!0?['import { LUNORA_VECTOR_INDEXES } from "./vectors.js";']:[]]},N=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. */\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}']:[]],L=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> = {};"]:[]," private shardSelector?: Selector<Env, ShardNamespaceLike>;",...e.hasSourcedTables?[' private sourceClientFactory?: NonNullable<ShardConfig["sourceClient"]>;']:[],...e.hasStorage?[" private storageDeclaration?: StorageDeclaration<Env>;"]:[]],q=e=>b.filter(([t])=>e[t]).map(([,t,a,r])=>` /** ${r} */
|
|
1
|
+
import{A as w,G as y}from"./emit-6YJU3YbV.mjs";const k=e=>`has${e.charAt(0).toUpperCase()}${e.slice(1)}`,b=w.map(({appMethod:e,key:t})=>[k(t),e.method,e.configKey,e.doc]),m=e=>b.some(([t])=>e[t]),S=e=>e?['import * as lunoraIdentityContract from "../identity.js";']:[],E=(e,t)=>e?['import type { CreateAccessResolverOptions } from "@lunora/cloudflare-access";',`import { createAccessResolver${t?", composeResolvers":""} } from "@lunora/cloudflare-access";`]:[],D=e=>e?['import { createKvIntrospectorFromEnv } from "@lunora/bindings/kv";']:[],x=e=>e?['import { createVectorAdminIntrospector } from "@lunora/bindings/vectors";']:[],R=e=>e?['import type { D1CtxDbOptions, D1DatabaseLike, D1Exec } from "@lunora/d1";','import { applyCdcChanges, createD1CtxDb, emitD1QueryCost, exportGlobalRows, facetGlobalColumn, importGlobalRows, listGlobalTables, readD1CdcChanges, readGlobalTablePage, retryingExec } from "@lunora/d1";']:[],A=e=>e?['import notifyConfig from "../notify.js";']:[],g=e=>(e.emailAgents?.length??0)>0,C=e=>g(e)?['import { dispatchAgentEmail } from "@lunora/agent/inbound";']:[],O=e=>g(e)?['import * as lunoraAgentDefinitions from "../agents.js";']:[],T=e=>{const{hasFramework:t,hasGlobal:a,hasHyperdriveGlobal:r,hasQueue:n,useUmbrella:i}=e,o=i?"lunorash/runtime":"@lunora/runtime",l=["ExecutionContextLike","HttpRouterLike","LunoraWorker","Route","ScheduledControllerLike","ShardNamespaceLike","WorkerOptions",...n?["TriggerTrace"]:[],...a?["GlobalIntrospector","AdminTableResolver"]:[],...t?["FrameworkHostHandler"]:[]],s=[...a||r?["createCrossShardRelationCapabilities"]:[],"createWorker",...e.jurisdiction?["declareAppJurisdiction"]:[],"resolveLogArchiveFromEnv",...t?["withFrameworkWorker"]:[]].join(", ");return[`import type { ${[...l].toSorted((c,d)=>c.localeCompare(d)).join(", ")} } from "${o}";`,`import { ${s} } from "${o}";`]},I=e=>{const{hasAccess:t,hasAuth:a,hasGlobal:r,hasHyperdriveGlobal:n,hasKvIntrospector:i,hasQueue:o,hasScheduler:l,hasStorage:s,hasWorkflow:c,wantsOpenApi:d,wantsOpenRpc:h}=e;return[...a?['import type { AuthNamespaceLike, LunoraAuth, LunoraAuthOptions } from "@lunora/auth";','import { createAuth, createAuthAdmin, createAuthAuditReader, createDoAuthWiring, d1Executor, ensureMigrated, handleAuthRequest, lunoraD1Adapter } from "@lunora/auth";']:[],...E(t,a),...R(r),...n?['import type { HyperdriveEngine } from "@lunora/hyperdrive/global";','import { createHyperdriveGlobalCtxDb } from "@lunora/hyperdrive/global";','import type { SqlCtxDbOptions, SqlExec } from "@lunora/sql-store";']:[],...D(i),...x(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";']:[],...C(e),...T(e),"",...S(e.identity),...O(e),...r||n?['import schema from "../schema.js";']:[],...A(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";']:[],...d?['import { openApiSpec } from "./openapi.js";']:[],...h?['import { openRpcSpec } from "./openrpc.js";']:[],'import { createShardDO } from "./shard.js";',...e.hasVectors===!0?['import { LUNORA_VECTOR_INDEXES } from "./vectors.js";']:[]]},N=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. */\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}']:[]],L=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> = {};"]:[]," private shardSelector?: Selector<Env, ShardNamespaceLike>;",...e.hasSourcedTables?[' private sourceClientFactory?: NonNullable<ShardConfig["sourceClient"]>;']:[],...e.hasStorage?[" private storageDeclaration?: StorageDeclaration<Env>;"]:[]],q=e=>b.filter(([t])=>e[t]).map(([,t,a,r])=>` /** ${r} */
|
|
2
2
|
public ${t}(factory: (env: Env) => ReturnType<NonNullable<ShardConfig["${a}"]>>): this {
|
|
3
3
|
this.shardExtras.${a} = factory as NonNullable<ShardConfig["${a}"]>;
|
|
4
4
|
|
|
@@ -698,7 +698,12 @@ type Selector<Env, T> = (env: Env) => T | undefined;
|
|
|
698
698
|
|
|
699
699
|
/** The generated \`createShardDO\` config — \`.observability()\`, \`.maxRelationKeys()\` and the long-tail \`.ai()\` / \`.kv()\` / … methods pass straight through to it. */
|
|
700
700
|
type ShardConfig = NonNullable<Parameters<typeof createShardDO>[0]>;
|
|
701
|
-
|
|
701
|
+
${t.jurisdiction?`
|
|
702
|
+
// Module scope, so every isolate loading this script (the worker and each Durable
|
|
703
|
+
// Object class it exports) knows the schema's jurisdiction before a request runs.
|
|
704
|
+
// \`@lunora/mail\` reads it to pin its shard RPC like every other DO path.
|
|
705
|
+
declareAppJurisdiction(${JSON.stringify(t.jurisdiction)});
|
|
706
|
+
`:""}
|
|
702
707
|
${r.join(`
|
|
703
708
|
|
|
704
709
|
`)}${r.length>0?`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/codegen",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.226",
|
|
4
4
|
"description": "Code generator for Lunora: emits _generated/{api,server,dataModel}.ts from your schema",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@lunora/advisor": "1.0.0-alpha.163",
|
|
50
|
-
"@lunora/agent": "1.0.0-alpha.
|
|
50
|
+
"@lunora/agent": "1.0.0-alpha.145",
|
|
51
51
|
"@lunora/container": "1.0.0-alpha.60",
|
|
52
52
|
"@lunora/errors": "1.0.0-alpha.44",
|
|
53
53
|
"@lunora/platform": "1.0.0-alpha.40",
|