@lunora/codegen 1.0.0-alpha.143 → 1.0.0-alpha.144

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
@@ -905,15 +905,18 @@ interface NondeterministicCallIR {
905
905
  line: number;
906
906
  }
907
907
  /**
908
- * One `ctx.r2sql` access lexically inside a `query`/`mutation` handler — the
909
- * `r2sql_outside_action` advisor lint input. Structurally identical to the
910
- * advisor's `AdvisorR2sqlCall` (same field set) so values pass straight through
911
- * `lintSchema` without conversion, exactly as `NondeterministicCallIR` does.
912
- * Only `query`/`mutation` handlers are recorded; `action(...)` is the intended
913
- * home for `ctx.r2sql` and is skipped.
914
- */
915
- interface R2sqlCallIR {
916
- /** The accessed `ctx.r2sql` surface, e.g. `ctx.r2sql.query` / `ctx.r2sql.from`. */
908
+ * One `ctx.<property>` access lexically inside a `query`/`mutation` handler —
909
+ * the feeder shape behind every "action-only surface used outside an action"
910
+ * advisor lint (`hyperdrive_outside_action` for `ctx.sql`,
911
+ * `r2sql_outside_action` for `ctx.r2sql`). Structurally identical to the
912
+ * advisor's `AdvisorHyperdriveCall` / `AdvisorR2sqlCall` (same field set) so
913
+ * values pass straight through `lintSchema` without conversion, exactly as
914
+ * {@link NondeterministicCallIR} does. Only `query`/`mutation` handlers are
915
+ * recorded; `action(...)` is the only context where these surfaces are even
916
+ * typed, so it is the intended home and is skipped.
917
+ */
918
+ interface ContextPropertyCallIR {
919
+ /** The accessed surface, e.g. `ctx.sql.query` / `ctx.r2sql.from` — the property, suffixed with the method when one is called on it. */
917
920
  callee: string;
918
921
  /** Export binding name of the function performing the access. */
919
922
  exportName: string;
@@ -921,7 +924,7 @@ interface R2sqlCallIR {
921
924
  file: string;
922
925
  /** Which procedure kind the access lives in — only `query`/`mutation` handlers are recorded. */
923
926
  kind: "mutation" | "query";
924
- /** 1-based line of the access, or `0` when unknown. */
927
+ /** 1-based line of the access. */
925
928
  line: number;
926
929
  }
927
930
  /**
@@ -1773,9 +1776,9 @@ interface FlagSecurityDefaultIR {
1773
1776
  * `__cdc_log`, so a subscribed query is never re-run when a flag flips and keeps
1774
1777
  * serving the branch it last picked; `useFlag` is the reactive path. Structurally
1775
1778
  * identical to the advisor's `AdvisorFlagRead` (same field set) so values pass
1776
- * straight through `lintSchema` without conversion, exactly as `R2sqlCallIR` does.
1779
+ * straight through `lintSchema` without conversion, exactly as `ContextPropertyCallIR` does.
1777
1780
  *
1778
- * Only `query` handlers are recorded — unlike `R2sqlCallIR` / `NondeterministicCallIR`
1781
+ * Only `query` handlers are recorded — unlike `ContextPropertyCallIR` / `NondeterministicCallIR`
1779
1782
  * there is no `kind` field, because `mutation`/`action` handlers run once and have
1780
1783
  * no subscription staleness to warn about, so the feeder drops them rather than
1781
1784
  * handing the lint rows it would discard.
@@ -2026,6 +2029,7 @@ interface LintSchemaOptions {
2026
2029
  geoIndexUsages?: ReadonlyArray<AdvisorGeoIndexUsage>;
2027
2030
  httpActionGuards?: ReadonlyArray<HttpActionGuardIR>;
2028
2031
  httpHeaderWrites?: ReadonlyArray<HttpHeaderWriteIR>;
2032
+ hyperdriveCalls?: ReadonlyArray<ContextPropertyCallIR>;
2029
2033
  identityClaimReads?: ReadonlyArray<IdentityClaimReadIR>;
2030
2034
  imageDeliveryUrlAccesses?: ReadonlyArray<ImageDeliveryUrlAccessIR>;
2031
2035
  inserts?: ReadonlyArray<InsertWriteIR>;
@@ -2044,7 +2048,7 @@ interface LintSchemaOptions {
2044
2048
  procedureProtections?: ReadonlyArray<ProcedureMiddlewareIR>;
2045
2049
  queries?: ReadonlyArray<QueryReadIR>;
2046
2050
  queues?: ReadonlyArray<QueueIR>;
2047
- r2sqlCalls?: ReadonlyArray<R2sqlCallIR>;
2051
+ r2sqlCalls?: ReadonlyArray<ContextPropertyCallIR>;
2048
2052
  ratelimitKeySelectors?: ReadonlyArray<RatelimitKeySelectorIR>;
2049
2053
  rawRowReturns?: ReadonlyArray<RawRowReturnIR>;
2050
2054
  relationLoads?: ReadonlyArray<RelationLoadIR>;
@@ -2306,12 +2310,13 @@ declare const resolveCodegenTarget: (projectRoot: string, explicit?: string) =>
2306
2310
  * `@lunora/config`'s driver registry (`deployTargetIds`) used to assert
2307
2311
  * equality against this — "two id spaces for one concept" — on the theory that
2308
2312
  * a target with a matrix but no driver "gates a surface nothing can deploy."
2309
- * Plan 234 found that reasoning incomplete by registering `node` here: a
2310
- * codegen-gateable target and a deployable target are genuinely different
2311
- * questions, and a spike/dev-only host answers the first "yes" and the second
2312
- * "not yet" without that being a bug in either registry. See
2313
- * `plans/234-node-host-findings.md` for the finding and `@lunora/config`'s
2314
- * `project-config.test.ts` for where the now-relaxed invariant lives.
2313
+ * Both registries list `cloudflare` and `node` today, so they happen to agree;
2314
+ * the assertion stays relaxed because agreement is a coincidence of timing, not
2315
+ * an invariant. "Codegen can gate capabilities for this target" and "the CLI can
2316
+ * deploy to it" are different questions, and a new host answers the first the
2317
+ * moment its capability matrix lands — before its deploy driver exists. See
2318
+ * `@lunora/config`'s `project-config.test.ts` for where that relaxed invariant
2319
+ * lives.
2315
2320
  * @returns the registered matrix ids, sorted.
2316
2321
  */
2317
2322
  declare const platformMatrixIds: () => ReadonlyArray<string>;
@@ -2681,6 +2686,17 @@ declare const discoverFunctions: (project: Project, lunoraDirectory: string) =>
2681
2686
  * These are the headline OpenAPI target: each becomes a real `paths` entry.
2682
2687
  */
2683
2688
  declare const discoverHttpRoutes: (project: Project, lunoraDirectory: string) => HttpRouteIR[];
2689
+ /**
2690
+ * Discover Hyperdrive `ctx.sql` accesses inside exported `query(...)` /
2691
+ * `mutation(...)` handlers — the `hyperdrive_outside_action` lint input.
2692
+ *
2693
+ * The lint shipped with no feeder at all: it returns `[]` unless
2694
+ * `context.hyperdriveCalls` is set, and nothing set it, so the one guardrail
2695
+ * against non-deterministic external SQL in a reactive handler never fired.
2696
+ * `ctx.sql` is typed on `ActionCtx` only, so `action(...)` bodies are skipped by
2697
+ * the shared walker — an access there is correct usage, not a finding.
2698
+ */
2699
+ declare const discoverHyperdriveCalls: (project: Project, lunoraDirectory: string) => ContextPropertyCallIR[];
2684
2700
  /**
2685
2701
  * Discover `ctx.db.insert("table", …)` writes under the lunora source directory
2686
2702
  * and attribute each to the exported function (and file) performing it. Calls
@@ -2786,18 +2802,11 @@ declare const QUEUES_FILENAME = "queues.ts";
2786
2802
  */
2787
2803
  declare const discoverQueues: (project: Project, lunoraDirectory: string) => QueueIR[];
2788
2804
  /**
2789
- * Discover `ctx.r2sql` accesses lexically inside the handler body of every
2790
- * exported `query(...)` / `mutation(...)` registration under the lunora source
2791
- * directory — the `r2sql_outside_action` lint input. `action(...)` (and
2792
- * `stream(...)`) registrations are intentionally skipped: R2 SQL is the
2793
- * external, non-reactive surface that belongs in actions.
2794
- *
2795
- * Traversal is scoped to the handler node (not the whole declaration), mirroring
2796
- * `discoverNondeterministicCalls` — so a `ctx.r2sql` touch in a sibling helper
2797
- * outside the handler is not attributed to the query/mutation. One
2798
- * {@link R2sqlCallIR} is produced per access site.
2805
+ * Discover `ctx.r2sql` accesses inside exported `query(...)` / `mutation(...)`
2806
+ * handlers — the `r2sql_outside_action` lint input. `action(...)` is the
2807
+ * intended home for R2 SQL and is skipped by the shared walker.
2799
2808
  */
2800
- declare const discoverR2sqlCalls: (project: Project, lunoraDirectory: string) => R2sqlCallIR[];
2809
+ declare const discoverR2sqlCalls: (project: Project, lunoraDirectory: string) => ContextPropertyCallIR[];
2801
2810
  declare const discoverRlsProcedures: (project: Project, lunoraDirectory: string) => RlsProcedureIR[];
2802
2811
  /**
2803
2812
  * Aggregate the schema-wide RLS metadata the studio's read-only inspector reads:
@@ -3160,8 +3169,19 @@ interface EmitAppOptions {
3160
3169
  hasHyperdriveGlobal: boolean;
3161
3170
  /** App uses `@lunora/bindings/images` / `ctx.images` → emit `.images()`. */
3162
3171
  hasImages: boolean;
3163
- /** App uses `@lunora/bindings/kv` / `ctx.kv` → emit `.kv()`. */
3172
+ /** App uses `@lunora/bindings/kv` / `ctx.kv` → emit `.kv()`. Usage-only, because the method's parameter type reads `ShardConfig["kv"]`, and that config field is emitted on the same usage signal. */
3164
3173
  hasKv: boolean;
3174
+ /**
3175
+ * Wire the studio's zero-config KV introspector. Gated on `studioFeatures.kv`
3176
+ * (usage OR a declared `@lunora/bindings` dependency), NOT on {@link EmitAppOptions.hasKv},
3177
+ * so a visible KV tab always has a working backend — never the reverse.
3178
+ *
3179
+ * Kept separate from `hasKv` deliberately: the two were accidentally equal
3180
+ * while the dependency arm in `discover/studio-features.ts` matched a subpath
3181
+ * and could never fire. Fixing that arm made them diverge, and the shared flag
3182
+ * emitted a `.kv()` builder whose `ShardConfig["kv"]` type did not exist.
3183
+ */
3184
+ hasKvIntrospector: boolean;
3165
3185
  /** App declares `lunora/notify.ts` (`@lunora/notify`) → wire `options.notifySubscriptionStore` so the studio Notifications page can read registered devices. */
3166
3186
  hasNotify: boolean;
3167
3187
  /** App uses `@lunora/payment` / `ctx.payments` → emit `.payment()`. */
@@ -3687,4 +3707,4 @@ declare const secretKindOf: (value: string) => string | undefined;
3687
3707
  /** A redacted preview of a secret value — first 4 chars plus its length, never the full value. */
3688
3708
  declare const redact: (value: string) => string;
3689
3709
  declare const VERSION = "0.0.0";
3690
- export { AGENTS_FILENAME, type AgentIR, type AuthApiCallIR, CONTAINERS_FILENAME, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type CronJobIR, DEFAULT_TARGET, type DriftChange, 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 R2sqlCallIR, 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, 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, isTypedSchema, lintSchema, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectTarget, redact, refreshCodegenProject, resolveCodegenTarget, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, toAdvisorContext, validatorIrToJsonSchema };
3710
+ 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 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, isTypedSchema, lintSchema, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectTarget, redact, refreshCodegenProject, resolveCodegenTarget, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, toAdvisorContext, validatorIrToJsonSchema };
package/dist/index.d.ts CHANGED
@@ -905,15 +905,18 @@ interface NondeterministicCallIR {
905
905
  line: number;
906
906
  }
907
907
  /**
908
- * One `ctx.r2sql` access lexically inside a `query`/`mutation` handler — the
909
- * `r2sql_outside_action` advisor lint input. Structurally identical to the
910
- * advisor's `AdvisorR2sqlCall` (same field set) so values pass straight through
911
- * `lintSchema` without conversion, exactly as `NondeterministicCallIR` does.
912
- * Only `query`/`mutation` handlers are recorded; `action(...)` is the intended
913
- * home for `ctx.r2sql` and is skipped.
914
- */
915
- interface R2sqlCallIR {
916
- /** The accessed `ctx.r2sql` surface, e.g. `ctx.r2sql.query` / `ctx.r2sql.from`. */
908
+ * One `ctx.<property>` access lexically inside a `query`/`mutation` handler —
909
+ * the feeder shape behind every "action-only surface used outside an action"
910
+ * advisor lint (`hyperdrive_outside_action` for `ctx.sql`,
911
+ * `r2sql_outside_action` for `ctx.r2sql`). Structurally identical to the
912
+ * advisor's `AdvisorHyperdriveCall` / `AdvisorR2sqlCall` (same field set) so
913
+ * values pass straight through `lintSchema` without conversion, exactly as
914
+ * {@link NondeterministicCallIR} does. Only `query`/`mutation` handlers are
915
+ * recorded; `action(...)` is the only context where these surfaces are even
916
+ * typed, so it is the intended home and is skipped.
917
+ */
918
+ interface ContextPropertyCallIR {
919
+ /** The accessed surface, e.g. `ctx.sql.query` / `ctx.r2sql.from` — the property, suffixed with the method when one is called on it. */
917
920
  callee: string;
918
921
  /** Export binding name of the function performing the access. */
919
922
  exportName: string;
@@ -921,7 +924,7 @@ interface R2sqlCallIR {
921
924
  file: string;
922
925
  /** Which procedure kind the access lives in — only `query`/`mutation` handlers are recorded. */
923
926
  kind: "mutation" | "query";
924
- /** 1-based line of the access, or `0` when unknown. */
927
+ /** 1-based line of the access. */
925
928
  line: number;
926
929
  }
927
930
  /**
@@ -1773,9 +1776,9 @@ interface FlagSecurityDefaultIR {
1773
1776
  * `__cdc_log`, so a subscribed query is never re-run when a flag flips and keeps
1774
1777
  * serving the branch it last picked; `useFlag` is the reactive path. Structurally
1775
1778
  * identical to the advisor's `AdvisorFlagRead` (same field set) so values pass
1776
- * straight through `lintSchema` without conversion, exactly as `R2sqlCallIR` does.
1779
+ * straight through `lintSchema` without conversion, exactly as `ContextPropertyCallIR` does.
1777
1780
  *
1778
- * Only `query` handlers are recorded — unlike `R2sqlCallIR` / `NondeterministicCallIR`
1781
+ * Only `query` handlers are recorded — unlike `ContextPropertyCallIR` / `NondeterministicCallIR`
1779
1782
  * there is no `kind` field, because `mutation`/`action` handlers run once and have
1780
1783
  * no subscription staleness to warn about, so the feeder drops them rather than
1781
1784
  * handing the lint rows it would discard.
@@ -2026,6 +2029,7 @@ interface LintSchemaOptions {
2026
2029
  geoIndexUsages?: ReadonlyArray<AdvisorGeoIndexUsage>;
2027
2030
  httpActionGuards?: ReadonlyArray<HttpActionGuardIR>;
2028
2031
  httpHeaderWrites?: ReadonlyArray<HttpHeaderWriteIR>;
2032
+ hyperdriveCalls?: ReadonlyArray<ContextPropertyCallIR>;
2029
2033
  identityClaimReads?: ReadonlyArray<IdentityClaimReadIR>;
2030
2034
  imageDeliveryUrlAccesses?: ReadonlyArray<ImageDeliveryUrlAccessIR>;
2031
2035
  inserts?: ReadonlyArray<InsertWriteIR>;
@@ -2044,7 +2048,7 @@ interface LintSchemaOptions {
2044
2048
  procedureProtections?: ReadonlyArray<ProcedureMiddlewareIR>;
2045
2049
  queries?: ReadonlyArray<QueryReadIR>;
2046
2050
  queues?: ReadonlyArray<QueueIR>;
2047
- r2sqlCalls?: ReadonlyArray<R2sqlCallIR>;
2051
+ r2sqlCalls?: ReadonlyArray<ContextPropertyCallIR>;
2048
2052
  ratelimitKeySelectors?: ReadonlyArray<RatelimitKeySelectorIR>;
2049
2053
  rawRowReturns?: ReadonlyArray<RawRowReturnIR>;
2050
2054
  relationLoads?: ReadonlyArray<RelationLoadIR>;
@@ -2306,12 +2310,13 @@ declare const resolveCodegenTarget: (projectRoot: string, explicit?: string) =>
2306
2310
  * `@lunora/config`'s driver registry (`deployTargetIds`) used to assert
2307
2311
  * equality against this — "two id spaces for one concept" — on the theory that
2308
2312
  * a target with a matrix but no driver "gates a surface nothing can deploy."
2309
- * Plan 234 found that reasoning incomplete by registering `node` here: a
2310
- * codegen-gateable target and a deployable target are genuinely different
2311
- * questions, and a spike/dev-only host answers the first "yes" and the second
2312
- * "not yet" without that being a bug in either registry. See
2313
- * `plans/234-node-host-findings.md` for the finding and `@lunora/config`'s
2314
- * `project-config.test.ts` for where the now-relaxed invariant lives.
2313
+ * Both registries list `cloudflare` and `node` today, so they happen to agree;
2314
+ * the assertion stays relaxed because agreement is a coincidence of timing, not
2315
+ * an invariant. "Codegen can gate capabilities for this target" and "the CLI can
2316
+ * deploy to it" are different questions, and a new host answers the first the
2317
+ * moment its capability matrix lands — before its deploy driver exists. See
2318
+ * `@lunora/config`'s `project-config.test.ts` for where that relaxed invariant
2319
+ * lives.
2315
2320
  * @returns the registered matrix ids, sorted.
2316
2321
  */
2317
2322
  declare const platformMatrixIds: () => ReadonlyArray<string>;
@@ -2681,6 +2686,17 @@ declare const discoverFunctions: (project: Project, lunoraDirectory: string) =>
2681
2686
  * These are the headline OpenAPI target: each becomes a real `paths` entry.
2682
2687
  */
2683
2688
  declare const discoverHttpRoutes: (project: Project, lunoraDirectory: string) => HttpRouteIR[];
2689
+ /**
2690
+ * Discover Hyperdrive `ctx.sql` accesses inside exported `query(...)` /
2691
+ * `mutation(...)` handlers — the `hyperdrive_outside_action` lint input.
2692
+ *
2693
+ * The lint shipped with no feeder at all: it returns `[]` unless
2694
+ * `context.hyperdriveCalls` is set, and nothing set it, so the one guardrail
2695
+ * against non-deterministic external SQL in a reactive handler never fired.
2696
+ * `ctx.sql` is typed on `ActionCtx` only, so `action(...)` bodies are skipped by
2697
+ * the shared walker — an access there is correct usage, not a finding.
2698
+ */
2699
+ declare const discoverHyperdriveCalls: (project: Project, lunoraDirectory: string) => ContextPropertyCallIR[];
2684
2700
  /**
2685
2701
  * Discover `ctx.db.insert("table", …)` writes under the lunora source directory
2686
2702
  * and attribute each to the exported function (and file) performing it. Calls
@@ -2786,18 +2802,11 @@ declare const QUEUES_FILENAME = "queues.ts";
2786
2802
  */
2787
2803
  declare const discoverQueues: (project: Project, lunoraDirectory: string) => QueueIR[];
2788
2804
  /**
2789
- * Discover `ctx.r2sql` accesses lexically inside the handler body of every
2790
- * exported `query(...)` / `mutation(...)` registration under the lunora source
2791
- * directory — the `r2sql_outside_action` lint input. `action(...)` (and
2792
- * `stream(...)`) registrations are intentionally skipped: R2 SQL is the
2793
- * external, non-reactive surface that belongs in actions.
2794
- *
2795
- * Traversal is scoped to the handler node (not the whole declaration), mirroring
2796
- * `discoverNondeterministicCalls` — so a `ctx.r2sql` touch in a sibling helper
2797
- * outside the handler is not attributed to the query/mutation. One
2798
- * {@link R2sqlCallIR} is produced per access site.
2805
+ * Discover `ctx.r2sql` accesses inside exported `query(...)` / `mutation(...)`
2806
+ * handlers — the `r2sql_outside_action` lint input. `action(...)` is the
2807
+ * intended home for R2 SQL and is skipped by the shared walker.
2799
2808
  */
2800
- declare const discoverR2sqlCalls: (project: Project, lunoraDirectory: string) => R2sqlCallIR[];
2809
+ declare const discoverR2sqlCalls: (project: Project, lunoraDirectory: string) => ContextPropertyCallIR[];
2801
2810
  declare const discoverRlsProcedures: (project: Project, lunoraDirectory: string) => RlsProcedureIR[];
2802
2811
  /**
2803
2812
  * Aggregate the schema-wide RLS metadata the studio's read-only inspector reads:
@@ -3160,8 +3169,19 @@ interface EmitAppOptions {
3160
3169
  hasHyperdriveGlobal: boolean;
3161
3170
  /** App uses `@lunora/bindings/images` / `ctx.images` → emit `.images()`. */
3162
3171
  hasImages: boolean;
3163
- /** App uses `@lunora/bindings/kv` / `ctx.kv` → emit `.kv()`. */
3172
+ /** App uses `@lunora/bindings/kv` / `ctx.kv` → emit `.kv()`. Usage-only, because the method's parameter type reads `ShardConfig["kv"]`, and that config field is emitted on the same usage signal. */
3164
3173
  hasKv: boolean;
3174
+ /**
3175
+ * Wire the studio's zero-config KV introspector. Gated on `studioFeatures.kv`
3176
+ * (usage OR a declared `@lunora/bindings` dependency), NOT on {@link EmitAppOptions.hasKv},
3177
+ * so a visible KV tab always has a working backend — never the reverse.
3178
+ *
3179
+ * Kept separate from `hasKv` deliberately: the two were accidentally equal
3180
+ * while the dependency arm in `discover/studio-features.ts` matched a subpath
3181
+ * and could never fire. Fixing that arm made them diverge, and the shared flag
3182
+ * emitted a `.kv()` builder whose `ShardConfig["kv"]` type did not exist.
3183
+ */
3184
+ hasKvIntrospector: boolean;
3165
3185
  /** App declares `lunora/notify.ts` (`@lunora/notify`) → wire `options.notifySubscriptionStore` so the studio Notifications page can read registered devices. */
3166
3186
  hasNotify: boolean;
3167
3187
  /** App uses `@lunora/payment` / `ctx.payments` → emit `.payment()`. */
@@ -3687,4 +3707,4 @@ declare const secretKindOf: (value: string) => string | undefined;
3687
3707
  /** A redacted preview of a secret value — first 4 chars plus its length, never the full value. */
3688
3708
  declare const redact: (value: string) => string;
3689
3709
  declare const VERSION = "0.0.0";
3690
- export { AGENTS_FILENAME, type AgentIR, type AuthApiCallIR, CONTAINERS_FILENAME, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type CronJobIR, DEFAULT_TARGET, type DriftChange, 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 R2sqlCallIR, 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, 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, isTypedSchema, lintSchema, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectTarget, redact, refreshCodegenProject, resolveCodegenTarget, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, toAdvisorContext, validatorIrToJsonSchema };
3710
+ 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 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, isTypedSchema, lintSchema, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, 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-DLXXalg2.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 S}from"./packem_shared/describeErrorLevelFindings-D23VSkFP.mjs";import{CodegenDiagnosticError as E,diagnosticAt as x}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as u,discoverAgents as v}from"./packem_shared/AGENTS_FILENAME-D1qA0h5m.mjs";import{default as g}from"./packem_shared/discoverAuthApiCalls-C35kkayg.mjs";import{CONTAINERS_FILENAME as R,discoverContainers as M}from"./packem_shared/CONTAINERS_FILENAME-oKaARMoA.mjs";import{default as C}from"./packem_shared/discoverCrons-wXBfQcfn.mjs";import{FLAGS_FILENAME as T,discoverFlags as I}from"./packem_shared/FLAGS_FILENAME-BasxlnVS.mjs";import{default as F}from"./packem_shared/discoverFunctions-DglkHRlt.mjs";import{default as P}from"./packem_shared/discoverHttpRoutes-B60GWv_I.mjs";import{default as G}from"./packem_shared/discoverInserts-C5l2INmE.mjs";import{d as b}from"./packem_shared/index-CCDlo9L7.mjs";import{default as y}from"./packem_shared/discoverMigrations-CWH7T6qz.mjs";import{MUTATORS_FILENAME as j,discoverMutators as K}from"./packem_shared/MUTATORS_FILENAME-BKSzaCkq.mjs";import{default as z}from"./packem_shared/discoverNondeterministicCalls-JsO91i57.mjs";import{NOTIFY_FILENAME as w,discoverNotifyCalls as q,discoverNotifyConfig as B}from"./packem_shared/NOTIFY_FILENAME-B-eIjru_.mjs";import{default as Y}from"./packem_shared/readPackageDependencies-C6h6FZuP.mjs";import{d as Z}from"./packem_shared/queries-B_xEHIeL.mjs";import{QUEUES_FILENAME as ee,discoverQueues as re}from"./packem_shared/QUEUES_FILENAME-D229WtRm.mjs";import{default as te}from"./packem_shared/discoverR2sqlCalls-BbfOpwE4.mjs";import{default as ae}from"./packem_shared/discoverRlsProcedures-CRshfYZE.mjs";import{default as me}from"./packem_shared/discoverRlsMetadata-DGUGYgWs.mjs";import{discoverSandboxUsage as fe}from"./packem_shared/discoverSandboxUsage-DdewAOuj.mjs";import{default as ce}from"./packem_shared/discoverSchema-CubSTjtY.mjs";import{SHAPES_FILENAME as Se,discoverShapes as le}from"./packem_shared/SHAPES_FILENAME-D3N7xcEk.mjs";import{default as xe}from"./packem_shared/discoverStorageRulesMetadata-gyO60A5S.mjs";import{WORKFLOWS_FILENAME as ue,discoverWorkflows as ve}from"./packem_shared/WORKFLOWS_FILENAME-DRaiCNa6.mjs";import{G as ge,e as Oe,a as Re,b as Me,c as he,d as Ce,f as _e,g as Te,h as Ie,i as Le,j as Fe,k as De,l as Pe,m as Ue}from"./packem_shared/emit-s6mHBmXu.mjs";import{emitApp as He}from"./packem_shared/emitApp-D1qxNeh1.mjs";import{buildOpenApiDocument as ke,emitOpenApi as ye,emitOpenApiModule as We}from"./packem_shared/buildOpenApiDocument-DLEWgA5Y.mjs";import{OPENRPC_VERSION as Ke,buildOpenRpcDocument as Ve,emitOpenRpc as ze,emitOpenRpcModule as Qe}from"./packem_shared/OPENRPC_VERSION-B9ZC0SrC.mjs";import{DEFAULT_TARGET as qe,platformMatrixIds as Be,readProjectTarget as Je,resolveCodegenTarget as Ye}from"./packem_shared/DEFAULT_TARGET-CrhWLUK7.mjs";import{SCHEMA_SNAPSHOT_FILENAME as Ze,createCodegenProject as $e,findTsconfig as er,refreshCodegenProject as rr,runCodegen as or}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-lbo63hy2.mjs";import{SchemaSnapshotParseError as sr,buildSchemaSnapshot as ar,evaluateSchemaDrift as ir,parseSchemaSnapshot as mr}from"./packem_shared/SchemaSnapshotParseError-CvPTjDrT.mjs";import{schemaFromIr as fr}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as cr,validatorIrToJsonSchema as nr}from"./packem_shared/LUNORA_ERROR_CODES-BYg8Lpgb.mjs";import{SDK_LANGUAGES as lr,SDK_TARGETS as Er,generateSdk as xr}from"./packem_shared/SDK_LANGUAGES-CFyux-74.mjs";import{redact as ur,secretKindOf as vr}from"./packem_shared/redact-Cy14LEnc.mjs";import{MESSAGE_SOLUTIONS as gr,findSolutionByMessage as Or}from"@lunora/errors";import{isTypedSchema as Mr}from"./packem_shared/isTypedSchema-B_qlBbE-.mjs";const e="0.0.0";export{u as AGENTS_FILENAME,R as CONTAINERS_FILENAME,E as CodegenDiagnosticError,qe as DEFAULT_TARGET,T as FLAGS_FILENAME,ge as GENERATED_HEADER,cr as LUNORA_ERROR_CODES,gr as LUNORA_SOLUTION_RULES,j as MUTATORS_FILENAME,w as NOTIFY_FILENAME,Ke as OPENRPC_VERSION,ee as QUEUES_FILENAME,Ze as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,lr as SDK_LANGUAGES,Er as SDK_TARGETS,Se as SHAPES_FILENAME,sr as SchemaSnapshotParseError,e as VERSION,ue as WORKFLOWS_FILENAME,ke as buildOpenApiDocument,Ve as buildOpenRpcDocument,ar as buildSchemaSnapshot,$e as createCodegenProject,c as describeErrorLevelFindings,x as diagnosticAt,s as diffSchemaSnapshots,v as discoverAgents,g as discoverAuthApiCalls,M as discoverContainers,C as discoverCrons,I as discoverFlags,F as discoverFunctions,P as discoverHttpRoutes,G as discoverInserts,b as discoverMaskProcedures,y as discoverMigrations,K as discoverMutators,z as discoverNondeterministicCalls,q as discoverNotifyCalls,B as discoverNotifyConfig,Z as discoverQueries,re as discoverQueues,te as discoverR2sqlCalls,me as discoverRlsMetadata,ae as discoverRlsProcedures,fe as discoverSandboxUsage,ce as discoverSchema,le as discoverShapes,xe as discoverStorageRulesMetadata,ve as discoverWorkflows,Oe as emitAgents,Re as emitApi,He as emitApp,Me as emitCollections,he as emitContainers,Ce as emitCrons,_e as emitDataModel,Te as emitDrizzleSchema,Ie as emitFunctions,ye as emitOpenApi,We as emitOpenApiModule,ze as emitOpenRpc,Qe as emitOpenRpcModule,Le as emitServer,Fe as emitShard,De as emitVectors,Pe as emitWorkflows,Ue as emitWranglerCronTriggers,n as errorAdvisoryNames,S as errorPlatformDiagnosticNames,ir as evaluateSchemaDrift,Or as findLunoraSolution,er as findTsconfig,m as formatAdvisories,xr as generateSdk,Mr as isTypedSchema,d as lintSchema,mr as parseSchemaSnapshot,Be as platformMatrixIds,Y as readPackageDependencies,Je as readProjectTarget,ur as redact,rr as refreshCodegenProject,Ye as resolveCodegenTarget,or as runCodegen,fr as schemaFromIr,vr as secretKindOf,a as serializeSchemaSnapshot,f as toAdvisorContext,nr as validatorIrToJsonSchema};
1
+ import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as s,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-DLXXalg2.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-D1qA0h5m.mjs";import{default as g}from"./packem_shared/discoverAuthApiCalls-C35kkayg.mjs";import{CONTAINERS_FILENAME as R,discoverContainers as C}from"./packem_shared/CONTAINERS_FILENAME-oKaARMoA.mjs";import{default as h}from"./packem_shared/discoverCrons-wXBfQcfn.mjs";import{FLAGS_FILENAME as T,discoverFlags as I}from"./packem_shared/FLAGS_FILENAME-BasxlnVS.mjs";import{default as F}from"./packem_shared/discoverFunctions-DglkHRlt.mjs";import{default as P}from"./packem_shared/discoverHttpRoutes-B60GWv_I.mjs";import{default as G}from"./packem_shared/discoverHyperdriveCalls-De_QiFIl.mjs";import{default as b}from"./packem_shared/discoverInserts-C5l2INmE.mjs";import{d as y}from"./packem_shared/index-CCDlo9L7.mjs";import{default as j}from"./packem_shared/discoverMigrations-CWH7T6qz.mjs";import{MUTATORS_FILENAME as V,discoverMutators as z}from"./packem_shared/MUTATORS_FILENAME-BKSzaCkq.mjs";import{default as w}from"./packem_shared/discoverNondeterministicCalls-JsO91i57.mjs";import{NOTIFY_FILENAME as B,discoverNotifyCalls as J,discoverNotifyConfig as Y}from"./packem_shared/NOTIFY_FILENAME-B-eIjru_.mjs";import{default as Z}from"./packem_shared/readPackageDependencies-C6h6FZuP.mjs";import{d as ee}from"./packem_shared/queries-B_xEHIeL.mjs";import{QUEUES_FILENAME as oe,discoverQueues as te}from"./packem_shared/QUEUES_FILENAME-D229WtRm.mjs";import{default as ae}from"./packem_shared/discoverR2sqlCalls-BdkZw-D2.mjs";import{default as me}from"./packem_shared/discoverRlsProcedures-CRshfYZE.mjs";import{default as fe}from"./packem_shared/discoverRlsMetadata-DGUGYgWs.mjs";import{discoverSandboxUsage as ce}from"./packem_shared/discoverSandboxUsage-DdewAOuj.mjs";import{default as le}from"./packem_shared/discoverSchema-CubSTjtY.mjs";import{SHAPES_FILENAME as xe,discoverShapes as Ee}from"./packem_shared/SHAPES_FILENAME-D3N7xcEk.mjs";import{default as ue}from"./packem_shared/discoverStorageRulesMetadata-gyO60A5S.mjs";import{WORKFLOWS_FILENAME as Ne,discoverWorkflows as ge}from"./packem_shared/WORKFLOWS_FILENAME-DRaiCNa6.mjs";import{G as Re,e as Ce,a as Me,b as he,c as _e,d as Te,f as Ie,g as Le,h as Fe,i as De,j as Pe,k as Ue,l as Ge,m as He}from"./packem_shared/emit-EJw8shd_.mjs";import{emitApp as ke}from"./packem_shared/emitApp-DftAzAA2.mjs";import{buildOpenApiDocument as We,emitOpenApi as je,emitOpenApiModule as Ke}from"./packem_shared/buildOpenApiDocument-CmLfuJpW.mjs";import{OPENRPC_VERSION as ze,buildOpenRpcDocument as Qe,emitOpenRpc as we,emitOpenRpcModule as qe}from"./packem_shared/OPENRPC_VERSION-C30LtXay.mjs";import{DEFAULT_TARGET as Je,platformMatrixIds as Ye,readProjectTarget as Xe,resolveCodegenTarget as Ze}from"./packem_shared/DEFAULT_TARGET-CwB3hjFH.mjs";import{SCHEMA_SNAPSHOT_FILENAME as er,createCodegenProject as rr,findTsconfig as or,refreshCodegenProject as tr,runCodegen as sr}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-D7qF6qrd.mjs";import{SchemaSnapshotParseError as ir,buildSchemaSnapshot as mr,evaluateSchemaDrift as dr,parseSchemaSnapshot as fr}from"./packem_shared/SchemaSnapshotParseError-CvPTjDrT.mjs";import{schemaFromIr as cr}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as lr,validatorIrToJsonSchema as Sr}from"./packem_shared/LUNORA_ERROR_CODES-BYg8Lpgb.mjs";import{SDK_LANGUAGES as Er,SDK_TARGETS as Ar,generateSdk as ur}from"./packem_shared/SDK_LANGUAGES-CFyux-74.mjs";import{redact as Nr,secretKindOf as gr}from"./packem_shared/redact-Cy14LEnc.mjs";import{MESSAGE_SOLUTIONS as Rr,findSolutionByMessage as Cr}from"@lunora/errors";import{isTypedSchema as hr}from"./packem_shared/isTypedSchema-B_qlBbE-.mjs";const e="0.0.0";export{u as AGENTS_FILENAME,R as CONTAINERS_FILENAME,x as CodegenDiagnosticError,Je as DEFAULT_TARGET,T as FLAGS_FILENAME,Re as GENERATED_HEADER,lr as LUNORA_ERROR_CODES,Rr as LUNORA_SOLUTION_RULES,V as MUTATORS_FILENAME,B as NOTIFY_FILENAME,ze as OPENRPC_VERSION,oe as QUEUES_FILENAME,er as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Er as SDK_LANGUAGES,Ar as SDK_TARGETS,xe as SHAPES_FILENAME,ir as SchemaSnapshotParseError,e as VERSION,Ne as WORKFLOWS_FILENAME,We as buildOpenApiDocument,Qe as buildOpenRpcDocument,mr as buildSchemaSnapshot,rr as createCodegenProject,c as describeErrorLevelFindings,E as diagnosticAt,s as diffSchemaSnapshots,v as discoverAgents,g as discoverAuthApiCalls,C as discoverContainers,h as discoverCrons,I as discoverFlags,F as discoverFunctions,P as discoverHttpRoutes,G as discoverHyperdriveCalls,b as discoverInserts,y as discoverMaskProcedures,j as discoverMigrations,z as discoverMutators,w as discoverNondeterministicCalls,J as discoverNotifyCalls,Y as discoverNotifyConfig,ee as discoverQueries,te as discoverQueues,ae as discoverR2sqlCalls,fe as discoverRlsMetadata,me as discoverRlsProcedures,ce as discoverSandboxUsage,le as discoverSchema,Ee as discoverShapes,ue as discoverStorageRulesMetadata,ge as discoverWorkflows,Ce as emitAgents,Me as emitApi,ke as emitApp,he as emitCollections,_e as emitContainers,Te as emitCrons,Ie as emitDataModel,Le as emitDrizzleSchema,Fe as emitFunctions,je as emitOpenApi,Ke as emitOpenApiModule,we as emitOpenRpc,qe as emitOpenRpcModule,De as emitServer,Pe as emitShard,Ue as emitVectors,Ge as emitWorkflows,He as emitWranglerCronTriggers,n as errorAdvisoryNames,l as errorPlatformDiagnosticNames,dr as evaluateSchemaDrift,Cr as findLunoraSolution,or as findTsconfig,m as formatAdvisories,ur as generateSdk,hr as isTypedSchema,d as lintSchema,fr as parseSchemaSnapshot,Ye as platformMatrixIds,Z as readPackageDependencies,Xe as readProjectTarget,Nr as redact,tr as refreshCodegenProject,Ze as resolveCodegenTarget,sr as runCodegen,cr as schemaFromIr,gr as secretKindOf,a as serializeSchemaSnapshot,f as toAdvisorContext,Sr as validatorIrToJsonSchema};
@@ -0,0 +1 @@
1
+ import{existsSync as d,readFileSync as p}from"node:fs";import{join as m}from"node:path";import{NODE_CAPABILITIES as f,CLOUDFLARE_CAPABILITIES as h}from"@lunora/platform";import{parse as g}from"jsonc-parser";const v="cloudflare",y="lunora.json",b=a=>{const e=m(a,y);if(!d(e))return;let r;try{r=p(e,"utf8")}catch{return}const s=[],n=g(r,s,{allowTrailingComma:!0});if(s.length>0||n===null||typeof n!="object")return;const{target:o}=n;return typeof o=="string"&&o.length>0?o:void 0},E=(a,e)=>e??b(a)??v,i={cloudflare:h,node:f},L=()=>Object.keys(i).toSorted((a,e)=>a.localeCompare(e)),_={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},T=["crossShardFanout","durableStreams","globalTables","queues","secrets"],c={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`)"},$=(a,e,r,s={})=>{const n={...a},o=[];for(const[t,l]of Object.entries(_)){if(l===null||!a[t])continue;const u=e.features[l]?.level;u==="unsupported"?(n[t]=!1,o.push({feature:t,level:"error",message:`${e.name} does not support "${t}" (ctx.${t}). Its surface was omitted from the generated types.`,name:"platform_unsupported_feature",remediation:`Remove the ctx.${t} usage, or deploy to a target whose capability matrix marks "${l}" as native or emulated.`,target:r})):u===void 0&&(n[t]=!1,o.push({feature:t,level:"error",message:`${e.name}'s capability matrix does not declare a support level for "${t}" (ctx.${t}). Treated as unsupported and its surface was omitted from the generated types.`,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:r}))}for(const t of T){if(s[t]!==!0)continue;const l=e.features[t]?.level;l==="unsupported"?o.push({level:"error",message:`${e.name} does not support ${c[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:r}):l===void 0&&o.push({level:"error",message:`${e.name}'s capability matrix does not declare a support level for ${c[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:r})}return{diagnostics:o,usage:n}},k=(a,e,r={})=>{const s=i[e];return s===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(i).join(", ")}) or install the target's @lunora/platform-${e} package.`,target:e}],usage:{...a}}:$(a,s,e,r)};export{_ as CAPABILITY_TO_FEATURE,v as DEFAULT_TARGET,y as PROJECT_CONFIG_FILE,$ as gateAgainstMatrix,k as gatePlatformFeatures,L as platformMatrixIds,b as readProjectTarget,E as resolveCodegenTarget};
@@ -1 +1 @@
1
- import"./SCHEMA_SNAPSHOT_VERSION-DLXXalg2.mjs";import{G as t,U as m,n as r,e as o,a as n,b as l,c as A,d as E,f as S,g,h as C,o as c,p as d,i as p,j as u,k as D,l as f,m as h}from"./emit-s6mHBmXu.mjs";import"./paths-C-9fwEgQ.mjs";export{t as GENERATED_HEADER,m as UMBRELLA_BASE_PACKAGES,r as buildStorageColumns,o as emitAgents,n as emitApi,l as emitCollections,A as emitContainers,E as emitCrons,S as emitDataModel,g as emitDrizzleSchema,C as emitFunctions,c as emitQueues,d as emitSeed,p as emitServer,u as emitShard,D as emitVectors,f as emitWorkflows,h as emitWranglerCronTriggers};
1
+ import"./SCHEMA_SNAPSHOT_VERSION-DLXXalg2.mjs";import{G as t,U as m,n as r,e as o,a as n,b as l,c as A,d as E,f as S,g,h as C,o as c,p as d,i as p,j as u,k as D,l as f,m as h}from"./emit-EJw8shd_.mjs";import"./paths-C-9fwEgQ.mjs";export{t as GENERATED_HEADER,m as UMBRELLA_BASE_PACKAGES,r as buildStorageColumns,o as emitAgents,n as emitApi,l as emitCollections,A as emitContainers,E as emitCrons,S as emitDataModel,g as emitDrizzleSchema,C as emitFunctions,c as emitQueues,d as emitSeed,p as emitServer,u as emitShard,D as emitVectors,f as emitWorkflows,h as emitWranglerCronTriggers};
@@ -1,3 +1,3 @@
1
- import{G as c}from"./emit-s6mHBmXu.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-BYg8Lpgb.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-EJw8shd_.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-BYg8Lpgb.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};