import { A as collectEnumRefs, B as IdempotencyPolicy, C as Service, Ct as OverlayLookup, D as UnionType, E as TypeRef, F as walkTypeRef, G as RetryPolicy, H as LoggingPolicy, I as AiAgentEnvVar, J as TimeoutPolicy, K as SdkBehavior, L as BackoffStrategy, M as collectModelRefs, N as collectRequestBodyModels, O as assertNever, P as mapTypeRef, R as DeepPartial, S as ServerEntry, T as TypeParam, U as PaginationPolicy, V as LogEvent, W as RequestGuardPolicy, X as defaultSdkBehavior, Y as UserAgentPolicy, Z as mergeSdkBehavior, _ as Parameter, _t as ApiSurface, a as EnumRef, b as PrimitiveType, bt as Extractor, c as Field, d as MapType, f as Model, g as PaginationMeta, h as Operation, i as Enum, j as collectFieldDependencies, k as assignModelsToServices, l as HttpMethod, m as NullableType, n as ArrayType, o as EnumValue, p as ModelRef, q as TelemetryPolicy, r as AuthScheme, rt as CompatConfig, s as ErrorResponse, t as ApiSpec, u as LiteralType, v as ParameterGroup, w as SuccessResponse, x as SecurityRequirement, y as ParameterGroupVariant, z as ErrorPolicy } from "./types-nM5Kp7UP.mjs"; //#region src/ir/operation-hints.d.ts /** Per-operation override keyed by "METHOD /path" (e.g. "POST /auth/token"). */ interface OperationHint { /** Override the algorithm-derived method name. */ name?: string; /** Remount this operation to a different service/namespace (PascalCase). */ mountOn?: string; /** Split a union-body operation into N typed wrapper methods. */ split?: SplitHint[]; /** Inject constant body defaults (e.g. { grant_type: 'password' }). */ defaults?: Record; /** Fields the SDK reads from client config at runtime (e.g. ['client_id']). */ inferFromClient?: string[]; /** * Marks this operation as a URL builder rather than a real HTTP call. Emitters * should generate a method that returns the constructed URL (typically as a * string) without performing any I/O. Used for OAuth-style redirect endpoints * such as /auth/authorize and /accounts/sessions/logout. */ urlBuilder?: boolean; } interface SplitHint { /** Wrapper method name (snake_case). */ name: string; /** The discriminated union variant model name (e.g. 'PasswordSessionAuthenticateRequest'). */ targetVariant: string; /** Constant body fields injected by the wrapper. */ defaults?: Record; /** Fields the SDK reads from client config at runtime. */ inferFromClient?: string[]; /** Only these body fields are exposed as method params. If omitted, all non-default/non-inferred fields are exposed. */ exposedParams?: string[]; /** * Subset of exposedParams that should be emitted as optional even when the * variant model would otherwise mark them required (or when the variant has * no addressable model, as happens for inline oneOf branches). */ optionalParams?: string[]; } interface ResolvedOperation { /** The original IR operation (preserves description, params, types, etc.). */ operation: Operation; /** The original IR service that owns this operation. */ service: Service; /** Resolved snake_case method name (emitters convert to their convention). */ methodName: string; /** Resolved target service/namespace (PascalCase). */ mountOn: string; /** For split operations: one wrapper per union variant. */ wrappers?: ResolvedWrapper[]; /** Constant defaults injected into query/body at runtime (from operation-level hint). */ defaults: Record; /** Fields the SDK reads from client config at runtime (from operation-level hint). */ inferFromClient: string[]; /** Marks this operation as a URL builder; emitters should not generate an HTTP call. */ urlBuilder: boolean; } interface ResolvedWrapper { /** Wrapper method name (snake_case). */ name: string; /** The discriminated union variant model name. */ targetVariant: string; /** Constant body defaults injected by the wrapper. */ defaults: Record; /** Fields read from client config at runtime. */ inferFromClient: string[]; /** Body fields exposed as method params. */ exposedParams: string[]; /** Optional body fields (not required in the variant). */ optionalParams: string[]; /** Response model name (if any). */ responseModelName: string | null; } /** * Derive a snake_case method name from an operation's HTTP method and path. * * Rules: * 1. Strip path-param segments (`{id}`, `{slug}`, etc.) * 2. If the terminal segment is an action verb, use it as the verb * 3. Otherwise, use the CRUD verb for the HTTP method * 4. For GET on a collection (no trailing {id}), use "list"; with {id}, use "get" * 5. For POST on a resource path, if only one path param, use "create" singular * 6. Singularize the resource noun for single-resource operations */ declare function deriveMethodName(op: Operation, _service: Service): string; /** * Resolve all operations in the spec, applying hints and mount rules. * * @param spec - The parsed API spec * @param hints - Per-operation overrides keyed by "METHOD /path" * @param mountRules - Service name → target service mappings * @returns Resolved operations ready for emitter consumption */ declare function resolveOperations(spec: ApiSpec, hints?: Record, mountRules?: Record): ResolvedOperation[]; //#endregion //#region src/errors.d.ts /** * Structured error hierarchy for oagen. * * Every error carries a human-readable `hint` that suggests a recovery action. * The hint is appended to the `message` so it appears in stack traces and logs. */ /** Base class for all oagen errors. */ declare class OagenError extends Error { readonly hint: string; constructor(message: string, hint: string); } /** Thrown when a command should terminate with a specific exit code. */ declare class CommandError extends OagenError { readonly exitCode: number; constructor(message: string, hint: string, exitCode: number); } /** Thrown when an OpenAPI spec cannot be parsed or has an unsupported version. */ declare class SpecParseError extends OagenError { constructor(message: string, hint: string); } /** Thrown when configuration files (manifests, API surfaces, overlays) are missing or malformed. */ declare class ConfigError extends OagenError { constructor(message: string, hint: string); } /** Thrown when a config file exists but cannot be loaded or evaluated. */ declare class ConfigLoadError extends ConfigError { constructor(message: string, hint: string); } /** Thrown when a config targets a different IR version than the installed package. */ declare class ConfigVersionMismatchError extends ConfigError { constructor(message: string, hint: string); } /** Thrown when an API surface extractor encounters a problem. */ declare class ExtractorError extends OagenError { constructor(message: string, hint: string); } /** Thrown when a requested language or extractor is not found in a registry. */ declare class RegistryError extends OagenError { constructor(message: string, hint: string); } /** Thrown for internal invariant violations that indicate a bug. */ declare class InternalError extends OagenError { constructor(message: string, hint: string); } //#endregion //#region src/engine/types.d.ts interface GeneratedFile { path: string; content: string; skipIfExists?: boolean; headerPlacement?: 'prepend' | 'skip'; /** When false, exclude this file from --target integration. Defaults to true. */ integrateTarget?: boolean; /** When true, always overwrite existing file instead of merging. Defaults to false. */ overwriteExisting?: boolean; } interface EmitterContext { namespace: string; namespacePascal: string; spec: ApiSpec; outputDir?: string; apiSurface?: ApiSurface; overlayLookup?: OverlayLookup; /** Resolved operations from the hint-aware resolver. Populated by buildEmitterContext(). */ resolvedOperations?: ResolvedOperation[]; /** * Model-placement pins from `OagenConfig.modelHints`. Emitters that call * `assignModelsToServices` should pass this through so hinted models land in * the configured service instead of the default first-reference winner. */ modelHints?: Record; /** Language-specific emitter options from config for the active emitter. */ emitterOptions?: Record; /** Absolute path to the integration target directory (when --target is used). */ targetDir?: string; /** * Scoped-generation signal: the set of POST-MOUNT service names a `--services` * run selected. When present and non-empty, emitters must emit ONLY these * services' per-service resource/test files, while still emitting models, * enums, the root client, and all aggregate/barrel files from the FULL spec * (so shared files stay byte-identical and a brand-new selected service is * wired into the client automatically). Absent/empty ⇒ full generation. */ scopedServices?: Set; /** * Scoped-generation model/enum allow-lists: names of models/enums reachable * from the selected services. When `scopedServices` is active, * emitters must write a per-model/per-enum FILE only when its name is in these * sets — but must still include EVERY model/enum (the full set passed to * generateModels/generateEnums) in barrels/indexes, so on-disk files for * out-of-scope models (left untouched) stay importable. Absent ⇒ write all. */ scopedModelNames?: Set; scopedEnumNames?: Set; /** * Paths (relative to the output/target dir) that the previous run wrote, * loaded from that directory's `.oagen-manifest.json`. Emitters can use this * to distinguish "file exists because oagen wrote it last time" from "file * exists because a human wrote it" — the former is safe to overwrite, the * latter should be merged. */ priorTargetManifestPaths?: Set; } interface FormatCommand { /** The executable to run (e.g., "npx", "gofmt", "bundle"). */ cmd: string; /** Arguments before the file list (e.g., ["prettier", "--write"]). */ args: string[]; /** Max files per invocation (to avoid OS arg-length limits). Defaults to 100. */ batchSize?: number; } /** Maps "METHOD /path" to SDK method info. Values may be arrays for polymorphic operations. */ type OperationsMapEntry = { sdkMethod: string; service: string; }; type OperationsMap = Record; interface Emitter { language: string; generateModels(models: Model[], ctx: EmitterContext): GeneratedFile[]; generateEnums(enums: Enum[], ctx: EmitterContext): GeneratedFile[]; generateResources(services: Service[], ctx: EmitterContext): GeneratedFile[]; generateClient(spec: ApiSpec, ctx: EmitterContext): GeneratedFile[]; generateErrors(ctx: EmitterContext): GeneratedFile[]; generateTypeSignatures?(spec: ApiSpec, ctx: EmitterContext): GeneratedFile[]; generateTests(spec: ApiSpec, ctx: EmitterContext): GeneratedFile[]; /** Optional: build operation-to-SDK-method mapping, stored in .oagen-manifest.json */ buildOperationsMap?(spec: ApiSpec, ctx: EmitterContext): OperationsMap; fileHeader(): string; /** * Optional: return a format command to run on generated files after target * integration. The emitter can inspect the target directory to detect the * project's formatter (e.g., prettier config, .editorconfig, Gemfile). * Return null to skip formatting. */ formatCommand?(targetDir: string): FormatCommand | null; } //#endregion //#region src/differ/types.d.ts interface DiffReport { oldVersion: string; newVersion: string; changes: Change[]; /** * Cross-cutting events that change observable runtime behavior for callers * who did not previously set the affected parameter explicitly. Surfaced * separately so PR-description tooling can flag them as breaking even when * the type signatures of the operation are otherwise unchanged. */ behaviorChanges: BehaviorChange[]; summary: { added: number; removed: number; modified: number; breaking: number; additive: number; behaviorChanges: number; }; } interface BehaviorChange { kind: 'param-default-changed'; /** Service name (e.g. 'authorization', 'accounts'). */ serviceName: string; /** Operation name within the service. */ operationName: string; /** Parameter name (e.g. 'order', 'limit'). */ paramName: string; /** 'path' | 'query' | 'header'. */ paramLocation: 'path' | 'query' | 'header'; /** Old default value as a string, or null if previously unset. */ oldDefault: string | null; /** New default value as a string, or null if now unset. */ newDefault: string | null; classification: 'breaking'; } type Change = ModelAdded | ModelRemoved | ModelModified | EnumAdded | EnumRemoved | EnumModified | ServiceAdded | ServiceRemoved | OperationAdded | OperationRemoved | OperationModified; interface ModelAdded { kind: 'model-added'; name: string; classification: 'additive'; } interface ModelRemoved { kind: 'model-removed'; name: string; classification: 'breaking'; } interface ModelModified { kind: 'model-modified'; name: string; fieldChanges: FieldChange[]; classification: 'additive' | 'breaking'; } interface FieldChange { kind: 'field-added' | 'field-removed' | 'field-type-changed' | 'field-format-changed' | 'field-required-changed' | 'field-access-changed'; fieldName: string; classification: 'additive' | 'breaking'; details?: string; } interface EnumAdded { kind: 'enum-added'; name: string; classification: 'additive'; } interface EnumRemoved { kind: 'enum-removed'; name: string; classification: 'breaking'; } interface EnumModified { kind: 'enum-modified'; name: string; valueChanges: EnumValueChange[]; classification: 'additive' | 'breaking'; } interface EnumValueChange { kind: 'value-added' | 'value-removed' | 'value-changed'; valueName: string; classification: 'additive' | 'breaking'; details?: string; } interface ServiceAdded { kind: 'service-added'; name: string; classification: 'additive'; } interface ServiceRemoved { kind: 'service-removed'; name: string; classification: 'breaking'; } interface OperationAdded { kind: 'operation-added'; serviceName: string; operationName: string; classification: 'additive'; } interface OperationRemoved { kind: 'operation-removed'; serviceName: string; operationName: string; classification: 'breaking'; } interface OperationModified { kind: 'operation-modified'; serviceName: string; operationName: string; paramChanges: ParamChange[]; responseChanged: boolean; requestBodyChanged: boolean; httpMethodChanged: boolean; pathChanged: boolean; paginatedChanged: boolean; injectIdempotencyKeyChanged: boolean; errorsChanged: boolean; classification: 'additive' | 'breaking'; } interface ParamChange { kind: 'param-added' | 'param-removed' | 'param-type-changed' | 'param-format-changed' | 'param-required-changed' | 'param-default-changed'; paramName: string; classification: 'additive' | 'breaking'; /** For `param-default-changed`: serialized old default value, or `null` if previously unset. */ oldDefault?: string | null; /** For `param-default-changed`: serialized new default value, or `null` if now unset. */ newDefault?: string | null; /** For `param-default-changed`: 'query' | 'header' | 'path' — where the parameter lives. */ paramLocation?: 'path' | 'query' | 'header'; details?: string; } //#endregion //#region src/parser/parse.d.ts /** * A bundled OpenAPI document, post-`$ref` resolution but pre-IR extraction. * * This is the shape the spec author wrote, with external refs inlined and * internal refs left intact. It is intentionally loose (`Record`) so `transformSpec` can reach arbitrary spec extensions without * fighting types — narrow with `as` at use sites. */ type OpenApiDocument = Record; interface ParseOptions { operationIdTransform?: (id: string) => string; schemaNameTransform?: (name: string) => string; /** * Domain-facing field-name overrides, keyed by IR model name then wire field * name: `{ Connection: { connection_type: 'type' } }`. Sets `Field.domainName` * so emitters expose the field under the friendlier name while keeping the * wire key. Language-agnostic — honored by any emitter that reads `domainName`. */ fieldHints?: Record>; /** * Pre-IR overlay applied to the bundled OpenAPI document before any IR * extraction runs. Use this when the upstream spec can't be changed but you * need to patch around a spec quirk that would otherwise emit a breaking SDK * change — e.g. rewriting a path's response `$ref` back to its prior schema, * merging the new fields onto the prior schema, and dropping the fork. * * The function may mutate the document in place and return it, or return a * new object; the returned value is what the rest of oagen sees. * * Runs once, after `$ref` bundling and before schema/operation extraction. * If you need to inspect the resulting IR instead, post-process the * `ApiSpec` returned by `parseSpec`. */ transformSpec?: (spec: OpenApiDocument) => OpenApiDocument; } declare function parseSpec(specPath: string, options?: ParseOptions): Promise; //#endregion //#region src/engine/orchestrator.d.ts declare function generate(spec: ApiSpec, emitter: Emitter, options: { namespace: string; dryRun?: boolean; outputDir: string; target?: string; apiSurface?: ApiSurface; overlayLookup?: OverlayLookup; operationHints?: Record; mountRules?: Record; modelHints?: Record; emitterOptions?: Record; /** When true, skip deletion of files recorded in the previous manifest but not in the current emission. */ noPrune?: boolean; /** * Post-mount service names to generate (a `--services` run). When non-empty, * the FULL spec is still emitted for models/enums/client/barrels (so shared * files stay byte-identical and a brand-new selected service is wired into the * client automatically); only per-service resource/test emission is gated to * the selection (via `ctx.scopedServices`). Pruning is disabled and the * manifest is merged so unselected services' records survive. */ services?: string[]; }): Promise; //#endregion //#region src/engine/generate-files.d.ts declare function buildEmitterContext(spec: ApiSpec, options: { namespace: string; outputDir: string; apiSurface?: ApiSurface; overlayLookup?: OverlayLookup; operationHints?: Record; mountRules?: Record; modelHints?: Record; emitterOptions?: Record; target?: string; priorTargetManifestPaths?: Set; scopedServices?: Set; }): EmitterContext; /** * Collect model and enum names transitively referenced by service operations. * Walks operation parameters, request bodies, responses, and pagination item * types, then chases model field references until the set stabilizes. */ declare function collectReferencedNames(services: Service[], models: Model[], opts?: { preserveAllDiscriminated?: boolean; }): { models: Set; enums: Set; }; /** * Collect all generated files from an emitter (no headers, no path prefixes). * * In a scoped (`--services`) run the spec is NOT filtered: every generator runs * over the full spec so model placement, dedup, the root client, and all * aggregate/barrel files are byte-identical to a full run (and a brand-new * selected service is wired into the client automatically). The emitters * themselves consult `ctx.scopedServices` to emit only the selected services' * per-service resource/test files. */ declare function generateAllFiles(spec: ApiSpec, emitter: Emitter, ctx: EmitterContext): GeneratedFile[]; /** Apply file header to generated files, respecting headerPlacement and JSON files. */ declare function applyFileHeaders(files: GeneratedFile[], header: string): GeneratedFile[]; declare function generateFiles(spec: ApiSpec, emitter: Emitter, options: { namespace: string; outputDir: string; apiSurface?: ApiSurface; overlayLookup?: OverlayLookup; operationHints?: Record; mountRules?: Record; modelHints?: Record; emitterOptions?: Record; target?: string; priorTargetManifestPaths?: Set; /** Scoped-generation signal (POST-MOUNT names); set on ctx for emitters to gate per-service emission. */ scopedServices?: Set; }): { files: GeneratedFile[]; ctx: EmitterContext; header: string; operations?: OperationsMap; }; //#endregion //#region src/engine/writer.d.ts interface WriteResult { written: string[]; merged: string[]; skipped: string[]; identical: string[]; ignored: string[]; } //#endregion //#region src/engine/integrate.d.ts /** * Build a file-level dependency graph from generated files and return only * files reachable from root entry points. Uses tree-sitter to parse imports. */ declare function treeShakeFiles(files: GeneratedFile[], language: string): Promise; declare function mapFilesForTargetIntegration(files: GeneratedFile[], language: string): GeneratedFile[]; interface IntegrateResult extends WriteResult { /** Final set of paths this run claims ownership of in the target (post tree-shake + conflict resolution). */ emittedPaths: string[]; } declare function integrateGeneratedFiles(opts: { files: GeneratedFile[]; language: string; targetDir: string; header: string; }): Promise; //#endregion //#region src/engine/registry.d.ts declare function registerEmitter(emitter: Emitter): void; declare function getEmitter(language: string): Emitter; //#endregion //#region src/differ/diff.d.ts declare function diffSpecs(oldSpec: ApiSpec, newSpec: ApiSpec): DiffReport; //#endregion //#region src/utils/naming.d.ts declare const ACRONYM_SET: Set; declare function toPascalCase(s: string, acronyms?: Set): string; declare function toCamelCase(s: string, acronyms?: Set): string; declare function toSnakeCase(s: string): string; declare function toKebabCase(s: string): string; declare function toUpperSnakeCase(s: string): string; declare function stripBackendPrefixes(name: string): string; declare function cleanSchemaName(name: string): string; //#endregion //#region src/engine/operation-plan.d.ts interface OperationPlan { operation: Operation; isDelete: boolean; hasBody: boolean; isIdempotentPost: boolean; pathParamsInOptions: boolean; isPaginated: boolean; responseModelName: string | null; /** For paginated operations, the model name of individual list items * (unwrapped from the list wrapper). Null for non-paginated. */ paginatedItemModelName: string | null; isModelResponse: boolean; /** True when the response is an unpaginated `type: array` of models. * Emitters should use this to return `Model[]` (or the language's list * equivalent) and map the deserializer over each element. */ isArrayResponse: boolean; hasQueryParams: boolean; isAsync: boolean; } declare function planOperation(op: Operation): OperationPlan; //#endregion //#region src/cli/config-loader.d.ts interface OagenConfig { emitters?: Emitter[]; extractors?: Extractor[]; /** Compatibility verification policy. See docs/core/compatibility-policy.md. */ compat?: CompatConfig; /** Path to the emitter project (where skills scaffold new emitters, tests, smoke runners). */ emitterProject?: string; /** Map from language key to custom smoke runner script path. */ smokeRunners?: Record; /** * Custom transform for operation IDs. When provided, replaces the default * camelCase pass-through. Receives the raw operationId string; return the * desired operation name (no additional conversion is applied). * */ operationIdTransform?: (id: string) => string; /** * Custom transform for schema (model/enum) names. Applied after the built-in * cleanSchemaName normalization. Receives the cleaned PascalCase name; return * the desired name. Collisions are detected automatically -- if a transform * would produce a duplicate name, the original is kept. */ schemaNameTransform?: (name: string) => string; /** Base URL for documentation links. When set, relative paths in descriptions * (e.g. `/reference/users/user`) are expanded to full URLs. */ docUrl?: string; /** * Pre-IR overlay applied to the bundled OpenAPI document before any IR * extraction. Use this when the upstream spec can't be changed but a quirk * in it would otherwise emit a breaking SDK change — e.g. rewriting a * path's response `$ref` back to its prior schema, merging the new fields * onto the prior schema, and dropping the fork schema. * * The function may mutate the document in place and return it, or return a * new object. Runs once, after `$ref` bundling and before schema/operation * extraction. See `docs/advanced/transform-spec.md` for examples. */ transformSpec?: (spec: OpenApiDocument) => OpenApiDocument; /** * Per-operation overrides keyed by "METHOD /path" (e.g. "POST /auth/token"). * Used by the operation resolver to override derived method names, mount * targets, and to split union-body operations into typed wrappers. */ operationHints?: Record; /** * Service-level mount rules: maps an IR service name to a target * service/namespace (PascalCase). All operations in the source service * are mounted on the target. Per-operation mountOn in operationHints * takes priority. */ mountRules?: Record; /** * Pin specific models to a specific IR service for placement, overriding the * default "first service to reference the model wins" assignment. * * Maps IR model name → IR service name (both PascalCase). Useful when a model * is shared across services and the natural ordering would place it in a * service that's wrong for the public API. * * Both names must exist in the parsed spec; unknown names throw at generation * time so typos fail loud. Note that keys are post-cleanSchemaName / * post-schemaNameTransform model names (e.g. `User`, not `UserlandUser`). */ modelHints?: Record; /** * Domain-facing field-name overrides, keyed by IR model name then wire field * name: `{ Connection: { connection_type: 'type' } }`. Sets `Field.domainName` * so every emitter can expose the field under a friendlier domain name while * keeping the wire key unchanged. */ fieldHints?: Record>; /** * Language-specific emitter options. The CLI passes only the active * language's option bag to that emitter. */ emitterOptions?: Record>; } //#endregion //#region src/snippets/example-builder.d.ts /** * Builds illustrative example values for IR types. Used by snippet emitters * to produce realistic argument values in call-site samples. * * Values prefer, in order: * 1. An explicit `example` carried on the field/param. * 2. The `default` from the schema. * 3. The first enum value, when the type is an enum. * 4. A type-driven default (e.g. `"string_example"`, `1`, `true`). * * Recursion through models/arrays/maps is depth-limited; cyclic models * collapse to a placeholder object rather than blowing the stack. */ interface ExampleBuilder { /** Build an example value for a single type reference (no field metadata). */ forType(type: TypeRef): unknown; /** Build an example value for a field, honoring its `example`/`default`. */ forField(field: Field): unknown; /** Build an example object from a model, keyed by field wire name. */ forModel(model: Model | string): Record; } declare function createExampleBuilder(spec: ApiSpec): ExampleBuilder; //#endregion //#region src/snippets/types.d.ts /** * A call-site code sample for one SDK operation. * * Snippet emitters produce these instead of full SDK source files. Consumers * (REST API docs builds, partner integrations, etc.) decide where to write * them based on their own layout conventions — see * {@link snippetResultsToFiles} for a default file-per-snippet layout. */ interface SnippetResult { /** Language key (e.g. 'ruby', 'node'). Matches the underlying SDK emitter. */ language: string; /** File extension without the leading dot (e.g. 'rb', 'js', 'cs'). */ fileExtension: string; /** Stable identifier for the operation: `${mountTarget}.${methodName}`. */ operationId: string; /** PascalCase mount target the method lives on (e.g. 'Organizations'). */ mountTarget: string; /** snake_case method name as resolved by oagen (e.g. 'create_organization'). */ methodName: string; /** The rendered snippet, ending in a trailing newline. */ content: string; } /** * A snippet emitter renders one call-site example per resolved SDK operation * in a specific language. Unlike the full {@link Emitter} contract, snippet * emitters don't generate models, enums, or clients — only short, runnable * call samples. * * Implementations typically reuse the corresponding full emitter's naming * helpers (e.g. `src//naming.ts`) so generated snippets stay in * lockstep with the SDK they document. Framework primitives like * {@link collectSnippetArgs} live in `@workos/oagen` so emitter authors * don't have to reimplement the required-only / hidden-param / split-wrapper * logic per language. */ interface SnippetEmitter { /** Language key (must match the full emitter's `language`). */ language: string; /** File extension without the leading dot. */ fileExtension: string; /** * Render a single resolved operation as a complete, runnable snippet. * * Return `null` to skip — e.g. for URL-builder operations that don't make * an HTTP call, or other shapes the language SDK doesn't expose. */ renderOperation(resolved: ResolvedOperation, ctx: EmitterContext, examples: ExampleBuilder): string | null; } //#endregion //#region src/snippets/runner.d.ts /** * Run one or more snippet emitters over every resolved operation in the spec. * * Iteration order matches `ctx.resolvedOperations`. For each operation the * runner asks every emitter to render once; emitters that return `null` * contribute nothing for that op (the URL-builder / unsupported case). * * Returns a flat list of {@link SnippetResult}. Consumers map these to * file paths according to their own layout — see * {@link snippetResultsToFiles} for a convenience that writes * `//-request.`. */ declare function runSnippetEmitters(emitters: SnippetEmitter[], ctx: EmitterContext): SnippetResult[]; /** * Convenience: turn snippet results into oagen-style {@link GeneratedFile}s * under `//-request.`. * * Useful for consumers wired into the standard oagen file-writing pipeline. * Docs builds that already have their own per-tag file layout (e.g. * `content/reference/{tag}/_code/...`) typically skip this helper and route * `SnippetResult.operationId` / `mountTarget` through their own mapping. */ declare function snippetResultsToFiles(results: SnippetResult[], outputDir?: string): GeneratedFile[]; //#endregion //#region src/snippets/shared.d.ts /** * One argument resolved for a call-site snippet. The {@link wireName} stays * in the spec's casing so each language emitter can apply its own * field/param casing rules (snake_case for Python/Ruby/PHP, PascalCase for * Go/.NET, etc.). * * Path and query params carry their {@link Parameter} so emitters can pick * language-specific safe names; body args carry their {@link Field} so * emitters can read field-level metadata (deprecated, type details). */ interface SnippetArg { /** 'path' | 'body' | 'query' — used by emitters to pick a casing rule. */ source: 'path' | 'body' | 'query'; /** Spec wire name (e.g. `domain_data`, `client_id`). */ wireName: string; /** Pre-computed illustrative value (string, number, array, object, ...). */ value: unknown; /** Original parameter for path/query args, null for body fields. */ parameter: Parameter | null; /** Original field for body args, null for path/query params. */ field: Field | null; } /** * Resolve the set of required arguments for a snippet. Body fields are * expanded from the request body model; defaults / inferFromClient fields * are filtered out (they're injected by the SDK, not the caller). * * Iteration order: path params, then required body fields, then required * query params. Wire-name collisions between body and path are reported in * {@link collisionNames} so the emitter can rename whichever side it * prefers (e.g. prefix body field with `body_`). */ interface CollectedArgs { args: SnippetArg[]; /** Body field wire names that also appear as path params. */ collisionNames: Set; } declare function collectSnippetArgs(resolved: ResolvedOperation, ctx: EmitterContext, examples: ExampleBuilder): CollectedArgs; /** * Build the arg list for a single split (wrapper) variant. The wrapper's * `exposedParams` is the contract; fields are looked up on the variant model * by exact name and then snake-case-normalized name. Optional status comes * from `wrapper.optionalParams` first, then from the field's `required` flag. */ declare function collectWrapperArgs(wrapper: ResolvedWrapper, ctx: EmitterContext, examples: ExampleBuilder): SnippetArg[]; declare function hiddenParamSet(resolved: ResolvedOperation): Set; //#endregion export { ACRONYM_SET, type AiAgentEnvVar, type ApiSpec, type ArrayType, type AuthScheme, type BackoffStrategy, type Change, type CollectedArgs, CommandError, ConfigError, ConfigLoadError, ConfigVersionMismatchError, type DeepPartial, type DiffReport, type Emitter, type EmitterContext, type Enum, type EnumAdded, type EnumModified, type EnumRef, type EnumRemoved, type EnumValue, type EnumValueChange, type ErrorPolicy, type ErrorResponse, type ExampleBuilder, ExtractorError, type Field, type FieldChange, type FormatCommand, type GeneratedFile, type HttpMethod, type IdempotencyPolicy, InternalError, type LiteralType, type LogEvent, type LoggingPolicy, type MapType, type Model, type ModelAdded, type ModelModified, type ModelRef, type ModelRemoved, type NullableType, type OagenConfig, OagenError, type OpenApiDocument, type Operation, type OperationAdded, type OperationHint, type OperationModified, type OperationPlan, type OperationRemoved, type OperationsMap, type OperationsMapEntry, type PaginationMeta, type PaginationPolicy, type ParamChange, type Parameter, type ParameterGroup, type ParameterGroupVariant, type ParseOptions, type PrimitiveType, RegistryError, type RequestGuardPolicy, type ResolvedOperation, type ResolvedWrapper, type RetryPolicy, type SdkBehavior, type SecurityRequirement, type ServerEntry, type Service, type ServiceAdded, type ServiceRemoved, type SnippetArg, type SnippetEmitter, type SnippetResult, SpecParseError, type SplitHint, type SuccessResponse, type TelemetryPolicy, type TimeoutPolicy, type TypeParam, type TypeRef, type UnionType, type UserAgentPolicy, applyFileHeaders, assertNever, assignModelsToServices, buildEmitterContext, cleanSchemaName, collectEnumRefs, collectFieldDependencies, collectModelRefs, collectReferencedNames, collectRequestBodyModels, collectSnippetArgs, collectWrapperArgs, createExampleBuilder, defaultSdkBehavior, deriveMethodName, diffSpecs, generate, generateAllFiles, generateFiles, getEmitter, hiddenParamSet, integrateGeneratedFiles, mapFilesForTargetIntegration, mapTypeRef, mergeSdkBehavior, parseSpec, planOperation, registerEmitter, resolveOperations, runSnippetEmitters, snippetResultsToFiles, stripBackendPrefixes, toCamelCase, toKebabCase, toPascalCase, toSnakeCase, toUpperSnakeCase, treeShakeFiles, walkTypeRef }; //# sourceMappingURL=index.d.mts.map