typia 5.2.5 → 5.2.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 (64) hide show
  1. package/lib/factories/ExpressionFactory.d.ts +1 -0
  2. package/lib/factories/ExpressionFactory.js +5 -0
  3. package/lib/factories/ExpressionFactory.js.map +1 -1
  4. package/lib/programmers/CheckerProgrammer.js +4 -4
  5. package/lib/programmers/CheckerProgrammer.js.map +1 -1
  6. package/lib/programmers/RandomProgrammer.js +16 -18
  7. package/lib/programmers/RandomProgrammer.js.map +1 -1
  8. package/lib/programmers/ValidateProgrammer.js +2 -1
  9. package/lib/programmers/ValidateProgrammer.js.map +1 -1
  10. package/lib/programmers/helpers/RandomJoiner.js +4 -6
  11. package/lib/programmers/helpers/RandomJoiner.js.map +1 -1
  12. package/lib/programmers/helpers/RandomRanger.js +3 -2
  13. package/lib/programmers/helpers/RandomRanger.js.map +1 -1
  14. package/lib/programmers/http/HttpHeadersProgrammer.js +1 -1
  15. package/lib/programmers/http/HttpHeadersProgrammer.js.map +1 -1
  16. package/lib/programmers/internal/check_dynamic_properties.js +4 -3
  17. package/lib/programmers/internal/check_dynamic_properties.js.map +1 -1
  18. package/lib/programmers/internal/check_union_array_like.js +3 -2
  19. package/lib/programmers/internal/check_union_array_like.js.map +1 -1
  20. package/lib/programmers/json/JsonStringifyProgrammer.js +1 -3
  21. package/lib/programmers/json/JsonStringifyProgrammer.js.map +1 -1
  22. package/lib/programmers/misc/MiscCloneProgrammer.js +1 -3
  23. package/lib/programmers/misc/MiscCloneProgrammer.js.map +1 -1
  24. package/lib/programmers/misc/MiscLiteralsProgrammer.js +1 -1
  25. package/lib/programmers/misc/MiscLiteralsProgrammer.js.map +1 -1
  26. package/lib/programmers/misc/MiscPruneProgrammer.js +1 -3
  27. package/lib/programmers/misc/MiscPruneProgrammer.js.map +1 -1
  28. package/lib/programmers/notations/NotationGeneralProgrammer.js +1 -3
  29. package/lib/programmers/notations/NotationGeneralProgrammer.js.map +1 -1
  30. package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js +6 -6
  31. package/lib/programmers/protobuf/ProtobufDecodeProgrammer.js.map +1 -1
  32. package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js +2 -2
  33. package/lib/programmers/protobuf/ProtobufEncodeProgrammer.js.map +1 -1
  34. package/package.json +1 -1
  35. package/src/Primitive.ts +135 -135
  36. package/src/executable/TypiaSetupWizard.ts +142 -142
  37. package/src/executable/setup/CommandExecutor.ts +8 -8
  38. package/src/factories/ExpressionFactory.ts +8 -0
  39. package/src/factories/JsonMetadataFactory.ts +50 -50
  40. package/src/factories/MetadataCollection.ts +282 -282
  41. package/src/factories/internal/metadata/emplace_metadata_object.ts +178 -178
  42. package/src/functional/$stoll.ts +8 -8
  43. package/src/functional/Namespace.ts +168 -168
  44. package/src/programmers/AssertProgrammer.ts +322 -322
  45. package/src/programmers/CheckerProgrammer.ts +4 -4
  46. package/src/programmers/IsProgrammer.ts +258 -258
  47. package/src/programmers/RandomProgrammer.ts +16 -17
  48. package/src/programmers/ValidateProgrammer.ts +350 -349
  49. package/src/programmers/helpers/AtomicPredicator.ts +31 -31
  50. package/src/programmers/helpers/RandomJoiner.ts +4 -6
  51. package/src/programmers/helpers/RandomRanger.ts +4 -2
  52. package/src/programmers/http/HttpHeadersProgrammer.ts +1 -1
  53. package/src/programmers/internal/check_dynamic_key.ts +178 -178
  54. package/src/programmers/internal/check_dynamic_properties.ts +202 -201
  55. package/src/programmers/internal/check_object.ts +62 -62
  56. package/src/programmers/internal/check_union_array_like.ts +4 -3
  57. package/src/programmers/json/JsonStringifyProgrammer.ts +960 -964
  58. package/src/programmers/misc/MiscCloneProgrammer.ts +786 -790
  59. package/src/programmers/misc/MiscLiteralsProgrammer.ts +1 -1
  60. package/src/programmers/misc/MiscPruneProgrammer.ts +548 -552
  61. package/src/programmers/notations/NotationGeneralProgrammer.ts +716 -720
  62. package/src/programmers/protobuf/ProtobufDecodeProgrammer.ts +7 -9
  63. package/src/programmers/protobuf/ProtobufEncodeProgrammer.ts +882 -882
  64. package/src/transform.ts +35 -35
