typia 9.7.2 → 10.0.0-dev.20251107

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 (116) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +153 -153
  3. package/lib/factories/ProtobufFactory.js +1 -1
  4. package/lib/factories/ProtobufFactory.mjs +1 -1
  5. package/lib/programmers/internal/json_schema_station.d.mts +2 -2
  6. package/lib/programmers/internal/json_schema_station.d.ts +2 -2
  7. package/lib/programmers/llm/LlmApplicationProgrammer.js +5 -1
  8. package/lib/programmers/llm/LlmApplicationProgrammer.js.map +1 -1
  9. package/lib/programmers/llm/LlmApplicationProgrammer.mjs +5 -1
  10. package/lib/programmers/llm/LlmSchemaProgrammer.js +1 -4
  11. package/lib/programmers/llm/LlmSchemaProgrammer.js.map +1 -1
  12. package/lib/programmers/llm/LlmSchemaProgrammer.mjs +1 -35
  13. package/package.json +121 -121
  14. package/src/AssertionGuard.ts +41 -41
  15. package/src/CamelCase.ts +75 -75
  16. package/src/IRandomGenerator.ts +337 -337
  17. package/src/IReadableURLSearchParams.ts +9 -9
  18. package/src/PascalCase.ts +71 -71
  19. package/src/Primitive.ts +90 -90
  20. package/src/Resolved.ts +72 -72
  21. package/src/SnakeCase.ts +127 -127
  22. package/src/TypeGuardError.ts +216 -216
  23. package/src/factories/MetadataCollection.ts +270 -270
  24. package/src/factories/MetadataCommentTagFactory.ts +632 -632
  25. package/src/factories/MetadataFactory.ts +402 -402
  26. package/src/factories/ProtobufFactory.ts +873 -873
  27. package/src/functional.ts +705 -705
  28. package/src/http.ts +972 -972
  29. package/src/internal/_ProtobufReader.ts +188 -188
  30. package/src/internal/_ProtobufSizer.ts +137 -137
  31. package/src/internal/_ProtobufWriter.ts +135 -135
  32. package/src/internal/_jsonStringifyString.ts +42 -42
  33. package/src/json.ts +643 -643
  34. package/src/llm.ts +615 -615
  35. package/src/misc.ts +594 -594
  36. package/src/module.ts +889 -889
  37. package/src/notations.ts +751 -751
  38. package/src/programmers/FeatureProgrammer.ts +605 -605
  39. package/src/programmers/ImportProgrammer.ts +179 -179
  40. package/src/programmers/RandomProgrammer.ts +1195 -1195
  41. package/src/programmers/helpers/ProtobufWire.ts +34 -34
  42. package/src/programmers/internal/check_array_length.ts +43 -43
  43. package/src/programmers/internal/check_bigint.ts +46 -46
  44. package/src/programmers/internal/check_dynamic_key.ts +197 -197
  45. package/src/programmers/internal/check_dynamic_properties.ts +231 -231
  46. package/src/programmers/internal/check_everything.ts +21 -21
  47. package/src/programmers/internal/check_native.ts +23 -23
  48. package/src/programmers/internal/check_number.ts +108 -108
  49. package/src/programmers/internal/check_object.ts +72 -72
  50. package/src/programmers/internal/check_string.ts +46 -46
  51. package/src/programmers/internal/check_template.ts +46 -46
  52. package/src/programmers/internal/check_union_array_like.ts +331 -331
  53. package/src/programmers/internal/decode_union_object.ts +110 -110
  54. package/src/programmers/internal/feature_object_entries.ts +59 -59
  55. package/src/programmers/internal/json_schema_escaped.ts +78 -78
  56. package/src/programmers/internal/json_schema_object.ts +150 -150
  57. package/src/programmers/internal/json_schema_station.ts +2 -2
  58. package/src/programmers/internal/metadata_to_pattern.ts +40 -40
  59. package/src/programmers/internal/postfix_of_tuple.ts +3 -3
  60. package/src/programmers/internal/prune_object_properties.ts +69 -69
  61. package/src/programmers/internal/stringify_dynamic_properties.ts +158 -158
  62. package/src/programmers/internal/stringify_native.ts +5 -5
  63. package/src/programmers/internal/stringify_regular_properties.ts +77 -77
  64. package/src/programmers/internal/template_to_pattern.ts +21 -21
  65. package/src/programmers/internal/wrap_metadata_rest_tuple.ts +21 -21
  66. package/src/programmers/json/JsonStringifyProgrammer.ts +1124 -1124
  67. package/src/programmers/llm/LlmApplicationProgrammer.ts +10 -1
  68. package/src/programmers/llm/LlmSchemaProgrammer.ts +2 -7
  69. package/src/protobuf.ts +820 -820
  70. package/src/reflect.ts +46 -46
  71. package/src/schemas/json/IJsonApplication.ts +77 -77
  72. package/src/schemas/json/IJsonSchemaCollection.ts +212 -212
  73. package/src/schemas/json/IJsonSchemaUnit.ts +263 -263
  74. package/src/schemas/metadata/IMetadataTypeTag.ts +14 -14
  75. package/src/schemas/metadata/Metadata.ts +669 -669
  76. package/src/schemas/metadata/MetadataAliasType.ts +57 -57
  77. package/src/schemas/metadata/MetadataApplication.ts +40 -40
  78. package/src/schemas/metadata/MetadataArray.ts +47 -47
  79. package/src/schemas/metadata/MetadataArrayType.ts +51 -51
  80. package/src/schemas/metadata/MetadataAtomic.ts +85 -85
  81. package/src/schemas/metadata/MetadataEscaped.ts +45 -45
  82. package/src/schemas/metadata/MetadataFunction.ts +45 -45
  83. package/src/schemas/metadata/MetadataObject.ts +46 -46
  84. package/src/schemas/metadata/MetadataObjectType.ts +137 -137
  85. package/src/schemas/metadata/MetadataParameter.ts +52 -52
  86. package/src/schemas/metadata/MetadataProperty.ts +53 -53
  87. package/src/schemas/metadata/MetadataTemplate.ts +78 -78
  88. package/src/schemas/metadata/MetadataTuple.ts +28 -28
  89. package/src/schemas/metadata/MetadataTupleType.ts +61 -61
  90. package/src/tags/Constant.ts +47 -47
  91. package/src/tags/ContentMediaType.ts +27 -27
  92. package/src/tags/Default.ts +52 -52
  93. package/src/tags/Example.ts +56 -56
  94. package/src/tags/Examples.ts +56 -56
  95. package/src/tags/ExclusiveMaximum.ts +44 -44
  96. package/src/tags/ExclusiveMinimum.ts +44 -44
  97. package/src/tags/Format.ts +78 -78
  98. package/src/tags/JsonSchemaPlugin.ts +36 -36
  99. package/src/tags/MaxItems.ts +31 -31
  100. package/src/tags/MaxLength.ts +25 -25
  101. package/src/tags/Maximum.ts +39 -39
  102. package/src/tags/MinItems.ts +31 -31
  103. package/src/tags/MinLength.ts +25 -25
  104. package/src/tags/Minimum.ts +39 -39
  105. package/src/tags/MultipleOf.ts +42 -42
  106. package/src/tags/Pattern.ts +49 -49
  107. package/src/tags/Sequence.ts +37 -37
  108. package/src/tags/TagBase.ts +102 -102
  109. package/src/tags/Type.ts +64 -64
  110. package/src/tags/UniqueItems.ts +34 -34
  111. package/src/tags/internal/FormatCheatSheet.ts +71 -71
  112. package/src/transformers/ITransformOptions.ts +70 -70
  113. package/src/transformers/ImportTransformer.ts +253 -253
  114. package/src/transformers/NoTransformConfigurationError.ts +16 -16
  115. package/src/transformers/features/llm/LlmApplicationTransformer.ts +224 -224
  116. package/src/typings/Equal.ts +18 -18
