@effect/platform 0.48.15 → 0.48.17
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/Http/Cookies/package.json +6 -0
- package/README.md +235 -46
- package/dist/cjs/Http/Client.js +6 -1
- package/dist/cjs/Http/Client.js.map +1 -1
- package/dist/cjs/Http/ClientRequest.js.map +1 -1
- package/dist/cjs/Http/ClientResponse.js.map +1 -1
- package/dist/cjs/Http/Cookies.js +566 -0
- package/dist/cjs/Http/Cookies.js.map +1 -0
- package/dist/cjs/Http/Headers.js +2 -2
- package/dist/cjs/Http/Headers.js.map +1 -1
- package/dist/cjs/Http/IncomingMessage.js +12 -16
- package/dist/cjs/Http/IncomingMessage.js.map +1 -1
- package/dist/cjs/Http/Multipart.js.map +1 -1
- package/dist/cjs/Http/Router.js +11 -1
- package/dist/cjs/Http/Router.js.map +1 -1
- package/dist/cjs/Http/ServerRequest.js +6 -1
- package/dist/cjs/Http/ServerRequest.js.map +1 -1
- package/dist/cjs/Http/ServerResponse.js +36 -1
- package/dist/cjs/Http/ServerResponse.js.map +1 -1
- package/dist/cjs/Http/UrlParams.js +2 -2
- package/dist/cjs/Http/UrlParams.js.map +1 -1
- package/dist/cjs/HttpClient.js +3 -1
- package/dist/cjs/HttpClient.js.map +1 -1
- package/dist/cjs/HttpServer.js +3 -1
- package/dist/cjs/HttpServer.js.map +1 -1
- package/dist/cjs/internal/http/body.js +2 -2
- package/dist/cjs/internal/http/body.js.map +1 -1
- package/dist/cjs/internal/http/client.js +9 -3
- package/dist/cjs/internal/http/client.js.map +1 -1
- package/dist/cjs/internal/http/clientRequest.js +2 -2
- package/dist/cjs/internal/http/clientRequest.js.map +1 -1
- package/dist/cjs/internal/http/clientResponse.js +16 -8
- package/dist/cjs/internal/http/clientResponse.js.map +1 -1
- package/dist/cjs/internal/http/multipart.js +4 -4
- package/dist/cjs/internal/http/multipart.js.map +1 -1
- package/dist/cjs/internal/http/router.js +34 -7
- package/dist/cjs/internal/http/router.js.map +1 -1
- package/dist/cjs/internal/http/serverRequest.js +30 -15
- package/dist/cjs/internal/http/serverRequest.js.map +1 -1
- package/dist/cjs/internal/http/serverResponse.js +48 -23
- package/dist/cjs/internal/http/serverResponse.js.map +1 -1
- package/dist/dts/Error.d.ts.map +1 -1
- package/dist/dts/Http/App.d.ts +1 -1
- package/dist/dts/Http/App.d.ts.map +1 -1
- package/dist/dts/Http/Client.d.ts +13 -2
- package/dist/dts/Http/Client.d.ts.map +1 -1
- package/dist/dts/Http/ClientRequest.d.ts +2 -1
- package/dist/dts/Http/ClientRequest.d.ts.map +1 -1
- package/dist/dts/Http/ClientResponse.d.ts +7 -4
- package/dist/dts/Http/ClientResponse.d.ts.map +1 -1
- package/dist/dts/Http/Cookies.d.ts +253 -0
- package/dist/dts/Http/Cookies.d.ts.map +1 -0
- package/dist/dts/Http/Headers.d.ts +2 -2
- package/dist/dts/Http/Headers.d.ts.map +1 -1
- package/dist/dts/Http/IncomingMessage.d.ts +7 -6
- package/dist/dts/Http/IncomingMessage.d.ts.map +1 -1
- package/dist/dts/Http/Multipart.d.ts +3 -2
- package/dist/dts/Http/Multipart.d.ts.map +1 -1
- package/dist/dts/Http/Router.d.ts +29 -3
- package/dist/dts/Http/Router.d.ts.map +1 -1
- package/dist/dts/Http/ServerRequest.d.ts +14 -6
- package/dist/dts/Http/ServerRequest.d.ts.map +1 -1
- package/dist/dts/Http/ServerResponse.d.ts +89 -13
- package/dist/dts/Http/ServerResponse.d.ts.map +1 -1
- package/dist/dts/Http/UrlParams.d.ts +3 -2
- package/dist/dts/Http/UrlParams.d.ts.map +1 -1
- package/dist/dts/HttpClient.d.ts +8 -0
- package/dist/dts/HttpClient.d.ts.map +1 -1
- package/dist/dts/HttpServer.d.ts +8 -0
- package/dist/dts/HttpServer.d.ts.map +1 -1
- package/dist/dts/Socket.d.ts +3 -3
- package/dist/dts/Socket.d.ts.map +1 -1
- package/dist/dts/internal/http/router.d.ts.map +1 -1
- package/dist/esm/Http/Client.js +5 -0
- package/dist/esm/Http/Client.js.map +1 -1
- package/dist/esm/Http/ClientRequest.js.map +1 -1
- package/dist/esm/Http/ClientResponse.js.map +1 -1
- package/dist/esm/Http/Cookies.js +518 -0
- package/dist/esm/Http/Cookies.js.map +1 -0
- package/dist/esm/Http/Headers.js +2 -2
- package/dist/esm/Http/Headers.js.map +1 -1
- package/dist/esm/Http/IncomingMessage.js +12 -15
- package/dist/esm/Http/IncomingMessage.js.map +1 -1
- package/dist/esm/Http/Multipart.js.map +1 -1
- package/dist/esm/Http/Router.js +10 -0
- package/dist/esm/Http/Router.js.map +1 -1
- package/dist/esm/Http/ServerRequest.js +5 -0
- package/dist/esm/Http/ServerRequest.js.map +1 -1
- package/dist/esm/Http/ServerResponse.js +35 -0
- package/dist/esm/Http/ServerResponse.js.map +1 -1
- package/dist/esm/Http/UrlParams.js +2 -2
- package/dist/esm/Http/UrlParams.js.map +1 -1
- package/dist/esm/HttpClient.js +8 -0
- package/dist/esm/HttpClient.js.map +1 -1
- package/dist/esm/HttpServer.js +8 -0
- package/dist/esm/HttpServer.js.map +1 -1
- package/dist/esm/internal/http/body.js +2 -2
- package/dist/esm/internal/http/body.js.map +1 -1
- package/dist/esm/internal/http/client.js +8 -2
- package/dist/esm/internal/http/client.js.map +1 -1
- package/dist/esm/internal/http/clientRequest.js +2 -2
- package/dist/esm/internal/http/clientRequest.js.map +1 -1
- package/dist/esm/internal/http/clientResponse.js +16 -8
- package/dist/esm/internal/http/clientResponse.js.map +1 -1
- package/dist/esm/internal/http/multipart.js +4 -4
- package/dist/esm/internal/http/multipart.js.map +1 -1
- package/dist/esm/internal/http/router.js +31 -6
- package/dist/esm/internal/http/router.js.map +1 -1
- package/dist/esm/internal/http/serverRequest.js +28 -14
- package/dist/esm/internal/http/serverRequest.js.map +1 -1
- package/dist/esm/internal/http/serverResponse.js +47 -22
- package/dist/esm/internal/http/serverResponse.js.map +1 -1
- package/package.json +12 -4
- package/src/Http/Client.ts +16 -2
- package/src/Http/ClientRequest.ts +3 -1
- package/src/Http/ClientResponse.ts +18 -7
- package/src/Http/Cookies.ts +718 -0
- package/src/Http/Headers.ts +16 -8
- package/src/Http/IncomingMessage.ts +17 -12
- package/src/Http/Multipart.ts +5 -2
- package/src/Http/Router.ts +50 -3
- package/src/Http/ServerRequest.ts +25 -7
- package/src/Http/ServerResponse.ts +145 -13
- package/src/Http/UrlParams.ts +3 -2
- package/src/HttpClient.ts +8 -0
- package/src/HttpServer.ts +8 -0
- package/src/internal/http/body.ts +3 -2
- package/src/internal/http/client.ts +45 -5
- package/src/internal/http/clientRequest.ts +3 -2
- package/src/internal/http/clientResponse.ts +18 -8
- package/src/internal/http/multipart.ts +7 -4
- package/src/internal/http/router.ts +80 -6
- package/src/internal/http/serverRequest.ts +41 -15
- package/src/internal/http/serverResponse.ts +190 -18
package/src/Http/Client.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @since 1.0.0
|
|
3
3
|
*/
|
|
4
|
+
import type { Cookies } from "@effect/platform/Http/Cookies"
|
|
5
|
+
import type { ParseOptions } from "@effect/schema/AST"
|
|
4
6
|
import type * as ParseResult from "@effect/schema/ParseResult"
|
|
5
7
|
import type * as Schema from "@effect/schema/Schema"
|
|
6
8
|
import type * as Context from "effect/Context"
|
|
@@ -9,6 +11,7 @@ import type { Inspectable } from "effect/Inspectable"
|
|
|
9
11
|
import type * as Layer from "effect/Layer"
|
|
10
12
|
import type { Pipeable } from "effect/Pipeable"
|
|
11
13
|
import type * as Predicate from "effect/Predicate"
|
|
14
|
+
import type { Ref } from "effect/Ref"
|
|
12
15
|
import type * as Schedule from "effect/Schedule"
|
|
13
16
|
import type * as Scope from "effect/Scope"
|
|
14
17
|
import * as internal from "../internal/http/client.js"
|
|
@@ -382,7 +385,8 @@ export const scoped: <R, E, A>(self: Client<R, E, A>) => Client<Exclude<R, Scope
|
|
|
382
385
|
*/
|
|
383
386
|
export const schemaFunction: {
|
|
384
387
|
<SA, SI, SR>(
|
|
385
|
-
schema: Schema.Schema<SA, SI, SR
|
|
388
|
+
schema: Schema.Schema<SA, SI, SR>,
|
|
389
|
+
options?: ParseOptions | undefined
|
|
386
390
|
): <R, E, A>(
|
|
387
391
|
self: Client<R, E, A>
|
|
388
392
|
) => (
|
|
@@ -390,7 +394,8 @@ export const schemaFunction: {
|
|
|
390
394
|
) => (a: SA) => Effect.Effect<A, E | ParseResult.ParseError | Error.RequestError, SR | R>
|
|
391
395
|
<R, E, A, SA, SI, SR>(
|
|
392
396
|
self: Client<R, E, A>,
|
|
393
|
-
schema: Schema.Schema<SA, SI, SR
|
|
397
|
+
schema: Schema.Schema<SA, SI, SR>,
|
|
398
|
+
options?: ParseOptions | undefined
|
|
394
399
|
): (
|
|
395
400
|
request: ClientRequest.ClientRequest
|
|
396
401
|
) => (a: SA) => Effect.Effect<A, ParseResult.ParseError | Error.RequestError | E, R | SR>
|
|
@@ -418,3 +423,12 @@ export const tapRequest: {
|
|
|
418
423
|
f: (a: ClientRequest.ClientRequest) => Effect.Effect<_, E2, R2>
|
|
419
424
|
): Client<R | R2, E | E2, A>
|
|
420
425
|
} = internal.tapRequest
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* @since 1.0.0
|
|
429
|
+
* @category cookies
|
|
430
|
+
*/
|
|
431
|
+
export const withCookiesRef: {
|
|
432
|
+
(ref: Ref<Cookies>): <R, E>(self: Client.WithResponse<R, E>) => Client.WithResponse<R, E>
|
|
433
|
+
<R, E>(self: Client.WithResponse<R, E>, ref: Ref<Cookies>): Client.WithResponse<R, E>
|
|
434
|
+
} = internal.withCookiesRef
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @since 1.0.0
|
|
3
3
|
*/
|
|
4
|
+
import type { ParseOptions } from "@effect/schema/AST"
|
|
4
5
|
import type * as Schema from "@effect/schema/Schema"
|
|
5
6
|
import type * as Effect from "effect/Effect"
|
|
6
7
|
import type { Inspectable } from "effect/Inspectable"
|
|
@@ -302,7 +303,8 @@ export const unsafeJsonBody: {
|
|
|
302
303
|
* @category combinators
|
|
303
304
|
*/
|
|
304
305
|
export const schemaBody: <A, I, R>(
|
|
305
|
-
schema: Schema.Schema<A, I, R
|
|
306
|
+
schema: Schema.Schema<A, I, R>,
|
|
307
|
+
options?: ParseOptions | undefined
|
|
306
308
|
) => {
|
|
307
309
|
(body: A): (self: ClientRequest) => Effect.Effect<ClientRequest, Body.BodyError, R>
|
|
308
310
|
(self: ClientRequest, body: A): Effect.Effect<ClientRequest, Body.BodyError, R>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @since 1.0.0
|
|
3
3
|
*/
|
|
4
|
+
import type { ParseOptions } from "@effect/schema/AST"
|
|
4
5
|
import type * as ParseResult from "@effect/schema/ParseResult"
|
|
5
6
|
import type * as Schema from "@effect/schema/Schema"
|
|
6
7
|
import type * as Effect from "effect/Effect"
|
|
@@ -9,6 +10,7 @@ import type * as Stream from "effect/Stream"
|
|
|
9
10
|
import * as internal from "../internal/http/clientResponse.js"
|
|
10
11
|
import type * as Error from "./ClientError.js"
|
|
11
12
|
import type * as ClientRequest from "./ClientRequest.js"
|
|
13
|
+
import type * as Cookies from "./Cookies.js"
|
|
12
14
|
import type * as IncomingMessage from "./IncomingMessage.js"
|
|
13
15
|
import type * as UrlParams from "./UrlParams.js"
|
|
14
16
|
|
|
@@ -64,6 +66,7 @@ export type TypeId = typeof TypeId
|
|
|
64
66
|
export interface ClientResponse extends IncomingMessage.IncomingMessage<Error.ResponseError> {
|
|
65
67
|
readonly [TypeId]: TypeId
|
|
66
68
|
readonly status: number
|
|
69
|
+
readonly cookies: Cookies.Cookies
|
|
67
70
|
readonly formData: Effect.Effect<FormData, Error.ResponseError>
|
|
68
71
|
}
|
|
69
72
|
|
|
@@ -86,7 +89,8 @@ export const schemaJson: <
|
|
|
86
89
|
},
|
|
87
90
|
A
|
|
88
91
|
>(
|
|
89
|
-
schema: Schema.Schema<A, I, R
|
|
92
|
+
schema: Schema.Schema<A, I, R>,
|
|
93
|
+
options?: ParseOptions | undefined
|
|
90
94
|
) => (self: ClientResponse) => Effect.Effect<A, Error.ResponseError | ParseResult.ParseError, R> = internal.schemaJson
|
|
91
95
|
|
|
92
96
|
/**
|
|
@@ -100,8 +104,10 @@ export const schemaNoBody: <
|
|
|
100
104
|
readonly headers?: Readonly<Record<string, string>> | undefined
|
|
101
105
|
},
|
|
102
106
|
A
|
|
103
|
-
>(
|
|
104
|
-
|
|
107
|
+
>(
|
|
108
|
+
schema: Schema.Schema<A, I, R>,
|
|
109
|
+
options?: ParseOptions | undefined
|
|
110
|
+
) => (self: ClientResponse) => Effect.Effect<A, ParseResult.ParseError, R> = internal.schemaNoBody
|
|
105
111
|
|
|
106
112
|
/**
|
|
107
113
|
* @since 1.0.0
|
|
@@ -164,12 +170,13 @@ export const schemaJsonEffect: <
|
|
|
164
170
|
},
|
|
165
171
|
A
|
|
166
172
|
>(
|
|
167
|
-
schema: Schema.Schema<A, I, R
|
|
173
|
+
schema: Schema.Schema<A, I, R>,
|
|
174
|
+
options?: ParseOptions | undefined
|
|
168
175
|
) => <E, R2>(
|
|
169
176
|
effect: Effect.Effect<ClientResponse, E, R2>
|
|
170
177
|
) => Effect.Effect<
|
|
171
178
|
A,
|
|
172
|
-
Error.ResponseError |
|
|
179
|
+
E | Error.ResponseError | ParseResult.ParseError,
|
|
173
180
|
Exclude<R, Scope.Scope> | Exclude<R2, Scope.Scope>
|
|
174
181
|
> = internal.schemaJsonEffect
|
|
175
182
|
|
|
@@ -179,10 +186,14 @@ export const schemaJsonEffect: <
|
|
|
179
186
|
*/
|
|
180
187
|
export const schemaNoBodyEffect: <
|
|
181
188
|
R,
|
|
182
|
-
I extends {
|
|
189
|
+
I extends {
|
|
190
|
+
readonly status?: number | undefined
|
|
191
|
+
readonly headers?: Readonly<Record<string, string>> | undefined
|
|
192
|
+
},
|
|
183
193
|
A
|
|
184
194
|
>(
|
|
185
|
-
schema: Schema.Schema<A, I, R
|
|
195
|
+
schema: Schema.Schema<A, I, R>,
|
|
196
|
+
options?: ParseOptions | undefined
|
|
186
197
|
) => <E, R2>(
|
|
187
198
|
effect: Effect.Effect<ClientResponse, E, R2>
|
|
188
199
|
) => Effect.Effect<A, E | ParseResult.ParseError, Exclude<R, Scope.Scope> | Exclude<R2, Scope.Scope>> =
|