structured-outputs 0.1.0-beta.2 → 0.1.0-beta.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (391) hide show
  1. package/README.md +77 -6
  2. package/esm/ResponseFormat.d.ts +18 -11
  3. package/esm/ResponseFormat.d.ts.map +1 -1
  4. package/esm/ResponseFormat.js +57 -5
  5. package/esm/ResponseFormat.js.map +1 -1
  6. package/esm/Tool.d.ts +13 -0
  7. package/esm/Tool.d.ts.map +1 -0
  8. package/esm/Tool.js +17 -0
  9. package/esm/Tool.js.map +1 -0
  10. package/esm/_dnt.polyfills.d.ts +12 -0
  11. package/esm/_dnt.polyfills.d.ts.map +1 -0
  12. package/esm/_dnt.polyfills.js +16 -0
  13. package/esm/_dnt.polyfills.js.map +1 -0
  14. package/esm/deps/jsr.io/@std/collections/1.0.9/_utils.d.ts +6 -0
  15. package/esm/deps/jsr.io/@std/collections/1.0.9/_utils.d.ts.map +1 -0
  16. package/esm/deps/jsr.io/@std/collections/1.0.9/_utils.js +19 -0
  17. package/esm/deps/jsr.io/@std/collections/1.0.9/_utils.js.map +1 -0
  18. package/esm/deps/jsr.io/@std/collections/1.0.9/aggregate_groups.d.ts +41 -0
  19. package/esm/deps/jsr.io/@std/collections/1.0.9/aggregate_groups.d.ts.map +1 -0
  20. package/esm/deps/jsr.io/@std/collections/1.0.9/aggregate_groups.js +51 -0
  21. package/esm/deps/jsr.io/@std/collections/1.0.9/aggregate_groups.js.map +1 -0
  22. package/esm/deps/jsr.io/@std/collections/1.0.9/associate_by.d.ts +37 -0
  23. package/esm/deps/jsr.io/@std/collections/1.0.9/associate_by.d.ts.map +1 -0
  24. package/esm/deps/jsr.io/@std/collections/1.0.9/associate_by.js +45 -0
  25. package/esm/deps/jsr.io/@std/collections/1.0.9/associate_by.js.map +1 -0
  26. package/esm/deps/jsr.io/@std/collections/1.0.9/associate_with.d.ts +33 -0
  27. package/esm/deps/jsr.io/@std/collections/1.0.9/associate_with.d.ts.map +1 -0
  28. package/esm/deps/jsr.io/@std/collections/1.0.9/associate_with.js +41 -0
  29. package/esm/deps/jsr.io/@std/collections/1.0.9/associate_with.js.map +1 -0
  30. package/esm/deps/jsr.io/@std/collections/1.0.9/chunk.d.ts +38 -0
  31. package/esm/deps/jsr.io/@std/collections/1.0.9/chunk.d.ts.map +1 -0
  32. package/esm/deps/jsr.io/@std/collections/1.0.9/chunk.js +51 -0
  33. package/esm/deps/jsr.io/@std/collections/1.0.9/chunk.js.map +1 -0
  34. package/esm/deps/jsr.io/@std/collections/1.0.9/deep_merge.d.ts +322 -0
  35. package/esm/deps/jsr.io/@std/collections/1.0.9/deep_merge.d.ts.map +1 -0
  36. package/esm/deps/jsr.io/@std/collections/1.0.9/deep_merge.js +96 -0
  37. package/esm/deps/jsr.io/@std/collections/1.0.9/deep_merge.js.map +1 -0
  38. package/esm/deps/jsr.io/@std/collections/1.0.9/distinct.d.ts +23 -0
  39. package/esm/deps/jsr.io/@std/collections/1.0.9/distinct.d.ts.map +1 -0
  40. package/esm/deps/jsr.io/@std/collections/1.0.9/distinct.js +28 -0
  41. package/esm/deps/jsr.io/@std/collections/1.0.9/distinct.js.map +1 -0
  42. package/esm/deps/jsr.io/@std/collections/1.0.9/distinct_by.d.ts +26 -0
  43. package/esm/deps/jsr.io/@std/collections/1.0.9/distinct_by.d.ts.map +1 -0
  44. package/esm/deps/jsr.io/@std/collections/1.0.9/distinct_by.js +39 -0
  45. package/esm/deps/jsr.io/@std/collections/1.0.9/distinct_by.js.map +1 -0
  46. package/esm/deps/jsr.io/@std/collections/1.0.9/drop_last_while.d.ts +26 -0
  47. package/esm/deps/jsr.io/@std/collections/1.0.9/drop_last_while.d.ts.map +1 -0
  48. package/esm/deps/jsr.io/@std/collections/1.0.9/drop_last_while.js +33 -0
  49. package/esm/deps/jsr.io/@std/collections/1.0.9/drop_last_while.js.map +1 -0
  50. package/esm/deps/jsr.io/@std/collections/1.0.9/drop_while.d.ts +25 -0
  51. package/esm/deps/jsr.io/@std/collections/1.0.9/drop_while.d.ts.map +1 -0
  52. package/esm/deps/jsr.io/@std/collections/1.0.9/drop_while.js +34 -0
  53. package/esm/deps/jsr.io/@std/collections/1.0.9/drop_while.js.map +1 -0
  54. package/esm/deps/jsr.io/@std/collections/1.0.9/filter_entries.d.ts +32 -0
  55. package/esm/deps/jsr.io/@std/collections/1.0.9/filter_entries.d.ts.map +1 -0
  56. package/esm/deps/jsr.io/@std/collections/1.0.9/filter_entries.js +43 -0
  57. package/esm/deps/jsr.io/@std/collections/1.0.9/filter_entries.js.map +1 -0
  58. package/esm/deps/jsr.io/@std/collections/1.0.9/filter_keys.d.ts +36 -0
  59. package/esm/deps/jsr.io/@std/collections/1.0.9/filter_keys.d.ts.map +1 -0
  60. package/esm/deps/jsr.io/@std/collections/1.0.9/filter_keys.js +46 -0
  61. package/esm/deps/jsr.io/@std/collections/1.0.9/filter_keys.js.map +1 -0
  62. package/esm/deps/jsr.io/@std/collections/1.0.9/filter_values.d.ts +35 -0
  63. package/esm/deps/jsr.io/@std/collections/1.0.9/filter_values.d.ts.map +1 -0
  64. package/esm/deps/jsr.io/@std/collections/1.0.9/filter_values.js +46 -0
  65. package/esm/deps/jsr.io/@std/collections/1.0.9/filter_values.js.map +1 -0
  66. package/esm/deps/jsr.io/@std/collections/1.0.9/find_single.d.ts +31 -0
  67. package/esm/deps/jsr.io/@std/collections/1.0.9/find_single.d.ts.map +1 -0
  68. package/esm/deps/jsr.io/@std/collections/1.0.9/find_single.js +45 -0
  69. package/esm/deps/jsr.io/@std/collections/1.0.9/find_single.js.map +1 -0
  70. package/esm/deps/jsr.io/@std/collections/1.0.9/first_not_nullish_of.d.ts +32 -0
  71. package/esm/deps/jsr.io/@std/collections/1.0.9/first_not_nullish_of.d.ts.map +1 -0
  72. package/esm/deps/jsr.io/@std/collections/1.0.9/first_not_nullish_of.js +42 -0
  73. package/esm/deps/jsr.io/@std/collections/1.0.9/first_not_nullish_of.js.map +1 -0
  74. package/esm/deps/jsr.io/@std/collections/1.0.9/includes_value.d.ts +29 -0
  75. package/esm/deps/jsr.io/@std/collections/1.0.9/includes_value.d.ts.map +1 -0
  76. package/esm/deps/jsr.io/@std/collections/1.0.9/includes_value.js +39 -0
  77. package/esm/deps/jsr.io/@std/collections/1.0.9/includes_value.js.map +1 -0
  78. package/esm/deps/jsr.io/@std/collections/1.0.9/intersect.d.ts +25 -0
  79. package/esm/deps/jsr.io/@std/collections/1.0.9/intersect.d.ts.map +1 -0
  80. package/esm/deps/jsr.io/@std/collections/1.0.9/intersect.js +36 -0
  81. package/esm/deps/jsr.io/@std/collections/1.0.9/intersect.js.map +1 -0
  82. package/esm/deps/jsr.io/@std/collections/1.0.9/invert.d.ts +29 -0
  83. package/esm/deps/jsr.io/@std/collections/1.0.9/invert.d.ts.map +1 -0
  84. package/esm/deps/jsr.io/@std/collections/1.0.9/invert.js +29 -0
  85. package/esm/deps/jsr.io/@std/collections/1.0.9/invert.js.map +1 -0
  86. package/esm/deps/jsr.io/@std/collections/1.0.9/invert_by.d.ts +34 -0
  87. package/esm/deps/jsr.io/@std/collections/1.0.9/invert_by.d.ts.map +1 -0
  88. package/esm/deps/jsr.io/@std/collections/1.0.9/invert_by.js +46 -0
  89. package/esm/deps/jsr.io/@std/collections/1.0.9/invert_by.js.map +1 -0
  90. package/esm/deps/jsr.io/@std/collections/1.0.9/join_to_string.d.ts +75 -0
  91. package/esm/deps/jsr.io/@std/collections/1.0.9/join_to_string.d.ts.map +1 -0
  92. package/esm/deps/jsr.io/@std/collections/1.0.9/join_to_string.js +59 -0
  93. package/esm/deps/jsr.io/@std/collections/1.0.9/join_to_string.js.map +1 -0
  94. package/esm/deps/jsr.io/@std/collections/1.0.9/map_entries.d.ts +37 -0
  95. package/esm/deps/jsr.io/@std/collections/1.0.9/map_entries.d.ts.map +1 -0
  96. package/esm/deps/jsr.io/@std/collections/1.0.9/map_entries.js +47 -0
  97. package/esm/deps/jsr.io/@std/collections/1.0.9/map_entries.js.map +1 -0
  98. package/esm/deps/jsr.io/@std/collections/1.0.9/map_keys.d.ts +33 -0
  99. package/esm/deps/jsr.io/@std/collections/1.0.9/map_keys.d.ts.map +1 -0
  100. package/esm/deps/jsr.io/@std/collections/1.0.9/map_keys.js +42 -0
  101. package/esm/deps/jsr.io/@std/collections/1.0.9/map_keys.js.map +1 -0
  102. package/esm/deps/jsr.io/@std/collections/1.0.9/map_not_nullish.d.ts +32 -0
  103. package/esm/deps/jsr.io/@std/collections/1.0.9/map_not_nullish.d.ts.map +1 -0
  104. package/esm/deps/jsr.io/@std/collections/1.0.9/map_not_nullish.js +43 -0
  105. package/esm/deps/jsr.io/@std/collections/1.0.9/map_not_nullish.js.map +1 -0
  106. package/esm/deps/jsr.io/@std/collections/1.0.9/map_values.d.ts +71 -0
  107. package/esm/deps/jsr.io/@std/collections/1.0.9/map_values.d.ts.map +1 -0
  108. package/esm/deps/jsr.io/@std/collections/1.0.9/map_values.js +13 -0
  109. package/esm/deps/jsr.io/@std/collections/1.0.9/map_values.js.map +1 -0
  110. package/esm/deps/jsr.io/@std/collections/1.0.9/max_by.d.ts +117 -0
  111. package/esm/deps/jsr.io/@std/collections/1.0.9/max_by.d.ts.map +1 -0
  112. package/esm/deps/jsr.io/@std/collections/1.0.9/max_by.js +15 -0
  113. package/esm/deps/jsr.io/@std/collections/1.0.9/max_by.js.map +1 -0
  114. package/esm/deps/jsr.io/@std/collections/1.0.9/max_of.d.ts +61 -0
  115. package/esm/deps/jsr.io/@std/collections/1.0.9/max_of.d.ts.map +1 -0
  116. package/esm/deps/jsr.io/@std/collections/1.0.9/max_of.js +17 -0
  117. package/esm/deps/jsr.io/@std/collections/1.0.9/max_of.js.map +1 -0
  118. package/esm/deps/jsr.io/@std/collections/1.0.9/max_with.d.ts +29 -0
  119. package/esm/deps/jsr.io/@std/collections/1.0.9/max_with.d.ts.map +1 -0
  120. package/esm/deps/jsr.io/@std/collections/1.0.9/max_with.js +41 -0
  121. package/esm/deps/jsr.io/@std/collections/1.0.9/max_with.js.map +1 -0
  122. package/esm/deps/jsr.io/@std/collections/1.0.9/min_by.d.ts +115 -0
  123. package/esm/deps/jsr.io/@std/collections/1.0.9/min_by.d.ts.map +1 -0
  124. package/esm/deps/jsr.io/@std/collections/1.0.9/min_by.js +15 -0
  125. package/esm/deps/jsr.io/@std/collections/1.0.9/min_by.js.map +1 -0
  126. package/esm/deps/jsr.io/@std/collections/1.0.9/min_of.d.ts +61 -0
  127. package/esm/deps/jsr.io/@std/collections/1.0.9/min_of.d.ts.map +1 -0
  128. package/esm/deps/jsr.io/@std/collections/1.0.9/min_of.js +17 -0
  129. package/esm/deps/jsr.io/@std/collections/1.0.9/min_of.js.map +1 -0
  130. package/esm/deps/jsr.io/@std/collections/1.0.9/min_with.d.ts +25 -0
  131. package/esm/deps/jsr.io/@std/collections/1.0.9/min_with.d.ts.map +1 -0
  132. package/esm/deps/jsr.io/@std/collections/1.0.9/min_with.js +37 -0
  133. package/esm/deps/jsr.io/@std/collections/1.0.9/min_with.js.map +1 -0
  134. package/esm/deps/jsr.io/@std/collections/1.0.9/mod.d.ts +73 -0
  135. package/esm/deps/jsr.io/@std/collections/1.0.9/mod.d.ts.map +1 -0
  136. package/esm/deps/jsr.io/@std/collections/1.0.9/mod.js +75 -0
  137. package/esm/deps/jsr.io/@std/collections/1.0.9/mod.js.map +1 -0
  138. package/esm/deps/jsr.io/@std/collections/1.0.9/omit.d.ts +24 -0
  139. package/esm/deps/jsr.io/@std/collections/1.0.9/omit.d.ts.map +1 -0
  140. package/esm/deps/jsr.io/@std/collections/1.0.9/omit.js +29 -0
  141. package/esm/deps/jsr.io/@std/collections/1.0.9/omit.js.map +1 -0
  142. package/esm/deps/jsr.io/@std/collections/1.0.9/partition.d.ts +60 -0
  143. package/esm/deps/jsr.io/@std/collections/1.0.9/partition.d.ts.map +1 -0
  144. package/esm/deps/jsr.io/@std/collections/1.0.9/partition.js +16 -0
  145. package/esm/deps/jsr.io/@std/collections/1.0.9/partition.js.map +1 -0
  146. package/esm/deps/jsr.io/@std/collections/1.0.9/partition_entries.d.ts +39 -0
  147. package/esm/deps/jsr.io/@std/collections/1.0.9/partition_entries.d.ts.map +1 -0
  148. package/esm/deps/jsr.io/@std/collections/1.0.9/partition_entries.js +54 -0
  149. package/esm/deps/jsr.io/@std/collections/1.0.9/partition_entries.js.map +1 -0
  150. package/esm/deps/jsr.io/@std/collections/1.0.9/permutations.d.ts +27 -0
  151. package/esm/deps/jsr.io/@std/collections/1.0.9/permutations.d.ts.map +1 -0
  152. package/esm/deps/jsr.io/@std/collections/1.0.9/permutations.js +58 -0
  153. package/esm/deps/jsr.io/@std/collections/1.0.9/permutations.js.map +1 -0
  154. package/esm/deps/jsr.io/@std/collections/1.0.9/pick.d.ts +25 -0
  155. package/esm/deps/jsr.io/@std/collections/1.0.9/pick.d.ts.map +1 -0
  156. package/esm/deps/jsr.io/@std/collections/1.0.9/pick.js +33 -0
  157. package/esm/deps/jsr.io/@std/collections/1.0.9/pick.js.map +1 -0
  158. package/esm/deps/jsr.io/@std/collections/1.0.9/reduce_groups.d.ts +35 -0
  159. package/esm/deps/jsr.io/@std/collections/1.0.9/reduce_groups.d.ts.map +1 -0
  160. package/esm/deps/jsr.io/@std/collections/1.0.9/reduce_groups.js +40 -0
  161. package/esm/deps/jsr.io/@std/collections/1.0.9/reduce_groups.js.map +1 -0
  162. package/esm/deps/jsr.io/@std/collections/1.0.9/running_reduce.d.ts +27 -0
  163. package/esm/deps/jsr.io/@std/collections/1.0.9/running_reduce.d.ts.map +1 -0
  164. package/esm/deps/jsr.io/@std/collections/1.0.9/running_reduce.js +32 -0
  165. package/esm/deps/jsr.io/@std/collections/1.0.9/running_reduce.js.map +1 -0
  166. package/esm/deps/jsr.io/@std/collections/1.0.9/sample.d.ts +24 -0
  167. package/esm/deps/jsr.io/@std/collections/1.0.9/sample.d.ts.map +1 -0
  168. package/esm/deps/jsr.io/@std/collections/1.0.9/sample.js +35 -0
  169. package/esm/deps/jsr.io/@std/collections/1.0.9/sample.js.map +1 -0
  170. package/esm/deps/jsr.io/@std/collections/1.0.9/sliding_windows.d.ts +66 -0
  171. package/esm/deps/jsr.io/@std/collections/1.0.9/sliding_windows.d.ts.map +1 -0
  172. package/esm/deps/jsr.io/@std/collections/1.0.9/sliding_windows.js +57 -0
  173. package/esm/deps/jsr.io/@std/collections/1.0.9/sliding_windows.js.map +1 -0
  174. package/esm/deps/jsr.io/@std/collections/1.0.9/sort_by.d.ts +161 -0
  175. package/esm/deps/jsr.io/@std/collections/1.0.9/sort_by.d.ts.map +1 -0
  176. package/esm/deps/jsr.io/@std/collections/1.0.9/sort_by.js +30 -0
  177. package/esm/deps/jsr.io/@std/collections/1.0.9/sort_by.js.map +1 -0
  178. package/esm/deps/jsr.io/@std/collections/1.0.9/sum_of.d.ts +29 -0
  179. package/esm/deps/jsr.io/@std/collections/1.0.9/sum_of.d.ts.map +1 -0
  180. package/esm/deps/jsr.io/@std/collections/1.0.9/sum_of.js +37 -0
  181. package/esm/deps/jsr.io/@std/collections/1.0.9/sum_of.js.map +1 -0
  182. package/esm/deps/jsr.io/@std/collections/1.0.9/take_last_while.d.ts +27 -0
  183. package/esm/deps/jsr.io/@std/collections/1.0.9/take_last_while.d.ts.map +1 -0
  184. package/esm/deps/jsr.io/@std/collections/1.0.9/take_last_while.js +34 -0
  185. package/esm/deps/jsr.io/@std/collections/1.0.9/take_last_while.js.map +1 -0
  186. package/esm/deps/jsr.io/@std/collections/1.0.9/take_while.d.ts +30 -0
  187. package/esm/deps/jsr.io/@std/collections/1.0.9/take_while.d.ts.map +1 -0
  188. package/esm/deps/jsr.io/@std/collections/1.0.9/take_while.js +39 -0
  189. package/esm/deps/jsr.io/@std/collections/1.0.9/take_while.js.map +1 -0
  190. package/esm/deps/jsr.io/@std/collections/1.0.9/union.d.ts +24 -0
  191. package/esm/deps/jsr.io/@std/collections/1.0.9/union.d.ts.map +1 -0
  192. package/esm/deps/jsr.io/@std/collections/1.0.9/union.js +34 -0
  193. package/esm/deps/jsr.io/@std/collections/1.0.9/union.js.map +1 -0
  194. package/esm/deps/jsr.io/@std/collections/1.0.9/unzip.d.ts +32 -0
  195. package/esm/deps/jsr.io/@std/collections/1.0.9/unzip.d.ts.map +1 -0
  196. package/esm/deps/jsr.io/@std/collections/1.0.9/unzip.js +46 -0
  197. package/esm/deps/jsr.io/@std/collections/1.0.9/unzip.js.map +1 -0
  198. package/esm/deps/jsr.io/@std/collections/1.0.9/without_all.d.ts +23 -0
  199. package/esm/deps/jsr.io/@std/collections/1.0.9/without_all.d.ts.map +1 -0
  200. package/esm/deps/jsr.io/@std/collections/1.0.9/without_all.js +28 -0
  201. package/esm/deps/jsr.io/@std/collections/1.0.9/without_all.js.map +1 -0
  202. package/esm/deps/jsr.io/@std/collections/1.0.9/zip.d.ts +34 -0
  203. package/esm/deps/jsr.io/@std/collections/1.0.9/zip.d.ts.map +1 -0
  204. package/esm/deps/jsr.io/@std/collections/1.0.9/zip.js +43 -0
  205. package/esm/deps/jsr.io/@std/collections/1.0.9/zip.js.map +1 -0
  206. package/esm/mod.d.ts +3 -14
  207. package/esm/mod.d.ts.map +1 -1
  208. package/esm/mod.js +3 -10
  209. package/esm/mod.js.map +1 -1
  210. package/esm/oai.d.ts +5 -0
  211. package/esm/oai.d.ts.map +1 -0
  212. package/esm/oai.js +2 -0
  213. package/esm/oai.js.map +1 -0
  214. package/esm/types/Ref.d.ts +4 -0
  215. package/esm/types/Ref.d.ts.map +1 -0
  216. package/esm/types/Ref.js +11 -0
  217. package/esm/types/Ref.js.map +1 -0
  218. package/esm/types/RootTy.d.ts +8 -0
  219. package/esm/types/RootTy.d.ts.map +1 -0
  220. package/esm/types/RootTy.js +19 -0
  221. package/esm/types/RootTy.js.map +1 -0
  222. package/esm/types/Ty.d.ts +27 -0
  223. package/esm/types/Ty.d.ts.map +1 -0
  224. package/esm/types/Ty.js +17 -0
  225. package/esm/types/Ty.js.map +1 -0
  226. package/esm/types/array.d.ts +3 -0
  227. package/esm/types/array.d.ts.map +1 -0
  228. package/esm/types/array.js +9 -0
  229. package/esm/types/array.js.map +1 -0
  230. package/esm/types/constant.d.ts +3 -0
  231. package/esm/types/constant.d.ts.map +1 -0
  232. package/esm/types/constant.js +8 -0
  233. package/esm/types/constant.js.map +1 -0
  234. package/esm/types/constantUnion.d.ts +3 -0
  235. package/esm/types/constantUnion.d.ts.map +1 -0
  236. package/esm/types/constantUnion.js +25 -0
  237. package/esm/types/constantUnion.js.map +1 -0
  238. package/esm/types/leaves.d.ts +6 -0
  239. package/esm/types/leaves.d.ts.map +1 -0
  240. package/esm/types/leaves.js +18 -0
  241. package/esm/types/leaves.js.map +1 -0
  242. package/esm/types/mod.d.ts +11 -0
  243. package/esm/types/mod.d.ts.map +1 -0
  244. package/esm/types/mod.js +11 -0
  245. package/esm/types/mod.js.map +1 -0
  246. package/esm/types/object.d.ts +6 -0
  247. package/esm/types/object.d.ts.map +1 -0
  248. package/esm/{object.js → types/object.js} +4 -4
  249. package/esm/types/object.js.map +1 -0
  250. package/esm/types/std/Option.d.ts +7 -0
  251. package/esm/types/std/Option.d.ts.map +1 -0
  252. package/esm/types/std/Option.js +9 -0
  253. package/esm/types/std/Option.js.map +1 -0
  254. package/esm/types/std/Wrapper.d.ts +7 -0
  255. package/esm/types/std/Wrapper.d.ts.map +1 -0
  256. package/esm/types/std/Wrapper.js +5 -0
  257. package/esm/types/std/Wrapper.js.map +1 -0
  258. package/esm/types/std/mod.d.ts +3 -0
  259. package/esm/types/std/mod.d.ts.map +1 -0
  260. package/esm/types/std/mod.js +3 -0
  261. package/esm/types/std/mod.js.map +1 -0
  262. package/esm/types/taggedUnion.d.ts +8 -0
  263. package/esm/types/taggedUnion.d.ts.map +1 -0
  264. package/esm/types/taggedUnion.js +20 -0
  265. package/esm/types/taggedUnion.js.map +1 -0
  266. package/esm/util/phantoms.d.ts +2 -0
  267. package/esm/util/phantoms.d.ts.map +1 -0
  268. package/esm/util/phantoms.js +4 -0
  269. package/esm/util/phantoms.js.map +1 -0
  270. package/esm/util/recombineTaggedTemplateArgs.d.ts +2 -0
  271. package/esm/util/recombineTaggedTemplateArgs.d.ts.map +1 -0
  272. package/esm/util/recombineTaggedTemplateArgs.js +4 -0
  273. package/esm/util/recombineTaggedTemplateArgs.js.map +1 -0
  274. package/package.json +7 -9
  275. package/src/ResponseFormat.ts +80 -22
  276. package/src/Tool.ts +38 -0
  277. package/src/_dnt.polyfills.ts +27 -0
  278. package/src/deps/jsr.io/@std/collections/1.0.9/_utils.ts +26 -0
  279. package/src/deps/jsr.io/@std/collections/1.0.9/aggregate_groups.ts +62 -0
  280. package/src/deps/jsr.io/@std/collections/1.0.9/associate_by.ts +50 -0
  281. package/src/deps/jsr.io/@std/collections/1.0.9/associate_with.ts +46 -0
  282. package/src/deps/jsr.io/@std/collections/1.0.9/chunk.ts +56 -0
  283. package/src/deps/jsr.io/@std/collections/1.0.9/deep_merge.ts +578 -0
  284. package/src/deps/jsr.io/@std/collections/1.0.9/distinct.ts +29 -0
  285. package/src/deps/jsr.io/@std/collections/1.0.9/distinct_by.ts +42 -0
  286. package/src/deps/jsr.io/@std/collections/1.0.9/drop_last_while.ts +36 -0
  287. package/src/deps/jsr.io/@std/collections/1.0.9/drop_while.ts +39 -0
  288. package/src/deps/jsr.io/@std/collections/1.0.9/filter_entries.ts +48 -0
  289. package/src/deps/jsr.io/@std/collections/1.0.9/filter_keys.ts +51 -0
  290. package/src/deps/jsr.io/@std/collections/1.0.9/filter_values.ts +51 -0
  291. package/src/deps/jsr.io/@std/collections/1.0.9/find_single.ts +48 -0
  292. package/src/deps/jsr.io/@std/collections/1.0.9/first_not_nullish_of.ts +47 -0
  293. package/src/deps/jsr.io/@std/collections/1.0.9/includes_value.ts +45 -0
  294. package/src/deps/jsr.io/@std/collections/1.0.9/intersect.ts +35 -0
  295. package/src/deps/jsr.io/@std/collections/1.0.9/invert.ts +38 -0
  296. package/src/deps/jsr.io/@std/collections/1.0.9/invert_by.ts +56 -0
  297. package/src/deps/jsr.io/@std/collections/1.0.9/join_to_string.ts +109 -0
  298. package/src/deps/jsr.io/@std/collections/1.0.9/map_entries.ts +53 -0
  299. package/src/deps/jsr.io/@std/collections/1.0.9/map_keys.ts +47 -0
  300. package/src/deps/jsr.io/@std/collections/1.0.9/map_not_nullish.ts +49 -0
  301. package/src/deps/jsr.io/@std/collections/1.0.9/map_values.ts +96 -0
  302. package/src/deps/jsr.io/@std/collections/1.0.9/max_by.ts +153 -0
  303. package/src/deps/jsr.io/@std/collections/1.0.9/max_of.ts +90 -0
  304. package/src/deps/jsr.io/@std/collections/1.0.9/max_with.ts +46 -0
  305. package/src/deps/jsr.io/@std/collections/1.0.9/min_by.ts +151 -0
  306. package/src/deps/jsr.io/@std/collections/1.0.9/min_of.ts +90 -0
  307. package/src/deps/jsr.io/@std/collections/1.0.9/min_with.ts +42 -0
  308. package/src/deps/jsr.io/@std/collections/1.0.9/mod.ts +76 -0
  309. package/src/deps/jsr.io/@std/collections/1.0.9/omit.ts +34 -0
  310. package/src/deps/jsr.io/@std/collections/1.0.9/partition.ts +85 -0
  311. package/src/deps/jsr.io/@std/collections/1.0.9/partition_entries.ts +58 -0
  312. package/src/deps/jsr.io/@std/collections/1.0.9/permutations.ts +66 -0
  313. package/src/deps/jsr.io/@std/collections/1.0.9/pick.ts +34 -0
  314. package/src/deps/jsr.io/@std/collections/1.0.9/reduce_groups.ts +45 -0
  315. package/src/deps/jsr.io/@std/collections/1.0.9/running_reduce.ts +38 -0
  316. package/src/deps/jsr.io/@std/collections/1.0.9/sample.ts +36 -0
  317. package/src/deps/jsr.io/@std/collections/1.0.9/sliding_windows.ts +86 -0
  318. package/src/deps/jsr.io/@std/collections/1.0.9/sort_by.ts +219 -0
  319. package/src/deps/jsr.io/@std/collections/1.0.9/sum_of.ts +42 -0
  320. package/src/deps/jsr.io/@std/collections/1.0.9/take_last_while.ts +37 -0
  321. package/src/deps/jsr.io/@std/collections/1.0.9/take_while.ts +44 -0
  322. package/src/deps/jsr.io/@std/collections/1.0.9/union.ts +36 -0
  323. package/src/deps/jsr.io/@std/collections/1.0.9/unzip.ts +50 -0
  324. package/src/deps/jsr.io/@std/collections/1.0.9/without_all.ts +28 -0
  325. package/src/deps/jsr.io/@std/collections/1.0.9/zip.ts +49 -0
  326. package/src/mod.ts +3 -18
  327. package/src/oai.ts +5 -0
  328. package/src/types/Ref.ts +16 -0
  329. package/src/types/RootTy.ts +40 -0
  330. package/src/types/Ty.ts +57 -0
  331. package/src/types/array.ts +9 -0
  332. package/src/types/constant.ts +8 -0
  333. package/src/types/constantUnion.ts +27 -0
  334. package/src/types/leaves.ts +21 -0
  335. package/src/types/mod.ts +10 -0
  336. package/src/types/object.ts +15 -0
  337. package/src/types/std/Option.ts +15 -0
  338. package/src/types/std/Wrapper.ts +8 -0
  339. package/src/types/std/mod.ts +2 -0
  340. package/src/types/taggedUnion.ts +28 -0
  341. package/src/util/phantoms.ts +3 -0
  342. package/src/util/recombineTaggedTemplateArgs.ts +6 -0
  343. package/esm/F.d.ts +0 -13
  344. package/esm/F.d.ts.map +0 -1
  345. package/esm/F.js +0 -10
  346. package/esm/F.js.map +0 -1
  347. package/esm/_base.d.ts +0 -13
  348. package/esm/_base.d.ts.map +0 -1
  349. package/esm/_base.js +0 -40
  350. package/esm/_base.js.map +0 -1
  351. package/esm/array.d.ts +0 -4
  352. package/esm/array.d.ts.map +0 -1
  353. package/esm/array.js +0 -9
  354. package/esm/array.js.map +0 -1
  355. package/esm/common.d.ts +0 -6
  356. package/esm/common.d.ts.map +0 -1
  357. package/esm/common.js +0 -2
  358. package/esm/common.js.map +0 -1
  359. package/esm/literal.d.ts +0 -4
  360. package/esm/literal.d.ts.map +0 -1
  361. package/esm/literal.js +0 -8
  362. package/esm/literal.js.map +0 -1
  363. package/esm/number.d.ts +0 -4
  364. package/esm/number.d.ts.map +0 -1
  365. package/esm/number.js +0 -8
  366. package/esm/number.js.map +0 -1
  367. package/esm/object.d.ts +0 -7
  368. package/esm/object.d.ts.map +0 -1
  369. package/esm/object.js.map +0 -1
  370. package/esm/schema.d.ts +0 -4
  371. package/esm/schema.d.ts.map +0 -1
  372. package/esm/schema.js +0 -9
  373. package/esm/schema.js.map +0 -1
  374. package/esm/string.d.ts +0 -4
  375. package/esm/string.d.ts.map +0 -1
  376. package/esm/string.js +0 -8
  377. package/esm/string.js.map +0 -1
  378. package/esm/union.d.ts +0 -6
  379. package/esm/union.d.ts.map +0 -1
  380. package/esm/union.js +0 -8
  381. package/esm/union.js.map +0 -1
  382. package/src/F.ts +0 -27
  383. package/src/_base.ts +0 -25
  384. package/src/array.ts +0 -11
  385. package/src/common.ts +0 -6
  386. package/src/literal.ts +0 -10
  387. package/src/number.ts +0 -10
  388. package/src/object.ts +0 -17
  389. package/src/schema.ts +0 -10
  390. package/src/string.ts +0 -10
  391. package/src/union.ts +0 -12
