@fncts/schema 0.0.15 → 0.0.17
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/AST.d.ts +19 -6
- package/ASTAnnotation.d.ts +10 -2
- package/ParseError/ParseError.d.ts +231 -0
- package/ParseError/ParseErrorFormatter.d.ts +2 -0
- package/ParseError/PathFormatter.d.ts +13 -0
- package/ParseError/TreeFormatter.d.ts +14 -0
- package/ParseError.d.ts +4 -144
- package/ParseResult.d.ts +1 -8
- package/Parser/interpreter.d.ts +0 -1
- package/Schema/api/conc.d.ts +0 -2
- package/Schema/api/hashMap.d.ts +0 -1
- package/Schema/api/hashSet.d.ts +0 -1
- package/Schema/api/immutableArray.d.ts +0 -1
- package/Schema/api/list.d.ts +1 -2
- package/Schema/api/map.d.ts +19 -0
- package/Schema/api/set.d.ts +19 -0
- package/Schema/api.d.ts +12 -2
- package/Schema/derivations.d.ts +1 -1
- package/Schema.d.ts +2 -0
- package/Show.d.ts +7 -3
- package/_cjs/AST.cjs +180 -113
- package/_cjs/AST.cjs.map +1 -1
- package/_cjs/ASTAnnotation.cjs +6 -1
- package/_cjs/ASTAnnotation.cjs.map +1 -1
- package/_cjs/Gen.cjs +24 -24
- package/_cjs/Gen.cjs.map +1 -1
- package/_cjs/ParseError/ParseError.cjs +260 -0
- package/_cjs/ParseError/ParseError.cjs.map +1 -0
- package/_cjs/ParseError/ParseErrorFormatter.cjs +6 -0
- package/_cjs/ParseError/ParseErrorFormatter.cjs.map +1 -0
- package/_cjs/ParseError/PathFormatter.cjs +94 -0
- package/_cjs/ParseError/PathFormatter.cjs.map +1 -0
- package/_cjs/ParseError/TreeFormatter.cjs +123 -0
- package/_cjs/ParseError/TreeFormatter.cjs.map +1 -0
- package/_cjs/ParseError.cjs +43 -289
- package/_cjs/ParseError.cjs.map +1 -1
- package/_cjs/ParseResult.cjs +1 -10
- package/_cjs/ParseResult.cjs.map +1 -1
- package/_cjs/Parser/api.cjs +2 -2
- package/_cjs/Parser/api.cjs.map +1 -1
- package/_cjs/Parser/definition.cjs +1 -1
- package/_cjs/Parser/interpreter.cjs +121 -117
- package/_cjs/Parser/interpreter.cjs.map +1 -1
- package/_cjs/Schema/api/conc.cjs +35 -45
- package/_cjs/Schema/api/conc.cjs.map +1 -1
- package/_cjs/Schema/api/either.cjs +24 -30
- package/_cjs/Schema/api/either.cjs.map +1 -1
- package/_cjs/Schema/api/hashMap.cjs +41 -101
- package/_cjs/Schema/api/hashMap.cjs.map +1 -1
- package/_cjs/Schema/api/hashSet.cjs +46 -106
- package/_cjs/Schema/api/hashSet.cjs.map +1 -1
- package/_cjs/Schema/api/immutableArray.cjs +22 -48
- package/_cjs/Schema/api/immutableArray.cjs.map +1 -1
- package/_cjs/Schema/api/list.cjs +35 -52
- package/_cjs/Schema/api/list.cjs.map +1 -1
- package/_cjs/Schema/api/map.cjs +97 -0
- package/_cjs/Schema/api/map.cjs.map +1 -0
- package/_cjs/Schema/api/maybe.cjs +24 -35
- package/_cjs/Schema/api/maybe.cjs.map +1 -1
- package/_cjs/Schema/api/set.cjs +76 -0
- package/_cjs/Schema/api/set.cjs.map +1 -0
- package/_cjs/Schema/api.cjs +21 -3
- package/_cjs/Schema/api.cjs.map +1 -1
- package/_cjs/Schema.cjs +22 -0
- package/_cjs/Schema.cjs.map +1 -1
- package/_cjs/Show.cjs +106 -89
- package/_cjs/Show.cjs.map +1 -1
- package/_cjs/utils.cjs +5 -0
- package/_cjs/utils.cjs.map +1 -1
- package/_mjs/AST.mjs +177 -112
- package/_mjs/AST.mjs.map +1 -1
- package/_mjs/ASTAnnotation.mjs +5 -0
- package/_mjs/ASTAnnotation.mjs.map +1 -1
- package/_mjs/Gen.mjs +24 -24
- package/_mjs/Gen.mjs.map +1 -1
- package/_mjs/ParseError/ParseError.mjs +228 -0
- package/_mjs/ParseError/ParseError.mjs.map +1 -0
- package/_mjs/ParseError/ParseErrorFormatter.mjs +2 -0
- package/_mjs/ParseError/ParseErrorFormatter.mjs.map +1 -0
- package/_mjs/ParseError/PathFormatter.mjs +86 -0
- package/_mjs/ParseError/PathFormatter.mjs.map +1 -0
- package/_mjs/ParseError/TreeFormatter.mjs +113 -0
- package/_mjs/ParseError/TreeFormatter.mjs.map +1 -0
- package/_mjs/ParseError.mjs +6 -270
- package/_mjs/ParseError.mjs.map +1 -1
- package/_mjs/ParseResult.mjs +1 -9
- package/_mjs/ParseResult.mjs.map +1 -1
- package/_mjs/Parser/api.mjs +2 -2
- package/_mjs/Parser/api.mjs.map +1 -1
- package/_mjs/Parser/definition.mjs +1 -1
- package/_mjs/Parser/interpreter.mjs +121 -117
- package/_mjs/Parser/interpreter.mjs.map +1 -1
- package/_mjs/Schema/api/conc.mjs +35 -44
- package/_mjs/Schema/api/conc.mjs.map +1 -1
- package/_mjs/Schema/api/either.mjs +24 -30
- package/_mjs/Schema/api/either.mjs.map +1 -1
- package/_mjs/Schema/api/hashMap.mjs +41 -101
- package/_mjs/Schema/api/hashMap.mjs.map +1 -1
- package/_mjs/Schema/api/hashSet.mjs +46 -106
- package/_mjs/Schema/api/hashSet.mjs.map +1 -1
- package/_mjs/Schema/api/immutableArray.mjs +23 -49
- package/_mjs/Schema/api/immutableArray.mjs.map +1 -1
- package/_mjs/Schema/api/list.mjs +35 -52
- package/_mjs/Schema/api/list.mjs.map +1 -1
- package/_mjs/Schema/api/map.mjs +88 -0
- package/_mjs/Schema/api/map.mjs.map +1 -0
- package/_mjs/Schema/api/maybe.mjs +24 -35
- package/_mjs/Schema/api/maybe.mjs.map +1 -1
- package/_mjs/Schema/api/set.mjs +67 -0
- package/_mjs/Schema/api/set.mjs.map +1 -0
- package/_mjs/Schema/api.mjs +19 -3
- package/_mjs/Schema/api.mjs.map +1 -1
- package/_mjs/Schema.mjs +2 -0
- package/_mjs/Schema.mjs.map +1 -1
- package/_mjs/Show.mjs +106 -90
- package/_mjs/Show.mjs.map +1 -1
- package/_mjs/utils.mjs +4 -0
- package/_mjs/utils.mjs.map +1 -1
- package/_src/AST.ts +144 -43
- package/_src/ASTAnnotation.ts +8 -1
- package/_src/Gen.ts +12 -9
- package/_src/ParseError/ParseError.ts +304 -0
- package/_src/ParseError/ParseErrorFormatter.ts +1 -0
- package/_src/ParseError/PathFormatter.ts +117 -0
- package/_src/ParseError/TreeFormatter.ts +127 -0
- package/_src/ParseError.ts +7 -331
- package/_src/ParseResult.ts +2 -9
- package/_src/Parser/api.ts +1 -1
- package/_src/Parser/interpreter.ts +98 -75
- package/_src/Schema/api/conc.ts +33 -42
- package/_src/Schema/api/either.ts +20 -30
- package/_src/Schema/api/hashMap.ts +40 -124
- package/_src/Schema/api/hashSet.ts +31 -117
- package/_src/Schema/api/immutableArray.ts +15 -45
- package/_src/Schema/api/list.ts +32 -55
- package/_src/Schema/api/map.ts +93 -0
- package/_src/Schema/api/maybe.ts +19 -34
- package/_src/Schema/api/set.ts +74 -0
- package/_src/Schema/api.ts +21 -3
- package/_src/Schema/derivations.ts +1 -1
- package/_src/Schema.ts +2 -0
- package/_src/Show.ts +156 -128
- package/_src/global.ts +0 -4
- package/_src/utils.ts +5 -0
- package/global.d.ts +0 -4
- package/package.json +2 -2
- package/utils.d.ts +1 -0
- package/ParseFailure.d.ts +0 -18
- package/_cjs/ParseFailure.cjs +0 -28
- package/_cjs/ParseFailure.cjs.map +0 -1
- package/_mjs/ParseFailure.mjs +0 -20
- package/_mjs/ParseFailure.mjs.map +0 -1
- package/_src/ParseFailure.ts +0 -18
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Schema } from "@fncts/schema/Schema/definition";
|
|
2
|
+
import { Check } from "@fncts/typelevel";
|
|
3
|
+
import { Parser } from "@fncts/schema/Parser/definition";
|
|
4
|
+
import { Gen } from "@fncts/test/control/Gen";
|
|
5
|
+
/**
|
|
6
|
+
* @tsplus static fncts.schema.SchemaOps map
|
|
7
|
+
* @tsplus location "@fncts/schema/Schema/api/set"
|
|
8
|
+
*/
|
|
9
|
+
export declare function set<V>(value: Schema<V>): Schema<Set<V>>;
|
|
10
|
+
/**
|
|
11
|
+
* @tsplus static fncts.schema.SchemaOps mapFromRecord
|
|
12
|
+
* @tsplus location "@fncts/schema/Schema/api/set"
|
|
13
|
+
*/
|
|
14
|
+
export declare function setFromArray<V>(value: Schema<V>): Schema<Set<V>>;
|
|
15
|
+
/**
|
|
16
|
+
* @tsplus derive fncts.schema.Schema[fncts.Set]<_> 10
|
|
17
|
+
* @tsplus location "@fncts/schema/Schema/api/set"
|
|
18
|
+
*/
|
|
19
|
+
export declare function deriveSet<A extends Set<any>>(...[value]: [A] extends [Set<infer V>] ? Check<Check.IsEqual<A, Set<V>>> extends Check.True ? [value: Schema<V>] : never : never): Schema<A>;
|
package/Schema/api.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export declare function annotate<V>(annotation: ASTAnnotation<V>, value: V): <A>
|
|
|
24
24
|
* @tsplus static fncts.schema.SchemaOps declaration
|
|
25
25
|
* @tsplus location "@fncts/schema/Schema/api"
|
|
26
26
|
*/
|
|
27
|
-
export declare function declaration(typeParameters: Vector<Schema<any>>,
|
|
27
|
+
export declare function declaration(typeParameters: Vector<Schema<any>>, decode: (...typeParameters: ReadonlyArray<Schema<any>>) => Parser<any>, encode: (...typeParameters: ReadonlyArray<Schema<any>>) => Parser<any>, annotations?: ASTAnnotationMap): Schema<any>;
|
|
28
28
|
/**
|
|
29
29
|
* @tsplus pipeable fncts.schema.Schema filter
|
|
30
30
|
* @tsplus location "@fncts/schema/Schema/api"
|
|
@@ -126,8 +126,8 @@ export declare const date: Schema<Date>;
|
|
|
126
126
|
*/
|
|
127
127
|
export declare const implicitDate: Schema<Date>;
|
|
128
128
|
/**
|
|
129
|
-
* @tsplus static fncts.schema.SchemaOps union
|
|
130
129
|
* @tsplus derive fncts.schema.Schema<|> 30
|
|
130
|
+
* @tsplus static fncts.schema.SchemaOps union
|
|
131
131
|
* @tsplus location "@fncts/schema/Schema/api"
|
|
132
132
|
*/
|
|
133
133
|
export declare function union<A extends ReadonlyArray<unknown>>(...members: {
|
|
@@ -251,3 +251,13 @@ export declare function transformOrFail<A, B>(to: Schema<B>, decode: (input: A,
|
|
|
251
251
|
* @tsplus location "@fncts/schema/Schema/api"
|
|
252
252
|
*/
|
|
253
253
|
export declare function transform<A, B>(to: Schema<B>, decode: (input: A, options?: ParseOptions) => B, encode: (input: B, options?: ParseOptions) => A): (from: Schema<A>) => Schema<B>;
|
|
254
|
+
/**
|
|
255
|
+
* @tsplus pipeable fncts.schema.Schema pick
|
|
256
|
+
* @tsplus location "@fncts/schema/Schema/api"
|
|
257
|
+
*/
|
|
258
|
+
export declare function pick<A, Keys extends ReadonlyArray<keyof A>>(...keys: Keys): (self: Schema<A>) => Schema<Pick<A, Keys[number]>>;
|
|
259
|
+
/**
|
|
260
|
+
* @tsplus pipeable fncts.schema.Schema omit
|
|
261
|
+
* @tsplus location "@fncts/schema/Schema/api"
|
|
262
|
+
*/
|
|
263
|
+
export declare function omit<A, Keys extends ReadonlyArray<keyof A>>(...keys: Keys): (self: Schema<A>) => Schema<Omit<A, Keys[number]>>;
|
package/Schema/derivations.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export declare function deriveStruct<A extends Record<string, any>>(...[required
|
|
|
35
35
|
],
|
|
36
36
|
...([OptionalKeys<A>] extends [never] ? [optionalFields: {}] : [
|
|
37
37
|
optionalFields: {
|
|
38
|
-
[k in OptionalKeys<A>]: Schema<
|
|
38
|
+
[k in OptionalKeys<A>]: Schema<A[k]>;
|
|
39
39
|
}
|
|
40
40
|
]),
|
|
41
41
|
...([MaybeKeys<A>] extends [never] ? [] : [
|
package/Schema.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export * from "./Schema/derivations.js";
|
|
2
2
|
export * from "./Schema/definition.js";
|
|
3
3
|
export * from "./Schema/api.js";
|
|
4
|
+
export * from "./Schema/api/set.js";
|
|
4
5
|
export * from "./Schema/api/maybe.js";
|
|
6
|
+
export * from "./Schema/api/map.js";
|
|
5
7
|
export * from "./Schema/api/list.js";
|
|
6
8
|
export * from "./Schema/api/immutableArray.js";
|
|
7
9
|
export * from "./Schema/api/hashSet.js";
|
package/Show.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { AST } from "@fncts/schema/AST";
|
|
2
|
-
import { Eval } from "@fncts/base/control/Eval/definition";
|
|
3
2
|
import { Schema } from "@fncts/schema/Schema/definition";
|
|
4
3
|
/**
|
|
5
|
-
* @tsplus
|
|
4
|
+
* @tsplus pipeable fncts.schema.Schema show
|
|
6
5
|
* @tsplus location "@fncts/schema/Show"
|
|
7
6
|
*/
|
|
8
|
-
export declare function show<A>(self: Schema<A>)
|
|
7
|
+
export declare function show(verbose?: boolean): <A>(self: Schema<A>) => string;
|
|
8
|
+
/**
|
|
9
|
+
* @tsplus pipeable fncts.schema.AST show
|
|
10
|
+
* @tsplus location "@fncts/schema/Show"
|
|
11
|
+
*/
|
|
12
|
+
export declare function showAST(verbose?: boolean): (self: AST) => string;
|