@effect/platform 0.53.12 → 0.53.14
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 +989 -142
- package/dist/cjs/Http/Router.js.map +1 -1
- package/dist/dts/Http/App.d.ts +2 -2
- package/dist/dts/Http/Client.d.ts +29 -29
- package/dist/dts/Http/Client.d.ts.map +1 -1
- package/dist/dts/Http/IncomingMessage.d.ts +1 -1
- package/dist/dts/Http/Middleware.d.ts +10 -10
- package/dist/dts/Http/Multipart.d.ts +8 -8
- package/dist/dts/Http/Multiplex.d.ts +19 -19
- package/dist/dts/Http/Router.d.ts +34 -35
- package/dist/dts/Http/Router.d.ts.map +1 -1
- package/dist/dts/Http/Server.d.ts +13 -13
- package/dist/dts/Socket.d.ts +2 -2
- package/dist/dts/WorkerRunner.d.ts +2 -2
- package/dist/dts/internal/http/router.d.ts +1 -1
- package/dist/esm/Http/Router.js.map +1 -1
- package/package.json +3 -3
- package/src/Http/App.ts +3 -3
- package/src/Http/Client.ts +29 -29
- package/src/Http/IncomingMessage.ts +2 -2
- package/src/Http/Middleware.ts +10 -10
- package/src/Http/Multipart.ts +8 -8
- package/src/Http/Multiplex.ts +24 -24
- package/src/Http/Router.ts +34 -39
- package/src/Http/Server.ts +13 -13
- package/src/Socket.ts +4 -4
- package/src/WorkerRunner.ts +2 -2
- package/src/internal/http/client.ts +31 -31
- package/src/internal/http/middleware.ts +7 -7
- package/src/internal/http/multipart.ts +8 -8
- package/src/internal/http/multiplex.ts +28 -28
- package/src/internal/http/router.ts +23 -23
- package/src/internal/http/server.ts +13 -13
- package/src/internal/workerRunner.ts +2 -2
package/src/Http/Router.ts
CHANGED
|
@@ -16,7 +16,6 @@ import type * as App from "./App.js"
|
|
|
16
16
|
import type * as Method from "./Method.js"
|
|
17
17
|
import type * as Error from "./ServerError.js"
|
|
18
18
|
import type * as ServerRequest from "./ServerRequest.js"
|
|
19
|
-
import type * as ServerResponse from "./ServerResponse.js"
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* @since 1.0.0
|
|
@@ -99,11 +98,7 @@ export declare namespace Route {
|
|
|
99
98
|
/**
|
|
100
99
|
* @since 1.0.0
|
|
101
100
|
*/
|
|
102
|
-
export type Handler<E, R> =
|
|
103
|
-
ServerResponse.ServerResponse,
|
|
104
|
-
E,
|
|
105
|
-
R | RouteContext | ServerRequest.ServerRequest | ServerRequest.ParsedSearchParams
|
|
106
|
-
>
|
|
101
|
+
export type Handler<E, R> = App.Default<E, R | RouteContext | ServerRequest.ParsedSearchParams>
|
|
107
102
|
}
|
|
108
103
|
|
|
109
104
|
/**
|
|
@@ -246,8 +241,8 @@ export const makeRoute: <E, R>(
|
|
|
246
241
|
* @category combinators
|
|
247
242
|
*/
|
|
248
243
|
export const prefixAll: {
|
|
249
|
-
(prefix: PathInput): <
|
|
250
|
-
<
|
|
244
|
+
(prefix: PathInput): <E, R>(self: Router<E, R>) => Router<E, R>
|
|
245
|
+
<E, R>(self: Router<E, R>, prefix: PathInput): Router<E, R>
|
|
251
246
|
} = internal.prefixAll
|
|
252
247
|
|
|
253
248
|
/**
|
|
@@ -255,10 +250,10 @@ export const prefixAll: {
|
|
|
255
250
|
* @category combinators
|
|
256
251
|
*/
|
|
257
252
|
export const concat: {
|
|
258
|
-
<R1, E1>(that: Router<E1, R1>): <
|
|
253
|
+
<R1, E1>(that: Router<E1, R1>): <E, R>(
|
|
259
254
|
self: Router<E, R>
|
|
260
255
|
) => Router<E1 | E, R1 | R>
|
|
261
|
-
<
|
|
256
|
+
<E, R, R1, E1>(self: Router<E, R>, that: Router<E1, R1>): Router<
|
|
262
257
|
E | E1,
|
|
263
258
|
R | R1
|
|
264
259
|
>
|
|
@@ -269,8 +264,8 @@ export const concat: {
|
|
|
269
264
|
* @category routing
|
|
270
265
|
*/
|
|
271
266
|
export const mount: {
|
|
272
|
-
<R1, E1>(path: `/${string}`, that: Router<E1, R1>): <
|
|
273
|
-
<R,
|
|
267
|
+
<R1, E1>(path: `/${string}`, that: Router<E1, R1>): <E, R>(self: Router<E, R>) => Router<E1 | E, R1 | R>
|
|
268
|
+
<E, R, E1, R1>(self: Router<E, R>, path: `/${string}`, that: Router<E1, R1>): Router<E | E1, R | R1>
|
|
274
269
|
} = internal.mount
|
|
275
270
|
|
|
276
271
|
/**
|
|
@@ -282,14 +277,14 @@ export const mountApp: {
|
|
|
282
277
|
path: `/${string}`,
|
|
283
278
|
that: App.Default<E1, R1>,
|
|
284
279
|
options?: { readonly includePrefix?: boolean | undefined } | undefined
|
|
285
|
-
): <
|
|
280
|
+
): <E, R>(
|
|
286
281
|
self: Router<E, R>
|
|
287
282
|
) => Router<
|
|
288
283
|
E1 | E,
|
|
289
284
|
| Router.ExcludeProvided<R1>
|
|
290
285
|
| Router.ExcludeProvided<R>
|
|
291
286
|
>
|
|
292
|
-
<R,
|
|
287
|
+
<E, R, E1, R1>(
|
|
293
288
|
self: Router<E, R>,
|
|
294
289
|
path: `/${string}`,
|
|
295
290
|
that: App.Default<E1, R1>,
|
|
@@ -312,10 +307,10 @@ export const route: (
|
|
|
312
307
|
path: PathInput,
|
|
313
308
|
handler: Route.Handler<E1, R1>,
|
|
314
309
|
options?: { readonly uninterruptible?: boolean | undefined } | undefined
|
|
315
|
-
): <
|
|
310
|
+
): <E, R>(
|
|
316
311
|
self: Router<E, R>
|
|
317
312
|
) => Router<E1 | E, R | Exclude<R1, ServerRequest.ServerRequest | RouteContext | Scope.Scope>>
|
|
318
|
-
<R,
|
|
313
|
+
<E, R, E1, R1>(
|
|
319
314
|
self: Router<E, R>,
|
|
320
315
|
path: PathInput,
|
|
321
316
|
handler: Route.Handler<E1, R1>,
|
|
@@ -332,13 +327,13 @@ export const all: {
|
|
|
332
327
|
path: PathInput,
|
|
333
328
|
handler: Route.Handler<E1, R1>,
|
|
334
329
|
options?: { readonly uninterruptible?: boolean | undefined } | undefined
|
|
335
|
-
): <
|
|
330
|
+
): <E, R>(
|
|
336
331
|
self: Router<E, R>
|
|
337
332
|
) => Router<
|
|
338
333
|
E1 | E,
|
|
339
334
|
R | Router.ExcludeProvided<R1>
|
|
340
335
|
>
|
|
341
|
-
<R,
|
|
336
|
+
<E, R, E1, R1>(
|
|
342
337
|
self: Router<E, R>,
|
|
343
338
|
path: PathInput,
|
|
344
339
|
handler: Route.Handler<E1, R1>,
|
|
@@ -358,10 +353,10 @@ export const get: {
|
|
|
358
353
|
path: PathInput,
|
|
359
354
|
handler: Route.Handler<E1, R1>,
|
|
360
355
|
options?: { readonly uninterruptible?: boolean | undefined } | undefined
|
|
361
|
-
): <
|
|
356
|
+
): <E, R>(
|
|
362
357
|
self: Router<E, R>
|
|
363
358
|
) => Router<E1 | E, R | Router.ExcludeProvided<R1>>
|
|
364
|
-
<R,
|
|
359
|
+
<E, R, E1, R1>(
|
|
365
360
|
self: Router<E, R>,
|
|
366
361
|
path: PathInput,
|
|
367
362
|
handler: Route.Handler<E1, R1>,
|
|
@@ -378,10 +373,10 @@ export const post: {
|
|
|
378
373
|
path: PathInput,
|
|
379
374
|
handler: Route.Handler<E1, R1>,
|
|
380
375
|
options?: { readonly uninterruptible?: boolean | undefined } | undefined
|
|
381
|
-
): <
|
|
376
|
+
): <E, R>(
|
|
382
377
|
self: Router<E, R>
|
|
383
378
|
) => Router<E1 | E, R | Router.ExcludeProvided<R1>>
|
|
384
|
-
<R,
|
|
379
|
+
<E, R, E1, R1>(
|
|
385
380
|
self: Router<E, R>,
|
|
386
381
|
path: PathInput,
|
|
387
382
|
handler: Route.Handler<E1, R1>,
|
|
@@ -398,10 +393,10 @@ export const patch: {
|
|
|
398
393
|
path: PathInput,
|
|
399
394
|
handler: Route.Handler<E1, R1>,
|
|
400
395
|
options?: { readonly uninterruptible?: boolean | undefined } | undefined
|
|
401
|
-
): <
|
|
396
|
+
): <E, R>(
|
|
402
397
|
self: Router<E, R>
|
|
403
398
|
) => Router<E1 | E, R | Router.ExcludeProvided<R1>>
|
|
404
|
-
<R,
|
|
399
|
+
<E, R, E1, R1>(
|
|
405
400
|
self: Router<E, R>,
|
|
406
401
|
path: PathInput,
|
|
407
402
|
handler: Route.Handler<E1, R1>,
|
|
@@ -418,10 +413,10 @@ export const put: {
|
|
|
418
413
|
path: PathInput,
|
|
419
414
|
handler: Route.Handler<E1, R1>,
|
|
420
415
|
options?: { readonly uninterruptible?: boolean | undefined } | undefined
|
|
421
|
-
): <
|
|
416
|
+
): <E, R>(
|
|
422
417
|
self: Router<E, R>
|
|
423
418
|
) => Router<E1 | E, R | Router.ExcludeProvided<R1>>
|
|
424
|
-
<R,
|
|
419
|
+
<E, R, E1, R1>(
|
|
425
420
|
self: Router<E, R>,
|
|
426
421
|
path: PathInput,
|
|
427
422
|
handler: Route.Handler<E1, R1>,
|
|
@@ -438,10 +433,10 @@ export const del: {
|
|
|
438
433
|
path: PathInput,
|
|
439
434
|
handler: Route.Handler<E1, R1>,
|
|
440
435
|
options?: { readonly uninterruptible?: boolean | undefined } | undefined
|
|
441
|
-
): <
|
|
436
|
+
): <E, R>(
|
|
442
437
|
self: Router<E, R>
|
|
443
438
|
) => Router<E1 | E, R | Router.ExcludeProvided<R1>>
|
|
444
|
-
<R,
|
|
439
|
+
<E, R, E1, R1>(
|
|
445
440
|
self: Router<E, R>,
|
|
446
441
|
path: PathInput,
|
|
447
442
|
handler: Route.Handler<E1, R1>,
|
|
@@ -458,10 +453,10 @@ export const head: {
|
|
|
458
453
|
path: PathInput,
|
|
459
454
|
handler: Route.Handler<E1, R1>,
|
|
460
455
|
options?: { readonly uninterruptible?: boolean | undefined } | undefined
|
|
461
|
-
): <
|
|
456
|
+
): <E, R>(
|
|
462
457
|
self: Router<E, R>
|
|
463
458
|
) => Router<E1 | E, R | Router.ExcludeProvided<R1>>
|
|
464
|
-
<R,
|
|
459
|
+
<E, R, E1, R1>(
|
|
465
460
|
self: Router<E, R>,
|
|
466
461
|
path: PathInput,
|
|
467
462
|
handler: Route.Handler<E1, R1>,
|
|
@@ -478,10 +473,10 @@ export const options: {
|
|
|
478
473
|
path: PathInput,
|
|
479
474
|
handler: Route.Handler<E1, R1>,
|
|
480
475
|
options?: { readonly uninterruptible?: boolean | undefined } | undefined
|
|
481
|
-
): <
|
|
476
|
+
): <E, R>(
|
|
482
477
|
self: Router<E, R>
|
|
483
478
|
) => Router<E1 | E, R | Router.ExcludeProvided<R1>>
|
|
484
|
-
<R,
|
|
479
|
+
<E, R, E1, R1>(
|
|
485
480
|
self: Router<E, R>,
|
|
486
481
|
path: PathInput,
|
|
487
482
|
handler: Route.Handler<E1, R1>,
|
|
@@ -511,7 +506,7 @@ export const catchAll: {
|
|
|
511
506
|
<E, E2, R2>(
|
|
512
507
|
f: (e: E) => Route.Handler<E2, R2>
|
|
513
508
|
): <R>(self: Router<E, R>) => Router<E2, R | Router.ExcludeProvided<R2>>
|
|
514
|
-
<
|
|
509
|
+
<E, R, E2, R2>(
|
|
515
510
|
self: Router<E, R>,
|
|
516
511
|
f: (e: E) => Route.Handler<E2, R2>
|
|
517
512
|
): Router<E2, R | Router.ExcludeProvided<R2>>
|
|
@@ -525,7 +520,7 @@ export const catchAllCause: {
|
|
|
525
520
|
<E, E2, R2>(
|
|
526
521
|
f: (e: Cause.Cause<E>) => Route.Handler<E2, R2>
|
|
527
522
|
): <R>(self: Router<E, R>) => Router<E2, R | Router.ExcludeProvided<R2>>
|
|
528
|
-
<
|
|
523
|
+
<E, R, E2, R2>(
|
|
529
524
|
self: Router<E, R>,
|
|
530
525
|
f: (e: Cause.Cause<E>) => Route.Handler<E2, R2>
|
|
531
526
|
): Router<E2, R | Router.ExcludeProvided<R2>>
|
|
@@ -542,7 +537,7 @@ export const catchTag: {
|
|
|
542
537
|
): <R>(
|
|
543
538
|
self: Router<E, R>
|
|
544
539
|
) => Router<E1 | Exclude<E, { _tag: K }>, R | Router.ExcludeProvided<R1>>
|
|
545
|
-
<
|
|
540
|
+
<E, R, K extends E extends { _tag: string } ? E["_tag"] : never, E1, R1>(
|
|
546
541
|
self: Router<E, R>,
|
|
547
542
|
k: K,
|
|
548
543
|
f: (e: Extract<E, { _tag: K }>) => Route.Handler<E1, R1>
|
|
@@ -606,8 +601,8 @@ export const provideService: {
|
|
|
606
601
|
<T extends Context.Tag<any, any>>(
|
|
607
602
|
tag: T,
|
|
608
603
|
service: Context.Tag.Service<T>
|
|
609
|
-
): <
|
|
610
|
-
<
|
|
604
|
+
): <E, R>(self: Router<E, R>) => Router<E, Exclude<R, Context.Tag.Identifier<T>>>
|
|
605
|
+
<E, R, T extends Context.Tag<any, any>>(
|
|
611
606
|
self: Router<E, R>,
|
|
612
607
|
tag: T,
|
|
613
608
|
service: Context.Tag.Service<T>
|
|
@@ -622,14 +617,14 @@ export const provideServiceEffect: {
|
|
|
622
617
|
<T extends Context.Tag<any, any>, R1, E1>(
|
|
623
618
|
tag: T,
|
|
624
619
|
effect: Effect.Effect<Context.Tag.Service<T>, E1, R1>
|
|
625
|
-
): <
|
|
620
|
+
): <E, R>(
|
|
626
621
|
self: Router<E, R>
|
|
627
622
|
) => Router<
|
|
628
623
|
E1 | E,
|
|
629
624
|
| Exclude<R, Context.Tag.Identifier<T>>
|
|
630
625
|
| Exclude<Router.ExcludeProvided<R1>, Context.Tag.Identifier<T>>
|
|
631
626
|
>
|
|
632
|
-
<
|
|
627
|
+
<E, R, T extends Context.Tag<any, any>, R1, E1>(
|
|
633
628
|
self: Router<E, R>,
|
|
634
629
|
tag: T,
|
|
635
630
|
effect: Effect.Effect<Context.Tag.Service<T>, E1, R1>
|
package/src/Http/Server.ts
CHANGED
|
@@ -29,12 +29,12 @@ export type TypeId = typeof TypeId
|
|
|
29
29
|
export interface Server {
|
|
30
30
|
readonly [TypeId]: TypeId
|
|
31
31
|
readonly serve: {
|
|
32
|
-
<
|
|
32
|
+
<E, R>(httpApp: App.Default<E, R>): Effect.Effect<
|
|
33
33
|
void,
|
|
34
34
|
never,
|
|
35
35
|
Exclude<R, ServerRequest.ServerRequest> | Scope.Scope
|
|
36
36
|
>
|
|
37
|
-
<
|
|
37
|
+
<E, R, App extends App.Default<any, any>>(
|
|
38
38
|
httpApp: App.Default<E, R>,
|
|
39
39
|
middleware: Middleware.Middleware.Applied<App, E, R>
|
|
40
40
|
): Effect.Effect<
|
|
@@ -104,10 +104,10 @@ export const make: (
|
|
|
104
104
|
* @category accessors
|
|
105
105
|
*/
|
|
106
106
|
export const serve: {
|
|
107
|
-
(): <
|
|
107
|
+
(): <E, R>(
|
|
108
108
|
httpApp: App.Default<E, R>
|
|
109
109
|
) => Layer.Layer<never, never, Server | Exclude<R, ServerRequest.ServerRequest | Scope.Scope>>
|
|
110
|
-
<
|
|
110
|
+
<E, R, App extends App.Default<any, any>>(
|
|
111
111
|
middleware: Middleware.Middleware.Applied<App, E, R>
|
|
112
112
|
): (
|
|
113
113
|
httpApp: App.Default<E, R>
|
|
@@ -116,10 +116,10 @@ export const serve: {
|
|
|
116
116
|
never,
|
|
117
117
|
Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest | Scope.Scope>
|
|
118
118
|
>
|
|
119
|
-
<
|
|
119
|
+
<E, R>(
|
|
120
120
|
httpApp: App.Default<E, R>
|
|
121
121
|
): Layer.Layer<never, never, Server | Exclude<R, ServerRequest.ServerRequest | Scope.Scope>>
|
|
122
|
-
<
|
|
122
|
+
<E, R, App extends App.Default<any, any>>(
|
|
123
123
|
httpApp: App.Default<E, R>,
|
|
124
124
|
middleware: Middleware.Middleware.Applied<App, E, R>
|
|
125
125
|
): Layer.Layer<never, never, Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest | Scope.Scope>>
|
|
@@ -130,10 +130,10 @@ export const serve: {
|
|
|
130
130
|
* @category accessors
|
|
131
131
|
*/
|
|
132
132
|
export const serveEffect: {
|
|
133
|
-
(): <
|
|
133
|
+
(): <E, R>(
|
|
134
134
|
httpApp: App.Default<E, R>
|
|
135
135
|
) => Effect.Effect<void, never, Scope.Scope | Server | Exclude<R, ServerRequest.ServerRequest>>
|
|
136
|
-
<
|
|
136
|
+
<E, R, App extends App.Default<any, any>>(
|
|
137
137
|
middleware: Middleware.Middleware.Applied<App, E, R>
|
|
138
138
|
): (
|
|
139
139
|
httpApp: App.Default<E, R>
|
|
@@ -142,10 +142,10 @@ export const serveEffect: {
|
|
|
142
142
|
never,
|
|
143
143
|
Scope.Scope | Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest>
|
|
144
144
|
>
|
|
145
|
-
<
|
|
145
|
+
<E, R>(
|
|
146
146
|
httpApp: App.Default<E, R>
|
|
147
147
|
): Effect.Effect<void, never, Scope.Scope | Server | Exclude<R, ServerRequest.ServerRequest>>
|
|
148
|
-
<
|
|
148
|
+
<E, R, App extends App.Default<any, any>>(
|
|
149
149
|
httpApp: App.Default<E, R>,
|
|
150
150
|
middleware: Middleware.Middleware.Applied<App, E, R>
|
|
151
151
|
): Effect.Effect<void, never, Scope.Scope | Server | Exclude<Effect.Effect.Context<App>, ServerRequest.ServerRequest>>
|
|
@@ -161,7 +161,7 @@ export const formatAddress: (address: Address) => string = internal.formatAddres
|
|
|
161
161
|
* @since 1.0.0
|
|
162
162
|
* @category address
|
|
163
163
|
*/
|
|
164
|
-
export const addressWith: <
|
|
164
|
+
export const addressWith: <A, E, R>(
|
|
165
165
|
effect: (address: Address) => Effect.Effect<A, E, R>
|
|
166
166
|
) => Effect.Effect<A, E, Server | R> = internal.addressWith
|
|
167
167
|
|
|
@@ -169,7 +169,7 @@ export const addressWith: <R, E, A>(
|
|
|
169
169
|
* @since 1.0.0
|
|
170
170
|
* @category address
|
|
171
171
|
*/
|
|
172
|
-
export const addressFormattedWith: <
|
|
172
|
+
export const addressFormattedWith: <A, E, R>(
|
|
173
173
|
effect: (address: string) => Effect.Effect<A, E, R>
|
|
174
174
|
) => Effect.Effect<A, E, Server | R> = internal.addressFormattedWith
|
|
175
175
|
|
|
@@ -183,5 +183,5 @@ export const logAddress: Effect.Effect<void, never, Server> = internal.logAddres
|
|
|
183
183
|
* @since 1.0.0
|
|
184
184
|
* @category address
|
|
185
185
|
*/
|
|
186
|
-
export const withLogAddress: <
|
|
186
|
+
export const withLogAddress: <A, E, R>(layer: Layer.Layer<A, E, R>) => Layer.Layer<A, E, R | Exclude<Server, A>> =
|
|
187
187
|
internal.withLogAddress
|
package/src/Socket.ts
CHANGED
|
@@ -46,10 +46,10 @@ export const Socket: Context.Tag<Socket, Socket> = Context.GenericTag<Socket>(
|
|
|
46
46
|
*/
|
|
47
47
|
export interface Socket {
|
|
48
48
|
readonly [TypeId]: TypeId
|
|
49
|
-
readonly run: <
|
|
49
|
+
readonly run: <_, E, R>(
|
|
50
50
|
handler: (_: Uint8Array) => Effect.Effect<_, E, R>
|
|
51
51
|
) => Effect.Effect<void, SocketError | E, R>
|
|
52
|
-
readonly runRaw: <
|
|
52
|
+
readonly runRaw: <_, E, R>(
|
|
53
53
|
handler: (_: string | Uint8Array) => Effect.Effect<_, E, R>
|
|
54
54
|
) => Effect.Effect<void, SocketError | E, R>
|
|
55
55
|
readonly writer: Effect.Effect<
|
|
@@ -337,7 +337,7 @@ export const fromWebSocket = <R>(
|
|
|
337
337
|
))
|
|
338
338
|
const acquireContext = yield* Effect.context<Exclude<R, Scope.Scope>>()
|
|
339
339
|
|
|
340
|
-
const runRaw = <
|
|
340
|
+
const runRaw = <_, E, R>(handler: (_: string | Uint8Array) => Effect.Effect<_, E, R>) =>
|
|
341
341
|
Effect.gen(function*(_) {
|
|
342
342
|
const scope = yield* Effect.scope
|
|
343
343
|
const ws = yield* (acquire.pipe(
|
|
@@ -433,7 +433,7 @@ export const fromWebSocket = <R>(
|
|
|
433
433
|
)
|
|
434
434
|
|
|
435
435
|
const encoder = new TextEncoder()
|
|
436
|
-
const run = <
|
|
436
|
+
const run = <_, E, R>(handler: (_: Uint8Array) => Effect.Effect<_, E, R>) =>
|
|
437
437
|
runRaw((data) =>
|
|
438
438
|
typeof data === "string"
|
|
439
439
|
? handler(encoder.encode(data))
|
package/src/WorkerRunner.ts
CHANGED
|
@@ -95,7 +95,7 @@ export declare namespace Runner {
|
|
|
95
95
|
* @since 1.0.0
|
|
96
96
|
* @category constructors
|
|
97
97
|
*/
|
|
98
|
-
export const make: <I,
|
|
98
|
+
export const make: <I, E, R, O>(
|
|
99
99
|
process: (request: I) => Stream.Stream<O, E, R> | Effect.Effect<O, E, R>,
|
|
100
100
|
options?: Runner.Options<I, O, E> | undefined
|
|
101
101
|
) => Effect.Effect<void, WorkerError, Scope.Scope | R | PlatformRunner> = internal.make
|
|
@@ -104,7 +104,7 @@ export const make: <I, R, E, O>(
|
|
|
104
104
|
* @since 1.0.0
|
|
105
105
|
* @category layers
|
|
106
106
|
*/
|
|
107
|
-
export const layer: <I,
|
|
107
|
+
export const layer: <I, E, R, O>(
|
|
108
108
|
process: (request: I) => Stream.Stream<O, E, R> | Effect.Effect<O, E, R>,
|
|
109
109
|
options?: Runner.Options<I, O, E> | undefined
|
|
110
110
|
) => Layer.Layer<never, WorkerError, R | PlatformRunner> = internal.layer
|
|
@@ -45,8 +45,8 @@ export const currentTracerDisabledWhen = globalValue(
|
|
|
45
45
|
export const withTracerDisabledWhen = dual<
|
|
46
46
|
(
|
|
47
47
|
predicate: Predicate.Predicate<ClientRequest.ClientRequest>
|
|
48
|
-
) => <
|
|
49
|
-
<
|
|
48
|
+
) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>,
|
|
49
|
+
<A, E, R>(
|
|
50
50
|
effect: Effect.Effect<A, E, R>,
|
|
51
51
|
predicate: Predicate.Predicate<ClientRequest.ClientRequest>
|
|
52
52
|
) => Effect.Effect<A, E, R>
|
|
@@ -62,8 +62,8 @@ export const currentTracerPropagation = globalValue(
|
|
|
62
62
|
export const withTracerPropagation = dual<
|
|
63
63
|
(
|
|
64
64
|
enabled: boolean
|
|
65
|
-
) => <
|
|
66
|
-
<
|
|
65
|
+
) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>,
|
|
66
|
+
<A, E, R>(
|
|
67
67
|
effect: Effect.Effect<A, E, R>,
|
|
68
68
|
enabled: boolean
|
|
69
69
|
) => Effect.Effect<A, E, R>
|
|
@@ -79,8 +79,8 @@ export const currentFetchOptions = globalValue(
|
|
|
79
79
|
export const withFetchOptions = dual<
|
|
80
80
|
(
|
|
81
81
|
options: RequestInit
|
|
82
|
-
) => <
|
|
83
|
-
<
|
|
82
|
+
) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>,
|
|
83
|
+
<A, E, R>(
|
|
84
84
|
effect: Effect.Effect<A, E, R>,
|
|
85
85
|
options: RequestInit
|
|
86
86
|
) => Effect.Effect<A, E, R>
|
|
@@ -96,7 +96,7 @@ const clientProto = {
|
|
|
96
96
|
const isClient = (u: unknown): u is Client.Client<unknown, unknown, unknown> => Predicate.hasProperty(u, TypeId)
|
|
97
97
|
|
|
98
98
|
/** @internal */
|
|
99
|
-
export const make = <
|
|
99
|
+
export const make = <E2, R2, A, E, R>(
|
|
100
100
|
execute: (
|
|
101
101
|
request: Effect.Effect<ClientRequest.ClientRequest, E2, R2>
|
|
102
102
|
) => Effect.Effect<A, E, R>,
|
|
@@ -236,13 +236,13 @@ export const fetch: Client.Client.Default = makeDefault((request, url, signal, f
|
|
|
236
236
|
|
|
237
237
|
/** @internal */
|
|
238
238
|
export const transform = dual<
|
|
239
|
-
<A, E, R,
|
|
239
|
+
<A, E, R, A1, E1, R1>(
|
|
240
240
|
f: (
|
|
241
241
|
effect: Effect.Effect<A, E, R>,
|
|
242
242
|
request: ClientRequest.ClientRequest
|
|
243
243
|
) => Effect.Effect<A1, E1, R1>
|
|
244
244
|
) => (self: Client.Client<A, E, R>) => Client.Client<A1, E | E1, R | R1>,
|
|
245
|
-
<A, E, R,
|
|
245
|
+
<A, E, R, A1, E1, R1>(
|
|
246
246
|
self: Client.Client<A, E, R>,
|
|
247
247
|
f: (
|
|
248
248
|
effect: Effect.Effect<A, E, R>,
|
|
@@ -305,10 +305,10 @@ export const layer = Layer.succeed(tag, fetch)
|
|
|
305
305
|
|
|
306
306
|
/** @internal */
|
|
307
307
|
export const transformResponse = dual<
|
|
308
|
-
<A, E, R,
|
|
308
|
+
<A, E, R, A1, E1, R1>(
|
|
309
309
|
f: (effect: Effect.Effect<A, E, R>) => Effect.Effect<A1, E1, R1>
|
|
310
310
|
) => (self: Client.Client<A, E, R>) => Client.Client<A1, E1, R1>,
|
|
311
|
-
<A, E, R,
|
|
311
|
+
<A, E, R, A1, E1, R1>(
|
|
312
312
|
self: Client.Client<A, E, R>,
|
|
313
313
|
f: (effect: Effect.Effect<A, E, R>) => Effect.Effect<A1, E1, R1>
|
|
314
314
|
) => Client.Client<A1, E1, R1>
|
|
@@ -316,7 +316,7 @@ export const transformResponse = dual<
|
|
|
316
316
|
|
|
317
317
|
/** @internal */
|
|
318
318
|
export const catchTag: {
|
|
319
|
-
<K extends E extends { _tag: string } ? E["_tag"] : never, E,
|
|
319
|
+
<K extends E extends { _tag: string } ? E["_tag"] : never, E, A1, E1, R1>(
|
|
320
320
|
tag: K,
|
|
321
321
|
f: (e: Extract<E, { _tag: K }>) => Effect.Effect<A1, E1, R1>
|
|
322
322
|
): <A, R>(
|
|
@@ -327,9 +327,9 @@ export const catchTag: {
|
|
|
327
327
|
E,
|
|
328
328
|
A,
|
|
329
329
|
K extends E extends { _tag: string } ? E["_tag"] : never,
|
|
330
|
+
A1,
|
|
330
331
|
R1,
|
|
331
|
-
E1
|
|
332
|
-
A1
|
|
332
|
+
E1
|
|
333
333
|
>(
|
|
334
334
|
self: Client.Client<A, E, R>,
|
|
335
335
|
tag: K,
|
|
@@ -494,16 +494,16 @@ export const catchTags: {
|
|
|
494
494
|
|
|
495
495
|
/** @internal */
|
|
496
496
|
export const catchAll: {
|
|
497
|
-
<E,
|
|
497
|
+
<E, A2, E2, R2>(
|
|
498
498
|
f: (e: E) => Effect.Effect<A2, E2, R2>
|
|
499
499
|
): <A, R>(self: Client.Client<A, E, R>) => Client.Client<A2 | A, E2, R | R2>
|
|
500
|
-
<A, E, R,
|
|
500
|
+
<A, E, R, A2, E2, R2>(
|
|
501
501
|
self: Client.Client<A, E, R>,
|
|
502
502
|
f: (e: E) => Effect.Effect<A2, E2, R2>
|
|
503
503
|
): Client.Client<A2 | A, E2, R | R2>
|
|
504
504
|
} = dual(
|
|
505
505
|
2,
|
|
506
|
-
<A, E, R,
|
|
506
|
+
<A, E, R, A2, E2, R2>(
|
|
507
507
|
self: Client.Client<A, E, R>,
|
|
508
508
|
f: (e: E) => Effect.Effect<A2, E2, R2>
|
|
509
509
|
): Client.Client<A2 | A, E2, R | R2> => transformResponse(self, Effect.catchAll(f))
|
|
@@ -511,13 +511,13 @@ export const catchAll: {
|
|
|
511
511
|
|
|
512
512
|
/** @internal */
|
|
513
513
|
export const filterOrElse = dual<
|
|
514
|
-
<A,
|
|
514
|
+
<A, B, E2, R2>(
|
|
515
515
|
f: Predicate.Predicate<A>,
|
|
516
516
|
orElse: (a: A) => Effect.Effect<B, E2, R2>
|
|
517
517
|
) => <E, R>(
|
|
518
518
|
self: Client.Client<A, E, R>
|
|
519
519
|
) => Client.Client<A | B, E2 | E, R2 | R>,
|
|
520
|
-
<A, E, R,
|
|
520
|
+
<A, E, R, B, E2, R2>(
|
|
521
521
|
self: Client.Client<A, E, R>,
|
|
522
522
|
f: Predicate.Predicate<A>,
|
|
523
523
|
orElse: (a: A) => Effect.Effect<B, E2, R2>
|
|
@@ -550,10 +550,10 @@ export const map = dual<
|
|
|
550
550
|
|
|
551
551
|
/** @internal */
|
|
552
552
|
export const mapEffect = dual<
|
|
553
|
-
<A,
|
|
553
|
+
<A, B, E2, R2>(
|
|
554
554
|
f: (a: A) => Effect.Effect<B, E2, R2>
|
|
555
555
|
) => <E, R>(self: Client.Client<A, E, R>) => Client.Client<B, E | E2, R | R2>,
|
|
556
|
-
<A, E, R,
|
|
556
|
+
<A, E, R, B, E2, R2>(
|
|
557
557
|
self: Client.Client<A, E, R>,
|
|
558
558
|
f: (a: A) => Effect.Effect<B, E2, R2>
|
|
559
559
|
) => Client.Client<B, E | E2, R | R2>
|
|
@@ -566,10 +566,10 @@ export const scoped = <A, E, R>(
|
|
|
566
566
|
|
|
567
567
|
/** @internal */
|
|
568
568
|
export const mapEffectScoped = dual<
|
|
569
|
-
<A,
|
|
569
|
+
<A, B, E2, R2>(
|
|
570
570
|
f: (a: A) => Effect.Effect<B, E2, R2>
|
|
571
571
|
) => <E, R>(self: Client.Client<A, E, R>) => Client.Client<B, E | E2, Exclude<R | R2, Scope.Scope>>,
|
|
572
|
-
<A, E, R,
|
|
572
|
+
<A, E, R, B, E2, R2>(
|
|
573
573
|
self: Client.Client<A, E, R>,
|
|
574
574
|
f: (a: A) => Effect.Effect<B, E2, R2>
|
|
575
575
|
) => Client.Client<B, E | E2, Exclude<R | R2, Scope.Scope>>
|
|
@@ -588,14 +588,14 @@ export const mapRequest = dual<
|
|
|
588
588
|
|
|
589
589
|
/** @internal */
|
|
590
590
|
export const mapRequestEffect = dual<
|
|
591
|
-
<
|
|
591
|
+
<E2, R2>(
|
|
592
592
|
f: (
|
|
593
593
|
a: ClientRequest.ClientRequest
|
|
594
594
|
) => Effect.Effect<ClientRequest.ClientRequest, E2, R2>
|
|
595
595
|
) => <A, E, R>(
|
|
596
596
|
self: Client.Client<A, E, R>
|
|
597
597
|
) => Client.Client<A, E | E2, R | R2>,
|
|
598
|
-
<A, E, R,
|
|
598
|
+
<A, E, R, E2, R2>(
|
|
599
599
|
self: Client.Client<A, E, R>,
|
|
600
600
|
f: (
|
|
601
601
|
a: ClientRequest.ClientRequest
|
|
@@ -616,14 +616,14 @@ export const mapInputRequest = dual<
|
|
|
616
616
|
|
|
617
617
|
/** @internal */
|
|
618
618
|
export const mapInputRequestEffect = dual<
|
|
619
|
-
<
|
|
619
|
+
<E2, R2>(
|
|
620
620
|
f: (
|
|
621
621
|
a: ClientRequest.ClientRequest
|
|
622
622
|
) => Effect.Effect<ClientRequest.ClientRequest, E2, R2>
|
|
623
623
|
) => <A, E, R>(
|
|
624
624
|
self: Client.Client<A, E, R>
|
|
625
625
|
) => Client.Client<A, E | E2, R | R2>,
|
|
626
|
-
<A, E, R,
|
|
626
|
+
<A, E, R, E2, R2>(
|
|
627
627
|
self: Client.Client<A, E, R>,
|
|
628
628
|
f: (
|
|
629
629
|
a: ClientRequest.ClientRequest
|
|
@@ -694,10 +694,10 @@ export const schemaFunction = dual<
|
|
|
694
694
|
|
|
695
695
|
/** @internal */
|
|
696
696
|
export const tap = dual<
|
|
697
|
-
<A,
|
|
697
|
+
<A, _, E2, R2>(
|
|
698
698
|
f: (a: A) => Effect.Effect<_, E2, R2>
|
|
699
699
|
) => <E, R>(self: Client.Client<A, E, R>) => Client.Client<A, E | E2, R | R2>,
|
|
700
|
-
<A, E, R,
|
|
700
|
+
<A, E, R, _, E2, R2>(
|
|
701
701
|
self: Client.Client<A, E, R>,
|
|
702
702
|
f: (a: A) => Effect.Effect<_, E2, R2>
|
|
703
703
|
) => Client.Client<A, E | E2, R | R2>
|
|
@@ -705,12 +705,12 @@ export const tap = dual<
|
|
|
705
705
|
|
|
706
706
|
/** @internal */
|
|
707
707
|
export const tapRequest = dual<
|
|
708
|
-
<
|
|
708
|
+
<_, E2, R2>(
|
|
709
709
|
f: (a: ClientRequest.ClientRequest) => Effect.Effect<_, E2, R2>
|
|
710
710
|
) => <A, E, R>(
|
|
711
711
|
self: Client.Client<A, E, R>
|
|
712
712
|
) => Client.Client<A, E | E2, R | R2>,
|
|
713
|
-
<A, E, R,
|
|
713
|
+
<A, E, R, _, E2, R2>(
|
|
714
714
|
self: Client.Client<A, E, R>,
|
|
715
715
|
f: (a: ClientRequest.ClientRequest) => Effect.Effect<_, E2, R2>
|
|
716
716
|
) => Client.Client<A, E | E2, R | R2>
|
|
@@ -24,7 +24,7 @@ export const loggerDisabled = globalValue(
|
|
|
24
24
|
)
|
|
25
25
|
|
|
26
26
|
/** @internal */
|
|
27
|
-
export const withLoggerDisabled = <
|
|
27
|
+
export const withLoggerDisabled = <A, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> =>
|
|
28
28
|
Effect.zipRight(
|
|
29
29
|
FiberRef.set(loggerDisabled, true),
|
|
30
30
|
self
|
|
@@ -40,8 +40,8 @@ export const currentTracerDisabledWhen = globalValue(
|
|
|
40
40
|
export const withTracerDisabledWhen = dual<
|
|
41
41
|
(
|
|
42
42
|
predicate: Predicate.Predicate<ServerRequest.ServerRequest>
|
|
43
|
-
) => <
|
|
44
|
-
<
|
|
43
|
+
) => <A, E, R>(layer: Layer.Layer<A, E, R>) => Layer.Layer<A, E, R>,
|
|
44
|
+
<A, E, R>(
|
|
45
45
|
layer: Layer.Layer<A, E, R>,
|
|
46
46
|
predicate: Predicate.Predicate<ServerRequest.ServerRequest>
|
|
47
47
|
) => Layer.Layer<A, E, R>
|
|
@@ -51,8 +51,8 @@ export const withTracerDisabledWhen = dual<
|
|
|
51
51
|
export const withTracerDisabledWhenEffect = dual<
|
|
52
52
|
(
|
|
53
53
|
predicate: Predicate.Predicate<ServerRequest.ServerRequest>
|
|
54
|
-
) => <
|
|
55
|
-
<
|
|
54
|
+
) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>,
|
|
55
|
+
<A, E, R>(
|
|
56
56
|
effect: Effect.Effect<A, E, R>,
|
|
57
57
|
predicate: Predicate.Predicate<ServerRequest.ServerRequest>
|
|
58
58
|
) => Effect.Effect<A, E, R>
|
|
@@ -62,8 +62,8 @@ export const withTracerDisabledWhenEffect = dual<
|
|
|
62
62
|
export const withTracerDisabledForUrls = dual<
|
|
63
63
|
(
|
|
64
64
|
urls: ReadonlyArray<string>
|
|
65
|
-
) => <
|
|
66
|
-
<
|
|
65
|
+
) => <A, E, R>(layer: Layer.Layer<A, E, R>) => Layer.Layer<A, E, R>,
|
|
66
|
+
<A, E, R>(
|
|
67
67
|
layer: Layer.Layer<A, E, R>,
|
|
68
68
|
urls: ReadonlyArray<string>
|
|
69
69
|
) => Layer.Layer<A, E, R>
|