@lunora/codegen 1.0.0-alpha.331 → 1.0.0-alpha.332

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 (61) hide show
  1. package/dist/index.d.mts +29 -18
  2. package/dist/index.d.ts +29 -18
  3. package/dist/index.mjs +1 -1
  4. package/dist/packem_shared/{AGENTS_FILENAME-B6-kjzM3.mjs → AGENTS_FILENAME-8zoeGNsB.mjs} +1 -1
  5. package/dist/packem_shared/{CONTAINERS_FILENAME-dFRtAyIe.mjs → CONTAINERS_FILENAME-QiNt84QA.mjs} +1 -1
  6. package/dist/packem_shared/{DEFAULT_TARGET-BbWiB-rs.mjs → DEFAULT_TARGET-CDksdcYc.mjs} +1 -1
  7. package/dist/packem_shared/{FLAGS_FILENAME-Bf0MSlHH.mjs → FLAGS_FILENAME-Cwq0B2Nl.mjs} +1 -1
  8. package/dist/packem_shared/{MUTATORS_FILENAME-B_I0kkvJ.mjs → MUTATORS_FILENAME-DZFH7a9G.mjs} +1 -1
  9. package/dist/packem_shared/{NOTIFY_FILENAME-DOIxn0Qb.mjs → NOTIFY_FILENAME-DZIt-rb0.mjs} +1 -1
  10. package/dist/packem_shared/{OPENRPC_VERSION-CCY7xqSL.mjs → OPENRPC_VERSION-CeEGdAZ9.mjs} +1 -1
  11. package/dist/packem_shared/PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs +1 -0
  12. package/dist/packem_shared/{QUEUES_FILENAME-CsRy4VTF.mjs → QUEUES_FILENAME-EvfCmmv6.mjs} +1 -1
  13. package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-V7LYutDl.mjs +31 -0
  14. package/dist/packem_shared/{SHAPES_FILENAME-D7Ifi5Ce.mjs → SHAPES_FILENAME-Ciu5tx7B.mjs} +1 -1
  15. package/dist/packem_shared/{WORKFLOWS_FILENAME-CdeS224T.mjs → WORKFLOWS_FILENAME-C5tz9gMh.mjs} +1 -1
  16. package/dist/packem_shared/{attribution-hVBriwzy.mjs → attribution-RI-H1KPm.mjs} +1 -1
  17. package/dist/packem_shared/{buildOpenApiDocument-DFv-RYZU.mjs → buildOpenApiDocument-BBao-3vL.mjs} +1 -1
  18. package/dist/packem_shared/{capabilitiesUsedBy-CF7sUwa8.mjs → capabilitiesUsedBy-BC7ldWJI.mjs} +1 -1
  19. package/dist/packem_shared/chain-C9qZxjM_.mjs +1 -0
  20. package/dist/packem_shared/{classify-procedure-call-Bw5sia-K.mjs → classify-procedure-call-C5JY2w5V.mjs} +1 -1
  21. package/dist/packem_shared/{context-property-calls-Co_G3ENU.mjs → context-property-calls-M6Oo1xQT.mjs} +1 -1
  22. package/dist/packem_shared/{context-root-BTW5XwVq.mjs → context-root-DQd48e1F.mjs} +1 -1
  23. package/dist/packem_shared/createCodegenProject-C-fKC9h4.mjs +1 -0
  24. package/dist/packem_shared/{database-calls-D-GwIhWO.mjs → database-calls-BNoSJRFy.mjs} +1 -1
  25. package/dist/packem_shared/{discoverAuthApiCalls-xs0ONfI-.mjs → discoverAuthApiCalls-GPzUN_-_.mjs} +1 -1
  26. package/dist/packem_shared/{discoverCrons-B2SdRjRO.mjs → discoverCrons-C1fKEf4g.mjs} +1 -1
  27. package/dist/packem_shared/{discoverFunctions-C9Ra5XXH.mjs → discoverFunctions-CJu5EH_G.mjs} +1 -1
  28. package/dist/packem_shared/{discoverHttpRoutes-WBAqBcfK.mjs → discoverHttpRoutes-MrMxIY66.mjs} +1 -1
  29. package/dist/packem_shared/discoverHyperdriveCalls-VVJGsgxj.mjs +1 -0
  30. package/dist/packem_shared/{discoverInserts-T5ojinqL.mjs → discoverInserts-Boh6WAYw.mjs} +1 -1
  31. package/dist/packem_shared/discoverMaskProcedures-D3Tu8Q8Y.mjs +1 -0
  32. package/dist/packem_shared/{discoverMigrations-ClgjUkaG.mjs → discoverMigrations-BMdGxHeq.mjs} +1 -1
  33. package/dist/packem_shared/{discoverNondeterministicCalls-UCUCyCox.mjs → discoverNondeterministicCalls-c9xenrIN.mjs} +1 -1
  34. package/dist/packem_shared/{discoverQueries-u2XNpxsn.mjs → discoverQueries-o_00HnBB.mjs} +1 -1
  35. package/dist/packem_shared/discoverR2sqlCalls-D_H1v-UD.mjs +1 -0
  36. package/dist/packem_shared/{discoverRlsMetadata-D2G3YAoe.mjs → discoverRlsMetadata-C7J8dgVz.mjs} +1 -1
  37. package/dist/packem_shared/{discoverRlsProcedures-BD8aG1BU.mjs → discoverRlsProcedures-Di3VEk-D.mjs} +1 -1
  38. package/dist/packem_shared/{discoverSandboxUsage-w6Q3RvxZ.mjs → discoverSandboxUsage-CrhZZJZS.mjs} +1 -1
  39. package/dist/packem_shared/{discoverSchema-BtsX-CN9.mjs → discoverSchema-Bdmw34_P.mjs} +1 -1
  40. package/dist/packem_shared/{discoverStorageRulesMetadata-C2ceH0ZO.mjs → discoverStorageRulesMetadata-BFCmbsIN.mjs} +1 -1
  41. package/dist/packem_shared/{exported-procedure-chains-CVzkVdq4.mjs → exported-procedure-chains-Bol_VtzO.mjs} +1 -1
  42. package/dist/packem_shared/{fingerprintSchemaSources-eVG9aVt0.mjs → fingerprintSchemaSources-BdFj8vPc.mjs} +1 -1
  43. package/dist/packem_shared/{handler-reference-vIeqkhV_.mjs → handler-reference-8w_VU4XY.mjs} +1 -1
  44. package/dist/packem_shared/{index-BPUxZYM5.mjs → index-BMMBKqsT.mjs} +1 -1
  45. package/dist/packem_shared/isTestPath-Cdv_LoVU.mjs +1 -0
  46. package/dist/packem_shared/{loadProjectConfig-NO0dVJSl.mjs → loadProjectConfig-B0uxUGF-.mjs} +1 -1
  47. package/dist/packem_shared/{modules-CjOcuQnK.mjs → modules-DDIIcM7P.mjs} +1 -1
  48. package/dist/packem_shared/{parse-validator-IDBKIT7M.mjs → parse-validator-BqDQLzDZ.mjs} +1 -1
  49. package/dist/packem_shared/project-config-file-CBY6llht.mjs +1 -0
  50. package/dist/packem_shared/{readServiceBindings-DvqIThzd.mjs → readServiceBindings-4xlUucKw.mjs} +1 -1
  51. package/dist/packem_shared/{unwrap-handler-return-CeaOifqX.mjs → unwrap-handler-return-Bfz7lH0C.mjs} +1 -1
  52. package/package.json +1 -1
  53. package/dist/packem_shared/PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs +0 -1
  54. package/dist/packem_shared/SCHEMA_SNAPSHOT_FILENAME-DdPW4JCi.mjs +0 -31
  55. package/dist/packem_shared/chain-ZlTHdRo2.mjs +0 -1
  56. package/dist/packem_shared/createCodegenProject-V51_yBw3.mjs +0 -1
  57. package/dist/packem_shared/discoverHyperdriveCalls-DfCAjBgd.mjs +0 -1
  58. package/dist/packem_shared/discoverMaskProcedures-DKd9fVDa.mjs +0 -1
  59. package/dist/packem_shared/discoverR2sqlCalls-jz5KouxF.mjs +0 -1
  60. package/dist/packem_shared/isTestPath-B81lOULB.mjs +0 -1
  61. package/dist/packem_shared/project-config-file-BV7RR-l6.mjs +0 -1
package/dist/index.d.mts CHANGED
@@ -3490,27 +3490,25 @@ declare const findTsconfig: (startPath: string) => string | undefined;
3490
3490
  * dev-loop) can build one once and reuse it across runs via
3491
3491
  * {@link refreshCodegenProject} instead of re-parsing the user's whole TS
3492
3492
  * program on every save.
3493
+ *
3494
+ * The program is seeded with the `lunora/` sources, the tsconfig's ambient and global
3495
+ * declarations, and whatever those import. The app's UI and tests reach it only by
3496
+ * being imported, which is all type resolution needs, so a project whose tsconfig
3497
+ * includes a whole frontend does not pay to parse it on a cold run.
3493
3498
  */
3494
3499
  declare const createCodegenProject: (lunoraDirectory: string) => Project;
3495
3500
  /**
3496
- * Synchronise a reused `createCodegenProject` Project with the current
3497
- * on-disk state of `lunoraDirectory`, so the next `runCodegen` sees the
3498
- * same files a freshly-constructed Project would — without re-parsing the whole
3499
- * TS program. Adds any on-disk source file the Project doesn't yet have, and
3500
- * `refreshFromFileSystemSync()`es the ones it does (picking up edits); then
3501
- * removes Project source files under `lunoraDirectory` that no longer exist on
3502
- * disk (the classic stale-deleted-file cache bug).
3501
+ * Synchronise a reused `createCodegenProject` Project with the current on-disk state of
3502
+ * `lunoraDirectory`, so the next `runCodegen` sees the same files a freshly-constructed
3503
+ * Project would — without re-parsing the whole TS program.
3503
3504
  *
3504
- * Files outside `lunoraDirectory` — e.g. a shared validator or type pulled in
3505
- * via the user's tsconfig — are also `refreshFromFileSystemSync()`ed, but only
3506
- * the ones already loaded into the Project; none are added. `resolveValidatorAlias`
3507
- * (parse-validator.ts) follows `getAliasedSymbol()` across module boundaries, so a
3508
- * validator defined outside `lunoraDirectory` is genuinely read from whatever
3509
- * source the Project currently holds — leaving those files stale made a reused
3510
- * Project (the Vite dev loop) silently disagree with a fresh one (`lunora
3511
- * codegen`) about the same source. `node_modules` is excluded: its `.d.ts` set
3512
- * dominates the file count and never changes mid dev-loop, so refreshing it would
3513
- * reinstate close to the full re-parse cost this cache exists to avoid.
3505
+ * The seeds are re-read and created or refreshed; every other file the Project holds is
3506
+ * refreshed from disk too (a deleted one drops out). Then the Project keeps exactly the
3507
+ * files reached from the seeds and the augmentations whose module is still imported. A
3508
+ * file a `lunora/` source stops importing is therefore dropped, and one it still imports
3509
+ * stays put, so the program is rebuilt only when the files it holds actually change.
3510
+ * `node_modules` is left alone: its `.d.ts` set dominates the file count and never
3511
+ * changes mid dev-loop.
3514
3512
  */
