@effect/platform 0.18.4 → 0.18.6
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/Command/dist/effect-platform-Command.esm.js +12 -200
- package/CommandExecutor/dist/effect-platform-CommandExecutor.esm.js +9 -71
- package/Effectify/dist/effect-platform-Effectify.esm.js +2 -23
- package/Error/dist/effect-platform-Error.esm.js +2 -54
- package/FileSystem/dist/effect-platform-FileSystem.esm.js +10 -177
- package/Http/Body/dist/effect-platform-Http-Body.esm.js +13 -151
- package/Http/Client/dist/effect-platform-Http-Client.cjs.dev.js +2 -2
- package/Http/Client/dist/effect-platform-Http-Client.cjs.prod.js +2 -2
- package/Http/Client/dist/effect-platform-Http-Client.esm.js +28 -164
- package/Http/ClientError/dist/effect-platform-Http-ClientError.esm.js +3 -48
- package/Http/ClientRequest/dist/effect-platform-Http-ClientRequest.esm.js +20 -241
- package/Http/ClientResponse/dist/effect-platform-Http-ClientResponse.cjs.dev.js +3 -2
- package/Http/ClientResponse/dist/effect-platform-Http-ClientResponse.cjs.mjs +2 -1
- package/Http/ClientResponse/dist/effect-platform-Http-ClientResponse.cjs.prod.js +3 -2
- package/Http/ClientResponse/dist/effect-platform-Http-ClientResponse.esm.js +22 -35
- package/Http/Etag/dist/effect-platform-Http-Etag.esm.js +17 -1
- package/Http/FormData/dist/effect-platform-Http-FormData.esm.js +17 -155
- package/Http/Headers/dist/effect-platform-Http-Headers.esm.js +4 -74
- package/Http/IncomingMessage/dist/effect-platform-Http-IncomingMessage.esm.js +6 -1
- package/Http/Middleware/dist/effect-platform-Http-Middleware.cjs.dev.js +3 -3
- package/Http/Middleware/dist/effect-platform-Http-Middleware.cjs.prod.js +3 -3
- package/Http/Middleware/dist/effect-platform-Http-Middleware.esm.js +30 -52
- package/Http/Platform/dist/effect-platform-Http-Platform.esm.js +56 -1
- package/Http/Router/dist/effect-platform-Http-Router.esm.js +25 -224
- package/Http/Server/dist/effect-platform-Http-Server.esm.js +18 -1
- package/Http/ServerError/dist/effect-platform-Http-ServerError.esm.js +2 -70
- package/Http/ServerRequest/dist/effect-platform-Http-ServerRequest.esm.js +20 -65
- package/Http/ServerResponse/dist/effect-platform-Http-ServerResponse.cjs.dev.js +2 -2
- package/Http/ServerResponse/dist/effect-platform-Http-ServerResponse.cjs.prod.js +2 -2
- package/Http/ServerResponse/dist/effect-platform-Http-ServerResponse.esm.js +21 -126
- package/Http/UrlParams/dist/effect-platform-Http-UrlParams.esm.js +4 -101
- package/HttpClient/dist/effect-platform-HttpClient.cjs.dev.js +3 -3
- package/HttpClient/dist/effect-platform-HttpClient.cjs.prod.js +3 -3
- package/HttpClient/dist/effect-platform-HttpClient.esm.js +32 -18
- package/HttpServer/dist/effect-platform-HttpServer.cjs.dev.js +2 -3
- package/HttpServer/dist/effect-platform-HttpServer.cjs.prod.js +2 -3
- package/HttpServer/dist/effect-platform-HttpServer.esm.js +35 -24
- package/KeyValueStore/dist/effect-platform-KeyValueStore.esm.js +15 -78
- package/Path/dist/effect-platform-Path.esm.js +8 -33
- package/Runtime/dist/effect-platform-Runtime.esm.js +3 -26
- package/dist/App-687366d8.esm.js +5 -0
- package/dist/Body-ec1353f9.esm.js +170 -0
- package/dist/{Client-15671ed6.cjs.dev.js → Client-440a1019.cjs.dev.js} +1 -1
- package/dist/Client-4659bda7.esm.js +346 -0
- package/dist/{Client-6b3e3de8.cjs.prod.js → Client-7b851481.cjs.prod.js} +1 -1
- package/dist/ClientError-98b5da8c.esm.js +55 -0
- package/dist/ClientRequest-fc429335.esm.js +281 -0
- package/dist/{ClientResponse-a1d64ab8.cjs.dev.js → ClientResponse-1476704c.cjs.dev.js} +9 -1
- package/dist/ClientResponse-4524e99e.esm.js +53 -0
- package/dist/{ClientResponse-8f65511e.cjs.prod.js → ClientResponse-fe4e69c8.cjs.prod.js} +9 -1
- package/dist/Command-d8ab0c8d.esm.js +403 -0
- package/dist/CommandExecutor-5807b66b.esm.js +80 -0
- package/dist/Effectify-e5a9d266.esm.js +43 -0
- package/dist/Error-3099667c.esm.js +75 -0
- package/dist/FileSystem-7e31dccd.esm.js +271 -0
- package/dist/FormData-f54de878.esm.js +270 -0
- package/dist/Headers-58b56a08.esm.js +85 -0
- package/dist/{HttpClient-cefc7da9.cjs.dev.js → HttpClient-4d23b1f5.cjs.dev.js} +2 -2
- package/dist/{HttpClient-d3c69877.cjs.prod.js → HttpClient-88775b8e.cjs.prod.js} +2 -2
- package/dist/HttpClient-9ca6050c.esm.js +24 -0
- package/dist/{HttpServer-5b9d992e.cjs.dev.js → HttpServer-16159c3a.cjs.dev.js} +2 -2
- package/dist/HttpServer-50f8df76.esm.js +30 -0
- package/dist/{HttpServer-60325fb0.cjs.prod.js → HttpServer-93c0fbb3.cjs.prod.js} +2 -2
- package/{internal/keyValueStore.esm.js → dist/KeyValueStore-2f9a70bf.esm.js} +102 -15
- package/dist/Middleware-240f91f6.esm.js +105 -0
- package/dist/{Middleware-8e7cd600.cjs.dev.js → Middleware-e2edf820.cjs.dev.js} +1 -1
- package/dist/{Middleware-d4f1a1cd.cjs.prod.js → Middleware-f9a073d7.cjs.prod.js} +1 -1
- package/{internal/path.esm.js → dist/Path-46f84ba7.esm.js} +40 -4
- package/dist/Router-bf32317a.esm.js +454 -0
- package/dist/Runtime-7265fb98.esm.js +31 -0
- package/dist/ServerError-04ad5b57.esm.js +99 -0
- package/dist/ServerRequest-03161edc.esm.js +125 -0
- package/dist/ServerResponse-93038062.esm.js +259 -0
- package/dist/{ServerResponse-7d60c7d1.cjs.dev.js → ServerResponse-b63b7192.cjs.dev.js} +15 -4
- package/dist/{ServerResponse-830f1052.cjs.prod.js → ServerResponse-eae85b08.cjs.prod.js} +15 -4
- package/dist/UrlParams-1286c728.esm.js +114 -0
- package/{internal/http/body.esm.js → dist/body-20d78ec1.esm.js} +2 -2
- package/{internal/http/clientError.esm.js → dist/clientError-c4e1466c.esm.js} +1 -1
- package/{internal/http/clientRequest.esm.js → dist/clientRequest-1e9e0b0d.esm.js} +4 -4
- package/dist/{clientResponse-c58a116c.cjs.dev.js → clientResponse-79c84a64.cjs.dev.js} +10 -0
- package/{internal/http/clientResponse.esm.js → dist/clientResponse-8c2ec6a3.esm.js} +14 -5
- package/dist/{clientResponse-2c6a83f1.cjs.prod.js → clientResponse-f9c57e83.cjs.prod.js} +10 -0
- package/{internal/commandExecutor.esm.js → dist/commandExecutor-d6457489.esm.js} +1 -1
- package/dist/declarations/src/Http/ClientResponse.d.ts +8 -0
- package/dist/declarations/src/Http/ClientResponse.d.ts.map +1 -1
- package/dist/declarations/src/Http/ServerResponse.d.ts +1 -2
- package/dist/declarations/src/Http/ServerResponse.d.ts.map +1 -1
- package/dist/effect-platform.cjs.dev.js +8 -8
- package/dist/effect-platform.cjs.prod.js +8 -8
- package/dist/effect-platform.esm.js +58 -20
- package/package.json +1 -2
- package/src/Http/ClientResponse.ts +10 -0
- package/src/Http/ServerResponse.ts +1 -2
- package/src/internal/http/clientResponse.ts +16 -0
- package/src/internal/http/serverResponse.ts +18 -4
- package/internal/command.esm.js +0 -185
- package/internal/effectify.esm.js +0 -18
- package/internal/error.esm.js +0 -17
- package/internal/fileSystem.esm.js +0 -82
- package/internal/http/client.esm.js +0 -157
- package/internal/http/etag.esm.js +0 -19
- package/internal/http/formData.esm.js +0 -95
- package/internal/http/middleware.esm.js +0 -46
- package/internal/http/platform.esm.js +0 -52
- package/internal/http/router.esm.js +0 -199
- package/internal/http/server.esm.js +0 -20
- package/internal/http/serverError.esm.js +0 -23
- package/internal/http/serverRequest.esm.js +0 -50
- package/internal/http/serverResponse.esm.js +0 -105
|
@@ -7,8 +7,8 @@ var CommandExecutor_dist_effectPlatformCommandExecutor = require('./CommandExecu
|
|
|
7
7
|
var Effectify_dist_effectPlatformEffectify = require('./Effectify-2d8c3af9.cjs.dev.js');
|
|
8
8
|
var Error_dist_effectPlatformError = require('./Error-09496a70.cjs.dev.js');
|
|
9
9
|
var FileSystem_dist_effectPlatformFileSystem = require('./FileSystem-4c7daaf0.cjs.dev.js');
|
|
10
|
-
var HttpClient_dist_effectPlatformHttpClient = require('./HttpClient-
|
|
11
|
-
var HttpServer_dist_effectPlatformHttpServer = require('./HttpServer-
|
|
10
|
+
var HttpClient_dist_effectPlatformHttpClient = require('./HttpClient-4d23b1f5.cjs.dev.js');
|
|
11
|
+
var HttpServer_dist_effectPlatformHttpServer = require('./HttpServer-16159c3a.cjs.dev.js');
|
|
12
12
|
var KeyValueStore_dist_effectPlatformKeyValueStore = require('./KeyValueStore-f9c93610.cjs.dev.js');
|
|
13
13
|
var Path_dist_effectPlatformPath = require('./Path-7ba7e370.cjs.dev.js');
|
|
14
14
|
var Runtime_dist_effectPlatformRuntime = require('./Runtime-1edd577a.cjs.dev.js');
|
|
@@ -27,7 +27,7 @@ require('effect/Data');
|
|
|
27
27
|
require('./Body-86ef2922.cjs.dev.js');
|
|
28
28
|
require('./body-c7d7a944.cjs.dev.js');
|
|
29
29
|
require('@effect/schema/Schema');
|
|
30
|
-
require('./Client-
|
|
30
|
+
require('./Client-440a1019.cjs.dev.js');
|
|
31
31
|
require('effect/Layer');
|
|
32
32
|
require('../Http/IncomingMessage/dist/effect-platform-Http-IncomingMessage.cjs.dev.js');
|
|
33
33
|
require('@effect/schema/ParseResult');
|
|
@@ -40,21 +40,21 @@ require('./clientRequest-423fd562.cjs.dev.js');
|
|
|
40
40
|
require('./Headers-f56bc667.cjs.dev.js');
|
|
41
41
|
require('effect/ReadonlyArray');
|
|
42
42
|
require('effect/ReadonlyRecord');
|
|
43
|
-
require('./clientResponse-
|
|
43
|
+
require('./clientResponse-79c84a64.cjs.dev.js');
|
|
44
44
|
require('./ClientError-b7828377.cjs.dev.js');
|
|
45
45
|
require('./ClientRequest-00e89da8.cjs.dev.js');
|
|
46
|
-
require('./ClientResponse-
|
|
46
|
+
require('./ClientResponse-1476704c.cjs.dev.js');
|
|
47
47
|
require('./App-44aa3275.cjs.dev.js');
|
|
48
48
|
require('./FormData-ee0b1cf2.cjs.dev.js');
|
|
49
49
|
require('effect/Predicate');
|
|
50
|
-
require('./Middleware-
|
|
50
|
+
require('./Middleware-e2edf820.cjs.dev.js');
|
|
51
51
|
require('./ServerRequest-8d9c2c6b.cjs.dev.js');
|
|
52
52
|
require('./ServerError-55c5e24b.cjs.dev.js');
|
|
53
|
-
require('./ServerResponse-
|
|
53
|
+
require('./ServerResponse-b63b7192.cjs.dev.js');
|
|
54
|
+
require('effect/Effectable');
|
|
54
55
|
require('../Http/Platform/dist/effect-platform-Http-Platform.cjs.dev.js');
|
|
55
56
|
require('../Http/Etag/dist/effect-platform-Http-Etag.cjs.dev.js');
|
|
56
57
|
require('./Router-bd2b3014.cjs.dev.js');
|
|
57
|
-
require('effect/Effectable');
|
|
58
58
|
require('effect/Inspectable');
|
|
59
59
|
require('find-my-way');
|
|
60
60
|
require('path-browserify');
|
|
@@ -7,8 +7,8 @@ var CommandExecutor_dist_effectPlatformCommandExecutor = require('./CommandExecu
|
|
|
7
7
|
var Effectify_dist_effectPlatformEffectify = require('./Effectify-38757ba5.cjs.prod.js');
|
|
8
8
|
var Error_dist_effectPlatformError = require('./Error-2c4e6ce2.cjs.prod.js');
|
|
9
9
|
var FileSystem_dist_effectPlatformFileSystem = require('./FileSystem-3d439a05.cjs.prod.js');
|
|
10
|
-
var HttpClient_dist_effectPlatformHttpClient = require('./HttpClient-
|
|
11
|
-
var HttpServer_dist_effectPlatformHttpServer = require('./HttpServer-
|
|
10
|
+
var HttpClient_dist_effectPlatformHttpClient = require('./HttpClient-88775b8e.cjs.prod.js');
|
|
11
|
+
var HttpServer_dist_effectPlatformHttpServer = require('./HttpServer-93c0fbb3.cjs.prod.js');
|
|
12
12
|
var KeyValueStore_dist_effectPlatformKeyValueStore = require('./KeyValueStore-f6c5b981.cjs.prod.js');
|
|
13
13
|
var Path_dist_effectPlatformPath = require('./Path-3574641f.cjs.prod.js');
|
|
14
14
|
var Runtime_dist_effectPlatformRuntime = require('./Runtime-515efccf.cjs.prod.js');
|
|
@@ -27,7 +27,7 @@ require('effect/Data');
|
|
|
27
27
|
require('./Body-b77eac75.cjs.prod.js');
|
|
28
28
|
require('./body-33521da5.cjs.prod.js');
|
|
29
29
|
require('@effect/schema/Schema');
|
|
30
|
-
require('./Client-
|
|
30
|
+
require('./Client-7b851481.cjs.prod.js');
|
|
31
31
|
require('effect/Layer');
|
|
32
32
|
require('../Http/IncomingMessage/dist/effect-platform-Http-IncomingMessage.cjs.prod.js');
|
|
33
33
|
require('@effect/schema/ParseResult');
|
|
@@ -40,21 +40,21 @@ require('./clientRequest-3e72ec54.cjs.prod.js');
|
|
|
40
40
|
require('./Headers-122cb877.cjs.prod.js');
|
|
41
41
|
require('effect/ReadonlyArray');
|
|
42
42
|
require('effect/ReadonlyRecord');
|
|
43
|
-
require('./clientResponse-
|
|
43
|
+
require('./clientResponse-f9c57e83.cjs.prod.js');
|
|
44
44
|
require('./ClientError-22781879.cjs.prod.js');
|
|
45
45
|
require('./ClientRequest-750d8d59.cjs.prod.js');
|
|
46
|
-
require('./ClientResponse-
|
|
46
|
+
require('./ClientResponse-fe4e69c8.cjs.prod.js');
|
|
47
47
|
require('./App-0916639a.cjs.prod.js');
|
|
48
48
|
require('./FormData-902afd18.cjs.prod.js');
|
|
49
49
|
require('effect/Predicate');
|
|
50
|
-
require('./Middleware-
|
|
50
|
+
require('./Middleware-f9a073d7.cjs.prod.js');
|
|
51
51
|
require('./ServerRequest-938f3ed0.cjs.prod.js');
|
|
52
52
|
require('./ServerError-605b2fa2.cjs.prod.js');
|
|
53
|
-
require('./ServerResponse-
|
|
53
|
+
require('./ServerResponse-eae85b08.cjs.prod.js');
|
|
54
|
+
require('effect/Effectable');
|
|
54
55
|
require('../Http/Platform/dist/effect-platform-Http-Platform.cjs.prod.js');
|
|
55
56
|
require('../Http/Etag/dist/effect-platform-Http-Etag.cjs.prod.js');
|
|
56
57
|
require('./Router-6c80a4c9.cjs.prod.js');
|
|
57
|
-
require('effect/Effectable');
|
|
58
58
|
require('effect/Inspectable');
|
|
59
59
|
require('find-my-way');
|
|
60
60
|
require('path-browserify');
|
|
@@ -1,20 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
|
|
6
|
-
export {
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
import
|
|
18
|
-
|
|
19
|
-
import
|
|
20
|
-
|
|
1
|
+
export { C as Command } from './Command-d8ab0c8d.esm.js';
|
|
2
|
+
export { C as CommandExecutor } from './CommandExecutor-5807b66b.esm.js';
|
|
3
|
+
export { E as Effectify } from './Effectify-e5a9d266.esm.js';
|
|
4
|
+
export { E as Error } from './Error-3099667c.esm.js';
|
|
5
|
+
export { F as FileSystem } from './FileSystem-7e31dccd.esm.js';
|
|
6
|
+
export { H as HttpClient } from './HttpClient-9ca6050c.esm.js';
|
|
7
|
+
export { H as HttpServer } from './HttpServer-50f8df76.esm.js';
|
|
8
|
+
export { K as KeyValueStore } from './KeyValueStore-2f9a70bf.esm.js';
|
|
9
|
+
export { P as Path } from './Path-46f84ba7.esm.js';
|
|
10
|
+
export { R as Runtime } from './Runtime-7265fb98.esm.js';
|
|
11
|
+
import 'effect/Chunk';
|
|
12
|
+
import 'effect/Effect';
|
|
13
|
+
import 'effect/Function';
|
|
14
|
+
import 'effect/HashMap';
|
|
15
|
+
import 'effect/Option';
|
|
16
|
+
import 'effect/Pipeable';
|
|
17
|
+
import 'effect/Stream';
|
|
18
|
+
import './commandExecutor-d6457489.esm.js';
|
|
19
|
+
import 'effect/Brand';
|
|
20
|
+
import 'effect/Context';
|
|
21
|
+
import 'effect/Sink';
|
|
22
|
+
import 'effect/Data';
|
|
23
|
+
import './Body-ec1353f9.esm.js';
|
|
24
|
+
import './body-20d78ec1.esm.js';
|
|
25
|
+
import '@effect/schema/Schema';
|
|
26
|
+
import './Client-4659bda7.esm.js';
|
|
27
|
+
import 'effect/Layer';
|
|
28
|
+
import '../Http/IncomingMessage/dist/effect-platform-Http-IncomingMessage.esm.js';
|
|
29
|
+
import '@effect/schema/ParseResult';
|
|
30
|
+
import 'effect/FiberRef';
|
|
31
|
+
import 'effect/GlobalValue';
|
|
32
|
+
import '../Http/Method/dist/effect-platform-Http-Method.esm.js';
|
|
33
|
+
import './UrlParams-1286c728.esm.js';
|
|
34
|
+
import './clientError-c4e1466c.esm.js';
|
|
35
|
+
import './clientRequest-1e9e0b0d.esm.js';
|
|
36
|
+
import './Headers-58b56a08.esm.js';
|
|
37
|
+
import 'effect/ReadonlyArray';
|
|
38
|
+
import 'effect/ReadonlyRecord';
|
|
39
|
+
import './clientResponse-8c2ec6a3.esm.js';
|
|
40
|
+
import './ClientError-98b5da8c.esm.js';
|
|
41
|
+
import './ClientRequest-fc429335.esm.js';
|
|
42
|
+
import './ClientResponse-4524e99e.esm.js';
|
|
43
|
+
import './App-687366d8.esm.js';
|
|
44
|
+
import './FormData-f54de878.esm.js';
|
|
45
|
+
import 'effect/Predicate';
|
|
46
|
+
import './Middleware-240f91f6.esm.js';
|
|
47
|
+
import './ServerRequest-03161edc.esm.js';
|
|
48
|
+
import './ServerError-04ad5b57.esm.js';
|
|
49
|
+
import './ServerResponse-93038062.esm.js';
|
|
50
|
+
import 'effect/Effectable';
|
|
51
|
+
import '../Http/Platform/dist/effect-platform-Http-Platform.esm.js';
|
|
52
|
+
import '../Http/Etag/dist/effect-platform-Http-Etag.esm.js';
|
|
53
|
+
import './Router-bf32317a.esm.js';
|
|
54
|
+
import 'effect/Inspectable';
|
|
55
|
+
import 'find-my-way';
|
|
56
|
+
import 'path-browserify';
|
|
57
|
+
import 'effect/Cause';
|
|
58
|
+
import 'effect/Exit';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect/platform",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.6",
|
|
4
4
|
"description": "Unified interfaces for common platform-specific services",
|
|
5
5
|
"main": "dist/effect-platform.cjs.js",
|
|
6
6
|
"module": "dist/effect-platform.esm.js",
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
"files": [
|
|
43
43
|
"src",
|
|
44
44
|
"dist",
|
|
45
|
-
"internal",
|
|
46
45
|
"Command",
|
|
47
46
|
"CommandExecutor",
|
|
48
47
|
"Effectify",
|
|
@@ -71,3 +71,13 @@ export const schemaJson: <
|
|
|
71
71
|
schema: Schema.Schema<I, A>
|
|
72
72
|
) => (self: ClientResponse) => Effect.Effect<never, Error.ResponseError | ParseResult.ParseError, A> =
|
|
73
73
|
internal.schemaJson
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @since 1.0.0
|
|
77
|
+
* @category schema
|
|
78
|
+
*/
|
|
79
|
+
export const schemaNoBody: <
|
|
80
|
+
I extends { readonly status?: number; readonly headers?: Headers.Headers },
|
|
81
|
+
A
|
|
82
|
+
>(schema: Schema.Schema<I, A>) => (self: ClientResponse) => Effect.Effect<never, ParseResult.ParseError, A> =
|
|
83
|
+
internal.schemaNoBody
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type * as Schema from "@effect/schema/Schema"
|
|
5
5
|
import type * as Effect from "effect/Effect"
|
|
6
|
-
import type { Pipeable } from "effect/Pipeable"
|
|
7
6
|
import type * as Stream from "effect/Stream"
|
|
8
7
|
import type * as PlatformError from "../Error"
|
|
9
8
|
import type * as FileSystem from "../FileSystem"
|
|
@@ -29,7 +28,7 @@ export type TypeId = typeof TypeId
|
|
|
29
28
|
* @since 1.0.0
|
|
30
29
|
* @category models
|
|
31
30
|
*/
|
|
32
|
-
export interface ServerResponse extends
|
|
31
|
+
export interface ServerResponse extends Effect.Effect<never, never, ServerResponse> {
|
|
33
32
|
readonly [TypeId]: TypeId
|
|
34
33
|
readonly status: number
|
|
35
34
|
readonly statusText?: string
|
|
@@ -149,3 +149,19 @@ export const schemaJson = <
|
|
|
149
149
|
})
|
|
150
150
|
)
|
|
151
151
|
}
|
|
152
|
+
|
|
153
|
+
/** @internal */
|
|
154
|
+
export const schemaNoBody = <
|
|
155
|
+
I extends {
|
|
156
|
+
readonly status?: number
|
|
157
|
+
readonly headers?: Headers.Headers
|
|
158
|
+
},
|
|
159
|
+
A
|
|
160
|
+
>(schema: Schema.Schema<I, A>) => {
|
|
161
|
+
const parse = Schema.parse(schema)
|
|
162
|
+
return (self: ClientResponse.ClientResponse): Effect.Effect<never, ParseResult.ParseError, A> =>
|
|
163
|
+
parse({
|
|
164
|
+
status: self.status,
|
|
165
|
+
headers: self.headers
|
|
166
|
+
})
|
|
167
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as Schema from "@effect/schema/Schema"
|
|
2
2
|
import * as Effect from "effect/Effect"
|
|
3
|
+
import * as Effectable from "effect/Effectable"
|
|
3
4
|
import { dual } from "effect/Function"
|
|
4
|
-
import { pipeArguments } from "effect/Pipeable"
|
|
5
5
|
import type * as Stream from "effect/Stream"
|
|
6
6
|
import type * as PlatformError from "../../Error"
|
|
7
7
|
import type * as FileSystem from "../../FileSystem"
|
|
@@ -15,7 +15,9 @@ import * as internalBody from "./body"
|
|
|
15
15
|
/** @internal */
|
|
16
16
|
export const TypeId: ServerResponse.TypeId = Symbol.for("@effect/platform/Http/ServerResponse") as ServerResponse.TypeId
|
|
17
17
|
|
|
18
|
-
class ServerResponseImpl
|
|
18
|
+
class ServerResponseImpl extends Effectable.Effectable<never, never, ServerResponse.ServerResponse>
|
|
19
|
+
implements ServerResponse.ServerResponse
|
|
20
|
+
{
|
|
19
21
|
readonly [TypeId]: ServerResponse.TypeId
|
|
20
22
|
readonly headers: Headers.Headers
|
|
21
23
|
constructor(
|
|
@@ -24,6 +26,7 @@ class ServerResponseImpl implements ServerResponse.ServerResponse {
|
|
|
24
26
|
headers: Headers.Headers,
|
|
25
27
|
readonly body: Body.Body
|
|
26
28
|
) {
|
|
29
|
+
super()
|
|
27
30
|
this[TypeId] = TypeId
|
|
28
31
|
if (body.contentType || body.contentLength) {
|
|
29
32
|
const newHeaders = { ...headers }
|
|
@@ -38,8 +41,19 @@ class ServerResponseImpl implements ServerResponse.ServerResponse {
|
|
|
38
41
|
this.headers = headers
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
|
|
45
|
+
commit(): Effect.Effect<never, never, ServerResponse.ServerResponse> {
|
|
46
|
+
return Effect.succeed(this)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
toJSON() {
|
|
50
|
+
return {
|
|
51
|
+
_id: "ServerResponse",
|
|
52
|
+
status: this.status,
|
|
53
|
+
statusText: this.statusText,
|
|
54
|
+
headers: this.headers,
|
|
55
|
+
body: this.body
|
|
56
|
+
}
|
|
43
57
|
}
|
|
44
58
|
}
|
|
45
59
|
|
package/internal/command.esm.js
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import * as Chunk from 'effect/Chunk';
|
|
2
|
-
import * as Effect from 'effect/Effect';
|
|
3
|
-
import { dual } from 'effect/Function';
|
|
4
|
-
import * as HashMap from 'effect/HashMap';
|
|
5
|
-
import * as Option from 'effect/Option';
|
|
6
|
-
import { pipeArguments } from 'effect/Pipeable';
|
|
7
|
-
import * as Stream from 'effect/Stream';
|
|
8
|
-
import { CommandExecutor } from './commandExecutor.esm.js';
|
|
9
|
-
|
|
10
|
-
/** @internal */
|
|
11
|
-
const CommandTypeId = /*#__PURE__*/Symbol.for("@effect/platform/Command");
|
|
12
|
-
|
|
13
|
-
/** @internal */
|
|
14
|
-
const isCommand = u => typeof u === "object" && u != null && CommandTypeId in u;
|
|
15
|
-
|
|
16
|
-
/** @internal */
|
|
17
|
-
const env = /*#__PURE__*/dual(2, (self, environment) => {
|
|
18
|
-
switch (self._tag) {
|
|
19
|
-
case "StandardCommand":
|
|
20
|
-
{
|
|
21
|
-
return {
|
|
22
|
-
...self,
|
|
23
|
-
env: HashMap.union(self.env, HashMap.fromIterable(Object.entries(environment)))
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
case "PipedCommand":
|
|
27
|
-
{
|
|
28
|
-
return pipeTo(env(self.left, environment), env(self.right, environment));
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
/** @internal */
|
|
34
|
-
const exitCode = self => Effect.flatMap(CommandExecutor, executor => executor.exitCode(self));
|
|
35
|
-
|
|
36
|
-
/** @internal */
|
|
37
|
-
const feed = /*#__PURE__*/dual(2, (self, input) => stdin(self, Stream.fromChunk(Chunk.of(new TextEncoder().encode(input)))));
|
|
38
|
-
|
|
39
|
-
/** @internal */
|
|
40
|
-
const flatten = self => Array.from(flattenLoop(self));
|
|
41
|
-
|
|
42
|
-
/** @internal */
|
|
43
|
-
const flattenLoop = self => {
|
|
44
|
-
switch (self._tag) {
|
|
45
|
-
case "StandardCommand":
|
|
46
|
-
{
|
|
47
|
-
return Chunk.of(self);
|
|
48
|
-
}
|
|
49
|
-
case "PipedCommand":
|
|
50
|
-
{
|
|
51
|
-
return Chunk.appendAll(flattenLoop(self.left), flattenLoop(self.right));
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
/** @internal */
|
|
57
|
-
const lines = (command, encoding = "utf-8") => Effect.flatMap(CommandExecutor, executor => executor.lines(command, encoding));
|
|
58
|
-
|
|
59
|
-
/** @internal */
|
|
60
|
-
const make = (command, ...args) => ({
|
|
61
|
-
[CommandTypeId]: CommandTypeId,
|
|
62
|
-
_tag: "StandardCommand",
|
|
63
|
-
command,
|
|
64
|
-
args,
|
|
65
|
-
env: HashMap.empty(),
|
|
66
|
-
cwd: Option.none(),
|
|
67
|
-
// The initial process input here does not matter, we just want the child
|
|
68
|
-
// process to default to `"pipe"` for the stdin stream.
|
|
69
|
-
stdin: Option.some(Stream.empty),
|
|
70
|
-
stdout: "pipe",
|
|
71
|
-
stderr: "pipe",
|
|
72
|
-
gid: Option.none(),
|
|
73
|
-
uid: Option.none(),
|
|
74
|
-
pipe() {
|
|
75
|
-
return pipeArguments(this, arguments);
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
/** @internal */
|
|
80
|
-
const pipeTo = /*#__PURE__*/dual(2, (self, into) => ({
|
|
81
|
-
[CommandTypeId]: CommandTypeId,
|
|
82
|
-
_tag: "PipedCommand",
|
|
83
|
-
left: self,
|
|
84
|
-
right: into,
|
|
85
|
-
pipe() {
|
|
86
|
-
return pipeArguments(this, arguments);
|
|
87
|
-
}
|
|
88
|
-
}));
|
|
89
|
-
|
|
90
|
-
/** @internal */
|
|
91
|
-
const stderr = /*#__PURE__*/dual(2, (self, output) => {
|
|
92
|
-
switch (self._tag) {
|
|
93
|
-
case "StandardCommand":
|
|
94
|
-
{
|
|
95
|
-
return {
|
|
96
|
-
...self,
|
|
97
|
-
stderr: output
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
// For piped commands it only makes sense to provide `stderr` for the
|
|
101
|
-
// right-most command as the rest will be piped in.
|
|
102
|
-
case "PipedCommand":
|
|
103
|
-
{
|
|
104
|
-
return {
|
|
105
|
-
...self,
|
|
106
|
-
right: stderr(self.right, output)
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
/** @internal */
|
|
113
|
-
const stdin = /*#__PURE__*/dual(2, (self, input) => {
|
|
114
|
-
switch (self._tag) {
|
|
115
|
-
case "StandardCommand":
|
|
116
|
-
{
|
|
117
|
-
return {
|
|
118
|
-
...self,
|
|
119
|
-
stdin: Option.some(input)
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
// For piped commands it only makes sense to provide `stdin` for the
|
|
123
|
-
// left-most command as the rest will be piped in.
|
|
124
|
-
case "PipedCommand":
|
|
125
|
-
{
|
|
126
|
-
return {
|
|
127
|
-
...self,
|
|
128
|
-
left: stdin(self.left, input)
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
/** @internal */
|
|
135
|
-
const stdout = /*#__PURE__*/dual(2, (self, output) => {
|
|
136
|
-
switch (self._tag) {
|
|
137
|
-
case "StandardCommand":
|
|
138
|
-
{
|
|
139
|
-
return {
|
|
140
|
-
...self,
|
|
141
|
-
stdout: output
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
// For piped commands it only makes sense to provide `stderr` for the
|
|
145
|
-
// right-most command as the rest will be piped in.
|
|
146
|
-
case "PipedCommand":
|
|
147
|
-
{
|
|
148
|
-
return {
|
|
149
|
-
...self,
|
|
150
|
-
right: stdout(self.right, output)
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
/** @internal */
|
|
157
|
-
const start = command => Effect.flatMap(CommandExecutor, executor => executor.start(command));
|
|
158
|
-
|
|
159
|
-
/** @internal */
|
|
160
|
-
const stream = command => Stream.flatMap(CommandExecutor, process => process.stream(command));
|
|
161
|
-
|
|
162
|
-
/** @internal */
|
|
163
|
-
const streamLines = command => Stream.flatMap(CommandExecutor, process => process.streamLines(command));
|
|
164
|
-
|
|
165
|
-
/** @internal */
|
|
166
|
-
const string = /*#__PURE__*/dual(args => isCommand(args[0]), (command, encoding) => Effect.flatMap(CommandExecutor, executor => executor.string(command, encoding)));
|
|
167
|
-
|
|
168
|
-
/** @internal */
|
|
169
|
-
const workingDirectory = /*#__PURE__*/dual(2, (self, cwd) => {
|
|
170
|
-
switch (self._tag) {
|
|
171
|
-
case "StandardCommand":
|
|
172
|
-
{
|
|
173
|
-
return {
|
|
174
|
-
...self,
|
|
175
|
-
cwd: Option.some(cwd)
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
case "PipedCommand":
|
|
179
|
-
{
|
|
180
|
-
return pipeTo(workingDirectory(self.left, cwd), workingDirectory(self.right, cwd));
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
export { CommandTypeId, env, exitCode, feed, flatten, isCommand, lines, make, pipeTo, start, stderr, stdin, stdout, stream, streamLines, string, workingDirectory };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as Effect from 'effect/Effect';
|
|
2
|
-
|
|
3
|
-
/** @internal */
|
|
4
|
-
const effectify = (fn, onError, onSyncError) => (...args) => Effect.async(resume => {
|
|
5
|
-
try {
|
|
6
|
-
fn(...args, (err, result) => {
|
|
7
|
-
if (err) {
|
|
8
|
-
resume(Effect.fail(onError ? onError(err, args) : err));
|
|
9
|
-
} else {
|
|
10
|
-
resume(Effect.succeed(result));
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
} catch (err) {
|
|
14
|
-
resume(onSyncError ? Effect.fail(onSyncError(err, args)) : Effect.die(err));
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export { effectify };
|
package/internal/error.esm.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as Data from 'effect/Data';
|
|
2
|
-
|
|
3
|
-
/** @internal */
|
|
4
|
-
const PlatformErrorTypeId = /*#__PURE__*/Symbol.for("@effect/platform/Error/PlatformErrorTypeId");
|
|
5
|
-
const make = tag => props => Data.struct({
|
|
6
|
-
[PlatformErrorTypeId]: PlatformErrorTypeId,
|
|
7
|
-
_tag: tag,
|
|
8
|
-
...props
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
/** @internal */
|
|
12
|
-
const badArgument = /*#__PURE__*/make("BadArgument");
|
|
13
|
-
|
|
14
|
-
/** @internal */
|
|
15
|
-
const systemError = /*#__PURE__*/make("SystemError");
|
|
16
|
-
|
|
17
|
-
export { PlatformErrorTypeId, badArgument, systemError };
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { Tag } from 'effect/Context';
|
|
2
|
-
import * as Effect from 'effect/Effect';
|
|
3
|
-
import { pipe, identity } from 'effect/Function';
|
|
4
|
-
import * as Option from 'effect/Option';
|
|
5
|
-
import * as Sink from 'effect/Sink';
|
|
6
|
-
import * as Stream from 'effect/Stream';
|
|
7
|
-
import { BadArgument } from '../Error/dist/effect-platform-Error.esm.js';
|
|
8
|
-
|
|
9
|
-
/** @internal */
|
|
10
|
-
const tag = /*#__PURE__*/Tag("@effect/platform/FileSystem");
|
|
11
|
-
|
|
12
|
-
/** @internal */
|
|
13
|
-
const Size = bytes => typeof bytes === "bigint" ? bytes : BigInt(bytes);
|
|
14
|
-
|
|
15
|
-
/** @internal */
|
|
16
|
-
const KiB = n => Size(n * 1024);
|
|
17
|
-
|
|
18
|
-
/** @internal */
|
|
19
|
-
const MiB = n => Size(n * 1024 * 1024);
|
|
20
|
-
|
|
21
|
-
/** @internal */
|
|
22
|
-
const GiB = n => Size(n * 1024 * 1024 * 1024);
|
|
23
|
-
|
|
24
|
-
/** @internal */
|
|
25
|
-
const TiB = n => Size(n * 1024 * 1024 * 1024 * 1024);
|
|
26
|
-
const bigint1024 = /*#__PURE__*/BigInt(1024);
|
|
27
|
-
const bigintPiB = bigint1024 * bigint1024 * bigint1024 * bigint1024 * bigint1024;
|
|
28
|
-
|
|
29
|
-
/** @internal */
|
|
30
|
-
const PiB = n => Size(BigInt(n) * bigintPiB);
|
|
31
|
-
|
|
32
|
-
/** @internal */
|
|
33
|
-
const make = impl => {
|
|
34
|
-
return tag.of({
|
|
35
|
-
...impl,
|
|
36
|
-
exists: path => pipe(impl.access(path), Effect.as(true), Effect.catchTag("SystemError", e => e.reason === "NotFound" ? Effect.succeed(false) : Effect.fail(e))),
|
|
37
|
-
readFileString: (path, encoding) => Effect.tryMap(impl.readFile(path), {
|
|
38
|
-
try: _ => new TextDecoder(encoding).decode(_),
|
|
39
|
-
catch: () => BadArgument({
|
|
40
|
-
module: "FileSystem",
|
|
41
|
-
method: "readFileString",
|
|
42
|
-
message: "invalid encoding"
|
|
43
|
-
})
|
|
44
|
-
}),
|
|
45
|
-
stream: (path, options) => pipe(impl.open(path, {
|
|
46
|
-
flag: "r"
|
|
47
|
-
}), options?.offset ? Effect.tap(file => file.seek(options.offset, "start")) : identity, Effect.map(file => stream(file, options)), Stream.unwrapScoped),
|
|
48
|
-
sink: (path, options) => pipe(impl.open(path, {
|
|
49
|
-
flag: "w",
|
|
50
|
-
...options
|
|
51
|
-
}), Effect.map(file => Sink.forEach(_ => file.writeAll(_))), Sink.unwrapScoped),
|
|
52
|
-
writeFileString: (path, data, options) => Effect.flatMap(Effect.try({
|
|
53
|
-
try: () => new TextEncoder().encode(data),
|
|
54
|
-
catch: () => BadArgument({
|
|
55
|
-
module: "FileSystem",
|
|
56
|
-
method: "writeFileString",
|
|
57
|
-
message: "could not encode string"
|
|
58
|
-
})
|
|
59
|
-
}), _ => impl.writeFile(path, _, options))
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
/** @internal */
|
|
64
|
-
const stream = (file, {
|
|
65
|
-
bufferSize = 4,
|
|
66
|
-
bytesToRead: bytesToRead_,
|
|
67
|
-
chunkSize: chunkSize_ = Size(64 * 1024)
|
|
68
|
-
} = {}) => {
|
|
69
|
-
const bytesToRead = bytesToRead_ !== undefined ? Size(bytesToRead_) : undefined;
|
|
70
|
-
const chunkSize = Size(chunkSize_);
|
|
71
|
-
return Stream.bufferChunks(Stream.unfoldEffect(BigInt(0), totalBytesRead => {
|
|
72
|
-
if (bytesToRead !== undefined && bytesToRead <= totalBytesRead) {
|
|
73
|
-
return Effect.succeed(Option.none());
|
|
74
|
-
}
|
|
75
|
-
const toRead = bytesToRead !== undefined && bytesToRead - totalBytesRead < chunkSize ? bytesToRead - totalBytesRead : chunkSize;
|
|
76
|
-
return Effect.map(file.readAlloc(toRead), Option.map(buf => [buf, Size(totalBytesRead + BigInt(buf.length))]));
|
|
77
|
-
}), {
|
|
78
|
-
capacity: bufferSize
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export { GiB, KiB, MiB, PiB, Size, TiB, make, tag };
|