@fncts/node 0.0.45 → 0.0.46
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/_cjs/fs/api.cjs +25 -26
- package/_cjs/fs/api.cjs.map +1 -1
- package/_cjs/http/IncomingMessage.cjs +9 -10
- package/_cjs/http/IncomingMessage.cjs.map +1 -1
- package/_cjs/http/Server.cjs +25 -26
- package/_cjs/http/Server.cjs.map +1 -1
- package/_cjs/http/ServerRequest.cjs +4 -6
- package/_cjs/http/ServerRequest.cjs.map +1 -1
- package/_cjs/{chunk.cjs → rolldown-runtime.cjs} +2 -3
- package/_cjs/stream/api.cjs +26 -27
- package/_cjs/stream/api.cjs.map +1 -1
- package/_mjs/fs/api.mjs +2 -3
- package/_mjs/fs/api.mjs.map +1 -1
- package/_mjs/fs.mjs +1 -2
- package/_mjs/http/IncomingMessage.mjs +1 -2
- package/_mjs/http/IncomingMessage.mjs.map +1 -1
- package/_mjs/http/Server.mjs +1 -2
- package/_mjs/http/Server.mjs.map +1 -1
- package/_mjs/http/ServerRequest.mjs +2 -4
- package/_mjs/http/ServerRequest.mjs.map +1 -1
- package/_mjs/stream/api.mjs +1 -2
- package/_mjs/stream/api.mjs.map +1 -1
- package/_mjs/stream.mjs +1 -2
- package/package.json +3 -3
package/_cjs/stream/api.cjs
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
2
|
+
const require_rolldown_runtime = require("../rolldown-runtime.cjs");
|
|
3
3
|
let _fncts_io_Queue_constructors = require("@fncts/io/Queue/constructors");
|
|
4
|
-
_fncts_io_Queue_constructors =
|
|
4
|
+
_fncts_io_Queue_constructors = require_rolldown_runtime.__toESM(_fncts_io_Queue_constructors, 1);
|
|
5
5
|
let _fncts_io_IO_api = require("@fncts/io/IO/api");
|
|
6
|
-
_fncts_io_IO_api =
|
|
6
|
+
_fncts_io_IO_api = require_rolldown_runtime.__toESM(_fncts_io_IO_api, 1);
|
|
7
7
|
let _fncts_io_Queue_api_operations = require("@fncts/io/Queue/api/operations");
|
|
8
|
-
_fncts_io_Queue_api_operations =
|
|
8
|
+
_fncts_io_Queue_api_operations = require_rolldown_runtime.__toESM(_fncts_io_Queue_api_operations, 1);
|
|
9
9
|
let _fncts_io_Channel_api = require("@fncts/io/Channel/api");
|
|
10
|
-
_fncts_io_Channel_api =
|
|
10
|
+
_fncts_io_Channel_api = require_rolldown_runtime.__toESM(_fncts_io_Channel_api, 1);
|
|
11
11
|
let _fncts_base_data_Maybe_definition = require("@fncts/base/data/Maybe/definition");
|
|
12
|
-
_fncts_base_data_Maybe_definition =
|
|
12
|
+
_fncts_base_data_Maybe_definition = require_rolldown_runtime.__toESM(_fncts_base_data_Maybe_definition, 1);
|
|
13
13
|
let _fncts_base_data_Either_constructors = require("@fncts/base/data/Either/constructors");
|
|
14
|
-
_fncts_base_data_Either_constructors =
|
|
14
|
+
_fncts_base_data_Either_constructors = require_rolldown_runtime.__toESM(_fncts_base_data_Either_constructors, 1);
|
|
15
15
|
let _fncts_io_IO_runtime = require("@fncts/io/IO/runtime");
|
|
16
|
-
_fncts_io_IO_runtime =
|
|
16
|
+
_fncts_io_IO_runtime = require_rolldown_runtime.__toESM(_fncts_io_IO_runtime, 1);
|
|
17
17
|
let _fncts_base_data_Exit_constructors = require("@fncts/base/data/Exit/constructors");
|
|
18
|
-
_fncts_base_data_Exit_constructors =
|
|
18
|
+
_fncts_base_data_Exit_constructors = require_rolldown_runtime.__toESM(_fncts_base_data_Exit_constructors, 1);
|
|
19
19
|
let _fncts_io_Channel_core_api = require("@fncts/io/Channel/core-api");
|
|
20
|
-
_fncts_io_Channel_core_api =
|
|
20
|
+
_fncts_io_Channel_core_api = require_rolldown_runtime.__toESM(_fncts_io_Channel_core_api, 1);
|
|
21
21
|
let _fncts_base_data_Exit_api = require("@fncts/base/data/Exit/api");
|
|
22
|
-
_fncts_base_data_Exit_api =
|
|
22
|
+
_fncts_base_data_Exit_api = require_rolldown_runtime.__toESM(_fncts_base_data_Exit_api, 1);
|
|
23
23
|
let _fncts_base_data_Either_destructors = require("@fncts/base/data/Either/destructors");
|
|
24
|
-
_fncts_base_data_Either_destructors =
|
|
24
|
+
_fncts_base_data_Either_destructors = require_rolldown_runtime.__toESM(_fncts_base_data_Either_destructors, 1);
|
|
25
25
|
let _fncts_base_collection_immutable_Conc_definition = require("@fncts/base/collection/immutable/Conc/definition");
|
|
26
|
-
_fncts_base_collection_immutable_Conc_definition =
|
|
26
|
+
_fncts_base_collection_immutable_Conc_definition = require_rolldown_runtime.__toESM(_fncts_base_collection_immutable_Conc_definition, 1);
|
|
27
27
|
let _fncts_io_Sink_api = require("@fncts/io/Sink/api");
|
|
28
|
-
_fncts_io_Sink_api =
|
|
28
|
+
_fncts_io_Sink_api = require_rolldown_runtime.__toESM(_fncts_io_Sink_api, 1);
|
|
29
29
|
let _fncts_io_Future_api = require("@fncts/io/Future/api");
|
|
30
|
-
_fncts_io_Future_api =
|
|
30
|
+
_fncts_io_Future_api = require_rolldown_runtime.__toESM(_fncts_io_Future_api, 1);
|
|
31
31
|
let _fncts_io_Future_constructors = require("@fncts/io/Future/constructors");
|
|
32
|
-
_fncts_io_Future_constructors =
|
|
32
|
+
_fncts_io_Future_constructors = require_rolldown_runtime.__toESM(_fncts_io_Future_constructors, 1);
|
|
33
33
|
let _fncts_io_IO_api_asyncIO = require("@fncts/io/IO/api/asyncIO");
|
|
34
|
-
_fncts_io_IO_api_asyncIO =
|
|
34
|
+
_fncts_io_IO_api_asyncIO = require_rolldown_runtime.__toESM(_fncts_io_IO_api_asyncIO, 1);
|
|
35
35
|
let _fncts_io_IO_api_interrupt = require("@fncts/io/IO/api/interrupt");
|
|
36
|
-
_fncts_io_IO_api_interrupt =
|
|
36
|
+
_fncts_io_IO_api_interrupt = require_rolldown_runtime.__toESM(_fncts_io_IO_api_interrupt, 1);
|
|
37
37
|
let _fncts_base_collection_immutable_Conc_api = require("@fncts/base/collection/immutable/Conc/api");
|
|
38
|
-
_fncts_base_collection_immutable_Conc_api =
|
|
38
|
+
_fncts_base_collection_immutable_Conc_api = require_rolldown_runtime.__toESM(_fncts_base_collection_immutable_Conc_api, 1);
|
|
39
39
|
let _fncts_io_Sink_definition = require("@fncts/io/Sink/definition");
|
|
40
|
-
_fncts_io_Sink_definition =
|
|
40
|
+
_fncts_io_Sink_definition = require_rolldown_runtime.__toESM(_fncts_io_Sink_definition, 1);
|
|
41
41
|
let _fncts_io_IO_api_acquireRelease = require("@fncts/io/IO/api/acquireRelease");
|
|
42
|
-
_fncts_io_IO_api_acquireRelease =
|
|
42
|
+
_fncts_io_IO_api_acquireRelease = require_rolldown_runtime.__toESM(_fncts_io_IO_api_acquireRelease, 1);
|
|
43
43
|
let _fncts_io_Stream_api = require("@fncts/io/Stream/api");
|
|
44
|
-
_fncts_io_Stream_api =
|
|
44
|
+
_fncts_io_Stream_api = require_rolldown_runtime.__toESM(_fncts_io_Stream_api, 1);
|
|
45
45
|
let _fncts_base_collection_immutable_Conc_constructors = require("@fncts/base/collection/immutable/Conc/constructors");
|
|
46
|
-
_fncts_base_collection_immutable_Conc_constructors =
|
|
46
|
+
_fncts_base_collection_immutable_Conc_constructors = require_rolldown_runtime.__toESM(_fncts_base_collection_immutable_Conc_constructors, 1);
|
|
47
47
|
let _fncts_base_data_Maybe_constructors = require("@fncts/base/data/Maybe/constructors");
|
|
48
|
-
_fncts_base_data_Maybe_constructors =
|
|
48
|
+
_fncts_base_data_Maybe_constructors = require_rolldown_runtime.__toESM(_fncts_base_data_Maybe_constructors, 1);
|
|
49
49
|
let _fncts_io_IO_api_scoped = require("@fncts/io/IO/api/scoped");
|
|
50
|
-
_fncts_io_IO_api_scoped =
|
|
50
|
+
_fncts_io_IO_api_scoped = require_rolldown_runtime.__toESM(_fncts_io_IO_api_scoped, 1);
|
|
51
51
|
let _fncts_io_Stream = require("@fncts/io/Stream");
|
|
52
|
-
|
|
52
|
+
// build/esm/stream/api.js
|
|
53
53
|
const fileName_1 = "(@fncts/node) src/stream/api.ts";
|
|
54
54
|
var ReadableError = class {
|
|
55
55
|
error;
|
|
@@ -230,7 +230,6 @@ function toUint8Array(readable, onFailure, options = {}) {
|
|
|
230
230
|
if ("closed" in stream && !stream.closed) stream.destroy();
|
|
231
231
|
}, fileName_1 + ":314:9"), fileName_1 + ":313:20")), fileName_1 + ":343:6");
|
|
232
232
|
}
|
|
233
|
-
//#endregion
|
|
234
233
|
exports.ReadableError = ReadableError;
|
|
235
234
|
exports.TransformError = TransformError;
|
|
236
235
|
exports.fromReadable = fromReadable;
|
package/_cjs/stream/api.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.cjs","names":["Stream","tsplus_module_4","tsplus_module_2","tsplus_module_1","tsplus_module_3","tsplus_module_5","tsplus_module_6","tsplus_module_8","tsplus_module_9","tsplus_module_11","tsplus_module_10","tsplus_module_12","tsplus_module_13","tsplus_module_14","tsplus_module_15","tsplus_module_16","tsplus_module_17","tsplus_module_18","tsplus_module_19","tsplus_module_20","tsplus_module_21","tsplus_module_22","tsplus_module_23","tsplus_module_24"],"sources":["../../esm/stream/api.js"],"sourcesContent":["const fileName_1 = \"(@fncts/node) src/stream/api.ts\";\nimport * as tsplus_module_1 from \"@fncts/io/Queue/constructors\";\nimport * as tsplus_module_2 from \"@fncts/io/IO/api\";\nimport * as tsplus_module_3 from \"@fncts/io/Queue/api/operations\";\nimport * as tsplus_module_4 from \"@fncts/io/Channel/api\";\nimport * as tsplus_module_5 from \"@fncts/base/data/Maybe/definition\";\nimport * as tsplus_module_6 from \"@fncts/base/data/Either/constructors\";\nimport * as tsplus_module_7 from \"@fncts/io/IO/runtime\";\nimport * as tsplus_module_8 from \"@fncts/base/data/Exit/constructors\";\nimport * as tsplus_module_9 from \"@fncts/io/Channel/core-api\";\nimport * as tsplus_module_10 from \"@fncts/base/data/Exit/api\";\nimport * as tsplus_module_11 from \"@fncts/base/data/Either/destructors\";\nimport * as tsplus_module_12 from \"@fncts/base/collection/immutable/Conc/definition\";\nimport * as tsplus_module_13 from \"@fncts/io/Sink/api\";\nimport * as tsplus_module_14 from \"@fncts/io/Future/api\";\nimport * as tsplus_module_15 from \"@fncts/io/Future/constructors\";\nimport * as tsplus_module_16 from \"@fncts/io/IO/api/asyncIO\";\nimport * as tsplus_module_17 from \"@fncts/io/IO/api/interrupt\";\nimport * as tsplus_module_18 from \"@fncts/base/collection/immutable/Conc/api\";\nimport * as tsplus_module_19 from \"@fncts/io/Sink/definition\";\nimport * as tsplus_module_20 from \"@fncts/io/IO/api/acquireRelease\";\nimport * as tsplus_module_21 from \"@fncts/io/Stream/api\";\nimport * as tsplus_module_22 from \"@fncts/base/collection/immutable/Conc/constructors\";\nimport * as tsplus_module_23 from \"@fncts/base/data/Maybe/constructors\";\nimport * as tsplus_module_24 from \"@fncts/io/IO/api/scoped\";\nimport { Stream } from \"@fncts/io/Stream\";\nexport class ReadableError {\n error;\n _tag = \"ReadableError\";\n constructor(error) {\n this.error = error;\n }\n}\nexport function fromReadable(readable, onError, chunkSize) {\n return new Stream(fromReadableChannel(readable, onError, chunkSize));\n}\nfunction fromReadableChannel(evaluate, onError, chunkSize) {\n return tsplus_module_4.acquireReleaseWith(tsplus_module_2.tap(([readable, queue]) => readableOffer(readable, queue, onError), fileName_1 + \":27:11\")(tsplus_module_2.zip(tsplus_module_1.makeUnbounded(fileName_1 + \":26:31\"), fileName_1 + \":26:11\")(tsplus_module_2.succeed(evaluate, fileName_1 + \":25:7\"))), ([readable, queue]) => readableTake(readable, queue, chunkSize), ([readable, queue]) => tsplus_module_2.zipRight(tsplus_module_3.shutdown(queue, fileName_1 + \":36:17\"), fileName_1 + \":36:11\")(tsplus_module_2.succeed(() => {\n // @ts-expect-error\n readable.removeAllListeners();\n if (\"closed\" in readable && !readable.closed) {\n readable.destroy();\n }\n }, fileName_1 + \":30:9\")));\n}\nfunction readableOffer(readable, queue, onError) {\n return tsplus_module_2.succeed(() => {\n // @ts-expect-error\n readable.on(\"readable\", () => {\n const size = tsplus_module_3.unsafeSize(queue, fileName_1 + \":48:25\");\n if (tsplus_module_5.isJust(size) && size.value <= 0) {\n tsplus_module_7.unsafeRun(tsplus_module_3.offer(tsplus_module_6.right(void 0, fileName_1 + \":50:33\"), fileName_1 + \":50:20\")(queue));\n }\n });\n // @ts-expect-error\n readable.on(\"error\", (err) => {\n tsplus_module_3.unsafeOffer(tsplus_module_6.left(tsplus_module_8.fail(onError(err), fileName_1 + \":55:46\"), fileName_1 + \":55:36\"), fileName_1 + \":55:24\")(queue);\n });\n // @ts-expect-error\n readable.on(\"end\", () => {\n tsplus_module_3.unsafeOffer(tsplus_module_6.left(tsplus_module_8.unit, fileName_1 + \":59:36\"), fileName_1 + \":59:24\")(queue);\n });\n if (readable.readable) {\n tsplus_module_3.unsafeOffer(tsplus_module_6.right(void 0, fileName_1 + \":62:37\"), fileName_1 + \":62:24\")(queue);\n }\n }, fileName_1 + \":45:12\");\n}\nfunction readableTake(readable, queue, chunkSize) {\n const read = readChunkChannel(readable, chunkSize);\n const loop = tsplus_module_9.flatMap((either) => tsplus_module_11.match((exit) => tsplus_module_10.match((cause) => tsplus_module_9.failCauseNow(cause), () => tsplus_module_4.unit)(exit), () => tsplus_module_9.flatMap(() => loop)(read))(either))(tsplus_module_4.fromIO(() => tsplus_module_3.take(queue, fileName_1 + \":73:100\")));\n return loop;\n}\nfunction readChunkChannel(readable, chunkSize) {\n return tsplus_module_4.defer(() => {\n const arr = [];\n let chunk = readable.read(chunkSize);\n while (chunk !== null) {\n arr.push(chunk);\n chunk = readable.read(chunkSize);\n }\n return tsplus_module_4.write(() => tsplus_module_12.fromArray(arr));\n });\n}\nexport function fromWritable(writable, onError, options) {\n return tsplus_module_13.fromChannel(fromWritableChannel(writable, onError, options), fileName_1 + \":109:26\");\n}\nexport function fromWritableChannel(writable, onError, options) {\n return tsplus_module_9.flatMap(([writable, future]) => tsplus_module_4.embedInput(writeInput(writable, (cause) => tsplus_module_14.failCause(cause, fileName_1 + \":119:62\")(future), options, tsplus_module_14.fulfill(tsplus_module_2.unit, fileName_1 + \":119:94\")(future)))(writableOutput(writable, future, onError)))(tsplus_module_4.fromIO(() => tsplus_module_2.zip(tsplus_module_15.make(fileName_1 + \":117:53\"), fileName_1 + \":117:41\")(tsplus_module_2.succeed(writable, fileName_1 + \":117:27\"))));\n}\nfunction writeInput(writable, onFailure, { encoding, endOnDone = true } = {}, onDone = tsplus_module_2.unit) {\n const write = writeIO(writable, encoding);\n const close = endOnDone\n ? tsplus_module_2.async((resume) => {\n if (\"closed\" in writable && writable.closed) {\n resume(tsplus_module_2.unit);\n }\n else {\n // @ts-expect-error\n writable.once(\"finish\", () => resume(tsplus_module_2.unit));\n }\n })\n : tsplus_module_2.unit;\n return {\n awaitRead: tsplus_module_2.unit,\n emit: write,\n error: (cause) => tsplus_module_2.zipRight(onFailure(cause), fileName_1 + \":145:30\")(close),\n done: (_) => tsplus_module_2.zipRight(onDone, fileName_1 + \":146:25\")(close),\n };\n}\nfunction writeIO(writable, encoding) {\n return (chunk) => {\n if (chunk.length === 0) {\n return tsplus_module_2.unit;\n }\n else {\n return tsplus_module_16.asyncIO((resume) => {\n const iterator = chunk[Symbol.iterator]();\n let done = false;\n let next = iterator.next();\n return tsplus_module_2.whileLoop(() => !done, () => {\n if (next.done) {\n return tsplus_module_2.succeed(() => {\n done = true;\n resume(tsplus_module_2.unit);\n }, fileName_1 + \":165:24\");\n }\n const success = writable.write(next.value, encoding);\n if (!success) {\n return tsplus_module_2.async((k) => {\n // @ts-expect-error\n writable.once(\"drain\", () => {\n k(tsplus_module_2.unit);\n });\n });\n }\n else {\n return tsplus_module_2.unit;\n }\n }, () => {\n next = iterator.next();\n });\n }, fileName_1 + \":155:24\");\n }\n };\n}\nfunction writableOutput(writable, future, onError) {\n return tsplus_module_4.fromIO(() => tsplus_module_2.defer(() => {\n function handleError(err) {\n tsplus_module_14.unsafeDone(tsplus_module_2.failNow(onError(err), fileName_1 + \":201:37\"), fileName_1 + \":201:26\")(future);\n }\n // @ts-expect-error\n writable.on(\"error\", handleError);\n // @ts-expect-error\n return tsplus_module_17.ensuring(tsplus_module_2.succeed(writable.removeListener(\"error\", handleError), fileName_1 + \":206:38\"), fileName_1 + \":206:35\")(tsplus_module_14.wait(future, fileName_1 + \":206:20\"));\n }, fileName_1 + \":199:13\"));\n}\nexport class TransformError {\n error;\n _tag = \"TransformError\";\n constructor(error) {\n this.error = error;\n }\n}\n/**\n * @tsplus pipeable fncts.io.Stream transform\n */\nexport function transform(transform) {\n return (self) => {\n const scopedSink = tsplus_module_2.map((transform) => {\n const endTransform = tsplus_module_2.succeed(() => transform.end(), fileName_1 + \":224:40\");\n const reader = tsplus_module_4.readWith((inp) => tsplus_module_4.unwrap(() => tsplus_module_2.async((cb) => {\n transform.write(tsplus_module_18.toBuffer(inp), (err) => {\n err ? cb(tsplus_module_2.failNow(new TransformError(err), fileName_1 + \":230:38\")) : tsplus_module_2.succeedNow(reader, fileName_1 + \":230:80\");\n });\n })), (err) => tsplus_module_4.unwrap(() => tsplus_module_2.map(() => tsplus_module_4.failNow(err), fileName_1 + \":234:51\")(endTransform)), () => tsplus_module_4.unwrap(() => tsplus_module_2.map(() => tsplus_module_4.unit, fileName_1 + \":235:48\")(endTransform)));\n return [transform, new tsplus_module_19.Sink(reader)];\n }, fileName_1 + \":223:11\")(tsplus_module_20.acquireRelease(() => tsplus_module_2.succeed(transform, fileName_1 + \":221:34\"), (transform) => tsplus_module_2.succeed(() => transform.destroy(), fileName_1 + \":222:48\"), fileName_1 + \":222:22\"));\n return tsplus_module_21.flatMap(([transform, sink]) => tsplus_module_21.ensuring(tsplus_module_2.succeed(() => transform.removeAllListeners(), fileName_1 + \":252:20\"), fileName_1 + \":252:17\")(tsplus_module_21.asyncIO((cb) => tsplus_module_2.zipRight(tsplus_module_21.run(sink, fileName_1 + \":251:29\")(self), fileName_1 + \":251:20\")(tsplus_module_2.succeed(() => {\n transform.on(\"data\", (chunk) => {\n cb(tsplus_module_2.succeed(() => tsplus_module_22.fromBuffer(chunk), fileName_1 + \":243:26\"));\n });\n transform.on(\"error\", (err) => {\n cb(tsplus_module_2.failNow(tsplus_module_23.just(new TransformError(err), fileName_1 + \":246:31\"), fileName_1 + \":246:26\"));\n });\n transform.on(\"end\", () => {\n cb(tsplus_module_2.failNow(tsplus_module_23.nothing(fileName_1 + \":249:34\"), fileName_1 + \":249:26\"));\n });\n }, fileName_1 + \":241:19\")))), fileName_1 + \":239:45\")(tsplus_module_21.scoped(() => scopedSink, fileName_1 + \":239:25\"));\n };\n}\nexport function toString(readable, onFailure, options) {\n const maxBytes = options?.maxBytes ? Number(options.maxBytes) : undefined;\n return tsplus_module_24.scoped(tsplus_module_2.flatMap((stream) => tsplus_module_2.async((resume) => {\n let string = \"\";\n let bytes = 0;\n // @ts-expect-error\n stream.once(\"error\", (err) => {\n resume(tsplus_module_2.failNow(onFailure(err), fileName_1 + \":286:28\"));\n });\n // @ts-expect-error\n stream.once(\"end\", () => {\n resume(tsplus_module_2.succeedNow(string, fileName_1 + \":290:31\"));\n });\n // @ts-expect-error\n stream.on(\"data\", (chunk) => {\n string += chunk;\n bytes += Buffer.byteLength(chunk);\n if (maxBytes && bytes > maxBytes) {\n resume(tsplus_module_2.failNow(onFailure(new Error(\"maxBytes exceeded\")), fileName_1 + \":297:30\"));\n }\n });\n }), fileName_1 + \":280:13\")(tsplus_module_20.acquireRelease(() => tsplus_module_2.succeed(() => {\n const stream = readable();\n stream.setEncoding(options?.encoding ?? \"utf8\");\n return stream;\n }, fileName_1 + \":266:12\"), (stream) => tsplus_module_2.succeed(() => {\n // @ts-expect-error\n stream.removeAllListeners();\n if (\"closed\" in stream && !stream.closed) {\n stream.destroy();\n }\n }, fileName_1 + \":272:9\"), fileName_1 + \":271:20\")), fileName_1 + \":301:6\");\n}\nexport function toUint8Array(readable, onFailure, options = {}) {\n const maxBytes = options.maxBytes ? Number(options.maxBytes) : undefined;\n return tsplus_module_24.scoped(tsplus_module_2.flatMap((stream) => tsplus_module_2.async((resume) => {\n let buffer = Buffer.alloc(0);\n let bytes = 0;\n // @ts-expect-error\n stream.once(\"error\", (err) => {\n resume(tsplus_module_2.failNow(onFailure(err), fileName_1 + \":328:28\"));\n });\n // @ts-expect-error\n stream.once(\"end\", () => {\n resume(tsplus_module_2.succeedNow(buffer, fileName_1 + \":332:31\"));\n });\n // @ts-expect-error\n stream.on(\"data\", (chunk) => {\n buffer = Buffer.concat([buffer, chunk]);\n bytes += chunk.length;\n if (maxBytes && bytes > maxBytes) {\n resume(tsplus_module_2.failNow(onFailure(new Error(\"maxBytes exceeded\")), fileName_1 + \":339:30\"));\n }\n });\n }), fileName_1 + \":322:13\")(tsplus_module_20.acquireRelease(() => tsplus_module_2.succeed(readable, fileName_1 + \":312:12\"), (stream) => tsplus_module_2.succeed(() => {\n // @ts-expect-error\n stream.removeAllListeners();\n if (\"closed\" in stream && !stream.closed) {\n stream.destroy();\n }\n }, fileName_1 + \":314:9\"), fileName_1 + \":313:20\")), fileName_1 + \":343:6\");\n}\n//# sourceMappingURL=api.js.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,aAAa;AA0BnB,IAAa,gBAAb,MAA2B;CACvB;CACA,OAAO;CACP,YAAY,OAAO;AACf,OAAK,QAAQ;;;AAGrB,SAAgB,aAAa,UAAU,SAAS,WAAW;AACvD,QAAO,IAAIA,iBAAAA,OAAO,oBAAoB,UAAU,SAAS,UAAU,CAAC;;AAExE,SAAS,oBAAoB,UAAU,SAAS,WAAW;AACvD,QAAOC,sBAAgB,mBAAmBC,iBAAgB,KAAK,CAAC,UAAU,WAAW,cAAc,UAAU,OAAO,QAAQ,EAAE,aAAa,SAAS,CAACA,iBAAgB,IAAIC,6BAAgB,cAAc,aAAa,SAAS,EAAE,aAAa,SAAS,CAACD,iBAAgB,QAAQ,UAAU,aAAa,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,OAC9B,QAAO,SAAS;IAErB,aAAa,SAAS,EAAE,aAAa,UAAU,CAAC,EAAE,aAAa,SAAS;;AAE/E,SAAgB,aAAa,UAAU,WAAW,UAAU,EAAE,EAAE;CAC5D,MAAM,WAAW,QAAQ,WAAW,OAAO,QAAQ,SAAS,GAAG,KAAA;AAC/D,QAAOqB,wBAAiB,OAAOrB,iBAAgB,SAAS,WAAWA,iBAAgB,OAAO,WAAW;EACjG,IAAI,SAAS,OAAO,MAAM,EAAE;EAC5B,IAAI,QAAQ;AAEZ,SAAO,KAAK,UAAU,QAAQ;AAC1B,UAAOA,iBAAgB,QAAQ,UAAU,IAAI,EAAE,aAAa,UAAU,CAAC;IACzE;AAEF,SAAO,KAAK,aAAa;AACrB,UAAOA,iBAAgB,WAAW,QAAQ,aAAa,UAAU,CAAC;IACpE;AAEF,SAAO,GAAG,SAAS,UAAU;AACzB,YAAS,OAAO,OAAO,CAAC,QAAQ,MAAM,CAAC;AACvC,YAAS,MAAM;AACf,OAAI,YAAY,QAAQ,SACpB,QAAOA,iBAAgB,QAAQ,0BAAU,IAAI,MAAM,oBAAoB,CAAC,EAAE,aAAa,UAAU,CAAC;IAExG;GACJ,EAAE,aAAa,UAAU,CAACiB,gCAAiB,qBAAqBjB,iBAAgB,QAAQ,UAAU,aAAa,UAAU,GAAG,WAAWA,iBAAgB,cAAc;AAEnK,SAAO,oBAAoB;AAC3B,MAAI,YAAY,UAAU,CAAC,OAAO,OAC9B,QAAO,SAAS;IAErB,aAAa,SAAS,EAAE,aAAa,UAAU,CAAC,EAAE,aAAa,SAAS"}
|
|
1
|
+
{"version":3,"file":"api.cjs","names":["Stream","tsplus_module_4","tsplus_module_2","tsplus_module_1","tsplus_module_3","tsplus_module_5","tsplus_module_6","tsplus_module_8","tsplus_module_9","tsplus_module_11","tsplus_module_10","tsplus_module_12","tsplus_module_13","tsplus_module_14","tsplus_module_15","tsplus_module_16","tsplus_module_17","tsplus_module_18","tsplus_module_19","tsplus_module_20","tsplus_module_21","tsplus_module_22","tsplus_module_23","tsplus_module_24"],"sources":["../../esm/stream/api.js"],"sourcesContent":["const fileName_1 = \"(@fncts/node) src/stream/api.ts\";\nimport * as tsplus_module_1 from \"@fncts/io/Queue/constructors\";\nimport * as tsplus_module_2 from \"@fncts/io/IO/api\";\nimport * as tsplus_module_3 from \"@fncts/io/Queue/api/operations\";\nimport * as tsplus_module_4 from \"@fncts/io/Channel/api\";\nimport * as tsplus_module_5 from \"@fncts/base/data/Maybe/definition\";\nimport * as tsplus_module_6 from \"@fncts/base/data/Either/constructors\";\nimport * as tsplus_module_7 from \"@fncts/io/IO/runtime\";\nimport * as tsplus_module_8 from \"@fncts/base/data/Exit/constructors\";\nimport * as tsplus_module_9 from \"@fncts/io/Channel/core-api\";\nimport * as tsplus_module_10 from \"@fncts/base/data/Exit/api\";\nimport * as tsplus_module_11 from \"@fncts/base/data/Either/destructors\";\nimport * as tsplus_module_12 from \"@fncts/base/collection/immutable/Conc/definition\";\nimport * as tsplus_module_13 from \"@fncts/io/Sink/api\";\nimport * as tsplus_module_14 from \"@fncts/io/Future/api\";\nimport * as tsplus_module_15 from \"@fncts/io/Future/constructors\";\nimport * as tsplus_module_16 from \"@fncts/io/IO/api/asyncIO\";\nimport * as tsplus_module_17 from \"@fncts/io/IO/api/interrupt\";\nimport * as tsplus_module_18 from \"@fncts/base/collection/immutable/Conc/api\";\nimport * as tsplus_module_19 from \"@fncts/io/Sink/definition\";\nimport * as tsplus_module_20 from \"@fncts/io/IO/api/acquireRelease\";\nimport * as tsplus_module_21 from \"@fncts/io/Stream/api\";\nimport * as tsplus_module_22 from \"@fncts/base/collection/immutable/Conc/constructors\";\nimport * as tsplus_module_23 from \"@fncts/base/data/Maybe/constructors\";\nimport * as tsplus_module_24 from \"@fncts/io/IO/api/scoped\";\nimport { Stream } from \"@fncts/io/Stream\";\nexport class ReadableError {\n error;\n _tag = \"ReadableError\";\n constructor(error) {\n this.error = error;\n }\n}\nexport function fromReadable(readable, onError, chunkSize) {\n return new Stream(fromReadableChannel(readable, onError, chunkSize));\n}\nfunction fromReadableChannel(evaluate, onError, chunkSize) {\n return tsplus_module_4.acquireReleaseWith(tsplus_module_2.tap(([readable, queue]) => readableOffer(readable, queue, onError), fileName_1 + \":27:11\")(tsplus_module_2.zip(tsplus_module_1.makeUnbounded(fileName_1 + \":26:31\"), fileName_1 + \":26:11\")(tsplus_module_2.succeed(evaluate, fileName_1 + \":25:7\"))), ([readable, queue]) => readableTake(readable, queue, chunkSize), ([readable, queue]) => tsplus_module_2.zipRight(tsplus_module_3.shutdown(queue, fileName_1 + \":36:17\"), fileName_1 + \":36:11\")(tsplus_module_2.succeed(() => {\n // @ts-expect-error\n readable.removeAllListeners();\n if (\"closed\" in readable && !readable.closed) {\n readable.destroy();\n }\n }, fileName_1 + \":30:9\")));\n}\nfunction readableOffer(readable, queue, onError) {\n return tsplus_module_2.succeed(() => {\n // @ts-expect-error\n readable.on(\"readable\", () => {\n const size = tsplus_module_3.unsafeSize(queue, fileName_1 + \":48:25\");\n if (tsplus_module_5.isJust(size) && size.value <= 0) {\n tsplus_module_7.unsafeRun(tsplus_module_3.offer(tsplus_module_6.right(void 0, fileName_1 + \":50:33\"), fileName_1 + \":50:20\")(queue));\n }\n });\n // @ts-expect-error\n readable.on(\"error\", (err) => {\n tsplus_module_3.unsafeOffer(tsplus_module_6.left(tsplus_module_8.fail(onError(err), fileName_1 + \":55:46\"), fileName_1 + \":55:36\"), fileName_1 + \":55:24\")(queue);\n });\n // @ts-expect-error\n readable.on(\"end\", () => {\n tsplus_module_3.unsafeOffer(tsplus_module_6.left(tsplus_module_8.unit, fileName_1 + \":59:36\"), fileName_1 + \":59:24\")(queue);\n });\n if (readable.readable) {\n tsplus_module_3.unsafeOffer(tsplus_module_6.right(void 0, fileName_1 + \":62:37\"), fileName_1 + \":62:24\")(queue);\n }\n }, fileName_1 + \":45:12\");\n}\nfunction readableTake(readable, queue, chunkSize) {\n const read = readChunkChannel(readable, chunkSize);\n const loop = tsplus_module_9.flatMap((either) => tsplus_module_11.match((exit) => tsplus_module_10.match((cause) => tsplus_module_9.failCauseNow(cause), () => tsplus_module_4.unit)(exit), () => tsplus_module_9.flatMap(() => loop)(read))(either))(tsplus_module_4.fromIO(() => tsplus_module_3.take(queue, fileName_1 + \":73:100\")));\n return loop;\n}\nfunction readChunkChannel(readable, chunkSize) {\n return tsplus_module_4.defer(() => {\n const arr = [];\n let chunk = readable.read(chunkSize);\n while (chunk !== null) {\n arr.push(chunk);\n chunk = readable.read(chunkSize);\n }\n return tsplus_module_4.write(() => tsplus_module_12.fromArray(arr));\n });\n}\nexport function fromWritable(writable, onError, options) {\n return tsplus_module_13.fromChannel(fromWritableChannel(writable, onError, options), fileName_1 + \":109:26\");\n}\nexport function fromWritableChannel(writable, onError, options) {\n return tsplus_module_9.flatMap(([writable, future]) => tsplus_module_4.embedInput(writeInput(writable, (cause) => tsplus_module_14.failCause(cause, fileName_1 + \":119:62\")(future), options, tsplus_module_14.fulfill(tsplus_module_2.unit, fileName_1 + \":119:94\")(future)))(writableOutput(writable, future, onError)))(tsplus_module_4.fromIO(() => tsplus_module_2.zip(tsplus_module_15.make(fileName_1 + \":117:53\"), fileName_1 + \":117:41\")(tsplus_module_2.succeed(writable, fileName_1 + \":117:27\"))));\n}\nfunction writeInput(writable, onFailure, { encoding, endOnDone = true } = {}, onDone = tsplus_module_2.unit) {\n const write = writeIO(writable, encoding);\n const close = endOnDone\n ? tsplus_module_2.async((resume) => {\n if (\"closed\" in writable && writable.closed) {\n resume(tsplus_module_2.unit);\n }\n else {\n // @ts-expect-error\n writable.once(\"finish\", () => resume(tsplus_module_2.unit));\n }\n })\n : tsplus_module_2.unit;\n return {\n awaitRead: tsplus_module_2.unit,\n emit: write,\n error: (cause) => tsplus_module_2.zipRight(onFailure(cause), fileName_1 + \":145:30\")(close),\n done: (_) => tsplus_module_2.zipRight(onDone, fileName_1 + \":146:25\")(close),\n };\n}\nfunction writeIO(writable, encoding) {\n return (chunk) => {\n if (chunk.length === 0) {\n return tsplus_module_2.unit;\n }\n else {\n return tsplus_module_16.asyncIO((resume) => {\n const iterator = chunk[Symbol.iterator]();\n let done = false;\n let next = iterator.next();\n return tsplus_module_2.whileLoop(() => !done, () => {\n if (next.done) {\n return tsplus_module_2.succeed(() => {\n done = true;\n resume(tsplus_module_2.unit);\n }, fileName_1 + \":165:24\");\n }\n const success = writable.write(next.value, encoding);\n if (!success) {\n return tsplus_module_2.async((k) => {\n // @ts-expect-error\n writable.once(\"drain\", () => {\n k(tsplus_module_2.unit);\n });\n });\n }\n else {\n return tsplus_module_2.unit;\n }\n }, () => {\n next = iterator.next();\n });\n }, fileName_1 + \":155:24\");\n }\n };\n}\nfunction writableOutput(writable, future, onError) {\n return tsplus_module_4.fromIO(() => tsplus_module_2.defer(() => {\n function handleError(err) {\n tsplus_module_14.unsafeDone(tsplus_module_2.failNow(onError(err), fileName_1 + \":201:37\"), fileName_1 + \":201:26\")(future);\n }\n // @ts-expect-error\n writable.on(\"error\", handleError);\n // @ts-expect-error\n return tsplus_module_17.ensuring(tsplus_module_2.succeed(writable.removeListener(\"error\", handleError), fileName_1 + \":206:38\"), fileName_1 + \":206:35\")(tsplus_module_14.wait(future, fileName_1 + \":206:20\"));\n }, fileName_1 + \":199:13\"));\n}\nexport class TransformError {\n error;\n _tag = \"TransformError\";\n constructor(error) {\n this.error = error;\n }\n}\n/**\n * @tsplus pipeable fncts.io.Stream transform\n */\nexport function transform(transform) {\n return (self) => {\n const scopedSink = tsplus_module_2.map((transform) => {\n const endTransform = tsplus_module_2.succeed(() => transform.end(), fileName_1 + \":224:40\");\n const reader = tsplus_module_4.readWith((inp) => tsplus_module_4.unwrap(() => tsplus_module_2.async((cb) => {\n transform.write(tsplus_module_18.toBuffer(inp), (err) => {\n err ? cb(tsplus_module_2.failNow(new TransformError(err), fileName_1 + \":230:38\")) : tsplus_module_2.succeedNow(reader, fileName_1 + \":230:80\");\n });\n })), (err) => tsplus_module_4.unwrap(() => tsplus_module_2.map(() => tsplus_module_4.failNow(err), fileName_1 + \":234:51\")(endTransform)), () => tsplus_module_4.unwrap(() => tsplus_module_2.map(() => tsplus_module_4.unit, fileName_1 + \":235:48\")(endTransform)));\n return [transform, new tsplus_module_19.Sink(reader)];\n }, fileName_1 + \":223:11\")(tsplus_module_20.acquireRelease(() => tsplus_module_2.succeed(transform, fileName_1 + \":221:34\"), (transform) => tsplus_module_2.succeed(() => transform.destroy(), fileName_1 + \":222:48\"), fileName_1 + \":222:22\"));\n return tsplus_module_21.flatMap(([transform, sink]) => tsplus_module_21.ensuring(tsplus_module_2.succeed(() => transform.removeAllListeners(), fileName_1 + \":252:20\"), fileName_1 + \":252:17\")(tsplus_module_21.asyncIO((cb) => tsplus_module_2.zipRight(tsplus_module_21.run(sink, fileName_1 + \":251:29\")(self), fileName_1 + \":251:20\")(tsplus_module_2.succeed(() => {\n transform.on(\"data\", (chunk) => {\n cb(tsplus_module_2.succeed(() => tsplus_module_22.fromBuffer(chunk), fileName_1 + \":243:26\"));\n });\n transform.on(\"error\", (err) => {\n cb(tsplus_module_2.failNow(tsplus_module_23.just(new TransformError(err), fileName_1 + \":246:31\"), fileName_1 + \":246:26\"));\n });\n transform.on(\"end\", () => {\n cb(tsplus_module_2.failNow(tsplus_module_23.nothing(fileName_1 + \":249:34\"), fileName_1 + \":249:26\"));\n });\n }, fileName_1 + \":241:19\")))), fileName_1 + \":239:45\")(tsplus_module_21.scoped(() => scopedSink, fileName_1 + \":239:25\"));\n };\n}\nexport function toString(readable, onFailure, options) {\n const maxBytes = options?.maxBytes ? Number(options.maxBytes) : undefined;\n return tsplus_module_24.scoped(tsplus_module_2.flatMap((stream) => tsplus_module_2.async((resume) => {\n let string = \"\";\n let bytes = 0;\n // @ts-expect-error\n stream.once(\"error\", (err) => {\n resume(tsplus_module_2.failNow(onFailure(err), fileName_1 + \":286:28\"));\n });\n // @ts-expect-error\n stream.once(\"end\", () => {\n resume(tsplus_module_2.succeedNow(string, fileName_1 + \":290:31\"));\n });\n // @ts-expect-error\n stream.on(\"data\", (chunk) => {\n string += chunk;\n bytes += Buffer.byteLength(chunk);\n if (maxBytes && bytes > maxBytes) {\n resume(tsplus_module_2.failNow(onFailure(new Error(\"maxBytes exceeded\")), fileName_1 + \":297:30\"));\n }\n });\n }), fileName_1 + \":280:13\")(tsplus_module_20.acquireRelease(() => tsplus_module_2.succeed(() => {\n const stream = readable();\n stream.setEncoding(options?.encoding ?? \"utf8\");\n return stream;\n }, fileName_1 + \":266:12\"), (stream) => tsplus_module_2.succeed(() => {\n // @ts-expect-error\n stream.removeAllListeners();\n if (\"closed\" in stream && !stream.closed) {\n stream.destroy();\n }\n }, fileName_1 + \":272:9\"), fileName_1 + \":271:20\")), fileName_1 + \":301:6\");\n}\nexport function toUint8Array(readable, onFailure, options = {}) {\n const maxBytes = options.maxBytes ? Number(options.maxBytes) : undefined;\n return tsplus_module_24.scoped(tsplus_module_2.flatMap((stream) => tsplus_module_2.async((resume) => {\n let buffer = Buffer.alloc(0);\n let bytes = 0;\n // @ts-expect-error\n stream.once(\"error\", (err) => {\n resume(tsplus_module_2.failNow(onFailure(err), fileName_1 + \":328:28\"));\n });\n // @ts-expect-error\n stream.once(\"end\", () => {\n resume(tsplus_module_2.succeedNow(buffer, fileName_1 + \":332:31\"));\n });\n // @ts-expect-error\n stream.on(\"data\", (chunk) => {\n buffer = Buffer.concat([buffer, chunk]);\n bytes += chunk.length;\n if (maxBytes && bytes > maxBytes) {\n resume(tsplus_module_2.failNow(onFailure(new Error(\"maxBytes exceeded\")), fileName_1 + \":339:30\"));\n }\n });\n }), fileName_1 + \":322:13\")(tsplus_module_20.acquireRelease(() => tsplus_module_2.succeed(readable, fileName_1 + \":312:12\"), (stream) => tsplus_module_2.succeed(() => {\n // @ts-expect-error\n stream.removeAllListeners();\n if (\"closed\" in stream && !stream.closed) {\n stream.destroy();\n }\n }, fileName_1 + \":314:9\"), fileName_1 + \":313:20\")), fileName_1 + \":343:6\");\n}\n//# s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EACjG,IAAI,SAAS,OAAO,MAAM,CAAC;EAC3B,IAAI,QAAQ;EAEZ,OAAO,KAAK,UAAU,QAAQ;GAC1B,OAAOA,iBAAgB,QAAQ,UAAU,GAAG,GAAG,aAAa,SAAS,CAAC;EAC1E,CAAC;EAED,OAAO,KAAK,aAAa;GACrB,OAAOA,iBAAgB,WAAW,QAAQ,aAAa,SAAS,CAAC;EACrE,CAAC;EAED,OAAO,GAAG,SAAS,UAAU;GACzB,SAAS,OAAO,OAAO,CAAC,QAAQ,KAAK,CAAC;GACtC,SAAS,MAAM;GACf,IAAI,YAAY,QAAQ,UACpB,OAAOA,iBAAgB,QAAQ,0BAAU,IAAI,MAAM,mBAAmB,CAAC,GAAG,aAAa,SAAS,CAAC;EAEzG,CAAC;CACL,CAAC,GAAG,aAAa,SAAS,CAAC,CAACiB,gCAAiB,qBAAqBjB,iBAAgB,QAAQ,UAAU,aAAa,SAAS,IAAI,WAAWA,iBAAgB,cAAc;EAEnK,OAAO,mBAAmB;EAC1B,IAAI,YAAY,UAAU,CAAC,OAAO,QAC9B,OAAO,QAAQ;CAEvB,GAAG,aAAa,QAAQ,GAAG,aAAa,SAAS,CAAC,GAAG,aAAa,QAAQ;AAC9E"}
|
package/_mjs/fs/api.mjs
CHANGED
|
@@ -20,7 +20,7 @@ import * as tsplus_module_13 from "@fncts/base/data/Cause/api";
|
|
|
20
20
|
import * as tsplus_module_14 from "@fncts/io/Ref/api/modify";
|
|
21
21
|
import * as tsplus_module_17 from "@fncts/io/IO/api/asyncInterrupt";
|
|
22
22
|
import * as fs from "fs";
|
|
23
|
-
|
|
23
|
+
// build/esm/fs/api.js
|
|
24
24
|
const fileName_1 = "(@fncts/node) src/fs/api.ts";
|
|
25
25
|
const FileDescriptor = tsplus_module_1.newtype();
|
|
26
26
|
function unitErrorCallback(cb) {
|
|
@@ -57,7 +57,7 @@ function copyFile(src, dest, flags) {
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
function createReadStream(path, options) {
|
|
60
|
-
const chunkSize = options?.chunkSize ??
|
|
60
|
+
const chunkSize = options?.chunkSize ?? 65536;
|
|
61
61
|
return tsplus_module_7.flatMap(([fd, state]) => tsplus_module_7.repeatIOChunkMaybe(tsplus_module_2.flatMap(([pos, end]) => {
|
|
62
62
|
const n = Math.min(end - pos + 1, chunkSize);
|
|
63
63
|
return tsplus_module_2.flatMap(([bytes, chunk]) => tsplus_module_2.flatMap(() => tsplus_module_2.map(() => {
|
|
@@ -301,7 +301,6 @@ function watchFile(filename, options) {
|
|
|
301
301
|
return queue;
|
|
302
302
|
}, fileName_1 + ":571:24")(tsplus_module_20.runtime(fileName_1 + ":571:35")), fileName_1 + ":570:24")(tsplus_module_21.makeUnbounded(fileName_1 + ":570:44")), (queue) => tsplus_module_19.shutdown(queue, fileName_1 + ":577:21"), fileName_1 + ":568:31"));
|
|
303
303
|
}
|
|
304
|
-
//#endregion
|
|
305
304
|
export { Dir, FileDescriptor, access, appendFile, chmod, chown, close, copyFile, createReadStream, createWriteSink, fchmod, fchown, fdatasync, fstat, fsync, ftruncate, futimes, lchmod, lchown, link, lstat, lutimes, mkdir, mkdtemp, open, opendir, read, readFile, readdir, realpath, realpathNative, rename, rm, rmdir, stat, symlink, truncate, unlink, utimes, watch, watchFile, write, writeFile, writev };
|
|
306
305
|
|
|
307
306
|
//# sourceMappingURL=api.mjs.map
|
package/_mjs/fs/api.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.mjs","names":[],"sources":["../../esm/fs/api.js"],"sourcesContent":["const fileName_1 = \"(@fncts/node) src/fs/api.ts\";\nimport * as tsplus_module_1 from \"@fncts/base/data/Newtype\";\nimport * as tsplus_module_2 from \"@fncts/io/IO/api\";\nimport * as tsplus_module_3 from \"@fncts/base/collection/immutable/Conc/constructors\";\nimport * as tsplus_module_4 from \"@fncts/io/Ref/api/set\";\nimport * as tsplus_module_5 from \"@fncts/base/data/Maybe/constructors\";\nimport * as tsplus_module_6 from \"@fncts/io/Ref/api/get\";\nimport * as tsplus_module_7 from \"@fncts/io/Stream/api\";\nimport * as tsplus_module_8 from \"@fncts/io/Ref/constructors\";\nimport * as tsplus_module_9 from \"@fncts/io/Sink/definition\";\nimport * as tsplus_module_10 from \"@fncts/base/data/Maybe/definition\";\nimport * as tsplus_module_11 from \"@fncts/io/Channel/api\";\nimport * as tsplus_module_12 from \"@fncts/io/Channel/core-api\";\nimport * as tsplus_module_13 from \"@fncts/base/data/Cause/api\";\nimport * as tsplus_module_14 from \"@fncts/io/Ref/api/modify\";\nimport * as tsplus_module_15 from \"@fncts/io/IO/api/acquireRelease\";\nimport * as tsplus_module_16 from \"@fncts/base/data/Either/constructors\";\nimport * as tsplus_module_17 from \"@fncts/io/IO/api/asyncInterrupt\";\nimport * as tsplus_module_18 from \"@fncts/base/collection/immutable/Conc/api\";\nimport * as tsplus_module_19 from \"@fncts/io/Queue/api/operations\";\nimport * as tsplus_module_20 from \"@fncts/io/IO/runtime\";\nimport * as tsplus_module_21 from \"@fncts/io/Queue/constructors\";\nimport * as fs from \"fs\";\nexport const FileDescriptor = tsplus_module_1.newtype();\nfunction unitErrorCallback(cb) {\n return (err) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":17:36\")) : cb(tsplus_module_2.unit));\n}\nexport function access(path, mode) {\n return tsplus_module_2.async((cb) => {\n fs.access(path, mode, (err) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":22:53\")) : cb(tsplus_module_2.unit)));\n });\n}\nexport function appendFile(path, data, options) {\n return tsplus_module_2.async((cb) => {\n fs.appendFile(path, data, options ?? {}, (err) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":32:79\")) : cb(tsplus_module_2.unit)));\n });\n}\nexport function chmod(path, mode) {\n return tsplus_module_2.async((cb) => {\n fs.chmod(path, mode, (err) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":38:52\")) : cb(tsplus_module_2.unit)));\n });\n}\nexport function close(fd) {\n return tsplus_module_2.async((cb) => {\n fs.close(FileDescriptor.reverseGet(fd), (err) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":44:71\")) : cb(tsplus_module_2.unit)));\n });\n}\nexport function chown(path, uid, gid) {\n return tsplus_module_2.async((cb) => {\n fs.chown(path, uid, gid, (err) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":50:56\")) : cb(tsplus_module_2.unit)));\n });\n}\nexport function copyFile(src, dest, flags) {\n return tsplus_module_2.async((cb) => {\n fs.copyFile(src, dest, flags, (err) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":56:61\")) : cb(tsplus_module_2.unit)));\n });\n}\nexport function createReadStream(path, options) {\n const chunkSize = options?.chunkSize ?? 1024 * 64;\n return tsplus_module_7.flatMap(([fd, state]) => tsplus_module_7.repeatIOChunkMaybe(tsplus_module_2.flatMap(([pos, end]) => {\n const n = Math.min(end - pos + 1, chunkSize);\n return tsplus_module_2.flatMap(([bytes, chunk]) => tsplus_module_2.flatMap(() => tsplus_module_2.map(() => {\n if (bytes !== chunk.length) {\n const dst = Buffer.allocUnsafeSlow(bytes);\n chunk.copy(dst, 0, 0, bytes);\n return tsplus_module_3.fromBuffer(dst);\n }\n else {\n return tsplus_module_3.fromBuffer(chunk);\n }\n }, fileName_1 + \":94:10\")(tsplus_module_4.set([pos + n, end], fileName_1 + \":94:20\")(state)), fileName_1 + \":93:10\")(tsplus_module_2.when(() => bytes === 0, fileName_1 + \":93:34\")(tsplus_module_2.fail(() => tsplus_module_5.nothing(fileName_1 + \":93:26\"), fileName_1 + \":93:18\"))), fileName_1 + \":91:33\")(tsplus_module_2.mapError(tsplus_module_5.just, fileName_1 + \":91:59\")(read(fd, n, pos)));\n }, fileName_1 + \":89:33\")(tsplus_module_6.get(state, fileName_1 + \":89:39\")), fileName_1 + \":87:30\"), fileName_1 + \":86:12\")(tsplus_module_7.acquireRelease(tsplus_module_2.zip(tsplus_module_2.defer(() => {\n const start = options?.start ?? 0;\n const end = options?.end ?? Infinity;\n if (end < start) {\n return tsplus_module_2.fail(() => new RangeError(`start (${start}) must be <= end (${end})`), fileName_1 + \":79:25\");\n }\n else {\n return tsplus_module_8.make(() => [start, end], fileName_1 + \":81:26\");\n }\n }, fileName_1 + \":75:15\"), fileName_1 + \":74:75\")(open(path, options?.flags ?? fs.constants.O_RDONLY, options?.mode)), ([fd, _]) => tsplus_module_2.orHalt(close(fd), fileName_1 + \":85:27\"), fileName_1 + \":73:31\"));\n}\nexport function createWriteSink(path, options) {\n return new tsplus_module_9.Sink(tsplus_module_11.unwrapScoped(() => tsplus_module_2.flatMap(errorRef => tsplus_module_2.flatMap(st => tsplus_module_2.map(maybeError => {\n if (!st && tsplus_module_10.isJust(maybeError)) {\n const reader = tsplus_module_11.readWith((_) => tsplus_module_12.zipRight(tsplus_module_12.end(() => undefined))(tsplus_module_11.fail(() => maybeError.value)), (err) => tsplus_module_12.failCause(() => tsplus_module_13.sequential(tsplus_module_13.fail(maybeError.value), tsplus_module_13.fail(err))), (_) => tsplus_module_11.fail(() => maybeError.value));\n return reader;\n }\n else {\n const reader = tsplus_module_11.readWith((inp) => tsplus_module_11.unwrap(() => tsplus_module_2.map(() => reader, fileName_1 + \":151:23\")(tsplus_module_2.flatMap(() => tsplus_module_14.update((n) => (n !== undefined ? n + inp.length : undefined), fileName_1 + \":150:47\")(st[1]), fileName_1 + \":150:27\")(tsplus_module_2.flatMap((pos) => write(st[0], inp, pos), fileName_1 + \":149:27\")(tsplus_module_6.get(st[1], fileName_1 + \":148:23\"))))), (err) => tsplus_module_11.fail(() => err), (_) => tsplus_module_12.end(() => undefined));\n return reader;\n }\n }, fileName_1 + \":128:29\")(tsplus_module_6.get(errorRef, fileName_1 + \":128:38\")), fileName_1 + \":121:27\")(tsplus_module_2.catchAll((err) => tsplus_module_4.set(tsplus_module_5.just(err, fileName_1 + \":125:49\"), fileName_1 + \":125:44\")(errorRef), fileName_1 + \":125:22\")(tsplus_module_15.acquireRelease(() => tsplus_module_2.zip(tsplus_module_8.make(() => options?.start ?? undefined, fileName_1 + \":123:26\"), fileName_1 + \":123:17\")(open(path, options?.flags ?? fs.constants.O_CREAT | fs.constants.O_WRONLY, options?.mode)), ([fd, _]) => tsplus_module_2.orHalt(close(fd), fileName_1 + \":124:51\"), fileName_1 + \":124:28\"))), fileName_1 + \":120:27\")(tsplus_module_8.make(() => tsplus_module_5.nothing(fileName_1 + \":120:67\"), fileName_1 + \":120:36\"))));\n}\nexport function fchmod(fd, mode) {\n return tsplus_module_2.async((cb) => {\n fs.fchmod(FileDescriptor.reverseGet(fd), mode, unitErrorCallback(cb));\n });\n}\nexport function fchown(fd, uid, gid) {\n return tsplus_module_2.async((cb) => {\n fs.fchown(FileDescriptor.reverseGet(fd), uid, gid, unitErrorCallback(cb));\n });\n}\nexport function fdatasync(fd) {\n return tsplus_module_2.async((cb) => {\n fs.fdatasync(FileDescriptor.reverseGet(fd), unitErrorCallback(cb));\n });\n}\nexport function fstat(fd) {\n return tsplus_module_2.async((cb) => {\n fs.fstat(FileDescriptor.reverseGet(fd), (err, stats) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":183:78\")) : cb(tsplus_module_2.succeedNow(stats, fileName_1 + \":183:103\"))));\n });\n}\nexport function fsync(fd) {\n return tsplus_module_2.async((cb) => {\n fs.fsync(FileDescriptor.reverseGet(fd), unitErrorCallback(cb));\n });\n}\nexport function ftruncate(fd, len) {\n return tsplus_module_2.async((cb) => {\n fs.ftruncate(FileDescriptor.reverseGet(fd), len, unitErrorCallback(cb));\n });\n}\nexport function futimes(fd, atime, mtime) {\n return tsplus_module_2.async((cb) => {\n fs.futimes(FileDescriptor.reverseGet(fd), atime, mtime, unitErrorCallback(cb));\n });\n}\nexport function lchmod(path, mode) {\n return tsplus_module_2.async((cb) => {\n fs.lchmod(path, mode, unitErrorCallback(cb));\n });\n}\nexport function lchown(path, uid, gid) {\n return tsplus_module_2.async((cb) => {\n fs.lchown(path, uid, gid, unitErrorCallback(cb));\n });\n}\nexport function lutimes(path, atime, mtime) {\n return tsplus_module_2.async((cb) => {\n fs.lutimes(path, atime, mtime, unitErrorCallback(cb));\n });\n}\nexport function link(path, newPath) {\n return tsplus_module_2.async((cb) => {\n fs.link(path, newPath, (err) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":233:54\")) : cb(tsplus_module_2.unit)));\n });\n}\nexport function lstat(path) {\n return tsplus_module_2.async((cb) => {\n fs.lstat(path, (err, stats) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":239:53\")) : cb(tsplus_module_2.succeedNow(stats, fileName_1 + \":239:78\"))));\n });\n}\nexport function mkdir(path, options) {\n return tsplus_module_2.async((cb) => {\n fs.mkdir(path, options, (err, path) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":248:61\")) : cb(tsplus_module_2.succeed(() => tsplus_module_5.fromNullable(path), fileName_1 + \":248:83\"))));\n });\n}\nexport function mkdtemp(prefix, options) {\n return tsplus_module_2.async((cb) => {\n fs.mkdtemp(prefix, options, (err, folder) => (err ? cb(tsplus_module_2.failNow(err, fileName_1 + \":254:70\")) : cb(tsplus_module_2.succeedNow(folder, fileName_1 + \":254:95\"))));\n });\n}\nexport function open(path, flags, mode) {\n return tsplus_module_2.async((cb) => {\n fs.open(path, flags, mode ?? null, (err, fd) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":264:70\")) : cb(tsplus_module_2.succeed(() => FileDescriptor.get(fd), fileName_1 + \":264:92\"))));\n });\n}\nexport class Dir {\n path;\n _dir;\n constructor(dir) {\n this.path = dir.path;\n this._dir = dir;\n }\n close() {\n return tsplus_module_2.async((cb) => {\n this._dir.close(unitErrorCallback(cb));\n });\n }\n read() {\n return tsplus_module_2.async((cb) => {\n this._dir.read((err, dirEnt) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":284:56\")) : cb(tsplus_module_2.succeedNow(tsplus_module_5.fromNullable(dirEnt), fileName_1 + \":284:81\"))));\n });\n }\n}\nexport function opendir(path, options) {\n return tsplus_module_2.async((cb) => {\n fs.opendir(path, options ?? {}, (err, dir) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":291:75\")) : cb(tsplus_module_2.succeedNow(new Dir(dir), fileName_1 + \":291:100\"))));\n });\n}\nexport function read(fd, length, position) {\n return tsplus_module_2.async((cb) => {\n const buf = Buffer.alloc(length);\n fs.read(FileDescriptor.reverseGet(fd), buf, 0, length, position ?? null, (err, bytesRead, buffer) => err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":303:23\")) : cb(tsplus_module_2.succeed(() => [bytesRead, buffer], fileName_1 + \":303:45\")));\n });\n}\nexport function readFile(file, options = {}) {\n return tsplus_module_17.asyncInterrupt((cb) => {\n const abortController = new AbortController();\n fs.readFile(file, { ...options, signal: abortController.signal }, (err, data) => err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":320:23\")) : cb(tsplus_module_2.succeedNow(data, fileName_1 + \":320:48\")));\n return tsplus_module_16.left(tsplus_module_2.succeed(() => abortController.abort(), fileName_1 + \":322:34\"), fileName_1 + \":322:23\");\n });\n}\nexport function readdir(path, options) {\n return tsplus_module_2.async((cb) => {\n fs.readdir(path, options ?? {}, (err, files) => err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":356:23\")) : files[0] && files[0] instanceof fs.Dir ? files.map((a) => new Dir(a)) : files);\n });\n}\nexport function realpath(path, options) {\n return tsplus_module_2.async((cb) => {\n fs.realpath(path, options ?? {}, (err, resolvedPath) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":375:78\")) : cb(tsplus_module_2.succeedNow(resolvedPath, fileName_1 + \":375:103\"))));\n });\n}\nexport function realpathNative(path, options) {\n return tsplus_module_2.async((cb) => {\n fs.realpath.native(path, options ?? {}, (err, resolvedPath) => err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":394:23\")) : cb(tsplus_module_2.succeed(() => resolvedPath, fileName_1 + \":394:45\")));\n });\n}\nexport function rename(oldPath, newPath) {\n return tsplus_module_2.async((cb) => {\n fs.rename(oldPath, newPath, unitErrorCallback(cb));\n });\n}\nexport function rm(path, options) {\n return tsplus_module_2.async((cb) => {\n fs.rm(path, options ?? {}, unitErrorCallback(cb));\n });\n}\nexport function rmdir(path) {\n return tsplus_module_2.async((cb) => {\n fs.rmdir(path, unitErrorCallback(cb));\n });\n}\nexport function stat(path, options) {\n return tsplus_module_2.async((cb) => {\n fs.stat(path, options ?? {}, (err, stats) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":424:76\")) : cb(tsplus_module_2.succeedNow(stats, fileName_1 + \":424:101\"))));\n });\n}\nexport function symlink(target, path) {\n return tsplus_module_2.async((cb) => {\n fs.symlink(target, path, unitErrorCallback(cb));\n });\n}\nexport function truncate(path, len) {\n return tsplus_module_2.async((cb) => {\n fs.truncate(path, len, unitErrorCallback(cb));\n });\n}\nexport function unlink(path) {\n return tsplus_module_2.async((cb) => {\n fs.unlink(path, unitErrorCallback(cb));\n });\n}\nexport function utimes(path, atime, mtime) {\n return tsplus_module_2.async((cb) => {\n fs.utimes(path, atime, mtime, unitErrorCallback(cb));\n });\n}\nexport function write(fd, buffer, position) {\n return tsplus_module_2.async((cb) => {\n const b = tsplus_module_18.toBuffer(buffer);\n fs.write(FileDescriptor.reverseGet(fd), b, position ?? null, b.byteLength, (err, bytesWritten) => err ? cb(tsplus_module_2.failNow(err, fileName_1 + \":460:26\")) : cb(tsplus_module_2.succeedNow(bytesWritten, fileName_1 + \":460:51\")));\n });\n}\nexport function writeFile(file, data, options = {}) {\n return tsplus_module_17.asyncInterrupt((cb) => {\n const abortController = new AbortController();\n fs.writeFile(file, data, { ...options, signal: abortController.signal }, (err) => err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":479:23\")) : tsplus_module_2.unit);\n return tsplus_module_16.left(tsplus_module_2.succeed(() => abortController.abort(), fileName_1 + \":481:34\"), fileName_1 + \":481:23\");\n });\n}\nexport function writev(fd, buffers, position) {\n return tsplus_module_2.async((cb) => {\n if (position) {\n fs.writev(FileDescriptor.reverseGet(fd), buffers, position, (err, bytesWritten) => err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":493:25\")) : cb(tsplus_module_2.succeedNow(bytesWritten, fileName_1 + \":493:50\")));\n }\n else {\n fs.writev(FileDescriptor.reverseGet(fd), buffers, (err, bytesWritten) => err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":497:25\")) : cb(tsplus_module_2.succeedNow(bytesWritten, fileName_1 + \":497:50\")));\n }\n });\n}\nexport function watch(filename, options) {\n return tsplus_module_7.flatMap((watcher) => tsplus_module_7.repeatIOMaybe(tsplus_module_2.async((cb) => {\n watcher.once(\"change\", (eventType, filename) => {\n watcher.removeAllListeners();\n cb(tsplus_module_2.succeedNow({ eventType: eventType, filename }, fileName_1 + \":533:27\"));\n });\n watcher.once(\"error\", (error) => {\n watcher.removeAllListeners();\n cb(tsplus_module_2.failNow(tsplus_module_5.just(error, fileName_1 + \":537:29\"), fileName_1 + \":537:24\"));\n });\n watcher.once(\"close\", () => {\n watcher.removeAllListeners();\n cb(tsplus_module_2.failNow(tsplus_module_5.nothing(fileName_1 + \":541:32\"), fileName_1 + \":541:24\"));\n });\n }), fileName_1 + \":529:25\"), fileName_1 + \":528:12\")(tsplus_module_7.fromIO(tsplus_module_2.tryCatch(() => fs.watch(filename, options ?? {}), (err) => err, fileName_1 + \":524:16\"), fileName_1 + \":523:23\"));\n}\nexport function watchFile(filename, options) {\n return tsplus_module_7.flatMap((queue) => tsplus_module_7.repeatIOMaybe(tsplus_module_19.take(queue, fileName_1 + \":578:50\"), fileName_1 + \":578:44\"), fileName_1 + \":578:12\")(tsplus_module_7.acquireRelease(tsplus_module_2.flatMap(queue => tsplus_module_2.map(runtime => {\n fs.watchFile(filename, options ?? {}, (curr, prev) => {\n runtime.unsafeRunFiber(tsplus_module_19.offer([curr, prev], fileName_1 + \":573:43\")(queue), fileName_1 + \":573:31\");\n });\n return queue;\n }, fileName_1 + \":571:24\")(tsplus_module_20.runtime(fileName_1 + \":571:35\")), fileName_1 + \":570:24\")(tsplus_module_21.makeUnbounded(fileName_1 + \":570:44\")), (queue) => tsplus_module_19.shutdown(queue, fileName_1 + \":577:21\"), fileName_1 + \":568:31\"));\n}\n//# sourceMappingURL=api.js.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,aAAa;AAuBnB,MAAa,iBAAiB,gBAAgB,SAAS;AACvD,SAAS,kBAAkB,IAAI;AAC3B,SAAQ,QAAS,MAAM,GAAG,gBAAgB,WAAW,KAAK,aAAa,SAAS,CAAC,GAAG,GAAG,gBAAgB,KAAK;;AAEhH,SAAgB,OAAO,MAAM,MAAM;AAC/B,QAAO,gBAAgB,OAAO,OAAO;AACjC,KAAG,OAAO,MAAM,OAAO,QAAS,MAAM,GAAG,gBAAgB,WAAW,KAAK,aAAa,SAAS,CAAC,GAAG,GAAG,gBAAgB,KAAK,CAAE;GAC/H;;AAEN,SAAgB,WAAW,MAAM,MAAM,SAAS;AAC5C,QAAO,gBAAgB,OAAO,OAAO;AACjC,KAAG,WAAW,MAAM,MAAM,WAAW,EAAE,GAAG,QAAS,MAAM,GAAG,gBAAgB,WAAW,KAAK,aAAa,SAAS,CAAC,GAAG,GAAG,gBAAgB,KAAK,CAAE;GAClJ;;AAEN,SAAgB,MAAM,MAAM,MAAM;AAC9B,QAAO,gBAAgB,OAAO,OAAO;AACjC,KAAG,MAAM,MAAM,OAAO,QAAS,MAAM,GAAG,gBAAgB,WAAW,KAAK,aAAa,SAAS,CAAC,GAAG,GAAG,gBAAgB,KAAK,CAAE;GAC9H;;AAEN,SAAgB,MAAM,IAAI;AACtB,QAAO,gBAAgB,OAAO,OAAO;AACjC,KAAG,MAAM,eAAe,WAAW,GAAG,GAAG,QAAS,MAAM,GAAG,gBAAgB,WAAW,KAAK,aAAa,SAAS,CAAC,GAAG,GAAG,gBAAgB,KAAK,CAAE;GACjJ;;AAEN,SAAgB,MAAM,MAAM,KAAK,KAAK;AAClC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CAAC,gBAAgB,eAAe,gBAAgB,SAAQ,UAAS,gBAAgB,KAAI,YAAW;AAC1Q,KAAG,UAAU,UAAU,WAAW,EAAE,GAAG,MAAM,SAAS;AAClD,WAAQ,eAAe,iBAAiB,MAAM,CAAC,MAAM,KAAK,EAAE,aAAa,UAAU,CAAC,MAAM,EAAE,aAAa,UAAU;IACrH;AACF,SAAO;IACR,aAAa,UAAU,CAAC,iBAAiB,QAAQ,aAAa,UAAU,CAAC,EAAE,aAAa,UAAU,CAAC,iBAAiB,cAAc,aAAa,UAAU,CAAC,GAAG,UAAU,iBAAiB,SAAS,OAAO,aAAa,UAAU,EAAE,aAAa,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"api.mjs","names":[],"sources":["../../esm/fs/api.js"],"sourcesContent":["const fileName_1 = \"(@fncts/node) src/fs/api.ts\";\nimport * as tsplus_module_1 from \"@fncts/base/data/Newtype\";\nimport * as tsplus_module_2 from \"@fncts/io/IO/api\";\nimport * as tsplus_module_3 from \"@fncts/base/collection/immutable/Conc/constructors\";\nimport * as tsplus_module_4 from \"@fncts/io/Ref/api/set\";\nimport * as tsplus_module_5 from \"@fncts/base/data/Maybe/constructors\";\nimport * as tsplus_module_6 from \"@fncts/io/Ref/api/get\";\nimport * as tsplus_module_7 from \"@fncts/io/Stream/api\";\nimport * as tsplus_module_8 from \"@fncts/io/Ref/constructors\";\nimport * as tsplus_module_9 from \"@fncts/io/Sink/definition\";\nimport * as tsplus_module_10 from \"@fncts/base/data/Maybe/definition\";\nimport * as tsplus_module_11 from \"@fncts/io/Channel/api\";\nimport * as tsplus_module_12 from \"@fncts/io/Channel/core-api\";\nimport * as tsplus_module_13 from \"@fncts/base/data/Cause/api\";\nimport * as tsplus_module_14 from \"@fncts/io/Ref/api/modify\";\nimport * as tsplus_module_15 from \"@fncts/io/IO/api/acquireRelease\";\nimport * as tsplus_module_16 from \"@fncts/base/data/Either/constructors\";\nimport * as tsplus_module_17 from \"@fncts/io/IO/api/asyncInterrupt\";\nimport * as tsplus_module_18 from \"@fncts/base/collection/immutable/Conc/api\";\nimport * as tsplus_module_19 from \"@fncts/io/Queue/api/operations\";\nimport * as tsplus_module_20 from \"@fncts/io/IO/runtime\";\nimport * as tsplus_module_21 from \"@fncts/io/Queue/constructors\";\nimport * as fs from \"fs\";\nexport const FileDescriptor = tsplus_module_1.newtype();\nfunction unitErrorCallback(cb) {\n return (err) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":17:36\")) : cb(tsplus_module_2.unit));\n}\nexport function access(path, mode) {\n return tsplus_module_2.async((cb) => {\n fs.access(path, mode, (err) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":22:53\")) : cb(tsplus_module_2.unit)));\n });\n}\nexport function appendFile(path, data, options) {\n return tsplus_module_2.async((cb) => {\n fs.appendFile(path, data, options ?? {}, (err) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":32:79\")) : cb(tsplus_module_2.unit)));\n });\n}\nexport function chmod(path, mode) {\n return tsplus_module_2.async((cb) => {\n fs.chmod(path, mode, (err) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":38:52\")) : cb(tsplus_module_2.unit)));\n });\n}\nexport function close(fd) {\n return tsplus_module_2.async((cb) => {\n fs.close(FileDescriptor.reverseGet(fd), (err) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":44:71\")) : cb(tsplus_module_2.unit)));\n });\n}\nexport function chown(path, uid, gid) {\n return tsplus_module_2.async((cb) => {\n fs.chown(path, uid, gid, (err) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":50:56\")) : cb(tsplus_module_2.unit)));\n });\n}\nexport function copyFile(src, dest, flags) {\n return tsplus_module_2.async((cb) => {\n fs.copyFile(src, dest, flags, (err) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":56:61\")) : cb(tsplus_module_2.unit)));\n });\n}\nexport function createReadStream(path, options) {\n const chunkSize = options?.chunkSize ?? 1024 * 64;\n return tsplus_module_7.flatMap(([fd, state]) => tsplus_module_7.repeatIOChunkMaybe(tsplus_module_2.flatMap(([pos, end]) => {\n const n = Math.min(end - pos + 1, chunkSize);\n return tsplus_module_2.flatMap(([bytes, chunk]) => tsplus_module_2.flatMap(() => tsplus_module_2.map(() => {\n if (bytes !== chunk.length) {\n const dst = Buffer.allocUnsafeSlow(bytes);\n chunk.copy(dst, 0, 0, bytes);\n return tsplus_module_3.fromBuffer(dst);\n }\n else {\n return tsplus_module_3.fromBuffer(chunk);\n }\n }, fileName_1 + \":94:10\")(tsplus_module_4.set([pos + n, end], fileName_1 + \":94:20\")(state)), fileName_1 + \":93:10\")(tsplus_module_2.when(() => bytes === 0, fileName_1 + \":93:34\")(tsplus_module_2.fail(() => tsplus_module_5.nothing(fileName_1 + \":93:26\"), fileName_1 + \":93:18\"))), fileName_1 + \":91:33\")(tsplus_module_2.mapError(tsplus_module_5.just, fileName_1 + \":91:59\")(read(fd, n, pos)));\n }, fileName_1 + \":89:33\")(tsplus_module_6.get(state, fileName_1 + \":89:39\")), fileName_1 + \":87:30\"), fileName_1 + \":86:12\")(tsplus_module_7.acquireRelease(tsplus_module_2.zip(tsplus_module_2.defer(() => {\n const start = options?.start ?? 0;\n const end = options?.end ?? Infinity;\n if (end < start) {\n return tsplus_module_2.fail(() => new RangeError(`start (${start}) must be <= end (${end})`), fileName_1 + \":79:25\");\n }\n else {\n return tsplus_module_8.make(() => [start, end], fileName_1 + \":81:26\");\n }\n }, fileName_1 + \":75:15\"), fileName_1 + \":74:75\")(open(path, options?.flags ?? fs.constants.O_RDONLY, options?.mode)), ([fd, _]) => tsplus_module_2.orHalt(close(fd), fileName_1 + \":85:27\"), fileName_1 + \":73:31\"));\n}\nexport function createWriteSink(path, options) {\n return new tsplus_module_9.Sink(tsplus_module_11.unwrapScoped(() => tsplus_module_2.flatMap(errorRef => tsplus_module_2.flatMap(st => tsplus_module_2.map(maybeError => {\n if (!st && tsplus_module_10.isJust(maybeError)) {\n const reader = tsplus_module_11.readWith((_) => tsplus_module_12.zipRight(tsplus_module_12.end(() => undefined))(tsplus_module_11.fail(() => maybeError.value)), (err) => tsplus_module_12.failCause(() => tsplus_module_13.sequential(tsplus_module_13.fail(maybeError.value), tsplus_module_13.fail(err))), (_) => tsplus_module_11.fail(() => maybeError.value));\n return reader;\n }\n else {\n const reader = tsplus_module_11.readWith((inp) => tsplus_module_11.unwrap(() => tsplus_module_2.map(() => reader, fileName_1 + \":151:23\")(tsplus_module_2.flatMap(() => tsplus_module_14.update((n) => (n !== undefined ? n + inp.length : undefined), fileName_1 + \":150:47\")(st[1]), fileName_1 + \":150:27\")(tsplus_module_2.flatMap((pos) => write(st[0], inp, pos), fileName_1 + \":149:27\")(tsplus_module_6.get(st[1], fileName_1 + \":148:23\"))))), (err) => tsplus_module_11.fail(() => err), (_) => tsplus_module_12.end(() => undefined));\n return reader;\n }\n }, fileName_1 + \":128:29\")(tsplus_module_6.get(errorRef, fileName_1 + \":128:38\")), fileName_1 + \":121:27\")(tsplus_module_2.catchAll((err) => tsplus_module_4.set(tsplus_module_5.just(err, fileName_1 + \":125:49\"), fileName_1 + \":125:44\")(errorRef), fileName_1 + \":125:22\")(tsplus_module_15.acquireRelease(() => tsplus_module_2.zip(tsplus_module_8.make(() => options?.start ?? undefined, fileName_1 + \":123:26\"), fileName_1 + \":123:17\")(open(path, options?.flags ?? fs.constants.O_CREAT | fs.constants.O_WRONLY, options?.mode)), ([fd, _]) => tsplus_module_2.orHalt(close(fd), fileName_1 + \":124:51\"), fileName_1 + \":124:28\"))), fileName_1 + \":120:27\")(tsplus_module_8.make(() => tsplus_module_5.nothing(fileName_1 + \":120:67\"), fileName_1 + \":120:36\"))));\n}\nexport function fchmod(fd, mode) {\n return tsplus_module_2.async((cb) => {\n fs.fchmod(FileDescriptor.reverseGet(fd), mode, unitErrorCallback(cb));\n });\n}\nexport function fchown(fd, uid, gid) {\n return tsplus_module_2.async((cb) => {\n fs.fchown(FileDescriptor.reverseGet(fd), uid, gid, unitErrorCallback(cb));\n });\n}\nexport function fdatasync(fd) {\n return tsplus_module_2.async((cb) => {\n fs.fdatasync(FileDescriptor.reverseGet(fd), unitErrorCallback(cb));\n });\n}\nexport function fstat(fd) {\n return tsplus_module_2.async((cb) => {\n fs.fstat(FileDescriptor.reverseGet(fd), (err, stats) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":183:78\")) : cb(tsplus_module_2.succeedNow(stats, fileName_1 + \":183:103\"))));\n });\n}\nexport function fsync(fd) {\n return tsplus_module_2.async((cb) => {\n fs.fsync(FileDescriptor.reverseGet(fd), unitErrorCallback(cb));\n });\n}\nexport function ftruncate(fd, len) {\n return tsplus_module_2.async((cb) => {\n fs.ftruncate(FileDescriptor.reverseGet(fd), len, unitErrorCallback(cb));\n });\n}\nexport function futimes(fd, atime, mtime) {\n return tsplus_module_2.async((cb) => {\n fs.futimes(FileDescriptor.reverseGet(fd), atime, mtime, unitErrorCallback(cb));\n });\n}\nexport function lchmod(path, mode) {\n return tsplus_module_2.async((cb) => {\n fs.lchmod(path, mode, unitErrorCallback(cb));\n });\n}\nexport function lchown(path, uid, gid) {\n return tsplus_module_2.async((cb) => {\n fs.lchown(path, uid, gid, unitErrorCallback(cb));\n });\n}\nexport function lutimes(path, atime, mtime) {\n return tsplus_module_2.async((cb) => {\n fs.lutimes(path, atime, mtime, unitErrorCallback(cb));\n });\n}\nexport function link(path, newPath) {\n return tsplus_module_2.async((cb) => {\n fs.link(path, newPath, (err) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":233:54\")) : cb(tsplus_module_2.unit)));\n });\n}\nexport function lstat(path) {\n return tsplus_module_2.async((cb) => {\n fs.lstat(path, (err, stats) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":239:53\")) : cb(tsplus_module_2.succeedNow(stats, fileName_1 + \":239:78\"))));\n });\n}\nexport function mkdir(path, options) {\n return tsplus_module_2.async((cb) => {\n fs.mkdir(path, options, (err, path) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":248:61\")) : cb(tsplus_module_2.succeed(() => tsplus_module_5.fromNullable(path), fileName_1 + \":248:83\"))));\n });\n}\nexport function mkdtemp(prefix, options) {\n return tsplus_module_2.async((cb) => {\n fs.mkdtemp(prefix, options, (err, folder) => (err ? cb(tsplus_module_2.failNow(err, fileName_1 + \":254:70\")) : cb(tsplus_module_2.succeedNow(folder, fileName_1 + \":254:95\"))));\n });\n}\nexport function open(path, flags, mode) {\n return tsplus_module_2.async((cb) => {\n fs.open(path, flags, mode ?? null, (err, fd) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":264:70\")) : cb(tsplus_module_2.succeed(() => FileDescriptor.get(fd), fileName_1 + \":264:92\"))));\n });\n}\nexport class Dir {\n path;\n _dir;\n constructor(dir) {\n this.path = dir.path;\n this._dir = dir;\n }\n close() {\n return tsplus_module_2.async((cb) => {\n this._dir.close(unitErrorCallback(cb));\n });\n }\n read() {\n return tsplus_module_2.async((cb) => {\n this._dir.read((err, dirEnt) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":284:56\")) : cb(tsplus_module_2.succeedNow(tsplus_module_5.fromNullable(dirEnt), fileName_1 + \":284:81\"))));\n });\n }\n}\nexport function opendir(path, options) {\n return tsplus_module_2.async((cb) => {\n fs.opendir(path, options ?? {}, (err, dir) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":291:75\")) : cb(tsplus_module_2.succeedNow(new Dir(dir), fileName_1 + \":291:100\"))));\n });\n}\nexport function read(fd, length, position) {\n return tsplus_module_2.async((cb) => {\n const buf = Buffer.alloc(length);\n fs.read(FileDescriptor.reverseGet(fd), buf, 0, length, position ?? null, (err, bytesRead, buffer) => err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":303:23\")) : cb(tsplus_module_2.succeed(() => [bytesRead, buffer], fileName_1 + \":303:45\")));\n });\n}\nexport function readFile(file, options = {}) {\n return tsplus_module_17.asyncInterrupt((cb) => {\n const abortController = new AbortController();\n fs.readFile(file, { ...options, signal: abortController.signal }, (err, data) => err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":320:23\")) : cb(tsplus_module_2.succeedNow(data, fileName_1 + \":320:48\")));\n return tsplus_module_16.left(tsplus_module_2.succeed(() => abortController.abort(), fileName_1 + \":322:34\"), fileName_1 + \":322:23\");\n });\n}\nexport function readdir(path, options) {\n return tsplus_module_2.async((cb) => {\n fs.readdir(path, options ?? {}, (err, files) => err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":356:23\")) : files[0] && files[0] instanceof fs.Dir ? files.map((a) => new Dir(a)) : files);\n });\n}\nexport function realpath(path, options) {\n return tsplus_module_2.async((cb) => {\n fs.realpath(path, options ?? {}, (err, resolvedPath) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":375:78\")) : cb(tsplus_module_2.succeedNow(resolvedPath, fileName_1 + \":375:103\"))));\n });\n}\nexport function realpathNative(path, options) {\n return tsplus_module_2.async((cb) => {\n fs.realpath.native(path, options ?? {}, (err, resolvedPath) => err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":394:23\")) : cb(tsplus_module_2.succeed(() => resolvedPath, fileName_1 + \":394:45\")));\n });\n}\nexport function rename(oldPath, newPath) {\n return tsplus_module_2.async((cb) => {\n fs.rename(oldPath, newPath, unitErrorCallback(cb));\n });\n}\nexport function rm(path, options) {\n return tsplus_module_2.async((cb) => {\n fs.rm(path, options ?? {}, unitErrorCallback(cb));\n });\n}\nexport function rmdir(path) {\n return tsplus_module_2.async((cb) => {\n fs.rmdir(path, unitErrorCallback(cb));\n });\n}\nexport function stat(path, options) {\n return tsplus_module_2.async((cb) => {\n fs.stat(path, options ?? {}, (err, stats) => (err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":424:76\")) : cb(tsplus_module_2.succeedNow(stats, fileName_1 + \":424:101\"))));\n });\n}\nexport function symlink(target, path) {\n return tsplus_module_2.async((cb) => {\n fs.symlink(target, path, unitErrorCallback(cb));\n });\n}\nexport function truncate(path, len) {\n return tsplus_module_2.async((cb) => {\n fs.truncate(path, len, unitErrorCallback(cb));\n });\n}\nexport function unlink(path) {\n return tsplus_module_2.async((cb) => {\n fs.unlink(path, unitErrorCallback(cb));\n });\n}\nexport function utimes(path, atime, mtime) {\n return tsplus_module_2.async((cb) => {\n fs.utimes(path, atime, mtime, unitErrorCallback(cb));\n });\n}\nexport function write(fd, buffer, position) {\n return tsplus_module_2.async((cb) => {\n const b = tsplus_module_18.toBuffer(buffer);\n fs.write(FileDescriptor.reverseGet(fd), b, position ?? null, b.byteLength, (err, bytesWritten) => err ? cb(tsplus_module_2.failNow(err, fileName_1 + \":460:26\")) : cb(tsplus_module_2.succeedNow(bytesWritten, fileName_1 + \":460:51\")));\n });\n}\nexport function writeFile(file, data, options = {}) {\n return tsplus_module_17.asyncInterrupt((cb) => {\n const abortController = new AbortController();\n fs.writeFile(file, data, { ...options, signal: abortController.signal }, (err) => err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":479:23\")) : tsplus_module_2.unit);\n return tsplus_module_16.left(tsplus_module_2.succeed(() => abortController.abort(), fileName_1 + \":481:34\"), fileName_1 + \":481:23\");\n });\n}\nexport function writev(fd, buffers, position) {\n return tsplus_module_2.async((cb) => {\n if (position) {\n fs.writev(FileDescriptor.reverseGet(fd), buffers, position, (err, bytesWritten) => err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":493:25\")) : cb(tsplus_module_2.succeedNow(bytesWritten, fileName_1 + \":493:50\")));\n }\n else {\n fs.writev(FileDescriptor.reverseGet(fd), buffers, (err, bytesWritten) => err ? cb(tsplus_module_2.fail(() => err, fileName_1 + \":497:25\")) : cb(tsplus_module_2.succeedNow(bytesWritten, fileName_1 + \":497:50\")));\n }\n });\n}\nexport function watch(filename, options) {\n return tsplus_module_7.flatMap((watcher) => tsplus_module_7.repeatIOMaybe(tsplus_module_2.async((cb) => {\n watcher.once(\"change\", (eventType, filename) => {\n watcher.removeAllListeners();\n cb(tsplus_module_2.succeedNow({ eventType: eventType, filename }, fileName_1 + \":533:27\"));\n });\n watcher.once(\"error\", (error) => {\n watcher.removeAllListeners();\n cb(tsplus_module_2.failNow(tsplus_module_5.just(error, fileName_1 + \":537:29\"), fileName_1 + \":537:24\"));\n });\n watcher.once(\"close\", () => {\n watcher.removeAllListeners();\n cb(tsplus_module_2.failNow(tsplus_module_5.nothing(fileName_1 + \":541:32\"), fileName_1 + \":541:24\"));\n });\n }), fileName_1 + \":529:25\"), fileName_1 + \":528:12\")(tsplus_module_7.fromIO(tsplus_module_2.tryCatch(() => fs.watch(filename, options ?? {}), (err) => err, fileName_1 + \":524:16\"), fileName_1 + \":523:23\"));\n}\nexport function watchFile(filename, options) {\n return tsplus_module_7.flatMap((queue) => tsplus_module_7.repeatIOMaybe(tsplus_module_19.take(queue, fileName_1 + \":578:50\"), fileName_1 + \":578:44\"), fileName_1 + \":578:12\")(tsplus_module_7.acquireRelease(tsplus_module_2.flatMap(queue => tsplus_module_2.map(runtime => {\n fs.watchFile(filename, options ?? {}, (curr, prev) => {\n runtime.unsafeRunFiber(tsplus_module_19.offer([curr, prev], fileName_1 + \":573:43\")(queue), fileName_1 + \":573:31\");\n });\n return queue;\n }, fileName_1 + \":571:24\")(tsplus_module_20.runtime(fileName_1 + \":571:35\")), fileName_1 + \":570:24\")(tsplus_module_21.makeUnbounded(fileName_1 + \":570:44\")), (queue) => tsplus_module_19.shutdown(queue, fileName_1 + \":577:21\"), fileName_1 + \":568:31\"));\n}\n//# sourceMappingURL=api.js.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,aAAa;AAuBnB,MAAa,iBAAiB,gBAAgB,QAAQ;AACtD,SAAS,kBAAkB,IAAI;CAC3B,QAAQ,QAAS,MAAM,GAAG,gBAAgB,WAAW,KAAK,aAAa,QAAQ,CAAC,IAAI,GAAG,gBAAgB,IAAI;AAC/G;AACA,SAAgB,OAAO,MAAM,MAAM;CAC/B,OAAO,gBAAgB,OAAO,OAAO;EACjC,GAAG,OAAO,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AAgB,cAAc,iBAAiB,KAAK,OAAO,aAAa,SAAS,GAAG,aAAa,SAAS,GAAG,aAAa,SAAS,CAAC,CAAC,gBAAgB,eAAe,gBAAgB,SAAQ,UAAS,gBAAgB,KAAI,YAAW;EAC1Q,GAAG,UAAU,UAAU,WAAW,CAAC,IAAI,MAAM,SAAS;GAClD,QAAQ,eAAe,iBAAiB,MAAM,CAAC,MAAM,IAAI,GAAG,aAAa,SAAS,CAAC,CAAC,KAAK,GAAG,aAAa,SAAS;EACtH,CAAC;EACD,OAAO;CACX,GAAG,aAAa,SAAS,CAAC,CAAC,iBAAiB,QAAQ,aAAa,SAAS,CAAC,GAAG,aAAa,SAAS,CAAC,CAAC,iBAAiB,cAAc,aAAa,SAAS,CAAC,IAAI,UAAU,iBAAiB,SAAS,OAAO,aAAa,SAAS,GAAG,aAAa,SAAS,CAAC;AAC/P"}
|
package/_mjs/fs.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { Dir, FileDescriptor, access, appendFile, chmod, chown, close, copyFile, createReadStream, createWriteSink, fchmod, fchown, fdatasync, fstat, fsync, ftruncate, futimes, lchmod, lchown, link, lstat, lutimes, mkdir, mkdtemp, open, opendir, read, readFile, readdir, realpath, realpathNative, rename, rm, rmdir, stat, symlink, truncate, unlink, utimes, watch, watchFile, write, writeFile, writev };
|
|
1
|
+
export { Dir, FileDescriptor, access, appendFile, chmod, chown, close, copyFile, createReadStream, createWriteSink, fchmod, fchown, fdatasync, fstat, fsync, ftruncate, futimes, lchmod, lchown, link, lstat, lutimes, mkdir, mkdtemp, open, opendir, read, readFile, readdir, realpath, realpathNative, rename, rm, rmdir, stat, symlink, truncate, unlink, utimes, watch, watchFile, write, writeFile, writev } from "./fs/api.mjs";
|
|
@@ -8,7 +8,7 @@ import * as tsplus_module_3 from "@fncts/io/IO/api/memoize";
|
|
|
8
8
|
import * as tsplus_module_1 from "@fncts/http/Headers";
|
|
9
9
|
import * as tsplus_module_7 from "@fncts/http/UrlParams";
|
|
10
10
|
import { IncomingMessage } from "@fncts/http/IncomingMessage";
|
|
11
|
-
|
|
11
|
+
// build/esm/http/IncomingMessage.js
|
|
12
12
|
const fileName_1 = "(@fncts/node) src/http/IncomingMessage.ts";
|
|
13
13
|
var IncomingMessageImpl = class extends IncomingMessage {
|
|
14
14
|
source;
|
|
@@ -48,7 +48,6 @@ var IncomingMessageImpl = class extends IncomingMessage {
|
|
|
48
48
|
return fromReadable(() => this.source, this.onError);
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
|
-
//#endregion
|
|
52
51
|
export { IncomingMessageImpl };
|
|
53
52
|
|
|
54
53
|
//# sourceMappingURL=IncomingMessage.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IncomingMessage.mjs","names":["NodeStream.toString","NodeStream.toUint8Array","NodeStream.fromReadable"],"sources":["../../esm/http/IncomingMessage.js"],"sourcesContent":["const fileName_1 = \"(@fncts/node) src/http/IncomingMessage.ts\";\nimport * as tsplus_module_1 from \"@fncts/http/Headers\";\nimport * as tsplus_module_2 from \"@fncts/base/data/Maybe/constructors\";\nimport * as tsplus_module_3 from \"@fncts/io/IO/api/memoize\";\nimport * as tsplus_module_4 from \"@fncts/io/IO/runtime\";\nimport * as tsplus_module_5 from \"@fncts/base/data/Exit/api\";\nimport * as tsplus_module_6 from \"@fncts/io/IO/api\";\nimport * as tsplus_module_7 from \"@fncts/http/UrlParams\";\nimport { Headers } from \"@fncts/http/Headers\";\nimport { IncomingMessage } from \"@fncts/http/IncomingMessage\";\nimport { UrlParams } from \"@fncts/http/UrlParams\";\nimport * as NodeStream from \"../stream.js\";\nexport class IncomingMessageImpl extends IncomingMessage {\n source;\n onError;\n remoteAddressOverride;\n constructor(source, onError, remoteAddressOverride) {\n super();\n this.source = source;\n this.onError = onError;\n this.remoteAddressOverride = remoteAddressOverride;\n }\n get headers() {\n return tsplus_module_1.make(this.source.headers);\n }\n get remoteAddress() {\n return tsplus_module_2.fromNullable(this.remoteAddressOverride ?? this.source.socket.remoteAddress);\n }\n textIO;\n get text() {\n if (this.textIO) {\n return this.textIO;\n }\n this.textIO = tsplus_module_5.getOrThrow(tsplus_module_4.unsafeRun(tsplus_module_3.memoize(NodeStream.toString(() => this.source, this.onError), fileName_1 + \":33:65\")));\n return this.textIO;\n }\n get json() {\n return tsplus_module_6.flatMap((text) => tsplus_module_6.tryCatch(() => JSON.parse(text), this.onError, fileName_1 + \":39:51\"), fileName_1 + \":39:29\")(this.text);\n }\n get urlParamsBody() {\n return tsplus_module_6.flatMap((text) => tsplus_module_6.tryCatch(() => tsplus_module_7.make(new URLSearchParams(text)), this.onError, fileName_1 + \":43:51\"), fileName_1 + \":43:29\")(this.text);\n }\n arrayBufferIO;\n get arrayBuffer() {\n if (this.arrayBufferIO) {\n return this.arrayBufferIO;\n }\n this.arrayBufferIO = tsplus_module_5.getOrThrow(tsplus_module_4.unsafeRun(tsplus_module_3.memoize(NodeStream.toUint8Array(() => this.source, this.onError), fileName_1 + \":52:76\")));\n return this.arrayBufferIO;\n }\n get stream() {\n return NodeStream.fromReadable(() => this.source, this.onError);\n }\n}\n//# sourceMappingURL=IncomingMessage.js.map"],"mappings":";;;;;;;;;;;AAAA,MAAM,aAAa;AAYnB,IAAa,sBAAb,cAAyC,gBAAgB;CACrD;CACA;CACA;CACA,YAAY,QAAQ,SAAS,uBAAuB;
|
|
1
|
+
{"version":3,"file":"IncomingMessage.mjs","names":["NodeStream.toString","NodeStream.toUint8Array","NodeStream.fromReadable"],"sources":["../../esm/http/IncomingMessage.js"],"sourcesContent":["const fileName_1 = \"(@fncts/node) src/http/IncomingMessage.ts\";\nimport * as tsplus_module_1 from \"@fncts/http/Headers\";\nimport * as tsplus_module_2 from \"@fncts/base/data/Maybe/constructors\";\nimport * as tsplus_module_3 from \"@fncts/io/IO/api/memoize\";\nimport * as tsplus_module_4 from \"@fncts/io/IO/runtime\";\nimport * as tsplus_module_5 from \"@fncts/base/data/Exit/api\";\nimport * as tsplus_module_6 from \"@fncts/io/IO/api\";\nimport * as tsplus_module_7 from \"@fncts/http/UrlParams\";\nimport { Headers } from \"@fncts/http/Headers\";\nimport { IncomingMessage } from \"@fncts/http/IncomingMessage\";\nimport { UrlParams } from \"@fncts/http/UrlParams\";\nimport * as NodeStream from \"../stream.js\";\nexport class IncomingMessageImpl extends IncomingMessage {\n source;\n onError;\n remoteAddressOverride;\n constructor(source, onError, remoteAddressOverride) {\n super();\n this.source = source;\n this.onError = onError;\n this.remoteAddressOverride = remoteAddressOverride;\n }\n get headers() {\n return tsplus_module_1.make(this.source.headers);\n }\n get remoteAddress() {\n return tsplus_module_2.fromNullable(this.remoteAddressOverride ?? this.source.socket.remoteAddress);\n }\n textIO;\n get text() {\n if (this.textIO) {\n return this.textIO;\n }\n this.textIO = tsplus_module_5.getOrThrow(tsplus_module_4.unsafeRun(tsplus_module_3.memoize(NodeStream.toString(() => this.source, this.onError), fileName_1 + \":33:65\")));\n return this.textIO;\n }\n get json() {\n return tsplus_module_6.flatMap((text) => tsplus_module_6.tryCatch(() => JSON.parse(text), this.onError, fileName_1 + \":39:51\"), fileName_1 + \":39:29\")(this.text);\n }\n get urlParamsBody() {\n return tsplus_module_6.flatMap((text) => tsplus_module_6.tryCatch(() => tsplus_module_7.make(new URLSearchParams(text)), this.onError, fileName_1 + \":43:51\"), fileName_1 + \":43:29\")(this.text);\n }\n arrayBufferIO;\n get arrayBuffer() {\n if (this.arrayBufferIO) {\n return this.arrayBufferIO;\n }\n this.arrayBufferIO = tsplus_module_5.getOrThrow(tsplus_module_4.unsafeRun(tsplus_module_3.memoize(NodeStream.toUint8Array(() => this.source, this.onError), fileName_1 + \":52:76\")));\n return this.arrayBufferIO;\n }\n get stream() {\n return NodeStream.fromReadable(() => this.source, this.onError);\n }\n}\n//# sourceMappingURL=IncomingMessage.js.map"],"mappings":";;;;;;;;;;;AAAA,MAAM,aAAa;AAYnB,IAAa,sBAAb,cAAyC,gBAAgB;CACrD;CACA;CACA;CACA,YAAY,QAAQ,SAAS,uBAAuB;EAChD,MAAM;EACN,KAAK,SAAS;EACd,KAAK,UAAU;EACf,KAAK,wBAAwB;CACjC;CACA,IAAI,UAAU;EACV,OAAO,gBAAgB,KAAK,KAAK,OAAO,OAAO;CACnD;CACA,IAAI,gBAAgB;EAChB,OAAO,gBAAgB,aAAa,KAAK,yBAAyB,KAAK,OAAO,OAAO,aAAa;CACtG;CACA;CACA,IAAI,OAAO;EACP,IAAI,KAAK,QACL,OAAO,KAAK;EAEhB,KAAK,SAAS,gBAAgB,WAAW,gBAAgB,UAAU,gBAAgB,QAAQA,eAA0B,KAAK,QAAQ,KAAK,OAAO,GAAG,aAAa,QAAQ,CAAC,CAAC;EACxK,OAAO,KAAK;CAChB;CACA,IAAI,OAAO;EACP,OAAO,gBAAgB,SAAS,SAAS,gBAAgB,eAAe,KAAK,MAAM,IAAI,GAAG,KAAK,SAAS,aAAa,QAAQ,GAAG,aAAa,QAAQ,CAAC,CAAC,KAAK,IAAI;CACpK;CACA,IAAI,gBAAgB;EAChB,OAAO,gBAAgB,SAAS,SAAS,gBAAgB,eAAe,gBAAgB,KAAK,IAAI,gBAAgB,IAAI,CAAC,GAAG,KAAK,SAAS,aAAa,QAAQ,GAAG,aAAa,QAAQ,CAAC,CAAC,KAAK,IAAI;CACnM;CACA;CACA,IAAI,cAAc;EACd,IAAI,KAAK,eACL,OAAO,KAAK;EAEhB,KAAK,gBAAgB,gBAAgB,WAAW,gBAAgB,UAAU,gBAAgB,QAAQC,mBAA8B,KAAK,QAAQ,KAAK,OAAO,GAAG,aAAa,QAAQ,CAAC,CAAC;EACnL,OAAO,KAAK;CAChB;CACA,IAAI,SAAS;EACT,OAAOC,mBAA8B,KAAK,QAAQ,KAAK,OAAO;CAClE;AACJ"}
|
package/_mjs/http/Server.mjs
CHANGED
|
@@ -23,7 +23,7 @@ import * as Http from "node:http";
|
|
|
23
23
|
import { Readable } from "node:stream";
|
|
24
24
|
import { pipeline } from "node:stream/promises";
|
|
25
25
|
import * as ws from "ws";
|
|
26
|
-
|
|
26
|
+
// build/esm/http/Server.js
|
|
27
27
|
const fileName_1 = "(@fncts/node) src/http/Server.ts";
|
|
28
28
|
const makeHandler = makeHandler_1;
|
|
29
29
|
/**
|
|
@@ -162,7 +162,6 @@ function handleResponse(request, response) {
|
|
|
162
162
|
}
|
|
163
163
|
}, fileName_1 + ":224:18");
|
|
164
164
|
}
|
|
165
|
-
//#endregion
|
|
166
165
|
export { handleResponse, make, makeHandler, makeUpgradeHandler };
|
|
167
166
|
|
|
168
167
|
//# sourceMappingURL=Server.mjs.map
|
package/_mjs/http/Server.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Server.mjs","names":[],"sources":["../../esm/http/Server.js"],"sourcesContent":["const fileName_1 = \"(@fncts/node) src/http/Server.ts\";\nimport * as tsplus_module_1 from \"@fncts/io/IO/api\";\nimport * as tsplus_module_2 from \"@fncts/io/IO/api/addFinalizer\";\nimport * as tsplus_module_3 from \"@fncts/http/Server\";\nimport * as tsplus_module_4 from \"@fncts/io/IO/api/acquireRelease\";\nimport * as tsplus_module_5 from \"@fncts/io/Scope/api\";\nimport * as tsplus_module_6 from \"@fncts/io/IO/api/memoize\";\nimport * as tsplus_module_7 from \"@fncts/io/IO/api/scope\";\nimport * as tsplus_module_8 from \"@fncts/base/data/Exit/definition\";\nimport * as tsplus_module_9 from \"@fncts/http/HttpApp\";\nimport * as tsplus_module_10 from \"@fncts/http/ServerRequest/definition\";\nimport * as tsplus_module_11 from \"@fncts/io/IO/api/environment\";\nimport * as tsplus_module_12 from \"@fncts/io/IO/runtime\";\nimport * as tsplus_module_13 from \"@fncts/io/FiberSet\";\nimport * as tsplus_module_14 from \"@fncts/http/Socket\";\nimport * as tsplus_module_15 from \"@fncts/base/data/Cause/api\";\nimport * as tsplus_module_16 from \"@fncts/http/Body/definition\";\nimport * as tsplus_module_17 from \"@fncts/io/Stream/api\";\nexport const makeHandler = makeHandler_1;\nimport { ResponseError } from \"@fncts/http/ResponseError\";\nimport { Server } from \"@fncts/http/Server\";\nimport { clientAbortFiberId, ServeError } from \"@fncts/http/ServerError\";\nimport { ServerRequestImpl } from \"@fncts/node/http/ServerRequest\";\nimport * as NodeStream from \"@fncts/node/stream\";\nimport * as Http from \"node:http\";\nimport { Readable } from \"node:stream\";\nimport { pipeline } from \"node:stream/promises\";\nimport * as ws from \"ws\";\n/**\n * @tsplus static fncts.node.http.ServerOps make\n */\nexport function make(evaluate, options) {\n return tsplus_module_1.flatMap(scope => tsplus_module_1.flatMap(server => tsplus_module_1.flatMap(() => {\n const address = server.address();\n return tsplus_module_1.map(wss => tsplus_module_3.make({\n address: typeof address === \"string\"\n ? { _tag: \"UnixAddress\", path: address }\n : {\n _tag: \"TcpAddress\",\n hostname: address.address === \"::\" ? \"0.0.0.0\" : address.address,\n port: address.port,\n },\n serve: (httpApp, middleware) => tsplus_module_1.flatMap(handler => tsplus_module_1.flatMap(upgradeHandler => tsplus_module_1.flatMap(() => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => void 0, fileName_1 + \":92:12\")(tsplus_module_1.succeed(() => server.on(\"upgrade\", upgradeHandler), fileName_1 + \":92:15\")), fileName_1 + \":91:12\")(tsplus_module_1.succeed(() => server.on(\"request\", handler), fileName_1 + \":91:15\")), fileName_1 + \":83:12\")(tsplus_module_2.addFinalizer(() => tsplus_module_1.succeed(() => {\n server.off(\"request\", handler);\n server.off(\"upgrade\", upgradeHandler);\n }, fileName_1 + \":85:17\"), fileName_1 + \":84:28\")), fileName_1 + \":82:35\")(makeUpgradeHandler(wss, httpApp, middleware)), fileName_1 + \":81:35\")(makeHandler_1(httpApp, middleware)),\n }), fileName_1 + \":60:18\")(tsplus_module_6.memoize(tsplus_module_5.extend(() => tsplus_module_4.acquireRelease(() => tsplus_module_1.succeed(() => new ws.WebSocketServer({ noServer: true }), fileName_1 + \":62:29\"), (wss) => tsplus_module_1.async((resume) => {\n wss.close(() => resume(tsplus_module_1.unit));\n }), fileName_1 + \":62:26\"), fileName_1 + \":61:19\")(scope), fileName_1 + \":67:8\"));\n }, fileName_1 + \":47:6\")(tsplus_module_1.async((resume) => {\n server.on(\"error\", (error) => {\n resume(tsplus_module_1.failNow(new ServeError(error), fileName_1 + \":50:28\"));\n });\n server.listen(options, () => {\n resume(tsplus_module_1.unit);\n });\n })), fileName_1 + \":33:21\")(tsplus_module_4.acquireRelease(() => tsplus_module_1.succeed(evaluate, fileName_1 + \":34:27\"), (server) => tsplus_module_1.async((resume) => {\n server.close((error) => {\n if (error) {\n resume(tsplus_module_1.haltNow(error, fileName_1 + \":38:32\"));\n }\n else {\n resume(tsplus_module_1.unit);\n }\n });\n }), fileName_1 + \":34:24\")), fileName_1 + \":31:20\")(tsplus_module_7.scope);\n}\nfunction makeHandler_1(httpApp, middleware) {\n const handledApp = tsplus_module_9.toHandled((request, exit) => {\n if (tsplus_module_8.isSuccess(exit)) {\n return tsplus_module_1.catchAllCause((cause) => handleCause(request, cause), fileName_1 + \":126:63\")(handleResponse(request, exit.value));\n }\n return handleCause(request, exit.cause);\n }, middleware)(httpApp);\n return tsplus_module_1.map((runFork) => {\n return function handler(nodeRequest, nodeResponse) {\n const fiber = runFork(tsplus_module_11.provideSomeService(new ServerRequestImpl(nodeRequest, nodeResponse), tsplus_module_10.ServerRequestTag, fileName_1 + \":134:38\")(handledApp));\n nodeResponse.on(\"close\", () => {\n if (!nodeResponse.writableEnded) {\n if (!nodeResponse.headersSent) {\n nodeResponse.writeHead(499);\n }\n nodeResponse.end();\n tsplus_module_12.unsafeRunOrFork(fiber.interruptAsFork(clientAbortFiberId));\n }\n });\n };\n }, fileName_1 + \":131:49\")(tsplus_module_13.makeRuntime());\n}\nexport function makeUpgradeHandler(wss, httpApp, middleware) {\n const handledApp = tsplus_module_9.toHandled((request, exit) => {\n if (tsplus_module_8.isSuccess(exit)) {\n return tsplus_module_1.catchAllCause((cause) => handleCause(request, cause), fileName_1 + \":160:63\")(handleResponse(request, exit.value));\n }\n return handleCause(request, exit.cause);\n }, middleware)(httpApp);\n return tsplus_module_1.map((runFork) => {\n return function handler(nodeRequest, socket, head) {\n let nodeResponse_ = undefined;\n const nodeResponse = () => {\n if (nodeResponse_ === undefined) {\n nodeResponse_ = new Http.ServerResponse(nodeRequest);\n nodeResponse_.assignSocket(socket);\n }\n return nodeResponse_;\n };\n const upgradeEffect = tsplus_module_14.fromWebSocket(tsplus_module_1.flatMap((wss) => tsplus_module_4.acquireRelease(() => tsplus_module_1.async((resume) => {\n wss.handleUpgrade(nodeRequest, socket, head, (ws) => {\n resume(tsplus_module_1.succeedNow(ws, fileName_1 + \":182:37\"));\n });\n }), (ws) => tsplus_module_1.succeed(() => ws.close(), fileName_1 + \":185:23\"), fileName_1 + \":179:28\"), fileName_1 + \":178:20\")(wss));\n const fiber = runFork(tsplus_module_11.provideSomeService(new ServerRequestImpl(nodeRequest, nodeResponse, upgradeEffect), tsplus_module_10.ServerRequestTag, fileName_1 + \":191:38\")(handledApp));\n socket.on(\"close\", () => {\n const res = nodeResponse();\n if (!socket.writableEnded) {\n if (!res.headersSent) {\n res.writeHead(499);\n }\n res.end();\n tsplus_module_12.unsafeRunOrFork(fiber.interruptAsFork(clientAbortFiberId));\n }\n });\n };\n }, fileName_1 + \":165:49\")(tsplus_module_13.makeRuntime());\n}\nfunction handleCause(request, cause) {\n return tsplus_module_1.succeed(() => {\n const nodeResponse = request.resolvedResponse;\n if (!nodeResponse.headersSent) {\n nodeResponse.writeHead(tsplus_module_15.isInterruptedOnly(cause) ? 503 : 500);\n }\n if (!nodeResponse.writableEnded) {\n nodeResponse.end();\n }\n }, fileName_1 + \":212:12\");\n}\nexport function handleResponse(request, response) {\n return tsplus_module_1.defer(() => {\n const nodeResponse = request.resolvedResponse;\n if (nodeResponse.writableEnded) {\n return tsplus_module_1.unit;\n }\n else if (request.method === \"HEAD\") {\n nodeResponse.writeHead(response.status, response.headers.toHeadersInit());\n nodeResponse.end();\n return tsplus_module_1.unit;\n }\n tsplus_module_16.concrete(response.body);\n switch (response.body._tag) {\n case 0 /* BodyTag.Empty */: {\n nodeResponse.writeHead(response.status, response.headers.toHeadersInit());\n nodeResponse.end();\n return tsplus_module_1.unit;\n }\n case 1 /* BodyTag.Raw */: {\n nodeResponse.writeHead(response.status, response.headers.toHeadersInit());\n if (typeof response.body.body === \"object\" &&\n response.body.body !== null &&\n \"pipe\" in response.body.body &&\n typeof response.body.body.pipe === \"function\") {\n return tsplus_module_1.fromPromiseCatch(() => pipeline(response.body.body, nodeResponse, { end: true }), (error) => new ResponseError(request, response, \"Decode\", error), fileName_1 + \":248:37\");\n }\n nodeResponse.end(response.body.body);\n return tsplus_module_1.unit;\n }\n case 2 /* BodyTag.Uint8Array */: {\n nodeResponse.writeHead(response.status, response.headers.toHeadersInit());\n nodeResponse.end(response.body.body);\n return tsplus_module_1.unit;\n }\n case 3 /* BodyTag.FormData */: {\n return tsplus_module_1.async((resume) => {\n const r = new Response(response.body.formData);\n const headers = {\n ...response.headers,\n ...Object.fromEntries(r.headers),\n };\n nodeResponse.writeHead(response.status, headers);\n Readable.fromWeb(r.body)\n .pipe(nodeResponse)\n .on(\"error\", (error) => {\n resume(tsplus_module_1.failNow(new ResponseError(request, response, \"Decode\", error), fileName_1 + \":272:32\"));\n })\n .once(\"finish\", () => {\n resume(tsplus_module_1.unit);\n });\n });\n }\n case 4 /* BodyTag.Stream */: {\n nodeResponse.writeHead(response.status, response.headers.toHeadersInit());\n return tsplus_module_17.run(NodeStream.fromWritable(() => nodeResponse, (error) => new ResponseError(request, response, \"Decode\", error)), fileName_1 + \":283:15\")(tsplus_module_17.mapError((error) => new ResponseError(request, response, \"Decode\", error), fileName_1 + \":282:20\")(response.body.stream));\n }\n }\n }, fileName_1 + \":224:18\");\n}\n//# sourceMappingURL=Server.js.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,aAAa;AAkBnB,MAAa,cAAc;;;;AAa3B,SAAgB,KAAK,UA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AS;KACZ,GAAG,OAAO,YAAY,EAAE,QAAQ;KACnC;AACD,iBAAa,UAAU,SAAS,QAAQ,QAAQ;AAChD,aAAS,QAAQ,EAAE,KAAK,CACnB,KAAK,aAAa,CAClB,GAAG,UAAU,UAAU;AACxB,YAAO,gBAAgB,QAAQ,IAAI,cAAc,SAAS,UAAU,UAAU,MAAM,EAAE,aAAa,UAAU,CAAC;MAChH,CACG,KAAK,gBAAgB;AACtB,YAAO,gBAAgB,KAAK;MAC9B;KACJ;GAEN,KAAK;AACD,iBAAa,UAAU,SAAS,QAAQ,SAAS,QAAQ,eAAe,CAAC;AACzE,WAAO,iBAAiB,IAAI,WAAW,mBAAmB,eAAe,UAAU,IAAI,cAAc,SAAS,UAAU,UAAU,MAAM,CAAC,EAAE,aAAa,UAAU,CAAC,iBAAiB,UAAU,UAAU,IAAI,cAAc,SAAS,UAAU,UAAU,MAAM,EAAE,aAAa,UAAU,CAAC,SAAS,KAAK,OAAO,CAAC;;IAGtT,aAAa,UAAU"}
|
|
1
|
+
{"version":3,"file":"Server.mjs","names":[],"sources":["../../esm/http/Server.js"],"sourcesContent":["const fileName_1 = \"(@fncts/node) src/http/Server.ts\";\nimport * as tsplus_module_1 from \"@fncts/io/IO/api\";\nimport * as tsplus_module_2 from \"@fncts/io/IO/api/addFinalizer\";\nimport * as tsplus_module_3 from \"@fncts/http/Server\";\nimport * as tsplus_module_4 from \"@fncts/io/IO/api/acquireRelease\";\nimport * as tsplus_module_5 from \"@fncts/io/Scope/api\";\nimport * as tsplus_module_6 from \"@fncts/io/IO/api/memoize\";\nimport * as tsplus_module_7 from \"@fncts/io/IO/api/scope\";\nimport * as tsplus_module_8 from \"@fncts/base/data/Exit/definition\";\nimport * as tsplus_module_9 from \"@fncts/http/HttpApp\";\nimport * as tsplus_module_10 from \"@fncts/http/ServerRequest/definition\";\nimport * as tsplus_module_11 from \"@fncts/io/IO/api/environment\";\nimport * as tsplus_module_12 from \"@fncts/io/IO/runtime\";\nimport * as tsplus_module_13 from \"@fncts/io/FiberSet\";\nimport * as tsplus_module_14 from \"@fncts/http/Socket\";\nimport * as tsplus_module_15 from \"@fncts/base/data/Cause/api\";\nimport * as tsplus_module_16 from \"@fncts/http/Body/definition\";\nimport * as tsplus_module_17 from \"@fncts/io/Stream/api\";\nexport const makeHandler = makeHandler_1;\nimport { ResponseError } from \"@fncts/http/ResponseError\";\nimport { Server } from \"@fncts/http/Server\";\nimport { clientAbortFiberId, ServeError } from \"@fncts/http/ServerError\";\nimport { ServerRequestImpl } from \"@fncts/node/http/ServerRequest\";\nimport * as NodeStream from \"@fncts/node/stream\";\nimport * as Http from \"node:http\";\nimport { Readable } from \"node:stream\";\nimport { pipeline } from \"node:stream/promises\";\nimport * as ws from \"ws\";\n/**\n * @tsplus static fncts.node.http.ServerOps make\n */\nexport function make(evaluate, options) {\n return tsplus_module_1.flatMap(scope => tsplus_module_1.flatMap(server => tsplus_module_1.flatMap(() => {\n const address = server.address();\n return tsplus_module_1.map(wss => tsplus_module_3.make({\n address: typeof address === \"string\"\n ? { _tag: \"UnixAddress\", path: address }\n : {\n _tag: \"TcpAddress\",\n hostname: address.address === \"::\" ? \"0.0.0.0\" : address.address,\n port: address.port,\n },\n serve: (httpApp, middleware) => tsplus_module_1.flatMap(handler => tsplus_module_1.flatMap(upgradeHandler => tsplus_module_1.flatMap(() => tsplus_module_1.flatMap(() => tsplus_module_1.map(() => void 0, fileName_1 + \":92:12\")(tsplus_module_1.succeed(() => server.on(\"upgrade\", upgradeHandler), fileName_1 + \":92:15\")), fileName_1 + \":91:12\")(tsplus_module_1.succeed(() => server.on(\"request\", handler), fileName_1 + \":91:15\")), fileName_1 + \":83:12\")(tsplus_module_2.addFinalizer(() => tsplus_module_1.succeed(() => {\n server.off(\"request\", handler);\n server.off(\"upgrade\", upgradeHandler);\n }, fileName_1 + \":85:17\"), fileName_1 + \":84:28\")), fileName_1 + \":82:35\")(makeUpgradeHandler(wss, httpApp, middleware)), fileName_1 + \":81:35\")(makeHandler_1(httpApp, middleware)),\n }), fileName_1 + \":60:18\")(tsplus_module_6.memoize(tsplus_module_5.extend(() => tsplus_module_4.acquireRelease(() => tsplus_module_1.succeed(() => new ws.WebSocketServer({ noServer: true }), fileName_1 + \":62:29\"), (wss) => tsplus_module_1.async((resume) => {\n wss.close(() => resume(tsplus_module_1.unit));\n }), fileName_1 + \":62:26\"), fileName_1 + \":61:19\")(scope), fileName_1 + \":67:8\"));\n }, fileName_1 + \":47:6\")(tsplus_module_1.async((resume) => {\n server.on(\"error\", (error) => {\n resume(tsplus_module_1.failNow(new ServeError(error), fileName_1 + \":50:28\"));\n });\n server.listen(options, () => {\n resume(tsplus_module_1.unit);\n });\n })), fileName_1 + \":33:21\")(tsplus_module_4.acquireRelease(() => tsplus_module_1.succeed(evaluate, fileName_1 + \":34:27\"), (server) => tsplus_module_1.async((resume) => {\n server.close((error) => {\n if (error) {\n resume(tsplus_module_1.haltNow(error, fileName_1 + \":38:32\"));\n }\n else {\n resume(tsplus_module_1.unit);\n }\n });\n }), fileName_1 + \":34:24\")), fileName_1 + \":31:20\")(tsplus_module_7.scope);\n}\nfunction makeHandler_1(httpApp, middleware) {\n const handledApp = tsplus_module_9.toHandled((request, exit) => {\n if (tsplus_module_8.isSuccess(exit)) {\n return tsplus_module_1.catchAllCause((cause) => handleCause(request, cause), fileName_1 + \":126:63\")(handleResponse(request, exit.value));\n }\n return handleCause(request, exit.cause);\n }, middleware)(httpApp);\n return tsplus_module_1.map((runFork) => {\n return function handler(nodeRequest, nodeResponse) {\n const fiber = runFork(tsplus_module_11.provideSomeService(new ServerRequestImpl(nodeRequest, nodeResponse), tsplus_module_10.ServerRequestTag, fileName_1 + \":134:38\")(handledApp));\n nodeResponse.on(\"close\", () => {\n if (!nodeResponse.writableEnded) {\n if (!nodeResponse.headersSent) {\n nodeResponse.writeHead(499);\n }\n nodeResponse.end();\n tsplus_module_12.unsafeRunOrFork(fiber.interruptAsFork(clientAbortFiberId));\n }\n });\n };\n }, fileName_1 + \":131:49\")(tsplus_module_13.makeRuntime());\n}\nexport function makeUpgradeHandler(wss, httpApp, middleware) {\n const handledApp = tsplus_module_9.toHandled((request, exit) => {\n if (tsplus_module_8.isSuccess(exit)) {\n return tsplus_module_1.catchAllCause((cause) => handleCause(request, cause), fileName_1 + \":160:63\")(handleResponse(request, exit.value));\n }\n return handleCause(request, exit.cause);\n }, middleware)(httpApp);\n return tsplus_module_1.map((runFork) => {\n return function handler(nodeRequest, socket, head) {\n let nodeResponse_ = undefined;\n const nodeResponse = () => {\n if (nodeResponse_ === undefined) {\n nodeResponse_ = new Http.ServerResponse(nodeRequest);\n nodeResponse_.assignSocket(socket);\n }\n return nodeResponse_;\n };\n const upgradeEffect = tsplus_module_14.fromWebSocket(tsplus_module_1.flatMap((wss) => tsplus_module_4.acquireRelease(() => tsplus_module_1.async((resume) => {\n wss.handleUpgrade(nodeRequest, socket, head, (ws) => {\n resume(tsplus_module_1.succeedNow(ws, fileName_1 + \":182:37\"));\n });\n }), (ws) => tsplus_module_1.succeed(() => ws.close(), fileName_1 + \":185:23\"), fileName_1 + \":179:28\"), fileName_1 + \":178:20\")(wss));\n const fiber = runFork(tsplus_module_11.provideSomeService(new ServerRequestImpl(nodeRequest, nodeResponse, upgradeEffect), tsplus_module_10.ServerRequestTag, fileName_1 + \":191:38\")(handledApp));\n socket.on(\"close\", () => {\n const res = nodeResponse();\n if (!socket.writableEnded) {\n if (!res.headersSent) {\n res.writeHead(499);\n }\n res.end();\n tsplus_module_12.unsafeRunOrFork(fiber.interruptAsFork(clientAbortFiberId));\n }\n });\n };\n }, fileName_1 + \":165:49\")(tsplus_module_13.makeRuntime());\n}\nfunction handleCause(request, cause) {\n return tsplus_module_1.succeed(() => {\n const nodeResponse = request.resolvedResponse;\n if (!nodeResponse.headersSent) {\n nodeResponse.writeHead(tsplus_module_15.isInterruptedOnly(cause) ? 503 : 500);\n }\n if (!nodeResponse.writableEnded) {\n nodeResponse.end();\n }\n }, fileName_1 + \":212:12\");\n}\nexport function handleResponse(request, response) {\n return tsplus_module_1.defer(() => {\n const nodeResponse = request.resolvedResponse;\n if (nodeResponse.writableEnded) {\n return tsplus_module_1.unit;\n }\n else if (request.method === \"HEAD\") {\n nodeResponse.writeHead(response.status, response.headers.toHeadersInit());\n nodeResponse.end();\n return tsplus_module_1.unit;\n }\n tsplus_module_16.concrete(response.body);\n switch (response.body._tag) {\n case 0 /* BodyTag.Empty */: {\n nodeResponse.writeHead(response.status, response.headers.toHeadersInit());\n nodeResponse.end();\n return tsplus_module_1.unit;\n }\n case 1 /* BodyTag.Raw */: {\n nodeResponse.writeHead(response.status, response.headers.toHeadersInit());\n if (typeof response.body.body === \"object\" &&\n response.body.body !== null &&\n \"pipe\" in response.body.body &&\n typeof response.body.body.pipe === \"function\") {\n return tsplus_module_1.fromPromiseCatch(() => pipeline(response.body.body, nodeResponse, { end: true }), (error) => new ResponseError(request, response, \"Decode\", error), fileName_1 + \":248:37\");\n }\n nodeResponse.end(response.body.body);\n return tsplus_module_1.unit;\n }\n case 2 /* BodyTag.Uint8Array */: {\n nodeResponse.writeHead(response.status, response.headers.toHeadersInit());\n nodeResponse.end(response.body.body);\n return tsplus_module_1.unit;\n }\n case 3 /* BodyTag.FormData */: {\n return tsplus_module_1.async((resume) => {\n const r = new Response(response.body.formData);\n const headers = {\n ...response.headers,\n ...Object.fromEntries(r.headers),\n };\n nodeResponse.writeHead(response.status, headers);\n Readable.fromWeb(r.body)\n .pipe(nodeResponse)\n .on(\"error\", (error) => {\n resume(tsplus_module_1.failNow(new ResponseError(request, response, \"Decode\", error), fileName_1 + \":272:32\"));\n })\n .once(\"finish\", () => {\n resume(tsplus_module_1.unit);\n });\n });\n }\n case 4 /* BodyTag.Stream */: {\n nodeResponse.writeHead(response.status, response.headers.toHeadersInit());\n return tsplus_module_17.run(NodeStream.fromWritable(() => nodeResponse, (error) => new ResponseError(request, response, \"Decode\", error)), fileName_1 + \":283:15\")(tsplus_module_17.mapError((error) => new ResponseError(request, response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from "@fncts/http/RequestError";
|
|
3
3
|
import { ServerRequestTypeId } from "@fncts/http/ServerRequest";
|
|
4
4
|
import { IncomingMessageImpl } from "@fncts/node/http/IncomingMessage";
|
|
5
|
-
|
|
6
|
-
const fileName_1 = "(@fncts/node) src/http/ServerRequest.ts";
|
|
5
|
+
// build/esm/http/ServerRequest.js
|
|
7
6
|
var ServerRequestImpl = class ServerRequestImpl extends IncomingMessageImpl {
|
|
8
7
|
source;
|
|
9
8
|
response;
|
|
@@ -32,10 +31,9 @@ var ServerRequestImpl = class ServerRequestImpl extends IncomingMessageImpl {
|
|
|
32
31
|
return this.source.method.toUpperCase();
|
|
33
32
|
}
|
|
34
33
|
get upgrade() {
|
|
35
|
-
return this.upgradeEffect ?? tsplus_module_1.failNow(new RequestError(this, "Decode", "Not an upgradeable ServerRequest"),
|
|
34
|
+
return this.upgradeEffect ?? tsplus_module_1.failNow(new RequestError(this, "Decode", "Not an upgradeable ServerRequest"), "(@fncts/node) src/http/ServerRequest.ts:52:44");
|
|
36
35
|
}
|
|
37
36
|
};
|
|
38
|
-
//#endregion
|
|
39
37
|
export { ServerRequestImpl };
|
|
40
38
|
|
|
41
39
|
//# sourceMappingURL=ServerRequest.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerRequest.mjs","names":[],"sources":["../../esm/http/ServerRequest.js"],"sourcesContent":["const fileName_1 = \"(@fncts/node) src/http/ServerRequest.ts\";\nimport * as tsplus_module_1 from \"@fncts/io/IO/api\";\nimport { RequestError } from \"@fncts/http/RequestError\";\nimport { ServerRequestTypeId } from \"@fncts/http/ServerRequest\";\nimport { IncomingMessageImpl } from \"@fncts/node/http/IncomingMessage\";\nexport class ServerRequestImpl extends IncomingMessageImpl {\n source;\n response;\n upgradeEffect;\n url;\n headersOverride;\n [ServerRequestTypeId] = ServerRequestTypeId;\n constructor(source, response, upgradeEffect, url = source.url, headersOverride, remoteAddressOverride) {\n super(source, (error) => new RequestError(this, \"Decode\", error), remoteAddressOverride);\n this.source = source;\n this.response = response;\n this.upgradeEffect = upgradeEffect;\n this.url = url;\n this.headersOverride = headersOverride;\n }\n get resolvedResponse() {\n return typeof this.response === \"function\" ? this.response() : this.response;\n }\n modify(options) {\n return new ServerRequestImpl(this.source, this.response, this.upgradeEffect, options.url ?? this.url, options.headers ?? this.headersOverride, options.remoteAddress ?? this.remoteAddressOverride);\n }\n get originalUrl() {\n return this.source.url;\n }\n get method() {\n return this.source.method.toUpperCase();\n }\n get upgrade() {\n return this.upgradeEffect ?? tsplus_module_1.failNow(new RequestError(this, \"Decode\", \"Not an upgradeable ServerRequest\"), fileName_1 + \":52:44\");\n }\n}\n//# sourceMappingURL=ServerRequest.js.map"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"ServerRequest.mjs","names":[],"sources":["../../esm/http/ServerRequest.js"],"sourcesContent":["const fileName_1 = \"(@fncts/node) src/http/ServerRequest.ts\";\nimport * as tsplus_module_1 from \"@fncts/io/IO/api\";\nimport { RequestError } from \"@fncts/http/RequestError\";\nimport { ServerRequestTypeId } from \"@fncts/http/ServerRequest\";\nimport { IncomingMessageImpl } from \"@fncts/node/http/IncomingMessage\";\nexport class ServerRequestImpl extends IncomingMessageImpl {\n source;\n response;\n upgradeEffect;\n url;\n headersOverride;\n [ServerRequestTypeId] = ServerRequestTypeId;\n constructor(source, response, upgradeEffect, url = source.url, headersOverride, remoteAddressOverride) {\n super(source, (error) => new RequestError(this, \"Decode\", error), remoteAddressOverride);\n this.source = source;\n this.response = response;\n this.upgradeEffect = upgradeEffect;\n this.url = url;\n this.headersOverride = headersOverride;\n }\n get resolvedResponse() {\n return typeof this.response === \"function\" ? this.response() : this.response;\n }\n modify(options) {\n return new ServerRequestImpl(this.source, this.response, this.upgradeEffect, options.url ?? this.url, options.headers ?? this.headersOverride, options.remoteAddress ?? this.remoteAddressOverride);\n }\n get originalUrl() {\n return this.source.url;\n }\n get method() {\n return this.source.method.toUpperCase();\n }\n get upgrade() {\n return this.upgradeEffect ?? tsplus_module_1.failNow(new RequestError(this, \"Decode\", \"Not an upgradeable ServerRequest\"), fileName_1 + \":52:44\");\n }\n}\n//# sourceMappingURL=ServerRequest.js.map"],"mappings":";;;;;AAKA,IAAa,oBAAb,MAAa,0BAA0B,oBAAoB;CACvD;CACA;CACA;CACA;CACA;CACA,CAAC,uBAAuB;CACxB,YAAY,QAAQ,UAAU,eAAe,MAAM,OAAO,KAAK,iBAAiB,uBAAuB;EACnG,MAAM,SAAS,UAAU,IAAI,aAAa,MAAM,UAAU,KAAK,GAAG,qBAAqB;EACvF,KAAK,SAAS;EACd,KAAK,WAAW;EAChB,KAAK,gBAAgB;EACrB,KAAK,MAAM;EACX,KAAK,kBAAkB;CAC3B;CACA,IAAI,mBAAmB;EACnB,OAAO,OAAO,KAAK,aAAa,aAAa,KAAK,SAAS,IAAI,KAAK;CACxE;CACA,OAAO,SAAS;EACZ,OAAO,IAAI,kBAAkB,KAAK,QAAQ,KAAK,UAAU,KAAK,eAAe,QAAQ,OAAO,KAAK,KAAK,QAAQ,WAAW,KAAK,iBAAiB,QAAQ,iBAAiB,KAAK,qBAAqB;CACtM;CACA,IAAI,cAAc;EACd,OAAO,KAAK,OAAO;CACvB;CACA,IAAI,SAAS;EACT,OAAO,KAAK,OAAO,OAAO,YAAY;CAC1C;CACA,IAAI,UAAU;EACV,OAAO,KAAK,iBAAiB,gBAAgB,QAAQ,IAAI,aAAa,MAAM,UAAU,kCAAkC,GAAG,+CAAqB;CACpJ;AACJ"}
|
package/_mjs/stream/api.mjs
CHANGED
|
@@ -23,7 +23,7 @@ import * as tsplus_module_22 from "@fncts/base/collection/immutable/Conc/constru
|
|
|
23
23
|
import * as tsplus_module_23 from "@fncts/base/data/Maybe/constructors";
|
|
24
24
|
import * as tsplus_module_24 from "@fncts/io/IO/api/scoped";
|
|
25
25
|
import { Stream } from "@fncts/io/Stream";
|
|
26
|
-
|
|
26
|
+
// build/esm/stream/api.js
|
|
27
27
|
const fileName_1 = "(@fncts/node) src/stream/api.ts";
|
|
28
28
|
var ReadableError = class {
|
|
29
29
|
error;
|
|
@@ -204,7 +204,6 @@ function toUint8Array(readable, onFailure, options = {}) {
|
|
|
204
204
|
if ("closed" in stream && !stream.closed) stream.destroy();
|
|
205
205
|
}, fileName_1 + ":314:9"), fileName_1 + ":313:20")), fileName_1 + ":343:6");
|
|
206
206
|
}
|
|
207
|
-
//#endregion
|
|
208
207
|
export { ReadableError, TransformError, fromReadable, fromWritable, fromWritableChannel, toString, toUint8Array, transform };
|
|
209
208
|
|
|
210
209
|
//# sourceMappingURL=api.mjs.map
|