@lunora/codegen 1.0.0-alpha.405 → 1.0.0-alpha.406

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 i,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import{formatAdvisories as d,lintSchema as f,toAdvisorContext as m}from"./packem_shared/formatAdvisories-BCVASH7N.mjs";import{describeErrorLevelFindings as n,errorAdvisoryNames as c,errorPlatformDiagnosticNames as l,sortedUniqueNames as S}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-BuNEmlCO.mjs";import{COMPANION_BINDING as u,COMPANION_SERVICE_NAME as N}from"./packem_shared/COMPANION_BINDING-Da_v9XpC.mjs";import{CodegenDiagnosticError as g,diagnosticAt as C}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as I,discoverAgents as _}from"./packem_shared/AGENTS_FILENAME-D0Y0_UgB.mjs";import{isTestPath as L,listLunoraSourceFiles as M}from"./packem_shared/isTestPath-DRIdZaij.mjs";import{default as F}from"./packem_shared/discoverAuthApiCalls-ENLGem4M.mjs";import{CONTAINERS_FILENAME as P,discoverContainers as D}from"./packem_shared/CONTAINERS_FILENAME-J-e3Vanb.mjs";import{default as b}from"./packem_shared/discoverCrons-DWVXmktw.mjs";import{ENV_FILENAME as U}from"./packem_shared/ENV_FILENAME-COPIfgzp.mjs";import{capabilitiesUsedBy as H,createTargetScope as j,foldCapabilitySignals as V,mayReadCapabilityContext as k,sourceCapabilitySignals as W}from"./packem_shared/capabilitiesUsedBy-BwhaHK08.mjs";import{FLAGS_FILENAME as K,discoverFlags as Q}from"./packem_shared/FLAGS_FILENAME-6RzszxVW.mjs";import{d as q}from"./packem_shared/index-jtzAVdUp.mjs";import{default as J}from"./packem_shared/discoverHttpRoutes-CAoEemno.mjs";import{default as Z}from"./packem_shared/discoverHyperdriveCalls-BaRayTZe.mjs";import{default as ee}from"./packem_shared/discoverInserts-DmSa4WKU.mjs";import{d as oe}from"./packem_shared/index-mFEIaT45.mjs";import{default as ie}from"./packem_shared/discoverMigrations-Duh6HVG3.mjs";import{MUTATORS_FILENAME as se,discoverMutators as de}from"./packem_shared/MUTATORS_FILENAME-C3OImAxC.mjs";import{default as me}from"./packem_shared/discoverNondeterministicCalls-BoF6ob-B.mjs";import{ALL_NOTIFY_CHANNELS as ne,NOTIFY_FILENAME as ce,discoverNotifyCalls as le,discoverNotifyChannels as Se,discoverNotifyConfig as xe}from"./packem_shared/ALL_NOTIFY_CHANNELS-DPxI0EHQ.mjs";import{default as Ae}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as Ne}from"./packem_shared/discoverQueries-spxu-wHR.mjs";import{QUEUES_FILENAME as ge,discoverQueues as Ce}from"./packem_shared/QUEUES_FILENAME-Ba-sK5Ek.mjs";import{default as Ie}from"./packem_shared/discoverR2sqlCalls-CZjqFVi_.mjs";import{default as Re}from"./packem_shared/discoverRlsProcedures-mjiA0I4S.mjs";import{default as Me}from"./packem_shared/discoverRlsMetadata-Cc0zA-gZ.mjs";import{discoverSandboxUsage as Fe}from"./packem_shared/discoverSandboxUsage-Ccy9n7G1.mjs";import{default as Pe}from"./packem_shared/discoverSchema-ynieYB0n.mjs";import{companionServiceBinding as ye,readBoundServiceBindings as be,readDevServiceBindings as Ge,readServiceBindings as Ue,resolveServiceBindings as Be}from"./packem_shared/companionServiceBinding-BZjm486n.mjs";import{SHAPES_FILENAME as je,discoverShapes as Ve}from"./packem_shared/SHAPES_FILENAME-CH0KrAdb.mjs";import{default as We}from"./packem_shared/discoverStorageRulesMetadata-CtE5trUR.mjs";import{WORKFLOWS_FILENAME as Ke,discoverWorkflows as Qe}from"./packem_shared/WORKFLOWS_FILENAME-DfVfBum_.mjs";import{emitApp as qe}from"./packem_shared/emitApp-C3IUdkkt.mjs";import{isD1GlobalTable as Je,isHyperdriveGlobalTable as Xe}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as $e,emitOpenApi as er,emitOpenApiModule as rr}from"./packem_shared/buildOpenApiDocument-B8KEeeRr.mjs";import{OPENRPC_VERSION as tr,buildOpenRpcDocument as ir,emitOpenRpc as ar,emitOpenRpcModule as sr}from"./packem_shared/OPENRPC_VERSION-UNYmA7Ty.mjs";import{DEFAULT_TARGET as fr,platformMatrixIds as mr,readProjectTarget as pr,resolveCodegenTarget as nr}from"./packem_shared/DEFAULT_TARGET-CVYzxQ0y.mjs";import{b as lr,r as Sr,c as xr,d as Er}from"./packem_shared/project-config-file-DR7xrrNB.mjs";import{PROJECT_CONFIG_FILENAMES as ur,findCodegenConfigFile as Nr,findProjectConfigFile as vr,projectConfigCandidatePaths as gr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs";import{SCHEMA_SNAPSHOT_FILENAME as Or,runCodegen as Ir}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-CKRhpYzL.mjs";import{SchemaSnapshotParseError as Rr,buildSchemaSnapshot as Lr,evaluateSchemaDrift as Mr,indexReferencesOf as Tr,parseSchemaSnapshot as Fr}from"./packem_shared/SchemaSnapshotParseError-DnAuFdpl.mjs";import{default as Pr}from"./packem_shared/fingerprintSchemaSources-C8H1wOcH.mjs";import{schemaFromIr as yr}from"./packem_shared/schemaFromIr-CByOxuZb.mjs";import{LUNORA_ERROR_CODES as Gr,validatorIrToJsonSchema as Ur}from"./packem_shared/LUNORA_ERROR_CODES-D7AVT7qF.mjs";import{SDK_LANGUAGES as Hr,SDK_TARGETS as jr,generateSdk as Vr}from"./sdk/index.mjs";import{redact as Wr,secretKindOf as zr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as Qr}from"./packem_shared/emitDrizzleSchema-BzOChEYW.mjs";import{e as qr}from"./packem_shared/server-CRFaUMKQ.mjs";import{e as Jr}from"./packem_shared/shard-Csztu3jG.mjs";import{G as Zr}from"./packem_shared/shared-Cn7dMQ_u.mjs";import{MESSAGE_SOLUTIONS as eo,findSolutionByMessage as ro}from"@lunora/errors";import{createCodegenProject as to,findTsconfig as io,refreshCodegenProject as ao,tsconfigFingerprint as so}from"./packem_shared/createCodegenProject-Cfr1xHPC.mjs";import{t as mo,u as po,v as no}from"./packem_shared/shard-runtime-D0xuE0pX.mjs";import{emitApi as lo,emitCollections as So,emitInternalApi as xo}from"./packem_shared/emitApi-lwadq5G7.mjs";import{emitCrons as Ao,emitScheduler as uo,emitVectors as No,emitWranglerCronTriggers as vo}from"./packem_shared/emitCrons-CCRKs482.mjs";import{emitDataModel as Co}from"./packem_shared/emitDataModel-BvCZS4Yq.mjs";import{emitFunctions as Io}from"./packem_shared/emitFunctions-ppMX7E3X.mjs";import{isTypedSchema as Ro}from"./packem_shared/isTypedSchema-CDv3pJB6.mjs";const e="0.0.0";export{I as AGENTS_FILENAME,ne as ALL_NOTIFY_CHANNELS,E as CAPABILITY_PROBES,u as COMPANION_BINDING,N as COMPANION_SERVICE_NAME,P as CONTAINERS_FILENAME,g as CodegenDiagnosticError,fr as DEFAULT_TARGET,U as ENV_FILENAME,K as FLAGS_FILENAME,Zr as GENERATED_HEADER,Gr as LUNORA_ERROR_CODES,eo as LUNORA_SOLUTION_RULES,se as MUTATORS_FILENAME,ce as NOTIFY_FILENAME,tr as OPENRPC_VERSION,ur as PROJECT_CONFIG_FILENAMES,ge as QUEUES_FILENAME,Or as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Hr as SDK_LANGUAGES,jr as SDK_TARGETS,je as SHAPES_FILENAME,Rr as SchemaSnapshotParseError,e as VERSION,Ke as WORKFLOWS_FILENAME,$e as buildOpenApiDocument,ir as buildOpenRpcDocument,Lr as buildSchemaSnapshot,H as capabilitiesUsedBy,ye as companionServiceBinding,to as createCodegenProject,j as createTargetScope,n as describeErrorLevelFindings,C as diagnosticAt,i as diffSchemaSnapshots,_ as discoverAgents,F as discoverAuthApiCalls,D as discoverContainers,b as discoverCrons,Q as discoverFlags,q as discoverFunctions,J as discoverHttpRoutes,Z as discoverHyperdriveCalls,ee as discoverInserts,oe as discoverMaskProcedures,ie as discoverMigrations,de as discoverMutators,me as discoverNondeterministicCalls,le as discoverNotifyCalls,Se as discoverNotifyChannels,xe as discoverNotifyConfig,Ne as discoverQueries,Ce as discoverQueues,Ie as discoverR2sqlCalls,Me as discoverRlsMetadata,Re as discoverRlsProcedures,Fe as discoverSandboxUsage,Pe as discoverSchema,Ve as discoverShapes,We as discoverStorageRulesMetadata,Qe as discoverWorkflows,mo as emitAgents,lo as emitApi,qe as emitApp,So as emitCollections,po as emitContainers,Ao as emitCrons,Co as emitDataModel,Qr as emitDrizzleSchema,Io as emitFunctions,xo as emitInternalApi,er as emitOpenApi,rr as emitOpenApiModule,ar as emitOpenRpc,sr as emitOpenRpcModule,uo as emitScheduler,qr as emitServer,Jr as emitShard,No as emitVectors,no as emitWorkflows,vo as emitWranglerCronTriggers,c as errorAdvisoryNames,l as errorPlatformDiagnosticNames,Mr as evaluateSchemaDrift,Nr as findCodegenConfigFile,ro as findLunoraSolution,vr as findProjectConfigFile,io as findTsconfig,Pr as fingerprintSchemaSources,V as foldCapabilitySignals,d as formatAdvisories,Vr as generateSdk,Tr as indexReferencesOf,Je as isD1GlobalTable,Xe as isHyperdriveGlobalTable,L as isTestPath,Ro as isTypedSchema,f as lintSchema,M as listLunoraSourceFiles,lr as loadProjectConfig,k as mayReadCapabilityContext,Fr as parseSchemaSnapshot,mr as platformMatrixIds,gr as projectConfigCandidatePaths,be as readBoundServiceBindings,Ge as readDevServiceBindings,Ae as readPackageDependencies,Sr as readProjectConfigLiterals,xr as readProjectLazyFunctions,Er as readProjectSecurityHeaders,pr as readProjectTarget,Ue as readServiceBindings,Wr as redact,ao as refreshCodegenProject,nr as resolveCodegenTarget,Be as resolveServiceBindings,Ir as runCodegen,yr as schemaFromIr,zr as secretKindOf,a as serializeSchemaSnapshot,S as sortedUniqueNames,W as sourceCapabilitySignals,m as toAdvisorContext,so as tsconfigFingerprint,Ur as validatorIrToJsonSchema};
1
+ import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as i,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import{formatAdvisories as d,lintSchema as f,toAdvisorContext as m}from"./packem_shared/formatAdvisories-BCVASH7N.mjs";import{describeErrorLevelFindings as n,errorAdvisoryNames as c,errorPlatformDiagnosticNames as l,sortedUniqueNames as S}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-BuNEmlCO.mjs";import{COMPANION_BINDING as u,COMPANION_SERVICE_NAME as N}from"./packem_shared/COMPANION_BINDING-Da_v9XpC.mjs";import{CodegenDiagnosticError as g,diagnosticAt as C}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as I,discoverAgents as _}from"./packem_shared/AGENTS_FILENAME-D0Y0_UgB.mjs";import{isTestPath as L,listLunoraSourceFiles as M}from"./packem_shared/isTestPath-DRIdZaij.mjs";import{default as F}from"./packem_shared/discoverAuthApiCalls-ENLGem4M.mjs";import{CONTAINERS_FILENAME as P,discoverContainers as D}from"./packem_shared/CONTAINERS_FILENAME-J-e3Vanb.mjs";import{default as b}from"./packem_shared/discoverCrons-DWVXmktw.mjs";import{ENV_FILENAME as U}from"./packem_shared/ENV_FILENAME-COPIfgzp.mjs";import{capabilitiesUsedBy as H,createTargetScope as j,foldCapabilitySignals as V,mayReadCapabilityContext as k,sourceCapabilitySignals as W}from"./packem_shared/capabilitiesUsedBy-BwhaHK08.mjs";import{FLAGS_FILENAME as K,discoverFlags as Q}from"./packem_shared/FLAGS_FILENAME-6RzszxVW.mjs";import{d as q}from"./packem_shared/index-jtzAVdUp.mjs";import{default as J}from"./packem_shared/discoverHttpRoutes-CAoEemno.mjs";import{default as Z}from"./packem_shared/discoverHyperdriveCalls-BaRayTZe.mjs";import{default as ee}from"./packem_shared/discoverInserts-DmSa4WKU.mjs";import{d as oe}from"./packem_shared/index-mFEIaT45.mjs";import{default as ie}from"./packem_shared/discoverMigrations-Duh6HVG3.mjs";import{MUTATORS_FILENAME as se,discoverMutators as de}from"./packem_shared/MUTATORS_FILENAME-C3OImAxC.mjs";import{default as me}from"./packem_shared/discoverNondeterministicCalls-BoF6ob-B.mjs";import{ALL_NOTIFY_CHANNELS as ne,NOTIFY_FILENAME as ce,discoverNotifyCalls as le,discoverNotifyChannels as Se,discoverNotifyConfig as xe}from"./packem_shared/ALL_NOTIFY_CHANNELS-DPxI0EHQ.mjs";import{default as Ae}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as Ne}from"./packem_shared/discoverQueries-spxu-wHR.mjs";import{QUEUES_FILENAME as ge,discoverQueues as Ce}from"./packem_shared/QUEUES_FILENAME-Ba-sK5Ek.mjs";import{default as Ie}from"./packem_shared/discoverR2sqlCalls-CZjqFVi_.mjs";import{default as Re}from"./packem_shared/discoverRlsProcedures-mjiA0I4S.mjs";import{default as Me}from"./packem_shared/discoverRlsMetadata-Cc0zA-gZ.mjs";import{discoverSandboxUsage as Fe}from"./packem_shared/discoverSandboxUsage-Ccy9n7G1.mjs";import{default as Pe}from"./packem_shared/discoverSchema-ynieYB0n.mjs";import{companionServiceBinding as ye,readBoundServiceBindings as be,readDevServiceBindings as Ge,readServiceBindings as Ue,resolveServiceBindings as Be}from"./packem_shared/companionServiceBinding-BZjm486n.mjs";import{SHAPES_FILENAME as je,discoverShapes as Ve}from"./packem_shared/SHAPES_FILENAME-CH0KrAdb.mjs";import{default as We}from"./packem_shared/discoverStorageRulesMetadata-CtE5trUR.mjs";import{WORKFLOWS_FILENAME as Ke,discoverWorkflows as Qe}from"./packem_shared/WORKFLOWS_FILENAME-DfVfBum_.mjs";import{emitApp as qe}from"./packem_shared/emitApp-BsXqg0CQ.mjs";import{isD1GlobalTable as Je,isHyperdriveGlobalTable as Xe}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as $e,emitOpenApi as er,emitOpenApiModule as rr}from"./packem_shared/buildOpenApiDocument-B8KEeeRr.mjs";import{OPENRPC_VERSION as tr,buildOpenRpcDocument as ir,emitOpenRpc as ar,emitOpenRpcModule as sr}from"./packem_shared/OPENRPC_VERSION-UNYmA7Ty.mjs";import{DEFAULT_TARGET as fr,platformMatrixIds as mr,readProjectTarget as pr,resolveCodegenTarget as nr}from"./packem_shared/DEFAULT_TARGET-CVYzxQ0y.mjs";import{b as lr,r as Sr,c as xr,d as Er}from"./packem_shared/project-config-file-DR7xrrNB.mjs";import{PROJECT_CONFIG_FILENAMES as ur,findCodegenConfigFile as Nr,findProjectConfigFile as vr,projectConfigCandidatePaths as gr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs";import{SCHEMA_SNAPSHOT_FILENAME as Or,runCodegen as Ir}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-DfLhJQrR.mjs";import{SchemaSnapshotParseError as Rr,buildSchemaSnapshot as Lr,evaluateSchemaDrift as Mr,indexReferencesOf as Tr,parseSchemaSnapshot as Fr}from"./packem_shared/SchemaSnapshotParseError-CV7mmuPi.mjs";import{default as Pr}from"./packem_shared/fingerprintSchemaSources-C8H1wOcH.mjs";import{schemaFromIr as yr}from"./packem_shared/schemaFromIr-CByOxuZb.mjs";import{LUNORA_ERROR_CODES as Gr,validatorIrToJsonSchema as Ur}from"./packem_shared/LUNORA_ERROR_CODES-D7AVT7qF.mjs";import{SDK_LANGUAGES as Hr,SDK_TARGETS as jr,generateSdk as Vr}from"./sdk/index.mjs";import{redact as Wr,secretKindOf as zr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as Qr}from"./packem_shared/emitDrizzleSchema-BzOChEYW.mjs";import{e as qr}from"./packem_shared/server-CRFaUMKQ.mjs";import{e as Jr}from"./packem_shared/shard-Csztu3jG.mjs";import{G as Zr}from"./packem_shared/shared-Cn7dMQ_u.mjs";import{MESSAGE_SOLUTIONS as eo,findSolutionByMessage as ro}from"@lunora/errors";import{createCodegenProject as to,findTsconfig as io,refreshCodegenProject as ao,tsconfigFingerprint as so}from"./packem_shared/createCodegenProject-Cfr1xHPC.mjs";import{t as mo,u as po,v as no}from"./packem_shared/shard-runtime-D0xuE0pX.mjs";import{emitApi as lo,emitCollections as So,emitInternalApi as xo}from"./packem_shared/emitApi-lwadq5G7.mjs";import{emitCrons as Ao,emitScheduler as uo,emitVectors as No,emitWranglerCronTriggers as vo}from"./packem_shared/emitCrons-CCRKs482.mjs";import{emitDataModel as Co}from"./packem_shared/emitDataModel-BvCZS4Yq.mjs";import{emitFunctions as Io}from"./packem_shared/emitFunctions-ppMX7E3X.mjs";import{isTypedSchema as Ro}from"./packem_shared/isTypedSchema-CDv3pJB6.mjs";const e="0.0.0";export{I as AGENTS_FILENAME,ne as ALL_NOTIFY_CHANNELS,E as CAPABILITY_PROBES,u as COMPANION_BINDING,N as COMPANION_SERVICE_NAME,P as CONTAINERS_FILENAME,g as CodegenDiagnosticError,fr as DEFAULT_TARGET,U as ENV_FILENAME,K as FLAGS_FILENAME,Zr as GENERATED_HEADER,Gr as LUNORA_ERROR_CODES,eo as LUNORA_SOLUTION_RULES,se as MUTATORS_FILENAME,ce as NOTIFY_FILENAME,tr as OPENRPC_VERSION,ur as PROJECT_CONFIG_FILENAMES,ge as QUEUES_FILENAME,Or as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Hr as SDK_LANGUAGES,jr as SDK_TARGETS,je as SHAPES_FILENAME,Rr as SchemaSnapshotParseError,e as VERSION,Ke as WORKFLOWS_FILENAME,$e as buildOpenApiDocument,ir as buildOpenRpcDocument,Lr as buildSchemaSnapshot,H as capabilitiesUsedBy,ye as companionServiceBinding,to as createCodegenProject,j as createTargetScope,n as describeErrorLevelFindings,C as diagnosticAt,i as diffSchemaSnapshots,_ as discoverAgents,F as discoverAuthApiCalls,D as discoverContainers,b as discoverCrons,Q as discoverFlags,q as discoverFunctions,J as discoverHttpRoutes,Z as discoverHyperdriveCalls,ee as discoverInserts,oe as discoverMaskProcedures,ie as discoverMigrations,de as discoverMutators,me as discoverNondeterministicCalls,le as discoverNotifyCalls,Se as discoverNotifyChannels,xe as discoverNotifyConfig,Ne as discoverQueries,Ce as discoverQueues,Ie as discoverR2sqlCalls,Me as discoverRlsMetadata,Re as discoverRlsProcedures,Fe as discoverSandboxUsage,Pe as discoverSchema,Ve as discoverShapes,We as discoverStorageRulesMetadata,Qe as discoverWorkflows,mo as emitAgents,lo as emitApi,qe as emitApp,So as emitCollections,po as emitContainers,Ao as emitCrons,Co as emitDataModel,Qr as emitDrizzleSchema,Io as emitFunctions,xo as emitInternalApi,er as emitOpenApi,rr as emitOpenApiModule,ar as emitOpenRpc,sr as emitOpenRpcModule,uo as emitScheduler,qr as emitServer,Jr as emitShard,No as emitVectors,no as emitWorkflows,vo as emitWranglerCronTriggers,c as errorAdvisoryNames,l as errorPlatformDiagnosticNames,Mr as evaluateSchemaDrift,Nr as findCodegenConfigFile,ro as findLunoraSolution,vr as findProjectConfigFile,io as findTsconfig,Pr as fingerprintSchemaSources,V as foldCapabilitySignals,d as formatAdvisories,Vr as generateSdk,Tr as indexReferencesOf,Je as isD1GlobalTable,Xe as isHyperdriveGlobalTable,L as isTestPath,Ro as isTypedSchema,f as lintSchema,M as listLunoraSourceFiles,lr as loadProjectConfig,k as mayReadCapabilityContext,Fr as parseSchemaSnapshot,mr as platformMatrixIds,gr as projectConfigCandidatePaths,be as readBoundServiceBindings,Ge as readDevServiceBindings,Ae as readPackageDependencies,Sr as readProjectConfigLiterals,xr as readProjectLazyFunctions,Er as readProjectSecurityHeaders,pr as readProjectTarget,Ue as readServiceBindings,Wr as redact,ao as refreshCodegenProject,nr as resolveCodegenTarget,Be as resolveServiceBindings,Ir as runCodegen,yr as schemaFromIr,zr as secretKindOf,a as serializeSchemaSnapshot,S as sortedUniqueNames,W as sourceCapabilitySignals,m as toAdvisorContext,so as tsconfigFingerprint,Ur as validatorIrToJsonSchema};
@@ -1,4 +1,4 @@
1
- import{existsSync as z,readFileSync as Xe,mkdirSync as jt,writeFileSync as Or,rmSync as fe,readdirSync as Ht}from"node:fs";import{dirname as Ze,join as v,basename as kr,relative as Gt}from"node:path";import{performance as St}from"node:perf_hooks";import{runAdvisor as Rr}from"@lunora/advisor";import{LunoraError as R}from"@lunora/errors";import{serializeSchemaSnapshot as Fr}from"./SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import{toAdvisorContext as Lr}from"./formatAdvisories-BCVASH7N.mjs";import{Node as r,SyntaxKind as d,Project as Yt,ts as Dr,VariableDeclarationKind as Qt}from"ts-morph";import{listLunoraSourceFiles as y,lunoraRelativePath as I,descendantsOfKind as E,bindingKeyName as pe,collectCallRows as O,findObjectProperty as q,collectSecurityCallRows as _r,propertyInitializer as L,listSecurityScanFiles as et,objectLiteralFromCallbackBody as _n,limitNameOf as Mn,optionsObjectLiteral as zn,handlerOf as Mr,collectNodeRows as ae,chainRootOf as tt,outermostValueWrapper as T,isWriteTarget as st,isSameNode as N,unwrapExpression as h,isConstDeclaration as ce,memberAccessOf as Jt,returningFunctionOf as kt,walkChain as zr,RUN_METHODS as $n,functionReferenceSegments as $r,isTestPath as Kr,isFunctionLike as le,functionKeyOf as Kn,withSourceListMemo as Br}from"./isTestPath-DRIdZaij.mjs";import{j as Z,h as Y,d as D,b as Xt,c as S,a as Zt,w as es,k as Vr,l as Ur,f as Wr,m as qr,g as Rt,i as jr}from"./attribution-BhGR_h0Z.mjs";import{b as Bs,r as At,a as J,e as Hr,m as Bn,c as nt,f as ts,E as Vn,C as Un,d as Gr,g as Yr,i as Qr}from"./context-root-DnvrQxae.mjs";import{a as C,i as Wn,c as ie,d as qn,e as Jr,f as Xr,g as jn}from"./classify-procedure-call-BZ164dkJ.mjs";import{a as A,s as Zr}from"./property-name-7cBlgK_O.mjs";import{b as eo,a as Hn}from"./module-specifiers-BctA0m_p.mjs";import{r as it,s as to}from"./parse-validator-BisfC8bR.mjs";import so from"./discoverAuthApiCalls-ENLGem4M.mjs";import{i as $,r as Gn}from"./database-calls-BRI5W-Mp.mjs";import{i as Ft,p as Yn,w as no,d as io}from"./index-jtzAVdUp.mjs";import ro from"./discoverHyperdriveCalls-BaRayTZe.mjs";import{diagnosticAt as Ee}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{m as ss,a as qe,s as Qn,d as oo}from"./index-mFEIaT45.mjs";import{MUTATORS_FILENAME as ao,isDefineMutatorCallee as co,mutatorServerImplOf as lo,discoverMutators as uo}from"./MUTATORS_FILENAME-C3OImAxC.mjs";import fo from"./discoverNondeterministicCalls-BoF6ob-B.mjs";import{discoverNotifyConfig as po,discoverNotifyCalls as go}from"./ALL_NOTIFY_CHANNELS-DPxI0EHQ.mjs";import mo from"./discoverR2sqlCalls-CZjqFVi_.mjs";import ho from"./discoverRlsProcedures-mjiA0I4S.mjs";import{s as ns,n as vo}from"./dispatch-namespace-DwTjD7BU.mjs";import{secretKindOf as Eo,redact as xo,isHeuristicSecretKind as So,isSecretishName as Ao}from"./redact-Cy14LEnc.mjs";import{r as Jn,p as yo,c as bo,a as No,e as Po,d as wo}from"./project-config-file-DR7xrrNB.mjs";import{a as _e,d as Io,r as Co}from"./modules-Qpm_zqz4.mjs";import{WORKFLOWS_FILENAME as To,discoverWorkflows as Oo}from"./WORKFLOWS_FILENAME-DfVfBum_.mjs";import{r as ko}from"./json-data-Chfs2Cz5.mjs";import{a as Ro,I as Fo,g as Lo,G as Xn,d as Do,i as _o}from"./shared-Cn7dMQ_u.mjs";import{createCodegenProject as Mo}from"./createCodegenProject-Cfr1xHPC.mjs";import{findTsconfig as lx,refreshCodegenProject as dx,tsconfigFingerprint as ux}from"./createCodegenProject-Cfr1xHPC.mjs";import{wranglerString as zo,wranglerValue as $o,companionName as Ko,COMPANION_FILES as Bo}from"./COMPANION_BINDING-Da_v9XpC.mjs";import{CAPABILITIES as Vo,usedCapabilities as Uo}from"./CAPABILITY_PROBES-BuNEmlCO.mjs";import{isD1GlobalTable as Zn,isHyperdriveGlobalTable as ei}from"./isD1GlobalTable-udvHAAzD.mjs";import{discoverAgents as Wo}from"./AGENTS_FILENAME-D0Y0_UgB.mjs";import{discoverContainers as qo}from"./CONTAINERS_FILENAME-J-e3Vanb.mjs";import jo from"./discoverCrons-DWVXmktw.mjs";import{discoverEnv as Ho}from"./ENV_FILENAME-COPIfgzp.mjs";import{contextPropertiesRead as Go,createTargetScope as Yo,fileWiresRequestSecretTool as Qo,discoverFeatureUsage as Jo}from"./capabilitiesUsedBy-BwhaHK08.mjs";import ti from"./readPackageDependencies-RHhGiz0k.mjs";import{PROJECT_CONFIG_FILENAMES as Xo,findProjectConfigFile as si,findCodegenConfigFile as Zo}from"./PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs";import{discoverQueueDeclarations as ea}from"./QUEUES_FILENAME-Ba-sK5Ek.mjs";import{discoverSandboxUsage as ta}from"./discoverSandboxUsage-Ccy9n7G1.mjs";import{resolveServiceBindings as sa}from"./companionServiceBinding-BZjm486n.mjs";import na from"./discoverStorageRulesMetadata-CtE5trUR.mjs";import{resolveCodegenTarget as Me,gatePlatformFeatures as ia,readTargetDiagnostics as ra,vectorizeDimensionDiagnostics as oa,liveStreamsDeliveryAuthorizationDiagnostic as aa,socketRoutesDeliveryAuthorizationDiagnostic as ca,studioPlatformFor as la,platformFeatureAvailable as da,gateAdminTokenRevocation as ua}from"./DEFAULT_TARGET-CVYzxQ0y.mjs";import{i as fa}from"./schema-BgM8A3XV.mjs";import{b as ni,e as pa}from"./shard-Csztu3jG.mjs";import{e as ga,a as ma}from"./server-CRFaUMKQ.mjs";import{emitDataModel as ha}from"./emitDataModel-BvCZS4Yq.mjs";import{i as va,b as Ea,e as xa,d as Sa,f as Aa,c as ya}from"./unwrap-handler-return-DUzluwPj.mjs";import ba from"./discoverHttpRoutes-CAoEemno.mjs";import Na from"./discoverInserts-DmSa4WKU.mjs";import{e as ii}from"./exported-procedure-chains-h8Y7xDjq.mjs";import Pa from"./discoverMigrations-Duh6HVG3.mjs";import Vs from"./discoverQueries-spxu-wHR.mjs";import wa from"./discoverRlsMetadata-Cc0zA-gZ.mjs";import Ia from"./discoverSchema-ynieYB0n.mjs";import{discoverShapes as Ca}from"./SHAPES_FILENAME-CH0KrAdb.mjs";import{i as Ta}from"./reserved-words-CW1QFbTd.mjs";import{emitAuthModule as Oa,emitApp as ka}from"./emitApp-C3IUdkkt.mjs";import{readJsonSync as Ra}from"@visulima/fs";import{indexReferencesOf as Fa,buildSchemaSnapshot as La}from"./SchemaSnapshotParseError-DnAuFdpl.mjs";import{buildOpenApiDocument as Da,emitOpenApiModule as _a}from"./buildOpenApiDocument-B8KEeeRr.mjs";import{buildOpenRpcDocument as Ma,emitOpenRpcModule as za}from"./OPENRPC_VERSION-UNYmA7Ty.mjs";import{w as $a,u as Ka,v as Ba,t as Va,x as Ua}from"./shard-runtime-D0xuE0pX.mjs";import{emitCollections as Wa,emitSeed as qa,emitApi as ja,emitInternalApi as Ha}from"./emitApi-lwadq5G7.mjs";import{emitCrons as Ga,emitScheduler as Ya,emitAdminRevocations as Qa,emitShardRegistry as Ja,emitDurableObjects as Xa,emitVectors as Za,emitWranglerCronTriggers as ec}from"./emitCrons-CCRKs482.mjs";import tc from"./emitDrizzleSchema-BzOChEYW.mjs";import{LAZY_FUNCTION_DIRECTORY as ri,emitFunctions as sc,emitLazyFunctionModules as nc}from"./emitFunctions-ppMX7E3X.mjs";const ic=(e,t=!1)=>{if(e.length===0)return"";const s=Do(t),n=e.map(c=>{if(Ro(c.exportName,"live stream export name"),!Fo.test(c.filePath))throw new Error(`@lunora/codegen: live stream file path is not safe to import: ${JSON.stringify(c.filePath)}`);return`import type { ${c.exportName} as ${c.exportName}Stream } from "../${c.filePath}.js";`}),i=e.map(c=>{const l=c.topics.map(u=>{Lo(u.name,"live topic name");const f=`(typeof ${c.exportName}Stream)["topics"]["${u.name}"]`,p=`LiveTopicRef<LiveTopicPayload<${f}>>`,m=JSON.stringify(c.id);if(u.fields.length===0)return` ${u.name}: (): ${p} => ({ __lunoraLive: ${m}, topic: ${JSON.stringify(u.name)} }),`;const x=u.fields.map(_=>`\${encodeURIComponent(key.${_})}`).join(":");return` ${u.name}: (key: LiveTopicKey<${f}>): ${p} => ({
1
+ import{existsSync as z,readFileSync as Xe,mkdirSync as jt,writeFileSync as Or,rmSync as fe,readdirSync as Ht}from"node:fs";import{dirname as Ze,join as v,basename as kr,relative as Gt}from"node:path";import{performance as St}from"node:perf_hooks";import{runAdvisor as Rr}from"@lunora/advisor";import{LunoraError as R}from"@lunora/errors";import{serializeSchemaSnapshot as Fr}from"./SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import{toAdvisorContext as Lr}from"./formatAdvisories-BCVASH7N.mjs";import{Node as r,SyntaxKind as d,Project as Yt,ts as Dr,VariableDeclarationKind as Qt}from"ts-morph";import{listLunoraSourceFiles as y,lunoraRelativePath as I,descendantsOfKind as E,bindingKeyName as pe,collectCallRows as O,findObjectProperty as q,collectSecurityCallRows as _r,propertyInitializer as L,listSecurityScanFiles as et,objectLiteralFromCallbackBody as _n,limitNameOf as Mn,optionsObjectLiteral as zn,handlerOf as Mr,collectNodeRows as ae,chainRootOf as tt,outermostValueWrapper as T,isWriteTarget as st,isSameNode as N,unwrapExpression as h,isConstDeclaration as ce,memberAccessOf as Jt,returningFunctionOf as kt,walkChain as zr,RUN_METHODS as $n,functionReferenceSegments as $r,isTestPath as Kr,isFunctionLike as le,functionKeyOf as Kn,withSourceListMemo as Br}from"./isTestPath-DRIdZaij.mjs";import{j as Z,h as Y,d as D,b as Xt,c as S,a as Zt,w as es,k as Vr,l as Ur,f as Wr,m as qr,g as Rt,i as jr}from"./attribution-BhGR_h0Z.mjs";import{b as Bs,r as At,a as J,e as Hr,m as Bn,c as nt,f as ts,E as Vn,C as Un,d as Gr,g as Yr,i as Qr}from"./context-root-DnvrQxae.mjs";import{a as C,i as Wn,c as ie,d as qn,e as Jr,f as Xr,g as jn}from"./classify-procedure-call-BZ164dkJ.mjs";import{a as A,s as Zr}from"./property-name-7cBlgK_O.mjs";import{b as eo,a as Hn}from"./module-specifiers-BctA0m_p.mjs";import{r as it,s as to}from"./parse-validator-BisfC8bR.mjs";import so from"./discoverAuthApiCalls-ENLGem4M.mjs";import{i as $,r as Gn}from"./database-calls-BRI5W-Mp.mjs";import{i as Ft,p as Yn,w as no,d as io}from"./index-jtzAVdUp.mjs";import ro from"./discoverHyperdriveCalls-BaRayTZe.mjs";import{diagnosticAt as Ee}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{m as ss,a as qe,s as Qn,d as oo}from"./index-mFEIaT45.mjs";import{MUTATORS_FILENAME as ao,isDefineMutatorCallee as co,mutatorServerImplOf as lo,discoverMutators as uo}from"./MUTATORS_FILENAME-C3OImAxC.mjs";import fo from"./discoverNondeterministicCalls-BoF6ob-B.mjs";import{discoverNotifyConfig as po,discoverNotifyCalls as go}from"./ALL_NOTIFY_CHANNELS-DPxI0EHQ.mjs";import mo from"./discoverR2sqlCalls-CZjqFVi_.mjs";import ho from"./discoverRlsProcedures-mjiA0I4S.mjs";import{s as ns,n as vo}from"./dispatch-namespace-DwTjD7BU.mjs";import{secretKindOf as Eo,redact as xo,isHeuristicSecretKind as So,isSecretishName as Ao}from"./redact-Cy14LEnc.mjs";import{r as Jn,p as yo,c as bo,a as No,e as Po,d as wo}from"./project-config-file-DR7xrrNB.mjs";import{a as _e,d as Io,r as Co}from"./modules-Qpm_zqz4.mjs";import{WORKFLOWS_FILENAME as To,discoverWorkflows as Oo}from"./WORKFLOWS_FILENAME-DfVfBum_.mjs";import{r as ko}from"./json-data-Chfs2Cz5.mjs";import{a as Ro,I as Fo,g as Lo,G as Xn,d as Do,i as _o}from"./shared-Cn7dMQ_u.mjs";import{createCodegenProject as Mo}from"./createCodegenProject-Cfr1xHPC.mjs";import{findTsconfig as lx,refreshCodegenProject as dx,tsconfigFingerprint as ux}from"./createCodegenProject-Cfr1xHPC.mjs";import{wranglerString as zo,wranglerValue as $o,companionName as Ko,COMPANION_FILES as Bo}from"./COMPANION_BINDING-Da_v9XpC.mjs";import{CAPABILITIES as Vo,usedCapabilities as Uo}from"./CAPABILITY_PROBES-BuNEmlCO.mjs";import{isD1GlobalTable as Zn,isHyperdriveGlobalTable as ei}from"./isD1GlobalTable-udvHAAzD.mjs";import{discoverAgents as Wo}from"./AGENTS_FILENAME-D0Y0_UgB.mjs";import{discoverContainers as qo}from"./CONTAINERS_FILENAME-J-e3Vanb.mjs";import jo from"./discoverCrons-DWVXmktw.mjs";import{discoverEnv as Ho}from"./ENV_FILENAME-COPIfgzp.mjs";import{contextPropertiesRead as Go,createTargetScope as Yo,fileWiresRequestSecretTool as Qo,discoverFeatureUsage as Jo}from"./capabilitiesUsedBy-BwhaHK08.mjs";import ti from"./readPackageDependencies-RHhGiz0k.mjs";import{PROJECT_CONFIG_FILENAMES as Xo,findProjectConfigFile as si,findCodegenConfigFile as Zo}from"./PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs";import{discoverQueueDeclarations as ea}from"./QUEUES_FILENAME-Ba-sK5Ek.mjs";import{discoverSandboxUsage as ta}from"./discoverSandboxUsage-Ccy9n7G1.mjs";import{resolveServiceBindings as sa}from"./companionServiceBinding-BZjm486n.mjs";import na from"./discoverStorageRulesMetadata-CtE5trUR.mjs";import{resolveCodegenTarget as Me,gatePlatformFeatures as ia,readTargetDiagnostics as ra,vectorizeDimensionDiagnostics as oa,liveStreamsDeliveryAuthorizationDiagnostic as aa,socketRoutesDeliveryAuthorizationDiagnostic as ca,studioPlatformFor as la,platformFeatureAvailable as da,gateAdminTokenRevocation as ua}from"./DEFAULT_TARGET-CVYzxQ0y.mjs";import{i as fa}from"./schema-BgM8A3XV.mjs";import{b as ni,e as pa}from"./shard-Csztu3jG.mjs";import{e as ga,a as ma}from"./server-CRFaUMKQ.mjs";import{emitDataModel as ha}from"./emitDataModel-BvCZS4Yq.mjs";import{i as va,b as Ea,e as xa,d as Sa,f as Aa,c as ya}from"./unwrap-handler-return-DUzluwPj.mjs";import ba from"./discoverHttpRoutes-CAoEemno.mjs";import Na from"./discoverInserts-DmSa4WKU.mjs";import{e as ii}from"./exported-procedure-chains-h8Y7xDjq.mjs";import Pa from"./discoverMigrations-Duh6HVG3.mjs";import Vs from"./discoverQueries-spxu-wHR.mjs";import wa from"./discoverRlsMetadata-Cc0zA-gZ.mjs";import Ia from"./discoverSchema-ynieYB0n.mjs";import{discoverShapes as Ca}from"./SHAPES_FILENAME-CH0KrAdb.mjs";import{i as Ta}from"./reserved-words-CW1QFbTd.mjs";import{emitAuthModule as Oa,emitApp as ka}from"./emitApp-BsXqg0CQ.mjs";import{readJsonSync as Ra}from"@visulima/fs";import{indexReferencesOf as Fa,buildSchemaSnapshot as La}from"./SchemaSnapshotParseError-CV7mmuPi.mjs";import{buildOpenApiDocument as Da,emitOpenApiModule as _a}from"./buildOpenApiDocument-B8KEeeRr.mjs";import{buildOpenRpcDocument as Ma,emitOpenRpcModule as za}from"./OPENRPC_VERSION-UNYmA7Ty.mjs";import{w as $a,u as Ka,v as Ba,t as Va,x as Ua}from"./shard-runtime-D0xuE0pX.mjs";import{emitCollections as Wa,emitSeed as qa,emitApi as ja,emitInternalApi as Ha}from"./emitApi-lwadq5G7.mjs";import{emitCrons as Ga,emitScheduler as Ya,emitAdminRevocations as Qa,emitShardRegistry as Ja,emitDurableObjects as Xa,emitVectors as Za,emitWranglerCronTriggers as ec}from"./emitCrons-CCRKs482.mjs";import tc from"./emitDrizzleSchema-BzOChEYW.mjs";import{LAZY_FUNCTION_DIRECTORY as ri,emitFunctions as sc,emitLazyFunctionModules as nc}from"./emitFunctions-ppMX7E3X.mjs";const ic=(e,t=!1)=>{if(e.length===0)return"";const s=Do(t),n=e.map(c=>{if(Ro(c.exportName,"live stream export name"),!Fo.test(c.filePath))throw new Error(`@lunora/codegen: live stream file path is not safe to import: ${JSON.stringify(c.filePath)}`);return`import type { ${c.exportName} as ${c.exportName}Stream } from "../${c.filePath}.js";`}),i=e.map(c=>{const l=c.topics.map(u=>{Lo(u.name,"live topic name");const f=`(typeof ${c.exportName}Stream)["topics"]["${u.name}"]`,p=`LiveTopicRef<LiveTopicPayload<${f}>>`,m=JSON.stringify(c.id);if(u.fields.length===0)return` ${u.name}: (): ${p} => ({ __lunoraLive: ${m}, topic: ${JSON.stringify(u.name)} }),`;const x=u.fields.map(_=>`\${encodeURIComponent(key.${_})}`).join(":");return` ${u.name}: (key: LiveTopicKey<${f}>): ${p} => ({
2
2
  __lunoraLive: ${m},
