@effect/platform 0.66.2 → 0.67.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.
- 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/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/httpBody.js +3 -0
- package/dist/cjs/internal/httpBody.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/cjs/internal/httpMultiplex.js +3 -0
- package/dist/cjs/internal/httpMultiplex.js.map +1 -1
- package/dist/cjs/internal/httpRouter.js +3 -0
- package/dist/cjs/internal/httpRouter.js.map +1 -1
- package/dist/cjs/internal/httpServerResponse.js +3 -0
- package/dist/cjs/internal/httpServerResponse.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/dts/internal/httpRouter.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/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/httpBody.js +3 -0
- package/dist/esm/internal/httpBody.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/dist/esm/internal/httpMultiplex.js +3 -0
- package/dist/esm/internal/httpMultiplex.js.map +1 -1
- package/dist/esm/internal/httpRouter.js +3 -0
- package/dist/esm/internal/httpRouter.js.map +1 -1
- package/dist/esm/internal/httpServerResponse.js +3 -0
- package/dist/esm/internal/httpServerResponse.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/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/httpBody.ts +3 -0
- package/src/internal/httpClient.ts +41 -26
- package/src/internal/httpClientResponse.ts +40 -1
- package/src/internal/httpMultiplex.ts +3 -0
- package/src/internal/httpRouter.ts +3 -0
- package/src/internal/httpServerResponse.ts +3 -0
package/src/HttpClientRequest.ts
CHANGED
|
@@ -138,7 +138,15 @@ export const options: (url: string | URL, options?: Options.NoUrl) => HttpClient
|
|
|
138
138
|
* @category combinators
|
|
139
139
|
*/
|
|
140
140
|
export const modify: {
|
|
141
|
+
/**
|
|
142
|
+
* @since 1.0.0
|
|
143
|
+
* @category combinators
|
|
144
|
+
*/
|
|
141
145
|
(options: Options): (self: HttpClientRequest) => HttpClientRequest
|
|
146
|
+
/**
|
|
147
|
+
* @since 1.0.0
|
|
148
|
+
* @category combinators
|
|
149
|
+
*/
|
|
142
150
|
(self: HttpClientRequest, options: Options): HttpClientRequest
|
|
143
151
|
} = internal.modify
|
|
144
152
|
|
|
@@ -147,7 +155,15 @@ export const modify: {
|
|
|
147
155
|
* @category combinators
|
|
148
156
|
*/
|
|
149
157
|
export const setMethod: {
|
|
158
|
+
/**
|
|
159
|
+
* @since 1.0.0
|
|
160
|
+
* @category combinators
|
|
161
|
+
*/
|
|
150
162
|
(method: HttpMethod): (self: HttpClientRequest) => HttpClientRequest
|
|
163
|
+
/**
|
|
164
|
+
* @since 1.0.0
|
|
165
|
+
* @category combinators
|
|
166
|
+
*/
|
|
151
167
|
(self: HttpClientRequest, method: HttpMethod): HttpClientRequest
|
|
152
168
|
} = internal.setMethod
|
|
153
169
|
|
|
@@ -156,7 +172,15 @@ export const setMethod: {
|
|
|
156
172
|
* @category combinators
|
|
157
173
|
*/
|
|
158
174
|
export const setHeader: {
|
|
175
|
+
/**
|
|
176
|
+
* @since 1.0.0
|
|
177
|
+
* @category combinators
|
|
178
|
+
*/
|
|
159
179
|
(key: string, value: string): (self: HttpClientRequest) => HttpClientRequest
|
|
180
|
+
/**
|
|
181
|
+
* @since 1.0.0
|
|
182
|
+
* @category combinators
|
|
183
|
+
*/
|
|
160
184
|
(self: HttpClientRequest, key: string, value: string): HttpClientRequest
|
|
161
185
|
} = internal.setHeader
|
|
162
186
|
|
|
@@ -165,7 +189,15 @@ export const setHeader: {
|
|
|
165
189
|
* @category combinators
|
|
166
190
|
*/
|
|
167
191
|
export const setHeaders: {
|
|
192
|
+
/**
|
|
193
|
+
* @since 1.0.0
|
|
194
|
+
* @category combinators
|
|
195
|
+
*/
|
|
168
196
|
(input: Headers.Input): (self: HttpClientRequest) => HttpClientRequest
|
|
197
|
+
/**
|
|
198
|
+
* @since 1.0.0
|
|
199
|
+
* @category combinators
|
|
200
|
+
*/
|
|
169
201
|
(self: HttpClientRequest, input: Headers.Input): HttpClientRequest
|
|
170
202
|
} = internal.setHeaders
|
|
171
203
|
|
|
@@ -174,8 +206,20 @@ export const setHeaders: {
|
|
|
174
206
|
* @category combinators
|
|
175
207
|
*/
|
|
176
208
|
export const basicAuth: {
|
|
209
|
+
/**
|
|
210
|
+
* @since 1.0.0
|
|
211
|
+
* @category combinators
|
|
212
|
+
*/
|
|
177
213
|
(username: string | Redacted, password: string | Redacted): (self: HttpClientRequest) => HttpClientRequest
|
|
178
|
-
|
|
214
|
+
/**
|
|
215
|
+
* @since 1.0.0
|
|
216
|
+
* @category combinators
|
|
217
|
+
*/
|
|
218
|
+
(
|
|
219
|
+
self: HttpClientRequest,
|
|
220
|
+
username: string | Redacted,
|
|
221
|
+
password: string | Redacted
|
|
222
|
+
): HttpClientRequest
|
|
179
223
|
} = internal.basicAuth
|
|
180
224
|
|
|
181
225
|
/**
|
|
@@ -183,7 +227,15 @@ export const basicAuth: {
|
|
|
183
227
|
* @category combinators
|
|
184
228
|
*/
|
|
185
229
|
export const bearerToken: {
|
|
230
|
+
/**
|
|
231
|
+
* @since 1.0.0
|
|
232
|
+
* @category combinators
|
|
233
|
+
*/
|
|
186
234
|
(token: string | Redacted): (self: HttpClientRequest) => HttpClientRequest
|
|
235
|
+
/**
|
|
236
|
+
* @since 1.0.0
|
|
237
|
+
* @category combinators
|
|
238
|
+
*/
|
|
187
239
|
(self: HttpClientRequest, token: string | Redacted): HttpClientRequest
|
|
188
240
|
} = internal.bearerToken
|
|
189
241
|
|
|
@@ -192,7 +244,15 @@ export const bearerToken: {
|
|
|
192
244
|
* @category combinators
|
|
193
245
|
*/
|
|
194
246
|
export const accept: {
|
|
247
|
+
/**
|
|
248
|
+
* @since 1.0.0
|
|
249
|
+
* @category combinators
|
|
250
|
+
*/
|
|
195
251
|
(mediaType: string): (self: HttpClientRequest) => HttpClientRequest
|
|
252
|
+
/**
|
|
253
|
+
* @since 1.0.0
|
|
254
|
+
* @category combinators
|
|
255
|
+
*/
|
|
196
256
|
(self: HttpClientRequest, mediaType: string): HttpClientRequest
|
|
197
257
|
} = internal.accept
|
|
198
258
|
|
|
@@ -207,7 +267,15 @@ export const acceptJson: (self: HttpClientRequest) => HttpClientRequest = intern
|
|
|
207
267
|
* @category combinators
|
|
208
268
|
*/
|
|
209
269
|
export const setUrl: {
|
|
270
|
+
/**
|
|
271
|
+
* @since 1.0.0
|
|
272
|
+
* @category combinators
|
|
273
|
+
*/
|
|
210
274
|
(url: string | URL): (self: HttpClientRequest) => HttpClientRequest
|
|
275
|
+
/**
|
|
276
|
+
* @since 1.0.0
|
|
277
|
+
* @category combinators
|
|
278
|
+
*/
|
|
211
279
|
(self: HttpClientRequest, url: string | URL): HttpClientRequest
|
|
212
280
|
} = internal.setUrl
|
|
213
281
|
|
|
@@ -216,7 +284,15 @@ export const setUrl: {
|
|
|
216
284
|
* @category combinators
|
|
217
285
|
*/
|
|
218
286
|
export const prependUrl: {
|
|
287
|
+
/**
|
|
288
|
+
* @since 1.0.0
|
|
289
|
+
* @category combinators
|
|
290
|
+
*/
|
|
219
291
|
(path: string): (self: HttpClientRequest) => HttpClientRequest
|
|
292
|
+
/**
|
|
293
|
+
* @since 1.0.0
|
|
294
|
+
* @category combinators
|
|
295
|
+
*/
|
|
220
296
|
(self: HttpClientRequest, path: string): HttpClientRequest
|
|
221
297
|
} = internal.prependUrl
|
|
222
298
|
|
|
@@ -225,7 +301,15 @@ export const prependUrl: {
|
|
|
225
301
|
* @category combinators
|
|
226
302
|
*/
|
|
227
303
|
export const appendUrl: {
|
|
304
|
+
/**
|
|
305
|
+
* @since 1.0.0
|
|
306
|
+
* @category combinators
|
|
307
|
+
*/
|
|
228
308
|
(path: string): (self: HttpClientRequest) => HttpClientRequest
|
|
309
|
+
/**
|
|
310
|
+
* @since 1.0.0
|
|
311
|
+
* @category combinators
|
|
312
|
+
*/
|
|
229
313
|
(self: HttpClientRequest, path: string): HttpClientRequest
|
|
230
314
|
} = internal.appendUrl
|
|
231
315
|
|
|
@@ -234,7 +318,15 @@ export const appendUrl: {
|
|
|
234
318
|
* @category combinators
|
|
235
319
|
*/
|
|
236
320
|
export const updateUrl: {
|
|
321
|
+
/**
|
|
322
|
+
* @since 1.0.0
|
|
323
|
+
* @category combinators
|
|
324
|
+
*/
|
|
237
325
|
(f: (url: string) => string): (self: HttpClientRequest) => HttpClientRequest
|
|
326
|
+
/**
|
|
327
|
+
* @since 1.0.0
|
|
328
|
+
* @category combinators
|
|
329
|
+
*/
|
|
238
330
|
(self: HttpClientRequest, f: (url: string) => string): HttpClientRequest
|
|
239
331
|
} = internal.updateUrl
|
|
240
332
|
|
|
@@ -243,7 +335,15 @@ export const updateUrl: {
|
|
|
243
335
|
* @category combinators
|
|
244
336
|
*/
|
|
245
337
|
export const setUrlParam: {
|
|
338
|
+
/**
|
|
339
|
+
* @since 1.0.0
|
|
340
|
+
* @category combinators
|
|
341
|
+
*/
|
|
246
342
|
(key: string, value: string): (self: HttpClientRequest) => HttpClientRequest
|
|
343
|
+
/**
|
|
344
|
+
* @since 1.0.0
|
|
345
|
+
* @category combinators
|
|
346
|
+
*/
|
|
247
347
|
(self: HttpClientRequest, key: string, value: string): HttpClientRequest
|
|
248
348
|
} = internal.setUrlParam
|
|
249
349
|
|
|
@@ -252,7 +352,15 @@ export const setUrlParam: {
|
|
|
252
352
|
* @category combinators
|
|
253
353
|
*/
|
|
254
354
|
export const setUrlParams: {
|
|
355
|
+
/**
|
|
356
|
+
* @since 1.0.0
|
|
357
|
+
* @category combinators
|
|
358
|
+
*/
|
|
255
359
|
(input: UrlParams.Input): (self: HttpClientRequest) => HttpClientRequest
|
|
360
|
+
/**
|
|
361
|
+
* @since 1.0.0
|
|
362
|
+
* @category combinators
|
|
363
|
+
*/
|
|
256
364
|
(self: HttpClientRequest, input: UrlParams.Input): HttpClientRequest
|
|
257
365
|
} = internal.setUrlParams
|
|
258
366
|
|
|
@@ -261,7 +369,15 @@ export const setUrlParams: {
|
|
|
261
369
|
* @category combinators
|
|
262
370
|
*/
|
|
263
371
|
export const appendUrlParam: {
|
|
372
|
+
/**
|
|
373
|
+
* @since 1.0.0
|
|
374
|
+
* @category combinators
|
|
375
|
+
*/
|
|
264
376
|
(key: string, value: string): (self: HttpClientRequest) => HttpClientRequest
|
|
377
|
+
/**
|
|
378
|
+
* @since 1.0.0
|
|
379
|
+
* @category combinators
|
|
380
|
+
*/
|
|
265
381
|
(self: HttpClientRequest, key: string, value: string): HttpClientRequest
|
|
266
382
|
} = internal.appendUrlParam
|
|
267
383
|
|
|
@@ -270,7 +386,15 @@ export const appendUrlParam: {
|
|
|
270
386
|
* @category combinators
|
|
271
387
|
*/
|
|
272
388
|
export const appendUrlParams: {
|
|
389
|
+
/**
|
|
390
|
+
* @since 1.0.0
|
|
391
|
+
* @category combinators
|
|
392
|
+
*/
|
|
273
393
|
(input: UrlParams.Input): (self: HttpClientRequest) => HttpClientRequest
|
|
394
|
+
/**
|
|
395
|
+
* @since 1.0.0
|
|
396
|
+
* @category combinators
|
|
397
|
+
*/
|
|
274
398
|
(self: HttpClientRequest, input: UrlParams.Input): HttpClientRequest
|
|
275
399
|
} = internal.appendUrlParams
|
|
276
400
|
|
|
@@ -279,7 +403,15 @@ export const appendUrlParams: {
|
|
|
279
403
|
* @category combinators
|
|
280
404
|
*/
|
|
281
405
|
export const setHash: {
|
|
406
|
+
/**
|
|
407
|
+
* @since 1.0.0
|
|
408
|
+
* @category combinators
|
|
409
|
+
*/
|
|
282
410
|
(hash: string): (self: HttpClientRequest) => HttpClientRequest
|
|
411
|
+
/**
|
|
412
|
+
* @since 1.0.0
|
|
413
|
+
* @category combinators
|
|
414
|
+
*/
|
|
283
415
|
(self: HttpClientRequest, hash: string): HttpClientRequest
|
|
284
416
|
} = internal.setHash
|
|
285
417
|
|
|
@@ -294,7 +426,15 @@ export const removeHash: (self: HttpClientRequest) => HttpClientRequest = intern
|
|
|
294
426
|
* @category combinators
|
|
295
427
|
*/
|
|
296
428
|
export const setBody: {
|
|
429
|
+
/**
|
|
430
|
+
* @since 1.0.0
|
|
431
|
+
* @category combinators
|
|
432
|
+
*/
|
|
297
433
|
(body: Body.HttpBody): (self: HttpClientRequest) => HttpClientRequest
|
|
434
|
+
/**
|
|
435
|
+
* @since 1.0.0
|
|
436
|
+
* @category combinators
|
|
437
|
+
*/
|
|
298
438
|
(self: HttpClientRequest, body: Body.HttpBody): HttpClientRequest
|
|
299
439
|
} = internal.setBody
|
|
300
440
|
|
|
@@ -303,7 +443,15 @@ export const setBody: {
|
|
|
303
443
|
* @category combinators
|
|
304
444
|
*/
|
|
305
445
|
export const bodyUint8Array: {
|
|
446
|
+
/**
|
|
447
|
+
* @since 1.0.0
|
|
448
|
+
* @category combinators
|
|
449
|
+
*/
|
|
306
450
|
(body: Uint8Array, contentType?: string): (self: HttpClientRequest) => HttpClientRequest
|
|
451
|
+
/**
|
|
452
|
+
* @since 1.0.0
|
|
453
|
+
* @category combinators
|
|
454
|
+
*/
|
|
307
455
|
(self: HttpClientRequest, body: Uint8Array, contentType?: string): HttpClientRequest
|
|
308
456
|
} = internal.bodyUint8Array
|
|
309
457
|
|
|
@@ -312,7 +460,15 @@ export const bodyUint8Array: {
|
|
|
312
460
|
* @category combinators
|
|
313
461
|
*/
|
|
314
462
|
export const bodyText: {
|
|
463
|
+
/**
|
|
464
|
+
* @since 1.0.0
|
|
465
|
+
* @category combinators
|
|
466
|
+
*/
|
|
315
467
|
(body: string, contentType?: string): (self: HttpClientRequest) => HttpClientRequest
|
|
468
|
+
/**
|
|
469
|
+
* @since 1.0.0
|
|
470
|
+
* @category combinators
|
|
471
|
+
*/
|
|
316
472
|
(self: HttpClientRequest, body: string, contentType?: string): HttpClientRequest
|
|
317
473
|
} = internal.bodyText
|
|
318
474
|
|
|
@@ -321,7 +477,15 @@ export const bodyText: {
|
|
|
321
477
|
* @category combinators
|
|
322
478
|
*/
|
|
323
479
|
export const bodyJson: {
|
|
480
|
+
/**
|
|
481
|
+
* @since 1.0.0
|
|
482
|
+
* @category combinators
|
|
483
|
+
*/
|
|
324
484
|
(body: unknown): (self: HttpClientRequest) => Effect.Effect<HttpClientRequest, Body.HttpBodyError>
|
|
485
|
+
/**
|
|
486
|
+
* @since 1.0.0
|
|
487
|
+
* @category combinators
|
|
488
|
+
*/
|
|
325
489
|
(self: HttpClientRequest, body: unknown): Effect.Effect<HttpClientRequest, Body.HttpBodyError>
|
|
326
490
|
} = internal.bodyJson
|
|
327
491
|
|
|
@@ -330,7 +494,15 @@ export const bodyJson: {
|
|
|
330
494
|
* @category combinators
|
|
331
495
|
*/
|
|
332
496
|
export const bodyUnsafeJson: {
|
|
497
|
+
/**
|
|
498
|
+
* @since 1.0.0
|
|
499
|
+
* @category combinators
|
|
500
|
+
*/
|
|
333
501
|
(body: unknown): (self: HttpClientRequest) => HttpClientRequest
|
|
502
|
+
/**
|
|
503
|
+
* @since 1.0.0
|
|
504
|
+
* @category combinators
|
|
505
|
+
*/
|
|
334
506
|
(self: HttpClientRequest, body: unknown): HttpClientRequest
|
|
335
507
|
} = internal.bodyUnsafeJson
|
|
336
508
|
|
|
@@ -351,7 +523,15 @@ export const schemaBodyJson: <A, I, R>(
|
|
|
351
523
|
* @category combinators
|
|
352
524
|
*/
|
|
353
525
|
export const bodyUrlParams: {
|
|
526
|
+
/**
|
|
527
|
+
* @since 1.0.0
|
|
528
|
+
* @category combinators
|
|
529
|
+
*/
|
|
354
530
|
(input: UrlParams.Input): (self: HttpClientRequest) => HttpClientRequest
|
|
531
|
+
/**
|
|
532
|
+
* @since 1.0.0
|
|
533
|
+
* @category combinators
|
|
534
|
+
*/
|
|
355
535
|
(self: HttpClientRequest, input: UrlParams.Input): HttpClientRequest
|
|
356
536
|
} = internal.bodyUrlParams
|
|
357
537
|
|
|
@@ -360,7 +540,15 @@ export const bodyUrlParams: {
|
|
|
360
540
|
* @category combinators
|
|
361
541
|
*/
|
|
362
542
|
export const bodyFormData: {
|
|
543
|
+
/**
|
|
544
|
+
* @since 1.0.0
|
|
545
|
+
* @category combinators
|
|
546
|
+
*/
|
|
363
547
|
(body: FormData): (self: HttpClientRequest) => HttpClientRequest
|
|
548
|
+
/**
|
|
549
|
+
* @since 1.0.0
|
|
550
|
+
* @category combinators
|
|
551
|
+
*/
|
|
364
552
|
(self: HttpClientRequest, body: FormData): HttpClientRequest
|
|
365
553
|
} = internal.bodyFormData
|
|
366
554
|
|
|
@@ -369,10 +557,18 @@ export const bodyFormData: {
|
|
|
369
557
|
* @category combinators
|
|
370
558
|
*/
|
|
371
559
|
export const bodyStream: {
|
|
560
|
+
/**
|
|
561
|
+
* @since 1.0.0
|
|
562
|
+
* @category combinators
|
|
563
|
+
*/
|
|
372
564
|
(
|
|
373
565
|
body: Stream.Stream<Uint8Array, unknown>,
|
|
374
566
|
options?: { readonly contentType?: string | undefined; readonly contentLength?: number | undefined } | undefined
|
|
375
567
|
): (self: HttpClientRequest) => HttpClientRequest
|
|
568
|
+
/**
|
|
569
|
+
* @since 1.0.0
|
|
570
|
+
* @category combinators
|
|
571
|
+
*/
|
|
376
572
|
(
|
|
377
573
|
self: HttpClientRequest,
|
|
378
574
|
body: Stream.Stream<Uint8Array, unknown>,
|
|
@@ -385,10 +581,18 @@ export const bodyStream: {
|
|
|
385
581
|
* @category combinators
|
|
386
582
|
*/
|
|
387
583
|
export const bodyFile: {
|
|
584
|
+
/**
|
|
585
|
+
* @since 1.0.0
|
|
586
|
+
* @category combinators
|
|
587
|
+
*/
|
|
388
588
|
(
|
|
389
589
|
path: string,
|
|
390
590
|
options?: FileSystem.StreamOptions & { readonly contentType?: string }
|
|
391
591
|
): (self: HttpClientRequest) => Effect.Effect<HttpClientRequest, PlatformError.PlatformError, FileSystem.FileSystem>
|
|
592
|
+
/**
|
|
593
|
+
* @since 1.0.0
|
|
594
|
+
* @category combinators
|
|
595
|
+
*/
|
|
392
596
|
(
|
|
393
597
|
self: HttpClientRequest,
|
|
394
598
|
path: string,
|
|
@@ -401,6 +605,14 @@ export const bodyFile: {
|
|
|
401
605
|
* @category combinators
|
|
402
606
|
*/
|
|
403
607
|
export const bodyFileWeb: {
|
|
608
|
+
/**
|
|
609
|
+
* @since 1.0.0
|
|
610
|
+
* @category combinators
|
|
611
|
+
*/
|
|
404
612
|
(file: Body.HttpBody.FileLike): (self: HttpClientRequest) => HttpClientRequest
|
|
613
|
+
/**
|
|
614
|
+
* @since 1.0.0
|
|
615
|
+
* @category combinators
|
|
616
|
+
*/
|
|
405
617
|
(self: HttpClientRequest, file: Body.HttpBody.FileLike): HttpClientRequest
|
|
406
618
|
} = internal.bodyFileWeb
|
|
@@ -50,6 +50,7 @@ export type TypeId = typeof TypeId
|
|
|
50
50
|
*/
|
|
51
51
|
export interface HttpClientResponse extends IncomingMessage.HttpIncomingMessage<Error.ResponseError> {
|
|
52
52
|
readonly [TypeId]: TypeId
|
|
53
|
+
readonly request: ClientRequest.HttpClientRequest
|
|
53
54
|
readonly status: number
|
|
54
55
|
readonly cookies: Cookies.Cookies
|
|
55
56
|
readonly formData: Effect.Effect<FormData, Error.ResponseError>
|
|
@@ -109,6 +110,10 @@ export const stream: <E, R>(
|
|
|
109
110
|
* @category pattern matching
|
|
110
111
|
*/
|
|
111
112
|
export const matchStatus: {
|
|
113
|
+
/**
|
|
114
|
+
* @since 1.0.0
|
|
115
|
+
* @category pattern matching
|
|
116
|
+
*/
|
|
112
117
|
<
|
|
113
118
|
const Cases extends {
|
|
114
119
|
readonly [status: number]: (_: HttpClientResponse) => any
|
|
@@ -119,6 +124,10 @@ export const matchStatus: {
|
|
|
119
124
|
readonly orElse: (_: HttpClientResponse) => any
|
|
120
125
|
}
|
|
121
126
|
>(cases: Cases): (self: HttpClientResponse) => Cases[keyof Cases] extends (_: any) => infer R ? Unify<R> : never
|
|
127
|
+
/**
|
|
128
|
+
* @since 1.0.0
|
|
129
|
+
* @category pattern matching
|
|
130
|
+
*/
|
|
122
131
|
<
|
|
123
132
|
const Cases extends {
|
|
124
133
|
readonly [status: number]: (_: HttpClientResponse) => any
|
|
@@ -130,3 +139,27 @@ export const matchStatus: {
|
|
|
130
139
|
}
|
|
131
140
|
>(self: HttpClientResponse, cases: Cases): Cases[keyof Cases] extends (_: any) => infer R ? Unify<R> : never
|
|
132
141
|
} = internal.matchStatus
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* @since 1.0.0
|
|
145
|
+
* @category filters
|
|
146
|
+
*/
|
|
147
|
+
export const filterStatus: {
|
|
148
|
+
/**
|
|
149
|
+
* @since 1.0.0
|
|
150
|
+
* @category filters
|
|
151
|
+
*/
|
|
152
|
+
(f: (status: number) => boolean): (self: HttpClientResponse) => Effect.Effect<HttpClientResponse, Error.ResponseError>
|
|
153
|
+
/**
|
|
154
|
+
* @since 1.0.0
|
|
155
|
+
* @category filters
|
|
156
|
+
*/
|
|
157
|
+
(self: HttpClientResponse, f: (status: number) => boolean): Effect.Effect<HttpClientResponse, Error.ResponseError>
|
|
158
|
+
} = internal.filterStatus
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @since 1.0.0
|
|
162
|
+
* @category filters
|
|
163
|
+
*/
|
|
164
|
+
export const filterStatusOk: (self: HttpClientResponse) => Effect.Effect<HttpClientResponse, Error.ResponseError> =
|
|
165
|
+
internal.filterStatusOk
|
|
@@ -91,7 +91,15 @@ export const maxBodySize: FiberRef.FiberRef<Option.Option<FileSystem.Size>> = Gl
|
|
|
91
91
|
* @category fiber refs
|
|
92
92
|
*/
|
|
93
93
|
export const withMaxBodySize = dual<
|
|
94
|
+
/**
|
|
95
|
+
* @since 1.0.0
|
|
96
|
+
* @category fiber refs
|
|
97
|
+
*/
|
|
94
98
|
(size: Option.Option<FileSystem.SizeInput>) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>,
|
|
99
|
+
/**
|
|
100
|
+
* @since 1.0.0
|
|
101
|
+
* @category fiber refs
|
|
102
|
+
*/
|
|
95
103
|
<A, E, R>(effect: Effect.Effect<A, E, R>, size: Option.Option<FileSystem.SizeInput>) => Effect.Effect<A, E, R>
|
|
96
104
|
>(2, (effect, size) => Effect.locally(effect, maxBodySize, Option.map(size, FileSystem.Size)))
|
|
97
105
|
|
package/src/HttpMiddleware.ts
CHANGED
|
@@ -66,9 +66,17 @@ export const currentTracerDisabledWhen: FiberRef.FiberRef<Predicate.Predicate<Se
|
|
|
66
66
|
* @category fiber refs
|
|
67
67
|
*/
|
|
68
68
|
export const withTracerDisabledWhen: {
|
|
69
|
+
/**
|
|
70
|
+
* @since 1.0.0
|
|
71
|
+
* @category fiber refs
|
|
72
|
+
*/
|
|
69
73
|
(
|
|
70
74
|
predicate: Predicate.Predicate<ServerRequest.HttpServerRequest>
|
|
71
75
|
): <A, E, R>(layer: Layer.Layer<A, E, R>) => Layer.Layer<A, E, R>
|
|
76
|
+
/**
|
|
77
|
+
* @since 1.0.0
|
|
78
|
+
* @category fiber refs
|
|
79
|
+
*/
|
|
72
80
|
<A, E, R>(
|
|
73
81
|
layer: Layer.Layer<A, E, R>,
|
|
74
82
|
predicate: Predicate.Predicate<ServerRequest.HttpServerRequest>
|
|
@@ -80,9 +88,17 @@ export const withTracerDisabledWhen: {
|
|
|
80
88
|
* @category fiber refs
|
|
81
89
|
*/
|
|
82
90
|
export const withTracerDisabledWhenEffect: {
|
|
91
|
+
/**
|
|
92
|
+
* @since 1.0.0
|
|
93
|
+
* @category fiber refs
|
|
94
|
+
*/
|
|
83
95
|
(
|
|
84
96
|
predicate: Predicate.Predicate<ServerRequest.HttpServerRequest>
|
|
85
97
|
): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
|
|
98
|
+
/**
|
|
99
|
+
* @since 1.0.0
|
|
100
|
+
* @category fiber refs
|
|
101
|
+
*/
|
|
86
102
|
<A, E, R>(
|
|
87
103
|
effect: Effect.Effect<A, E, R>,
|
|
88
104
|
predicate: Predicate.Predicate<ServerRequest.HttpServerRequest>
|
|
@@ -94,7 +110,15 @@ export const withTracerDisabledWhenEffect: {
|
|
|
94
110
|
* @category fiber refs
|
|
95
111
|
*/
|
|
96
112
|
export const withTracerDisabledForUrls: {
|
|
113
|
+
/**
|
|
114
|
+
* @since 1.0.0
|
|
115
|
+
* @category fiber refs
|
|
116
|
+
*/
|
|
97
117
|
(urls: ReadonlyArray<string>): <A, E, R>(layer: Layer.Layer<A, E, R>) => Layer.Layer<A, E, R>
|
|
118
|
+
/**
|
|
119
|
+
* @since 1.0.0
|
|
120
|
+
* @category fiber refs
|
|
121
|
+
*/
|
|
98
122
|
<A, E, R>(layer: Layer.Layer<A, E, R>, urls: ReadonlyArray<string>): Layer.Layer<A, E, R>
|
|
99
123
|
} = internal.withTracerDisabledForUrls
|
|
100
124
|
|
package/src/HttpMultiplex.ts
CHANGED
|
@@ -58,10 +58,18 @@ export const make: <E, R>(
|
|
|
58
58
|
* @category combinators
|
|
59
59
|
*/
|
|
60
60
|
export const add: {
|
|
61
|
+
/**
|
|
62
|
+
* @since 1.0.0
|
|
63
|
+
* @category combinators
|
|
64
|
+
*/
|
|
61
65
|
<E2, R2, E3, R3>(
|
|
62
66
|
predicate: (request: ServerRequest.HttpServerRequest) => Effect.Effect<boolean, E2, R2>,
|
|
63
67
|
app: App.Default<E3, R3>
|
|
64
68
|
): <E, R>(self: HttpMultiplex<E, R>) => HttpMultiplex<E2 | E3 | E, R2 | R3 | R>
|
|
69
|
+
/**
|
|
70
|
+
* @since 1.0.0
|
|
71
|
+
* @category combinators
|
|
72
|
+
*/
|
|
65
73
|
<E, R, E2, R2, E3, R3>(
|
|
66
74
|
self: HttpMultiplex<E, R>,
|
|
67
75
|
predicate: (request: ServerRequest.HttpServerRequest) => Effect.Effect<boolean, E2, R2>,
|
|
@@ -74,11 +82,19 @@ export const add: {
|
|
|
74
82
|
* @category combinators
|
|
75
83
|
*/
|
|
76
84
|
export const headerExact: {
|
|
85
|
+
/**
|
|
86
|
+
* @since 1.0.0
|
|
87
|
+
* @category combinators
|
|
88
|
+
*/
|
|
77
89
|
<E2, R2>(
|
|
78
90
|
header: string,
|
|
79
91
|
value: string,
|
|
80
92
|
app: App.Default<E2, R2>
|
|
81
93
|
): <E, R>(self: HttpMultiplex<E, R>) => HttpMultiplex<E2 | E, R2 | R>
|
|
94
|
+
/**
|
|
95
|
+
* @since 1.0.0
|
|
96
|
+
* @category combinators
|
|
97
|
+
*/
|
|
82
98
|
<E, R, E2, R2>(
|
|
83
99
|
self: HttpMultiplex<E, R>,
|
|
84
100
|
header: string,
|
|
@@ -92,11 +108,19 @@ export const headerExact: {
|
|
|
92
108
|
* @category combinators
|
|
93
109
|
*/
|
|
94
110
|
export const headerRegex: {
|
|
111
|
+
/**
|
|
112
|
+
* @since 1.0.0
|
|
113
|
+
* @category combinators
|
|
114
|
+
*/
|
|
95
115
|
<E2, R2>(
|
|
96
116
|
header: string,
|
|
97
117
|
regex: RegExp,
|
|
98
118
|
app: App.Default<E2, R2>
|
|
99
119
|
): <E, R>(self: HttpMultiplex<E, R>) => HttpMultiplex<E2 | E, R2 | R>
|
|
120
|
+
/**
|
|
121
|
+
* @since 1.0.0
|
|
122
|
+
* @category combinators
|
|
123
|
+
*/
|
|
100
124
|
<E, R, E2, R2>(
|
|
101
125
|
self: HttpMultiplex<E, R>,
|
|
102
126
|
header: string,
|
|
@@ -110,11 +134,19 @@ export const headerRegex: {
|
|
|
110
134
|
* @category combinators
|
|
111
135
|
*/
|
|
112
136
|
export const headerStartsWith: {
|
|
137
|
+
/**
|
|
138
|
+
* @since 1.0.0
|
|
139
|
+
* @category combinators
|
|
140
|
+
*/
|
|
113
141
|
<E2, R2>(
|
|
114
142
|
header: string,
|
|
115
143
|
prefix: string,
|
|
116
144
|
app: App.Default<E2, R2>
|
|
117
145
|
): <E, R>(self: HttpMultiplex<E, R>) => HttpMultiplex<E2 | E, R2 | R>
|
|
146
|
+
/**
|
|
147
|
+
* @since 1.0.0
|
|
148
|
+
* @category combinators
|
|
149
|
+
*/
|
|
118
150
|
<E, R, E2, R2>(
|
|
119
151
|
self: HttpMultiplex<E, R>,
|
|
120
152
|
header: string,
|
|
@@ -128,11 +160,19 @@ export const headerStartsWith: {
|
|
|
128
160
|
* @category combinators
|
|
129
161
|
*/
|
|
130
162
|
export const headerEndsWith: {
|
|
163
|
+
/**
|
|
164
|
+
* @since 1.0.0
|
|
165
|
+
* @category combinators
|
|
166
|
+
*/
|
|
131
167
|
<E2, R2>(
|
|
132
168
|
header: string,
|
|
133
169
|
suffix: string,
|
|
134
170
|
app: App.Default<E2, R2>
|
|
135
171
|
): <E, R>(self: HttpMultiplex<E, R>) => HttpMultiplex<E2 | E, R2 | R>
|
|
172
|
+
/**
|
|
173
|
+
* @since 1.0.0
|
|
174
|
+
* @category combinators
|
|
175
|
+
*/
|
|
136
176
|
<E, R, E2, R2>(
|
|
137
177
|
self: HttpMultiplex<E, R>,
|
|
138
178
|
header: string,
|
|
@@ -146,7 +186,15 @@ export const headerEndsWith: {
|
|
|
146
186
|
* @category combinators
|
|
147
187
|
*/
|
|
148
188
|
export const hostExact: {
|
|
189
|
+
/**
|
|
190
|
+
* @since 1.0.0
|
|
191
|
+
* @category combinators
|
|
192
|
+
*/
|
|
149
193
|
<E2, R2>(host: string, app: App.Default<E2, R2>): <E, R>(self: HttpMultiplex<E, R>) => HttpMultiplex<E2 | E, R2 | R>
|
|
194
|
+
/**
|
|
195
|
+
* @since 1.0.0
|
|
196
|
+
* @category combinators
|
|
197
|
+
*/
|
|
150
198
|
<E, R, E2, R2>(self: HttpMultiplex<E, R>, host: string, app: App.Default<E2, R2>): HttpMultiplex<E | E2, R | R2>
|
|
151
199
|
} = internal.hostExact
|
|
152
200
|
|
|
@@ -155,7 +203,15 @@ export const hostExact: {
|
|
|
155
203
|
* @category combinators
|
|
156
204
|
*/
|
|
157
205
|
export const hostRegex: {
|
|
206
|
+
/**
|
|
207
|
+
* @since 1.0.0
|
|
208
|
+
* @category combinators
|
|
209
|
+
*/
|
|
158
210
|
<E2, R2>(regex: RegExp, app: App.Default<E2, R2>): <E, R>(self: HttpMultiplex<E, R>) => HttpMultiplex<E2 | E, R2 | R>
|
|
211
|
+
/**
|
|
212
|
+
* @since 1.0.0
|
|
213
|
+
* @category combinators
|
|
214
|
+
*/
|
|
159
215
|
<E, R, E2, R2>(self: HttpMultiplex<E, R>, regex: RegExp, app: App.Default<E2, R2>): HttpMultiplex<E | E2, R | R2>
|
|
160
216
|
} = internal.hostRegex
|
|
161
217
|
|
|
@@ -164,7 +220,15 @@ export const hostRegex: {
|
|
|
164
220
|
* @category combinators
|
|
165
221
|
*/
|
|
166
222
|
export const hostStartsWith: {
|
|
223
|
+
/**
|
|
224
|
+
* @since 1.0.0
|
|
225
|
+
* @category combinators
|
|
226
|
+
*/
|
|
167
227
|
<E2, R2>(prefix: string, app: App.Default<E2, R2>): <E, R>(self: HttpMultiplex<E, R>) => HttpMultiplex<E2 | E, R2 | R>
|
|
228
|
+
/**
|
|
229
|
+
* @since 1.0.0
|
|
230
|
+
* @category combinators
|
|
231
|
+
*/
|
|
168
232
|
<E, R, E2, R2>(self: HttpMultiplex<E, R>, prefix: string, app: App.Default<E2, R2>): HttpMultiplex<E | E2, R | R2>
|
|
169
233
|
} = internal.hostStartsWith
|
|
170
234
|
|
|
@@ -173,6 +237,14 @@ export const hostStartsWith: {
|
|
|
173
237
|
* @category combinators
|
|
174
238
|
*/
|
|
175
239
|
export const hostEndsWith: {
|
|
240
|
+
/**
|
|
241
|
+
* @since 1.0.0
|
|
242
|
+
* @category combinators
|
|
243
|
+
*/
|
|
176
244
|
<E2, R2>(suffix: string, app: App.Default<E2, R2>): <E, R>(self: HttpMultiplex<E, R>) => HttpMultiplex<E2 | E, R2 | R>
|
|
245
|
+
/**
|
|
246
|
+
* @since 1.0.0
|
|
247
|
+
* @category combinators
|
|
248
|
+
*/
|
|
177
249
|
<E, R, E2, R2>(self: HttpMultiplex<E, R>, suffix: string, app: App.Default<E2, R2>): HttpMultiplex<E | E2, R | R2>
|
|
178
250
|
} = internal.hostEndsWith
|