uuid-stream 1.1.6 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +14 -2
- package/esm/index.js +20 -0
- package/index.d.ts +9 -0
- package/index.js +24 -0
- package/package.json +25 -51
- package/main/index.js +0 -61
- package/module/index.js +0 -29
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2024 Dan Lynch <pyramation@gmail.com>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
# UUID Stream
|
|
1
|
+
# UUID Stream
|
|
2
|
+
|
|
3
|
+
<p align="center" width="100%">
|
|
4
|
+
<img height="250" src="https://github.com/user-attachments/assets/d0456af5-b6e9-422e-a45d-2574d5be490f" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center" width="100%">
|
|
8
|
+
<a href="https://github.com/launchql/launchql-2.0/actions/workflows/run-tests.yaml">
|
|
9
|
+
<img height="20" src="https://github.com/launchql/launchql-2.0/actions/workflows/run-tests.yaml/badge.svg" />
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://github.com/launchql/launchql-2.0/blob/main/LICENSE-MIT"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a>
|
|
12
|
+
<a href="https://www.npmjs.com/package/uuid-stream"><img height="20" src="https://img.shields.io/github/package-json/v/launchql/launchql-2.0?filename=packages%2Fuuid-stream%2Fpackage.json"/></a>
|
|
13
|
+
</p>
|
|
2
14
|
|
|
3
15
|
A Transform stream that generates RFC-compliant UUID v5.
|
|
4
16
|
|
|
@@ -32,4 +44,4 @@ stream
|
|
|
32
44
|
readstream.pipe(stream);
|
|
33
45
|
```
|
|
34
46
|
|
|
35
|
-
Just like [node-uuid](https://github.com/kelektiv/node-uuid) for uuid v5, but removed the need to have all contents in-memory to be compatible with streams.
|
|
47
|
+
Just like [node-uuid](https://github.com/kelektiv/node-uuid) for uuid v5, but removed the need to have all contents in-memory to be compatible with streams.
|
package/esm/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Transform } from 'stream';
|
|
2
|
+
import { createHash as createUuidHash } from 'uuid-hash';
|
|
3
|
+
export const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
|
4
|
+
export const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
|
|
5
|
+
export default class UuidStream extends Transform {
|
|
6
|
+
hash;
|
|
7
|
+
constructor(namespace = URL, version = 0x50) {
|
|
8
|
+
super();
|
|
9
|
+
this.hash = createUuidHash(namespace, version);
|
|
10
|
+
}
|
|
11
|
+
_write(chunk, _encoding, callback) {
|
|
12
|
+
this.hash.update(chunk);
|
|
13
|
+
this.push(chunk);
|
|
14
|
+
callback();
|
|
15
|
+
}
|
|
16
|
+
_flush(callback) {
|
|
17
|
+
this.emit('uuid', this.hash.digest());
|
|
18
|
+
callback();
|
|
19
|
+
}
|
|
20
|
+
}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Transform, TransformCallback } from 'stream';
|
|
2
|
+
export declare const DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
|
|
3
|
+
export declare const URL = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
|
|
4
|
+
export default class UuidStream extends Transform {
|
|
5
|
+
private hash;
|
|
6
|
+
constructor(namespace?: string, version?: number);
|
|
7
|
+
_write(chunk: Buffer, _encoding: BufferEncoding, callback: TransformCallback): void;
|
|
8
|
+
_flush(callback: TransformCallback): void;
|
|
9
|
+
}
|
package/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.URL = exports.DNS = void 0;
|
|
4
|
+
const stream_1 = require("stream");
|
|
5
|
+
const uuid_hash_1 = require("uuid-hash");
|
|
6
|
+
exports.DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
|
7
|
+
exports.URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
|
|
8
|
+
class UuidStream extends stream_1.Transform {
|
|
9
|
+
hash;
|
|
10
|
+
constructor(namespace = exports.URL, version = 0x50) {
|
|
11
|
+
super();
|
|
12
|
+
this.hash = (0, uuid_hash_1.createHash)(namespace, version);
|
|
13
|
+
}
|
|
14
|
+
_write(chunk, _encoding, callback) {
|
|
15
|
+
this.hash.update(chunk);
|
|
16
|
+
this.push(chunk);
|
|
17
|
+
callback();
|
|
18
|
+
}
|
|
19
|
+
_flush(callback) {
|
|
20
|
+
this.emit('uuid', this.hash.digest());
|
|
21
|
+
callback();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.default = UuidStream;
|
package/package.json
CHANGED
|
@@ -1,36 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uuid-stream",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "A Transform stream that generates RFC-compliant UUID v5.",
|
|
3
|
+
"version": "2.0.2",
|
|
5
4
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
6
|
-
"
|
|
5
|
+
"description": "A Transform stream that generates RFC-compliant UUID v5.",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"module": "esm/index.js",
|
|
8
|
+
"types": "index.d.ts",
|
|
9
|
+
"homepage": "https://github.com/launchql/launchql",
|
|
7
10
|
"license": "SEE LICENSE IN LICENSE",
|
|
8
|
-
"main": "main/index.js",
|
|
9
|
-
"module": "module/index.js",
|
|
10
|
-
"directories": {
|
|
11
|
-
"lib": "src",
|
|
12
|
-
"test": "__tests__"
|
|
13
|
-
},
|
|
14
|
-
"files": [
|
|
15
|
-
"main",
|
|
16
|
-
"module"
|
|
17
|
-
],
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build:main": "cross-env BABEL_ENV=production babel src --out-dir main --delete-dir-on-start",
|
|
20
|
-
"build:module": "cross-env MODULE=true babel src --out-dir module --delete-dir-on-start",
|
|
21
|
-
"build": "npm run build:module && npm run build:main",
|
|
22
|
-
"prepublish": "npm run build",
|
|
23
|
-
"lint": "eslint src --fix",
|
|
24
|
-
"test": "jest",
|
|
25
|
-
"test:watch": "jest --watch",
|
|
26
|
-
"test:debug": "node --inspect node_modules/.bin/jest --runInBand"
|
|
27
|
-
},
|
|
28
11
|
"publishConfig": {
|
|
29
|
-
"access": "public"
|
|
12
|
+
"access": "public",
|
|
13
|
+
"directory": "dist"
|
|
30
14
|
},
|
|
31
15
|
"repository": {
|
|
32
16
|
"type": "git",
|
|
33
|
-
"url": "https://github.com/
|
|
17
|
+
"url": "https://github.com/launchql/launchql"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/launchql/launchql/issues"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"copy": "copyfiles -f ../../LICENSE README.md package.json dist",
|
|
24
|
+
"clean": "rimraf dist/**",
|
|
25
|
+
"prepare": "npm run build",
|
|
26
|
+
"build": "npm run clean; tsc; tsc -p tsconfig.esm.json; npm run copy",
|
|
27
|
+
"build:dev": "npm run clean; tsc --declarationMap; tsc -p tsconfig.esm.json; npm run copy",
|
|
28
|
+
"lint": "eslint . --fix",
|
|
29
|
+
"test": "jest",
|
|
30
|
+
"test:watch": "jest --watch"
|
|
34
31
|
},
|
|
35
32
|
"keywords": [
|
|
36
33
|
"stream",
|
|
@@ -39,31 +36,8 @@
|
|
|
39
36
|
"uuidv5",
|
|
40
37
|
"uuid"
|
|
41
38
|
],
|
|
42
|
-
"bugs": {
|
|
43
|
-
"url": "https://github.com/pyramation/uuid-stream/issues"
|
|
44
|
-
},
|
|
45
|
-
"devDependencies": {
|
|
46
|
-
"@babel/cli": "7.11.6",
|
|
47
|
-
"@babel/core": "7.11.6",
|
|
48
|
-
"@babel/plugin-proposal-class-properties": "7.10.4",
|
|
49
|
-
"@babel/plugin-proposal-export-default-from": "7.10.4",
|
|
50
|
-
"@babel/plugin-proposal-object-rest-spread": "7.11.0",
|
|
51
|
-
"@babel/plugin-transform-runtime": "7.11.5",
|
|
52
|
-
"@babel/preset-env": "7.11.5",
|
|
53
|
-
"babel-core": "7.0.0-bridge.0",
|
|
54
|
-
"babel-eslint": "10.1.0",
|
|
55
|
-
"babel-jest": "25.1.0",
|
|
56
|
-
"cross-env": "^7.0.2",
|
|
57
|
-
"eslint": "6.8.0",
|
|
58
|
-
"eslint-config-prettier": "^6.10.0",
|
|
59
|
-
"eslint-plugin-prettier": "^3.1.2",
|
|
60
|
-
"jest": "^24.5.0",
|
|
61
|
-
"jest-in-case": "^1.0.2",
|
|
62
|
-
"prettier": "^2.1.2",
|
|
63
|
-
"regenerator-runtime": "^0.13.7"
|
|
64
|
-
},
|
|
65
39
|
"dependencies": {
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
40
|
+
"uuid-hash": "^2.0.2"
|
|
41
|
+
},
|
|
42
|
+
"gitHead": "d4ef195aec8d4c5a470f507b5a57c6c8e81124f4"
|
|
69
43
|
}
|
package/main/index.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
6
|
-
|
|
7
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
|
-
|
|
9
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
10
|
-
|
|
11
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
|
-
|
|
13
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
-
|
|
15
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
16
|
-
|
|
17
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
18
|
-
|
|
19
|
-
var stream = require('stream');
|
|
20
|
-
|
|
21
|
-
var uuid = require('uuid-hash');
|
|
22
|
-
|
|
23
|
-
var DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
|
24
|
-
var URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
|
|
25
|
-
module.exports.DNS = DNS;
|
|
26
|
-
module.exports.URL = URL;
|
|
27
|
-
|
|
28
|
-
var UuidStream = /*#__PURE__*/function (_stream$Transform) {
|
|
29
|
-
(0, _inherits2["default"])(UuidStream, _stream$Transform);
|
|
30
|
-
|
|
31
|
-
var _super = _createSuper(UuidStream);
|
|
32
|
-
|
|
33
|
-
function UuidStream() {
|
|
34
|
-
var _this;
|
|
35
|
-
|
|
36
|
-
var namespace = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : URL;
|
|
37
|
-
var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0x50;
|
|
38
|
-
(0, _classCallCheck2["default"])(this, UuidStream);
|
|
39
|
-
_this = _super.call(this);
|
|
40
|
-
_this.hash = uuid.createHash(namespace, version);
|
|
41
|
-
return _this;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
(0, _createClass2["default"])(UuidStream, [{
|
|
45
|
-
key: "_write",
|
|
46
|
-
value: function _write(chunk, enc, next) {
|
|
47
|
-
this.hash.update(chunk);
|
|
48
|
-
this.push(chunk);
|
|
49
|
-
next();
|
|
50
|
-
}
|
|
51
|
-
}, {
|
|
52
|
-
key: "_flush",
|
|
53
|
-
value: function _flush(done) {
|
|
54
|
-
this.emit('uuid', this.hash.digest());
|
|
55
|
-
done();
|
|
56
|
-
}
|
|
57
|
-
}]);
|
|
58
|
-
return UuidStream;
|
|
59
|
-
}(stream.Transform);
|
|
60
|
-
|
|
61
|
-
module.exports = UuidStream;
|
package/module/index.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const stream = require('stream');
|
|
2
|
-
|
|
3
|
-
const uuid = require('uuid-hash');
|
|
4
|
-
|
|
5
|
-
const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
|
6
|
-
const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
|
|
7
|
-
module.exports.DNS = DNS;
|
|
8
|
-
module.exports.URL = URL;
|
|
9
|
-
|
|
10
|
-
class UuidStream extends stream.Transform {
|
|
11
|
-
constructor(namespace = URL, version = 0x50) {
|
|
12
|
-
super();
|
|
13
|
-
this.hash = uuid.createHash(namespace, version);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
_write(chunk, enc, next) {
|
|
17
|
-
this.hash.update(chunk);
|
|
18
|
-
this.push(chunk);
|
|
19
|
-
next();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
_flush(done) {
|
|
23
|
-
this.emit('uuid', this.hash.digest());
|
|
24
|
-
done();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
module.exports = UuidStream;
|