//#region src/clientinfo/clientinfo.d.ts /** * Collects information about the client and its environment into an * immutable {@link ClientInfo} value. * * {@link ClientInfo.with} derives a new value with additional key/value * segments; it never mutates the original. * * @module */ type ClientInfoErrorCode = 'INVALID_KEY' | 'INVALID_VALUE' | 'INVALID_VERSION'; declare class ClientInfoError extends Error { readonly code: ClientInfoErrorCode; constructor(code: ClientInfoErrorCode, message: string); } interface Segment { readonly key: string; readonly value: string; } declare function isSemVer(s: string): boolean; declare function isValidSegment(s: string): boolean; /** * Replaces characters that are not valid in segment values with * hyphens. Used for environment-sourced values (runtime version, * upstream) that we do not control and cannot reject. */ declare function sanitize(s: string): string; /** * ClientInfo is an immutable, ordered list of key/value segments. Use * {@link ClientInfo.with} to derive new values with additional segments. */ declare class ClientInfo { static readonly EMPTY: ClientInfo; readonly segments: readonly Segment[]; private constructor(); /** * Returns a new {@link ClientInfo} with the given items appended. Accepts * either individual key/value pairs or another {@link ClientInfo} whose * segments are merged in order. The original is not modified; mixing the * two forms in a single call is supported. * * Keys and values on pair arguments must contain only alphanumeric * characters plus `_`, `.`, `+`, or `-`. Exact key+value duplicates are * silently ignored. On error, an exception is thrown (all-or-nothing). * * @example * ```ts * base.with({key: 'partner', value: 'acme'}); * base.with(pkgClientInfo); * base.with(pkgClientInfo, {key: 'sdk-feature', value: 'pagination'}); * ``` */ with(...items: (ClientInfo | Segment)[]): ClientInfo; /** * Returns a string representation of the client info suitable for * inclusion in HTTP headers. Key/value pairs are formatted as * "key/value" and joined by spaces in the order they were inserted. */ toString(): string; } //#endregion export { ClientInfo, ClientInfoError, ClientInfoErrorCode, isSemVer, isValidSegment, sanitize }; //# sourceMappingURL=clientinfo.d.ts.map