@typia/transform 12.0.0-dev.20260316 → 12.0.1

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.
@@ -1,581 +1,581 @@
1
- import {
2
- FunctionAssertReturnProgrammer,
3
- FunctionalAssertFunctionProgrammer,
4
- FunctionalAssertParametersProgrammer,
5
- FunctionalIsFunctionProgrammer,
6
- FunctionalIsParametersProgrammer,
7
- FunctionalIsReturnProgrammer,
8
- FunctionalValidateFunctionProgrammer,
9
- FunctionalValidateParametersProgrammer,
10
- FunctionalValidateReturnProgrammer,
11
- ITypiaContext,
12
- } from "@typia/core";
13
- import { NamingConvention } from "@typia/utils";
14
- import path from "path";
15
- import ts from "typescript";
16
-
17
- import { ITransformProps } from "./ITransformProps";
18
- import { AssertTransformer } from "./features/AssertTransformer";
19
- import { CreateAssertTransformer } from "./features/CreateAssertTransformer";
20
- import { CreateIsTransformer } from "./features/CreateIsTransformer";
21
- import { CreateRandomTransformer } from "./features/CreateRandomTransformer";
22
- import { CreateValidateTransformer } from "./features/CreateValidateTransformer";
23
- import { IsTransformer } from "./features/IsTransformer";
24
- import { RandomTransformer } from "./features/RandomTransformer";
25
- import { ValidateTransformer } from "./features/ValidateTransformer";
26
- import { FunctionalGenericTransformer } from "./features/functional/FunctionalGenericTransformer";
27
- import { CreateHttpAssertFormDataTransformer } from "./features/http/CreateHttpAssertFormDataTransformer";
28
- import { CreateHttpAssertHeadersTransformer } from "./features/http/CreateHttpAssertHeadersTransformer";
29
- import { CreateHttpAssertQueryTransformer } from "./features/http/CreateHttpAssertQueryTransformer";
30
- import { CreateHttpFormDataTransformer } from "./features/http/CreateHttpFormDataTransformer";
31
- import { CreateHttpHeadersTransformer } from "./features/http/CreateHttpHeadersTransformer";
32
- import { CreateHttpIsFormDataTransformer } from "./features/http/CreateHttpIsFormDataTransformer";
33
- import { CreateHttpIsHeadersTransformer } from "./features/http/CreateHttpIsHeadersTransformer";
34
- import { CreateHttpIsQueryTransformer } from "./features/http/CreateHttpIsQueryTransformer";
35
- import { CreateHttpParameterTransformer } from "./features/http/CreateHttpParameterTransformer";
36
- import { CreateHttpQueryTransformer } from "./features/http/CreateHttpQueryTransformer";
37
- import { CreateHttpValidateFormDataTransformer } from "./features/http/CreateHttpValidateFormDataTransformer";
38
- import { CreateHttpValidateHeadersTransformer } from "./features/http/CreateHttpValidateHeadersTransformer";
39
- import { CreateHttpValidateQueryTransformer } from "./features/http/CreateHttpValidateQueryTransformer";
40
- import { HttpAssertFormDataTransformer } from "./features/http/HttpAssertFormDataTransformer";
41
- import { HttpAssertHeadersTransformer } from "./features/http/HttpAssertHeadersTransformer";
42
- import { HttpAssertQueryTransformer } from "./features/http/HttpAssertQueryTransformer";
43
- import { HttpFormDataTransformer } from "./features/http/HttpFormDataTransformer";
44
- import { HttpHeadersTransformer } from "./features/http/HttpHeadersTransformer";
45
- import { HttpIsFormDataTransformer } from "./features/http/HttpIsFormDataTransformer";
46
- import { HttpIsHeadersTransformer } from "./features/http/HttpIsHeadersTransformer";
47
- import { HttpIsQueryTransformer } from "./features/http/HttpIsQueryTransformer";
48
- import { HttpParameterTransformer } from "./features/http/HttpParameterTransformer";
49
- import { HttpQueryTransformer } from "./features/http/HttpQueryTransformer";
50
- import { HttpValidateFormDataTransformer } from "./features/http/HttpValidateFormDataTransformer";
51
- import { HttpValidateHeadersTransformer } from "./features/http/HttpValidateHeadersTransformer";
52
- import { HttpValidateQueryTransformer } from "./features/http/HttpValidateQueryTransformer";
53
- import { JsonApplicationTransformer } from "./features/json/JsonApplicationTransformer";
54
- // import { JsonApplicationTransformer } from "./features/json/JsonApplicationTransformer";
55
- import { JsonAssertParseTransformer } from "./features/json/JsonAssertParseTransformer";
56
- import { JsonAssertStringifyTransformer } from "./features/json/JsonAssertStringifyTransformer";
57
- import { JsonCreateAssertParseTransformer } from "./features/json/JsonCreateAssertParseTransformer";
58
- import { JsonCreateAssertStringifyTransformer } from "./features/json/JsonCreateAssertStringifyTransformer";
59
- import { JsonCreateIsParseTransformer } from "./features/json/JsonCreateIsParseTransformer";
60
- import { JsonCreateIsStringifyTransformer } from "./features/json/JsonCreateIsStringifyTransformer";
61
- import { JsonCreateStringifyTransformer } from "./features/json/JsonCreateStringifyTransformer";
62
- import { JsonCreateValidateParseTransformer } from "./features/json/JsonCreateValidateParseTransformer";
63
- import { JsonCreateValidateStringifyTransformer } from "./features/json/JsonCreateValidateStringifyProgrammer";
64
- import { JsonIsParseTransformer } from "./features/json/JsonIsParseTransformer";
65
- import { JsonIsStringifyTransformer } from "./features/json/JsonIsStringifyTransformer";
66
- import { JsonSchemaTransformer } from "./features/json/JsonSchemaTransformer";
67
- import { JsonSchemasTransformer } from "./features/json/JsonSchemasTransformer";
68
- import { JsonStringifyTransformer } from "./features/json/JsonStringifyTransformer";
69
- import { JsonValidateParseTransformer } from "./features/json/JsonValidateParseTransformer";
70
- import { JsonValidateStringifyTransformer } from "./features/json/JsonValidateStringifyTransformer";
71
- import { LlmApplicationTransformer } from "./features/llm/LlmApplicationTransformer";
72
- import { LlmCoerceTransformer } from "./features/llm/LlmCoerceTransformer";
73
- import { LlmControllerTransformer } from "./features/llm/LlmControllerTransformer";
74
- import { LlmCreateCoerceTransformer } from "./features/llm/LlmCreateCoerceTransformer";
75
- import { LlmCreateParseTransformer } from "./features/llm/LlmCreateParseTransformer";
76
- import { LlmParametersTransformer } from "./features/llm/LlmParametersTransformer";
77
- import { LlmParseTransformer } from "./features/llm/LlmParseTransformer";
78
- import { LlmSchemaTransformer } from "./features/llm/LlmSchemaTransformer";
79
- import { LlmStructuredOutputTransformer } from "./features/llm/LlmStructuredOutputTransformer";
80
- import { MiscAssertCloneTransformer } from "./features/misc/MiscAssertCloneTransformer";
81
- import { MiscAssertPruneTransformer } from "./features/misc/MiscAssertPruneTransformer";
82
- import { MiscCloneTransformer } from "./features/misc/MiscCloneTransformer";
83
- import { MiscCreateAssertCloneTransformer } from "./features/misc/MiscCreateAssertCloneTransformer";
84
- import { MiscCreateAssertPruneTransformer } from "./features/misc/MiscCreateAssertPruneTransformer";
85
- import { MiscCreateCloneTransformer } from "./features/misc/MiscCreateCloneTransformer";
86
- import { MiscCreateIsCloneTransformer } from "./features/misc/MiscCreateIsCloneTransformer";
87
- import { MiscCreateIsPruneTransformer } from "./features/misc/MiscCreateIsPruneTransformer";
88
- import { MiscCreatePruneTransformer } from "./features/misc/MiscCreatePruneTransformer";
89
- import { MiscCreateValidateCloneTransformer } from "./features/misc/MiscCreateValidateCloneTransformer";
90
- import { MiscCreateValidatePruneTransformer } from "./features/misc/MiscCreateValidatePruneTransformer";
91
- import { MiscIsCloneTransformer } from "./features/misc/MiscIsCloneTransformer";
92
- import { MiscIsPruneTransformer } from "./features/misc/MiscIsPruneTransformer";
93
- import { MiscLiteralsTransformer } from "./features/misc/MiscLiteralsTransformer";
94
- import { MiscPruneTransformer } from "./features/misc/MiscPruneTransformer";
95
- import { MiscValidateCloneTransformer } from "./features/misc/MiscValidateCloneTransformer";
96
- import { MiscValidatePruneTransformer } from "./features/misc/MiscValidatePruneTransformer";
97
- import { NotationAssertGeneralTransformer } from "./features/notations/NotationAssertGeneralTransformer";
98
- import { NotationCreateAssertGeneralTransformer } from "./features/notations/NotationCreateAssertGeneralTransformer";
99
- import { NotationCreateGeneralTransformer } from "./features/notations/NotationCreateGeneralTransformer";
100
- import { NotationCreateIsGeneralTransformer } from "./features/notations/NotationCreateIsGeneralTransformer";
101
- import { NotationCreateValidateGeneralTransformer } from "./features/notations/NotationCreateValidateGeneralTransformer";
102
- import { NotationGeneralTransformer } from "./features/notations/NotationGeneralTransformer";
103
- import { NotationIsGeneralTransformer } from "./features/notations/NotationIsGeneralTransformer";
104
- import { NotationValidateGeneralTransformer } from "./features/notations/NotationValidateGeneralTransformer";
105
- import { ProtobufAssertDecodeTransformer } from "./features/protobuf/ProtobufAssertDecodeTransformer";
106
- import { ProtobufAssertEncodeTransformer } from "./features/protobuf/ProtobufAssertEncodeTransformer";
107
- import { ProtobufCreateAssertDecodeTransformer } from "./features/protobuf/ProtobufCreateAssertDecodeTransformer";
108
- import { ProtobufCreateAssertEncodeTransformer } from "./features/protobuf/ProtobufCreateAssertEncodeTransformer";
109
- import { ProtobufCreateDecodeTransformer } from "./features/protobuf/ProtobufCreateDecodeTransformer";
110
- import { ProtobufCreateEncodeTransformer } from "./features/protobuf/ProtobufCreateEncodeTransformer";
111
- import { ProtobufCreateIsDecodeTransformer } from "./features/protobuf/ProtobufCreateIsDecodeTransformer";
112
- import { ProtobufCreateIsEncodeTransformer } from "./features/protobuf/ProtobufCreateIsEncodeTransformer";
113
- import { ProtobufCreateValidateDecodeTransformer } from "./features/protobuf/ProtobufCreateValidateDecodeTransformer";
114
- import { ProtobufCreateValidateEncodeTransformer } from "./features/protobuf/ProtobufCreateValidateEncodeTransformer";
115
- import { ProtobufDecodeTransformer } from "./features/protobuf/ProtobufDecodeTransformer";
116
- import { ProtobufEncodeTransformer } from "./features/protobuf/ProtobufEncodeTransformer";
117
- import { ProtobufIsDecodeTransformer } from "./features/protobuf/ProtobufIsDecodeTransformer";
118
- import { ProtobufIsEncodeTransformer } from "./features/protobuf/ProtobufIsEncodeTransformer";
119
- import { ProtobufMessageTransformer } from "./features/protobuf/ProtobufMessageTransformer";
120
- import { ProtobufValidateDecodeTransformer } from "./features/protobuf/ProtobufValidateDecodeTransformer";
121
- import { ProtobufValidateEncodeTransformer } from "./features/protobuf/ProtobufValidateEncodeTransformer";
122
- import { ReflectMetadataTransformer } from "./features/reflect/ReflectMetadataTransformer";
123
- import { ReflectNameTransformer } from "./features/reflect/ReflectNameTransformer";
124
- import { ReflectSchemaTransformer } from "./features/reflect/ReflectSchemaTransformer";
125
- import { ReflectSchemasTransformer } from "./features/reflect/ReflectSchemasTransformer";
126
-
127
- /**
128
- * Transforms `typia.*` function call expressions.
129
- *
130
- * Routes typia function calls (e.g., `typia.is<T>()`, `typia.assert<T>()`) to
131
- * their corresponding transformers. Identifies calls by resolving the
132
- * declaration signature and matching against registered functor map.
133
- *
134
- * @author Jeongho Nam - https://github.com/samchon
135
- */
136
- export namespace CallExpressionTransformer {
137
- export const transform = (props: {
138
- context: ITypiaContext;
139
- expression: ts.CallExpression;
140
- }): ts.Expression | null => {
141
- //----
142
- // VALIDATIONS
143
- //----
144
- // SIGNATURE DECLARATION
145
- const declaration: ts.Declaration | undefined =
146
- props.context.checker.getResolvedSignature(props.expression)?.declaration;
147
- if (!declaration) return props.expression;
148
-
149
- // FILE PATH
150
- const location: string = path.resolve(declaration.getSourceFile().fileName);
151
- if (isTarget(location) === false) return props.expression;
152
-
153
- //----
154
- // TRANSFORMATION
155
- //----
156
- // FUNCTION NAME
157
- const module: string = location.split(path.sep).at(-1)!.split(".")[0]!;
158
- const { name } =
159
- props.context.checker.getTypeAtLocation(declaration).symbol;
160
-
161
- // FIND TRANSFORMER
162
- const functor: (() => Task) | undefined = FUNCTORS[module]?.[name];
163
- if (functor === undefined) return props.expression;
164
-
165
- // RETURNS WITH TRANSFORMATION
166
- const result: ts.Expression | null = functor()({
167
- context: props.context,
168
- modulo: props.expression.expression,
169
- expression: props.expression,
170
- });
171
- return result ?? props.expression;
172
- };
173
-
174
- const isTarget = (location: string): boolean => {
175
- const files: string[] = Object.keys(FUNCTORS);
176
- return files.some(
177
- (f) =>
178
- location.includes(path.join("typia", "lib", `${f}.d.ts`)) ||
179
- location.includes(path.join("typia", "src", `${f}.ts`)),
180
- );
181
- };
182
- }
183
-
184
- type Task = (props: ITransformProps) => ts.Expression | null;
185
-
186
- const FUNCTORS: Record<string, Record<string, () => Task>> = {
187
- module: {
188
- // BASIC
189
- assert: () => AssertTransformer.transform({ equals: false, guard: false }),
190
- assertGuard: () =>
191
- AssertTransformer.transform({ equals: false, guard: true }),
192
- assertType: () =>
193
- AssertTransformer.transform({ equals: false, guard: false }),
194
- is: () => IsTransformer.transform({ equals: false }),
195
- validate: () => ValidateTransformer.transform({ equals: false }),
196
-
197
- // STRICT
198
- assertEquals: () =>
199
- AssertTransformer.transform({ equals: true, guard: false }),
200
- assertGuardEquals: () =>
201
- AssertTransformer.transform({ equals: true, guard: true }),
202
- equals: () => IsTransformer.transform({ equals: true }),
203
- validateEquals: () => ValidateTransformer.transform({ equals: true }),
204
-
205
- // RANDOM + INTERNAL
206
- random: () => RandomTransformer.transform,
207
- metadata: () => ReflectMetadataTransformer.transform,
208
-
209
- // FACTORIES
210
- createAssert: () =>
211
- CreateAssertTransformer.transform({ equals: false, guard: false }),
212
- createAssertGuard: () =>
213
- CreateAssertTransformer.transform({ equals: false, guard: true }),
214
- createAssertType: () =>
215
- CreateAssertTransformer.transform({ equals: false, guard: false }),
216
- createIs: () => CreateIsTransformer.transform({ equals: false }),
217
- createValidate: () =>
218
- CreateValidateTransformer.transform({
219
- equals: false,
220
- standardSchema: true,
221
- }),
222
- createAssertEquals: () =>
223
- CreateAssertTransformer.transform({ equals: true, guard: false }),
224
- createAssertGuardEquals: () =>
225
- CreateAssertTransformer.transform({ equals: true, guard: true }),
226
- createEquals: () => CreateIsTransformer.transform({ equals: true }),
227
- createValidateEquals: () =>
228
- CreateValidateTransformer.transform({
229
- equals: true,
230
- standardSchema: true,
231
- }),
232
- createRandom: () => CreateRandomTransformer.transform,
233
- },
234
- functional: {
235
- // ASSERTIONS
236
- assertFunction: () =>
237
- FunctionalGenericTransformer.transform({
238
- method: "assertFunction",
239
- config: {
240
- equals: false,
241
- },
242
- programmer: FunctionalAssertFunctionProgrammer.write,
243
- }),
244
- assertParameters: () =>
245
- FunctionalGenericTransformer.transform({
246
- method: "assertParameters",
247
- config: {
248
- equals: false,
249
- },
250
- programmer: FunctionalAssertParametersProgrammer.write,
251
- }),
252
- assertReturn: () =>
253
- FunctionalGenericTransformer.transform({
254
- method: "assertReturn",
255
- config: {
256
- equals: false,
257
- },
258
- programmer: FunctionAssertReturnProgrammer.write,
259
- }),
260
- assertEqualsFunction: () =>
261
- FunctionalGenericTransformer.transform({
262
- method: "assertEqualsFunction",
263
- config: {
264
- equals: true,
265
- },
266
- programmer: FunctionalAssertFunctionProgrammer.write,
267
- }),
268
- assertEqualsParameters: () =>
269
- FunctionalGenericTransformer.transform({
270
- method: "assertEqualsParameters",
271
- config: {
272
- equals: true,
273
- },
274
- programmer: FunctionalAssertParametersProgrammer.write,
275
- }),
276
- assertEqualsReturn: () =>
277
- FunctionalGenericTransformer.transform({
278
- method: "assertEqualsReturn",
279
- config: {
280
- equals: true,
281
- },
282
- programmer: FunctionAssertReturnProgrammer.write,
283
- }),
284
-
285
- // IS
286
- isFunction: () =>
287
- FunctionalGenericTransformer.transform({
288
- method: "isFunction",
289
- config: {
290
- equals: false,
291
- },
292
- programmer: FunctionalIsFunctionProgrammer.write,
293
- }),
294
- isParameters: () =>
295
- FunctionalGenericTransformer.transform({
296
- method: "isParameters",
297
- config: {
298
- equals: false,
299
- },
300
- programmer: FunctionalIsParametersProgrammer.write,
301
- }),
302
- isReturn: () =>
303
- FunctionalGenericTransformer.transform({
304
- method: "isReturn",
305
- config: {
306
- equals: false,
307
- },
308
- programmer: FunctionalIsReturnProgrammer.write,
309
- }),
310
- equalsFunction: () =>
311
- FunctionalGenericTransformer.transform({
312
- method: "equalsFunction",
313
- config: {
314
- equals: true,
315
- },
316
- programmer: FunctionalIsFunctionProgrammer.write,
317
- }),
318
- equalsParameters: () =>
319
- FunctionalGenericTransformer.transform({
320
- method: "equalsParameters",
321
- config: {
322
- equals: true,
323
- },
324
- programmer: FunctionalIsParametersProgrammer.write,
325
- }),
326
- equalsReturn: () =>
327
- FunctionalGenericTransformer.transform({
328
- method: "equalsReturn",
329
- config: {
330
- equals: true,
331
- },
332
- programmer: FunctionalIsReturnProgrammer.write,
333
- }),
334
-
335
- // VALIDATIONS
336
- validateFunction: () =>
337
- FunctionalGenericTransformer.transform({
338
- method: "validateFunction",
339
- config: {
340
- equals: false,
341
- },
342
- programmer: FunctionalValidateFunctionProgrammer.write,
343
- }),
344
- validateParameters: () =>
345
- FunctionalGenericTransformer.transform({
346
- method: "validateParameters",
347
- config: {
348
- equals: false,
349
- },
350
- programmer: FunctionalValidateParametersProgrammer.write,
351
- }),
352
- validateReturn: () =>
353
- FunctionalGenericTransformer.transform({
354
- method: "validateReturn",
355
- config: {
356
- equals: false,
357
- },
358
- programmer: FunctionalValidateReturnProgrammer.write,
359
- }),
360
- validateEqualsFunction: () =>
361
- FunctionalGenericTransformer.transform({
362
- method: "validateEqualsFunction",
363
- config: {
364
- equals: true,
365
- },
366
- programmer: FunctionalValidateFunctionProgrammer.write,
367
- }),
368
- validateEqualsParameters: () =>
369
- FunctionalGenericTransformer.transform({
370
- method: "validateEqualsParameters",
371
- config: {
372
- equals: true,
373
- },
374
- programmer: FunctionalValidateParametersProgrammer.write,
375
- }),
376
- validateEqualsReturn: () =>
377
- FunctionalGenericTransformer.transform({
378
- method: "validateEqualsReturn",
379
- config: {
380
- equals: true,
381
- },
382
- programmer: FunctionalValidateReturnProgrammer.write,
383
- }),
384
- },
385
- http: {
386
- // FORM-DATA
387
- formData: () => HttpFormDataTransformer.transform,
388
- isFormData: () => HttpIsFormDataTransformer.transform,
389
- assertFormData: () => HttpAssertFormDataTransformer.transform,
390
- validateFormData: () => HttpValidateFormDataTransformer.transform,
391
-
392
- // HEADERS
393
- headers: () => HttpHeadersTransformer.transform,
394
- isHeaders: () => HttpIsHeadersTransformer.transform,
395
- assertHeaders: () => HttpAssertHeadersTransformer.transform,
396
- validateHeaders: () => HttpValidateHeadersTransformer.transform,
397
-
398
- // PARAMETER
399
- parameter: () => HttpParameterTransformer.transform,
400
-
401
- // QUERY
402
- query: () => HttpQueryTransformer.transform,
403
- isQuery: () => HttpIsQueryTransformer.transform,
404
- assertQuery: () => HttpAssertQueryTransformer.transform,
405
- validateQuery: () => HttpValidateQueryTransformer.transform,
406
-
407
- // FACTORIES
408
- createFormData: () => CreateHttpFormDataTransformer.transform,
409
- createIsFormData: () => CreateHttpIsFormDataTransformer.transform,
410
- createAssertFormData: () => CreateHttpAssertFormDataTransformer.transform,
411
- createValidateFormData: () =>
412
- CreateHttpValidateFormDataTransformer.transform,
413
- createHeaders: () => CreateHttpHeadersTransformer.transform,
414
- createIsHeaders: () => CreateHttpIsHeadersTransformer.transform,
415
- createAssertHeaders: () => CreateHttpAssertHeadersTransformer.transform,
416
- createValidateHeaders: () => CreateHttpValidateHeadersTransformer.transform,
417
- createParameter: () => CreateHttpParameterTransformer.transform,
418
- createQuery: () => CreateHttpQueryTransformer.transform,
419
- createIsQuery: () => CreateHttpIsQueryTransformer.transform,
420
- createAssertQuery: () => CreateHttpAssertQueryTransformer.transform,
421
- createValidateQuery: () => CreateHttpValidateQueryTransformer.transform,
422
- },
423
- llm: {
424
- controller: () => LlmControllerTransformer.transform,
425
- applicationOfValidate: () => LlmApplicationTransformer.transform,
426
- application: () => LlmApplicationTransformer.transform,
427
- structuredOutput: () => LlmStructuredOutputTransformer.transform,
428
- parameters: () => LlmParametersTransformer.transform,
429
- schema: () => LlmSchemaTransformer.transform,
430
- parse: () => LlmParseTransformer.transform,
431
- createParse: () => LlmCreateParseTransformer.transform,
432
- coerce: () => LlmCoerceTransformer.transform,
433
- createCoerce: () => LlmCreateCoerceTransformer.transform,
434
- },
435
- json: {
436
- // METADATA
437
- schema: () => JsonSchemaTransformer.transform,
438
- schemas: () => JsonSchemasTransformer.transform,
439
- application: () => JsonApplicationTransformer.transform,
440
-
441
- // PARSER
442
- isParse: () => JsonIsParseTransformer.transform,
443
- assertParse: () => JsonAssertParseTransformer.transform,
444
- validateParse: () => JsonValidateParseTransformer.transform,
445
-
446
- // STRINGIFY
447
- stringify: () => JsonStringifyTransformer.transform,
448
- assertStringify: () => JsonAssertStringifyTransformer.transform,
449
- isStringify: () => JsonIsStringifyTransformer.transform,
450
- validateStringify: () => JsonValidateStringifyTransformer.transform,
451
-
452
- // FACTORIES
453
- createIsParse: () => JsonCreateIsParseTransformer.transform,
454
- createAssertParse: () => JsonCreateAssertParseTransformer.transform,
455
- createValidateParse: () => JsonCreateValidateParseTransformer.transform,
456
- createStringify: () => JsonCreateStringifyTransformer.transform,
457
- createAssertStringify: () => JsonCreateAssertStringifyTransformer.transform,
458
- createIsStringify: () => JsonCreateIsStringifyTransformer.transform,
459
- createValidateStringify: () =>
460
- JsonCreateValidateStringifyTransformer.transform,
461
- },
462
- protobuf: {
463
- // SCHEMA
464
- message: () => ProtobufMessageTransformer.transform,
465
-
466
- // ENCODE
467
- encode: () => ProtobufEncodeTransformer.transform,
468
- assertEncode: () => ProtobufAssertEncodeTransformer.transform,
469
- isEncode: () => ProtobufIsEncodeTransformer.transform,
470
- validateEncode: () => ProtobufValidateEncodeTransformer.transform,
471
-
472
- // DECODE
473
- decode: () => ProtobufDecodeTransformer.transform,
474
- assertDecode: () => ProtobufAssertDecodeTransformer.transform,
475
- isDecode: () => ProtobufIsDecodeTransformer.transform,
476
- validateDecode: () => ProtobufValidateDecodeTransformer.transform,
477
-
478
- // FACTORIES
479
- createEncode: () => ProtobufCreateEncodeTransformer.transform,
480
- createAssertEncode: () => ProtobufCreateAssertEncodeTransformer.transform,
481
- createIsEncode: () => ProtobufCreateIsEncodeTransformer.transform,
482
- createValidateEncode: () =>
483
- ProtobufCreateValidateEncodeTransformer.transform,
484
- createDecode: () => ProtobufCreateDecodeTransformer.transform,
485
- createAssertDecode: () => ProtobufCreateAssertDecodeTransformer.transform,
486
- createIsDecode: () => ProtobufCreateIsDecodeTransformer.transform,
487
- createValidateDecode: () =>
488
- ProtobufCreateValidateDecodeTransformer.transform,
489
- },
490
- reflect: {
491
- metadata: () => ReflectMetadataTransformer.transform,
492
- name: () => ReflectNameTransformer.transform,
493
- schema: () => ReflectSchemaTransformer.transform,
494
- schemas: () => ReflectSchemasTransformer.transform,
495
- },
496
- misc: {
497
- literals: () => MiscLiteralsTransformer.transform,
498
-
499
- // CLONE
500
- clone: () => MiscCloneTransformer.transform,
501
- assertClone: () => MiscAssertCloneTransformer.transform,
502
- isClone: () => MiscIsCloneTransformer.transform,
503
- validateClone: () => MiscValidateCloneTransformer.transform,
504
-
505
- // PRUNE
506
- prune: () => MiscPruneTransformer.transform,
507
- assertPrune: () => MiscAssertPruneTransformer.transform,
508
- isPrune: () => MiscIsPruneTransformer.transform,
509
- validatePrune: () => MiscValidatePruneTransformer.transform,
510
-
511
- // FACTORIES
512
- createClone: () => MiscCreateCloneTransformer.transform,
513
- createAssertClone: () => MiscCreateAssertCloneTransformer.transform,
514
- createIsClone: () => MiscCreateIsCloneTransformer.transform,
515
- createValidateClone: () => MiscCreateValidateCloneTransformer.transform,
516
- createPrune: () => MiscCreatePruneTransformer.transform,
517
- createAssertPrune: () => MiscCreateAssertPruneTransformer.transform,
518
- createIsPrune: () => MiscCreateIsPruneTransformer.transform,
519
- createValidatePrune: () => MiscCreateValidatePruneTransformer.transform,
520
- },
521
- notations: {
522
- // CAMEL
523
- camel: () => NotationGeneralTransformer.transform(NamingConvention.camel),
524
- assertCamel: () =>
525
- NotationAssertGeneralTransformer.transform(NamingConvention.camel),
526
- isCamel: () =>
527
- NotationIsGeneralTransformer.transform(NamingConvention.camel),
528
- validateCamel: () =>
529
- NotationValidateGeneralTransformer.transform(NamingConvention.camel),
530
-
531
- // PASCAL
532
- pascal: () => NotationGeneralTransformer.transform(NamingConvention.pascal),
533
- assertPascal: () =>
534
- NotationAssertGeneralTransformer.transform(NamingConvention.pascal),
535
- isPascal: () =>
536
- NotationIsGeneralTransformer.transform(NamingConvention.pascal),
537
- validatePascal: () =>
538
- NotationValidateGeneralTransformer.transform(NamingConvention.pascal),
539
-
540
- // SNAKE
541
- snake: () => NotationGeneralTransformer.transform(NamingConvention.snake),
542
- assertSnake: () =>
543
- NotationAssertGeneralTransformer.transform(NamingConvention.snake),
544
- isSnake: () =>
545
- NotationIsGeneralTransformer.transform(NamingConvention.snake),
546
- validateSnake: () =>
547
- NotationValidateGeneralTransformer.transform(NamingConvention.snake),
548
-
549
- // FACTORIES
550
- createCamel: () =>
551
- NotationCreateGeneralTransformer.transform(NamingConvention.camel),
552
- createAssertCamel: () =>
553
- NotationCreateAssertGeneralTransformer.transform(NamingConvention.camel),
554
- createIsCamel: () =>
555
- NotationCreateIsGeneralTransformer.transform(NamingConvention.camel),
556
- createValidateCamel: () =>
557
- NotationCreateValidateGeneralTransformer.transform(
558
- NamingConvention.camel,
559
- ),
560
- createPascal: () =>
561
- NotationCreateGeneralTransformer.transform(NamingConvention.pascal),
562
- createAssertPascal: () =>
563
- NotationCreateAssertGeneralTransformer.transform(NamingConvention.pascal),
564
- createIsPascal: () =>
565
- NotationCreateIsGeneralTransformer.transform(NamingConvention.pascal),
566
- createValidatePascal: () =>
567
- NotationCreateValidateGeneralTransformer.transform(
568
- NamingConvention.pascal,
569
- ),
570
- createSnake: () =>
571
- NotationCreateGeneralTransformer.transform(NamingConvention.snake),
572
- createAssertSnake: () =>
573
- NotationCreateAssertGeneralTransformer.transform(NamingConvention.snake),
574
- createIsSnake: () =>
575
- NotationCreateIsGeneralTransformer.transform(NamingConvention.snake),
576
- createValidateSnake: () =>
577
- NotationCreateValidateGeneralTransformer.transform(
578
- NamingConvention.snake,
579
- ),
580
- },
581
- };
1
+ import {
2
+ FunctionAssertReturnProgrammer,
3
+ FunctionalAssertFunctionProgrammer,
4
+ FunctionalAssertParametersProgrammer,
5
+ FunctionalIsFunctionProgrammer,
6
+ FunctionalIsParametersProgrammer,
7
+ FunctionalIsReturnProgrammer,
8
+ FunctionalValidateFunctionProgrammer,
9
+ FunctionalValidateParametersProgrammer,
10
+ FunctionalValidateReturnProgrammer,
11
+ ITypiaContext,
12
+ } from "@typia/core";
13
+ import { NamingConvention } from "@typia/utils";
14
+ import path from "path";
15
+ import ts from "typescript";
16
+
17
+ import { ITransformProps } from "./ITransformProps";
18
+ import { AssertTransformer } from "./features/AssertTransformer";
19
+ import { CreateAssertTransformer } from "./features/CreateAssertTransformer";
20
+ import { CreateIsTransformer } from "./features/CreateIsTransformer";
21
+ import { CreateRandomTransformer } from "./features/CreateRandomTransformer";
22
+ import { CreateValidateTransformer } from "./features/CreateValidateTransformer";
23
+ import { IsTransformer } from "./features/IsTransformer";
24
+ import { RandomTransformer } from "./features/RandomTransformer";
25
+ import { ValidateTransformer } from "./features/ValidateTransformer";
26
+ import { FunctionalGenericTransformer } from "./features/functional/FunctionalGenericTransformer";
27
+ import { CreateHttpAssertFormDataTransformer } from "./features/http/CreateHttpAssertFormDataTransformer";
28
+ import { CreateHttpAssertHeadersTransformer } from "./features/http/CreateHttpAssertHeadersTransformer";
29
+ import { CreateHttpAssertQueryTransformer } from "./features/http/CreateHttpAssertQueryTransformer";
30
+ import { CreateHttpFormDataTransformer } from "./features/http/CreateHttpFormDataTransformer";
31
+ import { CreateHttpHeadersTransformer } from "./features/http/CreateHttpHeadersTransformer";
32
+ import { CreateHttpIsFormDataTransformer } from "./features/http/CreateHttpIsFormDataTransformer";
33
+ import { CreateHttpIsHeadersTransformer } from "./features/http/CreateHttpIsHeadersTransformer";
34
+ import { CreateHttpIsQueryTransformer } from "./features/http/CreateHttpIsQueryTransformer";
35
+ import { CreateHttpParameterTransformer } from "./features/http/CreateHttpParameterTransformer";
36
+ import { CreateHttpQueryTransformer } from "./features/http/CreateHttpQueryTransformer";
37
+ import { CreateHttpValidateFormDataTransformer } from "./features/http/CreateHttpValidateFormDataTransformer";
38
+ import { CreateHttpValidateHeadersTransformer } from "./features/http/CreateHttpValidateHeadersTransformer";
39
+ import { CreateHttpValidateQueryTransformer } from "./features/http/CreateHttpValidateQueryTransformer";
40
+ import { HttpAssertFormDataTransformer } from "./features/http/HttpAssertFormDataTransformer";
41
+ import { HttpAssertHeadersTransformer } from "./features/http/HttpAssertHeadersTransformer";
42
+ import { HttpAssertQueryTransformer } from "./features/http/HttpAssertQueryTransformer";
43
+ import { HttpFormDataTransformer } from "./features/http/HttpFormDataTransformer";
44
+ import { HttpHeadersTransformer } from "./features/http/HttpHeadersTransformer";
45
+ import { HttpIsFormDataTransformer } from "./features/http/HttpIsFormDataTransformer";
46
+ import { HttpIsHeadersTransformer } from "./features/http/HttpIsHeadersTransformer";
47
+ import { HttpIsQueryTransformer } from "./features/http/HttpIsQueryTransformer";
48
+ import { HttpParameterTransformer } from "./features/http/HttpParameterTransformer";
49
+ import { HttpQueryTransformer } from "./features/http/HttpQueryTransformer";
50
+ import { HttpValidateFormDataTransformer } from "./features/http/HttpValidateFormDataTransformer";
51
+ import { HttpValidateHeadersTransformer } from "./features/http/HttpValidateHeadersTransformer";
52
+ import { HttpValidateQueryTransformer } from "./features/http/HttpValidateQueryTransformer";
53
+ import { JsonApplicationTransformer } from "./features/json/JsonApplicationTransformer";
54
+ // import { JsonApplicationTransformer } from "./features/json/JsonApplicationTransformer";
55
+ import { JsonAssertParseTransformer } from "./features/json/JsonAssertParseTransformer";
56
+ import { JsonAssertStringifyTransformer } from "./features/json/JsonAssertStringifyTransformer";
57
+ import { JsonCreateAssertParseTransformer } from "./features/json/JsonCreateAssertParseTransformer";
58
+ import { JsonCreateAssertStringifyTransformer } from "./features/json/JsonCreateAssertStringifyTransformer";
59
+ import { JsonCreateIsParseTransformer } from "./features/json/JsonCreateIsParseTransformer";
60
+ import { JsonCreateIsStringifyTransformer } from "./features/json/JsonCreateIsStringifyTransformer";
61
+ import { JsonCreateStringifyTransformer } from "./features/json/JsonCreateStringifyTransformer";
62
+ import { JsonCreateValidateParseTransformer } from "./features/json/JsonCreateValidateParseTransformer";
63
+ import { JsonCreateValidateStringifyTransformer } from "./features/json/JsonCreateValidateStringifyProgrammer";
64
+ import { JsonIsParseTransformer } from "./features/json/JsonIsParseTransformer";
65
+ import { JsonIsStringifyTransformer } from "./features/json/JsonIsStringifyTransformer";
66
+ import { JsonSchemaTransformer } from "./features/json/JsonSchemaTransformer";
67
+ import { JsonSchemasTransformer } from "./features/json/JsonSchemasTransformer";
68
+ import { JsonStringifyTransformer } from "./features/json/JsonStringifyTransformer";
69
+ import { JsonValidateParseTransformer } from "./features/json/JsonValidateParseTransformer";
70
+ import { JsonValidateStringifyTransformer } from "./features/json/JsonValidateStringifyTransformer";
71
+ import { LlmApplicationTransformer } from "./features/llm/LlmApplicationTransformer";
72
+ import { LlmCoerceTransformer } from "./features/llm/LlmCoerceTransformer";
73
+ import { LlmControllerTransformer } from "./features/llm/LlmControllerTransformer";
74
+ import { LlmCreateCoerceTransformer } from "./features/llm/LlmCreateCoerceTransformer";
75
+ import { LlmCreateParseTransformer } from "./features/llm/LlmCreateParseTransformer";
76
+ import { LlmParametersTransformer } from "./features/llm/LlmParametersTransformer";
77
+ import { LlmParseTransformer } from "./features/llm/LlmParseTransformer";
78
+ import { LlmSchemaTransformer } from "./features/llm/LlmSchemaTransformer";
79
+ import { LlmStructuredOutputTransformer } from "./features/llm/LlmStructuredOutputTransformer";
80
+ import { MiscAssertCloneTransformer } from "./features/misc/MiscAssertCloneTransformer";
81
+ import { MiscAssertPruneTransformer } from "./features/misc/MiscAssertPruneTransformer";
82
+ import { MiscCloneTransformer } from "./features/misc/MiscCloneTransformer";
83
+ import { MiscCreateAssertCloneTransformer } from "./features/misc/MiscCreateAssertCloneTransformer";
84
+ import { MiscCreateAssertPruneTransformer } from "./features/misc/MiscCreateAssertPruneTransformer";
85
+ import { MiscCreateCloneTransformer } from "./features/misc/MiscCreateCloneTransformer";
86
+ import { MiscCreateIsCloneTransformer } from "./features/misc/MiscCreateIsCloneTransformer";
87
+ import { MiscCreateIsPruneTransformer } from "./features/misc/MiscCreateIsPruneTransformer";
88
+ import { MiscCreatePruneTransformer } from "./features/misc/MiscCreatePruneTransformer";
89
+ import { MiscCreateValidateCloneTransformer } from "./features/misc/MiscCreateValidateCloneTransformer";
90
+ import { MiscCreateValidatePruneTransformer } from "./features/misc/MiscCreateValidatePruneTransformer";
91
+ import { MiscIsCloneTransformer } from "./features/misc/MiscIsCloneTransformer";
92
+ import { MiscIsPruneTransformer } from "./features/misc/MiscIsPruneTransformer";
93
+ import { MiscLiteralsTransformer } from "./features/misc/MiscLiteralsTransformer";
94
+ import { MiscPruneTransformer } from "./features/misc/MiscPruneTransformer";
95
+ import { MiscValidateCloneTransformer } from "./features/misc/MiscValidateCloneTransformer";
96
+ import { MiscValidatePruneTransformer } from "./features/misc/MiscValidatePruneTransformer";
97
+ import { NotationAssertGeneralTransformer } from "./features/notations/NotationAssertGeneralTransformer";
98
+ import { NotationCreateAssertGeneralTransformer } from "./features/notations/NotationCreateAssertGeneralTransformer";
99
+ import { NotationCreateGeneralTransformer } from "./features/notations/NotationCreateGeneralTransformer";
100
+ import { NotationCreateIsGeneralTransformer } from "./features/notations/NotationCreateIsGeneralTransformer";
101
+ import { NotationCreateValidateGeneralTransformer } from "./features/notations/NotationCreateValidateGeneralTransformer";
102
+ import { NotationGeneralTransformer } from "./features/notations/NotationGeneralTransformer";
103
+ import { NotationIsGeneralTransformer } from "./features/notations/NotationIsGeneralTransformer";
104
+ import { NotationValidateGeneralTransformer } from "./features/notations/NotationValidateGeneralTransformer";
105
+ import { ProtobufAssertDecodeTransformer } from "./features/protobuf/ProtobufAssertDecodeTransformer";
106
+ import { ProtobufAssertEncodeTransformer } from "./features/protobuf/ProtobufAssertEncodeTransformer";
107
+ import { ProtobufCreateAssertDecodeTransformer } from "./features/protobuf/ProtobufCreateAssertDecodeTransformer";
108
+ import { ProtobufCreateAssertEncodeTransformer } from "./features/protobuf/ProtobufCreateAssertEncodeTransformer";
109
+ import { ProtobufCreateDecodeTransformer } from "./features/protobuf/ProtobufCreateDecodeTransformer";
110
+ import { ProtobufCreateEncodeTransformer } from "./features/protobuf/ProtobufCreateEncodeTransformer";
111
+ import { ProtobufCreateIsDecodeTransformer } from "./features/protobuf/ProtobufCreateIsDecodeTransformer";
112
+ import { ProtobufCreateIsEncodeTransformer } from "./features/protobuf/ProtobufCreateIsEncodeTransformer";
113
+ import { ProtobufCreateValidateDecodeTransformer } from "./features/protobuf/ProtobufCreateValidateDecodeTransformer";
114
+ import { ProtobufCreateValidateEncodeTransformer } from "./features/protobuf/ProtobufCreateValidateEncodeTransformer";
115
+ import { ProtobufDecodeTransformer } from "./features/protobuf/ProtobufDecodeTransformer";
116
+ import { ProtobufEncodeTransformer } from "./features/protobuf/ProtobufEncodeTransformer";
117
+ import { ProtobufIsDecodeTransformer } from "./features/protobuf/ProtobufIsDecodeTransformer";
118
+ import { ProtobufIsEncodeTransformer } from "./features/protobuf/ProtobufIsEncodeTransformer";
119
+ import { ProtobufMessageTransformer } from "./features/protobuf/ProtobufMessageTransformer";
120
+ import { ProtobufValidateDecodeTransformer } from "./features/protobuf/ProtobufValidateDecodeTransformer";
121
+ import { ProtobufValidateEncodeTransformer } from "./features/protobuf/ProtobufValidateEncodeTransformer";
122
+ import { ReflectMetadataTransformer } from "./features/reflect/ReflectMetadataTransformer";
123
+ import { ReflectNameTransformer } from "./features/reflect/ReflectNameTransformer";
124
+ import { ReflectSchemaTransformer } from "./features/reflect/ReflectSchemaTransformer";
125
+ import { ReflectSchemasTransformer } from "./features/reflect/ReflectSchemasTransformer";
126
+
127
+ /**
128
+ * Transforms `typia.*` function call expressions.
129
+ *
130
+ * Routes typia function calls (e.g., `typia.is<T>()`, `typia.assert<T>()`) to
131
+ * their corresponding transformers. Identifies calls by resolving the
132
+ * declaration signature and matching against registered functor map.
133
+ *
134
+ * @author Jeongho Nam - https://github.com/samchon
135
+ */
136
+ export namespace CallExpressionTransformer {
137
+ export const transform = (props: {
138
+ context: ITypiaContext;
139
+ expression: ts.CallExpression;
140
+ }): ts.Expression | null => {
141
+ //----
142
+ // VALIDATIONS
143
+ //----
144
+ // SIGNATURE DECLARATION
145
+ const declaration: ts.Declaration | undefined =
146
+ props.context.checker.getResolvedSignature(props.expression)?.declaration;
147
+ if (!declaration) return props.expression;
148
+
149
+ // FILE PATH
150
+ const location: string = path.resolve(declaration.getSourceFile().fileName);
151
+ if (isTarget(location) === false) return props.expression;
152
+
153
+ //----
154
+ // TRANSFORMATION
155
+ //----
156
+ // FUNCTION NAME
157
+ const module: string = location.split(path.sep).at(-1)!.split(".")[0]!;
158
+ const { name } =
159
+ props.context.checker.getTypeAtLocation(declaration).symbol;
160
+
161
+ // FIND TRANSFORMER
162
+ const functor: (() => Task) | undefined = FUNCTORS[module]?.[name];
163
+ if (functor === undefined) return props.expression;
164
+
165
+ // RETURNS WITH TRANSFORMATION
166
+ const result: ts.Expression | null = functor()({
167
+ context: props.context,
168
+ modulo: props.expression.expression,
169
+ expression: props.expression,
170
+ });
171
+ return result ?? props.expression;
172
+ };
173
+
174
+ const isTarget = (location: string): boolean => {
175
+ const files: string[] = Object.keys(FUNCTORS);
176
+ return files.some(
177
+ (f) =>
178
+ location.includes(path.join("typia", "lib", `${f}.d.ts`)) ||
179
+ location.includes(path.join("typia", "src", `${f}.ts`)),
180
+ );
181
+ };
182
+ }
183
+
184
+ type Task = (props: ITransformProps) => ts.Expression | null;
185
+
186
+ const FUNCTORS: Record<string, Record<string, () => Task>> = {
187
+ module: {
188
+ // BASIC
189
+ assert: () => AssertTransformer.transform({ equals: false, guard: false }),
190
+ assertGuard: () =>
191
+ AssertTransformer.transform({ equals: false, guard: true }),
192
+ assertType: () =>
193
+ AssertTransformer.transform({ equals: false, guard: false }),
194
+ is: () => IsTransformer.transform({ equals: false }),
195
+ validate: () => ValidateTransformer.transform({ equals: false }),
196
+
197
+ // STRICT
198
+ assertEquals: () =>
199
+ AssertTransformer.transform({ equals: true, guard: false }),
200
+ assertGuardEquals: () =>
201
+ AssertTransformer.transform({ equals: true, guard: true }),
202
+ equals: () => IsTransformer.transform({ equals: true }),
203
+ validateEquals: () => ValidateTransformer.transform({ equals: true }),
204
+
205
+ // RANDOM + INTERNAL
206
+ random: () => RandomTransformer.transform,
207
+ metadata: () => ReflectMetadataTransformer.transform,
208
+
209
+ // FACTORIES
210
+ createAssert: () =>
211
+ CreateAssertTransformer.transform({ equals: false, guard: false }),
212
+ createAssertGuard: () =>
213
+ CreateAssertTransformer.transform({ equals: false, guard: true }),
214
+ createAssertType: () =>
215
+ CreateAssertTransformer.transform({ equals: false, guard: false }),
216
+ createIs: () => CreateIsTransformer.transform({ equals: false }),
217
+ createValidate: () =>
218
+ CreateValidateTransformer.transform({
219
+ equals: false,
220
+ standardSchema: true,
221
+ }),
222
+ createAssertEquals: () =>
223
+ CreateAssertTransformer.transform({ equals: true, guard: false }),
224
+ createAssertGuardEquals: () =>
225
+ CreateAssertTransformer.transform({ equals: true, guard: true }),
226
+ createEquals: () => CreateIsTransformer.transform({ equals: true }),
227
+ createValidateEquals: () =>
228
+ CreateValidateTransformer.transform({
229
+ equals: true,
230
+ standardSchema: true,
231
+ }),
232
+ createRandom: () => CreateRandomTransformer.transform,
233
+ },
234
+ functional: {
235
+ // ASSERTIONS
236
+ assertFunction: () =>
237
+ FunctionalGenericTransformer.transform({
238
+ method: "assertFunction",
239
+ config: {
240
+ equals: false,
241
+ },
242
+ programmer: FunctionalAssertFunctionProgrammer.write,
243
+ }),
244
+ assertParameters: () =>
245
+ FunctionalGenericTransformer.transform({
246
+ method: "assertParameters",
247
+ config: {
248
+ equals: false,
249
+ },
250
+ programmer: FunctionalAssertParametersProgrammer.write,
251
+ }),
252
+ assertReturn: () =>
253
+ FunctionalGenericTransformer.transform({
254
+ method: "assertReturn",
255
+ config: {
256
+ equals: false,
257
+ },
258
+ programmer: FunctionAssertReturnProgrammer.write,
259
+ }),
260
+ assertEqualsFunction: () =>
261
+ FunctionalGenericTransformer.transform({
262
+ method: "assertEqualsFunction",
263
+ config: {
264
+ equals: true,
265
+ },
266
+ programmer: FunctionalAssertFunctionProgrammer.write,
267
+ }),
268
+ assertEqualsParameters: () =>
269
+ FunctionalGenericTransformer.transform({
270
+ method: "assertEqualsParameters",
271
+ config: {
272
+ equals: true,
273
+ },
274
+ programmer: FunctionalAssertParametersProgrammer.write,
275
+ }),
276
+ assertEqualsReturn: () =>
277
+ FunctionalGenericTransformer.transform({
278
+ method: "assertEqualsReturn",
279
+ config: {
280
+ equals: true,
281
+ },
282
+ programmer: FunctionAssertReturnProgrammer.write,
283
+ }),
284
+
285
+ // IS
286
+ isFunction: () =>
287
+ FunctionalGenericTransformer.transform({
288
+ method: "isFunction",
289
+ config: {
290
+ equals: false,
291
+ },
292
+ programmer: FunctionalIsFunctionProgrammer.write,
293
+ }),
294
+ isParameters: () =>
295
+ FunctionalGenericTransformer.transform({
296
+ method: "isParameters",
297
+ config: {
298
+ equals: false,
299
+ },
300
+ programmer: FunctionalIsParametersProgrammer.write,
301
+ }),
302
+ isReturn: () =>
303
+ FunctionalGenericTransformer.transform({
304
+ method: "isReturn",
305
+ config: {
306
+ equals: false,
307
+ },
308
+ programmer: FunctionalIsReturnProgrammer.write,
309
+ }),
310
+ equalsFunction: () =>
311
+ FunctionalGenericTransformer.transform({
312
+ method: "equalsFunction",
313
+ config: {
314
+ equals: true,
315
+ },
316
+ programmer: FunctionalIsFunctionProgrammer.write,
317
+ }),
318
+ equalsParameters: () =>
319
+ FunctionalGenericTransformer.transform({
320
+ method: "equalsParameters",
321
+ config: {
322
+ equals: true,
323
+ },
324
+ programmer: FunctionalIsParametersProgrammer.write,
325
+ }),
326
+ equalsReturn: () =>
327
+ FunctionalGenericTransformer.transform({
328
+ method: "equalsReturn",
329
+ config: {
330
+ equals: true,
331
+ },
332
+ programmer: FunctionalIsReturnProgrammer.write,
333
+ }),
334
+
335
+ // VALIDATIONS
336
+ validateFunction: () =>
337
+ FunctionalGenericTransformer.transform({
338
+ method: "validateFunction",
339
+ config: {
340
+ equals: false,
341
+ },
342
+ programmer: FunctionalValidateFunctionProgrammer.write,
343
+ }),
344
+ validateParameters: () =>
345
+ FunctionalGenericTransformer.transform({
346
+ method: "validateParameters",
347
+ config: {
348
+ equals: false,
349
+ },
350
+ programmer: FunctionalValidateParametersProgrammer.write,
351
+ }),
352
+ validateReturn: () =>
353
+ FunctionalGenericTransformer.transform({
354
+ method: "validateReturn",
355
+ config: {
356
+ equals: false,
357
+ },
358
+ programmer: FunctionalValidateReturnProgrammer.write,
359
+ }),
360
+ validateEqualsFunction: () =>
361
+ FunctionalGenericTransformer.transform({
362
+ method: "validateEqualsFunction",
363
+ config: {
364
+ equals: true,
365
+ },
366
+ programmer: FunctionalValidateFunctionProgrammer.write,
367
+ }),
368
+ validateEqualsParameters: () =>
369
+ FunctionalGenericTransformer.transform({
370
+ method: "validateEqualsParameters",
371
+ config: {
372
+ equals: true,
373
+ },
374
+ programmer: FunctionalValidateParametersProgrammer.write,
375
+ }),
376
+ validateEqualsReturn: () =>
377
+ FunctionalGenericTransformer.transform({
378
+ method: "validateEqualsReturn",
379
+ config: {
380
+ equals: true,
381
+ },
382
+ programmer: FunctionalValidateReturnProgrammer.write,
383
+ }),
384
+ },
385
+ http: {
386
+ // FORM-DATA
387
+ formData: () => HttpFormDataTransformer.transform,
388
+ isFormData: () => HttpIsFormDataTransformer.transform,
389
+ assertFormData: () => HttpAssertFormDataTransformer.transform,
390
+ validateFormData: () => HttpValidateFormDataTransformer.transform,
391
+
392
+ // HEADERS
393
+ headers: () => HttpHeadersTransformer.transform,
394
+ isHeaders: () => HttpIsHeadersTransformer.transform,
395
+ assertHeaders: () => HttpAssertHeadersTransformer.transform,
396
+ validateHeaders: () => HttpValidateHeadersTransformer.transform,
397
+
398
+ // PARAMETER
399
+ parameter: () => HttpParameterTransformer.transform,
400
+
401
+ // QUERY
402
+ query: () => HttpQueryTransformer.transform,
403
+ isQuery: () => HttpIsQueryTransformer.transform,
404
+ assertQuery: () => HttpAssertQueryTransformer.transform,
405
+ validateQuery: () => HttpValidateQueryTransformer.transform,
406
+
407
+ // FACTORIES
408
+ createFormData: () => CreateHttpFormDataTransformer.transform,
409
+ createIsFormData: () => CreateHttpIsFormDataTransformer.transform,
410
+ createAssertFormData: () => CreateHttpAssertFormDataTransformer.transform,
411
+ createValidateFormData: () =>
412
+ CreateHttpValidateFormDataTransformer.transform,
413
+ createHeaders: () => CreateHttpHeadersTransformer.transform,
414
+ createIsHeaders: () => CreateHttpIsHeadersTransformer.transform,
415
+ createAssertHeaders: () => CreateHttpAssertHeadersTransformer.transform,
416
+ createValidateHeaders: () => CreateHttpValidateHeadersTransformer.transform,
417
+ createParameter: () => CreateHttpParameterTransformer.transform,
418
+ createQuery: () => CreateHttpQueryTransformer.transform,
419
+ createIsQuery: () => CreateHttpIsQueryTransformer.transform,
420
+ createAssertQuery: () => CreateHttpAssertQueryTransformer.transform,
421
+ createValidateQuery: () => CreateHttpValidateQueryTransformer.transform,
422
+ },
423
+ llm: {
424
+ controller: () => LlmControllerTransformer.transform,
425
+ applicationOfValidate: () => LlmApplicationTransformer.transform,
426
+ application: () => LlmApplicationTransformer.transform,
427
+ structuredOutput: () => LlmStructuredOutputTransformer.transform,
428
+ parameters: () => LlmParametersTransformer.transform,
429
+ schema: () => LlmSchemaTransformer.transform,
430
+ parse: () => LlmParseTransformer.transform,
431
+ createParse: () => LlmCreateParseTransformer.transform,
432
+ coerce: () => LlmCoerceTransformer.transform,
433
+ createCoerce: () => LlmCreateCoerceTransformer.transform,
434
+ },
435
+ json: {
436
+ // METADATA
437
+ schema: () => JsonSchemaTransformer.transform,
438
+ schemas: () => JsonSchemasTransformer.transform,
439
+ application: () => JsonApplicationTransformer.transform,
440
+
441
+ // PARSER
442
+ isParse: () => JsonIsParseTransformer.transform,
443
+ assertParse: () => JsonAssertParseTransformer.transform,
444
+ validateParse: () => JsonValidateParseTransformer.transform,
445
+
446
+ // STRINGIFY
447
+ stringify: () => JsonStringifyTransformer.transform,
448
+ assertStringify: () => JsonAssertStringifyTransformer.transform,
449
+ isStringify: () => JsonIsStringifyTransformer.transform,
450
+ validateStringify: () => JsonValidateStringifyTransformer.transform,
451
+
452
+ // FACTORIES
453
+ createIsParse: () => JsonCreateIsParseTransformer.transform,
454
+ createAssertParse: () => JsonCreateAssertParseTransformer.transform,
455
+ createValidateParse: () => JsonCreateValidateParseTransformer.transform,
456
+ createStringify: () => JsonCreateStringifyTransformer.transform,
457
+ createAssertStringify: () => JsonCreateAssertStringifyTransformer.transform,
458
+ createIsStringify: () => JsonCreateIsStringifyTransformer.transform,
459
+ createValidateStringify: () =>
460
+ JsonCreateValidateStringifyTransformer.transform,
461
+ },
462
+ protobuf: {
463
+ // SCHEMA
464
+ message: () => ProtobufMessageTransformer.transform,
465
+
466
+ // ENCODE
467
+ encode: () => ProtobufEncodeTransformer.transform,
468
+ assertEncode: () => ProtobufAssertEncodeTransformer.transform,
469
+ isEncode: () => ProtobufIsEncodeTransformer.transform,
470
+ validateEncode: () => ProtobufValidateEncodeTransformer.transform,
471
+
472
+ // DECODE
473
+ decode: () => ProtobufDecodeTransformer.transform,
474
+ assertDecode: () => ProtobufAssertDecodeTransformer.transform,
475
+ isDecode: () => ProtobufIsDecodeTransformer.transform,
476
+ validateDecode: () => ProtobufValidateDecodeTransformer.transform,
477
+
478
+ // FACTORIES
479
+ createEncode: () => ProtobufCreateEncodeTransformer.transform,
480
+ createAssertEncode: () => ProtobufCreateAssertEncodeTransformer.transform,
481
+ createIsEncode: () => ProtobufCreateIsEncodeTransformer.transform,
482
+ createValidateEncode: () =>
483
+ ProtobufCreateValidateEncodeTransformer.transform,
484
+ createDecode: () => ProtobufCreateDecodeTransformer.transform,
485
+ createAssertDecode: () => ProtobufCreateAssertDecodeTransformer.transform,
486
+ createIsDecode: () => ProtobufCreateIsDecodeTransformer.transform,
487
+ createValidateDecode: () =>
488
+ ProtobufCreateValidateDecodeTransformer.transform,
489
+ },
490
+ reflect: {
491
+ metadata: () => ReflectMetadataTransformer.transform,
492
+ name: () => ReflectNameTransformer.transform,
493
+ schema: () => ReflectSchemaTransformer.transform,
494
+ schemas: () => ReflectSchemasTransformer.transform,
495
+ },
496
+ misc: {
497
+ literals: () => MiscLiteralsTransformer.transform,
498
+
499
+ // CLONE
500
+ clone: () => MiscCloneTransformer.transform,
501
+ assertClone: () => MiscAssertCloneTransformer.transform,
502
+ isClone: () => MiscIsCloneTransformer.transform,
503
+ validateClone: () => MiscValidateCloneTransformer.transform,
504
+
505
+ // PRUNE
506
+ prune: () => MiscPruneTransformer.transform,
507
+ assertPrune: () => MiscAssertPruneTransformer.transform,
508
+ isPrune: () => MiscIsPruneTransformer.transform,
509
+ validatePrune: () => MiscValidatePruneTransformer.transform,
510
+
511
+ // FACTORIES
512
+ createClone: () => MiscCreateCloneTransformer.transform,
513
+ createAssertClone: () => MiscCreateAssertCloneTransformer.transform,
514
+ createIsClone: () => MiscCreateIsCloneTransformer.transform,
515
+ createValidateClone: () => MiscCreateValidateCloneTransformer.transform,
516
+ createPrune: () => MiscCreatePruneTransformer.transform,
517
+ createAssertPrune: () => MiscCreateAssertPruneTransformer.transform,
518
+ createIsPrune: () => MiscCreateIsPruneTransformer.transform,
519
+ createValidatePrune: () => MiscCreateValidatePruneTransformer.transform,
520
+ },
521
+ notations: {
522
+ // CAMEL
523
+ camel: () => NotationGeneralTransformer.transform(NamingConvention.camel),
524
+ assertCamel: () =>
525
+ NotationAssertGeneralTransformer.transform(NamingConvention.camel),
526
+ isCamel: () =>
527
+ NotationIsGeneralTransformer.transform(NamingConvention.camel),
528
+ validateCamel: () =>
529
+ NotationValidateGeneralTransformer.transform(NamingConvention.camel),
530
+
531
+ // PASCAL
532
+ pascal: () => NotationGeneralTransformer.transform(NamingConvention.pascal),
533
+ assertPascal: () =>
534
+ NotationAssertGeneralTransformer.transform(NamingConvention.pascal),
535
+ isPascal: () =>
536
+ NotationIsGeneralTransformer.transform(NamingConvention.pascal),
537
+ validatePascal: () =>
538
+ NotationValidateGeneralTransformer.transform(NamingConvention.pascal),
539
+
540
+ // SNAKE
541
+ snake: () => NotationGeneralTransformer.transform(NamingConvention.snake),
542
+ assertSnake: () =>
543
+ NotationAssertGeneralTransformer.transform(NamingConvention.snake),
544
+ isSnake: () =>
545
+ NotationIsGeneralTransformer.transform(NamingConvention.snake),
546
+ validateSnake: () =>
547
+ NotationValidateGeneralTransformer.transform(NamingConvention.snake),
548
+
549
+ // FACTORIES
550
+ createCamel: () =>
551
+ NotationCreateGeneralTransformer.transform(NamingConvention.camel),
552
+ createAssertCamel: () =>
553
+ NotationCreateAssertGeneralTransformer.transform(NamingConvention.camel),
554
+ createIsCamel: () =>
555
+ NotationCreateIsGeneralTransformer.transform(NamingConvention.camel),
556
+ createValidateCamel: () =>
557
+ NotationCreateValidateGeneralTransformer.transform(
558
+ NamingConvention.camel,
559
+ ),
560
+ createPascal: () =>
561
+ NotationCreateGeneralTransformer.transform(NamingConvention.pascal),
562
+ createAssertPascal: () =>
563
+ NotationCreateAssertGeneralTransformer.transform(NamingConvention.pascal),
564
+ createIsPascal: () =>
565
+ NotationCreateIsGeneralTransformer.transform(NamingConvention.pascal),
566
+ createValidatePascal: () =>
567
+ NotationCreateValidateGeneralTransformer.transform(
568
+ NamingConvention.pascal,
569
+ ),
570
+ createSnake: () =>
571
+ NotationCreateGeneralTransformer.transform(NamingConvention.snake),
572
+ createAssertSnake: () =>
573
+ NotationCreateAssertGeneralTransformer.transform(NamingConvention.snake),
574
+ createIsSnake: () =>
575
+ NotationCreateIsGeneralTransformer.transform(NamingConvention.snake),
576
+ createValidateSnake: () =>
577
+ NotationCreateValidateGeneralTransformer.transform(
578
+ NamingConvention.snake,
579
+ ),
580
+ },
581
+ };