@effect/platform 0.48.29 → 0.49.1
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 +12 -12
- package/dist/cjs/FileSystem.js +8 -1
- package/dist/cjs/FileSystem.js.map +1 -1
- package/dist/cjs/Http/App.js +9 -7
- package/dist/cjs/Http/App.js.map +1 -1
- package/dist/cjs/Http/Client.js +13 -3
- package/dist/cjs/Http/Client.js.map +1 -1
- package/dist/cjs/Http/ClientResponse.js +9 -9
- package/dist/cjs/Http/ClientResponse.js.map +1 -1
- package/dist/cjs/Http/Cookies.js +7 -7
- package/dist/cjs/Http/Cookies.js.map +1 -1
- package/dist/cjs/Http/Headers.js +7 -7
- package/dist/cjs/Http/Headers.js.map +1 -1
- package/dist/cjs/Http/IncomingMessage.js +7 -7
- package/dist/cjs/Http/IncomingMessage.js.map +1 -1
- package/dist/cjs/Http/Middleware.js +11 -1
- package/dist/cjs/Http/Middleware.js.map +1 -1
- package/dist/cjs/Http/Multiplex.js.map +1 -1
- package/dist/cjs/Http/Router.js.map +1 -1
- package/dist/cjs/Http/UrlParams.js +13 -13
- package/dist/cjs/Http/UrlParams.js.map +1 -1
- package/dist/cjs/PlatformConfigProvider.js +2 -2
- package/dist/cjs/PlatformConfigProvider.js.map +1 -1
- package/dist/cjs/Socket.js +6 -6
- package/dist/cjs/Socket.js.map +1 -1
- package/dist/cjs/Template.js.map +1 -1
- package/dist/cjs/Transferable.js +1 -1
- package/dist/cjs/Transferable.js.map +1 -1
- package/dist/cjs/WorkerRunner.js.map +1 -1
- package/dist/cjs/internal/command.js +1 -1
- package/dist/cjs/internal/command.js.map +1 -1
- package/dist/cjs/internal/fileSystem.js +2 -2
- package/dist/cjs/internal/fileSystem.js.map +1 -1
- package/dist/cjs/internal/http/client.js +19 -16
- package/dist/cjs/internal/http/client.js.map +1 -1
- package/dist/cjs/internal/http/clientResponse.js +5 -5
- package/dist/cjs/internal/http/clientResponse.js.map +1 -1
- package/dist/cjs/internal/http/middleware.js +8 -3
- package/dist/cjs/internal/http/middleware.js.map +1 -1
- package/dist/cjs/internal/http/multipart.js +4 -4
- package/dist/cjs/internal/http/multipart.js.map +1 -1
- package/dist/cjs/internal/http/multiplex.js +2 -2
- package/dist/cjs/internal/http/multiplex.js.map +1 -1
- package/dist/cjs/internal/http/router.js +2 -1
- package/dist/cjs/internal/http/router.js.map +1 -1
- package/dist/cjs/internal/worker.js +7 -7
- package/dist/cjs/internal/worker.js.map +1 -1
- package/dist/cjs/internal/workerRunner.js +14 -13
- package/dist/cjs/internal/workerRunner.js.map +1 -1
- package/dist/dts/Command.d.ts +3 -3
- package/dist/dts/Command.d.ts.map +1 -1
- package/dist/dts/FileSystem.d.ts +11 -0
- package/dist/dts/FileSystem.d.ts.map +1 -1
- package/dist/dts/Http/App.d.ts +7 -7
- package/dist/dts/Http/App.d.ts.map +1 -1
- package/dist/dts/Http/Client.d.ts +78 -65
- package/dist/dts/Http/Client.d.ts.map +1 -1
- package/dist/dts/Http/ClientResponse.d.ts +5 -5
- package/dist/dts/Http/Cookies.d.ts +3 -3
- package/dist/dts/Http/Cookies.d.ts.map +1 -1
- package/dist/dts/Http/Headers.d.ts +4 -4
- package/dist/dts/Http/Headers.d.ts.map +1 -1
- package/dist/dts/Http/IncomingMessage.d.ts +4 -3
- package/dist/dts/Http/IncomingMessage.d.ts.map +1 -1
- package/dist/dts/Http/Middleware.d.ts +22 -5
- package/dist/dts/Http/Middleware.d.ts.map +1 -1
- package/dist/dts/Http/Multiplex.d.ts +22 -22
- package/dist/dts/Http/Multiplex.d.ts.map +1 -1
- package/dist/dts/Http/Router.d.ts +80 -80
- package/dist/dts/Http/Router.d.ts.map +1 -1
- package/dist/dts/Http/Server.d.ts +11 -11
- package/dist/dts/Http/Server.d.ts.map +1 -1
- package/dist/dts/Http/ServerRequest.d.ts +1 -1
- package/dist/dts/Http/ServerRequest.d.ts.map +1 -1
- package/dist/dts/Http/TraceContext.d.ts.map +1 -1
- package/dist/dts/Http/UrlParams.d.ts.map +1 -1
- package/dist/dts/PlatformConfigProvider.d.ts.map +1 -1
- package/dist/dts/Socket.d.ts +10 -10
- package/dist/dts/Socket.d.ts.map +1 -1
- package/dist/dts/Template.d.ts.map +1 -1
- package/dist/dts/Transferable.d.ts.map +1 -1
- package/dist/dts/Worker.d.ts +6 -6
- package/dist/dts/Worker.d.ts.map +1 -1
- package/dist/dts/WorkerRunner.d.ts +5 -5
- package/dist/dts/WorkerRunner.d.ts.map +1 -1
- package/dist/dts/internal/http/router.d.ts +1 -1
- package/dist/dts/internal/http/router.d.ts.map +1 -1
- package/dist/esm/FileSystem.js +6 -0
- package/dist/esm/FileSystem.js.map +1 -1
- package/dist/esm/Http/App.js +9 -7
- package/dist/esm/Http/App.js.map +1 -1
- package/dist/esm/Http/Client.js +12 -2
- package/dist/esm/Http/Client.js.map +1 -1
- package/dist/esm/Http/ClientResponse.js +5 -5
- package/dist/esm/Http/ClientResponse.js.map +1 -1
- package/dist/esm/Http/Cookies.js +7 -7
- package/dist/esm/Http/Cookies.js.map +1 -1
- package/dist/esm/Http/Headers.js +7 -7
- package/dist/esm/Http/Headers.js.map +1 -1
- package/dist/esm/Http/IncomingMessage.js +3 -3
- package/dist/esm/Http/IncomingMessage.js.map +1 -1
- package/dist/esm/Http/Middleware.js +10 -0
- package/dist/esm/Http/Middleware.js.map +1 -1
- package/dist/esm/Http/Multiplex.js.map +1 -1
- package/dist/esm/Http/Router.js.map +1 -1
- package/dist/esm/Http/UrlParams.js +13 -13
- package/dist/esm/Http/UrlParams.js.map +1 -1
- package/dist/esm/PlatformConfigProvider.js +2 -2
- package/dist/esm/PlatformConfigProvider.js.map +1 -1
- package/dist/esm/Socket.js +6 -6
- package/dist/esm/Socket.js.map +1 -1
- package/dist/esm/Template.js.map +1 -1
- package/dist/esm/Transferable.js +1 -1
- package/dist/esm/Transferable.js.map +1 -1
- package/dist/esm/WorkerRunner.js.map +1 -1
- package/dist/esm/internal/command.js +1 -1
- package/dist/esm/internal/command.js.map +1 -1
- package/dist/esm/internal/fileSystem.js +2 -2
- package/dist/esm/internal/fileSystem.js.map +1 -1
- package/dist/esm/internal/http/client.js +18 -13
- package/dist/esm/internal/http/client.js.map +1 -1
- package/dist/esm/internal/http/clientResponse.js +2 -2
- package/dist/esm/internal/http/clientResponse.js.map +1 -1
- package/dist/esm/internal/http/middleware.js +7 -2
- package/dist/esm/internal/http/middleware.js.map +1 -1
- package/dist/esm/internal/http/multipart.js +4 -4
- package/dist/esm/internal/http/multipart.js.map +1 -1
- package/dist/esm/internal/http/multiplex.js +2 -2
- package/dist/esm/internal/http/multiplex.js.map +1 -1
- package/dist/esm/internal/http/router.js +2 -1
- package/dist/esm/internal/http/router.js.map +1 -1
- package/dist/esm/internal/worker.js +7 -7
- package/dist/esm/internal/worker.js.map +1 -1
- package/dist/esm/internal/workerRunner.js +14 -13
- package/dist/esm/internal/workerRunner.js.map +1 -1
- package/package.json +3 -3
- package/src/Command.ts +3 -3
- package/src/FileSystem.ts +13 -0
- package/src/Http/App.ts +21 -17
- package/src/Http/Client.ts +105 -90
- package/src/Http/ClientResponse.ts +7 -7
- package/src/Http/Cookies.ts +9 -9
- package/src/Http/Headers.ts +13 -13
- package/src/Http/IncomingMessage.ts +16 -6
- package/src/Http/Middleware.ts +30 -6
- package/src/Http/Multiplex.ts +38 -38
- package/src/Http/Router.ts +136 -134
- package/src/Http/Server.ts +16 -16
- package/src/Http/ServerRequest.ts +1 -1
- package/src/Http/UrlParams.ts +15 -15
- package/src/PlatformConfigProvider.ts +2 -2
- package/src/Socket.ts +6 -6
- package/src/Template.ts +4 -5
- package/src/Transferable.ts +1 -1
- package/src/Worker.ts +9 -9
- package/src/WorkerRunner.ts +5 -4
- package/src/internal/command.ts +12 -6
- package/src/internal/fileSystem.ts +2 -2
- package/src/internal/http/client.ts +221 -204
- package/src/internal/http/clientResponse.ts +2 -2
- package/src/internal/http/middleware.ts +24 -1
- package/src/internal/http/multipart.ts +4 -4
- package/src/internal/http/multiplex.ts +54 -54
- package/src/internal/http/router.ts +121 -104
- package/src/internal/http/server.ts +17 -17
- package/src/internal/http/serverRequest.ts +1 -1
- package/src/internal/worker.ts +14 -14
- package/src/internal/workerRunner.ts +20 -16
|
@@ -217,7 +217,7 @@ export const stream = <E, R>(effect: Effect.Effect<ClientResponse.ClientResponse
|
|
|
217
217
|
Stream.unwrapScoped(Effect.map(effect, (_) => _.stream))
|
|
218
218
|
|
|
219
219
|
/** @internal */
|
|
220
|
-
export const
|
|
220
|
+
export const schemaJsonScoped = <
|
|
221
221
|
R,
|
|
222
222
|
I extends {
|
|
223
223
|
readonly status?: number | undefined
|
|
@@ -232,7 +232,7 @@ export const schemaJsonEffect = <
|
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
/** @internal */
|
|
235
|
-
export const
|
|
235
|
+
export const schemaNoBodyScoped = <
|
|
236
236
|
R,
|
|
237
237
|
I extends {
|
|
238
238
|
readonly status?: number | undefined
|
|
@@ -4,6 +4,7 @@ import * as Effect from "effect/Effect"
|
|
|
4
4
|
import * as FiberRef from "effect/FiberRef"
|
|
5
5
|
import { constFalse, dual } from "effect/Function"
|
|
6
6
|
import { globalValue } from "effect/GlobalValue"
|
|
7
|
+
import * as Layer from "effect/Layer"
|
|
7
8
|
import * as Option from "effect/Option"
|
|
8
9
|
import type * as Predicate from "effect/Predicate"
|
|
9
10
|
import * as Headers from "../../Http/Headers.js"
|
|
@@ -36,6 +37,17 @@ export const currentTracerDisabledWhen = globalValue(
|
|
|
36
37
|
|
|
37
38
|
/** @internal */
|
|
38
39
|
export const withTracerDisabledWhen = dual<
|
|
40
|
+
(
|
|
41
|
+
predicate: Predicate.Predicate<ServerRequest.ServerRequest>
|
|
42
|
+
) => <R, E, A>(layer: Layer.Layer<A, E, R>) => Layer.Layer<A, E, R>,
|
|
43
|
+
<R, E, A>(
|
|
44
|
+
layer: Layer.Layer<A, E, R>,
|
|
45
|
+
predicate: Predicate.Predicate<ServerRequest.ServerRequest>
|
|
46
|
+
) => Layer.Layer<A, E, R>
|
|
47
|
+
>(2, (self, pred) => Layer.locally(self, currentTracerDisabledWhen, pred))
|
|
48
|
+
|
|
49
|
+
/** @internal */
|
|
50
|
+
export const withTracerDisabledWhenEffect = dual<
|
|
39
51
|
(
|
|
40
52
|
predicate: Predicate.Predicate<ServerRequest.ServerRequest>
|
|
41
53
|
) => <R, E, A>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>,
|
|
@@ -45,6 +57,17 @@ export const withTracerDisabledWhen = dual<
|
|
|
45
57
|
) => Effect.Effect<A, E, R>
|
|
46
58
|
>(2, (self, pred) => Effect.locally(self, currentTracerDisabledWhen, pred))
|
|
47
59
|
|
|
60
|
+
/** @internal */
|
|
61
|
+
export const withTracerDisabledForUrls = dual<
|
|
62
|
+
(
|
|
63
|
+
urls: ReadonlyArray<string>
|
|
64
|
+
) => <R, E, A>(layer: Layer.Layer<A, E, R>) => Layer.Layer<A, E, R>,
|
|
65
|
+
<R, E, A>(
|
|
66
|
+
layer: Layer.Layer<A, E, R>,
|
|
67
|
+
urls: ReadonlyArray<string>
|
|
68
|
+
) => Layer.Layer<A, E, R>
|
|
69
|
+
>(2, (self, urls) => Layer.locally(self, currentTracerDisabledWhen, (req) => urls.includes(req.url)))
|
|
70
|
+
|
|
48
71
|
/** @internal */
|
|
49
72
|
export const logger = make((httpApp) => {
|
|
50
73
|
let counter = 0
|
|
@@ -54,7 +77,7 @@ export const logger = make((httpApp) => {
|
|
|
54
77
|
return Effect.withLogSpan(
|
|
55
78
|
Effect.onExit(httpApp, (exit) => {
|
|
56
79
|
if (fiber.getFiberRef(loggerDisabled)) {
|
|
57
|
-
return Effect.
|
|
80
|
+
return Effect.void
|
|
58
81
|
}
|
|
59
82
|
return exit._tag === "Failure" ?
|
|
60
83
|
Effect.annotateLogs(Effect.log(exit.cause), {
|
|
@@ -214,7 +214,7 @@ const makeFromQueue = <IE>(
|
|
|
214
214
|
let partsFinished = false
|
|
215
215
|
|
|
216
216
|
const input: AsyncInput.AsyncInputProducer<IE, Chunk.Chunk<Uint8Array>, unknown> = {
|
|
217
|
-
awaitRead: () => Effect.
|
|
217
|
+
awaitRead: () => Effect.void,
|
|
218
218
|
emit(element) {
|
|
219
219
|
return Queue.offer(queue, element)
|
|
220
220
|
},
|
|
@@ -238,7 +238,7 @@ const makeFromQueue = <IE>(
|
|
|
238
238
|
const take: Channel.Channel<Chunk.Chunk<Uint8Array>, unknown, never, unknown, void, unknown> = Channel
|
|
239
239
|
.suspend(() => {
|
|
240
240
|
if (chunks.length === 0) {
|
|
241
|
-
return finished ? Channel.
|
|
241
|
+
return finished ? Channel.void : Channel.zipRight(pump, take)
|
|
242
242
|
}
|
|
243
243
|
const chunk = Chunk.unsafeFromArray(chunks)
|
|
244
244
|
chunks = []
|
|
@@ -282,7 +282,7 @@ const makeFromQueue = <IE>(
|
|
|
282
282
|
pump,
|
|
283
283
|
Channel.suspend(() => {
|
|
284
284
|
if (partsBuffer.length === 0) {
|
|
285
|
-
return Channel.
|
|
285
|
+
return Channel.void
|
|
286
286
|
}
|
|
287
287
|
const parts = Chunk.unsafeFromArray(partsBuffer)
|
|
288
288
|
partsBuffer = []
|
|
@@ -301,7 +301,7 @@ const makeFromQueue = <IE>(
|
|
|
301
301
|
if (error._tag === "Some") {
|
|
302
302
|
return Channel.failCause(error.value)
|
|
303
303
|
} else if (partsFinished) {
|
|
304
|
-
return Channel.
|
|
304
|
+
return Channel.void
|
|
305
305
|
}
|
|
306
306
|
return Channel.zipRight(takeParts, partsChannel)
|
|
307
307
|
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import * as Arr from "effect/Array"
|
|
1
2
|
import * as Effect from "effect/Effect"
|
|
2
3
|
import * as Effectable from "effect/Effectable"
|
|
3
4
|
import { dual } from "effect/Function"
|
|
4
5
|
import * as Inspectable from "effect/Inspectable"
|
|
5
|
-
import * as ReadonlyArray from "effect/ReadonlyArray"
|
|
6
6
|
import type * as App from "../../Http/App.js"
|
|
7
7
|
import type * as Multiplex from "../../Http/Multiplex.js"
|
|
8
8
|
import * as Error from "../../Http/ServerError.js"
|
|
@@ -12,9 +12,9 @@ import type * as ServerResponse from "../../Http/ServerResponse.js"
|
|
|
12
12
|
/** @internal */
|
|
13
13
|
export const TypeId: Multiplex.TypeId = Symbol.for("@effect/platform/Http/Multiplex") as Multiplex.TypeId
|
|
14
14
|
|
|
15
|
-
class MultiplexImpl<
|
|
15
|
+
class MultiplexImpl<E = never, R = never>
|
|
16
16
|
extends Effectable.Class<ServerResponse.ServerResponse, E | Error.RouteNotFound, R | ServerRequest.ServerRequest>
|
|
17
|
-
implements Multiplex.Multiplex<
|
|
17
|
+
implements Multiplex.Multiplex<E, R>
|
|
18
18
|
{
|
|
19
19
|
readonly [TypeId]: Multiplex.TypeId
|
|
20
20
|
|
|
@@ -22,14 +22,14 @@ class MultiplexImpl<R, E>
|
|
|
22
22
|
readonly apps: ReadonlyArray<
|
|
23
23
|
readonly [
|
|
24
24
|
predicate: (request: ServerRequest.ServerRequest) => Effect.Effect<boolean, E, R>,
|
|
25
|
-
app: App.Default<
|
|
25
|
+
app: App.Default<E, R>
|
|
26
26
|
]
|
|
27
27
|
>
|
|
28
28
|
) {
|
|
29
29
|
super()
|
|
30
30
|
this[TypeId] = TypeId
|
|
31
31
|
|
|
32
|
-
let execute: (request: ServerRequest.ServerRequest) => App.Default<
|
|
32
|
+
let execute: (request: ServerRequest.ServerRequest) => App.Default<E | Error.RouteNotFound, R> = (request) =>
|
|
33
33
|
Effect.fail(new Error.RouteNotFound({ request }))
|
|
34
34
|
|
|
35
35
|
for (let i = apps.length - 1; i >= 0; i--) {
|
|
@@ -45,7 +45,7 @@ class MultiplexImpl<R, E>
|
|
|
45
45
|
this.execute = Effect.flatMap(ServerRequest.ServerRequest, execute)
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
execute: App.Default<
|
|
48
|
+
execute: App.Default<E | Error.RouteNotFound, R>
|
|
49
49
|
|
|
50
50
|
commit() {
|
|
51
51
|
return this.execute
|
|
@@ -65,26 +65,26 @@ class MultiplexImpl<R, E>
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
/** @internal */
|
|
68
|
-
export const empty: Multiplex.Multiplex<never
|
|
68
|
+
export const empty: Multiplex.Multiplex<never> = new MultiplexImpl([])
|
|
69
69
|
|
|
70
70
|
/** @internal */
|
|
71
71
|
export const make = <R, E>(
|
|
72
72
|
apps: Iterable<
|
|
73
|
-
readonly [predicate: (request: ServerRequest.ServerRequest) => Effect.Effect<boolean, E, R>, app: App.Default<
|
|
73
|
+
readonly [predicate: (request: ServerRequest.ServerRequest) => Effect.Effect<boolean, E, R>, app: App.Default<E, R>]
|
|
74
74
|
>
|
|
75
|
-
): Multiplex.Multiplex<
|
|
75
|
+
): Multiplex.Multiplex<E, R> => new MultiplexImpl(Arr.fromIterable(apps))
|
|
76
76
|
|
|
77
77
|
/** @internal */
|
|
78
78
|
export const add = dual<
|
|
79
79
|
<R2, E2, R3, E3>(
|
|
80
80
|
predicate: (request: ServerRequest.ServerRequest) => Effect.Effect<boolean, E2, R2>,
|
|
81
|
-
app: App.Default<
|
|
82
|
-
) => <R, E>(self: Multiplex.Multiplex<
|
|
81
|
+
app: App.Default<E3, R3>
|
|
82
|
+
) => <R, E>(self: Multiplex.Multiplex<E, R>) => Multiplex.Multiplex<E | E2 | E3, R | R2 | R3>,
|
|
83
83
|
<R, E, R2, E2, R3, E3>(
|
|
84
|
-
self: Multiplex.Multiplex<
|
|
84
|
+
self: Multiplex.Multiplex<E, R>,
|
|
85
85
|
predicate: (request: ServerRequest.ServerRequest) => Effect.Effect<boolean, E2, R2>,
|
|
86
|
-
app: App.Default<
|
|
87
|
-
) => Multiplex.Multiplex<
|
|
86
|
+
app: App.Default<E3, R3>
|
|
87
|
+
) => Multiplex.Multiplex<E | E2 | E3, R | R2 | R3>
|
|
88
88
|
>(
|
|
89
89
|
3,
|
|
90
90
|
(self, predicate, app) =>
|
|
@@ -99,14 +99,14 @@ export const headerExact = dual<
|
|
|
99
99
|
<R2, E2>(
|
|
100
100
|
header: string,
|
|
101
101
|
value: string,
|
|
102
|
-
app: App.Default<
|
|
103
|
-
) => <R, E>(self: Multiplex.Multiplex<
|
|
102
|
+
app: App.Default<E2, R2>
|
|
103
|
+
) => <R, E>(self: Multiplex.Multiplex<E, R>) => Multiplex.Multiplex<E | E2, R | R2>,
|
|
104
104
|
<R, E, R2, E2>(
|
|
105
|
-
self: Multiplex.Multiplex<
|
|
105
|
+
self: Multiplex.Multiplex<E, R>,
|
|
106
106
|
header: string,
|
|
107
107
|
value: string,
|
|
108
|
-
app: App.Default<
|
|
109
|
-
) => Multiplex.Multiplex<
|
|
108
|
+
app: App.Default<E2, R2>
|
|
109
|
+
) => Multiplex.Multiplex<E | E2, R | R2>
|
|
110
110
|
>(
|
|
111
111
|
4,
|
|
112
112
|
(self, header, value, app) =>
|
|
@@ -121,14 +121,14 @@ export const headerRegex = dual<
|
|
|
121
121
|
<R2, E2>(
|
|
122
122
|
header: string,
|
|
123
123
|
regex: RegExp,
|
|
124
|
-
app: App.Default<
|
|
125
|
-
) => <R, E>(self: Multiplex.Multiplex<
|
|
124
|
+
app: App.Default<E2, R2>
|
|
125
|
+
) => <R, E>(self: Multiplex.Multiplex<E, R>) => Multiplex.Multiplex<E | E2, R | R2>,
|
|
126
126
|
<R, E, R2, E2>(
|
|
127
|
-
self: Multiplex.Multiplex<
|
|
127
|
+
self: Multiplex.Multiplex<E, R>,
|
|
128
128
|
header: string,
|
|
129
129
|
regex: RegExp,
|
|
130
|
-
app: App.Default<
|
|
131
|
-
) => Multiplex.Multiplex<
|
|
130
|
+
app: App.Default<E2, R2>
|
|
131
|
+
) => Multiplex.Multiplex<E | E2, R | R2>
|
|
132
132
|
>(
|
|
133
133
|
4,
|
|
134
134
|
(self, header, regex, app) =>
|
|
@@ -143,14 +143,14 @@ export const headerStartsWith = dual<
|
|
|
143
143
|
<R2, E2>(
|
|
144
144
|
header: string,
|
|
145
145
|
prefix: string,
|
|
146
|
-
app: App.Default<
|
|
147
|
-
) => <R, E>(self: Multiplex.Multiplex<
|
|
146
|
+
app: App.Default<E2, R2>
|
|
147
|
+
) => <R, E>(self: Multiplex.Multiplex<E, R>) => Multiplex.Multiplex<E | E2, R | R2>,
|
|
148
148
|
<R, E, R2, E2>(
|
|
149
|
-
self: Multiplex.Multiplex<
|
|
149
|
+
self: Multiplex.Multiplex<E, R>,
|
|
150
150
|
header: string,
|
|
151
151
|
prefix: string,
|
|
152
|
-
app: App.Default<
|
|
153
|
-
) => Multiplex.Multiplex<
|
|
152
|
+
app: App.Default<E2, R2>
|
|
153
|
+
) => Multiplex.Multiplex<E | E2, R | R2>
|
|
154
154
|
>(
|
|
155
155
|
4,
|
|
156
156
|
(self, header, prefix, app) =>
|
|
@@ -165,14 +165,14 @@ export const headerEndsWith = dual<
|
|
|
165
165
|
<R2, E2>(
|
|
166
166
|
header: string,
|
|
167
167
|
suffix: string,
|
|
168
|
-
app: App.Default<
|
|
169
|
-
) => <R, E>(self: Multiplex.Multiplex<
|
|
168
|
+
app: App.Default<E2, R2>
|
|
169
|
+
) => <R, E>(self: Multiplex.Multiplex<E, R>) => Multiplex.Multiplex<E | E2, R | R2>,
|
|
170
170
|
<R, E, R2, E2>(
|
|
171
|
-
self: Multiplex.Multiplex<
|
|
171
|
+
self: Multiplex.Multiplex<E, R>,
|
|
172
172
|
header: string,
|
|
173
173
|
suffix: string,
|
|
174
|
-
app: App.Default<
|
|
175
|
-
) => Multiplex.Multiplex<
|
|
174
|
+
app: App.Default<E2, R2>
|
|
175
|
+
) => Multiplex.Multiplex<E | E2, R | R2>
|
|
176
176
|
>(
|
|
177
177
|
4,
|
|
178
178
|
(self, header, suffix, app) =>
|
|
@@ -186,50 +186,50 @@ export const headerEndsWith = dual<
|
|
|
186
186
|
export const hostRegex = dual<
|
|
187
187
|
<R2, E2>(
|
|
188
188
|
regex: RegExp,
|
|
189
|
-
app: App.Default<
|
|
190
|
-
) => <R, E>(self: Multiplex.Multiplex<
|
|
189
|
+
app: App.Default<E2, R2>
|
|
190
|
+
) => <R, E>(self: Multiplex.Multiplex<E, R>) => Multiplex.Multiplex<E | E2, R | R2>,
|
|
191
191
|
<R, E, R2, E2>(
|
|
192
|
-
self: Multiplex.Multiplex<
|
|
192
|
+
self: Multiplex.Multiplex<E, R>,
|
|
193
193
|
regex: RegExp,
|
|
194
|
-
app: App.Default<
|
|
195
|
-
) => Multiplex.Multiplex<
|
|
194
|
+
app: App.Default<E2, R2>
|
|
195
|
+
) => Multiplex.Multiplex<E | E2, R | R2>
|
|
196
196
|
>(3, (self, regex, app) => headerRegex(self, "host", regex, app))
|
|
197
197
|
|
|
198
198
|
/** @internal */
|
|
199
199
|
export const hostStartsWith = dual<
|
|
200
200
|
<R2, E2>(
|
|
201
201
|
prefix: string,
|
|
202
|
-
app: App.Default<
|
|
203
|
-
) => <R, E>(self: Multiplex.Multiplex<
|
|
202
|
+
app: App.Default<E2, R2>
|
|
203
|
+
) => <R, E>(self: Multiplex.Multiplex<E, R>) => Multiplex.Multiplex<E | E2, R | R2>,
|
|
204
204
|
<R, E, R2, E2>(
|
|
205
|
-
self: Multiplex.Multiplex<
|
|
205
|
+
self: Multiplex.Multiplex<E, R>,
|
|
206
206
|
prefix: string,
|
|
207
|
-
app: App.Default<
|
|
208
|
-
) => Multiplex.Multiplex<
|
|
207
|
+
app: App.Default<E2, R2>
|
|
208
|
+
) => Multiplex.Multiplex<E | E2, R | R2>
|
|
209
209
|
>(3, (self, prefix, app) => headerStartsWith(self, "host", prefix, app))
|
|
210
210
|
|
|
211
211
|
/** @internal */
|
|
212
212
|
export const hostEndsWith = dual<
|
|
213
213
|
<R2, E2>(
|
|
214
214
|
suffix: string,
|
|
215
|
-
app: App.Default<
|
|
216
|
-
) => <R, E>(self: Multiplex.Multiplex<
|
|
215
|
+
app: App.Default<E2, R2>
|
|
216
|
+
) => <R, E>(self: Multiplex.Multiplex<E, R>) => Multiplex.Multiplex<E | E2, R | R2>,
|
|
217
217
|
<R, E, R2, E2>(
|
|
218
|
-
self: Multiplex.Multiplex<
|
|
218
|
+
self: Multiplex.Multiplex<E, R>,
|
|
219
219
|
suffix: string,
|
|
220
|
-
app: App.Default<
|
|
221
|
-
) => Multiplex.Multiplex<
|
|
220
|
+
app: App.Default<E2, R2>
|
|
221
|
+
) => Multiplex.Multiplex<E | E2, R | R2>
|
|
222
222
|
>(3, (self, suffix, app) => headerEndsWith(self, "host", suffix, app))
|
|
223
223
|
|
|
224
224
|
/** @internal */
|
|
225
225
|
export const hostExact = dual<
|
|
226
226
|
<R2, E2>(
|
|
227
227
|
host: string,
|
|
228
|
-
app: App.Default<
|
|
229
|
-
) => <R, E>(self: Multiplex.Multiplex<
|
|
228
|
+
app: App.Default<E2, R2>
|
|
229
|
+
) => <R, E>(self: Multiplex.Multiplex<E, R>) => Multiplex.Multiplex<E | E2, R | R2>,
|
|
230
230
|
<R, E, R2, E2>(
|
|
231
|
-
self: Multiplex.Multiplex<
|
|
231
|
+
self: Multiplex.Multiplex<E, R>,
|
|
232
232
|
host: string,
|
|
233
|
-
app: App.Default<
|
|
234
|
-
) => Multiplex.Multiplex<
|
|
233
|
+
app: App.Default<E2, R2>
|
|
234
|
+
) => Multiplex.Multiplex<E | E2, R | R2>
|
|
235
235
|
>(3, (self, host, app) => headerExact(self, "host", host, app))
|