/** * Collision-free naming strategy for TypeScript class names. * * 6-phase algorithm: * 1. Priority names (backward compatibility) * 1a. Reserved names — names this lexicon has already published (chant #1459) * 2. Priority aliases (additional short names) * 3. Short names (last segment of type) * 4. Collision resolution (service-prefixed) * 5. Property type aliases (globally unique defs) * * ## Why phase 1a exists * * Phases 3 and 4 assign a short name to whoever asks first and service-qualify * everyone after. Membership of that contest is the whole input set, so a * resource's name was a function of its NEIGHBOURS: removing * `AWS::Athena::Session` upstream freed `Session`, and `AWS::Macie::Session` * silently changed from `MacieSession` to `Session` — a breaking rename for a * resource whose schema had not moved. Adding a resource does the same in * reverse: `AWS::QuickSight::Space` appearing renamed `AWS::SageMaker::Space` * from `Space` to `SageMakerSpace`. * * Worse, it is reversible. These are read-only registry types that come and go, * so a name could flip back on the next upgrade and break consumers again. * * Reserved names invert the bias: a name that has already shipped belongs to * the type that shipped it, and a newcomer colliding with it gets qualified * instead. A published name then changes only when its own type disappears, * which is a genuine breaking change rather than an incidental one. */ /** * Minimal input required by the naming strategy — avoids coupling * to any specific schema parser output format. */ export interface NamingInput { typeName: string; propertyTypes: Array<{ name: string; }>; } /** * Configuration that parameterizes the naming algorithm. * The data tables and name-extraction helpers are provider-specific. */ export interface NamingConfig { /** Fixed TypeScript class names for backward compatibility. */ priorityNames: Record; /** Additional TypeScript names beyond the primary priority name. */ priorityAliases: Record; /** Property type aliases that must always be emitted. */ priorityPropertyAliases: Record>; /** Service name abbreviations for collision-resolved names. */ serviceAbbreviations: Record; /** Extract the short name from a type name (e.g. "Vendor::Service::Resource" → "Resource"). */ shortName: (typeName: string) => string; /** Extract the service name from a type name (e.g. "Vendor::Service::Resource" → "Service"). */ serviceName: (typeName: string) => string; /** * chant #1459 — spec type name → the TypeScript name this lexicon has * already published for it, normally read from the committed * `surface.snapshot.json` via {@link reservedNamesFromSnapshot}. * * Claimed before short names are contested, so a shipped name is not taken * away from its owner by an unrelated upstream change. Omit for a lexicon * with no published surface yet; an entry for a type that is no longer in * the input is ignored, so a removed type frees its name for reuse. */ reservedNames?: Record; } /** * The names a lexicon has already published, read from a committed surface * snapshot (chant #1459). * * The snapshot is keyed by TypeScript name with the spec type inside, which is * exactly the mapping phase 1a needs, inverted. Only `resource` entries are * reserved: property-type names are derived from their owning resource's name * (phase 5), so pinning the resource pins them, and reserving them separately * would freeze aliases that are meant to follow their parent. */ export declare function reservedNamesFromSnapshot(snapshot: { entries?: Record; } | undefined): Record; export declare class NamingStrategy { private config; private assigned; private _aliases; private usedNames; private _propertyAliases; constructor(results: NamingInput[], config: NamingConfig); /** Primary TypeScript class name for a type. */ resolve(typeName: string): string | undefined; /** Additional TypeScript names for a type. */ aliases(typeName: string): string[]; /** All (typeName, tsName) pairs sorted by TS name. */ allAssignments(): [string, string][]; /** Property type aliases for a given type. */ propertyTypeAliases(typeName: string): Map | undefined; } /** * Construct property type name: "Bucket_ServerSideEncryptionByDefault" */ export declare function propertyTypeName(parentTSName: string, defName: string): string; /** * Extract the raw definition name from a parser-generated name. * "Bucket_ServerSideEncryptionByDefault" → "ServerSideEncryptionByDefault" */ export declare function extractDefName(parserName: string, shortName: string): string; //# sourceMappingURL=naming.d.ts.map