@xtandard/kit 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (402) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +71 -2
  3. package/bin/xtandard-kit.mjs +3 -0
  4. package/dist/base-path-BJugWLNO.cjs +42 -0
  5. package/dist/base-path-BJugWLNO.cjs.map +1 -0
  6. package/dist/base-path-CDb4In5E.mjs +31 -0
  7. package/dist/base-path-CDb4In5E.mjs.map +1 -0
  8. package/dist/basic-Qtriv0xS.mjs +176 -0
  9. package/dist/basic-Qtriv0xS.mjs.map +1 -0
  10. package/dist/basic-ZaO92-lB.cjs +199 -0
  11. package/dist/basic-ZaO92-lB.cjs.map +1 -0
  12. package/dist/bin.cjs +126 -0
  13. package/dist/bin.cjs.map +1 -0
  14. package/dist/bin.d.cts +20 -0
  15. package/dist/bin.d.mts +20 -0
  16. package/dist/bin.mjs +125 -0
  17. package/dist/bin.mjs.map +1 -0
  18. package/dist/cas-CuPSaXBV.cjs +23 -0
  19. package/dist/cas-CuPSaXBV.cjs.map +1 -0
  20. package/dist/cas-CzA-yECx.mjs +18 -0
  21. package/dist/cas-CzA-yECx.mjs.map +1 -0
  22. package/dist/chunk-DakpK96I.cjs +43 -0
  23. package/dist/contract-B3UPXXLx.d.cts +30 -0
  24. package/dist/contract-B3UPXXLx.d.mts +30 -0
  25. package/dist/contract-BDPNvjtp.d.mts +64 -0
  26. package/dist/contract-BEdfGTPs.mjs +85 -0
  27. package/dist/contract-BEdfGTPs.mjs.map +1 -0
  28. package/dist/contract-BIVzAn4f.d.cts +64 -0
  29. package/dist/contract-BvgtswLX.d.cts +75 -0
  30. package/dist/contract-BvgtswLX.d.mts +75 -0
  31. package/dist/contract-DUj9P3Vt.d.cts +72 -0
  32. package/dist/contract-DUj9P3Vt.d.mts +72 -0
  33. package/dist/contract-wAEMDmYG.cjs +132 -0
  34. package/dist/contract-wAEMDmYG.cjs.map +1 -0
  35. package/dist/drizzle-BElCHWri.d.mts +115 -0
  36. package/dist/drizzle-BXaQXCr0.cjs +232 -0
  37. package/dist/drizzle-BXaQXCr0.cjs.map +1 -0
  38. package/dist/drizzle-CEpahWQB.d.cts +115 -0
  39. package/dist/drizzle-DxnelsPT.mjs +197 -0
  40. package/dist/drizzle-DxnelsPT.mjs.map +1 -0
  41. package/dist/duration-7WpAK-xe.mjs +52 -0
  42. package/dist/duration-7WpAK-xe.mjs.map +1 -0
  43. package/dist/duration-DVA0Fzkx.cjs +63 -0
  44. package/dist/duration-DVA0Fzkx.cjs.map +1 -0
  45. package/dist/duration-FPwbmWIU.d.cts +35 -0
  46. package/dist/duration-FPwbmWIU.d.mts +35 -0
  47. package/dist/entry-adapters-bun.cjs +10 -0
  48. package/dist/entry-adapters-bun.cjs.map +1 -0
  49. package/dist/entry-adapters-bun.d.cts +10 -0
  50. package/dist/entry-adapters-bun.d.mts +10 -0
  51. package/dist/entry-adapters-bun.mjs +9 -0
  52. package/dist/entry-adapters-bun.mjs.map +1 -0
  53. package/dist/entry-adapters-elysia.cjs +54 -0
  54. package/dist/entry-adapters-elysia.cjs.map +1 -0
  55. package/dist/entry-adapters-elysia.d.cts +38 -0
  56. package/dist/entry-adapters-elysia.d.mts +38 -0
  57. package/dist/entry-adapters-elysia.mjs +53 -0
  58. package/dist/entry-adapters-elysia.mjs.map +1 -0
  59. package/dist/entry-adapters-express.cjs +27 -0
  60. package/dist/entry-adapters-express.cjs.map +1 -0
  61. package/dist/entry-adapters-express.d.cts +24 -0
  62. package/dist/entry-adapters-express.d.mts +24 -0
  63. package/dist/entry-adapters-express.mjs +26 -0
  64. package/dist/entry-adapters-express.mjs.map +1 -0
  65. package/dist/entry-adapters-hono.cjs +33 -0
  66. package/dist/entry-adapters-hono.cjs.map +1 -0
  67. package/dist/entry-adapters-hono.d.cts +36 -0
  68. package/dist/entry-adapters-hono.d.mts +36 -0
  69. package/dist/entry-adapters-hono.mjs +30 -0
  70. package/dist/entry-adapters-hono.mjs.map +1 -0
  71. package/dist/entry-adapters-next.cjs +19 -0
  72. package/dist/entry-adapters-next.cjs.map +1 -0
  73. package/dist/entry-adapters-next.d.cts +35 -0
  74. package/dist/entry-adapters-next.d.mts +35 -0
  75. package/dist/entry-adapters-next.mjs +18 -0
  76. package/dist/entry-adapters-next.mjs.map +1 -0
  77. package/dist/entry-adapters-node.cjs +7 -0
  78. package/dist/entry-adapters-node.d.cts +2 -0
  79. package/dist/entry-adapters-node.d.mts +2 -0
  80. package/dist/entry-adapters-node.mjs +2 -0
  81. package/dist/entry-auth-basic.cjs +5 -0
  82. package/dist/entry-auth-basic.d.cts +83 -0
  83. package/dist/entry-auth-basic.d.mts +83 -0
  84. package/dist/entry-auth-basic.mjs +2 -0
  85. package/dist/entry-auth-delegated.cjs +28 -0
  86. package/dist/entry-auth-delegated.cjs.map +1 -0
  87. package/dist/entry-auth-delegated.d.cts +36 -0
  88. package/dist/entry-auth-delegated.d.mts +36 -0
  89. package/dist/entry-auth-delegated.mjs +27 -0
  90. package/dist/entry-auth-delegated.mjs.map +1 -0
  91. package/dist/entry-auth-none.cjs +4 -0
  92. package/dist/entry-auth-none.d.cts +25 -0
  93. package/dist/entry-auth-none.d.mts +25 -0
  94. package/dist/entry-auth-none.mjs +2 -0
  95. package/dist/entry-auth.cjs +0 -0
  96. package/dist/entry-auth.d.cts +2 -0
  97. package/dist/entry-auth.d.mts +2 -0
  98. package/dist/entry-auth.mjs +1 -0
  99. package/dist/entry-authorization-delegated.cjs +27 -0
  100. package/dist/entry-authorization-delegated.cjs.map +1 -0
  101. package/dist/entry-authorization-delegated.d.cts +31 -0
  102. package/dist/entry-authorization-delegated.d.mts +31 -0
  103. package/dist/entry-authorization-delegated.mjs +26 -0
  104. package/dist/entry-authorization-delegated.mjs.map +1 -0
  105. package/dist/entry-authorization-none.cjs +3 -0
  106. package/dist/entry-authorization-none.d.cts +18 -0
  107. package/dist/entry-authorization-none.d.mts +18 -0
  108. package/dist/entry-authorization-none.mjs +2 -0
  109. package/dist/entry-authorization-roles.cjs +3 -0
  110. package/dist/entry-authorization-roles.d.cts +2 -0
  111. package/dist/entry-authorization-roles.d.mts +2 -0
  112. package/dist/entry-authorization-roles.mjs +2 -0
  113. package/dist/entry-authorization.cjs +35 -0
  114. package/dist/entry-authorization.cjs.map +1 -0
  115. package/dist/entry-authorization.d.cts +2 -0
  116. package/dist/entry-authorization.d.mts +2 -0
  117. package/dist/entry-authorization.mjs +34 -0
  118. package/dist/entry-authorization.mjs.map +1 -0
  119. package/dist/entry-build.cjs +481 -0
  120. package/dist/entry-build.cjs.map +1 -0
  121. package/dist/entry-build.d.cts +355 -0
  122. package/dist/entry-build.d.mts +355 -0
  123. package/dist/entry-build.mjs +460 -0
  124. package/dist/entry-build.mjs.map +1 -0
  125. package/dist/entry-cli.cjs +368 -0
  126. package/dist/entry-cli.cjs.map +1 -0
  127. package/dist/entry-cli.d.cts +275 -0
  128. package/dist/entry-cli.d.mts +275 -0
  129. package/dist/entry-cli.mjs +355 -0
  130. package/dist/entry-cli.mjs.map +1 -0
  131. package/dist/entry-drizzle-mysql.cjs +36 -0
  132. package/dist/entry-drizzle-mysql.cjs.map +1 -0
  133. package/dist/entry-drizzle-mysql.d.cts +55 -0
  134. package/dist/entry-drizzle-mysql.d.mts +55 -0
  135. package/dist/entry-drizzle-mysql.mjs +34 -0
  136. package/dist/entry-drizzle-mysql.mjs.map +1 -0
  137. package/dist/entry-drizzle-pg.cjs +38 -0
  138. package/dist/entry-drizzle-pg.cjs.map +1 -0
  139. package/dist/entry-drizzle-pg.d.cts +78 -0
  140. package/dist/entry-drizzle-pg.d.mts +78 -0
  141. package/dist/entry-drizzle-pg.mjs +36 -0
  142. package/dist/entry-drizzle-pg.mjs.map +1 -0
  143. package/dist/entry-drizzle-sqlite.cjs +20 -0
  144. package/dist/entry-drizzle-sqlite.cjs.map +1 -0
  145. package/dist/entry-drizzle-sqlite.d.cts +22 -0
  146. package/dist/entry-drizzle-sqlite.d.mts +22 -0
  147. package/dist/entry-drizzle-sqlite.mjs +19 -0
  148. package/dist/entry-drizzle-sqlite.mjs.map +1 -0
  149. package/dist/entry-hooks-log.cjs +32 -0
  150. package/dist/entry-hooks-log.cjs.map +1 -0
  151. package/dist/entry-hooks-log.d.cts +36 -0
  152. package/dist/entry-hooks-log.d.mts +36 -0
  153. package/dist/entry-hooks-log.mjs +31 -0
  154. package/dist/entry-hooks-log.mjs.map +1 -0
  155. package/dist/entry-hooks.cjs +10 -0
  156. package/dist/entry-hooks.d.cts +2 -0
  157. package/dist/entry-hooks.d.mts +2 -0
  158. package/dist/entry-hooks.mjs +2 -0
  159. package/dist/entry-server-router.cjs +235 -0
  160. package/dist/entry-server-router.cjs.map +1 -0
  161. package/dist/entry-server-router.d.cts +193 -0
  162. package/dist/entry-server-router.d.mts +193 -0
  163. package/dist/entry-server-router.mjs +228 -0
  164. package/dist/entry-server-router.mjs.map +1 -0
  165. package/dist/entry-server.cjs +344 -0
  166. package/dist/entry-server.cjs.map +1 -0
  167. package/dist/entry-server.d.cts +230 -0
  168. package/dist/entry-server.d.mts +230 -0
  169. package/dist/entry-server.mjs +322 -0
  170. package/dist/entry-server.mjs.map +1 -0
  171. package/dist/entry-site.cjs +1083 -0
  172. package/dist/entry-site.cjs.map +1 -0
  173. package/dist/entry-site.d.cts +336 -0
  174. package/dist/entry-site.d.mts +336 -0
  175. package/dist/entry-site.mjs +1060 -0
  176. package/dist/entry-site.mjs.map +1 -0
  177. package/dist/entry-storage-cloudflare-kv.cjs +51 -0
  178. package/dist/entry-storage-cloudflare-kv.cjs.map +1 -0
  179. package/dist/entry-storage-cloudflare-kv.d.cts +52 -0
  180. package/dist/entry-storage-cloudflare-kv.d.mts +52 -0
  181. package/dist/entry-storage-cloudflare-kv.mjs +50 -0
  182. package/dist/entry-storage-cloudflare-kv.mjs.map +1 -0
  183. package/dist/entry-storage-drizzle-internals.cjs +6 -0
  184. package/dist/entry-storage-drizzle-internals.d.cts +2 -0
  185. package/dist/entry-storage-drizzle-internals.d.mts +2 -0
  186. package/dist/entry-storage-drizzle-internals.mjs +2 -0
  187. package/dist/entry-storage-drizzle.cjs +4 -0
  188. package/dist/entry-storage-drizzle.d.cts +3 -0
  189. package/dist/entry-storage-drizzle.d.mts +3 -0
  190. package/dist/entry-storage-drizzle.mjs +2 -0
  191. package/dist/entry-storage-file.cjs +306 -0
  192. package/dist/entry-storage-file.cjs.map +1 -0
  193. package/dist/entry-storage-file.d.cts +76 -0
  194. package/dist/entry-storage-file.d.mts +76 -0
  195. package/dist/entry-storage-file.mjs +301 -0
  196. package/dist/entry-storage-file.mjs.map +1 -0
  197. package/dist/entry-storage-libsql-internals.cjs +7 -0
  198. package/dist/entry-storage-libsql-internals.d.cts +3 -0
  199. package/dist/entry-storage-libsql-internals.d.mts +3 -0
  200. package/dist/entry-storage-libsql-internals.mjs +3 -0
  201. package/dist/entry-storage-libsql.cjs +3 -0
  202. package/dist/entry-storage-libsql.d.cts +2 -0
  203. package/dist/entry-storage-libsql.d.mts +2 -0
  204. package/dist/entry-storage-libsql.mjs +2 -0
  205. package/dist/entry-storage-memory.cjs +78 -0
  206. package/dist/entry-storage-memory.cjs.map +1 -0
  207. package/dist/entry-storage-memory.d.cts +35 -0
  208. package/dist/entry-storage-memory.d.mts +35 -0
  209. package/dist/entry-storage-memory.mjs +77 -0
  210. package/dist/entry-storage-memory.mjs.map +1 -0
  211. package/dist/entry-storage-mongodb-internals.cjs +5 -0
  212. package/dist/entry-storage-mongodb-internals.d.cts +2 -0
  213. package/dist/entry-storage-mongodb-internals.d.mts +2 -0
  214. package/dist/entry-storage-mongodb-internals.mjs +2 -0
  215. package/dist/entry-storage-mongodb.cjs +3 -0
  216. package/dist/entry-storage-mongodb.d.cts +2 -0
  217. package/dist/entry-storage-mongodb.d.mts +2 -0
  218. package/dist/entry-storage-mongodb.mjs +2 -0
  219. package/dist/entry-storage-postgres-internals.cjs +6 -0
  220. package/dist/entry-storage-postgres-internals.d.cts +2 -0
  221. package/dist/entry-storage-postgres-internals.d.mts +2 -0
  222. package/dist/entry-storage-postgres-internals.mjs +2 -0
  223. package/dist/entry-storage-postgres.cjs +4 -0
  224. package/dist/entry-storage-postgres.d.cts +2 -0
  225. package/dist/entry-storage-postgres.d.mts +2 -0
  226. package/dist/entry-storage-postgres.mjs +2 -0
  227. package/dist/entry-storage-redis-internals.cjs +7 -0
  228. package/dist/entry-storage-redis-internals.d.cts +2 -0
  229. package/dist/entry-storage-redis-internals.d.mts +2 -0
  230. package/dist/entry-storage-redis-internals.mjs +2 -0
  231. package/dist/entry-storage-redis.cjs +4 -0
  232. package/dist/entry-storage-redis.d.cts +2 -0
  233. package/dist/entry-storage-redis.d.mts +2 -0
  234. package/dist/entry-storage-redis.mjs +2 -0
  235. package/dist/entry-storage-sqlite-internals.cjs +7 -0
  236. package/dist/entry-storage-sqlite-internals.d.cts +3 -0
  237. package/dist/entry-storage-sqlite-internals.d.mts +3 -0
  238. package/dist/entry-storage-sqlite-internals.mjs +3 -0
  239. package/dist/entry-storage-sqlite.cjs +3 -0
  240. package/dist/entry-storage-sqlite.d.cts +2 -0
  241. package/dist/entry-storage-sqlite.d.mts +2 -0
  242. package/dist/entry-storage-sqlite.mjs +2 -0
  243. package/dist/entry-storage-testing.cjs +801 -0
  244. package/dist/entry-storage-testing.cjs.map +1 -0
  245. package/dist/entry-storage-testing.d.cts +150 -0
  246. package/dist/entry-storage-testing.d.mts +150 -0
  247. package/dist/entry-storage-testing.mjs +790 -0
  248. package/dist/entry-storage-testing.mjs.map +1 -0
  249. package/dist/entry-storage-unstorage.cjs +78 -0
  250. package/dist/entry-storage-unstorage.cjs.map +1 -0
  251. package/dist/entry-storage-unstorage.d.cts +30 -0
  252. package/dist/entry-storage-unstorage.d.mts +30 -0
  253. package/dist/entry-storage-unstorage.mjs +77 -0
  254. package/dist/entry-storage-unstorage.mjs.map +1 -0
  255. package/dist/entry-storage.cjs +114 -0
  256. package/dist/entry-storage.cjs.map +1 -0
  257. package/dist/entry-storage.d.cts +152 -0
  258. package/dist/entry-storage.d.mts +152 -0
  259. package/dist/entry-storage.mjs +91 -0
  260. package/dist/entry-storage.mjs.map +1 -0
  261. package/dist/entry-testing.cjs +79 -0
  262. package/dist/entry-testing.cjs.map +1 -0
  263. package/dist/entry-testing.d.cts +55 -0
  264. package/dist/entry-testing.d.mts +55 -0
  265. package/dist/entry-testing.mjs +77 -0
  266. package/dist/entry-testing.mjs.map +1 -0
  267. package/dist/entry-tokens.cjs +4 -0
  268. package/dist/entry-tokens.d.cts +85 -0
  269. package/dist/entry-tokens.d.mts +85 -0
  270. package/dist/entry-tokens.mjs +2 -0
  271. package/dist/entry-ui-embed.cjs +131 -0
  272. package/dist/entry-ui-embed.cjs.map +1 -0
  273. package/dist/entry-ui-embed.d.cts +87 -0
  274. package/dist/entry-ui-embed.d.mts +87 -0
  275. package/dist/entry-ui-embed.mjs +127 -0
  276. package/dist/entry-ui-embed.mjs.map +1 -0
  277. package/dist/entry-ui.cjs +795 -0
  278. package/dist/entry-ui.cjs.map +1 -0
  279. package/dist/entry-ui.d.cts +574 -0
  280. package/dist/entry-ui.d.mts +574 -0
  281. package/dist/entry-ui.mjs +731 -0
  282. package/dist/entry-ui.mjs.map +1 -0
  283. package/dist/entry-util.cjs +145 -0
  284. package/dist/entry-util.cjs.map +1 -0
  285. package/dist/entry-util.d.cts +85 -0
  286. package/dist/entry-util.d.mts +85 -0
  287. package/dist/entry-util.mjs +130 -0
  288. package/dist/entry-util.mjs.map +1 -0
  289. package/dist/http-B_rTnLW9.cjs +235 -0
  290. package/dist/http-B_rTnLW9.cjs.map +1 -0
  291. package/dist/http-CxYM7kPT.d.mts +133 -0
  292. package/dist/http-DVdVI6kJ.mjs +164 -0
  293. package/dist/http-DVdVI6kJ.mjs.map +1 -0
  294. package/dist/http-XBVRk8uo.d.cts +133 -0
  295. package/dist/index.cjs +8 -0
  296. package/dist/index.cjs.map +1 -0
  297. package/dist/index.d.cts +6 -0
  298. package/dist/index.d.mts +6 -0
  299. package/dist/index.mjs +7 -0
  300. package/dist/index.mjs.map +1 -0
  301. package/dist/json-CCyzstIm.d.cts +44 -0
  302. package/dist/json-CCyzstIm.d.mts +44 -0
  303. package/dist/json-CM7TwYQ7.cjs +92 -0
  304. package/dist/json-CM7TwYQ7.cjs.map +1 -0
  305. package/dist/json-CmM1M5Kz.mjs +63 -0
  306. package/dist/json-CmM1M5Kz.mjs.map +1 -0
  307. package/dist/keys-Bwubabk0.mjs +73 -0
  308. package/dist/keys-Bwubabk0.mjs.map +1 -0
  309. package/dist/keys-DQrwxDKI.cjs +126 -0
  310. package/dist/keys-DQrwxDKI.cjs.map +1 -0
  311. package/dist/kv-sqlite-B6iTLOx2.d.cts +20 -0
  312. package/dist/kv-sqlite-CHOdIMJ-.cjs +77 -0
  313. package/dist/kv-sqlite-CHOdIMJ-.cjs.map +1 -0
  314. package/dist/kv-sqlite-DIIPfflJ.mjs +66 -0
  315. package/dist/kv-sqlite-DIIPfflJ.mjs.map +1 -0
  316. package/dist/kv-sqlite-Tx4UedJs.d.mts +20 -0
  317. package/dist/libsql-0160BubR.d.mts +65 -0
  318. package/dist/libsql-BZmRZIqt.d.cts +65 -0
  319. package/dist/libsql-CiBfVtbS.cjs +103 -0
  320. package/dist/libsql-CiBfVtbS.cjs.map +1 -0
  321. package/dist/libsql-CkOjQINi.mjs +86 -0
  322. package/dist/libsql-CkOjQINi.mjs.map +1 -0
  323. package/dist/mongodb--Cuj7V_9.cjs +150 -0
  324. package/dist/mongodb--Cuj7V_9.cjs.map +1 -0
  325. package/dist/mongodb-DGtsolQ2.d.cts +61 -0
  326. package/dist/mongodb-JMizy4Wg.mjs +127 -0
  327. package/dist/mongodb-JMizy4Wg.mjs.map +1 -0
  328. package/dist/mongodb-xGEU5Gwz.d.mts +61 -0
  329. package/dist/node-B1Djcwfi.d.cts +57 -0
  330. package/dist/node-B1Djcwfi.d.mts +57 -0
  331. package/dist/node-BYjocCbU.mjs +167 -0
  332. package/dist/node-BYjocCbU.mjs.map +1 -0
  333. package/dist/node-DFFqYRk-.cjs +201 -0
  334. package/dist/node-DFFqYRk-.cjs.map +1 -0
  335. package/dist/none-BEY7Kc_-.mjs +33 -0
  336. package/dist/none-BEY7Kc_-.mjs.map +1 -0
  337. package/dist/none-BoQ6-30P.cjs +33 -0
  338. package/dist/none-BoQ6-30P.cjs.map +1 -0
  339. package/dist/none-CHwVkQL-.cjs +49 -0
  340. package/dist/none-CHwVkQL-.cjs.map +1 -0
  341. package/dist/none-yu3qC47E.mjs +23 -0
  342. package/dist/none-yu3qC47E.mjs.map +1 -0
  343. package/dist/peer-BIjBFzwQ.cjs +56 -0
  344. package/dist/peer-BIjBFzwQ.cjs.map +1 -0
  345. package/dist/peer-CTHMzOdn.mjs +40 -0
  346. package/dist/peer-CTHMzOdn.mjs.map +1 -0
  347. package/dist/portal-container-CJIcau3B.mjs +610 -0
  348. package/dist/portal-container-CJIcau3B.mjs.map +1 -0
  349. package/dist/portal-container-Ca1NxrLE.cjs +774 -0
  350. package/dist/portal-container-Ca1NxrLE.cjs.map +1 -0
  351. package/dist/postgres-BJzxKBk0.d.cts +72 -0
  352. package/dist/postgres-CA8_XcAE.cjs +164 -0
  353. package/dist/postgres-CA8_XcAE.cjs.map +1 -0
  354. package/dist/postgres-RfQMgAsj.d.mts +72 -0
  355. package/dist/postgres-aDiBmNzr.mjs +135 -0
  356. package/dist/postgres-aDiBmNzr.mjs.map +1 -0
  357. package/dist/redis-B2AS4xAQ.cjs +259 -0
  358. package/dist/redis-B2AS4xAQ.cjs.map +1 -0
  359. package/dist/redis-B362ofBw.d.cts +159 -0
  360. package/dist/redis-CahNAVTW.d.mts +159 -0
  361. package/dist/redis-hdoKymfG.mjs +218 -0
  362. package/dist/redis-hdoKymfG.mjs.map +1 -0
  363. package/dist/roles-7JPrQXZa.mjs +46 -0
  364. package/dist/roles-7JPrQXZa.mjs.map +1 -0
  365. package/dist/roles-B_8QqJ3j.cjs +56 -0
  366. package/dist/roles-B_8QqJ3j.cjs.map +1 -0
  367. package/dist/roles-DLISB4T3.d.mts +41 -0
  368. package/dist/roles-DQbbtUPW.d.cts +41 -0
  369. package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
  370. package/dist/scope-css-BN3jf0ly.cjs +315 -0
  371. package/dist/scope-css-BN3jf0ly.cjs.map +1 -0
  372. package/dist/scope-css-BuJfRCsE.mjs +256 -0
  373. package/dist/scope-css-BuJfRCsE.mjs.map +1 -0
  374. package/dist/scoped-BRoE1W1x.cjs +175 -0
  375. package/dist/scoped-BRoE1W1x.cjs.map +1 -0
  376. package/dist/scoped-cFBbotCh.mjs +164 -0
  377. package/dist/scoped-cFBbotCh.mjs.map +1 -0
  378. package/dist/sqlite-B2g1JJz1.d.cts +47 -0
  379. package/dist/sqlite-BIPIlxfj.d.mts +47 -0
  380. package/dist/sqlite-BntoYaXZ.cjs +79 -0
  381. package/dist/sqlite-BntoYaXZ.cjs.map +1 -0
  382. package/dist/sqlite-DYJDcu7p.mjs +62 -0
  383. package/dist/sqlite-DYJDcu7p.mjs.map +1 -0
  384. package/dist/table-BrioFSra.d.cts +11 -0
  385. package/dist/table-BrioFSra.d.mts +11 -0
  386. package/dist/theme-context-DzZ1otaD.d.cts +270 -0
  387. package/dist/theme-context-J65pythD.d.mts +270 -0
  388. package/dist/ui/styles.css +239 -0
  389. package/dist/util-Dnj5T-yw.mjs +39 -0
  390. package/dist/util-Dnj5T-yw.mjs.map +1 -0
  391. package/dist/util-dAnTK9x-.cjs +74 -0
  392. package/dist/util-dAnTK9x-.cjs.map +1 -0
  393. package/dist/validation-B-atP968.mjs +191 -0
  394. package/dist/validation-B-atP968.mjs.map +1 -0
  395. package/dist/validation-BJifGoB2.d.mts +122 -0
  396. package/dist/validation-DLnzBVJr.cjs +258 -0
  397. package/dist/validation-DLnzBVJr.cjs.map +1 -0
  398. package/dist/validation-tfV2qhbD.d.cts +122 -0
  399. package/package.json +715 -4
  400. package/tsconfig/assets.d.ts +21 -0
  401. package/tsconfig/base.json +21 -0
  402. package/tsconfig/react.json +9 -0
