@omnitron-dev/cuid 0.4.6 → 0.4.8

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.
Files changed (2) hide show
  1. package/README.md +19 -12
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,27 +1,34 @@
1
1
  # @omnitron-dev/cuid
2
2
 
3
- > Collision-resistant unique ID generation
3
+ Generate compact string identifiers from a timestamp, counter, fingerprint and hashed entropy.
4
4
 
5
- Part of the [Omni](../../README.md) monorepo — Fullstack Type-Safe RPC Framework.
5
+ ## Capabilities
6
6
 
7
- ## Installation
7
+ - A default 16-character identifier beginning with a lowercase letter.
8
+ - `isCuid` for format validation.
9
+ - `createOptimizedCuid` for a configured generator.
8
10
 
9
- ```bash
11
+ ## Quick start
12
+
13
+ ```sh
10
14
  pnpm add @omnitron-dev/cuid
11
15
  ```
12
16
 
13
- ## Overview
17
+ ```ts
18
+ import { cuid, isCuid, createOptimizedCuid } from '@omnitron-dev/cuid';
14
19
 
15
- A fast, collision-resistant unique identifier generator. Produces URL-safe, monotonically sortable IDs suitable for distributed systems where coordination-free ID generation is required.
20
+ const id = cuid();
21
+ console.log(isCuid(id)); // true
22
+ const createLongId = createOptimizedCuid({ length: 32 });
23
+ console.log(createLongId());
24
+ ```
16
25
 
17
- ## Quick Start
26
+ The encoded hash does not preserve timestamp order. Entropy uses `Math.random`; use a cryptographic token generator for bearer credentials. Format validation does not prove uniqueness or origin; use a uniqueness constraint where your storage requires one.
18
27
 
19
- ```typescript
20
- import { cuid } from '@omnitron-dev/cuid';
28
+ ## Documentation
21
29
 
22
- const id = cuid(); // e.g. "clh3k7v0a0000..."
23
- ```
30
+ [Public API](src/index.ts) · [Package exports](package.json) · [Omni](../../README.md)
24
31
 
25
32
  ## License
26
33
 
27
- MIT
34
+ [MIT](../../LICENSE).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnitron-dev/cuid",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "description": "CUID implementation",
5
5
  "author": "LuxQuant",
6
6
  "license": "MIT",
@@ -54,7 +54,7 @@
54
54
  "dependencies": {
55
55
  "@noble/hashes": "2.4.0"
56
56
  },
57
- "gitHead": "3a912fa181e97ddd238a28bb355cd7445c1b7364",
57
+ "gitHead": "1ae8568eebc2581e2cc2428bd3ca1cf570ed3f03",
58
58
  "scripts": {
59
59
  "build": "../../scripts/build-package.sh -p ./tsconfig.json",
60
60
  "typecheck": "tsc --noEmit -p tsconfig.typecheck.json",