UNPKG

969 BTypeScriptView Raw
1/**
2 * Helper class to generate unique object IDs.
3 * It supports two types of IDs: long and short.
4 *
5 * Long IDs are string GUIDs. They are globally unique and 32-character long.
6 *
7 * ShortIDs are just 9-digit random numbers. They are not guaranteed be unique.
8 *
9 * ### Example ###
10 *
11 * IdGenerator.nextLong(); // Possible result: "234ab342c56a2b49c2ab42bf23ff991ac"
12 * IdGenerator.nextShort(); // Possible result: "23495247"
13 *
14 */
15export declare class IdGenerator {
16 /**
17 * Generates a random 9-digit random ID (code).
18 *
19 * Remember: The returned value is not guaranteed to be unique.
20 *
21 * @returns a generated random 9-digit code
22 */
23 static nextShort(): string;
24 private static uuidToHex;
25 /**
26 * Generates a globally unique 32-digit object ID.
27 * The value is a string representation of a GUID value.
28 *
29 * @returns a generated 32-digit object ID
30 */
31 static nextLong(): string;
32}