@nestia/migrate 14.0.1 → 14.0.2

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 (167) hide show
  1. package/lib/NestiaMigrateApplication.d.ts +111 -0
  2. package/lib/NestiaMigrateApplication.js +148 -9
  3. package/lib/NestiaMigrateApplication.js.map +1 -1
  4. package/lib/NestiaMigrateApplication.mjs +147 -5
  5. package/lib/analyzers/NestiaMigrateControllerAnalyzer.d.ts +45 -0
  6. package/lib/analyzers/NestiaMigrateControllerAnalyzer.js +59 -3
  7. package/lib/analyzers/NestiaMigrateControllerAnalyzer.js.map +1 -1
  8. package/lib/analyzers/NestiaMigrateControllerAnalyzer.mjs +9 -3
  9. package/lib/archivers/NestiaMigrateFileArchiver.d.ts +34 -0
  10. package/lib/archivers/NestiaMigrateFileArchiver.js +34 -0
  11. package/lib/archivers/NestiaMigrateFileArchiver.js.map +1 -1
  12. package/lib/bundles/NEST_TEMPLATE.js +1 -1
  13. package/lib/bundles/NEST_TEMPLATE.mjs +1 -1
  14. package/lib/bundles/SDK_TEMPLATE.js +1 -1
  15. package/lib/bundles/SDK_TEMPLATE.mjs +1 -1
  16. package/lib/executable/NestiaMigrateCommander.d.ts +36 -0
  17. package/lib/executable/NestiaMigrateCommander.js +38 -0
  18. package/lib/executable/NestiaMigrateCommander.js.map +1 -1
  19. package/lib/executable/NestiaMigrateCommander.mjs +3 -1
  20. package/lib/executable/NestiaMigrateInquirer.d.ts +29 -0
  21. package/lib/executable/NestiaMigrateInquirer.js +20 -0
  22. package/lib/executable/NestiaMigrateInquirer.js.map +1 -1
  23. package/lib/factories/ExpressionFactory.d.ts +14 -0
  24. package/lib/factories/ExpressionFactory.js +14 -0
  25. package/lib/factories/ExpressionFactory.js.map +1 -1
  26. package/lib/factories/IdentifierFactory.d.ts +20 -0
  27. package/lib/factories/IdentifierFactory.js +20 -0
  28. package/lib/factories/IdentifierFactory.js.map +1 -1
  29. package/lib/factories/LiteralFactory.d.ts +18 -2
  30. package/lib/factories/LiteralFactory.js +18 -2
  31. package/lib/factories/LiteralFactory.js.map +1 -1
  32. package/lib/factories/StatementFactory.d.ts +26 -1
  33. package/lib/factories/StatementFactory.js +26 -1
  34. package/lib/factories/StatementFactory.js.map +1 -1
  35. package/lib/factories/SupportedStringFormats.d.ts +6 -0
  36. package/lib/factories/SupportedStringFormats.js +33 -0
  37. package/lib/factories/SupportedStringFormats.js.map +1 -0
  38. package/lib/factories/SupportedStringFormats.mjs +34 -0
  39. package/lib/factories/SupportedStringFormats.mjs.map +1 -0
  40. package/lib/factories/TypeFactory.d.ts +21 -0
  41. package/lib/factories/TypeFactory.js +13 -0
  42. package/lib/factories/TypeFactory.js.map +1 -1
  43. package/lib/factories/TypeLiteralFactory.d.ts +18 -0
  44. package/lib/factories/TypeLiteralFactory.js +18 -0
  45. package/lib/factories/TypeLiteralFactory.js.map +1 -1
  46. package/lib/internal/ts.d.ts +153 -0
  47. package/lib/internal/ts.js.map +1 -1
  48. package/lib/programmers/NestiaMigrateApiFileProgrammer.d.ts +31 -0
  49. package/lib/programmers/NestiaMigrateApiFileProgrammer.js +17 -0
  50. package/lib/programmers/NestiaMigrateApiFileProgrammer.js.map +1 -1
  51. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.d.ts +40 -0
  52. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js +27 -0
  53. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js.map +1 -1
  54. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.d.ts +39 -0
  55. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js +26 -0
  56. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js.map +1 -1
  57. package/lib/programmers/NestiaMigrateApiProgrammer.d.ts +18 -0
  58. package/lib/programmers/NestiaMigrateApiProgrammer.js +18 -0
  59. package/lib/programmers/NestiaMigrateApiProgrammer.js.map +1 -1
  60. package/lib/programmers/NestiaMigrateApiProgrammer.mjs +1 -1
  61. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.d.ts +40 -0
  62. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js +27 -0
  63. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js.map +1 -1
  64. package/lib/programmers/NestiaMigrateApiStartProgrammer.d.ts +17 -0
  65. package/lib/programmers/NestiaMigrateApiStartProgrammer.js +19 -8
  66. package/lib/programmers/NestiaMigrateApiStartProgrammer.js.map +1 -1
  67. package/lib/programmers/NestiaMigrateApiStartProgrammer.mjs +1 -6
  68. package/lib/programmers/NestiaMigrateDtoProgrammer.d.ts +30 -0
  69. package/lib/programmers/NestiaMigrateDtoProgrammer.js +17 -0
  70. package/lib/programmers/NestiaMigrateDtoProgrammer.js.map +1 -1
  71. package/lib/programmers/NestiaMigrateE2eFileProgrammer.d.ts +39 -0
  72. package/lib/programmers/NestiaMigrateE2eFileProgrammer.js +26 -0
  73. package/lib/programmers/NestiaMigrateE2eFileProgrammer.js.map +1 -1
  74. package/lib/programmers/NestiaMigrateE2eProgrammer.d.ts +16 -0
  75. package/lib/programmers/NestiaMigrateE2eProgrammer.js +16 -0
  76. package/lib/programmers/NestiaMigrateE2eProgrammer.js.map +1 -1
  77. package/lib/programmers/NestiaMigrateImportProgrammer.d.ts +75 -0
  78. package/lib/programmers/NestiaMigrateImportProgrammer.js +58 -3
  79. package/lib/programmers/NestiaMigrateImportProgrammer.js.map +1 -1
  80. package/lib/programmers/NestiaMigrateImportProgrammer.mjs +58 -3
  81. package/lib/programmers/NestiaMigrateNestControllerProgrammer.d.ts +28 -0
  82. package/lib/programmers/NestiaMigrateNestControllerProgrammer.js +16 -0
  83. package/lib/programmers/NestiaMigrateNestControllerProgrammer.js.map +1 -1
  84. package/lib/programmers/NestiaMigrateNestMethodProgrammer.d.ts +30 -0
  85. package/lib/programmers/NestiaMigrateNestMethodProgrammer.js +16 -0
  86. package/lib/programmers/NestiaMigrateNestMethodProgrammer.js.map +1 -1
  87. package/lib/programmers/NestiaMigrateNestModuleProgrammer.d.ts +16 -0
  88. package/lib/programmers/NestiaMigrateNestModuleProgrammer.js +16 -0
  89. package/lib/programmers/NestiaMigrateNestModuleProgrammer.js.map +1 -1
  90. package/lib/programmers/NestiaMigrateNestProgrammer.d.ts +17 -0
  91. package/lib/programmers/NestiaMigrateNestProgrammer.js +17 -0
  92. package/lib/programmers/NestiaMigrateNestProgrammer.js.map +1 -1
  93. package/lib/programmers/NestiaMigrateSchemaProgrammer.d.ts +16 -0
  94. package/lib/programmers/NestiaMigrateSchemaProgrammer.js +20 -5
  95. package/lib/programmers/NestiaMigrateSchemaProgrammer.js.map +1 -1
  96. package/lib/programmers/NestiaMigrateSchemaProgrammer.mjs +4 -4
  97. package/lib/structures/INestiaMigrateConfig.d.ts +21 -0
  98. package/lib/structures/INestiaMigrateContext.d.ts +15 -0
  99. package/lib/structures/INestiaMigrateController.d.ts +13 -0
  100. package/lib/structures/INestiaMigrateFile.d.ts +11 -0
  101. package/lib/utils/FilePrinter.d.ts +33 -0
  102. package/lib/utils/FilePrinter.js +33 -0
  103. package/lib/utils/FilePrinter.js.map +1 -1
  104. package/lib/utils/MapUtil.d.ts +17 -0
  105. package/lib/utils/MapUtil.js +19 -3
  106. package/lib/utils/MapUtil.js.map +1 -1
  107. package/lib/utils/MapUtil.mjs +1 -2
  108. package/lib/utils/PathTemplate.d.ts +23 -1
  109. package/lib/utils/PathTemplate.js +15 -1
  110. package/lib/utils/PathTemplate.js.map +1 -1
  111. package/lib/utils/RequestBody.d.ts +13 -0
  112. package/lib/utils/RequestBody.js +13 -0
  113. package/lib/utils/RequestBody.js.map +1 -1
  114. package/lib/utils/StringUtil.d.ts +55 -0
  115. package/lib/utils/StringUtil.js +93 -8
  116. package/lib/utils/StringUtil.js.map +1 -1
  117. package/lib/utils/StringUtil.mjs +30 -8
  118. package/lib/utils/SuccessStatus.d.ts +21 -1
  119. package/lib/utils/SuccessStatus.js +21 -1
  120. package/lib/utils/SuccessStatus.js.map +1 -1
  121. package/package.json +4 -3
  122. package/src/NestiaMigrateApplication.ts +151 -13
  123. package/src/analyzers/NestiaMigrateControllerAnalyzer.ts +59 -4
  124. package/src/archivers/NestiaMigrateFileArchiver.ts +34 -0
  125. package/src/bundles/NEST_TEMPLATE.ts +1 -1
  126. package/src/bundles/SDK_TEMPLATE.ts +1 -1
  127. package/src/executable/NestiaMigrateCommander.ts +40 -0
  128. package/src/executable/NestiaMigrateInquirer.ts +29 -0
  129. package/src/factories/ExpressionFactory.ts +14 -0
  130. package/src/factories/IdentifierFactory.ts +20 -0
  131. package/src/factories/LiteralFactory.ts +18 -2
  132. package/src/factories/StatementFactory.ts +26 -1
  133. package/src/factories/SupportedStringFormats.ts +29 -0
  134. package/src/factories/TypeFactory.ts +21 -0
  135. package/src/factories/TypeLiteralFactory.ts +18 -0
  136. package/src/internal/ts.ts +153 -0
  137. package/src/programmers/NestiaMigrateApiFileProgrammer.ts +35 -0
  138. package/src/programmers/NestiaMigrateApiFunctionProgrammer.ts +43 -0
  139. package/src/programmers/NestiaMigrateApiNamespaceProgrammer.ts +42 -0
  140. package/src/programmers/NestiaMigrateApiProgrammer.ts +18 -0
  141. package/src/programmers/NestiaMigrateApiSimulationProgrammer.ts +43 -0
  142. package/src/programmers/NestiaMigrateApiStartProgrammer.ts +19 -10
  143. package/src/programmers/NestiaMigrateDtoProgrammer.ts +33 -0
  144. package/src/programmers/NestiaMigrateE2eFileProgrammer.ts +42 -0
  145. package/src/programmers/NestiaMigrateE2eProgrammer.ts +16 -0
  146. package/src/programmers/NestiaMigrateImportProgrammer.ts +86 -5
  147. package/src/programmers/NestiaMigrateNestControllerProgrammer.ts +30 -0
  148. package/src/programmers/NestiaMigrateNestMethodProgrammer.ts +34 -0
  149. package/src/programmers/NestiaMigrateNestModuleProgrammer.ts +16 -0
  150. package/src/programmers/NestiaMigrateNestProgrammer.ts +17 -0
  151. package/src/programmers/NestiaMigrateSchemaProgrammer.ts +25 -8
  152. package/src/structures/INestiaMigrateConfig.ts +26 -0
  153. package/src/structures/INestiaMigrateContext.ts +17 -0
  154. package/src/structures/INestiaMigrateController.ts +16 -0
  155. package/src/structures/INestiaMigrateFile.ts +13 -0
  156. package/src/utils/FilePrinter.ts +33 -0
  157. package/src/utils/MapUtil.ts +18 -2
  158. package/src/utils/PathTemplate.ts +23 -1
  159. package/src/utils/RequestBody.ts +13 -0
  160. package/src/utils/StringUtil.ts +101 -9
  161. package/src/utils/SuccessStatus.ts +21 -1
  162. package/lib/factories/FormatCheatSheet.d.ts +0 -25
  163. package/lib/factories/FormatCheatSheet.js +0 -34
  164. package/lib/factories/FormatCheatSheet.js.map +0 -1
  165. package/lib/factories/FormatCheatSheet.mjs +0 -31
  166. package/lib/factories/FormatCheatSheet.mjs.map +0 -1
  167. package/src/factories/FormatCheatSheet.ts +0 -71
