effect-start 0.22.0 → 0.23.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 (313) hide show
  1. package/dist/BlobStore.d.ts +80 -0
  2. package/dist/BlobStore.js +19 -0
  3. package/dist/ChildProcess.d.ts +60 -0
  4. package/dist/ChildProcess.js +30 -0
  5. package/dist/Commander.d.ts +3 -6
  6. package/dist/Commander.js +6 -13
  7. package/dist/ContentNegotiation.d.ts +8 -9
  8. package/dist/ContentNegotiation.js +32 -37
  9. package/dist/Cookies.d.ts +47 -0
  10. package/dist/Cookies.js +273 -363
  11. package/dist/Development.d.ts +2 -2
  12. package/dist/Development.js +3 -4
  13. package/dist/Effectify.d.ts +1 -4
  14. package/dist/FilePathPattern.d.ts +3 -3
  15. package/dist/FileRouter.d.ts +5 -8
  16. package/dist/FileRouter.js +9 -10
  17. package/dist/FileRouterCodegen.d.ts +1 -1
  18. package/dist/FileRouterCodegen.js +33 -13
  19. package/dist/FileSystem.d.ts +158 -0
  20. package/dist/FileSystem.js +64 -125
  21. package/dist/Http.js +2 -6
  22. package/dist/PathPattern.d.ts +7 -7
  23. package/dist/PathPattern.js +1 -3
  24. package/dist/PlatformError.d.ts +24 -32
  25. package/dist/PlatformError.js +3 -21
  26. package/dist/PlatformRuntime.js +5 -10
  27. package/dist/Route.d.ts +14 -19
  28. package/dist/Route.js +8 -11
  29. package/dist/RouteBody.d.ts +6 -12
  30. package/dist/RouteBody.js +2 -2
  31. package/dist/RouteError.d.ts +98 -0
  32. package/dist/RouteError.js +55 -0
  33. package/dist/RouteHook.js +6 -11
  34. package/dist/RouteHttp.d.ts +3 -3
  35. package/dist/RouteHttp.js +27 -22
  36. package/dist/RouteMount.d.ts +16 -50
  37. package/dist/RouteMount.js +6 -20
  38. package/dist/RouteSchema.d.ts +22 -1
  39. package/dist/RouteSchema.js +33 -0
  40. package/dist/RouteSse.js +4 -10
  41. package/dist/RouteTree.d.ts +2 -1
  42. package/dist/RouteTree.js +17 -15
  43. package/dist/RouteTrie.d.ts +2 -2
  44. package/dist/RouteTrie.js +4 -9
  45. package/dist/SchemaExtra.d.ts +1 -1
  46. package/dist/Socket.d.ts +27 -0
  47. package/dist/Socket.js +20 -28
  48. package/dist/Sql.d.ts +34 -0
  49. package/dist/Sql.js +5 -0
  50. package/dist/SqlIntrospect.d.ts +91 -0
  51. package/dist/SqlIntrospect.js +466 -0
  52. package/dist/Start.d.ts +4 -6
  53. package/dist/Start.js +10 -2
  54. package/dist/StreamExtra.d.ts +1 -1
  55. package/dist/StreamExtra.js +9 -9
  56. package/dist/System.d.ts +7 -0
  57. package/dist/System.js +22 -0
  58. package/dist/TuplePathPattern.js +55 -50
  59. package/dist/Unique.js +7 -7
  60. package/dist/Values.d.ts +2 -1
  61. package/dist/Values.js +19 -13
  62. package/dist/bun/BunBlobStoreDisk.d.ts +6 -0
  63. package/dist/bun/BunBlobStoreDisk.js +116 -0
  64. package/dist/bun/BunBlobStoreS3.d.ts +11 -0
  65. package/dist/bun/BunBlobStoreS3.js +89 -0
  66. package/dist/bun/BunBlobWatcherDisk.d.ts +6 -0
  67. package/dist/bun/BunBlobWatcherDisk.js +60 -0
  68. package/dist/bun/BunBlobWatcherQueue.d.ts +6 -0
  69. package/dist/bun/BunBlobWatcherQueue.js +17 -0
  70. package/dist/bun/BunBundle.d.ts +5 -6
  71. package/dist/bun/BunBundle.js +7 -15
  72. package/dist/bun/BunChildProcessSpawner.d.ts +3 -0
  73. package/dist/bun/BunChildProcessSpawner.js +103 -0
  74. package/dist/bun/BunImportTrackerPlugin.d.ts +1 -1
  75. package/dist/bun/BunImportTrackerPlugin.js +3 -5
  76. package/dist/bun/BunRoute.d.ts +3 -2
  77. package/dist/bun/BunRoute.js +5 -7
  78. package/dist/bun/BunRuntime.js +1 -1
  79. package/dist/bun/BunServer.d.ts +11 -4
  80. package/dist/bun/BunServer.js +35 -11
  81. package/dist/bun/BunSql.d.ts +4 -0
  82. package/dist/bun/BunSql.js +81 -0
  83. package/dist/bun/_BunEnhancedResolve.d.ts +3 -3
  84. package/dist/bun/_BunEnhancedResolve.js +2 -4
  85. package/dist/bun/index.d.ts +1 -0
  86. package/dist/bun/index.js +1 -0
  87. package/dist/bundler/Bundle.d.ts +2 -1
  88. package/dist/bundler/Bundle.js +1 -1
  89. package/dist/bundler/BundleFiles.d.ts +5 -5
  90. package/dist/bundler/BundleFiles.js +10 -8
  91. package/dist/bundler/BundleRoute.d.ts +27 -0
  92. package/dist/bundler/BundleRoute.js +51 -0
  93. package/dist/client/ScrollState.js +2 -6
  94. package/dist/client/index.js +6 -8
  95. package/dist/console/Console.d.ts +6 -0
  96. package/dist/console/Console.js +26 -0
  97. package/dist/console/ConsoleErrors.d.ts +3 -0
  98. package/dist/console/ConsoleErrors.js +200 -0
  99. package/dist/console/ConsoleLogger.d.ts +3 -0
  100. package/dist/console/ConsoleLogger.js +47 -0
  101. package/dist/console/ConsoleMetrics.d.ts +3 -0
  102. package/dist/console/ConsoleMetrics.js +61 -0
  103. package/dist/console/ConsoleProcess.d.ts +3 -0
  104. package/dist/console/ConsoleProcess.js +49 -0
  105. package/dist/console/ConsoleStore.d.ts +144 -0
  106. package/dist/console/ConsoleStore.js +61 -0
  107. package/dist/console/ConsoleTracer.d.ts +3 -0
  108. package/dist/console/ConsoleTracer.js +94 -0
  109. package/dist/console/Simulation.d.ts +2 -0
  110. package/dist/console/Simulation.js +633 -0
  111. package/dist/console/index.d.ts +3 -0
  112. package/dist/console/index.js +3 -0
  113. package/dist/console/routes/errors/route.d.ts +10 -0
  114. package/dist/console/routes/errors/route.js +47 -0
  115. package/dist/console/routes/fiberDetail.d.ts +16 -0
  116. package/dist/console/routes/fiberDetail.js +38 -0
  117. package/dist/console/routes/fibers/route.d.ts +10 -0
  118. package/dist/console/routes/fibers/route.js +19 -0
  119. package/dist/console/routes/git/route.d.ts +11 -0
  120. package/dist/console/routes/git/route.js +33 -0
  121. package/dist/console/routes/layout.d.ts +9 -0
  122. package/dist/console/routes/layout.js +3 -0
  123. package/dist/console/routes/logs/route.d.ts +10 -0
  124. package/dist/console/routes/logs/route.js +32 -0
  125. package/dist/console/routes/metrics/route.d.ts +10 -0
  126. package/dist/console/routes/metrics/route.js +17 -0
  127. package/dist/console/routes/route.d.ts +6 -0
  128. package/dist/console/routes/route.js +5 -0
  129. package/dist/console/routes/routes/route.d.ts +6 -0
  130. package/dist/console/routes/routes/route.js +20 -0
  131. package/dist/console/routes/services/route.d.ts +6 -0
  132. package/dist/console/routes/services/route.js +12 -0
  133. package/dist/console/routes/system/route.d.ts +10 -0
  134. package/dist/console/routes/system/route.js +18 -0
  135. package/dist/console/routes/traceDetail.d.ts +16 -0
  136. package/dist/console/routes/traceDetail.js +14 -0
  137. package/dist/console/routes/traces/route.d.ts +10 -0
  138. package/dist/console/routes/traces/route.js +39 -0
  139. package/dist/console/routes/tree.d.ts +153 -0
  140. package/dist/console/routes/tree.js +29 -0
  141. package/dist/console/ui/Errors.d.ts +4 -0
  142. package/dist/console/ui/Errors.js +15 -0
  143. package/dist/console/ui/Fibers.d.ts +24 -0
  144. package/dist/console/ui/Fibers.js +121 -0
  145. package/dist/console/ui/Git.d.ts +20 -0
  146. package/dist/console/ui/Git.js +95 -0
  147. package/dist/console/ui/Logs.d.ts +4 -0
  148. package/dist/console/ui/Logs.js +25 -0
  149. package/dist/console/ui/Metrics.d.ts +4 -0
  150. package/dist/console/ui/Metrics.js +26 -0
  151. package/dist/console/ui/Routes.d.ts +8 -0
  152. package/dist/console/ui/Routes.js +70 -0
  153. package/dist/console/ui/Services.d.ts +10 -0
  154. package/dist/console/ui/Services.js +246 -0
  155. package/dist/console/ui/Shell.d.ts +10 -0
  156. package/dist/console/ui/Shell.js +7 -0
  157. package/dist/console/ui/System.d.ts +4 -0
  158. package/dist/console/ui/System.js +35 -0
  159. package/dist/console/ui/Traces.d.ts +12 -0
  160. package/dist/console/ui/Traces.js +179 -0
  161. package/dist/datastar/actions/fetch.d.ts +1 -1
  162. package/dist/datastar/actions/fetch.js +10 -18
  163. package/dist/datastar/actions/peek.js +1 -2
  164. package/dist/datastar/actions/setAll.js +1 -2
  165. package/dist/datastar/actions/toggleAll.js +1 -2
  166. package/dist/datastar/attributes/attr.js +1 -2
  167. package/dist/datastar/attributes/bind.js +10 -18
  168. package/dist/datastar/attributes/class.js +2 -5
  169. package/dist/datastar/attributes/computed.js +2 -3
  170. package/dist/datastar/attributes/effect.js +1 -2
  171. package/dist/datastar/attributes/indicator.js +2 -4
  172. package/dist/datastar/attributes/init.js +2 -3
  173. package/dist/datastar/attributes/jsonSignals.js +1 -2
  174. package/dist/datastar/attributes/on.js +41 -22
  175. package/dist/datastar/attributes/onIntersect.js +2 -3
  176. package/dist/datastar/attributes/onInterval.js +2 -3
  177. package/dist/datastar/attributes/onSignalPatch.js +2 -4
  178. package/dist/datastar/attributes/ref.js +1 -2
  179. package/dist/datastar/attributes/show.js +1 -2
  180. package/dist/datastar/attributes/signals.js +1 -2
  181. package/dist/datastar/attributes/style.js +6 -12
  182. package/dist/datastar/attributes/text.js +1 -2
  183. package/dist/datastar/engine.d.ts +13 -7
  184. package/dist/datastar/engine.js +76 -48
  185. package/dist/datastar/happydom.d.ts +1 -0
  186. package/dist/datastar/happydom.js +8 -0
  187. package/dist/datastar/index.d.ts +1 -1
  188. package/dist/datastar/index.js +1 -1
  189. package/dist/datastar/utils.js +4 -7
  190. package/dist/datastar/watchers/patchElements.js +24 -45
  191. package/dist/datastar/watchers/patchSignals.js +1 -2
  192. package/dist/experimental/EncryptedCookies.d.ts +2 -5
  193. package/dist/experimental/EncryptedCookies.js +17 -48
  194. package/dist/experimental/index.d.ts +0 -1
  195. package/dist/experimental/index.js +0 -1
  196. package/dist/hyper/Hyper.d.ts +2 -9
  197. package/dist/hyper/Hyper.js +1 -12
  198. package/dist/hyper/HyperHtml.d.ts +1 -1
  199. package/dist/hyper/HyperHtml.js +18 -12
  200. package/dist/hyper/HyperHtml.test.d.ts +1 -0
  201. package/dist/hyper/HyperHtml.test.js +197 -0
  202. package/dist/hyper/HyperRoute.test.js +14 -3
  203. package/dist/hyper/html.d.ts +11 -0
  204. package/dist/hyper/html.js +30 -0
  205. package/dist/hyper/index.d.ts +2 -0
  206. package/dist/hyper/index.js +1 -0
  207. package/dist/hyper/jsx-runtime.d.ts +1 -1
  208. package/dist/hyper/jsx-runtime.js +1 -1
  209. package/dist/index.d.ts +1 -0
  210. package/dist/index.js +1 -0
  211. package/dist/lint/plugin.d.ts +86 -0
  212. package/dist/lint/plugin.js +341 -0
  213. package/dist/node/NodeFileSystem.d.ts +2 -2
  214. package/dist/node/NodeFileSystem.js +4 -14
  215. package/dist/sql/bun/index.d.ts +3 -0
  216. package/dist/sql/bun/index.js +75 -0
  217. package/dist/sql/mssql/docker.d.ts +2 -0
  218. package/dist/sql/mssql/docker.js +67 -0
  219. package/dist/sql/mssql/index.d.ts +21 -0
  220. package/dist/sql/mssql/index.js +113 -0
  221. package/dist/testing/TestLogger.js +4 -1
  222. package/dist/testing/index.d.ts +0 -1
  223. package/dist/testing/index.js +0 -1
  224. package/dist/testing/utils.d.ts +3 -3
  225. package/dist/testing/utils.js +4 -4
  226. package/dist/x/cloudflare/CloudflareTunnel.d.ts +2 -5
  227. package/dist/x/cloudflare/CloudflareTunnel.js +14 -27
  228. package/dist/x/datastar/Datastar.d.ts +1 -1
  229. package/dist/x/datastar/Datastar.js +13 -12
  230. package/dist/x/datastar/index.d.ts +1 -2
  231. package/dist/x/datastar/index.js +1 -2
  232. package/dist/x/tailscale/TailscaleTunnel.d.ts +15 -0
  233. package/dist/x/tailscale/TailscaleTunnel.js +68 -0
  234. package/dist/x/tailscale/index.d.ts +1 -0
  235. package/dist/x/tailscale/index.js +1 -0
  236. package/dist/x/tailwind/TailwindPlugin.js +19 -19
  237. package/dist/x/tailwind/compile.d.ts +2 -2
  238. package/dist/x/tailwind/compile.js +2 -4
  239. package/package.json +22 -10
  240. package/src/ChildProcess.ts +145 -0
  241. package/src/PlatformError.ts +27 -50
  242. package/src/Route.ts +2 -2
  243. package/src/RouteError.ts +76 -0
  244. package/src/RouteHttp.ts +13 -5
  245. package/src/RouteSchema.ts +96 -1
  246. package/src/RouteTree.ts +12 -0
  247. package/src/Sql.ts +51 -0
  248. package/src/SqlIntrospect.ts +620 -0
  249. package/src/Start.ts +15 -3
  250. package/src/System.ts +43 -0
  251. package/src/Values.ts +7 -0
  252. package/src/bun/BunChildProcessSpawner.ts +143 -0
  253. package/src/bun/BunRoute.ts +5 -2
  254. package/src/bun/BunServer.ts +22 -1
  255. package/src/bun/index.ts +1 -0
  256. package/src/bundler/BundleRoute.ts +66 -0
  257. package/src/console/Console.ts +42 -0
  258. package/src/console/ConsoleErrors.ts +213 -0
  259. package/src/console/ConsoleLogger.ts +56 -0
  260. package/src/console/ConsoleMetrics.ts +72 -0
  261. package/src/console/ConsoleProcess.ts +59 -0
  262. package/src/console/ConsoleStore.ts +187 -0
  263. package/src/console/ConsoleTracer.ts +107 -0
  264. package/src/console/Simulation.ts +814 -0
  265. package/src/console/console.html +340 -0
  266. package/src/console/index.ts +3 -0
  267. package/src/console/routes/errors/route.tsx +97 -0
  268. package/src/console/routes/fiberDetail.tsx +54 -0
  269. package/src/console/routes/fibers/route.tsx +45 -0
  270. package/src/console/routes/git/route.tsx +64 -0
  271. package/src/console/routes/layout.tsx +4 -0
  272. package/src/console/routes/logs/route.tsx +77 -0
  273. package/src/console/routes/metrics/route.tsx +36 -0
  274. package/src/console/routes/route.tsx +8 -0
  275. package/src/console/routes/routes/route.tsx +30 -0
  276. package/src/console/routes/services/route.tsx +21 -0
  277. package/src/console/routes/system/route.tsx +43 -0
  278. package/src/console/routes/traceDetail.tsx +22 -0
  279. package/src/console/routes/traces/route.tsx +81 -0
  280. package/src/console/routes/tree.ts +30 -0
  281. package/src/console/ui/Errors.tsx +76 -0
  282. package/src/console/ui/Fibers.tsx +321 -0
  283. package/src/console/ui/Git.tsx +182 -0
  284. package/src/console/ui/Logs.tsx +46 -0
  285. package/src/console/ui/Metrics.tsx +78 -0
  286. package/src/console/ui/Routes.tsx +125 -0
  287. package/src/console/ui/Services.tsx +273 -0
  288. package/src/console/ui/Shell.tsx +62 -0
  289. package/src/console/ui/System.tsx +131 -0
  290. package/src/console/ui/Traces.tsx +426 -0
  291. package/src/datastar/README.md +6 -1
  292. package/src/datastar/actions/fetch.ts +0 -1
  293. package/src/datastar/attributes/on.ts +40 -20
  294. package/src/datastar/engine.ts +51 -0
  295. package/src/datastar/jsx.d.ts +79 -0
  296. package/src/hyper/Hyper.ts +1 -16
  297. package/src/hyper/HyperHtml.ts +6 -4
  298. package/src/hyper/HyperRoute.ts +2 -1
  299. package/src/hyper/html.ts +47 -0
  300. package/src/hyper/index.ts +2 -0
  301. package/src/hyper/jsx.d.ts +5 -3
  302. package/src/index.ts +1 -0
  303. package/src/lint/plugin.js +129 -0
  304. package/src/sql/bun/index.ts +147 -0
  305. package/src/sql/mssql/docker.ts +117 -0
  306. package/src/sql/mssql/index.ts +223 -0
  307. package/src/sql/mssql/mssql.d.ts +41 -0
  308. package/src/x/cloudflare/CloudflareTunnel.ts +8 -36
  309. package/src/x/tailscale/TailscaleTunnel.ts +113 -0
  310. package/src/x/tailscale/index.ts +1 -0
  311. package/src/x/datastar/Datastar.ts +0 -61
  312. package/src/x/datastar/index.ts +0 -2
  313. package/src/x/datastar/jsx-datastar.d.ts +0 -60
