@effect/platform 0.71.7 → 0.72.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/HttpClient.js.map +1 -1
- package/dist/cjs/internal/httpClient.js.map +1 -1
- package/dist/dts/HttpClient.d.ts +59 -53
- package/dist/dts/HttpClient.d.ts.map +1 -1
- package/dist/dts/internal/httpClient.d.ts +8 -8
- package/dist/dts/internal/httpClient.d.ts.map +1 -1
- package/dist/esm/HttpClient.js.map +1 -1
- package/dist/esm/internal/httpClient.js.map +1 -1
- package/package.json +2 -2
- package/src/HttpClient.ts +97 -87
- package/src/internal/httpClient.ts +80 -80
|
@@ -100,9 +100,9 @@ const ClientProto = {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
const isClient = (u: unknown): u is Client.HttpClient<unknown, unknown> => Predicate.hasProperty(u, TypeId)
|
|
103
|
+
const isClient = (u: unknown): u is Client.HttpClient.With<unknown, unknown> => Predicate.hasProperty(u, TypeId)
|
|
104
104
|
|
|
105
|
-
interface HttpClientImpl<E, R> extends Client.HttpClient<E, R> {
|
|
105
|
+
interface HttpClientImpl<E, R> extends Client.HttpClient.With<E, R> {
|
|
106
106
|
readonly preprocess: Client.HttpClient.Preprocess<E, R>
|
|
107
107
|
readonly postprocess: Client.HttpClient.Postprocess<E, R>
|
|
108
108
|
}
|
|
@@ -113,7 +113,7 @@ export const makeWith = <E2, R2, E, R>(
|
|
|
113
113
|
request: Effect.Effect<ClientRequest.HttpClientRequest, E2, R2>
|
|
114
114
|
) => Effect.Effect<ClientResponse.HttpClientResponse, E, R>,
|
|
115
115
|
preprocess: Client.HttpClient.Preprocess<E2, R2>
|
|
116
|
-
): Client.HttpClient<E, R> => {
|
|
116
|
+
): Client.HttpClient.With<E, R> => {
|
|
117
117
|
const self = Object.create(ClientProto)
|
|
118
118
|
self.preprocess = preprocess
|
|
119
119
|
self.postprocess = postprocess
|
|
@@ -226,14 +226,14 @@ export const transform = dual<
|
|
|
226
226
|
effect: Effect.Effect<ClientResponse.HttpClientResponse, E, R>,
|
|
227
227
|
request: ClientRequest.HttpClientRequest
|
|
228
228
|
) => Effect.Effect<ClientResponse.HttpClientResponse, E1, R1>
|
|
229
|
-
) => (self: Client.HttpClient<E, R>) => Client.HttpClient<E | E1, R | R1>,
|
|
229
|
+
) => (self: Client.HttpClient.With<E, R>) => Client.HttpClient.With<E | E1, R | R1>,
|
|
230
230
|
<E, R, E1, R1>(
|
|
231
|
-
self: Client.HttpClient<E, R>,
|
|
231
|
+
self: Client.HttpClient.With<E, R>,
|
|
232
232
|
f: (
|
|
233
233
|
effect: Effect.Effect<ClientResponse.HttpClientResponse, E, R>,
|
|
234
234
|
request: ClientRequest.HttpClientRequest
|
|
235
235
|
) => Effect.Effect<ClientResponse.HttpClientResponse, E1, R1>
|
|
236
|
-
) => Client.HttpClient<E | E1, R | R1>
|
|
236
|
+
) => Client.HttpClient.With<E | E1, R | R1>
|
|
237
237
|
>(2, (self, f) => {
|
|
238
238
|
const client = self as HttpClientImpl<any, any>
|
|
239
239
|
return makeWith(
|
|
@@ -247,18 +247,18 @@ export const filterStatus = dual<
|
|
|
247
247
|
(
|
|
248
248
|
f: (status: number) => boolean
|
|
249
249
|
) => <E, R>(
|
|
250
|
-
self: Client.HttpClient<E, R>
|
|
251
|
-
) => Client.HttpClient<E | Error.ResponseError, R>,
|
|
250
|
+
self: Client.HttpClient.With<E, R>
|
|
251
|
+
) => Client.HttpClient.With<E | Error.ResponseError, R>,
|
|
252
252
|
<E, R>(
|
|
253
|
-
self: Client.HttpClient<E, R>,
|
|
253
|
+
self: Client.HttpClient.With<E, R>,
|
|
254
254
|
f: (status: number) => boolean
|
|
255
|
-
) => Client.HttpClient<E | Error.ResponseError, R>
|
|
255
|
+
) => Client.HttpClient.With<E | Error.ResponseError, R>
|
|
256
256
|
>(2, (self, f) => transformResponse(self, Effect.flatMap(internalResponse.filterStatus(f))))
|
|
257
257
|
|
|
258
258
|
/** @internal */
|
|
259
259
|
export const filterStatusOk = <E, R>(
|
|
260
|
-
self: Client.HttpClient<E, R>
|
|
261
|
-
): Client.HttpClient<E | Error.ResponseError, R> =>
|
|
260
|
+
self: Client.HttpClient.With<E, R>
|
|
261
|
+
): Client.HttpClient.With<E | Error.ResponseError, R> =>
|
|
262
262
|
transformResponse(self, Effect.flatMap(internalResponse.filterStatusOk))
|
|
263
263
|
|
|
264
264
|
/** @internal */
|
|
@@ -267,13 +267,13 @@ export const transformResponse = dual<
|
|
|
267
267
|
f: (
|
|
268
268
|
effect: Effect.Effect<ClientResponse.HttpClientResponse, E, R>
|
|
269
269
|
) => Effect.Effect<ClientResponse.HttpClientResponse, E1, R1>
|
|
270
|
-
) => (self: Client.HttpClient<E, R>) => Client.HttpClient<E1, R1>,
|
|
270
|
+
) => (self: Client.HttpClient.With<E, R>) => Client.HttpClient.With<E1, R1>,
|
|
271
271
|
<E, R, E1, R1>(
|
|
272
|
-
self: Client.HttpClient<E, R>,
|
|
272
|
+
self: Client.HttpClient.With<E, R>,
|
|
273
273
|
f: (
|
|
274
274
|
effect: Effect.Effect<ClientResponse.HttpClientResponse, E, R>
|
|
275
275
|
) => Effect.Effect<ClientResponse.HttpClientResponse, E1, R1>
|
|
276
|
-
) => Client.HttpClient<E1, R1>
|
|
276
|
+
) => Client.HttpClient.With<E1, R1>
|
|
277
277
|
>(2, (self, f) => {
|
|
278
278
|
const client = self as HttpClientImpl<any, any>
|
|
279
279
|
return makeWith((request) => f(client.postprocess(request)), client.preprocess)
|
|
@@ -284,7 +284,7 @@ export const catchTag: {
|
|
|
284
284
|
<K extends E extends { _tag: string } ? E["_tag"] : never, E, E1, R1>(
|
|
285
285
|
tag: K,
|
|
286
286
|
f: (e: Extract<E, { _tag: K }>) => Effect.Effect<ClientResponse.HttpClientResponse, E1, R1>
|
|
287
|
-
): <R>(self: Client.HttpClient<E, R>) => Client.HttpClient<E1 | Exclude<E, { _tag: K }>, R1 | R>
|
|
287
|
+
): <R>(self: Client.HttpClient.With<E, R>) => Client.HttpClient.With<E1 | Exclude<E, { _tag: K }>, R1 | R>
|
|
288
288
|
<
|
|
289
289
|
R,
|
|
290
290
|
E,
|
|
@@ -292,10 +292,10 @@ export const catchTag: {
|
|
|
292
292
|
R1,
|
|
293
293
|
E1
|
|
294
294
|
>(
|
|
295
|
-
self: Client.HttpClient<E, R>,
|
|
295
|
+
self: Client.HttpClient.With<E, R>,
|
|
296
296
|
tag: K,
|
|
297
297
|
f: (e: Extract<E, { _tag: K }>) => Effect.Effect<ClientResponse.HttpClientResponse, E1, R1>
|
|
298
|
-
): Client.HttpClient<E1 | Exclude<E, { _tag: K }>, R1 | R>
|
|
298
|
+
): Client.HttpClient.With<E1 | Exclude<E, { _tag: K }>, R1 | R>
|
|
299
299
|
} = dual(
|
|
300
300
|
3,
|
|
301
301
|
<
|
|
@@ -305,10 +305,10 @@ export const catchTag: {
|
|
|
305
305
|
R1,
|
|
306
306
|
E1
|
|
307
307
|
>(
|
|
308
|
-
self: Client.HttpClient<E, R>,
|
|
308
|
+
self: Client.HttpClient.With<E, R>,
|
|
309
309
|
tag: K,
|
|
310
310
|
f: (e: Extract<E, { _tag: K }>) => Effect.Effect<ClientResponse.HttpClientResponse, E1, R1>
|
|
311
|
-
): Client.HttpClient<E1 | Exclude<E, { _tag: K }>, R1 | R> => transformResponse(self, Effect.catchTag(tag, f))
|
|
311
|
+
): Client.HttpClient.With<E1 | Exclude<E, { _tag: K }>, R1 | R> => transformResponse(self, Effect.catchTag(tag, f))
|
|
312
312
|
)
|
|
313
313
|
|
|
314
314
|
/** @internal */
|
|
@@ -332,7 +332,7 @@ export const catchTags: {
|
|
|
332
332
|
})
|
|
333
333
|
>(
|
|
334
334
|
cases: Cases
|
|
335
|
-
): <R>(self: Client.HttpClient<E, R>) => Client.HttpClient<
|
|
335
|
+
): <R>(self: Client.HttpClient.With<E, R>) => Client.HttpClient.With<
|
|
336
336
|
| Exclude<E, { _tag: keyof Cases }>
|
|
337
337
|
| {
|
|
338
338
|
[K in keyof Cases]: Cases[K] extends (
|
|
@@ -367,9 +367,9 @@ export const catchTags: {
|
|
|
367
367
|
]: never
|
|
368
368
|
})
|
|
369
369
|
>(
|
|
370
|
-
self: Client.HttpClient<E, R>,
|
|
370
|
+
self: Client.HttpClient.With<E, R>,
|
|
371
371
|
cases: Cases
|
|
372
|
-
): Client.HttpClient<
|
|
372
|
+
): Client.HttpClient.With<
|
|
373
373
|
| Exclude<E, { _tag: keyof Cases }>
|
|
374
374
|
| {
|
|
375
375
|
[K in keyof Cases]: Cases[K] extends (
|
|
@@ -406,9 +406,9 @@ export const catchTags: {
|
|
|
406
406
|
]: never
|
|
407
407
|
})
|
|
408
408
|
>(
|
|
409
|
-
self: Client.HttpClient<E, R>,
|
|
409
|
+
self: Client.HttpClient.With<E, R>,
|
|
410
410
|
cases: Cases
|
|
411
|
-
): Client.HttpClient<
|
|
411
|
+
): Client.HttpClient.With<
|
|
412
412
|
| Exclude<E, { _tag: keyof Cases }>
|
|
413
413
|
| {
|
|
414
414
|
[K in keyof Cases]: Cases[K] extends (
|
|
@@ -430,17 +430,17 @@ export const catchTags: {
|
|
|
430
430
|
export const catchAll: {
|
|
431
431
|
<E, E2, R2>(
|
|
432
432
|
f: (e: E) => Effect.Effect<ClientResponse.HttpClientResponse, E2, R2>
|
|
433
|
-
): <R>(self: Client.HttpClient<E, R>) => Client.HttpClient<E2, R | R2>
|
|
433
|
+
): <R>(self: Client.HttpClient.With<E, R>) => Client.HttpClient.With<E2, R | R2>
|
|
434
434
|
<E, R, E2, R2>(
|
|
435
|
-
self: Client.HttpClient<E, R>,
|
|
435
|
+
self: Client.HttpClient.With<E, R>,
|
|
436
436
|
f: (e: E) => Effect.Effect<ClientResponse.HttpClientResponse, E2, R2>
|
|
437
|
-
): Client.HttpClient<E2, R | R2>
|
|
437
|
+
): Client.HttpClient.With<E2, R | R2>
|
|
438
438
|
} = dual(
|
|
439
439
|
2,
|
|
440
440
|
<E, R, E2, R2>(
|
|
441
|
-
self: Client.HttpClient<E, R>,
|
|
441
|
+
self: Client.HttpClient.With<E, R>,
|
|
442
442
|
f: (e: E) => Effect.Effect<ClientResponse.HttpClientResponse, E2, R2>
|
|
443
|
-
): Client.HttpClient<E2, R | R2> => transformResponse(self, Effect.catchAll(f))
|
|
443
|
+
): Client.HttpClient.With<E2, R | R2> => transformResponse(self, Effect.catchAll(f))
|
|
444
444
|
)
|
|
445
445
|
|
|
446
446
|
/** @internal */
|
|
@@ -449,13 +449,13 @@ export const filterOrElse: {
|
|
|
449
449
|
predicate: Predicate.Predicate<ClientResponse.HttpClientResponse>,
|
|
450
450
|
orElse: (response: ClientResponse.HttpClientResponse) => Effect.Effect<ClientResponse.HttpClientResponse, E2, R2>
|
|
451
451
|
): <E, R>(
|
|
452
|
-
self: Client.HttpClient<E, R>
|
|
453
|
-
) => Client.HttpClient<E2 | E, R2 | R>
|
|
452
|
+
self: Client.HttpClient.With<E, R>
|
|
453
|
+
) => Client.HttpClient.With<E2 | E, R2 | R>
|
|
454
454
|
<E, R, E2, R2>(
|
|
455
|
-
self: Client.HttpClient<E, R>,
|
|
455
|
+
self: Client.HttpClient.With<E, R>,
|
|
456
456
|
predicate: Predicate.Predicate<ClientResponse.HttpClientResponse>,
|
|
457
457
|
orElse: (response: ClientResponse.HttpClientResponse) => Effect.Effect<ClientResponse.HttpClientResponse, E2, R2>
|
|
458
|
-
): Client.HttpClient<E2 | E, R2 | R>
|
|
458
|
+
): Client.HttpClient.With<E2 | E, R2 | R>
|
|
459
459
|
} = dual(3, (self, f, orElse) => transformResponse(self, Effect.filterOrElse(f, orElse)))
|
|
460
460
|
|
|
461
461
|
/** @internal */
|
|
@@ -463,23 +463,23 @@ export const filterOrFail: {
|
|
|
463
463
|
<E2>(
|
|
464
464
|
predicate: Predicate.Predicate<ClientResponse.HttpClientResponse>,
|
|
465
465
|
orFailWith: (response: ClientResponse.HttpClientResponse) => E2
|
|
466
|
-
): <E, R>(self: Client.HttpClient<E, R>) => Client.HttpClient<E2 | E, R>
|
|
466
|
+
): <E, R>(self: Client.HttpClient.With<E, R>) => Client.HttpClient.With<E2 | E, R>
|
|
467
467
|
<E, R, E2>(
|
|
468
|
-
self: Client.HttpClient<E, R>,
|
|
468
|
+
self: Client.HttpClient.With<E, R>,
|
|
469
469
|
predicate: Predicate.Predicate<ClientResponse.HttpClientResponse>,
|
|
470
470
|
orFailWith: (response: ClientResponse.HttpClientResponse) => E2
|
|
471
|
-
): Client.HttpClient<E2 | E, R>
|
|
471
|
+
): Client.HttpClient.With<E2 | E, R>
|
|
472
472
|
} = dual(3, (self, f, orFailWith) => transformResponse(self, Effect.filterOrFail(f, orFailWith)))
|
|
473
473
|
|
|
474
474
|
/** @internal */
|
|
475
475
|
export const mapRequest = dual<
|
|
476
476
|
(
|
|
477
477
|
f: (a: ClientRequest.HttpClientRequest) => ClientRequest.HttpClientRequest
|
|
478
|
-
) => <E, R>(self: Client.HttpClient<E, R>) => Client.HttpClient<E, R>,
|
|
478
|
+
) => <E, R>(self: Client.HttpClient.With<E, R>) => Client.HttpClient.With<E, R>,
|
|
479
479
|
<E, R>(
|
|
480
|
-
self: Client.HttpClient<E, R>,
|
|
480
|
+
self: Client.HttpClient.With<E, R>,
|
|
481
481
|
f: (a: ClientRequest.HttpClientRequest) => ClientRequest.HttpClientRequest
|
|
482
|
-
) => Client.HttpClient<E, R>
|
|
482
|
+
) => Client.HttpClient.With<E, R>
|
|
483
483
|
>(2, (self, f) => {
|
|
484
484
|
const client = self as HttpClientImpl<any, any>
|
|
485
485
|
return makeWith(client.postprocess, (request) => Effect.map(client.preprocess(request), f))
|
|
@@ -492,14 +492,14 @@ export const mapRequestEffect = dual<
|
|
|
492
492
|
a: ClientRequest.HttpClientRequest
|
|
493
493
|
) => Effect.Effect<ClientRequest.HttpClientRequest, E2, R2>
|
|
494
494
|
) => <E, R>(
|
|
495
|
-
self: Client.HttpClient<E, R>
|
|
496
|
-
) => Client.HttpClient<E | E2, R | R2>,
|
|
495
|
+
self: Client.HttpClient.With<E, R>
|
|
496
|
+
) => Client.HttpClient.With<E | E2, R | R2>,
|
|
497
497
|
<E, R, E2, R2>(
|
|
498
|
-
self: Client.HttpClient<E, R>,
|
|
498
|
+
self: Client.HttpClient.With<E, R>,
|
|
499
499
|
f: (
|
|
500
500
|
a: ClientRequest.HttpClientRequest
|
|
501
501
|
) => Effect.Effect<ClientRequest.HttpClientRequest, E2, R2>
|
|
502
|
-
) => Client.HttpClient<E | E2, R | R2>
|
|
502
|
+
) => Client.HttpClient.With<E | E2, R | R2>
|
|
503
503
|
>(2, (self, f) => {
|
|
504
504
|
const client = self as HttpClientImpl<any, any>
|
|
505
505
|
return makeWith(client.postprocess as any, (request) => Effect.flatMap(client.preprocess(request), f))
|
|
@@ -509,11 +509,11 @@ export const mapRequestEffect = dual<
|
|
|
509
509
|
export const mapRequestInput = dual<
|
|
510
510
|
(
|
|
511
511
|
f: (a: ClientRequest.HttpClientRequest) => ClientRequest.HttpClientRequest
|
|
512
|
-
) => <E, R>(self: Client.HttpClient<E, R>) => Client.HttpClient<E, R>,
|
|
512
|
+
) => <E, R>(self: Client.HttpClient.With<E, R>) => Client.HttpClient.With<E, R>,
|
|
513
513
|
<E, R>(
|
|
514
|
-
self: Client.HttpClient<E, R>,
|
|
514
|
+
self: Client.HttpClient.With<E, R>,
|
|
515
515
|
f: (a: ClientRequest.HttpClientRequest) => ClientRequest.HttpClientRequest
|
|
516
|
-
) => Client.HttpClient<E, R>
|
|
516
|
+
) => Client.HttpClient.With<E, R>
|
|
517
517
|
>(2, (self, f) => {
|
|
518
518
|
const client = self as HttpClientImpl<any, any>
|
|
519
519
|
return makeWith(client.postprocess, (request) => client.preprocess(f(request)))
|
|
@@ -526,14 +526,14 @@ export const mapRequestInputEffect = dual<
|
|
|
526
526
|
a: ClientRequest.HttpClientRequest
|
|
527
527
|
) => Effect.Effect<ClientRequest.HttpClientRequest, E2, R2>
|
|
528
528
|
) => <E, R>(
|
|
529
|
-
self: Client.HttpClient<E, R>
|
|
530
|
-
) => Client.HttpClient<E | E2, R | R2>,
|
|
529
|
+
self: Client.HttpClient.With<E, R>
|
|
530
|
+
) => Client.HttpClient.With<E | E2, R | R2>,
|
|
531
531
|
<E, R, E2, R2>(
|
|
532
|
-
self: Client.HttpClient<E, R>,
|
|
532
|
+
self: Client.HttpClient.With<E, R>,
|
|
533
533
|
f: (
|
|
534
534
|
a: ClientRequest.HttpClientRequest
|
|
535
535
|
) => Effect.Effect<ClientRequest.HttpClientRequest, E2, R2>
|
|
536
|
-
) => Client.HttpClient<E | E2, R | R2>
|
|
536
|
+
) => Client.HttpClient.With<E | E2, R | R2>
|
|
537
537
|
>(2, (self, f) => {
|
|
538
538
|
const client = self as HttpClientImpl<any, any>
|
|
539
539
|
return makeWith(client.postprocess as any, (request) => Effect.flatMap(f(request), client.preprocess))
|
|
@@ -543,24 +543,24 @@ export const mapRequestInputEffect = dual<
|
|
|
543
543
|
export const retry: {
|
|
544
544
|
<E, O extends Effect.Retry.Options<E>>(
|
|
545
545
|
options: O
|
|
546
|
-
): <R>(self: Client.HttpClient<E, R>) => Client.Retry.Return<R, E, O>
|
|
546
|
+
): <R>(self: Client.HttpClient.With<E, R>) => Client.Retry.Return<R, E, O>
|
|
547
547
|
<B, E, R1>(
|
|
548
548
|
policy: Schedule.Schedule<B, NoInfer<E>, R1>
|
|
549
|
-
): <R>(self: Client.HttpClient<E, R>) => Client.HttpClient<E, R1 | R>
|
|
549
|
+
): <R>(self: Client.HttpClient.With<E, R>) => Client.HttpClient.With<E, R1 | R>
|
|
550
550
|
<E, R, O extends Effect.Retry.Options<E>>(
|
|
551
|
-
self: Client.HttpClient<E, R>,
|
|
551
|
+
self: Client.HttpClient.With<E, R>,
|
|
552
552
|
options: O
|
|
553
553
|
): Client.Retry.Return<R, E, O>
|
|
554
554
|
<E, R, B, R1>(
|
|
555
|
-
self: Client.HttpClient<E, R>,
|
|
555
|
+
self: Client.HttpClient.With<E, R>,
|
|
556
556
|
policy: Schedule.Schedule<B, E, R1>
|
|
557
|
-
): Client.HttpClient<E, R1 | R>
|
|
557
|
+
): Client.HttpClient.With<E, R1 | R>
|
|
558
558
|
} = dual(
|
|
559
559
|
2,
|
|
560
560
|
<E extends E0, E0, R, R1, B>(
|
|
561
|
-
self: Client.HttpClient<E, R>,
|
|
561
|
+
self: Client.HttpClient.With<E, R>,
|
|
562
562
|
policy: Schedule.Schedule<B, E0, R1>
|
|
563
|
-
): Client.HttpClient<E, R | R1> => transformResponse(self, Effect.retry(policy))
|
|
563
|
+
): Client.HttpClient.With<E, R | R1> => transformResponse(self, Effect.retry(policy))
|
|
564
564
|
)
|
|
565
565
|
|
|
566
566
|
/** @internal */
|
|
@@ -571,25 +571,25 @@ export const retryTransient: {
|
|
|
571
571
|
readonly schedule?: Schedule.Schedule<B, NoInfer<E>, R1>
|
|
572
572
|
readonly times?: number
|
|
573
573
|
} | Schedule.Schedule<B, NoInfer<E>, R1>
|
|
574
|
-
): <R>(self: Client.HttpClient<E, R>) => Client.HttpClient<E, R1 | R>
|
|
574
|
+
): <R>(self: Client.HttpClient.With<E, R>) => Client.HttpClient.With<E, R1 | R>
|
|
575
575
|
<E, R, B, R1 = never>(
|
|
576
|
-
self: Client.HttpClient<E, R>,
|
|
576
|
+
self: Client.HttpClient.With<E, R>,
|
|
577
577
|
options: {
|
|
578
578
|
readonly while?: Predicate.Predicate<NoInfer<E>>
|
|
579
579
|
readonly schedule?: Schedule.Schedule<B, NoInfer<E>, R1>
|
|
580
580
|
readonly times?: number
|
|
581
581
|
} | Schedule.Schedule<B, NoInfer<E>, R1>
|
|
582
|
-
): Client.HttpClient<E, R1 | R>
|
|
582
|
+
): Client.HttpClient.With<E, R1 | R>
|
|
583
583
|
} = dual(
|
|
584
584
|
2,
|
|
585
585
|
<E extends E0, E0, R, B, R1 = never>(
|
|
586
|
-
self: Client.HttpClient<E, R>,
|
|
586
|
+
self: Client.HttpClient.With<E, R>,
|
|
587
587
|
options: {
|
|
588
588
|
readonly while?: Predicate.Predicate<NoInfer<E>>
|
|
589
589
|
readonly schedule?: Schedule.Schedule<B, NoInfer<E>, R1>
|
|
590
590
|
readonly times?: number
|
|
591
591
|
} | Schedule.Schedule<B, NoInfer<E>, R1>
|
|
592
|
-
): Client.HttpClient<E, R | R1> =>
|
|
592
|
+
): Client.HttpClient.With<E, R | R1> =>
|
|
593
593
|
transformResponse(
|
|
594
594
|
self,
|
|
595
595
|
Effect.retry({
|
|
@@ -614,11 +614,11 @@ const isTransientHttpError = (error: unknown) =>
|
|
|
614
614
|
export const tap = dual<
|
|
615
615
|
<_, E2, R2>(
|
|
616
616
|
f: (response: ClientResponse.HttpClientResponse) => Effect.Effect<_, E2, R2>
|
|
617
|
-
) => <E, R>(self: Client.HttpClient<E, R>) => Client.HttpClient<E | E2, R | R2>,
|
|
617
|
+
) => <E, R>(self: Client.HttpClient.With<E, R>) => Client.HttpClient.With<E | E2, R | R2>,
|
|
618
618
|
<E, R, _, E2, R2>(
|
|
619
|
-
self: Client.HttpClient<E, R>,
|
|
619
|
+
self: Client.HttpClient.With<E, R>,
|
|
620
620
|
f: (response: ClientResponse.HttpClientResponse) => Effect.Effect<_, E2, R2>
|
|
621
|
-
) => Client.HttpClient<E | E2, R | R2>
|
|
621
|
+
) => Client.HttpClient.With<E | E2, R | R2>
|
|
622
622
|
>(2, (self, f) => transformResponse(self, Effect.tap(f)))
|
|
623
623
|
|
|
624
624
|
/** @internal */
|
|
@@ -626,12 +626,12 @@ export const tapRequest = dual<
|
|
|
626
626
|
<_, E2, R2>(
|
|
627
627
|
f: (a: ClientRequest.HttpClientRequest) => Effect.Effect<_, E2, R2>
|
|
628
628
|
) => <E, R>(
|
|
629
|
-
self: Client.HttpClient<E, R>
|
|
630
|
-
) => Client.HttpClient<E | E2, R | R2>,
|
|
629
|
+
self: Client.HttpClient.With<E, R>
|
|
630
|
+
) => Client.HttpClient.With<E | E2, R | R2>,
|
|
631
631
|
<E, R, _, E2, R2>(
|
|
632
|
-
self: Client.HttpClient<E, R>,
|
|
632
|
+
self: Client.HttpClient.With<E, R>,
|
|
633
633
|
f: (a: ClientRequest.HttpClientRequest) => Effect.Effect<_, E2, R2>
|
|
634
|
-
) => Client.HttpClient<E | E2, R | R2>
|
|
634
|
+
) => Client.HttpClient.With<E | E2, R | R2>
|
|
635
635
|
>(2, (self, f) => {
|
|
636
636
|
const client = self as HttpClientImpl<any, any>
|
|
637
637
|
return makeWith(client.postprocess as any, (request) => Effect.tap(client.preprocess(request), f))
|
|
@@ -641,17 +641,17 @@ export const tapRequest = dual<
|
|
|
641
641
|
export const withCookiesRef = dual<
|
|
642
642
|
(
|
|
643
643
|
ref: Ref.Ref<Cookies.Cookies>
|
|
644
|
-
) => <E, R>(self: Client.HttpClient<E, R>) => Client.HttpClient<E, R>,
|
|
644
|
+
) => <E, R>(self: Client.HttpClient.With<E, R>) => Client.HttpClient.With<E, R>,
|
|
645
645
|
<E, R>(
|
|
646
|
-
self: Client.HttpClient<E, R>,
|
|
646
|
+
self: Client.HttpClient.With<E, R>,
|
|
647
647
|
ref: Ref.Ref<Cookies.Cookies>
|
|
648
|
-
) => Client.HttpClient<E, R>
|
|
648
|
+
) => Client.HttpClient.With<E, R>
|
|
649
649
|
>(
|
|
650
650
|
2,
|
|
651
651
|
<E, R>(
|
|
652
|
-
self: Client.HttpClient<E, R>,
|
|
652
|
+
self: Client.HttpClient.With<E, R>,
|
|
653
653
|
ref: Ref.Ref<Cookies.Cookies>
|
|
654
|
-
): Client.HttpClient<E, R> => {
|
|
654
|
+
): Client.HttpClient.With<E, R> => {
|
|
655
655
|
const client = self as HttpClientImpl<E, R>
|
|
656
656
|
return makeWith(
|
|
657
657
|
(request: Effect.Effect<ClientRequest.HttpClientRequest, E, R>) =>
|
|
@@ -676,15 +676,15 @@ export const withCookiesRef = dual<
|
|
|
676
676
|
export const followRedirects = dual<
|
|
677
677
|
(
|
|
678
678
|
maxRedirects?: number | undefined
|
|
679
|
-
) => <E, R>(self: Client.HttpClient<E, R>) => Client.HttpClient<E, R>,
|
|
679
|
+
) => <E, R>(self: Client.HttpClient.With<E, R>) => Client.HttpClient.With<E, R>,
|
|
680
680
|
<E, R>(
|
|
681
|
-
self: Client.HttpClient<E, R>,
|
|
681
|
+
self: Client.HttpClient.With<E, R>,
|
|
682
682
|
maxRedirects?: number | undefined
|
|
683
|
-
) => Client.HttpClient<E, R>
|
|
683
|
+
) => Client.HttpClient.With<E, R>
|
|
684
684
|
>((args) => isClient(args[0]), <E, R>(
|
|
685
|
-
self: Client.HttpClient<E, R>,
|
|
685
|
+
self: Client.HttpClient.With<E, R>,
|
|
686
686
|
maxRedirects?: number | undefined
|
|
687
|
-
): Client.HttpClient<E, R> => {
|
|
687
|
+
): Client.HttpClient.With<E, R> => {
|
|
688
688
|
const client = self as HttpClientImpl<E, R>
|
|
689
689
|
return makeWith(
|
|
690
690
|
(request) => {
|