liminal 0.1.0-beta.25

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 (519) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +26 -0
  3. package/esm/_dnt.shims.d.ts +2 -0
  4. package/esm/_dnt.shims.d.ts.map +1 -0
  5. package/esm/_dnt.shims.js +58 -0
  6. package/esm/_dnt.shims.js.map +1 -0
  7. package/esm/client/Adapter.d.ts +46 -0
  8. package/esm/client/Adapter.d.ts.map +1 -0
  9. package/esm/client/Adapter.js +2 -0
  10. package/esm/client/Adapter.js.map +1 -0
  11. package/esm/client/Liminal.d.ts +19 -0
  12. package/esm/client/Liminal.d.ts.map +1 -0
  13. package/esm/client/Liminal.js +154 -0
  14. package/esm/client/Liminal.js.map +1 -0
  15. package/esm/client/Tool.d.ts +15 -0
  16. package/esm/client/Tool.d.ts.map +1 -0
  17. package/esm/client/Tool.js +23 -0
  18. package/esm/client/Tool.js.map +1 -0
  19. package/esm/client/constants.d.ts +2 -0
  20. package/esm/client/constants.d.ts.map +1 -0
  21. package/esm/client/constants.js +7 -0
  22. package/esm/client/constants.js.map +1 -0
  23. package/esm/client/mod.d.ts +5 -0
  24. package/esm/client/mod.d.ts.map +1 -0
  25. package/esm/client/mod.js +6 -0
  26. package/esm/client/mod.js.map +1 -0
  27. package/esm/core/DescriptionContext.d.ts +11 -0
  28. package/esm/core/DescriptionContext.d.ts.map +1 -0
  29. package/esm/core/DescriptionContext.js +103 -0
  30. package/esm/core/DescriptionContext.js.map +1 -0
  31. package/esm/core/L.d.ts +4 -0
  32. package/esm/core/L.d.ts.map +1 -0
  33. package/esm/core/L.js +4 -0
  34. package/esm/core/L.js.map +1 -0
  35. package/esm/core/ReduceDependencies.d.ts +6 -0
  36. package/esm/core/ReduceDependencies.d.ts.map +1 -0
  37. package/esm/core/ReduceDependencies.js +2 -0
  38. package/esm/core/ReduceDependencies.js.map +1 -0
  39. package/esm/core/Type.d.ts +30 -0
  40. package/esm/core/Type.d.ts.map +1 -0
  41. package/esm/core/Type.js +2 -0
  42. package/esm/core/Type.js.map +1 -0
  43. package/esm/core/TypeVisitor.d.ts +15 -0
  44. package/esm/core/TypeVisitor.d.ts.map +1 -0
  45. package/esm/core/TypeVisitor.js +12 -0
  46. package/esm/core/TypeVisitor.js.map +1 -0
  47. package/esm/core/annotations/Annotation.d.ts +7 -0
  48. package/esm/core/annotations/Annotation.d.ts.map +1 -0
  49. package/esm/core/annotations/Annotation.js +2 -0
  50. package/esm/core/annotations/Annotation.js.map +1 -0
  51. package/esm/core/annotations/Assertion.d.ts +8 -0
  52. package/esm/core/annotations/Assertion.d.ts.map +1 -0
  53. package/esm/core/annotations/Assertion.js +8 -0
  54. package/esm/core/annotations/Assertion.js.map +1 -0
  55. package/esm/core/annotations/Description.d.ts +7 -0
  56. package/esm/core/annotations/Description.d.ts.map +1 -0
  57. package/esm/core/annotations/Description.js +8 -0
  58. package/esm/core/annotations/Description.js.map +1 -0
  59. package/esm/core/annotations/Param.d.ts +13 -0
  60. package/esm/core/annotations/Param.d.ts.map +1 -0
  61. package/esm/core/annotations/Param.js +11 -0
  62. package/esm/core/annotations/Param.js.map +1 -0
  63. package/esm/core/annotations/Template.d.ts +10 -0
  64. package/esm/core/annotations/Template.d.ts.map +1 -0
  65. package/esm/core/annotations/Template.js +2 -0
  66. package/esm/core/annotations/Template.js.map +1 -0
  67. package/esm/core/annotations/mod.d.ts +6 -0
  68. package/esm/core/annotations/mod.d.ts.map +1 -0
  69. package/esm/core/annotations/mod.js +7 -0
  70. package/esm/core/annotations/mod.js.map +1 -0
  71. package/esm/core/assert.d.ts +22 -0
  72. package/esm/core/assert.d.ts.map +1 -0
  73. package/esm/core/assert.js +155 -0
  74. package/esm/core/assert.js.map +1 -0
  75. package/esm/core/declareIntrinsic.d.ts +4 -0
  76. package/esm/core/declareIntrinsic.d.ts.map +1 -0
  77. package/esm/core/declareIntrinsic.js +26 -0
  78. package/esm/core/declareIntrinsic.js.map +1 -0
  79. package/esm/core/deserialize.d.ts +3 -0
  80. package/esm/core/deserialize.d.ts.map +1 -0
  81. package/esm/core/deserialize.js +32 -0
  82. package/esm/core/deserialize.js.map +1 -0
  83. package/esm/core/display.d.ts +3 -0
  84. package/esm/core/display.d.ts.map +1 -0
  85. package/esm/core/display.js +75 -0
  86. package/esm/core/display.js.map +1 -0
  87. package/esm/core/inspect.node.d.ts +5 -0
  88. package/esm/core/inspect.node.d.ts.map +1 -0
  89. package/esm/core/inspect.node.js +7 -0
  90. package/esm/core/inspect.node.js.map +1 -0
  91. package/esm/core/intrinsics.d.ts +19 -0
  92. package/esm/core/intrinsics.d.ts.map +1 -0
  93. package/esm/core/intrinsics.js +64 -0
  94. package/esm/core/intrinsics.js.map +1 -0
  95. package/esm/core/intrinsics_util.d.ts +6 -0
  96. package/esm/core/intrinsics_util.d.ts.map +1 -0
  97. package/esm/core/intrinsics_util.js +46 -0
  98. package/esm/core/intrinsics_util.js.map +1 -0
  99. package/esm/core/isType.d.ts +4 -0
  100. package/esm/core/isType.d.ts.map +1 -0
  101. package/esm/core/isType.js +18 -0
  102. package/esm/core/isType.js.map +1 -0
  103. package/esm/core/mod.d.ts +13 -0
  104. package/esm/core/mod.d.ts.map +1 -0
  105. package/esm/core/mod.js +14 -0
  106. package/esm/core/mod.js.map +1 -0
  107. package/esm/core/signature.d.ts +4 -0
  108. package/esm/core/signature.d.ts.map +1 -0
  109. package/esm/core/signature.js +93 -0
  110. package/esm/core/signature.js.map +1 -0
  111. package/esm/core/utility/Flatten.d.ts +8 -0
  112. package/esm/core/utility/Flatten.d.ts.map +1 -0
  113. package/esm/core/utility/Flatten.js +6 -0
  114. package/esm/core/utility/Flatten.js.map +1 -0
  115. package/esm/core/utility/Intersection.d.ts +12 -0
  116. package/esm/core/utility/Intersection.d.ts.map +1 -0
  117. package/esm/core/utility/Intersection.js +5 -0
  118. package/esm/core/utility/Intersection.js.map +1 -0
  119. package/esm/core/utility/Option.d.ts +3 -0
  120. package/esm/core/utility/Option.d.ts.map +1 -0
  121. package/esm/core/utility/Option.js +5 -0
  122. package/esm/core/utility/Option.js.map +1 -0
  123. package/esm/core/utility/Record.d.ts +3 -0
  124. package/esm/core/utility/Record.d.ts.map +1 -0
  125. package/esm/core/utility/Record.js +6 -0
  126. package/esm/core/utility/Record.js.map +1 -0
  127. package/esm/core/utility/Set.d.ts +4 -0
  128. package/esm/core/utility/Set.d.ts.map +1 -0
  129. package/esm/core/utility/Set.js +7 -0
  130. package/esm/core/utility/Set.js.map +1 -0
  131. package/esm/core/utility/TaggedUnion.d.ts +13 -0
  132. package/esm/core/utility/TaggedUnion.d.ts.map +1 -0
  133. package/esm/core/utility/TaggedUnion.js +8 -0
  134. package/esm/core/utility/TaggedUnion.js.map +1 -0
  135. package/esm/core/utility/Tuple.d.ts +9 -0
  136. package/esm/core/utility/Tuple.d.ts.map +1 -0
  137. package/esm/core/utility/Tuple.js +11 -0
  138. package/esm/core/utility/Tuple.js.map +1 -0
  139. package/esm/core/utility/mod.d.ts +8 -0
  140. package/esm/core/utility/mod.d.ts.map +1 -0
  141. package/esm/core/utility/mod.js +9 -0
  142. package/esm/core/utility/mod.js.map +1 -0
  143. package/esm/deps/jsr.io/@std/assert/1.0.10/almost_equals.d.ts +29 -0
  144. package/esm/deps/jsr.io/@std/assert/1.0.10/almost_equals.d.ts.map +1 -0
  145. package/esm/deps/jsr.io/@std/assert/1.0.10/almost_equals.js +47 -0
  146. package/esm/deps/jsr.io/@std/assert/1.0.10/almost_equals.js.map +1 -0
  147. package/esm/deps/jsr.io/@std/assert/1.0.10/array_includes.d.ts +24 -0
  148. package/esm/deps/jsr.io/@std/assert/1.0.10/array_includes.d.ts.map +1 -0
  149. package/esm/deps/jsr.io/@std/assert/1.0.10/array_includes.js +47 -0
  150. package/esm/deps/jsr.io/@std/assert/1.0.10/array_includes.js.map +1 -0
  151. package/esm/deps/jsr.io/@std/assert/1.0.10/assert.d.ts +16 -0
  152. package/esm/deps/jsr.io/@std/assert/1.0.10/assert.d.ts.map +1 -0
  153. package/esm/deps/jsr.io/@std/assert/1.0.10/assert.js +23 -0
  154. package/esm/deps/jsr.io/@std/assert/1.0.10/assert.js.map +1 -0
  155. package/esm/deps/jsr.io/@std/assert/1.0.10/assertion_error.d.ts +26 -0
  156. package/esm/deps/jsr.io/@std/assert/1.0.10/assertion_error.d.ts.map +1 -0
  157. package/esm/deps/jsr.io/@std/assert/1.0.10/assertion_error.js +31 -0
  158. package/esm/deps/jsr.io/@std/assert/1.0.10/assertion_error.js.map +1 -0
  159. package/esm/deps/jsr.io/@std/assert/1.0.10/equal.d.ts +17 -0
  160. package/esm/deps/jsr.io/@std/assert/1.0.10/equal.d.ts.map +1 -0
  161. package/esm/deps/jsr.io/@std/assert/1.0.10/equal.js +184 -0
  162. package/esm/deps/jsr.io/@std/assert/1.0.10/equal.js.map +1 -0
  163. package/esm/deps/jsr.io/@std/assert/1.0.10/equals.d.ts +35 -0
  164. package/esm/deps/jsr.io/@std/assert/1.0.10/equals.d.ts.map +1 -0
  165. package/esm/deps/jsr.io/@std/assert/1.0.10/equals.js +59 -0
  166. package/esm/deps/jsr.io/@std/assert/1.0.10/equals.js.map +1 -0
  167. package/esm/deps/jsr.io/@std/assert/1.0.10/exists.d.ts +18 -0
  168. package/esm/deps/jsr.io/@std/assert/1.0.10/exists.d.ts.map +1 -0
  169. package/esm/deps/jsr.io/@std/assert/1.0.10/exists.js +28 -0
  170. package/esm/deps/jsr.io/@std/assert/1.0.10/exists.js.map +1 -0
  171. package/esm/deps/jsr.io/@std/assert/1.0.10/fail.d.ts +15 -0
  172. package/esm/deps/jsr.io/@std/assert/1.0.10/fail.d.ts.map +1 -0
  173. package/esm/deps/jsr.io/@std/assert/1.0.10/fail.js +21 -0
  174. package/esm/deps/jsr.io/@std/assert/1.0.10/fail.js.map +1 -0
  175. package/esm/deps/jsr.io/@std/assert/1.0.10/false.d.ts +18 -0
  176. package/esm/deps/jsr.io/@std/assert/1.0.10/false.d.ts.map +1 -0
  177. package/esm/deps/jsr.io/@std/assert/1.0.10/false.js +23 -0
  178. package/esm/deps/jsr.io/@std/assert/1.0.10/false.js.map +1 -0
  179. package/esm/deps/jsr.io/@std/assert/1.0.10/greater.d.ts +20 -0
  180. package/esm/deps/jsr.io/@std/assert/1.0.10/greater.d.ts.map +1 -0
  181. package/esm/deps/jsr.io/@std/assert/1.0.10/greater.js +30 -0
  182. package/esm/deps/jsr.io/@std/assert/1.0.10/greater.js.map +1 -0
  183. package/esm/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.d.ts +20 -0
  184. package/esm/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.d.ts.map +1 -0
  185. package/esm/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.js +30 -0
  186. package/esm/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.js.map +1 -0
  187. package/esm/deps/jsr.io/@std/assert/1.0.10/instance_of.d.ts +23 -0
  188. package/esm/deps/jsr.io/@std/assert/1.0.10/instance_of.d.ts.map +1 -0
  189. package/esm/deps/jsr.io/@std/assert/1.0.10/instance_of.js +53 -0
  190. package/esm/deps/jsr.io/@std/assert/1.0.10/instance_of.js.map +1 -0
  191. package/esm/deps/jsr.io/@std/assert/1.0.10/is_error.d.ts +25 -0
  192. package/esm/deps/jsr.io/@std/assert/1.0.10/is_error.d.ts.map +1 -0
  193. package/esm/deps/jsr.io/@std/assert/1.0.10/is_error.js +54 -0
  194. package/esm/deps/jsr.io/@std/assert/1.0.10/is_error.js.map +1 -0
  195. package/esm/deps/jsr.io/@std/assert/1.0.10/less.d.ts +19 -0
  196. package/esm/deps/jsr.io/@std/assert/1.0.10/less.d.ts.map +1 -0
  197. package/esm/deps/jsr.io/@std/assert/1.0.10/less.js +29 -0
  198. package/esm/deps/jsr.io/@std/assert/1.0.10/less.js.map +1 -0
  199. package/esm/deps/jsr.io/@std/assert/1.0.10/less_or_equal.d.ts +20 -0
  200. package/esm/deps/jsr.io/@std/assert/1.0.10/less_or_equal.d.ts.map +1 -0
  201. package/esm/deps/jsr.io/@std/assert/1.0.10/less_or_equal.js +30 -0
  202. package/esm/deps/jsr.io/@std/assert/1.0.10/less_or_equal.js.map +1 -0
  203. package/esm/deps/jsr.io/@std/assert/1.0.10/match.d.ts +18 -0
  204. package/esm/deps/jsr.io/@std/assert/1.0.10/match.d.ts.map +1 -0
  205. package/esm/deps/jsr.io/@std/assert/1.0.10/match.js +27 -0
  206. package/esm/deps/jsr.io/@std/assert/1.0.10/match.js.map +1 -0
  207. package/esm/deps/jsr.io/@std/assert/1.0.10/mod.d.ts +44 -0
  208. package/esm/deps/jsr.io/@std/assert/1.0.10/mod.d.ts.map +1 -0
  209. package/esm/deps/jsr.io/@std/assert/1.0.10/mod.js +46 -0
  210. package/esm/deps/jsr.io/@std/assert/1.0.10/mod.js.map +1 -0
  211. package/esm/deps/jsr.io/@std/assert/1.0.10/not_equals.d.ts +21 -0
  212. package/esm/deps/jsr.io/@std/assert/1.0.10/not_equals.d.ts.map +1 -0
  213. package/esm/deps/jsr.io/@std/assert/1.0.10/not_equals.js +34 -0
  214. package/esm/deps/jsr.io/@std/assert/1.0.10/not_equals.js.map +1 -0
  215. package/esm/deps/jsr.io/@std/assert/1.0.10/not_instance_of.d.ts +20 -0
  216. package/esm/deps/jsr.io/@std/assert/1.0.10/not_instance_of.d.ts.map +1 -0
  217. package/esm/deps/jsr.io/@std/assert/1.0.10/not_instance_of.js +30 -0
  218. package/esm/deps/jsr.io/@std/assert/1.0.10/not_instance_of.js.map +1 -0
  219. package/esm/deps/jsr.io/@std/assert/1.0.10/not_match.d.ts +18 -0
  220. package/esm/deps/jsr.io/@std/assert/1.0.10/not_match.d.ts.map +1 -0
  221. package/esm/deps/jsr.io/@std/assert/1.0.10/not_match.js +27 -0
  222. package/esm/deps/jsr.io/@std/assert/1.0.10/not_match.js.map +1 -0
  223. package/esm/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.d.ts +23 -0
  224. package/esm/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.d.ts.map +1 -0
  225. package/esm/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.js +33 -0
  226. package/esm/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.js.map +1 -0
  227. package/esm/deps/jsr.io/@std/assert/1.0.10/object_match.d.ts +29 -0
  228. package/esm/deps/jsr.io/@std/assert/1.0.10/object_match.d.ts.map +1 -0
  229. package/esm/deps/jsr.io/@std/assert/1.0.10/object_match.js +161 -0
  230. package/esm/deps/jsr.io/@std/assert/1.0.10/object_match.js.map +1 -0
  231. package/esm/deps/jsr.io/@std/assert/1.0.10/rejects.d.ts +42 -0
  232. package/esm/deps/jsr.io/@std/assert/1.0.10/rejects.d.ts.map +1 -0
  233. package/esm/deps/jsr.io/@std/assert/1.0.10/rejects.js +54 -0
  234. package/esm/deps/jsr.io/@std/assert/1.0.10/rejects.js.map +1 -0
  235. package/esm/deps/jsr.io/@std/assert/1.0.10/strict_equals.d.ts +24 -0
  236. package/esm/deps/jsr.io/@std/assert/1.0.10/strict_equals.d.ts.map +1 -0
  237. package/esm/deps/jsr.io/@std/assert/1.0.10/strict_equals.js +58 -0
  238. package/esm/deps/jsr.io/@std/assert/1.0.10/strict_equals.js.map +1 -0
  239. package/esm/deps/jsr.io/@std/assert/1.0.10/string_includes.d.ts +18 -0
  240. package/esm/deps/jsr.io/@std/assert/1.0.10/string_includes.d.ts.map +1 -0
  241. package/esm/deps/jsr.io/@std/assert/1.0.10/string_includes.js +27 -0
  242. package/esm/deps/jsr.io/@std/assert/1.0.10/string_includes.js.map +1 -0
  243. package/esm/deps/jsr.io/@std/assert/1.0.10/throws.d.ts +45 -0
  244. package/esm/deps/jsr.io/@std/assert/1.0.10/throws.d.ts.map +1 -0
  245. package/esm/deps/jsr.io/@std/assert/1.0.10/throws.js +45 -0
  246. package/esm/deps/jsr.io/@std/assert/1.0.10/throws.js.map +1 -0
  247. package/esm/deps/jsr.io/@std/assert/1.0.10/unimplemented.d.ts +15 -0
  248. package/esm/deps/jsr.io/@std/assert/1.0.10/unimplemented.d.ts.map +1 -0
  249. package/esm/deps/jsr.io/@std/assert/1.0.10/unimplemented.js +21 -0
  250. package/esm/deps/jsr.io/@std/assert/1.0.10/unimplemented.js.map +1 -0
  251. package/esm/deps/jsr.io/@std/assert/1.0.10/unreachable.d.ts +15 -0
  252. package/esm/deps/jsr.io/@std/assert/1.0.10/unreachable.d.ts.map +1 -0
  253. package/esm/deps/jsr.io/@std/assert/1.0.10/unreachable.js +21 -0
  254. package/esm/deps/jsr.io/@std/assert/1.0.10/unreachable.js.map +1 -0
  255. package/esm/deps/jsr.io/@std/encoding/1.0.6/_base32_common.d.ts +17 -0
  256. package/esm/deps/jsr.io/@std/encoding/1.0.6/_base32_common.d.ts.map +1 -0
  257. package/esm/deps/jsr.io/@std/encoding/1.0.6/_base32_common.js +184 -0
  258. package/esm/deps/jsr.io/@std/encoding/1.0.6/_base32_common.js.map +1 -0
  259. package/esm/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.d.ts +2 -0
  260. package/esm/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.d.ts.map +1 -0
  261. package/esm/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.js +27 -0
  262. package/esm/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.js.map +1 -0
  263. package/esm/deps/jsr.io/@std/encoding/1.0.6/ascii85.d.ts +59 -0
  264. package/esm/deps/jsr.io/@std/encoding/1.0.6/ascii85.d.ts.map +1 -0
  265. package/esm/deps/jsr.io/@std/encoding/1.0.6/ascii85.js +153 -0
  266. package/esm/deps/jsr.io/@std/encoding/1.0.6/ascii85.js.map +1 -0
  267. package/esm/deps/jsr.io/@std/encoding/1.0.6/base32.d.ts +38 -0
  268. package/esm/deps/jsr.io/@std/encoding/1.0.6/base32.d.ts.map +1 -0
  269. package/esm/deps/jsr.io/@std/encoding/1.0.6/base32.js +70 -0
  270. package/esm/deps/jsr.io/@std/encoding/1.0.6/base32.js.map +1 -0
  271. package/esm/deps/jsr.io/@std/encoding/1.0.6/base58.d.ts +38 -0
  272. package/esm/deps/jsr.io/@std/encoding/1.0.6/base58.d.ts.map +1 -0
  273. package/esm/deps/jsr.io/@std/encoding/1.0.6/base58.js +132 -0
  274. package/esm/deps/jsr.io/@std/encoding/1.0.6/base58.js.map +1 -0
  275. package/esm/deps/jsr.io/@std/encoding/1.0.6/base64.d.ts +38 -0
  276. package/esm/deps/jsr.io/@std/encoding/1.0.6/base64.d.ts.map +1 -0
  277. package/esm/deps/jsr.io/@std/encoding/1.0.6/base64.js +164 -0
  278. package/esm/deps/jsr.io/@std/encoding/1.0.6/base64.js.map +1 -0
  279. package/esm/deps/jsr.io/@std/encoding/1.0.6/base64url.d.ts +38 -0
  280. package/esm/deps/jsr.io/@std/encoding/1.0.6/base64url.d.ts.map +1 -0
  281. package/esm/deps/jsr.io/@std/encoding/1.0.6/base64url.js +82 -0
  282. package/esm/deps/jsr.io/@std/encoding/1.0.6/base64url.js.map +1 -0
  283. package/esm/deps/jsr.io/@std/encoding/1.0.6/hex.d.ts +37 -0
  284. package/esm/deps/jsr.io/@std/encoding/1.0.6/hex.d.ts.map +1 -0
  285. package/esm/deps/jsr.io/@std/encoding/1.0.6/hex.js +110 -0
  286. package/esm/deps/jsr.io/@std/encoding/1.0.6/hex.js.map +1 -0
  287. package/esm/deps/jsr.io/@std/encoding/1.0.6/mod.d.ts +22 -0
  288. package/esm/deps/jsr.io/@std/encoding/1.0.6/mod.d.ts.map +1 -0
  289. package/esm/deps/jsr.io/@std/encoding/1.0.6/mod.js +23 -0
  290. package/esm/deps/jsr.io/@std/encoding/1.0.6/mod.js.map +1 -0
  291. package/esm/deps/jsr.io/@std/encoding/1.0.6/varint.d.ts +118 -0
  292. package/esm/deps/jsr.io/@std/encoding/1.0.6/varint.d.ts.map +1 -0
  293. package/esm/deps/jsr.io/@std/encoding/1.0.6/varint.js +208 -0
  294. package/esm/deps/jsr.io/@std/encoding/1.0.6/varint.js.map +1 -0
  295. package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts +82 -0
  296. package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts.map +1 -0
  297. package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.js +111 -0
  298. package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.js.map +1 -0
  299. package/esm/deps/jsr.io/@std/internal/1.0.5/diff.d.ts +140 -0
  300. package/esm/deps/jsr.io/@std/internal/1.0.5/diff.d.ts.map +1 -0
  301. package/esm/deps/jsr.io/@std/internal/1.0.5/diff.js +277 -0
  302. package/esm/deps/jsr.io/@std/internal/1.0.5/diff.js.map +1 -0
  303. package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts +99 -0
  304. package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts.map +1 -0
  305. package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.js +180 -0
  306. package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.js.map +1 -0
  307. package/esm/deps/jsr.io/@std/internal/1.0.5/format.d.ts +2 -0
  308. package/esm/deps/jsr.io/@std/internal/1.0.5/format.d.ts.map +1 -0
  309. package/esm/deps/jsr.io/@std/internal/1.0.5/format.js +38 -0
  310. package/esm/deps/jsr.io/@std/internal/1.0.5/format.js.map +1 -0
  311. package/esm/deps/jsr.io/@std/internal/1.0.5/styles.d.ts +159 -0
  312. package/esm/deps/jsr.io/@std/internal/1.0.5/styles.d.ts.map +1 -0
  313. package/esm/deps/jsr.io/@std/internal/1.0.5/styles.js +208 -0
  314. package/esm/deps/jsr.io/@std/internal/1.0.5/styles.js.map +1 -0
  315. package/esm/deps/jsr.io/@std/internal/1.0.5/types.d.ts +16 -0
  316. package/esm/deps/jsr.io/@std/internal/1.0.5/types.d.ts.map +1 -0
  317. package/esm/deps/jsr.io/@std/internal/1.0.5/types.js +3 -0
  318. package/esm/deps/jsr.io/@std/internal/1.0.5/types.js.map +1 -0
  319. package/esm/json_schema/Hydrated.d.ts +4 -0
  320. package/esm/json_schema/Hydrated.d.ts.map +1 -0
  321. package/esm/json_schema/Hydrated.js +49 -0
  322. package/esm/json_schema/Hydrated.js.map +1 -0
  323. package/esm/json_schema/JSONSchema.d.ts +50 -0
  324. package/esm/json_schema/JSONSchema.d.ts.map +1 -0
  325. package/esm/json_schema/JSONSchema.js +46 -0
  326. package/esm/json_schema/JSONSchema.js.map +1 -0
  327. package/esm/json_schema/MetaType.d.ts +4 -0
  328. package/esm/json_schema/MetaType.d.ts.map +1 -0
  329. package/esm/json_schema/MetaType.js +25 -0
  330. package/esm/json_schema/MetaType.js.map +1 -0
  331. package/esm/json_schema/MetaTypeMigration.d.ts +19 -0
  332. package/esm/json_schema/MetaTypeMigration.d.ts.map +1 -0
  333. package/esm/json_schema/MetaTypeMigration.js +15 -0
  334. package/esm/json_schema/MetaTypeMigration.js.map +1 -0
  335. package/esm/json_schema/PathLike.d.ts +4 -0
  336. package/esm/json_schema/PathLike.d.ts.map +1 -0
  337. package/esm/json_schema/PathLike.js +3 -0
  338. package/esm/json_schema/PathLike.js.map +1 -0
  339. package/esm/json_schema/mod.d.ts +7 -0
  340. package/esm/json_schema/mod.d.ts.map +1 -0
  341. package/esm/json_schema/mod.js +8 -0
  342. package/esm/json_schema/mod.js.map +1 -0
  343. package/esm/json_schema/toJSONSchema.d.ts +4 -0
  344. package/esm/json_schema/toJSONSchema.d.ts.map +1 -0
  345. package/esm/json_schema/toJSONSchema.js +117 -0
  346. package/esm/json_schema/toJSONSchema.js.map +1 -0
  347. package/esm/mod.d.ts +4 -0
  348. package/esm/mod.d.ts.map +1 -0
  349. package/esm/mod.js +4 -0
  350. package/esm/mod.js.map +1 -0
  351. package/esm/package.json +3 -0
  352. package/esm/providers/OpenAI/OpenAIAdapter.d.ts +17 -0
  353. package/esm/providers/OpenAI/OpenAIAdapter.d.ts.map +1 -0
  354. package/esm/providers/OpenAI/OpenAIAdapter.js +56 -0
  355. package/esm/providers/OpenAI/OpenAIAdapter.js.map +1 -0
  356. package/esm/providers/OpenAI/OpenAIResponseFormat.d.ts +18 -0
  357. package/esm/providers/OpenAI/OpenAIResponseFormat.d.ts.map +1 -0
  358. package/esm/providers/OpenAI/OpenAIResponseFormat.js +26 -0
  359. package/esm/providers/OpenAI/OpenAIResponseFormat.js.map +1 -0
  360. package/esm/providers/OpenAI/TokenAllowance.d.ts +17 -0
  361. package/esm/providers/OpenAI/TokenAllowance.d.ts.map +1 -0
  362. package/esm/providers/OpenAI/TokenAllowance.js +32 -0
  363. package/esm/providers/OpenAI/TokenAllowance.js.map +1 -0
  364. package/esm/providers/OpenAI/mod.d.ts +6 -0
  365. package/esm/providers/OpenAI/mod.d.ts.map +1 -0
  366. package/esm/providers/OpenAI/mod.js +7 -0
  367. package/esm/providers/OpenAI/mod.js.map +1 -0
  368. package/esm/providers/OpenAI/openai_util.d.ts +4 -0
  369. package/esm/providers/OpenAI/openai_util.d.ts.map +1 -0
  370. package/esm/providers/OpenAI/openai_util.js +14 -0
  371. package/esm/providers/OpenAI/openai_util.js.map +1 -0
  372. package/esm/providers/OpenAI/refine.d.ts +2 -0
  373. package/esm/providers/OpenAI/refine.d.ts.map +1 -0
  374. package/esm/providers/OpenAI/refine.js +166 -0
  375. package/esm/providers/OpenAI/refine.js.map +1 -0
  376. package/esm/util/ArrayOfLength.d.ts +2 -0
  377. package/esm/util/ArrayOfLength.d.ts.map +1 -0
  378. package/esm/util/ArrayOfLength.js +2 -0
  379. package/esm/util/ArrayOfLength.js.map +1 -0
  380. package/esm/util/PromiseOr.d.ts +2 -0
  381. package/esm/util/PromiseOr.d.ts.map +1 -0
  382. package/esm/util/PromiseOr.js +2 -0
  383. package/esm/util/PromiseOr.js.map +1 -0
  384. package/esm/util/WeakMemo.d.ts +7 -0
  385. package/esm/util/WeakMemo.d.ts.map +1 -0
  386. package/esm/util/WeakMemo.js +32 -0
  387. package/esm/util/WeakMemo.js.map +1 -0
  388. package/esm/util/collect.d.ts +2 -0
  389. package/esm/util/collect.d.ts.map +1 -0
  390. package/esm/util/collect.js +8 -0
  391. package/esm/util/collect.js.map +1 -0
  392. package/esm/util/isPromise.d.ts +2 -0
  393. package/esm/util/isPromise.d.ts.map +1 -0
  394. package/esm/util/isPromise.js +7 -0
  395. package/esm/util/isPromise.js.map +1 -0
  396. package/esm/util/isTemplateStringsArray.d.ts +2 -0
  397. package/esm/util/isTemplateStringsArray.d.ts.map +1 -0
  398. package/esm/util/isTemplateStringsArray.js +4 -0
  399. package/esm/util/isTemplateStringsArray.js.map +1 -0
  400. package/esm/util/mod.d.ts +10 -0
  401. package/esm/util/mod.d.ts.map +1 -0
  402. package/esm/util/mod.js +11 -0
  403. package/esm/util/mod.js.map +1 -0
  404. package/esm/util/recombine.d.ts +2 -0
  405. package/esm/util/recombine.d.ts.map +1 -0
  406. package/esm/util/recombine.js +11 -0
  407. package/esm/util/recombine.js.map +1 -0
  408. package/esm/util/splitLast.d.ts +2 -0
  409. package/esm/util/splitLast.d.ts.map +1 -0
  410. package/esm/util/splitLast.js +8 -0
  411. package/esm/util/splitLast.js.map +1 -0
  412. package/esm/util/type_util.d.ts +5 -0
  413. package/esm/util/type_util.d.ts.map +1 -0
  414. package/esm/util/type_util.js +2 -0
  415. package/esm/util/type_util.js.map +1 -0
  416. package/package.json +22 -0
  417. package/src/_dnt.shims.ts +60 -0
  418. package/src/client/Adapter.ts +50 -0
  419. package/src/client/Liminal.ts +113 -0
  420. package/src/client/Tool.ts +17 -0
  421. package/src/client/constants.ts +6 -0
  422. package/src/client/mod.ts +6 -0
  423. package/src/core/DescriptionContext.ts +89 -0
  424. package/src/core/L.ts +3 -0
  425. package/src/core/ReduceDependencies.ts +9 -0
  426. package/src/core/Type.ts +45 -0
  427. package/src/core/TypeVisitor.ts +44 -0
  428. package/src/core/annotations/Annotation.ts +14 -0
  429. package/src/core/annotations/Assertion.ts +18 -0
  430. package/src/core/annotations/Description.ts +16 -0
  431. package/src/core/annotations/Param.ts +30 -0
  432. package/src/core/annotations/Template.ts +11 -0
  433. package/src/core/annotations/mod.ts +7 -0
  434. package/src/core/assert.ts +145 -0
  435. package/src/core/declareIntrinsic.ts +45 -0
  436. package/src/core/deserialize.ts +36 -0
  437. package/src/core/display.ts +68 -0
  438. package/src/core/inspect.node.ts +13 -0
  439. package/src/core/intrinsics.ts +86 -0
  440. package/src/core/intrinsics_util.ts +50 -0
  441. package/src/core/isType.ts +20 -0
  442. package/src/core/mod.ts +15 -0
  443. package/src/core/signature.ts +90 -0
  444. package/src/core/utility/Flatten.ts +14 -0
  445. package/src/core/utility/Intersection.ts +24 -0
  446. package/src/core/utility/Option.ts +6 -0
  447. package/src/core/utility/Record.ts +7 -0
  448. package/src/core/utility/Set.ts +8 -0
  449. package/src/core/utility/TaggedUnion.ts +23 -0
  450. package/src/core/utility/Tuple.ts +24 -0
  451. package/src/core/utility/mod.ts +9 -0
  452. package/src/deps/jsr.io/@std/assert/1.0.10/almost_equals.ts +55 -0
  453. package/src/deps/jsr.io/@std/assert/1.0.10/array_includes.ts +57 -0
  454. package/src/deps/jsr.io/@std/assert/1.0.10/assert.ts +23 -0
  455. package/src/deps/jsr.io/@std/assert/1.0.10/assertion_error.ts +31 -0
  456. package/src/deps/jsr.io/@std/assert/1.0.10/equal.ts +210 -0
  457. package/src/deps/jsr.io/@std/assert/1.0.10/equals.ts +65 -0
  458. package/src/deps/jsr.io/@std/assert/1.0.10/exists.ts +31 -0
  459. package/src/deps/jsr.io/@std/assert/1.0.10/fail.ts +21 -0
  460. package/src/deps/jsr.io/@std/assert/1.0.10/false.ts +26 -0
  461. package/src/deps/jsr.io/@std/assert/1.0.10/greater.ts +30 -0
  462. package/src/deps/jsr.io/@std/assert/1.0.10/greater_or_equal.ts +36 -0
  463. package/src/deps/jsr.io/@std/assert/1.0.10/instance_of.ts +64 -0
  464. package/src/deps/jsr.io/@std/assert/1.0.10/is_error.ts +65 -0
  465. package/src/deps/jsr.io/@std/assert/1.0.10/less.ts +29 -0
  466. package/src/deps/jsr.io/@std/assert/1.0.10/less_or_equal.ts +36 -0
  467. package/src/deps/jsr.io/@std/assert/1.0.10/match.ts +30 -0
  468. package/src/deps/jsr.io/@std/assert/1.0.10/mod.ts +47 -0
  469. package/src/deps/jsr.io/@std/assert/1.0.10/not_equals.ts +37 -0
  470. package/src/deps/jsr.io/@std/assert/1.0.10/not_instance_of.ts +33 -0
  471. package/src/deps/jsr.io/@std/assert/1.0.10/not_match.ts +30 -0
  472. package/src/deps/jsr.io/@std/assert/1.0.10/not_strict_equals.ts +42 -0
  473. package/src/deps/jsr.io/@std/assert/1.0.10/object_match.ts +203 -0
  474. package/src/deps/jsr.io/@std/assert/1.0.10/rejects.ts +123 -0
  475. package/src/deps/jsr.io/@std/assert/1.0.10/strict_equals.ts +67 -0
  476. package/src/deps/jsr.io/@std/assert/1.0.10/string_includes.ts +30 -0
  477. package/src/deps/jsr.io/@std/assert/1.0.10/throws.ts +111 -0
  478. package/src/deps/jsr.io/@std/assert/1.0.10/unimplemented.ts +21 -0
  479. package/src/deps/jsr.io/@std/assert/1.0.10/unreachable.ts +21 -0
  480. package/src/deps/jsr.io/@std/encoding/1.0.6/_base32_common.ts +218 -0
  481. package/src/deps/jsr.io/@std/encoding/1.0.6/_validate_binary_like.ts +29 -0
  482. package/src/deps/jsr.io/@std/encoding/1.0.6/ascii85.ts +203 -0
  483. package/src/deps/jsr.io/@std/encoding/1.0.6/base32.ts +73 -0
  484. package/src/deps/jsr.io/@std/encoding/1.0.6/base58.ts +173 -0
  485. package/src/deps/jsr.io/@std/encoding/1.0.6/base64.ts +174 -0
  486. package/src/deps/jsr.io/@std/encoding/1.0.6/base64url.ts +88 -0
  487. package/src/deps/jsr.io/@std/encoding/1.0.6/hex.ts +120 -0
  488. package/src/deps/jsr.io/@std/encoding/1.0.6/mod.ts +24 -0
  489. package/src/deps/jsr.io/@std/encoding/1.0.6/varint.ts +242 -0
  490. package/src/deps/jsr.io/@std/internal/1.0.5/build_message.ts +134 -0
  491. package/src/deps/jsr.io/@std/internal/1.0.5/diff.ts +317 -0
  492. package/src/deps/jsr.io/@std/internal/1.0.5/diff_str.ts +204 -0
  493. package/src/deps/jsr.io/@std/internal/1.0.5/format.ts +39 -0
  494. package/src/deps/jsr.io/@std/internal/1.0.5/styles.ts +233 -0
  495. package/src/deps/jsr.io/@std/internal/1.0.5/types.ts +18 -0
  496. package/src/json_schema/Hydrated.ts +52 -0
  497. package/src/json_schema/JSONSchema.ts +95 -0
  498. package/src/json_schema/MetaType.ts +32 -0
  499. package/src/json_schema/MetaTypeMigration.ts +31 -0
  500. package/src/json_schema/PathLike.ts +9 -0
  501. package/src/json_schema/mod.ts +8 -0
  502. package/src/json_schema/toJSONSchema.ts +114 -0
  503. package/src/mod.ts +3 -0
  504. package/src/providers/OpenAI/OpenAIAdapter.ts +89 -0
  505. package/src/providers/OpenAI/OpenAIResponseFormat.ts +54 -0
  506. package/src/providers/OpenAI/TokenAllowance.ts +29 -0
  507. package/src/providers/OpenAI/mod.ts +7 -0
  508. package/src/providers/OpenAI/openai_util.ts +19 -0
  509. package/src/providers/OpenAI/refine.ts +171 -0
  510. package/src/util/ArrayOfLength.ts +5 -0
  511. package/src/util/PromiseOr.ts +1 -0
  512. package/src/util/WeakMemo.ts +13 -0
  513. package/src/util/collect.ts +7 -0
  514. package/src/util/isPromise.ts +8 -0
  515. package/src/util/isTemplateStringsArray.ts +3 -0
  516. package/src/util/mod.ts +11 -0
  517. package/src/util/recombine.ts +10 -0
  518. package/src/util/splitLast.ts +7 -0
  519. package/src/util/type_util.ts +3 -0
