@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/Command.ts
CHANGED
|
@@ -126,7 +126,19 @@ export const isCommand: (u: unknown) => u is Command = internal.isCommand
|
|
|
126
126
|
* @category combinators
|
|
127
127
|
*/
|
|
128
128
|
export const env: {
|
|
129
|
+
/**
|
|
130
|
+
* Specify the environment variables that will be used when running this command.
|
|
131
|
+
*
|
|
132
|
+
* @since 1.0.0
|
|
133
|
+
* @category combinators
|
|
134
|
+
*/
|
|
129
135
|
(environment: Record<string, string | undefined>): (self: Command) => Command
|
|
136
|
+
/**
|
|
137
|
+
* Specify the environment variables that will be used when running this command.
|
|
138
|
+
*
|
|
139
|
+
* @since 1.0.0
|
|
140
|
+
* @category combinators
|
|
141
|
+
*/
|
|
130
142
|
(self: Command, environment: Record<string, string | undefined>): Command
|
|
131
143
|
} = internal.env
|
|
132
144
|
|
|
@@ -146,7 +158,19 @@ export const exitCode: (self: Command) => Effect<ExitCode, PlatformError, Comman
|
|
|
146
158
|
* @category combinators
|
|
147
159
|
*/
|
|
148
160
|
export const feed: {
|
|
161
|
+
/**
|
|
162
|
+
* Feed a string to standard input (default encoding of UTF-8).
|
|
163
|
+
*
|
|
164
|
+
* @since 1.0.0
|
|
165
|
+
* @category combinators
|
|
166
|
+
*/
|
|
149
167
|
(input: string): (self: Command) => Command
|
|
168
|
+
/**
|
|
169
|
+
* Feed a string to standard input (default encoding of UTF-8).
|
|
170
|
+
*
|
|
171
|
+
* @since 1.0.0
|
|
172
|
+
* @category combinators
|
|
173
|
+
*/
|
|
150
174
|
(self: Command, input: string): Command
|
|
151
175
|
} = internal.feed
|
|
152
176
|
|
|
@@ -194,7 +218,31 @@ export const make: (command: string, ...args: Array<string>) => Command = intern
|
|
|
194
218
|
* @category combinators
|
|
195
219
|
*/
|
|
196
220
|
export const pipeTo: {
|
|
221
|
+
/**
|
|
222
|
+
* Pipe one command to another command from left to right.
|
|
223
|
+
*
|
|
224
|
+
* Conceptually, the equivalent of piping one shell command to another:
|
|
225
|
+
*
|
|
226
|
+
* ```sh
|
|
227
|
+
* command1 | command2
|
|
228
|
+
* ```
|
|
229
|
+
*
|
|
230
|
+
* @since 1.0.0
|
|
231
|
+
* @category combinators
|
|
232
|
+
*/
|
|
197
233
|
(into: Command): (self: Command) => Command
|
|
234
|
+
/**
|
|
235
|
+
* Pipe one command to another command from left to right.
|
|
236
|
+
*
|
|
237
|
+
* Conceptually, the equivalent of piping one shell command to another:
|
|
238
|
+
*
|
|
239
|
+
* ```sh
|
|
240
|
+
* command1 | command2
|
|
241
|
+
* ```
|
|
242
|
+
*
|
|
243
|
+
* @since 1.0.0
|
|
244
|
+
* @category combinators
|
|
245
|
+
*/
|
|
198
246
|
(self: Command, into: Command): Command
|
|
199
247
|
} = internal.pipeTo
|
|
200
248
|
|
|
@@ -206,7 +254,21 @@ export const pipeTo: {
|
|
|
206
254
|
* @category combinators
|
|
207
255
|
*/
|
|
208
256
|
export const runInShell: {
|
|
257
|
+
/**
|
|
258
|
+
* Allows for specifying whether or not a `Command` should be run inside a
|
|
259
|
+
* shell.
|
|
260
|
+
*
|
|
261
|
+
* @since 1.0.0
|
|
262
|
+
* @category combinators
|
|
263
|
+
*/
|
|
209
264
|
(shell: string | boolean): (self: Command) => Command
|
|
265
|
+
/**
|
|
266
|
+
* Allows for specifying whether or not a `Command` should be run inside a
|
|
267
|
+
* shell.
|
|
268
|
+
*
|
|
269
|
+
* @since 1.0.0
|
|
270
|
+
* @category combinators
|
|
271
|
+
*/
|
|
210
272
|
(self: Command, shell: string | boolean): Command
|
|
211
273
|
} = internal.runInShell
|
|
212
274
|
|
|
@@ -246,7 +308,25 @@ export const streamLines: (command: Command, encoding?: string) => Stream<string
|
|
|
246
308
|
* @category execution
|
|
247
309
|
*/
|
|
248
310
|
export const string: {
|
|
311
|
+
/**
|
|
312
|
+
* Runs the command returning the entire output as a string with the
|
|
313
|
+
* specified encoding.
|
|
314
|
+
*
|
|
315
|
+
* If an encoding is not specified, the encoding will default to `utf-8`.
|
|
316
|
+
*
|
|
317
|
+
* @since 1.0.0
|
|
318
|
+
* @category execution
|
|
319
|
+
*/
|
|
249
320
|
(encoding?: string): (command: Command) => Effect<string, PlatformError, CommandExecutor>
|
|
321
|
+
/**
|
|
322
|
+
* Runs the command returning the entire output as a string with the
|
|
323
|
+
* specified encoding.
|
|
324
|
+
*
|
|
325
|
+
* If an encoding is not specified, the encoding will default to `utf-8`.
|
|
326
|
+
*
|
|
327
|
+
* @since 1.0.0
|
|
328
|
+
* @category execution
|
|
329
|
+
*/
|
|
250
330
|
(command: Command, encoding?: string): Effect<string, PlatformError, CommandExecutor>
|
|
251
331
|
} = internal.string
|
|
252
332
|
|
|
@@ -257,7 +337,19 @@ export const string: {
|
|
|
257
337
|
* @category combinators
|
|
258
338
|
*/
|
|
259
339
|
export const stderr: {
|
|
340
|
+
/**
|
|
341
|
+
* Specify the standard error stream for a command.
|
|
342
|
+
*
|
|
343
|
+
* @since 1.0.0
|
|
344
|
+
* @category combinators
|
|
345
|
+
*/
|
|
260
346
|
(stderr: Command.Output): (self: Command) => Command
|
|
347
|
+
/**
|
|
348
|
+
* Specify the standard error stream for a command.
|
|
349
|
+
*
|
|
350
|
+
* @since 1.0.0
|
|
351
|
+
* @category combinators
|
|
352
|
+
*/
|
|
261
353
|
(self: Command, stderr: Command.Output): Command
|
|
262
354
|
} = internal.stderr
|
|
263
355
|
|
|
@@ -268,7 +360,19 @@ export const stderr: {
|
|
|
268
360
|
* @category combinators
|
|
269
361
|
*/
|
|
270
362
|
export const stdin: {
|
|
363
|
+
/**
|
|
364
|
+
* Specify the standard input stream for a command.
|
|
365
|
+
*
|
|
366
|
+
* @since 1.0.0
|
|
367
|
+
* @category combinators
|
|
368
|
+
*/
|
|
271
369
|
(stdin: Command.Input): (self: Command) => Command
|
|
370
|
+
/**
|
|
371
|
+
* Specify the standard input stream for a command.
|
|
372
|
+
*
|
|
373
|
+
* @since 1.0.0
|
|
374
|
+
* @category combinators
|
|
375
|
+
*/
|
|
272
376
|
(self: Command, stdin: Command.Input): Command
|
|
273
377
|
} = internal.stdin
|
|
274
378
|
|
|
@@ -279,7 +383,19 @@ export const stdin: {
|
|
|
279
383
|
* @category combinators
|
|
280
384
|
*/
|
|
281
385
|
export const stdout: {
|
|
386
|
+
/**
|
|
387
|
+
* Specify the standard output stream for a command.
|
|
388
|
+
*
|
|
389
|
+
* @since 1.0.0
|
|
390
|
+
* @category combinators
|
|
391
|
+
*/
|
|
282
392
|
(stdout: Command.Output): (self: Command) => Command
|
|
393
|
+
/**
|
|
394
|
+
* Specify the standard output stream for a command.
|
|
395
|
+
*
|
|
396
|
+
* @since 1.0.0
|
|
397
|
+
* @category combinators
|
|
398
|
+
*/
|
|
283
399
|
(self: Command, stdout: Command.Output): Command
|
|
284
400
|
} = internal.stdout
|
|
285
401
|
|
|
@@ -293,6 +409,24 @@ export const stdout: {
|
|
|
293
409
|
* @category combinators
|
|
294
410
|
*/
|
|
295
411
|
export const workingDirectory: {
|
|
412
|
+
/**
|
|
413
|
+
* Set the working directory that will be used when this command will be run.
|
|
414
|
+
*
|
|
415
|
+
* For piped commands, the working directory of each command will be set to the
|
|
416
|
+
* specified working directory.
|
|
417
|
+
*
|
|
418
|
+
* @since 1.0.0
|
|
419
|
+
* @category combinators
|
|
420
|
+
*/
|
|
296
421
|
(cwd: string): (self: Command) => Command
|
|
422
|
+
/**
|
|
423
|
+
* Set the working directory that will be used when this command will be run.
|
|
424
|
+
*
|
|
425
|
+
* For piped commands, the working directory of each command will be set to the
|
|
426
|
+
* specified working directory.
|
|
427
|
+
*
|
|
428
|
+
* @since 1.0.0
|
|
429
|
+
* @category combinators
|
|
430
|
+
*/
|
|
297
431
|
(self: Command, cwd: string): Command
|
|
298
432
|
} = internal.workingDirectory
|
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
|
(
|