@lunora/codegen 1.0.0-alpha.400 → 1.0.0-alpha.401
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/{GENERATED_HEADER-B-tYRlRG.mjs → GENERATED_HEADER-DgrhC3Iv.mjs} +1 -1
- package/dist/packem_shared/{LUNORA_ERROR_CODES-CjACC-MQ.mjs → LUNORA_ERROR_CODES-D7AVT7qF.mjs} +1 -1
- package/dist/packem_shared/{OPENRPC_VERSION-Dr6Xjldk.mjs → OPENRPC_VERSION-CCp_wKFT.mjs} +1 -1
- package/dist/packem_shared/{SCHEMA_SNAPSHOT_FILENAME-CxmZ2igT.mjs → SCHEMA_SNAPSHOT_FILENAME-BIELlQsc.mjs} +1 -1
- package/dist/packem_shared/{buildOpenApiDocument-BTp9vkHw.mjs → buildOpenApiDocument-B1PEHSSc.mjs} +1 -1
- package/dist/packem_shared/{emitAgents-ChXyTTzS.mjs → emitAgents-ec5ov78B.mjs} +1 -1
- package/dist/packem_shared/{emitApi-Cdc8MeNK.mjs → emitApi-lwadq5G7.mjs} +1 -1
- package/dist/packem_shared/{emitApp-xunr1-_c.mjs → emitApp-BrOgH7YU.mjs} +1 -1
- package/dist/packem_shared/{emitCrons-BQjDleCe.mjs → emitCrons-CCRKs482.mjs} +1 -1
- package/dist/packem_shared/{emitDataModel-MjAOi3KM.mjs → emitDataModel-BvCZS4Yq.mjs} +1 -1
- package/dist/packem_shared/{emitDrizzleSchema-Dszoyymv.mjs → emitDrizzleSchema-BzOChEYW.mjs} +1 -1
- package/dist/packem_shared/{emitFunctions-BIMKBLQ8.mjs → emitFunctions-ppMX7E3X.mjs} +1 -1
- package/dist/packem_shared/{emitServer-DNwuNiay.mjs → emitServer-DsSAaZaT.mjs} +1 -1
- package/dist/packem_shared/{emitShard-CueduzG1.mjs → emitShard-Dhy_F7iF.mjs} +1 -1
- package/dist/packem_shared/{qualifiers-ClaCHu0X.mjs → qualifiers-qqH8fRTo.mjs} +1 -1
- package/dist/packem_shared/{server-C4h6-BZx.mjs → server-CRFaUMKQ.mjs} +1 -1
- package/dist/packem_shared/{shard-DNpjvEod.mjs → shard-Csztu3jG.mjs} +57 -45
- package/dist/packem_shared/{shard-runtime-knn-ER8x.mjs → shard-runtime-D0xuE0pX.mjs} +1 -1
- package/dist/packem_shared/{shared-DhqnD5R3.mjs → shared-Cn7dMQ_u.mjs} +1 -1
- package/package.json +1 -1
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 p,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 v}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 R}from"./packem_shared/AGENTS_FILENAME-Cli3X44r.mjs";import{isTestPath as L,listLunoraSourceFiles as T}from"./packem_shared/isTestPath-ClgKgMYM.mjs";import{default as h}from"./packem_shared/discoverAuthApiCalls-f8_WRQEA.mjs";import{CONTAINERS_FILENAME as P,discoverContainers as D}from"./packem_shared/CONTAINERS_FILENAME-BX1_ALLp.mjs";import{default as b}from"./packem_shared/discoverCrons-DTqSuSDh.mjs";import{capabilitiesUsedBy as U,createTargetScope as B,foldCapabilitySignals as H,mayReadCapabilityContext as j,sourceCapabilitySignals as k}from"./packem_shared/capabilitiesUsedBy-SSrieNZ1.mjs";import{FLAGS_FILENAME as W,discoverFlags as z}from"./packem_shared/FLAGS_FILENAME-DY3yo1u_.mjs";import{d as Q}from"./packem_shared/index-fVYBrxkP.mjs";import{default as q}from"./packem_shared/discoverHttpRoutes-2gxHuLgt.mjs";import{default as J}from"./packem_shared/discoverHyperdriveCalls-DaJLewG0.mjs";import{default as Z}from"./packem_shared/discoverInserts-CLh70kVu.mjs";import{d as ee}from"./packem_shared/index-Dd6T5nSP.mjs";import{default as oe}from"./packem_shared/discoverMigrations-e5_NQdf-.mjs";import{MUTATORS_FILENAME as ie,discoverMutators as ae}from"./packem_shared/MUTATORS_FILENAME-Ck_l1lz7.mjs";import{default as de}from"./packem_shared/discoverNondeterministicCalls-CrXAegUc.mjs";import{ALL_NOTIFY_CHANNELS as me,NOTIFY_FILENAME as ne,discoverNotifyCalls as pe,discoverNotifyChannels as ce,discoverNotifyConfig as le}from"./packem_shared/ALL_NOTIFY_CHANNELS-D1SaOfnm.mjs";import{default as xe}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as Ae}from"./packem_shared/discoverQueries-T8b_7ZZ-.mjs";import{QUEUES_FILENAME as ve,discoverQueues as Ne}from"./packem_shared/QUEUES_FILENAME-C5xotY-M.mjs";import{default as Ce}from"./packem_shared/discoverR2sqlCalls-CY0xmIWX.mjs";import{default as Ie}from"./packem_shared/discoverRlsProcedures-DttY0Jld.mjs";import{default as _e}from"./packem_shared/discoverRlsMetadata-CnVvP2Ps.mjs";import{discoverSandboxUsage as Te}from"./packem_shared/discoverSandboxUsage-X0SECo-x.mjs";import{default as he}from"./packem_shared/discoverSchema-DDvMQheA.mjs";import{companionServiceBinding as Pe,readBoundServiceBindings as De,readDevServiceBindings as ye,readServiceBindings as be,resolveServiceBindings as Ge}from"./packem_shared/companionServiceBinding-ChINWo8k.mjs";import{SHAPES_FILENAME as Be,discoverShapes as He}from"./packem_shared/SHAPES_FILENAME-DCtGHMEm.mjs";import{default as ke}from"./packem_shared/discoverStorageRulesMetadata-t_oMSn0L.mjs";import{WORKFLOWS_FILENAME as We,discoverWorkflows as ze}from"./packem_shared/WORKFLOWS_FILENAME-CyV1HQaP.mjs";import{emitApp as Qe}from"./packem_shared/emitApp-
|
|
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 p,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 v}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 R}from"./packem_shared/AGENTS_FILENAME-Cli3X44r.mjs";import{isTestPath as L,listLunoraSourceFiles as T}from"./packem_shared/isTestPath-ClgKgMYM.mjs";import{default as h}from"./packem_shared/discoverAuthApiCalls-f8_WRQEA.mjs";import{CONTAINERS_FILENAME as P,discoverContainers as D}from"./packem_shared/CONTAINERS_FILENAME-BX1_ALLp.mjs";import{default as b}from"./packem_shared/discoverCrons-DTqSuSDh.mjs";import{capabilitiesUsedBy as U,createTargetScope as B,foldCapabilitySignals as H,mayReadCapabilityContext as j,sourceCapabilitySignals as k}from"./packem_shared/capabilitiesUsedBy-SSrieNZ1.mjs";import{FLAGS_FILENAME as W,discoverFlags as z}from"./packem_shared/FLAGS_FILENAME-DY3yo1u_.mjs";import{d as Q}from"./packem_shared/index-fVYBrxkP.mjs";import{default as q}from"./packem_shared/discoverHttpRoutes-2gxHuLgt.mjs";import{default as J}from"./packem_shared/discoverHyperdriveCalls-DaJLewG0.mjs";import{default as Z}from"./packem_shared/discoverInserts-CLh70kVu.mjs";import{d as ee}from"./packem_shared/index-Dd6T5nSP.mjs";import{default as oe}from"./packem_shared/discoverMigrations-e5_NQdf-.mjs";import{MUTATORS_FILENAME as ie,discoverMutators as ae}from"./packem_shared/MUTATORS_FILENAME-Ck_l1lz7.mjs";import{default as de}from"./packem_shared/discoverNondeterministicCalls-CrXAegUc.mjs";import{ALL_NOTIFY_CHANNELS as me,NOTIFY_FILENAME as ne,discoverNotifyCalls as pe,discoverNotifyChannels as ce,discoverNotifyConfig as le}from"./packem_shared/ALL_NOTIFY_CHANNELS-D1SaOfnm.mjs";import{default as xe}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as Ae}from"./packem_shared/discoverQueries-T8b_7ZZ-.mjs";import{QUEUES_FILENAME as ve,discoverQueues as Ne}from"./packem_shared/QUEUES_FILENAME-C5xotY-M.mjs";import{default as Ce}from"./packem_shared/discoverR2sqlCalls-CY0xmIWX.mjs";import{default as Ie}from"./packem_shared/discoverRlsProcedures-DttY0Jld.mjs";import{default as _e}from"./packem_shared/discoverRlsMetadata-CnVvP2Ps.mjs";import{discoverSandboxUsage as Te}from"./packem_shared/discoverSandboxUsage-X0SECo-x.mjs";import{default as he}from"./packem_shared/discoverSchema-DDvMQheA.mjs";import{companionServiceBinding as Pe,readBoundServiceBindings as De,readDevServiceBindings as ye,readServiceBindings as be,resolveServiceBindings as Ge}from"./packem_shared/companionServiceBinding-ChINWo8k.mjs";import{SHAPES_FILENAME as Be,discoverShapes as He}from"./packem_shared/SHAPES_FILENAME-DCtGHMEm.mjs";import{default as ke}from"./packem_shared/discoverStorageRulesMetadata-t_oMSn0L.mjs";import{WORKFLOWS_FILENAME as We,discoverWorkflows as ze}from"./packem_shared/WORKFLOWS_FILENAME-CyV1HQaP.mjs";import{emitApp as Qe}from"./packem_shared/emitApp-BrOgH7YU.mjs";import{isD1GlobalTable as qe,isHyperdriveGlobalTable as we}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as Xe,emitOpenApi as Ze,emitOpenApiModule as $e}from"./packem_shared/buildOpenApiDocument-B1PEHSSc.mjs";import{OPENRPC_VERSION as rr,buildOpenRpcDocument as or,emitOpenRpc as tr,emitOpenRpcModule as ir}from"./packem_shared/OPENRPC_VERSION-CCp_wKFT.mjs";import{DEFAULT_TARGET as sr,platformMatrixIds as dr,readProjectTarget as fr,resolveCodegenTarget as mr}from"./packem_shared/DEFAULT_TARGET-C-gcdslJ.mjs";import{loadProjectConfig as pr,readProjectConfigLiterals as cr,readProjectLazyFunctions as lr}from"./packem_shared/loadProjectConfig-CtcJHHKS.mjs";import{PROJECT_CONFIG_FILENAMES as xr,findCodegenConfigFile as Er,findProjectConfigFile as Ar,projectConfigCandidatePaths as ur}from"./packem_shared/PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs";import{SCHEMA_SNAPSHOT_FILENAME as Nr,runCodegen as gr}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-BIELlQsc.mjs";import{SchemaSnapshotParseError as Or,buildSchemaSnapshot as Ir,evaluateSchemaDrift as Rr,indexReferencesOf as _r,parseSchemaSnapshot as Lr}from"./packem_shared/SchemaSnapshotParseError-DnAuFdpl.mjs";import{default as Mr}from"./packem_shared/fingerprintSchemaSources-PmhepCVj.mjs";import{schemaFromIr as Fr}from"./packem_shared/schemaFromIr-CByOxuZb.mjs";import{LUNORA_ERROR_CODES as Dr,validatorIrToJsonSchema as yr}from"./packem_shared/LUNORA_ERROR_CODES-D7AVT7qF.mjs";import{SDK_LANGUAGES as Gr,SDK_TARGETS as Ur,generateSdk as Br}from"./sdk/index.mjs";import{redact as jr,secretKindOf as kr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as Wr}from"./packem_shared/emitDrizzleSchema-BzOChEYW.mjs";import{e as Kr}from"./packem_shared/server-CRFaUMKQ.mjs";import{e as Yr}from"./packem_shared/shard-Csztu3jG.mjs";import{G as wr}from"./packem_shared/shared-Cn7dMQ_u.mjs";import{MESSAGE_SOLUTIONS as Xr,findSolutionByMessage as Zr}from"@lunora/errors";import{createCodegenProject as eo,findTsconfig as ro,refreshCodegenProject as oo,tsconfigFingerprint as to}from"./packem_shared/createCodegenProject-C8N4Zm8h.mjs";import{t as ao,u as so,v as fo}from"./packem_shared/shard-runtime-D0xuE0pX.mjs";import{emitApi as no,emitCollections as po,emitInternalApi as co}from"./packem_shared/emitApi-lwadq5G7.mjs";import{emitCrons as So,emitScheduler as xo,emitVectors as Eo,emitWranglerCronTriggers as Ao}from"./packem_shared/emitCrons-CCRKs482.mjs";import{emitDataModel as vo}from"./packem_shared/emitDataModel-BvCZS4Yq.mjs";import{emitFunctions as go}from"./packem_shared/emitFunctions-ppMX7E3X.mjs";import{isTypedSchema as Oo}from"./packem_shared/isTypedSchema-CDv3pJB6.mjs";const e="0.0.0";export{I as AGENTS_FILENAME,me as ALL_NOTIFY_CHANNELS,E as CAPABILITY_PROBES,u as COMPANION_BINDING,v as COMPANION_SERVICE_NAME,P as CONTAINERS_FILENAME,g as CodegenDiagnosticError,sr as DEFAULT_TARGET,W as FLAGS_FILENAME,wr as GENERATED_HEADER,Dr as LUNORA_ERROR_CODES,Xr as LUNORA_SOLUTION_RULES,ie as MUTATORS_FILENAME,ne as NOTIFY_FILENAME,rr as OPENRPC_VERSION,xr as PROJECT_CONFIG_FILENAMES,ve as QUEUES_FILENAME,Nr as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Gr as SDK_LANGUAGES,Ur as SDK_TARGETS,Be as SHAPES_FILENAME,Or as SchemaSnapshotParseError,e as VERSION,We as WORKFLOWS_FILENAME,Xe as buildOpenApiDocument,or as buildOpenRpcDocument,Ir as buildSchemaSnapshot,U as capabilitiesUsedBy,Pe as companionServiceBinding,eo as createCodegenProject,B as createTargetScope,p as describeErrorLevelFindings,C as diagnosticAt,i as diffSchemaSnapshots,R as discoverAgents,h as discoverAuthApiCalls,D as discoverContainers,b as discoverCrons,z as discoverFlags,Q as discoverFunctions,q as discoverHttpRoutes,J as discoverHyperdriveCalls,Z as discoverInserts,ee as discoverMaskProcedures,oe as discoverMigrations,ae as discoverMutators,de as discoverNondeterministicCalls,pe as discoverNotifyCalls,ce as discoverNotifyChannels,le as discoverNotifyConfig,Ae as discoverQueries,Ne as discoverQueues,Ce as discoverR2sqlCalls,_e as discoverRlsMetadata,Ie as discoverRlsProcedures,Te as discoverSandboxUsage,he as discoverSchema,He as discoverShapes,ke as discoverStorageRulesMetadata,ze as discoverWorkflows,ao as emitAgents,no as emitApi,Qe as emitApp,po as emitCollections,so as emitContainers,So as emitCrons,vo as emitDataModel,Wr as emitDrizzleSchema,go as emitFunctions,co as emitInternalApi,Ze as emitOpenApi,$e as emitOpenApiModule,tr as emitOpenRpc,ir as emitOpenRpcModule,xo as emitScheduler,Kr as emitServer,Yr as emitShard,Eo as emitVectors,fo as emitWorkflows,Ao as emitWranglerCronTriggers,c as errorAdvisoryNames,l as errorPlatformDiagnosticNames,Rr as evaluateSchemaDrift,Er as findCodegenConfigFile,Zr as findLunoraSolution,Ar as findProjectConfigFile,ro as findTsconfig,Mr as fingerprintSchemaSources,H as foldCapabilitySignals,d as formatAdvisories,Br as generateSdk,_r as indexReferencesOf,qe as isD1GlobalTable,we as isHyperdriveGlobalTable,L as isTestPath,Oo as isTypedSchema,f as lintSchema,T as listLunoraSourceFiles,pr as loadProjectConfig,j as mayReadCapabilityContext,Lr as parseSchemaSnapshot,dr as platformMatrixIds,ur as projectConfigCandidatePaths,De as readBoundServiceBindings,ye as readDevServiceBindings,xe as readPackageDependencies,cr as readProjectConfigLiterals,lr as readProjectLazyFunctions,fr as readProjectTarget,be as readServiceBindings,jr as redact,oo as refreshCodegenProject,mr as resolveCodegenTarget,Ge as resolveServiceBindings,gr as runCodegen,Fr as schemaFromIr,kr as secretKindOf,a as serializeSchemaSnapshot,S as sortedUniqueNames,k as sourceCapabilitySignals,m as toAdvisorContext,to as tsconfigFingerprint,yr as validatorIrToJsonSchema};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{G as n,I as p,a as o,g as d,d as c,h as f,i as m,p as I,r as T,f as y,b as E,c as O,e as A,s as l,u as v,v as P}from"./shared-
|
|
1
|
+
import{G as n,I as p,a as o,g as d,d as c,h as f,i as m,p as I,r as T,f as y,b as E,c as O,e as A,s as l,u as v,v as P}from"./shared-Cn7dMQ_u.mjs";import"./parse-validator-BisfC8bR.mjs";import"./reserved-words-CW1QFbTd.mjs";import"./LUNORA_ERROR_CODES-D7AVT7qF.mjs";import"./dispatch-namespace-DwTjD7BU.mjs";export{n as GENERATED_HEADER,p as IMPORT_PATH_RE,o as assertIdentifier,d as assertPropertyIdentifier,c as baseSpecifiers,f as isOptionalOnInsert,m as isSensitiveFunction,I as pascalCase,T as renderArgsType,y as renderInsertInterface,E as renderNamespaceTree,O as renderObjectKey,A as renderPropertyKey,l as sensitiveArgNamesOf,v as unwrapOptional,P as validatorToType};
|
package/dist/packem_shared/{LUNORA_ERROR_CODES-CjACC-MQ.mjs → LUNORA_ERROR_CODES-D7AVT7qF.mjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsonSchemaFromNode as r,acceptsAbsent as i,objectSchemaFromNodes as o}from"@lunora/values";const c=/^-?\d+n$/u,N=t=>{if(t===void 0)return{};const e=t.trim();if(e==="true")return{const:!0};if(e==="false")return{const:!1};if(e==="null")return{const:null,type:"null"};if(e.startsWith('"')&&e.endsWith('"'))try{return{const:JSON.parse(e),type:"string"}}catch{return{const:e.slice(1,-1),type:"string"}}if(e.startsWith("'")&&e.endsWith("'"))return{const:e.slice(1,-1),type:"string"};if(c.test(e))return{const:e.slice(0,-1),format:"int64",type:"string"};const s=Number(e);return Number.isNaN(s)?{const:e}:{const:s}},n={constraints:()=>{},inner:t=>t.inner,isNullable:t=>t.column?.notNull===!1,keyChild:t=>t.keyType,kind:t=>t.kind,literalSchema:t=>N(t.literalValue),members:t=>t.members??[],sensitive:t=>t.sensitive===!0,shape:t=>t.shape??{},tableName:t=>t.tableName,valueChild:t=>t.valueType},O=t=>r(t,n),E=t=>o(t,n),a={...n,kind:t=>t.sourceText===void 0?n.kind(t):"from"},
|
|
1
|
+
import{jsonSchemaFromNode as r,acceptsAbsent as i,objectSchemaFromNodes as o}from"@lunora/values";const c=/^-?\d+n$/u,N=t=>{if(t===void 0)return{};const e=t.trim();if(e==="true")return{const:!0};if(e==="false")return{const:!1};if(e==="null")return{const:null,type:"null"};if(e.startsWith('"')&&e.endsWith('"'))try{return{const:JSON.parse(e),type:"string"}}catch{return{const:e.slice(1,-1),type:"string"}}if(e.startsWith("'")&&e.endsWith("'"))return{const:e.slice(1,-1),type:"string"};if(c.test(e))return{const:e.slice(0,-1),format:"int64",type:"string"};const s=Number(e);return Number.isNaN(s)?{const:e}:{const:s}},n={constraints:()=>{},inner:t=>t.inner,isNullable:t=>t.column?.notNull===!1,keyChild:t=>t.keyType,kind:t=>t.kind,literalSchema:t=>N(t.literalValue),members:t=>t.members??[],sensitive:t=>t.sensitive===!0,shape:t=>t.shape??{},tableName:t=>t.tableName,valueChild:t=>t.valueType},O=t=>r(t,n),E=t=>o(t,n),a={...n,kind:t=>t.sourceText===void 0?n.kind(t):"from"},R=t=>i(t,a),u=["BAD_REQUEST","CONFLICT","COUNT_RLS_UNSUPPORTED","FORBIDDEN","FUNCTION_NOT_FOUND","INTERNAL","INTERNAL_SERVER_ERROR","METHOD_NOT_ALLOWED","NOT_FOUND","NOT_IMPLEMENTED","PAYLOAD_TOO_LARGE","TOO_MANY_REQUESTS","UNAUTHORIZED","UNPROCESSABLE","VALIDATION_ERROR","UNIQUE_INDEX_DUPLICATES","INVALID_CURSOR"];export{u as LUNORA_ERROR_CODES,R as acceptsAbsentIr,N as literalConst,E as objectSchema,O as validatorIrToJsonSchema};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{m}from"./modules-DE0ksIeR.mjs";import{r as u}from"./json-data-Chfs2Cz5.mjs";import{validatorIrToJsonSchema as p,objectSchema as l,LUNORA_ERROR_CODES as d}from"./LUNORA_ERROR_CODES-
|
|
1
|
+
import{m}from"./modules-DE0ksIeR.mjs";import{r as u}from"./json-data-Chfs2Cz5.mjs";import{validatorIrToJsonSchema as p,objectSchema as l,LUNORA_ERROR_CODES as d}from"./LUNORA_ERROR_CODES-D7AVT7qF.mjs";import{G as h}from"./shared-Cn7dMQ_u.mjs";import{s as i}from"./dispatch-namespace-DwTjD7BU.mjs";const R="1.3.2",g={description:"Result is TS-inferred from the function's return type (no `.output()` declared); best-effort — any JSON."},O=(e,r)=>e==="stream"?`Open the \`stream\` \`${r}\` over the Lunora WebSocket. It yields chunks rather than one result, so its \`result\` schema is a placeholder.`:`Invoke the \`${e}\` \`${r}\` over the Lunora RPC envelope (POST /_lunora/rpc, body \`{ "functionPath": "${r}", "args": { … } }\`).`,S=(e,r)=>{const o=`${i(e.filePath)}:${e.exportName}`;return{description:O(e.kind,o),errors:d.map((s,a)=>({code:-32e3-a,data:{code:s},message:s})),name:o,params:[{description:"The function's argument object (the RPC envelope's `args`).",name:"args",required:Object.keys(e.args).length>0,schema:l(e.args)}],result:{name:"result",schema:e.output&&e.kind!=="stream"?p(e.output):g},summary:`${e.kind}: ${o}`,"x-lunora-function-kind":e.kind,...e.description?{"x-lunora-description":e.description}:{},"x-tags":[{name:r}]}},v=e=>{const r=e.version??"0.0.0",n=e.functions.filter(t=>t.visibility!=="internal"),o=e.modules??[],s=n.map(t=>S(t,m(o,t.filePath))).toSorted((t,c)=>t.name.localeCompare(c.name));return{info:{description:"Auto-generated from @lunora/values-typed functions by @lunora/codegen. Do not edit — run `lunora codegen` to regenerate.",title:"Lunora RPC",version:r},methods:s,openrpc:R}},E=e=>`${JSON.stringify(v(e),void 0,2)}
|
|
2
2
|
`,N=e=>`${h}export const openRpcSpec = ${u(e,"Record<string, unknown>")};
|
|
3
3
|
`;export{R as OPENRPC_VERSION,v as buildOpenRpcDocument,E as emitOpenRpc,N as emitOpenRpcModule};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync as M,readFileSync as Je,mkdirSync as Gt,writeFileSync as Cr,rmSync as pe,readdirSync as Yt}from"node:fs";import{dirname as Ze,join as v,relative as Qt}from"node:path";import{performance as At}from"node:perf_hooks";import{runAdvisor as Or}from"@lunora/advisor";import{LunoraError as L}from"@lunora/errors";import{serializeSchemaSnapshot as kr}from"./SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import{toAdvisorContext as Rr}from"./formatAdvisories-BCVASH7N.mjs";import{Node as r,SyntaxKind as d,Project as Xt,ts as Fr,VariableDeclarationKind as Jt}from"ts-morph";import{listLunoraSourceFiles as A,lunoraRelativePath as I,descendantsOfKind as E,bindingKeyName as ge,collectCallRows as O,findObjectProperty as q,collectSecurityCallRows as Lr,propertyInitializer as F,listSecurityScanFiles as et,objectLiteralFromCallbackBody as _n,limitNameOf as zn,optionsObjectLiteral as $n,handlerOf as Dr,collectNodeRows as ae,chainRootOf as tt,outermostValueWrapper as C,isWriteTarget as st,isSameNode as N,unwrapExpression as h,isConstDeclaration as ce,memberAccessOf as Zt,returningFunctionOf as Ft,walkChain as Mr,RUN_METHODS as Kn,functionReferenceSegments as _r,isTestPath as zr,isFunctionLike as le,functionKeyOf as Bn,withSourceListMemo as $r}from"./isTestPath-ClgKgMYM.mjs";import{j as Z,h as Y,d as D,b as es,c as S,a as nt,w as ts,k as Kr,l as Br,f as Vr,m as Ur,g as Lt,i as Wr}from"./attribution-DjweYNgJ.mjs";import{b as Vs,r as bt,a as X,e as qr,m as Vn,c as it,f as ss,E as Un,C as Wn,d as jr,g as Hr,i as Gr}from"./context-root-2wag3akK.mjs";import{a as T,i as qn,c as ie,d as jn,e as Yr,f as Qr,g as Hn}from"./classify-procedure-call-BuF5PNwV.mjs";import{a as y,s as Xr}from"./property-name-7cBlgK_O.mjs";import{b as Jr,a as rt}from"./module-specifiers-BctA0m_p.mjs";import{r as ot,s as Zr}from"./parse-validator-BisfC8bR.mjs";import eo from"./discoverAuthApiCalls-f8_WRQEA.mjs";import{i as $,r as Gn}from"./database-calls-B_85LJIk.mjs";import{i as Dt,p as Yn,w as to,d as so}from"./index-fVYBrxkP.mjs";import no from"./discoverHyperdriveCalls-DaJLewG0.mjs";import{diagnosticAt as de}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{m as ns,a as qe,s as Qn,d as io}from"./index-Dd6T5nSP.mjs";import{MUTATORS_FILENAME as ro,isDefineMutatorCallee as oo,mutatorServerImplOf as ao,discoverMutators as co}from"./MUTATORS_FILENAME-Ck_l1lz7.mjs";import lo from"./discoverNondeterministicCalls-CrXAegUc.mjs";import{discoverNotifyConfig as uo,discoverNotifyCalls as fo}from"./ALL_NOTIFY_CHANNELS-D1SaOfnm.mjs";import po from"./discoverR2sqlCalls-CY0xmIWX.mjs";import go from"./discoverRlsProcedures-DttY0Jld.mjs";import{s as is,n as mo}from"./dispatch-namespace-DwTjD7BU.mjs";import{secretKindOf as ho,redact as vo,isHeuristicSecretKind as Eo,isSecretishName as xo}from"./redact-Cy14LEnc.mjs";import{readProjectConfigLiterals as Xn,readProjectLazyFunctions as So,readProjectStudioCompanion as yo,readMergeDurableObjects as Ao}from"./loadProjectConfig-CtcJHHKS.mjs";import{a as Me,d as bo,r as No}from"./modules-DE0ksIeR.mjs";import{WORKFLOWS_FILENAME as Po,discoverWorkflows as wo}from"./WORKFLOWS_FILENAME-CyV1HQaP.mjs";import{r as Io}from"./json-data-Chfs2Cz5.mjs";import{a as To,I as Co,g as Oo,G as Jn,d as ko,i as Ro}from"./shared-
|
|
1
|
+
import{existsSync as M,readFileSync as Je,mkdirSync as Gt,writeFileSync as Cr,rmSync as pe,readdirSync as Yt}from"node:fs";import{dirname as Ze,join as v,relative as Qt}from"node:path";import{performance as At}from"node:perf_hooks";import{runAdvisor as Or}from"@lunora/advisor";import{LunoraError as L}from"@lunora/errors";import{serializeSchemaSnapshot as kr}from"./SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import{toAdvisorContext as Rr}from"./formatAdvisories-BCVASH7N.mjs";import{Node as r,SyntaxKind as d,Project as Xt,ts as Fr,VariableDeclarationKind as Jt}from"ts-morph";import{listLunoraSourceFiles as A,lunoraRelativePath as I,descendantsOfKind as E,bindingKeyName as ge,collectCallRows as O,findObjectProperty as q,collectSecurityCallRows as Lr,propertyInitializer as F,listSecurityScanFiles as et,objectLiteralFromCallbackBody as _n,limitNameOf as zn,optionsObjectLiteral as $n,handlerOf as Dr,collectNodeRows as ae,chainRootOf as tt,outermostValueWrapper as C,isWriteTarget as st,isSameNode as N,unwrapExpression as h,isConstDeclaration as ce,memberAccessOf as Zt,returningFunctionOf as Ft,walkChain as Mr,RUN_METHODS as Kn,functionReferenceSegments as _r,isTestPath as zr,isFunctionLike as le,functionKeyOf as Bn,withSourceListMemo as $r}from"./isTestPath-ClgKgMYM.mjs";import{j as Z,h as Y,d as D,b as es,c as S,a as nt,w as ts,k as Kr,l as Br,f as Vr,m as Ur,g as Lt,i as Wr}from"./attribution-DjweYNgJ.mjs";import{b as Vs,r as bt,a as X,e as qr,m as Vn,c as it,f as ss,E as Un,C as Wn,d as jr,g as Hr,i as Gr}from"./context-root-2wag3akK.mjs";import{a as T,i as qn,c as ie,d as jn,e as Yr,f as Qr,g as Hn}from"./classify-procedure-call-BuF5PNwV.mjs";import{a as y,s as Xr}from"./property-name-7cBlgK_O.mjs";import{b as Jr,a as rt}from"./module-specifiers-BctA0m_p.mjs";import{r as ot,s as Zr}from"./parse-validator-BisfC8bR.mjs";import eo from"./discoverAuthApiCalls-f8_WRQEA.mjs";import{i as $,r as Gn}from"./database-calls-B_85LJIk.mjs";import{i as Dt,p as Yn,w as to,d as so}from"./index-fVYBrxkP.mjs";import no from"./discoverHyperdriveCalls-DaJLewG0.mjs";import{diagnosticAt as de}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{m as ns,a as qe,s as Qn,d as io}from"./index-Dd6T5nSP.mjs";import{MUTATORS_FILENAME as ro,isDefineMutatorCallee as oo,mutatorServerImplOf as ao,discoverMutators as co}from"./MUTATORS_FILENAME-Ck_l1lz7.mjs";import lo from"./discoverNondeterministicCalls-CrXAegUc.mjs";import{discoverNotifyConfig as uo,discoverNotifyCalls as fo}from"./ALL_NOTIFY_CHANNELS-D1SaOfnm.mjs";import po from"./discoverR2sqlCalls-CY0xmIWX.mjs";import go from"./discoverRlsProcedures-DttY0Jld.mjs";import{s as is,n as mo}from"./dispatch-namespace-DwTjD7BU.mjs";import{secretKindOf as ho,redact as vo,isHeuristicSecretKind as Eo,isSecretishName as xo}from"./redact-Cy14LEnc.mjs";import{readProjectConfigLiterals as Xn,readProjectLazyFunctions as So,readProjectStudioCompanion as yo,readMergeDurableObjects as Ao}from"./loadProjectConfig-CtcJHHKS.mjs";import{a as Me,d as bo,r as No}from"./modules-DE0ksIeR.mjs";import{WORKFLOWS_FILENAME as Po,discoverWorkflows as wo}from"./WORKFLOWS_FILENAME-CyV1HQaP.mjs";import{r as Io}from"./json-data-Chfs2Cz5.mjs";import{a as To,I as Co,g as Oo,G as Jn,d as ko,i as Ro}from"./shared-Cn7dMQ_u.mjs";import{createCodegenProject as Fo}from"./createCodegenProject-C8N4Zm8h.mjs";import{findTsconfig as cx,refreshCodegenProject as lx,tsconfigFingerprint as dx}from"./createCodegenProject-C8N4Zm8h.mjs";import{wranglerString as Lo,wranglerValue as Do,companionName as Mo,COMPANION_FILES as _o}from"./COMPANION_BINDING-Da_v9XpC.mjs";import{CAPABILITIES as zo,usedCapabilities as $o}from"./CAPABILITY_PROBES-BuNEmlCO.mjs";import{isD1GlobalTable as Zn,isHyperdriveGlobalTable as ei}from"./isD1GlobalTable-udvHAAzD.mjs";import{discoverAgents as Ko}from"./AGENTS_FILENAME-Cli3X44r.mjs";import{discoverContainers as Bo}from"./CONTAINERS_FILENAME-BX1_ALLp.mjs";import Vo from"./discoverCrons-DTqSuSDh.mjs";import{contextPropertiesRead as Uo,createTargetScope as Wo,fileWiresRequestSecretTool as qo,discoverFeatureUsage as jo}from"./capabilitiesUsedBy-SSrieNZ1.mjs";import ti from"./readPackageDependencies-RHhGiz0k.mjs";import{PROJECT_CONFIG_FILENAMES as Ho,findProjectConfigFile as Go}from"./PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs";import{discoverQueueDeclarations as Yo}from"./QUEUES_FILENAME-C5xotY-M.mjs";import{discoverSandboxUsage as Qo}from"./discoverSandboxUsage-X0SECo-x.mjs";import{resolveServiceBindings as Xo}from"./companionServiceBinding-ChINWo8k.mjs";import Jo from"./discoverStorageRulesMetadata-t_oMSn0L.mjs";import{resolveCodegenTarget as _e,gatePlatformFeatures as Zo,readTargetDiagnostics as ea,vectorizeDimensionDiagnostics as ta,liveStreamsDeliveryAuthorizationDiagnostic as sa,socketRoutesDeliveryAuthorizationDiagnostic as na,studioPlatformFor as ia,platformFeatureAvailable as ra,gateAdminTokenRevocation as oa}from"./DEFAULT_TARGET-C-gcdslJ.mjs";import{i as aa}from"./schema-BgM8A3XV.mjs";import{b as si,e as ca}from"./shard-Csztu3jG.mjs";import{e as la,a as da}from"./server-CRFaUMKQ.mjs";import{emitDataModel as ua}from"./emitDataModel-BvCZS4Yq.mjs";import{i as fa,b as pa,e as ga,d as ma,f as ha,c as va}from"./unwrap-handler-return-BpigsVD6.mjs";import Ea from"./discoverHttpRoutes-2gxHuLgt.mjs";import xa from"./discoverInserts-CLh70kVu.mjs";import{e as ni}from"./exported-procedure-chains-BaxQ8C-S.mjs";import Sa from"./discoverMigrations-e5_NQdf-.mjs";import Us from"./discoverQueries-T8b_7ZZ-.mjs";import ya from"./discoverRlsMetadata-CnVvP2Ps.mjs";import Aa from"./discoverSchema-DDvMQheA.mjs";import{discoverShapes as ba}from"./SHAPES_FILENAME-DCtGHMEm.mjs";import{i as Na}from"./reserved-words-CW1QFbTd.mjs";import{emitAuthModule as Pa,emitApp as wa}from"./emitApp-BrOgH7YU.mjs";import{readJsonSync as Ia}from"@visulima/fs";import{indexReferencesOf as Ta,buildSchemaSnapshot as Ca}from"./SchemaSnapshotParseError-DnAuFdpl.mjs";import{buildOpenApiDocument as Oa,emitOpenApiModule as ka}from"./buildOpenApiDocument-B1PEHSSc.mjs";import{buildOpenRpcDocument as Ra,emitOpenRpcModule as Fa}from"./OPENRPC_VERSION-CCp_wKFT.mjs";import{w as La,u as Da,v as Ma,t as _a,x as za}from"./shard-runtime-D0xuE0pX.mjs";import{emitCollections as $a,emitSeed as Ka,emitApi as Ba,emitInternalApi as Va}from"./emitApi-lwadq5G7.mjs";import{emitCrons as Ua,emitScheduler as Wa,emitAdminRevocations as qa,emitShardRegistry as ja,emitDurableObjects as Ha,emitVectors as Ga,emitWranglerCronTriggers as Ya}from"./emitCrons-CCRKs482.mjs";import Qa from"./emitDrizzleSchema-BzOChEYW.mjs";import{LAZY_FUNCTION_DIRECTORY as ii,emitFunctions as Xa,emitLazyFunctionModules as Ja}from"./emitFunctions-ppMX7E3X.mjs";const Za=(e,t=!1)=>{if(e.length===0)return"";const s=ko(t),n=e.map(c=>{if(To(c.exportName,"live stream export name"),!Co.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=>{Oo(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}: {
|
package/dist/packem_shared/{buildOpenApiDocument-BTp9vkHw.mjs → buildOpenApiDocument-B1PEHSSc.mjs}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{m as b}from"./modules-DE0ksIeR.mjs";import{r as E}from"./json-data-Chfs2Cz5.mjs";import{LUNORA_ERROR_CODES as P,objectSchema as g,validatorIrToJsonSchema as l}from"./LUNORA_ERROR_CODES-
|
|
1
|
+
import{m as b}from"./modules-DE0ksIeR.mjs";import{r as E}from"./json-data-Chfs2Cz5.mjs";import{LUNORA_ERROR_CODES as P,objectSchema as g,validatorIrToJsonSchema as l}from"./LUNORA_ERROR_CODES-D7AVT7qF.mjs";import{G as A}from"./shared-Cn7dMQ_u.mjs";import{s as m}from"./dispatch-namespace-DwTjD7BU.mjs";const T="/_lunora/rest",x=["authorization","cf-access-jwt-assertion","cookie","payment-signature","x-payment"],v=["x-d1-bookmark","x-lunora-shard-key"],j=e=>[...x,...(e.credentialHeaders??[]).map(t=>t.toLowerCase())],O=e=>Number.isFinite(e)?Math.max(0,Math.floor(e)):0,$=(...e)=>{const t=[];for(const r of e)for(const n of r?.split(",")??[]){const s=n.trim().toLowerCase();s!==""&&!t.includes(s)&&t.push(s)}return t.length===0?void 0:t.join(", ")},k=(e,t)=>{const r=[t,`max-age=${String(O(e.maxAge))}`];return e.staleWhileRevalidate!==void 0&&r.push(`stale-while-revalidate=${String(O(e.staleWhileRevalidate))}`),r.join(", ")},N=e=>e.scope==="public"?$(e.vary,...j(e),...v):$(e.vary,...v),q=e=>{const t=e.indexOf(":");if(!(t<=0||t>=e.length-1||e.indexOf(":",t+1)!==-1))return{name:e.slice(t+1),namespace:e.slice(0,t)}},_=e=>{const t=q(e);if(t!==void 0)return`${T}/${t.namespace}/${t.name}`},C=e=>e==="query"?"GET":"POST",y="#/components/responses/LunoraError",R=/:([A-Za-z_$][\w$]*)/gu,w=e=>[...e.matchAll(R)].map(t=>t[1]),D=e=>e.replaceAll(R,"{$1}"),f=e=>e.kind==="optional"?e.inner??e:e,I=e=>{const t=new Set(w(e.path)),r=[];for(const[n,s]of Object.entries(e.searchParams)){const c=f(s);r.push({description:`Query parameter \`${n}\``,in:"query",name:n,required:s.kind!=="optional",schema:l(c)})}for(const[n,s]of Object.entries(e.params)){const c=f(s);r.push({description:`Path parameter \`${n}\``,in:t.has(n)?"path":"query",name:n,required:t.has(n)?!0:s.kind!=="optional",schema:l(c)})}return r},S=e=>e?{content:{"application/json":{schema:l(e)}},description:"Successful response."}:{content:{"application/json":{schema:{description:"Return shape is TS-inferred (no `.output()` declared); best-effort — any JSON."}}},description:"Successful response. The return shape is TypeScript-inferred and not declared via `.output()`, so it is documented best-effort."},L=(e,t)=>{const r=I(e),n={description:`${e.stream?"Streaming (SSE) ":""}HTTP route handler \`${e.exportName}\` (${e.method} ${e.path}).`,operationId:`${e.method.toLowerCase()}_${m(e.path)}`,responses:{200:S(e.output),204:{description:"No content (handler returned `undefined`)."},default:{$ref:y}},summary:`${e.method} ${e.path}`,tags:[t]};return r.length>0&&(n.parameters=r),Object.keys(e.body).length>0&&(n.requestBody={content:{"application/json":{schema:g(e.body)}},required:!0}),e.stream&&(n["x-lunora-stream"]="text/event-stream"),n},F=(e,t)=>{const r=`${m(e.filePath)}:${e.exportName}`,n={additionalProperties:!1,properties:{args:g(e.args),functionPath:{const:r,type:"string"},shardKey:{description:"Optional shard key; omitted routes to the default shard.",type:"string"}},required:["functionPath"],type:"object"};return{operation:{description:`Invoke the \`${e.kind}\` \`${r}\` over the Lunora RPC envelope (POST /_lunora/rpc).`,operationId:r,requestBody:{content:{"application/json":{schema:n}},required:!0},responses:{200:S(e.output),default:{$ref:y}},summary:`${e.kind}: ${r}`,tags:[t],"x-lunora-function-kind":e.kind},pathKey:`/_lunora/rpc#${r}`}},H=(e,t)=>{if(e===void 0||t!=="get"||e.scope===void 0||e.maxAge===void 0)return{};const r={maxAge:e.maxAge,scope:e.scope,...e.staleWhileRevalidate===void 0?{}:{staleWhileRevalidate:e.staleWhileRevalidate},...e.tag===void 0?{}:{tag:e.tag},...e.vary===void 0?{}:{vary:e.vary}},n={"Cache-Control":{description:r.scope==="public"?"Caching policy. `public` applies only to an uncredentialed request — a request carrying `Authorization` or `Cookie` is always answered `private`.":"Caching policy. Restricted to the caller's own cache; never stored by a shared/edge cache.",schema:{example:k(r,r.scope),type:"string"}}};r.tag!==void 0&&(n["Cache-Tag"]={description:"Purge tag for `ctx.cache.purge({ tags: [...] })`.",schema:{example:r.tag,type:"string"}});const s=N(r);return s!==void 0&&(n.Vary={description:"Request headers this response varies by. The endpoint's own negotiated headers are merged in at runtime.",schema:{example:s,type:"string"}}),{headers:n}},M=(e,t)=>{const r=`${m(e.filePath)}:${e.exportName}`,n=_(r);if(n===void 0)return;const s=C(e.kind),c=s==="GET",i={description:`Public REST endpoint for the \`${e.kind}\` \`${r}\` (opt-in via \`.expose({ rest: true })\`). Routed through the procedure, so auth / RLS / validators are enforced.`,operationId:`rest_${m(n)}`,responses:{200:{content:{"application/json":{schema:{description:"Procedure result. The shape is TS-inferred from the return type; best-effort — any JSON."}}},description:"Successful result (TypeScript-inferred return shape, documented best-effort).",...H(e.expose?.cache,c?"get":"post")},default:{$ref:y}},summary:`${s} ${n}`,tags:[t],"x-lunora-function-kind":e.kind};if(c){const d=Object.entries(e.args).map(([u,h])=>{const o=f(h);return{description:`Argument \`${u}\` (JSON-encoded for non-string values).`,in:"query",name:u,required:h.kind!=="optional",schema:l(o)}});return d.length>0&&(i.parameters=d),{method:"get",operation:i,path:n}}return i.requestBody={content:{"application/json":{schema:g(e.args)}},required:Object.keys(e.args).length>0},{method:"post",operation:i,path:n}},J=e=>{const t=e.version??"0.0.0",r=Object.create(null),n=o=>r[o]??Object.create(null),s=new Set,c=e.modules??[],i=o=>b(c,o);for(const o of e.httpRoutes){const a=D(o.path),p=n(a);p[o.method.toLowerCase()]=L(o,i(o.filePath)),r[a]=p,s.add(i(o.filePath))}const d=e.functions.filter(o=>o.visibility!=="internal"&&o.kind!=="stream");for(const o of d){const{operation:a,pathKey:p}=F(o,i(o.filePath));r[p]={post:a},s.add(i(o.filePath))}for(const o of d){if(o.expose?.rest!==!0)continue;const a=M(o,i(o.filePath));if(a===void 0)continue;const p=n(a.path);p[a.method]=a.operation,r[a.path]=p}const u=[...s].toSorted((o,a)=>o.localeCompare(a)).map(o=>({description:c.find(p=>p.name===o)?.description??`Operations declared in \`lunora/${o}\`.`,name:o}));return{components:{responses:{LunoraError:{content:{"application/json":{schema:{additionalProperties:!1,description:"Standard Lunora error envelope.",properties:{error:{additionalProperties:!1,properties:{code:{description:"Machine-readable error code. Clients switch on this value.",enum:P,type:"string"},message:{description:"Human-readable error message (never echoes internal details).",type:"string"}},required:["code","message"],type:"object"}},required:["error"],type:"object"}}},description:"A Lunora error response. The HTTP status reflects the error code (e.g. BAD_REQUEST→400, UNAUTHORIZED→401, FORBIDDEN→403, NOT_FOUND→404)."}}},info:{description:"Auto-generated from @lunora/values-typed functions by @lunora/codegen. Do not edit — run `lunora codegen` to regenerate.",title:"Lunora API",version:t},openapi:"3.1.0",paths:Object.fromEntries(Object.entries(r).map(([o,a])=>[o,{...a}])),tags:u}},z=e=>`${JSON.stringify(J(e),void 0,2)}
|
|
2
2
|
`,K=e=>`${A}export const openApiSpec = ${E(e,"Record<string, unknown>")};
|
|
3
3
|
`;export{J as buildOpenApiDocument,z as emitOpenApi,K as emitOpenApiModule};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./json-data-Chfs2Cz5.mjs";import{p as i,j as r,t as n,h as o,u as g,k as F,d as u,x as p,n as l,g as f,f as d,m as k,i as w,v as W,l as v,w as A}from"./shard-runtime-
|
|
1
|
+
import"./json-data-Chfs2Cz5.mjs";import{p as i,j as r,t as n,h as o,u as g,k as F,d as u,x as p,n as l,g as f,f as d,m as k,i as w,v as W,l as v,w as A}from"./shard-runtime-D0xuE0pX.mjs";import"./shared-Cn7dMQ_u.mjs";import"./platform-8oj7iXQy.mjs";export{i as buildDoTypeImports,r as emitAgentFragments,n as emitAgents,o as emitContainerFragments,g as emitContainers,F as emitPaymentFragments,u as emitQueueFragments,p as emitQueues,l as emitQueuesMetadataFragments,f as emitServiceFragments,d as emitTopicFragments,k as emitWorkflowEventFragments,w as emitWorkflowFragments,W as emitWorkflows,v as emitWorkflowsMetadataFragments,A as queueAliasFindings};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{AGENT_RUNTIME_FUNCTIONS as N}from"@lunora/agent/naming";import{LunoraError as R}from"@lunora/errors";import{r as d,a as w,b as P,c as L}from"./qualifiers-
|
|
1
|
+
import{AGENT_RUNTIME_FUNCTIONS as N}from"@lunora/agent/naming";import{LunoraError as R}from"@lunora/errors";import{r as d,a as w,b as P,c as L}from"./qualifiers-qqH8fRTo.mjs";import{a as A,r as y,p as $,G as x,b as k,c as m,d as S,e as O,i as T}from"./shared-Cn7dMQ_u.mjs";import{s as g}from"./dispatch-namespace-DwTjD7BU.mjs";const j=t=>k(t,e=>{const s=d(y(e.args),e.filePath),n=d(L(e),e.filePath),o=`FunctionReference<"${e.kind}", ${s}, ${n}>`;return`${e.exportName}: ${T(e)?`${o} & { readonly sensitive: true }`:o};`},"type"),I=(t,e)=>{if(t.length===0&&e.length===0)return{block:"",importLine:""};const s=[];let n="";if(t.length>0&&(n+="\n/** Params type carried by a `defineWorkflow` definition (its phantom `__params`). */\ntype WorkflowParamsOf<Definition> = Definition extends { __params?: infer Params } ? (unknown extends Params ? Record<string, unknown> : Params) : Record<string, unknown>;\n"),n+=`
|
|
2
2
|
/** A typed reference to a durable workflow, addressable for \`cronJobs()\` targets. Mirrors \`@lunora/scheduler\`'s \`WorkflowReference\` structurally. */
|
|
3
3
|
export interface WorkflowReference<Params = Record<string, unknown>> {
|
|
4
4
|
readonly isLunoraWorkflow: true;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{APP_METHOD_CAPABILITIES as q}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-
|
|
1
|
+
import{APP_METHOD_CAPABILITIES as q}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=>[...q.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);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{G as i,d as c}from"./shared-
|
|
1
|
+
import{G as i,d as c}from"./shared-Cn7dMQ_u.mjs";import{i as g}from"./schema-BgM8A3XV.mjs";const f=r=>r?`${i}/**
|
|
2
2
|
* The \`SchedulerDO\` Durable Object class, re-exported so a worker entry can
|
|
3
3
|
* forward it — wrangler binds only what the entry exports:
|
|
4
4
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as k}from"./qualifiers-
|
|
1
|
+
import{r as k}from"./qualifiers-qqH8fRTo.mjs";import{a as i,e as o,v as d,f as v,G as M}from"./shared-Cn7dMQ_u.mjs";const _="schema",w=a=>{for(const e of a.tables)i(e.name,"table name");const l=a.tables.map(e=>`"${e.name}"`).join(" | ")||"never",m=a.tables.filter(e=>e.extensionKey===void 0).map(e=>`"${e.name}"`).join(" | ")||"never",p=a.tables.map(e=>{const t=Object.entries(e.shape).map(([g,r])=>{const s=o(g);if(r.kind==="optional"){const h=r.inner?d(r.inner):"unknown";return` ${s}?: ${h};`}return` ${s}: ${d(r)};`}).join(`
|
|
2
2
|
`),n=t?`
|
|
3
3
|
${t}
|
|
4
4
|
`:"",N=e.commitOrdered===!0?`
|
package/dist/packem_shared/{emitDrizzleSchema-Dszoyymv.mjs → emitDrizzleSchema-BzOChEYW.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{SCHEMA_MODULE_PATH as c}from"./emitDataModel-
|
|
1
|
+
import{SCHEMA_MODULE_PATH as c}from"./emitDataModel-BvCZS4Yq.mjs";import{r as m}from"./qualifiers-qqH8fRTo.mjs";import{G as b,a as z,d as T,v as f,u as A,g as x,c as h}from"./shared-Cn7dMQ_u.mjs";const d=e=>{switch(e.kind){case"array":case"object":case"record":case"union":return{builder:"text",mode:"json",notNull:!0,typeAnnotation:f(e)};case"bigint":return{builder:"blob",mode:"bigint",notNull:!0};case"boolean":return{builder:"integer",mode:"boolean",notNull:!0};case"bytes":return{builder:"blob",mode:"buffer",notNull:!0};case"date":case"timestamp":return{builder:"integer",notNull:!0};case"from":return{builder:"text",notNull:!0,typeAnnotation:f(e)};case"id":return{builder:"text",notNull:!0};case"literal":{const t=e.literalValue??"";return t.startsWith('"')||t.startsWith("'")?{builder:"text",notNull:!0}:t==="true"||t==="false"?{builder:"integer",mode:"boolean",notNull:!0}:t==="null"?{builder:"text",notNull:!0}:{builder:"real",notNull:!0}}case"null":return{builder:"text",notNull:!0};case"number":return{builder:"real",notNull:!0};case"optional":return{...e.inner?d(e.inner):{builder:"text",notNull:!1},notNull:!1};case"storage":case"string":return{builder:"text",notNull:!0};default:return{builder:"text",notNull:!0}}},N=(e,t)=>{const r=A(e);return r.kind==="id"&&r.tableName!==void 0&&t.has(r.tableName)?r.tableName:void 0},j=(e,t,r)=>{x(e,"drizzle column name");const n=d(t),o=n.mode?`, { mode: "${n.mode}" }`:"";let l=`${n.builder}("${e}"${o})`;n.typeAnnotation&&(l+=`.$type<${n.typeAnnotation}>()`);const s=N(t,r);return s!==void 0&&(l+=`.references((): AnySQLiteColumn => ${s}._id)`),n.notNull&&t.column?.notNull!==!1&&(l+=".notNull()"),l},I=e=>{const t=e.unique?"uniqueIndex":"index",r=e.fields.map(n=>(x(n,"drizzle index field"),`t.${n}`)).join(", ");return` ${h(e.name)}: ${t}(${JSON.stringify(e.name)}).on(${r}),`},S=(e,t)=>{z(e.name,"table name");const r=[' _id: text("_id").primaryKey(),',' _creationTime: integer("_creationTime").notNull(),',...Object.entries(e.shape).map(([o,l])=>` ${o}: ${j(o,l,t)},`)].join(`
|
|
2
2
|
`),n=e.indexes.length>0?`, (t) => ({
|
|
3
3
|
${e.indexes.map(o=>I(o)).join(`
|
|
4
4
|
`)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{LunoraError as L}from"@lunora/errors";import{L as pe,i as ge,G as U,d as J,I as F,s as fe,b as C,r as ye,c as $e}from"./shared-
|
|
1
|
+
import{LunoraError as L}from"@lunora/errors";import{L as pe,i as ge,G as U,d as J,I as F,s as fe,b as C,r as ye,c as $e}from"./shared-Cn7dMQ_u.mjs";import{v as we}from"./parse-validator-BisfC8bR.mjs";import{renderAgentFunctionRegistry as be,renderSandboxFunctionRegistry as Re}from"./emitApi-lwadq5G7.mjs";import{b as ke,a as Ne,r as j,c as ve}from"./qualifiers-qqH8fRTo.mjs";import{s as g}from"./dispatch-namespace-DwTjD7BU.mjs";const Oe=new Set(["any","bigint","boolean","date","id","null","number","storage","string","timestamp"]),B=t=>t.column!==void 0,Se=(t,r)=>{switch(t){case"bigint":return`if (typeof ${r} !== "bigint") return DEFER;
|
|
2
2
|
`;case"boolean":return`if (typeof ${r} !== "boolean") return DEFER;
|
|
3
3
|
`;case"date":case"number":case"timestamp":return`if (typeof ${r} !== "number" || !Number.isFinite(${r})) return DEFER;
|
|
4
4
|
`;case"null":return`if (${r} !== null) return DEFER;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./CAPABILITY_PROBES-BuNEmlCO.mjs";import{e}from"./server-
|
|
1
|
+
import"./CAPABILITY_PROBES-BuNEmlCO.mjs";import{e}from"./server-CRFaUMKQ.mjs";import"./shared-Cn7dMQ_u.mjs";import"./platform-8oj7iXQy.mjs";export{e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import"./isD1GlobalTable-udvHAAzD.mjs";import"./json-data-Chfs2Cz5.mjs";import{e as d}from"./shard-
|
|
1
|
+
import"./SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import"./isD1GlobalTable-udvHAAzD.mjs";import"./json-data-Chfs2Cz5.mjs";import{e as d}from"./shard-Csztu3jG.mjs";import"./shard-runtime-D0xuE0pX.mjs";import"./shared-Cn7dMQ_u.mjs";import"./platform-8oj7iXQy.mjs";import"./schema-BgM8A3XV.mjs";export{d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as E}from"./declared-output-Iaar469J.mjs";import{v as u}from"./shared-
|
|
1
|
+
import{d as E}from"./declared-output-Iaar469J.mjs";import{v as u}from"./shared-Cn7dMQ_u.mjs";const p=/import\("(?<spec>(?:\.\.?\/)*_generated\/[^"]+)"\)/gu,l=/^(?:\.\.?\/)*_generated\//u,i=/\.[A-Za-z]\w*$/u,R=t=>t.replaceAll(p,(e,r)=>{const o=r.replace(l,"./");return`import("${i.test(o)?o:`${o}.js`}")`}),_=/import\("(?<spec>[^"]+)"\)/gu,a="node_modules/",m=/^@types\//u,A=t=>t.replaceAll(_,(e,r)=>{const o=r.lastIndexOf(a);if(o===-1||o>0&&r[o-1]!=="/")return e;const s=r.slice(o+a.length);return s===""||m.test(s)?e:`import("${s}")`}),I=/import\("(?<spec>\.\.?\/[^"]+)"\)/gu,f=/^(?:\.\.?\/)+/u,g=t=>{const e=[];for(const r of t.split("/"))if(!(r===""||r===".")){if(r===".."&&e.length>0&&e.at(-1)!==".."){e.pop();continue}e.push(r)}return e.join("/")},S=(t,e)=>t.replaceAll(I,(r,o)=>{if(l.test(o.replace(f,"")))return r;const s=e.includes("/")?e.slice(0,e.lastIndexOf("/")):"",c=`../${g(`${s}/${o}`)}`;return`import("${i.test(c)?c:`${c}.js`}")`}),v=(t,e)=>R(S(A(t),e)),d=["client","do","errors","flags","observability","platform","ratelimit","runtime","server","values"],L=new RegExp(String.raw`import\("@lunora/(?<pkg>${d.join("|")})(?<subpath>/[^"]*)?"\)`,"gu"),T={flags:new Set(["/web"]),platform:new Set},M=(t,e)=>e?t.replaceAll(L,(r,o,s)=>{const n=T[o];return s&&n&&!n.has(s)?r:`import("lunorash/${o}${s??""}")`}):t,O=t=>["Doc","Id"].filter(e=>new RegExp(String.raw`(?<![.$\w])${e}<`,"u").test(t)),U=t=>E(t)?u(t.output):t.returnType;export{O as a,M as b,U as c,v as r};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{CAPABILITIES as Qe}from"./CAPABILITY_PROBES-BuNEmlCO.mjs";import{existsSync as D,readdirSync as de,readlinkSync as ce,lstatSync as qe,statSync as Le}from"node:fs";import{join as h,relative as y,dirname as d,sep as ue,isAbsolute as _e,resolve as Ve,basename as Ge}from"node:path";import{ts as c,Project as He}from"ts-morph";import{G as pe,a as C,u as Ke,d as Ue}from"./shared-
|
|
1
|
+
import{CAPABILITIES as Qe}from"./CAPABILITY_PROBES-BuNEmlCO.mjs";import{existsSync as D,readdirSync as de,readlinkSync as ce,lstatSync as qe,statSync as Le}from"node:fs";import{join as h,relative as y,dirname as d,sep as ue,isAbsolute as _e,resolve as Ve,basename as Ge}from"node:path";import{ts as c,Project as He}from"ts-morph";import{G as pe,a as C,u as Ke,d as Ue}from"./shared-Cn7dMQ_u.mjs";import{p as Je}from"./platform-8oj7iXQy.mjs";const me=/(?:\.d)?\.([cm]?)tsx?$/u,ze=t=>t.replace(me,".d.$1ts"),ye=(t,o)=>{const a=y(t,o).split(ue).join("/").replace(me,".$1js");return a.startsWith(".")?a:`./${a}`},he=t=>t.replaceAll("\\","/"),Y=(t,o,a)=>he(h(t,ze(y(o,a)))),Ye=t=>ye(".",h("services",t.name,y(d(t.wranglerPath),t.main))),Xe=t=>{const o=[],a=e=>{(c.isImportDeclaration(e)||c.isExportDeclaration(e))&&e.moduleSpecifier!==void 0&&c.isStringLiteral(e.moduleSpecifier)?o.push(e.moduleSpecifier):c.isImportTypeNode(e)&&c.isLiteralTypeNode(e.argument)&&c.isStringLiteral(e.argument.literal)&&o.push(e.argument.literal),c.forEachChild(e,a)};return a(t),o},T=t=>{const{ctimeMs:o,mtimeMs:a,size:e}=Le(t);return`${String(a)}:${String(o)}:${String(e)}`},Ze=new Set([".git",".wrangler","dist","node_modules","target"]),fe=t=>de(t,{withFileTypes:!0}).flatMap(o=>{const a=h(t,o.name);return o.isSymbolicLink()?[`${a}->${ce(a)}`]:o.isDirectory()&&o.name.startsWith("@")?[`${a}:${T(a)}`,...fe(a)]:[]}),be=t=>[`${t}:${T(t)}`,...fe(t)],ge=t=>{const o=h(t,"node_modules"),a=D(o)?be(o):[],e=d(t);return e===t?a:[...a,...ge(e)]},et=(t,o)=>{const a=[];try{const e=s=>{for(const n of de(s,{withFileTypes:!0})){const l=h(s,n.name);if(l!==o)if(n.isSymbolicLink())a.push(`${l}->${ce(l)}`);else if(n.isDirectory()){if(n.name==="node_modules")a.push(...be(l));else if(!Ze.has(n.name)){if(!qe(l).isDirectory())throw new Error(`${l} changed during the scan`);e(l)}}else a.push(`${l}:${T(l)}`)}};e(t),a.push(...ge(t))}catch{return}return[...new Set(a)].toSorted((e,s)=>e.localeCompare(s)).join(`
|
|
2
2
|
`)},tt=t=>Ge(d(t)).startsWith("@")?d(d(t)):d(t),se=(t,o)=>!y(o,t).startsWith("..")&&!t.split(ue).includes("node_modules"),ie=(t,o)=>{const a=[];let e=t;for(;e!==d(e)&&!D(h(e,"package.json"));)a.push(e),e=d(e);if(D(h(e,"package.json"))){for(const s of[...a,e,h(e,"package.json")])o.add(s);return e}},at=(t,o,a)=>{let e=t;for(;y(e,o).startsWith("..")&&e!==d(e);)a.add(e),e=d(e);a.add(e)},rt=(t,o)=>{const a=new Set;t.some(e=>se(e,o))&&ie(o,a);for(const e of t){if(se(e,o)){for(let n=d(e);n!==o&&n!==d(n);n=d(n))a.add(n);continue}const s=ie(d(e),a);s===void 0?at(d(e),o,a):a.add(tt(s))}return[...a].map(e=>[e,T(e)])},xe=new Map,le=([t,o])=>{try{return T(t)===o}catch{return!1}},ot=(t,o,a)=>{const e=xe.get(t);return e?.optionsKey===o&&e.stamps.every(n=>le(n))&&e.directories.every(n=>le(n))&&a!==void 0&&e.tree===a?e.files:void 0},nt=(t,o,a)=>{const e=[...o.stamps,...o.directories].every(([,s])=>Math.floor(Number.parseFloat(s))<=a);o.tree!==void 0&&e&&xe.set(t,{...o,tree:o.tree})},st=(t,o)=>({directories:rt(o,t),stamps:o.map(a=>[a,T(a)])}),ht=(t,o)=>{const a=d(t.wranglerPath),e=y(a,t.main);if(e.startsWith("..")||_e(e))throw new Error(`@lunora/codegen: service "${t.name}": its entry module (${t.main}) must be inside ${a} to be typed as RPC`);const s=h(o,"services",t.name),n=c.findConfigFile(a,i=>c.sys.fileExists(i)),l=new He({compilerOptions:{composite:!1,declaration:!0,declarationMap:!1,emitDeclarationOnly:!0,incremental:!1,noEmit:!1,noEmitOnError:!1,outDir:s,rootDir:a},skipAddingFilesFromTsConfig:!0,...n===void 0?{}:{tsConfigFilePath:n}}),m=JSON.stringify([t.name,t.main,t.wranglerPath,o]),v=JSON.stringify(l.getCompilerOptions()),w=et(a,Ve(o)),g=ot(m,v,w);if(g!==void 0)return g;const A=Date.now();l.addSourceFileAtPath(t.main),l.resolveSourceFileDependencies();const $=l.getProgram().compilerObject.getSourceFiles().map(i=>i.fileName).filter(i=>D(i)),{directories:F,stamps:S}=st(a,$),u={...l.getCompilerOptions(),preserveSymlinks:!0},O=new Map(l.getSourceFiles().map(i=>i.getFilePath()).filter(i=>!i.endsWith(".d.ts")&&!y(a,i).startsWith("..")).map(i=>[Y(s,a,i),i])),f={};for(const i of l.emitToMemory({emitOnlyDtsFiles:!0}).getFiles()){const B=O.get(he(i.filePath));if(B===void 0)continue;const R=c.createSourceFile(i.filePath,i.text,c.ScriptTarget.Latest,!1);let{text:b}=i;for(const k of Xe(R).toReversed()){const x=c.resolveModuleName(k.text,B,u,c.sys).resolvedModule?.resolvedFileName;if(x===void 0)continue;const I=Y(s,a,x),W=O.has(I)?I:x;b=`${b.slice(0,k.getStart(R))}${JSON.stringify(ye(d(i.filePath),W))}${b.slice(k.getEnd())}`}f[y(o,i.filePath)]=`${pe}${b}`}if(f[y(o,Y(s,a,t.main))]===void 0)throw new Error(`@lunora/codegen: service "${t.name}": TypeScript emitted no declaration for its entry module ${t.main}`);return nt(m,{files:f,optionsKey:v,directories:F,stamps:S,tree:w},A),f},it=(t,o=[])=>{const a=new Set;for(const e of t.tables)for(const s of Object.values(e.shape)){const n=Ke(s);n.kind==="storage"&&typeof n.bucket=="string"&&n.bucket!==""&&a.add(n.bucket)}for(const e of o)e!==""&&e!=="default"&&a.add(e);return["default",...[...a].toSorted((e,s)=>e.localeCompare(s))]},ft=({agents:t=[],capabilities:o=new Set,containers:a=[],env:e,hasVectors:s=!0,hasFlags:n=!1,hasNotify:l=!1,identity:m,queues:v=[],schema:w,services:g=[],storageRuleBuckets:A=[],topics:$=[],useUmbrella:F=!1,workflows:S=[]}={})=>{const u=Ue(F),O=it(w??{tables:[]},A).map(r=>JSON.stringify(r)).join(" | "),f=r=>r.sandbox===!0?"SandboxContainerAccessor":"ContainerAccessor",i=[...new Set(a.map(r=>f(r)))].toSorted((r,p)=>r.localeCompare(p)),B=a.length>0?`import type { ${i.join(", ")} } from "@lunora/container";
|
|
3
3
|
`:"",R=a.length>0?`
|
|
4
4
|
readonly containers: {${a.map(r=>`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{LunoraError as pe}from"@lunora/errors";import{serializeSchemaSnapshot as Zt,hashSchemaSnapshot as er}from"./SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import{isHyperdriveGlobalTable as tr,isD1GlobalTable as rr}from"./isD1GlobalTable-udvHAAzD.mjs";import{r as nr}from"./json-data-Chfs2Cz5.mjs";import{r as q,e as ar,a as sr,b as or,c as ir,d as dr,f as cr,g as lr,h as ur,i as hr,j as pr,k as mr,l as fr,m as gr,n as br,o as yr,p as wr,q as vr,s as kr}from"./shard-runtime-
|
|
1
|
+
import{LunoraError as pe}from"@lunora/errors";import{serializeSchemaSnapshot as Zt,hashSchemaSnapshot as er}from"./SCHEMA_SNAPSHOT_VERSION-DTLoSaNn.mjs";import{isHyperdriveGlobalTable as tr,isD1GlobalTable as rr}from"./isD1GlobalTable-udvHAAzD.mjs";import{r as nr}from"./json-data-Chfs2Cz5.mjs";import{r as q,e as ar,a as sr,b as or,c as ir,d as dr,f as cr,g as lr,h as ur,i as hr,j as pr,k as mr,l as fr,m as gr,n as br,o as yr,p as wr,q as vr,s as kr}from"./shard-runtime-D0xuE0pX.mjs";import{u as U,h as Sr,s as Rr,a as xr,I as Ar,c as Or,G as Tr,d as _r}from"./shared-Cn7dMQ_u.mjs";import{p as Dr}from"./platform-8oj7iXQy.mjs";import{i as Ir}from"./schema-BgM8A3XV.mjs";const m=(r,t)=>`((): (() => ${t}) => { let cached: ${t} | undefined; return () => (cached ??= JSON.parse(${JSON.stringify(JSON.stringify(r))}) as ${t}); })()`,me=["categories","description","facing","level","remediation","title"],Er=r=>{const t={};return{advisoryRows:r.map(o=>{let n=t[o.name];return n||(n=Object.fromEntries(me.filter(a=>a in o).map(a=>[a,o[a]])),t[o.name]=n),Object.fromEntries(Object.entries(o).filter(([a,i])=>!me.includes(a)||JSON.stringify(i)!==JSON.stringify(n[a])))}),advisoryRules:t}},Cr=` /**
|
|
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
|
|
@@ -234,7 +234,7 @@ ${y()}
|
|
|
234
234
|
await applyCdcChanges(writer, args.changes);
|
|
235
235
|
|
|
236
236
|
return { applied: args.changes.length };
|
|
237
|
-
}`,Pr=({actionOnlyBuild:r,actionOnlyFields:t,agentsBuild:e,agentsContextField:o,agentsSchedulerSource:n,containersBuild:a,containersContextField:i,databaseOptions:f,everyContextBuild:c,everyContextField:g,facadeBlock:A,globalDatabaseLine:w,hasSensitiveArgs:u=!1,lazyFunctions:l=!1,notifyBuild:O,ormContextField:v,paymentsBuild:F,paymentsContextField:
|
|
237
|
+
}`,Pr=({actionOnlyBuild:r,actionOnlyFields:t,agentsBuild:e,agentsContextField:o,agentsSchedulerSource:n,containersBuild:a,containersContextField:i,databaseOptions:f,everyContextBuild:c,everyContextField:g,facadeBlock:A,globalDatabaseLine:w,hasSensitiveArgs:u=!1,lazyFunctions:l=!1,notifyBuild:O,ormContextField:v,paymentsBuild:F,paymentsContextField:B,queuesBuild:R,queuesContextField:j,topicsBuild:d,topicsContextField:k,vectorsBuild:I,vectorsContextField:W,workflowsBuild:K,workflowsContextField:E})=>{const T=t.length>0,H=v===""?"{ db }":"{ db, orm: bindOrm(facade) }",V=v===""?"":`
|
|
238
238
|
orm: databaseContext.orm,`,C=v===""?"":`
|
|
239
239
|
orm: { configurable: true, enumerable: true, value: mutationDatabase.orm, writable: true },`,x=T?`
|
|
240
240
|
// ActionCtx-only helpers (external, non-deterministic I/O): constructed
|
|
@@ -300,7 +300,7 @@ ${r.replaceAll(/^(?=.)/gmu," ")}${t.map(p=>` ctx.${p} = ${p};`
|
|
|
300
300
|
|
|
301
301
|
return caller.ip;
|
|
302
302
|
};
|
|
303
|
-
${I}${c}${a}${
|
|
303
|
+
${I}${c}${a}${K}${R}${d}${e}
|
|
304
304
|
// Which dispatch this ctx belongs to. Drives the two deferral facades
|
|
305
305
|
// below and the \`ctx.run*\` caller guard; a ctx built for an
|
|
306
306
|
// admin/lifecycle path has no registered function, and so no kind. An
|
|
@@ -415,7 +415,7 @@ ${w} // \`ctx.db\`, wrapped in automatic instrumentation: by default
|
|
|
415
415
|
// mutation must rebuild its DB and table/ORM views with its own queue.
|
|
416
416
|
const makeDatabaseContext = (scheduler: SchedulerLike) => {
|
|
417
417
|
const db: DatabaseWriterLike = this.instrumentDb(createShardCtxDb(${f}), logFunctionPath, traceAnchor, observability, options.sensitive);
|
|
418
|
-
${A} return ${
|
|
418
|
+
${A} return ${H};
|
|
419
419
|
};
|
|
420
420
|
const databaseContext = makeDatabaseContext(scheduler);
|
|
421
421
|
const db = databaseContext.db;
|
|
@@ -505,11 +505,11 @@ ${O}
|
|
|
505
505
|
// to the handler so code that signs its own URLs (a copy-in
|
|
506
506
|
// \`createStorage\`) can fall back to it too. \`undefined\` for a
|
|
507
507
|
// query and for a deferred dispatch, for the reasons given there.
|
|
508
|
-
origin: requestOrigin,${
|
|
508
|
+
origin: requestOrigin,${V}
|
|
509
509
|
scheduler,
|
|
510
510
|
span,
|
|
511
511
|
storage: contextStorage,
|
|
512
|
-
trace,${
|
|
512
|
+
trace,${W}${g}${B}${i}${E}${j}${k}${o}${u?`
|
|
513
513
|
[Symbol.for("lunora.admitSensitiveArgs")]: (args: Record<string, unknown>, names: ReadonlySet<string>): void => this.admitSensitiveValues(options.sensitive, args, names),`:""}
|
|
514
514
|
};
|
|
515
515
|
${T?` const isAction = contextKind === "action";
|
|
@@ -932,7 +932,7 @@ __COMMITTED_CATCH__ } finally {
|
|
|
932
932
|
// parked it, and there is nothing to park — an app with no scheduler has no
|
|
933
933
|
// \`ctx.scheduler\` call that reached the buffer in the first place.
|
|
934
934
|
protected override scheduleOutboxScheduler(): SchedulerLike | undefined {
|
|
935
|
-
__OUTBOX_SCHEDULER__ }`,
|
|
935
|
+
__OUTBOX_SCHEDULER__ }`,Mr=` protected override async executeSubscription(functionPath: string, args: Record<string, unknown>, identity?: SubscriptionIdentity): Promise<{ identityTracked?: boolean; ranges?: Map<string, KeyRange[]>; result: unknown; tables: Set<string> } | null> {
|
|
936
936
|
const registered = LUNORA_FUNCTIONS[functionPath];
|
|
937
937
|
|
|
938
938
|
if (!registered || registered.kind !== "query" || registered.visibility === "internal") {
|
|
@@ -945,9 +945,7 @@ __PREPARE_FUNCTION__ this.ensureServable();
|
|
|
945
945
|
// Identity is threaded EXPLICITLY from the (deferred/interleaved)
|
|
946
946
|
// subscription caller — never read from the shared per-request field
|
|
947
947
|
// here — so a concurrent RPC can't leak its identity into this re-run.
|
|
948
|
-
|
|
949
|
-
const result = await registered.handler(ctx, args);
|
|
950
|
-
|
|
948
|
+
__SUBSCRIPTION_RUN__
|
|
951
949
|
// Ranges come from THIS run's reads, never a shared field on the DO:
|
|
952
950
|
// a deferred re-run interleaves with unrelated dispatches.
|
|
953
951
|
const ranges = footprint.ranges();
|
|
@@ -980,7 +978,7 @@ __PREPARE_FUNCTION__ this.ensureServable();
|
|
|
980
978
|
return this.windowStreamReads(headroom, (registered.handler as (context: unknown, args: Record<string, unknown>, signal: AbortSignal) => AsyncIterable<unknown>)(this.buildCtx({ functionPath, headroom, identity }), args, signal));
|
|
981
979
|
},
|
|
982
980
|
};
|
|
983
|
-
}`,
|
|
981
|
+
}`,qr=` } catch (error) {
|
|
984
982
|
// The write committed before this failed. Mark the error so the caller can tell
|
|
985
983
|
// a durable write from a rollback: the rethrow still reaches the caller unchanged.
|
|
986
984
|
if (typeof error === "object" && error !== null) {
|
|
@@ -988,7 +986,7 @@ __PREPARE_FUNCTION__ this.ensureServable();
|
|
|
988
986
|
}
|
|
989
987
|
|
|
990
988
|
throw error;
|
|
991
|
-
`,
|
|
989
|
+
`,Ur=(r,t=!1,e=!1)=>{const o=t?` const registeredBeforeLoad = LUNORA_FUNCTIONS[functionPath];
|
|
992
990
|
|
|
993
991
|
if (registeredBeforeLoad?.visibility === "internal" && !this.isSystemDispatch()) {
|
|
994
992
|
throw new LunoraError("FUNCTION_NOT_FOUND", "function not registered: " + functionPath);
|
|
@@ -1008,7 +1006,21 @@ __PREPARE_FUNCTION__ this.ensureServable();
|
|
|
1008
1006
|
`:"",a=e?` const configured = config.scheduler?.((this.env ?? {}) as Record<string, unknown>) as SchedulerLike | undefined;
|
|
1009
1007
|
return configured === undefined ? undefined : withAgentScheduleShard(configured, LUNORA_AGENTS, this.currentShardKey());
|
|
1010
1008
|
`:` return config.scheduler?.((this.env ?? {}) as Record<string, unknown>) as SchedulerLike | undefined;
|
|
1011
|
-
`;return $r.replace("__COMMITTED_CATCH__",r?
|
|
1009
|
+
`;return $r.replace("__COMMITTED_CATCH__",r?qr:"").replace("__PREPARE_FUNCTION__",`${o}${n}`).replace("__OUTBOX_SCHEDULER__",a)},Fr=` const ctx = this.buildCtx({ functionPath, headroom: this.subscriptionHeadroom(functionPath, identity), identity, onRead: footprint.onRead, onReadRange: footprint.onReadRange });
|
|
1010
|
+
const result = await registered.handler(ctx, args);
|
|
1011
|
+
`,Br=` const sensitive = this.openSensitiveScope(functionPath, args);
|
|
1012
|
+
let result: unknown;
|
|
1013
|
+
|
|
1014
|
+
try {
|
|
1015
|
+
const ctx = this.buildCtx({ functionPath, headroom: this.subscriptionHeadroom(functionPath, identity), identity, onRead: footprint.onRead, onReadRange: footprint.onReadRange, sensitive });
|
|
1016
|
+
|
|
1017
|
+
result = await registered.handler(ctx, args);
|
|
1018
|
+
} catch (error) {
|
|
1019
|
+
throw this.maskSensitiveError(error, sensitive);
|
|
1020
|
+
} finally {
|
|
1021
|
+
sensitive.clear();
|
|
1022
|
+
}
|
|
1023
|
+
`,jr=r=>Mr.replace("__SUBSCRIPTION_RUN__",r?Br:Fr),Wr=r=>{const t={};for(const e of r.tables){const o={};for(const[n,a]of Object.entries(e.shape)){const i=U(a);i.kind==="id"&&i.tableName!==void 0&&(o[n]=i.tableName)}Object.keys(o).length>0&&(t[e.name]=o)}return t},Kr=r=>{const t={};for(const e of r.tables){const o=[];for(const[n,a]of Object.entries(e.shape))U(a).kind==="storage"&&o.push(n);o.length>0&&(t[e.name]=o)}return t},Hr=r=>{const t={};for(const e of r.tables){const o=[...e.indexes.map(n=>({fields:[...n.fields],name:n.name,type:"index",...n.unique===!0?{unique:!0}:{}})),...e.searchIndexes.map(n=>({fields:[n.field,...n.filterFields??[]],name:n.name,type:"search"})),...(e.geoIndexes??[]).map(n=>({fields:[n.field],name:n.name,type:"geo"})),...e.rankIndexes.map(n=>({fields:n.sortBy.map(a=>a.field),name:n.name,type:"rank"})),...e.vectorIndexes.map(n=>({fields:n.field===void 0?[]:[n.field],name:n.name,type:"vector"}))];o.length>0&&(t[e.name]=o)}return t},Vr=r=>{const t=[];for(const e of r.tables)!e.ttl||e.shardMode==="global"||t.push({...e.ttl.after===void 0?{}:{after:e.ttl.after},field:e.ttl.field,...e.softDelete?{softDeleteField:e.softDelete.field}:{},table:e.name});return t},Gr=r=>{if(r.kind!=="union"||r.members===void 0||r.members.length===0)return;const t=[];for(const e of r.members){if(e.kind!=="literal"||e.literalValue===void 0)return;try{const o=JSON.parse(e.literalValue);if(typeof o!="string")return;t.push(o)}catch{return}}return t},Qr=new Set(["bigint","boolean","date","number","timestamp"]),zr=r=>{const[t,e]=r.kind==="union"?r.members??[]:[];if(t===void 0||e===void 0||r.members?.length!==2)return;const o=a=>a.kind==="null"||a.kind==="literal"&&a.literalValue==="null",n=U(o(e)?t:e);return o(t)!==o(e)&&Qr.has(n.kind)?n:void 0},Jr=(r,t,e)=>{const o=U(t),n=zr(o),a=n??o,i={name:r,optional:Sr(t),type:a.kind};if(a.kind==="id"&&a.tableName!==void 0){i.ref=a.tableName;const c=e.get(r);c!==void 0&&(i.onDelete=c)}a.kind==="storage"&&(i.isStorage=!0,a.bucket!==void 0&&(i.bucket=a.bucket));const f=Gr(a);return f!==void 0&&(i.enumValues=f),(a.column?.notNull===!1||n!==void 0)&&(i.nullable=!0),i},Yr=r=>{const t={};for(const e of r.tables){const o=[{name:"_id",optional:!1,pk:!0,type:"id"},{name:"_creationTime",optional:!1,type:"number"},...e.commitOrdered===!0?[{name:"_commitSeq",optional:!1,type:"number"}]:[]],n=new Map(e.relations.flatMap(a=>a.kind==="one"?[[a.field,a.onDelete]]:[]));for(const[a,i]of Object.entries(e.shape))o.push(Jr(a,i,n));t[e.name]=o}return t},Xr=({hasMutators:r,hasSensitiveShapes:t,hasShapes:e,rlsData:o})=>{const n="{ columns?: readonly string[]; effectiveWhere?: WhereInput; global?: boolean; table: string } | undefined",a=t?` protected override resolveShape(name: string, args: Record<string, unknown>, identity?: SubscriptionIdentity): ${n} {
|
|
1012
1024
|
const sensitive = this.openSensitiveScope(\`__shape__:\${name}\`, args);
|
|
1013
1025
|
|
|
1014
1026
|
try {
|
|
@@ -1090,7 +1102,7 @@ assertShapesDeclareReadPolicies(LUNORA_SHAPES, ${JSON.stringify(c)}, (schema as
|
|
|
1090
1102
|
protected override isCustomMutator(functionPath: string): boolean {
|
|
1091
1103
|
return LUNORA_MUTATOR_PATHS.has(functionPath);
|
|
1092
1104
|
}
|
|
1093
|
-
`:"",shapeGuardImport:e?"assertShapeShardable, ":"",shapeReadPolicyAssertion:g,shapeReadPolicyImport:g===""?"":"assertShapesDeclareReadPolicies, ",shapeResolveOverride:f}},
|
|
1105
|
+
`:"",shapeGuardImport:e?"assertShapeShardable, ":"",shapeReadPolicyAssertion:g,shapeReadPolicyImport:g===""?"":"assertShapesDeclareReadPolicies, ",shapeResolveOverride:f}},Zr=(r,t)=>r?`
|
|
1094
1106
|
protected override async readGlobalShapeRows(resolved: { columns?: readonly string[]; effectiveWhere?: WhereInput; global?: boolean; table: string }, identity?: SubscriptionIdentity): Promise<Array<{ doc: Record<string, unknown>; id: string }>> {
|
|
1095
1107
|
const env = this.env as Record<string, unknown>;
|
|
1096
1108
|
// A shape read performs no writes, so the widened request only needs
|
|
@@ -1156,7 +1168,7 @@ assertShapesDeclareReadPolicies(LUNORA_SHAPES, ${JSON.stringify(c)}, (schema as
|
|
|
1156
1168
|
|
|
1157
1169
|
return globalDb.cdcChangedTables?.(sinceSeq, cursorOnly === undefined ? {} : { cursorOnly });
|
|
1158
1170
|
}
|
|
1159
|
-
`:"",
|
|
1171
|
+
`:"",en=r=>({externalSourceOverride:r?`
|
|
1160
1172
|
protected override async pollExternalSources(trace?: TraceRefLike): Promise<number | undefined> {
|
|
1161
1173
|
const env = (this.env ?? {}) as Record<string, unknown>;
|
|
1162
1174
|
const sourced = Object.entries((schema as unknown as SchemaLike).tables)
|
|
@@ -1313,7 +1325,7 @@ assertShapesDeclareReadPolicies(LUNORA_SHAPES, ${JSON.stringify(c)}, (schema as
|
|
|
1313
1325
|
`:"",sourceClientCacheConst:r?`
|
|
1314
1326
|
const sourceClientCache = new WeakMap<object, Map<string, SourceClientLike>>();
|
|
1315
1327
|
const sourcePollAtCache = new WeakMap<object, Map<string, number>>();
|
|
1316
|
-
`:""}),
|
|
1328
|
+
`:""}),tn=(r,t)=>{const e=t.length>0,n=r?q("vectorsStub: VectorSearchLike","ctx.vectors: no vectors configured. Pass `vectors` to createShardDO().",["deleteByIds","getByIds","query","upsert","upsertMany","upsertNow"]):"",a=e?` const vectorShardKey = this.currentShardKey();
|
|
1317
1329
|
`:"",i=e?"namespace: vectorShardKey === ROOT_SHARD_NAME ? undefined : vectorShardKey, ":"",c=`, { ${["deferAfterCommit: (work) => this.deferAfterCommit(work)",...e?["namespace: vectorShardKey === ROOT_SHARD_NAME ? undefined : vectorShardKey",`shardedIndexNames: [${t.map(w=>JSON.stringify(w)).join(", ")}]`]:[]].join(", ")} }`,g=r?`
|
|
1318
1330
|
const vectorSync = this.vectorSync(env);
|
|
1319
1331
|
// Vectorize lives outside this shard's SQLite, so a query whose result
|
|
@@ -1357,14 +1369,14 @@ ${a} const vectors = createContextVectors(lunora${c});
|
|
|
1357
1369
|
ordered: async (read, work) => this.runOrderedAfterWrites(read, work),
|
|
1358
1370
|
});
|
|
1359
1371
|
}
|
|
1360
|
-
`:"",vectorsBuild:g,vectorsStub:n}},
|
|
1372
|
+
`:"",vectorsBuild:g,vectorsStub:n}},vn=({advisories:r=[],agents:t=[],capabilities:e=new Set,containers:o=[],env:n,flagKeys:a=[],hasFlags:i=!1,hasNotify:f=!1,hasRooms:c=!1,hasSecretValues:g=!1,hasSensitiveArgs:A=!1,hasSockets:w=!1,lazyFunctions:u=!1,hasVectors:l=!0,liveStreamDeclarations:O=[],liveStreams:v=!1,maskMetadata:F,mutators:B=[],queues:R=[],rlsMetadata:j,schema:d,schemaSnapshot:k,shapes:I=[],storageRules:W,studioFeatures:K,hasIpReaders:E=!1,services:T=[],topics:H=[],useUmbrella:V=!1,workflowEvents:C=[],workflows:x=[]})=>{const h=_r(V),G=B.length>0,p=I.length>0,L=I.some(s=>Rr(s.args).length>0),P=A||L,ge=k===void 0?"":Zt(k),be=k===void 0?"":`
|
|
1361
1373
|
/** 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. */
|
|
1362
1374
|
const LUNORA_SCHEMA_SNAPSHOT: { hash: string; json: string } = { hash: ${JSON.stringify(er(k))}, json: ${JSON.stringify(ge)} };
|
|
1363
|
-
`,ye=k===void 0?"":", schemaSnapshot: LUNORA_SCHEMA_SNAPSHOT",S=ar(e),
|
|
1364
|
-
return { ${
|
|
1375
|
+
`,ye=k===void 0?"":", schemaSnapshot: LUNORA_SCHEMA_SNAPSHOT",S=ar(e),N=sr(i,h.flags),Q=or(a,i,h.flags),z=kr(f),J=ir(n),{build:we,contextField:ve,importLines:ke,specs:Se}=dr(Dr(R)),{build:Re,contextField:xe,importLines:Ae,specs:Oe}=cr(H,R),Y=lr(T,h.server),{build:Te,contextField:_e,importLines:De,specs:Ie}=ur(o,d.jurisdiction),{build:Ee,contextField:Ce,importLines:Le,specs:Pe}=hr(x),{build:Ne,contextField:$e,importLines:Me,schedulerSource:qe,specs:Ue,stampsOutbox:Fe}=pr(t,g&&t.length>0),{build:Be,configField:je,contextField:We,imports:Ke,stub:He}=mr(e.has("payments")),Ve=r,{advisoryRules:Ge,advisoryRows:Qe}=Er(Ve),ne=j??{policies:[],roles:[]},ze=F??{columns:[]},Je=W??{rules:[]},Ye=K??{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:Xe,override:Ze}=fr(x,C),{constant:et,override:tt}=gr(x,C),{constant:rt,override:nt}=br(R),b=l&&d.vectorIndexes.length>0,X=new Set(d.tables.filter(s=>Ir(s)).map(s=>s.name)),ae=b&&d.vectorIndexes.some(s=>X.has(s.table)),_=d.tables.some(s=>s.shardMode==="global"),Z=yr(X),ee=d.tables.some(s=>tr(s)),se=d.tables.some(s=>rr(s)),$=d.tables.some(s=>s.externalSource!==void 0),oe=d.tables.some(s=>s.memory===!0),te=d.tables.some(s=>s.shardMode!=="global"&&s.searchIndexes.length>0);if(se&&ee)throw new pe("INTERNAL",'lunora codegen: mixing `.global()` (D1) and `.global({ backend: "hyperdrive" })` tables in one app is not supported yet — use a single global backend.');const re=d.tables.length>0,at=Wr(d),st=Hr(d),ot=Yr(d),it=Kr(d),ie=Vr(d),de=wr(b,x.length>0,R.length>0,i,te);p&&de.push("WhereInput");const ce=vr(_),{customMutatorOverride:dt,shapeGuardImport:ct,shapeReadPolicyAssertion:lt,shapeReadPolicyImport:ut,shapeResolveOverride:ht}=Xr({hasMutators:G,hasSensitiveShapes:L,hasShapes:p,rlsData:ne}),D=v?O:[];for(const s of D)if(xr(s.exportName,"live stream export name"),!Ar.test(s.filePath))throw new pe("INTERNAL",`@lunora/codegen: refusing to emit import for unsafe live stream file path: ${JSON.stringify(s.filePath)}`);const pt=u?[]:D.map(s=>`import { ${s.exportName} as liveStream_${s.exportName} } from "../${s.filePath}.js";`),mt=` protected override liveStreams() {
|
|
1376
|
+
return { ${D.map(s=>`${Or(s.id)}: liveStream_${s.exportName}`).join(", ")} };
|
|
1365
1377
|
}
|
|
1366
1378
|
`,ft=` private readonly liveStreamLoaders = new Map<string, () => Promise<{ validatePublish: (topic: string, payload: unknown) => unknown }>>([
|
|
1367
|
-
${
|
|
1379
|
+
${D.map(s=>` [${JSON.stringify(s.id)}, () => import("../${s.filePath}.js").then((module) => module.${s.exportName})],`).join(`
|
|
1368
1380
|
`)}
|
|
1369
1381
|
]);
|
|
1370
1382
|
|
|
@@ -1385,11 +1397,11 @@ ${_.map(s=>` [${JSON.stringify(s.id)}, () => import("../${s.filePath}
|
|
|
1385
1397
|
protected override liveStreams() {
|
|
1386
1398
|
return Object.fromEntries(this.loadedLiveStreams);
|
|
1387
1399
|
}
|
|
1388
|
-
`;let le="";
|
|
1400
|
+
`;let le="";D.length>0&&(le=u?ft:mt);const M=[`import type { ${de.join(", ")} } from "${h.do}";`,`import { applyCdcChanges, createStableIdFactory, createStableRandomFactory, ${te?"backfillSearchIndexes, ":""}${b?"backfillVectorIndexes, ":""}buildReprojectionMigration, ${oe?"clearMemoryTables, ":""}${ct}createReadFootprint, createShardCtxDb, exportShardRows, importShardRows, ${$?"isSourceDue, pullExternalSourceIncrementalTick, pullExternalSourceTick, ":""}markUnvouchableReads, ${ae?"ROOT_SHARD_NAME, ":""}runDataMigration, runShardMigrations, ${ce.importFragment}ShardDO as ShardDOBase } from "${h.do}";`,...$?[`import type { ExternalSourceLike, SourceClientLike, TraceRefLike } from "${h.do}";`]:[],p?`import { asBucketStorage, ${ut}beginDeferredDeletes, beginDeferredSchedules, composeShapeReadWhere, createSecrets, flushDeferredDeletes, LunoraError, withDeferredDeletes, withDeferredSchedules } from "${h.server}";`:`import { asBucketStorage, beginDeferredDeletes, beginDeferredSchedules, createSecrets, flushDeferredDeletes, LunoraError, withDeferredDeletes, withDeferredSchedules } from "${h.server}";`];re&&M.push(`import type { FacadeEntry } from "${h.server}";`,`import { bindOrm, defineLazyFacade } from "${h.server}";`),b&&M.push('import type { SchemaLike as VectorSchemaLike, VectorBackfillSync, VectorizeIndexLike, VectorSearchLike } from "@lunora/bindings/vectors";','import { createContextVectors, createVectorBackfillSync, createVectors, createVectorSyncHook, vectorBackfillTargets } from "@lunora/bindings/vectors";'),M.push(...S.importLines,...N.importLines,...z.importLines,...J.importLines,...De,...Le,...ke,...Ae,...Y.importLines,...Me,...Ke,...P?[`import { sensitiveArgumentNames } from "${h.values}";`]:[],"",'import schema from "../schema.js";',...pt,`import { ${["LUNORA_FUNCTIONS","LUNORA_LIFECYCLE_HOOKS","LUNORA_MIGRATIONS",...u?["getLoadedFunction","loadFunction"]:[],...G?["LUNORA_MUTATOR_PATHS"]:[],...E?["LUNORA_IP_READER_PATHS"]:[],...c?["LUNORA_ROOMS"]:[],...w?["LUNORA_SOCKETS"]:[],...p?["LUNORA_SHAPES"]:[]].join(", ")} } from "./functions.js";`);const gt=b?`
|
|
1389
1401
|
vectors?: (env: Record<string, unknown>) => Record<string, VectorizeIndexLike>;`:"",bt=se?`
|
|
1390
1402
|
d1?: (env: Record<string, unknown>, request?: { bookmark?: string; cdc?: boolean; cdcRetentionMs?: number; identity?: Record<string, unknown> | undefined; onBookmark?: (bookmark: string | undefined) => void; userId?: string | undefined }) => DatabaseWriterLike | undefined;`:"",yt=ee?`
|
|
1391
|
-
hyperdriveGlobal?: (env: Record<string, unknown>, request?: { cdc?: boolean; cdcRetentionMs?: number; identity?: Record<string, unknown> | undefined; userId?: string | undefined }) => DatabaseWriterLike | undefined;`:"",wt
|
|
1392
|
-
sourceClient?: (env: Record<string, unknown>, binding: string) => { query: <Row = Record<string, unknown>>(text: string, params?: readonly unknown[]) => Promise<Row[]> } | undefined;`:"",vt="ctx.db.<globalTable>: no global backend configured. Pass `d1` or `hyperdriveGlobal` to createShardDO().",kt="ctx.scheduler: no scheduler configured. Pass `scheduler` to createShardDO().",St="ctx.storage: no storage configured. Pass `storage` to createShardDO().",Rt=
|
|
1403
|
+
hyperdriveGlobal?: (env: Record<string, unknown>, request?: { cdc?: boolean; cdcRetentionMs?: number; identity?: Record<string, unknown> | undefined; userId?: string | undefined }) => DatabaseWriterLike | undefined;`:"",wt=$?`
|
|
1404
|
+
sourceClient?: (env: Record<string, unknown>, binding: string) => { query: <Row = Record<string, unknown>>(text: string, params?: readonly unknown[]) => Promise<Row[]> } | undefined;`:"",vt="ctx.db.<globalTable>: no global backend configured. Pass `d1` or `hyperdriveGlobal` to createShardDO().",kt="ctx.scheduler: no scheduler configured. Pass `scheduler` to createShardDO().",St="ctx.storage: no storage configured. Pass `storage` to createShardDO().",Rt=_?q("globalDbStub: DatabaseWriterLike",vt,["aggregate","count","delete","explain","findFirst","findFirstOrThrow","findMany","get","groupBy","insert","normalizeId","patch","query","rank","rankPage","replace"],{sync:["normalizeId","query"]}):"",{vectorSyncMethod:xt,vectorsBuild:At,vectorsStub:Ot}=tn(b,ae?d.vectorIndexes.filter(s=>X.has(s.table)).map(s=>s.name):[]),Tt=`{
|
|
1393
1405
|
...this.ctxDbTuning(),
|
|
1394
1406
|
auth: {
|
|
1395
1407
|
get identity() {
|
|
@@ -1448,11 +1460,11 @@ ${_.map(s=>` [${JSON.stringify(s.id)}, () => import("../${s.filePath}
|
|
|
1448
1460
|
scheduler,
|
|
1449
1461
|
schema: schema as unknown as SchemaLike,
|
|
1450
1462
|
sql: this.sql as SqlExec,
|
|
1451
|
-
storage,${
|
|
1463
|
+
storage,${_?`
|
|
1452
1464
|
globalDb,`:""}
|
|
1453
|
-
}`,
|
|
1454
|
-
vectors,`:"",
|
|
1455
|
-
orm: bindOrm(facade),`:"",ue=ee?"config.hyperdriveGlobal":"config.d1",It=
|
|
1465
|
+
}`,_t=b?`
|
|
1466
|
+
vectors,`:"",Dt=re?`
|
|
1467
|
+
orm: bindOrm(facade),`:"",ue=ee?"config.hyperdriveGlobal":"config.d1",It=_?` const bookmark = this.getInboundBookmark();
|
|
1456
1468
|
const globalRequest = {
|
|
1457
1469
|
...this.globalCdcOptions(config.cdc ?? false),
|
|
1458
1470
|
...(bookmark === undefined ? {} : { bookmark }),
|
|
@@ -1465,14 +1477,14 @@ ${_.map(s=>` [${JSON.stringify(s.id)}, () => import("../${s.filePath}
|
|
|
1465
1477
|
},
|
|
1466
1478
|
};
|
|
1467
1479
|
const globalDb: DatabaseWriterLike = ${ue}?.(env, globalRequest) ?? globalDbStub;
|
|
1468
|
-
`:"",Et=
|
|
1480
|
+
`:"",Et=Zr(p&&_,ue),Ct=c?` protected override roomHandlerPath(topic: string): string | undefined {
|
|
1469
1481
|
// Own properties only: a plain object would resolve \`toString\` and the like to inherited functions.
|
|
1470
1482
|
return Object.hasOwn(LUNORA_ROOMS, topic) ? LUNORA_ROOMS[topic] : undefined;
|
|
1471
1483
|
}
|
|
1472
1484
|
`:"",Lt=w?` protected override socketRoute(path: string): { auth: boolean; functionPath: string } | undefined {
|
|
1473
1485
|
return LUNORA_SOCKETS[path];
|
|
1474
1486
|
}
|
|
1475
|
-
`:"",{externalSourceOverride:Pt,sourceBootstrap:Nt,sourceClientCacheConst:$t}=
|
|
1487
|
+
`:"",{externalSourceOverride:Pt,sourceBootstrap:Nt,sourceClientCacheConst:$t}=en($),Mt=`
|
|
1476
1488
|
private shardInitDeferred = false;
|
|
1477
1489
|
private deferredShardInit?: Promise<void>;
|
|
1478
1490
|
|
|
@@ -1518,11 +1530,11 @@ ${oe?` clearMemoryTables(this.sql as SqlExec, schema as unknown as Sc
|
|
|
1518
1530
|
|
|
1519
1531
|
await this.deferredShardInit;
|
|
1520
1532
|
}
|
|
1521
|
-
`,
|
|
1533
|
+
`,qt=ie.length>0?`
|
|
1522
1534
|
if (LUNORA_TTL_SWEEPS.length > 0) {
|
|
1523
1535
|
void this.scheduleTtlSweep();
|
|
1524
1536
|
}
|
|
1525
|
-
`:"",
|
|
1537
|
+
`:"",Ut=`
|
|
1526
1538
|
public constructor(state: ShardDOState, env: unknown) {
|
|
1527
1539
|
super(state, env, {
|
|
1528
1540
|
// Every writer this file builds spreads the ctxDbTuning() slice —
|
|
@@ -1542,7 +1554,7 @@ ${oe?` clearMemoryTables(this.sql as SqlExec, schema as unknown as Sc
|
|
|
1542
1554
|
${E?` for (const path of LUNORA_IP_READER_PATHS) {
|
|
1543
1555
|
this.ipKeyedFunctionPaths.add(path);
|
|
1544
1556
|
}
|
|
1545
|
-
`:""}${Nt}${
|
|
1557
|
+
`:""}${Nt}${qt} }
|
|
1546
1558
|
|
|
1547
1559
|
protected override isCacheableQuery(functionPath: string): boolean {
|
|
1548
1560
|
// NOT \`kind === "query"\` alone. A cache hit answers without running
|
|
@@ -1581,10 +1593,10 @@ ${E?` for (const path of LUNORA_IP_READER_PATHS) {
|
|
|
1581
1593
|
|
|
1582
1594
|
return this.holdShardWhileLoading(() => loadFunction(functionPath));
|
|
1583
1595
|
}
|
|
1584
|
-
`:"",
|
|
1596
|
+
`:"",Ft=he===""?`
|
|
1585
1597
|
|
|
1586
1598
|
`:`${he}
|
|
1587
|
-
`,Bt=
|
|
1599
|
+
`,Bt=P?`
|
|
1588
1600
|
protected override sensitiveArgNames(functionPath: string): ReadonlySet<string> {
|
|
1589
1601
|
const registered = LUNORA_FUNCTIONS[functionPath];${L?`
|
|
1590
1602
|
const shape = functionPath.startsWith("__shape__:") ? LUNORA_SHAPES[functionPath.slice("__shape__:".length)] : undefined;`:""}
|
|
@@ -1599,20 +1611,20 @@ ${E?` for (const path of LUNORA_IP_READER_PATHS) {
|
|
|
1599
1611
|
|
|
1600
1612
|
`:"",jt=Nr(u),Wt=u?` const preparation = this.prepareFunction(functionPath, "subscription");
|
|
1601
1613
|
if (preparation !== undefined) await preparation;
|
|
1602
|
-
`:"",Kt=
|
|
1614
|
+
`:"",Kt=jr(P).replace("__PREPARE_FUNCTION__",Wt),Ht=Ur(c,u,Fe),Vt=re?`
|
|
1603
1615
|
const facade = db as unknown as Record<string, FacadeEntry>;
|
|
1604
1616
|
${d.tables.map(s=>` defineLazyFacade(db, ${JSON.stringify(s.name)});`).join(`
|
|
1605
1617
|
`)}
|
|
1606
|
-
`:"",Gt=`${S.everyBuild}${
|
|
1618
|
+
`:"",Gt=`${S.everyBuild}${N.build}${J.build}
|
|
1607
1619
|
const secrets = createSecrets(env);
|
|
1608
|
-
`,Qt=`${S.everyFields}${
|
|
1620
|
+
`,Qt=`${S.everyFields}${N.contextField}${z.contextField}${J.contextField}
|
|
1609
1621
|
secrets,`,zt=z.build,Jt=v?`
|
|
1610
1622
|
const live = {
|
|
1611
1623
|
publish: async (ref: { __lunoraLive: string; topic: string }, payload: unknown, publishOptions?: { shardKey?: string }): Promise<void> => {
|
|
1612
1624
|
await this.publishLiveFromAction(ref.topic, payload, { ...publishOptions, stream: ref.__lunoraLive });
|
|
1613
1625
|
},
|
|
1614
1626
|
};
|
|
1615
|
-
`:"",Yt=[...S.actionFields,...T.length>0?["services"]:[],...v?["live"]:[]],Xt=`${S.actionBuild}${Y.build}${Jt}`;return`${Tr}${
|
|
1627
|
+
`:"",Yt=[...S.actionFields,...T.length>0?["services"]:[],...v?["live"]:[]],Xt=`${S.actionBuild}${Y.build}${Jt}`;return`${Tr}${M.join(`
|
|
1616
1628
|
`)}
|
|
1617
1629
|
|
|
1618
1630
|
type FunctionKind = "action" | "mutation" | "query";
|
|
@@ -1675,7 +1687,7 @@ const LUNORA_STUDIO_FEATURES = ${m(Ye,"StudioFeaturesResult")};
|
|
|
1675
1687
|
|
|
1676
1688
|
/** How long a shard with a UNIQUE index blocked by duplicate rows serves the cached diagnostic before re-attempting the build. */
|
|
1677
1689
|
const BLOCKED_MIGRATION_RETRY_MS = 5000;
|
|
1678
|
-
${be}${Z.constant}${Q.constant}${Xe}${et}${rt}${Ie}${Pe}${Se}${Oe}${Y.specs}${
|
|
1690
|
+
${be}${Z.constant}${Q.constant}${Xe}${et}${rt}${Ie}${Pe}${Se}${Oe}${Y.specs}${Ue}
|
|
1679
1691
|
export interface ShardDOConfig {
|
|
1680
1692
|
/** Opt into change-data-capture: records a post-image to \`__cdc_log\` on every write (backs streaming export + replay-PITR). */
|
|
1681
1693
|
cdc?: boolean;
|
|
@@ -1692,7 +1704,7 @@ export interface ShardDOConfig {
|
|
|
1692
1704
|
/** \`unknown\` because \`@lunora/scheduler\`'s \`Scheduler\` is not assignable to \`SchedulerLike\`; the shard casts it. */
|
|
1693
1705
|
scheduler?: (env: Record<string, unknown>) => unknown;
|
|
1694
1706
|
/** \`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. */
|
|
1695
|
-
storage?: (env: Record<string, unknown>, origin?: string) => unknown;${gt}${S.configFields}${
|
|
1707
|
+
storage?: (env: Record<string, unknown>, origin?: string) => unknown;${gt}${S.configFields}${N.configField}${je}${bt}${yt}${wt}${Z.configField}
|
|
1696
1708
|
}
|
|
1697
1709
|
${q("schedulerStub",kt,["cancel","runAfter","runAt"])}${q("storageStub",St,["createMultipartUpload","delete","download","generateUploadUrl","getMetadata","getPresignedUrl","getSignedUrl","getUrl","head","list","resumeMultipartUpload","store","upload"],{sync:["getUrl","resumeMultipartUpload"]})}${Rt}${$t}${Ot}${S.stubs}${He}
|
|
1698
1710
|
// \`ctx.fetch\` is action-only. A query is re-run by every live subscription and a
|
|
@@ -1713,17 +1725,17 @@ ${jt}
|
|
|
1713
1725
|
* from the worker entry so wrangler binds it by name.
|
|
1714
1726
|
*/
|
|
1715
1727
|
export const createShardDO = (config: ShardDOConfig = {}): new (state: ShardDOState, env: unknown) => ShardDOBase =>
|
|
1716
|
-
class extends ShardDOBase {${
|
|
1728
|
+
class extends ShardDOBase {${Ut}
|
|
1717
1729
|
private blockedUniqueIndexes: readonly string[] = [];
|
|
1718
1730
|
private migrated = false;
|
|
1719
|
-
private migrationRetryAt = 0;${
|
|
1731
|
+
private migrationRetryAt = 0;${Ft}${Bt}${Ht}
|
|
1720
1732
|
${ce.override}
|
|
1721
1733
|
${Kt}
|
|
1722
1734
|
${dt}${ht}${Et}${Pt}
|
|
1723
1735
|
protected override lifecycleHookPaths(event: "connect" | "disconnect" | "init" | "reactor" | "whisper"): readonly string[] {
|
|
1724
1736
|
return LUNORA_LIFECYCLE_HOOKS[event];
|
|
1725
1737
|
}
|
|
1726
|
-
${Ct}${Lt}${le}${Z.override}${
|
|
1738
|
+
${Ct}${Lt}${le}${Z.override}${Mt}
|
|
1727
1739
|
// One \`onQueryChange\` dispatch. Mirrors \`executeSubscription\` — the
|
|
1728
1740
|
// socket-terminated half of the same reactivity — and differs only in who
|
|
1729
1741
|
// consumes the result: the base's \`dispatchReactors\` stores the digest as
|
|
@@ -1880,6 +1892,6 @@ ${te?`
|
|
|
1880
1892
|
return backfillSearchIndexes(this.sql as SqlExec, schema as unknown as SchemaLike, options);
|
|
1881
1893
|
}
|
|
1882
1894
|
`:""}${xt}
|
|
1883
|
-
${Pr({hasSensitiveArgs:
|
|
1895
|
+
${Pr({hasSensitiveArgs:P,lazyFunctions:u,actionOnlyFields:Yt,agentsBuild:Ne,agentsContextField:$e,agentsSchedulerSource:qe,containersBuild:Te,containersContextField:_e,databaseOptions:Tt,everyContextBuild:Gt,everyContextField:Qt,facadeBlock:Vt,globalDatabaseLine:It,notifyBuild:zt,ormContextField:Dt,paymentsBuild:Be,paymentsContextField:We,queuesBuild:we,queuesContextField:ve,topicsBuild:Re,topicsContextField:xe,vectorsBuild:At,vectorsContextField:_t,workflowsBuild:Ee,workflowsContextField:Ce,actionOnlyBuild:Xt})}
|
|
1884
1896
|
};
|
|
1885
|
-
`};export{
|
|
1897
|
+
`};export{Kr as b,vn as e};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{LunoraError as R}from"@lunora/errors";import{r as $}from"./json-data-Chfs2Cz5.mjs";import{CAPABILITIES as S}from"./CAPABILITY_PROBES-BuNEmlCO.mjs";import{a as l,G as f,I as w}from"./shared-
|
|
1
|
+
import{LunoraError as R}from"@lunora/errors";import{r as $}from"./json-data-Chfs2Cz5.mjs";import{CAPABILITIES as S}from"./CAPABILITY_PROBES-BuNEmlCO.mjs";import{a as l,G as f,I as w}from"./shared-Cn7dMQ_u.mjs";import{s as L}from"./platform-8oj7iXQy.mjs";const M=e=>e?{importFragment:"serveRelationFanout, ",override:`
|
|
2
2
|
protected override async runRelationFanoutRead(functionPath: string, args: Record<string, unknown>): Promise<unknown> {
|
|
3
3
|
this.ensureServable();
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{LunoraError as $}from"@lunora/errors";import{v as _}from"./parse-validator-BisfC8bR.mjs";import{R as k}from"./reserved-words-CW1QFbTd.mjs";import{acceptsAbsentIr as I}from"./LUNORA_ERROR_CODES-
|
|
1
|
+
import{LunoraError as $}from"@lunora/errors";import{v as _}from"./parse-validator-BisfC8bR.mjs";import{R as k}from"./reserved-words-CW1QFbTd.mjs";import{acceptsAbsentIr as I}from"./LUNORA_ERROR_CODES-D7AVT7qF.mjs";import{n as E}from"./dispatch-namespace-DwTjD7BU.mjs";const R=/^(?:"(?:[^"\\]|\\(?:["\\/bfnrt]|u[0-9A-Fa-f]{4}))*"|'[^'\\]*'|-?\d+(?:\.\d+)?|true|false|null)$/u,O=e=>Object.keys(e).filter(n=>_(e[n])),B=e=>e.typeDerivedArgs===!0&&Object.keys(e.args).length>0||O(e.args).length>0,F=`// GENERATED by @lunora/codegen — do not edit.
|
|
2
2
|
// Run \`lunora codegen\` to regenerate.
|
|
3
3
|
|
|
4
4
|
`,G=(e=!1)=>e?{client:"lunorash/client",do:"lunorash/do",flags:"lunorash/flags",server:"lunorash/server",serverDataModel:"lunorash/server/data-model",serverDrizzle:"lunorash/server/drizzle",serverTypes:"lunorash/server/types",values:"lunorash/values"}:{client:"@lunora/client",do:"@lunora/do",flags:"@lunora/flags",server:"@lunora/server",serverDataModel:"@lunora/server/data-model",serverDrizzle:"@lunora/server/drizzle",serverTypes:"@lunora/server/types",values:"@lunora/values"},b=/^[A-Za-z_$][\w$]*$/u,U=/^[\w./-]+$/u,w=(e,n)=>{if(!b.test(e)||k.has(e))throw new $("INTERNAL",`@lunora/codegen: ${n} is not a valid JS identifier: ${JSON.stringify(e)}`)},V=(e,n)=>{if(!b.test(e))throw new $("INTERNAL",`@lunora/codegen: ${n} is not a valid JS identifier: ${JSON.stringify(e)}`)},H=e=>e.charAt(0).toUpperCase()+e.slice(1),g=e=>b.test(e)?e:JSON.stringify(e),j=e=>e==="__proto__"?`[${JSON.stringify(e)}]`:g(e),D=e=>{const n=new Map;for(const r of e){const t=n.get(r.filePath)??[];t.push(r),n.set(r.filePath,t)}return[...n.entries()].toSorted(([r],[t])=>r.localeCompare(t))},Y=(e,n,r)=>{const[t,l]=r==="type"?[g,";"]:[j,","],h={children:new Map};for(const[o,d]of D(e)){let a=h;for(const m of E(o)){let c=a.children.get(m);c===void 0&&(c={children:new Map},a.children.set(m,c)),a=c}a.file={entries:d,path:o}}const u=o=>o.file?.path??u(o.children.values().next().value),p=(o,d)=>{const a=" ".repeat(d),{entries:m=[],path:c=""}=o.file??{},y=m.find(s=>o.children.has(s.exportName));if(y!==void 0){const s=u(o.children.get(y.exportName));throw new $("NAMESPACE_COLLISION",`Namespace collision: the export "${y.exportName}" of "${c}" and "${s}" both resolve to api.${[...E(c),y.exportName].join(".")}. Rename the export or the folder.`)}const A=m.toSorted((s,f)=>s.exportName.localeCompare(f.exportName)).map(s=>`${a}${n(s)}`),S=[...o.children.entries()].toSorted(([s],[f])=>s.localeCompare(f)).map(([s,f])=>`${a}${t(s)}: {
|