@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.
Files changed (76) hide show
  1. package/AST.d.ts +29 -12
  2. package/Guard.d.ts +9 -0
  3. package/ParseError.d.ts +40 -3
  4. package/ParseFailure.d.ts +18 -0
  5. package/ParseResult.d.ts +2 -1
  6. package/Parser/api.d.ts +0 -6
  7. package/Parser/interpreter.d.ts +1 -2
  8. package/Show.d.ts +1 -1
  9. package/_cjs/AST.cjs +115 -65
  10. package/_cjs/AST.cjs.map +1 -1
  11. package/_cjs/Guard.cjs +278 -0
  12. package/_cjs/Guard.cjs.map +1 -0
  13. package/_cjs/ParseError.cjs +77 -3
  14. package/_cjs/ParseError.cjs.map +1 -1
  15. package/_cjs/ParseFailure.cjs +28 -0
  16. package/_cjs/ParseFailure.cjs.map +1 -0
  17. package/_cjs/ParseResult.cjs +4 -3
  18. package/_cjs/ParseResult.cjs.map +1 -1
  19. package/_cjs/Parser/api.cjs +11 -23
  20. package/_cjs/Parser/api.cjs.map +1 -1
  21. package/_cjs/Parser/interpreter.cjs +93 -141
  22. package/_cjs/Parser/interpreter.cjs.map +1 -1
  23. package/_cjs/Schema/api/conc.cjs +1 -1
  24. package/_cjs/Schema/api/conc.cjs.map +1 -1
  25. package/_cjs/Schema/api/hashMap.cjs +1 -1
  26. package/_cjs/Schema/api/hashMap.cjs.map +1 -1
  27. package/_cjs/Schema/api/immutableArray.cjs +1 -1
  28. package/_cjs/Schema/api/immutableArray.cjs.map +1 -1
  29. package/_cjs/Schema/api/list.cjs +1 -1
  30. package/_cjs/Schema/api/list.cjs.map +1 -1
  31. package/_cjs/Schema/api.cjs +27 -28
  32. package/_cjs/Schema/api.cjs.map +1 -1
  33. package/_cjs/Show.cjs +23 -12
  34. package/_cjs/Show.cjs.map +1 -1
  35. package/_mjs/AST.mjs +107 -61
  36. package/_mjs/AST.mjs.map +1 -1
  37. package/_mjs/Guard.mjs +269 -0
  38. package/_mjs/Guard.mjs.map +1 -0
  39. package/_mjs/ParseError.mjs +72 -2
  40. package/_mjs/ParseError.mjs.map +1 -1
  41. package/_mjs/ParseFailure.mjs +20 -0
  42. package/_mjs/ParseFailure.mjs.map +1 -0
  43. package/_mjs/ParseResult.mjs +4 -3
  44. package/_mjs/ParseResult.mjs.map +1 -1
  45. package/_mjs/Parser/api.mjs +10 -21
  46. package/_mjs/Parser/api.mjs.map +1 -1
  47. package/_mjs/Parser/interpreter.mjs +94 -142
  48. package/_mjs/Parser/interpreter.mjs.map +1 -1
  49. package/_mjs/Schema/api/conc.mjs +1 -1
  50. package/_mjs/Schema/api/conc.mjs.map +1 -1
  51. package/_mjs/Schema/api/hashMap.mjs +1 -1
  52. package/_mjs/Schema/api/hashMap.mjs.map +1 -1
  53. package/_mjs/Schema/api/immutableArray.mjs +1 -1
  54. package/_mjs/Schema/api/immutableArray.mjs.map +1 -1
  55. package/_mjs/Schema/api/list.mjs +1 -1
  56. package/_mjs/Schema/api/list.mjs.map +1 -1
  57. package/_mjs/Schema/api.mjs +27 -28
  58. package/_mjs/Schema/api.mjs.map +1 -1
  59. package/_mjs/Show.mjs +23 -12
  60. package/_mjs/Show.mjs.map +1 -1
  61. package/_src/AST.ts +96 -47
  62. package/_src/Guard.ts +268 -0
  63. package/_src/ParseError.ts +88 -4
  64. package/_src/ParseFailure.ts +18 -0
  65. package/_src/ParseResult.ts +3 -3
  66. package/_src/Parser/api.ts +8 -21
  67. package/_src/Parser/interpreter.ts +94 -128
  68. package/_src/Schema/api/conc.ts +1 -1
  69. package/_src/Schema/api/hashMap.ts +1 -1
  70. package/_src/Schema/api/immutableArray.ts +1 -1
  71. package/_src/Schema/api/list.ts +1 -1
  72. package/_src/Schema/api.ts +3 -10
  73. package/_src/Show.ts +28 -15
  74. package/_src/global.ts +4 -0
  75. package/global.d.ts +4 -0
  76. package/package.json +3 -3
package/_cjs/Show.cjs CHANGED
@@ -11,17 +11,28 @@ var tsplus_module_4 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require
11
11
  var tsplus_module_5 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/control/Eval/api"));
12
12
  var tsplus_module_6 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/schema/ASTAnnotation"));
13
13
  var tsplus_module_7 = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@fncts/base/data/Maybe/destructors"));
