@adviser/cement 0.1.11 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- package/base_sys_abstraction-BCdXJHNa.d.ts +21 -0
- package/base_sys_abstraction-BYZvxqsW.d.cts +21 -0
- package/chunk-J2IM7FHM.js +65 -0
- package/chunk-J2IM7FHM.js.map +1 -0
- package/chunk-MWAFFTM4.js +82 -0
- package/chunk-MWAFFTM4.js.map +1 -0
- package/chunk-PZTL4UNG.js +233 -0
- package/chunk-PZTL4UNG.js.map +1 -0
- package/index.cjs +986 -0
- package/index.cjs.map +1 -0
- package/index.d.cts +196 -0
- package/index.d.ts +196 -11
- package/index.js +610 -26
- package/index.js.map +1 -1
- package/node/index.cjs +436 -0
- package/node/index.cjs.map +1 -0
- package/node/index.d.cts +47 -0
- package/node/index.d.ts +47 -4
- package/node/index.js +215 -17
- package/node/index.js.map +1 -1
- package/package.json +34 -8
- package/sys_abstraction-CjljYIkv.d.cts +65 -0
- package/sys_abstraction-CjljYIkv.d.ts +65 -0
- package/utils/index.cjs +270 -0
- package/utils/index.cjs.map +1 -0
- package/utils/index.d.cts +33 -0
- package/utils/index.d.ts +33 -6
- package/utils/index.js +232 -20
- package/utils/index.js.map +1 -1
- package/web/index.cjs +286 -0
- package/web/index.cjs.map +1 -0
- package/web/index.d.cts +6 -0
- package/web/index.d.ts +6 -2
- package/web/index.js +7 -16
- package/web/index.js.map +1 -1
- package/base_sys_abstraction.d.ts +0 -79
- package/base_sys_abstraction.d.ts.map +0 -1
- package/base_sys_abstraction.js +0 -186
- package/base_sys_abstraction.js.map +0 -1
- package/base_sys_abstraction.test.d.ts +0 -2
- package/base_sys_abstraction.test.d.ts.map +0 -1
- package/base_sys_abstraction.test.js +0 -77
- package/base_sys_abstraction.test.js.map +0 -1
- package/file_service.d.ts +0 -18
- package/file_service.d.ts.map +0 -1
- package/file_service.js +0 -3
- package/file_service.js.map +0 -1
- package/future.d.ts +0 -8
- package/future.d.ts.map +0 -1
- package/future.js +0 -42
- package/future.js.map +0 -1
- package/future.test.d.ts +0 -2
- package/future.test.d.ts.map +0 -1
- package/future.test.js +0 -30
- package/future.test.js.map +0 -1
- package/index.d.ts.map +0 -1
- package/logger.d.ts +0 -36
- package/logger.d.ts.map +0 -1
- package/logger.js +0 -11
- package/logger.js.map +0 -1
- package/logger.test.d.ts +0 -2
- package/logger.test.d.ts.map +0 -1
- package/logger.test.js +0 -372
- package/logger.test.js.map +0 -1
- package/logger_impl.d.ts +0 -64
- package/logger_impl.d.ts.map +0 -1
- package/logger_impl.js +0 -331
- package/logger_impl.js.map +0 -1
- package/node/index.d.ts.map +0 -1
- package/node/mock_file_service.d.ts +0 -11
- package/node/mock_file_service.d.ts.map +0 -1
- package/node/mock_file_service.js +0 -38
- package/node/mock_file_service.js.map +0 -1
- package/node/mock_file_service.test.d.ts +0 -2
- package/node/mock_file_service.test.d.ts.map +0 -1
- package/node/mock_file_service.test.js +0 -19
- package/node/mock_file_service.test.js.map +0 -1
- package/node/node_file_service.d.ts +0 -16
- package/node/node_file_service.d.ts.map +0 -1
- package/node/node_file_service.js +0 -84
- package/node/node_file_service.js.map +0 -1
- package/node/node_sys_abstraction.d.ts +0 -21
- package/node/node_sys_abstraction.d.ts.map +0 -1
- package/node/node_sys_abstraction.js +0 -101
- package/node/node_sys_abstraction.js.map +0 -1
- package/node/node_sys_abstraction.test.d.ts +0 -2
- package/node/node_sys_abstraction.test.d.ts.map +0 -1
- package/node/node_sys_abstraction.test.js +0 -57
- package/node/node_sys_abstraction.test.js.map +0 -1
- package/option.d.ts +0 -25
- package/option.d.ts.map +0 -1
- package/option.js +0 -53
- package/option.js.map +0 -1
- package/result.d.ts +0 -31
- package/result.d.ts.map +0 -1
- package/result.js +0 -69
- package/result.js.map +0 -1
- package/result.test.d.ts +0 -2
- package/result.test.d.ts.map +0 -1
- package/result.test.js +0 -39
- package/result.test.js.map +0 -1
- package/sys_abstraction.d.ts +0 -35
- package/sys_abstraction.d.ts.map +0 -1
- package/sys_abstraction.js +0 -35
- package/sys_abstraction.js.map +0 -1
- package/test/log_collector.d.ts +0 -22
- package/test/log_collector.d.ts.map +0 -1
- package/test/log_collector.js +0 -66
- package/test/log_collector.js.map +0 -1
- package/test/mock_logger.d.ts +0 -13
- package/test/mock_logger.d.ts.map +0 -1
- package/test/mock_logger.js +0 -30
- package/test/mock_logger.js.map +0 -1
- package/test/mock_logger.test.d.ts +0 -2
- package/test/mock_logger.test.d.ts.map +0 -1
- package/test/mock_logger.test.js +0 -49
- package/test/mock_logger.test.js.map +0 -1
- package/test/test-exit-handler.d.ts +0 -1
- package/test/test-exit-handler.d.ts.map +0 -1
- package/test/test-exit-handler.js +0 -76
- package/test/test-exit-handler.js.map +0 -1
- package/time.d.ts +0 -13
- package/time.d.ts.map +0 -1
- package/time.js +0 -18
- package/time.js.map +0 -1
- package/utils/index.d.ts.map +0 -1
- package/utils/rebuffer.d.ts +0 -3
- package/utils/rebuffer.d.ts.map +0 -1
- package/utils/rebuffer.js +0 -65
- package/utils/rebuffer.js.map +0 -1
- package/utils/rebuffer.test.d.ts +0 -2
- package/utils/rebuffer.test.d.ts.map +0 -1
- package/utils/rebuffer.test.js +0 -79
- package/utils/rebuffer.test.js.map +0 -1
- package/utils/stream2string.d.ts +0 -3
- package/utils/stream2string.d.ts.map +0 -1
- package/utils/stream2string.js +0 -53
- package/utils/stream2string.js.map +0 -1
- package/utils/stream2string.test.d.ts +0 -2
- package/utils/stream2string.test.d.ts.map +0 -1
- package/utils/stream2string.test.js +0 -31
- package/utils/stream2string.test.js.map +0 -1
- package/utils/stream_map.d.ts +0 -9
- package/utils/stream_map.d.ts.map +0 -1
- package/utils/stream_map.js +0 -67
- package/utils/stream_map.js.map +0 -1
- package/utils/stream_map.test.d.ts +0 -2
- package/utils/stream_map.test.d.ts.map +0 -1
- package/utils/stream_map.test.js +0 -89
- package/utils/stream_map.test.js.map +0 -1
- package/utils/stream_test_helper.d.ts +0 -15
- package/utils/stream_test_helper.d.ts.map +0 -1
- package/utils/stream_test_helper.js +0 -42
- package/utils/stream_test_helper.js.map +0 -1
- package/utils/string2stream.d.ts +0 -3
- package/utils/string2stream.d.ts.map +0 -1
- package/utils/string2stream.js +0 -18
- package/utils/string2stream.js.map +0 -1
- package/utils/string2stream.test.d.ts +0 -2
- package/utils/string2stream.test.d.ts.map +0 -1
- package/utils/string2stream.test.js +0 -9
- package/utils/string2stream.test.js.map +0 -1
- package/web/index.d.ts.map +0 -1
- package/web/web_sys_abstraction.d.ts +0 -4
- package/web/web_sys_abstraction.d.ts.map +0 -1
- package/web/web_sys_abstraction.js +0 -65
- package/web/web_sys_abstraction.js.map +0 -1
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"mock_logger.d.ts","sourceRoot":"","sources":["../../src/test/mock_logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;CACrC;AAED,wBAAgB,UAAU,CAAC,MAAM,CAAC,EAAE;IAClC,QAAQ,CAAC,GAAG,CAAC,EAAE,cAAc,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC/B,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;CACjC,GAAG,gBAAgB,CAqBnB"}
|
package/test/mock_logger.js
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.MockLogger = void 0;
|
4
|
-
const logger_impl_1 = require("../logger_impl");
|
5
|
-
const log_collector_1 = require("./log_collector");
|
6
|
-
function MockLogger(params) {
|
7
|
-
const lc = new log_collector_1.LogCollector();
|
8
|
-
let modNames = ["MockLogger"];
|
9
|
-
if (typeof (params === null || params === void 0 ? void 0 : params.moduleName) === "string") {
|
10
|
-
modNames = [params === null || params === void 0 ? void 0 : params.moduleName];
|
11
|
-
}
|
12
|
-
else if (Array.isArray(params === null || params === void 0 ? void 0 : params.moduleName)) {
|
13
|
-
modNames = [...params.moduleName, ...modNames];
|
14
|
-
}
|
15
|
-
const logger = new logger_impl_1.LoggerImpl({
|
16
|
-
out: lc,
|
17
|
-
sys: params === null || params === void 0 ? void 0 : params.sys,
|
18
|
-
levelHandler: new logger_impl_1.LevelHandlerImpl(),
|
19
|
-
})
|
20
|
-
.With()
|
21
|
-
.Module(modNames[0])
|
22
|
-
.Logger();
|
23
|
-
!(params === null || params === void 0 ? void 0 : params.disableDebug) && logger.SetDebug(...modNames);
|
24
|
-
return {
|
25
|
-
logCollector: lc,
|
26
|
-
logger,
|
27
|
-
};
|
28
|
-
}
|
29
|
-
exports.MockLogger = MockLogger;
|
30
|
-
//# sourceMappingURL=mock_logger.js.map
|
package/test/mock_logger.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"mock_logger.js","sourceRoot":"","sources":["../../src/test/mock_logger.ts"],"names":[],"mappings":";;;AACA,gDAA8D;AAE9D,mDAA+C;AAO/C,SAAgB,UAAU,CAAC,MAI1B;IACC,MAAM,EAAE,GAAG,IAAI,4BAAY,EAAE,CAAC;IAC9B,IAAI,QAAQ,GAAG,CAAC,YAAY,CAAC,CAAC;IAC9B,IAAI,OAAO,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,CAAA,KAAK,QAAQ,EAAE,CAAC;QAC3C,QAAQ,GAAG,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,CAAC,CAAC;IAClC,CAAC;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,CAAC,EAAE,CAAC;QAC7C,QAAQ,GAAG,CAAC,GAAG,MAAM,CAAC,UAAU,EAAE,GAAG,QAAQ,CAAC,CAAC;IACjD,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,wBAAU,CAAC;QAC5B,GAAG,EAAE,EAAE;QACP,GAAG,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,GAAG;QAChB,YAAY,EAAE,IAAI,8BAAgB,EAAE;KACrC,CAAC;SACC,IAAI,EAAE;SACN,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;SACnB,MAAM,EAAE,CAAC;IACZ,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY,CAAA,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC;IACtD,OAAO;QACL,YAAY,EAAE,EAAE;QAChB,MAAM;KACP,CAAC;AACJ,CAAC;AAzBD,gCAyBC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"mock_logger.test.d.ts","sourceRoot":"","sources":["../../src/test/mock_logger.test.ts"],"names":[],"mappings":""}
|
package/test/mock_logger.test.js
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const mock_logger_1 = require("./mock_logger");
|
4
|
-
describe("logger", () => {
|
5
|
-
it("with logcollector", async () => {
|
6
|
-
const l = (0, mock_logger_1.MockLogger)();
|
7
|
-
l.logger.Debug().Str("bla1", "blub1").Msg("hello1");
|
8
|
-
l.logger.Info().Str("bla2", "blub2").Msg("hello2");
|
9
|
-
await l.logger.Flush();
|
10
|
-
expect(l.logCollector.Logs()).toEqual([
|
11
|
-
{ level: "debug", bla1: "blub1", msg: "hello1", module: "MockLogger" },
|
12
|
-
{ level: "info", bla2: "blub2", msg: "hello2", module: "MockLogger" },
|
13
|
-
]);
|
14
|
-
});
|
15
|
-
it("with logcollector disableDebug", async () => {
|
16
|
-
const l = (0, mock_logger_1.MockLogger)({
|
17
|
-
disableDebug: true,
|
18
|
-
});
|
19
|
-
l.logger.Debug().Str("bla1", "blub1").Msg("hello1");
|
20
|
-
l.logger.Info().Str("bla2", "blub2").Msg("hello2");
|
21
|
-
await l.logger.Flush();
|
22
|
-
expect(l.logCollector.Logs()).toEqual([{ level: "info", bla2: "blub2", msg: "hello2", module: "MockLogger" }]);
|
23
|
-
});
|
24
|
-
it("with logcollector moduleName", async () => {
|
25
|
-
const l = (0, mock_logger_1.MockLogger)({
|
26
|
-
moduleName: "test",
|
27
|
-
});
|
28
|
-
l.logger.Debug().Str("bla1", "blub1").Msg("hello1");
|
29
|
-
l.logger.Info().Str("bla2", "blub2").Msg("hello2");
|
30
|
-
await l.logger.Flush();
|
31
|
-
expect(l.logCollector.Logs()).toEqual([
|
32
|
-
{ level: "debug", bla1: "blub1", msg: "hello1", module: "test" },
|
33
|
-
{ level: "info", bla2: "blub2", msg: "hello2", module: "test" },
|
34
|
-
]);
|
35
|
-
});
|
36
|
-
it("with logcollector [moduleName]", async () => {
|
37
|
-
const l = (0, mock_logger_1.MockLogger)({
|
38
|
-
moduleName: ["test", "wurst"],
|
39
|
-
});
|
40
|
-
l.logger.Debug().Str("bla1", "blub1").Msg("hello1");
|
41
|
-
l.logger.With().Module("wurst").Logger().Debug().Str("bla2", "blub2").Msg("hello2");
|
42
|
-
await l.logger.Flush();
|
43
|
-
expect(l.logCollector.Logs()).toEqual([
|
44
|
-
{ level: "debug", bla1: "blub1", msg: "hello1", module: "test" },
|
45
|
-
{ level: "debug", bla2: "blub2", msg: "hello2", module: "wurst" },
|
46
|
-
]);
|
47
|
-
});
|
48
|
-
});
|
49
|
-
//# sourceMappingURL=mock_logger.test.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"mock_logger.test.js","sourceRoot":"","sources":["../../src/test/mock_logger.test.ts"],"names":[],"mappings":";;AAAA,+CAA2C;AAE3C,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,EAAE,CAAC,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IAAI,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACpF,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACvB,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC;YACpC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE;YAChE,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE;SAClE,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
//# sourceMappingURL=test-exit-handler.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"test-exit-handler.d.ts","sourceRoot":"","sources":["../../src/test/test-exit-handler.ts"],"names":[],"mappings":""}
|
@@ -1,76 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
|
-
(async () => {
|
26
|
-
const sa = await Promise.resolve().then(() => __importStar(require("../node/node_sys_abstraction")));
|
27
|
-
const my = sa.NodeSysAbstraction();
|
28
|
-
const larg = process.argv[process.argv.length - 1];
|
29
|
-
console.log(JSON.stringify({
|
30
|
-
larg,
|
31
|
-
pid: process.pid,
|
32
|
-
}));
|
33
|
-
my.System().OnExit(async () => {
|
34
|
-
await my.Time().Sleep(100);
|
35
|
-
console.log(JSON.stringify({
|
36
|
-
larg,
|
37
|
-
pid: process.pid,
|
38
|
-
msg: "Called OnExit 1",
|
39
|
-
}));
|
40
|
-
});
|
41
|
-
my.System().OnExit(async () => {
|
42
|
-
await my.Time().Sleep(200);
|
43
|
-
console.log(JSON.stringify({
|
44
|
-
larg,
|
45
|
-
pid: process.pid,
|
46
|
-
msg: "Called OnExit 2",
|
47
|
-
}));
|
48
|
-
});
|
49
|
-
switch (larg) {
|
50
|
-
case "sigint":
|
51
|
-
await my.Time().Sleep(100);
|
52
|
-
process.kill(process.pid, "SIGINT");
|
53
|
-
await my.Time().Sleep(1000000);
|
54
|
-
break;
|
55
|
-
case "sigquit":
|
56
|
-
await my.Time().Sleep(100);
|
57
|
-
process.kill(process.pid, "SIGQUIT");
|
58
|
-
await my.Time().Sleep(1000000);
|
59
|
-
break;
|
60
|
-
case "sigterm":
|
61
|
-
await my.Time().Sleep(100);
|
62
|
-
process.kill(process.pid, "SIGTERM");
|
63
|
-
await my.Time().Sleep(1000000);
|
64
|
-
break;
|
65
|
-
case "throw":
|
66
|
-
await my.Time().Sleep(100);
|
67
|
-
throw new Error("throwing");
|
68
|
-
case "sleep":
|
69
|
-
await my.Time().Sleep(3000);
|
70
|
-
break;
|
71
|
-
case "exit24":
|
72
|
-
default:
|
73
|
-
my.System().Exit(24);
|
74
|
-
}
|
75
|
-
})();
|
76
|
-
//# sourceMappingURL=test-exit-handler.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"test-exit-handler.js","sourceRoot":"","sources":["../../src/test/test-exit-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,CAAC,KAAK,IAAI,EAAE;IACV,MAAM,EAAE,GAAG,wDAAa,8BAA8B,GAAC,CAAC;IAExD,MAAM,EAAE,GAAG,EAAE,CAAC,kBAAkB,EAAE,CAAC;IAEnC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACnD,OAAO,CAAC,GAAG,CACT,IAAI,CAAC,SAAS,CAAC;QACb,IAAI;QACJ,GAAG,EAAE,OAAO,CAAC,GAAG;KACjB,CAAC,CACH,CAAC;IAEF,EAAE,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;QAC5B,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3B,OAAO,CAAC,GAAG,CACT,IAAI,CAAC,SAAS,CAAC;YACb,IAAI;YACJ,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,GAAG,EAAE,iBAAiB;SACvB,CAAC,CACH,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE;QAC5B,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3B,OAAO,CAAC,GAAG,CACT,IAAI,CAAC,SAAS,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AAC;IACzB,CAAC;AACH,CAAC,CAAC,EAAE,CAAC"}
|
package/time.d.ts
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
export declare abstract class Time {
|
2
|
-
abstract Now(): Date;
|
3
|
-
abstract Sleep(duration: Duration): Promise<void>;
|
4
|
-
TimeSince(start: Date): Duration;
|
5
|
-
}
|
6
|
-
export type Duration = number;
|
7
|
-
export declare enum TimeUnits {
|
8
|
-
Microsecond = 1,
|
9
|
-
Second = 1000,
|
10
|
-
Minute = 60000,
|
11
|
-
Hour = 3600000
|
12
|
-
}
|
13
|
-
//# sourceMappingURL=time.d.ts.map
|
package/time.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../src/time.ts"],"names":[],"mappings":"AAAA,8BAAsB,IAAI;IACxB,QAAQ,CAAC,GAAG,IAAI,IAAI;IACpB,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IACjD,SAAS,CAAC,KAAK,EAAE,IAAI,GAAG,QAAQ;CAIjC;AAED,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,oBAAY,SAAS;IACnB,WAAW,IAAI;IAEf,MAAM,OAAqB;IAE3B,MAAM,QAAc;IAEpB,IAAI,UAAc;CACnB"}
|
package/time.js
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.TimeUnits = exports.Time = void 0;
|
4
|
-
class Time {
|
5
|
-
TimeSince(start) {
|
6
|
-
const now = this.Now();
|
7
|
-
return now.getTime() - start.getTime();
|
8
|
-
}
|
9
|
-
}
|
10
|
-
exports.Time = Time;
|
11
|
-
var TimeUnits;
|
12
|
-
(function (TimeUnits) {
|
13
|
-
TimeUnits[TimeUnits["Microsecond"] = 1] = "Microsecond";
|
14
|
-
TimeUnits[TimeUnits["Second"] = 1000] = "Second";
|
15
|
-
TimeUnits[TimeUnits["Minute"] = 60000] = "Minute";
|
16
|
-
TimeUnits[TimeUnits["Hour"] = 3600000] = "Hour";
|
17
|
-
})(TimeUnits || (exports.TimeUnits = TimeUnits = {}));
|
18
|
-
//# sourceMappingURL=time.js.map
|
package/time.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"time.js","sourceRoot":"","sources":["../src/time.ts"],"names":[],"mappings":";;;AAAA,MAAsB,IAAI;IAGxB,SAAS,CAAC,KAAW;QACnB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,OAAO,GAAG,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;IACzC,CAAC;CACF;AAPD,oBAOC;AAID,IAAY,SAQX;AARD,WAAY,SAAS;IACnB,uDAAe,CAAA;IAEf,gDAA2B,CAAA;IAE3B,iDAAoB,CAAA;IAEpB,+CAAkB,CAAA;AACpB,CAAC,EARW,SAAS,yBAAT,SAAS,QAQpB"}
|
package/utils/index.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC"}
|
package/utils/rebuffer.d.ts
DELETED
package/utils/rebuffer.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"rebuffer.d.ts","sourceRoot":"","sources":["../../src/utils/rebuffer.ts"],"names":[],"mappings":"AAOA,wBAAsB,aAAa,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAE7F;AAmDD,wBAAgB,QAAQ,CAAC,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,cAAc,CAAC,UAAU,CAAC,CAcrG"}
|
package/utils/rebuffer.js
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.rebuffer = exports.rebufferArray = void 0;
|
4
|
-
const stream_map_1 = require("./stream_map");
|
5
|
-
async function rebufferArray(a, chunkSize) {
|
6
|
-
return (0, stream_map_1.stream2array)(rebuffer((0, stream_map_1.array2stream)(a), chunkSize));
|
7
|
-
}
|
8
|
-
exports.rebufferArray = rebufferArray;
|
9
|
-
function reChunk(cs, chunkSize) {
|
10
|
-
const len = cs.reduce((acc, v) => acc + v.length, 0);
|
11
|
-
const last = cs[cs.length - 1];
|
12
|
-
const lastOfs = len - last.length;
|
13
|
-
const rest = last.subarray(chunkSize - lastOfs);
|
14
|
-
cs[cs.length - 1] = last.subarray(0, chunkSize - lastOfs);
|
15
|
-
const chunk = new Uint8Array(chunkSize);
|
16
|
-
let ofs = 0;
|
17
|
-
for (const c of cs) {
|
18
|
-
chunk.set(c, ofs);
|
19
|
-
ofs += c.length;
|
20
|
-
}
|
21
|
-
return { rest, chunk };
|
22
|
-
}
|
23
|
-
function pump(ps, controller, next) {
|
24
|
-
ps.reader.read().then(({ done, value }) => {
|
25
|
-
if (done) {
|
26
|
-
if (ps.tmpLen > 0) {
|
27
|
-
controller.enqueue(reChunk(ps.tmp, ps.tmpLen).chunk);
|
28
|
-
}
|
29
|
-
controller.close();
|
30
|
-
next();
|
31
|
-
return;
|
32
|
-
}
|
33
|
-
if (ps.tmpLen + value.length > ps.chunkSize) {
|
34
|
-
ps.tmp.push(value);
|
35
|
-
const res = reChunk(ps.tmp, ps.chunkSize);
|
36
|
-
controller.enqueue(res.chunk);
|
37
|
-
ps.tmp = [res.rest];
|
38
|
-
ps.tmpLen = res.rest.length;
|
39
|
-
next();
|
40
|
-
return;
|
41
|
-
}
|
42
|
-
else if (value.length) {
|
43
|
-
ps.tmp.push(value);
|
44
|
-
ps.tmpLen += value.length;
|
45
|
-
}
|
46
|
-
pump(ps, controller, next);
|
47
|
-
});
|
48
|
-
}
|
49
|
-
function rebuffer(a, chunkSize) {
|
50
|
-
const state = {
|
51
|
-
reader: a.getReader(),
|
52
|
-
tmp: [],
|
53
|
-
tmpLen: 0,
|
54
|
-
chunkSize,
|
55
|
-
};
|
56
|
-
return new ReadableStream({
|
57
|
-
async pull(controller) {
|
58
|
-
return new Promise((resolve) => {
|
59
|
-
pump(state, controller, resolve);
|
60
|
-
});
|
61
|
-
},
|
62
|
-
});
|
63
|
-
}
|
64
|
-
exports.rebuffer = rebuffer;
|
65
|
-
//# sourceMappingURL=rebuffer.js.map
|
package/utils/rebuffer.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"rebuffer.js","sourceRoot":"","sources":["../../src/utils/rebuffer.ts"],"names":[],"mappings":";;;AAAA,6CAA0D;AAOnD,KAAK,UAAU,aAAa,CAAC,CAAe,EAAE,SAAiB;IACpE,OAAO,IAAA,yBAAY,EAAC,QAAQ,CAAC,IAAA,yBAAY,EAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;AAC5D,CAAC;AAFD,sCAEC;AAED,SAAS,OAAO,CAAC,EAAgB,EAAE,SAAiB;IAClD,MAAM,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACrD,MAAM,IAAI,GAAG,EAAE,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC/B,MAAM,OAAO,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC;IAElC,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,GAAG,OAAO,CAAC,CAAC;IAChD,EAAE,CAAC,EAAE,CAAC,MAAM,GAAG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pB,EAAE,CAAC,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC;YAC5B,IAAI,EAAE,CAAC;YACP,OAAO;QACT,CAAC;aAAM,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YACxB,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACnB,EAAE,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC;QAC5B,CAAC;QACD,IAAI,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,QAAQ,CAAC,CAA6B,EAAE,SAAiB;IACvE,MAAM,KAAK,GAAc;QACvB,MAAM,EAAE,CAAC,CAAC,SAAS,EAAE;QACrB,GAAG,EAAE,EAAE;QACP,MAAM,EAAE,CAAC;QACT,SAAS;KACV,CAAC;IACF,OAAO,IAAI,cAAc,CAAa;QACpC,KAAK,CAAC,IAAI,CAAC,UAAU;YACnB,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;gBACnC,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAdD,4BAcC"}
|
package/utils/rebuffer.test.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"rebuffer.test.d.ts","sourceRoot":"","sources":["../../src/utils/rebuffer.test.ts"],"names":[],"mappings":""}
|
package/utils/rebuffer.test.js
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const rebuffer_1 = require("./rebuffer");
|
4
|
-
const stream_test_helper_1 = require("./stream_test_helper");
|
5
|
-
it("rechunk empty", async () => {
|
6
|
-
const chunks = await (0, rebuffer_1.rebufferArray)([], 10);
|
7
|
-
expect(chunks.length).toEqual(0);
|
8
|
-
});
|
9
|
-
it("rechunk 0 size", async () => {
|
10
|
-
const chunks = await (0, rebuffer_1.rebufferArray)([new Uint8Array(0)], 10);
|
11
|
-
expect(chunks.length).toEqual(0);
|
12
|
-
});
|
13
|
-
it("rechunk smaller 10", async () => {
|
14
|
-
const chunks = await (0, rebuffer_1.rebufferArray)([new Uint8Array(3)], 10);
|
15
|
-
expect(chunks.length).toEqual(1);
|
16
|
-
expect(chunks[0].length).toEqual(3);
|
17
|
-
});
|
18
|
-
it("rechunk smaller 10 pack smaller chunks", async () => {
|
19
|
-
const chunks = await (0, rebuffer_1.rebufferArray)(Array(7)
|
20
|
-
.fill(0)
|
21
|
-
.map((_, i) => {
|
22
|
-
const o = new Uint8Array(3);
|
23
|
-
for (let j = 0; j < o.length; j++) {
|
24
|
-
o[j] = i * o.length + j;
|
25
|
-
}
|
26
|
-
return o;
|
27
|
-
}), 10);
|
28
|
-
expect(chunks.length).toEqual(3);
|
29
|
-
expect(chunks[0].length).toEqual(10);
|
30
|
-
expect(Array.from(chunks[0]).map((i) => i)).toEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
|
31
|
-
expect(chunks[1].length).toEqual(10);
|
32
|
-
expect(Array.from(chunks[1]).map((i) => i)).toEqual([10, 11, 12, 13, 14, 15, 16, 17, 18, 19]);
|
33
|
-
expect(chunks[2].length).toEqual(1);
|
34
|
-
expect(Array.from(chunks[2]).map((i) => i)).toEqual([20]);
|
35
|
-
});
|
36
|
-
it("rechunk smaller 10 pack bigger chunks", async () => {
|
37
|
-
const chunks = await (0, rebuffer_1.rebufferArray)(Array(3)
|
38
|
-
.fill(0)
|
39
|
-
.map((_, i) => {
|
40
|
-
const o = new Uint8Array(11);
|
41
|
-
for (let j = 0; j < o.length; j++) {
|
42
|
-
o[j] = i * o.length + j;
|
43
|
-
}
|
44
|
-
return o;
|
45
|
-
}), 10);
|
46
|
-
expect(chunks.length).toEqual(4);
|
47
|
-
expect(chunks[0].length).toEqual(10);
|
48
|
-
expect(Array.from(chunks[0]).map((i) => i)).toEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
|
49
|
-
expect(chunks[1].length).toEqual(10);
|
50
|
-
expect(Array.from(chunks[1]).map((i) => i)).toEqual([10, 11, 12, 13, 14, 15, 16, 17, 18, 19]);
|
51
|
-
expect(chunks[2].length).toEqual(10);
|
52
|
-
expect(Array.from(chunks[2]).map((i) => i)).toEqual([20, 21, 22, 23, 24, 25, 26, 27, 28, 29]);
|
53
|
-
expect(chunks[3].length).toEqual(3);
|
54
|
-
expect(Array.from(chunks[3]).map((i) => i)).toEqual([30, 31, 32]);
|
55
|
-
});
|
56
|
-
describe("test streaming through rebuffer", () => {
|
57
|
-
const state = {
|
58
|
-
sendChunks: 10000,
|
59
|
-
sendChunkSize: 3,
|
60
|
-
fillCalls: 0,
|
61
|
-
CollectorFn: jest.fn(),
|
62
|
-
};
|
63
|
-
const reBufferSize = 11;
|
64
|
-
it("does rebuffer respect backpressure", async () => {
|
65
|
-
const ts = new TransformStream(undefined, undefined, { highWaterMark: 2 });
|
66
|
-
const reb = (0, rebuffer_1.rebuffer)(ts.readable, reBufferSize);
|
67
|
-
await Promise.all([(0, stream_test_helper_1.receiveFromStream)(reb, state), (0, stream_test_helper_1.sendToStream)(ts.writable, state)]);
|
68
|
-
expect(state.CollectorFn).toBeCalledTimes(~~((state.sendChunkSize * state.sendChunks) / reBufferSize) + 1 + 1);
|
69
|
-
expect(state.CollectorFn.mock.calls.slice(-1)[0][0].done).toBeTruthy();
|
70
|
-
let lastfillCalls = 0;
|
71
|
-
for (let i = 0; i < state.CollectorFn.mock.calls.length - 1; i++) {
|
72
|
-
const { fillCalls, reBufferCalls, value } = state.CollectorFn.mock.calls[i][0];
|
73
|
-
expect(value === null || value === void 0 ? void 0 : value[0]).toBe(~~((reBufferSize * i) / state.sendChunkSize) % 256);
|
74
|
-
expect(fillCalls * state.sendChunkSize).toBeGreaterThanOrEqual((fillCalls - lastfillCalls) * state.sendChunkSize + reBufferCalls * reBufferSize);
|
75
|
-
lastfillCalls = fillCalls;
|
76
|
-
}
|
77
|
-
});
|
78
|
-
});
|
79
|
-
//# sourceMappingURL=rebuffer.test.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"rebuffer.test.js","sourceRoot":"","sources":["../../src/utils/rebuffer.test.ts"],"names":[],"mappings":";;AAAA,yCAAqD;AACrD,6DAA2F;AAE3F,EAAE,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;IAC7B,MAAM,MAAM,GAAG,MAAM,IAAA,wBAAa,EAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAC3C,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,gBAAgB,EAAE,KAAK,IAAI,EAAE;IAC9B,MAAM,MAAM,GAAG,MAAM,IAAA,wBAAa,EAAC,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5D,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,oBAAoB,EAAE,KAAK,IAAI,EAAE;IAClC,MAAM,MAAM,GAAG,MAAM,IAAA,wBAAa,EAAC,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5D,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACjC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACtC,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,wCAAwC,EAAE,KAAK,IAAI,EAAE;IACtD,MAAM,MAAM,GAAG,MAAM,IAAA,wBAAa,EAChC,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AS,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC/E,MAAM,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,GAAG,GAAG,CAAC,CAAC;YAC5E,MAAM,CAAC,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,sBAAsB,CAC5D,CAAC,SAAS,GAAG,aAAa,CAAC,GAAG,KAAK,CAAC,aAAa,GAAG,aAAa,GAAG,YAAY,CACjF,CAAC;YACF,aAAa,GAAG,SAAS,CAAC;QAC5B,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/utils/stream2string.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"stream2string.d.ts","sourceRoot":"","sources":["../../src/utils/stream2string.ts"],"names":[],"mappings":"AAAA,wBAAsB,aAAa,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBjH;AAED,wBAAsB,iBAAiB,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,CAmBvG"}
|
package/utils/stream2string.js
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.stream2uint8array = exports.stream2string = void 0;
|
4
|
-
async function stream2string(stream, maxSize) {
|
5
|
-
if (!stream) {
|
6
|
-
return Promise.resolve("");
|
7
|
-
}
|
8
|
-
const reader = stream.getReader();
|
9
|
-
let res = "";
|
10
|
-
const decoder = new TextDecoder();
|
11
|
-
let rSize = 0;
|
12
|
-
while (typeof maxSize === "undefined" || rSize < maxSize) {
|
13
|
-
try {
|
14
|
-
const read = await reader.read();
|
15
|
-
if (read.done) {
|
16
|
-
break;
|
17
|
-
}
|
18
|
-
if (maxSize && rSize + read.value.length > maxSize) {
|
19
|
-
read.value = read.value.slice(0, maxSize - rSize);
|
20
|
-
}
|
21
|
-
const block = decoder.decode(read.value, { stream: true });
|
22
|
-
rSize += read.value.length;
|
23
|
-
res += block;
|
24
|
-
}
|
25
|
-
catch (err) {
|
26
|
-
return Promise.reject(err);
|
27
|
-
}
|
28
|
-
}
|
29
|
-
return Promise.resolve(res);
|
30
|
-
}
|
31
|
-
exports.stream2string = stream2string;
|
32
|
-
async function stream2uint8array(stream) {
|
33
|
-
if (!stream) {
|
34
|
-
return Promise.resolve(new Uint8Array());
|
35
|
-
}
|
36
|
-
const reader = stream.getReader();
|
37
|
-
let res = new Uint8Array();
|
38
|
-
while (1) {
|
39
|
-
try {
|
40
|
-
const { done, value } = await reader.read();
|
41
|
-
if (done) {
|
42
|
-
break;
|
43
|
-
}
|
44
|
-
res = new Uint8Array([...res, ...value]);
|
45
|
-
}
|
46
|
-
catch (err) {
|
47
|
-
return Promise.reject(err);
|
48
|
-
}
|
49
|
-
}
|
50
|
-
return Promise.resolve(res);
|
51
|
-
}
|
52
|
-
exports.stream2uint8array = stream2uint8array;
|
53
|
-
//# sourceMappingURL=stream2string.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"stream2string.js","sourceRoot":"","sources":["../../src/utils/stream2string.ts"],"names":[],"mappings":";;;AAAO,KAAK,UAAU,aAAa,CAAC,MAA0C,EAAE,OAAgB;IAC9F,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,C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C;QACT,IAAI,CAAC;YACH,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YAC5C,IAAI,IAAI,EAAE,CAAC;gBACT,MAAM;YACR,CAAC;YACD,GAAG,GAAG,IAAI,UAAU,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC;QAC3C,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC;AAnBD,8CAmBC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"stream2string.test.d.ts","sourceRoot":"","sources":["../../src/utils/stream2string.test.ts"],"names":[],"mappings":""}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const stream2string_1 = require("./stream2string");
|
4
|
-
it("stream2string", async () => {
|
5
|
-
expect(await (0, stream2string_1.stream2string)(new ReadableStream({
|
6
|
-
start(controller) {
|
7
|
-
const encoder = new TextEncoder();
|
8
|
-
controller.enqueue(encoder.encode("Hello"));
|
9
|
-
controller.enqueue(encoder.encode(" "));
|
10
|
-
controller.enqueue(encoder.encode("World"));
|
11
|
-
controller.enqueue(encoder.encode("!"));
|
12
|
-
controller.close();
|
13
|
-
},
|
14
|
-
}))).toBe("Hello World!");
|
15
|
-
});
|
16
|
-
it("stream2string maxSize", async () => {
|
17
|
-
const instr = "Hello World!";
|
18
|
-
for (let i = 0; i < instr.length; i++) {
|
19
|
-
expect(await (0, stream2string_1.stream2string)(new ReadableStream({
|
20
|
-
start(controller) {
|
21
|
-
const encoder = new TextEncoder();
|
22
|
-
controller.enqueue(encoder.encode("Hello"));
|
23
|
-
controller.enqueue(encoder.encode(" "));
|
24
|
-
controller.enqueue(encoder.encode("World"));
|
25
|
-
controller.enqueue(encoder.encode("!"));
|
26
|
-
controller.close();
|
27
|
-
},
|
28
|
-
}), i)).toBe(instr.slice(0, i));
|
29
|
-
}
|
30
|
-
});
|
31
|
-
//# sourceMappingURL=stream2string.test.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"stream2string.test.js","sourceRoot":"","sources":["../../src/utils/stream2string.test.ts"],"names":[],"mappings":";;AAAA,mDAAgD;AAEhD,EAAE,CAAC,eAAe,EAAE,KAAK,IAAI,EAAE;IAC7B,MAAM,CACJ,MAAM,IAAA,6BAAa,EACjB,IAAI,cAAc,CAAC;QACjB,KAAK,CAAC,UAAU;YACd,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;YAClC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;YAC5C,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YACxC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;YAC5C,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YACxC,UAAU,CAAC,KAAK,EAAE,CAAC;QACrB,CAAC;KACF,CAAC,CACH,CACF,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;AACzB,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,uBAAuB,EAAE,KAAK,IAAI,EAAE;IACrC,MAAM,KAAK,GAAG,cAAc,CAAC;IAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,CACJ,MAAM,IAAA,6BAAa,EACjB,IAAI,cAAc,CAAC;YACjB,KAAK,CAAC,UAAU;gBACd,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;gBAClC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;gBAC5C,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;gBACxC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;gBAC5C,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;gBACxC,UAAU,CAAC,KAAK,EAAE,CAAC;YACrB,CAAC;SACF,CAAC,EACF,CAAC,CACF,CACF,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;AACH,CAAC,CAAC,CAAC"}
|
package/utils/stream_map.d.ts
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
export interface StreamMap<T, U> {
|
2
|
-
Map(s: T, idx: number): U | Promise<U>;
|
3
|
-
readonly Close?: () => void;
|
4
|
-
}
|
5
|
-
export declare function streamMap<T, U>(s: ReadableStream<T>, sm: StreamMap<T, U>): ReadableStream<U>;
|
6
|
-
export declare function devnull<T>(a: ReadableStream<T>): Promise<number>;
|
7
|
-
export declare function array2stream<T>(a: T[]): ReadableStream<T>;
|
8
|
-
export declare function stream2array<T>(a: ReadableStream<T>): Promise<T[]>;
|
9
|
-
//# sourceMappingURL=stream_map.d.ts.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"stream_map.d.ts","sourceRoot":"","sources":["../../src/utils/stream_map.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS,CAAC,CAAC,EAAE,CAAC;IAC7B,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACvC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AACD,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAoB5F;AAED,wBAAsB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAWtE;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,cAAc,CAAC,CAAC,CAAC,CAYzD;AAED,wBAAsB,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAWxE"}
|
package/utils/stream_map.js
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.stream2array = exports.array2stream = exports.devnull = exports.streamMap = void 0;
|
4
|
-
function streamMap(s, sm) {
|
5
|
-
const state = { reader: s.getReader(), streamMap: sm, idx: 0 };
|
6
|
-
return new ReadableStream({
|
7
|
-
async pull(controller) {
|
8
|
-
const { done, value } = await state.reader.read();
|
9
|
-
if (done) {
|
10
|
-
state.streamMap.Close && state.streamMap.Close();
|
11
|
-
controller.close();
|
12
|
-
return;
|
13
|
-
}
|
14
|
-
const promiseOrU = state.streamMap.Map(value, state.idx++);
|
15
|
-
let mapped;
|
16
|
-
if (promiseOrU instanceof Promise || typeof promiseOrU.then === "function") {
|
17
|
-
mapped = await promiseOrU;
|
18
|
-
}
|
19
|
-
else {
|
20
|
-
mapped = promiseOrU;
|
21
|
-
}
|
22
|
-
controller.enqueue(mapped);
|
23
|
-
},
|
24
|
-
});
|
25
|
-
}
|
26
|
-
exports.streamMap = streamMap;
|
27
|
-
async function devnull(a) {
|
28
|
-
const reader = a.getReader();
|
29
|
-
let cnt = 0;
|
30
|
-
while (true) {
|
31
|
-
const { done } = await reader.read();
|
32
|
-
if (done) {
|
33
|
-
break;
|
34
|
-
}
|
35
|
-
cnt++;
|
36
|
-
}
|
37
|
-
return cnt;
|
38
|
-
}
|
39
|
-
exports.devnull = devnull;
|
40
|
-
function array2stream(a) {
|
41
|
-
let i = 0;
|
42
|
-
return new ReadableStream({
|
43
|
-
pull(controller) {
|
44
|
-
if (i >= a.length) {
|
45
|
-
controller.close();
|
46
|
-
return;
|
47
|
-
}
|
48
|
-
controller.enqueue(a[i]);
|
49
|
-
i++;
|
50
|
-
},
|
51
|
-
});
|
52
|
-
}
|
53
|
-
exports.array2stream = array2stream;
|
54
|
-
async function stream2array(a) {
|
55
|
-
const ret = [];
|
56
|
-
const reader = a.getReader();
|
57
|
-
while (true) {
|
58
|
-
const { done, value } = await reader.read();
|
59
|
-
if (done) {
|
60
|
-
break;
|
61
|
-
}
|
62
|
-
ret.push(value);
|
63
|
-
}
|
64
|
-
return ret;
|
65
|
-
}
|
66
|
-
exports.stream2array = stream2array;
|
67
|
-
//# sourceMappingURL=stream_map.js.map
|
package/utils/stream_map.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"stream_map.js","sourceRoot":"","sources":["../../src/utils/stream_map.ts"],"names":[],"mappings":";;;AAIA,SAAgB,SAAS,CAAO,CAAoB,EAAE,EAAmB;IACvE,MAAM,KAAK,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;IAC/D,OAAO,IAAI,cAAc,CAAI;QAC3B,KAAK,CAAC,IAAI,CAAC,UAAU;YACnB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YAClD,IAAI,IAAI,EAAE,CAAC;gBACT,KAAK,CAAC,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