@thi.ng/ksuid 3.0.1 → 3.1.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/CHANGELOG.md +7 -1
- package/README.md +19 -4
- package/bin/ksuid +12 -0
- package/cli.d.ts +2 -0
- package/cli.js +3 -0
- package/package.json +13 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2023-02-
|
|
3
|
+
- **Last updated**: 2023-02-10T14:03:10Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
## [3.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/ksuid@3.1.0) (2023-02-10)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- add CLI wrapper ([36fdc08](https://github.com/thi-ng/umbrella/commit/36fdc08))
|
|
17
|
+
|
|
12
18
|
# [3.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/ksuid@3.0.0) (2023-01-17)
|
|
13
19
|
|
|
14
20
|
#### 🛑 Breaking changes
|
package/README.md
CHANGED
|
@@ -10,6 +10,7 @@ This project is part of the
|
|
|
10
10
|
[@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo.
|
|
11
11
|
|
|
12
12
|
- [About](#about)
|
|
13
|
+
- [CLI usage](#cli-usage)
|
|
13
14
|
- [Status](#status)
|
|
14
15
|
- [Breaking changes](#breaking-changes)
|
|
15
16
|
- [Related packages](#related-packages)
|
|
@@ -44,15 +45,29 @@ creation of [ULIDs](https://github.com/ulid/spec):
|
|
|
44
45
|
for alternatives
|
|
45
46
|
- <sup>(2)</sup> Default: `window.crypto`, `Math.random` as fallback
|
|
46
47
|
|
|
47
|
-
IDs generated w/ this package are composed of a 32, 48 or 64 bit Unix epochs
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
byte arrays or base-N encoded strings. For the latter, the JS runtime MUST
|
|
48
|
+
IDs generated w/ this package are composed of a 32, 48 or 64 bit Unix epochs and
|
|
49
|
+
N additional bits of a random payload (from a configurable source). By default
|
|
50
|
+
all timestamps are shifted to free up bits for the future. IDs can be generated
|
|
51
|
+
as byte arrays or base-N encoded strings. For the latter, the JS runtime MUST
|
|
51
52
|
support
|
|
52
53
|
[`BigInt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt).
|
|
53
54
|
|
|
54
55
|

|
|
55
56
|
|
|
57
|
+
### CLI usage
|
|
58
|
+
|
|
59
|
+
Since v3.1.0 a small CLI for ad-hoc KSUID generation is included. Currently only
|
|
60
|
+
KSUID32 is supported and IDs are always based on the current time:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npx @thi.ng/ksuid
|
|
64
|
+
# 0dwncLZE8byaQdccncWDmsNmlYt
|
|
65
|
+
|
|
66
|
+
# optionally provide number of random bytes to be used (default: 16)
|
|
67
|
+
npx @thi.ng/ksuid 8
|
|
68
|
+
# 01ogp9KDpWlQ0pXCY
|
|
69
|
+
```
|
|
70
|
+
|
|
56
71
|
## Status
|
|
57
72
|
|
|
58
73
|
**STABLE** - used in production
|
package/bin/ksuid
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# https://stackoverflow.com/a/246128/294515
|
|
4
|
+
SOURCE="${BASH_SOURCE[0]}"
|
|
5
|
+
while [ -h "$SOURCE" ]; do
|
|
6
|
+
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
|
|
7
|
+
SOURCE="$(readlink "$SOURCE")"
|
|
8
|
+
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
|
|
9
|
+
done
|
|
10
|
+
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
|
|
11
|
+
|
|
12
|
+
/usr/bin/env node "$DIR/../cli.js" "$DIR" "$@"
|
package/cli.d.ts
ADDED
package/cli.js
ADDED
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/ksuid",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "Configurable K-sortable unique IDs, ULIDs, binary & base-N encoded, 32/48/64bit time resolutions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
7
7
|
"typings": "./index.d.ts",
|
|
8
|
+
"bin": "bin/ksuid",
|
|
8
9
|
"sideEffects": false,
|
|
9
10
|
"repository": {
|
|
10
11
|
"type": "git",
|
|
@@ -35,14 +36,14 @@
|
|
|
35
36
|
"test": "testament test"
|
|
36
37
|
},
|
|
37
38
|
"dependencies": {
|
|
38
|
-
"@thi.ng/base-n": "^2.
|
|
39
|
-
"@thi.ng/errors": "^2.2.
|
|
40
|
-
"@thi.ng/random": "^3.3.
|
|
41
|
-
"@thi.ng/strings": "^3.3.
|
|
39
|
+
"@thi.ng/base-n": "^2.4.1",
|
|
40
|
+
"@thi.ng/errors": "^2.2.11",
|
|
41
|
+
"@thi.ng/random": "^3.3.25",
|
|
42
|
+
"@thi.ng/strings": "^3.3.26"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"@microsoft/api-extractor": "^7.34.2",
|
|
45
|
-
"@thi.ng/testament": "^0.3.
|
|
46
|
+
"@thi.ng/testament": "^0.3.11",
|
|
46
47
|
"rimraf": "^4.1.2",
|
|
47
48
|
"tools": "^0.0.1",
|
|
48
49
|
"typedoc": "^0.23.24",
|
|
@@ -78,7 +79,8 @@
|
|
|
78
79
|
},
|
|
79
80
|
"files": [
|
|
80
81
|
"./*.js",
|
|
81
|
-
"./*.d.ts"
|
|
82
|
+
"./*.d.ts",
|
|
83
|
+
"bin"
|
|
82
84
|
],
|
|
83
85
|
"exports": {
|
|
84
86
|
".": {
|
|
@@ -90,6 +92,9 @@
|
|
|
90
92
|
"./api": {
|
|
91
93
|
"default": "./api.js"
|
|
92
94
|
},
|
|
95
|
+
"./cli": {
|
|
96
|
+
"default": "./cli.js"
|
|
97
|
+
},
|
|
93
98
|
"./ksuid32": {
|
|
94
99
|
"default": "./ksuid32.js"
|
|
95
100
|
},
|
|
@@ -109,5 +114,5 @@
|
|
|
109
114
|
"status": "stable",
|
|
110
115
|
"year": 2020
|
|
111
116
|
},
|
|
112
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "7896250248d960109253215c75b115c46626293e\n"
|
|
113
118
|
}
|