@fncts/schema 0.0.4 → 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
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.UnionMemberError = exports.UnexpectedError = exports.TypeError = exports.MissingError = exports.KeyError = exports.IndexError = void 0;
|
|
7
|
+
exports.format = format;
|
|
8
|
+
exports.indexError = indexError;
|
|
9
|
+
exports.keyError = keyError;
|
|
10
|
+
exports.missingError = void 0;
|
|
11
|
+
exports.typeError = typeError;
|
|
12
|
+
exports.unexpectedError = unexpectedError;
|
|
13
|
+
exports.unionMemberError = unionMemberError;
|
|
14
|
+
var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Vector/api"));
|
|
15
|
+
var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/RoseTree/api"));
|
|
16
|
+
var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/constructors"));
|
|
17
|
+
var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/schema/ASTAnnotation"));
|
|
18
|
+
var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/destructors"));
|
|
19
|
+
var tsplus_module_6 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/api"));
|
|
20
|
+
var _Showable = /*#__PURE__*/require("@fncts/base/data/Showable");
|
|
21
|
+
var _AST = /*#__PURE__*/require("@fncts/schema/AST");
|
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24
|
+
/**
|
|
25
|
+
* @tsplus companion fncts.schema.ParseError.TypeError
|
|
26
|
+
*/
|
|
27
|
+
class TypeError {
|
|
28
|
+
constructor(expected, actual) {
|
|
29
|
+
this.expected = expected;
|
|
30
|
+
this.actual = actual;
|
|
31
|
+
this._tag = 0 /* ParseErrorTag.Type */;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @tsplus static fncts.schema.ParseError.TypeError __call
|
|
36
|
+
* @tsplus static fncts.schema.ParseErrorOps TypeError
|
|
37
|
+
*/
|
|
38
|
+
exports.TypeError = TypeError;
|
|
39
|
+
function typeError(expected, actual) {
|
|
40
|
+
return new TypeError(expected, actual);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @tsplus companion fncts.schema.ParseError.IndexError
|
|
44
|
+
*/
|
|
45
|
+
class IndexError {
|
|
46
|
+
constructor(index, errors) {
|
|
47
|
+
this.index = index;
|
|
48
|
+
this.errors = errors;
|
|
49
|
+
this._tag = 1 /* ParseErrorTag.Index */;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @tsplus static fncts.schema.ParseError.IndexError __call
|
|
54
|
+
* @tsplus static fncts.schema.ParseErrorOps IndexError
|
|
55
|
+
*/
|
|
56
|
+
exports.IndexError = IndexError;
|
|
57
|
+
function indexError(index, errors) {
|
|
58
|
+
return new IndexError(index, errors);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @tsplus companion fncts.schema.ParseError.KeyError
|
|
62
|
+
*/
|
|
63
|
+
class KeyError {
|
|
64
|
+
constructor(keyAST, key, errors) {
|
|
65
|
+
this.keyAST = keyAST;
|
|
66
|
+
this.key = key;
|
|
67
|
+
this.errors = errors;
|
|
68
|
+
this._tag = 2 /* ParseErrorTag.Key */;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @tsplus static fncts.schema.ParseError.IndexError __call
|
|
73
|
+
* @tsplus static fncts.schema.ParseErrorOps KeyError
|
|
74
|
+
*/
|
|
75
|
+
exports.KeyError = KeyError;
|
|
76
|
+
function keyError(keyAST, key, errors) {
|
|
77
|
+
return new KeyError(keyAST, key, errors);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* @tsplus companion fncts.schema.ParseError.MissingError
|
|
81
|
+
*/
|
|
82
|
+
class MissingError {
|
|
83
|
+
constructor() {
|
|
84
|
+
this._tag = 3 /* ParseErrorTag.Missing */;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* @tsplus static fncts.schema.ParseErrorOps MissingError
|
|
89
|
+
*/
|
|
90
|
+
exports.MissingError = MissingError;
|
|
91
|
+
const missingError = /*#__PURE__*/new MissingError();
|
|
92
|
+
/**
|
|
93
|
+
* @tsplus companion fncts.schema.ParseError.UnexpectedError
|
|
94
|
+
*/
|
|
95
|
+
exports.missingError = missingError;
|
|
96
|
+
class UnexpectedError {
|
|
97
|
+
constructor(actual) {
|
|
98
|
+
this.actual = actual;
|
|
99
|
+
this._tag = 4 /* ParseErrorTag.Unexpected */;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* @tsplus static fncts.schema.ParseError.UnexpectedError __call
|
|
104
|
+
* @tsplus static fncts.schema.ParseErrorOps UnexpectedError
|
|
105
|
+
*/
|
|
106
|
+
exports.UnexpectedError = UnexpectedError;
|
|
107
|
+
function unexpectedError(actual) {
|
|
108
|
+
return new UnexpectedError(actual);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* @tsplus companion fncts.schema.ParseError.UnionMemberError
|
|
112
|
+
*/
|
|
113
|
+
class UnionMemberError {
|
|
114
|
+
constructor(errors) {
|
|
115
|
+
this.errors = errors;
|
|
116
|
+
this._tag = 5 /* ParseErrorTag.UnionMember */;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* @tsplus static fncts.schema.ParseError.UnionMemberError __call
|
|
121
|
+
* @tsplus static fncts.schema.ParseErrorOps UnionMemberError
|
|
122
|
+
*/
|
|
123
|
+
exports.UnionMemberError = UnionMemberError;
|
|
124
|
+
function unionMemberError(errors) {
|
|
125
|
+
return new UnionMemberError(errors);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* @tsplus static fncts.schema.ParseErrorOps format
|
|
129
|
+
*/
|
|
130
|
+
function format(errors) {
|
|
131
|
+
return tsplus_module_2.draw(tsplus_module_2.make(`${errors.length} error(s) found`, tsplus_module_1.map(go)(errors)));
|
|
132
|
+
}
|
|
133
|
+
function formatActual(actual) {
|
|
134
|
+
return (0, _Showable.showWithOptions)(actual, {
|
|
135
|
+
colors: false
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
function formatTemplateLiteralSpan(span) {
|
|
139
|
+
switch (span.type._tag) {
|
|
140
|
+
case 8 /* ASTTag.StringKeyword */:
|
|
141
|
+
return "${string}";
|
|
142
|
+
case 9 /* ASTTag.NumberKeyword */:
|
|
143
|
+
return "${number}";
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function formatTemplateLiteral(ast) {
|
|
147
|
+
return ast.head + tsplus_module_1.join("")(tsplus_module_1.map(span => formatTemplateLiteralSpan(span) + span.literal)(ast.spans));
|
|
148
|
+
}
|
|
149
|
+
function getExpected(ast) {
|
|
150
|
+
return tsplus_module_6.flatMap(title => tsplus_module_5.match(() => tsplus_module_3.just(title), description => tsplus_module_3.just(`${title} (${description})`))(ast.annotations.get(tsplus_module_4.Description)))(tsplus_module_6.orElse(() => ast.annotations.get(tsplus_module_4.Title))(ast.annotations.get(tsplus_module_4.Identifier)));
|
|
151
|
+
}
|
|
152
|
+
function getMissedBrands(ast) {
|
|
153
|
+
return tsplus_module_1.join(" & ")(tsplus_module_1.map(validation => validation.name)(ast.validation));
|
|
154
|
+
}
|
|
155
|
+
function formatExpected(ast) {
|
|
156
|
+
void 0;
|
|
157
|
+
switch (ast._tag) {
|
|
158
|
+
case 8 /* ASTTag.StringKeyword */:
|
|
159
|
+
return tsplus_module_6.getOrElse(() => "string")(getExpected(ast));
|
|
160
|
+
case 9 /* ASTTag.NumberKeyword */:
|
|
161
|
+
return tsplus_module_6.getOrElse(() => "number")(getExpected(ast));
|
|
162
|
+
case 10 /* ASTTag.BooleanKeyword */:
|
|
163
|
+
return tsplus_module_6.getOrElse(() => "boolean")(getExpected(ast));
|
|
164
|
+
case 11 /* ASTTag.BigIntKeyword */:
|
|
165
|
+
return tsplus_module_6.getOrElse(() => "bigint")(getExpected(ast));
|
|
166
|
+
case 3 /* ASTTag.UndefinedKeyword */:
|
|
167
|
+
return tsplus_module_6.getOrElse(() => "undefined")(getExpected(ast));
|
|
168
|
+
case 12 /* ASTTag.SymbolKeyword */:
|
|
169
|
+
return tsplus_module_6.getOrElse(() => "symbol")(getExpected(ast));
|
|
170
|
+
case 13 /* ASTTag.ObjectKeyword */:
|
|
171
|
+
return tsplus_module_6.getOrElse(() => "object")(getExpected(ast));
|
|
172
|
+
case 7 /* ASTTag.AnyKeyword */:
|
|
173
|
+
return tsplus_module_6.getOrElse(() => "any")(getExpected(ast));
|
|
174
|
+
case 6 /* ASTTag.UnknownKeyword */:
|
|
175
|
+
return tsplus_module_6.getOrElse(() => "unknown")(getExpected(ast));
|
|
176
|
+
case 4 /* ASTTag.VoidKeyword */:
|
|
177
|
+
return tsplus_module_6.getOrElse(() => "void")(getExpected(ast));
|
|
178
|
+
case 5 /* ASTTag.NeverKeyword */:
|
|
179
|
+
return tsplus_module_6.getOrElse(() => "never")(getExpected(ast));
|
|
180
|
+
case 1 /* ASTTag.Literal */:
|
|
181
|
+
return tsplus_module_6.getOrElse(() => formatActual(ast.literal))(getExpected(ast));
|
|
182
|
+
case 2 /* ASTTag.UniqueSymbol */:
|
|
183
|
+
return tsplus_module_6.getOrElse(() => formatActual(ast.symbol))(getExpected(ast));
|
|
184
|
+
case 18 /* ASTTag.Union */:
|
|
185
|
+
return tsplus_module_1.join(" or ")(tsplus_module_1.map(formatExpected)(ast.types));
|
|
186
|
+
case 20 /* ASTTag.Refinement */:
|
|
187
|
+
return tsplus_module_6.getOrElse(() => "refinement")(getExpected(ast));
|
|
188
|
+
case 15 /* ASTTag.TemplateLiteral */:
|
|
189
|
+
return tsplus_module_6.getOrElse(() => formatTemplateLiteral(ast))(getExpected(ast));
|
|
190
|
+
case 16 /* ASTTag.Tuple */:
|
|
191
|
+
return tsplus_module_6.getOrElse(() => "tuple or array")(getExpected(ast));
|
|
192
|
+
case 17 /* ASTTag.TypeLiteral */:
|
|
193
|
+
return tsplus_module_6.getOrElse(() => "type literal")(getExpected(ast));
|
|
194
|
+
case 14 /* ASTTag.Enum */:
|
|
195
|
+
return tsplus_module_6.getOrElse(() => tsplus_module_1.join(" | ")(tsplus_module_1.map(([_, value]) => JSON.stringify(value))(ast.enums)))(getExpected(ast));
|
|
196
|
+
case 19 /* ASTTag.Lazy */:
|
|
197
|
+
return tsplus_module_6.getOrElse(() => "<anonymous lazy schema>")(getExpected(ast));
|
|
198
|
+
case 0 /* ASTTag.Declaration */:
|
|
199
|
+
return tsplus_module_6.getOrElse(() => "<anonymous Declaration schema>")(getExpected(ast));
|
|
200
|
+
case 21 /* ASTTag.Transform */:
|
|
201
|
+
return `a parsable value from ${formatExpected(ast.from)} to ${formatExpected(ast.to)}`;
|
|
202
|
+
case 22 /* ASTTag.Validation */:
|
|
203
|
+
return tsplus_module_5.match(() => getMissedBrands(ast), expected => `${expected} with validation(s) ${getMissedBrands(ast)}`)(getExpected(ast));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function go(error) {
|
|
207
|
+
switch (error._tag) {
|
|
208
|
+
case 0 /* ParseErrorTag.Type */:
|
|
209
|
+
return tsplus_module_2.make(tsplus_module_6.getOrElse(() => `Expected ${formatExpected(error.expected)}, actual ${formatActual(error.actual)}`)(tsplus_module_6.map(f => f(error.actual))(error.expected.annotations.get(tsplus_module_4.Message))));
|
|
210
|
+
case 1 /* ParseErrorTag.Index */:
|
|
211
|
+
return tsplus_module_2.make(`index ${error.index}`, tsplus_module_1.map(go)(error.errors));
|
|
212
|
+
case 4 /* ParseErrorTag.Unexpected */:
|
|
213
|
+
return tsplus_module_2.make("is unexpected");
|
|
214
|
+
case 2 /* ParseErrorTag.Key */:
|
|
215
|
+
return tsplus_module_2.make(`key ${formatActual(error.key)}`, tsplus_module_1.map(go)(error.errors));
|
|
216
|
+
case 3 /* ParseErrorTag.Missing */:
|
|
217
|
+
return tsplus_module_2.make("is missing");
|
|
218
|
+
case 5 /* ParseErrorTag.UnionMember */:
|
|
219
|
+
return tsplus_module_2.make("union member", tsplus_module_1.map(go)(error.errors));
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
//# sourceMappingURL=ParseError.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParseError.cjs","mappings":";;;;;;;;;;;;;;;;;;;AAEA;AACA;AAA6C;AAAA;AA0B7C;;;AAGM,MAAOA,SAAS;EAEpBC,YAAqBC,QAAa,EAAWC,MAAe;IAAvC,aAAQ,GAARD,QAAQ;IAAgB,WAAM,GAANC,MAAM;IAD1C,SAAI;EACkD;;AAGjE;;;;AAAA;AAIM,SAAUC,SAAS,CAACF,QAAa,EAAEC,MAAe;EACtD,OAAO,IAAIH,SAAS,CAACE,QAAQ,EAAEC,MAAM,CAAC;AACxC;AAEA;;;AAGM,MAAOE,UAAU;EAErBJ,YAAqBK,KAAa,EAAWC,MAA0B;IAAlD,UAAK,GAALD,KAAK;IAAmB,WAAM,GAANC,MAAM;IAD1C,SAAI;EAC6D;;AAG5E;;;;AAAA;AAIM,SAAUC,UAAU,CAACF,KAAa,EAAEC,MAA0B;EAClE,OAAO,IAAIF,UAAU,CAACC,KAAK,EAAEC,MAAM,CAAC;AACtC;AAEA;;;AAGM,MAAOE,QAAQ;EAEnBR,YAAqBS,MAAW,EAAWC,GAAQ,EAAWJ,MAA0B;IAAnE,WAAM,GAANG,MAAM;IAAgB,QAAG,GAAHC,GAAG;IAAgB,WAAM,GAANJ,MAAM;IAD3D,SAAI;EAC8E;;AAG7F;;;;AAAA;AAIM,SAAUK,QAAQ,CAACF,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,CAACuB,IAAI,CAAC,OAAOR,cAAc,CAACf,GAAG,CAACwB,EAAE,CAAC,EAAE;IACzF;MACE,OAAOjB,sBACL,MAAMK,eAAe,CAACZ,GAAG,CAAC,EACzB7B,QAAQ,IAAK,GAAGA,QAAQ,uBAAuByC,eAAe,CAACZ,GAAG,CAAC,EAAE,EAFjEI,WAAW,CAACJ,GAAG,CAAC,CAGtB;EAAC;AAER;AAEA,SAASR,EAAE,CAACiC,KAAiB;EAC3B,QAAQA,KAAK,CAAC3B,IAAI;IAChB;MACE,OAAOT,qBACLgB,gCAGa,YAAYU,cAAc,CAACU,KAAK,CAACtD,QAAQ,CAAC,YAAYsB,YAAY,CAACgC,KAAK,CAACrD,MAAM,CAAC,EAAE,EAH/FiC,oBAEQqB,CAAC,IAAKA,CAAC,CAACD,KAAK,CAACrD,MAAM,CAAC,EAF7BqD,KAAK,CAACtD,QAAQ,CAACuC,WAAW,CACvBC,GAAG,yBAAuB,CACC,CACkE,CACjG;IACH;MACE,OAAOtB,qBAAS,SAASoC,KAAK,CAAClD,KAAK,EAAE,EAAEgB,oBAAiBC,EAAE,EAAnBiC,KAAK,CAACjD,MAAM,CAAQ,CAAC;IAC/D;MACE,OAAOa,qBAAS,eAAe,CAAC;IAClC;MACE,OAAOA,qBAAS,OAAOI,YAAY,CAACgC,KAAK,CAAC7C,GAAG,CAAC,EAAE,EAAEW,oBAAiBC,EAAE,EAAnBiC,KAAK,CAACjD,MAAM,CAAQ,CAAC;IACzE;MACE,OAAOa,qBAAS,YAAY,CAAC;IAC/B;MACE,OAAOA,qBAAS,cAAc,EAAEE,oBAAiBC,EAAE,EAAnBiC,KAAK,CAACjD,MAAM,CAAQ,CAAC;EAAC;AAE5D","names":["TypeError","constructor","expected","actual","typeError","IndexError","index","errors","indexError","KeyError","keyAST","key","keyError","MissingError","missingError","UnexpectedError","unexpectedError","UnionMemberError","unionMemberError","format","tsplus_module_2","length","tsplus_module_1","go","formatActual","colors","formatTemplateLiteralSpan","span","type","_tag","formatTemplateLiteral","ast","head","literal","spans","getExpected","tsplus_module_6","title","tsplus_module_5","tsplus_module_3","description","annotations","get","getMissedBrands","validation","name","formatExpected","symbol","types","_","value","JSON","stringify","enums","from","to","error","f"],"sourceRoot":"","sources":["../_src/ParseError.ts"],"sourcesContent":[null]}
|
|
@@ -3,27 +3,29 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
exports.fail = fail;
|
|
7
|
+
exports.failures = failures;
|
|
8
|
+
exports.succeed = succeed;
|
|
9
|
+
var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Either/constructors"));
|
|
10
|
+
var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Vector/api"));
|
|
9
11
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
//# sourceMappingURL=
|
|
13
|
+
/**
|
|
14
|
+
* @tsplus static fncts.schema.ParseResultOps succeed
|
|
15
|
+
*/
|
|
16
|
+
function succeed(value) {
|
|
17
|
+
return tsplus_module_1.right(value);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @tsplus static fncts.schema.ParseResultOps failures
|
|
21
|
+
*/
|
|
22
|
+
function failures(value) {
|
|
23
|
+
return tsplus_module_1.left(value);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @tsplus static fncts.schema.ParseResultOps fail
|
|
27
|
+
*/
|
|
28
|
+
function fail(value) {
|
|
29
|
+
return tsplus_module_1.left(tsplus_module_2.vector(value));
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=ParseResult.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParseResult.cjs","mappings":";;;;;;;;;;;;AAMA;;;AAGM,SAAUA,OAAO,CAAIC,KAAQ;EACjC,OAAOC,sBAAaD,KAAK,CAAC;AAC5B;AAEA;;;AAGM,SAAUE,QAAQ,CAAYF,KAAyB;EAC3D,OAAOC,qBAAYD,KAAK,CAAC;AAC3B;AAEA;;;AAGM,SAAUG,IAAI,CAAYH,KAAiB;EAC/C,OAAOC,qBAAYG,uBAAOJ,KAAK,CAAC,CAAC;AACnC","names":["succeed","value","tsplus_module_1","failures","fail","tsplus_module_2"],"sourceRoot":"","sources":["../_src/ParseResult.ts"],"sourcesContent":[null]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.asserts = asserts;
|
|
7
|
+
exports.decode = decode;
|
|
8
|
+
exports.decodeMaybe = decodeMaybe;
|
|
9
|
+
exports.encode = encode;
|
|
10
|
+
exports.encodeMaybe = encodeMaybe;
|
|
11
|
+
exports.is = is;
|
|
12
|
+
var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/schema/AST"));
|
|
13
|
+
var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Either/api"));
|
|
14
|
+
var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/schema/ParseError"));
|
|
15
|
+
var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/function/api"));
|
|
16
|
+
var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Either/destructors"));
|
|
17
|
+
var _interpreter = /*#__PURE__*/require("./interpreter.cjs");
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
20
|
+
/**
|
|
21
|
+
* @tsplus getter fncts.schema.Schema decode
|
|
22
|
+
* @tsplus getter fncts.schema.Parser decode
|
|
23
|
+
*/
|
|
24
|
+
function decode(schema) {
|
|
25
|
+
return (0, _interpreter.parserFor)(schema.ast);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @tsplus getter fncts.schema.Schema decodeMaybe
|
|
29
|
+
* @tsplus getter fncts.schema.Parser decodeMaybe
|
|
30
|
+
*/
|
|
31
|
+
function decodeMaybe(schema) {
|
|
32
|
+
return parseMaybe(tsplus_module_1.getTo(schema.ast));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @tsplus getter fncts.schema.Schema encode
|
|
36
|
+
* @tsplus getter fncts.schema.Parser encode
|
|
37
|
+
*/
|
|
38
|
+
function encode(schema) {
|
|
39
|
+
return (0, _interpreter.parserFor)(tsplus_module_1.reverse(schema.ast));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @tsplus getter fncts.schema.Schema encodeMaybe
|
|
43
|
+
* @tsplus getter fncts.schema.Parser encodeMaybe
|
|
44
|
+
*/
|
|
45
|
+
function encodeMaybe(schema) {
|
|
46
|
+
return parseMaybe(tsplus_module_1.reverse(schema.ast));
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @tsplus getter fncts.schema.Schema is
|
|
50
|
+
* @tsplus getter fncts.schema.Parser is
|
|
51
|
+
*/
|
|
52
|
+
function is(schema) {
|
|
53
|
+
return (input, options) => {
|
|
54
|
+
return tsplus_module_2.isRight((0, _interpreter.parserFor)(schema.ast)(input, options));
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function parseMaybe(ast) {
|
|
58
|
+
const parse = (0, _interpreter.parserFor)(ast);
|
|
59
|
+
return (input, options) => {
|
|
60
|
+
return tsplus_module_2.toMaybe(parse(input, options));
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function parseOrThrow(ast) {
|
|
64
|
+
const parser = (0, _interpreter.parserFor)(ast);
|
|
65
|
+
return (input, options) => {
|
|
66
|
+
return tsplus_module_5.match(errors => {
|
|
67
|
+
throw new Error(tsplus_module_3.format(errors));
|
|
68
|
+
}, tsplus_module_4.identity)(parser(input, options));
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @tsplus getter fncts.schema.Schema asserts
|
|
73
|
+
* @tsplus getter fncts.schema.Parser asserts
|
|
74
|
+
*/
|
|
75
|
+
function asserts(schema) {
|
|
76
|
+
return (input, options) => {
|
|
77
|
+
parseOrThrow(tsplus_module_1.getTo(schema.ast))(input, options);
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=api.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.cjs","mappings":";;;;;;;;;;;;;;;;AAEA;AAA6C;AAAA;AAE7C;;;;AAIM,SAAUA,MAAM,CAAIC,MAAiB;EACzC,OAAO,0BAAS,EAACA,MAAM,CAACC,GAAG,CAAC;AAC9B;AAEA;;;;AAIM,SAAUC,WAAW,CAAIF,MAAiB;EAC9C,OAAOG,UAAU,uBAACH,MAAM,CAACC,GAAG,EAAO;AACrC;AAEA;;;;AAIM,SAAUG,MAAM,CAAIJ,MAAiB;EACzC,OAAO,0BAAS,0BAACA,MAAM,CAACC,GAAG,EAAS;AACtC;AAEA;;;;AAIM,SAAUI,WAAW,CAAIL,MAAiB;EAC9C,OAAOG,UAAU,yBAACH,MAAM,CAACC,GAAG,EAAS;AACvC;AAEA;;;;AAIM,SAAUK,EAAE,CAAIN,MAAiB;EACrC,OAAO,CAACO,KAAc,EAAEC,OAAsB,KAAgB;IAC5D,OAAOC,kDAAS,EAACT,MAAM,CAACC,GAAG,CAAC,CAACM,KAAK,EAAEC,OAAO,CAAC,CAAU;EACxD,CAAC;AACH;AAEA,SAASL,UAAU,CAACF,GAAQ;EAC1B,MAAMS,KAAK,GAAG,0BAAS,EAACT,GAAG,CAAC;EAC5B,OAAO,CAACM,KAAc,EAAEC,OAAsB,KAAgB;IAC5D,+BAAOE,KAAK,CAACH,KAAK,EAAEC,OAAO,CAAC;EAC9B,CAAC;AACH;AAEA,SAASG,YAAY,CAACV,GAAQ;EAC5B,MAAMW,MAAM,GAAG,0BAAS,EAACX,GAAG,CAAC;EAC7B,OAAO,CAACM,KAAc,EAAEC,OAAsB,KAAI;IAChD,OAAOK,sBAA8BC,MAAM,IAAI;MAC7C,MAAM,IAAIC,KAAK,CAACC,uBAAkBF,MAAM,CAAC,CAAC;IAC5C,CAAC,4BAFMF,MAAM,CAACL,KAAK,EAAEC,OAAO,CAAC,CAER;EACvB,CAAC;AACH;AAEA;;;;AAIM,SAAUS,OAAO,CAAIjB,MAAiB;EAC1C,OAAO,CAACO,KAAc,EAAEC,OAAsB,KAAwB;IACpEG,YAAY,uBAACX,MAAM,CAACC,GAAG,EAAO,CAACM,KAAK,EAAEC,OAAO,CAAC;EAChD,CAAC;AACH","names":["decode","schema","ast","decodeMaybe","parseMaybe","encode","encodeMaybe","is","input","options","tsplus_module_2","parse","parseOrThrow","parser","tsplus_module_5","errors","Error","tsplus_module_3","asserts"],"sourceRoot":"","sources":["../../_src/Parser/api.ts"],"sourcesContent":[null]}
|
|
@@ -3,27 +3,22 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
var
|
|
6
|
+
exports.fromRefinement = fromRefinement;
|
|
7
|
+
exports.make = make;
|
|
8
|
+
var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/schema/ParseResult"));
|
|
9
|
+
var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/schema/ParseError"));
|
|
9
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
10
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
lazy: tsplus_module_1.deriveLazy,
|
|
25
|
-
validation: tsplus_module_1.validation,
|
|
26
|
-
union: members => tsplus_module_1.deriveUnion(...members)
|
|
27
|
-
};
|
|
28
|
-
exports.Schemable = Schemable;
|
|
29
|
-
//# sourceMappingURL=Guard.cjs.map
|
|
12
|
+
/**
|
|
13
|
+
* @tsplus static fncts.schema.ParserOps make
|
|
14
|
+
*/
|
|
15
|
+
function make(parse) {
|
|
16
|
+
return parse;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @tsplus static fncts.schema.ParserOps fromRefinement
|
|
20
|
+
*/
|
|
21
|
+
function fromRefinement(ast, refinement) {
|
|
22
|
+
return u => refinement(u) ? tsplus_module_1.succeed(u) : tsplus_module_1.fail(tsplus_module_2.typeError(ast, u));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=definition.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.cjs","mappings":";;;;;;;;;;;AAWA;;;AAGM,SAAUA,IAAI,CAAIC,KAAgB;EACtC,OAAOA,KAAK;AACd;AAEA;;;AAGM,SAAUC,cAAc,CAAIC,GAAQ,EAAEC,UAAkC;EAC5E,OAAQC,CAAC,IAAMD,UAAU,CAACC,CAAC,CAAC,GAAGC,wBAAoBD,CAAC,CAAC,GAAGC,qBAAiBC,0BAAqBJ,GAAG,EAAEE,CAAC,CAAC,CAAE;AACzG","names":["make","parse","fromRefinement","ast","refinement","u","tsplus_module_1","tsplus_module_2"],"sourceRoot":"","sources":["../../_src/Parser/definition.ts"],"sourcesContent":[null]}
|