@@ -15,7 +15,7 @@ export type Params<T extends string> = string extends T ? Record<string, string>
15
15
  } : {};
16
16
  export type ValidateResult = {
17
17
  ok: true;
18
- segments: string[];
18
+ segments: Array<string>;
19
19
  } | {
20
20
  ok: false;
21
21
  error: string;
@@ -33,7 +33,7 @@ export declare function toRegex(path: string): RegExp;
33
33
  * - `:param+` → `/*param`
34
34
  * - `:param*` → `/`, `/*param`
35
35
  */
36
- export declare function toExpress(path: string): string[];
36
+ export declare function toExpress(path: string): Array<string>;
37
37
  /**
38
38
  * Converts to URLPattern path pattern.
39
39
  *
@@ -44,7 +44,7 @@ export declare function toExpress(path: string): string[];
44
44
  * - `:param+` → `:param+`
45
45
  * - `:param*` → `:param*`
46
46
  */
47
- export declare function toURLPattern(path: string): string[];
47
+ export declare function toURLPattern(path: string): Array<string>;
48
48
  /**
49
49
  * Converts to React Router path pattern.
50
50
  *
@@ -55,7 +55,7 @@ export declare function toURLPattern(path: string): string[];
55
55
  * - `:param+` → `*` (splat, required)
56
56
  * - `:param*` → `/`, `/*` (splat, optional - two routes)
57
57
  */
58
- export declare function toReactRouter(path: string): string[];
58
+ export declare function toReactRouter(path: string): Array<string>;
59
59
  /**
60
60
  * Alias for toReactRouter.
61
61
  *
@@ -104,7 +104,7 @@ export declare function toTanStack(path: string): string;
104
104
  * - `:param+` → `*` (unnamed, required)
105
105
  * - `:param*` → `/`, `/*` (unnamed, optional - two routes)
106
106
  */
107
- export declare function toHono(path: string): string[];
107
+ export declare function toHono(path: string): Array<string>;
108
108
  /**
109
109
  * Converts to Effect HttpRouter / find-my-way path pattern.
110
110
  *
@@ -117,7 +117,7 @@ export declare function toHono(path: string): string[];
117
117
  * - `:param+` → `*` (unnamed)
118
118
  * - `:param*` → `/`, `/*` (two routes)
119
119
  */
120
- export declare function toEffect(path: string): string[];
120
+ export declare function toEffect(path: string): Array<string>;
121
121
  /**
122
122
  * Converts to Bun.serve path pattern.
123
123
  *
@@ -131,4 +131,4 @@ export declare function toEffect(path: string): string[];
131
131
  * - `:param+` → `/*`
132
132
  * - `:param*` → `/`, `/*` (two routes)
133
133
  */
134
- export declare function toBun(path: string): PathPattern[];
134
+ export declare function toBun(path: string): Array<PathPattern>;
@@ -406,9 +406,7 @@ export function toBun(path) {
406
406
  const basePath = beforePath ? `/${beforePath}` : "/";
407
407
  const optionalModifier = getModifier(optional);
408
408
  const optionalName = getParamName(optional);
409
- const requiredOptional = optionalModifier === "*"
410
- ? `:${optionalName}+`
411
- : `:${optionalName}`;
409
+ const requiredOptional = optionalModifier === "*" ? `:${optionalName}+` : `:${optionalName}`;
412
410
  const withOptionalSegments = [...before, requiredOptional, ...after];
413
411
  const withOptionalPath = `/${withOptionalSegments.map(formatSegment).join("/")}`;
414
412
  return [...toBun(basePath), ...toBun(withOptionalPath)];
@@ -1,46 +1,38 @@
1
1
  import type * as Cause from "effect/Cause";
2
- import * as Schema from "effect/Schema";
3
2
  import type * as Types from "effect/Types";
4
- import { TypeId as TypeId_ } from "@effect/platform/Error";
5
- export declare const TypeId: typeof TypeId_;
3
+ export declare const TypeId: unique symbol;
6
4
  export type TypeId = typeof TypeId;
7
5
  export declare const isPlatformError: (u: unknown) => u is PlatformError;
8
- export declare const TypeIdError: <const TypeId extends symbol, const Tag extends string>(typeId: TypeId, tag: Tag) => new <A extends Record<string, any>>(args: Types.Simplify<A>) => Cause.YieldableError & Record<TypeId, TypeId> & {
6
+ export declare const TypeIdError: <const TypeId extends symbol, const Tag extends string>(typeId: TypeId, tag: Tag) => (new <A extends Record<string, any>>(args: Types.Simplify<A>) => Cause.YieldableError & Record<TypeId, TypeId> & {
9
7
  readonly _tag: Tag;
8
+ } & Readonly<A>);
9
+ export type SystemErrorReason = "AlreadyExists" | "BadResource" | "Busy" | "InvalidData" | "NotFound" | "PermissionDenied" | "TimedOut" | "UnexpectedEof" | "Unknown" | "WouldBlock" | "WriteZero";
10
+ declare const BadArgument_base: new <A extends Record<string, any> = {}>(args: Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => Cause.YieldableError & {
11
+ readonly _tag: "BadArgument";
10
12
  } & Readonly<A>;
11
- export declare const Module: Schema.Literal<["Clipboard", "Command", "FileSystem", "KeyValueStore", "Path", "Stream", "Terminal"]>;
12
- declare const BadArgument_base: Schema.TaggedErrorClass<BadArgument, "BadArgument", {
13
- readonly _tag: Schema.tag<"BadArgument">;
14
- } & {
15
- module: Schema.Literal<["Clipboard", "Command", "FileSystem", "KeyValueStore", "Path", "Stream", "Terminal"]>;
16
- method: typeof Schema.String;
17
- description: Schema.optional<typeof Schema.String>;
18
- cause: Schema.optional<typeof Schema.Defect>;
19
- }>;
20
- export declare class BadArgument extends BadArgument_base {
13
+ export declare class BadArgument extends BadArgument_base<{
14
+ module: string;
15
+ method: string;
16
+ description?: string | undefined;
17
+ cause?: unknown;
18
+ }> {
21
19
  readonly [TypeId]: typeof TypeId;
22
20
  get message(): string;
23
21
  }
24
- export declare const SystemErrorReason: Schema.Literal<["AlreadyExists", "BadResource", "Busy", "InvalidData", "NotFound", "PermissionDenied", "TimedOut", "UnexpectedEof", "Unknown", "WouldBlock", "WriteZero"]>;
25
- export type SystemErrorReason = typeof SystemErrorReason.Type;
26
- declare const SystemError_base: Schema.TaggedErrorClass<SystemError, "SystemError", {
27
- readonly _tag: Schema.tag<"SystemError">;
28
- } & {
29
- reason: Schema.Literal<["AlreadyExists", "BadResource", "Busy", "InvalidData", "NotFound", "PermissionDenied", "TimedOut", "UnexpectedEof", "Unknown", "WouldBlock", "WriteZero"]>;
30
- module: Schema.Literal<["Clipboard", "Command", "FileSystem", "KeyValueStore", "Path", "Stream", "Terminal"]>;
31
- method: typeof Schema.String;
32
- description: Schema.optional<typeof Schema.String>;
33
- syscall: Schema.optional<typeof Schema.String>;
34
- pathOrDescriptor: Schema.optional<Schema.Union<[typeof Schema.String, typeof Schema.Number]>>;
35
- cause: Schema.optional<typeof Schema.Defect>;
36
- }>;
37
- export declare class SystemError extends SystemError_base {
22
+ declare const SystemError_base: new <A extends Record<string, any> = {}>(args: Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => Cause.YieldableError & {
23
+ readonly _tag: "SystemError";
24
+ } & Readonly<A>;
25
+ export declare class SystemError extends SystemError_base<{
26
+ reason: SystemErrorReason;
27
+ module: string;
28
+ method: string;
29
+ description?: string | undefined;
30
+ syscall?: string | undefined;
31
+ pathOrDescriptor?: string | number | undefined;
32
+ cause?: unknown;
33
+ }> {
38
34
  readonly [TypeId]: typeof TypeId;
39
35
  get message(): string;
40
36
  }
41
37
  export type PlatformError = BadArgument | SystemError;
42
- export declare const PlatformError: Schema.Union<[
43
- typeof BadArgument,
44
- typeof SystemError
45
- ]>;
46
38
  export {};
@@ -1,8 +1,6 @@
1
1
  import * as Data from "effect/Data";
2
2
  import * as Predicate from "effect/Predicate";
3
- import * as Schema from "effect/Schema";
4
- import { TypeId as TypeId_ } from "@effect/platform/Error";
5
- export const TypeId = TypeId_;
3
+ export const TypeId = Symbol.for("@effect/platform/Error/PlatformError");
6
4
  export const isPlatformError = (u) => Predicate.hasProperty(u, TypeId);
7
5
  export const TypeIdError = (typeId, tag) => {
8
6
  class Base extends Data.Error {
@@ -13,31 +11,15 @@ export const TypeIdError = (typeId, tag) => {
13
11
  Base.prototype.name = tag;
14
12
  return Base;
15
13
  };
16
- export const Module = Schema.Literal("Clipboard", "Command", "FileSystem", "KeyValueStore", "Path", "Stream", "Terminal");
17
- export class BadArgument extends Schema.TaggedError("@effect/platform/Error/BadArgument")("BadArgument", {
18
- module: Module,
19
- method: Schema.String,
20
- description: Schema.optional(Schema.String),
21
- cause: Schema.optional(Schema.Defect),
22
- }) {
14
+ export class BadArgument extends Data.TaggedError("BadArgument") {
23
15
  [TypeId] = TypeId;
24
16
  get message() {
25
17
  return `${this.module}.${this.method}${this.description ? `: ${this.description}` : ""}`;
26
18
  }
27
19
  }
28
- export const SystemErrorReason = Schema.Literal("AlreadyExists", "BadResource", "Busy", "InvalidData", "NotFound", "PermissionDenied", "TimedOut", "UnexpectedEof", "Unknown", "WouldBlock", "WriteZero");
29
- export class SystemError extends Schema.TaggedError("@effect/platform/Error/SystemError")("SystemError", {
30
- reason: SystemErrorReason,
31
- module: Module,
32
- method: Schema.String,
33
- description: Schema.optional(Schema.String),
34
- syscall: Schema.optional(Schema.String),
35
- pathOrDescriptor: Schema.optional(Schema.Union(Schema.String, Schema.Number)),
36
- cause: Schema.optional(Schema.Defect),
37
- }) {
20
+ export class SystemError extends Data.TaggedError("SystemError") {
38
21
  [TypeId] = TypeId;
39
22
  get message() {
40
23
  return `${this.reason}: ${this.module}.${this.method}${this.pathOrDescriptor !== undefined ? ` (${this.pathOrDescriptor})` : ""}${this.description ? `: ${this.description}` : ""}`;
41
24
  }
42
25
  }
43
- export const PlatformError = Schema.Union(BadArgument, SystemError);
@@ -23,9 +23,7 @@ const addPrettyLogger = (refs, fiberId) => {
23
23
  export const makeRunMain = (f) => Function.dual((args) => Effect.isEffect(args[0]), (effect, options) => {
24
24
  const fiber = options?.disableErrorReporting === true
25
25
  ? Effect.runFork(effect, {
26
- updateRefs: options?.disablePrettyLogger === true
27
- ? undefined
28
- : addPrettyLogger,
26
+ updateRefs: options?.disablePrettyLogger === true ? undefined : addPrettyLogger,
29
27
  })
30
28
  : Effect.runFork(Effect.tapErrorCause(effect, (cause) => {
31
29
  if (Cause.isInterruptedOnly(cause)) {
@@ -33,9 +31,7 @@ export const makeRunMain = (f) => Function.dual((args) => Effect.isEffect(args[0
33
31
  }
34
32
  return Effect.logError(cause);
35
33
  }), {
36
- updateRefs: options?.disablePrettyLogger === true
37
- ? undefined
38
- : addPrettyLogger,
34
+ updateRefs: options?.disablePrettyLogger === true ? undefined : addPrettyLogger,
39
35
  });
40
36
  const teardown = options?.teardown ?? defaultTeardown;
41
37
  return f({ fiber, teardown });
@@ -44,8 +40,7 @@ export const makeRunMain = (f) => Function.dual((args) => Effect.isEffect(args[0
44
40
  * Are we running within an agent harness, like Claude Code?
45
41
  */
46
42
  export function isAgentHarness() {
47
- return typeof process !== "undefined"
48
- && !process.stdout.isTTY
49
- && (process.env.CLAUDECODE
50
- || process.env.CURSOR_AGENT);
43
+ return (typeof process !== "undefined" &&
44
+ !process.stdout.isTTY &&
45
+ (process.env.CLAUDECODE || process.env.CURSOR_AGENT));
51
46
  }
package/dist/Route.d.ts CHANGED
@@ -5,7 +5,7 @@ import * as Pipeable from "effect/Pipeable";
5
5
  import * as Entity from "./Entity.ts";
6
6
  import * as RouteBody from "./RouteBody.ts";
7
7
  import * as RouteTree from "./RouteTree.ts";
8
- import * as Values from "./Values.ts";
8
+ import type * as Values from "./Values.ts";
9
9
  export declare const RouteItems: unique symbol;
10
10
  export declare const RouteDescriptor: unique symbol;
11
11
  export declare const RouteBindings: unique symbol;
@@ -33,17 +33,13 @@ export declare namespace RouteSet {
33
33
  type Descriptor<T extends Data<any, any, any>> = T extends Data<infer D, any, any> ? D : never;
34
34
  }
35
35
  export declare namespace Route {
36
- export interface Route<D extends RouteDescriptor.Any = {}, B = {}, A = any, E = never, R = never> extends RouteSet.RouteSet<D, {}, [
37
- Route<D, B, A, E, R>
38
- ]> {
36
+ export interface Route<D extends RouteDescriptor.Any = {}, B = {}, A = any, E = never, R = never> extends RouteSet.RouteSet<D, {}, [Route<D, B, A, E, R>]> {
39
37
  readonly handler: Handler<B & D, A, E, R>;
40
38
  }
41
39
  export type With<D extends RouteDescriptor.Any> = Route<any, any, any, any, any> & {
42
40
  [RouteDescriptor]: D;
43
41
  };
44
- export type Tuple<_D extends RouteDescriptor.Any = {}> = [
45
- ...Route<any, any, any, any, any>[]
46
- ];
42
+ export type Tuple<_D extends RouteDescriptor.Any = {}> = [...Route<any, any, any, any, any>[]];
47
43
  export type Handler<B, A, E, R> = (context: B, next: (context?: Partial<B> & Record<string, unknown>) => Entity.Entity<A>) => Effect.Effect<Entity.Entity<A>, E, R>;
48
44
  /**
49
45
  * Extracts only the bindings (B) from routes, excluding descriptors.
@@ -51,7 +47,7 @@ export declare namespace Route {
51
47
  export type Bindings<T extends RouteSet.Any, M extends Tuple = RouteSet.Items<T>> = M extends [
52
48
  infer Head,
53
49
  ...infer Tail extends Tuple
54
- ] ? (Head extends Route<any, infer B, any, any, any> ? ShallowMerge<B, Bindings<T, Tail>> : Bindings<T, Tail>) : {};
50
+ ] ? Head extends Route<any, infer B, any, any, any> ? ShallowMerge<B, Bindings<T, Tail>> : Bindings<T, Tail> : {};
55
51
  /**
56
52
  * Extracts the full handler context from a RouteSet.
57
53
  * Merges descriptors and bindings from all routes, with later values
@@ -59,10 +55,7 @@ export declare namespace Route {
59
55
  * literal types (e.g. `{ method: "*" } & { method: "GET" }`).
60
56
  */
61
57
  export type Context<T extends RouteSet.Any> = Omit<RouteSet.Descriptor<T>, keyof ExtractContext<RouteSet.Items<T>>> & ExtractContext<RouteSet.Items<T>>;
62
- type ExtractContext<M extends Tuple> = M extends [
63
- infer Head,
64
- ...infer Tail extends Tuple
65
- ] ? (Head extends Route<infer D, infer B, any, any, any> ? ShallowMerge<Omit<D, keyof B> & B, ExtractContext<Tail>> : ExtractContext<Tail>) : {};
58
+ type ExtractContext<M extends Tuple> = M extends [infer Head, ...infer Tail extends Tuple] ? Head extends Route<infer D, infer B, any, any, any> ? ShallowMerge<Omit<D, keyof B> & B, ExtractContext<Tail>> : ExtractContext<Tail> : {};
66
59
  export {};
67
60
  }
68
61
  export declare function isRouteSet(input: unknown): input is RouteSet.Any;
@@ -73,30 +66,32 @@ export declare const empty: RouteSet.RouteSet<{}, {}, []>;
73
66
  export declare function describe<D extends RouteDescriptor.Any>(descriptor: D): RouteSet.RouteSet<D, {}, never[]>;
74
67
  export declare function items<T extends RouteSet.Data<any, any, any>>(self: T): RouteSet.Items<T>;
75
68
  export declare function descriptor<T extends RouteSet.Data<any, any, any>>(self: T): T[typeof RouteDescriptor];
76
- export declare function descriptor<T extends RouteSet.Data<any, any, any>>(self: Iterable<T>): T[typeof RouteDescriptor][];
69
+ export declare function descriptor<T extends RouteSet.Data<any, any, any>>(self: Iterable<T>): Array<T[typeof RouteDescriptor]>;
77
70
  export type ExtractBindings<M extends Route.Tuple> = M extends [
78
71
  infer Head,
79
72
  ...infer Tail extends Route.Tuple
80
- ] ? (Head extends Route.Route<any, infer B, any, any, any> ? ShallowMerge<B, ExtractBindings<Tail>> : ExtractBindings<Tail>) : {};
73
+ ] ? Head extends Route.Route<any, infer B, any, any, any> ? ShallowMerge<B, ExtractBindings<Tail>> : ExtractBindings<Tail> : {};
81
74
  type ShallowMerge<A, B> = Omit<A, keyof B> & {
82
75
  [K in keyof B]: K extends keyof A ? A[K] & B[K] : B[K];
83
76
  };
84
77
  export type ExtractContext<Items extends Route.Tuple, Descriptor extends RouteDescriptor.Any> = ExtractBindings<Items> & Descriptor;
85
78
  export * from "./RouteHook.ts";
86
79
  export * from "./RouteSchema.ts";
87
- export { add, del, get, head, options, patch, post, put, use, } from "./RouteMount.ts";
80
+ export { add, del, get, head, options, patch, post, put, use } from "./RouteMount.ts";
88
81
  export declare const text: RouteBody.BuildReturn<string, "text">;
89
82
  export declare const html: RouteBody.BuildReturn<string, "html">;
90
83
  export declare const json: RouteBody.BuildReturn<Values.Json, "json">;
91
84
  export declare const bytes: RouteBody.BuildReturn<Uint8Array<ArrayBufferLike>, "bytes">;
92
- export { render, } from "./RouteBody.ts";
93
- export { sse, } from "./RouteSse.ts";
94
- export declare function redirect(url: string | URL, status?: 301 | 302 | 303 | 307 | 308): Entity.Entity<"">;
85
+ export { render } from "./RouteBody.ts";
86
+ export { sse } from "./RouteSse.ts";
87
+ export declare function redirect(url: string | URL, options?: {
88
+ status?: 301 | 302 | 303 | 307 | 308;
89
+ }): Entity.Entity<"">;
95
90
  declare const Routes_base: Context.TagClass<Routes, "effect-start/Routes", RouteTree.RouteTree<RouteTree.RouteMap>>;
96
91
  export declare class Routes extends Routes_base {
97
92
  }
98
93
  export declare function layer(routes: RouteTree.RouteMap | RouteTree.RouteTree): Layer.Layer<Routes, never, never>;
99
- export { make as tree, } from "./RouteTree.ts";
94
+ export { make as tree } from "./RouteTree.ts";
100
95
  export declare function lazy<T extends RouteSet.Any>(load: () => Promise<{
101
96
  default: T;
102
97
  }>): Effect.Effect<T, never, never>;
package/dist/Route.js CHANGED
@@ -24,8 +24,7 @@ export function isRouteSet(input) {
24
24
  return Predicate.hasProperty(input, TypeId);
25
25
  }
26
26
  export function isRoute(input) {
27
- return isRouteSet(input)
28
- && Predicate.hasProperty(input, "handler");
27
+ return isRouteSet(input) && Predicate.hasProperty(input, "handler");
29
28
  }
30
29
  export function set(items = [], descriptor = {}) {
31
30
  return Object.assign(Object.create(Proto), {
@@ -58,7 +57,7 @@ export function descriptor(self) {
58
57
  }
59
58
  export * from "./RouteHook.js";
60
59
  export * from "./RouteSchema.js";
61
- export { add, del, get, head, options, patch, post, put, use, } from "./RouteMount.js";
60
+ export { add, del, get, head, options, patch, post, put, use } from "./RouteMount.js";
62
61
  export const text = RouteBody.build({
63
62
  format: "text",
64
63
  });
@@ -71,11 +70,11 @@ export const json = RouteBody.build({
71
70
  export const bytes = RouteBody.build({
72
71
  format: "bytes",
73
72
  });
74
- export { render, } from "./RouteBody.js";
75
- export { sse, } from "./RouteSse.js";
76
- export function redirect(url, status = 302) {
73
+ export { render } from "./RouteBody.js";
74
+ export { sse } from "./RouteSse.js";
75
+ export function redirect(url, options) {
77
76
  return Entity.make("", {
78
- status,
77
+ status: options?.status ?? 302,
79
78
  headers: {
80
79
  location: url instanceof URL ? url.href : url,
81
80
  },
@@ -84,11 +83,9 @@ export function redirect(url, status = 302) {
84
83
  export class Routes extends Context.Tag("effect-start/Routes")() {
85
84
  }
86
85
  export function layer(routes) {
87
- return Layer.sync(Routes, () => RouteTree.isRouteTree(routes)
88
- ? routes
89
- : RouteTree.make(routes));
86
+ return Layer.sync(Routes, () => (RouteTree.isRouteTree(routes) ? routes : RouteTree.make(routes)));
90
87
  }
91
- export { make as tree, } from "./RouteTree.js";
88
+ export { make as tree } from "./RouteTree.js";
92
89
  export function lazy(load) {
93
90
  let cached;
94
91
  return Effect.suspend(() => {
@@ -23,12 +23,9 @@ export interface BuildReturn<Value, F extends Format> {
23
23
  ]>;
24
24
  <D extends Route.RouteDescriptor.Any, B, I extends Route.Route.Tuple, A extends F extends "json" ? Value : Value | Stream.Stream<Value, any, any>, E = never, R = never>(handler: HandlerInput<NoInfer<D & B & Route.ExtractBindings<I> & {
25
25
  format: F;
26
- }>, A, E, R>): (self: Route.RouteSet.RouteSet<D, B, I>) => Route.RouteSet.RouteSet<D, B, [
27
- ...I,
28
- Route.Route.Route<{
29
- format: F;
30
- }, {}, A, E, R>
31
- ]>;
26
+ }>, A, E, R>): (self: Route.RouteSet.RouteSet<D, B, I>) => Route.RouteSet.RouteSet<D, B, [...I, Route.Route.Route<{
27
+ format: F;
28
+ }, {}, A, E, R>]>;
32
29
  }
33
30
  export declare function build<Value, F extends Format>(descriptors: {
34
31
  format: F;
@@ -44,10 +41,7 @@ export declare function render<D extends Route.RouteDescriptor.Any, B extends {}
44
41
  ]>;
45
42
  export declare function render<D extends Route.RouteDescriptor.Any, B extends {}, I extends Route.Route.Tuple, A extends RenderValue, E = never, R = never>(handler: HandlerInput<NoInfer<D & B & Route.ExtractBindings<I> & {
46
43
  format: "*";
47
- }>, A, E, R>): (self: Route.RouteSet.RouteSet<D, B, I>) => Route.RouteSet.RouteSet<D, B, [
48
- ...I,
49
- Route.Route.Route<{
50
- format: "*";
51
- }, {}, A, E, R>
52
- ]>;
44
+ }>, A, E, R>): (self: Route.RouteSet.RouteSet<D, B, I>) => Route.RouteSet.RouteSet<D, B, [...I, Route.Route.Route<{
45
+ format: "*";
46
+ }, {}, A, E, R>]>;
53
47
  export {};
package/dist/RouteBody.js CHANGED
@@ -35,7 +35,7 @@ function normalizeToEntity(value) {
35
35
  return Entity.make(value, { status: 200 });
36
36
  }
37
37
  export function build(descriptors) {
38
- return (function (handler) {
38
+ return function (handler) {
39
39
  return function (self) {
40
40
  const contentType = formatToContentType[descriptors.format];
41
41
  const baseHandler = handle(handler);
@@ -53,7 +53,7 @@ export function build(descriptors) {
53
53
  ];
54
54
  return Route.set(items, Route.descriptor(self));
55
55
  };
56
- });
56
+ };
57
57
  }
58
58
  export function render(handler) {
59
59
  return function (self) {
@@ -0,0 +1,98 @@
1
+ import * as Schema from "effect/Schema";
2
+ declare const BadRequest_base: Schema.TaggedErrorClass<BadRequest, "BadRequest", {
3
+ readonly _tag: Schema.tag<"BadRequest">;
4
+ } & {
5
+ message: typeof Schema.String;
6
+ }>;
7
+ export declare class BadRequest extends BadRequest_base {
8
+ static readonly status = 400;
9
+ }
10
+ declare const Unauthorized_base: Schema.TaggedErrorClass<Unauthorized, "Unauthorized", {
11
+ readonly _tag: Schema.tag<"Unauthorized">;
12
+ } & {
13
+ message: typeof Schema.String;
14
+ }>;
15
+ export declare class Unauthorized extends Unauthorized_base {
16
+ static readonly status = 401;
17
+ }
18
+ declare const Forbidden_base: Schema.TaggedErrorClass<Forbidden, "Forbidden", {
19
+ readonly _tag: Schema.tag<"Forbidden">;
20
+ } & {
21
+ message: typeof Schema.String;
22
+ }>;
23
+ export declare class Forbidden extends Forbidden_base {
24
+ static readonly status = 403;
25
+ }
26
+ declare const NotFound_base: Schema.TaggedErrorClass<NotFound, "NotFound", {
27
+ readonly _tag: Schema.tag<"NotFound">;
28
+ } & {
29
+ message: typeof Schema.String;
30
+ }>;
31
+ export declare class NotFound extends NotFound_base {
32
+ static readonly status = 404;
33
+ }
34
+ declare const MethodNotAllowed_base: Schema.TaggedErrorClass<MethodNotAllowed, "MethodNotAllowed", {
35
+ readonly _tag: Schema.tag<"MethodNotAllowed">;
36
+ } & {
37
+ message: typeof Schema.String;
38
+ }>;
39
+ export declare class MethodNotAllowed extends MethodNotAllowed_base {
40
+ static readonly status = 405;
41
+ }
42
+ declare const Conflict_base: Schema.TaggedErrorClass<Conflict, "Conflict", {
43
+ readonly _tag: Schema.tag<"Conflict">;
44
+ } & {
45
+ message: typeof Schema.String;
46
+ }>;
47
+ export declare class Conflict extends Conflict_base {
48
+ static readonly status = 409;
49
+ }
50
+ declare const Gone_base: Schema.TaggedErrorClass<Gone, "Gone", {
51
+ readonly _tag: Schema.tag<"Gone">;
52
+ } & {
53
+ message: typeof Schema.String;
54
+ }>;
55
+ export declare class Gone extends Gone_base {
56
+ static readonly status = 410;
57
+ }
58
+ declare const UnprocessableEntity_base: Schema.TaggedErrorClass<UnprocessableEntity, "UnprocessableEntity", {
59
+ readonly _tag: Schema.tag<"UnprocessableEntity">;
60
+ } & {
61
+ message: typeof Schema.String;
62
+ }>;
63
+ export declare class UnprocessableEntity extends UnprocessableEntity_base {
64
+ static readonly status = 422;
65
+ }
66
+ declare const TooManyRequests_base: Schema.TaggedErrorClass<TooManyRequests, "TooManyRequests", {
67
+ readonly _tag: Schema.tag<"TooManyRequests">;
68
+ } & {
69
+ message: typeof Schema.String;
70
+ }>;
71
+ export declare class TooManyRequests extends TooManyRequests_base {
72
+ static readonly status = 429;
73
+ }
74
+ declare const InternalServerError_base: Schema.TaggedErrorClass<InternalServerError, "InternalServerError", {
75
+ readonly _tag: Schema.tag<"InternalServerError">;
76
+ } & {
77
+ message: typeof Schema.String;
78
+ }>;
79
+ export declare class InternalServerError extends InternalServerError_base {
80
+ static readonly status = 500;
81
+ }
82
+ declare const NotImplemented_base: Schema.TaggedErrorClass<NotImplemented, "NotImplemented", {
83
+ readonly _tag: Schema.tag<"NotImplemented">;
84
+ } & {
85
+ message: typeof Schema.String;
86
+ }>;
87
+ export declare class NotImplemented extends NotImplemented_base {
88
+ static readonly status = 501;
89
+ }
90
+ declare const ServiceUnavailable_base: Schema.TaggedErrorClass<ServiceUnavailable, "ServiceUnavailable", {
91
+ readonly _tag: Schema.tag<"ServiceUnavailable">;
92
+ } & {
93
+ message: typeof Schema.String;
94
+ }>;
95
+ export declare class ServiceUnavailable extends ServiceUnavailable_base {
96
+ static readonly status = 503;
97
+ }
98
+ export {};
@@ -0,0 +1,55 @@
1
+ import * as Schema from "effect/Schema";
2
+ export class BadRequest extends Schema.TaggedError()("BadRequest", {
3
+ message: Schema.String,
4
+ }) {
5
+ static status = 400;
6
+ }
7
+ export class Unauthorized extends Schema.TaggedError()("Unauthorized", {
8
+ message: Schema.String,
9
+ }) {
10
+ static status = 401;
11
+ }
12
+ export class Forbidden extends Schema.TaggedError()("Forbidden", {
13
+ message: Schema.String,
14
+ }) {
15
+ static status = 403;
16
+ }
17
+ export class NotFound extends Schema.TaggedError()("NotFound", {
18
+ message: Schema.String,
19
+ }) {
20
+ static status = 404;
21
+ }
22
+ export class MethodNotAllowed extends Schema.TaggedError()("MethodNotAllowed", {
23
+ message: Schema.String,
24
+ }) {
25
+ static status = 405;
26
+ }
27
+ export class Conflict extends Schema.TaggedError()("Conflict", {
28
+ message: Schema.String,
29
+ }) {
30
+ static status = 409;
31
+ }
32
+ export class Gone extends Schema.TaggedError()("Gone", {
33
+ message: Schema.String,
34
+ }) {
35
+ static status = 410;
36
+ }
37
+ export class UnprocessableEntity extends Schema.TaggedError()("UnprocessableEntity", { message: Schema.String }) {
38
+ static status = 422;
39
+ }
40
+ export class TooManyRequests extends Schema.TaggedError()("TooManyRequests", {
41
+ message: Schema.String,
42
+ }) {
43
+ static status = 429;
44
+ }
45
+ export class InternalServerError extends Schema.TaggedError()("InternalServerError", { message: Schema.String }) {
46
+ static status = 500;
47
+ }
48
+ export class NotImplemented extends Schema.TaggedError()("NotImplemented", {
49
+ message: Schema.String,
50
+ }) {
51
+ static status = 501;
52
+ }
53
+ export class ServiceUnavailable extends Schema.TaggedError()("ServiceUnavailable", { message: Schema.String }) {
54
+ static status = 503;
55
+ }
package/dist/RouteHook.js CHANGED
@@ -6,22 +6,17 @@ export function filter(filterHandler) {
6
6
  return function (self) {
7
7
  const route = Route.make((context, next) => Effect.gen(function* () {
8
8
  const filterResult = yield* normalized(context);
9
- const mergedContext = filterResult
10
- ? { ...context, ...filterResult.context }
11
- : context;
9
+ const mergedContext = filterResult ? { ...context, ...filterResult.context } : context;
12
10
  return yield* Entity.resolve(next(mergedContext));
13
11
  }));
14
- return Route.set([
15
- ...Route.items(self),
16
- route,
17
- ], Route.descriptor(self));
12
+ return Route.set([...Route.items(self), route], Route.descriptor(self));
18
13
  };
19
14
  }
20
15
  function isGenerator(value) {
21
- return (typeof value === "object"
22
- && value !== null
23
- && Symbol.iterator in value
24
- && typeof value.next === "function");
16
+ return (typeof value === "object" &&
17
+ value !== null &&
18
+ Symbol.iterator in value &&
19
+ typeof value.next === "function");
25
20
  }
26
21
  function normalizeFilterHandler(handler) {
27
22
  if (typeof handler === "function") {
@@ -1,9 +1,9 @@
1
1
  import * as FiberId from "effect/FiberId";
2
2
  import * as Runtime from "effect/Runtime";
3
- import * as Http from "./Http.ts";
3
+ import type * as Http from "./Http.ts";
4
4
  import * as Route from "./Route.ts";
5
- import * as RouteBody from "./RouteBody.ts";
6
- import * as RouteMount from "./RouteMount.ts";
5
+ import type * as RouteBody from "./RouteBody.ts";
6
+ import type * as RouteMount from "./RouteMount.ts";
7
7
  import * as RouteTree from "./RouteTree.ts";
8
8
  type UnboundedRouteWithMethod = Route.Route.With<{
9
9
  method: RouteMount.RouteMount.Method;