@lunora/codegen 1.0.0-alpha.173 → 1.0.0-alpha.175

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -2377,33 +2377,30 @@ type CapabilityKey = (typeof CAPABILITY_ROWS)[number]["key"];
2377
2377
  /** The default codegen target — today's behavior, byte-identical goldens. */
2378
2378
  declare const DEFAULT_TARGET = "cloudflare";
2379
2379
  /**
2380
- * Read `target` from `<projectRoot>/lunora.json`.
2380
+ * Read `target` from the project's `lunora.config.*`.
2381
2381
  *
2382
- * This lives in `@lunora/codegen` rather than `@lunora/config` — where the rest
2383
- * of the `lunora.json` reading lives — because `@lunora/config` depends on
2384
- * `@lunora/codegen`, not the reverse. Putting it there and importing it here
2385
- * would invert that edge, so config delegates to this instead and there is
2386
- * still exactly one parser for the key.
2387
- *
2388
- * Best-effort and deliberately unvalidated: a missing file, malformed JSONC, or
2389
- * a non-string value all collapse to `undefined`, because those are shape
2390
- * errors rather than a name the user meant. An unrecognized *name* is returned
2391
- * as-is so the caller's registry lookup rejects it — swallowing a typo into the
2392
- * default would ship an app to the wrong provider.
2393
- * @param projectRoot Directory containing `lunora.json`.
2382
+ * Read as a LITERAL rather than by evaluating the config: `runCodegen` is
2383
+ * synchronous and resolves the target inside itself, and `jiti`'s
2384
+ * non-deprecated entry point is async — see `project-config-file`'s header.
2385
+ * Best-effort and deliberately unvalidated: a missing file, a computed value, or
2386
+ * a non-string one all collapse to `undefined`, because those are shape errors
2387
+ * rather than a name the user meant. An unrecognized *name* is
2388
+ * returned as-is so the caller's registry lookup rejects it — swallowing a typo
2389
+ * into the default would ship an app to the wrong provider.
2390
+ * @param projectRoot Directory containing `lunora.config.*`.
2394
2391
  * @returns the declared target, or `undefined` when none is usable.
2395
2392
  */
2396
2393
  declare const readProjectTarget: (projectRoot: string) => string | undefined;
2397
2394
  /**
2398
2395
  * The target codegen should emit for: an explicit option wins, then
2399
- * `lunora.json`, then the default.
2396
+ * `lunora.config.*`, then the default.
2400
2397
  *
2401
2398
  * `runCodegen` applies this itself so a caller that forgets to pass a target
2402
2399
  * still emits the surface the project declared. That default matters more than
2403
2400
  * it looks: a call site that silently omits the target emits the *default*
2404
2401
  * surface with no diagnostic to notice, and the mismatch only shows up at
2405
2402
  * runtime on the deployed app.
2406
- * @param projectRoot Directory containing `lunora.json`.
2403
+ * @param projectRoot Directory containing `lunora.config.*`.
2407
2404
  * @param explicit A caller-supplied target, if any.
2408
2405
  * @returns the resolved target id — not guaranteed to be registered.
2409
2406
  */
