@effect/platform-node 0.19.3 → 0.19.5
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-node-Command.esm.js +0 -4
- package/CommandExecutor/dist/effect-platform-node-CommandExecutor.esm.js +14 -13
- package/Effectify/dist/effect-platform-node-Effectify.esm.js +0 -4
- package/Error/dist/effect-platform-node-Error.esm.js +0 -4
- package/FileSystem/dist/effect-platform-node-FileSystem.esm.js +12 -13
- package/Http/Etag/dist/effect-platform-node-Http-Etag.esm.js +4 -0
- package/Http/FormData/dist/effect-platform-node-Http-FormData.esm.js +16 -0
- package/Http/NodeClient/dist/effect-platform-node-Http-NodeClient.esm.js +24 -0
- package/Http/Platform/dist/effect-platform-node-Http-Platform.esm.js +40 -0
- package/Http/Server/dist/effect-platform-node-Http-Server.esm.js +45 -0
- package/HttpClient/dist/effect-platform-node-HttpClient.esm.js +19 -6
- package/HttpServer/dist/effect-platform-node-HttpServer.esm.js +40 -10
- package/KeyValueStore/dist/effect-platform-node-KeyValueStore.esm.js +17 -18
- package/NodeContext/dist/effect-platform-node-NodeContext.esm.js +25 -22
- package/Path/dist/effect-platform-node-Path.esm.js +6 -25
- package/Runtime/dist/effect-platform-node-Runtime.esm.js +3 -13
- package/Sink/dist/effect-platform-node-Sink.esm.js +5 -18
- package/Stream/dist/effect-platform-node-Stream.esm.js +6 -30
- package/dist/Command-56d67f13.esm.js +27 -0
- package/{internal/commandExecutor.esm.js → dist/CommandExecutor-cfc0af4b.esm.js} +27 -10
- package/dist/Effectify-24bba5b0.esm.js +12 -0
- package/dist/Error-6b032e84.esm.js +16 -0
- package/dist/Etag-6f08d5ed.esm.js +86 -0
- package/{internal/fileSystem.esm.js → dist/FileSystem-d4a3521c.esm.js} +30 -12
- package/dist/FormData-bafc0b9a.esm.js +43 -0
- package/dist/HttpClient-3e1bd3e7.esm.js +26 -0
- package/dist/HttpServer-331621bd.esm.js +34 -0
- package/dist/KeyValueStore-66bca5fd.esm.js +38 -0
- package/{internal/http/nodeClient.esm.js → dist/NodeClient-4070cde3.esm.js} +86 -12
- package/dist/NodeContext-4bca6ed4.esm.js +27 -0
- package/{internal/path.esm.js → dist/Path-7a81561f.esm.js} +35 -5
- package/{internal/runtime.esm.js → dist/Runtime-3bc7ee1e.esm.js} +18 -2
- package/{internal/http/server.esm.js → dist/Server-3a9f4a90.esm.js} +56 -10
- package/dist/Sink-554d2819.esm.js +23 -0
- package/dist/Stream-2d5b1ece.esm.js +37 -0
- package/dist/effect-platform-node.esm.js +73 -26
- package/{internal/error.esm.js → dist/error-4865cb95.esm.js} +1 -1
- package/{internal/http/formData.esm.js → dist/formData-4330f230.esm.js} +2 -2
- package/{internal/http/incomingMessage.esm.js → dist/incomingMessage-309eb6a5.esm.js} +2 -2
- package/{internal/http/platform.esm.js → dist/platform-f3d31bb1.esm.js} +3 -3
- package/{internal/sink.esm.js → dist/sink-bd7ef408.esm.js} +1 -1
- package/{internal/stream.esm.js → dist/stream-860139d3.esm.js} +1 -1
- package/package.json +2 -3
- package/Http/Http/Etag/dist/effect-platform-node-Http-Etag.esm.js +0 -23
- package/Http/Http/FormData/dist/effect-platform-node-Http-FormData.esm.js +0 -23
- package/Http/Http/NodeClient/dist/effect-platform-node-Http-NodeClient.esm.js +0 -65
- package/Http/Http/Platform/dist/effect-platform-node-Http-Platform.esm.js +0 -22
- package/Http/Http/Server/dist/effect-platform-node-Http-Server.esm.js +0 -29
- package/internal/http/etag.esm.js +0 -47
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import * as Etag$1 from '@effect/platform/Http/Etag';
|
|
2
|
+
import * as Effect from 'effect/Effect';
|
|
3
|
+
import * as Layer from 'effect/Layer';
|
|
4
|
+
|
|
5
|
+
function _mergeNamespaces(n, m) {
|
|
6
|
+
m.forEach(function (e) {
|
|
7
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
8
|
+
if (k !== 'default' && !(k in n)) {
|
|
9
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
10
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () { return e[k]; }
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
return Object.freeze(n);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const fromFileInfo = info => {
|
|
21
|
+
const mtime = info.mtime._tag === "Some" ? info.mtime.value.getTime().toString(16) : "0";
|
|
22
|
+
return `${info.size.toString(16)}-${mtime}`;
|
|
23
|
+
};
|
|
24
|
+
const fromFileWeb = file => {
|
|
25
|
+
return `${file.size.toString(16)}-${file.lastModified.toString(16)}`;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** @internal */
|
|
29
|
+
const layer$1 = /*#__PURE__*/Layer.succeed(Etag$1.Generator, /*#__PURE__*/Etag$1.Generator.of({
|
|
30
|
+
[Etag$1.GeneratorTypeId]: Etag$1.GeneratorTypeId,
|
|
31
|
+
fromFileInfo(info) {
|
|
32
|
+
return Effect.sync(() => ({
|
|
33
|
+
_tag: "Strong",
|
|
34
|
+
value: fromFileInfo(info)
|
|
35
|
+
}));
|
|
36
|
+
},
|
|
37
|
+
fromFileWeb(file) {
|
|
38
|
+
return Effect.sync(() => ({
|
|
39
|
+
_tag: "Strong",
|
|
40
|
+
value: fromFileWeb(file)
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
}));
|
|
44
|
+
|
|
45
|
+
/** @internal */
|
|
46
|
+
const layerWeak$1 = /*#__PURE__*/Layer.succeed(Etag$1.Generator, /*#__PURE__*/Etag$1.Generator.of({
|
|
47
|
+
[Etag$1.GeneratorTypeId]: Etag$1.GeneratorTypeId,
|
|
48
|
+
fromFileInfo(info) {
|
|
49
|
+
return Effect.sync(() => ({
|
|
50
|
+
_tag: "Weak",
|
|
51
|
+
value: fromFileInfo(info)
|
|
52
|
+
}));
|
|
53
|
+
},
|
|
54
|
+
fromFileWeb(file) {
|
|
55
|
+
return Effect.sync(() => ({
|
|
56
|
+
_tag: "Weak",
|
|
57
|
+
value: fromFileWeb(file)
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
}));
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @since 1.0.0
|
|
64
|
+
*
|
|
65
|
+
* Also includes exports from [`@effect/platform/Http/Etag`](https://effect-ts.github.io/platform/platform/Http/Etag.ts.html).
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @since 1.0.0
|
|
70
|
+
* @category layers
|
|
71
|
+
*/
|
|
72
|
+
const layer = layer$1;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @since 1.0.0
|
|
76
|
+
* @category layers
|
|
77
|
+
*/
|
|
78
|
+
const layerWeak = layerWeak$1;
|
|
79
|
+
|
|
80
|
+
var Etag = /*#__PURE__*/_mergeNamespaces({
|
|
81
|
+
__proto__: null,
|
|
82
|
+
layer: layer,
|
|
83
|
+
layerWeak: layerWeak
|
|
84
|
+
}, [Etag$1]);
|
|
85
|
+
|
|
86
|
+
export { Etag as E, layerWeak as a, layer as l };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { effectify } from '@effect/platform/Effectify';
|
|
2
2
|
import * as Error from '@effect/platform/Error';
|
|
3
|
-
import * as FileSystem from '@effect/platform/FileSystem';
|
|
3
|
+
import * as FileSystem$1 from '@effect/platform/FileSystem';
|
|
4
|
+
import { FileSystem as FileSystem$2, Size } from '@effect/platform/FileSystem';
|
|
4
5
|
import * as Effect from 'effect/Effect';
|
|
5
6
|
import { pipe } from 'effect/Function';
|
|
6
7
|
import * as Layer from 'effect/Layer';
|
|
@@ -9,7 +10,7 @@ import * as Crypto from 'node:crypto';
|
|
|
9
10
|
import * as NFS from 'node:fs';
|
|
10
11
|
import * as OS from 'node:os';
|
|
11
12
|
import * as NodePath from 'node:path';
|
|
12
|
-
import { handleErrnoException } from './error.esm.js';
|
|
13
|
+
import { h as handleErrnoException } from './error-4865cb95.esm.js';
|
|
13
14
|
|
|
14
15
|
const handleBadArgument = method => err => Error.BadArgument({
|
|
15
16
|
module: "FileSystem",
|
|
@@ -119,7 +120,7 @@ const makeTempDirectoryScoped = /*#__PURE__*/(() => {
|
|
|
119
120
|
const openFactory = method => {
|
|
120
121
|
const nodeOpen = effectify(NFS.open, handleErrnoException("FileSystem", method), handleBadArgument(method));
|
|
121
122
|
const nodeClose = effectify(NFS.close, handleErrnoException("FileSystem", method), handleBadArgument(method));
|
|
122
|
-
return (path, options) => pipe(Effect.acquireRelease(nodeOpen(path, options?.flag ?? "r", options?.mode), fd => Effect.orDie(nodeClose(fd))), Effect.map(fd => makeFile(FileSystem.FileDescriptor(fd), options?.flag?.startsWith("a") ?? false)));
|
|
123
|
+
return (path, options) => pipe(Effect.acquireRelease(nodeOpen(path, options?.flag ?? "r", options?.mode), fd => Effect.orDie(nodeClose(fd))), Effect.map(fd => makeFile(FileSystem$1.FileDescriptor(fd), options?.flag?.startsWith("a") ?? false)));
|
|
123
124
|
};
|
|
124
125
|
const open = /*#__PURE__*/openFactory("open");
|
|
125
126
|
const makeFile = /*#__PURE__*/(() => {
|
|
@@ -137,13 +138,13 @@ const makeFile = /*#__PURE__*/(() => {
|
|
|
137
138
|
constructor(fd, append) {
|
|
138
139
|
this.fd = fd;
|
|
139
140
|
this.append = append;
|
|
140
|
-
this[FileSystem.FileTypeId] = FileSystem.FileTypeId;
|
|
141
|
+
this[FileSystem$1.FileTypeId] = FileSystem$1.FileTypeId;
|
|
141
142
|
}
|
|
142
143
|
get stat() {
|
|
143
144
|
return Effect.map(nodeStat(this.fd), makeFileInfo);
|
|
144
145
|
}
|
|
145
146
|
seek(offset, from) {
|
|
146
|
-
const offsetSize = FileSystem.Size(offset);
|
|
147
|
+
const offsetSize = FileSystem$1.Size(offset);
|
|
147
148
|
return this.semaphore.withPermits(1)(Effect.sync(() => {
|
|
148
149
|
if (from === "start") {
|
|
149
150
|
this.position = offsetSize;
|
|
@@ -158,7 +159,7 @@ const makeFile = /*#__PURE__*/(() => {
|
|
|
158
159
|
buffer,
|
|
159
160
|
position: this.position
|
|
160
161
|
})), bytesRead => {
|
|
161
|
-
const sizeRead = FileSystem.Size(bytesRead);
|
|
162
|
+
const sizeRead = FileSystem$1.Size(bytesRead);
|
|
162
163
|
this.position = this.position + sizeRead;
|
|
163
164
|
return sizeRead;
|
|
164
165
|
}));
|
|
@@ -193,7 +194,7 @@ const makeFile = /*#__PURE__*/(() => {
|
|
|
193
194
|
}
|
|
194
195
|
write(buffer) {
|
|
195
196
|
return this.semaphore.withPermits(1)(Effect.map(Effect.suspend(() => nodeWrite(this.fd, buffer, undefined, undefined, this.append ? undefined : Number(this.position))), bytesWritten => {
|
|
196
|
-
const sizeWritten = FileSystem.Size(bytesWritten);
|
|
197
|
+
const sizeWritten = FileSystem$1.Size(bytesWritten);
|
|
197
198
|
if (!this.append) {
|
|
198
199
|
this.position = this.position + sizeWritten;
|
|
199
200
|
}
|
|
@@ -304,8 +305,8 @@ const makeFileInfo = stat => ({
|
|
|
304
305
|
nlink: Option.fromNullable(stat.nlink),
|
|
305
306
|
uid: Option.fromNullable(stat.uid),
|
|
306
307
|
gid: Option.fromNullable(stat.gid),
|
|
307
|
-
size: FileSystem.Size(stat.size),
|
|
308
|
-
blksize: Option.fromNullable(FileSystem.Size(stat.blksize)),
|
|
308
|
+
size: FileSystem$1.Size(stat.size),
|
|
309
|
+
blksize: Option.fromNullable(FileSystem$1.Size(stat.blksize)),
|
|
309
310
|
blocks: Option.fromNullable(stat.blocks)
|
|
310
311
|
});
|
|
311
312
|
const stat = /*#__PURE__*/(() => {
|
|
@@ -353,7 +354,7 @@ const writeFile = (path, data, options) => Effect.async((resume, signal) => {
|
|
|
353
354
|
resume(Effect.fail(handleBadArgument("writeFile")(err)));
|
|
354
355
|
}
|
|
355
356
|
});
|
|
356
|
-
const fileSystemImpl = /*#__PURE__*/FileSystem.make({
|
|
357
|
+
const fileSystemImpl = /*#__PURE__*/FileSystem$1.make({
|
|
357
358
|
access,
|
|
358
359
|
chmod,
|
|
359
360
|
chown,
|
|
@@ -380,6 +381,23 @@ const fileSystemImpl = /*#__PURE__*/FileSystem.make({
|
|
|
380
381
|
});
|
|
381
382
|
|
|
382
383
|
/** @internal */
|
|
383
|
-
const layer = /*#__PURE__*/Layer.succeed(FileSystem.FileSystem, fileSystemImpl);
|
|
384
|
+
const layer$1 = /*#__PURE__*/Layer.succeed(FileSystem$1.FileSystem, fileSystemImpl);
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* @since 1.0.0
|
|
388
|
+
*/
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* @since 1.0.0
|
|
392
|
+
* @category layer
|
|
393
|
+
*/
|
|
394
|
+
const layer = layer$1;
|
|
395
|
+
|
|
396
|
+
var FileSystem = /*#__PURE__*/Object.freeze({
|
|
397
|
+
__proto__: null,
|
|
398
|
+
layer: layer,
|
|
399
|
+
FileSystem: FileSystem$2,
|
|
400
|
+
Size: Size
|
|
401
|
+
});
|
|
384
402
|
|
|
385
|
-
export { layer };
|
|
403
|
+
export { FileSystem as F, layer as l };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { s as stream$1, f as formData$1 } from './formData-4330f230.esm.js';
|
|
2
|
+
import * as FormData$1 from '@effect/platform/Http/FormData';
|
|
3
|
+
|
|
4
|
+
function _mergeNamespaces(n, m) {
|
|
5
|
+
m.forEach(function (e) {
|
|
6
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
7
|
+
if (k !== 'default' && !(k in n)) {
|
|
8
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
9
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return e[k]; }
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
return Object.freeze(n);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @since 1.0.0
|
|
21
|
+
*
|
|
22
|
+
* Also includes exports from [`@effect/platform/Http/FormData`](https://effect-ts.github.io/platform/platform/Http/FormData.ts.html).
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @since 1.0.0
|
|
27
|
+
* @category constructors
|
|
28
|
+
*/
|
|
29
|
+
const stream = stream$1;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @since 1.0.0
|
|
33
|
+
* @category constructors
|
|
34
|
+
*/
|
|
35
|
+
const formData = formData$1;
|
|
36
|
+
|
|
37
|
+
var FormData = /*#__PURE__*/_mergeNamespaces({
|
|
38
|
+
__proto__: null,
|
|
39
|
+
stream: stream,
|
|
40
|
+
formData: formData
|
|
41
|
+
}, [FormData$1]);
|
|
42
|
+
|
|
43
|
+
export { FormData as F, formData as f, stream as s };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as Body from '@effect/platform/Http/Body';
|
|
2
|
+
import * as Client from '@effect/platform/Http/Client';
|
|
3
|
+
import * as Error from '@effect/platform/Http/ClientError';
|
|
4
|
+
import * as ClientRequest from '@effect/platform/Http/ClientRequest';
|
|
5
|
+
import * as ClientResponse from '@effect/platform/Http/ClientResponse';
|
|
6
|
+
import * as Headers from '@effect/platform/Http/Headers';
|
|
7
|
+
import * as UrlParams from '@effect/platform/Http/UrlParams';
|
|
8
|
+
import { N as NodeClient } from './NodeClient-4070cde3.esm.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @since 1.0.0
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
var HttpClient = /*#__PURE__*/Object.freeze({
|
|
15
|
+
__proto__: null,
|
|
16
|
+
body: Body,
|
|
17
|
+
client: Client,
|
|
18
|
+
error: Error,
|
|
19
|
+
headers: Headers,
|
|
20
|
+
nodeClient: NodeClient,
|
|
21
|
+
request: ClientRequest,
|
|
22
|
+
response: ClientResponse,
|
|
23
|
+
urlParams: UrlParams
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export { HttpClient as H };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as App from '@effect/platform/Http/App';
|
|
2
|
+
import * as Body from '@effect/platform/Http/Body';
|
|
3
|
+
import * as Headers from '@effect/platform/Http/Headers';
|
|
4
|
+
import * as Middleware from '@effect/platform/Http/Middleware';
|
|
5
|
+
import * as Router from '@effect/platform/Http/Router';
|
|
6
|
+
import * as Error from '@effect/platform/Http/ServerError';
|
|
7
|
+
import * as ServerRequest from '@effect/platform/Http/ServerRequest';
|
|
8
|
+
import * as ServerResponse from '@effect/platform/Http/ServerResponse';
|
|
9
|
+
import * as UrlParams from '@effect/platform/Http/UrlParams';
|
|
10
|
+
import { E as Etag } from './Etag-6f08d5ed.esm.js';
|
|
11
|
+
import { F as FormData } from './FormData-bafc0b9a.esm.js';
|
|
12
|
+
import { S as Server } from './Server-3a9f4a90.esm.js';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @since 1.0.0
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
var HttpServer = /*#__PURE__*/Object.freeze({
|
|
19
|
+
__proto__: null,
|
|
20
|
+
app: App,
|
|
21
|
+
body: Body,
|
|
22
|
+
error: Error,
|
|
23
|
+
etag: Etag,
|
|
24
|
+
formData: FormData,
|
|
25
|
+
headers: Headers,
|
|
26
|
+
middleware: Middleware,
|
|
27
|
+
request: ServerRequest,
|
|
28
|
+
response: ServerResponse,
|
|
29
|
+
router: Router,
|
|
30
|
+
server: Server,
|
|
31
|
+
urlParams: UrlParams
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export { HttpServer as H };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as KeyValueStore$1 from '@effect/platform/KeyValueStore';
|
|
2
|
+
import * as Layer from 'effect/Layer';
|
|
3
|
+
import { l as layer } from './FileSystem-d4a3521c.esm.js';
|
|
4
|
+
import { l as layer$1 } from './Path-7a81561f.esm.js';
|
|
5
|
+
|
|
6
|
+
function _mergeNamespaces(n, m) {
|
|
7
|
+
m.forEach(function (e) {
|
|
8
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
9
|
+
if (k !== 'default' && !(k in n)) {
|
|
10
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return e[k]; }
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
return Object.freeze(n);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @since 1.0.0
|
|
23
|
+
*
|
|
24
|
+
* Also includes exports from [`@effect/platform/KeyValueStore`](https://effect-ts.github.io/platform/platform/KeyValueStore.ts.html).
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @since 1.0.0
|
|
29
|
+
* @category layers
|
|
30
|
+
*/
|
|
31
|
+
const layerFileSystem = directory => Layer.provide(Layer.merge(layer, layer$1), KeyValueStore$1.layerFileSystem(directory));
|
|
32
|
+
|
|
33
|
+
var KeyValueStore = /*#__PURE__*/_mergeNamespaces({
|
|
34
|
+
__proto__: null,
|
|
35
|
+
layerFileSystem: layerFileSystem
|
|
36
|
+
}, [KeyValueStore$1]);
|
|
37
|
+
|
|
38
|
+
export { KeyValueStore as K, layerFileSystem as l };
|
|
@@ -11,27 +11,27 @@ import * as Http from 'node:http';
|
|
|
11
11
|
import * as Https from 'node:https';
|
|
12
12
|
import { Readable } from 'node:stream';
|
|
13
13
|
import { pipeline } from 'node:stream/promises';
|
|
14
|
-
import { fromWritable } from '
|
|
15
|
-
import { IncomingMessageImpl } from './incomingMessage.esm.js';
|
|
14
|
+
import { f as fromWritable } from './Sink-554d2819.esm.js';
|
|
15
|
+
import { I as IncomingMessageImpl } from './incomingMessage-309eb6a5.esm.js';
|
|
16
16
|
|
|
17
17
|
/** @internal */
|
|
18
|
-
const HttpAgentTypeId = /*#__PURE__*/Symbol.for("@effect/platform-node/Http/NodeClient/HttpAgent");
|
|
18
|
+
const HttpAgentTypeId$1 = /*#__PURE__*/Symbol.for("@effect/platform-node/Http/NodeClient/HttpAgent");
|
|
19
19
|
|
|
20
20
|
/** @internal */
|
|
21
|
-
const HttpAgent = /*#__PURE__*/Context.Tag(HttpAgentTypeId);
|
|
21
|
+
const HttpAgent$1 = /*#__PURE__*/Context.Tag(HttpAgentTypeId$1);
|
|
22
22
|
|
|
23
23
|
/** @internal */
|
|
24
|
-
const makeAgent = options => Effect.map(Effect.all([Effect.acquireRelease(Effect.sync(() => new Http.Agent(options)), agent => Effect.sync(() => agent.destroy())), Effect.acquireRelease(Effect.sync(() => new Https.Agent(options)), agent => Effect.sync(() => agent.destroy()))]), ([http, https]) => ({
|
|
25
|
-
[HttpAgentTypeId]: HttpAgentTypeId,
|
|
24
|
+
const makeAgent$1 = options => Effect.map(Effect.all([Effect.acquireRelease(Effect.sync(() => new Http.Agent(options)), agent => Effect.sync(() => agent.destroy())), Effect.acquireRelease(Effect.sync(() => new Https.Agent(options)), agent => Effect.sync(() => agent.destroy()))]), ([http, https]) => ({
|
|
25
|
+
[HttpAgentTypeId$1]: HttpAgentTypeId$1,
|
|
26
26
|
http,
|
|
27
27
|
https
|
|
28
28
|
}));
|
|
29
29
|
|
|
30
30
|
/** @internal */
|
|
31
|
-
const makeAgentLayer = options => Layer.scoped(HttpAgent, makeAgent(options));
|
|
31
|
+
const makeAgentLayer$1 = options => Layer.scoped(HttpAgent$1, makeAgent$1(options));
|
|
32
32
|
|
|
33
33
|
/** @internal */
|
|
34
|
-
const agentLayer = /*#__PURE__*/makeAgentLayer();
|
|
34
|
+
const agentLayer$1 = /*#__PURE__*/makeAgentLayer$1();
|
|
35
35
|
const fromAgent = agent => Client.make(request => Effect.flatMap(UrlParams.makeUrl(request.url, request.urlParams, _ => Error.RequestError({
|
|
36
36
|
request,
|
|
37
37
|
reason: "InvalidUrl",
|
|
@@ -156,12 +156,86 @@ class ClientResponseImpl extends IncomingMessageImpl {
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
/** @internal */
|
|
159
|
-
const make = /*#__PURE__*/Effect.map(HttpAgent, fromAgent);
|
|
159
|
+
const make$1 = /*#__PURE__*/Effect.map(HttpAgent$1, fromAgent);
|
|
160
160
|
|
|
161
161
|
/** @internal */
|
|
162
|
-
const layerWithoutAgent = /*#__PURE__*/Layer.effect(Client.Client, make);
|
|
162
|
+
const layerWithoutAgent$1 = /*#__PURE__*/Layer.effect(Client.Client, make$1);
|
|
163
163
|
|
|
164
164
|
/** @internal */
|
|
165
|
-
const layer = /*#__PURE__*/Layer.provide(agentLayer, layerWithoutAgent);
|
|
165
|
+
const layer$1 = /*#__PURE__*/Layer.provide(agentLayer$1, layerWithoutAgent$1);
|
|
166
166
|
|
|
167
|
-
|
|
167
|
+
/**
|
|
168
|
+
* @since 1.0.0
|
|
169
|
+
*/
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* @since 1.0.0
|
|
173
|
+
* @category agent
|
|
174
|
+
*/
|
|
175
|
+
const HttpAgentTypeId = HttpAgentTypeId$1;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* @since 1.0.0
|
|
179
|
+
* @category agent
|
|
180
|
+
*/
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* @since 1.0.0
|
|
184
|
+
* @category agent
|
|
185
|
+
*/
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @since 1.0.0
|
|
189
|
+
* @category agent
|
|
190
|
+
*/
|
|
191
|
+
const HttpAgent = HttpAgent$1;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* @since 1.0.0
|
|
195
|
+
* @category agent
|
|
196
|
+
*/
|
|
197
|
+
const makeAgent = makeAgent$1;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* @since 1.0.0
|
|
201
|
+
* @category agent
|
|
202
|
+
*/
|
|
203
|
+
const agentLayer = agentLayer$1;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* @since 1.0.0
|
|
207
|
+
* @category agent
|
|
208
|
+
*/
|
|
209
|
+
const makeAgentLayer = makeAgentLayer$1;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* @since 1.0.0
|
|
213
|
+
* @category constructors
|
|
214
|
+
*/
|
|
215
|
+
const make = make$1;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* @since 1.0.0
|
|
219
|
+
* @category layers
|
|
220
|
+
*/
|
|
221
|
+
const layer = layer$1;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* @since 1.0.0
|
|
225
|
+
* @category layers
|
|
226
|
+
*/
|
|
227
|
+
const layerWithoutAgent = layerWithoutAgent$1;
|
|
228
|
+
|
|
229
|
+
var NodeClient = /*#__PURE__*/Object.freeze({
|
|
230
|
+
__proto__: null,
|
|
231
|
+
HttpAgentTypeId: HttpAgentTypeId,
|
|
232
|
+
HttpAgent: HttpAgent,
|
|
233
|
+
makeAgent: makeAgent,
|
|
234
|
+
agentLayer: agentLayer,
|
|
235
|
+
makeAgentLayer: makeAgentLayer,
|
|
236
|
+
make: make,
|
|
237
|
+
layer: layer,
|
|
238
|
+
layerWithoutAgent: layerWithoutAgent
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
export { HttpAgentTypeId as H, NodeClient as N, HttpAgent as a, agentLayer as b, makeAgentLayer as c, make as d, layerWithoutAgent as e, layer as l, makeAgent as m };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { pipe } from 'effect/Function';
|
|
2
|
+
import * as Layer from 'effect/Layer';
|
|
3
|
+
import { l as layer$3 } from './CommandExecutor-cfc0af4b.esm.js';
|
|
4
|
+
import { l as layer$1 } from './FileSystem-d4a3521c.esm.js';
|
|
5
|
+
import { l as layer$2 } from './Path-7a81561f.esm.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @since 1.0.0
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @since 1.0.0
|
|
13
|
+
* @category models
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @since 1.0.0
|
|
18
|
+
* @category layer
|
|
19
|
+
*/
|
|
20
|
+
const layer = /*#__PURE__*/pipe(layer$1, /*#__PURE__*/Layer.merge(layer$2), /*#__PURE__*/Layer.merge( /*#__PURE__*/Layer.provideMerge(layer$1, layer$3)));
|
|
21
|
+
|
|
22
|
+
var NodeContext = /*#__PURE__*/Object.freeze({
|
|
23
|
+
__proto__: null,
|
|
24
|
+
layer: layer
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export { NodeContext as N, layer as l };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BadArgument } from '@effect/platform/Error';
|
|
2
|
-
import { Path } from '@effect/platform/Path';
|
|
2
|
+
import { Path as Path$1 } from '@effect/platform/Path';
|
|
3
3
|
import * as Effect from 'effect/Effect';
|
|
4
4
|
import * as Layer from 'effect/Layer';
|
|
5
5
|
import * as NodePath from 'node:path';
|
|
@@ -23,24 +23,54 @@ const toFileUrl = path => Effect.try({
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
/** @internal */
|
|
26
|
-
const layerPosix = /*#__PURE__*/Layer.succeed(Path, /*#__PURE__*/Path.of({
|
|
26
|
+
const layerPosix$1 = /*#__PURE__*/Layer.succeed(Path$1, /*#__PURE__*/Path$1.of({
|
|
27
27
|
...NodePath.posix,
|
|
28
28
|
fromFileUrl,
|
|
29
29
|
toFileUrl
|
|
30
30
|
}));
|
|
31
31
|
|
|
32
32
|
/** @internal */
|
|
33
|
-
const layerWin32 = /*#__PURE__*/Layer.succeed(Path, /*#__PURE__*/Path.of({
|
|
33
|
+
const layerWin32$1 = /*#__PURE__*/Layer.succeed(Path$1, /*#__PURE__*/Path$1.of({
|
|
34
34
|
...NodePath.win32,
|
|
35
35
|
fromFileUrl,
|
|
36
36
|
toFileUrl
|
|
37
37
|
}));
|
|
38
38
|
|
|
39
39
|
/** @internal */
|
|
40
|
-
const layer = /*#__PURE__*/Layer.succeed(Path, /*#__PURE__*/Path.of({
|
|
40
|
+
const layer$1 = /*#__PURE__*/Layer.succeed(Path$1, /*#__PURE__*/Path$1.of({
|
|
41
41
|
...NodePath,
|
|
42
42
|
fromFileUrl,
|
|
43
43
|
toFileUrl
|
|
44
44
|
}));
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
/**
|
|
47
|
+
* @since 1.0.0
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @since 1.0.0
|
|
52
|
+
* @category layer
|
|
53
|
+
*/
|
|
54
|
+
const layer = layer$1;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @since 1.0.0
|
|
58
|
+
* @category layer
|
|
59
|
+
*/
|
|
60
|
+
const layerPosix = layerPosix$1;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @since 1.0.0
|
|
64
|
+
* @category layer
|
|
65
|
+
*/
|
|
66
|
+
const layerWin32 = layerWin32$1;
|
|
67
|
+
|
|
68
|
+
var Path = /*#__PURE__*/Object.freeze({
|
|
69
|
+
__proto__: null,
|
|
70
|
+
layer: layer,
|
|
71
|
+
layerPosix: layerPosix,
|
|
72
|
+
layerWin32: layerWin32,
|
|
73
|
+
Path: Path$1
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
export { Path as P, layerPosix as a, layerWin32 as b, layer as l };
|
|
@@ -3,7 +3,7 @@ import * as Effect from 'effect/Effect';
|
|
|
3
3
|
import * as Fiber from 'effect/Fiber';
|
|
4
4
|
|
|
5
5
|
/** @internal */
|
|
6
|
-
const runMain = (effect, teardown = defaultTeardown) => {
|
|
6
|
+
const runMain$1 = (effect, teardown = defaultTeardown) => {
|
|
7
7
|
const fiber = Effect.runFork(effect);
|
|
8
8
|
fiber.addObserver(exit => teardown(exit, code => {
|
|
9
9
|
Effect.runCallback(interruptAll(fiber.id()), () => {
|
|
@@ -25,4 +25,20 @@ const interruptAll = id => Effect.flatMap(Fiber.roots, roots => {
|
|
|
25
25
|
return Fiber.interruptAllAs(roots, id);
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
/**
|
|
29
|
+
* @since 1.0.0
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @since 1.0.0
|
|
34
|
+
* @category runtime
|
|
35
|
+
*/
|
|
36
|
+
const runMain = runMain$1;
|
|
37
|
+
|
|
38
|
+
var Runtime = /*#__PURE__*/Object.freeze({
|
|
39
|
+
__proto__: null,
|
|
40
|
+
runMain: runMain,
|
|
41
|
+
defaultTeardown: defaultTeardown
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export { Runtime as R, runMain as r };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as FileSystem from '@effect/platform/FileSystem';
|
|
2
2
|
import * as IncomingMessage from '@effect/platform/Http/IncomingMessage';
|
|
3
3
|
import * as Middleware from '@effect/platform/Http/Middleware';
|
|
4
|
-
import * as Server from '@effect/platform/Http/Server';
|
|
4
|
+
import * as Server$1 from '@effect/platform/Http/Server';
|
|
5
5
|
import * as Error from '@effect/platform/Http/ServerError';
|
|
6
6
|
import * as ServerRequest from '@effect/platform/Http/ServerRequest';
|
|
7
7
|
import * as Config from 'effect/Config';
|
|
@@ -13,13 +13,28 @@ import * as Runtime from 'effect/Runtime';
|
|
|
13
13
|
import * as Stream from 'effect/Stream';
|
|
14
14
|
import { Readable } from 'node:stream';
|
|
15
15
|
import { pipeline } from 'node:stream/promises';
|
|
16
|
-
import { fromWritable } from '
|
|
17
|
-
import { formData, stream } from './formData.esm.js';
|
|
18
|
-
import { IncomingMessageImpl } from './incomingMessage.esm.js';
|
|
19
|
-
import {
|
|
16
|
+
import { f as fromWritable } from './Sink-554d2819.esm.js';
|
|
17
|
+
import { f as formData, s as stream } from './formData-4330f230.esm.js';
|
|
18
|
+
import { I as IncomingMessageImpl } from './incomingMessage-309eb6a5.esm.js';
|
|
19
|
+
import { l as layer$2 } from './platform-f3d31bb1.esm.js';
|
|
20
|
+
|
|
21
|
+
function _mergeNamespaces(n, m) {
|
|
22
|
+
m.forEach(function (e) {
|
|
23
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
24
|
+
if (k !== 'default' && !(k in n)) {
|
|
25
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
26
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () { return e[k]; }
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
return Object.freeze(n);
|
|
34
|
+
}
|
|
20
35
|
|
|
21
36
|
/** @internal */
|
|
22
|
-
const make = (evaluate, options) => Effect.gen(function* (_) {
|
|
37
|
+
const make$1 = (evaluate, options) => Effect.gen(function* (_) {
|
|
23
38
|
const server = evaluate();
|
|
24
39
|
const serverFiber = yield* _(Effect.addFinalizer(() => Effect.async(resume => {
|
|
25
40
|
server.close(error => {
|
|
@@ -42,7 +57,7 @@ const make = (evaluate, options) => Effect.gen(function* (_) {
|
|
|
42
57
|
});
|
|
43
58
|
}));
|
|
44
59
|
const address = server.address();
|
|
45
|
-
return Server.make({
|
|
60
|
+
return Server$1.make({
|
|
46
61
|
address: typeof address === "string" ? {
|
|
47
62
|
_tag: "UnixAddress",
|
|
48
63
|
path: address
|
|
@@ -131,10 +146,10 @@ class ServerRequestImpl extends IncomingMessageImpl {
|
|
|
131
146
|
}
|
|
132
147
|
|
|
133
148
|
/** @internal */
|
|
134
|
-
const layer = (evaluate, options) => Layer.merge(Layer.scoped(Server.Server, make(evaluate, options)), layer$
|
|
149
|
+
const layer$1 = (evaluate, options) => Layer.merge(Layer.scoped(Server$1.Server, make$1(evaluate, options)), layer$2);
|
|
135
150
|
|
|
136
151
|
/** @internal */
|
|
137
|
-
const layerConfig = (evaluate, options) => Layer.merge(Layer.scoped(Server.Server, Effect.flatMap(Effect.config(Config.unwrap(options)), options => make(evaluate, options))), layer$
|
|
152
|
+
const layerConfig$1 = (evaluate, options) => Layer.merge(Layer.scoped(Server$1.Server, Effect.flatMap(Effect.config(Config.unwrap(options)), options => make$1(evaluate, options))), layer$2);
|
|
138
153
|
const handleResponse = (request, response) => Effect.suspend(() => {
|
|
139
154
|
const nodeResponse = request.response;
|
|
140
155
|
if (request.method === "HEAD") {
|
|
@@ -215,4 +230,35 @@ const handleResponse = (request, response) => Effect.suspend(() => {
|
|
|
215
230
|
}
|
|
216
231
|
});
|
|
217
232
|
|
|
218
|
-
|
|
233
|
+
/**
|
|
234
|
+
* @since 1.0.0
|
|
235
|
+
*
|
|
236
|
+
* Also includes exports from [`@effect/platform/Http/Server`](https://effect-ts.github.io/platform/platform/Http/Server.ts.html).
|
|
237
|
+
*/
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* @since 1.0.0
|
|
241
|
+
* @category constructors
|
|
242
|
+
*/
|
|
243
|
+
const make = make$1;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* @since 1.0.0
|
|
247
|
+
* @category layers
|
|
248
|
+
*/
|
|
249
|
+
const layer = layer$1;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* @since 1.0.0
|
|
253
|
+
* @category layers
|
|
254
|
+
*/
|
|
255
|
+
const layerConfig = layerConfig$1;
|
|
256
|
+
|
|
257
|
+
var Server = /*#__PURE__*/_mergeNamespaces({
|
|
258
|
+
__proto__: null,
|
|
259
|
+
make: make,
|
|
260
|
+
layer: layer,
|
|
261
|
+
layerConfig: layerConfig
|
|
262
|
+
}, [Server$1]);
|
|
263
|
+
|
|
264
|
+
export { Server as S, layerConfig as a, layer as l, make as m };
|