@effect/platform 0.67.0 → 0.68.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.
Files changed (63) hide show
  1. package/README.md +66 -52
  2. package/dist/cjs/FetchHttpClient.js.map +1 -1
  3. package/dist/cjs/HttpClient.js +43 -31
  4. package/dist/cjs/HttpClient.js.map +1 -1
  5. package/dist/cjs/HttpClientRequest.js.map +1 -1
  6. package/dist/cjs/internal/fetchHttpClient.js +1 -1
  7. package/dist/cjs/internal/fetchHttpClient.js.map +1 -1
  8. package/dist/cjs/internal/httpBody.js +0 -3
  9. package/dist/cjs/internal/httpBody.js.map +1 -1
  10. package/dist/cjs/internal/httpClient.js +41 -38
  11. package/dist/cjs/internal/httpClient.js.map +1 -1
  12. package/dist/cjs/internal/httpClientRequest.js +5 -9
  13. package/dist/cjs/internal/httpClientRequest.js.map +1 -1
  14. package/dist/cjs/internal/httpMultiplex.js +0 -3
  15. package/dist/cjs/internal/httpMultiplex.js.map +1 -1
  16. package/dist/cjs/internal/httpRouter.js +0 -3
  17. package/dist/cjs/internal/httpRouter.js.map +1 -1
  18. package/dist/cjs/internal/httpServerResponse.js +0 -3
  19. package/dist/cjs/internal/httpServerResponse.js.map +1 -1
  20. package/dist/dts/FetchHttpClient.d.ts +1 -1
  21. package/dist/dts/FetchHttpClient.d.ts.map +1 -1
  22. package/dist/dts/HttpApiClient.d.ts +2 -2
  23. package/dist/dts/HttpApiClient.d.ts.map +1 -1
  24. package/dist/dts/HttpClient.d.ts +118 -186
  25. package/dist/dts/HttpClient.d.ts.map +1 -1
  26. package/dist/dts/HttpClientRequest.d.ts +2 -5
  27. package/dist/dts/HttpClientRequest.d.ts.map +1 -1
  28. package/dist/dts/HttpServer.d.ts +1 -1
  29. package/dist/dts/HttpServer.d.ts.map +1 -1
  30. package/dist/dts/internal/httpClient.d.ts +23 -1
  31. package/dist/dts/internal/httpClient.d.ts.map +1 -1
  32. package/dist/dts/internal/httpRouter.d.ts.map +1 -1
  33. package/dist/esm/FetchHttpClient.js.map +1 -1
  34. package/dist/esm/HttpClient.js +42 -30
  35. package/dist/esm/HttpClient.js.map +1 -1
  36. package/dist/esm/HttpClientRequest.js.map +1 -1
  37. package/dist/esm/internal/fetchHttpClient.js +1 -1
  38. package/dist/esm/internal/fetchHttpClient.js.map +1 -1
  39. package/dist/esm/internal/httpBody.js +0 -3
  40. package/dist/esm/internal/httpBody.js.map +1 -1
  41. package/dist/esm/internal/httpClient.js +29 -33
  42. package/dist/esm/internal/httpClient.js.map +1 -1
  43. package/dist/esm/internal/httpClientRequest.js +4 -8
  44. package/dist/esm/internal/httpClientRequest.js.map +1 -1
  45. package/dist/esm/internal/httpMultiplex.js +0 -3
  46. package/dist/esm/internal/httpMultiplex.js.map +1 -1
  47. package/dist/esm/internal/httpRouter.js +0 -3
  48. package/dist/esm/internal/httpRouter.js.map +1 -1
  49. package/dist/esm/internal/httpServerResponse.js +0 -3
  50. package/dist/esm/internal/httpServerResponse.js.map +1 -1
  51. package/package.json +3 -3
  52. package/src/FetchHttpClient.ts +1 -1
  53. package/src/HttpApiClient.ts +2 -2
  54. package/src/HttpClient.ts +258 -279
  55. package/src/HttpClientRequest.ts +2 -7
  56. package/src/HttpServer.ts +1 -1
  57. package/src/internal/fetchHttpClient.ts +1 -1
  58. package/src/internal/httpBody.ts +0 -3
  59. package/src/internal/httpClient.ts +191 -303
  60. package/src/internal/httpClientRequest.ts +4 -10
  61. package/src/internal/httpMultiplex.ts +0 -3
  62. package/src/internal/httpRouter.ts +0 -3
  63. package/src/internal/httpServerResponse.ts +0 -3
@@ -1,9 +1,6 @@
1
1
  /**
2
2
  * @since 1.0.0
3
3
  */
4
- import type { ParseOptions } from "@effect/schema/AST";
5
- import type * as ParseResult from "@effect/schema/ParseResult";
6
- import type * as Schema from "@effect/schema/Schema";
7
4
  import type * as Context from "effect/Context";
8
5
  import type * as Effect from "effect/Effect";
9
6
  import type { RuntimeFiber } from "effect/Fiber";
@@ -33,16 +30,16 @@ export type TypeId = typeof TypeId;
33
30
  * @since 1.0.0
34
31
  * @category models
35
32
  */
