@earendil-works/pi-schema 0.0.0-stage → 0.0.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 (176) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/LICENSES/typebox-LICENSE +23 -0
  3. package/README.md +295 -2
  4. package/dist/annotations.d.ts +44 -0
  5. package/dist/annotations.d.ts.map +1 -0
  6. package/dist/annotations.js +193 -0
  7. package/dist/annotations.js.map +1 -0
  8. package/dist/builders.d.ts +114 -0
  9. package/dist/builders.d.ts.map +1 -0
  10. package/dist/builders.js +98 -0
  11. package/dist/builders.js.map +1 -0
  12. package/dist/checks.d.ts +87 -0
  13. package/dist/checks.d.ts.map +1 -0
  14. package/dist/checks.js +447 -0
  15. package/dist/checks.js.map +1 -0
  16. package/dist/coerce.d.ts +53 -0
  17. package/dist/coerce.d.ts.map +1 -0
  18. package/dist/coerce.js +585 -0
  19. package/dist/coerce.js.map +1 -0
  20. package/dist/compiler.d.ts +53 -0
  21. package/dist/compiler.d.ts.map +1 -0
  22. package/dist/compiler.js +532 -0
  23. package/dist/compiler.js.map +1 -0
  24. package/dist/explain.d.ts +29 -0
  25. package/dist/explain.d.ts.map +1 -0
  26. package/dist/explain.js +381 -0
  27. package/dist/explain.js.map +1 -0
  28. package/dist/formats/index.d.ts +7 -0
  29. package/dist/formats/index.d.ts.map +1 -0
  30. package/dist/formats/index.js +51 -0
  31. package/dist/formats/index.js.map +1 -0
  32. package/dist/formats/typebox/date.d.ts +7 -0
  33. package/dist/formats/typebox/date.d.ts.map +1 -0
  34. package/dist/formats/typebox/date.js +47 -0
  35. package/dist/formats/typebox/date.js.map +1 -0
  36. package/dist/formats/typebox/date_time.d.ts +7 -0
  37. package/dist/formats/typebox/date_time.d.ts.map +1 -0
  38. package/dist/formats/typebox/date_time.js +39 -0
  39. package/dist/formats/typebox/date_time.js.map +1 -0
  40. package/dist/formats/typebox/duration.d.ts +6 -0
  41. package/dist/formats/typebox/duration.d.ts.map +1 -0
  42. package/dist/formats/typebox/duration.js +36 -0
  43. package/dist/formats/typebox/duration.js.map +1 -0
  44. package/dist/formats/typebox/email.d.ts +6 -0
  45. package/dist/formats/typebox/email.d.ts.map +1 -0
  46. package/dist/formats/typebox/email.js +36 -0
  47. package/dist/formats/typebox/email.js.map +1 -0
  48. package/dist/formats/typebox/hostname.d.ts +8 -0
  49. package/dist/formats/typebox/hostname.d.ts.map +1 -0
  50. package/dist/formats/typebox/hostname.js +38 -0
  51. package/dist/formats/typebox/hostname.js.map +1 -0
  52. package/dist/formats/typebox/idn_email.d.ts +6 -0
  53. package/dist/formats/typebox/idn_email.d.ts.map +1 -0
  54. package/dist/formats/typebox/idn_email.js +36 -0
  55. package/dist/formats/typebox/idn_email.js.map +1 -0
  56. package/dist/formats/typebox/idn_hostname.d.ts +9 -0
  57. package/dist/formats/typebox/idn_hostname.d.ts.map +1 -0
  58. package/dist/formats/typebox/idn_hostname.js +39 -0
  59. package/dist/formats/typebox/idn_hostname.js.map +1 -0
  60. package/dist/formats/typebox/idna/format/bidi.d.ts +4 -0
  61. package/dist/formats/typebox/idna/format/bidi.d.ts.map +1 -0
  62. package/dist/formats/typebox/idna/format/bidi.js +132 -0
  63. package/dist/formats/typebox/idna/format/bidi.js.map +1 -0
  64. package/dist/formats/typebox/idna/format/puny.d.ts +4 -0
  65. package/dist/formats/typebox/idna/format/puny.d.ts.map +1 -0
  66. package/dist/formats/typebox/idna/format/puny.js +172 -0
  67. package/dist/formats/typebox/idna/format/puny.js.map +1 -0
  68. package/dist/formats/typebox/idna/hostname.d.ts +2 -0
  69. package/dist/formats/typebox/idna/hostname.d.ts.map +1 -0
  70. package/dist/formats/typebox/idna/hostname.js +43 -0
  71. package/dist/formats/typebox/idna/hostname.js.map +1 -0
  72. package/dist/formats/typebox/idna/idn-hostname.d.ts +2 -0
  73. package/dist/formats/typebox/idna/idn-hostname.d.ts.map +1 -0
  74. package/dist/formats/typebox/idna/idn-hostname.js +71 -0
  75. package/dist/formats/typebox/idna/idn-hostname.js.map +1 -0
  76. package/dist/formats/typebox/idna/index.d.ts +3 -0
  77. package/dist/formats/typebox/idna/index.d.ts.map +1 -0
  78. package/dist/formats/typebox/idna/index.js +30 -0
  79. package/dist/formats/typebox/idna/index.js.map +1 -0
  80. package/dist/formats/typebox/idna/label/ascii.d.ts +2 -0
  81. package/dist/formats/typebox/idna/label/ascii.d.ts.map +1 -0
  82. package/dist/formats/typebox/idna/label/ascii.js +37 -0
  83. package/dist/formats/typebox/idna/label/ascii.js.map +1 -0
  84. package/dist/formats/typebox/idna/label/puny.d.ts +2 -0
  85. package/dist/formats/typebox/idna/label/puny.d.ts.map +1 -0
  86. package/dist/formats/typebox/idna/label/puny.js +56 -0
  87. package/dist/formats/typebox/idna/label/puny.js.map +1 -0
  88. package/dist/formats/typebox/idna/label/unicode.d.ts +2 -0
  89. package/dist/formats/typebox/idna/label/unicode.d.ts.map +1 -0
  90. package/dist/formats/typebox/idna/label/unicode.js +134 -0
  91. package/dist/formats/typebox/idna/label/unicode.js.map +1 -0
  92. package/dist/formats/typebox/idna/pattern/pattern.d.ts +31 -0
  93. package/dist/formats/typebox/idna/pattern/pattern.d.ts.map +1 -0
  94. package/dist/formats/typebox/idna/pattern/pattern.js +98 -0
  95. package/dist/formats/typebox/idna/pattern/pattern.js.map +1 -0
  96. package/dist/formats/typebox/ipv4.d.ts +6 -0
  97. package/dist/formats/typebox/ipv4.d.ts.map +1 -0
  98. package/dist/formats/typebox/ipv4.js +36 -0
  99. package/dist/formats/typebox/ipv4.js.map +1 -0
  100. package/dist/formats/typebox/ipv6.d.ts +6 -0
  101. package/dist/formats/typebox/ipv6.d.ts.map +1 -0
  102. package/dist/formats/typebox/ipv6.js +36 -0
  103. package/dist/formats/typebox/ipv6.js.map +1 -0
  104. package/dist/formats/typebox/iri.d.ts +6 -0
  105. package/dist/formats/typebox/iri.d.ts.map +1 -0
  106. package/dist/formats/typebox/iri.js +63 -0
  107. package/dist/formats/typebox/iri.js.map +1 -0
  108. package/dist/formats/typebox/iri_reference.d.ts +6 -0
  109. package/dist/formats/typebox/iri_reference.d.ts.map +1 -0
  110. package/dist/formats/typebox/iri_reference.js +40 -0
  111. package/dist/formats/typebox/iri_reference.js.map +1 -0
  112. package/dist/formats/typebox/json_pointer.d.ts +7 -0
  113. package/dist/formats/typebox/json_pointer.d.ts.map +1 -0
  114. package/dist/formats/typebox/json_pointer.js +37 -0
  115. package/dist/formats/typebox/json_pointer.js.map +1 -0
  116. package/dist/formats/typebox/json_pointer_uri_fragment.d.ts +7 -0
  117. package/dist/formats/typebox/json_pointer_uri_fragment.d.ts.map +1 -0
  118. package/dist/formats/typebox/json_pointer_uri_fragment.js +37 -0
  119. package/dist/formats/typebox/json_pointer_uri_fragment.js.map +1 -0
  120. package/dist/formats/typebox/regex.d.ts +6 -0
  121. package/dist/formats/typebox/regex.d.ts.map +1 -0
  122. package/dist/formats/typebox/regex.js +41 -0
  123. package/dist/formats/typebox/regex.js.map +1 -0
  124. package/dist/formats/typebox/relative_json_pointer.d.ts +7 -0
  125. package/dist/formats/typebox/relative_json_pointer.d.ts.map +1 -0
  126. package/dist/formats/typebox/relative_json_pointer.js +37 -0
  127. package/dist/formats/typebox/relative_json_pointer.js.map +1 -0
  128. package/dist/formats/typebox/time.d.ts +6 -0
  129. package/dist/formats/typebox/time.d.ts.map +1 -0
  130. package/dist/formats/typebox/time.js +60 -0
  131. package/dist/formats/typebox/time.js.map +1 -0
  132. package/dist/formats/typebox/uri.d.ts +6 -0
  133. package/dist/formats/typebox/uri.d.ts.map +1 -0
  134. package/dist/formats/typebox/uri.js +36 -0
  135. package/dist/formats/typebox/uri.js.map +1 -0
  136. package/dist/formats/typebox/uri_reference.d.ts +6 -0
  137. package/dist/formats/typebox/uri_reference.d.ts.map +1 -0
  138. package/dist/formats/typebox/uri_reference.js +36 -0
  139. package/dist/formats/typebox/uri_reference.js.map +1 -0
  140. package/dist/formats/typebox/uri_template.d.ts +6 -0
  141. package/dist/formats/typebox/uri_template.d.ts.map +1 -0
  142. package/dist/formats/typebox/uri_template.js +37 -0
  143. package/dist/formats/typebox/uri_template.js.map +1 -0
  144. package/dist/formats/typebox/url.d.ts +7 -0
  145. package/dist/formats/typebox/url.d.ts.map +1 -0
  146. package/dist/formats/typebox/url.js +36 -0
  147. package/dist/formats/typebox/url.js.map +1 -0
  148. package/dist/formats/typebox/uuid.d.ts +7 -0
  149. package/dist/formats/typebox/uuid.d.ts.map +1 -0
  150. package/dist/formats/typebox/uuid.js +37 -0
  151. package/dist/formats/typebox/uuid.js.map +1 -0
  152. package/dist/index.d.ts +4 -0
  153. package/dist/index.d.ts.map +1 -0
  154. package/dist/index.js +5 -0
  155. package/dist/index.js.map +1 -0
  156. package/dist/resolver.d.ts +57 -0
  157. package/dist/resolver.d.ts.map +1 -0
  158. package/dist/resolver.js +202 -0
  159. package/dist/resolver.js.map +1 -0
  160. package/dist/shared.d.ts +9 -0
  161. package/dist/shared.d.ts.map +1 -0
  162. package/dist/shared.js +33 -0
  163. package/dist/shared.js.map +1 -0
  164. package/dist/typebox-static.d.ts +48 -0
  165. package/dist/typebox-static.d.ts.map +1 -0
  166. package/dist/typebox-static.js +5 -0
  167. package/dist/typebox-static.js.map +1 -0
  168. package/dist/types.d.ts +48 -0
  169. package/dist/types.d.ts.map +1 -0
  170. package/dist/types.js +3 -0
  171. package/dist/types.js.map +1 -0
  172. package/dist/validator.d.ts +39 -0
  173. package/dist/validator.d.ts.map +1 -0
  174. package/dist/validator.js +71 -0
  175. package/dist/validator.js.map +1 -0
  176. package/package.json +59 -5
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Returns true if the value is a ISO8601 DateTime string
3
+ * @specification https://datatracker.ietf.org/doc/html/rfc3339
4
+ * @example `2020-12-12T20:20:40+00:00`
5
+ */
6
+ export declare function IsDateTime(value: string): boolean;
7
+ //# sourceMappingURL=date_time.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date_time.d.ts","sourceRoot":"","sources":["../../../src/formats/typebox/date_time.ts"],"names":[],"mappings":"AA+BA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAGjD"}
@@ -0,0 +1,39 @@
1
+ /*--------------------------------------------------------------------------
2
+
3
+ TypeBox
4
+
5
+ The MIT License (MIT)
6
+
7
+ Copyright (c) 2017-2026 Haydn Paterson
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
26
+
27
+ ---------------------------------------------------------------------------*/
28
+ import { IsDate } from "./date.js";
29
+ import { IsTime } from "./time.js";
30
+ /**
31
+ * Returns true if the value is a ISO8601 DateTime string
32
+ * @specification https://datatracker.ietf.org/doc/html/rfc3339
33
+ * @example `2020-12-12T20:20:40+00:00`
34
+ */
35
+ export function IsDateTime(value) {
36
+ const dateTime = value.split(/T/i);
37
+ return dateTime.length === 2 && IsDate(dateTime[0]) && IsTime(dateTime[1]);
38
+ }
39
+ //# sourceMappingURL=date_time.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date_time.js","sourceRoot":"","sources":["../../../src/formats/typebox/date_time.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;6EA0B6E;AAE7E,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa;IACvC,MAAM,QAAQ,GAAa,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7C,OAAO,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["/*--------------------------------------------------------------------------\n\nTypeBox\n\nThe MIT License (MIT)\n\nCopyright (c) 2017-2026 Haydn Paterson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n---------------------------------------------------------------------------*/\n\nimport { IsDate } from \"./date.ts\";\nimport { IsTime } from \"./time.ts\";\n\n/**\n * Returns true if the value is a ISO8601 DateTime string\n * @specification https://datatracker.ietf.org/doc/html/rfc3339\n * @example `2020-12-12T20:20:40+00:00`\n */\nexport function IsDateTime(value: string): boolean {\n\tconst dateTime: string[] = value.split(/T/i);\n\treturn dateTime.length === 2 && IsDate(dateTime[0]) && IsTime(dateTime[1]);\n}\n"]}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Returns true if the value is a valid ISO-8601 duration.
3
+ * @specification https://tools.ietf.org/html/rfc3339
4
+ */
5
+ export declare function IsDuration(value: string): boolean;
6
+ //# sourceMappingURL=duration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../../src/formats/typebox/duration.ts"],"names":[],"mappings":"AA+BA;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEjD"}
@@ -0,0 +1,36 @@
1
+ /*--------------------------------------------------------------------------
2
+
3
+ TypeBox
4
+
5
+ The MIT License (MIT)
6
+
7
+ Copyright (c) 2017-2026 Haydn Paterson
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
26
+
27
+ ---------------------------------------------------------------------------*/
28
+ const Duration = /^P((\d+Y(\d+M(\d+D)?)?|\d+M(\d+D)?|\d+D)(T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S))?|T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S)|\d+W)$/;
29
+ /**
30
+ * Returns true if the value is a valid ISO-8601 duration.
31
+ * @specification https://tools.ietf.org/html/rfc3339
32
+ */
33
+ export function IsDuration(value) {
34
+ return Duration.test(value);
35
+ }
36
+ //# sourceMappingURL=duration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duration.js","sourceRoot":"","sources":["../../../src/formats/typebox/duration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;6EA0B6E;AAE7E,MAAM,QAAQ,GACb,iIAAiI,CAAC;AAEnI;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa;IACvC,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["/*--------------------------------------------------------------------------\n\nTypeBox\n\nThe MIT License (MIT)\n\nCopyright (c) 2017-2026 Haydn Paterson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n---------------------------------------------------------------------------*/\n\nconst Duration =\n\t/^P((\\d+Y(\\d+M(\\d+D)?)?|\\d+M(\\d+D)?|\\d+D)(T(\\d+H(\\d+M(\\d+S)?)?|\\d+M(\\d+S)?|\\d+S))?|T(\\d+H(\\d+M(\\d+S)?)?|\\d+M(\\d+S)?|\\d+S)|\\d+W)$/;\n\n/**\n * Returns true if the value is a valid ISO-8601 duration.\n * @specification https://tools.ietf.org/html/rfc3339\n */\nexport function IsDuration(value: string): boolean {\n\treturn Duration.test(value);\n}\n"]}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Returns true if the value is an Email
3
+ * @specification https://datatracker.ietf.org/doc/html/rfc5322
4
+ */
5
+ export declare function IsEmail(value: string): boolean;
6
+ //# sourceMappingURL=email.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../../src/formats/typebox/email.ts"],"names":[],"mappings":"AA+BA;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE9C"}
@@ -0,0 +1,36 @@
1
+ /*--------------------------------------------------------------------------
2
+
3
+ TypeBox
4
+
5
+ The MIT License (MIT)
6
+
7
+ Copyright (c) 2017-2026 Haydn Paterson
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
26
+
27
+ ---------------------------------------------------------------------------*/
28
+ const Email = /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[^"\\]|\\[\x20-\x7e])*")@(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*|\[(?:IPv6:[a-f0-9:]+|(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?:\.(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3})\])$/i;
29
+ /**
30
+ * Returns true if the value is an Email
31
+ * @specification https://datatracker.ietf.org/doc/html/rfc5322
32
+ */
33
+ export function IsEmail(value) {
34
+ return Email.test(value);
35
+ }
36
+ //# sourceMappingURL=email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email.js","sourceRoot":"","sources":["../../../src/formats/typebox/email.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;6EA0B6E;AAE7E,MAAM,KAAK,GACV,oTAAoT,CAAC;AAEtT;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,KAAa;IACpC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["/*--------------------------------------------------------------------------\n\nTypeBox\n\nThe MIT License (MIT)\n\nCopyright (c) 2017-2026 Haydn Paterson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n---------------------------------------------------------------------------*/\n\nconst Email =\n\t/^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[^\"\\\\]|\\\\[\\x20-\\x7e])*\")@(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*|\\[(?:IPv6:[a-f0-9:]+|(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?:\\.(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3})\\])$/i;\n\n/**\n * Returns true if the value is an Email\n * @specification https://datatracker.ietf.org/doc/html/rfc5322\n */\nexport function IsEmail(value: string): boolean {\n\treturn Email.test(value);\n}\n"]}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Returns true if the value is a valid hostname.
3
+ * @specification https://tools.ietf.org/html/rfc1123
4
+ * @specification https://tools.ietf.org/html/rfc5891
5
+ * @specification https://tools.ietf.org/html/rfc5892
6
+ */
7
+ export declare function IsHostname(value: string): boolean;
8
+ //# sourceMappingURL=hostname.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hostname.d.ts","sourceRoot":"","sources":["../../../src/formats/typebox/hostname.ts"],"names":[],"mappings":"AA8BA;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEjD"}
@@ -0,0 +1,38 @@
1
+ /*--------------------------------------------------------------------------
2
+
3
+ TypeBox
4
+
5
+ The MIT License (MIT)
6
+
7
+ Copyright (c) 2017-2026 Haydn Paterson
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
26
+
27
+ ---------------------------------------------------------------------------*/
28
+ import * as Idna from "./idna/index.js";
29
+ /**
30
+ * Returns true if the value is a valid hostname.
31
+ * @specification https://tools.ietf.org/html/rfc1123
32
+ * @specification https://tools.ietf.org/html/rfc5891
33
+ * @specification https://tools.ietf.org/html/rfc5892
34
+ */
35
+ export function IsHostname(value) {
36
+ return Idna.IsHostname(value);
37
+ }
38
+ //# sourceMappingURL=hostname.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hostname.js","sourceRoot":"","sources":["../../../src/formats/typebox/hostname.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;6EA0B6E;AAE7E,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAExC;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa;IACvC,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["/*--------------------------------------------------------------------------\n\nTypeBox\n\nThe MIT License (MIT)\n\nCopyright (c) 2017-2026 Haydn Paterson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n---------------------------------------------------------------------------*/\n\nimport * as Idna from \"./idna/index.ts\";\n\n/**\n * Returns true if the value is a valid hostname.\n * @specification https://tools.ietf.org/html/rfc1123\n * @specification https://tools.ietf.org/html/rfc5891\n * @specification https://tools.ietf.org/html/rfc5892\n */\nexport function IsHostname(value: string): boolean {\n\treturn Idna.IsHostname(value);\n}\n"]}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Returns true if the value is an IdnEmail
3
+ * @specification https://datatracker.ietf.org/doc/html/rfc4952
4
+ */
5
+ export declare function IsIdnEmail(value: string): boolean;
6
+ //# sourceMappingURL=idn_email.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"idn_email.d.ts","sourceRoot":"","sources":["../../../src/formats/typebox/idn_email.ts"],"names":[],"mappings":"AA+BA;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEjD"}
@@ -0,0 +1,36 @@
1
+ /*--------------------------------------------------------------------------
2
+
3
+ TypeBox
4
+
5
+ The MIT License (MIT)
6
+
7
+ Copyright (c) 2017-2026 Haydn Paterson
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
26
+
27
+ ---------------------------------------------------------------------------*/
28
+ const IdnEmail = /^(?:[A-Za-z0-9!#$%&'*+/=?^_`{|}~\u{0080}-\u{10FFFF}-]+(?:\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~\u{0080}-\u{10FFFF}-]+)*|"(?:[^"\\]|\\.)*")@[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,62})(?<!-)(?:\.[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,62})(?<!-))*$/iu;
29
+ /**
30
+ * Returns true if the value is an IdnEmail
31
+ * @specification https://datatracker.ietf.org/doc/html/rfc4952
32
+ */
33
+ export function IsIdnEmail(value) {
34
+ return IdnEmail.test(value.normalize("NFC"));
35
+ }
36
+ //# sourceMappingURL=idn_email.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"idn_email.js","sourceRoot":"","sources":["../../../src/formats/typebox/idn_email.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;6EA0B6E;AAE7E,MAAM,QAAQ,GACb,iOAAiO,CAAC;AAEnO;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa;IACvC,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;AAC9C,CAAC","sourcesContent":["/*--------------------------------------------------------------------------\n\nTypeBox\n\nThe MIT License (MIT)\n\nCopyright (c) 2017-2026 Haydn Paterson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n---------------------------------------------------------------------------*/\n\nconst IdnEmail =\n\t/^(?:[A-Za-z0-9!#$%&'*+/=?^_`{|}~\\u{0080}-\\u{10FFFF}-]+(?:\\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~\\u{0080}-\\u{10FFFF}-]+)*|\"(?:[^\"\\\\]|\\\\.)*\")@[\\p{L}\\p{N}](?:[\\p{L}\\p{N}-]{0,62})(?<!-)(?:\\.[\\p{L}\\p{N}](?:[\\p{L}\\p{N}-]{0,62})(?<!-))*$/iu;\n\n/**\n * Returns true if the value is an IdnEmail\n * @specification https://datatracker.ietf.org/doc/html/rfc4952\n */\nexport function IsIdnEmail(value: string): boolean {\n\treturn IdnEmail.test(value.normalize(\"NFC\"));\n}\n"]}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Returns true if the value is a valid internationalized (IDN) hostname.
3
+ * @specification https://tools.ietf.org/html/rfc3490
4
+ * @specification https://tools.ietf.org/html/rfc5891
5
+ * @specification https://tools.ietf.org/html/rfc5892
6
+ * @specification https://tools.ietf.org/html/rfc5893
7
+ */
8
+ export declare function IsIdnHostname(value: string): boolean;
9
+ //# sourceMappingURL=idn_hostname.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"idn_hostname.d.ts","sourceRoot":"","sources":["../../../src/formats/typebox/idn_hostname.ts"],"names":[],"mappings":"AA8BA;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEpD"}
@@ -0,0 +1,39 @@
1
+ /*--------------------------------------------------------------------------
2
+
3
+ TypeBox
4
+
5
+ The MIT License (MIT)
6
+
7
+ Copyright (c) 2017-2026 Haydn Paterson
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
26
+
27
+ ---------------------------------------------------------------------------*/
28
+ import * as Idna from "./idna/index.js";
29
+ /**
30
+ * Returns true if the value is a valid internationalized (IDN) hostname.
31
+ * @specification https://tools.ietf.org/html/rfc3490
32
+ * @specification https://tools.ietf.org/html/rfc5891
33
+ * @specification https://tools.ietf.org/html/rfc5892
34
+ * @specification https://tools.ietf.org/html/rfc5893
35
+ */
36
+ export function IsIdnHostname(value) {
37
+ return Idna.IsIdnHostname(value);
38
+ }
39
+ //# sourceMappingURL=idn_hostname.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"idn_hostname.js","sourceRoot":"","sources":["../../../src/formats/typebox/idn_hostname.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;6EA0B6E;AAE7E,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IAC1C,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAClC,CAAC","sourcesContent":["/*--------------------------------------------------------------------------\n\nTypeBox\n\nThe MIT License (MIT)\n\nCopyright (c) 2017-2026 Haydn Paterson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n---------------------------------------------------------------------------*/\n\nimport * as Idna from \"./idna/index.ts\";\n\n/**\n * Returns true if the value is a valid internationalized (IDN) hostname.\n * @specification https://tools.ietf.org/html/rfc3490\n * @specification https://tools.ietf.org/html/rfc5891\n * @specification https://tools.ietf.org/html/rfc5892\n * @specification https://tools.ietf.org/html/rfc5893\n */\nexport function IsIdnHostname(value: string): boolean {\n\treturn Idna.IsIdnHostname(value);\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export declare function HasBidiChars(value: string): boolean;
2
+ export declare function HasRightToLeftCharacters(value: string): boolean;
3
+ export declare function SatisfiesBidiRule(value: string): boolean;
4
+ //# sourceMappingURL=bidi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bidi.d.ts","sourceRoot":"","sources":["../../../../../src/formats/typebox/idna/format/bidi.ts"],"names":[],"mappings":"AA8CA,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CASnD;AA8BD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAG/D;AAID,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAkCxD"}
@@ -0,0 +1,132 @@
1
+ /*--------------------------------------------------------------------------
2
+
3
+ TypeBox
4
+
5
+ The MIT License (MIT)
6
+
7
+ Copyright (c) 2017-2026 Haydn Paterson
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in
17
+ all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
+ THE SOFTWARE.
26
+
27
+ ---------------------------------------------------------------------------*/
28
+ // deno-fmt-ignore-file
29
+ import * as Pattern from "../pattern/pattern.js";
30
+ import * as FormatPuny from "./puny.js";
31
+ // ------------------------------------------------------------------
32
+ // LOCAL REGEX: Allowed Bidi classes per direction (RFC 5893)
33
+ // ------------------------------------------------------------------
34
+ const RE_RTL_ALLOWED = /^(?:R|AL|AN|EN|ES|CS|ET|ON|BN|NSM)$/;
35
+ const RE_LTR_ALLOWED = /^(?:L|EN|ES|CS|ET|ON|BN|NSM)$/;
36
+ const RE_RTL_CLASSES = /^(?:R|AL|AN)$/;
37
+ // ------------------------------------------------------------------
38
+ // HasBidiChars
39
+ //
40
+ // Decodes a punycode label to its Unicode form (if it is one) and
41
+ // checks whether the result is an RTL label per RFC 5893 §1.4.
42
+ // ------------------------------------------------------------------
43
+ export function HasBidiChars(value) {
44
+ if (FormatPuny.IsAcePrefixed(value)) {
45
+ try {
46
+ return HasRightToLeftCharacters(FormatPuny.Decode(value.slice(4).toLowerCase()));
47
+ }
48
+ catch {
49
+ return false;
50
+ }
51
+ }
52
+ return HasRightToLeftCharacters(value);
53
+ }
54
+ // ------------------------------------------------------------------
55
+ // GetBidiClass
56
+ // ------------------------------------------------------------------
57
+ function GetBidiClass(codePoint) {
58
+ const char = String.fromCodePoint(codePoint);
59
+ return Pattern.RE_EUROPEAN_NUMBER.test(char)
60
+ ? "EN"
61
+ : Pattern.RE_ARABIC_INDIC_DIGIT.test(char)
62
+ ? "AN"
63
+ : // Pattern.RE_EUROPEAN_SEPARATOR.test(char) ? 'ES' : // (no-spec-coverage)
64
+ // Pattern.RE_COMMON_SEPARATOR.test(char) ? 'CS' : // (no-spec-coverage)
65
+ Pattern.RE_MARK_NONSPACING.test(char)
66
+ ? "NSM"
67
+ : Pattern.RE_SCRIPT_HEBREW.test(char)
68
+ ? "R"
69
+ : Pattern.RE_SCRIPT_ARABIC_LETTER.test(char)
70
+ ? "AL"
71
+ : Pattern.RE_LETTER.test(char)
72
+ ? "L"
73
+ : "ON";
74
+ }
75
+ // ------------------------------------------------------------------
76
+ // HasRightToLeftCharacters
77
+ //
78
+ // Per RFC 5893 §1.4: "An RTL label is a label that contains at least
79
+ // one character of type R, AL, or AN." Used to determine whether a
80
+ // domain name is a "Bidi domain name" (RFC 5893 §1.4), in which case
81
+ // the Bidi Rule applies to every label in the domain.
82
+ // ------------------------------------------------------------------
83
+ export function HasRightToLeftCharacters(value) {
84
+ for (const ch of value)
85
+ if (RE_RTL_CLASSES.test(GetBidiClass(ch.codePointAt(0))))
86
+ return true;
87
+ return false;
88
+ }
89
+ // ------------------------------------------------------------------
90
+ // SatisfiesBidiRule
91
+ // ------------------------------------------------------------------
92
+ export function SatisfiesBidiRule(value) {
93
+ let isRtl = false;
94
+ let allowed = RE_LTR_ALLOWED;
95
+ let sawEN = false;
96
+ let sawAN = false;
97
+ let isFirst = true;
98
+ // let lastClass: string | null = null // (no-spec-coverage)
99
+ for (const ch of value) {
100
+ const bidiClass = GetBidiClass(ch.codePointAt(0));
101
+ if (isFirst) {
102
+ // 1. The first character must be a character with Bidi property L, R, or AL.
103
+ if (bidiClass !== "L" && bidiClass !== "R" && bidiClass !== "AL")
104
+ return false;
105
+ isRtl = bidiClass === "R" || bidiClass === "AL";
106
+ allowed = isRtl ? RE_RTL_ALLOWED : RE_LTR_ALLOWED;
107
+ isFirst = false;
108
+ }
109
+ // 2 / 5. Only characters in the allowed set for this direction may appear.
110
+ if (!allowed.test(bidiClass))
111
+ return false;
112
+ if (bidiClass === "EN")
113
+ sawEN = true;
114
+ else if (bidiClass === "AN")
115
+ sawAN = true;
116
+ // if (bidiClass !== 'NSM') lastClass = bidiClass // (no-spec-coverage)
117
+ }
118
+ if (isRtl && sawEN && sawAN)
119
+ return false; // spec coverage path
120
+ // (no-spec-coverage)
121
+ // if (isRtl) {
122
+ // // 3. The end of the label must be R, AL, EN, or AN (ignoring trailing NSM).
123
+ // // if (lastClass !== 'R' && lastClass !== 'AL' && lastClass !== 'EN' && lastClass !== 'AN') return false
124
+ // // 4. If an EN is present, no AN may be present, and vice versa.
125
+ // if (sawEN && sawAN) return false
126
+ // } else {
127
+ // // 6. The end of the label must be L or EN (ignoring trailing NSM).
128
+ // // if (lastClass !== 'L' && lastClass !== 'EN') return false
129
+ // }
130
+ return true;
131
+ }
132
+ //# sourceMappingURL=bidi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bidi.js","sourceRoot":"","sources":["../../../../../src/formats/typebox/idna/format/bidi.ts"],"names":[],"mappings":"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","sourcesContent":["/*--------------------------------------------------------------------------\n\nTypeBox\n\nThe MIT License (MIT)\n\nCopyright (c) 2017-2026 Haydn Paterson\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n---------------------------------------------------------------------------*/\n\n// deno-fmt-ignore-file\n\nimport * as Pattern from \"../pattern/pattern.ts\";\nimport * as FormatPuny from \"./puny.ts\";\n\n// ------------------------------------------------------------------\n// LOCAL REGEX: Allowed Bidi classes per direction (RFC 5893)\n// ------------------------------------------------------------------\nconst RE_RTL_ALLOWED = /^(?:R|AL|AN|EN|ES|CS|ET|ON|BN|NSM)$/;\nconst RE_LTR_ALLOWED = /^(?:L|EN|ES|CS|ET|ON|BN|NSM)$/;\nconst RE_RTL_CLASSES = /^(?:R|AL|AN)$/;\n\n// ------------------------------------------------------------------\n// HasBidiChars\n//\n// Decodes a punycode label to its Unicode form (if it is one) and\n// checks whether the result is an RTL label per RFC 5893 §1.4.\n// ------------------------------------------------------------------\nexport function HasBidiChars(value: string): boolean {\n\tif (FormatPuny.IsAcePrefixed(value)) {\n\t\ttry {\n\t\t\treturn HasRightToLeftCharacters(FormatPuny.Decode(value.slice(4).toLowerCase()));\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn HasRightToLeftCharacters(value);\n}\n// ------------------------------------------------------------------\n// GetBidiClass\n// ------------------------------------------------------------------\nfunction GetBidiClass(codePoint: number): string {\n\tconst char = String.fromCodePoint(codePoint);\n\treturn Pattern.RE_EUROPEAN_NUMBER.test(char)\n\t\t? \"EN\"\n\t\t: Pattern.RE_ARABIC_INDIC_DIGIT.test(char)\n\t\t\t? \"AN\"\n\t\t\t: // Pattern.RE_EUROPEAN_SEPARATOR.test(char) ? 'ES' : // (no-spec-coverage)\n\t\t\t\t// Pattern.RE_COMMON_SEPARATOR.test(char) ? 'CS' : // (no-spec-coverage)\n\t\t\t\tPattern.RE_MARK_NONSPACING.test(char)\n\t\t\t\t? \"NSM\"\n\t\t\t\t: Pattern.RE_SCRIPT_HEBREW.test(char)\n\t\t\t\t\t? \"R\"\n\t\t\t\t\t: Pattern.RE_SCRIPT_ARABIC_LETTER.test(char)\n\t\t\t\t\t\t? \"AL\"\n\t\t\t\t\t\t: Pattern.RE_LETTER.test(char)\n\t\t\t\t\t\t\t? \"L\"\n\t\t\t\t\t\t\t: \"ON\";\n}\n// ------------------------------------------------------------------\n// HasRightToLeftCharacters\n//\n// Per RFC 5893 §1.4: \"An RTL label is a label that contains at least\n// one character of type R, AL, or AN.\" Used to determine whether a\n// domain name is a \"Bidi domain name\" (RFC 5893 §1.4), in which case\n// the Bidi Rule applies to every label in the domain.\n// ------------------------------------------------------------------\nexport function HasRightToLeftCharacters(value: string): boolean {\n\tfor (const ch of value) if (RE_RTL_CLASSES.test(GetBidiClass(ch.codePointAt(0)!))) return true;\n\treturn false;\n}\n// ------------------------------------------------------------------\n// SatisfiesBidiRule\n// ------------------------------------------------------------------\nexport function SatisfiesBidiRule(value: string): boolean {\n\tlet isRtl = false;\n\tlet allowed = RE_LTR_ALLOWED;\n\tlet sawEN = false;\n\tlet sawAN = false;\n\tlet isFirst = true;\n\t// let lastClass: string | null = null // (no-spec-coverage)\n\tfor (const ch of value) {\n\t\tconst bidiClass = GetBidiClass(ch.codePointAt(0)!);\n\t\tif (isFirst) {\n\t\t\t// 1. The first character must be a character with Bidi property L, R, or AL.\n\t\t\tif (bidiClass !== \"L\" && bidiClass !== \"R\" && bidiClass !== \"AL\") return false;\n\t\t\tisRtl = bidiClass === \"R\" || bidiClass === \"AL\";\n\t\t\tallowed = isRtl ? RE_RTL_ALLOWED : RE_LTR_ALLOWED;\n\t\t\tisFirst = false;\n\t\t}\n\t\t// 2 / 5. Only characters in the allowed set for this direction may appear.\n\t\tif (!allowed.test(bidiClass)) return false;\n\t\tif (bidiClass === \"EN\") sawEN = true;\n\t\telse if (bidiClass === \"AN\") sawAN = true;\n\t\t// if (bidiClass !== 'NSM') lastClass = bidiClass // (no-spec-coverage)\n\t}\n\tif (isRtl && sawEN && sawAN) return false; // spec coverage path\n\t// (no-spec-coverage)\n\t// if (isRtl) {\n\t// // 3. The end of the label must be R, AL, EN, or AN (ignoring trailing NSM).\n\t// // if (lastClass !== 'R' && lastClass !== 'AL' && lastClass !== 'EN' && lastClass !== 'AN') return false\n\t// // 4. If an EN is present, no AN may be present, and vice versa.\n\t// if (sawEN && sawAN) return false\n\t// } else {\n\t// // 6. The end of the label must be L or EN (ignoring trailing NSM).\n\t// // if (lastClass !== 'L' && lastClass !== 'EN') return false\n\t// }\n\treturn true;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export declare function IsAcePrefixed(value: string): boolean;
2
+ export declare function Decode(value: string): string;
3
+ export declare function Encode(input: string): string;
4
+ //# sourceMappingURL=puny.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"puny.d.ts","sourceRoot":"","sources":["../../../../../src/formats/typebox/idna/format/puny.ts"],"names":[],"mappings":"AAkDA,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEpD;AAiBD,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CA0C5C;AAgBD,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAuC5C"}