@effect/platform 0.43.10 → 0.44.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 (235) hide show
  1. package/dist/cjs/Error.js +4 -0
  2. package/dist/cjs/Error.js.map +1 -1
  3. package/dist/cjs/Http/App.js.map +1 -1
  4. package/dist/cjs/Http/Body.js.map +1 -1
  5. package/dist/cjs/Http/Client.js.map +1 -1
  6. package/dist/cjs/Http/ClientError.js +4 -0
  7. package/dist/cjs/Http/ClientError.js.map +1 -1
  8. package/dist/cjs/Http/ClientResponse.js.map +1 -1
  9. package/dist/cjs/Http/IncomingMessage.js.map +1 -1
  10. package/dist/cjs/Http/Multipart.js.map +1 -1
  11. package/dist/cjs/Http/Server.js +26 -1
  12. package/dist/cjs/Http/Server.js.map +1 -1
  13. package/dist/cjs/Http/ServerError.js.map +1 -1
  14. package/dist/cjs/Http/ServerResponse.js.map +1 -1
  15. package/dist/cjs/HttpServer.js +7 -1
  16. package/dist/cjs/HttpServer.js.map +1 -1
  17. package/dist/cjs/KeyValueStore.js.map +1 -1
  18. package/dist/cjs/Path.js.map +1 -1
  19. package/dist/cjs/Transferable.js +51 -48
  20. package/dist/cjs/Transferable.js.map +1 -1
  21. package/dist/cjs/Worker.js +6 -1
  22. package/dist/cjs/Worker.js.map +1 -1
  23. package/dist/cjs/WorkerError.js +4 -0
  24. package/dist/cjs/WorkerError.js.map +1 -1
  25. package/dist/cjs/index.js +62 -0
  26. package/dist/cjs/index.js.map +1 -0
  27. package/dist/cjs/internal/commandExecutor.js +1 -1
  28. package/dist/cjs/internal/commandExecutor.js.map +1 -1
  29. package/dist/cjs/internal/effectify.js.map +1 -1
  30. package/dist/cjs/internal/fileSystem.js +1 -1
  31. package/dist/cjs/internal/fileSystem.js.map +1 -1
  32. package/dist/cjs/internal/http/body.js.map +1 -1
  33. package/dist/cjs/internal/http/client.js +2 -2
  34. package/dist/cjs/internal/http/client.js.map +1 -1
  35. package/dist/cjs/internal/http/etag.js +1 -1
  36. package/dist/cjs/internal/http/etag.js.map +1 -1
  37. package/dist/cjs/internal/http/multipart.js.map +1 -1
  38. package/dist/cjs/internal/http/platform.js +1 -1
  39. package/dist/cjs/internal/http/platform.js.map +1 -1
  40. package/dist/cjs/internal/http/router.js +1 -1
  41. package/dist/cjs/internal/http/router.js.map +1 -1
  42. package/dist/cjs/internal/http/server.js +23 -2
  43. package/dist/cjs/internal/http/server.js.map +1 -1
  44. package/dist/cjs/internal/http/serverRequest.js +1 -1
  45. package/dist/cjs/internal/http/serverRequest.js.map +1 -1
  46. package/dist/cjs/internal/http/serverResponse.js.map +1 -1
  47. package/dist/cjs/internal/keyValueStore.js +2 -2
  48. package/dist/cjs/internal/keyValueStore.js.map +1 -1
  49. package/dist/cjs/internal/path.js +9 -4
  50. package/dist/cjs/internal/path.js.map +1 -1
  51. package/dist/cjs/internal/terminal.js +1 -1
  52. package/dist/cjs/internal/terminal.js.map +1 -1
  53. package/dist/cjs/internal/worker.js +16 -12
  54. package/dist/cjs/internal/worker.js.map +1 -1
  55. package/dist/cjs/internal/workerError.js.map +1 -1
  56. package/dist/cjs/internal/workerRunner.js +15 -12
  57. package/dist/cjs/internal/workerRunner.js.map +1 -1
  58. package/dist/dts/Command.d.ts +9 -9
  59. package/dist/dts/Command.d.ts.map +1 -1
  60. package/dist/dts/CommandExecutor.d.ts +13 -13
  61. package/dist/dts/CommandExecutor.d.ts.map +1 -1
  62. package/dist/dts/Effectify.d.ts +55 -55
  63. package/dist/dts/Effectify.d.ts.map +1 -1
  64. package/dist/dts/Error.d.ts +2 -6
  65. package/dist/dts/Error.d.ts.map +1 -1
  66. package/dist/dts/FileSystem.d.ts +35 -35
  67. package/dist/dts/FileSystem.d.ts.map +1 -1
  68. package/dist/dts/Http/App.d.ts +5 -5
  69. package/dist/dts/Http/App.d.ts.map +1 -1
  70. package/dist/dts/Http/Body.d.ts +10 -11
  71. package/dist/dts/Http/Body.d.ts.map +1 -1
  72. package/dist/dts/Http/Client.d.ts +32 -32
  73. package/dist/dts/Http/Client.d.ts.map +1 -1
  74. package/dist/dts/Http/ClientError.d.ts +2 -6
  75. package/dist/dts/Http/ClientError.d.ts.map +1 -1
  76. package/dist/dts/Http/ClientRequest.d.ts +16 -16
  77. package/dist/dts/Http/ClientRequest.d.ts.map +1 -1
  78. package/dist/dts/Http/ClientResponse.d.ts +3 -3
  79. package/dist/dts/Http/ClientResponse.d.ts.map +1 -1
  80. package/dist/dts/Http/Etag.d.ts +2 -2
  81. package/dist/dts/Http/Etag.d.ts.map +1 -1
  82. package/dist/dts/Http/IncomingMessage.d.ts +10 -10
  83. package/dist/dts/Http/IncomingMessage.d.ts.map +1 -1
  84. package/dist/dts/Http/Middleware.d.ts +3 -3
  85. package/dist/dts/Http/Multipart.d.ts +18 -19
  86. package/dist/dts/Http/Multipart.d.ts.map +1 -1
  87. package/dist/dts/Http/Multiplex.d.ts +4 -4
  88. package/dist/dts/Http/Multiplex.d.ts.map +1 -1
  89. package/dist/dts/Http/Platform.d.ts +3 -3
  90. package/dist/dts/Http/Platform.d.ts.map +1 -1
  91. package/dist/dts/Http/Router.d.ts +10 -10
  92. package/dist/dts/Http/Router.d.ts.map +1 -1
  93. package/dist/dts/Http/Server.d.ts +39 -14
  94. package/dist/dts/Http/Server.d.ts.map +1 -1
  95. package/dist/dts/Http/ServerError.d.ts +2 -3
  96. package/dist/dts/Http/ServerError.d.ts.map +1 -1
  97. package/dist/dts/Http/ServerRequest.d.ts +9 -9
  98. package/dist/dts/Http/ServerRequest.d.ts.map +1 -1
  99. package/dist/dts/Http/ServerResponse.d.ts +7 -7
  100. package/dist/dts/Http/ServerResponse.d.ts.map +1 -1
  101. package/dist/dts/Http/UrlParams.d.ts +4 -4
  102. package/dist/dts/HttpServer.d.ts +24 -0
  103. package/dist/dts/HttpServer.d.ts.map +1 -1
  104. package/dist/dts/KeyValueStore.d.ts +21 -21
  105. package/dist/dts/KeyValueStore.d.ts.map +1 -1
  106. package/dist/dts/Path.d.ts +3 -3
  107. package/dist/dts/Path.d.ts.map +1 -1
  108. package/dist/dts/Runtime.d.ts +1 -1
  109. package/dist/dts/Runtime.d.ts.map +1 -1
  110. package/dist/dts/Terminal.d.ts +5 -5
  111. package/dist/dts/Terminal.d.ts.map +1 -1
  112. package/dist/dts/Transferable.d.ts +35 -13
  113. package/dist/dts/Transferable.d.ts.map +1 -1
  114. package/dist/dts/Worker.d.ts +58 -41
  115. package/dist/dts/Worker.d.ts.map +1 -1
  116. package/dist/dts/WorkerError.d.ts +3 -7
  117. package/dist/dts/WorkerError.d.ts.map +1 -1
  118. package/dist/dts/WorkerRunner.d.ts +13 -13
  119. package/dist/dts/WorkerRunner.d.ts.map +1 -1
  120. package/dist/dts/index.d.ts +61 -0
  121. package/dist/dts/index.d.ts.map +1 -0
  122. package/dist/esm/Error.js +3 -0
  123. package/dist/esm/Error.js.map +1 -1
  124. package/dist/esm/Http/App.js.map +1 -1
  125. package/dist/esm/Http/Body.js.map +1 -1
  126. package/dist/esm/Http/Client.js.map +1 -1
  127. package/dist/esm/Http/ClientError.js +3 -0
  128. package/dist/esm/Http/ClientError.js.map +1 -1
  129. package/dist/esm/Http/ClientResponse.js.map +1 -1
  130. package/dist/esm/Http/IncomingMessage.js.map +1 -1
  131. package/dist/esm/Http/Multipart.js.map +1 -1
  132. package/dist/esm/Http/Server.js +25 -0
  133. package/dist/esm/Http/Server.js.map +1 -1
  134. package/dist/esm/Http/ServerError.js.map +1 -1
  135. package/dist/esm/Http/ServerResponse.js.map +1 -1
  136. package/dist/esm/HttpServer.js +24 -0
  137. package/dist/esm/HttpServer.js.map +1 -1
  138. package/dist/esm/KeyValueStore.js.map +1 -1
  139. package/dist/esm/Path.js.map +1 -1
  140. package/dist/esm/Transferable.js +48 -45
  141. package/dist/esm/Transferable.js.map +1 -1
  142. package/dist/esm/Worker.js +5 -0
  143. package/dist/esm/Worker.js.map +1 -1
  144. package/dist/esm/WorkerError.js +3 -0
  145. package/dist/esm/WorkerError.js.map +1 -1
  146. package/dist/esm/index.js +61 -0
  147. package/dist/esm/index.js.map +1 -0
  148. package/dist/esm/internal/commandExecutor.js +2 -2
  149. package/dist/esm/internal/commandExecutor.js.map +1 -1
  150. package/dist/esm/internal/effectify.js.map +1 -1
  151. package/dist/esm/internal/fileSystem.js +2 -2
  152. package/dist/esm/internal/fileSystem.js.map +1 -1
  153. package/dist/esm/internal/http/body.js.map +1 -1
  154. package/dist/esm/internal/http/client.js +2 -2
  155. package/dist/esm/internal/http/client.js.map +1 -1
  156. package/dist/esm/internal/http/etag.js +1 -1
  157. package/dist/esm/internal/http/etag.js.map +1 -1
  158. package/dist/esm/internal/http/multipart.js.map +1 -1
  159. package/dist/esm/internal/http/platform.js +1 -1
  160. package/dist/esm/internal/http/platform.js.map +1 -1
  161. package/dist/esm/internal/http/router.js +1 -1
  162. package/dist/esm/internal/http/router.js.map +1 -1
  163. package/dist/esm/internal/http/server.js +18 -1
  164. package/dist/esm/internal/http/server.js.map +1 -1
  165. package/dist/esm/internal/http/serverRequest.js +1 -1
  166. package/dist/esm/internal/http/serverRequest.js.map +1 -1
  167. package/dist/esm/internal/http/serverResponse.js.map +1 -1
  168. package/dist/esm/internal/keyValueStore.js +2 -2
  169. package/dist/esm/internal/keyValueStore.js.map +1 -1
  170. package/dist/esm/internal/path.js +3 -3
  171. package/dist/esm/internal/path.js.map +1 -1
  172. package/dist/esm/internal/terminal.js +2 -2
  173. package/dist/esm/internal/terminal.js.map +1 -1
  174. package/dist/esm/internal/worker.js +14 -11
  175. package/dist/esm/internal/worker.js.map +1 -1
  176. package/dist/esm/internal/workerError.js.map +1 -1
  177. package/dist/esm/internal/workerRunner.js +15 -12
  178. package/dist/esm/internal/workerRunner.js.map +1 -1
  179. package/package.json +11 -3
  180. package/src/Command.ts +9 -9
  181. package/src/CommandExecutor.ts +13 -13
  182. package/src/Effectify.ts +55 -55
  183. package/src/Error.ts +2 -3
  184. package/src/FileSystem.ts +35 -35
  185. package/src/Http/App.ts +5 -5
  186. package/src/Http/Body.ts +12 -13
  187. package/src/Http/Client.ts +37 -37
  188. package/src/Http/ClientError.ts +2 -3
  189. package/src/Http/ClientRequest.ts +17 -17
  190. package/src/Http/ClientResponse.ts +8 -5
  191. package/src/Http/Etag.ts +2 -2
  192. package/src/Http/IncomingMessage.ts +27 -23
  193. package/src/Http/Middleware.ts +4 -4
  194. package/src/Http/Multipart.ts +22 -25
  195. package/src/Http/Multiplex.ts +4 -4
  196. package/src/Http/Platform.ts +3 -3
  197. package/src/Http/Router.ts +16 -16
  198. package/src/Http/Server.ts +53 -18
  199. package/src/Http/ServerError.ts +2 -3
  200. package/src/Http/ServerRequest.ts +22 -22
  201. package/src/Http/ServerResponse.ts +9 -10
  202. package/src/Http/UrlParams.ts +6 -6
  203. package/src/HttpServer.ts +24 -0
  204. package/src/KeyValueStore.ts +23 -23
  205. package/src/Path.ts +3 -3
  206. package/src/Runtime.ts +1 -1
  207. package/src/Terminal.ts +4 -4
  208. package/src/Transferable.ts +88 -70
  209. package/src/Worker.ts +73 -57
  210. package/src/WorkerError.ts +3 -4
  211. package/src/WorkerRunner.ts +21 -21
  212. package/src/index.ts +74 -0
  213. package/src/internal/command.ts +7 -7
  214. package/src/internal/commandExecutor.ts +3 -3
  215. package/src/internal/effectify.ts +1 -1
  216. package/src/internal/fileSystem.ts +3 -3
  217. package/src/internal/http/body.ts +12 -12
  218. package/src/internal/http/client.ts +42 -46
  219. package/src/internal/http/clientRequest.ts +15 -15
  220. package/src/internal/http/clientResponse.ts +18 -18
  221. package/src/internal/http/etag.ts +1 -1
  222. package/src/internal/http/middleware.ts +4 -4
  223. package/src/internal/http/multipart.ts +32 -39
  224. package/src/internal/http/multiplex.ts +5 -5
  225. package/src/internal/http/platform.ts +2 -2
  226. package/src/internal/http/router.ts +14 -14
  227. package/src/internal/http/server.ts +60 -23
  228. package/src/internal/http/serverRequest.ts +24 -24
  229. package/src/internal/http/serverResponse.ts +11 -11
  230. package/src/internal/keyValueStore.ts +7 -7
  231. package/src/internal/path.ts +4 -4
  232. package/src/internal/terminal.ts +2 -2
  233. package/src/internal/worker.ts +55 -39
  234. package/src/internal/workerError.ts +1 -1
  235. package/src/internal/workerRunner.ts +55 -30
