uuid 14.0.1 → 14.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -19
- package/dist/v1.js +7 -3
- package/dist/v7.js +5 -2
- package/dist-node/v1.js +7 -3
- package/dist-node/v7.js +5 -2
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -41,23 +41,23 @@ For timestamp UUIDs, namespace UUIDs, and other options read on ...
|
|
|
41
41
|
|
|
42
42
|
## API Summary
|
|
43
43
|
|
|
44
|
-
| | |
|
|
45
|
-
| --- | --- |
|
|
46
|
-
| [`uuid.NIL`](#uuidnil) | The nil UUID string (all zeros) |
|
|
47
|
-
| [`uuid.MAX`](#uuidmax) | The max UUID string (all ones) |
|
|
48
|
-
| [`uuid.parse()`](#uuidparsestr) | Convert UUID string to array of bytes |
|
|
49
|
-
| [`uuid.stringify()`](#uuidstringifyarr-offset) | Convert array of bytes to UUID string |
|
|
50
|
-
| [`uuid.v1()`](#uuidv1options-buffer-offset) |
|
|
51
|
-
| [`uuid.v1ToV6()`](#uuidv1tov6uuid) |
|
|
52
|
-
| [`uuid.v3()`](#uuidv3name-namespace-buffer-offset) |
|
|
53
|
-
| [`uuid.v4()`](#uuidv4options-buffer-offset) |
|
|
54
|
-
| [`uuid.v5()`](#uuidv5name-namespace-buffer-offset) |
|
|
55
|
-
| [`uuid.v6()`](#uuidv6options-buffer-offset) |
|
|
56
|
-
| [`uuid.v6ToV1()`](#uuidv6tov1uuid) |
|
|
57
|
-
| [`uuid.v7()`](#uuidv7options-buffer-offset) |
|
|
58
|
-
| ~~[`uuid.v8()`](#uuidv8)~~ | "Intentionally left blank" |
|
|
59
|
-
| [`uuid.validate()`](#uuidvalidatestr) | Test a string to see if it is a valid UUID |
|
|
60
|
-
| [`uuid.version()`](#uuidversionstr) | Detect RFC version of a UUID |
|
|
44
|
+
| | |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| [`uuid.NIL`](#uuidnil) | The nil UUID string (all zeros) |
|
|
47
|
+
| [`uuid.MAX`](#uuidmax) | The max UUID string (all ones) |
|
|
48
|
+
| [`uuid.parse()`](#uuidparsestr) | Convert UUID string to array of bytes |
|
|
49
|
+
| [`uuid.stringify()`](#uuidstringifyarr-offset) | Convert array of bytes to UUID string |
|
|
50
|
+
| [`uuid.v1()`](#uuidv1options-buffer-offset) | Generate a version 1 (timestamp) UUID |
|
|
51
|
+
| [`uuid.v1ToV6()`](#uuidv1tov6uuid) | Convert a version 1 UUID to version 6 |
|
|
52
|
+
| [`uuid.v3()`](#uuidv3name-namespace-buffer-offset) | Generate a version 3 (namespace w/ MD5) UUID |
|
|
53
|
+
| [`uuid.v4()`](#uuidv4options-buffer-offset) | Generate a version 4 (random) UUID |
|
|
54
|
+
| [`uuid.v5()`](#uuidv5name-namespace-buffer-offset) | Generate a version 5 (namespace w/ SHA-1) UUID |
|
|
55
|
+
| [`uuid.v6()`](#uuidv6options-buffer-offset) | Generate a version 6 (timestamp, reordered) UUID |
|
|
56
|
+
| [`uuid.v6ToV1()`](#uuidv6tov1uuid) | Convert a version 6 UUID to version 1 |
|
|
57
|
+
| [`uuid.v7()`](#uuidv7options-buffer-offset) | Generate a version 7 (Unix Epoch time-based) UUID |
|
|
58
|
+
| ~~[`uuid.v8()`](#uuidv8)~~ | "Intentionally left blank" |
|
|
59
|
+
| [`uuid.validate()`](#uuidvalidatestr) | Test a string to see if it is a valid UUID |
|
|
60
|
+
| [`uuid.version()`](#uuidversionstr) | Detect RFC version of a UUID |
|
|
61
61
|
|
|
62
62
|
## API
|
|
63
63
|
|
|
@@ -357,7 +357,7 @@ Example:
|
|
|
357
357
|
```javascript
|
|
358
358
|
import { v7 as uuidv7 } from 'uuid';
|
|
359
359
|
|
|
360
|
-
uuidv7(); // ⇨ '01941f29-7c00-
|
|
360
|
+
uuidv7(); // ⇨ '01941f29-7c00-73e4-a310-744d2167fc5b'
|
|
361
361
|
```
|
|
362
362
|
|
|
363
363
|
### ~~uuid.v8()~~
|
|
@@ -464,7 +464,7 @@ Prior to `uuid@11`, it was possible for `options` state to interfere with the in
|
|
|
464
464
|
|
|
465
465
|
**Browsers**: `uuid` [builds are tested](/uuidjs/uuid/blob/main/wdio.conf.js) against the latest version of desktop Chrome, Safari, Firefox, and Edge. Mobile versions of these same browsers are expected to work but aren't currently tested.
|
|
466
466
|
|
|
467
|
-
**Node**: `uuid` [builds are tested](https://github.com/uuidjs/uuid/blob/main/.github/workflows/ci.yml#
|
|
467
|
+
**Node**: `uuid` [builds are tested](https://github.com/uuidjs/uuid/blob/main/.github/workflows/ci.yml#L31) against node ([LTS releases](https://github.com/nodejs/Release)), plus one prior. E.g. At the time of this writing `node@20` is the "maintenance" release and `node@24` is the "current" release, so `uuid` supports `node@20`-`node@24`.
|
|
468
468
|
|
|
469
469
|
**Typescript**: TS versions released within the past two years are supported. [source](https://github.com/microsoft/TypeScript/issues/49088#issuecomment-2468723715)
|
|
470
470
|
|
package/dist/v1.js
CHANGED
|
@@ -61,14 +61,18 @@ function v1Bytes(rnds, msecs, nsecs, clockseq, node, buf, offset = 0) {
|
|
|
61
61
|
msecs ??= Date.now();
|
|
62
62
|
nsecs ??= 0;
|
|
63
63
|
clockseq ??= ((rnds[8] << 8) | rnds[9]) & 0x3fff;
|
|
64
|
-
node
|
|
64
|
+
if (node == null) {
|
|
65
|
+
node = rnds.slice(10, 16);
|
|
66
|
+
node[0] |= 0x01;
|
|
67
|
+
}
|
|
65
68
|
msecs += 12219292800000;
|
|
66
|
-
const
|
|
69
|
+
const t = (msecs & 0xfffffff) * 10000 + nsecs;
|
|
70
|
+
const tl = t >>> 0;
|
|
67
71
|
buf[offset++] = (tl >>> 24) & 0xff;
|
|
68
72
|
buf[offset++] = (tl >>> 16) & 0xff;
|
|
69
73
|
buf[offset++] = (tl >>> 8) & 0xff;
|
|
70
74
|
buf[offset++] = tl & 0xff;
|
|
71
|
-
const tmh = ((msecs /
|
|
75
|
+
const tmh = (((msecs / 0x10000000) | 0) * 625 + ((t / 0x100000000) | 0)) & 0xfffffff;
|
|
72
76
|
buf[offset++] = (tmh >>> 8) & 0xff;
|
|
73
77
|
buf[offset++] = tmh & 0xff;
|
|
74
78
|
buf[offset++] = ((tmh >>> 24) & 0xf) | 0x10;
|
package/dist/v7.js
CHANGED
|
@@ -18,7 +18,7 @@ export function updateV7State(state, now, rnds) {
|
|
|
18
18
|
state.msecs ??= -Infinity;
|
|
19
19
|
state.seq ??= 0;
|
|
20
20
|
if (now > state.msecs) {
|
|
21
|
-
state.seq = (rnds
|
|
21
|
+
state.seq = v7Sequence(rnds);
|
|
22
22
|
state.msecs = now;
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
@@ -43,7 +43,7 @@ function v7Bytes(rnds, msecs, seq, buf, offset = 0) {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
msecs ??= Date.now();
|
|
46
|
-
seq ??= (
|
|
46
|
+
seq ??= v7Sequence(rnds);
|
|
47
47
|
buf[offset++] = (msecs / 0x10000000000) & 0xff;
|
|
48
48
|
buf[offset++] = (msecs / 0x100000000) & 0xff;
|
|
49
49
|
buf[offset++] = (msecs / 0x1000000) & 0xff;
|
|
@@ -62,4 +62,7 @@ function v7Bytes(rnds, msecs, seq, buf, offset = 0) {
|
|
|
62
62
|
buf[offset++] = rnds[15];
|
|
63
63
|
return buf;
|
|
64
64
|
}
|
|
65
|
+
function v7Sequence(rnds) {
|
|
66
|
+
return ((rnds[6] & 0x7f) << 24) | (rnds[7] << 16) | (rnds[8] << 8) | rnds[9];
|
|
67
|
+
}
|
|
65
68
|
export default v7;
|
package/dist-node/v1.js
CHANGED
|
@@ -61,14 +61,18 @@ function v1Bytes(rnds, msecs, nsecs, clockseq, node, buf, offset = 0) {
|
|
|
61
61
|
msecs ??= Date.now();
|
|
62
62
|
nsecs ??= 0;
|
|
63
63
|
clockseq ??= ((rnds[8] << 8) | rnds[9]) & 0x3fff;
|
|
64
|
-
node
|
|
64
|
+
if (node == null) {
|
|
65
|
+
node = rnds.slice(10, 16);
|
|
66
|
+
node[0] |= 0x01;
|
|
67
|
+
}
|
|
65
68
|
msecs += 12219292800000;
|
|
66
|
-
const
|
|
69
|
+
const t = (msecs & 0xfffffff) * 10000 + nsecs;
|
|
70
|
+
const tl = t >>> 0;
|
|
67
71
|
buf[offset++] = (tl >>> 24) & 0xff;
|
|
68
72
|
buf[offset++] = (tl >>> 16) & 0xff;
|
|
69
73
|
buf[offset++] = (tl >>> 8) & 0xff;
|
|
70
74
|
buf[offset++] = tl & 0xff;
|
|
71
|
-
const tmh = ((msecs /
|
|
75
|
+
const tmh = (((msecs / 0x10000000) | 0) * 625 + ((t / 0x100000000) | 0)) & 0xfffffff;
|
|
72
76
|
buf[offset++] = (tmh >>> 8) & 0xff;
|
|
73
77
|
buf[offset++] = tmh & 0xff;
|
|
74
78
|
buf[offset++] = ((tmh >>> 24) & 0xf) | 0x10;
|
package/dist-node/v7.js
CHANGED
|
@@ -18,7 +18,7 @@ export function updateV7State(state, now, rnds) {
|
|
|
18
18
|
state.msecs ??= -Infinity;
|
|
19
19
|
state.seq ??= 0;
|
|
20
20
|
if (now > state.msecs) {
|
|
21
|
-
state.seq = (rnds
|
|
21
|
+
state.seq = v7Sequence(rnds);
|
|
22
22
|
state.msecs = now;
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
@@ -43,7 +43,7 @@ function v7Bytes(rnds, msecs, seq, buf, offset = 0) {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
msecs ??= Date.now();
|
|
46
|
-
seq ??= (
|
|
46
|
+
seq ??= v7Sequence(rnds);
|
|
47
47
|
buf[offset++] = (msecs / 0x10000000000) & 0xff;
|
|
48
48
|
buf[offset++] = (msecs / 0x100000000) & 0xff;
|
|
49
49
|
buf[offset++] = (msecs / 0x1000000) & 0xff;
|
|
@@ -62,4 +62,7 @@ function v7Bytes(rnds, msecs, seq, buf, offset = 0) {
|
|
|
62
62
|
buf[offset++] = rnds[15];
|
|
63
63
|
return buf;
|
|
64
64
|
}
|
|
65
|
+
function v7Sequence(rnds) {
|
|
66
|
+
return ((rnds[6] & 0x7f) << 24) | (rnds[7] << 16) | (rnds[8] << 8) | rnds[9];
|
|
67
|
+
}
|
|
65
68
|
export default v7;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uuid",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.2",
|
|
4
4
|
"description": "RFC9562 UUIDs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"funding": [
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"neostandard": "0.13.0",
|
|
53
53
|
"npm-run-all2": "8.0.4",
|
|
54
54
|
"prettier": "3.8.3",
|
|
55
|
+
"publint": "0.3.21",
|
|
55
56
|
"release-please": "17.3.0",
|
|
56
57
|
"runmd": "2.1.1",
|
|
57
58
|
"standard-version": "9.5.0",
|
|
@@ -78,6 +79,8 @@
|
|
|
78
79
|
"examples:node:esmodules:test": "cd examples/node-esmodules && npm test",
|
|
79
80
|
"examples:node:jest:test": "cd examples/node-jest && npm test",
|
|
80
81
|
"examples:node:typescript:test": "cd examples/typescript && npm test",
|
|
82
|
+
"format": "biome format --write .",
|
|
83
|
+
"format:check": "biome format --check .",
|
|
81
84
|
"lint": "npm run biome:check",
|
|
82
85
|
"md": "runmd --watch --output=README.md README_js.md",
|
|
83
86
|
"prepack": "npm run build -- --no-pack",
|
|
@@ -87,8 +90,6 @@
|
|
|
87
90
|
"pretest:browser": "./scripts/iodd && npm run build && npm-run-all --parallel examples:browser:**",
|
|
88
91
|
"pretest:node": "npm run build",
|
|
89
92
|
"pretest": "npm run build",
|
|
90
|
-
"format": "biome format --write .",
|
|
91
|
-
"format:check": "biome format --check .",
|
|
92
93
|
"release": "standard-version --no-verify",
|
|
93
94
|
"test:benchmark": "cd examples/benchmark && npm test",
|
|
94
95
|
"test:browser": "wdio run ./wdio.conf.js",
|