@vicin/phantom 1.0.1
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 +7 -0
- package/README.md +869 -0
- package/dist/assertors/assertors.d.ts +86 -0
- package/dist/assertors/assertors.d.ts.map +1 -0
- package/dist/assertors/assertors.js +91 -0
- package/dist/assertors/assertors.js.map +1 -0
- package/dist/assertors/brand.d.ts +13 -0
- package/dist/assertors/brand.d.ts.map +1 -0
- package/dist/assertors/brand.js +12 -0
- package/dist/assertors/brand.js.map +1 -0
- package/dist/assertors/identity.d.ts +13 -0
- package/dist/assertors/identity.d.ts.map +1 -0
- package/dist/assertors/identity.js +12 -0
- package/dist/assertors/identity.js.map +1 -0
- package/dist/assertors/index.d.ts +2 -0
- package/dist/assertors/index.d.ts.map +1 -0
- package/dist/assertors/index.js +2 -0
- package/dist/assertors/index.js.map +1 -0
- package/dist/assertors/trait.d.ts +38 -0
- package/dist/assertors/trait.d.ts.map +1 -0
- package/dist/assertors/trait.js +37 -0
- package/dist/assertors/trait.js.map +1 -0
- package/dist/assertors/transformation.d.ts +27 -0
- package/dist/assertors/transformation.d.ts.map +1 -0
- package/dist/assertors/transformation.js +26 -0
- package/dist/assertors/transformation.js.map +1 -0
- package/dist/chain/chain.d.ts +42 -0
- package/dist/chain/chain.d.ts.map +1 -0
- package/dist/chain/chain.js +48 -0
- package/dist/chain/chain.js.map +1 -0
- package/dist/chain/index.d.ts +2 -0
- package/dist/chain/index.d.ts.map +1 -0
- package/dist/chain/index.js +2 -0
- package/dist/chain/index.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/phantom.d.ts +352 -0
- package/dist/phantom.d.ts.map +1 -0
- package/dist/phantom.js +139 -0
- package/dist/phantom.js.map +1 -0
- package/dist/types/composed/brand.d.ts +32 -0
- package/dist/types/composed/brand.d.ts.map +1 -0
- package/dist/types/composed/brand.js +2 -0
- package/dist/types/composed/brand.js.map +1 -0
- package/dist/types/composed/helpers.d.ts +75 -0
- package/dist/types/composed/helpers.d.ts.map +1 -0
- package/dist/types/composed/helpers.js +2 -0
- package/dist/types/composed/helpers.js.map +1 -0
- package/dist/types/composed/identity.d.ts +37 -0
- package/dist/types/composed/identity.d.ts.map +1 -0
- package/dist/types/composed/identity.js +2 -0
- package/dist/types/composed/identity.js.map +1 -0
- package/dist/types/composed/index.d.ts +6 -0
- package/dist/types/composed/index.d.ts.map +1 -0
- package/dist/types/composed/index.js +2 -0
- package/dist/types/composed/index.js.map +1 -0
- package/dist/types/composed/trait.d.ts +35 -0
- package/dist/types/composed/trait.d.ts.map +1 -0
- package/dist/types/composed/trait.js +2 -0
- package/dist/types/composed/trait.js.map +1 -0
- package/dist/types/composed/transformation.d.ts +34 -0
- package/dist/types/composed/transformation.d.ts.map +1 -0
- package/dist/types/composed/transformation.js +2 -0
- package/dist/types/composed/transformation.js.map +1 -0
- package/dist/types/core/base.d.ts +35 -0
- package/dist/types/core/base.d.ts.map +1 -0
- package/dist/types/core/base.js +2 -0
- package/dist/types/core/base.js.map +1 -0
- package/dist/types/core/index.d.ts +8 -0
- package/dist/types/core/index.d.ts.map +1 -0
- package/dist/types/core/index.js +2 -0
- package/dist/types/core/index.js.map +1 -0
- package/dist/types/core/input.d.ts +38 -0
- package/dist/types/core/input.d.ts.map +1 -0
- package/dist/types/core/input.js +2 -0
- package/dist/types/core/input.js.map +1 -0
- package/dist/types/core/label.d.ts +34 -0
- package/dist/types/core/label.d.ts.map +1 -0
- package/dist/types/core/label.js +2 -0
- package/dist/types/core/label.js.map +1 -0
- package/dist/types/core/phantom.d.ts +20 -0
- package/dist/types/core/phantom.d.ts.map +1 -0
- package/dist/types/core/phantom.js +11 -0
- package/dist/types/core/phantom.js.map +1 -0
- package/dist/types/core/tag.d.ts +35 -0
- package/dist/types/core/tag.d.ts.map +1 -0
- package/dist/types/core/tag.js +2 -0
- package/dist/types/core/tag.js.map +1 -0
- package/dist/types/core/traits.d.ts +51 -0
- package/dist/types/core/traits.d.ts.map +1 -0
- package/dist/types/core/traits.js +2 -0
- package/dist/types/core/traits.js.map +1 -0
- package/dist/types/core/variants.d.ts +34 -0
- package/dist/types/core/variants.d.ts.map +1 -0
- package/dist/types/core/variants.js +2 -0
- package/dist/types/core/variants.js.map +1 -0
- package/dist/types/errors.d.ts +40 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +2 -0
- package/dist/types/errors.js.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/public.d.ts +224 -0
- package/dist/types/public.d.ts.map +1 -0
- package/dist/types/public.js +12 -0
- package/dist/types/public.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { PhantomChain as _PhantomChain } from './chain';
|
|
2
|
+
import type { Base as NamespaceBase, Brand as NamespaceBrand, Identity as NamespaceIdentity, Input as NamespaceInput, Label as NamespaceLabel, Tag as NamespaceTag, Trait as NamespaceTrait, Traits as NamespaceTraits, Transformation as NamespaceTransformation, Variants as NamespaceVariants, ErrorType as _ErrorType } from './types';
|
|
3
|
+
import { Phantom as NamespacePhantom } from './types';
|
|
4
|
+
export declare namespace Phantom {
|
|
5
|
+
/** --------------------------------------
|
|
6
|
+
* Types
|
|
7
|
+
* --------------------------------------- */
|
|
8
|
+
/**
|
|
9
|
+
* Optional human-readable label metadata.
|
|
10
|
+
*
|
|
11
|
+
* Labels are descriptive only and do not affect identity.
|
|
12
|
+
*/
|
|
13
|
+
namespace Label {
|
|
14
|
+
/** Marker type for labeled values */
|
|
15
|
+
type Any = NamespaceLabel.Any;
|
|
16
|
+
/** Extract the label */
|
|
17
|
+
type LabelOf<T> = NamespaceLabel.LabelOf<T>;
|
|
18
|
+
/** Check whether a label exists */
|
|
19
|
+
type HasLabel<T, L extends string = string> = NamespaceLabel.HasLabel<T, L>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Nominal tag metadata.
|
|
23
|
+
*
|
|
24
|
+
* Tags uniquely identify a branded or identified type.
|
|
25
|
+
* A value may only have a single tag.
|
|
26
|
+
*/
|
|
27
|
+
namespace Tag {
|
|
28
|
+
/** Marker type for any tagged value */
|
|
29
|
+
type Any = NamespaceTag.Any;
|
|
30
|
+
/** Extract the tag from a type */
|
|
31
|
+
type TagOf<T> = NamespaceTag.TagOf<T>;
|
|
32
|
+
/** Check whether a type is tagged */
|
|
33
|
+
type HasTag<T, Ta extends string | symbol = string | symbol> = NamespaceTag.HasTag<T, Ta>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Variant metadata.
|
|
37
|
+
*
|
|
38
|
+
* Variants represent mutually exclusive states of a type.
|
|
39
|
+
*/
|
|
40
|
+
namespace Variants {
|
|
41
|
+
/** Marker type for variant-bearing values */
|
|
42
|
+
type Any = NamespaceVariants.Any;
|
|
43
|
+
/** Extract variant union */
|
|
44
|
+
type VariantsOf<T> = NamespaceVariants.VariantsOf<T>;
|
|
45
|
+
/** Check whether variants exist */
|
|
46
|
+
type HasVariants<T> = NamespaceVariants.HasVariants<T>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Base-type metadata.
|
|
50
|
+
*
|
|
51
|
+
* Used to constrain which runtime types a brand, identity,
|
|
52
|
+
* or transformation may be applied to.
|
|
53
|
+
*/
|
|
54
|
+
namespace Base {
|
|
55
|
+
/** Marker type for base constraints */
|
|
56
|
+
type Any = NamespaceBase.Any;
|
|
57
|
+
/** Extract the base type */
|
|
58
|
+
type BaseOf<T> = NamespaceBase.BaseOf<T>;
|
|
59
|
+
/** Check whether a base constraint exists */
|
|
60
|
+
type HasBase<T, B = unknown> = NamespaceBase.HasBase<T, B>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Input metadata.
|
|
64
|
+
*
|
|
65
|
+
* Utilities for attaching and querying input metadata in transformations.
|
|
66
|
+
*/
|
|
67
|
+
namespace Input {
|
|
68
|
+
/** Marker type for input value */
|
|
69
|
+
type Any = NamespaceInput.Any;
|
|
70
|
+
/** Extract the input */
|
|
71
|
+
type InputOf<T> = NamespaceInput.InputOf<T>;
|
|
72
|
+
/** Check whether an input exists */
|
|
73
|
+
type HasInput<T, I = unknown> = NamespaceInput.HasInput<T, I>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Trait metadata.
|
|
77
|
+
*
|
|
78
|
+
* Traits behave like a set of capabilities that can be
|
|
79
|
+
* added or removed independently.
|
|
80
|
+
*/
|
|
81
|
+
namespace Traits {
|
|
82
|
+
/** Marker type for trait-bearing values */
|
|
83
|
+
type Any = NamespaceTraits.Any;
|
|
84
|
+
/** Extract the trait map */
|
|
85
|
+
type TraitsOf<T> = NamespaceTraits.TraitsOf<T>;
|
|
86
|
+
/** Extract trait keys */
|
|
87
|
+
type TraitKeysOf<T> = NamespaceTraits.TraitKeysOf<T>;
|
|
88
|
+
/** Check if any traits exist */
|
|
89
|
+
type HasTraits<T, Tr extends string | symbol = string | symbol> = NamespaceTraits.HasTraits<T, Tr>;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Branding API.
|
|
93
|
+
*
|
|
94
|
+
* Brands provide nominal typing for otherwise identical values.
|
|
95
|
+
* A value may only be branded once.
|
|
96
|
+
*/
|
|
97
|
+
namespace Brand {
|
|
98
|
+
/** Type guard for any brand. */
|
|
99
|
+
type Any = NamespaceBrand.Any;
|
|
100
|
+
/** Declare a brand */
|
|
101
|
+
type Declare<T extends string | symbol, L extends string = never> = NamespaceBrand.Declare<T, L>;
|
|
102
|
+
/** Assign a brand to a value. Fails if the value is already branded */
|
|
103
|
+
type Assign<B extends Any, T> = NamespaceBrand.Assign<B, T>;
|
|
104
|
+
/** Assign a brand if possible, otherwise return the original type */
|
|
105
|
+
type AssignSafe<B extends Any, T> = NamespaceBrand.AssignSafe<B, T>;
|
|
106
|
+
/** Check whether value is branded with */
|
|
107
|
+
type isBrand<T, B extends Brand.Any> = NamespaceBrand.isBrand<T, B>;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Identity API.
|
|
111
|
+
*
|
|
112
|
+
* Identities are brands with additional constraints:
|
|
113
|
+
* - Base type
|
|
114
|
+
* - Variants
|
|
115
|
+
*/
|
|
116
|
+
namespace Identity {
|
|
117
|
+
/** Type guard for any identity. */
|
|
118
|
+
type Any = NamespaceIdentity.Any;
|
|
119
|
+
/** Declare an identity */
|
|
120
|
+
type Declare<T extends string | symbol, L extends string = never, B extends unknown = never, V extends string = never> = NamespaceIdentity.Declare<T, L, B, V>;
|
|
121
|
+
/** Assign an identity to a value. Enforces base-type compatibility */
|
|
122
|
+
type Assign<I extends Any, T> = NamespaceIdentity.Assign<I, T>;
|
|
123
|
+
/** Safe identity assignment */
|
|
124
|
+
type AssignSafe<I extends Any, T> = NamespaceIdentity.AssignSafe<I, T>;
|
|
125
|
+
/** Set the active variant on an identity */
|
|
126
|
+
type WithVariant<I extends Any, V extends Variants.VariantsOf<I>> = NamespaceIdentity.WithVariant<I, V>;
|
|
127
|
+
/** Set the active variant on a value */
|
|
128
|
+
type WithTypeVariant<T, V extends Variants.VariantsOf<T>> = NamespaceIdentity.WithTypeVariant<T, V>;
|
|
129
|
+
/** Check whether value is branded with */
|
|
130
|
+
type isIdentity<T, I extends Any> = NamespaceIdentity.isIdentity<T, I>;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Trait API.
|
|
134
|
+
*
|
|
135
|
+
* Traits are additive capabilities that can be attached
|
|
136
|
+
* or removed independently.
|
|
137
|
+
*/
|
|
138
|
+
namespace Trait {
|
|
139
|
+
/** Type guard for any trait. */
|
|
140
|
+
type Any = NamespaceTrait.Any;
|
|
141
|
+
/** Declare a trait */
|
|
142
|
+
type Declare<Tr extends string | symbol> = NamespaceTrait.Declare<Tr>;
|
|
143
|
+
/** Add a trait */
|
|
144
|
+
type Add<Tr extends Any, T> = NamespaceTrait.Add<Tr, T>;
|
|
145
|
+
/** Add multiple traits */
|
|
146
|
+
type AddMulti<Tr extends readonly Any[], T> = NamespaceTrait.AddMulti<Tr, T>;
|
|
147
|
+
/** Remove a trait */
|
|
148
|
+
type Drop<Tr extends Any, T> = NamespaceTrait.Drop<Tr, T>;
|
|
149
|
+
/** Remove multiple traits */
|
|
150
|
+
type DropMulti<Tr extends readonly Any[], T> = NamespaceTrait.DropMulti<Tr, T>;
|
|
151
|
+
/** Check whether value has trait */
|
|
152
|
+
type HasTrait<T, Tr extends Any> = NamespaceTrait.HasTrait<T, Tr>;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Transformation API.
|
|
156
|
+
*
|
|
157
|
+
* Transformations represent reversible operations that
|
|
158
|
+
* change the shape of a value while preserving its origin.
|
|
159
|
+
*/
|
|
160
|
+
namespace Transformation {
|
|
161
|
+
/** Type guard for any transformation. */
|
|
162
|
+
type Any = NamespaceTransformation.Any;
|
|
163
|
+
/** Declare a transformation */
|
|
164
|
+
type Declare<I, T extends string | symbol, L extends string = never, B extends unknown = never, V extends string = never> = NamespaceTransformation.Declare<I, T, L, B, V>;
|
|
165
|
+
/** Apply a transformation to a value. Enforces base-type compatibility */
|
|
166
|
+
type Apply<Tr extends Any, I, T> = NamespaceTransformation.Apply<Tr, I, T>;
|
|
167
|
+
/** Revert a transformation */
|
|
168
|
+
type Revert<Tr extends Any, T, I> = NamespaceTransformation.Revert<Tr, T, I>;
|
|
169
|
+
/** Revert a transformation whatever transformation was */
|
|
170
|
+
type RevertAny<T, I> = NamespaceTransformation.RevertAny<T, I>;
|
|
171
|
+
/** Check whether value is transformed with */
|
|
172
|
+
type isTransformed<T, Tr extends Any> = NamespaceTransformation.isTransformed<T, Tr>;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Inspect API.
|
|
176
|
+
*
|
|
177
|
+
* Inspection helpers of phantom types.
|
|
178
|
+
*/
|
|
179
|
+
namespace Inspect {
|
|
180
|
+
/** Get phantom metadata object from a type */
|
|
181
|
+
type PhantomOf<T> = NamespacePhantom.PhantomOf<T>;
|
|
182
|
+
/** Stip phantom metadata object from a type */
|
|
183
|
+
type StripPhantom<T> = NamespacePhantom.StripPhantom<T>;
|
|
184
|
+
/** run-time helper for 'StringPhantom', used for debugging mainly */
|
|
185
|
+
const stripPhantom: <T>(value: T) => import("./types/core").Phantom.StripPhantom<T>;
|
|
186
|
+
/** Extract the label */
|
|
187
|
+
type LabelOf<T> = NamespaceLabel.LabelOf<T>;
|
|
188
|
+
/** Check whether a base constraint exists */
|
|
189
|
+
type HasLabel<T, L extends string = string> = NamespaceLabel.HasLabel<T, L>;
|
|
190
|
+
/** Extract the tag from a type */
|
|
191
|
+
type TagOf<T> = NamespaceTag.TagOf<T>;
|
|
192
|
+
/** Check whether a type is tagged */
|
|
193
|
+
type HasTag<T, Ta extends string | symbol = string | symbol> = NamespaceTag.HasTag<T, Ta>;
|
|
194
|
+
/** Extract variant union */
|
|
195
|
+
type VariantsOf<T> = NamespaceVariants.VariantsOf<T>;
|
|
196
|
+
/** Check whether variants exist */
|
|
197
|
+
type HasVariants<T> = NamespaceVariants.HasVariants<T>;
|
|
198
|
+
/** Extract the base type */
|
|
199
|
+
type BaseOf<T> = NamespaceBase.BaseOf<T>;
|
|
200
|
+
/** Check whether a base constraint exists */
|
|
201
|
+
type HasBase<T, B = unknown> = NamespaceBase.HasBase<T, B>;
|
|
202
|
+
/** Extract the input */
|
|
203
|
+
type InputOf<T> = NamespaceInput.InputOf<T>;
|
|
204
|
+
/** Check whether an input exists */
|
|
205
|
+
type HasInput<T, I = unknown> = NamespaceInput.HasInput<T, I>;
|
|
206
|
+
/** Extract the trait map */
|
|
207
|
+
type TraitsOf<T> = NamespaceTraits.TraitsOf<T>;
|
|
208
|
+
/** Extract trait keys */
|
|
209
|
+
type TraitKeysOf<T> = NamespaceTraits.TraitKeysOf<T>;
|
|
210
|
+
/** Check if any traits exist */
|
|
211
|
+
type HasTraits<T, Tr extends string | symbol = string | symbol> = NamespaceTraits.HasTraits<T, Tr>;
|
|
212
|
+
/** Check whether value is branded with */
|
|
213
|
+
type isBrand<T, B extends Brand.Any> = NamespaceBrand.isBrand<T, B>;
|
|
214
|
+
/** Check whether value is branded with */
|
|
215
|
+
type isIdentity<T, I extends Identity.Any> = NamespaceIdentity.isIdentity<T, I>;
|
|
216
|
+
/** Check whether value has trait */
|
|
217
|
+
type HasTrait<T, Tr extends Trait.Any> = NamespaceTrait.HasTrait<T, Tr>;
|
|
218
|
+
/** Check whether value is transformed with */
|
|
219
|
+
type isTransformed<T, Tr extends Transformation.Any> = NamespaceTransformation.isTransformed<T, Tr>;
|
|
220
|
+
}
|
|
221
|
+
/** --------------------------------------
|
|
222
|
+
* assertors
|
|
223
|
+
* --------------------------------------- */
|
|
224
|
+
namespace assertors {
|
|
225
|
+
/**
|
|
226
|
+
* Creates a typed caster that assigns a {@link Brand} to a value.
|
|
227
|
+
*
|
|
228
|
+
* This is a zero-cost runtime assertion helper — it simply returns the value
|
|
229
|
+
* with the brand's nominal type applied. Use it for simple branded primitives
|
|
230
|
+
* where you know the value is valid.
|
|
231
|
+
*
|
|
232
|
+
* @template B - The brand declaration to assign.
|
|
233
|
+
* @returns A function that casts any value to the branded type.
|
|
234
|
+
*/
|
|
235
|
+
const asBrand: <B extends NamespaceBrand.Any>() => <T>(value: T) => NamespaceBrand.Assign<B, T>;
|
|
236
|
+
/**
|
|
237
|
+
* Creates a typed caster that assigns an {@link Identity} to a value.
|
|
238
|
+
*
|
|
239
|
+
* This is a zero-cost runtime assertion helper — it simply returns the value
|
|
240
|
+
* with the identity's nominal type applied. Use it when you know a value
|
|
241
|
+
* conforms to an identity but need to assert it for the type system.
|
|
242
|
+
*
|
|
243
|
+
* @template I - The identity declaration to assign.
|
|
244
|
+
* @returns A function that casts any value to the assigned identity type.
|
|
245
|
+
*/
|
|
246
|
+
const asIdentity: <I extends NamespaceIdentity.Any>() => <V>(value: V) => NamespaceIdentity.Assign<I, V>;
|
|
247
|
+
/**
|
|
248
|
+
* Creates a typed caster that adds a single {@link Trait} to a value.
|
|
249
|
+
*
|
|
250
|
+
* Zero-runtime-cost assertion helper.
|
|
251
|
+
*
|
|
252
|
+
* @template Tr - The trait declaration to add.
|
|
253
|
+
* @returns A function that adds the trait to any value.
|
|
254
|
+
*/
|
|
255
|
+
const addTrait: <Tr extends NamespaceTrait.Any>() => <V>(value: V) => NamespaceTrait.Add<Tr, V>;
|
|
256
|
+
/**
|
|
257
|
+
* Creates a typed caster that adds multiple {@link Trait}s to a value.
|
|
258
|
+
*
|
|
259
|
+
* Zero-runtime-cost assertion helper.
|
|
260
|
+
*
|
|
261
|
+
* @template Tr - Tuple of trait declarations to add.
|
|
262
|
+
* @returns A function that adds all traits to any value.
|
|
263
|
+
*/
|
|
264
|
+
const addTraits: <Tr extends NamespaceTrait.Any[]>() => <V>(value: V) => NamespaceTrait.AddMulti<Tr, V>;
|
|
265
|
+
/**
|
|
266
|
+
* Creates a typed caster that removes a single {@link Trait} from a value.
|
|
267
|
+
*
|
|
268
|
+
* Zero-runtime-cost assertion helper.
|
|
269
|
+
*
|
|
270
|
+
* @template Tr - The trait declaration to remove.
|
|
271
|
+
* @returns A function that drops the trait from any value.
|
|
272
|
+
*/
|
|
273
|
+
const dropTrait: <Tr extends NamespaceTrait.Any>() => <V>(value: V) => NamespaceTrait.Drop<Tr, V>;
|
|
274
|
+
/**
|
|
275
|
+
* Creates a typed caster that removes multiple {@link Trait}s from a value.
|
|
276
|
+
*
|
|
277
|
+
* Zero-runtime-cost assertion helper.
|
|
278
|
+
*
|
|
279
|
+
* @template Tr - Tuple of trait declarations to remove.
|
|
280
|
+
* @returns A function that drops all specified traits from any value.
|
|
281
|
+
*/
|
|
282
|
+
const dropTraits: <Tr extends NamespaceTrait.Any[]>() => <V>(value: V) => NamespaceTrait.DropMulti<Tr, V>;
|
|
283
|
+
/**
|
|
284
|
+
* Creates a typed applicator for a {@link Transformation}.
|
|
285
|
+
*
|
|
286
|
+
* Use this for "forward" operations (e.g., encrypt, encode, wrap).
|
|
287
|
+
* The `input` parameter is only used for type inference — it is not used at runtime.
|
|
288
|
+
*
|
|
289
|
+
* Zero-runtime-cost assertion helper.
|
|
290
|
+
*
|
|
291
|
+
* @template Tr - The transformation declaration.
|
|
292
|
+
* @returns A function that applies the transformation while preserving the input type for later revert.
|
|
293
|
+
*/
|
|
294
|
+
const applyTransformation: <Tr extends NamespaceTransformation.Any>() => <I, T>(input: I, transformed: T) => NamespaceTransformation.Apply<Tr, I, T>;
|
|
295
|
+
/**
|
|
296
|
+
* Creates a typed reverter for a {@link Transformation}.
|
|
297
|
+
*
|
|
298
|
+
* Use this for "reverse" operations (e.g., decrypt, decode, unwrap).
|
|
299
|
+
* The `transformed` parameter is used for type inference of the expected input,
|
|
300
|
+
* and `input` is the computed result that must match the stored input type.
|
|
301
|
+
*
|
|
302
|
+
* Zero-runtime-cost assertion helper.
|
|
303
|
+
*
|
|
304
|
+
* @template Tr - The transformation declaration.
|
|
305
|
+
* @returns A function that reverts the transformation, stripping phantom metadata.
|
|
306
|
+
*/
|
|
307
|
+
const revertTransformation: <Tr extends NamespaceTransformation.Any>() => <T, I>(transformed: T, input: I) => NamespaceTransformation.Revert<Tr, T, I>;
|
|
308
|
+
}
|
|
309
|
+
/** --------------------------------------
|
|
310
|
+
* Phantom object manipulators
|
|
311
|
+
* --------------------------------------- */
|
|
312
|
+
/** Get phantom metadata object from a type */
|
|
313
|
+
type PhantomOf<T> = NamespacePhantom.PhantomOf<T>;
|
|
314
|
+
/** Stip phantom metadata object from a type */
|
|
315
|
+
type StripPhantom<T> = NamespacePhantom.StripPhantom<T>;
|
|
316
|
+
/** run-time helper for 'StringPhantom', used for debugging mainly */
|
|
317
|
+
const stripPhantom: <T>(value: T) => import("./types/core").Phantom.StripPhantom<T>;
|
|
318
|
+
/** --------------------------------------
|
|
319
|
+
* Error type
|
|
320
|
+
* --------------------------------------- */
|
|
321
|
+
/** Unique Error type for rules validation in phantom. */
|
|
322
|
+
type ErrorType<E> = _ErrorType<E>;
|
|
323
|
+
/** --------------------------------------
|
|
324
|
+
* Chain class
|
|
325
|
+
* --------------------------------------- */
|
|
326
|
+
/**
|
|
327
|
+
* A fluent PhantomChain class for chaining Phantom assertors.
|
|
328
|
+
*
|
|
329
|
+
* This provides a better developer experience (DX) by allowing method chaining
|
|
330
|
+
* with `.with(assertor)` instead of nesting function calls or using a variadic chain.
|
|
331
|
+
* Each `.with()` applies the assertor to the current value, updating the type incrementally.
|
|
332
|
+
* Call `.end()` to retrieve the final value.
|
|
333
|
+
*
|
|
334
|
+
* At runtime, assertors are zero-cost casts, so the PhantomChain adds minimal overhead
|
|
335
|
+
* (just object creation and method calls).
|
|
336
|
+
*
|
|
337
|
+
* Example:
|
|
338
|
+
* ```ts
|
|
339
|
+
* const asMyBrand = Phantom.assertors.asBrand<MyBrand>();
|
|
340
|
+
* const asMyTrait = Phantom.assertors.asTrait<MyTrait>();
|
|
341
|
+
* const applyMyTransform = Phantom.assertors.applyTransformation<MyTransform>();
|
|
342
|
+
*
|
|
343
|
+
* const result = new PhantomChain("value")
|
|
344
|
+
* .with(asMyBrand)
|
|
345
|
+
* .with(asMyTrait)
|
|
346
|
+
* .with(applyMyTransform)
|
|
347
|
+
* .end();
|
|
348
|
+
* ```
|
|
349
|
+
*/
|
|
350
|
+
const PhantomChain: typeof _PhantomChain;
|
|
351
|
+
}
|
|
352
|
+
//# sourceMappingURL=phantom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phantom.d.ts","sourceRoot":"","sources":["../src/phantom.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,KAAK,EACV,IAAI,IAAI,aAAa,EACrB,KAAK,IAAI,cAAc,EACvB,QAAQ,IAAI,iBAAiB,EAC7B,K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,CAAC,EAAE,QAAQ,mCAuU2C,CAAC;QAExD;;;;;;;WAOG;QACI,MAAM,QAAQ,wCAxVpB,CAAC,EAAG,QAAO,8BAwVuC,CAAC;QAEpD;;;;;;;WAOG;QACI,MAAM,SAAS,0CArVjB,CAAC,EAAE,QAAQ,mCAqVqC,CAAC;QAEtD;;;;;;;WAOG;QACI,MAAM,SAAS,wCArVV,CAAA,EAAE,QAAQ,+BAqV+B,CAAC;QAEtD;;;;;;;WAOG;QACI,MAAM,UAAU,0CAhVL,CAAC,EAAE,QAAQ,oCAgV0B,CAAC;QAExD;;;;;;;;;;WAUG;QACI,MAAM,mBAAmB,iDA5XlB,CAAC,EAAC,CAAE,EAAG,QACrB,EAAE,cAAc,4CA2XyD,CAAC;QAE1E;;;;;;;;;;;WAWG;QACI,MAAM,oBAAoB,iDAjX3B,CAAC,EAAC,CAAE,EAAE,cAAc,EAAC,QAAS,6CAiXuC,CAAC;KAC7E;IAED;;iDAE6C;IAE7C,8CAA8C;IAC9C,KAAY,SAAS,CAAC,CAAC,IAAI,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACzD,+CAA+C;IAC/C,KAAY,YAAY,CAAC,CAAC,IAAI,gBAAgB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAC/D,qEAAqE;IAC9D,MAAM,YAAY,iEAAgC,CAAC;IAE1D;;iDAE6C;IAE7C,yDAAyD;IACzD,KAAY,SAAS,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;IAEzC;;iDAE6C;IAE7C;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACI,MAAM,YAAY,sBAAgB,CAAC;CAC3C"}
|
package/dist/phantom.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { assertors as NamespaceAssertors } from './assertors';
|
|
2
|
+
import { PhantomChain as _PhantomChain } from './chain';
|
|
3
|
+
import { Phantom as NamespacePhantom } from './types';
|
|
4
|
+
export var Phantom;
|
|
5
|
+
(function (Phantom) {
|
|
6
|
+
/** --------------------------------------
|
|
7
|
+
* Types
|
|
8
|
+
* --------------------------------------- */
|
|
9
|
+
/**
|
|
10
|
+
* Inspect API.
|
|
11
|
+
*
|
|
12
|
+
* Inspection helpers of phantom types.
|
|
13
|
+
*/
|
|
14
|
+
let Inspect;
|
|
15
|
+
(function (Inspect) {
|
|
16
|
+
/** run-time helper for 'StringPhantom', used for debugging mainly */
|
|
17
|
+
Inspect.stripPhantom = NamespacePhantom.stripPhantom;
|
|
18
|
+
})(Inspect = Phantom.Inspect || (Phantom.Inspect = {}));
|
|
19
|
+
/** --------------------------------------
|
|
20
|
+
* assertors
|
|
21
|
+
* --------------------------------------- */
|
|
22
|
+
let assertors;
|
|
23
|
+
(function (assertors) {
|
|
24
|
+
/**
|
|
25
|
+
* Creates a typed caster that assigns a {@link Brand} to a value.
|
|
26
|
+
*
|
|
27
|
+
* This is a zero-cost runtime assertion helper — it simply returns the value
|
|
28
|
+
* with the brand's nominal type applied. Use it for simple branded primitives
|
|
29
|
+
* where you know the value is valid.
|
|
30
|
+
*
|
|
31
|
+
* @template B - The brand declaration to assign.
|
|
32
|
+
* @returns A function that casts any value to the branded type.
|
|
33
|
+
*/
|
|
34
|
+
assertors.asBrand = NamespaceAssertors.asBrand;
|
|
35
|
+
/**
|
|
36
|
+
* Creates a typed caster that assigns an {@link Identity} to a value.
|
|
37
|
+
*
|
|
38
|
+
* This is a zero-cost runtime assertion helper — it simply returns the value
|
|
39
|
+
* with the identity's nominal type applied. Use it when you know a value
|
|
40
|
+
* conforms to an identity but need to assert it for the type system.
|
|
41
|
+
*
|
|
42
|
+
* @template I - The identity declaration to assign.
|
|
43
|
+
* @returns A function that casts any value to the assigned identity type.
|
|
44
|
+
*/
|
|
45
|
+
assertors.asIdentity = NamespaceAssertors.asIdentity;
|
|
46
|
+
/**
|
|
47
|
+
* Creates a typed caster that adds a single {@link Trait} to a value.
|
|
48
|
+
*
|
|
49
|
+
* Zero-runtime-cost assertion helper.
|
|
50
|
+
*
|
|
51
|
+
* @template Tr - The trait declaration to add.
|
|
52
|
+
* @returns A function that adds the trait to any value.
|
|
53
|
+
*/
|
|
54
|
+
assertors.addTrait = NamespaceAssertors.addTrait;
|
|
55
|
+
/**
|
|
56
|
+
* Creates a typed caster that adds multiple {@link Trait}s to a value.
|
|
57
|
+
*
|
|
58
|
+
* Zero-runtime-cost assertion helper.
|
|
59
|
+
*
|
|
60
|
+
* @template Tr - Tuple of trait declarations to add.
|
|
61
|
+
* @returns A function that adds all traits to any value.
|
|
62
|
+
*/
|
|
63
|
+
assertors.addTraits = NamespaceAssertors.addTraits;
|
|
64
|
+
/**
|
|
65
|
+
* Creates a typed caster that removes a single {@link Trait} from a value.
|
|
66
|
+
*
|
|
67
|
+
* Zero-runtime-cost assertion helper.
|
|
68
|
+
*
|
|
69
|
+
* @template Tr - The trait declaration to remove.
|
|
70
|
+
* @returns A function that drops the trait from any value.
|
|
71
|
+
*/
|
|
72
|
+
assertors.dropTrait = NamespaceAssertors.dropTrait;
|
|
73
|
+
/**
|
|
74
|
+
* Creates a typed caster that removes multiple {@link Trait}s from a value.
|
|
75
|
+
*
|
|
76
|
+
* Zero-runtime-cost assertion helper.
|
|
77
|
+
*
|
|
78
|
+
* @template Tr - Tuple of trait declarations to remove.
|
|
79
|
+
* @returns A function that drops all specified traits from any value.
|
|
80
|
+
*/
|
|
81
|
+
assertors.dropTraits = NamespaceAssertors.dropTraits;
|
|
82
|
+
/**
|
|
83
|
+
* Creates a typed applicator for a {@link Transformation}.
|
|
84
|
+
*
|
|
85
|
+
* Use this for "forward" operations (e.g., encrypt, encode, wrap).
|
|
86
|
+
* The `input` parameter is only used for type inference — it is not used at runtime.
|
|
87
|
+
*
|
|
88
|
+
* Zero-runtime-cost assertion helper.
|
|
89
|
+
*
|
|
90
|
+
* @template Tr - The transformation declaration.
|
|
91
|
+
* @returns A function that applies the transformation while preserving the input type for later revert.
|
|
92
|
+
*/
|
|
93
|
+
assertors.applyTransformation = NamespaceAssertors.applyTransformation;
|
|
94
|
+
/**
|
|
95
|
+
* Creates a typed reverter for a {@link Transformation}.
|
|
96
|
+
*
|
|
97
|
+
* Use this for "reverse" operations (e.g., decrypt, decode, unwrap).
|
|
98
|
+
* The `transformed` parameter is used for type inference of the expected input,
|
|
99
|
+
* and `input` is the computed result that must match the stored input type.
|
|
100
|
+
*
|
|
101
|
+
* Zero-runtime-cost assertion helper.
|
|
102
|
+
*
|
|
103
|
+
* @template Tr - The transformation declaration.
|
|
104
|
+
* @returns A function that reverts the transformation, stripping phantom metadata.
|
|
105
|
+
*/
|
|
106
|
+
assertors.revertTransformation = NamespaceAssertors.revertTransformation;
|
|
107
|
+
})(assertors = Phantom.assertors || (Phantom.assertors = {}));
|
|
108
|
+
/** run-time helper for 'StringPhantom', used for debugging mainly */
|
|
109
|
+
Phantom.stripPhantom = NamespacePhantom.stripPhantom;
|
|
110
|
+
/** --------------------------------------
|
|
111
|
+
* Chain class
|
|
112
|
+
* --------------------------------------- */
|
|
113
|
+
/**
|
|
114
|
+
* A fluent PhantomChain class for chaining Phantom assertors.
|
|
115
|
+
*
|
|
116
|
+
* This provides a better developer experience (DX) by allowing method chaining
|
|
117
|
+
* with `.with(assertor)` instead of nesting function calls or using a variadic chain.
|
|
118
|
+
* Each `.with()` applies the assertor to the current value, updating the type incrementally.
|
|
119
|
+
* Call `.end()` to retrieve the final value.
|
|
120
|
+
*
|
|
121
|
+
* At runtime, assertors are zero-cost casts, so the PhantomChain adds minimal overhead
|
|
122
|
+
* (just object creation and method calls).
|
|
123
|
+
*
|
|
124
|
+
* Example:
|
|
125
|
+
* ```ts
|
|
126
|
+
* const asMyBrand = Phantom.assertors.asBrand<MyBrand>();
|
|
127
|
+
* const asMyTrait = Phantom.assertors.asTrait<MyTrait>();
|
|
128
|
+
* const applyMyTransform = Phantom.assertors.applyTransformation<MyTransform>();
|
|
129
|
+
*
|
|
130
|
+
* const result = new PhantomChain("value")
|
|
131
|
+
* .with(asMyBrand)
|
|
132
|
+
* .with(asMyTrait)
|
|
133
|
+
* .with(applyMyTransform)
|
|
134
|
+
* .end();
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
Phantom.PhantomChain = _PhantomChain;
|
|
138
|
+
})(Phantom || (Phantom = {}));
|
|
139
|
+
//# sourceMappingURL=phantom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phantom.js","sourceRoot":"","sources":["../src/phantom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,YAAY,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAcxD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEtD,MAAM,KAAW,OAAO,CA4bvB;AA5bD,WAAiB,OAAO;IACtB;;iDAE6C;IAuO7C;;;;OAIG;IACH,IAAiB,OAAO,CA2DvB;IA3DD,WAAiB,OAAO;QAKtB,qEAAqE;QACxD,oBAAY,GAAG,gBAAgB,CAAC,YAAY,CAAC;IAqD5D,CAAC,EA3DgB,OAAO,GAAP,eAAO,KAAP,eAAO,QA2DvB;IAED;;iDAE6C;IAE7C,IAAiB,SAAS,CA2FzB;IA3FD,WAAiB,SAAS;QACxB;;;;;;;;;WASG;QACU,iBAAO,GAAG,kBAAkB,CAAC,OAAO,CAAC;QAElD;;;;;;;;;WASG;QACU,oBAAU,GAAG,kBAAkB,CAAC,UAAU,CAAC;QAExD;;;;;;;WAOG;QACU,kBAAQ,GAAG,kBAAkB,CAAC,QAAQ,CAAC;QAEpD;;;;;;;WAOG;QACU,mBAAS,GAAG,kBAAkB,CAAC,SAAS,CAAC;QAEtD;;;;;;;WAOG;QACU,mBAAS,GAAG,kBAAkB,CAAC,SAAS,CAAC;QAEtD;;;;;;;WAOG;QACU,oBAAU,GAAG,kBAAkB,CAAC,UAAU,CAAC;QAExD;;;;;;;;;;WAUG;QACU,6BAAmB,GAAG,kBAAkB,CAAC,mBAAmB,CAAC;QAE1E;;;;;;;;;;;WAWG;QACU,8BAAoB,GAAG,kBAAkB,CAAC,oBAAoB,CAAC;IAC9E,CAAC,EA3FgB,SAAS,GAAT,iBAAS,KAAT,iBAAS,QA2FzB;IAUD,qEAAqE;IACxD,oBAAY,GAAG,gBAAgB,CAAC,YAAY,CAAC;IAS1D;;iDAE6C;IAE7C;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACU,oBAAY,GAAG,aAAa,CAAC;AAC5C,CAAC,EA5bgB,OAAO,KAAP,OAAO,QA4bvB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Label as NamespaceLabel, Tag as NamespaceTag } from '../core';
|
|
2
|
+
import type { ErrorType, Errors } from '../errors';
|
|
3
|
+
import type { HandleOriginalType, Prettify, WithMetadata } from './helpers';
|
|
4
|
+
/**
|
|
5
|
+
* Branding API.
|
|
6
|
+
*
|
|
7
|
+
* Brands provide nominal typing for otherwise identical values.
|
|
8
|
+
* A value may only be branded once.
|
|
9
|
+
*/
|
|
10
|
+
export declare namespace Brand {
|
|
11
|
+
/** Type guard for any brand. */
|
|
12
|
+
export type Any = NamespaceTag.Of<string | symbol>;
|
|
13
|
+
/** Declare a brand */
|
|
14
|
+
export type Declare<T extends string | symbol, L extends string = never> = Prettify<NamespaceTag.Of<T> & NamespaceLabel.OfIfExists<L>>;
|
|
15
|
+
/**
|
|
16
|
+
* Assign a brand to a value.
|
|
17
|
+
* Fails if the value is already branded.
|
|
18
|
+
*/
|
|
19
|
+
export type Assign<B extends Any, T> = T extends ErrorType<any> ? T : _Assign<B, HandleOriginalType<T>>;
|
|
20
|
+
/** Internal implementation of 'Brand.Assign' */
|
|
21
|
+
type _Assign<B extends Any, T> = NamespaceTag.HasTag<T> extends true ? ErrorType<Errors<B, T>['alreadyBranded']> : WithMetadata<T, B>;
|
|
22
|
+
/**
|
|
23
|
+
* Assign a brand if possible, otherwise return the original type.
|
|
24
|
+
*/
|
|
25
|
+
export type AssignSafe<B extends Any, T> = T extends ErrorType<any> ? T : _AssignSafe<B, HandleOriginalType<T>>;
|
|
26
|
+
/** Internal implementation of 'Brand.AssignSafe' */
|
|
27
|
+
type _AssignSafe<B extends Any, T> = NamespaceTag.HasTag<T> extends true ? T : WithMetadata<T, B>;
|
|
28
|
+
/** Check whether value is branded with */
|
|
29
|
+
export type isBrand<T, B extends Any> = T extends B ? true : false;
|
|
30
|
+
export {};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=brand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brand.d.ts","sourceRoot":"","sources":["../../../src/types/composed/brand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,IAAI,cAAc,EAAE,GAAG,IAAI,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE5E;;;;;GAKG;AACH,yBAAiB,KAAK,CAAC;IACrB,gCAAgC;IAChC,MAAM,MAAM,GAAG,GAAG,YAAY,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAEnD,sBAAsB;IACtB,MAAM,MAAM,OAAO,CACjB,CAAC,SAAS,MAAM,GAAG,MAAM,EACzB,CAAC,SAAS,MAAM,GAAG,KAAK,IACtB,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhE;;;OAGG;IACH,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,IACjC,CAAC,SAAS,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;IAEnE,gDAAgD;IAChD,KAAK,OAAO,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,IAC3B,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,IAAI,GAC/B,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,GACzC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAEzB;;OAEG;IACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,IACrC,CAAC,SAAS,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;IAEvE,oDAAoD;IACpD,KAAK,WAAW,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,IAC/B,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,GAAG,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAE/D,0CAA0C;IAC1C,MAAM,MAAM,OAAO,CAAC,CAAC,EAAE,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC;;CACpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brand.js","sourceRoot":"","sources":["../../../src/types/composed/brand.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Phantom } from '../core';
|
|
2
|
+
/** --------------------------------------
|
|
3
|
+
* Phantom type helpers
|
|
4
|
+
* --------------------------------------- */
|
|
5
|
+
/**
|
|
6
|
+
* Attach or override phantom metadata while preserving
|
|
7
|
+
* the original runtime type.
|
|
8
|
+
*/
|
|
9
|
+
export type WithMetadata<T, Change extends object> = Phantom.StripPhantom<T> & {
|
|
10
|
+
__Phantom: Prettify<Merge<IfNever<Phantom.PhantomOf<T>>, Omit<IfNever<Phantom.PhantomOf<Change>>, '__Base'> & SetType<T>>>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Patch phantom metadata without touching the original type.
|
|
14
|
+
* Used when mutating metadata declarations themselves.
|
|
15
|
+
*/
|
|
16
|
+
export type PatchMetadata<T, Change extends object> = {
|
|
17
|
+
__Phantom: Prettify<Merge<IfNever<Phantom.PhantomOf<T>>, IfNever<Phantom.PhantomOf<Change>>>>;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Remove a metadata dimension while preserving the original type.
|
|
21
|
+
*/
|
|
22
|
+
export type WithoutMetadata<T, S extends string> = Phantom.StripPhantom<T> & {
|
|
23
|
+
__Phantom: Prettify<Omit<IfNever<Phantom.PhantomOf<T>>, S> & SetType<T>>;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Remove metadata without preserving original type information.
|
|
27
|
+
* Intended for internal cleanup.
|
|
28
|
+
*/
|
|
29
|
+
export type StripMetadata<T, S extends string> = {
|
|
30
|
+
__Phantom: Prettify<Omit<IfNever<Phantom.PhantomOf<T>>, S>>;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Update '__OriginalType' if the passed type is changed.
|
|
34
|
+
*/
|
|
35
|
+
export type HandleOriginalType<T> = Equals<Omit<Phantom.StripPhantom<T>, never>, Omit<T, '__Phantom'>> extends true ? T : Omit<T, '__Phantom'> & PatchMetadata<T, {
|
|
36
|
+
__Phantom: {
|
|
37
|
+
__OriginalType?: Omit<T, '__Phantom'>;
|
|
38
|
+
};
|
|
39
|
+
}>;
|
|
40
|
+
/**
|
|
41
|
+
* Attaches or updates the original runtime type metadata
|
|
42
|
+
* for a nominal value.
|
|
43
|
+
*
|
|
44
|
+
* If the type already carries an `__OriginalType`, it is preserved.
|
|
45
|
+
* Otherwise, the provided type is stored as the original type.
|
|
46
|
+
*
|
|
47
|
+
* This is used to maintain a stable runtime type while layering
|
|
48
|
+
* additional phantom metadata.
|
|
49
|
+
*/
|
|
50
|
+
type SetType<T> = T extends {
|
|
51
|
+
__Phantom: {
|
|
52
|
+
__OriginalType?: infer O;
|
|
53
|
+
};
|
|
54
|
+
} ? {
|
|
55
|
+
__OriginalType?: O;
|
|
56
|
+
} : {
|
|
57
|
+
__OriginalType?: T;
|
|
58
|
+
};
|
|
59
|
+
/** --------------------------------------
|
|
60
|
+
* Generic helpers
|
|
61
|
+
* --------------------------------------- */
|
|
62
|
+
/** Prettify type */
|
|
63
|
+
export type Prettify<T> = {
|
|
64
|
+
[K in keyof T]: K extends '__Phantom' | '__Traits' ? Prettify<T[K]> : T[K];
|
|
65
|
+
} & {};
|
|
66
|
+
/** Check equality and returns true or false */
|
|
67
|
+
export type Equals<A1 extends any, A2 extends any> = (<A>() => A extends A2 ? true : false) extends <A>() => A extends A1 ? true : false ? true : false;
|
|
68
|
+
/** Type to replace 'never' with another type */
|
|
69
|
+
export type IfNever<T, R = {}> = [T] extends [never] ? R : T;
|
|
70
|
+
/** Get intersection from union */
|
|
71
|
+
export type IntersectOf<U extends any> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
72
|
+
/** Merge two objects. if matching keys between the two exists, the second object key value is used. */
|
|
73
|
+
type Merge<O1 extends object, O2 extends object> = Prettify<Omit<O1, keyof O2> & O2>;
|
|
74
|
+
export {};
|
|
75
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/types/composed/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC;;6CAE6C;AAE7C;;;GAGG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,MAAM,SAAS,MAAM,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG;IAC7E,SAAS,EAAE,QAAQ,CACjB,KAAK,CACH,OAAO,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