uuid 9.0.1 → 11.0.0-0
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/CHANGELOG.md +45 -0
- package/README.md +186 -167
- package/dist/cjs/_types.d.ts +21 -0
- package/dist/cjs/_types.js +3 -0
- package/dist/cjs/index.d.ts +14 -0
- package/dist/cjs/index.js +32 -0
- package/dist/cjs/max.d.ts +2 -0
- package/dist/cjs/max.js +4 -0
- package/dist/cjs/md5.d.ts +2 -0
- package/dist/cjs/md5.js +14 -0
- package/dist/cjs/native.d.ts +5 -0
- package/dist/cjs/native.js +5 -0
- package/dist/cjs/nil.d.ts +2 -0
- package/dist/cjs/nil.js +4 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/parse.d.ts +2 -0
- package/dist/cjs/parse.js +12 -0
- package/dist/cjs/regex.d.ts +2 -0
- package/dist/cjs/regex.js +4 -0
- package/dist/cjs/rng.d.ts +1 -0
- package/dist/cjs/rng.js +14 -0
- package/dist/cjs/sha1.d.ts +2 -0
- package/dist/cjs/sha1.js +14 -0
- package/dist/cjs/stringify.d.ts +3 -0
- package/dist/cjs/stringify.js +39 -0
- package/dist/cjs/test/parse.test.d.ts +1 -0
- package/dist/cjs/test/parse.test.js +51 -0
- package/dist/cjs/test/rng.test.d.ts +1 -0
- package/dist/cjs/test/rng.test.js +15 -0
- package/dist/cjs/test/stringify.test.d.ts +1 -0
- package/dist/cjs/test/stringify.test.js +24 -0
- package/dist/cjs/test/test_constants.d.ts +33 -0
- package/dist/cjs/test/test_constants.js +92 -0
- package/dist/cjs/test/v1.test.d.ts +1 -0
- package/dist/cjs/test/v1.test.js +128 -0
- package/dist/cjs/test/v35.test.d.ts +1 -0
- package/dist/cjs/test/v35.test.js +144 -0
- package/dist/cjs/test/v4.test.d.ts +1 -0
- package/dist/cjs/test/v4.test.js +61 -0
- package/dist/cjs/test/v6.test.d.ts +1 -0
- package/dist/cjs/test/v6.test.js +57 -0
- package/dist/cjs/test/v7.test.d.ts +1 -0
- package/dist/cjs/test/v7.test.js +195 -0
- package/dist/cjs/test/validate.test.d.ts +1 -0
- package/dist/cjs/test/validate.test.js +14 -0
- package/dist/cjs/test/version.test.d.ts +1 -0
- package/dist/cjs/test/version.test.js +21 -0
- package/dist/cjs/uuid-bin.d.ts +1 -0
- package/dist/cjs/uuid-bin.js +73 -0
- package/dist/cjs/v1.d.ts +11 -0
- package/dist/cjs/v1.js +79 -0
- package/dist/cjs/v1ToV6.d.ts +2 -0
- package/dist/cjs/v1ToV6.js +14 -0
- package/dist/cjs/v3.d.ts +9 -0
- package/dist/cjs/v3.js +15 -0
- package/dist/cjs/v35.d.ts +7 -0
- package/dist/cjs/v35.js +42 -0
- package/dist/cjs/v4.d.ts +4 -0
- package/dist/cjs/v4.js +24 -0
- package/dist/cjs/v5.d.ts +9 -0
- package/dist/cjs/v5.js +15 -0
- package/dist/cjs/v6.d.ts +4 -0
- package/dist/cjs/v6.js +20 -0
- package/dist/cjs/v6ToV1.d.ts +2 -0
- package/dist/cjs/v6ToV1.js +14 -0
- package/dist/cjs/v7.d.ts +9 -0
- package/dist/cjs/v7.js +61 -0
- package/dist/cjs/validate.d.ts +2 -0
- package/dist/cjs/validate.js +8 -0
- package/dist/cjs/version.d.ts +2 -0
- package/dist/cjs/version.js +11 -0
- package/dist/cjs-browser/_types.d.ts +21 -0
- package/dist/cjs-browser/_types.js +3 -0
- package/dist/{esm-node/index.js → cjs-browser/index.d.ts} +9 -4
- package/dist/cjs-browser/index.js +32 -0
- package/dist/cjs-browser/max.d.ts +2 -0
- package/dist/cjs-browser/max.js +4 -0
- package/dist/cjs-browser/md5.d.ts +2 -0
- package/dist/cjs-browser/md5.js +138 -0
- package/dist/cjs-browser/native.d.ts +4 -0
- package/dist/cjs-browser/native.js +5 -0
- package/dist/cjs-browser/nil.d.ts +2 -0
- package/dist/cjs-browser/nil.js +4 -0
- package/dist/cjs-browser/package.json +1 -0
- package/dist/cjs-browser/parse.d.ts +2 -0
- package/dist/cjs-browser/parse.js +12 -0
- package/dist/cjs-browser/regex.d.ts +2 -0
- package/dist/cjs-browser/regex.js +4 -0
- package/dist/cjs-browser/rng.d.ts +1 -0
- package/dist/cjs-browser/rng.js +15 -0
- package/dist/cjs-browser/sha1.d.ts +2 -0
- package/dist/cjs-browser/sha1.js +73 -0
- package/dist/cjs-browser/stringify.d.ts +3 -0
- package/dist/cjs-browser/stringify.js +39 -0
- package/dist/cjs-browser/test/parse.test.d.ts +1 -0
- package/dist/cjs-browser/test/parse.test.js +51 -0
- package/dist/cjs-browser/test/rng.test.d.ts +1 -0
- package/dist/cjs-browser/test/rng.test.js +15 -0
- package/dist/cjs-browser/test/stringify.test.d.ts +1 -0
- package/dist/cjs-browser/test/stringify.test.js +24 -0
- package/dist/cjs-browser/test/test_constants.d.ts +33 -0
- package/dist/cjs-browser/test/test_constants.js +92 -0
- package/dist/cjs-browser/test/v1.test.d.ts +1 -0
- package/dist/cjs-browser/test/v1.test.js +128 -0
- package/dist/cjs-browser/test/v35.test.d.ts +1 -0
- package/dist/cjs-browser/test/v35.test.js +144 -0
- package/dist/cjs-browser/test/v4.test.d.ts +1 -0
- package/dist/cjs-browser/test/v4.test.js +61 -0
- package/dist/cjs-browser/test/v6.test.d.ts +1 -0
- package/dist/cjs-browser/test/v6.test.js +57 -0
- package/dist/cjs-browser/test/v7.test.d.ts +1 -0
- package/dist/cjs-browser/test/v7.test.js +195 -0
- package/dist/cjs-browser/test/validate.test.d.ts +1 -0
- package/dist/cjs-browser/test/validate.test.js +14 -0
- package/dist/cjs-browser/test/version.test.d.ts +1 -0
- package/dist/cjs-browser/test/version.test.js +21 -0
- package/dist/cjs-browser/uuid-bin.d.ts +1 -0
- package/dist/cjs-browser/uuid-bin.js +73 -0
- package/dist/cjs-browser/v1.d.ts +11 -0
- package/dist/cjs-browser/v1.js +79 -0
- package/dist/cjs-browser/v1ToV6.d.ts +2 -0
- package/dist/cjs-browser/v1ToV6.js +14 -0
- package/dist/cjs-browser/v3.d.ts +9 -0
- package/dist/cjs-browser/v3.js +15 -0
- package/dist/cjs-browser/v35.d.ts +7 -0
- package/dist/cjs-browser/v35.js +42 -0
- package/dist/cjs-browser/v4.d.ts +4 -0
- package/dist/cjs-browser/v4.js +24 -0
- package/dist/cjs-browser/v5.d.ts +9 -0
- package/dist/cjs-browser/v5.js +15 -0
- package/dist/cjs-browser/v6.d.ts +4 -0
- package/dist/cjs-browser/v6.js +20 -0
- package/dist/cjs-browser/v6ToV1.d.ts +2 -0
- package/dist/cjs-browser/v6ToV1.js +14 -0
- package/dist/cjs-browser/v7.d.ts +9 -0
- package/dist/cjs-browser/v7.js +61 -0
- package/dist/cjs-browser/validate.d.ts +2 -0
- package/dist/cjs-browser/validate.js +8 -0
- package/dist/cjs-browser/version.d.ts +2 -0
- package/dist/cjs-browser/version.js +11 -0
- package/dist/esm/_types.d.ts +21 -0
- package/dist/esm/_types.js +2 -0
- package/dist/esm/bin/uuid +2 -0
- package/dist/esm/index.d.ts +14 -0
- package/dist/esm/index.js +15 -0
- package/dist/esm/max.d.ts +2 -0
- package/dist/esm/max.js +2 -0
- package/dist/esm/md5.d.ts +2 -0
- package/dist/esm/md5.js +12 -0
- package/dist/esm/native.d.ts +5 -0
- package/dist/esm/native.js +3 -0
- package/dist/esm/nil.d.ts +2 -0
- package/dist/esm/nil.js +2 -0
- package/dist/esm/parse.d.ts +2 -0
- package/dist/esm/parse.js +10 -0
- package/dist/esm/regex.d.ts +2 -0
- package/dist/esm/regex.js +2 -0
- package/dist/esm/rng.d.ts +1 -0
- package/dist/esm/rng.js +11 -0
- package/dist/esm/sha1.d.ts +2 -0
- package/dist/esm/sha1.js +12 -0
- package/dist/esm/stringify.d.ts +3 -0
- package/dist/esm/stringify.js +36 -0
- package/dist/esm/test/parse.test.d.ts +1 -0
- package/dist/esm/test/parse.test.js +49 -0
- package/dist/esm/test/rng.test.d.ts +1 -0
- package/dist/esm/test/rng.test.js +13 -0
- package/dist/esm/test/stringify.test.d.ts +1 -0
- package/dist/esm/test/stringify.test.js +22 -0
- package/dist/esm/test/test_constants.d.ts +33 -0
- package/dist/esm/test/test_constants.js +89 -0
- package/dist/esm/test/v1.test.d.ts +1 -0
- package/dist/esm/test/v1.test.js +126 -0
- package/dist/esm/test/v35.test.d.ts +1 -0
- package/dist/esm/test/v35.test.js +142 -0
- package/dist/esm/test/v4.test.d.ts +1 -0
- package/dist/esm/test/v4.test.js +59 -0
- package/dist/esm/test/v6.test.d.ts +1 -0
- package/dist/esm/test/v6.test.js +55 -0
- package/dist/esm/test/v7.test.d.ts +1 -0
- package/dist/esm/test/v7.test.js +193 -0
- package/dist/esm/test/validate.test.d.ts +1 -0
- package/dist/esm/test/validate.test.js +12 -0
- package/dist/esm/test/version.test.d.ts +1 -0
- package/dist/esm/test/version.test.js +19 -0
- package/dist/esm/uuid-bin.d.ts +1 -0
- package/dist/esm/uuid-bin.js +71 -0
- package/dist/esm/v1.d.ts +11 -0
- package/dist/esm/v1.js +76 -0
- package/dist/esm/v1ToV6.d.ts +2 -0
- package/dist/esm/v1ToV6.js +11 -0
- package/dist/esm/v3.d.ts +9 -0
- package/dist/esm/v3.js +10 -0
- package/dist/esm/v35.d.ts +7 -0
- package/dist/esm/v35.js +37 -0
- package/dist/esm/v4.d.ts +4 -0
- package/dist/esm/v4.js +22 -0
- package/dist/esm/v5.d.ts +9 -0
- package/dist/esm/v5.js +10 -0
- package/dist/esm/v6.d.ts +4 -0
- package/dist/esm/v6.js +18 -0
- package/dist/esm/v6ToV1.d.ts +2 -0
- package/dist/esm/v6ToV1.js +11 -0
- package/dist/esm/v7.d.ts +9 -0
- package/dist/esm/v7.js +58 -0
- package/dist/esm/validate.d.ts +2 -0
- package/dist/esm/validate.js +6 -0
- package/dist/esm/version.d.ts +2 -0
- package/dist/esm/version.js +9 -0
- package/dist/esm-browser/_types.d.ts +21 -0
- package/dist/esm-browser/_types.js +2 -0
- package/dist/esm-browser/index.d.ts +14 -0
- package/dist/esm-browser/index.js +10 -4
- package/dist/esm-browser/max.d.ts +2 -0
- package/dist/esm-browser/max.js +2 -0
- package/dist/esm-browser/md5.d.ts +2 -0
- package/dist/esm-browser/md5.js +114 -193
- package/dist/esm-browser/native.d.ts +4 -0
- package/dist/esm-browser/native.js +2 -3
- package/dist/esm-browser/nil.d.ts +2 -0
- package/dist/esm-browser/nil.js +2 -1
- package/dist/esm-browser/parse.d.ts +2 -0
- package/dist/esm-browser/parse.js +7 -32
- package/dist/esm-browser/regex.d.ts +2 -0
- package/dist/esm-browser/regex.js +2 -1
- package/dist/esm-browser/rng.d.ts +1 -0
- package/dist/esm-browser/rng.js +7 -13
- package/dist/esm-browser/sha1.d.ts +2 -0
- package/dist/esm-browser/sha1.js +63 -88
- package/dist/esm-browser/stringify.d.ts +3 -0
- package/dist/esm-browser/stringify.js +28 -25
- package/dist/esm-browser/test/parse.test.d.ts +1 -0
- package/dist/esm-browser/test/parse.test.js +49 -0
- package/dist/esm-browser/test/rng.test.d.ts +1 -0
- package/dist/esm-browser/test/rng.test.js +13 -0
- package/dist/esm-browser/test/stringify.test.d.ts +1 -0
- package/dist/esm-browser/test/stringify.test.js +22 -0
- package/dist/esm-browser/test/test_constants.d.ts +33 -0
- package/dist/esm-browser/test/test_constants.js +89 -0
- package/dist/esm-browser/test/v1.test.d.ts +1 -0
- package/dist/esm-browser/test/v1.test.js +126 -0
- package/dist/esm-browser/test/v35.test.d.ts +1 -0
- package/dist/esm-browser/test/v35.test.js +142 -0
- package/dist/esm-browser/test/v4.test.d.ts +1 -0
- package/dist/esm-browser/test/v4.test.js +59 -0
- package/dist/esm-browser/test/v6.test.d.ts +1 -0
- package/dist/esm-browser/test/v6.test.js +55 -0
- package/dist/esm-browser/test/v7.test.d.ts +1 -0
- package/dist/esm-browser/test/v7.test.js +193 -0
- package/dist/esm-browser/test/validate.test.d.ts +1 -0
- package/dist/esm-browser/test/validate.test.js +12 -0
- package/dist/esm-browser/test/version.test.d.ts +1 -0
- package/dist/esm-browser/test/version.test.js +19 -0
- package/dist/esm-browser/uuid-bin.d.ts +1 -0
- package/dist/esm-browser/uuid-bin.js +71 -0
- package/dist/esm-browser/v1.d.ts +11 -0
- package/dist/esm-browser/v1.js +71 -90
- package/dist/esm-browser/v1ToV6.d.ts +2 -0
- package/dist/esm-browser/v1ToV6.js +11 -0
- package/dist/esm-browser/v3.d.ts +9 -0
- package/dist/esm-browser/v3.js +9 -3
- package/dist/esm-browser/v35.d.ts +7 -0
- package/dist/esm-browser/v35.js +28 -57
- package/dist/esm-browser/v4.d.ts +4 -0
- package/dist/esm-browser/v4.js +16 -23
- package/dist/esm-browser/v5.d.ts +9 -0
- package/dist/esm-browser/v5.js +9 -3
- package/dist/esm-browser/v6.d.ts +4 -0
- package/dist/esm-browser/v6.js +18 -0
- package/dist/esm-browser/v6ToV1.d.ts +2 -0
- package/dist/esm-browser/v6ToV1.js +11 -0
- package/dist/esm-browser/v7.d.ts +9 -0
- package/dist/esm-browser/v7.js +58 -0
- package/dist/esm-browser/validate.d.ts +2 -0
- package/dist/esm-browser/validate.js +3 -4
- package/dist/esm-browser/version.d.ts +2 -0
- package/dist/esm-browser/version.js +6 -8
- package/package.json +65 -63
- package/wrapper.mjs +6 -1
- package/dist/bin/uuid +0 -2
- package/dist/commonjs-browser/index.js +0 -79
- package/dist/commonjs-browser/md5.js +0 -223
- package/dist/commonjs-browser/native.js +0 -11
- package/dist/commonjs-browser/nil.js +0 -8
- package/dist/commonjs-browser/parse.js +0 -45
- package/dist/commonjs-browser/regex.js +0 -8
- package/dist/commonjs-browser/rng.js +0 -25
- package/dist/commonjs-browser/sha1.js +0 -104
- package/dist/commonjs-browser/stringify.js +0 -44
- package/dist/commonjs-browser/v1.js +0 -107
- package/dist/commonjs-browser/v3.js +0 -16
- package/dist/commonjs-browser/v35.js +0 -80
- package/dist/commonjs-browser/v4.js +0 -43
- package/dist/commonjs-browser/v5.js +0 -16
- package/dist/commonjs-browser/validate.js +0 -17
- package/dist/commonjs-browser/version.js +0 -21
- package/dist/esm-node/md5.js +0 -13
- package/dist/esm-node/native.js +0 -4
- package/dist/esm-node/nil.js +0 -1
- package/dist/esm-node/parse.js +0 -35
- package/dist/esm-node/regex.js +0 -1
- package/dist/esm-node/rng.js +0 -12
- package/dist/esm-node/sha1.js +0 -13
- package/dist/esm-node/stringify.js +0 -33
- package/dist/esm-node/v1.js +0 -95
- package/dist/esm-node/v3.js +0 -4
- package/dist/esm-node/v35.js +0 -66
- package/dist/esm-node/v4.js +0 -29
- package/dist/esm-node/v5.js +0 -4
- package/dist/esm-node/validate.js +0 -7
- package/dist/esm-node/version.js +0 -11
- package/dist/index.js +0 -79
- package/dist/md5-browser.js +0 -223
- package/dist/md5.js +0 -23
- package/dist/native-browser.js +0 -11
- package/dist/native.js +0 -15
- package/dist/nil.js +0 -8
- package/dist/parse.js +0 -45
- package/dist/regex.js +0 -8
- package/dist/rng-browser.js +0 -25
- package/dist/rng.js +0 -24
- package/dist/sha1-browser.js +0 -104
- package/dist/sha1.js +0 -23
- package/dist/stringify.js +0 -44
- package/dist/uuid-bin.js +0 -85
- package/dist/v1.js +0 -107
- package/dist/v3.js +0 -16
- package/dist/v35.js +0 -80
- package/dist/v4.js +0 -43
- package/dist/v5.js +0 -16
- package/dist/validate.js +0 -17
- package/dist/version.js +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,51 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [11.0.0-0](https://github.com/uuidjs/uuid/compare/v9.0.0...v11.0.0-0) (2024-09-05)
|
|
6
|
+
|
|
7
|
+
### ⚠ BREAKING CHANGES
|
|
8
|
+
|
|
9
|
+
- refactor v1 internal state and options logic (#780)
|
|
10
|
+
- refactor v7 internal state and options logic, fixes #764 (#779)
|
|
11
|
+
- Port to TypeScript, closes #762 (#763)
|
|
12
|
+
- update node support matrix (only support node 16-20) (#750)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- add support for MAX uuid (new in RFC9562) ([#714](https://github.com/uuidjs/uuid/issues/714)) ([0385cd3](https://github.com/uuidjs/uuid/commit/0385cd3f18ae9920678b2849932fa7a9d9aee7d0))
|
|
17
|
+
- Port to TypeScript, closes [#762](https://github.com/uuidjs/uuid/issues/762) ([#763](https://github.com/uuidjs/uuid/issues/763)) ([1e0f987](https://github.com/uuidjs/uuid/commit/1e0f9870db864ca93f7a69db0d468b5e1b7605e7))
|
|
18
|
+
- support v6 uuids ([#754](https://github.com/uuidjs/uuid/issues/754)) ([c4ed13e](https://github.com/uuidjs/uuid/commit/c4ed13e7159d87c9e42a349bdd9dc955f1af46b6))
|
|
19
|
+
- update node support matrix (only support node 16-20) ([#750](https://github.com/uuidjs/uuid/issues/750)) ([883b163](https://github.com/uuidjs/uuid/commit/883b163b9ab9d6655bfbd8a35e61a3c71674dfe1))
|
|
20
|
+
- v8 support ([#759](https://github.com/uuidjs/uuid/issues/759)) ([35a5342](https://github.com/uuidjs/uuid/commit/35a53428202657e402e6b4aa68f56c08194541bf))
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
- missing v7 expectations in browser spec ([#751](https://github.com/uuidjs/uuid/issues/751)) ([f54a866](https://github.com/uuidjs/uuid/commit/f54a866cedb2b3b96581157c1f4ac935a0b11411))
|
|
25
|
+
- refactor v1 internal state and options logic ([#780](https://github.com/uuidjs/uuid/issues/780)) ([031b3d3](https://github.com/uuidjs/uuid/commit/031b3d3d738bc6694501ac0a37152b95ed500989))
|
|
26
|
+
- refactor v7 internal state and options logic, fixes [#764](https://github.com/uuidjs/uuid/issues/764) ([#779](https://github.com/uuidjs/uuid/issues/779)) ([9dbd1cd](https://github.com/uuidjs/uuid/commit/9dbd1cd4177c43fcaac961a3b16fb2d044c9940a))
|
|
27
|
+
- remove v4 options default assignment preventing native.randomUUID from being used ([#786](https://github.com/uuidjs/uuid/issues/786)) ([afe6232](https://github.com/uuidjs/uuid/commit/afe62323c4408a824755a39d7b971a8ae06f7199)), closes [#763](https://github.com/uuidjs/uuid/issues/763)
|
|
28
|
+
- revert "perf: remove superfluous call to toLowerCase ([#677](https://github.com/uuidjs/uuid/issues/677))" ([#738](https://github.com/uuidjs/uuid/issues/738)) ([e267b90](https://github.com/uuidjs/uuid/commit/e267b9073df1d0ce119ee53c0487fe76acb2be37))
|
|
29
|
+
- seq_hi shift for byte 6 ([#775](https://github.com/uuidjs/uuid/issues/775)) ([1d532ca](https://github.com/uuidjs/uuid/commit/1d532ca374f181932a24a83fa98f71a5bd4f3e96))
|
|
30
|
+
- tsconfig module type ([#778](https://github.com/uuidjs/uuid/issues/778)) ([7eff835](https://github.com/uuidjs/uuid/commit/7eff835cba334ad418f57768c00d15b918a9b419))
|
|
31
|
+
|
|
32
|
+
## [10.0.0](https://github.com/uuidjs/uuid/compare/v9.0.0...v10.0.0) (2024-06-07)
|
|
33
|
+
|
|
34
|
+
### ⚠ BREAKING CHANGES
|
|
35
|
+
|
|
36
|
+
- update node support (drop node@12, node@14, add node@20) (#750)
|
|
37
|
+
|
|
38
|
+
### Features
|
|
39
|
+
|
|
40
|
+
- support support rfc9562 MAX uuid (new in RFC9562) ([#714](https://github.com/uuidjs/uuid/issues/714)) ([0385cd3](https://github.com/uuidjs/uuid/commit/0385cd3f18ae9920678b2849932fa7a9d9aee7d0))
|
|
41
|
+
- support rfc9562 v6 uuids ([#754](https://github.com/uuidjs/uuid/issues/754)) ([c4ed13e](https://github.com/uuidjs/uuid/commit/c4ed13e7159d87c9e42a349bdd9dc955f1af46b6))
|
|
42
|
+
- support rfc9562 v7 uuids ([#681](https://github.com/uuidjs/uuid/issues/681)) ([db76a12](https://github.com/uuidjs/uuid/commit/db76a1284760c441438f50a57924b322dae08891))
|
|
43
|
+
- update node support matrix (only support node 16-20) ([#750](https://github.com/uuidjs/uuid/issues/750)) ([883b163](https://github.com/uuidjs/uuid/commit/883b163b9ab9d6655bfbd8a35e61a3c71674dfe1))
|
|
44
|
+
- support rfc9562 v8 uuids ([#759](https://github.com/uuidjs/uuid/issues/759)) ([35a5342](https://github.com/uuidjs/uuid/commit/35a53428202657e402e6b4aa68f56c08194541bf))
|
|
45
|
+
|
|
46
|
+
### Bug Fixes
|
|
47
|
+
|
|
48
|
+
- revert "perf: remove superfluous call to toLowerCase ([#677](https://github.com/uuidjs/uuid/issues/677))" ([#738](https://github.com/uuidjs/uuid/issues/738)) ([e267b90](https://github.com/uuidjs/uuid/commit/e267b9073df1d0ce119ee53c0487fe76acb2be37))
|
|
49
|
+
|
|
5
50
|
## [9.0.1](https://github.com/uuidjs/uuid/compare/v9.0.0...v9.0.1) (2023-09-12)
|
|
6
51
|
|
|
7
52
|
### build
|
package/README.md
CHANGED
|
@@ -5,41 +5,42 @@
|
|
|
5
5
|
|
|
6
6
|
# uuid [](https://github.com/uuidjs/uuid/actions?query=workflow%3ACI) [](https://github.com/uuidjs/uuid/actions?query=workflow%3ABrowser)
|
|
7
7
|
|
|
8
|
-
For the creation of [RFC4122](https://www.
|
|
8
|
+
For the creation of [RFC9562](https://www.rfc-editor.org/rfc/rfc9562.html) (formally [RFC4122](https://www.rfc-editor.org/rfc/rfc4122.html)) UUIDs
|
|
9
9
|
|
|
10
|
-
- **Complete** - Support for
|
|
10
|
+
- **Complete** - Support for all RFC9562 UUID versions
|
|
11
11
|
- **Cross-platform** - Support for ...
|
|
12
|
-
- CommonJS, [ECMAScript Modules](#ecmascript-modules)
|
|
13
|
-
- NodeJS
|
|
12
|
+
- CommonJS, [ECMAScript Modules](#ecmascript-modules)
|
|
13
|
+
- NodeJS 16+ ([LTS releases](https://github.com/nodejs/Release))
|
|
14
14
|
- Chrome, Safari, Firefox, Edge browsers
|
|
15
|
-
- Webpack and rollup.js module bundlers
|
|
16
|
-
- [React Native / Expo](#react-native--expo)
|
|
17
15
|
- **Secure** - Cryptographically-strong random values
|
|
18
|
-
- **
|
|
16
|
+
- **Compact** - No dependencies, [tree-shakable](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking)
|
|
19
17
|
- **CLI** - Includes the [`uuid` command line](#command-line) utility
|
|
18
|
+
- **Typescript** - Types now included
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
>
|
|
20
|
+
<!-- prettier-ignore -->
|
|
21
|
+
> [!NOTE]
|
|
22
|
+
> `uuid@11` has the following breaking changes:
|
|
23
|
+
> * Passing `options` to `v1()`, `v6()`, and `v7()` now behaves slightly differently. [See details](#options-handling-for-timestamp-uuids)
|
|
24
|
+
> * Binary UUIDs are now of type `Uint8Array`. This may affect code utilizing `parse()`, `stringify()`, or that passes a `buf` argument to any of the `v1()`-`v7()` methods.
|
|
24
25
|
|
|
25
26
|
## Quickstart
|
|
26
27
|
|
|
27
|
-
To create a random UUID...
|
|
28
|
-
|
|
29
28
|
**1. Install**
|
|
30
29
|
|
|
31
30
|
```shell
|
|
32
31
|
npm install uuid
|
|
33
32
|
```
|
|
34
33
|
|
|
35
|
-
**2. Create a UUID**
|
|
34
|
+
**2. Create a UUID**
|
|
35
|
+
|
|
36
|
+
ESM-syntax (must use named exports):
|
|
36
37
|
|
|
37
38
|
```javascript
|
|
38
39
|
import { v4 as uuidv4 } from 'uuid';
|
|
39
40
|
uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
|
|
40
41
|
```
|
|
41
42
|
|
|
42
|
-
...
|
|
43
|
+
... CommonJS:
|
|
43
44
|
|
|
44
45
|
```javascript
|
|
45
46
|
const { v4: uuidv4 } = require('uuid');
|
|
@@ -53,12 +54,18 @@ For timestamp UUIDs, namespace UUIDs, and other options read on ...
|
|
|
53
54
|
| | | |
|
|
54
55
|
| --- | --- | --- |
|
|
55
56
|
| [`uuid.NIL`](#uuidnil) | The nil UUID string (all zeros) | New in `uuid@8.3` |
|
|
57
|
+
| [`uuid.MAX`](#uuidmax) | The max UUID string (all ones) | New in `uuid@9.1` |
|
|
56
58
|
| [`uuid.parse()`](#uuidparsestr) | Convert UUID string to array of bytes | New in `uuid@8.3` |
|
|
57
59
|
| [`uuid.stringify()`](#uuidstringifyarr-offset) | Convert array of bytes to UUID string | New in `uuid@8.3` |
|
|
58
60
|
| [`uuid.v1()`](#uuidv1options-buffer-offset) | Create a version 1 (timestamp) UUID | |
|
|
61
|
+
| [`uuid.v1ToV6()`](#uuidv1tov6uuid) | Create a version 6 UUID from a version 1 UUID | New in `uuid@10` |
|
|
59
62
|
| [`uuid.v3()`](#uuidv3name-namespace-buffer-offset) | Create a version 3 (namespace w/ MD5) UUID | |
|
|
60
63
|
| [`uuid.v4()`](#uuidv4options-buffer-offset) | Create a version 4 (random) UUID | |
|
|
61
64
|
| [`uuid.v5()`](#uuidv5name-namespace-buffer-offset) | Create a version 5 (namespace w/ SHA-1) UUID | |
|
|
65
|
+
| [`uuid.v6()`](#uuidv6options-buffer-offset) | Create a version 6 (timestamp, reordered) UUID | New in `uuid@10` |
|
|
66
|
+
| [`uuid.v6ToV1()`](#uuidv6tov1uuid) | Create a version 1 UUID from a version 6 UUID | New in `uuid@10` |
|
|
67
|
+
| [`uuid.v7()`](#uuidv7options-buffer-offset) | Create a version 7 (Unix Epoch time-based) UUID | New in `uuid@10` |
|
|
68
|
+
| ~~[`uuid.v8()`](#uuidv8)~~ | "Intentionally left blank" | |
|
|
62
69
|
| [`uuid.validate()`](#uuidvalidatestr) | Test a string to see if it is a valid UUID | New in `uuid@8.3` |
|
|
63
70
|
| [`uuid.version()`](#uuidversionstr) | Detect RFC version of a UUID | New in `uuid@8.3` |
|
|
64
71
|
|
|
@@ -76,6 +83,18 @@ import { NIL as NIL_UUID } from 'uuid';
|
|
|
76
83
|
NIL_UUID; // ⇨ '00000000-0000-0000-0000-000000000000'
|
|
77
84
|
```
|
|
78
85
|
|
|
86
|
+
### uuid.MAX
|
|
87
|
+
|
|
88
|
+
The max UUID string (all ones).
|
|
89
|
+
|
|
90
|
+
Example:
|
|
91
|
+
|
|
92
|
+
```javascript
|
|
93
|
+
import { MAX as MAX_UUID } from 'uuid';
|
|
94
|
+
|
|
95
|
+
MAX_UUID; // ⇨ 'ffffffff-ffff-ffff-ffff-ffffffffffff'
|
|
96
|
+
```
|
|
97
|
+
|
|
79
98
|
### uuid.parse(str)
|
|
80
99
|
|
|
81
100
|
Convert UUID string to array of bytes
|
|
@@ -86,7 +105,9 @@ Convert UUID string to array of bytes
|
|
|
86
105
|
| _returns_ | `Uint8Array[16]` |
|
|
87
106
|
| _throws_ | `TypeError` if `str` is not a valid UUID |
|
|
88
107
|
|
|
89
|
-
|
|
108
|
+
<!-- prettier-ignore -->
|
|
109
|
+
> [!NOTE]
|
|
110
|
+
> Ordering of values in the byte arrays used by `parse()` and `stringify()` follows the left ↠ right order of hex-pairs in UUID strings. As shown in the example below.
|
|
90
111
|
|
|
91
112
|
Example:
|
|
92
113
|
|
|
@@ -94,15 +115,12 @@ Example:
|
|
|
94
115
|
import { parse as uuidParse } from 'uuid';
|
|
95
116
|
|
|
96
117
|
// Parse a UUID
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
//
|
|
100
|
-
|
|
101
|
-
//
|
|
102
|
-
//
|
|
103
|
-
// '11', 'c0', '43', 'da',
|
|
104
|
-
// '97', '5e', '2a', '8a',
|
|
105
|
-
// 'd9', 'eb', 'ae', '0b'
|
|
118
|
+
uuidParse('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // ⇨
|
|
119
|
+
// Uint8Array(16) [
|
|
120
|
+
// 110, 192, 189, 127, 17,
|
|
121
|
+
// 192, 67, 218, 151, 94,
|
|
122
|
+
// 42, 138, 217, 235, 174,
|
|
123
|
+
// 11
|
|
106
124
|
// ]
|
|
107
125
|
```
|
|
108
126
|
|
|
@@ -117,16 +135,33 @@ Convert array of bytes to UUID string
|
|
|
117
135
|
| _returns_ | `String` |
|
|
118
136
|
| _throws_ | `TypeError` if a valid UUID string cannot be generated |
|
|
119
137
|
|
|
120
|
-
|
|
138
|
+
<!-- prettier-ignore -->
|
|
139
|
+
> [!NOTE]
|
|
140
|
+
> Ordering of values in the byte arrays used by `parse()` and `stringify()` follows the left ↠ right order of hex-pairs in UUID strings. As shown in the example below.
|
|
121
141
|
|
|
122
142
|
Example:
|
|
123
143
|
|
|
124
144
|
```javascript
|
|
125
145
|
import { stringify as uuidStringify } from 'uuid';
|
|
126
146
|
|
|
127
|
-
const uuidBytes =
|
|
128
|
-
0x6e,
|
|
129
|
-
|
|
147
|
+
const uuidBytes = Uint8Array.of(
|
|
148
|
+
0x6e,
|
|
149
|
+
0xc0,
|
|
150
|
+
0xbd,
|
|
151
|
+
0x7f,
|
|
152
|
+
0x11,
|
|
153
|
+
0xc0,
|
|
154
|
+
0x43,
|
|
155
|
+
0xda,
|
|
156
|
+
0x97,
|
|
157
|
+
0x5e,
|
|
158
|
+
0x2a,
|
|
159
|
+
0x8a,
|
|
160
|
+
0xd9,
|
|
161
|
+
0xeb,
|
|
162
|
+
0xae,
|
|
163
|
+
0x0b
|
|
164
|
+
);
|
|
130
165
|
|
|
131
166
|
uuidStringify(uuidBytes); // ⇨ '6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'
|
|
132
167
|
```
|
|
@@ -149,16 +184,20 @@ Create an RFC version 1 (timestamp) UUID
|
|
|
149
184
|
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
|
|
150
185
|
| _throws_ | `Error` if more than 10M UUIDs/sec are requested |
|
|
151
186
|
|
|
152
|
-
|
|
187
|
+
<!-- prettier-ignore -->
|
|
188
|
+
> [!NOTE]
|
|
189
|
+
> The default [node id](https://datatracker.ietf.org/doc/html/rfc9562#section-5.1) (the last 12 digits in the UUID) is generated once, randomly, on process startup, and then remains unchanged for the duration of the process.
|
|
153
190
|
|
|
154
|
-
|
|
191
|
+
<!-- prettier-ignore -->
|
|
192
|
+
> [!NOTE]
|
|
193
|
+
> `options.random` and `options.rng` are only meaningful on the very first call to `v1()`, where they may be passed to initialize the internal `node` and `clockseq` fields.
|
|
155
194
|
|
|
156
195
|
Example:
|
|
157
196
|
|
|
158
197
|
```javascript
|
|
159
198
|
import { v1 as uuidv1 } from 'uuid';
|
|
160
199
|
|
|
161
|
-
uuidv1(); // ⇨ '2c5ea4c0-4067-11e9-
|
|
200
|
+
uuidv1(); // ⇨ '2c5ea4c0-4067-11e9-9bdd-2b0d7b3dcb6d'
|
|
162
201
|
```
|
|
163
202
|
|
|
164
203
|
Example using `options`:
|
|
@@ -166,13 +205,23 @@ Example using `options`:
|
|
|
166
205
|
```javascript
|
|
167
206
|
import { v1 as uuidv1 } from 'uuid';
|
|
168
207
|
|
|
169
|
-
const
|
|
170
|
-
node:
|
|
208
|
+
const options = {
|
|
209
|
+
node: Uint8Array.of(0x01, 0x23, 0x45, 0x67, 0x89, 0xab),
|
|
171
210
|
clockseq: 0x1234,
|
|
172
211
|
msecs: new Date('2011-11-01').getTime(),
|
|
173
212
|
nsecs: 5678,
|
|
174
213
|
};
|
|
175
|
-
uuidv1(
|
|
214
|
+
uuidv1(options); // ⇨ '710b962e-041c-11e1-9234-0123456789ab'
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### uuid.v1ToV6(uuid)
|
|
218
|
+
|
|
219
|
+
Convert a UUID from version 1 to version 6
|
|
220
|
+
|
|
221
|
+
```javascript
|
|
222
|
+
import { v1ToV6 } from 'uuid';
|
|
223
|
+
|
|
224
|
+
v1ToV6('92f62d9e-22c4-11ef-97e9-325096b39f47'); // ⇨ '1ef22c49-2f62-6d9e-97e9-325096b39f47'
|
|
176
225
|
```
|
|
177
226
|
|
|
178
227
|
### uuid.v3(name, namespace[, buffer[, offset]])
|
|
@@ -181,7 +230,9 @@ Create an RFC version 3 (namespace w/ MD5) UUID
|
|
|
181
230
|
|
|
182
231
|
API is identical to `v5()`, but uses "v3" instead.
|
|
183
232
|
|
|
184
|
-
|
|
233
|
+
<!-- prettier-ignore -->
|
|
234
|
+
> [!IMPORTANT]
|
|
235
|
+
> Per the RFC, "_If backward compatibility is not an issue, SHA-1 [Version 5] is preferred_."
|
|
185
236
|
|
|
186
237
|
### uuid.v4([options[, buffer[, offset]]])
|
|
187
238
|
|
|
@@ -201,7 +252,7 @@ Example:
|
|
|
201
252
|
```javascript
|
|
202
253
|
import { v4 as uuidv4 } from 'uuid';
|
|
203
254
|
|
|
204
|
-
uuidv4(); // ⇨ '
|
|
255
|
+
uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
|
|
205
256
|
```
|
|
206
257
|
|
|
207
258
|
Example using predefined `random` values:
|
|
@@ -210,9 +261,24 @@ Example using predefined `random` values:
|
|
|
210
261
|
import { v4 as uuidv4 } from 'uuid';
|
|
211
262
|
|
|
212
263
|
const v4options = {
|
|
213
|
-
random:
|
|
214
|
-
0x10,
|
|
215
|
-
|
|
264
|
+
random: Uint8Array.of(
|
|
265
|
+
0x10,
|
|
266
|
+
0x91,
|
|
267
|
+
0x56,
|
|
268
|
+
0xbe,
|
|
269
|
+
0xc4,
|
|
270
|
+
0xfb,
|
|
271
|
+
0xc1,
|
|
272
|
+
0xea,
|
|
273
|
+
0x71,
|
|
274
|
+
0xb4,
|
|
275
|
+
0xef,
|
|
276
|
+
0xe1,
|
|
277
|
+
0x67,
|
|
278
|
+
0x1c,
|
|
279
|
+
0x58,
|
|
280
|
+
0x36
|
|
281
|
+
),
|
|
216
282
|
};
|
|
217
283
|
uuidv4(v4options); // ⇨ '109156be-c4fb-41ea-b1b4-efe1671c5836'
|
|
218
284
|
```
|
|
@@ -229,7 +295,9 @@ Create an RFC version 5 (namespace w/ SHA-1) UUID
|
|
|
229
295
|
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
|
|
230
296
|
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
|
|
231
297
|
|
|
232
|
-
|
|
298
|
+
<!-- prettier-ignore -->
|
|
299
|
+
> [!NOTE]
|
|
300
|
+
> The RFC `DNS` and `URL` namespaces are available as `v5.DNS` and `v5.URL`.
|
|
233
301
|
|
|
234
302
|
Example with custom namespace:
|
|
235
303
|
|
|
@@ -251,6 +319,73 @@ import { v5 as uuidv5 } from 'uuid';
|
|
|
251
319
|
uuidv5('https://www.w3.org/', uuidv5.URL); // ⇨ 'c106a26a-21bb-5538-8bf2-57095d1976c1'
|
|
252
320
|
```
|
|
253
321
|
|
|
322
|
+
### uuid.v6([options[, buffer[, offset]]])
|
|
323
|
+
|
|
324
|
+
Create an RFC version 6 (timestamp, reordered) UUID
|
|
325
|
+
|
|
326
|
+
This method takes the same arguments as uuid.v1().
|
|
327
|
+
|
|
328
|
+
```javascript
|
|
329
|
+
import { v6 as uuidv6 } from 'uuid';
|
|
330
|
+
|
|
331
|
+
uuidv6(); // ⇨ '1e940672-c5ea-64c0-9b5d-ab8dfbbd4bed'
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
Example using `options`:
|
|
335
|
+
|
|
336
|
+
```javascript
|
|
337
|
+
import { v6 as uuidv6 } from 'uuid';
|
|
338
|
+
|
|
339
|
+
const options = {
|
|
340
|
+
node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],
|
|
341
|
+
clockseq: 0x1234,
|
|
342
|
+
msecs: new Date('2011-11-01').getTime(),
|
|
343
|
+
nsecs: 5678,
|
|
344
|
+
};
|
|
345
|
+
uuidv6(options); // ⇨ '1e1041c7-10b9-662e-9234-0123456789ab'
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### uuid.v6ToV1(uuid)
|
|
349
|
+
|
|
350
|
+
Convert a UUID from version 6 to version 1
|
|
351
|
+
|
|
352
|
+
```javascript
|
|
353
|
+
import { v6ToV1 } from 'uuid';
|
|
354
|
+
|
|
355
|
+
v6ToV1('1ef22c49-2f62-6d9e-97e9-325096b39f47'); // ⇨ '92f62d9e-22c4-11ef-97e9-325096b39f47'
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
### uuid.v7([options[, buffer[, offset]]])
|
|
359
|
+
|
|
360
|
+
Create an RFC version 7 (random) UUID
|
|
361
|
+
|
|
362
|
+
| | |
|
|
363
|
+
| --- | --- |
|
|
364
|
+
| [`options`] | `Object` with one or more of the following properties: |
|
|
365
|
+
| [`options.msecs`] | RFC "timestamp" field (`Number` of milliseconds, unix epoch). Default = `Date.now()` |
|
|
366
|
+
| [`options.random`] | `Array` of 16 random bytes (0-255) |
|
|
367
|
+
| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |
|
|
368
|
+
| [`options.seq`] | 32-bit sequence `Number` between 0 - 0xffffffff. This may be provided to help insure uniqueness for UUIDs generated within the same millisecond time interval. Default = random value. |
|
|
369
|
+
| [`buffer`] | `Array \| Buffer` If specified, uuid will be written here in byte-form, starting at `offset` |
|
|
370
|
+
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
|
|
371
|
+
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
|
|
372
|
+
|
|
373
|
+
Example:
|
|
374
|
+
|
|
375
|
+
```javascript
|
|
376
|
+
import { v7 as uuidv7 } from 'uuid';
|
|
377
|
+
|
|
378
|
+
uuidv7(); // ⇨ '01695553-c90c-705a-b56d-778dfbbd4bed'
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### ~~uuid.v8()~~
|
|
382
|
+
|
|
383
|
+
**_"Intentionally left blank"_**
|
|
384
|
+
|
|
385
|
+
<!-- prettier-ignore -->
|
|
386
|
+
> [!NOTE]
|
|
387
|
+
> Version 8 (experimental) UUIDs are "[for experimental or vendor-specific use cases](https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-8)". The RFC does not define a creation algorithm for them, which is why this package does not offer a `v8()` method. The `validate()` and `version()` methods do work with such UUIDs, however.
|
|
388
|
+
|
|
254
389
|
### uuid.validate(str)
|
|
255
390
|
|
|
256
391
|
Test a string to see if it is a valid UUID
|
|
@@ -305,6 +440,10 @@ uuidVersion('45637ec4-c85f-11ea-87d0-0242ac130003'); // ⇨ 1
|
|
|
305
440
|
uuidVersion('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // ⇨ 4
|
|
306
441
|
```
|
|
307
442
|
|
|
443
|
+
<!-- prettier-ignore -->
|
|
444
|
+
> [!NOTE]
|
|
445
|
+
> This method returns `0` for the `NIL` UUID, and `15` for the `MAX` UUID.
|
|
446
|
+
|
|
308
447
|
## Command Line
|
|
309
448
|
|
|
310
449
|
UUIDs can be generated from the command line using `uuid`.
|
|
@@ -325,141 +464,21 @@ Usage:
|
|
|
325
464
|
uuid v3 <name> <namespace uuid>
|
|
326
465
|
uuid v4
|
|
327
466
|
uuid v5 <name> <namespace uuid>
|
|
467
|
+
uuid v7
|
|
328
468
|
uuid --help
|
|
329
469
|
|
|
330
470
|
Note: <namespace uuid> may be "URL" or "DNS" to use the corresponding UUIDs
|
|
331
|
-
defined by
|
|
471
|
+
defined by RFC9562
|
|
332
472
|
```
|
|
333
473
|
|
|
334
|
-
##
|
|
474
|
+
## `options` Handling for Timestamp UUIDs
|
|
335
475
|
|
|
336
|
-
|
|
476
|
+
As of `uuid@11`, all timestamp-based UUID APIs (`v1()`, `v6()`, and `v7()`) now operate in two distinct modes:
|
|
337
477
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
To run the examples you must first create a dist build of this library in the module root:
|
|
344
|
-
|
|
345
|
-
```shell
|
|
346
|
-
npm run build
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
## CDN Builds
|
|
350
|
-
|
|
351
|
-
### ECMAScript Modules
|
|
352
|
-
|
|
353
|
-
To load this module directly into modern browsers that [support loading ECMAScript Modules](https://caniuse.com/#feat=es6-module) you can make use of [jspm](https://jspm.org/):
|
|
354
|
-
|
|
355
|
-
```html
|
|
356
|
-
<script type="module">
|
|
357
|
-
import { v4 as uuidv4 } from 'https://jspm.dev/uuid';
|
|
358
|
-
console.log(uuidv4()); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
|
|
359
|
-
</script>
|
|
360
|
-
```
|
|
361
|
-
|
|
362
|
-
### UMD
|
|
363
|
-
|
|
364
|
-
As of `uuid@9` [UMD (Universal Module Definition)](https://github.com/umdjs/umd) builds are no longer shipped with this library.
|
|
365
|
-
|
|
366
|
-
If you need a UMD build of this library, use a bundler like Webpack or Rollup. Alternatively, refer to the documentation of [`uuid@8.3.2`](https://github.com/uuidjs/uuid/blob/v8.3.2/README.md#umd) which was the last version that shipped UMD builds.
|
|
367
|
-
|
|
368
|
-
## Known issues
|
|
369
|
-
|
|
370
|
-
### Duplicate UUIDs (Googlebot)
|
|
371
|
-
|
|
372
|
-
This module may generate duplicate UUIDs when run in clients with _deterministic_ random number generators, such as [Googlebot crawlers](https://developers.google.com/search/docs/advanced/crawling/overview-google-crawlers). This can cause problems for apps that expect client-generated UUIDs to always be unique. Developers should be prepared for this and have a strategy for dealing with possible collisions, such as:
|
|
373
|
-
|
|
374
|
-
- Check for duplicate UUIDs, fail gracefully
|
|
375
|
-
- Disable write operations for Googlebot clients
|
|
376
|
-
|
|
377
|
-
### "getRandomValues() not supported"
|
|
378
|
-
|
|
379
|
-
This error occurs in environments where the standard [`crypto.getRandomValues()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues) API is not supported. This issue can be resolved by adding an appropriate polyfill:
|
|
380
|
-
|
|
381
|
-
### React Native / Expo
|
|
382
|
-
|
|
383
|
-
1. Install [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme)
|
|
384
|
-
1. Import it _before_ `uuid`. Since `uuid` might also appear as a transitive dependency of some other imports it's safest to just import `react-native-get-random-values` as the very first thing in your entry point:
|
|
385
|
-
|
|
386
|
-
```javascript
|
|
387
|
-
import 'react-native-get-random-values';
|
|
388
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
Note: If you are using Expo, you must be using at least `react-native-get-random-values@1.5.0` and `expo@39.0.0`.
|
|
392
|
-
|
|
393
|
-
### Web Workers / Service Workers (Edge <= 18)
|
|
394
|
-
|
|
395
|
-
[In Edge <= 18, Web Crypto is not supported in Web Workers or Service Workers](https://caniuse.com/#feat=cryptography) and we are not aware of a polyfill (let us know if you find one, please).
|
|
396
|
-
|
|
397
|
-
### IE 11 (Internet Explorer)
|
|
398
|
-
|
|
399
|
-
Support for IE11 and other legacy browsers has been dropped as of `uuid@9`. If you need to support legacy browsers, you can always transpile the uuid module source yourself (e.g. using [Babel](https://babeljs.io/)).
|
|
400
|
-
|
|
401
|
-
## Upgrading From `uuid@7`
|
|
402
|
-
|
|
403
|
-
### Only Named Exports Supported When Using with Node.js ESM
|
|
404
|
-
|
|
405
|
-
`uuid@7` did not come with native ECMAScript Module (ESM) support for Node.js. Importing it in Node.js ESM consequently imported the CommonJS source with a default export. This library now comes with true Node.js ESM support and only provides named exports.
|
|
406
|
-
|
|
407
|
-
Instead of doing:
|
|
408
|
-
|
|
409
|
-
```javascript
|
|
410
|
-
import uuid from 'uuid';
|
|
411
|
-
uuid.v4();
|
|
412
|
-
```
|
|
413
|
-
|
|
414
|
-
you will now have to use the named exports:
|
|
415
|
-
|
|
416
|
-
```javascript
|
|
417
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
418
|
-
uuidv4();
|
|
419
|
-
```
|
|
420
|
-
|
|
421
|
-
### Deep Requires No Longer Supported
|
|
422
|
-
|
|
423
|
-
Deep requires like `require('uuid/v4')` [which have been deprecated in `uuid@7`](#deep-requires-now-deprecated) are no longer supported.
|
|
424
|
-
|
|
425
|
-
## Upgrading From `uuid@3`
|
|
426
|
-
|
|
427
|
-
"_Wait... what happened to `uuid@4` thru `uuid@6`?!?_"
|
|
428
|
-
|
|
429
|
-
In order to avoid confusion with RFC [version 4](#uuidv4options-buffer-offset) and [version 5](#uuidv5name-namespace-buffer-offset) UUIDs, and a possible [version 6](http://gh.peabody.io/uuidv6/), releases 4 thru 6 of this module have been skipped.
|
|
430
|
-
|
|
431
|
-
### Deep Requires Now Deprecated
|
|
432
|
-
|
|
433
|
-
`uuid@3` encouraged the use of deep requires to minimize the bundle size of browser builds:
|
|
434
|
-
|
|
435
|
-
```javascript
|
|
436
|
-
const uuidv4 = require('uuid/v4'); // <== NOW DEPRECATED!
|
|
437
|
-
uuidv4();
|
|
438
|
-
```
|
|
439
|
-
|
|
440
|
-
As of `uuid@7` this library now provides ECMAScript modules builds, which allow packagers like Webpack and Rollup to do "tree-shaking" to remove dead code. Instead, use the `import` syntax:
|
|
441
|
-
|
|
442
|
-
```javascript
|
|
443
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
444
|
-
uuidv4();
|
|
445
|
-
```
|
|
446
|
-
|
|
447
|
-
... or for CommonJS:
|
|
448
|
-
|
|
449
|
-
```javascript
|
|
450
|
-
const { v4: uuidv4 } = require('uuid');
|
|
451
|
-
uuidv4();
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
### Default Export Removed
|
|
455
|
-
|
|
456
|
-
`uuid@3` was exporting the Version 4 UUID method as a default export:
|
|
457
|
-
|
|
458
|
-
```javascript
|
|
459
|
-
const uuid = require('uuid'); // <== REMOVED!
|
|
460
|
-
```
|
|
478
|
+
- Without `options`: If no `options` argument is passed, these APIs will make use of internal state such as a sequence counter to improve UUID uniqueness.
|
|
479
|
+
- With `options`: If an `options` argument of any kind is passed, no internal state is used or updated. Instead, appropriate defaults are used. See the respective APIs for details.
|
|
461
480
|
|
|
462
|
-
|
|
481
|
+
Prior to `uuid@11`, this distinction was less clear. Internal state was was being combined with `options` values in ways that were difficult to rationalize about, and that could lead to unpredictable behavior. Hence, this change.
|
|
463
482
|
|
|
464
483
|
---
|
|
465
484
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type UUIDTypes = string | Uint8Array;
|
|
2
|
+
export type Version1Options = {
|
|
3
|
+
node?: Uint8Array;
|
|
4
|
+
clockseq?: number;
|
|
5
|
+
random?: Uint8Array;
|
|
6
|
+
rng?: () => Uint8Array;
|
|
7
|
+
msecs?: number;
|
|
8
|
+
nsecs?: number;
|
|
9
|
+
_v6?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export type Version4Options = {
|
|
12
|
+
random?: Uint8Array;
|
|
13
|
+
rng?: () => Uint8Array;
|
|
14
|
+
};
|
|
15
|
+
export type Version6Options = Version1Options;
|
|
16
|
+
export type Version7Options = {
|
|
17
|
+
random?: Uint8Array;
|
|
18
|
+
msecs?: number;
|
|
19
|
+
seq?: number;
|
|
20
|
+
rng?: () => Uint8Array;
|
|
21
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { default as MAX } from './max.js';
|
|
2
|
+
export { default as NIL } from './nil.js';
|
|
3
|
+
export { default as parse } from './parse.js';
|
|
4
|
+
export { default as stringify } from './stringify.js';
|
|
5
|
+
export { default as v1 } from './v1.js';
|
|
6
|
+
export { default as v1ToV6 } from './v1ToV6.js';
|
|
7
|
+
export { default as v3 } from './v3.js';
|
|
8
|
+
export { default as v4 } from './v4.js';
|
|
9
|
+
export { default as v5 } from './v5.js';
|
|
10
|
+
export { default as v6 } from './v6.js';
|
|
11
|
+
export { default as v6ToV1 } from './v6ToV1.js';
|
|
12
|
+
export { default as v7 } from './v7.js';
|
|
13
|
+
export { default as validate } from './validate.js';
|
|
14
|
+
export { default as version } from './version.js';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.version = exports.validate = exports.v7 = exports.v6ToV1 = exports.v6 = exports.v5 = exports.v4 = exports.v3 = exports.v1ToV6 = exports.v1 = exports.stringify = exports.parse = exports.NIL = exports.MAX = void 0;
|
|
4
|
+
var max_js_1 = require("./max.js");
|
|
5
|
+
Object.defineProperty(exports, "MAX", { enumerable: true, get: function () { return max_js_1.default; } });
|
|
6
|
+
var nil_js_1 = require("./nil.js");
|
|
7
|
+
Object.defineProperty(exports, "NIL", { enumerable: true, get: function () { return nil_js_1.default; } });
|
|
8
|
+
var parse_js_1 = require("./parse.js");
|
|
9
|
+
Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return parse_js_1.default; } });
|
|
10
|
+
var stringify_js_1 = require("./stringify.js");
|
|
11
|
+
Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return stringify_js_1.default; } });
|
|
12
|
+
var v1_js_1 = require("./v1.js");
|
|
13
|
+
Object.defineProperty(exports, "v1", { enumerable: true, get: function () { return v1_js_1.default; } });
|
|
14
|
+
var v1ToV6_js_1 = require("./v1ToV6.js");
|
|
15
|
+
Object.defineProperty(exports, "v1ToV6", { enumerable: true, get: function () { return v1ToV6_js_1.default; } });
|
|
16
|
+
var v3_js_1 = require("./v3.js");
|
|
17
|
+
Object.defineProperty(exports, "v3", { enumerable: true, get: function () { return v3_js_1.default; } });
|
|
18
|
+
var v4_js_1 = require("./v4.js");
|
|
19
|
+
Object.defineProperty(exports, "v4", { enumerable: true, get: function () { return v4_js_1.default; } });
|
|
20
|
+
var v5_js_1 = require("./v5.js");
|
|
21
|
+
Object.defineProperty(exports, "v5", { enumerable: true, get: function () { return v5_js_1.default; } });
|
|
22
|
+
var v6_js_1 = require("./v6.js");
|
|
23
|
+
Object.defineProperty(exports, "v6", { enumerable: true, get: function () { return v6_js_1.default; } });
|
|
24
|
+
var v6ToV1_js_1 = require("./v6ToV1.js");
|
|
25
|
+
Object.defineProperty(exports, "v6ToV1", { enumerable: true, get: function () { return v6ToV1_js_1.default; } });
|
|
26
|
+
var v7_js_1 = require("./v7.js");
|
|
27
|
+
Object.defineProperty(exports, "v7", { enumerable: true, get: function () { return v7_js_1.default; } });
|
|
28
|
+
var validate_js_1 = require("./validate.js");
|
|
29
|
+
Object.defineProperty(exports, "validate", { enumerable: true, get: function () { return validate_js_1.default; } });
|
|
30
|
+
var version_js_1 = require("./version.js");
|
|
31
|
+
Object.defineProperty(exports, "version", { enumerable: true, get: function () { return version_js_1.default; } });
|
|
32
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsbUNBQTBDO0FBQWpDLDZGQUFBLE9BQU8sT0FBTztBQUN2QixtQ0FBMEM7QUFBakMsNkZBQUEsT0FBTyxPQUFPO0FBQ3ZCLHVDQUE4QztBQUFyQyxpR0FBQSxPQUFPLE9BQVM7QUFDekIsK0NBQXNEO0FBQTdDLHlHQUFBLE9BQU8sT0FBYTtBQUM3QixpQ0FBd0M7QUFBL0IsMkZBQUEsT0FBTyxPQUFNO0FBQ3RCLHlDQUFnRDtBQUF2QyxtR0FBQSxPQUFPLE9BQVU7QUFDMUIsaUNBQXdDO0FBQS9CLDJGQUFBLE9BQU8sT0FBTTtBQUN0QixpQ0FBd0M7QUFBL0IsMkZBQUEsT0FBTyxPQUFNO0FBQ3RCLGlDQUF3QztBQUEvQiwyRkFBQSxPQUFPLE9BQU07QUFDdEIsaUNBQXdDO0FBQS9CLDJGQUFBLE9BQU8sT0FBTTtBQUN0Qix5Q0FBZ0Q7QUFBdkMsbUdBQUEsT0FBTyxPQUFVO0FBQzFCLGlDQUF3QztBQUEvQiwyRkFBQSxPQUFPLE9BQU07QUFDdEIsNkNBQW9EO0FBQTNDLHVHQUFBLE9BQU8sT0FBWTtBQUM1QiwyQ0FBa0Q7QUFBekMscUdBQUEsT0FBTyxPQUFXIn0=
|
package/dist/cjs/max.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = 'ffffffff-ffff-ffff-ffff-ffffffffffff';
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWF4LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL21heC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGtCQUFlLHNDQUFzQyxDQUFDIn0=
|