@@ -5,7 +5,6 @@ import type * as ParseResult from "@effect/schema/ParseResult"
5
5
  import type * as Schema from "@effect/schema/Schema"
6
6
  import type * as Channel from "effect/Channel"
7
7
  import type * as Chunk from "effect/Chunk"
8
- import type * as Data from "effect/Data"
9
8
  import type * as Effect from "effect/Effect"
10
9
  import type * as FiberRef from "effect/FiberRef"
11
10
  import type * as Option from "effect/Option"
@@ -68,7 +67,7 @@ export interface File extends Part.Proto {
68
67
  readonly key: string
69
68
  readonly name: string
70
69
  readonly contentType: string
71
- readonly content: Stream.Stream<never, MultipartError, Uint8Array>
70
+ readonly content: Stream.Stream<Uint8Array, MultipartError>
72
71
  }
73
72
 
74
73
  /**
@@ -107,7 +106,7 @@ export type ErrorTypeId = typeof ErrorTypeId
107
106
  * @since 1.0.0
108
107
  * @category errors
109
108
  */
110
- export interface MultipartError extends Data.Case {
109
+ export interface MultipartError {
111
110
  readonly [ErrorTypeId]: ErrorTypeId
112
111
  readonly _tag: "MultipartError"
113
112
  readonly reason: "FileTooLarge" | "FieldTooLarge" | "BodyTooLarge" | "TooManyParts" | "InternalError" | "Parse"
@@ -140,8 +139,8 @@ export const maxParts: FiberRef.FiberRef<Option.Option<number>> = internal.maxPa
140
139
  * @category fiber refs
141
140
  */
142
141
  export const withMaxParts: {
143
- (count: Option.Option<number>): <R, E, A>(effect: Effect.Effect<R, E, A>) => Effect.Effect<R, E, A>
144
- <R, E, A>(effect: Effect.Effect<R, E, A>, count: Option.Option<number>): Effect.Effect<R, E, A>
142
+ (count: Option.Option<number>): <R, E, A>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
143
+ <R, E, A>(effect: Effect.Effect<A, E, R>, count: Option.Option<number>): Effect.Effect<A, E, R>
145
144
  } = internal.withMaxParts
146
145
 
147
146
  /**
@@ -155,8 +154,8 @@ export const maxFieldSize: FiberRef.FiberRef<FileSystem.Size> = internal.maxFiel
155
154
  * @category fiber refs
156
155
  */
157
156
  export const withMaxFieldSize: {
158
- (size: FileSystem.SizeInput): <R, E, A>(effect: Effect.Effect<R, E, A>) => Effect.Effect<R, E, A>
159
- <R, E, A>(effect: Effect.Effect<R, E, A>, size: FileSystem.SizeInput): Effect.Effect<R, E, A>
157
+ (size: FileSystem.SizeInput): <R, E, A>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
158
+ <R, E, A>(effect: Effect.Effect<A, E, R>, size: FileSystem.SizeInput): Effect.Effect<A, E, R>
160
159
  } = internal.withMaxFieldSize
161
160
 
162
161
  /**
@@ -170,8 +169,8 @@ export const maxFileSize: FiberRef.FiberRef<Option.Option<FileSystem.Size>> = in
170
169
  * @category fiber refs
171
170
  */
172
171
  export const withMaxFileSize: {
173
- (size: Option.Option<FileSystem.SizeInput>): <R, E, A>(effect: Effect.Effect<R, E, A>) => Effect.Effect<R, E, A>
174
- <R, E, A>(effect: Effect.Effect<R, E, A>, size: Option.Option<FileSystem.SizeInput>): Effect.Effect<R, E, A>
172
+ (size: Option.Option<FileSystem.SizeInput>): <R, E, A>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
173
+ <R, E, A>(effect: Effect.Effect<A, E, R>, size: Option.Option<FileSystem.SizeInput>): Effect.Effect<A, E, R>
175
174
  } = internal.withMaxFileSize
176
175
 
177
176
  /**
@@ -185,26 +184,25 @@ export const fieldMimeTypes: FiberRef.FiberRef<Chunk.Chunk<string>> = internal.f
185
184
  * @category fiber refs
186
185
  */
187
186
  export const withFieldMimeTypes: {
188
- (mimeTypes: ReadonlyArray<string>): <R, E, A>(effect: Effect.Effect<R, E, A>) => Effect.Effect<R, E, A>
189
- <R, E, A>(effect: Effect.Effect<R, E, A>, mimeTypes: ReadonlyArray<string>): Effect.Effect<R, E, A>
187
+ (mimeTypes: ReadonlyArray<string>): <R, E, A>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
188
+ <R, E, A>(effect: Effect.Effect<A, E, R>, mimeTypes: ReadonlyArray<string>): Effect.Effect<A, E, R>
190
189
  } = internal.withFieldMimeTypes
191
190
 
192
191
  /**
193
192
  * @since 1.0.0
194
193
  * @category schema
195
194
  */
196
- export const filesSchema: Schema.Schema<never, ReadonlyArray<PersistedFile>, ReadonlyArray<PersistedFile>> =
197
- internal.filesSchema
195
+ export const filesSchema: Schema.Schema<ReadonlyArray<PersistedFile>> = internal.filesSchema
198
196
 
199
197
  /**
200
198
  * @since 1.0.0
201
199
  * @category schema
202
200
  */
203
- export const schemaJson: <R, I, A>(
204
- schema: Schema.Schema<R, I, A>
201
+ export const schemaJson: <A, I, R>(
202
+ schema: Schema.Schema<A, I, R>
205
203
  ) => {
206
- (field: string): (persisted: Persisted) => Effect.Effect<R, ParseResult.ParseError, A>
207
- (persisted: Persisted, field: string): Effect.Effect<R, ParseResult.ParseError, A>
204
+ (field: string): (persisted: Persisted) => Effect.Effect<A, ParseResult.ParseError, R>
205
+ (persisted: Persisted, field: string): Effect.Effect<A, ParseResult.ParseError, R>
208
206
  } = internal.schemaJson
209
207
 
210
208
  /**
@@ -212,8 +210,8 @@ export const schemaJson: <R, I, A>(
212
210
  * @category schema
213
211
  */
214
212
  export const schemaPersisted: <R, I extends Persisted, A>(
215
- schema: Schema.Schema<R, I, A>
216
- ) => (persisted: Persisted) => Effect.Effect<R, ParseResult.ParseError, A> = internal.schemaPersisted
213
+ schema: Schema.Schema<A, I, R>
214
+ ) => (persisted: Persisted) => Effect.Effect<A, ParseResult.ParseError, R> = internal.schemaPersisted
217
215
 
218
216
  /**
219
217
  * @since 1.0.0
@@ -222,21 +220,20 @@ export const schemaPersisted: <R, I extends Persisted, A>(
222
220
  export const makeChannel: <IE>(
223
221
  headers: Record<string, string>,
224
222
  bufferSize?: number
225
- ) => Channel.Channel<never, IE, Chunk.Chunk<Uint8Array>, unknown, MultipartError | IE, Chunk.Chunk<Part>, unknown> =
223
+ ) => Channel.Channel<Chunk.Chunk<Part>, Chunk.Chunk<Uint8Array>, MultipartError | IE, IE, unknown, unknown> =
226
224
  internal.makeChannel
227
225
 
228
226
  /**
229
227
  * @since 1.0.0
230
228
  * @category constructors
231
229
  */
232
- export const makeConfig: (headers: Record<string, string>) => Effect.Effect<never, never, Multipasta.BaseConfig> =
233
- internal.makeConfig
230
+ export const makeConfig: (headers: Record<string, string>) => Effect.Effect<Multipasta.BaseConfig> = internal.makeConfig
234
231
 
235
232
  /**
236
233
  * @since 1.0.0
237
234
  * @category constructors
238
235
  */
239
236
  export const toPersisted: (
240
- stream: Stream.Stream<never, MultipartError, Part>,
241
- writeFile?: (path: string, file: File) => Effect.Effect<FileSystem.FileSystem, MultipartError, void>
242
- ) => Effect.Effect<FileSystem.FileSystem | Path.Path | Scope.Scope, MultipartError, Persisted> = internal.toPersisted
237
+ stream: Stream.Stream<Part, MultipartError>,
238
+ writeFile?: (path: string, file: File) => Effect.Effect<void, MultipartError, FileSystem.FileSystem>
239
+ ) => Effect.Effect<Persisted, MultipartError, FileSystem.FileSystem | Path.Path | Scope.Scope> = internal.toPersisted
@@ -27,7 +27,7 @@ export interface Multiplex<R, E> extends App.Default<R, E | Error.RouteNotFound>
27
27
  readonly [TypeId]: TypeId
28
28
  readonly apps: ReadonlyArray<
29
29
  readonly [
30
- predicate: (request: ServerRequest.ServerRequest) => Effect.Effect<R, E, boolean>,
30
+ predicate: (request: ServerRequest.ServerRequest) => Effect.Effect<boolean, E, R>,
31
31
  app: App.Default<R, E>
32
32
  ]
33
33
  >
@@ -45,7 +45,7 @@ export const empty: Multiplex<never, never> = internal.empty
45
45
  */
46
46
  export const make: <R, E>(
47
47
  apps: Iterable<
48
- readonly [predicate: (request: ServerRequest.ServerRequest) => Effect.Effect<R, E, boolean>, app: App.Default<R, E>]
48
+ readonly [predicate: (request: ServerRequest.ServerRequest) => Effect.Effect<boolean, E, R>, app: App.Default<R, E>]
49
49
  >
50
50
  ) => Multiplex<R, E> = internal.make
51
51
 
@@ -55,12 +55,12 @@ export const make: <R, E>(
55
55
  */
56
56
  export const add: {
57
57
  <R2, E2, R3, E3>(
58
- predicate: (request: ServerRequest.ServerRequest) => Effect.Effect<R2, E2, boolean>,
58
+ predicate: (request: ServerRequest.ServerRequest) => Effect.Effect<boolean, E2, R2>,
59
59
  app: App.Default<R3, E3>
60
60
  ): <R, E>(self: Multiplex<R, E>) => Multiplex<R2 | R3 | R, E2 | E3 | E>
61
61
  <R, E, R2, E2, R3, E3>(
62
62
  self: Multiplex<R, E>,
63
- predicate: (request: ServerRequest.ServerRequest) => Effect.Effect<R2, E2, boolean>,
63
+ predicate: (request: ServerRequest.ServerRequest) => Effect.Effect<boolean, E2, R2>,
64
64
  app: App.Default<R3, E3>
65
65
  ): Multiplex<R | R2 | R3, E | E2 | E3>
66
66
  } = internal.add
@@ -38,11 +38,11 @@ export interface Platform {
38
38
  readonly fileResponse: (
39
39
  path: string,
40
40
  options?: ServerResponse.Options.WithContent & FileSystem.StreamOptions
41
- ) => Effect.Effect<never, Error.PlatformError, ServerResponse.ServerResponse>
41
+ ) => Effect.Effect<ServerResponse.ServerResponse, Error.PlatformError>
42
42
  readonly fileWebResponse: (
43
43
  file: Body.Body.FileLike,
44
44
  options?: ServerResponse.Options.WithContent & FileSystem.StreamOptions
45
- ) => Effect.Effect<never, never, ServerResponse.ServerResponse>
45
+ ) => Effect.Effect<ServerResponse.ServerResponse>
46
46
  }
