@lunora/codegen 1.0.0-alpha.244 → 1.0.0-alpha.246

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
@@ -974,6 +974,37 @@ interface ModuleIR {
974
974
  /** Tables the module declares it owns (`defineModule({ tables })`); empty when it declares none. */
975
975
  tables: ReadonlyArray<string>;
976
976
  }
977
+ /**
978
+ * A sibling Worker the app calls through a Cloudflare service binding, declared in
979
+ * `lunora.config.*` `services` (plan 457). Becomes a wrangler `services[]` entry,
980
+ * a typed `ctx.services.<name>` on actions, and a `service` node in the
981
+ * architecture manifest.
982
+ */
983
+ interface ServiceBindingIR {
984
+ /** The `services[].binding` Lunora writes, e.g. `SERVICE_DOCUMENT_PARSER`. */
985
+ binding: string;
986
+ /** The exported `WorkerEntrypoint` class for an RPC service; absent for a fetch service. */
987
+ entrypoint?: string;
988
+ /**
989
+ * The Worker name per `env.<name>` block the service's own wrangler config
990
+ * sets a `name` in. An environment missing here deploys as wrangler's
991
+ * default `<worker>-<env>`.
992
+ */
993
+ envWorkers: Readonly<Record<string, string>>;
994
+ /** Absolute path of the service's entry module (its wrangler `main`) — what the RPC type is read from. */
995
+ main: string;
996
+ /** The `ctx.services.<name>` key, e.g. `documentParser`. */
997
+ name: string;
998
+ /**
999
+ * The scopes in which the service still serves on `*.workers.dev` with no
1000
+ * route of its own: `""` for the top level, else the environment name.
1001
+ */
1002
+ publicScopes: ReadonlyArray<string>;
1003
+ /** The Worker's own `name` from its wrangler config — the `services[].service` target. */
1004
+ worker: string;
1005
+ /** Absolute path of the service's wrangler config. */
1006
+ wranglerPath: string;
1007
+ }
977
1008
  /**
978
1009
  * The feature-flag provider declared by the default export of `lunora/flags.ts`
979
1010
  * (`defineFlags({ provider, … })`). Discovery is **metadata-only** — codegen
@@ -3141,6 +3172,24 @@ declare const discoverSandboxUsage: (project: Project, lunoraDirectory: string)
3141
3172
  * return a structural IR. Throws if the file or call cannot be found.
3142
3173
  */
3143
3174
  declare const discoverSchema: (project: Project, schemaPath: string, projectRoot?: string) => SchemaIR;
3175
+ /**
3176
+ * Resolve every `services` entry in `lunora.config.*` (plan 457) into the binding
3177
+ * Lunora wires: the Worker name and entry module come from the service's own
3178
+ * wrangler config, so they have one source of truth. Returns `[]` when no
3179
+ * service is declared; throws, naming the entry, on anything codegen cannot wire
3180
+ * — an unreadable declaration, a missing folder or config, a nameless Worker.
3181
+ */
3182
+ declare const resolveServiceBindings: (projectRoot: string) => ServiceBindingIR[];
3183
+ /**
3184
+ * The non-throwing {@link resolveServiceBindings}, for the tools around codegen
3185
+ * (dev, deploy, doctor, the Vite plugin): a declaration codegen rejects comes back as `error`
3186
+ * with no services, so each caller decides how loud to be — codegen itself
3187
+ * already throws on it.
3188
+ */
3189
+ declare const readServiceBindings: (projectRoot: string) => {
3190
+ error?: string;
3191
+ services: ServiceBindingIR[];
3192
+ };
3144
3193
  /** The only file shapes may be declared in — mirrors `lunora/queues.ts`. */
3145
3194
  declare const SHAPES_FILENAME = "shapes.ts";
3146
3195
  /**
@@ -3322,6 +3371,8 @@ interface EmitServerOptions {
3322
3371
  * the base optional binding record — byte-identical to today.
3323
3372
  */
3324
3373
  env?: EnvIR;
3374
+ /** Absolute `_generated/` directory, so an RPC service's entry module is imported by a path relative to it. Required with `services`. */
3375
+ generatedDirectory?: string;
3325
3376
  /**
3326
3377
  * A `lunora/` source reads `ctx.access` — wires the verified Cloudflare Access
3327
3378
  * facade (`@lunora/cloudflare-access/context`) onto every ctx. Distinct from
@@ -3365,6 +3416,8 @@ interface EmitServerOptions {
3365
3416
  /** Queues declared via `defineQueue` exports — wires the typed `ctx.queues` producers onto Mutation/Action contexts. */
3366
3417
  queues?: ReadonlyArray<QueueIR>;
3367
3418
  schema?: SchemaIR;
3419
+ /** Sibling Workers declared in `lunora.config.*` `services` — wires a typed `ctx.services` onto ActionCtx (plan 457). */
3420
+ services?: ReadonlyArray<ServiceBindingIR>;
3368
3421
  storageRuleBuckets?: ReadonlyArray<string>;
3369
3422
  /** Topics declared via `defineTopic` exports — wires the typed `ctx.topics` publishers onto Mutation/Action contexts. */
3370
3423
  topics?: ReadonlyArray<TopicIR>;
@@ -3372,7 +3425,7 @@ interface EmitServerOptions {
3372
3425
  useUmbrella?: boolean;
3373
3426
  workflows?: ReadonlyArray<WorkflowIR>;
3374
3427
  }