@@ -1,102 +1,102 @@
1
- /**
2
- * Base type for all validation tags in typia.
3
- *
4
- * TagBase provides the foundation for all typia's validation tags. It attaches
5
- * metadata to TypeScript types that typia's transformer processes at
6
- * compile-time to generate optimized runtime validation code.
7
- *
8
- * @author Jeongho Nam - https://github.com/samchon
9
- * @example
10
- * ```typescript
11
- * // Custom tag example
12
- * type MyCustomTag<Value extends number> = TagBase<{
13
- * target: "number";
14
- * kind: "MyCustom";
15
- * value: Value;
16
- * validate: `$input === ${Value}`;
17
- * }>;
18
- * ```
19
- *
20
- * @template Props - Tag properties that define validation behavior
21
- */
22
- export type TagBase<
23
- Props extends TagBase.IProps<any, any, any, any, any, any>,
24
- > = {
25
- /**
26
- * This is a dummy property for compilation.
27
- *
28
- * It does not mean anything in runtime.
29
- */
30
- "typia.tag"?: Props;
31
- };
32
- export namespace TagBase {
33
- /**
34
- * Properties interface for validation tags.
35
- *
36
- * @author Jeongho Nam - https://github.com/samchon
37
- */
38
- export interface IProps<
39
- Target extends
40
- | "boolean"
41
- | "bigint"
42
- | "number"
43
- | "string"
44
- | "array"
45
- | "object",
46
- Kind extends string,
47
- Value extends boolean | bigint | number | string | undefined,
48
- Validate extends
49
- | string
50
- | {
51
- [key in Target]?: string;
52
- },
53
- Exclusive extends boolean | string[],
54
- Schema extends object | undefined,
55
- > {
56
- /**
57
- * Target type.
58
- *
59
- * If user tries to adapt this tag to a different type, it would be a
60
- * compile error.
61
- *
62
- * For example, you've configured target type as `string`, but user adapted
63
- * it onto a `number` type (`number & YourCustomTag<Value>`), then it would
64
- * be blocked by TypeScript compiler.
65
- */
66
- target: Target;
67
-
68
- /** What kind of tag is this? */
69
- kind: Kind;
70
-
71
- /** Value to be configured by user. */
72
- value: Value;
73
-
74
- /**
75
- * Validation script.
76
- *
77
- * This script would be inserted into the generated validation function. In
78
- * here script, target variable name must be `$input`. The variable name
79
- * `$input` would be transformed to the suitable when compilation.
80
- *
81
- * Also, If you've take a mistake on this script, compile error would be
82
- * occurred. So, define it with confidence. Compiler will block all your
83
- * mistakes.
84
- */
85
- validate?: Validate;
86
-
87
- /**
88
- * Exclusive option.
89
- *
90
- * If this property configured as `true`, same {@link kind} tag cannot be
91
- * duplicated in the target type. Otherwise, if you've configured this
92
- * property as string array, all of the {@link kind} value assigned tags
93
- * cannot be compatible in the target type.
94
- *
95
- * @default false
96
- */
97
- exclusive?: Exclusive | string[];
98
-
99
- /** Additional schema info assigned to the {@link IJsonSchema} object. */
100
- schema?: Schema;
101
- }
102
- }
1
+ /**
2
+ * Base type for all validation tags in typia.
3
+ *
4
+ * TagBase provides the foundation for all typia's validation tags. It attaches
5
+ * metadata to TypeScript types that typia's transformer processes at
6
+ * compile-time to generate optimized runtime validation code.
7
+ *
8
+ * @author Jeongho Nam - https://github.com/samchon
9
+ * @example
10
+ * ```typescript
11
+ * // Custom tag example
12
+ * type MyCustomTag<Value extends number> = TagBase<{
13
+ * target: "number";
14
+ * kind: "MyCustom";
15
+ * value: Value;
16
+ * validate: `$input === ${Value}`;
17
+ * }>;
18
+ * ```
19
+ *
20
+ * @template Props - Tag properties that define validation behavior
21
+ */
22
+ export type TagBase<
23
+ Props extends TagBase.IProps<any, any, any, any, any, any>,
24
+ > = {
25
+ /**
26
+ * This is a dummy property for compilation.
27
+ *
28
+ * It does not mean anything in runtime.
29
+ */
30
+ "typia.tag"?: Props;
31
+ };
32
+ export namespace TagBase {
33
+ /**
34
+ * Properties interface for validation tags.
35
+ *
36
+ * @author Jeongho Nam - https://github.com/samchon
37
+ */
38
+ export interface IProps<
39
+ Target extends
40
+ | "boolean"
41
+ | "bigint"
42
+ | "number"
43
+ | "string"
44
+ | "array"
45
+ | "object",
46
+ Kind extends string,
47
+ Value extends boolean | bigint | number | string | undefined,
48
+ Validate extends
49
+ | string
50
+ | {
51
+ [key in Target]?: string;
52
+ },
53
+ Exclusive extends boolean | string[],
54
+ Schema extends object | undefined,
55
+ > {
56
+ /**
57
+ * Target type.
58
+ *
59
+ * If user tries to adapt this tag to a different type, it would be a
60
+ * compile error.
61
+ *
62
+ * For example, you've configured target type as `string`, but user adapted
63
+ * it onto a `number` type (`number & YourCustomTag<Value>`), then it would
64
+ * be blocked by TypeScript compiler.
65
+ */
66
+ target: Target;
67
+
68
+ /** What kind of tag is this? */
69
+ kind: Kind;
70
+
71
+ /** Value to be configured by user. */
72
+ value: Value;
73
+
74
+ /**
75
+ * Validation script.
76
+ *
77
+ * This script would be inserted into the generated validation function. In
78
+ * here script, target variable name must be `$input`. The variable name
79
+ * `$input` would be transformed to the suitable when compilation.
80
+ *
81
+ * Also, If you've take a mistake on this script, compile error would be
82
+ * occurred. So, define it with confidence. Compiler will block all your
83
+ * mistakes.
84
+ */
85
+ validate?: Validate;
86
+
87
+ /**
88
+ * Exclusive option.
89
+ *
90
+ * If this property configured as `true`, same {@link kind} tag cannot be
91
+ * duplicated in the target type. Otherwise, if you've configured this
92
+ * property as string array, all of the {@link kind} value assigned tags
93
+ * cannot be compatible in the target type.
94
+ *
95
+ * @default false
96
+ */
97
+ exclusive?: Exclusive | string[];
98
+
99
+ /** Additional schema info assigned to the {@link IJsonSchema} object. */
100
+ schema?: Schema;
101
+ }
102
+ }
package/src/tags/Type.ts CHANGED
@@ -1,64 +1,64 @@
1
- import { TagBase } from "./TagBase";
2
-
3
- /**
4
- * Type tag for specifying numeric bit-width representations.
5
- *
6
- * Constrains numeric types to specific bit-width formats used in systems
7
- * programming and protocol buffers. Ensures numbers conform to
8
- * platform-specific representations.
9
- *
10
- * Supported types:
11
- *
12
- * - `int32`: 32-bit signed integer (-2^31 to 2^31-1)
13
- * - `uint32`: 32-bit unsigned integer (0 to 2^32-1)
14
- * - `int64`: 64-bit signed integer (supports both bigint and number)
15
- * - `uint64`: 64-bit unsigned integer (supports both bigint and number)
16
- * - `float`: 32-bit floating point (single precision)
17
- * - `double`: 64-bit floating point (double precision, default JS number)
18
- *
19
- * @author Jeongho Nam - https://github.com/samchon
20
- * @example
21
- * ```typescript
22
- * type Score = number & Type<"int32">; // -2,147,483,648 to 2,147,483,647
23
- * type UserId = number & Type<"uint32">; // 0 to 4,294,967,295
24
- * type FileSize = bigint & Type<"int64">; // Large file sizes
25
- * type Coordinate = number & Type<"double">; // High precision coordinates
26
- * ```
27
- *
28
- * @template Value - The numeric type representation
29
- */
30
- export type Type<
31
- Value extends "int32" | "uint32" | "int64" | "uint64" | "float" | "double",
32
- > = TagBase<{
33
- target: Value extends "int64" | "uint64" ? "bigint" | "number" : "number";
34
- kind: "type";
35
- value: Value;
36
- validate: Value extends "int32"
37
- ? `$importInternal("isTypeInt32")($input)`
38
- : Value extends "uint32"
39
- ? `$importInternal("isTypeUint32")($input)`
40
- : Value extends "int64"
41
- ? {
42
- number: `$importInternal("isTypeInt64")($input)`;
43
- bigint: `true`;
44
- }
45
- : Value extends "uint64"
46
- ? {
47
- number: `$importInternal("isTypeUint64")($input)`;
48
- bigint: `BigInt(0) <= $input`;
49
- }
50
- : Value extends "float"
51
- ? `$importInternal("isTypeFloat")($input)`
52
- : `true`;
53
- exclusive: true;
54
- schema: Value extends "uint32" | "uint64"
55
- ? {
56
- type: "integer";
57
- minimum: 0;
58
- }
59
- : {
60
- type: Value extends "int32" | "uint32" | "int64" | "uint64"
61
- ? "integer"
62
- : "number";
63
- };
64
- }>;
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * Type tag for specifying numeric bit-width representations.
5
+ *
6
+ * Constrains numeric types to specific bit-width formats used in systems
7
+ * programming and protocol buffers. Ensures numbers conform to
8
+ * platform-specific representations.
9
+ *
10
+ * Supported types:
11
+ *
12
+ * - `int32`: 32-bit signed integer (-2^31 to 2^31-1)
13
+ * - `uint32`: 32-bit unsigned integer (0 to 2^32-1)
14
+ * - `int64`: 64-bit signed integer (supports both bigint and number)
15
+ * - `uint64`: 64-bit unsigned integer (supports both bigint and number)
16
+ * - `float`: 32-bit floating point (single precision)
17
+ * - `double`: 64-bit floating point (double precision, default JS number)
18
+ *
19
+ * @author Jeongho Nam - https://github.com/samchon
20
+ * @example
21
+ * ```typescript
22
+ * type Score = number & Type<"int32">; // -2,147,483,648 to 2,147,483,647
23
+ * type UserId = number & Type<"uint32">; // 0 to 4,294,967,295
24
+ * type FileSize = bigint & Type<"int64">; // Large file sizes
25
+ * type Coordinate = number & Type<"double">; // High precision coordinates
26
+ * ```
27
+ *
28
+ * @template Value - The numeric type representation
29
+ */
30
+ export type Type<
31
+ Value extends "int32" | "uint32" | "int64" | "uint64" | "float" | "double",
32
+ > = TagBase<{
33
+ target: Value extends "int64" | "uint64" ? "bigint" | "number" : "number";
34
+ kind: "type";
35
+ value: Value;
36
+ validate: Value extends "int32"
37
+ ? `$importInternal("isTypeInt32")($input)`
38
+ : Value extends "uint32"
39
+ ? `$importInternal("isTypeUint32")($input)`
40
+ : Value extends "int64"
41
+ ? {
42
+ number: `$importInternal("isTypeInt64")($input)`;
43
+ bigint: `true`;
44
+ }
45
+ : Value extends "uint64"
46
+ ? {
47
+ number: `$importInternal("isTypeUint64")($input)`;
48
+ bigint: `BigInt(0) <= $input`;
49
+ }
50
+ : Value extends "float"
51
+ ? `$importInternal("isTypeFloat")($input)`
52
+ : `true`;
53
+ exclusive: true;
54
+ schema: Value extends "uint32" | "uint64"
55
+ ? {
56
+ type: "integer";
57
+ minimum: 0;
58
+ }
59
+ : {
60
+ type: Value extends "int32" | "uint32" | "int64" | "uint64"
61
+ ? "integer"
62
+ : "number";
63
+ };
64
+ }>;
@@ -1,34 +1,34 @@
1
- import { TagBase } from "./TagBase";
2
-
3
- /**
4
- * Unique items validation tag for arrays.
5
- *
6
- * Enforces that all items in an array are unique, preventing duplicate values.
7
- * Uniqueness is determined using strict equality (===) for primitives and deep
8
- * structural comparison for objects and arrays. This means two objects with the
9
- * same properties and values are considered duplicates.
10
- *
11
- * @author Jeongho Nam - https://github.com/samchon
12
- * @example
13
- * // Ensure all IDs are unique
14
- * type UserIds = number[] & UniqueItems;
15
- *
16
- * @example
17
- * // Prevent duplicate email addresses
18
- * type EmailList = string[] & UniqueItems;
19
- *
20
- * @template Value - Boolean flag to enable/disable uniqueness validation
21
- * (defaults to true)
22
- */
23
- export type UniqueItems<Value extends boolean = true> = TagBase<{
24
- target: "array";
25
- kind: "uniqueItems";
26
- value: Value;
27
- validate: Value extends true
28
- ? `$importInternal("isUniqueItems")($input)`
29
- : undefined;
30
- exclusive: true;
31
- schema: {
32
- uniqueItems: true;
33
- };
34
- }>;
1
+ import { TagBase } from "./TagBase";
2
+
3
+ /**
4
+ * Unique items validation tag for arrays.
5
+ *
6
+ * Enforces that all items in an array are unique, preventing duplicate values.
7
+ * Uniqueness is determined using strict equality (===) for primitives and deep
8
+ * structural comparison for objects and arrays. This means two objects with the
9
+ * same properties and values are considered duplicates.
10
+ *
11
+ * @author Jeongho Nam - https://github.com/samchon
12
+ * @example
13
+ * // Ensure all IDs are unique
14
+ * type UserIds = number[] & UniqueItems;
15
+ *
16
+ * @example
17
+ * // Prevent duplicate email addresses
18
+ * type EmailList = string[] & UniqueItems;
19
+ *
20
+ * @template Value - Boolean flag to enable/disable uniqueness validation
21
+ * (defaults to true)
22
+ */
23
+ export type UniqueItems<Value extends boolean = true> = TagBase<{
24
+ target: "array";
25
+ kind: "uniqueItems";
26
+ value: Value;
27
+ validate: Value extends true
28
+ ? `$importInternal("isUniqueItems")($input)`
29
+ : undefined;
30
+ exclusive: true;
31
+ schema: {
32
+ uniqueItems: true;
33
+ };
34
+ }>;
@@ -1,71 +1,71 @@
1
- const RegexCall = <Text extends string>(text: Text) =>
2
- `${text}.test($input)` as const;
3
-
4
- /** @reference https://github.dev/ajv-validator/ajv-formats/blob/master/src/formats.ts */
5
- export const FormatCheatSheet = {
6
- // SPECIAL CHARACTERS
7
- byte: RegexCall(
8
- `/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm`,
9
- ),
10
- password: `true`,
11
- regex: `(() => { try { new RegExp($input); return true; } catch { return false; } })()`,
12
- uuid: RegexCall(
13
- `/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i`,
14
- ),
15
-
16
- // ADDRESSES
17
- email: RegexCall(
18
- `/^[a-z0-9!#$%&'*+/=?^_\`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_\`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i`,
19
- ),
20
- hostname: RegexCall(
21
- `/^(?=.{1,253}\\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\\.?$/i`,
22
- ),
23
- "idn-email": RegexCall(
24
- `/^(([^<>()[\\]\\.,;:\\s@\\"]+(\\.[^<>()[\\]\\.,;:\\s@\\"]+)*)|(\\".+\\"))@(([^<>()[\\]\\.,;:\\s@\\"]+\\.)+[^<>()[\\]\\.,;:\\s@\\"]{2,})$/i`,
25
- ),
26
- "idn-hostname": RegexCall(
27
- `/^([a-z0-9\\u00a1-\\uffff0-9]+(-[a-z0-9\\u00a1-\\uffff0-9]+)*\\.)+[a-z\\u00a1-\\uffff]{2,}$/i`,
28
- ),
29
- iri: RegexCall(
30
- `/^[A-Za-z][\\d+-.A-Za-z]*:[^\\u0000-\\u0020"<>\\\\^\`{|}]*$/u`,
31
- ),
32
- "iri-reference": RegexCall(
33
- `/^[A-Za-z][\\d+-.A-Za-z]*:[^\\u0000-\\u0020"<>\\\\^\`{|}]*$/u`,
34
- ),
35
- ipv4: RegexCall(
36
- `/^(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)$/`,
37
- ),
38
- ipv6: RegexCall(
39
- `/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1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(?:(?:[a-z0-9\\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\\/(?:[a-z0-9\\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\\/(?:[a-z0-9\\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\\?(?:[a-z0-9\\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i`,
46
- ),
47
- "uri-template": RegexCall(
48
- `/^(?:(?:[^\\x00-\\x20"'<>%\\\\^\`{|}]|%[0-9a-f]{2})|\\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\\*)?)*\\})*$/i`,
49
- ),
50
- url: RegexCall(
51
- `/^(?:https?|ftp):\\/\\/(?:\\S+(?::\\S*)?@)?(?:(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u{00a1}-\\u{ffff}]+-)*[a-z0-9\\u{00a1}-\\u{ffff}]+)(?:\\.(?:[a-z0-9\\u{00a1}-\\u{ffff}]+-)*[a-z0-9\\u{00a1}-\\u{ffff}]+)*(?:\\.(?:[a-z\\u{00a1}-\\u{ffff}]{2,})))(?::\\d{2,5})?(?:\\/[^\\s]*)?$/iu`,
52
- ),
53
-
54
- // TIMESTAMPS
55
- "date-time": RegexCall(
56
- `/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(T|\\s)([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](?:\\.[0-9]{1,9})?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$/i`,
57
- ),
58
- date: RegexCall(`/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/`),
59
- time: RegexCall(
60
- `/^([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](?:\\.[0-9]{1,9})?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$/i`,
61
- ),
62
- duration: RegexCall(
63
- `/^P(?!$)((\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+S)?)?|(\\d+W)?)$/`,
64
- ),
65
-
66
- // POINTERS
67
- "json-pointer": RegexCall(`/^(?:\\/(?:[^~/]|~0|~1)*)*$/`),
68
- "relative-json-pointer": RegexCall(
69
- `/^(?:0|[1-9][0-9]*)(?:#|(?:\\/(?:[^~/]|~0|~1)*)*)$/`,
70
- ),
71
- } as const;
1
+ const RegexCall = <Text extends string>(text: Text) =>
2
+ `${text}.test($input)` as const;
3
+
4
+ /** @reference https://github.dev/ajv-validator/ajv-formats/blob/master/src/formats.ts */
5
+ export const FormatCheatSheet = {
6
+ // SPECIAL CHARACTERS
7
+ byte: RegexCall(
8
+ `/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm`,
9
+ ),
10
+ password: `true`,
11
+ regex: `(() => { try { new RegExp($input); return true; } catch { return false; } })()`,
12
+ uuid: RegexCall(
13
+ `/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i`,
14
+ ),
15
+
16
+ // ADDRESSES
17
+ email: RegexCall(
18
+ `/^[a-z0-9!#$%&'*+/=?^_\`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_\`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i`,
19
+ ),
20
+ hostname: RegexCall(
21
+ `/^(?=.{1,253}\\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\\.?$/i`,
22
+ ),
23
+ "idn-email": RegexCall(
24
+ `/^(([^<>()[\\]\\.,;:\\s@\\"]+(\\.[^<>()[\\]\\.,;:\\s@\\"]+)*)|(\\".+\\"))@(([^<>()[\\]\\.,;:\\s@\\"]+\\.)+[^<>()[\\]\\.,;:\\s@\\"]{2,})$/i`,
25
+ ),
26
+ "idn-hostname": RegexCall(
27
+ `/^([a-z0-9\\u00a1-\\uffff0-9]+(-[a-z0-9\\u00a1-\\uffff0-9]+)*\\.)+[a-z\\u00a1-\\uffff]{2,}$/i`,
28
+ ),
29
+ iri: RegexCall(
30
+ `/^[A-Za-z][\\d+-.A-Za-z]*:[^\\u0000-\\u0020"<>\\\\^\`{|}]*$/u`,
31
+ ),
32
+ "iri-reference": RegexCall(
33
+ `/^[A-Za-z][\\d+-.A-Za-z]*:[^\\u0000-\\u0020"<>\\\\^\`{|}]*$/u`,
34
+ ),
35
+ ipv4: RegexCall(
36
+ `/^(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)$/`,
37
+ ),
38
+ ipv6: RegexCall(
39
+ `/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})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,
46
+ ),
47
+ "uri-template": RegexCall(
48
+ `/^(?:(?:[^\\x00-\\x20"'<>%\\\\^\`{|}]|%[0-9a-f]{2})|\\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\\*)?)*\\})*$/i`,
49
+ ),
50
+ url: RegexCall(
51
+ `/^(?:https?|ftp):\\/\\/(?:\\S+(?::\\S*)?@)?(?:(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u{00a1}-\\u{ffff}]+-)*[a-z0-9\\u{00a1}-\\u{ffff}]+)(?:\\.(?:[a-z0-9\\u{00a1}-\\u{ffff}]+-)*[a-z0-9\\u{00a1}-\\u{ffff}]+)*(?:\\.(?:[a-z\\u{00a1}-\\u{ffff}]{2,})))(?::\\d{2,5})?(?:\\/[^\\s]*)?$/iu`,
52
+ ),
53
+
54
+ // TIMESTAMPS
55
+ "date-time": RegexCall(
56
+ `/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(T|\\s)([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](?:\\.[0-9]{1,9})?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$/i`,
57
+ ),
58
+ date: RegexCall(`/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/`),
59
+ time: RegexCall(
60
+ `/^([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](?:\\.[0-9]{1,9})?(Z|[+-]([01][0-9]|2[0-3]):[0-5][0-9])$/i`,
61
+ ),
62
+ duration: RegexCall(
63
+ `/^P(?!$)((\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+S)?)?|(\\d+W)?)$/`,
64
+ ),
65
+
66
+ // POINTERS
67
+ "json-pointer": RegexCall(`/^(?:\\/(?:[^~/]|~0|~1)*)*$/`),
68
+ "relative-json-pointer": RegexCall(
69
+ `/^(?:0|[1-9][0-9]*)(?:#|(?:\\/(?:[^~/]|~0|~1)*)*)$/`,
70
+ ),
71
+ } as const;