47
47
 
48
48
  /**
@@ -68,4 +68,4 @@ export const make: (
68
68
  options?: FileSystem.StreamOptions | undefined
69
69
  ) => ServerResponse.ServerResponse
70
70
  }
71
- ) => Effect.Effect<FileSystem.FileSystem | Etag.Generator, never, Platform> = internal.make
71
+ ) => Effect.Effect<Platform, never, FileSystem.FileSystem | Etag.Generator> = internal.make
@@ -86,9 +86,9 @@ export declare namespace Route {
86
86
  * @since 1.0.0
87
87
  */
88
88
  export type Handler<R, E> = Effect.Effect<
89
- R | RouteContext | ServerRequest.ServerRequest,
89
+ ServerResponse.ServerResponse,
90
90
  E,
91
- ServerResponse.ServerResponse
91
+ R | RouteContext | ServerRequest.ServerRequest
92
92
  >
93
93
  }
94
94
 
@@ -126,9 +126,9 @@ export const RouteContext: Context.Tag<RouteContext, RouteContext> = internal.Ro
126
126
  * @category route context
127
127
  */
128
128
  export const params: Effect.Effect<
129
- RouteContext,
129
+ Readonly<Record<string, string | undefined>>,
130
130
  never,
131
- Readonly<Record<string, string | undefined>>
131
+ RouteContext
132
132
  > = internal.params
