//#region src/types.d.ts type LowerChar = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z"; /** * Validator-style conditional type: resolves to `S` when `S` is exactly three * lowercase `a–z` characters, and to `never` otherwise. * * When passed the generic `string` type it resolves to `string`, so existing * dynamic-brand call sites (e.g. CLI, ORM adapters) are unaffected. * * Apply as a parameter intersection on codec constructors: * ```ts * function createTimestampId(brand: Brand & ValidBrand, ...) * ``` * TypeScript then validates the specific brand literal at each call site without * materialising the 17 576-member all-brands union. */ type ValidBrand = string extends S ? S : S extends `${infer _A extends LowerChar}${infer _B extends LowerChar}${infer _C extends LowerChar}` ? S : never; /** The brand plus trailing separator — e.g. `usr_` for brand `usr`. */ type Prefix = `${Brand}_`; declare const idBrand: unique symbol; /** A canonical branded ID string for `Brand`. Produced by `generate()` and `safeParse()`. */ type Id = `${Prefix}${string}` & { readonly [idBrand]: Brand; }; /** Parse failure reason returned by `safeParse()` and `safeFromUUID()`. */ type ParseError = "not_string" | "invalid_prefix" | "invalid_base32" | "invalid_uuid"; /** Result of `safeParse()`: canonical `Id` or a `ParseError`. */ type ParseResult = { ok: true; id: Id; } | { ok: false; error: ParseError; }; /** JSON Schema for the canonical wire form returned by `toJsonSchema()`. */ type JsonSchema = { readonly type: "string"; readonly pattern: string; readonly description: string; readonly example: string; }; /** Standard Schema validate entry point exposed on a codec's `~standard` property. */ type StandardSchemaProps = { readonly version: 1; readonly vendor: "@smonn/ids"; readonly validate: (value: unknown, options?: { readonly libraryOptions?: Record | undefined; }) => { readonly value: Id; readonly issues?: undefined; } | { readonly issues: ReadonlyArray<{ readonly message: string; }>; }; readonly types?: { readonly input: unknown; readonly output: Id; }; }; //#endregion export { StandardSchemaProps as a, ParseResult as i, JsonSchema as n, ValidBrand as o, ParseError as r, Id as t }; //# sourceMappingURL=types-hGBnCpJj.d.mts.map