@fncts/schema 0.0.23 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AST.d.ts +60 -29
- package/ASTAnnotationMap.d.ts +4 -1
- package/ParseError/ParseError.d.ts +28 -13
- package/_cjs/AST.cjs +279 -137
- package/_cjs/AST.cjs.map +1 -1
- package/_cjs/ASTAnnotation.cjs +5 -3
- package/_cjs/ASTAnnotation.cjs.map +1 -1
- package/_cjs/ASTAnnotationMap.cjs +18 -9
- package/_cjs/ASTAnnotationMap.cjs.map +1 -1
- package/_cjs/InvalidInterpretationError.cjs +1 -6
- package/_cjs/InvalidInterpretationError.cjs.map +1 -1
- package/_cjs/ParseError/ParseError.cjs +91 -14
- package/_cjs/ParseError/ParseError.cjs.map +1 -1
- package/_cjs/Schema/api/hashMap.cjs +1 -1
- package/_cjs/Schema/api/hashMap.cjs.map +1 -1
- package/_cjs/Schema/api/hashSet.cjs +1 -1
- package/_cjs/Schema/api/hashSet.cjs.map +1 -1
- package/_cjs/Schema/api/list.cjs +3 -1
- package/_cjs/Schema/api/list.cjs.map +1 -1
- package/_cjs/Schema/api/map.cjs +1 -1
- package/_cjs/Schema/api/map.cjs.map +1 -1
- package/_cjs/Schema/api/set.cjs +1 -1
- package/_cjs/Schema/api/set.cjs.map +1 -1
- package/_cjs/Schema/definition.cjs +3 -4
- package/_cjs/Schema/definition.cjs.map +1 -1
- package/_mjs/AST.mjs +277 -136
- package/_mjs/AST.mjs.map +1 -1
- package/_mjs/ASTAnnotation.mjs +5 -3
- package/_mjs/ASTAnnotation.mjs.map +1 -1
- package/_mjs/ASTAnnotationMap.mjs +18 -9
- package/_mjs/ASTAnnotationMap.mjs.map +1 -1
- package/_mjs/InvalidInterpretationError.mjs +1 -6
- package/_mjs/InvalidInterpretationError.mjs.map +1 -1
- package/_mjs/ParseError/ParseError.mjs +90 -14
- package/_mjs/ParseError/ParseError.mjs.map +1 -1
- package/_mjs/Schema/api/hashMap.mjs +1 -1
- package/_mjs/Schema/api/hashMap.mjs.map +1 -1
- package/_mjs/Schema/api/hashSet.mjs +1 -1
- package/_mjs/Schema/api/hashSet.mjs.map +1 -1
- package/_mjs/Schema/api/list.mjs +3 -1
- package/_mjs/Schema/api/list.mjs.map +1 -1
- package/_mjs/Schema/api/map.mjs +1 -1
- package/_mjs/Schema/api/map.mjs.map +1 -1
- package/_mjs/Schema/api/set.mjs +1 -1
- package/_mjs/Schema/api/set.mjs.map +1 -1
- package/_mjs/Schema/definition.mjs +2 -3
- package/_mjs/Schema/definition.mjs.map +1 -1
- package/_src/AST.ts +226 -28
- package/_src/ASTAnnotationMap.ts +14 -1
- package/_src/ParseError/ParseError.ts +128 -13
- package/_src/Schema/api/hashMap.ts +1 -1
- package/_src/Schema/api/hashSet.ts +1 -1
- package/_src/Schema/api/list.ts +3 -1
- package/_src/Schema/api/map.ts +1 -1
- package/_src/Schema/api/set.ts +1 -1
- package/package.json +3 -3
package/_mjs/AST.mjs
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
var _a;
|
|
2
1
|
const fileName_1 = "(@fncts/schema) src/AST.ts";
|
|
3
|
-
import * as tsplus_module_1 from "@fncts/
|
|
4
|
-
import * as tsplus_module_2 from "@fncts/schema/
|
|
5
|
-
import * as tsplus_module_3 from "@fncts/base/
|
|
6
|
-
import * as tsplus_module_4 from "@fncts/
|
|
7
|
-
import * as tsplus_module_5 from "@fncts/
|
|
8
|
-
import * as tsplus_module_6 from "@fncts/
|
|
9
|
-
import * as tsplus_module_7 from "@fncts/base/data/
|
|
10
|
-
import * as tsplus_module_8 from "@fncts/
|
|
11
|
-
import * as tsplus_module_9 from "@fncts/
|
|
12
|
-
import * as tsplus_module_10 from "@fncts/base/data/
|
|
13
|
-
import * as tsplus_module_11 from "@fncts/base/
|
|
14
|
-
import * as tsplus_module_12 from "@fncts/base/data/
|
|
15
|
-
import * as tsplus_module_13 from "@fncts/base/data/
|
|
16
|
-
import * as tsplus_module_14 from "@fncts/base/collection/
|
|
17
|
-
import * as tsplus_module_15 from "@fncts/base/data/Maybe/
|
|
2
|
+
import * as tsplus_module_1 from "@fncts/base/data/Equatable/definition";
|
|
3
|
+
import * as tsplus_module_2 from "@fncts/schema/Show";
|
|
4
|
+
import * as tsplus_module_3 from "@fncts/base/util/predicates";
|
|
5
|
+
import * as tsplus_module_4 from "@fncts/schema/ASTAnnotation";
|
|
6
|
+
import * as tsplus_module_5 from "@fncts/base/collection/immutable/Vector/definition";
|
|
7
|
+
import * as tsplus_module_6 from "@fncts/base/collection/immutable/Vector/api";
|
|
8
|
+
import * as tsplus_module_7 from "@fncts/base/data/Maybe/constructors";
|
|
9
|
+
import * as tsplus_module_8 from "@fncts/schema/ParseResult";
|
|
10
|
+
import * as tsplus_module_9 from "@fncts/schema/ParseError/ParseError";
|
|
11
|
+
import * as tsplus_module_10 from "@fncts/base/data/number/instances";
|
|
12
|
+
import * as tsplus_module_11 from "@fncts/base/data/Ord/api/contramap";
|
|
13
|
+
import * as tsplus_module_12 from "@fncts/base/data/Ord/api";
|
|
14
|
+
import * as tsplus_module_13 from "@fncts/base/data/Ord/api/max";
|
|
15
|
+
import * as tsplus_module_14 from "@fncts/base/collection/Iterable/api";
|
|
16
|
+
import * as tsplus_module_15 from "@fncts/base/data/Maybe/destructors";
|
|
17
|
+
import * as tsplus_module_16 from "@fncts/base/data/Maybe/definition";
|
|
18
|
+
import * as tsplus_module_17 from "@fncts/base/collection/immutable/Vector/internal";
|
|
19
|
+
import * as tsplus_module_18 from "@fncts/base/data/Maybe/api";
|
|
18
20
|
export const createLiteral = createLiteral_1;
|
|
19
21
|
export const isLiteral = isLiteral_1;
|
|
20
22
|
export const createUniqueSymbol = createUniqueSymbol_1;
|
|
@@ -41,24 +43,18 @@ import { memoize } from "@fncts/schema/utils";
|
|
|
41
43
|
import { ASTAnnotationMap } from "./ASTAnnotationMap.mjs";
|
|
42
44
|
export const ASTTypeId = /*#__PURE__*/Symbol.for("fncts.schema.AST");
|
|
43
45
|
export class Annotated {
|
|
44
|
-
|
|
45
|
-
this.annotations = ASTAnnotationMap.empty;
|
|
46
|
-
}
|
|
46
|
+
annotations = ASTAnnotationMap.empty;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* @tsplus type fncts.schema.AST
|
|
50
50
|
* @tsplus companion fncts.schema.ASTOps
|
|
51
51
|
*/
|
|
52
52
|
export class AST extends Annotated {
|
|
53
|
-
|
|
54
|
-
super(...arguments);
|
|
55
|
-
this[_a] = ASTTypeId;
|
|
56
|
-
}
|
|
53
|
+
[ASTTypeId] = ASTTypeId;
|
|
57
54
|
toString(verbose = false) {
|
|
58
|
-
return
|
|
55
|
+
return tsplus_module_2.showAST(verbose)(this);
|
|
59
56
|
}
|
|
60
57
|
}
|
|
61
|
-
_a = ASTTypeId;
|
|
62
58
|
/**
|
|
63
59
|
* @tsplus static fncts.schema.ASTOps concrete
|
|
64
60
|
* @tsplus macro remove
|
|
@@ -66,6 +62,12 @@ _a = ASTTypeId;
|
|
|
66
62
|
export function concrete(_) {
|
|
67
63
|
//
|
|
68
64
|
}
|
|
65
|
+
export function isAST(u) {
|
|
66
|
+
return tsplus_module_3.isObject(u) && ASTTypeId in u;
|
|
67
|
+
}
|
|
68
|
+
function hasTag(u, tag) {
|
|
69
|
+
return isAST(u) && u._tag === tag;
|
|
70
|
+
}
|
|
69
71
|
export function getAnnotations(key) {
|
|
70
72
|
return self => {
|
|
71
73
|
return self.annotations.get(key);
|
|
@@ -78,17 +80,24 @@ export function getAnnotations(key) {
|
|
|
78
80
|
* @tsplus type fncts.schema.AST.Declaration
|
|
79
81
|
*/
|
|
80
82
|
export class Declaration extends AST {
|
|
83
|
+
typeParameters;
|
|
84
|
+
decode;
|
|
85
|
+
encode;
|
|
86
|
+
annotations;
|
|
87
|
+
_tag = 0 /* ASTTag.Declaration */;
|
|
81
88
|
constructor(typeParameters, decode, encode, annotations = ASTAnnotationMap.empty) {
|
|
82
89
|
super();
|
|
83
90
|
this.typeParameters = typeParameters;
|
|
84
91
|
this.decode = decode;
|
|
85
92
|
this.encode = encode;
|
|
86
93
|
this.annotations = annotations;
|
|
87
|
-
this._tag = 0 /* ASTTag.Declaration */;
|
|
88
94
|
}
|
|
89
95
|
clone(newProperties) {
|
|
90
96
|
return new Declaration(newProperties.typeParameters ?? this.typeParameters, newProperties.decode ?? this.decode, newProperties.encode ?? this.encode, newProperties.annotations ?? this.annotations);
|
|
91
97
|
}
|
|
98
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
99
|
+
return hasTag(that, 0 /* ASTTag.Declaration */) && context.comparator(this.typeParameters, that.typeParameters) && context.comparator(this.decode, that.decode) && context.comparator(this.encode, that.encode) && context.comparator(this.annotations, that.annotations);
|
|
100
|
+
}
|
|
92
101
|
}
|
|
93
102
|
/**
|
|
94
103
|
* @tsplus static fncts.schema.ASTOps createDeclaration
|
|
@@ -104,15 +113,20 @@ export function isDeclaration(self) {
|
|
|
104
113
|
return self._tag === 0 /* ASTTag.Declaration */;
|
|
105
114
|
}
|
|
106
115
|
export class Literal extends AST {
|
|
116
|
+
literal;
|
|
117
|
+
annotations;
|
|
118
|
+
_tag = 1 /* ASTTag.Literal */;
|
|
107
119
|
constructor(literal, annotations = ASTAnnotationMap.empty) {
|
|
108
120
|
super();
|
|
109
121
|
this.literal = literal;
|
|
110
122
|
this.annotations = annotations;
|
|
111
|
-
this._tag = 1 /* ASTTag.Literal */;
|
|
112
123
|
}
|
|
113
124
|
clone(newProperties) {
|
|
114
125
|
return new Literal(newProperties.literal ?? this.literal, newProperties.annotations ?? this.annotations);
|
|
115
126
|
}
|
|
127
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
128
|
+
return hasTag(that, 1 /* ASTTag.Literal */) && context.comparator(this.literal, that.literal) && context.comparator(this.annotations, that.annotations);
|
|
129
|
+
}
|
|
116
130
|
}
|
|
117
131
|
/**
|
|
118
132
|
* @tsplus static fncts.schema.ASTOps createLiteral
|
|
@@ -131,15 +145,20 @@ function isLiteral_1(self) {
|
|
|
131
145
|
* UniqueSymbol
|
|
132
146
|
*/
|
|
133
147
|
export class UniqueSymbol extends AST {
|
|
148
|
+
symbol;
|
|
149
|
+
annotations;
|
|
150
|
+
_tag = 2 /* ASTTag.UniqueSymbol */;
|
|
134
151
|
constructor(symbol, annotations = ASTAnnotationMap.empty) {
|
|
135
152
|
super();
|
|
136
153
|
this.symbol = symbol;
|
|
137
154
|
this.annotations = annotations;
|
|
138
|
-
this._tag = 2 /* ASTTag.UniqueSymbol */;
|
|
139
155
|
}
|
|
140
156
|
clone(newProperties) {
|
|
141
157
|
return new UniqueSymbol(newProperties.symbol ?? this.symbol, newProperties.annotations ?? this.annotations);
|
|
142
158
|
}
|
|
159
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
160
|
+
return hasTag(that, 2 /* ASTTag.UniqueSymbol */) && context.comparator(this.symbol, that.symbol) && context.comparator(this.annotations, that.annotations);
|
|
161
|
+
}
|
|
143
162
|
}
|
|
144
163
|
/**
|
|
145
164
|
* @tsplus static fncts.schema.ASTOps createUniqueSymbol
|
|
@@ -158,107 +177,131 @@ function isUniqueSymbol_1(self) {
|
|
|
158
177
|
* UndefinedKeyword
|
|
159
178
|
*/
|
|
160
179
|
export class UndefinedKeyword extends AST {
|
|
180
|
+
annotations;
|
|
181
|
+
_tag = 3 /* ASTTag.UndefinedKeyword */;
|
|
161
182
|
constructor(annotations = ASTAnnotationMap.empty) {
|
|
162
183
|
super();
|
|
163
184
|
this.annotations = annotations;
|
|
164
|
-
this._tag = 3 /* ASTTag.UndefinedKeyword */;
|
|
165
185
|
}
|
|
166
186
|
clone(newProperties) {
|
|
167
187
|
return new UndefinedKeyword(newProperties.annotations ?? this.annotations);
|
|
168
188
|
}
|
|
189
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
190
|
+
return hasTag(that, 3 /* ASTTag.UndefinedKeyword */) && context.comparator(this.annotations, that.annotations);
|
|
191
|
+
}
|
|
169
192
|
}
|
|
170
193
|
/**
|
|
171
194
|
* @tsplus static fncts.schema.ASTOps undefinedKeyword
|
|
172
195
|
*/
|
|
173
|
-
const undefinedKeyword_1 = /*#__PURE__*/new UndefinedKeyword(/*#__PURE__*/ASTAnnotationMap.empty.annotate(
|
|
196
|
+
const undefinedKeyword_1 = /*#__PURE__*/new UndefinedKeyword(/*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_4.Title, "undefined"));
|
|
174
197
|
export const undefinedKeyword = undefinedKeyword_1;
|
|
175
198
|
/*
|
|
176
199
|
* VoidKeyword
|
|
177
200
|
*/
|
|
178
201
|
export class VoidKeyword extends AST {
|
|
202
|
+
annotations;
|
|
203
|
+
_tag = 4 /* ASTTag.VoidKeyword */;
|
|
179
204
|
constructor(annotations = ASTAnnotationMap.empty) {
|
|
180
205
|
super();
|
|
181
206
|
this.annotations = annotations;
|
|
182
|
-
this._tag = 4 /* ASTTag.VoidKeyword */;
|
|
183
207
|
}
|
|
184
208
|
clone(newProperties) {
|
|
185
209
|
return new VoidKeyword(newProperties.annotations ?? this.annotations);
|
|
186
210
|
}
|
|
211
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
212
|
+
return hasTag(that, 4 /* ASTTag.VoidKeyword */) && context.comparator(this.annotations, that.annotations);
|
|
213
|
+
}
|
|
187
214
|
}
|
|
188
215
|
/**
|
|
189
216
|
* @tsplus static fncts.schema.ASTOps voidKeyword
|
|
190
217
|
*/
|
|
191
|
-
export const voidKeyword = /*#__PURE__*/new VoidKeyword(/*#__PURE__*/ASTAnnotationMap.empty.annotate(
|
|
218
|
+
export const voidKeyword = /*#__PURE__*/new VoidKeyword(/*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_4.Title, "void"));
|
|
192
219
|
/*
|
|
193
220
|
* NeverKeyword
|
|
194
221
|
*/
|
|
195
222
|
export class NeverKeyword extends AST {
|
|
223
|
+
annotations;
|
|
224
|
+
_tag = 5 /* ASTTag.NeverKeyword */;
|
|
196
225
|
constructor(annotations = ASTAnnotationMap.empty) {
|
|
197
226
|
super();
|
|
198
227
|
this.annotations = annotations;
|
|
199
|
-
this._tag = 5 /* ASTTag.NeverKeyword */;
|
|
200
228
|
}
|
|
201
229
|
clone(newProperties) {
|
|
202
230
|
return new NeverKeyword(newProperties.annotations ?? this.annotations);
|
|
203
231
|
}
|
|
232
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
233
|
+
return hasTag(that, 5 /* ASTTag.NeverKeyword */) && context.comparator(this.annotations, that.annotations);
|
|
234
|
+
}
|
|
204
235
|
}
|
|
205
236
|
/**
|
|
206
237
|
* @tsplus static fncts.schema.ASTOps neverKeyword
|
|
207
238
|
*/
|
|
208
|
-
const neverKeyword_1 = /*#__PURE__*/new NeverKeyword(/*#__PURE__*/ASTAnnotationMap.empty.annotate(
|
|
239
|
+
const neverKeyword_1 = /*#__PURE__*/new NeverKeyword(/*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_4.Title, "never"));
|
|
209
240
|
export const neverKeyword = neverKeyword_1;
|
|
210
241
|
/*
|
|
211
242
|
* UnknownKeyword
|
|
212
243
|
*/
|
|
213
244
|
export class UnknownKeyword extends AST {
|
|
245
|
+
annotations;
|
|
246
|
+
_tag = 6 /* ASTTag.UnknownKeyword */;
|
|
214
247
|
constructor(annotations = ASTAnnotationMap.empty) {
|
|
215
248
|
super();
|
|
216
249
|
this.annotations = annotations;
|
|
217
|
-
this._tag = 6 /* ASTTag.UnknownKeyword */;
|
|
218
250
|
}
|
|
219
251
|
clone(newProperties) {
|
|
220
252
|
return new UnknownKeyword(newProperties.annotations ?? this.annotations);
|
|
221
253
|
}
|
|
254
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
255
|
+
return hasTag(that, 6 /* ASTTag.UnknownKeyword */) && context.comparator(this.annotations, that.annotations);
|
|
256
|
+
}
|
|
222
257
|
}
|
|
223
258
|
/**
|
|
224
259
|
* @tsplus static fncts.schema.ASTOps unknownKeyword
|
|
225
260
|
*/
|
|
226
|
-
const unknownKeyword_1 = /*#__PURE__*/new UnknownKeyword(/*#__PURE__*/ASTAnnotationMap.empty.annotate(
|
|
261
|
+
const unknownKeyword_1 = /*#__PURE__*/new UnknownKeyword(/*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_4.Title, "unknown"));
|
|
227
262
|
export const unknownKeyword = unknownKeyword_1;
|
|
228
263
|
/*
|
|
229
264
|
* AnyKeyword
|
|
230
265
|
*/
|
|
231
266
|
export class AnyKeyword extends AST {
|
|
267
|
+
annotations;
|
|
268
|
+
_tag = 7 /* ASTTag.AnyKeyword */;
|
|
232
269
|
constructor(annotations = ASTAnnotationMap.empty) {
|
|
233
270
|
super();
|
|
234
271
|
this.annotations = annotations;
|
|
235
|
-
this._tag = 7 /* ASTTag.AnyKeyword */;
|
|
236
272
|
}
|
|
237
273
|
clone(newProperties) {
|
|
238
274
|
return new AnyKeyword(newProperties.annotations ?? this.annotations);
|
|
239
275
|
}
|
|
276
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
277
|
+
return hasTag(that, 7 /* ASTTag.AnyKeyword */) && context.comparator(this.annotations, that.annotations);
|
|
278
|
+
}
|
|
240
279
|
}
|
|
241
280
|
/**
|
|
242
281
|
* @tsplus static fncts.schema.ASTOps anyKeyword
|
|
243
282
|
*/
|
|
244
|
-
export const anyKeyword = /*#__PURE__*/new AnyKeyword(/*#__PURE__*/ASTAnnotationMap.empty.annotate(
|
|
283
|
+
export const anyKeyword = /*#__PURE__*/new AnyKeyword(/*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_4.Title, "any"));
|
|
245
284
|
/*
|
|
246
285
|
* StringKeyword
|
|
247
286
|
*/
|
|
248
287
|
export class StringKeyword extends AST {
|
|
288
|
+
annotations;
|
|
289
|
+
_tag = 8 /* ASTTag.StringKeyword */;
|
|
249
290
|
constructor(annotations = ASTAnnotationMap.empty) {
|
|
250
291
|
super();
|
|
251
292
|
this.annotations = annotations;
|
|
252
|
-
this._tag = 8 /* ASTTag.StringKeyword */;
|
|
253
293
|
}
|
|
254
294
|
clone(newProperties) {
|
|
255
295
|
return new StringKeyword(newProperties.annotations ?? this.annotations);
|
|
256
296
|
}
|
|
297
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
298
|
+
return hasTag(that, 8 /* ASTTag.StringKeyword */) && context.comparator(this.annotations, that.annotations);
|
|
299
|
+
}
|
|
257
300
|
}
|
|
258
301
|
/**
|
|
259
302
|
* @tsplus static fncts.schema.ASTOps stringKeyword
|
|
260
303
|
*/
|
|
261
|
-
const stringKeyword_1 = /*#__PURE__*/new StringKeyword(/*#__PURE__*/ASTAnnotationMap.empty.annotate(
|
|
304
|
+
const stringKeyword_1 = /*#__PURE__*/new StringKeyword(/*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_4.Title, "string"));
|
|
262
305
|
export const stringKeyword = stringKeyword_1;
|
|
263
306
|
/**
|
|
264
307
|
* @tsplus fluent fncts.schema.AST isStringKeyword
|
|
@@ -271,19 +314,23 @@ function isStringKeyword_1(self) {
|
|
|
271
314
|
* NumberKeyword
|
|
272
315
|
*/
|
|
273
316
|
export class NumberKeyword extends AST {
|
|
317
|
+
annotations;
|
|
318
|
+
_tag = 9 /* ASTTag.NumberKeyword */;
|
|
274
319
|
constructor(annotations = ASTAnnotationMap.empty) {
|
|
275
320
|
super();
|
|
276
321
|
this.annotations = annotations;
|
|
277
|
-
this._tag = 9 /* ASTTag.NumberKeyword */;
|
|
278
322
|
}
|
|
279
323
|
clone(newProperties) {
|
|
280
324
|
return new NumberKeyword(newProperties.annotations ?? this.annotations);
|
|
281
325
|
}
|
|
326
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
327
|
+
return hasTag(that, 9 /* ASTTag.NumberKeyword */) && context.comparator(this.annotations, that.annotations);
|
|
328
|
+
}
|
|
282
329
|
}
|
|
283
330
|
/**
|
|
284
331
|
* @tsplus static fncts.schema.ASTOps numberKeyword
|
|
285
332
|
*/
|
|
286
|
-
const numberKeyword_1 = /*#__PURE__*/new NumberKeyword(/*#__PURE__*/ASTAnnotationMap.empty.annotate(
|
|
333
|
+
const numberKeyword_1 = /*#__PURE__*/new NumberKeyword(/*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_4.Title, "number"));
|
|
287
334
|
export const numberKeyword = numberKeyword_1;
|
|
288
335
|
/**
|
|
289
336
|
* @tsplus fluent fncts.schema.AST isNumberKeyword
|
|
@@ -296,19 +343,23 @@ function isNumberKeyword_1(self) {
|
|
|
296
343
|
* BooleanKeyword
|
|
297
344
|
*/
|
|
298
345
|
export class BooleanKeyword extends AST {
|
|
346
|
+
annotations;
|
|
347
|
+
_tag = 10 /* ASTTag.BooleanKeyword */;
|
|
299
348
|
constructor(annotations = ASTAnnotationMap.empty) {
|
|
300
349
|
super();
|
|
301
350
|
this.annotations = annotations;
|
|
302
|
-
this._tag = 10 /* ASTTag.BooleanKeyword */;
|
|
303
351
|
}
|
|
304
352
|
clone(newProperties) {
|
|
305
353
|
return new BooleanKeyword(newProperties.annotations ?? this.annotations);
|
|
306
354
|
}
|
|
355
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
356
|
+
return hasTag(that, 10 /* ASTTag.BooleanKeyword */) && context.comparator(this.annotations, that.annotations);
|
|
357
|
+
}
|
|
307
358
|
}
|
|
308
359
|
/**
|
|
309
360
|
* @tsplus static fncts.schema.ASTOps booleanKeyword
|
|
310
361
|
*/
|
|
311
|
-
export const booleanKeyword = /*#__PURE__*/new BooleanKeyword(/*#__PURE__*/ASTAnnotationMap.empty.annotate(
|
|
362
|
+
export const booleanKeyword = /*#__PURE__*/new BooleanKeyword(/*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_4.Title, "boolean"));
|
|
312
363
|
/**
|
|
313
364
|
* @tsplus fluent fncts.schema.AST isBooleanKeyword
|
|
314
365
|
*/
|
|
@@ -320,19 +371,23 @@ export function isBooleanKeyword(self) {
|
|
|
320
371
|
* BigIntKeyword
|
|
321
372
|
*/
|
|
322
373
|
export class BigIntKeyword extends AST {
|
|
374
|
+
annotations;
|
|
375
|
+
_tag = 11 /* ASTTag.BigIntKeyword */;
|
|
323
376
|
constructor(annotations = ASTAnnotationMap.empty) {
|
|
324
377
|
super();
|
|
325
378
|
this.annotations = annotations;
|
|
326
|
-
this._tag = 11 /* ASTTag.BigIntKeyword */;
|
|
327
379
|
}
|
|
328
380
|
clone(newProperties) {
|
|
329
381
|
return new BigIntKeyword(newProperties.annotations ?? this.annotations);
|
|
330
382
|
}
|
|
383
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
384
|
+
return hasTag(that, 11 /* ASTTag.BigIntKeyword */) && context.comparator(this.annotations, that.annotations);
|
|
385
|
+
}
|
|
331
386
|
}
|
|
332
387
|
/**
|
|
333
388
|
* @tsplus static fncts.schema.ASTOps bigIntKeyword
|
|
334
389
|
*/
|
|
335
|
-
export const bigIntKeyword = /*#__PURE__*/new BigIntKeyword(/*#__PURE__*/ASTAnnotationMap.empty.annotate(
|
|
390
|
+
export const bigIntKeyword = /*#__PURE__*/new BigIntKeyword(/*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_4.Title, "bigint"));
|
|
336
391
|
/**
|
|
337
392
|
* @tsplus fluent fncts.schema.AST isBigIntKeyword
|
|
338
393
|
*/
|
|
@@ -344,19 +399,23 @@ export function isBigIntKeyword(self) {
|
|
|
344
399
|
* SymbolKeyword
|
|
345
400
|
*/
|
|
346
401
|
export class SymbolKeyword extends AST {
|
|
402
|
+
annotations;
|
|
403
|
+
_tag = 12 /* ASTTag.SymbolKeyword */;
|
|
347
404
|
constructor(annotations = ASTAnnotationMap.empty) {
|
|
348
405
|
super();
|
|
349
406
|
this.annotations = annotations;
|
|
350
|
-
this._tag = 12 /* ASTTag.SymbolKeyword */;
|
|
351
407
|
}
|
|
352
408
|
clone(newProperties) {
|
|
353
409
|
return new SymbolKeyword(newProperties.annotations ?? this.annotations);
|
|
354
410
|
}
|
|
411
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
412
|
+
return hasTag(that, 12 /* ASTTag.SymbolKeyword */) && context.comparator(this.annotations, that.annotations);
|
|
413
|
+
}
|
|
355
414
|
}
|
|
356
415
|
/**
|
|
357
416
|
* @tsplus static fncts.schema.ASTOps symbolKeyword
|
|
358
417
|
*/
|
|
359
|
-
const symbolKeyword_1 = /*#__PURE__*/new SymbolKeyword(/*#__PURE__*/ASTAnnotationMap.empty.annotate(
|
|
418
|
+
const symbolKeyword_1 = /*#__PURE__*/new SymbolKeyword(/*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_4.Title, "symbol"));
|
|
360
419
|
export const symbolKeyword = symbolKeyword_1;
|
|
361
420
|
/**
|
|
362
421
|
* @tsplus fluent fncts.schema.AST isSymbolKeyword
|
|
@@ -369,32 +428,41 @@ function isSymbolKeyword_1(self) {
|
|
|
369
428
|
* ObjectKeyword
|
|
370
429
|
*/
|
|
371
430
|
export class ObjectKeyword extends AST {
|
|
431
|
+
annotations;
|
|
432
|
+
_tag = 13 /* ASTTag.ObjectKeyword */;
|
|
372
433
|
constructor(annotations = ASTAnnotationMap.empty) {
|
|
373
434
|
super();
|
|
374
435
|
this.annotations = annotations;
|
|
375
|
-
this._tag = 13 /* ASTTag.ObjectKeyword */;
|
|
376
436
|
}
|
|
377
437
|
clone(newProperties) {
|
|
378
438
|
return new ObjectKeyword(newProperties.annotations ?? this.annotations);
|
|
379
439
|
}
|
|
440
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
441
|
+
return hasTag(that, 13 /* ASTTag.ObjectKeyword */) && context.comparator(this.annotations, that.annotations);
|
|
442
|
+
}
|
|
380
443
|
}
|
|
381
444
|
/**
|
|
382
445
|
* @tsplus static fncts.schema.ASTOps objectKeyword
|
|
383
446
|
*/
|
|
384
|
-
export const objectKeyword = /*#__PURE__*/new ObjectKeyword(/*#__PURE__*/ASTAnnotationMap.empty.annotate(
|
|
447
|
+
export const objectKeyword = /*#__PURE__*/new ObjectKeyword(/*#__PURE__*/ASTAnnotationMap.empty.annotate(tsplus_module_4.Title, "object"));
|
|
385
448
|
/*
|
|
386
449
|
* Enum
|
|
387
450
|
*/
|
|
388
451
|
export class Enum extends AST {
|
|
452
|
+
enums;
|
|
453
|
+
annotations;
|
|
454
|
+
_tag = 14 /* ASTTag.Enum */;
|
|
389
455
|
constructor(enums, annotations = ASTAnnotationMap.empty) {
|
|
390
456
|
super();
|
|
391
457
|
this.enums = enums;
|
|
392
458
|
this.annotations = annotations;
|
|
393
|
-
this._tag = 14 /* ASTTag.Enum */;
|
|
394
459
|
}
|
|
395
460
|
clone(newProperties) {
|
|
396
461
|
return new Enum(newProperties.enums ?? this.enums, newProperties.annotations ?? this.annotations);
|
|
397
462
|
}
|
|
463
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
464
|
+
return hasTag(that, 14 /* ASTTag.Enum */) && tsplus_module_5.corresponds(that.enums, ([leftName, leftValue], [rightName, rightValue]) => context.comparator(leftName, rightName) && context.comparator(leftValue, rightValue))(this.enums) && context.comparator(this.annotations, that.annotations);
|
|
465
|
+
}
|
|
398
466
|
}
|
|
399
467
|
/**
|
|
400
468
|
* @tsplus static fncts.schema.ASTOps createEnum
|
|
@@ -403,10 +471,15 @@ export function createEnum(enums, annotations = ASTAnnotationMap.empty) {
|
|
|
403
471
|
return new Enum(enums, annotations);
|
|
404
472
|
}
|
|
405
473
|
export class TemplateLiteralSpan {
|
|
474
|
+
type;
|
|
475
|
+
literal;
|
|
406
476
|
constructor(type, literal) {
|
|
407
477
|
this.type = type;
|
|
408
478
|
this.literal = literal;
|
|
409
479
|
}
|
|
480
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
481
|
+
return that instanceof TemplateLiteralSpan && context.comparator(this.type, that.type) && context.comparator(this.literal, that.literal);
|
|
482
|
+
}
|
|
410
483
|
toString() {
|
|
411
484
|
switch (this.type._tag) {
|
|
412
485
|
case 8 /* ASTTag.StringKeyword */:
|
|
@@ -420,22 +493,28 @@ export class TemplateLiteralSpan {
|
|
|
420
493
|
* TemplateLiteral
|
|
421
494
|
*/
|
|
422
495
|
export class TemplateLiteral extends AST {
|
|
496
|
+
head;
|
|
497
|
+
spans;
|
|
498
|
+
annotations;
|
|
499
|
+
_tag = 15 /* ASTTag.TemplateLiteral */;
|
|
423
500
|
constructor(head, spans, annotations = ASTAnnotationMap.empty) {
|
|
424
501
|
super();
|
|
425
502
|
this.head = head;
|
|
426
503
|
this.spans = spans;
|
|
427
504
|
this.annotations = annotations;
|
|
428
|
-
this._tag = 15 /* ASTTag.TemplateLiteral */;
|
|
429
505
|
}
|
|
430
506
|
clone(newProperties) {
|
|
431
507
|
return createTemplateLiteral_1(newProperties.head ?? this.head, newProperties.spans ?? this.spans, newProperties.annotations ?? this.annotations);
|
|
432
508
|
}
|
|
509
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
510
|
+
return hasTag(that, 15 /* ASTTag.TemplateLiteral */) && context.comparator(this.head, that.head) && context.comparator(this.spans, that.spans) && context.comparator(this.annotations, that.annotations);
|
|
511
|
+
}
|
|
433
512
|
}
|
|
434
513
|
/**
|
|
435
514
|
* @tsplus static fncts.schema.ASTOps createTemplateLiteral
|
|
436
515
|
*/
|
|
437
516
|
function createTemplateLiteral_1(head, spans, annotations = ASTAnnotationMap.empty) {
|
|
438
|
-
if (
|
|
517
|
+
if (tsplus_module_6.isNonEmpty(spans)) {
|
|
439
518
|
return new TemplateLiteral(head, spans, annotations);
|
|
440
519
|
} else {
|
|
441
520
|
return createLiteral_1(head, annotations);
|
|
@@ -445,10 +524,15 @@ function createTemplateLiteral_1(head, spans, annotations = ASTAnnotationMap.emp
|
|
|
445
524
|
* Element
|
|
446
525
|
*/
|
|
447
526
|
export class Element {
|
|
527
|
+
type;
|
|
528
|
+
isOptional;
|
|
448
529
|
constructor(type, isOptional) {
|
|
449
530
|
this.type = type;
|
|
450
531
|
this.isOptional = isOptional;
|
|
451
532
|
}
|
|
533
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
534
|
+
return that instanceof Element && context.comparator(this.type, that.type) && context.comparator(this.isOptional, that.isOptional);
|
|
535
|
+
}
|
|
452
536
|
toString() {
|
|
453
537
|
return String(this.type) + (this.isOptional ? "?" : "");
|
|
454
538
|
}
|
|
@@ -463,17 +547,24 @@ function createElement_1(type, isOptional) {
|
|
|
463
547
|
* Tuple
|
|
464
548
|
*/
|
|
465
549
|
export class Tuple extends AST {
|
|
550
|
+
elements;
|
|
551
|
+
rest;
|
|
552
|
+
isReadonly;
|
|
553
|
+
annotations;
|
|
554
|
+
_tag = 16 /* ASTTag.Tuple */;
|
|
466
555
|
constructor(elements, rest, isReadonly, annotations = ASTAnnotationMap.empty) {
|
|
467
556
|
super();
|
|
468
557
|
this.elements = elements;
|
|
469
558
|
this.rest = rest;
|
|
470
559
|
this.isReadonly = isReadonly;
|
|
471
560
|
this.annotations = annotations;
|
|
472
|
-
this._tag = 16 /* ASTTag.Tuple */;
|
|
473
561
|
}
|
|
474
562
|
clone(newProperties) {
|
|
475
563
|
return new Tuple(newProperties.elements ?? this.elements, newProperties.rest ?? this.rest, newProperties.isReadonly ?? this.isReadonly, newProperties.annotations ?? this.annotations);
|
|
476
564
|
}
|
|
565
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
566
|
+
return hasTag(that, 16 /* ASTTag.Tuple */) && context.comparator(this.elements, that.elements) && context.comparator(this.rest, that.rest) && context.comparator(this.isReadonly, that.isReadonly) && context.comparator(this.annotations, that.annotations);
|
|
567
|
+
}
|
|
477
568
|
}
|
|
478
569
|
/**
|
|
479
570
|
* @tsplus static fncts.schema.ASTOps createTuple
|
|
@@ -484,11 +575,16 @@ function createTuple_1(elements, rest, isReadonly, annotations = ASTAnnotationMa
|
|
|
484
575
|
/**
|
|
485
576
|
* @tsplus static fncts.schema.ASTOps unknownArray
|
|
486
577
|
*/
|
|
487
|
-
export const unknownArray = /*#__PURE__*/createTuple_1(/*#__PURE__*/
|
|
578
|
+
export const unknownArray = /*#__PURE__*/createTuple_1(/*#__PURE__*/tsplus_module_6.empty(), /*#__PURE__*/tsplus_module_7.just(/*#__PURE__*/tsplus_module_6.vector(unknownKeyword_1), fileName_1 + ":779:65"), true);
|
|
488
579
|
/*
|
|
489
580
|
* PropertySignature
|
|
490
581
|
*/
|
|
491
582
|
export class PropertySignature {
|
|
583
|
+
name;
|
|
584
|
+
type;
|
|
585
|
+
isOptional;
|
|
586
|
+
isReadonly;
|
|
587
|
+
annotations;
|
|
492
588
|
constructor(name, type, isOptional, isReadonly, annotations = ASTAnnotationMap.empty) {
|
|
493
589
|
this.name = name;
|
|
494
590
|
this.type = type;
|
|
@@ -499,6 +595,9 @@ export class PropertySignature {
|
|
|
499
595
|
clone(newProperties) {
|
|
500
596
|
return new PropertySignature(newProperties.name ?? this.name, newProperties.type ?? this.type, newProperties.isOptional ?? this.isOptional, newProperties.isReadonly ?? this.isReadonly, newProperties.annotations ?? this.annotations);
|
|
501
597
|
}
|
|
598
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
599
|
+
return that instanceof PropertySignature && context.comparator(this.name, that.name) && context.comparator(this.type, that.type) && context.comparator(this.isOptional, that.isOptional) && context.comparator(this.isReadonly, that.isReadonly) && context.comparator(this.annotations, that.annotations);
|
|
600
|
+
}
|
|
502
601
|
}
|
|
503
602
|
/**
|
|
504
603
|
* @tsplus static fncts.schema.ASTOps createPropertySignature
|
|
@@ -510,11 +609,17 @@ function createPropertySignature_1(name, type, isOptional, isReadonly, annotatio
|
|
|
510
609
|
* IndexSignature
|
|
511
610
|
*/
|
|
512
611
|
export class IndexSignature {
|
|
612
|
+
parameter;
|
|
613
|
+
type;
|
|
614
|
+
isReadonly;
|
|
513
615
|
constructor(parameter, type, isReadonly) {
|
|
514
616
|
this.parameter = parameter;
|
|
515
617
|
this.type = type;
|
|
516
618
|
this.isReadonly = isReadonly;
|
|
517
619
|
}
|
|
620
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
621
|
+
return that instanceof IndexSignature && context.comparator(this.parameter, that.parameter) && context.comparator(this.type, that.type) && context.comparator(this.isReadonly, that.isReadonly);
|
|
622
|
+
}
|
|
518
623
|
}
|
|
519
624
|
/**
|
|
520
625
|
* @tsplus static fncts.schema.ASTOps createIndexSignature
|
|
@@ -526,16 +631,22 @@ function createIndexSignature_1(parameter, type, isReadonly) {
|
|
|
526
631
|
* TypeLiteral
|
|
527
632
|
*/
|
|
528
633
|
export class TypeLiteral extends AST {
|
|
634
|
+
annotations;
|
|
635
|
+
_tag = 17 /* ASTTag.TypeLiteral */;
|
|
636
|
+
propertySignatures;
|
|
637
|
+
indexSignatures;
|
|
529
638
|
constructor(propertySignatures, indexSignatures, annotations = ASTAnnotationMap.empty) {
|
|
530
639
|
super();
|
|
531
640
|
this.annotations = annotations;
|
|
532
|
-
this._tag = 17 /* ASTTag.TypeLiteral */;
|
|
533
641
|
this.propertySignatures = sortByAscendingCardinality(propertySignatures);
|
|
534
642
|
this.indexSignatures = sortByAscendingCardinality(indexSignatures);
|
|
535
643
|
}
|
|
536
644
|
clone(newProperties) {
|
|
537
645
|
return new TypeLiteral(newProperties.propertySignatures ?? this.propertySignatures, newProperties.indexSignatures ?? this.indexSignatures, newProperties.annotations ?? this.annotations);
|
|
538
646
|
}
|
|
647
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
648
|
+
return hasTag(that, 17 /* ASTTag.TypeLiteral */) && context.comparator(this.propertySignatures, that.propertySignatures) && context.comparator(this.indexSignatures, that.indexSignatures) && context.comparator(this.annotations, that.annotations);
|
|
649
|
+
}
|
|
539
650
|
}
|
|
540
651
|
/**
|
|
541
652
|
* @tsplus static fncts.schema.ASTOps isTypeLiteral
|
|
@@ -554,20 +665,25 @@ function createTypeLiteral_1(propertySignatures, indexSignatures, annotations) {
|
|
|
554
665
|
/**
|
|
555
666
|
* @tsplus static fncts.schema.ASTOps unknownRecord
|
|
556
667
|
*/
|
|
557
|
-
export const unknownRecord = /*#__PURE__*/createTypeLiteral_1(/*#__PURE__*/
|
|
668
|
+
export const unknownRecord = /*#__PURE__*/createTypeLiteral_1(/*#__PURE__*/tsplus_module_6.empty(), /*#__PURE__*/tsplus_module_6.vector(/*#__PURE__*/createIndexSignature_1(stringKeyword_1, unknownKeyword_1, true), /*#__PURE__*/createIndexSignature_1(symbolKeyword_1, unknownKeyword_1, true)));
|
|
558
669
|
/*
|
|
559
670
|
* Union
|
|
560
671
|
*/
|
|
561
672
|
export class Union extends AST {
|
|
673
|
+
types;
|
|
674
|
+
annotations;
|
|
675
|
+
_tag = 18 /* ASTTag.Union */;
|
|
562
676
|
constructor(types, annotations = ASTAnnotationMap.empty) {
|
|
563
677
|
super();
|
|
564
678
|
this.types = types;
|
|
565
679
|
this.annotations = annotations;
|
|
566
|
-
this._tag = 18 /* ASTTag.Union */;
|
|
567
680
|
}
|
|
568
681
|
clone(newProperties) {
|
|
569
682
|
return createUnion_1(newProperties.types ?? this.types, newProperties.annotations ?? this.annotations);
|
|
570
683
|
}
|
|
684
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
685
|
+
return hasTag(that, 18 /* ASTTag.Union */) && context.comparator(this.types, that.types) && context.comparator(this.annotations, that.annotations);
|
|
686
|
+
}
|
|
571
687
|
}
|
|
572
688
|
/**
|
|
573
689
|
* @tsplus fluent fncts.schema.AST isUnion
|
|
@@ -585,7 +701,7 @@ function createUnion_1(candidates, annotations = ASTAnnotationMap.empty) {
|
|
|
585
701
|
case 0:
|
|
586
702
|
return neverKeyword_1;
|
|
587
703
|
case 1:
|
|
588
|
-
return
|
|
704
|
+
return tsplus_module_6.unsafeGet(0)(types);
|
|
589
705
|
default:
|
|
590
706
|
return new Union(sortByDescendingWeight(types), annotations);
|
|
591
707
|
}
|
|
@@ -594,15 +710,20 @@ function createUnion_1(candidates, annotations = ASTAnnotationMap.empty) {
|
|
|
594
710
|
* Lazy
|
|
595
711
|
*/
|
|
596
712
|
export class Lazy extends AST {
|
|
713
|
+
getAST;
|
|
714
|
+
annotations;
|
|
715
|
+
_tag = 19 /* ASTTag.Lazy */;
|
|
597
716
|
constructor(getAST, annotations = ASTAnnotationMap.empty) {
|
|
598
717
|
super();
|
|
599
718
|
this.getAST = getAST;
|
|
600
719
|
this.annotations = annotations;
|
|
601
|
-
this._tag = 19 /* ASTTag.Lazy */;
|
|
602
720
|
}
|
|
603
721
|
clone(newProperties) {
|
|
604
722
|
return new Lazy(newProperties.getAST ?? this.getAST, newProperties.annotations ?? this.annotations);
|
|
605
723
|
}
|
|
724
|
+
[tsplus_module_1.equalsSymbol](that) {
|
|
725
|
+
return this === that;
|
|
726
|
+
}
|
|
606
727
|
}
|
|
607
728
|
/**
|
|
608
729
|
* @tsplus static fncts.schema.ASTOps createLazy
|
|
@@ -621,19 +742,25 @@ export function isLazy(self) {
|
|
|
621
742
|
* Refinement
|
|
622
743
|
*/
|
|
623
744
|
export class Refinement extends AST {
|
|
745
|
+
from;
|
|
746
|
+
predicate;
|
|
747
|
+
annotations;
|
|
748
|
+
_tag = 20 /* ASTTag.Refinement */;
|
|
624
749
|
constructor(from, predicate, annotations = ASTAnnotationMap.empty) {
|
|
625
750
|
super();
|
|
626
751
|
this.from = from;
|
|
627
752
|
this.predicate = predicate;
|
|
628
753
|
this.annotations = annotations;
|
|
629
|
-
this._tag = 20 /* ASTTag.Refinement */;
|
|
630
754
|
}
|
|
631
755
|
decode(input, options) {
|
|
632
|
-
return this.predicate(input) ?
|
|
756
|
+
return this.predicate(input) ? tsplus_module_8.succeed(input) : tsplus_module_8.fail(tsplus_module_9.typeError(this, input));
|
|
633
757
|
}
|
|
634
758
|
clone(newProperties) {
|
|
635
759
|
return new Refinement(newProperties.from ?? this.from, newProperties.predicate ?? this.predicate, newProperties.annotations ?? this.annotations);
|
|
636
760
|
}
|
|
761
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
762
|
+
return hasTag(that, 20 /* ASTTag.Refinement */) && context.comparator(this.from, that.from) && context.comparator(this.predicate, that.predicate) && context.comparator(this.annotations, that.annotations);
|
|
763
|
+
}
|
|
637
764
|
}
|
|
638
765
|
/**
|
|
639
766
|
* @tsplus static fncts.schema.ASTOps createRefinement
|
|
@@ -649,6 +776,12 @@ export function isRefinement(self) {
|
|
|
649
776
|
* Transform
|
|
650
777
|
*/
|
|
651
778
|
export class Transform extends AST {
|
|
779
|
+
from;
|
|
780
|
+
to;
|
|
781
|
+
decode;
|
|
782
|
+
encode;
|
|
783
|
+
annotations;
|
|
784
|
+
_tag = 21 /* ASTTag.Transform */;
|
|
652
785
|
constructor(from, to, decode, encode, annotations = ASTAnnotationMap.empty) {
|
|
653
786
|
super();
|
|
654
787
|
this.from = from;
|
|
@@ -656,11 +789,13 @@ export class Transform extends AST {
|
|
|
656
789
|
this.decode = decode;
|
|
657
790
|
this.encode = encode;
|
|
658
791
|
this.annotations = annotations;
|
|
659
|
-
this._tag = 21 /* ASTTag.Transform */;
|
|
660
792
|
}
|
|
661
793
|
clone(newProperties) {
|
|
662
794
|
return new Transform(newProperties.from ?? this.from, newProperties.to ?? this.to, newProperties.decode ?? this.decode, newProperties.encode ?? this.encode, newProperties.annotations ?? this.annotations);
|
|
663
795
|
}
|
|
796
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
797
|
+
return hasTag(that, 21 /* ASTTag.Transform */) && context.comparator(this.from, that.from) && context.comparator(this.to, that.to) && context.comparator(this.decode, that.decode) && context.comparator(this.encode, that.encode) && context.comparator(this.annotations, that.annotations);
|
|
798
|
+
}
|
|
664
799
|
}
|
|
665
800
|
/**
|
|
666
801
|
* @tsplus static fncts.schema.ASTOps createTransform
|
|
@@ -672,16 +807,22 @@ export function createTransform(from, to, decode, encode, annotations) {
|
|
|
672
807
|
* Validation
|
|
673
808
|
*/
|
|
674
809
|
export class Validation extends AST {
|
|
810
|
+
from;
|
|
811
|
+
validation;
|
|
812
|
+
annotations;
|
|
813
|
+
_tag = 22 /* ASTTag.Validation */;
|
|
675
814
|
constructor(from, validation, annotations = ASTAnnotationMap.empty) {
|
|
676
815
|
super();
|
|
677
816
|
this.from = from;
|
|
678
817
|
this.validation = validation;
|
|
679
818
|
this.annotations = annotations;
|
|
680
|
-
this._tag = 22 /* ASTTag.Validation */;
|
|
681
819
|
}
|
|
682
820
|
clone(newProperties) {
|
|
683
821
|
return new Validation(newProperties.from ?? this.from, newProperties.validation ?? this.validation, newProperties.annotations ?? this.annotations);
|
|
684
822
|
}
|
|
823
|
+
[tsplus_module_1.equalsSymbol](that, context) {
|
|
824
|
+
return hasTag(that, 22 /* ASTTag.Validation */) && context.comparator(this.from, that.from) && context.comparator(this.validation, that.validation) && context.comparator(this.annotations, that.annotations);
|
|
825
|
+
}
|
|
685
826
|
}
|
|
686
827
|
/**
|
|
687
828
|
* @tsplus static fncts.schema.ASTOps createValidation
|
|
@@ -731,26 +872,26 @@ export function getCardinality(ast) {
|
|
|
731
872
|
}
|
|
732
873
|
}
|
|
733
874
|
function sortByAscendingCardinality(types) {
|
|
734
|
-
return
|
|
875
|
+
return tsplus_module_6.sort(tsplus_module_11.contramap(({
|
|
735
876
|
type
|
|
736
|
-
}) => getCardinality(type))(
|
|
877
|
+
}) => getCardinality(type))(tsplus_module_10.Ord))(types);
|
|
737
878
|
}
|
|
738
|
-
const OrdWeight = /*#__PURE__*/
|
|
739
|
-
const maxWeight = /*#__PURE__*/
|
|
879
|
+
const OrdWeight = /*#__PURE__*/tsplus_module_12.tuple(tsplus_module_10.Ord, tsplus_module_10.Ord, tsplus_module_10.Ord);
|
|
880
|
+
const maxWeight = /*#__PURE__*/tsplus_module_13.max(OrdWeight);
|
|
740
881
|
function maxWeightAll(weights) {
|
|
741
|
-
return
|
|
882
|
+
return tsplus_module_14.foldLeft(emptyWeight, (b, a) => maxWeight(b)(a))(weights);
|
|
742
883
|
}
|
|
743
884
|
const emptyWeight = [0, 0, 0];
|
|
744
885
|
export function getWeight(ast) {
|
|
745
886
|
void 0;
|
|
746
887
|
switch (ast._tag) {
|
|
747
888
|
case 0 /* ASTTag.Declaration */:
|
|
748
|
-
return
|
|
889
|
+
return tsplus_module_15.match(() => [6, 0, 0], ast => {
|
|
749
890
|
const [_, y, z] = getWeight(ast);
|
|
750
891
|
return [6, y, z];
|
|
751
|
-
})(ast.annotations.get(
|
|
892
|
+
})(ast.annotations.get(tsplus_module_4.Surrogate));
|
|
752
893
|
case 16 /* ASTTag.Tuple */:
|
|
753
|
-
return [2, ast.elements.length,
|
|
894
|
+
return [2, ast.elements.length, tsplus_module_15.match(() => 0, rest => rest.length)(ast.rest)];
|
|
754
895
|
case 17 /* ASTTag.TypeLiteral */:
|
|
755
896
|
{
|
|
756
897
|
const y = ast.propertySignatures.length;
|
|
@@ -758,7 +899,7 @@ export function getWeight(ast) {
|
|
|
758
899
|
return y + z === 0 ? [-4, 0, 0] : [4, y, z];
|
|
759
900
|
}
|
|
760
901
|
case 18 /* ASTTag.Union */:
|
|
761
|
-
return maxWeightAll(
|
|
902
|
+
return maxWeightAll(tsplus_module_6.map(getWeight)(ast.types));
|
|
762
903
|
case 19 /* ASTTag.Lazy */:
|
|
763
904
|
return [8, 0, 0];
|
|
764
905
|
case 20 /* ASTTag.Refinement */:
|
|
@@ -776,28 +917,28 @@ export function getWeight(ast) {
|
|
|
776
917
|
}
|
|
777
918
|
}
|
|
778
919
|
function sortByDescendingWeight(types) {
|
|
779
|
-
return
|
|
920
|
+
return tsplus_module_6.sort(tsplus_module_11.contramap(getWeight)(OrdWeight))(types);
|
|
780
921
|
}
|
|
781
922
|
function unify(candidates) {
|
|
782
|
-
let out =
|
|
923
|
+
let out = tsplus_module_6.flatMap(ast => {
|
|
783
924
|
void 0;
|
|
784
925
|
switch (ast._tag) {
|
|
785
926
|
case 5 /* ASTTag.NeverKeyword */:
|
|
786
|
-
return
|
|
927
|
+
return tsplus_module_6.empty();
|
|
787
928
|
case 18 /* ASTTag.Union */:
|
|
788
929
|
return ast.types;
|
|
789
930
|
default:
|
|
790
|
-
return
|
|
931
|
+
return tsplus_module_6.vector(ast);
|
|
791
932
|
}
|
|
792
933
|
})(candidates);
|
|
793
|
-
if (
|
|
794
|
-
out =
|
|
934
|
+
if (tsplus_module_6.some(isStringKeyword_1)(out)) {
|
|
935
|
+
out = tsplus_module_6.filter(m => !(isLiteral_1(m) && typeof m.literal === "string"))(out);
|
|
795
936
|
}
|
|
796
|
-
if (
|
|
797
|
-
out =
|
|
937
|
+
if (tsplus_module_6.some(isNumberKeyword_1)(out)) {
|
|
938
|
+
out = tsplus_module_6.filter(m => !(isLiteral_1(m) && typeof m.literal === "number"))(out);
|
|
798
939
|
}
|
|
799
|
-
if (
|
|
800
|
-
out =
|
|
940
|
+
if (tsplus_module_6.some(isSymbolKeyword_1)(out)) {
|
|
941
|
+
out = tsplus_module_6.filter(m => !isUniqueSymbol_1(m))(out);
|
|
801
942
|
}
|
|
802
943
|
return out;
|
|
803
944
|
}
|
|
@@ -826,10 +967,10 @@ export function setAnnotation(annotation, value) {
|
|
|
826
967
|
*/
|
|
827
968
|
export function appendRestElement(restElement) {
|
|
828
969
|
return self => {
|
|
829
|
-
if (
|
|
970
|
+
if (tsplus_module_16.isJust(self.rest)) {
|
|
830
971
|
throw new Error("A rest element cannot follow another rest element. ts(1265)");
|
|
831
972
|
}
|
|
832
|
-
return createTuple_1(self.elements,
|
|
973
|
+
return createTuple_1(self.elements, tsplus_module_7.just(tsplus_module_6.vector(restElement), fileName_1 + ":1313:43"), self.isReadonly, self.annotations);
|
|
833
974
|
};
|
|
834
975
|
}
|
|
835
976
|
/**
|
|
@@ -837,14 +978,14 @@ export function appendRestElement(restElement) {
|
|
|
837
978
|
*/
|
|
838
979
|
export function appendElement(element) {
|
|
839
980
|
return self => {
|
|
840
|
-
if (
|
|
981
|
+
if (tsplus_module_6.some(e => e.isOptional)(self.elements) && !element.isOptional) {
|
|
841
982
|
throw new Error("A required element cannot follow an optional element. ts(1257)");
|
|
842
983
|
}
|
|
843
|
-
return
|
|
984
|
+
return tsplus_module_15.match(() => createTuple_1(tsplus_module_6.append(element)(self.elements), tsplus_module_7.nothing(fileName_1 + ":1326:63"), self.isReadonly, self.annotations), rest => {
|
|
844
985
|
if (element.isOptional) {
|
|
845
986
|
throw new Error("A required element cannot follow an optional element. ts(1257)");
|
|
846
987
|
}
|
|
847
|
-
return createTuple_1(self.elements,
|
|
988
|
+
return createTuple_1(self.elements, tsplus_module_7.just(tsplus_module_6.append(element.type)(rest), fileName_1 + ":1331:47"), self.isReadonly, self.annotations);
|
|
848
989
|
})(self.rest);
|
|
849
990
|
};
|
|
850
991
|
}
|
|
@@ -858,21 +999,21 @@ function getPropertySignatures_1(self) {
|
|
|
858
999
|
void 0;
|
|
859
1000
|
switch (self._tag) {
|
|
860
1001
|
case 0 /* ASTTag.Declaration */:
|
|
861
|
-
return
|
|
1002
|
+
return tsplus_module_15.match(() => tsplus_module_6.empty(), surrogate => getPropertySignatures_1(surrogate))(self.annotations.get(tsplus_module_4.Surrogate));
|
|
862
1003
|
case 16 /* ASTTag.Tuple */:
|
|
863
|
-
return
|
|
1004
|
+
return tsplus_module_6.mapWithIndex((i, element) => createPropertySignature_1(i, element.type, element.isOptional, self.isReadonly))(self.elements);
|
|
864
1005
|
case 18 /* ASTTag.Union */:
|
|
865
1006
|
{
|
|
866
|
-
const propertySignatures =
|
|
867
|
-
return
|
|
1007
|
+
const propertySignatures = tsplus_module_6.map(getPropertySignatures_1)(self.types);
|
|
1008
|
+
return tsplus_module_6.filterMap(({
|
|
868
1009
|
name
|
|
869
1010
|
}) => {
|
|
870
|
-
if (
|
|
871
|
-
const members =
|
|
872
|
-
return
|
|
1011
|
+
if (tsplus_module_6.every(ps => tsplus_module_6.some(p => p.name === name)(ps))(propertySignatures)) {
|
|
1012
|
+
const members = tsplus_module_6.flatMap(ps => tsplus_module_6.filter(p => p.name === name)(ps))(propertySignatures);
|
|
1013
|
+
return tsplus_module_7.just(createPropertySignature_1(name, createUnion_1(tsplus_module_6.map(p => p.type)(members)), tsplus_module_6.some(p => p.isOptional)(members), tsplus_module_6.some(p => p.isReadonly)(members)), fileName_1 + ":1363:22");
|
|
873
1014
|
}
|
|
874
|
-
return
|
|
875
|
-
})(
|
|
1015
|
+
return tsplus_module_7.nothing(fileName_1 + ":1372:23");
|
|
1016
|
+
})(tsplus_module_6.unsafeGet(0)(propertySignatures));
|
|
876
1017
|
}
|
|
877
1018
|
case 17 /* ASTTag.TypeLiteral */:
|
|
878
1019
|
return self.propertySignatures;
|
|
@@ -883,7 +1024,7 @@ function getPropertySignatures_1(self) {
|
|
|
883
1024
|
case 21 /* ASTTag.Transform */:
|
|
884
1025
|
return getPropertySignatures_1(self.to);
|
|
885
1026
|
default:
|
|
886
|
-
return
|
|
1027
|
+
return tsplus_module_6.empty();
|
|
887
1028
|
}
|
|
888
1029
|
}
|
|
889
1030
|
/**
|
|
@@ -893,16 +1034,16 @@ function keysOf_1(ast) {
|
|
|
893
1034
|
void 0;
|
|
894
1035
|
switch (ast._tag) {
|
|
895
1036
|
case 0 /* ASTTag.Declaration */:
|
|
896
|
-
return
|
|
1037
|
+
return tsplus_module_15.match(() => tsplus_module_6.empty(), surrogate => keysOf_1(surrogate))(ast.annotations.get(tsplus_module_4.Surrogate));
|
|
897
1038
|
case 5 /* ASTTag.NeverKeyword */:
|
|
898
1039
|
case 7 /* ASTTag.AnyKeyword */:
|
|
899
|
-
return
|
|
1040
|
+
return tsplus_module_6.vector(stringKeyword_1, numberKeyword_1, symbolKeyword_1);
|
|
900
1041
|
case 8 /* ASTTag.StringKeyword */:
|
|
901
|
-
return
|
|
1042
|
+
return tsplus_module_6.vector(createLiteral_1("length"));
|
|
902
1043
|
case 17 /* ASTTag.TypeLiteral */:
|
|
903
|
-
return
|
|
1044
|
+
return tsplus_module_6.concat(tsplus_module_6.map(is => getParameter(is.parameter))(ast.indexSignatures))(tsplus_module_6.map(p => typeof p.name === "symbol" ? createUniqueSymbol_1(p.name) : createLiteral_1(p.name))(ast.propertySignatures));
|
|
904
1045
|
case 18 /* ASTTag.Union */:
|
|
905
|
-
return
|
|
1046
|
+
return tsplus_module_6.map(p => typeof p.name === "symbol" ? createUniqueSymbol_1(p.name) : createLiteral_1(p.name))(getPropertySignatures_1(ast));
|
|
906
1047
|
case 19 /* ASTTag.Lazy */:
|
|
907
1048
|
return keysOf_1(ast.getAST());
|
|
908
1049
|
case 20 /* ASTTag.Refinement */:
|
|
@@ -910,7 +1051,7 @@ function keysOf_1(ast) {
|
|
|
910
1051
|
case 21 /* ASTTag.Transform */:
|
|
911
1052
|
return keysOf_1(ast.to);
|
|
912
1053
|
default:
|
|
913
|
-
return
|
|
1054
|
+
return tsplus_module_6.empty();
|
|
914
1055
|
}
|
|
915
1056
|
}
|
|
916
1057
|
/**
|
|
@@ -923,8 +1064,8 @@ export function keyof(self) {
|
|
|
923
1064
|
* @tsplus static fncts.schema.ASTOps createRecord
|
|
924
1065
|
*/
|
|
925
1066
|
export function createRecord(key, value, isReadonly) {
|
|
926
|
-
const propertySignatures =
|
|
927
|
-
const indexSignatures =
|
|
1067
|
+
const propertySignatures = tsplus_module_6.emptyPushable();
|
|
1068
|
+
const indexSignatures = tsplus_module_6.emptyPushable();
|
|
928
1069
|
function go(key) {
|
|
929
1070
|
void 0;
|
|
930
1071
|
switch (key._tag) {
|
|
@@ -934,18 +1075,18 @@ export function createRecord(key, value, isReadonly) {
|
|
|
934
1075
|
case 12 /* ASTTag.SymbolKeyword */:
|
|
935
1076
|
case 15 /* ASTTag.TemplateLiteral */:
|
|
936
1077
|
case 20 /* ASTTag.Refinement */:
|
|
937
|
-
|
|
1078
|
+
tsplus_module_17.push(createIndexSignature_1(key, value, isReadonly))(indexSignatures);
|
|
938
1079
|
break;
|
|
939
1080
|
case 1 /* ASTTag.Literal */:
|
|
940
1081
|
if (typeof key.literal === "string" || typeof key.literal === "number") {
|
|
941
|
-
|
|
1082
|
+
tsplus_module_17.push(createPropertySignature_1(key.literal, value, false, isReadonly))(propertySignatures);
|
|
942
1083
|
}
|
|
943
1084
|
break;
|
|
944
1085
|
case 2 /* ASTTag.UniqueSymbol */:
|
|
945
|
-
|
|
1086
|
+
tsplus_module_17.push(createPropertySignature_1(key.symbol, value, false, isReadonly))(propertySignatures);
|
|
946
1087
|
break;
|
|
947
1088
|
case 18 /* ASTTag.Union */:
|
|
948
|
-
|
|
1089
|
+
tsplus_module_6.forEach(go)(key.types);
|
|
949
1090
|
break;
|
|
950
1091
|
default:
|
|
951
1092
|
throw new Error(`createRecord: Unsupported key\n${show(key)}`);
|
|
@@ -959,7 +1100,7 @@ export function createRecord(key, value, isReadonly) {
|
|
|
959
1100
|
*/
|
|
960
1101
|
export function pick(keys) {
|
|
961
1102
|
return self => {
|
|
962
|
-
return createTypeLiteral_1(
|
|
1103
|
+
return createTypeLiteral_1(tsplus_module_6.filter(ps => tsplus_module_6.includes(ps.name)(keys))(getPropertySignatures_1(self)), tsplus_module_6.empty());
|
|
963
1104
|
};
|
|
964
1105
|
}
|
|
965
1106
|
/**
|
|
@@ -967,7 +1108,7 @@ export function pick(keys) {
|
|
|
967
1108
|
*/
|
|
968
1109
|
export function omit(keys) {
|
|
969
1110
|
return self => {
|
|
970
|
-
return createTypeLiteral_1(
|
|
1111
|
+
return createTypeLiteral_1(tsplus_module_6.filter(ps => !tsplus_module_6.includes(ps.name)(keys))(getPropertySignatures_1(self)), tsplus_module_6.empty());
|
|
971
1112
|
};
|
|
972
1113
|
}
|
|
973
1114
|
/**
|
|
@@ -977,11 +1118,11 @@ function partial_1(self) {
|
|
|
977
1118
|
void 0;
|
|
978
1119
|
switch (self._tag) {
|
|
979
1120
|
case 16 /* ASTTag.Tuple */:
|
|
980
|
-
return createTuple_1(
|
|
1121
|
+
return createTuple_1(tsplus_module_6.map(e => createElement_1(e.type, true))(self.elements), tsplus_module_18.map(rest => tsplus_module_6.vector(createUnion_1(tsplus_module_6.append(undefinedKeyword_1)(rest))))(self.rest), self.isReadonly);
|
|
981
1122
|
case 17 /* ASTTag.TypeLiteral */:
|
|
982
|
-
return createTypeLiteral_1(
|
|
1123
|
+
return createTypeLiteral_1(tsplus_module_6.map(f => createPropertySignature_1(f.name, f.type, true, f.isReadonly, f.annotations))(self.propertySignatures), self.indexSignatures);
|
|
983
1124
|
case 18 /* ASTTag.Union */:
|
|
984
|
-
return createUnion_1(
|
|
1125
|
+
return createUnion_1(tsplus_module_6.map(partial_1)(self.types));
|
|
985
1126
|
case 19 /* ASTTag.Lazy */:
|
|
986
1127
|
return createLazy_1(() => partial_1(self.getAST()));
|
|
987
1128
|
case 20 /* ASTTag.Refinement */:
|
|
@@ -1006,18 +1147,18 @@ function getFrom_1(ast) {
|
|
|
1006
1147
|
switch (ast._tag) {
|
|
1007
1148
|
case 0 /* ASTTag.Declaration */:
|
|
1008
1149
|
{
|
|
1009
|
-
const surrogate = ast.annotations.get(
|
|
1010
|
-
if (
|
|
1150
|
+
const surrogate = ast.annotations.get(tsplus_module_4.Surrogate);
|
|
1151
|
+
if (tsplus_module_16.isJust(surrogate)) {
|
|
1011
1152
|
return getFrom_1(surrogate.value);
|
|
1012
1153
|
}
|
|
1013
1154
|
break;
|
|
1014
1155
|
}
|
|
1015
1156
|
case 16 /* ASTTag.Tuple */:
|
|
1016
|
-
return createTuple_1(
|
|
1157
|
+
return createTuple_1(tsplus_module_6.map(element => createElement_1(getFrom_1(element.type), element.isOptional))(ast.elements), tsplus_module_18.map(restElement => tsplus_module_6.map(getFrom_1)(restElement))(ast.rest), ast.isReadonly, ast.annotations);
|
|
1017
1158
|
case 17 /* ASTTag.TypeLiteral */:
|
|
1018
|
-
return createTypeLiteral_1(
|
|
1159
|
+
return createTypeLiteral_1(tsplus_module_6.map(ps => createPropertySignature_1(ps.name, getFrom_1(ps.type), ps.isOptional, ps.isReadonly, ps.annotations))(ast.propertySignatures), tsplus_module_6.map(is => createIndexSignature_1(is.parameter, getFrom_1(is.type), is.isReadonly))(ast.indexSignatures), ast.annotations);
|
|
1019
1160
|
case 18 /* ASTTag.Union */:
|
|
1020
|
-
return createUnion_1(
|
|
1161
|
+
return createUnion_1(tsplus_module_6.map(getFrom_1)(ast.types), ast.annotations);
|
|
1021
1162
|
case 19 /* ASTTag.Lazy */:
|
|
1022
1163
|
return createLazy_1(() => getFrom_1(ast.getAST()), ast.annotations);
|
|
1023
1164
|
case 20 /* ASTTag.Refinement */:
|
|
@@ -1034,18 +1175,18 @@ function getTo_1(ast) {
|
|
|
1034
1175
|
switch (ast._tag) {
|
|
1035
1176
|
case 0 /* ASTTag.Declaration */:
|
|
1036
1177
|
{
|
|
1037
|
-
const surrogate = ast.annotations.get(
|
|
1038
|
-
if (
|
|
1178
|
+
const surrogate = ast.annotations.get(tsplus_module_4.Surrogate);
|
|
1179
|
+
if (tsplus_module_16.isJust(surrogate)) {
|
|
1039
1180
|
return getTo_1(surrogate.value);
|
|
1040
1181
|
}
|
|
1041
1182
|
break;
|
|
1042
1183
|
}
|
|
1043
1184
|
case 16 /* ASTTag.Tuple */:
|
|
1044
|
-
return createTuple_1(
|
|
1185
|
+
return createTuple_1(tsplus_module_6.map(element => createElement_1(getTo_1(element.type), element.isOptional))(ast.elements), tsplus_module_18.map(restElement => tsplus_module_6.map(getTo_1)(restElement))(ast.rest), ast.isReadonly, ast.annotations);
|
|
1045
1186
|
case 17 /* ASTTag.TypeLiteral */:
|
|
1046
|
-
return createTypeLiteral_1(
|
|
1187
|
+
return createTypeLiteral_1(tsplus_module_6.map(ps => createPropertySignature_1(ps.name, getTo_1(ps.type), ps.isOptional, ps.isReadonly, ps.annotations))(ast.propertySignatures), tsplus_module_6.map(is => createIndexSignature_1(is.parameter, getTo_1(is.type), is.isReadonly))(ast.indexSignatures), ast.annotations);
|
|
1047
1188
|
case 18 /* ASTTag.Union */:
|
|
1048
|
-
return createUnion_1(
|
|
1189
|
+
return createUnion_1(tsplus_module_6.map(getTo_1)(ast.types), ast.annotations);
|
|
1049
1190
|
case 19 /* ASTTag.Lazy */:
|
|
1050
1191
|
return createLazy_1(() => getTo_1(ast.getAST()), ast.annotations);
|
|
1051
1192
|
case 20 /* ASTTag.Refinement */:
|
|
@@ -1070,8 +1211,8 @@ export function getLiterals(ast, isDecoding) {
|
|
|
1070
1211
|
switch (ast._tag) {
|
|
1071
1212
|
case 0 /* ASTTag.Declaration */:
|
|
1072
1213
|
{
|
|
1073
|
-
const surrogate = ast.annotations.get(
|
|
1074
|
-
if (
|
|
1214
|
+
const surrogate = ast.annotations.get(tsplus_module_4.Surrogate);
|
|
1215
|
+
if (tsplus_module_16.isJust(surrogate)) {
|
|
1075
1216
|
return getLiterals(surrogate.value, isDecoding);
|
|
1076
1217
|
}
|
|
1077
1218
|
break;
|
|
@@ -1080,7 +1221,7 @@ export function getLiterals(ast, isDecoding) {
|
|
|
1080
1221
|
{
|
|
1081
1222
|
const out = [];
|
|
1082
1223
|
for (let i = 0; i < ast.propertySignatures.length; i++) {
|
|
1083
|
-
const propertySignature =
|
|
1224
|
+
const propertySignature = tsplus_module_6.unsafeGet(i)(ast.propertySignatures);
|
|
1084
1225
|
if (isLiteral_1(propertySignature.type) && !propertySignature.isOptional) {
|
|
1085
1226
|
out.push([propertySignature.name, propertySignature.type]);
|
|
1086
1227
|
}
|
|
@@ -1098,28 +1239,28 @@ export function getSearchTree(members, isDecoding) {
|
|
|
1098
1239
|
const keys = {};
|
|
1099
1240
|
const otherwise = [];
|
|
1100
1241
|
for (let i = 0; i < members.length; i++) {
|
|
1101
|
-
const member =
|
|
1242
|
+
const member = tsplus_module_6.unsafeGet(i)(members);
|
|
1102
1243
|
const tags = getLiterals(member, isDecoding);
|
|
1103
1244
|
if (tags.length > 0) {
|
|
1104
1245
|
for (let j = 0; j < tags.length; j++) {
|
|
1105
1246
|
const [key, literal] = tags[j];
|
|
1106
1247
|
const hash = String(literal.literal);
|
|
1107
|
-
keys[key]
|
|
1248
|
+
keys[key] ||= {
|
|
1108
1249
|
buckets: {},
|
|
1109
1250
|
ast: neverKeyword_1,
|
|
1110
1251
|
literals: []
|
|
1111
|
-
}
|
|
1252
|
+
};
|
|
1112
1253
|
const buckets = keys[key].buckets;
|
|
1113
1254
|
if (Object.prototype.hasOwnProperty.call(buckets, hash)) {
|
|
1114
1255
|
if (j < tags.length - 1) {
|
|
1115
1256
|
continue;
|
|
1116
1257
|
}
|
|
1117
1258
|
buckets[hash].push(member);
|
|
1118
|
-
keys[key].ast = createUnion_1(
|
|
1259
|
+
keys[key].ast = createUnion_1(tsplus_module_6.vector(keys[key].ast, literal));
|
|
1119
1260
|
keys[key].literals.push(literal);
|
|
1120
1261
|
} else {
|
|
1121
1262
|
buckets[hash] = [member];
|
|
1122
|
-
keys[key].ast = createUnion_1(
|
|
1263
|
+
keys[key].ast = createUnion_1(tsplus_module_6.vector(keys[key].ast, literal));
|
|
1123
1264
|
keys[key].literals.push(literal);
|
|
1124
1265
|
break;
|
|
1125
1266
|
}
|
|
@@ -1139,10 +1280,10 @@ export function getSearchTree(members, isDecoding) {
|
|
|
1139
1280
|
export function getFormattedExpected(verbose = false) {
|
|
1140
1281
|
return self => {
|
|
1141
1282
|
if (verbose) {
|
|
1142
|
-
const description =
|
|
1143
|
-
return
|
|
1283
|
+
const description = tsplus_module_18.orElse(() => self.annotations.get(tsplus_module_4.Title))(self.annotations.get(tsplus_module_4.Description));
|
|
1284
|
+
return tsplus_module_15.match(() => description, identifier => tsplus_module_15.match(() => tsplus_module_7.just(identifier, fileName_1 + ":1710:23"), description => tsplus_module_7.just(`${identifier} (${description})`, fileName_1 + ":1711:34"))(description))(self.annotations.get(tsplus_module_4.Identifier));
|
|
1144
1285
|
} else {
|
|
1145
|
-
return
|
|
1286
|
+
return tsplus_module_18.orElse(() => self.annotations.get(tsplus_module_4.Description))(tsplus_module_18.orElse(() => self.annotations.get(tsplus_module_4.Title))(self.annotations.get(tsplus_module_4.Identifier)));
|
|
1146
1287
|
}
|
|
1147
1288
|
};
|
|
1148
1289
|
}
|