/** A monotonic ULID mint. `now` is epoch milliseconds; it defaults to the wall clock. */ export interface UlidMint { (now?: number): string; /** * Raise the floor to an id this writer has already persisted (#1335), so the next * mint is strictly greater than it whatever the clock now says. * * The floor only ever goes UP: seeding with an id below where the mint already * stands is a no-op, so a seed racing an in-flight mint cannot undo it, and seeding * twice is harmless. Both halves of the state are taken — the timestamp AND the * random digits — because an id minted in the same millisecond has to beat the * seed's random half too, and re-randomizing could land below it. * * Refuses anything that is not a ULID, for `ulidTime`'s reason: a floor decoded * from a prefix is a plausible-looking number and would silently sit in the wrong * place. Callers read the id back out of their own storage, where the only writer * is a mint like this one. */ seedFrom(id: string): void; } /** * A ULID mint with its OWN monotonic state — one writer's floor, not the process's. * * Hand one to anything that stamps ids from a clock it was given rather than from * `Date.now()`, so an unrelated wall-clock mint elsewhere in the isolate cannot pull * its timestamps forward. Everything else keeps using the shared `ulid()` below. */ export declare function createUlid(): UlidMint; export declare function ulid(now?: number): string; /** * The epoch-millisecond timestamp a ULID carries in its first ten characters. * * Refuses anything that is not a ULID rather than decoding a prefix: a truncated id * decodes to a plausible-looking number, which is worse than a throw. All 26 digits * are judged, not the ten this reads — an id whose random half is outside Crockford's * alphabet is malformed whether or not the half carrying the timestamp is fine. * * The timestamp is bounded as well as shaped. Ten base32 digits hold 50 bits and the * timestamp is 48, so a first digit of `8` through `Z` is not a far-future date, it is * not a ULID — and decoding it would hand back a millisecond nothing can have minted. */ export declare function ulidTime(id: string): number; //# sourceMappingURL=ulid.d.ts.map