@fncts/base 0.0.33 → 0.0.35
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/_cjs/collection/immutable/Conc/api.cjs +1 -4
- package/_cjs/collection/immutable/Conc/api.cjs.map +1 -1
- package/_cjs/collection/immutable/HashMap/api.cjs +4 -7
- package/_cjs/collection/immutable/HashMap/api.cjs.map +1 -1
- package/_cjs/collection/immutable/HashSet/api.cjs +4 -7
- package/_cjs/collection/immutable/HashSet/api.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableArray/api.cjs +6 -9
- package/_cjs/collection/immutable/ImmutableArray/api.cjs.map +1 -1
- package/_cjs/collection/immutable/ImmutableArray/instances.cjs.map +1 -1
- package/_cjs/control/Pure/api.cjs +8 -20
- package/_cjs/control/Pure/api.cjs.map +1 -1
- package/_cjs/data/Cause/api.cjs +2 -8
- package/_cjs/data/Cause/api.cjs.map +1 -1
- package/_cjs/data/Data.cjs +121 -0
- package/_cjs/data/Data.cjs.map +1 -0
- package/_cjs/data/Datum/api.cjs +2 -8
- package/_cjs/data/Datum/api.cjs.map +1 -1
- package/_cjs/data/DatumEither/api.cjs +2 -8
- package/_cjs/data/DatumEither/api.cjs.map +1 -1
- package/_cjs/data/Either/api.cjs +6 -24
- package/_cjs/data/Either/api.cjs.map +1 -1
- package/_cjs/data/Either/definition.cjs +1 -0
- package/_cjs/data/Either/definition.cjs.map +1 -1
- package/_cjs/data/Either/destructors.cjs +3 -3
- package/_cjs/data/Either/destructors.cjs.map +1 -1
- package/_cjs/data/Either/instances.cjs +7 -27
- package/_cjs/data/Either/instances.cjs.map +1 -1
- package/_cjs/data/EitherT/api.cjs +2 -8
- package/_cjs/data/EitherT/api.cjs.map +1 -1
- package/_cjs/data/Exit/api.cjs +3 -3
- package/_cjs/data/Exit/api.cjs.map +1 -1
- package/_cjs/data/Exit/constructors.cjs +1 -4
- package/_cjs/data/Exit/constructors.cjs.map +1 -1
- package/_cjs/data/Exit/definition.cjs +2 -0
- package/_cjs/data/Exit/definition.cjs.map +1 -1
- package/_cjs/data/Guard/api.cjs +4 -2
- package/_cjs/data/Guard/api.cjs.map +1 -1
- package/_cjs/data/Maybe/api.cjs +1 -4
- package/_cjs/data/Maybe/api.cjs.map +1 -1
- package/_cjs/data/Maybe/definition.cjs +1 -0
- package/_cjs/data/Maybe/definition.cjs.map +1 -1
- package/_cjs/data/Maybe/instances.cjs +13 -46
- package/_cjs/data/Maybe/instances.cjs.map +1 -1
- package/_cjs/data/Showable/show.cjs.map +1 -1
- package/_cjs/data/Tag/definition.cjs +8 -0
- package/_cjs/data/Tag/definition.cjs.map +1 -1
- package/_cjs/data/These/instances.cjs +0 -11
- package/_cjs/data/These/instances.cjs.map +1 -1
- package/_cjs/json/EitherJson.cjs +0 -18
- package/_cjs/json/EitherJson.cjs.map +1 -1
- package/_cjs/json/MaybeJson.cjs +0 -16
- package/_cjs/json/MaybeJson.cjs.map +1 -1
- package/_cjs/json/TheseJson.cjs +0 -22
- package/_cjs/json/TheseJson.cjs.map +1 -1
- package/_cjs/optics/Optional/definition.cjs +1 -4
- package/_cjs/optics/Optional/definition.cjs.map +1 -1
- package/_cjs/optics/Prism/definition.cjs +1 -4
- package/_cjs/optics/Prism/definition.cjs.map +1 -1
- package/_cjs/typeclass/MonadExcept.cjs +1 -4
- package/_cjs/typeclass/MonadExcept.cjs.map +1 -1
- package/_mjs/collection/immutable/Conc/api.mjs +1 -4
- package/_mjs/collection/immutable/Conc/api.mjs.map +1 -1
- package/_mjs/collection/immutable/HashMap/api.mjs +4 -7
- package/_mjs/collection/immutable/HashMap/api.mjs.map +1 -1
- package/_mjs/collection/immutable/HashSet/api.mjs +4 -7
- package/_mjs/collection/immutable/HashSet/api.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableArray/api.mjs +6 -9
- package/_mjs/collection/immutable/ImmutableArray/api.mjs.map +1 -1
- package/_mjs/collection/immutable/ImmutableArray/instances.mjs.map +1 -1
- package/_mjs/control/Pure/api.mjs +8 -20
- package/_mjs/control/Pure/api.mjs.map +1 -1
- package/_mjs/data/Cause/api.mjs +2 -8
- package/_mjs/data/Cause/api.mjs.map +1 -1
- package/_mjs/data/Data.mjs +110 -0
- package/_mjs/data/Data.mjs.map +1 -0
- package/_mjs/data/Datum/api.mjs +2 -8
- package/_mjs/data/Datum/api.mjs.map +1 -1
- package/_mjs/data/DatumEither/api.mjs +2 -8
- package/_mjs/data/DatumEither/api.mjs.map +1 -1
- package/_mjs/data/Either/api.mjs +6 -24
- package/_mjs/data/Either/api.mjs.map +1 -1
- package/_mjs/data/Either/definition.mjs +1 -0
- package/_mjs/data/Either/definition.mjs.map +1 -1
- package/_mjs/data/Either/destructors.mjs +3 -3
- package/_mjs/data/Either/destructors.mjs.map +1 -1
- package/_mjs/data/Either/instances.mjs +6 -25
- package/_mjs/data/Either/instances.mjs.map +1 -1
- package/_mjs/data/EitherT/api.mjs +2 -8
- package/_mjs/data/EitherT/api.mjs.map +1 -1
- package/_mjs/data/Exit/api.mjs +2 -2
- package/_mjs/data/Exit/api.mjs.map +1 -1
- package/_mjs/data/Exit/constructors.mjs +1 -4
- package/_mjs/data/Exit/constructors.mjs.map +1 -1
- package/_mjs/data/Exit/definition.mjs +2 -0
- package/_mjs/data/Exit/definition.mjs.map +1 -1
- package/_mjs/data/Guard/api.mjs +5 -3
- package/_mjs/data/Guard/api.mjs.map +1 -1
- package/_mjs/data/Maybe/api.mjs +1 -4
- package/_mjs/data/Maybe/api.mjs.map +1 -1
- package/_mjs/data/Maybe/definition.mjs +1 -0
- package/_mjs/data/Maybe/definition.mjs.map +1 -1
- package/_mjs/data/Maybe/instances.mjs +0 -31
- package/_mjs/data/Maybe/instances.mjs.map +1 -1
- package/_mjs/data/Showable/show.mjs.map +1 -1
- package/_mjs/data/Tag/definition.mjs +7 -0
- package/_mjs/data/Tag/definition.mjs.map +1 -1
- package/_mjs/data/These/instances.mjs +0 -10
- package/_mjs/data/These/instances.mjs.map +1 -1
- package/_mjs/json/EitherJson.mjs +0 -15
- package/_mjs/json/EitherJson.mjs.map +1 -1
- package/_mjs/json/MaybeJson.mjs +0 -13
- package/_mjs/json/MaybeJson.mjs.map +1 -1
- package/_mjs/json/TheseJson.mjs +0 -19
- package/_mjs/json/TheseJson.mjs.map +1 -1
- package/_mjs/optics/Optional/definition.mjs +1 -4
- package/_mjs/optics/Optional/definition.mjs.map +1 -1
- package/_mjs/optics/Prism/definition.mjs +1 -4
- package/_mjs/optics/Prism/definition.mjs.map +1 -1
- package/_mjs/typeclass/MonadExcept.mjs +1 -4
- package/_mjs/typeclass/MonadExcept.mjs.map +1 -1
- package/_src/collection/immutable/Conc/api.ts +4 -4
- package/_src/collection/immutable/HashMap/api.ts +4 -4
- package/_src/collection/immutable/HashSet/api.ts +4 -4
- package/_src/collection/immutable/ImmutableArray/api.ts +4 -4
- package/_src/collection/immutable/ImmutableArray/instances.ts +0 -2
- package/_src/control/Pure/api.ts +4 -7
- package/_src/control.ts +0 -2
- package/_src/data/Cause/api.ts +8 -8
- package/_src/data/Data.ts +144 -0
- package/_src/data/Datum/api.ts +8 -8
- package/_src/data/DatumEither/api.ts +8 -8
- package/_src/data/Either/api.ts +18 -18
- package/_src/data/Either/definition.ts +2 -1
- package/_src/data/Either/destructors.ts +3 -3
- package/_src/data/Either/instances.ts +12 -31
- package/_src/data/EitherT/api.ts +8 -8
- package/_src/data/Exit/api.ts +2 -2
- package/_src/data/Exit/constructors.ts +1 -1
- package/_src/data/Exit/definition.ts +2 -0
- package/_src/data/Guard/api.ts +6 -3
- package/_src/data/Maybe/api.ts +4 -4
- package/_src/data/Maybe/definition.ts +1 -0
- package/_src/data/Maybe/instances.ts +0 -39
- package/_src/data/Showable/show.ts +1 -1
- package/_src/data/Tag/definition.ts +8 -0
- package/_src/data/These/instances.ts +0 -22
- package/_src/data.ts +1 -0
- package/_src/global.ts +0 -8
- package/_src/json/EitherJson.ts +0 -7
- package/_src/json/MaybeJson.ts +0 -7
- package/_src/json/TheseJson.ts +0 -7
- package/_src/optics/Optional/definition.ts +4 -4
- package/_src/optics/Prism/definition.ts +1 -1
- package/_src/typeclass/MonadExcept.ts +1 -1
- package/control.d.ts +0 -2
- package/data/Data.d.ts +31 -0
- package/data/Either/definition.d.ts +2 -1
- package/data/Either/destructors.d.ts +1 -4
- package/data/Either/instances.d.ts +0 -6
- package/data/Exit/api.d.ts +2 -2
- package/data/Exit/definition.d.ts +2 -0
- package/data/Guard/api.d.ts +1 -2
- package/data/Maybe/definition.d.ts +1 -0
- package/data/Maybe/instances.d.ts +0 -12
- package/data/Showable/show.d.ts +1 -1
- package/data/Tag/definition.d.ts +5 -0
- package/data/These/instances.d.ts +0 -6
- package/data.d.ts +1 -0
- package/global.d.ts +0 -8
- package/json/EitherJson.d.ts +0 -6
- package/json/MaybeJson.d.ts +0 -6
- package/json/TheseJson.d.ts +0 -6
- package/package.json +2 -2
- package/_cjs/control/CompletablePromise.cjs +0 -21
- package/_cjs/control/CompletablePromise.cjs.map +0 -1
- package/_cjs/control/InterruptiblePromise.cjs +0 -23
- package/_cjs/control/InterruptiblePromise.cjs.map +0 -1
- package/_cjs/data/DecodeError/definition.cjs +0 -240
- package/_cjs/data/DecodeError/definition.cjs.map +0 -1
- package/_cjs/data/DecodeError/instances.cjs +0 -6
- package/_cjs/data/DecodeError/instances.cjs.map +0 -1
- package/_cjs/data/DecodeError.cjs +0 -28
- package/_cjs/data/DecodeError.cjs.map +0 -1
- package/_cjs/data/Decoder/api.cjs +0 -572
- package/_cjs/data/Decoder/api.cjs.map +0 -1
- package/_cjs/data/Decoder/definition.cjs +0 -30
- package/_cjs/data/Decoder/definition.cjs.map +0 -1
- package/_cjs/data/Decoder.cjs +0 -28
- package/_cjs/data/Decoder.cjs.map +0 -1
- package/_cjs/data/Encoder/api.cjs +0 -315
- package/_cjs/data/Encoder/api.cjs.map +0 -1
- package/_cjs/data/Encoder/definition.cjs +0 -22
- package/_cjs/data/Encoder/definition.cjs.map +0 -1
- package/_cjs/data/Encoder.cjs +0 -28
- package/_cjs/data/Encoder.cjs.map +0 -1
- package/_mjs/control/CompletablePromise.mjs +0 -15
- package/_mjs/control/CompletablePromise.mjs.map +0 -1
- package/_mjs/control/InterruptiblePromise.mjs +0 -15
- package/_mjs/control/InterruptiblePromise.mjs.map +0 -1
- package/_mjs/data/DecodeError/definition.mjs +0 -209
- package/_mjs/data/DecodeError/definition.mjs.map +0 -1
- package/_mjs/data/DecodeError/instances.mjs +0 -2
- package/_mjs/data/DecodeError/instances.mjs.map +0 -1
- package/_mjs/data/DecodeError.mjs +0 -5
- package/_mjs/data/DecodeError.mjs.map +0 -1
- package/_mjs/data/Decoder/api.mjs +0 -542
- package/_mjs/data/Decoder/api.mjs.map +0 -1
- package/_mjs/data/Decoder/definition.mjs +0 -22
- package/_mjs/data/Decoder/definition.mjs.map +0 -1
- package/_mjs/data/Decoder.mjs +0 -5
- package/_mjs/data/Decoder.mjs.map +0 -1
- package/_mjs/data/Encoder/api.mjs +0 -279
- package/_mjs/data/Encoder/api.mjs.map +0 -1
- package/_mjs/data/Encoder/definition.mjs +0 -15
- package/_mjs/data/Encoder/definition.mjs.map +0 -1
- package/_mjs/data/Encoder.mjs +0 -5
- package/_mjs/data/Encoder.mjs.map +0 -1
- package/_src/control/CompletablePromise.ts +0 -23
- package/_src/control/InterruptiblePromise.ts +0 -23
- package/_src/data/DecodeError/definition.ts +0 -267
- package/_src/data/DecodeError/instances.ts +0 -0
- package/_src/data/DecodeError.ts +0 -5
- package/_src/data/Decoder/api.ts +0 -696
- package/_src/data/Decoder/definition.ts +0 -31
- package/_src/data/Decoder.ts +0 -5
- package/_src/data/Encoder/api.ts +0 -381
- package/_src/data/Encoder/definition.ts +0 -16
- package/_src/data/Encoder.ts +0 -5
- package/control/CompletablePromise.d.ts +0 -13
- package/control/InterruptiblePromise.d.ts +0 -12
- package/data/DecodeError/definition.d.ts +0 -148
- package/data/DecodeError/instances.d.ts +0 -1
- package/data/DecodeError.d.ts +0 -2
- package/data/Decoder/api.d.ts +0 -214
- package/data/Decoder/definition.d.ts +0 -27
- package/data/Decoder.d.ts +0 -2
- package/data/Encoder/api.d.ts +0 -214
- package/data/Encoder/definition.d.ts +0 -16
- package/data/Encoder.d.ts +0 -2
package/data/Decoder/api.d.ts
DELETED
@@ -1,214 +0,0 @@
|
|
1
|
-
import { These } from "@fncts/base/data/These";
|
2
|
-
import { Guard } from "@fncts/base/data/Guard";
|
3
|
-
import { ImmutableArray } from "@fncts/base/collection/immutable/ImmutableArray/definition";
|
4
|
-
import { ImmutableNonEmptyArray } from "@fncts/base/collection/immutable/ImmutableNonEmptyArray/definition";
|
5
|
-
import { Conc } from "@fncts/base/collection/immutable/Conc";
|
6
|
-
import type { Brand, Validation } from "@fncts/base/data/Branded";
|
7
|
-
import type { DecodeError } from "@fncts/base/data/DecodeError";
|
8
|
-
import type { Literal } from "@fncts/typelevel/Any";
|
9
|
-
import type { Check } from "@fncts/typelevel/Check";
|
10
|
-
import type { OptionalKeys, RequiredKeys } from "@fncts/typelevel/Object";
|
11
|
-
import { Decoder } from "@fncts/base/data/Decoder/definition";
|
12
|
-
/**
|
13
|
-
* @tsplus pipeable fncts.Decoder __call
|
14
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
15
|
-
*/
|
16
|
-
export declare function decode(input: unknown): <A>(self: Decoder<A>) => These<DecodeError, A>;
|
17
|
-
export declare function fromGuard<A>(guard: Guard<A>, onFalse: (i: unknown) => DecodeError, label: string): Decoder<A>;
|
18
|
-
/**
|
19
|
-
* @tsplus implicit
|
20
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
21
|
-
*/
|
22
|
-
export declare const string: Decoder<string>;
|
23
|
-
/**
|
24
|
-
* @tsplus implicit
|
25
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
26
|
-
*/
|
27
|
-
export declare const number: Decoder<number>;
|
28
|
-
/**
|
29
|
-
* @tsplus implicit
|
30
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
31
|
-
*/
|
32
|
-
export declare const boolean: Decoder<boolean>;
|
33
|
-
/**
|
34
|
-
* @tsplus implicit
|
35
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
36
|
-
*/
|
37
|
-
export declare const bigint: Decoder<bigint>;
|
38
|
-
/**
|
39
|
-
* @tsplus static fncts.DecoderOps object
|
40
|
-
* @tsplus implicit
|
41
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
42
|
-
*/
|
43
|
-
export declare const object: Decoder<object>;
|
44
|
-
/**
|
45
|
-
* @tsplus static fncts.DecoderOps unknown
|
46
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
47
|
-
*/
|
48
|
-
export declare const unknown: Decoder<unknown>;
|
49
|
-
/**
|
50
|
-
* @tsplus static fncts.DecoderOps null
|
51
|
-
* @tsplus implicit
|
52
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
53
|
-
*/
|
54
|
-
export declare const _null: Decoder<null>;
|
55
|
-
/**
|
56
|
-
* @tsplus static fncts.DecoderOps undefined
|
57
|
-
* @tsplus implicit
|
58
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
59
|
-
*/
|
60
|
-
export declare const _undefined: Decoder<undefined>;
|
61
|
-
/**
|
62
|
-
* @tsplus static fncts.DecoderOps nullable
|
63
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
64
|
-
*/
|
65
|
-
export declare function nullable<A>(/** @tsplus implicit local */ base: Decoder<A>): Decoder<A | null | undefined>;
|
66
|
-
/**
|
67
|
-
* @tsplus derive fncts.Decoder lazy
|
68
|
-
* @tsplus static fncts.DecoderOps lazy
|
69
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
70
|
-
*/
|
71
|
-
export declare function deriveLazy<A>(f: (_: Decoder<A>) => Decoder<A>): Decoder<A>;
|
72
|
-
/**
|
73
|
-
* @tsplus static fncts.DecoderOps literal
|
74
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
75
|
-
*/
|
76
|
-
export declare function literal<A extends Literal>(value: A): Decoder<A>;
|
77
|
-
/**
|
78
|
-
* @tsplus derive fncts.Decoder<_> 20
|
79
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
80
|
-
*/
|
81
|
-
export declare function deriveLiteral<A extends string | number | boolean>(...[value]: Check<Check.IsLiteral<A> & Check.Not<Check.IsUnion<A>>> extends Check.True ? [value: A] : never): Decoder<A>;
|
82
|
-
/**
|
83
|
-
* @tsplus static fncts.DecoderOps union
|
84
|
-
* @tsplus derive fncts.Decoder<|> 30
|
85
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
86
|
-
*/
|
87
|
-
export declare function union<A extends ReadonlyArray<unknown>>(...elements: {
|
88
|
-
[K in keyof A]: Decoder<A[K]>;
|
89
|
-
}): Decoder<A[number]>;
|
90
|
-
/**
|
91
|
-
* @tsplus static fncts.DecoderOps struct
|
92
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
93
|
-
*/
|
94
|
-
export declare function struct<A extends Record<string, any>>(fields: {
|
95
|
-
[K in keyof A]: Decoder<A[K]>;
|
96
|
-
}): Decoder<A>;
|
97
|
-
/**
|
98
|
-
* @tsplus static fncts.DecoderOps partial
|
99
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
100
|
-
*/
|
101
|
-
export declare function partial<A extends Record<string, any>>(fields: {
|
102
|
-
[K in keyof A]: Decoder<A[K]>;
|
103
|
-
}): Decoder<Partial<A>>;
|
104
|
-
/**
|
105
|
-
* @tsplus derive fncts.Decoder<_> 20
|
106
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
107
|
-
*/
|
108
|
-
export declare function deriveStruct<A extends Record<string, any>>(...[requiredFields, optionalFields]: Check<Check.IsStruct<A>> extends Check.True ? [
|
109
|
-
...[
|
110
|
-
requiredFields: {
|
111
|
-
[k in RequiredKeys<A>]: Decoder<A[k]>;
|
112
|
-
}
|
113
|
-
],
|
114
|
-
...([OptionalKeys<A>] extends [never] ? [] : [
|
115
|
-
optionalFields: {
|
116
|
-
[k in OptionalKeys<A>]: Decoder<NonNullable<A[k]>>;
|
117
|
-
}
|
118
|
-
])
|
119
|
-
] : never): Decoder<A>;
|
120
|
-
/**
|
121
|
-
* @tsplus derive fncts.Decoder[fncts.Array]<_> 10
|
122
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
123
|
-
*/
|
124
|
-
export declare function deriveArray<A extends Array<any>>(...[element]: [A] extends [Array<infer _A>] ? Check<Check.IsEqual<A, Array<_A>>> extends Check.True ? [element: Decoder<_A>] : never : never): Decoder<A>;
|
125
|
-
/**
|
126
|
-
* @tsplus static fncts.DecoderOps array
|
127
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
128
|
-
*/
|
129
|
-
export declare function array<A>(base: Decoder<A>): Decoder<Array<A>>;
|
130
|
-
/**
|
131
|
-
* @tsplus derive fncts.Decoder[fncts.ReadonlyArray]<_> 10
|
132
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
133
|
-
*/
|
134
|
-
export declare function deriveReadonlyArray<A extends ReadonlyArray<any>>(...[element]: [A] extends [ReadonlyArray<infer _A>] ? Check<Check.IsEqual<A, ReadonlyArray<_A>>> extends Check.True ? [element: Decoder<_A>] : never : never): Decoder<A>;
|
135
|
-
/**
|
136
|
-
* @tsplus static fncts.DecoderOps readonlyArray
|
137
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
138
|
-
*/
|
139
|
-
export declare function readonlyArray<A>(base: Decoder<A>): Decoder<ReadonlyArray<A>>;
|
140
|
-
/**
|
141
|
-
* @tsplus derive fncts.Decoder<_> 15
|
142
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
143
|
-
*/
|
144
|
-
export declare function deriveRecord<A extends Record<string, any>>(...[keyGuard, valueDecoder, requiredKeysRecord]: [A] extends [Record<infer X, infer Y>] ? Check<Check.Not<Check.IsUnion<A>> & Check.IsEqual<A, Record<X, Y>>> extends Check.True ? [
|
145
|
-
keyGuard: Guard<X>,
|
146
|
-
valueDecoder: Decoder<Y>,
|
147
|
-
requiredKeysRecord: {
|
148
|
-
[k in X]: 0;
|
149
|
-
}
|
150
|
-
] : never : never): Decoder<A>;
|
151
|
-
/**
|
152
|
-
* @tsplus static fncts.DecoderOps record
|
153
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
154
|
-
*/
|
155
|
-
export declare function record<A>(codomain: Decoder<A>): Decoder<Record<string, A>>;
|
156
|
-
/**
|
157
|
-
* @tsplus derive fncts.Decoder[fncts.ImmutableArray]<_> 10
|
158
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
159
|
-
*/
|
160
|
-
export declare function deriveImmutableArray<A extends ImmutableArray<any>>(...[array, elem]: [A] extends [ImmutableArray<infer _A>] ? Check<Check.IsEqual<A, ImmutableArray<_A>>> extends Check.True ? [array: Decoder<Array<_A>>, elem: Decoder<_A>] : never : never): Decoder<A>;
|
161
|
-
/**
|
162
|
-
* @tsplus static fncts.DecoderOps immutableArray
|
163
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
164
|
-
*/
|
165
|
-
export declare function immutableArray<A>(base: Decoder<A>): Decoder<ImmutableArray<A>>;
|
166
|
-
/**
|
167
|
-
* @tsplus derive fncts.Decoder[fncts.ImmutableNonEmptyArray]<_> 10
|
168
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
169
|
-
*/
|
170
|
-
export declare function deriveImmutableNonEmptyArray<A extends ImmutableNonEmptyArray<any>>(...[array, elem]: [A] extends [ImmutableNonEmptyArray<infer _A>] ? Check<Check.IsEqual<A, ImmutableNonEmptyArray<_A>>> extends Check.True ? [array: Decoder<Array<_A>>, elem: Decoder<_A>] : never : never): Decoder<A>;
|
171
|
-
/**
|
172
|
-
* @tsplus static fncts.DecoderOps immutableNonEmptyArray
|
173
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
174
|
-
*/
|
175
|
-
export declare function immutableNonEmptyArray<A>(base: Decoder<A>): Decoder<ImmutableNonEmptyArray<A>>;
|
176
|
-
/**
|
177
|
-
* @tsplus derive fncts.Decoder[fncts.Conc]<_> 10
|
178
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
179
|
-
*/
|
180
|
-
export declare function deriveConc<A extends Conc<any>>(...[array, elem]: [A] extends [Conc<infer _A>] ? Check<Check.IsEqual<A, Conc<_A>>> extends Check.True ? [array: Decoder<Array<_A>>, elem: Decoder<_A>] : never : never): Decoder<A>;
|
181
|
-
/**
|
182
|
-
* @tsplus static fncts.DecoderOps conc
|
183
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
184
|
-
*/
|
185
|
-
export declare function conc<A>(base: Decoder<A>): Decoder<Conc<A>>;
|
186
|
-
/**
|
187
|
-
* @tsplus derive fncts.Decoder<_> 10
|
188
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
189
|
-
*/
|
190
|
-
export declare function deriveValidation<A extends Brand.Valid<any, any>>(...[base, brands]: Check<Brand.IsValidated<A>> extends Check.True ? [
|
191
|
-
base: Decoder<Brand.Unbranded<A>>,
|
192
|
-
brands: {
|
193
|
-
[K in keyof A[Brand.valid] & string]: Validation<A[Brand.valid][K], K>;
|
194
|
-
}
|
195
|
-
] : never): Decoder<A>;
|
196
|
-
/**
|
197
|
-
* @tsplus static fncts.DecoderOps validation
|
198
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
199
|
-
*/
|
200
|
-
export declare function validation<A, B extends ReadonlyArray<Validation<A, any>>>(...validations: B): (base: Decoder<A>) => Decoder<A & { [K in keyof B]: B[K] extends Validation<any, infer S extends string> ? Brand.Valid<A, S> : never; }[number]>;
|
201
|
-
/**
|
202
|
-
* @tsplus derive fncts.Decoder<_> 10
|
203
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
204
|
-
*/
|
205
|
-
export declare function deriveTuple<A extends ReadonlyArray<unknown>>(...[components]: Check<Check.IsTuple<A>> extends Check.True ? [components: {
|
206
|
-
[K in keyof A]: Decoder<A[K]>;
|
207
|
-
}] : never): Decoder<A>;
|
208
|
-
/**
|
209
|
-
* @tsplus static fncts.DecoderOps tuple
|
210
|
-
* @tsplus location "@fncts/base/data/Decoder/api"
|
211
|
-
*/
|
212
|
-
export declare function tuple<A extends ReadonlyArray<unknown>>(...components: {
|
213
|
-
[K in keyof A]: Decoder<A[K]>;
|
214
|
-
}): Decoder<A>;
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import { HKT } from "@fncts/typelevel/HKT";
|
2
|
-
import { These } from "@fncts/base/data/These";
|
3
|
-
import type { DecodeError } from "@fncts/base/data/DecodeError";
|
4
|
-
export declare const DecoderTypeId: unique symbol;
|
5
|
-
export type DecoderTypeId = typeof DecoderTypeId;
|
6
|
-
export interface DecoderF extends HKT {
|
7
|
-
type: Decoder<this["A"]>;
|
8
|
-
variance: {
|
9
|
-
A: "+";
|
10
|
-
};
|
11
|
-
}
|
12
|
-
/**
|
13
|
-
* @tsplus type fncts.Decoder
|
14
|
-
* @tsplus companion fncts.DecoderOps
|
15
|
-
* @tsplus derive nominal
|
16
|
-
*/
|
17
|
-
export declare class Decoder<in out A> {
|
18
|
-
readonly decode: (input: unknown) => These<DecodeError, A>;
|
19
|
-
readonly label: string;
|
20
|
-
readonly [DecoderTypeId]: DecoderTypeId;
|
21
|
-
constructor(decode: (input: unknown) => These<DecodeError, A>, label: string);
|
22
|
-
}
|
23
|
-
/**
|
24
|
-
* @tsplus static fncts.DecoderOps __call
|
25
|
-
* @tsplus location "@fncts/base/data/Decoder/definition"
|
26
|
-
*/
|
27
|
-
export declare function makeDecoder<A>(decode: (input: unknown) => These<DecodeError, A>, label: string): Decoder<A>;
|
package/data/Decoder.d.ts
DELETED
package/data/Encoder/api.d.ts
DELETED
@@ -1,214 +0,0 @@
|
|
1
|
-
import { Guard } from "@fncts/base/data/Guard";
|
2
|
-
import { ImmutableArray } from "@fncts/base/collection/immutable/ImmutableArray/definition";
|
3
|
-
import { ImmutableNonEmptyArray } from "@fncts/base/collection/immutable/ImmutableNonEmptyArray/definition";
|
4
|
-
import { Conc } from "@fncts/base/collection/immutable/Conc";
|
5
|
-
import type { Brand, Validation } from "../Branded.js";
|
6
|
-
import type { Check } from "@fncts/typelevel";
|
7
|
-
import type { Literal } from "@fncts/typelevel/Any";
|
8
|
-
import type { OptionalKeys, RequiredKeys } from "@fncts/typelevel/Object";
|
9
|
-
import { Encoder } from "./definition.js";
|
10
|
-
/**
|
11
|
-
* @tsplus static fncts.EncoderOps __call
|
12
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
13
|
-
*/
|
14
|
-
export declare function makeEncoder<A>(encode: (inp: A) => unknown): Encoder<A>;
|
15
|
-
/**
|
16
|
-
* @tsplus static fncts.EncoderOps unknown
|
17
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
18
|
-
*/
|
19
|
-
export declare const unknown: Encoder<unknown>;
|
20
|
-
/**
|
21
|
-
* @tsplus implicit
|
22
|
-
* @tsplus static fncts.EncoderOps boolean
|
23
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
24
|
-
*/
|
25
|
-
export declare const boolean: Encoder<boolean>;
|
26
|
-
/**
|
27
|
-
* @tsplus implicit
|
28
|
-
* @tsplus static fncts.EncoderOps number
|
29
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
30
|
-
*/
|
31
|
-
export declare const number: Encoder<number>;
|
32
|
-
/**
|
33
|
-
* @tsplus implicit
|
34
|
-
* @tsplus static fncts.EncoderOps string
|
35
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
36
|
-
*/
|
37
|
-
export declare const string: Encoder<string>;
|
38
|
-
/**
|
39
|
-
* @tsplus implicit
|
40
|
-
* @tsplus static fncts.EncoderOps bigint
|
41
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
42
|
-
*/
|
43
|
-
export declare const bigint: Encoder<bigint>;
|
44
|
-
/**
|
45
|
-
* @tsplus implicit
|
46
|
-
* @tsplus static fncts.EncoderOps null
|
47
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
48
|
-
*/
|
49
|
-
export declare const _null: Encoder<null>;
|
50
|
-
/**
|
51
|
-
* @tsplus implicit
|
52
|
-
* @tsplus static fncts.EncoderOps undefined
|
53
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
54
|
-
*/
|
55
|
-
export declare const _undefined: Encoder<undefined>;
|
56
|
-
/**
|
57
|
-
* @tsplus implicit
|
58
|
-
* @tsplus static fncts.EncoderOps date
|
59
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
60
|
-
*/
|
61
|
-
export declare const date: Encoder<Date>;
|
62
|
-
/**
|
63
|
-
* @tsplus derive fncts.Encoder lazy
|
64
|
-
* @tsplus static fncts.EncoderOps lazy
|
65
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
66
|
-
*/
|
67
|
-
export declare function deriveLazy<A>(fn: (_: Encoder<A>) => Encoder<A>): Encoder<A>;
|
68
|
-
export declare function deriveLiteral<A extends string | number | boolean>(...[value]: Check<Check.IsLiteral<A> & Check.Not<Check.IsUnion<A>>> extends Check.True ? [value: A] : never): Encoder<A>;
|
69
|
-
/**
|
70
|
-
* @tsplus static fncts.EncoderOps literal
|
71
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
72
|
-
*/
|
73
|
-
export declare function literal<A extends Literal>(value: A): Encoder<A>;
|
74
|
-
/**
|
75
|
-
* @tsplus static fncts.EncoderOps nullable
|
76
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
77
|
-
*/
|
78
|
-
export declare function nullable<A>(/** @tsplus implicit local */ base: Encoder<A>): Encoder<A | null | undefined>;
|
79
|
-
/**
|
80
|
-
* @tsplus derive fncts.Encoder<_> 20
|
81
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
82
|
-
*/
|
83
|
-
export declare function deriveStruct<A extends Record<string, any>>(...[requiredFields, optionalFields]: Check<Check.IsStruct<A>> extends Check.True ? [
|
84
|
-
...[
|
85
|
-
requiredFields: {
|
86
|
-
[K in RequiredKeys<A>]: Encoder<A[K]>;
|
87
|
-
}
|
88
|
-
],
|
89
|
-
...([OptionalKeys<A>] extends [never] ? [] : [
|
90
|
-
optionalFields: {
|
91
|
-
[K in OptionalKeys<A>]: Encoder<NonNullable<A[K]>>;
|
92
|
-
}
|
93
|
-
])
|
94
|
-
] : never): Encoder<A>;
|
95
|
-
/**
|
96
|
-
* @tsplus static fncts.EncoderOps struct
|
97
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
98
|
-
*/
|
99
|
-
export declare function struct<A extends Record<string, any>>(fields: {
|
100
|
-
[K in keyof A]: Encoder<A[K]>;
|
101
|
-
}): Encoder<A>;
|
102
|
-
/**
|
103
|
-
* @tsplus static fncts.EncoderOps partial
|
104
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
105
|
-
*/
|
106
|
-
export declare function partial<A extends Record<string, any>>(fields: {
|
107
|
-
[K in keyof A]: Encoder<A[K]>;
|
108
|
-
}): Encoder<Partial<A>>;
|
109
|
-
/**
|
110
|
-
* @tsplus derive fncts.Encoder<|> 30
|
111
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
112
|
-
*/
|
113
|
-
export declare function deriveUnion<A extends Array<unknown>>(...elements: {
|
114
|
-
[K in keyof A]: [Guard<A[K]>, Encoder<A[K]>];
|
115
|
-
}): Encoder<A[number]>;
|
116
|
-
/**
|
117
|
-
* @tsplus derive fncts.Encoder<_> 10
|
118
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
119
|
-
*/
|
120
|
-
export declare function deriveEmptyRecord<A extends {}>(..._: Check<Check.IsEqual<A, {}>> extends Check.True ? [] : never): Encoder<A>;
|
121
|
-
/**
|
122
|
-
* @tsplus derive fncts.Encoder[fncts.Array]<_> 10
|
123
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
124
|
-
*/
|
125
|
-
export declare function deriveArray<A extends Array<any>>(...[element]: [A] extends [Array<infer _A>] ? Check<Check.IsEqual<A, Array<_A>>> extends Check.True ? [element: Encoder<_A>] : never : never): Encoder<A>;
|
126
|
-
/**
|
127
|
-
* @tsplus static fncts.EncoderOps array
|
128
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
129
|
-
*/
|
130
|
-
export declare function array<A>(/** @tsplus implicit local */ base: Encoder<A>): Encoder<Array<A>>;
|
131
|
-
/**
|
132
|
-
* @tsplus derive fncts.Encoder[fncts.ReadonlyArray]<_> 10
|
133
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
134
|
-
*/
|
135
|
-
export declare function deriveReadonlyArray<A extends ReadonlyArray<any>>(...[element]: [A] extends [ReadonlyArray<infer _A>] ? Check<Check.IsEqual<A, ReadonlyArray<_A>>> extends Check.True ? [element: Encoder<_A>] : never : never): Encoder<A>;
|
136
|
-
/**
|
137
|
-
* @tsplus static fncts.EncoderOps readonlyArray
|
138
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
139
|
-
*/
|
140
|
-
export declare function readonlyArray<A>(/** @tsplus implicit local */ base: Encoder<A>): Encoder<ReadonlyArray<A>>;
|
141
|
-
/**
|
142
|
-
* @tsplus derive fncts.Encoder<_> 15
|
143
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
144
|
-
*/
|
145
|
-
export declare function deriveDictionary<A extends Record<string, any>>(...[value]: Check<Check.IsDictionary<A>> extends Check.True ? [value: Encoder<A[keyof A]>] : never): Encoder<A>;
|
146
|
-
/**
|
147
|
-
* @tsplus derive fncts.Encoder<_> 15
|
148
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
149
|
-
*/
|
150
|
-
export declare function deriveRecord<A extends Record<string, any>>(...[value, requiredKeys]: Check<Check.IsRecord<A>> extends Check.True ? [
|
151
|
-
value: Encoder<A[keyof A]>,
|
152
|
-
requiredKeys: {
|
153
|
-
[K in keyof A]: 0;
|
154
|
-
}
|
155
|
-
] : never): Encoder<A>;
|
156
|
-
/**
|
157
|
-
* @tsplus static fncts.EncoderOps record
|
158
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
159
|
-
*/
|
160
|
-
export declare function record<A>(codomain: Encoder<A>): Encoder<Record<string, A>>;
|
161
|
-
/**
|
162
|
-
* @tsplus derive fncts.Encoder[fncts.ImmutableArray]<_> 10
|
163
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
164
|
-
*/
|
165
|
-
export declare function deriveImmutableArray<A extends ImmutableArray<any>>(...[element]: [A] extends [ImmutableArray<infer _A>] ? Check<Check.IsEqual<A, ImmutableArray<_A>>> extends Check.True ? [element: Encoder<_A>] : never : never): Encoder<A>;
|
166
|
-
/**
|
167
|
-
* @tsplus static fncts.EncoderOps immutableArray
|
168
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
169
|
-
*/
|
170
|
-
export declare function immutableArray<A>(base: Encoder<A>): Encoder<ImmutableArray<A>>;
|
171
|
-
/**
|
172
|
-
* @tsplus derive fncts.Encoder[fncts.ImmutableNonEmptyArray]<_> 10
|
173
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
174
|
-
*/
|
175
|
-
export declare function deriveImmutableNonEmptyArray<A extends ImmutableNonEmptyArray<any>>(...[element]: [A] extends [ImmutableNonEmptyArray<infer _A>] ? Check<Check.IsEqual<A, ImmutableNonEmptyArray<_A>>> extends Check.True ? [element: Encoder<_A>] : never : never): Encoder<A>;
|
176
|
-
/**
|
177
|
-
* @tsplus static fncts.EncoderOps immutableNonEmptyArray
|
178
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
179
|
-
*/
|
180
|
-
export declare function immutableNonEmptyArray<A>(base: Encoder<A>): Encoder<ImmutableNonEmptyArray<A>>;
|
181
|
-
/**
|
182
|
-
* @tsplus derive fncts.Encoder[fncts.Conc]<_> 10
|
183
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
184
|
-
*/
|
185
|
-
export declare function deriveConc<A extends Conc<any>>(...[element]: [A] extends [Conc<infer _A>] ? Check<Check.IsEqual<A, Conc<_A>>> extends Check.True ? [element: Encoder<_A>] : never : never): Encoder<A>;
|
186
|
-
/**
|
187
|
-
* @tsplus static fncts.EncoderOps conc
|
188
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
189
|
-
*/
|
190
|
-
export declare function conc<A>(base: Encoder<A>): Encoder<Conc<A>>;
|
191
|
-
/**
|
192
|
-
* @tsplus derive fncts.Encoder<_> 10
|
193
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
194
|
-
*/
|
195
|
-
export declare function deriveValidation<A extends Brand.Valid<any, any>>(...[base]: Check<Brand.IsValidated<A>> extends Check.True ? [base: Encoder<Brand.Unbranded<A>>] : never): Encoder<A>;
|
196
|
-
/**
|
197
|
-
* @tsplus static fncts.EncoderOps validation
|
198
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
199
|
-
*/
|
200
|
-
export declare function validation<A, B extends ReadonlyArray<Validation<A, any>>>(..._validations: B): (base: Encoder<A>) => Encoder<A & { [K in keyof B]: B[K] extends Validation<any, infer S extends string> ? Brand.Valid<A, S> : never; }[number]>;
|
201
|
-
/**
|
202
|
-
* @tsplus derive fncts.Encoder<_> 10
|
203
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
204
|
-
*/
|
205
|
-
export declare function deriveTuple<A extends ReadonlyArray<unknown>>(...[components]: Check<Check.IsTuple<A>> extends Check.True ? [components: {
|
206
|
-
[K in keyof A]: Encoder<A[K]>;
|
207
|
-
}] : never): Encoder<A>;
|
208
|
-
/**
|
209
|
-
* @tsplus static fncts.EncoderOps tuple
|
210
|
-
* @tsplus location "@fncts/base/data/Encoder/api"
|
211
|
-
*/
|
212
|
-
export declare function tuple<A extends ReadonlyArray<unknown>>(...components: {
|
213
|
-
[K in keyof A]: Encoder<A[K]>;
|
214
|
-
}): Encoder<A>;
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import { HKT } from "@fncts/typelevel/HKT";
|
2
|
-
export declare const EncoderTypeId: unique symbol;
|
3
|
-
export type EncoderTypeId = typeof EncoderTypeId;
|
4
|
-
/**
|
5
|
-
* @tsplus type fncts.Encoder
|
6
|
-
* @tsplus companion fncts.EncoderOps
|
7
|
-
* @tsplus derive nominal
|
8
|
-
*/
|
9
|
-
export declare class Encoder<in out A> {
|
10
|
-
readonly encode: (inp: A) => unknown;
|
11
|
-
readonly [EncoderTypeId]: EncoderTypeId;
|
12
|
-
constructor(encode: (inp: A) => unknown);
|
13
|
-
}
|
14
|
-
export interface EncoderF extends HKT {
|
15
|
-
readonly type: Encoder<this["A"]>;
|
16
|
-
}
|
package/data/Encoder.d.ts
DELETED