@hasna/domains
Version:
Domain portfolio, registrar, marketplace, and DNS management for AI agents — CLI + MCP + HTTP API + SDK, shared account API and PostgreSQL
42 lines • 1.73 kB
TypeScript
export declare const DEFAULT_LIST_LIMIT = 20;
export declare const DEFAULT_DETAIL_LIMIT = 5;
export declare const MAX_LIST_LIMIT = 200;
export interface Page<T> {
items: T[];
total: number;
shown: number;
limit: number;
offset: number;
hasMore: boolean;
}
/**
* Parse a --limit value.
*
* `maxLimit` caps the result. It defaults to MAX_LIST_LIMIT, which is a *display*
* bound for human output. Machine-readable output MUST pass `Infinity` instead:
* silently clamping a requested limit and then echoing the clamped value back as
* `limit` produces a response that is self-consistent with a request the caller
* never made, which is indistinguishable from a complete read.
*/
export declare function parseLimit(value: string | number | undefined, fallback?: number, maxLimit?: number): number;
export declare function parseOffset(value: string | number | undefined): number;
export declare function pageItems<T>(items: T[], options?: {
limit?: string | number;
offset?: string | number;
all?: boolean;
fallbackLimit?: number;
maxLimit?: number;
}): Page<T>;
export declare function pageItemsOrExit<T>(items: T[], options?: {
limit?: string | number;
offset?: string | number;
all?: boolean;
fallbackLimit?: number;
maxLimit?: number;
}): Page<T>;
export declare function truncateText(value: unknown, max?: number): string;
export declare function formatDate(value: string | null | undefined): string;
export declare function compactHint(page: Pick<Page<unknown>, "shown" | "total" | "limit" | "offset" | "hasMore">, noun: string, detailHint: string, options?: {
paging?: "offset" | "limit" | "none";
}): string;
//# sourceMappingURL=compact-output.d.ts.map