@lunora/codegen 1.0.0-alpha.275 → 1.0.0-alpha.276

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.mjs CHANGED
@@ -1 +1 @@
1
- import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as a,serializeSchemaSnapshot as s}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{formatAdvisories as m,lintSchema as f,toAdvisorContext as d}from"./packem_shared/formatAdvisories-DwmUKYuc.mjs";import{describeErrorLevelFindings as l,errorAdvisoryNames as n,errorPlatformDiagnosticNames as c,sortedUniqueNames as x}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-brcmKenl.mjs";import{CodegenDiagnosticError as A,diagnosticAt as v}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as C,discoverAgents as N}from"./packem_shared/AGENTS_FILENAME-NQIB6wh3.mjs";import{isTestPath as R,listLunoraSourceFiles as T}from"./packem_shared/isTestPath-CgyyLk8U.mjs";import{default as _}from"./packem_shared/discoverAuthApiCalls-XK_WCMDG.mjs";import{CONTAINERS_FILENAME as L,discoverContainers as M}from"./packem_shared/CONTAINERS_FILENAME-CK3xJGwm.mjs";import{default as P}from"./packem_shared/discoverCrons-B5bVCaNF.mjs";import{capabilitiesUsedBy as b,foldCapabilitySignals as U,mayReadCapabilityContext as y,sourceCapabilitySignals as G}from"./packem_shared/capabilitiesUsedBy-FnnYmnSl.mjs";import{FLAGS_FILENAME as j,discoverFlags as B}from"./packem_shared/FLAGS_FILENAME-DYMd1xqw.mjs";import{default as W}from"./packem_shared/discoverFunctions-Be-XuuSW.mjs";import{default as V}from"./packem_shared/discoverHttpRoutes-CMOxt2Y9.mjs";import{default as Q}from"./packem_shared/discoverHyperdriveCalls-mrho5AnY.mjs";import{default as w}from"./packem_shared/discoverInserts-BhIpUWXN.mjs";import{d as Y}from"./packem_shared/index-CefI-Sba.mjs";import{default as Z}from"./packem_shared/discoverMigrations-dVVZtuJa.mjs";import{MUTATORS_FILENAME as ee,discoverMutators as re}from"./packem_shared/MUTATORS_FILENAME-BrEGrcPU.mjs";import{default as te}from"./packem_shared/discoverNondeterministicCalls-Dtb1aoGV.mjs";import{NOTIFY_FILENAME as se,discoverNotifyCalls as ie,discoverNotifyConfig as me}from"./packem_shared/NOTIFY_FILENAME-B42rW2NJ.mjs";import{default as de}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as le}from"./packem_shared/discoverQueries-BSOjEsk3.mjs";import{QUEUES_FILENAME as ce,discoverQueues as xe}from"./packem_shared/QUEUES_FILENAME-Dj5yK34Z.mjs";import{default as Ee}from"./packem_shared/discoverR2sqlCalls-KONCqZr2.mjs";import{default as Ae}from"./packem_shared/discoverRlsProcedures-c0DnIR4z.mjs";import{default as ge}from"./packem_shared/discoverRlsMetadata-9YDlDDoh.mjs";import{discoverSandboxUsage as Ne}from"./packem_shared/discoverSandboxUsage-CfEU2hM-.mjs";import{default as Re}from"./packem_shared/discoverSchema-BTFFWy3i.mjs";import{readServiceBindings as Ie,resolveServiceBindings as _e}from"./packem_shared/readServiceBindings-DuE9xlvV.mjs";import{SHAPES_FILENAME as Le,discoverShapes as Me}from"./packem_shared/SHAPES_FILENAME-CVc2VCnS.mjs";import{default as Pe}from"./packem_shared/discoverStorageRulesMetadata-f89BWody.mjs";import{WORKFLOWS_FILENAME as be,discoverWorkflows as Ue}from"./packem_shared/WORKFLOWS_FILENAME-Ze98LsB3.mjs";import{emitApp as Ge}from"./packem_shared/emitApp-DUGS6Ve2.mjs";import{isD1GlobalTable as je,isHyperdriveGlobalTable as Be}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as We,emitOpenApi as Ke,emitOpenApiModule as Ve}from"./packem_shared/buildOpenApiDocument-BjHdW7b2.mjs";import{OPENRPC_VERSION as Qe,buildOpenRpcDocument as qe,emitOpenRpc as we,emitOpenRpcModule as Je}from"./packem_shared/OPENRPC_VERSION-BaD2A2YR.mjs";import{DEFAULT_TARGET as Xe,platformMatrixIds as Ze,readProjectTarget as $e,resolveCodegenTarget as er}from"./packem_shared/DEFAULT_TARGET-rlz3WdHe.mjs";import{l as or,r as tr}from"./packem_shared/project-config-file-Bv2l-Kmm.mjs";import{SCHEMA_SNAPSHOT_FILENAME as sr,createCodegenProject as ir,findTsconfig as mr,refreshCodegenProject as fr,runCodegen as dr}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-DWriXOYw.mjs";import{SchemaSnapshotParseError as lr,buildSchemaSnapshot as nr,evaluateSchemaDrift as cr,parseSchemaSnapshot as xr}from"./packem_shared/SchemaSnapshotParseError-CPOXlFhI.mjs";import{default as Er}from"./packem_shared/fingerprintSchemaSources-BJSIxwhY.mjs";import{schemaFromIr as Ar}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as gr,validatorIrToJsonSchema as Cr}from"./packem_shared/LUNORA_ERROR_CODES-C2s0xWQD.mjs";import{SDK_LANGUAGES as Or,SDK_TARGETS as Rr,generateSdk as Tr}from"./packem_shared/SDK_LANGUAGES-Df_CnJx5.mjs";import{redact as _r,secretKindOf as hr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as Mr}from"./packem_shared/emitDrizzleSchema-DLtfKTI4.mjs";import{default as Pr}from"./packem_shared/emitFunctions-DkkcTDqh.mjs";import{e as br}from"./packem_shared/server-BmY5wwKY.mjs";import{e as yr}from"./packem_shared/shard-Dr5gMNyz.mjs";import{G as Hr}from"./packem_shared/shared-Be3TGzxM.mjs";import{MESSAGE_SOLUTIONS as Br,findSolutionByMessage as kr}from"@lunora/errors";import{PROJECT_CONFIG_FILENAMES as Kr,findProjectConfigFile as Vr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs";import{s as Qr,t as qr,u as wr}from"./packem_shared/shard-runtime-BI2SZ54Z.mjs";import{emitApi as Yr,emitCollections as Xr,emitInternalApi as Zr}from"./packem_shared/emitApi-zY6egN77.mjs";import{emitCrons as eo,emitScheduler as ro,emitVectors as oo,emitWranglerCronTriggers as to}from"./packem_shared/emitCrons-B8TBAOZ4.mjs";import{emitDataModel as so}from"./packem_shared/emitDataModel-B68T_eX6.mjs";import{isTypedSchema as mo}from"./packem_shared/isTypedSchema-CKzc3ioR.mjs";const e="0.0.0";export{C as AGENTS_FILENAME,E as CAPABILITY_PROBES,L as CONTAINERS_FILENAME,A as CodegenDiagnosticError,Xe as DEFAULT_TARGET,j as FLAGS_FILENAME,Hr as GENERATED_HEADER,gr as LUNORA_ERROR_CODES,Br as LUNORA_SOLUTION_RULES,ee as MUTATORS_FILENAME,se as NOTIFY_FILENAME,Qe as OPENRPC_VERSION,Kr as PROJECT_CONFIG_FILENAMES,ce as QUEUES_FILENAME,sr as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Or as SDK_LANGUAGES,Rr as SDK_TARGETS,Le as SHAPES_FILENAME,lr as SchemaSnapshotParseError,e as VERSION,be as WORKFLOWS_FILENAME,We as buildOpenApiDocument,qe as buildOpenRpcDocument,nr as buildSchemaSnapshot,b as capabilitiesUsedBy,ir as createCodegenProject,l as describeErrorLevelFindings,v as diagnosticAt,a as diffSchemaSnapshots,N as discoverAgents,_ as discoverAuthApiCalls,M as discoverContainers,P as discoverCrons,B as discoverFlags,W as discoverFunctions,V as discoverHttpRoutes,Q as discoverHyperdriveCalls,w as discoverInserts,Y as discoverMaskProcedures,Z as discoverMigrations,re as discoverMutators,te as discoverNondeterministicCalls,ie as discoverNotifyCalls,me as discoverNotifyConfig,le as discoverQueries,xe as discoverQueues,Ee as discoverR2sqlCalls,ge as discoverRlsMetadata,Ae as discoverRlsProcedures,Ne as discoverSandboxUsage,Re as discoverSchema,Me as discoverShapes,Pe as discoverStorageRulesMetadata,Ue as discoverWorkflows,Qr as emitAgents,Yr as emitApi,Ge as emitApp,Xr as emitCollections,qr as emitContainers,eo as emitCrons,so as emitDataModel,Mr as emitDrizzleSchema,Pr as emitFunctions,Zr as emitInternalApi,Ke as emitOpenApi,Ve as emitOpenApiModule,we as emitOpenRpc,Je as emitOpenRpcModule,ro as emitScheduler,br as emitServer,yr as emitShard,oo as emitVectors,wr as emitWorkflows,to as emitWranglerCronTriggers,n as errorAdvisoryNames,c as errorPlatformDiagnosticNames,cr as evaluateSchemaDrift,kr as findLunoraSolution,Vr as findProjectConfigFile,mr as findTsconfig,Er as fingerprintSchemaSources,U as foldCapabilitySignals,m as formatAdvisories,Tr as generateSdk,je as isD1GlobalTable,Be as isHyperdriveGlobalTable,R as isTestPath,mo as isTypedSchema,f as lintSchema,T as listLunoraSourceFiles,or as loadProjectConfig,y as mayReadCapabilityContext,xr as parseSchemaSnapshot,Ze as platformMatrixIds,de as readPackageDependencies,tr as readProjectConfigLiterals,$e as readProjectTarget,Ie as readServiceBindings,_r as redact,fr as refreshCodegenProject,er as resolveCodegenTarget,_e as resolveServiceBindings,dr as runCodegen,Ar as schemaFromIr,hr as secretKindOf,s as serializeSchemaSnapshot,x as sortedUniqueNames,G as sourceCapabilitySignals,d as toAdvisorContext,Cr as validatorIrToJsonSchema};
1
+ import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as a,serializeSchemaSnapshot as s}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{formatAdvisories as m,lintSchema as f,toAdvisorContext as d}from"./packem_shared/formatAdvisories-DwmUKYuc.mjs";import{describeErrorLevelFindings as l,errorAdvisoryNames as n,errorPlatformDiagnosticNames as c,sortedUniqueNames as x}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-brcmKenl.mjs";import{CodegenDiagnosticError as A,diagnosticAt as v}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as C,discoverAgents as N}from"./packem_shared/AGENTS_FILENAME-NQIB6wh3.mjs";import{isTestPath as R,listLunoraSourceFiles as T}from"./packem_shared/isTestPath-CgyyLk8U.mjs";import{default as _}from"./packem_shared/discoverAuthApiCalls-XK_WCMDG.mjs";import{CONTAINERS_FILENAME as L,discoverContainers as M}from"./packem_shared/CONTAINERS_FILENAME-CK3xJGwm.mjs";import{default as P}from"./packem_shared/discoverCrons-B5bVCaNF.mjs";import{capabilitiesUsedBy as b,foldCapabilitySignals as U,mayReadCapabilityContext as y,sourceCapabilitySignals as G}from"./packem_shared/capabilitiesUsedBy-FnnYmnSl.mjs";import{FLAGS_FILENAME as j,discoverFlags as B}from"./packem_shared/FLAGS_FILENAME-DYMd1xqw.mjs";import{default as W}from"./packem_shared/discoverFunctions-Be-XuuSW.mjs";import{default as V}from"./packem_shared/discoverHttpRoutes-CMOxt2Y9.mjs";import{default as Q}from"./packem_shared/discoverHyperdriveCalls-mrho5AnY.mjs";import{default as w}from"./packem_shared/discoverInserts-BhIpUWXN.mjs";import{d as Y}from"./packem_shared/index-CefI-Sba.mjs";import{default as Z}from"./packem_shared/discoverMigrations-dVVZtuJa.mjs";import{MUTATORS_FILENAME as ee,discoverMutators as re}from"./packem_shared/MUTATORS_FILENAME-BrEGrcPU.mjs";import{default as te}from"./packem_shared/discoverNondeterministicCalls-Dtb1aoGV.mjs";import{NOTIFY_FILENAME as se,discoverNotifyCalls as ie,discoverNotifyConfig as me}from"./packem_shared/NOTIFY_FILENAME-B42rW2NJ.mjs";import{default as de}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as le}from"./packem_shared/discoverQueries-BSOjEsk3.mjs";import{QUEUES_FILENAME as ce,discoverQueues as xe}from"./packem_shared/QUEUES_FILENAME-Dj5yK34Z.mjs";import{default as Ee}from"./packem_shared/discoverR2sqlCalls-KONCqZr2.mjs";import{default as Ae}from"./packem_shared/discoverRlsProcedures-c0DnIR4z.mjs";import{default as ge}from"./packem_shared/discoverRlsMetadata-9YDlDDoh.mjs";import{discoverSandboxUsage as Ne}from"./packem_shared/discoverSandboxUsage-CfEU2hM-.mjs";import{default as Re}from"./packem_shared/discoverSchema-BTFFWy3i.mjs";import{readServiceBindings as Ie,resolveServiceBindings as _e}from"./packem_shared/readServiceBindings-DuE9xlvV.mjs";import{SHAPES_FILENAME as Le,discoverShapes as Me}from"./packem_shared/SHAPES_FILENAME-CVc2VCnS.mjs";import{default as Pe}from"./packem_shared/discoverStorageRulesMetadata-f89BWody.mjs";import{WORKFLOWS_FILENAME as be,discoverWorkflows as Ue}from"./packem_shared/WORKFLOWS_FILENAME-Ze98LsB3.mjs";import{emitApp as Ge}from"./packem_shared/emitApp-DUGS6Ve2.mjs";import{isD1GlobalTable as je,isHyperdriveGlobalTable as Be}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as We,emitOpenApi as Ke,emitOpenApiModule as Ve}from"./packem_shared/buildOpenApiDocument-BjHdW7b2.mjs";import{OPENRPC_VERSION as Qe,buildOpenRpcDocument as qe,emitOpenRpc as we,emitOpenRpcModule as Je}from"./packem_shared/OPENRPC_VERSION-BaD2A2YR.mjs";import{DEFAULT_TARGET as Xe,platformMatrixIds as Ze,readProjectTarget as $e,resolveCodegenTarget as er}from"./packem_shared/DEFAULT_TARGET-GPPgJNTn.mjs";import{l as or,r as tr}from"./packem_shared/project-config-file-Bv2l-Kmm.mjs";import{SCHEMA_SNAPSHOT_FILENAME as sr,createCodegenProject as ir,findTsconfig as mr,refreshCodegenProject as fr,runCodegen as dr}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-CaONLqHU.mjs";import{SchemaSnapshotParseError as lr,buildSchemaSnapshot as nr,evaluateSchemaDrift as cr,parseSchemaSnapshot as xr}from"./packem_shared/SchemaSnapshotParseError-CPOXlFhI.mjs";import{default as Er}from"./packem_shared/fingerprintSchemaSources-BJSIxwhY.mjs";import{schemaFromIr as Ar}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as gr,validatorIrToJsonSchema as Cr}from"./packem_shared/LUNORA_ERROR_CODES-C2s0xWQD.mjs";import{SDK_LANGUAGES as Or,SDK_TARGETS as Rr,generateSdk as Tr}from"./packem_shared/SDK_LANGUAGES-Df_CnJx5.mjs";import{redact as _r,secretKindOf as hr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as Mr}from"./packem_shared/emitDrizzleSchema-DLtfKTI4.mjs";import{default as Pr}from"./packem_shared/emitFunctions-DkkcTDqh.mjs";import{e as br}from"./packem_shared/server-BmY5wwKY.mjs";import{e as yr}from"./packem_shared/shard-Dr5gMNyz.mjs";import{G as Hr}from"./packem_shared/shared-Be3TGzxM.mjs";import{MESSAGE_SOLUTIONS as Br,findSolutionByMessage as kr}from"@lunora/errors";import{PROJECT_CONFIG_FILENAMES as Kr,findProjectConfigFile as Vr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs";import{s as Qr,t as qr,u as wr}from"./packem_shared/shard-runtime-BI2SZ54Z.mjs";import{emitApi as Yr,emitCollections as Xr,emitInternalApi as Zr}from"./packem_shared/emitApi-zY6egN77.mjs";import{emitCrons as eo,emitScheduler as ro,emitVectors as oo,emitWranglerCronTriggers as to}from"./packem_shared/emitCrons-B8TBAOZ4.mjs";import{emitDataModel as so}from"./packem_shared/emitDataModel-B68T_eX6.mjs";import{isTypedSchema as mo}from"./packem_shared/isTypedSchema-CKzc3ioR.mjs";const e="0.0.0";export{C as AGENTS_FILENAME,E as CAPABILITY_PROBES,L as CONTAINERS_FILENAME,A as CodegenDiagnosticError,Xe as DEFAULT_TARGET,j as FLAGS_FILENAME,Hr as GENERATED_HEADER,gr as LUNORA_ERROR_CODES,Br as LUNORA_SOLUTION_RULES,ee as MUTATORS_FILENAME,se as NOTIFY_FILENAME,Qe as OPENRPC_VERSION,Kr as PROJECT_CONFIG_FILENAMES,ce as QUEUES_FILENAME,sr as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Or as SDK_LANGUAGES,Rr as SDK_TARGETS,Le as SHAPES_FILENAME,lr as SchemaSnapshotParseError,e as VERSION,be as WORKFLOWS_FILENAME,We as buildOpenApiDocument,qe as buildOpenRpcDocument,nr as buildSchemaSnapshot,b as capabilitiesUsedBy,ir as createCodegenProject,l as describeErrorLevelFindings,v as diagnosticAt,a as diffSchemaSnapshots,N as discoverAgents,_ as discoverAuthApiCalls,M as discoverContainers,P as discoverCrons,B as discoverFlags,W as discoverFunctions,V as discoverHttpRoutes,Q as discoverHyperdriveCalls,w as discoverInserts,Y as discoverMaskProcedures,Z as discoverMigrations,re as discoverMutators,te as discoverNondeterministicCalls,ie as discoverNotifyCalls,me as discoverNotifyConfig,le as discoverQueries,xe as discoverQueues,Ee as discoverR2sqlCalls,ge as discoverRlsMetadata,Ae as discoverRlsProcedures,Ne as discoverSandboxUsage,Re as discoverSchema,Me as discoverShapes,Pe as discoverStorageRulesMetadata,Ue as discoverWorkflows,Qr as emitAgents,Yr as emitApi,Ge as emitApp,Xr as emitCollections,qr as emitContainers,eo as emitCrons,so as emitDataModel,Mr as emitDrizzleSchema,Pr as emitFunctions,Zr as emitInternalApi,Ke as emitOpenApi,Ve as emitOpenApiModule,we as emitOpenRpc,Je as emitOpenRpcModule,ro as emitScheduler,br as emitServer,yr as emitShard,oo as emitVectors,wr as emitWorkflows,to as emitWranglerCronTriggers,n as errorAdvisoryNames,c as errorPlatformDiagnosticNames,cr as evaluateSchemaDrift,kr as findLunoraSolution,Vr as findProjectConfigFile,mr as findTsconfig,Er as fingerprintSchemaSources,U as foldCapabilitySignals,m as formatAdvisories,Tr as generateSdk,je as isD1GlobalTable,Be as isHyperdriveGlobalTable,R as isTestPath,mo as isTypedSchema,f as lintSchema,T as listLunoraSourceFiles,or as loadProjectConfig,y as mayReadCapabilityContext,xr as parseSchemaSnapshot,Ze as platformMatrixIds,de as readPackageDependencies,tr as readProjectConfigLiterals,$e as readProjectTarget,Ie as readServiceBindings,_r as redact,fr as refreshCodegenProject,er as resolveCodegenTarget,_e as resolveServiceBindings,dr as runCodegen,Ar as schemaFromIr,hr as secretKindOf,s as serializeSchemaSnapshot,x as sortedUniqueNames,G as sourceCapabilitySignals,d as toAdvisorContext,Cr as validatorIrToJsonSchema};
@@ -0,0 +1 @@
1
+ import{NODE_CAPABILITIES as f,CLOUDFLARE_CAPABILITIES as h,CELLD_CAPABILITIES as b}from"@lunora/platform";import{r as g}from"./project-config-file-Bv2l-Kmm.mjs";const d="cloudflare",v=t=>{const{target:e}=g(t);return e!==void 0&&e.length>0?e:void 0},A=(t,e)=>e??v(t)??d,L=(t,e)=>{if(e!==void 0)return[];const{target:a,unreadable:r}=g(t);return r!==!0||a!==void 0?[]:[{level:"warn",message:`lunora.config declares a \`target\` that codegen cannot read without evaluating it, so the "${d}" surface was emitted. \`runCodegen\` resolves the target synchronously, which means it reads literals only.`,name:"platform_unreadable_target",remediation:`Write \`target\` as a string literal on the config's default export (\`export default { target: "${d}" }\`), or pass \`--target\`.`,target:d}]},u={celld:b,cloudflare:h,node:f},C=()=>Object.keys(u).toSorted((t,e)=>t.localeCompare(e)),S={access:null,ai:"ai",aiSearch:"aiSearch",analytics:"analytics",analyticsSql:"analyticsSql",artifacts:"artifacts",browser:"browser",container:"containers",flags:null,hyperdrive:"hyperdrive",images:"images",kv:"keyValueStore",mail:"mail",notify:null,payments:null,pipelines:"pipelines",r2sql:null,scheduler:"scheduler",storage:"objectStorage",vectors:"vectorStore",workflows:"workflows",x402:"secrets"},w=["agents","commitOrderedTables","containerEgressPolicy","containerRuntimeScheduling","containerSandboxTools","cronTriggers","crossShardFanout","durableStreams","globalTables","queues","relationGraph","secrets","services","topics","vectorStore","workerLoaders","workflowRollback","workflowSchedules"],m={agents:"durable agents (`defineAgent`)",commitOrderedTables:"commit-ordered tables (`.commitOrdered()`)",containerEgressPolicy:"container egress policies (`defineContainer({ allowedHosts | deniedHosts | interceptHttps })`)",containerRuntimeScheduling:'per-instance container images and snapshots (`defineContainer({ schedulingPolicy: "durable_object" })`)',containerSandboxTools:"container sandbox helpers — files, directory backups, bucket mounts (`defineContainer({ sandbox: true })`)",cronTriggers:"declared cron triggers (`cronJobs()`)",crossShardFanout:"cross-shard fan-out queries (a `.shardBy(...)` schema)",durableStreams:"durable streams (`.stream(handler, { durable: true })`)",globalTables:"global tables (`.global()`)",queues:"queues (`defineQueue`)",relationGraph:"relation-graph traversal (`ctx.db.related`, derived from `v.id(...)` columns)",secrets:"the secrets store (`ctx.secrets`)",services:"service bindings to sibling Workers (`lunora.config` `services`)",topics:"pub/sub topics (`defineTopic` / `defineSubscription`)",vectorStore:"vector indexes (`.vectorize()`)",workerLoaders:"sandboxed agent scripts (`jsCodeTool`, on Worker Loaders)",workflowRollback:"workflow step rollback (`defineStep({ rollback })`)",workflowSchedules:"scheduled workflow instances (`defineWorkflow({ schedules })`)"},y=(t,e,a)=>({level:"error",message:`${e.name} does not support ${m[t]}, which this app declares.`,name:"platform_unsupported_feature",remediation:`Remove the declaration, or deploy to a target whose capability matrix marks "${t}" as native or emulated.`,target:a}),T=(t,e,a)=>({level:"error",message:`${e.name}'s capability matrix does not declare a support level for ${m[t]}, which this app declares. Treated as unsupported.`,name:"platform_undeclared_feature",remediation:`Rate "${t}" in the ${e.name} capability matrix as "native", "emulated", or "unsupported" — an undeclared feature fails closed rather than letting the app deploy onto a primitive the host may not provide.`,target:a}),k=t=>{const{diagnostics:e,gatedSignals:a,matrix:r,reported:n,signals:c,target:i}=t;for(const s of w){if(c[s]!==!0)continue;const o=r.features[s]?.level;o!=="unsupported"&&o!==void 0||(a[s]=!1,!n.has(s)&&e.push(o==="unsupported"?y(s,r,i):T(s,r,i)))}},_=(t,e,a,r={})=>{const n={...t},c={...r},i=[],s=new Set;for(const[o,l]of Object.entries(S)){if(l===null||!t[o])continue;const p=e.features[l]?.level;p==="unsupported"?(n[o]=!1,s.add(l),i.push({feature:o,level:"error",message:`${e.name} does not support "${o}" (ctx.${o}).`,name:"platform_unsupported_feature",remediation:`Remove the ctx.${o} usage, or deploy to a target whose capability matrix marks "${l}" as native or emulated.`,target:a})):p===void 0&&(n[o]=!1,s.add(l),i.push({feature:o,level:"error",message:`${e.name}'s capability matrix does not declare a support level for "${o}" (ctx.${o}). Treated as unsupported.`,name:"platform_undeclared_feature",remediation:`Rate "${l}" in the ${e.name} capability matrix as "native", "emulated", or "unsupported" — an undeclared feature fails closed rather than shipping a surface the host may not provide.`,target:a}))}return k({diagnostics:i,gatedSignals:c,matrix:e,reported:s,signals:r,target:a}),{diagnostics:i,signals:c,usage:n}},E=(t,e,a={})=>{const r=u[e];return r===void 0?{diagnostics:[{level:"error",message:`Unknown deploy target "${e}" — no capability matrix is registered for it. Codegen emitted the full Cloudflare surface un-gated.`,name:"platform_unknown_target",remediation:`Use a registered target (${Object.keys(u).join(", ")}) or install the target's @lunora/platform-${e} package.`,target:e}],signals:{...a},usage:{...t}}:_(t,r,e,a)},I=t=>{const e=u[t];if(e===void 0)return;const a=Object.entries(e.features).filter(([,r])=>r.level==="unsupported").map(([r])=>r).toSorted((r,n)=>r.localeCompare(n));return{id:e.id,name:e.name,unsupported:a}};export{S as CAPABILITY_TO_FEATURE,d as DEFAULT_TARGET,_ as gateAgainstMatrix,E as gatePlatformFeatures,C as platformMatrixIds,v as readProjectTarget,L as readTargetDiagnostics,A as resolveCodegenTarget,I as studioPlatformFor};
@@ -1,4 +1,4 @@
1
- import{existsSync as R,mkdirSync as Us,rmSync as lt,readdirSync as er,readFileSync as tr,writeFileSync as sr}from"node:fs";import{join as h,dirname as fe,relative as nr}from"node:path";import{performance as et}from"node:perf_hooks";import{runAdvisor as rr}from"@lunora/advisor";import{LunoraError as Y}from"@lunora/errors";import{readJsonSync as ir}from"@visulima/fs";import{SyntaxKind as d,Node as i,Project as ts}from"ts-morph";import{serializeSchemaSnapshot as or}from"./SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{toAdvisorContext as ar}from"./formatAdvisories-DwmUKYuc.mjs";import{r as cr,a as S,s as lr,b as dr}from"./project-config-file-Bv2l-Kmm.mjs";import{a as Ce,d as ur,r as fr}from"./modules-BIpFLz3Z.mjs";import{WORKFLOWS_FILENAME as pr,discoverWorkflows as gr}from"./WORKFLOWS_FILENAME-Ze98LsB3.mjs";import{r as mr}from"./json-data-Chfs2Cz5.mjs";import{n as hr,s as js}from"./paths-DwTjD7BU.mjs";import{G as vr}from"./shared-Be3TGzxM.mjs";import{CAPABILITIES as Er,usedCapabilities as xr}from"./CAPABILITY_PROBES-brcmKenl.mjs";import{isD1GlobalTable as Vs,isHyperdriveGlobalTable as qs}from"./isD1GlobalTable-udvHAAzD.mjs";import{discoverAgents as Sr}from"./AGENTS_FILENAME-NQIB6wh3.mjs";import{discoverContainers as yr}from"./CONTAINERS_FILENAME-CK3xJGwm.mjs";import Ar from"./discoverCrons-B5bVCaNF.mjs";import{diagnosticAt as Ee}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{b as Be}from"./module-specifiers-WF8iAydP.mjs";import{a as Ws,b as q,d as $,f as F,g as At,c as v,w as bt,k as br,l as Nr,h as Pr,j as dt,i as wr}from"./attribution-Dw35rOaJ.mjs";import{contextPropertiesRead as Ir,discoverFeatureUsage as Cr}from"./capabilitiesUsedBy-FnnYmnSl.mjs";import Tr from"./readPackageDependencies-RHhGiz0k.mjs";import{listLunoraSourceFiles as x,unwrapExpression as E,listSecurityScanFiles as $e,objectLiteralFromCallbackBody as Hs,propertyInitializer as I,lunoraRelativePath as C,bindingKeyName as xe,collectCallRows as T,findObjectProperty as L,collectSecurityCallRows as Or,collectNodeRows as ut,RUN_METHODS as Gs,functionKeyOf as Ys,limitNameOf as Qs,optionsObjectLiteral as Xs,handlerOf as Rr,chainRootOf as Nt,outermostValueWrapper as P,isWriteTarget as Ue,isSameNode as me,isConstDeclaration as Z,returningFunctionOf as ft,walkChain as kr,memberAccessOf as Fr,functionReferenceSegments as Dr,isTestPath as Lr}from"./isTestPath-CgyyLk8U.mjs";import{discoverQueueDeclarations as Mr}from"./QUEUES_FILENAME-Dj5yK34Z.mjs";import{discoverSandboxUsage as _r}from"./discoverSandboxUsage-CfEU2hM-.mjs";import{resolveServiceBindings as Kr}from"./readServiceBindings-DuE9xlvV.mjs";import zr from"./discoverStorageRulesMetadata-f89BWody.mjs";import{a as y,c as W,d as Js,e as Br}from"./classify-procedure-call-DxuPQkJA.mjs";import{i as $r}from"./ir-DBSvhNa-.mjs";import{gatePlatformFeatures as Ur,resolveCodegenTarget as Zs,readTargetDiagnostics as jr,studioPlatformFor as Vr}from"./DEFAULT_TARGET-rlz3WdHe.mjs";import{b as en,e as qr}from"./shard-Dr5gMNyz.mjs";import{e as Wr,a as Hr}from"./server-BmY5wwKY.mjs";import{emitDataModel as Gr}from"./emitDataModel-B68T_eX6.mjs";import{a as ss,r as tt,i as j,b as Yr,m as tn,c as je,e as sn,E as nn,C as rn,d as Qr,f as Xr,g as Jr}from"./context-root-B04bYCE-.mjs";import{r as Ve,s as Zr}from"./parse-validator-DYdT7Hyf.mjs";import ei from"./discoverAuthApiCalls-XK_WCMDG.mjs";import{i as ti,a as si,e as ni,b as ri,d as ii,c as oi}from"./unwrap-handler-return-T5sJhEss.mjs";import ai from"./discoverFunctions-Be-XuuSW.mjs";import ci from"./discoverHttpRoutes-CMOxt2Y9.mjs";import li from"./discoverHyperdriveCalls-mrho5AnY.mjs";import di from"./discoverInserts-BhIpUWXN.mjs";import{m as Pt,a as Fe,s as on,d as ui}from"./index-CefI-Sba.mjs";import{e as an}from"./exported-procedure-chains-C5VKkd9T.mjs";import fi from"./discoverMigrations-dVVZtuJa.mjs";import{i as B,r as cn}from"./database-calls-DWDtdDbS.mjs";import{MUTATORS_FILENAME as pi,isDefineMutatorCallee as gi,mutatorServerImplOf as mi,discoverMutators as hi}from"./MUTATORS_FILENAME-BrEGrcPU.mjs";import vi from"./discoverNondeterministicCalls-Dtb1aoGV.mjs";import{discoverNotifyConfig as Ei,discoverNotifyCalls as xi}from"./NOTIFY_FILENAME-B42rW2NJ.mjs";import Si from"./discoverQueries-BSOjEsk3.mjs";import yi from"./discoverR2sqlCalls-KONCqZr2.mjs";import Ai from"./discoverRlsProcedures-c0DnIR4z.mjs";import bi from"./discoverRlsMetadata-9YDlDDoh.mjs";import Ni from"./discoverSchema-BTFFWy3i.mjs";import{secretKindOf as Pi,redact as wi,isHeuristicSecretKind as Ii,isSecretishName as Ci}from"./redact-Cy14LEnc.mjs";import{discoverShapes as Ti}from"./SHAPES_FILENAME-CVc2VCnS.mjs";import{i as Oi}from"./reserved-words-CW1QFbTd.mjs";import{emitApp as Ri}from"./emitApp-DUGS6Ve2.mjs";import{buildOpenApiDocument as ki,emitOpenApiModule as Fi}from"./buildOpenApiDocument-BjHdW7b2.mjs";import{buildOpenRpcDocument as Di,emitOpenRpcModule as Li}from"./OPENRPC_VERSION-BaD2A2YR.mjs";import{buildSchemaSnapshot as Mi}from"./SchemaSnapshotParseError-CPOXlFhI.mjs";import{emitCollections as _i,emitSeed as Ki,emitApi as zi,emitInternalApi as Bi}from"./emitApi-zY6egN77.mjs";import{t as $i,u as Ui,s as ji,v as Vi}from"./shard-runtime-BI2SZ54Z.mjs";import{emitCrons as qi,emitScheduler as Wi,emitShardRegistry as Hi,emitDurableObjects as Gi,emitVectors as Yi,emitWranglerCronTriggers as Qi}from"./emitCrons-B8TBAOZ4.mjs";import Xi from"./emitDrizzleSchema-DLtfKTI4.mjs";import Ji from"./emitFunctions-DkkcTDqh.mjs";const ns={error:"ERROR",info:"INFO",warn:"WARN"},rs={ERROR:2,INFO:0,WARN:1},Zi=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"}),eo=(e,t)=>{const{advisor:s}=cr(e);if(s===void 0||s.minSeverity===void 0&&s.unreadable!==!0)return[...t];const{minSeverity:n}=s,r=n!==void 0&&Object.hasOwn(ns,n)?ns[n]:void 0;return r===void 0?[...t,Zi(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(o=>rs[o.level]>=rs[r])},to={call:"function",enqueue:"queue",invoke:"service",publish:"topic",schedule:"function"},so="crons",no=pr.replace(/\.ts$/u,""),oe=(e,t)=>`${js(e)}:${t}`,st=(e,t,s)=>t===""?{reason:`the ${s} is not a string literal`}:{to:`${e}:${t}`},ro=e=>[...e.callEdges.map(t=>{const s=t.target===void 0?{reason:t.reason??"unreadable target"}:{to:`${to[t.kind]}:${t.target}`};return{file:t.file,kind:t.kind,line:t.line,scope:t.scope,...s}}),...e.queries.map(t=>({file:t.file,kind:"read",line:t.line,scope:t.scope,...st("table",t.table,"table name")})),...[...e.inserts,...e.tableWrites].map(t=>({file:t.file,kind:"write",line:t.line,scope:t.scope,...st("table",t.table,"written table")})),...e.workflowCalls.map(t=>({file:t.file,kind:"start",line:t.line,scope:t.scope,...st("workflow",t.workflow,"workflow name")}))],io=e=>e.untracked===!0?"inside a helper only code outside any export calls":"inside a non-exported helper",oo=e=>{const{scope:t}=e;switch(t.kind){case"export":return[{...e,exportName:t.name}];case"helper":return t.callers.length===0?[{...e,unattributed:io(t)}]:t.callers.map(s=>({...e,exportName:s}));default:return[{...e,unattributed:"at module scope"}]}},ao=e=>ro(e).flatMap(t=>oo(t)),co=e=>[...e.queues.flatMap(t=>t.topic===void 0?[]:[{file:t.filePath,from:`topic:${t.topic}`,kind:"subscribe",line:0,to:`queue:${t.exportName}`}]),...e.crons.map(t=>{const s=t.workflow===void 0?void 0:`workflow:${t.workflow.exportName}`,n=t.functionPath===void 0?void 0:`function:${t.functionPath}`,r=s??n;return{file:so,from:`cron:${t.name}`,kind:"trigger",line:0,...r===void 0?{reason:"the cron has no target"}:{to:r}}})],lo=e=>new Map(e.flatMap(t=>t.tables.map(s=>[s,t.name]))),ue=(e,t)=>t===void 0?e:{...e,module:t},uo=e=>{const t=new Map,s=new Map,n=lo(e.modules),r=(c,l)=>{s.set(c,[...s.get(c)??[],l])},o=(c,l)=>{t.set(c.id,c),l!==void 0&&r(l,c.id)},a=(c,l)=>{c!==void 0&&r(oe(c.file,c.exportName),l)};for(const c of e.functions){const l=oe(c.filePath,c.exportName),u=[...hr(c.filePath),c.exportName].join(".");o(ue({detail:c.kind,id:`function:${l}`,kind:"function",name:u},Ce(e.modules,c.filePath)),l)}for(const c of e.httpRoutes){const l=oe(c.filePath,c.exportName);o(ue({id:`http:${l}`,kind:"http",name:`${c.method} ${c.path}`},Ce(e.modules,c.filePath)),l)}for(const c of e.schema.tables)o(ue({id:`table:${c.name}`,kind:"table",name:c.name},n.get(c.name)));for(const c of e.queues){const l=c.topic===void 0?{}:{detail:"subscription"};o(ue({...l,id:`queue:${c.exportName}`,kind:"queue",name:c.exportName},Ce(e.modules,c.filePath)),oe(c.filePath,c.exportName)),a(c.handlerSite,`queue:${c.exportName}`)}for(const c of e.topics)o(ue({id:`topic:${c.exportName}`,kind:"topic",name:c.exportName},Ce(e.modules,c.filePath)));for(const c of e.workflows)o({id:`workflow:${c.exportName}`,kind:"workflow",name:c.exportName},oe(no,c.exportName)),a(c.handlerSite,`workflow:${c.exportName}`);for(const c of e.crons)o({detail:c.cron,id:`cron:${c.name}`,kind:"cron",name:c.name});for(const c of e.services){const l=c.rpcEntrypoint===void 0?"fetch":"rpc";o({detail:c.entrypoint===void 0?l:`${l} · ${c.entrypoint}`,id:`service:${c.name}`,kind:"service",name:c.worker})}return{nodes:t,sites:s}},fo=e=>e==="default"?"the default export is not a registered function":`"${e}" is not a registered function`,po=(e,t)=>"from"in e?[e.from]:"unattributed"in e?{reason:e.unattributed}:t.get(oe(e.file,e.exportName))??{reason:fo(e.exportName)},go=(e,t,s)=>{if("reason"in e)return{reason:e.reason};const n=po(e,t);if("reason"in n)return n;const{to:r}=e;return s.has(r)?{drawn:n.map(o=>({from:o,kind:e.kind,to:r}))}:{reason:`${r} is not declared`}},nt=e=>`${e.from}|${e.kind}|${e.to}`,mo=e=>`${e.file}|${String(e.line)}|${e.kind}|${e.reason}`,ho=e=>{const{nodes:t,sites:s}=uo(e),n=new Map,r=new Map;for(const o of[...co(e),...ao(e)]){const a=go(o,s,t);if("drawn"in a)for(const c of a.drawn)n.set(nt(c),c);else{const c={file:o.file,kind:o.kind,line:o.line,reason:a.reason};r.set(mo(c),c)}}return{edges:[...n.values()].toSorted((o,a)=>nt(o).localeCompare(nt(a))),nodes:[...t.values()].toSorted((o,a)=>o.id.localeCompare(a.id)),modules:e.modules.map(o=>({...o.description===void 0?{}:{description:o.description},...o.installed===!0?{installed:!0}:{},...o.ownsFolder===!1?{ownsFolder:!1}:{},name:o.name,tables:[...o.tables]})),unresolved:[...r.values()].toSorted((o,a)=>o.file.localeCompare(a.file)||o.line-a.line),version:1}},vo=e=>`${vr}export const architecture = ${mr(e,"Record<string, unknown>")};
1
+ import{existsSync as R,mkdirSync as Us,rmSync as lt,readdirSync as er,readFileSync as tr,writeFileSync as sr}from"node:fs";import{join as h,dirname as fe,relative as nr}from"node:path";import{performance as et}from"node:perf_hooks";import{runAdvisor as rr}from"@lunora/advisor";import{LunoraError as Y}from"@lunora/errors";import{readJsonSync as ir}from"@visulima/fs";import{SyntaxKind as d,Node as i,Project as ts}from"ts-morph";import{serializeSchemaSnapshot as or}from"./SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{toAdvisorContext as ar}from"./formatAdvisories-DwmUKYuc.mjs";import{r as cr,a as S,s as lr,b as dr}from"./project-config-file-Bv2l-Kmm.mjs";import{a as Ce,d as ur,r as fr}from"./modules-BIpFLz3Z.mjs";import{WORKFLOWS_FILENAME as pr,discoverWorkflows as gr}from"./WORKFLOWS_FILENAME-Ze98LsB3.mjs";import{r as mr}from"./json-data-Chfs2Cz5.mjs";import{n as hr,s as js}from"./paths-DwTjD7BU.mjs";import{G as vr}from"./shared-Be3TGzxM.mjs";import{CAPABILITIES as Er,usedCapabilities as xr}from"./CAPABILITY_PROBES-brcmKenl.mjs";import{isD1GlobalTable as Vs,isHyperdriveGlobalTable as qs}from"./isD1GlobalTable-udvHAAzD.mjs";import{discoverAgents as Sr}from"./AGENTS_FILENAME-NQIB6wh3.mjs";import{discoverContainers as yr}from"./CONTAINERS_FILENAME-CK3xJGwm.mjs";import Ar from"./discoverCrons-B5bVCaNF.mjs";import{diagnosticAt as Ee}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{b as Be}from"./module-specifiers-WF8iAydP.mjs";import{a as Ws,b as q,d as $,f as F,g as At,c as v,w as bt,k as br,l as Nr,h as Pr,j as dt,i as wr}from"./attribution-Dw35rOaJ.mjs";import{contextPropertiesRead as Ir,discoverFeatureUsage as Cr}from"./capabilitiesUsedBy-FnnYmnSl.mjs";import Tr from"./readPackageDependencies-RHhGiz0k.mjs";import{listLunoraSourceFiles as x,unwrapExpression as E,listSecurityScanFiles as $e,objectLiteralFromCallbackBody as Hs,propertyInitializer as I,lunoraRelativePath as C,bindingKeyName as xe,collectCallRows as T,findObjectProperty as L,collectSecurityCallRows as Or,collectNodeRows as ut,RUN_METHODS as Gs,functionKeyOf as Ys,limitNameOf as Qs,optionsObjectLiteral as Xs,handlerOf as Rr,chainRootOf as Nt,outermostValueWrapper as P,isWriteTarget as Ue,isSameNode as me,isConstDeclaration as Z,returningFunctionOf as ft,walkChain as kr,memberAccessOf as Fr,functionReferenceSegments as Dr,isTestPath as Lr}from"./isTestPath-CgyyLk8U.mjs";import{discoverQueueDeclarations as Mr}from"./QUEUES_FILENAME-Dj5yK34Z.mjs";import{discoverSandboxUsage as _r}from"./discoverSandboxUsage-CfEU2hM-.mjs";import{resolveServiceBindings as Kr}from"./readServiceBindings-DuE9xlvV.mjs";import zr from"./discoverStorageRulesMetadata-f89BWody.mjs";import{a as y,c as W,d as Js,e as Br}from"./classify-procedure-call-DxuPQkJA.mjs";import{i as $r}from"./ir-DBSvhNa-.mjs";import{gatePlatformFeatures as Ur,resolveCodegenTarget as Zs,readTargetDiagnostics as jr,studioPlatformFor as Vr}from"./DEFAULT_TARGET-GPPgJNTn.mjs";import{b as en,e as qr}from"./shard-Dr5gMNyz.mjs";import{e as Wr,a as Hr}from"./server-BmY5wwKY.mjs";import{emitDataModel as Gr}from"./emitDataModel-B68T_eX6.mjs";import{a as ss,r as tt,i as j,b as Yr,m as tn,c as je,e as sn,E as nn,C as rn,d as Qr,f as Xr,g as Jr}from"./context-root-B04bYCE-.mjs";import{r as Ve,s as Zr}from"./parse-validator-DYdT7Hyf.mjs";import ei from"./discoverAuthApiCalls-XK_WCMDG.mjs";import{i as ti,a as si,e as ni,b as ri,d as ii,c as oi}from"./unwrap-handler-return-T5sJhEss.mjs";import ai from"./discoverFunctions-Be-XuuSW.mjs";import ci from"./discoverHttpRoutes-CMOxt2Y9.mjs";import li from"./discoverHyperdriveCalls-mrho5AnY.mjs";import di from"./discoverInserts-BhIpUWXN.mjs";import{m as Pt,a as Fe,s as on,d as ui}from"./index-CefI-Sba.mjs";import{e as an}from"./exported-procedure-chains-C5VKkd9T.mjs";import fi from"./discoverMigrations-dVVZtuJa.mjs";import{i as B,r as cn}from"./database-calls-DWDtdDbS.mjs";import{MUTATORS_FILENAME as pi,isDefineMutatorCallee as gi,mutatorServerImplOf as mi,discoverMutators as hi}from"./MUTATORS_FILENAME-BrEGrcPU.mjs";import vi from"./discoverNondeterministicCalls-Dtb1aoGV.mjs";import{discoverNotifyConfig as Ei,discoverNotifyCalls as xi}from"./NOTIFY_FILENAME-B42rW2NJ.mjs";import Si from"./discoverQueries-BSOjEsk3.mjs";import yi from"./discoverR2sqlCalls-KONCqZr2.mjs";import Ai from"./discoverRlsProcedures-c0DnIR4z.mjs";import bi from"./discoverRlsMetadata-9YDlDDoh.mjs";import Ni from"./discoverSchema-BTFFWy3i.mjs";import{secretKindOf as Pi,redact as wi,isHeuristicSecretKind as Ii,isSecretishName as Ci}from"./redact-Cy14LEnc.mjs";import{discoverShapes as Ti}from"./SHAPES_FILENAME-CVc2VCnS.mjs";import{i as Oi}from"./reserved-words-CW1QFbTd.mjs";import{emitApp as Ri}from"./emitApp-DUGS6Ve2.mjs";import{buildOpenApiDocument as ki,emitOpenApiModule as Fi}from"./buildOpenApiDocument-BjHdW7b2.mjs";import{buildOpenRpcDocument as Di,emitOpenRpcModule as Li}from"./OPENRPC_VERSION-BaD2A2YR.mjs";import{buildSchemaSnapshot as Mi}from"./SchemaSnapshotParseError-CPOXlFhI.mjs";import{emitCollections as _i,emitSeed as Ki,emitApi as zi,emitInternalApi as Bi}from"./emitApi-zY6egN77.mjs";import{t as $i,u as Ui,s as ji,v as Vi}from"./shard-runtime-BI2SZ54Z.mjs";import{emitCrons as qi,emitScheduler as Wi,emitShardRegistry as Hi,emitDurableObjects as Gi,emitVectors as Yi,emitWranglerCronTriggers as Qi}from"./emitCrons-B8TBAOZ4.mjs";import Xi from"./emitDrizzleSchema-DLtfKTI4.mjs";import Ji from"./emitFunctions-DkkcTDqh.mjs";const ns={error:"ERROR",info:"INFO",warn:"WARN"},rs={ERROR:2,INFO:0,WARN:1},Zi=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"}),eo=(e,t)=>{const{advisor:s}=cr(e);if(s===void 0||s.minSeverity===void 0&&s.unreadable!==!0)return[...t];const{minSeverity:n}=s,r=n!==void 0&&Object.hasOwn(ns,n)?ns[n]:void 0;return r===void 0?[...t,Zi(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(o=>rs[o.level]>=rs[r])},to={call:"function",enqueue:"queue",invoke:"service",publish:"topic",schedule:"function"},so="crons",no=pr.replace(/\.ts$/u,""),oe=(e,t)=>`${js(e)}:${t}`,st=(e,t,s)=>t===""?{reason:`the ${s} is not a string literal`}:{to:`${e}:${t}`},ro=e=>[...e.callEdges.map(t=>{const s=t.target===void 0?{reason:t.reason??"unreadable target"}:{to:`${to[t.kind]}:${t.target}`};return{file:t.file,kind:t.kind,line:t.line,scope:t.scope,...s}}),...e.queries.map(t=>({file:t.file,kind:"read",line:t.line,scope:t.scope,...st("table",t.table,"table name")})),...[...e.inserts,...e.tableWrites].map(t=>({file:t.file,kind:"write",line:t.line,scope:t.scope,...st("table",t.table,"written table")})),...e.workflowCalls.map(t=>({file:t.file,kind:"start",line:t.line,scope:t.scope,...st("workflow",t.workflow,"workflow name")}))],io=e=>e.untracked===!0?"inside a helper only code outside any export calls":"inside a non-exported helper",oo=e=>{const{scope:t}=e;switch(t.kind){case"export":return[{...e,exportName:t.name}];case"helper":return t.callers.length===0?[{...e,unattributed:io(t)}]:t.callers.map(s=>({...e,exportName:s}));default:return[{...e,unattributed:"at module scope"}]}},ao=e=>ro(e).flatMap(t=>oo(t)),co=e=>[...e.queues.flatMap(t=>t.topic===void 0?[]:[{file:t.filePath,from:`topic:${t.topic}`,kind:"subscribe",line:0,to:`queue:${t.exportName}`}]),...e.crons.map(t=>{const s=t.workflow===void 0?void 0:`workflow:${t.workflow.exportName}`,n=t.functionPath===void 0?void 0:`function:${t.functionPath}`,r=s??n;return{file:so,from:`cron:${t.name}`,kind:"trigger",line:0,...r===void 0?{reason:"the cron has no target"}:{to:r}}})],lo=e=>new Map(e.flatMap(t=>t.tables.map(s=>[s,t.name]))),ue=(e,t)=>t===void 0?e:{...e,module:t},uo=e=>{const t=new Map,s=new Map,n=lo(e.modules),r=(c,l)=>{s.set(c,[...s.get(c)??[],l])},o=(c,l)=>{t.set(c.id,c),l!==void 0&&r(l,c.id)},a=(c,l)=>{c!==void 0&&r(oe(c.file,c.exportName),l)};for(const c of e.functions){const l=oe(c.filePath,c.exportName),u=[...hr(c.filePath),c.exportName].join(".");o(ue({detail:c.kind,id:`function:${l}`,kind:"function",name:u},Ce(e.modules,c.filePath)),l)}for(const c of e.httpRoutes){const l=oe(c.filePath,c.exportName);o(ue({id:`http:${l}`,kind:"http",name:`${c.method} ${c.path}`},Ce(e.modules,c.filePath)),l)}for(const c of e.schema.tables)o(ue({id:`table:${c.name}`,kind:"table",name:c.name},n.get(c.name)));for(const c of e.queues){const l=c.topic===void 0?{}:{detail:"subscription"};o(ue({...l,id:`queue:${c.exportName}`,kind:"queue",name:c.exportName},Ce(e.modules,c.filePath)),oe(c.filePath,c.exportName)),a(c.handlerSite,`queue:${c.exportName}`)}for(const c of e.topics)o(ue({id:`topic:${c.exportName}`,kind:"topic",name:c.exportName},Ce(e.modules,c.filePath)));for(const c of e.workflows)o({id:`workflow:${c.exportName}`,kind:"workflow",name:c.exportName},oe(no,c.exportName)),a(c.handlerSite,`workflow:${c.exportName}`);for(const c of e.crons)o({detail:c.cron,id:`cron:${c.name}`,kind:"cron",name:c.name});for(const c of e.services){const l=c.rpcEntrypoint===void 0?"fetch":"rpc";o({detail:c.entrypoint===void 0?l:`${l} · ${c.entrypoint}`,id:`service:${c.name}`,kind:"service",name:c.worker})}return{nodes:t,sites:s}},fo=e=>e==="default"?"the default export is not a registered function":`"${e}" is not a registered function`,po=(e,t)=>"from"in e?[e.from]:"unattributed"in e?{reason:e.unattributed}:t.get(oe(e.file,e.exportName))??{reason:fo(e.exportName)},go=(e,t,s)=>{if("reason"in e)return{reason:e.reason};const n=po(e,t);if("reason"in n)return n;const{to:r}=e;return s.has(r)?{drawn:n.map(o=>({from:o,kind:e.kind,to:r}))}:{reason:`${r} is not declared`}},nt=e=>`${e.from}|${e.kind}|${e.to}`,mo=e=>`${e.file}|${String(e.line)}|${e.kind}|${e.reason}`,ho=e=>{const{nodes:t,sites:s}=uo(e),n=new Map,r=new Map;for(const o of[...co(e),...ao(e)]){const a=go(o,s,t);if("drawn"in a)for(const c of a.drawn)n.set(nt(c),c);else{const c={file:o.file,kind:o.kind,line:o.line,reason:a.reason};r.set(mo(c),c)}}return{edges:[...n.values()].toSorted((o,a)=>nt(o).localeCompare(nt(a))),nodes:[...t.values()].toSorted((o,a)=>o.id.localeCompare(a.id)),modules:e.modules.map(o=>({...o.description===void 0?{}:{description:o.description},...o.installed===!0?{installed:!0}:{},...o.ownsFolder===!1?{ownsFolder:!1}:{},name:o.name,tables:[...o.tables]})),unresolved:[...r.values()].toSorted((o,a)=>o.file.localeCompare(a.file)||o.line-a.line),version:1}},vo=e=>`${vr}export const architecture = ${mr(e,"Record<string, unknown>")};
2
2
  `,is=(e,t="api")=>{const s=new Map;for(const n of e){const r=js(n),o=s.get(r);if(o===void 0){s.set(r,n);continue}if(o!==n){const a=t==="api"?`the generated api.ts would declare "${r}" twice and the dispatch key "${r}:<fn>" would be ambiguous`:`the generated api.ts would declare "${r}" twice in HttpStreamsRef and again in the httpStreams object literal`;throw new Y("INTERNAL",`@lunora/codegen: "${o}" and "${n}" both map to the ${t} namespace "${r}" — ${a}. Rename one file so the two differ by more than a non-identifier character (\`-\`, \`.\`, \`/\` and \`_\` all sanitize to \`_\`).`,{status:500})}}},Eo=(e,t={})=>{const{hasVectors:s=!0,scheduler:n=!1,storage:r=!1,usage:o}=t,a=[];e.tables.some(c=>Vs(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=>qs(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`"}),r&&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 o===void 0?[]:Er)c.requiredPackage!==void 0&&o?.[c.key]===!0&&a.push({name:c.requiredPackage,reason:`\`ctx.${c.contextProperty??c.key}\` usage makes \`_generated/\` import \`${c.moduleSpecifier}\``});return a.filter((c,l)=>a.findIndex(u=>u.name===c.name)===l)},xo=(e,t,s={})=>{if(t===void 0)return;const n=Eo(e,s).filter(o=>!t.has(o.name));if(n.length===0)return;const r=n.map(o=>` - ${o.name} — ${o.reason}`).join(`
3
3
  `);throw new Y("INTERNAL",`@lunora/codegen: this schema's generated code imports packages the project does not declare:
4
4
  ${r}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/codegen",
3
- "version": "1.0.0-alpha.275",
3
+ "version": "1.0.0-alpha.276",
4
4
  "description": "Code generator for Lunora: emits _generated/{api,server,dataModel}.ts from your schema",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -46,13 +46,13 @@
46
46
  "access": "public"
47
47
  },
48
48
  "dependencies": {
49
- "@lunora/advisor": "1.0.0-alpha.198",
49
+ "@lunora/advisor": "1.0.0-alpha.199",
50
50
  "@lunora/agent": "1.0.0-alpha.186",
51
- "@lunora/container": "1.0.0-alpha.69",
52
- "@lunora/errors": "1.0.0-alpha.50",
51
+ "@lunora/container": "1.0.0-alpha.70",
52
+ "@lunora/errors": "1.0.0-alpha.51",
53
53
  "@lunora/platform": "1.0.0-alpha.57",
54
- "@lunora/queue": "1.0.0-alpha.94",
55
- "@lunora/scheduler": "1.0.0-alpha.113",
54
+ "@lunora/queue": "1.0.0-alpha.95",
55
+ "@lunora/scheduler": "1.0.0-alpha.114",
56
56
  "@lunora/values": "1.0.0-alpha.60",
57
57
  "@lunora/workflow": "1.0.0-alpha.71",
58
58
  "@visulima/fs": "6.0.28",
@@ -1 +0,0 @@
1
- import{NODE_CAPABILITIES as f,CLOUDFLARE_CAPABILITIES as h,CELLD_CAPABILITIES as b}from"@lunora/platform";import{r as g}from"./project-config-file-Bv2l-Kmm.mjs";const d="cloudflare",v=t=>{const{target:e}=g(t);return e!==void 0&&e.length>0?e:void 0},A=(t,e)=>e??v(t)??d,L=(t,e)=>{if(e!==void 0)return[];const{target:a,unreadable:r}=g(t);return r!==!0||a!==void 0?[]:[{level:"warn",message:`lunora.config declares a \`target\` that codegen cannot read without evaluating it, so the "${d}" surface was emitted. \`runCodegen\` resolves the target synchronously, which means it reads literals only.`,name:"platform_unreadable_target",remediation:`Write \`target\` as a string literal on the config's default export (\`export default { target: "${d}" }\`), or pass \`--target\`.`,target:d}]},u={celld:b,cloudflare:h,node:f},C=()=>Object.keys(u).toSorted((t,e)=>t.localeCompare(e)),S={access:null,ai:"ai",aiSearch:"aiSearch",analytics:"analytics",analyticsSql:"analyticsSql",artifacts:"artifacts",browser:"browser",container:"containers",flags:null,hyperdrive:"hyperdrive",images:"images",kv:"keyValueStore",mail:"mail",notify:null,payments:null,pipelines:"pipelines",r2sql:null,scheduler:"scheduler",storage:"objectStorage",vectors:"vectorStore",workflows:"workflows",x402:null},w=["agents","commitOrderedTables","containerEgressPolicy","containerRuntimeScheduling","containerSandboxTools","cronTriggers","crossShardFanout","durableStreams","globalTables","queues","relationGraph","secrets","services","topics","vectorStore","workerLoaders","workflowRollback","workflowSchedules"],m={agents:"durable agents (`defineAgent`)",commitOrderedTables:"commit-ordered tables (`.commitOrdered()`)",containerEgressPolicy:"container egress policies (`defineContainer({ allowedHosts | deniedHosts | interceptHttps })`)",containerRuntimeScheduling:'per-instance container images and snapshots (`defineContainer({ schedulingPolicy: "durable_object" })`)',containerSandboxTools:"container sandbox helpers — files, directory backups, bucket mounts (`defineContainer({ sandbox: true })`)",cronTriggers:"declared cron triggers (`cronJobs()`)",crossShardFanout:"cross-shard fan-out queries (a `.shardBy(...)` schema)",durableStreams:"durable streams (`.stream(handler, { durable: true })`)",globalTables:"global tables (`.global()`)",queues:"queues (`defineQueue`)",relationGraph:"relation-graph traversal (`ctx.db.related`, derived from `v.id(...)` columns)",secrets:"the secrets store (`ctx.secrets`)",services:"service bindings to sibling Workers (`lunora.config` `services`)",topics:"pub/sub topics (`defineTopic` / `defineSubscription`)",vectorStore:"vector indexes (`.vectorize()`)",workerLoaders:"sandboxed agent scripts (`jsCodeTool`, on Worker Loaders)",workflowRollback:"workflow step rollback (`defineStep({ rollback })`)",workflowSchedules:"scheduled workflow instances (`defineWorkflow({ schedules })`)"},y=(t,e,a)=>({level:"error",message:`${e.name} does not support ${m[t]}, which this app declares.`,name:"platform_unsupported_feature",remediation:`Remove the declaration, or deploy to a target whose capability matrix marks "${t}" as native or emulated.`,target:a}),T=(t,e,a)=>({level:"error",message:`${e.name}'s capability matrix does not declare a support level for ${m[t]}, which this app declares. Treated as unsupported.`,name:"platform_undeclared_feature",remediation:`Rate "${t}" in the ${e.name} capability matrix as "native", "emulated", or "unsupported" — an undeclared feature fails closed rather than letting the app deploy onto a primitive the host may not provide.`,target:a}),k=t=>{const{diagnostics:e,gatedSignals:a,matrix:r,reported:n,signals:c,target:i}=t;for(const s of w){if(c[s]!==!0)continue;const o=r.features[s]?.level;o!=="unsupported"&&o!==void 0||(a[s]=!1,!n.has(s)&&e.push(o==="unsupported"?y(s,r,i):T(s,r,i)))}},_=(t,e,a,r={})=>{const n={...t},c={...r},i=[],s=new Set;for(const[o,l]of Object.entries(S)){if(l===null||!t[o])continue;const p=e.features[l]?.level;p==="unsupported"?(n[o]=!1,s.add(l),i.push({feature:o,level:"error",message:`${e.name} does not support "${o}" (ctx.${o}).`,name:"platform_unsupported_feature",remediation:`Remove the ctx.${o} usage, or deploy to a target whose capability matrix marks "${l}" as native or emulated.`,target:a})):p===void 0&&(n[o]=!1,s.add(l),i.push({feature:o,level:"error",message:`${e.name}'s capability matrix does not declare a support level for "${o}" (ctx.${o}). Treated as unsupported.`,name:"platform_undeclared_feature",remediation:`Rate "${l}" in the ${e.name} capability matrix as "native", "emulated", or "unsupported" — an undeclared feature fails closed rather than shipping a surface the host may not provide.`,target:a}))}return k({diagnostics:i,gatedSignals:c,matrix:e,reported:s,signals:r,target:a}),{diagnostics:i,signals:c,usage:n}},E=(t,e,a={})=>{const r=u[e];return r===void 0?{diagnostics:[{level:"error",message:`Unknown deploy target "${e}" — no capability matrix is registered for it. Codegen emitted the full Cloudflare surface un-gated.`,name:"platform_unknown_target",remediation:`Use a registered target (${Object.keys(u).join(", ")}) or install the target's @lunora/platform-${e} package.`,target:e}],signals:{...a},usage:{...t}}:_(t,r,e,a)},I=t=>{const e=u[t];if(e===void 0)return;const a=Object.entries(e.features).filter(([,r])=>r.level==="unsupported").map(([r])=>r).toSorted((r,n)=>r.localeCompare(n));return{id:e.id,name:e.name,unsupported:a}};export{S as CAPABILITY_TO_FEATURE,d as DEFAULT_TARGET,_ as gateAgainstMatrix,E as gatePlatformFeatures,C as platformMatrixIds,v as readProjectTarget,L as readTargetDiagnostics,A as resolveCodegenTarget,I as studioPlatformFor};