14
+ var _Global = /*#__PURE__*/require("@fncts/base/data/Global");
14
15
  var _utils = /*#__PURE__*/require("@fncts/schema/utils");
15
16
  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); }
16
17
  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; }
18
+ const showMemoMap = /*#__PURE__*/(0, _Global.globalValue)( /*#__PURE__*/Symbol.for("fncts.schema.Guard.showMemoMap"), () => new WeakMap());
19
+ function goMemo(ast) {
20
+ const memo = showMemoMap.get(ast);
21
+ if (memo) {
22
+ return memo;
23
+ }
24
+ const s = go(ast);
25
+ showMemoMap.set(ast, s);
26
+ return s;
27
+ }
17
28
  /**
18
29
  * @tsplus getter fncts.schema.Schema show
19
30
  */
20
31
  function show(self) {
21
- const ev = go(self.ast);
32
+ const ev = goMemo(self.ast);
22
33
  return tsplus_module_1.run(ev);
23
34
  }
24
- const go = /*#__PURE__*/(0, _utils.memoize)(function go(ast) {
35
+ function go(ast) {
25
36
  void 0;
26
37
  switch (ast._tag) {
27
38
  case 0 /* ASTTag.Declaration */:
@@ -33,7 +44,7 @@ const go = /*#__PURE__*/(0, _utils.memoize)(function go(ast) {
33
44
  } else {
34
45
  return `${id}<${tsplus_module_3.join(", ")(ts)}>`;
35
46
  }
36
- })(tsplus_module_3._traverse(ast.typeParameters)(tsplus_module_4.Applicative)(go));
47
+ })(tsplus_module_3._traverse(ast.typeParameters)(tsplus_module_4.Applicative)(goMemo));
37
48
  })(ast.annotations.get(tsplus_module_6.Identifier));
38
49
  }
39
50
  case 1 /* ASTTag.Literal */:
@@ -83,7 +94,7 @@ const go = /*#__PURE__*/(0, _utils.memoize)(function go(ast) {
83
94
  const middle = restElements.length > 0 ? ", " : "";
84
95
  const suffix = tsplus_module_3.join(", ")(tsplus_module_3.map(s => `...${s}`)(restElements)) + "]";
85
96
  return prefix + middle + suffix;
86
- }))(tsplus_module_7.match(() => tsplus_module_2.now(tsplus_module_3.empty()), rest => tsplus_module_3._traverse(rest)(tsplus_module_4.Applicative)(go))(ast.rest)))(tsplus_module_3._traverse(tsplus_module_3.map(element => element.type)(ast.elements))(tsplus_module_4.Applicative)(go));
97
+ }))(tsplus_module_7.match(() => tsplus_module_2.now(tsplus_module_3.empty()), rest => tsplus_module_3._traverse(rest)(tsplus_module_4.Applicative)(goMemo))(ast.rest)))(tsplus_module_3._traverse(ast.elements)(tsplus_module_4.Applicative)(element => goMemo(element.type)));
87
98
  case 17 /* ASTTag.TypeLiteral */:
88
99
  return tsplus_module_5.flatMap(propertySignatures => tsplus_module_5.map(indexSignatures => {
89
100
  const required = [];
@@ -101,14 +112,14 @@ const go = /*#__PURE__*/(0, _utils.memoize)(function go(ast) {
101
112
  const index = tsplus_module_3.join(", ")(tsplus_module_3.map(([param, type]) => `[x: ${param}]: ${type}`)(indexSignatures));
102
113
  const suffix = "}";
103
114
  return prefix + " " + properties + (index.length === 0 ? "" : ", ") + index + " " + suffix;
104
- })(tsplus_module_3._traverse(ast.indexSignatures)(tsplus_module_4.Applicative)(is => tsplus_module_5.zip(go(is.type))(go(is.parameter)))))(tsplus_module_3._traverse(ast.propertySignatures)(tsplus_module_4.Applicative)(ps => go(ps.type)));
115
+ })(tsplus_module_3._traverse(ast.indexSignatures)(tsplus_module_4.Applicative)(is => tsplus_module_5.zip(goMemo(is.type))(goMemo(is.parameter)))))(tsplus_module_3._traverse(ast.propertySignatures)(tsplus_module_4.Applicative)(ps => goMemo(ps.type)));
105
116
  case 18 /* ASTTag.Union */:
106
- return tsplus_module_5.map(ts => tsplus_module_3.join(" | ")(ts))(tsplus_module_3._traverse(ast.types)(tsplus_module_4.Applicative)(go));
117
+ return tsplus_module_5.map(ts => tsplus_module_3.join(" | ")(ts))(tsplus_module_3._traverse(ast.types)(tsplus_module_4.Applicative)(goMemo));
107
118
  case 19 /* ASTTag.Lazy */:
108
119
  {
109
- const f = () => go(ast.getAST());
120
+ const f = () => goMemo(ast.getAST());
110
121
  const get = (0, _utils.memoize)(f);
111
- return tsplus_module_2.defer(() => get(f));
122
+ return tsplus_module_2.defer(() => get());
112
123
  }
113
124
  case 14 /* ASTTag.Enum */:
114
125
  {
@@ -116,10 +127,10 @@ const go = /*#__PURE__*/(0, _utils.memoize)(function go(ast) {
116
127
  }
117
128
  case 20 /* ASTTag.Refinement */:
118
129
  {
119
- return tsplus_module_7.match(() => tsplus_module_5.map(from => `Refined<${from}>`)(go(ast.from)), id => tsplus_module_2.now(id))(ast.annotations.get(tsplus_module_6.Identifier));
130
+ return tsplus_module_7.match(() => tsplus_module_5.map(from => `Refined<${from}>`)(goMemo(ast.from)), id => tsplus_module_2.now(id))(ast.annotations.get(tsplus_module_6.Identifier));
120
131
  }
121
132
  case 21 /* ASTTag.Transform */:
122
- return go(ast.to);
133
+ return goMemo(ast.to);
123
134
  case 22 /* ASTTag.Validation */:
124
135
  {
125
136
  return tsplus_module_5.map(from => {
@@ -128,10 +139,10 @@ const go = /*#__PURE__*/(0, _utils.memoize)(function go(ast) {
128
139
  return from;
129
140
  }
130
141
  return `${from} & ${validationNames}`;
131
- })(go(ast.from));
142
+ })(goMemo(ast.from));
132
143
  }
133
144
  }
