effect-start 0.27.0 → 0.29.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 (693) hide show
  1. package/dist/Cookies.d.ts +46 -0
  2. package/dist/Cookies.d.ts.map +1 -0
  3. package/dist/Cookies.js +303 -0
  4. package/dist/Cookies.js.map +1 -0
  5. package/dist/Entity.d.ts +47 -0
  6. package/dist/Entity.d.ts.map +1 -0
  7. package/dist/Entity.js +238 -0
  8. package/dist/Entity.js.map +1 -0
  9. package/dist/Fetch.d.ts +69 -0
  10. package/dist/Fetch.d.ts.map +1 -0
  11. package/dist/Fetch.js +225 -0
  12. package/dist/Fetch.js.map +1 -0
  13. package/dist/FileRouter.d.ts +54 -0
  14. package/dist/FileRouter.d.ts.map +1 -0
  15. package/dist/FileRouter.js +158 -0
  16. package/dist/FileRouter.js.map +1 -0
  17. package/dist/FileRouterCodegen.d.ts +19 -0
  18. package/dist/FileRouterCodegen.d.ts.map +1 -0
  19. package/dist/FileRouterCodegen.js +216 -0
  20. package/dist/FileRouterCodegen.js.map +1 -0
  21. package/dist/FileSystem.d.ts +159 -0
  22. package/dist/FileSystem.d.ts.map +1 -0
  23. package/dist/FileSystem.js +73 -0
  24. package/dist/FileSystem.js.map +1 -0
  25. package/dist/GlobalLayer.d.ts +4 -0
  26. package/dist/GlobalLayer.d.ts.map +1 -0
  27. package/dist/GlobalLayer.js +51 -0
  28. package/dist/GlobalLayer.js.map +1 -0
  29. package/dist/PlatformRuntime.d.ts +30 -0
  30. package/dist/PlatformRuntime.d.ts.map +1 -0
  31. package/dist/PlatformRuntime.js +50 -0
  32. package/dist/PlatformRuntime.js.map +1 -0
  33. package/dist/Route.d.ts +98 -0
  34. package/dist/Route.d.ts.map +1 -0
  35. package/dist/Route.js +101 -0
  36. package/dist/Route.js.map +1 -0
  37. package/dist/RouteBody.d.ts +48 -0
  38. package/dist/RouteBody.d.ts.map +1 -0
  39. package/dist/RouteBody.js +68 -0
  40. package/dist/RouteBody.js.map +1 -0
  41. package/dist/RouteError.d.ts +99 -0
  42. package/dist/RouteError.d.ts.map +1 -0
  43. package/dist/RouteError.js +56 -0
  44. package/dist/RouteError.js.map +1 -0
  45. package/dist/RouteHook.d.ts +13 -0
  46. package/dist/RouteHook.d.ts.map +1 -0
  47. package/dist/RouteHook.js +40 -0
  48. package/dist/RouteHook.js.map +1 -0
  49. package/dist/RouteHttp.d.ts +22 -0
  50. package/dist/RouteHttp.d.ts.map +1 -0
  51. package/dist/RouteHttp.js +266 -0
  52. package/dist/RouteHttp.js.map +1 -0
  53. package/dist/RouteHttpTracer.d.ts +11 -0
  54. package/dist/RouteHttpTracer.d.ts.map +1 -0
  55. package/dist/RouteHttpTracer.js +63 -0
  56. package/dist/RouteHttpTracer.js.map +1 -0
  57. package/dist/RouteMount.d.ts +87 -0
  58. package/dist/RouteMount.d.ts.map +1 -0
  59. package/dist/RouteMount.js +64 -0
  60. package/dist/RouteMount.js.map +1 -0
  61. package/dist/RouteSchema.d.ts +87 -0
  62. package/dist/RouteSchema.d.ts.map +1 -0
  63. package/dist/RouteSchema.js +189 -0
  64. package/dist/RouteSchema.js.map +1 -0
  65. package/dist/RouteSse.d.ts +21 -0
  66. package/dist/RouteSse.d.ts.map +1 -0
  67. package/dist/RouteSse.js +76 -0
  68. package/dist/RouteSse.js.map +1 -0
  69. package/dist/RouteTree.d.ts +58 -0
  70. package/dist/RouteTree.d.ts.map +1 -0
  71. package/dist/RouteTree.js +94 -0
  72. package/dist/RouteTree.js.map +1 -0
  73. package/dist/RouteTrie.d.ts +21 -0
  74. package/dist/RouteTrie.d.ts.map +1 -0
  75. package/dist/RouteTrie.js +153 -0
  76. package/dist/RouteTrie.js.map +1 -0
  77. package/dist/Socket.d.ts +23 -0
  78. package/dist/Socket.d.ts.map +1 -0
  79. package/dist/Socket.js +29 -0
  80. package/dist/Socket.js.map +1 -0
  81. package/dist/Start.d.ts +82 -0
  82. package/dist/Start.d.ts.map +1 -0
  83. package/dist/Start.js +102 -0
  84. package/dist/Start.js.map +1 -0
  85. package/dist/System.d.ts +24 -0
  86. package/dist/System.d.ts.map +1 -0
  87. package/dist/System.js +31 -0
  88. package/dist/System.js.map +1 -0
  89. package/dist/Unique.d.ts +68 -0
  90. package/dist/Unique.d.ts.map +1 -0
  91. package/dist/Unique.js +225 -0
  92. package/dist/Unique.js.map +1 -0
  93. package/dist/_ChildProcess.d.ts +59 -0
  94. package/dist/_ChildProcess.d.ts.map +1 -0
  95. package/dist/_ChildProcess.js +30 -0
  96. package/dist/_ChildProcess.js.map +1 -0
  97. package/dist/_ContentNegotiation.d.ts +13 -0
  98. package/dist/_ContentNegotiation.d.ts.map +1 -0
  99. package/dist/_ContentNegotiation.js +360 -0
  100. package/dist/_ContentNegotiation.js.map +1 -0
  101. package/dist/_Development.d.ts +27 -0
  102. package/dist/_Development.d.ts.map +1 -0
  103. package/dist/_Development.js +57 -0
  104. package/dist/_Development.js.map +1 -0
  105. package/dist/_Docker.d.ts +51 -0
  106. package/dist/_Docker.d.ts.map +1 -0
  107. package/dist/_Docker.js +88 -0
  108. package/dist/_Docker.js.map +1 -0
  109. package/dist/_Effectify.d.ts +210 -0
  110. package/dist/_Effectify.d.ts.map +1 -0
  111. package/dist/_Effectify.js +20 -0
  112. package/dist/_Effectify.js.map +1 -0
  113. package/dist/_Http.d.ts +31 -0
  114. package/dist/_Http.d.ts.map +1 -0
  115. package/dist/_Http.js +73 -0
  116. package/dist/_Http.js.map +1 -0
  117. package/dist/_PathPattern.d.ts +146 -0
  118. package/dist/_PathPattern.d.ts.map +1 -0
  119. package/dist/_PathPattern.js +499 -0
  120. package/dist/_PathPattern.js.map +1 -0
  121. package/dist/_SchemaExtra.d.ts +4 -0
  122. package/dist/_SchemaExtra.d.ts.map +1 -0
  123. package/dist/_SchemaExtra.js +75 -0
  124. package/dist/_SchemaExtra.js.map +1 -0
  125. package/dist/_StartApp.d.ts +13 -0
  126. package/dist/_StartApp.d.ts.map +1 -0
  127. package/dist/_StartApp.js +4 -0
  128. package/dist/_StartApp.js.map +1 -0
  129. package/dist/_StreamExtra.d.ts +29 -0
  130. package/dist/_StreamExtra.d.ts.map +1 -0
  131. package/dist/_StreamExtra.js +101 -0
  132. package/dist/_StreamExtra.js.map +1 -0
  133. package/dist/_Values.d.ts +30 -0
  134. package/dist/_Values.d.ts.map +1 -0
  135. package/dist/_Values.js +46 -0
  136. package/dist/_Values.js.map +1 -0
  137. package/dist/bun/BunBundle.d.ts +12 -0
  138. package/dist/bun/BunBundle.d.ts.map +1 -0
  139. package/dist/bun/BunBundle.js +138 -0
  140. package/dist/bun/BunBundle.js.map +1 -0
  141. package/dist/bun/BunChildProcessSpawner.d.ts +4 -0
  142. package/dist/bun/BunChildProcessSpawner.d.ts.map +1 -0
  143. package/dist/bun/BunChildProcessSpawner.js +99 -0
  144. package/dist/bun/BunChildProcessSpawner.js.map +1 -0
  145. package/dist/bun/BunImportTrackerPlugin.d.ts +14 -0
  146. package/dist/bun/BunImportTrackerPlugin.d.ts.map +1 -0
  147. package/dist/bun/BunImportTrackerPlugin.js +70 -0
  148. package/dist/bun/BunImportTrackerPlugin.js.map +1 -0
  149. package/dist/bun/BunRoute.d.ts +49 -0
  150. package/dist/bun/BunRoute.d.ts.map +1 -0
  151. package/dist/bun/BunRoute.js +121 -0
  152. package/dist/bun/BunRoute.js.map +1 -0
  153. package/dist/bun/BunRuntime.d.ts +3 -0
  154. package/dist/bun/BunRuntime.d.ts.map +1 -0
  155. package/dist/bun/BunRuntime.js +30 -0
  156. package/dist/bun/BunRuntime.js.map +1 -0
  157. package/dist/bun/BunServer.d.ts +52 -0
  158. package/dist/bun/BunServer.d.ts.map +1 -0
  159. package/dist/bun/BunServer.js +262 -0
  160. package/dist/bun/BunServer.js.map +1 -0
  161. package/dist/bun/BunVirtualFilesPlugin.d.ts +5 -0
  162. package/dist/bun/BunVirtualFilesPlugin.d.ts.map +1 -0
  163. package/dist/bun/BunVirtualFilesPlugin.js +41 -0
  164. package/dist/bun/BunVirtualFilesPlugin.js.map +1 -0
  165. package/dist/bun/_BunEnhancedResolve.d.ts +46 -0
  166. package/dist/bun/_BunEnhancedResolve.d.ts.map +1 -0
  167. package/dist/bun/_BunEnhancedResolve.js +103 -0
  168. package/dist/bun/_BunEnhancedResolve.js.map +1 -0
  169. package/dist/bun/_empty.html +0 -0
  170. package/dist/bun/index.d.ts +6 -0
  171. package/dist/bun/index.d.ts.map +1 -0
  172. package/dist/bun/index.js +6 -0
  173. package/dist/bun/index.js.map +1 -0
  174. package/dist/bundler/Bundle.d.ts +62 -0
  175. package/dist/bundler/Bundle.d.ts.map +1 -0
  176. package/dist/bundler/Bundle.js +49 -0
  177. package/dist/bundler/Bundle.js.map +1 -0
  178. package/dist/bundler/BundleFiles.d.ts +14 -0
  179. package/dist/bundler/BundleFiles.d.ts.map +1 -0
  180. package/dist/bundler/BundleFiles.js +97 -0
  181. package/dist/bundler/BundleFiles.js.map +1 -0
  182. package/dist/bundler/BundleRoute.d.ts +28 -0
  183. package/dist/bundler/BundleRoute.d.ts.map +1 -0
  184. package/dist/bundler/BundleRoute.js +52 -0
  185. package/dist/bundler/BundleRoute.js.map +1 -0
  186. package/dist/cli/Argument.d.ts +26 -0
  187. package/dist/cli/Argument.d.ts.map +1 -0
  188. package/dist/cli/Argument.js +31 -0
  189. package/dist/cli/Argument.js.map +1 -0
  190. package/dist/cli/CliError.d.ts +15 -0
  191. package/dist/cli/CliError.d.ts.map +1 -0
  192. package/dist/cli/CliError.js +54 -0
  193. package/dist/cli/CliError.js.map +1 -0
  194. package/dist/cli/Command.d.ts +61 -0
  195. package/dist/cli/Command.d.ts.map +1 -0
  196. package/dist/cli/Command.js +453 -0
  197. package/dist/cli/Command.js.map +1 -0
  198. package/dist/cli/Flag.d.ts +32 -0
  199. package/dist/cli/Flag.d.ts.map +1 -0
  200. package/dist/cli/Flag.js +35 -0
  201. package/dist/cli/Flag.js.map +1 -0
  202. package/dist/cli/HelpDoc.d.ts +28 -0
  203. package/dist/cli/HelpDoc.d.ts.map +1 -0
  204. package/dist/cli/HelpDoc.js +40 -0
  205. package/dist/cli/HelpDoc.js.map +1 -0
  206. package/dist/cli/Param.d.ts +71 -0
  207. package/dist/cli/Param.d.ts.map +1 -0
  208. package/dist/cli/Param.js +236 -0
  209. package/dist/cli/Param.js.map +1 -0
  210. package/dist/cli/Primitive.d.ts +22 -0
  211. package/dist/cli/Primitive.d.ts.map +1 -0
  212. package/dist/cli/Primitive.js +73 -0
  213. package/dist/cli/Primitive.js.map +1 -0
  214. package/dist/cli/index.d.ts +8 -0
  215. package/dist/cli/index.d.ts.map +1 -0
  216. package/dist/cli/index.js +8 -0
  217. package/dist/cli/index.js.map +1 -0
  218. package/dist/client/Overlay.d.ts +3 -0
  219. package/dist/client/Overlay.d.ts.map +1 -0
  220. package/dist/client/Overlay.js +33 -0
  221. package/dist/client/Overlay.js.map +1 -0
  222. package/dist/client/ScrollState.d.ts +7 -0
  223. package/dist/client/ScrollState.d.ts.map +1 -0
  224. package/dist/client/ScrollState.js +95 -0
  225. package/dist/client/ScrollState.js.map +1 -0
  226. package/dist/client/index.d.ts +7 -0
  227. package/dist/client/index.d.ts.map +1 -0
  228. package/dist/client/index.js +80 -0
  229. package/dist/client/index.js.map +1 -0
  230. package/dist/datastar/actions/fetch.d.ts +31 -0
  231. package/dist/datastar/actions/fetch.d.ts.map +1 -0
  232. package/dist/datastar/actions/fetch.js +404 -0
  233. package/dist/datastar/actions/fetch.js.map +1 -0
  234. package/dist/datastar/actions/peek.d.ts +2 -0
  235. package/dist/datastar/actions/peek.d.ts.map +1 -0
  236. package/dist/datastar/actions/peek.js +14 -0
  237. package/dist/datastar/actions/peek.js.map +1 -0
  238. package/dist/datastar/actions/setAll.d.ts +2 -0
  239. package/dist/datastar/actions/setAll.d.ts.map +1 -0
  240. package/dist/datastar/actions/setAll.js +13 -0
  241. package/dist/datastar/actions/setAll.js.map +1 -0
  242. package/dist/datastar/actions/toggleAll.d.ts +2 -0
  243. package/dist/datastar/actions/toggleAll.d.ts.map +1 -0
  244. package/dist/datastar/actions/toggleAll.js +13 -0
  245. package/dist/datastar/actions/toggleAll.js.map +1 -0
  246. package/dist/datastar/attributes/attr.d.ts +2 -0
  247. package/dist/datastar/attributes/attr.d.ts.map +1 -0
  248. package/dist/datastar/attributes/attr.js +49 -0
  249. package/dist/datastar/attributes/attr.js.map +1 -0
  250. package/dist/datastar/attributes/bind.d.ts +2 -0
  251. package/dist/datastar/attributes/bind.d.ts.map +1 -0
  252. package/dist/datastar/attributes/bind.js +176 -0
  253. package/dist/datastar/attributes/bind.js.map +1 -0
  254. package/dist/datastar/attributes/class.d.ts +2 -0
  255. package/dist/datastar/attributes/class.d.ts.map +1 -0
  256. package/dist/datastar/attributes/class.js +48 -0
  257. package/dist/datastar/attributes/class.js.map +1 -0
  258. package/dist/datastar/attributes/computed.d.ts +2 -0
  259. package/dist/datastar/attributes/computed.d.ts.map +1 -0
  260. package/dist/datastar/attributes/computed.js +27 -0
  261. package/dist/datastar/attributes/computed.js.map +1 -0
  262. package/dist/datastar/attributes/effect.d.ts +2 -0
  263. package/dist/datastar/attributes/effect.d.ts.map +1 -0
  264. package/dist/datastar/attributes/effect.js +10 -0
  265. package/dist/datastar/attributes/effect.js.map +1 -0
  266. package/dist/datastar/attributes/indicator.d.ts +2 -0
  267. package/dist/datastar/attributes/indicator.d.ts.map +1 -0
  268. package/dist/datastar/attributes/indicator.js +31 -0
  269. package/dist/datastar/attributes/indicator.js.map +1 -0
  270. package/dist/datastar/attributes/init.d.ts +2 -0
  271. package/dist/datastar/attributes/init.d.ts.map +1 -0
  272. package/dist/datastar/attributes/init.js +27 -0
  273. package/dist/datastar/attributes/init.js.map +1 -0
  274. package/dist/datastar/attributes/jsonSignals.d.ts +2 -0
  275. package/dist/datastar/attributes/jsonSignals.d.ts.map +1 -0
  276. package/dist/datastar/attributes/jsonSignals.js +31 -0
  277. package/dist/datastar/attributes/jsonSignals.js.map +1 -0
  278. package/dist/datastar/attributes/on.d.ts +2 -0
  279. package/dist/datastar/attributes/on.d.ts.map +1 -0
  280. package/dist/datastar/attributes/on.js +79 -0
  281. package/dist/datastar/attributes/on.js.map +1 -0
  282. package/dist/datastar/attributes/onIntersect.d.ts +2 -0
  283. package/dist/datastar/attributes/onIntersect.d.ts.map +1 -0
  284. package/dist/datastar/attributes/onIntersect.js +54 -0
  285. package/dist/datastar/attributes/onIntersect.js.map +1 -0
  286. package/dist/datastar/attributes/onInterval.d.ts +2 -0
  287. package/dist/datastar/attributes/onInterval.d.ts.map +1 -0
  288. package/dist/datastar/attributes/onInterval.js +31 -0
  289. package/dist/datastar/attributes/onInterval.js.map +1 -0
  290. package/dist/datastar/attributes/onSignalPatch.d.ts +2 -0
  291. package/dist/datastar/attributes/onSignalPatch.d.ts.map +1 -0
  292. package/dist/datastar/attributes/onSignalPatch.js +43 -0
  293. package/dist/datastar/attributes/onSignalPatch.js.map +1 -0
  294. package/dist/datastar/attributes/ref.d.ts +2 -0
  295. package/dist/datastar/attributes/ref.d.ts.map +1 -0
  296. package/dist/datastar/attributes/ref.js +11 -0
  297. package/dist/datastar/attributes/ref.js.map +1 -0
  298. package/dist/datastar/attributes/show.d.ts +2 -0
  299. package/dist/datastar/attributes/show.d.ts.map +1 -0
  300. package/dist/datastar/attributes/show.js +32 -0
  301. package/dist/datastar/attributes/show.js.map +1 -0
  302. package/dist/datastar/attributes/signals.d.ts +2 -0
  303. package/dist/datastar/attributes/signals.d.ts.map +1 -0
  304. package/dist/datastar/attributes/signals.js +18 -0
  305. package/dist/datastar/attributes/signals.js.map +1 -0
  306. package/dist/datastar/attributes/style.d.ts +2 -0
  307. package/dist/datastar/attributes/style.d.ts.map +1 -0
  308. package/dist/datastar/attributes/style.js +51 -0
  309. package/dist/datastar/attributes/style.js.map +1 -0
  310. package/dist/datastar/attributes/text.d.ts +2 -0
  311. package/dist/datastar/attributes/text.d.ts.map +1 -0
  312. package/dist/datastar/attributes/text.js +27 -0
  313. package/dist/datastar/attributes/text.js.map +1 -0
  314. package/dist/datastar/engine.d.ts +163 -0
  315. package/dist/datastar/engine.d.ts.map +1 -0
  316. package/dist/datastar/engine.js +1000 -0
  317. package/dist/datastar/engine.js.map +1 -0
  318. package/dist/datastar/index.d.ts +25 -0
  319. package/dist/datastar/index.d.ts.map +1 -0
  320. package/dist/datastar/index.js +25 -0
  321. package/dist/datastar/index.js.map +1 -0
  322. package/dist/datastar/utils.d.ts +52 -0
  323. package/dist/datastar/utils.d.ts.map +1 -0
  324. package/dist/datastar/utils.js +203 -0
  325. package/dist/datastar/utils.js.map +1 -0
  326. package/dist/datastar/watchers/patchElements.d.ts +2 -0
  327. package/dist/datastar/watchers/patchElements.d.ts.map +1 -0
  328. package/dist/datastar/watchers/patchElements.js +400 -0
  329. package/dist/datastar/watchers/patchElements.js.map +1 -0
  330. package/dist/datastar/watchers/patchSignals.d.ts +2 -0
  331. package/dist/datastar/watchers/patchSignals.d.ts.map +1 -0
  332. package/dist/datastar/watchers/patchSignals.js +15 -0
  333. package/dist/datastar/watchers/patchSignals.js.map +1 -0
  334. package/dist/experimental/EncryptedCookies.d.ts +49 -0
  335. package/dist/experimental/EncryptedCookies.d.ts.map +1 -0
  336. package/dist/experimental/EncryptedCookies.js +213 -0
  337. package/dist/experimental/EncryptedCookies.js.map +1 -0
  338. package/dist/experimental/index.d.ts +2 -0
  339. package/dist/experimental/index.d.ts.map +1 -0
  340. package/dist/experimental/index.js +2 -0
  341. package/dist/experimental/index.js.map +1 -0
  342. package/dist/hyper/Hyper.d.ts +26 -0
  343. package/dist/hyper/Hyper.d.ts.map +1 -0
  344. package/dist/hyper/Hyper.js +24 -0
  345. package/dist/hyper/Hyper.js.map +1 -0
  346. package/dist/hyper/HyperHtml.d.ts +24 -0
  347. package/dist/hyper/HyperHtml.d.ts.map +1 -0
  348. package/dist/hyper/HyperHtml.js +153 -0
  349. package/dist/hyper/HyperHtml.js.map +1 -0
  350. package/dist/hyper/HyperHtml.test.d.ts +2 -0
  351. package/dist/hyper/HyperHtml.test.d.ts.map +1 -0
  352. package/dist/hyper/HyperHtml.test.js +283 -0
  353. package/dist/hyper/HyperHtml.test.js.map +1 -0
  354. package/dist/hyper/HyperNode.d.ts +14 -0
  355. package/dist/hyper/HyperNode.d.ts.map +1 -0
  356. package/dist/hyper/HyperNode.js +12 -0
  357. package/dist/hyper/HyperNode.js.map +1 -0
  358. package/dist/hyper/HyperRoute.d.ts +9 -0
  359. package/dist/hyper/HyperRoute.d.ts.map +1 -0
  360. package/dist/hyper/HyperRoute.js +33 -0
  361. package/dist/hyper/HyperRoute.js.map +1 -0
  362. package/dist/hyper/HyperRoute.test.d.ts +2 -0
  363. package/dist/hyper/HyperRoute.test.d.ts.map +1 -0
  364. package/dist/hyper/HyperRoute.test.js +84 -0
  365. package/dist/hyper/HyperRoute.test.js.map +1 -0
  366. package/dist/hyper/html.d.ts +12 -0
  367. package/dist/hyper/html.d.ts.map +1 -0
  368. package/dist/hyper/html.js +31 -0
  369. package/dist/hyper/html.js.map +1 -0
  370. package/dist/hyper/index.d.ts +7 -0
  371. package/dist/hyper/index.d.ts.map +1 -0
  372. package/dist/hyper/index.js +6 -0
  373. package/dist/hyper/index.js.map +1 -0
  374. package/dist/hyper/jsx-runtime.d.ts +8 -0
  375. package/dist/hyper/jsx-runtime.d.ts.map +1 -0
  376. package/dist/hyper/jsx-runtime.js +9 -0
  377. package/dist/hyper/jsx-runtime.js.map +1 -0
  378. package/dist/index.d.ts +9 -0
  379. package/dist/index.d.ts.map +1 -0
  380. package/dist/index.js +9 -0
  381. package/dist/index.js.map +1 -0
  382. package/dist/lint/plugin.d.ts +124 -0
  383. package/dist/lint/plugin.d.ts.map +1 -0
  384. package/dist/lint/plugin.js +533 -0
  385. package/dist/lint/plugin.js.map +1 -0
  386. package/dist/node/NodeFileSystem.d.ts +8 -0
  387. package/dist/node/NodeFileSystem.d.ts.map +1 -0
  388. package/dist/node/NodeFileSystem.js +412 -0
  389. package/dist/node/NodeFileSystem.js.map +1 -0
  390. package/dist/node/NodeUtils.d.ts +3 -0
  391. package/dist/node/NodeUtils.d.ts.map +1 -0
  392. package/dist/node/NodeUtils.js +21 -0
  393. package/dist/node/NodeUtils.js.map +1 -0
  394. package/dist/sql/SqlCache.d.ts +19 -0
  395. package/dist/sql/SqlCache.d.ts.map +1 -0
  396. package/dist/sql/SqlCache.js +35 -0
  397. package/dist/sql/SqlCache.js.map +1 -0
  398. package/dist/sql/SqlClient.d.ts +88 -0
  399. package/dist/sql/SqlClient.d.ts.map +1 -0
  400. package/dist/sql/SqlClient.js +171 -0
  401. package/dist/sql/SqlClient.js.map +1 -0
  402. package/dist/sql/SqlIntrospect.d.ts +92 -0
  403. package/dist/sql/SqlIntrospect.d.ts.map +1 -0
  404. package/dist/sql/SqlIntrospect.js +478 -0
  405. package/dist/sql/SqlIntrospect.js.map +1 -0
  406. package/dist/sql/bun/index.d.ts +6 -0
  407. package/dist/sql/bun/index.d.ts.map +1 -0
  408. package/dist/sql/bun/index.js +132 -0
  409. package/dist/sql/bun/index.js.map +1 -0
  410. package/dist/sql/index.d.ts +4 -0
  411. package/dist/sql/index.d.ts.map +1 -0
  412. package/dist/sql/index.js +4 -0
  413. package/dist/sql/index.js.map +1 -0
  414. package/dist/sql/libsql/index.d.ts +15 -0
  415. package/dist/sql/libsql/index.d.ts.map +1 -0
  416. package/dist/sql/libsql/index.js +132 -0
  417. package/dist/sql/libsql/index.js.map +1 -0
  418. package/dist/sql/mssql/index.d.ts +8 -0
  419. package/dist/sql/mssql/index.d.ts.map +1 -0
  420. package/dist/sql/mssql/index.js +145 -0
  421. package/dist/sql/mssql/index.js.map +1 -0
  422. package/dist/sql/postgres/index.d.ts +7 -0
  423. package/dist/sql/postgres/index.d.ts.map +1 -0
  424. package/dist/sql/postgres/index.js +136 -0
  425. package/dist/sql/postgres/index.js.map +1 -0
  426. package/dist/studio/Simulation.d.ts +3 -0
  427. package/dist/studio/Simulation.d.ts.map +1 -0
  428. package/dist/studio/Simulation.js +606 -0
  429. package/dist/studio/Simulation.js.map +1 -0
  430. package/dist/studio/Studio.d.ts +11 -0
  431. package/dist/studio/Studio.d.ts.map +1 -0
  432. package/dist/studio/Studio.js +30 -0
  433. package/dist/studio/Studio.js.map +1 -0
  434. package/dist/studio/StudioErrors.d.ts +4 -0
  435. package/dist/studio/StudioErrors.d.ts.map +1 -0
  436. package/dist/studio/StudioErrors.js +200 -0
  437. package/dist/studio/StudioErrors.js.map +1 -0
  438. package/dist/studio/StudioLogger.d.ts +2 -0
  439. package/dist/studio/StudioLogger.d.ts.map +1 -0
  440. package/dist/studio/StudioLogger.js +46 -0
  441. package/dist/studio/StudioLogger.js.map +1 -0
  442. package/dist/studio/StudioMetrics.d.ts +4 -0
  443. package/dist/studio/StudioMetrics.d.ts.map +1 -0
  444. package/dist/studio/StudioMetrics.js +62 -0
  445. package/dist/studio/StudioMetrics.js.map +1 -0
  446. package/dist/studio/StudioProcess.d.ts +4 -0
  447. package/dist/studio/StudioProcess.d.ts.map +1 -0
  448. package/dist/studio/StudioProcess.js +50 -0
  449. package/dist/studio/StudioProcess.js.map +1 -0
  450. package/dist/studio/StudioStore.d.ts +199 -0
  451. package/dist/studio/StudioStore.d.ts.map +1 -0
  452. package/dist/studio/StudioStore.js +307 -0
  453. package/dist/studio/StudioStore.js.map +1 -0
  454. package/dist/studio/StudioTracer.d.ts +4 -0
  455. package/dist/studio/StudioTracer.d.ts.map +1 -0
  456. package/dist/studio/StudioTracer.js +111 -0
  457. package/dist/studio/StudioTracer.js.map +1 -0
  458. package/dist/studio/index.d.ts +4 -0
  459. package/dist/studio/index.d.ts.map +1 -0
  460. package/dist/studio/index.js +4 -0
  461. package/dist/studio/index.js.map +1 -0
  462. package/dist/studio/routes/errors/route.d.ts +11 -0
  463. package/dist/studio/routes/errors/route.d.ts.map +1 -0
  464. package/dist/studio/routes/errors/route.js +43 -0
  465. package/dist/studio/routes/errors/route.js.map +1 -0
  466. package/dist/studio/routes/fiberDetail.d.ts +17 -0
  467. package/dist/studio/routes/fiberDetail.d.ts.map +1 -0
  468. package/dist/studio/routes/fiberDetail.js +35 -0
  469. package/dist/studio/routes/fiberDetail.js.map +1 -0
  470. package/dist/studio/routes/fibers/route.d.ts +11 -0
  471. package/dist/studio/routes/fibers/route.d.ts.map +1 -0
  472. package/dist/studio/routes/fibers/route.js +25 -0
  473. package/dist/studio/routes/fibers/route.js.map +1 -0
  474. package/dist/studio/routes/layout.d.ts +10 -0
  475. package/dist/studio/routes/layout.d.ts.map +1 -0
  476. package/dist/studio/routes/layout.html +340 -0
  477. package/dist/studio/routes/layout.js +4 -0
  478. package/dist/studio/routes/layout.js.map +1 -0
  479. package/dist/studio/routes/logs/route.d.ts +11 -0
  480. package/dist/studio/routes/logs/route.d.ts.map +1 -0
  481. package/dist/studio/routes/logs/route.js +30 -0
  482. package/dist/studio/routes/logs/route.js.map +1 -0
  483. package/dist/studio/routes/metrics/route.d.ts +11 -0
  484. package/dist/studio/routes/metrics/route.d.ts.map +1 -0
  485. package/dist/studio/routes/metrics/route.js +18 -0
  486. package/dist/studio/routes/metrics/route.js.map +1 -0
  487. package/dist/studio/routes/route.d.ts +7 -0
  488. package/dist/studio/routes/route.d.ts.map +1 -0
  489. package/dist/studio/routes/route.js +6 -0
  490. package/dist/studio/routes/route.js.map +1 -0
  491. package/dist/studio/routes/routes/route.d.ts +7 -0
  492. package/dist/studio/routes/routes/route.d.ts.map +1 -0
  493. package/dist/studio/routes/routes/route.js +21 -0
  494. package/dist/studio/routes/routes/route.js.map +1 -0
  495. package/dist/studio/routes/services/route.d.ts +7 -0
  496. package/dist/studio/routes/services/route.d.ts.map +1 -0
  497. package/dist/studio/routes/services/route.js +13 -0
  498. package/dist/studio/routes/services/route.js.map +1 -0
  499. package/dist/studio/routes/system/route.d.ts +11 -0
  500. package/dist/studio/routes/system/route.d.ts.map +1 -0
  501. package/dist/studio/routes/system/route.js +19 -0
  502. package/dist/studio/routes/system/route.js.map +1 -0
  503. package/dist/studio/routes/traceDetail.d.ts +17 -0
  504. package/dist/studio/routes/traceDetail.d.ts.map +1 -0
  505. package/dist/studio/routes/traceDetail.js +20 -0
  506. package/dist/studio/routes/traceDetail.js.map +1 -0
  507. package/dist/studio/routes/traces/route.d.ts +11 -0
  508. package/dist/studio/routes/traces/route.d.ts.map +1 -0
  509. package/dist/studio/routes/traces/route.js +30 -0
  510. package/dist/studio/routes/traces/route.js.map +1 -0
  511. package/dist/studio/routes/tree.d.ts +142 -0
  512. package/dist/studio/routes/tree.d.ts.map +1 -0
  513. package/dist/studio/routes/tree.js +28 -0
  514. package/dist/studio/routes/tree.js.map +1 -0
  515. package/dist/studio/ui/Errors.d.ts +5 -0
  516. package/dist/studio/ui/Errors.d.ts.map +1 -0
  517. package/dist/studio/ui/Errors.js +17 -0
  518. package/dist/studio/ui/Errors.js.map +1 -0
  519. package/dist/studio/ui/Fibers.d.ts +25 -0
  520. package/dist/studio/ui/Fibers.d.ts.map +1 -0
  521. package/dist/studio/ui/Fibers.js +134 -0
  522. package/dist/studio/ui/Fibers.js.map +1 -0
  523. package/dist/studio/ui/Logs.d.ts +5 -0
  524. package/dist/studio/ui/Logs.d.ts.map +1 -0
  525. package/dist/studio/ui/Logs.js +27 -0
  526. package/dist/studio/ui/Logs.js.map +1 -0
  527. package/dist/studio/ui/Metrics.d.ts +5 -0
  528. package/dist/studio/ui/Metrics.d.ts.map +1 -0
  529. package/dist/studio/ui/Metrics.js +27 -0
  530. package/dist/studio/ui/Metrics.js.map +1 -0
  531. package/dist/studio/ui/Routes.d.ts +9 -0
  532. package/dist/studio/ui/Routes.d.ts.map +1 -0
  533. package/dist/studio/ui/Routes.js +71 -0
  534. package/dist/studio/ui/Routes.js.map +1 -0
  535. package/dist/studio/ui/Services.d.ts +11 -0
  536. package/dist/studio/ui/Services.d.ts.map +1 -0
  537. package/dist/studio/ui/Services.js +247 -0
  538. package/dist/studio/ui/Services.js.map +1 -0
  539. package/dist/studio/ui/Shell.d.ts +11 -0
  540. package/dist/studio/ui/Shell.d.ts.map +1 -0
  541. package/dist/studio/ui/Shell.js +8 -0
  542. package/dist/studio/ui/Shell.js.map +1 -0
  543. package/dist/studio/ui/System.d.ts +5 -0
  544. package/dist/studio/ui/System.d.ts.map +1 -0
  545. package/dist/studio/ui/System.js +36 -0
  546. package/dist/studio/ui/System.js.map +1 -0
  547. package/dist/studio/ui/Traces.d.ts +13 -0
  548. package/dist/studio/ui/Traces.d.ts.map +1 -0
  549. package/dist/studio/ui/Traces.js +182 -0
  550. package/dist/studio/ui/Traces.js.map +1 -0
  551. package/dist/testing/TestLogger.d.ts +14 -0
  552. package/dist/testing/TestLogger.d.ts.map +1 -0
  553. package/dist/testing/TestLogger.js +33 -0
  554. package/dist/testing/TestLogger.js.map +1 -0
  555. package/dist/testing/index.d.ts +3 -0
  556. package/dist/testing/index.d.ts.map +1 -0
  557. package/dist/testing/index.js +3 -0
  558. package/dist/testing/index.js.map +1 -0
  559. package/dist/testing/utils.d.ts +12 -0
  560. package/dist/testing/utils.d.ts.map +1 -0
  561. package/dist/testing/utils.js +79 -0
  562. package/dist/testing/utils.js.map +1 -0
  563. package/dist/x/cloudflare/CloudflareTunnel.d.ts +12 -0
  564. package/dist/x/cloudflare/CloudflareTunnel.d.ts.map +1 -0
  565. package/dist/x/cloudflare/CloudflareTunnel.js +31 -0
  566. package/dist/x/cloudflare/CloudflareTunnel.js.map +1 -0
  567. package/dist/x/cloudflare/index.d.ts +2 -0
  568. package/dist/x/cloudflare/index.d.ts.map +1 -0
  569. package/dist/x/cloudflare/index.js +2 -0
  570. package/dist/x/cloudflare/index.js.map +1 -0
  571. package/dist/x/tailscale/TailscaleTunnel.d.ts +16 -0
  572. package/dist/x/tailscale/TailscaleTunnel.d.ts.map +1 -0
  573. package/dist/x/tailscale/TailscaleTunnel.js +65 -0
  574. package/dist/x/tailscale/TailscaleTunnel.js.map +1 -0
  575. package/dist/x/tailscale/index.d.ts +2 -0
  576. package/dist/x/tailscale/index.d.ts.map +1 -0
  577. package/dist/x/tailscale/index.js +2 -0
  578. package/dist/x/tailscale/index.js.map +1 -0
  579. package/dist/x/tailwind/TailwindPlugin.d.ts +24 -0
  580. package/dist/x/tailwind/TailwindPlugin.d.ts.map +1 -0
  581. package/dist/x/tailwind/TailwindPlugin.js +220 -0
  582. package/dist/x/tailwind/TailwindPlugin.js.map +1 -0
  583. package/dist/x/tailwind/compile.d.ts +20 -0
  584. package/dist/x/tailwind/compile.d.ts.map +1 -0
  585. package/dist/x/tailwind/compile.js +155 -0
  586. package/dist/x/tailwind/compile.js.map +1 -0
  587. package/dist/x/tailwind/plugin.d.ts +3 -0
  588. package/dist/x/tailwind/plugin.d.ts.map +1 -0
  589. package/dist/x/tailwind/plugin.js +16 -0
  590. package/dist/x/tailwind/plugin.js.map +1 -0
  591. package/package.json +89 -26
  592. package/src/Cookies.ts +4 -8
  593. package/src/Entity.ts +24 -19
  594. package/src/Fetch.ts +128 -5
  595. package/src/FileRouter.ts +46 -49
  596. package/src/FileRouterCodegen.ts +9 -23
  597. package/src/FileSystem.ts +44 -67
  598. package/src/GlobalLayer.ts +85 -0
  599. package/src/PlatformRuntime.ts +8 -1
  600. package/src/Route.ts +2 -2
  601. package/src/RouteBody.ts +1 -1
  602. package/src/RouteHook.ts +1 -1
  603. package/src/RouteHttp.ts +133 -113
  604. package/src/RouteMount.ts +3 -3
  605. package/src/RouteSchema.ts +2 -2
  606. package/src/RouteSse.ts +28 -37
  607. package/src/RouteTree.ts +2 -2
  608. package/src/RouteTrie.ts +1 -1
  609. package/src/Socket.ts +17 -27
  610. package/src/Start.ts +67 -64
  611. package/src/System.ts +42 -9
  612. package/src/Unique.ts +59 -0
  613. package/src/{ChildProcess.ts → _ChildProcess.ts} +16 -28
  614. package/src/{Development.ts → _Development.ts} +16 -21
  615. package/src/_Docker.ts +190 -0
  616. package/src/{Effectify.ts → _Effectify.ts} +7 -10
  617. package/src/{Http.ts → _Http.ts} +0 -28
  618. package/src/{PathPattern.ts → _PathPattern.ts} +105 -0
  619. package/src/{SchemaExtra.ts → _SchemaExtra.ts} +3 -4
  620. package/src/bun/BunChildProcessSpawner.ts +10 -17
  621. package/src/bun/BunRoute.ts +6 -8
  622. package/src/bun/BunRuntime.ts +2 -8
  623. package/src/bun/BunServer.ts +57 -5
  624. package/src/bundler/BundleRoute.ts +2 -2
  625. package/src/cli/Argument.ts +45 -0
  626. package/src/cli/CliError.ts +68 -0
  627. package/src/cli/Command.ts +685 -0
  628. package/src/cli/Flag.ts +63 -0
  629. package/src/cli/HelpDoc.ts +67 -0
  630. package/src/cli/Param.ts +418 -0
  631. package/src/cli/Primitive.ts +94 -0
  632. package/src/cli/index.ts +7 -0
  633. package/src/datastar/watchers/patchElements.ts +3 -2
  634. package/src/hyper/HyperHtml.test.tsx +395 -0
  635. package/src/hyper/HyperNode.ts +1 -2
  636. package/src/hyper/HyperRoute.test.tsx +166 -0
  637. package/src/hyper/HyperRoute.ts +1 -1
  638. package/src/index.ts +1 -1
  639. package/src/lint/plugin.js +179 -125
  640. package/src/node/NodeFileSystem.ts +15 -14
  641. package/src/sql/SqlCache.ts +63 -0
  642. package/src/sql/SqlClient.ts +60 -15
  643. package/src/{SqlIntrospect.ts → sql/SqlIntrospect.ts} +13 -11
  644. package/src/sql/bun/index.ts +29 -27
  645. package/src/sql/index.ts +2 -0
  646. package/src/sql/libsql/index.ts +63 -29
  647. package/src/sql/mssql/index.ts +54 -58
  648. package/src/sql/postgres/index.ts +254 -0
  649. package/src/studio/Simulation.ts +776 -0
  650. package/src/studio/Studio.ts +47 -0
  651. package/src/studio/StudioErrors.ts +224 -0
  652. package/src/studio/StudioLogger.ts +52 -0
  653. package/src/studio/StudioMetrics.ts +72 -0
  654. package/src/studio/StudioProcess.ts +59 -0
  655. package/src/studio/StudioStore.ts +505 -0
  656. package/src/studio/StudioTracer.ts +128 -0
  657. package/src/studio/index.ts +3 -0
  658. package/src/studio/routes/errors/route.tsx +90 -0
  659. package/src/studio/routes/fiberDetail.tsx +51 -0
  660. package/src/studio/routes/fibers/route.tsx +46 -0
  661. package/src/studio/routes/layout.html +340 -0
  662. package/src/studio/routes/layout.tsx +4 -0
  663. package/src/studio/routes/logs/route.tsx +73 -0
  664. package/src/studio/routes/metrics/route.tsx +36 -0
  665. package/src/studio/routes/route.tsx +8 -0
  666. package/src/studio/routes/routes/route.tsx +30 -0
  667. package/src/studio/routes/services/route.tsx +21 -0
  668. package/src/studio/routes/system/route.tsx +43 -0
  669. package/src/studio/routes/traceDetail.tsx +30 -0
  670. package/src/studio/routes/traces/route.tsx +72 -0
  671. package/src/studio/routes/tree.ts +28 -0
  672. package/src/studio/ui/Errors.tsx +80 -0
  673. package/src/studio/ui/Fibers.tsx +336 -0
  674. package/src/studio/ui/Logs.tsx +50 -0
  675. package/src/studio/ui/Metrics.tsx +78 -0
  676. package/src/studio/ui/Routes.tsx +125 -0
  677. package/src/studio/ui/Services.tsx +273 -0
  678. package/src/studio/ui/Shell.tsx +74 -0
  679. package/src/studio/ui/System.tsx +141 -0
  680. package/src/studio/ui/Traces.tsx +419 -0
  681. package/src/testing/utils.ts +59 -0
  682. package/src/x/cloudflare/CloudflareTunnel.ts +1 -1
  683. package/src/x/tailscale/TailscaleTunnel.ts +6 -7
  684. package/src/x/tailwind/compile.ts +6 -1
  685. package/src/Commander.ts +0 -585
  686. package/src/FilePathPattern.ts +0 -115
  687. package/src/PlatformError.ts +0 -73
  688. package/src/TuplePathPattern.ts +0 -75
  689. package/src/sql/mssql/docker.ts +0 -117
  690. /package/src/{ContentNegotiation.ts → _ContentNegotiation.ts} +0 -0
  691. /package/src/{StartApp.ts → _StartApp.ts} +0 -0
  692. /package/src/{StreamExtra.ts → _StreamExtra.ts} +0 -0
  693. /package/src/{Values.ts → _Values.ts} +0 -0
