UNPKG

uuniq

Version:
55 lines 1.42 kB
//#region src/types/snowflake_options.d.ts type SnowflakeOptions = { format?: 'numeric' | 'symbolic'; charset?: string; epoch?: string; place_id?: number; }; //#endregion //#region src/types/snowflake_resolve.d.ts type SnowflakeResolve = { created_at: string; place_id: number; sequence: number; }; //#endregion //#region src/snowflake.d.ts declare class Snowflake { private readonly options; private readonly epoch; private sequence; private last_timestamp; private readonly anybase_encode; private readonly anybase_decode; constructor(options?: SnowflakeOptions); private current_timestamp; private wait_for_next_time; generate(): string; resolve(id: string): SnowflakeResolve; } //#endregion //#region src/types/increment_options.d.ts type IncrementOptions = { format?: 'numeric' | 'symbolic'; initial?: number; charset?: string; place_id?: number; store: { set: (key: string, value: unknown) => unknown; get: (key: string) => unknown; }; }; //#endregion //#region src/increment.d.ts declare class Increment { private readonly options; private readonly store; private sequence; private readonly anybase_encode; constructor(options: IncrementOptions); private init; private readonly sync_sequence; generate(): Promise<string>; } //#endregion export { Increment, type IncrementOptions, Snowflake, type SnowflakeOptions, type SnowflakeResolve };