@@ -0,0 +1,208 @@
1
+ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
2
+ // Copyright 2020 Keith Cirkel. All rights reserved. MIT license.
3
+ // Copyright 2023 Skye "MierenManz". All rights reserved. MIT license.
4
+ /**
5
+ * Utilities for {@link https://protobuf.dev/programming-guides/encoding/#varints Varint} encoding
6
+ * of typed integers. Varint encoding represents integers using a variable number of bytes, with
7
+ * smaller values requiring fewer bytes.
8
+ *
9
+ * ```ts
10
+ * import { encodeVarint, decodeVarint } from "@std/encoding/varint";
11
+ * import { assertEquals } from "@std/assert";
12
+ *
13
+ * const buf = new Uint8Array(10);
14
+ * assertEquals(
15
+ * encodeVarint(42n, buf),
16
+ * [new Uint8Array([42]), 1]
17
+ * );
18
+ *
19
+ * assertEquals(
20
+ * decodeVarint(new Uint8Array([42])),
21
+ * [ 42n, 1 ]
22
+ * );
23
+ * ```
24
+ *
25
+ * @module
26
+ */
27
+ // This implementation is a port of https://deno.land/x/varint@v2.0.0 by @keithamus
28
+ // This module is browser compatible.
29
+ /**
30
+ * The maximum value of an unsigned 64-bit integer.
31
+ * Equivalent to `2n**64n - 1n`
32
+ */
33
+ export const MaxUint64 = 18446744073709551615n;
34
+ /**
35
+ * The maximum length, in bytes, of a Varint encoded 64-bit integer.
36
+ */
37
+ export const MaxVarintLen64 = 10;
38
+ /**
39
+ * The maximum length, in bytes, of a Varint encoded 32-bit integer.
40
+ */
41
+ export const MaxVarintLen32 = 5;
42
+ const MSB = 0x80;
43
+ const REST = 0x7f;
44
+ const SHIFT = 7;
45
+ const MSBN = 0x80n;
46
+ const SHIFTN = 7n;
47
+ // ArrayBuffer and TypedArray's for "pointer casting"
48
+ const AB = new ArrayBuffer(8);
49
+ const U32_VIEW = new Uint32Array(AB);
50
+ const U64_VIEW = new BigUint64Array(AB);
51
+ /**
52
+ * Given a non empty `buf`, starting at `offset` (default: 0), begin decoding bytes as
53
+ * Varint encoded bytes, for a maximum of 10 bytes (offset + 10). The returned
54
+ * tuple is of the decoded varint 32-bit number, and the new offset with which
55
+ * to continue decoding other data.
56
+ *
57
+ * If a `bigint` in return is undesired, the `decode32` function will return a
58
+ * `number`, but this should only be used in cases where the varint is
59
+ * _assured_ to be 32-bits. If in doubt, use `decode()`.
60
+ *
61
+ * To know how many bytes the Varint took to encode, simply negate `offset`
62
+ * from the returned new `offset`.
63
+ *
64
+ * @param buf The buffer to decode from.
65
+ * @param offset The offset to start decoding from.
66
+ * @returns A tuple of the decoded varint 64-bit number, and the new offset.
67
+ *
68
+ * @example Usage
69
+ * ```ts
70
+ * import { decodeVarint } from "@std/encoding/varint";
71
+ * import { assertEquals } from "@std/assert";
72
+ *
73
+ * const buf = new Uint8Array([0x8E, 0x02]);
74
+ * assertEquals(decodeVarint(buf), [270n, 2]);
75
+ * ```
76
+ */
77
+ export function decodeVarint(buf, offset = 0) {
78
+ // Clear the last result from the Two's complement view
79
+ U64_VIEW[0] = 0n;
80
+ // Setup the initiat state of the function
81
+ let intermediate = 0;
82
+ let position = 0;
83
+ let i = offset;
84
+ // If the buffer is empty Throw
85
+ if (buf.length === 0)
86
+ throw new RangeError("Cannot read empty buffer");
87
+ let byte;
88
+ do {
89
+ // Get a single byte from the buffer
90
+ byte = buf[i];
91
+ // 1. Take the lower 7 bits of the byte.
92
+ // 2. Shift the bits into the correct position.
93
+ // 3. Bitwise OR it with the intermediate value
94
+ // QUIRK: in the 5th (and 10th) iteration of this loop it will overflow on the shift.
95
+ // This causes only the lower 4 bits to be shifted into place and removing the upper 3 bits
96
+ intermediate |= (byte & 0b01111111) << position;
97
+ // If position is 28
98
+ // it means that this iteration needs to be written the the two's complement view
99
+ // This only happens once due to the `-4` in this branch
100
+ if (position === 28) {
101
+ // Write to the view
102
+ U32_VIEW[0] = intermediate;
103
+ // set `intermediate` to the remaining 3 bits
104
+ // We only want the remaining three bits because the other 4 have been "consumed" on line 21
105
+ intermediate = (byte & 0b01110000) >>> 4;
106
+ // set `position` to -4 because later 7 will be added, making it 3
107
+ position = -4;
108
+ }
109
+ // Increment the shift position by 7
110
+ position += 7;
111
+ // Increment the iterator by 1
112
+ i++;
113
+ // Keep going while there is a continuation bit
114
+ } while ((byte & 0b10000000) === 0b10000000);
115
+ // subtract the initial offset from `i` to get the bytes read
116
+ const nRead = i - offset;
117
+ // If 10 bytes have been read and intermediate has overflown
118
+ // it means that the varint is malformed
119
+ // If 11 bytes have been read it means that the varint is malformed
120
+ // If `i` is bigger than the buffer it means we overread the buffer and the varint is malformed
121
+ if ((nRead === 10 && intermediate > -1) || nRead === 11 || i > buf.length) {
122
+ throw new RangeError("Cannot decode the varint input: Malformed or overflow varint");
123
+ }
124
+ // Write the intermediate value to the "empty" slot
125
+ // if the first slot is taken. Take the second slot
126
+ U32_VIEW[Number(nRead > 4)] = intermediate;
127
+ return [U64_VIEW[0], i];
128
+ }
129
+ /**
130
+ * Given a `buf`, starting at `offset` (default: 0), begin decoding bytes as
131
+ * Varint encoded bytes, for a maximum of 5 bytes (offset + 5). The returned
132
+ * tuple is of the decoded varint 32-bit number, and the new offset with which
133
+ * to continue decoding other data.
134
+ *
135
+ * Varints are _not 32-bit by default_ so this should only be used in cases
136
+ * where the varint is _assured_ to be 32-bits. If in doubt, use `decode()`.
137
+ *
138
+ * To know how many bytes the Varint took to encode, simply negate `offset`
139
+ * from the returned new `offset`.
140
+ *
141
+ * @param buf The buffer to decode from.
142
+ * @param offset The offset to start decoding from.
143
+ * @returns A tuple of the decoded varint 32-bit number, and the new offset.
144
+ *
145
+ * @example Usage
146
+ * ```ts
147
+ * import { decodeVarint32 } from "@std/encoding/varint";
148
+ * import { assertEquals } from "@std/assert";
149
+ *
150
+ * const buf = new Uint8Array([0x8E, 0x02]);
151
+ * assertEquals(decodeVarint32(buf), [270, 2]);
152
+ * ```
153
+ */
154
+ export function decodeVarint32(buf, offset = 0) {
155
+ let shift = 0;
156
+ let decoded = 0;
157
+ for (let i = offset; i <= Math.min(buf.length, offset + MaxVarintLen32); i += 1, shift += SHIFT) {
158
+ const byte = buf[i];
159
+ decoded += (byte & REST) * Math.pow(2, shift);
160
+ if (!(byte & MSB))
161
+ return [decoded, i + 1];
162
+ }
163
+ throw new RangeError("Cannot decode the varint input: Malformed or overflow varint");
164
+ }
165
+ /**
166
+ * Takes unsigned number `num` and converts it into a Varint encoded
167
+ * `Uint8Array`, returning a tuple consisting of a `Uint8Array` slice of the
168
+ * encoded Varint, and an offset where the Varint encoded bytes end within the
169
+ * `Uint8Array`.
170
+ *
171
+ * If `buf` is not given then a Uint8Array will be created.
172
+ * `offset` defaults to `0`.
173
+ *
174
+ * If passed `buf` then that will be written into, starting at `offset`. The
175
+ * resulting returned `Uint8Array` will be a slice of `buf`. The resulting
176
+ * returned number is effectively `offset + bytesWritten`.
177
+ *
178
+ * @param num The number to encode.
179
+ * @param buf The buffer to write into.
180
+ * @param offset The offset to start writing at.
181
+ * @returns A tuple of the encoded Varint `Uint8Array` and the new offset.
182
+ *
183
+ * @example Usage
184
+ * ```ts
185
+ * import { encodeVarint } from "@std/encoding/varint";
186
+ * import { assertEquals } from "@std/assert";
187
+ *
188
+ * const buf = new Uint8Array(10);
189
+ * assertEquals(encodeVarint(42n, buf), [new Uint8Array([42]), 1]);
190
+ * ```
191
+ */
192
+ export function encodeVarint(num, buf = new Uint8Array(MaxVarintLen64), offset = 0) {
193
+ num = BigInt(num);
194
+ if (num < 0n) {
195
+ throw new RangeError(`Cannot encode the input into varint as it should be non-negative integer: received ${num}`);
196
+ }
197
+ for (let i = offset; i <= Math.min(buf.length, MaxVarintLen64); i += 1) {
198
+ if (num < MSBN) {
199
+ buf[i] = Number(num);
200
+ i += 1;
201
+ return [buf.slice(offset, i), i];
202
+ }
203
+ buf[i] = Number((num & 0xffn) | MSBN);
204
+ num >>= SHIFTN;
205
+ }
206
+ throw new RangeError(`Cannot encode the input ${num} into varint as it overflows uint64`);
207
+ }
208
+ //# sourceMappingURL=varint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"varint.js","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/encoding/1.0.6/varint.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,iEAAiE;AACjE,sEAAsE;AACtE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,mFAAmF;AACnF,qCAAqC;AAErC;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,qBAAqB,CAAC;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,cAA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qC,CACpE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,82 @@
1
+ import type { DiffResult, DiffType } from "./types.js";
2
+ /**
3
+ * Colors the output of assertion diffs.
4
+ *
5
+ * @param diffType Difference type, either added or removed.
6
+ * @param background If true, colors the background instead of the text.
7
+ *
8
+ * @returns A function that colors the input string.
9
+ *
10
+ * @example Usage
11
+ * ```ts
12
+ * import { createColor } from "@std/internal";
13
+ * import { assertEquals } from "@std/assert";
14
+ * import { bold, green, red, white } from "@std/fmt/colors";
15
+ *
16
+ * assertEquals(createColor("added")("foo"), green(bold("foo")));
17
+ * assertEquals(createColor("removed")("foo"), red(bold("foo")));
18
+ * assertEquals(createColor("common")("foo"), white("foo"));
19
+ * ```
20
+ */
21
+ export declare function createColor(diffType: DiffType,
22
+ /**
23
+ * TODO(@littledivy): Remove this when we can detect true color terminals. See
24
+ * https://github.com/denoland/deno_std/issues/2575.
25
+ */
26
+ background?: boolean): (s: string) => string;
27
+ /**
28
+ * Prefixes `+` or `-` in diff output.
29
+ *
30
+ * @param diffType Difference type, either added or removed
31
+ *
32
+ * @returns A string representing the sign.
33
+ *
34
+ * @example Usage
35
+ * ```ts
36
+ * import { createSign } from "@std/internal";
37
+ * import { assertEquals } from "@std/assert";
38
+ *
39
+ * assertEquals(createSign("added"), "+ ");
40
+ * assertEquals(createSign("removed"), "- ");
41
+ * assertEquals(createSign("common"), " ");
42
+ * ```
43
+ */
44
+ export declare function createSign(diffType: DiffType): string;
45
+ /** Options for {@linkcode buildMessage}. */
46
+ export interface BuildMessageOptions {
47
+ /**
48
+ * Whether to output the diff as a single string.
49
+ *
50
+ * @default {false}
51
+ */
52
+ stringDiff?: boolean;
53
+ }
54
+ /**
55
+ * Builds a message based on the provided diff result.
56
+ *
57
+ * @param diffResult The diff result array.
58
+ * @param options Optional parameters for customizing the message.
59
+ *
60
+ * @returns An array of strings representing the built message.
61
+ *
62
+ * @example Usage
63
+ * ```ts no-assert
64
+ * import { diffStr, buildMessage } from "@std/internal";
65
+ *
66
+ * const diffResult = diffStr("Hello, world!", "Hello, world");
67
+ *
68
+ * console.log(buildMessage(diffResult));
69
+ * // [
70
+ * // "",
71
+ * // "",
72
+ * // " [Diff] Actual / Expected",
73
+ * // "",
74
+ * // "",
75
+ * // "- Hello, world!",
76
+ * // "+ Hello, world",
77
+ * // "",
78
+ * // ]
79
+ * ```
80
+ */
81
+ export declare function buildMessage(diffResult: ReadonlyArray<DiffResult<string>>, options?: BuildMessageOptions): string[];
82
+ //# sourceMappingURL=build_message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build_message.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.5/build_message.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEvD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,QAAQ;AAClB;;;GAGG;AACH,UAAU,UAAQ,GACjB,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CASvB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CASrD;AAED,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,aAAa,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAC7C,OAAO,GAAE,mBAAwB,GAChC,MAAM,EAAE,CAsBV"}
@@ -0,0 +1,111 @@
1
+ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
2
+ // This module is browser compatible.
3
+ import { bgGreen, bgRed, bold, gray, green, red, white } from "./styles.js";
4
+ /**
5
+ * Colors the output of assertion diffs.
6
+ *
7
+ * @param diffType Difference type, either added or removed.
8
+ * @param background If true, colors the background instead of the text.
9
+ *
10
+ * @returns A function that colors the input string.
11
+ *
12
+ * @example Usage
13
+ * ```ts
14
+ * import { createColor } from "@std/internal";
15
+ * import { assertEquals } from "@std/assert";
16
+ * import { bold, green, red, white } from "@std/fmt/colors";
17
+ *
18
+ * assertEquals(createColor("added")("foo"), green(bold("foo")));
19
+ * assertEquals(createColor("removed")("foo"), red(bold("foo")));
20
+ * assertEquals(createColor("common")("foo"), white("foo"));
21
+ * ```
22
+ */
23
+ export function createColor(diffType,
24
+ /**
25
+ * TODO(@littledivy): Remove this when we can detect true color terminals. See
26
+ * https://github.com/denoland/deno_std/issues/2575.
27
+ */
28
+ background = false) {
29
+ switch (diffType) {
30
+ case "added":
31
+ return (s) => background ? bgGreen(white(s)) : green(bold(s));
32
+ case "removed":
33
+ return (s) => background ? bgRed(white(s)) : red(bold(s));
34
+ default:
35
+ return white;
36
+ }
37
+ }
38
+ /**
39
+ * Prefixes `+` or `-` in diff output.
40
+ *
41
+ * @param diffType Difference type, either added or removed
42
+ *
43
+ * @returns A string representing the sign.
44
+ *
45
+ * @example Usage
46
+ * ```ts
47
+ * import { createSign } from "@std/internal";
48
+ * import { assertEquals } from "@std/assert";
49
+ *
50
+ * assertEquals(createSign("added"), "+ ");
51
+ * assertEquals(createSign("removed"), "- ");
52
+ * assertEquals(createSign("common"), " ");
53
+ * ```
54
+ */
55
+ export function createSign(diffType) {
56
+ switch (diffType) {
57
+ case "added":
58
+ return "+ ";
59
+ case "removed":
60
+ return "- ";
61
+ default:
62
+ return " ";
63
+ }
64
+ }
65
+ /**
66
+ * Builds a message based on the provided diff result.
67
+ *
68
+ * @param diffResult The diff result array.
69
+ * @param options Optional parameters for customizing the message.
70
+ *
71
+ * @returns An array of strings representing the built message.
72
+ *
73
+ * @example Usage
74
+ * ```ts no-assert
75
+ * import { diffStr, buildMessage } from "@std/internal";
76
+ *
77
+ * const diffResult = diffStr("Hello, world!", "Hello, world");
78
+ *
79
+ * console.log(buildMessage(diffResult));
80
+ * // [
81
+ * // "",
82
+ * // "",
83
+ * // " [Diff] Actual / Expected",
84
+ * // "",
85
+ * // "",
86
+ * // "- Hello, world!",
87
+ * // "+ Hello, world",
88
+ * // "",
89
+ * // ]
90
+ * ```
91
+ */
92
+ export function buildMessage(diffResult, options = {}) {
93
+ const { stringDiff = false } = options;
94
+ const messages = [
95
+ "",
96
+ "",
97
+ ` ${gray(bold("[Diff]"))} ${red(bold("Actual"))} / ${green(bold("Expected"))}`,
98
+ "",
99
+ "",
100
+ ];
101
+ const diffMessages = diffResult.map((result) => {
102
+ const color = createColor(result.type);
103
+ const line = result.details?.map((detail) => detail.type !== "common"
104
+ ? createColor(detail.type, true)(detail.value)
105
+ : detail.value).join("") ?? result.value;
106
+ return color(`${createSign(result.type)}${line}`);
107
+ });
108
+ messages.push(...(stringDiff ? [diffMessages.join("")] : diffMessages), "");
109
+ return messages;
110
+ }
111
+ //# sourceMappingURL=build_message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build_message.js","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.5/build_message.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qCAAqC;AAErC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAG5E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,WAAW,CACzB,QAAkB;AAClB;;;GAGG;AACH,UAAU,GAAG,KAAK;IAElB,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,OAAO;YACV,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAChE,KAAK,SAAS;YACZ,OAAO,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CAAC,KAAK,CACjB,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC;QAC3B,OAAO,KAAK,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5E,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,140 @@
1
+ import type { DiffResult, DiffType } from "./types.js";
2
+ /** Represents the farthest point in the diff algorithm. */
3
+ export interface FarthestPoint {
4
+ /** The y-coordinate of the point. */
5
+ y: number;
6
+ /** The id of the point. */
7
+ id: number;
8
+ }
9
+ /**
10
+ * Creates an array of common elements between two arrays.
11
+ *
12
+ * @typeParam T The type of elements in the arrays.
13
+ *
14
+ * @param A The first array.
15
+ * @param B The second array.
16
+ *
17
+ * @returns An array containing the common elements between the two arrays.
18
+ *
19
+ * @example Usage
20
+ * ```ts
21
+ * import { createCommon } from "@std/internal/diff";
22
+ * import { assertEquals } from "@std/assert";
23
+ *
24
+ * const a = [1, 2, 3];
25
+ * const b = [1, 2, 4];
26
+ *
27
+ * assertEquals(createCommon(a, b), [1, 2]);
28
+ * ```
29
+ */
30
+ export declare function createCommon<T>(A: T[], B: T[]): T[];
31
+ /**
32
+ * Asserts that the value is a {@linkcode FarthestPoint}.
33
+ * If not, an error is thrown.
34
+ *
35
+ * @param value The value to check.
36
+ *
37
+ * @returns A void value that returns once the assertion completes.
38
+ *
39
+ * @example Usage
40
+ * ```ts
41
+ * import { assertFp } from "@std/internal/diff";
42
+ * import { assertThrows } from "@std/assert";
43
+ *
44
+ * assertFp({ y: 0, id: 0 });
45
+ * assertThrows(() => assertFp({ id: 0 }));
46
+ * assertThrows(() => assertFp({ y: 0 }));
47
+ * assertThrows(() => assertFp(undefined));
48
+ * ```
49
+ */
50
+ export declare function assertFp(value: unknown): asserts value is FarthestPoint;
51
+ /**
52
+ * Creates an array of backtraced differences.
53
+ *
54
+ * @typeParam T The type of elements in the arrays.
55
+ *
56
+ * @param A The first array.
57
+ * @param B The second array.
58
+ * @param current The current {@linkcode FarthestPoint}.
59
+ * @param swapped Boolean indicating if the arrays are swapped.
60
+ * @param routes The routes array.
61
+ * @param diffTypesPtrOffset The offset of the diff types in the routes array.
62
+ *
63
+ * @returns An array of backtraced differences.
64
+ *
65
+ * @example Usage
66
+ * ```ts
67
+ * import { backTrace } from "@std/internal/diff";
68
+ * import { assertEquals } from "@std/assert";
69
+ *
70
+ * assertEquals(
71
+ * backTrace([], [], { y: 0, id: 0 }, false, new Uint32Array(0), 0),
72
+ * [],
73
+ * );
74
+ * ```
75
+ */
76
+ export declare function backTrace<T>(A: T[], B: T[], current: FarthestPoint, swapped: boolean, routes: Uint32Array, diffTypesPtrOffset: number): Array<{
77
+ type: DiffType;
78
+ value: T;
79
+ }>;
80
+ /**
81
+ * Creates a {@linkcode FarthestPoint}.
82
+ *
83
+ * @param k The current index.
84
+ * @param M The length of the first array.
85
+ * @param routes The routes array.
86
+ * @param diffTypesPtrOffset The offset of the diff types in the routes array.
87
+ * @param ptr The current pointer.
88
+ * @param slide The slide {@linkcode FarthestPoint}.
89
+ * @param down The down {@linkcode FarthestPoint}.
90
+ *
91
+ * @returns A {@linkcode FarthestPoint}.
92
+ *
93
+ * @example Usage
94
+ * ```ts
95
+ * import { createFp } from "@std/internal/diff";
96
+ * import { assertEquals } from "@std/assert";
97
+ *
98
+ * assertEquals(
99
+ * createFp(
100
+ * 0,
101
+ * 0,
102
+ * new Uint32Array(0),
103
+ * 0,
104
+ * 0,
105
+ * { y: -1, id: 0 },
106
+ * { y: 0, id: 0 },
107
+ * ),
108
+ * { y: -1, id: 1 },
109
+ * );
110
+ * ```
111
+ */
112
+ export declare function createFp(k: number, M: number, routes: Uint32Array, diffTypesPtrOffset: number, ptr: number, slide?: FarthestPoint, down?: FarthestPoint): FarthestPoint;
113
+ /**
114
+ * Renders the differences between the actual and expected values.
115
+ *
116
+ * @typeParam T The type of elements in the arrays.
117
+ *
118
+ * @param A Actual value
119
+ * @param B Expected value
120
+ *
121
+ * @returns An array of differences between the actual and expected values.
122
+ *
123
+ * @example Usage
124
+ * ```ts
125
+ * import { diff } from "@std/internal/diff";
126
+ * import { assertEquals } from "@std/assert";
127
+ *
128
+ * const a = [1, 2, 3];
129
+ * const b = [1, 2, 4];
130
+ *
131
+ * assertEquals(diff(a, b), [
132
+ * { type: "common", value: 1 },
133
+ * { type: "common", value: 2 },
134
+ * { type: "removed", value: 3 },
135
+ * { type: "added", value: 4 },
136
+ * ]);
137
+ * ```
138
+ */
139
+ export declare function diff<T>(A: T[], B: T[]): DiffResult<T>[];
140
+ //# sourceMappingURL=diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/internal/1.0.5/diff.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEvD,2DAA2D;AAC3D,MAAM,WAAW,aAAa;IAC5B,qCAAqC;IACrC,CAAC,EAAE,MAAM,CAAC;IACV,2BAA2B;IAC3B,EAAE,EAAE,MAAM,CAAC;CACZ;AAMD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAanD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,aAAa,CAWvE;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;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