typia 5.2.0-dev.20231007 → 5.2.0

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 (71) hide show
  1. package/lib/CamelCase.d.ts +10 -0
  2. package/lib/PascalCase.d.ts +10 -0
  3. package/lib/Primitive.d.ts +1 -1
  4. package/lib/Resolved.d.ts +1 -1
  5. package/lib/SnakeCase.d.ts +10 -0
  6. package/package.json +1 -1
  7. package/src/CamelCase.ts +116 -116
  8. package/src/PascalCase.ts +116 -106
  9. package/src/Primitive.ts +135 -135
  10. package/src/Resolved.ts +116 -116
  11. package/src/SnakeCase.ts +156 -156
  12. package/src/functional/$convention.ts +40 -40
  13. package/src/functional/Namespace.ts +164 -164
  14. package/src/module.ts +662 -662
  15. package/src/notations.ts +855 -855
  16. package/src/programmers/helpers/NotationJoiner.ts +146 -146
  17. package/src/programmers/misc/MiscCloneProgrammer.ts +790 -790
  18. package/src/programmers/misc/MiscPruneProgrammer.ts +552 -552
  19. package/src/programmers/notations/NotationAssertGeneralProgrammer.ts +72 -72
  20. package/src/programmers/notations/NotationGeneralProgrammer.ts +720 -720
  21. package/src/programmers/notations/NotationIsGeneralProgrammer.ts +79 -79
  22. package/src/programmers/notations/NotationValidateGeneralProgrammer.ts +88 -88
  23. package/src/transformers/CallExpressionTransformer.ts +380 -380
  24. package/src/transformers/features/json/JsonAssertParseTransformer.ts +10 -10
  25. package/src/transformers/features/json/JsonAssertStringifyTransformer.ts +10 -10
  26. package/src/transformers/features/json/JsonCreateAssertParseTransformer.ts +12 -12
  27. package/src/transformers/features/json/JsonCreateAssertStringifyTransformer.ts +12 -12
  28. package/src/transformers/features/json/JsonCreateIsParseTransformer.ts +9 -9
  29. package/src/transformers/features/json/JsonCreateIsStringifyTransformer.ts +12 -12
  30. package/src/transformers/features/json/JsonCreateStringifyTransformer.ts +9 -9
  31. package/src/transformers/features/json/JsonCreateValidateParseTransformer.ts +12 -12
  32. package/src/transformers/features/json/JsonCreateValidateStringifyProgrammer.ts +12 -12
  33. package/src/transformers/features/json/JsonIsParseTransformer.ts +9 -9
  34. package/src/transformers/features/json/JsonIsStringifyTransformer.ts +10 -10
  35. package/src/transformers/features/json/JsonStringifyTransformer.ts +9 -9
  36. package/src/transformers/features/json/JsonValidateParseTransformer.ts +10 -10
  37. package/src/transformers/features/json/JsonValidateStringifyTransformer.ts +10 -10
  38. package/src/transformers/features/misc/MiscAssertCloneTransformer.ts +10 -10
  39. package/src/transformers/features/misc/MiscAssertPruneTransformer.ts +10 -10
  40. package/src/transformers/features/misc/MiscCloneTransformer.ts +9 -9
  41. package/src/transformers/features/misc/MiscCreateAssertCloneTransformer.ts +12 -12
  42. package/src/transformers/features/misc/MiscCreateAssertPruneTransformer.ts +12 -12
  43. package/src/transformers/features/misc/MiscCreateCloneTransformer.ts +9 -9
  44. package/src/transformers/features/misc/MiscCreateIsCloneTransformer.ts +9 -9
  45. package/src/transformers/features/misc/MiscCreateIsPruneTransformer.ts +9 -9
  46. package/src/transformers/features/misc/MiscCreatePruneTransformer.ts +9 -9
  47. package/src/transformers/features/misc/MiscCreateValidateCloneTransformer.ts +12 -12
  48. package/src/transformers/features/misc/MiscCreateValidatePruneTransformer.ts +12 -12
  49. package/src/transformers/features/misc/MiscIsCloneTransformer.ts +9 -9
  50. package/src/transformers/features/misc/MiscIsPruneTransformer.ts +9 -9
  51. package/src/transformers/features/misc/MiscPruneTransformer.ts +9 -9
  52. package/src/transformers/features/misc/MiscValidateCloneTransformer.ts +10 -10
  53. package/src/transformers/features/misc/MiscValidatePruneTransformer.ts +10 -10
  54. package/src/transformers/features/notations/NotationAssertGeneralTransformer.ts +15 -15
  55. package/src/transformers/features/notations/NotationCreateAssertGeneralTransformer.ts +15 -15
  56. package/src/transformers/features/notations/NotationCreateGeneralTransformer.ts +15 -15
  57. package/src/transformers/features/notations/NotationCreateIsGeneralTransformer.ts +15 -15
  58. package/src/transformers/features/notations/NotationCreateValidateGeneralTransformer.ts +17 -17
  59. package/src/transformers/features/notations/NotationGeneralTransformer.ts +11 -11
  60. package/src/transformers/features/notations/NotationIsGeneralTransformer.ts +15 -15
  61. package/src/transformers/features/notations/NotationValidateGeneralTransformer.ts +17 -17
  62. package/src/transformers/features/protobuf/ProtobufCreateAssertDecodeTransformer.ts +12 -12
  63. package/src/transformers/features/protobuf/ProtobufCreateAssertEncodeTransformer.ts +12 -12
  64. package/src/transformers/features/protobuf/ProtobufCreateDecodeTransformer.ts +9 -9
  65. package/src/transformers/features/protobuf/ProtobufCreateEncodeTransformer.ts +9 -9
  66. package/src/transformers/features/protobuf/ProtobufCreateIsDecodeTransformer.ts +12 -12
  67. package/src/transformers/features/protobuf/ProtobufCreateIsEncodeTransformer.ts +12 -12
  68. package/src/transformers/features/protobuf/ProtobufCreateValidateDecodeTransformer.ts +12 -12
  69. package/src/transformers/features/protobuf/ProtobufCreateValidateEncodeTransformer.ts +12 -12
  70. package/src/utils/NamingConvention.ts +91 -91
  71. package/src/utils/StringUtil.ts +4 -4
