@typed/id 1.0.0-beta.6 → 1.0.0-beta.7
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 +9 -7
- package/dist/Cuid.d.ts +6 -6
- package/dist/Cuid.js +5 -5
- package/dist/DateTimes.d.ts +5 -5
- package/dist/DateTimes.js +5 -5
- package/dist/Ids.d.ts +8 -47
- package/dist/Ids.d.ts.map +1 -1
- package/dist/Ids.js +11 -55
- package/dist/IdsTest.d.ts +34 -0
- package/dist/IdsTest.d.ts.map +1 -0
- package/dist/IdsTest.js +44 -0
- package/dist/Ksuid.d.ts +3 -3
- package/dist/Ksuid.js +3 -3
- package/dist/NanoId.d.ts +3 -3
- package/dist/NanoId.js +3 -3
- package/dist/RandomValues.d.ts +4 -4
- package/dist/RandomValues.js +4 -4
- package/dist/Ulid.d.ts +3 -3
- package/dist/Ulid.js +3 -3
- package/dist/Uuid4.d.ts +3 -3
- package/dist/Uuid4.js +3 -3
- package/dist/Uuid5.d.ts +13 -13
- package/dist/Uuid5.js +8 -8
- package/dist/Uuid7.d.ts +6 -6
- package/dist/Uuid7.js +5 -5
- package/dist/internal/Ids.d.ts +23 -0
- package/dist/internal/Ids.d.ts.map +1 -0
- package/dist/internal/Ids.js +29 -0
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -44,6 +44,7 @@ for CUID or UUID v5 generation.
|
|
|
44
44
|
|
|
45
45
|
```ts
|
|
46
46
|
import { Ids, Uuid5Namespace } from "@typed/id";
|
|
47
|
+
import { IdsTest } from "@typed/id/IdsTest";
|
|
47
48
|
import * as Effect from "effect/Effect";
|
|
48
49
|
|
|
49
50
|
const program = Effect.gen(function* () {
|
|
@@ -62,7 +63,8 @@ const ids = await Effect.runPromise(Effect.provide(program, Ids.Default));
|
|
|
62
63
|
console.log(ids);
|
|
63
64
|
```
|
|
64
65
|
|
|
65
|
-
Use `
|
|
66
|
+
Use `IdsTest()` from `@typed/id/IdsTest` instead of `Ids.Default` when the same program needs
|
|
67
|
+
deterministic test data.
|
|
66
68
|
|
|
67
69
|
## Values and serialization
|
|
68
70
|
|
|
@@ -102,7 +104,7 @@ The standalone generators have narrower requirements:
|
|
|
102
104
|
|
|
103
105
|
`RandomValues.Default` uses Web Crypto and is the production entropy source. `RandomValues.Random`
|
|
104
106
|
derives bytes from Effect's current `Random` service and is intended for controlled tests or
|
|
105
|
-
simulations, not as a cryptographic entropy source. `
|
|
107
|
+
simulations, not as a cryptographic entropy source. `IdsTest()` supplies fixed internal entropy
|
|
106
108
|
and a controllable clock; its output is for repeatable tests, not production IDs. Service state is
|
|
107
109
|
process-local and is not a serialization format or a persistence mechanism.
|
|
108
110
|
|
|
@@ -135,9 +137,9 @@ This provider is deterministic and is therefore test-only. Application code norm
|
|
|
135
137
|
|
|
136
138
|
## API reference
|
|
137
139
|
|
|
138
|
-
### Ids
|
|
140
|
+
### Ids and IdsTest
|
|
139
141
|
|
|
140
|
-
Unified service for generating all ID types. Requires `DateTimes`, `RandomValues`, `CuidState`, and `Uuid7State` (use `Ids.Default` or `
|
|
142
|
+
Unified service for generating all ID types. Requires `DateTimes`, `RandomValues`, `CuidState`, and `Uuid7State` (use `Ids.Default` or `IdsTest()` to provide them).
|
|
141
143
|
|
|
142
144
|
| Member | Type | Description |
|
|
143
145
|
| -------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
|
|
@@ -149,12 +151,12 @@ Unified service for generating all ID types. Requires `DateTimes`, `RandomValues
|
|
|
149
151
|
| `Ids.uuid5` | `(name, namespace) => Effect<Uuid5, IllegalArgumentError, Ids>` | Generate a UUID v5; namespaces not exactly 16 bytes fail. Also has `.dns`, `.url`, `.oid`, and `.x500`. |
|
|
150
152
|
| `Ids.uuid7` | `Effect<Uuid7, IllegalArgumentError, Ids>` | Generate a UUID v7; timestamps outside its 48-bit field fail before state mutation. |
|
|
151
153
|
| `Ids.Default` | `Layer<Ids \| DateTimes \| RandomValues>` | Layer that provides `Ids` with default Cuid/Uuid7/DateTimes/RandomValues. |
|
|
152
|
-
| `
|
|
154
|
+
| `IdsTest(options?)` | `Layer<Ids \| DateTimes \| RandomValues, IllegalArgumentError>` | Reproducible test layer; invalid `currentTime` values fail. |
|
|
153
155
|
|
|
154
|
-
**
|
|
156
|
+
**IdsTestOptions:**
|
|
155
157
|
`{ currentTime?: number | string | Date; envData?: string }`
|
|
156
158
|
|
|
157
|
-
`
|
|
159
|
+
`IdsTest()` defaults to time `1_400_000_000_000` and uses fixed internal test entropy.
|
|
158
160
|
|
|
159
161
|
---
|
|
160
162
|
|
package/dist/Cuid.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ import { RandomValues } from "./RandomValues.js";
|
|
|
17
17
|
* const id = Cuid.make("a00000000000000000000000")
|
|
18
18
|
* ```
|
|
19
19
|
* See [Effect Schema](https://effect.website/docs/schema/introduction/).
|
|
20
|
-
* @category
|
|
20
|
+
* @category ID schemas
|
|
21
21
|
* @since 1.0.0
|
|
22
22
|
*/
|
|
23
23
|
export declare const Cuid: Schema.brand<Schema.String, "@typed/id/CUID">;
|
|
@@ -34,7 +34,7 @@ export type Cuid = Schema.Schema.Type<typeof Cuid>;
|
|
|
34
34
|
* import { isCuid } from "@typed/id/Cuid"
|
|
35
35
|
* isCuid("a00000000000000000000000")
|
|
36
36
|
* ```
|
|
37
|
-
* @category
|
|
37
|
+
* @category ID validation
|
|
38
38
|
* @since 1.0.0
|
|
39
39
|
*/
|
|
40
40
|
export declare const isCuid: (value: string) => value is Cuid;
|
|
@@ -50,7 +50,7 @@ export declare const isCuid: (value: string) => value is Cuid;
|
|
|
50
50
|
* import type { CuidSeed } from "@typed/id/Cuid"
|
|
51
51
|
* const seed: CuidSeed = { timestamp: 0, counter: 0, random: new Uint8Array(32) as CuidSeed["random"], fingerprint: "test" }
|
|
52
52
|
* ```
|
|
53
|
-
* @category
|
|
53
|
+
* @category ID types
|
|
54
54
|
* @since 1.0.0
|
|
55
55
|
*/
|
|
56
56
|
export type CuidSeed = {
|
|
@@ -100,7 +100,7 @@ declare const CuidState_base: Context.ServiceClass<CuidState, "@typed/id/CuidSta
|
|
|
100
100
|
* const program = Effect.provide(cuid, CuidState.Default)
|
|
101
101
|
* ```
|
|
102
102
|
* See [Effect services](https://effect.website/docs/requirements-management/services/) and [Layers](https://effect.website/docs/requirements-management/layers/).
|
|
103
|
-
* @category
|
|
103
|
+
* @category Sequence state
|
|
104
104
|
* @since 1.0.0
|
|
105
105
|
*/
|
|
106
106
|
export declare class CuidState extends CuidState_base {
|
|
@@ -129,7 +129,7 @@ export declare class CuidState extends CuidState_base {
|
|
|
129
129
|
* The explicit Layer gives production code a standard service while keeping test and environment-specific alternatives replaceable.
|
|
130
130
|
* ## Ownership and lifetime
|
|
131
131
|
* Layer acquisition creates one counter state; the surrounding Layer Scope owns it. Web Crypto must be available in the runtime.
|
|
132
|
-
* @category
|
|
132
|
+
* @category Production layers
|
|
133
133
|
* @since 1.0.0
|
|
134
134
|
*/
|
|
135
135
|
static readonly Default: Layer.Layer<CuidState, never, never>;
|
|
@@ -147,7 +147,7 @@ export declare class CuidState extends CuidState_base {
|
|
|
147
147
|
* import { Effect } from "effect"
|
|
148
148
|
* const id = Effect.provide(cuid, CuidState.Default)
|
|
149
149
|
* ```
|
|
150
|
-
* @category
|
|
150
|
+
* @category ID generation
|
|
151
151
|
* @since 1.0.0
|
|
152
152
|
*/
|
|
153
153
|
export declare const cuid: Effect.Effect<Cuid, never, CuidState>;
|
package/dist/Cuid.js
CHANGED
|
@@ -22,7 +22,7 @@ const INITIAL_COUNT_MAX = 476782367;
|
|
|
22
22
|
* const id = Cuid.make("a00000000000000000000000")
|
|
23
23
|
* ```
|
|
24
24
|
* See [Effect Schema](https://effect.website/docs/schema/introduction/).
|
|
25
|
-
* @category
|
|
25
|
+
* @category ID schemas
|
|
26
26
|
* @since 1.0.0
|
|
27
27
|
*/
|
|
28
28
|
export const Cuid = Schema.String.pipe(Schema.check(Schema.isPattern(/^[a-z][0-9a-z]{23}$/)), Schema.brand("@typed/id/CUID"));
|
|
@@ -38,7 +38,7 @@ export const Cuid = Schema.String.pipe(Schema.check(Schema.isPattern(/^[a-z][0-9
|
|
|
38
38
|
* import { isCuid } from "@typed/id/Cuid"
|
|
39
39
|
* isCuid("a00000000000000000000000")
|
|
40
40
|
* ```
|
|
41
|
-
* @category
|
|
41
|
+
* @category ID validation
|
|
42
42
|
* @since 1.0.0
|
|
43
43
|
*/
|
|
44
44
|
export const isCuid = Schema.is(Cuid);
|
|
@@ -56,7 +56,7 @@ export const isCuid = Schema.is(Cuid);
|
|
|
56
56
|
* const program = Effect.provide(cuid, CuidState.Default)
|
|
57
57
|
* ```
|
|
58
58
|
* See [Effect services](https://effect.website/docs/requirements-management/services/) and [Layers](https://effect.website/docs/requirements-management/layers/).
|
|
59
|
-
* @category
|
|
59
|
+
* @category Sequence state
|
|
60
60
|
* @since 1.0.0
|
|
61
61
|
*/
|
|
62
62
|
export class CuidState extends Context.Service()("@typed/id/CuidState", {
|
|
@@ -106,7 +106,7 @@ export class CuidState extends Context.Service()("@typed/id/CuidState", {
|
|
|
106
106
|
* The explicit Layer gives production code a standard service while keeping test and environment-specific alternatives replaceable.
|
|
107
107
|
* ## Ownership and lifetime
|
|
108
108
|
* Layer acquisition creates one counter state; the surrounding Layer Scope owns it. Web Crypto must be available in the runtime.
|
|
109
|
-
* @category
|
|
109
|
+
* @category Production layers
|
|
110
110
|
* @since 1.0.0
|
|
111
111
|
*/
|
|
112
112
|
static Default = Layer.effect(CuidState, CuidState.make("node")).pipe(Layer.provide([DateTimes.Default, RandomValues.Default]));
|
|
@@ -124,7 +124,7 @@ export class CuidState extends Context.Service()("@typed/id/CuidState", {
|
|
|
124
124
|
* import { Effect } from "effect"
|
|
125
125
|
* const id = Effect.provide(cuid, CuidState.Default)
|
|
126
126
|
* ```
|
|
127
|
-
* @category
|
|
127
|
+
* @category ID generation
|
|
128
128
|
* @since 1.0.0
|
|
129
129
|
*/
|
|
130
130
|
export const cuid = Effect.flatMap(CuidState.next, cuidFromSeed);
|
package/dist/DateTimes.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ declare const DateTimes_base: Context.ServiceClass<DateTimes, "@typed/id/DateTim
|
|
|
25
25
|
* const now = Effect.provide(DateTimes.now, DateTimes.Default)
|
|
26
26
|
* ```
|
|
27
27
|
* See [Effect Clock](https://effect.website/docs/testing/testclock/).
|
|
28
|
-
* @category
|
|
28
|
+
* @category Time services
|
|
29
29
|
* @since 1.0.0
|
|
30
30
|
*/
|
|
31
31
|
export declare class DateTimes extends DateTimes_base {
|
|
@@ -36,7 +36,7 @@ export declare class DateTimes extends DateTimes_base {
|
|
|
36
36
|
* A service-backed read avoids hard-wiring `Date.now` into generators and tests.
|
|
37
37
|
* ## Ownership and lifetime
|
|
38
38
|
* This Effect acquires no resources and uses the DateTimes service for one invocation.
|
|
39
|
-
* @category
|
|
39
|
+
* @category Time services
|
|
40
40
|
* @since 1.0.0
|
|
41
41
|
*/
|
|
42
42
|
static readonly now: Effect.Effect<number, never, DateTimes>;
|
|
@@ -47,7 +47,7 @@ export declare class DateTimes extends DateTimes_base {
|
|
|
47
47
|
* The Date view stays aligned with the same replaceable time source as epoch-millisecond reads.
|
|
48
48
|
* ## Ownership and lifetime
|
|
49
49
|
* This Effect acquires no resources and uses the DateTimes service for one invocation.
|
|
50
|
-
* @category
|
|
50
|
+
* @category Time services
|
|
51
51
|
* @since 1.0.0
|
|
52
52
|
*/
|
|
53
53
|
static readonly date: Effect.Effect<Date, never, DateTimes>;
|
|
@@ -58,7 +58,7 @@ export declare class DateTimes extends DateTimes_base {
|
|
|
58
58
|
* The production default is explicit and replaceable rather than hidden in each generator.
|
|
59
59
|
* ## Ownership and lifetime
|
|
60
60
|
* The surrounding Layer Scope owns the service; reads allocate only their returned Date values.
|
|
61
|
-
* @category
|
|
61
|
+
* @category Time services
|
|
62
62
|
* @since 1.0.0
|
|
63
63
|
*/
|
|
64
64
|
static readonly Default: Layer.Layer<DateTimes, never, never>;
|
|
@@ -74,7 +74,7 @@ export declare class DateTimes extends DateTimes_base {
|
|
|
74
74
|
* import { DateTimes } from "@typed/id/DateTimes"
|
|
75
75
|
* const fixed = DateTimes.Fixed("2026-01-01T00:00:00Z")
|
|
76
76
|
* ```
|
|
77
|
-
* @category
|
|
77
|
+
* @category Time services
|
|
78
78
|
* @since 1.0.0
|
|
79
79
|
*/
|
|
80
80
|
static readonly Fixed: (baseDate: number | string | Date) => Layer.Layer<DateTimes, Cause.IllegalArgumentError, never>;
|
package/dist/DateTimes.js
CHANGED
|
@@ -17,7 +17,7 @@ import * as Context from "effect/Context";
|
|
|
17
17
|
* const now = Effect.provide(DateTimes.now, DateTimes.Default)
|
|
18
18
|
* ```
|
|
19
19
|
* See [Effect Clock](https://effect.website/docs/testing/testclock/).
|
|
20
|
-
* @category
|
|
20
|
+
* @category Time services
|
|
21
21
|
* @since 1.0.0
|
|
22
22
|
*/
|
|
23
23
|
export class DateTimes extends Context.Service()("@typed/id/DateTimes", {
|
|
@@ -33,7 +33,7 @@ export class DateTimes extends Context.Service()("@typed/id/DateTimes", {
|
|
|
33
33
|
* A service-backed read avoids hard-wiring `Date.now` into generators and tests.
|
|
34
34
|
* ## Ownership and lifetime
|
|
35
35
|
* This Effect acquires no resources and uses the DateTimes service for one invocation.
|
|
36
|
-
* @category
|
|
36
|
+
* @category Time services
|
|
37
37
|
* @since 1.0.0
|
|
38
38
|
*/
|
|
39
39
|
static now = Effect.flatMap(DateTimes, ({ now }) => now);
|
|
@@ -44,7 +44,7 @@ export class DateTimes extends Context.Service()("@typed/id/DateTimes", {
|
|
|
44
44
|
* The Date view stays aligned with the same replaceable time source as epoch-millisecond reads.
|
|
45
45
|
* ## Ownership and lifetime
|
|
46
46
|
* This Effect acquires no resources and uses the DateTimes service for one invocation.
|
|
47
|
-
* @category
|
|
47
|
+
* @category Time services
|
|
48
48
|
* @since 1.0.0
|
|
49
49
|
*/
|
|
50
50
|
static date = Effect.flatMap(DateTimes, ({ date }) => date);
|
|
@@ -55,7 +55,7 @@ export class DateTimes extends Context.Service()("@typed/id/DateTimes", {
|
|
|
55
55
|
* The production default is explicit and replaceable rather than hidden in each generator.
|
|
56
56
|
* ## Ownership and lifetime
|
|
57
57
|
* The surrounding Layer Scope owns the service; reads allocate only their returned Date values.
|
|
58
|
-
* @category
|
|
58
|
+
* @category Time services
|
|
59
59
|
* @since 1.0.0
|
|
60
60
|
*/
|
|
61
61
|
static Default = Layer.effect(DateTimes, DateTimes.make);
|
|
@@ -71,7 +71,7 @@ export class DateTimes extends Context.Service()("@typed/id/DateTimes", {
|
|
|
71
71
|
* import { DateTimes } from "@typed/id/DateTimes"
|
|
72
72
|
* const fixed = DateTimes.Fixed("2026-01-01T00:00:00Z")
|
|
73
73
|
* ```
|
|
74
|
-
* @category
|
|
74
|
+
* @category Time services
|
|
75
75
|
* @since 1.0.0
|
|
76
76
|
*/
|
|
77
77
|
static Fixed = (baseDate) => Layer.effect(DateTimes, Effect.gen(function* () {
|
package/dist/Ids.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ import type { Uuid4 } from "./Uuid4.js";
|
|
|
13
13
|
import { type Uuid5, Uuid5Namespace } from "./Uuid5.js";
|
|
14
14
|
import type { Uuid7 } from "./Uuid7.js";
|
|
15
15
|
import { Uuid7State } from "./Uuid7.js";
|
|
16
|
-
import { TestClock } from "effect/testing";
|
|
17
16
|
declare const Ids_base: Context.ServiceClass<Ids, "@typed/id/Ids", {
|
|
18
17
|
cuid: Effect.Effect<string & import("effect/Brand").Brand<"@typed/id/CUID">, never, never>;
|
|
19
18
|
ksuid: Effect.Effect<string & import("effect/Brand").Brand<"@typed/id/KSUID">, Cause.IllegalArgumentError, never>;
|
|
@@ -72,7 +71,7 @@ export declare class Ids extends Ids_base {
|
|
|
72
71
|
* The facade shares the Ids-owned CuidState instead of allocating a new sequence for every call.
|
|
73
72
|
* ## Ownership and lifetime
|
|
74
73
|
* This Effect acquires no resources and uses state owned by the provided Ids Layer.
|
|
75
|
-
* @category
|
|
74
|
+
* @category ID generation
|
|
76
75
|
* @since 1.0.0
|
|
77
76
|
*/
|
|
78
77
|
static readonly cuid: Effect.Effect<Cuid, never, Ids>;
|
|
@@ -83,7 +82,7 @@ export declare class Ids extends Ids_base {
|
|
|
83
82
|
* The facade reuses captured time and entropy while retaining `IllegalArgumentError` for invalid KSUID timestamps.
|
|
84
83
|
* ## Ownership and lifetime
|
|
85
84
|
* This Effect acquires no persistent resource and uses services owned by the provided Ids Layer.
|
|
86
|
-
* @category
|
|
85
|
+
* @category ID generation
|
|
87
86
|
* @since 1.0.0
|
|
88
87
|
*/
|
|
89
88
|
static readonly ksuid: Effect.Effect<Ksuid, Cause.IllegalArgumentError, Ids>;
|
|
@@ -94,7 +93,7 @@ export declare class Ids extends Ids_base {
|
|
|
94
93
|
* The facade makes the selected entropy implementation available through one application dependency.
|
|
95
94
|
* ## Ownership and lifetime
|
|
96
95
|
* This Effect acquires no persistent resource and uses entropy owned by the provided Ids Layer.
|
|
97
|
-
* @category
|
|
96
|
+
* @category ID generation
|
|
98
97
|
* @since 1.0.0
|
|
99
98
|
*/
|
|
100
99
|
static readonly nanoId: Effect.Effect<NanoId, never, Ids>;
|
|
@@ -105,7 +104,7 @@ export declare class Ids extends Ids_base {
|
|
|
105
104
|
* The facade reuses captured time and entropy while retaining `IllegalArgumentError` for invalid 48-bit timestamps.
|
|
106
105
|
* ## Ownership and lifetime
|
|
107
106
|
* This Effect acquires no persistent resource and uses services owned by the provided Ids Layer.
|
|
108
|
-
* @category
|
|
107
|
+
* @category ID generation
|
|
109
108
|
* @since 1.0.0
|
|
110
109
|
*/
|
|
111
110
|
static readonly ulid: Effect.Effect<Ulid, Cause.IllegalArgumentError, Ids>;
|
|
@@ -116,7 +115,7 @@ export declare class Ids extends Ids_base {
|
|
|
116
115
|
* The facade keeps entropy selection replaceable while preserving UUID version and variant semantics.
|
|
117
116
|
* ## Ownership and lifetime
|
|
118
117
|
* This Effect acquires no persistent resource and uses entropy owned by the provided Ids Layer.
|
|
119
|
-
* @category
|
|
118
|
+
* @category ID generation
|
|
120
119
|
* @since 1.0.0
|
|
121
120
|
*/
|
|
122
121
|
static readonly uuid4: Effect.Effect<Uuid4, never, Ids>;
|
|
@@ -133,7 +132,7 @@ export declare class Ids extends Ids_base {
|
|
|
133
132
|
* import { Effect } from "effect"
|
|
134
133
|
* const program = Ids.uuid5.dns("example.com").pipe(Effect.provide(Ids.Default))
|
|
135
134
|
* ```
|
|
136
|
-
* @category
|
|
135
|
+
* @category ID generation
|
|
137
136
|
* @since 1.0.0
|
|
138
137
|
*/
|
|
139
138
|
static readonly uuid5: {
|
|
@@ -157,7 +156,7 @@ export declare class Ids extends Ids_base {
|
|
|
157
156
|
* The facade shares one lazy Uuid7State per Ids Layer, preserving local monotonicity and typed timestamp errors.
|
|
158
157
|
* ## Ownership and lifetime
|
|
159
158
|
* This Effect acquires no resources and uses sequence state owned by the provided Ids Layer.
|
|
160
|
-
* @category
|
|
159
|
+
* @category ID generation
|
|
161
160
|
* @since 1.0.0
|
|
162
161
|
*/
|
|
163
162
|
static readonly uuid7: Effect.Effect<Uuid7, Cause.IllegalArgumentError, Ids>;
|
|
@@ -168,48 +167,10 @@ export declare class Ids extends Ids_base {
|
|
|
168
167
|
* The standard Layer uses system time and Web Crypto while lazily creating sequence state only when CUID or UUIDv7 is first requested.
|
|
169
168
|
* ## Ownership and lifetime
|
|
170
169
|
* The surrounding Layer Scope owns captured services and lazy sequence state; Web Crypto must exist in the runtime.
|
|
171
|
-
* @category
|
|
170
|
+
* @category Production layers
|
|
172
171
|
* @since 1.0.0
|
|
173
172
|
*/
|
|
174
173
|
static readonly Default: Layer.Layer<Ids | DateTimes | RandomValues, never, never>;
|
|
175
|
-
/**
|
|
176
|
-
* Provides deterministic Ids, time, entropy, and TestClock services.
|
|
177
|
-
* @remarks
|
|
178
|
-
* ## Why
|
|
179
|
-
* Reproducible generators make exact sequences testable; the deterministic entropy is for tests and simulations, not security.
|
|
180
|
-
* ## Ownership and lifetime
|
|
181
|
-
* Each Layer construction owns an independent clock, random sequence, and lazy CUID/UUIDv7 state for its Scope.
|
|
182
|
-
* @example
|
|
183
|
-
* ```ts
|
|
184
|
-
* import { Ids } from "@typed/id/Ids"
|
|
185
|
-
* import { Effect } from "effect"
|
|
186
|
-
* const deterministic = Ids.uuid7.pipe(Effect.provide(Ids.Test({ currentTime: 0 })))
|
|
187
|
-
* ```
|
|
188
|
-
* @category Testing
|
|
189
|
-
* @since 1.0.0
|
|
190
|
-
*/
|
|
191
|
-
static readonly Test: (options?: TestOptions) => Layer.Layer<Ids | DateTimes | RandomValues | TestClock.TestClock, Cause.IllegalArgumentError>;
|
|
192
174
|
}
|
|
193
|
-
/**
|
|
194
|
-
* Configuration for the deterministic Ids test Layer.
|
|
195
|
-
* @remarks
|
|
196
|
-
* ## Why
|
|
197
|
-
* Explicit initial time and CUID environment data let tests reproduce generator sequences without ambient process state.
|
|
198
|
-
* ## Ownership and lifetime
|
|
199
|
-
* This plain configuration acquires no resources and is read only by Layer acquisition; TypeScript `readonly` does not freeze it at runtime.
|
|
200
|
-
* @example
|
|
201
|
-
* ```ts
|
|
202
|
-
* import type { TestOptions } from "@typed/id/Ids"
|
|
203
|
-
* const options: TestOptions = { currentTime: "2026-01-01T00:00:00Z", envData: "test-worker" }
|
|
204
|
-
* ```
|
|
205
|
-
* @category Testing
|
|
206
|
-
* @since 1.0.0
|
|
207
|
-
*/
|
|
208
|
-
export type TestOptions = {
|
|
209
|
-
/** Base time passed to `DateTimes.Fixed`; invalid dates fail Layer acquisition. @since 1.0.0 */
|
|
210
|
-
readonly currentTime?: number | string | Date;
|
|
211
|
-
/** CUID caller discriminator used when the test CuidState is created. @since 1.0.0 */
|
|
212
|
-
readonly envData?: string;
|
|
213
|
-
};
|
|
214
175
|
export {};
|
|
215
176
|
//# sourceMappingURL=Ids.d.ts.map
|
package/dist/Ids.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ids.d.ts","sourceRoot":"","sources":["../src/Ids.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Ids.d.ts","sourceRoot":"","sources":["../src/Ids.ts"],"names":[],"mappings":"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"}
|
package/dist/Ids.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as Effect from "effect/Effect";
|
|
2
2
|
import { dual } from "effect/Function";
|
|
3
3
|
import * as Layer from "effect/Layer";
|
|
4
|
-
import * as Random from "effect/Random";
|
|
5
4
|
import * as Context from "effect/Context";
|
|
6
|
-
import { cuid
|
|
5
|
+
import { cuid } from "./Cuid.js";
|
|
7
6
|
import { DateTimes } from "./DateTimes.js";
|
|
8
7
|
import { ksuid } from "./Ksuid.js";
|
|
9
8
|
import { nanoId } from "./NanoId.js";
|
|
@@ -11,9 +10,8 @@ import { RandomValues } from "./RandomValues.js";
|
|
|
11
10
|
import { ulid } from "./Ulid.js";
|
|
12
11
|
import { uuid4 } from "./Uuid4.js";
|
|
13
12
|
import { uuid5, Uuid5Namespace } from "./Uuid5.js";
|
|
14
|
-
import { uuid7
|
|
15
|
-
import {
|
|
16
|
-
const testRandomValues = () => Layer.effect(RandomValues, RandomValues.pipe(Effect.provide(RandomValues.Random), Random.withSeed("@typed/id/Ids.Test")));
|
|
13
|
+
import { uuid7 } from "./Uuid7.js";
|
|
14
|
+
import { makeLazyIds } from "./internal/Ids.js";
|
|
17
15
|
/**
|
|
18
16
|
* Unified Effect service for every Typed ID generator.
|
|
19
17
|
* @remarks
|
|
@@ -58,7 +56,7 @@ export class Ids extends Context.Service()("@typed/id/Ids", {
|
|
|
58
56
|
* The facade shares the Ids-owned CuidState instead of allocating a new sequence for every call.
|
|
59
57
|
* ## Ownership and lifetime
|
|
60
58
|
* This Effect acquires no resources and uses state owned by the provided Ids Layer.
|
|
61
|
-
* @category
|
|
59
|
+
* @category ID generation
|
|
62
60
|
* @since 1.0.0
|
|
63
61
|
*/
|
|
64
62
|
static cuid = Effect.flatMap(Ids, ({ cuid }) => cuid);
|
|
@@ -69,7 +67,7 @@ export class Ids extends Context.Service()("@typed/id/Ids", {
|
|
|
69
67
|
* The facade reuses captured time and entropy while retaining `IllegalArgumentError` for invalid KSUID timestamps.
|
|
70
68
|
* ## Ownership and lifetime
|
|
71
69
|
* This Effect acquires no persistent resource and uses services owned by the provided Ids Layer.
|
|
72
|
-
* @category
|
|
70
|
+
* @category ID generation
|
|
73
71
|
* @since 1.0.0
|
|
74
72
|
*/
|
|
75
73
|
static ksuid = Effect.flatMap(Ids, ({ ksuid }) => ksuid);
|
|
@@ -80,7 +78,7 @@ export class Ids extends Context.Service()("@typed/id/Ids", {
|
|
|
80
78
|
* The facade makes the selected entropy implementation available through one application dependency.
|
|
81
79
|
* ## Ownership and lifetime
|
|
82
80
|
* This Effect acquires no persistent resource and uses entropy owned by the provided Ids Layer.
|
|
83
|
-
* @category
|
|
81
|
+
* @category ID generation
|
|
84
82
|
* @since 1.0.0
|
|
85
83
|
*/
|
|
86
84
|
static nanoId = Effect.flatMap(Ids, ({ nanoId }) => nanoId);
|
|
@@ -91,7 +89,7 @@ export class Ids extends Context.Service()("@typed/id/Ids", {
|
|
|
91
89
|
* The facade reuses captured time and entropy while retaining `IllegalArgumentError` for invalid 48-bit timestamps.
|
|
92
90
|
* ## Ownership and lifetime
|
|
93
91
|
* This Effect acquires no persistent resource and uses services owned by the provided Ids Layer.
|
|
94
|
-
* @category
|
|
92
|
+
* @category ID generation
|
|
95
93
|
* @since 1.0.0
|
|
96
94
|
*/
|
|
97
95
|
static ulid = Effect.flatMap(Ids, ({ ulid }) => ulid);
|
|
@@ -102,7 +100,7 @@ export class Ids extends Context.Service()("@typed/id/Ids", {
|
|
|
102
100
|
* The facade keeps entropy selection replaceable while preserving UUID version and variant semantics.
|
|
103
101
|
* ## Ownership and lifetime
|
|
104
102
|
* This Effect acquires no persistent resource and uses entropy owned by the provided Ids Layer.
|
|
105
|
-
* @category
|
|
103
|
+
* @category ID generation
|
|
106
104
|
* @since 1.0.0
|
|
107
105
|
*/
|
|
108
106
|
static uuid4 = Effect.flatMap(Ids, ({ uuid4 }) => uuid4);
|
|
@@ -119,7 +117,7 @@ export class Ids extends Context.Service()("@typed/id/Ids", {
|
|
|
119
117
|
* import { Effect } from "effect"
|
|
120
118
|
* const program = Ids.uuid5.dns("example.com").pipe(Effect.provide(Ids.Default))
|
|
121
119
|
* ```
|
|
122
|
-
* @category
|
|
120
|
+
* @category ID generation
|
|
123
121
|
* @since 1.0.0
|
|
124
122
|
*/
|
|
125
123
|
static uuid5 = Object.assign(dual(2, (name, namespace) => Effect.flatMap(Ids, ({ uuid5 }) => uuid5(name, namespace))), {
|
|
@@ -135,7 +133,7 @@ export class Ids extends Context.Service()("@typed/id/Ids", {
|
|
|
135
133
|
* The facade shares one lazy Uuid7State per Ids Layer, preserving local monotonicity and typed timestamp errors.
|
|
136
134
|
* ## Ownership and lifetime
|
|
137
135
|
* This Effect acquires no resources and uses sequence state owned by the provided Ids Layer.
|
|
138
|
-
* @category
|
|
136
|
+
* @category ID generation
|
|
139
137
|
* @since 1.0.0
|
|
140
138
|
*/
|
|
141
139
|
static uuid7 = Effect.flatMap(Ids, ({ uuid7 }) => uuid7);
|
|
@@ -146,50 +144,8 @@ export class Ids extends Context.Service()("@typed/id/Ids", {
|
|
|
146
144
|
* The standard Layer uses system time and Web Crypto while lazily creating sequence state only when CUID or UUIDv7 is first requested.
|
|
147
145
|
* ## Ownership and lifetime
|
|
148
146
|
* The surrounding Layer Scope owns captured services and lazy sequence state; Web Crypto must exist in the runtime.
|
|
149
|
-
* @category
|
|
147
|
+
* @category Production layers
|
|
150
148
|
* @since 1.0.0
|
|
151
149
|
*/
|
|
152
150
|
static Default = Layer.effect(Ids, makeLazyIds("node")).pipe(Layer.provideMerge([DateTimes.Default, RandomValues.Default]));
|
|
153
|
-
/**
|
|
154
|
-
* Provides deterministic Ids, time, entropy, and TestClock services.
|
|
155
|
-
* @remarks
|
|
156
|
-
* ## Why
|
|
157
|
-
* Reproducible generators make exact sequences testable; the deterministic entropy is for tests and simulations, not security.
|
|
158
|
-
* ## Ownership and lifetime
|
|
159
|
-
* Each Layer construction owns an independent clock, random sequence, and lazy CUID/UUIDv7 state for its Scope.
|
|
160
|
-
* @example
|
|
161
|
-
* ```ts
|
|
162
|
-
* import { Ids } from "@typed/id/Ids"
|
|
163
|
-
* import { Effect } from "effect"
|
|
164
|
-
* const deterministic = Ids.uuid7.pipe(Effect.provide(Ids.Test({ currentTime: 0 })))
|
|
165
|
-
* ```
|
|
166
|
-
* @category Testing
|
|
167
|
-
* @since 1.0.0
|
|
168
|
-
*/
|
|
169
|
-
static Test = (options = {}) => {
|
|
170
|
-
const services = Layer.mergeAll(DateTimes.Fixed(options.currentTime ?? 1400000000000), testRandomValues());
|
|
171
|
-
return Layer.effect(Ids, makeLazyIds(options.envData ?? "node")).pipe(Layer.provide(services), Layer.provideMerge(services), Layer.provideMerge(TestClock.layer({})));
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
function makeLazyIds(envData) {
|
|
175
|
-
return Effect.gen(function* () {
|
|
176
|
-
const services = yield* Effect.context();
|
|
177
|
-
const getCuidState = yield* Effect.cached(Effect.provide(CuidState.make(envData), services));
|
|
178
|
-
const getUuid7State = yield* Effect.cached(Effect.provide(Uuid7State.make, services));
|
|
179
|
-
const uuid5_ = Object.assign(dual(2, (name, namespace) => Effect.provide(uuid5(name, namespace), services)), {
|
|
180
|
-
dns: uuid5(Uuid5Namespace.DNS),
|
|
181
|
-
url: uuid5(Uuid5Namespace.URL),
|
|
182
|
-
oid: uuid5(Uuid5Namespace.OID),
|
|
183
|
-
x500: uuid5(Uuid5Namespace.X500),
|
|
184
|
-
});
|
|
185
|
-
return {
|
|
186
|
-
cuid: Effect.flatMap(getCuidState, (state) => Effect.provideService(cuid, CuidState, state)),
|
|
187
|
-
ksuid: Effect.provide(ksuid, services),
|
|
188
|
-
nanoId: Effect.provide(nanoId, services),
|
|
189
|
-
ulid: Effect.provide(ulid, services),
|
|
190
|
-
uuid4: Effect.provide(uuid4, services),
|
|
191
|
-
uuid5: uuid5_,
|
|
192
|
-
uuid7: Effect.flatMap(getUuid7State, (state) => Effect.provideService(uuid7, Uuid7State, state)),
|
|
193
|
-
};
|
|
194
|
-
});
|
|
195
151
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as Cause from "effect/Cause";
|
|
2
|
+
import * as Layer from "effect/Layer";
|
|
3
|
+
import * as TestClock from "effect/testing/TestClock";
|
|
4
|
+
import { DateTimes } from "./DateTimes.js";
|
|
5
|
+
import { Ids } from "./Ids.js";
|
|
6
|
+
import { RandomValues } from "./RandomValues.js";
|
|
7
|
+
import { Uuid7State } from "./Uuid7.js";
|
|
8
|
+
/**
|
|
9
|
+
* Provides deterministic IDs, time, entropy, and TestClock services.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* This test-only entry point keeps Effect's testing runtime out of production imports of `Ids`.
|
|
13
|
+
* Each invocation owns an independent clock, random sequence, and lazy CUID/UUIDv7 state.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { Ids } from "@typed/id/Ids"
|
|
18
|
+
* import { IdsTest } from "@typed/id/IdsTest"
|
|
19
|
+
* import { Effect } from "effect"
|
|
20
|
+
* const deterministic = Ids.uuid7.pipe(Effect.provide(IdsTest({ currentTime: 0 })))
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @category Deterministic testing
|
|
24
|
+
* @since 1.0.0
|
|
25
|
+
*/
|
|
26
|
+
export declare const IdsTest: (options?: IdsTestOptions) => Layer.Layer<Ids | DateTimes | RandomValues | Uuid7State | TestClock.TestClock, Cause.IllegalArgumentError>;
|
|
27
|
+
/** Configuration for the deterministic ID test layer. @since 1.0.0 */
|
|
28
|
+
export type IdsTestOptions = {
|
|
29
|
+
/** Fixed generator time; invalid dates fail Layer acquisition. @since 1.0.0 */
|
|
30
|
+
readonly currentTime?: number | string | Date;
|
|
31
|
+
/** CUID caller discriminator used when the test CuidState is created. @since 1.0.0 */
|
|
32
|
+
readonly envData?: string;
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=IdsTest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IdsTest.d.ts","sourceRoot":"","sources":["../src/IdsTest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,SAAS,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAyBxC;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,OAAO,aACT,cAAc,KACtB,KAAK,CAAC,KAAK,CACZ,GAAG,GAAG,SAAS,GAAG,YAAY,GAAG,UAAU,GAAG,SAAS,CAAC,SAAS,EACjE,KAAK,CAAC,oBAAoB,CAe3B,CAAC;AAEF,sEAAsE;AACtE,MAAM,MAAM,cAAc,GAAG;IAC3B,+EAA+E;IAC/E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC9C,sFAAsF;IACtF,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC"}
|
package/dist/IdsTest.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as Cause from "effect/Cause";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
import * as Random from "effect/Random";
|
|
5
|
+
import * as TestClock from "effect/testing/TestClock";
|
|
6
|
+
import { DateTimes } from "./DateTimes.js";
|
|
7
|
+
import { Ids } from "./Ids.js";
|
|
8
|
+
import { makeLazyIds } from "./internal/Ids.js";
|
|
9
|
+
import { RandomValues } from "./RandomValues.js";
|
|
10
|
+
import { Uuid7State } from "./Uuid7.js";
|
|
11
|
+
const testRandomValues = () => Layer.effect(RandomValues, RandomValues.pipe(Effect.provide(RandomValues.Random), Random.withSeed("@typed/id/IdsTest")));
|
|
12
|
+
const fixedDateTimes = (baseDate) => Layer.effect(DateTimes, Effect.gen(function* () {
|
|
13
|
+
const millis = new Date(baseDate).getTime();
|
|
14
|
+
if (!Number.isFinite(millis)) {
|
|
15
|
+
return yield* new Cause.IllegalArgumentError(`Invalid base date: ${String(baseDate)}`);
|
|
16
|
+
}
|
|
17
|
+
return DateTimes.of({
|
|
18
|
+
now: Effect.succeed(millis),
|
|
19
|
+
date: Effect.sync(() => new Date(millis)),
|
|
20
|
+
});
|
|
21
|
+
}));
|
|
22
|
+
/**
|
|
23
|
+
* Provides deterministic IDs, time, entropy, and TestClock services.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* This test-only entry point keeps Effect's testing runtime out of production imports of `Ids`.
|
|
27
|
+
* Each invocation owns an independent clock, random sequence, and lazy CUID/UUIDv7 state.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import { Ids } from "@typed/id/Ids"
|
|
32
|
+
* import { IdsTest } from "@typed/id/IdsTest"
|
|
33
|
+
* import { Effect } from "effect"
|
|
34
|
+
* const deterministic = Ids.uuid7.pipe(Effect.provide(IdsTest({ currentTime: 0 })))
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @category Deterministic testing
|
|
38
|
+
* @since 1.0.0
|
|
39
|
+
*/
|
|
40
|
+
export const IdsTest = (options = {}) => {
|
|
41
|
+
const services = Layer.mergeAll(fixedDateTimes(options.currentTime ?? 1400000000000), testRandomValues());
|
|
42
|
+
const uuid7State = Layer.effect(Uuid7State, Uuid7State.make).pipe(Layer.provide(services));
|
|
43
|
+
return Layer.effect(Ids, makeLazyIds(options.envData ?? "node")).pipe(Layer.provide(services), Layer.provideMerge(services), Layer.provideMerge(TestClock.layer({})), Layer.provideMerge(uuid7State));
|
|
44
|
+
};
|
package/dist/Ksuid.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ import { RandomValues } from "./RandomValues.js";
|
|
|
16
16
|
* import { Schema } from "effect"
|
|
17
17
|
* const id = Schema.decodeUnknownSync(Ksuid)("0ujtsYcgvSTl8PAuAdqWYSMnLOv")
|
|
18
18
|
* ```
|
|
19
|
-
* @category
|
|
19
|
+
* @category ID schemas
|
|
20
20
|
* @since 1.0.0
|
|
21
21
|
*/
|
|
22
22
|
export declare const Ksuid: Schema.brand<Schema.String, "@typed/id/KSUID">;
|
|
@@ -33,7 +33,7 @@ export type Ksuid = typeof Ksuid.Type;
|
|
|
33
33
|
* import { isKsuid } from "@typed/id/Ksuid"
|
|
34
34
|
* isKsuid("0ujtsYcgvSTl8PAuAdqWYSMnLOv")
|
|
35
35
|
* ```
|
|
36
|
-
* @category
|
|
36
|
+
* @category ID validation
|
|
37
37
|
* @since 1.0.0
|
|
38
38
|
*/
|
|
39
39
|
export declare const isKsuid: (value: string) => value is Ksuid;
|
|
@@ -52,7 +52,7 @@ export declare const isKsuid: (value: string) => value is Ksuid;
|
|
|
52
52
|
* import { Effect, Layer } from "effect"
|
|
53
53
|
* const id = Effect.provide(ksuid, Layer.merge(DateTimes.Default, RandomValues.Default))
|
|
54
54
|
* ```
|
|
55
|
-
* @category
|
|
55
|
+
* @category ID generation
|
|
56
56
|
* @since 1.0.0
|
|
57
57
|
*/
|
|
58
58
|
export declare const ksuid: Effect.Effect<Ksuid, Cause.IllegalArgumentError, DateTimes | RandomValues>;
|
package/dist/Ksuid.js
CHANGED
|
@@ -24,7 +24,7 @@ const STRING_LENGTH = 27;
|
|
|
24
24
|
* import { Schema } from "effect"
|
|
25
25
|
* const id = Schema.decodeUnknownSync(Ksuid)("0ujtsYcgvSTl8PAuAdqWYSMnLOv")
|
|
26
26
|
* ```
|
|
27
|
-
* @category
|
|
27
|
+
* @category ID schemas
|
|
28
28
|
* @since 1.0.0
|
|
29
29
|
*/
|
|
30
30
|
export const Ksuid = Schema.String.pipe(Schema.check(Schema.isPattern(/^[0-9A-Za-z]{27}$/)), Schema.brand("@typed/id/KSUID"));
|
|
@@ -40,7 +40,7 @@ export const Ksuid = Schema.String.pipe(Schema.check(Schema.isPattern(/^[0-9A-Za
|
|
|
40
40
|
* import { isKsuid } from "@typed/id/Ksuid"
|
|
41
41
|
* isKsuid("0ujtsYcgvSTl8PAuAdqWYSMnLOv")
|
|
42
42
|
* ```
|
|
43
|
-
* @category
|
|
43
|
+
* @category ID validation
|
|
44
44
|
* @since 1.0.0
|
|
45
45
|
*/
|
|
46
46
|
export const isKsuid = Schema.is(Ksuid);
|
|
@@ -60,7 +60,7 @@ export const isKsuid = Schema.is(Ksuid);
|
|
|
60
60
|
* import { Effect, Layer } from "effect"
|
|
61
61
|
* const id = Effect.provide(ksuid, Layer.merge(DateTimes.Default, RandomValues.Default))
|
|
62
62
|
* ```
|
|
63
|
-
* @category
|
|
63
|
+
* @category ID generation
|
|
64
64
|
* @since 1.0.0
|
|
65
65
|
*/
|
|
66
66
|
export const ksuid = Effect.gen(function* () {
|
package/dist/NanoId.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { RandomValues } from "./RandomValues.js";
|
|
|
13
13
|
* import { NanoId } from "@typed/id/NanoId"
|
|
14
14
|
* const id = NanoId.make("V1StGXR8_Z5jdHi6B-myT")
|
|
15
15
|
* ```
|
|
16
|
-
* @category
|
|
16
|
+
* @category ID schemas
|
|
17
17
|
* @since 1.0.0
|
|
18
18
|
*/
|
|
19
19
|
export declare const NanoId: Schema.brand<Schema.String, "@typed/id/NanoId">;
|
|
@@ -30,7 +30,7 @@ export type NanoId = typeof NanoId.Type;
|
|
|
30
30
|
* import { isNanoId } from "@typed/id/NanoId"
|
|
31
31
|
* isNanoId("V1StGXR8_Z5jdHi6B-myT")
|
|
32
32
|
* ```
|
|
33
|
-
* @category
|
|
33
|
+
* @category ID validation
|
|
34
34
|
* @since 1.0.0
|
|
35
35
|
*/
|
|
36
36
|
export declare const isNanoId: (value: string) => value is NanoId;
|
|
@@ -48,7 +48,7 @@ export declare const isNanoId: (value: string) => value is NanoId;
|
|
|
48
48
|
* import { Effect } from "effect"
|
|
49
49
|
* const id = Effect.provide(nanoId, RandomValues.Default)
|
|
50
50
|
* ```
|
|
51
|
-
* @category
|
|
51
|
+
* @category ID generation
|
|
52
52
|
* @since 1.0.0
|
|
53
53
|
*/
|
|
54
54
|
export declare const nanoId: Effect.Effect<NanoId, never, RandomValues>;
|
package/dist/NanoId.js
CHANGED
|
@@ -13,7 +13,7 @@ import { RandomValues } from "./RandomValues.js";
|
|
|
13
13
|
* import { NanoId } from "@typed/id/NanoId"
|
|
14
14
|
* const id = NanoId.make("V1StGXR8_Z5jdHi6B-myT")
|
|
15
15
|
* ```
|
|
16
|
-
* @category
|
|
16
|
+
* @category ID schemas
|
|
17
17
|
* @since 1.0.0
|
|
18
18
|
*/
|
|
19
19
|
export const NanoId = Schema.String.pipe(Schema.check(Schema.isPattern(/^[0-9a-zA-Z_-]+$/)), Schema.brand("@typed/id/NanoId"));
|
|
@@ -29,7 +29,7 @@ export const NanoId = Schema.String.pipe(Schema.check(Schema.isPattern(/^[0-9a-z
|
|
|
29
29
|
* import { isNanoId } from "@typed/id/NanoId"
|
|
30
30
|
* isNanoId("V1StGXR8_Z5jdHi6B-myT")
|
|
31
31
|
* ```
|
|
32
|
-
* @category
|
|
32
|
+
* @category ID validation
|
|
33
33
|
* @since 1.0.0
|
|
34
34
|
*/
|
|
35
35
|
export const isNanoId = Schema.is(NanoId);
|
|
@@ -47,7 +47,7 @@ export const isNanoId = Schema.is(NanoId);
|
|
|
47
47
|
* import { Effect } from "effect"
|
|
48
48
|
* const id = Effect.provide(nanoId, RandomValues.Default)
|
|
49
49
|
* ```
|
|
50
|
-
* @category
|
|
50
|
+
* @category ID generation
|
|
51
51
|
* @since 1.0.0
|
|
52
52
|
*/
|
|
53
53
|
export const nanoId = Effect.map(RandomValues.call(21), (seed) => NanoId.make(Array.from(seed, numToCharacter).join("")));
|
package/dist/RandomValues.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ declare const RandomValues_base: Context.ServiceClass<RandomValues, "@typed/id/R
|
|
|
22
22
|
* import { Effect } from "effect"
|
|
23
23
|
* const bytes = Effect.provide(RandomValues.call(16), RandomValues.Default)
|
|
24
24
|
* ```
|
|
25
|
-
* @category
|
|
25
|
+
* @category Entropy services
|
|
26
26
|
* @since 1.0.0
|
|
27
27
|
*/
|
|
28
28
|
export declare class RandomValues extends RandomValues_base {
|
|
@@ -39,7 +39,7 @@ export declare class RandomValues extends RandomValues_base {
|
|
|
39
39
|
* import { Effect } from "effect"
|
|
40
40
|
* const bytes = RandomValues.call(32).pipe(Effect.provide(RandomValues.Default))
|
|
41
41
|
* ```
|
|
42
|
-
* @category
|
|
42
|
+
* @category Entropy services
|
|
43
43
|
* @since 1.0.0
|
|
44
44
|
*/
|
|
45
45
|
static readonly call: <const N extends number>(length: N) => Effect.Effect<Uint8Array & {
|
|
@@ -52,7 +52,7 @@ export declare class RandomValues extends RandomValues_base {
|
|
|
52
52
|
* Production IDs need platform entropy. Missing `globalThis.crypto.getRandomValues` and platform exceptions are Effect defects, not typed errors, rather than silently weakening randomness.
|
|
53
53
|
* ## Ownership and lifetime
|
|
54
54
|
* The Layer owns no mutable generator state; each request returns a fresh buffer. The runtime must provide Web Crypto or the request defects.
|
|
55
|
-
* @category
|
|
55
|
+
* @category Entropy layers
|
|
56
56
|
* @since 1.0.0
|
|
57
57
|
*/
|
|
58
58
|
static readonly Default: Layer.Layer<RandomValues, never, never>;
|
|
@@ -63,7 +63,7 @@ export declare class RandomValues extends RandomValues_base {
|
|
|
63
63
|
* Deterministic tests and simulations need replaceable entropy; this Layer is not cryptographically secure.
|
|
64
64
|
* ## Ownership and lifetime
|
|
65
65
|
* The provided Effect Random service owns sequence state for the Layer lifetime; each request returns a fresh buffer.
|
|
66
|
-
* @category
|
|
66
|
+
* @category Entropy layers
|
|
67
67
|
* @since 1.0.0
|
|
68
68
|
*/
|
|
69
69
|
static readonly Random: Layer.Layer<RandomValues, never, never>;
|
package/dist/RandomValues.js
CHANGED
|
@@ -32,7 +32,7 @@ const fromRandom = (random) => RandomValues.of((length) => Effect.sync(() => all
|
|
|
32
32
|
* import { Effect } from "effect"
|
|
33
33
|
* const bytes = Effect.provide(RandomValues.call(16), RandomValues.Default)
|
|
34
34
|
* ```
|
|
35
|
-
* @category
|
|
35
|
+
* @category Entropy services
|
|
36
36
|
* @since 1.0.0
|
|
37
37
|
*/
|
|
38
38
|
export class RandomValues extends Context.Service()("@typed/id/RandomValues", {
|
|
@@ -51,7 +51,7 @@ export class RandomValues extends Context.Service()("@typed/id/RandomValues", {
|
|
|
51
51
|
* import { Effect } from "effect"
|
|
52
52
|
* const bytes = RandomValues.call(32).pipe(Effect.provide(RandomValues.Default))
|
|
53
53
|
* ```
|
|
54
|
-
* @category
|
|
54
|
+
* @category Entropy services
|
|
55
55
|
* @since 1.0.0
|
|
56
56
|
*/
|
|
57
57
|
static call = (length) => RandomValues.pipe(Effect.flatMap((randomValues) => randomValues(length)));
|
|
@@ -62,7 +62,7 @@ export class RandomValues extends Context.Service()("@typed/id/RandomValues", {
|
|
|
62
62
|
* Production IDs need platform entropy. Missing `globalThis.crypto.getRandomValues` and platform exceptions are Effect defects, not typed errors, rather than silently weakening randomness.
|
|
63
63
|
* ## Ownership and lifetime
|
|
64
64
|
* The Layer owns no mutable generator state; each request returns a fresh buffer. The runtime must provide Web Crypto or the request defects.
|
|
65
|
-
* @category
|
|
65
|
+
* @category Entropy layers
|
|
66
66
|
* @since 1.0.0
|
|
67
67
|
*/
|
|
68
68
|
static Default = Layer.effect(RandomValues, RandomValues.make);
|
|
@@ -73,7 +73,7 @@ export class RandomValues extends Context.Service()("@typed/id/RandomValues", {
|
|
|
73
73
|
* Deterministic tests and simulations need replaceable entropy; this Layer is not cryptographically secure.
|
|
74
74
|
* ## Ownership and lifetime
|
|
75
75
|
* The provided Effect Random service owns sequence state for the Layer lifetime; each request returns a fresh buffer.
|
|
76
|
-
* @category
|
|
76
|
+
* @category Entropy layers
|
|
77
77
|
* @since 1.0.0
|
|
78
78
|
*/
|
|
79
79
|
static Random = Layer.effect(RandomValues, Effect.gen(function* () {
|
package/dist/Ulid.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ import { RandomValues } from "./RandomValues.js";
|
|
|
15
15
|
* import { Ulid } from "@typed/id/Ulid"
|
|
16
16
|
* const id = Ulid.make("01ARZ3NDEKTSV4RRFFQ69G5FAV")
|
|
17
17
|
* ```
|
|
18
|
-
* @category
|
|
18
|
+
* @category ID schemas
|
|
19
19
|
* @since 1.0.0
|
|
20
20
|
*/
|
|
21
21
|
export declare const Ulid: Schema.brand<Schema.String, "@typed/id/ULID">;
|
|
@@ -32,7 +32,7 @@ export type Ulid = typeof Ulid.Type;
|
|
|
32
32
|
* import { isUlid } from "@typed/id/Ulid"
|
|
33
33
|
* isUlid("01ARZ3NDEKTSV4RRFFQ69G5FAV")
|
|
34
34
|
* ```
|
|
35
|
-
* @category
|
|
35
|
+
* @category ID validation
|
|
36
36
|
* @since 1.0.0
|
|
37
37
|
*/
|
|
38
38
|
export declare const isUlid: (value: string) => value is Ulid;
|
|
@@ -50,7 +50,7 @@ export declare const isUlid: (value: string) => value is Ulid;
|
|
|
50
50
|
* import { Effect } from "effect"
|
|
51
51
|
* const id = Effect.provide(ulid, Ids.Default)
|
|
52
52
|
* ```
|
|
53
|
-
* @category
|
|
53
|
+
* @category ID generation
|
|
54
54
|
* @since 1.0.0
|
|
55
55
|
*/
|
|
56
56
|
export declare const ulid: Effect.Effect<Ulid, Cause.IllegalArgumentError, RandomValues | DateTimes>;
|
package/dist/Ulid.js
CHANGED
|
@@ -15,7 +15,7 @@ import { RandomValues } from "./RandomValues.js";
|
|
|
15
15
|
* import { Ulid } from "@typed/id/Ulid"
|
|
16
16
|
* const id = Ulid.make("01ARZ3NDEKTSV4RRFFQ69G5FAV")
|
|
17
17
|
* ```
|
|
18
|
-
* @category
|
|
18
|
+
* @category ID schemas
|
|
19
19
|
* @since 1.0.0
|
|
20
20
|
*/
|
|
21
21
|
export const Ulid = Schema.String.pipe(Schema.check(Schema.isULID()), Schema.brand("@typed/id/ULID"));
|
|
@@ -31,7 +31,7 @@ export const Ulid = Schema.String.pipe(Schema.check(Schema.isULID()), Schema.bra
|
|
|
31
31
|
* import { isUlid } from "@typed/id/Ulid"
|
|
32
32
|
* isUlid("01ARZ3NDEKTSV4RRFFQ69G5FAV")
|
|
33
33
|
* ```
|
|
34
|
-
* @category
|
|
34
|
+
* @category ID validation
|
|
35
35
|
* @since 1.0.0
|
|
36
36
|
*/
|
|
37
37
|
export const isUlid = Schema.is(Ulid);
|
|
@@ -55,7 +55,7 @@ const RANDOM_LEN = 16;
|
|
|
55
55
|
* import { Effect } from "effect"
|
|
56
56
|
* const id = Effect.provide(ulid, Ids.Default)
|
|
57
57
|
* ```
|
|
58
|
-
* @category
|
|
58
|
+
* @category ID generation
|
|
59
59
|
* @since 1.0.0
|
|
60
60
|
*/
|
|
61
61
|
export const ulid = Effect.gen(function* () {
|
package/dist/Uuid4.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { RandomValues } from "./RandomValues.js";
|
|
|
13
13
|
* import { Uuid4 } from "@typed/id/Uuid4"
|
|
14
14
|
* const id = Uuid4.make("550e8400-e29b-41d4-a716-446655440000")
|
|
15
15
|
* ```
|
|
16
|
-
* @category
|
|
16
|
+
* @category ID schemas
|
|
17
17
|
* @since 1.0.0
|
|
18
18
|
*/
|
|
19
19
|
export declare const Uuid4: Schema.brand<Schema.String, "@typed/id/UUID4">;
|
|
@@ -30,7 +30,7 @@ export type Uuid4 = typeof Uuid4.Type;
|
|
|
30
30
|
* import { isUuid4 } from "@typed/id/Uuid4"
|
|
31
31
|
* isUuid4("550e8400-e29b-41d4-a716-446655440000")
|
|
32
32
|
* ```
|
|
33
|
-
* @category
|
|
33
|
+
* @category ID validation
|
|
34
34
|
* @since 1.0.0
|
|
35
35
|
*/
|
|
36
36
|
export declare const isUuid4: (value: string) => value is Uuid4;
|
|
@@ -48,7 +48,7 @@ export declare const isUuid4: (value: string) => value is Uuid4;
|
|
|
48
48
|
* import { Effect } from "effect"
|
|
49
49
|
* const id = Effect.provide(uuid4, RandomValues.Default)
|
|
50
50
|
* ```
|
|
51
|
-
* @category
|
|
51
|
+
* @category ID generation
|
|
52
52
|
* @since 1.0.0
|
|
53
53
|
*/
|
|
54
54
|
export declare const uuid4: Effect.Effect<Uuid4, never, RandomValues>;
|
package/dist/Uuid4.js
CHANGED
|
@@ -14,7 +14,7 @@ import { RandomValues } from "./RandomValues.js";
|
|
|
14
14
|
* import { Uuid4 } from "@typed/id/Uuid4"
|
|
15
15
|
* const id = Uuid4.make("550e8400-e29b-41d4-a716-446655440000")
|
|
16
16
|
* ```
|
|
17
|
-
* @category
|
|
17
|
+
* @category ID schemas
|
|
18
18
|
* @since 1.0.0
|
|
19
19
|
*/
|
|
20
20
|
export const Uuid4 = Schema.String.pipe(Schema.check(Schema.isUUID(4)), Schema.brand("@typed/id/UUID4"));
|
|
@@ -30,7 +30,7 @@ export const Uuid4 = Schema.String.pipe(Schema.check(Schema.isUUID(4)), Schema.b
|
|
|
30
30
|
* import { isUuid4 } from "@typed/id/Uuid4"
|
|
31
31
|
* isUuid4("550e8400-e29b-41d4-a716-446655440000")
|
|
32
32
|
* ```
|
|
33
|
-
* @category
|
|
33
|
+
* @category ID validation
|
|
34
34
|
* @since 1.0.0
|
|
35
35
|
*/
|
|
36
36
|
export const isUuid4 = Schema.is(Uuid4);
|
|
@@ -48,7 +48,7 @@ export const isUuid4 = Schema.is(Uuid4);
|
|
|
48
48
|
* import { Effect } from "effect"
|
|
49
49
|
* const id = Effect.provide(uuid4, RandomValues.Default)
|
|
50
50
|
* ```
|
|
51
|
-
* @category
|
|
51
|
+
* @category ID generation
|
|
52
52
|
* @since 1.0.0
|
|
53
53
|
*/
|
|
54
54
|
export const uuid4 = Effect.map(RandomValues.call(16), (seed) => {
|
package/dist/Uuid5.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ import * as Schema from "effect/Schema";
|
|
|
14
14
|
* import { Schema } from "effect"
|
|
15
15
|
* const id = Schema.decodeUnknownSync(Uuid5)("21f7f8de-8051-5b89-8680-0195ef798b6a")
|
|
16
16
|
* ```
|
|
17
|
-
* @category
|
|
17
|
+
* @category ID schemas
|
|
18
18
|
* @since 1.0.0
|
|
19
19
|
*/
|
|
20
20
|
export declare const Uuid5: Schema.brand<Schema.String, "@typed/id/UUID5">;
|
|
@@ -31,7 +31,7 @@ export type Uuid5 = typeof Uuid5.Type;
|
|
|
31
31
|
* import { isUuid5 } from "@typed/id/Uuid5"
|
|
32
32
|
* isUuid5("21f7f8de-8051-5b89-8680-0195ef798b6a")
|
|
33
33
|
* ```
|
|
34
|
-
* @category
|
|
34
|
+
* @category ID validation
|
|
35
35
|
* @since 1.0.0
|
|
36
36
|
*/
|
|
37
37
|
export declare const isUuid5: (value: string) => value is Uuid5;
|
|
@@ -42,7 +42,7 @@ export declare const isUuid5: (value: string) => value is Uuid5;
|
|
|
42
42
|
* Namespace bytes are part of deterministic identity; caller canonicalization of names and namespace selection must remain explicit.
|
|
43
43
|
* ## Ownership and lifetime
|
|
44
44
|
* This type acquires no resources. Callers own and may mutate their byte array; generation reads exactly 16 bytes.
|
|
45
|
-
* @category
|
|
45
|
+
* @category ID types
|
|
46
46
|
* @since 1.0.0
|
|
47
47
|
*/
|
|
48
48
|
export type Uuid5Namespace = Uint8Array;
|
|
@@ -58,7 +58,7 @@ export type Uuid5Namespace = Uint8Array;
|
|
|
58
58
|
* import { Uuid5Namespace } from "@typed/id/Uuid5"
|
|
59
59
|
* const namespace = Uuid5Namespace.DNS
|
|
60
60
|
* ```
|
|
61
|
-
* @category
|
|
61
|
+
* @category Name-based identity
|
|
62
62
|
* @since 1.0.0
|
|
63
63
|
*/
|
|
64
64
|
export declare const Uuid5Namespace: {
|
|
@@ -69,7 +69,7 @@ export declare const Uuid5Namespace: {
|
|
|
69
69
|
* DNS names need a stable namespace distinct from URLs, OIDs, and X.500 names.
|
|
70
70
|
* ## Ownership and lifetime
|
|
71
71
|
* Each access allocates a mutable byte array owned by the caller.
|
|
72
|
-
* @category
|
|
72
|
+
* @category Name-based identity
|
|
73
73
|
* @since 1.0.0
|
|
74
74
|
*/
|
|
75
75
|
readonly DNS: Uint8Array<ArrayBuffer>;
|
|
@@ -80,7 +80,7 @@ export declare const Uuid5Namespace: {
|
|
|
80
80
|
* URL names need a stable namespace distinct from DNS, OID, and X.500 names.
|
|
81
81
|
* ## Ownership and lifetime
|
|
82
82
|
* Each access allocates a mutable byte array owned by the caller.
|
|
83
|
-
* @category
|
|
83
|
+
* @category Name-based identity
|
|
84
84
|
* @since 1.0.0
|
|
85
85
|
*/
|
|
86
86
|
readonly URL: Uint8Array<ArrayBuffer>;
|
|
@@ -91,7 +91,7 @@ export declare const Uuid5Namespace: {
|
|
|
91
91
|
* Object identifiers need a stable namespace distinct from DNS, URL, and X.500 names.
|
|
92
92
|
* ## Ownership and lifetime
|
|
93
93
|
* Each access allocates a mutable byte array owned by the caller.
|
|
94
|
-
* @category
|
|
94
|
+
* @category Name-based identity
|
|
95
95
|
* @since 1.0.0
|
|
96
96
|
*/
|
|
97
97
|
readonly OID: Uint8Array<ArrayBuffer>;
|
|
@@ -102,7 +102,7 @@ export declare const Uuid5Namespace: {
|
|
|
102
102
|
* X.500 names need a stable namespace distinct from DNS, URL, and OID names.
|
|
103
103
|
* ## Ownership and lifetime
|
|
104
104
|
* Each access allocates a mutable byte array owned by the caller.
|
|
105
|
-
* @category
|
|
105
|
+
* @category Name-based identity
|
|
106
106
|
* @since 1.0.0
|
|
107
107
|
*/
|
|
108
108
|
readonly X500: Uint8Array<ArrayBuffer>;
|
|
@@ -119,7 +119,7 @@ export declare const Uuid5Namespace: {
|
|
|
119
119
|
* import { uuid5, Uuid5Namespace } from "@typed/id/Uuid5"
|
|
120
120
|
* const id = uuid5("example.com", Uuid5Namespace.DNS)
|
|
121
121
|
* ```
|
|
122
|
-
* @category
|
|
122
|
+
* @category ID generation
|
|
123
123
|
* @since 1.0.0
|
|
124
124
|
*/
|
|
125
125
|
export declare const uuid5: {
|
|
@@ -138,7 +138,7 @@ export declare const uuid5: {
|
|
|
138
138
|
* import { dnsUuid5 } from "@typed/id/Uuid5"
|
|
139
139
|
* const id = dnsUuid5("example.com")
|
|
140
140
|
* ```
|
|
141
|
-
* @category
|
|
141
|
+
* @category ID generation
|
|
142
142
|
* @since 1.0.0
|
|
143
143
|
*/
|
|
144
144
|
export declare const dnsUuid5: (name: string) => Effect.Effect<Uuid5, Cause.IllegalArgumentError>;
|
|
@@ -154,7 +154,7 @@ export declare const dnsUuid5: (name: string) => Effect.Effect<Uuid5, Cause.Ille
|
|
|
154
154
|
* import { urlUuid5 } from "@typed/id/Uuid5"
|
|
155
155
|
* const id = urlUuid5("https://example.com")
|
|
156
156
|
* ```
|
|
157
|
-
* @category
|
|
157
|
+
* @category ID generation
|
|
158
158
|
* @since 1.0.0
|
|
159
159
|
*/
|
|
160
160
|
export declare const urlUuid5: (name: string) => Effect.Effect<Uuid5, Cause.IllegalArgumentError>;
|
|
@@ -170,7 +170,7 @@ export declare const urlUuid5: (name: string) => Effect.Effect<Uuid5, Cause.Ille
|
|
|
170
170
|
* import { oidUuid5 } from "@typed/id/Uuid5"
|
|
171
171
|
* const id = oidUuid5("1.3.6.1.4.1")
|
|
172
172
|
* ```
|
|
173
|
-
* @category
|
|
173
|
+
* @category ID generation
|
|
174
174
|
* @since 1.0.0
|
|
175
175
|
*/
|
|
176
176
|
export declare const oidUuid5: (name: string) => Effect.Effect<Uuid5, Cause.IllegalArgumentError>;
|
|
@@ -186,7 +186,7 @@ export declare const oidUuid5: (name: string) => Effect.Effect<Uuid5, Cause.Ille
|
|
|
186
186
|
* import { x500Uuid5 } from "@typed/id/Uuid5"
|
|
187
187
|
* const id = x500Uuid5("CN=example")
|
|
188
188
|
* ```
|
|
189
|
-
* @category
|
|
189
|
+
* @category ID generation
|
|
190
190
|
* @since 1.0.0
|
|
191
191
|
*/
|
|
192
192
|
export declare const x500Uuid5: (name: string) => Effect.Effect<Uuid5, Cause.IllegalArgumentError>;
|
package/dist/Uuid5.js
CHANGED
|
@@ -17,7 +17,7 @@ import { uuidStringify } from "./_uuid-stringify.js";
|
|
|
17
17
|
* import { Schema } from "effect"
|
|
18
18
|
* const id = Schema.decodeUnknownSync(Uuid5)("21f7f8de-8051-5b89-8680-0195ef798b6a")
|
|
19
19
|
* ```
|
|
20
|
-
* @category
|
|
20
|
+
* @category ID schemas
|
|
21
21
|
* @since 1.0.0
|
|
22
22
|
*/
|
|
23
23
|
export const Uuid5 = Schema.String.pipe(Schema.check(Schema.isUUID(5)), Schema.brand("@typed/id/UUID5"));
|
|
@@ -33,7 +33,7 @@ export const Uuid5 = Schema.String.pipe(Schema.check(Schema.isUUID(5)), Schema.b
|
|
|
33
33
|
* import { isUuid5 } from "@typed/id/Uuid5"
|
|
34
34
|
* isUuid5("21f7f8de-8051-5b89-8680-0195ef798b6a")
|
|
35
35
|
* ```
|
|
36
|
-
* @category
|
|
36
|
+
* @category ID validation
|
|
37
37
|
* @since 1.0.0
|
|
38
38
|
*/
|
|
39
39
|
export const isUuid5 = Schema.is(Uuid5);
|
|
@@ -63,7 +63,7 @@ const X500 = new Uint8Array([
|
|
|
63
63
|
* import { Uuid5Namespace } from "@typed/id/Uuid5"
|
|
64
64
|
* const namespace = Uuid5Namespace.DNS
|
|
65
65
|
* ```
|
|
66
|
-
* @category
|
|
66
|
+
* @category Name-based identity
|
|
67
67
|
* @since 1.0.0
|
|
68
68
|
*/
|
|
69
69
|
export const Uuid5Namespace = Object.freeze({
|
|
@@ -92,7 +92,7 @@ export const Uuid5Namespace = Object.freeze({
|
|
|
92
92
|
* import { uuid5, Uuid5Namespace } from "@typed/id/Uuid5"
|
|
93
93
|
* const id = uuid5("example.com", Uuid5Namespace.DNS)
|
|
94
94
|
* ```
|
|
95
|
-
* @category
|
|
95
|
+
* @category ID generation
|
|
96
96
|
* @since 1.0.0
|
|
97
97
|
*/
|
|
98
98
|
export const uuid5 = dual(2, function uuid5(name, namespace) {
|
|
@@ -130,7 +130,7 @@ export const uuid5 = dual(2, function uuid5(name, namespace) {
|
|
|
130
130
|
* import { dnsUuid5 } from "@typed/id/Uuid5"
|
|
131
131
|
* const id = dnsUuid5("example.com")
|
|
132
132
|
* ```
|
|
133
|
-
* @category
|
|
133
|
+
* @category ID generation
|
|
134
134
|
* @since 1.0.0
|
|
135
135
|
*/
|
|
136
136
|
export const dnsUuid5 = uuid5(Uuid5Namespace.DNS);
|
|
@@ -146,7 +146,7 @@ export const dnsUuid5 = uuid5(Uuid5Namespace.DNS);
|
|
|
146
146
|
* import { urlUuid5 } from "@typed/id/Uuid5"
|
|
147
147
|
* const id = urlUuid5("https://example.com")
|
|
148
148
|
* ```
|
|
149
|
-
* @category
|
|
149
|
+
* @category ID generation
|
|
150
150
|
* @since 1.0.0
|
|
151
151
|
*/
|
|
152
152
|
export const urlUuid5 = uuid5(Uuid5Namespace.URL);
|
|
@@ -162,7 +162,7 @@ export const urlUuid5 = uuid5(Uuid5Namespace.URL);
|
|
|
162
162
|
* import { oidUuid5 } from "@typed/id/Uuid5"
|
|
163
163
|
* const id = oidUuid5("1.3.6.1.4.1")
|
|
164
164
|
* ```
|
|
165
|
-
* @category
|
|
165
|
+
* @category ID generation
|
|
166
166
|
* @since 1.0.0
|
|
167
167
|
*/
|
|
168
168
|
export const oidUuid5 = uuid5(Uuid5Namespace.OID);
|
|
@@ -178,7 +178,7 @@ export const oidUuid5 = uuid5(Uuid5Namespace.OID);
|
|
|
178
178
|
* import { x500Uuid5 } from "@typed/id/Uuid5"
|
|
179
179
|
* const id = x500Uuid5("CN=example")
|
|
180
180
|
* ```
|
|
181
|
-
* @category
|
|
181
|
+
* @category ID generation
|
|
182
182
|
* @since 1.0.0
|
|
183
183
|
*/
|
|
184
184
|
export const x500Uuid5 = uuid5(Uuid5Namespace.X500);
|
package/dist/Uuid7.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ import { RandomValues } from "./RandomValues.js";
|
|
|
18
18
|
* import { Schema } from "effect"
|
|
19
19
|
* const id = Schema.decodeUnknownSync(Uuid7)("01890f2e-7d6c-7cc0-98c4-dc0c0c07398f")
|
|
20
20
|
* ```
|
|
21
|
-
* @category
|
|
21
|
+
* @category ID schemas
|
|
22
22
|
* @since 1.0.0
|
|
23
23
|
*/
|
|
24
24
|
export declare const Uuid7: Schema.brand<Schema.String, "@typed/id/UUID7">;
|
|
@@ -35,7 +35,7 @@ export type Uuid7 = typeof Uuid7.Type;
|
|
|
35
35
|
* import { isUuid7 } from "@typed/id/Uuid7"
|
|
36
36
|
* const valid = isUuid7("01890f2e-7d6c-7cc0-98c4-dc0c0c07398f")
|
|
37
37
|
* ```
|
|
38
|
-
* @category
|
|
38
|
+
* @category ID validation
|
|
39
39
|
* @since 1.0.0
|
|
40
40
|
*/
|
|
41
41
|
export declare const isUuid7: (value: string) => value is Uuid7;
|
|
@@ -51,7 +51,7 @@ export declare const isUuid7: (value: string) => value is Uuid7;
|
|
|
51
51
|
* import type { Uuid7Seed } from "@typed/id/Uuid7"
|
|
52
52
|
* const seed: Uuid7Seed = { timestamp: 0, seq: 0, randomBytes: new Uint8Array(16) as Uuid7Seed["randomBytes"] }
|
|
53
53
|
* ```
|
|
54
|
-
* @category
|
|
54
|
+
* @category Sequence state
|
|
55
55
|
* @since 1.0.0
|
|
56
56
|
*/
|
|
57
57
|
export type Uuid7Seed = {
|
|
@@ -96,7 +96,7 @@ declare const Uuid7State_base: Context.ServiceClass<Uuid7State, "@typed/id/Uuid7
|
|
|
96
96
|
* import { Effect } from "effect"
|
|
97
97
|
* const id = Effect.provide(uuid7, Uuid7State.Default)
|
|
98
98
|
* ```
|
|
99
|
-
* @category
|
|
99
|
+
* @category Sequence state
|
|
100
100
|
* @since 1.0.0
|
|
101
101
|
*/
|
|
102
102
|
export declare class Uuid7State extends Uuid7State_base {
|
|
@@ -124,7 +124,7 @@ export declare class Uuid7State extends Uuid7State_base {
|
|
|
124
124
|
* The production default is explicit while remaining replaceable by deterministic service layers.
|
|
125
125
|
* ## Ownership and lifetime
|
|
126
126
|
* Layer acquisition creates one mutable sequence state owned by the surrounding Layer Scope.
|
|
127
|
-
* @category
|
|
127
|
+
* @category Production layers
|
|
128
128
|
* @since 1.0.0
|
|
129
129
|
*/
|
|
130
130
|
static readonly Default: Layer.Layer<Uuid7State, never, never>;
|
|
@@ -142,7 +142,7 @@ export declare class Uuid7State extends Uuid7State_base {
|
|
|
142
142
|
* import { Effect } from "effect"
|
|
143
143
|
* const id = Effect.provide(uuid7, Uuid7State.Default)
|
|
144
144
|
* ```
|
|
145
|
-
* @category
|
|
145
|
+
* @category ID generation
|
|
146
146
|
* @since 1.0.0
|
|
147
147
|
*/
|
|
148
148
|
export declare const uuid7: Effect.Effect<Uuid7, Cause.IllegalArgumentError, Uuid7State>;
|
package/dist/Uuid7.js
CHANGED
|
@@ -19,7 +19,7 @@ import { RandomValues } from "./RandomValues.js";
|
|
|
19
19
|
* import { Schema } from "effect"
|
|
20
20
|
* const id = Schema.decodeUnknownSync(Uuid7)("01890f2e-7d6c-7cc0-98c4-dc0c0c07398f")
|
|
21
21
|
* ```
|
|
22
|
-
* @category
|
|
22
|
+
* @category ID schemas
|
|
23
23
|
* @since 1.0.0
|
|
24
24
|
*/
|
|
25
25
|
export const Uuid7 = Schema.String.pipe(Schema.check(Schema.isUUID(7)), Schema.brand("@typed/id/UUID7"));
|
|
@@ -35,7 +35,7 @@ export const Uuid7 = Schema.String.pipe(Schema.check(Schema.isUUID(7)), Schema.b
|
|
|
35
35
|
* import { isUuid7 } from "@typed/id/Uuid7"
|
|
36
36
|
* const valid = isUuid7("01890f2e-7d6c-7cc0-98c4-dc0c0c07398f")
|
|
37
37
|
* ```
|
|
38
|
-
* @category
|
|
38
|
+
* @category ID validation
|
|
39
39
|
* @since 1.0.0
|
|
40
40
|
*/
|
|
41
41
|
export const isUuid7 = Schema.is(Uuid7);
|
|
@@ -53,7 +53,7 @@ const maximumTimestamp = 2 ** 48 - 1;
|
|
|
53
53
|
* import { Effect } from "effect"
|
|
54
54
|
* const id = Effect.provide(uuid7, Uuid7State.Default)
|
|
55
55
|
* ```
|
|
56
|
-
* @category
|
|
56
|
+
* @category Sequence state
|
|
57
57
|
* @since 1.0.0
|
|
58
58
|
*/
|
|
59
59
|
export class Uuid7State extends Context.Service()("@typed/id/Uuid7State", {
|
|
@@ -130,7 +130,7 @@ export class Uuid7State extends Context.Service()("@typed/id/Uuid7State", {
|
|
|
130
130
|
* The production default is explicit while remaining replaceable by deterministic service layers.
|
|
131
131
|
* ## Ownership and lifetime
|
|
132
132
|
* Layer acquisition creates one mutable sequence state owned by the surrounding Layer Scope.
|
|
133
|
-
* @category
|
|
133
|
+
* @category Production layers
|
|
134
134
|
* @since 1.0.0
|
|
135
135
|
*/
|
|
136
136
|
static Default = Layer.effect(Uuid7State, Uuid7State.make).pipe(Layer.provide([DateTimes.Default, RandomValues.Default]));
|
|
@@ -148,7 +148,7 @@ export class Uuid7State extends Context.Service()("@typed/id/Uuid7State", {
|
|
|
148
148
|
* import { Effect } from "effect"
|
|
149
149
|
* const id = Effect.provide(uuid7, Uuid7State.Default)
|
|
150
150
|
* ```
|
|
151
|
-
* @category
|
|
151
|
+
* @category ID generation
|
|
152
152
|
* @since 1.0.0
|
|
153
153
|
*/
|
|
154
154
|
export const uuid7 = Effect.map(Uuid7State.next, uuid7FromSeed);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as Cause from "effect/Cause";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import type { Uuid5 } from "../Uuid5.js";
|
|
4
|
+
import { Uuid5Namespace } from "../Uuid5.js";
|
|
5
|
+
import { DateTimes } from "../DateTimes.js";
|
|
6
|
+
import { RandomValues } from "../RandomValues.js";
|
|
7
|
+
export declare const makeLazyIds: (envData: string) => Effect.Effect<{
|
|
8
|
+
cuid: Effect.Effect<string & import("effect/Brand").Brand<"@typed/id/CUID">, never, never>;
|
|
9
|
+
ksuid: Effect.Effect<string & import("effect/Brand").Brand<"@typed/id/KSUID">, Cause.IllegalArgumentError, never>;
|
|
10
|
+
nanoId: Effect.Effect<string & import("effect/Brand").Brand<"@typed/id/NanoId">, never, never>;
|
|
11
|
+
ulid: Effect.Effect<string & import("effect/Brand").Brand<"@typed/id/ULID">, Cause.IllegalArgumentError, never>;
|
|
12
|
+
uuid4: Effect.Effect<string & import("effect/Brand").Brand<"@typed/id/UUID4">, never, never>;
|
|
13
|
+
uuid5: {
|
|
14
|
+
(namespace: Uuid5Namespace): (name: string) => Effect.Effect<Uuid5, Cause.IllegalArgumentError>;
|
|
15
|
+
(name: string, namespace: Uuid5Namespace): Effect.Effect<Uuid5, Cause.IllegalArgumentError>;
|
|
16
|
+
readonly dns: (name: string) => Effect.Effect<Uuid5, Cause.IllegalArgumentError>;
|
|
17
|
+
readonly url: (name: string) => Effect.Effect<Uuid5, Cause.IllegalArgumentError>;
|
|
18
|
+
readonly oid: (name: string) => Effect.Effect<Uuid5, Cause.IllegalArgumentError>;
|
|
19
|
+
readonly x500: (name: string) => Effect.Effect<Uuid5, Cause.IllegalArgumentError>;
|
|
20
|
+
};
|
|
21
|
+
uuid7: Effect.Effect<string & import("effect/Brand").Brand<"@typed/id/UUID7">, Cause.IllegalArgumentError, never>;
|
|
22
|
+
}, never, DateTimes | RandomValues>;
|
|
23
|
+
//# sourceMappingURL=Ids.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Ids.d.ts","sourceRoot":"","sources":["../../src/internal/Ids.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,cAAc,EAAS,MAAM,aAAa,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAKlD,eAAO,MAAM,WAAW,YAAa,MAAM;;;;;;;oBAQxB,cAAc,GACxB,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,oBAAoB,CAAC;eAC9D,MAAM,aAAa,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,oBAAoB,CAAC;sBAC7E,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,oBAAoB,CAAC;sBAClE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,oBAAoB,CAAC;sBAClE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,oBAAoB,CAAC;uBACjE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,oBAAoB,CAAC;;;mCAwBnF,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import { dual } from "effect/Function";
|
|
3
|
+
import { Uuid5Namespace, uuid5 } from "../Uuid5.js";
|
|
4
|
+
import { CuidState, cuid } from "../Cuid.js";
|
|
5
|
+
import { ksuid } from "../Ksuid.js";
|
|
6
|
+
import { nanoId } from "../NanoId.js";
|
|
7
|
+
import { ulid } from "../Ulid.js";
|
|
8
|
+
import { uuid4 } from "../Uuid4.js";
|
|
9
|
+
import { Uuid7State, uuid7 } from "../Uuid7.js";
|
|
10
|
+
export const makeLazyIds = (envData) => Effect.gen(function* () {
|
|
11
|
+
const services = yield* Effect.context();
|
|
12
|
+
const getCuidState = yield* Effect.cached(Effect.provide(CuidState.make(envData), services));
|
|
13
|
+
const getUuid7State = yield* Effect.cached(Effect.provide(Uuid7State.make, services));
|
|
14
|
+
const uuid5_ = Object.assign(dual(2, (name, namespace) => Effect.provide(uuid5(name, namespace), services)), {
|
|
15
|
+
dns: uuid5(Uuid5Namespace.DNS),
|
|
16
|
+
url: uuid5(Uuid5Namespace.URL),
|
|
17
|
+
oid: uuid5(Uuid5Namespace.OID),
|
|
18
|
+
x500: uuid5(Uuid5Namespace.X500),
|
|
19
|
+
});
|
|
20
|
+
return {
|
|
21
|
+
cuid: Effect.flatMap(getCuidState, (state) => Effect.provideService(cuid, CuidState, state)),
|
|
22
|
+
ksuid: Effect.provide(ksuid, services),
|
|
23
|
+
nanoId: Effect.provide(nanoId, services),
|
|
24
|
+
ulid: Effect.provide(ulid, services),
|
|
25
|
+
uuid4: Effect.provide(uuid4, services),
|
|
26
|
+
uuid5: uuid5_,
|
|
27
|
+
uuid7: Effect.flatMap(getUuid7State, (state) => Effect.provideService(uuid7, Uuid7State, state)),
|
|
28
|
+
};
|
|
29
|
+
});
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typed/id",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.7",
|
|
4
4
|
"description": "Branded ID generators and facades for Typed applications.",
|
|
5
|
-
"license": "MIT",
|
|
6
5
|
"homepage": "https://github.com/TylorS/typed-smol/tree/main/packages/id#readme",
|
|
7
6
|
"bugs": "https://github.com/TylorS/typed-smol/issues",
|
|
7
|
+
"license": "MIT",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+https://github.com/TylorS/typed-smol.git",
|
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
"types": "./dist/Ids.d.ts",
|
|
33
33
|
"import": "./dist/Ids.js"
|
|
34
34
|
},
|
|
35
|
+
"./IdsTest": {
|
|
36
|
+
"types": "./dist/IdsTest.d.ts",
|
|
37
|
+
"import": "./dist/IdsTest.js"
|
|
38
|
+
},
|
|
35
39
|
"./Ksuid": {
|
|
36
40
|
"types": "./dist/Ksuid.d.ts",
|
|
37
41
|
"import": "./dist/Ksuid.js"
|