@effect/platform 0.66.1 → 0.66.3
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/Command.js.map +1 -1
- package/dist/cjs/Cookies.js.map +1 -1
- package/dist/cjs/Effectify.js.map +1 -1
- package/dist/cjs/Headers.js.map +1 -1
- package/dist/cjs/HttpApi.js.map +1 -1
- package/dist/cjs/HttpApiBuilder.js.map +1 -1
- package/dist/cjs/HttpApiEndpoint.js.map +1 -1
- package/dist/cjs/HttpApiGroup.js.map +1 -1
- package/dist/cjs/HttpApiSchema.js.map +1 -1
- package/dist/cjs/HttpApiSecurity.js.map +1 -1
- package/dist/cjs/HttpApp.js.map +1 -1
- package/dist/cjs/HttpClient.js +8 -1
- package/dist/cjs/HttpClient.js.map +1 -1
- package/dist/cjs/HttpClientError.js +8 -1
- package/dist/cjs/HttpClientError.js.map +1 -1
- package/dist/cjs/HttpClientRequest.js.map +1 -1
- package/dist/cjs/HttpClientResponse.js +11 -1
- package/dist/cjs/HttpClientResponse.js.map +1 -1
- package/dist/cjs/HttpIncomingMessage.js.map +1 -1
- package/dist/cjs/HttpMiddleware.js.map +1 -1
- package/dist/cjs/HttpMultiplex.js.map +1 -1
- package/dist/cjs/HttpRouter.js.map +1 -1
- package/dist/cjs/HttpServer.js.map +1 -1
- package/dist/cjs/HttpServerResponse.js.map +1 -1
- package/dist/cjs/KeyValueStore.js.map +1 -1
- package/dist/cjs/Multipart.js.map +1 -1
- package/dist/cjs/OpenApi.js.map +1 -1
- package/dist/cjs/OpenApiJsonSchema.js +40 -27
- package/dist/cjs/OpenApiJsonSchema.js.map +1 -1
- package/dist/cjs/PlatformLogger.js.map +1 -1
- package/dist/cjs/Socket.js +4 -1
- package/dist/cjs/Socket.js.map +1 -1
- package/dist/cjs/Transferable.js.map +1 -1
- package/dist/cjs/UrlParams.js.map +1 -1
- package/dist/cjs/internal/httpClient.js +12 -14
- package/dist/cjs/internal/httpClient.js.map +1 -1
- package/dist/cjs/internal/httpClientResponse.js +16 -1
- package/dist/cjs/internal/httpClientResponse.js.map +1 -1
- package/dist/dts/Command.d.ts +134 -0
- package/dist/dts/Command.d.ts.map +1 -1
- package/dist/dts/Cookies.d.ts +120 -0
- package/dist/dts/Cookies.d.ts.map +1 -1
- package/dist/dts/Effectify.d.ts +9 -0
- package/dist/dts/Effectify.d.ts.map +1 -1
- package/dist/dts/Headers.d.ts +56 -0
- package/dist/dts/Headers.d.ts.map +1 -1
- package/dist/dts/HttpApi.d.ts +58 -0
- package/dist/dts/HttpApi.d.ts.map +1 -1
- package/dist/dts/HttpApiBuilder.d.ts +84 -0
- package/dist/dts/HttpApiBuilder.d.ts.map +1 -1
- package/dist/dts/HttpApiEndpoint.d.ts +118 -0
- package/dist/dts/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/dts/HttpApiGroup.d.ts +100 -0
- package/dist/dts/HttpApiGroup.d.ts.map +1 -1
- package/dist/dts/HttpApiSchema.d.ts +16 -0
- package/dist/dts/HttpApiSchema.d.ts.map +1 -1
- package/dist/dts/HttpApiSecurity.d.ts +16 -0
- package/dist/dts/HttpApiSecurity.d.ts.map +1 -1
- package/dist/dts/HttpApp.d.ts.map +1 -1
- package/dist/dts/HttpClient.d.ts +308 -0
- package/dist/dts/HttpClient.d.ts.map +1 -1
- package/dist/dts/HttpClientError.d.ts +5 -0
- package/dist/dts/HttpClientError.d.ts.map +1 -1
- package/dist/dts/HttpClientRequest.d.ts +208 -0
- package/dist/dts/HttpClientRequest.d.ts.map +1 -1
- package/dist/dts/HttpClientResponse.d.ts +30 -0
- package/dist/dts/HttpClientResponse.d.ts.map +1 -1
- package/dist/dts/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/dts/HttpMiddleware.d.ts +24 -0
- package/dist/dts/HttpMiddleware.d.ts.map +1 -1
- package/dist/dts/HttpMultiplex.d.ts +72 -0
- package/dist/dts/HttpMultiplex.d.ts.map +1 -1
- package/dist/dts/HttpRouter.d.ts +184 -0
- package/dist/dts/HttpRouter.d.ts.map +1 -1
- package/dist/dts/HttpServer.d.ts +32 -0
- package/dist/dts/HttpServer.d.ts.map +1 -1
- package/dist/dts/HttpServerResponse.d.ts +96 -0
- package/dist/dts/HttpServerResponse.d.ts.map +1 -1
- package/dist/dts/KeyValueStore.d.ts +8 -0
- package/dist/dts/KeyValueStore.d.ts.map +1 -1
- package/dist/dts/Multipart.d.ts +32 -0
- package/dist/dts/Multipart.d.ts.map +1 -1
- package/dist/dts/OpenApi.d.ts +8 -0
- package/dist/dts/OpenApi.d.ts.map +1 -1
- package/dist/dts/PlatformLogger.d.ts +46 -0
- package/dist/dts/PlatformLogger.d.ts.map +1 -1
- package/dist/dts/Socket.d.ts +8 -0
- package/dist/dts/Socket.d.ts.map +1 -1
- package/dist/dts/Transferable.d.ts +8 -0
- package/dist/dts/Transferable.d.ts.map +1 -1
- package/dist/dts/UrlParams.d.ts +64 -0
- package/dist/dts/UrlParams.d.ts.map +1 -1
- package/dist/esm/Command.js.map +1 -1
- package/dist/esm/Cookies.js.map +1 -1
- package/dist/esm/Effectify.js.map +1 -1
- package/dist/esm/Headers.js.map +1 -1
- package/dist/esm/HttpApi.js.map +1 -1
- package/dist/esm/HttpApiBuilder.js.map +1 -1
- package/dist/esm/HttpApiEndpoint.js.map +1 -1
- package/dist/esm/HttpApiGroup.js.map +1 -1
- package/dist/esm/HttpApiSchema.js.map +1 -1
- package/dist/esm/HttpApiSecurity.js.map +1 -1
- package/dist/esm/HttpApp.js.map +1 -1
- package/dist/esm/HttpClient.js +7 -0
- package/dist/esm/HttpClient.js.map +1 -1
- package/dist/esm/HttpClientError.js +6 -0
- package/dist/esm/HttpClientError.js.map +1 -1
- package/dist/esm/HttpClientRequest.js.map +1 -1
- package/dist/esm/HttpClientResponse.js +10 -0
- package/dist/esm/HttpClientResponse.js.map +1 -1
- package/dist/esm/HttpIncomingMessage.js.map +1 -1
- package/dist/esm/HttpMiddleware.js.map +1 -1
- package/dist/esm/HttpMultiplex.js.map +1 -1
- package/dist/esm/HttpRouter.js.map +1 -1
- package/dist/esm/HttpServer.js.map +1 -1
- package/dist/esm/HttpServerResponse.js.map +1 -1
- package/dist/esm/KeyValueStore.js.map +1 -1
- package/dist/esm/Multipart.js.map +1 -1
- package/dist/esm/OpenApi.js.map +1 -1
- package/dist/esm/OpenApiJsonSchema.js +40 -27
- package/dist/esm/OpenApiJsonSchema.js.map +1 -1
- package/dist/esm/PlatformLogger.js.map +1 -1
- package/dist/esm/Socket.js +4 -1
- package/dist/esm/Socket.js.map +1 -1
- package/dist/esm/Transferable.js.map +1 -1
- package/dist/esm/UrlParams.js.map +1 -1
- package/dist/esm/internal/httpClient.js +11 -13
- package/dist/esm/internal/httpClient.js.map +1 -1
- package/dist/esm/internal/httpClientResponse.js +14 -0
- package/dist/esm/internal/httpClientResponse.js.map +1 -1
- package/package.json +3 -3
- package/src/Command.ts +134 -0
- package/src/Cookies.ts +128 -38
- package/src/Effectify.ts +9 -0
- package/src/Headers.ts +106 -7
- package/src/HttpApi.ts +58 -0
- package/src/HttpApiBuilder.ts +85 -3
- package/src/HttpApiEndpoint.ts +121 -9
- package/src/HttpApiGroup.ts +102 -7
- package/src/HttpApiSchema.ts +22 -4
- package/src/HttpApiSecurity.ts +16 -0
- package/src/HttpApp.ts +8 -0
- package/src/HttpClient.ts +315 -11
- package/src/HttpClientError.ts +7 -0
- package/src/HttpClientRequest.ts +213 -1
- package/src/HttpClientResponse.ts +33 -0
- package/src/HttpIncomingMessage.ts +8 -0
- package/src/HttpMiddleware.ts +24 -0
- package/src/HttpMultiplex.ts +72 -0
- package/src/HttpRouter.ts +189 -18
- package/src/HttpServer.ts +34 -6
- package/src/HttpServerResponse.ts +98 -10
- package/src/KeyValueStore.ts +8 -0
- package/src/Multipart.ts +32 -0
- package/src/OpenApi.ts +31 -18
- package/src/OpenApiJsonSchema.ts +39 -21
- package/src/PlatformLogger.ts +46 -0
- package/src/Socket.ts +19 -13
- package/src/Transferable.ts +9 -3
- package/src/UrlParams.ts +64 -0
- package/src/internal/httpClient.ts +41 -26
- package/src/internal/httpClientResponse.ts +40 -1
package/src/Cookies.ts
CHANGED
|
@@ -377,11 +377,20 @@ export const unsafeMakeCookie = (
|
|
|
377
377
|
* @category combinators
|
|
378
378
|
*/
|
|
379
379
|
export const setCookie: {
|
|
380
|
+
/**
|
|
381
|
+
* Add a cookie to a Cookies object
|
|
382
|
+
*
|
|
383
|
+
* @since 1.0.0
|
|
384
|
+
* @category combinators
|
|
385
|
+
*/
|
|
380
386
|
(cookie: Cookie): (self: Cookies) => Cookies
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
387
|
+
/**
|
|
388
|
+
* Add a cookie to a Cookies object
|
|
389
|
+
*
|
|
390
|
+
* @since 1.0.0
|
|
391
|
+
* @category combinators
|
|
392
|
+
*/
|
|
393
|
+
(self: Cookies, cookie: Cookie): Cookies
|
|
385
394
|
} = dual(
|
|
386
395
|
2,
|
|
387
396
|
(self: Cookies, cookie: Cookie) =>
|
|
@@ -399,11 +408,20 @@ export const setCookie: {
|
|
|
399
408
|
* @category combinators
|
|
400
409
|
*/
|
|
401
410
|
export const setAllCookie: {
|
|
411
|
+
/**
|
|
412
|
+
* Add multiple cookies to a Cookies object
|
|
413
|
+
*
|
|
414
|
+
* @since 1.0.0
|
|
415
|
+
* @category combinators
|
|
416
|
+
*/
|
|
402
417
|
(cookies: Iterable<Cookie>): (self: Cookies) => Cookies
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
418
|
+
/**
|
|
419
|
+
* Add multiple cookies to a Cookies object
|
|
420
|
+
*
|
|
421
|
+
* @since 1.0.0
|
|
422
|
+
* @category combinators
|
|
423
|
+
*/
|
|
424
|
+
(self: Cookies, cookies: Iterable<Cookie>): Cookies
|
|
407
425
|
} = dual(2, (self: Cookies, cookies: Iterable<Cookie>) => {
|
|
408
426
|
const record = { ...self.cookies }
|
|
409
427
|
for (const cookie of cookies) {
|
|
@@ -419,11 +437,20 @@ export const setAllCookie: {
|
|
|
419
437
|
* @category combinators
|
|
420
438
|
*/
|
|
421
439
|
export const merge: {
|
|
440
|
+
/**
|
|
441
|
+
* Combine two Cookies objects, removing duplicates from the first
|
|
442
|
+
*
|
|
443
|
+
* @since 1.0.0
|
|
444
|
+
* @category combinators
|
|
445
|
+
*/
|
|
422
446
|
(that: Cookies): (self: Cookies) => Cookies
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
447
|
+
/**
|
|
448
|
+
* Combine two Cookies objects, removing duplicates from the first
|
|
449
|
+
*
|
|
450
|
+
* @since 1.0.0
|
|
451
|
+
* @category combinators
|
|
452
|
+
*/
|
|
453
|
+
(self: Cookies, that: Cookies): Cookies
|
|
427
454
|
} = dual(2, (self: Cookies, that: Cookies) =>
|
|
428
455
|
fromReadonlyRecord({
|
|
429
456
|
...self.cookies,
|
|
@@ -437,11 +464,20 @@ export const merge: {
|
|
|
437
464
|
* @category combinators
|
|
438
465
|
*/
|
|
439
466
|
export const remove: {
|
|
467
|
+
/**
|
|
468
|
+
* Remove a cookie by name
|
|
469
|
+
*
|
|
470
|
+
* @since 1.0.0
|
|
471
|
+
* @category combinators
|
|
472
|
+
*/
|
|
440
473
|
(name: string): (self: Cookies) => Cookies
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
474
|
+
/**
|
|
475
|
+
* Remove a cookie by name
|
|
476
|
+
*
|
|
477
|
+
* @since 1.0.0
|
|
478
|
+
* @category combinators
|
|
479
|
+
*/
|
|
480
|
+
(self: Cookies, name: string): Cookies
|
|
445
481
|
} = dual(2, (self: Cookies, name: string) => fromReadonlyRecord(Record.remove(self.cookies, name)))
|
|
446
482
|
|
|
447
483
|
/**
|
|
@@ -451,7 +487,19 @@ export const remove: {
|
|
|
451
487
|
* @category combinators
|
|
452
488
|
*/
|
|
453
489
|
export const get: {
|
|
490
|
+
/**
|
|
491
|
+
* Get a cookie from a Cookies object
|
|
492
|
+
*
|
|
493
|
+
* @since 1.0.0
|
|
494
|
+
* @category combinators
|
|
495
|
+
*/
|
|
454
496
|
(name: string): (self: Cookies) => Option.Option<Cookie>
|
|
497
|
+
/**
|
|
498
|
+
* Get a cookie from a Cookies object
|
|
499
|
+
*
|
|
500
|
+
* @since 1.0.0
|
|
501
|
+
* @category combinators
|
|
502
|
+
*/
|
|
455
503
|
(self: Cookies, name: string): Option.Option<Cookie>
|
|
456
504
|
} = dual(
|
|
457
505
|
(args) => isCookies(args[0]),
|
|
@@ -465,7 +513,19 @@ export const get: {
|
|
|
465
513
|
* @category combinators
|
|
466
514
|
*/
|
|
467
515
|
export const getValue: {
|
|
516
|
+
/**
|
|
517
|
+
* Get a cookie from a Cookies object
|
|
518
|
+
*
|
|
519
|
+
* @since 1.0.0
|
|
520
|
+
* @category combinators
|
|
521
|
+
*/
|
|
468
522
|
(name: string): (self: Cookies) => Option.Option<string>
|
|
523
|
+
/**
|
|
524
|
+
* Get a cookie from a Cookies object
|
|
525
|
+
*
|
|
526
|
+
* @since 1.0.0
|
|
527
|
+
* @category combinators
|
|
528
|
+
*/
|
|
469
529
|
(self: Cookies, name: string): Option.Option<string>
|
|
470
530
|
} = dual(
|
|
471
531
|
(args) => isCookies(args[0]),
|
|
@@ -480,17 +540,20 @@ export const getValue: {
|
|
|
480
540
|
* @category combinators
|
|
481
541
|
*/
|
|
482
542
|
export const set: {
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
543
|
+
/**
|
|
544
|
+
* Add a cookie to a Cookies object
|
|
545
|
+
*
|
|
546
|
+
* @since 1.0.0
|
|
547
|
+
* @category combinators
|
|
548
|
+
*/
|
|
549
|
+
(name: string, value: string, options?: Cookie["options"]): (self: Cookies) => Either.Either<Cookies, CookiesError>
|
|
550
|
+
/**
|
|
551
|
+
* Add a cookie to a Cookies object
|
|
552
|
+
*
|
|
553
|
+
* @since 1.0.0
|
|
554
|
+
* @category combinators
|
|
555
|
+
*/
|
|
556
|
+
(self: Cookies, name: string, value: string, options?: Cookie["options"]): Either.Either<Cookies, CookiesError>
|
|
494
557
|
} = dual(
|
|
495
558
|
(args) => isCookies(args[0]),
|
|
496
559
|
(self: Cookies, name: string, value: string, options?: Cookie["options"]) =>
|
|
@@ -507,17 +570,20 @@ export const set: {
|
|
|
507
570
|
* @category combinators
|
|
508
571
|
*/
|
|
509
572
|
export const unsafeSet: {
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
573
|
+
/**
|
|
574
|
+
* Add a cookie to a Cookies object
|
|
575
|
+
*
|
|
576
|
+
* @since 1.0.0
|
|
577
|
+
* @category combinators
|
|
578
|
+
*/
|
|
579
|
+
(name: string, value: string, options?: Cookie["options"]): (self: Cookies) => Cookies
|
|
580
|
+
/**
|
|
581
|
+
* Add a cookie to a Cookies object
|
|
582
|
+
*
|
|
583
|
+
* @since 1.0.0
|
|
584
|
+
* @category combinators
|
|
585
|
+
*/
|
|
586
|
+
(self: Cookies, name: string, value: string, options?: Cookie["options"]): Cookies
|
|
521
587
|
} = dual(
|
|
522
588
|
(args) => isCookies(args[0]),
|
|
523
589
|
(self: Cookies, name: string, value: string, options?: Cookie["options"]) =>
|
|
@@ -535,9 +601,21 @@ export const unsafeSet: {
|
|
|
535
601
|
* @category combinators
|
|
536
602
|
*/
|
|
537
603
|
export const setAll: {
|
|
604
|
+
/**
|
|
605
|
+
* Add multiple cookies to a Cookies object
|
|
606
|
+
*
|
|
607
|
+
* @since 1.0.0
|
|
608
|
+
* @category combinators
|
|
609
|
+
*/
|
|
538
610
|
(
|
|
539
611
|
cookies: Iterable<readonly [name: string, value: string, options?: Cookie["options"]]>
|
|
540
612
|
): (self: Cookies) => Either.Either<Cookies, CookiesError>
|
|
613
|
+
/**
|
|
614
|
+
* Add multiple cookies to a Cookies object
|
|
615
|
+
*
|
|
616
|
+
* @since 1.0.0
|
|
617
|
+
* @category combinators
|
|
618
|
+
*/
|
|
541
619
|
(
|
|
542
620
|
self: Cookies,
|
|
543
621
|
cookies: Iterable<readonly [name: string, value: string, options?: Cookie["options"]]>
|
|
@@ -567,9 +645,21 @@ export const setAll: {
|
|
|
567
645
|
* @category combinators
|
|
568
646
|
*/
|
|
569
647
|
export const unsafeSetAll: {
|
|
648
|
+
/**
|
|
649
|
+
* Add multiple cookies to a Cookies object, throwing an error if invalid
|
|
650
|
+
*
|
|
651
|
+
* @since 1.0.0
|
|
652
|
+
* @category combinators
|
|
653
|
+
*/
|
|
570
654
|
(
|
|
571
655
|
cookies: Iterable<readonly [name: string, value: string, options?: Cookie["options"]]>
|
|
572
656
|
): (self: Cookies) => Cookies
|
|
657
|
+
/**
|
|
658
|
+
* Add multiple cookies to a Cookies object, throwing an error if invalid
|
|
659
|
+
*
|
|
660
|
+
* @since 1.0.0
|
|
661
|
+
* @category combinators
|
|
662
|
+
*/
|
|
573
663
|
(
|
|
574
664
|
self: Cookies,
|
|
575
665
|
cookies: Iterable<readonly [name: string, value: string, options?: Cookie["options"]]>
|
package/src/Effectify.ts
CHANGED
|
@@ -244,11 +244,20 @@ export type EffectifyError<T> = T extends {
|
|
|
244
244
|
* @since 1.0.0
|
|
245
245
|
*/
|
|
246
246
|
export const effectify: {
|
|
247
|
+
/**
|
|
248
|
+
* @since 1.0.0
|
|
249
|
+
*/
|
|
247
250
|
<F extends (...args: Array<any>) => any>(fn: F): Effectify<F, EffectifyError<F>>
|
|
251
|
+
/**
|
|
252
|
+
* @since 1.0.0
|
|
253
|
+
*/
|
|
248
254
|
<F extends (...args: Array<any>) => any, E>(
|
|
249
255
|
fn: F,
|
|
250
256
|
onError: (error: EffectifyError<F>, args: Parameters<F>) => E
|
|
251
257
|
): Effectify<F, E>
|
|
258
|
+
/**
|
|
259
|
+
* @since 1.0.0
|
|
260
|
+
*/
|
|
252
261
|
<F extends (...args: Array<any>) => any, E, E2>(
|
|
253
262
|
fn: F,
|
|
254
263
|
onError: (error: EffectifyError<F>, args: Parameters<F>) => E,
|
package/src/Headers.ts
CHANGED
|
@@ -117,10 +117,26 @@ export const unsafeFromRecord = (input: Record.ReadonlyRecord<string, string>):
|
|
|
117
117
|
* @category combinators
|
|
118
118
|
*/
|
|
119
119
|
export const has: {
|
|
120
|
+
/**
|
|
121
|
+
* @since 1.0.0
|
|
122
|
+
* @category combinators
|
|
123
|
+
*/
|
|
120
124
|
(key: string): (self: Headers) => boolean
|
|
125
|
+
/**
|
|
126
|
+
* @since 1.0.0
|
|
127
|
+
* @category combinators
|
|
128
|
+
*/
|
|
121
129
|
(self: Headers, key: string): boolean
|
|
122
130
|
} = dual<
|
|
131
|
+
/**
|
|
132
|
+
* @since 1.0.0
|
|
133
|
+
* @category combinators
|
|
134
|
+
*/
|
|
123
135
|
(key: string) => (self: Headers) => boolean,
|
|
136
|
+
/**
|
|
137
|
+
* @since 1.0.0
|
|
138
|
+
* @category combinators
|
|
139
|
+
*/
|
|
124
140
|
(self: Headers, key: string) => boolean
|
|
125
141
|
>(2, (self, key) => key.toLowerCase() in self)
|
|
126
142
|
|
|
@@ -129,10 +145,26 @@ export const has: {
|
|
|
129
145
|
* @category combinators
|
|
130
146
|
*/
|
|
131
147
|
export const get: {
|
|
148
|
+
/**
|
|
149
|
+
* @since 1.0.0
|
|
150
|
+
* @category combinators
|
|
151
|
+
*/
|
|
132
152
|
(key: string): (self: Headers) => Option.Option<string>
|
|
153
|
+
/**
|
|
154
|
+
* @since 1.0.0
|
|
155
|
+
* @category combinators
|
|
156
|
+
*/
|
|
133
157
|
(self: Headers, key: string): Option.Option<string>
|
|
134
158
|
} = dual<
|
|
159
|
+
/**
|
|
160
|
+
* @since 1.0.0
|
|
161
|
+
* @category combinators
|
|
162
|
+
*/
|
|
135
163
|
(key: string) => (self: Headers) => Option.Option<string>,
|
|
164
|
+
/**
|
|
165
|
+
* @since 1.0.0
|
|
166
|
+
* @category combinators
|
|
167
|
+
*/
|
|
136
168
|
(self: Headers, key: string) => Option.Option<string>
|
|
137
169
|
>(2, (self, key) => Record.get(self as Record<string, string>, key.toLowerCase()))
|
|
138
170
|
|
|
@@ -141,10 +173,26 @@ export const get: {
|
|
|
141
173
|
* @category combinators
|
|
142
174
|
*/
|
|
143
175
|
export const set: {
|
|
176
|
+
/**
|
|
177
|
+
* @since 1.0.0
|
|
178
|
+
* @category combinators
|
|
179
|
+
*/
|
|
144
180
|
(key: string, value: string): (self: Headers) => Headers
|
|
181
|
+
/**
|
|
182
|
+
* @since 1.0.0
|
|
183
|
+
* @category combinators
|
|
184
|
+
*/
|
|
145
185
|
(self: Headers, key: string, value: string): Headers
|
|
146
186
|
} = dual<
|
|
187
|
+
/**
|
|
188
|
+
* @since 1.0.0
|
|
189
|
+
* @category combinators
|
|
190
|
+
*/
|
|
147
191
|
(key: string, value: string) => (self: Headers) => Headers,
|
|
192
|
+
/**
|
|
193
|
+
* @since 1.0.0
|
|
194
|
+
* @category combinators
|
|
195
|
+
*/
|
|
148
196
|
(self: Headers, key: string, value: string) => Headers
|
|
149
197
|
>(3, (self, key, value) => {
|
|
150
198
|
const out = make(self)
|
|
@@ -157,10 +205,26 @@ export const set: {
|
|
|
157
205
|
* @category combinators
|
|
158
206
|
*/
|
|
159
207
|
export const setAll: {
|
|
208
|
+
/**
|
|
209
|
+
* @since 1.0.0
|
|
210
|
+
* @category combinators
|
|
211
|
+
*/
|
|
160
212
|
(headers: Input): (self: Headers) => Headers
|
|
213
|
+
/**
|
|
214
|
+
* @since 1.0.0
|
|
215
|
+
* @category combinators
|
|
216
|
+
*/
|
|
161
217
|
(self: Headers, headers: Input): Headers
|
|
162
218
|
} = dual<
|
|
219
|
+
/**
|
|
220
|
+
* @since 1.0.0
|
|
221
|
+
* @category combinators
|
|
222
|
+
*/
|
|
163
223
|
(headers: Input) => (self: Headers) => Headers,
|
|
224
|
+
/**
|
|
225
|
+
* @since 1.0.0
|
|
226
|
+
* @category combinators
|
|
227
|
+
*/
|
|
164
228
|
(self: Headers, headers: Input) => Headers
|
|
165
229
|
>(2, (self, headers) =>
|
|
166
230
|
make({
|
|
@@ -173,10 +237,26 @@ export const setAll: {
|
|
|
173
237
|
* @category combinators
|
|
174
238
|
*/
|
|
175
239
|
export const merge: {
|
|
240
|
+
/**
|
|
241
|
+
* @since 1.0.0
|
|
242
|
+
* @category combinators
|
|
243
|
+
*/
|
|
176
244
|
(headers: Headers): (self: Headers) => Headers
|
|
245
|
+
/**
|
|
246
|
+
* @since 1.0.0
|
|
247
|
+
* @category combinators
|
|
248
|
+
*/
|
|
177
249
|
(self: Headers, headers: Headers): Headers
|
|
178
250
|
} = dual<
|
|
251
|
+
/**
|
|
252
|
+
* @since 1.0.0
|
|
253
|
+
* @category combinators
|
|
254
|
+
*/
|
|
179
255
|
(headers: Headers) => (self: Headers) => Headers,
|
|
256
|
+
/**
|
|
257
|
+
* @since 1.0.0
|
|
258
|
+
* @category combinators
|
|
259
|
+
*/
|
|
180
260
|
(self: Headers, headers: Headers) => Headers
|
|
181
261
|
>(2, (self, headers) => {
|
|
182
262
|
const out = make(self)
|
|
@@ -189,10 +269,26 @@ export const merge: {
|
|
|
189
269
|
* @category combinators
|
|
190
270
|
*/
|
|
191
271
|
export const remove: {
|
|
272
|
+
/**
|
|
273
|
+
* @since 1.0.0
|
|
274
|
+
* @category combinators
|
|
275
|
+
*/
|
|
192
276
|
(key: string): (self: Headers) => Headers
|
|
277
|
+
/**
|
|
278
|
+
* @since 1.0.0
|
|
279
|
+
* @category combinators
|
|
280
|
+
*/
|
|
193
281
|
(self: Headers, key: string): Headers
|
|
194
282
|
} = dual<
|
|
283
|
+
/**
|
|
284
|
+
* @since 1.0.0
|
|
285
|
+
* @category combinators
|
|
286
|
+
*/
|
|
195
287
|
(key: string) => (self: Headers) => Headers,
|
|
288
|
+
/**
|
|
289
|
+
* @since 1.0.0
|
|
290
|
+
* @category combinators
|
|
291
|
+
*/
|
|
196
292
|
(self: Headers, key: string) => Headers
|
|
197
293
|
>(2, (self, key) => {
|
|
198
294
|
const out = make(self)
|
|
@@ -205,13 +301,16 @@ export const remove: {
|
|
|
205
301
|
* @category combinators
|
|
206
302
|
*/
|
|
207
303
|
export const redact: {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
304
|
+
/**
|
|
305
|
+
* @since 1.0.0
|
|
306
|
+
* @category combinators
|
|
307
|
+
*/
|
|
308
|
+
(key: string | RegExp | ReadonlyArray<string | RegExp>): (self: Headers) => Record<string, string | Redacted.Redacted>
|
|
309
|
+
/**
|
|
310
|
+
* @since 1.0.0
|
|
311
|
+
* @category combinators
|
|
312
|
+
*/
|
|
313
|
+
(self: Headers, key: string | RegExp | ReadonlyArray<string | RegExp>): Record<string, string | Redacted.Redacted>
|
|
215
314
|
} = dual(
|
|
216
315
|
2,
|
|
217
316
|
(
|
package/src/HttpApi.ts
CHANGED
|
@@ -134,21 +134,45 @@ export const empty: HttpApi = makeProto({
|
|
|
134
134
|
* @category constructors
|
|
135
135
|
*/
|
|
136
136
|
export const addGroup: {
|
|
137
|
+
/**
|
|
138
|
+
* Add a `HttpApiGroup` to an `HttpApi`.
|
|
139
|
+
*
|
|
140
|
+
* @since 1.0.0
|
|
141
|
+
* @category constructors
|
|
142
|
+
*/
|
|
137
143
|
<Group extends HttpApiGroup.HttpApiGroup.Any>(
|
|
138
144
|
group: Group
|
|
139
145
|
): <Groups extends HttpApiGroup.HttpApiGroup.Any, Error, ErrorR>(
|
|
140
146
|
self: HttpApi<Groups, Error, ErrorR>
|
|
141
147
|
) => HttpApi<Groups | Group, Error, ErrorR>
|
|
148
|
+
/**
|
|
149
|
+
* Add a `HttpApiGroup` to an `HttpApi`.
|
|
150
|
+
*
|
|
151
|
+
* @since 1.0.0
|
|
152
|
+
* @category constructors
|
|
153
|
+
*/
|
|
142
154
|
<Group extends HttpApiGroup.HttpApiGroup.Any>(
|
|
143
155
|
path: HttpRouter.PathInput,
|
|
144
156
|
group: Group
|
|
145
157
|
): <Groups extends HttpApiGroup.HttpApiGroup.Any, Error, ErrorR>(
|
|
146
158
|
self: HttpApi<Groups, Error, ErrorR>
|
|
147
159
|
) => HttpApi<Groups | Group, Error, ErrorR>
|
|
160
|
+
/**
|
|
161
|
+
* Add a `HttpApiGroup` to an `HttpApi`.
|
|
162
|
+
*
|
|
163
|
+
* @since 1.0.0
|
|
164
|
+
* @category constructors
|
|
165
|
+
*/
|
|
148
166
|
<Groups extends HttpApiGroup.HttpApiGroup.Any, Error, ErrorR, Group extends HttpApiGroup.HttpApiGroup.Any>(
|
|
149
167
|
self: HttpApi<Groups, Error, ErrorR>,
|
|
150
168
|
group: Group
|
|
151
169
|
): HttpApi<Groups | Group, Error, ErrorR>
|
|
170
|
+
/**
|
|
171
|
+
* Add a `HttpApiGroup` to an `HttpApi`.
|
|
172
|
+
*
|
|
173
|
+
* @since 1.0.0
|
|
174
|
+
* @category constructors
|
|
175
|
+
*/
|
|
152
176
|
<Groups extends HttpApiGroup.HttpApiGroup.Any, Error, ErrorR, Group extends HttpApiGroup.HttpApiGroup.Any>(
|
|
153
177
|
self: HttpApi<Groups, Error, ErrorR>,
|
|
154
178
|
path: HttpRouter.PathInput,
|
|
@@ -178,6 +202,15 @@ export const addGroup: {
|
|
|
178
202
|
* @category errors
|
|
179
203
|
*/
|
|
180
204
|
export const addError: {
|
|
205
|
+
/**
|
|
206
|
+
* Add an error schema to an `HttpApi`, which is shared by all endpoints in the
|
|
207
|
+
* `HttpApi`.
|
|
208
|
+
*
|
|
209
|
+
* Useful for adding error types from middleware or other shared error types.
|
|
210
|
+
*
|
|
211
|
+
* @since 1.0.0
|
|
212
|
+
* @category errors
|
|
213
|
+
*/
|
|
181
214
|
<A, I, R>(
|
|
182
215
|
schema: Schema.Schema<A, I, R>,
|
|
183
216
|
annotations?: {
|
|
@@ -186,6 +219,15 @@ export const addError: {
|
|
|
186
219
|
): <Groups extends HttpApiGroup.HttpApiGroup.Any, Error, ErrorR>(
|
|
187
220
|
self: HttpApi<Groups, Error, ErrorR>
|
|
188
221
|
) => HttpApi<Groups, Error | A, ErrorR | R>
|
|
222
|
+
/**
|
|
223
|
+
* Add an error schema to an `HttpApi`, which is shared by all endpoints in the
|
|
224
|
+
* `HttpApi`.
|
|
225
|
+
*
|
|
226
|
+
* Useful for adding error types from middleware or other shared error types.
|
|
227
|
+
*
|
|
228
|
+
* @since 1.0.0
|
|
229
|
+
* @category errors
|
|
230
|
+
*/
|
|
189
231
|
<Groups extends HttpApiGroup.HttpApiGroup.Any, Error, ErrorR, A, I, R>(
|
|
190
232
|
self: HttpApi<Groups, Error, ErrorR>,
|
|
191
233
|
schema: Schema.Schema<A, I, R>,
|
|
@@ -219,7 +261,15 @@ export const addError: {
|
|
|
219
261
|
* @category annotations
|
|
220
262
|
*/
|
|
221
263
|
export const annotateMerge: {
|
|
264
|
+
/**
|
|
265
|
+
* @since 1.0.0
|
|
266
|
+
* @category annotations
|
|
267
|
+
*/
|
|
222
268
|
<I>(context: Context.Context<I>): <A extends HttpApi.Any>(self: A) => A
|
|
269
|
+
/**
|
|
270
|
+
* @since 1.0.0
|
|
271
|
+
* @category annotations
|
|
272
|
+
*/
|
|
223
273
|
<A extends HttpApi.Any, I>(self: A, context: Context.Context<I>): A
|
|
224
274
|
} = dual(
|
|
225
275
|
2,
|
|
@@ -236,7 +286,15 @@ export const annotateMerge: {
|
|
|
236
286
|
* @category annotations
|
|
237
287
|
*/
|
|
238
288
|
export const annotate: {
|
|
289
|
+
/**
|
|
290
|
+
* @since 1.0.0
|
|
291
|
+
* @category annotations
|
|
292
|
+
*/
|
|
239
293
|
<I, S>(tag: Context.Tag<I, S>, value: S): <A extends HttpApi.Any>(self: A) => A
|
|
294
|
+
/**
|
|
295
|
+
* @since 1.0.0
|
|
296
|
+
* @category annotations
|
|
297
|
+
*/
|
|
240
298
|
<A extends HttpApi.Any, I, S>(self: A, tag: Context.Tag<I, S>, value: S): A
|
|
241
299
|
} = dual(
|
|
242
300
|
3,
|