@@ -0,0 +1,122 @@
1
+ import { n as JsonValue, t as JsonObject } from "./json-CCyzstIm.mjs";
2
+ import * as v from "valibot";
3
+
4
+ //#region src/util/validation.d.ts
5
+ /** A single validation problem with a dotted path into the offending data. */
6
+ interface ValidationIssue {
7
+ path: string;
8
+ message: string;
9
+ }
10
+ /** Result of a `validate*` function. */
11
+ interface ValidationResult {
12
+ valid: boolean;
13
+ errors: ValidationIssue[];
14
+ }
15
+ /**
16
+ * Raised when an input fails validation. It carries the issues as both
17
+ * `errors` (webhooks/audit/links) and `issues` (entitlements); they are the
18
+ * same array.
19
+ */
20
+ declare class ValidationError extends Error {
21
+ readonly errors: ValidationIssue[];
22
+ constructor(errors: ValidationIssue[], message?: string);
23
+ /** Alias of {@link ValidationError.errors}. */
24
+ get issues(): ValidationIssue[];
25
+ }
26
+ /** Throw a {@link ValidationError} when `result` is invalid. */
27
+ declare function assertValid(result: ValidationResult): void;
28
+ /** A `{ valid, errors }` result from a list of issues. */
29
+ declare const resultOf: (errors: ValidationIssue[]) => ValidationResult;
30
+ /**
31
+ * Map valibot issues to {@link ValidationIssue}s under `basePath`. A root
32
+ * issue gets `basePath` itself (no trailing `.`); a strict object's extra key
33
+ * (valibot reports it as "expected never") reads `"unknown field"`.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const r = v.safeParse(schema, input);
38
+ * if (!r.success) return { valid: false, errors: issuesFrom(r.issues, "link") };
39
+ * ```
40
+ */
41
+ declare function issuesFrom(issues: readonly v.BaseIssue<unknown>[], basePath?: string): ValidationIssue[];
42
+ /** Options for {@link parseInput}. */
43
+ interface ParseInputOptions {
44
+ /** Prefix for every issue path. Default `""` (paths are relative to the input). */
45
+ basePath?: string;
46
+ /**
47
+ * Build the error to throw. Default: a {@link ValidationError}. A product
48
+ * passes its own error class here to keep its `name`/HTTP mapping.
49
+ */
50
+ error?: (issues: ValidationIssue[]) => Error;
51
+ }
52
+ /**
53
+ * Validate `input` against `schema`; return the typed output or throw a
54
+ * {@link ValidationError} listing every issue.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * const grant = parseInput(grantSchema, await request.json());
59
+ * ```
60
+ */
61
+ declare function parseInput<S extends v.GenericSchema>(schema: S, input: unknown, options?: ParseInputOptions): v.InferOutput<S>;
62
+ /**
63
+ * A valibot schema for a JSON value. Numbers must be **finite**: `NaN` and
64
+ * `±Infinity` would silently serialise to `null`.
65
+ */
66
+ declare const jsonValueSchema: v.GenericSchema<JsonValue>;
67
+ /** A valibot schema for a JSON object (finite numbers, see {@link jsonValueSchema}). */
68
+ declare const jsonObjectSchema: v.GenericSchema<unknown, JsonObject>;
69
+ /** The characters allowed in a caller-supplied storage key segment. */
70
+ declare const KEY_SEGMENT_REGEX: RegExp;
71
+ /**
72
+ * Check a caller-supplied value that becomes one storage key segment (a
73
+ * tenant, an idempotency key…). It must be a non-empty string of
74
+ * {@link KEY_SEGMENT_REGEX} characters and must not be only dots, so it can't
75
+ * escape its namespace (`..`) or collide with the separator.
76
+ */
77
+ declare function validateKeySegment(value: unknown, path: string): ValidationIssue[];
78
+ /** Schemes {@link validateUrl} always rejects: they run code or read local data. */
79
+ declare const FORBIDDEN_URL_SCHEMES: ReadonlySet<string>;
80
+ /** Options for {@link validateUrl}. */
81
+ interface UrlPolicyOptions {
82
+ /**
83
+ * Allowed schemes, with the trailing colon (`["https:", "http:"]`). Default:
84
+ * any scheme except {@link FORBIDDEN_URL_SCHEMES} (app deep links such as
85
+ * `myapp://` pass).
86
+ */
87
+ allowedSchemes?: readonly string[];
88
+ /**
89
+ * Reject plain `http:` except for localhost (see `allowLocalhost`). Default
90
+ * `false`. Webhook endpoints set it; link destinations don't.
91
+ */
92
+ requireHttps?: boolean;
93
+ /** With `requireHttps`, still accept `http:` for localhost / loopback. Default `true`. */
94
+ allowLocalhost?: boolean;
95
+ /** Reject URLs with embedded credentials (`https://user:pass@…`). Default `false`. */
96
+ rejectCredentials?: boolean;
97
+ /** Maximum length. Default `8192`. */
98
+ maxLength?: number;
99
+ /**
100
+ * Extra host-supplied check (an SSRF denylist…). Return a message or `false`
101
+ * to reject; `true`, `null` or `undefined` to accept.
102
+ */
103
+ policy?: (url: URL) => string | boolean | null | undefined;
104
+ }
105
+ /**
106
+ * Check an absolute URL against a policy; returns the issues (empty when the
107
+ * URL is acceptable). Dangerous schemes are always rejected.
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * // A webhook endpoint: https only (http on localhost), no credentials.
112
+ * validateUrl(url, "endpoint.url", {
113
+ * allowedSchemes: ["https:", "http:"],
114
+ * requireHttps: true,
115
+ * rejectCredentials: true,
116
+ * });
117
+ * ```
118
+ */
119
+ declare function validateUrl(value: unknown, path: string, options?: UrlPolicyOptions): ValidationIssue[];
120
+ //#endregion
121
+ export { ValidationError as a, assertValid as c, jsonValueSchema as d, parseInput as f, validateUrl as h, UrlPolicyOptions as i, issuesFrom as l, validateKeySegment as m, KEY_SEGMENT_REGEX as n, ValidationIssue as o, resultOf as p, ParseInputOptions as r, ValidationResult as s, FORBIDDEN_URL_SCHEMES as t, jsonObjectSchema as u };
122
+ //# sourceMappingURL=validation-BJifGoB2.d.mts.map
@@ -0,0 +1,258 @@
1
+ const require_chunk = require("./chunk-DakpK96I.cjs");
2
+ let valibot = require("valibot");
3
+ valibot = require_chunk.__toESM(valibot, 1);
4
+ //#region src/util/validation.ts
5
+ /**
6
+ * The validation core shared by the products, built on `valibot` (the kit's
7
+ * only runtime dependency): the issue and error types, a valibot issue mapper,
8
+ * `parseInput`, a finite JSON-value schema, the storage key-segment check and
9
+ * a URL policy check. Product schemas stay in the products.
10
+ *
11
+ * @module
12
+ */
13
+ /**
14
+ * Raised when an input fails validation. It carries the issues as both
15
+ * `errors` (webhooks/audit/links) and `issues` (entitlements); they are the
16
+ * same array.
17
+ */
18
+ var ValidationError = class extends Error {
19
+ errors;
20
+ constructor(errors, message) {
21
+ super(message ?? `Validation failed:\n${errors.map((e) => ` - ${e.path ? `${e.path}: ` : ""}${e.message}`).join("\n")}`);
22
+ this.name = "ValidationError";
23
+ this.errors = errors;
24
+ }
25
+ /** Alias of {@link ValidationError.errors}. */
26
+ get issues() {
27
+ return this.errors;
28
+ }
29
+ };
30
+ /** Throw a {@link ValidationError} when `result` is invalid. */
31
+ function assertValid(result) {
32
+ if (!result.valid) throw new ValidationError(result.errors);
33
+ }
34
+ /** A `{ valid, errors }` result from a list of issues. */
35
+ const resultOf = (errors) => ({
36
+ valid: errors.length === 0,
37
+ errors
38
+ });
39
+ /**
40
+ * Map valibot issues to {@link ValidationIssue}s under `basePath`. A root
41
+ * issue gets `basePath` itself (no trailing `.`); a strict object's extra key
42
+ * (valibot reports it as "expected never") reads `"unknown field"`.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * const r = v.safeParse(schema, input);
47
+ * if (!r.success) return { valid: false, errors: issuesFrom(r.issues, "link") };
48
+ * ```
49
+ */
50
+ function issuesFrom(issues, basePath = "") {
51
+ return issues.map((issue) => {
52
+ const sub = (issue.path ?? []).map((p) => String(p.key)).join(".");
53
+ return {
54
+ path: sub ? basePath ? `${basePath}.${sub}` : sub : basePath,
55
+ message: issue.expected === "never" ? "unknown field" : issue.message
56
+ };
57
+ });
58
+ }
59
+ /**
60
+ * Validate `input` against `schema`; return the typed output or throw a
61
+ * {@link ValidationError} listing every issue.
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * const grant = parseInput(grantSchema, await request.json());
66
+ * ```
67
+ */
68
+ function parseInput(schema, input, options = {}) {
69
+ const result = valibot.safeParse(schema, input);
70
+ if (result.success) return result.output;
71
+ const issues = issuesFrom(result.issues, options.basePath);
72
+ throw options.error ? options.error(issues) : new ValidationError(issues);
73
+ }
74
+ /**
75
+ * A valibot schema for a JSON value. Numbers must be **finite**: `NaN` and
76
+ * `±Infinity` would silently serialise to `null`.
77
+ */
78
+ const jsonValueSchema = valibot.lazy(() => valibot.union([
79
+ valibot.string(),
80
+ valibot.pipe(valibot.number(), valibot.finite()),
81
+ valibot.boolean(),
82
+ valibot.null(),
83
+ valibot.array(jsonValueSchema),
84
+ valibot.record(valibot.string(), jsonValueSchema)
85
+ ]));
86
+ /** A valibot schema for a JSON object (finite numbers, see {@link jsonValueSchema}). */
87
+ const jsonObjectSchema = valibot.pipe(valibot.custom((value) => typeof value === "object" && value !== null && !Array.isArray(value), "must be an object"), valibot.record(valibot.string(), jsonValueSchema));
88
+ /** The characters allowed in a caller-supplied storage key segment. */
89
+ const KEY_SEGMENT_REGEX = /^[a-zA-Z0-9._-]+$/;
90
+ /**
91
+ * Check a caller-supplied value that becomes one storage key segment (a
92
+ * tenant, an idempotency key…). It must be a non-empty string of
93
+ * {@link KEY_SEGMENT_REGEX} characters and must not be only dots, so it can't
94
+ * escape its namespace (`..`) or collide with the separator.
95
+ */
96
+ function validateKeySegment(value, path) {
97
+ if (typeof value !== "string" || value.length === 0) return [{
98
+ path,
99
+ message: "is required"
100
+ }];
101
+ if (!KEY_SEGMENT_REGEX.test(value)) return [{
102
+ path,
103
+ message: `must match ${KEY_SEGMENT_REGEX}`
104
+ }];
105
+ if (/^\.+$/.test(value)) return [{
106
+ path,
107
+ message: `"${value}" is not an allowed key`
108
+ }];
109
+ return [];
110
+ }
111
+ /** Schemes {@link validateUrl} always rejects: they run code or read local data. */
112
+ const FORBIDDEN_URL_SCHEMES = new Set([
113
+ "javascript:",
114
+ "data:",
115
+ "vbscript:",
116
+ "file:",
117
+ "blob:",
118
+ "about:"
119
+ ]);
120
+ const LOCAL_HOSTS = new Set([
121
+ "localhost",
122
+ "127.0.0.1",
123
+ "[::1]",
124
+ "::1"
125
+ ]);
126
+ /**
127
+ * Check an absolute URL against a policy; returns the issues (empty when the
128
+ * URL is acceptable). Dangerous schemes are always rejected.
129
+ *
130
+ * @example
131
+ * ```ts
132
+ * // A webhook endpoint: https only (http on localhost), no credentials.
133
+ * validateUrl(url, "endpoint.url", {
134
+ * allowedSchemes: ["https:", "http:"],
135
+ * requireHttps: true,
136
+ * rejectCredentials: true,
137
+ * });
138
+ * ```
139
+ */
140
+ function validateUrl(value, path, options = {}) {
141
+ if (typeof value !== "string" || value.length === 0) return [{
142
+ path,
143
+ message: "is required"
144
+ }];
145
+ const maxLength = options.maxLength ?? 8192;
146
+ if (value.length > maxLength) return [{
147
+ path,
148
+ message: `must be at most ${maxLength} characters`
149
+ }];
150
+ let url;
151
+ try {
152
+ url = new URL(value);
153
+ } catch {
154
+ return [{
155
+ path,
156
+ message: "must be an absolute URL"
157
+ }];
158
+ }
159
+ if (FORBIDDEN_URL_SCHEMES.has(url.protocol)) return [{
160
+ path,
161
+ message: `scheme ${url.protocol} is not allowed`
162
+ }];
163
+ if (options.allowedSchemes && !options.allowedSchemes.includes(url.protocol)) return [{
164
+ path,
165
+ message: `unsupported protocol "${url.protocol}"`
166
+ }];
167
+ if ((url.protocol === "http:" || url.protocol === "https:") && !url.hostname) return [{
168
+ path,
169
+ message: "must have a host"
170
+ }];
171
+ if (options.rejectCredentials && (url.username || url.password)) return [{
172
+ path,
173
+ message: "URL must not contain credentials"
174
+ }];
175
+ if (options.requireHttps && url.protocol === "http:" && !((options.allowLocalhost ?? true) && LOCAL_HOSTS.has(url.hostname))) return [{
176
+ path,
177
+ message: "http URLs are only allowed for localhost"
178
+ }];
179
+ const verdict = options.policy?.(url);
180
+ if (typeof verdict === "string") return [{
181
+ path,
182
+ message: verdict
183
+ }];
184
+ if (verdict === false) return [{
185
+ path,
186
+ message: "URL rejected by the configured policy"
187
+ }];
188
+ return [];
189
+ }
190
+ //#endregion
191
+ Object.defineProperty(exports, "FORBIDDEN_URL_SCHEMES", {
192
+ enumerable: true,
193
+ get: function() {
194
+ return FORBIDDEN_URL_SCHEMES;
195
+ }
196
+ });
197
+ Object.defineProperty(exports, "KEY_SEGMENT_REGEX", {
198
+ enumerable: true,
199
+ get: function() {
200
+ return KEY_SEGMENT_REGEX;
201
+ }
202
+ });
203
+ Object.defineProperty(exports, "ValidationError", {
204
+ enumerable: true,
205
+ get: function() {
206
+ return ValidationError;
207
+ }
208
+ });
209
+ Object.defineProperty(exports, "assertValid", {
210
+ enumerable: true,
211
+ get: function() {
212
+ return assertValid;
213
+ }
214
+ });
215
+ Object.defineProperty(exports, "issuesFrom", {
216
+ enumerable: true,
217
+ get: function() {
218
+ return issuesFrom;
219
+ }
220
+ });
221
+ Object.defineProperty(exports, "jsonObjectSchema", {
222
+ enumerable: true,
223
+ get: function() {
224
+ return jsonObjectSchema;
225
+ }
226
+ });
227
+ Object.defineProperty(exports, "jsonValueSchema", {
228
+ enumerable: true,
229
+ get: function() {
230
+ return jsonValueSchema;
231
+ }
232
+ });
233
+ Object.defineProperty(exports, "parseInput", {
234
+ enumerable: true,
235
+ get: function() {
236
+ return parseInput;
237
+ }
238
+ });
239
+ Object.defineProperty(exports, "resultOf", {
240
+ enumerable: true,
241
+ get: function() {
242
+ return resultOf;
243
+ }
244
+ });
245
+ Object.defineProperty(exports, "validateKeySegment", {
246
+ enumerable: true,
247
+ get: function() {
248
+ return validateKeySegment;
249
+ }
250
+ });
251
+ Object.defineProperty(exports, "validateUrl", {
252
+ enumerable: true,
253
+ get: function() {
254
+ return validateUrl;
255
+ }
256
+ });
257
+
258
+ //# sourceMappingURL=validation-DLnzBVJr.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation-DLnzBVJr.cjs","names":["v"],"sources":["../src/util/validation.ts"],"sourcesContent":["/**\n * The validation core shared by the products, built on `valibot` (the kit's\n * only runtime dependency): the issue and error types, a valibot issue mapper,\n * `parseInput`, a finite JSON-value schema, the storage key-segment check and\n * a URL policy check. Product schemas stay in the products.\n *\n * @module\n */\n\nimport * as v from \"valibot\";\nimport type { JsonObject, JsonValue } from \"../internal/json.ts\";\n\n/** A single validation problem with a dotted path into the offending data. */\nexport interface ValidationIssue {\n path: string;\n message: string;\n}\n\n/** Result of a `validate*` function. */\nexport interface ValidationResult {\n valid: boolean;\n errors: ValidationIssue[];\n}\n\n/**\n * Raised when an input fails validation. It carries the issues as both\n * `errors` (webhooks/audit/links) and `issues` (entitlements); they are the\n * same array.\n */\nexport class ValidationError extends Error {\n readonly errors: ValidationIssue[];\n constructor(errors: ValidationIssue[], message?: string) {\n super(\n message ??\n `Validation failed:\\n${errors.map((e) => ` - ${e.path ? `${e.path}: ` : \"\"}${e.message}`).join(\"\\n\")}`,\n );\n this.name = \"ValidationError\";\n this.errors = errors;\n }\n /** Alias of {@link ValidationError.errors}. */\n get issues(): ValidationIssue[] {\n return this.errors;\n }\n}\n\n/** Throw a {@link ValidationError} when `result` is invalid. */\nexport function assertValid(result: ValidationResult): void {\n if (!result.valid) throw new ValidationError(result.errors);\n}\n\n/** A `{ valid, errors }` result from a list of issues. */\nexport const resultOf = (errors: ValidationIssue[]): ValidationResult => ({\n valid: errors.length === 0,\n errors,\n});\n\n/**\n * Map valibot issues to {@link ValidationIssue}s under `basePath`. A root\n * issue gets `basePath` itself (no trailing `.`); a strict object's extra key\n * (valibot reports it as \"expected never\") reads `\"unknown field\"`.\n *\n * @example\n * ```ts\n * const r = v.safeParse(schema, input);\n * if (!r.success) return { valid: false, errors: issuesFrom(r.issues, \"link\") };\n * ```\n */\nexport function issuesFrom(\n issues: readonly v.BaseIssue<unknown>[],\n basePath = \"\",\n): ValidationIssue[] {\n return issues.map((issue) => {\n const sub = (issue.path ?? []).map((p) => String(p.key)).join(\".\");\n const path = sub ? (basePath ? `${basePath}.${sub}` : sub) : basePath;\n return { path, message: issue.expected === \"never\" ? \"unknown field\" : issue.message };\n });\n}\n\n/** Options for {@link parseInput}. */\nexport interface ParseInputOptions {\n /** Prefix for every issue path. Default `\"\"` (paths are relative to the input). */\n basePath?: string;\n /**\n * Build the error to throw. Default: a {@link ValidationError}. A product\n * passes its own error class here to keep its `name`/HTTP mapping.\n */\n error?: (issues: ValidationIssue[]) => Error;\n}\n\n/**\n * Validate `input` against `schema`; return the typed output or throw a\n * {@link ValidationError} listing every issue.\n *\n * @example\n * ```ts\n * const grant = parseInput(grantSchema, await request.json());\n * ```\n */\nexport function parseInput<S extends v.GenericSchema>(\n schema: S,\n input: unknown,\n options: ParseInputOptions = {},\n): v.InferOutput<S> {\n const result = v.safeParse(schema, input);\n if (result.success) return result.output;\n const issues = issuesFrom(result.issues, options.basePath);\n throw options.error ? options.error(issues) : new ValidationError(issues);\n}\n\n/**\n * A valibot schema for a JSON value. Numbers must be **finite**: `NaN` and\n * `±Infinity` would silently serialise to `null`.\n */\nexport const jsonValueSchema: v.GenericSchema<JsonValue> = v.lazy(() =>\n v.union([\n v.string(),\n v.pipe(v.number(), v.finite()),\n v.boolean(),\n v.null(),\n v.array(jsonValueSchema),\n v.record(v.string(), jsonValueSchema),\n ]),\n);\n\n/** A valibot schema for a JSON object (finite numbers, see {@link jsonValueSchema}). */\nexport const jsonObjectSchema: v.GenericSchema<unknown, JsonObject> = v.pipe(\n v.custom<object>(\n (value) => typeof value === \"object\" && value !== null && !Array.isArray(value),\n \"must be an object\",\n ),\n v.record(v.string(), jsonValueSchema),\n);\n\n/** The characters allowed in a caller-supplied storage key segment. */\nexport const KEY_SEGMENT_REGEX = /^[a-zA-Z0-9._-]+$/;\n\n/**\n * Check a caller-supplied value that becomes one storage key segment (a\n * tenant, an idempotency key…). It must be a non-empty string of\n * {@link KEY_SEGMENT_REGEX} characters and must not be only dots, so it can't\n * escape its namespace (`..`) or collide with the separator.\n */\nexport function validateKeySegment(value: unknown, path: string): ValidationIssue[] {\n if (typeof value !== \"string\" || value.length === 0) return [{ path, message: \"is required\" }];\n if (!KEY_SEGMENT_REGEX.test(value)) return [{ path, message: `must match ${KEY_SEGMENT_REGEX}` }];\n if (/^\\.+$/.test(value)) return [{ path, message: `\"${value}\" is not an allowed key` }];\n return [];\n}\n\n/** Schemes {@link validateUrl} always rejects: they run code or read local data. */\nexport const FORBIDDEN_URL_SCHEMES: ReadonlySet<string> = new Set([\n \"javascript:\",\n \"data:\",\n \"vbscript:\",\n \"file:\",\n \"blob:\",\n \"about:\",\n]);\n\nconst LOCAL_HOSTS = new Set([\"localhost\", \"127.0.0.1\", \"[::1]\", \"::1\"]);\n\n/** Options for {@link validateUrl}. */\nexport interface UrlPolicyOptions {\n /**\n * Allowed schemes, with the trailing colon (`[\"https:\", \"http:\"]`). Default:\n * any scheme except {@link FORBIDDEN_URL_SCHEMES} (app deep links such as\n * `myapp://` pass).\n */\n allowedSchemes?: readonly string[];\n /**\n * Reject plain `http:` except for localhost (see `allowLocalhost`). Default\n * `false`. Webhook endpoints set it; link destinations don't.\n */\n requireHttps?: boolean;\n /** With `requireHttps`, still accept `http:` for localhost / loopback. Default `true`. */\n allowLocalhost?: boolean;\n /** Reject URLs with embedded credentials (`https://user:pass@…`). Default `false`. */\n rejectCredentials?: boolean;\n /** Maximum length. Default `8192`. */\n maxLength?: number;\n /**\n * Extra host-supplied check (an SSRF denylist…). Return a message or `false`\n * to reject; `true`, `null` or `undefined` to accept.\n */\n policy?: (url: URL) => string | boolean | null | undefined;\n}\n\n/**\n * Check an absolute URL against a policy; returns the issues (empty when the\n * URL is acceptable). Dangerous schemes are always rejected.\n *\n * @example\n * ```ts\n * // A webhook endpoint: https only (http on localhost), no credentials.\n * validateUrl(url, \"endpoint.url\", {\n * allowedSchemes: [\"https:\", \"http:\"],\n * requireHttps: true,\n * rejectCredentials: true,\n * });\n * ```\n */\nexport function validateUrl(\n value: unknown,\n path: string,\n options: UrlPolicyOptions = {},\n): ValidationIssue[] {\n if (typeof value !== \"string\" || value.length === 0) return [{ path, message: \"is required\" }];\n const maxLength = options.maxLength ?? 8192;\n if (value.length > maxLength) {\n return [{ path, message: `must be at most ${maxLength} characters` }];\n }\n let url: URL;\n try {\n url = new URL(value);\n } catch {\n return [{ path, message: \"must be an absolute URL\" }];\n }\n if (FORBIDDEN_URL_SCHEMES.has(url.protocol)) {\n return [{ path, message: `scheme ${url.protocol} is not allowed` }];\n }\n if (options.allowedSchemes && !options.allowedSchemes.includes(url.protocol)) {\n return [{ path, message: `unsupported protocol \"${url.protocol}\"` }];\n }\n const web = url.protocol === \"http:\" || url.protocol === \"https:\";\n if (web && !url.hostname) return [{ path, message: \"must have a host\" }];\n if (options.rejectCredentials && (url.username || url.password)) {\n return [{ path, message: \"URL must not contain credentials\" }];\n }\n if (\n options.requireHttps &&\n url.protocol === \"http:\" &&\n !((options.allowLocalhost ?? true) && LOCAL_HOSTS.has(url.hostname))\n ) {\n return [{ path, message: \"http URLs are only allowed for localhost\" }];\n }\n const verdict = options.policy?.(url);\n if (typeof verdict === \"string\") return [{ path, message: verdict }];\n if (verdict === false) return [{ path, message: \"URL rejected by the configured policy\" }];\n return [];\n}\n"],"mappings":"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"}
@@ -0,0 +1,122 @@
1
+ import { n as JsonValue, t as JsonObject } from "./json-CCyzstIm.cjs";
2
+ import * as v from "valibot";
3
+
4
+ //#region src/util/validation.d.ts
5
+ /** A single validation problem with a dotted path into the offending data. */
6
+ interface ValidationIssue {
7
+ path: string;
8
+ message: string;
9
+ }
10
+ /** Result of a `validate*` function. */
11
+ interface ValidationResult {
12
+ valid: boolean;
13
+ errors: ValidationIssue[];
14
+ }
15
+ /**
16
+ * Raised when an input fails validation. It carries the issues as both
17
+ * `errors` (webhooks/audit/links) and `issues` (entitlements); they are the
18
+ * same array.
19
+ */
20
+ declare class ValidationError extends Error {
21
+ readonly errors: ValidationIssue[];
22
+ constructor(errors: ValidationIssue[], message?: string);
23
+ /** Alias of {@link ValidationError.errors}. */
24
+ get issues(): ValidationIssue[];
25
+ }
26
+ /** Throw a {@link ValidationError} when `result` is invalid. */
27
+ declare function assertValid(result: ValidationResult): void;
28
+ /** A `{ valid, errors }` result from a list of issues. */
29
+ declare const resultOf: (errors: ValidationIssue[]) => ValidationResult;
30
+ /**
31
+ * Map valibot issues to {@link ValidationIssue}s under `basePath`. A root
32
+ * issue gets `basePath` itself (no trailing `.`); a strict object's extra key
33
+ * (valibot reports it as "expected never") reads `"unknown field"`.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const r = v.safeParse(schema, input);
38
+ * if (!r.success) return { valid: false, errors: issuesFrom(r.issues, "link") };
39
+ * ```
40
+ */
41
+ declare function issuesFrom(issues: readonly v.BaseIssue<unknown>[], basePath?: string): ValidationIssue[];
42
+ /** Options for {@link parseInput}. */
43
+ interface ParseInputOptions {
44
+ /** Prefix for every issue path. Default `""` (paths are relative to the input). */
45
+ basePath?: string;
46
+ /**
47
+ * Build the error to throw. Default: a {@link ValidationError}. A product
48
+ * passes its own error class here to keep its `name`/HTTP mapping.
49
+ */
50
+ error?: (issues: ValidationIssue[]) => Error;
51
+ }
52
+ /**
53
+ * Validate `input` against `schema`; return the typed output or throw a
54
+ * {@link ValidationError} listing every issue.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * const grant = parseInput(grantSchema, await request.json());
59
+ * ```
60
+ */
61
+ declare function parseInput<S extends v.GenericSchema>(schema: S, input: unknown, options?: ParseInputOptions): v.InferOutput<S>;
62
+ /**
63
+ * A valibot schema for a JSON value. Numbers must be **finite**: `NaN` and
64
+ * `±Infinity` would silently serialise to `null`.
65
+ */
66
+ declare const jsonValueSchema: v.GenericSchema<JsonValue>;
67
+ /** A valibot schema for a JSON object (finite numbers, see {@link jsonValueSchema}). */
68
+ declare const jsonObjectSchema: v.GenericSchema<unknown, JsonObject>;
69
+ /** The characters allowed in a caller-supplied storage key segment. */
70
+ declare const KEY_SEGMENT_REGEX: RegExp;
71
+ /**
72
+ * Check a caller-supplied value that becomes one storage key segment (a
73
+ * tenant, an idempotency key…). It must be a non-empty string of
74
+ * {@link KEY_SEGMENT_REGEX} characters and must not be only dots, so it can't
75
+ * escape its namespace (`..`) or collide with the separator.
76
+ */
77
+ declare function validateKeySegment(value: unknown, path: string): ValidationIssue[];
78
+ /** Schemes {@link validateUrl} always rejects: they run code or read local data. */
79
+ declare const FORBIDDEN_URL_SCHEMES: ReadonlySet<string>;
80
+ /** Options for {@link validateUrl}. */
81
+ interface UrlPolicyOptions {
82
+ /**
83
+ * Allowed schemes, with the trailing colon (`["https:", "http:"]`). Default:
84
+ * any scheme except {@link FORBIDDEN_URL_SCHEMES} (app deep links such as
85
+ * `myapp://` pass).
86
+ */
87
+ allowedSchemes?: readonly string[];
88
+ /**
89
+ * Reject plain `http:` except for localhost (see `allowLocalhost`). Default
90
+ * `false`. Webhook endpoints set it; link destinations don't.
91
+ */
92
+ requireHttps?: boolean;
93
+ /** With `requireHttps`, still accept `http:` for localhost / loopback. Default `true`. */
94
+ allowLocalhost?: boolean;
95
+ /** Reject URLs with embedded credentials (`https://user:pass@…`). Default `false`. */
96
+ rejectCredentials?: boolean;
97
+ /** Maximum length. Default `8192`. */
98
+ maxLength?: number;
99
+ /**
100
+ * Extra host-supplied check (an SSRF denylist…). Return a message or `false`
101
+ * to reject; `true`, `null` or `undefined` to accept.
102
+ */
103
+ policy?: (url: URL) => string | boolean | null | undefined;
104
+ }
105
+ /**
106
+ * Check an absolute URL against a policy; returns the issues (empty when the
107
+ * URL is acceptable). Dangerous schemes are always rejected.
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * // A webhook endpoint: https only (http on localhost), no credentials.
112
+ * validateUrl(url, "endpoint.url", {
113
+ * allowedSchemes: ["https:", "http:"],
114
+ * requireHttps: true,
115
+ * rejectCredentials: true,
116
+ * });
117
+ * ```
118
+ */
119
+ declare function validateUrl(value: unknown, path: string, options?: UrlPolicyOptions): ValidationIssue[];
120
+ //#endregion
121
+ export { ValidationError as a, assertValid as c, jsonValueSchema as d, parseInput as f, validateUrl as h, UrlPolicyOptions as i, issuesFrom as l, validateKeySegment as m, KEY_SEGMENT_REGEX as n, ValidationIssue as o, resultOf as p, ParseInputOptions as r, ValidationResult as s, FORBIDDEN_URL_SCHEMES as t, jsonObjectSchema as u };
122
+ //# sourceMappingURL=validation-tfV2qhbD.d.cts.map