acrylblends 0.4.0 → 0.5.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 (426) hide show
  1. package/LICENSE +73 -0
  2. package/dist/index.js +56 -2
  3. package/dist/index.js.map +1 -1
  4. package/docs/framework/LICENSE +23 -0
  5. package/docs/framework/README.md +63 -0
  6. package/docs/framework/UPSTREAM.md +3 -0
  7. package/docs/framework/agents/index.md +24 -0
  8. package/docs/framework/api/acryl.md +259 -0
  9. package/docs/framework/api/context.md +527 -0
  10. package/docs/framework/api/exception.md +80 -0
  11. package/docs/framework/api/index.md +12 -0
  12. package/docs/framework/api/presets.md +65 -0
  13. package/docs/framework/api/request.md +396 -0
  14. package/docs/framework/api/routing.md +303 -0
  15. package/docs/framework/api/summary.md +140 -0
  16. package/docs/framework/concepts/benchmarks.md +26 -0
  17. package/docs/framework/concepts/developer-experience.md +5 -0
  18. package/docs/framework/concepts/middleware.md +21 -0
  19. package/docs/framework/concepts/motivation.md +14 -0
  20. package/docs/framework/concepts/routers.md +63 -0
  21. package/docs/framework/concepts/stacks.md +235 -0
  22. package/docs/framework/concepts/web-standard.md +37 -0
  23. package/docs/framework/cordis/acryl-in-a-cordis-app.md +146 -0
  24. package/docs/framework/cordis/concepts.md +105 -0
  25. package/docs/framework/cordis/middleware.md +8 -0
  26. package/docs/framework/cordis/migration-from-0-3.md +111 -0
  27. package/docs/framework/cordis/migration-from-0-4.md +14 -0
  28. package/docs/framework/cordis/migration-from-dsh-webserver.md +103 -0
  29. package/docs/framework/cordis/mounting.md +85 -0
  30. package/docs/framework/cordis/node-server.md +75 -0
  31. package/docs/framework/cordis/plugin-lifecycle.md +111 -0
  32. package/docs/framework/cordis/surfaces.md +71 -0
  33. package/docs/framework/cordis/transport-and-cancellation.md +57 -0
  34. package/docs/framework/cordis/validation.md +135 -0
  35. package/docs/framework/getting-started/basic.md +196 -0
  36. package/docs/framework/getting-started/bun.md +221 -0
  37. package/docs/framework/getting-started/nodejs.md +344 -0
  38. package/docs/framework/getting-started/other-runtimes.md +23 -0
  39. package/docs/framework/guides/best-practices.md +231 -0
  40. package/docs/framework/guides/create-acrylblends.md +79 -0
  41. package/docs/framework/guides/examples.md +3 -0
  42. package/docs/framework/guides/faq.md +19 -0
  43. package/docs/framework/guides/helpers.md +33 -0
  44. package/docs/framework/guides/jsx-dom.md +299 -0
  45. package/docs/framework/guides/jsx.md +440 -0
  46. package/docs/framework/guides/middleware.md +253 -0
  47. package/docs/framework/guides/rpc.md +886 -0
  48. package/docs/framework/guides/testing.md +133 -0
  49. package/docs/framework/guides/validation.md +383 -0
  50. package/docs/framework/helpers/accepts.md +60 -0
  51. package/docs/framework/helpers/adapter.md +87 -0
  52. package/docs/framework/helpers/conninfo.md +112 -0
  53. package/docs/framework/helpers/cookie.md +232 -0
  54. package/docs/framework/helpers/css.md +285 -0
  55. package/docs/framework/helpers/dev.md +67 -0
  56. package/docs/framework/helpers/factory.md +180 -0
  57. package/docs/framework/helpers/html.md +123 -0
  58. package/docs/framework/helpers/jwt.md +184 -0
  59. package/docs/framework/helpers/proxy.md +118 -0
  60. package/docs/framework/helpers/route.md +143 -0
  61. package/docs/framework/helpers/ssg.md +393 -0
  62. package/docs/framework/helpers/streaming.md +119 -0
  63. package/docs/framework/helpers/testing.md +101 -0
  64. package/docs/framework/helpers/websocket.md +215 -0
  65. package/docs/framework/middleware/builtin/basic-auth.md +165 -0
  66. package/docs/framework/middleware/builtin/bearer-auth.md +138 -0
  67. package/docs/framework/middleware/builtin/body-limit.md +71 -0
  68. package/docs/framework/middleware/builtin/cache.md +122 -0
  69. package/docs/framework/middleware/builtin/combine.md +94 -0
  70. package/docs/framework/middleware/builtin/compress.md +59 -0
  71. package/docs/framework/middleware/builtin/context-storage.md +78 -0
  72. package/docs/framework/middleware/builtin/cors.md +135 -0
  73. package/docs/framework/middleware/builtin/csrf.md +105 -0
  74. package/docs/framework/middleware/builtin/etag.md +54 -0
  75. package/docs/framework/middleware/builtin/ip-restriction.md +69 -0
  76. package/docs/framework/middleware/builtin/jsx-renderer.md +286 -0
  77. package/docs/framework/middleware/builtin/jwk.md +192 -0
  78. package/docs/framework/middleware/builtin/jwt.md +145 -0
  79. package/docs/framework/middleware/builtin/language.md +232 -0
  80. package/docs/framework/middleware/builtin/logger.md +74 -0
  81. package/docs/framework/middleware/builtin/loopback-only.md +31 -0
  82. package/docs/framework/middleware/builtin/method-not-allowed.md +48 -0
  83. package/docs/framework/middleware/builtin/method-override.md +80 -0
  84. package/docs/framework/middleware/builtin/mount.md +106 -0
  85. package/docs/framework/middleware/builtin/pretty-json.md +53 -0
  86. package/docs/framework/middleware/builtin/request-id.md +94 -0
  87. package/docs/framework/middleware/builtin/secure-headers.md +247 -0
  88. package/docs/framework/middleware/builtin/timeout.md +98 -0
  89. package/docs/framework/middleware/builtin/timing.md +101 -0
  90. package/docs/framework/middleware/builtin/trailing-slash.md +74 -0
  91. package/docs/framework/middleware/third-party.md +4 -0
  92. package/docs/framework/upstream.json +9 -0
  93. package/lib/accepts-XBuZPVRI.js +52 -0
  94. package/lib/accepts.d.ts +33 -0
  95. package/lib/accepts.js +2 -0
  96. package/lib/acryl-base.d.ts +2 -0
  97. package/lib/acryl-base.js +332 -0
  98. package/lib/adapter.d.ts +12 -0
  99. package/lib/adapter.js +37 -0
  100. package/lib/app-BM0rTCp7.js +26 -0
  101. package/lib/app-CmAYW1Al.d.ts +21 -0
  102. package/lib/basic-auth.d.ts +72 -0
  103. package/lib/basic-auth.js +95 -0
  104. package/lib/bearer-auth.d.ts +89 -0
  105. package/lib/bearer-auth.js +94 -0
  106. package/lib/body-limit.d.ts +42 -0
  107. package/lib/body-limit.js +66 -0
  108. package/lib/client-BHTr318g.js +266 -0
  109. package/lib/client.d.ts +3 -0
  110. package/lib/client.js +2 -0
  111. package/lib/combine.d.ts +85 -0
  112. package/lib/combine.js +137 -0
  113. package/lib/compose-BuW2B6PZ.js +50 -0
  114. package/lib/compress.d.ts +38 -0
  115. package/lib/compress.js +79 -0
  116. package/lib/connection-C7xgP1hP.js +24 -0
  117. package/lib/conninfo.d.ts +25 -0
  118. package/lib/conninfo.js +2 -0
  119. package/lib/constants-Dy7ZvN1H.js +4 -0
  120. package/lib/context-Bm7rI-oK.d.ts +1234 -0
  121. package/lib/context-DDO0cfuP.js +365 -0
  122. package/lib/context-storage.d.ts +38 -0
  123. package/lib/context-storage.js +52 -0
  124. package/lib/cookie-ClMaKDQf.d.ts +40 -0
  125. package/lib/cookie.d.ts +24 -0
  126. package/lib/cookie.js +82 -0
  127. package/lib/cors.d.ts +52 -0
  128. package/lib/cors.js +106 -0
  129. package/lib/csrf.d.ts +75 -0
  130. package/lib/csrf.js +101 -0
  131. package/lib/etag.d.ts +40 -0
  132. package/lib/etag.js +135 -0
  133. package/lib/factory.d.ts +35 -0
  134. package/lib/factory.js +30 -0
  135. package/lib/headers-tu2YYN8T.d.ts +11 -0
  136. package/lib/html.d.ts +6 -0
  137. package/lib/html.js +31 -0
  138. package/lib/http-exception.d.ts +57 -0
  139. package/lib/http-exception.js +54 -0
  140. package/lib/http-status-DaAwGAFL.d.ts +35 -0
  141. package/lib/index-B-3F4wt2.d.ts +12 -0
  142. package/lib/index-UTBmM3GX.d.ts +68 -0
  143. package/lib/index-oOClm_Xk.d.ts +45 -0
  144. package/lib/index.d.ts +5 -0
  145. package/lib/index.js +28 -0
  146. package/lib/ip-restriction.d.ts +68 -0
  147. package/lib/ip-restriction.js +166 -0
  148. package/lib/jwk.d.ts +52 -0
  149. package/lib/jwk.js +117 -0
  150. package/lib/jwt-BGJBw5AF.js +403 -0
  151. package/lib/jwt-Dg493Tai.d.ts +51 -0
  152. package/lib/jwt.d.ts +72 -0
  153. package/lib/jwt.js +115 -0
  154. package/lib/language.d.ts +88 -0
  155. package/lib/language.js +198 -0
  156. package/lib/logger.d.ts +22 -0
  157. package/lib/logger.js +54 -0
  158. package/lib/loopback-only.d.ts +45 -0
  159. package/lib/loopback-only.js +90 -0
  160. package/lib/method-not-allowed.d.ts +47 -0
  161. package/lib/method-not-allowed.js +82 -0
  162. package/lib/method-override.d.ts +46 -0
  163. package/lib/method-override.js +103 -0
  164. package/lib/mime-BQOYHl-l.d.ts +72 -0
  165. package/lib/node-server/conninfo.d.ts +11 -0
  166. package/lib/node-server/conninfo.js +19 -0
  167. package/lib/node-server/serve-static.d.ts +19 -0
  168. package/lib/node-server/serve-static.js +2 -0
  169. package/lib/node-server.d.ts +103 -0
  170. package/lib/node-server.js +1325 -0
  171. package/lib/powered-by.d.ts +28 -0
  172. package/lib/powered-by.js +24 -0
  173. package/lib/pretty-json.d.ts +40 -0
  174. package/lib/pretty-json.js +39 -0
  175. package/lib/reg-exp-router-DC1R3qoY.js +363 -0
  176. package/lib/request-id.d.ts +45 -0
  177. package/lib/request-id.js +34 -0
  178. package/lib/request.d.ts +2 -0
  179. package/lib/request.js +323 -0
  180. package/lib/route.d.ts +78 -0
  181. package/lib/route.js +126 -0
  182. package/lib/router/linear-router.d.ts +11 -0
  183. package/lib/router/linear-router.js +96 -0
  184. package/lib/router/pattern-router.d.ts +11 -0
  185. package/lib/router/pattern-router.js +41 -0
  186. package/lib/router/reg-exp-router.d.ts +35 -0
  187. package/lib/router/reg-exp-router.js +2 -0
  188. package/lib/router/smart-router.d.ts +15 -0
  189. package/lib/router/smart-router.js +2 -0
  190. package/lib/router/trie-router.d.ts +11 -0
  191. package/lib/router/trie-router.js +2 -0
  192. package/lib/router-CvUxUTOq.d.ts +99 -0
  193. package/lib/router.d.ts +2 -0
  194. package/lib/router.js +35 -0
  195. package/lib/schema-validator.d.ts +28 -0
  196. package/lib/schema-validator.js +22 -0
  197. package/lib/secure-headers.d.ts +125 -0
  198. package/lib/secure-headers.js +163 -0
  199. package/lib/serve-static-Dw_m6KxR.js +213 -0
  200. package/lib/serve-static.d.ts +31 -0
  201. package/lib/serve-static.js +77 -0
  202. package/lib/smart-router-C5CZ5XSM.js +49 -0
  203. package/lib/stream-CPdqZ0Fp.d.ts +34 -0
  204. package/lib/streaming-DHST3Scg.js +96 -0
  205. package/lib/streaming.d.ts +23 -0
  206. package/lib/streaming.js +2 -0
  207. package/lib/testing.d.ts +10 -0
  208. package/lib/testing.js +17 -0
  209. package/lib/timeout.d.ts +30 -0
  210. package/lib/timeout.js +42 -0
  211. package/lib/timing.d.ts +130 -0
  212. package/lib/timing.js +183 -0
  213. package/lib/trailing-slash.d.ts +91 -0
  214. package/lib/trailing-slash.js +85 -0
  215. package/lib/trie-router-CfFbapzL.js +146 -0
  216. package/lib/types-CDO6I3B0.d.ts +40 -0
  217. package/lib/types-CHesD1KG.d.ts +195 -0
  218. package/lib/types-CwrQjlaM.d.ts +105 -0
  219. package/lib/types-DR95J00T.d.ts +29 -0
  220. package/lib/types.d.ts +2 -0
  221. package/lib/types.js +4 -0
  222. package/lib/utils/accept.d.ts +9 -0
  223. package/lib/utils/accept.js +193 -0
  224. package/lib/utils/basic-auth.d.ts +8 -0
  225. package/lib/utils/basic-auth.js +20 -0
  226. package/lib/utils/body.d.ts +2 -0
  227. package/lib/utils/body.js +94 -0
  228. package/lib/utils/buffer.d.ts +19 -0
  229. package/lib/utils/buffer.js +51 -0
  230. package/lib/utils/color.d.ts +24 -0
  231. package/lib/utils/color.js +37 -0
  232. package/lib/utils/compress.d.ts +11 -0
  233. package/lib/utils/compress.js +11 -0
  234. package/lib/utils/concurrent.d.ts +17 -0
  235. package/lib/utils/concurrent.js +30 -0
  236. package/lib/utils/constants.d.ts +7 -0
  237. package/lib/utils/constants.js +7 -0
  238. package/lib/utils/cookie.d.ts +2 -0
  239. package/lib/utils/cookie.js +125 -0
  240. package/lib/utils/crypto.d.ts +14 -0
  241. package/lib/utils/crypto.js +34 -0
  242. package/lib/utils/encode.d.ts +11 -0
  243. package/lib/utils/encode.js +33 -0
  244. package/lib/utils/filepath.d.ts +14 -0
  245. package/lib/utils/filepath.js +25 -0
  246. package/lib/utils/handler.d.ts +9 -0
  247. package/lib/utils/handler.js +12 -0
  248. package/lib/utils/headers.d.ts +2 -0
  249. package/lib/utils/headers.js +1 -0
  250. package/lib/utils/html.d.ts +46 -0
  251. package/lib/utils/html.js +103 -0
  252. package/lib/utils/http-status.d.ts +2 -0
  253. package/lib/utils/http-status.js +1 -0
  254. package/lib/utils/ipaddr.d.ts +56 -0
  255. package/lib/utils/ipaddr.js +238 -0
  256. package/lib/utils/jwt.d.ts +24 -0
  257. package/lib/utils/jwt.js +2 -0
  258. package/lib/utils/mime.d.ts +2 -0
  259. package/lib/utils/mime.js +77 -0
  260. package/lib/utils/stream.d.ts +2 -0
  261. package/lib/utils/stream.js +88 -0
  262. package/lib/utils/types.d.ts +2 -0
  263. package/lib/utils/types.js +1 -0
  264. package/lib/utils/url.d.ts +46 -0
  265. package/lib/utils/url.js +197 -0
  266. package/lib/utils-dw8lxqjL.js +4 -0
  267. package/lib/validator-D84mq-dO.js +65 -0
  268. package/lib/validator.d.ts +42 -0
  269. package/lib/validator.js +2 -0
  270. package/lib/ws.d.ts +2 -0
  271. package/lib/ws.js +53 -0
  272. package/package.json +315 -15
  273. package/plugins/acryl-inspect/src/report.ts +15 -10
  274. package/plugins/acryl-inspect/src/service.ts +2 -2
  275. package/plugins/acryl-inspect/tests/report.spec.ts +9 -3
  276. package/plugins/acryl-inspect/tests/service.spec.ts +3 -3
  277. package/plugins/acryl-inspect/upstream.json +2 -2
  278. package/plugins/acryl-node-server/tests/adapter/app.ts +2 -2
  279. package/plugins/acryl-node-server/tests/adapter/assets/static/acryl.html +1 -1
  280. package/plugins/acryl-node-server/tests/adapter/assets/static/index.html +1 -1
  281. package/plugins/acryl-node-server/tests/adapter/conninfo.test.ts +2 -2
  282. package/plugins/acryl-node-server/tests/adapter/content-length.test.ts +4 -4
  283. package/plugins/acryl-node-server/tests/adapter/early-hints.test.ts +5 -5
  284. package/plugins/acryl-node-server/tests/adapter/request-client-disconnect.test.ts +2 -2
  285. package/plugins/acryl-node-server/tests/adapter/serve-static.test.ts +20 -20
  286. package/plugins/acryl-node-server/tests/adapter/server-socket.test.ts +2 -2
  287. package/plugins/acryl-node-server/tests/adapter/server.test.ts +50 -50
  288. package/plugins/acryl-node-server/tests/adapter/utils/response.test.ts +4 -4
  289. package/plugins/acryl-node-server/tests/adapter/websocket.test.ts +9 -9
  290. package/plugins/acryl-node-server/tests/server.spec.ts +6 -6
  291. package/plugins/acryl-node-server/upstream.json +2 -2
  292. package/plugins/acryl-router/src/client.ts +1 -1
  293. package/plugins/acryl-router/src/connection.ts +2 -2
  294. package/plugins/acryl-router/src/core/app-base.ts +29 -29
  295. package/plugins/acryl-router/src/core/app.test.ts +175 -175
  296. package/plugins/acryl-router/src/core/app.ts +8 -8
  297. package/plugins/acryl-router/src/core/client/client.test.ts +76 -76
  298. package/plugins/acryl-router/src/core/client/client.ts +2 -2
  299. package/plugins/acryl-router/src/core/client/fetch-result-please.ts +1 -1
  300. package/plugins/acryl-router/src/core/client/index.ts +1 -1
  301. package/plugins/acryl-router/src/core/client/types.test.ts +6 -6
  302. package/plugins/acryl-router/src/core/client/types.ts +16 -16
  303. package/plugins/acryl-router/src/core/client/utils.test.ts +2 -2
  304. package/plugins/acryl-router/src/core/context.test.ts +4 -4
  305. package/plugins/acryl-router/src/core/context.ts +6 -6
  306. package/plugins/acryl-router/src/core/helper/accepts/accepts.test.ts +3 -3
  307. package/plugins/acryl-router/src/core/helper/accepts/index.ts +1 -1
  308. package/plugins/acryl-router/src/core/helper/adapter/index.test.ts +6 -6
  309. package/plugins/acryl-router/src/core/helper/adapter/index.ts +1 -1
  310. package/plugins/acryl-router/src/core/helper/conninfo/index.ts +1 -1
  311. package/plugins/acryl-router/src/core/helper/cookie/index.test.ts +8 -8
  312. package/plugins/acryl-router/src/core/helper/cookie/index.ts +1 -1
  313. package/plugins/acryl-router/src/core/helper/factory/index.test.ts +9 -9
  314. package/plugins/acryl-router/src/core/helper/factory/index.ts +10 -10
  315. package/plugins/acryl-router/src/core/helper/html/index.test.ts +4 -4
  316. package/plugins/acryl-router/src/core/helper/html/index.ts +1 -1
  317. package/plugins/acryl-router/src/core/helper/route/index.test.ts +7 -7
  318. package/plugins/acryl-router/src/core/helper/route/index.ts +8 -8
  319. package/plugins/acryl-router/src/core/helper/streaming/index.ts +1 -1
  320. package/plugins/acryl-router/src/core/helper/testing/index.test.ts +6 -6
  321. package/plugins/acryl-router/src/core/helper/testing/index.ts +4 -4
  322. package/plugins/acryl-router/src/core/helper/websocket/index.ts +2 -1
  323. package/plugins/acryl-router/src/core/http-exception.ts +1 -1
  324. package/plugins/acryl-router/src/core/index.ts +9 -9
  325. package/plugins/acryl-router/src/core/middleware/basic-auth/index.test.ts +6 -6
  326. package/plugins/acryl-router/src/core/middleware/basic-auth/index.ts +3 -3
  327. package/plugins/acryl-router/src/core/middleware/bearer-auth/index.test.ts +5 -5
  328. package/plugins/acryl-router/src/core/middleware/bearer-auth/index.ts +3 -3
  329. package/plugins/acryl-router/src/core/middleware/body-limit/index.test.ts +6 -6
  330. package/plugins/acryl-router/src/core/middleware/body-limit/index.ts +3 -3
  331. package/plugins/acryl-router/src/core/middleware/combine/index.test.ts +9 -9
  332. package/plugins/acryl-router/src/core/middleware/combine/index.ts +7 -7
  333. package/plugins/acryl-router/src/core/middleware/compress/index.test.ts +9 -9
  334. package/plugins/acryl-router/src/core/middleware/compress/index.ts +3 -3
  335. package/plugins/acryl-router/src/core/middleware/context-storage/index.test.ts +5 -5
  336. package/plugins/acryl-router/src/core/middleware/context-storage/index.ts +4 -4
  337. package/plugins/acryl-router/src/core/middleware/cors/index.test.ts +7 -7
  338. package/plugins/acryl-router/src/core/middleware/cors/index.ts +3 -3
  339. package/plugins/acryl-router/src/core/middleware/csrf/index.test.ts +10 -10
  340. package/plugins/acryl-router/src/core/middleware/csrf/index.ts +3 -3
  341. package/plugins/acryl-router/src/core/middleware/etag/index.test.ts +42 -42
  342. package/plugins/acryl-router/src/core/middleware/etag/index.ts +4 -4
  343. package/plugins/acryl-router/src/core/middleware/ip-restriction/index.test.ts +4 -4
  344. package/plugins/acryl-router/src/core/middleware/ip-restriction/index.ts +6 -6
  345. package/plugins/acryl-router/src/core/middleware/jwk/index.test.ts +16 -16
  346. package/plugins/acryl-router/src/core/middleware/jwk/jwk.ts +7 -6
  347. package/plugins/acryl-router/src/core/middleware/jwt/index.test.ts +16 -16
  348. package/plugins/acryl-router/src/core/middleware/jwt/jwt.ts +4 -3
  349. package/plugins/acryl-router/src/core/middleware/language/index.test.ts +3 -3
  350. package/plugins/acryl-router/src/core/middleware/language/language.ts +3 -3
  351. package/plugins/acryl-router/src/core/middleware/logger/index.test.ts +5 -5
  352. package/plugins/acryl-router/src/core/middleware/logger/index.ts +4 -4
  353. package/plugins/acryl-router/src/core/middleware/method-not-allowed/index.test.ts +24 -24
  354. package/plugins/acryl-router/src/core/middleware/method-not-allowed/index.ts +8 -8
  355. package/plugins/acryl-router/src/core/middleware/method-override/index.test.ts +5 -5
  356. package/plugins/acryl-router/src/core/middleware/method-override/index.ts +6 -6
  357. package/plugins/acryl-router/src/core/middleware/powered-by/index.test.ts +4 -4
  358. package/plugins/acryl-router/src/core/middleware/powered-by/index.ts +6 -6
  359. package/plugins/acryl-router/src/core/middleware/pretty-json/index.test.ts +30 -30
  360. package/plugins/acryl-router/src/core/middleware/pretty-json/index.ts +4 -4
  361. package/plugins/acryl-router/src/core/middleware/request-id/index.test.ts +15 -15
  362. package/plugins/acryl-router/src/core/middleware/request-id/request-id.ts +3 -3
  363. package/plugins/acryl-router/src/core/middleware/secure-headers/index.test.ts +35 -35
  364. package/plugins/acryl-router/src/core/middleware/secure-headers/secure-headers.ts +3 -3
  365. package/plugins/acryl-router/src/core/middleware/serve-static/index.test.ts +23 -23
  366. package/plugins/acryl-router/src/core/middleware/serve-static/index.ts +1 -1
  367. package/plugins/acryl-router/src/core/middleware/timeout/index.test.ts +2 -2
  368. package/plugins/acryl-router/src/core/middleware/timeout/index.ts +3 -3
  369. package/plugins/acryl-router/src/core/middleware/timing/index.test.ts +14 -14
  370. package/plugins/acryl-router/src/core/middleware/timing/timing.ts +3 -3
  371. package/plugins/acryl-router/src/core/middleware/trailing-slash/index.test.ts +7 -7
  372. package/plugins/acryl-router/src/core/middleware/trailing-slash/index.ts +7 -7
  373. package/plugins/acryl-router/src/core/request.test.ts +42 -42
  374. package/plugins/acryl-router/src/core/request.ts +6 -6
  375. package/plugins/acryl-router/src/core/router/linear-router/index.ts +1 -1
  376. package/plugins/acryl-router/src/core/router/pattern-router/index.ts +1 -1
  377. package/plugins/acryl-router/src/core/router/reg-exp-router/index.ts +1 -1
  378. package/plugins/acryl-router/src/core/router/smart-router/index.ts +1 -1
  379. package/plugins/acryl-router/src/core/router/trie-router/index.ts +1 -1
  380. package/plugins/acryl-router/src/core/types.test.ts +115 -115
  381. package/plugins/acryl-router/src/core/types.ts +72 -72
  382. package/plugins/acryl-router/src/core/utils/body.ts +8 -8
  383. package/plugins/acryl-router/src/core/utils/html.ts +1 -1
  384. package/plugins/acryl-router/src/core/utils/jwt/jws.ts +3 -3
  385. package/plugins/acryl-router/src/core/utils/jwt/jwt.test.ts +2 -2
  386. package/plugins/acryl-router/src/core/utils/jwt/jwt.ts +3 -3
  387. package/plugins/acryl-router/src/core/utils/jwt/types.ts +1 -1
  388. package/plugins/acryl-router/src/core/utils/types.ts +42 -0
  389. package/plugins/acryl-router/src/core/utils/url.test.ts +2 -2
  390. package/plugins/acryl-router/src/core/validator/index.ts +1 -1
  391. package/plugins/acryl-router/src/core/validator/validator.test.ts +28 -28
  392. package/plugins/acryl-router/src/deprecated.ts +15 -0
  393. package/plugins/acryl-router/src/index.ts +3 -2
  394. package/plugins/acryl-router/src/middleware/index.ts +1 -1
  395. package/plugins/acryl-router/src/middleware/loopback-only.ts +34 -1
  396. package/plugins/acryl-router/src/service.ts +19 -13
  397. package/plugins/acryl-router/tests/docs-examples.spec.ts +11 -11
  398. package/plugins/acryl-router/tests/live-install.spec.ts +2 -2
  399. package/plugins/acryl-router/tests/loader.spec.ts +3 -3
  400. package/plugins/acryl-router/tests/loopback-only.spec.ts +80 -0
  401. package/plugins/acryl-router/tests/no-dom/consumer.ts +11 -0
  402. package/plugins/acryl-router/tests/no-dom/tsconfig.json +13 -0
  403. package/plugins/acryl-router/tests/service.spec.ts +39 -22
  404. package/plugins/acryl-router/upstream.json +3 -3
  405. package/plugins/acryl-router-http/tests/adapter.spec.ts +3 -3
  406. package/plugins/acryl-router-http/tests/surfaces.spec.ts +2 -2
  407. package/plugins/acryl-router-http/upstream.json +2 -2
  408. package/plugins/acryl-state/src/service.ts +2 -2
  409. package/plugins/acryl-state/upstream.json +2 -2
  410. package/plugins/builder/script.ts +3 -3
  411. package/plugins/extensions/index.ts +4 -3
  412. package/plugins/extensions/resolve.ts +70 -10
  413. package/plugins/openai/prompt.ts +7 -7
  414. package/shared/AGENTS.core.md +61 -0
  415. package/templates/agent/AGENTS.md +6 -0
  416. package/templates/agent/README.md +2 -2
  417. package/templates/agent/blend.yaml +1 -1
  418. package/templates/agent/src/routes.ts +2 -2
  419. package/templates/agent/test/model.test.ts +2 -2
  420. package/templates/agent/tsconfig.json +40 -0
  421. package/templates/blank/AGENTS.md +5 -0
  422. package/templates/blank/README.md +1 -1
  423. package/templates/blank/src/routes.ts +2 -2
  424. package/templates/todo/AGENTS.md +5 -0
  425. package/templates/todo/src/todo.ts +6 -4
  426. package/templates/todo/upstream.json +2 -2
