@fncts/schema 0.0.13 → 0.0.15
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 +29 -12
- package/Guard.d.ts +9 -0
- package/ParseError.d.ts +40 -3
- package/ParseFailure.d.ts +18 -0
- package/ParseResult.d.ts +2 -1
- package/Parser/api.d.ts +0 -6
- package/Parser/interpreter.d.ts +1 -2
- package/Show.d.ts +1 -1
- package/_cjs/AST.cjs +115 -65
- package/_cjs/AST.cjs.map +1 -1
- package/_cjs/Guard.cjs +278 -0
- package/_cjs/Guard.cjs.map +1 -0
- package/_cjs/ParseError.cjs +77 -3
- package/_cjs/ParseError.cjs.map +1 -1
- package/_cjs/ParseFailure.cjs +28 -0
- package/_cjs/ParseFailure.cjs.map +1 -0
- package/_cjs/ParseResult.cjs +4 -3
- package/_cjs/ParseResult.cjs.map +1 -1
- package/_cjs/Parser/api.cjs +11 -23
- package/_cjs/Parser/api.cjs.map +1 -1
- package/_cjs/Parser/interpreter.cjs +93 -141
- package/_cjs/Parser/interpreter.cjs.map +1 -1
- package/_cjs/Schema/api/conc.cjs +1 -1
- package/_cjs/Schema/api/conc.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/immutableArray.cjs +1 -1
- package/_cjs/Schema/api/immutableArray.cjs.map +1 -1
- package/_cjs/Schema/api/list.cjs +1 -1
- package/_cjs/Schema/api/list.cjs.map +1 -1
- package/_cjs/Schema/api.cjs +27 -28
- package/_cjs/Schema/api.cjs.map +1 -1
- package/_cjs/Show.cjs +23 -12
- package/_cjs/Show.cjs.map +1 -1
- package/_mjs/AST.mjs +107 -61
- package/_mjs/AST.mjs.map +1 -1
- package/_mjs/Guard.mjs +269 -0
- package/_mjs/Guard.mjs.map +1 -0
- package/_mjs/ParseError.mjs +72 -2
- package/_mjs/ParseError.mjs.map +1 -1
- package/_mjs/ParseFailure.mjs +20 -0
- package/_mjs/ParseFailure.mjs.map +1 -0
- package/_mjs/ParseResult.mjs +4 -3
- package/_mjs/ParseResult.mjs.map +1 -1
- package/_mjs/Parser/api.mjs +10 -21
- package/_mjs/Parser/api.mjs.map +1 -1
- package/_mjs/Parser/interpreter.mjs +94 -142
- package/_mjs/Parser/interpreter.mjs.map +1 -1
- package/_mjs/Schema/api/conc.mjs +1 -1
- package/_mjs/Schema/api/conc.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/immutableArray.mjs +1 -1
- package/_mjs/Schema/api/immutableArray.mjs.map +1 -1
- package/_mjs/Schema/api/list.mjs +1 -1
- package/_mjs/Schema/api/list.mjs.map +1 -1
- package/_mjs/Schema/api.mjs +27 -28
- package/_mjs/Schema/api.mjs.map +1 -1
- package/_mjs/Show.mjs +23 -12
- package/_mjs/Show.mjs.map +1 -1
- package/_src/AST.ts +96 -47
- package/_src/Guard.ts +268 -0
- package/_src/ParseError.ts +88 -4
- package/_src/ParseFailure.ts +18 -0
- package/_src/ParseResult.ts +3 -3
- package/_src/Parser/api.ts +8 -21
- package/_src/Parser/interpreter.ts +94 -128
- package/_src/Schema/api/conc.ts +1 -1
- package/_src/Schema/api/hashMap.ts +1 -1
- package/_src/Schema/api/immutableArray.ts +1 -1
- package/_src/Schema/api/list.ts +1 -1
- package/_src/Schema/api.ts +3 -10
- package/_src/Show.ts +28 -15
- package/_src/global.ts +4 -0
- package/global.d.ts +4 -0
- package/package.json +3 -3
package/_cjs/ParseError.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParseError.cjs","names":["_Showable","require","_AST","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","TypeError","constructor","expected","actual","_tag","exports","typeError","IndexError","index","errors","indexError","KeyError","keyAST","key","keyError","MissingError","missingError","UnexpectedError","unexpectedError","UnionMemberError","unionMemberError","format","tsplus_module_2","draw","make","length","tsplus_module_1","map","go","formatActual","showWithOptions","colors","formatTemplateLiteralSpan","span","type","formatTemplateLiteral","
|
|
1
|
+
{"version":3,"file":"ParseError.cjs","names":["_Showable","require","_AST","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","TypeError","constructor","expected","actual","_tag","exports","typeError","IndexError","index","errors","indexError","KeyError","keyAST","key","keyError","MissingError","missingError","UnexpectedError","unexpectedError","UnionMemberError","unionMemberError","RefinementError","ast","kind","refinementError","TransformationError","transformationError","format","tsplus_module_2","draw","make","length","tsplus_module_1","map","go","formatActual","showWithOptions","colors","formatTemplateLiteralSpan","span","type","formatTemplateLiteral","head","join","literal","spans","formatRefinementKind","error","formatTransformationKind","getExpected","tsplus_module_6","flatMap","title","tsplus_module_5","match","tsplus_module_3","just","fileName_1","description","annotations","tsplus_module_4","Description","orElse","Title","Identifier","getMissedBrands","validation","name","formatExpected","getOrElse","symbol","types","_","value","JSON","stringify","enums","from","to","f","Message"],"sources":["../_src/ParseError.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,IAAAA,SAAA,gBAAAC,OAAA;AACA,IAAAC,IAAA,gBAAAD,OAAA;AAA6C,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAI,wBAAAJ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,eAAAA,CAAA,uBAAA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AE,EAAEwB,eAAA,CAAAC,GAAA,CAAiBC,EAAE,EAAnBa,KAAK,CAACtC,MAAM,CAAQ,CAAC;IAC/D;MACE,OAAOmB,eAAA,CAAAE,IAAA,CAAS,eAAe,CAAC;IAClC;MACE,OAAOF,eAAA,CAAAE,IAAA,CAAS,OAAOK,YAAY,CAACY,KAAK,CAAClC,GAAG,CAAC,EAAE,EAAEmB,eAAA,CAAAC,GAAA,CAAiBC,EAAE,EAAnBa,KAAK,CAACtC,MAAM,CAAQ,CAAC;IACzE;MACE,OAAOmB,eAAA,CAAAE,IAAA,CAAS,YAAY,CAAC;IAC/B;MACE,OAAOF,eAAA,CAAAE,IAAA,CAAS,cAAc,EAAEE,eAAA,CAAAC,GAAA,CAAiBC,EAAE,EAAnBa,KAAK,CAACtC,MAAM,CAAQ,CAAC;IACvD;MACE,OAAOmB,eAAA,CAAAE,IAAA,CAASgB,oBAAoB,CAACC,KAAK,CAAC,EAAEf,eAAA,CAAAC,GAAA,CAAiBC,EAAE,EAAnBa,KAAK,CAACtC,MAAM,CAAQ,CAAC;IACpE;MACE,OAAOmB,eAAA,CAAAE,IAAA,CAASkB,wBAAwB,CAACD,KAAK,CAAC,EAAEf,eAAA,CAAAC,GAAA,CAAiBC,EAAE,EAAnBa,KAAK,CAACtC,MAAM,CAAQ,CAAC;EAC1E;AACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ParseFailureTypeId = exports.ParseFailure = void 0;
|
|
7
|
+
exports.make = make;
|
|
8
|
+
var _a;
|
|
9
|
+
const ParseFailureTypeId = exports.ParseFailureTypeId = /*#__PURE__*/Symbol.for("fncts.schema.ParseFailure");
|
|
10
|
+
/**
|
|
11
|
+
* @tsplus type fncts.schema.ParseFailure
|
|
12
|
+
* @tsplus companion fncts.schema.ParseFailureOps
|
|
13
|
+
*/
|
|
14
|
+
class ParseFailure {
|
|
15
|
+
constructor(errors) {
|
|
16
|
+
this.errors = errors;
|
|
17
|
+
this[_a] = ParseFailureTypeId;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.ParseFailure = ParseFailure;
|
|
21
|
+
_a = ParseFailureTypeId;
|
|
22
|
+
/**
|
|
23
|
+
* @tsplus static fncts.schema.ParseFailureOps __call
|
|
24
|
+
*/
|
|
25
|
+
function make(errors) {
|
|
26
|
+
return new ParseFailure(errors);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=ParseFailure.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParseFailure.cjs","names":["ParseFailureTypeId","exports","Symbol","for","ParseFailure","constructor","errors","_a","make"],"sources":["../_src/ParseFailure.ts"],"sourcesContent":[null],"mappings":";;;;;;;;AAAO,MAAMA,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,gBAAGE,MAAM,CAACC,GAAG,CAAC,2BAA2B,CAAC;AAGzE;;;;AAIM,MAAOC,YAAY;EAEvBC,YAAqBC,MAA0B;IAA1B,KAAAA,MAAM,GAANA,MAAM;IADlB,KAAAC,EAAA,CAAoB,GAAuBP,kBAAkB;EACpB;;AACnDC,OAAA,CAAAG,YAAA,GAAAA,YAAA;KAFWJ,kBAAkB;AAI9B;;;AAGM,SAAUQ,IAAIA,CAACF,MAA0B;EAC7C,OAAO,IAAIF,YAAY,CAACE,MAAM,CAAC;AACjC"}
|
package/_cjs/ParseResult.cjs
CHANGED
|
@@ -7,7 +7,8 @@ exports.fail = fail;
|
|
|
7
7
|
exports.failures = failures;
|
|
8
8
|
exports.succeed = succeed;
|
|
9
9
|
var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Either/constructors"));
|
|
10
|
-
var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
|
10
|
+
var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/schema/ParseFailure"));
|
|
11
|
+
var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Vector/api"));
|
|
11
12
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
13
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
14
|
const fileName_1 = "(@fncts/schema) src/ParseResult.ts";
|
|
@@ -21,12 +22,12 @@ function succeed(value) {
|
|
|
21
22
|
* @tsplus static fncts.schema.ParseResultOps failures
|
|
22
23
|
*/
|
|
23
24
|
function failures(value) {
|
|
24
|
-
return tsplus_module_1.left(value, fileName_1 + ":18:21");
|
|
25
|
+
return tsplus_module_1.left(tsplus_module_2.make(value), fileName_1 + ":18:21");
|
|
25
26
|
}
|
|
26
27
|
/**
|
|
27
28
|
* @tsplus static fncts.schema.ParseResultOps fail
|
|
28
29
|
*/
|
|
29
30
|
function fail(value) {
|
|
30
|
-
return tsplus_module_1.left(tsplus_module_2.vector(value), fileName_1 + ":25:21");
|
|
31
|
+
return tsplus_module_1.left(tsplus_module_2.make(tsplus_module_3.vector(value)), fileName_1 + ":25:21");
|
|
31
32
|
}
|
|
32
33
|
//# sourceMappingURL=ParseResult.cjs.map
|
package/_cjs/ParseResult.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParseResult.cjs","names":["succeed","value","tsplus_module_1","right","fileName_1","failures","left","fail","
|
|
1
|
+
{"version":3,"file":"ParseResult.cjs","names":["succeed","value","tsplus_module_1","right","fileName_1","failures","left","tsplus_module_2","make","fail","tsplus_module_3","vector"],"sources":["../_src/ParseResult.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;AAMA;;;AAGM,SAAUA,OAAOA,CAAIC,KAAQ;EACjC,OAAOC,eAAA,CAAAC,KAAA,CAAaF,KAAK,EAAAG,UAAA,YAAC;AAC5B;AAEA;;;AAGM,SAAUC,QAAQA,CAAYJ,KAAyB;EAC3D,OAAOC,eAAA,CAAAI,IAAA,CAAYC,eAAA,CAAAC,IAAA,CAAaP,KAAK,CAAC,EAAAG,UAAA,YAAC;AACzC;AAEA;;;AAGM,SAAUK,IAAIA,CAAYR,KAAiB;EAC/C,OAAOC,eAAA,CAAAI,IAAA,CAAYC,eAAA,CAAAC,IAAA,CAAaE,eAAA,CAAAC,MAAA,CAAOV,KAAK,CAAC,CAAC,EAAAG,UAAA,YAAC;AACjD"}
|
package/_cjs/Parser/api.cjs
CHANGED
|
@@ -6,9 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.asserts = asserts;
|
|
7
7
|
exports.decode = decode;
|
|
8
8
|
exports.decodeMaybe = decodeMaybe;
|
|
9
|
-
exports.encode =
|
|
9
|
+
exports.encode = void 0;
|
|
10
10
|
exports.encodeMaybe = encodeMaybe;
|
|
11
|
-
exports.is = is;
|
|
12
11
|
var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/schema/AST"));
|
|
13
12
|
var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Either/api"));
|
|
14
13
|
var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/schema/ParseError"));
|
|
@@ -17,12 +16,13 @@ var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require
|
|
|
17
16
|
var _interpreter = /*#__PURE__*/require("./interpreter.cjs");
|
|
18
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
19
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
|
+
const encode = exports.encode = encode_1;
|
|
20
20
|
/**
|
|
21
21
|
* @tsplus getter fncts.schema.Schema decode
|
|
22
22
|
* @tsplus getter fncts.schema.Parser decode
|
|
23
23
|
*/
|
|
24
24
|
function decode(schema) {
|
|
25
|
-
return (0, _interpreter.parserFor)(schema.ast);
|
|
25
|
+
return (0, _interpreter.parserFor)(schema.ast, true);
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* @tsplus getter fncts.schema.Schema decodeMaybe
|
|
@@ -35,40 +35,28 @@ function decodeMaybe(schema) {
|
|
|
35
35
|
* @tsplus getter fncts.schema.Schema encode
|
|
36
36
|
* @tsplus getter fncts.schema.Parser encode
|
|
37
37
|
*/
|
|
38
|
-
function
|
|
39
|
-
return (0, _interpreter.parserFor)(
|
|
38
|
+
function encode_1(schema) {
|
|
39
|
+
return (0, _interpreter.parserFor)(schema.ast, false);
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* @tsplus getter fncts.schema.Schema encodeMaybe
|
|
43
43
|
* @tsplus getter fncts.schema.Parser encodeMaybe
|
|
44
44
|
*/
|
|
45
45
|
function encodeMaybe(schema) {
|
|
46
|
-
return
|
|
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
|
-
};
|
|
46
|
+
return (input, options) => tsplus_module_2.toMaybe(encode_1(schema)(input, options));
|
|
56
47
|
}
|
|
57
48
|
function parseMaybe(ast) {
|
|
58
|
-
const parse = (0, _interpreter.parserFor)(ast);
|
|
49
|
+
const parse = (0, _interpreter.parserFor)(ast, true);
|
|
59
50
|
return (input, options) => {
|
|
60
51
|
return tsplus_module_2.toMaybe(parse(input, options));
|
|
61
52
|
};
|
|
62
53
|
}
|
|
63
54
|
function parseOrThrow(ast) {
|
|
64
|
-
const parser = (0, _interpreter.parserFor)(ast);
|
|
55
|
+
const parser = (0, _interpreter.parserFor)(ast, true);
|
|
65
56
|
return (input, options) => {
|
|
66
|
-
return tsplus_module_5.match({
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
},
|
|
70
|
-
Right: tsplus_module_4.identity
|
|
71
|
-
})(parser(input, options));
|
|
57
|
+
return tsplus_module_5.match(failure => {
|
|
58
|
+
throw new Error(tsplus_module_3.format(failure.errors));
|
|
59
|
+
}, tsplus_module_4.identity)(parser(input, options));
|
|
72
60
|
};
|
|
73
61
|
}
|
|
74
62
|
/**
|
package/_cjs/Parser/api.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.cjs","names":["_interpreter","require","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","decode","schema","parserFor","ast","decodeMaybe","parseMaybe","tsplus_module_1","getTo","
|
|
1
|
+
{"version":3,"file":"api.cjs","names":["_interpreter","require","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","encode","exports","encode_1","decode","schema","parserFor","ast","decodeMaybe","parseMaybe","tsplus_module_1","getTo","encodeMaybe","input","options","tsplus_module_2","toMaybe","parse","parseOrThrow","parser","tsplus_module_5","match","failure","Error","tsplus_module_3","format","errors","tsplus_module_4","identity","asserts"],"sources":["../../_src/Parser/api.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;AAEA,IAAAA,YAAA,gBAAAC,OAAA;AAA6C,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAI,wBAAAJ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAM,OAAA,EAAAN,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAI,GAAA,CAAAP,CAAA,UAAAG,CAAA,CAAAK,GAAA,CAAAR,CAAA,OAAAS,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAf,CAAA,oBAAAe,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAlB,CAAA,EAAAe,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAd,CAAA,EAAAe,CA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AS,EAACC,GAAG,EAAE,IAAI,CAAC;EACnC,OAAO,CAACM,KAAc,EAAEC,OAAsB,KAAI;IAChD,OAAOM,eAAA,CAAAC,KAAA,CAA8BC,OAAO,IAAI;MAC9C,MAAM,IAAIC,KAAK,CAACC,eAAA,CAAAC,MAAA,CAAkBH,OAAO,CAACI,MAAM,CAAC,CAAC;IACpD,CAAC,EAAAC,eAAA,CAAAC,QAAA,EAFMT,MAAM,CAACN,KAAK,EAAEC,OAAO,CAAC,CAER;EACvB,CAAC;AACH;AAEA;;;;AAIM,SAAUe,OAAOA,CAAIxB,MAAiB;EAC1C,OAAO,CAACQ,KAAc,EAAEC,OAAsB,KAAwB;IACpEI,YAAY,CAAAR,eAAA,CAAAC,KAAA,CAACN,MAAM,CAACE,GAAG,EAAO,CAACM,KAAK,EAAEC,OAAO,CAAC;EAChD,CAAC;AACH"}
|
|
@@ -8,19 +8,32 @@ var tsplus_module_1 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require
|
|
|
8
8
|
var tsplus_module_2 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/schema/ParseResult"));
|
|
9
9
|
var tsplus_module_3 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Vector/api"));
|
|
10
10
|
var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/api"));
|
|
11
|
-
var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/schema/
|
|
12
|
-
var tsplus_module_6 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
|
13
|
-
var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/
|
|
14
|
-
var tsplus_module_8 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/
|
|
15
|
-
var tsplus_module_9 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
|
16
|
-
var tsplus_module_10 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/
|
|
11
|
+
var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/schema/AST"));
|
|
12
|
+
var tsplus_module_6 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/schema/ParseError"));
|
|
13
|
+
var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/collection/immutable/Vector/internal"));
|
|
14
|
+
var tsplus_module_8 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Either/api"));
|
|
15
|
+
var tsplus_module_9 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/definition"));
|
|
16
|
+
var tsplus_module_10 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/schema/ParseFailure"));
|
|
17
|
+
var _Global = /*#__PURE__*/require("@fncts/base/data/Global");
|
|
17
18
|
var _predicates = /*#__PURE__*/require("@fncts/base/util/predicates");
|
|
18
19
|
var _AST2 = /*#__PURE__*/require("../AST.cjs");
|
|
20
|
+
var _ParseError2 = /*#__PURE__*/require("../ParseError.cjs");
|
|
19
21
|
var _utils = /*#__PURE__*/require("../utils.cjs");
|
|
20
22
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
21
23
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
+
const decodeMemoMap = /*#__PURE__*/(0, _Global.globalValue)( /*#__PURE__*/Symbol.for("fncts.schema.Parser.decodeMemoMap"), () => new WeakMap());
|
|
25
|
+
const encodeMemoMap = /*#__PURE__*/(0, _Global.globalValue)( /*#__PURE__*/Symbol.for("fncts.schema.Parser.encodeMemoMap"), () => new WeakMap());
|
|
26
|
+
function goMemo(ast, isDecoding) {
|
|
27
|
+
const memoMap = isDecoding ? decodeMemoMap : encodeMemoMap;
|
|
28
|
+
const memo = memoMap.get(ast);
|
|
29
|
+
if (memo) {
|
|
30
|
+
return memo;
|
|
31
|
+
}
|
|
32
|
+
const parser = go(ast, isDecoding);
|
|
33
|
+
memoMap.set(ast, parser);
|
|
34
|
+
return parser;
|
|
35
|
+
}
|
|
36
|
+
function go(ast, isDecoding) {
|
|
24
37
|
void 0;
|
|
25
38
|
switch (ast._tag) {
|
|
26
39
|
case 0 /* ASTTag.Declaration */:
|
|
@@ -58,52 +71,52 @@ const go = /*#__PURE__*/(0, _utils.memoize)(function go(ast) {
|
|
|
58
71
|
}
|
|
59
72
|
case 16 /* ASTTag.Tuple */:
|
|
60
73
|
{
|
|
61
|
-
const elements = tsplus_module_3.map(e =>
|
|
62
|
-
const rest = tsplus_module_4.map(rest => tsplus_module_3.map(
|
|
74
|
+
const elements = tsplus_module_3.map(e => goMemo(e.type, isDecoding))(ast.elements);
|
|
75
|
+
const rest = tsplus_module_4.map(rest => tsplus_module_3.map(ast => goMemo(ast, isDecoding))(rest))(ast.rest);
|
|
63
76
|
return tsplus_module_1.make((input, options) => {
|
|
64
77
|
if (!Array.isArray(input)) {
|
|
65
|
-
return tsplus_module_2.fail(
|
|
78
|
+
return tsplus_module_2.fail(tsplus_module_6.typeError(tsplus_module_5.unknownArray, input));
|
|
66
79
|
}
|
|
67
80
|
const output = [];
|
|
68
81
|
const errors = tsplus_module_3.emptyPushable();
|
|
69
82
|
const allErrors = options?.allErrors;
|
|
70
83
|
let i = 0;
|
|
71
84
|
for (; i < elements.length; i++) {
|
|
72
|
-
if (input.length < i +
|
|
85
|
+
if (input.length < i + 1) {
|
|
73
86
|
if (!tsplus_module_3.unsafeGet(i)(ast.elements).isOptional) {
|
|
74
|
-
const e =
|
|
75
|
-
|
|
87
|
+
const e = tsplus_module_6.indexError(i, tsplus_module_3.vector(tsplus_module_6.missingError));
|
|
88
|
+
tsplus_module_7.push(e)(errors);
|
|
76
89
|
if (allErrors) {
|
|
77
90
|
continue;
|
|
78
91
|
} else {
|
|
79
92
|
return tsplus_module_2.failures(errors);
|
|
80
93
|
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
const parser = tsplus_module_3.unsafeGet(i)(elements);
|
|
97
|
+
const t = parser(input[i], options);
|
|
98
|
+
void 0;
|
|
99
|
+
if (tsplus_module_8.isLeft(t)) {
|
|
100
|
+
const e = tsplus_module_6.indexError(i, t.left.errors);
|
|
101
|
+
tsplus_module_7.push(e)(errors);
|
|
102
|
+
if (allErrors) {
|
|
103
|
+
continue;
|
|
104
|
+
} else {
|
|
105
|
+
return tsplus_module_2.failures(errors);
|
|
93
106
|
}
|
|
94
|
-
output.push(t.right);
|
|
95
107
|
}
|
|
108
|
+
output.push(t.right);
|
|
96
109
|
}
|
|
97
110
|
}
|
|
98
|
-
if (
|
|
111
|
+
if (tsplus_module_9.isJust(rest)) {
|
|
99
112
|
const head = tsplus_module_3.unsafeHead(rest.value);
|
|
100
113
|
const tail = tsplus_module_3.tail(rest.value);
|
|
101
114
|
for (; i < input.length - tail.length; i++) {
|
|
102
115
|
const t = head(input[i], options);
|
|
103
116
|
void 0;
|
|
104
|
-
if (
|
|
105
|
-
const e =
|
|
106
|
-
|
|
117
|
+
if (tsplus_module_8.isLeft(t)) {
|
|
118
|
+
const e = tsplus_module_6.indexError(i, t.left.errors);
|
|
119
|
+
tsplus_module_7.push(e)(errors);
|
|
107
120
|
if (allErrors) {
|
|
108
121
|
continue;
|
|
109
122
|
} else {
|
|
@@ -115,14 +128,14 @@ const go = /*#__PURE__*/(0, _utils.memoize)(function go(ast) {
|
|
|
115
128
|
for (let j = 0; j < tail.length; j++) {
|
|
116
129
|
i += j;
|
|
117
130
|
if (input.length < i + 1) {
|
|
118
|
-
|
|
131
|
+
tsplus_module_7.push(tsplus_module_6.indexError(i, tsplus_module_3.vector(tsplus_module_6.missingError)))(errors);
|
|
119
132
|
return tsplus_module_2.failures(errors);
|
|
120
133
|
} else {
|
|
121
134
|
const t = tsplus_module_3.unsafeGet(j)(tail)(input[i], options);
|
|
122
135
|
void 0;
|
|
123
|
-
if (
|
|
124
|
-
const e =
|
|
125
|
-
|
|
136
|
+
if (tsplus_module_8.isLeft(t)) {
|
|
137
|
+
const e = tsplus_module_6.indexError(i, t.left.errors);
|
|
138
|
+
tsplus_module_7.push(e)(errors);
|
|
126
139
|
if (allErrors) {
|
|
127
140
|
continue;
|
|
128
141
|
} else {
|
|
@@ -135,9 +148,9 @@ const go = /*#__PURE__*/(0, _utils.memoize)(function go(ast) {
|
|
|
135
148
|
} else {
|
|
136
149
|
const isUnexpectedAllowed = options?.isUnexpectedAllowed;
|
|
137
150
|
for (; i < input.length; i++) {
|
|
138
|
-
const e =
|
|
151
|
+
const e = tsplus_module_6.indexError(i, tsplus_module_3.vector(tsplus_module_6.unexpectedError(input[i])));
|
|
139
152
|
if (!isUnexpectedAllowed) {
|
|
140
|
-
|
|
153
|
+
tsplus_module_7.push(e)(errors);
|
|
141
154
|
if (allErrors) {
|
|
142
155
|
continue;
|
|
143
156
|
} else {
|
|
@@ -154,11 +167,11 @@ const go = /*#__PURE__*/(0, _utils.memoize)(function go(ast) {
|
|
|
154
167
|
if (ast.propertySignatures.length === 0 && ast.indexSignatures.length === 0) {
|
|
155
168
|
return tsplus_module_1.fromRefinement(ast, u => u !== null);
|
|
156
169
|
}
|
|
157
|
-
const propertySignatureTypes = tsplus_module_3.map(f =>
|
|
158
|
-
const indexSignatures = tsplus_module_3.map(is => [
|
|
170
|
+
const propertySignatureTypes = tsplus_module_3.map(f => goMemo(f.type, isDecoding))(ast.propertySignatures);
|
|
171
|
+
const indexSignatures = tsplus_module_3.map(is => [goMemo(is.parameter, isDecoding), goMemo(is.type, isDecoding)])(ast.indexSignatures);
|
|
159
172
|
return tsplus_module_1.make((input, options) => {
|
|
160
173
|
if (!(0, _predicates.isRecord)(input)) {
|
|
161
|
-
return tsplus_module_2.fail(
|
|
174
|
+
return tsplus_module_2.fail(tsplus_module_6.typeError(tsplus_module_5.unknownRecord, input));
|
|
162
175
|
}
|
|
163
176
|
const output = {};
|
|
164
177
|
const expectedKeys = {};
|
|
@@ -171,8 +184,8 @@ const go = /*#__PURE__*/(0, _utils.memoize)(function go(ast) {
|
|
|
171
184
|
expectedKeys[name] = null;
|
|
172
185
|
if (!Object.prototype.hasOwnProperty.call(input, name)) {
|
|
173
186
|
if (!ps.isOptional) {
|
|
174
|
-
const e =
|
|
175
|
-
|
|
187
|
+
const e = tsplus_module_6.keyError(tsplus_module_5.createKey(name), name, tsplus_module_3.vector(tsplus_module_6.missingError));
|
|
188
|
+
tsplus_module_7.push(e)(errors);
|
|
176
189
|
if (allErrors) {
|
|
177
190
|
continue;
|
|
178
191
|
} else {
|
|
@@ -182,9 +195,9 @@ const go = /*#__PURE__*/(0, _utils.memoize)(function go(ast) {
|
|
|
182
195
|
} else {
|
|
183
196
|
const t = parser(input[name], options);
|
|
184
197
|
void 0;
|
|
185
|
-
if (
|
|
186
|
-
const e =
|
|
187
|
-
|
|
198
|
+
if (tsplus_module_8.isLeft(t)) {
|
|
199
|
+
const e = tsplus_module_6.keyError(tsplus_module_5.createKey(name), name, t.left.errors);
|
|
200
|
+
tsplus_module_7.push(e)(errors);
|
|
188
201
|
if (allErrors) {
|
|
189
202
|
continue;
|
|
190
203
|
} else {
|
|
@@ -204,9 +217,9 @@ const go = /*#__PURE__*/(0, _utils.memoize)(function go(ast) {
|
|
|
204
217
|
}
|
|
205
218
|
let t = parameter(key, options);
|
|
206
219
|
void 0;
|
|
207
|
-
if (
|
|
208
|
-
const e =
|
|
209
|
-
|
|
220
|
+
if (tsplus_module_8.isLeft(t)) {
|
|
221
|
+
const e = tsplus_module_6.keyError(tsplus_module_5.createKey(key), key, t.left.errors);
|
|
222
|
+
tsplus_module_7.push(e)(errors);
|
|
210
223
|
if (allErrors) {
|
|
211
224
|
continue;
|
|
212
225
|
} else {
|
|
@@ -215,9 +228,9 @@ const go = /*#__PURE__*/(0, _utils.memoize)(function go(ast) {
|
|
|
215
228
|
}
|
|
216
229
|
t = type(input[key], options);
|
|
217
230
|
void 0;
|
|
218
|
-
if (
|
|
219
|
-
const e =
|
|
220
|
-
|
|
231
|
+
if (tsplus_module_8.isLeft(t)) {
|
|
232
|
+
const e = tsplus_module_6.keyError(tsplus_module_5.createKey(key), key, t.left.errors);
|
|
233
|
+
tsplus_module_7.push(e)(errors);
|
|
221
234
|
if (allErrors) {
|
|
222
235
|
continue;
|
|
223
236
|
} else {
|
|
@@ -231,9 +244,9 @@ const go = /*#__PURE__*/(0, _utils.memoize)(function go(ast) {
|
|
|
231
244
|
const isUnexpectedAllowed = options?.isUnexpectedAllowed;
|
|
232
245
|
for (const key of (0, _utils.ownKeys)(input)) {
|
|
233
246
|
if (!Object.prototype.hasOwnProperty.call(expectedKeys, key)) {
|
|
234
|
-
const e =
|
|
247
|
+
const e = tsplus_module_6.keyError(tsplus_module_5.createKey(key), key, tsplus_module_3.vector(tsplus_module_6.unexpectedError(input[key])));
|
|
235
248
|
if (!isUnexpectedAllowed) {
|
|
236
|
-
|
|
249
|
+
tsplus_module_7.push(e)(errors);
|
|
237
250
|
if (allErrors) {
|
|
238
251
|
continue;
|
|
239
252
|
} else {
|
|
@@ -248,13 +261,13 @@ const go = /*#__PURE__*/(0, _utils.memoize)(function go(ast) {
|
|
|
248
261
|
}
|
|
249
262
|
case 18 /* ASTTag.Union */:
|
|
250
263
|
{
|
|
251
|
-
const searchTree = getSearchTree(ast.types);
|
|
264
|
+
const searchTree = (0, _AST2.getSearchTree)(ast.types, isDecoding);
|
|
252
265
|
const ownKeys = Reflect.ownKeys(searchTree.keys);
|
|
253
266
|
const len = ownKeys.length;
|
|
254
267
|
const otherwise = searchTree.otherwise;
|
|
255
268
|
const map = new Map();
|
|
256
269
|
tsplus_module_3.forEach(ast => {
|
|
257
|
-
map.set(ast,
|
|
270
|
+
map.set(ast, goMemo(ast, isDecoding));
|
|
258
271
|
})(ast.types);
|
|
259
272
|
return tsplus_module_1.make((input, options) => {
|
|
260
273
|
const errors = tsplus_module_3.emptyPushable();
|
|
@@ -270,58 +283,58 @@ const go = /*#__PURE__*/(0, _utils.memoize)(function go(ast) {
|
|
|
270
283
|
for (let i = 0; i < bucket.length; i++) {
|
|
271
284
|
const t = map.get(bucket[i])(input, options);
|
|
272
285
|
void 0;
|
|
273
|
-
if (
|
|
286
|
+
if (tsplus_module_8.isRight(t)) {
|
|
274
287
|
return t;
|
|
275
288
|
} else {
|
|
276
|
-
|
|
289
|
+
tsplus_module_7.push(tsplus_module_6.unionMemberError(t.left.errors))(errors);
|
|
277
290
|
}
|
|
278
291
|
}
|
|
279
292
|
} else {
|
|
280
|
-
|
|
293
|
+
tsplus_module_7.push(tsplus_module_6.keyError(tsplus_module_5.createKey(name), name, tsplus_module_3.vector(tsplus_module_6.typeError(searchTree.keys[name].ast, input[name]))))(errors);
|
|
281
294
|
}
|
|
282
295
|
} else {
|
|
283
|
-
|
|
296
|
+
tsplus_module_7.push(tsplus_module_6.keyError(tsplus_module_5.createKey(name), name, tsplus_module_3.vector(tsplus_module_6.missingError)))(errors);
|
|
284
297
|
}
|
|
285
298
|
}
|
|
286
299
|
} else {
|
|
287
|
-
|
|
300
|
+
tsplus_module_7.push(tsplus_module_6.typeError(tsplus_module_5.unknownRecord, input))(errors);
|
|
288
301
|
}
|
|
289
302
|
}
|
|
290
303
|
for (let i = 0; i < otherwise.length; i++) {
|
|
291
304
|
const t = map.get(otherwise[i])(input, options);
|
|
292
305
|
void 0;
|
|
293
|
-
if (
|
|
306
|
+
if (tsplus_module_8.isRight(t)) {
|
|
294
307
|
return t;
|
|
295
308
|
} else {
|
|
296
|
-
|
|
309
|
+
tsplus_module_7.push(tsplus_module_6.unionMemberError(t.left.errors))(errors);
|
|
297
310
|
}
|
|
298
311
|
}
|
|
299
|
-
return tsplus_module_3.isNonEmpty(errors) ? tsplus_module_2.failures(errors) : tsplus_module_2.fail(
|
|
312
|
+
return tsplus_module_3.isNonEmpty(errors) ? tsplus_module_2.failures(errors) : tsplus_module_2.fail(tsplus_module_6.typeError(tsplus_module_5.neverKeyword, input));
|
|
300
313
|
});
|
|
301
314
|
}
|
|
302
315
|
case 19 /* ASTTag.Lazy */:
|
|
303
316
|
{
|
|
304
|
-
const f = () =>
|
|
317
|
+
const f = () => goMemo(ast.getAST(), isDecoding);
|
|
305
318
|
const get = (0, _utils.memoize)(f);
|
|
306
319
|
return tsplus_module_1.make((a, options) => get()(a, options));
|
|
307
320
|
}
|
|
308
321
|
case 20 /* ASTTag.Refinement */:
|
|
309
322
|
{
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
323
|
+
if (isDecoding) {
|
|
324
|
+
const from = goMemo(ast.from, isDecoding);
|
|
325
|
+
return tsplus_module_1.make((input, options) => tsplus_module_8.flatMap(a => tsplus_module_8.mapLeft(failure => tsplus_module_10.make(tsplus_module_3.vector(tsplus_module_6.refinementError(ast, input, "Predicate", failure.errors))))(ast.decode(a, options)))(tsplus_module_8.mapLeft(failure => tsplus_module_10.make(tsplus_module_3.vector(tsplus_module_6.refinementError(ast, input, "From", failure.errors))))(from(input, options))));
|
|
326
|
+
} else {
|
|
327
|
+
const from = goMemo(ast.from, true);
|
|
328
|
+
const to = goMemo(tsplus_module_5.getTo(ast.from), false);
|
|
329
|
+
return tsplus_module_1.make((input, options) => tsplus_module_8.flatMap(a => from(a, options))(tsplus_module_8.flatMap(a => ast.decode(a, options))(to(input, options))));
|
|
314
330
|
}
|
|
315
|
-
return tsplus_module_1.make((input, options) => tsplus_module_7.flatMap(a => ast.decode(a, options))(from(input, options)));
|
|
316
331
|
}
|
|
317
332
|
case 21 /* ASTTag.Transform */:
|
|
318
333
|
{
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
}
|
|
324
|
-
return tsplus_module_1.make((input, options) => tsplus_module_7.flatMap(a => ast.decode(a, options))(from(input, options)));
|
|
334
|
+
const transformation = isDecoding ? ast.decode : ast.encode;
|
|
335
|
+
const from = isDecoding ? goMemo(ast.from, true) : goMemo(ast.to, false);
|
|
336
|
+
const to = isDecoding ? goMemo(ast.to, true) : goMemo(ast.from, false);
|
|
337
|
+
return tsplus_module_1.make((input, options) => tsplus_module_8.flatMap(a => tsplus_module_8.mapLeft(failure => tsplus_module_10.make(tsplus_module_3.vector(tsplus_module_6.transformationError(ast, input, isDecoding ? "Type" : "Encoded", failure.errors))))(to(a, options)))(tsplus_module_8.flatMap(a => tsplus_module_8.mapLeft(failure => tsplus_module_10.make(tsplus_module_3.vector(tsplus_module_6.transformationError(ast, input, "Transformation", failure.errors))))(transformation(a, options)))(tsplus_module_8.mapLeft(failure => tsplus_module_10.make(tsplus_module_3.vector(tsplus_module_6.transformationError(ast, input, isDecoding ? "Encoded" : "Type", failure.errors))))(from(input, options)))));
|
|
325
338
|
}
|
|
326
339
|
case 22 /* ASTTag.Validation */:
|
|
327
340
|
{
|
|
@@ -330,81 +343,20 @@ const go = /*#__PURE__*/(0, _utils.memoize)(function go(ast) {
|
|
|
330
343
|
const allErrors = options?.allErrors;
|
|
331
344
|
for (const validation of ast.validation) {
|
|
332
345
|
if (!validation.validate(u)) {
|
|
333
|
-
|
|
346
|
+
tsplus_module_7.push(validation)(missedBrands);
|
|
334
347
|
if (allErrors) {
|
|
335
348
|
continue;
|
|
336
349
|
} else {
|
|
337
|
-
return tsplus_module_2.fail(
|
|
350
|
+
return tsplus_module_2.fail(tsplus_module_6.typeError(tsplus_module_5.createValidation(ast.from, missedBrands, ast.annotations), u));
|
|
338
351
|
}
|
|
339
352
|
}
|
|
340
353
|
}
|
|
341
|
-
return missedBrands.length > 0 ? tsplus_module_2.fail(
|
|
354
|
+
return missedBrands.length > 0 ? tsplus_module_2.fail(tsplus_module_6.typeError(tsplus_module_5.createValidation(ast.from, missedBrands, ast.annotations), u)) : tsplus_module_2.succeed(u);
|
|
342
355
|
});
|
|
343
356
|
}
|
|
344
357
|
}
|
|
345
|
-
});
|
|
346
|
-
function parserFor(ast) {
|
|
347
|
-
return go(ast);
|
|
348
358
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
function getLiterals(ast) {
|
|
352
|
-
void 0;
|
|
353
|
-
switch (ast._tag) {
|
|
354
|
-
case 0 /* ASTTag.Declaration */:
|
|
355
|
-
return getLiterals(ast.type);
|
|
356
|
-
case 17 /* ASTTag.TypeLiteral */:
|
|
357
|
-
{
|
|
358
|
-
const out = [];
|
|
359
|
-
for (let i = 0; i < ast.propertySignatures.length; i++) {
|
|
360
|
-
const propertySignature = tsplus_module_3.unsafeGet(i)(ast.propertySignatures);
|
|
361
|
-
if (tsplus_module_9.isLiteral(propertySignature.type) && !propertySignature.isOptional) {
|
|
362
|
-
out.push([propertySignature.name, propertySignature.type]);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
return out;
|
|
366
|
-
}
|
|
367
|
-
case 20 /* ASTTag.Refinement */:
|
|
368
|
-
return getLiterals(ast.from);
|
|
369
|
-
case 21 /* ASTTag.Transform */:
|
|
370
|
-
return ast.isReversed ? getLiterals(ast.to) : getLiterals(tsplus_module_9.getFrom(ast.from));
|
|
371
|
-
}
|
|
372
|
-
return [];
|
|
373
|
-
}
|
|
374
|
-
function getSearchTree(members) {
|
|
375
|
-
const keys = {};
|
|
376
|
-
const otherwise = [];
|
|
377
|
-
for (let i = 0; i < members.length; i++) {
|
|
378
|
-
const member = tsplus_module_3.unsafeGet(i)(members);
|
|
379
|
-
const tags = getLiterals(member);
|
|
380
|
-
if (tags.length > 0) {
|
|
381
|
-
for (let j = 0; j < tags.length; j++) {
|
|
382
|
-
const [key, literal] = tags[j];
|
|
383
|
-
const hash = String(literal.literal);
|
|
384
|
-
keys[key] || (keys[key] = {
|
|
385
|
-
buckets: {},
|
|
386
|
-
ast: tsplus_module_9.neverKeyword
|
|
387
|
-
});
|
|
388
|
-
const buckets = keys[key].buckets;
|
|
389
|
-
if (Object.prototype.hasOwnProperty.call(buckets, hash)) {
|
|
390
|
-
if (j < tags.length - 1) {
|
|
391
|
-
continue;
|
|
392
|
-
}
|
|
393
|
-
buckets[hash].push(member);
|
|
394
|
-
keys[key].ast = tsplus_module_9.createUnion(tsplus_module_3.vector(keys[key].ast, literal));
|
|
395
|
-
} else {
|
|
396
|
-
buckets[hash] = [member];
|
|
397
|
-
keys[key].ast = tsplus_module_9.createUnion(tsplus_module_3.vector(keys[key].ast, literal));
|
|
398
|
-
break;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
} else {
|
|
402
|
-
otherwise.push(member);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
return {
|
|
406
|
-
keys,
|
|
407
|
-
otherwise
|
|
408
|
-
};
|
|
359
|
+
function parserFor(ast, isDecoding) {
|
|
360
|
+
return goMemo(ast, isDecoding);
|
|
409
361
|
}
|
|
410
362
|
//# sourceMappingURL=interpreter.cjs.map
|