1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | export {};
|
13 |
|
14 |
|
15 | type OutputBuffer = ArrayLike<number>;
|
16 | type InputBuffer = ArrayLike<number>;
|
17 |
|
18 | interface RandomOptions {
|
19 | random?: InputBuffer;
|
20 | }
|
21 | interface RngOptions {
|
22 | rng?: () => InputBuffer;
|
23 | }
|
24 |
|
25 | interface V1BaseOptions {
|
26 | node?: InputBuffer;
|
27 | clockseq?: number;
|
28 | msecs?: number | Date;
|
29 | nsecs?: number;
|
30 | }
|
31 | interface V1RandomOptions extends V1BaseOptions, RandomOptions {}
|
32 | interface V1RngOptions extends V1BaseOptions, RngOptions {}
|
33 |
|
34 | export type V1Options = V1RandomOptions | V1RngOptions;
|
35 | export type V4Options = RandomOptions | RngOptions;
|
36 |
|
37 | type v1String = (options?: V1Options) => string;
|
38 | type v1Buffer = <T extends OutputBuffer>(options: V1Options | null | undefined, buffer: T, offset?: number) => T;
|
39 | type v1 = v1Buffer & v1String;
|
40 |
|
41 | type v4String = (options?: V4Options) => string;
|
42 | type v4Buffer = <T extends OutputBuffer>(options: V4Options | null | undefined, buffer: T, offset?: number) => T;
|
43 | type v4 = v4Buffer & v4String;
|
44 |
|
45 | type v3String = (name: string | InputBuffer, namespace: string | InputBuffer) => string;
|
46 | type v3Buffer = <T extends OutputBuffer>(name: string | InputBuffer, namespace: string | InputBuffer, buffer: T, offset?: number) => T;
|
47 | interface v3Static {
|
48 |
|
49 | DNS: string;
|
50 |
|
51 | URL: string;
|
52 | }
|
53 | type v3 = v3Buffer & v3String & v3Static;
|
54 |
|
55 | type v5String = (name: string | InputBuffer, namespace: string | InputBuffer) => string;
|
56 | type v5Buffer = <T extends OutputBuffer>(name: string | InputBuffer, namespace: string | InputBuffer, buffer: T, offset?: number) => T;
|
57 | interface v5Static {
|
58 |
|
59 | DNS: string;
|
60 |
|
61 | URL: string;
|
62 | }
|
63 | type v5 = v5Buffer & v5String & v5Static;
|
64 |
|
65 | type NIL = string;
|
66 |
|
67 | type parse = (uuid: string) => OutputBuffer;
|
68 | type stringify = (buffer: InputBuffer, offset?: number) => string;
|
69 | type validate = (uuid: string) => boolean;
|
70 | type version = (uuid: string) => number;
|
71 |
|
72 | export const NIL: NIL;
|
73 | export const parse: parse;
|
74 | export const stringify: stringify;
|
75 | export const v1: v1;
|
76 | export const v3: v3;
|
77 | export const v4: v4;
|
78 | export const v5: v5;
|
79 | export const validate: validate;
|
80 | export const version: version;
|