@fncts/schema 0.0.24 → 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.
Files changed (135) hide show
  1. package/LICENSE +26 -0
  2. package/_cjs/AST.cjs +1093 -1226
  3. package/_cjs/AST.cjs.map +1 -1
  4. package/_cjs/ASTAnnotation.cjs +114 -85
  5. package/_cjs/ASTAnnotation.cjs.map +1 -1
  6. package/_cjs/ASTAnnotationMap.cjs +43 -41
  7. package/_cjs/ASTAnnotationMap.cjs.map +1 -1
  8. package/_cjs/Eq.cjs +113 -145
  9. package/_cjs/Eq.cjs.map +1 -1
  10. package/_cjs/Gen.cjs +131 -167
  11. package/_cjs/Gen.cjs.map +1 -1
  12. package/_cjs/Guard.cjs +167 -267
  13. package/_cjs/Guard.cjs.map +1 -1
  14. package/_cjs/InvalidInterpretationError.cjs +9 -10
  15. package/_cjs/InvalidInterpretationError.cjs.map +1 -1
  16. package/_cjs/ParseError/ParseError.cjs +283 -284
  17. package/_cjs/ParseError/ParseError.cjs.map +1 -1
  18. package/_cjs/ParseError/ParseErrorFormatter.cjs +0 -2
  19. package/_cjs/ParseError/PathFormatter.cjs +55 -87
  20. package/_cjs/ParseError/PathFormatter.cjs.map +1 -1
  21. package/_cjs/ParseError/TreeFormatter.cjs +70 -102
  22. package/_cjs/ParseError/TreeFormatter.cjs.map +1 -1
  23. package/_cjs/ParseError.cjs +35 -50
  24. package/_cjs/ParseResult.cjs +15 -15
  25. package/_cjs/ParseResult.cjs.map +1 -1
  26. package/_cjs/Parser/api.cjs +54 -50
  27. package/_cjs/Parser/api.cjs.map +1 -1
  28. package/_cjs/Parser/definition.cjs +17 -16
  29. package/_cjs/Parser/definition.cjs.map +1 -1
  30. package/_cjs/Parser/interpreter.cjs +276 -358
  31. package/_cjs/Parser/interpreter.cjs.map +1 -1
  32. package/_cjs/Parser.cjs +12 -39
  33. package/_cjs/Schema/api/conc.cjs +64 -59
  34. package/_cjs/Schema/api/conc.cjs.map +1 -1
  35. package/_cjs/Schema/api/either.cjs +73 -72
  36. package/_cjs/Schema/api/either.cjs.map +1 -1
  37. package/_cjs/Schema/api/hashMap.cjs +85 -85
  38. package/_cjs/Schema/api/hashMap.cjs.map +1 -1
  39. package/_cjs/Schema/api/hashSet.cjs +75 -69
  40. package/_cjs/Schema/api/hashSet.cjs.map +1 -1
  41. package/_cjs/Schema/api/list.cjs +74 -66
  42. package/_cjs/Schema/api/list.cjs.map +1 -1
  43. package/_cjs/Schema/api/map.cjs +81 -83
  44. package/_cjs/Schema/api/map.cjs.map +1 -1
  45. package/_cjs/Schema/api/maybe.cjs +56 -49
  46. package/_cjs/Schema/api/maybe.cjs.map +1 -1
  47. package/_cjs/Schema/api/set.cjs +68 -61
  48. package/_cjs/Schema/api/set.cjs.map +1 -1
  49. package/_cjs/Schema/api.cjs +332 -350
  50. package/_cjs/Schema/api.cjs.map +1 -1
  51. package/_cjs/Schema/definition.cjs +28 -26
  52. package/_cjs/Schema/definition.cjs.map +1 -1
  53. package/_cjs/Schema/derivations.cjs +85 -100
  54. package/_cjs/Schema/derivations.cjs.map +1 -1
  55. package/_cjs/Schema.cjs +95 -127
  56. package/_cjs/Show.cjs +91 -151
  57. package/_cjs/Show.cjs.map +1 -1
  58. package/_cjs/chunk.cjs +28 -0
  59. package/_cjs/global.cjs +0 -2
  60. package/_cjs/index.cjs +0 -2
  61. package/_cjs/utils.cjs +41 -46
  62. package/_cjs/utils.cjs.map +1 -1
  63. package/_mjs/AST.mjs +996 -1161
  64. package/_mjs/AST.mjs.map +1 -1
  65. package/_mjs/ASTAnnotation.mjs +77 -73
  66. package/_mjs/ASTAnnotation.mjs.map +1 -1
  67. package/_mjs/ASTAnnotationMap.mjs +31 -29
  68. package/_mjs/ASTAnnotationMap.mjs.map +1 -1
  69. package/_mjs/Eq.mjs +101 -134
  70. package/_mjs/Eq.mjs.map +1 -1
  71. package/_mjs/Gen.mjs +117 -157
  72. package/_mjs/Gen.mjs.map +1 -1
  73. package/_mjs/Guard.mjs +154 -257
  74. package/_mjs/Guard.mjs.map +1 -1
  75. package/_mjs/InvalidInterpretationError.mjs +8 -4
  76. package/_mjs/InvalidInterpretationError.mjs.map +1 -1
  77. package/_mjs/ParseError/ParseError.mjs +266 -262
  78. package/_mjs/ParseError/ParseError.mjs.map +1 -1
  79. package/_mjs/ParseError/ParseErrorFormatter.mjs +0 -2
  80. package/_mjs/ParseError/PathFormatter.mjs +51 -80
  81. package/_mjs/ParseError/PathFormatter.mjs.map +1 -1
  82. package/_mjs/ParseError/TreeFormatter.mjs +62 -94
  83. package/_mjs/ParseError/TreeFormatter.mjs.map +1 -1
  84. package/_mjs/ParseError.mjs +5 -6
  85. package/_mjs/ParseResult.mjs +13 -9
  86. package/_mjs/ParseResult.mjs.map +1 -1
  87. package/_mjs/Parser/api.mjs +43 -39
  88. package/_mjs/Parser/api.mjs.map +1 -1
  89. package/_mjs/Parser/definition.mjs +12 -8
  90. package/_mjs/Parser/definition.mjs.map +1 -1
  91. package/_mjs/Parser/interpreter.mjs +262 -348
  92. package/_mjs/Parser/interpreter.mjs.map +1 -1
  93. package/_mjs/Parser.mjs +4 -5
  94. package/_mjs/Schema/api/conc.mjs +41 -45
  95. package/_mjs/Schema/api/conc.mjs.map +1 -1
  96. package/_mjs/Schema/api/either.mjs +55 -61
  97. package/_mjs/Schema/api/either.mjs.map +1 -1
  98. package/_mjs/Schema/api/hashMap.mjs +61 -71
  99. package/_mjs/Schema/api/hashMap.mjs.map +1 -1
  100. package/_mjs/Schema/api/hashSet.mjs +53 -56
  101. package/_mjs/Schema/api/hashSet.mjs.map +1 -1
  102. package/_mjs/Schema/api/list.mjs +50 -53
  103. package/_mjs/Schema/api/list.mjs.map +1 -1
  104. package/_mjs/Schema/api/map.mjs +59 -69
  105. package/_mjs/Schema/api/map.mjs.map +1 -1
  106. package/_mjs/Schema/api/maybe.mjs +34 -36
  107. package/_mjs/Schema/api/maybe.mjs.map +1 -1
  108. package/_mjs/Schema/api/set.mjs +47 -48
  109. package/_mjs/Schema/api/set.mjs.map +1 -1
  110. package/_mjs/Schema/api.mjs +304 -346
  111. package/_mjs/Schema/api.mjs.map +1 -1
  112. package/_mjs/Schema/definition.mjs +21 -17
  113. package/_mjs/Schema/definition.mjs.map +1 -1
  114. package/_mjs/Schema/derivations.mjs +71 -90
  115. package/_mjs/Schema/derivations.mjs.map +1 -1
  116. package/_mjs/Schema.mjs +12 -15
  117. package/_mjs/Show.mjs +79 -139
  118. package/_mjs/Show.mjs.map +1 -1
  119. package/_mjs/global.mjs +0 -2
  120. package/_mjs/index.mjs +0 -2
  121. package/_mjs/utils.mjs +35 -37
  122. package/_mjs/utils.mjs.map +1 -1
  123. package/package.json +7 -3
  124. package/_cjs/ParseError/ParseErrorFormatter.cjs.map +0 -1
  125. package/_cjs/ParseError.cjs.map +0 -1
  126. package/_cjs/Parser.cjs.map +0 -1
  127. package/_cjs/Schema.cjs.map +0 -1
  128. package/_cjs/global.cjs.map +0 -1
  129. package/_cjs/index.cjs.map +0 -1
  130. package/_mjs/ParseError/ParseErrorFormatter.mjs.map +0 -1
  131. package/_mjs/ParseError.mjs.map +0 -1
  132. package/_mjs/Parser.mjs.map +0 -1
  133. package/_mjs/Schema.mjs.map +0 -1
  134. package/_mjs/global.mjs.map +0 -1
  135. package/_mjs/index.mjs.map +0 -1