@@ -1,164 +1,164 @@
1
- import { NamingConvention } from "../utils/NamingConvention";
2
- import { RandomGenerator } from "../utils/RandomGenerator";
3
-
4
- import { IValidation } from "../IValidation";
5
- import { TypeGuardError } from "../TypeGuardError";
6
- import { $HeadersReader } from "./$HeadersReader";
7
- import { $ParameterReader } from "./$ParameterReader";
8
- import { $ProtobufReader } from "./$ProtobufReader";
9
- import { $ProtobufSizer } from "./$ProtobufSizer";
10
- import { $ProtobufWriter } from "./$ProtobufWriter";
11
- import { $QueryReader } from "./$QueryReader";
12
- import { $any } from "./$any";
13
- import { $convention } from "./$convention";
14
- import { $every } from "./$every";
15
- import { $guard } from "./$guard";
16
- import { $is_between } from "./$is_between";
17
- import { $join } from "./$join";
18
- import { $number } from "./$number";
19
- import { $report } from "./$report";
20
- import { $rest } from "./$rest";
21
- import { $string } from "./$string";
22
- import { $strlen } from "./$strlen";
23
- import { $tail } from "./$tail";
24
-
25
- /**
26
- * @internal
27
- */
28
- export namespace Namespace {
29
- export const is = () => ({
30
- is_between: $is_between,
31
- });
32
-
33
- export const assert = (method: string) => ({
34
- ...is(),
35
- join: $join,
36
- every: $every,
37
- guard: $guard(`typia.${method}`),
38
- predicate: (
39
- matched: boolean,
40
- exceptionable: boolean,
41
- closure: () => Omit<TypeGuardError.IProps, "method">,
42
- ): boolean => {
43
- if (matched === false && exceptionable === true)
44
- throw new TypeGuardError({
45
- ...closure(),
46
- method: `typia.${method}`,
47
- });
48
- return matched;
49
- },
50
- });
51
-
52
- export const validate = () => ({
53
- ...is(),
54
- join: $join,
55
- report: $report,
56
- predicate:
57
- (res: IValidation) =>
58
- (
59
- matched: boolean,
60
- exceptionable: boolean,
61
- closure: () => IValidation.IError,
62
- ) => {
63
- // CHECK FAILURE
64
- if (matched === false && exceptionable === true)
65
- (() => {
66
- res.success &&= false;
67
- const errorList = (res as IValidation.IFailure).errors;
68
-
69
- // TRACE ERROR
70
- const error = closure();
71
- if (errorList.length) {
72
- const last = errorList[errorList.length - 1]!.path;
73
- if (
74
- last.length >= error.path.length &&
75
- last.substring(0, error.path.length) ===
76
- error.path
77
- )
78
- return;
79
- }
80
- errorList.push(error);
81
- return;
82
- })();
83
- return matched;
84
- },
85
- });
86
-
87
- export namespace json {
88
- export const stringify = (method: string) => ({
89
- ...is(),
90
- number: $number,
91
- string: $string,
92
- tail: $tail,
93
- rest: $rest,
94
- throws: $throws(`json.${method}`),
95
- });
96
- }
97
-
98
- export namespace protobuf {
99
- export const decode = (method: string) => ({
100
- Reader: $ProtobufReader,
101
- throws: $throws(`protobuf.${method}`),
102
- });
103
-
104
- export const encode = (method: string) => ({
105
- Sizer: $ProtobufSizer,
106
- Writer: $ProtobufWriter,
107
- strlen: $strlen,
108
- throws: $throws(method),
109
- });
110
- }
111
-
112
- export namespace http {
113
- export const query = () => $QueryReader;
114
- export const headers = () => $HeadersReader;
115
- export const parameter = () => $ParameterReader;
116
- }
117
-
118
- export namespace misc {
119
- export const clone = (method: string) => ({
120
- ...is(),
121
- throws: $throws(`misc.${method}`),
122
- any: $any,
123
- });
124
-
125
- export const prune = (method: string) => ({
126
- ...is(),
127
- throws: $throws(`misc.${method}`),
128
- });
129
- }
130
-
131
- export namespace notations {
132
- export const camel = (method: string) => ({
133
- ...base(method),
134
- any: $convention(NamingConvention.camel),
135
- });
136
- export const pascal = (method: string) => ({
137
- ...base(method),
138
- any: $convention(NamingConvention.pascal),
139
- });
140
- export const snake = (method: string) => ({
141
- ...base(method),
142
- any: $convention(NamingConvention.snake),
143
- });
144
-
145
- const base = (method: string) => ({
146
- ...is(),
147
- throws: $throws(`notations.${method}`),
148
- });
149
- }
150
-
151
- export const random = () => ({
152
- generator: RandomGenerator,
153
- pick: RandomGenerator.pick,
154
- });
155
-
156
- const $throws =
157
- (method: string) =>
158
- (props: Pick<TypeGuardError.IProps, "expected" | "value">) => {
159
- throw new TypeGuardError({
160
- ...props,
161
- method: `typia.${method}`,
162
- });
163
- };
164
- }
1
+ import { NamingConvention } from "../utils/NamingConvention";
2
+ import { RandomGenerator } from "../utils/RandomGenerator";
3
+
4
+ import { IValidation } from "../IValidation";
5
+ import { TypeGuardError } from "../TypeGuardError";
6
+ import { $HeadersReader } from "./$HeadersReader";
7
+ import { $ParameterReader } from "./$ParameterReader";
8
+ import { $ProtobufReader } from "./$ProtobufReader";
9
+ import { $ProtobufSizer } from "./$ProtobufSizer";
10
+ import { $ProtobufWriter } from "./$ProtobufWriter";
11
+ import { $QueryReader } from "./$QueryReader";
12
+ import { $any } from "./$any";
13
+ import { $convention } from "./$convention";
14
+ import { $every } from "./$every";
15
+ import { $guard } from "./$guard";
16
+ import { $is_between } from "./$is_between";
17
+ import { $join } from "./$join";
18
+ import { $number } from "./$number";
19
+ import { $report } from "./$report";
20
+ import { $rest } from "./$rest";
21
+ import { $string } from "./$string";
22
+ import { $strlen } from "./$strlen";
23
+ import { $tail } from "./$tail";
24
+
25
+ /**
26
+ * @internal
27
+ */
28
+ export namespace Namespace {
29
+ export const is = () => ({
30
+ is_between: $is_between,
31
+ });
32
+
33
+ export const assert = (method: string) => ({
34
+ ...is(),
35
+ join: $join,
36
+ every: $every,
37
+ guard: $guard(`typia.${method}`),
38
+ predicate: (
39
+ matched: boolean,
40
+ exceptionable: boolean,
41
+ closure: () => Omit<TypeGuardError.IProps, "method">,
42
+ ): boolean => {
43
+ if (matched === false && exceptionable === true)
44
+ throw new TypeGuardError({
45
+ ...closure(),
46
+ method: `typia.${method}`,
47
+ });
48
+ return matched;
49
+ },
50
+ });
51
+
52
+ export const validate = () => ({
53
+ ...is(),
54
+ join: $join,
55
+ report: $report,
56
+ predicate:
57
+ (res: IValidation) =>
58
+ (
59
+ matched: boolean,
60
+ exceptionable: boolean,
61
+ closure: () => IValidation.IError,
62
+ ) => {
63
+ // CHECK FAILURE
64
+ if (matched === false && exceptionable === true)
65
+ (() => {
66
+ res.success &&= false;
67
+ const errorList = (res as IValidation.IFailure).errors;
68
+
69
+ // TRACE ERROR
70
+ const error = closure();
71
+ if (errorList.length) {
72
+ const last = errorList[errorList.length - 1]!.path;
73
+ if (
74
+ last.length >= error.path.length &&
75
+ last.substring(0, error.path.length) ===
76
+ error.path
77
+ )
78
+ return;
79
+ }
80
+ errorList.push(error);
81
+ return;
82
+ })();
83
+ return matched;
84
+ },
85
+ });
86
+
87
+ export namespace json {
88
+ export const stringify = (method: string) => ({
89
+ ...is(),
90
+ number: $number,
91
+ string: $string,
92
+ tail: $tail,
93
+ rest: $rest,
94
+ throws: $throws(`json.${method}`),
95
+ });
96
+ }
97
+
98
+ export namespace protobuf {
99
+ export const decode = (method: string) => ({
100
+ Reader: $ProtobufReader,
101
+ throws: $throws(`protobuf.${method}`),
102
+ });
103
+
104
+ export const encode = (method: string) => ({
105
+ Sizer: $ProtobufSizer,
106
+ Writer: $ProtobufWriter,
107
+ strlen: $strlen,
108
+ throws: $throws(method),
109
+ });
110
+ }
111
+
112
+ export namespace http {
113
+ export const query = () => $QueryReader;
114
+ export const headers = () => $HeadersReader;
115
+ export const parameter = () => $ParameterReader;
116
+ }
117
+
118
+ export namespace misc {
119
+ export const clone = (method: string) => ({
120
+ ...is(),
121
+ throws: $throws(`misc.${method}`),
122
+ any: $any,
123
+ });
124
+
125
+ export const prune = (method: string) => ({
126
+ ...is(),
127
+ throws: $throws(`misc.${method}`),
128
+ });
129
+ }
130
+
131
+ export namespace notations {
132
+ export const camel = (method: string) => ({
133
+ ...base(method),
134
+ any: $convention(NamingConvention.camel),
135
+ });
136
+ export const pascal = (method: string) => ({
137
+ ...base(method),
138
+ any: $convention(NamingConvention.pascal),
139
+ });
140
+ export const snake = (method: string) => ({
141
+ ...base(method),
142
+ any: $convention(NamingConvention.snake),
143
+ });
144
+
145
+ const base = (method: string) => ({
146
+ ...is(),
147
+ throws: $throws(`notations.${method}`),
148
+ });
149
+ }
150
+
151
+ export const random = () => ({
152
+ generator: RandomGenerator,
153
+ pick: RandomGenerator.pick,
154
+ });
155
+
156
+ const $throws =
157
+ (method: string) =>
158
+ (props: Pick<TypeGuardError.IProps, "expected" | "value">) => {
159
+ throw new TypeGuardError({
160
+ ...props,
161
+ method: `typia.${method}`,
162
+ });
163
+ };
164
+ }