UNPKG

@eristack/entity-id

Version:

UUID v7 entity identifiers — sortable, parseable, Drizzle column helper

15 lines • 1 kB
import type { EntityId } from "./types.js"; /** Default Eristack `idFactory` — UUID v7, not DB serial or `randomUUID`. */ export declare function entityIdFactory(): EntityId; export declare function generateEntityId(unixMs?: number): EntityId; /** Deterministic generation for tests — same ms + random → same id. */ export declare function generateEntityIdAt(unixMs: number, random: Uint8Array): EntityId; export declare function normalizeEntityId(value: string): EntityId; export declare function parseEntityId(value: string): EntityId; export declare function isValidEntityId(value: string): boolean; export declare function entityIdToUnixMs(id: EntityId): number; export declare function entityIdToDate(id: EntityId): Date; /** Lexicographic compare — matches time order for ids from `generateEntityId`. */ export declare function compareEntityIds(a: EntityId, b: EntityId): number; export declare function entityIdEquals(a: string, b: string): boolean; //# sourceMappingURL=entity-id.d.ts.map