3
3
  topic: \`${u.name}:${x}\`,
4
4
  }),`});return` ${c.exportName}: {
@@ -9,7 +9,7 @@ ${a.map(l=>U(l)).join(`
9
9
  `),i.length>0&&e.some(a=>a.identityRewrites!==!0)&&d.push(` • Migration(s) ${i.join(", ")} return each document unchanged, so they rewrite no row and cover nothing. Fill in \`up\`.
10
10
  `),r.length>0&&d.push(" • If the stored rows already fit the new schema, `lunora deploy` goes ahead on its own: it reads the rows of each affected table from the deployed worker (`--migrate-url` or the project link, plus `LUNORA_ADMIN_TOKEN`) and names any row that does not fit.\n");for(const a of e){const{coverage:l}=a;if(l===void 0)continue;const u=l.table??e.find(h=>h.table!==void 0)?.table??"users",f=`{ ${Object.entries(l).toSorted(([h],[p])=>h.localeCompare(p)).map(([h,p])=>`${h}: ${typeof p=="object"?`{ ${Object.entries(p).map(([y,$])=>`${y}: ${JSON.stringify($)}`).join(", ")} }`:JSON.stringify(p)}`).join(", ")} }`,m=l.table===void 0?"":` and iterates \`${l.table}\` with an \`up\` that rewrites rows`,S=a.summary.split(" — ")[0]??"",k=l.ttl===void 0?`Move the rows first (\`lunora export --tables ${u} --out ${u}.ndjson\`, deploy, \`lunora import ${u}.ndjson\`), then declare: `:`Decide which rows must survive and refresh \`${l.ttl.field}\` on them in \`up\`, then declare: `;d.push(` • "${S}" moves, empties or deletes data, so it stays blocked until a new migration declares \`covers: ${f}\`${m}. ${k}\`defineMigration({ id: "rehome_${u}", table: "${l.table??u}", covers: ${f}, up: (doc) => ({ ...doc, tenantId: doc.tenantId ?? "default" }) })\`.
11
11
  `)}return d.push(P()),[`${n??"deploy"} blocked: ${String(e.length)} unresolved breaking schema change(s) since the last blessed schema baseline:`,w(e),"",`To fix:
12
- ${d.join("")}Docs: https://lunora.dev/docs/migrations`].join(`
12
+ ${d.join("")}Docs: https://lunora.sh/docs/concepts/migrations`].join(`
13
13
  `)},Q=e=>{const{allowDrift:t=!1,baseline:n,command:i,current:s,indexReferences:r=[],migrations:d}=e,a={changes:O(n,s).changes.map(o=>H(o,r))},l=a.changes.filter(o=>o.severity==="breaking"),u=s.migrationIds.filter(o=>!(n?.migrationIds??[]).includes(o)),f=d.filter(o=>u.includes(o.id)),m=(o,c,b=[])=>({blocked:o,changes:a.changes,newMigrationIds:u,reason:c,uncovered:b}),S=new Set(f.filter(o=>o.table!==""&&o.identity!==!0).map(o=>o.table)),k=f.filter(o=>o.table==="").map(o=>o.id),h=f.filter(o=>o.table!==""&&o.identity===!0).map(o=>o.id);if(a.changes.length===0||n===void 0)return m(!1,"");if(l.length===0)return m(!1,`schema drift detected (all additive/safe):
14
14
  ${w(a.changes)}`);const p=o=>o.coverage!==void 0?f.some(c=>M(c,o)):o.identityRewrites===!0&&o.table!==void 0?f.some(c=>c.table===o.table):x(o)&&S.has(o.table),y=l.filter(o=>!p(o));if(y.length===0){const o=f.filter(c=>l.some(b=>b.coverage===void 0?x(b)&&(c.identity!==!0||b.identityRewrites===!0)&&b.table===c.table:M(c,b))).map(c=>c.id);return m(!1,`breaking schema drift detected, covered by ${String(o.length)} new migration(s) (${o.join(", ")}):
15
15
  ${w(l)}`)}const $=z(y,{identity:h,unresolved:k},i);return t?m(!1,`${$}
@@ -1,4 +1,4 @@
1
- import{APP_METHOD_CAPABILITIES as N}from"./CAPABILITY_PROBES-BuNEmlCO.mjs";import{i as q}from"./schema-BgM8A3XV.mjs";import{a as I,I as L,G as y}from"./shared-Cn7dMQ_u.mjs";const j={configKey:"vectors",doc:"Wire the Vectorize index map backing `ctx.vectors`.",method:"vectors"},f=e=>[...N.filter(({key:r})=>e.capabilities.has(r)).map(({appMethod:r})=>r),...e.hasVectors?[j]:[]],w=e=>f(e).length>0,k=e=>(e.emailAgents?.length??0)>0,l=e=>e.tables.some(r=>q(r)),p=e=>e.liveStreams===!0&&(e.liveStreamDeclarations?.length??0)>0,$=e=>e.hasScheduler?`
1
+ import{APP_METHOD_CAPABILITIES as T}from"./CAPABILITY_PROBES-BuNEmlCO.mjs";import{i as N}from"./schema-BgM8A3XV.mjs";import{a as I,I as L,G as y}from"./shared-Cn7dMQ_u.mjs";const j={configKey:"vectors",doc:"Wire the Vectorize index map backing `ctx.vectors`.",method:"vectors"},f=e=>[...T.filter(({key:r})=>e.capabilities.has(r)).map(({appMethod:r})=>r),...e.hasVectors?[j]:[]],w=e=>f(e).length>0,k=e=>(e.emailAgents?.length??0)>0,l=e=>e.tables.some(r=>N(r)),p=e=>e.liveStreams===!0&&(e.liveStreamDeclarations?.length??0)>0,$=e=>e.hasScheduler?`
2
2
  /** Resolve the \`SchedulerDO\`-backed scheduler for this env; \`undefined\` until the namespace is wired. */
3
3
  private resolveScheduler(env: Env): ReturnType<typeof createScheduler> | undefined {
4
4
  const namespace = this.schedulerDeclaration?.namespace(env);
@@ -567,7 +567,7 @@ const buildGlobalCdcApplier =
567
567
  : {}),`]:[],...l(e)?[" ...(this.shardRegistrySelector ? { shardRegistry: (rawEnv: Record<string, unknown>) => this.shardRegistrySelector?.(rawEnv as Env) } : {}),"]:[],...e.hasSourcedTables?[" ...(this.sourceClientFactory === undefined ? {} : { sourceClient: this.sourceClientFactory }),"]:[],...e.hasStorage?[" ...(this.storageDeclaration ? { storage: (rawEnv: Record<string, unknown>, origin?: string) => this.resolveStorage(rawEnv as Env, origin) } : {}),"]:[],...w(e)?[" ...this.shardExtras,"]:[]];return t.length>0?`
568
568
  ${t.join(`