@@ -2433,7 +2430,7 @@ interface PlatformDiagnostic {
2433
2430
  /** Human-readable explanation of the gap. */
2434
2431
  message: string;
2435
2432
  /** The lint id: `platform_unsupported_feature`, `platform_undeclared_feature`, or `platform_unknown_target`. */
2436
- name: "platform_undeclared_feature" | "platform_unknown_target" | "platform_unsupported_feature";
2433
+ name: "platform_undeclared_feature" | "platform_unknown_target" | "platform_unreadable_target" | "platform_unsupported_feature";
2437
2434
  /** How to resolve it. */
2438
2435
  remediation: string;
2439
2436
  /** The requested deploy target. */
@@ -3258,6 +3255,28 @@ declare const emitDrizzleSchema: (schema: SchemaIR, useUmbrella?: boolean) => {
3258
3255
  * finer-grained scheduling use Durable Object alarms (`@lunora/scheduler`),
3259
3256
  * which have no such cap.
3260
3257
  */
3258
+ /**
3259
+ * Emit `_generated/scheduler.ts` — the `SchedulerDO` class re-export, or `""`
3260
+ * when the app has no scheduler (the file is not written then).
3261
+ *
3262
+ * It exists so the class-A composed entry has something to FORWARD. wrangler
3263
+ * binds only what the worker entry exports, and `@lunora/vite` generates that
3264
+ * entry, so a Vite-first app had no file to add the re-export to and
3265
+ * `ctx.scheduler.runAfter` / `runAt` were unreachable.
3266
+ *
3267
+ * Emitted off the same `hasScheduler` that decides whether the builder even HAS
3268
+ * a `.scheduler()` method, and that is the whole point: the plugin composes the
3269
+ * call and the re-export off THIS FILE's existence, so the two cannot disagree.
3270
+ * Keying the plugin on the `wrangler.jsonc` binding instead let a project
3271
+ * declare the binding with no scheduler code and get
3272
+ * `TypeError: ….scheduler is not a function` at worker boot, from inside a
3273
+ * virtual module.
3274
+ *
3275
+ * `@lunora/scheduler` stays scoped — the umbrella ships no `./scheduler`
3276
+ * subpath — and `assertRequiredPackages` already demands the dependency off the
3277
+ * same signal, so the specifier cannot go unresolvable.
3278
+ */
3279
+ declare const emitScheduler: (hasScheduler: boolean) => string;
3261
3280
  declare const emitCrons: (crons: ReadonlyArray<CronJobIR>) => string;
3262
3281
  /**
3263
3282
  * Render `_generated/vectors.ts` — the static registry of every vector index
@@ -3484,6 +3503,78 @@ declare const emitOpenRpc: (input: OpenRpcEmitInput) => string;
3484
3503
  * the object returned by {@link buildOpenRpcDocument} (reused, never recomputed).
3485
3504
  */
3486
3505
  declare const emitOpenRpcModule: (document_: Record<string, unknown>) => string;
3506
+ /**
3507
+ * The config filenames probed at the project root, in order. TypeScript first
3508
+ * because that is what the templates ship and what the type-only `satisfies`
3509
+ * needs; the JS forms are accepted so a JS-authored project is not forced into
3510
+ * TypeScript for one file.
3511
+ *
3512
+ * The one exported truth: the dev server watches exactly these, and
3513
+ * {@link findProjectConfigFile} probes exactly these.
3514
+ *
3515
+ * `.cts` / `.cjs` are absent deliberately. Vite's default `resolve.extensions`
3516
+ * does not include them, so the specifier `@lunora/vite` emits for the `app`
3517
+ * hook would not resolve — and a config half of whose keys work is worse than
3518
+ * one the probe never finds.
3519
+ */
3520
+ declare const PROJECT_CONFIG_FILENAMES: ReadonlyArray<string>;
3521
+ /**
3522
+ * The literals {@link readProjectConfigLiterals} proves by parsing — narrowed,
3523
+ * unlike the evaluated shape below, because the parser has just established that
3524
+ * each one IS a string or a boolean. Callers that re-checked `typeof` were
3525
+ * re-validating a fact this file already knew.
3526
+ */
3527
+ interface ProjectConfigLiterals {
3528
+ remote?: boolean;
3529
+ target?: string;
3530
+ /**
3531
+ * A config file exists, but its default export could not be read as an
3532
+ * object literal — a computed value, a getter, a spread, `module.exports`.
3533
+ * The caller must not treat this as "no keys declared": that is how a
3534
+ * declared `target` becomes the default in silence.
3535
+ */
3536
+ unreadable?: boolean;
3537
+ }
3538
+ /** The structural slice of `lunora.config.*` Lunora reads. Unvalidated on purpose — see {@link loadProjectConfig}. */
3539
+ interface LunoraProjectConfig {
3540
+ /** The `app` hook: receives the generated `defineApp()` builder and returns it. Read by `@lunora/vite`, not by the CLI. */
3541
+ app?: unknown;
3542
+ /** Remote-binding dev preference. */
3543
+ remote?: unknown;
3544
+ /** Deploy target id. */
3545
+ target?: unknown;
3546
+ }
3547
+ /** What {@link loadProjectConfig} found: the config, or why it could not be evaluated. */
3548
+ interface LoadedProjectConfig {
3549
+ config?: LunoraProjectConfig;
3550
+ /**
3551
+ * Set when the file exists but evaluating it threw. Surfaced by the caller —
3552
+ * a config whose imports do not resolve on the host used to read as "no
3553
+ * config", which silently dropped the user's whole `app` hook.
3554
+ */
3555
+ error?: string;
3556
+ }
3557
+ /** The resolved config file, or `undefined` when the project ships none. */
3558
+ declare const findProjectConfigFile: (projectRoot: string) => string | undefined;
3559
+ /**
3560
+ * Load `lunora.config.*`, or `{}` when the project ships none.
3561
+ *
3562
+ * `moduleCache: false` is load-bearing, not a tuning knob: `jiti`'s module cache
3563
+ * lives on `globalThis`, so a NEW instance still hands back the module it
3564
+ * compiled the first time. Without it a config edit was never picked up in a
3565
+ * long-lived dev server — the watcher fired, the server restarted, and the hook
3566
+ * stayed as it was when the process started.
3567
+ *
3568
+ * `interopDefault` is off so the namespace is not collapsed onto its default
3569
+ * export: the hook has to come from `default` specifically, because that is what
3570
+ * the emitted worker entry imports (see the module header).
3571
+ */
3572
+ declare const loadProjectConfig: (projectRoot: string) => Promise<LoadedProjectConfig>;
3573
+ /**
3574
+ * The `target` and `remote` LITERALS declared in the config, without evaluating
3575
+ * it — see the module header for what this can and cannot see, and why.
3576
+ */
3577
+ declare const readProjectConfigLiterals: (projectRoot: string) => ProjectConfigLiterals;
3487
3578
  /**
3488
3579
  * Build a {@link SchemaSnapshot} from a parsed {@link SchemaIR} and the set of
3489
3580
  * declared migration ids. Tables and migration ids are sorted so the emitted
@@ -3879,4 +3970,4 @@ declare const secretKindOf: (value: string) => string | undefined;
3879
3970
  /** A redacted preview of a secret value — first 4 chars plus its length, never the full value. */
3880
3971
  declare const redact: (value: string) => string;
3881
3972
  declare const VERSION = "0.0.0";
3882
- export { AGENTS_FILENAME, type AgentIR, type AuthApiCallIR, CONTAINERS_FILENAME, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DriftChange, type DriftRemediation, type DriftScope, 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, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, NOTIFY_FILENAME, OPENRPC_VERSION, type OpenApiEmitInput, type OpenRpcDocument, type OpenRpcEmitInput, type OpenRpcMethod, type PlatformDiagnostic, type ProjectIR, QUEUES_FILENAME, type QueryReadIR, type QueueIR, type RelationSnapshot, type RlsMetadataIR, type RlsPolicyIR, type RlsProcedureIR, type RlsRoleIR, type RuntimeVerb, SCHEMA_SNAPSHOT_FILENAME, SCHEMA_SNAPSHOT_VERSION, SDK_LANGUAGES, SDK_TARGETS, SHAPES_FILENAME, type SandboxUsage, type SchemaDrift, type SchemaDriftDecision, type SchemaIR, type SchemaSnapshot, SchemaSnapshotParseError, type SdkFiles, type SdkMethod, type SdkNamespace, type SdkRenderInput, type SdkResult, type SdkTarget, type ShapeIR, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, createCodegenProject, describeErrorLevelFindings, diagnosticAt, diffSchemaSnapshots, discoverAgents, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverHyperdriveCalls, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverNotifyCalls, discoverNotifyConfig, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSandboxUsage, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitAgents, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, errorAdvisoryNames, errorPlatformDiagnosticNames, evaluateSchemaDrift, findTsconfig, formatAdvisories, generateSdk, isD1GlobalTable, isHyperdriveGlobalTable, isTypedSchema, lintSchema, listLunoraSourceFiles, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectTarget, redact, refreshCodegenProject, resolveCodegenTarget, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, toAdvisorContext, validatorIrToJsonSchema };
3973
+ export { AGENTS_FILENAME, type AgentIR, type AuthApiCallIR, CONTAINERS_FILENAME, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DriftChange, type DriftRemediation, type DriftScope, 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, OPENRPC_VERSION, type OpenApiEmitInput, type OpenRpcDocument, type OpenRpcEmitInput, type OpenRpcMethod, 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, type RuntimeVerb, SCHEMA_SNAPSHOT_FILENAME, SCHEMA_SNAPSHOT_VERSION, SDK_LANGUAGES, SDK_TARGETS, SHAPES_FILENAME, type SandboxUsage, type SchemaDrift, type SchemaDriftDecision, type SchemaIR, type SchemaSnapshot, SchemaSnapshotParseError, type SdkFiles, type SdkMethod, type SdkNamespace, type SdkRenderInput, type SdkResult, type SdkTarget, type ShapeIR, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, createCodegenProject, describeErrorLevelFindings, diagnosticAt, diffSchemaSnapshots, discoverAgents, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverHyperdriveCalls, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverNotifyCalls, discoverNotifyConfig, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSandboxUsage, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitAgents, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitScheduler, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, errorAdvisoryNames, errorPlatformDiagnosticNames, evaluateSchemaDrift, findProjectConfigFile, findTsconfig, formatAdvisories, generateSdk, isD1GlobalTable, isHyperdriveGlobalTable, isTypedSchema, lintSchema, listLunoraSourceFiles, loadProjectConfig, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectConfigLiterals, readProjectTarget, redact, refreshCodegenProject, resolveCodegenTarget, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, toAdvisorContext, validatorIrToJsonSchema };
package/dist/index.d.ts CHANGED
@@ -2377,33 +2377,30 @@ type CapabilityKey = (typeof CAPABILITY_ROWS)[number]["key"];
2377
2377
  /** The default codegen target — today's behavior, byte-identical goldens. */
2378
2378
  declare const DEFAULT_TARGET = "cloudflare";
2379
2379
  /**
2380
- * Read `target` from `<projectRoot>/lunora.json`.
2380
+ * Read `target` from the project's `lunora.config.*`.
2381
2381
  *
2382
- * This lives in `@lunora/codegen` rather than `@lunora/config` — where the rest
2383
- * of the `lunora.json` reading lives — because `@lunora/config` depends on
2384
- * `@lunora/codegen`, not the reverse. Putting it there and importing it here
2385
- * would invert that edge, so config delegates to this instead and there is
2386
- * still exactly one parser for the key.
2387
- *
2388
- * Best-effort and deliberately unvalidated: a missing file, malformed JSONC, or
2389
- * a non-string value all collapse to `undefined`, because those are shape
2390
- * errors rather than a name the user meant. An unrecognized *name* is returned
2391
- * as-is so the caller's registry lookup rejects it — swallowing a typo into the
2392
- * default would ship an app to the wrong provider.
2393
- * @param projectRoot Directory containing `lunora.json`.
2382
+ * Read as a LITERAL rather than by evaluating the config: `runCodegen` is
2383
+ * synchronous and resolves the target inside itself, and `jiti`'s
2384
+ * non-deprecated entry point is async — see `project-config-file`'s header.
2385
+ * Best-effort and deliberately unvalidated: a missing file, a computed value, or
2386
+ * a non-string one all collapse to `undefined`, because those are shape errors
2387
+ * rather than a name the user meant. An unrecognized *name* is
2388
+ * returned as-is so the caller's registry lookup rejects it — swallowing a typo
2389
+ * into the default would ship an app to the wrong provider.
2390
+ * @param projectRoot Directory containing `lunora.config.*`.
2394
2391
  * @returns the declared target, or `undefined` when none is usable.
2395
2392
  */
2396
2393
  declare const readProjectTarget: (projectRoot: string) => string | undefined;
2397
2394
  /**
2398
2395
  * The target codegen should emit for: an explicit option wins, then
2399
- * `lunora.json`, then the default.
2396
+ * `lunora.config.*`, then the default.
2400
2397
  *
2401
2398
  * `runCodegen` applies this itself so a caller that forgets to pass a target
2402
2399
  * still emits the surface the project declared. That default matters more than
2403
2400
  * it looks: a call site that silently omits the target emits the *default*
2404
2401
  * surface with no diagnostic to notice, and the mismatch only shows up at
2405
2402
  * runtime on the deployed app.
2406
- * @param projectRoot Directory containing `lunora.json`.
2403
+ * @param projectRoot Directory containing `lunora.config.*`.
2407
2404
  * @param explicit A caller-supplied target, if any.
2408
2405
  * @returns the resolved target id — not guaranteed to be registered.
2409
2406
  */
@@ -2433,7 +2430,7 @@ interface PlatformDiagnostic {
2433
2430
  /** Human-readable explanation of the gap. */
2434
2431
  message: string;
2435
2432
  /** The lint id: `platform_unsupported_feature`, `platform_undeclared_feature`, or `platform_unknown_target`. */
2436
- name: "platform_undeclared_feature" | "platform_unknown_target" | "platform_unsupported_feature";
2433
+ name: "platform_undeclared_feature" | "platform_unknown_target" | "platform_unreadable_target" | "platform_unsupported_feature";
2437
2434
  /** How to resolve it. */
2438
2435
  remediation: string;
2439
2436
  /** The requested deploy target. */
@@ -3258,6 +3255,28 @@ declare const emitDrizzleSchema: (schema: SchemaIR, useUmbrella?: boolean) => {
3258
3255
  * finer-grained scheduling use Durable Object alarms (`@lunora/scheduler`),
3259
3256
  * which have no such cap.
3260
3257
  */
3258
+ /**
3259
+ * Emit `_generated/scheduler.ts` — the `SchedulerDO` class re-export, or `""`
3260
+ * when the app has no scheduler (the file is not written then).
3261
+ *
3262
+ * It exists so the class-A composed entry has something to FORWARD. wrangler
3263
+ * binds only what the worker entry exports, and `@lunora/vite` generates that
3264
+ * entry, so a Vite-first app had no file to add the re-export to and
3265
+ * `ctx.scheduler.runAfter` / `runAt` were unreachable.
3266
+ *
3267
+ * Emitted off the same `hasScheduler` that decides whether the builder even HAS
3268
+ * a `.scheduler()` method, and that is the whole point: the plugin composes the
3269
+ * call and the re-export off THIS FILE's existence, so the two cannot disagree.
3270
+ * Keying the plugin on the `wrangler.jsonc` binding instead let a project
3271
+ * declare the binding with no scheduler code and get
3272
+ * `TypeError: ….scheduler is not a function` at worker boot, from inside a
3273
+ * virtual module.
3274
+ *
3275
+ * `@lunora/scheduler` stays scoped — the umbrella ships no `./scheduler`
3276
+ * subpath — and `assertRequiredPackages` already demands the dependency off the
3277
+ * same signal, so the specifier cannot go unresolvable.
3278
+ */
3279
+ declare const emitScheduler: (hasScheduler: boolean) => string;
3261
3280
  declare const emitCrons: (crons: ReadonlyArray<CronJobIR>) => string;
3262
3281
  /**
3263
3282
  * Render `_generated/vectors.ts` — the static registry of every vector index
@@ -3484,6 +3503,78 @@ declare const emitOpenRpc: (input: OpenRpcEmitInput) => string;
3484
3503
  * the object returned by {@link buildOpenRpcDocument} (reused, never recomputed).
3485
3504
  */
3486
3505
  declare const emitOpenRpcModule: (document_: Record<string, unknown>) => string;
3506
+ /**
3507
+ * The config filenames probed at the project root, in order. TypeScript first
3508
+ * because that is what the templates ship and what the type-only `satisfies`
3509
+ * needs; the JS forms are accepted so a JS-authored project is not forced into
3510
+ * TypeScript for one file.
3511
+ *
3512
+ * The one exported truth: the dev server watches exactly these, and
3513
+ * {@link findProjectConfigFile} probes exactly these.
3514
+ *
3515
+ * `.cts` / `.cjs` are absent deliberately. Vite's default `resolve.extensions`
3516
+ * does not include them, so the specifier `@lunora/vite` emits for the `app`
3517
+ * hook would not resolve — and a config half of whose keys work is worse than
3518
+ * one the probe never finds.
3519
+ */
3520
+ declare const PROJECT_CONFIG_FILENAMES: ReadonlyArray<string>;
3521
+ /**
3522
+ * The literals {@link readProjectConfigLiterals} proves by parsing — narrowed,
3523
+ * unlike the evaluated shape below, because the parser has just established that
3524
+ * each one IS a string or a boolean. Callers that re-checked `typeof` were
3525
+ * re-validating a fact this file already knew.
3526
+ */
3527
+ interface ProjectConfigLiterals {
3528
+ remote?: boolean;
3529
+ target?: string;
3530
+ /**
3531
+ * A config file exists, but its default export could not be read as an
3532
+ * object literal — a computed value, a getter, a spread, `module.exports`.
3533
+ * The caller must not treat this as "no keys declared": that is how a
3534
+ * declared `target` becomes the default in silence.
3535
+ */
3536
+ unreadable?: boolean;
3537
+ }
3538
+ /** The structural slice of `lunora.config.*` Lunora reads. Unvalidated on purpose — see {@link loadProjectConfig}. */
3539
+ interface LunoraProjectConfig {
3540
+ /** The `app` hook: receives the generated `defineApp()` builder and returns it. Read by `@lunora/vite`, not by the CLI. */
3541
+ app?: unknown;
3542
+ /** Remote-binding dev preference. */
3543
+ remote?: unknown;
3544
+ /** Deploy target id. */
3545
+ target?: unknown;
3546
+ }
3547
+ /** What {@link loadProjectConfig} found: the config, or why it could not be evaluated. */
3548
+ interface LoadedProjectConfig {
3549
+ config?: LunoraProjectConfig;
3550
+ /**
3551
+ * Set when the file exists but evaluating it threw. Surfaced by the caller —
3552
+ * a config whose imports do not resolve on the host used to read as "no
3553
+ * config", which silently dropped the user's whole `app` hook.
3554
+ */
3555
+ error?: string;
3556
+ }
3557
+ /** The resolved config file, or `undefined` when the project ships none. */
3558
+ declare const findProjectConfigFile: (projectRoot: string) => string | undefined;
3559
+ /**
3560
+ * Load `lunora.config.*`, or `{}` when the project ships none.
3561
+ *
3562
+ * `moduleCache: false` is load-bearing, not a tuning knob: `jiti`'s module cache
3563
+ * lives on `globalThis`, so a NEW instance still hands back the module it
3564
+ * compiled the first time. Without it a config edit was never picked up in a
3565
+ * long-lived dev server — the watcher fired, the server restarted, and the hook
3566
+ * stayed as it was when the process started.
3567
+ *
3568
+ * `interopDefault` is off so the namespace is not collapsed onto its default
3569
+ * export: the hook has to come from `default` specifically, because that is what
3570
+ * the emitted worker entry imports (see the module header).
3571
+ */
3572
+ declare const loadProjectConfig: (projectRoot: string) => Promise<LoadedProjectConfig>;
3573
+ /**
3574
+ * The `target` and `remote` LITERALS declared in the config, without evaluating
3575
+ * it — see the module header for what this can and cannot see, and why.
3576
+ */
3577
+ declare const readProjectConfigLiterals: (projectRoot: string) => ProjectConfigLiterals;
3487
3578
  /**
3488
3579
  * Build a {@link SchemaSnapshot} from a parsed {@link SchemaIR} and the set of
3489
3580
  * declared migration ids. Tables and migration ids are sorted so the emitted
@@ -3879,4 +3970,4 @@ declare const secretKindOf: (value: string) => string | undefined;
3879
3970
  /** A redacted preview of a secret value — first 4 chars plus its length, never the full value. */
3880
3971
  declare const redact: (value: string) => string;
3881
3972
  declare const VERSION = "0.0.0";
3882
- export { AGENTS_FILENAME, type AgentIR, type AuthApiCallIR, CONTAINERS_FILENAME, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DriftChange, type DriftRemediation, type DriftScope, 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, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, NOTIFY_FILENAME, OPENRPC_VERSION, type OpenApiEmitInput, type OpenRpcDocument, type OpenRpcEmitInput, type OpenRpcMethod, type PlatformDiagnostic, type ProjectIR, QUEUES_FILENAME, type QueryReadIR, type QueueIR, type RelationSnapshot, type RlsMetadataIR, type RlsPolicyIR, type RlsProcedureIR, type RlsRoleIR, type RuntimeVerb, SCHEMA_SNAPSHOT_FILENAME, SCHEMA_SNAPSHOT_VERSION, SDK_LANGUAGES, SDK_TARGETS, SHAPES_FILENAME, type SandboxUsage, type SchemaDrift, type SchemaDriftDecision, type SchemaIR, type SchemaSnapshot, SchemaSnapshotParseError, type SdkFiles, type SdkMethod, type SdkNamespace, type SdkRenderInput, type SdkResult, type SdkTarget, type ShapeIR, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, createCodegenProject, describeErrorLevelFindings, diagnosticAt, diffSchemaSnapshots, discoverAgents, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverHyperdriveCalls, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverNotifyCalls, discoverNotifyConfig, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSandboxUsage, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitAgents, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, errorAdvisoryNames, errorPlatformDiagnosticNames, evaluateSchemaDrift, findTsconfig, formatAdvisories, generateSdk, isD1GlobalTable, isHyperdriveGlobalTable, isTypedSchema, lintSchema, listLunoraSourceFiles, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectTarget, redact, refreshCodegenProject, resolveCodegenTarget, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, toAdvisorContext, validatorIrToJsonSchema };
3973
+ export { AGENTS_FILENAME, type AgentIR, type AuthApiCallIR, CONTAINERS_FILENAME, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DriftChange, type DriftRemediation, type DriftScope, 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, OPENRPC_VERSION, type OpenApiEmitInput, type OpenRpcDocument, type OpenRpcEmitInput, type OpenRpcMethod, 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, type RuntimeVerb, SCHEMA_SNAPSHOT_FILENAME, SCHEMA_SNAPSHOT_VERSION, SDK_LANGUAGES, SDK_TARGETS, SHAPES_FILENAME, type SandboxUsage, type SchemaDrift, type SchemaDriftDecision, type SchemaIR, type SchemaSnapshot, SchemaSnapshotParseError, type SdkFiles, type SdkMethod, type SdkNamespace, type SdkRenderInput, type SdkResult, type SdkTarget, type ShapeIR, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, createCodegenProject, describeErrorLevelFindings, diagnosticAt, diffSchemaSnapshots, discoverAgents, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverHyperdriveCalls, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverNotifyCalls, discoverNotifyConfig, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSandboxUsage, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitAgents, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitScheduler, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, errorAdvisoryNames, errorPlatformDiagnosticNames, evaluateSchemaDrift, findProjectConfigFile, findTsconfig, formatAdvisories, generateSdk, isD1GlobalTable, isHyperdriveGlobalTable, isTypedSchema, lintSchema, listLunoraSourceFiles, loadProjectConfig, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectConfigLiterals, readProjectTarget, redact, refreshCodegenProject, resolveCodegenTarget, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, 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-CWESEYLi.mjs";import{formatAdvisories as m,lintSchema as d,toAdvisorContext as f}from"./packem_shared/formatAdvisories-CkEu1eye.mjs";import{describeErrorLevelFindings as c,errorAdvisoryNames as n,errorPlatformDiagnosticNames as l}from"./packem_shared/describeErrorLevelFindings-D23VSkFP.mjs";import{CodegenDiagnosticError as x,diagnosticAt as E}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as u,discoverAgents as v}from"./packem_shared/AGENTS_FILENAME-B78F7DuQ.mjs";import{listLunoraSourceFiles as g}from"./packem_shared/listLunoraSourceFiles-D4xthUf-.mjs";import{default as R}from"./packem_shared/discoverAuthApiCalls-DoblmzUW.mjs";import{CONTAINERS_FILENAME as M,discoverContainers as T}from"./packem_shared/CONTAINERS_FILENAME-CQoUu7n7.mjs";import{default as _}from"./packem_shared/discoverCrons-CMu0sA8k.mjs";import{FLAGS_FILENAME as I,discoverFlags as F}from"./packem_shared/FLAGS_FILENAME-CoTJH0-7.mjs";import{default as P}from"./packem_shared/discoverFunctions-DB9G_XrW.mjs";import{default as U}from"./packem_shared/discoverHttpRoutes-S81Iv_iB.mjs";import{default as H}from"./packem_shared/discoverHyperdriveCalls-DgAYcZRD.mjs";import{default as k}from"./packem_shared/discoverInserts-COk-Sm_n.mjs";import{d as j}from"./packem_shared/index-D_Z8rX-f.mjs";import{default as V}from"./packem_shared/discoverMigrations-B_sYrTyE.mjs";import{MUTATORS_FILENAME as Q,discoverMutators as w}from"./packem_shared/MUTATORS_FILENAME-CTHlZ1j6.mjs";import{default as B}from"./packem_shared/discoverNondeterministicCalls-DkVVHe3U.mjs";import{NOTIFY_FILENAME as Y,discoverNotifyCalls as X,discoverNotifyConfig as Z}from"./packem_shared/NOTIFY_FILENAME-CZh4jN4q.mjs";import{default as ee}from"./packem_shared/readPackageDependencies-C6h6FZuP.mjs";import{d as oe}from"./packem_shared/queries-CPlxXagL.mjs";import{QUEUES_FILENAME as se,discoverQueues as ae}from"./packem_shared/QUEUES_FILENAME-Q3CF3uYr.mjs";import{default as me}from"./packem_shared/discoverR2sqlCalls-6u0OKy2N.mjs";import{default as fe}from"./packem_shared/discoverRlsProcedures-vJZq3yhb.mjs";import{default as ce}from"./packem_shared/discoverRlsMetadata-CwWRPb8N.mjs";import{discoverSandboxUsage as le}from"./packem_shared/discoverSandboxUsage-DskdDbkM.mjs";import{default as xe}from"./packem_shared/discoverSchema-DoZtXwLg.mjs";import{SHAPES_FILENAME as Ae,discoverShapes as ue}from"./packem_shared/SHAPES_FILENAME-Bvd5kgsF.mjs";import{default as Ne}from"./packem_shared/discoverStorageRulesMetadata-xhxu-mkS.mjs";import{WORKFLOWS_FILENAME as Oe,discoverWorkflows as Re}from"./packem_shared/WORKFLOWS_FILENAME-BaSbufF2.mjs";import{G as Me,e as Te,a as he,b as _e,c as Le,d as Ie,f as Fe,g as De,h as Pe,i as Ge,j as Ue,k as be,l as He,m as ye}from"./packem_shared/emit-B2PLgxM0.mjs";import{emitApp as We}from"./packem_shared/emitApp-DN-9pbIM.mjs";import{isD1GlobalTable as Ke,isHyperdriveGlobalTable as Ve}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as Qe,emitOpenApi as we,emitOpenApiModule as qe}from"./packem_shared/buildOpenApiDocument-BlImTugs.mjs";import{OPENRPC_VERSION as Je,buildOpenRpcDocument as Ye,emitOpenRpc as Xe,emitOpenRpcModule as Ze}from"./packem_shared/OPENRPC_VERSION-B-7SyEfS.mjs";import{DEFAULT_TARGET as er,platformMatrixIds as rr,readProjectTarget as or,resolveCodegenTarget as tr}from"./packem_shared/DEFAULT_TARGET-lPq34YeN.mjs";import{SCHEMA_SNAPSHOT_FILENAME as ar,createCodegenProject as ir,findTsconfig as mr,refreshCodegenProject as dr,runCodegen as fr}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-CjzGxonx.mjs";import{SchemaSnapshotParseError as cr,buildSchemaSnapshot as nr,evaluateSchemaDrift as lr,parseSchemaSnapshot as Sr}from"./packem_shared/SchemaSnapshotParseError-yrVM8bTa.mjs";import{schemaFromIr as Er}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as ur,validatorIrToJsonSchema as vr}from"./packem_shared/LUNORA_ERROR_CODES-CW7-uASH.mjs";import{SDK_LANGUAGES as gr,SDK_TARGETS as Or,generateSdk as Rr}from"./packem_shared/SDK_LANGUAGES-CFyux-74.mjs";import{redact as Mr,secretKindOf as Tr}from"./packem_shared/redact-Cy14LEnc.mjs";import{MESSAGE_SOLUTIONS as _r,findSolutionByMessage as Lr}from"@lunora/errors";import{isTypedSchema as Fr}from"./packem_shared/isTypedSchema-B_qlBbE-.mjs";const e="0.0.0";export{u as AGENTS_FILENAME,M as CONTAINERS_FILENAME,x as CodegenDiagnosticError,er as DEFAULT_TARGET,I as FLAGS_FILENAME,Me as GENERATED_HEADER,ur as LUNORA_ERROR_CODES,_r as LUNORA_SOLUTION_RULES,Q as MUTATORS_FILENAME,Y as NOTIFY_FILENAME,Je as OPENRPC_VERSION,se as QUEUES_FILENAME,ar as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,gr as SDK_LANGUAGES,Or as SDK_TARGETS,Ae as SHAPES_FILENAME,cr as SchemaSnapshotParseError,e as VERSION,Oe as WORKFLOWS_FILENAME,Qe as buildOpenApiDocument,Ye as buildOpenRpcDocument,nr as buildSchemaSnapshot,ir as createCodegenProject,c as describeErrorLevelFindings,E as diagnosticAt,s as diffSchemaSnapshots,v as discoverAgents,R as discoverAuthApiCalls,T as discoverContainers,_ as discoverCrons,F as discoverFlags,P as discoverFunctions,U as discoverHttpRoutes,H as discoverHyperdriveCalls,k as discoverInserts,j as discoverMaskProcedures,V as discoverMigrations,w as discoverMutators,B as discoverNondeterministicCalls,X as discoverNotifyCalls,Z as discoverNotifyConfig,oe as discoverQueries,ae as discoverQueues,me as discoverR2sqlCalls,ce as discoverRlsMetadata,fe as discoverRlsProcedures,le as discoverSandboxUsage,xe as discoverSchema,ue as discoverShapes,Ne as discoverStorageRulesMetadata,Re as discoverWorkflows,Te as emitAgents,he as emitApi,We as emitApp,_e as emitCollections,Le as emitContainers,Ie as emitCrons,Fe as emitDataModel,De as emitDrizzleSchema,Pe as emitFunctions,we as emitOpenApi,qe as emitOpenApiModule,Xe as emitOpenRpc,Ze as emitOpenRpcModule,Ge as emitServer,Ue as emitShard,be as emitVectors,He as emitWorkflows,ye as emitWranglerCronTriggers,n as errorAdvisoryNames,l as errorPlatformDiagnosticNames,lr as evaluateSchemaDrift,Lr as findLunoraSolution,mr as findTsconfig,m as formatAdvisories,Rr as generateSdk,Ke as isD1GlobalTable,Ve as isHyperdriveGlobalTable,Fr as isTypedSchema,d as lintSchema,g as listLunoraSourceFiles,Sr as parseSchemaSnapshot,rr as platformMatrixIds,ee as readPackageDependencies,or as readProjectTarget,Mr as redact,dr as refreshCodegenProject,tr as resolveCodegenTarget,fr as runCodegen,Er as schemaFromIr,Tr as secretKindOf,a as serializeSchemaSnapshot,f as toAdvisorContext,vr as validatorIrToJsonSchema};
1
+ import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as s,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-CWESEYLi.mjs";import{formatAdvisories as m,lintSchema as d,toAdvisorContext as f}from"./packem_shared/formatAdvisories-CkEu1eye.mjs";import{describeErrorLevelFindings as c,errorAdvisoryNames as n,errorPlatformDiagnosticNames as l}from"./packem_shared/describeErrorLevelFindings-D23VSkFP.mjs";import{CodegenDiagnosticError as x,diagnosticAt as E}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as u,discoverAgents as v}from"./packem_shared/AGENTS_FILENAME-B78F7DuQ.mjs";import{listLunoraSourceFiles as g}from"./packem_shared/listLunoraSourceFiles-D4xthUf-.mjs";import{default as O}from"./packem_shared/discoverAuthApiCalls-DoblmzUW.mjs";import{CONTAINERS_FILENAME as M,discoverContainers as T}from"./packem_shared/CONTAINERS_FILENAME-CQoUu7n7.mjs";import{default as h}from"./packem_shared/discoverCrons-CMu0sA8k.mjs";import{FLAGS_FILENAME as F,discoverFlags as I}from"./packem_shared/FLAGS_FILENAME-CoTJH0-7.mjs";import{default as D}from"./packem_shared/discoverFunctions-DB9G_XrW.mjs";import{default as U}from"./packem_shared/discoverHttpRoutes-S81Iv_iB.mjs";import{default as H}from"./packem_shared/discoverHyperdriveCalls-DgAYcZRD.mjs";import{default as y}from"./packem_shared/discoverInserts-COk-Sm_n.mjs";import{d as W}from"./packem_shared/index-D_Z8rX-f.mjs";import{default as V}from"./packem_shared/discoverMigrations-B_sYrTyE.mjs";import{MUTATORS_FILENAME as Q,discoverMutators as w}from"./packem_shared/MUTATORS_FILENAME-CTHlZ1j6.mjs";import{default as q}from"./packem_shared/discoverNondeterministicCalls-DkVVHe3U.mjs";import{NOTIFY_FILENAME as Y,discoverNotifyCalls as X,discoverNotifyConfig as Z}from"./packem_shared/NOTIFY_FILENAME-CZh4jN4q.mjs";import{default as ee}from"./packem_shared/readPackageDependencies-C6h6FZuP.mjs";import{d as oe}from"./packem_shared/queries-CPlxXagL.mjs";import{QUEUES_FILENAME as se,discoverQueues as ae}from"./packem_shared/QUEUES_FILENAME-Q3CF3uYr.mjs";import{default as me}from"./packem_shared/discoverR2sqlCalls-6u0OKy2N.mjs";import{default as fe}from"./packem_shared/discoverRlsProcedures-vJZq3yhb.mjs";import{default as ce}from"./packem_shared/discoverRlsMetadata-CwWRPb8N.mjs";import{discoverSandboxUsage as le}from"./packem_shared/discoverSandboxUsage-DskdDbkM.mjs";import{default as xe}from"./packem_shared/discoverSchema-DoZtXwLg.mjs";import{SHAPES_FILENAME as Ae,discoverShapes as ue}from"./packem_shared/SHAPES_FILENAME-Bvd5kgsF.mjs";import{default as Ne}from"./packem_shared/discoverStorageRulesMetadata-xhxu-mkS.mjs";import{WORKFLOWS_FILENAME as Ce,discoverWorkflows as Oe}from"./packem_shared/WORKFLOWS_FILENAME-BaSbufF2.mjs";import{G as Me,e as Te,a as _e,b as he,c as Le,d as Fe,f as Ie,g as Pe,h as De,i as Ge,j as Ue,k as be,l as He,m as je,n as ye}from"./packem_shared/emit-x9ax2eJn.mjs";import{emitApp as We}from"./packem_shared/emitApp-BHPpglXY.mjs";import{isD1GlobalTable as Ve,isHyperdriveGlobalTable as ze}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as we,emitOpenApi as Je,emitOpenApiModule as qe}from"./packem_shared/buildOpenApiDocument-DcK-kygT.mjs";import{OPENRPC_VERSION as Ye,buildOpenRpcDocument as Xe,emitOpenRpc as Ze,emitOpenRpcModule as $e}from"./packem_shared/OPENRPC_VERSION-DXgqfETq.mjs";import{DEFAULT_TARGET as rr,platformMatrixIds as or,readProjectTarget as tr,resolveCodegenTarget as sr}from"./packem_shared/DEFAULT_TARGET-Ek8LuFzn.mjs";import{PROJECT_CONFIG_FILENAMES as ir,findProjectConfigFile as mr,loadProjectConfig as dr,readProjectConfigLiterals as fr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-D29yBg5X.mjs";import{SCHEMA_SNAPSHOT_FILENAME as cr,createCodegenProject as nr,findTsconfig as lr,refreshCodegenProject as Sr,runCodegen as xr}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-DyF03au4.mjs";import{SchemaSnapshotParseError as Ar,buildSchemaSnapshot as ur,evaluateSchemaDrift as vr,parseSchemaSnapshot as Nr}from"./packem_shared/SchemaSnapshotParseError-yrVM8bTa.mjs";import{schemaFromIr as Cr}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as Rr,validatorIrToJsonSchema as Mr}from"./packem_shared/LUNORA_ERROR_CODES-CW7-uASH.mjs";import{SDK_LANGUAGES as _r,SDK_TARGETS as hr,generateSdk as Lr}from"./packem_shared/SDK_LANGUAGES-CFyux-74.mjs";import{redact as Ir,secretKindOf as Pr}from"./packem_shared/redact-Cy14LEnc.mjs";import{MESSAGE_SOLUTIONS as Gr,findSolutionByMessage as Ur}from"@lunora/errors";import{isTypedSchema as Hr}from"./packem_shared/isTypedSchema-B_qlBbE-.mjs";const e="0.0.0";export{u as AGENTS_FILENAME,M as CONTAINERS_FILENAME,x as CodegenDiagnosticError,rr as DEFAULT_TARGET,F as FLAGS_FILENAME,Me as GENERATED_HEADER,Rr as LUNORA_ERROR_CODES,Gr as LUNORA_SOLUTION_RULES,Q as MUTATORS_FILENAME,Y as NOTIFY_FILENAME,Ye as OPENRPC_VERSION,ir as PROJECT_CONFIG_FILENAMES,se as QUEUES_FILENAME,cr as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,_r as SDK_LANGUAGES,hr as SDK_TARGETS,Ae as SHAPES_FILENAME,Ar as SchemaSnapshotParseError,e as VERSION,Ce as WORKFLOWS_FILENAME,we as buildOpenApiDocument,Xe as buildOpenRpcDocument,ur as buildSchemaSnapshot,nr as createCodegenProject,c as describeErrorLevelFindings,E as diagnosticAt,s as diffSchemaSnapshots,v as discoverAgents,O as discoverAuthApiCalls,T as discoverContainers,h as discoverCrons,I as discoverFlags,D as discoverFunctions,U as discoverHttpRoutes,H as discoverHyperdriveCalls,y as discoverInserts,W as discoverMaskProcedures,V as discoverMigrations,w as discoverMutators,q as discoverNondeterministicCalls,X as discoverNotifyCalls,Z as discoverNotifyConfig,oe as discoverQueries,ae as discoverQueues,me as discoverR2sqlCalls,ce as discoverRlsMetadata,fe as discoverRlsProcedures,le as discoverSandboxUsage,xe as discoverSchema,ue as discoverShapes,Ne as discoverStorageRulesMetadata,Oe as discoverWorkflows,Te as emitAgents,_e as emitApi,We as emitApp,he as emitCollections,Le as emitContainers,Fe as emitCrons,Ie as emitDataModel,Pe as emitDrizzleSchema,De as emitFunctions,Je as emitOpenApi,qe as emitOpenApiModule,Ze as emitOpenRpc,$e as emitOpenRpcModule,Ge as emitScheduler,Ue as emitServer,be as emitShard,He as emitVectors,je as emitWorkflows,ye as emitWranglerCronTriggers,n as errorAdvisoryNames,l as errorPlatformDiagnosticNames,vr as evaluateSchemaDrift,Ur as findLunoraSolution,mr as findProjectConfigFile,lr as findTsconfig,m as formatAdvisories,Lr as generateSdk,Ve as isD1GlobalTable,ze as isHyperdriveGlobalTable,Hr as isTypedSchema,d as lintSchema,g as listLunoraSourceFiles,dr as loadProjectConfig,Nr as parseSchemaSnapshot,or as platformMatrixIds,ee as readPackageDependencies,fr as readProjectConfigLiterals,tr as readProjectTarget,Ir as redact,Sr as refreshCodegenProject,sr as resolveCodegenTarget,xr as runCodegen,Cr as schemaFromIr,Pr as secretKindOf,a as serializeSchemaSnapshot,f as toAdvisorContext,Mr as validatorIrToJsonSchema};
@@ -0,0 +1 @@
1
+ import{NODE_CAPABILITIES as f,CLOUDFLARE_CAPABILITIES as h}from"@lunora/platform";import{readProjectConfigLiterals as g}from"./PROJECT_CONFIG_FILENAMES-D29yBg5X.mjs";const c="cloudflare",v=t=>{const{target:e}=g(t);return e!==void 0&&e.length>0?e:void 0},x=(t,e)=>e??v(t)??c,L=(t,e)=>{if(e!==void 0)return[];const{target:a,unreadable:o}=g(t);return o!==!0||a!==void 0?[]:[{level:"warn",message:`lunora.config declares a \`target\` that codegen cannot read without evaluating it, so the "${c}" 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: "${c}" }\`), or pass \`--target\`.`,target:c}]},u={cloudflare:h,node:f},I=()=>Object.keys(u).toSorted((t,e)=>t.localeCompare(e)),b={access:null,ai:"ai",analytics:"analytics",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:null},y=["agents","commitOrderedTables","cronTriggers","crossShardFanout","durableStreams","globalTables","queues","secrets","vectorStore"],m={agents:"durable agents (`defineAgent`)",commitOrderedTables:"commit-ordered tables (`.commitOrdered()`)",cronTriggers:"declared cron triggers (`cronJobs()`)",crossShardFanout:"cross-shard fan-out queries (a `.shardBy(...)` schema)",durableStreams:"durable streams (`.stream(handler, { durable: true })`)",globalTables:"global tables (`.global()`)",queues:"queues (`defineQueue`)",secrets:"the secrets store (`ctx.secrets`)",vectorStore:"vector indexes (`.vectorize()`)"},S=(t,e,a)=>({level:"error",message:`${e.name} does not support ${m[t]}, which this app declares.`,name:"platform_unsupported_feature",remediation:`Remove the declaration, or deploy to a target whose capability matrix marks "${t}" as native or emulated.`,target:a}),T=(t,e,a)=>({level:"error",message:`${e.name}'s capability matrix does not declare a support level for ${m[t]}, which this app declares. Treated as unsupported.`,name:"platform_undeclared_feature",remediation:`Rate "${t}" in the ${e.name} capability matrix as "native", "emulated", or "unsupported" — an undeclared feature fails closed rather than letting the app deploy onto a primitive the host may not provide.`,target:a}),_=t=>{const{diagnostics:e,gatedSignals:a,matrix:o,reported:i,signals:d,target:n}=t;for(const s of y){if(d[s]!==!0)continue;const r=o.features[s]?.level;r!=="unsupported"&&r!==void 0||(a[s]=!1,!i.has(s)&&e.push(r==="unsupported"?S(s,o,n):T(s,o,n)))}},$=(t,e,a,o={})=>{const i={...t},d={...o},n=[],s=new Set;for(const[r,l]of Object.entries(b)){if(l===null||!t[r])continue;const p=e.features[l]?.level;p==="unsupported"?(i[r]=!1,s.add(l),n.push({feature:r,level:"error",message:`${e.name} does not support "${r}" (ctx.${r}).`,name:"platform_unsupported_feature",remediation:`Remove the ctx.${r} usage, or deploy to a target whose capability matrix marks "${l}" as native or emulated.`,target:a})):p===void 0&&(i[r]=!1,s.add(l),n.push({feature:r,level:"error",message:`${e.name}'s capability matrix does not declare a support level for "${r}" (ctx.${r}). Treated as unsupported.`,name:"platform_undeclared_feature",remediation:`Rate "${l}" in the ${e.name} capability matrix as "native", "emulated", or "unsupported" — an undeclared feature fails closed rather than shipping a surface the host may not provide.`,target:a}))}return _({diagnostics:n,gatedSignals:d,matrix:e,reported:s,signals:o,target:a}),{diagnostics:n,signals:d,usage:i}},O=(t,e,a={})=>{const o=u[e];return o===void 0?{diagnostics:[{level:"error",message:`Unknown deploy target "${e}" — no capability matrix is registered for it. Codegen emitted the full Cloudflare surface un-gated.`,name:"platform_unknown_target",remediation:`Use a registered target (${Object.keys(u).join(", ")}) or install the target's @lunora/platform-${e} package.`,target:e}],signals:{...a},usage:{...t}}:$(t,o,e,a)};export{b as CAPABILITY_TO_FEATURE,c as DEFAULT_TARGET,$ as gateAgainstMatrix,O as gatePlatformFeatures,I as platformMatrixIds,v as readProjectTarget,L as readTargetDiagnostics,x as resolveCodegenTarget};
@@ -0,0 +1 @@
1
+ import"./SCHEMA_SNAPSHOT_VERSION-CWESEYLi.mjs";import{G as m,U as r,o,e as n,a as l,b as A,c as E,d as S,f as c,g as d,h as g,p,i as u,q as C,j as h,k as D,l as f,m as G,n as R}from"./emit-x9ax2eJn.mjs";import"./isD1GlobalTable-udvHAAzD.mjs";import"./paths-C-9fwEgQ.mjs";export{m as GENERATED_HEADER,r as UMBRELLA_BASE_PACKAGES,o as buildStorageColumns,n as emitAgents,l as emitApi,A as emitCollections,E as emitContainers,S as emitCrons,c as emitDataModel,d as emitDrizzleSchema,g as emitFunctions,p as emitQueues,u as emitScheduler,C as emitSeed,h as emitServer,D as emitShard,f as emitVectors,G as emitWorkflows,R as emitWranglerCronTriggers};
@@ -1,3 +1,3 @@
1
- import{G as c}from"./emit-B2PLgxM0.mjs";import{s as u}from"./paths-C-9fwEgQ.mjs";import{validatorIrToJsonSchema as m,objectSchema as p,LUNORA_ERROR_CODES as i}from"./LUNORA_ERROR_CODES-CW7-uASH.mjs";const l="1.3.2",d={description:"Result is TS-inferred from the function's return type (no `.output()` declared); best-effort — any JSON."},R=e=>{const n=u(e.filePath),o=`${n}:${e.exportName}`;return{description:`Invoke the \`${e.kind}\` \`${o}\` over the Lunora RPC envelope (POST /_lunora/rpc, body \`{ "functionPath": "${o}", "args": { … } }\`).`,errors:i.map((r,s)=>({code:-32e3-s,data:{code:r},message:r})),name:o,params:[{description:"The function's argument object (the RPC envelope's `args`).",name:"args",required:Object.keys(e.args).length>0,schema:p(e.args)}],result:{name:"result",schema:e.output?m(e.output):d},summary:`${e.kind}: ${o}`,"x-lunora-function-kind":e.kind,"x-tags":[{name:n}]}},g=e=>{const n=e.version??"0.0.0",r=e.functions.filter(t=>t.visibility!=="internal"&&t.kind!=="stream").map(t=>R(t)).toSorted((t,a)=>t.name.localeCompare(a.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:l}},S=e=>`${JSON.stringify(g(e),void 0,2)}
1
+ import{G as c}from"./emit-x9ax2eJn.mjs";import{s as u}from"./paths-C-9fwEgQ.mjs";import{validatorIrToJsonSchema as m,objectSchema as p,LUNORA_ERROR_CODES as i}from"./LUNORA_ERROR_CODES-CW7-uASH.mjs";const l="1.3.2",d={description:"Result is TS-inferred from the function's return type (no `.output()` declared); best-effort — any JSON."},R=e=>{const n=u(e.filePath),o=`${n}:${e.exportName}`;return{description:`Invoke the \`${e.kind}\` \`${o}\` over the Lunora RPC envelope (POST /_lunora/rpc, body \`{ "functionPath": "${o}", "args": { … } }\`).`,errors:i.map((r,s)=>({code:-32e3-s,data:{code:r},message:r})),name:o,params:[{description:"The function's argument object (the RPC envelope's `args`).",name:"args",required:Object.keys(e.args).length>0,schema:p(e.args)}],result:{name:"result",schema:e.output?m(e.output):d},summary:`${e.kind}: ${o}`,"x-lunora-function-kind":e.kind,"x-tags":[{name:n}]}},g=e=>{const n=e.version??"0.0.0",r=e.functions.filter(t=>t.visibility!=="internal"&&t.kind!=="stream").map(t=>R(t)).toSorted((t,a)=>t.name.localeCompare(a.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:l}},S=e=>`${JSON.stringify(g(e),void 0,2)}
2
2
  `,v=e=>`${c}export const openRpcSpec: Record<string, unknown> = ${JSON.stringify(e,void 0,4)};
3
3
  `;export{l as OPENRPC_VERSION,g as buildOpenRpcDocument,S as emitOpenRpc,v as emitOpenRpcModule};
@@ -0,0 +1 @@
1
+ import{existsSync as g,statSync as f,readFileSync as d}from"node:fs";import{resolve as m,basename as p}from"node:path";import{createJiti as x}from"jiti";import{Project as E,Node as i}from"ts-morph";const b=["lunora.config.ts","lunora.config.mts","lunora.config.js","lunora.config.mjs"],u=r=>b.map(t=>m(r,t)).find(t=>g(t)),l=new Map,F=async r=>{const t=u(r);if(t===void 0)return{};let e;try{const s=f(t);e=`${String(s.mtimeMs)}:${String(s.size)}`}catch{return{}}const n=l.get(t);if(n?.key===e)return n.value;const o=(async()=>{try{const a=(await x(t,{interopDefault:!1,moduleCache:!1}).import(t))?.default;return{config:a!==null&&typeof a=="object"?a:void 0}}catch(s){return{error:s instanceof Error?s.message:String(s)}}})();return l.set(t,{key:e,value:o}),o},v=r=>{let e=r.getExportAssignments().find(n=>!n.isExportEquals())?.getExpression();for(;e!==void 0&&(i.isSatisfiesExpression(e)||i.isAsExpression(e)||i.isParenthesizedExpression(e));)e=e.getExpression();if(e!==void 0&&i.isIdentifier(e))for(e=r.getVariableDeclaration(e.getText())?.getInitializer();e!==void 0&&(i.isSatisfiesExpression(e)||i.isAsExpression(e));)e=e.getExpression();return e!==void 0&&i.isObjectLiteralExpression(e)?e:void 0},y=r=>{const t=r.getNameNode();return i.isStringLiteral(t)?t.getLiteralValue():t.getText()},S=(r,t)=>i.isPropertyAssignment(r)?r.getInitializer():t.getVariableDeclaration(r.getName())?.getInitializer(),h=(r,t)=>{if(i.isGetAccessorDeclaration(r)||i.isMethodDeclaration(r)){const o=r.getName();return o==="target"||o==="remote"?{unreadable:!0}:{}}if(!i.isPropertyAssignment(r)&&!i.isShorthandPropertyAssignment(r))return{};const e=y(r);if(e!=="target"&&e!=="remote")return{};const n=S(r,t);return n===void 0?{unreadable:!0}:e==="target"?i.isStringLiteral(n)?{target:n.getLiteralValue()}:{unreadable:!0}:i.isTrueLiteral(n)||i.isFalseLiteral(n)?{remote:n.getLiteralValue()}:i.isObjectLiteralExpression(n)?{remote:!0}:{unreadable:!0}},N=r=>{const t=u(r);if(t===void 0)return{};let e;try{e=d(t,"utf8")}catch{return{unreadable:!0}}const o=new E({compilerOptions:{allowJs:!0},skipFileDependencyResolution:!0,skipLoadingLibFiles:!0,useInMemoryFileSystem:!0}).createSourceFile(p(t),e,{overwrite:!0}),s=v(o);if(s===void 0)return{unreadable:!0};if(s.getProperties().some(c=>i.isSpreadAssignment(c)))return{unreadable:!0};let a={};for(const c of s.getProperties())a={...a,...h(c,o)};return a};export{b as PROJECT_CONFIG_FILENAMES,u as findProjectConfigFile,F as loadProjectConfig,N as readProjectConfigLiterals};