36
- export interface HttpClient<A = ClientResponse.HttpClientResponse, E = never, R = never> extends Pipeable, Inspectable {
33
+ export interface HttpClient<E = Error.HttpClientError, R = Scope.Scope> extends Pipeable, Inspectable {
37
34
  readonly [TypeId]: TypeId;
38
- readonly execute: (request: ClientRequest.HttpClientRequest) => Effect.Effect<A, E, R>;
39
- readonly get: (url: string | URL, options?: ClientRequest.Options.NoBody) => Effect.Effect<A, E, R>;
40
- readonly head: (url: string | URL, options?: ClientRequest.Options.NoBody) => Effect.Effect<A, E, R>;
41
- readonly post: (url: string | URL, options?: ClientRequest.Options.NoUrl) => Effect.Effect<A, E, R>;
42
- readonly patch: (url: string | URL, options?: ClientRequest.Options.NoUrl) => Effect.Effect<A, E, R>;
43
- readonly put: (url: string | URL, options?: ClientRequest.Options.NoUrl) => Effect.Effect<A, E, R>;
44
- readonly del: (url: string | URL, options?: ClientRequest.Options.NoUrl) => Effect.Effect<A, E, R>;
45
- readonly options: (url: string | URL, options?: ClientRequest.Options.NoUrl) => Effect.Effect<A, E, R>;
35
+ readonly execute: (request: ClientRequest.HttpClientRequest) => Effect.Effect<ClientResponse.HttpClientResponse, E, R>;
36
+ readonly get: (url: string | URL, options?: ClientRequest.Options.NoBody) => Effect.Effect<ClientResponse.HttpClientResponse, E, R>;
37
+ readonly head: (url: string | URL, options?: ClientRequest.Options.NoBody) => Effect.Effect<ClientResponse.HttpClientResponse, E, R>;
38
+ readonly post: (url: string | URL, options?: ClientRequest.Options.NoUrl) => Effect.Effect<ClientResponse.HttpClientResponse, E, R>;
39
+ readonly patch: (url: string | URL, options?: ClientRequest.Options.NoUrl) => Effect.Effect<ClientResponse.HttpClientResponse, E, R>;
40
+ readonly put: (url: string | URL, options?: ClientRequest.Options.NoUrl) => Effect.Effect<ClientResponse.HttpClientResponse, E, R>;
41
+ readonly del: (url: string | URL, options?: ClientRequest.Options.NoUrl) => Effect.Effect<ClientResponse.HttpClientResponse, E, R>;
42
+ readonly options: (url: string | URL, options?: ClientRequest.Options.NoUrl) => Effect.Effect<ClientResponse.HttpClientResponse, E, R>;
46
43
  }
47
44
  /**
48
45
  * @since 1.0.0
@@ -57,23 +54,53 @@ export declare namespace HttpClient {
57
54
  * @since 1.0.0
58
55
  * @category models
59
56
  */
60
- type Postprocess<A, E = never, R = never> = (request: Effect.Effect<ClientRequest.HttpClientRequest, E, R>) => Effect.Effect<A, E, R>;
61
- /**
62
- * @since 1.0.0
63
- * @category models
64
- */
65
- type WithResponse<E = never, R = never> = HttpClient<ClientResponse.HttpClientResponse, E, R>;
66
- /**
67
- * @since 1.0.0
68
- * @category models
69
- */
70
- type Service = WithResponse<Error.HttpClientError, Scope.Scope>;
57
+ type Postprocess<E = never, R = never> = (request: Effect.Effect<ClientRequest.HttpClientRequest, E, R>) => Effect.Effect<ClientResponse.HttpClientResponse, E, R>;
71
58
  }
72
59
  /**
73
60
  * @since 1.0.0
74
61
  * @category tags
75
62
  */
76
- export declare const HttpClient: Context.Tag<HttpClient.Service, HttpClient.Service>;
63
+ export declare const HttpClient: Context.Tag<HttpClient, HttpClient>;
64
+ /**
65
+ * @since 1.0.0
66
+ * @category accessors
67
+ */
68
+ export declare const execute: (request: ClientRequest.HttpClientRequest) => Effect.Effect<ClientResponse.HttpClientResponse, Error.HttpClientError, Scope.Scope | HttpClient>;
69
+ /**
70
+ * @since 1.0.0
71
+ * @category accessors
72
+ */
73
+ export declare const get: (url: string | URL, options?: ClientRequest.Options.NoBody | undefined) => Effect.Effect<ClientResponse.HttpClientResponse, Error.HttpClientError, Scope.Scope | HttpClient>;
74
+ /**
75
+ * @since 1.0.0
76
+ * @category accessors
77
+ */
78
+ export declare const head: (url: string | URL, options?: ClientRequest.Options.NoBody | undefined) => Effect.Effect<ClientResponse.HttpClientResponse, Error.HttpClientError, Scope.Scope | HttpClient>;
79
+ /**
80
+ * @since 1.0.0
81
+ * @category accessors
82
+ */
83
+ export declare const post: (url: string | URL, options?: ClientRequest.Options.NoUrl | undefined) => Effect.Effect<ClientResponse.HttpClientResponse, Error.HttpClientError, Scope.Scope | HttpClient>;
84
+ /**
85
+ * @since 1.0.0
86
+ * @category accessors
87
+ */
88
+ export declare const patch: (url: string | URL, options?: ClientRequest.Options.NoUrl | undefined) => Effect.Effect<ClientResponse.HttpClientResponse, Error.HttpClientError, Scope.Scope | HttpClient>;
89
+ /**
90
+ * @since 1.0.0
91
+ * @category accessors
92
+ */
93
+ export declare const put: (url: string | URL, options?: ClientRequest.Options.NoUrl | undefined) => Effect.Effect<ClientResponse.HttpClientResponse, Error.HttpClientError, Scope.Scope | HttpClient>;
94
+ /**
95
+ * @since 1.0.0
96
+ * @category accessors
97
+ */
98
+ export declare const del: (url: string | URL, options?: ClientRequest.Options.NoUrl | undefined) => Effect.Effect<ClientResponse.HttpClientResponse, Error.HttpClientError, Scope.Scope | HttpClient>;
99
+ /**
100
+ * @since 1.0.0
101
+ * @category accessors
102
+ */
103
+ export declare const options: (url: string | URL, options?: ClientRequest.Options.NoUrl | undefined) => Effect.Effect<ClientResponse.HttpClientResponse, Error.HttpClientError, Scope.Scope | HttpClient>;
77
104
  /**
78
105
  * @since 1.0.0
79
106
  * @category error handling
@@ -83,12 +110,12 @@ export declare const catchAll: {
83
110
  * @since 1.0.0
84
111
  * @category error handling
85
112
  */
