typia 3.8.0-dev.20230416 → 3.8.0-dev.20230417

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 (50) hide show
  1. package/README.md +35 -228
  2. package/lib/factories/TypiaFileFactory.js +9 -4
  3. package/lib/factories/TypiaFileFactory.js.map +1 -1
  4. package/package.json +1 -1
  5. package/src/IRandomGenerator.ts +33 -33
  6. package/src/executable/TypiaGenerateWizard.ts +85 -85
  7. package/src/executable/TypiaSetupWizard.ts +118 -118
  8. package/src/executable/setup/ArgumentParser.ts +45 -45
  9. package/src/executable/setup/CommandExecutor.ts +8 -8
  10. package/src/executable/setup/FileRetriever.ts +22 -22
  11. package/src/executable/setup/PackageManager.ts +71 -71
  12. package/src/executable/setup/PluginConfigurator.ts +59 -59
  13. package/src/executable/typia.ts +52 -52
  14. package/src/factories/IdentifierFactory.ts +59 -59
  15. package/src/factories/MetadataTagFactory.ts +302 -302
  16. package/src/factories/TypiaFileFactory.ts +12 -3
  17. package/src/metadata/ICommentTag.ts +4 -4
  18. package/src/metadata/Metadata.ts +533 -533
  19. package/src/module.ts +2043 -2043
  20. package/src/programmers/AssertProgrammer.ts +284 -284
  21. package/src/programmers/CheckerProgrammer.ts +920 -920
  22. package/src/programmers/LiteralsProgrammer.ts +65 -65
  23. package/src/programmers/RandomProgrammer.ts +413 -413
  24. package/src/programmers/ValidateProgrammer.ts +317 -317
  25. package/src/programmers/helpers/RandomJoiner.ts +161 -161
  26. package/src/programmers/helpers/RandomRanger.ts +216 -216
  27. package/src/programmers/internal/application_native.ts +32 -32
  28. package/src/programmers/internal/check_array.ts +30 -30
  29. package/src/programmers/internal/check_array_length.ts +35 -35
  30. package/src/programmers/internal/check_custom.ts +33 -33
  31. package/src/programmers/internal/check_number.ts +177 -177
  32. package/src/programmers/internal/check_object.ts +55 -55
  33. package/src/programmers/internal/check_string_tags.ts +67 -67
  34. package/src/programmers/internal/check_template.ts +56 -56
  35. package/src/programmers/internal/check_union_array_like.ts +272 -272
  36. package/src/programmers/internal/feature_object_entries.ts +63 -63
  37. package/src/programmers/internal/get_comment_tags.ts +23 -23
  38. package/src/programmers/internal/metadata_to_pattern.ts +34 -34
  39. package/src/programmers/internal/random_custom.ts +30 -30
  40. package/src/programmers/internal/stringify_dynamic_properties.ts +168 -168
  41. package/src/programmers/internal/stringify_regular_properties.ts +84 -84
  42. package/src/transformers/CallExpressionTransformer.ts +174 -174
  43. package/src/transformers/ImportTransformer.ts +66 -66
  44. package/src/transformers/features/miscellaneous/ApplicationTransformer.ts +119 -119
  45. package/src/transformers/features/miscellaneous/CreateRandomTransformer.ts +41 -41
  46. package/src/transformers/features/miscellaneous/LiteralsTransformer.ts +30 -30
  47. package/src/transformers/features/miscellaneous/MetadataTransformer.ts +54 -54
  48. package/src/transformers/features/miscellaneous/RandomTransformer.ts +46 -46
  49. package/src/typings/Customizable.ts +5 -5
  50. package/src/utils/RandomGenerator.ts +93 -93
