typia 5.1.4 → 5.1.5-dev.20230929

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 (88) hide show
  1. package/lib/TypeGuardError.d.ts +2 -2
  2. package/lib/executable/TypiaGenerateWizard.js.map +1 -1
  3. package/lib/executable/TypiaSetupWizard.js +16 -7
  4. package/lib/executable/TypiaSetupWizard.js.map +1 -1
  5. package/lib/factories/internal/metadata/emplace_metadata_object.js +25 -6
  6. package/lib/factories/internal/metadata/emplace_metadata_object.js.map +1 -1
  7. package/lib/programmers/CheckerProgrammer.d.ts +3 -3
  8. package/lib/programmers/CheckerProgrammer.js.map +1 -1
  9. package/lib/programmers/FeatureProgrammer.d.ts +11 -11
  10. package/lib/programmers/FeatureProgrammer.js.map +1 -1
  11. package/lib/schemas/json/IJsonComponents.d.ts +12 -12
  12. package/lib/schemas/json/IJsonSchema.d.ts +32 -32
  13. package/lib/schemas/metadata/IMetadataObject.d.ts +1 -1
  14. package/lib/transformers/ITransformOptions.d.ts +4 -4
  15. package/package.json +1 -1
  16. package/src/TypeGuardError.ts +2 -2
  17. package/src/executable/TypiaGenerateWizard.ts +2 -2
  18. package/src/executable/TypiaSetupWizard.ts +7 -3
  19. package/src/factories/MetadataCollection.ts +277 -277
  20. package/src/factories/MetadataFactory.ts +238 -238
  21. package/src/factories/MetadataTypeTagFactory.ts +325 -325
  22. package/src/factories/internal/metadata/emend_metadata_atomics.ts +41 -41
  23. package/src/factories/internal/metadata/emplace_metadata_object.ts +30 -8
  24. package/src/factories/internal/metadata/iterate_metadata_intersection.ts +259 -259
  25. package/src/functional/$HeadersReader.ts +28 -28
  26. package/src/functional/$ParameterReader.ts +31 -31
  27. package/src/functional/$QueryReader.ts +56 -56
  28. package/src/functional/Namespace.ts +142 -142
  29. package/src/http.ts +1149 -1149
  30. package/src/json.ts +648 -648
  31. package/src/misc.ts +651 -651
  32. package/src/module.ts +657 -657
  33. package/src/programmers/CheckerProgrammer.ts +11 -9
  34. package/src/programmers/FeatureProgrammer.ts +25 -17
  35. package/src/programmers/helpers/HttpMetadataUtil.ts +21 -21
  36. package/src/programmers/helpers/RandomRanger.ts +1 -1
  37. package/src/programmers/http/HttpAssertHeadersProgrammer.ts +77 -77
  38. package/src/programmers/http/HttpAssertQueryProgrammer.ts +77 -77
  39. package/src/programmers/http/HttpHeadersProgrammer.ts +339 -339
  40. package/src/programmers/http/HttpIsHeadersProgrammer.ts +87 -87
  41. package/src/programmers/http/HttpIsQueryProgrammer.ts +87 -87
  42. package/src/programmers/http/HttpParameterProgrammer.ts +104 -104
  43. package/src/programmers/http/HttpQueryProgrammer.ts +273 -273
  44. package/src/programmers/http/HttpValidateHeadersProgrammer.ts +77 -77
  45. package/src/programmers/http/HttpValidateQueryProgrammer.ts +77 -77
  46. package/src/programmers/internal/application_boolean.ts +30 -30
  47. package/src/programmers/internal/application_number.ts +90 -90
  48. package/src/programmers/internal/application_object.ts +1 -1
  49. package/src/programmers/internal/application_schema.ts +180 -180
  50. package/src/programmers/internal/application_string.ts +54 -54
  51. package/src/programmers/internal/check_array_length.ts +44 -44
  52. package/src/programmers/internal/check_bigint.ts +48 -48
  53. package/src/programmers/internal/check_number.ts +108 -108
  54. package/src/programmers/internal/check_object.ts +2 -2
  55. package/src/programmers/internal/check_string.ts +48 -48
  56. package/src/programmers/protobuf/ProtobufEncodeProgrammer.ts +882 -882
  57. package/src/protobuf.ts +887 -887
  58. package/src/schemas/json/IJsonComponents.ts +36 -34
  59. package/src/schemas/json/IJsonSchema.ts +112 -112
  60. package/src/schemas/metadata/IMetadataConstant.ts +25 -25
  61. package/src/schemas/metadata/IMetadataObject.ts +1 -1
  62. package/src/schemas/metadata/IMetadataTypeTag.ts +8 -8
  63. package/src/schemas/metadata/Metadata.ts +686 -686
  64. package/src/tags/Default.ts +15 -15
  65. package/src/tags/Format.ts +30 -30
  66. package/src/tags/Pattern.ts +9 -9
  67. package/src/tags/TagBase.ts +68 -68
  68. package/src/tags/index.ts +14 -14
  69. package/src/transformers/CallExpressionTransformer.ts +289 -289
  70. package/src/transformers/ITransformOptions.ts +4 -4
  71. package/src/transformers/features/http/CreateHttpAssertHeadersTransformer.ts +12 -12
  72. package/src/transformers/features/http/CreateHttpAssertQueryTransformer.ts +12 -12
  73. package/src/transformers/features/http/CreateHttpHeadersTransformer.ts +9 -9
  74. package/src/transformers/features/http/CreateHttpIsHeadersTransformer.ts +9 -9
  75. package/src/transformers/features/http/CreateHttpIsQueryTransformer.ts +9 -9
  76. package/src/transformers/features/http/CreateHttpParameterTransformer.ts +9 -9
  77. package/src/transformers/features/http/CreateHttpQueryTransformer.ts +9 -9
  78. package/src/transformers/features/http/CreateHttpValidateHeadersTransformer.ts +12 -12
  79. package/src/transformers/features/http/CreateHttpValidateQueryTransformer.ts +12 -12
  80. package/src/transformers/features/http/HttpAssertHeadersTransformer.ts +10 -10
  81. package/src/transformers/features/http/HttpAssertQueryTransformer.ts +10 -10
  82. package/src/transformers/features/http/HttpHeadersTransformer.ts +9 -9
  83. package/src/transformers/features/http/HttpIsHeadersTransformer.ts +9 -9
  84. package/src/transformers/features/http/HttpIsQueryTransformer.ts +9 -9
  85. package/src/transformers/features/http/HttpParameterTransformer.ts +9 -9
  86. package/src/transformers/features/http/HttpQueryTransformer.ts +9 -9
  87. package/src/transformers/features/http/HttpValidateHeadersTransformer.ts +10 -10
  88. package/src/transformers/features/http/HttpValidateQueryTransformer.ts +10 -10