134
- });
145
+ }
135
146
  function formatTemplateLiteralSpan(span) {
136
147
  switch (span.type._tag) {
137
148
  case 8 /* ASTTag.StringKeyword */:
package/_cjs/Show.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Show.cjs","names":["_utils","require","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","show","self","ev","go","ast","tsplus_module_1","run","memoize","_tag","tsplus_module_7","match","tsplus_module_2","now","id","tsplus_module_5","map","ts","length","tsplus_module_3","join","_traverse","typeParameters","tsplus_module_4","Applicative","annotations","tsplus_module_6","Identifier","literal","toString","symbol","formatTemplateLiteral","flatMap","elements","restElements","always","isReadonly","unsafeGet","prefix","middle","suffix","s","empty","rest","element","type","propertySignatures","indexSignatures","required","optional","forEachWithIndex","ps","name","isOptional","push","properties","concat","sort","k1","k2","toLocaleString","localeCompare","propertyKey","String","index","param","is","zip","parameter","types","f","getAST","defer","enums","from","to","validationNames","v","validation","formatTemplateLiteralSpan","span","head","spans"],"sources":["../_src/Show.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;AAIA,IAAAA,MAAA,gBAAAC,OAAA;AAA8C,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,EAA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AACnC,IAAI,CAACpC,IAAI;IACpB;MACE,OAAO,WAAW;IACpB;MACE,OAAO,WAAW;EACtB;AACF;AAEA,SAASsB,qBAAqBA,CAAC1B,GAAoB;EACjD,OAAOA,GAAG,CAAC4E,IAAI,GAAG9D,eAAA,CAAAC,IAAA,CAA6E,EAAE,EAA/ED,eAAA,CAAAH,GAAA,CAAegE,IAAI,IAAKD,yBAAyB,CAACC,IAAI,CAAC,GAAGA,IAAI,CAACpD,OAAO,EAAtEvB,GAAG,CAAC6E,KAAK,CAA8D,CAAS;AACpG"}
1
+ {"version":3,"file":"Show.cjs","names":["_Global","require","_utils","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","showMemoMap","globalValue","Symbol","for","goMemo","ast","memo","s","go","show","self","ev","tsplus_module_1","run","_tag","tsplus_module_7","match","tsplus_module_2","now","id","tsplus_module_5","map","ts","length","tsplus_module_3","join","_traverse","typeParameters","tsplus_module_4","Applicative","annotations","tsplus_module_6","Identifier","literal","toString","symbol","formatTemplateLiteral","flatMap","elements","restElements","always","isReadonly","unsafeGet","prefix","middle","suffix","empty","rest","element","type","propertySignatures","indexSignatures","required","optional","forEachWithIndex","ps","name","isOptional","push","properties","concat","sort","k1","k2","toLocaleString","localeCompare","propertyKey","String","index","param","is","zip","parameter","types","f","getAST","memoize","defer","enums","from","to","validationNames","v","validation","formatTemplateLiteralSpan","span","head","spans"],"sources":["../_src/Show.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;AAEA,IAAAA,OAAA,gBAAAC,OAAA;AAGA,IAAAC,MAAA,gBAAAD,OAAA;AAA8C,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,C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ACvB;MAAwB;QACtB,OAAO5D,eAAA,CAAAC,GAAA,CAAsB0D,IAAI,IAAI;UACnC,MAAME,eAAe,GAAGzD,eAAA,CAAAC,IAAA,CAAuC,KAAK,EAA5CD,eAAA,CAAAH,GAAA,CAAoB6D,CAAC,IAAKA,CAAC,CAAC1B,IAAI,EAAhCnD,GAAG,CAAC8E,UAAU,CAAmB,CAAY;UAErE,IAAIF,eAAe,CAAC1D,MAAM,IAAI,CAAC,EAAE;YAC/B,OAAOwD,IAAI;UACb;UAEA,OAAO,GAAGA,IAAI,MAAME,eAAe,EAAE;QACvC,CAAC,EARM7E,MAAM,CAACC,GAAG,CAAC0E,IAAI,CAAC,CAQrB;MACJ;EACF;AACF;AAEA,SAASK,yBAAyBA,CAACC,IAAyB;EAC1D,QAAQA,IAAI,CAACpC,IAAI,CAACnC,IAAI;IACpB;MACE,OAAO,WAAW;IACpB;MACE,OAAO,WAAW;EACtB;AACF;AAEA,SAASsB,qBAAqBA,CAAC/B,GAAoB;EACjD,OAAOA,GAAG,CAACiF,IAAI,GAAG9D,eAAA,CAAAC,IAAA,CAA6E,EAAE,EAA/ED,eAAA,CAAAH,GAAA,CAAegE,IAAI,IAAKD,yBAAyB,CAACC,IAAI,CAAC,GAAGA,IAAI,CAACpD,OAAO,EAAtE5B,GAAG,CAACkF,KAAK,CAA8D,CAAS;AACpG"}
package/_mjs/AST.mjs CHANGED
@@ -2,13 +2,15 @@ var _a;
2
2
  const fileName_1 = "(@fncts/schema) src/AST.ts";
3
3
  import * as tsplus_module_1 from "@fncts/schema/ASTAnnotation";
4
4
  import * as tsplus_module_2 from "@fncts/base/collection/immutable/Vector/api";
5
- import * as tsplus_module_3 from "@fncts/base/data/number/instances";
6
- import * as tsplus_module_4 from "@fncts/base/data/Ord/api/contramap";
7
- import * as tsplus_module_5 from "@fncts/base/data/Maybe/definition";
8
- import * as tsplus_module_6 from "@fncts/base/data/Maybe/constructors";
9
- import * as tsplus_module_7 from "@fncts/base/data/Maybe/destructors";
10
- import * as tsplus_module_8 from "@fncts/base/collection/immutable/Vector/internal";
11
- import * as tsplus_module_9 from "@fncts/base/data/Maybe/api";
5
+ import * as tsplus_module_3 from "@fncts/base/data/Maybe/constructors";
6
+ import * as tsplus_module_4 from "@fncts/schema/ParseResult";
7
+ import * as tsplus_module_5 from "@fncts/schema/ParseError";
8
+ import * as tsplus_module_6 from "@fncts/base/data/number/instances";
9
+ import * as tsplus_module_7 from "@fncts/base/data/Ord/api/contramap";
10
+ import * as tsplus_module_8 from "@fncts/base/data/Maybe/definition";
11
+ import * as tsplus_module_9 from "@fncts/base/data/Maybe/destructors";
12
+ import * as tsplus_module_10 from "@fncts/base/collection/immutable/Vector/internal";
13
+ import * as tsplus_module_11 from "@fncts/base/data/Maybe/api";
12
14
  export const createDeclaration = createDeclaration_1;
13
15
  export const createLiteral = createLiteral_1;
14
16
  export const isLiteral = isLiteral_1;
@@ -26,13 +28,11 @@ export const createTypeLiteral = createTypeLiteral_1;
26
28
  export const createUnion = createUnion_1;
27
29
  export const createLazy = createLazy_1;
28
30
  export const createRefinement = createRefinement_1;
29
- export const createTransform = createTransform_1;
30
31
  export const getPropertySignatures = getPropertySignatures_1;
31
32
  export const keysOf = keysOf_1;
32
33
  export const partial = partial_1;
33
34
  export const getFrom = getFrom_1;
34
35
  export const getTo = getTo_1;
35
- export const reverse = reverse_1;
36
36
  import { show } from "@fncts/base/data/Showable";
37
37
  import { memoize } from "@fncts/schema/utils";
38
38
  import { ASTAnnotationMap } from "./ASTAnnotationMap.mjs";
@@ -214,7 +214,8 @@ export class UnknownKeyword extends AST {
214
214
  /**
215
215
  * @tsplus static fncts.schema.ASTOps unknownKeyword
216
216
  */
217
- export const unknownKeyword = /*#__PURE__*/new UnknownKeyword( /*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_1.Title, "unknown"));
217
+ const unknownKeyword_1 = /*#__PURE__*/new UnknownKeyword( /*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_1.Title, "unknown"));
218
+ export const unknownKeyword = unknownKeyword_1;
218
219
  /*
219
220
  * AnyKeyword
220
221
  */
@@ -460,6 +461,10 @@ export class Tuple extends AST {
460
461
  function createTuple_1(elements, rest, isReadonly, annotations = ASTAnnotationMap.empty) {
461
462
  return new Tuple(elements, rest, isReadonly, annotations);
462
463
  }
464
+ /**
465
+ * @tsplus static fncts.schema.ASTOps unknownArray
466
+ */
467
+ export const unknownArray = /*#__PURE__*/createTuple_1( /*#__PURE__*/tsplus_module_2.empty(), /*#__PURE__*/tsplus_module_3.just( /*#__PURE__*/tsplus_module_2.vector(unknownKeyword_1), fileName_1 + ":629:65"), true);
463
468
  /*
464
469
  * PropertySignature
465
470
  */
@@ -527,6 +532,10 @@ export function isTypeLiteral(self) {
527
532
  function createTypeLiteral_1(propertySignatures, indexSignatures, annotations) {
528
533
  return new TypeLiteral(propertySignatures, indexSignatures, annotations);
529
534
  }
535
+ /**
536
+ * @tsplus static fncts.schema.ASTOps unknownRecord
537
+ */
538
+ export const unknownRecord = /*#__PURE__*/createTypeLiteral_1( /*#__PURE__*/tsplus_module_2.empty(), /*#__PURE__*/tsplus_module_2.vector( /*#__PURE__*/createIndexSignature_1(stringKeyword_1, unknownKeyword_1, true), /*#__PURE__*/createIndexSignature_1(symbolKeyword_1, unknownKeyword_1, true)));
530
539
  /*
531
540
  * Union
532
541
  */
@@ -593,23 +602,25 @@ export function isLazy(self) {
593
602
  * Refinement
594
603
  */
595
604
  export class Refinement extends AST {
596
- constructor(from, decode, isReversed, annotations = ASTAnnotationMap.empty) {
605
+ constructor(from, predicate, annotations = ASTAnnotationMap.empty) {
597
606
  super();
598
607
  this.from = from;
599
- this.decode = decode;
600
- this.isReversed = isReversed;
608
+ this.predicate = predicate;
601
609
  this.annotations = annotations;
602
610
  this._tag = 20 /* ASTTag.Refinement */;
603
611
  }
612
+ decode(input, options) {
613
+ return this.predicate(input) ? tsplus_module_4.succeed(input) : tsplus_module_4.fail(tsplus_module_5.typeError(this, input));
614
+ }
604
615
  clone(newProperties) {
605
- return new Refinement(newProperties.from ?? this.from, newProperties.decode ?? this.decode, newProperties.isReversed ?? this.isReversed, newProperties.annotations ?? this.annotations);
616
+ return new Refinement(newProperties.from ?? this.from, newProperties.predicate ?? this.predicate, newProperties.annotations ?? this.annotations);
606
617
  }
607
618
  }
608
619
  /**
609
620
  * @tsplus static fncts.schema.ASTOps createRefinement
610
621
  */
611
- function createRefinement_1(from, decode, isReversed, annotations) {
612
- return new Refinement(from, decode, isReversed, annotations);
622
+ function createRefinement_1(from, predicate, annotations) {
623
+ return new Refinement(from, predicate, annotations);
613
624
  }
614
625
  export function isRefinement(self) {
615
626
  void 0;
@@ -619,25 +630,24 @@ export function isRefinement(self) {
619
630
  * Transform
620
631
  */
621
632
  export class Transform extends AST {
622
- constructor(from, to, decode, encode, isReversed, annotations = ASTAnnotationMap.empty) {
633
+ constructor(from, to, decode, encode, annotations = ASTAnnotationMap.empty) {
623
634
  super();
624
635
  this.from = from;
625
636
  this.to = to;
626
637
  this.decode = decode;
627
638
  this.encode = encode;
628
- this.isReversed = isReversed;
629
639
  this.annotations = annotations;
630
640
  this._tag = 21 /* ASTTag.Transform */;
631
641
  }
632
642
  clone(newProperties) {
633
- return new Transform(newProperties.from ?? this.from, newProperties.to ?? this.to, newProperties.decode ?? this.decode, newProperties.encode ?? this.encode, newProperties.isReversed ?? this.isReversed, newProperties.annotations ?? this.annotations);
643
+ return new Transform(newProperties.from ?? this.from, newProperties.to ?? this.to, newProperties.decode ?? this.decode, newProperties.encode ?? this.encode, newProperties.annotations ?? this.annotations);
634
644
  }
635
645
  }
636
646
  /**
637
647
  * @tsplus static fncts.schema.ASTOps createTransform
638
648
  */
639
- function createTransform_1(from, to, decode, encode, isReversed, annotations) {
640
- return new Transform(from, getTo_1(to), decode, encode, isReversed, annotations);
649
+ export function createTransform(from, to, decode, encode, annotations) {
650
+ return new Transform(from, getTo_1(to), decode, encode, annotations);
641
651
  }
642
652
  /*
643
653
  * Validation
@@ -706,9 +716,9 @@ export function getCardinality(ast) {
706
716
  }
707
717
  }
708
718
  function sortByAscendingCardinality(types) {
709
- return tsplus_module_2.sort(tsplus_module_4.contramap(({
719
+ return tsplus_module_2.sort(tsplus_module_7.contramap(({
710
720
  type
711
- }) => getCardinality(type))(tsplus_module_3.Ord))(types);
721
+ }) => getCardinality(type))(tsplus_module_6.Ord))(types);
712
722
  }
713
723
  export function getWeight(ast) {
714
724
  void 0;
@@ -716,7 +726,7 @@ export function getWeight(ast) {
716
726
  case 0 /* ASTTag.Declaration */:
717
727
  return getWeight(ast.type);
718
728
  case 16 /* ASTTag.Tuple */:
719
- return ast.elements.length + (tsplus_module_5.isJust(ast.rest) ? ast.rest.value.length : 0);
729
+ return ast.elements.length + (tsplus_module_8.isJust(ast.rest) ? ast.rest.value.length : 0);
720
730
  case 17 /* ASTTag.TypeLiteral */:
721
731
  return ast.propertySignatures.length + ast.indexSignatures.length;
722
732
  case 18 /* ASTTag.Union */:
@@ -732,7 +742,7 @@ export function getWeight(ast) {
732
742
  }
733
743
  }
734
744
  function sortByDescendingWeight(types) {
735
- return tsplus_module_2.sort(tsplus_module_4.contramap(getWeight)(tsplus_module_3.Ord))(types);
745
+ return tsplus_module_2.sort(tsplus_module_7.contramap(getWeight)(tsplus_module_6.Ord))(types);
736
746
  }
737
747
  function unify(candidates) {
738
748
  let out = tsplus_module_2.flatMap(ast => {
@@ -782,10 +792,10 @@ export function setAnnotation(annotation, value) {
782
792
  */
783
793
  export function appendRestElement(restElement) {
784
794
  return self => {
785
- if (tsplus_module_5.isJust(self.rest)) {
795
+ if (tsplus_module_8.isJust(self.rest)) {
786
796
  throw new Error("A rest element cannot follow another rest element. ts(1265)");
787
797
  }
788
- return createTuple_1(self.elements, tsplus_module_6.just(tsplus_module_2.vector(restElement), fileName_1 + ":1048:43"), self.isReadonly, self.annotations);
798
+ return createTuple_1(self.elements, tsplus_module_3.just(tsplus_module_2.vector(restElement), fileName_1 + ":1062:43"), self.isReadonly, self.annotations);
789
799
  };
790
800
  }
791
801
  /**
@@ -796,11 +806,11 @@ export function appendElement(element) {
796
806
  if (tsplus_module_2.some(e => e.isOptional)(self.elements) && !element.isOptional) {
797
807
  throw new Error("A required element cannot follow an optional element. ts(1257)");
798
808
  }
799
- return tsplus_module_7.match(() => createTuple_1(tsplus_module_2.append(element)(self.elements), tsplus_module_6.nothing(fileName_1 + ":1061:63"), self.isReadonly, self.annotations), rest => {
809
+ return tsplus_module_9.match(() => createTuple_1(tsplus_module_2.append(element)(self.elements), tsplus_module_3.nothing(fileName_1 + ":1075:63"), self.isReadonly, self.annotations), rest => {
800
810
  if (element.isOptional) {
801
811
  throw new Error("A required element cannot follow an optional element. ts(1257)");
802
812
  }
803
- return createTuple_1(self.elements, tsplus_module_6.just(tsplus_module_2.append(element.type)(rest), fileName_1 + ":1066:47"), self.isReadonly, self.annotations);
813
+ return createTuple_1(self.elements, tsplus_module_3.just(tsplus_module_2.append(element.type)(rest), fileName_1 + ":1080:47"), self.isReadonly, self.annotations);
804
814
  })(self.rest);
805
815
  };
806
816
  }
@@ -825,9 +835,9 @@ function getPropertySignatures_1(self) {
825
835
  }) => {
826
836
  if (tsplus_module_2.every(ps => tsplus_module_2.some(p => p.name === name)(ps))(propertySignatures)) {
827
837
  const members = tsplus_module_2.flatMap(ps => tsplus_module_2.filter(p => p.name === name)(ps))(propertySignatures);
828
- return tsplus_module_6.just(createPropertySignature_1(name, createUnion_1(tsplus_module_2.map(p => p.type)(members)), tsplus_module_2.some(p => p.isOptional)(members), tsplus_module_2.some(p => p.isReadonly)(members)), fileName_1 + ":1093:22");
838
+ return tsplus_module_3.just(createPropertySignature_1(name, createUnion_1(tsplus_module_2.map(p => p.type)(members)), tsplus_module_2.some(p => p.isOptional)(members), tsplus_module_2.some(p => p.isReadonly)(members)), fileName_1 + ":1107:22");
829
839
  }
830
- return tsplus_module_6.nothing(fileName_1 + ":1102:23");
840
+ return tsplus_module_3.nothing(fileName_1 + ":1116:23");
831
841
  })(tsplus_module_2.unsafeGet(0)(propertySignatures));
832
842
  }
833
843
  case 19 /* ASTTag.Lazy */:
@@ -891,15 +901,15 @@ export function createRecord(key, value, isReadonly) {
891
901
  case 12 /* ASTTag.SymbolKeyword */:
892
902
  case 15 /* ASTTag.TemplateLiteral */:
893
903
  case 20 /* ASTTag.Refinement */:
894
- tsplus_module_8.push(createIndexSignature_1(key, value, isReadonly))(indexSignatures);
904
+ tsplus_module_10.push(createIndexSignature_1(key, value, isReadonly))(indexSignatures);
895
905
  break;
896
906
  case 1 /* ASTTag.Literal */:
897
907
  if (typeof key.literal === "string" || typeof key.literal === "number") {
898
- tsplus_module_8.push(createPropertySignature_1(key.literal, value, false, isReadonly))(propertySignatures);
908
+ tsplus_module_10.push(createPropertySignature_1(key.literal, value, false, isReadonly))(propertySignatures);
899
909
  }
900
910
  break;
901
911
  case 2 /* ASTTag.UniqueSymbol */:
902
- tsplus_module_8.push(createPropertySignature_1(key.symbol, value, false, isReadonly))(propertySignatures);
912
+ tsplus_module_10.push(createPropertySignature_1(key.symbol, value, false, isReadonly))(propertySignatures);
903
913
  break;
904
914
  case 18 /* ASTTag.Union */:
905
915
  tsplus_module_2.forEach(go)(key.types);
@@ -936,7 +946,7 @@ function partial_1(self) {
936
946
  case 0 /* ASTTag.Declaration */:
937
947
  return partial_1(self.type);
938
948
  case 16 /* ASTTag.Tuple */:
939
- return createTuple_1(tsplus_module_2.map(e => createElement_1(e.type, true))(self.elements), tsplus_module_9.map(rest => tsplus_module_2.vector(createUnion_1(tsplus_module_2.append(undefinedKeyword_1)(rest))))(self.rest), self.isReadonly);
949
+ return createTuple_1(tsplus_module_2.map(e => createElement_1(e.type, true))(self.elements), tsplus_module_11.map(rest => tsplus_module_2.vector(createUnion_1(tsplus_module_2.append(undefinedKeyword_1)(rest))))(self.rest), self.isReadonly);
940
950
  case 17 /* ASTTag.TypeLiteral */:
941
951
  return createTypeLiteral_1(tsplus_module_2.map(f => createPropertySignature_1(f.name, f.type, true, f.isReadonly, f.annotations))(self.propertySignatures), self.indexSignatures);
942
952
  case 18 /* ASTTag.Union */:
@@ -966,7 +976,7 @@ function getFrom_1(ast) {
966
976
  case 0 /* ASTTag.Declaration */:
967
977
  return createDeclaration_1(tsplus_module_2.map(getFrom_1)(ast.typeParameters), ast.type, ast.decode, ast.annotations);
968
978
  case 16 /* ASTTag.Tuple */:
969
- return createTuple_1(tsplus_module_2.map(element => createElement_1(getFrom_1(element.type), element.isOptional))(ast.elements), tsplus_module_9.map(restElement => tsplus_module_2.map(getFrom_1)(restElement))(ast.rest), ast.isReadonly, ast.annotations);
979
+ return createTuple_1(tsplus_module_2.map(element => createElement_1(getFrom_1(element.type), element.isOptional))(ast.elements), tsplus_module_11.map(restElement => tsplus_module_2.map(getFrom_1)(restElement))(ast.rest), ast.isReadonly, ast.annotations);
970
980
  case 17 /* ASTTag.TypeLiteral */:
971
981
  return createTypeLiteral_1(tsplus_module_2.map(ps => createPropertySignature_1(ps.name, getFrom_1(ps.type), ps.isOptional, ps.isReadonly, ps.annotations))(ast.propertySignatures), tsplus_module_2.map(is => createIndexSignature_1(is.parameter, getFrom_1(is.type), is.isReadonly))(ast.indexSignatures), ast.annotations);
972
982
  case 18 /* ASTTag.Union */:
@@ -988,7 +998,7 @@ function getTo_1(ast) {
988
998
  case 0 /* ASTTag.Declaration */:
989
999
  return createDeclaration_1(tsplus_module_2.map(getTo_1)(ast.typeParameters), ast.type, ast.decode, ast.annotations);
990
1000
  case 16 /* ASTTag.Tuple */:
991
- return createTuple_1(tsplus_module_2.map(element => createElement_1(getTo_1(element.type), element.isOptional))(ast.elements), tsplus_module_9.map(restElement => tsplus_module_2.map(getTo_1)(restElement))(ast.rest), ast.isReadonly, ast.annotations);
1001
+ return createTuple_1(tsplus_module_2.map(element => createElement_1(getTo_1(element.type), element.isOptional))(ast.elements), tsplus_module_11.map(restElement => tsplus_module_2.map(getTo_1)(restElement))(ast.rest), ast.isReadonly, ast.annotations);
992
1002
  case 17 /* ASTTag.TypeLiteral */:
993
1003
  return createTypeLiteral_1(tsplus_module_2.map(ps => createPropertySignature_1(ps.name, getTo_1(ps.type), ps.isOptional, ps.isReadonly, ps.annotations))(ast.propertySignatures), tsplus_module_2.map(is => createIndexSignature_1(is.parameter, getTo_1(is.type), is.isReadonly))(ast.indexSignatures), ast.annotations);
994
1004
  case 18 /* ASTTag.Union */:
@@ -996,35 +1006,12 @@ function getTo_1(ast) {
996
1006
  case 19 /* ASTTag.Lazy */:
997
1007
  return createLazy_1(() => getTo_1(ast.getAST()), ast.annotations);
998
1008
  case 20 /* ASTTag.Refinement */:
999
- return createRefinement_1(getTo_1(ast.from), ast.decode, false, ast.annotations);
1009
+ return createRefinement_1(getTo_1(ast.from), ast.predicate, ast.annotations);
1000
1010
  case 21 /* ASTTag.Transform */:
1001
1011
  return getTo_1(ast.to);
1002
1012
  }
1003
1013
  return ast;
1004
1014
  }
1005
- /**
1006
- * @tsplus getter fncts.schema.AST reverse
1007
- */
1008
- function reverse_1(ast) {
1009
- void 0;
1010
- switch (ast._tag) {
1011
- case 0 /* ASTTag.Declaration */:
1012
- return createDeclaration_1(tsplus_module_2.map(reverse_1)(ast.typeParameters), ast.type, ast.decode, ast.annotations);
1013
- case 16 /* ASTTag.Tuple */:
1014
- return createTuple_1(tsplus_module_2.map(element => createElement_1(reverse_1(element.type), element.isOptional))(ast.elements), tsplus_module_9.map(restElement => tsplus_module_2.map(reverse_1)(restElement))(ast.rest), ast.isReadonly, ast.annotations);
1015
- case 17 /* ASTTag.TypeLiteral */:
1016
- return createTypeLiteral_1(tsplus_module_2.map(ps => createPropertySignature_1(ps.name, reverse_1(ps.type), ps.isOptional, ps.isReadonly, ps.annotations))(ast.propertySignatures), tsplus_module_2.map(is => createIndexSignature_1(is.parameter, reverse_1(is.type), is.isReadonly))(ast.indexSignatures), ast.annotations);
1017
- case 18 /* ASTTag.Union */:
1018
- return createUnion_1(tsplus_module_2.map(reverse_1)(ast.types), ast.annotations);
1019
- case 19 /* ASTTag.Lazy */:
1020
- return createLazy_1(() => reverse_1(ast.getAST()), ast.annotations);
1021
- case 20 /* ASTTag.Refinement */:
1022
- return createRefinement_1(ast.from, ast.decode, !ast.isReversed, ast.annotations);
1023
- case 21 /* ASTTag.Transform */:
1024
- return createTransform_1(reverse_1(ast.from), ast.to, ast.decode, ast.encode, !ast.isReversed, ast.annotations);
1025
- }
1026
- return ast;
1027
- }
1028
1015
  /**
1029
1016
  * @tsplus static fncts.schema.AST getCompiler
1030
1017
  */
@@ -1035,4 +1022,63 @@ export function getCompiler(match) {
1035
1022
  });
1036
1023
  return compile;
1037
1024
  }
1025
+ export function getLiterals(ast, isDecoding) {
1026
+ void 0;
1027
+ switch (ast._tag) {
1028
+ case 0 /* ASTTag.Declaration */:
1029
+ return getLiterals(ast.type, isDecoding);
1030
+ case 17 /* ASTTag.TypeLiteral */:
1031
+ {
1032
+ const out = [];
1033
+ for (let i = 0; i < ast.propertySignatures.length; i++) {
1034
+ const propertySignature = tsplus_module_2.unsafeGet(i)(ast.propertySignatures);
1035
+ if (isLiteral_1(propertySignature.type) && !propertySignature.isOptional) {
1036
+ out.push([propertySignature.name, propertySignature.type]);
1037
+ }
1038
+ }
1039
+ return out;
1040
+ }
1041
+ case 20 /* ASTTag.Refinement */:
1042
+ return getLiterals(ast.from, isDecoding);
1043
+ case 21 /* ASTTag.Transform */:
1044
+ return getLiterals(isDecoding ? ast.from : ast.to, isDecoding);
1045
+ }
1046
+ return [];
1047
+ }
1048
+ export function getSearchTree(members, isDecoding) {
1049
+ const keys = {};
1050
+ const otherwise = [];
1051
+ for (let i = 0; i < members.length; i++) {
1052
+ const member = tsplus_module_2.unsafeGet(i)(members);
1053
+ const tags = getLiterals(member, isDecoding);
1054
+ if (tags.length > 0) {
1055
+ for (let j = 0; j < tags.length; j++) {
1056
+ const [key, literal] = tags[j];
1057
+ const hash = String(literal.literal);
1058
+ keys[key] || (keys[key] = {
1059
+ buckets: {},
1060
+ ast: neverKeyword_1
1061
+ });
1062
+ const buckets = keys[key].buckets;
1063
+ if (Object.prototype.hasOwnProperty.call(buckets, hash)) {
1064
+ if (j < tags.length - 1) {
1065
+ continue;
1066
+ }
1067
+ buckets[hash].push(member);
1068
+ keys[key].ast = createUnion_1(tsplus_module_2.vector(keys[key].ast, literal));
1069
+ } else {
1070
+ buckets[hash] = [member];
1071
+ keys[key].ast = createUnion_1(tsplus_module_2.vector(keys[key].ast, literal));
1072
+ break;
1073
+ }
1074
+ }
1075
+ } else {
1076
+ otherwise.push(member);
1077
+ }
1078
+ }
1079
+ return {
1080
+ keys,
1081
+ otherwise
1082
+ };
1083
+ }
1038
1084
  //# sourceMappingURL=AST.mjs.map