@cqrs-ddd/uuidv7 0.3.0 → 0.4.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/README.md +3 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -6
- package/dist/index.js.map +1 -1
- package/dist/uuidv7.js +4 -8
- package/dist/uuidv7.js.map +1 -1
- package/package.json +9 -1
package/README.md
CHANGED
|
@@ -18,6 +18,9 @@ pnpm add @cqrs-ddd/uuidv7
|
|
|
18
18
|
|
|
19
19
|
Requires Node.js 22.12 or later.
|
|
20
20
|
|
|
21
|
+
Published as an ES module; a CommonJS application loads it with `require()`. Coming from
|
|
22
|
+
0.3.x, see [Upgrading from 0.3.x](https://github.com/aristoteliss/nestjs-pipeline#upgrading-from-03x).
|
|
23
|
+
|
|
21
24
|
## API
|
|
22
25
|
|
|
23
26
|
```typescript
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { isUuidV7, uuidv7 } from './uuidv7';
|
|
1
|
+
export { isUuidV7, uuidv7 } from './uuidv7.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/* Copyright (C) 2026-present Aristotelis — see repository license. */
|
|
3
|
-
|
|
4
|
-
exports.uuidv7 = exports.isUuidV7 = void 0;
|
|
5
|
-
var uuidv7_1 = require("./uuidv7");
|
|
6
|
-
Object.defineProperty(exports, "isUuidV7", { enumerable: true, get: function () { return uuidv7_1.isUuidV7; } });
|
|
7
|
-
Object.defineProperty(exports, "uuidv7", { enumerable: true, get: function () { return uuidv7_1.uuidv7; } });
|
|
2
|
+
export { isUuidV7, uuidv7 } from './uuidv7.js';
|
|
8
3
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/uuidv7.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/* Copyright (C) 2026-present Aristotelis — see repository license. */
|
|
3
|
-
|
|
4
|
-
exports.uuidv7 = uuidv7;
|
|
5
|
-
exports.isUuidV7 = isUuidV7;
|
|
6
|
-
const node_crypto_1 = require("node:crypto");
|
|
2
|
+
import { randomBytes } from 'node:crypto';
|
|
7
3
|
const UUID_V7_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
8
4
|
/**
|
|
9
5
|
* Generates a UUIDv7 string per RFC 9562.
|
|
@@ -35,8 +31,8 @@ const UUID_V7_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[
|
|
|
35
31
|
*
|
|
36
32
|
* Zero external dependencies — uses Node.js built-in `crypto.randomBytes()`.
|
|
37
33
|
*/
|
|
38
|
-
function uuidv7() {
|
|
39
|
-
const bytes =
|
|
34
|
+
export function uuidv7() {
|
|
35
|
+
const bytes = randomBytes(16);
|
|
40
36
|
// Encode unix timestamp (ms) into the first 48 bits (bytes 0-5)
|
|
41
37
|
const now = Date.now();
|
|
42
38
|
bytes[0] = (now / 2 ** 40) & 0xff;
|
|
@@ -65,7 +61,7 @@ function uuidv7() {
|
|
|
65
61
|
* Returns true when the value is a string that, with surrounding whitespace
|
|
66
62
|
* trimmed, is a valid RFC 9562 UUID v7.
|
|
67
63
|
*/
|
|
68
|
-
function isUuidV7(value) {
|
|
64
|
+
export function isUuidV7(value) {
|
|
69
65
|
if (typeof value !== 'string')
|
|
70
66
|
return false;
|
|
71
67
|
const trimmed = value.trim();
|
package/dist/uuidv7.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uuidv7.js","sourceRoot":"","sources":["../src/uuidv7.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"uuidv7.js","sourceRoot":"","sources":["../src/uuidv7.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,aAAa,GACjB,wEAAwE,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,MAAM;IACpB,MAAM,KAAK,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC;IAE9B,gEAAgE;IAChE,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IAClC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IAClC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IAClC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,EAAE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
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "RFC 9562 UUID version 7 generation and validation, with no dependencies and no framework.",
|
|
5
5
|
"author": "Aristotelis",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
7
|
+
"type": "module",
|
|
7
8
|
"engines": {
|
|
8
9
|
"node": ">=22.12.0"
|
|
9
10
|
},
|
|
@@ -21,6 +22,13 @@
|
|
|
21
22
|
"uuidv7",
|
|
22
23
|
"rfc9562"
|
|
23
24
|
],
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"default": "./dist/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./package.json": "./package.json"
|
|
31
|
+
},
|
|
24
32
|
"main": "dist/index.js",
|
|
25
33
|
"types": "dist/index.d.ts",
|
|
26
34
|
"files": [
|