@@ -1,29 +1,29 @@
1
- import { AppBase } from './app-base.ts'
2
- import type { AppOptions } from './app-base.ts'
1
+ import { AcrylBase } from './app-base.ts'
2
+ import type { AcrylOptions } from './app-base.ts'
3
3
  import { RegExpRouter } from './router/reg-exp-router/index.ts'
4
4
  import { SmartRouter } from './router/smart-router/index.ts'
5
5
  import { TrieRouter } from './router/trie-router/index.ts'
6
6
  import type { BlankEnv, BlankSchema, Env, Schema } from './types.ts'
7
7
 
8
8
  /**
9
- * The App class extends the functionality of the AppBase class.
9
+ * The Acryl class extends the functionality of the AcrylBase class.
10
10
  * It sets up routing and allows for custom options to be passed.
11
11
  *
12
12
  * @template E - The environment type.
13
13
  * @template S - The schema type.
14
14
  * @template BasePath - The base path type.
15
15
  */
16
- export class App<
16
+ export class Acryl<
17
17
  E extends Env = BlankEnv,
18
18
  S extends Schema = BlankSchema,
19
19
  BasePath extends string = '/',
20
- > extends AppBase<E, S, BasePath> {
20
+ > extends AcrylBase<E, S, BasePath> {
21
21
  /**
22
- * Creates an instance of the App class.
22
+ * Creates an instance of the Acryl class.
23
23
  *
24
- * @param options - Optional configuration options for the App instance.
24
+ * @param options - Optional configuration options for the Acryl instance.
25
25
  */
26
- constructor(options: AppOptions<E> = {}) {
26
+ constructor(options: AcrylOptions<E> = {}) {
27
27
  super(options)
28
28
  this.router =
29
29
  options.router ??
@@ -5,7 +5,7 @@ import { HttpResponse, http } from 'msw'
5
5
  import { setupServer } from 'msw/node'
6
6
  import { expectTypeOf, vi } from 'vitest'
7
7
  import { defineWebSocketHelper } from '../helper/websocket/index.ts'
8
- import { App } from '../app.ts'
8
+ import { Acryl } from '../app.ts'
9
9
  import { parse } from '../utils/cookie.ts'
10
10
  import type { Equal, Expect, JSONValue, SimplifyDeepArray } from '../utils/types.ts'
11
11
  import { validator } from '../validator/index.ts'
@@ -32,7 +32,7 @@ class SafeBigInt {
32
32
  }
33
33
 
34
34
  describe('Basic - JSON', () => {
35
- const app = new App()
35
+ const app = new Acryl()
36
36
 
37
37
  const route = app
38
38
  .post(
@@ -58,7 +58,7 @@ describe('Basic - JSON', () => {
58
58
  success: true,
59
59
  message: 'dummy',
60
60
  requestContentType: 'dummy',
61
- requestApp: 'dummy',
61
+ requestAcryl: 'dummy',
62
62
  requestMessage: 'dummy',
63
63
  requestBody: {
64
64
  id: 123,
@@ -78,14 +78,14 @@ describe('Basic - JSON', () => {
78
78
  const server = setupServer(
79
79
  http.post('http://localhost/posts', async ({ request }) => {
80
80
  const requestContentType = request.headers.get('content-type')
81
- const requestApp = request.headers.get('x-acryl')
81
+ const requestAcryl = request.headers.get('x-acryl')
82
82
  const requestMessage = request.headers.get('x-message')
83
83
  const requestBody = await request.json()
84
84
  const payload = {
85
85
  message: 'Hello!',
86
86
  success: true,
87
87
  requestContentType,
88
- requestApp,
88
+ requestAcryl,
89
89
  requestMessage,
90
90
  requestBody,
91
91
  }
@@ -128,7 +128,7 @@ describe('Basic - JSON', () => {
128
128
 
129
129
  const payload = {
130
130
  id: 123,
131
- title: 'Hello! App!',
131
+ title: 'Hello! Acryl!',
132
132
  }
133
133
 
134
134
  const client = hc<AppType>('http://localhost', { headers: { 'x-acryl': 'acryl' } })
@@ -152,7 +152,7 @@ describe('Basic - JSON', () => {
152
152
  expect(data.success).toBe(true)
153
153
  expect(data.message).toBe('Hello!')
154
154
  expect(data.requestContentType).toBe('application/json')
155
- expect(data.requestApp).toBe('acryl')
155
+ expect(data.requestAcryl).toBe('acryl')
156
156
  expect(data.requestMessage).toBe('foobar')
157
157
  expect(data.requestBody).toEqual(payload)
158
158
  })
@@ -199,7 +199,7 @@ describe('Basic - JSON', () => {
199
199
  })
200
200
 
201
201
  it('Should have correct types - primitives', async () => {
202
- const app = new App()
202
+ const app = new Acryl()
203
203
  const route = app
204
204
  .get('/api/string', (c) => c.json('a-string'))
205
205
  .get('/api/number', (c) => c.json(37))
@@ -232,7 +232,7 @@ describe('Basic - JSON', () => {
232
232
  })
233
233
 
234
234
  describe('Basic - query, queries, form, path params, header and cookie', () => {
235
- const app = new App()
235
+ const app = new Acryl()
236
236
 
237
237
  const route = app
238
238
  .get(
@@ -387,15 +387,15 @@ describe('Basic - query, queries, form, path params, header and cookie', () => {
387
387
  })
388
388
 
389
389
  describe('Basic - $url()', () => {
390
- const api = new App().get('/', (c) => c.text('API')).get('/posts/:id', (c) => c.text('Post'))
391
- const content = new App().get(
390
+ const api = new Acryl().get('/', (c) => c.text('API')).get('/posts/:id', (c) => c.text('Post'))
391
+ const content = new Acryl().get(
392
392
  '/search',
393
393
  validator('query', () => {
394
394
  return { page: '1', limit: '10' }
395
395
  }),
396
396
  (c) => c.text('Search')
397
397
  )
398
- const app = new App()
398
+ const app = new Acryl()
399
399
  .get('/', (c) => c.text('Index'))
400
400
  .route('/api', api)
401
401
  .route('/content', content)
@@ -525,7 +525,7 @@ describe('Form - Undefined Values', () => {
525
525
  })
526
526
 
527
527
  describe('Form arrays containing undefined', () => {
528
- const app = new App().post(
528
+ const app = new Acryl().post(
529
529
  '/',
530
530
  validator('form', () => ({}) as { tag: (string | undefined)[] | undefined }),
531
531
  async (c) => {
@@ -557,7 +557,7 @@ describe('Form arrays containing undefined', () => {
557
557
  })
558
558
 
559
559
  describe('Optional header and cookie values', () => {
560
- const app = new App().get(
560
+ const app = new Acryl().get(
561
561
  '/',
562
562
  validator('header', () => {
563
563
  return {} as {
@@ -603,7 +603,7 @@ describe('Optional header and cookie values', () => {
603
603
  })
604
604
 
605
605
  it('Should not send a Cookie header if all cookie values are undefined', async () => {
606
- const app = new App().get(
606
+ const app = new Acryl().get(
607
607
  '/',
608
608
  validator('cookie', () => {
609
609
  return {} as {
@@ -626,7 +626,7 @@ describe('Optional header and cookie values', () => {
626
626
  })
627
627
 
628
628
  describe('Infer the response/request type', () => {
629
- const app = new App()
629
+ const app = new Acryl()
630
630
  const route = app.get(
631
631
  '/',
632
632
  validator('query', () => {
@@ -768,8 +768,8 @@ describe('Merge path with `app.route()`', () => {
768
768
  }
769
769
 
770
770
  it('Should have correct types', async () => {
771
- const api = new App<Env>().get('/search', (c) => c.json({ ok: true }))
772
- const app = new App<Env>().route('/api', api)
771
+ const api = new Acryl<Env>().get('/search', (c) => c.json({ ok: true }))
772
+ const app = new Acryl<Env>().route('/api', api)
773
773
  type AppType = typeof app
774
774
  const client = hc<AppType>('http://localhost')
775
775
  const res = await client.api.search.$get()
@@ -779,7 +779,7 @@ describe('Merge path with `app.route()`', () => {
779
779
  })
780
780
 
781
781
  it('Should have correct types - basePath() then get()', async () => {
782
- const base = new App<Env>().basePath('/api')
782
+ const base = new Acryl<Env>().basePath('/api')
783
783
  const app = base.get('/search', (c) => c.json({ ok: true }))
784
784
  type AppType = typeof app
785
785
  const client = hc<AppType>('http://localhost')
@@ -790,8 +790,8 @@ describe('Merge path with `app.route()`', () => {
790
790
  })
791
791
 
792
792
  it('Should have correct types - basePath(), route(), get()', async () => {
793
- const book = new App().get('/', (c) => c.json({ ok: true }))
794
- const app = new App().basePath('/v1').route('/book', book)
793
+ const book = new Acryl().get('/', (c) => c.json({ ok: true }))
794
+ const app = new Acryl().basePath('/v1').route('/book', book)
795
795
  type AppType = typeof app
796
796
  const client = hc<AppType>('http://localhost')
797
797
  const res = await client.v1.book.$get()
@@ -806,7 +806,7 @@ describe('Merge path with `app.route()`', () => {
806
806
  okUndefined?: boolean
807
807
  }
808
808
  const result: Result = { ok: true }
809
- const base = new App<Env>().basePath('/api')
809
+ const base = new Acryl<Env>().basePath('/api')
810
810
  const app = base.get('/search', (c) => c.json(result))
811
811
  type AppType = typeof app
812
812
  const client = hc<AppType>('http://localhost')
@@ -840,7 +840,7 @@ describe('Merge path with `app.route()`', () => {
840
840
  type Results = Result[]
841
841
 
842
842
  const results: Results = [{ ok: true }]
843
- const base = new App<Env>().basePath('/api')
843
+ const base = new Acryl<Env>().basePath('/api')
844
844
  const app = base.get('/searchArray', (c) => c.json(results))
845
845
  type AppType = typeof app
846
846
  const client = hc<AppType>('http://localhost')
@@ -865,7 +865,7 @@ describe('Merge path with `app.route()`', () => {
865
865
  })
866
866
 
867
867
  it('Should allow a Date object and return it as a string', async () => {
868
- const app = new App()
868
+ const app = new Acryl()
869
869
  const route = app.get('/api/foo', (c) => c.json({ datetime: new Date() }))
870
870
  type AppType = typeof route
871
871
  const client = hc<AppType>('http://localhost')
@@ -875,10 +875,10 @@ describe('Merge path with `app.route()`', () => {
875
875
  })
876
876
 
877
877
  describe('Multiple endpoints', () => {
878
- const api = new App()
878
+ const api = new Acryl()
879
879
  .get('/foo', (c) => c.json({ foo: '' }))
880
880
  .post('/bar', (c) => c.json({ bar: 0 }))
881
- const app = new App().route('/api', api)
881
+ const app = new Acryl().route('/api', api)
882
882
  type AppType = typeof app
883
883
  const client = hc<typeof app>('http://localhost')
884
884
 
@@ -904,12 +904,12 @@ describe('Merge path with `app.route()`', () => {
904
904
  })
905
905
 
906
906
  describe('With a blank path', () => {
907
- const app = new App().basePath('/api/v1')
907
+ const app = new Acryl().basePath('/api/v1')
908
908
  const routes = app.route(
909
909
  '/me',
910
- new App().route(
910
+ new Acryl().route(
911
911
  '',
912
- new App().get('', async (c) => {
912
+ new Acryl().get('', async (c) => {
913
913
  return c.json({ name: 'acryl' })
914
914
  })
915
915
  )
@@ -929,12 +929,12 @@ describe('Merge path with `app.route()`', () => {
929
929
  })
930
930
 
931
931
  describe('With endpoint pathname', () => {
932
- const app = new App().basePath('/api/v1')
932
+ const app = new Acryl().basePath('/api/v1')
933
933
  const routes = app.route(
934
934
  '/me',
935
- new App().route(
935
+ new Acryl().route(
936
936
  '',
937
- new App().get('', async (c) => {
937
+ new Acryl().get('', async (c) => {
938
938
  return c.json({ name: 'acryl' })
939
939
  })
940
940
  )
@@ -958,8 +958,8 @@ describe('Use custom fetch method', () => {
958
958
  it('Should call the custom fetch method when provided', async () => {
959
959
  const fetchMock = vi.fn()
960
960
 
961
- const api = new App().get('/search', (c) => c.json({ ok: true }))
962
- const app = new App().route('/api', api)
961
+ const api = new Acryl().get('/search', (c) => c.json({ ok: true }))
962
+ const app = new Acryl().route('/api', api)
963
963
  type AppType = typeof app
964
964
  const client = hc<AppType>('http://localhost', { fetch: fetchMock })
965
965
  await client.api.search.$get()
@@ -971,8 +971,8 @@ describe('Use custom fetch method', () => {
971
971
  const returnValue = new Response(null, { status: 200 })
972
972
  fetchMock.mockReturnValueOnce(returnValue)
973
973
 
974
- const api = new App().get('/search', (c) => c.json({ ok: true }))
975
- const app = new App().route('/api', api)
974
+ const api = new Acryl().get('/search', (c) => c.json({ ok: true }))
975
+ const app = new Acryl().route('/api', api)
976
976
  type AppType = typeof app
977
977
  const client = hc<AppType>('http://localhost', { fetch: fetchMock })
978
978
  const res = await client.api.search.$get()
@@ -983,7 +983,7 @@ describe('Use custom fetch method', () => {
983
983
 
984
984
  describe('Use custom fetch (app.request) method', () => {
985
985
  it('Should return Response from app request method', async () => {
986
- const app = new App().get('/search', (c) => c.json({ ok: true }))
986
+ const app = new Acryl().get('/search', (c) => c.json({ ok: true }))
987
987
  type AppType = typeof app
988
988
  const client = hc<AppType>('', { fetch: app.request })
989
989
  const res = await client.search.$get()
@@ -991,7 +991,7 @@ describe('Use custom fetch (app.request) method', () => {
991
991
  })
992
992
 
993
993
  it.each([false, 0, '', null])('Should send falsy JSON value: %j', async (json) => {
994
- const app = new App().post(
994
+ const app = new Acryl().post(
995
995
  '/json',
996
996
  validator('json', (value) => value as boolean | number | string | null),
997
997
  (c) => c.json(c.req.valid('json'))
@@ -1007,7 +1007,7 @@ describe('Use custom fetch (app.request) method', () => {
1007
1007
 
1008
1008
  describe('Optional parameters in JSON response', () => {
1009
1009
  it('Should return the correct type', async () => {
1010
- const app = new App().get('/', (c) => {
1010
+ const app = new Acryl().get('/', (c) => {
1011
1011
  return c.json({ message: 'foo' } as { message?: string })
1012
1012
  })
1013
1013
  type AppType = typeof app
@@ -1022,7 +1022,7 @@ describe('Optional parameters in JSON response', () => {
1022
1022
 
1023
1023
  describe('ClientResponse<T>.json() returns a Union type correctly', () => {
1024
1024
  const condition = () => true
1025
- const app = new App().get('/', async (c) => {
1025
+ const app = new Acryl().get('/', async (c) => {
1026
1026
  const ok = condition()
1027
1027
  if (ok) {
1028
1028
  return c.json({ data: 'foo' })
@@ -1040,7 +1040,7 @@ describe('ClientResponse<T>.json() returns a Union type correctly', () => {
1040
1040
 
1041
1041
  describe('Response with different status codes', () => {
1042
1042
  const condition = () => true
1043
- const app = new App().get('/', async (c) => {
1043
+ const app = new Acryl().get('/', async (c) => {
1044
1044
  const ok = condition()
1045
1045
  if (ok) {
1046
1046
  return c.json({ data: 'foo' }, 200)
@@ -1094,7 +1094,7 @@ describe('Response with different status codes', () => {
1094
1094
 
1095
1095
  describe('Infer the response type with different status codes', () => {
1096
1096
  const condition = () => true
1097
- const app = new App().get('/', async (c) => {
1097
+ const app = new Acryl().get('/', async (c) => {
1098
1098
  const ok = condition()
1099
1099
  if (ok) {
1100
1100
  return c.json({ data: 'foo' }, 200)
@@ -1134,7 +1134,7 @@ describe('Infer the response type with different status codes', () => {
1134
1134
  })
1135
1135
 
1136
1136
  describe('Infer the response types from middlewares', () => {
1137
- const app = new App()
1137
+ const app = new Acryl()
1138
1138
  .get(
1139
1139
  '/',
1140
1140
  validator('query', (input, c) => {
@@ -1243,7 +1243,7 @@ const pathname = <T extends URL | string>(value: T): string =>
1243
1243
  value instanceof URL ? value.pathname : value
1244
1244
 
1245
1245
  describe.each(['$path', '$url'] as const)('%s() with a param option', (cmd) => {
1246
- const app = new App()
1246
+ const app = new Acryl()
1247
1247
  .get('/posts/:id/comments', (c) => c.json({ ok: true }))
1248
1248
  .get('/something/:firstId/:secondId/:version?', (c) => c.json({ ok: true }))
1249
1249
  .get('/docs/:page', (c) => c.json({ ok: true }))
@@ -1316,7 +1316,7 @@ describe.each(['$path', '$url'] as const)('%s() with a param option', (cmd) => {
1316
1316
  })
1317
1317
 
1318
1318
  describe('$url() / $path() with a query option', () => {
1319
- const app = new App()
1319
+ const app = new Acryl()
1320
1320
  .get(
1321
1321
  '/posts',
1322
1322
  validator('query', () => {
@@ -1378,12 +1378,12 @@ describe('Client can be awaited', () => {
1378
1378
  })
1379
1379
 
1380
1380
  describe('Dynamic headers', () => {
1381
- const app = new App()
1381
+ const app = new Acryl()
1382
1382
 
1383
1383
  const route = app.post('/posts', (c) => {
1384
1384
  return c.json({
1385
1385
  requestDynamic: 'dummy',
1386
- requestApp: 'dummy',
1386
+ requestAcryl: 'dummy',
1387
1387
  })
1388
1388
  })
1389
1389
 
@@ -1392,10 +1392,10 @@ describe('Dynamic headers', () => {
1392
1392
  const server = setupServer(
1393
1393
  http.post('http://localhost/posts', async ({ request }) => {
1394
1394
  const requestDynamic = request.headers.get('x-dynamic')
1395
- const requestApp = request.headers.get('x-acryl')
1395
+ const requestAcryl = request.headers.get('x-acryl')
1396
1396
  const payload = {
1397
1397
  requestDynamic,
1398
- requestApp,
1398
+ requestAcryl,
1399
1399
  }
1400
1400
  return HttpResponse.json(payload)
1401
1401
  })
@@ -1440,7 +1440,7 @@ describe('Dynamic headers', () => {
1440
1440
 
1441
1441
  expect(res.ok).toBe(true)
1442
1442
  const data = await res.json()
1443
- expect(data.requestApp).toEqual('acryl')
1443
+ expect(data.requestAcryl).toEqual('acryl')
1444
1444
  expect(data.requestDynamic).toEqual('request')
1445
1445
  })
1446
1446
 
@@ -1456,7 +1456,7 @@ describe('Dynamic headers', () => {
1456
1456
 
1457
1457
  expect(res.ok).toBe(true)
1458
1458
  const data = await res.json()
1459
- expect(data.requestApp).toEqual('acryl')
1459
+ expect(data.requestAcryl).toEqual('acryl')
1460
1460
  expect(data.requestDynamic).toEqual('request')
1461
1461
  })
1462
1462
 
@@ -1472,7 +1472,7 @@ describe('Dynamic headers', () => {
1472
1472
 
1473
1473
  expect(res.ok).toBe(true)
1474
1474
  const data = await res.json()
1475
- expect(data.requestApp).toEqual('acryl')
1475
+ expect(data.requestAcryl).toEqual('acryl')
1476
1476
  expect(data.requestDynamic).toEqual('request')
1477
1477
  })
1478
1478
 
@@ -1485,12 +1485,12 @@ describe('Dynamic headers', () => {
1485
1485
 
1486
1486
  expect(res.ok).toBe(true)
1487
1487
  const data = await res.json()
1488
- expect(data.requestApp).toEqual('request')
1488
+ expect(data.requestAcryl).toEqual('request')
1489
1489
  })
1490
1490
  })
1491
1491
 
1492
1492
  describe('RequestInit work as expected', () => {
1493
- const app = new App()
1493
+ const app = new Acryl()
1494
1494
 
1495
1495
  const route = app
1496
1496
  .get('/credentials', (c) => {
@@ -1583,7 +1583,7 @@ describe('RequestInit work as expected', () => {
1583
1583
  })
1584
1584
 
1585
1585
  describe('WebSocket URL Protocol Translation', () => {
1586
- const app = new App()
1586
+ const app = new Acryl()
1587
1587
  const route = app.get(
1588
1588
  '/',
1589
1589
  upgradeWebSocket((c) => ({
@@ -1637,7 +1637,7 @@ describe('WebSocket URL Protocol Translation', () => {
1637
1637
  })
1638
1638
 
1639
1639
  it('Preserves an index path parameter value', async () => {
1640
- const dynamicRoute = new App().get(
1640
+ const dynamicRoute = new Acryl().get(
1641
1641
  '/:id',
1642
1642
  upgradeWebSocket(() => ({}))
1643
1643
  )
@@ -1650,7 +1650,7 @@ describe('WebSocket URL Protocol Translation', () => {
1650
1650
  })
1651
1651
 
1652
1652
  describe('WebSocket URL Protocol Translation with Query Parameters', () => {
1653
- const app = new App()
1653
+ const app = new Acryl()
1654
1654
  const route = app.get(
1655
1655
  '/',
1656
1656
  upgradeWebSocket((c) => ({
@@ -1749,7 +1749,7 @@ describe('Client can be console.log in react native', () => {
1749
1749
  })
1750
1750
 
1751
1751
  describe('Text response', () => {
1752
- const text = 'My name is App'
1752
+ const text = 'My name is Acryl'
1753
1753
  const obj = { ok: true }
1754
1754
  const server = setupServer(
1755
1755
  http.get('http://localhost/about/me', async () => {
@@ -1764,7 +1764,7 @@ describe('Text response', () => {
1764
1764
  afterEach(() => server.resetHandlers())
1765
1765
  afterAll(() => server.close())
1766
1766
 
1767
- const app = new App().get('/about/me', (c) => c.text(text)).get('/api', (c) => c.json(obj))
1767
+ const app = new Acryl().get('/about/me', (c) => c.text(text)).get('/api', (c) => c.json(obj))
1768
1768
  const client = hc<typeof app>('http://localhost/')
1769
1769
 
1770
1770
  it('Should be never with res.json() - /about/me', async () => {
@@ -1777,7 +1777,7 @@ describe('Text response', () => {
1777
1777
  it('Should be "Hello, World!" with res.text() - /about/me', async () => {
1778
1778
  const res = await client.about.me.$get()
1779
1779
  const data = await res.text()
1780
- expectTypeOf(data).toEqualTypeOf<'My name is App'>()
1780
+ expectTypeOf(data).toEqualTypeOf<'My name is Acryl'>()
1781
1781
  expect(data).toBe(text)
1782
1782
  })
1783
1783
 
@@ -1804,7 +1804,7 @@ describe('Redirect response - only types', () => {
1804
1804
  afterAll(() => server.close())
1805
1805
 
1806
1806
  const condition = () => true
1807
- const app = new App().get('/', async (c) => {
1807
+ const app = new Acryl().get('/', async (c) => {
1808
1808
  const ok = condition()
1809
1809
  const temporary = condition()
1810
1810
  if (ok) {
@@ -1847,7 +1847,7 @@ describe('Redirect response - only types', () => {
1847
1847
  })
1848
1848
 
1849
1849
  describe('WebSocket Provider Integration', () => {
1850
- const app = new App()
1850
+ const app = new Acryl()
1851
1851
  const route = app.get(
1852
1852
  '/',
1853
1853
  upgradeWebSocket((c) => ({
@@ -1898,7 +1898,7 @@ describe('WebSocket Provider Integration', () => {
1898
1898
  describe('Query arrays containing undefined', () => {
1899
1899
  // A validator whose query field is an optional union gives the client an input
1900
1900
  // type of `(string | undefined)[] | undefined`, so this compiles with no cast.
1901
- const app = new App().get(
1901
+ const app = new Acryl().get(
1902
1902
  '/search',
1903
1903
  validator('query', () => ({}) as { tag: (string | undefined)[] | undefined }),
1904
1904
  (c) => c.json({ ok: true })
@@ -1921,7 +1921,7 @@ describe('Query arrays containing undefined', () => {
1921
1921
  })
1922
1922
 
1923
1923
  describe('Empty serialized query', () => {
1924
- const app = new App().get(
1924
+ const app = new Acryl().get(
1925
1925
  '/search',
1926
1926
  validator('query', () => ({}) as { q?: string }),
1927
1927
  (c) => c.json({ ok: true })
@@ -1981,7 +1981,7 @@ describe('Empty serialized query', () => {
1981
1981
  })
1982
1982
 
1983
1983
  describe('Custom buildSearchParams', () => {
1984
- const app = new App()
1984
+ const app = new Acryl()
1985
1985
  const route = app.get(
1986
1986
  '/search',
1987
1987
  validator('query', () => {
@@ -2112,7 +2112,7 @@ describe('ApplyGlobalResponse Type Helper', () => {
2112
2112
 
2113
2113
  it('Should add global error response types to all routes', () => {
2114
2114
  // Use explicit status codes for proper type narrowing
2115
- const app = new App().get('/api/users', (c) => c.json({ users: ['alice', 'bob'] }, 200))
2115
+ const app = new Acryl().get('/api/users', (c) => c.json({ users: ['alice', 'bob'] }, 200))
2116
2116
 
2117
2117
  // Apply global error responses with new object syntax
2118
2118
  type AppWithGlobalErrors = ApplyGlobalResponse<
@@ -2134,7 +2134,7 @@ describe('ApplyGlobalResponse Type Helper', () => {
2134
2134
  })
2135
2135
 
2136
2136
  it('Should support multiple global error status codes', async () => {
2137
- const app = new App()
2137
+ const app = new Acryl()
2138
2138
  .get('/api/users', (c) => c.json({ users: ['alice', 'bob'] }, 200))
2139
2139
  .get('/api/unauthorized', (c) =>
2140
2140
  c.json({ error: 'Unauthorized', message: 'Please login' }, 401)
@@ -2171,9 +2171,9 @@ describe('ApplyGlobalResponse Type Helper', () => {
2171
2171
  })
2172
2172
 
2173
2173
  it('Should work with onError handler pattern', () => {
2174
- // Simulating typical App app with onError handler
2174
+ // Simulating typical Acryl app with onError handler
2175
2175
  // Use explicit status code for proper type narrowing
2176
- const app = new App().get('/api/users', (c) => c.json({ users: ['alice', 'bob'] }, 200))
2176
+ const app = new Acryl().get('/api/users', (c) => c.json({ users: ['alice', 'bob'] }, 200))
2177
2177
 
2178
2178
  // In real app: app.onError((err, c) => c.json({ error: err.message }, 500))
2179
2179
  type AppWithOnError = ApplyGlobalResponse<
@@ -2194,8 +2194,8 @@ describe('ApplyGlobalResponse Type Helper', () => {
2194
2194
  })
2195
2195
 
2196
2196
  it('Should keep route() paths when global responses are applied', () => {
2197
- const users = new App().get('/users', (c) => c.json({ users: ['alice', 'bob'] }, 200))
2198
- const app = new App().route('/api', users)
2197
+ const users = new Acryl().get('/users', (c) => c.json({ users: ['alice', 'bob'] }, 200))
2198
+ const app = new Acryl().route('/api', users)
2199
2199
 
2200
2200
  type AppWithGlobalErrors = ApplyGlobalResponse<
2201
2201
  typeof app,
@@ -2216,7 +2216,7 @@ describe('ApplyGlobalResponse Type Helper', () => {
2216
2216
 
2217
2217
  describe('PickResponseByStatusCode Type Helper', () => {
2218
2218
  it('Should keep only specified status code responses', () => {
2219
- const app = new App().get('/api/users', (c) => {
2219
+ const app = new Acryl().get('/api/users', (c) => {
2220
2220
  try {
2221
2221
  return c.json({ users: ['alice', 'bob'] }, 200)
2222
2222
  } catch {
@@ -2239,7 +2239,7 @@ describe('PickResponseByStatusCode Type Helper', () => {
2239
2239
  })
2240
2240
 
2241
2241
  it('Should work with ApplyGlobalResponse', () => {
2242
- const app = new App().get('/api/users', (c) => {
2242
+ const app = new Acryl().get('/api/users', (c) => {
2243
2243
  try {
2244
2244
  return c.json({ users: ['alice', 'bob'] }, 200)
2245
2245
  } catch {
@@ -2266,14 +2266,14 @@ describe('PickResponseByStatusCode Type Helper', () => {
2266
2266
  })
2267
2267
 
2268
2268
  it('Should work with route() paths', () => {
2269
- const users = new App().get('/users', (c) => {
2269
+ const users = new Acryl().get('/users', (c) => {
2270
2270
  try {
2271
2271
  return c.json({ users: ['alice', 'bob'] }, 200)
2272
2272
  } catch {
2273
2273
  return c.json({ error: 'error' }, 500)
2274
2274
  }
2275
2275
  })
2276
- const app = new App().route('/api', users)
2276
+ const app = new Acryl().route('/api', users)
2277
2277
 
2278
2278
  type AppSuccessOnly = PickResponseByStatusCode<typeof app, 200>
2279
2279
 
@@ -2286,7 +2286,7 @@ describe('PickResponseByStatusCode Type Helper', () => {
2286
2286
  })
2287
2287
 
2288
2288
  it('Should pick multiple status codes', () => {
2289
- const app = new App().get('/api/users', (c) => {
2289
+ const app = new Acryl().get('/api/users', (c) => {
2290
2290
  try {
2291
2291
  return c.json({ users: ['alice', 'bob'] }, 200)
2292
2292
  } catch {
@@ -1,4 +1,4 @@
1
- import type { App } from '../app.ts'
1
+ import type { Acryl } from '../app.ts'
2
2
  import type { FormValue, ValidationTargets } from '../types.ts'
3
3
  import { serialize } from '../utils/cookie.ts'
4
4
  import type { UnionToIntersection } from '../utils/types.ts'
@@ -148,7 +148,7 @@ class ClientRequestImpl {
148
148
  }
149
149
 
150
150
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
151
- export const hc = <T extends App<any, any, any>, Prefix extends string = string>(
151
+ export const hc = <T extends Acryl<any, any, any>, Prefix extends string = string>(
152
152
  baseUrl: Prefix,
153
153
  options?: ClientRequestOptions
154
154
  ) =>
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @description This file is a modified version of `fetch-result-please` (`ofetch`), minimalized and adapted to App's custom needs.
2
+ * @description This file is a modified version of `fetch-result-please` (`ofetch`), minimalized and adapted to Acryl's custom needs.
3
3
  *
4
4
  * @link https://www.npmjs.com/package/fetch-result-please
5
5
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @module
3
- * The HTTP Client for App.
3
+ * The HTTP Client for Acryl.
4
4
  */
5
5
 
6
6
  export { hc } from './client.ts'