86
- <E, E2, R2, A2>(f: (e: E) => Effect.Effect<A2, E2, R2>): <A, R>(self: HttpClient<A, E, R>) => HttpClient<A2 | A, E2, R2 | R>;
113
+ <E, E2, R2>(f: (e: E) => Effect.Effect<ClientResponse.HttpClientResponse, E2, R2>): <R>(self: HttpClient<E, R>) => HttpClient<E2, R2 | R>;
87
114
  /**
88
115
  * @since 1.0.0
89
116
  * @category error handling
90
117
  */
91
- <A, E, R, A2, E2, R2>(self: HttpClient<A, E, R>, f: (e: E) => Effect.Effect<A2, E2, R2>): HttpClient<A | A2, E2, R | R2>;
118
+ <E, R, A2, E2, R2>(self: HttpClient<E, R>, f: (e: E) => Effect.Effect<A2, E2, R2>): HttpClient<E2, R | R2>;
92
119
  };
93
120
  /**
94
121
  * @since 1.0.0
@@ -99,24 +126,24 @@ export declare const catchTag: {
99
126
  * @since 1.0.0
100
127
  * @category error handling
101
128
  */
102
- <E extends {
129
+ <K extends E extends {
103
130
  _tag: string;
104
- }, K extends E["_tag"] & string, A1, E1, R1>(tag: K, f: (e: Extract<E, {
131
+ } ? E["_tag"] : never, E, E1, R1>(tag: K, f: (e: Extract<E, {
105
132
  _tag: K;
106
- }>) => Effect.Effect<A1, E1, R1>): <A, R>(self: HttpClient<A, E, R>) => HttpClient<A1 | A, E1 | Exclude<E, {
133
+ }>) => Effect.Effect<ClientResponse.HttpClientResponse, E1, R1>): <R>(self: HttpClient<E, R>) => HttpClient<E1 | Exclude<E, {
107
134
  _tag: K;
108
135
  }>, R1 | R>;
109
136
  /**
110
137
  * @since 1.0.0
111
138
  * @category error handling
112
139
  */
113
- <A, E extends {
140
+ <R, E, K extends E extends {
114
141
  _tag: string;
115
- }, R, K extends E["_tag"] & string, A1, E1, R1>(self: HttpClient<A, E, R>, tag: K, f: (e: Extract<E, {
142
+ } ? E["_tag"] : never, R1, E1>(self: HttpClient<E, R>, tag: K, f: (e: Extract<E, {
116
143
  _tag: K;
117
- }>) => Effect.Effect<A1, E1, R1>): HttpClient<A | A1, E1 | Exclude<E, {
144
+ }>) => Effect.Effect<ClientResponse.HttpClientResponse, E1, R1>): HttpClient<E1 | Exclude<E, {
118
145
  _tag: K;
119
- }>, R | R1>;
146
+ }>, R1 | R>;
120
147
  };
121
148
  /**
122
149
  * @since 1.0.0
@@ -127,15 +154,17 @@ export declare const catchTags: {
127
154
  * @since 1.0.0
128
155
  * @category error handling
129
156
  */
