@fncts/schema 0.0.5 → 0.0.6
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 +528 -0
- package/ASTAnnotation.d.ts +82 -0
- package/ASTAnnotationMap.d.ts +14 -0
- package/Gen.d.ts +15 -0
- package/InvalidInterpretationError.d.ts +5 -0
- package/ParseError.d.ts +107 -0
- package/ParseResult.d.ts +24 -0
- package/Parser/api.d.ts +42 -0
- package/Parser/definition.d.ts +22 -0
- package/Parser/interpreter.d.ts +6 -0
- package/Parser.d.ts +2 -0
- package/Schema/api/conc.d.ts +18 -0
- package/Schema/api/hashMap.d.ts +21 -0
- package/Schema/api/immutableArray.d.ts +23 -0
- package/Schema/api/list.d.ts +23 -0
- package/Schema/api/maybe.d.ts +21 -0
- package/Schema/api.d.ts +243 -0
- package/Schema/definition.d.ts +29 -0
- package/Schema/derivations.d.ts +70 -0
- package/Schema.d.ts +2 -144
- package/_cjs/AST.cjs +1171 -0
- package/_cjs/AST.cjs.map +1 -0
- package/_cjs/ASTAnnotation.cjs +111 -0
- package/_cjs/ASTAnnotation.cjs.map +1 -0
- package/_cjs/ASTAnnotationMap.cjs +35 -0
- package/_cjs/ASTAnnotationMap.cjs.map +1 -0
- package/_cjs/Gen.cjs +185 -0
- package/_cjs/Gen.cjs.map +1 -0
- package/_cjs/InvalidInterpretationError.cjs +18 -0
- package/_cjs/InvalidInterpretationError.cjs.map +1 -0
- package/_cjs/ParseError.cjs +222 -0
- package/_cjs/ParseError.cjs.map +1 -0
- package/_cjs/{Decoder.cjs → ParseResult.cjs} +24 -22
- package/_cjs/ParseResult.cjs.map +1 -0
- package/_cjs/Parser/api.cjs +80 -0
- package/_cjs/Parser/api.cjs.map +1 -0
- package/_cjs/{Guard.cjs → Parser/definition.cjs} +17 -22
- package/_cjs/Parser/definition.cjs.map +1 -0
- package/_cjs/Parser/interpreter.cjs +409 -0
- package/_cjs/Parser/interpreter.cjs.map +1 -0
- package/_cjs/Parser.cjs +28 -0
- package/_cjs/Parser.cjs.map +1 -0
- package/_cjs/Schema/api/conc.cjs +84 -0
- package/_cjs/Schema/api/conc.cjs.map +1 -0
- package/_cjs/Schema/api/hashMap.cjs +161 -0
- package/_cjs/Schema/api/hashMap.cjs.map +1 -0
- package/_cjs/Schema/api/immutableArray.cjs +90 -0
- package/_cjs/Schema/api/immutableArray.cjs.map +1 -0
- package/_cjs/Schema/api/list.cjs +98 -0
- package/_cjs/Schema/api/list.cjs.map +1 -0
- package/_cjs/Schema/api/maybe.cjs +75 -0
- package/_cjs/Schema/api/maybe.cjs.map +1 -0
- package/_cjs/Schema/api.cjs +424 -0
- package/_cjs/Schema/api.cjs.map +1 -0
- package/_cjs/Schema/definition.cjs +26 -0
- package/_cjs/Schema/definition.cjs.map +1 -0
- package/_cjs/Schema/derivations.cjs +108 -0
- package/_cjs/Schema/derivations.cjs.map +1 -0
- package/_cjs/Schema.cjs +20 -237
- package/_cjs/Schema.cjs.map +1 -1
- package/_cjs/utils.cjs +52 -0
- package/_cjs/utils.cjs.map +1 -0
- package/_mjs/AST.mjs +1060 -0
- package/_mjs/AST.mjs.map +1 -0
- package/_mjs/ASTAnnotation.mjs +80 -0
- package/_mjs/ASTAnnotation.mjs.map +1 -0
- package/_mjs/ASTAnnotationMap.mjs +27 -0
- package/_mjs/ASTAnnotationMap.mjs.map +1 -0
- package/_mjs/Gen.mjs +176 -0
- package/_mjs/Gen.mjs.map +1 -0
- package/_mjs/InvalidInterpretationError.mjs +10 -0
- package/_mjs/InvalidInterpretationError.mjs.map +1 -0
- package/_mjs/ParseError.mjs +200 -0
- package/_mjs/ParseError.mjs.map +1 -0
- package/_mjs/ParseResult.mjs +21 -0
- package/_mjs/ParseResult.mjs.map +1 -0
- package/_mjs/Parser/api.mjs +67 -0
- package/_mjs/Parser/api.mjs.map +1 -0
- package/_mjs/Parser/definition.mjs +15 -0
- package/_mjs/Parser/definition.mjs.map +1 -0
- package/_mjs/Parser/interpreter.mjs +401 -0
- package/_mjs/Parser/interpreter.mjs.map +1 -0
- package/_mjs/Parser.mjs +4 -0
- package/_mjs/Parser.mjs.map +1 -0
- package/_mjs/Schema/api/conc.mjs +72 -0
- package/_mjs/Schema/api/conc.mjs.map +1 -0
- package/_mjs/Schema/api/hashMap.mjs +150 -0
- package/_mjs/Schema/api/hashMap.mjs.map +1 -0
- package/_mjs/Schema/api/immutableArray.mjs +79 -0
- package/_mjs/Schema/api/immutableArray.mjs.map +1 -0
- package/_mjs/Schema/api/list.mjs +87 -0
- package/_mjs/Schema/api/list.mjs.map +1 -0
- package/_mjs/Schema/api/maybe.mjs +64 -0
- package/_mjs/Schema/api/maybe.mjs.map +1 -0
- package/_mjs/Schema/api.mjs +367 -0
- package/_mjs/Schema/api.mjs.map +1 -0
- package/_mjs/Schema/definition.mjs +16 -0
- package/_mjs/Schema/definition.mjs.map +1 -0
- package/_mjs/Schema/derivations.mjs +94 -0
- package/_mjs/Schema/derivations.mjs.map +1 -0
- package/_mjs/Schema.mjs +3 -212
- package/_mjs/Schema.mjs.map +1 -1
- package/_mjs/utils.mjs +41 -0
- package/_mjs/utils.mjs.map +1 -0
- package/_src/AST.ts +1353 -0
- package/_src/ASTAnnotation.ts +98 -0
- package/_src/ASTAnnotationMap.ts +38 -0
- package/_src/Gen.ts +171 -0
- package/_src/InvalidInterpretationError.ts +6 -0
- package/_src/ParseError.ts +237 -0
- package/_src/ParseResult.ts +26 -0
- package/_src/Parser/api.ts +71 -0
- package/_src/Parser/definition.ts +24 -0
- package/_src/Parser/interpreter.ts +442 -0
- package/_src/Parser.ts +4 -0
- package/_src/Schema/api/conc.ts +78 -0
- package/_src/Schema/api/hashMap.ts +184 -0
- package/_src/Schema/api/immutableArray.ts +88 -0
- package/_src/Schema/api/list.ts +96 -0
- package/_src/Schema/api/maybe.ts +68 -0
- package/_src/Schema/api.ts +530 -0
- package/_src/Schema/definition.ts +32 -0
- package/_src/Schema/derivations.ts +185 -0
- package/_src/Schema.ts +4 -254
- package/_src/global.ts +53 -0
- package/_src/utils.ts +48 -0
- package/global.d.ts +52 -0
- package/package.json +2 -2
- package/utils.d.ts +8 -0
- package/Decoder.d.ts +0 -3
- package/Encoder.d.ts +0 -4
- package/Guard.d.ts +0 -3
- package/Schemable.d.ts +0 -39
- package/_cjs/Decoder.cjs.map +0 -1
- package/_cjs/Encoder.cjs +0 -45
- package/_cjs/Encoder.cjs.map +0 -1
- package/_cjs/Guard.cjs.map +0 -1
- package/_cjs/Schemable.cjs +0 -6
- package/_cjs/Schemable.cjs.map +0 -1
- package/_mjs/Decoder.mjs +0 -20
- package/_mjs/Decoder.mjs.map +0 -1
- package/_mjs/Encoder.mjs +0 -36
- package/_mjs/Encoder.mjs.map +0 -1
- package/_mjs/Guard.mjs +0 -20
- package/_mjs/Guard.mjs.map +0 -1
- package/_mjs/Schemable.mjs +0 -2
- package/_mjs/Schemable.mjs.map +0 -1
- package/_src/Decoder.ts +0 -20
- package/_src/Encoder.ts +0 -38
- package/_src/Guard.ts +0 -20
- package/_src/Schemable.ts +0 -46
package/AST.d.ts
ADDED
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
|
2
|
+
import { Vector } from "@fncts/base/collection/immutable/Vector";
|
|
3
|
+
import { ParseResult } from "@fncts/schema/ParseResult";
|
|
4
|
+
import type { Validation as ValidationType } from "@fncts/base/data/Branded";
|
|
5
|
+
import { ASTAnnotation } from "./ASTAnnotation.js";
|
|
6
|
+
import { ASTAnnotationMap } from "./ASTAnnotationMap.js";
|
|
7
|
+
export declare const ASTTypeId: unique symbol;
|
|
8
|
+
export type ASTTypeId = typeof ASTTypeId;
|
|
9
|
+
export declare abstract class Annotated {
|
|
10
|
+
readonly annotations: ASTAnnotationMap;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @tsplus type fncts.schema.AST
|
|
14
|
+
* @tsplus companion fncts.schema.ASTOps
|
|
15
|
+
*/
|
|
16
|
+
export declare abstract class AST extends Annotated {
|
|
17
|
+
readonly [ASTTypeId]: ASTTypeId;
|
|
18
|
+
abstract clone(newProperties: Partial<this>): AST;
|
|
19
|
+
}
|
|
20
|
+
export declare namespace AST {
|
|
21
|
+
interface Compiler<A> {
|
|
22
|
+
(ast: AST): A;
|
|
23
|
+
}
|
|
24
|
+
type Match<A> = {
|
|
25
|
+
[K in Concrete["_tag"]]: (ast: Extract<Concrete, {
|
|
26
|
+
_tag: K;
|
|
27
|
+
}>, compile: Compiler<A>) => A;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export declare const enum ASTTag {
|
|
31
|
+
Declaration = 0,
|
|
32
|
+
Literal = 1,
|
|
33
|
+
UniqueSymbol = 2,
|
|
34
|
+
UndefinedKeyword = 3,
|
|
35
|
+
VoidKeyword = 4,
|
|
36
|
+
NeverKeyword = 5,
|
|
37
|
+
UnknownKeyword = 6,
|
|
38
|
+
AnyKeyword = 7,
|
|
39
|
+
StringKeyword = 8,
|
|
40
|
+
NumberKeyword = 9,
|
|
41
|
+
BooleanKeyword = 10,
|
|
42
|
+
BigIntKeyword = 11,
|
|
43
|
+
SymbolKeyword = 12,
|
|
44
|
+
ObjectKeyword = 13,
|
|
45
|
+
Enum = 14,
|
|
46
|
+
TemplateLiteral = 15,
|
|
47
|
+
Tuple = 16,
|
|
48
|
+
TypeLiteral = 17,
|
|
49
|
+
Union = 18,
|
|
50
|
+
Lazy = 19,
|
|
51
|
+
Refinement = 20,
|
|
52
|
+
Transform = 21,
|
|
53
|
+
Validation = 22
|
|
54
|
+
}
|
|
55
|
+
export type Concrete = Declaration | Literal | UniqueSymbol | UndefinedKeyword | VoidKeyword | NeverKeyword | UnknownKeyword | AnyKeyword | StringKeyword | NumberKeyword | BooleanKeyword | BigIntKeyword | SymbolKeyword | ObjectKeyword | Enum | TemplateLiteral | Tuple | TypeLiteral | Union | Lazy | Refinement | Transform | Validation;
|
|
56
|
+
/**
|
|
57
|
+
* @tsplus static fncts.schema.ASTOps concrete
|
|
58
|
+
* @tsplus macro remove
|
|
59
|
+
* @tsplus location "@fncts/schema/AST"
|
|
60
|
+
*/
|
|
61
|
+
export declare function concrete(_: AST): asserts _ is Concrete;
|
|
62
|
+
export declare function getAnnotations<V>(key: ASTAnnotation<V>): (self: Annotated) => Maybe<V>;
|
|
63
|
+
export declare class Declaration extends AST {
|
|
64
|
+
readonly typeParameters: Vector<AST>;
|
|
65
|
+
readonly type: AST;
|
|
66
|
+
readonly decode: (...typeParameters: ReadonlyArray<AST>) => (input: any, options?: ParseOptions) => ParseResult<any>;
|
|
67
|
+
readonly annotations: ASTAnnotationMap;
|
|
68
|
+
readonly _tag = ASTTag.Declaration;
|
|
69
|
+
constructor(typeParameters: Vector<AST>, type: AST, decode: (...typeParameters: ReadonlyArray<AST>) => (input: any, options?: ParseOptions) => ParseResult<any>, annotations?: ASTAnnotationMap);
|
|
70
|
+
clone(newProperties: Partial<this>): AST;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* @tsplus static fncts.schema.ASTOps createDeclaration
|
|
74
|
+
* @tsplus location "@fncts/schema/AST"
|
|
75
|
+
*/
|
|
76
|
+
export declare function createDeclaration(typeParameters: Vector<AST>, type: AST, decode: (...typeParameters: ReadonlyArray<AST>) => (input: any, options?: ParseOptions) => ParseResult<any>, annotations?: ASTAnnotationMap): Declaration;
|
|
77
|
+
/**
|
|
78
|
+
* @tsplus fluent fncts.schema.AST isDeclaration
|
|
79
|
+
* @tsplus location "@fncts/schema/AST"
|
|
80
|
+
*/
|
|
81
|
+
export declare function isDeclaration(self: AST): self is Declaration;
|
|
82
|
+
export type LiteralValue = string | number | boolean | null | bigint;
|
|
83
|
+
export declare class Literal extends AST {
|
|
84
|
+
readonly literal: LiteralValue;
|
|
85
|
+
readonly annotations: ASTAnnotationMap;
|
|
86
|
+
readonly _tag = ASTTag.Literal;
|
|
87
|
+
constructor(literal: LiteralValue, annotations?: ASTAnnotationMap);
|
|
88
|
+
clone(newProperties: Partial<this>): AST;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* @tsplus static fncts.schema.ASTOps createLiteral
|
|
92
|
+
* @tsplus location "@fncts/schema/AST"
|
|
93
|
+
*/
|
|
94
|
+
export declare function createLiteral(literal: LiteralValue, annotations?: ASTAnnotationMap): Literal;
|
|
95
|
+
/**
|
|
96
|
+
* @tsplus fluent fncts.schema.AST isLiteral
|
|
97
|
+
* @tsplus location "@fncts/schema/AST"
|
|
98
|
+
*/
|
|
99
|
+
export declare function isLiteral(self: AST): self is Literal;
|
|
100
|
+
export declare class UniqueSymbol extends AST {
|
|
101
|
+
readonly symbol: symbol;
|
|
102
|
+
readonly annotations: ASTAnnotationMap;
|
|
103
|
+
readonly _tag = ASTTag.UniqueSymbol;
|
|
104
|
+
constructor(symbol: symbol, annotations?: ASTAnnotationMap);
|
|
105
|
+
clone(newProperties: Partial<this>): AST;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* @tsplus static fncts.schema.ASTOps createUniqueSymbol
|
|
109
|
+
* @tsplus location "@fncts/schema/AST"
|
|
110
|
+
*/
|
|
111
|
+
export declare function createUniqueSymbol(symbol: symbol, annotations?: ASTAnnotationMap): UniqueSymbol;
|
|
112
|
+
/**
|
|
113
|
+
* @tsplus fluent fncts.schema.AST isUniqueSymbol
|
|
114
|
+
* @tsplus location "@fncts/schema/AST"
|
|
115
|
+
*/
|
|
116
|
+
export declare function isUniqueSymbol(self: AST): self is UniqueSymbol;
|
|
117
|
+
export declare class UndefinedKeyword extends AST {
|
|
118
|
+
readonly annotations: ASTAnnotationMap;
|
|
119
|
+
readonly _tag = ASTTag.UndefinedKeyword;
|
|
120
|
+
constructor(annotations?: ASTAnnotationMap);
|
|
121
|
+
clone(newProperties: Partial<this>): AST;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* @tsplus static fncts.schema.ASTOps undefinedKeyword
|
|
125
|
+
* @tsplus location "@fncts/schema/AST"
|
|
126
|
+
*/
|
|
127
|
+
export declare const undefinedKeyword: UndefinedKeyword;
|
|
128
|
+
export declare class VoidKeyword extends AST {
|
|
129
|
+
readonly annotations: ASTAnnotationMap;
|
|
130
|
+
readonly _tag = ASTTag.VoidKeyword;
|
|
131
|
+
constructor(annotations?: ASTAnnotationMap);
|
|
132
|
+
clone(newProperties: Partial<this>): AST;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* @tsplus static fncts.schema.ASTOps voidKeyword
|
|
136
|
+
* @tsplus location "@fncts/schema/AST"
|
|
137
|
+
*/
|
|
138
|
+
export declare const voidKeyword: VoidKeyword;
|
|
139
|
+
export declare class NeverKeyword extends AST {
|
|
140
|
+
readonly annotations: ASTAnnotationMap;
|
|
141
|
+
readonly _tag = ASTTag.NeverKeyword;
|
|
142
|
+
constructor(annotations?: ASTAnnotationMap);
|
|
143
|
+
clone(newProperties: Partial<this>): AST;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* @tsplus static fncts.schema.ASTOps neverKeyword
|
|
147
|
+
* @tsplus location "@fncts/schema/AST"
|
|
148
|
+
*/
|
|
149
|
+
export declare const neverKeyword: NeverKeyword;
|
|
150
|
+
export declare class UnknownKeyword extends AST {
|
|
151
|
+
readonly annotations: ASTAnnotationMap;
|
|
152
|
+
readonly _tag = ASTTag.UnknownKeyword;
|
|
153
|
+
constructor(annotations?: ASTAnnotationMap);
|
|
154
|
+
clone(newProperties: Partial<this>): AST;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* @tsplus static fncts.schema.ASTOps unknownKeyword
|
|
158
|
+
* @tsplus location "@fncts/schema/AST"
|
|
159
|
+
*/
|
|
160
|
+
export declare const unknownKeyword: UnknownKeyword;
|
|
161
|
+
export declare class AnyKeyword extends AST {
|
|
162
|
+
readonly annotations: ASTAnnotationMap;
|
|
163
|
+
readonly _tag = ASTTag.AnyKeyword;
|
|
164
|
+
constructor(annotations?: ASTAnnotationMap);
|
|
165
|
+
clone(newProperties: Partial<this>): AST;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* @tsplus static fncts.schema.ASTOps anyKeyword
|
|
169
|
+
* @tsplus location "@fncts/schema/AST"
|
|
170
|
+
*/
|
|
171
|
+
export declare const anyKeyword: AnyKeyword;
|
|
172
|
+
export declare class StringKeyword extends AST {
|
|
173
|
+
readonly annotations: ASTAnnotationMap;
|
|
174
|
+
readonly _tag = ASTTag.StringKeyword;
|
|
175
|
+
constructor(annotations?: ASTAnnotationMap);
|
|
176
|
+
clone(newProperties: Partial<this>): AST;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* @tsplus static fncts.schema.ASTOps stringKeyword
|
|
180
|
+
* @tsplus location "@fncts/schema/AST"
|
|
181
|
+
*/
|
|
182
|
+
export declare const stringKeyword: StringKeyword;
|
|
183
|
+
/**
|
|
184
|
+
* @tsplus fluent fncts.schema.AST isStringKeyword
|
|
185
|
+
* @tsplus location "@fncts/schema/AST"
|
|
186
|
+
*/
|
|
187
|
+
export declare function isStringKeyword(self: AST): self is StringKeyword;
|
|
188
|
+
export declare class NumberKeyword extends AST {
|
|
189
|
+
readonly annotations: ASTAnnotationMap;
|
|
190
|
+
readonly _tag = ASTTag.NumberKeyword;
|
|
191
|
+
constructor(annotations?: ASTAnnotationMap);
|
|
192
|
+
clone(newProperties: Partial<this>): AST;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* @tsplus static fncts.schema.ASTOps numberKeyword
|
|
196
|
+
* @tsplus location "@fncts/schema/AST"
|
|
197
|
+
*/
|
|
198
|
+
export declare const numberKeyword: NumberKeyword;
|
|
199
|
+
/**
|
|
200
|
+
* @tsplus fluent fncts.schema.AST isNumberKeyword
|
|
201
|
+
* @tsplus location "@fncts/schema/AST"
|
|
202
|
+
*/
|
|
203
|
+
export declare function isNumberKeyword(self: AST): self is NumberKeyword;
|
|
204
|
+
export declare class BooleanKeyword extends AST {
|
|
205
|
+
readonly annotations: ASTAnnotationMap;
|
|
206
|
+
readonly _tag = ASTTag.BooleanKeyword;
|
|
207
|
+
constructor(annotations?: ASTAnnotationMap);
|
|
208
|
+
clone(newProperties: Partial<this>): AST;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* @tsplus static fncts.schema.ASTOps booleanKeyword
|
|
212
|
+
* @tsplus location "@fncts/schema/AST"
|
|
213
|
+
*/
|
|
214
|
+
export declare const booleanKeyword: BooleanKeyword;
|
|
215
|
+
/**
|
|
216
|
+
* @tsplus fluent fncts.schema.AST isBooleanKeyword
|
|
217
|
+
* @tsplus location "@fncts/schema/AST"
|
|
218
|
+
*/
|
|
219
|
+
export declare function isBooleanKeyword(self: AST): self is BooleanKeyword;
|
|
220
|
+
export declare class BigIntKeyword extends AST {
|
|
221
|
+
readonly annotations: ASTAnnotationMap;
|
|
222
|
+
readonly _tag = ASTTag.BigIntKeyword;
|
|
223
|
+
constructor(annotations?: ASTAnnotationMap);
|
|
224
|
+
clone(newProperties: Partial<this>): AST;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* @tsplus static fncts.schema.ASTOps bigIntKeyword
|
|
228
|
+
* @tsplus location "@fncts/schema/AST"
|
|
229
|
+
*/
|
|
230
|
+
export declare const bigIntKeyword: BigIntKeyword;
|
|
231
|
+
/**
|
|
232
|
+
* @tsplus fluent fncts.schema.AST isBigIntKeyword
|
|
233
|
+
* @tsplus location "@fncts/schema/AST"
|
|
234
|
+
*/
|
|
235
|
+
export declare function isBigIntKeyword(self: AST): self is BigIntKeyword;
|
|
236
|
+
export declare class SymbolKeyword extends AST {
|
|
237
|
+
readonly annotations: ASTAnnotationMap;
|
|
238
|
+
readonly _tag = ASTTag.SymbolKeyword;
|
|
239
|
+
constructor(annotations?: ASTAnnotationMap);
|
|
240
|
+
clone(newProperties: Partial<this>): AST;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* @tsplus static fncts.schema.ASTOps symbolKeyword
|
|
244
|
+
* @tsplus location "@fncts/schema/AST"
|
|
245
|
+
*/
|
|
246
|
+
export declare const symbolKeyword: SymbolKeyword;
|
|
247
|
+
/**
|
|
248
|
+
* @tsplus fluent fncts.schema.AST isSymbolKeyword
|
|
249
|
+
* @tsplus location "@fncts/schema/AST"
|
|
250
|
+
*/
|
|
251
|
+
export declare function isSymbolKeyword(self: AST): self is SymbolKeyword;
|
|
252
|
+
export declare class ObjectKeyword extends AST {
|
|
253
|
+
readonly annotations: ASTAnnotationMap;
|
|
254
|
+
readonly _tag = ASTTag.ObjectKeyword;
|
|
255
|
+
constructor(annotations?: ASTAnnotationMap);
|
|
256
|
+
clone(newProperties: Partial<this>): AST;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* @tsplus static fncts.schema.ASTOps objectKeyword
|
|
260
|
+
* @tsplus location "@fncts/schema/AST"
|
|
261
|
+
*/
|
|
262
|
+
export declare const objectKeyword: ObjectKeyword;
|
|
263
|
+
export declare class Enum extends AST {
|
|
264
|
+
readonly enums: Vector<readonly [string, string | number]>;
|
|
265
|
+
readonly annotations: ASTAnnotationMap;
|
|
266
|
+
readonly _tag = ASTTag.Enum;
|
|
267
|
+
constructor(enums: Vector<readonly [string, string | number]>, annotations?: ASTAnnotationMap);
|
|
268
|
+
clone(newProperties: Partial<this>): AST;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* @tsplus static fncts.schema.ASTOps createEnum
|
|
272
|
+
* @tsplus location "@fncts/schema/AST"
|
|
273
|
+
*/
|
|
274
|
+
export declare function createEnum(enums: Vector<readonly [string, string | number]>, annotations?: ASTAnnotationMap): Enum;
|
|
275
|
+
export declare class TemplateLiteralSpan {
|
|
276
|
+
readonly type: StringKeyword | NumberKeyword;
|
|
277
|
+
readonly literal: string;
|
|
278
|
+
constructor(type: StringKeyword | NumberKeyword, literal: string);
|
|
279
|
+
}
|
|
280
|
+
export declare class TemplateLiteral extends AST {
|
|
281
|
+
readonly head: string;
|
|
282
|
+
readonly spans: Vector<TemplateLiteralSpan>;
|
|
283
|
+
readonly annotations: ASTAnnotationMap;
|
|
284
|
+
readonly _tag = ASTTag.TemplateLiteral;
|
|
285
|
+
constructor(head: string, spans: Vector<TemplateLiteralSpan>, annotations?: ASTAnnotationMap);
|
|
286
|
+
clone(newProperties: Partial<this>): AST;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* @tsplus static fncts.schema.ASTOps createTemplateLiteral
|
|
290
|
+
* @tsplus location "@fncts/schema/AST"
|
|
291
|
+
*/
|
|
292
|
+
export declare function createTemplateLiteral(head: string, spans: Vector<TemplateLiteralSpan>, annotations?: ASTAnnotationMap): TemplateLiteral | Literal;
|
|
293
|
+
export declare class Element {
|
|
294
|
+
readonly type: AST;
|
|
295
|
+
readonly isOptional: boolean;
|
|
296
|
+
constructor(type: AST, isOptional: boolean);
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* @tsplus static fncts.schema.ASTOps createElement
|
|
300
|
+
* @tsplus location "@fncts/schema/AST"
|
|
301
|
+
*/
|
|
302
|
+
export declare function createElement(type: AST, isOptional: boolean): Element;
|
|
303
|
+
export declare class Tuple extends AST {
|
|
304
|
+
readonly elements: Vector<Element>;
|
|
305
|
+
readonly rest: Maybe<Vector<AST>>;
|
|
306
|
+
readonly isReadonly: boolean;
|
|
307
|
+
readonly annotations: ASTAnnotationMap;
|
|
308
|
+
readonly _tag = ASTTag.Tuple;
|
|
309
|
+
constructor(elements: Vector<Element>, rest: Maybe<Vector<AST>>, isReadonly: boolean, annotations?: ASTAnnotationMap);
|
|
310
|
+
clone(newProperties: Partial<this>): AST;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* @tsplus static fncts.schema.ASTOps createTuple
|
|
314
|
+
* @tsplus location "@fncts/schema/AST"
|
|
315
|
+
*/
|
|
316
|
+
export declare function createTuple(elements: Vector<Element>, rest: Maybe<Vector<AST>>, isReadonly: boolean, annotations?: ASTAnnotationMap): Tuple;
|
|
317
|
+
export declare class PropertySignature extends AST {
|
|
318
|
+
readonly name: PropertyKey;
|
|
319
|
+
readonly type: AST;
|
|
320
|
+
readonly isOptional: boolean;
|
|
321
|
+
readonly isReadonly: boolean;
|
|
322
|
+
readonly annotations: ASTAnnotationMap;
|
|
323
|
+
constructor(name: PropertyKey, type: AST, isOptional: boolean, isReadonly: boolean, annotations?: ASTAnnotationMap);
|
|
324
|
+
clone(newProperties: Partial<this>): AST;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* @tsplus static fncts.schema.ASTOps createPropertySignature
|
|
328
|
+
* @tsplus location "@fncts/schema/AST"
|
|
329
|
+
*/
|
|
330
|
+
export declare function createPropertySignature(name: PropertyKey, type: AST, isOptional: boolean, isReadonly: boolean, annotations?: ASTAnnotationMap): PropertySignature;
|
|
331
|
+
export declare class IndexSignature {
|
|
332
|
+
readonly parameter: StringKeyword | SymbolKeyword | TemplateLiteral | Refinement;
|
|
333
|
+
readonly type: AST;
|
|
334
|
+
readonly isReadonly: boolean;
|
|
335
|
+
constructor(parameter: StringKeyword | SymbolKeyword | TemplateLiteral | Refinement, type: AST, isReadonly: boolean);
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* @tsplus static fncts.schema.ASTOps createIndexSignature
|
|
339
|
+
* @tsplus location "@fncts/schema/AST"
|
|
340
|
+
*/
|
|
341
|
+
export declare function createIndexSignature(parameter: StringKeyword | SymbolKeyword | TemplateLiteral | Refinement, type: AST, isReadonly: boolean): IndexSignature;
|
|
342
|
+
export declare class TypeLiteral extends AST {
|
|
343
|
+
readonly annotations: ASTAnnotationMap;
|
|
344
|
+
readonly _tag = ASTTag.TypeLiteral;
|
|
345
|
+
readonly propertySignatures: Vector<PropertySignature>;
|
|
346
|
+
readonly indexSignatures: Vector<IndexSignature>;
|
|
347
|
+
constructor(propertySignatures: Vector<PropertySignature>, indexSignatures: Vector<IndexSignature>, annotations?: ASTAnnotationMap);
|
|
348
|
+
clone(newProperties: Partial<this>): AST;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* @tsplus static fncts.schema.ASTOps isTypeLiteral
|
|
352
|
+
* @tsplus fluent fncts.schema.AST isTypeLiteral
|
|
353
|
+
* @tsplus location "@fncts/schema/AST"
|
|
354
|
+
*/
|
|
355
|
+
export declare function isTypeLiteral(self: AST): self is TypeLiteral;
|
|
356
|
+
/**
|
|
357
|
+
* @tsplus static fncts.schema.ASTOps createTypeLiteral
|
|
358
|
+
* @tsplus location "@fncts/schema/AST"
|
|
359
|
+
*/
|
|
360
|
+
export declare function createTypeLiteral(propertySignatures: Vector<PropertySignature>, indexSignatures: Vector<IndexSignature>, annotations?: ASTAnnotationMap): TypeLiteral;
|
|
361
|
+
export declare class Union extends AST {
|
|
362
|
+
readonly types: Vector<AST>;
|
|
363
|
+
readonly annotations: ASTAnnotationMap;
|
|
364
|
+
readonly _tag = ASTTag.Union;
|
|
365
|
+
constructor(types: Vector<AST>, annotations?: ASTAnnotationMap);
|
|
366
|
+
clone(newProperties: Partial<this>): AST;
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* @tsplus fluent fncts.schema.AST isUnion
|
|
370
|
+
* @tsplus location "@fncts/schema/AST"
|
|
371
|
+
*/
|
|
372
|
+
export declare function isUnion(self: AST): self is Union;
|
|
373
|
+
/**
|
|
374
|
+
* @tsplus static fncts.schema.ASTOps createUnion
|
|
375
|
+
* @tsplus location "@fncts/schema/AST"
|
|
376
|
+
*/
|
|
377
|
+
export declare function createUnion(candidates: Vector<AST>, annotations?: ASTAnnotationMap): AST;
|
|
378
|
+
export declare class Lazy extends AST {
|
|
379
|
+
readonly getAST: () => AST;
|
|
380
|
+
readonly annotations: ASTAnnotationMap;
|
|
381
|
+
readonly _tag = ASTTag.Lazy;
|
|
382
|
+
constructor(getAST: () => AST, annotations?: ASTAnnotationMap);
|
|
383
|
+
clone(newProperties: Partial<this>): AST;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* @tsplus static fncts.schema.ASTOps createLazy
|
|
387
|
+
* @tsplus location "@fncts/schema/AST"
|
|
388
|
+
*/
|
|
389
|
+
export declare function createLazy(getAST: () => AST, annotations?: ASTAnnotationMap): Lazy;
|
|
390
|
+
/**
|
|
391
|
+
* @tsplus fluent fncts.schema.AST isLazy
|
|
392
|
+
* @tsplus location "@fncts/schema/AST"
|
|
393
|
+
*/
|
|
394
|
+
export declare function isLazy(self: AST): self is Lazy;
|
|
395
|
+
export declare class Refinement extends AST {
|
|
396
|
+
readonly from: AST;
|
|
397
|
+
readonly decode: (input: any, options?: ParseOptions) => ParseResult<any>;
|
|
398
|
+
readonly isReversed: boolean;
|
|
399
|
+
readonly annotations: ASTAnnotationMap;
|
|
400
|
+
readonly _tag = ASTTag.Refinement;
|
|
401
|
+
constructor(from: AST, decode: (input: any, options?: ParseOptions) => ParseResult<any>, isReversed: boolean, annotations?: ASTAnnotationMap);
|
|
402
|
+
clone(newProperties: Partial<this>): AST;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* @tsplus static fncts.schema.ASTOps createRefinement
|
|
406
|
+
* @tsplus location "@fncts/schema/AST"
|
|
407
|
+
*/
|
|
408
|
+
export declare function createRefinement(from: AST, decode: (input: any, options?: ParseOptions) => ParseResult<any>, isReversed: boolean, annotations?: ASTAnnotationMap): Refinement;
|
|
409
|
+
export declare function isRefinement(self: AST): self is Refinement;
|
|
410
|
+
export interface ParseOptions {
|
|
411
|
+
readonly isUnexpectedAllowed?: boolean;
|
|
412
|
+
readonly allErrors?: boolean;
|
|
413
|
+
}
|
|
414
|
+
export declare class Transform extends AST {
|
|
415
|
+
readonly from: AST;
|
|
416
|
+
readonly to: AST;
|
|
417
|
+
readonly decode: (input: any, options?: ParseOptions) => ParseResult<any>;
|
|
418
|
+
readonly encode: (input: any, options?: ParseOptions) => ParseResult<any>;
|
|
419
|
+
readonly isReversed: boolean;
|
|
420
|
+
readonly annotations: ASTAnnotationMap;
|
|
421
|
+
readonly _tag = ASTTag.Transform;
|
|
422
|
+
constructor(from: AST, to: AST, decode: (input: any, options?: ParseOptions) => ParseResult<any>, encode: (input: any, options?: ParseOptions) => ParseResult<any>, isReversed: boolean, annotations?: ASTAnnotationMap);
|
|
423
|
+
clone(newProperties: Partial<this>): AST;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* @tsplus static fncts.schema.ASTOps createTransform
|
|
427
|
+
* @tsplus location "@fncts/schema/AST"
|
|
428
|
+
*/
|
|
429
|
+
export declare function createTransform(from: AST, to: AST, decode: (input: any, options?: ParseOptions) => ParseResult<any>, encode: (input: any, options?: ParseOptions) => ParseResult<any>, isReversed: boolean, annotations?: ASTAnnotationMap): Transform;
|
|
430
|
+
export declare class Validation extends AST {
|
|
431
|
+
readonly from: AST;
|
|
432
|
+
readonly validation: Vector<ValidationType<any, string>>;
|
|
433
|
+
readonly annotations: ASTAnnotationMap;
|
|
434
|
+
readonly _tag = ASTTag.Validation;
|
|
435
|
+
constructor(from: AST, validation: Vector<ValidationType<any, string>>, annotations?: ASTAnnotationMap);
|
|
436
|
+
clone(newProperties: Partial<this>): AST;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* @tsplus static fncts.schema.ASTOps createValidation
|
|
440
|
+
* @tsplus location "@fncts/schema/AST"
|
|
441
|
+
*/
|
|
442
|
+
export declare function createValidation(from: AST, validation: Vector<ValidationType<any, string>>, annotations?: ASTAnnotationMap): Validation;
|
|
443
|
+
/**
|
|
444
|
+
* @tsplus tailRec
|
|
445
|
+
*/
|
|
446
|
+
export declare function getCardinality(ast: AST): number;
|
|
447
|
+
export declare function getWeight(ast: AST): number;
|
|
448
|
+
/**
|
|
449
|
+
* @tsplus pipeable fncts.schema.AST combineAnnotations
|
|
450
|
+
* @tsplus location "@fncts/schema/AST"
|
|
451
|
+
*/
|
|
452
|
+
export declare function combineAnnotations(annotations: ASTAnnotationMap): (self: AST) => AST;
|
|
453
|
+
/**
|
|
454
|
+
* @tsplus pipeable fncts.schema.AST setAnnotation
|
|
455
|
+
* @tsplus location "@fncts/schema/AST"
|
|
456
|
+
*/
|
|
457
|
+
export declare function setAnnotation<A>(annotation: ASTAnnotation<A>, value: A): (self: AST) => AST;
|
|
458
|
+
/**
|
|
459
|
+
* @tsplus pipeable fncts.schema.AST appendRestElement
|
|
460
|
+
* @tsplus location "@fncts/schema/AST"
|
|
461
|
+
*/
|
|
462
|
+
export declare function appendRestElement(restElement: AST): (self: Tuple) => Tuple;
|
|
463
|
+
/**
|
|
464
|
+
* @tsplus pipeable fncts.schema.AST appendElement
|
|
465
|
+
* @tsplus location "@fncts/schema/AST"
|
|
466
|
+
*/
|
|
467
|
+
export declare function appendElement(element: Element): (self: Tuple) => Tuple;
|
|
468
|
+
export declare function getParameter(x: IndexSignature["parameter"]): StringKeyword | SymbolKeyword | TemplateLiteral;
|
|
469
|
+
/**
|
|
470
|
+
* @tsplus getter fncts.schema.AST getPropertySignatures
|
|
471
|
+
* @tsplus location "@fncts/schema/AST"
|
|
472
|
+
*/
|
|
473
|
+
export declare function getPropertySignatures(self: AST): Vector<PropertySignature>;
|
|
474
|
+
/**
|
|
475
|
+
* @tsplus getter fncts.schema.AST keysof
|
|
476
|
+
* @tsplus location "@fncts/schema/AST"
|
|
477
|
+
*/
|
|
478
|
+
export declare function keysOf(ast: AST): Vector<AST>;
|
|
479
|
+
/**
|
|
480
|
+
* @tsplus getter fncts.schema.AST keyof
|
|
481
|
+
* @tsplus location "@fncts/schema/AST"
|
|
482
|
+
*/
|
|
483
|
+
export declare function keyof(self: AST): AST;
|
|
484
|
+
/**
|
|
485
|
+
* @tsplus static fncts.schema.ASTOps createRecord
|
|
486
|
+
* @tsplus location "@fncts/schema/AST"
|
|
487
|
+
*/
|
|
488
|
+
export declare function createRecord(key: AST, value: AST, isReadonly: boolean): TypeLiteral;
|
|
489
|
+
/**
|
|
490
|
+
* @tsplus pipeable fncts.schema.AST pick
|
|
491
|
+
* @tsplus location "@fncts/schema/AST"
|
|
492
|
+
*/
|
|
493
|
+
export declare function pick(keys: Vector<PropertyKey>): (self: AST) => TypeLiteral;
|
|
494
|
+
/**
|
|
495
|
+
* @tsplus pipeable fncts.schema.AST omit
|
|
496
|
+
* @tsplus location "@fncts/schema/AST"
|
|
497
|
+
*/
|
|
498
|
+
export declare function omit(keys: Vector<PropertyKey>): (self: AST) => TypeLiteral;
|
|
499
|
+
/**
|
|
500
|
+
* @tsplus getter fncts.schema.AST partial
|
|
501
|
+
* @tsplus location "@fncts/schema/AST"
|
|
502
|
+
*/
|
|
503
|
+
export declare function partial(self: AST): AST;
|
|
504
|
+
/**
|
|
505
|
+
* @tsplus static fncts.schema.AST createKey
|
|
506
|
+
* @tsplus location "@fncts/schema/AST"
|
|
507
|
+
*/
|
|
508
|
+
export declare function createKey(key: PropertyKey): AST;
|
|
509
|
+
/**
|
|
510
|
+
* @tsplus getter fncts.schema.AST getFrom
|
|
511
|
+
* @tsplus location "@fncts/schema/AST"
|
|
512
|
+
*/
|
|
513
|
+
export declare function getFrom(ast: AST): AST;
|
|
514
|
+
/**
|
|
515
|
+
* @tsplus getter fncts.schema.AST getTo
|
|
516
|
+
* @tsplus location "@fncts/schema/AST"
|
|
517
|
+
*/
|
|
518
|
+
export declare function getTo(ast: AST): AST;
|
|
519
|
+
/**
|
|
520
|
+
* @tsplus getter fncts.schema.AST reverse
|
|
521
|
+
* @tsplus location "@fncts/schema/AST"
|
|
522
|
+
*/
|
|
523
|
+
export declare function reverse(ast: AST): AST;
|
|
524
|
+
/**
|
|
525
|
+
* @tsplus static fncts.schema.AST getCompiler
|
|
526
|
+
* @tsplus location "@fncts/schema/AST"
|
|
527
|
+
*/
|
|
528
|
+
export declare function getCompiler<A>(match: AST.Match<A>): AST.Compiler<A>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Hashable } from "@fncts/base/data/Hashable";
|
|
2
|
+
import { Equatable } from "@fncts/base/data/Equatable";
|
|
3
|
+
import { Tag } from "@fncts/base/data/Tag/definition";
|
|
4
|
+
import { Vector } from "@fncts/base/collection/immutable/Vector";
|
|
5
|
+
import type { Validation } from "@fncts/base/data/Branded";
|
|
6
|
+
export declare const ASTAnnotationVariance: unique symbol;
|
|
7
|
+
export type ASTAnnotationVariance = typeof ASTAnnotationVariance;
|
|
8
|
+
export declare const ASTAnnotationTypeId: unique symbol;
|
|
9
|
+
export type ASTAnnotationTypeId = typeof ASTAnnotationTypeId;
|
|
10
|
+
/**
|
|
11
|
+
* @tsplus type fncts.schema.ASTAnnotation
|
|
12
|
+
* @tsplus companion fncts.schema.ASTAnnotationOps
|
|
13
|
+
*/
|
|
14
|
+
export declare class ASTAnnotation<V> implements Hashable, Equatable {
|
|
15
|
+
readonly tag: Tag<V>;
|
|
16
|
+
readonly identifier: string;
|
|
17
|
+
readonly combine: (v1: V, v2: V) => V;
|
|
18
|
+
readonly [ASTAnnotationTypeId]: ASTAnnotationTypeId;
|
|
19
|
+
[ASTAnnotationVariance]: {
|
|
20
|
+
readonly _V: (_: never) => V;
|
|
21
|
+
};
|
|
22
|
+
constructor(tag: Tag<V>, identifier: string, combine: (v1: V, v2: V) => V);
|
|
23
|
+
get [Symbol.hash](): number;
|
|
24
|
+
[Symbol.equals](that: unknown): boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare function isASTAnnotation(u: unknown): u is ASTAnnotation<unknown>;
|
|
27
|
+
export declare const TitleTag: import("@fncts/base/data/Tag").Tag<string>;
|
|
28
|
+
/**
|
|
29
|
+
* @tsplus static fncts.schema.ASTAnnotationOps Title
|
|
30
|
+
* @tsplus location "@fncts/schema/ASTAnnotation"
|
|
31
|
+
*/
|
|
32
|
+
export declare const Title: ASTAnnotation<string>;
|
|
33
|
+
export declare const IdentifierTag: import("@fncts/base/data/Tag").Tag<string>;
|
|
34
|
+
/**
|
|
35
|
+
* @tsplus static fncts.schema.ASTAnnotationOps Identifier
|
|
36
|
+
* @tsplus location "@fncts/schema/ASTAnnotation"
|
|
37
|
+
*/
|
|
38
|
+
export declare const Identifier: ASTAnnotation<string>;
|
|
39
|
+
export declare const DescriptionTag: import("@fncts/base/data/Tag").Tag<string>;
|
|
40
|
+
/**
|
|
41
|
+
* @tsplus static fncts.schema.ASTAnnotationOps Description
|
|
42
|
+
* @tsplus location "@fncts/schema/ASTAnnotation"
|
|
43
|
+
*/
|
|
44
|
+
export declare const Description: ASTAnnotation<string>;
|
|
45
|
+
export declare const MessageTag: import("@fncts/base/data/Tag").Tag<(_: unknown) => string>;
|
|
46
|
+
/**
|
|
47
|
+
* @tsplus static fncts.schema.ASTAnnotationOps Message
|
|
48
|
+
* @tsplus location "@fncts/schema/ASTAnnotation"
|
|
49
|
+
*/
|
|
50
|
+
export declare const Message: ASTAnnotation<(_: unknown) => string>;
|
|
51
|
+
export declare const BrandTag: import("@fncts/base/data/Tag").Tag<import("@fncts/base/collection/immutable/Vector").Vector<Validation<any, any>>>;
|
|
52
|
+
/**
|
|
53
|
+
* @tsplus static fncts.schema.ASTAnnotationOps Brand
|
|
54
|
+
* @tsplus location "@fncts/schema/ASTAnnotation"
|
|
55
|
+
*/
|
|
56
|
+
export declare const Brand: ASTAnnotation<import("@fncts/base/collection/immutable/Vector").Vector<Validation<any, any>>>;
|
|
57
|
+
export declare const OptionalTag: import("@fncts/base/data/Tag").Tag<boolean>;
|
|
58
|
+
/**
|
|
59
|
+
* @tsplus static fncts.schema.ASTAnnotationOps Optional
|
|
60
|
+
* @tsplus location "@fncts/schema/ASTAnnotation"
|
|
61
|
+
*/
|
|
62
|
+
export declare const Optional: ASTAnnotation<boolean>;
|
|
63
|
+
export declare const ParseOptionalTag: import("@fncts/base/data/Tag").Tag<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* @tsplus static fncts.schema.ASTAnnotationOps ParseOptional
|
|
66
|
+
* @tsplus location "@fncts/schema/ASTAnnotation"
|
|
67
|
+
*/
|
|
68
|
+
export declare const ParseOptional: ASTAnnotation<boolean>;
|
|
69
|
+
export type Hook<A> = (...typeParameters: ReadonlyArray<A>) => A;
|
|
70
|
+
export declare function hook(handler: (...typeParameters: ReadonlyArray<any>) => any): Hook<any>;
|
|
71
|
+
export declare const ParserHookTag: import("@fncts/base/data/Tag").Tag<Hook<any>>;
|
|
72
|
+
/**
|
|
73
|
+
* @tsplus static fncts.schema.ASTAnnotationOps ParserHook
|
|
74
|
+
* @tsplus location "@fncts/schema/ASTAnnotation"
|
|
75
|
+
*/
|
|
76
|
+
export declare const ParserHook: ASTAnnotation<Hook<any>>;
|
|
77
|
+
export declare const GenHookTag: import("@fncts/base/data/Tag").Tag<Hook<any>>;
|
|
78
|
+
/**
|
|
79
|
+
* @tsplus static fncts.schema.ASTAnnotationOps GenHook
|
|
80
|
+
* @tsplus location "@fncts/schema/ASTAnnotation"
|
|
81
|
+
*/
|
|
82
|
+
export declare const GenHook: ASTAnnotation<Hook<any>>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HashMap } from "@fncts/base/collection/immutable/HashMap/definition";
|
|
2
|
+
import { Conc } from "@fncts/base/collection/immutable/Conc";
|
|
3
|
+
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
|
4
|
+
import type { ASTAnnotation } from "./ASTAnnotation.js";
|
|
5
|
+
export declare class ASTAnnotationMap {
|
|
6
|
+
readonly map: HashMap<ASTAnnotation<any>, any>;
|
|
7
|
+
constructor(map: HashMap<ASTAnnotation<any>, any>);
|
|
8
|
+
combine(that: ASTAnnotationMap): ASTAnnotationMap;
|
|
9
|
+
get<V>(key: ASTAnnotation<V>): Maybe<V>;
|
|
10
|
+
private overwrite;
|
|
11
|
+
private update;
|
|
12
|
+
annotate<V>(key: ASTAnnotation<V>, value: V): ASTAnnotationMap;
|
|
13
|
+
static empty: ASTAnnotationMap;
|
|
14
|
+
}
|
package/Gen.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Schema } from "@fncts/schema/Schema/definition";
|
|
2
|
+
import { Gen } from "@fncts/test/control/Gen";
|
|
3
|
+
import { AST } from "@fncts/schema/AST";
|
|
4
|
+
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
|
5
|
+
import type { Sized } from "@fncts/test/control/Sized";
|
|
6
|
+
/**
|
|
7
|
+
* @tsplus getter fncts.schema.Schema genFrom
|
|
8
|
+
* @tsplus location "@fncts/schema/Gen"
|
|
9
|
+
*/
|
|
10
|
+
export declare function genFrom<A>(self: Schema<A>): Gen<Sized, unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* @tsplus getter fncts.schema.Schema genTo
|
|
13
|
+
* @tsplus location "@fncts/schema/Gen"
|
|
14
|
+
*/
|
|
15
|
+
export declare function genTo<A>(self: Schema<A>): Gen<Sized, A>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const InvalidInterpretationErrorTypeId: unique symbol;
|
|
2
|
+
export type InvalidInterpretationErrorTypeId = typeof InvalidInterpretationErrorTypeId;
|
|
3
|
+
export declare class InvalidInterpretationError extends Error {
|
|
4
|
+
readonly [InvalidInterpretationErrorTypeId]: InvalidInterpretationErrorTypeId;
|
|
5
|
+
}
|