@@ -1,24 +1,79 @@
1
+ /**
2
+ * String helpers that turn arbitrary text into valid identifiers and names.
3
+ *
4
+ * Identifier escaping traverses the input with a fixed punctuation table and
5
+ * Unicode-aware per-segment replacements; total work and intermediate storage
6
+ * scale with encoded output length.
7
+ *
8
+ * @evidence contracts/common.md#principled-implementation The namespace holds the capitalization, path segment normalization, and identifier escaping rules used by the generators.
9
+ * @evidence contracts/common.md#clear-and-simple-design Three functions and private tables of reserved words and replacements.
10
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The tables are the language's reserved words and a fixed replacement of punctuation.
11
+ * @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
12
+ */
1
13
  export namespace StringUtil {
2
- export const capitalize = (str: string) =>
3
- str[0]!.toUpperCase() + str.slice(1).toLowerCase();
14
+ /**
15
+ * Upper-cases the first character and lower-cases the rest; an empty string
16
+ * stays empty.
17
+ *
18
+ * One leading-character conversion and one remainder conversion cost O(N) in
19
+ * the input length.
20
+ *
21
+ * @evidence contracts/common.md#principled-implementation The first character is transformed alone and the remainder is lower-cased, so the result is a normalized word.
22
+ * @evidence contracts/common.md#clear-and-simple-design One expression.
23
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts It applies to every input.
24
+ * @evidence contracts/common.md#meaningful-documentation The comment states the rule and the empty case.
25
+ */
26
+ export const capitalize = (str: string): string =>
27
+ str.length === 0 ? str : str[0]!.toUpperCase() + str.slice(1).toLowerCase();
4
28
 
29
+ /**
30
+ * Splits a path by slashes and normalizes each non-empty segment into a name.
31
+ *
32
+ * The path is split once and each segment normalized with a fixed number of
33
+ * transformations: O(N) total text work and output storage.
34
+ *
35
+ * @evidence contracts/common.md#principled-implementation Each segment loses dots and dashes, a reserved word or a leading digit gets an underscore prefix, and empty segments are dropped.
36
+ * @evidence contracts/common.md#clear-and-simple-design One expression over the private normalizer.
37
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The rules apply to every segment.
38
+ * @evidence contracts/common.md#meaningful-documentation The comment states the normalization.
39
+ */
5
40
  export const splitWithNormalization = (path: string) =>
6
41
  path
7
42
  .split("/")
8
43
  .map((str) => normalize(str.trim()))
9
44
  .filter((str) => !!str.length);
10
45
 
46
+ /**
47
+ * Escapes a string into a valid, possibly qualified, name.
48
+ *
49
+ * A dot separates the segments of a qualified name, so each segment is
50
+ * escaped as one identifier. Punctuation is replaced by a word such as
51
+ * `_at_`, any other character an identifier cannot hold by its code point, a
52
+ * reserved word or a segment that cannot start an identifier gets an
53
+ * underscore prefix, and an empty segment is `_empty_`. The last segment
54
+ * names a type, so it is also prefixed when it is a predefined type name.
55
+ *
56
+ * A fixed punctuation table traverses the text before per-segment Unicode
57
+ * escaping. Work scales linearly with the encoded text length for the fixed
58
+ * table; expanded code-point spellings are retained only in the returned
59
+ * string.
60
+ *
61
+ * @evidence contracts/common.md#principled-implementation Whitespace at the edges is trimmed and the punctuation table is applied in its fixed order over the whole string; the string is then split at the dots, which stay as the namespace separators the DTO tree reads, and every segment is made an identifier by the ECMAScript rule: characters outside `ID_Continue` become their code point, and a reserved word, a predefined type name in the last segment or a segment not starting with `ID_Start`, `_` or `$` is prefixed with an underscore, so each segment is a valid identifier even where the punctuation table does not cover its characters.
62
+ * @evidence contracts/common.md#clear-and-simple-design One function over one segment helper and three private tables of reserved words, predefined type names and replacements.
63
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts No schema name is special-cased; the fixed punctuation table and Unicode identifier rules apply to every segment.
64
+ * @evidence contracts/common.md#meaningful-documentation The comment states the segment rule, the replacements, the prefixes and the empty case.
65
+ */
11
66
  export const escapeNonVariable = (str: string): string => {
12
- str = escape(str);
67
+ str = str.trim();
13
68
  for (const [before, after] of VARIABLE_REPLACERS)
14
69
  str = str.split(before).join(after);
15
- for (let i: number = 0; i <= 9; ++i)
16
- if (str[0] === i.toString()) {
17
- str = "_" + str;
18
- break;
19
- }
20
70
  if (str === "") return "_empty_";
21
- return str;
71
+ const segments: string[] = str.split(".");
72
+ return segments
73
+ .map((segment, index) =>
74
+ escapeSegment(segment, index === segments.length - 1),
75
+ )
76
+ .join(".");
22
77
  };
23
78
  }