133
133
 
134
134
  /**
@@ -136,9 +136,9 @@ export const params: Effect.Effect<
136
136
  * @category route context
137
137
  */
138
138
  export const searchParams: Effect.Effect<
139
- RouteContext,
139
+ Readonly<Record<string, string>>,
140
140
  never,
141
- Readonly<Record<string, string>>
141
+ RouteContext
142
142
  > = internal.searchParams
143
143
 
144
144
  /**
@@ -146,24 +146,24 @@ export const searchParams: Effect.Effect<
146
146
  * @category route context
147
147
  */
148
148
  export const schemaParams: <R, I extends Readonly<Record<string, string>>, A>(
149
- schema: Schema.Schema<R, I, A>
150
- ) => Effect.Effect<RouteContext | R, ParseResult.ParseError, A> = internal.schemaParams
149
+ schema: Schema.Schema<A, I, R>
150
+ ) => Effect.Effect<A, ParseResult.ParseError, RouteContext | R> = internal.schemaParams
151
151
 
152
152
  /**
153
153
  * @since 1.0.0
154
154
  * @category route context
155
155
  */
156
156
  export const schemaPathParams: <R, I extends Readonly<Record<string, string>>, A>(
157
- schema: Schema.Schema<R, I, A>
158
- ) => Effect.Effect<RouteContext | R, ParseResult.ParseError, A> = internal.schemaPathParams
157
+ schema: Schema.Schema<A, I, R>
158
+ ) => Effect.Effect<A, ParseResult.ParseError, RouteContext | R> = internal.schemaPathParams
159
159
 