130
- <E extends {
131
- _tag: string;
132
- }, Cases extends {
133
- [K in E["_tag"]]+?: ((error: Extract<E, {
157
+ <E, Cases extends {
158
+ [K in Extract<E, {
159
+ _tag: string;
160
+ }>["_tag"]]+?: (error: Extract<E, {
134
161
  _tag: K;
135
- }>) => Effect.Effect<any, any, any>) | undefined;
136
- }>(cases: Cases): <A, R>(self: HttpClient<A, E, R>) => HttpClient<A | {
137
- [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect.Effect<infer A, any, any> ? A : never;
138
- }[keyof Cases], Exclude<E, {
162
+ }>) => Effect.Effect<ClientResponse.HttpClientResponse, any, any>;
163
+ } & (unknown extends E ? {} : {
164
+ [K in Exclude<keyof Cases, Extract<E, {
165
+ _tag: string;
166
+ }>["_tag"]>]: never;
167
+ })>(cases: Cases): <R>(self: HttpClient<E, R>) => HttpClient<Exclude<E, {
139
168
  _tag: keyof Cases;
140
169
  }> | {
141
170
  [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect.Effect<any, infer E, any> ? E : never;
@@ -146,15 +175,19 @@ export declare const catchTags: {
146
175
  * @since 1.0.0
147
176
  * @category error handling
148
177
  */
149
- <A, E extends {
178
+ <E extends {
150
179
  _tag: string;
151
180
  }, R, Cases extends {
152
- [K in E["_tag"]]+?: ((error: Extract<E, {
181
+ [K in Extract<E, {
182
+ _tag: string;
183
+ }>["_tag"]]+?: (error: Extract<E, {
153
184
  _tag: K;
154
- }>) => Effect.Effect<any, any, any>) | undefined;
155
- }>(self: HttpClient<A, E, R>, cases: Cases): HttpClient<A | {
156
- [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect.Effect<infer A, any, any> ? A : never;
157
- }[keyof Cases], Exclude<E, {
185
+ }>) => Effect.Effect<ClientResponse.HttpClientResponse, any, any>;
186
+ } & (unknown extends E ? {} : {
187
+ [K in Exclude<keyof Cases, Extract<E, {
188
+ _tag: string;
189
+ }>["_tag"]>]: never;
190
+ })>(self: HttpClient<E, R>, cases: Cases): HttpClient<Exclude<E, {
158
191
  _tag: keyof Cases;
159
192
  }> | {
160
193
  [K in keyof Cases]: Cases[K] extends (...args: Array<any>) => Effect.Effect<any, infer E, any> ? E : never;
@@ -175,28 +208,14 @@ export declare const filterOrElse: {
175
208
  * @since 1.0.0
176
209
  * @category filters
177
210
  */
178
- <A, B extends A, C, E2, R2>(refinement: Predicate.Refinement<NoInfer<A>, B>, orElse: (a: NoInfer<A>) => Effect.Effect<C, E2, R2>): <E, R>(self: HttpClient<A, E, R>) => HttpClient<B | C, E | E2, R | R2>;
211
+ <E2, R2>(predicate: Predicate.Predicate<ClientResponse.HttpClientResponse>, orElse: (response: ClientResponse.HttpClientResponse) => Effect.Effect<ClientResponse.HttpClientResponse, E2, R2>): <E, R>(self: HttpClient<E, R>) => HttpClient<E2 | E, R2 | R>;
179
212
  /**
180
213
  * Filters the result of a response, or runs an alternative effect if the predicate fails.
181
214
  *
182
215
  * @since 1.0.0
183
216
  * @category filters
184
217
  */
185
- <A, B, E2, R2>(predicate: Predicate.Predicate<NoInfer<A>>, orElse: (a: NoInfer<A>) => Effect.Effect<B, E2, R2>): <E, R>(self: HttpClient<A, E, R>) => HttpClient<A | B, E2 | E, R2 | R>;
186
- /**
187
- * Filters the result of a response, or runs an alternative effect if the predicate fails.
188
- *
189
- * @since 1.0.0
190
- * @category filters
191
- */
192
- <A, E, R, B extends A, C, E2, R2>(self: HttpClient<A, E, R>, refinement: Predicate.Refinement<A, B>, orElse: (a: A) => Effect.Effect<C, E2, R2>): HttpClient<B | C, E | E2, R | R2>;
193
- /**
194
- * Filters the result of a response, or runs an alternative effect if the predicate fails.
195
- *
196
- * @since 1.0.0
197
- * @category filters
198
- */
199
- <A, E, R, B, E2, R2>(self: HttpClient<A, E, R>, predicate: Predicate.Predicate<A>, orElse: (a: A) => Effect.Effect<B, E2, R2>): HttpClient<A | B, E2 | E, R2 | R>;
218
+ <E, R, E2, R2>(self: HttpClient<E, R>, predicate: Predicate.Predicate<ClientResponse.HttpClientResponse>, orElse: (response: ClientResponse.HttpClientResponse) => Effect.Effect<ClientResponse.HttpClientResponse, E2, R2>): HttpClient<E2 | E, R2 | R>;
200
219
  };
201
220
  /**
202
221
  * Filters the result of a response, or throws an error if the predicate fails.
@@ -211,28 +230,14 @@ export declare const filterOrFail: {
211
230
  * @since 1.0.0
212
231
  * @category filters
213
232
  */
214
- <A, B extends A, E2>(refinement: Predicate.Refinement<NoInfer<A>, B>, orFailWith: (a: NoInfer<A>) => E2): <E, R>(self: HttpClient<A, E, R>) => HttpClient<B, E | E2, R>;
215
- /**
216
- * Filters the result of a response, or throws an error if the predicate fails.
217
- *
218
- * @since 1.0.0
219
- * @category filters
220
- */
221
- <A, E2>(predicate: Predicate.Predicate<NoInfer<A>>, orFailWith: (a: NoInfer<A>) => E2): <E, R>(self: HttpClient<A, E, R>) => HttpClient<A, E2 | E, R>;
233
+ <E2>(predicate: Predicate.Predicate<ClientResponse.HttpClientResponse>, orFailWith: (response: ClientResponse.HttpClientResponse) => E2): <E, R>(self: HttpClient<E, R>) => HttpClient<E2 | E, R>;
222
234
  /**
223
235
  * Filters the result of a response, or throws an error if the predicate fails.
224
236
  *
225
237
  * @since 1.0.0
226
238
  * @category filters
227
239
  */
228
- <A, B extends A, E, R, E2>(self: HttpClient<A, E, R>, refinement: Predicate.Refinement<A, B>, orFailWith: (a: A) => E2): HttpClient<B, E2 | E, R>;
229
- /**
230
- * Filters the result of a response, or throws an error if the predicate fails.
231
- *
232
- * @since 1.0.0
233
- * @category filters
234
- */
235
- <A, E, R, E2>(self: HttpClient<A, E, R>, predicate: Predicate.Predicate<A>, orFailWith: (a: A) => E2): HttpClient<A, E2 | E, R>;
240
+ <E, R, E2>(self: HttpClient<E, R>, predicate: Predicate.Predicate<ClientResponse.HttpClientResponse>, orFailWith: (response: ClientResponse.HttpClientResponse) => E2): HttpClient<E2 | E, R>;
236
241
  };
237
242
  /**
238
243
  * Filters responses by HTTP status code.
@@ -247,14 +252,14 @@ export declare const filterStatus: {
247
252
  * @since 1.0.0
248
253
  * @category filters
249
254
  */
250
- (f: (status: number) => boolean): <E, R>(self: HttpClient.WithResponse<E, R>) => HttpClient.WithResponse<E | Error.ResponseError, R>;
255
+ (f: (status: number) => boolean): <E, R>(self: HttpClient<E, R>) => HttpClient<E | Error.ResponseError, R>;
251
256
  /**
252
257
  * Filters responses by HTTP status code.
253
258
  *
254
259
  * @since 1.0.0
255
260
  * @category filters
256
261
  */
257
- <E, R>(self: HttpClient.WithResponse<E, R>, f: (status: number) => boolean): HttpClient.WithResponse<Error.ResponseError | E, R>;
262
+ <E, R>(self: HttpClient<E, R>, f: (status: number) => boolean): HttpClient<E | Error.ResponseError, R>;
258
263
  };
259
264
  /**
260
265
  * Filters responses that return a 2xx status code.
@@ -262,17 +267,17 @@ export declare const filterStatus: {
262
267
  * @since 1.0.0
263
268
  * @category filters
264
269
  */
265
- export declare const filterStatusOk: <E, R>(self: HttpClient.WithResponse<E, R>) => HttpClient.WithResponse<Error.ResponseError | E, R>;
270
+ export declare const filterStatusOk: <E, R>(self: HttpClient<E, R>) => HttpClient<E | Error.ResponseError, R>;
266
271
  /**
267
272
  * @since 1.0.0
268
273
  * @category constructors
269
274
  */
270
- export declare const make: <A, E, R, E2, R2>(execute: (request: Effect.Effect<ClientRequest.HttpClientRequest, E2, R2>) => Effect.Effect<A, E, R>, preprocess: HttpClient.Preprocess<E2, R2>) => HttpClient<A, E, R>;
275
+ export declare const makeWith: <E2, R2, E, R>(postprocess: (request: Effect.Effect<ClientRequest.HttpClientRequest, E2, R2>) => Effect.Effect<ClientResponse.HttpClientResponse, E, R>, preprocess: HttpClient.Preprocess<E2, R2>) => HttpClient<E, R>;
271
276
  /**
272
277
  * @since 1.0.0
273
278
  * @category constructors
274
279
  */
275
- export declare const makeService: (f: (request: ClientRequest.HttpClientRequest, url: URL, signal: AbortSignal, fiber: RuntimeFiber<ClientResponse.HttpClientResponse, Error.HttpClientError>) => Effect.Effect<ClientResponse.HttpClientResponse, Error.HttpClientError, Scope.Scope>) => HttpClient.Service;
280
+ export declare const make: (f: (request: ClientRequest.HttpClientRequest, url: URL, signal: AbortSignal, fiber: RuntimeFiber<ClientResponse.HttpClientResponse, Error.HttpClientError>) => Effect.Effect<ClientResponse.HttpClientResponse, Error.HttpClientError, Scope.Scope>) => HttpClient;
276
281
  /**
277
282
  * @since 1.0.0
278
283
  * @category mapping & sequencing
@@ -282,12 +287,12 @@ export declare const transform: {
282
287
  * @since 1.0.0
283
288
  * @category mapping & sequencing
284
289
  */
285
- <A, E, R, A1, E1, R1>(f: (effect: Effect.Effect<A, E, R>, request: ClientRequest.HttpClientRequest) => Effect.Effect<A1, E1, R1>): (self: HttpClient<A, E, R>) => HttpClient<A1, E | E1, R | R1>;
290
+ <E, R, E1, R1>(f: (effect: Effect.Effect<ClientResponse.HttpClientResponse, E, R>, request: ClientRequest.HttpClientRequest) => Effect.Effect<ClientResponse.HttpClientResponse, E1, R1>): (self: HttpClient<E, R>) => HttpClient<E | E1, R | R1>;
286
291
  /**
287
292
  * @since 1.0.0
288
293
  * @category mapping & sequencing
289
294
  */
290
- <A, E, R, A1, E1, R1>(self: HttpClient<A, E, R>, f: (effect: Effect.Effect<A, E, R>, request: ClientRequest.HttpClientRequest) => Effect.Effect<A1, E1, R1>): HttpClient<A1, E | E1, R | R1>;
295
+ <E, R, E1, R1>(self: HttpClient<E, R>, f: (effect: Effect.Effect<ClientResponse.HttpClientResponse, E, R>, request: ClientRequest.HttpClientRequest) => Effect.Effect<ClientResponse.HttpClientResponse, E1, R1>): HttpClient<E | E1, R | R1>;
291
296
  };
292
297
  /**
293
298
  * @since 1.0.0
@@ -298,56 +303,12 @@ export declare const transformResponse: {
298
303
  * @since 1.0.0
299
304
  * @category mapping & sequencing
300
305
  */
301
- <A, E, R, A1, E1, R1>(f: (effect: Effect.Effect<A, E, R>) => Effect.Effect<A1, E1, R1>): (self: HttpClient<A, E, R>) => HttpClient<A1, E1, R1>;
302
- /**
303
- * @since 1.0.0
304
- * @category mapping & sequencing
305
- */
306
- <A, E, R, A1, E1, R1>(self: HttpClient<A, E, R>, f: (effect: Effect.Effect<A, E, R>) => Effect.Effect<A1, E1, R1>): HttpClient<A1, E1, R1>;
307
- };
308
- /**
309
- * Transforms the result of a request.
310
- *
311
- * @since 1.0.0
312
- * @category mapping & sequencing
313
- */
314
- export declare const map: {
315
- /**
316
- * Transforms the result of a request.
317
- *
318
- * @since 1.0.0
319
- * @category mapping & sequencing
320
- */
321
- <A, B>(f: (a: A) => B): <E, R>(self: HttpClient<A, E, R>) => HttpClient<B, E, R>;
306
+ <E, R, E1, R1>(f: (effect: Effect.Effect<ClientResponse.HttpClientResponse, E, R>) => Effect.Effect<ClientResponse.HttpClientResponse, E1, R1>): (self: HttpClient<E, R>) => HttpClient<E1, R1>;
322
307
  /**
323
- * Transforms the result of a request.
324
- *
325
308
  * @since 1.0.0
326
309
  * @category mapping & sequencing
327
310
  */
328
- <A, E, R, B>(self: HttpClient<A, E, R>, f: (a: A) => B): HttpClient<B, E, R>;
329
- };
330
- /**
331
- * Transforms the result of a request using an effectful function.
332
- *
333
- * @since 1.0.0
334
- * @category mapping & sequencing
335
- */
336
- export declare const mapEffect: {
337
- /**
338
- * Transforms the result of a request using an effectful function.
339
- *
340
- * @since 1.0.0
341
- * @category mapping & sequencing
342
- */
343
- <A, B, E2, R2>(f: (a: A) => Effect.Effect<B, E2, R2>): <E, R>(self: HttpClient<A, E, R>) => HttpClient<B, E2 | E, R2 | R>;
344
- /**
345
- * Transforms the result of a request using an effectful function.
346
- *
347
- * @since 1.0.0
348
- * @category mapping & sequencing
349
- */
350
- <A, E, R, B, E2, R2>(self: HttpClient<A, E, R>, f: (a: A) => Effect.Effect<B, E2, R2>): HttpClient<B, E | E2, R2 | R>;
311
+ <E, R, E1, R1>(self: HttpClient<E, R>, f: (effect: Effect.Effect<ClientResponse.HttpClientResponse, E, R>) => Effect.Effect<ClientResponse.HttpClientResponse, E1, R1>): HttpClient<E1, R1>;
351
312
  };
352
313
  /**
353
314
  * Appends a transformation of the request object before sending it.
@@ -362,14 +323,14 @@ export declare const mapRequest: {
362
323
  * @since 1.0.0
363
324
  * @category mapping & sequencing
364
325
  */
365
- (f: (a: ClientRequest.HttpClientRequest) => ClientRequest.HttpClientRequest): <A, E, R>(self: HttpClient<A, E, R>) => HttpClient<A, E, R>;
326
+ (f: (a: ClientRequest.HttpClientRequest) => ClientRequest.HttpClientRequest): <E, R>(self: HttpClient<E, R>) => HttpClient<E, R>;
366
327
  /**
367
328
  * Appends a transformation of the request object before sending it.
368
329
  *
369
330
  * @since 1.0.0
370
331
  * @category mapping & sequencing
371
332
  */
372
- <A, E, R>(self: HttpClient<A, E, R>, f: (a: ClientRequest.HttpClientRequest) => ClientRequest.HttpClientRequest): HttpClient<A, E, R>;
333
+ <E, R>(self: HttpClient<E, R>, f: (a: ClientRequest.HttpClientRequest) => ClientRequest.HttpClientRequest): HttpClient<E, R>;
373
334
  };
374
335
  /**
375
336
  * Appends an effectful transformation of the request object before sending it.
@@ -384,14 +345,14 @@ export declare const mapRequestEffect: {
384
345
  * @since 1.0.0
385
346
  * @category mapping & sequencing
386
347
  */
387
- <E2, R2>(f: (a: ClientRequest.HttpClientRequest) => Effect.Effect<ClientRequest.HttpClientRequest, E2, R2>): <A, E, R>(self: HttpClient<A, E, R>) => HttpClient<A, E2 | E, R2 | R>;
348
+ <E2, R2>(f: (a: ClientRequest.HttpClientRequest) => Effect.Effect<ClientRequest.HttpClientRequest, E2, R2>): <E, R>(self: HttpClient<E, R>) => HttpClient<E | E2, R | R2>;
388
349
  /**
389
350
  * Appends an effectful transformation of the request object before sending it.
390
351
  *
391
352
  * @since 1.0.0
392
353
  * @category mapping & sequencing
393
354
  */
394
- <A, E, R, E2, R2>(self: HttpClient<A, E, R>, f: (a: ClientRequest.HttpClientRequest) => Effect.Effect<ClientRequest.HttpClientRequest, E2, R2>): HttpClient<A, E | E2, R | R2>;
355
+ <E, R, E2, R2>(self: HttpClient<E, R>, f: (a: ClientRequest.HttpClientRequest) => Effect.Effect<ClientRequest.HttpClientRequest, E2, R2>): HttpClient<E | E2, R | R2>;
395
356
  };
396
357
  /**
397
358
  * Prepends a transformation of the request object before sending it.
@@ -406,14 +367,14 @@ export declare const mapRequestInput: {
406
367
  * @since 1.0.0
407
368
  * @category mapping & sequencing
408
369
  */
409
- (f: (a: ClientRequest.HttpClientRequest) => ClientRequest.HttpClientRequest): <A, E, R>(self: HttpClient<A, E, R>) => HttpClient<A, E, R>;
370
+ (f: (a: ClientRequest.HttpClientRequest) => ClientRequest.HttpClientRequest): <E, R>(self: HttpClient<E, R>) => HttpClient<E, R>;
410
371
  /**
411
372
  * Prepends a transformation of the request object before sending it.
412
373
  *
413
374
  * @since 1.0.0
414
375
  * @category mapping & sequencing
415
376
  */
416
- <A, E, R>(self: HttpClient<A, E, R>, f: (a: ClientRequest.HttpClientRequest) => ClientRequest.HttpClientRequest): HttpClient<A, E, R>;
377
+ <E, R>(self: HttpClient<E, R>, f: (a: ClientRequest.HttpClientRequest) => ClientRequest.HttpClientRequest): HttpClient<E, R>;
417
378
  };
418
379
  /**
419
380
  * Prepends an effectful transformation of the request object before sending it.
@@ -428,14 +389,14 @@ export declare const mapRequestInputEffect: {
428
389
  * @since 1.0.0
429
390
  * @category mapping & sequencing
430
391
  */
431
- <E2, R2>(f: (a: ClientRequest.HttpClientRequest) => Effect.Effect<ClientRequest.HttpClientRequest, E2, R2>): <A, E, R>(self: HttpClient<A, E, R>) => HttpClient<A, E2 | E, R2 | R>;
392
+ <E2, R2>(f: (a: ClientRequest.HttpClientRequest) => Effect.Effect<ClientRequest.HttpClientRequest, E2, R2>): <E, R>(self: HttpClient<E, R>) => HttpClient<E | E2, R | R2>;
432
393
  /**
433
394
  * Prepends an effectful transformation of the request object before sending it.
434
395
  *
435
396
  * @since 1.0.0
436
397
  * @category mapping & sequencing
437
398
  */
438
- <A, E, R, E2, R2>(self: HttpClient<A, E, R>, f: (a: ClientRequest.HttpClientRequest) => Effect.Effect<ClientRequest.HttpClientRequest, E2, R2>): HttpClient<A, E | E2, R2 | R>;
399
+ <E, R, E2, R2>(self: HttpClient<E, R>, f: (a: ClientRequest.HttpClientRequest) => Effect.Effect<ClientRequest.HttpClientRequest, E2, R2>): HttpClient<E | E2, R | R2>;
439
400
  };
