node-red-contrib-web-worldmap 5.7.2 → 5.8.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 +1 -0
- package/README.md +3 -2
- package/node_modules/uuid/README.md +182 -177
- package/node_modules/uuid/dist/cjs/index.d.ts +15 -0
- package/node_modules/uuid/dist/cjs/index.js +31 -0
- package/node_modules/uuid/dist/cjs/max.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/max.js +3 -0
- package/node_modules/uuid/dist/cjs/md5.d.ts +4 -0
- package/node_modules/uuid/dist/cjs/md5.js +13 -0
- package/node_modules/uuid/dist/cjs/native.d.ts +6 -0
- package/node_modules/uuid/dist/cjs/native.js +4 -0
- package/node_modules/uuid/dist/cjs/nil.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/nil.js +3 -0
- package/node_modules/uuid/dist/cjs/package.json +1 -0
- package/node_modules/uuid/dist/cjs/parse.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/parse.js +11 -0
- package/node_modules/uuid/dist/cjs/regex.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/regex.js +3 -0
- package/node_modules/uuid/dist/cjs/rng.d.ts +1 -0
- package/node_modules/uuid/dist/cjs/rng.js +13 -0
- package/node_modules/uuid/dist/cjs/sha1.d.ts +4 -0
- package/node_modules/uuid/dist/cjs/sha1.js +13 -0
- package/node_modules/uuid/dist/cjs/stringify.d.ts +3 -0
- package/node_modules/uuid/dist/cjs/stringify.js +39 -0
- package/node_modules/uuid/dist/cjs/types.d.ts +21 -0
- package/node_modules/uuid/dist/cjs/types.js +2 -0
- package/node_modules/uuid/dist/cjs/uuid-bin.d.ts +1 -0
- package/node_modules/uuid/dist/cjs/uuid-bin.js +72 -0
- package/node_modules/uuid/dist/cjs/v1.d.ts +11 -0
- package/node_modules/uuid/dist/cjs/v1.js +87 -0
- package/node_modules/uuid/dist/cjs/v1ToV6.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/v1ToV6.js +13 -0
- package/node_modules/uuid/dist/cjs/v3.d.ts +9 -0
- package/node_modules/uuid/dist/cjs/v3.js +14 -0
- package/node_modules/uuid/dist/cjs/v35.d.ts +7 -0
- package/node_modules/uuid/dist/cjs/v35.js +44 -0
- package/node_modules/uuid/dist/cjs/v4.d.ts +4 -0
- package/node_modules/uuid/dist/cjs/v4.js +29 -0
- package/node_modules/uuid/dist/cjs/v5.d.ts +9 -0
- package/node_modules/uuid/dist/cjs/v5.js +14 -0
- package/node_modules/uuid/dist/cjs/v6.d.ts +4 -0
- package/node_modules/uuid/dist/cjs/v6.js +22 -0
- package/node_modules/uuid/dist/cjs/v6ToV1.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/v6ToV1.js +13 -0
- package/node_modules/uuid/dist/cjs/v7.d.ts +9 -0
- package/node_modules/uuid/dist/cjs/v7.js +69 -0
- package/node_modules/uuid/dist/cjs/validate.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/validate.js +7 -0
- package/node_modules/uuid/dist/cjs/version.d.ts +2 -0
- package/node_modules/uuid/dist/cjs/version.js +10 -0
- package/node_modules/uuid/dist/cjs-browser/index.d.ts +15 -0
- package/node_modules/uuid/dist/cjs-browser/index.js +31 -0
- package/node_modules/uuid/dist/cjs-browser/max.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/max.js +3 -0
- package/node_modules/uuid/dist/cjs-browser/md5.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/md5.js +137 -0
- package/node_modules/uuid/dist/cjs-browser/native.d.ts +4 -0
- package/node_modules/uuid/dist/cjs-browser/native.js +4 -0
- package/node_modules/uuid/dist/cjs-browser/nil.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/nil.js +3 -0
- package/node_modules/uuid/dist/cjs-browser/package.json +1 -0
- package/node_modules/uuid/dist/cjs-browser/parse.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/parse.js +11 -0
- package/node_modules/uuid/dist/cjs-browser/regex.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/regex.js +3 -0
- package/node_modules/uuid/dist/cjs-browser/rng.d.ts +1 -0
- package/node_modules/uuid/dist/cjs-browser/rng.js +14 -0
- package/node_modules/uuid/dist/cjs-browser/sha1.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/sha1.js +72 -0
- package/node_modules/uuid/dist/cjs-browser/stringify.d.ts +3 -0
- package/node_modules/uuid/dist/cjs-browser/stringify.js +39 -0
- package/node_modules/uuid/dist/cjs-browser/types.d.ts +21 -0
- package/node_modules/uuid/dist/cjs-browser/types.js +2 -0
- package/node_modules/uuid/dist/cjs-browser/uuid-bin.d.ts +1 -0
- package/node_modules/uuid/dist/cjs-browser/uuid-bin.js +72 -0
- package/node_modules/uuid/dist/cjs-browser/v1.d.ts +11 -0
- package/node_modules/uuid/dist/cjs-browser/v1.js +87 -0
- package/node_modules/uuid/dist/cjs-browser/v1ToV6.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/v1ToV6.js +13 -0
- package/node_modules/uuid/dist/cjs-browser/v3.d.ts +9 -0
- package/node_modules/uuid/dist/cjs-browser/v3.js +14 -0
- package/node_modules/uuid/dist/cjs-browser/v35.d.ts +7 -0
- package/node_modules/uuid/dist/cjs-browser/v35.js +44 -0
- package/node_modules/uuid/dist/cjs-browser/v4.d.ts +4 -0
- package/node_modules/uuid/dist/cjs-browser/v4.js +29 -0
- package/node_modules/uuid/dist/cjs-browser/v5.d.ts +9 -0
- package/node_modules/uuid/dist/cjs-browser/v5.js +14 -0
- package/node_modules/uuid/dist/cjs-browser/v6.d.ts +4 -0
- package/node_modules/uuid/dist/cjs-browser/v6.js +22 -0
- package/node_modules/uuid/dist/cjs-browser/v6ToV1.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/v6ToV1.js +13 -0
- package/node_modules/uuid/dist/cjs-browser/v7.d.ts +9 -0
- package/node_modules/uuid/dist/cjs-browser/v7.js +69 -0
- package/node_modules/uuid/dist/cjs-browser/validate.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/validate.js +7 -0
- package/node_modules/uuid/dist/cjs-browser/version.d.ts +2 -0
- package/node_modules/uuid/dist/cjs-browser/version.js +10 -0
- package/node_modules/uuid/dist/esm/bin/uuid +2 -0
- package/node_modules/uuid/dist/esm/index.d.ts +15 -0
- package/node_modules/uuid/dist/{esm-node → esm}/index.js +9 -4
- package/node_modules/uuid/dist/esm/max.d.ts +2 -0
- package/node_modules/uuid/dist/esm/max.js +1 -0
- package/node_modules/uuid/dist/esm/md5.d.ts +4 -0
- package/node_modules/uuid/dist/esm/md5.js +11 -0
- package/node_modules/uuid/dist/esm/native.d.ts +6 -0
- package/node_modules/uuid/dist/esm/native.js +2 -0
- package/node_modules/uuid/dist/esm/nil.d.ts +2 -0
- package/node_modules/uuid/dist/esm/nil.js +1 -0
- package/node_modules/uuid/dist/esm/parse.d.ts +2 -0
- package/node_modules/uuid/dist/esm/parse.js +9 -0
- package/node_modules/uuid/dist/esm/regex.d.ts +2 -0
- package/node_modules/uuid/dist/esm/regex.js +1 -0
- package/node_modules/uuid/dist/esm/rng.d.ts +1 -0
- package/node_modules/uuid/dist/esm/rng.js +10 -0
- package/node_modules/uuid/dist/esm/sha1.d.ts +4 -0
- package/node_modules/uuid/dist/esm/sha1.js +11 -0
- package/node_modules/uuid/dist/esm/stringify.d.ts +3 -0
- package/node_modules/uuid/dist/esm/stringify.js +35 -0
- package/node_modules/uuid/dist/esm/types.d.ts +21 -0
- package/node_modules/uuid/dist/esm/types.js +1 -0
- package/node_modules/uuid/dist/esm/uuid-bin.d.ts +1 -0
- package/node_modules/uuid/dist/esm/uuid-bin.js +70 -0
- package/node_modules/uuid/dist/esm/v1.d.ts +11 -0
- package/node_modules/uuid/dist/esm/v1.js +83 -0
- package/node_modules/uuid/dist/esm/v1ToV6.d.ts +2 -0
- package/node_modules/uuid/dist/esm/v1ToV6.js +10 -0
- package/node_modules/uuid/dist/esm/v3.d.ts +9 -0
- package/node_modules/uuid/dist/esm/v3.js +9 -0
- package/node_modules/uuid/dist/esm/v35.d.ts +7 -0
- package/node_modules/uuid/dist/esm/v35.js +39 -0
- package/node_modules/uuid/dist/esm/v4.d.ts +4 -0
- package/node_modules/uuid/dist/esm/v4.js +27 -0
- package/node_modules/uuid/dist/esm/v5.d.ts +9 -0
- package/node_modules/uuid/dist/esm/v5.js +9 -0
- package/node_modules/uuid/dist/esm/v6.d.ts +4 -0
- package/node_modules/uuid/dist/esm/v6.js +20 -0
- package/node_modules/uuid/dist/esm/v6ToV1.d.ts +2 -0
- package/node_modules/uuid/dist/esm/v6ToV1.js +10 -0
- package/node_modules/uuid/dist/esm/v7.d.ts +9 -0
- package/node_modules/uuid/dist/esm/v7.js +65 -0
- package/node_modules/uuid/dist/esm/validate.d.ts +2 -0
- package/node_modules/uuid/dist/esm/validate.js +5 -0
- package/node_modules/uuid/dist/esm/version.d.ts +2 -0
- package/node_modules/uuid/dist/esm/version.js +8 -0
- package/node_modules/uuid/dist/esm-browser/index.d.ts +15 -0
- package/node_modules/uuid/dist/esm-browser/index.js +9 -4
- package/node_modules/uuid/dist/esm-browser/max.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/max.js +1 -0
- package/node_modules/uuid/dist/esm-browser/md5.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/md5.js +113 -193
- package/node_modules/uuid/dist/esm-browser/native.d.ts +4 -0
- package/node_modules/uuid/dist/esm-browser/native.js +2 -0
- package/node_modules/uuid/dist/esm-browser/nil.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/nil.js +1 -1
- package/node_modules/uuid/dist/esm-browser/parse.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/parse.js +6 -32
- package/node_modules/uuid/dist/esm-browser/regex.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/regex.js +1 -1
- package/node_modules/uuid/dist/esm-browser/rng.d.ts +1 -0
- package/node_modules/uuid/dist/esm-browser/rng.js +8 -16
- package/node_modules/uuid/dist/esm-browser/sha1.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/sha1.js +62 -88
- package/node_modules/uuid/dist/esm-browser/stringify.d.ts +3 -0
- package/node_modules/uuid/dist/esm-browser/stringify.js +32 -27
- package/node_modules/uuid/dist/esm-browser/types.d.ts +21 -0
- package/node_modules/uuid/dist/esm-browser/types.js +1 -0
- package/node_modules/uuid/dist/esm-browser/uuid-bin.d.ts +1 -0
- package/node_modules/uuid/dist/esm-browser/uuid-bin.js +70 -0
- package/node_modules/uuid/dist/esm-browser/v1.d.ts +11 -0
- package/node_modules/uuid/dist/esm-browser/v1.js +78 -90
- package/node_modules/uuid/dist/esm-browser/v1ToV6.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/v1ToV6.js +10 -0
- package/node_modules/uuid/dist/esm-browser/v3.d.ts +9 -0
- package/node_modules/uuid/dist/esm-browser/v3.js +8 -3
- package/node_modules/uuid/dist/esm-browser/v35.d.ts +7 -0
- package/node_modules/uuid/dist/esm-browser/v35.js +33 -58
- package/node_modules/uuid/dist/esm-browser/v4.d.ts +4 -0
- package/node_modules/uuid/dist/esm-browser/v4.js +23 -20
- package/node_modules/uuid/dist/esm-browser/v5.d.ts +9 -0
- package/node_modules/uuid/dist/esm-browser/v5.js +8 -3
- package/node_modules/uuid/dist/esm-browser/v6.d.ts +4 -0
- package/node_modules/uuid/dist/esm-browser/v6.js +20 -0
- package/node_modules/uuid/dist/esm-browser/v6ToV1.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/v6ToV1.js +10 -0
- package/node_modules/uuid/dist/esm-browser/v7.d.ts +9 -0
- package/node_modules/uuid/dist/esm-browser/v7.js +65 -0
- package/node_modules/uuid/dist/esm-browser/validate.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/validate.js +2 -4
- package/node_modules/uuid/dist/esm-browser/version.d.ts +2 -0
- package/node_modules/uuid/dist/esm-browser/version.js +5 -8
- package/node_modules/uuid/package.json +80 -83
- package/package.json +4 -1
- package/worldmap/worldmap.js +7 -0
- package/worldmap.html +1 -1
- package/node_modules/uuid/CHANGELOG.md +0 -229
- package/node_modules/uuid/CONTRIBUTING.md +0 -18
- package/node_modules/uuid/dist/bin/uuid +0 -2
- package/node_modules/uuid/dist/esm-node/md5.js +0 -13
- package/node_modules/uuid/dist/esm-node/nil.js +0 -1
- package/node_modules/uuid/dist/esm-node/parse.js +0 -35
- package/node_modules/uuid/dist/esm-node/regex.js +0 -1
- package/node_modules/uuid/dist/esm-node/rng.js +0 -12
- package/node_modules/uuid/dist/esm-node/sha1.js +0 -13
- package/node_modules/uuid/dist/esm-node/stringify.js +0 -29
- package/node_modules/uuid/dist/esm-node/v1.js +0 -95
- package/node_modules/uuid/dist/esm-node/v3.js +0 -4
- package/node_modules/uuid/dist/esm-node/v35.js +0 -64
- package/node_modules/uuid/dist/esm-node/v4.js +0 -24
- package/node_modules/uuid/dist/esm-node/v5.js +0 -4
- package/node_modules/uuid/dist/esm-node/validate.js +0 -7
- package/node_modules/uuid/dist/esm-node/version.js +0 -11
- package/node_modules/uuid/dist/index.js +0 -79
- package/node_modules/uuid/dist/md5-browser.js +0 -223
- package/node_modules/uuid/dist/md5.js +0 -23
- package/node_modules/uuid/dist/nil.js +0 -8
- package/node_modules/uuid/dist/parse.js +0 -45
- package/node_modules/uuid/dist/regex.js +0 -8
- package/node_modules/uuid/dist/rng-browser.js +0 -26
- package/node_modules/uuid/dist/rng.js +0 -24
- package/node_modules/uuid/dist/sha1-browser.js +0 -104
- package/node_modules/uuid/dist/sha1.js +0 -23
- package/node_modules/uuid/dist/stringify.js +0 -39
- package/node_modules/uuid/dist/umd/uuid.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidNIL.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidParse.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidStringify.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidValidate.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidVersion.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidv1.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidv3.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidv4.min.js +0 -1
- package/node_modules/uuid/dist/umd/uuidv5.min.js +0 -1
- package/node_modules/uuid/dist/uuid-bin.js +0 -85
- package/node_modules/uuid/dist/v1.js +0 -107
- package/node_modules/uuid/dist/v3.js +0 -16
- package/node_modules/uuid/dist/v35.js +0 -78
- package/node_modules/uuid/dist/v4.js +0 -37
- package/node_modules/uuid/dist/v5.js +0 -16
- package/node_modules/uuid/dist/validate.js +0 -17
- package/node_modules/uuid/dist/version.js +0 -21
- package/node_modules/uuid/wrapper.mjs +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
### Change Log for Node-RED Worldmap
|
|
2
2
|
|
|
3
|
+
- v5.8.0 - Stop double click on icons zooming in. Bump uuid lib.
|
|
3
4
|
- v5.7.2 - Bump express libs
|
|
4
5
|
- v5.7.0 - Add events for openPopup and closePopup actions, small popup fixups. Add showdialog command.
|
|
5
6
|
- v5.6.1 - Also call autoswitch on initial connect to ensure map in view.
|
package/README.md
CHANGED
|
@@ -10,7 +10,8 @@ A <a href="https://nodered.org" target="mapinfo">Node-RED</a> node to provide a
|
|
|
10
10
|
|
|
11
11
|
### Updates
|
|
12
12
|
|
|
13
|
-
- v5.
|
|
13
|
+
- v5.8.0 - Stop double click on icons zooming in. Bump uuid lib.
|
|
14
|
+
- v5.7.2 - Bump express libs.
|
|
14
15
|
- v5.7.0 - Add events for openPopup and closePopup, small popup fixups. Add showdialog command.
|
|
15
16
|
- v5.6.1 - Also call autoswitch on initial connect to ensure map in view.
|
|
16
17
|
- v5.6.0 - Autoswitch pmtiles basemaps based on zoom and/or coverage.
|
|
@@ -62,7 +63,7 @@ Optional properties for **msg.payload** include
|
|
|
62
63
|
- **iconSize** : Set the size in pixels of the "special" icons and web icons.
|
|
63
64
|
- **SIDC** : NATO symbology code (can be used instead of icon). See below.
|
|
64
65
|
- **building** : OSMbulding GeoJSON feature set to add 2.5D buildings to buildings layer. See below.
|
|
65
|
-
- **ttl** : time to live, how long an individual marker stays on map in seconds (overrides general maxage setting, minimum 20 seconds)
|
|
66
|
+
- **ttl** : time to live, how long an individual marker stays on map in seconds (overrides general maxage setting, minimum 20 seconds). Setting to 0 disables the timeout.
|
|
66
67
|
- **photoUrl** : adds an image pointed at by the url to the popup box.
|
|
67
68
|
- **videoUrl** : adds an mp4 video pointed at by the url to the popup box. Ideally 320x240 in size.
|
|
68
69
|
- **weblink** : adds a link to an external page. Either set a url as a *string*, or an *object* like `{"name":"BBC News", "url":"https://news.bbc.co.uk", "target":"_new"}`, or multiple links with an *array of objects* `[{"name":"BBC News", "url":"https://news.bbc.co.uk", "target":"_new"},{"name":"node-red", "url":"https://nodered.org", "target":"_new"}]`
|
|
@@ -2,41 +2,46 @@
|
|
|
2
2
|
-- This file is auto-generated from README_js.md. Changes should be made there.
|
|
3
3
|
-->
|
|
4
4
|
|
|
5
|
-
# uuid [](https://github.com/uuidjs/uuid/actions?query=workflow%3ACI) [](https://github.com/uuidjs/uuid/actions
|
|
5
|
+
# uuid [](https://github.com/uuidjs/uuid/actions?query=workflow%3ACI) [](https://github.com/uuidjs/uuid/actions/workflows/browser.yml)
|
|
6
6
|
|
|
7
|
-
For the creation of [RFC4122](
|
|
7
|
+
For the creation of [RFC9562](https://www.rfc-editor.org/rfc/rfc9562.html) (formerly [RFC4122](https://www.rfc-editor.org/rfc/rfc4122.html)) UUIDs
|
|
8
8
|
|
|
9
|
-
- **Complete** - Support for
|
|
10
|
-
- **Cross-platform** - Support for
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
- Chrome, Safari, Firefox, Edge
|
|
14
|
-
-
|
|
9
|
+
- **Complete** - Support for all RFC9562 UUID versions
|
|
10
|
+
- **Cross-platform** - Support for...
|
|
11
|
+
- ESM & Common JS
|
|
12
|
+
- [Typescript](#support)
|
|
13
|
+
- [Chrome, Safari, Firefox, and Edge](#support)
|
|
14
|
+
- [NodeJS](#support)
|
|
15
15
|
- [React Native / Expo](#react-native--expo)
|
|
16
|
-
- **Secure** -
|
|
17
|
-
- **
|
|
18
|
-
- **CLI** -
|
|
16
|
+
- **Secure** - Uses modern `crypto` API for random values
|
|
17
|
+
- **Compact** - Zero-dependency, [tree-shakable](https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking)
|
|
18
|
+
- **CLI** - [`uuid` command line](#command-line) utility
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
<!-- prettier-ignore -->
|
|
21
|
+
> [!NOTE]
|
|
22
|
+
> `uuid@11` is now available: See the [CHANGELOG](./CHANGELOG.md) for details. TL;DR:
|
|
23
|
+
> * TypeScript support is now included (remove `@types/uuid` from your dependencies)
|
|
24
|
+
> * Subtle changes to how the `options` arg is interpreted for `v1()`, `v6()`, and `v7()`. [See details](#options-handling-for-timestamp-uuids)
|
|
25
|
+
> * Binary UUIDs are now `Uint8Array`s. (May impact callers of `parse()`, `stringify()`, or that pass an `option#buf` argument to `v1()`-`v7()`.)
|
|
21
26
|
|
|
22
27
|
## Quickstart
|
|
23
28
|
|
|
24
|
-
To create a random UUID...
|
|
25
|
-
|
|
26
29
|
**1. Install**
|
|
27
30
|
|
|
28
31
|
```shell
|
|
29
32
|
npm install uuid
|
|
30
33
|
```
|
|
31
34
|
|
|
32
|
-
**2. Create a UUID**
|
|
35
|
+
**2. Create a UUID**
|
|
36
|
+
|
|
37
|
+
ESM-syntax (must use named exports):
|
|
33
38
|
|
|
34
39
|
```javascript
|
|
35
40
|
import { v4 as uuidv4 } from 'uuid';
|
|
36
41
|
uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
|
|
37
42
|
```
|
|
38
43
|
|
|
39
|
-
...
|
|
44
|
+
... CommonJS:
|
|
40
45
|
|
|
41
46
|
```javascript
|
|
42
47
|
const { v4: uuidv4 } = require('uuid');
|
|
@@ -50,12 +55,18 @@ For timestamp UUIDs, namespace UUIDs, and other options read on ...
|
|
|
50
55
|
| | | |
|
|
51
56
|
| --- | --- | --- |
|
|
52
57
|
| [`uuid.NIL`](#uuidnil) | The nil UUID string (all zeros) | New in `uuid@8.3` |
|
|
58
|
+
| [`uuid.MAX`](#uuidmax) | The max UUID string (all ones) | New in `uuid@9.1` |
|
|
53
59
|
| [`uuid.parse()`](#uuidparsestr) | Convert UUID string to array of bytes | New in `uuid@8.3` |
|
|
54
60
|
| [`uuid.stringify()`](#uuidstringifyarr-offset) | Convert array of bytes to UUID string | New in `uuid@8.3` |
|
|
55
61
|
| [`uuid.v1()`](#uuidv1options-buffer-offset) | Create a version 1 (timestamp) UUID | |
|
|
62
|
+
| [`uuid.v1ToV6()`](#uuidv1tov6uuid) | Create a version 6 UUID from a version 1 UUID | New in `uuid@10` |
|
|
56
63
|
| [`uuid.v3()`](#uuidv3name-namespace-buffer-offset) | Create a version 3 (namespace w/ MD5) UUID | |
|
|
57
64
|
| [`uuid.v4()`](#uuidv4options-buffer-offset) | Create a version 4 (random) UUID | |
|
|
58
65
|
| [`uuid.v5()`](#uuidv5name-namespace-buffer-offset) | Create a version 5 (namespace w/ SHA-1) UUID | |
|
|
66
|
+
| [`uuid.v6()`](#uuidv6options-buffer-offset) | Create a version 6 (timestamp, reordered) UUID | New in `uuid@10` |
|
|
67
|
+
| [`uuid.v6ToV1()`](#uuidv6tov1uuid) | Create a version 1 UUID from a version 6 UUID | New in `uuid@10` |
|
|
68
|
+
| [`uuid.v7()`](#uuidv7options-buffer-offset) | Create a version 7 (Unix Epoch time-based) UUID | New in `uuid@10` |
|
|
69
|
+
| ~~[`uuid.v8()`](#uuidv8)~~ | "Intentionally left blank" | |
|
|
59
70
|
| [`uuid.validate()`](#uuidvalidatestr) | Test a string to see if it is a valid UUID | New in `uuid@8.3` |
|
|
60
71
|
| [`uuid.version()`](#uuidversionstr) | Detect RFC version of a UUID | New in `uuid@8.3` |
|
|
61
72
|
|
|
@@ -73,6 +84,18 @@ import { NIL as NIL_UUID } from 'uuid';
|
|
|
73
84
|
NIL_UUID; // ⇨ '00000000-0000-0000-0000-000000000000'
|
|
74
85
|
```
|
|
75
86
|
|
|
87
|
+
### uuid.MAX
|
|
88
|
+
|
|
89
|
+
The max UUID string (all ones).
|
|
90
|
+
|
|
91
|
+
Example:
|
|
92
|
+
|
|
93
|
+
```javascript
|
|
94
|
+
import { MAX as MAX_UUID } from 'uuid';
|
|
95
|
+
|
|
96
|
+
MAX_UUID; // ⇨ 'ffffffff-ffff-ffff-ffff-ffffffffffff'
|
|
97
|
+
```
|
|
98
|
+
|
|
76
99
|
### uuid.parse(str)
|
|
77
100
|
|
|
78
101
|
Convert UUID string to array of bytes
|
|
@@ -83,7 +106,9 @@ Convert UUID string to array of bytes
|
|
|
83
106
|
| _returns_ | `Uint8Array[16]` |
|
|
84
107
|
| _throws_ | `TypeError` if `str` is not a valid UUID |
|
|
85
108
|
|
|
86
|
-
|
|
109
|
+
<!-- prettier-ignore -->
|
|
110
|
+
> [!NOTE]
|
|
111
|
+
> 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.
|
|
87
112
|
|
|
88
113
|
Example:
|
|
89
114
|
|
|
@@ -91,16 +116,13 @@ Example:
|
|
|
91
116
|
import { parse as uuidParse } from 'uuid';
|
|
92
117
|
|
|
93
118
|
// Parse a UUID
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
//
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
// '97', '5e', '2a', '8a',
|
|
102
|
-
// 'd9', 'eb', 'ae', '0b'
|
|
103
|
-
// ]
|
|
119
|
+
uuidParse('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // ⇨
|
|
120
|
+
// Uint8Array(16) [
|
|
121
|
+
// 110, 192, 189, 127, 17,
|
|
122
|
+
// 192, 67, 218, 151, 94,
|
|
123
|
+
// 42, 138, 217, 235, 174,
|
|
124
|
+
// 11
|
|
125
|
+
// ]
|
|
104
126
|
```
|
|
105
127
|
|
|
106
128
|
### uuid.stringify(arr[, offset])
|
|
@@ -114,14 +136,16 @@ Convert array of bytes to UUID string
|
|
|
114
136
|
| _returns_ | `String` |
|
|
115
137
|
| _throws_ | `TypeError` if a valid UUID string cannot be generated |
|
|
116
138
|
|
|
117
|
-
|
|
139
|
+
<!-- prettier-ignore -->
|
|
140
|
+
> [!NOTE]
|
|
141
|
+
> 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.
|
|
118
142
|
|
|
119
143
|
Example:
|
|
120
144
|
|
|
121
145
|
```javascript
|
|
122
146
|
import { stringify as uuidStringify } from 'uuid';
|
|
123
147
|
|
|
124
|
-
const uuidBytes =
|
|
148
|
+
const uuidBytes = Uint8Array.of(
|
|
125
149
|
0x6e,
|
|
126
150
|
0xc0,
|
|
127
151
|
0xbd,
|
|
@@ -137,8 +161,8 @@ const uuidBytes = [
|
|
|
137
161
|
0xd9,
|
|
138
162
|
0xeb,
|
|
139
163
|
0xae,
|
|
140
|
-
0x0b
|
|
141
|
-
|
|
164
|
+
0x0b
|
|
165
|
+
);
|
|
142
166
|
|
|
143
167
|
uuidStringify(uuidBytes); // ⇨ '6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'
|
|
144
168
|
```
|
|
@@ -150,27 +174,31 @@ Create an RFC version 1 (timestamp) UUID
|
|
|
150
174
|
| | |
|
|
151
175
|
| --- | --- |
|
|
152
176
|
| [`options`] | `Object` with one or more of the following properties: |
|
|
153
|
-
| [`options.node` ] | RFC "node" field as an `Array[6]` of byte values (per 4.1.6) |
|
|
154
|
-
| [`options.clockseq`] | RFC "clock sequence" as a `Number` between 0 - 0x3fff |
|
|
155
|
-
| [`options.msecs`] | RFC "timestamp" field (`Number` of milliseconds, unix epoch) |
|
|
156
|
-
| [`options.nsecs`] | RFC "timestamp" field (`Number` of
|
|
157
|
-
| [`options.random`] | `Array` of 16 random bytes (0-255) |
|
|
177
|
+
| [`options.node = (random)` ] | RFC "node" field as an `Array[6]` of byte values (per 4.1.6) |
|
|
178
|
+
| [`options.clockseq = (random)`] | RFC "clock sequence" as a `Number` between 0 - 0x3fff |
|
|
179
|
+
| [`options.msecs = (current time)`] | RFC "timestamp" field (`Number` of milliseconds, unix epoch) |
|
|
180
|
+
| [`options.nsecs = 0`] | RFC "timestamp" field (`Number` of nanoseconds to add to `msecs`, should be 0-10,000) |
|
|
181
|
+
| [`options.random = (random)`] | `Array` of 16 random bytes (0-255) used to generate other fields, above |
|
|
158
182
|
| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |
|
|
159
|
-
| [`buffer`] | `
|
|
183
|
+
| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |
|
|
160
184
|
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
|
|
161
185
|
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
|
|
162
186
|
| _throws_ | `Error` if more than 10M UUIDs/sec are requested |
|
|
163
187
|
|
|
164
|
-
|
|
188
|
+
<!-- prettier-ignore -->
|
|
189
|
+
> [!NOTE]
|
|
190
|
+
> 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.
|
|
165
191
|
|
|
166
|
-
|
|
192
|
+
<!-- prettier-ignore -->
|
|
193
|
+
> [!NOTE]
|
|
194
|
+
> `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.
|
|
167
195
|
|
|
168
196
|
Example:
|
|
169
197
|
|
|
170
198
|
```javascript
|
|
171
199
|
import { v1 as uuidv1 } from 'uuid';
|
|
172
200
|
|
|
173
|
-
uuidv1(); // ⇨ '2c5ea4c0-4067-11e9-
|
|
201
|
+
uuidv1(); // ⇨ '2c5ea4c0-4067-11e9-9bdd-2b0d7b3dcb6d'
|
|
174
202
|
```
|
|
175
203
|
|
|
176
204
|
Example using `options`:
|
|
@@ -178,13 +206,23 @@ Example using `options`:
|
|
|
178
206
|
```javascript
|
|
179
207
|
import { v1 as uuidv1 } from 'uuid';
|
|
180
208
|
|
|
181
|
-
const
|
|
182
|
-
node:
|
|
209
|
+
const options = {
|
|
210
|
+
node: Uint8Array.of(0x01, 0x23, 0x45, 0x67, 0x89, 0xab),
|
|
183
211
|
clockseq: 0x1234,
|
|
184
212
|
msecs: new Date('2011-11-01').getTime(),
|
|
185
213
|
nsecs: 5678,
|
|
186
214
|
};
|
|
187
|
-
uuidv1(
|
|
215
|
+
uuidv1(options); // ⇨ '710b962e-041c-11e1-9234-0123456789ab'
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### uuid.v1ToV6(uuid)
|
|
219
|
+
|
|
220
|
+
Convert a UUID from version 1 to version 6
|
|
221
|
+
|
|
222
|
+
```javascript
|
|
223
|
+
import { v1ToV6 } from 'uuid';
|
|
224
|
+
|
|
225
|
+
v1ToV6('92f62d9e-22c4-11ef-97e9-325096b39f47'); // ⇨ '1ef22c49-2f62-6d9e-97e9-325096b39f47'
|
|
188
226
|
```
|
|
189
227
|
|
|
190
228
|
### uuid.v3(name, namespace[, buffer[, offset]])
|
|
@@ -193,7 +231,9 @@ Create an RFC version 3 (namespace w/ MD5) UUID
|
|
|
193
231
|
|
|
194
232
|
API is identical to `v5()`, but uses "v3" instead.
|
|
195
233
|
|
|
196
|
-
|
|
234
|
+
<!-- prettier-ignore -->
|
|
235
|
+
> [!IMPORTANT]
|
|
236
|
+
> Per the RFC, "_If backward compatibility is not an issue, SHA-1 [Version 5] is preferred_."
|
|
197
237
|
|
|
198
238
|
### uuid.v4([options[, buffer[, offset]]])
|
|
199
239
|
|
|
@@ -204,7 +244,7 @@ Create an RFC version 4 (random) UUID
|
|
|
204
244
|
| [`options`] | `Object` with one or more of the following properties: |
|
|
205
245
|
| [`options.random`] | `Array` of 16 random bytes (0-255) |
|
|
206
246
|
| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |
|
|
207
|
-
| [`buffer`] | `
|
|
247
|
+
| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |
|
|
208
248
|
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
|
|
209
249
|
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
|
|
210
250
|
|
|
@@ -213,7 +253,7 @@ Example:
|
|
|
213
253
|
```javascript
|
|
214
254
|
import { v4 as uuidv4 } from 'uuid';
|
|
215
255
|
|
|
216
|
-
uuidv4(); // ⇨ '
|
|
256
|
+
uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
|
|
217
257
|
```
|
|
218
258
|
|
|
219
259
|
Example using predefined `random` values:
|
|
@@ -222,7 +262,7 @@ Example using predefined `random` values:
|
|
|
222
262
|
import { v4 as uuidv4 } from 'uuid';
|
|
223
263
|
|
|
224
264
|
const v4options = {
|
|
225
|
-
random:
|
|
265
|
+
random: Uint8Array.of(
|
|
226
266
|
0x10,
|
|
227
267
|
0x91,
|
|
228
268
|
0x56,
|
|
@@ -238,8 +278,8 @@ const v4options = {
|
|
|
238
278
|
0x67,
|
|
239
279
|
0x1c,
|
|
240
280
|
0x58,
|
|
241
|
-
0x36
|
|
242
|
-
|
|
281
|
+
0x36
|
|
282
|
+
),
|
|
243
283
|
};
|
|
244
284
|
uuidv4(v4options); // ⇨ '109156be-c4fb-41ea-b1b4-efe1671c5836'
|
|
245
285
|
```
|
|
@@ -252,11 +292,13 @@ Create an RFC version 5 (namespace w/ SHA-1) UUID
|
|
|
252
292
|
| --- | --- |
|
|
253
293
|
| `name` | `String \| Array` |
|
|
254
294
|
| `namespace` | `String \| Array[16]` Namespace UUID |
|
|
255
|
-
| [`buffer`] | `
|
|
295
|
+
| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |
|
|
256
296
|
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
|
|
257
297
|
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
|
|
258
298
|
|
|
259
|
-
|
|
299
|
+
<!-- prettier-ignore -->
|
|
300
|
+
> [!NOTE]
|
|
301
|
+
> The RFC `DNS` and `URL` namespaces are available as `v5.DNS` and `v5.URL`.
|
|
260
302
|
|
|
261
303
|
Example with custom namespace:
|
|
262
304
|
|
|
@@ -278,6 +320,73 @@ import { v5 as uuidv5 } from 'uuid';
|
|
|
278
320
|
uuidv5('https://www.w3.org/', uuidv5.URL); // ⇨ 'c106a26a-21bb-5538-8bf2-57095d1976c1'
|
|
279
321
|
```
|
|
280
322
|
|
|
323
|
+
### uuid.v6([options[, buffer[, offset]]])
|
|
324
|
+
|
|
325
|
+
Create an RFC version 6 (timestamp, reordered) UUID
|
|
326
|
+
|
|
327
|
+
This method takes the same arguments as uuid.v1().
|
|
328
|
+
|
|
329
|
+
```javascript
|
|
330
|
+
import { v6 as uuidv6 } from 'uuid';
|
|
331
|
+
|
|
332
|
+
uuidv6(); // ⇨ '1e940672-c5ea-64c0-9b5d-ab8dfbbd4bed'
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
Example using `options`:
|
|
336
|
+
|
|
337
|
+
```javascript
|
|
338
|
+
import { v6 as uuidv6 } from 'uuid';
|
|
339
|
+
|
|
340
|
+
const options = {
|
|
341
|
+
node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],
|
|
342
|
+
clockseq: 0x1234,
|
|
343
|
+
msecs: new Date('2011-11-01').getTime(),
|
|
344
|
+
nsecs: 5678,
|
|
345
|
+
};
|
|
346
|
+
uuidv6(options); // ⇨ '1e1041c7-10b9-662e-9234-0123456789ab'
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### uuid.v6ToV1(uuid)
|
|
350
|
+
|
|
351
|
+
Convert a UUID from version 6 to version 1
|
|
352
|
+
|
|
353
|
+
```javascript
|
|
354
|
+
import { v6ToV1 } from 'uuid';
|
|
355
|
+
|
|
356
|
+
v6ToV1('1ef22c49-2f62-6d9e-97e9-325096b39f47'); // ⇨ '92f62d9e-22c4-11ef-97e9-325096b39f47'
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### uuid.v7([options[, buffer[, offset]]])
|
|
360
|
+
|
|
361
|
+
Create an RFC version 7 (random) UUID
|
|
362
|
+
|
|
363
|
+
| | |
|
|
364
|
+
| --- | --- |
|
|
365
|
+
| [`options`] | `Object` with one or more of the following properties: |
|
|
366
|
+
| [`options.msecs = (current time)`] | RFC "timestamp" field (`Number` of milliseconds, unix epoch) |
|
|
367
|
+
| [`options.random = (random)`] | `Array` of 16 random bytes (0-255) used to generate other fields, above |
|
|
368
|
+
| [`options.rng`] | Alternative to `options.random`, a `Function` that returns an `Array` of 16 random bytes (0-255) |
|
|
369
|
+
| [`options.seq = (random)`] | 32-bit sequence `Number` between 0 - 0xffffffff. This may be provided to help ensure uniqueness for UUIDs generated within the same millisecond time interval. Default = random value. |
|
|
370
|
+
| [`buffer`] | `Uint8Array` or `Uint8Array` subtype (e.g. Node.js `Buffer`). If provided, binary UUID is written into the array, starting at `offset` |
|
|
371
|
+
| [`offset` = 0] | `Number` Index to start writing UUID bytes in `buffer` |
|
|
372
|
+
| _returns_ | UUID `String` if no `buffer` is specified, otherwise returns `buffer` |
|
|
373
|
+
|
|
374
|
+
Example:
|
|
375
|
+
|
|
376
|
+
```javascript
|
|
377
|
+
import { v7 as uuidv7 } from 'uuid';
|
|
378
|
+
|
|
379
|
+
uuidv7(); // ⇨ '01695553-c90c-705a-b56d-778dfbbd4bed'
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### ~~uuid.v8()~~
|
|
383
|
+
|
|
384
|
+
**_"Intentionally left blank"_**
|
|
385
|
+
|
|
386
|
+
<!-- prettier-ignore -->
|
|
387
|
+
> [!NOTE]
|
|
388
|
+
> 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.
|
|
389
|
+
|
|
281
390
|
### uuid.validate(str)
|
|
282
391
|
|
|
283
392
|
Test a string to see if it is a valid UUID
|
|
@@ -332,19 +441,23 @@ uuidVersion('45637ec4-c85f-11ea-87d0-0242ac130003'); // ⇨ 1
|
|
|
332
441
|
uuidVersion('6ec0bd7f-11c0-43da-975e-2a8ad9ebae0b'); // ⇨ 4
|
|
333
442
|
```
|
|
334
443
|
|
|
444
|
+
<!-- prettier-ignore -->
|
|
445
|
+
> [!NOTE]
|
|
446
|
+
> This method returns `0` for the `NIL` UUID, and `15` for the `MAX` UUID.
|
|
447
|
+
|
|
335
448
|
## Command Line
|
|
336
449
|
|
|
337
450
|
UUIDs can be generated from the command line using `uuid`.
|
|
338
451
|
|
|
339
452
|
```shell
|
|
340
|
-
$ uuid
|
|
453
|
+
$ npx uuid
|
|
341
454
|
ddeb27fb-d9a0-4624-be4d-4615062daed4
|
|
342
455
|
```
|
|
343
456
|
|
|
344
457
|
The default is to generate version 4 UUIDS, however the other versions are supported. Type `uuid --help` for details:
|
|
345
458
|
|
|
346
459
|
```shell
|
|
347
|
-
$ uuid --help
|
|
460
|
+
$ npx uuid --help
|
|
348
461
|
|
|
349
462
|
Usage:
|
|
350
463
|
uuid
|
|
@@ -352,77 +465,37 @@ Usage:
|
|
|
352
465
|
uuid v3 <name> <namespace uuid>
|
|
353
466
|
uuid v4
|
|
354
467
|
uuid v5 <name> <namespace uuid>
|
|
468
|
+
uuid v7
|
|
355
469
|
uuid --help
|
|
356
470
|
|
|
357
471
|
Note: <namespace uuid> may be "URL" or "DNS" to use the corresponding UUIDs
|
|
358
|
-
defined by
|
|
472
|
+
defined by RFC9562
|
|
359
473
|
```
|
|
360
474
|
|
|
361
|
-
##
|
|
475
|
+
## `options` Handling for Timestamp UUIDs
|
|
362
476
|
|
|
363
|
-
|
|
477
|
+
Prior to `uuid@11`, it was possible for `options` state to interfere with the internal state used to ensure uniqueness of timestamp-based UUIDs (the `v1()`, `v6()`, and `v7()` methods). Starting with `uuid@11`, this issue has been addressed by using the presence of the `options` argument as a flag to select between two possible behaviors:
|
|
364
478
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
To run the examples you must first create a dist build of this library in the module root:
|
|
371
|
-
|
|
372
|
-
```shell
|
|
373
|
-
npm run build
|
|
374
|
-
```
|
|
479
|
+
- Without `options`: Internal state is utilized to improve UUID uniqueness.
|
|
480
|
+
- With `options`: Internal state is **NOT** used and, instead, appropriate defaults are applied as needed.
|
|
375
481
|
|
|
376
|
-
##
|
|
482
|
+
## Support
|
|
377
483
|
|
|
378
|
-
|
|
484
|
+
**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.
|
|
379
485
|
|
|
380
|
-
|
|
486
|
+
**Node**: `uuid` [builds are tested](https://github.com/uuidjs/uuid/blob/main/.github/workflows/ci.yml#L26-L27) against node ([LTS releases](https://github.com/nodejs/Release)), plus one prior. E.g. `node@18` is in maintainence mode, and `node@22` is the current LTS release. So `uuid` supports `node@16`-`node@22`.
|
|
381
487
|
|
|
382
|
-
|
|
383
|
-
<script type="module">
|
|
384
|
-
import { v4 as uuidv4 } from 'https://jspm.dev/uuid';
|
|
385
|
-
console.log(uuidv4()); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
|
|
386
|
-
</script>
|
|
387
|
-
```
|
|
388
|
-
|
|
389
|
-
### UMD
|
|
390
|
-
|
|
391
|
-
To load this module directly into older browsers you can use the [UMD (Universal Module Definition)](https://github.com/umdjs/umd) builds from any of the following CDNs:
|
|
392
|
-
|
|
393
|
-
**Using [UNPKG](https://unpkg.com/uuid@latest/dist/umd/)**:
|
|
488
|
+
**Typescript**: TS versions released within the past two years are supported. [source](https://github.com/microsoft/TypeScript/issues/49088#issuecomment-2468723715)
|
|
394
489
|
|
|
395
|
-
|
|
396
|
-
<script src="https://unpkg.com/uuid@latest/dist/umd/uuidv4.min.js"></script>
|
|
397
|
-
```
|
|
398
|
-
|
|
399
|
-
**Using [jsDelivr](https://cdn.jsdelivr.net/npm/uuid@latest/dist/umd/)**:
|
|
490
|
+
## Known issues
|
|
400
491
|
|
|
401
|
-
|
|
402
|
-
<script src="https://cdn.jsdelivr.net/npm/uuid@latest/dist/umd/uuidv4.min.js"></script>
|
|
403
|
-
```
|
|
492
|
+
<!-- This header is referenced as an anchor in src/rng-browser.ts -->
|
|
404
493
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
```html
|
|
408
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/uuid/8.1.0/uuidv4.min.js"></script>
|
|
409
|
-
```
|
|
410
|
-
|
|
411
|
-
These CDNs all provide the same [`uuidv4()`](#uuidv4options-buffer-offset) method:
|
|
412
|
-
|
|
413
|
-
```html
|
|
414
|
-
<script>
|
|
415
|
-
uuidv4(); // ⇨ '55af1e37-0734-46d8-b070-a1e42e4fc392'
|
|
416
|
-
</script>
|
|
417
|
-
```
|
|
418
|
-
|
|
419
|
-
Methods for the other algorithms ([`uuidv1()`](#uuidv1options-buffer-offset), [`uuidv3()`](#uuidv3name-namespace-buffer-offset) and [`uuidv5()`](#uuidv5name-namespace-buffer-offset)) are available from the files `uuidv1.min.js`, `uuidv3.min.js` and `uuidv5.min.js` respectively.
|
|
420
|
-
|
|
421
|
-
## "getRandomValues() not supported"
|
|
494
|
+
### "getRandomValues() not supported"
|
|
422
495
|
|
|
423
496
|
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:
|
|
424
497
|
|
|
425
|
-
|
|
498
|
+
#### React Native / Expo
|
|
426
499
|
|
|
427
500
|
1. Install [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme)
|
|
428
501
|
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:
|
|
@@ -432,74 +505,6 @@ import 'react-native-get-random-values';
|
|
|
432
505
|
import { v4 as uuidv4 } from 'uuid';
|
|
433
506
|
```
|
|
434
507
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
### Web Workers / Service Workers (Edge <= 18)
|
|
438
|
-
|
|
439
|
-
[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).
|
|
440
|
-
|
|
441
|
-
## Upgrading From `uuid@7.x`
|
|
442
|
-
|
|
443
|
-
### Only Named Exports Supported When Using with Node.js ESM
|
|
444
|
-
|
|
445
|
-
`uuid@7.x` 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.
|
|
446
|
-
|
|
447
|
-
Instead of doing:
|
|
448
|
-
|
|
449
|
-
```javascript
|
|
450
|
-
import uuid from 'uuid';
|
|
451
|
-
uuid.v4();
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
you will now have to use the named exports:
|
|
455
|
-
|
|
456
|
-
```javascript
|
|
457
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
458
|
-
uuidv4();
|
|
459
|
-
```
|
|
460
|
-
|
|
461
|
-
### Deep Requires No Longer Supported
|
|
462
|
-
|
|
463
|
-
Deep requires like `require('uuid/v4')` [which have been deprecated in `uuid@7.x`](#deep-requires-now-deprecated) are no longer supported.
|
|
464
|
-
|
|
465
|
-
## Upgrading From `uuid@3.x`
|
|
466
|
-
|
|
467
|
-
"_Wait... what happened to `uuid@4.x` - `uuid@6.x`?!?_"
|
|
468
|
-
|
|
469
|
-
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.
|
|
470
|
-
|
|
471
|
-
### Deep Requires Now Deprecated
|
|
472
|
-
|
|
473
|
-
`uuid@3.x` encouraged the use of deep requires to minimize the bundle size of browser builds:
|
|
474
|
-
|
|
475
|
-
```javascript
|
|
476
|
-
const uuidv4 = require('uuid/v4'); // <== NOW DEPRECATED!
|
|
477
|
-
uuidv4();
|
|
478
|
-
```
|
|
479
|
-
|
|
480
|
-
As of `uuid@7.x` 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:
|
|
481
|
-
|
|
482
|
-
```javascript
|
|
483
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
484
|
-
uuidv4();
|
|
485
|
-
```
|
|
486
|
-
|
|
487
|
-
... or for CommonJS:
|
|
488
|
-
|
|
489
|
-
```javascript
|
|
490
|
-
const { v4: uuidv4 } = require('uuid');
|
|
491
|
-
uuidv4();
|
|
492
|
-
```
|
|
493
|
-
|
|
494
|
-
### Default Export Removed
|
|
495
|
-
|
|
496
|
-
`uuid@3.x` was exporting the Version 4 UUID method as a default export:
|
|
497
|
-
|
|
498
|
-
```javascript
|
|
499
|
-
const uuid = require('uuid'); // <== REMOVED!
|
|
500
|
-
```
|
|
501
|
-
|
|
502
|
-
This usage pattern was already discouraged in `uuid@3.x` and has been removed in `uuid@7.x`.
|
|
508
|
+
---
|
|
503
509
|
|
|
504
|
-
|
|
505
|
-
Markdown generated from [README_js.md](README_js.md) by [](https://github.com/broofa/runmd)
|
|
510
|
+
Markdown generated from [README_js.md](README_js.md) by <a href="https://github.com/broofa/runmd"><image height="13" src="https://camo.githubusercontent.com/5c7c603cd1e6a43370b0a5063d457e0dabb74cf317adc7baba183acb686ee8d0/687474703a2f2f692e696d6775722e636f6d2f634a4b6f3662552e706e67" /></a>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type * from './types.js';
|
|
2
|
+
export { default as MAX } from './max.js';
|
|
3
|
+
export { default as NIL } from './nil.js';
|
|
4
|
+
export { default as parse } from './parse.js';
|
|
5
|
+
export { default as stringify } from './stringify.js';
|
|
6
|
+
export { default as v1 } from './v1.js';
|
|
7
|
+
export { default as v1ToV6 } from './v1ToV6.js';
|
|
8
|
+
export { default as v3 } from './v3.js';
|
|
9
|
+
export { default as v4 } from './v4.js';
|
|
10
|
+
export { default as v5 } from './v5.js';
|
|
11
|
+
export { default as v6 } from './v6.js';
|
|
12
|
+
export { default as v6ToV1 } from './v6ToV1.js';
|
|
13
|
+
export { default as v7 } from './v7.js';
|
|
14
|
+
export { default as validate } from './validate.js';
|
|
15
|
+
export { default as version } from './version.js';
|
|
@@ -0,0 +1,31 @@
|
|
|
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; } });
|