160
160
  /**
161
161
  * @since 1.0.0
162
162
  * @category route context
163
163
  */
164
164
  export const schemaSearchParams: <R, I extends Readonly<Record<string, string>>, A>(
165
- schema: Schema.Schema<R, I, A>
166
- ) => Effect.Effect<RouteContext | R, ParseResult.ParseError, A> = internal.schemaSearchParams
165
+ schema: Schema.Schema<A, I, R>
166
+ ) => Effect.Effect<A, ParseResult.ParseError, RouteContext | R> = internal.schemaSearchParams
167
167
 
168
168
  /**
169
169
  * @since 1.0.0
@@ -590,7 +590,7 @@ export const catchTags: {
590
590
  | Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
591
591
  | Exclude<
592
592
  {
593
- [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect.Effect<infer R, any, any> ? R : never
593
+ [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect.Effect<any, any, infer R> ? R : never
594
594
  }[keyof Cases],
595
595
  RouteContext | ServerRequest.ServerRequest | Scope.Scope
596
596
  >,
@@ -618,7 +618,7 @@ export const catchTags: {
618
618
  | Exclude<R, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
619
619
  | Exclude<
620
620
  {
621
- [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect.Effect<infer R, any, any> ? R : never
621
+ [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect.Effect<any, any, infer R> ? R : never
622
622
  }[keyof Cases],
623
623
  RouteContext | ServerRequest.ServerRequest | Scope.Scope
624
624
  >,
@@ -657,7 +657,7 @@ export const provideService: {
657
657
  export const provideServiceEffect: {
658
658
  <T extends Context.Tag<any, any>, R1, E1>(
659
659
  tag: T,
660
- effect: Effect.Effect<R1, E1, Context.Tag.Service<T>>
660
+ effect: Effect.Effect<Context.Tag.Service<T>, E1, R1>
661
661
  ): <R, E>(
662
662
  self: Router<R, E>
663
663
  ) => Router<
@@ -668,7 +668,7 @@ export const provideServiceEffect: {
668
668
  <R, E, T extends Context.Tag<any, any>, R1, E1>(
669
669
  self: Router<R, E>,
670
670
  tag: T,
671
- effect: Effect.Effect<R1, E1, Context.Tag.Service<T>>
671
+ effect: Effect.Effect<Context.Tag.Service<T>, E1, R1>
672
672
  ): Router<
673
673
  | Exclude<R1, RouteContext | ServerRequest.ServerRequest | Scope.Scope>
674
674
  | Exclude<Exclude<R, Context.Tag.Identifier<T>>, RouteContext | ServerRequest.ServerRequest | Scope.Scope>,
@@ -30,17 +30,17 @@ export interface Server {
30
30
  readonly [TypeId]: TypeId
31
31
  readonly serve: {
32
32
  <R, E>(httpApp: App.Default<R, E>): Effect.Effect<
33
- Exclude<R, ServerRequest.ServerRequest> | Scope.Scope,
33
+ void,
34
34
  never,
35
- void
35
+ Exclude<R, ServerRequest.ServerRequest> | Scope.Scope
36
36
  >
37
37
  <R, E, App extends App.Default<any, any>>(
38
38
  httpApp: App.Default<R, E>,
39
39
  middleware: Middleware.Middleware.Applied<R, E, App>
40
40
  ): Effect.Effect<
41
- Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest> | Scope.Scope,
41
+ void,
42
42
  never,
43
- void
43
+ Exclude<R, ServerRequest.ServerRequest> | Scope.Scope
44
44
  >
45
45
  }
46
46
  readonly address: Address
@@ -56,13 +56,13 @@ export interface ServeOptions {
56
56
 
57
57
  /**
58
58
  * @since 1.0.0
59
- * @category models
59
+ * @category address
60
60
  */
