//#region src/compat/policy.d.ts /** Policy hints that determine what constitutes a breaking change. */ interface CompatPolicyHints { /** Callers reference parameter names at the call site (PHP named args, Python/Ruby keyword args, Kotlin/C# named args). */ callerUsesParamNames: boolean; /** Constructor positional order is part of the public API. */ constructorOrderMatters: boolean; /** Method parameter names are visible to callers. */ methodParameterNamesArePublicApi: boolean; /** Constructor parameter names are visible to callers. */ constructorParameterNamesArePublicApi: boolean; /** Method overload sets are part of the public API (Kotlin, C#). */ overloadsArePublicApi: boolean; /** Function arity is part of the public API (Elixir, Go). */ arityIsPublicApi: boolean; } /** Get the built-in default policy for a language. */ declare function getDefaultPolicy(language: LanguageId): CompatPolicyHints; /** Merge user overrides onto language defaults. Only provided keys are overridden. */ declare function mergePolicy(defaults: CompatPolicyHints, overrides: Partial): CompatPolicyHints; /** All supported language IDs. */ declare const ALL_LANGUAGE_IDS: readonly LanguageId[]; //#endregion //#region src/compat/ir.d.ts /** Language identifier for emitter targets. */ type LanguageId = 'node' | 'php' | 'python' | 'ruby' | 'go' | 'kotlin' | 'dotnet' | 'elixir' | 'rust'; /** A full compatibility snapshot of an SDK's public API surface. */ interface CompatSnapshot { schemaVersion: string; source: { specSha?: string; extractedAt: string; }; policies: CompatPolicyHints; symbols: CompatSymbol[]; } /** Kind of public API symbol. */ type CompatSymbolKind = 'service_accessor' | 'callable' | 'constructor' | 'field' | 'property' | 'enum' | 'enum_member' | 'alias'; /** Visibility level of a symbol. */ type CompatVisibility = 'public' | 'protected' | 'internal'; /** Stability classification of a symbol. */ type CompatStability = 'stable' | 'unstable' | 'deprecated'; /** How the symbol was generated. */ type CompatSourceKind = 'generated_service_wrapper' | 'generated_model_constructor' | 'generated_resource_constructor' | 'generated_enum' | 'compat_alias'; /** A single public API symbol with its full metadata. */ interface CompatSymbol { id: string; kind: CompatSymbolKind; fqName: string; ownerFqName?: string; displayName: string; visibility: CompatVisibility; stability: CompatStability; sourceKind: CompatSourceKind; operationId?: string; schemaName?: string; route?: { method: string; path: string; }; parameters?: CompatParameter[]; returns?: CompatTypeRef; /** Type reference for field/property symbols. */ typeRef?: CompatTypeRef; /** Value for enum member symbols. */ value?: string | number; /** Relative path to the source file where this symbol is defined. */ sourceFile?: string; } /** How a parameter is passed at the call site. */ type CompatPassingStyle = 'positional' | 'keyword' | 'named' | 'keyword_or_positional' | 'options_object' | 'builder'; /** A parameter on a callable or constructor symbol. */ interface CompatParameter { publicName: string; wireName?: string; position: number; required: boolean; nullable: boolean; hasDefault: boolean; passing: CompatPassingStyle; type: CompatTypeRef; sensitivity: ParameterSensitivity; } /** Which aspects of this parameter are part of the public API contract. */ interface ParameterSensitivity { order: boolean; publicName: boolean; requiredness: boolean; type: boolean; } /** A type reference — either a named type or an inline description. */ interface CompatTypeRef { name: string; nullable?: boolean; array?: boolean; generic?: string[]; } /** * Convert a legacy ApiSurface to a CompatSnapshot. * * This bridge allows existing extractors (which produce ApiSurface) to feed * into the new classified diff engine without requiring immediate migration. */ declare function apiSurfaceToSnapshot(surface: ApiSurface): CompatSnapshot; //#endregion //#region src/compat/types.d.ts interface ApiSurface { language: string; extractedFrom: string; extractedAt: string; classes: Record; interfaces: Record; typeAliases: Record; enums: Record; exports: Record; } interface ApiClass { name: string; sourceFile?: string; methods: Record; properties: Record; constructorParams: ApiParam[]; /** Present when the class JSDoc carries `@deprecated`. Emitters use this * to propagate deprecation to the service property on the client class * so IDEs surface the strikethrough at the access site, not just when * users instantiate the class directly. */ deprecationMessage?: string; } interface ApiMethod { name: string; params: ApiParam[]; returnType: string; async: boolean; } interface ApiParam { name: string; type: string; optional: boolean; /** Per-parameter passing style, populated by extractors. * When absent, the bridge infers from language defaults. */ passingStyle?: CompatPassingStyle; } interface ApiProperty { name: string; type: string; readonly: boolean; } interface ApiInterface { name: string; sourceFile?: string; fields: Record; extends: string[]; /** True if the resource class defines its own constructFromResponse (not inherited). */ hasCustomConstructor?: boolean; } interface ApiField { name: string; type: string; optional: boolean; } interface ApiTypeAlias { name: string; sourceFile?: string; value: string; } interface ApiEnum { name: string; sourceFile?: string; members: Record; } interface LanguageHints { /** Strip nullable wrapper, return inner type. null if not nullable. * Node: "string | null" → "string" * Go: "*Organization" → "Organization" * Python: "Optional[str]" → "str" */ stripNullable(type: string): string | null; /** True if a and b differ only by nullability. */ isNullableOnlyDifference(a: string, b: string): boolean; /** True if a and b are union types with same members in different order. */ isUnionReorder(a: string, b: string): boolean; /** True if type is a generic type parameter the extractor can't resolve. */ isGenericTypeParam(type: string): boolean; /** True if type is an extraction artifact (extractor couldn't resolve). * Node: "any"; Python: "Any"; Go: "interface{}" */ isExtractionArtifact(type: string): boolean; /** Whether a missing type alias should be tolerated when the candidate * has the same name as an interface or class (TS allows this). */ tolerateCategoryMismatch: boolean; /** Extract innermost meaningful type name from a return type string. * Node: "Promise>" → "Organization" */ extractReturnTypeName(returnType: string): string | null; /** Extract meaningful type name from a param type string. null for primitives. */ extractParamTypeName(paramType: string): string | null; /** True if sdkResourceProperty maps to className. * Node: camelCase ("organizations" → "Organizations") * Ruby: snake_case ("organizations" → "Organizations") */ propertyMatchesClass(propertyName: string, className: string): boolean; /** Additional names derived from a model name by this language's emitter. * Node: ["FooResponse", "SerializedFoo"] * Go: ["FooResponse"] */ derivedModelNames(modelName: string): string[]; /** True if two type strings are semantically equivalent even when * structurally different — e.g., a named enum vs an inline union * of its string literal values. The candidate surface is provided * so the hint can look up enum definitions. * Returns true to suppress the mismatch, false to report it. */ isTypeEquivalent?(baselineType: string, candidateType: string, candidateSurface: ApiSurface): boolean; /** True if two method signatures should be considered equivalent despite * structural differences. Called as a fallback when strict positional * matching fails — e.g., when the baseline unpacks body fields into * individual params while the candidate uses a dict/array payload. * Returns true to suppress the mismatch. */ isSignatureEquivalent?(baseline: ApiMethod, candidate: ApiMethod, candidateSurface: ApiSurface): boolean; /** Base class names that indicate a data model (→ ApiInterface). * Python: ["BaseModel"]; PHP: ["BaseResource"]. * Extractors should provide these for their SDK. */ modelBaseClasses?: string[]; /** Base class names that indicate an exception class. * Python: ["Exception", "BaseException"]; PHP: ["Exception"]. */ exceptionBaseClasses?: string[]; /** Type names for list/paginated resource wrappers (for return type unwrapping). * The first type argument is extracted as the inner item type. * e.g., ["ListResource"] causes `ListResource[Org, ...]` → `Org`. */ listResourcePatterns?: string[]; } interface Extractor { language: string; extract(sdkPath: string): Promise; extractSnapshot(sdkPath: string): Promise; hints: LanguageHints; } interface MethodOverlay { className: string; methodName: string; params: ApiParam[]; returnType: string; } interface OverlayLookup { /** HTTP method + path → existing method info */ methodByOperation: Map; /** Reverse map: "ClassName.methodName" → HTTP key for patchOverlay */ httpKeyByMethod: Map; /** IR interface name → existing interface name */ interfaceByName: Map; /** IR type alias name → existing type alias name */ typeAliasByName: Map; /** Barrel file path → symbols that must be exported */ requiredExports: Map>; /** IR model name → SDK interface name (auto-inferred from field structure) */ modelNameByIR: Map; /** IR symbol name → relative file path in the live SDK */ fileBySymbol: Map; } type ViolationCategory = 'public-api' | 'signature' | 'export-structure' | 'behavioral' | 'staleness'; type ViolationSeverity = 'breaking' | 'warning'; interface Violation { category: ViolationCategory; severity: ViolationSeverity; symbolPath: string; baseline: string; candidate: string; message: string; } interface Addition { symbolPath: string; symbolType: 'class' | 'method' | 'interface' | 'type-alias' | 'enum' | 'property'; } interface DiffResult { preservationScore: number; totalBaselineSymbols: number; preservedSymbols: number; violations: Violation[]; additions: Addition[]; } //#endregion //#region src/compat/config.d.ts /** Breaking change categories — changes that break callers. */ type BreakingChangeCategory = 'symbol_removed' | 'symbol_renamed' | 'parameter_removed' | 'parameter_renamed' | 'parameter_requiredness_increased' | 'parameter_type_narrowed' | 'parameter_position_changed_order_sensitive' | 'constructor_position_changed_order_sensitive' | 'named_arg_name_removed' | 'keyword_name_removed' | 'overload_removed' | 'union_wrapper_migration_without_compat_alias' | 'field_type_changed' | 'return_type_changed' | 'enum_member_value_changed'; /** Soft-risk change categories — may affect callers depending on usage. */ type SoftRiskChangeCategory = 'parameter_added_non_terminal_optional' | 'constructor_reordered_named_friendly' | 'default_value_changed' | 'wrapper_stricter_than_previous_sdk_but_matches_spec' | 'doc_surface_drift'; /** Additive change categories — safe to ship. */ type AdditiveChangeCategory = 'symbol_added' | 'parameter_added_optional_terminal' | 'new_constructor_overload_added' | 'new_wrapper_alias_added'; /** All change categories. */ type CompatChangeCategory = BreakingChangeCategory | SoftRiskChangeCategory | AdditiveChangeCategory; /** Change severity levels. */ type CompatChangeSeverity = 'breaking' | 'soft-risk' | 'additive'; /** Provenance bucket — where the drift originated. */ type CompatProvenance = 'spec_shape_change' | 'spec_ordering_change' | 'emitter_template_change' | 'compat_extractor_change' | 'operation_hint_change' | 'manual_override_change' | 'normalization_change' | 'unknown'; /** Level at which `verify` should fail. */ type CompatFailLevel = 'none' | 'breaking' | 'soft-risk'; /** A single intentional-break approval in `oagen.config.ts`. */ interface CompatApproval { /** Fully-qualified symbol (e.g., "Acme\\Service\\Users::createUser"). */ symbol: string; /** The kind of change being approved. */ category: CompatChangeCategory; /** Languages this approval applies to. Omit for all impacted languages. */ appliesTo?: LanguageId[] | 'all-impacted-languages'; /** Optional narrowing criteria. */ match?: { parameter?: string; member?: string; oldName?: string; newName?: string; }; /** Minimum release level required for this break. */ allowedReleaseLevel?: 'major' | 'minor' | 'patch'; /** Human-readable reason for this approval. */ reason: string; /** Issue tracker reference (e.g., "SDK-1234"). */ issue?: string; /** Auto-expire this approval after a version is released. */ expiresAfterVersion?: string; /** Whether this approval is currently active. */ approved?: boolean; } /** The `compat` section of `oagen.config.ts`. */ interface CompatConfig { /** Level at which `oagen verify` should fail. Default: 'breaking'. */ failOn?: CompatFailLevel; /** Path to write the machine-readable compat report. */ reportPath?: string; /** Include provenance explanations in reports. */ explain?: boolean; /** Path to the baseline compatibility snapshot. */ baselinePath?: string; /** Per-language policy overrides. Sparse — only override what diverges. */ languagePolicy?: Partial>>; /** Intentional break approvals. */ allow?: CompatApproval[]; } /** Get the default severity for a change category. */ declare function defaultSeverityForCategory(category: CompatChangeCategory): CompatChangeSeverity; /** Check whether a severity meets or exceeds a fail threshold. */ declare function severityMeetsThreshold(severity: CompatChangeSeverity, threshold: CompatFailLevel): boolean; //#endregion //#region src/ir/sdk-behavior.d.ts /** * SDK Behavior IR — language-agnostic runtime policies for generated SDKs. * * These types capture the "what" of SDK behavior (retry, telemetry, errors, etc.) * while emitters provide the "how" (language-specific mechanism). * * Emitters access these via `ctx.spec.sdk` — always populated, never undefined. */ /** Retry policy — when and how to retry failed requests. */ interface RetryPolicy { /** HTTP status codes that trigger a retry. */ retryableStatusCodes: number[]; /** Maximum number of retry attempts (0 = no retries). */ maxRetries: number; /** Whether to retry on connection errors (DNS failure, TCP reset). */ retryOnConnectionError: boolean; /** Whether to retry on timeout errors. */ retryOnTimeout: boolean; /** Backoff strategy between retries. */ backoff: BackoffStrategy; } /** Exponential backoff configuration. * * Formula: `delay = min(initialDelay * multiplier^attempt, maxDelay)` * With jitter: `delay += delay * jitterFactor * random(0, 1)` */ interface BackoffStrategy { /** Initial delay in seconds before the first retry. */ initialDelay: number; /** Multiplier applied to the delay on each subsequent retry. */ multiplier: number; /** Maximum delay in seconds (cap). */ maxDelay: number; /** Jitter factor (0..1). 0.5 means up to 50% random jitter added. */ jitterFactor: number; } /** Error mapping — status codes to named exception kinds. */ interface ErrorPolicy { /** Map from HTTP status code to a logical error kind name (e.g. 400 → 'BadRequest'). * Emitters append language-specific suffixes (e.g. 'BadRequestException'). */ statusCodeMap: Record; /** Catch-all error kind for 5xx status codes not in the map. */ serverErrorKind: string; /** Catch-all error kind for unrecognized status codes. */ clientErrorKind: string; /** URL template for error documentation. Use {code} as placeholder for the API error code. */ errorDocUrlTemplate?: string; } /** Telemetry — what request metrics to track and send. */ interface TelemetryPolicy { /** Whether telemetry is enabled by default. Users can opt out via constructor param. */ enabledByDefault: boolean; /** Header name for client telemetry data (previous request's ID + latency). */ headerName: string; /** Response header name for the request ID. */ requestIdHeader: string; } /** Pagination behavior defaults. */ interface PaginationPolicy { /** Delay in milliseconds between pages during auto-pagination. 0 = no delay. */ autoPageDelayMs: number; } /** Idempotency auto-generation rules. */ interface IdempotencyPolicy { /** Header name for the idempotency key. */ headerName: string; /** Whether to auto-generate a UUID v4 idempotency key for POST requests when retries > 0. */ autoGenerateForPost: boolean; } /** Logging contract — what to log at which level. */ interface LoggingPolicy { /** Whether structured logging hooks are generated. */ enabled: boolean; /** Log events that the generated client emits. */ events: LogEvent[]; } /** A discrete loggable event in the request lifecycle. */ type LogEvent = 'request.start' | 'request.success' | 'request.retry' | 'request.rate_limited' | 'request.error' | 'request.connection_error'; /** User-Agent construction rules. */ interface UserAgentPolicy { /** Template for the SDK identifier string. * Placeholders: {name} = spec name, {lang} = emitter language, {version} = SDK version. * Each emitter interpolates with its own language string and casing conventions. * Example: '{name} {lang}/{version}' → 'Acme PHP/4.32.0' */ sdkIdentifierTemplate: string; /** Whether to append the runtime/language version (e.g. PHP 8.2, Python 3.12). */ includeRuntimeVersion: boolean; /** Whether to allow app info enrichment via setAppInfo(name, version, url). */ allowAppInfo: boolean; /** AI agent environment variable detection entries. */ aiAgentEnvVars: AiAgentEnvVar[]; } /** Maps an environment variable to an AI agent slug for User-Agent enrichment. */ interface AiAgentEnvVar { /** Environment variable to check (e.g. 'CLAUDE_CODE'). */ envVar: string; /** Agent name to append to User-Agent (e.g. 'ClaudeCode'). */ agentName: string; } /** Guards that validate request params before sending. */ interface RequestGuardPolicy { /** Keys that should be in RequestOptions, not in params. * If detected in the body or query params, the SDK throws an error. */ optionKeys: string[]; } /** Timeout configuration. */ interface TimeoutPolicy { /** Default HTTP request timeout in seconds. */ defaultTimeoutSeconds: number; /** Environment variable name to override the timeout (e.g. 'SDK_REQUEST_TIMEOUT'). */ timeoutEnvVar?: string; } /** Language-agnostic runtime policies for generated SDKs. * Attached to `ApiSpec.sdk` and consumed by emitters via `ctx.spec.sdk`. */ interface SdkBehavior { retry: RetryPolicy; errors: ErrorPolicy; telemetry: TelemetryPolicy; pagination: PaginationPolicy; idempotency: IdempotencyPolicy; logging: LoggingPolicy; userAgent: UserAgentPolicy; requestGuard: RequestGuardPolicy; timeout: TimeoutPolicy; } /** * Canonical SDK behavior defaults. Per-language or per-project overrides can * be applied via `mergeSdkBehavior()` in each SDK's `oagen.config.ts`. * * - Retry: exponential backoff with jitter, retries on 429/5xx * - Errors: standard HTTP status → exception kind mapping * - Telemetry: enabled by default, tracks request ID + latency * - Pagination: no inter-page delay (Node overrides to 350ms) * - Idempotency: auto-generate UUID v4 for retryable POSTs * - Logging: all lifecycle events enabled * - User-Agent: SDK identifier + runtime version + app info + AI agent detection * - Request guards: detect misplaced RequestOptions keys in params * - Timeout: 60s default (Python overrides to 30s) */ declare function defaultSdkBehavior(): SdkBehavior; /** Recursive partial type for deep overrides. */ type DeepPartial = { [K in keyof T]?: T[K] extends (infer U)[] ? U[] : T[K] extends object ? DeepPartial : T[K] }; /** * Deep-merge partial overrides into the canonical defaults. * Arrays replace entirely (so `retryableStatusCodes: [429]` replaces the full list, * rather than appending). Object properties are merged recursively. */ declare function mergeSdkBehavior(overrides: DeepPartial): SdkBehavior; //#endregion //#region src/ir/types.d.ts /** Authentication scheme extracted from OpenAPI securitySchemes */ type AuthScheme = { kind: 'bearer'; } | { kind: 'apiKey'; in: 'header' | 'query' | 'cookie'; name: string; } | { kind: 'oauth2'; flows: Record; }; /** Root IR node representing the full API surface */ /** A server entry from the OpenAPI servers array */ interface ServerEntry { url: string; description?: string; } /** Root IR node representing the full API surface */ interface ApiSpec { name: string; version: string; description?: string; baseUrl: string; servers?: ServerEntry[]; services: Service[]; models: Model[]; enums: Enum[]; auth?: AuthScheme[]; /** Language-agnostic runtime policies (retry, errors, telemetry, etc.). */ sdk: SdkBehavior; } /** A service groups related operations (maps to an SDK resource class) */ interface Service { name: string; description?: string; operations: Operation[]; } /** A single API operation (maps to an SDK method) */ /** Per-operation security requirement: scheme name → scope list. */ interface SecurityRequirement { schemeName: string; scopes: string[]; } interface Operation { name: string; description?: string; httpMethod: HttpMethod; path: string; pathParams: Parameter[]; queryParams: Parameter[]; headerParams: Parameter[]; cookieParams?: Parameter[]; requestBody?: TypeRef; requestBodyEncoding?: 'json' | 'form-data' | 'form-urlencoded' | 'binary' | 'text'; response: TypeRef; successResponses?: SuccessResponse[]; errors: ErrorResponse[]; pagination?: PaginationMeta; injectIdempotencyKey: boolean; deprecated?: boolean; async?: boolean; /** Per-operation security overrides. When present, overrides the global spec-level security. */ security?: SecurityRequirement[]; /** * Mutually-exclusive parameter groups parsed from `x-mutually-exclusive-parameter-groups`. * Each group represents a logical choice the caller must (or may) make between * several subsets of query/path/header parameters. The grouped parameters remain * in their original arrays (queryParams, pathParams, etc.) for wire-format purposes; * this field adds the grouping metadata so emitters can render sum types. */ parameterGroups?: ParameterGroup[]; } /** * A mutually-exclusive parameter group. The caller must supply exactly one * variant (when `optional` is false) or may omit the group entirely (when true). */ interface ParameterGroup { /** Group name from the extension (e.g. "parent_resource"). */ name: string; /** True when the whole group may be omitted. */ optional: boolean; /** Ordered variants (insertion order matches the spec). */ variants: ParameterGroupVariant[]; } /** * One variant within a mutually-exclusive parameter group. */ interface ParameterGroupVariant { /** Variant name from the extension (e.g. "by_id", "by_external_id"). */ name: string; /** * References to the actual parameter IR nodes. These are the same * objects that live in operation.queryParams / .pathParams / .headerParams -- * shared by identity, not duplicated. */ parameters: Parameter[]; } /** Structured pagination metadata for auto-paging iterator generation */ interface PaginationMeta { strategy: 'cursor' | 'offset' | 'link-header'; param: string; limitParam?: string; dataPath?: string; itemType: TypeRef; } type HttpMethod = 'get' | 'post' | 'put' | 'patch' | 'delete' | 'head' | 'options' | 'trace'; interface Parameter { name: string; type: TypeRef; required: boolean; description?: string; deprecated?: boolean; default?: unknown; example?: unknown; style?: 'form' | 'simple' | 'label' | 'matrix'; explode?: boolean; } /** Type reference — the core type system of the IR */ type TypeRef = PrimitiveType | ArrayType | ModelRef | EnumRef | UnionType | NullableType | LiteralType | MapType; interface PrimitiveType { kind: 'primitive'; type: 'string' | 'integer' | 'number' | 'boolean' | 'unknown'; format?: string; } interface ArrayType { kind: 'array'; items: TypeRef; } interface ModelRef { kind: 'model'; name: string; } interface EnumRef { kind: 'enum'; name: string; values?: (string | number)[]; } interface LiteralType { kind: 'literal'; value: string | number | boolean | null; } interface UnionType { kind: 'union'; variants: TypeRef[]; discriminator?: { property: string; mapping: Record; }; /** Which OAS composition keyword produced this union. Emitters can use this to * distinguish inheritance (allOf) from exclusive union (oneOf) from open union (anyOf). */ compositionKind?: 'allOf' | 'oneOf' | 'anyOf'; } interface NullableType { kind: 'nullable'; inner: TypeRef; } interface MapType { kind: 'map'; valueType: TypeRef; keyType?: TypeRef; } /** * A generic type parameter on a model. * Example: `DirectoryUser>` * → `{ name: 'TCustomAttributes', default: { kind: 'map', valueType: { kind: 'primitive', type: 'unknown' } } }` */ interface TypeParam { name: string; /** Default type when the param is not specified. */ default?: TypeRef; } /** Model definition (maps to an SDK model/data class) */ interface Model { name: string; description?: string; fields: Field[]; /** Generic type parameters. Empty/undefined for non-generic models. */ typeParams?: TypeParam[]; /** * When set, this model is a discriminated union over allOf+oneOf variants. * Emitters should generate a dispatcher (factory) instead of a regular dataclass. * The `property` field is the discriminator key (e.g. "event"), and `mapping` * maps each discriminator value to the concrete variant model name. */ discriminator?: { property: string; mapping: Record; }; } interface Field { name: string; /** * Optional domain-facing name override. When set, emitters derive the * domain-side identifier (in their own casing) from this instead of `name`, * while serialization still uses `name` for the wire key. Lets an SDK expose * a wire field under a friendlier name (e.g. `connection_type` → `type`) * without changing the API contract. Set via the `fieldHints` config and * honored by any emitter that reads it. */ domainName?: string; type: TypeRef; required: boolean; description?: string; readOnly?: boolean; writeOnly?: boolean; deprecated?: boolean; default?: unknown; example?: unknown; } /** Enum definition */ interface Enum { name: string; values: EnumValue[]; /** Spec-level default value (the value of `default:` on the schema). Optional. */ default?: string | number; } interface EnumValue { name: string; value: string | number; description?: string; deprecated?: boolean; } /** * Exhaustive check helper for TypeRef switches. * If a new kind is added to TypeRef, any switch that doesn't handle it * will fail to compile because `never` won't accept the unhandled variant. * * Usage: * switch (ref.kind) { * case 'primitive': ... * case 'array': ... * // If you forget 'literal', TypeScript errors here: * default: assertNever(ref); * } */ declare function assertNever(x: never): never; /** * Generic depth-first walker for TypeRef trees. * Handles recursion into array/nullable/union/map children and provides * an exhaustive `assertNever` check so callers don't need to repeat the * switch boilerplate. Supply callbacks only for the leaf kinds you care about. */ declare function walkTypeRef(ref: TypeRef, visitor: { model?: (ref: ModelRef) => void; enum?: (ref: EnumRef) => void; primitive?: (ref: PrimitiveType) => void; literal?: (ref: LiteralType) => void; }): void; /** * Generic depth-first mapper for TypeRef trees. * Like walkTypeRef but returns a transformed value instead of void. * Handles recursion into array/nullable/union/map children, passing * already-mapped child values to the parent callback. */ declare function mapTypeRef(ref: TypeRef, mapper: { primitive: (ref: PrimitiveType) => T; array: (ref: ArrayType, mappedItems: T) => T; model: (ref: ModelRef) => T; enum: (ref: EnumRef) => T; union: (ref: UnionType, mappedVariants: T[]) => T; nullable: (ref: NullableType, mappedInner: T) => T; literal: (ref: LiteralType) => T; map: (ref: MapType, mappedValue: T, mappedKey?: T) => T; }): T; /** * Collect all model names referenced (directly or transitively) by a TypeRef. */ declare function collectModelRefs(ref: TypeRef): string[]; /** * Collect all enum names referenced by a TypeRef. */ declare function collectEnumRefs(ref: TypeRef): string[]; /** * Collect all TypeRef-referenced model and enum names from a model's fields. * Returns { models, enums } sets for generating import statements. */ declare function collectFieldDependencies(model: Model): { models: Set; enums: Set; }; /** * Assign each model to the service that first references it. * Models referenced by multiple services are assigned to the first. * Models not referenced by any service are unassigned (absent from the map). * * @param hints - Optional pin overrides keyed by IR model name → IR service * name. Applied after the natural assignment loop. Both names must exist in * the spec; unknown keys/values throw a config-style error so typos fail * loud at generation time. */ declare function assignModelsToServices(models: Model[], services: Service[], hints?: Record): Map; /** * Collect all model names referenced as request bodies across all services. */ declare function collectRequestBodyModels(services: Service[]): Set; interface ErrorResponse { statusCode: number; type?: TypeRef; } /** A successful response entry from a 2xx status code */ interface SuccessResponse { statusCode: number; type: TypeRef; } //#endregion export { BreakingChangeCategory as $, collectEnumRefs as A, CompatSourceKind as At, IdempotencyPolicy as B, CompatPolicyHints as Bt, Service as C, OverlayLookup as Ct, UnionType as D, CompatParameter as Dt, TypeRef as E, ViolationSeverity as Et, walkTypeRef as F, CompatVisibility as Ft, RetryPolicy as G, LoggingPolicy as H, mergePolicy as Ht, AiAgentEnvVar as I, LanguageId as It, TimeoutPolicy as J, SdkBehavior as K, BackoffStrategy as L, ParameterSensitivity as Lt, collectModelRefs as M, CompatSymbol as Mt, collectRequestBodyModels as N, CompatSymbolKind as Nt, assertNever as O, CompatPassingStyle as Ot, mapTypeRef as P, CompatTypeRef as Pt, AdditiveChangeCategory as Q, DeepPartial as R, apiSurfaceToSnapshot as Rt, ServerEntry as S, MethodOverlay as St, TypeParam as T, ViolationCategory as Tt, PaginationPolicy as U, LogEvent as V, getDefaultPolicy as Vt, RequestGuardPolicy as W, defaultSdkBehavior as X, UserAgentPolicy as Y, mergeSdkBehavior as Z, Parameter as _, ApiSurface as _t, EnumRef as a, CompatProvenance as at, PrimitiveType as b, Extractor as bt, Field as c, severityMeetsThreshold as ct, MapType as d, ApiEnum as dt, CompatApproval as et, Model as f, ApiField as ft, PaginationMeta as g, ApiProperty as gt, Operation as h, ApiParam as ht, Enum as i, CompatFailLevel as it, collectFieldDependencies as j, CompatStability as jt, assignModelsToServices as k, CompatSnapshot as kt, HttpMethod as l, Addition as lt, NullableType as m, ApiMethod as mt, ArrayType as n, CompatChangeSeverity as nt, EnumValue as o, SoftRiskChangeCategory as ot, ModelRef as p, ApiInterface as pt, TelemetryPolicy as q, AuthScheme as r, CompatConfig as rt, ErrorResponse as s, defaultSeverityForCategory as st, ApiSpec as t, CompatChangeCategory as tt, LiteralType as u, ApiClass as ut, ParameterGroup as v, ApiTypeAlias as vt, SuccessResponse as w, Violation as wt, SecurityRequirement as x, LanguageHints as xt, ParameterGroupVariant as y, DiffResult as yt, ErrorPolicy as z, ALL_LANGUAGE_IDS as zt }; //# sourceMappingURL=types-nM5Kp7UP.d.mts.map