@effect/platform 0.53.12 → 0.53.14
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.
- package/README.md +989 -142
- package/dist/cjs/Http/Router.js.map +1 -1
- package/dist/dts/Http/App.d.ts +2 -2
- package/dist/dts/Http/Client.d.ts +29 -29
- package/dist/dts/Http/Client.d.ts.map +1 -1
- package/dist/dts/Http/IncomingMessage.d.ts +1 -1
- package/dist/dts/Http/Middleware.d.ts +10 -10
- package/dist/dts/Http/Multipart.d.ts +8 -8
- package/dist/dts/Http/Multiplex.d.ts +19 -19
- package/dist/dts/Http/Router.d.ts +34 -35
- package/dist/dts/Http/Router.d.ts.map +1 -1
- package/dist/dts/Http/Server.d.ts +13 -13
- package/dist/dts/Socket.d.ts +2 -2
- package/dist/dts/WorkerRunner.d.ts +2 -2
- package/dist/dts/internal/http/router.d.ts +1 -1
- package/dist/esm/Http/Router.js.map +1 -1
- package/package.json +3 -3
- package/src/Http/App.ts +3 -3
- package/src/Http/Client.ts +29 -29
- package/src/Http/IncomingMessage.ts +2 -2
- package/src/Http/Middleware.ts +10 -10
- package/src/Http/Multipart.ts +8 -8
- package/src/Http/Multiplex.ts +24 -24
- package/src/Http/Router.ts +34 -39
- package/src/Http/Server.ts +13 -13
- package/src/Socket.ts +4 -4
- package/src/WorkerRunner.ts +2 -2
- package/src/internal/http/client.ts +31 -31
- package/src/internal/http/middleware.ts +7 -7
- package/src/internal/http/multipart.ts +8 -8
- package/src/internal/http/multiplex.ts +28 -28
- package/src/internal/http/router.ts +23 -23
- package/src/internal/http/server.ts +13 -13
- package/src/internal/workerRunner.ts +2 -2
|
@@ -60,8 +60,8 @@ export const maxParts: FiberRef.FiberRef<Option.Option<number>> = globalValue(
|
|
|
60
60
|
|
|
61
61
|
/** @internal */
|
|
62
62
|
export const withMaxParts = dual<
|
|
63
|
-
(count: Option.Option<number>) => <
|
|
64
|
-
<
|
|
63
|
+
(count: Option.Option<number>) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>,
|
|
64
|
+
<A, E, R>(effect: Effect.Effect<A, E, R>, count: Option.Option<number>) => Effect.Effect<A, E, R>
|
|
65
65
|
>(2, (effect, count) => Effect.locally(effect, maxParts, count))
|
|
66
66
|
|
|
67
67
|
/** @internal */
|
|
@@ -72,8 +72,8 @@ export const maxFieldSize: FiberRef.FiberRef<FileSystem.Size> = globalValue(
|
|
|
72
72
|
|
|
73
73
|
/** @internal */
|
|
74
74
|
export const withMaxFieldSize = dual<
|
|
75
|
-
(size: FileSystem.SizeInput) => <
|
|
76
|
-
<
|
|
75
|
+
(size: FileSystem.SizeInput) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>,
|
|
76
|
+
<A, E, R>(effect: Effect.Effect<A, E, R>, size: FileSystem.SizeInput) => Effect.Effect<A, E, R>
|
|
77
77
|
>(2, (effect, size) => Effect.locally(effect, maxFieldSize, FileSystem.Size(size)))
|
|
78
78
|
|
|
79
79
|
/** @internal */
|
|
@@ -84,8 +84,8 @@ export const maxFileSize: FiberRef.FiberRef<Option.Option<FileSystem.Size>> = gl
|
|
|
84
84
|
|
|
85
85
|
/** @internal */
|
|
86
86
|
export const withMaxFileSize = dual<
|
|
87
|
-
(size: Option.Option<FileSystem.SizeInput>) => <
|
|
88
|
-
<
|
|
87
|
+
(size: Option.Option<FileSystem.SizeInput>) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>,
|
|
88
|
+
<A, E, R>(effect: Effect.Effect<A, E, R>, size: Option.Option<FileSystem.SizeInput>) => Effect.Effect<A, E, R>
|
|
89
89
|
>(2, (effect, size) => Effect.locally(effect, maxFileSize, Option.map(size, FileSystem.Size)))
|
|
90
90
|
|
|
91
91
|
/** @internal */
|
|
@@ -96,8 +96,8 @@ export const fieldMimeTypes: FiberRef.FiberRef<Chunk.Chunk<string>> = globalValu
|
|
|
96
96
|
|
|
97
97
|
/** @internal */
|
|
98
98
|
export const withFieldMimeTypes = dual<
|
|
99
|
-
(mimeTypes: ReadonlyArray<string>) => <
|
|
100
|
-
<
|
|
99
|
+
(mimeTypes: ReadonlyArray<string>) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>,
|
|
100
|
+
<A, E, R>(effect: Effect.Effect<A, E, R>, mimeTypes: ReadonlyArray<string>) => Effect.Effect<A, E, R>
|
|
101
101
|
>(2, (effect, mimeTypes) => Effect.locally(effect, fieldMimeTypes, Chunk.fromIterable(mimeTypes)))
|
|
102
102
|
|
|
103
103
|
/** @internal */
|
|
@@ -68,7 +68,7 @@ class MultiplexImpl<E = never, R = never>
|
|
|
68
68
|
export const empty: Multiplex.Multiplex<never> = new MultiplexImpl([])
|
|
69
69
|
|
|
70
70
|
/** @internal */
|
|
71
|
-
export const make = <
|
|
71
|
+
export const make = <E, R>(
|
|
72
72
|
apps: Iterable<
|
|
73
73
|
readonly [predicate: (request: ServerRequest.ServerRequest) => Effect.Effect<boolean, E, R>, app: App.Default<E, R>]
|
|
74
74
|
>
|
|
@@ -76,11 +76,11 @@ export const make = <R, E>(
|
|
|
76
76
|
|
|
77
77
|
/** @internal */
|
|
78
78
|
export const add = dual<
|
|
79
|
-
<R2,
|
|
79
|
+
<E2, R2, E3, R3>(
|
|
80
80
|
predicate: (request: ServerRequest.ServerRequest) => Effect.Effect<boolean, E2, R2>,
|
|
81
81
|
app: App.Default<E3, R3>
|
|
82
|
-
) => <
|
|
83
|
-
<R,
|
|
82
|
+
) => <E, R>(self: Multiplex.Multiplex<E, R>) => Multiplex.Multiplex<E | E2 | E3, R | R2 | R3>,
|
|
83
|
+
<E, R, E2, R2, E3, R3>(
|
|
84
84
|
self: Multiplex.Multiplex<E, R>,
|
|
85
85
|
predicate: (request: ServerRequest.ServerRequest) => Effect.Effect<boolean, E2, R2>,
|
|
86
86
|
app: App.Default<E3, R3>
|
|
@@ -96,12 +96,12 @@ export const add = dual<
|
|
|
96
96
|
|
|
97
97
|
/** @internal */
|
|
98
98
|
export const headerExact = dual<
|
|
99
|
-
<
|
|
99
|
+
<E2, R2>(
|
|
100
100
|
header: string,
|
|
101
101
|
value: string,
|
|
102
102
|
app: App.Default<E2, R2>
|
|
103
|
-
) => <
|
|
104
|
-
<R,
|
|
103
|
+
) => <E, R>(self: Multiplex.Multiplex<E, R>) => Multiplex.Multiplex<E | E2, R | R2>,
|
|
104
|
+
<E, R, E2, R2>(
|
|
105
105
|
self: Multiplex.Multiplex<E, R>,
|
|
106
106
|
header: string,
|
|
107
107
|
value: string,
|
|
@@ -118,12 +118,12 @@ export const headerExact = dual<
|
|
|
118
118
|
|
|
119
119
|
/** @internal */
|
|
120
120
|
export const headerRegex = dual<
|
|
121
|
-
<
|
|
121
|
+
<E2, R2>(
|
|
122
122
|
header: string,
|
|
123
123
|
regex: RegExp,
|
|
124
124
|
app: App.Default<E2, R2>
|
|
125
|
-
) => <
|
|
126
|
-
<R,
|
|
125
|
+
) => <E, R>(self: Multiplex.Multiplex<E, R>) => Multiplex.Multiplex<E | E2, R | R2>,
|
|
126
|
+
<E, R, E2, R2>(
|
|
127
127
|
self: Multiplex.Multiplex<E, R>,
|
|
128
128
|
header: string,
|
|
129
129
|
regex: RegExp,
|
|
@@ -140,12 +140,12 @@ export const headerRegex = dual<
|
|
|
140
140
|
|
|
141
141
|
/** @internal */
|
|
142
142
|
export const headerStartsWith = dual<
|
|
143
|
-
<
|
|
143
|
+
<E2, R2>(
|
|
144
144
|
header: string,
|
|
145
145
|
prefix: string,
|
|
146
146
|
app: App.Default<E2, R2>
|
|
147
|
-
) => <
|
|
148
|
-
<R,
|
|
147
|
+
) => <E, R>(self: Multiplex.Multiplex<E, R>) => Multiplex.Multiplex<E | E2, R | R2>,
|
|
148
|
+
<E, R, E2, R2>(
|
|
149
149
|
self: Multiplex.Multiplex<E, R>,
|
|
150
150
|
header: string,
|
|
151
151
|
prefix: string,
|
|
@@ -162,12 +162,12 @@ export const headerStartsWith = dual<
|
|
|
162
162
|
|
|
163
163
|
/** @internal */
|
|
164
164
|
export const headerEndsWith = dual<
|
|
165
|
-
<
|
|
165
|
+
<E2, R2>(
|
|
166
166
|
header: string,
|
|
167
167
|
suffix: string,
|
|
168
168
|
app: App.Default<E2, R2>
|
|
169
|
-
) => <
|
|
170
|
-
<R,
|
|
169
|
+
) => <E, R>(self: Multiplex.Multiplex<E, R>) => Multiplex.Multiplex<E | E2, R | R2>,
|
|
170
|
+
<E, R, E2, R2>(
|
|
171
171
|
self: Multiplex.Multiplex<E, R>,
|
|
172
172
|
header: string,
|
|
173
173
|
suffix: string,
|
|
@@ -184,11 +184,11 @@ export const headerEndsWith = dual<
|
|
|
184
184
|
|
|
185
185
|
/** @internal */
|
|
186
186
|
export const hostRegex = dual<
|
|
187
|
-
<
|
|
187
|
+
<E2, R2>(
|
|
188
188
|
regex: RegExp,
|
|
189
189
|
app: App.Default<E2, R2>
|
|
190
|
-
) => <
|
|
191
|
-
<R,
|
|
190
|
+
) => <E, R>(self: Multiplex.Multiplex<E, R>) => Multiplex.Multiplex<E | E2, R | R2>,
|
|
191
|
+
<E, R, E2, R2>(
|
|
192
192
|
self: Multiplex.Multiplex<E, R>,
|
|
193
193
|
regex: RegExp,
|
|
194
194
|
app: App.Default<E2, R2>
|
|
@@ -197,11 +197,11 @@ export const hostRegex = dual<
|
|
|
197
197
|
|
|
198
198
|
/** @internal */
|
|
199
199
|
export const hostStartsWith = dual<
|
|
200
|
-
<
|
|
200
|
+
<E2, R2>(
|
|
201
201
|
prefix: string,
|
|
202
202
|
app: App.Default<E2, R2>
|
|
203
|
-
) => <
|
|
204
|
-
<R,
|
|
203
|
+
) => <E, R>(self: Multiplex.Multiplex<E, R>) => Multiplex.Multiplex<E | E2, R | R2>,
|
|
204
|
+
<E, R, E2, R2>(
|
|
205
205
|
self: Multiplex.Multiplex<E, R>,
|
|
206
206
|
prefix: string,
|
|
207
207
|
app: App.Default<E2, R2>
|
|
@@ -210,11 +210,11 @@ export const hostStartsWith = dual<
|
|
|
210
210
|
|
|
211
211
|
/** @internal */
|
|
212
212
|
export const hostEndsWith = dual<
|
|
213
|
-
<
|
|
213
|
+
<E2, R2>(
|
|
214
214
|
suffix: string,
|
|
215
215
|
app: App.Default<E2, R2>
|
|
216
|
-
) => <
|
|
217
|
-
<R,
|
|
216
|
+
) => <E, R>(self: Multiplex.Multiplex<E, R>) => Multiplex.Multiplex<E | E2, R | R2>,
|
|
217
|
+
<E, R, E2, R2>(
|
|
218
218
|
self: Multiplex.Multiplex<E, R>,
|
|
219
219
|
suffix: string,
|
|
220
220
|
app: App.Default<E2, R2>
|
|
@@ -223,11 +223,11 @@ export const hostEndsWith = dual<
|
|
|
223
223
|
|
|
224
224
|
/** @internal */
|
|
225
225
|
export const hostExact = dual<
|
|
226
|
-
<
|
|
226
|
+
<E2, R2>(
|
|
227
227
|
host: string,
|
|
228
228
|
app: App.Default<E2, R2>
|
|
229
|
-
) => <
|
|
230
|
-
<R,
|
|
229
|
+
) => <E, R>(self: Multiplex.Multiplex<E, R>) => Multiplex.Multiplex<E | E2, R | R2>,
|
|
230
|
+
<E, R, E2, R2>(
|
|
231
231
|
self: Multiplex.Multiplex<E, R>,
|
|
232
232
|
host: string,
|
|
233
233
|
app: App.Default<E2, R2>
|
|
@@ -180,7 +180,7 @@ class RouterImpl<E = never, R = never> extends Effectable.StructuralClass<
|
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
const toHttpApp = <
|
|
183
|
+
const toHttpApp = <E, R>(
|
|
184
184
|
self: Router.Router<E, R>
|
|
185
185
|
): App.Default<E | Error.RouteNotFound, R> => {
|
|
186
186
|
const router = FindMyWay.make<Router.Route<E, R>>()
|
|
@@ -331,8 +331,8 @@ export const makeRoute = <E, R>(
|
|
|
331
331
|
|
|
332
332
|
/** @internal */
|
|
333
333
|
export const concat = dual<
|
|
334
|
-
<R1, E1>(that: Router.Router<E1, R1>) => <
|
|
335
|
-
<R,
|
|
334
|
+
<R1, E1>(that: Router.Router<E1, R1>) => <E, R>(self: Router.Router<E, R>) => Router.Router<E | E1, R | R1>,
|
|
335
|
+
<E, R, E1, R1>(self: Router.Router<E, R>, that: Router.Router<E1, R1>) => Router.Router<E | E1, R | R1>
|
|
336
336
|
>(2, (self, that) => new RouterImpl(Chunk.appendAll(self.routes, that.routes) as any, self.mounts))
|
|
337
337
|
|
|
338
338
|
const removeTrailingSlash = (
|
|
@@ -341,8 +341,8 @@ const removeTrailingSlash = (
|
|
|
341
341
|
|
|
342
342
|
/** @internal */
|
|
343
343
|
export const prefixAll = dual<
|
|
344
|
-
(prefix: Router.PathInput) => <
|
|
345
|
-
<
|
|
344
|
+
(prefix: Router.PathInput) => <E, R>(self: Router.Router<E, R>) => Router.Router<E, R>,
|
|
345
|
+
<E, R>(self: Router.Router<E, R>, prefix: Router.PathInput) => Router.Router<E, R>
|
|
346
346
|
>(
|
|
347
347
|
2,
|
|
348
348
|
(self, prefix) => {
|
|
@@ -369,8 +369,8 @@ export const mount = dual<
|
|
|
369
369
|
<R1, E1>(
|
|
370
370
|
path: `/${string}`,
|
|
371
371
|
that: Router.Router<E1, R1>
|
|
372
|
-
) => <
|
|
373
|
-
<R,
|
|
372
|
+
) => <E, R>(self: Router.Router<E, R>) => Router.Router<E | E1, R | R1>,
|
|
373
|
+
<E, R, E1, R1>(
|
|
374
374
|
self: Router.Router<E, R>,
|
|
375
375
|
path: `/${string}`,
|
|
376
376
|
that: Router.Router<E1, R1>
|
|
@@ -388,10 +388,10 @@ export const mountApp = dual<
|
|
|
388
388
|
options?: {
|
|
389
389
|
readonly includePrefix?: boolean | undefined
|
|
390
390
|
} | undefined
|
|
391
|
-
) => <
|
|
391
|
+
) => <E, R>(
|
|
392
392
|
self: Router.Router<E, R>
|
|
393
393
|
) => Router.Router<E | E1, R | Router.Router.ExcludeProvided<R1>>,
|
|
394
|
-
<R,
|
|
394
|
+
<E, R, E1, R1>(
|
|
395
395
|
self: Router.Router<E, R>,
|
|
396
396
|
path: `/${string}`,
|
|
397
397
|
that: App.Default<E1, R1>,
|
|
@@ -401,7 +401,7 @@ export const mountApp = dual<
|
|
|
401
401
|
) => Router.Router<E | E1, R | Router.Router.ExcludeProvided<R1>>
|
|
402
402
|
>(
|
|
403
403
|
(args) => Predicate.hasProperty(args[0], TypeId),
|
|
404
|
-
<R,
|
|
404
|
+
<E, R, E1, R1>(
|
|
405
405
|
self: Router.Router<E, R>,
|
|
406
406
|
path: `/${string}`,
|
|
407
407
|
that: App.Default<E1, R1>,
|
|
@@ -420,10 +420,10 @@ export const route = (method: Method.Method | "*"): {
|
|
|
420
420
|
options?: {
|
|
421
421
|
readonly uninterruptible?: boolean | undefined
|
|
422
422
|
} | undefined
|
|
423
|
-
): <
|
|
423
|
+
): <E, R>(
|
|
424
424
|
self: Router.Router<E, R>
|
|
425
425
|
) => Router.Router<E1 | E, R | Router.Router.ExcludeProvided<R1>>
|
|
426
|
-
<R,
|
|
426
|
+
<E, R, E1, R1>(
|
|
427
427
|
self: Router.Router<E, R>,
|
|
428
428
|
path: Router.PathInput,
|
|
429
429
|
handler: Router.Route.Handler<E1, R1>,
|
|
@@ -436,10 +436,10 @@ export const route = (method: Method.Method | "*"): {
|
|
|
436
436
|
<R1, E1>(
|
|
437
437
|
path: Router.PathInput,
|
|
438
438
|
handler: Router.Route.Handler<R1, E1>
|
|
439
|
-
) => <
|
|
439
|
+
) => <E, R>(
|
|
440
440
|
self: Router.Router<E, R>
|
|
441
441
|
) => Router.Router<E | E1, R | Router.Router.ExcludeProvided<R1>>,
|
|
442
|
-
<R,
|
|
442
|
+
<E, R, E1, R1>(
|
|
443
443
|
self: Router.Router<E, R>,
|
|
444
444
|
path: Router.PathInput,
|
|
445
445
|
handler: Router.Route.Handler<E1, R1>,
|
|
@@ -512,7 +512,7 @@ export const catchAll = dual<
|
|
|
512
512
|
<E, E2, R2>(
|
|
513
513
|
f: (e: E) => Router.Route.Handler<E2, R2>
|
|
514
514
|
) => <R>(self: Router.Router<E, R>) => Router.Router<E2, R | Router.Router.ExcludeProvided<R2>>,
|
|
515
|
-
<
|
|
515
|
+
<E, R, E2, R2>(
|
|
516
516
|
self: Router.Router<E, R>,
|
|
517
517
|
f: (e: E) => Router.Route.Handler<E2, R2>
|
|
518
518
|
) => Router.Router<E2, R | Router.Router.ExcludeProvided<R2>>
|
|
@@ -523,7 +523,7 @@ export const catchAllCause = dual<
|
|
|
523
523
|
<E, E2, R2>(
|
|
524
524
|
f: (e: Cause.Cause<E>) => Router.Route.Handler<E2, R2>
|
|
525
525
|
) => <R>(self: Router.Router<E, R>) => Router.Router<E2, R | Router.Router.ExcludeProvided<R2>>,
|
|
526
|
-
<
|
|
526
|
+
<E, R, E2, R2>(
|
|
527
527
|
self: Router.Router<E, R>,
|
|
528
528
|
f: (e: Cause.Cause<E>) => Router.Route.Handler<E2, R2>
|
|
529
529
|
) => Router.Router<E2, R | Router.Router.ExcludeProvided<R2>>
|
|
@@ -537,7 +537,7 @@ export const catchTag = dual<
|
|
|
537
537
|
) => <R>(
|
|
538
538
|
self: Router.Router<E, R>
|
|
539
539
|
) => Router.Router<Exclude<E, { _tag: K }> | E1, R | Router.Router.ExcludeProvided<R1>>,
|
|
540
|
-
<
|
|
540
|
+
<E, R, K extends (E extends { _tag: string } ? E["_tag"] : never), E1, R1>(
|
|
541
541
|
self: Router.Router<E, R>,
|
|
542
542
|
k: K,
|
|
543
543
|
f: (e: Extract<E, { _tag: K }>) => Router.Route.Handler<E1, R1>
|
|
@@ -594,15 +594,15 @@ export const provideService = dual<
|
|
|
594
594
|
<T extends Context.Tag<any, any>>(
|
|
595
595
|
tag: T,
|
|
596
596
|
service: Context.Tag.Service<T>
|
|
597
|
-
) => <
|
|
597
|
+
) => <E, R>(
|
|
598
598
|
self: Router.Router<E, R>
|
|
599
599
|
) => Router.Router<E, Exclude<R, Context.Tag.Identifier<T>>>,
|
|
600
|
-
<
|
|
600
|
+
<E, R, T extends Context.Tag<any, any>>(
|
|
601
601
|
self: Router.Router<E, R>,
|
|
602
602
|
tag: T,
|
|
603
603
|
service: Context.Tag.Service<T>
|
|
604
604
|
) => Router.Router<E, Exclude<R, Context.Tag.Identifier<T>>>
|
|
605
|
-
>(3, <
|
|
605
|
+
>(3, <E, R, T extends Context.Tag<any, any>>(
|
|
606
606
|
self: Router.Router<E, R>,
|
|
607
607
|
tag: T,
|
|
608
608
|
service: Context.Tag.Service<T>
|
|
@@ -613,7 +613,7 @@ export const provideServiceEffect = dual<
|
|
|
613
613
|
<T extends Context.Tag<any, any>, R1, E1>(
|
|
614
614
|
tag: T,
|
|
615
615
|
effect: Effect.Effect<Context.Tag.Service<T>, E1, R1>
|
|
616
|
-
) => <
|
|
616
|
+
) => <E, R>(
|
|
617
617
|
self: Router.Router<E, R>
|
|
618
618
|
) => Router.Router<
|
|
619
619
|
E | E1,
|
|
@@ -622,7 +622,7 @@ export const provideServiceEffect = dual<
|
|
|
622
622
|
Context.Tag.Identifier<T>
|
|
623
623
|
>
|
|
624
624
|
>,
|
|
625
|
-
<
|
|
625
|
+
<E, R, T extends Context.Tag<any, any>, R1, E1>(
|
|
626
626
|
self: Router.Router<E, R>,
|
|
627
627
|
tag: T,
|
|
628
628
|
effect: Effect.Effect<Context.Tag.Service<T>, E1, R1>
|
|
@@ -633,7 +633,7 @@ export const provideServiceEffect = dual<
|
|
|
633
633
|
Context.Tag.Identifier<T>
|
|
634
634
|
>
|
|
635
635
|
>
|
|
636
|
-
>(3, <
|
|
636
|
+
>(3, <E, R, T extends Context.Tag<any, any>, R1, E1>(
|
|
637
637
|
self: Router.Router<E, R>,
|
|
638
638
|
tag: T,
|
|
639
639
|
effect: Effect.Effect<Context.Tag.Service<T>, E1, R1>
|
|
@@ -35,10 +35,10 @@ export const make = (
|
|
|
35
35
|
/** @internal */
|
|
36
36
|
export const serve = dual<
|
|
37
37
|
{
|
|
38
|
-
(): <
|
|
38
|
+
(): <E, R>(
|
|
39
39
|
httpApp: App.Default<E, R>
|
|
40
40
|
) => Layer.Layer<never, never, Server.Server | Exclude<R, ServerRequest.ServerRequest | Scope.Scope>>
|
|
41
|
-
<
|
|
41
|
+
<E, R, App extends App.Default<any, any>>(middleware: Middleware.Middleware.Applied<App, E, R>): (
|
|
42
42
|
httpApp: App.Default<E, R>
|
|
43
43
|
) => Layer.Layer<
|
|
44
44
|
never,
|
|
@@ -47,10 +47,10 @@ export const serve = dual<
|
|
|
47
47
|
>
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
|
-
<
|
|
50
|
+
<E, R>(
|
|
51
51
|
httpApp: App.Default<E, R>
|
|
52
52
|
): Layer.Layer<never, never, Server.Server | Exclude<R, ServerRequest.ServerRequest | Scope.Scope>>
|
|
53
|
-
<
|
|
53
|
+
<E, R, App extends App.Default<any, any>>(
|
|
54
54
|
httpApp: App.Default<E, R>,
|
|
55
55
|
middleware: Middleware.Middleware.Applied<App, E, R>
|
|
56
56
|
): Layer.Layer<
|
|
@@ -61,7 +61,7 @@ export const serve = dual<
|
|
|
61
61
|
}
|
|
62
62
|
>(
|
|
63
63
|
(args) => Effect.isEffect(args[0]),
|
|
64
|
-
<
|
|
64
|
+
<E, R, App extends App.Default<any, any>>(
|
|
65
65
|
httpApp: App.Default<E, R>,
|
|
66
66
|
middleware?: Middleware.Middleware.Applied<App, E, R>
|
|
67
67
|
): Layer.Layer<
|
|
@@ -80,14 +80,14 @@ export const serve = dual<
|
|
|
80
80
|
/** @internal */
|
|
81
81
|
export const serveEffect = dual<
|
|
82
82
|
{
|
|
83
|
-
(): <
|
|
83
|
+
(): <E, R>(
|
|
84
84
|
httpApp: App.Default<E, R>
|
|
85
85
|
) => Effect.Effect<
|
|
86
86
|
void,
|
|
87
87
|
never,
|
|
88
88
|
Server.Server | Scope.Scope | Exclude<R, ServerRequest.ServerRequest>
|
|
89
89
|
>
|
|
90
|
-
<
|
|
90
|
+
<E, R, App extends App.Default<any, any>>(middleware: Middleware.Middleware.Applied<App, E, R>): (
|
|
91
91
|
httpApp: App.Default<E, R>
|
|
92
92
|
) => Effect.Effect<
|
|
93
93
|
void,
|
|
@@ -96,10 +96,10 @@ export const serveEffect = dual<
|
|
|
96
96
|
>
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
|
-
<
|
|
99
|
+
<E, R>(
|
|
100
100
|
httpApp: App.Default<E, R>
|
|
101
101
|
): Effect.Effect<void, never, Server.Server | Scope.Scope | Exclude<R, ServerRequest.ServerRequest>>
|
|
102
|
-
<
|
|
102
|
+
<E, R, App extends App.Default<any, any>>(
|
|
103
103
|
httpApp: App.Default<E, R>,
|
|
104
104
|
middleware: Middleware.Middleware.Applied<App, E, R>
|
|
105
105
|
): Effect.Effect<
|
|
@@ -110,7 +110,7 @@ export const serveEffect = dual<
|
|
|
110
110
|
}
|
|
111
111
|
>(
|
|
112
112
|
(args) => Effect.isEffect(args[0]),
|
|
113
|
-
(<
|
|
113
|
+
(<E, R, App extends App.Default<any, any>>(
|
|
114
114
|
httpApp: App.Default<E, R>,
|
|
115
115
|
middleware: Middleware.Middleware.Applied<App, E, R>
|
|
116
116
|
): Effect.Effect<
|
|
@@ -135,7 +135,7 @@ export const formatAddress = (address: Server.Address): string => {
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
/** @internal */
|
|
138
|
-
export const addressWith = <
|
|
138
|
+
export const addressWith = <A, E, R>(
|
|
139
139
|
effect: (address: Server.Address) => Effect.Effect<A, E, R>
|
|
140
140
|
): Effect.Effect<A, E, Server.Server | R> =>
|
|
141
141
|
Effect.flatMap(
|
|
@@ -144,7 +144,7 @@ export const addressWith = <R, E, A>(
|
|
|
144
144
|
)
|
|
145
145
|
|
|
146
146
|
/** @internal */
|
|
147
|
-
export const addressFormattedWith = <
|
|
147
|
+
export const addressFormattedWith = <A, E, R>(
|
|
148
148
|
effect: (address: string) => Effect.Effect<A, E, R>
|
|
149
149
|
): Effect.Effect<A, E, Server.Server | R> =>
|
|
150
150
|
Effect.flatMap(
|
|
@@ -158,7 +158,7 @@ export const logAddress: Effect.Effect<void, never, Server.Server> = addressForm
|
|
|
158
158
|
)
|
|
159
159
|
|
|
160
160
|
/** @internal */
|
|
161
|
-
export const withLogAddress = <
|
|
161
|
+
export const withLogAddress = <A, E, R>(
|
|
162
162
|
layer: Layer.Layer<A, E, R>
|
|
163
163
|
): Layer.Layer<A, E, R | Exclude<Server.Server, A>> =>
|
|
164
164
|
Layer.effectDiscard(logAddress).pipe(
|
|
@@ -30,7 +30,7 @@ export const PlatformRunner = Context.GenericTag<WorkerRunner.PlatformRunner>(
|
|
|
30
30
|
)
|
|
31
31
|
|
|
32
32
|
/** @internal */
|
|
33
|
-
export const make = <I,
|
|
33
|
+
export const make = <I, E, R, O>(
|
|
34
34
|
process: (request: I) => Stream.Stream<O, E, R> | Effect.Effect<O, E, R>,
|
|
35
35
|
options?: WorkerRunner.Runner.Options<I, O, E>
|
|
36
36
|
) =>
|
|
@@ -172,7 +172,7 @@ export const make = <I, R, E, O>(
|
|
|
172
172
|
})
|
|
173
173
|
|
|
174
174
|
/** @internal */
|
|
175
|
-
export const layer = <I,
|
|
175
|
+
export const layer = <I, E, R, O>(
|
|
176
176
|
process: (request: I) => Stream.Stream<O, E, R> | Effect.Effect<O, E, R>,
|
|
177
177
|
options?: WorkerRunner.Runner.Options<I, O, E>
|
|
178
178
|
): Layer.Layer<never, WorkerError, WorkerRunner.PlatformRunner | R> => Layer.scopedDiscard(make(process, options))
|