61
61
  export type Address = UnixAddress | TcpAddress
62
62
 
63
63
  /**
64
64
  * @since 1.0.0
65
- * @category models
65
+ * @category address
66
66
  */
67
67
  export interface TcpAddress {
68
68
  readonly _tag: "TcpAddress"
@@ -72,7 +72,7 @@ export interface TcpAddress {
72
72
 
73
73
  /**
74
74
  * @since 1.0.0
75
- * @category models
75
+ * @category address
76
76
  */
77
77
  export interface UnixAddress {
78
78
  readonly _tag: "UnixAddress"
@@ -94,7 +94,7 @@ export const make: (
94
94
  readonly serve: (
95
95
  httpApp: App.Default<never, unknown>,
96
96
  middleware?: Middleware.Middleware
97
- ) => Effect.Effect<Scope.Scope, never, void>
97
+ ) => Effect.Effect<void, never, Scope.Scope>
98
98
  readonly address: Address
99
99
  }
100
100
  ) => Server = internal.make
@@ -106,23 +106,23 @@ export const make: (
106
106
  export const serve: {
107
107
  (): <R, E>(
108
108
  httpApp: App.Default<R, E>
109
- ) => Layer.Layer<Server | Exclude<R, ServerRequest.ServerRequest | Scope.Scope>, never, never>
109
+ ) => Layer.Layer<never, never, Server | Exclude<R, ServerRequest.ServerRequest | Scope.Scope>>
110
110
  <R, E, App extends App.Default<any, any>>(
111
111
  middleware: Middleware.Middleware.Applied<R, E, App>
112
112
  ): (
113
113
  httpApp: App.Default<R, E>
114
114
  ) => Layer.Layer<
115
- Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest | Scope.Scope>,
116
115
  never,
117
- never
116
+ never,
117
+ Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest | Scope.Scope>
118
118
  >
119
119
  <R, E>(
120
120
  httpApp: App.Default<R, E>
121
- ): Layer.Layer<Server | Exclude<R, ServerRequest.ServerRequest | Scope.Scope>, never, never>
121
+ ): Layer.Layer<never, never, Server | Exclude<R, ServerRequest.ServerRequest | Scope.Scope>>
122
122
  <R, E, App extends App.Default<any, any>>(
123
123
  httpApp: App.Default<R, E>,
124
124
  middleware: Middleware.Middleware.Applied<R, E, App>
125
- ): Layer.Layer<Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest | Scope.Scope>, never, never>
125
+ ): Layer.Layer<never, never, Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest | Scope.Scope>>
126
126
  } = internal.serve
127
127
 
128
128
  /**
@@ -132,21 +132,56 @@ export const serve: {
132
132
  export const serveEffect: {
133
133
  (): <R, E>(
134
134
  httpApp: App.Default<R, E>
135
- ) => Effect.Effect<Scope.Scope | Server | Exclude<R, ServerRequest.ServerRequest>, never, void>
135
+ ) => Effect.Effect<void, never, Scope.Scope | Server | Exclude<R, ServerRequest.ServerRequest>>
136
136
  <R, E, App extends App.Default<any, any>>(
137
137
  middleware: Middleware.Middleware.Applied<R, E, App>
138
138
  ): (
139
139
  httpApp: App.Default<R, E>
140
140
  ) => Effect.Effect<
141
- Scope.Scope | Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest>,
141
+ void,
142
142
  never,
143
- void
143
+ Scope.Scope | Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest>
144
144
  >
145
145
  <R, E>(
146
146
  httpApp: App.Default<R, E>
147
- ): Effect.Effect<Scope.Scope | Server | Exclude<R, ServerRequest.ServerRequest>, never, void>
147
+ ): Effect.Effect<void, never, Scope.Scope | Server | Exclude<R, ServerRequest.ServerRequest>>
148
148
  <R, E, App extends App.Default<any, any>>(
149
149
  httpApp: App.Default<R, E>,
150
150
  middleware: Middleware.Middleware.Applied<R, E, App>
151
- ): Effect.Effect<Scope.Scope | Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest>, never, void>
151
+ ): Effect.Effect<void, never, Scope.Scope | Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest>>
152
152
  } = internal.serveEffect
153
+
154
+ /**
155
+ * @since 1.0.0
156
+ * @category address
157
+ */
158
+ export const formatAddress: (address: Address) => string = internal.formatAddress
159
+
160
+ /**
161
+ * @since 1.0.0
162
+ * @category address
163
+ */
164
+ export const addressWith: <R, E, A>(
165
+ effect: (address: Address) => Effect.Effect<A, E, R>
166
+ ) => Effect.Effect<A, E, Server | R> = internal.addressWith
167
+
168
+ /**
169
+ * @since 1.0.0
170
+ * @category address
171
+ */
172
+ export const addressFormattedWith: <R, E, A>(
173
+ effect: (address: string) => Effect.Effect<A, E, R>
174
+ ) => Effect.Effect<A, E, Server | R> = internal.addressFormattedWith
175
+
176
+ /**
177
+ * @since 1.0.0
178
+ * @category address
179
+ */
180
+ export const logAddress: Effect.Effect<void, never, Server> = internal.logAddress
181
+
182
+ /**
183
+ * @since 1.0.0
184
+ * @category address
185
+ */
186
+ export const withLogAddress: <R, E, A>(layer: Layer.Layer<A, E, R>) => Layer.Layer<A, E, R | Exclude<Server, A>> =
187
+ internal.withLogAddress
@@ -2,7 +2,6 @@
2
2
  * @since 1.0.0