@@ -1,349 +1,350 @@
1
- import ts from "typescript";
2
-
3
- import { IdentifierFactory } from "../factories/IdentifierFactory";
4
- import { StatementFactory } from "../factories/StatementFactory";
5
- import { TypeFactory } from "../factories/TypeFactory";
6
-
7
- import { IProject } from "../transformers/IProject";
8
-
9
- import { CheckerProgrammer } from "./CheckerProgrammer";
10
- import { IsProgrammer } from "./IsProgrammer";
11
- import { FunctionImporter } from "./helpers/FunctionImporeter";
12
- import { OptionPredicator } from "./helpers/OptionPredicator";
13
- import { check_everything } from "./internal/check_everything";
14
- import { check_object } from "./internal/check_object";
15
-
16
- export namespace ValidateProgrammer {
17
- export const write =
18
- (project: IProject) =>
19
- (modulo: ts.LeftHandSideExpression) =>
20
- (equals: boolean) =>
21
- (type: ts.Type, name?: string) => {
22
- const importer: FunctionImporter = new FunctionImporter(
23
- modulo.getText(),
24
- );
25
-
26
- const is = IsProgrammer.write(project)(modulo, true)(equals)(
27
- type,
28
- name ?? TypeFactory.getFullName(project.checker)(type),
29
- );
30
- const validate: ts.ArrowFunction = CheckerProgrammer.write(project)(
31
- {
32
- prefix: "$v",
33
- path: true,
34
- trace: true,
35
- numeric: OptionPredicator.numeric(project.options),
36
- equals,
37
- atomist: (explore) => (entry) => (input) =>
38
- [
39
- ...(entry.expression ? [entry.expression] : []),
40
- ...(entry.conditions.length === 0
41
- ? []
42
- : entry.conditions.length === 1
43
- ? entry.conditions[0]!.map((cond) =>
44
- ts.factory.createLogicalOr(
45
- cond.expression,
46
- create_report_call(
47
- explore.from === "top"
48
- ? ts.factory.createTrue()
49
- : ts.factory.createIdentifier(
50
- "_exceptionable",
51
- ),
52
- )(
53
- ts.factory.createIdentifier(
54
- explore.postfix
55
- ? `_path + ${explore.postfix}`
56
- : "_path",
57
- ),
58
- cond.expected,
59
- input,
60
- ),
61
- ),
62
- )
63
- : [
64
- ts.factory.createLogicalOr(
65
- entry.conditions
66
- .map((set) =>
67
- set
68
- .map((s) => s.expression)
69
- .reduce((a, b) =>
70
- ts.factory.createLogicalAnd(
71
- a,
72
- b,
73
- ),
74
- ),
75
- )
76
- .reduce((a, b) =>
77
- ts.factory.createLogicalOr(
78
- a,
79
- b,
80
- ),
81
- ),
82
- create_report_call(
83
- explore.from === "top"
84
- ? ts.factory.createTrue()
85
- : ts.factory.createIdentifier(
86
- "_exceptionable",
87
- ),
88
- )(
89
- ts.factory.createIdentifier(
90
- explore.postfix
91
- ? `_path + ${explore.postfix}`
92
- : "_path",
93
- ),
94
- entry.expected,
95
- input,
96
- ),
97
- ),
98
- ]),
99
- ].reduce((x, y) => ts.factory.createLogicalAnd(x, y)),
100
- combiner: combine(equals)(project)(importer),
101
- joiner: joiner(equals)(project)(importer),
102
- success: ts.factory.createTrue(),
103
- addition: () => importer.declare(modulo),
104
- },
105
- )(importer)(type, name);
106
-
107
- return ts.factory.createArrowFunction(
108
- undefined,
109
- undefined,
110
- [
111
- IdentifierFactory.parameter(
112
- "input",
113
- TypeFactory.keyword("any"),
114
- ),
115
- ],
116
- ts.factory.createTypeReferenceNode(
117
- `typia.IValidation<${
118
- name ?? TypeFactory.getFullName(project.checker)(type)
119
- }>`,
120
- ),
121
- undefined,
122
- ts.factory.createBlock(
123
- [
124
- StatementFactory.constant(
125
- "errors",
126
- ts.factory.createAsExpression(
127
- ts.factory.createArrayLiteralExpression([]),
128
- ts.factory.createArrayTypeNode(
129
- TypeFactory.keyword("any"),
130
- ),
131
- ),
132
- ),
133
- StatementFactory.constant("__is", is),
134
- ts.factory.createIfStatement(
135
- ts.factory.createStrictEquality(
136
- ts.factory.createFalse(),
137
- ts.factory.createCallExpression(
138
- ts.factory.createIdentifier("__is"),
139
- undefined,
140
- [ts.factory.createIdentifier("input")],
141
- ),
142
- ),
143
- ts.factory.createBlock([
144
- StatementFactory.constant(
145
- "$report",
146
- ts.factory.createCallExpression(
147
- IdentifierFactory.access(
148
- ts.factory.createParenthesizedExpression(
149
- ts.factory.createAsExpression(
150
- modulo,
151
- TypeFactory.keyword("any"),
152
- ),
153
- ),
154
- )("report"),
155
- [],
156
- [ts.factory.createIdentifier("errors")],
157
- ),
158
- ),
159
- ts.factory.createExpressionStatement(
160
- ts.factory.createCallExpression(
161
- validate,
162
- undefined,
163
- [
164
- ts.factory.createIdentifier(
165
- "input",
166
- ),
167
- ts.factory.createStringLiteral(
168
- "$input",
169
- ),
170
- ts.factory.createTrue(),
171
- ],
172
- ),
173
- ),
174
- ]),
175
- ),
176
- StatementFactory.constant(
177
- "success",
178
- ts.factory.createStrictEquality(
179
- ts.factory.createNumericLiteral(0),
180
- ts.factory.createIdentifier("errors.length"),
181
- ),
182
- ),
183
- ts.factory.createReturnStatement(
184
- ts.factory.createAsExpression(
185
- create_output(),
186
- TypeFactory.keyword("any"),
187
- ),
188
- ),
189
- ],
190
- true,
191
- ),
192
- );
193
- };
194
- }
195
-
196
- const combine =
197
- (equals: boolean) =>
198
- (project: IProject) =>
199
- (importer: FunctionImporter): CheckerProgrammer.IConfig.Combiner =>
200
- (explore: CheckerProgrammer.IExplore) => {
201
- if (explore.tracable === false)
202
- return IsProgrammer.configure({
203
- object: validate_object(equals)(project)(importer),
204
- numeric: true,
205
- })(project)(importer).combiner(explore);
206
-
207
- const path: string = explore.postfix
208
- ? `_path + ${explore.postfix}`
209
- : "_path";
210
- return (logic) => (input, binaries, expected) =>
211
- logic === "and"
212
- ? binaries
213
- .map((binary) =>
214
- binary.combined
215
- ? binary.expression
216
- : ts.factory.createLogicalOr(
217
- binary.expression,
218
- create_report_call(
219
- explore.source === "top"
220
- ? ts.factory.createTrue()
221
- : ts.factory.createIdentifier(
222
- "_exceptionable",
223
- ),
224
- )(
225
- ts.factory.createIdentifier(path),
226
- expected,
227
- input,
228
- ),
229
- ),
230
- )
231
- .reduce(ts.factory.createLogicalAnd)
232
- : ts.factory.createLogicalOr(
233
- binaries
234
- .map((binary) => binary.expression)
235
- .reduce(ts.factory.createLogicalOr),
236
- create_report_call(
237
- explore.source === "top"
238
- ? ts.factory.createTrue()
239
- : ts.factory.createIdentifier("_exceptionable"),
240
- )(ts.factory.createIdentifier(path), expected, input),
241
- );
242
- };
243
-
244
- const validate_object =
245
- (equals: boolean) => (project: IProject) => (importer: FunctionImporter) =>
246
- check_object({
247
- equals,
248
- undefined: true,
249
- assert: false,
250
- reduce: ts.factory.createLogicalAnd,
251
- positive: ts.factory.createTrue(),
252
- superfluous: (value) =>
253
- create_report_call()(
254
- ts.factory.createAdd(
255
- ts.factory.createIdentifier("_path"),
256
- ts.factory.createCallExpression(
257
- importer.use("join"),
258
- undefined,
259
- [ts.factory.createIdentifier("key")],
260
- ),
261
- ),
262
- "undefined",
263
- value,
264
- ),
265
- halt: (expr) =>
266
- ts.factory.createLogicalOr(
267
- ts.factory.createStrictEquality(
268
- ts.factory.createFalse(),
269
- ts.factory.createIdentifier("_exceptionable"),
270
- ),
271
- expr,
272
- ),
273
- })(project)(importer);
274
-
275
- const joiner =
276
- (equals: boolean) =>
277
- (project: IProject) =>
278
- (importer: FunctionImporter): CheckerProgrammer.IConfig.IJoiner => ({
279
- object: validate_object(equals)(project)(importer),
280
- array: (input, arrow) =>
281
- check_everything(
282
- ts.factory.createCallExpression(
283
- IdentifierFactory.access(input)("map"),
284
- undefined,
285
- [arrow],
286
- ),
287
- ),
288
- failure: (value, expected, explore) =>
289
- create_report_call(
290
- explore?.from === "top"
291
- ? ts.factory.createTrue()
292
- : ts.factory.createIdentifier("_exceptionable"),
293
- )(
294
- ts.factory.createIdentifier(
295
- explore?.postfix ? `_path + ${explore.postfix}` : "_path",
296
- ),
297
- expected,
298
- value,
299
- ),
300
- tuple: (binaries) =>
301
- check_everything(
302
- ts.factory.createArrayLiteralExpression(binaries, true),
303
- ),
304
- });
305
-
306
- const create_output = () =>
307
- ts.factory.createObjectLiteralExpression(
308
- [
309
- ts.factory.createShorthandPropertyAssignment("success"),
310
- ts.factory.createShorthandPropertyAssignment("errors"),
311
- ts.factory.createPropertyAssignment(
312
- "data",
313
- ts.factory.createConditionalExpression(
314
- ts.factory.createIdentifier("success"),
315
- undefined,
316
- ts.factory.createIdentifier("input"),
317
- undefined,
318
- ts.factory.createIdentifier("undefined"),
319
- ),
320
- ),
321
- ],
322
- true,
323
- );
324
-
325
- const create_report_call =
326
- (exceptionable?: ts.Expression) =>
327
- (
328
- path: ts.Expression,
329
- expected: string,
330
- value: ts.Expression,
331
- ): ts.Expression =>
332
- ts.factory.createCallExpression(
333
- ts.factory.createIdentifier("$report"),
334
- undefined,
335
- [
336
- exceptionable ?? ts.factory.createIdentifier("_exceptionable"),
337
- ts.factory.createObjectLiteralExpression(
338
- [
339
- ts.factory.createPropertyAssignment("path", path),
340
- ts.factory.createPropertyAssignment(
341
- "expected",
342
- ts.factory.createStringLiteral(expected),
343
- ),
344
- ts.factory.createPropertyAssignment("value", value),
345
- ],
346
- true,
347
- ),
348
- ],
349
- );
1
+ import ts from "typescript";
2
+
3
+ import { ExpressionFactory } from "../factories/ExpressionFactory";
4
+ import { IdentifierFactory } from "../factories/IdentifierFactory";
5
+ import { StatementFactory } from "../factories/StatementFactory";
6
+ import { TypeFactory } from "../factories/TypeFactory";
7
+
8
+ import { IProject } from "../transformers/IProject";
9
+
10
+ import { CheckerProgrammer } from "./CheckerProgrammer";
11
+ import { IsProgrammer } from "./IsProgrammer";
12
+ import { FunctionImporter } from "./helpers/FunctionImporeter";
13
+ import { OptionPredicator } from "./helpers/OptionPredicator";
14
+ import { check_everything } from "./internal/check_everything";
15
+ import { check_object } from "./internal/check_object";
16
+
17
+ export namespace ValidateProgrammer {
18
+ export const write =
19
+ (project: IProject) =>
20
+ (modulo: ts.LeftHandSideExpression) =>
21
+ (equals: boolean) =>
22
+ (type: ts.Type, name?: string) => {
23
+ const importer: FunctionImporter = new FunctionImporter(
24
+ modulo.getText(),
25
+ );
26
+
27
+ const is = IsProgrammer.write(project)(modulo, true)(equals)(
28
+ type,
29
+ name ?? TypeFactory.getFullName(project.checker)(type),
30
+ );
31
+ const validate: ts.ArrowFunction = CheckerProgrammer.write(project)(
32
+ {
33
+ prefix: "$v",
34
+ path: true,
35
+ trace: true,
36
+ numeric: OptionPredicator.numeric(project.options),
37
+ equals,
38
+ atomist: (explore) => (entry) => (input) =>
39
+ [
40
+ ...(entry.expression ? [entry.expression] : []),
41
+ ...(entry.conditions.length === 0
42
+ ? []
43
+ : entry.conditions.length === 1
44
+ ? entry.conditions[0]!.map((cond) =>
45
+ ts.factory.createLogicalOr(
46
+ cond.expression,
47
+ create_report_call(
48
+ explore.from === "top"
49
+ ? ts.factory.createTrue()
50
+ : ts.factory.createIdentifier(
51
+ "_exceptionable",
52
+ ),
53
+ )(
54
+ ts.factory.createIdentifier(
55
+ explore.postfix
56
+ ? `_path + ${explore.postfix}`
57
+ : "_path",
58
+ ),
59
+ cond.expected,
60
+ input,
61
+ ),
62
+ ),
63
+ )
64
+ : [
65
+ ts.factory.createLogicalOr(
66
+ entry.conditions
67
+ .map((set) =>
68
+ set
69
+ .map((s) => s.expression)
70
+ .reduce((a, b) =>
71
+ ts.factory.createLogicalAnd(
72
+ a,
73
+ b,
74
+ ),
75
+ ),
76
+ )
77
+ .reduce((a, b) =>
78
+ ts.factory.createLogicalOr(
79
+ a,
80
+ b,
81
+ ),
82
+ ),
83
+ create_report_call(
84
+ explore.from === "top"
85
+ ? ts.factory.createTrue()
86
+ : ts.factory.createIdentifier(
87
+ "_exceptionable",
88
+ ),
89
+ )(
90
+ ts.factory.createIdentifier(
91
+ explore.postfix
92
+ ? `_path + ${explore.postfix}`
93
+ : "_path",
94
+ ),
95
+ entry.expected,
96
+ input,
97
+ ),
98
+ ),
99
+ ]),
100
+ ].reduce((x, y) => ts.factory.createLogicalAnd(x, y)),
101
+ combiner: combine(equals)(project)(importer),
102
+ joiner: joiner(equals)(project)(importer),
103
+ success: ts.factory.createTrue(),
104
+ addition: () => importer.declare(modulo),
105
+ },
106
+ )(importer)(type, name);
107
+
108
+ return ts.factory.createArrowFunction(
109
+ undefined,
110
+ undefined,
111
+ [
112
+ IdentifierFactory.parameter(
113
+ "input",
114
+ TypeFactory.keyword("any"),
115
+ ),
116
+ ],
117
+ ts.factory.createTypeReferenceNode(
118
+ `typia.IValidation<${
119
+ name ?? TypeFactory.getFullName(project.checker)(type)
120
+ }>`,
121
+ ),
122
+ undefined,
123
+ ts.factory.createBlock(
124
+ [
125
+ StatementFactory.constant(
126
+ "errors",
127
+ ts.factory.createAsExpression(
128
+ ts.factory.createArrayLiteralExpression([]),
129
+ ts.factory.createArrayTypeNode(
130
+ TypeFactory.keyword("any"),
131
+ ),
132
+ ),
133
+ ),
134
+ StatementFactory.constant("__is", is),
135
+ ts.factory.createIfStatement(
136
+ ts.factory.createStrictEquality(
137
+ ts.factory.createFalse(),
138
+ ts.factory.createCallExpression(
139
+ ts.factory.createIdentifier("__is"),
140
+ undefined,
141
+ [ts.factory.createIdentifier("input")],
142
+ ),
143
+ ),
144
+ ts.factory.createBlock([
145
+ StatementFactory.constant(
146
+ "$report",
147
+ ts.factory.createCallExpression(
148
+ IdentifierFactory.access(
149
+ ts.factory.createParenthesizedExpression(
150
+ ts.factory.createAsExpression(
151
+ modulo,
152
+ TypeFactory.keyword("any"),
153
+ ),
154
+ ),
155
+ )("report"),
156
+ [],
157
+ [ts.factory.createIdentifier("errors")],
158
+ ),
159
+ ),
160
+ ts.factory.createExpressionStatement(
161
+ ts.factory.createCallExpression(
162
+ validate,
163
+ undefined,
164
+ [
165
+ ts.factory.createIdentifier(
166
+ "input",
167
+ ),
168
+ ts.factory.createStringLiteral(
169
+ "$input",
170
+ ),
171
+ ts.factory.createTrue(),
172
+ ],
173
+ ),
174
+ ),
175
+ ]),
176
+ ),
177
+ StatementFactory.constant(
178
+ "success",
179
+ ts.factory.createStrictEquality(
180
+ ExpressionFactory.number(0),
181
+ ts.factory.createIdentifier("errors.length"),
182
+ ),
183
+ ),
184
+ ts.factory.createReturnStatement(
185
+ ts.factory.createAsExpression(
186
+ create_output(),
187
+ TypeFactory.keyword("any"),
188
+ ),
189
+ ),
190
+ ],
191
+ true,
192
+ ),
193
+ );
194
+ };
195
+ }
196
+
197
+ const combine =
198
+ (equals: boolean) =>
199
+ (project: IProject) =>
200
+ (importer: FunctionImporter): CheckerProgrammer.IConfig.Combiner =>
201
+ (explore: CheckerProgrammer.IExplore) => {
202
+ if (explore.tracable === false)
203
+ return IsProgrammer.configure({
204
+ object: validate_object(equals)(project)(importer),
205
+ numeric: true,
206
+ })(project)(importer).combiner(explore);
207
+
208
+ const path: string = explore.postfix
209
+ ? `_path + ${explore.postfix}`
210
+ : "_path";
211
+ return (logic) => (input, binaries, expected) =>
212
+ logic === "and"
213
+ ? binaries
214
+ .map((binary) =>
215
+ binary.combined
216
+ ? binary.expression
217
+ : ts.factory.createLogicalOr(
218
+ binary.expression,
219
+ create_report_call(
220
+ explore.source === "top"
221
+ ? ts.factory.createTrue()
222
+ : ts.factory.createIdentifier(
223
+ "_exceptionable",
224
+ ),
225
+ )(
226
+ ts.factory.createIdentifier(path),
227
+ expected,
228
+ input,
229
+ ),
230
+ ),
231
+ )
232
+ .reduce(ts.factory.createLogicalAnd)
233
+ : ts.factory.createLogicalOr(
234
+ binaries
235
+ .map((binary) => binary.expression)
236
+ .reduce(ts.factory.createLogicalOr),
237
+ create_report_call(
238
+ explore.source === "top"
239
+ ? ts.factory.createTrue()
240
+ : ts.factory.createIdentifier("_exceptionable"),
241
+ )(ts.factory.createIdentifier(path), expected, input),
242
+ );
243
+ };
244
+
245
+ const validate_object =
246
+ (equals: boolean) => (project: IProject) => (importer: FunctionImporter) =>
247
+ check_object({
248
+ equals,
249
+ undefined: true,
250
+ assert: false,
251
+ reduce: ts.factory.createLogicalAnd,
252
+ positive: ts.factory.createTrue(),
253
+ superfluous: (value) =>
254
+ create_report_call()(
255
+ ts.factory.createAdd(
256
+ ts.factory.createIdentifier("_path"),
257
+ ts.factory.createCallExpression(
258
+ importer.use("join"),
259
+ undefined,
260
+ [ts.factory.createIdentifier("key")],
261
+ ),
262
+ ),
263
+ "undefined",
264
+ value,
265
+ ),
266
+ halt: (expr) =>
267
+ ts.factory.createLogicalOr(
268
+ ts.factory.createStrictEquality(
269
+ ts.factory.createFalse(),
270
+ ts.factory.createIdentifier("_exceptionable"),
271
+ ),
272
+ expr,
273
+ ),
274
+ })(project)(importer);
275
+
276
+ const joiner =
277
+ (equals: boolean) =>
278
+ (project: IProject) =>
279
+ (importer: FunctionImporter): CheckerProgrammer.IConfig.IJoiner => ({
280
+ object: validate_object(equals)(project)(importer),
281
+ array: (input, arrow) =>
282
+ check_everything(
283
+ ts.factory.createCallExpression(
284
+ IdentifierFactory.access(input)("map"),
285
+ undefined,
286
+ [arrow],
287
+ ),
288
+ ),
289
+ failure: (value, expected, explore) =>
290
+ create_report_call(
291
+ explore?.from === "top"
292
+ ? ts.factory.createTrue()
293
+ : ts.factory.createIdentifier("_exceptionable"),
294
+ )(
295
+ ts.factory.createIdentifier(
296
+ explore?.postfix ? `_path + ${explore.postfix}` : "_path",
297
+ ),
298
+ expected,
299
+ value,
300
+ ),
301
+ tuple: (binaries) =>
302
+ check_everything(
303
+ ts.factory.createArrayLiteralExpression(binaries, true),
304
+ ),
305
+ });
306
+
307
+ const create_output = () =>
308
+ ts.factory.createObjectLiteralExpression(
309
+ [
310
+ ts.factory.createShorthandPropertyAssignment("success"),
311
+ ts.factory.createShorthandPropertyAssignment("errors"),
312
+ ts.factory.createPropertyAssignment(
313
+ "data",
314
+ ts.factory.createConditionalExpression(
315
+ ts.factory.createIdentifier("success"),
316
+ undefined,
317
+ ts.factory.createIdentifier("input"),
318
+ undefined,
319
+ ts.factory.createIdentifier("undefined"),
320
+ ),
321
+ ),
322
+ ],
323
+ true,
324
+ );
325
+
326
+ const create_report_call =
327
+ (exceptionable?: ts.Expression) =>
328
+ (
329
+ path: ts.Expression,
330
+ expected: string,
331
+ value: ts.Expression,
332
+ ): ts.Expression =>
333
+ ts.factory.createCallExpression(
334
+ ts.factory.createIdentifier("$report"),
335
+ undefined,
336
+ [
337
+ exceptionable ?? ts.factory.createIdentifier("_exceptionable"),
338
+ ts.factory.createObjectLiteralExpression(
339
+ [
340
+ ts.factory.createPropertyAssignment("path", path),
341
+ ts.factory.createPropertyAssignment(
342
+ "expected",
343
+ ts.factory.createStringLiteral(expected),
344
+ ),
345
+ ts.factory.createPropertyAssignment("value", value),
346
+ ],
347
+ true,
348
+ ),
349
+ ],
350
+ );