@lunora/codegen 1.0.0-alpha.287 → 1.0.0-alpha.289

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.
Files changed (56) hide show
  1. package/dist/index.d.mts +9 -0
  2. package/dist/index.d.ts +9 -0
  3. package/dist/index.mjs +1 -1
  4. package/dist/packem_shared/{AGENTS_FILENAME-CMApbNUc.mjs → AGENTS_FILENAME-CwwSEW6a.mjs} +1 -1
  5. package/dist/packem_shared/{CONTAINERS_FILENAME-CotojPk5.mjs → CONTAINERS_FILENAME-BtX5vWh8.mjs} +1 -1
  6. package/dist/packem_shared/{DEFAULT_TARGET-GPPgJNTn.mjs → DEFAULT_TARGET-3U7x981M.mjs} +1 -1
  7. package/dist/packem_shared/{FLAGS_FILENAME-C1RHlinh.mjs → FLAGS_FILENAME-Bf0MSlHH.mjs} +1 -1
  8. package/dist/packem_shared/{MUTATORS_FILENAME-DQ-010Zm.mjs → MUTATORS_FILENAME-Dl1tElqi.mjs} +1 -1
  9. package/dist/packem_shared/{NOTIFY_FILENAME-BOdrj1Oc.mjs → NOTIFY_FILENAME-BeTurUSC.mjs} +1 -1
  10. package/dist/packem_shared/{OPENRPC_VERSION-DnYKkFP6.mjs → OPENRPC_VERSION-CCY7xqSL.mjs} +1 -1
  11. package/dist/packem_shared/{QUEUES_FILENAME-DLCZe-bV.mjs → QUEUES_FILENAME-D588u733.mjs} +1 -1
  12. package/dist/packem_shared/{SCHEMA_SNAPSHOT_FILENAME-B7WJKe_F.mjs → SCHEMA_SNAPSHOT_FILENAME-Ddnww-0x.mjs} +6 -6
  13. package/dist/packem_shared/{SHAPES_FILENAME-CAJGkW3k.mjs → SHAPES_FILENAME-D-Q8lSEw.mjs} +1 -1
  14. package/dist/packem_shared/{WORKFLOWS_FILENAME-CKclegFS.mjs → WORKFLOWS_FILENAME-BGMSNTDC.mjs} +1 -1
  15. package/dist/packem_shared/{attribution-0YtR4LvZ.mjs → attribution-BUciBs1M.mjs} +1 -1
  16. package/dist/packem_shared/{buildOpenApiDocument-D_8TtHK1.mjs → buildOpenApiDocument-DFv-RYZU.mjs} +1 -1
  17. package/dist/packem_shared/{capabilitiesUsedBy-CmSX6ODG.mjs → capabilitiesUsedBy-QgSZyE0T.mjs} +1 -1
  18. package/dist/packem_shared/chain-BUxIVIw_.mjs +1 -0
  19. package/dist/packem_shared/{classify-procedure-call-C9lQCjso.mjs → classify-procedure-call-BJdf_-M6.mjs} +1 -1
  20. package/dist/packem_shared/{context-property-calls-mJoBjbyp.mjs → context-property-calls-DPnUYWSX.mjs} +1 -1
  21. package/dist/packem_shared/{context-root-DX4uZFBy.mjs → context-root-Dlo21ybw.mjs} +1 -1
  22. package/dist/packem_shared/{database-calls-DyOLz_lK.mjs → database-calls-ONnjnkMd.mjs} +1 -1
  23. package/dist/packem_shared/{discoverAuthApiCalls-DZu_PHnZ.mjs → discoverAuthApiCalls-DAaK0HUK.mjs} +1 -1
  24. package/dist/packem_shared/{discoverCrons-DBuEbNrB.mjs → discoverCrons-DF7dOP9x.mjs} +1 -1
  25. package/dist/packem_shared/{discoverFunctions-CgyrgvUR.mjs → discoverFunctions-DsQwrwWq.mjs} +1 -1
  26. package/dist/packem_shared/{discoverHttpRoutes-Bwqu4zSU.mjs → discoverHttpRoutes-Cv-h-Yuc.mjs} +1 -1
  27. package/dist/packem_shared/discoverHyperdriveCalls-xy2G6igG.mjs +1 -0
  28. package/dist/packem_shared/{discoverInserts-S3k8YMGc.mjs → discoverInserts-CQsoloGk.mjs} +1 -1
  29. package/dist/packem_shared/discoverMaskProcedures-Dr1UccD6.mjs +1 -0
  30. package/dist/packem_shared/{discoverMigrations-DG1eWtr3.mjs → discoverMigrations-uxm9qHrr.mjs} +1 -1
  31. package/dist/packem_shared/{discoverNondeterministicCalls-Bzr6I_nH.mjs → discoverNondeterministicCalls-Dm7_PJoA.mjs} +1 -1
  32. package/dist/packem_shared/{discoverQueries-DZ4v6es7.mjs → discoverQueries-BqECbkm9.mjs} +1 -1
  33. package/dist/packem_shared/discoverR2sqlCalls-I9IqJFcy.mjs +1 -0
  34. package/dist/packem_shared/{discoverRlsMetadata-BnFqUsvY.mjs → discoverRlsMetadata-Cu4bc5KZ.mjs} +1 -1
  35. package/dist/packem_shared/{discoverRlsProcedures-DTexWDMq.mjs → discoverRlsProcedures-Bkohn4ZR.mjs} +1 -1
  36. package/dist/packem_shared/{discoverSandboxUsage-ejLtE6Ky.mjs → discoverSandboxUsage-w6Q3RvxZ.mjs} +1 -1
  37. package/dist/packem_shared/{discoverSchema-C3WOG-xt.mjs → discoverSchema-BCxeD80d.mjs} +1 -1
  38. package/dist/packem_shared/{discoverStorageRulesMetadata-DE2Kblph.mjs → discoverStorageRulesMetadata-D6rjgKYC.mjs} +1 -1
  39. package/dist/packem_shared/{emitApp-CBIXVzkw.mjs → emitApp-D7G7gmV7.mjs} +5 -5
  40. package/dist/packem_shared/{exported-procedure-chains-DLor3aUN.mjs → exported-procedure-chains-BZk1-hro.mjs} +1 -1
  41. package/dist/packem_shared/{fingerprintSchemaSources-C4PkhFFQ.mjs → fingerprintSchemaSources-eVG9aVt0.mjs} +1 -1
  42. package/dist/packem_shared/{handler-reference-DQlWnkjm.mjs → handler-reference-DXkpwoAq.mjs} +1 -1
  43. package/dist/packem_shared/{index-DbaVBeCK.mjs → index-BoPXSW7g.mjs} +1 -1
  44. package/dist/packem_shared/{isTestPath-CiIyKqhF.mjs → isTestPath-B81lOULB.mjs} +1 -1
  45. package/dist/packem_shared/{loadProjectConfig-DGqGWOfa.mjs → loadProjectConfig-NO0dVJSl.mjs} +1 -1
  46. package/dist/packem_shared/{modules-Cuogms61.mjs → modules-CjOcuQnK.mjs} +1 -1
  47. package/dist/packem_shared/{parse-validator-DYdT7Hyf.mjs → parse-validator-IDBKIT7M.mjs} +1 -1
  48. package/dist/packem_shared/project-config-file-BV7RR-l6.mjs +1 -0
  49. package/dist/packem_shared/{readServiceBindings-DuE9xlvV.mjs → readServiceBindings-DvqIThzd.mjs} +1 -1
  50. package/dist/packem_shared/{unwrap-handler-return-BedChFbC.mjs → unwrap-handler-return-B-jQde6M.mjs} +1 -1
  51. package/package.json +4 -4
  52. package/dist/packem_shared/chain-Dsgmjc_m.mjs +0 -1
  53. package/dist/packem_shared/discoverHyperdriveCalls-CkLpUaGK.mjs +0 -1
  54. package/dist/packem_shared/discoverMaskProcedures-DthLheP8.mjs +0 -1
  55. package/dist/packem_shared/discoverR2sqlCalls-L3A7rGcQ.mjs +0 -1
  56. package/dist/packem_shared/project-config-file-Bv2l-Kmm.mjs +0 -1
package/dist/index.d.mts CHANGED
@@ -4195,6 +4195,13 @@ declare const emitOpenRpc: (input: OpenRpcEmitInput) => string;
4195
4195
  * the object returned by {@link buildOpenRpcDocument} (reused, never recomputed).
4196
4196
  */
4197
4197
  declare const emitOpenRpcModule: (document_: Record<string, unknown>) => string;