3
3
  */
4
4
  import type * as Cause from "effect/Cause"
5
- import type * as Data from "effect/Data"
6
5
  import type * as FiberId from "effect/FiberId"
7
6
  import * as internal from "../internal/http/serverError.js"
8
7
  import type * as ServerRequest from "./ServerRequest.js"
@@ -34,7 +33,7 @@ export declare namespace HttpError {
34
33
  * @since 1.0.0
35
34
  * @category models
36
35
  */
37
- export interface Proto extends Data.Case {
36
+ export interface Proto {
38
37
  readonly [TypeId]: TypeId
39
38
  readonly _tag: string
40
39
  }
@@ -42,7 +41,7 @@ export declare namespace HttpError {
42
41
  /**
43
42
  * @since 1.0.0
44
43
  */
45
- export type ProvidedFields = TypeId | "_tag" | keyof Data.Case
44
+ export type ProvidedFields = TypeId | "_tag"
46
45
  }
47
46
 
48
47
  /**
@@ -48,11 +48,11 @@ export interface ServerRequest extends IncomingMessage.IncomingMessage<Error.Req
48
48
  readonly method: Method
49
49
 
50
50
  readonly multipart: Effect.Effect<
51
- Scope.Scope | FileSystem.FileSystem | Path.Path,
51
+ Multipart.Persisted,
52
52
  Multipart.MultipartError,
53
- Multipart.Persisted
53
+ Scope.Scope | FileSystem.FileSystem | Path.Path
54
54
  >
55
- readonly multipartStream: Stream.Stream<never, Multipart.MultipartError, Multipart.Part>
55
+ readonly multipartStream: Stream.Stream<Multipart.Part, Multipart.MultipartError>
56
56
 
57
57
  readonly modify: (
58
58
  options: {
@@ -74,9 +74,9 @@ export const ServerRequest: Context.Tag<ServerRequest, ServerRequest> = internal
74
74
  * @category accessors
75
75
  */
76
76
  export const persistedMultipart: Effect.Effect<
77
- Scope.Scope | FileSystem.FileSystem | Path.Path | ServerRequest,
77
+ unknown,
78
78
  Multipart.MultipartError,
79
- unknown
79
+ Scope.Scope | FileSystem.FileSystem | Path.Path | ServerRequest
80
80
  > = internal.multipartPersisted
81
81
 
82
82
  /**
@@ -84,27 +84,27 @@ export const persistedMultipart: Effect.Effect<
84
84
  * @category schema
85
85
  */
86
86
  export const schemaHeaders: <R, I extends Readonly<Record<string, string>>, A>(
87
- schema: Schema.Schema<R, I, A>
88
- ) => Effect.Effect<ServerRequest | R, ParseResult.ParseError, A> = internal.schemaHeaders
87
+ schema: Schema.Schema<A, I, R>
88
+ ) => Effect.Effect<A, ParseResult.ParseError, ServerRequest | R> = internal.schemaHeaders
89
89
 
90
90
  /**
91
91
  * @since 1.0.0
92
92
  * @category schema
93
93
  */
94
- export const schemaBodyJson: <R, I, A>(
95
- schema: Schema.Schema<R, I, A>
96
- ) => Effect.Effect<ServerRequest | R, Error.RequestError | ParseResult.ParseError, A> = internal.schemaBodyJson
94
+ export const schemaBodyJson: <A, I, R>(
95
+ schema: Schema.Schema<A, I, R>
96
+ ) => Effect.Effect<A, Error.RequestError | ParseResult.ParseError, ServerRequest | R> = internal.schemaBodyJson
97
97
 
98
98
  /**
99
99
  * @since 1.0.0
100
100
  * @category schema
101
101
  */
102
102
  export const schemaBodyForm: <R, I extends Multipart.Persisted, A>(
103
- schema: Schema.Schema<R, I, A>
103
+ schema: Schema.Schema<A, I, R>
104
104
  ) => Effect.Effect<
105
- ServerRequest | Scope.Scope | FileSystem.FileSystem | Path.Path | R,
105
+ A,
106
106
  Multipart.MultipartError | Error.RequestError | ParseResult.ParseError,
107
- A
107
+ ServerRequest | Scope.Scope | FileSystem.FileSystem | Path.Path | R
108
108
  > = internal.schemaBodyForm
109
109
 
110
110
  /**
@@ -112,33 +112,33 @@ export const schemaBodyForm: <R, I extends Multipart.Persisted, A>(
112
112
  * @category schema
113
113
  */
114
114
  export const schemaBodyUrlParams: <R, I extends Readonly<Record<string, string>>, A>(
115
- schema: Schema.Schema<R, I, A>
116
- ) => Effect.Effect<ServerRequest | R, Error.RequestError | ParseResult.ParseError, A> = internal.schemaBodyUrlParams
115
+ schema: Schema.Schema<A, I, R>
116
+ ) => Effect.Effect<A, Error.RequestError | ParseResult.ParseError, ServerRequest | R> = internal.schemaBodyUrlParams
117
117
 
118
118
  /**
119
119
  * @since 1.0.0
120
120
  * @category schema
121
121
  */
122
122
  export const schemaBodyMultipart: <R, I extends Multipart.Persisted, A>(
123
- schema: Schema.Schema<R, I, A>
123
+ schema: Schema.Schema<A, I, R>
124
124
  ) => Effect.Effect<
125
- R | ServerRequest | Scope.Scope | FileSystem.FileSystem | Path.Path,
125
+ A,
126
126
  Multipart.MultipartError | ParseResult.ParseError,
