@lunora/codegen 1.0.0-alpha.312 → 1.0.0-alpha.313

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
@@ -5,8 +5,9 @@ import { LunoraError } from '@lunora/errors';
5
5
  export { MESSAGE_SOLUTIONS as LUNORA_SOLUTION_RULES, type Solution as LunoraSolution, type SolutionRule as LunoraSolutionRule, findSolutionByMessage as findLunoraSolution } from '@lunora/errors';
6
6
  import { Schema } from '@lunora/server';
7
7
  import { JsonSchema } from '@lunora/values';
8
- import { LanguageName } from 'quicktype-core';
8
+ export { type OpenRpcDocument, type OpenRpcMethod, type RuntimeVerb, SDK_LANGUAGES, SDK_TARGETS, type SdkFiles, type SdkMethod, type SdkNamespace, type SdkRenderInput, type SdkResult, type SdkTarget, generateSdk, isTypedSchema } from "./sdk/index.mjs";
9
9
  import { StudioFeaturesResult } from '@lunora/shard-engine';
10
+ import 'quicktype-core';
10
11
  /**
11
12
  * The architecture manifest — `_generated/architecture.json` — shared by the
12
13
  * codegen that builds it, the runtime that serves it at
@@ -4604,295 +4605,9 @@ declare const validatorIrToJsonSchema: (validator: ValidatorIR) => JsonSchema;
4604
4605
  * the contract; clients switch on `error.code`. Kept sorted for stable output.
4605
4606
  */
4606
4607
  declare const LUNORA_ERROR_CODES: ReadonlyArray<string>;
4607
- /**
4608
- * Language-agnostic half of SDK generation: turn an OpenRPC document
4609
- * (`_generated/openrpc.json`, see {@link file://../openrpc.ts}) into the parsed
4610
- * shape every per-language target renders from.
4611
- *
4612
- * Nothing here knows about a target language. A target supplies its own member
4613
- * naming and templates (see {@link file://./targets}); everything that would
4614
- * otherwise be re-derived per language — how a `functionPath` splits, which
4615
- * runtime verb a kind maps to, whether a schema is real or the untyped
4616
- * placeholder, how namespaces group and sort — lives here exactly once.
4617
- *
4618
- * That single-source rule is not stylistic. `paths.ts` documents the same
4619
- * discipline for namespaces ("if these ever disagree, runtime dispatch silently
4620
- * misses functions"), and the failure mode here is the same in a new costume: a
4621
- * target that re-derives a model name renders an import pointing at a class
4622
- * quicktype never emitted.
4623
- *
4624
- * Deriving names in one place is necessary but NOT sufficient, because only
4625
- * half the decision is ours: quicktype chooses whether a predicted name becomes
4626
- * a declared type, and different backends answer differently for the same
4627
- * schema. {@link withDeclaredModels} reconciles the two halves before a target
4628
- * renders anything.
4629
- */
4630
- /** One OpenRPC method as {@link file://../openrpc.ts} emits it. */
4631
- interface OpenRpcMethod {
4632
- name: string;
4633
- params?: ReadonlyArray<{
4634
- name: string;
4635
- schema?: Record<string, unknown>;
4636
- }>;
4637
- result?: {
4638
- name: string;
4639
- schema?: Record<string, unknown>;
4640
- };
4641
- summary?: string;
4642
- "x-lunora-function-kind"?: string;
4643
- }
4644
- /** The `_generated/openrpc.json` document. */
4645
- interface OpenRpcDocument {
4646
- info?: {
4647
- title?: string;
4648
- version?: string;
4649
- };
4650
- methods: ReadonlyArray<OpenRpcMethod>;
4651
- }
4652
- /** The runtime verbs a generated SDK can call. Mirrors the client transports. */
4653
- type RuntimeVerb = "action" | "mutation" | "query";
4654
- /** One RPC function, parsed and language-neutral. */
4655
- interface SdkMethod {
4656
- /**
4657
- * Where this function's ARGUMENT nulls mean "unset" and where they mean
4658
- * "null" — see {@link ModelNullPaths}.
4659
- *
4660
- * On the method rather than on a shared render input because it is a
4661
- * per-method fact and the parser already holds the schema it comes from. Read
4662
- * by the three targets whose rendered models cannot tell the two apart
4663
- * (ruby, rust, swift); the other five have a marker of their own and ignore
4664
- * it.
4665
- */
4666
- argsNullPaths: ModelNullPaths;
4667
- /**
4668
- * Generated args model name, or `undefined` when NO model could be named for
4669
- * this function's arguments.
4670
- *
4671
- * `undefined` does NOT mean "takes no arguments" — see {@link SdkMethod.takesArgs}.
4672
- * A schema carrying a `v.bigint()` or `v.bytes()` gets no model deliberately
4673
- * (`hasUnrepresentableWireType`), and a backend that cannot name a shape leaves
4674
- * it undeclared. Both still take arguments, just untyped ones.
4675
- */
4676
- argsType: string | undefined;
4677
- /** Raw exported function name (`"list"`), before any naming convention. */
4678
- functionName: string;
4679
- /** The wire identifier (`"messages:list"`), emitted verbatim into calls. */
4680
- functionPath: string;
4681
- /** Raw file namespace (`"messages"`), before any naming convention. */
4682
- namespace: string;
4683
- /** Generated result model name, or `undefined` while the result is untyped. */
4684
- resultType: string | undefined;
4685
- /** Human summary for the doc comment. */
4686
- summary: string;
4687
- /**
4688
- * Whether this function declares arguments at all, independent of whether a
4689
- * model could be named for them.
4690
- *
4691
- * A target emits three shapes from this: a TYPED parameter when `argsType` is
4692
- * set, an UNTYPED wire-shaped parameter when it is not but this is true, and no
4693
- * parameter at all when this is false. Collapsing the middle case into the last
4694
- * is what made `v.bigint()` functions uncallable with arguments.
4695
- */
4696
- takesArgs: boolean;
4697
- /** Which runtime verb this dispatches to. */
4698
- verb: RuntimeVerb;
4699
- }
4700
- /** One namespace's functions, sorted. */
4701
- interface SdkNamespace {
4702
- methods: ReadonlyArray<SdkMethod>;
4703
- /** Raw namespace (`"messages"`); a target applies its own casing. */
4704
- name: string;
4705
- }
4706
- /**
4707
- * True when a schema actually describes a shape.
4708
- *
4709
- * `openrpc.ts` emits a description-only placeholder for any function without a
4710
- * declared `.output()` (the return type is TS-inferred and absent from the IR).
4711
- * A placeholder must never become a generated model: quicktype would render an
4712
- * empty type, and the surface would decode every response into it — silently
4713
- * discarding the real payload rather than leaving it untyped.
4714
- */
4715
- declare const isTypedSchema: (schema: Record<string, unknown> | undefined) => boolean;
4716
- /**
4717
- * A path from a model's root to one property. `*` stands for every element of an
4718
- * array or every value of a record, neither of which has named positions.
4719
- */
4720
- type SchemaPath = ReadonlyArray<string>;
4721
- /**
4722
- * Where a model's nulls mean different things — the one fact a generated model
4723
- * flattens away, and the reason three ports could not send a `v.nullable()`
4724
- * argument at all.
4725
- *
4726
- * An unset `v.optional()` and a `v.nullable()` set to null are the SAME value in
4727
- * every generated model (a nil field), and opposite things on the wire: the
4728
- * validator rejects an explicit null for the first and requires the key present
4729
- * for the second. Neither Ruby, Rust nor Swift renders a marker telling them
4730
- * apart, so the distinction is computed here, from the schema, where `required`
4731
- * still exists — and handed to the targets that need it.
4732
- *
4733
- * Two lists rather than one because the ports need opposite operations. Ruby and
4734
- * Rust project a whole value tree and prune nulls, so they prune at
4735
- * {@link ModelNullPaths.optional} and nowhere else — which also stops them
4736
- * dropping a legitimate null inside a record or an array, as a blanket prune
4737
- * does. Swift's `JSONEncoder` has already dropped every struct-property nil
4738
- * before the transport sees a tree, so it restores nulls at
4739
- * {@link ModelNullPaths.nullable} instead: an absent key at a required path can
4740
- * only have been a nil, so putting the null back is exact.
4741
- *
4742
- * A `$ref` is NOT resolved. `openrpc.ts` inlines everything it emits, so this
4743
- * never comes up for a generated document — but `--spec` accepts a hand-written
4744
- * one, and there a `$ref`'d sub-object contributes no paths at all: the ports
4745
- * that prune would send its unset optionals as null, and Swift would not restore
4746
- * its nullables. Inline the schema, or teach this to follow the pointer.
4747
- *
4748
- * Both lists name PROPERTIES only. A record's values and an array's elements can
4749
- * be null too, but no port drops one: the pruning ports prune at `optional`
4750
- * paths, which a `*` position can never be, and `JSONEncoder` drops a nil only
4751
- * from a struct property — a nil inside a dictionary or array encodes as null.
4752
- * Listing a `*` leaf would also make Swift's restore INVENT record keys that
4753
- * were never there, which is why the walk records the path it descends through
4754
- * but never the `*` position itself.
4755
- */
4756
- interface ModelNullPaths {
4757
- /** Required properties that permit null — a null there is a VALUE and must survive. */
4758
- nullable: ReadonlyArray<SchemaPath>;
4759
- /** Properties absent from their object's `required` — a null there means UNSET. */
4760
- optional: ReadonlyArray<SchemaPath>;
4761
- }
4762
- /** What a target renders from. */
4763
- interface SdkRenderInput {
4764
- /**
4765
- * The rendered model source, to be written as the target's model file.
4766
- *
4767
- * Empty for a target that emits its own model FILES via
4768
- * {@link SdkTarget.renderModels} — those are already written, and this string
4769
- * exists only so the declared-model reconciliation reads one shape.
4770
- */
4771
- models: string;
4772
- /** Namespaces and their functions, already sorted. */
4773
- namespaces: ReadonlyArray<SdkNamespace>;
4774
- }
4775
- /**
4776
- * One directory or file of the hand-written transport, and where it lands in the
4777
- * output.
4778
- *
4779
- * `from` is relative to `sdks/<target id>/` and `to` is relative to `--out`. The
4780
- * two differ because a repo layout and a consumable layout are not the same
4781
- * shape: the Ruby transport lives under `lib/` so `ruby -Ilib` works in the
4782
- * repo, while a vendored copy has no `lib` to point at, and the Rust transport
4783
- * is the repo's root crate but a nested one in the output.
4784
- *
4785
- * Only the runtime is listed. A transport's own conformance suite and its
4786
- * `generated_check/` sample are deliberately absent — they assert against
4787
- * `protocol/fixtures/`, which is not copied, so vendoring them would ship a user
4788
- * a test suite that cannot run.
4789
- */
4790
- interface SdkVendorEntry {
4791
- /** Path under `sdks/<id>/`. A directory is copied recursively. */
4792
- from: string;
4793
- /** Destination path under `--out`. */
4794
- to: string;
4795
- }
4796
- /** A language target. One per `--lang` value. */
4797
- interface SdkTarget {
4798
- /** The `--lang` value (`"python"`, `"go"`, …). */
4799
- id: string;
4800
- /**
4801
- * The quicktype backend + renderer options that produce this target's
4802
- * models, or absent when the target emits its own (see
4803
- * {@link SdkTarget.renderModels}) or none at all.
4804
- *
4805
- * `LanguageName` is quicktype's own union, so a target naming a backend
4806
- * quicktype does not ship fails to compile rather than at run time.
4807
- */
4808
- quicktype?: {
4809
- lang: LanguageName;
4810
- rendererOptions?: Record<string, string>;
4811
- };
4812
- /**
4813
- * Render the SDK. Returns file contents keyed by path relative to the
4814
- * output directory (nested paths are created as needed).
4815
- *
4816
- * This includes the BUILD MANIFEST the layout needs — `go.mod`, `Cargo.toml`,
4817
- * `Package.swift`, a crate root — because those name the vendored transport
4818
- * and are therefore part of "how this language resolves the copy", not
4819
- * something a consumer should have to write. Languages that resolve by
4820
- * directory (Python, Ruby, Java, Kotlin) emit no manifest.
4821
- */
4822
- render: (input: SdkRenderInput) => Record<string, string>;
4823
- /**
4824
- * Emit this target's models from the schema directly, INSTEAD of quicktype,
4825
- * as file contents keyed by path relative to the output directory.
4826
- *
4827
- * Present only for the two JVM targets, and the exception is earned rather
4828
- * than a preference: quicktype's Java and Kotlin backends rename properties
4829
- * and, under `just-types`, emit no mapping metadata, so a model they render
4830
- * cannot be projected back onto the wire — and the only complete mapping
4831
- * they offer requires a Jackson / Klaxon / kotlinx dependency, which is the
4832
- * one thing these JDK-only transports are defined not to have.
4833
- * `targets/java.ts` records every option that was measured.
4834
- *
4835
- * A MAP rather than the single string quicktype returns, because Java takes
4836
- * one file per class: its single-file render is not compilable Java at all.
4837
- * The values are still joined for {@link SdkRenderInput.models}, so the
4838
- * declared-model reconciliation is the same code for every target.
4839
- */
4840
- renderModels?: (document: OpenRpcDocument) => Record<string, string>;
4841
- /**
4842
- * THIRD-PARTY packages a consuming project must still install, reported by
4843
- * the CLI. Empty for six of the eight — the transport is vendored and those
4844
- * six reach the wire with only their standard library.
4845
- *
4846
- * A list, and not derivable from the transport, because a target's MODELS can
4847
- * carry a dependency the transport does not: quicktype's Ruby backend emits
4848
- * `Dry::Struct` types with no renderer option to avoid them, so a Ruby SDK
4849
- * needs the gems even though `sdks/ruby` itself is dependency-free.
4850
- */
4851
- requires: ReadonlyArray<string>;
4852
- /**
4853
- * Which parts of `sdks/<id>/` are the transport, and where they land under
4854
- * `--out`. See {@link SdkVendorEntry}.
4855
- */
4856
- vendor: ReadonlyArray<SdkVendorEntry>;
4857
- }
4858
- /** Every language `lunora sdk generate --lang` accepts, keyed by id. */
4859
- declare const SDK_TARGETS: Readonly<Record<string, SdkTarget>>;
4860
- /** The accepted `--lang` values, sorted — for help text and error messages. */
4861
- declare const SDK_LANGUAGES: ReadonlyArray<string>;
4862
- /** The files a generation run writes, keyed by path relative to the output directory. */
4863
- type SdkFiles = Record<string, string>;
4864
- /** What a generation run produced, plus what it had to weaken and why. */
4865
- interface SdkResult {
4866
- files: SdkFiles;
4867
- /**
4868
- * Model names predicted from the schema that the chosen backend did not
4869
- * declare, so their call sites fell back to an untyped return. Surfaced
4870
- * rather than swallowed — silently weaker types are how an SDK looks
4871
- * finished while returning `Any` everywhere.
4872
- */
4873
- undeclared: ReadonlyArray<string>;
4874
- /**
4875
- * Functions whose args or result carry a `v.bigint()` or `v.bytes()`. No
4876
- * typed model can represent those — the wire needs a tagged value that no
4877
- * generated field produces — so their parameters stay untyped and the
4878
- * caller passes wire values directly.
4879
- */
4880
- unrepresentable: ReadonlyArray<string>;
4881
- }
4882
- /**
4883
- * Generate the SDK for `document` in `target`'s language.
4884
- *
4885
- * Async only because the model layer is: quicktype's renderer is promise-based.
4886
- * The surface itself is pure, so a target's `render` stays synchronous and
4887
- * unit-testable without touching quicktype.
4888
- *
4889
- * Models are rendered BEFORE the surface because the surface's model references
4890
- * depend on what the backend actually declared — see {@link withDeclaredModels}.
4891
- */
4892
- declare const generateSdk: (document: OpenRpcDocument, target: SdkTarget) => Promise<SdkResult>;
4893
4608
  /** The matching secret rule's `kind` for a string value, or `undefined` when none matches. */