4198
+ /** One reviewed ERROR to accept. `reason` says why it is safe; it is shown with the finding. */
4199
+ interface AcceptedFinding {
4200
+ exportName: string;
4201
+ file: string;
4202
+ reason: string;
4203
+ rule: string;
4204
+ }
4198
4205
  /**
4199
4206
  * The config filenames probed at the project root, in order. TypeScript first
4200
4207
  * because that is what the templates ship and what the type-only `satisfies`
@@ -4229,6 +4236,8 @@ interface ProjectConfigLiterals {
4229
4236
  * be wrong".
4230
4237
  */
4231
4238
  advisor?: {
4239
+ accept?: AcceptedFinding[];
4240
+ acceptUnreadable?: true;
4232
4241
  minSeverity?: string;
4233
4242
  unreadable?: boolean;
4234
4243
  };
package/dist/index.d.ts CHANGED
@@ -4195,6 +4195,13 @@ declare const emitOpenRpc: (input: OpenRpcEmitInput) => string;
4195
4195
  * the object returned by {@link buildOpenRpcDocument} (reused, never recomputed).
4196
4196
  */
4197
4197
  declare const emitOpenRpcModule: (document_: Record<string, unknown>) => string;
4198
+ /** One reviewed ERROR to accept. `reason` says why it is safe; it is shown with the finding. */
4199
+ interface AcceptedFinding {
4200
+ exportName: string;
4201
+ file: string;
4202
+ reason: string;
4203
+ rule: string;
4204
+ }
4198
4205
  /**
4199
4206
  * The config filenames probed at the project root, in order. TypeScript first
4200
4207
  * because that is what the templates ship and what the type-only `satisfies`
@@ -4229,6 +4236,8 @@ interface ProjectConfigLiterals {
4229
4236
  * be wrong".
4230
4237
  */
