@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.
- package/dist/cjs/Error.js +4 -0
- package/dist/cjs/Error.js.map +1 -1
- package/dist/cjs/Http/App.js.map +1 -1
- package/dist/cjs/Http/Body.js.map +1 -1
- package/dist/cjs/Http/Client.js.map +1 -1
- package/dist/cjs/Http/ClientError.js +4 -0
- package/dist/cjs/Http/ClientError.js.map +1 -1
- package/dist/cjs/Http/ClientResponse.js.map +1 -1
- package/dist/cjs/Http/IncomingMessage.js.map +1 -1
- package/dist/cjs/Http/Multipart.js.map +1 -1
- package/dist/cjs/Http/Server.js +26 -1
- package/dist/cjs/Http/Server.js.map +1 -1
- package/dist/cjs/Http/ServerError.js.map +1 -1
- package/dist/cjs/Http/ServerResponse.js.map +1 -1
- package/dist/cjs/HttpServer.js +7 -1
- package/dist/cjs/HttpServer.js.map +1 -1
- package/dist/cjs/KeyValueStore.js.map +1 -1
- package/dist/cjs/Path.js.map +1 -1
- package/dist/cjs/Transferable.js +51 -48
- package/dist/cjs/Transferable.js.map +1 -1
- package/dist/cjs/Worker.js +6 -1
- package/dist/cjs/Worker.js.map +1 -1
- package/dist/cjs/WorkerError.js +4 -0
- package/dist/cjs/WorkerError.js.map +1 -1
- package/dist/cjs/index.js +62 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/internal/commandExecutor.js +1 -1
- package/dist/cjs/internal/commandExecutor.js.map +1 -1
- package/dist/cjs/internal/effectify.js.map +1 -1
- package/dist/cjs/internal/fileSystem.js +1 -1
- package/dist/cjs/internal/fileSystem.js.map +1 -1
- package/dist/cjs/internal/http/body.js.map +1 -1
- package/dist/cjs/internal/http/client.js +2 -2
- package/dist/cjs/internal/http/client.js.map +1 -1
- package/dist/cjs/internal/http/etag.js +1 -1
- package/dist/cjs/internal/http/etag.js.map +1 -1
- package/dist/cjs/internal/http/multipart.js.map +1 -1
- package/dist/cjs/internal/http/platform.js +1 -1
- package/dist/cjs/internal/http/platform.js.map +1 -1
- package/dist/cjs/internal/http/router.js +1 -1
- package/dist/cjs/internal/http/router.js.map +1 -1
- package/dist/cjs/internal/http/server.js +23 -2
- package/dist/cjs/internal/http/server.js.map +1 -1
- package/dist/cjs/internal/http/serverRequest.js +1 -1
- package/dist/cjs/internal/http/serverRequest.js.map +1 -1
- package/dist/cjs/internal/http/serverResponse.js.map +1 -1
- package/dist/cjs/internal/keyValueStore.js +2 -2
- package/dist/cjs/internal/keyValueStore.js.map +1 -1
- package/dist/cjs/internal/path.js +9 -4
- package/dist/cjs/internal/path.js.map +1 -1
- package/dist/cjs/internal/terminal.js +1 -1
- package/dist/cjs/internal/terminal.js.map +1 -1
- package/dist/cjs/internal/worker.js +16 -12
- package/dist/cjs/internal/worker.js.map +1 -1
- package/dist/cjs/internal/workerError.js.map +1 -1
- package/dist/cjs/internal/workerRunner.js +15 -12
- package/dist/cjs/internal/workerRunner.js.map +1 -1
- package/dist/dts/Command.d.ts +9 -9
- package/dist/dts/Command.d.ts.map +1 -1
- package/dist/dts/CommandExecutor.d.ts +13 -13
- package/dist/dts/CommandExecutor.d.ts.map +1 -1
- package/dist/dts/Effectify.d.ts +55 -55
- package/dist/dts/Effectify.d.ts.map +1 -1
- package/dist/dts/Error.d.ts +2 -6
- package/dist/dts/Error.d.ts.map +1 -1
- package/dist/dts/FileSystem.d.ts +35 -35
- package/dist/dts/FileSystem.d.ts.map +1 -1
- package/dist/dts/Http/App.d.ts +5 -5
- package/dist/dts/Http/App.d.ts.map +1 -1
- package/dist/dts/Http/Body.d.ts +10 -11
- package/dist/dts/Http/Body.d.ts.map +1 -1
- package/dist/dts/Http/Client.d.ts +32 -32
- package/dist/dts/Http/Client.d.ts.map +1 -1
- package/dist/dts/Http/ClientError.d.ts +2 -6
- package/dist/dts/Http/ClientError.d.ts.map +1 -1
- package/dist/dts/Http/ClientRequest.d.ts +16 -16
- package/dist/dts/Http/ClientRequest.d.ts.map +1 -1
- package/dist/dts/Http/ClientResponse.d.ts +3 -3
- package/dist/dts/Http/ClientResponse.d.ts.map +1 -1
- package/dist/dts/Http/Etag.d.ts +2 -2
- package/dist/dts/Http/Etag.d.ts.map +1 -1
- package/dist/dts/Http/IncomingMessage.d.ts +10 -10
- package/dist/dts/Http/IncomingMessage.d.ts.map +1 -1
- package/dist/dts/Http/Middleware.d.ts +3 -3
- package/dist/dts/Http/Multipart.d.ts +18 -19
- package/dist/dts/Http/Multipart.d.ts.map +1 -1
- package/dist/dts/Http/Multiplex.d.ts +4 -4
- package/dist/dts/Http/Multiplex.d.ts.map +1 -1
- package/dist/dts/Http/Platform.d.ts +3 -3
- package/dist/dts/Http/Platform.d.ts.map +1 -1
- package/dist/dts/Http/Router.d.ts +10 -10
- package/dist/dts/Http/Router.d.ts.map +1 -1
- package/dist/dts/Http/Server.d.ts +39 -14
- package/dist/dts/Http/Server.d.ts.map +1 -1
- package/dist/dts/Http/ServerError.d.ts +2 -3
- package/dist/dts/Http/ServerError.d.ts.map +1 -1
- package/dist/dts/Http/ServerRequest.d.ts +9 -9
- package/dist/dts/Http/ServerRequest.d.ts.map +1 -1
- package/dist/dts/Http/ServerResponse.d.ts +7 -7
- package/dist/dts/Http/ServerResponse.d.ts.map +1 -1
- package/dist/dts/Http/UrlParams.d.ts +4 -4
- package/dist/dts/HttpServer.d.ts +24 -0
- package/dist/dts/HttpServer.d.ts.map +1 -1
- package/dist/dts/KeyValueStore.d.ts +21 -21
- package/dist/dts/KeyValueStore.d.ts.map +1 -1
- package/dist/dts/Path.d.ts +3 -3
- package/dist/dts/Path.d.ts.map +1 -1
- package/dist/dts/Runtime.d.ts +1 -1
- package/dist/dts/Runtime.d.ts.map +1 -1
- package/dist/dts/Terminal.d.ts +5 -5
- package/dist/dts/Terminal.d.ts.map +1 -1
- package/dist/dts/Transferable.d.ts +35 -13
- package/dist/dts/Transferable.d.ts.map +1 -1
- package/dist/dts/Worker.d.ts +58 -41
- package/dist/dts/Worker.d.ts.map +1 -1
- package/dist/dts/WorkerError.d.ts +3 -7
- package/dist/dts/WorkerError.d.ts.map +1 -1
- package/dist/dts/WorkerRunner.d.ts +13 -13
- package/dist/dts/WorkerRunner.d.ts.map +1 -1
- package/dist/dts/index.d.ts +61 -0
- package/dist/dts/index.d.ts.map +1 -0
- package/dist/esm/Error.js +3 -0
- package/dist/esm/Error.js.map +1 -1
- package/dist/esm/Http/App.js.map +1 -1
- package/dist/esm/Http/Body.js.map +1 -1
- package/dist/esm/Http/Client.js.map +1 -1
- package/dist/esm/Http/ClientError.js +3 -0
- package/dist/esm/Http/ClientError.js.map +1 -1
- package/dist/esm/Http/ClientResponse.js.map +1 -1
- package/dist/esm/Http/IncomingMessage.js.map +1 -1
- package/dist/esm/Http/Multipart.js.map +1 -1
- package/dist/esm/Http/Server.js +25 -0
- package/dist/esm/Http/Server.js.map +1 -1
- package/dist/esm/Http/ServerError.js.map +1 -1
- package/dist/esm/Http/ServerResponse.js.map +1 -1
- package/dist/esm/HttpServer.js +24 -0
- package/dist/esm/HttpServer.js.map +1 -1
- package/dist/esm/KeyValueStore.js.map +1 -1
- package/dist/esm/Path.js.map +1 -1
- package/dist/esm/Transferable.js +48 -45
- package/dist/esm/Transferable.js.map +1 -1
- package/dist/esm/Worker.js +5 -0
- package/dist/esm/Worker.js.map +1 -1
- package/dist/esm/WorkerError.js +3 -0
- package/dist/esm/WorkerError.js.map +1 -1
- package/dist/esm/index.js +61 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/commandExecutor.js +2 -2
- package/dist/esm/internal/commandExecutor.js.map +1 -1
- package/dist/esm/internal/effectify.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/body.js.map +1 -1
- package/dist/esm/internal/http/client.js +2 -2
- package/dist/esm/internal/http/client.js.map +1 -1
- package/dist/esm/internal/http/etag.js +1 -1
- package/dist/esm/internal/http/etag.js.map +1 -1
- package/dist/esm/internal/http/multipart.js.map +1 -1
- package/dist/esm/internal/http/platform.js +1 -1
- package/dist/esm/internal/http/platform.js.map +1 -1
- package/dist/esm/internal/http/router.js +1 -1
- package/dist/esm/internal/http/router.js.map +1 -1
- package/dist/esm/internal/http/server.js +18 -1
- package/dist/esm/internal/http/server.js.map +1 -1
- package/dist/esm/internal/http/serverRequest.js +1 -1
- package/dist/esm/internal/http/serverRequest.js.map +1 -1
- package/dist/esm/internal/http/serverResponse.js.map +1 -1
- package/dist/esm/internal/keyValueStore.js +2 -2
- package/dist/esm/internal/keyValueStore.js.map +1 -1
- package/dist/esm/internal/path.js +3 -3
- package/dist/esm/internal/path.js.map +1 -1
- package/dist/esm/internal/terminal.js +2 -2
- package/dist/esm/internal/terminal.js.map +1 -1
- package/dist/esm/internal/worker.js +14 -11
- package/dist/esm/internal/worker.js.map +1 -1
- package/dist/esm/internal/workerError.js.map +1 -1
- package/dist/esm/internal/workerRunner.js +15 -12
- package/dist/esm/internal/workerRunner.js.map +1 -1
- package/package.json +11 -3
- package/src/Command.ts +9 -9
- package/src/CommandExecutor.ts +13 -13
- package/src/Effectify.ts +55 -55
- package/src/Error.ts +2 -3
- package/src/FileSystem.ts +35 -35
- package/src/Http/App.ts +5 -5
- package/src/Http/Body.ts +12 -13
- package/src/Http/Client.ts +37 -37
- package/src/Http/ClientError.ts +2 -3
- package/src/Http/ClientRequest.ts +17 -17
- package/src/Http/ClientResponse.ts +8 -5
- package/src/Http/Etag.ts +2 -2
- package/src/Http/IncomingMessage.ts +27 -23
- package/src/Http/Middleware.ts +4 -4
- package/src/Http/Multipart.ts +22 -25
- package/src/Http/Multiplex.ts +4 -4
- package/src/Http/Platform.ts +3 -3
- package/src/Http/Router.ts +16 -16
- package/src/Http/Server.ts +53 -18
- package/src/Http/ServerError.ts +2 -3
- package/src/Http/ServerRequest.ts +22 -22
- package/src/Http/ServerResponse.ts +9 -10
- package/src/Http/UrlParams.ts +6 -6
- package/src/HttpServer.ts +24 -0
- package/src/KeyValueStore.ts +23 -23
- package/src/Path.ts +3 -3
- package/src/Runtime.ts +1 -1
- package/src/Terminal.ts +4 -4
- package/src/Transferable.ts +88 -70
- package/src/Worker.ts +73 -57
- package/src/WorkerError.ts +3 -4
- package/src/WorkerRunner.ts +21 -21
- package/src/index.ts +74 -0
- package/src/internal/command.ts +7 -7
- package/src/internal/commandExecutor.ts +3 -3
- package/src/internal/effectify.ts +1 -1
- package/src/internal/fileSystem.ts +3 -3
- package/src/internal/http/body.ts +12 -12
- package/src/internal/http/client.ts +42 -46
- package/src/internal/http/clientRequest.ts +15 -15
- package/src/internal/http/clientResponse.ts +18 -18
- package/src/internal/http/etag.ts +1 -1
- package/src/internal/http/middleware.ts +4 -4
- package/src/internal/http/multipart.ts +32 -39
- package/src/internal/http/multiplex.ts +5 -5
- package/src/internal/http/platform.ts +2 -2
- package/src/internal/http/router.ts +14 -14
- package/src/internal/http/server.ts +60 -23
- package/src/internal/http/serverRequest.ts +24 -24
- package/src/internal/http/serverResponse.ts +11 -11
- package/src/internal/keyValueStore.ts +7 -7
- package/src/internal/path.ts +4 -4
- package/src/internal/terminal.ts +2 -2
- package/src/internal/worker.ts +55 -39
- package/src/internal/workerError.ts +1 -1
- package/src/internal/workerRunner.ts +55 -30
|
@@ -40,8 +40,8 @@ class RawImpl implements Body.Raw {
|
|
|
40
40
|
readonly _tag = "Raw"
|
|
41
41
|
constructor(
|
|
42
42
|
readonly body: unknown,
|
|
43
|
-
readonly contentType?: string,
|
|
44
|
-
readonly contentLength?: number
|
|
43
|
+
readonly contentType?: string | undefined,
|
|
44
|
+
readonly contentLength?: number | undefined
|
|
45
45
|
) {
|
|
46
46
|
this[TypeId] = TypeId
|
|
47
47
|
}
|
|
@@ -79,7 +79,7 @@ export const text = (body: string, contentType?: string): Body.Uint8Array =>
|
|
|
79
79
|
export const unsafeJson = (body: unknown): Body.Uint8Array => text(JSON.stringify(body), "application/json")
|
|
80
80
|
|
|
81
81
|
/** @internal */
|
|
82
|
-
export const json = (body: unknown): Effect.Effect<
|
|
82
|
+
export const json = (body: unknown): Effect.Effect<Body.Uint8Array, Body.BodyError> =>
|
|
83
83
|
Effect.try({
|
|
84
84
|
try: () => unsafeJson(body),
|
|
85
85
|
catch: (error) => BodyError({ _tag: "JsonError", error })
|
|
@@ -90,9 +90,9 @@ export const urlParams = (urlParams: UrlParams.UrlParams): Body.Uint8Array =>
|
|
|
90
90
|
text(UrlParams.toString(urlParams), "application/x-www-form-urlencoded")
|
|
91
91
|
|
|
92
92
|
/** @internal */
|
|
93
|
-
export const jsonSchema = <
|
|
93
|
+
export const jsonSchema = <A, I, R>(schema: Schema.Schema<A, I, R>) => {
|
|
94
94
|
const encode = Schema.encode(schema)
|
|
95
|
-
return (body: A): Effect.Effect<
|
|
95
|
+
return (body: A): Effect.Effect<Body.Uint8Array, Body.BodyError, R> =>
|
|
96
96
|
Effect.flatMap(
|
|
97
97
|
Effect.mapError(encode(body), (error) => BodyError({ _tag: "SchemaError", error })),
|
|
98
98
|
json
|
|
@@ -103,7 +103,7 @@ export const jsonSchema = <R, I, A>(schema: Schema.Schema<R, I, A>) => {
|
|
|
103
103
|
export const file = (
|
|
104
104
|
path: string,
|
|
105
105
|
options?: FileSystem.StreamOptions & { readonly contentType?: string }
|
|
106
|
-
): Effect.Effect<
|
|
106
|
+
): Effect.Effect<Body.Stream, PlatformError.PlatformError, FileSystem.FileSystem> =>
|
|
107
107
|
Effect.flatMap(
|
|
108
108
|
FileSystem.FileSystem,
|
|
109
109
|
(fs) =>
|
|
@@ -120,7 +120,7 @@ export const fileInfo = (
|
|
|
120
120
|
path: string,
|
|
121
121
|
info: FileSystem.File.Info,
|
|
122
122
|
options?: FileSystem.StreamOptions & { readonly contentType?: string }
|
|
123
|
-
): Effect.Effect<
|
|
123
|
+
): Effect.Effect<Body.Stream, PlatformError.PlatformError, FileSystem.FileSystem> =>
|
|
124
124
|
Effect.map(
|
|
125
125
|
FileSystem.FileSystem,
|
|
126
126
|
(fs) =>
|
|
@@ -152,9 +152,9 @@ class StreamImpl implements Body.Stream {
|
|
|
152
152
|
readonly [TypeId]: Body.TypeId
|
|
153
153
|
readonly _tag = "Stream"
|
|
154
154
|
constructor(
|
|
155
|
-
readonly stream: Stream_.Stream<
|
|
155
|
+
readonly stream: Stream_.Stream<Uint8Array, unknown>,
|
|
156
156
|
readonly contentType: string,
|
|
157
|
-
readonly contentLength?: number
|
|
157
|
+
readonly contentLength?: number | undefined
|
|
158
158
|
) {
|
|
159
159
|
this[TypeId] = TypeId
|
|
160
160
|
}
|
|
@@ -162,7 +162,7 @@ class StreamImpl implements Body.Stream {
|
|
|
162
162
|
|
|
163
163
|
/** @internal */
|
|
164
164
|
export const stream = (
|
|
165
|
-
body: Stream_.Stream<
|
|
166
|
-
contentType?: string,
|
|
167
|
-
contentLength?: number
|
|
165
|
+
body: Stream_.Stream<Uint8Array, unknown>,
|
|
166
|
+
contentType?: string | undefined,
|
|
167
|
+
contentLength?: number | undefined
|
|
168
168
|
): Body.Stream => new StreamImpl(body, contentType ?? "application/octet-stream", contentLength)
|
|
@@ -26,7 +26,7 @@ export const TypeId: Client.TypeId = Symbol.for(
|
|
|
26
26
|
) as Client.TypeId
|
|
27
27
|
|
|
28
28
|
/** @internal */
|
|
29
|
-
export const tag = Context.
|
|
29
|
+
export const tag = Context.GenericTag<Client.Client.Default>("@effect/platform/Http/Client")
|
|
30
30
|
|
|
31
31
|
const clientProto = {
|
|
32
32
|
[TypeId]: TypeId,
|
|
@@ -38,8 +38,8 @@ const clientProto = {
|
|
|
38
38
|
/** @internal */
|
|
39
39
|
export const make = <R, E, A, R2, E2>(
|
|
40
40
|
execute: (
|
|
41
|
-
request: Effect.Effect<
|
|
42
|
-
) => Effect.Effect<
|
|
41
|
+
request: Effect.Effect<ClientRequest.ClientRequest, E2, R2>
|
|
42
|
+
) => Effect.Effect<A, E, R>,
|
|
43
43
|
preprocess: Client.Client.Preprocess<R2, E2>
|
|
44
44
|
): Client.Client<R, E, A> => {
|
|
45
45
|
function client(request: ClientRequest.ClientRequest) {
|
|
@@ -68,16 +68,12 @@ const addB3Headers = (req: ClientRequest.ClientRequest) =>
|
|
|
68
68
|
export const makeDefault = (
|
|
69
69
|
f: (
|
|
70
70
|
request: ClientRequest.ClientRequest
|
|
71
|
-
) => Effect.Effect<
|
|
72
|
-
never,
|
|
73
|
-
Error.HttpClientError,
|
|
74
|
-
ClientResponse.ClientResponse
|
|
75
|
-
>
|
|
71
|
+
) => Effect.Effect<ClientResponse.ClientResponse, Error.HttpClientError>
|
|
76
72
|
): Client.Client.Default => make(Effect.flatMap(f), addB3Headers)
|
|
77
73
|
|
|
78
74
|
/** @internal */
|
|
79
|
-
export const Fetch = Context.
|
|
80
|
-
|
|
75
|
+
export const Fetch = Context.GenericTag<Client.Fetch, typeof globalThis.fetch>(
|
|
76
|
+
"@effect/platform/Http/Client/Fetch"
|
|
81
77
|
)
|
|
82
78
|
|
|
83
79
|
/** @internal */
|
|
@@ -148,16 +144,16 @@ export const layer = Layer.succeed(tag, fetch())
|
|
|
148
144
|
export const transform = dual<
|
|
149
145
|
<R, E, A, R1, E1, A1>(
|
|
150
146
|
f: (
|
|
151
|
-
effect: Effect.Effect<
|
|
147
|
+
effect: Effect.Effect<A, E, R>,
|
|
152
148
|
request: ClientRequest.ClientRequest
|
|
153
|
-
) => Effect.Effect<
|
|
149
|
+
) => Effect.Effect<A1, E1, R1>
|
|
154
150
|
) => (self: Client.Client<R, E, A>) => Client.Client<R | R1, E | E1, A1>,
|
|
155
151
|
<R, E, A, R1, E1, A1>(
|
|
156
152
|
self: Client.Client<R, E, A>,
|
|
157
153
|
f: (
|
|
158
|
-
effect: Effect.Effect<
|
|
154
|
+
effect: Effect.Effect<A, E, R>,
|
|
159
155
|
request: ClientRequest.ClientRequest
|
|
160
|
-
) => Effect.Effect<
|
|
156
|
+
) => Effect.Effect<A1, E1, R1>
|
|
161
157
|
) => Client.Client<R | R1, E | E1, A1>
|
|
162
158
|
>(2, (self, f) =>
|
|
163
159
|
make(
|
|
@@ -168,11 +164,11 @@ export const transform = dual<
|
|
|
168
164
|
/** @internal */
|
|
169
165
|
export const transformResponse = dual<
|
|
170
166
|
<R, E, A, R1, E1, A1>(
|
|
171
|
-
f: (effect: Effect.Effect<
|
|
167
|
+
f: (effect: Effect.Effect<A, E, R>) => Effect.Effect<A1, E1, R1>
|
|
172
168
|
) => (self: Client.Client<R, E, A>) => Client.Client<R1, E1, A1>,
|
|
173
169
|
<R, E, A, R1, E1, A1>(
|
|
174
170
|
self: Client.Client<R, E, A>,
|
|
175
|
-
f: (effect: Effect.Effect<
|
|
171
|
+
f: (effect: Effect.Effect<A, E, R>) => Effect.Effect<A1, E1, R1>
|
|
176
172
|
) => Client.Client<R1, E1, A1>
|
|
177
173
|
>(2, (self, f) => make((request) => f(self.execute(request)), self.preprocess))
|
|
178
174
|
|
|
@@ -180,7 +176,7 @@ export const transformResponse = dual<
|
|
|
180
176
|
export const catchTag: {
|
|
181
177
|
<K extends E extends { _tag: string } ? E["_tag"] : never, E, R1, E1, A1>(
|
|
182
178
|
tag: K,
|
|
183
|
-
f: (e: Extract<E, { _tag: K }>) => Effect.Effect<
|
|
179
|
+
f: (e: Extract<E, { _tag: K }>) => Effect.Effect<A1, E1, R1>
|
|
184
180
|
): <R, A>(
|
|
185
181
|
self: Client.Client<R, E, A>
|
|
186
182
|
) => Client.Client<R1 | R, E1 | Exclude<E, { _tag: K }>, A1 | A>
|
|
@@ -195,7 +191,7 @@ export const catchTag: {
|
|
|
195
191
|
>(
|
|
196
192
|
self: Client.Client<R, E, A>,
|
|
197
193
|
tag: K,
|
|
198
|
-
f: (e: Extract<E, { _tag: K }>) => Effect.Effect<
|
|
194
|
+
f: (e: Extract<E, { _tag: K }>) => Effect.Effect<A1, E1, R1>
|
|
199
195
|
): Client.Client<R1 | R, E1 | Exclude<E, { _tag: K }>, A1 | A>
|
|
200
196
|
} = dual(
|
|
201
197
|
3,
|
|
@@ -210,7 +206,7 @@ export const catchTag: {
|
|
|
210
206
|
>(
|
|
211
207
|
self: Client.Client<R, E, A>,
|
|
212
208
|
tag: K,
|
|
213
|
-
f: (e: Extract<E, { _tag: K }>) => Effect.Effect<
|
|
209
|
+
f: (e: Extract<E, { _tag: K }>) => Effect.Effect<A1, E1, R1>
|
|
214
210
|
): Client.Client<R1 | R, E1 | Exclude<E, { _tag: K }>, A1 | A> => transformResponse(self, Effect.catchTag(tag, f))
|
|
215
211
|
)
|
|
216
212
|
|
|
@@ -242,7 +238,7 @@ export const catchTags: {
|
|
|
242
238
|
| {
|
|
243
239
|
[K in keyof Cases]: Cases[K] extends (
|
|
244
240
|
...args: Array<any>
|
|
245
|
-
) => Effect.Effect<
|
|
241
|
+
) => Effect.Effect<any, any, infer R> ? R
|
|
246
242
|
: never
|
|
247
243
|
}[keyof Cases],
|
|
248
244
|
| Exclude<E, { _tag: keyof Cases }>
|
|
@@ -256,7 +252,7 @@ export const catchTags: {
|
|
|
256
252
|
| {
|
|
257
253
|
[K in keyof Cases]: Cases[K] extends (
|
|
258
254
|
...args: Array<any>
|
|
259
|
-
) => Effect.Effect<
|
|
255
|
+
) => Effect.Effect<infer A, any, any> ? A
|
|
260
256
|
: never
|
|
261
257
|
}[keyof Cases]
|
|
262
258
|
>
|
|
@@ -287,7 +283,7 @@ export const catchTags: {
|
|
|
287
283
|
| {
|
|
288
284
|
[K in keyof Cases]: Cases[K] extends (
|
|
289
285
|
...args: Array<any>
|
|
290
|
-
) => Effect.Effect<
|
|
286
|
+
) => Effect.Effect<any, any, infer R> ? R
|
|
291
287
|
: never
|
|
292
288
|
}[keyof Cases],
|
|
293
289
|
| Exclude<E, { _tag: keyof Cases }>
|
|
@@ -301,7 +297,7 @@ export const catchTags: {
|
|
|
301
297
|
| {
|
|
302
298
|
[K in keyof Cases]: Cases[K] extends (
|
|
303
299
|
...args: Array<any>
|
|
304
|
-
) => Effect.Effect<
|
|
300
|
+
) => Effect.Effect<infer A, any, any> ? A
|
|
305
301
|
: never
|
|
306
302
|
}[keyof Cases]
|
|
307
303
|
>
|
|
@@ -334,7 +330,7 @@ export const catchTags: {
|
|
|
334
330
|
| {
|
|
335
331
|
[K in keyof Cases]: Cases[K] extends (
|
|
336
332
|
...args: Array<any>
|
|
337
|
-
) => Effect.Effect<
|
|
333
|
+
) => Effect.Effect<any, any, infer R> ? R
|
|
338
334
|
: never
|
|
339
335
|
}[keyof Cases],
|
|
340
336
|
| Exclude<E, { _tag: keyof Cases }>
|
|
@@ -348,7 +344,7 @@ export const catchTags: {
|
|
|
348
344
|
| {
|
|
349
345
|
[K in keyof Cases]: Cases[K] extends (
|
|
350
346
|
...args: Array<any>
|
|
351
|
-
) => Effect.Effect<
|
|
347
|
+
) => Effect.Effect<infer A, any, any> ? A
|
|
352
348
|
: never
|
|
353
349
|
}[keyof Cases]
|
|
354
350
|
> => transformResponse(self, Effect.catchTags(cases))
|
|
@@ -357,17 +353,17 @@ export const catchTags: {
|
|
|
357
353
|
/** @internal */
|
|
358
354
|
export const catchAll: {
|
|
359
355
|
<E, R2, E2, A2>(
|
|
360
|
-
f: (e: E) => Effect.Effect<
|
|
356
|
+
f: (e: E) => Effect.Effect<A2, E2, R2>
|
|
361
357
|
): <R, A>(self: Client.Client<R, E, A>) => Client.Client<R | R2, E2, A2 | A>
|
|
362
358
|
<R, E, A, R2, E2, A2>(
|
|
363
359
|
self: Client.Client<R, E, A>,
|
|
364
|
-
f: (e: E) => Effect.Effect<
|
|
360
|
+
f: (e: E) => Effect.Effect<A2, E2, R2>
|
|
365
361
|
): Client.Client<R | R2, E2, A2 | A>
|
|
366
362
|
} = dual(
|
|
367
363
|
2,
|
|
368
364
|
<R, E, A, R2, E2, A2>(
|
|
369
365
|
self: Client.Client<R, E, A>,
|
|
370
|
-
f: (e: E) => Effect.Effect<
|
|
366
|
+
f: (e: E) => Effect.Effect<A2, E2, R2>
|
|
371
367
|
): Client.Client<R | R2, E2, A2 | A> => transformResponse(self, Effect.catchAll(f))
|
|
372
368
|
)
|
|
373
369
|
|
|
@@ -375,14 +371,14 @@ export const catchAll: {
|
|
|
375
371
|
export const filterOrElse = dual<
|
|
376
372
|
<A, R2, E2, B>(
|
|
377
373
|
f: Predicate.Predicate<A>,
|
|
378
|
-
orElse: (a: A) => Effect.Effect<
|
|
374
|
+
orElse: (a: A) => Effect.Effect<B, E2, R2>
|
|
379
375
|
) => <R, E>(
|
|
380
376
|
self: Client.Client<R, E, A>
|
|
381
377
|
) => Client.Client<R2 | R, E2 | E, A | B>,
|
|
382
378
|
<R, E, A, R2, E2, B>(
|
|
383
379
|
self: Client.Client<R, E, A>,
|
|
384
380
|
f: Predicate.Predicate<A>,
|
|
385
|
-
orElse: (a: A) => Effect.Effect<
|
|
381
|
+
orElse: (a: A) => Effect.Effect<B, E2, R2>
|
|
386
382
|
) => Client.Client<R2 | R, E2 | E, A | B>
|
|
387
383
|
>(3, (self, f, orElse) => transformResponse(self, Effect.filterOrElse(f, orElse)))
|
|
388
384
|
|
|
@@ -445,11 +441,11 @@ export const map = dual<
|
|
|
445
441
|
/** @internal */
|
|
446
442
|
export const mapEffect = dual<
|
|
447
443
|
<A, R2, E2, B>(
|
|
448
|
-
f: (a: A) => Effect.Effect<
|
|
444
|
+
f: (a: A) => Effect.Effect<B, E2, R2>
|
|
449
445
|
) => <R, E>(self: Client.Client<R, E, A>) => Client.Client<R | R2, E | E2, B>,
|
|
450
446
|
<R, E, A, R2, E2, B>(
|
|
451
447
|
self: Client.Client<R, E, A>,
|
|
452
|
-
f: (a: A) => Effect.Effect<
|
|
448
|
+
f: (a: A) => Effect.Effect<B, E2, R2>
|
|
453
449
|
) => Client.Client<R | R2, E | E2, B>
|
|
454
450
|
>(2, (self, f) => transformResponse(self, Effect.flatMap(f)))
|
|
455
451
|
|
|
@@ -469,7 +465,7 @@ export const mapRequestEffect = dual<
|
|
|
469
465
|
<R2, E2>(
|
|
470
466
|
f: (
|
|
471
467
|
a: ClientRequest.ClientRequest
|
|
472
|
-
) => Effect.Effect<
|
|
468
|
+
) => Effect.Effect<ClientRequest.ClientRequest, E2, R2>
|
|
473
469
|
) => <R, E, A>(
|
|
474
470
|
self: Client.Client<R, E, A>
|
|
475
471
|
) => Client.Client<R | R2, E | E2, A>,
|
|
@@ -477,7 +473,7 @@ export const mapRequestEffect = dual<
|
|
|
477
473
|
self: Client.Client<R, E, A>,
|
|
478
474
|
f: (
|
|
479
475
|
a: ClientRequest.ClientRequest
|
|
480
|
-
) => Effect.Effect<
|
|
476
|
+
) => Effect.Effect<ClientRequest.ClientRequest, E2, R2>
|
|
481
477
|
) => Client.Client<R | R2, E | E2, A>
|
|
482
478
|
>(2, (self, f) => make(self.execute as any, (request) => Effect.flatMap(self.preprocess(request), f)))
|
|
483
479
|
|
|
@@ -497,7 +493,7 @@ export const mapInputRequestEffect = dual<
|
|
|
497
493
|
<R2, E2>(
|
|
498
494
|
f: (
|
|
499
495
|
a: ClientRequest.ClientRequest
|
|
500
|
-
) => Effect.Effect<
|
|
496
|
+
) => Effect.Effect<ClientRequest.ClientRequest, E2, R2>
|
|
501
497
|
) => <R, E, A>(
|
|
502
498
|
self: Client.Client<R, E, A>
|
|
503
499
|
) => Client.Client<R | R2, E | E2, A>,
|
|
@@ -505,7 +501,7 @@ export const mapInputRequestEffect = dual<
|
|
|
505
501
|
self: Client.Client<R, E, A>,
|
|
506
502
|
f: (
|
|
507
503
|
a: ClientRequest.ClientRequest
|
|
508
|
-
) => Effect.Effect<
|
|
504
|
+
) => Effect.Effect<ClientRequest.ClientRequest, E2, R2>
|
|
509
505
|
) => Client.Client<R | R2, E | E2, A>
|
|
510
506
|
>(2, (self, f) => make(self.execute as any, (request) => Effect.flatMap(f(request), self.preprocess)))
|
|
511
507
|
|
|
@@ -528,23 +524,23 @@ export const retry: {
|
|
|
528
524
|
|
|
529
525
|
/** @internal */
|
|
530
526
|
export const schemaFunction = dual<
|
|
531
|
-
<
|
|
532
|
-
schema: Schema.Schema<
|
|
527
|
+
<SA, SI, SR>(
|
|
528
|
+
schema: Schema.Schema<SA, SI, SR>
|
|
533
529
|
) => <R, E, A>(
|
|
534
530
|
self: Client.Client<R, E, A>
|
|
535
531
|
) => (
|
|
536
532
|
request: ClientRequest.ClientRequest
|
|
537
533
|
) => (
|
|
538
534
|
a: SA
|
|
539
|
-
) => Effect.Effect<
|
|
540
|
-
<R, E, A,
|
|
535
|
+
) => Effect.Effect<A, E | ParseResult.ParseError | Error.RequestError, SR | R>,
|
|
536
|
+
<R, E, A, SA, SI, SR>(
|
|
541
537
|
self: Client.Client<R, E, A>,
|
|
542
|
-
schema: Schema.Schema<
|
|
538
|
+
schema: Schema.Schema<SA, SI, SR>
|
|
543
539
|
) => (
|
|
544
540
|
request: ClientRequest.ClientRequest
|
|
545
541
|
) => (
|
|
546
542
|
a: SA
|
|
547
|
-
) => Effect.Effect<
|
|
543
|
+
) => Effect.Effect<A, E | ParseResult.ParseError | Error.RequestError, SR | R>
|
|
548
544
|
>(2, (self, schema) => {
|
|
549
545
|
const encode = Schema.encode(schema)
|
|
550
546
|
return (request) => (a) =>
|
|
@@ -571,23 +567,23 @@ export const schemaFunction = dual<
|
|
|
571
567
|
/** @internal */
|
|
572
568
|
export const tap = dual<
|
|
573
569
|
<A, R2, E2, _>(
|
|
574
|
-
f: (a: A) => Effect.Effect<
|
|
570
|
+
f: (a: A) => Effect.Effect<_, E2, R2>
|
|
575
571
|
) => <R, E>(self: Client.Client<R, E, A>) => Client.Client<R | R2, E | E2, A>,
|
|
576
572
|
<R, E, A, R2, E2, _>(
|
|
577
573
|
self: Client.Client<R, E, A>,
|
|
578
|
-
f: (a: A) => Effect.Effect<
|
|
574
|
+
f: (a: A) => Effect.Effect<_, E2, R2>
|
|
579
575
|
) => Client.Client<R | R2, E | E2, A>
|
|
580
576
|
>(2, (self, f) => transformResponse(self, Effect.tap(f)))
|
|
581
577
|
|
|
582
578
|
/** @internal */
|
|
583
579
|
export const tapRequest = dual<
|
|
584
580
|
<R2, E2, _>(
|
|
585
|
-
f: (a: ClientRequest.ClientRequest) => Effect.Effect<
|
|
581
|
+
f: (a: ClientRequest.ClientRequest) => Effect.Effect<_, E2, R2>
|
|
586
582
|
) => <R, E, A>(
|
|
587
583
|
self: Client.Client<R, E, A>
|
|
588
584
|
) => Client.Client<R | R2, E | E2, A>,
|
|
589
585
|
<R, E, A, R2, E2, _>(
|
|
590
586
|
self: Client.Client<R, E, A>,
|
|
591
|
-
f: (a: ClientRequest.ClientRequest) => Effect.Effect<
|
|
587
|
+
f: (a: ClientRequest.ClientRequest) => Effect.Effect<_, E2, R2>
|
|
592
588
|
) => Client.Client<R | R2, E | E2, A>
|
|
593
589
|
>(2, (self, f) => make(self.execute as any, (request) => Effect.tap(self.preprocess(request), f)))
|
|
@@ -323,11 +323,11 @@ export const textBody = dual<
|
|
|
323
323
|
export const jsonBody = dual<
|
|
324
324
|
(
|
|
325
325
|
body: unknown
|
|
326
|
-
) => (self: ClientRequest.ClientRequest) => Effect.Effect<
|
|
326
|
+
) => (self: ClientRequest.ClientRequest) => Effect.Effect<ClientRequest.ClientRequest, Body.BodyError>,
|
|
327
327
|
(
|
|
328
328
|
self: ClientRequest.ClientRequest,
|
|
329
329
|
body: unknown
|
|
330
|
-
) => Effect.Effect<
|
|
330
|
+
) => Effect.Effect<ClientRequest.ClientRequest, Body.BodyError>
|
|
331
331
|
>(2, (self, body) => Effect.map(internalBody.json(body), (body) => setBody(self, body)))
|
|
332
332
|
|
|
333
333
|
/** @internal */
|
|
@@ -343,12 +343,12 @@ export const fileBody = dual<
|
|
|
343
343
|
options?: FileSystem.StreamOptions & { readonly contentType?: string }
|
|
344
344
|
) => (
|
|
345
345
|
self: ClientRequest.ClientRequest
|
|
346
|
-
) => Effect.Effect<
|
|
346
|
+
) => Effect.Effect<ClientRequest.ClientRequest, PlatformError.PlatformError, FileSystem.FileSystem>,
|
|
347
347
|
(
|
|
348
348
|
self: ClientRequest.ClientRequest,
|
|
349
349
|
path: string,
|
|
350
350
|
options?: FileSystem.StreamOptions & { readonly contentType?: string }
|
|
351
|
-
) => Effect.Effect<
|
|
351
|
+
) => Effect.Effect<ClientRequest.ClientRequest, PlatformError.PlatformError, FileSystem.FileSystem>
|
|
352
352
|
>(
|
|
353
353
|
(args) => isClientRequest(args[0]),
|
|
354
354
|
(self, path, options) => Effect.map(internalBody.file(path, options), (body) => setBody(self, body))
|
|
@@ -361,16 +361,16 @@ export const fileWebBody = dual<
|
|
|
361
361
|
>(2, (self, file) => setBody(self, internalBody.fileWeb(file)))
|
|
362
362
|
|
|
363
363
|
/** @internal */
|
|
364
|
-
export const schemaBody = <
|
|
365
|
-
(body: A): (self: ClientRequest.ClientRequest) => Effect.Effect<
|
|
366
|
-
(self: ClientRequest.ClientRequest, body: A): Effect.Effect<
|
|
364
|
+
export const schemaBody = <A, I, R>(schema: Schema.Schema<A, I, R>): {
|
|
365
|
+
(body: A): (self: ClientRequest.ClientRequest) => Effect.Effect<ClientRequest.ClientRequest, Body.BodyError, R>
|
|
366
|
+
(self: ClientRequest.ClientRequest, body: A): Effect.Effect<ClientRequest.ClientRequest, Body.BodyError, R>
|
|
367
367
|
} => {
|
|
368
368
|
const encode = internalBody.jsonSchema(schema)
|
|
369
369
|
return dual<
|
|
370
370
|
(
|
|
371
371
|
body: A
|
|
372
|
-
) => (self: ClientRequest.ClientRequest) => Effect.Effect<
|
|
373
|
-
(self: ClientRequest.ClientRequest, body: A) => Effect.Effect<
|
|
372
|
+
) => (self: ClientRequest.ClientRequest) => Effect.Effect<ClientRequest.ClientRequest, Body.BodyError, R>,
|
|
373
|
+
(self: ClientRequest.ClientRequest, body: A) => Effect.Effect<ClientRequest.ClientRequest, Body.BodyError, R>
|
|
374
374
|
>(2, (self, body) => Effect.map(encode(body), (body) => setBody(self, body)))
|
|
375
375
|
}
|
|
376
376
|
|
|
@@ -396,18 +396,18 @@ export const formDataBody = dual<
|
|
|
396
396
|
/** @internal */
|
|
397
397
|
export const streamBody = dual<
|
|
398
398
|
(
|
|
399
|
-
body: Stream.Stream<
|
|
399
|
+
body: Stream.Stream<Uint8Array, unknown>,
|
|
400
400
|
options?: {
|
|
401
|
-
readonly contentType?: string
|
|
402
|
-
readonly contentLength?: number
|
|
401
|
+
readonly contentType?: string | undefined
|
|
402
|
+
readonly contentLength?: number | undefined
|
|
403
403
|
}
|
|
404
404
|
) => (self: ClientRequest.ClientRequest) => ClientRequest.ClientRequest,
|
|
405
405
|
(
|
|
406
406
|
self: ClientRequest.ClientRequest,
|
|
407
|
-
body: Stream.Stream<
|
|
407
|
+
body: Stream.Stream<Uint8Array, unknown>,
|
|
408
408
|
options?: {
|
|
409
|
-
readonly contentType?: string
|
|
410
|
-
readonly contentLength?: number
|
|
409
|
+
readonly contentType?: string | undefined
|
|
410
|
+
readonly contentLength?: number | undefined
|
|
411
411
|
}
|
|
412
412
|
) => ClientRequest.ClientRequest
|
|
413
413
|
>(
|
|
@@ -44,7 +44,7 @@ class ClientResponseImpl implements ClientResponse.ClientResponse {
|
|
|
44
44
|
return Option.none()
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
get stream(): Stream.Stream<
|
|
47
|
+
get stream(): Stream.Stream<Uint8Array, Error.ResponseError> {
|
|
48
48
|
return this.source.body
|
|
49
49
|
? Stream.fromReadableStream(() => this.source.body!, (_) =>
|
|
50
50
|
internalError.responseError({
|
|
@@ -61,7 +61,7 @@ class ClientResponseImpl implements ClientResponse.ClientResponse {
|
|
|
61
61
|
}))
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
get json(): Effect.Effect<
|
|
64
|
+
get json(): Effect.Effect<unknown, Error.ResponseError> {
|
|
65
65
|
return Effect.tryMap(this.text, {
|
|
66
66
|
try: (text) => text === "" ? null : JSON.parse(text) as unknown,
|
|
67
67
|
catch: (_) =>
|
|
@@ -74,8 +74,8 @@ class ClientResponseImpl implements ClientResponse.ClientResponse {
|
|
|
74
74
|
})
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
private textBody?: Effect.Effect<
|
|
78
|
-
get text(): Effect.Effect<
|
|
77
|
+
private textBody?: Effect.Effect<string, Error.ResponseError>
|
|
78
|
+
get text(): Effect.Effect<string, Error.ResponseError> {
|
|
79
79
|
return this.textBody ??= Effect.tryPromise({
|
|
80
80
|
try: () => this.source.text(),
|
|
81
81
|
catch: (_) =>
|
|
@@ -88,7 +88,7 @@ class ClientResponseImpl implements ClientResponse.ClientResponse {
|
|
|
88
88
|
}).pipe(Effect.cached, Effect.runSync)
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
get urlParamsBody(): Effect.Effect<
|
|
91
|
+
get urlParamsBody(): Effect.Effect<UrlParams.UrlParams, Error.ResponseError> {
|
|
92
92
|
return Effect.flatMap(this.text, (_) =>
|
|
93
93
|
Effect.try({
|
|
94
94
|
try: () => UrlParams.fromInput(new URLSearchParams(_)),
|
|
@@ -102,8 +102,8 @@ class ClientResponseImpl implements ClientResponse.ClientResponse {
|
|
|
102
102
|
}))
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
private formDataBody?: Effect.Effect<
|
|
106
|
-
get formData(): Effect.Effect<
|
|
105
|
+
private formDataBody?: Effect.Effect<FormData, Error.ResponseError>
|
|
106
|
+
get formData(): Effect.Effect<FormData, Error.ResponseError> {
|
|
107
107
|
return this.formDataBody ??= Effect.tryPromise({
|
|
108
108
|
try: () => this.source.formData(),
|
|
109
109
|
catch: (_) =>
|
|
@@ -116,8 +116,8 @@ class ClientResponseImpl implements ClientResponse.ClientResponse {
|
|
|
116
116
|
}).pipe(Effect.cached, Effect.runSync)
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
private arrayBufferBody?: Effect.Effect<
|
|
120
|
-
get arrayBuffer(): Effect.Effect<
|
|
119
|
+
private arrayBufferBody?: Effect.Effect<ArrayBuffer, Error.ResponseError>
|
|
120
|
+
get arrayBuffer(): Effect.Effect<ArrayBuffer, Error.ResponseError> {
|
|
121
121
|
return this.arrayBufferBody ??= Effect.tryPromise({
|
|
122
122
|
try: () => this.source.arrayBuffer(),
|
|
123
123
|
catch: (_) =>
|
|
@@ -135,14 +135,14 @@ class ClientResponseImpl implements ClientResponse.ClientResponse {
|
|
|
135
135
|
export const schemaJson = <
|
|
136
136
|
R,
|
|
137
137
|
I extends {
|
|
138
|
-
readonly status?: number
|
|
139
|
-
readonly headers?: Readonly<Record<string, string>>
|
|
140
|
-
readonly body?: unknown
|
|
138
|
+
readonly status?: number | undefined
|
|
139
|
+
readonly headers?: Readonly<Record<string, string>> | undefined
|
|
140
|
+
readonly body?: unknown | undefined
|
|
141
141
|
},
|
|
142
142
|
A
|
|
143
|
-
>(schema: Schema.Schema<
|
|
143
|
+
>(schema: Schema.Schema<A, I, R>) => {
|
|
144
144
|
const parse = Schema.decodeUnknown(schema)
|
|
145
|
-
return (self: ClientResponse.ClientResponse): Effect.Effect<
|
|
145
|
+
return (self: ClientResponse.ClientResponse): Effect.Effect<A, Error.ResponseError | ParseResult.ParseError, R> =>
|
|
146
146
|
Effect.flatMap(
|
|
147
147
|
self.json,
|
|
148
148
|
(body) =>
|
|
@@ -158,13 +158,13 @@ export const schemaJson = <
|
|
|
158
158
|
export const schemaNoBody = <
|
|
159
159
|
R,
|
|
160
160
|
I extends {
|
|
161
|
-
readonly status?: number
|
|
162
|
-
readonly headers?: Readonly<Record<string, string>>
|
|
161
|
+
readonly status?: number | undefined
|
|
162
|
+
readonly headers?: Readonly<Record<string, string>> | undefined
|
|
163
163
|
},
|
|
164
164
|
A
|
|
165
|
-
>(schema: Schema.Schema<
|
|
165
|
+
>(schema: Schema.Schema<A, I, R>) => {
|
|
166
166
|
const parse = Schema.decodeUnknown(schema)
|
|
167
|
-
return (self: ClientResponse.ClientResponse): Effect.Effect<
|
|
167
|
+
return (self: ClientResponse.ClientResponse): Effect.Effect<A, ParseResult.ParseError, R> =>
|
|
168
168
|
parse({
|
|
169
169
|
status: self.status,
|
|
170
170
|
headers: self.headers
|
|
@@ -7,7 +7,7 @@ export const GeneratorTypeId: Etag.GeneratorTypeId = Symbol.for(
|
|
|
7
7
|
) as Etag.GeneratorTypeId
|
|
8
8
|
|
|
9
9
|
/** @internal */
|
|
10
|
-
export const tag = Context.
|
|
10
|
+
export const tag = Context.GenericTag<Etag.Generator>("@effect/platform/Http/Etag/Generator")
|
|
11
11
|
|
|
12
12
|
/** @internal */
|
|
13
13
|
export const toString = (self: Etag.Etag): string => {
|
|
@@ -20,7 +20,7 @@ export const loggerDisabled = globalValue(
|
|
|
20
20
|
)
|
|
21
21
|
|
|
22
22
|
/** @internal */
|
|
23
|
-
export const withLoggerDisabled = <R, E, A>(self: Effect.Effect<
|
|
23
|
+
export const withLoggerDisabled = <R, E, A>(self: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> =>
|
|
24
24
|
Effect.zipRight(
|
|
25
25
|
FiberRef.set(loggerDisabled, true),
|
|
26
26
|
self
|
|
@@ -36,11 +36,11 @@ export const currentTracerDisabledWhen = globalValue(
|
|
|
36
36
|
export const withTracerDisabledWhen = dual<
|
|
37
37
|
(
|
|
38
38
|
predicate: Predicate.Predicate<ServerRequest.ServerRequest>
|
|
39
|
-
) => <R, E, A>(effect: Effect.Effect<
|
|
39
|
+
) => <R, E, A>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>,
|
|
40
40
|
<R, E, A>(
|
|
41
|
-
effect: Effect.Effect<
|
|
41
|
+
effect: Effect.Effect<A, E, R>,
|
|
42
42
|
predicate: Predicate.Predicate<ServerRequest.ServerRequest>
|
|
43
|
-
) => Effect.Effect<
|
|
43
|
+
) => Effect.Effect<A, E, R>
|
|
44
44
|
>(2, (self, pred) => Effect.locally(self, currentTracerDisabledWhen, pred))
|
|
45
45
|
|
|
46
46
|
/** @internal */
|