@fncts/schema 0.0.22 → 0.0.24
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 +60 -29
- package/ASTAnnotationMap.d.ts +4 -1
- package/ParseError/ParseError.d.ts +28 -13
- package/_cjs/AST.cjs +279 -137
- package/_cjs/AST.cjs.map +1 -1
- package/_cjs/ASTAnnotation.cjs +5 -3
- package/_cjs/ASTAnnotation.cjs.map +1 -1
- package/_cjs/ASTAnnotationMap.cjs +18 -9
- package/_cjs/ASTAnnotationMap.cjs.map +1 -1
- package/_cjs/InvalidInterpretationError.cjs +1 -6
- package/_cjs/InvalidInterpretationError.cjs.map +1 -1
- package/_cjs/ParseError/ParseError.cjs +91 -14
- package/_cjs/ParseError/ParseError.cjs.map +1 -1
- package/_cjs/Schema/api/hashMap.cjs +1 -1
- package/_cjs/Schema/api/hashMap.cjs.map +1 -1
- package/_cjs/Schema/api/hashSet.cjs +1 -1
- package/_cjs/Schema/api/hashSet.cjs.map +1 -1
- package/_cjs/Schema/api/list.cjs +3 -1
- package/_cjs/Schema/api/list.cjs.map +1 -1
- package/_cjs/Schema/api/map.cjs +1 -1
- package/_cjs/Schema/api/map.cjs.map +1 -1
- package/_cjs/Schema/api/set.cjs +1 -1
- package/_cjs/Schema/api/set.cjs.map +1 -1
- package/_cjs/Schema/definition.cjs +3 -4
- package/_cjs/Schema/definition.cjs.map +1 -1
- package/_mjs/AST.mjs +277 -136
- package/_mjs/AST.mjs.map +1 -1
- package/_mjs/ASTAnnotation.mjs +5 -3
- package/_mjs/ASTAnnotation.mjs.map +1 -1
- package/_mjs/ASTAnnotationMap.mjs +18 -9
- package/_mjs/ASTAnnotationMap.mjs.map +1 -1
- package/_mjs/InvalidInterpretationError.mjs +1 -6
- package/_mjs/InvalidInterpretationError.mjs.map +1 -1
- package/_mjs/ParseError/ParseError.mjs +90 -14
- package/_mjs/ParseError/ParseError.mjs.map +1 -1
- package/_mjs/Schema/api/hashMap.mjs +1 -1
- package/_mjs/Schema/api/hashMap.mjs.map +1 -1
- package/_mjs/Schema/api/hashSet.mjs +1 -1
- package/_mjs/Schema/api/hashSet.mjs.map +1 -1
- package/_mjs/Schema/api/list.mjs +3 -1
- package/_mjs/Schema/api/list.mjs.map +1 -1
- package/_mjs/Schema/api/map.mjs +1 -1
- package/_mjs/Schema/api/map.mjs.map +1 -1
- package/_mjs/Schema/api/set.mjs +1 -1
- package/_mjs/Schema/api/set.mjs.map +1 -1
- package/_mjs/Schema/definition.mjs +2 -3
- package/_mjs/Schema/definition.mjs.map +1 -1
- package/_src/AST.ts +226 -28
- package/_src/ASTAnnotationMap.ts +14 -1
- package/_src/ParseError/ParseError.ts +128 -13
- package/_src/Schema/api/hashMap.ts +1 -1
- package/_src/Schema/api/hashSet.ts +1 -1
- package/_src/Schema/api/list.ts +3 -1
- package/_src/Schema/api/map.ts +1 -1
- package/_src/Schema/api/set.ts +1 -1
- package/package.json +3 -3
package/AST.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { Equatable } from "@fncts/base/data/Equatable";
|
|
1
2
|
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
|
2
3
|
import { Vector } from "@fncts/base/collection/immutable/Vector";
|
|
3
4
|
import { ParseResult } from "@fncts/schema/ParseResult";
|
|
4
5
|
import { ParseError } from "@fncts/schema/ParseError";
|
|
5
6
|
import type { Validation as ValidationType } from "@fncts/base/data/Branded";
|
|
7
|
+
import type { EqualsContext } from "@fncts/base/data/Equatable";
|
|
6
8
|
import { ASTAnnotation } from "./ASTAnnotation.js";
|
|
7
9
|
import { ASTAnnotationMap } from "./ASTAnnotationMap.js";
|
|
8
10
|
export declare const ASTTypeId: unique symbol;
|
|
@@ -14,9 +16,10 @@ export declare abstract class Annotated {
|
|
|
14
16
|
* @tsplus type fncts.schema.AST
|
|
15
17
|
* @tsplus companion fncts.schema.ASTOps
|
|
16
18
|
*/
|
|
17
|
-
export declare abstract class AST extends Annotated {
|
|
19
|
+
export declare abstract class AST extends Annotated implements Equatable {
|
|
18
20
|
readonly [ASTTypeId]: ASTTypeId;
|
|
19
21
|
abstract clone(newProperties: Partial<this>): AST;
|
|
22
|
+
abstract [Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
20
23
|
toString(verbose?: boolean): string;
|
|
21
24
|
}
|
|
22
25
|
export declare namespace AST {
|
|
@@ -61,11 +64,12 @@ export type Concrete = Declaration | Literal | UniqueSymbol | UndefinedKeyword |
|
|
|
61
64
|
* @tsplus location "@fncts/schema/AST"
|
|
62
65
|
*/
|
|
63
66
|
export declare function concrete(_: AST): asserts _ is Concrete;
|
|
67
|
+
export declare function isAST(u: unknown): u is AST;
|
|
64
68
|
export declare function getAnnotations<V>(key: ASTAnnotation<V>): (self: Annotated) => Maybe<V>;
|
|
65
69
|
/**
|
|
66
70
|
* @tsplus type fncts.schema.AST.Declaration
|
|
67
71
|
*/
|
|
68
|
-
export declare class Declaration extends AST {
|
|
72
|
+
export declare class Declaration extends AST implements Equatable {
|
|
69
73
|
readonly typeParameters: Vector<AST>;
|
|
70
74
|
readonly decode: (...typeParameters: ReadonlyArray<AST>) => (input: any, options?: ParseOptions) => ParseResult<any>;
|
|
71
75
|
readonly encode: (...typeParameters: ReadonlyArray<AST>) => (input: any, options?: ParseOptions) => ParseResult<any>;
|
|
@@ -73,6 +77,7 @@ export declare class Declaration extends AST {
|
|
|
73
77
|
readonly _tag = ASTTag.Declaration;
|
|
74
78
|
constructor(typeParameters: Vector<AST>, decode: (...typeParameters: ReadonlyArray<AST>) => (input: any, options?: ParseOptions) => ParseResult<any>, encode: (...typeParameters: ReadonlyArray<AST>) => (input: any, options?: ParseOptions) => ParseResult<any>, annotations?: ASTAnnotationMap);
|
|
75
79
|
clone(newProperties: Partial<this>): AST;
|
|
80
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
76
81
|
}
|
|
77
82
|
/**
|
|
78
83
|
* @tsplus static fncts.schema.ASTOps createDeclaration
|
|
@@ -85,12 +90,13 @@ export declare function createDeclaration(typeParameters: Vector<AST>, decode: (
|
|
|
85
90
|
*/
|
|
86
91
|
export declare function isDeclaration(self: AST): self is Declaration;
|
|
87
92
|
export type LiteralValue = string | number | boolean | null | bigint;
|
|
88
|
-
export declare class Literal extends AST {
|
|
93
|
+
export declare class Literal extends AST implements Equatable {
|
|
89
94
|
readonly literal: LiteralValue;
|
|
90
95
|
readonly annotations: ASTAnnotationMap;
|
|
91
96
|
readonly _tag = ASTTag.Literal;
|
|
92
97
|
constructor(literal: LiteralValue, annotations?: ASTAnnotationMap);
|
|
93
98
|
clone(newProperties: Partial<this>): AST;
|
|
99
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
94
100
|
}
|
|
95
101
|
/**
|
|
96
102
|
* @tsplus static fncts.schema.ASTOps createLiteral
|
|
@@ -102,12 +108,13 @@ export declare function createLiteral(literal: LiteralValue, annotations?: ASTAn
|
|
|
102
108
|
* @tsplus location "@fncts/schema/AST"
|
|
103
109
|
*/
|
|
104
110
|
export declare function isLiteral(self: AST): self is Literal;
|
|
105
|
-
export declare class UniqueSymbol extends AST {
|
|
111
|
+
export declare class UniqueSymbol extends AST implements Equatable {
|
|
106
112
|
readonly symbol: symbol;
|
|
107
113
|
readonly annotations: ASTAnnotationMap;
|
|
108
114
|
readonly _tag = ASTTag.UniqueSymbol;
|
|
109
115
|
constructor(symbol: symbol, annotations?: ASTAnnotationMap);
|
|
110
116
|
clone(newProperties: Partial<this>): AST;
|
|
117
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
111
118
|
}
|
|
112
119
|
/**
|
|
113
120
|
* @tsplus static fncts.schema.ASTOps createUniqueSymbol
|
|
@@ -119,66 +126,72 @@ export declare function createUniqueSymbol(symbol: symbol, annotations?: ASTAnno
|
|
|
119
126
|
* @tsplus location "@fncts/schema/AST"
|
|
120
127
|
*/
|
|
121
128
|
export declare function isUniqueSymbol(self: AST): self is UniqueSymbol;
|
|
122
|
-
export declare class UndefinedKeyword extends AST {
|
|
129
|
+
export declare class UndefinedKeyword extends AST implements Equatable {
|
|
123
130
|
readonly annotations: ASTAnnotationMap;
|
|
124
131
|
readonly _tag = ASTTag.UndefinedKeyword;
|
|
125
132
|
constructor(annotations?: ASTAnnotationMap);
|
|
126
133
|
clone(newProperties: Partial<this>): AST;
|
|
134
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
127
135
|
}
|
|
128
136
|
/**
|
|
129
137
|
* @tsplus static fncts.schema.ASTOps undefinedKeyword
|
|
130
138
|
* @tsplus location "@fncts/schema/AST"
|
|
131
139
|
*/
|
|
132
140
|
export declare const undefinedKeyword: UndefinedKeyword;
|
|
133
|
-
export declare class VoidKeyword extends AST {
|
|
141
|
+
export declare class VoidKeyword extends AST implements Equatable {
|
|
134
142
|
readonly annotations: ASTAnnotationMap;
|
|
135
143
|
readonly _tag = ASTTag.VoidKeyword;
|
|
136
144
|
constructor(annotations?: ASTAnnotationMap);
|
|
137
145
|
clone(newProperties: Partial<this>): AST;
|
|
146
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
138
147
|
}
|
|
139
148
|
/**
|
|
140
149
|
* @tsplus static fncts.schema.ASTOps voidKeyword
|
|
141
150
|
* @tsplus location "@fncts/schema/AST"
|
|
142
151
|
*/
|
|
143
152
|
export declare const voidKeyword: VoidKeyword;
|
|
144
|
-
export declare class NeverKeyword extends AST {
|
|
153
|
+
export declare class NeverKeyword extends AST implements Equatable {
|
|
145
154
|
readonly annotations: ASTAnnotationMap;
|
|
146
155
|
readonly _tag = ASTTag.NeverKeyword;
|
|
147
156
|
constructor(annotations?: ASTAnnotationMap);
|
|
148
157
|
clone(newProperties: Partial<this>): AST;
|
|
158
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
149
159
|
}
|
|
150
160
|
/**
|
|
151
161
|
* @tsplus static fncts.schema.ASTOps neverKeyword
|
|
152
162
|
* @tsplus location "@fncts/schema/AST"
|
|
153
163
|
*/
|
|
154
164
|
export declare const neverKeyword: NeverKeyword;
|
|
155
|
-
export declare class UnknownKeyword extends AST {
|
|
165
|
+
export declare class UnknownKeyword extends AST implements Equatable {
|
|
156
166
|
readonly annotations: ASTAnnotationMap;
|
|
157
167
|
readonly _tag = ASTTag.UnknownKeyword;
|
|
158
168
|
constructor(annotations?: ASTAnnotationMap);
|
|
159
169
|
clone(newProperties: Partial<this>): AST;
|
|
170
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
160
171
|
}
|
|
161
172
|
/**
|
|
162
173
|
* @tsplus static fncts.schema.ASTOps unknownKeyword
|
|
163
174
|
* @tsplus location "@fncts/schema/AST"
|
|
164
175
|
*/
|
|
165
176
|
export declare const unknownKeyword: UnknownKeyword;
|
|
166
|
-
export declare class AnyKeyword extends AST {
|
|
177
|
+
export declare class AnyKeyword extends AST implements Equatable {
|
|
167
178
|
readonly annotations: ASTAnnotationMap;
|
|
168
179
|
readonly _tag = ASTTag.AnyKeyword;
|
|
169
180
|
constructor(annotations?: ASTAnnotationMap);
|
|
170
181
|
clone(newProperties: Partial<this>): AST;
|
|
182
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
171
183
|
}
|
|
172
184
|
/**
|
|
173
185
|
* @tsplus static fncts.schema.ASTOps anyKeyword
|
|
174
186
|
* @tsplus location "@fncts/schema/AST"
|
|
175
187
|
*/
|
|
176
188
|
export declare const anyKeyword: AnyKeyword;
|
|
177
|
-
export declare class StringKeyword extends AST {
|
|
189
|
+
export declare class StringKeyword extends AST implements Equatable {
|
|
178
190
|
readonly annotations: ASTAnnotationMap;
|
|
179
191
|
readonly _tag = ASTTag.StringKeyword;
|
|
180
192
|
constructor(annotations?: ASTAnnotationMap);
|
|
181
193
|
clone(newProperties: Partial<this>): AST;
|
|
194
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
182
195
|
}
|
|
183
196
|
/**
|
|
184
197
|
* @tsplus static fncts.schema.ASTOps stringKeyword
|
|
@@ -190,11 +203,12 @@ export declare const stringKeyword: StringKeyword;
|
|
|
190
203
|
* @tsplus location "@fncts/schema/AST"
|
|
191
204
|
*/
|
|
192
205
|
export declare function isStringKeyword(self: AST): self is StringKeyword;
|
|
193
|
-
export declare class NumberKeyword extends AST {
|
|
206
|
+
export declare class NumberKeyword extends AST implements Equatable {
|
|
194
207
|
readonly annotations: ASTAnnotationMap;
|
|
195
208
|
readonly _tag = ASTTag.NumberKeyword;
|
|
196
209
|
constructor(annotations?: ASTAnnotationMap);
|
|
197
210
|
clone(newProperties: Partial<this>): AST;
|
|
211
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
198
212
|
}
|
|
199
213
|
/**
|
|
200
214
|
* @tsplus static fncts.schema.ASTOps numberKeyword
|
|
@@ -206,11 +220,12 @@ export declare const numberKeyword: NumberKeyword;
|
|
|
206
220
|
* @tsplus location "@fncts/schema/AST"
|
|
207
221
|
*/
|
|
208
222
|
export declare function isNumberKeyword(self: AST): self is NumberKeyword;
|
|
209
|
-
export declare class BooleanKeyword extends AST {
|
|
223
|
+
export declare class BooleanKeyword extends AST implements Equatable {
|
|
210
224
|
readonly annotations: ASTAnnotationMap;
|
|
211
225
|
readonly _tag = ASTTag.BooleanKeyword;
|
|
212
226
|
constructor(annotations?: ASTAnnotationMap);
|
|
213
227
|
clone(newProperties: Partial<this>): AST;
|
|
228
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
214
229
|
}
|
|
215
230
|
/**
|
|
216
231
|
* @tsplus static fncts.schema.ASTOps booleanKeyword
|
|
@@ -222,11 +237,12 @@ export declare const booleanKeyword: BooleanKeyword;
|
|
|
222
237
|
* @tsplus location "@fncts/schema/AST"
|
|
223
238
|
*/
|
|
224
239
|
export declare function isBooleanKeyword(self: AST): self is BooleanKeyword;
|
|
225
|
-
export declare class BigIntKeyword extends AST {
|
|
240
|
+
export declare class BigIntKeyword extends AST implements Equatable {
|
|
226
241
|
readonly annotations: ASTAnnotationMap;
|
|
227
242
|
readonly _tag = ASTTag.BigIntKeyword;
|
|
228
243
|
constructor(annotations?: ASTAnnotationMap);
|
|
229
244
|
clone(newProperties: Partial<this>): AST;
|
|
245
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
230
246
|
}
|
|
231
247
|
/**
|
|
232
248
|
* @tsplus static fncts.schema.ASTOps bigIntKeyword
|
|
@@ -238,11 +254,12 @@ export declare const bigIntKeyword: BigIntKeyword;
|
|
|
238
254
|
* @tsplus location "@fncts/schema/AST"
|
|
239
255
|
*/
|
|
240
256
|
export declare function isBigIntKeyword(self: AST): self is BigIntKeyword;
|
|
241
|
-
export declare class SymbolKeyword extends AST {
|
|
257
|
+
export declare class SymbolKeyword extends AST implements Equatable {
|
|
242
258
|
readonly annotations: ASTAnnotationMap;
|
|
243
259
|
readonly _tag = ASTTag.SymbolKeyword;
|
|
244
260
|
constructor(annotations?: ASTAnnotationMap);
|
|
245
261
|
clone(newProperties: Partial<this>): AST;
|
|
262
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
246
263
|
}
|
|
247
264
|
/**
|
|
248
265
|
* @tsplus static fncts.schema.ASTOps symbolKeyword
|
|
@@ -254,52 +271,57 @@ export declare const symbolKeyword: SymbolKeyword;
|
|
|
254
271
|
* @tsplus location "@fncts/schema/AST"
|
|
255
272
|
*/
|
|
256
273
|
export declare function isSymbolKeyword(self: AST): self is SymbolKeyword;
|
|
257
|
-
export declare class ObjectKeyword extends AST {
|
|
274
|
+
export declare class ObjectKeyword extends AST implements Equatable {
|
|
258
275
|
readonly annotations: ASTAnnotationMap;
|
|
259
276
|
readonly _tag = ASTTag.ObjectKeyword;
|
|
260
277
|
constructor(annotations?: ASTAnnotationMap);
|
|
261
278
|
clone(newProperties: Partial<this>): AST;
|
|
279
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
262
280
|
}
|
|
263
281
|
/**
|
|
264
282
|
* @tsplus static fncts.schema.ASTOps objectKeyword
|
|
265
283
|
* @tsplus location "@fncts/schema/AST"
|
|
266
284
|
*/
|
|
267
285
|
export declare const objectKeyword: ObjectKeyword;
|
|
268
|
-
export declare class Enum extends AST {
|
|
286
|
+
export declare class Enum extends AST implements Equatable {
|
|
269
287
|
readonly enums: Vector<readonly [string, string | number]>;
|
|
270
288
|
readonly annotations: ASTAnnotationMap;
|
|
271
289
|
readonly _tag = ASTTag.Enum;
|
|
272
290
|
constructor(enums: Vector<readonly [string, string | number]>, annotations?: ASTAnnotationMap);
|
|
273
291
|
clone(newProperties: Partial<this>): AST;
|
|
292
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
274
293
|
}
|
|
275
294
|
/**
|
|
276
295
|
* @tsplus static fncts.schema.ASTOps createEnum
|
|
277
296
|
* @tsplus location "@fncts/schema/AST"
|
|
278
297
|
*/
|
|
279
298
|
export declare function createEnum(enums: Vector<readonly [string, string | number]>, annotations?: ASTAnnotationMap): Enum;
|
|
280
|
-
export declare class TemplateLiteralSpan {
|
|
299
|
+
export declare class TemplateLiteralSpan implements Equatable {
|
|
281
300
|
readonly type: StringKeyword | NumberKeyword;
|
|
282
301
|
readonly literal: string;
|
|
283
302
|
constructor(type: StringKeyword | NumberKeyword, literal: string);
|
|
284
|
-
|
|
303
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
304
|
+
toString(): "${number}" | "${string}";
|
|
285
305
|
}
|
|
286
|
-
export declare class TemplateLiteral extends AST {
|
|
306
|
+
export declare class TemplateLiteral extends AST implements Equatable {
|
|
287
307
|
readonly head: string;
|
|
288
308
|
readonly spans: Vector<TemplateLiteralSpan>;
|
|
289
309
|
readonly annotations: ASTAnnotationMap;
|
|
290
310
|
readonly _tag = ASTTag.TemplateLiteral;
|
|
291
311
|
constructor(head: string, spans: Vector<TemplateLiteralSpan>, annotations?: ASTAnnotationMap);
|
|
292
312
|
clone(newProperties: Partial<this>): AST;
|
|
313
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
293
314
|
}
|
|
294
315
|
/**
|
|
295
316
|
* @tsplus static fncts.schema.ASTOps createTemplateLiteral
|
|
296
317
|
* @tsplus location "@fncts/schema/AST"
|
|
297
318
|
*/
|
|
298
319
|
export declare function createTemplateLiteral(head: string, spans: Vector<TemplateLiteralSpan>, annotations?: ASTAnnotationMap): TemplateLiteral | Literal;
|
|
299
|
-
export declare class Element {
|
|
320
|
+
export declare class Element implements Equatable {
|
|
300
321
|
readonly type: AST;
|
|
301
322
|
readonly isOptional: boolean;
|
|
302
323
|
constructor(type: AST, isOptional: boolean);
|
|
324
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
303
325
|
toString(): string;
|
|
304
326
|
}
|
|
305
327
|
/**
|
|
@@ -307,7 +329,7 @@ export declare class Element {
|
|
|
307
329
|
* @tsplus location "@fncts/schema/AST"
|
|
308
330
|
*/
|
|
309
331
|
export declare function createElement(type: AST, isOptional: boolean): Element;
|
|
310
|
-
export declare class Tuple extends AST {
|
|
332
|
+
export declare class Tuple extends AST implements Equatable {
|
|
311
333
|
readonly elements: Vector<Element>;
|
|
312
334
|
readonly rest: Maybe<Vector<AST>>;
|
|
313
335
|
readonly isReadonly: boolean;
|
|
@@ -315,6 +337,7 @@ export declare class Tuple extends AST {
|
|
|
315
337
|
readonly _tag = ASTTag.Tuple;
|
|
316
338
|
constructor(elements: Vector<Element>, rest: Maybe<Vector<AST>>, isReadonly: boolean, annotations?: ASTAnnotationMap);
|
|
317
339
|
clone(newProperties: Partial<this>): AST;
|
|
340
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
318
341
|
}
|
|
319
342
|
/**
|
|
320
343
|
* @tsplus static fncts.schema.ASTOps createTuple
|
|
@@ -326,7 +349,7 @@ export declare function createTuple(elements: Vector<Element>, rest: Maybe<Vecto
|
|
|
326
349
|
* @tsplus location "@fncts/schema/AST"
|
|
327
350
|
*/
|
|
328
351
|
export declare const unknownArray: Tuple;
|
|
329
|
-
export declare class PropertySignature {
|
|
352
|
+
export declare class PropertySignature implements Equatable {
|
|
330
353
|
readonly name: PropertyKey;
|
|
331
354
|
readonly type: AST;
|
|
332
355
|
readonly isOptional: boolean;
|
|
@@ -334,30 +357,33 @@ export declare class PropertySignature {
|
|
|
334
357
|
readonly annotations: ASTAnnotationMap;
|
|
335
358
|
constructor(name: PropertyKey, type: AST, isOptional: boolean, isReadonly: boolean, annotations?: ASTAnnotationMap);
|
|
336
359
|
clone(newProperties: Partial<this>): PropertySignature;
|
|
360
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
337
361
|
}
|
|
338
362
|
/**
|
|
339
363
|
* @tsplus static fncts.schema.ASTOps createPropertySignature
|
|
340
364
|
* @tsplus location "@fncts/schema/AST"
|
|
341
365
|
*/
|
|
342
366
|
export declare function createPropertySignature(name: PropertyKey, type: AST, isOptional: boolean, isReadonly: boolean, annotations?: ASTAnnotationMap): PropertySignature;
|
|
343
|
-
export declare class IndexSignature {
|
|
367
|
+
export declare class IndexSignature implements Equatable {
|
|
344
368
|
readonly parameter: StringKeyword | SymbolKeyword | TemplateLiteral | NumberKeyword | Refinement;
|
|
345
369
|
readonly type: AST;
|
|
346
370
|
readonly isReadonly: boolean;
|
|
347
371
|
constructor(parameter: StringKeyword | SymbolKeyword | TemplateLiteral | NumberKeyword | Refinement, type: AST, isReadonly: boolean);
|
|
372
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
348
373
|
}
|
|
349
374
|
/**
|
|
350
375
|
* @tsplus static fncts.schema.ASTOps createIndexSignature
|
|
351
376
|
* @tsplus location "@fncts/schema/AST"
|
|
352
377
|
*/
|
|
353
378
|
export declare function createIndexSignature(parameter: StringKeyword | SymbolKeyword | TemplateLiteral | NumberKeyword | Refinement, type: AST, isReadonly: boolean): IndexSignature;
|
|
354
|
-
export declare class TypeLiteral extends AST {
|
|
379
|
+
export declare class TypeLiteral extends AST implements Equatable {
|
|
355
380
|
readonly annotations: ASTAnnotationMap;
|
|
356
381
|
readonly _tag = ASTTag.TypeLiteral;
|
|
357
382
|
readonly propertySignatures: Vector<PropertySignature>;
|
|
358
383
|
readonly indexSignatures: Vector<IndexSignature>;
|
|
359
384
|
constructor(propertySignatures: Vector<PropertySignature>, indexSignatures: Vector<IndexSignature>, annotations?: ASTAnnotationMap);
|
|
360
385
|
clone(newProperties: Partial<this>): AST;
|
|
386
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
361
387
|
}
|
|
362
388
|
/**
|
|
363
389
|
* @tsplus static fncts.schema.ASTOps isTypeLiteral
|
|
@@ -375,12 +401,13 @@ export declare function createTypeLiteral(propertySignatures: Vector<PropertySig
|
|
|
375
401
|
* @tsplus location "@fncts/schema/AST"
|
|
376
402
|
*/
|
|
377
403
|
export declare const unknownRecord: TypeLiteral;
|
|
378
|
-
export declare class Union extends AST {
|
|
404
|
+
export declare class Union extends AST implements Equatable {
|
|
379
405
|
readonly types: Vector<AST>;
|
|
380
406
|
readonly annotations: ASTAnnotationMap;
|
|
381
407
|
readonly _tag = ASTTag.Union;
|
|
382
408
|
constructor(types: Vector<AST>, annotations?: ASTAnnotationMap);
|
|
383
409
|
clone(newProperties: Partial<this>): AST;
|
|
410
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
384
411
|
}
|
|
385
412
|
/**
|
|
386
413
|
* @tsplus fluent fncts.schema.AST isUnion
|
|
@@ -392,12 +419,13 @@ export declare function isUnion(self: AST): self is Union;
|
|
|
392
419
|
* @tsplus location "@fncts/schema/AST"
|
|
393
420
|
*/
|
|
394
421
|
export declare function createUnion(candidates: Vector<AST>, annotations?: ASTAnnotationMap): AST;
|
|
395
|
-
export declare class Lazy extends AST {
|
|
422
|
+
export declare class Lazy extends AST implements Equatable {
|
|
396
423
|
readonly getAST: () => AST;
|
|
397
424
|
readonly annotations: ASTAnnotationMap;
|
|
398
425
|
readonly _tag = ASTTag.Lazy;
|
|
399
426
|
constructor(getAST: () => AST, annotations?: ASTAnnotationMap);
|
|
400
427
|
clone(newProperties: Partial<this>): AST;
|
|
428
|
+
[Symbol.equals](that: unknown): boolean;
|
|
401
429
|
}
|
|
402
430
|
/**
|
|
403
431
|
* @tsplus static fncts.schema.ASTOps createLazy
|
|
@@ -409,7 +437,7 @@ export declare function createLazy(getAST: () => AST, annotations?: ASTAnnotatio
|
|
|
409
437
|
* @tsplus location "@fncts/schema/AST"
|
|
410
438
|
*/
|
|
411
439
|
export declare function isLazy(self: AST): self is Lazy;
|
|
412
|
-
export declare class Refinement extends AST {
|
|
440
|
+
export declare class Refinement extends AST implements Equatable {
|
|
413
441
|
readonly from: AST;
|
|
414
442
|
readonly predicate: (input: any) => boolean;
|
|
415
443
|
readonly annotations: ASTAnnotationMap;
|
|
@@ -417,6 +445,7 @@ export declare class Refinement extends AST {
|
|
|
417
445
|
constructor(from: AST, predicate: (input: any) => boolean, annotations?: ASTAnnotationMap);
|
|
418
446
|
decode(input: any, options?: ParseOptions): ParseResult<any>;
|
|
419
447
|
clone(newProperties: Partial<this>): AST;
|
|
448
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
420
449
|
}
|
|
421
450
|
/**
|
|
422
451
|
* @tsplus static fncts.schema.ASTOps createRefinement
|
|
@@ -428,7 +457,7 @@ export interface ParseOptions {
|
|
|
428
457
|
readonly isUnexpectedAllowed?: boolean;
|
|
429
458
|
readonly allErrors?: boolean;
|
|
430
459
|
}
|
|
431
|
-
export declare class Transform extends AST {
|
|
460
|
+
export declare class Transform extends AST implements Equatable {
|
|
432
461
|
readonly from: AST;
|
|
433
462
|
readonly to: AST;
|
|
434
463
|
readonly decode: (input: any, options?: ParseOptions) => ParseResult<any>;
|
|
@@ -437,19 +466,21 @@ export declare class Transform extends AST {
|
|
|
437
466
|
readonly _tag = ASTTag.Transform;
|
|
438
467
|
constructor(from: AST, to: AST, decode: (input: any, options?: ParseOptions) => ParseResult<any>, encode: (input: any, options?: ParseOptions) => ParseResult<any>, annotations?: ASTAnnotationMap);
|
|
439
468
|
clone(newProperties: Partial<this>): AST;
|
|
469
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
440
470
|
}
|
|
441
471
|
/**
|
|
442
472
|
* @tsplus static fncts.schema.ASTOps createTransform
|
|
443
473
|
* @tsplus location "@fncts/schema/AST"
|
|
444
474
|
*/
|
|
445
475
|
export declare function createTransform(from: AST, to: AST, decode: (input: any, options?: ParseOptions) => ParseResult<any>, encode: (input: any, options?: ParseOptions) => ParseResult<any>, annotations?: ASTAnnotationMap): Transform;
|
|
446
|
-
export declare class Validation extends AST {
|
|
476
|
+
export declare class Validation extends AST implements Equatable {
|
|
447
477
|
readonly from: AST;
|
|
448
478
|
readonly validation: Vector<ValidationType<any, string>>;
|
|
449
479
|
readonly annotations: ASTAnnotationMap;
|
|
450
480
|
readonly _tag = ASTTag.Validation;
|
|
451
481
|
constructor(from: AST, validation: Vector<ValidationType<any, string>>, annotations?: ASTAnnotationMap);
|
|
452
482
|
clone(newProperties: Partial<this>): AST;
|
|
483
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
453
484
|
}
|
|
454
485
|
/**
|
|
455
486
|
* @tsplus static fncts.schema.ASTOps createValidation
|
package/ASTAnnotationMap.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { Equatable } from "@fncts/base/data/Equatable";
|
|
1
2
|
import { HashMap } from "@fncts/base/collection/immutable/HashMap/definition";
|
|
2
3
|
import { Conc } from "@fncts/base/collection/immutable/Conc";
|
|
3
4
|
import { Maybe } from "@fncts/base/data/Maybe/definition";
|
|
4
5
|
import type { ASTAnnotation } from "./ASTAnnotation.js";
|
|
5
|
-
|
|
6
|
+
import type { EqualsContext } from "@fncts/base/data/Equatable";
|
|
7
|
+
export declare class ASTAnnotationMap implements Equatable {
|
|
6
8
|
readonly map: HashMap<ASTAnnotation<any>, any>;
|
|
7
9
|
constructor(map: HashMap<ASTAnnotation<any>, any>);
|
|
10
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
8
11
|
combine(that: ASTAnnotationMap): ASTAnnotationMap;
|
|
9
12
|
get<V>(key: ASTAnnotation<V>): Maybe<V>;
|
|
10
13
|
private overwrite;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { Equatable } from "@fncts/base/data/Equatable";
|
|
1
2
|
import { AST } from "@fncts/schema/AST";
|
|
2
3
|
import { Vector } from "@fncts/base/collection/immutable/Vector";
|
|
4
|
+
import type { EqualsContext } from "@fncts/base/data/Equatable";
|
|
3
5
|
import type { Declaration, Refinement, Transform, Tuple, TypeLiteral, Union } from "@fncts/schema/AST";
|
|
4
6
|
export declare const enum ParseErrorTag {
|
|
5
7
|
Declaration = 0,
|
|
@@ -24,12 +26,13 @@ export type ParseError = DeclarationError | TypeError | RefinementError | Transf
|
|
|
24
26
|
/**
|
|
25
27
|
* @tsplus companion fncts.schema.ParseError.DeclarationError
|
|
26
28
|
*/
|
|
27
|
-
export declare class DeclarationError {
|
|
29
|
+
export declare class DeclarationError implements Equatable {
|
|
28
30
|
readonly ast: Declaration;
|
|
29
31
|
readonly actual: unknown;
|
|
30
32
|
readonly error: ParseError;
|
|
31
33
|
readonly _tag = ParseErrorTag.Declaration;
|
|
32
34
|
constructor(ast: Declaration, actual: unknown, error: ParseError);
|
|
35
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
33
36
|
}
|
|
34
37
|
/**
|
|
35
38
|
* @tsplus static fncts.schema.ParseError.DeclarationError __call
|
|
@@ -40,11 +43,12 @@ export declare function declarationError(ast: Declaration, actual: unknown, erro
|
|
|
40
43
|
/**
|
|
41
44
|
* @tsplus companion fncts.schema.ParseError.TypeError
|
|
42
45
|
*/
|
|
43
|
-
export declare class TypeError {
|
|
46
|
+
export declare class TypeError implements Equatable {
|
|
44
47
|
readonly ast: AST;
|
|
45
48
|
readonly actual: unknown;
|
|
46
49
|
readonly _tag = ParseErrorTag.Type;
|
|
47
50
|
constructor(ast: AST, actual: unknown);
|
|
51
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
48
52
|
}
|
|
49
53
|
/**
|
|
50
54
|
* @tsplus static fncts.schema.ParseError.TypeError __call
|
|
@@ -55,7 +59,7 @@ export declare function typeError(expected: AST, actual: unknown): TypeError;
|
|
|
55
59
|
/**
|
|
56
60
|
* @tsplus companion fncts.schema.ParseError.TypeLiteralError
|
|
57
61
|
*/
|
|
58
|
-
export declare class TypeLiteralError {
|
|
62
|
+
export declare class TypeLiteralError implements Equatable {
|
|
59
63
|
readonly ast: TypeLiteral;
|
|
60
64
|
readonly actual: unknown;
|
|
61
65
|
readonly errors: Vector<KeyError>;
|
|
@@ -66,6 +70,7 @@ export declare class TypeLiteralError {
|
|
|
66
70
|
constructor(ast: TypeLiteral, actual: unknown, errors: Vector<KeyError>, output?: {
|
|
67
71
|
readonly [x: string]: unknown;
|
|
68
72
|
});
|
|
73
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
69
74
|
}
|
|
70
75
|
/**
|
|
71
76
|
* @tsplus static fncts.schema.ParseError.TypeLiteralError __call
|
|
@@ -78,13 +83,14 @@ export declare function typeLiteralError(ast: TypeLiteral, actual: unknown, erro
|
|
|
78
83
|
/**
|
|
79
84
|
* @tsplus companion fncts.schema.ParseError.TupleError
|
|
80
85
|
*/
|
|
81
|
-
export declare class TupleError {
|
|
86
|
+
export declare class TupleError implements Equatable {
|
|
82
87
|
readonly ast: Tuple;
|
|
83
88
|
readonly actual: unknown;
|
|
84
89
|
readonly errors: Vector<IndexError>;
|
|
85
90
|
readonly output: ReadonlyArray<unknown>;
|
|
86
91
|
readonly _tag = ParseErrorTag.Tuple;
|
|
87
92
|
constructor(ast: Tuple, actual: unknown, errors: Vector<IndexError>, output?: ReadonlyArray<unknown>);
|
|
93
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
88
94
|
}
|
|
89
95
|
/**
|
|
90
96
|
* @tsplus static fncts.schema.ParseError.TupleError __call
|
|
@@ -95,11 +101,12 @@ export declare function tupleError(ast: Tuple, actual: unknown, errors: Vector<I
|
|
|
95
101
|
/**
|
|
96
102
|
* @tsplus companion fncts.schema.ParseError.IndexError
|
|
97
103
|
*/
|
|
98
|
-
export declare class IndexError {
|
|
104
|
+
export declare class IndexError implements Equatable {
|
|
99
105
|
readonly index: number;
|
|
100
106
|
readonly error: ParseError | MissingError | UnexpectedError;
|
|
101
107
|
readonly _tag = ParseErrorTag.Index;
|
|
102
108
|
constructor(index: number, error: ParseError | MissingError | UnexpectedError);
|
|
109
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
103
110
|
}
|
|
104
111
|
/**
|
|
105
112
|
* @tsplus static fncts.schema.ParseError.IndexError __call
|
|
@@ -110,12 +117,13 @@ export declare function indexError(index: number, error: ParseError | MissingErr
|
|
|
110
117
|
/**
|
|
111
118
|
* @tsplus companion fncts.schema.ParseError.KeyError
|
|
112
119
|
*/
|
|
113
|
-
export declare class KeyError {
|
|
120
|
+
export declare class KeyError implements Equatable {
|
|
114
121
|
readonly keyAST: AST;
|
|
115
122
|
readonly key: any;
|
|
116
123
|
readonly error: ParseError | MissingError | UnexpectedError;
|
|
117
124
|
readonly _tag = ParseErrorTag.Key;
|
|
118
125
|
constructor(keyAST: AST, key: any, error: ParseError | MissingError | UnexpectedError);
|
|
126
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
119
127
|
}
|
|
120
128
|
/**
|
|
121
129
|
* @tsplus static fncts.schema.ParseError.KeyError __call
|
|
@@ -126,8 +134,9 @@ export declare function keyError(keyAST: AST, key: any, error: ParseError | Miss
|
|
|
126
134
|
/**
|
|
127
135
|
* @tsplus companion fncts.schema.ParseError.MissingError
|
|
128
136
|
*/
|
|
129
|
-
export declare class MissingError {
|
|
137
|
+
export declare class MissingError implements Equatable {
|
|
130
138
|
readonly _tag = ParseErrorTag.Missing;
|
|
139
|
+
[Symbol.equals](that: unknown): boolean;
|
|
131
140
|
}
|
|
132
141
|
/**
|
|
133
142
|
* @tsplus static fncts.schema.ParseErrorOps MissingError
|
|
@@ -137,10 +146,11 @@ export declare const missingError: MissingError;
|
|
|
137
146
|
/**
|
|
138
147
|
* @tsplus companion fncts.schema.ParseError.UnexpectedError
|
|
139
148
|
*/
|
|
140
|
-
export declare class UnexpectedError {
|
|
149
|
+
export declare class UnexpectedError implements Equatable {
|
|
141
150
|
readonly actual: unknown;
|
|
142
151
|
readonly _tag = ParseErrorTag.Unexpected;
|
|
143
152
|
constructor(actual: unknown);
|
|
153
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
144
154
|
}
|
|
145
155
|
/**
|
|
146
156
|
* @tsplus static fncts.schema.ParseError.UnexpectedError __call
|
|
@@ -151,12 +161,13 @@ export declare function unexpectedError(actual: unknown): UnexpectedError;
|
|
|
151
161
|
/**
|
|
152
162
|
* @tsplus companion fncts.schema.ParseError.UnionError
|
|
153
163
|
*/
|
|
154
|
-
export declare class UnionError {
|
|
164
|
+
export declare class UnionError implements Equatable {
|
|
155
165
|
readonly ast: Union;
|
|
156
166
|
readonly actual: unknown;
|
|
157
167
|
readonly errors: Vector<TypeError | TypeLiteralError | UnionMemberError>;
|
|
158
168
|
readonly _tag = ParseErrorTag.Union;
|
|
159
169
|
constructor(ast: Union, actual: unknown, errors: Vector<TypeError | TypeLiteralError | UnionMemberError>);
|
|
170
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
160
171
|
}
|
|
161
172
|
/**
|
|
162
173
|
* @tsplus static fncts.schema.ParseError.UnionError __call
|
|
@@ -167,11 +178,12 @@ export declare function unionError(ast: Union, actual: unknown, errors: Vector<T
|
|
|
167
178
|
/**
|
|
168
179
|
* @tsplus companion fncts.schema.ParseError.UnionMemberError
|
|
169
180
|
*/
|
|
170
|
-
export declare class UnionMemberError {
|
|
181
|
+
export declare class UnionMemberError implements Equatable {
|
|
171
182
|
readonly ast: AST;
|
|
172
183
|
readonly error: ParseError;
|
|
173
184
|
readonly _tag = ParseErrorTag.UnionMember;
|
|
174
185
|
constructor(ast: AST, error: ParseError);
|
|
186
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
175
187
|
}
|
|
176
188
|
/**
|
|
177
189
|
* @tsplus static fncts.schema.ParseError.UnionMemberError __call
|
|
@@ -182,13 +194,14 @@ export declare function unionMemberError(ast: AST, error: ParseError): UnionMemb
|
|
|
182
194
|
/**
|
|
183
195
|
* @tsplus companion fncts.schema.ParseError.RefinementError
|
|
184
196
|
*/
|
|
185
|
-
export declare class RefinementError {
|
|
197
|
+
export declare class RefinementError implements Equatable {
|
|
186
198
|
readonly ast: Refinement;
|
|
187
199
|
readonly actual: unknown;
|
|
188
200
|
readonly kind: "From" | "Predicate";
|
|
189
201
|
readonly error: ParseError;
|
|
190
202
|
readonly _tag = ParseErrorTag.Refinement;
|
|
191
203
|
constructor(ast: Refinement, actual: unknown, kind: "From" | "Predicate", error: ParseError);
|
|
204
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
192
205
|
}
|
|
193
206
|
/**
|
|
194
207
|
* @tsplus static fncts.schema.ParseError.RefinementError __call
|
|
@@ -199,13 +212,14 @@ export declare function refinementError(ast: Refinement, actual: unknown, kind:
|
|
|
199
212
|
/**
|
|
200
213
|
* @tsplus companion fncts.schema.ParseError.TransformationError
|
|
201
214
|
*/
|
|
202
|
-
export declare class TransformationError {
|
|
215
|
+
export declare class TransformationError implements Equatable {
|
|
203
216
|
readonly ast: Transform;
|
|
204
217
|
readonly actual: unknown;
|
|
205
218
|
readonly kind: "Encoded" | "Transformation" | "Type";
|
|
206
219
|
readonly error: ParseError;
|
|
207
220
|
readonly _tag = ParseErrorTag.Transformation;
|
|
208
221
|
constructor(ast: Transform, actual: unknown, kind: "Encoded" | "Transformation" | "Type", error: ParseError);
|
|
222
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
209
223
|
}
|
|
210
224
|
/**
|
|
211
225
|
* @tsplus static fncts.schema.ParseError.TransformationError __call
|
|
@@ -216,12 +230,13 @@ export declare function transformationError(ast: Transform, actual: unknown, kin
|
|
|
216
230
|
/**
|
|
217
231
|
* @tsplus companion fncts.schema.ParseError.IterableError
|
|
218
232
|
*/
|
|
219
|
-
export declare class IterableError {
|
|
233
|
+
export declare class IterableError implements Equatable {
|
|
220
234
|
readonly ast: AST;
|
|
221
235
|
readonly actual: unknown;
|
|
222
236
|
readonly errors: Vector<IndexError | KeyError>;
|
|
223
237
|
readonly _tag = ParseErrorTag.Iterable;
|
|
224
238
|
constructor(ast: AST, actual: unknown, errors: Vector<IndexError | KeyError>);
|
|
239
|
+
[Symbol.equals](that: unknown, context: EqualsContext): boolean;
|
|
225
240
|
}
|
|
226
241
|
/**
|
|
227
242
|
* @tsplus static fncts.schema.ParseError.IterableError __call
|