4231
4238
  advisor?: {
4239
+ accept?: AcceptedFinding[];
4240
+ acceptUnreadable?: true;
4232
4241
  minSeverity?: string;
4233
4242
  unreadable?: boolean;
4234
4243
  };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as s,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{formatAdvisories as m,lintSchema as f,toAdvisorContext as d}from"./packem_shared/formatAdvisories-DwmUKYuc.mjs";import{describeErrorLevelFindings as n,errorAdvisoryNames as l,errorPlatformDiagnosticNames as c,sortedUniqueNames as x}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-brcmKenl.mjs";import{CodegenDiagnosticError as A,diagnosticAt as v}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as N,discoverAgents as g}from"./packem_shared/AGENTS_FILENAME-CMApbNUc.mjs";import{isTestPath as R,listLunoraSourceFiles as T}from"./packem_shared/isTestPath-CiIyKqhF.mjs";import{default as I}from"./packem_shared/discoverAuthApiCalls-DZu_PHnZ.mjs";import{CONTAINERS_FILENAME as L,discoverContainers as M}from"./packem_shared/CONTAINERS_FILENAME-CotojPk5.mjs";import{default as P}from"./packem_shared/discoverCrons-DBuEbNrB.mjs";import{capabilitiesUsedBy as b,foldCapabilitySignals as y,mayReadCapabilityContext as U,sourceCapabilitySignals as G}from"./packem_shared/capabilitiesUsedBy-CmSX6ODG.mjs";import{FLAGS_FILENAME as j,discoverFlags as B}from"./packem_shared/FLAGS_FILENAME-C1RHlinh.mjs";import{default as W}from"./packem_shared/discoverFunctions-CgyrgvUR.mjs";import{default as V}from"./packem_shared/discoverHttpRoutes-Bwqu4zSU.mjs";import{default as Q}from"./packem_shared/discoverHyperdriveCalls-CkLpUaGK.mjs";import{default as w}from"./packem_shared/discoverInserts-S3k8YMGc.mjs";import{d as Y}from"./packem_shared/index-DbaVBeCK.mjs";import{default as Z}from"./packem_shared/discoverMigrations-DG1eWtr3.mjs";import{MUTATORS_FILENAME as ee,discoverMutators as re}from"./packem_shared/MUTATORS_FILENAME-DQ-010Zm.mjs";import{default as te}from"./packem_shared/discoverNondeterministicCalls-Bzr6I_nH.mjs";import{NOTIFY_FILENAME as ae,discoverNotifyCalls as ie,discoverNotifyChannels as me,discoverNotifyConfig as fe}from"./packem_shared/NOTIFY_FILENAME-BOdrj1Oc.mjs";import{default as pe}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as le}from"./packem_shared/discoverQueries-DZ4v6es7.mjs";import{QUEUES_FILENAME as xe,discoverQueues as Se}from"./packem_shared/QUEUES_FILENAME-DLCZe-bV.mjs";import{default as ue}from"./packem_shared/discoverR2sqlCalls-L3A7rGcQ.mjs";import{default as ve}from"./packem_shared/discoverRlsProcedures-DTexWDMq.mjs";import{default as Ne}from"./packem_shared/discoverRlsMetadata-BnFqUsvY.mjs";import{discoverSandboxUsage as Oe}from"./packem_shared/discoverSandboxUsage-ejLtE6Ky.mjs";import{default as Te}from"./packem_shared/discoverSchema-C3WOG-xt.mjs";import{readServiceBindings as Ie,resolveServiceBindings as _e}from"./packem_shared/readServiceBindings-DuE9xlvV.mjs";import{SHAPES_FILENAME as Me,discoverShapes as Fe}from"./packem_shared/SHAPES_FILENAME-CAJGkW3k.mjs";import{default as De}from"./packem_shared/discoverStorageRulesMetadata-DE2Kblph.mjs";import{WORKFLOWS_FILENAME as ye,discoverWorkflows as Ue}from"./packem_shared/WORKFLOWS_FILENAME-CKclegFS.mjs";import{emitApp as He}from"./packem_shared/emitApp-CBIXVzkw.mjs";import{isD1GlobalTable as Be,isHyperdriveGlobalTable as ke}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as Ke,emitOpenApi as Ve,emitOpenApiModule as ze}from"./packem_shared/buildOpenApiDocument-D_8TtHK1.mjs";import{OPENRPC_VERSION as qe,buildOpenRpcDocument as we,emitOpenRpc as Je,emitOpenRpcModule as Ye}from"./packem_shared/OPENRPC_VERSION-DnYKkFP6.mjs";import{DEFAULT_TARGET as Ze,platformMatrixIds as $e,readProjectTarget as er,resolveCodegenTarget as rr}from"./packem_shared/DEFAULT_TARGET-GPPgJNTn.mjs";import{l as tr,r as sr}from"./packem_shared/project-config-file-Bv2l-Kmm.mjs";import{SCHEMA_SNAPSHOT_FILENAME as ir,createCodegenProject as mr,findTsconfig as fr,refreshCodegenProject as dr,runCodegen as pr}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-B7WJKe_F.mjs";import{SchemaSnapshotParseError as lr,buildSchemaSnapshot as cr,evaluateSchemaDrift as xr,parseSchemaSnapshot as Sr}from"./packem_shared/SchemaSnapshotParseError-CPOXlFhI.mjs";import{default as ur}from"./packem_shared/fingerprintSchemaSources-C4PkhFFQ.mjs";import{schemaFromIr as vr}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as Nr,validatorIrToJsonSchema as gr}from"./packem_shared/LUNORA_ERROR_CODES-C2s0xWQD.mjs";import{SDK_LANGUAGES as Rr,SDK_TARGETS as Tr,generateSdk as hr}from"./packem_shared/SDK_LANGUAGES-Df_CnJx5.mjs";import{redact as _r,secretKindOf as Lr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as Fr}from"./packem_shared/emitDrizzleSchema-CpOGYfyl.mjs";import{default as Dr}from"./packem_shared/emitFunctions-BeKgL3dl.mjs";import{e as yr}from"./packem_shared/server-DSUfd6Tc.mjs";import{e as Gr}from"./packem_shared/shard-BTfJuEeP.mjs";import{G as jr}from"./packem_shared/shared-DnCokNcE.mjs";import{MESSAGE_SOLUTIONS as kr,findSolutionByMessage as Wr}from"@lunora/errors";import{PROJECT_CONFIG_FILENAMES as Vr,findProjectConfigFile as zr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs";import{s as qr,t as wr,u as Jr}from"./packem_shared/shard-runtime-CkaEBSdL.mjs";import{emitApi as Xr,emitCollections as Zr,emitInternalApi as $r}from"./packem_shared/emitApi-Zx6VPN-7.mjs";import{emitCrons as ro,emitScheduler as oo,emitVectors as to,emitWranglerCronTriggers as so}from"./packem_shared/emitCrons-Gd8jD8jF.mjs";import{emitDataModel as io}from"./packem_shared/emitDataModel-DdtjdNg3.mjs";import{isTypedSchema as fo}from"./packem_shared/isTypedSchema-CKzc3ioR.mjs";const e="0.0.0";export{N as AGENTS_FILENAME,E as CAPABILITY_PROBES,L as CONTAINERS_FILENAME,A as CodegenDiagnosticError,Ze as DEFAULT_TARGET,j as FLAGS_FILENAME,jr as GENERATED_HEADER,Nr as LUNORA_ERROR_CODES,kr as LUNORA_SOLUTION_RULES,ee as MUTATORS_FILENAME,ae as NOTIFY_FILENAME,qe as OPENRPC_VERSION,Vr as PROJECT_CONFIG_FILENAMES,xe as QUEUES_FILENAME,ir as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Rr as SDK_LANGUAGES,Tr as SDK_TARGETS,Me as SHAPES_FILENAME,lr as SchemaSnapshotParseError,e as VERSION,ye as WORKFLOWS_FILENAME,Ke as buildOpenApiDocument,we as buildOpenRpcDocument,cr as buildSchemaSnapshot,b as capabilitiesUsedBy,mr as createCodegenProject,n as describeErrorLevelFindings,v as diagnosticAt,s as diffSchemaSnapshots,g as discoverAgents,I as discoverAuthApiCalls,M as discoverContainers,P as discoverCrons,B as discoverFlags,W as discoverFunctions,V as discoverHttpRoutes,Q as discoverHyperdriveCalls,w as discoverInserts,Y as discoverMaskProcedures,Z as discoverMigrations,re as discoverMutators,te as discoverNondeterministicCalls,ie as discoverNotifyCalls,me as discoverNotifyChannels,fe as discoverNotifyConfig,le as discoverQueries,Se as discoverQueues,ue as discoverR2sqlCalls,Ne as discoverRlsMetadata,ve as discoverRlsProcedures,Oe as discoverSandboxUsage,Te as discoverSchema,Fe as discoverShapes,De as discoverStorageRulesMetadata,Ue as discoverWorkflows,qr as emitAgents,Xr as emitApi,He as emitApp,Zr as emitCollections,wr as emitContainers,ro as emitCrons,io as emitDataModel,Fr as emitDrizzleSchema,Dr as emitFunctions,$r as emitInternalApi,Ve as emitOpenApi,ze as emitOpenApiModule,Je as emitOpenRpc,Ye as emitOpenRpcModule,oo as emitScheduler,yr as emitServer,Gr as emitShard,to as emitVectors,Jr as emitWorkflows,so as emitWranglerCronTriggers,l as errorAdvisoryNames,c as errorPlatformDiagnosticNames,xr as evaluateSchemaDrift,Wr as findLunoraSolution,zr as findProjectConfigFile,fr as findTsconfig,ur as fingerprintSchemaSources,y as foldCapabilitySignals,m as formatAdvisories,hr as generateSdk,Be as isD1GlobalTable,ke as isHyperdriveGlobalTable,R as isTestPath,fo as isTypedSchema,f as lintSchema,T as listLunoraSourceFiles,tr as loadProjectConfig,U as mayReadCapabilityContext,Sr as parseSchemaSnapshot,$e as platformMatrixIds,pe as readPackageDependencies,sr as readProjectConfigLiterals,er as readProjectTarget,Ie as readServiceBindings,_r as redact,dr as refreshCodegenProject,rr as resolveCodegenTarget,_e as resolveServiceBindings,pr as runCodegen,vr as schemaFromIr,Lr as secretKindOf,a as serializeSchemaSnapshot,x as sortedUniqueNames,G as sourceCapabilitySignals,d as toAdvisorContext,gr as validatorIrToJsonSchema};
1
+ import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as s,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{formatAdvisories as m,lintSchema as f,toAdvisorContext as d}from"./packem_shared/formatAdvisories-DwmUKYuc.mjs";import{describeErrorLevelFindings as n,errorAdvisoryNames as l,errorPlatformDiagnosticNames as c,sortedUniqueNames as x}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-brcmKenl.mjs";import{CodegenDiagnosticError as A,diagnosticAt as v}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as N,discoverAgents as g}from"./packem_shared/AGENTS_FILENAME-CwwSEW6a.mjs";import{isTestPath as R,listLunoraSourceFiles as T}from"./packem_shared/isTestPath-B81lOULB.mjs";import{default as I}from"./packem_shared/discoverAuthApiCalls-DAaK0HUK.mjs";import{CONTAINERS_FILENAME as L,discoverContainers as M}from"./packem_shared/CONTAINERS_FILENAME-BtX5vWh8.mjs";import{default as P}from"./packem_shared/discoverCrons-DF7dOP9x.mjs";import{capabilitiesUsedBy as b,foldCapabilitySignals as y,mayReadCapabilityContext as U,sourceCapabilitySignals as G}from"./packem_shared/capabilitiesUsedBy-QgSZyE0T.mjs";import{FLAGS_FILENAME as j,discoverFlags as B}from"./packem_shared/FLAGS_FILENAME-Bf0MSlHH.mjs";import{default as W}from"./packem_shared/discoverFunctions-DsQwrwWq.mjs";import{default as V}from"./packem_shared/discoverHttpRoutes-Cv-h-Yuc.mjs";import{default as Q}from"./packem_shared/discoverHyperdriveCalls-xy2G6igG.mjs";import{default as w}from"./packem_shared/discoverInserts-CQsoloGk.mjs";import{d as Y}from"./packem_shared/index-BoPXSW7g.mjs";import{default as Z}from"./packem_shared/discoverMigrations-uxm9qHrr.mjs";import{MUTATORS_FILENAME as ee,discoverMutators as re}from"./packem_shared/MUTATORS_FILENAME-Dl1tElqi.mjs";import{default as te}from"./packem_shared/discoverNondeterministicCalls-Dm7_PJoA.mjs";import{NOTIFY_FILENAME as ae,discoverNotifyCalls as ie,discoverNotifyChannels as me,discoverNotifyConfig as fe}from"./packem_shared/NOTIFY_FILENAME-BeTurUSC.mjs";import{default as pe}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as le}from"./packem_shared/discoverQueries-BqECbkm9.mjs";import{QUEUES_FILENAME as xe,discoverQueues as Se}from"./packem_shared/QUEUES_FILENAME-D588u733.mjs";import{default as ue}from"./packem_shared/discoverR2sqlCalls-I9IqJFcy.mjs";import{default as ve}from"./packem_shared/discoverRlsProcedures-Bkohn4ZR.mjs";import{default as Ne}from"./packem_shared/discoverRlsMetadata-Cu4bc5KZ.mjs";import{discoverSandboxUsage as Oe}from"./packem_shared/discoverSandboxUsage-w6Q3RvxZ.mjs";import{default as Te}from"./packem_shared/discoverSchema-BCxeD80d.mjs";import{readServiceBindings as Ie,resolveServiceBindings as _e}from"./packem_shared/readServiceBindings-DvqIThzd.mjs";import{SHAPES_FILENAME as Me,discoverShapes as Fe}from"./packem_shared/SHAPES_FILENAME-D-Q8lSEw.mjs";import{default as De}from"./packem_shared/discoverStorageRulesMetadata-D6rjgKYC.mjs";import{WORKFLOWS_FILENAME as ye,discoverWorkflows as Ue}from"./packem_shared/WORKFLOWS_FILENAME-BGMSNTDC.mjs";import{emitApp as He}from"./packem_shared/emitApp-D7G7gmV7.mjs";import{isD1GlobalTable as Be,isHyperdriveGlobalTable as ke}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as Ke,emitOpenApi as Ve,emitOpenApiModule as ze}from"./packem_shared/buildOpenApiDocument-DFv-RYZU.mjs";import{OPENRPC_VERSION as qe,buildOpenRpcDocument as we,emitOpenRpc as Je,emitOpenRpcModule as Ye}from"./packem_shared/OPENRPC_VERSION-CCY7xqSL.mjs";import{DEFAULT_TARGET as Ze,platformMatrixIds as $e,readProjectTarget as er,resolveCodegenTarget as rr}from"./packem_shared/DEFAULT_TARGET-3U7x981M.mjs";import{l as tr,r as sr}from"./packem_shared/project-config-file-BV7RR-l6.mjs";import{SCHEMA_SNAPSHOT_FILENAME as ir,createCodegenProject as mr,findTsconfig as fr,refreshCodegenProject as dr,runCodegen as pr}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-Ddnww-0x.mjs";import{SchemaSnapshotParseError as lr,buildSchemaSnapshot as cr,evaluateSchemaDrift as xr,parseSchemaSnapshot as Sr}from"./packem_shared/SchemaSnapshotParseError-CPOXlFhI.mjs";import{default as ur}from"./packem_shared/fingerprintSchemaSources-eVG9aVt0.mjs";import{schemaFromIr as vr}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as Nr,validatorIrToJsonSchema as gr}from"./packem_shared/LUNORA_ERROR_CODES-C2s0xWQD.mjs";import{SDK_LANGUAGES as Rr,SDK_TARGETS as Tr,generateSdk as hr}from"./packem_shared/SDK_LANGUAGES-Df_CnJx5.mjs";import{redact as _r,secretKindOf as Lr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as Fr}from"./packem_shared/emitDrizzleSchema-CpOGYfyl.mjs";import{default as Dr}from"./packem_shared/emitFunctions-BeKgL3dl.mjs";import{e as yr}from"./packem_shared/server-DSUfd6Tc.mjs";import{e as Gr}from"./packem_shared/shard-BTfJuEeP.mjs";import{G as jr}from"./packem_shared/shared-DnCokNcE.mjs";import{MESSAGE_SOLUTIONS as kr,findSolutionByMessage as Wr}from"@lunora/errors";import{PROJECT_CONFIG_FILENAMES as Vr,findProjectConfigFile as zr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs";import{s as qr,t as wr,u as Jr}from"./packem_shared/shard-runtime-CkaEBSdL.mjs";import{emitApi as Xr,emitCollections as Zr,emitInternalApi as $r}from"./packem_shared/emitApi-Zx6VPN-7.mjs";import{emitCrons as ro,emitScheduler as oo,emitVectors as to,emitWranglerCronTriggers as so}from"./packem_shared/emitCrons-Gd8jD8jF.mjs";import{emitDataModel as io}from"./packem_shared/emitDataModel-DdtjdNg3.mjs";import{isTypedSchema as fo}from"./packem_shared/isTypedSchema-CKzc3ioR.mjs";const e="0.0.0";export{N as AGENTS_FILENAME,E as CAPABILITY_PROBES,L as CONTAINERS_FILENAME,A as CodegenDiagnosticError,Ze as DEFAULT_TARGET,j as FLAGS_FILENAME,jr as GENERATED_HEADER,Nr as LUNORA_ERROR_CODES,kr as LUNORA_SOLUTION_RULES,ee as MUTATORS_FILENAME,ae as NOTIFY_FILENAME,qe as OPENRPC_VERSION,Vr as PROJECT_CONFIG_FILENAMES,xe as QUEUES_FILENAME,ir as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Rr as SDK_LANGUAGES,Tr as SDK_TARGETS,Me as SHAPES_FILENAME,lr as SchemaSnapshotParseError,e as VERSION,ye as WORKFLOWS_FILENAME,Ke as buildOpenApiDocument,we as buildOpenRpcDocument,cr as buildSchemaSnapshot,b as capabilitiesUsedBy,mr as createCodegenProject,n as describeErrorLevelFindings,v as diagnosticAt,s as diffSchemaSnapshots,g as discoverAgents,I as discoverAuthApiCalls,M as discoverContainers,P as discoverCrons,B as discoverFlags,W as discoverFunctions,V as discoverHttpRoutes,Q as discoverHyperdriveCalls,w as discoverInserts,Y as discoverMaskProcedures,Z as discoverMigrations,re as discoverMutators,te as discoverNondeterministicCalls,ie as discoverNotifyCalls,me as discoverNotifyChannels,fe as discoverNotifyConfig,le as discoverQueries,Se as discoverQueues,ue as discoverR2sqlCalls,Ne as discoverRlsMetadata,ve as discoverRlsProcedures,Oe as discoverSandboxUsage,Te as discoverSchema,Fe as discoverShapes,De as discoverStorageRulesMetadata,Ue as discoverWorkflows,qr as emitAgents,Xr as emitApi,He as emitApp,Zr as emitCollections,wr as emitContainers,ro as emitCrons,io as emitDataModel,Fr as emitDrizzleSchema,Dr as emitFunctions,$r as emitInternalApi,Ve as emitOpenApi,ze as emitOpenApiModule,Je as emitOpenRpc,Ye as emitOpenRpcModule,oo as emitScheduler,yr as emitServer,Gr as emitShard,to as emitVectors,Jr as emitWorkflows,so as emitWranglerCronTriggers,l as errorAdvisoryNames,c as errorPlatformDiagnosticNames,xr as evaluateSchemaDrift,Wr as findLunoraSolution,zr as findProjectConfigFile,fr as findTsconfig,ur as fingerprintSchemaSources,y as foldCapabilitySignals,m as formatAdvisories,hr as generateSdk,Be as isD1GlobalTable,ke as isHyperdriveGlobalTable,R as isTestPath,fo as isTypedSchema,f as lintSchema,T as listLunoraSourceFiles,tr as loadProjectConfig,U as mayReadCapabilityContext,Sr as parseSchemaSnapshot,$e as platformMatrixIds,pe as readPackageDependencies,sr as readProjectConfigLiterals,er as readProjectTarget,Ie as readServiceBindings,_r as redact,dr as refreshCodegenProject,rr as resolveCodegenTarget,_e as resolveServiceBindings,pr as runCodegen,vr as schemaFromIr,Lr as secretKindOf,a as serializeSchemaSnapshot,x as sortedUniqueNames,G as sourceCapabilitySignals,d as toAdvisorContext,gr 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-CiIyKqhF.mjs";import{a as h}from"./attribution-0YtR4LvZ.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};
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-B81lOULB.mjs";import{a as h}from"./attribution-BUciBs1M.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};
@@ -1 +1 @@
1
- import{existsSync as T}from"node:fs";import{join as j}from"node:path";import{containerClassName as I,containerBindingName as A,DURABLE_OBJECT_POLICY_FORBIDDEN_KEYS as O,isManagedImage as k,isCloudflareRegistryDigest as C,normalizeContainerImage as f}from"@lunora/container";import{SyntaxKind as S,Node as s}from"ts-morph";import{diagnosticAt as a}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{stringPropertyFor as _,findObjectProperty as p,symbolConstInitializer as D,outermostValueWrapper as w,isWriteTarget as M}from"./isTestPath-CiIyKqhF.mjs";import{a as F}from"./attribution-0YtR4LvZ.mjs";import{a as b}from"./project-config-file-Bv2l-Kmm.mjs";const V="containers.ts",K=t=>{const e=t.getSymbol();if(!e)return t.getText()==="defineContainer";for(const n of e.getDeclarations())if(s.isImportSpecifier(n))return n.getImportDeclaration().getModuleSpecifierValue()!=="@lunora/container"?!1:n.getNameNode().getText()==="defineContainer";return!1},d=_("container"),y=(t,e,n)=>{if(s.isNumericLiteral(t))return t.getLiteralValue();throw a(t,`container "${e}": \`${n}\` must be a static number literal — it is deploy configuration codegen writes into wrangler.jsonc`)},$=(t,e)=>{if(s.isStringLiteral(t)||s.isNoSubstitutionTemplateLiteral(t))return f(t.getLiteralValue());if(s.isObjectLiteralExpression(t)){const n=p(t,"registry");if(n&&s.isPropertyAssignment(n)){const r=n.getInitializerOrThrow();return f({registry:d(r,e,"image.registry")})}const i=p(t,"build");if(i&&s.isPropertyAssignment(i)){const r=i.getInitializerOrThrow();return f({build:d(r,e,"image.build")})}}throw a(t,`container "${e}": \`image\` must be a static string path, { registry: "…" }, or { build: "…" } literal`)},B=new Set(["buildArgs","image","images","instanceType","maxInstances","name","rollout","sandbox","schedulingPolicy"]),R=new Set(["gracePeriodSeconds","stepPercentage"]),E=t=>{let e=t;for(;s.isAsExpression(e)||s.isSatisfiesExpression(e)||s.isTypeAssertion(e)||s.isParenthesizedExpression(e);)e=e.getExpression();return e},U=(t,e)=>e.getDescendantsOfKind(S.Identifier).some(n=>{if(n.getSymbol()!==t)return!1;let i=w(n),r=i.getParent();if(s.isCallExpression(r)&&r.getExpression().getText()==="Object.assign")return r.getArguments()[0]===i;for(;(s.isPropertyAccessExpression(r)||s.isElementAccessExpression(r))&&r.getExpression()===i;){if(M(r))return!0;i=w(r),r=i.getParent()}return!1}),z=16,L=(t,e,n,i)=>{let r={name:n,symbol:t},o;for(let c=0;c<z;c+=1){const l=D(r.symbol);if(l===void 0||!s.isExpression(l))return o;if(o=E(l),s.isObjectLiteralExpression(o)&&r.symbol!==void 0&&U(r.symbol,e.getSourceFile()))throw a(e,`${i}: \`${r.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;r={name:o.getText(),symbol:o.getSymbol()}}return o},P=(t,e)=>{const n=E(t);return s.isIdentifier(n)?L(n.getSymbol(),n,n.getText(),e)??n:n},N=t=>{const e=t.getNonNullableType();return(e.isUnion()?e.getUnionTypes():[e]).flatMap(i=>i.getApparentType().getProperties().map(r=>r.getName()))},Y=(t,e,n)=>{const i=t.getExpression().getType(),r=e==="every"||i.isAny()||i.isUnknown()?["its keys"]:[...new Set(N(i))].filter(o=>e.has(o)).map(o=>`\`${o}\``);if(r.length>0)throw a(t,`${n}: this spread can set ${r.join(", ")}, which codegen writes into wrangler.jsonc and so must read statically. Spread a module-scope \`const\` object literal, or write the keys inline.`)},W=(t,e,n)=>{const i=b(t),r=s.isShorthandPropertyAssignment(t)?L(t.getValueSymbol(),t,i,n):void 0;if(r!==void 0)return[i,r];if(e==="every"||e.has(i))throw a(t,`${n}: \`${i}\` 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,n,i=new Set)=>{const r=[],o=new Set(i).add(t);for(const c of t.getProperties())if(s.isPropertyAssignment(c))r.push([b(c),P(c.getInitializerOrThrow(),n)]);else if(s.isSpreadAssignment(c))r.push(...q(c,e,n,o));else{const l=W(c,e,n);l!==void 0&&r.push(l)}return r},q=(t,e,n,i)=>{const r=P(t.getExpression(),n);if(!s.isObjectLiteralExpression(r))return Y(t,e,n),[];if(i.has(r))throw a(t,`${n}: this spread refers back to an object it is part of, so it has no static value.`);return m(r,e,n,i)},x=(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 n={};for(const[i,r]of m(t,"every",`container "${e}" buildArgs`))n[i]=d(r,e,`buildArgs.${i}`);return Object.keys(n).length>0?n:void 0},H=(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 n={};for(const[i,r]of m(t,R,`container "${e}" rollout`))(i==="gracePeriodSeconds"||i==="stepPercentage")&&(n[i]=y(r,e,`rollout.${i}`));return n.gracePeriodSeconds===void 0&&n.stepPercentage===void 0?void 0:n},v=t=>{if(s.isTrueLiteral(t))return!0;if(s.isFalseLiteral(t))return!1},J=t=>{if(s.isStringLiteral(t)||s.isNoSubstitutionTemplateLiteral(t)||s.isNumericLiteral(t))return t.getLiteralValue()},X=(t,e)=>{if(s.isStringLiteral(t))return t.getLiteralValue();if(s.isObjectLiteralExpression(t)){const n={};for(const i of t.getProperties()){if(!s.isPropertyAssignment(i))throw a(i,`container "${e}": \`instanceType\` must be an object of static number literals`);const r=b(i);if(r!=="diskMb"&&r!=="memoryMib"&&r!=="vcpu")throw a(i,`container "${e}": unknown \`instanceType\` field "${r}" — expected vcpu, memoryMib, or diskMb`);n[r]=y(i.getInitializerOrThrow(),e,`instanceType.${r}`)}return n}throw a(t,`container "${e}": \`instanceType\` must be a static string or { vcpu, memoryMib, diskMb } literal`)},G=(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 n={};for(const[i,r]of m(t,"every",`container "${e}" images`)){const o=$(r,e);if(o.kind==="build")throw a(r,`container "${e}": \`images["${i}"]\` cannot be a Railpack { build } source — use a Dockerfile path or a { registry } reference`);if(o.kind==="registry"&&!C(o.reference))throw a(r,`container "${e}": \`images["${i}"].registry\` must be a digest-pinned (@sha256) reference under registry.cloudflare.com — push other registries' images there first`);n[i]=o}return n},Q=(t,e)=>{const n=t.findLast(([r])=>r==="schedulingPolicy");if(n===void 0)return;const i=d(n[1],e,"schedulingPolicy");if(i!=="default"&&i!=="durable_object")throw a(n[1],`container "${e}": unknown \`schedulingPolicy\` "${i}" — use "default" or "durable_object"`);return i==="durable_object"?i:void 0},Z=(t,e,n,i)=>{if(n!==void 0&&O.includes(t))throw a(e,`container "${i}": \`${t}\` is not supported with schedulingPolicy "durable_object"`);if(n===void 0&&t==="images")throw a(e,`container "${i}": \`images\` needs schedulingPolicy "durable_object"`)},ee=(t,e,n,i)=>{const{base:r,policy:o}=n;switch(t){case"buildArgs":{r.buildArgs=x(e,i);break}case"enableInternet":{r.enableInternet=v(e);break}case"image":{n.scheduled||(o.image=$(e,i));break}case"images":{o.images=G(e,i);break}case"instanceType":{r.instanceType=X(e,i);break}case"maxInstances":{o.maxInstances=y(e,i,"maxInstances");break}case"name":{r.name=d(e,i,"name");break}case"rollout":{o.rollout=H(e,i);break}case"sandbox":{const c=v(e);if(c===void 0)throw a(e,`container "${i}": \`sandbox\` must be a static true/false literal`);r.sandbox=c;break}case"sleepAfter":{r.sleepAfter=J(e);break}}},te=(t,e,n)=>{const i=t.findLast(([o])=>o==="image")?.[1];if(i===void 0||!(s.isStringLiteral(i)||s.isNoSubstitutionTemplateLiteral(i)))return;const r=i.getLiteralValue();if(!Object.hasOwn(e??{},r)&&!k(r))throw a(i,`container "${n}": \`image\` "${r}" must name an entry of \`images\` or a Cloudflare-managed "cloudflare/…" image`)},ie=(t,e)=>{const n=t.getArguments()[0];if(!n||!s.isObjectLiteralExpression(n))throw a(t,`container "${e}": defineContainer must be passed an inline object literal`);const i=m(n,B,`container "${e}"`),r=Q(i,e),o={base:{bindingName:A(e),className:I(e),exportName:e},policy:{},scheduled:r!==void 0};for(const[g,u]of i)Z(g,u,r,e),ee(g,u,o,e);const{base:c,policy:l}=o;if(r==="durable_object")return te(i,l.images,e),{...c,...l.images===void 0?{}:{images:l.images},schedulingPolicy:r};if(l.image===void 0)throw a(n,`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}}},ne=t=>{const e=[],n=new Map;for(const i of t.getVariableDeclarations()){const r=i.getInitializer();if(r?.getKind()!==S.CallExpression)continue;const o=r,c=o.getExpression();if(!s.isIdentifier(c)||!K(c))continue;const l=i.getNameNode();if(!s.isIdentifier(l)){if(i.getVariableStatement()?.hasExportKeyword()!==!0)continue;throw a(l,"defineContainer exports must be plain named exports (no destructuring)")}const g=F(i,"binding");if(g===void 0)continue;const u=ie(o,g),h=n.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`);n.set(u.bindingName,u.exportName),e.push(u)}return e},de=(t,e)=>{const n=j(e,V);if(!T(n))return[];const i=t.getSourceFile(n)??t.addSourceFileAtPath(n),r=ne(i);return r.sort((o,c)=>o.exportName.localeCompare(c.exportName)),r};export{V as CONTAINERS_FILENAME,de as discoverContainers};
1
+ import{existsSync as T}from"node:fs";import{join as j}from"node:path";import{containerClassName as I,containerBindingName as A,DURABLE_OBJECT_POLICY_FORBIDDEN_KEYS as O,isManagedImage as k,isCloudflareRegistryDigest as C,normalizeContainerImage as f}from"@lunora/container";import{SyntaxKind as S,Node as s}from"ts-morph";import{diagnosticAt as a}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{stringPropertyFor as _,findObjectProperty as p,symbolConstInitializer as D,outermostValueWrapper as w,isWriteTarget as M}from"./isTestPath-B81lOULB.mjs";import{a as F}from"./attribution-BUciBs1M.mjs";import{a as b}from"./project-config-file-BV7RR-l6.mjs";const V="containers.ts",K=t=>{const e=t.getSymbol();if(!e)return t.getText()==="defineContainer";for(const n of e.getDeclarations())if(s.isImportSpecifier(n))return n.getImportDeclaration().getModuleSpecifierValue()!=="@lunora/container"?!1:n.getNameNode().getText()==="defineContainer";return!1},d=_("container"),y=(t,e,n)=>{if(s.isNumericLiteral(t))return t.getLiteralValue();throw a(t,`container "${e}": \`${n}\` must be a static number literal — it is deploy configuration codegen writes into wrangler.jsonc`)},$=(t,e)=>{if(s.isStringLiteral(t)||s.isNoSubstitutionTemplateLiteral(t))return f(t.getLiteralValue());if(s.isObjectLiteralExpression(t)){const n=p(t,"registry");if(n&&s.isPropertyAssignment(n)){const r=n.getInitializerOrThrow();return f({registry:d(r,e,"image.registry")})}const i=p(t,"build");if(i&&s.isPropertyAssignment(i)){const r=i.getInitializerOrThrow();return f({build:d(r,e,"image.build")})}}throw a(t,`container "${e}": \`image\` must be a static string path, { registry: "…" }, or { build: "…" } literal`)},B=new Set(["buildArgs","image","images","instanceType","maxInstances","name","rollout","sandbox","schedulingPolicy"]),R=new Set(["gracePeriodSeconds","stepPercentage"]),E=t=>{let e=t;for(;s.isAsExpression(e)||s.isSatisfiesExpression(e)||s.isTypeAssertion(e)||s.isParenthesizedExpression(e);)e=e.getExpression();return e},U=(t,e)=>e.getDescendantsOfKind(S.Identifier).some(n=>{if(n.getSymbol()!==t)return!1;let i=w(n),r=i.getParent();if(s.isCallExpression(r)&&r.getExpression().getText()==="Object.assign")return r.getArguments()[0]===i;for(;(s.isPropertyAccessExpression(r)||s.isElementAccessExpression(r))&&r.getExpression()===i;){if(M(r))return!0;i=w(r),r=i.getParent()}return!1}),z=16,L=(t,e,n,i)=>{let r={name:n,symbol:t},o;for(let c=0;c<z;c+=1){const l=D(r.symbol);if(l===void 0||!s.isExpression(l))return o;if(o=E(l),s.isObjectLiteralExpression(o)&&r.symbol!==void 0&&U(r.symbol,e.getSourceFile()))throw a(e,`${i}: \`${r.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;r={name:o.getText(),symbol:o.getSymbol()}}return o},P=(t,e)=>{const n=E(t);return s.isIdentifier(n)?L(n.getSymbol(),n,n.getText(),e)??n:n},N=t=>{const e=t.getNonNullableType();return(e.isUnion()?e.getUnionTypes():[e]).flatMap(i=>i.getApparentType().getProperties().map(r=>r.getName()))},Y=(t,e,n)=>{const i=t.getExpression().getType(),r=e==="every"||i.isAny()||i.isUnknown()?["its keys"]:[...new Set(N(i))].filter(o=>e.has(o)).map(o=>`\`${o}\``);if(r.length>0)throw a(t,`${n}: this spread can set ${r.join(", ")}, which codegen writes into wrangler.jsonc and so must read statically. Spread a module-scope \`const\` object literal, or write the keys inline.`)},W=(t,e,n)=>{const i=b(t),r=s.isShorthandPropertyAssignment(t)?L(t.getValueSymbol(),t,i,n):void 0;if(r!==void 0)return[i,r];if(e==="every"||e.has(i))throw a(t,`${n}: \`${i}\` 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,n,i=new Set)=>{const r=[],o=new Set(i).add(t);for(const c of t.getProperties())if(s.isPropertyAssignment(c))r.push([b(c),P(c.getInitializerOrThrow(),n)]);else if(s.isSpreadAssignment(c))r.push(...q(c,e,n,o));else{const l=W(c,e,n);l!==void 0&&r.push(l)}return r},q=(t,e,n,i)=>{const r=P(t.getExpression(),n);if(!s.isObjectLiteralExpression(r))return Y(t,e,n),[];if(i.has(r))throw a(t,`${n}: this spread refers back to an object it is part of, so it has no static value.`);return m(r,e,n,i)},x=(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 n={};for(const[i,r]of m(t,"every",`container "${e}" buildArgs`))n[i]=d(r,e,`buildArgs.${i}`);return Object.keys(n).length>0?n:void 0},H=(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 n={};for(const[i,r]of m(t,R,`container "${e}" rollout`))(i==="gracePeriodSeconds"||i==="stepPercentage")&&(n[i]=y(r,e,`rollout.${i}`));return n.gracePeriodSeconds===void 0&&n.stepPercentage===void 0?void 0:n},v=t=>{if(s.isTrueLiteral(t))return!0;if(s.isFalseLiteral(t))return!1},J=t=>{if(s.isStringLiteral(t)||s.isNoSubstitutionTemplateLiteral(t)||s.isNumericLiteral(t))return t.getLiteralValue()},X=(t,e)=>{if(s.isStringLiteral(t))return t.getLiteralValue();if(s.isObjectLiteralExpression(t)){const n={};for(const i of t.getProperties()){if(!s.isPropertyAssignment(i))throw a(i,`container "${e}": \`instanceType\` must be an object of static number literals`);const r=b(i);if(r!=="diskMb"&&r!=="memoryMib"&&r!=="vcpu")throw a(i,`container "${e}": unknown \`instanceType\` field "${r}" — expected vcpu, memoryMib, or diskMb`);n[r]=y(i.getInitializerOrThrow(),e,`instanceType.${r}`)}return n}throw a(t,`container "${e}": \`instanceType\` must be a static string or { vcpu, memoryMib, diskMb } literal`)},G=(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 n={};for(const[i,r]of m(t,"every",`container "${e}" images`)){const o=$(r,e);if(o.kind==="build")throw a(r,`container "${e}": \`images["${i}"]\` cannot be a Railpack { build } source — use a Dockerfile path or a { registry } reference`);if(o.kind==="registry"&&!C(o.reference))throw a(r,`container "${e}": \`images["${i}"].registry\` must be a digest-pinned (@sha256) reference under registry.cloudflare.com — push other registries' images there first`);n[i]=o}return n},Q=(t,e)=>{const n=t.findLast(([r])=>r==="schedulingPolicy");if(n===void 0)return;const i=d(n[1],e,"schedulingPolicy");if(i!=="default"&&i!=="durable_object")throw a(n[1],`container "${e}": unknown \`schedulingPolicy\` "${i}" — use "default" or "durable_object"`);return i==="durable_object"?i:void 0},Z=(t,e,n,i)=>{if(n!==void 0&&O.includes(t))throw a(e,`container "${i}": \`${t}\` is not supported with schedulingPolicy "durable_object"`);if(n===void 0&&t==="images")throw a(e,`container "${i}": \`images\` needs schedulingPolicy "durable_object"`)},ee=(t,e,n,i)=>{const{base:r,policy:o}=n;switch(t){case"buildArgs":{r.buildArgs=x(e,i);break}case"enableInternet":{r.enableInternet=v(e);break}case"image":{n.scheduled||(o.image=$(e,i));break}case"images":{o.images=G(e,i);break}case"instanceType":{r.instanceType=X(e,i);break}case"maxInstances":{o.maxInstances=y(e,i,"maxInstances");break}case"name":{r.name=d(e,i,"name");break}case"rollout":{o.rollout=H(e,i);break}case"sandbox":{const c=v(e);if(c===void 0)throw a(e,`container "${i}": \`sandbox\` must be a static true/false literal`);r.sandbox=c;break}case"sleepAfter":{r.sleepAfter=J(e);break}}},te=(t,e,n)=>{const i=t.findLast(([o])=>o==="image")?.[1];if(i===void 0||!(s.isStringLiteral(i)||s.isNoSubstitutionTemplateLiteral(i)))return;const r=i.getLiteralValue();if(!Object.hasOwn(e??{},r)&&!k(r))throw a(i,`container "${n}": \`image\` "${r}" must name an entry of \`images\` or a Cloudflare-managed "cloudflare/…" image`)},ie=(t,e)=>{const n=t.getArguments()[0];if(!n||!s.isObjectLiteralExpression(n))throw a(t,`container "${e}": defineContainer must be passed an inline object literal`);const i=m(n,B,`container "${e}"`),r=Q(i,e),o={base:{bindingName:A(e),className:I(e),exportName:e},policy:{},scheduled:r!==void 0};for(const[g,u]of i)Z(g,u,r,e),ee(g,u,o,e);const{base:c,policy:l}=o;if(r==="durable_object")return te(i,l.images,e),{...c,...l.images===void 0?{}:{images:l.images},schedulingPolicy:r};if(l.image===void 0)throw a(n,`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}}},ne=t=>{const e=[],n=new Map;for(const i of t.getVariableDeclarations()){const r=i.getInitializer();if(r?.getKind()!==S.CallExpression)continue;const o=r,c=o.getExpression();if(!s.isIdentifier(c)||!K(c))continue;const l=i.getNameNode();if(!s.isIdentifier(l)){if(i.getVariableStatement()?.hasExportKeyword()!==!0)continue;throw a(l,"defineContainer exports must be plain named exports (no destructuring)")}const g=F(i,"binding");if(g===void 0)continue;const u=ie(o,g),h=n.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`);n.set(u.bindingName,u.exportName),e.push(u)}return e},de=(t,e)=>{const n=j(e,V);if(!T(n))return[];const i=t.getSourceFile(n)??t.addSourceFileAtPath(n),r=ne(i);return r.sort((o,c)=>o.exportName.localeCompare(c.exportName)),r};export{V as CONTAINERS_FILENAME,de as discoverContainers};
@@ -1 +1 @@
1
- import{NODE_CAPABILITIES as f,CLOUDFLARE_CAPABILITIES as h,CELLD_CAPABILITIES as b}from"@lunora/platform";import{r as g}from"./project-config-file-Bv2l-Kmm.mjs";const d="cloudflare",v=t=>{const{target:e}=g(t);return e!==void 0&&e.length>0?e:void 0},A=(t,e)=>e??v(t)??d,L=(t,e)=>{if(e!==void 0)return[];const{target:a,unreadable:r}=g(t);return r!==!0||a!==void 0?[]:[{level:"warn",message:`lunora.config declares a \`target\` that codegen cannot read without evaluating it, so the "${d}" surface was emitted. \`runCodegen\` resolves the target synchronously, which means it reads literals only.`,name:"platform_unreadable_target",remediation:`Write \`target\` as a string literal on the config's default export (\`export default { target: "${d}" }\`), or pass \`--target\`.`,target:d}]},u={celld:b,cloudflare:h,node:f},C=()=>Object.keys(u).toSorted((t,e)=>t.localeCompare(e)),S={access:null,ai:"ai",aiSearch:"aiSearch",analytics:"analytics",analyticsSql:"analyticsSql",artifacts:"artifacts",browser:"browser",container:"containers",flags:null,hyperdrive:"hyperdrive",images:"images",kv:"keyValueStore",mail:"mail",notify:null,payments:null,pipelines:"pipelines",r2sql:null,scheduler:"scheduler",storage:"objectStorage",vectors:"vectorStore",workflows:"workflows",x402:"secrets"},w=["agents","commitOrderedTables","containerEgressPolicy","containerRuntimeScheduling","containerSandboxTools","cronTriggers","crossShardFanout","durableStreams","globalTables","queues","relationGraph","secrets","services","topics","vectorStore","workerLoaders","workflowRollback","workflowSchedules"],m={agents:"durable agents (`defineAgent`)",commitOrderedTables:"commit-ordered tables (`.commitOrdered()`)",containerEgressPolicy:"container egress policies (`defineContainer({ allowedHosts | deniedHosts | interceptHttps })`)",containerRuntimeScheduling:'per-instance container images and snapshots (`defineContainer({ schedulingPolicy: "durable_object" })`)',containerSandboxTools:"container sandbox helpers — files, directory backups, bucket mounts (`defineContainer({ sandbox: true })`)",cronTriggers:"declared cron triggers (`cronJobs()`)",crossShardFanout:"cross-shard fan-out queries (a `.shardBy(...)` schema)",durableStreams:"durable streams (`.stream(handler, { durable: true })`)",globalTables:"global tables (`.global()`)",queues:"queues (`defineQueue`)",relationGraph:"relation-graph traversal (`ctx.db.related`, derived from `v.id(...)` columns)",secrets:"the secrets store (`ctx.secrets`)",services:"service bindings to sibling Workers (`lunora.config` `services`)",topics:"pub/sub topics (`defineTopic` / `defineSubscription`)",vectorStore:"vector indexes (`.vectorize()`)",workerLoaders:"sandboxed agent scripts (`jsCodeTool`, on Worker Loaders)",workflowRollback:"workflow step rollback (`defineStep({ rollback })`)",workflowSchedules:"scheduled workflow instances (`defineWorkflow({ schedules })`)"},y=(t,e,a)=>({level:"error",message:`${e.name} does not support ${m[t]}, which this app declares.`,name:"platform_unsupported_feature",remediation:`Remove the declaration, or deploy to a target whose capability matrix marks "${t}" as native or emulated.`,target:a}),T=(t,e,a)=>({level:"error",message:`${e.name}'s capability matrix does not declare a support level for ${m[t]}, which this app declares. Treated as unsupported.`,name:"platform_undeclared_feature",remediation:`Rate "${t}" in the ${e.name} capability matrix as "native", "emulated", or "unsupported" — an undeclared feature fails closed rather than letting the app deploy onto a primitive the host may not provide.`,target:a}),k=t=>{const{diagnostics:e,gatedSignals:a,matrix:r,reported:n,signals:c,target:i}=t;for(const s of w){if(c[s]!==!0)continue;const o=r.features[s]?.level;o!=="unsupported"&&o!==void 0||(a[s]=!1,!n.has(s)&&e.push(o==="unsupported"?y(s,r,i):T(s,r,i)))}},_=(t,e,a,r={})=>{const n={...t},c={...r},i=[],s=new Set;for(const[o,l]of Object.entries(S)){if(l===null||!t[o])continue;const p=e.features[l]?.level;p==="unsupported"?(n[o]=!1,s.add(l),i.push({feature:o,level:"error",message:`${e.name} does not support "${o}" (ctx.${o}).`,name:"platform_unsupported_feature",remediation:`Remove the ctx.${o} usage, or deploy to a target whose capability matrix marks "${l}" as native or emulated.`,target:a})):p===void 0&&(n[o]=!1,s.add(l),i.push({feature:o,level:"error",message:`${e.name}'s capability matrix does not declare a support level for "${o}" (ctx.${o}). Treated as unsupported.`,name:"platform_undeclared_feature",remediation:`Rate "${l}" in the ${e.name} capability matrix as "native", "emulated", or "unsupported" — an undeclared feature fails closed rather than shipping a surface the host may not provide.`,target:a}))}return k({diagnostics:i,gatedSignals:c,matrix:e,reported:s,signals:r,target:a}),{diagnostics:i,signals:c,usage:n}},E=(t,e,a={})=>{const r=u[e];return r===void 0?{diagnostics:[{level:"error",message:`Unknown deploy target "${e}" — no capability matrix is registered for it. Codegen emitted the full Cloudflare surface un-gated.`,name:"platform_unknown_target",remediation:`Use a registered target (${Object.keys(u).join(", ")}) or install the target's @lunora/platform-${e} package.`,target:e}],signals:{...a},usage:{...t}}:_(t,r,e,a)},I=t=>{const e=u[t];if(e===void 0)return;const a=Object.entries(e.features).filter(([,r])=>r.level==="unsupported").map(([r])=>r).toSorted((r,n)=>r.localeCompare(n));return{id:e.id,name:e.name,unsupported:a}};export{S as CAPABILITY_TO_FEATURE,d as DEFAULT_TARGET,_ as gateAgainstMatrix,E as gatePlatformFeatures,C as platformMatrixIds,v as readProjectTarget,L as readTargetDiagnostics,A as resolveCodegenTarget,I as studioPlatformFor};
1
+ import{NODE_CAPABILITIES as f,CLOUDFLARE_CAPABILITIES as h,CELLD_CAPABILITIES as b}from"@lunora/platform";import{r as g}from"./project-config-file-BV7RR-l6.mjs";const d="cloudflare",v=t=>{const{target:e}=g(t);return e!==void 0&&e.length>0?e:void 0},A=(t,e)=>e??v(t)??d,L=(t,e)=>{if(e!==void 0)return[];const{target:a,unreadable:r}=g(t);return r!==!0||a!==void 0?[]:[{level:"warn",message:`lunora.config declares a \`target\` that codegen cannot read without evaluating it, so the "${d}" surface was emitted. \`runCodegen\` resolves the target synchronously, which means it reads literals only.`,name:"platform_unreadable_target",remediation:`Write \`target\` as a string literal on the config's default export (\`export default { target: "${d}" }\`), or pass \`--target\`.`,target:d}]},u={celld:b,cloudflare:h,node:f},C=()=>Object.keys(u).toSorted((t,e)=>t.localeCompare(e)),S={access:null,ai:"ai",aiSearch:"aiSearch",analytics:"analytics",analyticsSql:"analyticsSql",artifacts:"artifacts",browser:"browser",container:"containers",flags:null,hyperdrive:"hyperdrive",images:"images",kv:"keyValueStore",mail:"mail",notify:null,payments:null,pipelines:"pipelines",r2sql:null,scheduler:"scheduler",storage:"objectStorage",vectors:"vectorStore",workflows:"workflows",x402:"secrets"},w=["agents","commitOrderedTables","containerEgressPolicy","containerRuntimeScheduling","containerSandboxTools","cronTriggers","crossShardFanout","durableStreams","globalTables","queues","relationGraph","secrets","services","topics","vectorStore","workerLoaders","workflowRollback","workflowSchedules"],m={agents:"durable agents (`defineAgent`)",commitOrderedTables:"commit-ordered tables (`.commitOrdered()`)",containerEgressPolicy:"container egress policies (`defineContainer({ allowedHosts | deniedHosts | interceptHttps })`)",containerRuntimeScheduling:'per-instance container images and snapshots (`defineContainer({ schedulingPolicy: "durable_object" })`)',containerSandboxTools:"container sandbox helpers — files, directory backups, bucket mounts (`defineContainer({ sandbox: true })`)",cronTriggers:"declared cron triggers (`cronJobs()`)",crossShardFanout:"cross-shard fan-out queries (a `.shardBy(...)` schema)",durableStreams:"durable streams (`.stream(handler, { durable: true })`)",globalTables:"global tables (`.global()`)",queues:"queues (`defineQueue`)",relationGraph:"relation-graph traversal (`ctx.db.related`, derived from `v.id(...)` columns)",secrets:"the secrets store (`ctx.secrets`)",services:"service bindings to sibling Workers (`lunora.config` `services`)",topics:"pub/sub topics (`defineTopic` / `defineSubscription`)",vectorStore:"vector indexes (`.vectorize()`)",workerLoaders:"sandboxed agent scripts (`jsCodeTool`, on Worker Loaders)",workflowRollback:"workflow step rollback (`defineStep({ rollback })`)",workflowSchedules:"scheduled workflow instances (`defineWorkflow({ schedules })`)"},y=(t,e,a)=>({level:"error",message:`${e.name} does not support ${m[t]}, which this app declares.`,name:"platform_unsupported_feature",remediation:`Remove the declaration, or deploy to a target whose capability matrix marks "${t}" as native or emulated.`,target:a}),T=(t,e,a)=>({level:"error",message:`${e.name}'s capability matrix does not declare a support level for ${m[t]}, which this app declares. Treated as unsupported.`,name:"platform_undeclared_feature",remediation:`Rate "${t}" in the ${e.name} capability matrix as "native", "emulated", or "unsupported" — an undeclared feature fails closed rather than letting the app deploy onto a primitive the host may not provide.`,target:a}),k=t=>{const{diagnostics:e,gatedSignals:a,matrix:r,reported:n,signals:c,target:i}=t;for(const s of w){if(c[s]!==!0)continue;const o=r.features[s]?.level;o!=="unsupported"&&o!==void 0||(a[s]=!1,!n.has(s)&&e.push(o==="unsupported"?y(s,r,i):T(s,r,i)))}},_=(t,e,a,r={})=>{const n={...t},c={...r},i=[],s=new Set;for(const[o,l]of Object.entries(S)){if(l===null||!t[o])continue;const p=e.features[l]?.level;p==="unsupported"?(n[o]=!1,s.add(l),i.push({feature:o,level:"error",message:`${e.name} does not support "${o}" (ctx.${o}).`,name:"platform_unsupported_feature",remediation:`Remove the ctx.${o} usage, or deploy to a target whose capability matrix marks "${l}" as native or emulated.`,target:a})):p===void 0&&(n[o]=!1,s.add(l),i.push({feature:o,level:"error",message:`${e.name}'s capability matrix does not declare a support level for "${o}" (ctx.${o}). Treated as unsupported.`,name:"platform_undeclared_feature",remediation:`Rate "${l}" in the ${e.name} capability matrix as "native", "emulated", or "unsupported" — an undeclared feature fails closed rather than shipping a surface the host may not provide.`,target:a}))}return k({diagnostics:i,gatedSignals:c,matrix:e,reported:s,signals:r,target:a}),{diagnostics:i,signals:c,usage:n}},E=(t,e,a={})=>{const r=u[e];return r===void 0?{diagnostics:[{level:"error",message:`Unknown deploy target "${e}" — no capability matrix is registered for it. Codegen emitted the full Cloudflare surface un-gated.`,name:"platform_unknown_target",remediation:`Use a registered target (${Object.keys(u).join(", ")}) or install the target's @lunora/platform-${e} package.`,target:e}],signals:{...a},usage:{...t}}:_(t,r,e,a)},I=t=>{const e=u[t];if(e===void 0)return;const a=Object.entries(e.features).filter(([,r])=>r.level==="unsupported").map(([r])=>r).toSorted((r,n)=>r.localeCompare(n));return{id:e.id,name:e.name,unsupported:a}};export{S as CAPABILITY_TO_FEATURE,d as DEFAULT_TARGET,_ as gateAgainstMatrix,E as gatePlatformFeatures,C as platformMatrixIds,v as readProjectTarget,L as readTargetDiagnostics,A as resolveCodegenTarget,I as studioPlatformFor};
@@ -1 +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-CiIyKqhF.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};
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-B81lOULB.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};
@@ -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{a as M}from"./module-specifiers-WF8iAydP.mjs";import{p as A}from"./parse-validator-DYdT7Hyf.mjs";import{findObjectProperty as c,unwrapExpression as d,isConstDeclaration as P}from"./isTestPath-CiIyKqhF.mjs";import{j as D,i as b,f as g,d as O}from"./attribution-0YtR4LvZ.mjs";import{u as w}from"./unwrap-handler-return-BedChFbC.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
+ 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-IDBKIT7M.mjs";import{findObjectProperty as c,unwrapExpression as d,isConstDeclaration as P}from"./isTestPath-B81lOULB.mjs";import{j as D,i as b,f as g,d as O}from"./attribution-BUciBs1M.mjs";import{u as w}from"./unwrap-handler-return-B-jQde6M.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-CiIyKqhF.mjs";import{b as I,d as T}from"./attribution-0YtR4LvZ.mjs";import{i as l}from"./context-root-DX4uZFBy.mjs";import{c as C}from"./classify-procedure-call-C9lQCjso.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
+ 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-B81lOULB.mjs";import{b as I,d as T}from"./attribution-BUciBs1M.mjs";import{i as l}from"./context-root-Dlo21ybw.mjs";import{c as C}from"./classify-procedure-call-BJdf_-M6.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-Cuogms61.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-C2s0xWQD.mjs";import{G as i}from"./shared-DnCokNcE.mjs";import{s as R}from"./dispatch-namespace-DwTjD7BU.mjs";const h="1.3.2",g={description:"Result is TS-inferred from the function's return type (no `.output()` declared); best-effort — any JSON."},f=(e,n)=>{const t=`${R(e.filePath)}:${e.exportName}`;return{description:`Invoke the \`${e.kind}\` \`${t}\` over the Lunora RPC envelope (POST /_lunora/rpc, body \`{ "functionPath": "${t}", "args": { … } }\`).`,errors:d.map((r,a)=>({code:-32e3-a,data:{code:r},message:r})),name:t,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?p(e.output):g},summary:`${e.kind}: ${t}`,"x-lunora-function-kind":e.kind,"x-tags":[{name:n}]}},O=e=>{const n=e.version??"0.0.0",s=e.functions.filter(o=>o.visibility!=="internal"&&o.kind!=="stream"),t=e.modules??[],r=s.map(o=>f(o,m(t,o.filePath))).toSorted((o,c)=>o.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:n},methods:r,openrpc:h}},E=e=>`${JSON.stringify(O(e),void 0,2)}
1
+ import{m}from"./modules-CjOcuQnK.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-C2s0xWQD.mjs";import{G as i}from"./shared-DnCokNcE.mjs";import{s as R}from"./dispatch-namespace-DwTjD7BU.mjs";const h="1.3.2",g={description:"Result is TS-inferred from the function's return type (no `.output()` declared); best-effort — any JSON."},f=(e,n)=>{const t=`${R(e.filePath)}:${e.exportName}`;return{description:`Invoke the \`${e.kind}\` \`${t}\` over the Lunora RPC envelope (POST /_lunora/rpc, body \`{ "functionPath": "${t}", "args": { … } }\`).`,errors:d.map((r,a)=>({code:-32e3-a,data:{code:r},message:r})),name:t,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?p(e.output):g},summary:`${e.kind}: ${t}`,"x-lunora-function-kind":e.kind,"x-tags":[{name:n}]}},O=e=>{const n=e.version??"0.0.0",s=e.functions.filter(o=>o.visibility!=="internal"&&o.kind!=="stream"),t=e.modules??[],r=s.map(o=>f(o,m(t,o.filePath))).toSorted((o,c)=>o.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:n},methods:r,openrpc:h}},E=e=>`${JSON.stringify(O(e),void 0,2)}
2
2
  `,b=e=>`${i}export const openRpcSpec = ${u(e,"Record<string, unknown>")};
3
3
  `;export{h as OPENRPC_VERSION,O as buildOpenRpcDocument,E as emitOpenRpc,b 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-CiIyKqhF.mjs";import{a as v}from"./attribution-0YtR4LvZ.mjs";import{r as $}from"./handler-reference-DQlWnkjm.mjs";import{d as F}from"./modules-Cuogms61.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};
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-B81lOULB.mjs";import{a as v}from"./attribution-BUciBs1M.mjs";import{r as $}from"./handler-reference-DXkpwoAq.mjs";import{d as F}from"./modules-CjOcuQnK.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};