@pgarbe/cdk-ecr-sync 0.5.29 → 0.5.30
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/.jsii +3 -3
- package/API.md +106 -50
- package/CHANGELOG.md +1 -1
- package/lib/ecr-sync.js +1 -1
- package/node_modules/aws-sdk/CHANGELOG.md +34 -1
- package/node_modules/aws-sdk/README.md +1 -1
- package/node_modules/aws-sdk/apis/appflow-2020-08-23.min.json +76 -70
- package/node_modules/aws-sdk/apis/cloudformation-2010-05-15.min.json +10 -8
- package/node_modules/aws-sdk/apis/cognito-idp-2016-04-18.min.json +155 -127
- package/node_modules/aws-sdk/apis/datasync-2018-11-09.min.json +80 -74
- package/node_modules/aws-sdk/apis/datasync-2018-11-09.paginators.json +10 -5
- package/node_modules/aws-sdk/apis/drs-2020-02-26.min.json +332 -205
- package/node_modules/aws-sdk/apis/drs-2020-02-26.paginators.json +12 -0
- package/node_modules/aws-sdk/apis/ec2-2016-11-15.min.json +17 -0
- package/node_modules/aws-sdk/apis/emr-serverless-2021-07-13.examples.json +5 -0
- package/node_modules/aws-sdk/apis/emr-serverless-2021-07-13.min.json +860 -0
- package/node_modules/aws-sdk/apis/emr-serverless-2021-07-13.paginators.json +16 -0
- package/node_modules/aws-sdk/apis/forecast-2018-06-26.min.json +82 -63
- package/node_modules/aws-sdk/apis/fsx-2018-03-01.min.json +135 -116
- package/node_modules/aws-sdk/apis/iotsitewise-2019-12-02.min.json +20 -15
- package/node_modules/aws-sdk/apis/lightsail-2016-11-28.min.json +155 -122
- package/node_modules/aws-sdk/apis/lookoutmetrics-2017-07-25.min.json +43 -15
- package/node_modules/aws-sdk/apis/mediaconvert-2017-08-29.min.json +176 -99
- package/node_modules/aws-sdk/apis/metadata.json +4 -0
- package/node_modules/aws-sdk/apis/networkmanager-2019-07-05.min.json +72 -3
- package/node_modules/aws-sdk/apis/sagemaker-2017-07-24.min.json +673 -649
- package/node_modules/aws-sdk/apis/transcribe-2017-10-26.min.json +37 -11
- package/node_modules/aws-sdk/apis/voice-id-2021-09-27.min.json +6 -0
- package/node_modules/aws-sdk/apis/voice-id-2021-09-27.paginators.json +8 -4
- package/node_modules/aws-sdk/clients/all.d.ts +1 -0
- package/node_modules/aws-sdk/clients/all.js +2 -1
- package/node_modules/aws-sdk/clients/apigateway.d.ts +327 -324
- package/node_modules/aws-sdk/clients/appflow.d.ts +17 -7
- package/node_modules/aws-sdk/clients/apprunner.d.ts +2 -2
- package/node_modules/aws-sdk/clients/cloudformation.d.ts +62 -53
- package/node_modules/aws-sdk/clients/cognitoidentityserviceprovider.d.ts +197 -162
- package/node_modules/aws-sdk/clients/datasync.d.ts +41 -15
- package/node_modules/aws-sdk/clients/drs.d.ts +173 -6
- package/node_modules/aws-sdk/clients/ec2.d.ts +35 -15
- package/node_modules/aws-sdk/clients/emrserverless.d.ts +890 -0
- package/node_modules/aws-sdk/clients/emrserverless.js +18 -0
- package/node_modules/aws-sdk/clients/forecastservice.d.ts +38 -2
- package/node_modules/aws-sdk/clients/fsx.d.ts +28 -3
- package/node_modules/aws-sdk/clients/iotsitewise.d.ts +23 -3
- package/node_modules/aws-sdk/clients/ivschat.d.ts +1 -1
- package/node_modules/aws-sdk/clients/lightsail.d.ts +40 -0
- package/node_modules/aws-sdk/clients/lookoutmetrics.d.ts +54 -5
- package/node_modules/aws-sdk/clients/mediaconvert.d.ts +83 -8
- package/node_modules/aws-sdk/clients/networkmanager.d.ts +56 -10
- package/node_modules/aws-sdk/clients/sagemaker.d.ts +53 -24
- package/node_modules/aws-sdk/clients/secretsmanager.d.ts +1 -1
- package/node_modules/aws-sdk/clients/transcribeservice.d.ts +479 -447
- package/node_modules/aws-sdk/clients/voiceid.d.ts +9 -1
- package/node_modules/aws-sdk/dist/aws-sdk-core-react-native.js +702 -233
- package/node_modules/aws-sdk/dist/aws-sdk-react-native.js +2499 -1776
- package/node_modules/aws-sdk/dist/aws-sdk.js +839 -320
- package/node_modules/aws-sdk/dist/aws-sdk.min.js +90 -90
- package/node_modules/aws-sdk/lib/config_service_placeholders.d.ts +2 -0
- package/node_modules/aws-sdk/lib/core.js +1 -1
- package/node_modules/aws-sdk/package.json +2 -2
- package/node_modules/uuid/CHANGELOG.md +132 -44
- package/node_modules/uuid/CONTRIBUTING.md +20 -0
- package/node_modules/uuid/LICENSE.md +1 -1
- package/node_modules/uuid/README.md +298 -152
- package/node_modules/uuid/dist/bin/uuid +2 -0
- package/node_modules/uuid/dist/bytesToUuid.js +26 -0
- package/node_modules/uuid/dist/esm-browser/bytesToUuid.js +18 -0
- package/node_modules/uuid/dist/esm-browser/index.js +4 -0
- package/node_modules/uuid/dist/esm-browser/md5.js +218 -0
- package/node_modules/uuid/dist/esm-browser/rng.js +15 -0
- package/node_modules/uuid/dist/esm-browser/sha1.js +91 -0
- package/node_modules/uuid/{v1.js → dist/esm-browser/v1.js} +34 -48
- package/node_modules/uuid/dist/esm-browser/v3.js +4 -0
- package/node_modules/uuid/dist/esm-browser/v35.js +56 -0
- package/node_modules/uuid/dist/esm-browser/v4.js +27 -0
- package/node_modules/uuid/dist/esm-browser/v5.js +4 -0
- package/node_modules/uuid/dist/esm-node/bytesToUuid.js +18 -0
- package/node_modules/uuid/dist/esm-node/index.js +4 -0
- package/node_modules/uuid/dist/esm-node/md5.js +13 -0
- package/node_modules/uuid/dist/esm-node/rng.js +4 -0
- package/node_modules/uuid/dist/esm-node/sha1.js +13 -0
- package/node_modules/uuid/dist/esm-node/v1.js +95 -0
- package/node_modules/uuid/dist/esm-node/v3.js +4 -0
- package/node_modules/uuid/{lib → dist/esm-node}/v35.js +21 -22
- package/node_modules/uuid/dist/esm-node/v4.js +27 -0
- package/node_modules/uuid/dist/esm-node/v5.js +4 -0
- package/node_modules/uuid/dist/index.js +39 -0
- package/node_modules/uuid/{lib → dist}/md5-browser.js +58 -50
- package/node_modules/uuid/dist/md5.js +23 -0
- package/node_modules/uuid/dist/rng-browser.js +21 -0
- package/node_modules/uuid/dist/rng.js +14 -0
- package/node_modules/uuid/dist/sha1-browser.js +95 -0
- package/node_modules/uuid/dist/sha1.js +23 -0
- package/node_modules/uuid/dist/umd/uuid.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidv1.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidv3.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidv4.min.js +1 -0
- package/node_modules/uuid/dist/umd/uuidv5.min.js +1 -0
- package/node_modules/uuid/dist/uuid-bin.js +67 -0
- package/node_modules/uuid/dist/v1.js +107 -0
- package/node_modules/uuid/dist/v3.js +16 -0
- package/node_modules/uuid/dist/v35.js +69 -0
- package/node_modules/uuid/dist/v4.js +40 -0
- package/node_modules/uuid/dist/v5.js +16 -0
- package/node_modules/uuid/package.json +92 -19
- package/node_modules/uuid/wrapper.mjs +5 -0
- package/package.json +7 -7
- package/releasetag.txt +1 -1
- package/version.txt +1 -1
- package/node_modules/uuid/.eslintrc.json +0 -47
- package/node_modules/uuid/AUTHORS +0 -5
- package/node_modules/uuid/README_js.md +0 -280
- package/node_modules/uuid/bin/uuid +0 -65
- package/node_modules/uuid/index.js +0 -8
- package/node_modules/uuid/lib/bytesToUuid.js +0 -24
- package/node_modules/uuid/lib/md5.js +0 -25
- package/node_modules/uuid/lib/rng-browser.js +0 -34
- package/node_modules/uuid/lib/rng.js +0 -8
- package/node_modules/uuid/lib/sha1-browser.js +0 -89
- package/node_modules/uuid/lib/sha1.js +0 -25
- package/node_modules/uuid/v3.js +0 -4
- package/node_modules/uuid/v4.js +0 -29
- package/node_modules/uuid/v5.js +0 -3
|
@@ -2,130 +2,164 @@
|
|
|
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)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
For the creation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDs
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
- **Complete** - Support for RFC4122 version 1, 3, 4, and 5 UUIDs
|
|
10
|
+
- **Cross-platform** - Support for ...
|
|
11
|
+
- CommonJS, [ECMAScript Modules](#ecmascript-modules) and UMD builds
|
|
12
|
+
- Node 8, 10, 12, 14
|
|
13
|
+
- Chrome, Safari, Firefox, Edge, IE 11 browsers
|
|
14
|
+
- Webpack and rollup.js module bundlers
|
|
15
|
+
- [React Native](#react-native)
|
|
16
|
+
- **Secure** - Cryptographically-strong random values
|
|
17
|
+
- **Small** - Zero-dependency, small footprint, plays nice with "tree shaking" packagers
|
|
18
|
+
- **CLI** - Includes the [`uuid` command line](#command-line) utility
|
|
10
19
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* Uses cryptographically-strong random number APIs (when available)
|
|
14
|
-
* Zero-dependency, small footprint (... but not [this small](https://gist.github.com/982883))
|
|
20
|
+
**Upgrading from uuid\@3?** Your code is probably okay, but check out [Upgrading
|
|
21
|
+
From uuid\@3](#upgrading-from-uuid3) for details.
|
|
15
22
|
|
|
16
|
-
|
|
17
|
-
supported after version 3.x of this module. Instead, use `require('uuid/[v1|v3|v4|v5]')` as shown in the examples below.]
|
|
18
|
-
|
|
19
|
-
## Quickstart - CommonJS (Recommended)
|
|
23
|
+
## Quickstart
|
|
20
24
|
|
|
21
25
|
```shell
|
|
22
26
|
npm install uuid
|
|
23
27
|
```
|
|
24
28
|
|
|
25
|
-
|
|
29
|
+
Once installed, decide which type of UUID you need. RFC4122 provides for four
|
|
30
|
+
versions, all of which are supported here. In order of popularity, they are:
|
|
26
31
|
|
|
27
|
-
Version
|
|
32
|
+
- Version 4 (random) - Created from cryptographically-strong random values
|
|
33
|
+
- Version 1 (timestamp) - Created from the system clock (plus random values)
|
|
34
|
+
- Version 5 (namespace, SHA-1) - Created from user-supplied name and namespace strings
|
|
35
|
+
- Version 3 (namespace, MD5) - Like version 5, above, but with a poorer hash algorithm
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
const uuidv1 = require('uuid/v1');
|
|
31
|
-
uuidv1(); // ⇨ '45745c60-7b1a-11e8-9c9c-2d42b21b1a3e'
|
|
37
|
+
**Unsure which one to use?** Use version 4 (random) unless you have a specific need for one of the other versions. See also [this FAQ](https://github.com/tc39/proposal-uuid#faq).
|
|
32
38
|
|
|
33
|
-
|
|
39
|
+
### Create Version 4 (Random) UUIDs
|
|
34
40
|
|
|
35
|
-
|
|
41
|
+
ECMAScript Module syntax:
|
|
36
42
|
|
|
37
43
|
```javascript
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
uuidv3('hello.example.com', uuidv3.DNS); // ⇨ '9125a8dc-52ee-365b-a5aa-81b0b3681cf6'
|
|
42
|
-
|
|
43
|
-
// ... using predefined URL namespace (for, well, URLs)
|
|
44
|
-
uuidv3('http://example.com/hello', uuidv3.URL); // ⇨ 'c6235813-3ba4-3801-ae84-e0a6ebb7d138'
|
|
44
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
45
|
+
uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
|
|
46
|
+
```
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
//
|
|
48
|
-
// Note: Custom namespaces should be a UUID string specific to your application!
|
|
49
|
-
// E.g. the one here was generated using this modules `uuid` CLI.
|
|
50
|
-
const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';
|
|
51
|
-
uuidv3('Hello, World!', MY_NAMESPACE); // ⇨ 'e8b5a51d-11c8-3310-a6ab-367563f20686'
|
|
48
|
+
CommonJS syntax:
|
|
52
49
|
|
|
50
|
+
```javascript
|
|
51
|
+
const { v4: uuidv4 } = require('uuid');
|
|
52
|
+
uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
Version
|
|
55
|
+
### Create Version 1 (Timestamp) UUIDs
|
|
56
56
|
|
|
57
57
|
```javascript
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
import { v1 as uuidv1 } from 'uuid';
|
|
59
|
+
uuidv1(); // ⇨ '2c5ea4c0-4067-11e9-8bad-9b1deb4d3b7d'
|
|
61
60
|
```
|
|
62
61
|
|
|
63
|
-
Version 5 (
|
|
62
|
+
### Create Version 3 or Version 5 (Namespace) UUIDs
|
|
63
|
+
|
|
64
|
+
⚠️ Version 3 and Version 5 UUIDs are basically the same, differing
|
|
65
|
+
only in the underlying hash algorithm. Note that per the RFC, "_If backward
|
|
66
|
+
compatibility is not an issue, SHA-1 [Version 5] is preferred_."
|
|
67
|
+
|
|
68
|
+
⚠️ If using a custom namespace **be sure to generate your own
|
|
69
|
+
namespace UUID**. You can grab one [here](https://www.uuidgenerator.net/).
|
|
64
70
|
|
|
65
71
|
```javascript
|
|
66
|
-
|
|
72
|
+
import { v5 as uuidv5 } from 'uuid'; // For version 5
|
|
73
|
+
import { v3 as uuidv3 } from 'uuid'; // For version 3
|
|
67
74
|
|
|
68
|
-
//
|
|
75
|
+
// Using predefined DNS namespace (for domain names)
|
|
69
76
|
uuidv5('hello.example.com', uuidv5.DNS); // ⇨ 'fdda765f-fc57-5604-a269-52a7df8164ec'
|
|
77
|
+
uuidv3('hello.example.com', uuidv3.DNS); // ⇨ '9125a8dc-52ee-365b-a5aa-81b0b3681cf6'
|
|
70
78
|
|
|
71
|
-
//
|
|
79
|
+
// Using predefined URL namespace (for URLs)
|
|
72
80
|
uuidv5('http://example.com/hello', uuidv5.URL); // ⇨ '3bbcee75-cecc-5b56-8031-b6641c1ed1f1'
|
|
81
|
+
uuidv3('http://example.com/hello', uuidv3.URL); // ⇨ 'c6235813-3ba4-3801-ae84-e0a6ebb7d138'
|
|
73
82
|
|
|
74
|
-
//
|
|
75
|
-
//
|
|
76
|
-
// Note: Custom namespaces should be a UUID string specific to your application!
|
|
77
|
-
// E.g. the one here was generated using this modules `uuid` CLI.
|
|
83
|
+
// Using a custom namespace (See note, above, about generating your own
|
|
84
|
+
// namespace UUID)
|
|
78
85
|
const MY_NAMESPACE = '1b671a64-40d5-491e-99b0-da01ff1f3341';
|
|
79
86
|
uuidv5('Hello, World!', MY_NAMESPACE); // ⇨ '630eb68f-e0fa-5ecc-887a-7c7a62614681'
|
|
80
|
-
|
|
87
|
+
uuidv3('Hello, World!', MY_NAMESPACE); // ⇨ 'e8b5a51d-11c8-3310-a6ab-367563f20686'
|
|
81
88
|
```
|
|
82
89
|
|
|
83
|
-
##
|
|
90
|
+
## API
|
|
84
91
|
|
|
85
|
-
|
|
92
|
+
### Version 4 (Random)
|
|
86
93
|
|
|
87
|
-
|
|
94
|
+
```javascript
|
|
95
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
88
96
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
</script>
|
|
97
|
+
// Incantations
|
|
98
|
+
uuidv4();
|
|
99
|
+
uuidv4(options);
|
|
100
|
+
uuidv4(options, buffer, offset);
|
|
94
101
|
```
|
|
95
102
|
|
|
96
|
-
|
|
103
|
+
Generate and return a RFC4122 version 4 UUID.
|
|
97
104
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
```
|
|
105
|
+
- `options` - (Object) Optional uuid state to apply. Properties may include:
|
|
106
|
+
- `random` - (Number[16]) Array of 16 numbers (0-255) to use in place of randomly generated values. Takes precedence over `options.rng`.
|
|
107
|
+
- `rng` - (Function) Random # generator function that returns an Array[16] of byte values (0-255). Alternative to `options.random`.
|
|
108
|
+
- `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
|
|
109
|
+
- `offset` - (Number) Starting index in `buffer` at which to begin writing.
|
|
104
110
|
|
|
105
|
-
|
|
111
|
+
Returns `buffer`, if specified, otherwise the string form of the UUID
|
|
106
112
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
113
|
+
Example: Generate string UUID with predefined `random` values
|
|
114
|
+
|
|
115
|
+
```javascript
|
|
116
|
+
const v4options = {
|
|
117
|
+
random: [
|
|
118
|
+
0x10,
|
|
119
|
+
0x91,
|
|
120
|
+
0x56,
|
|
121
|
+
0xbe,
|
|
122
|
+
0xc4,
|
|
123
|
+
0xfb,
|
|
124
|
+
0xc1,
|
|
125
|
+
0xea,
|
|
126
|
+
0x71,
|
|
127
|
+
0xb4,
|
|
128
|
+
0xef,
|
|
129
|
+
0xe1,
|
|
130
|
+
0x67,
|
|
131
|
+
0x1c,
|
|
132
|
+
0x58,
|
|
133
|
+
0x36,
|
|
134
|
+
],
|
|
135
|
+
};
|
|
136
|
+
uuidv4(v4options); // ⇨ '109156be-c4fb-41ea-b1b4-efe1671c5836'
|
|
112
137
|
```
|
|
113
138
|
|
|
114
|
-
|
|
139
|
+
Example: Generate two IDs in a single buffer
|
|
115
140
|
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
141
|
+
```javascript
|
|
142
|
+
const buffer = new Array();
|
|
143
|
+
uuidv4(null, buffer, 0); // ⇨
|
|
144
|
+
// [
|
|
145
|
+
// 27, 157, 107, 205, 187,
|
|
146
|
+
// 253, 75, 45, 155, 93,
|
|
147
|
+
// 171, 141, 251, 189, 75,
|
|
148
|
+
// 237
|
|
149
|
+
// ]
|
|
150
|
+
uuidv4(null, buffer, 16); // ⇨
|
|
151
|
+
// [
|
|
152
|
+
// 27, 157, 107, 205, 187, 253, 75, 45,
|
|
153
|
+
// 155, 93, 171, 141, 251, 189, 75, 237,
|
|
154
|
+
// 155, 29, 235, 77, 59, 125, 75, 173,
|
|
155
|
+
// 155, 221, 43, 13, 123, 61, 203, 109
|
|
156
|
+
// ]
|
|
121
157
|
```
|
|
122
158
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
### Version 1
|
|
159
|
+
### Version 1 (Timestamp)
|
|
126
160
|
|
|
127
161
|
```javascript
|
|
128
|
-
|
|
162
|
+
import { v1 as uuidv1 } from 'uuid';
|
|
129
163
|
|
|
130
164
|
// Incantations
|
|
131
165
|
uuidv1();
|
|
@@ -133,21 +167,21 @@ uuidv1(options);
|
|
|
133
167
|
uuidv1(options, buffer, offset);
|
|
134
168
|
```
|
|
135
169
|
|
|
136
|
-
Generate and return a RFC4122
|
|
137
|
-
|
|
138
|
-
* `options` - (Object) Optional uuid state to apply. Properties may include:
|
|
170
|
+
Generate and return a RFC4122 version 1 (timestamp) UUID.
|
|
139
171
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
172
|
+
- `options` - (Object) Optional uuid state to apply. Properties may include:
|
|
173
|
+
- `node` - (Array) Node id as Array of 6 bytes (per 4.1.6). Default: Randomly generated ID. See note 1.
|
|
174
|
+
- `clockseq` - (Number between 0 - 0x3fff) RFC clock sequence. Default: An internally maintained clockseq is used.
|
|
175
|
+
- `msecs` - (Number) Time in milliseconds since unix Epoch. Default: The current time is used.
|
|
176
|
+
- `nsecs` - (Number between 0-9999) additional time, in 100-nanosecond units. Ignored if `msecs` is unspecified. Default: internal uuid counter is used, as per 4.2.1.2.
|
|
177
|
+
- `random` - (Number[16]) Array of 16 numbers (0-255) to use for initialization of `node` and `clockseq` as described above. Takes precedence over `options.rng`.
|
|
178
|
+
- `rng` - (Function) Random # generator function that returns an Array[16] of byte values (0-255). Alternative to `options.random`.
|
|
179
|
+
- `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
|
|
180
|
+
- `offset` - (Number) Starting index in `buffer` at which to begin writing.
|
|
147
181
|
|
|
148
182
|
Returns `buffer`, if specified, otherwise the string form of the UUID
|
|
149
183
|
|
|
150
|
-
Note: The
|
|
184
|
+
Note: The default [node id](https://tools.ietf.org/html/rfc4122#section-4.1.6) (the last 12 digits in the UUID) is generated once, randomly, on process startup, and then remains unchanged for the duration of the process.
|
|
151
185
|
|
|
152
186
|
Example: Generate string UUID with fully-specified options
|
|
153
187
|
|
|
@@ -156,10 +190,9 @@ const v1options = {
|
|
|
156
190
|
node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab],
|
|
157
191
|
clockseq: 0x1234,
|
|
158
192
|
msecs: new Date('2011-11-01').getTime(),
|
|
159
|
-
nsecs: 5678
|
|
193
|
+
nsecs: 5678,
|
|
160
194
|
};
|
|
161
195
|
uuidv1(v1options); // ⇨ '710b962e-041c-11e1-9234-0123456789ab'
|
|
162
|
-
|
|
163
196
|
```
|
|
164
197
|
|
|
165
198
|
Example: In-place generation of two binary IDs
|
|
@@ -167,127 +200,240 @@ Example: In-place generation of two binary IDs
|
|
|
167
200
|
```javascript
|
|
168
201
|
// Generate two ids in an array
|
|
169
202
|
const arr = new Array();
|
|
170
|
-
uuidv1(null, arr, 0);
|
|
171
|
-
|
|
172
|
-
|
|
203
|
+
uuidv1(null, arr, 0); // ⇨
|
|
204
|
+
// [
|
|
205
|
+
// 44, 94, 164, 192, 64, 103,
|
|
206
|
+
// 17, 233, 146, 52, 155, 29,
|
|
207
|
+
// 235, 77, 59, 125
|
|
208
|
+
// ]
|
|
209
|
+
uuidv1(null, arr, 16); // ⇨
|
|
210
|
+
// [
|
|
211
|
+
// 44, 94, 164, 192, 64, 103, 17, 233,
|
|
212
|
+
// 146, 52, 155, 29, 235, 77, 59, 125,
|
|
213
|
+
// 44, 94, 164, 193, 64, 103, 17, 233,
|
|
214
|
+
// 146, 52, 155, 29, 235, 77, 59, 125
|
|
215
|
+
// ]
|
|
173
216
|
```
|
|
174
217
|
|
|
175
|
-
### Version
|
|
218
|
+
### Version 5 (Namespace)
|
|
176
219
|
|
|
177
220
|
```javascript
|
|
178
|
-
|
|
221
|
+
import { v5 as uuidv5 } from 'uuid';
|
|
179
222
|
|
|
180
223
|
// Incantations
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
224
|
+
uuidv5(name, namespace);
|
|
225
|
+
uuidv5(name, namespace, buffer);
|
|
226
|
+
uuidv5(name, namespace, buffer, offset);
|
|
184
227
|
```
|
|
185
228
|
|
|
186
|
-
Generate and return a RFC4122
|
|
229
|
+
Generate and return a RFC4122 version 5 UUID.
|
|
187
230
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
231
|
+
- `name` - (String | Array[]) "name" to create UUID with
|
|
232
|
+
- `namespace` - (String | Array[]) "namespace" UUID either as a String or Array[16] of byte values
|
|
233
|
+
- `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
|
|
234
|
+
- `offset` - (Number) Starting index in `buffer` at which to begin writing. Default = 0
|
|
192
235
|
|
|
193
236
|
Returns `buffer`, if specified, otherwise the string form of the UUID
|
|
194
237
|
|
|
195
238
|
Example:
|
|
196
239
|
|
|
197
240
|
```javascript
|
|
198
|
-
|
|
199
|
-
|
|
241
|
+
uuidv5('hello world', MY_NAMESPACE); // ⇨ '9f282611-e0fd-5650-8953-89c8e342da0b'
|
|
200
242
|
```
|
|
201
243
|
|
|
202
|
-
### Version
|
|
244
|
+
### Version 3 (Namespace)
|
|
245
|
+
|
|
246
|
+
⚠️ Note: Per the RFC, "_If backward compatibility is not an issue, SHA-1 [Version 5] is preferred_."
|
|
203
247
|
|
|
204
248
|
```javascript
|
|
205
|
-
|
|
249
|
+
import { v3 as uuidv3 } from 'uuid';
|
|
206
250
|
|
|
207
251
|
// Incantations
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
252
|
+
uuidv3(name, namespace);
|
|
253
|
+
uuidv3(name, namespace, buffer);
|
|
254
|
+
uuidv3(name, namespace, buffer, offset);
|
|
211
255
|
```
|
|
212
256
|
|
|
213
|
-
Generate and return a RFC4122
|
|
257
|
+
Generate and return a RFC4122 version 3 UUID.
|
|
214
258
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
* `offset` - (Number) Starting index in `buffer` at which to begin writing.
|
|
259
|
+
- `name` - (String | Array[]) "name" to create UUID with
|
|
260
|
+
- `namespace` - (String | Array[]) "namespace" UUID either as a String or Array[16] of byte values
|
|
261
|
+
- `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
|
|
262
|
+
- `offset` - (Number) Starting index in `buffer` at which to begin writing. Default = 0
|
|
220
263
|
|
|
221
264
|
Returns `buffer`, if specified, otherwise the string form of the UUID
|
|
222
265
|
|
|
223
|
-
Example:
|
|
266
|
+
Example:
|
|
224
267
|
|
|
225
268
|
```javascript
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
uuidv4(v4options); // ⇨ '109156be-c4fb-41ea-b1b4-efe1671c5836'
|
|
269
|
+
uuidv3('hello world', MY_NAMESPACE); // ⇨ '042ffd34-d989-321c-ad06-f60826172424'
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## Command Line
|
|
273
|
+
|
|
274
|
+
UUIDs can be generated from the command line using `uuid`.
|
|
233
275
|
|
|
276
|
+
```shell
|
|
277
|
+
$ uuid
|
|
278
|
+
ddeb27fb-d9a0-4624-be4d-4615062daed4
|
|
234
279
|
```
|
|
235
280
|
|
|
236
|
-
|
|
281
|
+
The default is to generate version 4 UUIDS, however the other versions are supported. Type `uuid --help` for details:
|
|
282
|
+
|
|
283
|
+
```
|
|
284
|
+
$ uuid --help
|
|
285
|
+
|
|
286
|
+
Usage:
|
|
287
|
+
uuid
|
|
288
|
+
uuid v1
|
|
289
|
+
uuid v3 <name> <namespace uuid>
|
|
290
|
+
uuid v4
|
|
291
|
+
uuid v5 <name> <namespace uuid>
|
|
292
|
+
uuid --help
|
|
293
|
+
|
|
294
|
+
Note: <namespace uuid> may be "URL" or "DNS" to use the corresponding UUIDs
|
|
295
|
+
defined by RFC4122
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
## ECMAScript Modules
|
|
299
|
+
|
|
300
|
+
This library comes with [ECMAScript
|
|
301
|
+
Modules](https://www.ecma-international.org/ecma-262/6.0/#sec-modules) (ESM) support for Node.js
|
|
302
|
+
versions that support it ([example](./examples/node-esmodules/)) as well as bundlers like
|
|
303
|
+
[rollup.js](https://rollupjs.org/guide/en/#tree-shaking) ([example](./examples/browser-rollup/))
|
|
304
|
+
and [webpack](https://webpack.js.org/guides/tree-shaking/)
|
|
305
|
+
([example](./examples/browser-webpack/)) (targeting both, Node.js and browser environments).
|
|
237
306
|
|
|
238
307
|
```javascript
|
|
239
|
-
|
|
240
|
-
uuidv4(
|
|
241
|
-
|
|
308
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
309
|
+
uuidv4(); // ⇨ '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'
|
|
310
|
+
```
|
|
242
311
|
|
|
312
|
+
To run the examples you must first create a dist build of this library in the module root:
|
|
313
|
+
|
|
314
|
+
```
|
|
315
|
+
npm run build
|
|
243
316
|
```
|
|
244
317
|
|
|
245
|
-
|
|
318
|
+
## UMD Builds
|
|
246
319
|
|
|
247
|
-
|
|
248
|
-
|
|
320
|
+
If you want to load a minified UMD build directly in the browser you can use one of the popular npm
|
|
321
|
+
CDNs:
|
|
249
322
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
323
|
+
```html
|
|
324
|
+
<script src="https://unpkg.com/uuid@latest/dist/umd/uuidv4.min.js"></script>
|
|
325
|
+
<script>
|
|
326
|
+
alert(uuidv4());
|
|
327
|
+
</script>
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
or
|
|
331
|
+
|
|
332
|
+
```html
|
|
333
|
+
<script src="https://cdn.jsdelivr.net/npm/uuid@latest/dist/umd/uuidv4.min.js"></script>
|
|
334
|
+
<script>
|
|
335
|
+
alert(uuidv4());
|
|
336
|
+
</script>
|
|
254
337
|
```
|
|
255
338
|
|
|
256
|
-
|
|
339
|
+
Available bundles:
|
|
257
340
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written.
|
|
261
|
-
* `offset` - (Number) Starting index in `buffer` at which to begin writing. Default = 0
|
|
341
|
+
- https://unpkg.com/uuid@latest/dist/umd/
|
|
342
|
+
- https://cdn.jsdelivr.net/npm/uuid@latest/dist/umd/
|
|
262
343
|
|
|
263
|
-
|
|
344
|
+
## "getRandomValues() not supported"
|
|
264
345
|
|
|
265
|
-
|
|
346
|
+
This error occurs in environments where the standard
|
|
347
|
+
[`crypto.getRandomValues()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues)
|
|
348
|
+
API is not supported. This issue can be resolved by adding an appropriate polyfill:
|
|
349
|
+
|
|
350
|
+
### React Native
|
|
351
|
+
|
|
352
|
+
1. Install [`react-native-get-random-values`](https://github.com/LinusU/react-native-get-random-values#readme)
|
|
353
|
+
1. Import it before `uuid`:
|
|
266
354
|
|
|
267
355
|
```javascript
|
|
268
|
-
|
|
356
|
+
import 'react-native-get-random-values';
|
|
357
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### Web Workers / Service Workers (Edge <= 18)
|
|
361
|
+
|
|
362
|
+
[In Edge <= 18, Web Crypto is not supported in Web Workers or Service
|
|
363
|
+
Workers](https://caniuse.com/#feat=cryptography) and we are not aware of a polyfill (let us know if
|
|
364
|
+
you find one, please).
|
|
365
|
+
|
|
366
|
+
## Upgrading From uuid\@7
|
|
367
|
+
|
|
368
|
+
### Only Named Exports Supported When Using with Node.js ESM
|
|
269
369
|
|
|
370
|
+
uuid\@7 did not come with native ECMAScript Module (ESM) support for Node.js. Importing it in
|
|
371
|
+
Node.js ESM consequently imported the CommonJS source with a default export. This library now comes
|
|
372
|
+
with true Node.js ESM support and only provides named exports.
|
|
373
|
+
|
|
374
|
+
Instead of doing:
|
|
375
|
+
|
|
376
|
+
```javascript
|
|
377
|
+
import uuid from 'uuid';
|
|
378
|
+
uuid.v4();
|
|
270
379
|
```
|
|
271
380
|
|
|
272
|
-
|
|
381
|
+
you will now have to use the named exports:
|
|
273
382
|
|
|
274
|
-
|
|
383
|
+
```javascript
|
|
384
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
385
|
+
uuidv4();
|
|
386
|
+
```
|
|
275
387
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
388
|
+
### Deep Requires No Longer Supported
|
|
389
|
+
|
|
390
|
+
Deep requires like `require('uuid/v4')` [which have been deprecated in
|
|
391
|
+
uuid\@7](#deep-requires-now-deprecated) are no longer supported.
|
|
392
|
+
|
|
393
|
+
## Upgrading From uuid\@3
|
|
394
|
+
|
|
395
|
+
"_Wait... what happened to uuid\@4 - uuid\@6?!?_"
|
|
279
396
|
|
|
280
|
-
|
|
281
|
-
|
|
397
|
+
In order to avoid confusion with RFC [version 4](#version-4-random) and [version
|
|
398
|
+
5](#version-5-namespace) UUIDs, and a possible [version
|
|
399
|
+
6](http://gh.peabody.io/uuidv6/), releases 4 thru 6 of this module have been
|
|
400
|
+
skipped. Hence, how we're now at uuid\@7.
|
|
401
|
+
|
|
402
|
+
### Deep Requires Now Deprecated
|
|
403
|
+
|
|
404
|
+
uuid\@3 encouraged the use of deep requires to minimize the bundle size of
|
|
405
|
+
browser builds:
|
|
406
|
+
|
|
407
|
+
```javascript
|
|
408
|
+
const uuidv4 = require('uuid/v4'); // <== NOW DEPRECATED!
|
|
409
|
+
uuidv4();
|
|
282
410
|
```
|
|
283
411
|
|
|
284
|
-
|
|
412
|
+
As of uuid\@7 this library now provides ECMAScript modules builds, which allow
|
|
413
|
+
packagers like Webpack and Rollup to do "tree-shaking" to remove dead code.
|
|
414
|
+
Instead, use the `import` syntax:
|
|
285
415
|
|
|
286
|
-
|
|
416
|
+
```javascript
|
|
417
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
418
|
+
uuidv4();
|
|
419
|
+
```
|
|
287
420
|
|
|
288
|
-
|
|
289
|
-
|
|
421
|
+
... or for CommonJS:
|
|
422
|
+
|
|
423
|
+
```javascript
|
|
424
|
+
const { v4: uuidv4 } = require('uuid');
|
|
425
|
+
uuidv4();
|
|
290
426
|
```
|
|
291
427
|
|
|
428
|
+
### Default Export Removed
|
|
429
|
+
|
|
430
|
+
uuid\@3 was exporting the Version 4 UUID method as a default export:
|
|
431
|
+
|
|
432
|
+
```javascript
|
|
433
|
+
const uuid = require('uuid'); // <== REMOVED!
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
This usage pattern was already discouraged in uuid\@3 and has been removed in uuid\@7.
|
|
437
|
+
|
|
292
438
|
----
|
|
293
439
|
Markdown generated from [README_js.md](README_js.md) by [](https://github.com/broofa/runmd)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Convert array of 16 byte values to UUID string format of the form:
|
|
10
|
+
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
11
|
+
*/
|
|
12
|
+
var byteToHex = [];
|
|
13
|
+
|
|
14
|
+
for (var i = 0; i < 256; ++i) {
|
|
15
|
+
byteToHex[i] = (i + 0x100).toString(16).substr(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function bytesToUuid(buf, offset) {
|
|
19
|
+
var i = offset || 0;
|
|
20
|
+
var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
|
|
21
|
+
|
|
22
|
+
return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join('');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var _default = bytesToUuid;
|
|
26
|
+
exports.default = _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert array of 16 byte values to UUID string format of the form:
|
|
3
|
+
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
4
|
+
*/
|
|
5
|
+
var byteToHex = [];
|
|
6
|
+
|
|
7
|
+
for (var i = 0; i < 256; ++i) {
|
|
8
|
+
byteToHex[i] = (i + 0x100).toString(16).substr(1);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function bytesToUuid(buf, offset) {
|
|
12
|
+
var i = offset || 0;
|
|
13
|
+
var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
|
|
14
|
+
|
|
15
|
+
return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join('');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default bytesToUuid;
|