/** * Canonical ordering pass for {@link GeneratorMetadata}. * * The language generators consume the metadata collections in array order. * This pass is the single, generator-agnostic stabilizer: it returns a new * `GeneratorMetadata` whose every collection is ordered so that any producer * (the bundled SQL `introspect()` or a custom injected adapter) yields * byte-stable codegen. Generators document that they expect input pre-sorted * with this function; ordering is intentionally NOT enforced inside * `introspect()` so the concern lives in one place. * * **The TypeScript generator is the source of truth for ordering.** The keys * below replicate the sorts that `generateTypescript` historically applied * internally (schemas/tables/views/functions/types/columns/relationships by * name; function args by name), so that generator can drop its own sorting and * stay byte-identical. The other generators then inherit the same canonical * order for free. * * Keys are **semantic** (schema + name + signature), never oid: equivalent * databases assign different oids, so an oid sort would still churn output * across environments. `id` is only a final tie-breaker for a total order. * * Composite type `attributes` and enum values are left untouched — their order * is semantically meaningful (struct field / enum-label order) and must be * preserved. Function `args` are sorted by name because PostgREST RPC args are * addressed by name (the generated type is an object), matching TypeScript. */ import type { GeneratorMetadata } from "./types.ts"; /** * Return a new {@link GeneratorMetadata} with every collection ordered by a * stable, total, semantic key (matching the TypeScript generator's ordering). * Pure (does not mutate the input) and idempotent. Apply this after * introspection and before any `generate*` call. */ export declare function sortGeneratorMetadata(metadata: GeneratorMetadata): GeneratorMetadata;