@@ -0,0 +1,27 @@
1
+ import { partition } from "../deps/jsr.io/@std/collections/1.0.9/mod.js"
2
+ import { Ty } from "./Ty.js"
3
+
4
+ export function constantUnion<M extends Array<number | string>>(
5
+ ...members: M
6
+ ): Ty<M[number], never> {
7
+ const [strings, numbers] = partition(members, (v) => typeof v === "string")
8
+ return Ty((description) => {
9
+ return {
10
+ anyOf: [
11
+ ...strings.length
12
+ ? [{
13
+ type: "string",
14
+ enum: strings,
15
+ }]
16
+ : [],
17
+ ...numbers.length
18
+ ? [{
19
+ type: "number",
20
+ enum: numbers,
21
+ }]
22
+ : [],
23
+ ],
24
+ description,
25
+ }
26
+ })
27
+ }
@@ -0,0 +1,21 @@
1
+ import { Ty } from "./Ty.js"
2
+
3
+ export const none: Ty<null, never> = Ty((description) => ({
4
+ type: "null",
5
+ description,
6
+ }))
7
+
8
+ export const boolean: Ty<boolean, never> = Ty((description) => ({
9
+ type: "boolean",
10
+ description,
11
+ }))
12
+
13
+ export const number: Ty<number, never> = Ty((description) => ({
14
+ type: "number",
15
+ description,
16
+ }))
17
+
18
+ export const string: Ty<string, never> = Ty((description) => ({
19
+ type: "string",
20
+ description,
21
+ }))
@@ -0,0 +1,10 @@
1
+ export * from "./array.js"
2
+ export * from "./leaves.js"
3
+ export * from "./constant.js"
4
+ export * from "./constantUnion.js"
5
+ export * from "./std/mod.js"
6
+ export * from "./object.js"
7
+ export * from "./Ref.js"
8
+ export * from "./taggedUnion.js"
9
+ export * from "./Ty.js"
10
+ export * from "./RootTy.js"
@@ -0,0 +1,15 @@
1
+ import { RootTy } from "./RootTy.js"
2
+ import type { Ty } from "./Ty.js"
3
+
4
+ export function object<F extends Record<string, Ty>>(fields: F): RootTy<
5
+ { [K in keyof F]: F[K][Ty.T] },
6
+ F[keyof F][Ty.P]
7
+ > {
8
+ return RootTy((description, ref) => ({
9
+ type: "object",
10
+ description,
11
+ properties: Object.fromEntries(Object.entries(fields).map(([k, v]) => [k, ref(v)])),
12
+ additionalProperties: false,
13
+ required: Object.keys(fields),
14
+ }))
15
+ }
@@ -0,0 +1,15 @@
1
+ import { none } from "../leaves.js"
2
+ import { taggedUnion } from "../taggedUnion.js"
3
+ import type { Ty } from "../Ty.js"
4
+
5
+ export function option<S extends Ty>(Some: S): ReturnType<
6
+ typeof taggedUnion<{
7
+ Some: S
8
+ None: Ty<null, never>
9
+ }>
10
+ > {
11
+ return taggedUnion({
12
+ Some,
13
+ None: none,
14
+ })`An option of specified \`some\` type.`
15
+ }
@@ -0,0 +1,8 @@
1
+ import type { Ty } from "../mod.js"
2
+ import { object } from "../object.js"
3
+
4
+ export type Wrapper<X extends Ty = Ty> = ReturnType<typeof Wrapper<X>>
5
+
6
+ export function Wrapper<X extends Ty>(value: X): ReturnType<typeof object<{ value: X }>> {
7
+ return object({ value })
8
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./Option.js"
2
+ export * from "./Wrapper.js"
@@ -0,0 +1,28 @@
1
+ import { Ty } from "./Ty.js"
2
+
3
+ export function taggedUnion<M extends Record<string, Ty>>(members: M): Ty<
4
+ {
5
+ [K in keyof M]: {
6
+ type: K
7
+ value: M[K][Ty.T]
8
+ }
9
+ }[keyof M],
10
+ M[keyof M][Ty.P]
11
+ > {
12
+ return Ty((description, ref) => ({
13
+ description,
14
+ discriminator: "type",
15
+ anyOf: Object.entries(members).map(([k, v]) => ({
16
+ type: "object",
17
+ properties: {
18
+ type: {
19
+ type: "string",
20
+ const: k,
21
+ },
22
+ value: ref(v),
23
+ },
24
+ required: ["type", "value"],
25
+ additionalProperties: false,
26
+ })),
27
+ }))
28
+ }
@@ -0,0 +1,3 @@
1
+ export function phantoms<T>(): T {
2
+ return {} as T
3
+ }
@@ -0,0 +1,6 @@
1
+ export function recombineTaggedTemplateArgs(
2
+ strings: TemplateStringsArray,
3
+ values: Array<number | string>,
4
+ ): string {
5
+ return strings.reduce((acc, cur, i) => `${acc}${cur}${values[i] ?? ""}`, "")
6
+ }
package/esm/F.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import type { Ty } from "./_base.js";
2
- import type { ValidRootKey } from "./common.js";
3
- export type F = {
4
- type: "function";
5
- /** The name of the function. */
6
- name: string;
7
- /** The description of the function. */
8
- description: string;
9
- /** Parameters of the function in JSON Schema. */
10
- parameters: unknown;
11
- };
12
- export declare function F<M extends Record<string, Ty>>(name: string, description: string, models: M, rootKey: ValidRootKey<M>): F;
13
- //# sourceMappingURL=F.d.ts.map
package/esm/F.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"F.d.ts","sourceRoot":"","sources":["../src/F.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG/C,MAAM,MAAM,CAAC,GAAG;IACd,IAAI,EAAE,UAAU,CAAA;IAChB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAA;IACnB,iDAAiD;IACjD,UAAU,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,wBAAgB,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,EAC5C,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,CAAC,EACT,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,GACvB,CAAC,CAOH"}
package/esm/F.js DELETED
@@ -1,10 +0,0 @@
1
- import { schema } from "./schema.js";
2
- export function F(name, description, models, rootKey) {
3
- return {
4
- type: "function",
5
- name,
6
- description,
7
- parameters: schema(models, rootKey),
8
- };
9
- }
10
- //# sourceMappingURL=F.js.map
package/esm/F.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"F.js","sourceRoot":"","sources":["../src/F.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAYpC,MAAM,UAAU,CAAC,CACf,IAAY,EACZ,WAAmB,EACnB,MAAS,EACT,OAAwB;IAExB,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,IAAI;QACJ,WAAW;QACX,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;KACpC,CAAA;AACH,CAAC"}
package/esm/_base.d.ts DELETED
@@ -1,13 +0,0 @@
1
- export interface Ty<N = any> {
2
- new (): N;
3
- schema(ctx: Context): Record<string, unknown>;
4
- }
5
- export declare function make<Ty_ extends Ty>(schema: (ctx: Context) => unknown): Ty_;
6
- export declare class Context {
7
- readonly root: Ty;
8
- readonly models?: Record<string, Ty> | undefined;
9
- defs: Map<Ty, string>;
10
- constructor(root: Ty, models?: Record<string, Ty> | undefined);
11
- ref(value: Ty): Record<string, unknown>;
12
- }
13
- //# sourceMappingURL=_base.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_base.d.ts","sourceRoot":"","sources":["../src/_base.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,EAAE,CAAC,CAAC,GAAG,GAAG;IACzB,QAAO,CAAC,CAAA;IACR,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC9C;AAED,wBAAgB,IAAI,CAAC,GAAG,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,GAG/D,GAAG,CACT;AAED,qBAAa,OAAO;IAGhB,QAAQ,CAAC,IAAI,EAAE,EAAE;IACjB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;IAHtC,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;gBAEV,IAAI,EAAE,EAAE,EACR,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,YAAA;IAKtC,GAAG,CAAC,KAAK,EAAE,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAIxC"}
package/esm/_base.js DELETED
@@ -1,40 +0,0 @@
1
- export function make(schema) {
2
- var _a;
3
- return _a = class Ty {
4
- },
5
- Object.defineProperty(_a, "schema", {
6
- enumerable: true,
7
- configurable: true,
8
- writable: true,
9
- value: schema
10
- }),
11
- _a;
12
- }
13
- export class Context {
14
- constructor(root, models) {
15
- Object.defineProperty(this, "root", {
16
- enumerable: true,
17
- configurable: true,
18
- writable: true,
19
- value: root
20
- });
21
- Object.defineProperty(this, "models", {
22
- enumerable: true,
23
- configurable: true,
24
- writable: true,
25
- value: models
26
- });
27
- Object.defineProperty(this, "defs", {
28
- enumerable: true,
29
- configurable: true,
30
- writable: true,
31
- value: void 0
32
- });
33
- this.defs = new Map(models ? Object.entries(models).map(([k, v]) => [v, k]) : []);
34
- }
35
- ref(value) {
36
- const key = this.defs.get(value);
37
- return key ? { $ref: `#/$defs/${key}` } : value.schema(this);
38
- }
39
- }
40
- //# sourceMappingURL=_base.js.map
package/esm/_base.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"_base.js","sourceRoot":"","sources":["../src/_base.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,IAAI,CAAiB,MAAiC;;IACpE,OAAO,KAAA,MAAM,EAAE;SAEd;QADQ;;;;mBAAS,MAAM;UAAA;UAChB,CAAA;AACV,CAAC;AAED,MAAM,OAAO,OAAO;IAElB,YACW,IAAQ,EACR,MAA2B;QADpC;;;;mBAAS,IAAI;WAAI;QACjB;;;;mBAAS,MAAM;WAAqB;QAHtC;;;;;WAAqB;QAKnB,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;IACnF,CAAC;IAED,GAAG,CAAC,KAAS;QACX,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAChC,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC9D,CAAC;CACF"}
package/esm/array.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { type Ty } from "./_base.js";
2
- export declare function array<E extends Ty>(description: string | undefined, element: E): ArrayTy<E>;
3
- export type ArrayTy<E extends Ty = any> = Ty<Array<InstanceType<E>>>;
4
- //# sourceMappingURL=array.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../src/array.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,EAAE,EAAE,MAAM,YAAY,CAAA;AAE1C,wBAAgB,KAAK,CAAC,CAAC,SAAS,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAM3F;AAED,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,EAAE,GAAG,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA"}
package/esm/array.js DELETED
@@ -1,9 +0,0 @@
1
- import { make } from "./_base.js";
2
- export function array(description, element) {
3
- return make((ctx) => ({
4
- type: "array",
5
- description,
6
- items: ctx.ref(element),
7
- }));
8
- }
9
- //# sourceMappingURL=array.js.map
package/esm/array.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"array.js","sourceRoot":"","sources":["../src/array.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAW,MAAM,YAAY,CAAA;AAE1C,MAAM,UAAU,KAAK,CAAe,WAA+B,EAAE,OAAU;IAC7E,OAAO,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACpB,IAAI,EAAE,OAAO;QACb,WAAW;QACX,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC;KACxB,CAAC,CAAC,CAAA;AACL,CAAC"}
package/esm/common.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import type { Ty } from "./_base.js";
2
- import type { ObjectTy } from "./object.js";
3
- export type ValidRootKey<M extends Record<string, Ty>> = keyof {
4
- [K in keyof M as (M[K] extends ObjectTy<any> ? K : never)]: never;
5
- };
6
- //# sourceMappingURL=common.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE3C,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MAAM;KAC5D,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,KAAK;CAClE,CAAA"}
package/esm/common.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=common.js.map
package/esm/common.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":""}
package/esm/literal.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { type Ty } from "./_base.js";
2
- export declare function literal<V extends number | string>(description: string | undefined, value: V): LiteralTy<V>;
3
- export type LiteralTy<V extends number | string = any> = Ty<V>;
4
- //# sourceMappingURL=literal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"literal.d.ts","sourceRoot":"","sources":["../src/literal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,EAAE,EAAE,MAAM,YAAY,CAAA;AAE1C,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAK1G;AAED,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA"}
package/esm/literal.js DELETED
@@ -1,8 +0,0 @@
1
- import { make } from "./_base.js";
2
- export function literal(description, value) {
3
- return make(() => ({
4
- const: value,
5
- description,
6
- }));
7
- }
8
- //# sourceMappingURL=literal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"literal.js","sourceRoot":"","sources":["../src/literal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAW,MAAM,YAAY,CAAA;AAE1C,MAAM,UAAU,OAAO,CAA4B,WAA+B,EAAE,KAAQ;IAC1F,OAAO,IAAI,CAAe,GAAG,EAAE,CAAC,CAAC;QAC/B,KAAK,EAAE,KAAK;QACZ,WAAW;KACZ,CAAC,CAAC,CAAA;AACL,CAAC"}
package/esm/number.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { type Ty } from "./_base.js";
2
- export declare function number(description?: string): NumberTy;
3
- export type NumberTy = Ty<number>;
4
- //# sourceMappingURL=number.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../src/number.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,EAAE,EAAE,MAAM,YAAY,CAAA;AAE1C,wBAAgB,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,QAAQ,CAKrD;AAED,MAAM,MAAM,QAAQ,GAAG,EAAE,CAAC,MAAM,CAAC,CAAA"}
package/esm/number.js DELETED
@@ -1,8 +0,0 @@
1
- import { make } from "./_base.js";
2
- export function number(description) {
3
- return make(() => ({
4
- type: "number",
5
- description,
6
- }));
7
- }
8
- //# sourceMappingURL=number.js.map
package/esm/number.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"number.js","sourceRoot":"","sources":["../src/number.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAW,MAAM,YAAY,CAAA;AAE1C,MAAM,UAAU,MAAM,CAAC,WAAoB;IACzC,OAAO,IAAI,CAAW,GAAG,EAAE,CAAC,CAAC;QAC3B,IAAI,EAAE,QAAQ;QACd,WAAW;KACZ,CAAC,CAAC,CAAA;AACL,CAAC"}
package/esm/object.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import { type Ty } from "./_base.js";
2
- export declare function object<F extends ObjectTyFields>(description: string | undefined, fields: F): ObjectTy<F>;
3
- export type ObjectTyFields = Record<string, Ty>;
4
- export type ObjectTy<F extends ObjectTyFields = any> = Ty<{
5
- [K in keyof F]: F[K] extends Ty ? InstanceType<F[K]> : F[K];
6
- }>;
7
- //# sourceMappingURL=object.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"object.d.ts","sourceRoot":"","sources":["../src/object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,EAAE,EAAE,MAAM,YAAY,CAAA;AAE1C,wBAAgB,MAAM,CAAC,CAAC,SAAS,cAAc,EAAE,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAQxG;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AAE/C,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,cAAc,GAAG,GAAG,IAAI,EAAE,CACvD;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAChE,CAAA"}
package/esm/object.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"object.js","sourceRoot":"","sources":["../src/object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAW,MAAM,YAAY,CAAA;AAE1C,MAAM,UAAU,MAAM,CAA2B,WAA+B,EAAE,MAAS;IACzF,OAAO,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACpB,IAAI,EAAE,QAAQ;QACd,WAAW;QACX,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvF,oBAAoB,EAAE,KAAK;QAC3B,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;KAC9B,CAAC,CAAC,CAAA;AACL,CAAC"}
package/esm/schema.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { type Ty } from "./_base.js";
2
- import type { ValidRootKey } from "./common.js";
3
- export declare function schema<M extends Record<string, Ty>>(models: M, rootKey: ValidRootKey<M>): Record<string, unknown>;
4
- //# sourceMappingURL=schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,EAAE,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMjH"}
package/esm/schema.js DELETED
@@ -1,9 +0,0 @@
1
- import { Context } from "./_base.js";
2
- export function schema(models, rootKey) {
3
- const root = models[rootKey];
4
- const ctx = new Context(root, models);
5
- return Object.assign(root.schema(ctx), {
6
- $defs: Object.fromEntries(Object.entries(models).map(([k, v]) => [k, v.schema(ctx)])),
7
- });
8
- }
9
- //# sourceMappingURL=schema.js.map
package/esm/schema.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAW,MAAM,YAAY,CAAA;AAG7C,MAAM,UAAU,MAAM,CAA+B,MAAS,EAAE,OAAwB;IACtF,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAE,CAAA;IAC7B,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IACrC,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;QACrC,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KACtF,CAAC,CAAA;AACJ,CAAC"}
package/esm/string.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { type Ty } from "./_base.js";
2
- export declare function string(description?: string): StringTy;
3
- export type StringTy = Ty<string>;
4
- //# sourceMappingURL=string.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../src/string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,EAAE,EAAE,MAAM,YAAY,CAAA;AAE1C,wBAAgB,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,QAAQ,CAKrD;AAED,MAAM,MAAM,QAAQ,GAAG,EAAE,CAAC,MAAM,CAAC,CAAA"}
package/esm/string.js DELETED
@@ -1,8 +0,0 @@
1
- import { make } from "./_base.js";
2
- export function string(description) {
3
- return make(() => ({
4
- type: "string",
5
- description,
6
- }));
7
- }
8
- //# sourceMappingURL=string.js.map
package/esm/string.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"string.js","sourceRoot":"","sources":["../src/string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAW,MAAM,YAAY,CAAA;AAE1C,MAAM,UAAU,MAAM,CAAC,WAAoB;IACzC,OAAO,IAAI,CAAW,GAAG,EAAE,CAAC,CAAC;QAC3B,IAAI,EAAE,QAAQ;QACd,WAAW;KACZ,CAAC,CAAC,CAAA;AACL,CAAC"}
package/esm/union.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { type Ty } from "./_base.js";
2
- export declare function union<M extends Ty[]>(description: string | undefined, members: [...M]): UnionTy<M>;
3
- export type UnionTy<M extends Ty[]> = Ty<{
4
- [K in keyof M]: M[K] extends Ty ? InstanceType<M[K]> : M[K];
5
- }[number]>;
6
- //# sourceMappingURL=union.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"union.d.ts","sourceRoot":"","sources":["../src/union.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,EAAE,EAAE,MAAM,YAAY,CAAA;AAE1C,wBAAgB,KAAK,CAAC,CAAC,SAAS,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAKlG;AAED,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,CACtC;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC,MAAM,CAAC,CACxE,CAAA"}
package/esm/union.js DELETED
@@ -1,8 +0,0 @@
1
- import { make } from "./_base.js";
2
- export function union(description, members) {
3
- return make((ctx) => ({
4
- description,
5
- oneOf: members.map((member) => ctx.ref(member)),
6
- }));
7
- }
8
- //# sourceMappingURL=union.js.map
package/esm/union.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"union.js","sourceRoot":"","sources":["../src/union.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAW,MAAM,YAAY,CAAA;AAE1C,MAAM,UAAU,KAAK,CAAiB,WAA+B,EAAE,OAAe;IACpF,OAAO,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACpB,WAAW;QACX,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;KAChD,CAAC,CAAC,CAAA;AACL,CAAC"}
package/src/F.ts DELETED
@@ -1,27 +0,0 @@
1
- import type { Ty } from "./_base.js"
2
- import type { ValidRootKey } from "./common.js"
3
- import { schema } from "./schema.js"
4
-
5
- export type F = {
6
- type: "function"
7
- /** The name of the function. */
8
- name: string
9
- /** The description of the function. */
10
- description: string
11
- /** Parameters of the function in JSON Schema. */
12
- parameters: unknown
13
- }
14
-
15
- export function F<M extends Record<string, Ty>>(
16
- name: string,
17
- description: string,
18
- models: M,
19
- rootKey: ValidRootKey<M>,
20
- ): F {
21
- return {
22
- type: "function",
23
- name,
24
- description,
25
- parameters: schema(models, rootKey),
26
- }
27
- }
package/src/_base.ts DELETED
@@ -1,25 +0,0 @@
1
- export interface Ty<N = any> {
2
- new(): N
3
- schema(ctx: Context): Record<string, unknown>
4
- }
5
-
6
- export function make<Ty_ extends Ty>(schema: (ctx: Context) => unknown) {
7
- return class Ty {
8
- static schema = schema
9
- } as Ty_
10
- }
11
-
12
- export class Context {
13
- defs: Map<Ty, string>
14
- constructor(
15
- readonly root: Ty,
16
- readonly models?: Record<string, Ty>,
17
- ) {
18
- this.defs = new Map(models ? Object.entries(models).map(([k, v]) => [v, k]) : [])
19
- }
20
-
21
- ref(value: Ty): Record<string, unknown> {
22
- const key = this.defs.get(value)
23
- return key ? { $ref: `#/$defs/${key}` } : value.schema(this)
24
- }
25
- }
package/src/array.ts DELETED
@@ -1,11 +0,0 @@
1
- import { make, type Ty } from "./_base.js"
2
-
3
- export function array<E extends Ty>(description: string | undefined, element: E): ArrayTy<E> {
4
- return make((ctx) => ({
5
- type: "array",
6
- description,
7
- items: ctx.ref(element),
8
- }))
9
- }
10
-
11
- export type ArrayTy<E extends Ty = any> = Ty<Array<InstanceType<E>>>
package/src/common.ts DELETED
@@ -1,6 +0,0 @@
1
- import type { Ty } from "./_base.js"
2
- import type { ObjectTy } from "./object.js"
3
-
4
- export type ValidRootKey<M extends Record<string, Ty>> = keyof {
5
- [K in keyof M as (M[K] extends ObjectTy<any> ? K : never)]: never
6
- }
package/src/literal.ts DELETED
@@ -1,10 +0,0 @@
1
- import { make, type Ty } from "./_base.js"
2
-
3
- export function literal<V extends number | string>(description: string | undefined, value: V): LiteralTy<V> {
4
- return make<LiteralTy<V>>(() => ({
5
- const: value,
6
- description,
7
- }))
8
- }
9
-
10
- export type LiteralTy<V extends number | string = any> = Ty<V>
package/src/number.ts DELETED
@@ -1,10 +0,0 @@
1
- import { make, type Ty } from "./_base.js"
2
-
3
- export function number(description?: string): NumberTy {
4
- return make<NumberTy>(() => ({
5
- type: "number",
6
- description,
7
- }))
8
- }
9
-
10
- export type NumberTy = Ty<number>
package/src/object.ts DELETED
@@ -1,17 +0,0 @@
1
- import { make, type Ty } from "./_base.js"
2
-
3
- export function object<F extends ObjectTyFields>(description: string | undefined, fields: F): ObjectTy<F> {
4
- return make((ctx) => ({
5
- type: "object",
6
- description,
7
- properties: Object.fromEntries(Object.entries(fields).map(([k, v]) => [k, ctx.ref(v)])),
8
- additionalProperties: false,
9
- required: Object.keys(fields),
10
- }))
11
- }
12
-
13
- export type ObjectTyFields = Record<string, Ty>
14
-
15
- export type ObjectTy<F extends ObjectTyFields = any> = Ty<
16
- { [K in keyof F]: F[K] extends Ty ? InstanceType<F[K]> : F[K] }
17
- >
package/src/schema.ts DELETED
@@ -1,10 +0,0 @@
1
- import { Context, type Ty } from "./_base.js"
2
- import type { ValidRootKey } from "./common.js"
3
-
4
- export function schema<M extends Record<string, Ty>>(models: M, rootKey: ValidRootKey<M>): Record<string, unknown> {
5
- const root = models[rootKey]!
6
- const ctx = new Context(root, models)
7
- return Object.assign(root.schema(ctx), {
8
- $defs: Object.fromEntries(Object.entries(models).map(([k, v]) => [k, v.schema(ctx)])),
9
- })
10
- }
package/src/string.ts DELETED
@@ -1,10 +0,0 @@
1
- import { make, type Ty } from "./_base.js"
2
-
3
- export function string(description?: string): StringTy {
4
- return make<StringTy>(() => ({
5
- type: "string",
6
- description,
7
- }))
8
- }
9
-
10
- export type StringTy = Ty<string>
package/src/union.ts DELETED
@@ -1,12 +0,0 @@
1
- import { make, type Ty } from "./_base.js"
2
-
3
- export function union<M extends Ty[]>(description: string | undefined, members: [...M]): UnionTy<M> {
4
- return make((ctx) => ({
5
- description,
6
- oneOf: members.map((member) => ctx.ref(member)),
7
- }))
8
- }
9
-
10
- export type UnionTy<M extends Ty[]> = Ty<
11
- { [K in keyof M]: M[K] extends Ty ? InstanceType<M[K]> : M[K] }[number]
12
- >