4894
4609
  declare const secretKindOf: (value: string) => string | undefined;
4895
4610
  /** A redacted preview of a secret value — first 4 chars plus its length, never the full value. */
4896
4611
  declare const redact: (value: string) => string;
4897
4612
  declare const VERSION = "0.0.0";
4898
- export { AGENTS_FILENAME, type AgentIR, type ArchitectureManifest, type AuthApiCallIR, CAPABILITY_PROBES, CONTAINERS_FILENAME, type CapabilityKey, type CapabilityProbe, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContainerImageIR, type ContainerNamedImageIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DefaultScheduledContainerIR, type DriftChange, type DriftRemediation, type DriftScope, type DurableObjectScheduledContainerIR, type EmitAppOptions, FLAGS_FILENAME, type FieldSnapshot, type FlagsIR, type FunctionIR, GENERATED_HEADER, type HttpRouteIR, type IndexIR, type IndexSnapshot, type InsertWriteIR, LUNORA_ERROR_CODES, type LintSchemaOptions, type LoadedProjectConfig, type LunoraProjectConfig, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, NOTIFY_FILENAME, type NotifyChannels, OPENRPC_VERSION, type OpenApiEmitInput, type 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 SourceCapabilitySignals, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, type TopicIR, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerQueueProducerIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, capabilitiesUsedBy, createCodegenProject, describeErrorLevelFindings, diagnosticAt, diffSchemaSnapshots, discoverAgents, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverHyperdriveCalls, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverNotifyCalls, discoverNotifyChannels, discoverNotifyConfig, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSandboxUsage, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitAgents, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitInternalApi, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitScheduler, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, errorAdvisoryNames, errorPlatformDiagnosticNames, evaluateSchemaDrift, findProjectConfigFile, findTsconfig, fingerprintSchemaSources, foldCapabilitySignals, formatAdvisories, generateSdk, isD1GlobalTable, isHyperdriveGlobalTable, isTestPath, isTypedSchema, lintSchema, listLunoraSourceFiles, loadProjectConfig, mayReadCapabilityContext, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectConfigLiterals, readProjectTarget, readServiceBindings, redact, refreshCodegenProject, resolveCodegenTarget, resolveServiceBindings, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, sortedUniqueNames, sourceCapabilitySignals, toAdvisorContext, validatorIrToJsonSchema };
4613
+ export { AGENTS_FILENAME, type AgentIR, type ArchitectureManifest, type AuthApiCallIR, CAPABILITY_PROBES, CONTAINERS_FILENAME, type CapabilityKey, type CapabilityProbe, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContainerImageIR, type ContainerNamedImageIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DefaultScheduledContainerIR, type DriftChange, type DriftRemediation, type DriftScope, type DurableObjectScheduledContainerIR, type EmitAppOptions, FLAGS_FILENAME, type FieldSnapshot, type FlagsIR, type FunctionIR, GENERATED_HEADER, type HttpRouteIR, type IndexIR, type IndexSnapshot, type InsertWriteIR, LUNORA_ERROR_CODES, type LintSchemaOptions, type LoadedProjectConfig, type LunoraProjectConfig, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, NOTIFY_FILENAME, type NotifyChannels, OPENRPC_VERSION, type OpenApiEmitInput, type OpenRpcEmitInput, PROJECT_CONFIG_FILENAMES, type PlatformDiagnostic, type ProjectConfigLiterals, type ProjectIR, QUEUES_FILENAME, type QueryReadIR, type QueueIR, type RelationSnapshot, type RlsMetadataIR, type RlsPolicyIR, type RlsProcedureIR, type RlsRoleIR, SCHEMA_SNAPSHOT_FILENAME, SCHEMA_SNAPSHOT_VERSION, SHAPES_FILENAME, type SandboxUsage, type SchemaDrift, type SchemaDriftDecision, type SchemaIR, type SchemaSnapshot, SchemaSnapshotParseError, type ServiceBindingIR, type ServiceLiteral, type ShapeIR, type SourceCapabilitySignals, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, type TopicIR, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerQueueProducerIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, capabilitiesUsedBy, createCodegenProject, describeErrorLevelFindings, diagnosticAt, diffSchemaSnapshots, discoverAgents, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverHyperdriveCalls, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverNotifyCalls, discoverNotifyChannels, discoverNotifyConfig, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSandboxUsage, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitAgents, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitInternalApi, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitScheduler, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, errorAdvisoryNames, errorPlatformDiagnosticNames, evaluateSchemaDrift, findProjectConfigFile, findTsconfig, fingerprintSchemaSources, foldCapabilitySignals, formatAdvisories, isD1GlobalTable, isHyperdriveGlobalTable, isTestPath, lintSchema, listLunoraSourceFiles, loadProjectConfig, mayReadCapabilityContext, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectConfigLiterals, readProjectTarget, readServiceBindings, redact, refreshCodegenProject, resolveCodegenTarget, resolveServiceBindings, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, sortedUniqueNames, sourceCapabilitySignals, toAdvisorContext, validatorIrToJsonSchema };
package/dist/index.d.ts CHANGED
@@ -5,8 +5,9 @@ import { LunoraError } from '@lunora/errors';
5
5
  export { MESSAGE_SOLUTIONS as LUNORA_SOLUTION_RULES, type Solution as LunoraSolution, type SolutionRule as LunoraSolutionRule, findSolutionByMessage as findLunoraSolution } from '@lunora/errors';
6
6
  import { Schema } from '@lunora/server';
7
7
  import { JsonSchema } from '@lunora/values';
8
- import { LanguageName } from 'quicktype-core';
8
+ export { type OpenRpcDocument, type OpenRpcMethod, type RuntimeVerb, SDK_LANGUAGES, SDK_TARGETS, type SdkFiles, type SdkMethod, type SdkNamespace, type SdkRenderInput, type SdkResult, type SdkTarget, generateSdk, isTypedSchema } from "./sdk/index.js";
9
9
  import { StudioFeaturesResult } from '@lunora/shard-engine';
10
+ import 'quicktype-core';
10
11
  /**
11
12
  * The architecture manifest — `_generated/architecture.json` — shared by the
12
13
  * codegen that builds it, the runtime that serves it at
@@ -4604,295 +4605,9 @@ declare const validatorIrToJsonSchema: (validator: ValidatorIR) => JsonSchema;
4604
4605
  * the contract; clients switch on `error.code`. Kept sorted for stable output.
4605
4606
  */
4606
4607
  declare const LUNORA_ERROR_CODES: ReadonlyArray<string>;