440
401
  /**
441
402
  * @since 1.0.0
@@ -446,7 +407,7 @@ export declare namespace Retry {
446
407
  * @since 1.0.0
447
408
  * @category error handling
448
409
  */
449
- type Return<R, E, A, O extends Effect.Retry.Options<E>> = HttpClient<A, (O extends {
410
+ type Return<R, E, O extends Effect.Retry.Options<E>> = HttpClient<(O extends {
450
411
  schedule: Schedule.Schedule<infer _O, infer _I, infer _R>;
451
412
  } ? E : O extends {
452
413
  until: Predicate.Refinement<E, infer E2>;
@@ -475,28 +436,28 @@ export declare const retry: {
475
436
  * @since 1.0.0
476
437
  * @category error handling
477
438
  */
478
- <E, O extends Effect.Retry.Options<E>>(options: O): <A, R>(self: HttpClient<A, E, R>) => Retry.Return<R, E, A, O>;
439
+ <E, O extends Effect.Retry.Options<E>>(options: O): <R>(self: HttpClient<E, R>) => Retry.Return<R, E, O>;
479
440
  /**
480
441
  * Retries the request based on a provided schedule or policy.
481
442
  *
482
443
  * @since 1.0.0
483
444
  * @category error handling
484
445
  */
485
- <B, E, R1>(policy: Schedule.Schedule<B, NoInfer<E>, R1>): <A, R>(self: HttpClient<A, E, R>) => HttpClient<A, E, R1 | R>;
446
+ <B, E, R1>(policy: Schedule.Schedule<B, NoInfer<E>, R1>): <R>(self: HttpClient<E, R>) => HttpClient<E, R1 | R>;
486
447
  /**
487
448
  * Retries the request based on a provided schedule or policy.
488
449
  *
489
450
  * @since 1.0.0
490
451
  * @category error handling
491
452
  */
492
- <A, E, R, O extends Effect.Retry.Options<E>>(self: HttpClient<A, E, R>, options: O): Retry.Return<R, E, A, O>;
453
+ <E, R, O extends Effect.Retry.Options<E>>(self: HttpClient<E, R>, options: O): Retry.Return<R, E, O>;
493
454
  /**
494
455
  * Retries the request based on a provided schedule or policy.
495
456
  *
496
457
  * @since 1.0.0
497
458
  * @category error handling
498
459
  */
499
- <A, E, R, B, R1>(self: HttpClient<A, E, R>, policy: Schedule.Schedule<B, E, R1>): HttpClient<A, E, R1 | R>;
460
+ <E, R, B, R1>(self: HttpClient<E, R>, policy: Schedule.Schedule<B, E, R1>): HttpClient<E, R1 | R>;
500
461
  };
501
462
  /**
502
463
  * Retries common transient errors, such as rate limiting or network issues.
@@ -514,46 +475,17 @@ export declare const retryTransient: {
514
475
  <B, E, R1 = never>(options: {
515
476
  readonly schedule?: Schedule.Schedule<B, NoInfer<E>, R1>;
516
477
  readonly times?: number;
517
- } | Schedule.Schedule<B, NoInfer<E>, R1>): <A, R>(self: HttpClient<A, E, R>) => HttpClient<A, E, R1 | R>;
478
+ } | Schedule.Schedule<B, NoInfer<E>, R1>): <R>(self: HttpClient<E, R>) => HttpClient<E, R1 | R>;
518
479
  /**
519
480
  * Retries common transient errors, such as rate limiting or network issues.
520
481
  *
521
482
  * @since 1.0.0
522
483
  * @category error handling
523
484
  */
524
- <A, E, R, B, R1 = never>(self: HttpClient<A, E, R>, options: {
485
+ <E, R, B, R1 = never>(self: HttpClient<E, R>, options: {
525
486
  readonly schedule?: Schedule.Schedule<B, NoInfer<E>, R1>;
526
487
  readonly times?: number;
527
- } | Schedule.Schedule<B, NoInfer<E>, R1>): HttpClient<A, E, R1 | R>;
528
- };
529
- /**
530
- * Ensures resources are properly scoped and released after execution.
531
- *
532
- * @since 1.0.0
533
- * @category resources & finalizers
534
- */
535
- export declare const scoped: <A, E, R>(self: HttpClient<A, E, R>) => HttpClient<A, E, Exclude<R, Scope.Scope>>;
536
- /**
537
- * Creates a function that validates request data against a schema before sending it.
538
- *
539
- * @since 1.0.0
540
- * @category schema
541
- */
542
- export declare const schemaFunction: {
543
- /**
544
- * Creates a function that validates request data against a schema before sending it.
545
- *
546
- * @since 1.0.0
547
- * @category schema
548
- */
549
- <SA, SI, SR>(schema: Schema.Schema<SA, SI, SR>, options?: ParseOptions | undefined): <A, E, R>(self: HttpClient<A, E, R>) => (request: ClientRequest.HttpClientRequest) => (a: SA) => Effect.Effect<A, Error.RequestError | E | ParseResult.ParseError, SR | R>;
550
- /**
551
- * Creates a function that validates request data against a schema before sending it.
552
- *
553
- * @since 1.0.0
554
- * @category schema
555
- */
556
- <A, E, R, SA, SI, SR>(self: HttpClient<A, E, R>, schema: Schema.Schema<SA, SI, SR>, options?: ParseOptions | undefined): (request: ClientRequest.HttpClientRequest) => (a: SA) => Effect.Effect<A, Error.RequestError | ParseResult.ParseError | E, R | SR>;
488
+ } | Schedule.Schedule<B, NoInfer<E>, R1>): HttpClient<E, R1 | R>;
557
489
  };
558
490
  /**
559
491
  * Performs an additional effect after a successful request.
@@ -568,14 +500,14 @@ export declare const tap: {
568
500
  * @since 1.0.0
569
501
  * @category mapping & sequencing
570
502
  */
571
- <A, _, E2, R2>(f: (a: A) => Effect.Effect<_, E2, R2>): <E, R>(self: HttpClient<A, E, R>) => HttpClient<A, E2 | E, R2 | R>;
503
+ <_, E2, R2>(f: (response: ClientResponse.HttpClientResponse) => Effect.Effect<_, E2, R2>): <E, R>(self: HttpClient<E, R>) => HttpClient<E | E2, R | R2>;
572
504
  /**
573
505
  * Performs an additional effect after a successful request.
574
506
  *
575
507
  * @since 1.0.0
576
508
  * @category mapping & sequencing
577
509
  */
578
- <A, E, R, _, E2, R2>(self: HttpClient<A, E, R>, f: (a: A) => Effect.Effect<_, E2, R2>): HttpClient<A, E | E2, R2 | R>;
510
+ <E, R, _, E2, R2>(self: HttpClient<E, R>, f: (response: ClientResponse.HttpClientResponse) => Effect.Effect<_, E2, R2>): HttpClient<E | E2, R | R2>;
579
511
  };
580
512
  /**
581
513
  * Performs an additional effect on the request before sending it.
@@ -590,14 +522,14 @@ export declare const tapRequest: {
590
522
  * @since 1.0.0
591
523
  * @category mapping & sequencing
592
524
  */
593
- <_, E2, R2>(f: (a: ClientRequest.HttpClientRequest) => Effect.Effect<_, E2, R2>): <A, E, R>(self: HttpClient<A, E, R>) => HttpClient<A, E2 | E, R2 | R>;
525
+ <_, E2, R2>(f: (a: ClientRequest.HttpClientRequest) => Effect.Effect<_, E2, R2>): <E, R>(self: HttpClient<E, R>) => HttpClient<E | E2, R | R2>;
594
526
  /**
595
527
  * Performs an additional effect on the request before sending it.
596
528
  *
597
529
  * @since 1.0.0
598
530
  * @category mapping & sequencing
599
531
  */
600
- <A, E, R, _, E2, R2>(self: HttpClient<A, E, R>, f: (a: ClientRequest.HttpClientRequest) => Effect.Effect<_, E2, R2>): HttpClient<A, E | E2, R | R2>;
532
+ <E, R, _, E2, R2>(self: HttpClient<E, R>, f: (a: ClientRequest.HttpClientRequest) => Effect.Effect<_, E2, R2>): HttpClient<E | E2, R | R2>;
601
533
  };
602
534
  /**
603
535
  * Associates a `Ref` of cookies with the client for handling cookies across requests.
@@ -612,14 +544,14 @@ export declare const withCookiesRef: {
612
544
  * @since 1.0.0
613
545
  * @category cookies
614
546
  */
615
- (ref: Ref<Cookies>): <E, R>(self: HttpClient.WithResponse<E, R>) => HttpClient.WithResponse<E, R>;
547
+ (ref: Ref<Cookies>): <E, R>(self: HttpClient<E, R>) => HttpClient<E, R>;
616
548
  /**
617
549
  * Associates a `Ref` of cookies with the client for handling cookies across requests.
618
550
  *
619
551
  * @since 1.0.0
620
552
  * @category cookies
621
553
  */
622
- <E, R>(self: HttpClient.WithResponse<E, R>, ref: Ref<Cookies>): HttpClient.WithResponse<E, R>;
554
+ <E, R>(self: HttpClient<E, R>, ref: Ref<Cookies>): HttpClient<E, R>;
623
555
  };
