@fncts/schema 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/AST.d.ts +528 -0
  2. package/ASTAnnotation.d.ts +82 -0
  3. package/ASTAnnotationMap.d.ts +14 -0
  4. package/Gen.d.ts +15 -0
  5. package/InvalidInterpretationError.d.ts +5 -0
  6. package/ParseError.d.ts +107 -0
  7. package/ParseResult.d.ts +24 -0
  8. package/Parser/api.d.ts +42 -0
  9. package/Parser/definition.d.ts +22 -0
  10. package/Parser/interpreter.d.ts +6 -0
  11. package/Parser.d.ts +2 -0
  12. package/Schema/api/conc.d.ts +18 -0
  13. package/Schema/api/hashMap.d.ts +21 -0
  14. package/Schema/api/immutableArray.d.ts +23 -0
  15. package/Schema/api/list.d.ts +23 -0
  16. package/Schema/api/maybe.d.ts +21 -0
  17. package/Schema/api.d.ts +243 -0
  18. package/Schema/definition.d.ts +29 -0
  19. package/Schema/derivations.d.ts +70 -0
  20. package/Schema.d.ts +2 -144
  21. package/_cjs/AST.cjs +1171 -0
  22. package/_cjs/AST.cjs.map +1 -0
  23. package/_cjs/ASTAnnotation.cjs +111 -0
  24. package/_cjs/ASTAnnotation.cjs.map +1 -0
  25. package/_cjs/ASTAnnotationMap.cjs +35 -0
  26. package/_cjs/ASTAnnotationMap.cjs.map +1 -0
  27. package/_cjs/Gen.cjs +185 -0
  28. package/_cjs/Gen.cjs.map +1 -0
  29. package/_cjs/InvalidInterpretationError.cjs +18 -0
  30. package/_cjs/InvalidInterpretationError.cjs.map +1 -0
  31. package/_cjs/ParseError.cjs +222 -0
  32. package/_cjs/ParseError.cjs.map +1 -0
  33. package/_cjs/{Decoder.cjs → ParseResult.cjs} +24 -22
  34. package/_cjs/ParseResult.cjs.map +1 -0
  35. package/_cjs/Parser/api.cjs +80 -0
  36. package/_cjs/Parser/api.cjs.map +1 -0
  37. package/_cjs/{Guard.cjs → Parser/definition.cjs} +17 -22
  38. package/_cjs/Parser/definition.cjs.map +1 -0
  39. package/_cjs/Parser/interpreter.cjs +409 -0
  40. package/_cjs/Parser/interpreter.cjs.map +1 -0
  41. package/_cjs/Parser.cjs +28 -0
  42. package/_cjs/Parser.cjs.map +1 -0
  43. package/_cjs/Schema/api/conc.cjs +84 -0
  44. package/_cjs/Schema/api/conc.cjs.map +1 -0
  45. package/_cjs/Schema/api/hashMap.cjs +161 -0
  46. package/_cjs/Schema/api/hashMap.cjs.map +1 -0
  47. package/_cjs/Schema/api/immutableArray.cjs +90 -0
  48. package/_cjs/Schema/api/immutableArray.cjs.map +1 -0
  49. package/_cjs/Schema/api/list.cjs +98 -0
  50. package/_cjs/Schema/api/list.cjs.map +1 -0
  51. package/_cjs/Schema/api/maybe.cjs +75 -0
  52. package/_cjs/Schema/api/maybe.cjs.map +1 -0
  53. package/_cjs/Schema/api.cjs +424 -0
  54. package/_cjs/Schema/api.cjs.map +1 -0
  55. package/_cjs/Schema/definition.cjs +26 -0
  56. package/_cjs/Schema/definition.cjs.map +1 -0
  57. package/_cjs/Schema/derivations.cjs +108 -0
  58. package/_cjs/Schema/derivations.cjs.map +1 -0
  59. package/_cjs/Schema.cjs +20 -237
  60. package/_cjs/Schema.cjs.map +1 -1
  61. package/_cjs/utils.cjs +52 -0
  62. package/_cjs/utils.cjs.map +1 -0
  63. package/_mjs/AST.mjs +1060 -0
  64. package/_mjs/AST.mjs.map +1 -0
  65. package/_mjs/ASTAnnotation.mjs +80 -0
  66. package/_mjs/ASTAnnotation.mjs.map +1 -0
  67. package/_mjs/ASTAnnotationMap.mjs +27 -0
  68. package/_mjs/ASTAnnotationMap.mjs.map +1 -0
  69. package/_mjs/Gen.mjs +176 -0
  70. package/_mjs/Gen.mjs.map +1 -0
  71. package/_mjs/InvalidInterpretationError.mjs +10 -0
  72. package/_mjs/InvalidInterpretationError.mjs.map +1 -0
  73. package/_mjs/ParseError.mjs +200 -0
  74. package/_mjs/ParseError.mjs.map +1 -0
  75. package/_mjs/ParseResult.mjs +21 -0
  76. package/_mjs/ParseResult.mjs.map +1 -0
  77. package/_mjs/Parser/api.mjs +67 -0
  78. package/_mjs/Parser/api.mjs.map +1 -0
  79. package/_mjs/Parser/definition.mjs +15 -0
  80. package/_mjs/Parser/definition.mjs.map +1 -0
  81. package/_mjs/Parser/interpreter.mjs +401 -0
  82. package/_mjs/Parser/interpreter.mjs.map +1 -0
  83. package/_mjs/Parser.mjs +4 -0
  84. package/_mjs/Parser.mjs.map +1 -0
  85. package/_mjs/Schema/api/conc.mjs +72 -0
  86. package/_mjs/Schema/api/conc.mjs.map +1 -0
  87. package/_mjs/Schema/api/hashMap.mjs +150 -0
  88. package/_mjs/Schema/api/hashMap.mjs.map +1 -0
  89. package/_mjs/Schema/api/immutableArray.mjs +79 -0
  90. package/_mjs/Schema/api/immutableArray.mjs.map +1 -0
  91. package/_mjs/Schema/api/list.mjs +87 -0
  92. package/_mjs/Schema/api/list.mjs.map +1 -0
  93. package/_mjs/Schema/api/maybe.mjs +64 -0
  94. package/_mjs/Schema/api/maybe.mjs.map +1 -0
  95. package/_mjs/Schema/api.mjs +367 -0
  96. package/_mjs/Schema/api.mjs.map +1 -0
  97. package/_mjs/Schema/definition.mjs +16 -0
  98. package/_mjs/Schema/definition.mjs.map +1 -0
  99. package/_mjs/Schema/derivations.mjs +94 -0
  100. package/_mjs/Schema/derivations.mjs.map +1 -0
  101. package/_mjs/Schema.mjs +3 -212
  102. package/_mjs/Schema.mjs.map +1 -1
  103. package/_mjs/utils.mjs +41 -0
  104. package/_mjs/utils.mjs.map +1 -0
  105. package/_src/AST.ts +1353 -0
  106. package/_src/ASTAnnotation.ts +98 -0
  107. package/_src/ASTAnnotationMap.ts +38 -0
  108. package/_src/Gen.ts +171 -0
  109. package/_src/InvalidInterpretationError.ts +6 -0
  110. package/_src/ParseError.ts +237 -0
  111. package/_src/ParseResult.ts +26 -0
  112. package/_src/Parser/api.ts +71 -0
  113. package/_src/Parser/definition.ts +24 -0
  114. package/_src/Parser/interpreter.ts +442 -0
  115. package/_src/Parser.ts +4 -0
  116. package/_src/Schema/api/conc.ts +78 -0
  117. package/_src/Schema/api/hashMap.ts +184 -0
  118. package/_src/Schema/api/immutableArray.ts +88 -0
  119. package/_src/Schema/api/list.ts +96 -0
  120. package/_src/Schema/api/maybe.ts +68 -0
  121. package/_src/Schema/api.ts +530 -0
  122. package/_src/Schema/definition.ts +32 -0
  123. package/_src/Schema/derivations.ts +185 -0
  124. package/_src/Schema.ts +4 -254
  125. package/_src/global.ts +53 -0
  126. package/_src/utils.ts +48 -0
  127. package/global.d.ts +52 -0
  128. package/package.json +2 -2
  129. package/utils.d.ts +8 -0
  130. package/Decoder.d.ts +0 -3
  131. package/Encoder.d.ts +0 -4
  132. package/Guard.d.ts +0 -3
  133. package/Schemable.d.ts +0 -39
  134. package/_cjs/Decoder.cjs.map +0 -1
  135. package/_cjs/Encoder.cjs +0 -45
  136. package/_cjs/Encoder.cjs.map +0 -1
  137. package/_cjs/Guard.cjs.map +0 -1
  138. package/_cjs/Schemable.cjs +0 -6
  139. package/_cjs/Schemable.cjs.map +0 -1
  140. package/_mjs/Decoder.mjs +0 -20
  141. package/_mjs/Decoder.mjs.map +0 -1
  142. package/_mjs/Encoder.mjs +0 -36
  143. package/_mjs/Encoder.mjs.map +0 -1
  144. package/_mjs/Guard.mjs +0 -20
  145. package/_mjs/Guard.mjs.map +0 -1
  146. package/_mjs/Schemable.mjs +0 -2
  147. package/_mjs/Schemable.mjs.map +0 -1
  148. package/_src/Decoder.ts +0 -20
  149. package/_src/Encoder.ts +0 -38
  150. package/_src/Guard.ts +0 -20
  151. package/_src/Schemable.ts +0 -46