4607
- /**
4608
- * Language-agnostic half of SDK generation: turn an OpenRPC document
4609
- * (`_generated/openrpc.json`, see {@link file://../openrpc.ts}) into the parsed
4610
- * shape every per-language target renders from.
4611
- *
4612
- * Nothing here knows about a target language. A target supplies its own member
4613
- * naming and templates (see {@link file://./targets}); everything that would
4614
- * otherwise be re-derived per language — how a `functionPath` splits, which
4615
- * runtime verb a kind maps to, whether a schema is real or the untyped
4616
- * placeholder, how namespaces group and sort — lives here exactly once.
4617
- *
4618
- * That single-source rule is not stylistic. `paths.ts` documents the same
4619
- * discipline for namespaces ("if these ever disagree, runtime dispatch silently
4620
- * misses functions"), and the failure mode here is the same in a new costume: a
4621
- * target that re-derives a model name renders an import pointing at a class
4622
- * quicktype never emitted.
4623
- *
4624
- * Deriving names in one place is necessary but NOT sufficient, because only
4625
- * half the decision is ours: quicktype chooses whether a predicted name becomes
4626
- * a declared type, and different backends answer differently for the same
4627
- * schema. {@link withDeclaredModels} reconciles the two halves before a target
4628
- * renders anything.
4629
- */
4630
- /** One OpenRPC method as {@link file://../openrpc.ts} emits it. */
4631
- interface OpenRpcMethod {
4632
- name: string;
4633
- params?: ReadonlyArray<{
4634
- name: string;
4635
- schema?: Record<string, unknown>;
4636
- }>;
4637
- result?: {
4638
- name: string;
4639
- schema?: Record<string, unknown>;
4640
- };
4641
- summary?: string;
4642
- "x-lunora-function-kind"?: string;
4643
- }
4644
- /** The `_generated/openrpc.json` document. */
4645
- interface OpenRpcDocument {
4646
- info?: {
4647
- title?: string;
4648
- version?: string;
4649
- };
4650
- methods: ReadonlyArray<OpenRpcMethod>;
4651
- }
4652
- /** The runtime verbs a generated SDK can call. Mirrors the client transports. */
4653
- type RuntimeVerb = "action" | "mutation" | "query";
4654
- /** One RPC function, parsed and language-neutral. */
4655
- interface SdkMethod {
4656
- /**
4657
- * Where this function's ARGUMENT nulls mean "unset" and where they mean
4658
- * "null" — see {@link ModelNullPaths}.
4659
- *
4660
- * On the method rather than on a shared render input because it is a
4661
- * per-method fact and the parser already holds the schema it comes from. Read
4662
- * by the three targets whose rendered models cannot tell the two apart
4663
- * (ruby, rust, swift); the other five have a marker of their own and ignore
4664
- * it.
4665
- */
4666
- argsNullPaths: ModelNullPaths;
4667
- /**
4668
- * Generated args model name, or `undefined` when NO model could be named for
4669
- * this function's arguments.
4670
- *
4671
- * `undefined` does NOT mean "takes no arguments" — see {@link SdkMethod.takesArgs}.
4672
- * A schema carrying a `v.bigint()` or `v.bytes()` gets no model deliberately
4673
- * (`hasUnrepresentableWireType`), and a backend that cannot name a shape leaves
4674
- * it undeclared. Both still take arguments, just untyped ones.
4675
- */
4676
- argsType: string | undefined;
4677
- /** Raw exported function name (`"list"`), before any naming convention. */
4678
- functionName: string;
4679
- /** The wire identifier (`"messages:list"`), emitted verbatim into calls. */
4680
- functionPath: string;
4681
- /** Raw file namespace (`"messages"`), before any naming convention. */
4682
- namespace: string;
4683
- /** Generated result model name, or `undefined` while the result is untyped. */
4684
- resultType: string | undefined;
4685
- /** Human summary for the doc comment. */
4686
- summary: string;
4687
- /**
4688
- * Whether this function declares arguments at all, independent of whether a
4689
- * model could be named for them.
4690
- *
4691
- * A target emits three shapes from this: a TYPED parameter when `argsType` is
4692
- * set, an UNTYPED wire-shaped parameter when it is not but this is true, and no
4693
- * parameter at all when this is false. Collapsing the middle case into the last
4694
- * is what made `v.bigint()` functions uncallable with arguments.
4695
- */
4696
- takesArgs: boolean;
4697
- /** Which runtime verb this dispatches to. */
4698
- verb: RuntimeVerb;
4699
- }
4700
- /** One namespace's functions, sorted. */
4701
- interface SdkNamespace {
4702
- methods: ReadonlyArray<SdkMethod>;
4703
- /** Raw namespace (`"messages"`); a target applies its own casing. */
4704
- name: string;
4705
- }
4706
- /**
4707
- * True when a schema actually describes a shape.
4708
- *
4709
- * `openrpc.ts` emits a description-only placeholder for any function without a
4710
- * declared `.output()` (the return type is TS-inferred and absent from the IR).
4711
- * A placeholder must never become a generated model: quicktype would render an
4712
- * empty type, and the surface would decode every response into it — silently
4713
- * discarding the real payload rather than leaving it untyped.
4714
- */
4715
- declare const isTypedSchema: (schema: Record<string, unknown> | undefined) => boolean;
4716
- /**
4717
- * A path from a model's root to one property. `*` stands for every element of an
4718
- * array or every value of a record, neither of which has named positions.
4719
- */
4720
- type SchemaPath = ReadonlyArray<string>;
4721
- /**
4722
- * Where a model's nulls mean different things — the one fact a generated model
4723
- * flattens away, and the reason three ports could not send a `v.nullable()`
4724
- * argument at all.
4725
- *
4726
- * An unset `v.optional()` and a `v.nullable()` set to null are the SAME value in
4727
- * every generated model (a nil field), and opposite things on the wire: the
4728
- * validator rejects an explicit null for the first and requires the key present
4729
- * for the second. Neither Ruby, Rust nor Swift renders a marker telling them
4730
- * apart, so the distinction is computed here, from the schema, where `required`
4731
- * still exists — and handed to the targets that need it.
4732
- *
4733
- * Two lists rather than one because the ports need opposite operations. Ruby and
4734
- * Rust project a whole value tree and prune nulls, so they prune at
4735
- * {@link ModelNullPaths.optional} and nowhere else — which also stops them
4736
- * dropping a legitimate null inside a record or an array, as a blanket prune
4737
- * does. Swift's `JSONEncoder` has already dropped every struct-property nil
4738
- * before the transport sees a tree, so it restores nulls at
4739
- * {@link ModelNullPaths.nullable} instead: an absent key at a required path can
4740
- * only have been a nil, so putting the null back is exact.
4741
- *
4742
- * A `$ref` is NOT resolved. `openrpc.ts` inlines everything it emits, so this
4743
- * never comes up for a generated document — but `--spec` accepts a hand-written
4744
- * one, and there a `$ref`'d sub-object contributes no paths at all: the ports
4745
- * that prune would send its unset optionals as null, and Swift would not restore
4746
- * its nullables. Inline the schema, or teach this to follow the pointer.
4747
- *
4748
- * Both lists name PROPERTIES only. A record's values and an array's elements can
4749
- * be null too, but no port drops one: the pruning ports prune at `optional`
4750
- * paths, which a `*` position can never be, and `JSONEncoder` drops a nil only
4751
- * from a struct property — a nil inside a dictionary or array encodes as null.
4752
- * Listing a `*` leaf would also make Swift's restore INVENT record keys that
4753
- * were never there, which is why the walk records the path it descends through
4754
- * but never the `*` position itself.
4755
- */
4756
- interface ModelNullPaths {
4757
- /** Required properties that permit null — a null there is a VALUE and must survive. */
4758
- nullable: ReadonlyArray<SchemaPath>;
4759
- /** Properties absent from their object's `required` — a null there means UNSET. */
4760
- optional: ReadonlyArray<SchemaPath>;
4761
- }
4762
- /** What a target renders from. */
4763
- interface SdkRenderInput {
4764
- /**
4765
- * The rendered model source, to be written as the target's model file.
4766
- *
4767
- * Empty for a target that emits its own model FILES via
4768
- * {@link SdkTarget.renderModels} — those are already written, and this string
4769
- * exists only so the declared-model reconciliation reads one shape.
4770
- */
4771
- models: string;
4772
- /** Namespaces and their functions, already sorted. */
4773
- namespaces: ReadonlyArray<SdkNamespace>;
4774
- }
4775
- /**
4776
- * One directory or file of the hand-written transport, and where it lands in the
4777
- * output.
4778
- *
4779
- * `from` is relative to `sdks/<target id>/` and `to` is relative to `--out`. The
4780
- * two differ because a repo layout and a consumable layout are not the same
4781
- * shape: the Ruby transport lives under `lib/` so `ruby -Ilib` works in the
4782
- * repo, while a vendored copy has no `lib` to point at, and the Rust transport
4783
- * is the repo's root crate but a nested one in the output.
4784
- *
4785
- * Only the runtime is listed. A transport's own conformance suite and its
4786
- * `generated_check/` sample are deliberately absent — they assert against
4787
- * `protocol/fixtures/`, which is not copied, so vendoring them would ship a user
4788
- * a test suite that cannot run.
4789
- */
4790
- interface SdkVendorEntry {
4791
- /** Path under `sdks/<id>/`. A directory is copied recursively. */
4792
- from: string;
4793
- /** Destination path under `--out`. */
4794
- to: string;
4795
- }
4796
- /** A language target. One per `--lang` value. */
4797
- interface SdkTarget {
4798
- /** The `--lang` value (`"python"`, `"go"`, …). */
4799
- id: string;
4800
- /**
4801
- * The quicktype backend + renderer options that produce this target's
4802
- * models, or absent when the target emits its own (see
4803
- * {@link SdkTarget.renderModels}) or none at all.
4804
- *
4805
- * `LanguageName` is quicktype's own union, so a target naming a backend
4806
- * quicktype does not ship fails to compile rather than at run time.
4807
- */
4808
- quicktype?: {
4809
- lang: LanguageName;
4810
- rendererOptions?: Record<string, string>;
4811
- };
4812
- /**
4813
- * Render the SDK. Returns file contents keyed by path relative to the
4814
- * output directory (nested paths are created as needed).
4815
- *
4816
- * This includes the BUILD MANIFEST the layout needs — `go.mod`, `Cargo.toml`,
4817
- * `Package.swift`, a crate root — because those name the vendored transport
4818
- * and are therefore part of "how this language resolves the copy", not
4819
- * something a consumer should have to write. Languages that resolve by
4820
- * directory (Python, Ruby, Java, Kotlin) emit no manifest.
4821
- */
4822
- render: (input: SdkRenderInput) => Record<string, string>;
4823
- /**
4824
- * Emit this target's models from the schema directly, INSTEAD of quicktype,
4825
- * as file contents keyed by path relative to the output directory.
4826
- *
4827
- * Present only for the two JVM targets, and the exception is earned rather
4828
- * than a preference: quicktype's Java and Kotlin backends rename properties
4829
- * and, under `just-types`, emit no mapping metadata, so a model they render
4830
- * cannot be projected back onto the wire — and the only complete mapping
4831
- * they offer requires a Jackson / Klaxon / kotlinx dependency, which is the
4832
- * one thing these JDK-only transports are defined not to have.
4833
- * `targets/java.ts` records every option that was measured.
4834
- *
4835
- * A MAP rather than the single string quicktype returns, because Java takes
4836
- * one file per class: its single-file render is not compilable Java at all.
4837
- * The values are still joined for {@link SdkRenderInput.models}, so the
4838
- * declared-model reconciliation is the same code for every target.
4839
- */
4840
- renderModels?: (document: OpenRpcDocument) => Record<string, string>;
4841
- /**
4842
- * THIRD-PARTY packages a consuming project must still install, reported by
4843
- * the CLI. Empty for six of the eight — the transport is vendored and those
4844
- * six reach the wire with only their standard library.
4845
- *
4846
- * A list, and not derivable from the transport, because a target's MODELS can
4847
- * carry a dependency the transport does not: quicktype's Ruby backend emits
4848
- * `Dry::Struct` types with no renderer option to avoid them, so a Ruby SDK
4849
- * needs the gems even though `sdks/ruby` itself is dependency-free.
4850
- */
4851
- requires: ReadonlyArray<string>;
4852
- /**
4853
- * Which parts of `sdks/<id>/` are the transport, and where they land under
4854
- * `--out`. See {@link SdkVendorEntry}.
4855
- */
4856
- vendor: ReadonlyArray<SdkVendorEntry>;
4857
- }
4858
- /** Every language `lunora sdk generate --lang` accepts, keyed by id. */
4859
- declare const SDK_TARGETS: Readonly<Record<string, SdkTarget>>;
4860
- /** The accepted `--lang` values, sorted — for help text and error messages. */
4861
- declare const SDK_LANGUAGES: ReadonlyArray<string>;
4862
- /** The files a generation run writes, keyed by path relative to the output directory. */
4863
- type SdkFiles = Record<string, string>;
4864
- /** What a generation run produced, plus what it had to weaken and why. */
4865
- interface SdkResult {
4866
- files: SdkFiles;
4867
- /**
4868
- * Model names predicted from the schema that the chosen backend did not
4869
- * declare, so their call sites fell back to an untyped return. Surfaced
4870
- * rather than swallowed — silently weaker types are how an SDK looks
4871
- * finished while returning `Any` everywhere.
4872
- */
4873
- undeclared: ReadonlyArray<string>;
4874
- /**
4875
- * Functions whose args or result carry a `v.bigint()` or `v.bytes()`. No
4876
- * typed model can represent those — the wire needs a tagged value that no
4877
- * generated field produces — so their parameters stay untyped and the
4878
- * caller passes wire values directly.
4879
- */
4880
- unrepresentable: ReadonlyArray<string>;
4881
- }
4882
- /**
4883
- * Generate the SDK for `document` in `target`'s language.
4884
- *
4885
- * Async only because the model layer is: quicktype's renderer is promise-based.
4886
- * The surface itself is pure, so a target's `render` stays synchronous and
4887
- * unit-testable without touching quicktype.
4888
- *
4889
- * Models are rendered BEFORE the surface because the surface's model references
4890
- * depend on what the backend actually declared — see {@link withDeclaredModels}.
4891
- */
4892
- declare const generateSdk: (document: OpenRpcDocument, target: SdkTarget) => Promise<SdkResult>;
4893
4608
  /** The matching secret rule's `kind` for a string value, or `undefined` when none matches. */
