@lunora/codegen 1.0.0-alpha.357 → 1.0.0-alpha.358
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/{AGENTS_FILENAME-isdHqPIt.mjs → AGENTS_FILENAME-MkkvnsUE.mjs} +1 -1
- package/dist/packem_shared/CONTAINERS_FILENAME-bE-y0B87.mjs +1 -0
- package/dist/packem_shared/{FLAGS_FILENAME-BQk3SX8D.mjs → FLAGS_FILENAME-_nmXVMje.mjs} +1 -1
- package/dist/packem_shared/{MUTATORS_FILENAME-qrKFa1I1.mjs → MUTATORS_FILENAME-Y5_Dxk1E.mjs} +1 -1
- package/dist/packem_shared/{NOTIFY_FILENAME-Dj7fObvj.mjs → NOTIFY_FILENAME-BXAiPzbD.mjs} +1 -1
- package/dist/packem_shared/{OPENRPC_VERSION-CoJWSPHr.mjs → OPENRPC_VERSION-TX2C_rJT.mjs} +1 -1
- package/dist/packem_shared/{QUEUES_FILENAME-Civ-7SiI.mjs → QUEUES_FILENAME-DEW3hmFm.mjs} +1 -1
- package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-Z18YPqk_.mjs +31 -0
- package/dist/packem_shared/{SHAPES_FILENAME-CFpyCOh2.mjs → SHAPES_FILENAME-B40f_T6B.mjs} +1 -1
- package/dist/packem_shared/{WORKFLOWS_FILENAME-kXq07aGl.mjs → WORKFLOWS_FILENAME-WZhRFaoW.mjs} +1 -1
- package/dist/packem_shared/attribution-ILDWgo1x.mjs +1 -0
- package/dist/packem_shared/{buildOpenApiDocument-ecVsBXVh.mjs → buildOpenApiDocument-20bRusvI.mjs} +1 -1
- package/dist/packem_shared/capabilitiesUsedBy-CIms8agu.mjs +1 -0
- package/dist/packem_shared/chain-COp_5hZ4.mjs +1 -0
- package/dist/packem_shared/{classify-procedure-call-BkaeM9Ej.mjs → classify-procedure-call-CGyiEHy1.mjs} +1 -1
- package/dist/packem_shared/{context-property-calls-FpBfosw3.mjs → context-property-calls-Bj3YOlL1.mjs} +1 -1
- package/dist/packem_shared/{context-root-BAeDnkKU.mjs → context-root-ChKZ81ma.mjs} +1 -1
- package/dist/packem_shared/{createCodegenProject-ClPr_MXM.mjs → createCodegenProject-BinzLGxq.mjs} +1 -1
- package/dist/packem_shared/{database-calls-Dohiwd-7.mjs → database-calls-BklD-ffT.mjs} +1 -1
- package/dist/packem_shared/{discoverAuthApiCalls-CScPrUD-.mjs → discoverAuthApiCalls-cxNhFbVB.mjs} +1 -1
- package/dist/packem_shared/{discoverCrons-B1_NUt19.mjs → discoverCrons-C5MhFDni.mjs} +1 -1
- package/dist/packem_shared/{discoverFunctions-C_Y8PWMi.mjs → discoverFunctions-BCsT7GQS.mjs} +1 -1
- package/dist/packem_shared/{discoverHttpRoutes-D_b2SrdD.mjs → discoverHttpRoutes-DwbVREYV.mjs} +1 -1
- package/dist/packem_shared/discoverHyperdriveCalls-Ca9U-rY9.mjs +1 -0
- package/dist/packem_shared/{discoverInserts-C9DSRPCl.mjs → discoverInserts-6cgh3ZTP.mjs} +1 -1
- package/dist/packem_shared/discoverMaskProcedures-B5jXqwvB.mjs +1 -0
- package/dist/packem_shared/{discoverMigrations-BWxx8Wv9.mjs → discoverMigrations-PQUwbVwP.mjs} +1 -1
- package/dist/packem_shared/{discoverNondeterministicCalls-mFJNU8qY.mjs → discoverNondeterministicCalls-Br_sPo8Z.mjs} +1 -1
- package/dist/packem_shared/{discoverQueries-BOuUa0Nl.mjs → discoverQueries-BJCIpowp.mjs} +1 -1
- package/dist/packem_shared/discoverR2sqlCalls-D2OK5ZWP.mjs +1 -0
- package/dist/packem_shared/{discoverRlsMetadata-D0B4nCmG.mjs → discoverRlsMetadata-DmzmJtoo.mjs} +1 -1
- package/dist/packem_shared/{discoverRlsProcedures-Dnl0WCtW.mjs → discoverRlsProcedures-DEwd3N-e.mjs} +1 -1
- package/dist/packem_shared/{discoverSandboxUsage--Z1vx7GM.mjs → discoverSandboxUsage-q0SIdjyQ.mjs} +1 -1
- package/dist/packem_shared/discoverSchema-BM_ZW7Z1.mjs +1 -0
- package/dist/packem_shared/{discoverStorageRulesMetadata-CitX6ziW.mjs → discoverStorageRulesMetadata-DFRtQeRb.mjs} +1 -1
- package/dist/packem_shared/{emitApi-DP9KFbgH.mjs → emitApi-CCjh0ICg.mjs} +18 -18
- package/dist/packem_shared/{emitFunctions-D5ItlRW-.mjs → emitFunctions-C3WOlVN0.mjs} +1 -1
- package/dist/packem_shared/{emitServer-cINjWPKS.mjs → emitServer-C2zwuJvT.mjs} +1 -1
- package/dist/packem_shared/{exported-procedure-chains-D1WlRfqJ.mjs → exported-procedure-chains-BX5nIQAe.mjs} +1 -1
- package/dist/packem_shared/{fingerprintSchemaSources-BKXkgkj4.mjs → fingerprintSchemaSources-C8hE4K08.mjs} +1 -1
- package/dist/packem_shared/{handler-reference-CClSR4bi.mjs → handler-reference-D5sW4xun.mjs} +1 -1
- package/dist/packem_shared/{index-BaQeoSqB.mjs → index-2eZFYBau.mjs} +1 -1
- package/dist/packem_shared/isTestPath-BrBtG0bz.mjs +1 -0
- package/dist/packem_shared/{module-specifiers-BctA0m_p.mjs → module-specifiers-WF8iAydP.mjs} +1 -1
- package/dist/packem_shared/{modules-l-Db0C4S.mjs → modules-CsEUB8s1.mjs} +1 -1
- package/dist/packem_shared/{server-CMceLanP.mjs → server-DCjunXFf.mjs} +1 -1
- package/dist/packem_shared/{unwrap-handler-return-CGdJGvGh.mjs → unwrap-handler-return-B79Rd7T0.mjs} +1 -1
- package/package.json +8 -8
- package/dist/packem_shared/CONTAINERS_FILENAME-mK4cZpcz.mjs +0 -1
- package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-Ia0lAKbR.mjs +0 -31
- package/dist/packem_shared/attribution-CG8-kUcl.mjs +0 -1
- package/dist/packem_shared/capabilitiesUsedBy-DjRHg-Zk.mjs +0 -1
- package/dist/packem_shared/chain-74gjwZMP.mjs +0 -1
- package/dist/packem_shared/discoverHyperdriveCalls-CV6bPCIa.mjs +0 -1
- package/dist/packem_shared/discoverMaskProcedures-rLz_2bHY.mjs +0 -1
- package/dist/packem_shared/discoverR2sqlCalls-BlnIOBxe.mjs +0 -1
- package/dist/packem_shared/discoverSchema-uxcH-Jy6.mjs +0 -1
- package/dist/packem_shared/isTestPath-C3QumE88.mjs +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -3569,6 +3569,9 @@ declare const SCHEMA_SNAPSHOT_FILENAME = ".lunora-schema.json";
|
|
|
3569
3569
|
* line is written to stderr with the total wall time and the discovery-vs-emit
|
|
3570
3570
|
* split — opt-in instrumentation that is otherwise zero-cost and side-effect-free
|
|
3571
3571
|
* on the returned {@link CodegenResult}.
|
|
3572
|
+
*
|
|
3573
|
+
* One walk of the source tree is shared by every discoverer for the run (see
|
|
3574
|
+
* `withSourceListMemo`).
|
|
3572
3575
|
*/
|
|
3573
3576
|
declare const runCodegen: (options: CodegenOptions) => CodegenResult;
|
|
3574
3577
|
declare const sortedUniqueNames: (names: Iterable<string>) => ReadonlyArray<string>;
|
package/dist/index.d.ts
CHANGED
|
@@ -3569,6 +3569,9 @@ declare const SCHEMA_SNAPSHOT_FILENAME = ".lunora-schema.json";
|
|
|
3569
3569
|
* line is written to stderr with the total wall time and the discovery-vs-emit
|
|
3570
3570
|
* split — opt-in instrumentation that is otherwise zero-cost and side-effect-free
|
|
3571
3571
|
* on the returned {@link CodegenResult}.
|
|
3572
|
+
*
|
|
3573
|
+
* One walk of the source tree is shared by every discoverer for the run (see
|
|
3574
|
+
* `withSourceListMemo`).
|
|
3572
3575
|
*/
|
|
3573
3576
|
declare const runCodegen: (options: CodegenOptions) => CodegenResult;
|
|
3574
3577
|
declare const sortedUniqueNames: (names: Iterable<string>) => ReadonlyArray<string>;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as a,serializeSchemaSnapshot as i}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-SplX7j_9.mjs";import{formatAdvisories as f,lintSchema as m,toAdvisorContext as d}from"./packem_shared/formatAdvisories-BCVASH7N.mjs";import{describeErrorLevelFindings as n,errorAdvisoryNames as c,errorPlatformDiagnosticNames as l,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 g}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as C,discoverAgents as N}from"./packem_shared/AGENTS_FILENAME-
|
|
1
|
+
import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as a,serializeSchemaSnapshot as i}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-SplX7j_9.mjs";import{formatAdvisories as f,lintSchema as m,toAdvisorContext as d}from"./packem_shared/formatAdvisories-BCVASH7N.mjs";import{describeErrorLevelFindings as n,errorAdvisoryNames as c,errorPlatformDiagnosticNames as l,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 g}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as C,discoverAgents as N}from"./packem_shared/AGENTS_FILENAME-MkkvnsUE.mjs";import{isTestPath as R,listLunoraSourceFiles as T}from"./packem_shared/isTestPath-BrBtG0bz.mjs";import{default as I}from"./packem_shared/discoverAuthApiCalls-cxNhFbVB.mjs";import{CONTAINERS_FILENAME as F,discoverContainers as L}from"./packem_shared/CONTAINERS_FILENAME-bE-y0B87.mjs";import{default as P}from"./packem_shared/discoverCrons-C5MhFDni.mjs";import{capabilitiesUsedBy as b,createTargetScope as y,foldCapabilitySignals as U,mayReadCapabilityContext as G,sourceCapabilitySignals as H}from"./packem_shared/capabilitiesUsedBy-CIms8agu.mjs";import{FLAGS_FILENAME as B,discoverFlags as k}from"./packem_shared/FLAGS_FILENAME-_nmXVMje.mjs";import{default as K}from"./packem_shared/discoverFunctions-BCsT7GQS.mjs";import{default as z}from"./packem_shared/discoverHttpRoutes-DwbVREYV.mjs";import{default as q}from"./packem_shared/discoverHyperdriveCalls-Ca9U-rY9.mjs";import{default as J}from"./packem_shared/discoverInserts-6cgh3ZTP.mjs";import{d as X}from"./packem_shared/index-2eZFYBau.mjs";import{default as $}from"./packem_shared/discoverMigrations-PQUwbVwP.mjs";import{MUTATORS_FILENAME as re,discoverMutators as oe}from"./packem_shared/MUTATORS_FILENAME-Y5_Dxk1E.mjs";import{default as ae}from"./packem_shared/discoverNondeterministicCalls-Br_sPo8Z.mjs";import{NOTIFY_FILENAME as se,discoverNotifyCalls as fe,discoverNotifyChannels as me,discoverNotifyConfig as de}from"./packem_shared/NOTIFY_FILENAME-BXAiPzbD.mjs";import{default as ne}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as le}from"./packem_shared/discoverQueries-BJCIpowp.mjs";import{QUEUES_FILENAME as Se,discoverQueues as Ee}from"./packem_shared/QUEUES_FILENAME-DEW3hmFm.mjs";import{default as Ae}from"./packem_shared/discoverR2sqlCalls-D2OK5ZWP.mjs";import{default as ve}from"./packem_shared/discoverRlsProcedures-DEwd3N-e.mjs";import{default as Ne}from"./packem_shared/discoverRlsMetadata-DmzmJtoo.mjs";import{discoverSandboxUsage as Re}from"./packem_shared/discoverSandboxUsage-q0SIdjyQ.mjs";import{default as he}from"./packem_shared/discoverSchema-BM_ZW7Z1.mjs";import{readServiceBindings as _e,resolveServiceBindings as Fe}from"./packem_shared/readServiceBindings-BA49C6aN.mjs";import{SHAPES_FILENAME as Me,discoverShapes as Pe}from"./packem_shared/SHAPES_FILENAME-B40f_T6B.mjs";import{default as be}from"./packem_shared/discoverStorageRulesMetadata-DFRtQeRb.mjs";import{WORKFLOWS_FILENAME as Ue,discoverWorkflows as Ge}from"./packem_shared/WORKFLOWS_FILENAME-WZhRFaoW.mjs";import{emitApp as je}from"./packem_shared/emitApp-CT7iAjam.mjs";import{isD1GlobalTable as ke,isHyperdriveGlobalTable as We}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as Ve,emitOpenApi as ze,emitOpenApiModule as Qe}from"./packem_shared/buildOpenApiDocument-20bRusvI.mjs";import{OPENRPC_VERSION as we,buildOpenRpcDocument as Je,emitOpenRpc as Ye,emitOpenRpcModule as Xe}from"./packem_shared/OPENRPC_VERSION-TX2C_rJT.mjs";import{DEFAULT_TARGET as $e,platformMatrixIds as er,readProjectTarget as rr,resolveCodegenTarget as or}from"./packem_shared/DEFAULT_TARGET-3OLdJhTj.mjs";import{loadProjectConfig as ar,readProjectConfigLiterals as ir}from"./packem_shared/loadProjectConfig-B7RmxIeD.mjs";import{PROJECT_CONFIG_FILENAMES as fr,findCodegenConfigFile as mr,findProjectConfigFile as dr,projectConfigCandidatePaths as pr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs";import{SCHEMA_SNAPSHOT_FILENAME as cr,runCodegen as lr}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-Z18YPqk_.mjs";import{SchemaSnapshotParseError as Sr,buildSchemaSnapshot as Er,evaluateSchemaDrift as ur,parseSchemaSnapshot as Ar}from"./packem_shared/SchemaSnapshotParseError-CjKSMuex.mjs";import{default as vr}from"./packem_shared/fingerprintSchemaSources-C8hE4K08.mjs";import{schemaFromIr as Nr}from"./packem_shared/schemaFromIr-CByOxuZb.mjs";import{LUNORA_ERROR_CODES as Rr,validatorIrToJsonSchema as Tr}from"./packem_shared/LUNORA_ERROR_CODES-CIAJQeKB.mjs";import{SDK_LANGUAGES as Ir,SDK_TARGETS as _r,generateSdk as Fr}from"./sdk/index.mjs";import{redact as Mr,secretKindOf as Pr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as br}from"./packem_shared/emitDrizzleSchema-CD4hPtUP.mjs";import{e as Ur}from"./packem_shared/server-DCjunXFf.mjs";import{e as Hr}from"./packem_shared/shard-gWobaDx2.mjs";import{G as Br}from"./packem_shared/shared-Br_OnErI.mjs";import{MESSAGE_SOLUTIONS as Wr,findSolutionByMessage as Kr}from"@lunora/errors";import{createCodegenProject as zr,findTsconfig as Qr,refreshCodegenProject as qr,tsconfigFingerprint as wr}from"./packem_shared/createCodegenProject-BinzLGxq.mjs";import{s as Yr,t as Xr,u as Zr}from"./packem_shared/shard-runtime-DXlpfT3P.mjs";import{emitApi as eo,emitCollections as ro,emitInternalApi as oo}from"./packem_shared/emitApi-CCjh0ICg.mjs";import{emitCrons as ao,emitScheduler as io,emitVectors as so,emitWranglerCronTriggers as fo}from"./packem_shared/emitCrons-CY8IQfAI.mjs";import{emitDataModel as po}from"./packem_shared/emitDataModel-Bba2y2yt.mjs";import{emitFunctions as co}from"./packem_shared/emitFunctions-C3WOlVN0.mjs";import{isTypedSchema as xo}from"./packem_shared/isTypedSchema-CDv3pJB6.mjs";const e="0.0.0";export{C as AGENTS_FILENAME,E as CAPABILITY_PROBES,F as CONTAINERS_FILENAME,A as CodegenDiagnosticError,$e as DEFAULT_TARGET,B as FLAGS_FILENAME,Br as GENERATED_HEADER,Rr as LUNORA_ERROR_CODES,Wr as LUNORA_SOLUTION_RULES,re as MUTATORS_FILENAME,se as NOTIFY_FILENAME,we as OPENRPC_VERSION,fr as PROJECT_CONFIG_FILENAMES,Se as QUEUES_FILENAME,cr as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Ir as SDK_LANGUAGES,_r as SDK_TARGETS,Me as SHAPES_FILENAME,Sr as SchemaSnapshotParseError,e as VERSION,Ue as WORKFLOWS_FILENAME,Ve as buildOpenApiDocument,Je as buildOpenRpcDocument,Er as buildSchemaSnapshot,b as capabilitiesUsedBy,zr as createCodegenProject,y as createTargetScope,n as describeErrorLevelFindings,g as diagnosticAt,a as diffSchemaSnapshots,N as discoverAgents,I as discoverAuthApiCalls,L as discoverContainers,P as discoverCrons,k as discoverFlags,K as discoverFunctions,z as discoverHttpRoutes,q as discoverHyperdriveCalls,J as discoverInserts,X as discoverMaskProcedures,$ as discoverMigrations,oe as discoverMutators,ae as discoverNondeterministicCalls,fe as discoverNotifyCalls,me as discoverNotifyChannels,de as discoverNotifyConfig,le as discoverQueries,Ee as discoverQueues,Ae as discoverR2sqlCalls,Ne as discoverRlsMetadata,ve as discoverRlsProcedures,Re as discoverSandboxUsage,he as discoverSchema,Pe as discoverShapes,be as discoverStorageRulesMetadata,Ge as discoverWorkflows,Yr as emitAgents,eo as emitApi,je as emitApp,ro as emitCollections,Xr as emitContainers,ao as emitCrons,po as emitDataModel,br as emitDrizzleSchema,co as emitFunctions,oo as emitInternalApi,ze as emitOpenApi,Qe as emitOpenApiModule,Ye as emitOpenRpc,Xe as emitOpenRpcModule,io as emitScheduler,Ur as emitServer,Hr as emitShard,so as emitVectors,Zr as emitWorkflows,fo as emitWranglerCronTriggers,c as errorAdvisoryNames,l as errorPlatformDiagnosticNames,ur as evaluateSchemaDrift,mr as findCodegenConfigFile,Kr as findLunoraSolution,dr as findProjectConfigFile,Qr as findTsconfig,vr as fingerprintSchemaSources,U as foldCapabilitySignals,f as formatAdvisories,Fr as generateSdk,ke as isD1GlobalTable,We as isHyperdriveGlobalTable,R as isTestPath,xo as isTypedSchema,m as lintSchema,T as listLunoraSourceFiles,ar as loadProjectConfig,G as mayReadCapabilityContext,Ar as parseSchemaSnapshot,er as platformMatrixIds,pr as projectConfigCandidatePaths,ne as readPackageDependencies,ir as readProjectConfigLiterals,rr as readProjectTarget,_e as readServiceBindings,Mr as redact,qr as refreshCodegenProject,or as resolveCodegenTarget,Fe as resolveServiceBindings,lr as runCodegen,Nr as schemaFromIr,Pr as secretKindOf,i as serializeSchemaSnapshot,x as sortedUniqueNames,H as sourceCapabilitySignals,d as toAdvisorContext,wr as tsconfigFingerprint,Tr as validatorIrToJsonSchema};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as p}from"node:fs";import{join as f}from"node:path";import{agentDefaultName as d,agentClassName as b,voiceBindingName as N,voiceClassName as y}from"@lunora/agent/naming";import{LunoraError as g}from"@lunora/errors";import{Node as a,SyntaxKind as u}from"ts-morph";import{diagnosticAt as l}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{unwrapToCallExpression as A,findObjectProperty as c,stringPropertyFor as w}from"./isTestPath-
|
|
1
|
+
import{existsSync as p}from"node:fs";import{join as f}from"node:path";import{agentDefaultName as d,agentClassName as b,voiceBindingName as N,voiceClassName as y}from"@lunora/agent/naming";import{LunoraError as g}from"@lunora/errors";import{Node as a,SyntaxKind as u}from"ts-morph";import{diagnosticAt as l}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{unwrapToCallExpression as A,findObjectProperty as c,stringPropertyFor as w}from"./isTestPath-BrBtG0bz.mjs";import{a as h}from"./attribution-ILDWgo1x.mjs";const E="agents.ts",v=o=>{const n=o.getSymbol();if(!n)return o.getText()==="defineAgent";for(const e of n.getDeclarations())if(a.isImportSpecifier(e))return e.getImportDeclaration().getModuleSpecifierValue()!=="@lunora/agent"?!1:e.getNameNode().getText()==="defineAgent";return!1},P=w("agent"),x=(o,n,e)=>{if(o.getKind()===u.TrueKeyword)return!0;if(o.getKind()===u.FalseKeyword)return!1;throw l(o,`agent "${n}": \`${e}\` must be a static boolean literal — it is deploy configuration codegen writes into the ctx.agents wiring spec`)},I=(o,n)=>{const e=o.getArguments()[0];if(!e||!a.isObjectLiteralExpression(e))throw l(o,`agent "${n}": defineAgent must be passed an inline object literal`);const t={className:b(n),exportName:n,name:d(n)},i=c(e,"name");i&&a.isPropertyAssignment(i)&&(t.name=P(i.getInitializerOrThrow(),n,"name"));const r=c(e,"publicRun");r&&a.isPropertyAssignment(r)&&x(r.getInitializerOrThrow(),n,"publicRun")&&(t.publicRun=!0);const s=c(e,"voice");if(s&&a.isPropertyAssignment(s)){const m=s.getInitializerOrThrow();if(!a.isObjectLiteralExpression(m))throw l(m,`agent "${n}": \`voice\` must be an inline object literal — its presence tells codegen to emit the voice-session Durable Object`);t.voice=!0,t.voiceBindingName=N(n),t.voiceClassName=y(n)}return c(e,"onEmail")&&(t.onEmail=!0),t},S=o=>{const n=[];for(const e of o.getVariableDeclarations()){const t=A(e.getInitializer());if(!t)continue;const i=t.getExpression();if(!a.isIdentifier(i)||!v(i))continue;const r=e.getNameNode();if(!a.isIdentifier(r)){if(e.getVariableStatement()?.hasExportKeyword()!==!0)continue;throw l(r,"defineAgent exports must be plain named exports (no destructuring)")}const s=h(e,"binding");s!==void 0&&n.push(I(t,s))}return n},T=o=>{const n=new Map,e=new Map;for(const t of o){const i=n.get(t.name);if(i!==void 0)throw new g("DUPLICATE_AGENT_NAME",`Duplicate agent name "${t.name}": produced by both "${i}" and "${t.exportName}". Deployed agent names must be unique across the project.`,{status:500});n.set(t.name,t.exportName);const r=e.get(t.className);if(r!==void 0)throw new g("DUPLICATE_AGENT_CLASS",`Duplicate agent class "${t.className}": produced by both "${r}" and "${t.exportName}". Agent export names must yield unique generated class names.`,{status:500});e.set(t.className,t.exportName)}},z=(o,n)=>{const e=f(n,E);if(!p(e))return[];const t=o.getSourceFile(e)??o.addSourceFileAtPath(e),i=S(t);return i.sort((r,s)=>r.exportName.localeCompare(s.exportName)),T(i),i};export{E as AGENTS_FILENAME,z as discoverAgents};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{existsSync as j}from"node:fs";import{join as I}from"node:path";import{containerClassName as A,containerBindingName as O,DURABLE_OBJECT_POLICY_FORBIDDEN_KEYS as k,isManagedImage as C,isCloudflareRegistryDigest as _,normalizeContainerImage as f}from"@lunora/container";import{SyntaxKind as $,Node as s}from"ts-morph";import{diagnosticAt as a}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{stringPropertyFor as D,findObjectProperty as p,symbolConstInitializer as M,descendantsOfKind as F,outermostValueWrapper as w,isWriteTarget as V}from"./isTestPath-BrBtG0bz.mjs";import{a as K}from"./attribution-ILDWgo1x.mjs";import{a as b}from"./property-name-7cBlgK_O.mjs";const B="containers.ts",R=t=>{const e=t.getSymbol();if(!e)return t.getText()==="defineContainer";for(const r of e.getDeclarations())if(s.isImportSpecifier(r))return r.getImportDeclaration().getModuleSpecifierValue()!=="@lunora/container"?!1:r.getNameNode().getText()==="defineContainer";return!1},d=D("container"),y=(t,e,r)=>{if(s.isNumericLiteral(t))return t.getLiteralValue();throw a(t,`container "${e}": \`${r}\` must be a static number literal — it is deploy configuration codegen writes into wrangler.jsonc`)},E=(t,e)=>{if(s.isStringLiteral(t)||s.isNoSubstitutionTemplateLiteral(t))return f(t.getLiteralValue());if(s.isObjectLiteralExpression(t)){const r=p(t,"registry");if(r&&s.isPropertyAssignment(r)){const i=r.getInitializerOrThrow();return f({registry:d(i,e,"image.registry")})}const n=p(t,"build");if(n&&s.isPropertyAssignment(n)){const i=n.getInitializerOrThrow();return f({build:d(i,e,"image.build")})}}throw a(t,`container "${e}": \`image\` must be a static string path, { registry: "…" }, or { build: "…" } literal`)},U=new Set(["buildArgs","image","images","instanceType","maxInstances","name","rollout","sandbox","schedulingPolicy"]),N=new Set(["gracePeriodSeconds","stepPercentage"]),L=t=>{let e=t;for(;s.isAsExpression(e)||s.isSatisfiesExpression(e)||s.isTypeAssertion(e)||s.isParenthesizedExpression(e);)e=e.getExpression();return e},Y=(t,e)=>F(e,$.Identifier).some(r=>{if(r.getSymbol()!==t)return!1;let n=w(r),i=n.getParent();if(s.isCallExpression(i)&&i.getExpression().getText()==="Object.assign")return i.getArguments()[0]===n;for(;(s.isPropertyAccessExpression(i)||s.isElementAccessExpression(i))&&i.getExpression()===n;){if(V(i))return!0;n=w(i),i=n.getParent()}return!1}),z=16,T=(t,e,r,n)=>{let i={name:r,symbol:t},o;for(let c=0;c<z;c+=1){const l=M(i.symbol);if(l===void 0||!s.isExpression(l))return o;if(o=L(l),s.isObjectLiteralExpression(o)&&i.symbol!==void 0&&Y(i.symbol,e.getSourceFile()))throw a(e,`${n}: \`${i.name}\` is a const object that is written to elsewhere in this file, so its initializer is not the value the container runs with. Declare the settings where they are final.`);if(!s.isIdentifier(o))return o;i={name:o.getText(),symbol:o.getSymbol()}}return o},P=(t,e)=>{const r=L(t);return s.isIdentifier(r)?T(r.getSymbol(),r,r.getText(),e)??r:r},W=t=>{const e=t.getNonNullableType();return(e.isUnion()?e.getUnionTypes():[e]).flatMap(n=>n.getApparentType().getProperties().map(i=>i.getName()))},q=(t,e,r)=>{const n=t.getExpression().getType(),i=e==="every"||n.isAny()||n.isUnknown()?["its keys"]:[...new Set(W(n))].filter(o=>e.has(o)).map(o=>`\`${o}\``);if(i.length>0)throw a(t,`${r}: this spread can set ${i.join(", ")}, which codegen writes into wrangler.jsonc and so must read statically. Spread a module-scope \`const\` object literal, or write the keys inline.`)},x=(t,e,r)=>{const n=b(t),i=s.isShorthandPropertyAssignment(t)?T(t.getValueSymbol(),t,n,r):void 0;if(i!==void 0)return[n,i];if(e==="every"||e.has(n))throw a(t,`${r}: \`${n}\` is deploy configuration codegen writes into wrangler.jsonc, so it must be a static literal — inline it, or name a module-scope \`const\` initialized with one.`)},m=(t,e,r,n=new Set)=>{const i=[],o=new Set(n).add(t);for(const c of t.getProperties())if(s.isPropertyAssignment(c))i.push([b(c),P(c.getInitializerOrThrow(),r)]);else if(s.isSpreadAssignment(c))i.push(...H(c,e,r,o));else{const l=x(c,e,r);l!==void 0&&i.push(l)}return i},H=(t,e,r,n)=>{const i=P(t.getExpression(),r);if(!s.isObjectLiteralExpression(i))return q(t,e,r),[];if(n.has(i))throw a(t,`${r}: this spread refers back to an object it is part of, so it has no static value.`);return m(i,e,r,n)},J=(t,e)=>{if(!s.isObjectLiteralExpression(t))throw a(t,`container "${e}": \`buildArgs\` must be a static object literal — it is deploy configuration codegen writes into wrangler.jsonc`);const r={};for(const[n,i]of m(t,"every",`container "${e}" buildArgs`))r[n]=d(i,e,`buildArgs.${n}`);return Object.keys(r).length>0?r:void 0},X=(t,e)=>{if(!s.isObjectLiteralExpression(t))throw a(t,`container "${e}": \`rollout\` must be a static object literal — it is deploy configuration codegen writes into wrangler.jsonc`);const r={};for(const[n,i]of m(t,N,`container "${e}" rollout`))(n==="gracePeriodSeconds"||n==="stepPercentage")&&(r[n]=y(i,e,`rollout.${n}`));return r.gracePeriodSeconds===void 0&&r.stepPercentage===void 0?void 0:r},v=t=>{if(s.isTrueLiteral(t))return!0;if(s.isFalseLiteral(t))return!1},S=t=>{if(s.isStringLiteral(t)||s.isNoSubstitutionTemplateLiteral(t)||s.isNumericLiteral(t))return t.getLiteralValue()},G=(t,e)=>{if(s.isStringLiteral(t))return t.getLiteralValue();if(s.isObjectLiteralExpression(t)){const r={};for(const n of t.getProperties()){if(!s.isPropertyAssignment(n))throw a(n,`container "${e}": \`instanceType\` must be an object of static number literals`);const i=b(n);if(i!=="diskMb"&&i!=="memoryMib"&&i!=="vcpu")throw a(n,`container "${e}": unknown \`instanceType\` field "${i}" — expected vcpu, memoryMib, or diskMb`);r[i]=y(n.getInitializerOrThrow(),e,`instanceType.${i}`)}return r}throw a(t,`container "${e}": \`instanceType\` must be a static string or { vcpu, memoryMib, diskMb } literal`)},Q=(t,e)=>{if(!s.isObjectLiteralExpression(t))throw a(t,`container "${e}": \`images\` must be a static object literal — codegen writes it into wrangler.jsonc`);const r={};for(const[n,i]of m(t,"every",`container "${e}" images`)){const o=E(i,e);if(o.kind==="build")throw a(i,`container "${e}": \`images["${n}"]\` cannot be a Railpack { build } source — use a Dockerfile path or a { registry } reference`);if(o.kind==="registry"&&!_(o.reference))throw a(i,`container "${e}": \`images["${n}"].registry\` must be a digest-pinned (@sha256) reference under registry.cloudflare.com — push other registries' images there first`);r[n]=o}return r},Z=(t,e)=>{const r=t.findLast(([i])=>i==="schedulingPolicy");if(r===void 0)return;const n=d(r[1],e,"schedulingPolicy");if(n!=="default"&&n!=="durable_object")throw a(r[1],`container "${e}": unknown \`schedulingPolicy\` "${n}" — use "default" or "durable_object"`);return n==="durable_object"?n:void 0},ee=(t,e,r,n)=>{if(r!==void 0&&k.includes(t))throw a(e,`container "${n}": \`${t}\` is not supported with schedulingPolicy "durable_object"`);if(r===void 0&&t==="images")throw a(e,`container "${n}": \`images\` needs schedulingPolicy "durable_object"`)},te=(t,e,r,n)=>{const{base:i,policy:o}=r;switch(t){case"buildArgs":{i.buildArgs=J(e,n);break}case"enableInternet":{i.enableInternet=v(e);break}case"hardTimeout":{i.hardTimeout=S(e);break}case"image":{r.scheduled||(o.image=E(e,n));break}case"images":{o.images=Q(e,n);break}case"instanceType":{i.instanceType=G(e,n);break}case"maxInstances":{o.maxInstances=y(e,n,"maxInstances");break}case"name":{i.name=d(e,n,"name");break}case"rollout":{o.rollout=X(e,n);break}case"sandbox":{const c=v(e);if(c===void 0)throw a(e,`container "${n}": \`sandbox\` must be a static true/false literal`);i.sandbox=c;break}case"sleepAfter":{i.sleepAfter=S(e);break}}},ne=(t,e,r)=>{const n=t.findLast(([o])=>o==="image")?.[1];if(n===void 0||!(s.isStringLiteral(n)||s.isNoSubstitutionTemplateLiteral(n)))return;const i=n.getLiteralValue();if(!Object.hasOwn(e??{},i)&&!C(i))throw a(n,`container "${r}": \`image\` "${i}" must name an entry of \`images\` or a Cloudflare-managed "cloudflare/…" image`)},ie=(t,e)=>{const r=t.getArguments()[0];if(!r||!s.isObjectLiteralExpression(r))throw a(t,`container "${e}": defineContainer must be passed an inline object literal`);const n=m(r,U,`container "${e}"`),i=Z(n,e),o={base:{bindingName:O(e),className:A(e),exportName:e},policy:{},scheduled:i!==void 0};for(const[g,u]of n)ee(g,u,i,e),te(g,u,o,e);const{base:c,policy:l}=o;if(i==="durable_object")return ne(n,l.images,e),{...c,...l.images===void 0?{}:{images:l.images},schedulingPolicy:i};if(l.image===void 0)throw a(r,`container "${e}": defineContainer requires a static \`image\` property`);return{...c,image:l.image,...l.maxInstances===void 0?{}:{maxInstances:l.maxInstances},...l.rollout===void 0?{}:{rollout:l.rollout}}},re=t=>{const e=[],r=new Map;for(const n of t.getVariableDeclarations()){const i=n.getInitializer();if(i?.getKind()!==$.CallExpression)continue;const o=i,c=o.getExpression();if(!s.isIdentifier(c)||!R(c))continue;const l=n.getNameNode();if(!s.isIdentifier(l)){if(n.getVariableStatement()?.hasExportKeyword()!==!0)continue;throw a(l,"defineContainer exports must be plain named exports (no destructuring)")}const g=K(n,"binding");if(g===void 0)continue;const u=ie(o,g),h=r.get(u.bindingName);if(h!==void 0)throw a(l,`containers "${h}" and "${u.exportName}" both map to the binding ${u.bindingName} — rename one so each container gets its own Durable Object binding`);r.set(u.bindingName,u.exportName),e.push(u)}return e},me=(t,e)=>{const r=I(e,B);if(!j(r))return[];const n=t.getSourceFile(r)??t.addSourceFileAtPath(r),i=re(n);return i.sort((o,c)=>o.exportName.localeCompare(c.exportName)),i};export{B as CONTAINERS_FILENAME,me as discoverContainers};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as l}from"node:fs";import{join as p}from"node:path";import{Node as t}from"ts-morph";import{defaultExportExpression as g,propertyInitializer as f,findObjectProperty as c}from"./isTestPath-
|
|
1
|
+
import{existsSync as l}from"node:fs";import{join as p}from"node:path";import{Node as t}from"ts-morph";import{defaultExportExpression as g,propertyInitializer as f,findObjectProperty as c}from"./isTestPath-BrBtG0bz.mjs";const d="flags.ts",u=new Set(["@lunora/flags/providers/flagship","lunorash/flags/flagship"]),m=e=>{const i=e.getSymbol();if(!i)return e.getText()==="flagshipProvider";for(const r of i.getDeclarations())if(t.isImportSpecifier(r))return u.has(r.getImportDeclaration().getModuleSpecifierValue())?r.getNameNode().getText()==="flagshipProvider":!1;return!1},v=(e,i)=>{const r=c(e,i);if(!r||!t.isPropertyAssignment(r))return;const o=r.getInitializerOrThrow();if(t.isStringLiteral(o)||t.isNoSubstitutionTemplateLiteral(o))return o.getLiteralValue()},h=e=>{const i=e.getArguments()[0];if(i&&t.isObjectLiteralExpression(i)){const r=v(i,"binding");if(r!==void 0&&r.length>0)return{bindingName:r,mode:"binding",provider:"flagship"}}return{mode:"http",provider:"flagship"}},S=e=>f(e.getArguments()[0],"provider"),b=(e,i)=>{const r=p(i,d);if(!l(r))return;const o=e.getSourceFile(r)??e.addSourceFileAtPath(r),n=g(o);if(!n||!t.isCallExpression(n))return{provider:"custom"};const s=S(n);if(s&&t.isCallExpression(s)){const a=s.getExpression();if(t.isIdentifier(a)&&m(a))return h(s)}return{provider:"custom"}};export{d as FLAGS_FILENAME,b as discoverFlags};
|
package/dist/packem_shared/{MUTATORS_FILENAME-qrKFa1I1.mjs → MUTATORS_FILENAME-Y5_Dxk1E.mjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as E}from"node:fs";import{join as y}from"node:path";import{Node as o,SyntaxKind as l}from"ts-morph";import{diagnosticAt as I}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{
|
|
1
|
+
import{existsSync as E}from"node:fs";import{join as y}from"node:path";import{Node as o,SyntaxKind as l}from"ts-morph";import{diagnosticAt as I}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{a as M}from"./module-specifiers-WF8iAydP.mjs";import{p as A}from"./parse-validator-CP5CL6Q7.mjs";import{findObjectProperty as c,unwrapExpression as d,isConstDeclaration as P}from"./isTestPath-BrBtG0bz.mjs";import{j as D,i as b,f as g,d as O}from"./attribution-ILDWgo1x.mjs";import{u as w}from"./unwrap-handler-return-B79Rd7T0.mjs";const z="mutators.ts",x=M,h=r=>{const e=r.getSymbol();if(!e)return r.getText()==="defineMutator";for(const t of e.getDeclarations())if(o.isImportSpecifier(t))return x(t.getImportDeclaration().getModuleSpecifierValue())?t.getNameNode().getText()==="defineMutator":!1;return!1},C=r=>{const e=r.getSymbol();if(!e)return!1;for(const t of e.getDeclarations()){if(!o.isNamespaceImport(t))continue;const i=t.getFirstAncestorByKind(l.ImportDeclaration);return i!==void 0&&x(i.getModuleSpecifierValue())}return!1},N=r=>{if(o.isIdentifier(r))return h(r);if(o.isPropertyAccessExpression(r)){const e=r.getExpression();return r.getName()==="defineMutator"&&o.isIdentifier(e)&&C(e)}return!1},S=r=>{const e=r.getArguments()[0];return e&&o.isObjectLiteralExpression(e)?e:void 0},m=new WeakMap,p=r=>{let e=m.get(r.compilerNode);if(e===void 0){const t=r.getNameNode(),i=t?.getText();e=r.getSourceFile().getDescendantsOfKind(l.Identifier).filter(s=>s!==t&&s.getText()===i&&g(s)?.compilerNode===r.compilerNode).length===1&&O(r)===void 0,m.set(r.compilerNode,e)}return e},f=r=>{const e=o.isIdentifier(r)?g(r):void 0,t=o.isSourceFile(e?.getParent())||o.isSourceFile(e?.getParent()?.getParent()?.getParent());if(e===void 0||e.getSourceFile()!==r?.getSourceFile()||!t)return;if(o.isFunctionDeclaration(e))return e.hasBody()&&p(e)?e:void 0;const i=P(e)?d(e.getInitializer()):void 0;return(o.isArrowFunction(i)||o.isFunctionExpression(i))&&o.isVariableDeclaration(e)&&p(e)?i:void 0},G=r=>{const e=r.getInitializer();if(!o.isCallExpression(e)||!N(e.getExpression()))return;const t=c(S(e),"server");if(o.isMethodDeclaration(t))return t;if(o.isShorthandPropertyAssignment(t))return f(t.getNameNode());const i=o.isPropertyAssignment(t)?d(t.getInitializer()):void 0;return o.isArrowFunction(i)||o.isFunctionExpression(i)?i:f(i)},T=r=>{const e=c(r,"args");if(!e||!o.isPropertyAssignment(e))return{};const t=e.getInitializer();return t&&o.isObjectLiteralExpression(t)?A(t):{}},L=r=>{const e=c(r,"server");if(!e||!o.isPropertyAssignment(e))return"unknown";const t=e.getInitializer();return!t||!(o.isArrowFunction(t)||o.isFunctionExpression(t))?"unknown":w(t)},j=r=>{const e=c(r,"owner");if(!e||!o.isPropertyAssignment(e))return;const t=e.getInitializer();return t&&o.isStringLiteral(t)?t.getLiteralValue():void 0},R=r=>{const e=[];for(const t of r.getVariableDeclarations()){if(!t.isExported())continue;const i=t.getInitializer();if(i?.getKind()!==l.CallExpression)continue;const n=i,s=n.getExpression();if(!N(s))continue;const a=t.getNameNode();if(!o.isIdentifier(a))throw I(a,"defineMutator exports must be plain named exports (no destructuring)");const u=S(n);for(const v of D(t).filter(F=>b(F)))e.push({args:T(u),exportName:v,filePath:"mutators",line:n.getStartLineNumber(),owner:j(u),returnType:L(u)})}return e},J=(r,e)=>{const t=y(e,z);if(!E(t))return[];const i=r.getSourceFile(t)??r.addSourceFileAtPath(t),n=R(i);return n.sort((s,a)=>s.exportName.localeCompare(a.exportName)),n};export{z as MUTATORS_FILENAME,J as discoverMutators,N as isDefineMutatorCallee,S as mutatorLiteral,G as mutatorServerImplOf};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync as v}from"node:fs";import{join as N}from"node:path";import{SyntaxKind as u,Node as r,VariableDeclarationKind as F}from"ts-morph";import{listLunoraSourceFiles as m,lunoraRelativePath as O,findObjectProperty as g,defaultExportExpression as D,handlerOf as A}from"./isTestPath-
|
|
1
|
+
import{existsSync as v}from"node:fs";import{join as N}from"node:path";import{SyntaxKind as u,Node as r,VariableDeclarationKind as F}from"ts-morph";import{listLunoraSourceFiles as m,lunoraRelativePath as O,findObjectProperty as g,defaultExportExpression as D,handlerOf as A}from"./isTestPath-BrBtG0bz.mjs";import{b as I,d as T}from"./attribution-ILDWgo1x.mjs";import{i as l}from"./context-root-ChKZ81ma.mjs";import{c as C}from"./classify-procedure-call-CGyiEHy1.mjs";const k="notify.ts",L=new Set(["chat","inApp","send","webhook"]),h=new Set(["broadcast","send"]),M=e=>{const s=e.getInitializer();if(!s||!r.isCallExpression(s))return;const t=C(s);if(!t)return;const i=A(s,t.receiver);return i?{exportName:T(e)??e.getName(),handler:i,kind:t.kind}:void 0},x=e=>{const s=[];for(const t of I(e)){const i=M(t);i&&s.push(i)}return s},y=e=>l(e,["notify"])?"notify":l(e,["push"])||l(e,["notify","push"])?"push":void 0,w=e=>{if(!r.isPropertyAccessExpression(e))return;const s=e.getName(),t=y(e.getExpression());if(t==="notify"&&L.has(s))return`ctx.notify.${s}`;if(t==="push"&&h.has(s))return`ctx.push.${s}`},_=e=>r.isPropertyAccessExpression(e)?y(e.getExpression())==="push"&&h.has(e.getName()):!1,Z=(e,s)=>{const t=[];for(const i of m(s)){const n=e.getSourceFile(i)??e.addSourceFileAtPath(i),o=O(s,i);for(const c of x(n))if(!(c.kind!=="query"&&c.kind!=="mutation"))for(const a of c.handler.getDescendantsOfKind(u.PropertyAccessExpression)){const f=w(a);f!==void 0&&t.push({callee:f,exportName:c.exportName,file:o,kind:c.kind,line:a.getStartLineNumber()})}}return t},K=(e,s)=>{for(const t of m(s)){const i=e.getSourceFile(t)??e.addSourceFileAtPath(t);for(const n of x(i))for(const o of n.handler.getDescendantsOfKind(u.PropertyAccessExpression))if(_(o))return!0}return!1},R=new Set(["@lunora/notify"]),U=e=>{const s=e.getSymbol();if(!s)return e.getText()==="defineNotify";for(const t of s.getDeclarations())if(r.isImportSpecifier(t))return R.has(t.getImportDeclaration().getModuleSpecifierValue())?t.getNameNode().getText()==="defineNotify":!1;return!1},E=(e,s=new Set)=>{const t=D(e);if(!t)return;if(!r.isIdentifier(t))return t;const i=t.getSymbol();if(!i?.isAlias())return t;const n=i.getAliasedSymbol();if(!n)return t;const o=n.getDeclarations().find(a=>r.isExportAssignment(a));if(!o)return t;const c=o.getSourceFile();if(!s.has(c.getFilePath()))return E(c,s.add(c.getFilePath()))},V=new Set(["%=","&&=","&=","**=","+=","-=","/=","<<=","=",">>=",">>>=","??=","^=","|=","||="]),p=e=>{const s=e.getSymbol();return s?.getAliasedSymbol()?.getDeclarations()[0]??s?.getDeclarations()[0]},P=e=>{if(r.isIdentifier(e))return e;if(r.isPropertyAccessExpression(e)||r.isElementAccessExpression(e))return P(e.getExpression())},d=(e,s)=>{const t=P(e);return t!==void 0&&p(t)===s},j=(e,s)=>{const t=e.getExpression();if(!r.isPropertyAccessExpression(t))return!1;const i=t.getName(),n=t.getExpression(),o=r.isIdentifier(n)?n.getText():"";if(!((i==="assign"||i==="defineProperty"||i==="defineProperties")&&o==="Object"||i==="set"&&o==="Reflect"))return!1;const a=e.getArguments()[0];return a!==void 0&&r.isIdentifier(a)&&p(a)===s},z=(e,s)=>{if(r.isBinaryExpression(e))return V.has(e.getOperatorToken().getText())&&d(e.getLeft(),s);if(r.isDeleteExpression(e))return d(e.getExpression(),s);if(r.isPrefixUnaryExpression(e)||r.isPostfixUnaryExpression(e)){const t=e.getOperatorToken();return(t===u.PlusPlusToken||t===u.MinusMinusToken)&&d(e.getOperand(),s)}return r.isCallExpression(e)?j(e,s):!1},H=(e,s)=>{const t=p(e);return t===void 0?!0:s.some(i=>i.getDescendants().some(n=>z(n,t)))},W=e=>{if(r.isObjectLiteralExpression(e))return e;if(!r.isIdentifier(e))return;const s=e.getSymbol(),t=s?.getAliasedSymbol()?.getDeclarations()??s?.getDeclarations()??[];for(const i of t){if(!r.isVariableDeclaration(i))continue;const n=i.getInitializer();if(!n||!r.isObjectLiteralExpression(n))continue;const o=i.getParent();if(!r.isVariableDeclarationList(o)||o.getDeclarationKind()!==F.Const)continue;const c=[i.getSourceFile(),e.getSourceFile()].filter((a,f,S)=>S.findIndex(b=>b.getFilePath()===a.getFilePath())===f);if(!H(e,c))return n}},Y=(e,s)=>{const t=N(s,k);if(!v(t))return;const i=e.getSourceFile(t)??e.addSourceFileAtPath(t),n=E(i);if(!n||!r.isCallExpression(n))return{hasFcm:!0,hasWebPush:!0};const o=n.getExpression(),c=r.isIdentifier(o)&&U(o)?n.getArguments()[0]:void 0,a=c===void 0?void 0:W(c);return!a||a.getProperties().some(f=>r.isSpreadAssignment(f))?{hasFcm:!0,hasWebPush:!0}:{hasFcm:g(a,"fcm")!==void 0,hasWebPush:g(a,"webPush")!==void 0}},ee=(e,s)=>{const t=Y(e,s);return t===void 0?void 0:{...t,usesPush:K(e,s)}};export{k as NOTIFY_FILENAME,Z as discoverNotifyCalls,Y as discoverNotifyChannels,ee as discoverNotifyConfig};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{m}from"./modules-
|
|
1
|
+
import{m}from"./modules-CsEUB8s1.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-CIAJQeKB.mjs";import{G as h}from"./shared-Br_OnErI.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 +1 @@
|
|
|
1
|
-
import{existsSync as x}from"node:fs";import{join as f}from"node:path";import{LunoraError as b}from"@lunora/errors";import{queueDefaultName as q,queueBindingName as y}from"@lunora/queue";import{SyntaxKind as S,Node as u}from"ts-morph";import{diagnosticAt as c}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{lunoraRelativePath as g,findObjectProperty as l,stringPropertyFor as w}from"./isTestPath-
|
|
1
|
+
import{existsSync as x}from"node:fs";import{join as f}from"node:path";import{LunoraError as b}from"@lunora/errors";import{queueDefaultName as q,queueBindingName as y}from"@lunora/queue";import{SyntaxKind as S,Node as u}from"ts-morph";import{diagnosticAt as c}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{lunoraRelativePath as g,findObjectProperty as l,stringPropertyFor as w}from"./isTestPath-BrBtG0bz.mjs";import{a as v}from"./attribution-ILDWgo1x.mjs";import{r as $}from"./handler-reference-D5sW4xun.mjs";import{d as F}from"./modules-CsEUB8s1.mjs";const h="queues.ts",P=o=>{const e=t=>t==="defineQueue"||t==="defineSubscription"||t==="defineTopic",i=o.getSymbol();if(!i){const t=o.getText();return e(t)?t:void 0}for(const t of i.getDeclarations()){if(!u.isImportSpecifier(t))continue;if(t.getImportDeclaration().getModuleSpecifierValue()!=="@lunora/queue")return;const n=t.getNameNode().getText();return e(n)?n:void 0}},d=w("queue"),E=(o,e,i)=>{if(u.isNumericLiteral(o))return o.getLiteralValue();throw c(o,`queue "${e}": \`${i}\` must be a static numeric literal — it is deploy configuration codegen writes into wrangler.jsonc`)},I={maxBatchSize:{integer:!0,max:100,min:1},maxBatchTimeout:{integer:!1,max:60,min:0},maxConcurrency:{integer:!0,max:250,min:1},maxRetries:{integer:!0,max:100,min:0},retryDelay:{integer:!0,max:86400,min:0}},A=(o,e)=>{const i={};for(const[t,n]of Object.entries(I)){const r=l(o,t);if(r&&u.isPropertyAssignment(r)){const a=E(r.getInitializerOrThrow(),e,t);if(a<n.min||a>n.max||n.integer&&!Number.isInteger(a))throw c(r,`queue "${e}": \`${t}\` must be ${n.integer?"an integer":"a number"} from ${n.min.toString()} to ${n.max.toString()} (got ${a.toString()})`);i[t]=a}}return i},T=(o,e)=>{const i=l(o,"name");if(!i||!u.isPropertyAssignment(i))return;const t=d(i.getInitializerOrThrow(),e,"name");if(t.length===0)throw c(i,`queue "${e}": \`name\` must be a non-empty string when provided`);return t},N=(o,e,i,t)=>{const n=$(l(o,"handler"),t)?.site,r={bindingName:y(e),exportName:e,filePath:g(t,o.getSourceFile().getFilePath()),mode:"push",name:T(o,e)??q(e),...i===void 0?{}:{topic:i},...n===void 0?{}:{handlerSite:n},tuning:{}},a=l(o,"mode");if(a&&u.isPropertyAssignment(a)){if(i!==void 0)throw c(a,`subscription "${e}": \`mode\` is not allowed — a subscription is always a push consumer`);const m=d(a.getInitializerOrThrow(),e,"mode");if(m!=="push"&&m!=="pull")throw c(a,`queue "${e}": \`mode\` must be "push" or "pull" (got ${JSON.stringify(m)})`);r.mode=m}const s=l(o,"deadLetterQueue");return s&&u.isPropertyAssignment(s)&&(r.tuning.deadLetterQueue=d(s.getInitializerOrThrow(),e,"deadLetterQueue")),Object.assign(r.tuning,A(o,e)),r},O=(o,e,i)=>{const t=o.getArguments()[0];if(!t||!u.isObjectLiteralExpression(t))throw c(o,`queue "${e}": defineQueue must be passed an inline object literal`);return N(t,e,void 0,i)},p=(o,e)=>`${o}:${e}`,Q=o=>{const e=o.getSymbol(),i=(e?.isAlias()===!0?e.getAliasedSymbol():e)?.getDeclarations()[0];return i!==void 0&&u.isVariableDeclaration(i)?p(i.getSourceFile().getFilePath(),i.getName()):p(o.getSourceFile().getFilePath(),o.getText())},L=(o,e,i,t)=>{const[n,r]=o.getArguments(),a=n!==void 0&&u.isIdentifier(n)?i.get(Q(n)):void 0;if(a===void 0)throw c(n??o,`subscription "${e}": the first argument must name a \`defineTopic()\` export of lunora/queues.ts or a module's queues.ts`);if(!r||!u.isObjectLiteralExpression(r))throw c(o,`subscription "${e}": defineSubscription must be passed an inline object literal`);return N(r,e,a,t)},U=o=>{const e=[];for(const i of o.getVariableDeclarations()){const t=i.getInitializer();if(t?.getKind()!==S.CallExpression)continue;const n=t,r=n.getExpression(),a=u.isIdentifier(r)?P(r):void 0;if(a===void 0)continue;const s=i.getNameNode();if(!u.isIdentifier(s)){if(i.getVariableStatement()?.hasExportKeyword()!==!0)continue;throw c(s,`${a} exports must be plain named exports (no destructuring)`)}const m=v(i,"binding");m!==void 0&&e.push({call:n,exportName:m,factory:a,localName:s.getText()})}return e},C=(o,e)=>{const i=new Map;for(const t of o){const n=g(e,t.call.getSourceFile().getFilePath()),r=i.get(t.exportName);if(r!==void 0)throw c(t.call,`"${t.exportName}" is exported by both lunora/${r}.ts and lunora/${n}.ts — queue and topic export names must be unique across the app`);i.set(t.exportName,n)}},M=(o,e)=>{const i=o.flatMap(s=>U(s));C(i,e);const t=i.filter(s=>s.factory==="defineTopic"),n=new Map(t.map(s=>[p(s.call.getSourceFile().getFilePath(),s.localName),s.exportName])),r=[];for(const s of i)s.factory==="defineQueue"?r.push(O(s.call,s.exportName,e)):s.factory==="defineSubscription"&&r.push(L(s.call,s.exportName,n,e));const a=t.map(s=>({exportName:s.exportName,filePath:g(e,s.call.getSourceFile().getFilePath())}));return{queues:r,topics:a}},j=(o,e)=>[f(e,h),...F(o,e).map(i=>f(e,i.name,h))].filter(i=>x(i)),z=o=>{const e=new Map,i=new Map;for(const t of o){const n=e.get(t.name);if(n!==void 0)throw new b("DUPLICATE_QUEUE_NAME",`Duplicate queue name "${t.name}": produced by both "${n}" and "${t.exportName}". Deployed queue names must be unique across the project.`,{status:500});e.set(t.name,t.exportName);const r=i.get(t.bindingName);if(r!==void 0)throw new b("DUPLICATE_QUEUE_BINDING",`Duplicate queue binding "${t.bindingName}": produced by both "${r}" and "${t.exportName}". Queue export names must yield unique binding names.`,{status:500});i.set(t.bindingName,t.exportName)}},D=(o,e)=>{const i=j(o,e).map(a=>o.getSourceFile(a)??o.addSourceFileAtPath(a)),{queues:t,topics:n}=M(i,e),r=t.toSorted((a,s)=>a.exportName.localeCompare(s.exportName));return z(r),{queues:r,topics:n.toSorted((a,s)=>a.exportName.localeCompare(s.exportName))}},X=(o,e)=>D(o,e).queues;export{h as QUEUES_FILENAME,D as discoverQueueDeclarations,X as discoverQueues};
|