package/src/RouteHttp.ts CHANGED
@@ -7,15 +7,15 @@ import * as Option from "effect/Option"
7
7
  import type * as ParseResult from "effect/ParseResult"
8
8
  import * as Runtime from "effect/Runtime"
9
9
  import * as Stream from "effect/Stream"
10
- import * as ContentNegotiation from "./ContentNegotiation.ts"
10
+ import * as ContentNegotiation from "./_ContentNegotiation.ts"
11
11
  import * as Entity from "./Entity.ts"
12
- import type * as Http from "./Http.ts"
12
+ import type * as Http from "./_Http.ts"
13
13
  import * as Route from "./Route.ts"
14
14
  import type * as RouteBody from "./RouteBody.ts"
15
15
  import * as RouteHttpTracer from "./RouteHttpTracer.ts"
16
16
  import type * as RouteMount from "./RouteMount.ts"
17
17
  import * as RouteTree from "./RouteTree.ts"
18
- import * as StreamExtra from "./StreamExtra.ts"
18
+ import * as StreamExtra from "./_StreamExtra.ts"
19
19
 
20
20
  type UnboundedRouteWithMethod = Route.Route.With<{
21
21
  method: RouteMount.RouteMount.Method
@@ -63,10 +63,13 @@ const getStatusFromCause = (cause: Cause.Cause<unknown>): number => {
63
63
  return 500
64
64
  }
65
65
 
66
- const respondError = (options: { status: number; message: string }): Response =>
66
+ const respondError = (
67
+ options: { status: number; message: string },
68
+ headers?: Record<string, string>,
69
+ ): Response =>
67
70
  new Response(JSON.stringify(options, null, 2), {
68
71
  status: options.status,
69
- headers: { "content-type": "application/json" },
72
+ headers: { "content-type": "application/json", ...headers },
70
73
  })
71
74
 
72
75
  function streamResponse(
@@ -188,140 +191,158 @@ export const toWebHandlerRuntime = <R>(runtime: Runtime.Runtime<R>) => {
188
191
  }
189
192
  }
190
193
 
191
- return (request) => {
192
- const method = request.method.toUpperCase()
193
- const accept = request.headers.get("accept")
194
- const methodRoutes = methodGroups[method] ?? []
194
+ const allowedMethods = Object.keys(methodGroups)
195
+ .filter((m) => methodGroups[m] !== undefined && methodGroups[m]!.length > 0)
196
+ .join(", ")
197
+
198
+ return (request) =>
199
+ new Promise((resolve) => {
200
+ const method = request.method.toUpperCase()
201
+ const accept = request.headers.get("accept")
202
+ const methodRoutes = methodGroups[method] ?? []
203
+
204
+ if (method === "OPTIONS" && methodRoutes.length === 0 && wildcards.length === 0) {
205
+ return resolve(
206
+ new Response(null, {
207
+ status: 204,
208
+ headers: { allow: allowedMethods },
209
+ }),
210
+ )
211
+ }
195
212
 
196
- if (methodRoutes.length === 0 && wildcards.length === 0) {
197
- return Promise.resolve(respondError({ status: 405, message: "method not allowed" }))
198
- }
213
+ if (methodRoutes.length === 0 && wildcards.length === 0) {
214
+ return resolve(
215
+ respondError({ status: 405, message: "method not allowed" }, { allow: allowedMethods }),
216
+ )
217
+ }
199
218
 
200
- const allRoutes = [...wildcards, ...methodRoutes]
201
- const selectedFormat = determineSelectedFormat(accept, allRoutes)
219
+ const allRoutes = [...wildcards, ...methodRoutes]
220
+ const selectedFormat = determineSelectedFormat(accept, allRoutes)
202
221
 
203
- const specificFormats = new Set<string>()
204
- let hasWildcardFormatRoutes = false
205
- for (const r of allRoutes) {
206
- const format = Route.descriptor(r).format
207
- if (format === "*") hasWildcardFormatRoutes = true
208
- else if (format) specificFormats.add(format)
209
- }
210
- const hasSpecificFormatRoutes = specificFormats.size > 0
211
- const varyAccept = specificFormats.size > 1
222
+ const specificFormats = new Set<string>()
223
+ let hasWildcardFormatRoutes = false
224
+ for (const r of allRoutes) {
225
+ const format = Route.descriptor(r).format
226
+ if (format === "*") hasWildcardFormatRoutes = true
227
+ else if (format) specificFormats.add(format)
228
+ }
229
+ const hasSpecificFormatRoutes = specificFormats.size > 0
230
+ const varyAccept = specificFormats.size > 1
212
231
 
213
- if (selectedFormat === undefined && hasSpecificFormatRoutes && !hasWildcardFormatRoutes) {
214
- return Promise.resolve(respondError({ status: 406, message: "not acceptable" }))
215
- }
232
+ if (selectedFormat === undefined && hasSpecificFormatRoutes && !hasWildcardFormatRoutes) {
233
+ return resolve(respondError({ status: 406, message: "not acceptable" }))
234
+ }
216
235
 
217
- const createChain = (initialContext: any): Effect.Effect<Entity.Entity<any>, any, any> => {
218
- let index = 0
219
- let currentContext = initialContext
220
- let routePathSet = false
236
+ const createChain = (initialContext: any): Effect.Effect<Entity.Entity<any>, any, any> => {
237
+ let index = 0
238
+ let currentContext = initialContext
239
+ let routePathSet = false
221
240
 
222
- const runNext = (passedContext?: any): Effect.Effect<Entity.Entity<any>, any, any> => {
223
- if (passedContext !== undefined) {
224
- currentContext = passedContext
225
- }
241
+ const runNext = (passedContext?: any): Effect.Effect<Entity.Entity<any>, any, any> => {
242
+ if (passedContext !== undefined) {
243
+ currentContext = passedContext
244
+ }
226
245
 
227
- if (index >= allRoutes.length) {
228
- return Effect.succeed(
229
- Entity.make({ status: 404, message: "route not found" }, { status: 404 }),
230
- )
231
- }
246
+ if (index >= allRoutes.length) {
247
+ return Effect.succeed(
248
+ Entity.make({ status: 404, message: "route not found" }, { status: 404 }),
249
+ )
250
+ }
232
251
 
233
- const route = allRoutes[index++]
234
- const descriptor = Route.descriptor(route)
235
- const format = descriptor.format
236
- const handler = route.handler as unknown as Handler
252
+ const route = allRoutes[index++]
253
+ const descriptor = Route.descriptor(route)
254
+ const format = descriptor.format
255
+ const handler = route.handler as unknown as Handler
237
256
 
238
- if (format && format !== "*" && format !== selectedFormat) {
239
- return runNext()
240
- }
257
+ if (format && format !== "*" && format !== selectedFormat) {
258
+ return runNext()
259
+ }
241
260
 
242
- currentContext = { ...currentContext, ...descriptor }
261
+ currentContext = { ...currentContext, ...descriptor }
243
262
 
244
- const nextArg = (ctx?: any) => Entity.effect(Effect.suspend(() => runNext(ctx)))
263
+ const nextArg = (ctx?: any) => Entity.effect(Effect.suspend(() => runNext(ctx)))
245
264
 
246
- const routePath = descriptor["path"]
247
- if (!routePathSet && routePath !== undefined) {
248
- routePathSet = true
249
- return Effect.flatMap(Effect.currentSpan.pipe(Effect.option), (spanOption) => {
250
- if (Option.isSome(spanOption)) {
251
- spanOption.value.attribute("http.route", routePath)
252
- }
253
- return handler(currentContext, nextArg)
254
- })
265
+ const routePath = descriptor["path"]
266
+ if (!routePathSet && routePath !== undefined) {
267
+ routePathSet = true
268
+ return Effect.flatMap(Effect.currentSpan.pipe(Effect.option), (spanOption) => {
269
+ if (Option.isSome(spanOption)) {
270
+ spanOption.value.attribute("http.route", routePath)
271
+ }
272
+ return handler(currentContext, nextArg)
273
+ })
274
+ }
275
+
276
+ return handler(currentContext, nextArg)
255
277
  }
256
278
 
257
- return handler(currentContext, nextArg)
279
+ return runNext()
258
280
  }
259
281
 
260
- return runNext()
261
- }
282
+ const effect = Effect.withFiberRuntime<Response, unknown, R>((fiber) => {
283
+ const tracerDisabled =
284
+ !fiber.getFiberRef(FiberRef.currentTracerEnabled) ||
285
+ fiber.getFiberRef(RouteHttpTracer.currentTracerDisabledWhen)(request)
262
286
 
263
- const effect = Effect.withFiberRuntime<Response, unknown, R>((fiber) => {
264
- const tracerDisabled =
265
- !fiber.getFiberRef(FiberRef.currentTracerEnabled) ||
266
- fiber.getFiberRef(RouteHttpTracer.currentTracerDisabledWhen)(request)
287
+ const url = new URL(request.url)
267
288
 
268
- const url = new URL(request.url)
289
+ const innerEffect = Effect.gen(function* () {
290
+ const result = yield* createChain({ request, selectedFormat })
269
291
 
270
- const innerEffect = Effect.gen(function* () {
271
- const result = yield* createChain({ request, selectedFormat })
292
+ const entity = Entity.isEntity(result) ? result : Entity.make(result, { status: 200 })
272
293
 
273
- const entity = Entity.isEntity(result) ? result : Entity.make(result, { status: 200 })
294
+ if (entity.status === 404 && entity.body === undefined) {
295
+ return respondError({ status: 406, message: "not acceptable" })
296
+ }
274
297
 
275
- if (entity.status === 404 && entity.body === undefined) {
276
- return respondError({ status: 406, message: "not acceptable" })
277
- }
298
+ const response = yield* toResponse(entity, selectedFormat, runtime)
299
+ if (varyAccept) {
300
+ response.headers.set("vary", "Accept")
301
+ }
302
+ return response
303
+ })
278
304
 
279
- const response = yield* toResponse(entity, selectedFormat, runtime)
280
- if (varyAccept) {
281
- response.headers.set("vary", "Accept")
305
+ if (tracerDisabled) {
306
+ return innerEffect
282
307
  }
283
- return response
284
- })
285
-
286
- if (tracerDisabled) {
287
- return innerEffect
288
- }
289
-
290
- const spanNameGenerator = fiber.getFiberRef(RouteHttpTracer.currentSpanNameGenerator)
291
-
292
- return Effect.useSpan(
293
- spanNameGenerator(request),
294
- {
295
- parent: Option.getOrUndefined(RouteHttpTracer.parentSpanFromHeaders(request.headers)),
296
- kind: "server",
297
- captureStackTrace: false,
298
- },
299
- (span) => {
300
- span.attribute("http.request.method", request.method)
301
- span.attribute("url.full", url.toString())
302
- span.attribute("url.path", url.pathname)
303
- const query = url.search.slice(1)
304
- if (query !== "") {
305
- span.attribute("url.query", query)
306
- }
307
- span.attribute("url.scheme", url.protocol.slice(0, -1))
308
308
 
309
- const userAgent = request.headers.get("user-agent")
310
- if (userAgent !== null) {
311
- span.attribute("user_agent.original", userAgent)
312
- }
309
+ const spanNameGenerator = fiber.getFiberRef(RouteHttpTracer.currentSpanNameGenerator)
310
+
311
+ return Effect.useSpan(
312
+ spanNameGenerator(request),
313
+ {
314
+ parent: Option.getOrUndefined(RouteHttpTracer.parentSpanFromHeaders(request.headers)),
315
+ kind: "server",
316
+ captureStackTrace: false,
317
+ },
318
+ (span) => {
319
+ span.attribute("http.request.method", request.method)
320
+ span.attribute("url.full", url.toString())
321
+ span.attribute("url.path", url.pathname)
322
+ const query = url.search.slice(1)
323
+ if (query !== "") {
324
+ span.attribute("url.query", query)
325
+ }
326
+ span.attribute("url.scheme", url.protocol.slice(0, -1))
313
327
 
314
- return Effect.flatMap(Effect.exit(Effect.withParentSpan(innerEffect, span)), (exit) => {
315
- if (exit._tag === "Success") {
316
- span.attribute("http.response.status_code", exit.value.status)
328
+ const userAgent = request.headers.get("user-agent")
329
+ if (userAgent !== null) {
330
+ span.attribute("user_agent.original", userAgent)
317
331
  }
318
- return exit
319
- })
320
- },
321
- )
322
- })
323
332
 
324
- return new Promise((resolve) => {
333
+ return Effect.flatMap(
334
+ Effect.exit(Effect.withParentSpan(innerEffect, span)),
335
+ (exit) => {
336
+ if (exit._tag === "Success") {
337
+ span.attribute("http.response.status_code", exit.value.status)
338
+ }
339
+ return exit
340
+ },
341
+ )
342
+ },
343
+ )
344
+ })
345
+
325
346
  const fiber = runFork(
326
347
  effect.pipe(
327
348
  Effect.scoped,
@@ -356,7 +377,6 @@ export const toWebHandlerRuntime = <R>(runtime: Runtime.Runtime<R>) => {
356
377
  }
357
378
  })
358
379
  })
359
- }
360
380
  }
361
381
  }
362
382
 
package/src/RouteMount.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as Function from "effect/Function"
2
2
  import type * as Types from "effect/Types"
3
- import type * as Http from "./Http.ts"
4
- import type * as PathPattern from "./PathPattern.ts"
3
+ import type * as Http from "./_Http.ts"
4
+ import type * as PathPattern from "./_PathPattern.ts"
5
5
  import * as Route from "./Route.ts"
6
6
  import type * as RouteBody from "./RouteBody.ts"
7
7
 
8
- const RouteSetTypeId: unique symbol = Symbol.for("effect-start/RouteSet")
8
+ const RouteSetTypeId = "~effect-start/RouteSet" as const
9
9
 
10
10
  // oxlint-disable-next-line import/first, typescript/consistent-type-imports -- typeof import() is not an import statement
11
11
  type Module = typeof import("./RouteMount.ts")
@@ -3,8 +3,8 @@ import type * as ParseResult from "effect/ParseResult"
3
3
  import * as Schema from "effect/Schema"
4
4
  import type * as Scope from "effect/Scope"
5
5
  import * as Entity from "./Entity.ts"
6
- import * as Http from "./Http.ts"
7
- import * as PathPattern from "./PathPattern.ts"
6
+ import * as Http from "./_Http.ts"
7
+ import * as PathPattern from "./_PathPattern.ts"
8
8
  import * as Route from "./Route.ts"
9
9
  import * as RouteHook from "./RouteHook.ts"
10
10
 
package/src/RouteSse.ts CHANGED
@@ -5,46 +5,37 @@ import * as Stream from "effect/Stream"
5
5
  import type * as Utils from "effect/Utils"
6
6
  import * as Entity from "./Entity.ts"
7
7
  import * as Route from "./Route.ts"
8
- import * as StreamExtra from "./StreamExtra.ts"
9
- import type * as Values from "./Values.ts"
8
+ import * as StreamExtra from "./_StreamExtra.ts"
9
+ import type * as Values from "./_Values.ts"
10
10
 
11
11
  const HEARTBEAT_INTERVAL = Duration.seconds(5)
12
12
  const HEARTBEAT = ": <3\n\n"
13
13
 
14
- export interface SseEvent {
15
- data?: string | undefined
16
- type?: string
17
- retry?: number
14
+ interface SseEvent {
15
+ readonly [key: string]: unknown
16
+ readonly _tag?: string
17
+ readonly data?: string | undefined
18
+ readonly type?: string
19
+ readonly retry?: number
18
20
  }
19
21
 
20
- export type SseTaggedEvent = {
21
- readonly _tag: string
22
- }
23
-
24
- export type SseEventInput = SseEvent | SseTaggedEvent
25
-
26
- function isTaggedEvent(event: SseEventInput): event is SseTaggedEvent {
27
- return Object.hasOwn(event, "_tag") && typeof event["_tag"] === "string"
28
- }
29
-
30
- function formatSseEvent(event: SseEventInput): string {
31
- if (isTaggedEvent(event)) {
22
+ function formatSseEvent(event: SseEvent): string {
23
+ if (event._tag) {
32
24
  const json = JSON.stringify(event)
33
25
  return `event: ${event._tag}\ndata: ${json}\n\n`
34
26
  }
35
27
 
36
- const e = event as SseEvent
37
28
  let result = ""
38
- if (e.type) {
39
- result += `event: ${e.type}\n`
29
+ if (event.type) {
30
+ result += `event: ${event.type}\n`
40
31
  }
41
- if (typeof e.data === "string") {
42
- for (const line of e.data.split("\n")) {
32
+ if (typeof event.data === "string") {
33
+ for (const line of event.data.split("\n")) {
43
34
  result += `data: ${line}\n`
44
35
  }
45
36
  }
46
- if (e.retry !== undefined) {
47
- result += `retry: ${e.retry}\n`
37
+ if (event.retry !== undefined) {
38
+ result += `retry: ${event.retry}\n`
48
39
  }
49
40
  if (result === "") {
50
41
  return ""
@@ -52,18 +43,18 @@ function formatSseEvent(event: SseEventInput): string {
52
43
  return result + "\n"
53
44
  }
54
45
 
55
- export type SseHandlerInput<B, E, R> =
56
- | Stream.Stream<SseEventInput, E, R>
57
- | Effect.Effect<Stream.Stream<SseEventInput, E, R>, E, R>
46
+ type SseHandlerInput<B, E, R> =
47
+ | Stream.Stream<SseEvent, E, R>
48
+ | Effect.Effect<Stream.Stream<SseEvent, E, R>, E, R>
58
49
  | ((
59
50
  context: Values.Simplify<B>,
60
51
  next: (context?: Partial<B> & Record<string, unknown>) => Entity.Entity<string>,
61
52
  ) =>
62
- | Stream.Stream<SseEventInput, E, R>
63
- | Effect.Effect<Stream.Stream<SseEventInput, E, R>, E, R>
53
+ | Stream.Stream<SseEvent, E, R>
54
+ | Effect.Effect<Stream.Stream<SseEvent, E, R>, E, R>
64
55
  | Generator<
65
56
  Utils.YieldWrap<Effect.Effect<unknown, E, R>>,
66
- Stream.Stream<SseEventInput, E, R>,
57
+ Stream.Stream<SseEvent, E, R>,
67
58
  unknown
68
59
  >)
69
60
 
@@ -81,24 +72,24 @@ export function sse<
81
72
  E,
82
73
  R
83
74
  > = (ctx, _next) => {
84
- const getStream = (): Effect.Effect<Stream.Stream<SseEventInput, E, R>, E, R> => {
75
+ const getStream = (): Effect.Effect<Stream.Stream<SseEvent, E, R>, E, R> => {
85
76
  if (typeof handler === "function") {
86
77
  const result = (handler as Function)(ctx, _next)
87
78
  if (StreamExtra.isStream(result)) {
88
- return Effect.succeed(result as Stream.Stream<SseEventInput, E, R>)
79
+ return Effect.succeed(result as Stream.Stream<SseEvent, E, R>)
89
80
  }
90
81
  if (Effect.isEffect(result)) {
91
- return result as Effect.Effect<Stream.Stream<SseEventInput, E, R>, E, R>
82
+ return result as Effect.Effect<Stream.Stream<SseEvent, E, R>, E, R>
92
83
  }
93
84
  return Effect.gen(function* () {
94
85
  return yield* result
95
- }) as Effect.Effect<Stream.Stream<SseEventInput, E, R>, E, R>
86
+ }) as Effect.Effect<Stream.Stream<SseEvent, E, R>, E, R>
96
87
  }
97
88
  if (StreamExtra.isStream(handler)) {
98
- return Effect.succeed(handler as Stream.Stream<SseEventInput, E, R>)
89
+ return Effect.succeed(handler as Stream.Stream<SseEvent, E, R>)
99
90
  }
100
91
  if (Effect.isEffect(handler)) {
101
- return handler as Effect.Effect<Stream.Stream<SseEventInput, E, R>, E, R>
92
+ return handler as Effect.Effect<Stream.Stream<SseEvent, E, R>, E, R>
102
93
  }
103
94
  return Effect.succeed(Stream.empty)
104
95
  }
package/src/RouteTree.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as Predicate from "effect/Predicate"
2
- import * as PathPattern from "./PathPattern.ts"
2
+ import * as PathPattern from "./_PathPattern.ts"
3
3
  import * as Route from "./Route.ts"
4
4
  import type * as RouteMount from "./RouteMount.ts"
5
5
 
6
- const TypeId: unique symbol = Symbol.for("effect-start/RouteTree")
6
+ const TypeId = "~effect-start/RouteTree" as const
7
7
  const RouteTreeRoutes: unique symbol = Symbol()
8
8
 
9
9
  type MethodRoute = Route.Route.With<{ method: string }>
package/src/RouteTrie.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as PathPattern from "./PathPattern.ts"
1
+ import * as PathPattern from "./_PathPattern.ts"
2
2
  import * as Route from "./Route.ts"
3
3
 
4
4
  export interface Node {
package/src/Socket.ts CHANGED
@@ -1,50 +1,40 @@
1
1
  /*
2
2
  * Adapted from @effect/platform
3
3
  */
4
+ import * as Data from "effect/Data"
4
5
  import * as Predicate from "effect/Predicate"
5
- import * as PlatformError from "./PlatformError.ts"
6
6
 
7
- export const SocketErrorTypeId: unique symbol = Symbol.for("@effect/platform/Socket/SocketError")
8
-
9
- export type SocketErrorTypeId = typeof SocketErrorTypeId
7
+ const SocketErrorTypeId: unique symbol = Symbol.for("@effect/platform/Socket/SocketError")
10
8
 
11
9
  export const isSocketError = (u: unknown): u is SocketError =>
12
10
  Predicate.hasProperty(u, SocketErrorTypeId)
13
11
 
14
- export type SocketError = SocketGenericError | SocketCloseError
15
-
16
- export class SocketGenericError extends PlatformError.TypeIdError(
17
- SocketErrorTypeId,
18
- "SocketError",
19
- )<{
20
- readonly reason: "Write" | "Read" | "Open" | "OpenTimeout"
21
- readonly cause: unknown
22
- }> {
23
- get message() {
24
- return `An error occurred during ${this.reason}`
25
- }
26
- }
27
-
28
- export class SocketCloseError extends PlatformError.TypeIdError(SocketErrorTypeId, "SocketError")<{
29
- readonly reason: "Close"
30
- readonly code: number
12
+ export class SocketError extends Data.TaggedError("SocketError")<{
13
+ readonly reason: "Write" | "Read" | "Open" | "OpenTimeout" | "Close"
14
+ readonly cause?: unknown
15
+ readonly code?: number | undefined
31
16
  readonly closeReason?: string | undefined
32
17
  }> {
33
- static is(u: unknown): u is SocketCloseError {
18
+ readonly [SocketErrorTypeId]: typeof SocketErrorTypeId = SocketErrorTypeId
19
+
20
+ static isClose(u: unknown): u is SocketError & { reason: "Close" } {
34
21
  return isSocketError(u) && u.reason === "Close"
35
22
  }
36
23
 
37
24
  static isClean(isClean: (code: number) => boolean) {
38
- return function (u: unknown): u is SocketCloseError {
39
- return SocketCloseError.is(u) && isClean(u.code)
25
+ return function (u: unknown): u is SocketError & { reason: "Close" } {
26
+ return SocketError.isClose(u) && u.code !== undefined && isClean(u.code)
40
27
  }
41
28
  }
42
29
 
43
30
  get message() {
44
- if (this.closeReason) {
45
- return `${this.reason}: ${this.code}: ${this.closeReason}`
31
+ if (this.reason === "Close") {
32
+ if (this.closeReason) {
33
+ return `${this.reason}: ${this.code}: ${this.closeReason}`
34
+ }
35
+ return `${this.reason}: ${this.code}`
46
36
  }
47
- return `${this.reason}: ${this.code}`
37
+ return `An error occurred during ${this.reason}`
48
38
  }
49
39
  }
50
40