@lunora/codegen 1.0.0-alpha.342 → 1.0.0-alpha.343
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 +1 -1
- package/dist/packem_shared/{SCHEMA_SNAPSHOT_FILENAME-DC18IFFl.mjs → SCHEMA_SNAPSHOT_FILENAME-BVqpxoxR.mjs} +1 -1
- package/dist/packem_shared/discoverNondeterministicCalls-mFJNU8qY.mjs +1 -0
- package/dist/packem_shared/{emitShard-hzuG9fUo.mjs → emitShard-X1mcPmq6.mjs} +1 -1
- package/dist/packem_shared/{shard-CBG10DT5.mjs → shard-C_cP6i89.mjs} +57 -45
- package/package.json +6 -6
- package/dist/packem_shared/discoverNondeterministicCalls-3INW8oqs.mjs +0 -1
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-C7Um0EnM.mjs";import{formatAdvisories as f,lintSchema as m,toAdvisorContext as d}from"./packem_shared/formatAdvisories-BCVASH7N.mjs";import{describeErrorLevelFindings as n,errorAdvisoryNames as l,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 g,discoverAgents as N}from"./packem_shared/AGENTS_FILENAME-isdHqPIt.mjs";import{isTestPath as R,listLunoraSourceFiles as h}from"./packem_shared/isTestPath-C3QumE88.mjs";import{default as I}from"./packem_shared/discoverAuthApiCalls-CScPrUD-.mjs";import{CONTAINERS_FILENAME as L,discoverContainers as M}from"./packem_shared/CONTAINERS_FILENAME-mK4cZpcz.mjs";import{default as P}from"./packem_shared/discoverCrons-B1_NUt19.mjs";import{capabilitiesUsedBy as b,foldCapabilitySignals as y,mayReadCapabilityContext as U,sourceCapabilitySignals as G}from"./packem_shared/capabilitiesUsedBy-C-7D7vlH.mjs";import{FLAGS_FILENAME as j,discoverFlags as B}from"./packem_shared/FLAGS_FILENAME-BQk3SX8D.mjs";import{default as W}from"./packem_shared/discoverFunctions-DkPOc8b9.mjs";import{default as V}from"./packem_shared/discoverHttpRoutes-DCDgDIYv.mjs";import{default as Q}from"./packem_shared/discoverHyperdriveCalls-CL-d0IVo.mjs";import{default as w}from"./packem_shared/discoverInserts-BcoTjXqI.mjs";import{d as Y}from"./packem_shared/index-CN8FVvr-.mjs";import{default as Z}from"./packem_shared/discoverMigrations-BWxx8Wv9.mjs";import{MUTATORS_FILENAME as ee,discoverMutators as re}from"./packem_shared/MUTATORS_FILENAME-Cy9h3EVW.mjs";import{default as te}from"./packem_shared/discoverNondeterministicCalls-
|
|
1
|
+
import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as a,serializeSchemaSnapshot as s}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-C7Um0EnM.mjs";import{formatAdvisories as f,lintSchema as m,toAdvisorContext as d}from"./packem_shared/formatAdvisories-BCVASH7N.mjs";import{describeErrorLevelFindings as n,errorAdvisoryNames as l,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 g,discoverAgents as N}from"./packem_shared/AGENTS_FILENAME-isdHqPIt.mjs";import{isTestPath as R,listLunoraSourceFiles as h}from"./packem_shared/isTestPath-C3QumE88.mjs";import{default as I}from"./packem_shared/discoverAuthApiCalls-CScPrUD-.mjs";import{CONTAINERS_FILENAME as L,discoverContainers as M}from"./packem_shared/CONTAINERS_FILENAME-mK4cZpcz.mjs";import{default as P}from"./packem_shared/discoverCrons-B1_NUt19.mjs";import{capabilitiesUsedBy as b,foldCapabilitySignals as y,mayReadCapabilityContext as U,sourceCapabilitySignals as G}from"./packem_shared/capabilitiesUsedBy-C-7D7vlH.mjs";import{FLAGS_FILENAME as j,discoverFlags as B}from"./packem_shared/FLAGS_FILENAME-BQk3SX8D.mjs";import{default as W}from"./packem_shared/discoverFunctions-DkPOc8b9.mjs";import{default as V}from"./packem_shared/discoverHttpRoutes-DCDgDIYv.mjs";import{default as Q}from"./packem_shared/discoverHyperdriveCalls-CL-d0IVo.mjs";import{default as w}from"./packem_shared/discoverInserts-BcoTjXqI.mjs";import{d as Y}from"./packem_shared/index-CN8FVvr-.mjs";import{default as Z}from"./packem_shared/discoverMigrations-BWxx8Wv9.mjs";import{MUTATORS_FILENAME as ee,discoverMutators as re}from"./packem_shared/MUTATORS_FILENAME-Cy9h3EVW.mjs";import{default as te}from"./packem_shared/discoverNondeterministicCalls-mFJNU8qY.mjs";import{NOTIFY_FILENAME as se,discoverNotifyCalls as ie,discoverNotifyChannels as fe,discoverNotifyConfig as me}from"./packem_shared/NOTIFY_FILENAME-9to_l_Kh.mjs";import{default as pe}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as le}from"./packem_shared/discoverQueries-CxQRVuIV.mjs";import{QUEUES_FILENAME as xe,discoverQueues as Se}from"./packem_shared/QUEUES_FILENAME-Civ-7SiI.mjs";import{default as ue}from"./packem_shared/discoverR2sqlCalls-B4oeTYEM.mjs";import{default as ve}from"./packem_shared/discoverRlsProcedures-Cl6UKT7L.mjs";import{default as ge}from"./packem_shared/discoverRlsMetadata-D0B4nCmG.mjs";import{discoverSandboxUsage as Oe}from"./packem_shared/discoverSandboxUsage--Z1vx7GM.mjs";import{default as he}from"./packem_shared/discoverSchema-Cwt-DQgh.mjs";import{readServiceBindings as Ie,resolveServiceBindings as _e}from"./packem_shared/readServiceBindings-BA49C6aN.mjs";import{SHAPES_FILENAME as Me,discoverShapes as Fe}from"./packem_shared/SHAPES_FILENAME-DVJbfDZ8.mjs";import{default as De}from"./packem_shared/discoverStorageRulesMetadata-CitX6ziW.mjs";import{WORKFLOWS_FILENAME as ye,discoverWorkflows as Ue}from"./packem_shared/WORKFLOWS_FILENAME-kXq07aGl.mjs";import{emitApp as He}from"./packem_shared/emitApp-BL16wvE9.mjs";import{isD1GlobalTable as Be,isHyperdriveGlobalTable as ke}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as Ke,emitOpenApi as Ve,emitOpenApiModule as ze}from"./packem_shared/buildOpenApiDocument-DWdj2jvW.mjs";import{OPENRPC_VERSION as qe,buildOpenRpcDocument as we,emitOpenRpc as Je,emitOpenRpcModule as Ye}from"./packem_shared/OPENRPC_VERSION-l4HD4osw.mjs";import{DEFAULT_TARGET as Ze,platformMatrixIds as $e,readProjectTarget as er,resolveCodegenTarget as rr}from"./packem_shared/DEFAULT_TARGET-3OLdJhTj.mjs";import{loadProjectConfig as tr,readProjectConfigLiterals as ar}from"./packem_shared/loadProjectConfig-B7RmxIeD.mjs";import{PROJECT_CONFIG_FILENAMES as ir,findCodegenConfigFile as fr,findProjectConfigFile as mr,projectConfigCandidatePaths as dr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs";import{SCHEMA_SNAPSHOT_FILENAME as nr,runCodegen as lr}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-BVqpxoxR.mjs";import{SchemaSnapshotParseError as xr,buildSchemaSnapshot as Sr,evaluateSchemaDrift as Er,parseSchemaSnapshot as ur}from"./packem_shared/SchemaSnapshotParseError-H9eQX4ui.mjs";import{default as vr}from"./packem_shared/fingerprintSchemaSources-BKXkgkj4.mjs";import{schemaFromIr as gr}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as Or,validatorIrToJsonSchema as Rr}from"./packem_shared/LUNORA_ERROR_CODES-CIAJQeKB.mjs";import{SDK_LANGUAGES as Tr,SDK_TARGETS as Ir,generateSdk as _r}from"./sdk/index.mjs";import{redact as Mr,secretKindOf as Fr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as Dr}from"./packem_shared/emitDrizzleSchema-bct1OuH5.mjs";import{e as yr}from"./packem_shared/server-B6VhYK7m.mjs";import{e as Gr}from"./packem_shared/shard-C_cP6i89.mjs";import{G as jr}from"./packem_shared/shared-8vTRkL2-.mjs";import{MESSAGE_SOLUTIONS as kr,findSolutionByMessage as Wr}from"@lunora/errors";import{createCodegenProject as Vr,findTsconfig as zr,refreshCodegenProject as Qr}from"./packem_shared/createCodegenProject-R4so-yTU.mjs";import{s as wr,t as Jr,u as Yr}from"./packem_shared/shard-runtime-ByYXjCKY.mjs";import{emitApi as Zr,emitCollections as $r,emitInternalApi as eo}from"./packem_shared/emitApi-zynTVppI.mjs";import{emitCrons as oo,emitScheduler as to,emitVectors as ao,emitWranglerCronTriggers as so}from"./packem_shared/emitCrons-lc-hnJYn.mjs";import{emitDataModel as fo}from"./packem_shared/emitDataModel-CuFqq97x.mjs";import{emitFunctions as po}from"./packem_shared/emitFunctions-D7mopPiT.mjs";import{isTypedSchema as lo}from"./packem_shared/isTypedSchema-CKzc3ioR.mjs";const e="0.0.0";export{g as AGENTS_FILENAME,E as CAPABILITY_PROBES,L as CONTAINERS_FILENAME,A as CodegenDiagnosticError,Ze as DEFAULT_TARGET,j as FLAGS_FILENAME,jr as GENERATED_HEADER,Or as LUNORA_ERROR_CODES,kr as LUNORA_SOLUTION_RULES,ee as MUTATORS_FILENAME,se as NOTIFY_FILENAME,qe as OPENRPC_VERSION,ir as PROJECT_CONFIG_FILENAMES,xe as QUEUES_FILENAME,nr as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Tr as SDK_LANGUAGES,Ir as SDK_TARGETS,Me as SHAPES_FILENAME,xr as SchemaSnapshotParseError,e as VERSION,ye as WORKFLOWS_FILENAME,Ke as buildOpenApiDocument,we as buildOpenRpcDocument,Sr as buildSchemaSnapshot,b as capabilitiesUsedBy,Vr as createCodegenProject,n as describeErrorLevelFindings,v as diagnosticAt,a as diffSchemaSnapshots,N as discoverAgents,I 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,fe as discoverNotifyChannels,me as discoverNotifyConfig,le as discoverQueries,Se as discoverQueues,ue as discoverR2sqlCalls,ge as discoverRlsMetadata,ve as discoverRlsProcedures,Oe as discoverSandboxUsage,he as discoverSchema,Fe as discoverShapes,De as discoverStorageRulesMetadata,Ue as discoverWorkflows,wr as emitAgents,Zr as emitApi,He as emitApp,$r as emitCollections,Jr as emitContainers,oo as emitCrons,fo as emitDataModel,Dr as emitDrizzleSchema,po as emitFunctions,eo as emitInternalApi,Ve as emitOpenApi,ze as emitOpenApiModule,Je as emitOpenRpc,Ye as emitOpenRpcModule,to as emitScheduler,yr as emitServer,Gr as emitShard,ao as emitVectors,Yr as emitWorkflows,so as emitWranglerCronTriggers,l as errorAdvisoryNames,c as errorPlatformDiagnosticNames,Er as evaluateSchemaDrift,fr as findCodegenConfigFile,Wr as findLunoraSolution,mr as findProjectConfigFile,zr as findTsconfig,vr as fingerprintSchemaSources,y as foldCapabilitySignals,f as formatAdvisories,_r as generateSdk,Be as isD1GlobalTable,ke as isHyperdriveGlobalTable,R as isTestPath,lo as isTypedSchema,m as lintSchema,h as listLunoraSourceFiles,tr as loadProjectConfig,U as mayReadCapabilityContext,ur as parseSchemaSnapshot,$e as platformMatrixIds,dr as projectConfigCandidatePaths,pe as readPackageDependencies,ar as readProjectConfigLiterals,er as readProjectTarget,Ie as readServiceBindings,Mr as redact,Qr as refreshCodegenProject,rr as resolveCodegenTarget,_e as resolveServiceBindings,lr as runCodegen,gr as schemaFromIr,Fr as secretKindOf,s as serializeSchemaSnapshot,x as sortedUniqueNames,G as sourceCapabilitySignals,d as toAdvisorContext,Rr as validatorIrToJsonSchema};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync as M,readFileSync as Ge,mkdirSync as $t,writeFileSync as gr,rmSync as ye,readdirSync as Cn}from"node:fs";import{dirname as Bt,join as E,relative as Tn}from"node:path";import{performance as mt}from"node:perf_hooks";import{runAdvisor as pr}from"@lunora/advisor";import{LunoraError as _}from"@lunora/errors";import{serializeSchemaSnapshot as mr}from"./SCHEMA_SNAPSHOT_VERSION-C7Um0EnM.mjs";import{toAdvisorContext as hr}from"./formatAdvisories-BCVASH7N.mjs";import{Node as r,SyntaxKind as d,Project as Vt,ts as vr,VariableDeclarationKind as Er}from"ts-morph";import{listLunoraSourceFiles as A,lunoraRelativePath as w,bindingKeyName as ce,collectCallRows as C,findObjectProperty as V,collectSecurityCallRows as xr,propertyInitializer as R,listSecurityScanFiles as Ye,objectLiteralFromCallbackBody as On,limitNameOf as kn,optionsObjectLiteral as Rn,handlerOf as Sr,collectNodeRows as ne,chainRootOf as Qe,outermostValueWrapper as I,isWriteTarget as Xe,isSameNode as y,unwrapExpression as h,isConstDeclaration as ie,memberAccessOf as Ut,returningFunctionOf as Pt,walkChain as Ar,RUN_METHODS as Fn,functionReferenceSegments as yr,isTestPath as br,isFunctionLike as re,functionKeyOf as Ln}from"./isTestPath-C3QumE88.mjs";import{b as Q,d as j,f as L,g as Wt,c as x,a as qt,w as jt,k as Nr,l as Pr,h as wr,m as Ir,j as wt,i as Cr}from"./attribution-CG8-kUcl.mjs";import{a as Fs,r as ht,i as G,b as Tr,m as Dn,c as Je,e as Ht,E as Mn,C as _n,d as Or,f as kr,g as Rr}from"./context-root-CNR6TAsP.mjs";import{a as P,i as Fr,c as ee,d as Kn,e as Lr,f as Dr,g as zn}from"./classify-procedure-call-BkaeM9Ej.mjs";import{a as S,s as Mr}from"./property-name-7cBlgK_O.mjs";import{b as _r,a as Ze}from"./module-specifiers-BctA0m_p.mjs";import{r as et,s as Kr}from"./parse-validator-iVTounLK.mjs";import zr from"./discoverAuthApiCalls-CScPrUD-.mjs";import{i as z,r as $n}from"./database-calls-UPlhi3Ks.mjs";import $r from"./discoverHyperdriveCalls-CL-d0IVo.mjs";import{diagnosticAt as de}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{m as Gt,a as Be,s as Bn,d as Br}from"./index-CN8FVvr-.mjs";import{MUTATORS_FILENAME as Vr,isDefineMutatorCallee as Ur,mutatorServerImplOf as Wr,discoverMutators as qr}from"./MUTATORS_FILENAME-Cy9h3EVW.mjs";import jr from"./discoverNondeterministicCalls-
|
|
1
|
+
import{existsSync as M,readFileSync as Ge,mkdirSync as $t,writeFileSync as gr,rmSync as ye,readdirSync as Cn}from"node:fs";import{dirname as Bt,join as E,relative as Tn}from"node:path";import{performance as mt}from"node:perf_hooks";import{runAdvisor as pr}from"@lunora/advisor";import{LunoraError as _}from"@lunora/errors";import{serializeSchemaSnapshot as mr}from"./SCHEMA_SNAPSHOT_VERSION-C7Um0EnM.mjs";import{toAdvisorContext as hr}from"./formatAdvisories-BCVASH7N.mjs";import{Node as r,SyntaxKind as d,Project as Vt,ts as vr,VariableDeclarationKind as Er}from"ts-morph";import{listLunoraSourceFiles as A,lunoraRelativePath as w,bindingKeyName as ce,collectCallRows as C,findObjectProperty as V,collectSecurityCallRows as xr,propertyInitializer as R,listSecurityScanFiles as Ye,objectLiteralFromCallbackBody as On,limitNameOf as kn,optionsObjectLiteral as Rn,handlerOf as Sr,collectNodeRows as ne,chainRootOf as Qe,outermostValueWrapper as I,isWriteTarget as Xe,isSameNode as y,unwrapExpression as h,isConstDeclaration as ie,memberAccessOf as Ut,returningFunctionOf as Pt,walkChain as Ar,RUN_METHODS as Fn,functionReferenceSegments as yr,isTestPath as br,isFunctionLike as re,functionKeyOf as Ln}from"./isTestPath-C3QumE88.mjs";import{b as Q,d as j,f as L,g as Wt,c as x,a as qt,w as jt,k as Nr,l as Pr,h as wr,m as Ir,j as wt,i as Cr}from"./attribution-CG8-kUcl.mjs";import{a as Fs,r as ht,i as G,b as Tr,m as Dn,c as Je,e as Ht,E as Mn,C as _n,d as Or,f as kr,g as Rr}from"./context-root-CNR6TAsP.mjs";import{a as P,i as Fr,c as ee,d as Kn,e as Lr,f as Dr,g as zn}from"./classify-procedure-call-BkaeM9Ej.mjs";import{a as S,s as Mr}from"./property-name-7cBlgK_O.mjs";import{b as _r,a as Ze}from"./module-specifiers-BctA0m_p.mjs";import{r as et,s as Kr}from"./parse-validator-iVTounLK.mjs";import zr from"./discoverAuthApiCalls-CScPrUD-.mjs";import{i as z,r as $n}from"./database-calls-UPlhi3Ks.mjs";import $r from"./discoverHyperdriveCalls-CL-d0IVo.mjs";import{diagnosticAt as de}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{m as Gt,a as Be,s as Bn,d as Br}from"./index-CN8FVvr-.mjs";import{MUTATORS_FILENAME as Vr,isDefineMutatorCallee as Ur,mutatorServerImplOf as Wr,discoverMutators as qr}from"./MUTATORS_FILENAME-Cy9h3EVW.mjs";import jr from"./discoverNondeterministicCalls-mFJNU8qY.mjs";import{discoverNotifyConfig as Hr,discoverNotifyCalls as Gr}from"./NOTIFY_FILENAME-9to_l_Kh.mjs";import Yr from"./discoverR2sqlCalls-B4oeTYEM.mjs";import Qr from"./discoverRlsProcedures-Cl6UKT7L.mjs";import{s as Yt,n as Xr}from"./dispatch-namespace-DwTjD7BU.mjs";import{secretKindOf as Jr,redact as Zr,isHeuristicSecretKind as eo,isSecretishName as to}from"./redact-Cy14LEnc.mjs";import{readProjectConfigLiterals as Vn,readMergeDurableObjects as so}from"./loadProjectConfig-B7RmxIeD.mjs";import{a as Le,d as no,r as io}from"./modules-l-Db0C4S.mjs";import{WORKFLOWS_FILENAME as ro,discoverWorkflows as oo}from"./WORKFLOWS_FILENAME-kXq07aGl.mjs";import{r as ao}from"./json-data-Chfs2Cz5.mjs";import{a as co,I as lo,g as uo,G as Un,d as fo,i as go}from"./shared-8vTRkL2-.mjs";import{createCodegenProject as po}from"./createCodegenProject-R4so-yTU.mjs";import{findTsconfig as PE,refreshCodegenProject as wE}from"./createCodegenProject-R4so-yTU.mjs";import{CAPABILITIES as mo,usedCapabilities as ho}from"./CAPABILITY_PROBES-brcmKenl.mjs";import{isD1GlobalTable as Wn,isHyperdriveGlobalTable as qn}from"./isD1GlobalTable-udvHAAzD.mjs";import{discoverAgents as vo}from"./AGENTS_FILENAME-isdHqPIt.mjs";import{discoverContainers as Eo}from"./CONTAINERS_FILENAME-mK4cZpcz.mjs";import xo from"./discoverCrons-B1_NUt19.mjs";import{contextPropertiesRead as So,fileWiresRequestSecretTool as Ao,discoverFeatureUsage as yo}from"./capabilitiesUsedBy-C-7D7vlH.mjs";import jn from"./readPackageDependencies-RHhGiz0k.mjs";import{PROJECT_CONFIG_FILENAMES as bo,findProjectConfigFile as No}from"./PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs";import{discoverQueueDeclarations as Po}from"./QUEUES_FILENAME-Civ-7SiI.mjs";import{discoverSandboxUsage as wo}from"./discoverSandboxUsage--Z1vx7GM.mjs";import{resolveServiceBindings as Io}from"./readServiceBindings-BA49C6aN.mjs";import Co from"./discoverStorageRulesMetadata-CitX6ziW.mjs";import{resolveCodegenTarget as It,gatePlatformFeatures as To,readTargetDiagnostics as Oo,vectorizeDimensionDiagnostics as ko,liveStreamsDeliveryAuthorizationDiagnostic as Ro,socketRoutesDeliveryAuthorizationDiagnostic as Fo,studioPlatformFor as Lo,platformFeatureAvailable as Do}from"./DEFAULT_TARGET-3OLdJhTj.mjs";import{i as Mo}from"./schema-BgM8A3XV.mjs";import{b as Hn,e as _o}from"./shard-C_cP6i89.mjs";import{e as Ko,a as zo}from"./server-B6VhYK7m.mjs";import{emitDataModel as $o}from"./emitDataModel-CuFqq97x.mjs";import{i as Bo,a as Vo,e as Uo,b as Wo,d as qo,c as jo}from"./unwrap-handler-return-CGdJGvGh.mjs";import Ho from"./discoverFunctions-DkPOc8b9.mjs";import Go from"./discoverHttpRoutes-DCDgDIYv.mjs";import Yo from"./discoverInserts-BcoTjXqI.mjs";import{e as Gn}from"./exported-procedure-chains-D1WlRfqJ.mjs";import Qo from"./discoverMigrations-BWxx8Wv9.mjs";import Xo from"./discoverQueries-CxQRVuIV.mjs";import Jo from"./discoverRlsMetadata-D0B4nCmG.mjs";import Zo from"./discoverSchema-Cwt-DQgh.mjs";import{discoverShapes as ea}from"./SHAPES_FILENAME-DVJbfDZ8.mjs";import{i as ta}from"./reserved-words-CW1QFbTd.mjs";import{emitApp as sa}from"./emitApp-BL16wvE9.mjs";import{readJsonSync as na}from"@visulima/fs";import{buildSchemaSnapshot as ia}from"./SchemaSnapshotParseError-H9eQX4ui.mjs";import{buildOpenApiDocument as ra,emitOpenApiModule as oa}from"./buildOpenApiDocument-DWdj2jvW.mjs";import{buildOpenRpcDocument as aa,emitOpenRpcModule as ca}from"./OPENRPC_VERSION-l4HD4osw.mjs";import{v as la,t as da,u as ua,s as fa,w as ga}from"./shard-runtime-ByYXjCKY.mjs";import{emitCollections as pa,emitSeed as ma,emitApi as ha,emitInternalApi as va}from"./emitApi-zynTVppI.mjs";import{emitCrons as Ea,emitScheduler as xa,emitShardRegistry as Sa,emitDurableObjects as Aa,emitVectors as ya,emitWranglerCronTriggers as ba}from"./emitCrons-lc-hnJYn.mjs";import Na from"./emitDrizzleSchema-bct1OuH5.mjs";import{LAZY_FUNCTION_DIRECTORY as Yn,emitFunctions as Pa,emitLazyFunctionModules as wa}from"./emitFunctions-D7mopPiT.mjs";const Ia=(e,t=!1)=>{if(e.length===0)return"";const s=fo(t),n=e.map(c=>{if(co(c.exportName,"live stream export name"),!lo.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=>{uo(u.name,"live topic name");const f=`(typeof ${c.exportName}Stream)["topics"]["${u.name}"]`,g=`LiveTopicRef<LiveTopicPayload<${f}>>`,m=JSON.stringify(c.id);if(u.fields.length===0)return` ${u.name}: (): ${g} => ({ __lunoraLive: ${m}, topic: ${JSON.stringify(u.name)} }),`;const v=u.fields.map($=>`\${encodeURIComponent(key.${$})}`).join(":");return` ${u.name}: (key: LiveTopicKey<${f}>): ${g} => ({
|
|
2
2
|
__lunoraLive: ${m},
|
|
3
3
|
topic: \`${u.name}:${v}\`,
|
|
4
4
|
}),`});return` ${c.exportName}: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Node as s,SyntaxKind as r}from"ts-morph";import{listLunoraSourceFiles as a,lunoraRelativePath as l,handlerOf as c}from"./isTestPath-C3QumE88.mjs";import{b as d,d as f}from"./attribution-CG8-kUcl.mjs";import{c as m}from"./classify-procedure-call-BkaeM9Ej.mjs";const u={"crypto.getRandomValues":"crypto.getRandomValues","crypto.randomUUID":"crypto.randomUUID","Date.now":"Date.now","Math.random":"Math.random"},p=new Set(["globalThis","self"]),g=new Set(["globalThis","self","window"]),x=e=>{if(s.isIdentifier(e))return e.getText();if(s.isPropertyAccessExpression(e)){const t=e.getExpression();if(s.isIdentifier(t)&&g.has(t.getText()))return e.getName()}},h=e=>{const t=e.getExpression();if(s.isIdentifier(t)){const i=t.getText();return i==="fetch"||i==="Date"?i:void 0}if(!s.isPropertyAccessExpression(t))return;const n=t.getName(),o=x(t.getExpression());if(o!==void 0)return n==="fetch"&&p.has(o)?"fetch":u[`${o}.${n}`]},N=e=>{const t=e.getExpression();if(!s.isIdentifier(t)||t.getText()!=="Date")return;const n=e.getArguments(),o=n.every(i=>s.isNumericLiteral(i)||s.isStringLiteral(i)||s.isNoSubstitutionTemplateLiteral(i));return n.length>0&&o?void 0:"new Date"},E=e=>{const t=e.getInitializer();if(!t||!s.isCallExpression(t))return;const n=m(t);if(!n||n.kind!=="query"&&n.kind!=="mutation")return;const o=c(t,n.receiver);return o?{exportName:f(e)??e.getName(),handler:o,kind:n.kind}:void 0},S=(e,t)=>{const n=[];for(const o of e.handler.getDescendantsOfKind(r.CallExpression)){const i=e.kind==="query"&&o.getExpression().getText()==="ctx.random"?"ctx.random":h(o);i!==void 0&&n.push({callee:i,exportName:e.exportName,file:t,kind:e.kind,line:o.getStartLineNumber()})}for(const o of e.handler.getDescendantsOfKind(r.NewExpression)){const i=N(o);i!==void 0&&n.push({callee:i,exportName:e.exportName,file:t,kind:e.kind,line:o.getStartLineNumber()})}return n},v=(e,t)=>{const n=[];for(const o of d(e)){const i=E(o);i&&n.push(...S(i,t))}return n},w=(e,t)=>{const n=[];for(const o of a(t)){const i=e.getSourceFile(o)??e.addSourceFileAtPath(o);n.push(...v(i,l(t,o)))}return n};export{w as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./SCHEMA_SNAPSHOT_VERSION-C7Um0EnM.mjs";import"./isD1GlobalTable-udvHAAzD.mjs";import"./json-data-Chfs2Cz5.mjs";import{e as d}from"./shard-
|
|
1
|
+
import"./SCHEMA_SNAPSHOT_VERSION-C7Um0EnM.mjs";import"./isD1GlobalTable-udvHAAzD.mjs";import"./json-data-Chfs2Cz5.mjs";import{e as d}from"./shard-C_cP6i89.mjs";import"./shard-runtime-ByYXjCKY.mjs";import"./shared-8vTRkL2-.mjs";import"./platform-8oj7iXQy.mjs";import"./schema-BgM8A3XV.mjs";export{d as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{LunoraError as he}from"@lunora/errors";import{serializeSchemaSnapshot as Jt,hashSchemaSnapshot as Yt}from"./SCHEMA_SNAPSHOT_VERSION-C7Um0EnM.mjs";import{isHyperdriveGlobalTable as zt,isD1GlobalTable as Xt}from"./isD1GlobalTable-udvHAAzD.mjs";import{r as Zt}from"./json-data-Chfs2Cz5.mjs";import{r as $,e as er,a as tr,b as rr,c as nr,d as ar,f as sr,g as or,h as ir,i as dr,j as cr,k as lr,l as ur,m as hr,n as pr,o as mr,p as
|
|
1
|
+
import{LunoraError as he}from"@lunora/errors";import{serializeSchemaSnapshot as Jt,hashSchemaSnapshot as Yt}from"./SCHEMA_SNAPSHOT_VERSION-C7Um0EnM.mjs";import{isHyperdriveGlobalTable as zt,isD1GlobalTable as Xt}from"./isD1GlobalTable-udvHAAzD.mjs";import{r as Zt}from"./json-data-Chfs2Cz5.mjs";import{r as $,e as er,a as tr,b as rr,c as nr,d as ar,f as sr,g as or,h as ir,i as dr,j as cr,k as lr,l as ur,m as hr,n as pr,o as mr,p as fr,q as gr}from"./shard-runtime-ByYXjCKY.mjs";import{u as re,h as br,s as yr,a as wr,I as vr,c as kr,G as Sr,d as Rr}from"./shared-8vTRkL2-.mjs";import{p as xr}from"./platform-8oj7iXQy.mjs";import{i as Ar}from"./schema-BgM8A3XV.mjs";const u=(n,t)=>`((): (() => ${t}) => { let cached: ${t} | undefined; return () => (cached ??= JSON.parse(${JSON.stringify(JSON.stringify(n))}) as ${t}); })()`,pe=["categories","description","facing","level","remediation","title"],Or=n=>{const t={};return{advisoryRows:n.map(a=>{let r=t[a.name];return r||(r=Object.fromEntries(pe.filter(o=>o in a).map(o=>[o,a[o]])),t[a.name]=r),Object.fromEntries(Object.entries(a).filter(([o,d])=>!pe.includes(o)||JSON.stringify(d)!==JSON.stringify(r[o])))}),advisoryRules:t}},Dr=` /**
|
|
2
2
|
* The bare writer every admin/maintenance entry point writes through.
|
|
3
3
|
*
|
|
4
4
|
* Admin and maintenance writes go through the SAME reactive-cache hooks as a
|
|
@@ -30,7 +30,7 @@ import{LunoraError as he}from"@lunora/errors";import{serializeSchemaSnapshot as
|
|
|
30
30
|
schema: schema as unknown as SchemaLike,
|
|
31
31
|
sql: this.sql as SqlExec,
|
|
32
32
|
});
|
|
33
|
-
}`,
|
|
33
|
+
}`,y=(n="")=>` const writer = this.adminWriter(${n});`,Tr=`${Dr}
|
|
34
34
|
|
|
35
35
|
protected override async runShardDataMigration(args: RunShardMigrationArgs): Promise<MigrationRunResult> {
|
|
36
36
|
this.ensureMigrated();
|
|
@@ -47,7 +47,7 @@ import{LunoraError as he}from"@lunora/errors";import{serializeSchemaSnapshot as
|
|
|
47
47
|
throw new LunoraError("MIGRATION_NOT_FOUND", \`data migration "\${args.id}" is not registered\`, { status: 404 });
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
${
|
|
50
|
+
${y()}
|
|
51
51
|
|
|
52
52
|
try {
|
|
53
53
|
return await runDataMigration({
|
|
@@ -86,7 +86,7 @@ ${w()}
|
|
|
86
86
|
|
|
87
87
|
this.ensureMigrated();
|
|
88
88
|
|
|
89
|
-
${
|
|
89
|
+
${y("headroom ?? this.transactionHeadroom()")}
|
|
90
90
|
|
|
91
91
|
if (args.op === "insert") {
|
|
92
92
|
const id = await writer.insert(args.table, args.doc ?? {});
|
|
@@ -141,7 +141,7 @@ ${w("headroom ?? this.transactionHeadroom()")}
|
|
|
141
141
|
protected override async runShardExport(args: RunShardExportArgs): Promise<ExportRow[]> {
|
|
142
142
|
this.ensureMigrated();
|
|
143
143
|
|
|
144
|
-
${
|
|
144
|
+
${y()}
|
|
145
145
|
|
|
146
146
|
const rows: ExportRow[] = [];
|
|
147
147
|
|
|
@@ -158,7 +158,7 @@ ${w()}
|
|
|
158
158
|
protected override async runShardImport(args: RunShardImportArgs): Promise<ImportShardResult> {
|
|
159
159
|
this.ensureMigrated();
|
|
160
160
|
|
|
161
|
-
${
|
|
161
|
+
${y()}
|
|
162
162
|
|
|
163
163
|
// \`importShardRows\` inserts with \`allowExplicitId\`, so a source
|
|
164
164
|
// database's \`_id\`s carry across verbatim and every foreign key
|
|
@@ -169,7 +169,7 @@ ${w()}
|
|
|
169
169
|
protected override async runShardRankBefore(args: RunShardRankBeforeArgs): Promise<{ before: number; total: number }> {
|
|
170
170
|
this.ensureMigrated();
|
|
171
171
|
|
|
172
|
-
${
|
|
172
|
+
${y()}
|
|
173
173
|
|
|
174
174
|
// \`rankBefore\` is optional on \`DatabaseWriterLike\` (the D1 twin omits it),
|
|
175
175
|
// but the shard writer from \`createShardCtxDb\` always defines it.
|
|
@@ -187,7 +187,7 @@ ${w()}
|
|
|
187
187
|
protected override async runShardFindRelated(args: RunShardFindRelatedArgs): Promise<RelatedPage> {
|
|
188
188
|
this.ensureMigrated();
|
|
189
189
|
|
|
190
|
-
${
|
|
190
|
+
${y()}
|
|
191
191
|
|
|
192
192
|
// \`related\` is optional on \`DatabaseWriterLike\` (the D1 twin omits it),
|
|
193
193
|
// but the shard writer from \`createShardCtxDb\` always defines it — it
|
|
@@ -205,7 +205,7 @@ ${w()}
|
|
|
205
205
|
protected override async runShardRankPage(args: RunShardRankPageArgs): Promise<ShardRankPageResult> {
|
|
206
206
|
this.ensureMigrated();
|
|
207
207
|
|
|
208
|
-
${
|
|
208
|
+
${y()}
|
|
209
209
|
|
|
210
210
|
// \`rankPageRows\` is optional on \`DatabaseWriterLike\` (the D1 twin omits it),
|
|
211
211
|
// but the shard writer from \`createShardCtxDb\` always defines it. The sort
|
|
@@ -226,13 +226,13 @@ ${w()}
|
|
|
226
226
|
protected override async runShardApplyCdc(args: RunShardApplyCdcArgs): Promise<{ applied: number }> {
|
|
227
227
|
this.ensureMigrated();
|
|
228
228
|
|
|
229
|
-
${
|
|
229
|
+
${y()}
|
|
230
230
|
|
|
231
231
|
await applyCdcChanges(writer, args.changes);
|
|
232
232
|
|
|
233
233
|
return { applied: args.changes.length };
|
|
234
|
-
}`,_r=({actionOnlyBuild:n,actionOnlyFields:t,agentsBuild:e,agentsContextField:a,containersBuild:r,containersContextField:o,databaseOptions:d,everyContextBuild:m,everyContextField:
|
|
235
|
-
orm: databaseContext.orm,`,W=
|
|
234
|
+
}`,_r=({actionOnlyBuild:n,actionOnlyFields:t,agentsBuild:e,agentsContextField:a,containersBuild:r,containersContextField:o,databaseOptions:d,everyContextBuild:m,everyContextField:f,facadeBlock:h,globalDatabaseLine:x,hasSensitiveArgs:S=!1,lazyFunctions:g=!1,notifyBuild:c,ormContextField:w,paymentsBuild:M,paymentsContextField:A,queuesBuild:q,queuesContextField:F,topicsBuild:R,topicsContextField:U,vectorsBuild:i,vectorsContextField:v,workflowsBuild:E,workflowsContextField:B})=>{const I=t.length>0,C=w===""?"{ db }":"{ db, orm: bindOrm(facade) }",j=w===""?"":`
|
|
235
|
+
orm: databaseContext.orm,`,W=w===""?"":`
|
|
236
236
|
orm: { configurable: true, enumerable: true, value: mutationDatabase.orm, writable: true },`,O=I?`
|
|
237
237
|
// ActionCtx-only helpers (external, non-deterministic I/O): constructed
|
|
238
238
|
// and attached only for an \`action\` so query/mutation ctx never carry them.
|
|
@@ -240,7 +240,7 @@ ${w()}
|
|
|
240
240
|
${n.replaceAll(/^(?=.)/gmu," ")}${t.map(p=>` ctx.${p} = ${p};`).join(`
|
|
241
241
|
`)}
|
|
242
242
|
}
|
|
243
|
-
`:"";return` private buildCtx(options: { bookmarks?: DispatchBookmark | undefined; functionPath?: string | undefined; headroom?: TransactionHeadroomTracker | undefined; identity?: SubscriptionIdentity | undefined; kind?: "query" | undefined; onRead?: ((table: string, idOrScan?: string) => void) | undefined; onReadRange?: ((range: KeyRange) => void) | undefined; scope?: QueryReadScope | undefined; sensitive?: SensitiveScope | undefined; trusted?: boolean | undefined } = {}): unknown {
|
|
243
|
+
`:"";return` private buildCtx(options: { bookmarks?: DispatchBookmark | undefined; functionPath?: string | undefined; headroom?: TransactionHeadroomTracker | undefined; identity?: SubscriptionIdentity | undefined; kind?: "query" | undefined; onRead?: ((table: string, idOrScan?: string) => void) | undefined; onReadRange?: ((range: KeyRange) => void) | undefined; replayKey?: boolean | undefined; scope?: QueryReadScope | undefined; sensitive?: SensitiveScope | undefined; trusted?: boolean | undefined } = {}): unknown {
|
|
244
244
|
const env = (this.env ?? {}) as Record<string, unknown>;
|
|
245
245
|
// The caller context this ctx runs under, resolved ONCE on one
|
|
246
246
|
// discriminant. When the caller threads an explicit identity
|
|
@@ -416,6 +416,13 @@ ${c}
|
|
|
416
416
|
throw new LunoraError("FORBIDDEN", "ctx.fetch is action-only: network I/O belongs in an action, not a query or mutation");
|
|
417
417
|
};
|
|
418
418
|
|
|
419
|
+
// A reactor run is driven by the writer's inline refresh, not replayed by the writer, so it must not
|
|
420
|
+
// inherit the writer's key: every run would restart the same id and random sequence.
|
|
421
|
+
const stableKey = options.replayKey !== false && options.identity === undefined && this.idempotencyNamespace() !== undefined ? this.getCurrentMutationId() : undefined;
|
|
422
|
+
const stableScope = JSON.stringify([this.currentShardKey(), options.functionPath ?? "", this.idempotencyNamespace() ?? "", userId ?? ""]);
|
|
423
|
+
// One sequence for every mutation this run composes: their ids share one counter (the copied \`newId\`), so their draws must too.
|
|
424
|
+
const composedRandom = createStableRandomFactory(stableKey, stableScope);
|
|
425
|
+
|
|
419
426
|
const ctx: Record<string, unknown> = {
|
|
420
427
|
auth: {
|
|
421
428
|
getIdentity: async () => identity ?? null,
|
|
@@ -426,10 +433,10 @@ ${c}
|
|
|
426
433
|
// subscription-driven build (\`options.identity\`) is not a replay.
|
|
427
434
|
// A replay key only means something inside the caller's dedup namespace; without one the call is not
|
|
428
435
|
// deduplicated, so its ids stay random.
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
),
|
|
436
|
+
// \`ctx.random()\` shares the replay key and scope, so a replay reproduces both sequences.
|
|
437
|
+
newId: createStableIdFactory(stableKey, stableScope),
|
|
438
|
+
// Only a mutation is a replay the key reproduces; a query or action carrying the header draws Math.random.
|
|
439
|
+
random: createStableRandomFactory(contextKind === "mutation" ? stableKey : undefined, stableScope),
|
|
433
440
|
// Instrumented \`fetch\`: a CLIENT span per outbound call plus W3C
|
|
434
441
|
// \`traceparent\` propagation, so time spent in a downstream service
|
|
435
442
|
// is visible and its spans join this trace. Degrades to the bare
|
|
@@ -460,12 +467,12 @@ ${c}
|
|
|
460
467
|
scheduler,
|
|
461
468
|
span,
|
|
462
469
|
storage: contextStorage,
|
|
463
|
-
trace,${v}${
|
|
470
|
+
trace,${v}${f}${A}${o}${B}${F}${U}${a}${S?`
|
|
464
471
|
[Symbol.for("lunora.admitSensitiveArgs")]: (args: Record<string, unknown>, names: ReadonlySet<string>): void => this.admitSensitiveValues(options.sensitive, args, names),`:""}
|
|
465
472
|
};
|
|
466
473
|
${I?` const isAction = contextKind === "action";
|
|
467
474
|
`:""}${O}
|
|
468
|
-
${
|
|
475
|
+
${g?` const captureScope = (): (() => void) => {
|
|
469
476
|
const requestScope = this.captureRequestScope();
|
|
470
477
|
return () => this.restoreRequestScope(requestScope);
|
|
471
478
|
};
|
|
@@ -475,7 +482,7 @@ ${f?` const captureScope = (): (() => void) => {
|
|
|
475
482
|
// The callee runs inside this invocation, so its marked arguments are scrubbed here too.
|
|
476
483
|
this.admitSensitiveArgs(options.sensitive, reference.__lunoraRef, fnArgs);
|
|
477
484
|
|
|
478
|
-
return dispatchRun("action", reference.__lunoraRef, fnArgs, target, kind${
|
|
485
|
+
return dispatchRun("action", reference.__lunoraRef, fnArgs, target, kind${g?", undefined, captureScope":""});
|
|
479
486
|
};
|
|
480
487
|
// The composed mutation runs under the SAME wrapper the top-level RPC
|
|
481
488
|
// uses, so "do the transactional work in a mutation and call it from the
|
|
@@ -497,6 +504,9 @@ ${f?` const captureScope = (): (() => void) => {
|
|
|
497
504
|
...Object.getOwnPropertyDescriptors(target),
|
|
498
505
|
db: { configurable: true, enumerable: true, value: mutationDatabase.db, writable: true },${W}
|
|
499
506
|
fetch: { configurable: true, enumerable: true, value: refuseFetch, writable: true },
|
|
507
|
+
// The composed mutation's ids come from the action's replay key and counter, so its draws do too; a
|
|
508
|
+
// fresh factory per call would repeat the same draws across sibling mutations.
|
|
509
|
+
random: { configurable: true, enumerable: true, value: composedRandom, writable: true },
|
|
500
510
|
scheduler: { configurable: true, enumerable: true, value: mutationScheduler, writable: true },
|
|
501
511
|
storage: { configurable: true, enumerable: true, value: withDeferredDeletes(storage), writable: true },
|
|
502
512
|
});
|
|
@@ -506,7 +516,7 @@ ${f?` const captureScope = (): (() => void) => {
|
|
|
506
516
|
installRun(mutationCtx, kind);
|
|
507
517
|
}
|
|
508
518
|
|
|
509
|
-
return dispatchRun("mutation", reference.__lunoraRef, fnArgs, mutationCtx, kind, async (work) => this.runMutationTransaction(mutationCtx, work)${
|
|
519
|
+
return dispatchRun("mutation", reference.__lunoraRef, fnArgs, mutationCtx, kind, async (work) => this.runMutationTransaction(mutationCtx, work)${g?", captureScope":""});
|
|
510
520
|
};
|
|
511
521
|
// \`ctx.runQuery(ref, args, { untracked: true })\` runs the sub-query on
|
|
512
522
|
// its OWN query context, built without the subscription's read-footprint
|
|
@@ -531,7 +541,7 @@ ${f?` const captureScope = (): (() => void) => {
|
|
|
531
541
|
runOptions?.untracked === true
|
|
532
542
|
? this.buildCtx({ bookmarks: options.bookmarks, functionPath: options.functionPath, headroom: options.headroom, identity: caller, kind: "query", scope: options.scope, sensitive: options.sensitive })
|
|
533
543
|
: queryContext(),
|
|
534
|
-
kind,${
|
|
544
|
+
kind,${g?`
|
|
535
545
|
undefined,
|
|
536
546
|
captureScope,`:""}
|
|
537
547
|
);
|
|
@@ -565,6 +575,8 @@ ${t.map(p=>` delete descriptors.${p};
|
|
|
565
575
|
...descriptors,
|
|
566
576
|
fetch: field(refuseFetch),
|
|
567
577
|
origin: field(undefined),
|
|
578
|
+
// A composed query is not a mutation replay, so it must not advance the mutation's random sequence.
|
|
579
|
+
random: field(createStableRandomFactory(undefined, stableScope)),
|
|
568
580
|
scheduler: field(schedulerBase),
|
|
569
581
|
storage: field(makeStorage()),
|
|
570
582
|
}) as Record<string, unknown>;
|
|
@@ -1002,9 +1014,9 @@ ${o}
|
|
|
1002
1014
|
|
|
1003
1015
|
return { ...(shape.columns === undefined ? {} : { columns: shape.columns }), effectiveWhere, global: isGlobal, table: shape.table };
|
|
1004
1016
|
}
|
|
1005
|
-
`:"",
|
|
1017
|
+
`:"",f=e?[...new Set(a.policies.filter(c=>c.on==="read"&&c.table!=="").map(c=>c.table))].toSorted((c,w)=>c.localeCompare(w)):[],h=f.length>0?`
|
|
1006
1018
|
/** Refuses to boot a shape that would replicate around the read policies its table is governed by (\`defineShape({ use })\` is how a shape opts in; \`use: []\` acknowledges an ungoverned one). */
|
|
1007
|
-
assertShapesDeclareReadPolicies(LUNORA_SHAPES, ${JSON.stringify(
|
|
1019
|
+
assertShapesDeclareReadPolicies(LUNORA_SHAPES, ${JSON.stringify(f)}, (schema as unknown as { rlsMode?: string }).rlsMode === "required");
|
|
1008
1020
|
`:"";return{customMutatorOverride:n?`
|
|
1009
1021
|
protected override isCustomMutator(functionPath: string): boolean {
|
|
1010
1022
|
return LUNORA_MUTATOR_PATHS.has(functionPath);
|
|
@@ -1228,8 +1240,8 @@ assertShapesDeclareReadPolicies(LUNORA_SHAPES, ${JSON.stringify(g)}, (schema as
|
|
|
1228
1240
|
`:"",sourceClientCacheConst:n?`
|
|
1229
1241
|
const sourceClientCache = new WeakMap<object, Map<string, SourceClientLike>>();
|
|
1230
1242
|
const sourcePollAtCache = new WeakMap<object, Map<string, number>>();
|
|
1231
|
-
`:""}),
|
|
1232
|
-
`:"",d=e?"namespace: vectorShardKey === ROOT_SHARD_NAME ? undefined : vectorShardKey, ":"",
|
|
1243
|
+
`:""}),Kr=(n,t)=>{const e=t.length>0,r=n?$("vectorsStub: VectorSearchLike","ctx.vectors: no vectors configured. Pass `vectors` to createShardDO().",["deleteByIds","getByIds","query","upsert","upsertMany","upsertNow"]):"",o=e?` const vectorShardKey = this.currentShardKey();
|
|
1244
|
+
`:"",d=e?"namespace: vectorShardKey === ROOT_SHARD_NAME ? undefined : vectorShardKey, ":"",f=`, { ${["deferAfterCommit: (work) => this.deferAfterCommit(work)",...e?["namespace: vectorShardKey === ROOT_SHARD_NAME ? undefined : vectorShardKey",`shardedIndexNames: [${t.map(S=>JSON.stringify(S)).join(", ")}]`]:[]].join(", ")} }`,h=n?`
|
|
1233
1245
|
const vectorSync = this.vectorSync(env);
|
|
1234
1246
|
// Vectorize lives outside this shard's SQLite, so a query whose result
|
|
1235
1247
|
// depends on a similarity search cannot be proven current on reconnect —
|
|
@@ -1246,7 +1258,7 @@ const sourcePollAtCache = new WeakMap<object, Map<string, number>>();
|
|
|
1246
1258
|
}
|
|
1247
1259
|
|
|
1248
1260
|
const lunora = createVectors({ indexes: config.vectors(env) });
|
|
1249
|
-
${o} const vectors = createContextVectors(lunora${
|
|
1261
|
+
${o} const vectors = createContextVectors(lunora${f});
|
|
1250
1262
|
|
|
1251
1263
|
return {
|
|
1252
1264
|
backfill: createVectorBackfillSync({ ${d}schema: schema as unknown as VectorSchemaLike, upsertMany: lunora.upsertMany, vectors }),
|
|
@@ -1272,10 +1284,10 @@ ${o} const vectors = createContextVectors(lunora${g});
|
|
|
1272
1284
|
ordered: async (read, work) => this.runOrderedAfterWrites(read, work),
|
|
1273
1285
|
});
|
|
1274
1286
|
}
|
|
1275
|
-
`:"",vectorsBuild:h,vectorsStub:r}},on=({advisories:n=[],advisorProcedures:t=[],agents:e=[],capabilities:a=new Set,containers:r=[],env:o,flagKeys:d=[],hasFlags:m=!1,hasNotify:
|
|
1287
|
+
`:"",vectorsBuild:h,vectorsStub:r}},on=({advisories:n=[],advisorProcedures:t=[],agents:e=[],capabilities:a=new Set,containers:r=[],env:o,flagKeys:d=[],hasFlags:m=!1,hasNotify:f=!1,hasRooms:h=!1,hasSecretValues:x=!1,hasSensitiveArgs:S=!1,hasSockets:g=!1,lazyFunctions:c=!1,hasVectors:w=!0,liveStreamDeclarations:M=[],liveStreams:A=!1,maskMetadata:q,mutators:F=[],queues:R=[],rlsMetadata:U,schema:i,schemaSnapshot:v,shapes:E=[],storageRules:B,studioFeatures:I,services:C=[],topics:j=[],useUmbrella:W=!1,workflows:O=[]})=>{const l=Rr(W),H=F.length>0,p=E.length>0,D=E.some(s=>yr(s.args).length>0),K=S||D,fe=v===void 0?"":Jt(v),ge=v===void 0?"":`
|
|
1276
1288
|
/** Structural schema snapshot + its content hash, recorded in the shard's \`__lunora_schema_history\` ledger on cold start so the studio can show a schema-version timeline and diff any two versions. */
|
|
1277
|
-
const LUNORA_SCHEMA_SNAPSHOT: { hash: string; json: string } = { hash: ${JSON.stringify(Yt(v))}, json: ${JSON.stringify(
|
|
1278
|
-
`,be=v===void 0?"":", schemaSnapshot: LUNORA_SCHEMA_SNAPSHOT",k=er(a),L=tr(m,l.flags),
|
|
1289
|
+
const LUNORA_SCHEMA_SNAPSHOT: { hash: string; json: string } = { hash: ${JSON.stringify(Yt(v))}, json: ${JSON.stringify(fe)} };
|
|
1290
|
+
`,be=v===void 0?"":", schemaSnapshot: LUNORA_SCHEMA_SNAPSHOT",k=er(a),L=tr(m,l.flags),V=rr(d,m,l.flags),G=gr(f),Q=nr(o),{build:ye,contextField:we,importLines:ve,specs:ke}=ar(xr(R)),{build:Se,contextField:Re,importLines:xe,specs:Ae}=sr(j,R),J=or(C,l.server),{build:Oe,contextField:De,importLines:Te,specs:_e}=ir(r,i.jurisdiction),{build:Ee,contextField:Ie,importLines:Ce,specs:Le}=dr(O),{build:Pe,contextField:Ne,importLines:$e,specs:Me}=cr(e,x&&e.length>0),{build:qe,configField:Fe,contextField:Ue,imports:Be,stub:je}=lr(a.has("payments")),We=n,{advisoryRules:He,advisoryRows:Ke}=Or(We),Ve=t,ne=U??{policies:[],roles:[]},Ge=q??{columns:[]},Qe=B??{rules:[]},Je=I??{analytics:!1,auth:!1,containers:!1,flags:!1,kv:!1,mail:!1,notifications:!1,payments:!1,privacy:!1,queues:!1,scheduler:!1,storage:!1,vectors:!1,workflows:!1},{constant:Ye,override:ze}=ur(O),{constant:Xe,override:Ze}=hr(R),b=w&&i.vectorIndexes.length>0,Y=new Set(i.tables.filter(s=>Ar(s)).map(s=>s.name)),ae=b&&i.vectorIndexes.some(s=>Y.has(s.table)),T=i.tables.some(s=>s.shardMode==="global"),z=pr(Y),X=i.tables.some(s=>zt(s)),se=i.tables.some(s=>Xt(s)),P=i.tables.some(s=>s.externalSource!==void 0),oe=i.tables.some(s=>s.memory===!0),Z=i.tables.some(s=>s.shardMode!=="global"&&s.searchIndexes.length>0);if(se&&X)throw new he("INTERNAL",'lunora codegen: mixing `.global()` (D1) and `.global({ backend: "hyperdrive" })` tables in one app is not supported yet — use a single global backend.');const ee=i.tables.length>0,et=Nr(i),tt=Mr(i),rt=Br(i),nt=$r(i),ie=qr(i),te=mr(b,O.length>0,R.length>0,m,Z);p&&te.push("WhereInput"),D&&te.push("SensitiveScope");const de=fr(T),{customMutatorOverride:at,shapeGuardImport:st,shapeReadPolicyAssertion:ot,shapeReadPolicyImport:it,shapeResolveOverride:dt}=jr({hasMutators:H,hasSensitiveShapes:D,hasShapes:p,rlsData:ne}),_=A?M:[];for(const s of _)if(wr(s.exportName,"live stream export name"),!vr.test(s.filePath))throw new he("INTERNAL",`@lunora/codegen: refusing to emit import for unsafe live stream file path: ${JSON.stringify(s.filePath)}`);const ct=c?[]:_.map(s=>`import { ${s.exportName} as liveStream_${s.exportName} } from "../${s.filePath}.js";`),lt=` protected override liveStreams() {
|
|
1279
1291
|
return { ${_.map(s=>`${kr(s.id)}: liveStream_${s.exportName}`).join(", ")} };
|
|
1280
1292
|
}
|
|
1281
1293
|
`,ut=` private readonly liveStreamLoaders = new Map<string, () => Promise<{ validatePublish: (topic: string, payload: unknown) => unknown }>>([
|
|
@@ -1300,11 +1312,11 @@ ${_.map(s=>` [${JSON.stringify(s.id)}, () => import("../${s.filePath}
|
|
|
1300
1312
|
protected override liveStreams() {
|
|
1301
1313
|
return Object.fromEntries(this.loadedLiveStreams);
|
|
1302
1314
|
}
|
|
1303
|
-
`;let ce="";_.length>0&&(ce=c?ut:lt);const N=[`import type { ${te.join(", ")} } from "${l.do}";`,`import { applyCdcChanges, createStableIdFactory, ${Z?"backfillSearchIndexes, ":""}${b?"backfillVectorIndexes, ":""}buildReprojectionMigration, ${oe?"clearMemoryTables, ":""}${st}createReadFootprint, createShardCtxDb, exportShardRows, importShardRows, ${P?"isSourceDue, pullExternalSourceIncrementalTick, pullExternalSourceTick, ":""}markUnvouchableReads, ${ae?"ROOT_SHARD_NAME, ":""}runDataMigration, runShardMigrations, ${de.importFragment}ShardDO as ShardDOBase } from "${l.do}";`,...P?[`import type { ExternalSourceLike, SourceClientLike, TraceRefLike } from "${l.do}";`]:[],p?`import { asBucketStorage, ${it}beginDeferredDeletes, beginDeferredSchedules, composeShapeReadWhere, createSecrets, flushDeferredDeletes, LunoraError, withDeferredDeletes, withDeferredSchedules } from "${l.server}";`:`import { asBucketStorage, beginDeferredDeletes, beginDeferredSchedules, createSecrets, flushDeferredDeletes, LunoraError, withDeferredDeletes, withDeferredSchedules } from "${l.server}";`];ee&&N.push(`import { bindOrm, bindTableFacade } from "${l.server}";`),b&&N.push('import type { SchemaLike as VectorSchemaLike, VectorBackfillSync, VectorizeIndexLike, VectorSearchLike } from "@lunora/bindings/vectors";','import { createContextVectors, createVectorBackfillSync, createVectors, createVectorSyncHook, vectorBackfillTargets } from "@lunora/bindings/vectors";'),N.push(...k.importLines,...L.importLines,...G.importLines,...Q.importLines,...Te,...Ce,...ve,...xe,...J.importLines,...$e,...Be,...
|
|
1315
|
+
`;let ce="";_.length>0&&(ce=c?ut:lt);const N=[`import type { ${te.join(", ")} } from "${l.do}";`,`import { applyCdcChanges, createStableIdFactory, createStableRandomFactory, ${Z?"backfillSearchIndexes, ":""}${b?"backfillVectorIndexes, ":""}buildReprojectionMigration, ${oe?"clearMemoryTables, ":""}${st}createReadFootprint, createShardCtxDb, exportShardRows, importShardRows, ${P?"isSourceDue, pullExternalSourceIncrementalTick, pullExternalSourceTick, ":""}markUnvouchableReads, ${ae?"ROOT_SHARD_NAME, ":""}runDataMigration, runShardMigrations, ${de.importFragment}ShardDO as ShardDOBase } from "${l.do}";`,...P?[`import type { ExternalSourceLike, SourceClientLike, TraceRefLike } from "${l.do}";`]:[],p?`import { asBucketStorage, ${it}beginDeferredDeletes, beginDeferredSchedules, composeShapeReadWhere, createSecrets, flushDeferredDeletes, LunoraError, withDeferredDeletes, withDeferredSchedules } from "${l.server}";`:`import { asBucketStorage, beginDeferredDeletes, beginDeferredSchedules, createSecrets, flushDeferredDeletes, LunoraError, withDeferredDeletes, withDeferredSchedules } from "${l.server}";`];ee&&N.push(`import { bindOrm, bindTableFacade } from "${l.server}";`),b&&N.push('import type { SchemaLike as VectorSchemaLike, VectorBackfillSync, VectorizeIndexLike, VectorSearchLike } from "@lunora/bindings/vectors";','import { createContextVectors, createVectorBackfillSync, createVectors, createVectorSyncHook, vectorBackfillTargets } from "@lunora/bindings/vectors";'),N.push(...k.importLines,...L.importLines,...G.importLines,...Q.importLines,...Te,...Ce,...ve,...xe,...J.importLines,...$e,...Be,...K?[`import { sensitiveArgumentNames } from "${l.values}";`]:[],"",'import schema from "../schema.js";',...ct,`import { ${["LUNORA_FUNCTIONS","LUNORA_LIFECYCLE_HOOKS","LUNORA_MIGRATIONS",...c?["getLoadedFunction","loadFunction"]:[],...H?["LUNORA_MUTATOR_PATHS"]:[],...h?["LUNORA_ROOMS"]:[],...g?["LUNORA_SOCKETS"]:[],...p?["LUNORA_SHAPES"]:[]].join(", ")} } from "./functions.js";`);const ht=b?`
|
|
1304
1316
|
vectors?: (env: Record<string, unknown>) => Record<string, VectorizeIndexLike>;`:"",pt=se?`
|
|
1305
1317
|
d1?: (env: Record<string, unknown>, request?: { bookmark?: string; cdc?: boolean; cdcRetentionMs?: number; identity?: Record<string, unknown>; onBookmark?: (bookmark: string | undefined) => void; userId?: string }) => DatabaseWriterLike | undefined;`:"",mt=X?`
|
|
1306
|
-
hyperdriveGlobal?: (env: Record<string, unknown>, request?: { cdc?: boolean; cdcRetentionMs?: number; identity?: Record<string, unknown>; userId?: string }) => DatabaseWriterLike | undefined;`:"",
|
|
1307
|
-
sourceClient?: (env: Record<string, unknown>, binding: string) => { query: <Row = Record<string, unknown>>(text: string, params?: readonly unknown[]) => Promise<Row[]> } | undefined;`:"",
|
|
1318
|
+
hyperdriveGlobal?: (env: Record<string, unknown>, request?: { cdc?: boolean; cdcRetentionMs?: number; identity?: Record<string, unknown>; userId?: string }) => DatabaseWriterLike | undefined;`:"",ft=P?`
|
|
1319
|
+
sourceClient?: (env: Record<string, unknown>, binding: string) => { query: <Row = Record<string, unknown>>(text: string, params?: readonly unknown[]) => Promise<Row[]> } | undefined;`:"",gt="ctx.db.<globalTable>: no global backend configured. Pass `d1` or `hyperdriveGlobal` to createShardDO().",bt="ctx.scheduler: no scheduler configured. Pass `scheduler` to createShardDO().",yt="ctx.storage: no storage configured. Pass `storage` to createShardDO().",wt=T?$("globalDbStub: DatabaseWriterLike",gt,["aggregate","count","delete","explain","findFirst","findFirstOrThrow","findMany","get","groupBy","insert","normalizeId","patch","query","rank","rankPage","replace"],{sync:["normalizeId","query"]}):"",{vectorSyncMethod:vt,vectorsBuild:kt,vectorsStub:St}=Kr(b,ae?i.vectorIndexes.filter(s=>Y.has(s.table)).map(s=>s.name):[]),Rt=`{
|
|
1308
1320
|
...this.ctxDbTuning(),
|
|
1309
1321
|
auth: { identity: identity ?? null, userId: userId ?? null },
|
|
1310
1322
|
broadcast: (delta) => {
|
|
@@ -1373,7 +1385,7 @@ ${_.map(s=>` [${JSON.stringify(s.id)}, () => import("../${s.filePath}
|
|
|
1373
1385
|
// Own properties only: a plain object would resolve \`toString\` and the like to inherited functions.
|
|
1374
1386
|
return Object.hasOwn(LUNORA_ROOMS, topic) ? LUNORA_ROOMS[topic] : undefined;
|
|
1375
1387
|
}
|
|
1376
|
-
`:"",_t=
|
|
1388
|
+
`:"",_t=g?` protected override socketRoute(path: string): { auth: boolean; functionPath: string } | undefined {
|
|
1377
1389
|
return LUNORA_SOCKETS[path];
|
|
1378
1390
|
}
|
|
1379
1391
|
`:"",{externalSourceOverride:Et,sourceBootstrap:It,sourceClientCacheConst:Ct}=Hr(P),Lt=`
|
|
@@ -1485,7 +1497,7 @@ ${It}${Pt} }
|
|
|
1485
1497
|
`:"",$t=ue===""?`
|
|
1486
1498
|
|
|
1487
1499
|
`:`${ue}
|
|
1488
|
-
`,Mt=
|
|
1500
|
+
`,Mt=K?`
|
|
1489
1501
|
protected override sensitiveArgNames(functionPath: string): ReadonlySet<string> {
|
|
1490
1502
|
const registered = LUNORA_FUNCTIONS[functionPath];${D?`
|
|
1491
1503
|
const shape = functionPath.startsWith("__shape__:") ? LUNORA_SHAPES[functionPath.slice("__shape__:".length)] : undefined;`:""}
|
|
@@ -1507,13 +1519,13 @@ ${i.tables.map(s=>` facade[${JSON.stringify(s.name)}] = bindTableFaca
|
|
|
1507
1519
|
`:"",Wt=`${k.everyBuild}${L.build}${Q.build}
|
|
1508
1520
|
const secrets = createSecrets(env);
|
|
1509
1521
|
`,Ht=`${k.everyFields}${L.contextField}${G.contextField}${Q.contextField}
|
|
1510
|
-
secrets,`,
|
|
1522
|
+
secrets,`,Kt=G.build,Vt=A?`
|
|
1511
1523
|
const live = {
|
|
1512
1524
|
publish: async (ref: { __lunoraLive: string; topic: string }, payload: unknown, publishOptions?: { shardKey?: string }): Promise<void> => {
|
|
1513
1525
|
await this.publishLiveFromAction(ref.topic, payload, { ...publishOptions, stream: ref.__lunoraLive });
|
|
1514
1526
|
},
|
|
1515
1527
|
};
|
|
1516
|
-
`:"",Gt=[...k.actionFields,...C.length>0?["services"]:[],...A?["live"]:[]],Qt=`${k.actionBuild}${J.build}${
|
|
1528
|
+
`:"",Gt=[...k.actionFields,...C.length>0?["services"]:[],...A?["live"]:[]],Qt=`${k.actionBuild}${J.build}${Vt}`;return`${Sr}${N.join(`
|
|
1517
1529
|
`)}
|
|
1518
1530
|
|
|
1519
1531
|
type FunctionKind = "action" | "mutation" | "query";
|
|
@@ -1555,7 +1567,7 @@ const LUNORA_TTL_SWEEPS = ${Zt(ie,"Array<{ after?: number; field: string; softDe
|
|
|
1555
1567
|
const LUNORA_ADVISORY_RULES = ${u(He,"Record<string, Partial<AdvisoryFinding>>")};
|
|
1556
1568
|
|
|
1557
1569
|
/** Per-finding rows; rule-level text lives once in \`LUNORA_ADVISORY_RULES\` and is merged back on first read. */
|
|
1558
|
-
const LUNORA_ADVISORY_ROWS = ${u(
|
|
1570
|
+
const LUNORA_ADVISORY_ROWS = ${u(Ke,"Array<Partial<AdvisoryFinding> & { name: string }>")};
|
|
1559
1571
|
|
|
1560
1572
|
const LUNORA_ADVISORIES = ((): (() => AdvisoryFinding[]) => {
|
|
1561
1573
|
let cached: AdvisoryFinding[] | undefined;
|
|
@@ -1563,7 +1575,7 @@ const LUNORA_ADVISORIES = ((): (() => AdvisoryFinding[]) => {
|
|
|
1563
1575
|
})();
|
|
1564
1576
|
|
|
1565
1577
|
/** Every declared procedure (discovered by @lunora/codegen) served via \`__lunora_admin__:getAdvisorProcedures\` — the health map's denominator. */
|
|
1566
|
-
const LUNORA_ADVISOR_PROCEDURES = ${u(
|
|
1578
|
+
const LUNORA_ADVISOR_PROCEDURES = ${u(Ve,"AdvisorProcedure[]")};
|
|
1567
1579
|
|
|
1568
1580
|
/** Read-only RLS metadata (policies + roles discovered from \`.use(rls(...))\` chains) served via \`__lunora_admin__:rlsPolicies\` for the studio's RLS inspector. */
|
|
1569
1581
|
const LUNORA_RLS_METADATA = ${u(ne,"RlsPoliciesResult")};
|
|
@@ -1579,7 +1591,7 @@ const LUNORA_STUDIO_FEATURES = ${u(Je,"StudioFeaturesResult")};
|
|
|
1579
1591
|
|
|
1580
1592
|
/** How long a shard with a UNIQUE index blocked by duplicate rows serves the cached diagnostic before re-attempting the build. */
|
|
1581
1593
|
const BLOCKED_MIGRATION_RETRY_MS = 5000;
|
|
1582
|
-
${
|
|
1594
|
+
${ge}${z.constant}${V.constant}${Ye}${Xe}${_e}${Le}${ke}${Ae}${J.specs}${Me}
|
|
1583
1595
|
export interface ShardDOConfig {
|
|
1584
1596
|
/** Opt into change-data-capture: records a post-image to \`__cdc_log\` on every write (backs streaming export + replay-PITR). */
|
|
1585
1597
|
cdc?: boolean;
|
|
@@ -1596,9 +1608,9 @@ export interface ShardDOConfig {
|
|
|
1596
1608
|
/** \`unknown\` because \`@lunora/scheduler\`'s \`Scheduler\` is not assignable to \`SchedulerLike\`; the shard casts it. */
|
|
1597
1609
|
scheduler?: (env: Record<string, unknown>) => unknown;
|
|
1598
1610
|
/** \`origin\` is the origin the current \`/rpc\` request reached the worker on — the fallback base for signed object URLs when no \`publicBaseUrl\` is configured. \`undefined\` off the synchronous dispatch path. */
|
|
1599
|
-
storage?: (env: Record<string, unknown>, origin?: string) => unknown;${ht}${k.configFields}${L.configField}${Fe}${pt}${mt}${
|
|
1611
|
+
storage?: (env: Record<string, unknown>, origin?: string) => unknown;${ht}${k.configFields}${L.configField}${Fe}${pt}${mt}${ft}${z.configField}
|
|
1600
1612
|
}
|
|
1601
|
-
${$("schedulerStub",bt,["cancel","runAfter","runAt"])}${$("storageStub",
|
|
1613
|
+
${$("schedulerStub",bt,["cancel","runAfter","runAt"])}${$("storageStub",yt,["createMultipartUpload","delete","download","generateUploadUrl","getMetadata","getPresignedUrl","getSignedUrl","getUrl","head","list","resumeMultipartUpload","store","upload"],{sync:["getUrl","resumeMultipartUpload"]})}${wt}${Ct}${St}${k.stubs}${je}
|
|
1602
1614
|
${qt}
|
|
1603
1615
|
|
|
1604
1616
|
/**
|
|
@@ -1657,7 +1669,7 @@ ${c?` const requestScope = this.captureRequestScope();
|
|
|
1657
1669
|
this.ensureServable();
|
|
1658
1670
|
|
|
1659
1671
|
const footprint = createReadFootprint();
|
|
1660
|
-
const ctx = this.buildCtx({ functionPath, headroom: this.subscriptionHeadroom(), onRead: footprint.onRead, onReadRange: footprint.onReadRange, trusted: true });
|
|
1672
|
+
const ctx = this.buildCtx({ functionPath, headroom: this.subscriptionHeadroom(), onRead: footprint.onRead, onReadRange: footprint.onReadRange, replayKey: false, trusted: true });
|
|
1661
1673
|
const outcome = (await this.runMutationTransaction(ctx, async () =>
|
|
1662
1674
|
registered.handler(ctx, { previousDigest } as unknown as Record<string, unknown>),
|
|
1663
1675
|
)) as {
|
|
@@ -1715,7 +1727,7 @@ ${c?` const requestScope = this.captureRequestScope();
|
|
|
1715
1727
|
protected override studioFeatures(): StudioFeaturesResult {
|
|
1716
1728
|
return LUNORA_STUDIO_FEATURES();
|
|
1717
1729
|
}
|
|
1718
|
-
${
|
|
1730
|
+
${V.evaluateOverride}${V.subscriptionOverride}${ze}${Ze}
|
|
1719
1731
|
protected override advisories(): AdvisoryFinding[] {
|
|
1720
1732
|
return LUNORA_ADVISORIES();
|
|
1721
1733
|
}
|
|
@@ -1771,6 +1783,6 @@ ${Z?`
|
|
|
1771
1783
|
return backfillSearchIndexes(this.sql as SqlExec, schema as unknown as SchemaLike, options);
|
|
1772
1784
|
}
|
|
1773
1785
|
`:""}${vt}
|
|
1774
|
-
${_r({hasSensitiveArgs:
|
|
1786
|
+
${_r({hasSensitiveArgs:K,lazyFunctions:c,actionOnlyFields:Gt,agentsBuild:Pe,agentsContextField:Ne,containersBuild:Oe,containersContextField:De,databaseOptions:Rt,everyContextBuild:Wt,everyContextField:Ht,facadeBlock:jt,globalDatabaseLine:Ot,notifyBuild:Kt,ormContextField:At,paymentsBuild:qe,paymentsContextField:Ue,queuesBuild:ye,queuesContextField:we,topicsBuild:Se,topicsContextField:Re,vectorsBuild:kt,vectorsContextField:xt,workflowsBuild:Ee,workflowsContextField:Ie,actionOnlyBuild:Qt})}
|
|
1775
1787
|
};
|
|
1776
1788
|
`};export{$r as b,on as e};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/codegen",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.343",
|
|
4
4
|
"description": "Code generator for Lunora: emits _generated/{api,server,dataModel}.ts from your schema",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -50,13 +50,13 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@lunora/advisor": "1.0.0-alpha.
|
|
54
|
-
"@lunora/agent": "1.0.0-alpha.
|
|
53
|
+
"@lunora/advisor": "1.0.0-alpha.249",
|
|
54
|
+
"@lunora/agent": "1.0.0-alpha.239",
|
|
55
55
|
"@lunora/container": "1.0.0-alpha.89",
|
|
56
56
|
"@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
|
|
57
|
-
"@lunora/platform": "1.0.0-alpha.
|
|
58
|
-
"@lunora/queue": "1.0.0-alpha.
|
|
59
|
-
"@lunora/scheduler": "1.0.0-alpha.
|
|
57
|
+
"@lunora/platform": "1.0.0-alpha.74",
|
|
58
|
+
"@lunora/queue": "1.0.0-alpha.124",
|
|
59
|
+
"@lunora/scheduler": "1.0.0-alpha.146",
|
|
60
60
|
"@lunora/values": "1.0.0-alpha.78",
|
|
61
61
|
"@lunora/workflow": "1.0.0-alpha.92",
|
|
62
62
|
"@visulima/fs": "6.0.29",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Node as s,SyntaxKind as r}from"ts-morph";import{listLunoraSourceFiles as a,lunoraRelativePath as l,handlerOf as c}from"./isTestPath-C3QumE88.mjs";import{b as d,d as f}from"./attribution-CG8-kUcl.mjs";import{c as u}from"./classify-procedure-call-BkaeM9Ej.mjs";const m={"crypto.getRandomValues":"crypto.getRandomValues","crypto.randomUUID":"crypto.randomUUID","Date.now":"Date.now","Math.random":"Math.random"},p=new Set(["globalThis","self"]),g=new Set(["globalThis","self","window"]),h=e=>{if(s.isIdentifier(e))return e.getText();if(s.isPropertyAccessExpression(e)){const t=e.getExpression();if(s.isIdentifier(t)&&g.has(t.getText()))return e.getName()}},x=e=>{const t=e.getExpression();if(s.isIdentifier(t)){const i=t.getText();return i==="fetch"||i==="Date"?i:void 0}if(!s.isPropertyAccessExpression(t))return;const n=t.getName(),o=h(t.getExpression());if(o!==void 0)return n==="fetch"&&p.has(o)?"fetch":m[`${o}.${n}`]},N=e=>{const t=e.getExpression();if(!s.isIdentifier(t)||t.getText()!=="Date")return;const n=e.getArguments(),o=n.every(i=>s.isNumericLiteral(i)||s.isStringLiteral(i)||s.isNoSubstitutionTemplateLiteral(i));return n.length>0&&o?void 0:"new Date"},E=e=>{const t=e.getInitializer();if(!t||!s.isCallExpression(t))return;const n=u(t);if(!n||n.kind!=="query"&&n.kind!=="mutation")return;const o=c(t,n.receiver);return o?{exportName:f(e)??e.getName(),handler:o,kind:n.kind}:void 0},S=(e,t)=>{const n=[];for(const o of e.handler.getDescendantsOfKind(r.CallExpression)){const i=x(o);i!==void 0&&n.push({callee:i,exportName:e.exportName,file:t,kind:e.kind,line:o.getStartLineNumber()})}for(const o of e.handler.getDescendantsOfKind(r.NewExpression)){const i=N(o);i!==void 0&&n.push({callee:i,exportName:e.exportName,file:t,kind:e.kind,line:o.getStartLineNumber()})}return n},v=(e,t)=>{const n=[];for(const o of d(e)){const i=E(o);i&&n.push(...S(i,t))}return n},T=(e,t)=>{const n=[];for(const o of a(t)){const i=e.getSourceFile(o)??e.addSourceFileAtPath(o);n.push(...v(i,l(t,o)))}return n};export{T as default};
|