package/_mjs/AST.mjs ADDED
@@ -0,0 +1,1060 @@
1
+ var _a;
2
+ import * as tsplus_module_1 from "@fncts/schema/ASTAnnotation";
3
+ import * as tsplus_module_2 from "@fncts/base/collection/immutable/Vector/api";
4
+ import * as tsplus_module_3 from "@fncts/base/data/number/instances";
5
+ import * as tsplus_module_4 from "@fncts/base/data/Ord/api/contramap";
6
+ import * as tsplus_module_5 from "@fncts/base/data/Maybe/definition";
7
+ import * as tsplus_module_6 from "@fncts/base/data/Maybe/constructors";
8
+ import * as tsplus_module_7 from "@fncts/base/data/Maybe/destructors";
9
+ import * as tsplus_module_8 from "@fncts/base/collection/immutable/Vector/internal";
10
+ import * as tsplus_module_9 from "@fncts/base/data/Maybe/api";
11
+ export const createDeclaration = createDeclaration_1;
12
+ export const createLiteral = createLiteral_1;
13
+ export const isLiteral = isLiteral_1;
14
+ export const createUniqueSymbol = createUniqueSymbol_1;
15
+ export const isUniqueSymbol = isUniqueSymbol_1;
16
+ export const isStringKeyword = isStringKeyword_1;
17
+ export const isNumberKeyword = isNumberKeyword_1;
18
+ export const isSymbolKeyword = isSymbolKeyword_1;
19
+ export const createTemplateLiteral = createTemplateLiteral_1;
20
+ export const createElement = createElement_1;
21
+ export const createTuple = createTuple_1;
22
+ export const createPropertySignature = createPropertySignature_1;
23
+ export const createIndexSignature = createIndexSignature_1;
24
+ export const createTypeLiteral = createTypeLiteral_1;
25
+ export const createUnion = createUnion_1;
26
+ export const createLazy = createLazy_1;
27
+ export const createRefinement = createRefinement_1;
28
+ export const createTransform = createTransform_1;
29
+ export const getPropertySignatures = getPropertySignatures_1;
30
+ export const keysOf = keysOf_1;
31
+ export const partial = partial_1;
32
+ export const getFrom = getFrom_1;
33
+ export const getTo = getTo_1;
34
+ export const reverse = reverse_1;
35
+ import { show } from "@fncts/base/data/Showable";
36
+ import { memoize } from "@fncts/schema/utils";
37
+ import { ASTAnnotationMap } from "./ASTAnnotationMap.mjs";
38
+ export const ASTTypeId = /*#__PURE__*/Symbol.for("fncts.schema.AST");
39
+ export class Annotated {
40
+ constructor() {
41
+ this.annotations = ASTAnnotationMap.empty;
42
+ }
43
+ }
44
+ /**
45
+ * @tsplus type fncts.schema.AST
46
+ * @tsplus companion fncts.schema.ASTOps
47
+ */
48
+ export class AST extends Annotated {
49
+ constructor() {
50
+ super(...arguments);
51
+ this[_a] = ASTTypeId;
52
+ }
53
+ }
54
+ _a = ASTTypeId;
55
+ /**
56
+ * @tsplus static fncts.schema.ASTOps concrete
57
+ * @tsplus macro remove
58
+ */
59
+ export function concrete(_) {
60
+ //
61
+ }
62
+ export function getAnnotations(key) {
63
+ return self => {
64
+ return self.annotations.get(key);
65
+ };
66
+ }
67
+ /*
68
+ * Declaration
69
+ */
70
+ export class Declaration extends AST {
71
+ constructor(typeParameters, type, decode, annotations = ASTAnnotationMap.empty) {
72
+ super();
73
+ this.typeParameters = typeParameters;
74
+ this.type = type;
75
+ this.decode = decode;
76
+ this.annotations = annotations;
77
+ this._tag = 0 /* ASTTag.Declaration */;
78
+ }
79
+
80
+ clone(newProperties) {
81
+ return new Declaration(newProperties.typeParameters ?? this.typeParameters, newProperties.type ?? this.type, newProperties.decode ?? this.decode, newProperties.annotations ?? this.annotations);
82
+ }
83
+ }
84
+ /**
85
+ * @tsplus static fncts.schema.ASTOps createDeclaration
86
+ */
87
+ function createDeclaration_1(typeParameters, type, decode, annotations = ASTAnnotationMap.empty) {
88
+ return new Declaration(typeParameters, type, decode, annotations);
89
+ }
90
+ /**
91
+ * @tsplus fluent fncts.schema.AST isDeclaration
92
+ */
93
+ export function isDeclaration(self) {
94
+ void 0;
95
+ return self._tag === 0 /* ASTTag.Declaration */;
96
+ }
97
+
98
+ export class Literal extends AST {
99
+ constructor(literal, annotations = ASTAnnotationMap.empty) {
100
+ super();
101
+ this.literal = literal;
102
+ this.annotations = annotations;
103
+ this._tag = 1 /* ASTTag.Literal */;
104
+ }
105
+
106
+ clone(newProperties) {
107
+ return new Literal(newProperties.literal ?? this.literal, newProperties.annotations ?? this.annotations);
108
+ }
109
+ }
110
+ /**
111
+ * @tsplus static fncts.schema.ASTOps createLiteral
112
+ */
113
+ function createLiteral_1(literal, annotations = ASTAnnotationMap.empty) {
114
+ return new Literal(literal, annotations);
115
+ }
116
+ /**
117
+ * @tsplus fluent fncts.schema.AST isLiteral
118
+ */
119
+ function isLiteral_1(self) {
120
+ void 0;
121
+ return self._tag === 1 /* ASTTag.Literal */;
122
+ }
123
+ /*
124
+ * UniqueSymbol
125
+ */
126
+ export class UniqueSymbol extends AST {
127
+ constructor(symbol, annotations = ASTAnnotationMap.empty) {
128
+ super();
129
+ this.symbol = symbol;
130
+ this.annotations = annotations;
131
+ this._tag = 2 /* ASTTag.UniqueSymbol */;
132
+ }
133
+
134
+ clone(newProperties) {
135
+ return new UniqueSymbol(newProperties.symbol ?? this.symbol, newProperties.annotations ?? this.annotations);
136
+ }
137
+ }
138
+ /**
139
+ * @tsplus static fncts.schema.ASTOps createUniqueSymbol
140
+ */
141
+ function createUniqueSymbol_1(symbol, annotations = ASTAnnotationMap.empty) {
142
+ return new UniqueSymbol(symbol, annotations);
143
+ }
144
+ /**
145
+ * @tsplus fluent fncts.schema.AST isUniqueSymbol
146
+ */
147
+ function isUniqueSymbol_1(self) {
148
+ void 0;
149
+ return self._tag === 2 /* ASTTag.UniqueSymbol */;
150
+ }
151
+ /*
152
+ * UndefinedKeyword
153
+ */
154
+ export class UndefinedKeyword extends AST {
155
+ constructor(annotations = ASTAnnotationMap.empty) {
156
+ super();
157
+ this.annotations = annotations;
158
+ this._tag = 3 /* ASTTag.UndefinedKeyword */;
159
+ }
160
+
161
+ clone(newProperties) {
162
+ return new UndefinedKeyword(newProperties.annotations ?? this.annotations);
163
+ }
164
+ }
165
+ /**
166
+ * @tsplus static fncts.schema.ASTOps undefinedKeyword
167
+ */
168
+ const undefinedKeyword_1 = /*#__PURE__*/new UndefinedKeyword( /*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_1.Title, "undefined"));
169
+ export const undefinedKeyword = undefinedKeyword_1;
170
+ /*
171
+ * VoidKeyword
172
+ */
173
+ export class VoidKeyword extends AST {
174
+ constructor(annotations = ASTAnnotationMap.empty) {
175
+ super();
176
+ this.annotations = annotations;
177
+ this._tag = 4 /* ASTTag.VoidKeyword */;
178
+ }
179
+
180
+ clone(newProperties) {
181
+ return new VoidKeyword(newProperties.annotations ?? this.annotations);
182
+ }
183
+ }
184
+ /**
185
+ * @tsplus static fncts.schema.ASTOps voidKeyword
186
+ */
187
+ export const voidKeyword = /*#__PURE__*/new VoidKeyword( /*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_1.Title, "void"));
188
+ /*
189
+ * NeverKeyword
190
+ */
191
+ export class NeverKeyword extends AST {
192
+ constructor(annotations = ASTAnnotationMap.empty) {
193
+ super();
194
+ this.annotations = annotations;
195
+ this._tag = 5 /* ASTTag.NeverKeyword */;
196
+ }
197
+
198
+ clone(newProperties) {
199
+ return new NeverKeyword(newProperties.annotations ?? this.annotations);
200
+ }
201
+ }
202
+ /**
203
+ * @tsplus static fncts.schema.ASTOps neverKeyword
204
+ */
205
+ const neverKeyword_1 = /*#__PURE__*/new NeverKeyword( /*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_1.Title, "never"));
206
+ export const neverKeyword = neverKeyword_1;
207
+ /*
208
+ * UnknownKeyword
209
+ */
210
+ export class UnknownKeyword extends AST {
211
+ constructor(annotations = ASTAnnotationMap.empty) {
212
+ super();
213
+ this.annotations = annotations;
214
+ this._tag = 6 /* ASTTag.UnknownKeyword */;
215
+ }
216
+
217
+ clone(newProperties) {
218
+ return new UnknownKeyword(newProperties.annotations ?? this.annotations);
219
+ }
220
+ }
221
+ /**
222
+ * @tsplus static fncts.schema.ASTOps unknownKeyword
223
+ */
224
+ export const unknownKeyword = /*#__PURE__*/new UnknownKeyword( /*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_1.Title, "unknown"));
225
+ /*
226
+ * AnyKeyword
227
+ */
228
+ export class AnyKeyword extends AST {
229
+ constructor(annotations = ASTAnnotationMap.empty) {
230
+ super();
231
+ this.annotations = annotations;
232
+ this._tag = 7 /* ASTTag.AnyKeyword */;
233
+ }
234
+
235
+ clone(newProperties) {
236
+ return new AnyKeyword(newProperties.annotations ?? this.annotations);
237
+ }
238
+ }
239
+ /**
240
+ * @tsplus static fncts.schema.ASTOps anyKeyword
241
+ */
242
+ export const anyKeyword = /*#__PURE__*/new AnyKeyword( /*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_1.Title, "any"));
243
+ /*
244
+ * StringKeyword
245
+ */
246
+ export class StringKeyword extends AST {
247
+ constructor(annotations = ASTAnnotationMap.empty) {
248
+ super();
249
+ this.annotations = annotations;
250
+ this._tag = 8 /* ASTTag.StringKeyword */;
251
+ }
252
+
253
+ clone(newProperties) {
254
+ return new StringKeyword(newProperties.annotations ?? this.annotations);
255
+ }
256
+ }
257
+ /**
258
+ * @tsplus static fncts.schema.ASTOps stringKeyword
259
+ */
260
+ const stringKeyword_1 = /*#__PURE__*/new StringKeyword( /*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_1.Title, "string"));
261
+ export const stringKeyword = stringKeyword_1;
262
+ /**
263
+ * @tsplus fluent fncts.schema.AST isStringKeyword
264
+ */
265
+ function isStringKeyword_1(self) {
266
+ void 0;
267
+ return self._tag === 8 /* ASTTag.StringKeyword */;
268
+ }
269
+ /*
270
+ * NumberKeyword
271
+ */
272
+ export class NumberKeyword extends AST {
273
+ constructor(annotations = ASTAnnotationMap.empty) {
274
+ super();
275
+ this.annotations = annotations;
276
+ this._tag = 9 /* ASTTag.NumberKeyword */;
277
+ }
278
+
279
+ clone(newProperties) {
280
+ return new NumberKeyword(newProperties.annotations ?? this.annotations);
281
+ }
282
+ }
283
+ /**
284
+ * @tsplus static fncts.schema.ASTOps numberKeyword
285
+ */
286
+ const numberKeyword_1 = /*#__PURE__*/new NumberKeyword( /*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_1.Title, "number"));
287
+ export const numberKeyword = numberKeyword_1;
288
+ /**
289
+ * @tsplus fluent fncts.schema.AST isNumberKeyword
290
+ */
291
+ function isNumberKeyword_1(self) {
292
+ void 0;
293
+ return self._tag === 9 /* ASTTag.NumberKeyword */;
294
+ }
295
+ /*
296
+ * BooleanKeyword
297
+ */
298
+ export class BooleanKeyword extends AST {
299
+ constructor(annotations = ASTAnnotationMap.empty) {
300
+ super();
301
+ this.annotations = annotations;
302
+ this._tag = 10 /* ASTTag.BooleanKeyword */;
303
+ }
304
+
305
+ clone(newProperties) {
306
+ return new BooleanKeyword(newProperties.annotations ?? this.annotations);
307
+ }
308
+ }
309
+ /**
310
+ * @tsplus static fncts.schema.ASTOps booleanKeyword
311
+ */
312
+ export const booleanKeyword = /*#__PURE__*/new BooleanKeyword( /*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_1.Title, "boolean"));
313
+ /**
314
+ * @tsplus fluent fncts.schema.AST isBooleanKeyword
315
+ */
316
+ export function isBooleanKeyword(self) {
317
+ void 0;
318
+ return self._tag === 10 /* ASTTag.BooleanKeyword */;
319
+ }
320
+ /*
321
+ * BigIntKeyword
322
+ */
323
+ export class BigIntKeyword extends AST {
324
+ constructor(annotations = ASTAnnotationMap.empty) {
325
+ super();
326
+ this.annotations = annotations;
327
+ this._tag = 11 /* ASTTag.BigIntKeyword */;
328
+ }
329
+
330
+ clone(newProperties) {
331
+ return new BigIntKeyword(newProperties.annotations ?? this.annotations);
332
+ }
333
+ }
334
+ /**
335
+ * @tsplus static fncts.schema.ASTOps bigIntKeyword
336
+ */
337
+ export const bigIntKeyword = /*#__PURE__*/new BigIntKeyword( /*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_1.Title, "bigint"));
338
+ /**
339
+ * @tsplus fluent fncts.schema.AST isBigIntKeyword
340
+ */
341
+ export function isBigIntKeyword(self) {
342
+ void 0;
343
+ return self._tag === 11 /* ASTTag.BigIntKeyword */;
344
+ }
345
+ /*
346
+ * SymbolKeyword
347
+ */
348
+ export class SymbolKeyword extends AST {
349
+ constructor(annotations = ASTAnnotationMap.empty) {
350
+ super();
351
+ this.annotations = annotations;
352
+ this._tag = 12 /* ASTTag.SymbolKeyword */;
353
+ }
354
+
355
+ clone(newProperties) {
356
+ return new SymbolKeyword(newProperties.annotations ?? this.annotations);
357
+ }
358
+ }
359
+ /**
360
+ * @tsplus static fncts.schema.ASTOps symbolKeyword
361
+ */
362
+ const symbolKeyword_1 = /*#__PURE__*/new SymbolKeyword( /*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_1.Title, "symbol"));
363
+ export const symbolKeyword = symbolKeyword_1;
364
+ /**
365
+ * @tsplus fluent fncts.schema.AST isSymbolKeyword
366
+ */
367
+ function isSymbolKeyword_1(self) {
368
+ void 0;
369
+ return self._tag === 12 /* ASTTag.SymbolKeyword */;
370
+ }
371
+ /*
372
+ * ObjectKeyword
373
+ */
374
+ export class ObjectKeyword extends AST {
375
+ constructor(annotations = ASTAnnotationMap.empty) {
376
+ super();
377
+ this.annotations = annotations;
378
+ this._tag = 13 /* ASTTag.ObjectKeyword */;
379
+ }
380
+
381
+ clone(newProperties) {
382
+ return new ObjectKeyword(newProperties.annotations ?? this.annotations);
383
+ }
384
+ }
385
+ /**
386
+ * @tsplus static fncts.schema.ASTOps objectKeyword
387
+ */
388
+ export const objectKeyword = /*#__PURE__*/new ObjectKeyword( /*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_1.Title, "object"));
389
+ /*
390
+ * Enum
391
+ */
392
+ export class Enum extends AST {
393
+ constructor(enums, annotations = ASTAnnotationMap.empty) {
394
+ super();
395
+ this.enums = enums;
396
+ this.annotations = annotations;
397
+ this._tag = 14 /* ASTTag.Enum */;
398
+ }
399
+
400
+ clone(newProperties) {
401
+ return new Enum(newProperties.enums ?? this.enums, newProperties.annotations ?? this.annotations);
402
+ }
403
+ }
404
+ /**
405
+ * @tsplus static fncts.schema.ASTOps createEnum
406
+ */
407
+ export function createEnum(enums, annotations = ASTAnnotationMap.empty) {
408
+ return new Enum(enums, annotations);
409
+ }
410
+ export class TemplateLiteralSpan {
411
+ constructor(type, literal) {
412
+ this.type = type;
413
+ this.literal = literal;
414
+ }
415
+ }
416
+ /*
417
+ * TemplateLiteral
418
+ */
419
+ export class TemplateLiteral extends AST {
420
+ constructor(head, spans, annotations = ASTAnnotationMap.empty) {
421
+ super();
422
+ this.head = head;
423
+ this.spans = spans;
424
+ this.annotations = annotations;
425
+ this._tag = 15 /* ASTTag.TemplateLiteral */;
426
+ }
427
+
428
+ clone(newProperties) {
429
+ return createTemplateLiteral_1(newProperties.head ?? this.head, newProperties.spans ?? this.spans, newProperties.annotations ?? this.annotations);
430
+ }
431
+ }
432
+ /**
433
+ * @tsplus static fncts.schema.ASTOps createTemplateLiteral
434
+ */
435
+ function createTemplateLiteral_1(head, spans, annotations = ASTAnnotationMap.empty) {
436
+ if (tsplus_module_2.isNonEmpty(spans)) {
437
+ return new TemplateLiteral(head, spans, annotations);
438
+ } else {
439
+ return createLiteral_1(head, annotations);
440
+ }
441
+ }
442
+ /*
443
+ * Element
444
+ */
445
+ export class Element {
446
+ constructor(type, isOptional) {
447
+ this.type = type;
448
+ this.isOptional = isOptional;
449
+ }
450
+ }
451
+ /**
452
+ * @tsplus static fncts.schema.ASTOps createElement
453
+ */
454
+ function createElement_1(type, isOptional) {
455
+ return new Element(type, isOptional);
456
+ }
457
+ /*
458
+ * Tuple
459
+ */
460
+ export class Tuple extends AST {
461
+ constructor(elements, rest, isReadonly, annotations = ASTAnnotationMap.empty) {
462
+ super();
463
+ this.elements = elements;
464
+ this.rest = rest;
465
+ this.isReadonly = isReadonly;
466
+ this.annotations = annotations;
467
+ this._tag = 16 /* ASTTag.Tuple */;
468
+ }
469
+
470
+ clone(newProperties) {
471
+ return new Tuple(newProperties.elements ?? this.elements, newProperties.rest ?? this.rest, newProperties.isReadonly ?? this.isReadonly, newProperties.annotations ?? this.annotations);
472
+ }
473
+ }
474
+ /**
475
+ * @tsplus static fncts.schema.ASTOps createTuple
476
+ */
477
+ function createTuple_1(elements, rest, isReadonly, annotations = ASTAnnotationMap.empty) {
478
+ return new Tuple(elements, rest, isReadonly, annotations);
479
+ }
480
+ /*
481
+ * PropertySignature
482
+ */
483
+ export class PropertySignature extends AST {
484
+ constructor(name, type, isOptional, isReadonly, annotations = ASTAnnotationMap.empty) {
485
+ super();
486
+ this.name = name;
487
+ this.type = type;
488
+ this.isOptional = isOptional;
489
+ this.isReadonly = isReadonly;
490
+ this.annotations = annotations;
491
+ }
492
+ clone(newProperties) {
493
+ return new PropertySignature(newProperties.name ?? this.name, newProperties.type ?? this.type, newProperties.isOptional ?? this.isOptional, newProperties.isReadonly ?? this.isReadonly, newProperties.annotations ?? this.annotations);
494
+ }
495
+ }
496
+ /**
497
+ * @tsplus static fncts.schema.ASTOps createPropertySignature
498
+ */
499
+ function createPropertySignature_1(name, type, isOptional, isReadonly, annotations = ASTAnnotationMap.empty) {
500
+ return new PropertySignature(name, type, isOptional, isReadonly, annotations);
501
+ }
502
+ /*
503
+ * IndexSignature
504
+ */
505
+ export class IndexSignature {
506
+ constructor(parameter, type, isReadonly) {
507
+ this.parameter = parameter;
508
+ this.type = type;
509
+ this.isReadonly = isReadonly;
510
+ }
511
+ }
512
+ /**
513
+ * @tsplus static fncts.schema.ASTOps createIndexSignature
514
+ */
515
+ function createIndexSignature_1(parameter, type, isReadonly) {
516
+ return new IndexSignature(parameter, type, isReadonly);
517
+ }
518
+ /*
519
+ * TypeLiteral
520
+ */
521
+ export class TypeLiteral extends AST {
522
+ constructor(propertySignatures, indexSignatures, annotations = ASTAnnotationMap.empty) {
523
+ super();
524
+ this.annotations = annotations;
525
+ this._tag = 17 /* ASTTag.TypeLiteral */;
526
+ this.propertySignatures = sortByAscendingCardinality(propertySignatures);
527
+ this.indexSignatures = sortByAscendingCardinality(indexSignatures);
528
+ }
529
+ clone(newProperties) {
530
+ return new TypeLiteral(newProperties.propertySignatures ?? this.propertySignatures, newProperties.indexSignatures ?? this.indexSignatures, newProperties.annotations ?? this.annotations);
531
+ }
532
+ }
533
+ /**
534
+ * @tsplus static fncts.schema.ASTOps isTypeLiteral
535
+ * @tsplus fluent fncts.schema.AST isTypeLiteral
536
+ */
537
+ export function isTypeLiteral(self) {
538
+ void 0;
539
+ return self._tag === 17 /* ASTTag.TypeLiteral */;
540
+ }
541
+ /**
542
+ * @tsplus static fncts.schema.ASTOps createTypeLiteral
543
+ */
544
+ function createTypeLiteral_1(propertySignatures, indexSignatures, annotations) {
545
+ return new TypeLiteral(propertySignatures, indexSignatures, annotations);
546
+ }
547
+ /*
548
+ * Union
549
+ */
550
+ export class Union extends AST {
551
+ constructor(types, annotations = ASTAnnotationMap.empty) {
552
+ super();
553
+ this.types = types;
554
+ this.annotations = annotations;
555
+ this._tag = 18 /* ASTTag.Union */;
556
+ }
557
+
558
+ clone(newProperties) {
559
+ return createUnion_1(newProperties.types ?? this.types, newProperties.annotations ?? this.annotations);
560
+ }
561
+ }
562
+ /**
563
+ * @tsplus fluent fncts.schema.AST isUnion
564
+ */
565
+ export function isUnion(self) {
566
+ void 0;
567
+ return self._tag === 18 /* ASTTag.Union */;
568
+ }
569
+ /**
570
+ * @tsplus static fncts.schema.ASTOps createUnion
571
+ */
572
+ function createUnion_1(candidates, annotations = ASTAnnotationMap.empty) {
573
+ const types = unify(candidates);
574
+ switch (types.length) {
575
+ case 0:
576
+ return neverKeyword_1;
577
+ case 1:
578
+ return tsplus_module_2.unsafeGet(0)(types);
579
+ default:
580
+ return new Union(sortByDescendingWeight(types), annotations);
581
+ }
582
+ }
583
+ /*
584
+ * Lazy
585
+ */
586
+ export class Lazy extends AST {
587
+ constructor(getAST, annotations = ASTAnnotationMap.empty) {
588
+ super();
589
+ this.getAST = getAST;
590
+ this.annotations = annotations;
591
+ this._tag = 19 /* ASTTag.Lazy */;
592
+ }
593
+
594
+ clone(newProperties) {
595
+ return new Lazy(newProperties.getAST ?? this.getAST, newProperties.annotations ?? this.annotations);
596
+ }
597
+ }
598
+ /**
599
+ * @tsplus static fncts.schema.ASTOps createLazy
600
+ */
601
+ function createLazy_1(getAST, annotations) {
602
+ return new Lazy(getAST, annotations);
603
+ }
604
+ /**
605
+ * @tsplus fluent fncts.schema.AST isLazy
606
+ */
607
+ export function isLazy(self) {
608
+ void 0;
609
+ return self._tag === 19 /* ASTTag.Lazy */;
610
+ }
611
+ /*
612
+ * Refinement
613
+ */
614
+ export class Refinement extends AST {
615
+ constructor(from, decode, isReversed, annotations = ASTAnnotationMap.empty) {
616
+ super();
617
+ this.from = from;
618
+ this.decode = decode;
619
+ this.isReversed = isReversed;
620
+ this.annotations = annotations;
621
+ this._tag = 20 /* ASTTag.Refinement */;
622
+ }
623
+
624
+ clone(newProperties) {
625
+ return new Refinement(newProperties.from ?? this.from, newProperties.decode ?? this.decode, newProperties.isReversed ?? this.isReversed, newProperties.annotations ?? this.annotations);
626
+ }
627
+ }
628
+ /**
629
+ * @tsplus static fncts.schema.ASTOps createRefinement
630
+ */
631
+ function createRefinement_1(from, decode, isReversed, annotations) {
632
+ return new Refinement(from, decode, isReversed, annotations);
633
+ }
634
+ export function isRefinement(self) {
635
+ void 0;
636
+ return self._tag === 20 /* ASTTag.Refinement */;
637
+ }
638
+ /*
639
+ * Transform
640
+ */
641
+ export class Transform extends AST {
642
+ constructor(from, to, decode, encode, isReversed, annotations = ASTAnnotationMap.empty) {
643
+ super();
644
+ this.from = from;
645
+ this.to = to;
646
+ this.decode = decode;
647
+ this.encode = encode;
648
+ this.isReversed = isReversed;
649
+ this.annotations = annotations;
650
+ this._tag = 21 /* ASTTag.Transform */;
651
+ }
652
+
653
+ clone(newProperties) {
654
+ 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);
655
+ }
656
+ }
657
+ /**
658
+ * @tsplus static fncts.schema.ASTOps createTransform
659
+ */
660
+ function createTransform_1(from, to, decode, encode, isReversed, annotations) {
661
+ return new Transform(from, getTo_1(to), decode, encode, isReversed, annotations);
662
+ }
663
+ /*
664
+ * Validation
665
+ */
666
+ export class Validation extends AST {
667
+ constructor(from, validation, annotations = ASTAnnotationMap.empty) {
668
+ super();
669
+ this.from = from;
670
+ this.validation = validation;
671
+ this.annotations = annotations;
672
+ this._tag = 22 /* ASTTag.Validation */;
673
+ }
674
+
675
+ clone(newProperties) {
676
+ return new Validation(newProperties.from ?? this.from, newProperties.validation ?? this.validation, newProperties.annotations ?? this.annotations);
677
+ }
678
+ }
679
+ /**
680
+ * @tsplus static fncts.schema.ASTOps createValidation
681
+ */
682
+ export function createValidation(from, validation, annotations) {
683
+ return new Validation(from, validation, annotations);
684
+ }
685
+ /**
686
+ * @tsplus tailRec
687
+ */
688
+ export function getCardinality(ast) {
689
+ var ast_1 = ast;
690
+ var ast_2 = ast;
691
+ while (1) {
692
+ void 0;
693
+ switch (ast_1._tag) {
694
+ case 0 /* ASTTag.Declaration */:
695
+ ast_2 = ast_1.type;
696
+ ast_1 = ast_2;
697
+ continue;
698
+ case 5 /* ASTTag.NeverKeyword */:
699
+ return 0;
700
+ case 1 /* ASTTag.Literal */:
701
+ case 3 /* ASTTag.UndefinedKeyword */:
702
+ case 4 /* ASTTag.VoidKeyword */:
703
+ case 2 /* ASTTag.UniqueSymbol */:
704
+ return 1;
705
+ case 10 /* ASTTag.BooleanKeyword */:
706
+ return 2;
707
+ case 8 /* ASTTag.StringKeyword */:
708
+ case 9 /* ASTTag.NumberKeyword */:
709
+ case 11 /* ASTTag.BigIntKeyword */:
710
+ case 12 /* ASTTag.SymbolKeyword */:
711
+ return 3;
712
+ case 13 /* ASTTag.ObjectKeyword */:
713
+ return 4;
714
+ case 6 /* ASTTag.UnknownKeyword */:
715
+ case 7 /* ASTTag.AnyKeyword */:
716
+ return 6;
717
+ case 20 /* ASTTag.Refinement */:
718
+ ast_2 = ast_1.from;
719
+ ast_1 = ast_2;
720
+ continue;
721
+ case 21 /* ASTTag.Transform */:
722
+ ast_2 = ast_1.to;
723
+ ast_1 = ast_2;
724
+ continue;
725
+ default:
726
+ return 5;
727
+ }
728
+ }
729
+ }
730
+ function sortByAscendingCardinality(types) {
731
+ return tsplus_module_2.sort(tsplus_module_4.contramap(({
732
+ type
733
+ }) => getCardinality(type))(tsplus_module_3.Ord))(types);
734
+ }
735
+ export function getWeight(ast) {
736
+ void 0;
737
+ switch (ast._tag) {
738
+ case 0 /* ASTTag.Declaration */:
739
+ return getWeight(ast.type);
740
+ case 16 /* ASTTag.Tuple */:
741
+ return ast.elements.length + (tsplus_module_5.isJust(ast.rest) ? ast.rest.value.length : 0);
742
+ case 17 /* ASTTag.TypeLiteral */:
743
+ return ast.propertySignatures.length + ast.indexSignatures.length;
744
+ case 18 /* ASTTag.Union */:
745
+ return tsplus_module_2.foldLeft(0, (n, member) => n + getWeight(member))(ast.types);
746
+ case 19 /* ASTTag.Lazy */:
747
+ return 10;
748
+ case 20 /* ASTTag.Refinement */:
749
+ return getWeight(ast.from);
750
+ case 21 /* ASTTag.Transform */:
751
+ return getWeight(ast.to);
752
+ default:
753
+ return 0;
754
+ }
755
+ }
756
+ function sortByDescendingWeight(types) {
757
+ return tsplus_module_2.sort(tsplus_module_4.contramap(getWeight)(tsplus_module_3.Ord))(types);
758
+ }
759
+ function unify(candidates) {
760
+ let out = tsplus_module_2.flatMap(ast => {
761
+ void 0;
762
+ switch (ast._tag) {
763
+ case 5 /* ASTTag.NeverKeyword */:
764
+ return tsplus_module_2.empty();
765
+ case 18 /* ASTTag.Union */:
766
+ return ast.types;
767
+ default:
768
+ return tsplus_module_2.vector(ast);
769
+ }
770
+ })(candidates);
771
+ if (tsplus_module_2.some(isStringKeyword_1)(out)) {
772
+ out = tsplus_module_2.filter(m => !(isLiteral_1(m) && typeof m.literal === "string"))(out);
773
+ }
774
+ if (tsplus_module_2.some(isNumberKeyword_1)(out)) {
775
+ out = tsplus_module_2.filter(m => !(isLiteral_1(m) && typeof m.literal === "number"))(out);
776
+ }
777
+ if (tsplus_module_2.some(isSymbolKeyword_1)(out)) {
778
+ out = tsplus_module_2.filter(m => !isUniqueSymbol_1(m))(out);
779
+ }
780
+ return out;
781
+ }
782
+ /**
783
+ * @tsplus pipeable fncts.schema.AST combineAnnotations
784
+ */
785
+ export function combineAnnotations(annotations) {
786
+ return self => {
787
+ return self.clone({
788
+ annotations: self.annotations.combine(annotations)
789
+ });
790
+ };
791
+ }
792
+ /**
793
+ * @tsplus pipeable fncts.schema.AST setAnnotation
794
+ */
795
+ export function setAnnotation(annotation, value) {
796
+ return self => {
797
+ return self.clone({
798
+ annotations: self.annotations.annotate(annotation, value)
799
+ });
800
+ };
801
+ }
802
+ /**
803
+ * @tsplus pipeable fncts.schema.AST appendRestElement
804
+ */
805
+ export function appendRestElement(restElement) {
806
+ return self => {
807
+ if (tsplus_module_5.isJust(self.rest)) {
808
+ throw new Error("A rest element cannot follow another rest element. ts(1265)");
809
+ }
810
+ return createTuple_1(self.elements, tsplus_module_6.just(tsplus_module_2.vector(restElement)), self.isReadonly, self.annotations);
811
+ };
812
+ }
813
+ /**
814
+ * @tsplus pipeable fncts.schema.AST appendElement
815
+ */
816
+ export function appendElement(element) {
817
+ return self => {
818
+ if (tsplus_module_2.some(e => e.isOptional)(self.elements) && !element.isOptional) {
819
+ throw new Error("A required element cannot follow an optional element. ts(1257)");
820
+ }
821
+ return tsplus_module_7.match(() => createTuple_1(tsplus_module_2.append(element)(self.elements), tsplus_module_6.nothing(), self.isReadonly, self.annotations), rest => {
822
+ if (element.isOptional) {
823
+ throw new Error("A required element cannot follow an optional element. ts(1257)");
824
+ }
825
+ return createTuple_1(self.elements, tsplus_module_6.just(tsplus_module_2.append(element.type)(rest)), self.isReadonly, self.annotations);
826
+ })(self.rest);
827
+ };
828
+ }
829
+ export function getParameter(x) {
830
+ return isRefinement(x) ? getParameter(x.from) : x;
831
+ }
832
+ /**
833
+ * @tsplus getter fncts.schema.AST getPropertySignatures
834
+ */
835
+ function getPropertySignatures_1(self) {
836
+ void 0;
837
+ switch (self._tag) {
838
+ case 0 /* ASTTag.Declaration */:
839
+ return getPropertySignatures_1(self.type);
840
+ case 16 /* ASTTag.Tuple */:
841
+ return tsplus_module_2.mapWithIndex((i, element) => createPropertySignature_1(i, element.type, element.isOptional, self.isReadonly))(self.elements);
842
+ case 18 /* ASTTag.Union */:
843
+ {
844
+ const propertySignatures = tsplus_module_2.map(getPropertySignatures_1)(self.types);
845
+ return tsplus_module_2.filterMap(({
846
+ name
847
+ }) => {
848
+ if (tsplus_module_2.every(ps => tsplus_module_2.some(p => p.name === name)(ps))(propertySignatures)) {
849
+ const members = tsplus_module_2.flatMap(ps => tsplus_module_2.filter(p => p.name === name)(ps))(propertySignatures);
850
+ 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)));
851
+ }
852
+ return tsplus_module_6.nothing();
853
+ })(tsplus_module_2.unsafeGet(0)(propertySignatures));
854
+ }
855
+ case 19 /* ASTTag.Lazy */:
856
+ return getPropertySignatures_1(self.getAST());
857
+ case 20 /* ASTTag.Refinement */:
858
+ return getPropertySignatures_1(self.from);
859
+ case 21 /* ASTTag.Transform */:
860
+ return getPropertySignatures_1(self.to);
861
+ default:
862
+ return tsplus_module_2.empty();
863
+ }
864
+ }
865
+ /**
866
+ * @tsplus getter fncts.schema.AST keysof
867
+ */
868
+ function keysOf_1(ast) {
869
+ void 0;
870
+ switch (ast._tag) {
871
+ case 0 /* ASTTag.Declaration */:
872
+ return keysOf_1(ast.type);
873
+ case 5 /* ASTTag.NeverKeyword */:
874
+ case 7 /* ASTTag.AnyKeyword */:
875
+ return tsplus_module_2.vector(stringKeyword_1, numberKeyword_1, symbolKeyword_1);
876
+ case 8 /* ASTTag.StringKeyword */:
877
+ return tsplus_module_2.vector(createLiteral_1("length"));
878
+ case 17 /* ASTTag.TypeLiteral */:
879
+ return tsplus_module_2.concat(tsplus_module_2.map(is => getParameter(is.parameter))(ast.indexSignatures))(tsplus_module_2.map(p => typeof p.name === "symbol" ? createUniqueSymbol_1(p.name) : createLiteral_1(p.name))(ast.propertySignatures));
880
+ case 18 /* ASTTag.Union */:
881
+ return tsplus_module_2.map(p => typeof p.name === "symbol" ? createUniqueSymbol_1(p.name) : createLiteral_1(p.name))(getPropertySignatures_1(ast));
882
+ case 19 /* ASTTag.Lazy */:
883
+ return keysOf_1(ast.getAST());
884
+ case 20 /* ASTTag.Refinement */:
885
+ return keysOf_1(ast.from);
886
+ case 21 /* ASTTag.Transform */:
887
+ return keysOf_1(ast.to);
888
+ default:
889
+ return tsplus_module_2.empty();
890
+ }
891
+ }
892
+ /**
893
+ * @tsplus getter fncts.schema.AST keyof
894
+ */
895
+ export function keyof(self) {
896
+ return createUnion_1(keysOf_1(self));
897
+ }
898
+ /**
899
+ * @tsplus static fncts.schema.ASTOps createRecord
900
+ */
901
+ export function createRecord(key, value, isReadonly) {
902
+ const propertySignatures = tsplus_module_2.emptyPushable();
903
+ const indexSignatures = tsplus_module_2.emptyPushable();
904
+ function go(key) {
905
+ void 0;
906
+ switch (key._tag) {
907
+ case 0 /* ASTTag.Declaration */:
908
+ go(key.type);
909
+ break;
910
+ case 5 /* ASTTag.NeverKeyword */:
911
+ break;
912
+ case 8 /* ASTTag.StringKeyword */:
913
+ case 12 /* ASTTag.SymbolKeyword */:
914
+ case 15 /* ASTTag.TemplateLiteral */:
915
+ case 20 /* ASTTag.Refinement */:
916
+ tsplus_module_8.push(createIndexSignature_1(key, value, isReadonly))(indexSignatures);
917
+ break;
918
+ case 1 /* ASTTag.Literal */:
919
+ if (typeof key.literal === "string" || typeof key.literal === "number") {
920
+ tsplus_module_8.push(createPropertySignature_1(key.literal, value, false, isReadonly))(propertySignatures);
921
+ }
922
+ break;
923
+ case 2 /* ASTTag.UniqueSymbol */:
924
+ tsplus_module_8.push(createPropertySignature_1(key.symbol, value, false, isReadonly))(propertySignatures);
925
+ break;
926
+ case 18 /* ASTTag.Union */:
927
+ tsplus_module_2.forEach(go)(key.types);
928
+ break;
929
+ default:
930
+ throw new Error(`createRecord: Unsupported key\n${show(key)}`);
931
+ }
932
+ }
933
+ go(key);
934
+ return createTypeLiteral_1(propertySignatures, indexSignatures);
935
+ }
936
+ /**
937
+ * @tsplus pipeable fncts.schema.AST pick
938
+ */
939
+ export function pick(keys) {
940
+ return self => {
941
+ return createTypeLiteral_1(tsplus_module_2.filter(ps => tsplus_module_2.includes(ps.name)(keys))(getPropertySignatures_1(self)), tsplus_module_2.empty());
942
+ };
943
+ }
944
+ /**
945
+ * @tsplus pipeable fncts.schema.AST omit
946
+ */
947
+ export function omit(keys) {
948
+ return self => {
949
+ return createTypeLiteral_1(tsplus_module_2.filter(ps => !tsplus_module_2.includes(ps.name)(keys))(getPropertySignatures_1(self)), tsplus_module_2.empty());
950
+ };
951
+ }
952
+ /**
953
+ * @tsplus getter fncts.schema.AST partial
954
+ */
955
+ function partial_1(self) {
956
+ void 0;
957
+ switch (self._tag) {
958
+ case 0 /* ASTTag.Declaration */:
959
+ return partial_1(self.type);
960
+ case 16 /* ASTTag.Tuple */:
961
+ 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);
962
+ case 17 /* ASTTag.TypeLiteral */:
963
+ return createTypeLiteral_1(tsplus_module_2.map(f => createPropertySignature_1(f.name, f.type, true, f.isReadonly, f.annotations))(self.propertySignatures), self.indexSignatures);
964
+ case 18 /* ASTTag.Union */:
965
+ return createUnion_1(tsplus_module_2.map(partial_1)(self.types));
966
+ case 19 /* ASTTag.Lazy */:
967
+ return createLazy_1(() => partial_1(self.getAST()));
968
+ case 20 /* ASTTag.Refinement */:
969
+ return partial_1(self.from);
970
+ case 21 /* ASTTag.Transform */:
971
+ return partial_1(self.to);
972
+ default:
973
+ return self;
974
+ }
975
+ }
976
+ /**
977
+ * @tsplus static fncts.schema.AST createKey
978
+ */
979
+ export function createKey(key) {
980
+ return typeof key === "symbol" ? createUniqueSymbol_1(key) : createLiteral_1(key);
981
+ }
982
+ /**
983
+ * @tsplus getter fncts.schema.AST getFrom
984
+ */
985
+ function getFrom_1(ast) {
986
+ void 0;
987
+ switch (ast._tag) {
988
+ case 0 /* ASTTag.Declaration */:
989
+ return createDeclaration_1(tsplus_module_2.map(getFrom_1)(ast.typeParameters), ast.type, ast.decode, ast.annotations);
990
+ case 16 /* ASTTag.Tuple */:
991
+ 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);
992
+ case 17 /* ASTTag.TypeLiteral */:
993
+ 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);
994
+ case 18 /* ASTTag.Union */:
995
+ return createUnion_1(tsplus_module_2.map(getFrom_1)(ast.types), ast.annotations);
996
+ case 19 /* ASTTag.Lazy */:
997
+ return createLazy_1(() => getFrom_1(ast.getAST()), ast.annotations);
998
+ case 20 /* ASTTag.Refinement */:
999
+ case 21 /* ASTTag.Transform */:
1000
+ return getFrom_1(ast.from);
1001
+ }
1002
+ return ast;
1003
+ }
1004
+ /**
1005
+ * @tsplus getter fncts.schema.AST getTo
1006
+ */
1007
+ function getTo_1(ast) {
1008
+ void 0;
1009
+ switch (ast._tag) {
1010
+ case 0 /* ASTTag.Declaration */:
1011
+ return createDeclaration_1(tsplus_module_2.map(getTo_1)(ast.typeParameters), ast.type, ast.decode, ast.annotations);
1012
+ case 16 /* ASTTag.Tuple */:
1013
+ 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);
1014
+ case 17 /* ASTTag.TypeLiteral */:
1015
+ 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);
1016
+ case 18 /* ASTTag.Union */:
1017
+ return createUnion_1(tsplus_module_2.map(getTo_1)(ast.types), ast.annotations);
1018
+ case 19 /* ASTTag.Lazy */:
1019
+ return createLazy_1(() => getTo_1(ast.getAST()), ast.annotations);
1020
+ case 20 /* ASTTag.Refinement */:
1021
+ return createRefinement_1(getTo_1(ast.from), ast.decode, false, ast.annotations);
1022
+ case 21 /* ASTTag.Transform */:
1023
+ return getTo_1(ast.to);
1024
+ }
1025
+ return ast;
1026
+ }
1027
+ /**
1028
+ * @tsplus getter fncts.schema.AST reverse
1029
+ */
1030
+ function reverse_1(ast) {
1031
+ void 0;
1032
+ switch (ast._tag) {
1033
+ case 0 /* ASTTag.Declaration */:
1034
+ return createDeclaration_1(tsplus_module_2.map(reverse_1)(ast.typeParameters), ast.type, ast.decode, ast.annotations);
1035
+ case 16 /* ASTTag.Tuple */:
1036
+ 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);
1037
+ case 17 /* ASTTag.TypeLiteral */:
1038
+ 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);
1039
+ case 18 /* ASTTag.Union */:
1040
+ return createUnion_1(tsplus_module_2.map(reverse_1)(ast.types), ast.annotations);
1041
+ case 19 /* ASTTag.Lazy */:
1042
+ return createLazy_1(() => reverse_1(ast.getAST()), ast.annotations);
1043
+ case 20 /* ASTTag.Refinement */:
1044
+ return createRefinement_1(ast.from, ast.decode, !ast.isReversed, ast.annotations);
1045
+ case 21 /* ASTTag.Transform */:
1046
+ return createTransform_1(reverse_1(ast.from), ast.to, ast.decode, ast.encode, !ast.isReversed, ast.annotations);
1047
+ }
1048
+ return ast;
1049
+ }
1050
+ /**
1051
+ * @tsplus static fncts.schema.AST getCompiler
1052
+ */
1053
+ export function getCompiler(match) {
1054
+ const compile = memoize(ast => {
1055
+ void 0;
1056
+ return match[ast._tag](ast, compile);
1057
+ });
1058
+ return compile;
1059
+ }
1060
+ //# sourceMappingURL=AST.mjs.map