package/README.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # Typia
2
+ ![Typia Logo](https://typia.io/logo.png)
3
+
2
4
  [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/typia/blob/master/LICENSE)
3
5
  [![npm version](https://img.shields.io/npm/v/typia.svg)](https://www.npmjs.com/package/typia)
4
6
  [![Downloads](https://img.shields.io/npm/dm/typia.svg)](https://www.npmjs.com/package/typia)
5
7
  [![Build Status](https://github.com/samchon/typia/workflows/build/badge.svg)](https://github.com/samchon/typia/actions?query=workflow%3Abuild)
6
- [![Guide Documents](https://img.shields.io/badge/wiki-documentation-forestgreen)](https://github.com/samchon/typia/wiki)
8
+ [![Guide Documents](https://img.shields.io/badge/wiki-documentation-forestgreen)](https://typia.io/docs/)
7
9
 
8
10
  ```typescript
9
11
  // RUNTIME VALIDATORS
@@ -21,247 +23,52 @@ export function assertStringify<T>(input: T): string; // safe and faster
21
23
 
22
24
  // MISC
23
25
  export function random<T>(g?: Partial<IRandomGenerator>): Primitive<T>;
24
- export function literals<T extends Atomic.Type>(): T[];
25
- export function clone<T>(input: T): Primitive<T>; // deep clone
26
- export function prune<T extends object>(input: T): void; // erase extra props
27
- // +) isClone, assertClone, validateClone
28
- // +) isPrune, assertPrune, validatePrune
29
26
  ```
30
27
 
31
- `typia` is a transformer library of TypeScript, supporting below features:
28
+ Typia is a transformer library supporting below features:
32
29
 
33
30
  - Super-fast Runtime Validators
34
31
  - Safe JSON parse and fast stringify functions
35
32
  - JSON schema generator
36
33
  - Random data generator
37
34
 
38
- All functions in `typia` require **only one line**. You don't need any extra dedication like JSON schema definitions or decorator function calls. Just call `typia` function with only one line like `typia.assert<T>(input)`.
39
-
40
- Also, as `typia` performs AOT (Ahead of Time) compilation skill, its performance is much faster than other competitive libaries. For an example, when comparing validate function `is()` with other competitive libraries, `typia` is maximum **20,000x faster** than `class-validator`.
41
-
42
- ![Is Function Benchmark](https://github.com/samchon/typia/raw/master/benchmark/results/11th%20Gen%20Intel(R)%20Core(TM)%20i5-1135G7%20%40%202.40GHz/images/is.svg)
43
-
44
- > Measured on [Intel i5-1135g7, Surface Pro 8](https://github.com/samchon/typia/tree/master/benchmark/results/11th%20Gen%20Intel(R)%20Core(TM)%20i5-1135G7%20%40%202.40GHz#is)
45
-
35
+ > **Note**
36
+ >
37
+ > - **Only one line** required, with pure TypeScript type
38
+ > - Runtime validator is **20,000x faster** than `class-validator`
39
+ > - JSON serialization is **200x faster** than `class-transformer`
46
40
 
47
41
 
48
42
 
49
- ## Sponsors and Backers
43
+ ## Sponsors
50
44
  Thanks for your support.
51
45
 
52
46
  Your donation would encourage `typia` development.
53
47
 
54
48
  [![Sponsers](https://opencollective.com/typia/badge.svg?avatarHeight=75&width=600)](https://opencollective.com/typia)
55
49
 
56
-
57
-
58
-
59
- ## Setup
60
- ### Transformation
61
- ```bash
62
- npm install --save typia
63
- npx typia setup
64
- ```
65
-
66
- AOT (Ahead of Time) compilation mode.
67
-
68
- When you write a TypeScript code calling `typia.createIs<string | null>()` function and compile it, `typia` will write optimal validation code like below, for the `string | null` type. This is the transform mode performing AOT (Ahead of Time) compilation.
69
-
70
- ```typescript
71
- // TYPESCRIPT CODE
72
- import typia from "typia";
73
- export const check = typia.createIs<string | null>();
74
-
75
- // COMPILED JAVASCRIPT CODE
76
- export const check = (input) => "string" === typeof input || null === input;
77
- ```
78
-
79
- ### Generation
80
- ```bash
81
- # INSTALL TYPIA
82
- npm install --save typia
83
- npm install --save-dev typescript
84
-
85
- # GENERATE TRANSFORMED TYPESCRIPT CODES
86
- npx typia generate \
87
- --input src/templates \
88
- --output src/generated \
89
- --project tsconfig.json
90
- ```
91
-
92
- For frontend projects.
93
-
94
- If you're using non-standard TypeScript compiler, you can't use [transform mode](#transformation).
95
-
96
- - Non-standard TypeScript compilers:
97
- - [swc](https://swc.rs/) in Next.JS
98
- - [esbuild](https://esbuild.github.io/) in Vite
99
- - [babel](https://babeljs.io/) in Create-React-App
100
-
101
- Instead, you should utilize the generation mode.
102
-
103
- Install `typia` through `npm install` command and run `typia generate` command. Then, generator of `typia` reads your TypeScript code of `--input`, and writes transformed TypeScript code into the `--output` directory, like below.
104
-
105
- ```typescript
106
- //--------
107
- // src/templates/check.ts
108
- //--------
109
- import typia from "typia";
110
- export const check = typia.createIs<string | null>();
111
-
112
- //--------
113
- // src/generated/check.ts
114
- //--------
115
- import typia from "typia";
116
- export const check =
117
- (input: unknown): input is string | null
118
- => "string" === typeof input || null === input;
119
- ```
120
-
121
-
122
-
123
-
124
- ## Features
125
- [![Guide Documents](https://img.shields.io/badge/wiki-documentation-forestgreen)](https://github.com/samchon/typia/wiki)
126
-
127
- In here README documents, only summarized informations are provided.
128
-
129
- For more details, refer to the [Guide Documents (wiki)](https://github.com/samchon/typia/wiki).
130
-
131
- > - **Runtime Validators**
132
- > - [powerful validator](https://github.com/samchon/typia/wiki/Runtime-Validators#powerful-validator)
133
- > - [`is()` function](https://github.com/samchon/typia/wiki/Runtime-Validators#is-function)
134
- > - [`assert()` function](https://github.com/samchon/typia/wiki/Runtime-Validators#assert-function)
135
- > - [`validate()` function](https://github.com/samchon/typia/wiki/Runtime-Validators#validate-function)
136
- > - [strict validators](https://github.com/samchon/typia/wiki/Runtime-Validators#strict-validators)
137
- > - [factory functions](https://github.com/samchon/typia/wiki/Runtime-Validators#factory-functions)
138
- > - [comment tags](https://github.com/samchon/typia/wiki/Runtime-Validators#comment-tags)
139
- > - [custom validators](https://github.com/samchon/typia/wiki/Runtime-Validators#custom-validators)
140
- > - **Enhanced JSON**
141
- > - [`stringify()` functions](https://github.com/samchon/typia/wiki/Enhanced-JSON#stringify-functions)
142
- > - [`parse()` functions](https://github.com/samchon/typia/wiki/Enhanced-JSON#parse-functions)
143
- > - [JSON schema](https://github.com/samchon/typia/wiki/Enhanced-JSON#json-schema)
144
- > - [comment tags](https://github.com/samchon/typia/wiki/Enhanced-JSON#comment-tags)
145
- > - **Random Generator**
146
- > - [`random()` function](https://github.com/samchon/typia/wiki/Random-Generator#random-function)
147
- > - [comment tags](https://github.com/samchon/typia/wiki/Random-Geneerator#comment-tags)
148
- > - [customization](https://github.com/samchon/typia/wiki/Random-Generator#customization)
149
-
150
- ### Runtime Validators
151
- ```typescript
152
- // ALLOW SUPERFLUOUS PROPERTIES
153
- export function is<T>(input: unknown): input is T; // returns boolean
154
- export function assert<T>(input: unknown): T; // throws `TypeGuardError`
155
- export function validate<T>(input: unknown): IValidation<T>; // detailed
156
-
157
- // DO NOT ALLOW SUPERFLUOUS PROPERTIES
158
- export function equals<T>(input: unknown): input is T;
159
- export function assertEquals<T>(input: unknown): T;
160
- export function validateEquals<T>(input: unknown): IValidation<T>;
161
-
162
- // REUSABLE FACTORY FUNCTIONS
163
- export function createIs<T>(): (input: unknown) => input is T;
164
- export function createAssert<T>(): (input: unknown) => T;
165
- export function createValidate<T>(): (input: unknown) => IValidation<T>;
166
- export function createEquals<T>(): (input: unknown) => input is T;
167
- export function createAssertEquals<T>(): (input: unknown) => T;
168
- export function createValidateEquals<T>(): (input: unknown) => IValidation<T>;
169
-
170
- // YOU CAN ADD CUSTOM VALIDATORS
171
- export const customValidators: CustomValidatorMap;
172
- ```
173
-
174
- `typia` supports three type of validator functions:
175
-
176
- - `is()`: returns `false` if not matched with the type `T`
177
- - `assert()`: throws a [`TypeGuardError`](https://github.com/samchon/typia/blob/master/src/TypeGuardError.ts) when not matched
178
- - `validate()`
179
- - when matched, returns [`IValidation.ISuccess<T>`](https://github.com/samchon/typia/blob/master/src/IValidation.ts) with `value` property
180
- - otherwise not matched, returns [`IValidation.IFailure`](https://github.com/samchon/typia/blob/master/src/IValidation.ts) with `errors` property
181
-
182
- Also, if you want more strict validator functions that even do not allowing superfluous properties not written in the type `T`, you can use those functions instead; `equals()`, `assertEquals()`, `validateEquals()`. Otherwise you want to create resuable validator functions, you can utilize factory functions like `createIs()` instead.
183
-
184
- When you want to add special validation logics, like limiting range of numeric values, you can do it through comment tags. Furthermore, you can add your custom validator logics. If you want to know about them, visit the Guide Documents:
185
-
186
- - [Features > Runtime Validators > Comment Tags](https://github.com/samchon/typia/wiki/Runtime-Validators#comment-tags)
187
- - [Features > Runtime Validators > Custom Validators](https://github.com/samchon/typia/wiki/Runtime-Validators#custom-validators).
188
-
189
- ### Enhanced JSON
190
- ```typescript
191
- // JSON SCHEMA GENERATOR
192
- export function application<
193
- Types extends unknown[],
194
- Purpose extends "swagger" | "ajv" = "swagger",
195
- Prefix extends string = Purpose extends "swagger"
196
- ? "#/components/schemas"
197
- : "components#/schemas",
198
- >(): IJsonApplication;
199
-
200
- // SAFE PARSER FUNCTIONS
201
- export function isParse<T>(input: string): T | null;
202
- export function assertParse<T>(input: string): T;
203
- export function validateParse<T>(input: string): IValidation<T>;
204
-
205
- // FASTER STRINGIFY FUNCTIONS
206
- export function stringify<T>(input: T): string; // unsafe
207
- export function isStringify<T>(input: T): string | null; // safe
208
- export function assertStringify<T>(input: T): string;
209
- export function validateStringify<T>(input: T): IValidation<string>;
210
-
211
- // FACTORY FUNCTIONS
212
- export function createAssertParse<T>(): (input: string) => T;
213
- export function createAssertStringify<T>(): (input: T) => string;
214
- // +) createIsParse, createValidateParse
215
- // +) createStringify, createIsStringify, createValidateStringify
216
- ```
217
-
218
- `typia` supports enhanced JSON functions.
219
-
220
- - `application()`: generate JSON schema with only one line
221
- - you can complement JSON schema contents through [comment tags](https://github.com/samchon/typia/wiki/Enhanced-JSON#comment-tags)
222
- - `assertParse()`: parse JSON string safely with type validation
223
- - `isStringify()`: maximum 160x faster JSON stringify fuction even type safe
224
-
225
- ![JSON string conversion speed](https://raw.githubusercontent.com/samchon/typia/master/benchmark/results/AMD%20Ryzen%207%206800HS%20with%20Radeon%20Graphics/images/stringify.svg)
226
-
227
- > Measured on [AMD R7 6800HS](https://github.com/samchon/typia/tree/master/benchmark/results/AMD%20Ryzen%207%206800HS%20with%20Radeon%20Graphics)
228
-
229
- ### Miscellaneous
230
- ```typescript
231
- export function random<T>(g?: Partial<IRandomGenerator>): Primitive<T>;
232
- export function literals<T extends Atomic.Type>(): T[];
233
- export function clone<T>(input: T): Primitive<T>; // deep copy
234
- export function prune<T>(input: T): void; // remove superfluous properties
235
- // +) isClone, assertClone, validateClone
236
- // +) isPrune, assertPrune, validatePrune
237
- ```
238
-
239
- When you need random data, just call only `typia.random<T>()` function.
240
-
241
- If you need specific random data generation, utilize comment tags or do customize.
242
-
243
- - [Features > Random Generator > comment tags](https://github.com/samchon/typia/wiki/Random-Generator#random-function)
244
- - [Features > Random Generator > customization](https://github.com/samchon/typia/wiki/Random-Generator#customization)
245
-
246
-
247
-
248
- ## Appendix
249
- ### Nestia
250
- [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/nestia/blob/master/LICENSE)
251
- [![npm version](https://img.shields.io/npm/v/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)
252
- [![Downloads](https://img.shields.io/npm/dm/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)
253
- [![Build Status](https://github.com/samchon/typia/workflows/build/badge.svg)](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)
254
- [![Guide Documents](https://img.shields.io/badge/wiki-documentation-forestgreen)](https://github.com/samchon/nestia/wiki)
255
-
256
- [Nestia](https://github.com/samchon/nestia) is a set of helper libraries for `NestJS`, supporting below features:
257
-
258
- - `@nestia/core`: superfast decorators using `typia`
259
- - **20,000x faster** validation
260
- - **200x faster** JSON serialization
261
- - `@nestia/sdk`: evolved **SDK** and **Swagger** generators
262
- - SDK (Software Development Kit)
263
- - interaction library for client developers
264
- - almost same with [tRPC](https://github.com/trpc/trpc)
265
- - `nestia`: just CLI (command line interface) tool
266
-
267
- ![nestia-sdk-demo](https://user-images.githubusercontent.com/13158709/215004990-368c589d-7101-404e-b81b-fbc936382f05.gif)
50
+ ## Guide Documents
51
+ Check out the document in the [website](https://typia.io/docs/):
52
+
53
+ ### 🙋🏻‍♂️ Home
54
+ - [Introduction](https://typia.io/docs/)
55
+ - [Setup](https://typia.io/docs/setup/)
56
+
57
+ ### 📖 Features
58
+ - Runtime Validators
59
+ - [`is()` function](https://typia.io/docs/validators/is/)
60
+ - [`assert()` function](https://typia.io/docs/validators/assert/)
61
+ - [`validate()` function](https://typia.io/docs/validators/validate/)
62
+ - [Comment Tags](https://typia.io/docs/validators/comment-tags/)
63
+ - Enhanced JSON
64
+ - [`stringify()` functions](https://typia.io/docs/json/stringify/)
65
+ - [`parse()` functions](https://typia.io/docs/json/parse/)
66
+ - [JSON Schema](https://typia.io/docs/json/schema)
67
+ - [Random Generator](https://typia.io/docs/random/)
68
+
69
+ ### 🔗 Appendix
70
+ - Utillization Cases
71
+ - [NestJS](https://typia.io/docs/utilization/nestjs/)
72
+ - [tRPC](https://typia.io/docs/utilization/trpc/)
73
+ - [⇲ Benchmark Result](https://github.com/samchon/typia/tree/master/benchmark/results/11th%20Gen%20Intel(R)%20Core(TM)%20i5-1135G7%20%40%202.40GHz)
74
+ - [⇲ `dev.to` Articles](https://dev.to/samchon/series/22474)
@@ -62,7 +62,7 @@ var TypiaFileFactory;
62
62
  function generate(props) {
63
63
  var _a, _b;
64
64
  return __awaiter(this, void 0, void 0, function () {
65
- var parent_1, config, program, _c, _d, result, printer, _e, _f, file, to, content, e_1_1;
65
+ var parent_1, compilerOptions, program, _c, _d, result, printer, _e, _f, file, to, content, e_1_1;
66
66
  var e_1, _g;
67
67
  var _this = this;
68
68
  return __generator(this, function (_h) {
@@ -93,7 +93,12 @@ var TypiaFileFactory;
93
93
  _h.sent();
94
94
  _h.label = 8;
95
95
  case 8:
96
- config = typescript_1.default.readConfigFile(props.project, typescript_1.default.sys.readFile).config;
96
+ compilerOptions = typescript_1.default.parseJsonConfigFileContent(typescript_1.default.readConfigFile(props.project, typescript_1.default.sys.readFile).config, {
97
+ fileExists: typescript_1.default.sys.fileExists,
98
+ readFile: typescript_1.default.sys.readFile,
99
+ readDirectory: typescript_1.default.sys.readDirectory,
100
+ useCaseSensitiveFileNames: typescript_1.default.sys.useCaseSensitiveFileNames,
101
+ }, path_1.default.dirname(props.project)).options;
97
102
  _d = (_c = typescript_1.default).createProgram;
98
103
  return [4, (function () { return __awaiter(_this, void 0, void 0, function () {
99
104
  var container;
@@ -109,7 +114,7 @@ var TypiaFileFactory;
109
114
  });
110
115
  }); })()];
111
116
  case 9:
112
- program = _d.apply(_c, [_h.sent(), config.compilerOptions]);
117
+ program = _d.apply(_c, [_h.sent(), compilerOptions]);
113
118
  result = typescript_1.default.transform(program
114
119
  .getSourceFiles()
115
120
  .filter(function (file) {
@@ -117,7 +122,7 @@ var TypiaFileFactory;
117
122
  path_1.default.resolve(file.fileName).indexOf(props.input) !== -1;
118
123
  }), [
119
124
  ImportTransformer_1.ImportTransformer.transform(props.input)(props.output),
120
- (0, transform_1.default)(program, (_b = ((_a = config.compilerOptions.plugins) !== null && _a !== void 0 ? _a : []).find(function (p) {
125
+ (0, transform_1.default)(program, (_b = ((_a = compilerOptions.plugins) !== null && _a !== void 0 ? _a : []).find(function (p) {
121
126
  return p.transform === "typia/lib/transform" ||
122
127
  p.transform === "../src/transform.ts";
123
128
  })) !== null && _b !== void 0 ? _b : {}),
@@ -1 +1 @@
1
- {"version":3,"file":"TypiaFileFactory.js","sourceRoot":"","sources":["../../src/factories/TypiaFileFactory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAoB;AACpB,8CAAwB;AACxB,0DAA4B;AAE5B,uEAAsE;AAEtE,2DAAqC;AAErC,IAAiB,gBAAgB,CA+GhC;AA/GD,WAAiB,gBAAgB;;IAO7B,SAAsB,QAAQ,CAC1B,KAA8B;;;;;;;;;wBAE9B,KAAK,CAAC,KAAK,GAAG,cAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;wBACxC,KAAK,CAAC,MAAM,GAAG,cAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;wBAErC,WAAM,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,EAAA;;6BAAhC,CAAA,CAAC,SAA+B,CAAC,KAAK,KAAK,CAAA,EAA3C,cAA2C;wBAC3C,MAAM,IAAI,KAAK,CACX,oEAAoE,CACvE,CAAC;;6BACG,CAAA,YAAE,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,KAAK,CAAA,EAArC,cAAqC;wBAC1C,WAAM,YAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAA;;wBAA1D,SAA0D,CAAC;;4BACrD,WAAM,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,EAAA;;6BAAjC,CAAA,CAAC,SAAgC,CAAC,KAAK,KAAK,CAAA,EAA5C,cAA4C;wBAC3C,WAAiB,cAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;wBAChD,WAAM,YAAY,CAAC,QAAM,CAAC,E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CAAC,EAxHgB,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAwHhC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typia",
3
- "version": "3.8.0-dev.20230416",
3
+ "version": "3.8.0-dev.20230417",
4
4
  "description": "Superfast runtime validators with only one line",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -1,33 +1,33 @@
1
- import { Customizable } from "./typings/Customizable";
2
-
3
- export interface IRandomGenerator {
4
- boolean(): boolean;
5
- integer(minimum?: number, maximum?: number): number;
6
- number(minimum?: number, maximum?: number): number;
7
- bigint(minimum?: bigint, maximum?: bigint): bigint;
8
- string(length?: number): string;
9
- array<T>(closure: (index: number) => T, count?: number): T[];
10
-
11
- uuid(): string;
12
- email(): string;
13
- url(): string;
14
- ipv4(): string;
15
- ipv6(): string;
16
- pattern(regex: RegExp): string;
17
- date(minimum?: number, maximum?: number): string;
18
- datetime(minimum?: number, maximum?: number): string;
19
-
20
- customs?: IRandomGenerator.CustomMap;
21
- }
22
- export namespace IRandomGenerator {
23
- export type CustomMap = {
24
- [Type in keyof Customizable]?: (
25
- tags: ICommentTag[],
26
- ) => Customizable[Type] | undefined;
27
- };
28
-
29
- export interface ICommentTag {
30
- name: string;
31
- value?: string;
32
- }
33
- }
1
+ import { Customizable } from "./typings/Customizable";
2
+
3
+ export interface IRandomGenerator {
4
+ boolean(): boolean;
5
+ integer(minimum?: number, maximum?: number): number;
6
+ number(minimum?: number, maximum?: number): number;
7
+ bigint(minimum?: bigint, maximum?: bigint): bigint;
8
+ string(length?: number): string;
9
+ array<T>(closure: (index: number) => T, count?: number): T[];
10
+
11
+ uuid(): string;
12
+ email(): string;
13
+ url(): string;
14
+ ipv4(): string;
15
+ ipv6(): string;
16
+ pattern(regex: RegExp): string;
17
+ date(minimum?: number, maximum?: number): string;
18
+ datetime(minimum?: number, maximum?: number): string;
19
+
20
+ customs?: IRandomGenerator.CustomMap;
21
+ }
22
+ export namespace IRandomGenerator {
23
+ export type CustomMap = {
24
+ [Type in keyof Customizable]?: (
25
+ tags: ICommentTag[],
26
+ ) => Customizable[Type] | undefined;
27
+ };
28
+
29
+ export interface ICommentTag {
30
+ name: string;
31
+ value?: string;
32
+ }
33
+ }
@@ -1,85 +1,85 @@
1
- import fs from "fs";
2
-
3
- import { TypiaFileFactory } from "../factories/TypiaFileFactory";
4
-
5
- import { ArgumentParser } from "./setup/ArgumentParser";
6
- import { PackageManager } from "./setup/PackageManager";
7
-
8
- export namespace TypiaGenerateWizard {
9
- export async function generate(): Promise<void> {
10
- console.log("----------------------------------------");
11
- console.log(" Typia Generate Wizard");
12
- console.log("----------------------------------------");
13
-
14
- // LOAD PACKAGE.JSON INFO
15
- const pack: PackageManager = await PackageManager.mount();
16
- const options: IArguments = await ArgumentParser.parse(pack)(inquiry);
17
- await TypiaFileFactory.generate(options);
18
- }
19
-
20
- const inquiry: ArgumentParser.Inquiry<IArguments> = async (
21
- _pack,
22
- command,
23
- prompt,
24
- action,
25
- ) => {
26
- // PREPARE ASSETS
27
- command.option("--input [path]", "input directory");
28
- command.option("--output [directory]", "output directory");
29
- command.option("--project [project]", "tsconfig.json file location");
30
-
31
- const questioned = { value: false };
32
-
33
- const input = (name: string) => async (message: string) => {
34
- const result = await prompt()({
35
- type: "input",
36
- name,
37
- message,
38
- default: "",
39
- });
40
- return result[name] as string;
41
- };
42
- const select =
43
- (name: string) =>
44
- (message: string) =>
45
- async <Choice extends string>(
46
- choices: Choice[],
47
- ): Promise<Choice> => {
48
- questioned.value = true;
49
- return (
50
- await prompt()({
51
- type: "list",
52
- name: name,
53
- message: message,
54
- choices: choices,
55
- })
56
- )[name];
57
- };
58
- const configure = async () => {
59
- const files: string[] = await (
60
- await fs.promises.readdir(process.cwd())
61
- ).filter(
62
- (str) =>
63
- str.substring(0, 8) === "tsconfig" &&
64
- str.substring(str.length - 5) === ".json",
65
- );
66
- if (files.length === 0)
67
- throw new Error(`Unable to find "tsconfig.json" file.`);
68
- else if (files.length === 1) return files[0];
69
- return select("tsconfig")("TS Config File")(files);
70
- };
71
-
72
- return action(async (options) => {
73
- options.input ??= await input("input")("input directory");
74
- options.output ??= await input("output")("output directory");
75
- options.project ??= await configure();
76
- return options as IArguments;
77
- });
78
- };
79
-
80
- export interface IArguments {
81
- input: string;
82
- output: string;
83
- project: string;
84
- }
85
- }
1
+ import fs from "fs";
2
+
3
+ import { TypiaFileFactory } from "../factories/TypiaFileFactory";
4
+
5
+ import { ArgumentParser } from "./setup/ArgumentParser";
6
+ import { PackageManager } from "./setup/PackageManager";
7
+
8
+ export namespace TypiaGenerateWizard {
9
+ export async function generate(): Promise<void> {
10
+ console.log("----------------------------------------");
11
+ console.log(" Typia Generate Wizard");
12
+ console.log("----------------------------------------");
13
+
14
+ // LOAD PACKAGE.JSON INFO
15
+ const pack: PackageManager = await PackageManager.mount();
16
+ const options: IArguments = await ArgumentParser.parse(pack)(inquiry);
17
+ await TypiaFileFactory.generate(options);
18
+ }
19
+
20
+ const inquiry: ArgumentParser.Inquiry<IArguments> = async (
21
+ _pack,
22
+ command,
23
+ prompt,
24
+ action,
25
+ ) => {
26
+ // PREPARE ASSETS
27
+ command.option("--input [path]", "input directory");
28
+ command.option("--output [directory]", "output directory");
29
+ command.option("--project [project]", "tsconfig.json file location");
30
+
31
+ const questioned = { value: false };
32
+
33
+ const input = (name: string) => async (message: string) => {
34
+ const result = await prompt()({
35
+ type: "input",
36
+ name,
37
+ message,
38
+ default: "",
39
+ });
40
+ return result[name] as string;
41
+ };
42
+ const select =
43
+ (name: string) =>
44
+ (message: string) =>
45
+ async <Choice extends string>(
46
+ choices: Choice[],
47
+ ): Promise<Choice> => {
48
+ questioned.value = true;
49
+ return (
50
+ await prompt()({
51
+ type: "list",
52
+ name: name,
53
+ message: message,
54
+ choices: choices,
55
+ })
56
+ )[name];
57
+ };
58
+ const configure = async () => {
59
+ const files: string[] = await (
60
+ await fs.promises.readdir(process.cwd())
61
+ ).filter(
62
+ (str) =>
63
+ str.substring(0, 8) === "tsconfig" &&
64
+ str.substring(str.length - 5) === ".json",
65
+ );
66
+ if (files.length === 0)
67
+ throw new Error(`Unable to find "tsconfig.json" file.`);
68
+ else if (files.length === 1) return files[0];
69
+ return select("tsconfig")("TS Config File")(files);
70
+ };
71
+
72
+ return action(async (options) => {
73
+ options.input ??= await input("input")("input directory");
74
+ options.output ??= await input("output")("output directory");
75
+ options.project ??= await configure();
76
+ return options as IArguments;
77
+ });
78
+ };
79
+
80
+ export interface IArguments {
81
+ input: string;
82
+ output: string;
83
+ project: string;
84
+ }
85
+ }