@effect/platform 0.65.3 → 0.65.5
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 +276 -62
- package/dist/cjs/HttpClient.js +38 -0
- package/dist/cjs/HttpClient.js.map +1 -1
- package/dist/cjs/internal/httpMiddleware.js +2 -2
- package/dist/cjs/internal/httpMiddleware.js.map +1 -1
- package/dist/dts/HttpClient.d.ts +38 -0
- package/dist/dts/HttpClient.d.ts.map +1 -1
- package/dist/esm/HttpClient.js +38 -0
- package/dist/esm/HttpClient.js.map +1 -1
- package/dist/esm/internal/httpMiddleware.js +2 -2
- package/dist/esm/internal/httpMiddleware.js.map +1 -1
- package/package.json +3 -3
- package/src/HttpClient.ts +38 -0
- package/src/internal/httpMiddleware.ts +2 -2
package/src/HttpClient.ts
CHANGED
|
@@ -170,6 +170,8 @@ export const catchTags: {
|
|
|
170
170
|
} = internal.catchTags
|
|
171
171
|
|
|
172
172
|
/**
|
|
173
|
+
* Filters the result of a response, or runs an alternative effect if the predicate fails.
|
|
174
|
+
*
|
|
173
175
|
* @since 1.0.0
|
|
174
176
|
* @category filters
|
|
175
177
|
*/
|
|
@@ -197,6 +199,8 @@ export const filterOrElse: {
|
|
|
197
199
|
} = internal.filterOrElse
|
|
198
200
|
|
|
199
201
|
/**
|
|
202
|
+
* Filters the result of a response, or throws an error if the predicate fails.
|
|
203
|
+
*
|
|
200
204
|
* @since 1.0.0
|
|
201
205
|
* @category filters
|
|
202
206
|
*/
|
|
@@ -222,6 +226,8 @@ export const filterOrFail: {
|
|
|
222
226
|
} = internal.filterOrFail
|
|
223
227
|
|
|
224
228
|
/**
|
|
229
|
+
* Filters responses by HTTP status code.
|
|
230
|
+
*
|
|
225
231
|
* @since 1.0.0
|
|
226
232
|
* @category filters
|
|
227
233
|
*/
|
|
@@ -236,6 +242,8 @@ export const filterStatus: {
|
|
|
236
242
|
} = internal.filterStatus
|
|
237
243
|
|
|
238
244
|
/**
|
|
245
|
+
* Filters responses that return a 2xx status code.
|
|
246
|
+
*
|
|
239
247
|
* @since 1.0.0
|
|
240
248
|
* @category filters
|
|
241
249
|
*/
|
|
@@ -294,6 +302,8 @@ export const transformResponse: {
|
|
|
294
302
|
} = internal.transformResponse
|
|
295
303
|
|
|
296
304
|
/**
|
|
305
|
+
* Transforms the result of a request.
|
|
306
|
+
*
|
|
297
307
|
* @since 1.0.0
|
|
298
308
|
* @category mapping & sequencing
|
|
299
309
|
*/
|
|
@@ -303,6 +313,8 @@ export const map: {
|
|
|
303
313
|
} = internal.map
|
|
304
314
|
|
|
305
315
|
/**
|
|
316
|
+
* Transforms the result of a request using an effectful function.
|
|
317
|
+
*
|
|
306
318
|
* @since 1.0.0
|
|
307
319
|
* @category mapping & sequencing
|
|
308
320
|
*/
|
|
@@ -314,6 +326,8 @@ export const mapEffect: {
|
|
|
314
326
|
} = internal.mapEffect
|
|
315
327
|
|
|
316
328
|
/**
|
|
329
|
+
* Appends a transformation of the request object before sending it.
|
|
330
|
+
*
|
|
317
331
|
* @since 1.0.0
|
|
318
332
|
* @category mapping & sequencing
|
|
319
333
|
*/
|
|
@@ -328,6 +342,8 @@ export const mapRequest: {
|
|
|
328
342
|
} = internal.mapRequest
|
|
329
343
|
|
|
330
344
|
/**
|
|
345
|
+
* Appends an effectful transformation of the request object before sending it.
|
|
346
|
+
*
|
|
331
347
|
* @since 1.0.0
|
|
332
348
|
* @category mapping & sequencing
|
|
333
349
|
*/
|
|
@@ -342,6 +358,8 @@ export const mapRequestEffect: {
|
|
|
342
358
|
} = internal.mapRequestEffect
|
|
343
359
|
|
|
344
360
|
/**
|
|
361
|
+
* Prepends a transformation of the request object before sending it.
|
|
362
|
+
*
|
|
345
363
|
* @since 1.0.0
|
|
346
364
|
* @category mapping & sequencing
|
|
347
365
|
*/
|
|
@@ -356,6 +374,8 @@ export const mapRequestInput: {
|
|
|
356
374
|
} = internal.mapRequestInput
|
|
357
375
|
|
|
358
376
|
/**
|
|
377
|
+
* Prepends an effectful transformation of the request object before sending it.
|
|
378
|
+
*
|
|
359
379
|
* @since 1.0.0
|
|
360
380
|
* @category mapping & sequencing
|
|
361
381
|
*/
|
|
@@ -393,6 +413,8 @@ export declare namespace Retry {
|
|
|
393
413
|
}
|
|
394
414
|
|
|
395
415
|
/**
|
|
416
|
+
* Retries the request based on a provided schedule or policy.
|
|
417
|
+
*
|
|
396
418
|
* @since 1.0.0
|
|
397
419
|
* @category error handling
|
|
398
420
|
*/
|
|
@@ -406,12 +428,16 @@ export const retry: {
|
|
|
406
428
|
} = internal.retry
|
|
407
429
|
|
|
408
430
|
/**
|
|
431
|
+
* Ensures resources are properly scoped and released after execution.
|
|
432
|
+
*
|
|
409
433
|
* @since 1.0.0
|
|
410
434
|
* @category resources & finalizers
|
|
411
435
|
*/
|
|
412
436
|
export const scoped: <A, E, R>(self: HttpClient<A, E, R>) => HttpClient<A, E, Exclude<R, Scope.Scope>> = internal.scoped
|
|
413
437
|
|
|
414
438
|
/**
|
|
439
|
+
* Creates a function that validates request data against a schema before sending it.
|
|
440
|
+
*
|
|
415
441
|
* @since 1.0.0
|
|
416
442
|
* @category schema
|
|
417
443
|
*/
|
|
@@ -434,6 +460,8 @@ export const schemaFunction: {
|
|
|
434
460
|
} = internal.schemaFunction
|
|
435
461
|
|
|
436
462
|
/**
|
|
463
|
+
* Performs an additional effect after a successful request.
|
|
464
|
+
*
|
|
437
465
|
* @since 1.0.0
|
|
438
466
|
* @category mapping & sequencing
|
|
439
467
|
*/
|
|
@@ -445,6 +473,8 @@ export const tap: {
|
|
|
445
473
|
} = internal.tap
|
|
446
474
|
|
|
447
475
|
/**
|
|
476
|
+
* Performs an additional effect on the request before sending it.
|
|
477
|
+
*
|
|
448
478
|
* @since 1.0.0
|
|
449
479
|
* @category mapping & sequencing
|
|
450
480
|
*/
|
|
@@ -459,6 +489,8 @@ export const tapRequest: {
|
|
|
459
489
|
} = internal.tapRequest
|
|
460
490
|
|
|
461
491
|
/**
|
|
492
|
+
* Associates a `Ref` of cookies with the client for handling cookies across requests.
|
|
493
|
+
*
|
|
462
494
|
* @since 1.0.0
|
|
463
495
|
* @category cookies
|
|
464
496
|
*/
|
|
@@ -468,6 +500,8 @@ export const withCookiesRef: {
|
|
|
468
500
|
} = internal.withCookiesRef
|
|
469
501
|
|
|
470
502
|
/**
|
|
503
|
+
* Follows HTTP redirects up to a specified number of times.
|
|
504
|
+
*
|
|
471
505
|
* @since 1.0.0
|
|
472
506
|
* @category redirects
|
|
473
507
|
*/
|
|
@@ -484,6 +518,8 @@ export const currentTracerDisabledWhen: FiberRef.FiberRef<Predicate.Predicate<Cl
|
|
|
484
518
|
internal.currentTracerDisabledWhen
|
|
485
519
|
|
|
486
520
|
/**
|
|
521
|
+
* Disables tracing for specific requests based on a provided predicate.
|
|
522
|
+
*
|
|
487
523
|
* @since 1.0.0
|
|
488
524
|
* @category fiber refs
|
|
489
525
|
*/
|
|
@@ -504,6 +540,8 @@ export const withTracerDisabledWhen: {
|
|
|
504
540
|
export const currentTracerPropagation: FiberRef.FiberRef<boolean> = internal.currentTracerPropagation
|
|
505
541
|
|
|
506
542
|
/**
|
|
543
|
+
* Enables or disables tracing propagation for the request.
|
|
544
|
+
*
|
|
507
545
|
* @since 1.0.0
|
|
508
546
|
* @category fiber refs
|
|
509
547
|
*/
|
|
@@ -189,9 +189,9 @@ export const searchParamsParser = <E, R>(httpApp: App.Default<E, R>) =>
|
|
|
189
189
|
E,
|
|
190
190
|
ServerRequest.HttpServerRequest | Exclude<R, ServerRequest.ParsedSearchParams>
|
|
191
191
|
>((fiber) => {
|
|
192
|
-
const context = fiber.
|
|
192
|
+
const context = fiber.currentContext
|
|
193
193
|
const request = Context.unsafeGet(context, ServerRequest.HttpServerRequest)
|
|
194
|
-
const params = ServerRequest.searchParamsFromURL(new URL(request.
|
|
194
|
+
const params = ServerRequest.searchParamsFromURL(new URL(request.originalUrl))
|
|
195
195
|
return Effect.locally(
|
|
196
196
|
httpApp,
|
|
197
197
|
FiberRef.currentContext,
|