24
79
 
@@ -30,10 +85,42 @@ const escape = (str: string): string => {
30
85
  return str;
31
86
  };
32
87
 
88
+ // One identifier. The patterns are built at run time because the property
89
+ // escapes need a newer script target than the one this package compiles to.
90
+ const NON_IDENTIFIER_PART: RegExp = new RegExp("[^\\p{ID_Continue}]", "gu");
91
+ const IDENTIFIER_START: RegExp = new RegExp("^[\\p{ID_Start}_$]", "u");
92
+
93
+ const escapeSegment = (segment: string, type: boolean): string => {
94
+ segment = segment.replace(
95
+ NON_IDENTIFIER_PART,
96
+ (char) => `_u${char.codePointAt(0)!.toString(16)}_`,
97
+ );
98
+ if (segment.length === 0) return "_empty_";
99
+ return RESERVED.has(segment) ||
100
+ (type && TYPE_NAMES.has(segment)) ||
101
+ IDENTIFIER_START.test(segment) === false
102
+ ? `_${segment}`
103
+ : segment;
104
+ };
105
+
33
106
  const normalize = (str: string): string =>
34
107
  escape(str.split(".").join("_").split("-").join("_"));
35
108
 
109
+ const TYPE_NAMES: Set<string> = new Set([
110
+ "any",
111
+ "bigint",
112
+ "boolean",
113
+ "never",
114
+ "number",
115
+ "object",
116
+ "string",
117
+ "symbol",
118
+ "undefined",
119
+ "unknown",
120
+ ]);
121
+
36
122
  const RESERVED: Set<string> = new Set([
123
+ "await",
37
124
  "break",
38
125
  "case",
39
126
  "catch",
@@ -53,9 +140,12 @@ const RESERVED: Set<string> = new Set([
53
140
  "for",
54
141
  "function",
55
142
  "if",
143
+ "implements",
56
144
  "import",
57
145
  "in",
58
146
  "instanceof",
147
+ "interface",
148
+ "let",
59
149
  "module",
60
150
  "new",
61
151
  "null",
@@ -64,6 +154,7 @@ const RESERVED: Set<string> = new Set([
64
154
  "private",
65
155
  "protected",
66
156
  "return",
157
+ "static",
67
158
  "super",
68
159
  "switch",
69
160
  "this",
@@ -75,6 +166,7 @@ const RESERVED: Set<string> = new Set([
75
166
  "void",
76
167
  "while",
77
168
  "with",
169
+ "yield",
78
170
  ]);
79
171
 
80
172
  const VARIABLE_REPLACERS: [string, string][] = [
@@ -1,5 +1,13 @@
1
1
  import { IHttpMigrateRoute } from "@typia/interface";
2
2
 
3
+ /**
4
+ * Helpers about the success status of a route.
5
+ *
6
+ * @evidence contracts/common.md#principled-implementation The namespace holds the status that the SDK should treat as success and the status that the generated NestJS controller answers.
7
+ * @evidence contracts/common.md#clear-and-simple-design Two functions and one private priority.
8
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The rules follow HTTP conventions.
9
+ * @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
10
+ */
3
11
  export namespace SuccessStatus {
4
12
  /**
5
13
  * The route's success status code, or null when the document declares only a
@@ -8,6 +16,11 @@ export namespace SuccessStatus {
8
16
  * The success response is the one typia's route composer selects: 200, then
9
17
  * 201, then the lowest other 2xx. A bodiless one, such as a 204 No Content,
10
18
  * leaves `route.success` null, so its status is read from the responses.
19
+ *
20
+ * @evidence contracts/common.md#principled-implementation The candidates are the 2xx keys of the responses ordered by a fixed priority, and a value that is not a three-digit number is rejected.
21
+ * @evidence contracts/common.md#clear-and-simple-design One function with one priority helper.
22
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The order is the HTTP convention.
23
+ * @evidence contracts/common.md#meaningful-documentation The comment states the selection.
11
24
  */
12
25
  export const of = (route: IHttpMigrateRoute): number | null => {
13
26
  const status: string | undefined =
@@ -20,7 +33,14 @@ export namespace SuccessStatus {
20
33
  : null;
21
34
  };
22
35
 
23
- /** The status NestJS answers without `@HttpCode()`. */
36
+ /**
37
+ * The status NestJS answers without `@HttpCode()`.
38
+ *
39
+ * @evidence contracts/common.md#principled-implementation NestJS answers 201 for POST and 200 for the other methods when no status is set, so a generated controller matches without an explicit one.
40
+ * @evidence contracts/common.md#clear-and-simple-design One expression.
41
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The rule is NestJS's.
42
+ * @evidence contracts/common.md#meaningful-documentation The comment states the two statuses.
43
+ */
24
44
  export const nest = (route: IHttpMigrateRoute): number =>
25
45
  route.method === "post" ? 201 : 200;
26
46
 
@@ -1,25 +0,0 @@
1
- /** @reference https://github.dev/ajv-validator/ajv-formats/blob/master/src/formats.ts */
2
- export declare const FormatCheatSheet: {
3
- readonly byte: "/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm.test($input)";
4
- readonly password: `true`;
5
- readonly regex: `(() => { try { new RegExp($input); return true; } catch { return false; } })()`;
6
- readonly uuid: "/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i.test($input)";
7
- readonly email: "/^[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.test($input)";
8
- readonly hostname: "/^(?=.{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.test($input)";
9
- readonly "idn-email": "/^(([^<>()[\\]\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@(([^<>()[\\]\\.,;:\\s@\\\"]+\\.)+[^<>()[\\]\\.,;:\\s@\\\"]{2,})$/i.test($input)";
10
- readonly "idn-hostname": "/^([a-z0-9\\u00a1-\\uffff0-9]+(-[a-z0-9\\u00a1-\\uffff0-9]+)*\\.)+[a-z\\u00a1-\\uffff]{2,}$/i.test($input)";
11
- readonly iri: "/^[A-Za-z][\\d+-.A-Za-z]*:[^\\u0000-\\u0020\"<>\\\\^`{|}]*$/u.test($input)";
12
- readonly "iri-reference": "/^[A-Za-z][\\d+-.A-Za-z]*:[^\\u0000-\\u0020\"<>\\\\^`{|}]*$/u.test($input)";
13
- readonly ipv4: "/^(?:(?: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)$/.test($input)";
14
- readonly ipv6: "/^((([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|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[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|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[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|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[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|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[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|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[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|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))$/i.test($input)";
15
- readonly uri: "/\\/|:/.test($input) && /^(?:[a-z][a-z0-9+\\-.]*:)(?:\\/?\\/(?:(?:[a-z0-9\\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\\.[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?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\\.[a-z0-9\\-._~!$&'()*+,;=:]+)\\]|(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)|(?:[a-z0-9\\-._~!$&'\"()*+,;=]|%[0-9a-f]{2})*)(?::\\d*)?(?:\\/(?:[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})*)?(?:#(?:[a-z0-9\\-._~!$&'\"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i.test($input)";
17
- readonly "uri-template": "/^(?:(?:[^\\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.test($input)";
18
- readonly url: "/^(?: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.test($input)";
19
- readonly "date-time": "/^[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.test($input)";
20
- readonly date: "/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.test($input)";
21
- readonly time: "/^([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.test($input)";
22
- readonly duration: "/^P(?!$)((\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+S)?)?|(\\d+W)?)$/.test($input)";
23
- readonly "json-pointer": "/^(?:\\/(?:[^~/]|~0|~1)*)*$/.test($input)";
24
- readonly "relative-json-pointer": "/^(?:0|[1-9][0-9]*)(?:#|(?:\\/(?:[^~/]|~0|~1)*)*)$/.test($input)";
25
- };
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FormatCheatSheet = void 0;
4
- const RegexCall = (text) => `${text}.test($input)`;
5
- /** @reference https://github.dev/ajv-validator/ajv-formats/blob/master/src/formats.ts */
6
- exports.FormatCheatSheet = {
7
- // SPECIAL CHARACTERS
8
- byte: RegexCall(`/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm`),
9
- password: `true`,
10
- regex: `(() => { try { new RegExp($input); return true; } catch { return false; } })()`,
11
- uuid: RegexCall(`/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i`),
12
- // ADDRESSES
13
- email: RegexCall(`/^[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`),
14
- hostname: RegexCall(`/^(?=.{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`),
15
- "idn-email": RegexCall(`/^(([^<>()[\\]\\.,;:\\s@\\"]+(\\.[^<>()[\\]\\.,;:\\s@\\"]+)*)|(\\".+\\"))@(([^<>()[\\]\\.,;:\\s@\\"]+\\.)+[^<>()[\\]\\.,;:\\s@\\"]{2,})$/i`),
16
- "idn-hostname": RegexCall(`/^([a-z0-9\\u00a1-\\uffff0-9]+(-[a-z0-9\\u00a1-\\uffff0-9]+)*\\.)+[a-z\\u00a1-\\uffff]{2,}$/i`),
17
- iri: RegexCall(`/^[A-Za-z][\\d+-.A-Za-z]*:[^\\u0000-\\u0020"<>\\\\^\`{|}]*$/u`),
18
- "iri-reference": RegexCall(`/^[A-Za-z][\\d+-.A-Za-z]*:[^\\u0000-\\u0020"<>\\\\^\`{|}]*$/u`),
19
- ipv4: RegexCall(`/^(?:(?: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)$/`),
20
- ipv6: RegexCall(`/^((([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\d\d|[1-9]?\d)){3}))|:)))$/i`),
21
- uri: `${RegexCall(`/\\/|:/`)} && ${RegexCall(`/^(?:[a-z][a-z0-9+\\-.]*:)(?:\\/?\\/(?:(?:[a-z0-9\\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?: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'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\\?(?:[a-z0-9\\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i`),
23
- "uri-template": RegexCall(`/^(?:(?:[^\\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`),
24
- url: RegexCall(`/^(?: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`),
25
- // TIMESTAMPS
26
- "date-time": RegexCall(`/^[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`),
27
- date: RegexCall(`/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/`),
28
- time: RegexCall(`/^([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`),
29
- duration: RegexCall(`/^P(?!$)((\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+S)?)?|(\\d+W)?)$/`),
30
- // POINTERS
31
- "json-pointer": RegexCall(`/^(?:\\/(?:[^~/]|~0|~1)*)*$/`),
32
- "relative-json-pointer": RegexCall(`/^(?:0|[1-9][0-9]*)(?:#|(?:\\/(?:[^~/]|~0|~1)*)*)$/`),
33
- };
34
- //# sourceMappingURL=FormatCheatSheet.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormatCheatSheet.js","sourceRoot":"","sources":["../../src/factories/FormatCheatSheet.ts"],"names":[],"mappings":";;;AAAA,MAAM,SAAS,GAAG,CAAsB,IAAU,EAAE,EAAE,CACpD,GAAG,IAAI,eAAwB,CAAC;AAElC,yFAAyF;AAC5E,QAAA,gBAAgB,GAAG;IAC9B,qBAAqB;IACrB,IAAI,EAAE,SAAS,CACb,sEAAsE,CACvE;IACD,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,gFAAgF;IACvF,IAAI,EAAE,SAAS,CACb,gEAAgE,CACjE;IAED,YAAY;IACZ,KAAK,EAAE,SAAS,CACd,gJAAgJ,CACjJ;IACD,QAAQ,EAAE,SAAS,CACjB,4GAA4G,CAC7G;IACD,WAAW,EAAE,SAAS,CACpB,4IAA4I,CAC7I;IACD,cAAc,EAAE,SAAS,CACvB,+FAA+F,CAChG;IACD,GAAG,EAAE,SAAS,CACZ,+DAA+D,CAChE;IACD,eAAe,EAAE,SAAS,CACxB,+DAA+D,CAChE;IACD,IAAI,EAAE,SAAS,CACb,8FAA8F,CAC/F;IACD,IAAI,EAAE,SAAS,CACb,o/BAAo/B,CACr/B;IACD,GAAG,EAAE,GAAG,SAAS,CAAC,SAAS,CAAC,OAAO,SAAS,CAC1C,oqCAAoqC,CACrqC,EAAE;IACH,eAAe,EAAE,SAAS,CACxB,8qCAA8qC,CAC/qC;IACD,cAAc,EAAE,SAAS,CACvB,8LAA8L,CAC/L;IACD,GAAG,EAAE,SAAS,CACZ,+fAA+f,CAChgB;IAED,aAAa;IACb,WAAW,EAAE,SAAS,CACpB,8JAA8J,CAC/J;IACD,IAAI,EAAE,SAAS,CAAC,uDAAuD,CAAC;IACxE,IAAI,EAAE,SAAS,CACb,sGAAsG,CACvG;IACD,QAAQ,EAAE,SAAS,CACjB,kFAAkF,CACnF;IAED,WAAW;IACX,cAAc,EAAE,SAAS,CAAC,8BAA8B,CAAC;IACzD,uBAAuB,EAAE,SAAS,CAChC,qDAAqD,CACtD;CACO,CAAC"}
@@ -1,31 +0,0 @@
1
- //#region src/factories/FormatCheatSheet.ts
2
- const RegexCall = (text) => `${text}.test($input)`;
3
- /** @reference https://github.dev/ajv-validator/ajv-formats/blob/master/src/formats.ts */
4
- const FormatCheatSheet = {
5
- byte: RegexCall(`/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm`),
6
- password: `true`,
7
- regex: `(() => { try { new RegExp($input); return true; } catch { return false; } })()`,
8
- uuid: RegexCall(`/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i`),
9
- email: RegexCall(`/^[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`),
10
- hostname: RegexCall(`/^(?=.{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`),
11
- "idn-email": RegexCall(`/^(([^<>()[\\]\\.,;:\\s@\\"]+(\\.[^<>()[\\]\\.,;:\\s@\\"]+)*)|(\\".+\\"))@(([^<>()[\\]\\.,;:\\s@\\"]+\\.)+[^<>()[\\]\\.,;:\\s@\\"]{2,})$/i`),
12
- "idn-hostname": RegexCall(`/^([a-z0-9\\u00a1-\\uffff0-9]+(-[a-z0-9\\u00a1-\\uffff0-9]+)*\\.)+[a-z\\u00a1-\\uffff]{2,}$/i`),
13
- iri: RegexCall(`/^[A-Za-z][\\d+-.A-Za-z]*:[^\\u0000-\\u0020"<>\\\\^\`{|}]*$/u`),
14
- "iri-reference": RegexCall(`/^[A-Za-z][\\d+-.A-Za-z]*:[^\\u0000-\\u0020"<>\\\\^\`{|}]*$/u`),
15
- ipv4: RegexCall(`/^(?:(?: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)$/`),
16
- ipv6: RegexCall(`/^((([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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\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\\.[a-z0-9\\-._~!$&'()*+,;=:]+)\\]|(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)|(?:[a-z0-9\\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\\d*)?(?:\\/(?:[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})*)?(?:#(?:[a-z0-9\\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i`),
19
- "uri-template": RegexCall(`/^(?:(?:[^\\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`),
20
- url: RegexCall(`/^(?: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`),
21
- "date-time": RegexCall(`/^[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`),
22
- date: RegexCall(`/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/`),
23
- time: RegexCall(`/^([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`),
24
- duration: RegexCall(`/^P(?!$)((\\d+Y)?(\\d+M)?(\\d+D)?(T(?=\\d)(\\d+H)?(\\d+M)?(\\d+S)?)?|(\\d+W)?)$/`),
25
- "json-pointer": RegexCall(`/^(?:\\/(?:[^~/]|~0|~1)*)*$/`),
26
- "relative-json-pointer": RegexCall(`/^(?:0|[1-9][0-9]*)(?:#|(?:\\/(?:[^~/]|~0|~1)*)*)$/`)
27
- };
28
- //#endregion
29
- export { FormatCheatSheet };
30
-
31
- //# sourceMappingURL=FormatCheatSheet.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormatCheatSheet.mjs","names":[],"sources":[],"mappings":""}
@@ -1,71 +0,0 @@
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}:((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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})*)?(?:#(?:[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;