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