3375
- declare const emitServer: ({ agents, containers, env, hasAccessFacade, hasAi, hasAnalytics, hasBrowser, hasVectors, hasFlags, hasHyperdrive, hasImages, hasKv, hasNotify, hasPayments, hasPipelines, hasR2sql, hasX402, identity, queues, schema, storageRuleBuckets, topics, useUmbrella, workflows }?: EmitServerOptions) => string;
3428
+ declare const emitServer: ({ agents, containers, env, hasAccessFacade, hasAi, hasAnalytics, hasBrowser, hasVectors, hasFlags, hasHyperdrive, hasImages, hasKv, hasNotify, hasPayments, hasPipelines, hasR2sql, hasX402, identity, queues, schema, generatedDirectory, services, storageRuleBuckets, topics, useUmbrella, workflows }?: EmitServerOptions) => string;
3376
3429
  interface EmitShardOptions {
3377
3430
  advisories?: ReadonlyArray<Finding>;
3378
3431
  /** Every declared procedure — the health map's denominator, served via `getAdvisorProcedures`. */
@@ -3434,6 +3487,8 @@ interface EmitShardOptions {
3434
3487
  * unchanged.
3435
3488
  */
3436
3489
  schemaSnapshot?: SchemaSnapshot;
3490
+ /** Sibling Workers declared in `lunora.config.*` `services` — wires `ctx.services` onto the action ctx (plan 457). */
3491
+ services?: ReadonlyArray<ServiceBindingIR>;
3437
3492
  /** Replication shapes declared via `defineShape` in `lunora/shapes.ts` — wires the `resolveShape` subscription override. */
3438
3493
  shapes?: ReadonlyArray<ShapeIR>;
3439
3494
  storageRules?: StorageRulesMetadataIR;
@@ -3444,7 +3499,7 @@ interface EmitShardOptions {
3444
3499
  useUmbrella?: boolean;
3445
3500
  workflows?: ReadonlyArray<WorkflowIR>;
3446
3501
  }
3447
- declare const emitShard: ({ advisories, advisorProcedures, agents, containers, env, flagKeys, hasAccessFacade, hasAi, hasAnalytics, hasBrowser, hasFlags, hasHyperdrive, hasImages, hasKv, hasNotify, hasPayments, hasPipelines, hasR2sql, hasVectors, hasX402, maskMetadata, mutators, queues, rlsMetadata, schema, schemaSnapshot, shapes, storageRules, studioFeatures, topics, useUmbrella, workflows }: EmitShardOptions) => string;
3502
+ declare const emitShard: ({ advisories, advisorProcedures, agents, containers, env, flagKeys, hasAccessFacade, hasAi, hasAnalytics, hasBrowser, hasFlags, hasHyperdrive, hasImages, hasKv, hasNotify, hasPayments, hasPipelines, hasR2sql, hasVectors, hasX402, maskMetadata, mutators, queues, rlsMetadata, schema, schemaSnapshot, shapes, storageRules, studioFeatures, services, topics, useUmbrella, workflows }: EmitShardOptions) => string;
3448
3503
  /**
3449
3504
  * Emit `_generated/containers.ts` — one container-enabled Durable Object class
3450
3505
  * per `defineContainer` export, each a thin subclass of `LunoraContainer`
@@ -3770,6 +3825,16 @@ interface ProjectConfigLiterals {
3770
3825
  unreadable?: boolean;
3771
3826
  };
3772
3827
  remote?: boolean;
3828
+ /**
3829
+ * `services`: binding key → `{ dir, entrypoint? }` (plan 457). `unreadable`
3830
+ * when declared but not an object of string literals, kept apart from the
3831
+ * top-level `unreadable` like `advisor`: a service codegen cannot read must
3832
+ * fail loudly, not vanish from `ctx.services`.
3833
+ */
3834
+ services?: {
3835
+ declared?: Record<string, ServiceLiteral>;
3836
+ unreadable?: boolean;
3837
+ };
3773
3838
  target?: string;
3774
3839
  /**
3775
3840
  * A config file exists, but its default export could not be read as an
@@ -3779,6 +3844,11 @@ interface ProjectConfigLiterals {
3779
3844
  */
3780
3845
  unreadable?: boolean;
3781
3846
  }
3847
+ /** One `services.<key>` entry as written: the Worker's folder and, for RPC, its `WorkerEntrypoint` export. */
3848
+ interface ServiceLiteral {
3849
+ dir: string;
3850
+ entrypoint?: string;
3851
+ }
3782
3852
  /** The structural slice of `lunora.config.*` Lunora reads. Unvalidated on purpose — see {@link loadProjectConfig}. */
3783
3853
  interface LunoraProjectConfig {
3784
3854
  /** Advisor settings for codegen (`minSeverity`). Read by `runCodegen` through {@link readProjectConfigLiterals}. */
@@ -4242,4 +4312,4 @@ declare const secretKindOf: (value: string) => string | undefined;
4242
4312
  /** A redacted preview of a secret value — first 4 chars plus its length, never the full value. */
4243
4313
  declare const redact: (value: string) => string;
4244
4314
  declare const VERSION = "0.0.0";
4245
- export { AGENTS_FILENAME, type AgentIR, type AuthApiCallIR, CONTAINERS_FILENAME, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContainerImageIR, type ContainerNamedImageIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DefaultScheduledContainerIR, type DriftChange, type DriftRemediation, type DriftScope, type DurableObjectScheduledContainerIR, type EmitAppOptions, FLAGS_FILENAME, type FieldSnapshot, type FlagsIR, type FunctionIR, GENERATED_HEADER, type HttpRouteIR, type IndexIR, type IndexSnapshot, type InsertWriteIR, LUNORA_ERROR_CODES, type LintSchemaOptions, type LoadedProjectConfig, type LunoraProjectConfig, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, NOTIFY_FILENAME, 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, type TopicIR, 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, fingerprintSchemaSources, formatAdvisories, generateSdk, isD1GlobalTable, isHyperdriveGlobalTable, isTypedSchema, lintSchema, listLunoraSourceFiles, loadProjectConfig, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectConfigLiterals, readProjectTarget, redact, refreshCodegenProject, resolveCodegenTarget, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, sortedUniqueNames, toAdvisorContext, validatorIrToJsonSchema };
4315
+ export { AGENTS_FILENAME, type AgentIR, type AuthApiCallIR, CONTAINERS_FILENAME, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContainerImageIR, type ContainerNamedImageIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DefaultScheduledContainerIR, type DriftChange, type DriftRemediation, type DriftScope, type DurableObjectScheduledContainerIR, type EmitAppOptions, FLAGS_FILENAME, type FieldSnapshot, type FlagsIR, type FunctionIR, GENERATED_HEADER, type HttpRouteIR, type IndexIR, type IndexSnapshot, type InsertWriteIR, LUNORA_ERROR_CODES, type LintSchemaOptions, type LoadedProjectConfig, type LunoraProjectConfig, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, NOTIFY_FILENAME, 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 ServiceBindingIR, type ServiceLiteral, type ShapeIR, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, type TopicIR, 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, fingerprintSchemaSources, formatAdvisories, generateSdk, isD1GlobalTable, isHyperdriveGlobalTable, isTypedSchema, lintSchema, listLunoraSourceFiles, loadProjectConfig, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectConfigLiterals, readProjectTarget, readServiceBindings, redact, refreshCodegenProject, resolveCodegenTarget, resolveServiceBindings, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, sortedUniqueNames, toAdvisorContext, validatorIrToJsonSchema };
package/dist/index.d.ts CHANGED
@@ -974,6 +974,37 @@ interface ModuleIR {
974
974
  /** Tables the module declares it owns (`defineModule({ tables })`); empty when it declares none. */
975
975
  tables: ReadonlyArray<string>;
976
976
  }
977
+ /**
978
+ * A sibling Worker the app calls through a Cloudflare service binding, declared in
979
+ * `lunora.config.*` `services` (plan 457). Becomes a wrangler `services[]` entry,
980
+ * a typed `ctx.services.<name>` on actions, and a `service` node in the
981
+ * architecture manifest.
982
+ */
983
+ interface ServiceBindingIR {
984
+ /** The `services[].binding` Lunora writes, e.g. `SERVICE_DOCUMENT_PARSER`. */
985
+ binding: string;
986
+ /** The exported `WorkerEntrypoint` class for an RPC service; absent for a fetch service. */
987
+ entrypoint?: string;
988
+ /**
989
+ * The Worker name per `env.<name>` block the service's own wrangler config
990
+ * sets a `name` in. An environment missing here deploys as wrangler's
991
+ * default `<worker>-<env>`.
992
+ */
993
+ envWorkers: Readonly<Record<string, string>>;
994
+ /** Absolute path of the service's entry module (its wrangler `main`) — what the RPC type is read from. */
995
+ main: string;
996
+ /** The `ctx.services.<name>` key, e.g. `documentParser`. */
997
+ name: string;
998
+ /**
999
+ * The scopes in which the service still serves on `*.workers.dev` with no
1000
+ * route of its own: `""` for the top level, else the environment name.
1001
+ */
1002
+ publicScopes: ReadonlyArray<string>;
1003
+ /** The Worker's own `name` from its wrangler config — the `services[].service` target. */
1004
+ worker: string;
1005
+ /** Absolute path of the service's wrangler config. */
1006
+ wranglerPath: string;
1007
+ }
977
1008
  /**
978
1009
  * The feature-flag provider declared by the default export of `lunora/flags.ts`
979
1010
  * (`defineFlags({ provider, … })`). Discovery is **metadata-only** — codegen
@@ -3141,6 +3172,24 @@ declare const discoverSandboxUsage: (project: Project, lunoraDirectory: string)
3141
3172
  * return a structural IR. Throws if the file or call cannot be found.
3142
3173
  */
3143
3174
  declare const discoverSchema: (project: Project, schemaPath: string, projectRoot?: string) => SchemaIR;
3175
+ /**
3176
+ * Resolve every `services` entry in `lunora.config.*` (plan 457) into the binding
3177
+ * Lunora wires: the Worker name and entry module come from the service's own
3178
+ * wrangler config, so they have one source of truth. Returns `[]` when no
3179
+ * service is declared; throws, naming the entry, on anything codegen cannot wire
3180
+ * — an unreadable declaration, a missing folder or config, a nameless Worker.
3181
+ */
3182
+ declare const resolveServiceBindings: (projectRoot: string) => ServiceBindingIR[];
3183
+ /**
3184
+ * The non-throwing {@link resolveServiceBindings}, for the tools around codegen
3185
+ * (dev, deploy, doctor, the Vite plugin): a declaration codegen rejects comes back as `error`
3186
+ * with no services, so each caller decides how loud to be — codegen itself
3187
+ * already throws on it.
3188
+ */
3189
+ declare const readServiceBindings: (projectRoot: string) => {
3190
+ error?: string;
3191
+ services: ServiceBindingIR[];
3192
+ };
3144
3193
  /** The only file shapes may be declared in — mirrors `lunora/queues.ts`. */
3145
3194
  declare const SHAPES_FILENAME = "shapes.ts";
3146
3195
  /**
@@ -3322,6 +3371,8 @@ interface EmitServerOptions {
3322
3371
  * the base optional binding record — byte-identical to today.
3323
3372
  */
3324
3373
  env?: EnvIR;
3374
+ /** Absolute `_generated/` directory, so an RPC service's entry module is imported by a path relative to it. Required with `services`. */
3375
+ generatedDirectory?: string;
3325
3376
  /**
3326
3377
  * A `lunora/` source reads `ctx.access` — wires the verified Cloudflare Access
3327
3378
  * facade (`@lunora/cloudflare-access/context`) onto every ctx. Distinct from
@@ -3365,6 +3416,8 @@ interface EmitServerOptions {
3365
3416
  /** Queues declared via `defineQueue` exports — wires the typed `ctx.queues` producers onto Mutation/Action contexts. */
3366
3417
  queues?: ReadonlyArray<QueueIR>;
3367
3418
  schema?: SchemaIR;
3419
+ /** Sibling Workers declared in `lunora.config.*` `services` — wires a typed `ctx.services` onto ActionCtx (plan 457). */
3420
+ services?: ReadonlyArray<ServiceBindingIR>;
3368
3421
  storageRuleBuckets?: ReadonlyArray<string>;
3369
3422
  /** Topics declared via `defineTopic` exports — wires the typed `ctx.topics` publishers onto Mutation/Action contexts. */
3370
3423
  topics?: ReadonlyArray<TopicIR>;
@@ -3372,7 +3425,7 @@ interface EmitServerOptions {
3372
3425
  useUmbrella?: boolean;
3373
3426
  workflows?: ReadonlyArray<WorkflowIR>;
3374
3427
  }
3375
- declare const emitServer: ({ agents, containers, env, hasAccessFacade, hasAi, hasAnalytics, hasBrowser, hasVectors, hasFlags, hasHyperdrive, hasImages, hasKv, hasNotify, hasPayments, hasPipelines, hasR2sql, hasX402, identity, queues, schema, storageRuleBuckets, topics, useUmbrella, workflows }?: EmitServerOptions) => string;
3428
+ declare const emitServer: ({ agents, containers, env, hasAccessFacade, hasAi, hasAnalytics, hasBrowser, hasVectors, hasFlags, hasHyperdrive, hasImages, hasKv, hasNotify, hasPayments, hasPipelines, hasR2sql, hasX402, identity, queues, schema, generatedDirectory, services, storageRuleBuckets, topics, useUmbrella, workflows }?: EmitServerOptions) => string;
3376
3429
  interface EmitShardOptions {
3377
3430
  advisories?: ReadonlyArray<Finding>;
3378
3431
  /** Every declared procedure — the health map's denominator, served via `getAdvisorProcedures`. */
@@ -3434,6 +3487,8 @@ interface EmitShardOptions {
3434
3487
  * unchanged.
3435
3488
  */
3436
3489
  schemaSnapshot?: SchemaSnapshot;
3490
+ /** Sibling Workers declared in `lunora.config.*` `services` — wires `ctx.services` onto the action ctx (plan 457). */
3491
+ services?: ReadonlyArray<ServiceBindingIR>;
3437
3492
  /** Replication shapes declared via `defineShape` in `lunora/shapes.ts` — wires the `resolveShape` subscription override. */
3438
3493
  shapes?: ReadonlyArray<ShapeIR>;
3439
3494
  storageRules?: StorageRulesMetadataIR;
@@ -3444,7 +3499,7 @@ interface EmitShardOptions {
3444
3499
  useUmbrella?: boolean;
3445
3500
  workflows?: ReadonlyArray<WorkflowIR>;
3446
3501
  }
3447
- declare const emitShard: ({ advisories, advisorProcedures, agents, containers, env, flagKeys, hasAccessFacade, hasAi, hasAnalytics, hasBrowser, hasFlags, hasHyperdrive, hasImages, hasKv, hasNotify, hasPayments, hasPipelines, hasR2sql, hasVectors, hasX402, maskMetadata, mutators, queues, rlsMetadata, schema, schemaSnapshot, shapes, storageRules, studioFeatures, topics, useUmbrella, workflows }: EmitShardOptions) => string;
3502
+ declare const emitShard: ({ advisories, advisorProcedures, agents, containers, env, flagKeys, hasAccessFacade, hasAi, hasAnalytics, hasBrowser, hasFlags, hasHyperdrive, hasImages, hasKv, hasNotify, hasPayments, hasPipelines, hasR2sql, hasVectors, hasX402, maskMetadata, mutators, queues, rlsMetadata, schema, schemaSnapshot, shapes, storageRules, studioFeatures, services, topics, useUmbrella, workflows }: EmitShardOptions) => string;
3448
3503
  /**
3449
3504
  * Emit `_generated/containers.ts` — one container-enabled Durable Object class
3450
3505
  * per `defineContainer` export, each a thin subclass of `LunoraContainer`
@@ -3770,6 +3825,16 @@ interface ProjectConfigLiterals {
3770
3825
  unreadable?: boolean;
3771
3826
  };
3772
3827
  remote?: boolean;
3828
+ /**
3829
+ * `services`: binding key → `{ dir, entrypoint? }` (plan 457). `unreadable`
3830
+ * when declared but not an object of string literals, kept apart from the
3831
+ * top-level `unreadable` like `advisor`: a service codegen cannot read must
3832
+ * fail loudly, not vanish from `ctx.services`.
3833
+ */
3834
+ services?: {
3835
+ declared?: Record<string, ServiceLiteral>;
3836
+ unreadable?: boolean;
3837
+ };
3773
3838
  target?: string;
3774
3839
  /**
3775
3840
  * A config file exists, but its default export could not be read as an
@@ -3779,6 +3844,11 @@ interface ProjectConfigLiterals {
3779
3844
  */
3780
3845
  unreadable?: boolean;
3781
3846
  }
3847
+ /** One `services.<key>` entry as written: the Worker's folder and, for RPC, its `WorkerEntrypoint` export. */
3848
+ interface ServiceLiteral {
3849
+ dir: string;
3850
+ entrypoint?: string;
3851
+ }
3782
3852
  /** The structural slice of `lunora.config.*` Lunora reads. Unvalidated on purpose — see {@link loadProjectConfig}. */
3783
3853
  interface LunoraProjectConfig {
3784
3854
  /** Advisor settings for codegen (`minSeverity`). Read by `runCodegen` through {@link readProjectConfigLiterals}. */
@@ -4242,4 +4312,4 @@ declare const secretKindOf: (value: string) => string | undefined;
4242
4312
  /** A redacted preview of a secret value — first 4 chars plus its length, never the full value. */
4243
4313
  declare const redact: (value: string) => string;
4244
4314
  declare const VERSION = "0.0.0";
4245
- export { AGENTS_FILENAME, type AgentIR, type AuthApiCallIR, CONTAINERS_FILENAME, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContainerImageIR, type ContainerNamedImageIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DefaultScheduledContainerIR, type DriftChange, type DriftRemediation, type DriftScope, type DurableObjectScheduledContainerIR, type EmitAppOptions, FLAGS_FILENAME, type FieldSnapshot, type FlagsIR, type FunctionIR, GENERATED_HEADER, type HttpRouteIR, type IndexIR, type IndexSnapshot, type InsertWriteIR, LUNORA_ERROR_CODES, type LintSchemaOptions, type LoadedProjectConfig, type LunoraProjectConfig, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, NOTIFY_FILENAME, 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, type TopicIR, 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, fingerprintSchemaSources, formatAdvisories, generateSdk, isD1GlobalTable, isHyperdriveGlobalTable, isTypedSchema, lintSchema, listLunoraSourceFiles, loadProjectConfig, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectConfigLiterals, readProjectTarget, redact, refreshCodegenProject, resolveCodegenTarget, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, sortedUniqueNames, toAdvisorContext, validatorIrToJsonSchema };
4315
+ export { AGENTS_FILENAME, type AgentIR, type AuthApiCallIR, CONTAINERS_FILENAME, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContainerImageIR, type ContainerNamedImageIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DefaultScheduledContainerIR, type DriftChange, type DriftRemediation, type DriftScope, type DurableObjectScheduledContainerIR, type EmitAppOptions, FLAGS_FILENAME, type FieldSnapshot, type FlagsIR, type FunctionIR, GENERATED_HEADER, type HttpRouteIR, type IndexIR, type IndexSnapshot, type InsertWriteIR, LUNORA_ERROR_CODES, type LintSchemaOptions, type LoadedProjectConfig, type LunoraProjectConfig, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, NOTIFY_FILENAME, 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 ServiceBindingIR, type ServiceLiteral, type ShapeIR, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, type TopicIR, 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, fingerprintSchemaSources, formatAdvisories, generateSdk, isD1GlobalTable, isHyperdriveGlobalTable, isTypedSchema, lintSchema, listLunoraSourceFiles, loadProjectConfig, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectConfigLiterals, readProjectTarget, readServiceBindings, redact, refreshCodegenProject, resolveCodegenTarget, resolveServiceBindings, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, sortedUniqueNames, toAdvisorContext, validatorIrToJsonSchema };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as s,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{formatAdvisories as m,lintSchema as f,toAdvisorContext as d}from"./packem_shared/formatAdvisories-DwmUKYuc.mjs";import{describeErrorLevelFindings as c,errorAdvisoryNames as l,errorPlatformDiagnosticNames as n,sortedUniqueNames as x}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CodegenDiagnosticError as E,diagnosticAt as u}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as v,discoverAgents as N}from"./packem_shared/AGENTS_FILENAME-D8SgT3OR.mjs";import{listLunoraSourceFiles as C}from"./packem_shared/listLunoraSourceFiles-CSlcBYlo.mjs";import{default as R}from"./packem_shared/discoverAuthApiCalls-DoSN_yc3.mjs";import{CONTAINERS_FILENAME as T,discoverContainers as _}from"./packem_shared/CONTAINERS_FILENAME-CBCG6g9n.mjs";import{default as L}from"./packem_shared/discoverCrons-BEALHx1S.mjs";import{FLAGS_FILENAME as I,discoverFlags as P}from"./packem_shared/FLAGS_FILENAME-W5XQz_Po.mjs";import{default as G}from"./packem_shared/discoverFunctions-BcBzcG5x.mjs";import{default as b}from"./packem_shared/discoverHttpRoutes-CJHS4llq.mjs";import{default as y}from"./packem_shared/discoverHyperdriveCalls-Bkbh4tG7.mjs";import{default as k}from"./packem_shared/discoverInserts-DpuLYPPd.mjs";import{d as K}from"./packem_shared/index-D7dKfGPh.mjs";import{default as z}from"./packem_shared/discoverMigrations-Dt7ywfZv.mjs";import{MUTATORS_FILENAME as q,discoverMutators as w}from"./packem_shared/MUTATORS_FILENAME-DqWOgC5Z.mjs";import{default as J}from"./packem_shared/discoverNondeterministicCalls-CNJV2BiP.mjs";import{NOTIFY_FILENAME as X,discoverNotifyCalls as Z,discoverNotifyConfig as $}from"./packem_shared/NOTIFY_FILENAME-C1J_47et.mjs";import{default as re}from"./packem_shared/readPackageDependencies-C6h6FZuP.mjs";import{default as te}from"./packem_shared/discoverQueries-BcdqjYky.mjs";import{QUEUES_FILENAME as ae,discoverQueues as ie}from"./packem_shared/QUEUES_FILENAME-RGwht3Xu.mjs";import{default as fe}from"./packem_shared/discoverR2sqlCalls-30Wtbc0P.mjs";import{default as pe}from"./packem_shared/discoverRlsProcedures-F4Cy-kSi.mjs";import{default as le}from"./packem_shared/discoverRlsMetadata-mXBmPOGj.mjs";import{discoverSandboxUsage as xe}from"./packem_shared/discoverSandboxUsage-DkbwwFvO.mjs";import{default as Ee}from"./packem_shared/discoverSchema-D5R60b4F.mjs";import{SHAPES_FILENAME as Ae,discoverShapes as ve}from"./packem_shared/SHAPES_FILENAME-DRUFomCj.mjs";import{default as ge}from"./packem_shared/discoverStorageRulesMetadata-D3Ot9g5f.mjs";import{WORKFLOWS_FILENAME as Oe,discoverWorkflows as Re}from"./packem_shared/WORKFLOWS_FILENAME-4-ib4HH-.mjs";import{emitApp as Te}from"./packem_shared/emitApp-Cu0w-3vl.mjs";import{isD1GlobalTable as he,isHyperdriveGlobalTable as Le}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as Ie,emitOpenApi as Pe,emitOpenApiModule as De}from"./packem_shared/buildOpenApiDocument-SxfElVzK.mjs";import{OPENRPC_VERSION as Ue,buildOpenRpcDocument as be,emitOpenRpc as He,emitOpenRpcModule as ye}from"./packem_shared/OPENRPC_VERSION-Cr7Zzp6s.mjs";import{DEFAULT_TARGET as ke,platformMatrixIds as We,readProjectTarget as Ke,resolveCodegenTarget as Ve}from"./packem_shared/DEFAULT_TARGET-BLYeFMMT.mjs";import{loadProjectConfig as Qe,readProjectConfigLiterals as qe}from"./packem_shared/loadProjectConfig-CktK_il-.mjs";import{SCHEMA_SNAPSHOT_FILENAME as Be,createCodegenProject as Je,findTsconfig as Ye,refreshCodegenProject as Xe,runCodegen as Ze}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-D1zEPvOK.mjs";import{SchemaSnapshotParseError as er,buildSchemaSnapshot as rr,evaluateSchemaDrift as or,parseSchemaSnapshot as tr}from"./packem_shared/SchemaSnapshotParseError-CPOXlFhI.mjs";import{default as ar}from"./packem_shared/fingerprintSchemaSources-Cl1CJFeh.mjs";import{schemaFromIr as mr}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as dr,validatorIrToJsonSchema as pr}from"./packem_shared/LUNORA_ERROR_CODES-C2s0xWQD.mjs";import{SDK_LANGUAGES as lr,SDK_TARGETS as nr,generateSdk as xr}from"./packem_shared/SDK_LANGUAGES-Df_CnJx5.mjs";import{redact as Er,secretKindOf as ur}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as vr}from"./packem_shared/emitDrizzleSchema-Cv0HtLR3.mjs";import{default as gr}from"./packem_shared/emitFunctions-BgNeOZt_.mjs";import{default as Or}from"./packem_shared/emitServer-pF_fhA82.mjs";import{e as Mr}from"./packem_shared/shard-BVzXMtWg.mjs";import{G as _r}from"./packem_shared/shared-DjUziztz.mjs";import{MESSAGE_SOLUTIONS as Lr,findSolutionByMessage as Fr}from"@lunora/errors";import{PROJECT_CONFIG_FILENAMES as Pr,findProjectConfigFile as Dr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs";import{A as Ur,B as br,C as Hr}from"./packem_shared/shard-runtime-oIXHEMU7.mjs";import{emitApi as jr,emitCollections as kr}from"./packem_shared/emitApi-DdW9RyGG.mjs";import{emitCrons as Kr,emitScheduler as Vr,emitVectors as zr,emitWranglerCronTriggers as Qr}from"./packem_shared/emitCrons-BRKXFGFu.mjs";import{emitDataModel as wr}from"./packem_shared/emitDataModel-D3WuEZ4b.mjs";import{isTypedSchema as Jr}from"./packem_shared/isTypedSchema-CKzc3ioR.mjs";const e="0.0.0";export{v as AGENTS_FILENAME,T as CONTAINERS_FILENAME,E as CodegenDiagnosticError,ke as DEFAULT_TARGET,I as FLAGS_FILENAME,_r as GENERATED_HEADER,dr as LUNORA_ERROR_CODES,Lr as LUNORA_SOLUTION_RULES,q as MUTATORS_FILENAME,X as NOTIFY_FILENAME,Ue as OPENRPC_VERSION,Pr as PROJECT_CONFIG_FILENAMES,ae as QUEUES_FILENAME,Be as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,lr as SDK_LANGUAGES,nr as SDK_TARGETS,Ae as SHAPES_FILENAME,er as SchemaSnapshotParseError,e as VERSION,Oe as WORKFLOWS_FILENAME,Ie as buildOpenApiDocument,be as buildOpenRpcDocument,rr as buildSchemaSnapshot,Je as createCodegenProject,c as describeErrorLevelFindings,u as diagnosticAt,s as diffSchemaSnapshots,N as discoverAgents,R as discoverAuthApiCalls,_ as discoverContainers,L as discoverCrons,P as discoverFlags,G as discoverFunctions,b as discoverHttpRoutes,y as discoverHyperdriveCalls,k as discoverInserts,K as discoverMaskProcedures,z as discoverMigrations,w as discoverMutators,J as discoverNondeterministicCalls,Z as discoverNotifyCalls,$ as discoverNotifyConfig,te as discoverQueries,ie as discoverQueues,fe as discoverR2sqlCalls,le as discoverRlsMetadata,pe as discoverRlsProcedures,xe as discoverSandboxUsage,Ee as discoverSchema,ve as discoverShapes,ge as discoverStorageRulesMetadata,Re as discoverWorkflows,Ur as emitAgents,jr as emitApi,Te as emitApp,kr as emitCollections,br as emitContainers,Kr as emitCrons,wr as emitDataModel,vr as emitDrizzleSchema,gr as emitFunctions,Pe as emitOpenApi,De as emitOpenApiModule,He as emitOpenRpc,ye as emitOpenRpcModule,Vr as emitScheduler,Or as emitServer,Mr as emitShard,zr as emitVectors,Hr as emitWorkflows,Qr as emitWranglerCronTriggers,l as errorAdvisoryNames,n as errorPlatformDiagnosticNames,or as evaluateSchemaDrift,Fr as findLunoraSolution,Dr as findProjectConfigFile,Ye as findTsconfig,ar as fingerprintSchemaSources,m as formatAdvisories,xr as generateSdk,he as isD1GlobalTable,Le as isHyperdriveGlobalTable,Jr as isTypedSchema,f as lintSchema,C as listLunoraSourceFiles,Qe as loadProjectConfig,tr as parseSchemaSnapshot,We as platformMatrixIds,re as readPackageDependencies,qe as readProjectConfigLiterals,Ke as readProjectTarget,Er as redact,Xe as refreshCodegenProject,Ve as resolveCodegenTarget,Ze as runCodegen,mr as schemaFromIr,ur as secretKindOf,a as serializeSchemaSnapshot,x as sortedUniqueNames,d as toAdvisorContext,pr as validatorIrToJsonSchema};
1
+ import{SCHEMA_SNAPSHOT_VERSION as t,diffSchemaSnapshots as s,serializeSchemaSnapshot as a}from"./packem_shared/SCHEMA_SNAPSHOT_VERSION-C0oHwiJZ.mjs";import{formatAdvisories as m,lintSchema as f,toAdvisorContext as d}from"./packem_shared/formatAdvisories-DwmUKYuc.mjs";import{describeErrorLevelFindings as c,errorAdvisoryNames as n,errorPlatformDiagnosticNames as l,sortedUniqueNames as x}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CodegenDiagnosticError as E,diagnosticAt as u}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as v,discoverAgents as N}from"./packem_shared/AGENTS_FILENAME-D8SgT3OR.mjs";import{listLunoraSourceFiles as C}from"./packem_shared/listLunoraSourceFiles-CSlcBYlo.mjs";import{default as R}from"./packem_shared/discoverAuthApiCalls-DoSN_yc3.mjs";import{CONTAINERS_FILENAME as T,discoverContainers as _}from"./packem_shared/CONTAINERS_FILENAME-CBCG6g9n.mjs";import{default as L}from"./packem_shared/discoverCrons-BEALHx1S.mjs";import{FLAGS_FILENAME as I,discoverFlags as P}from"./packem_shared/FLAGS_FILENAME-W5XQz_Po.mjs";import{default as G}from"./packem_shared/discoverFunctions-BcBzcG5x.mjs";import{default as b}from"./packem_shared/discoverHttpRoutes-CJHS4llq.mjs";import{default as y}from"./packem_shared/discoverHyperdriveCalls-Bkbh4tG7.mjs";import{default as k}from"./packem_shared/discoverInserts-DpuLYPPd.mjs";import{d as B}from"./packem_shared/index-D7dKfGPh.mjs";import{default as V}from"./packem_shared/discoverMigrations-Dt7ywfZv.mjs";import{MUTATORS_FILENAME as Q,discoverMutators as q}from"./packem_shared/MUTATORS_FILENAME-DqWOgC5Z.mjs";import{default as J}from"./packem_shared/discoverNondeterministicCalls-CNJV2BiP.mjs";import{NOTIFY_FILENAME as X,discoverNotifyCalls as Z,discoverNotifyConfig as $}from"./packem_shared/NOTIFY_FILENAME-C1J_47et.mjs";import{default as re}from"./packem_shared/readPackageDependencies-C6h6FZuP.mjs";import{default as te}from"./packem_shared/discoverQueries-BcdqjYky.mjs";import{QUEUES_FILENAME as ae,discoverQueues as ie}from"./packem_shared/QUEUES_FILENAME-RGwht3Xu.mjs";import{default as fe}from"./packem_shared/discoverR2sqlCalls-30Wtbc0P.mjs";import{default as pe}from"./packem_shared/discoverRlsProcedures-F4Cy-kSi.mjs";import{default as ne}from"./packem_shared/discoverRlsMetadata-mXBmPOGj.mjs";import{discoverSandboxUsage as xe}from"./packem_shared/discoverSandboxUsage-DkbwwFvO.mjs";import{default as Ee}from"./packem_shared/discoverSchema-D5R60b4F.mjs";import{readServiceBindings as Ae,resolveServiceBindings as ve}from"./packem_shared/readServiceBindings-D9Wi_qGU.mjs";import{SHAPES_FILENAME as ge,discoverShapes as Ce}from"./packem_shared/SHAPES_FILENAME-DRUFomCj.mjs";import{default as Re}from"./packem_shared/discoverStorageRulesMetadata-D3Ot9g5f.mjs";import{WORKFLOWS_FILENAME as Te,discoverWorkflows as _e}from"./packem_shared/WORKFLOWS_FILENAME-4-ib4HH-.mjs";import{emitApp as Le}from"./packem_shared/emitApp-DsMk4tpo.mjs";import{isD1GlobalTable as Ie,isHyperdriveGlobalTable as Pe}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as Ge,emitOpenApi as Ue,emitOpenApiModule as be}from"./packem_shared/buildOpenApiDocument-SxfElVzK.mjs";import{OPENRPC_VERSION as ye,buildOpenRpcDocument as je,emitOpenRpc as ke,emitOpenRpcModule as We}from"./packem_shared/OPENRPC_VERSION-Cr7Zzp6s.mjs";import{DEFAULT_TARGET as Ke,platformMatrixIds as Ve,readProjectTarget as ze,resolveCodegenTarget as Qe}from"./packem_shared/DEFAULT_TARGET-D-zkySYF.mjs";import{loadProjectConfig as we,readProjectConfigLiterals as Je}from"./packem_shared/loadProjectConfig-6Zk3abcc.mjs";import{SCHEMA_SNAPSHOT_FILENAME as Xe,createCodegenProject as Ze,findTsconfig as $e,refreshCodegenProject as er,runCodegen as rr}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-KDyLA-v5.mjs";import{SchemaSnapshotParseError as tr,buildSchemaSnapshot as sr,evaluateSchemaDrift as ar,parseSchemaSnapshot as ir}from"./packem_shared/SchemaSnapshotParseError-CPOXlFhI.mjs";import{default as fr}from"./packem_shared/fingerprintSchemaSources-Cl1CJFeh.mjs";import{schemaFromIr as pr}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as nr,validatorIrToJsonSchema as lr}from"./packem_shared/LUNORA_ERROR_CODES-C2s0xWQD.mjs";import{SDK_LANGUAGES as Sr,SDK_TARGETS as Er,generateSdk as ur}from"./packem_shared/SDK_LANGUAGES-Df_CnJx5.mjs";import{redact as vr,secretKindOf as Nr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as Cr}from"./packem_shared/emitDrizzleSchema-Cv0HtLR3.mjs";import{default as Rr}from"./packem_shared/emitFunctions-BgNeOZt_.mjs";import{default as Tr}from"./packem_shared/emitServer-nvzMxk3d.mjs";import{e as hr}from"./packem_shared/shard-D6EZdlSg.mjs";import{G as Fr}from"./packem_shared/shared-DjUziztz.mjs";import{MESSAGE_SOLUTIONS as Pr,findSolutionByMessage as Dr}from"@lunora/errors";import{PROJECT_CONFIG_FILENAMES as Ur,findProjectConfigFile as br}from"./packem_shared/PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs";import{B as yr,C as jr,D as kr}from"./packem_shared/shard-runtime-D9GRosnD.mjs";import{emitApi as Br,emitCollections as Kr}from"./packem_shared/emitApi-DdW9RyGG.mjs";import{emitCrons as zr,emitScheduler as Qr,emitVectors as qr,emitWranglerCronTriggers as wr}from"./packem_shared/emitCrons-BRKXFGFu.mjs";import{emitDataModel as Yr}from"./packem_shared/emitDataModel-D3WuEZ4b.mjs";import{isTypedSchema as Zr}from"./packem_shared/isTypedSchema-CKzc3ioR.mjs";const e="0.0.0";export{v as AGENTS_FILENAME,T as CONTAINERS_FILENAME,E as CodegenDiagnosticError,Ke as DEFAULT_TARGET,I as FLAGS_FILENAME,Fr as GENERATED_HEADER,nr as LUNORA_ERROR_CODES,Pr as LUNORA_SOLUTION_RULES,Q as MUTATORS_FILENAME,X as NOTIFY_FILENAME,ye as OPENRPC_VERSION,Ur as PROJECT_CONFIG_FILENAMES,ae as QUEUES_FILENAME,Xe as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Sr as SDK_LANGUAGES,Er as SDK_TARGETS,ge as SHAPES_FILENAME,tr as SchemaSnapshotParseError,e as VERSION,Te as WORKFLOWS_FILENAME,Ge as buildOpenApiDocument,je as buildOpenRpcDocument,sr as buildSchemaSnapshot,Ze as createCodegenProject,c as describeErrorLevelFindings,u as diagnosticAt,s as diffSchemaSnapshots,N as discoverAgents,R as discoverAuthApiCalls,_ as discoverContainers,L as discoverCrons,P as discoverFlags,G as discoverFunctions,b as discoverHttpRoutes,y as discoverHyperdriveCalls,k as discoverInserts,B as discoverMaskProcedures,V as discoverMigrations,q as discoverMutators,J as discoverNondeterministicCalls,Z as discoverNotifyCalls,$ as discoverNotifyConfig,te as discoverQueries,ie as discoverQueues,fe as discoverR2sqlCalls,ne as discoverRlsMetadata,pe as discoverRlsProcedures,xe as discoverSandboxUsage,Ee as discoverSchema,Ce as discoverShapes,Re as discoverStorageRulesMetadata,_e as discoverWorkflows,yr as emitAgents,Br as emitApi,Le as emitApp,Kr as emitCollections,jr as emitContainers,zr as emitCrons,Yr as emitDataModel,Cr as emitDrizzleSchema,Rr as emitFunctions,Ue as emitOpenApi,be as emitOpenApiModule,ke as emitOpenRpc,We as emitOpenRpcModule,Qr as emitScheduler,Tr as emitServer,hr as emitShard,qr as emitVectors,kr as emitWorkflows,wr as emitWranglerCronTriggers,n as errorAdvisoryNames,l as errorPlatformDiagnosticNames,ar as evaluateSchemaDrift,Dr as findLunoraSolution,br as findProjectConfigFile,$e as findTsconfig,fr as fingerprintSchemaSources,m as formatAdvisories,ur as generateSdk,Ie as isD1GlobalTable,Pe as isHyperdriveGlobalTable,Zr as isTypedSchema,f as lintSchema,C as listLunoraSourceFiles,we as loadProjectConfig,ir as parseSchemaSnapshot,Ve as platformMatrixIds,re as readPackageDependencies,Je as readProjectConfigLiterals,ze as readProjectTarget,Ae as readServiceBindings,vr as redact,er as refreshCodegenProject,Qe as resolveCodegenTarget,ve as resolveServiceBindings,rr as runCodegen,pr as schemaFromIr,Nr as secretKindOf,a as serializeSchemaSnapshot,x as sortedUniqueNames,d as toAdvisorContext,lr as validatorIrToJsonSchema};
@@ -0,0 +1 @@
1
+ import{NODE_CAPABILITIES as f,CLOUDFLARE_CAPABILITIES as h,CELLD_CAPABILITIES as v}from"@lunora/platform";import{readProjectConfigLiterals as g}from"./loadProjectConfig-6Zk3abcc.mjs";const c="cloudflare",b=t=>{const{target:e}=g(t);return e!==void 0&&e.length>0?e:void 0},L=(t,e)=>e??b(t)??c,x=(t,e)=>{if(e!==void 0)return[];const{target:a,unreadable:r}=g(t);return r!==!0||a!==void 0?[]:[{level:"warn",message:`lunora.config declares a \`target\` that codegen cannot read without evaluating it, so the "${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={celld:v,cloudflare:h,node:f},C=()=>Object.keys(u).toSorted((t,e)=>t.localeCompare(e)),w={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},S=["agents","commitOrderedTables","containerEgressPolicy","containerRuntimeScheduling","cronTriggers","crossShardFanout","durableStreams","globalTables","queues","relationGraph","secrets","services","topics","vectorStore","workerLoaders","workflowRollback","workflowSchedules"],m={agents:"durable agents (`defineAgent`)",commitOrderedTables:"commit-ordered tables (`.commitOrdered()`)",containerEgressPolicy:"container egress policies (`defineContainer({ allowedHosts | deniedHosts | interceptHttps })`)",containerRuntimeScheduling:'per-instance container images and snapshots (`defineContainer({ schedulingPolicy: "durable_object" })`)',cronTriggers:"declared cron triggers (`cronJobs()`)",crossShardFanout:"cross-shard fan-out queries (a `.shardBy(...)` schema)",durableStreams:"durable streams (`.stream(handler, { durable: true })`)",globalTables:"global tables (`.global()`)",queues:"queues (`defineQueue`)",relationGraph:"relation-graph traversal (`ctx.db.related`, derived from `v.id(...)` columns)",secrets:"the secrets store (`ctx.secrets`)",services:"service bindings to sibling Workers (`lunora.config` `services`)",topics:"pub/sub topics (`defineTopic` / `defineSubscription`)",vectorStore:"vector indexes (`.vectorize()`)",workerLoaders:"sandboxed agent scripts (`jsCodeTool`, on Worker Loaders)",workflowRollback:"workflow step rollback (`defineStep({ rollback })`)",workflowSchedules:"scheduled workflow instances (`defineWorkflow({ schedules })`)"},y=(t,e,a)=>({level:"error",message:`${e.name} does not support ${m[t]}, which this app declares.`,name:"platform_unsupported_feature",remediation:`Remove the declaration, or deploy to a target whose capability matrix marks "${t}" as native or emulated.`,target:a}),T=(t,e,a)=>({level:"error",message:`${e.name}'s capability matrix does not declare a support level for ${m[t]}, which this app declares. Treated as unsupported.`,name:"platform_undeclared_feature",remediation:`Rate "${t}" in the ${e.name} capability matrix as "native", "emulated", or "unsupported" — an undeclared feature fails closed rather than letting the app deploy onto a primitive the host may not provide.`,target:a}),k=t=>{const{diagnostics:e,gatedSignals:a,matrix:r,reported:n,signals:d,target:i}=t;for(const s of S){if(d[s]!==!0)continue;const o=r.features[s]?.level;o!=="unsupported"&&o!==void 0||(a[s]=!1,!n.has(s)&&e.push(o==="unsupported"?y(s,r,i):T(s,r,i)))}},_=(t,e,a,r={})=>{const n={...t},d={...r},i=[],s=new Set;for(const[o,l]of Object.entries(w)){if(l===null||!t[o])continue;const p=e.features[l]?.level;p==="unsupported"?(n[o]=!1,s.add(l),i.push({feature:o,level:"error",message:`${e.name} does not support "${o}" (ctx.${o}).`,name:"platform_unsupported_feature",remediation:`Remove the ctx.${o} usage, or deploy to a target whose capability matrix marks "${l}" as native or emulated.`,target:a})):p===void 0&&(n[o]=!1,s.add(l),i.push({feature:o,level:"error",message:`${e.name}'s capability matrix does not declare a support level for "${o}" (ctx.${o}). Treated as unsupported.`,name:"platform_undeclared_feature",remediation:`Rate "${l}" in the ${e.name} capability matrix as "native", "emulated", or "unsupported" — an undeclared feature fails closed rather than shipping a surface the host may not provide.`,target:a}))}return k({diagnostics:i,gatedSignals:d,matrix:e,reported:s,signals:r,target:a}),{diagnostics:i,signals:d,usage:n}},E=(t,e,a={})=>{const r=u[e];return r===void 0?{diagnostics:[{level:"error",message:`Unknown deploy target "${e}" — no capability matrix is registered for it. Codegen emitted the full Cloudflare surface un-gated.`,name:"platform_unknown_target",remediation:`Use a registered target (${Object.keys(u).join(", ")}) or install the target's @lunora/platform-${e} package.`,target:e}],signals:{...a},usage:{...t}}:_(t,r,e,a)},I=t=>{const e=u[t];if(e===void 0)return;const a=Object.entries(e.features).filter(([,r])=>r.level==="unsupported").map(([r])=>r).toSorted((r,n)=>r.localeCompare(n));return{id:e.id,name:e.name,unsupported:a}};export{w as CAPABILITY_TO_FEATURE,c as DEFAULT_TARGET,_ as gateAgainstMatrix,E as gatePlatformFeatures,C as platformMatrixIds,b as readProjectTarget,x as readTargetDiagnostics,L as resolveCodegenTarget,I as studioPlatformFor};