3515
3513
  declare const refreshCodegenProject: (project: Project, lunoraDirectory: string) => void;
3516
3514
  /**
@@ -4462,6 +4460,19 @@ interface AcceptedFinding {
4462
4460
  declare const PROJECT_CONFIG_FILENAMES: ReadonlyArray<string>;
4463
4461
  /** The resolved config file, or `undefined` when the project ships none. */
4464
4462
  declare const findProjectConfigFile: (projectRoot: string) => string | undefined;
4463
+ /**
4464
+ * Every `lunora.config.*` path source discovery may read for the schema directory
4465
+ * `lunoraDirectory`: each candidate name in its parent and every directory above that,
4466
+ * nearest first, up to and including the project root (the first directory holding a
4467
+ * `package.json` or `.git`). The schema directory itself is not searched, matching
4468
+ * discovery. A config above the root belongs to another project, so the walk stops there.
4469
+ *
4470
+ * Listed whether or not each file exists. A watcher needs the absent ones too, so
4471
+ * that creating a nearer config is seen as the change it is.
4472
+ */
4473
+ declare const projectConfigCandidatePaths: (lunoraDirectory: string) => string[];
4474
+ /** The config codegen reads for `lunoraDirectory`: the nearest existing candidate, or `undefined`. */
4475
+ declare const findCodegenConfigFile: (lunoraDirectory: string) => string | undefined;
4465
4476
  /**
4466
4477
  * The literals {@link readProjectConfigLiterals} proves by parsing — narrowed,
4467
4478
  * unlike the evaluated shape below, because the parser has just established that
@@ -4708,4 +4719,4 @@ declare const secretKindOf: (value: string) => string | undefined;
4708
4719
  /** A redacted preview of a secret value — first 4 chars plus its length, never the full value. */
4709
4720
  declare const redact: (value: string) => string;
4710
4721
  declare const VERSION = "0.0.0";
4711
- export { AGENTS_FILENAME, type AgentIR, type ArchitectureManifest, type AuthApiCallIR, CAPABILITY_PROBES, CONTAINERS_FILENAME, type CapabilityKey, type CapabilityProbe, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContainerImageIR, type ContainerNamedImageIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DefaultScheduledContainerIR, type DriftChange, type DriftRemediation, type DriftScope, type DurableObjectScheduledContainerIR, type EmitAppOptions, FLAGS_FILENAME, type FieldSnapshot, type FlagsIR, type FunctionIR, GENERATED_HEADER, type HttpRouteIR, type IndexIR, type IndexSnapshot, type InsertWriteIR, LUNORA_ERROR_CODES, type LintSchemaOptions, type LoadedProjectConfig, type LunoraProjectConfig, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, NOTIFY_FILENAME, type NotifyChannels, OPENRPC_VERSION, type OpenApiEmitInput, type OpenRpcEmitInput, PROJECT_CONFIG_FILENAMES, type PlatformDiagnostic, type ProjectConfigLiterals, type ProjectIR, QUEUES_FILENAME, type QueryReadIR, type QueueIR, type RelationSnapshot, type RlsMetadataIR, type RlsPolicyIR, type RlsProcedureIR, type RlsRoleIR, SCHEMA_SNAPSHOT_FILENAME, SCHEMA_SNAPSHOT_VERSION, SHAPES_FILENAME, type SandboxUsage, type SchemaDrift, type SchemaDriftDecision, type SchemaIR, type SchemaSnapshot, SchemaSnapshotParseError, type ServiceBindingIR, type ServiceLiteral, type ShapeIR, type SourceCapabilitySignals, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, type TopicIR, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerQueueProducerIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, capabilitiesUsedBy, createCodegenProject, describeErrorLevelFindings, diagnosticAt, diffSchemaSnapshots, discoverAgents, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverHyperdriveCalls, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverNotifyCalls, discoverNotifyChannels, discoverNotifyConfig, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSandboxUsage, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitAgents, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitInternalApi, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitScheduler, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, errorAdvisoryNames, errorPlatformDiagnosticNames, evaluateSchemaDrift, findProjectConfigFile, findTsconfig, fingerprintSchemaSources, foldCapabilitySignals, formatAdvisories, isD1GlobalTable, isHyperdriveGlobalTable, isTestPath, lintSchema, listLunoraSourceFiles, loadProjectConfig, mayReadCapabilityContext, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectConfigLiterals, readProjectTarget, readServiceBindings, redact, refreshCodegenProject, resolveCodegenTarget, resolveServiceBindings, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, sortedUniqueNames, sourceCapabilitySignals, toAdvisorContext, validatorIrToJsonSchema };
4722
+ export { AGENTS_FILENAME, type AgentIR, type ArchitectureManifest, type AuthApiCallIR, CAPABILITY_PROBES, CONTAINERS_FILENAME, type CapabilityKey, type CapabilityProbe, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContainerImageIR, type ContainerNamedImageIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DefaultScheduledContainerIR, type DriftChange, type DriftRemediation, type DriftScope, type DurableObjectScheduledContainerIR, type EmitAppOptions, FLAGS_FILENAME, type FieldSnapshot, type FlagsIR, type FunctionIR, GENERATED_HEADER, type HttpRouteIR, type IndexIR, type IndexSnapshot, type InsertWriteIR, LUNORA_ERROR_CODES, type LintSchemaOptions, type LoadedProjectConfig, type LunoraProjectConfig, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, NOTIFY_FILENAME, type NotifyChannels, OPENRPC_VERSION, type OpenApiEmitInput, type OpenRpcEmitInput, PROJECT_CONFIG_FILENAMES, type PlatformDiagnostic, type ProjectConfigLiterals, type ProjectIR, QUEUES_FILENAME, type QueryReadIR, type QueueIR, type RelationSnapshot, type RlsMetadataIR, type RlsPolicyIR, type RlsProcedureIR, type RlsRoleIR, SCHEMA_SNAPSHOT_FILENAME, SCHEMA_SNAPSHOT_VERSION, SHAPES_FILENAME, type SandboxUsage, type SchemaDrift, type SchemaDriftDecision, type SchemaIR, type SchemaSnapshot, SchemaSnapshotParseError, type ServiceBindingIR, type ServiceLiteral, type ShapeIR, type SourceCapabilitySignals, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, type TopicIR, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerQueueProducerIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, capabilitiesUsedBy, createCodegenProject, describeErrorLevelFindings, diagnosticAt, diffSchemaSnapshots, discoverAgents, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverHyperdriveCalls, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverNotifyCalls, discoverNotifyChannels, discoverNotifyConfig, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSandboxUsage, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitAgents, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitInternalApi, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitScheduler, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, errorAdvisoryNames, errorPlatformDiagnosticNames, evaluateSchemaDrift, findCodegenConfigFile, findProjectConfigFile, findTsconfig, fingerprintSchemaSources, foldCapabilitySignals, formatAdvisories, isD1GlobalTable, isHyperdriveGlobalTable, isTestPath, lintSchema, listLunoraSourceFiles, loadProjectConfig, mayReadCapabilityContext, parseSchemaSnapshot, platformMatrixIds, projectConfigCandidatePaths, readPackageDependencies, readProjectConfigLiterals, readProjectTarget, readServiceBindings, redact, refreshCodegenProject, resolveCodegenTarget, resolveServiceBindings, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, sortedUniqueNames, sourceCapabilitySignals, toAdvisorContext, validatorIrToJsonSchema };
package/dist/index.d.ts CHANGED
@@ -3490,27 +3490,25 @@ declare const findTsconfig: (startPath: string) => string | undefined;
3490
3490
  * dev-loop) can build one once and reuse it across runs via
3491
3491
  * {@link refreshCodegenProject} instead of re-parsing the user's whole TS
3492
3492
  * program on every save.
3493
+ *
3494
+ * The program is seeded with the `lunora/` sources, the tsconfig's ambient and global
3495
+ * declarations, and whatever those import. The app's UI and tests reach it only by
3496
+ * being imported, which is all type resolution needs, so a project whose tsconfig
3497
+ * includes a whole frontend does not pay to parse it on a cold run.
3493
3498
  */
3494
3499
  declare const createCodegenProject: (lunoraDirectory: string) => Project;
3495
3500
  /**
3496
- * Synchronise a reused `createCodegenProject` Project with the current
3497
- * on-disk state of `lunoraDirectory`, so the next `runCodegen` sees the
3498
- * same files a freshly-constructed Project would — without re-parsing the whole
3499
- * TS program. Adds any on-disk source file the Project doesn't yet have, and
3500
- * `refreshFromFileSystemSync()`es the ones it does (picking up edits); then
3501
- * removes Project source files under `lunoraDirectory` that no longer exist on
3502
- * disk (the classic stale-deleted-file cache bug).
3501
+ * Synchronise a reused `createCodegenProject` Project with the current on-disk state of
3502
+ * `lunoraDirectory`, so the next `runCodegen` sees the same files a freshly-constructed
3503
+ * Project would — without re-parsing the whole TS program.
3503
3504
  *
3504
- * Files outside `lunoraDirectory` — e.g. a shared validator or type pulled in
3505
- * via the user's tsconfig — are also `refreshFromFileSystemSync()`ed, but only
3506
- * the ones already loaded into the Project; none are added. `resolveValidatorAlias`
3507
- * (parse-validator.ts) follows `getAliasedSymbol()` across module boundaries, so a
3508
- * validator defined outside `lunoraDirectory` is genuinely read from whatever
3509
- * source the Project currently holds — leaving those files stale made a reused
3510
- * Project (the Vite dev loop) silently disagree with a fresh one (`lunora
3511
- * codegen`) about the same source. `node_modules` is excluded: its `.d.ts` set
3512
- * dominates the file count and never changes mid dev-loop, so refreshing it would
3513
- * reinstate close to the full re-parse cost this cache exists to avoid.
3505
+ * The seeds are re-read and created or refreshed; every other file the Project holds is
3506
+ * refreshed from disk too (a deleted one drops out). Then the Project keeps exactly the
3507
+ * files reached from the seeds and the augmentations whose module is still imported. A
3508
+ * file a `lunora/` source stops importing is therefore dropped, and one it still imports
3509
+ * stays put, so the program is rebuilt only when the files it holds actually change.
3510
+ * `node_modules` is left alone: its `.d.ts` set dominates the file count and never
3511
+ * changes mid dev-loop.
3514
3512
  */