@@ -1,15 +1,15 @@
1
- import { TagBase } from "./TagBase";
2
-
3
- export type Default<Value extends boolean | bigint | number | string> =
4
- TagBase<{
5
- target: Value extends boolean
6
- ? "boolean"
7
- : Value extends bigint
8
- ? "bigint"
9
- : Value extends number
10
- ? "number"
11
- : "string";
12
- kind: "default";
13
- value: Value;
14
- exclusive: true;
15
- }>;
1
+ import { TagBase } from "./TagBase";
2
+
3
+ export type Default<Value extends boolean | bigint | number | string> =
4
+ TagBase<{
5
+ target: Value extends boolean
6
+ ? "boolean"
7
+ : Value extends bigint
8
+ ? "bigint"
9
+ : Value extends number
10
+ ? "number"
11
+ : "string";
12
+ kind: "default";
13
+ value: Value;
14
+ exclusive: true;
15
+ }>;
@@ -1,30 +1,30 @@
1
- import { TagBase } from "./TagBase";
2
-
3
- export type Format<
4
- Value extends
5
- | "email"
6
- | "uuid"
7
- | "ipv4"
8
- | "ipv6"
9
- | "url"
10
- | "date"
11
- | "date-time",
12
- > = TagBase<{
13
- target: "string";
14
- kind: "format";
15
- value: Value;
16
- validate: Value extends "email"
17
- ? `/^(([^<>()[\\]\\.,;:\\s@\\"]+(\\.[^<>()[\\]\\.,;:\\s@\\"]+)*)|(\\".+\\"))@(([^<>()[\\]\\.,;:\\s@\\"]+\\.)+[^<>()[\\]\\.,;:\\s@\\"]{2,})$/i.test($input)`
18
- : Value extends "uuid"
19
- ? `/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test($input)`
20
- : Value extends "ipv4"
21
- ? `/^(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test($input)`
22
- : Value extends "ipv6"
23
- ? `/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/.test($input)`
24
- : Value extends "url"
25
- ? `/^[a-zA-Z0-9]+:\\/\\/(?:www.)?[-a-zA-Z0-9@:%._+~#=]{1,256}.[a-zA-Z0-9()]{1,6}\\b(?:[-a-zA-Z0-9()@:%_+.~#?&/=]*)$/.test($input)`
26
- : Value extends "date"
27
- ? `/^(\\d{4})-(\\d{2})-(\\d{2})$/.test($input)`
28
- : `!isNaN(new Date($input).getTime())`;
29
- exclusive: ["format", "pattern"];
30
- }>;
1
+ import { TagBase } from "./TagBase";
2
+
3
+ export type Format<
4
+ Value extends
5
+ | "email"
6
+ | "uuid"
7
+ | "ipv4"
8
+ | "ipv6"
9
+ | "url"
10
+ | "date"
11
+ | "date-time",
12
+ > = TagBase<{
13
+ target: "string";
14
+ kind: "format";
15
+ value: Value;
16
+ validate: Value extends "email"
17
+ ? `/^(([^<>()[\\]\\.,;:\\s@\\"]+(\\.[^<>()[\\]\\.,;:\\s@\\"]+)*)|(\\".+\\"))@(([^<>()[\\]\\.,;:\\s@\\"]+\\.)+[^<>()[\\]\\.,;:\\s@\\"]{2,})$/i.test($input)`
18
+ : Value extends "uuid"
19
+ ? `/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test($input)`
20
+ : Value extends "ipv4"
21
+ ? `/^(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test($input)`
22
+ : Value extends "ipv6"
23
+ ? `/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/.test($input)`
24
+ : Value extends "url"
25
+ ? `/^[a-zA-Z0-9]+:\\/\\/(?:www.)?[-a-zA-Z0-9@:%._+~#=]{1,256}.[a-zA-Z0-9()]{1,6}\\b(?:[-a-zA-Z0-9()@:%_+.~#?&/=]*)$/.test($input)`
26
+ : Value extends "date"
27
+ ? `/^(\\d{4})-(\\d{2})-(\\d{2})$/.test($input)`
28
+ : `!isNaN(new Date($input).getTime())`;
29
+ exclusive: ["format", "pattern"];
30
+ }>;
@@ -1,9 +1,9 @@
1
- import { TagBase } from "./TagBase";
2
-
3
- export type Pattern<Value extends string> = TagBase<{
4
- target: "string";
5
- kind: "pattern";
6
- value: Value;
7
- validate: `/${Value}/.test($input)`;
8
- exclusive: ["format", "pattern"];
9
- }>;
1
+ import { TagBase } from "./TagBase";
2
+
3
+ export type Pattern<Value extends string> = TagBase<{
4
+ target: "string";
5
+ kind: "pattern";
6
+ value: Value;
7
+ validate: `/${Value}/.test($input)`;
8
+ exclusive: ["format", "pattern"];
9
+ }>;
@@ -1,68 +1,68 @@
1
- export type TagBase<Props extends TagBase.IProps<any, any, any, any, any>> = {
2
- /**
3
- * This is a dummy property for compilation.
4
- *
5
- * It does not mean anything in runtime.
6
- */
7
- "typia.tag"?: Props;
8
- };
9
- export namespace TagBase {
10
- export interface IProps<
11
- Target extends "boolean" | "bigint" | "number" | "string" | "array",
12
- Kind extends string,
13
- Value extends boolean | bigint | number | string | undefined,
14
- Validate extends
15
- | string
16
- | {
17
- [key in Target]?: string;
18
- },
19
- Exclusive extends boolean | string[],
20
- > {
21
- /**
22
- * Target type.
23
- *
24
- * If user tries to adapt this tag to a different type, it would be a compile
25
- * error.
26
- *
27
- * For example, you've configured target type as `string`, but user adapted it
28
- * onto a `number` type (`number & YourCustomTag<Value>`), then it would be
29
- * blocked by TypeScript compiler.
30
- */
31
- target: Target;
32
-
33
- /**
34
- * What kind of tag is this?
35
- */
36
- kind: Kind;
37
-
38
- /**
39
- * Value to be configured by user.
40
- */
41
- value: Value;
42
-
43
- /**
44
- * Validation script.
45
- *
46
- * This script would be inserted into the generated validation function.
47
- * In here script, target variable name must be `$input`. The variable name
48
- * `$input` would be transformed to the suitable when compilation.
49
- *
50
- * Also, If you've take a mistake on this script, compile error would be
51
- * occured. So, define it with confidence. Compiler will block all your
52
- * mistakes.
53
- */
54
- validate?: Validate;
55
-
56
- /**
57
- * Exclusive option.
58
- *
59
- * If this property configured as `true`, same {@link kind} tag cannot be
60
- * duplicated in the target type. Otherwise, if you've configured this
61
- * property as string array, all of the {@link kind} value assigned
62
- * tags cannot be compatible in the target type.
63
- *
64
- * @default false
65
- */
66
- exclusive?: Exclusive | string[];
67
- }
68
- }
1
+ export type TagBase<Props extends TagBase.IProps<any, any, any, any, any>> = {
2
+ /**
3
+ * This is a dummy property for compilation.
4
+ *
5
+ * It does not mean anything in runtime.
6
+ */
7
+ "typia.tag"?: Props;
8
+ };
9
+ export namespace TagBase {
10
+ export interface IProps<
11
+ Target extends "boolean" | "bigint" | "number" | "string" | "array",
12
+ Kind extends string,
13
+ Value extends boolean | bigint | number | string | undefined,
14
+ Validate extends
15
+ | string
16
+ | {
17
+ [key in Target]?: string;
18
+ },
19
+ Exclusive extends boolean | string[],
20
+ > {
21
+ /**
22
+ * Target type.
23
+ *
24
+ * If user tries to adapt this tag to a different type, it would be a compile
25
+ * error.
26
+ *
27
+ * For example, you've configured target type as `string`, but user adapted it
28
+ * onto a `number` type (`number & YourCustomTag<Value>`), then it would be
29
+ * blocked by TypeScript compiler.
30
+ */
31
+ target: Target;
32
+
33
+ /**
34
+ * What kind of tag is this?
35
+ */
36
+ kind: Kind;
37
+
38
+ /**
39
+ * Value to be configured by user.
40
+ */
41
+ value: Value;
42
+
43
+ /**
44
+ * Validation script.
45
+ *
46
+ * This script would be inserted into the generated validation function.
47
+ * In here script, target variable name must be `$input`. The variable name
48
+ * `$input` would be transformed to the suitable when compilation.
49
+ *
50
+ * Also, If you've take a mistake on this script, compile error would be
51
+ * occured. So, define it with confidence. Compiler will block all your
52
+ * mistakes.
53
+ */
54
+ validate?: Validate;
55
+
56
+ /**
57
+ * Exclusive option.
58
+ *
59
+ * If this property configured as `true`, same {@link kind} tag cannot be
60
+ * duplicated in the target type. Otherwise, if you've configured this
61
+ * property as string array, all of the {@link kind} value assigned
62
+ * tags cannot be compatible in the target type.
63
+ *
64
+ * @default false
65
+ */
66
+ exclusive?: Exclusive | string[];
67
+ }
68
+ }
package/src/tags/index.ts CHANGED
@@ -1,14 +1,14 @@
1
- export * from "./Default";
2
- export * from "./ExclusiveMaximum";
3
- export * from "./ExclusiveMinimum";
4
- export * from "./Format";
5
- export * from "./Maximum";
6
- export * from "./MaxItems";
7
- export * from "./MaxLength";
8
- export * from "./Minimum";
9
- export * from "./MinItems";
10
- export * from "./MinLength";
11
- export * from "./MultipleOf";
12
- export * from "./Pattern";
13
- export * from "./TagBase";
14
- export * from "./Type";
1
+ export * from "./Default";
2
+ export * from "./ExclusiveMaximum";
3
+ export * from "./ExclusiveMinimum";
4
+ export * from "./Format";
5
+ export * from "./Maximum";
6
+ export * from "./MaxItems";
7
+ export * from "./MaxLength";
8
+ export * from "./Minimum";
9
+ export * from "./MinItems";
10
+ export * from "./MinLength";
11
+ export * from "./MultipleOf";
12
+ export * from "./Pattern";
13
+ export * from "./TagBase";
14
+ export * from "./Type";