@@ -1,402 +1,360 @@
1
- const fileName_1 = "(@fncts/schema) src/Schema/api.ts";
2
- import * as tsplus_module_1 from "@fncts/schema/Schema/definition";
1
+ import { ownKeys } from "../utils.mjs";
2
+ import { TemplateLiteralSpan, getParameter } from "../AST.mjs";
3
3
  import * as tsplus_module_2 from "@fncts/base/collection/immutable/Vector/api";
4
4
  import * as tsplus_module_3 from "@fncts/schema/AST";
5
+ import { show } from "@fncts/base/data/Showable";
6
+ import * as tsplus_module_7 from "@fncts/base/data/Maybe/api";
7
+ import * as tsplus_module_9 from "@fncts/base/data/Maybe/constructors";
8
+ import * as tsplus_module_1 from "@fncts/schema/Schema/definition";
5
9
  import * as tsplus_module_4 from "@fncts/schema/ASTAnnotation";
6
10
  import * as tsplus_module_5 from "@fncts/schema/ParseResult";
7
11
  import * as tsplus_module_6 from "@fncts/schema/Parser/api";
8
- import * as tsplus_module_7 from "@fncts/base/data/Maybe/api";
9
12
  import * as tsplus_module_8 from "@fncts/schema/Schema/api/maybe";
10
- import * as tsplus_module_9 from "@fncts/base/data/Maybe/constructors";
11
13
  import * as tsplus_module_10 from "@fncts/base/data/Maybe/definition";
12
- export const make = make_1;
13
- export const annotate = annotate_1;
14
- export const filter = filter_1;
15
- export const union = union_1;
16
- export const isOptional = isOptional_1;
17
- export const isParseOptional = isParseOptional_1;
18
- export const enum_ = enum_1;
19
- export const instanceOf = instanceOf_1;
20
- export const transformOrFail = transformOrFail_1;
21
- export const transform = transform_1;
22
- import { show } from "@fncts/base/data/Showable";
23
- import { getParameter } from "../AST.mjs";
24
- import { concrete, TemplateLiteralSpan } from "../AST.mjs";
25
- import { ownKeys } from "../utils.mjs";
26
- /**
27
- * @tsplus static fncts.schema.SchemaOps fromAST
28
- */
14
+ //#region build/esm/Schema/api.js
15
+ const fileName_1 = "(@fncts/schema) src/Schema/api.ts";
16
+ const make = make_1;
17
+ const annotate = annotate_1;
18
+ const filter = filter_1;
19
+ const union = union_1;
20
+ const isOptional = isOptional_1;
21
+ const isParseOptional = isParseOptional_1;
22
+ const enum_ = enum_1;
23
+ const instanceOf = instanceOf_1;
24
+ const transformOrFail = transformOrFail_1;
25
+ const transform = transform_1;
26
+ /**
27
+ * @tsplus static fncts.schema.SchemaOps fromAST
28
+ */
29
29
  function make_1(ast) {
30
- return new tsplus_module_1.Schema(ast);
30
+ return new tsplus_module_1.Schema(ast);
31
31
  }