3515
3513
  declare const refreshCodegenProject: (project: Project, lunoraDirectory: string) => void;
3516
3514
  /**
@@ -4462,6 +4460,19 @@ interface AcceptedFinding {
4462
4460
  declare const PROJECT_CONFIG_FILENAMES: ReadonlyArray<string>;
4463
4461
  /** The resolved config file, or `undefined` when the project ships none. */
4464
4462
  declare const findProjectConfigFile: (projectRoot: string) => string | undefined;
4463
+ /**
4464
+ * Every `lunora.config.*` path source discovery may read for the schema directory
4465
+ * `lunoraDirectory`: each candidate name in its parent and every directory above that,
4466
+ * nearest first, up to and including the project root (the first directory holding a
4467
+ * `package.json` or `.git`). The schema directory itself is not searched, matching
4468
+ * discovery. A config above the root belongs to another project, so the walk stops there.
4469
+ *
4470
+ * Listed whether or not each file exists. A watcher needs the absent ones too, so
4471
+ * that creating a nearer config is seen as the change it is.
4472
+ */
4473
+ declare const projectConfigCandidatePaths: (lunoraDirectory: string) => string[];
4474
+ /** The config codegen reads for `lunoraDirectory`: the nearest existing candidate, or `undefined`. */
4475
+ declare const findCodegenConfigFile: (lunoraDirectory: string) => string | undefined;
4465
4476
  /**
4466
4477
  * The literals {@link readProjectConfigLiterals} proves by parsing — narrowed,
4467
4478
  * unlike the evaluated shape below, because the parser has just established that
@@ -4708,4 +4719,4 @@ declare const secretKindOf: (value: string) => string | undefined;
4708
4719
  /** A redacted preview of a secret value — first 4 chars plus its length, never the full value. */
4709
4720
  declare const redact: (value: string) => string;
4710
4721
  declare const VERSION = "0.0.0";
