@fncts/schema 0.0.23 → 0.0.25
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/LICENSE +26 -0
- package/ParseError/ParseError.d.ts +28 -13
- package/_cjs/AST.cjs +1096 -1087
- package/_cjs/AST.cjs.map +1 -1
- package/_cjs/ASTAnnotation.cjs +114 -83
- package/_cjs/ASTAnnotation.cjs.map +1 -1
- package/_cjs/ASTAnnotationMap.cjs +43 -32
- package/_cjs/ASTAnnotationMap.cjs.map +1 -1
- package/_cjs/Eq.cjs +113 -145
- package/_cjs/Eq.cjs.map +1 -1
- package/_cjs/Gen.cjs +131 -167
- package/_cjs/Gen.cjs.map +1 -1
- package/_cjs/Guard.cjs +167 -267
- package/_cjs/Guard.cjs.map +1 -1
- package/_cjs/InvalidInterpretationError.cjs +9 -15
- package/_cjs/InvalidInterpretationError.cjs.map +1 -1
- package/_cjs/ParseError/ParseError.cjs +285 -209
- package/_cjs/ParseError/ParseError.cjs.map +1 -1
- package/_cjs/ParseError/ParseErrorFormatter.cjs +0 -2
- package/_cjs/ParseError/PathFormatter.cjs +55 -87
- package/_cjs/ParseError/PathFormatter.cjs.map +1 -1
- package/_cjs/ParseError/TreeFormatter.cjs +70 -102
- package/_cjs/ParseError/TreeFormatter.cjs.map +1 -1
- package/_cjs/ParseError.cjs +35 -50
- package/_cjs/ParseResult.cjs +15 -15
- package/_cjs/ParseResult.cjs.map +1 -1
- package/_cjs/Parser/api.cjs +54 -50
- package/_cjs/Parser/api.cjs.map +1 -1
- package/_cjs/Parser/definition.cjs +17 -16
- package/_cjs/Parser/definition.cjs.map +1 -1
- package/_cjs/Parser/interpreter.cjs +276 -358
- package/_cjs/Parser/interpreter.cjs.map +1 -1
- package/_cjs/Parser.cjs +12 -39
- package/_cjs/Schema/api/conc.cjs +64 -59
- package/_cjs/Schema/api/conc.cjs.map +1 -1
- package/_cjs/Schema/api/either.cjs +73 -72
- package/_cjs/Schema/api/either.cjs.map +1 -1
- package/_cjs/Schema/api/hashMap.cjs +85 -85
- package/_cjs/Schema/api/hashMap.cjs.map +1 -1
- package/_cjs/Schema/api/hashSet.cjs +75 -69
- package/_cjs/Schema/api/hashSet.cjs.map +1 -1
- package/_cjs/Schema/api/list.cjs +74 -64
- package/_cjs/Schema/api/list.cjs.map +1 -1
- package/_cjs/Schema/api/map.cjs +81 -83
- package/_cjs/Schema/api/map.cjs.map +1 -1
- package/_cjs/Schema/api/maybe.cjs +56 -49
- package/_cjs/Schema/api/maybe.cjs.map +1 -1
- package/_cjs/Schema/api/set.cjs +68 -61
- package/_cjs/Schema/api/set.cjs.map +1 -1
- package/_cjs/Schema/api.cjs +332 -350
- package/_cjs/Schema/api.cjs.map +1 -1
- package/_cjs/Schema/definition.cjs +28 -27
- package/_cjs/Schema/definition.cjs.map +1 -1
- package/_cjs/Schema/derivations.cjs +85 -100
- package/_cjs/Schema/derivations.cjs.map +1 -1
- package/_cjs/Schema.cjs +95 -127
- package/_cjs/Show.cjs +91 -151
- package/_cjs/Show.cjs.map +1 -1
- package/_cjs/chunk.cjs +28 -0
- package/_cjs/global.cjs +0 -2
- package/_cjs/index.cjs +0 -2
- package/_cjs/utils.cjs +41 -46
- package/_cjs/utils.cjs.map +1 -1
- package/_mjs/AST.mjs +1007 -1031
- package/_mjs/AST.mjs.map +1 -1
- package/_mjs/ASTAnnotation.mjs +77 -71
- package/_mjs/ASTAnnotation.mjs.map +1 -1
- package/_mjs/ASTAnnotationMap.mjs +36 -25
- package/_mjs/ASTAnnotationMap.mjs.map +1 -1
- package/_mjs/Eq.mjs +101 -134
- package/_mjs/Eq.mjs.map +1 -1
- package/_mjs/Gen.mjs +117 -157
- package/_mjs/Gen.mjs.map +1 -1
- package/_mjs/Guard.mjs +154 -257
- package/_mjs/Guard.mjs.map +1 -1
- package/_mjs/InvalidInterpretationError.mjs +8 -9
- package/_mjs/InvalidInterpretationError.mjs.map +1 -1
- package/_mjs/ParseError/ParseError.mjs +270 -190
- package/_mjs/ParseError/ParseError.mjs.map +1 -1
- package/_mjs/ParseError/ParseErrorFormatter.mjs +0 -2
- package/_mjs/ParseError/PathFormatter.mjs +51 -80
- package/_mjs/ParseError/PathFormatter.mjs.map +1 -1
- package/_mjs/ParseError/TreeFormatter.mjs +62 -94
- package/_mjs/ParseError/TreeFormatter.mjs.map +1 -1
- package/_mjs/ParseError.mjs +5 -6
- package/_mjs/ParseResult.mjs +13 -9
- package/_mjs/ParseResult.mjs.map +1 -1
- package/_mjs/Parser/api.mjs +43 -39
- package/_mjs/Parser/api.mjs.map +1 -1
- package/_mjs/Parser/definition.mjs +12 -8
- package/_mjs/Parser/definition.mjs.map +1 -1
- package/_mjs/Parser/interpreter.mjs +262 -348
- package/_mjs/Parser/interpreter.mjs.map +1 -1
- package/_mjs/Parser.mjs +4 -5
- package/_mjs/Schema/api/conc.mjs +41 -45
- package/_mjs/Schema/api/conc.mjs.map +1 -1
- package/_mjs/Schema/api/either.mjs +55 -61
- package/_mjs/Schema/api/either.mjs.map +1 -1
- package/_mjs/Schema/api/hashMap.mjs +61 -71
- package/_mjs/Schema/api/hashMap.mjs.map +1 -1
- package/_mjs/Schema/api/hashSet.mjs +53 -56
- package/_mjs/Schema/api/hashSet.mjs.map +1 -1
- package/_mjs/Schema/api/list.mjs +50 -51
- package/_mjs/Schema/api/list.mjs.map +1 -1
- package/_mjs/Schema/api/map.mjs +59 -69
- package/_mjs/Schema/api/map.mjs.map +1 -1
- package/_mjs/Schema/api/maybe.mjs +34 -36
- package/_mjs/Schema/api/maybe.mjs.map +1 -1
- package/_mjs/Schema/api/set.mjs +47 -48
- package/_mjs/Schema/api/set.mjs.map +1 -1
- package/_mjs/Schema/api.mjs +304 -346
- package/_mjs/Schema/api.mjs.map +1 -1
- package/_mjs/Schema/definition.mjs +21 -18
- package/_mjs/Schema/definition.mjs.map +1 -1
- package/_mjs/Schema/derivations.mjs +71 -90
- package/_mjs/Schema/derivations.mjs.map +1 -1
- package/_mjs/Schema.mjs +12 -15
- package/_mjs/Show.mjs +79 -139
- package/_mjs/Show.mjs.map +1 -1
- package/_mjs/global.mjs +0 -2
- package/_mjs/index.mjs +0 -2
- package/_mjs/utils.mjs +35 -37
- package/_mjs/utils.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 +7 -3
- package/_cjs/ParseError/ParseErrorFormatter.cjs.map +0 -1
- package/_cjs/ParseError.cjs.map +0 -1
- package/_cjs/Parser.cjs.map +0 -1
- package/_cjs/Schema.cjs.map +0 -1
- package/_cjs/global.cjs.map +0 -1
- package/_cjs/index.cjs.map +0 -1
- package/_mjs/ParseError/ParseErrorFormatter.mjs.map +0 -1
- package/_mjs/ParseError.mjs.map +0 -1
- package/_mjs/Parser.mjs.map +0 -1
- package/_mjs/Schema.mjs.map +0 -1
- package/_mjs/global.mjs.map +0 -1
- package/_mjs/index.mjs.map +0 -1
package/_cjs/Schema/api/list.cjs
CHANGED
|
@@ -1,78 +1,88 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_chunk = require("../../chunk.cjs");
|
|
3
|
+
let _fncts_base_collection_immutable_Vector_api = require("@fncts/base/collection/immutable/Vector/api");
|
|
4
|
+
_fncts_base_collection_immutable_Vector_api = require_chunk.__toESM(_fncts_base_collection_immutable_Vector_api, 1);
|
|
5
|
+
let _fncts_schema_ASTAnnotation = require("@fncts/schema/ASTAnnotation");
|
|
6
|
+
_fncts_schema_ASTAnnotation = require_chunk.__toESM(_fncts_schema_ASTAnnotation, 1);
|
|
7
|
+
let _fncts_schema_ParseResult = require("@fncts/schema/ParseResult");
|
|
8
|
+
_fncts_schema_ParseResult = require_chunk.__toESM(_fncts_schema_ParseResult, 1);
|
|
9
|
+
let _fncts_schema_Parser_api = require("@fncts/schema/Parser/api");
|
|
10
|
+
_fncts_schema_Parser_api = require_chunk.__toESM(_fncts_schema_Parser_api, 1);
|
|
11
|
+
let _fncts_schema_Show = require("@fncts/schema/Show");
|
|
12
|
+
_fncts_schema_Show = require_chunk.__toESM(_fncts_schema_Show, 1);
|
|
13
|
+
let _fncts_schema_ParseError_ParseError = require("@fncts/schema/ParseError/ParseError");
|
|
14
|
+
_fncts_schema_ParseError_ParseError = require_chunk.__toESM(_fncts_schema_ParseError_ParseError, 1);
|
|
15
|
+
let _fncts_base_collection_immutable_Vector_internal = require("@fncts/base/collection/immutable/Vector/internal");
|
|
16
|
+
_fncts_base_collection_immutable_Vector_internal = require_chunk.__toESM(_fncts_base_collection_immutable_Vector_internal, 1);
|
|
17
|
+
let _fncts_schema_Schema_api = require("@fncts/schema/Schema/api");
|
|
18
|
+
_fncts_schema_Schema_api = require_chunk.__toESM(_fncts_schema_Schema_api, 1);
|
|
19
|
+
let _fncts_base_data_function_api = require("@fncts/base/data/function/api");
|
|
20
|
+
_fncts_base_data_function_api = require_chunk.__toESM(_fncts_base_data_function_api, 1);
|
|
21
|
+
let _fncts_base_data_Either_api = require("@fncts/base/data/Either/api");
|
|
22
|
+
_fncts_base_data_Either_api = require_chunk.__toESM(_fncts_base_data_Either_api, 1);
|
|
23
|
+
let _fncts_schema_Parser_definition = require("@fncts/schema/Parser/definition");
|
|
24
|
+
_fncts_schema_Parser_definition = require_chunk.__toESM(_fncts_schema_Parser_definition, 1);
|
|
25
|
+
let _fncts_test_control_Gen_api = require("@fncts/test/control/Gen/api");
|
|
26
|
+
_fncts_test_control_Gen_api = require_chunk.__toESM(_fncts_test_control_Gen_api, 1);
|
|
27
|
+
let _fncts_base_collection_immutable_List_constructors = require("@fncts/base/collection/immutable/List/constructors");
|
|
28
|
+
_fncts_base_collection_immutable_List_constructors = require_chunk.__toESM(_fncts_base_collection_immutable_List_constructors, 1);
|
|
29
|
+
let _fncts_base_collection_immutable_List_definition = require("@fncts/base/collection/immutable/List/definition");
|
|
30
|
+
_fncts_base_collection_immutable_List_definition = require_chunk.__toESM(_fncts_base_collection_immutable_List_definition, 1);
|
|
31
|
+
let _fncts_base_collection_mutable_ListBuffer = require("@fncts/base/collection/mutable/ListBuffer");
|
|
32
|
+
_fncts_base_collection_mutable_ListBuffer = require_chunk.__toESM(_fncts_base_collection_mutable_ListBuffer, 1);
|
|
33
|
+
//#region build/esm/Schema/api/list.js
|
|
34
|
+
const list = list_1;
|
|
35
|
+
const listFromArray = listFromArray_1;
|
|
26
36
|
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
37
|
+
* @tsplus static fncts.schema.SchemaOps list
|
|
38
|
+
* @tsplus getter fncts.Schema.Schema list
|
|
39
|
+
*/
|
|
30
40
|
function list_1(value) {
|
|
31
|
-
|
|
41
|
+
return _fncts_schema_Schema_api.annotate(_fncts_schema_ASTAnnotation.GenHook, gen)(_fncts_schema_Schema_api.annotate(_fncts_schema_ASTAnnotation.Identifier, `List<${_fncts_schema_Show.show()(value)}>`)(_fncts_schema_Schema_api.declaration(_fncts_base_collection_immutable_Vector_api.vector(value), parser(true), parser(false))));
|
|
32
42
|
}
|
|
33
43
|
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
44
|
+
* @tsplus static fncts.schema.SchemaOps listFromArray
|
|
45
|
+
* @tsplus getter fncts.Schema.Schema listFromArray
|
|
46
|
+
*/
|
|
37
47
|
function listFromArray_1(value) {
|
|
38
|
-
|
|
48
|
+
return _fncts_schema_Schema_api.transform(list_1(value), (input) => _fncts_base_collection_immutable_List_constructors.from(input), (input) => Array.from(input))(_fncts_schema_Schema_api.array(value));
|
|
39
49
|
}
|
|
40
50
|
/**
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
* @tsplus derive fncts.schema.Schema[fncts.List]<_> 10
|
|
52
|
+
*/
|
|
43
53
|
function deriveList(...[value]) {
|
|
44
|
-
|
|
54
|
+
return listFromArray_1(value);
|
|
45
55
|
}
|
|
46
56
|
function parser(isDecoding) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return tsplus_module_3.isNonEmpty(errors) ? tsplus_module_10.fail(tsplus_module_9.iterableError(schema.ast, u, errors)) : tsplus_module_10.succeed(out.toList);
|
|
72
|
-
});
|
|
73
|
-
};
|
|
57
|
+
return (value) => {
|
|
58
|
+
const schema = list_1(value);
|
|
59
|
+
const parseValue = isDecoding ? _fncts_schema_Parser_api.decode(value) : _fncts_schema_Parser_api.encode(value);
|
|
60
|
+
return _fncts_schema_Parser_definition.make((u, options) => {
|
|
61
|
+
if (!_fncts_base_collection_immutable_List_definition.isList(u)) return _fncts_schema_ParseResult.fail(_fncts_schema_ParseError_ParseError.typeError(schema.ast, u));
|
|
62
|
+
const out = new _fncts_base_collection_mutable_ListBuffer.ListBuffer();
|
|
63
|
+
const errors = _fncts_base_collection_immutable_Vector_api.emptyPushable();
|
|
64
|
+
const allErrors = options?.allErrors;
|
|
65
|
+
let index = 0;
|
|
66
|
+
for (const v of u) {
|
|
67
|
+
const t = parseValue(v, options);
|
|
68
|
+
if (_fncts_base_data_Either_api.isLeft(t)) {
|
|
69
|
+
_fncts_base_collection_immutable_Vector_internal.push(_fncts_schema_ParseError_ParseError.indexError(index, t.left))(errors);
|
|
70
|
+
index++;
|
|
71
|
+
if (allErrors) continue;
|
|
72
|
+
return _fncts_schema_ParseResult.fail(_fncts_schema_ParseError_ParseError.iterableError(schema.ast, u, errors));
|
|
73
|
+
} else out.append(t.right);
|
|
74
|
+
index++;
|
|
75
|
+
}
|
|
76
|
+
return _fncts_base_collection_immutable_Vector_api.isNonEmpty(errors) ? _fncts_schema_ParseResult.fail(_fncts_schema_ParseError_ParseError.iterableError(schema.ast, u, errors)) : _fncts_schema_ParseResult.succeed(out.toList);
|
|
77
|
+
});
|
|
78
|
+
};
|
|
74
79
|
}
|
|
75
80
|
function gen(value) {
|
|
76
|
-
|
|
81
|
+
return _fncts_test_control_Gen_api.map((array) => _fncts_base_collection_immutable_List_constructors.from(array))(_fncts_test_control_Gen_api.array(value));
|
|
77
82
|
}
|
|
83
|
+
//#endregion
|
|
84
|
+
exports.deriveList = deriveList;
|
|
85
|
+
exports.list = list;
|
|
86
|
+
exports.listFromArray = listFromArray;
|
|
87
|
+
|
|
78
88
|
//# sourceMappingURL=list.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.cjs","names":["
|
|
1
|
+
{"version":3,"file":"list.cjs","names":["tsplus_module_4","tsplus_module_1","tsplus_module_2","tsplus_module_3","tsplus_module_5","tsplus_module_7","tsplus_module_14","tsplus_module_8","tsplus_module_10","tsplus_module_9","tsplus_module_11","tsplus_module_12","tsplus_module_15"],"sources":["../../../esm/Schema/api/list.js"],"sourcesContent":["import * as tsplus_module_1 from \"@fncts/schema/ASTAnnotation\";\nimport * as tsplus_module_2 from \"@fncts/schema/Show\";\nimport * as tsplus_module_3 from \"@fncts/base/collection/immutable/Vector/api\";\nimport * as tsplus_module_4 from \"@fncts/schema/Schema/api\";\nimport * as tsplus_module_5 from \"@fncts/base/collection/immutable/List/constructors\";\nimport * as tsplus_module_6 from \"@fncts/base/data/function/api\";\nimport * as tsplus_module_7 from \"@fncts/schema/Parser/api\";\nimport * as tsplus_module_8 from \"@fncts/base/collection/immutable/List/definition\";\nimport * as tsplus_module_9 from \"@fncts/schema/ParseError/ParseError\";\nimport * as tsplus_module_10 from \"@fncts/schema/ParseResult\";\nimport * as tsplus_module_11 from \"@fncts/base/collection/mutable/ListBuffer\";\nimport * as tsplus_module_12 from \"@fncts/base/data/Either/api\";\nimport * as tsplus_module_13 from \"@fncts/base/collection/immutable/Vector/internal\";\nimport * as tsplus_module_14 from \"@fncts/schema/Parser/definition\";\nimport * as tsplus_module_15 from \"@fncts/test/control/Gen/api\";\nexport const list = list_1;\nexport const listFromArray = listFromArray_1;\n/**\n * @tsplus static fncts.schema.SchemaOps list\n * @tsplus getter fncts.Schema.Schema list\n */\nfunction list_1(value) {\n return tsplus_module_4.annotate(tsplus_module_1.GenHook, gen)(tsplus_module_4.annotate(tsplus_module_1.Identifier, `List<${tsplus_module_2.show()(value)}>`)(tsplus_module_4.declaration(tsplus_module_3.vector(value), parser(true), parser(false))));\n}\n/**\n * @tsplus static fncts.schema.SchemaOps listFromArray\n * @tsplus getter fncts.Schema.Schema listFromArray\n */\nfunction listFromArray_1(value) {\n return tsplus_module_4.transform(list_1(value), (input) => tsplus_module_5.from(input), (input) => Array.from(input))(tsplus_module_4.array(value));\n}\n/**\n * @tsplus derive fncts.schema.Schema[fncts.List]<_> 10\n */\nexport function deriveList(...[value]) {\n return listFromArray_1(value);\n}\nfunction parser(isDecoding) {\n return (value) => {\n const schema = list_1(value);\n const parseValue = isDecoding ? tsplus_module_7.decode(value) : tsplus_module_7.encode(value);\n return tsplus_module_14.make((u, options) => {\n if (!tsplus_module_8.isList(u)) {\n return tsplus_module_10.fail(tsplus_module_9.typeError(schema.ast, u));\n }\n const out = new tsplus_module_11.ListBuffer();\n const errors = tsplus_module_3.emptyPushable();\n const allErrors = options?.allErrors;\n let index = 0;\n for (const v of u) {\n const t = parseValue(v, options);\n void 0;\n if (tsplus_module_12.isLeft(t)) {\n tsplus_module_13.push(tsplus_module_9.indexError(index, t.left))(errors);\n index++;\n if (allErrors) {\n continue;\n }\n return tsplus_module_10.fail(tsplus_module_9.iterableError(schema.ast, u, errors));\n }\n else {\n out.append(t.right);\n }\n index++;\n }\n return tsplus_module_3.isNonEmpty(errors)\n ? tsplus_module_10.fail(tsplus_module_9.iterableError(schema.ast, u, errors))\n : tsplus_module_10.succeed(out.toList);\n });\n };\n}\nfunction gen(value) {\n return tsplus_module_15.map((array) => tsplus_module_5.from(array))(tsplus_module_15.array(value));\n}\n//# sourceMappingURL=list.js.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,MAAa,OAAO;AACpB,MAAa,gBAAgB;;;;;AAK7B,SAAS,OAAO,OAAO;AACnB,QAAOA,yBAAgB,SAASC,4BAAgB,SAAS,IAAI,CAACD,yBAAgB,SAASC,4BAAgB,YAAY,QAAQC,mBAAgB,MAAM,CAAC,MAAM,CAAC,GAAG,CAACF,yBAAgB,YAAYG,4CAAgB,OAAO,MAAM,EAAE,OAAO,KAAK,EAAE,OAAO,MAAM,CAAC,CAAC,CAAC;;;;;;AAM1P,SAAS,gBAAgB,OAAO;AAC5B,QAAOH,yBAAgB,UAAU,OAAO,MAAM,GAAG,UAAUI,mDAAgB,KAAK,MAAM,GAAG,UAAU,MAAM,KAAK,MAAM,CAAC,CAACJ,yBAAgB,MAAM,MAAM,CAAC;;;;;AAKvJ,SAAgB,WAAW,GAAG,CAAC,QAAQ;AACnC,QAAO,gBAAgB,MAAM;;AAEjC,SAAS,OAAO,YAAY;AACxB,SAAQ,UAAU;EACd,MAAM,SAAS,OAAO,MAAM;EAC5B,MAAM,aA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|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_chunk = require("../../chunk.cjs");
|
|
3
|
+
let _fncts_base_collection_immutable_Vector_api = require("@fncts/base/collection/immutable/Vector/api");
|
|
4
|
+
_fncts_base_collection_immutable_Vector_api = require_chunk.__toESM(_fncts_base_collection_immutable_Vector_api, 1);
|
|
5
|
+
let _fncts_schema_ASTAnnotation = require("@fncts/schema/ASTAnnotation");
|
|
6
|
+
_fncts_schema_ASTAnnotation = require_chunk.__toESM(_fncts_schema_ASTAnnotation, 1);
|
|
7
|
+
let _fncts_schema_ParseResult = require("@fncts/schema/ParseResult");
|
|
8
|
+
_fncts_schema_ParseResult = require_chunk.__toESM(_fncts_schema_ParseResult, 1);
|
|
9
|
+
let _fncts_schema_Parser_api = require("@fncts/schema/Parser/api");
|
|
10
|
+
_fncts_schema_Parser_api = require_chunk.__toESM(_fncts_schema_Parser_api, 1);
|
|
11
|
+
let _fncts_schema_Show = require("@fncts/schema/Show");
|
|
12
|
+
_fncts_schema_Show = require_chunk.__toESM(_fncts_schema_Show, 1);
|
|
13
|
+
let _fncts_schema_ParseError_ParseError = require("@fncts/schema/ParseError/ParseError");
|
|
14
|
+
_fncts_schema_ParseError_ParseError = require_chunk.__toESM(_fncts_schema_ParseError_ParseError, 1);
|
|
15
|
+
let _fncts_base_collection_immutable_Vector_internal = require("@fncts/base/collection/immutable/Vector/internal");
|
|
16
|
+
_fncts_base_collection_immutable_Vector_internal = require_chunk.__toESM(_fncts_base_collection_immutable_Vector_internal, 1);
|
|
17
|
+
let _fncts_schema_Schema_api = require("@fncts/schema/Schema/api");
|
|
18
|
+
_fncts_schema_Schema_api = require_chunk.__toESM(_fncts_schema_Schema_api, 1);
|
|
19
|
+
let _fncts_base_data_function_api = require("@fncts/base/data/function/api");
|
|
20
|
+
_fncts_base_data_function_api = require_chunk.__toESM(_fncts_base_data_function_api, 1);
|
|
21
|
+
let _fncts_base_data_Either_api = require("@fncts/base/data/Either/api");
|
|
22
|
+
_fncts_base_data_Either_api = require_chunk.__toESM(_fncts_base_data_Either_api, 1);
|
|
23
|
+
let _fncts_schema_Parser_definition = require("@fncts/schema/Parser/definition");
|
|
24
|
+
_fncts_schema_Parser_definition = require_chunk.__toESM(_fncts_schema_Parser_definition, 1);
|
|
25
|
+
let _fncts_test_control_Gen_api = require("@fncts/test/control/Gen/api");
|
|
26
|
+
_fncts_test_control_Gen_api = require_chunk.__toESM(_fncts_test_control_Gen_api, 1);
|
|
27
|
+
//#region build/esm/Schema/api/map.js
|
|
28
|
+
const map = map_1;
|
|
29
|
+
const mapFromRecord = mapFromRecord_1;
|
|
23
30
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
* @tsplus static fncts.schema.SchemaOps map
|
|
32
|
+
*/
|
|
26
33
|
function map_1(key, value) {
|
|
27
|
-
|
|
34
|
+
return _fncts_schema_Schema_api.annotate(_fncts_schema_ASTAnnotation.GenHook, gen)(_fncts_schema_Schema_api.annotate(_fncts_schema_ASTAnnotation.Identifier, `Map<${_fncts_schema_Show.show()(key)}, ${_fncts_schema_Show.show()(value)}>`)(_fncts_schema_Schema_api.declaration(_fncts_base_collection_immutable_Vector_api.vector(key, value), mapParser(true), mapParser(false))));
|
|
28
35
|
}
|
|
29
36
|
/**
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
* @tsplus static fncts.schema.SchemaOps mapFromRecord
|
|
38
|
+
*/
|
|
32
39
|
function mapFromRecord_1(key, value) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return out;
|
|
45
|
-
})(tsplus_module_4.record(key, value));
|
|
40
|
+
return _fncts_schema_Schema_api.transform(map_1(key, value), (input) => {
|
|
41
|
+
const out = /* @__PURE__ */ new Map();
|
|
42
|
+
for (const [k, v] of Object.entries(input)) out.set(k, v);
|
|
43
|
+
return out;
|
|
44
|
+
}, (input) => {
|
|
45
|
+
const out = {};
|
|
46
|
+
input.forEach((v, k) => {
|
|
47
|
+
out[k] = v;
|
|
48
|
+
});
|
|
49
|
+
return out;
|
|
50
|
+
})(_fncts_schema_Schema_api.record(key, value));
|
|
46
51
|
}
|
|
47
52
|
/**
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
function deriveMap(
|
|
51
|
-
|
|
52
|
-
...[key, value]) {
|
|
53
|
-
return mapFromRecord_1(key, value);
|
|
53
|
+
* @tsplus derive fncts.schema.Schema[fncts.Map]<_> 10
|
|
54
|
+
*/
|
|
55
|
+
function deriveMap(...[key, value]) {
|
|
56
|
+
return mapFromRecord_1(key, value);
|
|
54
57
|
}
|
|
55
58
|
function mapParser(isDecoding) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
if (tsplus_module_9.isLeft(tk) || tsplus_module_9.isLeft(tv)) {
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
out.set(tk.right, tv.right);
|
|
88
|
-
}
|
|
89
|
-
return tsplus_module_3.isNonEmpty(errors) ? tsplus_module_7.fail(tsplus_module_6.iterableError(schema.ast, u, errors)) : tsplus_module_7.succeed(out);
|
|
90
|
-
});
|
|
91
|
-
};
|
|
59
|
+
return (key, value) => {
|
|
60
|
+
const schema = map_1(key, value);
|
|
61
|
+
return _fncts_schema_Parser_definition.make((u, options) => {
|
|
62
|
+
if (!(u instanceof Map)) return _fncts_schema_ParseResult.fail(_fncts_schema_ParseError_ParseError.typeError(schema.ast, u));
|
|
63
|
+
const allErrors = options?.allErrors;
|
|
64
|
+
const errors = _fncts_base_collection_immutable_Vector_api.emptyPushable();
|
|
65
|
+
const out = /* @__PURE__ */ new Map();
|
|
66
|
+
const keyParser = isDecoding ? _fncts_schema_Parser_api.decode(key) : _fncts_schema_Parser_api.encode(key);
|
|
67
|
+
const valueParser = isDecoding ? _fncts_schema_Parser_api.decode(value) : _fncts_schema_Parser_api.encode(value);
|
|
68
|
+
for (const [k, v] of u) {
|
|
69
|
+
const tk = keyParser(k, options);
|
|
70
|
+
if (_fncts_base_data_Either_api.isLeft(tk)) {
|
|
71
|
+
_fncts_base_collection_immutable_Vector_internal.push(_fncts_schema_ParseError_ParseError.keyError(key.ast, k, tk.left))(errors);
|
|
72
|
+
if (!allErrors) return _fncts_schema_ParseResult.fail(_fncts_schema_ParseError_ParseError.iterableError(schema.ast, u, errors));
|
|
73
|
+
}
|
|
74
|
+
const tv = valueParser(v, options);
|
|
75
|
+
if (_fncts_base_data_Either_api.isLeft(tv)) {
|
|
76
|
+
_fncts_base_collection_immutable_Vector_internal.push(_fncts_schema_ParseError_ParseError.keyError(key.ast, k, tv.left))(errors);
|
|
77
|
+
if (!allErrors) return _fncts_schema_ParseResult.fail(_fncts_schema_ParseError_ParseError.iterableError(schema.ast, u, errors));
|
|
78
|
+
}
|
|
79
|
+
if (_fncts_base_data_Either_api.isLeft(tk) || _fncts_base_data_Either_api.isLeft(tv)) continue;
|
|
80
|
+
out.set(tk.right, tv.right);
|
|
81
|
+
}
|
|
82
|
+
return _fncts_base_collection_immutable_Vector_api.isNonEmpty(errors) ? _fncts_schema_ParseResult.fail(_fncts_schema_ParseError_ParseError.iterableError(schema.ast, u, errors)) : _fncts_schema_ParseResult.succeed(out);
|
|
83
|
+
});
|
|
84
|
+
};
|
|
92
85
|
}
|
|
93
86
|
function gen(key, value) {
|
|
94
|
-
|
|
87
|
+
return _fncts_test_control_Gen_api.map((pairs) => new Map(pairs))(_fncts_test_control_Gen_api.array(_fncts_test_control_Gen_api.tuple(key, value)));
|
|
95
88
|
}
|
|
89
|
+
//#endregion
|
|
90
|
+
exports.deriveMap = deriveMap;
|
|
91
|
+
exports.map = map;
|
|
92
|
+
exports.mapFromRecord = mapFromRecord;
|
|
93
|
+
|
|
96
94
|
//# sourceMappingURL=map.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.cjs","names":["
|
|
1
|
+
{"version":3,"file":"map.cjs","names":["tsplus_module_4","tsplus_module_1","tsplus_module_2","tsplus_module_3","tsplus_module_11","tsplus_module_7","tsplus_module_6","tsplus_module_8","tsplus_module_9","tsplus_module_12"],"sources":["../../../esm/Schema/api/map.js"],"sourcesContent":["import * as tsplus_module_1 from \"@fncts/schema/ASTAnnotation\";\nimport * as tsplus_module_2 from \"@fncts/schema/Show\";\nimport * as tsplus_module_3 from \"@fncts/base/collection/immutable/Vector/api\";\nimport * as tsplus_module_4 from \"@fncts/schema/Schema/api\";\nimport * as tsplus_module_5 from \"@fncts/base/data/function/api\";\nimport * as tsplus_module_6 from \"@fncts/schema/ParseError/ParseError\";\nimport * as tsplus_module_7 from \"@fncts/schema/ParseResult\";\nimport * as tsplus_module_8 from \"@fncts/schema/Parser/api\";\nimport * as tsplus_module_9 from \"@fncts/base/data/Either/api\";\nimport * as tsplus_module_10 from \"@fncts/base/collection/immutable/Vector/internal\";\nimport * as tsplus_module_11 from \"@fncts/schema/Parser/definition\";\nimport * as tsplus_module_12 from \"@fncts/test/control/Gen/api\";\nexport const map = map_1;\nexport const mapFromRecord = mapFromRecord_1;\n/**\n * @tsplus static fncts.schema.SchemaOps map\n */\nfunction map_1(key, value) {\n return tsplus_module_4.annotate(tsplus_module_1.GenHook, gen)(tsplus_module_4.annotate(tsplus_module_1.Identifier, `Map<${tsplus_module_2.show()(key)}, ${tsplus_module_2.show()(value)}>`)(tsplus_module_4.declaration(tsplus_module_3.vector(key, value), mapParser(true), mapParser(false))));\n}\n/**\n * @tsplus static fncts.schema.SchemaOps mapFromRecord\n */\nfunction mapFromRecord_1(key, value) {\n return tsplus_module_4.transform(map_1(key, value), (input) => {\n const out = new Map();\n for (const [k, v] of Object.entries(input)) {\n out.set(k, v);\n }\n return out;\n }, (input) => {\n const out = {};\n input.forEach((v, k) => {\n out[k] = v;\n });\n return out;\n })(tsplus_module_4.record(key, value));\n}\n/**\n * @tsplus derive fncts.schema.Schema[fncts.Map]<_> 10\n */\nexport function deriveMap(\n// @ts-expect-error\n...[key, value]) {\n return mapFromRecord_1(key, value);\n}\nfunction mapParser(isDecoding) {\n return (key, value) => {\n const schema = map_1(key, value);\n return tsplus_module_11.make((u, options) => {\n if (!(u instanceof Map)) {\n return tsplus_module_7.fail(tsplus_module_6.typeError(schema.ast, u));\n }\n const allErrors = options?.allErrors;\n const errors = tsplus_module_3.emptyPushable();\n const out = new Map();\n const keyParser = isDecoding ? tsplus_module_8.decode(key) : tsplus_module_8.encode(key);\n const valueParser = isDecoding ? tsplus_module_8.decode(value) : tsplus_module_8.encode(value);\n for (const [k, v] of u) {\n const tk = keyParser(k, options);\n void 0;\n if (tsplus_module_9.isLeft(tk)) {\n tsplus_module_10.push(tsplus_module_6.keyError(key.ast, k, tk.left))(errors);\n if (!allErrors) {\n return tsplus_module_7.fail(tsplus_module_6.iterableError(schema.ast, u, errors));\n }\n }\n const tv = valueParser(v, options);\n void 0;\n if (tsplus_module_9.isLeft(tv)) {\n tsplus_module_10.push(tsplus_module_6.keyError(key.ast, k, tv.left))(errors);\n if (!allErrors) {\n return tsplus_module_7.fail(tsplus_module_6.iterableError(schema.ast, u, errors));\n }\n }\n if (tsplus_module_9.isLeft(tk) || tsplus_module_9.isLeft(tv)) {\n continue;\n }\n out.set(tk.right, tv.right);\n }\n return tsplus_module_3.isNonEmpty(errors)\n ? tsplus_module_7.fail(tsplus_module_6.iterableError(schema.ast, u, errors))\n : tsplus_module_7.succeed(out);\n });\n };\n}\nfunction gen(key, value) {\n return tsplus_module_12.map((pairs) => new Map(pairs))(tsplus_module_12.array(tsplus_module_12.tuple(key, value)));\n}\n//# sourceMappingURL=map.js.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAa,MAAM;AACnB,MAAa,gBAAgB;;;;AAI7B,SAAS,MAAM,KAAK,OAAO;AACvB,QAAOA,yBAAgB,SAASC,4BAAgB,SAAS,IAAI,CAACD,yBAAgB,SAASC,4BAAgB,YAAY,OAAOC,mBAAgB,MAAM,CAAC,IAAI,CAAC,IAAIA,mBAAgB,MAAM,CAAC,MAAM,CAAC,GAAG,CAACF,yBAAgB,YAAYG,4CAAgB,OAAO,KAAK,MAAM,EAAE,UAAU,KAAK,EAAE,UAAU,MAAM,CAAC,CAAC,CAAC;;;;;AAKpS,SAAS,gBAAgB,KAAK,OAAO;AACjC,QAAOH,yBAAgB,UAAU,MAAM,KAAK,MAAM,GAAG,UAAU;EAC3D,MAAM,sBAAM,IAAI,KAAK;AACrB,OAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,MAAM,CACtC,KAAI,IAAI,GAAG,EAAE;AAEjB,SAAO;KACP,UAAU;EACV,MAAM,MAAM,EAAE;AACd,QAAM,SAAS,GAAG,MAAM;AACpB,OAAI,KAAK;IACX;AACF,SAAO;GACT,CAACA,yBAAgB,OAAO,KAAK,MAAM,CAAC;;;;;AAK1C,SAAgB,UAEhB,GAAG,CAAC,KAAK,QAAQ;AACb,QAAO,gBAAgB,KAAK,MAAM;;AAEtC,SAAS,UAAU,YAAY;AAC3B,SAAQ,KAAK,UAAU;EACnB,MAAM,SAAS,MAAM,KAAK,MAAM;AAChC,SAAOI,gCAAiB,MAAM,GAAG,YAAY;AACzC,OAAI,EAAE,aAAa,KACf,QAAOC,0BAAgB,KAAKC,oCAAgB,UAAU,OAAO,KAAK,EAAE,CAAC;GAEzE,MAAM,YAAY,SAAS;GAC3B,MAAM,SAASH,4CAAgB,eAAe;G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6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_chunk = require("../../chunk.cjs");
|
|
3
|
+
let _fncts_base_collection_immutable_Vector_api = require("@fncts/base/collection/immutable/Vector/api");
|
|
4
|
+
_fncts_base_collection_immutable_Vector_api = require_chunk.__toESM(_fncts_base_collection_immutable_Vector_api, 1);
|
|
5
|
+
let _fncts_base_data_Maybe_api = require("@fncts/base/data/Maybe/api");
|
|
6
|
+
_fncts_base_data_Maybe_api = require_chunk.__toESM(_fncts_base_data_Maybe_api, 1);
|
|
7
|
+
let _fncts_base_data_Maybe_constructors = require("@fncts/base/data/Maybe/constructors");
|
|
8
|
+
_fncts_base_data_Maybe_constructors = require_chunk.__toESM(_fncts_base_data_Maybe_constructors, 1);
|
|
9
|
+
let _fncts_schema_ASTAnnotation = require("@fncts/schema/ASTAnnotation");
|
|
10
|
+
_fncts_schema_ASTAnnotation = require_chunk.__toESM(_fncts_schema_ASTAnnotation, 1);
|
|
11
|
+
let _fncts_schema_ParseResult = require("@fncts/schema/ParseResult");
|
|
12
|
+
_fncts_schema_ParseResult = require_chunk.__toESM(_fncts_schema_ParseResult, 1);
|
|
13
|
+
let _fncts_schema_Parser_api = require("@fncts/schema/Parser/api");
|
|
14
|
+
_fncts_schema_Parser_api = require_chunk.__toESM(_fncts_schema_Parser_api, 1);
|
|
15
|
+
let _fncts_base_data_Maybe_definition = require("@fncts/base/data/Maybe/definition");
|
|
16
|
+
_fncts_base_data_Maybe_definition = require_chunk.__toESM(_fncts_base_data_Maybe_definition, 1);
|
|
17
|
+
let _fncts_schema_Show = require("@fncts/schema/Show");
|
|
18
|
+
_fncts_schema_Show = require_chunk.__toESM(_fncts_schema_Show, 1);
|
|
19
|
+
let _fncts_schema_ParseError_ParseError = require("@fncts/schema/ParseError/ParseError");
|
|
20
|
+
_fncts_schema_ParseError_ParseError = require_chunk.__toESM(_fncts_schema_ParseError_ParseError, 1);
|
|
21
|
+
let _fncts_schema_Schema_api = require("@fncts/schema/Schema/api");
|
|
22
|
+
_fncts_schema_Schema_api = require_chunk.__toESM(_fncts_schema_Schema_api, 1);
|
|
23
|
+
let _fncts_base_data_function_api = require("@fncts/base/data/function/api");
|
|
24
|
+
_fncts_base_data_function_api = require_chunk.__toESM(_fncts_base_data_function_api, 1);
|
|
25
|
+
let _fncts_base_data_Either_api = require("@fncts/base/data/Either/api");
|
|
26
|
+
_fncts_base_data_Either_api = require_chunk.__toESM(_fncts_base_data_Either_api, 1);
|
|
27
|
+
let _fncts_schema_Parser_definition = require("@fncts/schema/Parser/definition");
|
|
28
|
+
_fncts_schema_Parser_definition = require_chunk.__toESM(_fncts_schema_Parser_definition, 1);
|
|
29
|
+
//#region build/esm/Schema/api/maybe.js
|
|
22
30
|
const fileName_1 = "(@fncts/schema) src/Schema/api/maybe.ts";
|
|
23
|
-
const maybe =
|
|
24
|
-
const maybeFromNullable =
|
|
31
|
+
const maybe = maybe_1;
|
|
32
|
+
const maybeFromNullable = maybeFromNullable_1;
|
|
25
33
|
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
* @tsplus static fncts.schema.SchemaOps maybe
|
|
35
|
+
* @tsplus getter fncts.schema.Schema maybe
|
|
36
|
+
*/
|
|
29
37
|
function maybe_1(value) {
|
|
30
|
-
|
|
38
|
+
return _fncts_schema_Schema_api.annotate(_fncts_schema_ASTAnnotation.Identifier, `Maybe<${_fncts_schema_Show.show()(value)}>`)(_fncts_schema_Schema_api.declaration(_fncts_base_collection_immutable_Vector_api.vector(value), maybeParser(true), maybeParser(false)));
|
|
31
39
|
}
|
|
32
40
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
41
|
+
* @tsplus static fncts.schema.SchemaOps maybeFromNullable
|
|
42
|
+
* @tsplus getter fncts.schema.Schema maybeFromNullable
|
|
43
|
+
*/
|
|
36
44
|
function maybeFromNullable_1(value) {
|
|
37
|
-
|
|
45
|
+
return _fncts_schema_Schema_api.transform(maybe_1(value), _fncts_base_data_Maybe_constructors.fromNullable, (input) => _fncts_base_data_Maybe_api.getOrElse(() => null)(input))(_fncts_schema_Schema_api.union(_fncts_schema_Schema_api._undefined, _fncts_schema_Schema_api.nullable(value)));
|
|
38
46
|
}
|
|
39
47
|
/**
|
|
40
|
-
|
|
41
|
-
|
|
48
|
+
* @tsplus derive fncts.schema.Schema[fncts.Maybe]<_> 10
|
|
49
|
+
*/
|
|
42
50
|
function deriveMaybe(...[value]) {
|
|
43
|
-
|
|
51
|
+
return maybeFromNullable_1(value);
|
|
44
52
|
}
|
|
45
53
|
function maybeParser(isDecoding) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return tsplus_module_11.succeed(tsplus_module_5.nothing(fileName_1 + ":47:43"));
|
|
56
|
-
} else {
|
|
57
|
-
return tsplus_module_12.map(a => tsplus_module_5.just(a, fileName_1 + ":49:60"))(parseValue(u.value, options));
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
};
|
|
54
|
+
return (value) => {
|
|
55
|
+
const schema = maybe_1(value);
|
|
56
|
+
const parseValue = isDecoding ? _fncts_schema_Parser_api.decode(value) : _fncts_schema_Parser_api.encode(value);
|
|
57
|
+
return _fncts_schema_Parser_definition.make((u, options) => {
|
|
58
|
+
if (!_fncts_base_data_Maybe_definition.isMaybe(u)) return _fncts_schema_ParseResult.fail(_fncts_schema_ParseError_ParseError.typeError(schema.ast, u));
|
|
59
|
+
if (_fncts_base_data_Maybe_definition.isNothing(u)) return _fncts_schema_ParseResult.succeed(_fncts_base_data_Maybe_constructors.nothing(fileName_1 + ":47:43"));
|
|
60
|
+
else return _fncts_base_data_Either_api.map((a) => _fncts_base_data_Maybe_constructors.just(a, fileName_1 + ":49:60"))(parseValue(u.value, options));
|
|
61
|
+
});
|
|
62
|
+
};
|
|
61
63
|
}
|
|
64
|
+
//#endregion
|
|
65
|
+
exports.deriveMaybe = deriveMaybe;
|
|
66
|
+
exports.maybe = maybe;
|
|
67
|
+
exports.maybeFromNullable = maybeFromNullable;
|
|
68
|
+
|
|
62
69
|
//# sourceMappingURL=maybe.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maybe.cjs","names":["
|
|
1
|
+
{"version":3,"file":"maybe.cjs","names":["tsplus_module_4","tsplus_module_1","tsplus_module_2","tsplus_module_3","tsplus_module_5","tsplus_module_6","tsplus_module_8","tsplus_module_13","tsplus_module_9","tsplus_module_11","tsplus_module_10","tsplus_module_12"],"sources":["../../../esm/Schema/api/maybe.js"],"sourcesContent":["const fileName_1 = \"(@fncts/schema) src/Schema/api/maybe.ts\";\nimport * as tsplus_module_1 from \"@fncts/schema/ASTAnnotation\";\nimport * as tsplus_module_2 from \"@fncts/schema/Show\";\nimport * as tsplus_module_3 from \"@fncts/base/collection/immutable/Vector/api\";\nimport * as tsplus_module_4 from \"@fncts/schema/Schema/api\";\nimport * as tsplus_module_5 from \"@fncts/base/data/Maybe/constructors\";\nimport * as tsplus_module_6 from \"@fncts/base/data/Maybe/api\";\nimport * as tsplus_module_7 from \"@fncts/base/data/function/api\";\nimport * as tsplus_module_8 from \"@fncts/schema/Parser/api\";\nimport * as tsplus_module_9 from \"@fncts/base/data/Maybe/definition\";\nimport * as tsplus_module_10 from \"@fncts/schema/ParseError/ParseError\";\nimport * as tsplus_module_11 from \"@fncts/schema/ParseResult\";\nimport * as tsplus_module_12 from \"@fncts/base/data/Either/api\";\nimport * as tsplus_module_13 from \"@fncts/schema/Parser/definition\";\nexport const maybe = maybe_1;\nexport const maybeFromNullable = maybeFromNullable_1;\n/**\n * @tsplus static fncts.schema.SchemaOps maybe\n * @tsplus getter fncts.schema.Schema maybe\n */\nfunction maybe_1(value) {\n return tsplus_module_4.annotate(tsplus_module_1.Identifier, `Maybe<${tsplus_module_2.show()(value)}>`)(tsplus_module_4.declaration(tsplus_module_3.vector(value), maybeParser(true), maybeParser(false)));\n}\n/**\n * @tsplus static fncts.schema.SchemaOps maybeFromNullable\n * @tsplus getter fncts.schema.Schema maybeFromNullable\n */\nfunction maybeFromNullable_1(value) {\n return tsplus_module_4.transform(maybe_1(value), tsplus_module_5.fromNullable, (input) => tsplus_module_6.getOrElse(() => null)(input))(tsplus_module_4.union(tsplus_module_4._undefined, tsplus_module_4.nullable(value)));\n}\n/**\n * @tsplus derive fncts.schema.Schema[fncts.Maybe]<_> 10\n */\nexport function deriveMaybe(...[value]) {\n return maybeFromNullable_1(value);\n}\nfunction maybeParser(isDecoding) {\n return (value) => {\n const schema = maybe_1(value);\n const parseValue = isDecoding ? tsplus_module_8.decode(value) : tsplus_module_8.encode(value);\n return tsplus_module_13.make((u, options) => {\n if (!tsplus_module_9.isMaybe(u)) {\n return tsplus_module_11.fail(tsplus_module_10.typeError(schema.ast, u));\n }\n void 0;\n if (tsplus_module_9.isNothing(u)) {\n return tsplus_module_11.succeed(tsplus_module_5.nothing(fileName_1 + \":47:43\"));\n }\n else {\n return tsplus_module_12.map((a) => tsplus_module_5.just(a, fileName_1 + \":49:60\"))(parseValue(u.value, options));\n }\n });\n };\n}\n//# sourceMappingURL=maybe.js.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,aAAa;AAcnB,MAAa,QAAQ;AACrB,MAAa,oBAAoB;;;;;AAKjC,SAAS,QAAQ,OAAO;AACpB,QAAOA,yBAAgB,SAASC,4BAAgB,YAAY,SAASC,mBAAgB,MAAM,CAAC,MAAM,CAAC,GAAG,CAACF,yBAAgB,YAAYG,4CAAgB,OAAO,MAAM,EAAE,YAAY,KAAK,EAA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