624
556
  /**
625
557
  * Follows HTTP redirects up to a specified number of times.
@@ -634,14 +566,14 @@ export declare const followRedirects: {
634
566
  * @since 1.0.0
635
567
  * @category redirects
636
568
  */
637
- (maxRedirects?: number | undefined): <E, R>(self: HttpClient.WithResponse<E, R>) => HttpClient.WithResponse<E, R>;
569
+ (maxRedirects?: number | undefined): <E, R>(self: HttpClient<E, R>) => HttpClient<E, R>;
638
570
  /**
639
571
  * Follows HTTP redirects up to a specified number of times.
640
572
  *
641
573
  * @since 1.0.0
642
574
  * @category redirects
643
575
  */
644
- <E, R>(self: HttpClient.WithResponse<E, R>, maxRedirects?: number | undefined): HttpClient.WithResponse<E, R>;
576
+ <E, R>(self: HttpClient<E, R>, maxRedirects?: number | undefined): HttpClient<E, R>;
645
577
  };
646
578
  /**
647
579
  * @since 1.0.0
@@ -700,5 +632,5 @@ export declare const withTracerPropagation: {
700
632
  /**
701
633
  * @since 1.0.0
702
634
  */
703
- export declare const layerMergedContext: <E, R>(effect: Effect.Effect<HttpClient.Service, E, R>) => Layer<HttpClient.Service, E, R>;
635
+ export declare const layerMergedContext: <E, R>(effect: Effect.Effect<HttpClient, E, R>) => Layer<HttpClient, E, R>;
704
636
  //# sourceMappingURL=HttpClient.d.ts.map