4711
- export { AGENTS_FILENAME, type AgentIR, type ArchitectureManifest, type AuthApiCallIR, CAPABILITY_PROBES, CONTAINERS_FILENAME, type CapabilityKey, type CapabilityProbe, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContainerImageIR, type ContainerNamedImageIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DefaultScheduledContainerIR, type DriftChange, type DriftRemediation, type DriftScope, type DurableObjectScheduledContainerIR, type EmitAppOptions, FLAGS_FILENAME, type FieldSnapshot, type FlagsIR, type FunctionIR, GENERATED_HEADER, type HttpRouteIR, type IndexIR, type IndexSnapshot, type InsertWriteIR, LUNORA_ERROR_CODES, type LintSchemaOptions, type LoadedProjectConfig, type LunoraProjectConfig, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, NOTIFY_FILENAME, type NotifyChannels, OPENRPC_VERSION, type OpenApiEmitInput, type OpenRpcEmitInput, PROJECT_CONFIG_FILENAMES, type PlatformDiagnostic, type ProjectConfigLiterals, type ProjectIR, QUEUES_FILENAME, type QueryReadIR, type QueueIR, type RelationSnapshot, type RlsMetadataIR, type RlsPolicyIR, type RlsProcedureIR, type RlsRoleIR, SCHEMA_SNAPSHOT_FILENAME, SCHEMA_SNAPSHOT_VERSION, SHAPES_FILENAME, type SandboxUsage, type SchemaDrift, type SchemaDriftDecision, type SchemaIR, type SchemaSnapshot, SchemaSnapshotParseError, type ServiceBindingIR, type ServiceLiteral, type ShapeIR, type SourceCapabilitySignals, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, type TopicIR, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerQueueProducerIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, capabilitiesUsedBy, createCodegenProject, describeErrorLevelFindings, diagnosticAt, diffSchemaSnapshots, discoverAgents, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverHyperdriveCalls, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverNotifyCalls, discoverNotifyChannels, discoverNotifyConfig, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSandboxUsage, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitAgents, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitInternalApi, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitScheduler, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, errorAdvisoryNames, errorPlatformDiagnosticNames, evaluateSchemaDrift, findProjectConfigFile, findTsconfig, fingerprintSchemaSources, foldCapabilitySignals, formatAdvisories, isD1GlobalTable, isHyperdriveGlobalTable, isTestPath, lintSchema, listLunoraSourceFiles, loadProjectConfig, mayReadCapabilityContext, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectConfigLiterals, readProjectTarget, readServiceBindings, redact, refreshCodegenProject, resolveCodegenTarget, resolveServiceBindings, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, sortedUniqueNames, sourceCapabilitySignals, toAdvisorContext, validatorIrToJsonSchema };
4722
+ export { AGENTS_FILENAME, type AgentIR, type ArchitectureManifest, type AuthApiCallIR, CAPABILITY_PROBES, CONTAINERS_FILENAME, type CapabilityKey, type CapabilityProbe, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContainerImageIR, type ContainerNamedImageIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DefaultScheduledContainerIR, type DriftChange, type DriftRemediation, type DriftScope, type DurableObjectScheduledContainerIR, type EmitAppOptions, FLAGS_FILENAME, type FieldSnapshot, type FlagsIR, type FunctionIR, GENERATED_HEADER, type HttpRouteIR, type IndexIR, type IndexSnapshot, type InsertWriteIR, LUNORA_ERROR_CODES, type LintSchemaOptions, type LoadedProjectConfig, type LunoraProjectConfig, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, NOTIFY_FILENAME, type NotifyChannels, OPENRPC_VERSION, type OpenApiEmitInput, type OpenRpcEmitInput, PROJECT_CONFIG_FILENAMES, type PlatformDiagnostic, type ProjectConfigLiterals, type ProjectIR, QUEUES_FILENAME, type QueryReadIR, type QueueIR, type RelationSnapshot, type RlsMetadataIR, type RlsPolicyIR, type RlsProcedureIR, type RlsRoleIR, SCHEMA_SNAPSHOT_FILENAME, SCHEMA_SNAPSHOT_VERSION, SHAPES_FILENAME, type SandboxUsage, type SchemaDrift, type SchemaDriftDecision, type SchemaIR, type SchemaSnapshot, SchemaSnapshotParseError, type ServiceBindingIR, type ServiceLiteral, type ShapeIR, type SourceCapabilitySignals, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, type TopicIR, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerQueueProducerIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, capabilitiesUsedBy, createCodegenProject, describeErrorLevelFindings, diagnosticAt, diffSchemaSnapshots, discoverAgents, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverHyperdriveCalls, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverNotifyCalls, discoverNotifyChannels, discoverNotifyConfig, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSandboxUsage, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitAgents, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitInternalApi, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitScheduler, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, errorAdvisoryNames, errorPlatformDiagnosticNames, evaluateSchemaDrift, findCodegenConfigFile, findProjectConfigFile, findTsconfig, fingerprintSchemaSources, foldCapabilitySignals, formatAdvisories, isD1GlobalTable, isHyperdriveGlobalTable, isTestPath, lintSchema, listLunoraSourceFiles, loadProjectConfig, mayReadCapabilityContext, parseSchemaSnapshot, platformMatrixIds, projectConfigCandidatePaths, readPackageDependencies, readProjectConfigLiterals, readProjectTarget, readServiceBindings, redact, refreshCodegenProject, resolveCodegenTarget, resolveServiceBindings, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, sortedUniqueNames, sourceCapabilitySignals, toAdvisorContext, validatorIrToJsonSchema };
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 p}from"./packem_shared/formatAdvisories-BCVASH7N.mjs";import{describeErrorLevelFindings as n,errorAdvisoryNames as l,errorPlatformDiagnosticNames as c,sortedUniqueNames as x}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-brcmKenl.mjs";import{CodegenDiagnosticError as A,diagnosticAt as v}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as N,discoverAgents as g}from"./packem_shared/AGENTS_FILENAME-B6-kjzM3.mjs";import{isTestPath as R,listLunoraSourceFiles as T}from"./packem_shared/isTestPath-B81lOULB.mjs";import{default as I}from"./packem_shared/discoverAuthApiCalls-xs0ONfI-.mjs";import{CONTAINERS_FILENAME as L,discoverContainers as M}from"./packem_shared/CONTAINERS_FILENAME-dFRtAyIe.mjs";import{default as P}from"./packem_shared/discoverCrons-B2SdRjRO.mjs";import{capabilitiesUsedBy as b,foldCapabilitySignals as y,mayReadCapabilityContext as U,sourceCapabilitySignals as G}from"./packem_shared/capabilitiesUsedBy-CF7sUwa8.mjs";import{FLAGS_FILENAME as j,discoverFlags as B}from"./packem_shared/FLAGS_FILENAME-Bf0MSlHH.mjs";import{default as W}from"./packem_shared/discoverFunctions-C9Ra5XXH.mjs";import{default as V}from"./packem_shared/discoverHttpRoutes-WBAqBcfK.mjs";import{default as Q}from"./packem_shared/discoverHyperdriveCalls-DfCAjBgd.mjs";import{default as w}from"./packem_shared/discoverInserts-T5ojinqL.mjs";import{d as Y}from"./packem_shared/index-BPUxZYM5.mjs";import{default as Z}from"./packem_shared/discoverMigrations-ClgjUkaG.mjs";import{MUTATORS_FILENAME as ee,discoverMutators as re}from"./packem_shared/MUTATORS_FILENAME-B_I0kkvJ.mjs";import{default as te}from"./packem_shared/discoverNondeterministicCalls-UCUCyCox.mjs";import{NOTIFY_FILENAME as ae,discoverNotifyCalls as ie,discoverNotifyChannels as me,discoverNotifyConfig as fe}from"./packem_shared/NOTIFY_FILENAME-DOIxn0Qb.mjs";import{default as de}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as le}from"./packem_shared/discoverQueries-u2XNpxsn.mjs";import{QUEUES_FILENAME as xe,discoverQueues as Se}from"./packem_shared/QUEUES_FILENAME-CsRy4VTF.mjs";import{default as ue}from"./packem_shared/discoverR2sqlCalls-jz5KouxF.mjs";import{default as ve}from"./packem_shared/discoverRlsProcedures-BD8aG1BU.mjs";import{default as Ne}from"./packem_shared/discoverRlsMetadata-D2G3YAoe.mjs";import{discoverSandboxUsage as Oe}from"./packem_shared/discoverSandboxUsage-w6Q3RvxZ.mjs";import{default as Te}from"./packem_shared/discoverSchema-BtsX-CN9.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-D7Ifi5Ce.mjs";import{default as De}from"./packem_shared/discoverStorageRulesMetadata-C2ceH0ZO.mjs";import{WORKFLOWS_FILENAME as ye,discoverWorkflows as Ue}from"./packem_shared/WORKFLOWS_FILENAME-CdeS224T.mjs";import{emitApp as He}from"./packem_shared/emitApp-DuJW6LKD.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-BbWiB-rs.mjs";import{l as tr,r as sr}from"./packem_shared/project-config-file-BV7RR-l6.mjs";import{SCHEMA_SNAPSHOT_FILENAME as ir,runCodegen as mr}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-DdPW4JCi.mjs";import{SchemaSnapshotParseError as pr,buildSchemaSnapshot as dr,evaluateSchemaDrift as nr,parseSchemaSnapshot as lr}from"./packem_shared/SchemaSnapshotParseError-BRJT7c2k.mjs";import{default as xr}from"./packem_shared/fingerprintSchemaSources-eVG9aVt0.mjs";import{schemaFromIr as Er}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as Ar,validatorIrToJsonSchema as vr}from"./packem_shared/LUNORA_ERROR_CODES-C2s0xWQD.mjs";import{SDK_LANGUAGES as Nr,SDK_TARGETS as gr,generateSdk as Or}from"./sdk/index.mjs";import{redact as Tr,secretKindOf as hr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as _r}from"./packem_shared/emitDrizzleSchema-DitcRZ1a.mjs";import{e as Mr}from"./packem_shared/server-DAvi_bv_.mjs";import{e as Pr}from"./packem_shared/shard-CsfiXxV0.mjs";import{G as br}from"./packem_shared/shared-DnCokNcE.mjs";import{MESSAGE_SOLUTIONS as Ur,findSolutionByMessage as Gr}from"@lunora/errors";import{PROJECT_CONFIG_FILENAMES as jr,findProjectConfigFile as Br}from"./packem_shared/PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs";import{createCodegenProject as Wr,findTsconfig as Kr,refreshCodegenProject as Vr}from"./packem_shared/createCodegenProject-V51_yBw3.mjs";import{s as Qr,t as qr,u as wr}from"./packem_shared/shard-runtime-BpoCV-aM.mjs";import{emitApi as Yr,emitCollections as Xr,emitInternalApi as Zr}from"./packem_shared/emitApi-CDgIPAG2.mjs";import{emitCrons as eo,emitScheduler as ro,emitVectors as oo,emitWranglerCronTriggers as to}from"./packem_shared/emitCrons-BQW2lviZ.mjs";import{emitDataModel as ao}from"./packem_shared/emitDataModel-BskFt9Wv.mjs";import{emitFunctions as mo}from"./packem_shared/emitFunctions-Cd0Tuw73.mjs";import{isTypedSchema as po}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,br as GENERATED_HEADER,Ar as LUNORA_ERROR_CODES,Ur as LUNORA_SOLUTION_RULES,ee as MUTATORS_FILENAME,ae as NOTIFY_FILENAME,qe as OPENRPC_VERSION,jr as PROJECT_CONFIG_FILENAMES,xe as QUEUES_FILENAME,ir as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Nr as SDK_LANGUAGES,gr as SDK_TARGETS,Me as SHAPES_FILENAME,pr as SchemaSnapshotParseError,e as VERSION,ye as WORKFLOWS_FILENAME,Ke as buildOpenApiDocument,we as buildOpenRpcDocument,dr as buildSchemaSnapshot,b as capabilitiesUsedBy,Wr 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,Yr as emitApi,He as emitApp,Xr as emitCollections,qr as emitContainers,eo as emitCrons,ao as emitDataModel,_r as emitDrizzleSchema,mo as emitFunctions,Zr as emitInternalApi,Ve as emitOpenApi,ze as emitOpenApiModule,Je as emitOpenRpc,Ye as emitOpenRpcModule,ro as emitScheduler,Mr as emitServer,Pr as emitShard,oo as emitVectors,wr as emitWorkflows,to as emitWranglerCronTriggers,l as errorAdvisoryNames,c as errorPlatformDiagnosticNames,nr as evaluateSchemaDrift,Gr as findLunoraSolution,Br as findProjectConfigFile,Kr as findTsconfig,xr as fingerprintSchemaSources,y as foldCapabilitySignals,m as formatAdvisories,Or as generateSdk,Be as isD1GlobalTable,ke as isHyperdriveGlobalTable,R as isTestPath,po as isTypedSchema,f as lintSchema,T as listLunoraSourceFiles,tr as loadProjectConfig,U as mayReadCapabilityContext,lr as parseSchemaSnapshot,$e as platformMatrixIds,de as readPackageDependencies,sr as readProjectConfigLiterals,er as readProjectTarget,Ie as readServiceBindings,Tr as redact,Vr as refreshCodegenProject,rr as resolveCodegenTarget,_e as resolveServiceBindings,mr as runCodegen,Er as schemaFromIr,hr as secretKindOf,a as serializeSchemaSnapshot,x as sortedUniqueNames,G as sourceCapabilitySignals,p as toAdvisorContext,vr as validatorIrToJsonSchema};
1
+ import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as a,serializeSchemaSnapshot as s}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{formatAdvisories as f,lintSchema as m,toAdvisorContext as d}from"./packem_shared/formatAdvisories-BCVASH7N.mjs";import{describeErrorLevelFindings as n,errorAdvisoryNames as l,errorPlatformDiagnosticNames as c,sortedUniqueNames as x}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-brcmKenl.mjs";import{CodegenDiagnosticError as A,diagnosticAt as v}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as g,discoverAgents as N}from"./packem_shared/AGENTS_FILENAME-8zoeGNsB.mjs";import{isTestPath as R,listLunoraSourceFiles as h}from"./packem_shared/isTestPath-Cdv_LoVU.mjs";import{default as I}from"./packem_shared/discoverAuthApiCalls-GPzUN_-_.mjs";import{CONTAINERS_FILENAME as L,discoverContainers as M}from"./packem_shared/CONTAINERS_FILENAME-QiNt84QA.mjs";import{default as P}from"./packem_shared/discoverCrons-C1fKEf4g.mjs";import{capabilitiesUsedBy as b,foldCapabilitySignals as y,mayReadCapabilityContext as U,sourceCapabilitySignals as G}from"./packem_shared/capabilitiesUsedBy-BC7ldWJI.mjs";import{FLAGS_FILENAME as j,discoverFlags as B}from"./packem_shared/FLAGS_FILENAME-Cwq0B2Nl.mjs";import{default as W}from"./packem_shared/discoverFunctions-CJu5EH_G.mjs";import{default as V}from"./packem_shared/discoverHttpRoutes-MrMxIY66.mjs";import{default as Q}from"./packem_shared/discoverHyperdriveCalls-VVJGsgxj.mjs";import{default as w}from"./packem_shared/discoverInserts-Boh6WAYw.mjs";import{d as Y}from"./packem_shared/index-BMMBKqsT.mjs";import{default as Z}from"./packem_shared/discoverMigrations-BMdGxHeq.mjs";import{MUTATORS_FILENAME as ee,discoverMutators as re}from"./packem_shared/MUTATORS_FILENAME-DZFH7a9G.mjs";import{default as te}from"./packem_shared/discoverNondeterministicCalls-c9xenrIN.mjs";import{NOTIFY_FILENAME as se,discoverNotifyCalls as ie,discoverNotifyChannels as fe,discoverNotifyConfig as me}from"./packem_shared/NOTIFY_FILENAME-DZIt-rb0.mjs";import{default as pe}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as le}from"./packem_shared/discoverQueries-o_00HnBB.mjs";import{QUEUES_FILENAME as xe,discoverQueues as Se}from"./packem_shared/QUEUES_FILENAME-EvfCmmv6.mjs";import{default as ue}from"./packem_shared/discoverR2sqlCalls-D_H1v-UD.mjs";import{default as ve}from"./packem_shared/discoverRlsProcedures-Di3VEk-D.mjs";import{default as ge}from"./packem_shared/discoverRlsMetadata-C7J8dgVz.mjs";import{discoverSandboxUsage as Oe}from"./packem_shared/discoverSandboxUsage-CrhZZJZS.mjs";import{default as he}from"./packem_shared/discoverSchema-Bdmw34_P.mjs";import{readServiceBindings as Ie,resolveServiceBindings as _e}from"./packem_shared/readServiceBindings-4xlUucKw.mjs";import{SHAPES_FILENAME as Me,discoverShapes as Fe}from"./packem_shared/SHAPES_FILENAME-Ciu5tx7B.mjs";import{default as De}from"./packem_shared/discoverStorageRulesMetadata-BFCmbsIN.mjs";import{WORKFLOWS_FILENAME as ye,discoverWorkflows as Ue}from"./packem_shared/WORKFLOWS_FILENAME-C5tz9gMh.mjs";import{emitApp as He}from"./packem_shared/emitApp-DuJW6LKD.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-BBao-3vL.mjs";import{OPENRPC_VERSION as qe,buildOpenRpcDocument as we,emitOpenRpc as Je,emitOpenRpcModule as Ye}from"./packem_shared/OPENRPC_VERSION-CeEGdAZ9.mjs";import{DEFAULT_TARGET as Ze,platformMatrixIds as $e,readProjectTarget as er,resolveCodegenTarget as rr}from"./packem_shared/DEFAULT_TARGET-CDksdcYc.mjs";import{l as tr,r as ar}from"./packem_shared/project-config-file-CBY6llht.mjs";import{PROJECT_CONFIG_FILENAMES as ir,findCodegenConfigFile as fr,findProjectConfigFile as mr,projectConfigCandidatePaths as dr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-CLfsyvjA.mjs";import{SCHEMA_SNAPSHOT_FILENAME as nr,runCodegen as lr}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-V7LYutDl.mjs";import{SchemaSnapshotParseError as xr,buildSchemaSnapshot as Sr,evaluateSchemaDrift as Er,parseSchemaSnapshot as ur}from"./packem_shared/SchemaSnapshotParseError-BRJT7c2k.mjs";import{default as vr}from"./packem_shared/fingerprintSchemaSources-BdFj8vPc.mjs";import{schemaFromIr as gr}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as Or,validatorIrToJsonSchema as Rr}from"./packem_shared/LUNORA_ERROR_CODES-C2s0xWQD.mjs";import{SDK_LANGUAGES as Tr,SDK_TARGETS as Ir,generateSdk as _r}from"./sdk/index.mjs";import{redact as Mr,secretKindOf as Fr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as Dr}from"./packem_shared/emitDrizzleSchema-DitcRZ1a.mjs";import{e as yr}from"./packem_shared/server-DAvi_bv_.mjs";import{e as Gr}from"./packem_shared/shard-CsfiXxV0.mjs";import{G as jr}from"./packem_shared/shared-DnCokNcE.mjs";import{MESSAGE_SOLUTIONS as kr,findSolutionByMessage as Wr}from"@lunora/errors";import{createCodegenProject as Vr,findTsconfig as zr,refreshCodegenProject as Qr}from"./packem_shared/createCodegenProject-C-fKC9h4.mjs";import{s as wr,t as Jr,u as Yr}from"./packem_shared/shard-runtime-BpoCV-aM.mjs";import{emitApi as Zr,emitCollections as $r,emitInternalApi as eo}from"./packem_shared/emitApi-CDgIPAG2.mjs";import{emitCrons as oo,emitScheduler as to,emitVectors as ao,emitWranglerCronTriggers as so}from"./packem_shared/emitCrons-BQW2lviZ.mjs";import{emitDataModel as fo}from"./packem_shared/emitDataModel-BskFt9Wv.mjs";import{emitFunctions as po}from"./packem_shared/emitFunctions-Cd0Tuw73.mjs";import{isTypedSchema as lo}from"./packem_shared/isTypedSchema-CKzc3ioR.mjs";const e="0.0.0";export{g as AGENTS_FILENAME,E as CAPABILITY_PROBES,L as CONTAINERS_FILENAME,A as CodegenDiagnosticError,Ze as DEFAULT_TARGET,j as FLAGS_FILENAME,jr as GENERATED_HEADER,Or as LUNORA_ERROR_CODES,kr as LUNORA_SOLUTION_RULES,ee as MUTATORS_FILENAME,se as NOTIFY_FILENAME,qe as OPENRPC_VERSION,ir as PROJECT_CONFIG_FILENAMES,xe as QUEUES_FILENAME,nr as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Tr as SDK_LANGUAGES,Ir as SDK_TARGETS,Me as SHAPES_FILENAME,xr as SchemaSnapshotParseError,e as VERSION,ye as WORKFLOWS_FILENAME,Ke as buildOpenApiDocument,we as buildOpenRpcDocument,Sr as buildSchemaSnapshot,b as capabilitiesUsedBy,Vr as createCodegenProject,n as describeErrorLevelFindings,v as diagnosticAt,a as diffSchemaSnapshots,N as discoverAgents,I as discoverAuthApiCalls,M as discoverContainers,P as discoverCrons,B as discoverFlags,W as discoverFunctions,V as discoverHttpRoutes,Q as discoverHyperdriveCalls,w as discoverInserts,Y as discoverMaskProcedures,Z as discoverMigrations,re as discoverMutators,te as discoverNondeterministicCalls,ie as discoverNotifyCalls,fe as discoverNotifyChannels,me as discoverNotifyConfig,le as discoverQueries,Se as discoverQueues,ue as discoverR2sqlCalls,ge as discoverRlsMetadata,ve as discoverRlsProcedures,Oe as discoverSandboxUsage,he as discoverSchema,Fe as discoverShapes,De as discoverStorageRulesMetadata,Ue as discoverWorkflows,wr as emitAgents,Zr as emitApi,He as emitApp,$r as emitCollections,Jr as emitContainers,oo as emitCrons,fo as emitDataModel,Dr as emitDrizzleSchema,po as emitFunctions,eo as emitInternalApi,Ve as emitOpenApi,ze as emitOpenApiModule,Je as emitOpenRpc,Ye as emitOpenRpcModule,to as emitScheduler,yr as emitServer,Gr as emitShard,ao as emitVectors,Yr as emitWorkflows,so as emitWranglerCronTriggers,l as errorAdvisoryNames,c as errorPlatformDiagnosticNames,Er as evaluateSchemaDrift,fr as findCodegenConfigFile,Wr as findLunoraSolution,mr as findProjectConfigFile,zr as findTsconfig,vr as fingerprintSchemaSources,y as foldCapabilitySignals,f as formatAdvisories,_r as generateSdk,Be as isD1GlobalTable,ke as isHyperdriveGlobalTable,R as isTestPath,lo as isTypedSchema,m as lintSchema,h as listLunoraSourceFiles,tr as loadProjectConfig,U as mayReadCapabilityContext,ur as parseSchemaSnapshot,$e as platformMatrixIds,dr as projectConfigCandidatePaths,pe as readPackageDependencies,ar as readProjectConfigLiterals,er as readProjectTarget,Ie as readServiceBindings,Mr as redact,Qr as refreshCodegenProject,rr as resolveCodegenTarget,_e as resolveServiceBindings,lr as runCodegen,gr as schemaFromIr,Fr as secretKindOf,s as serializeSchemaSnapshot,x as sortedUniqueNames,G as sourceCapabilitySignals,d as toAdvisorContext,Rr as validatorIrToJsonSchema};
@@ -1 +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-B81lOULB.mjs";import{a as h}from"./attribution-hVBriwzy.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-Cdv_LoVU.mjs";import{a as h}from"./attribution-RI-H1KPm.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 j}from"node:fs";import{join as I}from"node:path";import{containerClassName as A,containerBindingName as O,DURABLE_OBJECT_POLICY_FORBIDDEN_KEYS as k,isManagedImage as C,isCloudflareRegistryDigest as _,normalizeContainerImage as f}from"@lunora/container";import{SyntaxKind as $,Node as s}from"ts-morph";import{diagnosticAt as a}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{stringPropertyFor as D,findObjectProperty as p,symbolConstInitializer as M,outermostValueWrapper as w,isWriteTarget as F}from"./isTestPath-B81lOULB.mjs";import{a as V}from"./attribution-hVBriwzy.mjs";import{a as b}from"./project-config-file-BV7RR-l6.mjs";const K="containers.ts",B=t=>{const e=t.getSymbol();if(!e)return t.getText()==="defineContainer";for(const r of e.getDeclarations())if(s.isImportSpecifier(r))return r.getImportDeclaration().getModuleSpecifierValue()!=="@lunora/container"?!1:r.getNameNode().getText()==="defineContainer";return!1},d=D("container"),y=(t,e,r)=>{if(s.isNumericLiteral(t))return t.getLiteralValue();throw a(t,`container "${e}": \`${r}\` must be a static number literal — it is deploy configuration codegen writes into wrangler.jsonc`)},E=(t,e)=>{if(s.isStringLiteral(t)||s.isNoSubstitutionTemplateLiteral(t))return f(t.getLiteralValue());if(s.isObjectLiteralExpression(t)){const r=p(t,"registry");if(r&&s.isPropertyAssignment(r)){const i=r.getInitializerOrThrow();return f({registry:d(i,e,"image.registry")})}const n=p(t,"build");if(n&&s.isPropertyAssignment(n)){const i=n.getInitializerOrThrow();return f({build:d(i,e,"image.build")})}}throw a(t,`container "${e}": \`image\` must be a static string path, { registry: "…" }, or { build: "…" } literal`)},R=new Set(["buildArgs","image","images","instanceType","maxInstances","name","rollout","sandbox","schedulingPolicy"]),U=new Set(["gracePeriodSeconds","stepPercentage"]),L=t=>{let e=t;for(;s.isAsExpression(e)||s.isSatisfiesExpression(e)||s.isTypeAssertion(e)||s.isParenthesizedExpression(e);)e=e.getExpression();return e},N=(t,e)=>e.getDescendantsOfKind($.Identifier).some(r=>{if(r.getSymbol()!==t)return!1;let n=w(r),i=n.getParent();if(s.isCallExpression(i)&&i.getExpression().getText()==="Object.assign")return i.getArguments()[0]===n;for(;(s.isPropertyAccessExpression(i)||s.isElementAccessExpression(i))&&i.getExpression()===n;){if(F(i))return!0;n=w(i),i=n.getParent()}return!1}),Y=16,T=(t,e,r,n)=>{let i={name:r,symbol:t},o;for(let c=0;c<Y;c+=1){const l=M(i.symbol);if(l===void 0||!s.isExpression(l))return o;if(o=L(l),s.isObjectLiteralExpression(o)&&i.symbol!==void 0&&N(i.symbol,e.getSourceFile()))throw a(e,`${n}: \`${i.name}\` is a const object that is written to elsewhere in this file, so its initializer is not the value the container runs with. Declare the settings where they are final.`);if(!s.isIdentifier(o))return o;i={name:o.getText(),symbol:o.getSymbol()}}return o},P=(t,e)=>{const r=L(t);return s.isIdentifier(r)?T(r.getSymbol(),r,r.getText(),e)??r:r},z=t=>{const e=t.getNonNullableType();return(e.isUnion()?e.getUnionTypes():[e]).flatMap(n=>n.getApparentType().getProperties().map(i=>i.getName()))},W=(t,e,r)=>{const n=t.getExpression().getType(),i=e==="every"||n.isAny()||n.isUnknown()?["its keys"]:[...new Set(z(n))].filter(o=>e.has(o)).map(o=>`\`${o}\``);if(i.length>0)throw a(t,`${r}: this spread can set ${i.join(", ")}, which codegen writes into wrangler.jsonc and so must read statically. Spread a module-scope \`const\` object literal, or write the keys inline.`)},q=(t,e,r)=>{const n=b(t),i=s.isShorthandPropertyAssignment(t)?T(t.getValueSymbol(),t,n,r):void 0;if(i!==void 0)return[n,i];if(e==="every"||e.has(n))throw a(t,`${r}: \`${n}\` is deploy configuration codegen writes into wrangler.jsonc, so it must be a static literal — inline it, or name a module-scope \`const\` initialized with one.`)},m=(t,e,r,n=new Set)=>{const i=[],o=new Set(n).add(t);for(const c of t.getProperties())if(s.isPropertyAssignment(c))i.push([b(c),P(c.getInitializerOrThrow(),r)]);else if(s.isSpreadAssignment(c))i.push(...x(c,e,r,o));else{const l=q(c,e,r);l!==void 0&&i.push(l)}return i},x=(t,e,r,n)=>{const i=P(t.getExpression(),r);if(!s.isObjectLiteralExpression(i))return W(t,e,r),[];if(n.has(i))throw a(t,`${r}: this spread refers back to an object it is part of, so it has no static value.`);return m(i,e,r,n)},H=(t,e)=>{if(!s.isObjectLiteralExpression(t))throw a(t,`container "${e}": \`buildArgs\` must be a static object literal — it is deploy configuration codegen writes into wrangler.jsonc`);const r={};for(const[n,i]of m(t,"every",`container "${e}" buildArgs`))r[n]=d(i,e,`buildArgs.${n}`);return Object.keys(r).length>0?r:void 0},J=(t,e)=>{if(!s.isObjectLiteralExpression(t))throw a(t,`container "${e}": \`rollout\` must be a static object literal — it is deploy configuration codegen writes into wrangler.jsonc`);const r={};for(const[n,i]of m(t,U,`container "${e}" rollout`))(n==="gracePeriodSeconds"||n==="stepPercentage")&&(r[n]=y(i,e,`rollout.${n}`));return r.gracePeriodSeconds===void 0&&r.stepPercentage===void 0?void 0:r},v=t=>{if(s.isTrueLiteral(t))return!0;if(s.isFalseLiteral(t))return!1},S=t=>{if(s.isStringLiteral(t)||s.isNoSubstitutionTemplateLiteral(t)||s.isNumericLiteral(t))return t.getLiteralValue()},X=(t,e)=>{if(s.isStringLiteral(t))return t.getLiteralValue();if(s.isObjectLiteralExpression(t)){const r={};for(const n of t.getProperties()){if(!s.isPropertyAssignment(n))throw a(n,`container "${e}": \`instanceType\` must be an object of static number literals`);const i=b(n);if(i!=="diskMb"&&i!=="memoryMib"&&i!=="vcpu")throw a(n,`container "${e}": unknown \`instanceType\` field "${i}" — expected vcpu, memoryMib, or diskMb`);r[i]=y(n.getInitializerOrThrow(),e,`instanceType.${i}`)}return r}throw a(t,`container "${e}": \`instanceType\` must be a static string or { vcpu, memoryMib, diskMb } literal`)},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 r={};for(const[n,i]of m(t,"every",`container "${e}" images`)){const o=E(i,e);if(o.kind==="build")throw a(i,`container "${e}": \`images["${n}"]\` cannot be a Railpack { build } source — use a Dockerfile path or a { registry } reference`);if(o.kind==="registry"&&!_(o.reference))throw a(i,`container "${e}": \`images["${n}"].registry\` must be a digest-pinned (@sha256) reference under registry.cloudflare.com — push other registries' images there first`);r[n]=o}return r},Q=(t,e)=>{const r=t.findLast(([i])=>i==="schedulingPolicy");if(r===void 0)return;const n=d(r[1],e,"schedulingPolicy");if(n!=="default"&&n!=="durable_object")throw a(r[1],`container "${e}": unknown \`schedulingPolicy\` "${n}" — use "default" or "durable_object"`);return n==="durable_object"?n:void 0},Z=(t,e,r,n)=>{if(r!==void 0&&k.includes(t))throw a(e,`container "${n}": \`${t}\` is not supported with schedulingPolicy "durable_object"`);if(r===void 0&&t==="images")throw a(e,`container "${n}": \`images\` needs schedulingPolicy "durable_object"`)},ee=(t,e,r,n)=>{const{base:i,policy:o}=r;switch(t){case"buildArgs":{i.buildArgs=H(e,n);break}case"enableInternet":{i.enableInternet=v(e);break}case"hardTimeout":{i.hardTimeout=S(e);break}case"image":{r.scheduled||(o.image=E(e,n));break}case"images":{o.images=G(e,n);break}case"instanceType":{i.instanceType=X(e,n);break}case"maxInstances":{o.maxInstances=y(e,n,"maxInstances");break}case"name":{i.name=d(e,n,"name");break}case"rollout":{o.rollout=J(e,n);break}case"sandbox":{const c=v(e);if(c===void 0)throw a(e,`container "${n}": \`sandbox\` must be a static true/false literal`);i.sandbox=c;break}case"sleepAfter":{i.sleepAfter=S(e);break}}},te=(t,e,r)=>{const n=t.findLast(([o])=>o==="image")?.[1];if(n===void 0||!(s.isStringLiteral(n)||s.isNoSubstitutionTemplateLiteral(n)))return;const i=n.getLiteralValue();if(!Object.hasOwn(e??{},i)&&!C(i))throw a(n,`container "${r}": \`image\` "${i}" must name an entry of \`images\` or a Cloudflare-managed "cloudflare/…" image`)},ne=(t,e)=>{const r=t.getArguments()[0];if(!r||!s.isObjectLiteralExpression(r))throw a(t,`container "${e}": defineContainer must be passed an inline object literal`);const n=m(r,R,`container "${e}"`),i=Q(n,e),o={base:{bindingName:O(e),className:A(e),exportName:e},policy:{},scheduled:i!==void 0};for(const[g,u]of n)Z(g,u,i,e),ee(g,u,o,e);const{base:c,policy:l}=o;if(i==="durable_object")return te(n,l.images,e),{...c,...l.images===void 0?{}:{images:l.images},schedulingPolicy:i};if(l.image===void 0)throw a(r,`container "${e}": defineContainer requires a static \`image\` property`);return{...c,image:l.image,...l.maxInstances===void 0?{}:{maxInstances:l.maxInstances},...l.rollout===void 0?{}:{rollout:l.rollout}}},ie=t=>{const e=[],r=new Map;for(const n of t.getVariableDeclarations()){const i=n.getInitializer();if(i?.getKind()!==$.CallExpression)continue;const o=i,c=o.getExpression();if(!s.isIdentifier(c)||!B(c))continue;const l=n.getNameNode();if(!s.isIdentifier(l)){if(n.getVariableStatement()?.hasExportKeyword()!==!0)continue;throw a(l,"defineContainer exports must be plain named exports (no destructuring)")}const g=V(n,"binding");if(g===void 0)continue;const u=ne(o,g),h=r.get(u.bindingName);if(h!==void 0)throw a(l,`containers "${h}" and "${u.exportName}" both map to the binding ${u.bindingName} — rename one so each container gets its own Durable Object binding`);r.set(u.bindingName,u.exportName),e.push(u)}return e},de=(t,e)=>{const r=I(e,K);if(!j(r))return[];const n=t.getSourceFile(r)??t.addSourceFileAtPath(r),i=ie(n);return i.sort((o,c)=>o.exportName.localeCompare(c.exportName)),i};export{K as CONTAINERS_FILENAME,de as discoverContainers};
1
+ import{existsSync as j}from"node:fs";import{join as I}from"node:path";import{containerClassName as A,containerBindingName as O,DURABLE_OBJECT_POLICY_FORBIDDEN_KEYS as k,isManagedImage as C,isCloudflareRegistryDigest as _,normalizeContainerImage as f}from"@lunora/container";import{SyntaxKind as $,Node as s}from"ts-morph";import{diagnosticAt as a}from"./CodegenDiagnosticError-BUXlG3P-.mjs";import{stringPropertyFor as D,findObjectProperty as p,symbolConstInitializer as M,outermostValueWrapper as w,isWriteTarget as F}from"./isTestPath-Cdv_LoVU.mjs";import{a as V}from"./attribution-RI-H1KPm.mjs";import{a as b}from"./project-config-file-CBY6llht.mjs";const K="containers.ts",B=t=>{const e=t.getSymbol();if(!e)return t.getText()==="defineContainer";for(const r of e.getDeclarations())if(s.isImportSpecifier(r))return r.getImportDeclaration().getModuleSpecifierValue()!=="@lunora/container"?!1:r.getNameNode().getText()==="defineContainer";return!1},d=D("container"),y=(t,e,r)=>{if(s.isNumericLiteral(t))return t.getLiteralValue();throw a(t,`container "${e}": \`${r}\` must be a static number literal — it is deploy configuration codegen writes into wrangler.jsonc`)},E=(t,e)=>{if(s.isStringLiteral(t)||s.isNoSubstitutionTemplateLiteral(t))return f(t.getLiteralValue());if(s.isObjectLiteralExpression(t)){const r=p(t,"registry");if(r&&s.isPropertyAssignment(r)){const i=r.getInitializerOrThrow();return f({registry:d(i,e,"image.registry")})}const n=p(t,"build");if(n&&s.isPropertyAssignment(n)){const i=n.getInitializerOrThrow();return f({build:d(i,e,"image.build")})}}throw a(t,`container "${e}": \`image\` must be a static string path, { registry: "…" }, or { build: "…" } literal`)},R=new Set(["buildArgs","image","images","instanceType","maxInstances","name","rollout","sandbox","schedulingPolicy"]),U=new Set(["gracePeriodSeconds","stepPercentage"]),L=t=>{let e=t;for(;s.isAsExpression(e)||s.isSatisfiesExpression(e)||s.isTypeAssertion(e)||s.isParenthesizedExpression(e);)e=e.getExpression();return e},N=(t,e)=>e.getDescendantsOfKind($.Identifier).some(r=>{if(r.getSymbol()!==t)return!1;let n=w(r),i=n.getParent();if(s.isCallExpression(i)&&i.getExpression().getText()==="Object.assign")return i.getArguments()[0]===n;for(;(s.isPropertyAccessExpression(i)||s.isElementAccessExpression(i))&&i.getExpression()===n;){if(F(i))return!0;n=w(i),i=n.getParent()}return!1}),Y=16,T=(t,e,r,n)=>{let i={name:r,symbol:t},o;for(let c=0;c<Y;c+=1){const l=M(i.symbol);if(l===void 0||!s.isExpression(l))return o;if(o=L(l),s.isObjectLiteralExpression(o)&&i.symbol!==void 0&&N(i.symbol,e.getSourceFile()))throw a(e,`${n}: \`${i.name}\` is a const object that is written to elsewhere in this file, so its initializer is not the value the container runs with. Declare the settings where they are final.`);if(!s.isIdentifier(o))return o;i={name:o.getText(),symbol:o.getSymbol()}}return o},P=(t,e)=>{const r=L(t);return s.isIdentifier(r)?T(r.getSymbol(),r,r.getText(),e)??r:r},z=t=>{const e=t.getNonNullableType();return(e.isUnion()?e.getUnionTypes():[e]).flatMap(n=>n.getApparentType().getProperties().map(i=>i.getName()))},W=(t,e,r)=>{const n=t.getExpression().getType(),i=e==="every"||n.isAny()||n.isUnknown()?["its keys"]:[...new Set(z(n))].filter(o=>e.has(o)).map(o=>`\`${o}\``);if(i.length>0)throw a(t,`${r}: this spread can set ${i.join(", ")}, which codegen writes into wrangler.jsonc and so must read statically. Spread a module-scope \`const\` object literal, or write the keys inline.`)},q=(t,e,r)=>{const n=b(t),i=s.isShorthandPropertyAssignment(t)?T(t.getValueSymbol(),t,n,r):void 0;if(i!==void 0)return[n,i];if(e==="every"||e.has(n))throw a(t,`${r}: \`${n}\` is deploy configuration codegen writes into wrangler.jsonc, so it must be a static literal — inline it, or name a module-scope \`const\` initialized with one.`)},m=(t,e,r,n=new Set)=>{const i=[],o=new Set(n).add(t);for(const c of t.getProperties())if(s.isPropertyAssignment(c))i.push([b(c),P(c.getInitializerOrThrow(),r)]);else if(s.isSpreadAssignment(c))i.push(...x(c,e,r,o));else{const l=q(c,e,r);l!==void 0&&i.push(l)}return i},x=(t,e,r,n)=>{const i=P(t.getExpression(),r);if(!s.isObjectLiteralExpression(i))return W(t,e,r),[];if(n.has(i))throw a(t,`${r}: this spread refers back to an object it is part of, so it has no static value.`);return m(i,e,r,n)},H=(t,e)=>{if(!s.isObjectLiteralExpression(t))throw a(t,`container "${e}": \`buildArgs\` must be a static object literal — it is deploy configuration codegen writes into wrangler.jsonc`);const r={};for(const[n,i]of m(t,"every",`container "${e}" buildArgs`))r[n]=d(i,e,`buildArgs.${n}`);return Object.keys(r).length>0?r:void 0},J=(t,e)=>{if(!s.isObjectLiteralExpression(t))throw a(t,`container "${e}": \`rollout\` must be a static object literal — it is deploy configuration codegen writes into wrangler.jsonc`);const r={};for(const[n,i]of m(t,U,`container "${e}" rollout`))(n==="gracePeriodSeconds"||n==="stepPercentage")&&(r[n]=y(i,e,`rollout.${n}`));return r.gracePeriodSeconds===void 0&&r.stepPercentage===void 0?void 0:r},v=t=>{if(s.isTrueLiteral(t))return!0;if(s.isFalseLiteral(t))return!1},S=t=>{if(s.isStringLiteral(t)||s.isNoSubstitutionTemplateLiteral(t)||s.isNumericLiteral(t))return t.getLiteralValue()},X=(t,e)=>{if(s.isStringLiteral(t))return t.getLiteralValue();if(s.isObjectLiteralExpression(t)){const r={};for(const n of t.getProperties()){if(!s.isPropertyAssignment(n))throw a(n,`container "${e}": \`instanceType\` must be an object of static number literals`);const i=b(n);if(i!=="diskMb"&&i!=="memoryMib"&&i!=="vcpu")throw a(n,`container "${e}": unknown \`instanceType\` field "${i}" — expected vcpu, memoryMib, or diskMb`);r[i]=y(n.getInitializerOrThrow(),e,`instanceType.${i}`)}return r}throw a(t,`container "${e}": \`instanceType\` must be a static string or { vcpu, memoryMib, diskMb } literal`)},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 r={};for(const[n,i]of m(t,"every",`container "${e}" images`)){const o=E(i,e);if(o.kind==="build")throw a(i,`container "${e}": \`images["${n}"]\` cannot be a Railpack { build } source — use a Dockerfile path or a { registry } reference`);if(o.kind==="registry"&&!_(o.reference))throw a(i,`container "${e}": \`images["${n}"].registry\` must be a digest-pinned (@sha256) reference under registry.cloudflare.com — push other registries' images there first`);r[n]=o}return r},Q=(t,e)=>{const r=t.findLast(([i])=>i==="schedulingPolicy");if(r===void 0)return;const n=d(r[1],e,"schedulingPolicy");if(n!=="default"&&n!=="durable_object")throw a(r[1],`container "${e}": unknown \`schedulingPolicy\` "${n}" — use "default" or "durable_object"`);return n==="durable_object"?n:void 0},Z=(t,e,r,n)=>{if(r!==void 0&&k.includes(t))throw a(e,`container "${n}": \`${t}\` is not supported with schedulingPolicy "durable_object"`);if(r===void 0&&t==="images")throw a(e,`container "${n}": \`images\` needs schedulingPolicy "durable_object"`)},ee=(t,e,r,n)=>{const{base:i,policy:o}=r;switch(t){case"buildArgs":{i.buildArgs=H(e,n);break}case"enableInternet":{i.enableInternet=v(e);break}case"hardTimeout":{i.hardTimeout=S(e);break}case"image":{r.scheduled||(o.image=E(e,n));break}case"images":{o.images=G(e,n);break}case"instanceType":{i.instanceType=X(e,n);break}case"maxInstances":{o.maxInstances=y(e,n,"maxInstances");break}case"name":{i.name=d(e,n,"name");break}case"rollout":{o.rollout=J(e,n);break}case"sandbox":{const c=v(e);if(c===void 0)throw a(e,`container "${n}": \`sandbox\` must be a static true/false literal`);i.sandbox=c;break}case"sleepAfter":{i.sleepAfter=S(e);break}}},te=(t,e,r)=>{const n=t.findLast(([o])=>o==="image")?.[1];if(n===void 0||!(s.isStringLiteral(n)||s.isNoSubstitutionTemplateLiteral(n)))return;const i=n.getLiteralValue();if(!Object.hasOwn(e??{},i)&&!C(i))throw a(n,`container "${r}": \`image\` "${i}" must name an entry of \`images\` or a Cloudflare-managed "cloudflare/…" image`)},ne=(t,e)=>{const r=t.getArguments()[0];if(!r||!s.isObjectLiteralExpression(r))throw a(t,`container "${e}": defineContainer must be passed an inline object literal`);const n=m(r,R,`container "${e}"`),i=Q(n,e),o={base:{bindingName:O(e),className:A(e),exportName:e},policy:{},scheduled:i!==void 0};for(const[g,u]of n)Z(g,u,i,e),ee(g,u,o,e);const{base:c,policy:l}=o;if(i==="durable_object")return te(n,l.images,e),{...c,...l.images===void 0?{}:{images:l.images},schedulingPolicy:i};if(l.image===void 0)throw a(r,`container "${e}": defineContainer requires a static \`image\` property`);return{...c,image:l.image,...l.maxInstances===void 0?{}:{maxInstances:l.maxInstances},...l.rollout===void 0?{}:{rollout:l.rollout}}},ie=t=>{const e=[],r=new Map;for(const n of t.getVariableDeclarations()){const i=n.getInitializer();if(i?.getKind()!==$.CallExpression)continue;const o=i,c=o.getExpression();if(!s.isIdentifier(c)||!B(c))continue;const l=n.getNameNode();if(!s.isIdentifier(l)){if(n.getVariableStatement()?.hasExportKeyword()!==!0)continue;throw a(l,"defineContainer exports must be plain named exports (no destructuring)")}const g=V(n,"binding");if(g===void 0)continue;const u=ne(o,g),h=r.get(u.bindingName);if(h!==void 0)throw a(l,`containers "${h}" and "${u.exportName}" both map to the binding ${u.bindingName} — rename one so each container gets its own Durable Object binding`);r.set(u.bindingName,u.exportName),e.push(u)}return e},de=(t,e)=>{const r=I(e,K);if(!j(r))return[];const n=t.getSourceFile(r)??t.addSourceFileAtPath(r),i=ie(n);return i.sort((o,c)=>o.exportName.localeCompare(c.exportName)),i};export{K as CONTAINERS_FILENAME,de as discoverContainers};
@@ -1 +1 @@
1
- import{NODE_CAPABILITIES as g,CLOUDFLARE_CAPABILITIES as b,CELLD_CAPABILITIES as S}from"@lunora/platform";import{r as f}from"./project-config-file-BV7RR-l6.mjs";const m="cloudflare",y=t=>{const{target:e}=f(t);return e!==void 0&&e.length>0?e:void 0},z=(t,e)=>e??y(t)??m,I=(t,e)=>{if(e!==void 0)return[];const{target:a,unreadable:r}=f(t);return r!==!0||a!==void 0?[]:[{level:"warn",message:`lunora.config declares a \`target\` that codegen cannot read without evaluating it, so the "${m}" 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: "${m}" }\`), or pass \`--target\`.`,target:m}]},_={max:1536,min:32},E=(t,e)=>{if(t!=="cloudflare")return[];const{max:a,min:r}=_,i=`${String(r)}-${String(a)}`;return e.filter(({dimensions:o})=>o!==void 0&&(!Number.isInteger(o)||o<r||o>a)).map(({dimensions:o,name:s})=>({level:"warn",message:`Vector index "${s}" declares ${String(o)} dimensions; Cloudflare Vectorize accepts ${i}, so creating a Vectorize index for it fails at deploy.`,name:"platform_vector_dimensions_out_of_range",remediation:`If a Vectorize index backs "${s}", use ${i} dimensions (many embedding models can truncate output to fit). Ignore this if another store, such as pgvector, backs it.`,target:t}))},u={celld:S,cloudflare:b,node:g},D=(t,e)=>{const a=u[t];if(a===void 0)return!0;const r=a.features[e]?.level;return r==="native"||r==="emulated"},O=()=>Object.keys(u).toSorted((t,e)=>t.localeCompare(e)),w={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"},k=["agents","commitOrderedTables","containerEgressPolicy","containerRuntimeScheduling","containerSandboxTools","cronTriggers","crossShardFanout","deliveryAuthorization","durableStreams","globalTables","liveStreams","queues","relationGraph","secrets","services","topics","typedWebSockets","vectorStore","workerLoaders","workflowRollback","workflowSchedules"],h={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 })`)",deliveryAuthorization:"delivery authorization (`.deliveryAuthorization(...)` on the app builder)",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()`)",liveContext:"the live publisher (`ctx.live`)",liveStreams:"live topic streams (`defineLiveStream`)",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`)",typedWebSockets:"typed WebSocket routes and rooms (`defineWebSocket` / `defineRoom`)",vectorStore:"vector indexes (`.vectorize()`)",workerLoaders:"sandboxed agent scripts (`jsCodeTool`, on Worker Loaders)",workflowRollback:"workflow step rollback (`defineStep({ rollback })`)",workflowSchedules:"scheduled workflow instances (`defineWorkflow({ schedules })`)"},x=(t,e,a)=>({level:"error",message:`${e.name} does not support ${h[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)=>({level:"error",message:`${t.name} withholds live streams, so ctx.live is not available on the "${e}" target, but this app reads ctx.live.`,name:"platform_unsupported_feature",remediation:'Remove the ctx.live usage, or deploy to a target whose capability matrix marks "liveStreams" as native or emulated.',target:e}),P=t=>({level:"error",message:"This app declares defineLiveStream topics and enables delivery authorization. With delivery authorization on, the shard answers every /_lunora/live/* request with 501, so the live streams cannot be served.",name:"platform_live_stream_delivery_authorization",remediation:"Remove the defineLiveStream declarations, or remove the .deliveryAuthorization(...) call. Live streams and delivery authorization cannot be combined.",target:t}),W=t=>({level:"error",message:"This app declares defineWebSocket routes and enables delivery authorization. With delivery authorization on, the shard answers every route upgrade with 501, so the routes cannot be served.",name:"platform_socket_delivery_authorization",remediation:"Remove the defineWebSocket declarations, or remove the .deliveryAuthorization(...) call. Socket routes and delivery authorization cannot be combined.",target:t}),$=(t,e,a)=>({level:"error",message:`${e.name}'s capability matrix does not declare a support level for ${h[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}),A=t=>{const{diagnostics:e,gatedSignals:a,matrix:r,reported:i,signals:o,target:s}=t;for(const n of k){if(o[n]!==!0)continue;const d=r.features[n]?.level;d!=="unsupported"&&d!==void 0||(a[n]=!1,!i.has(n)&&e.push(d==="unsupported"?x(n,r,s):$(n,r,s)))}},L=(t,e,a,r={})=>{const i={...t},o={...r},s=[],n=new Set;for(const[l,c]of Object.entries(w)){if(c===null||!t[l])continue;const v=e.features[c]?.level;v==="unsupported"?(i[l]=!1,n.add(c),s.push({feature:l,level:"error",message:`${e.name} does not support "${l}" (ctx.${l}).`,name:"platform_unsupported_feature",remediation:`Remove the ctx.${l} usage, or deploy to a target whose capability matrix marks "${c}" as native or emulated.`,target:a})):v===void 0&&(i[l]=!1,n.add(c),s.push({feature:l,level:"error",message:`${e.name}'s capability matrix does not declare a support level for "${l}" (ctx.${l}). Treated as unsupported.`,name:"platform_undeclared_feature",remediation:`Rate "${c}" 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}))}A({diagnostics:s,gatedSignals:o,matrix:e,reported:n,signals:r,target:a});const d=e.features.liveStreams?.level,p=d===void 0||d==="unsupported";return r.liveContext===!0&&p&&s.push(T(e,a)),{diagnostics:s,liveStreamsWithheld:p,signals:o,usage:i}},F=(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}],liveStreamsWithheld:!1,signals:{...a},usage:{...t}}:L(t,r,e,a)},j=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,i)=>r.localeCompare(i));return{id:e.id,name:e.name,unsupported:a}};export{w as CAPABILITY_TO_FEATURE,m as DEFAULT_TARGET,L as gateAgainstMatrix,F as gatePlatformFeatures,P as liveStreamsDeliveryAuthorizationDiagnostic,D as platformFeatureAvailable,O as platformMatrixIds,y as readProjectTarget,I as readTargetDiagnostics,z as resolveCodegenTarget,W as socketRoutesDeliveryAuthorizationDiagnostic,j as studioPlatformFor,E as vectorizeDimensionDiagnostics};
1
+ import{NODE_CAPABILITIES as g,CLOUDFLARE_CAPABILITIES as b,CELLD_CAPABILITIES as S}from"@lunora/platform";import{r as f}from"./project-config-file-CBY6llht.mjs";const m="cloudflare",y=t=>{const{target:e}=f(t);return e!==void 0&&e.length>0?e:void 0},z=(t,e)=>e??y(t)??m,I=(t,e)=>{if(e!==void 0)return[];const{target:a,unreadable:r}=f(t);return r!==!0||a!==void 0?[]:[{level:"warn",message:`lunora.config declares a \`target\` that codegen cannot read without evaluating it, so the "${m}" 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: "${m}" }\`), or pass \`--target\`.`,target:m}]},_={max:1536,min:32},E=(t,e)=>{if(t!=="cloudflare")return[];const{max:a,min:r}=_,i=`${String(r)}-${String(a)}`;return e.filter(({dimensions:o})=>o!==void 0&&(!Number.isInteger(o)||o<r||o>a)).map(({dimensions:o,name:s})=>({level:"warn",message:`Vector index "${s}" declares ${String(o)} dimensions; Cloudflare Vectorize accepts ${i}, so creating a Vectorize index for it fails at deploy.`,name:"platform_vector_dimensions_out_of_range",remediation:`If a Vectorize index backs "${s}", use ${i} dimensions (many embedding models can truncate output to fit). Ignore this if another store, such as pgvector, backs it.`,target:t}))},u={celld:S,cloudflare:b,node:g},D=(t,e)=>{const a=u[t];if(a===void 0)return!0;const r=a.features[e]?.level;return r==="native"||r==="emulated"},O=()=>Object.keys(u).toSorted((t,e)=>t.localeCompare(e)),w={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"},k=["agents","commitOrderedTables","containerEgressPolicy","containerRuntimeScheduling","containerSandboxTools","cronTriggers","crossShardFanout","deliveryAuthorization","durableStreams","globalTables","liveStreams","queues","relationGraph","secrets","services","topics","typedWebSockets","vectorStore","workerLoaders","workflowRollback","workflowSchedules"],h={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 })`)",deliveryAuthorization:"delivery authorization (`.deliveryAuthorization(...)` on the app builder)",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()`)",liveContext:"the live publisher (`ctx.live`)",liveStreams:"live topic streams (`defineLiveStream`)",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`)",typedWebSockets:"typed WebSocket routes and rooms (`defineWebSocket` / `defineRoom`)",vectorStore:"vector indexes (`.vectorize()`)",workerLoaders:"sandboxed agent scripts (`jsCodeTool`, on Worker Loaders)",workflowRollback:"workflow step rollback (`defineStep({ rollback })`)",workflowSchedules:"scheduled workflow instances (`defineWorkflow({ schedules })`)"},x=(t,e,a)=>({level:"error",message:`${e.name} does not support ${h[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)=>({level:"error",message:`${t.name} withholds live streams, so ctx.live is not available on the "${e}" target, but this app reads ctx.live.`,name:"platform_unsupported_feature",remediation:'Remove the ctx.live usage, or deploy to a target whose capability matrix marks "liveStreams" as native or emulated.',target:e}),P=t=>({level:"error",message:"This app declares defineLiveStream topics and enables delivery authorization. With delivery authorization on, the shard answers every /_lunora/live/* request with 501, so the live streams cannot be served.",name:"platform_live_stream_delivery_authorization",remediation:"Remove the defineLiveStream declarations, or remove the .deliveryAuthorization(...) call. Live streams and delivery authorization cannot be combined.",target:t}),W=t=>({level:"error",message:"This app declares defineWebSocket routes and enables delivery authorization. With delivery authorization on, the shard answers every route upgrade with 501, so the routes cannot be served.",name:"platform_socket_delivery_authorization",remediation:"Remove the defineWebSocket declarations, or remove the .deliveryAuthorization(...) call. Socket routes and delivery authorization cannot be combined.",target:t}),$=(t,e,a)=>({level:"error",message:`${e.name}'s capability matrix does not declare a support level for ${h[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}),A=t=>{const{diagnostics:e,gatedSignals:a,matrix:r,reported:i,signals:o,target:s}=t;for(const n of k){if(o[n]!==!0)continue;const d=r.features[n]?.level;d!=="unsupported"&&d!==void 0||(a[n]=!1,!i.has(n)&&e.push(d==="unsupported"?x(n,r,s):$(n,r,s)))}},L=(t,e,a,r={})=>{const i={...t},o={...r},s=[],n=new Set;for(const[l,c]of Object.entries(w)){if(c===null||!t[l])continue;const v=e.features[c]?.level;v==="unsupported"?(i[l]=!1,n.add(c),s.push({feature:l,level:"error",message:`${e.name} does not support "${l}" (ctx.${l}).`,name:"platform_unsupported_feature",remediation:`Remove the ctx.${l} usage, or deploy to a target whose capability matrix marks "${c}" as native or emulated.`,target:a})):v===void 0&&(i[l]=!1,n.add(c),s.push({feature:l,level:"error",message:`${e.name}'s capability matrix does not declare a support level for "${l}" (ctx.${l}). Treated as unsupported.`,name:"platform_undeclared_feature",remediation:`Rate "${c}" 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}))}A({diagnostics:s,gatedSignals:o,matrix:e,reported:n,signals:r,target:a});const d=e.features.liveStreams?.level,p=d===void 0||d==="unsupported";return r.liveContext===!0&&p&&s.push(T(e,a)),{diagnostics:s,liveStreamsWithheld:p,signals:o,usage:i}},F=(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}],liveStreamsWithheld:!1,signals:{...a},usage:{...t}}:L(t,r,e,a)},j=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,i)=>r.localeCompare(i));return{id:e.id,name:e.name,unsupported:a}};export{w as CAPABILITY_TO_FEATURE,m as DEFAULT_TARGET,L as gateAgainstMatrix,F as gatePlatformFeatures,P as liveStreamsDeliveryAuthorizationDiagnostic,D as platformFeatureAvailable,O as platformMatrixIds,y as readProjectTarget,I as readTargetDiagnostics,z as resolveCodegenTarget,W as socketRoutesDeliveryAuthorizationDiagnostic,j as studioPlatformFor,E as vectorizeDimensionDiagnostics};
@@ -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-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
+ 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-Cdv_LoVU.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{b as M}from"./module-specifiers-BctA0m_p.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 b,i as D,f as g,d as O}from"./attribution-hVBriwzy.mjs";import{u as w}from"./unwrap-handler-return-CeaOifqX.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 b(t).filter(F=>D(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{b as M}from"./module-specifiers-BctA0m_p.mjs";import{p as A}from"./parse-validator-BqDQLzDZ.mjs";import{findObjectProperty as c,unwrapExpression as d,isConstDeclaration as P}from"./isTestPath-Cdv_LoVU.mjs";import{j as b,i as D,f as g,d as O}from"./attribution-RI-H1KPm.mjs";import{u as w}from"./unwrap-handler-return-Bfz7lH0C.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 b(t).filter(F=>D(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-B81lOULB.mjs";import{b as I,d as T}from"./attribution-hVBriwzy.mjs";import{i as l}from"./context-root-BTW5XwVq.mjs";import{c as C}from"./classify-procedure-call-Bw5sia-K.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-Cdv_LoVU.mjs";import{b as I,d as T}from"./attribution-RI-H1KPm.mjs";import{i as l}from"./context-root-DQd48e1F.mjs";import{c as C}from"./classify-procedure-call-C5JY2w5V.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-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)}
1
+ import{m}from"./modules-DDIIcM7P.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};
@@ -0,0 +1 @@
1
+ import{existsSync as t}from"node:fs";import{resolve as c,dirname as s,join as r}from"node:path";const f=["lunora.config.ts","lunora.config.mts","lunora.config.js","lunora.config.mjs"],p=i=>f.map(n=>c(i,n)).find(n=>t(n)),d=i=>{const n=[];let o=s(c(i));for(;;){if(n.push(...f.map(a=>r(o,a))),t(r(o,"package.json"))||t(r(o,".git")))return n;const e=s(o);if(e===o)return n;o=e}},l=i=>d(i).find(n=>t(n));export{f as PROJECT_CONFIG_FILENAMES,l as findCodegenConfigFile,p as findProjectConfigFile,d as projectConfigCandidatePaths};
@@ -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-B81lOULB.mjs";import{a as v}from"./attribution-hVBriwzy.mjs";import{r as $}from"./handler-reference-vIeqkhV_.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};
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-Cdv_LoVU.mjs";import{a as v}from"./attribution-RI-H1KPm.mjs";import{r as $}from"./handler-reference-8w_VU4XY.mjs";import{d as F}from"./modules-DDIIcM7P.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};