32
32
  /**
33
- * @tsplus pipeable fncts.schema.Schema annotate
34
- */
33
+ * @tsplus pipeable fncts.schema.Schema annotate
34
+ */
35
35
  function annotate_1(annotation, value) {
36
- return self => {
37
- return make_1(self.ast.clone({
38
- annotations: self.ast.annotations.annotate(annotation, value)
39
- }));
40
- };
36
+ return (self) => {
37
+ return make_1(self.ast.clone({ annotations: self.ast.annotations.annotate(annotation, value) }));
38
+ };
41
39
  }
42
40
  /**
43
- * @tsplus static fncts.schema.SchemaOps declaration
44
- */
45
- export function declaration(typeParameters, decode, encode, annotations) {
46
- return make_1(tsplus_module_3.createDeclaration(tsplus_module_2.map(tp => tp.ast)(typeParameters), (...typeParameters) => decode(...typeParameters.map(make_1)), (...typeParameters) => encode(...typeParameters.map(make_1)), annotations));
41
+ * @tsplus static fncts.schema.SchemaOps declaration
42
+ */
43
+ function declaration(typeParameters, decode, encode, annotations) {
44
+ return make_1(tsplus_module_3.createDeclaration(tsplus_module_2.map((tp) => tp.ast)(typeParameters), (...typeParameters) => decode(...typeParameters.map(make_1)), (...typeParameters) => encode(...typeParameters.map(make_1)), annotations));
47
45
  }
48
46
  function filter_1(predicate) {
49
- return self => {
50
- const ast = tsplus_module_3.createRefinement(self.ast, predicate);
51
- return make_1(ast);
52
- };
47
+ return (self) => {
48
+ return make_1(tsplus_module_3.createRefinement(self.ast, predicate));
49
+ };
53
50
  }
54
51
  /**
55
- * @tsplus pipeable fncts.schema.Schema brand
56
- */
57
- export function brand(validation) {
58
- return self => {
59
- const ast = tsplus_module_3.createRefinement(self.ast, validation.validate, self.ast.annotations.annotate(tsplus_module_4.Brand, tsplus_module_2.vector(validation)));
60
- return make_1(ast);
61
- };
52
+ * @tsplus pipeable fncts.schema.Schema brand
53
+ */
54
+ function brand(validation) {
55
+ return (self) => {
56
+ return make_1(tsplus_module_3.createRefinement(self.ast, validation.validate, self.ast.annotations.annotate(tsplus_module_4.Brand, tsplus_module_2.vector(validation))));
57
+ };
62
58
  }
63
59
  function makeLiteral(value) {
64
- return make_1(tsplus_module_3.createLiteral(value));
65
- }
66
- /**
67
- * @tsplus static fncts.schema.SchemaOps literal
68
- */
69
- export function literal(...literals) {
70
- return union_1(...literals.map(makeLiteral));
71
- }
72
- /**
73
- * @tsplus static fncts.schema.SchemaOps never
74
- * @tsplus implicit
75
- */
76
- export const never = /*#__PURE__*/make_1(tsplus_module_3.neverKeyword);
77
- /**
78
- * @tsplus static fncts.schema.SchemaOps unknown
79
- * @tsplus implicit
80
- */
81
- const unknown_1 = /*#__PURE__*/make_1(tsplus_module_3.unknownKeyword);
82
- export const unknown = unknown_1;
83
- /**
84
- * @tsplus static fncts.schema.SchemaOps any
85
- */
86
- export const any = /*#__PURE__*/make_1(tsplus_module_3.anyKeyword);
87
- /**
88
- * @tsplus static fncts.schema.SchemaOps undefined
89
- * @tsplus implicit
90
- */
91
- const _undefined_1 = /*#__PURE__*/make_1(tsplus_module_3.undefinedKeyword);
92
- export const _undefined = _undefined_1;
93
- export { _undefined_1 as undefined };
94
- /**
95
- * @tsplus static fncts.schema.SchemaOps null
96
- * @tsplus implicit
97
- */
98
- const _null_1 = /*#__PURE__*/make_1(/*#__PURE__*/tsplus_module_3.createLiteral(null));
99
- export const _null = _null_1;
100
- export { _null_1 as null };
101
- /**
102
- * @tsplus static fncts.schema.SchemaOps void
103
- * @tsplus implicit
104
- */
105
- const _void_1 = /*#__PURE__*/make_1(tsplus_module_3.voidKeyword);
106
- export const _void = _void_1;
107
- export { _void_1 as void };
108
- /**
109
- * @tsplus static fncts.schema.SchemaOps string
110
- * @tsplus implicit
111
- */
112
- export const string = /*#__PURE__*/make_1(tsplus_module_3.stringKeyword);
113
- /**
114
- * @tsplus static fncts.schema.SchemaOps number
115
- * @tsplus implicit
116
- */
117
- export const number = /*#__PURE__*/make_1(tsplus_module_3.numberKeyword);
118
- /**
119
- * @tsplus static fncts.schema.SchemaOps boolean
120
- * @tsplus implicit
121
- */
122
- export const boolean = /*#__PURE__*/make_1(tsplus_module_3.booleanKeyword);
123
- /**
124
- * @tsplus static fncts.schema.SchemaOps bigint
125
- * @tsplus implicit
126
- */
127
- export const bigint = /*#__PURE__*/make_1(tsplus_module_3.bigIntKeyword);
128
- /**
129
- * @tsplus static fncts.schema.SchemaOps symbol
130
- * @tsplus implicit
131
- */
132
- export const symbol = /*#__PURE__*/make_1(tsplus_module_3.symbolKeyword);
133
- /**
134
- * @tsplus static fncts.schema.SchemaOps object
135
- * @tsplus implicit
136
- */
137
- const object_1 = /*#__PURE__*/make_1(tsplus_module_3.objectKeyword);
138
- export const object = object_1;
139
- /**
140
- * @tsplus static fncts.schema.SchemaOps date
141
- */
142
- const date_1 = /*#__PURE__*/instanceOf_1(Date)(object_1);
143
- export const date = date_1;
144
- /**
145
- * @tsplus implicit
146
- */
147
- export const implicitDate = /*#__PURE__*/transformOrFail_1(date_1, (input, options) => {
148
- if (typeof input === "string" || typeof input === "number") {
149
- return tsplus_module_5.succeed(new Date(input));
150
- } else {
151
- return tsplus_module_6.decode(date_1)(input, options);
152
- }
153
- }, input => tsplus_module_5.succeed(input))(unknown_1);
154
- /**
155
- * @tsplus derive fncts.schema.Schema<|> 30
156
- * @tsplus static fncts.schema.SchemaOps union
157
- */
60
+ return make_1(tsplus_module_3.createLiteral(value));
61
+ }
62
+ /**
63
+ * @tsplus static fncts.schema.SchemaOps literal
64
+ */
65
+ function literal(...literals) {
66
+ return union_1(...literals.map(makeLiteral));
67
+ }
68
+ /**
69
+ * @tsplus static fncts.schema.SchemaOps never
70
+ * @tsplus implicit
71
+ */
72
+ const never = make_1(tsplus_module_3.neverKeyword);
73
+ /**
74
+ * @tsplus static fncts.schema.SchemaOps unknown
75
+ * @tsplus implicit
76
+ */
77
+ const unknown_1 = make_1(tsplus_module_3.unknownKeyword);
78
+ const unknown = unknown_1;
79
+ /**
80
+ * @tsplus static fncts.schema.SchemaOps any
81
+ */
82
+ const any = make_1(tsplus_module_3.anyKeyword);
83
+ /**
84
+ * @tsplus static fncts.schema.SchemaOps undefined
85
+ * @tsplus implicit
86
+ */
87
+ const _undefined_1 = make_1(tsplus_module_3.undefinedKeyword);
88
+ const _undefined = _undefined_1;
89
+ /**
90
+ * @tsplus static fncts.schema.SchemaOps null
91
+ * @tsplus implicit
92
+ */
93
+ const _null_1 = make_1(tsplus_module_3.createLiteral(null));
94
+ const _null = _null_1;
95
+ /**
96
+ * @tsplus static fncts.schema.SchemaOps void
97
+ * @tsplus implicit
98
+ */
99
+ const _void_1 = make_1(tsplus_module_3.voidKeyword);
100
+ const _void = _void_1;
101
+ /**
102
+ * @tsplus static fncts.schema.SchemaOps string
103
+ * @tsplus implicit
104
+ */
105
+ const string = make_1(tsplus_module_3.stringKeyword);
106
+ /**
107
+ * @tsplus static fncts.schema.SchemaOps number
108
+ * @tsplus implicit
109
+ */
110
+ const number = make_1(tsplus_module_3.numberKeyword);
111
+ /**
112
+ * @tsplus static fncts.schema.SchemaOps boolean
113
+ * @tsplus implicit
114
+ */
115
+ const boolean = make_1(tsplus_module_3.booleanKeyword);
116
+ /**
117
+ * @tsplus static fncts.schema.SchemaOps bigint
118
+ * @tsplus implicit
119
+ */
120
+ const bigint = make_1(tsplus_module_3.bigIntKeyword);
121
+ /**
122
+ * @tsplus static fncts.schema.SchemaOps symbol
123
+ * @tsplus implicit
124
+ */
125
+ const symbol = make_1(tsplus_module_3.symbolKeyword);
126
+ /**
127
+ * @tsplus static fncts.schema.SchemaOps object
128
+ * @tsplus implicit
129
+ */
130
+ const object_1 = make_1(tsplus_module_3.objectKeyword);
131
+ const object = object_1;
132
+ /**
133
+ * @tsplus static fncts.schema.SchemaOps date
134
+ */
135
+ const date_1 = instanceOf_1(Date)(object_1);
136
+ const date = date_1;
137
+ /**
138
+ * @tsplus implicit
139
+ */
140
+ const implicitDate = transformOrFail_1(date_1, (input, options) => {
141
+ if (typeof input === "string" || typeof input === "number") return tsplus_module_5.succeed(new Date(input));
142
+ else return tsplus_module_6.decode(date_1)(input, options);
143
+ }, (input) => tsplus_module_5.succeed(input))(unknown_1);
144
+ /**
145
+ * @tsplus derive fncts.schema.Schema<|> 30
146
+ * @tsplus static fncts.schema.SchemaOps union
147
+ */
158
148
  function union_1(...members) {
159
- return make_1(tsplus_module_3.createUnion(tsplus_module_2.from(members.map(m => m.ast))));
149
+ return make_1(tsplus_module_3.createUnion(tsplus_module_2.from(members.map((m) => m.ast))));
160
150
  }
161
151
  /**
162
- * @tsplus getter fncts.schema.Schema nullable
163
- */
164
- export function nullable(self) {
165
- return union_1(_null_1, self);
152
+ * @tsplus getter fncts.schema.Schema nullable
153
+ */
154
+ function nullable(self) {
155
+ return union_1(_null_1, self);
166
156
  }
167
157
  /**
168
- * @tsplus static fncts.schema.SchemaOps uniqueSymbol
169
- */
170
- export function uniqueSymbol(symbol, annotations) {
171
- return make_1(tsplus_module_3.createUniqueSymbol(symbol, annotations));
158
+ * @tsplus static fncts.schema.SchemaOps uniqueSymbol
159
+ */
160
+ function uniqueSymbol(symbol, annotations) {
161
+ return make_1(tsplus_module_3.createUniqueSymbol(symbol, annotations));
172
162
  }
173
163
  /**
174
- * @tsplus getter fncts.schema.Schema optional
175
- */
176
- export function optional(self) {
177
- return make_1(self.ast.clone({
178
- annotations: self.ast.annotations.annotate(tsplus_module_4.Optional, true)
179
- }));
164
+ * @tsplus getter fncts.schema.Schema optional
165
+ */
166
+ function optional(self) {
167
+ return make_1(self.ast.clone({ annotations: self.ast.annotations.annotate(tsplus_module_4.Optional, true) }));
180
168
  }
181
169
  /**
182
- * @tsplus fluent fncts.schema.Schema isOptional
183
- */
170
+ * @tsplus fluent fncts.schema.Schema isOptional
171
+ */
184
172
  function isOptional_1(self) {
185
- return tsplus_module_7.getOrElse(() => false)(self.ast.annotations.get(tsplus_module_4.Optional));
173
+ return tsplus_module_7.getOrElse(() => false)(self.ast.annotations.get(tsplus_module_4.Optional));
186
174
  }
187
175
  /**
188
- * @tsplus getter fncts.schema.Schema parseOptional
189
- */
190
- export function parseOptional(self) {
191
- return make_1(self.ast.clone({
192
- annotations: self.ast.annotations.annotate(tsplus_module_4.ParseOptional, true)
193
- }));
176
+ * @tsplus getter fncts.schema.Schema parseOptional
177
+ */
178
+ function parseOptional(self) {
179
+ return make_1(self.ast.clone({ annotations: self.ast.annotations.annotate(tsplus_module_4.ParseOptional, true) }));
194
180
  }
195
181
  /**
196
- * @tsplus fluent fncts.schema.Schema isParseOptional
197
- */
182
+ * @tsplus fluent fncts.schema.Schema isParseOptional
183
+ */
198
184
  function isParseOptional_1(self) {
199
- return tsplus_module_7.getOrElse(() => false)(self.ast.annotations.get(tsplus_module_4.ParseOptional));
200
- }
201
- /**
202
- * @tsplus static fncts.schema.SchemaOps struct
203
- */
204
- export function struct(fields) {
205
- const parseOptionalKeys = tsplus_module_2.filter(key => isParseOptional_1(fields[key]))(ownKeys(fields));
206
- const struct = make_1(tsplus_module_3.createTypeLiteral(tsplus_module_2.map(key => tsplus_module_3.createPropertySignature(key, fields[key].ast, isOptional_1(fields[key]), true))(ownKeys(fields)), tsplus_module_2.empty()));
207
- if (tsplus_module_2.isEmpty(parseOptionalKeys)) {
208
- return struct;
209
- }
210
- const propertySignatures = struct.ast.propertySignatures;
211
- const from = make_1(tsplus_module_3.createTypeLiteral(tsplus_module_2.map(p => tsplus_module_2.includes(p.name)(parseOptionalKeys) ? tsplus_module_3.createPropertySignature(p.name, tsplus_module_3.createUnion(tsplus_module_2.vector(tsplus_module_3.undefinedKeyword, tsplus_module_3.createLiteral(null), p.type)), true, p.isReadonly) : p)(propertySignatures), tsplus_module_2.empty()));
212
- const to = make_1(tsplus_module_3.createTypeLiteral(tsplus_module_2.map(p => {
213
- if (tsplus_module_2.includes(p.name)(parseOptionalKeys)) {
214
- if (tsplus_module_3.isLazy(fields[p.name].ast)) {
215
- return tsplus_module_3.createPropertySignature(p.name, tsplus_module_3.createLazy(() => tsplus_module_8.maybe(fields[p.name]).ast), true, p.isReadonly);
216
- }
217
- return tsplus_module_3.createPropertySignature(p.name, tsplus_module_8.maybe(fields[p.name]).ast, true, p.isReadonly);
218
- }
219
- return p;
220
- })(propertySignatures), tsplus_module_2.empty()));
221
- return transform_1(to, input => {
222
- const output = {
223
- ...input
224
- };
225
- for (const key of parseOptionalKeys) {
226
- output[key] = tsplus_module_9.fromNullable(input[key]);
227
- }
228
- return output;
229
- }, input => {
230
- const output = {
231
- ...input
232
- };
233
- for (const key of parseOptionalKeys) {
234
- const value = input[key];
235
- if (tsplus_module_10.isNothing(value)) {
236
- delete output[key];
237
- continue;
238
- }
239
- output[key] = tsplus_module_7.toUndefined(value);
240
- }
241
- return output;
242
- })(from);
243
- }
244
- /**
245
- * @tsplus static fncts.schema.SchemaOps tuple
246
- */
247
- export function tuple(...elements) {
248
- return make_1(tsplus_module_3.createTuple(tsplus_module_2.from(elements.map(schema => tsplus_module_3.createElement(schema.ast, false))), tsplus_module_9.nothing(fileName_1 + ":333:105"), true));
249
- }
250
- /**
251
- * @tsplus static fncts.schema.SchemaOps lazy
252
- */
253
- export function lazy(f, annotations) {
254
- return make_1(tsplus_module_3.createLazy(() => f().ast, annotations));
255
- }
256
- /**
257
- * @tsplus static fncts.schema.SchemaOps array
258
- * @tsplus getter fncts.schema.Schema array
259
- */
260
- export function array(item) {
261
- return make_1(tsplus_module_3.createTuple(tsplus_module_2.empty(), tsplus_module_9.just(tsplus_module_2.vector(item.ast), fileName_1 + ":349:61"), true));
262
- }
263
- /**
264
- * @tsplus static fncts.schema.SchemaOps mutableArray
265
- * @tsplus getter fncts.schema.Schema mutableArray
266
- */
267
- export function mutableArray(item) {
268
- return make_1(tsplus_module_3.createTuple(tsplus_module_2.empty(), tsplus_module_9.just(tsplus_module_2.vector(item.ast), fileName_1 + ":357:61"), false));
269
- }
270
- /**
271
- * @tsplus static fncts.schema.SchemaOps record
272
- */
273
- export function record(key, value) {
274
- return make_1(tsplus_module_3.createRecord(key.ast, value.ast, true));
275
- }
276
- /**
277
- * @tsplus static fncts.schema.SchemaOps enum
278
- */
185
+ return tsplus_module_7.getOrElse(() => false)(self.ast.annotations.get(tsplus_module_4.ParseOptional));
186
+ }
187
+ /**
188
+ * @tsplus static fncts.schema.SchemaOps struct
189
+ */
190
+ function struct(fields) {
191
+ const parseOptionalKeys = tsplus_module_2.filter((key) => isParseOptional_1(fields[key]))(ownKeys(fields));
192
+ const struct = make_1(tsplus_module_3.createTypeLiteral(tsplus_module_2.map((key) => tsplus_module_3.createPropertySignature(key, fields[key].ast, isOptional_1(fields[key]), true))(ownKeys(fields)), tsplus_module_2.empty()));
193
+ if (tsplus_module_2.isEmpty(parseOptionalKeys)) return struct;
194
+ const propertySignatures = struct.ast.propertySignatures;
195
+ const from = make_1(tsplus_module_3.createTypeLiteral(tsplus_module_2.map((p) => tsplus_module_2.includes(p.name)(parseOptionalKeys) ? tsplus_module_3.createPropertySignature(p.name, tsplus_module_3.createUnion(tsplus_module_2.vector(tsplus_module_3.undefinedKeyword, tsplus_module_3.createLiteral(null), p.type)), true, p.isReadonly) : p)(propertySignatures), tsplus_module_2.empty()));
196
+ return transform_1(make_1(tsplus_module_3.createTypeLiteral(tsplus_module_2.map((p) => {
197
+ if (tsplus_module_2.includes(p.name)(parseOptionalKeys)) {
198
+ if (tsplus_module_3.isLazy(fields[p.name].ast)) return tsplus_module_3.createPropertySignature(p.name, tsplus_module_3.createLazy(() => tsplus_module_8.maybe(fields[p.name]).ast), true, p.isReadonly);
199
+ return tsplus_module_3.createPropertySignature(p.name, tsplus_module_8.maybe(fields[p.name]).ast, true, p.isReadonly);
200
+ }
201
+ return p;
202
+ })(propertySignatures), tsplus_module_2.empty())), (input) => {
203
+ const output = { ...input };
204
+ for (const key of parseOptionalKeys) output[key] = tsplus_module_9.fromNullable(input[key]);
205
+ return output;
206
+ }, (input) => {
207
+ const output = { ...input };
208
+ for (const key of parseOptionalKeys) {
209
+ const value = input[key];
210
+ if (tsplus_module_10.isNothing(value)) {
211
+ delete output[key];
212
+ continue;
213
+ }
214
+ output[key] = tsplus_module_7.toUndefined(value);
215
+ }
216
+ return output;
217
+ })(from);
218
+ }
219
+ /**
220
+ * @tsplus static fncts.schema.SchemaOps tuple
221
+ */
222
+ function tuple(...elements) {
223
+ return make_1(tsplus_module_3.createTuple(tsplus_module_2.from(elements.map((schema) => tsplus_module_3.createElement(schema.ast, false))), tsplus_module_9.nothing(fileName_1 + ":333:105"), true));
224
+ }
225
+ /**
226
+ * @tsplus static fncts.schema.SchemaOps lazy
227
+ */
228
+ function lazy(f, annotations) {
229
+ return make_1(tsplus_module_3.createLazy(() => f().ast, annotations));
230
+ }
231
+ /**
232
+ * @tsplus static fncts.schema.SchemaOps array
233
+ * @tsplus getter fncts.schema.Schema array
234
+ */
235
+ function array(item) {
236
+ return make_1(tsplus_module_3.createTuple(tsplus_module_2.empty(), tsplus_module_9.just(tsplus_module_2.vector(item.ast), fileName_1 + ":349:61"), true));
237
+ }
238
+ /**
239
+ * @tsplus static fncts.schema.SchemaOps mutableArray
240
+ * @tsplus getter fncts.schema.Schema mutableArray
241
+ */
242
+ function mutableArray(item) {
243
+ return make_1(tsplus_module_3.createTuple(tsplus_module_2.empty(), tsplus_module_9.just(tsplus_module_2.vector(item.ast), fileName_1 + ":357:61"), false));
244
+ }
245
+ /**
246
+ * @tsplus static fncts.schema.SchemaOps record
247
+ */
248
+ function record(key, value) {
249
+ return make_1(tsplus_module_3.createRecord(key.ast, value.ast, true));
250
+ }
251
+ /**
252
+ * @tsplus static fncts.schema.SchemaOps enum
253
+ */
279
254
  function enum_1(enums) {
280
- return make_1(tsplus_module_3.createEnum(tsplus_module_2.from(Object.keys(enums).filter(key => typeof enums[enums[key]] !== "number").map(key => [key, enums[key]]))));
255
+ return make_1(tsplus_module_3.createEnum(tsplus_module_2.from(Object.keys(enums).filter((key) => typeof enums[enums[key]] !== "number").map((key) => [key, enums[key]]))));
281
256
  }
282
- export { enum_1 as enum };
283
257
  function getTemplateLiterals(ast) {
284
- void 0;
285
- switch (ast._tag) {
286
- case 1 /* ASTTag.Literal */:
287
- return tsplus_module_2.vector(ast);
288
- case 9 /* ASTTag.NumberKeyword */:
289
- case 8 /* ASTTag.StringKeyword */:
290
- return tsplus_module_2.vector(tsplus_module_3.createTemplateLiteral("", tsplus_module_2.vector(new TemplateLiteralSpan(ast, ""))));
291
- case 18 /* ASTTag.Union */:
292
- return tsplus_module_2.flatMap(getTemplateLiterals)(ast.types);
293
- default:
294
- throw new Error(`Unsupported template literal span ${show(ast)}`);
295
- }
258
+ switch (ast._tag) {
259
+ case 1: return tsplus_module_2.vector(ast);
260
+ case 9:
261
+ case 8: return tsplus_module_2.vector(tsplus_module_3.createTemplateLiteral("", tsplus_module_2.vector(new TemplateLiteralSpan(ast, ""))));
262
+ case 18: return tsplus_module_2.flatMap(getTemplateLiterals)(ast.types);
263
+ default: throw new Error(`Unsupported template literal span ${show(ast)}`);
264
+ }
296
265
  }
297
266
  function combineTemplateLiterals(a, b) {
298
- if (tsplus_module_3.isLiteral(a)) {
299
- return tsplus_module_3.isLiteral(b) ? tsplus_module_3.createLiteral(String(a.literal) + String(b.literal)) : tsplus_module_3.createTemplateLiteral(String(a.literal) + b.head, b.spans);
300
- }
301
- if (tsplus_module_3.isLiteral(b)) {
302
- if (!tsplus_module_2.isNonEmpty(a.spans)) {
303
- throw new Error("Invalid template literal");
304
- }
305
- const last = tsplus_module_2.unsafeLast(a.spans);
306
- return tsplus_module_3.createTemplateLiteral(a.head, tsplus_module_2.append(new TemplateLiteralSpan(last.type, last.literal + String(b.literal)))(tsplus_module_2.slice(0, -1)(a.spans)));
307
- }
308
- if (!tsplus_module_2.isNonEmpty(a.spans)) {
309
- throw new Error("Invalid template literal");
310
- }
311
- const last = tsplus_module_2.unsafeLast(a.spans);
312
- return tsplus_module_3.createTemplateLiteral(a.head, tsplus_module_2.concat(b.spans)(tsplus_module_2.append(new TemplateLiteralSpan(last.type, last.literal + String(b.head)))(tsplus_module_2.slice(0, -1)(a.spans))));
313
- }
314
- /**
315
- * @tsplus static fncts.schema.SchemaOps templateLiteral
316
- */
317
- export function templateLiteral(...[head, ...tail]) {
318
- let types = getTemplateLiterals(head.ast);
319
- for (const span of tail) {
320
- types = tsplus_module_2.flatMap(a => tsplus_module_2.map(b => combineTemplateLiterals(a, b))(getTemplateLiterals(span.ast)))(types);
321
- }
322
- return make_1(tsplus_module_3.createUnion(types));
323
- }
324
- /**
325
- * @tsplus static fncts.schema.SchemaOps keyof
326
- * @tsplus getter fncts.schema.Schema keyof
327
- */
328
- export function keyof(self) {
329
- return make_1(tsplus_module_3.keyof(self.ast));
267
+ if (tsplus_module_3.isLiteral(a)) return tsplus_module_3.isLiteral(b) ? tsplus_module_3.createLiteral(String(a.literal) + String(b.literal)) : tsplus_module_3.createTemplateLiteral(String(a.literal) + b.head, b.spans);
268
+ if (tsplus_module_3.isLiteral(b)) {
269
+ if (!tsplus_module_2.isNonEmpty(a.spans)) throw new Error("Invalid template literal");
270
+ const last = tsplus_module_2.unsafeLast(a.spans);
271
+ return tsplus_module_3.createTemplateLiteral(a.head, tsplus_module_2.append(new TemplateLiteralSpan(last.type, last.literal + String(b.literal)))(tsplus_module_2.slice(0, -1)(a.spans)));
272
+ }
273
+ if (!tsplus_module_2.isNonEmpty(a.spans)) throw new Error("Invalid template literal");
274
+ const last = tsplus_module_2.unsafeLast(a.spans);
275
+ return tsplus_module_3.createTemplateLiteral(a.head, tsplus_module_2.concat(b.spans)(tsplus_module_2.append(new TemplateLiteralSpan(last.type, last.literal + String(b.head)))(tsplus_module_2.slice(0, -1)(a.spans))));
276
+ }
277
+ /**
278
+ * @tsplus static fncts.schema.SchemaOps templateLiteral
279
+ */
280
+ function templateLiteral(...[head, ...tail]) {
281
+ let types = getTemplateLiterals(head.ast);
282
+ for (const span of tail) types = tsplus_module_2.flatMap((a) => tsplus_module_2.map((b) => combineTemplateLiterals(a, b))(getTemplateLiterals(span.ast)))(types);
283
+ return make_1(tsplus_module_3.createUnion(types));
284
+ }
285
+ /**
286
+ * @tsplus static fncts.schema.SchemaOps keyof
287
+ * @tsplus getter fncts.schema.Schema keyof
288
+ */
289
+ function keyof(self) {
290
+ return make_1(tsplus_module_3.keyof(self.ast));
330
291
  }
331
292
  function isOverlappingPropertySignatures(x, y) {
332
- return tsplus_module_2.some(px => tsplus_module_2.some(py => px.name === py.name)(y.propertySignatures))(x.propertySignatures);
293
+ return tsplus_module_2.some((px) => tsplus_module_2.some((py) => px.name === py.name)(y.propertySignatures))(x.propertySignatures);
333
294
  }
334
295
  function isOverlappingIndexSignatures(x, y) {
335
- return tsplus_module_2.some(ix => tsplus_module_2.some(iy => {
336
- const bx = getParameter(ix.parameter);
337
- const by = getParameter(iy.parameter);
338
- return tsplus_module_3.isStringKeyword(bx) && tsplus_module_3.isStringKeyword(by) || tsplus_module_3.isSymbolKeyword(bx) && tsplus_module_3.isSymbolKeyword(by);
339
- })(y.indexSignatures))(x.indexSignatures);
340
- }
341
- /**
342
- * @tsplus pipeable fncts.schema.Schema extend
343
- */
344
- export function extend(that) {
345
- return self => {
346
- const selfTypes = tsplus_module_3.isUnion(self.ast) ? self.ast.types : tsplus_module_2.vector(self.ast);
347
- const thatTypes = tsplus_module_3.isUnion(that.ast) ? that.ast.types : tsplus_module_2.vector(that.ast);
348
- if (tsplus_module_2.every(tsplus_module_3.isTypeLiteral)(selfTypes) && tsplus_module_2.every(tsplus_module_3.isTypeLiteral)(thatTypes)) {
349
- return make_1(tsplus_module_3.createUnion(tsplus_module_2.flatMap(x => tsplus_module_2.map(y => {
350
- if (isOverlappingPropertySignatures(x, y)) {
351
- throw new Error("`extend` cannot handle overlapping property signatures");
352
- }
353
- if (isOverlappingIndexSignatures(x, y)) {
354
- throw new Error("`extend` cannot handle overlapping index signatures");
355
- }
356
- return tsplus_module_3.createTypeLiteral(tsplus_module_2.concat(y.propertySignatures)(x.propertySignatures), tsplus_module_2.concat(y.indexSignatures)(x.indexSignatures));
357
- })(thatTypes))(selfTypes)));
358
- }
359
- throw new Error("`extend can only handle type literals or unions of type literals`");
360
- };
361
- }
362
- /**
363
- * @tsplus pipeable fncts.schema.Schema instanceOf
364
- */
296
+ return tsplus_module_2.some((ix) => tsplus_module_2.some((iy) => {
297
+ const bx = getParameter(ix.parameter);
298
+ const by = getParameter(iy.parameter);
299
+ return tsplus_module_3.isStringKeyword(bx) && tsplus_module_3.isStringKeyword(by) || tsplus_module_3.isSymbolKeyword(bx) && tsplus_module_3.isSymbolKeyword(by);
300
+ })(y.indexSignatures))(x.indexSignatures);
301
+ }
302
+ /**
303
+ * @tsplus pipeable fncts.schema.Schema extend
304
+ */
305
+ function extend(that) {
306
+ return (self) => {
307
+ const selfTypes = tsplus_module_3.isUnion(self.ast) ? self.ast.types : tsplus_module_2.vector(self.ast);
308
+ const thatTypes = tsplus_module_3.isUnion(that.ast) ? that.ast.types : tsplus_module_2.vector(that.ast);
309
+ if (tsplus_module_2.every(tsplus_module_3.isTypeLiteral)(selfTypes) && tsplus_module_2.every(tsplus_module_3.isTypeLiteral)(thatTypes)) return make_1(tsplus_module_3.createUnion(tsplus_module_2.flatMap((x) => tsplus_module_2.map((y) => {
310
+ if (isOverlappingPropertySignatures(x, y)) throw new Error("`extend` cannot handle overlapping property signatures");
311
+ if (isOverlappingIndexSignatures(x, y)) throw new Error("`extend` cannot handle overlapping index signatures");
312
+ return tsplus_module_3.createTypeLiteral(tsplus_module_2.concat(y.propertySignatures)(x.propertySignatures), tsplus_module_2.concat(y.indexSignatures)(x.indexSignatures));
313
+ })(thatTypes))(selfTypes)));
314
+ throw new Error("`extend can only handle type literals or unions of type literals`");
315
+ };
316
+ }
317
+ /**
318
+ * @tsplus pipeable fncts.schema.Schema instanceOf
319
+ */
365
320
  function instanceOf_1(constructor) {
366
- return self => {
367
- return annotate_1(tsplus_module_4.Description, `an instance of ${constructor.name}`)(filter_1(value => value instanceof constructor)(self));
368
- };
321
+ return (self) => {
322
+ return annotate_1(tsplus_module_4.Description, `an instance of ${constructor.name}`)(filter_1((value) => value instanceof constructor)(self));
323
+ };
369
324
  }
370
325
  /**
371
- * @tsplus pipeable fncts.schema.Schema transformOrFail
372
- */
326
+ * @tsplus pipeable fncts.schema.Schema transformOrFail
327
+ */
373
328
  function transformOrFail_1(to, decode, encode) {
374
- return from => {
375
- return make_1(tsplus_module_3.createTransform(from.ast, to.ast, decode, encode));
376
- };
329
+ return (from) => {
330
+ return make_1(tsplus_module_3.createTransform(from.ast, to.ast, decode, encode));
331
+ };
377
332
  }
378
333
  /**
379
- * @tsplus pipeable fncts.schema.Schema transform
380
- */
334
+ * @tsplus pipeable fncts.schema.Schema transform
335
+ */
381
336
  function transform_1(to, decode, encode) {
382
- return from => {
383
- return transformOrFail_1(to, (input, options) => tsplus_module_5.succeed(decode(input, options)), (input, options) => tsplus_module_5.succeed(encode(input, options)))(from);
384
- };
337
+ return (from) => {
338
+ return transformOrFail_1(to, (input, options) => tsplus_module_5.succeed(decode(input, options)), (input, options) => tsplus_module_5.succeed(encode(input, options)))(from);
339
+ };
385
340
  }
386
341
  /**
387
- * @tsplus pipeable fncts.schema.Schema pick
388
- */
389
- export function pick(...keys) {
390
- return self => {
391
- return make_1(tsplus_module_3.pick(tsplus_module_2.from(keys))(self.ast));
392
- };
342
+ * @tsplus pipeable fncts.schema.Schema pick
343
+ */
344
+ function pick(...keys) {
345
+ return (self) => {
346
+ return make_1(tsplus_module_3.pick(tsplus_module_2.from(keys))(self.ast));
347
+ };
393
348
  }
394
349
  /**
395
- * @tsplus pipeable fncts.schema.Schema omit
396
- */
397
- export function omit(...keys) {
398
- return self => {
399
- return make_1(tsplus_module_3.omit(tsplus_module_2.from(keys))(self.ast));
400
- };
350
+ * @tsplus pipeable fncts.schema.Schema omit
351
+ */
352
+ function omit(...keys) {
353
+ return (self) => {
354
+ return make_1(tsplus_module_3.omit(tsplus_module_2.from(keys))(self.ast));
355
+ };
401
356
  }
357
+ //#endregion
358
+ export { _null, _undefined, _void, annotate, any, array, bigint, boolean, brand, date, declaration, enum_1 as enum, enum_, extend, filter, implicitDate, instanceOf, isOptional, isParseOptional, keyof, lazy, literal, make, mutableArray, never, _null_1 as null, nullable, number, object, omit, optional, parseOptional, pick, record, string, struct, symbol, templateLiteral, transform, transformOrFail, tuple, _undefined_1 as undefined, union, uniqueSymbol, unknown, _void_1 as void };
359
+
402
360
  //# sourceMappingURL=api.mjs.map