127
- A
127
+ R | ServerRequest | Scope.Scope | FileSystem.FileSystem | Path.Path
128
128
  > = internal.schemaBodyMultipart
129
129
 
130
130
  /**
131
131
  * @since 1.0.0
132
132
  * @category schema
133
133
  */
134
- export const schemaBodyFormJson: <R, I, A>(
135
- schema: Schema.Schema<R, I, A>
134
+ export const schemaBodyFormJson: <A, I, R>(
135
+ schema: Schema.Schema<A, I, R>
136
136
  ) => (
137
137
  field: string
138
138
  ) => Effect.Effect<
139
- R | ServerRequest | FileSystem.FileSystem | Path.Path | Scope.Scope,
139
+ A,
140
140
  ParseResult.ParseError | Error.RequestError,
141
- A
141
+ R | ServerRequest | FileSystem.FileSystem | Path.Path | Scope.Scope
142
142
  > = internal.schemaBodyFormJson
143
143
 
144
144
  /**
@@ -28,10 +28,10 @@ export type TypeId = typeof TypeId
28
28
  * @since 1.0.0
29
29
  * @category models
30
30
  */
31
- export interface ServerResponse extends Effect.Effect<never, never, ServerResponse> {
31
+ export interface ServerResponse extends Effect.Effect<ServerResponse> {
32
32
  readonly [TypeId]: TypeId
33
33
  readonly status: number
34
- readonly statusText?: string
34
+ readonly statusText?: string | undefined
35
35
  readonly headers: Headers.Headers
36
36
  readonly body: Body.Body
37
37
  }
@@ -95,15 +95,15 @@ export const text: (body: string, options?: Options.WithContentType) => ServerRe
95
95
  export const json: (
96
96
  body: unknown,
97
97
  options?: Options.WithContent
98
- ) => Effect.Effect<never, Body.BodyError, ServerResponse> = internal.json
98
+ ) => Effect.Effect<ServerResponse, Body.BodyError> = internal.json
99
99
 
100
100
  /**
101
101
  * @since 1.0.0
102
102
  * @category constructors
103
103
  */
104
- export const schemaJson: <R, I, A>(
105
- schema: Schema.Schema<R, I, A>
106
- ) => (body: A, options?: Options.WithContent | undefined) => Effect.Effect<R, Body.BodyError, ServerResponse> =
104
+ export const schemaJson: <A, I, R>(
105
+ schema: Schema.Schema<A, I, R>
106
+ ) => (body: A, options?: Options.WithContent | undefined) => Effect.Effect<ServerResponse, Body.BodyError, R> =
107
107
  internal.schemaJson
108
108
 
109
109
  /**
@@ -134,8 +134,7 @@ export const formData: (body: FormData, options?: Options.WithContent) => Server
134
134
  * @since 1.0.0
135
135
  * @category constructors
136
136
  */
137
- export const stream: (body: Stream.Stream<never, unknown, Uint8Array>, options?: Options) => ServerResponse =
138
- internal.stream
137
+ export const stream: (body: Stream.Stream<Uint8Array, unknown>, options?: Options) => ServerResponse = internal.stream
139
138
 
140
139
  /**
141
140
  * @since 1.0.0
@@ -144,7 +143,7 @@ export const stream: (body: Stream.Stream<never, unknown, Uint8Array>, options?:
144
143
  export const file: (
145
144
  path: string,
146
145
  options?: Options & FileSystem.StreamOptions
147
- ) => Effect.Effect<Platform.Platform, PlatformError.PlatformError, ServerResponse> = internal.file
146
+ ) => Effect.Effect<ServerResponse, PlatformError.PlatformError, Platform.Platform> = internal.file
148
147
 
149
148
  /**
150
149
  * @since 1.0.0
@@ -153,7 +152,7 @@ export const file: (
153
152
  export const fileWeb: (
154
153
  file: Body.Body.FileLike,
155
154
  options?: Options.WithContent & FileSystem.StreamOptions
156
- ) => Effect.Effect<Platform.Platform, never, ServerResponse> = internal.fileWeb
155
+ ) => Effect.Effect<ServerResponse, never, Platform.Platform> = internal.fileWeb
157
156
 
158
157
  /**
159
158
  * @since 1.0.0
@@ -182,7 +182,7 @@ export const toString = (self: UrlParams): string => new URLSearchParams(self as
182
182
  * @since 1.0.0
183
183
  * @category constructors
184
184
  */
185
- export const makeUrl = <E>(url: string, params: UrlParams, onError: (e: unknown) => E): Effect.Effect<never, E, URL> =>
185
+ export const makeUrl = <E>(url: string, params: UrlParams, onError: (e: unknown) => E): Effect.Effect<URL, E> =>
186
186
  Effect.try({
187
187
  try: () => {
188
188
  const urlInstance = new URL(url, baseUrl())
@@ -207,18 +207,18 @@ const baseUrl = (): string | undefined => {
207
207
  * @since 1.0.0
208
208
  * @category schema
209
209
  */
210
- export const schemaJson = <R, I, A>(schema: Schema.Schema<R, I, A>): {
210
+ export const schemaJson = <A, I, R>(schema: Schema.Schema<A, I, R>): {
211
211
  (
212
212
  field: string
213
- ): (self: UrlParams) => Effect.Effect<R, ParseResult.ParseError, A>
213
+ ): (self: UrlParams) => Effect.Effect<A, ParseResult.ParseError, R>
214
214
  (
215
215
  self: UrlParams,
216
216
  field: string
217
- ): Effect.Effect<R, ParseResult.ParseError, A>
217
+ ): Effect.Effect<A, ParseResult.ParseError, R>
218
218
  } => {
219
219
  const parse = Schema.decodeUnknown(Schema.parseJson(schema))
220
220
  return dual<
221
- (field: string) => (self: UrlParams) => Effect.Effect<R, ParseResult.ParseError, A>,
222
- (self: UrlParams, field: string) => Effect.Effect<R, ParseResult.ParseError, A>
221
+ (field: string) => (self: UrlParams) => Effect.Effect<A, ParseResult.ParseError, R>,
222
+ (self: UrlParams, field: string) => Effect.Effect<A, ParseResult.ParseError, R>
223
223
  >(2, (self, field) => parse(Option.getOrElse(getLast(self, field), () => "")))
224
224
  }