569
569
  `)}
570
- `:""},U=e=>e?['import * as lunoraIdentityContract from "../identity.js";']:[],F=(e,r)=>e?['import type { CreateAccessResolverOptions } from "@lunora/cloudflare-access";',`import { createAccessResolver${r?", composeResolvers":""} } from "@lunora/cloudflare-access";`]:[],z=e=>e?['import { createKvIntrospectorFromEnv } from "@lunora/bindings/kv";']:[],Q=e=>e?['import { createVectorAdminIntrospector } from "@lunora/bindings/vectors";']:[],J=e=>e?['import type { D1CtxDbOptions, D1DatabaseLike, D1Exec } from "@lunora/d1";','import { applyCdcChanges, createD1CtxDb, emitD1QueryCost, exportGlobalRows, facetGlobalColumn, importGlobalRows, listGlobalTables, readD1CdcChanges, readGlobalTablePage, retryingExec } from "@lunora/d1";']:[],K=e=>e?['import notifyConfig from "../notify.js";']:[],V=e=>k(e)?e.lazyFunctions===!0?['import type { dispatchAgentEmail } from "@lunora/agent/inbound";']:['import { dispatchAgentEmail } from "@lunora/agent/inbound";']:[],Y=e=>k(e)&&e.lazyFunctions!==!0?['import * as lunoraAgentDefinitions from "../agents.js";']:[],X=e=>{const{hasFramework:r,hasGlobal:t,hasHyperdriveGlobal:a,hasQueue:s,useUmbrella:n}=e,i=n?"lunorash/runtime":"@lunora/runtime",d=["ExecutionContextLike","HttpRouterLike","LunoraWorker","Route","ScheduledControllerLike","SecurityOptions","ShardNamespaceLike",...l(e)?["ShardRegistryRpc"]:[],"WorkerOptions",...s?["TriggerTrace"]:[],...t?["GlobalIntrospector"]:[],...e.tables.length>0?["ShardingInfo"]:[],...r?["FrameworkHostHandler"]:[]],c=[...t||a?["createCrossShardRelationCapabilities"]:[],...l(e)?["createDynamicShardRegistry","createQueryCoordinator"]:[],"createWorker",...e.jurisdiction?["declareAppJurisdiction"]:[],"resolveLogArchiveFromEnv",...e.hasAuth?["memoizeIdentity"]:[],...r?["withFrameworkWorker"]:[]].join(", ");return[`import type { ${[...d].toSorted((o,u)=>o.localeCompare(u)).join(", ")} } from "${i}";`,`import { ${c} } from "${i}";`]},Z=e=>{const{hasAccess:r,hasAuth:t,hasGlobal:a,hasHyperdriveGlobal:s,hasKvIntrospector:n,hasQueue:i,hasScheduler:d,hasStorage:c,hasWorkflow:o}=e;return[...t?['import type { AuthNamespaceLike, LunoraAuth, LunoraAuthOptions } from "@lunora/auth";','import type * as LunoraAuthModule from "./authModule.js";']:[],...F(r,t),...J(a),...s?['import type { HyperdriveEngine } from "@lunora/hyperdrive/global";','import { applyHyperdriveGlobalCdc, createHyperdriveGlobalCtxDb, createHyperdriveGlobalIntrospector, exportHyperdriveGlobalRows, importHyperdriveGlobalRows, readHyperdriveGlobalCdc } from "@lunora/hyperdrive/global";','import type { SqlCtxDbOptions, SqlExec } from "@lunora/sql-store";']:[],...z(n),...Q(e.hasVectors),...d?['import type { DurableObjectNamespaceLike } from "@lunora/scheduler";','import { createScheduler } from "@lunora/scheduler";']:[],...c?['import type { R2BucketLike, R2S3Credentials, Storage } from "@lunora/storage";','import { createBucketStorage, createStorage } from "@lunora/storage";']:[],...o?['import { createWorkflowsRestClient } from "@lunora/workflow";']:[],...V(e),...X(e),"",...U(e.identity),...Y(e),...a||s?['import schema from "../schema.js";']:[],...K(e.hasNotify),'import { LUNORA_CRONS } from "./crons.js";','import { LUNORA_FUNCTIONS } from "./functions.js";',...i?['import { createQueueCaptureSink, dispatchQueueBatch, shouldCaptureQueue } from "@lunora/queue";',...e.lazyFunctions===!0?[]:['import { LUNORA_QUEUE_REGISTRY } from "./queues.js";']]:[],'import { createShardDO } from "./shard.js";',...p(e)?[`import { liveStreamRouter } from "${e.useUmbrella?"lunorash/server":"@lunora/server"}";`]:[],...e.hasVectors?['import { LUNORA_VECTOR_INDEXES } from "./vectors.js";']:[]]},ee=e=>e.jurisdiction&&e.jurisdictionPinsAuth===!0?`
570
+ `:""},U=e=>e?['import * as lunoraIdentityContract from "../identity.js";']:[],F=(e,r)=>e?['import type { CreateAccessResolverOptions } from "@lunora/cloudflare-access";',`import { createAccessResolver${r?", composeResolvers":""} } from "@lunora/cloudflare-access";`]:[],z=e=>e?['import { createKvIntrospectorFromEnv } from "@lunora/bindings/kv";']:[],Q=e=>e?['import { createVectorAdminIntrospector } from "@lunora/bindings/vectors";']:[],J=e=>e?['import type { D1CtxDbOptions, D1DatabaseLike, D1Exec } from "@lunora/d1";','import { applyCdcChanges, applySqlMigrationFiles, createD1CtxDb, emitD1QueryCost, exportGlobalRows, facetGlobalColumn, importGlobalRows, listGlobalTables, readD1CdcChanges, readGlobalTablePage, retryingExec } from "@lunora/d1";']:[],K=e=>e?['import notifyConfig from "../notify.js";']:[],V=e=>k(e)?e.lazyFunctions===!0?['import type { dispatchAgentEmail } from "@lunora/agent/inbound";']:['import { dispatchAgentEmail } from "@lunora/agent/inbound";']:[],Y=e=>k(e)&&e.lazyFunctions!==!0?['import * as lunoraAgentDefinitions from "../agents.js";']:[],X=e=>{const{hasFramework:r,hasGlobal:t,hasHyperdriveGlobal:a,hasQueue:s,useUmbrella:n}=e,i=n?"lunorash/runtime":"@lunora/runtime",d=["ExecutionContextLike","HttpRouterLike","LunoraWorker","Route","ScheduledControllerLike","SecurityOptions","ShardNamespaceLike",...l(e)?["ShardRegistryRpc"]:[],"WorkerOptions",...s?["TriggerTrace"]:[],...t?["GlobalIntrospector"]:[],...e.tables.length>0?["ShardingInfo"]:[],...r?["FrameworkHostHandler"]:[]],c=[...t||a?["createCrossShardRelationCapabilities"]:[],...l(e)?["createDynamicShardRegistry","createQueryCoordinator"]:[],"createWorker",...e.jurisdiction?["declareAppJurisdiction"]:[],"resolveLogArchiveFromEnv",...e.hasAuth?["memoizeIdentity"]:[],...r?["withFrameworkWorker"]:[]].join(", ");return[`import type { ${[...d].toSorted((o,u)=>o.localeCompare(u)).join(", ")} } from "${i}";`,`import { ${c} } from "${i}";`]},Z=e=>{const{hasAccess:r,hasAuth:t,hasGlobal:a,hasHyperdriveGlobal:s,hasKvIntrospector:n,hasQueue:i,hasScheduler:d,hasStorage:c,hasWorkflow:o}=e;return[...t?['import type { AuthNamespaceLike, LunoraAuth, LunoraAuthOptions } from "@lunora/auth";','import type * as LunoraAuthModule from "./authModule.js";']:[],...F(r,t),...J(a),...s?['import type { HyperdriveEngine } from "@lunora/hyperdrive/global";','import { applyHyperdriveGlobalCdc, createHyperdriveGlobalCtxDb, createHyperdriveGlobalIntrospector, exportHyperdriveGlobalRows, importHyperdriveGlobalRows, readHyperdriveGlobalCdc } from "@lunora/hyperdrive/global";','import type { SqlCtxDbOptions, SqlExec } from "@lunora/sql-store";']:[],...z(n),...Q(e.hasVectors),...d?['import type { DurableObjectNamespaceLike } from "@lunora/scheduler";','import { createScheduler } from "@lunora/scheduler";']:[],...c?['import type { R2BucketLike, R2S3Credentials, Storage } from "@lunora/storage";','import { createBucketStorage, createStorage } from "@lunora/storage";']:[],...o?['import { createWorkflowsRestClient } from "@lunora/workflow";']:[],...V(e),...X(e),"",...U(e.identity),...Y(e),...a||s?['import schema from "../schema.js";']:[],...K(e.hasNotify),'import { LUNORA_CRONS } from "./crons.js";','import { LUNORA_FUNCTIONS } from "./functions.js";',...i?['import { createQueueCaptureSink, dispatchQueueBatch, shouldCaptureQueue } from "@lunora/queue";',...e.lazyFunctions===!0?[]:['import { LUNORA_QUEUE_REGISTRY } from "./queues.js";']]:[],'import { createShardDO } from "./shard.js";',...p(e)?[`import { liveStreamRouter } from "${e.useUmbrella?"lunorash/server":"@lunora/server"}";`]:[],...e.hasVectors?['import { LUNORA_VECTOR_INDEXES } from "./vectors.js";']:[]]},ee=e=>e.jurisdiction&&e.jurisdictionPinsAuth===!0?`
571
571
  // The schema's jurisdiction pins the auth object like every other DO.
572
572
  jurisdiction: ${JSON.stringify(e.jurisdiction)},`:"",te=e=>typeof e=="string"?`{ mode: { kind: ${JSON.stringify(e)} } }`:`{ mode: { field: ${JSON.stringify(e.field)}, kind: "shardBy" } }`,re=e=>[...e.tables.length>0?[` const tableSharding = new Map<string, ShardingInfo>([
573
573
  ${e.tables.map(r=>` [${JSON.stringify(r.name)}, ${te(r.shardMode)}],`).join(`
@@ -622,6 +622,11 @@ ${S(e).join(`
622
622
  options.exportGlobals = buildGlobalExporter(database);
623
623
  options.syncGlobals = buildGlobalCdcSync(database);
624
624
  options.applyGlobals = buildGlobalCdcApplier(database, this.cdcEnabled);
625
+ // \`lunora migrate apply\` runs the generated SQL files against this binding, recording each in
626
+ // \`__lunora_sql_migrations\`. A file runs once per stage, and nothing else runs it. The schema lets a
627
+ // column a file adds be filled the way the runtime fills it, so its rows never read NULL.
628
+ options.applySqlMigrations = (request) =>
629
+ applySqlMigrationFiles(database, request.files, { ...request, schema: schema as unknown as D1CtxDbOptions["schema"] });
625
630
  }
626
631
  }`]:[],...e.hasHyperdriveGlobal?[` const hyperdriveDeclaration = this.hyperdriveGlobalDeclaration;
627
632
 
@@ -979,7 +984,7 @@ const LUNORA_SECURITY_HEADERS: SecurityOptions["headers"] = ${JSON.stringify(e.s
979
984
  },
980
985
  );
981
986
  `:"",{asyncIfDeferred:c,deferredArgument:o,deferredParameter:u,loadDeferredLine:h}=me(t),{ensureAuthCall:R,ensureRawAuthCall:D,eventWorker:m,eventWorkerLine:b}=pe(a,o),g=`${a?"() => auth, identityMemos":"() => null"}${o}`,A=`${a?"getAuth: () => LunoraAuth | null, identityMemos: IdentityMemoStore":"_getAuth: () => null"}${u}`,v=`env: Env${u}`,x=t.hasFramework?` const buildWorker = (${v}): LunoraWorker =>
982
- host ? withFrameworkWorker(${oe(t)}, (hostEnv) => this.buildWorkerOptions(hostEnv as Env, ${g})) : createWorker(this.buildWorkerOptions(env, ${g}));`:` const buildWorker = (${v}): LunoraWorker => createWorker(this.buildWorkerOptions(env, ${g}));`,C=t.hasFramework?"host?: FrameworkHostHandler":"",O=be(t),T=` /** Materialise the standalone Cloudflare worker + \`ShardDO\` class. */
987
+ host ? withFrameworkWorker(${oe(t)}, (hostEnv) => this.buildWorkerOptions(hostEnv as Env, ${g})) : createWorker(this.buildWorkerOptions(env, ${g}));`:` const buildWorker = (${v}): LunoraWorker => createWorker(this.buildWorkerOptions(env, ${g}));`,C=t.hasFramework?"host?: FrameworkHostHandler":"",O=be(t),q=` /** Materialise the standalone Cloudflare worker + \`ShardDO\` class. */
983
988
  public build(): ComposedApp {
984
989
  return this.assemble();
985
990
  }${t.hasFramework?"\n\n /** Compose Lunora's realtime plane INTO a meta-framework's Cloudflare handler (SvelteKit/Astro/Nuxt). The framework `host` serves everything except the reserved `/_lunora/*` endpoints; pass the adapter-emitted worker (e.g. SvelteKit's `_worker.js`, Astro's `handle`). */\n public buildFrameworkWorker(host: FrameworkHostHandler): ComposedApp {\n return this.assemble(host);\n }":""}`;return`${y}${Z(t).join(`
@@ -1024,7 +1029,7 @@ ${B(t).join(`
1024
1029
 
1025
1030
  `)}
1026
1031
 
1027
- ${T}
1032
+ ${q}
1028
1033
 
1029
1034
  /** Build the shard DO + compose the worker (standalone or framework-hosted), wrapping the lazy per-isolate singletons + auth init. */
1030
1035
  private assemble(${C}): ComposedApp {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/codegen",
3
- "version": "1.0.0-alpha.405",
3
+ "version": "1.0.0-alpha.406",
4
4
  "description": "Code generator for Lunora: emits _generated/{api,server,dataModel}.ts from your schema",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -50,7 +50,7 @@
50
50
  "access": "public"
51
51
  },
52
52
  "dependencies": {
53
- "@lunora/advisor": "^1.0.0-alpha.288",
53
+ "@lunora/advisor": "^1.0.0-alpha.290",
54
54
  "@lunora/agent": "^1.0.0-alpha.281",
55
55
  "@lunora/container": "1.0.0-alpha.108",
56
56
  "@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",