@effect/platform 0.67.1 → 0.68.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 +66 -52
- package/dist/cjs/FetchHttpClient.js.map +1 -1
- package/dist/cjs/HttpClient.js +43 -31
- package/dist/cjs/HttpClient.js.map +1 -1
- package/dist/cjs/HttpClientRequest.js.map +1 -1
- package/dist/cjs/PlatformConfigProvider.js +24 -1
- package/dist/cjs/PlatformConfigProvider.js.map +1 -1
- package/dist/cjs/internal/fetchHttpClient.js +1 -1
- package/dist/cjs/internal/fetchHttpClient.js.map +1 -1
- package/dist/cjs/internal/httpClient.js +41 -38
- package/dist/cjs/internal/httpClient.js.map +1 -1
- package/dist/cjs/internal/httpClientRequest.js +5 -9
- package/dist/cjs/internal/httpClientRequest.js.map +1 -1
- package/dist/cjs/internal/platformConfigProvider.js +117 -0
- package/dist/cjs/internal/platformConfigProvider.js.map +1 -0
- package/dist/dts/FetchHttpClient.d.ts +1 -1
- package/dist/dts/FetchHttpClient.d.ts.map +1 -1
- package/dist/dts/HttpApiClient.d.ts +2 -2
- package/dist/dts/HttpApiClient.d.ts.map +1 -1
- package/dist/dts/HttpClient.d.ts +118 -186
- package/dist/dts/HttpClient.d.ts.map +1 -1
- package/dist/dts/HttpClientRequest.d.ts +2 -5
- package/dist/dts/HttpClientRequest.d.ts.map +1 -1
- package/dist/dts/HttpServer.d.ts +1 -1
- package/dist/dts/HttpServer.d.ts.map +1 -1
- package/dist/dts/PlatformConfigProvider.d.ts +23 -0
- package/dist/dts/PlatformConfigProvider.d.ts.map +1 -1
- package/dist/dts/internal/httpClient.d.ts +23 -1
- package/dist/dts/internal/httpClient.d.ts.map +1 -1
- package/dist/dts/internal/platformConfigProvider.d.ts +2 -0
- package/dist/dts/internal/platformConfigProvider.d.ts.map +1 -0
- package/dist/esm/FetchHttpClient.js.map +1 -1
- package/dist/esm/HttpClient.js +42 -30
- package/dist/esm/HttpClient.js.map +1 -1
- package/dist/esm/HttpClientRequest.js.map +1 -1
- package/dist/esm/PlatformConfigProvider.js +23 -0
- package/dist/esm/PlatformConfigProvider.js.map +1 -1
- package/dist/esm/internal/fetchHttpClient.js +1 -1
- package/dist/esm/internal/fetchHttpClient.js.map +1 -1
- package/dist/esm/internal/httpClient.js +29 -33
- package/dist/esm/internal/httpClient.js.map +1 -1
- package/dist/esm/internal/httpClientRequest.js +4 -8
- package/dist/esm/internal/httpClientRequest.js.map +1 -1
- package/dist/esm/internal/platformConfigProvider.js +106 -0
- package/dist/esm/internal/platformConfigProvider.js.map +1 -0
- package/package.json +2 -2
- package/src/FetchHttpClient.ts +1 -1
- package/src/HttpApiClient.ts +2 -2
- package/src/HttpClient.ts +258 -279
- package/src/HttpClientRequest.ts +2 -7
- package/src/HttpServer.ts +1 -1
- package/src/PlatformConfigProvider.ts +30 -0
- package/src/internal/fetchHttpClient.ts +1 -1
- package/src/internal/httpClient.ts +191 -303
- package/src/internal/httpClientRequest.ts +4 -10
- package/src/internal/platformConfigProvider.ts +148 -0
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import type { ParseOptions } from "@effect/schema/AST"
|
|
2
|
-
import type * as ParseResult from "@effect/schema/ParseResult"
|
|
3
|
-
import * as Schema from "@effect/schema/Schema"
|
|
4
1
|
import * as Context from "effect/Context"
|
|
5
2
|
import * as Effect from "effect/Effect"
|
|
6
3
|
import type * as Fiber from "effect/Fiber"
|
|
@@ -22,7 +19,6 @@ import type * as ClientRequest from "../HttpClientRequest.js"
|
|
|
22
19
|
import type * as ClientResponse from "../HttpClientResponse.js"
|
|
23
20
|
import * as TraceContext from "../HttpTraceContext.js"
|
|
24
21
|
import * as UrlParams from "../UrlParams.js"
|
|
25
|
-
import * as internalBody from "./httpBody.js"
|
|
26
22
|
import * as internalRequest from "./httpClientRequest.js"
|
|
27
23
|
import * as internalResponse from "./httpClientResponse.js"
|
|
28
24
|
|
|
@@ -32,7 +28,7 @@ export const TypeId: Client.TypeId = Symbol.for(
|
|
|
32
28
|
) as Client.TypeId
|
|
33
29
|
|
|
34
30
|
/** @internal */
|
|
35
|
-
export const tag = Context.GenericTag<Client.HttpClient
|
|
31
|
+
export const tag = Context.GenericTag<Client.HttpClient>("@effect/platform/HttpClient")
|
|
36
32
|
|
|
37
33
|
/** @internal */
|
|
38
34
|
export const currentTracerDisabledWhen = globalValue(
|
|
@@ -79,43 +75,43 @@ const ClientProto = {
|
|
|
79
75
|
_id: "@effect/platform/HttpClient"
|
|
80
76
|
}
|
|
81
77
|
},
|
|
82
|
-
get(this: Client.HttpClient
|
|
78
|
+
get(this: Client.HttpClient, url: string | URL, options?: ClientRequest.Options.NoBody) {
|
|
83
79
|
return this.execute(internalRequest.get(url, options))
|
|
84
80
|
},
|
|
85
|
-
head(this: Client.HttpClient
|
|
81
|
+
head(this: Client.HttpClient, url: string | URL, options?: ClientRequest.Options.NoBody) {
|
|
86
82
|
return this.execute(internalRequest.head(url, options))
|
|
87
83
|
},
|
|
88
|
-
post(this: Client.HttpClient
|
|
84
|
+
post(this: Client.HttpClient, url: string | URL, options: ClientRequest.Options.NoUrl) {
|
|
89
85
|
return this.execute(internalRequest.post(url, options))
|
|
90
86
|
},
|
|
91
|
-
put(this: Client.HttpClient
|
|
87
|
+
put(this: Client.HttpClient, url: string | URL, options: ClientRequest.Options.NoUrl) {
|
|
92
88
|
return this.execute(internalRequest.put(url, options))
|
|
93
89
|
},
|
|
94
|
-
patch(this: Client.HttpClient
|
|
90
|
+
patch(this: Client.HttpClient, url: string | URL, options: ClientRequest.Options.NoUrl) {
|
|
95
91
|
return this.execute(internalRequest.patch(url, options))
|
|
96
92
|
},
|
|
97
|
-
del(this: Client.HttpClient
|
|
93
|
+
del(this: Client.HttpClient, url: string | URL, options?: ClientRequest.Options.NoUrl) {
|
|
98
94
|
return this.execute(internalRequest.del(url, options))
|
|
99
95
|
},
|
|
100
|
-
options(this: Client.HttpClient
|
|
96
|
+
options(this: Client.HttpClient, url: string | URL, options?: ClientRequest.Options.NoBody) {
|
|
101
97
|
return this.execute(internalRequest.options(url, options))
|
|
102
98
|
}
|
|
103
99
|
}
|
|
104
100
|
|
|
105
|
-
const isClient = (u: unknown): u is Client.HttpClient<unknown, unknown
|
|
101
|
+
const isClient = (u: unknown): u is Client.HttpClient<unknown, unknown> => Predicate.hasProperty(u, TypeId)
|
|
106
102
|
|
|
107
|
-
interface HttpClientImpl<
|
|
103
|
+
interface HttpClientImpl<E, R> extends Client.HttpClient<E, R> {
|
|
108
104
|
readonly preprocess: Client.HttpClient.Preprocess<E, R>
|
|
109
|
-
readonly postprocess: Client.HttpClient.Postprocess<
|
|
105
|
+
readonly postprocess: Client.HttpClient.Postprocess<E, R>
|
|
110
106
|
}
|
|
111
107
|
|
|
112
108
|
/** @internal */
|
|
113
|
-
export const
|
|
109
|
+
export const makeWith = <E2, R2, E, R>(
|
|
114
110
|
postprocess: (
|
|
115
111
|
request: Effect.Effect<ClientRequest.HttpClientRequest, E2, R2>
|
|
116
|
-
) => Effect.Effect<
|
|
112
|
+
) => Effect.Effect<ClientResponse.HttpClientResponse, E, R>,
|
|
117
113
|
preprocess: Client.HttpClient.Preprocess<E2, R2>
|
|
118
|
-
): Client.HttpClient<
|
|
114
|
+
): Client.HttpClient<E, R> => {
|
|
119
115
|
const self = Object.create(ClientProto)
|
|
120
116
|
self.preprocess = preprocess
|
|
121
117
|
self.postprocess = postprocess
|
|
@@ -126,15 +122,15 @@ export const make = <E2, R2, A, E, R>(
|
|
|
126
122
|
}
|
|
127
123
|
|
|
128
124
|
/** @internal */
|
|
129
|
-
export const
|
|
125
|
+
export const make = (
|
|
130
126
|
f: (
|
|
131
127
|
request: ClientRequest.HttpClientRequest,
|
|
132
128
|
url: URL,
|
|
133
129
|
signal: AbortSignal,
|
|
134
130
|
fiber: Fiber.RuntimeFiber<ClientResponse.HttpClientResponse, Error.HttpClientError>
|
|
135
131
|
) => Effect.Effect<ClientResponse.HttpClientResponse, Error.HttpClientError, Scope.Scope>
|
|
136
|
-
): Client.HttpClient
|
|
137
|
-
|
|
132
|
+
): Client.HttpClient =>
|
|
133
|
+
makeWith((effect) =>
|
|
138
134
|
Effect.flatMap(effect, (request) =>
|
|
139
135
|
Effect.withFiberRuntime((fiber) => {
|
|
140
136
|
const scope = Context.unsafeGet(fiber.getFiberRef(FiberRef.currentContext), Scope.Scope)
|
|
@@ -202,24 +198,43 @@ export const makeService = (
|
|
|
202
198
|
)
|
|
203
199
|
})), Effect.succeed as Client.HttpClient.Preprocess<never, never>)
|
|
204
200
|
|
|
201
|
+
export const {
|
|
202
|
+
/** @internal */
|
|
203
|
+
del,
|
|
204
|
+
/** @internal */
|
|
205
|
+
execute,
|
|
206
|
+
/** @internal */
|
|
207
|
+
get,
|
|
208
|
+
/** @internal */
|
|
209
|
+
head,
|
|
210
|
+
/** @internal */
|
|
211
|
+
options,
|
|
212
|
+
/** @internal */
|
|
213
|
+
patch,
|
|
214
|
+
/** @internal */
|
|
215
|
+
post,
|
|
216
|
+
/** @internal */
|
|
217
|
+
put
|
|
218
|
+
} = Effect.serviceFunctions(tag)
|
|
219
|
+
|
|
205
220
|
/** @internal */
|
|
206
221
|
export const transform = dual<
|
|
207
|
-
<
|
|
222
|
+
<E, R, E1, R1>(
|
|
208
223
|
f: (
|
|
209
|
-
effect: Effect.Effect<
|
|
224
|
+
effect: Effect.Effect<ClientResponse.HttpClientResponse, E, R>,
|
|
210
225
|
request: ClientRequest.HttpClientRequest
|
|
211
|
-
) => Effect.Effect<
|
|
212
|
-
) => (self: Client.HttpClient<
|
|
213
|
-
<
|
|
214
|
-
self: Client.HttpClient<
|
|
226
|
+
) => Effect.Effect<ClientResponse.HttpClientResponse, E1, R1>
|
|
227
|
+
) => (self: Client.HttpClient<E, R>) => Client.HttpClient<E | E1, R | R1>,
|
|
228
|
+
<E, R, E1, R1>(
|
|
229
|
+
self: Client.HttpClient<E, R>,
|
|
215
230
|
f: (
|
|
216
|
-
effect: Effect.Effect<
|
|
231
|
+
effect: Effect.Effect<ClientResponse.HttpClientResponse, E, R>,
|
|
217
232
|
request: ClientRequest.HttpClientRequest
|
|
218
|
-
) => Effect.Effect<
|
|
219
|
-
) => Client.HttpClient<
|
|
233
|
+
) => Effect.Effect<ClientResponse.HttpClientResponse, E1, R1>
|
|
234
|
+
) => Client.HttpClient<E | E1, R | R1>
|
|
220
235
|
>(2, (self, f) => {
|
|
221
|
-
const client = self as HttpClientImpl<any, any
|
|
222
|
-
return
|
|
236
|
+
const client = self as HttpClientImpl<any, any>
|
|
237
|
+
return makeWith(
|
|
223
238
|
Effect.flatMap((request) => f(client.postprocess(Effect.succeed(request)), request)),
|
|
224
239
|
client.preprocess
|
|
225
240
|
)
|
|
@@ -230,70 +245,68 @@ export const filterStatus = dual<
|
|
|
230
245
|
(
|
|
231
246
|
f: (status: number) => boolean
|
|
232
247
|
) => <E, R>(
|
|
233
|
-
self: Client.HttpClient
|
|
234
|
-
) => Client.HttpClient
|
|
248
|
+
self: Client.HttpClient<E, R>
|
|
249
|
+
) => Client.HttpClient<E | Error.ResponseError, R>,
|
|
235
250
|
<E, R>(
|
|
236
|
-
self: Client.HttpClient
|
|
251
|
+
self: Client.HttpClient<E, R>,
|
|
237
252
|
f: (status: number) => boolean
|
|
238
|
-
) => Client.HttpClient
|
|
253
|
+
) => Client.HttpClient<E | Error.ResponseError, R>
|
|
239
254
|
>(2, (self, f) => transformResponse(self, Effect.flatMap(internalResponse.filterStatus(f))))
|
|
240
255
|
|
|
241
256
|
/** @internal */
|
|
242
257
|
export const filterStatusOk = <E, R>(
|
|
243
|
-
self: Client.HttpClient
|
|
244
|
-
): Client.HttpClient
|
|
258
|
+
self: Client.HttpClient<E, R>
|
|
259
|
+
): Client.HttpClient<E | Error.ResponseError, R> =>
|
|
245
260
|
transformResponse(self, Effect.flatMap(internalResponse.filterStatusOk))
|
|
246
261
|
|
|
247
262
|
/** @internal */
|
|
248
263
|
export const transformResponse = dual<
|
|
249
|
-
<
|
|
250
|
-
f: (
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
264
|
+
<E, R, E1, R1>(
|
|
265
|
+
f: (
|
|
266
|
+
effect: Effect.Effect<ClientResponse.HttpClientResponse, E, R>
|
|
267
|
+
) => Effect.Effect<ClientResponse.HttpClientResponse, E1, R1>
|
|
268
|
+
) => (self: Client.HttpClient<E, R>) => Client.HttpClient<E1, R1>,
|
|
269
|
+
<E, R, E1, R1>(
|
|
270
|
+
self: Client.HttpClient<E, R>,
|
|
271
|
+
f: (
|
|
272
|
+
effect: Effect.Effect<ClientResponse.HttpClientResponse, E, R>
|
|
273
|
+
) => Effect.Effect<ClientResponse.HttpClientResponse, E1, R1>
|
|
274
|
+
) => Client.HttpClient<E1, R1>
|
|
256
275
|
>(2, (self, f) => {
|
|
257
|
-
const client = self as HttpClientImpl<any, any
|
|
258
|
-
return
|
|
276
|
+
const client = self as HttpClientImpl<any, any>
|
|
277
|
+
return makeWith((request) => f(client.postprocess(request)), client.preprocess)
|
|
259
278
|
})
|
|
260
279
|
|
|
261
280
|
/** @internal */
|
|
262
281
|
export const catchTag: {
|
|
263
|
-
<K extends E extends { _tag: string } ? E["_tag"] : never, E,
|
|
282
|
+
<K extends E extends { _tag: string } ? E["_tag"] : never, E, E1, R1>(
|
|
264
283
|
tag: K,
|
|
265
|
-
f: (e: Extract<E, { _tag: K }>) => Effect.Effect<
|
|
266
|
-
): <
|
|
267
|
-
self: Client.HttpClient<A, E, R>
|
|
268
|
-
) => Client.HttpClient<A1 | A, E1 | Exclude<E, { _tag: K }>, R1 | R>
|
|
284
|
+
f: (e: Extract<E, { _tag: K }>) => Effect.Effect<ClientResponse.HttpClientResponse, E1, R1>
|
|
285
|
+
): <R>(self: Client.HttpClient<E, R>) => Client.HttpClient<E1 | Exclude<E, { _tag: K }>, R1 | R>
|
|
269
286
|
<
|
|
270
287
|
R,
|
|
271
288
|
E,
|
|
272
|
-
A,
|
|
273
289
|
K extends E extends { _tag: string } ? E["_tag"] : never,
|
|
274
|
-
A1,
|
|
275
290
|
R1,
|
|
276
291
|
E1
|
|
277
292
|
>(
|
|
278
|
-
self: Client.HttpClient<
|
|
293
|
+
self: Client.HttpClient<E, R>,
|
|
279
294
|
tag: K,
|
|
280
|
-
f: (e: Extract<E, { _tag: K }>) => Effect.Effect<
|
|
281
|
-
): Client.HttpClient<
|
|
295
|
+
f: (e: Extract<E, { _tag: K }>) => Effect.Effect<ClientResponse.HttpClientResponse, E1, R1>
|
|
296
|
+
): Client.HttpClient<E1 | Exclude<E, { _tag: K }>, R1 | R>
|
|
282
297
|
} = dual(
|
|
283
298
|
3,
|
|
284
299
|
<
|
|
285
300
|
R,
|
|
286
301
|
E,
|
|
287
|
-
A,
|
|
288
302
|
K extends E extends { _tag: string } ? E["_tag"] : never,
|
|
289
303
|
R1,
|
|
290
|
-
E1
|
|
291
|
-
A1
|
|
304
|
+
E1
|
|
292
305
|
>(
|
|
293
|
-
self: Client.HttpClient<
|
|
306
|
+
self: Client.HttpClient<E, R>,
|
|
294
307
|
tag: K,
|
|
295
|
-
f: (e: Extract<E, { _tag: K }>) => Effect.Effect<
|
|
296
|
-
): Client.HttpClient<
|
|
308
|
+
f: (e: Extract<E, { _tag: K }>) => Effect.Effect<ClientResponse.HttpClientResponse, E1, R1>
|
|
309
|
+
): Client.HttpClient<E1 | Exclude<E, { _tag: K }>, R1 | R> => transformResponse(self, Effect.catchTag(tag, f))
|
|
297
310
|
)
|
|
298
311
|
|
|
299
312
|
/** @internal */
|
|
@@ -304,7 +317,7 @@ export const catchTags: {
|
|
|
304
317
|
& {
|
|
305
318
|
[K in Extract<E, { _tag: string }>["_tag"]]+?: (
|
|
306
319
|
error: Extract<E, { _tag: K }>
|
|
307
|
-
) => Effect.Effect<
|
|
320
|
+
) => Effect.Effect<ClientResponse.HttpClientResponse, any, any>
|
|
308
321
|
}
|
|
309
322
|
& (unknown extends E ? {}
|
|
310
323
|
: {
|
|
@@ -317,16 +330,7 @@ export const catchTags: {
|
|
|
317
330
|
})
|
|
318
331
|
>(
|
|
319
332
|
cases: Cases
|
|
320
|
-
): <
|
|
321
|
-
self: Client.HttpClient<A, E, R>
|
|
322
|
-
) => Client.HttpClient<
|
|
323
|
-
| A
|
|
324
|
-
| {
|
|
325
|
-
[K in keyof Cases]: Cases[K] extends (
|
|
326
|
-
...args: Array<any>
|
|
327
|
-
) => Effect.Effect<infer A, any, any> ? A
|
|
328
|
-
: never
|
|
329
|
-
}[keyof Cases],
|
|
333
|
+
): <R>(self: Client.HttpClient<E, R>) => Client.HttpClient<
|
|
330
334
|
| Exclude<E, { _tag: keyof Cases }>
|
|
331
335
|
| {
|
|
332
336
|
[K in keyof Cases]: Cases[K] extends (
|
|
@@ -343,14 +347,13 @@ export const catchTags: {
|
|
|
343
347
|
}[keyof Cases]
|
|
344
348
|
>
|
|
345
349
|
<
|
|
346
|
-
A,
|
|
347
350
|
E extends { _tag: string },
|
|
348
351
|
R,
|
|
349
352
|
Cases extends
|
|
350
353
|
& {
|
|
351
354
|
[K in Extract<E, { _tag: string }>["_tag"]]+?: (
|
|
352
355
|
error: Extract<E, { _tag: K }>
|
|
353
|
-
) => Effect.Effect<
|
|
356
|
+
) => Effect.Effect<ClientResponse.HttpClientResponse, any, any>
|
|
354
357
|
}
|
|
355
358
|
& (unknown extends E ? {}
|
|
356
359
|
: {
|
|
@@ -362,16 +365,9 @@ export const catchTags: {
|
|
|
362
365
|
]: never
|
|
363
366
|
})
|
|
364
367
|
>(
|
|
365
|
-
self: Client.HttpClient<
|
|
368
|
+
self: Client.HttpClient<E, R>,
|
|
366
369
|
cases: Cases
|
|
367
370
|
): Client.HttpClient<
|
|
368
|
-
| A
|
|
369
|
-
| {
|
|
370
|
-
[K in keyof Cases]: Cases[K] extends (
|
|
371
|
-
...args: Array<any>
|
|
372
|
-
) => Effect.Effect<infer A, any, any> ? A
|
|
373
|
-
: never
|
|
374
|
-
}[keyof Cases],
|
|
375
371
|
| Exclude<E, { _tag: keyof Cases }>
|
|
376
372
|
| {
|
|
377
373
|
[K in keyof Cases]: Cases[K] extends (
|
|
@@ -390,14 +386,13 @@ export const catchTags: {
|
|
|
390
386
|
} = dual(
|
|
391
387
|
2,
|
|
392
388
|
<
|
|
393
|
-
A,
|
|
394
389
|
E extends { _tag: string },
|
|
395
390
|
R,
|
|
396
391
|
Cases extends
|
|
397
392
|
& {
|
|
398
393
|
[K in Extract<E, { _tag: string }>["_tag"]]+?: (
|
|
399
394
|
error: Extract<E, { _tag: K }>
|
|
400
|
-
) => Effect.Effect<
|
|
395
|
+
) => Effect.Effect<ClientResponse.HttpClientResponse, any, any>
|
|
401
396
|
}
|
|
402
397
|
& (unknown extends E ? {}
|
|
403
398
|
: {
|
|
@@ -409,16 +404,9 @@ export const catchTags: {
|
|
|
409
404
|
]: never
|
|
410
405
|
})
|
|
411
406
|
>(
|
|
412
|
-
self: Client.HttpClient<
|
|
407
|
+
self: Client.HttpClient<E, R>,
|
|
413
408
|
cases: Cases
|
|
414
409
|
): Client.HttpClient<
|
|
415
|
-
| A
|
|
416
|
-
| {
|
|
417
|
-
[K in keyof Cases]: Cases[K] extends (
|
|
418
|
-
...args: Array<any>
|
|
419
|
-
) => Effect.Effect<infer A, any, any> ? A
|
|
420
|
-
: never
|
|
421
|
-
}[keyof Cases],
|
|
422
410
|
| Exclude<E, { _tag: keyof Cases }>
|
|
423
411
|
| {
|
|
424
412
|
[K in keyof Cases]: Cases[K] extends (
|
|
@@ -433,122 +421,66 @@ export const catchTags: {
|
|
|
433
421
|
) => Effect.Effect<any, any, infer R> ? R
|
|
434
422
|
: never
|
|
435
423
|
}[keyof Cases]
|
|
436
|
-
> => transformResponse(self, Effect.catchTags(cases))
|
|
424
|
+
> => transformResponse(self, Effect.catchTags(cases) as any)
|
|
437
425
|
)
|
|
438
426
|
|
|
439
427
|
/** @internal */
|
|
440
428
|
export const catchAll: {
|
|
441
|
-
<E,
|
|
442
|
-
f: (e: E) => Effect.Effect<
|
|
443
|
-
): <
|
|
444
|
-
<
|
|
445
|
-
self: Client.HttpClient<
|
|
446
|
-
f: (e: E) => Effect.Effect<
|
|
447
|
-
): Client.HttpClient<
|
|
429
|
+
<E, E2, R2>(
|
|
430
|
+
f: (e: E) => Effect.Effect<ClientResponse.HttpClientResponse, E2, R2>
|
|
431
|
+
): <R>(self: Client.HttpClient<E, R>) => Client.HttpClient<E2, R | R2>
|
|
432
|
+
<E, R, E2, R2>(
|
|
433
|
+
self: Client.HttpClient<E, R>,
|
|
434
|
+
f: (e: E) => Effect.Effect<ClientResponse.HttpClientResponse, E2, R2>
|
|
435
|
+
): Client.HttpClient<E2, R | R2>
|
|
448
436
|
} = dual(
|
|
449
437
|
2,
|
|
450
|
-
<
|
|
451
|
-
self: Client.HttpClient<
|
|
452
|
-
f: (e: E) => Effect.Effect<
|
|
453
|
-
): Client.HttpClient<
|
|
438
|
+
<E, R, E2, R2>(
|
|
439
|
+
self: Client.HttpClient<E, R>,
|
|
440
|
+
f: (e: E) => Effect.Effect<ClientResponse.HttpClientResponse, E2, R2>
|
|
441
|
+
): Client.HttpClient<E2, R | R2> => transformResponse(self, Effect.catchAll(f))
|
|
454
442
|
)
|
|
455
443
|
|
|
456
444
|
/** @internal */
|
|
457
445
|
export const filterOrElse: {
|
|
458
|
-
<
|
|
459
|
-
|
|
460
|
-
orElse: (
|
|
461
|
-
): <E, R>(self: Client.HttpClient<A, E, R>) => Client.HttpClient<B | C, E | E2, R | R2>
|
|
462
|
-
<A, B, E2, R2>(
|
|
463
|
-
predicate: Predicate.Predicate<NoInfer<A>>,
|
|
464
|
-
orElse: (a: NoInfer<A>) => Effect.Effect<B, E2, R2>
|
|
446
|
+
<E2, R2>(
|
|
447
|
+
predicate: Predicate.Predicate<ClientResponse.HttpClientResponse>,
|
|
448
|
+
orElse: (response: ClientResponse.HttpClientResponse) => Effect.Effect<ClientResponse.HttpClientResponse, E2, R2>
|
|
465
449
|
): <E, R>(
|
|
466
|
-
self: Client.HttpClient<
|
|
467
|
-
) => Client.HttpClient<
|
|
468
|
-
<
|
|
469
|
-
self: Client.HttpClient<
|
|
470
|
-
|
|
471
|
-
orElse: (
|
|
472
|
-
): Client.HttpClient<
|
|
473
|
-
<A, E, R, B, E2, R2>(
|
|
474
|
-
self: Client.HttpClient<A, E, R>,
|
|
475
|
-
predicate: Predicate.Predicate<A>,
|
|
476
|
-
orElse: (a: A) => Effect.Effect<B, E2, R2>
|
|
477
|
-
): Client.HttpClient<A | B, E2 | E, R2 | R>
|
|
450
|
+
self: Client.HttpClient<E, R>
|
|
451
|
+
) => Client.HttpClient<E2 | E, R2 | R>
|
|
452
|
+
<E, R, E2, R2>(
|
|
453
|
+
self: Client.HttpClient<E, R>,
|
|
454
|
+
predicate: Predicate.Predicate<ClientResponse.HttpClientResponse>,
|
|
455
|
+
orElse: (response: ClientResponse.HttpClientResponse) => Effect.Effect<ClientResponse.HttpClientResponse, E2, R2>
|
|
456
|
+
): Client.HttpClient<E2 | E, R2 | R>
|
|
478
457
|
} = dual(3, (self, f, orElse) => transformResponse(self, Effect.filterOrElse(f, orElse)))
|
|
479
458
|
|
|
480
459
|
/** @internal */
|
|
481
460
|
export const filterOrFail: {
|
|
482
|
-
<
|
|
483
|
-
|
|
484
|
-
orFailWith: (
|
|
485
|
-
): <E, R>(self: Client.HttpClient<
|
|
486
|
-
<
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
<
|
|
491
|
-
self: Client.HttpClient<A, E, R>,
|
|
492
|
-
refinement: Predicate.Refinement<A, B>,
|
|
493
|
-
orFailWith: (a: A) => E2
|
|
494
|
-
): Client.HttpClient<B, E2 | E, R>
|
|
495
|
-
<A, E, R, E2>(
|
|
496
|
-
self: Client.HttpClient<A, E, R>,
|
|
497
|
-
predicate: Predicate.Predicate<A>,
|
|
498
|
-
orFailWith: (a: A) => E2
|
|
499
|
-
): Client.HttpClient<A, E2 | E, R>
|
|
461
|
+
<E2>(
|
|
462
|
+
predicate: Predicate.Predicate<ClientResponse.HttpClientResponse>,
|
|
463
|
+
orFailWith: (response: ClientResponse.HttpClientResponse) => E2
|
|
464
|
+
): <E, R>(self: Client.HttpClient<E, R>) => Client.HttpClient<E2 | E, R>
|
|
465
|
+
<E, R, E2>(
|
|
466
|
+
self: Client.HttpClient<E, R>,
|
|
467
|
+
predicate: Predicate.Predicate<ClientResponse.HttpClientResponse>,
|
|
468
|
+
orFailWith: (response: ClientResponse.HttpClientResponse) => E2
|
|
469
|
+
): Client.HttpClient<E2 | E, R>
|
|
500
470
|
} = dual(3, (self, f, orFailWith) => transformResponse(self, Effect.filterOrFail(f, orFailWith)))
|
|
501
471
|
|
|
502
|
-
/** @internal */
|
|
503
|
-
export const map = dual<
|
|
504
|
-
<A, B>(
|
|
505
|
-
f: (a: A) => B
|
|
506
|
-
) => <E, R>(self: Client.HttpClient<A, E, R>) => Client.HttpClient<B, E, R>,
|
|
507
|
-
<A, E, R, B>(
|
|
508
|
-
self: Client.HttpClient<A, E, R>,
|
|
509
|
-
f: (a: A) => B
|
|
510
|
-
) => Client.HttpClient<B, E, R>
|
|
511
|
-
>(2, (self, f) => transformResponse(self, Effect.map(f)))
|
|
512
|
-
|
|
513
|
-
/** @internal */
|
|
514
|
-
export const mapEffect = dual<
|
|
515
|
-
<A, B, E2, R2>(
|
|
516
|
-
f: (a: A) => Effect.Effect<B, E2, R2>
|
|
517
|
-
) => <E, R>(self: Client.HttpClient<A, E, R>) => Client.HttpClient<B, E | E2, R | R2>,
|
|
518
|
-
<A, E, R, B, E2, R2>(
|
|
519
|
-
self: Client.HttpClient<A, E, R>,
|
|
520
|
-
f: (a: A) => Effect.Effect<B, E2, R2>
|
|
521
|
-
) => Client.HttpClient<B, E | E2, R | R2>
|
|
522
|
-
>(2, (self, f) => transformResponse(self, Effect.flatMap(f)))
|
|
523
|
-
|
|
524
|
-
/** @internal */
|
|
525
|
-
export const scoped = <A, E, R>(
|
|
526
|
-
self: Client.HttpClient<A, E, R>
|
|
527
|
-
): Client.HttpClient<A, E, Exclude<R, Scope.Scope>> => transformResponse(self, Effect.scoped)
|
|
528
|
-
|
|
529
|
-
/** @internal */
|
|
530
|
-
export const mapEffectScoped = dual<
|
|
531
|
-
<A, B, E2, R2>(
|
|
532
|
-
f: (a: A) => Effect.Effect<B, E2, R2>
|
|
533
|
-
) => <E, R>(self: Client.HttpClient<A, E, R>) => Client.HttpClient<B, E | E2, Exclude<R | R2, Scope.Scope>>,
|
|
534
|
-
<A, E, R, B, E2, R2>(
|
|
535
|
-
self: Client.HttpClient<A, E, R>,
|
|
536
|
-
f: (a: A) => Effect.Effect<B, E2, R2>
|
|
537
|
-
) => Client.HttpClient<B, E | E2, Exclude<R | R2, Scope.Scope>>
|
|
538
|
-
>(2, (self, f) => scoped(mapEffect(self, f)))
|
|
539
|
-
|
|
540
472
|
/** @internal */
|
|
541
473
|
export const mapRequest = dual<
|
|
542
474
|
(
|
|
543
475
|
f: (a: ClientRequest.HttpClientRequest) => ClientRequest.HttpClientRequest
|
|
544
|
-
) => <
|
|
545
|
-
<
|
|
546
|
-
self: Client.HttpClient<
|
|
476
|
+
) => <E, R>(self: Client.HttpClient<E, R>) => Client.HttpClient<E, R>,
|
|
477
|
+
<E, R>(
|
|
478
|
+
self: Client.HttpClient<E, R>,
|
|
547
479
|
f: (a: ClientRequest.HttpClientRequest) => ClientRequest.HttpClientRequest
|
|
548
|
-
) => Client.HttpClient<
|
|
480
|
+
) => Client.HttpClient<E, R>
|
|
549
481
|
>(2, (self, f) => {
|
|
550
|
-
const client = self as HttpClientImpl<any, any
|
|
551
|
-
return
|
|
482
|
+
const client = self as HttpClientImpl<any, any>
|
|
483
|
+
return makeWith(client.postprocess, (request) => Effect.map(client.preprocess(request), f))
|
|
552
484
|
})
|
|
553
485
|
|
|
554
486
|
/** @internal */
|
|
@@ -557,32 +489,32 @@ export const mapRequestEffect = dual<
|
|
|
557
489
|
f: (
|
|
558
490
|
a: ClientRequest.HttpClientRequest
|
|
559
491
|
) => Effect.Effect<ClientRequest.HttpClientRequest, E2, R2>
|
|
560
|
-
) => <
|
|
561
|
-
self: Client.HttpClient<
|
|
562
|
-
) => Client.HttpClient<
|
|
563
|
-
<
|
|
564
|
-
self: Client.HttpClient<
|
|
492
|
+
) => <E, R>(
|
|
493
|
+
self: Client.HttpClient<E, R>
|
|
494
|
+
) => Client.HttpClient<E | E2, R | R2>,
|
|
495
|
+
<E, R, E2, R2>(
|
|
496
|
+
self: Client.HttpClient<E, R>,
|
|
565
497
|
f: (
|
|
566
498
|
a: ClientRequest.HttpClientRequest
|
|
567
499
|
) => Effect.Effect<ClientRequest.HttpClientRequest, E2, R2>
|
|
568
|
-
) => Client.HttpClient<
|
|
500
|
+
) => Client.HttpClient<E | E2, R | R2>
|
|
569
501
|
>(2, (self, f) => {
|
|
570
|
-
const client = self as HttpClientImpl<any, any
|
|
571
|
-
return
|
|
502
|
+
const client = self as HttpClientImpl<any, any>
|
|
503
|
+
return makeWith(client.postprocess as any, (request) => Effect.flatMap(client.preprocess(request), f))
|
|
572
504
|
})
|
|
573
505
|
|
|
574
506
|
/** @internal */
|
|
575
507
|
export const mapRequestInput = dual<
|
|
576
508
|
(
|
|
577
509
|
f: (a: ClientRequest.HttpClientRequest) => ClientRequest.HttpClientRequest
|
|
578
|
-
) => <
|
|
579
|
-
<
|
|
580
|
-
self: Client.HttpClient<
|
|
510
|
+
) => <E, R>(self: Client.HttpClient<E, R>) => Client.HttpClient<E, R>,
|
|
511
|
+
<E, R>(
|
|
512
|
+
self: Client.HttpClient<E, R>,
|
|
581
513
|
f: (a: ClientRequest.HttpClientRequest) => ClientRequest.HttpClientRequest
|
|
582
|
-
) => Client.HttpClient<
|
|
514
|
+
) => Client.HttpClient<E, R>
|
|
583
515
|
>(2, (self, f) => {
|
|
584
|
-
const client = self as HttpClientImpl<any, any
|
|
585
|
-
return
|
|
516
|
+
const client = self as HttpClientImpl<any, any>
|
|
517
|
+
return makeWith(client.postprocess, (request) => client.preprocess(f(request)))
|
|
586
518
|
})
|
|
587
519
|
|
|
588
520
|
/** @internal */
|
|
@@ -591,44 +523,42 @@ export const mapRequestInputEffect = dual<
|
|
|
591
523
|
f: (
|
|
592
524
|
a: ClientRequest.HttpClientRequest
|
|
593
525
|
) => Effect.Effect<ClientRequest.HttpClientRequest, E2, R2>
|
|
594
|
-
) => <
|
|
595
|
-
self: Client.HttpClient<
|
|
596
|
-
) => Client.HttpClient<
|
|
597
|
-
<
|
|
598
|
-
self: Client.HttpClient<
|
|
526
|
+
) => <E, R>(
|
|
527
|
+
self: Client.HttpClient<E, R>
|
|
528
|
+
) => Client.HttpClient<E | E2, R | R2>,
|
|
529
|
+
<E, R, E2, R2>(
|
|
530
|
+
self: Client.HttpClient<E, R>,
|
|
599
531
|
f: (
|
|
600
532
|
a: ClientRequest.HttpClientRequest
|
|
601
533
|
) => Effect.Effect<ClientRequest.HttpClientRequest, E2, R2>
|
|
602
|
-
) => Client.HttpClient<
|
|
534
|
+
) => Client.HttpClient<E | E2, R | R2>
|
|
603
535
|
>(2, (self, f) => {
|
|
604
|
-
const client = self as HttpClientImpl<any, any
|
|
605
|
-
return
|
|
536
|
+
const client = self as HttpClientImpl<any, any>
|
|
537
|
+
return makeWith(client.postprocess as any, (request) => Effect.flatMap(f(request), client.preprocess))
|
|
606
538
|
})
|
|
607
539
|
|
|
608
540
|
/** @internal */
|
|
609
541
|
export const retry: {
|
|
610
542
|
<E, O extends Effect.Retry.Options<E>>(
|
|
611
543
|
options: O
|
|
612
|
-
): <
|
|
613
|
-
self: Client.HttpClient<A, E, R>
|
|
614
|
-
) => Client.Retry.Return<R, E, A, O>
|
|
544
|
+
): <R>(self: Client.HttpClient<E, R>) => Client.Retry.Return<R, E, O>
|
|
615
545
|
<B, E, R1>(
|
|
616
546
|
policy: Schedule.Schedule<B, NoInfer<E>, R1>
|
|
617
|
-
): <
|
|
618
|
-
<
|
|
619
|
-
self: Client.HttpClient<
|
|
547
|
+
): <R>(self: Client.HttpClient<E, R>) => Client.HttpClient<E, R1 | R>
|
|
548
|
+
<E, R, O extends Effect.Retry.Options<E>>(
|
|
549
|
+
self: Client.HttpClient<E, R>,
|
|
620
550
|
options: O
|
|
621
|
-
): Client.Retry.Return<R, E,
|
|
622
|
-
<
|
|
623
|
-
self: Client.HttpClient<
|
|
551
|
+
): Client.Retry.Return<R, E, O>
|
|
552
|
+
<E, R, B, R1>(
|
|
553
|
+
self: Client.HttpClient<E, R>,
|
|
624
554
|
policy: Schedule.Schedule<B, E, R1>
|
|
625
|
-
): Client.HttpClient<
|
|
555
|
+
): Client.HttpClient<E, R1 | R>
|
|
626
556
|
} = dual(
|
|
627
557
|
2,
|
|
628
|
-
<
|
|
629
|
-
self: Client.HttpClient<
|
|
558
|
+
<E extends E0, E0, R, R1, B>(
|
|
559
|
+
self: Client.HttpClient<E, R>,
|
|
630
560
|
policy: Schedule.Schedule<B, E0, R1>
|
|
631
|
-
): Client.HttpClient<
|
|
561
|
+
): Client.HttpClient<E, R | R1> => transformResponse(self, Effect.retry(policy))
|
|
632
562
|
)
|
|
633
563
|
|
|
634
564
|
/** @internal */
|
|
@@ -638,23 +568,23 @@ export const retryTransient: {
|
|
|
638
568
|
readonly schedule?: Schedule.Schedule<B, NoInfer<E>, R1>
|
|
639
569
|
readonly times?: number
|
|
640
570
|
} | Schedule.Schedule<B, NoInfer<E>, R1>
|
|
641
|
-
): <
|
|
642
|
-
<
|
|
643
|
-
self: Client.HttpClient<
|
|
571
|
+
): <R>(self: Client.HttpClient<E, R>) => Client.HttpClient<E, R1 | R>
|
|
572
|
+
<E, R, B, R1 = never>(
|
|
573
|
+
self: Client.HttpClient<E, R>,
|
|
644
574
|
options: {
|
|
645
575
|
readonly schedule?: Schedule.Schedule<B, NoInfer<E>, R1>
|
|
646
576
|
readonly times?: number
|
|
647
577
|
} | Schedule.Schedule<B, NoInfer<E>, R1>
|
|
648
|
-
): Client.HttpClient<
|
|
578
|
+
): Client.HttpClient<E, R1 | R>
|
|
649
579
|
} = dual(
|
|
650
580
|
2,
|
|
651
|
-
<
|
|
652
|
-
self: Client.HttpClient<
|
|
581
|
+
<E extends E0, E0, R, B, R1 = never>(
|
|
582
|
+
self: Client.HttpClient<E, R>,
|
|
653
583
|
options: {
|
|
654
584
|
readonly schedule?: Schedule.Schedule<B, NoInfer<E>, R1>
|
|
655
585
|
readonly times?: number
|
|
656
586
|
} | Schedule.Schedule<B, NoInfer<E>, R1>
|
|
657
|
-
): Client.HttpClient<
|
|
587
|
+
): Client.HttpClient<E, R | R1> =>
|
|
658
588
|
transformResponse(
|
|
659
589
|
self,
|
|
660
590
|
Effect.retry({
|
|
@@ -668,94 +598,50 @@ export const retryTransient: {
|
|
|
668
598
|
)
|
|
669
599
|
)
|
|
670
600
|
|
|
671
|
-
/** @internal */
|
|
672
|
-
export const schemaFunction = dual<
|
|
673
|
-
<SA, SI, SR>(
|
|
674
|
-
schema: Schema.Schema<SA, SI, SR>,
|
|
675
|
-
options?: ParseOptions | undefined
|
|
676
|
-
) => <A, E, R>(
|
|
677
|
-
self: Client.HttpClient<A, E, R>
|
|
678
|
-
) => (
|
|
679
|
-
request: ClientRequest.HttpClientRequest
|
|
680
|
-
) => (
|
|
681
|
-
a: SA
|
|
682
|
-
) => Effect.Effect<A, E | ParseResult.ParseError | Error.RequestError, SR | R>,
|
|
683
|
-
<A, E, R, SA, SI, SR>(
|
|
684
|
-
self: Client.HttpClient<A, E, R>,
|
|
685
|
-
schema: Schema.Schema<SA, SI, SR>,
|
|
686
|
-
options?: ParseOptions | undefined
|
|
687
|
-
) => (
|
|
688
|
-
request: ClientRequest.HttpClientRequest
|
|
689
|
-
) => (
|
|
690
|
-
a: SA
|
|
691
|
-
) => Effect.Effect<A, E | ParseResult.ParseError | Error.RequestError, SR | R>
|
|
692
|
-
>((args) => isClient(args[0]), (self, schema, options) => {
|
|
693
|
-
const encode = Schema.encode(schema, options)
|
|
694
|
-
return (request) => (a) =>
|
|
695
|
-
Effect.flatMap(
|
|
696
|
-
Effect.tryMap(encode(a), {
|
|
697
|
-
try: (body) => new TextEncoder().encode(JSON.stringify(body)),
|
|
698
|
-
catch: (cause) =>
|
|
699
|
-
new Error.RequestError({
|
|
700
|
-
request,
|
|
701
|
-
reason: "Encode",
|
|
702
|
-
cause
|
|
703
|
-
})
|
|
704
|
-
}),
|
|
705
|
-
(body) =>
|
|
706
|
-
self.execute(
|
|
707
|
-
internalRequest.setBody(
|
|
708
|
-
request,
|
|
709
|
-
internalBody.uint8Array(body, "application/json")
|
|
710
|
-
)
|
|
711
|
-
)
|
|
712
|
-
)
|
|
713
|
-
})
|
|
714
|
-
|
|
715
601
|
/** @internal */
|
|
716
602
|
export const tap = dual<
|
|
717
|
-
<
|
|
718
|
-
f: (
|
|
719
|
-
) => <E, R>(self: Client.HttpClient<
|
|
720
|
-
<
|
|
721
|
-
self: Client.HttpClient<
|
|
722
|
-
f: (
|
|
723
|
-
) => Client.HttpClient<
|
|
603
|
+
<_, E2, R2>(
|
|
604
|
+
f: (response: ClientResponse.HttpClientResponse) => Effect.Effect<_, E2, R2>
|
|
605
|
+
) => <E, R>(self: Client.HttpClient<E, R>) => Client.HttpClient<E | E2, R | R2>,
|
|
606
|
+
<E, R, _, E2, R2>(
|
|
607
|
+
self: Client.HttpClient<E, R>,
|
|
608
|
+
f: (response: ClientResponse.HttpClientResponse) => Effect.Effect<_, E2, R2>
|
|
609
|
+
) => Client.HttpClient<E | E2, R | R2>
|
|
724
610
|
>(2, (self, f) => transformResponse(self, Effect.tap(f)))
|
|
725
611
|
|
|
726
612
|
/** @internal */
|
|
727
613
|
export const tapRequest = dual<
|
|
728
614
|
<_, E2, R2>(
|
|
729
615
|
f: (a: ClientRequest.HttpClientRequest) => Effect.Effect<_, E2, R2>
|
|
730
|
-
) => <
|
|
731
|
-
self: Client.HttpClient<
|
|
732
|
-
) => Client.HttpClient<
|
|
733
|
-
<
|
|
734
|
-
self: Client.HttpClient<
|
|
616
|
+
) => <E, R>(
|
|
617
|
+
self: Client.HttpClient<E, R>
|
|
618
|
+
) => Client.HttpClient<E | E2, R | R2>,
|
|
619
|
+
<E, R, _, E2, R2>(
|
|
620
|
+
self: Client.HttpClient<E, R>,
|
|
735
621
|
f: (a: ClientRequest.HttpClientRequest) => Effect.Effect<_, E2, R2>
|
|
736
|
-
) => Client.HttpClient<
|
|
622
|
+
) => Client.HttpClient<E | E2, R | R2>
|
|
737
623
|
>(2, (self, f) => {
|
|
738
|
-
const client = self as HttpClientImpl<any, any
|
|
739
|
-
return
|
|
624
|
+
const client = self as HttpClientImpl<any, any>
|
|
625
|
+
return makeWith(client.postprocess as any, (request) => Effect.tap(client.preprocess(request), f))
|
|
740
626
|
})
|
|
741
627
|
|
|
742
628
|
/** @internal */
|
|
743
629
|
export const withCookiesRef = dual<
|
|
744
630
|
(
|
|
745
631
|
ref: Ref.Ref<Cookies.Cookies>
|
|
746
|
-
) => <E, R>(self: Client.HttpClient
|
|
632
|
+
) => <E, R>(self: Client.HttpClient<E, R>) => Client.HttpClient<E, R>,
|
|
747
633
|
<E, R>(
|
|
748
|
-
self: Client.HttpClient
|
|
634
|
+
self: Client.HttpClient<E, R>,
|
|
749
635
|
ref: Ref.Ref<Cookies.Cookies>
|
|
750
|
-
) => Client.HttpClient
|
|
636
|
+
) => Client.HttpClient<E, R>
|
|
751
637
|
>(
|
|
752
638
|
2,
|
|
753
639
|
<E, R>(
|
|
754
|
-
self: Client.HttpClient
|
|
640
|
+
self: Client.HttpClient<E, R>,
|
|
755
641
|
ref: Ref.Ref<Cookies.Cookies>
|
|
756
|
-
): Client.HttpClient
|
|
757
|
-
const client = self as HttpClientImpl<
|
|
758
|
-
return
|
|
642
|
+
): Client.HttpClient<E, R> => {
|
|
643
|
+
const client = self as HttpClientImpl<E, R>
|
|
644
|
+
return makeWith(
|
|
759
645
|
(request: Effect.Effect<ClientRequest.HttpClientRequest, E, R>) =>
|
|
760
646
|
Effect.tap(
|
|
761
647
|
client.postprocess(request),
|
|
@@ -778,17 +664,17 @@ export const withCookiesRef = dual<
|
|
|
778
664
|
export const followRedirects = dual<
|
|
779
665
|
(
|
|
780
666
|
maxRedirects?: number | undefined
|
|
781
|
-
) => <E, R>(self: Client.HttpClient
|
|
667
|
+
) => <E, R>(self: Client.HttpClient<E, R>) => Client.HttpClient<E, R>,
|
|
782
668
|
<E, R>(
|
|
783
|
-
self: Client.HttpClient
|
|
669
|
+
self: Client.HttpClient<E, R>,
|
|
784
670
|
maxRedirects?: number | undefined
|
|
785
|
-
) => Client.HttpClient
|
|
671
|
+
) => Client.HttpClient<E, R>
|
|
786
672
|
>((args) => isClient(args[0]), <E, R>(
|
|
787
|
-
self: Client.HttpClient
|
|
673
|
+
self: Client.HttpClient<E, R>,
|
|
788
674
|
maxRedirects?: number | undefined
|
|
789
|
-
): Client.HttpClient
|
|
790
|
-
const client = self as HttpClientImpl<
|
|
791
|
-
return
|
|
675
|
+
): Client.HttpClient<E, R> => {
|
|
676
|
+
const client = self as HttpClientImpl<E, R>
|
|
677
|
+
return makeWith(
|
|
792
678
|
(request) => {
|
|
793
679
|
const loop = (
|
|
794
680
|
request: ClientRequest.HttpClientRequest,
|
|
@@ -815,7 +701,9 @@ export const followRedirects = dual<
|
|
|
815
701
|
})
|
|
816
702
|
|
|
817
703
|
/** @internal */
|
|
818
|
-
export const layerMergedContext = <E, R>(
|
|
704
|
+
export const layerMergedContext = <E, R>(
|
|
705
|
+
effect: Effect.Effect<Client.HttpClient, E, R>
|
|
706
|
+
): Layer.Layer<Client.HttpClient, E, R> =>
|
|
819
707
|
Layer.effect(
|
|
820
708
|
tag,
|
|
821
709
|
Effect.flatMap(Effect.context<never>(), (context) =>
|