4894
4609
  declare const secretKindOf: (value: string) => string | undefined;
4895
4610
  /** A redacted preview of a secret value — first 4 chars plus its length, never the full value. */
4896
4611
  declare const redact: (value: string) => string;
4897
4612
  declare const VERSION = "0.0.0";
4898
- export { AGENTS_FILENAME, type AgentIR, type ArchitectureManifest, type AuthApiCallIR, CAPABILITY_PROBES, CONTAINERS_FILENAME, type CapabilityKey, type CapabilityProbe, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContainerImageIR, type ContainerNamedImageIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DefaultScheduledContainerIR, type DriftChange, type DriftRemediation, type DriftScope, type DurableObjectScheduledContainerIR, type EmitAppOptions, FLAGS_FILENAME, type FieldSnapshot, type FlagsIR, type FunctionIR, GENERATED_HEADER, type HttpRouteIR, type IndexIR, type IndexSnapshot, type InsertWriteIR, LUNORA_ERROR_CODES, type LintSchemaOptions, type LoadedProjectConfig, type LunoraProjectConfig, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, NOTIFY_FILENAME, type NotifyChannels, OPENRPC_VERSION, type OpenApiEmitInput, type 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 SourceCapabilitySignals, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, type TopicIR, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerQueueProducerIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, capabilitiesUsedBy, createCodegenProject, describeErrorLevelFindings, diagnosticAt, diffSchemaSnapshots, discoverAgents, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverHyperdriveCalls, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverNotifyCalls, discoverNotifyChannels, discoverNotifyConfig, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSandboxUsage, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitAgents, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitInternalApi, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitScheduler, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, errorAdvisoryNames, errorPlatformDiagnosticNames, evaluateSchemaDrift, findProjectConfigFile, findTsconfig, fingerprintSchemaSources, foldCapabilitySignals, formatAdvisories, generateSdk, isD1GlobalTable, isHyperdriveGlobalTable, isTestPath, isTypedSchema, lintSchema, listLunoraSourceFiles, loadProjectConfig, mayReadCapabilityContext, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectConfigLiterals, readProjectTarget, readServiceBindings, redact, refreshCodegenProject, resolveCodegenTarget, resolveServiceBindings, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, sortedUniqueNames, sourceCapabilitySignals, toAdvisorContext, validatorIrToJsonSchema };
4613
+ export { AGENTS_FILENAME, type AgentIR, type ArchitectureManifest, type AuthApiCallIR, CAPABILITY_PROBES, CONTAINERS_FILENAME, type CapabilityKey, type CapabilityProbe, CodegenDiagnosticError, type CodegenOptions, type CodegenResult, type ContainerIR, type ContainerImageIR, type ContainerNamedImageIR, type ContextPropertyCallIR, type CronJobIR, DEFAULT_TARGET, type DefaultScheduledContainerIR, type DriftChange, type DriftRemediation, type DriftScope, type DurableObjectScheduledContainerIR, type EmitAppOptions, FLAGS_FILENAME, type FieldSnapshot, type FlagsIR, type FunctionIR, GENERATED_HEADER, type HttpRouteIR, type IndexIR, type IndexSnapshot, type InsertWriteIR, LUNORA_ERROR_CODES, type LintSchemaOptions, type LoadedProjectConfig, type LunoraProjectConfig, MUTATORS_FILENAME, type MaskProcedureIR, type MigrationIR, type MutatorIR, NOTIFY_FILENAME, type NotifyChannels, OPENRPC_VERSION, type OpenApiEmitInput, type OpenRpcEmitInput, PROJECT_CONFIG_FILENAMES, type PlatformDiagnostic, type ProjectConfigLiterals, type ProjectIR, QUEUES_FILENAME, type QueryReadIR, type QueueIR, type RelationSnapshot, type RlsMetadataIR, type RlsPolicyIR, type RlsProcedureIR, type RlsRoleIR, SCHEMA_SNAPSHOT_FILENAME, SCHEMA_SNAPSHOT_VERSION, SHAPES_FILENAME, type SandboxUsage, type SchemaDrift, type SchemaDriftDecision, type SchemaIR, type SchemaSnapshot, SchemaSnapshotParseError, type ServiceBindingIR, type ServiceLiteral, type ShapeIR, type SourceCapabilitySignals, type StorageRuleIR, type StorageRulesMetadataIR, type TableIR, type TableSnapshot, type TopicIR, VERSION, type ValidatorIR, type VectorIndexIR, WORKFLOWS_FILENAME, type WorkflowIR, type WranglerQueueProducerIR, type WranglerVariableIR, buildOpenApiDocument, buildOpenRpcDocument, buildSchemaSnapshot, capabilitiesUsedBy, createCodegenProject, describeErrorLevelFindings, diagnosticAt, diffSchemaSnapshots, discoverAgents, discoverAuthApiCalls, discoverContainers, discoverCrons, discoverFlags, discoverFunctions, discoverHttpRoutes, discoverHyperdriveCalls, discoverInserts, discoverMaskProcedures, discoverMigrations, discoverMutators, discoverNondeterministicCalls, discoverNotifyCalls, discoverNotifyChannels, discoverNotifyConfig, discoverQueries, discoverQueues, discoverR2sqlCalls, discoverRlsMetadata, discoverRlsProcedures, discoverSandboxUsage, discoverSchema, discoverShapes, discoverStorageRulesMetadata, discoverWorkflows, emitAgents, emitApi, emitApp, emitCollections, emitContainers, emitCrons, emitDataModel, emitDrizzleSchema, emitFunctions, emitInternalApi, emitOpenApi, emitOpenApiModule, emitOpenRpc, emitOpenRpcModule, emitScheduler, emitServer, emitShard, emitVectors, emitWorkflows, emitWranglerCronTriggers, errorAdvisoryNames, errorPlatformDiagnosticNames, evaluateSchemaDrift, findProjectConfigFile, findTsconfig, fingerprintSchemaSources, foldCapabilitySignals, formatAdvisories, isD1GlobalTable, isHyperdriveGlobalTable, isTestPath, lintSchema, listLunoraSourceFiles, loadProjectConfig, mayReadCapabilityContext, parseSchemaSnapshot, platformMatrixIds, readPackageDependencies, readProjectConfigLiterals, readProjectTarget, readServiceBindings, redact, refreshCodegenProject, resolveCodegenTarget, resolveServiceBindings, runCodegen, schemaFromIr, secretKindOf, serializeSchemaSnapshot, sortedUniqueNames, sourceCapabilitySignals, toAdvisorContext, validatorIrToJsonSchema };
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-BCVASH7N.mjs";import{describeErrorLevelFindings as n,errorAdvisoryNames as l,errorPlatformDiagnosticNames as c,sortedUniqueNames as x}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-brcmKenl.mjs";import{CodegenDiagnosticError as A,diagnosticAt as v}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as N,discoverAgents as g}from"./packem_shared/AGENTS_FILENAME-B6-kjzM3.mjs";import{isTestPath as R,listLunoraSourceFiles as T}from"./packem_shared/isTestPath-B81lOULB.mjs";import{default as I}from"./packem_shared/discoverAuthApiCalls-xs0ONfI-.mjs";import{CONTAINERS_FILENAME as L,discoverContainers as M}from"./packem_shared/CONTAINERS_FILENAME-dFRtAyIe.mjs";import{default as P}from"./packem_shared/discoverCrons-DBnCama4.mjs";import{capabilitiesUsedBy as b,foldCapabilitySignals as y,mayReadCapabilityContext as U,sourceCapabilitySignals as G}from"./packem_shared/capabilitiesUsedBy-QgSZyE0T.mjs";import{FLAGS_FILENAME as j,discoverFlags as B}from"./packem_shared/FLAGS_FILENAME-Bf0MSlHH.mjs";import{default as W}from"./packem_shared/discoverFunctions-CbxZGGj0.mjs";import{default as V}from"./packem_shared/discoverHttpRoutes-DgfoyNcf.mjs";import{default as Q}from"./packem_shared/discoverHyperdriveCalls-CwnXgjFJ.mjs";import{default as w}from"./packem_shared/discoverInserts-mHOX_dJR.mjs";import{d as Y}from"./packem_shared/index-CkS96b8a.mjs";import{default as Z}from"./packem_shared/discoverMigrations-C9mLIhGZ.mjs";import{MUTATORS_FILENAME as ee,discoverMutators as re}from"./packem_shared/MUTATORS_FILENAME-qVDmv8st.mjs";import{default as te}from"./packem_shared/discoverNondeterministicCalls-9ZDpRptb.mjs";import{NOTIFY_FILENAME as ae,discoverNotifyCalls as ie,discoverNotifyChannels as me,discoverNotifyConfig as fe}from"./packem_shared/NOTIFY_FILENAME-CLoeWMb5.mjs";import{default as pe}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as le}from"./packem_shared/discoverQueries-CfxkjP5X.mjs";import{QUEUES_FILENAME as xe,discoverQueues as Se}from"./packem_shared/QUEUES_FILENAME-CsRy4VTF.mjs";import{default as ue}from"./packem_shared/discoverR2sqlCalls-XBhs4XRZ.mjs";import{default as ve}from"./packem_shared/discoverRlsProcedures-TskedRMh.mjs";import{default as Ne}from"./packem_shared/discoverRlsMetadata-Cb8JR1b4.mjs";import{discoverSandboxUsage as Oe}from"./packem_shared/discoverSandboxUsage-w6Q3RvxZ.mjs";import{default as Te}from"./packem_shared/discoverSchema-BtsX-CN9.mjs";import{readServiceBindings as Ie,resolveServiceBindings as _e}from"./packem_shared/readServiceBindings-DvqIThzd.mjs";import{SHAPES_FILENAME as Me,discoverShapes as Fe}from"./packem_shared/SHAPES_FILENAME-DkBUN9dK.mjs";import{default as De}from"./packem_shared/discoverStorageRulesMetadata-BPJplDfz.mjs";import{WORKFLOWS_FILENAME as ye,discoverWorkflows as Ue}from"./packem_shared/WORKFLOWS_FILENAME-CdeS224T.mjs";import{emitApp as He}from"./packem_shared/emitApp-BOUdd-2R.mjs";import{isD1GlobalTable as Be,isHyperdriveGlobalTable as ke}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as Ke,emitOpenApi as Ve,emitOpenApiModule as ze}from"./packem_shared/buildOpenApiDocument-DFv-RYZU.mjs";import{OPENRPC_VERSION as qe,buildOpenRpcDocument as we,emitOpenRpc as Je,emitOpenRpcModule as Ye}from"./packem_shared/OPENRPC_VERSION-CCY7xqSL.mjs";import{DEFAULT_TARGET as Ze,platformMatrixIds as $e,readProjectTarget as er,resolveCodegenTarget as rr}from"./packem_shared/DEFAULT_TARGET-BnQiNNKu.mjs";import{l as tr,r as sr}from"./packem_shared/project-config-file-BV7RR-l6.mjs";import{SCHEMA_SNAPSHOT_FILENAME as ir,runCodegen as mr}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-CSjCtmZi.mjs";import{SchemaSnapshotParseError as dr,buildSchemaSnapshot as pr,evaluateSchemaDrift as nr,parseSchemaSnapshot as lr}from"./packem_shared/SchemaSnapshotParseError-BRJT7c2k.mjs";import{default as xr}from"./packem_shared/fingerprintSchemaSources-eVG9aVt0.mjs";import{schemaFromIr as Er}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as Ar,validatorIrToJsonSchema as vr}from"./packem_shared/LUNORA_ERROR_CODES-C2s0xWQD.mjs";import{SDK_LANGUAGES as Nr,SDK_TARGETS as gr,generateSdk as Or}from"./packem_shared/SDK_LANGUAGES-Df_CnJx5.mjs";import{redact as Tr,secretKindOf as hr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as _r}from"./packem_shared/emitDrizzleSchema-DitcRZ1a.mjs";import{default as Mr}from"./packem_shared/emitFunctions-BeKgL3dl.mjs";import{e as Pr}from"./packem_shared/server-DAvi_bv_.mjs";import{e as br}from"./packem_shared/shard-Av4rUyYS.mjs";import{G as Ur}from"./packem_shared/shared-DnCokNcE.mjs";import{MESSAGE_SOLUTIONS as Hr,findSolutionByMessage as jr}from"@lunora/errors";import{PROJECT_CONFIG_FILENAMES as kr,findProjectConfigFile as Wr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs";import{createCodegenProject as Vr,findTsconfig as zr,refreshCodegenProject as Qr}from"./packem_shared/createCodegenProject-V51_yBw3.mjs";import{s as wr,t as Jr,u as Yr}from"./packem_shared/shard-runtime-CkTgY8tL.mjs";import{emitApi as Zr,emitCollections as $r,emitInternalApi as eo}from"./packem_shared/emitApi-Zx6VPN-7.mjs";import{emitCrons as oo,emitScheduler as to,emitVectors as so,emitWranglerCronTriggers as ao}from"./packem_shared/emitCrons-BQW2lviZ.mjs";import{emitDataModel as mo}from"./packem_shared/emitDataModel-BskFt9Wv.mjs";import{isTypedSchema as po}from"./packem_shared/isTypedSchema-CKzc3ioR.mjs";const e="0.0.0";export{N as AGENTS_FILENAME,E as CAPABILITY_PROBES,L as CONTAINERS_FILENAME,A as CodegenDiagnosticError,Ze as DEFAULT_TARGET,j as FLAGS_FILENAME,Ur as GENERATED_HEADER,Ar as LUNORA_ERROR_CODES,Hr as LUNORA_SOLUTION_RULES,ee as MUTATORS_FILENAME,ae as NOTIFY_FILENAME,qe as OPENRPC_VERSION,kr as PROJECT_CONFIG_FILENAMES,xe as QUEUES_FILENAME,ir as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Nr as SDK_LANGUAGES,gr as SDK_TARGETS,Me as SHAPES_FILENAME,dr as SchemaSnapshotParseError,e as VERSION,ye as WORKFLOWS_FILENAME,Ke as buildOpenApiDocument,we as buildOpenRpcDocument,pr as buildSchemaSnapshot,b as capabilitiesUsedBy,Vr as createCodegenProject,n as describeErrorLevelFindings,v as diagnosticAt,s as diffSchemaSnapshots,g as discoverAgents,I as discoverAuthApiCalls,M as discoverContainers,P as discoverCrons,B as discoverFlags,W as discoverFunctions,V as discoverHttpRoutes,Q as discoverHyperdriveCalls,w as discoverInserts,Y as discoverMaskProcedures,Z as discoverMigrations,re as discoverMutators,te as discoverNondeterministicCalls,ie as discoverNotifyCalls,me as discoverNotifyChannels,fe as discoverNotifyConfig,le as discoverQueries,Se as discoverQueues,ue as discoverR2sqlCalls,Ne as discoverRlsMetadata,ve as discoverRlsProcedures,Oe as discoverSandboxUsage,Te as discoverSchema,Fe as discoverShapes,De as discoverStorageRulesMetadata,Ue as discoverWorkflows,wr as emitAgents,Zr as emitApi,He as emitApp,$r as emitCollections,Jr as emitContainers,oo as emitCrons,mo as emitDataModel,_r as emitDrizzleSchema,Mr as emitFunctions,eo as emitInternalApi,Ve as emitOpenApi,ze as emitOpenApiModule,Je as emitOpenRpc,Ye as emitOpenRpcModule,to as emitScheduler,Pr as emitServer,br as emitShard,so as emitVectors,Yr as emitWorkflows,ao as emitWranglerCronTriggers,l as errorAdvisoryNames,c as errorPlatformDiagnosticNames,nr as evaluateSchemaDrift,jr as findLunoraSolution,Wr as findProjectConfigFile,zr as findTsconfig,xr as fingerprintSchemaSources,y as foldCapabilitySignals,m as formatAdvisories,Or as generateSdk,Be as isD1GlobalTable,ke as isHyperdriveGlobalTable,R as isTestPath,po as isTypedSchema,f as lintSchema,T as listLunoraSourceFiles,tr as loadProjectConfig,U as mayReadCapabilityContext,lr as parseSchemaSnapshot,$e as platformMatrixIds,pe as readPackageDependencies,sr as readProjectConfigLiterals,er as readProjectTarget,Ie as readServiceBindings,Tr as redact,Qr as refreshCodegenProject,rr as resolveCodegenTarget,_e as resolveServiceBindings,mr as runCodegen,Er as schemaFromIr,hr as secretKindOf,a as serializeSchemaSnapshot,x as sortedUniqueNames,G as sourceCapabilitySignals,d as toAdvisorContext,vr 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-BCVASH7N.mjs";import{describeErrorLevelFindings as n,errorAdvisoryNames as l,errorPlatformDiagnosticNames as c,sortedUniqueNames as x}from"./packem_shared/describeErrorLevelFindings-vzaGS9KL.mjs";import{CAPABILITY_PROBES as E}from"./packem_shared/CAPABILITY_PROBES-brcmKenl.mjs";import{CodegenDiagnosticError as A,diagnosticAt as v}from"./packem_shared/CodegenDiagnosticError-BUXlG3P-.mjs";import{AGENTS_FILENAME as N,discoverAgents as g}from"./packem_shared/AGENTS_FILENAME-B6-kjzM3.mjs";import{isTestPath as R,listLunoraSourceFiles as T}from"./packem_shared/isTestPath-B81lOULB.mjs";import{default as I}from"./packem_shared/discoverAuthApiCalls-xs0ONfI-.mjs";import{CONTAINERS_FILENAME as L,discoverContainers as M}from"./packem_shared/CONTAINERS_FILENAME-dFRtAyIe.mjs";import{default as P}from"./packem_shared/discoverCrons-DBnCama4.mjs";import{capabilitiesUsedBy as b,foldCapabilitySignals as y,mayReadCapabilityContext as U,sourceCapabilitySignals as G}from"./packem_shared/capabilitiesUsedBy-QgSZyE0T.mjs";import{FLAGS_FILENAME as j,discoverFlags as B}from"./packem_shared/FLAGS_FILENAME-Bf0MSlHH.mjs";import{default as W}from"./packem_shared/discoverFunctions-CbxZGGj0.mjs";import{default as V}from"./packem_shared/discoverHttpRoutes-DgfoyNcf.mjs";import{default as Q}from"./packem_shared/discoverHyperdriveCalls-CwnXgjFJ.mjs";import{default as w}from"./packem_shared/discoverInserts-mHOX_dJR.mjs";import{d as Y}from"./packem_shared/index-CkS96b8a.mjs";import{default as Z}from"./packem_shared/discoverMigrations-C9mLIhGZ.mjs";import{MUTATORS_FILENAME as ee,discoverMutators as re}from"./packem_shared/MUTATORS_FILENAME-qVDmv8st.mjs";import{default as te}from"./packem_shared/discoverNondeterministicCalls-9ZDpRptb.mjs";import{NOTIFY_FILENAME as ae,discoverNotifyCalls as ie,discoverNotifyChannels as me,discoverNotifyConfig as fe}from"./packem_shared/NOTIFY_FILENAME-CLoeWMb5.mjs";import{default as pe}from"./packem_shared/readPackageDependencies-RHhGiz0k.mjs";import{default as le}from"./packem_shared/discoverQueries-CfxkjP5X.mjs";import{QUEUES_FILENAME as xe,discoverQueues as Se}from"./packem_shared/QUEUES_FILENAME-CsRy4VTF.mjs";import{default as ue}from"./packem_shared/discoverR2sqlCalls-XBhs4XRZ.mjs";import{default as ve}from"./packem_shared/discoverRlsProcedures-TskedRMh.mjs";import{default as Ne}from"./packem_shared/discoverRlsMetadata-Cb8JR1b4.mjs";import{discoverSandboxUsage as Oe}from"./packem_shared/discoverSandboxUsage-w6Q3RvxZ.mjs";import{default as Te}from"./packem_shared/discoverSchema-BtsX-CN9.mjs";import{readServiceBindings as Ie,resolveServiceBindings as _e}from"./packem_shared/readServiceBindings-DvqIThzd.mjs";import{SHAPES_FILENAME as Me,discoverShapes as Fe}from"./packem_shared/SHAPES_FILENAME-DkBUN9dK.mjs";import{default as De}from"./packem_shared/discoverStorageRulesMetadata-BPJplDfz.mjs";import{WORKFLOWS_FILENAME as ye,discoverWorkflows as Ue}from"./packem_shared/WORKFLOWS_FILENAME-CdeS224T.mjs";import{emitApp as He}from"./packem_shared/emitApp-BOUdd-2R.mjs";import{isD1GlobalTable as Be,isHyperdriveGlobalTable as ke}from"./packem_shared/isD1GlobalTable-udvHAAzD.mjs";import{buildOpenApiDocument as Ke,emitOpenApi as Ve,emitOpenApiModule as ze}from"./packem_shared/buildOpenApiDocument-DFv-RYZU.mjs";import{OPENRPC_VERSION as qe,buildOpenRpcDocument as we,emitOpenRpc as Je,emitOpenRpcModule as Ye}from"./packem_shared/OPENRPC_VERSION-CCY7xqSL.mjs";import{DEFAULT_TARGET as Ze,platformMatrixIds as $e,readProjectTarget as er,resolveCodegenTarget as rr}from"./packem_shared/DEFAULT_TARGET-BnQiNNKu.mjs";import{l as tr,r as sr}from"./packem_shared/project-config-file-BV7RR-l6.mjs";import{SCHEMA_SNAPSHOT_FILENAME as ir,runCodegen as mr}from"./packem_shared/SCHEMA_SNAPSHOT_FILENAME-CSjCtmZi.mjs";import{SchemaSnapshotParseError as dr,buildSchemaSnapshot as pr,evaluateSchemaDrift as nr,parseSchemaSnapshot as lr}from"./packem_shared/SchemaSnapshotParseError-BRJT7c2k.mjs";import{default as xr}from"./packem_shared/fingerprintSchemaSources-eVG9aVt0.mjs";import{schemaFromIr as Er}from"./packem_shared/schemaFromIr-BWFnvCVg.mjs";import{LUNORA_ERROR_CODES as Ar,validatorIrToJsonSchema as vr}from"./packem_shared/LUNORA_ERROR_CODES-C2s0xWQD.mjs";import{SDK_LANGUAGES as Nr,SDK_TARGETS as gr,generateSdk as Or}from"./sdk/index.mjs";import{redact as Tr,secretKindOf as hr}from"./packem_shared/redact-Cy14LEnc.mjs";import{default as _r}from"./packem_shared/emitDrizzleSchema-DitcRZ1a.mjs";import{default as Mr}from"./packem_shared/emitFunctions-BeKgL3dl.mjs";import{e as Pr}from"./packem_shared/server-DAvi_bv_.mjs";import{e as br}from"./packem_shared/shard-Av4rUyYS.mjs";import{G as Ur}from"./packem_shared/shared-DnCokNcE.mjs";import{MESSAGE_SOLUTIONS as Hr,findSolutionByMessage as jr}from"@lunora/errors";import{PROJECT_CONFIG_FILENAMES as kr,findProjectConfigFile as Wr}from"./packem_shared/PROJECT_CONFIG_FILENAMES-DzOu-lSc.mjs";import{createCodegenProject as Vr,findTsconfig as zr,refreshCodegenProject as Qr}from"./packem_shared/createCodegenProject-V51_yBw3.mjs";import{s as wr,t as Jr,u as Yr}from"./packem_shared/shard-runtime-CkTgY8tL.mjs";import{emitApi as Zr,emitCollections as $r,emitInternalApi as eo}from"./packem_shared/emitApi-Zx6VPN-7.mjs";import{emitCrons as oo,emitScheduler as to,emitVectors as so,emitWranglerCronTriggers as ao}from"./packem_shared/emitCrons-BQW2lviZ.mjs";import{emitDataModel as mo}from"./packem_shared/emitDataModel-BskFt9Wv.mjs";import{isTypedSchema as po}from"./packem_shared/isTypedSchema-CKzc3ioR.mjs";const e="0.0.0";export{N as AGENTS_FILENAME,E as CAPABILITY_PROBES,L as CONTAINERS_FILENAME,A as CodegenDiagnosticError,Ze as DEFAULT_TARGET,j as FLAGS_FILENAME,Ur as GENERATED_HEADER,Ar as LUNORA_ERROR_CODES,Hr as LUNORA_SOLUTION_RULES,ee as MUTATORS_FILENAME,ae as NOTIFY_FILENAME,qe as OPENRPC_VERSION,kr as PROJECT_CONFIG_FILENAMES,xe as QUEUES_FILENAME,ir as SCHEMA_SNAPSHOT_FILENAME,t as SCHEMA_SNAPSHOT_VERSION,Nr as SDK_LANGUAGES,gr as SDK_TARGETS,Me as SHAPES_FILENAME,dr as SchemaSnapshotParseError,e as VERSION,ye as WORKFLOWS_FILENAME,Ke as buildOpenApiDocument,we as buildOpenRpcDocument,pr as buildSchemaSnapshot,b as capabilitiesUsedBy,Vr as createCodegenProject,n as describeErrorLevelFindings,v as diagnosticAt,s as diffSchemaSnapshots,g as discoverAgents,I as discoverAuthApiCalls,M as discoverContainers,P as discoverCrons,B as discoverFlags,W as discoverFunctions,V as discoverHttpRoutes,Q as discoverHyperdriveCalls,w as discoverInserts,Y as discoverMaskProcedures,Z as discoverMigrations,re as discoverMutators,te as discoverNondeterministicCalls,ie as discoverNotifyCalls,me as discoverNotifyChannels,fe as discoverNotifyConfig,le as discoverQueries,Se as discoverQueues,ue as discoverR2sqlCalls,Ne as discoverRlsMetadata,ve as discoverRlsProcedures,Oe as discoverSandboxUsage,Te as discoverSchema,Fe as discoverShapes,De as discoverStorageRulesMetadata,Ue as discoverWorkflows,wr as emitAgents,Zr as emitApi,He as emitApp,$r as emitCollections,Jr as emitContainers,oo as emitCrons,mo as emitDataModel,_r as emitDrizzleSchema,Mr as emitFunctions,eo as emitInternalApi,Ve as emitOpenApi,ze as emitOpenApiModule,Je as emitOpenRpc,Ye as emitOpenRpcModule,to as emitScheduler,Pr as emitServer,br as emitShard,so as emitVectors,Yr as emitWorkflows,ao as emitWranglerCronTriggers,l as errorAdvisoryNames,c as errorPlatformDiagnosticNames,nr as evaluateSchemaDrift,jr as findLunoraSolution,Wr as findProjectConfigFile,zr as findTsconfig,xr as fingerprintSchemaSources,y as foldCapabilitySignals,m as formatAdvisories,Or as generateSdk,Be as isD1GlobalTable,ke as isHyperdriveGlobalTable,R as isTestPath,po as isTypedSchema,f as lintSchema,T as listLunoraSourceFiles,tr as loadProjectConfig,U as mayReadCapabilityContext,lr as parseSchemaSnapshot,$e as platformMatrixIds,pe as readPackageDependencies,sr as readProjectConfigLiterals,er as readProjectTarget,Ie as readServiceBindings,Tr as redact,Qr as refreshCodegenProject,rr as resolveCodegenTarget,_e as resolveServiceBindings,mr as runCodegen,Er as schemaFromIr,hr as secretKindOf,a as serializeSchemaSnapshot,x as sortedUniqueNames,G as sourceCapabilitySignals,d as toAdvisorContext,vr as validatorIrToJsonSchema};
@@ -0,0 +1,288 @@
1
+ import { LanguageName } from 'quicktype-core';
2
+ /**
3
+ * Language-agnostic half of SDK generation: turn an OpenRPC document
4
+ * (`_generated/openrpc.json`, see {@link file://../openrpc.ts}) into the parsed
5
+ * shape every per-language target renders from.
6
+ *
7
+ * Nothing here knows about a target language. A target supplies its own member
8
+ * naming and templates (see {@link file://./targets}); everything that would
9
+ * otherwise be re-derived per language — how a `functionPath` splits, which
10
+ * runtime verb a kind maps to, whether a schema is real or the untyped
11
+ * placeholder, how namespaces group and sort — lives here exactly once.
12
+ *
13
+ * That single-source rule is not stylistic. `paths.ts` documents the same
14
+ * discipline for namespaces ("if these ever disagree, runtime dispatch silently
15
+ * misses functions"), and the failure mode here is the same in a new costume: a
16
+ * target that re-derives a model name renders an import pointing at a class
17
+ * quicktype never emitted.
18
+ *
19
+ * Deriving names in one place is necessary but NOT sufficient, because only
20
+ * half the decision is ours: quicktype chooses whether a predicted name becomes
21
+ * a declared type, and different backends answer differently for the same
22
+ * schema. {@link withDeclaredModels} reconciles the two halves before a target
23
+ * renders anything.
24
+ */
25
+ /** One OpenRPC method as {@link file://../openrpc.ts} emits it. */
26
+ interface OpenRpcMethod {
27
+ name: string;
28
+ params?: ReadonlyArray<{
29
+ name: string;
30
+ schema?: Record<string, unknown>;
31
+ }>;
32
+ result?: {
33
+ name: string;
34
+ schema?: Record<string, unknown>;
35
+ };
36
+ summary?: string;
37
+ "x-lunora-function-kind"?: string;
38
+ }
39
+ /** The `_generated/openrpc.json` document. */
40
+ interface OpenRpcDocument {
41
+ info?: {
42
+ title?: string;
43
+ version?: string;
44
+ };
45
+ methods: ReadonlyArray<OpenRpcMethod>;
46
+ }
47
+ /** The runtime verbs a generated SDK can call. Mirrors the client transports. */
48
+ type RuntimeVerb = "action" | "mutation" | "query";
49
+ /** One RPC function, parsed and language-neutral. */
50
+ interface SdkMethod {
51
+ /**
52
+ * Where this function's ARGUMENT nulls mean "unset" and where they mean
53
+ * "null" — see {@link ModelNullPaths}.
54
+ *
55
+ * On the method rather than on a shared render input because it is a
56
+ * per-method fact and the parser already holds the schema it comes from. Read
57
+ * by the three targets whose rendered models cannot tell the two apart
58
+ * (ruby, rust, swift); the other five have a marker of their own and ignore
59
+ * it.
60
+ */
61
+ argsNullPaths: ModelNullPaths;
62
+ /**
63
+ * Generated args model name, or `undefined` when NO model could be named for
64
+ * this function's arguments.
65
+ *
66
+ * `undefined` does NOT mean "takes no arguments" — see {@link SdkMethod.takesArgs}.
67
+ * A schema carrying a `v.bigint()` or `v.bytes()` gets no model deliberately
68
+ * (`hasUnrepresentableWireType`), and a backend that cannot name a shape leaves
69
+ * it undeclared. Both still take arguments, just untyped ones.
70
+ */
71
+ argsType: string | undefined;
72
+ /** Raw exported function name (`"list"`), before any naming convention. */
73
+ functionName: string;
74
+ /** The wire identifier (`"messages:list"`), emitted verbatim into calls. */
75
+ functionPath: string;
76
+ /** Raw file namespace (`"messages"`), before any naming convention. */
77
+ namespace: string;
78
+ /** Generated result model name, or `undefined` while the result is untyped. */
79
+ resultType: string | undefined;
80
+ /** Human summary for the doc comment. */
81
+ summary: string;
82
+ /**
83
+ * Whether this function declares arguments at all, independent of whether a
84
+ * model could be named for them.
85
+ *
86
+ * A target emits three shapes from this: a TYPED parameter when `argsType` is
87
+ * set, an UNTYPED wire-shaped parameter when it is not but this is true, and no
88
+ * parameter at all when this is false. Collapsing the middle case into the last
89
+ * is what made `v.bigint()` functions uncallable with arguments.
90
+ */
91
+ takesArgs: boolean;
92
+ /** Which runtime verb this dispatches to. */
93
+ verb: RuntimeVerb;
94
+ }
95
+ /** One namespace's functions, sorted. */
96
+ interface SdkNamespace {
97
+ methods: ReadonlyArray<SdkMethod>;
98
+ /** Raw namespace (`"messages"`); a target applies its own casing. */
99
+ name: string;
100
+ }
101
+ /**
102
+ * True when a schema actually describes a shape.
103
+ *
104
+ * `openrpc.ts` emits a description-only placeholder for any function without a
105
+ * declared `.output()` (the return type is TS-inferred and absent from the IR).
106
+ * A placeholder must never become a generated model: quicktype would render an
107
+ * empty type, and the surface would decode every response into it — silently
108
+ * discarding the real payload rather than leaving it untyped.
109
+ */
110
+ declare const isTypedSchema: (schema: Record<string, unknown> | undefined) => boolean;
111
+ /**
112
+ * A path from a model's root to one property. `*` stands for every element of an
113
+ * array or every value of a record, neither of which has named positions.
114
+ */
115
+ type SchemaPath = ReadonlyArray<string>;
116
+ /**
117
+ * Where a model's nulls mean different things — the one fact a generated model
118
+ * flattens away, and the reason three ports could not send a `v.nullable()`
119
+ * argument at all.
120
+ *
121
+ * An unset `v.optional()` and a `v.nullable()` set to null are the SAME value in
122
+ * every generated model (a nil field), and opposite things on the wire: the
123
+ * validator rejects an explicit null for the first and requires the key present
124
+ * for the second. Neither Ruby, Rust nor Swift renders a marker telling them
125
+ * apart, so the distinction is computed here, from the schema, where `required`
126
+ * still exists — and handed to the targets that need it.
127
+ *
128
+ * Two lists rather than one because the ports need opposite operations. Ruby and
129
+ * Rust project a whole value tree and prune nulls, so they prune at
130
+ * {@link ModelNullPaths.optional} and nowhere else — which also stops them
131
+ * dropping a legitimate null inside a record or an array, as a blanket prune
132
+ * does. Swift's `JSONEncoder` has already dropped every struct-property nil
133
+ * before the transport sees a tree, so it restores nulls at
134
+ * {@link ModelNullPaths.nullable} instead: an absent key at a required path can
135
+ * only have been a nil, so putting the null back is exact.
136
+ *
137
+ * A `$ref` is NOT resolved. `openrpc.ts` inlines everything it emits, so this
138
+ * never comes up for a generated document — but `--spec` accepts a hand-written
139
+ * one, and there a `$ref`'d sub-object contributes no paths at all: the ports
140
+ * that prune would send its unset optionals as null, and Swift would not restore
141
+ * its nullables. Inline the schema, or teach this to follow the pointer.
142
+ *
143
+ * Both lists name PROPERTIES only. A record's values and an array's elements can
144
+ * be null too, but no port drops one: the pruning ports prune at `optional`
145
+ * paths, which a `*` position can never be, and `JSONEncoder` drops a nil only
146
+ * from a struct property — a nil inside a dictionary or array encodes as null.
147
+ * Listing a `*` leaf would also make Swift's restore INVENT record keys that
148
+ * were never there, which is why the walk records the path it descends through
149
+ * but never the `*` position itself.
150
+ */
151
+ interface ModelNullPaths {
152
+ /** Required properties that permit null — a null there is a VALUE and must survive. */
153
+ nullable: ReadonlyArray<SchemaPath>;
154
+ /** Properties absent from their object's `required` — a null there means UNSET. */
155
+ optional: ReadonlyArray<SchemaPath>;
156
+ }
157
+ /** What a target renders from. */
158
+ interface SdkRenderInput {
159
+ /**
160
+ * The rendered model source, to be written as the target's model file.
161
+ *
162
+ * Empty for a target that emits its own model FILES via
163
+ * {@link SdkTarget.renderModels} — those are already written, and this string
164
+ * exists only so the declared-model reconciliation reads one shape.
165
+ */
166
+ models: string;
167
+ /** Namespaces and their functions, already sorted. */
168
+ namespaces: ReadonlyArray<SdkNamespace>;
169
+ }
170
+ /**
171
+ * One directory or file of the hand-written transport, and where it lands in the
172
+ * output.
173
+ *
174
+ * `from` is relative to `sdks/<target id>/` and `to` is relative to `--out`. The
175
+ * two differ because a repo layout and a consumable layout are not the same
176
+ * shape: the Ruby transport lives under `lib/` so `ruby -Ilib` works in the
177
+ * repo, while a vendored copy has no `lib` to point at, and the Rust transport
178
+ * is the repo's root crate but a nested one in the output.
179
+ *
180
+ * Only the runtime is listed. A transport's own conformance suite and its
181
+ * `generated_check/` sample are deliberately absent — they assert against
182
+ * `protocol/fixtures/`, which is not copied, so vendoring them would ship a user
183
+ * a test suite that cannot run.
184
+ */
185
+ interface SdkVendorEntry {
186
+ /** Path under `sdks/<id>/`. A directory is copied recursively. */
187
+ from: string;
188
+ /** Destination path under `--out`. */
189
+ to: string;
190
+ }
191
+ /** A language target. One per `--lang` value. */
192
+ interface SdkTarget {
193
+ /** The `--lang` value (`"python"`, `"go"`, …). */
194
+ id: string;
195
+ /**
196
+ * The quicktype backend + renderer options that produce this target's
197
+ * models, or absent when the target emits its own (see
198
+ * {@link SdkTarget.renderModels}) or none at all.
199
+ *
200
+ * `LanguageName` is quicktype's own union, so a target naming a backend
201
+ * quicktype does not ship fails to compile rather than at run time.
202
+ */
203
+ quicktype?: {
204
+ lang: LanguageName;
205
+ rendererOptions?: Record<string, string>;
206
+ };
207
+ /**
208
+ * Render the SDK. Returns file contents keyed by path relative to the
209
+ * output directory (nested paths are created as needed).
210
+ *
211
+ * This includes the BUILD MANIFEST the layout needs — `go.mod`, `Cargo.toml`,
212
+ * `Package.swift`, a crate root — because those name the vendored transport
213
+ * and are therefore part of "how this language resolves the copy", not
214
+ * something a consumer should have to write. Languages that resolve by
215
+ * directory (Python, Ruby, Java, Kotlin) emit no manifest.
216
+ */
217
+ render: (input: SdkRenderInput) => Record<string, string>;
218
+ /**
219
+ * Emit this target's models from the schema directly, INSTEAD of quicktype,
220
+ * as file contents keyed by path relative to the output directory.
221
+ *
222
+ * Present only for the two JVM targets, and the exception is earned rather
223
+ * than a preference: quicktype's Java and Kotlin backends rename properties
224
+ * and, under `just-types`, emit no mapping metadata, so a model they render
225
+ * cannot be projected back onto the wire — and the only complete mapping
226
+ * they offer requires a Jackson / Klaxon / kotlinx dependency, which is the
227
+ * one thing these JDK-only transports are defined not to have.
228
+ * `targets/java.ts` records every option that was measured.
229
+ *
230
+ * A MAP rather than the single string quicktype returns, because Java takes
231
+ * one file per class: its single-file render is not compilable Java at all.
232
+ * The values are still joined for {@link SdkRenderInput.models}, so the
233
+ * declared-model reconciliation is the same code for every target.
234
+ */
235
+ renderModels?: (document: OpenRpcDocument) => Record<string, string>;
236
+ /**
237
+ * THIRD-PARTY packages a consuming project must still install, reported by
238
+ * the CLI. Empty for six of the eight — the transport is vendored and those
239
+ * six reach the wire with only their standard library.
240
+ *
241
+ * A list, and not derivable from the transport, because a target's MODELS can
242
+ * carry a dependency the transport does not: quicktype's Ruby backend emits
243
+ * `Dry::Struct` types with no renderer option to avoid them, so a Ruby SDK
244
+ * needs the gems even though `sdks/ruby` itself is dependency-free.
245
+ */
246
+ requires: ReadonlyArray<string>;
247
+ /**
248
+ * Which parts of `sdks/<id>/` are the transport, and where they land under
249
+ * `--out`. See {@link SdkVendorEntry}.
250
+ */
251
+ vendor: ReadonlyArray<SdkVendorEntry>;
252
+ }
253
+ /** Every language `lunora sdk generate --lang` accepts, keyed by id. */
254
+ declare const SDK_TARGETS: Readonly<Record<string, SdkTarget>>;
255
+ /** The accepted `--lang` values, sorted — for help text and error messages. */
256
+ declare const SDK_LANGUAGES: ReadonlyArray<string>;
257
+ /** The files a generation run writes, keyed by path relative to the output directory. */
258
+ type SdkFiles = Record<string, string>;
259
+ /** What a generation run produced, plus what it had to weaken and why. */
260
+ interface SdkResult {
261
+ files: SdkFiles;
262
+ /**
263
+ * Model names predicted from the schema that the chosen backend did not
264
+ * declare, so their call sites fell back to an untyped return. Surfaced
265
+ * rather than swallowed — silently weaker types are how an SDK looks
266
+ * finished while returning `Any` everywhere.
267
+ */
268
+ undeclared: ReadonlyArray<string>;
269
+ /**
270
+ * Functions whose args or result carry a `v.bigint()` or `v.bytes()`. No
271
+ * typed model can represent those — the wire needs a tagged value that no
272
+ * generated field produces — so their parameters stay untyped and the
273
+ * caller passes wire values directly.
274
+ */
275
+ unrepresentable: ReadonlyArray<string>;
276
+ }
277
+ /**
278
+ * Generate the SDK for `document` in `target`'s language.
279
+ *
280
+ * Async only because the model layer is: quicktype's renderer is promise-based.
281
+ * The surface itself is pure, so a target's `render` stays synchronous and
282
+ * unit-testable without touching quicktype.
283
+ *
284
+ * Models are rendered BEFORE the surface because the surface's model references
285
+ * depend on what the backend actually declared — see {@link withDeclaredModels}.
286
+ */
287
+ declare const generateSdk: (document: OpenRpcDocument, target: SdkTarget) => Promise<SdkResult>;
288
+ export { type OpenRpcDocument, type OpenRpcMethod, type RuntimeVerb, SDK_LANGUAGES, SDK_TARGETS, type SdkFiles, type SdkMethod, type SdkNamespace, type SdkRenderInput, type SdkResult, type SdkTarget, generateSdk, isTypedSchema };
@@ -0,0 +1,288 @@
1
+ import { LanguageName } from 'quicktype-core';
2
+ /**
3
+ * Language-agnostic half of SDK generation: turn an OpenRPC document
4
+ * (`_generated/openrpc.json`, see {@link file://../openrpc.ts}) into the parsed
5
+ * shape every per-language target renders from.
6
+ *
7
+ * Nothing here knows about a target language. A target supplies its own member
8
+ * naming and templates (see {@link file://./targets}); everything that would
9
+ * otherwise be re-derived per language — how a `functionPath` splits, which
10
+ * runtime verb a kind maps to, whether a schema is real or the untyped
11
+ * placeholder, how namespaces group and sort — lives here exactly once.
12
+ *
13
+ * That single-source rule is not stylistic. `paths.ts` documents the same
14
+ * discipline for namespaces ("if these ever disagree, runtime dispatch silently
15
+ * misses functions"), and the failure mode here is the same in a new costume: a
16
+ * target that re-derives a model name renders an import pointing at a class
17
+ * quicktype never emitted.
18
+ *
19
+ * Deriving names in one place is necessary but NOT sufficient, because only
20
+ * half the decision is ours: quicktype chooses whether a predicted name becomes
21
+ * a declared type, and different backends answer differently for the same
22
+ * schema. {@link withDeclaredModels} reconciles the two halves before a target
23
+ * renders anything.
24
+ */
25
+ /** One OpenRPC method as {@link file://../openrpc.ts} emits it. */
26
+ interface OpenRpcMethod {
27
+ name: string;
28
+ params?: ReadonlyArray<{
29
+ name: string;
30
+ schema?: Record<string, unknown>;
31
+ }>;
32
+ result?: {
33
+ name: string;
34
+ schema?: Record<string, unknown>;
35
+ };
36
+ summary?: string;
37
+ "x-lunora-function-kind"?: string;
38
+ }
39
+ /** The `_generated/openrpc.json` document. */
40
+ interface OpenRpcDocument {
41
+ info?: {
42
+ title?: string;
43
+ version?: string;
44
+ };
45
+ methods: ReadonlyArray<OpenRpcMethod>;
46
+ }
47
+ /** The runtime verbs a generated SDK can call. Mirrors the client transports. */
48
+ type RuntimeVerb = "action" | "mutation" | "query";
49
+ /** One RPC function, parsed and language-neutral. */
50
+ interface SdkMethod {
51
+ /**
52
+ * Where this function's ARGUMENT nulls mean "unset" and where they mean
53
+ * "null" — see {@link ModelNullPaths}.
54
+ *
55
+ * On the method rather than on a shared render input because it is a
56
+ * per-method fact and the parser already holds the schema it comes from. Read
57
+ * by the three targets whose rendered models cannot tell the two apart
58
+ * (ruby, rust, swift); the other five have a marker of their own and ignore
59
+ * it.
60
+ */
61
+ argsNullPaths: ModelNullPaths;
62
+ /**
63
+ * Generated args model name, or `undefined` when NO model could be named for
64
+ * this function's arguments.
65
+ *
66
+ * `undefined` does NOT mean "takes no arguments" — see {@link SdkMethod.takesArgs}.
67
+ * A schema carrying a `v.bigint()` or `v.bytes()` gets no model deliberately
68
+ * (`hasUnrepresentableWireType`), and a backend that cannot name a shape leaves
69
+ * it undeclared. Both still take arguments, just untyped ones.
70
+ */
71
+ argsType: string | undefined;
72
+ /** Raw exported function name (`"list"`), before any naming convention. */
73
+ functionName: string;
74
+ /** The wire identifier (`"messages:list"`), emitted verbatim into calls. */
75
+ functionPath: string;
76
+ /** Raw file namespace (`"messages"`), before any naming convention. */
77
+ namespace: string;
78
+ /** Generated result model name, or `undefined` while the result is untyped. */
79
+ resultType: string | undefined;
80
+ /** Human summary for the doc comment. */
81
+ summary: string;
82
+ /**
83
+ * Whether this function declares arguments at all, independent of whether a
84
+ * model could be named for them.
85
+ *
86
+ * A target emits three shapes from this: a TYPED parameter when `argsType` is
87
+ * set, an UNTYPED wire-shaped parameter when it is not but this is true, and no
88
+ * parameter at all when this is false. Collapsing the middle case into the last
89
+ * is what made `v.bigint()` functions uncallable with arguments.
90
+ */
91
+ takesArgs: boolean;
92
+ /** Which runtime verb this dispatches to. */
93
+ verb: RuntimeVerb;
94
+ }
95
+ /** One namespace's functions, sorted. */
96
+ interface SdkNamespace {
97
+ methods: ReadonlyArray<SdkMethod>;
98
+ /** Raw namespace (`"messages"`); a target applies its own casing. */
99
+ name: string;
100
+ }
101
+ /**
102
+ * True when a schema actually describes a shape.
103
+ *
104
+ * `openrpc.ts` emits a description-only placeholder for any function without a
105
+ * declared `.output()` (the return type is TS-inferred and absent from the IR).
106
+ * A placeholder must never become a generated model: quicktype would render an
107
+ * empty type, and the surface would decode every response into it — silently
108
+ * discarding the real payload rather than leaving it untyped.
109
+ */
110
+ declare const isTypedSchema: (schema: Record<string, unknown> | undefined) => boolean;
111
+ /**
112
+ * A path from a model's root to one property. `*` stands for every element of an
113
+ * array or every value of a record, neither of which has named positions.
114
+ */
115
+ type SchemaPath = ReadonlyArray<string>;
116
+ /**
117
+ * Where a model's nulls mean different things — the one fact a generated model
118
+ * flattens away, and the reason three ports could not send a `v.nullable()`
119
+ * argument at all.
120
+ *
121
+ * An unset `v.optional()` and a `v.nullable()` set to null are the SAME value in
122
+ * every generated model (a nil field), and opposite things on the wire: the
123
+ * validator rejects an explicit null for the first and requires the key present
124
+ * for the second. Neither Ruby, Rust nor Swift renders a marker telling them
125
+ * apart, so the distinction is computed here, from the schema, where `required`
126
+ * still exists — and handed to the targets that need it.
127
+ *
128
+ * Two lists rather than one because the ports need opposite operations. Ruby and
129
+ * Rust project a whole value tree and prune nulls, so they prune at
130
+ * {@link ModelNullPaths.optional} and nowhere else — which also stops them
131
+ * dropping a legitimate null inside a record or an array, as a blanket prune
132
+ * does. Swift's `JSONEncoder` has already dropped every struct-property nil
133
+ * before the transport sees a tree, so it restores nulls at
134
+ * {@link ModelNullPaths.nullable} instead: an absent key at a required path can
135
+ * only have been a nil, so putting the null back is exact.
136
+ *
137
+ * A `$ref` is NOT resolved. `openrpc.ts` inlines everything it emits, so this
138
+ * never comes up for a generated document — but `--spec` accepts a hand-written
139
+ * one, and there a `$ref`'d sub-object contributes no paths at all: the ports
140
+ * that prune would send its unset optionals as null, and Swift would not restore
141
+ * its nullables. Inline the schema, or teach this to follow the pointer.
142
+ *
143
+ * Both lists name PROPERTIES only. A record's values and an array's elements can
144
+ * be null too, but no port drops one: the pruning ports prune at `optional`
145
+ * paths, which a `*` position can never be, and `JSONEncoder` drops a nil only
146
+ * from a struct property — a nil inside a dictionary or array encodes as null.
147
+ * Listing a `*` leaf would also make Swift's restore INVENT record keys that
148
+ * were never there, which is why the walk records the path it descends through
149
+ * but never the `*` position itself.
150
+ */
151
+ interface ModelNullPaths {
152
+ /** Required properties that permit null — a null there is a VALUE and must survive. */
153
+ nullable: ReadonlyArray<SchemaPath>;
154
+ /** Properties absent from their object's `required` — a null there means UNSET. */
155
+ optional: ReadonlyArray<SchemaPath>;
156
+ }
157
+ /** What a target renders from. */
158
+ interface SdkRenderInput {
159
+ /**
160
+ * The rendered model source, to be written as the target's model file.
161
+ *
162
+ * Empty for a target that emits its own model FILES via
163
+ * {@link SdkTarget.renderModels} — those are already written, and this string
164
+ * exists only so the declared-model reconciliation reads one shape.
165
+ */
166
+ models: string;
167
+ /** Namespaces and their functions, already sorted. */
168
+ namespaces: ReadonlyArray<SdkNamespace>;
169
+ }
170
+ /**
171
+ * One directory or file of the hand-written transport, and where it lands in the
172
+ * output.
173
+ *
174
+ * `from` is relative to `sdks/<target id>/` and `to` is relative to `--out`. The
175
+ * two differ because a repo layout and a consumable layout are not the same
176
+ * shape: the Ruby transport lives under `lib/` so `ruby -Ilib` works in the
177
+ * repo, while a vendored copy has no `lib` to point at, and the Rust transport
178
+ * is the repo's root crate but a nested one in the output.
179
+ *
180
+ * Only the runtime is listed. A transport's own conformance suite and its
181
+ * `generated_check/` sample are deliberately absent — they assert against
182
+ * `protocol/fixtures/`, which is not copied, so vendoring them would ship a user
183
+ * a test suite that cannot run.
184
+ */
185
+ interface SdkVendorEntry {
186
+ /** Path under `sdks/<id>/`. A directory is copied recursively. */
187
+ from: string;
188
+ /** Destination path under `--out`. */
189
+ to: string;
190
+ }
191
+ /** A language target. One per `--lang` value. */
192
+ interface SdkTarget {
193
+ /** The `--lang` value (`"python"`, `"go"`, …). */
194
+ id: string;
195
+ /**
196
+ * The quicktype backend + renderer options that produce this target's
197
+ * models, or absent when the target emits its own (see
198
+ * {@link SdkTarget.renderModels}) or none at all.
199
+ *
200
+ * `LanguageName` is quicktype's own union, so a target naming a backend
201
+ * quicktype does not ship fails to compile rather than at run time.
202
+ */
203
+ quicktype?: {
204
+ lang: LanguageName;
205
+ rendererOptions?: Record<string, string>;
206
+ };
207
+ /**
208
+ * Render the SDK. Returns file contents keyed by path relative to the
209
+ * output directory (nested paths are created as needed).
210
+ *
211
+ * This includes the BUILD MANIFEST the layout needs — `go.mod`, `Cargo.toml`,
212
+ * `Package.swift`, a crate root — because those name the vendored transport
213
+ * and are therefore part of "how this language resolves the copy", not
214
+ * something a consumer should have to write. Languages that resolve by
215
+ * directory (Python, Ruby, Java, Kotlin) emit no manifest.
216
+ */
217
+ render: (input: SdkRenderInput) => Record<string, string>;
218
+ /**
219
+ * Emit this target's models from the schema directly, INSTEAD of quicktype,
220
+ * as file contents keyed by path relative to the output directory.
221
+ *
222
+ * Present only for the two JVM targets, and the exception is earned rather
223
+ * than a preference: quicktype's Java and Kotlin backends rename properties
224
+ * and, under `just-types`, emit no mapping metadata, so a model they render
225
+ * cannot be projected back onto the wire — and the only complete mapping
226
+ * they offer requires a Jackson / Klaxon / kotlinx dependency, which is the
227
+ * one thing these JDK-only transports are defined not to have.
228
+ * `targets/java.ts` records every option that was measured.
229
+ *
230
+ * A MAP rather than the single string quicktype returns, because Java takes
231
+ * one file per class: its single-file render is not compilable Java at all.
232
+ * The values are still joined for {@link SdkRenderInput.models}, so the
233
+ * declared-model reconciliation is the same code for every target.
234
+ */
235
+ renderModels?: (document: OpenRpcDocument) => Record<string, string>;
236
+ /**
237
+ * THIRD-PARTY packages a consuming project must still install, reported by
238
+ * the CLI. Empty for six of the eight — the transport is vendored and those
239
+ * six reach the wire with only their standard library.
240
+ *
241
+ * A list, and not derivable from the transport, because a target's MODELS can
242
+ * carry a dependency the transport does not: quicktype's Ruby backend emits
243
+ * `Dry::Struct` types with no renderer option to avoid them, so a Ruby SDK
244
+ * needs the gems even though `sdks/ruby` itself is dependency-free.
245
+ */
246
+ requires: ReadonlyArray<string>;
247
+ /**
248
+ * Which parts of `sdks/<id>/` are the transport, and where they land under
249
+ * `--out`. See {@link SdkVendorEntry}.
250
+ */
251
+ vendor: ReadonlyArray<SdkVendorEntry>;
252
+ }
253
+ /** Every language `lunora sdk generate --lang` accepts, keyed by id. */
254
+ declare const SDK_TARGETS: Readonly<Record<string, SdkTarget>>;
255
+ /** The accepted `--lang` values, sorted — for help text and error messages. */
256
+ declare const SDK_LANGUAGES: ReadonlyArray<string>;
257
+ /** The files a generation run writes, keyed by path relative to the output directory. */
258
+ type SdkFiles = Record<string, string>;
259
+ /** What a generation run produced, plus what it had to weaken and why. */
260
+ interface SdkResult {
261
+ files: SdkFiles;
262
+ /**
263
+ * Model names predicted from the schema that the chosen backend did not
264
+ * declare, so their call sites fell back to an untyped return. Surfaced
265
+ * rather than swallowed — silently weaker types are how an SDK looks
266
+ * finished while returning `Any` everywhere.
267
+ */
268
+ undeclared: ReadonlyArray<string>;
269
+ /**
270
+ * Functions whose args or result carry a `v.bigint()` or `v.bytes()`. No
271
+ * typed model can represent those — the wire needs a tagged value that no
272
+ * generated field produces — so their parameters stay untyped and the
273
+ * caller passes wire values directly.
274
+ */
275
+ unrepresentable: ReadonlyArray<string>;
276
+ }
277
+ /**
278
+ * Generate the SDK for `document` in `target`'s language.
279
+ *
280
+ * Async only because the model layer is: quicktype's renderer is promise-based.
281
+ * The surface itself is pure, so a target's `render` stays synchronous and
282
+ * unit-testable without touching quicktype.
283
+ *
284
+ * Models are rendered BEFORE the surface because the surface's model references
285
+ * depend on what the backend actually declared — see {@link withDeclaredModels}.
286
+ */
287
+ declare const generateSdk: (document: OpenRpcDocument, target: SdkTarget) => Promise<SdkResult>;
288
+ export { type OpenRpcDocument, type OpenRpcMethod, type RuntimeVerb, SDK_LANGUAGES, SDK_TARGETS, type SdkFiles, type SdkMethod, type SdkNamespace, type SdkRenderInput, type SdkResult, type SdkTarget, generateSdk, isTypedSchema };
@@ -1,4 +1,4 @@
1
- import{modelSources as pe,assertDistinctMembers as T,toPascalCase as l,referencedModels as W,generatedHeaderLines as f,commentText as p,argsChoice as $,stringLiteral as m,kotlinLiteral as w,allMethods as x,toSnakeCase as E,parseSpec as Ne,assertGeneratable as Oe,withDeclaredModels as Ce,unrepresentableFunctions as Le,undeclaredModels as Re}from"./isTypedSchema-CKzc3ioR.mjs";import{isTypedSchema as St}from"./isTypedSchema-CKzc3ioR.mjs";const We=async(e,n)=>{if(n.quicktype===void 0)return"";const t=pe(e);if(t.length===0)return"";const{InputData:r,JSONSchemaInput:a,JSONSchemaStore:i,quicktype:o}=await import("quicktype-core");class s extends i{fetch(){return Promise.resolve(void 0)}}const d=new a(new s);for(const g of t)await d.addSource({name:g.name,schema:JSON.stringify(g.schema)});const c=new r;c.addInput(d);const{lines:u}=await o({inputData:c,lang:n.quicktype.lang,rendererOptions:n.quicktype.rendererOptions??{}});return u.join(`
1
+ import{modelSources as pe,assertDistinctMembers as T,toPascalCase as l,referencedModels as W,generatedHeaderLines as f,commentText as p,argsChoice as $,stringLiteral as m,kotlinLiteral as w,allMethods as x,toSnakeCase as E,parseSpec as Ne,assertGeneratable as Oe,withDeclaredModels as Ce,unrepresentableFunctions as Le,undeclaredModels as Re}from"../packem_shared/isTypedSchema-CKzc3ioR.mjs";import{isTypedSchema as St}from"../packem_shared/isTypedSchema-CKzc3ioR.mjs";const We=async(e,n)=>{if(n.quicktype===void 0)return"";const t=pe(e);if(t.length===0)return"";const{InputData:r,JSONSchemaInput:a,JSONSchemaStore:i,quicktype:o}=await import("quicktype-core");class s extends i{fetch(){return Promise.resolve(void 0)}}const d=new a(new s);for(const g of t)await d.addSource({name:g.name,schema:JSON.stringify(g.schema)});const c=new r;c.addInput(d);const{lines:u}=await o({inputData:c,lang:n.quicktype.lang,rendererOptions:n.quicktype.rendererOptions??{}});return u.join(`
2
2
  `)},D=`${f("dart").map(e=>`// ${e}`).join(`
3
3
  `)}
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/codegen",
3
- "version": "1.0.0-alpha.312",
3
+ "version": "1.0.0-alpha.313",
4
4
  "description": "Code generator for Lunora: emits _generated/{api,server,dataModel}.ts from your schema",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -40,6 +40,10 @@
40
40
  "types": "./dist/index.d.ts",
41
41
  "import": "./dist/index.mjs"
42
42
  },
43
+ "./sdk": {
44
+ "types": "./dist/sdk/index.d.ts",
45
+ "import": "./dist/sdk/index.mjs"
46
+ },
43
47
  "./package.json": "./package.json"
44
48
  },
45
49
  "publishConfig": {