@adviser/cement 0.2.28 → 0.2.30
Sign up to get free protection for your applications and to get access to all the features.
- package/{base-sys-abstraction-C9WW3w57.d.cts → base-sys-abstraction-BkEiLHl0.d.ts} +8 -4
- package/{base-sys-abstraction-C9WW3w57.d.ts → base-sys-abstraction-Qj7pkY1N.d.cts} +8 -4
- package/{chunk-OXD3YZZ7.js → chunk-7KFVMTOS.js} +3 -47
- package/chunk-7KFVMTOS.js.map +1 -0
- package/{chunk-P5RXA4C4.js → chunk-GES3MUGV.js} +24 -27
- package/{chunk-LCPYQVWT.js.map → chunk-GES3MUGV.js.map} +1 -1
- package/{chunk-YDIUMYIE.js → chunk-Q65HLCNL.js} +8 -7
- package/chunk-Q65HLCNL.js.map +1 -0
- package/{chunk-DPIL5UIL.js → chunk-WMMUXBDX.js} +6 -2
- package/chunk-WMMUXBDX.js.map +1 -0
- package/{index-Dhb2fQiw.d.cts → index-Q3phXzYr.d.cts} +2 -21
- package/{index-CcsGcehs.d.ts → index-tIGZMHTc.d.ts} +2 -21
- package/index.cjs +288 -7345
- package/index.cjs.map +1 -1
- package/index.d.cts +74 -12
- package/index.d.ts +74 -12
- package/index.js +239 -7266
- package/index.js.map +1 -1
- package/node/index.cjs +220 -39
- package/node/index.cjs.map +1 -1
- package/node/index.d.cts +22 -4
- package/node/index.d.ts +22 -4
- package/node/index.js +201 -25
- package/node/index.js.map +1 -1
- package/package.json +34 -23
- package/src/LICENSE +201 -0
- package/src/README.md +39 -0
- package/src/base-sys-abstraction.ts +242 -0
- package/src/bin2text.ts +47 -0
- package/src/crypto.ts +125 -0
- package/src/file-service.ts +24 -0
- package/src/future.ts +27 -0
- package/src/index.ts +23 -0
- package/src/jsr.json +22 -0
- package/src/log-level-impl.ts +87 -0
- package/src/log-writer-impl.ts +58 -0
- package/src/logger-impl.ts +498 -0
- package/src/logger.ts +208 -0
- package/src/node/deno-file-service.ts +92 -0
- package/src/node/deno-sys-abstraction.ts +133 -0
- package/src/node/index.ts +4 -0
- package/src/node/mock-file-service.ts +45 -0
- package/src/node/node-file-service.ts +91 -0
- package/src/node/node-sys-abstraction.ts +121 -0
- package/src/option.ts +60 -0
- package/src/refcounted.ts +23 -0
- package/src/resolve-once.ts +179 -0
- package/src/result.ts +165 -0
- package/src/runtime.ts +36 -0
- package/src/sys-abstraction.ts +53 -0
- package/src/sys-env.ts +216 -0
- package/src/test/log-write-stream.ts +95 -0
- package/src/test/mock-logger.ts +40 -0
- package/src/time.ts +20 -0
- package/src/tracer.ts +222 -0
- package/src/txt-en-decoder.ts +21 -0
- package/src/uri.ts +421 -0
- package/src/utils/console-write-stream.ts +72 -0
- package/src/utils/fanout-write-stream.ts +32 -0
- package/src/utils/index.ts +6 -0
- package/src/utils/rebuffer.ts +75 -0
- package/src/utils/stream-map.ts +67 -0
- package/src/utils/stream2string.ts +47 -0
- package/src/utils/string2stream.ts +14 -0
- package/src/version.ts +3 -0
- package/src/web/index.ts +1 -0
- package/src/web/web-sys-abstraction.ts +80 -0
- package/ts/base-sys-abstraction.d.ts +84 -0
- package/ts/base-sys-abstraction.d.ts.map +1 -0
- package/ts/base-sys-abstraction.js +178 -0
- package/ts/base-sys-abstraction.js.map +1 -0
- package/ts/base-sys-abstraction.test.d.ts +2 -0
- package/ts/base-sys-abstraction.test.d.ts.map +1 -0
- package/ts/base-sys-abstraction.test.js +82 -0
- package/ts/base-sys-abstraction.test.js.map +1 -0
- package/ts/bin2text.d.ts +3 -0
- package/ts/bin2text.d.ts.map +1 -0
- package/ts/bin2text.js +43 -0
- package/ts/bin2text.js.map +1 -0
- package/ts/bin2text.test.d.ts +2 -0
- package/ts/bin2text.test.d.ts.map +1 -0
- package/ts/bin2text.test.js +51 -0
- package/ts/bin2text.test.js.map +1 -0
- package/ts/crypto.d.ts +76 -0
- package/ts/crypto.d.ts.map +1 -0
- package/ts/crypto.js +22 -0
- package/ts/crypto.js.map +1 -0
- package/ts/crypto.test.d.ts +2 -0
- package/ts/crypto.test.d.ts.map +1 -0
- package/ts/crypto.test.js +14 -0
- package/ts/crypto.test.js.map +1 -0
- package/ts/file-service.d.ts +17 -0
- package/ts/file-service.d.ts.map +1 -0
- package/ts/file-service.js +2 -0
- package/ts/file-service.js.map +1 -0
- package/ts/future.d.ts +8 -0
- package/ts/future.d.ts.map +1 -0
- package/ts/future.js +38 -0
- package/ts/future.js.map +1 -0
- package/ts/future.test.d.ts +2 -0
- package/ts/future.test.d.ts.map +1 -0
- package/ts/future.test.js +28 -0
- package/ts/future.test.js.map +1 -0
- package/ts/index.d.ts +24 -0
- package/ts/index.d.ts.map +1 -0
- package/ts/index.js +24 -0
- package/ts/index.js.map +1 -0
- package/ts/log-level-impl.d.ts +14 -0
- package/ts/log-level-impl.d.ts.map +1 -0
- package/ts/log-level-impl.js +72 -0
- package/ts/log-level-impl.js.map +1 -0
- package/ts/log-writer-impl.d.ts +10 -0
- package/ts/log-writer-impl.d.ts.map +1 -0
- package/ts/log-writer-impl.js +45 -0
- package/ts/log-writer-impl.js.map +1 -0
- package/ts/logger-impl.d.ts +71 -0
- package/ts/logger-impl.d.ts.map +1 -0
- package/ts/logger-impl.js +412 -0
- package/ts/logger-impl.js.map +1 -0
- package/ts/logger.d.ts +84 -0
- package/ts/logger.d.ts.map +1 -0
- package/ts/logger.js +114 -0
- package/ts/logger.js.map +1 -0
- package/ts/logger.test.d.ts +2 -0
- package/ts/logger.test.d.ts.map +1 -0
- package/ts/logger.test.js +1023 -0
- package/ts/logger.test.js.map +1 -0
- package/ts/node/deno-file-service.d.ts +17 -0
- package/ts/node/deno-file-service.d.ts.map +1 -0
- package/ts/node/deno-file-service.js +65 -0
- package/ts/node/deno-file-service.js.map +1 -0
- package/ts/node/deno-sys-abstraction.d.ts +22 -0
- package/ts/node/deno-sys-abstraction.d.ts.map +1 -0
- package/ts/node/deno-sys-abstraction.js +101 -0
- package/ts/node/deno-sys-abstraction.js.map +1 -0
- package/ts/node/index.d.ts +5 -0
- package/ts/node/index.d.ts.map +1 -0
- package/ts/node/index.js +5 -0
- package/ts/node/index.js.map +1 -0
- package/ts/node/mock-file-service.d.ts +11 -0
- package/ts/node/mock-file-service.d.ts.map +1 -0
- package/ts/node/mock-file-service.js +34 -0
- package/ts/node/mock-file-service.js.map +1 -0
- package/ts/node/mock-file-service.test.d.ts +2 -0
- package/ts/node/mock-file-service.test.d.ts.map +1 -0
- package/ts/node/mock-file-service.test.js +31 -0
- package/ts/node/mock-file-service.test.js.map +1 -0
- package/ts/node/node-file-service.d.ts +16 -0
- package/ts/node/node-file-service.d.ts.map +1 -0
- package/ts/node/node-file-service.js +71 -0
- package/ts/node/node-file-service.js.map +1 -0
- package/ts/node/node-sys-abstraction.d.ts +22 -0
- package/ts/node/node-sys-abstraction.d.ts.map +1 -0
- package/ts/node/node-sys-abstraction.js +99 -0
- package/ts/node/node-sys-abstraction.js.map +1 -0
- package/ts/node/node-sys-abstraction.test.d.ts +2 -0
- package/ts/node/node-sys-abstraction.test.d.ts.map +1 -0
- package/ts/node/node-sys-abstraction.test.js +83 -0
- package/ts/node/node-sys-abstraction.test.js.map +1 -0
- package/ts/option.d.ts +25 -0
- package/ts/option.d.ts.map +1 -0
- package/ts/option.js +47 -0
- package/ts/option.js.map +1 -0
- package/ts/refcounted.d.ts +2 -0
- package/ts/refcounted.d.ts.map +1 -0
- package/ts/refcounted.js +19 -0
- package/ts/refcounted.js.map +1 -0
- package/ts/refcounted.test.d.ts +2 -0
- package/ts/refcounted.test.d.ts.map +1 -0
- package/ts/refcounted.test.js +39 -0
- package/ts/refcounted.test.js.map +1 -0
- package/ts/resolve-once.d.ts +46 -0
- package/ts/resolve-once.d.ts.map +1 -0
- package/ts/resolve-once.js +152 -0
- package/ts/resolve-once.js.map +1 -0
- package/ts/resolve-once.test.d.ts +2 -0
- package/ts/resolve-once.test.d.ts.map +1 -0
- package/ts/resolve-once.test.js +283 -0
- package/ts/resolve-once.test.js.map +1 -0
- package/ts/result.d.ts +34 -0
- package/ts/result.d.ts.map +1 -0
- package/ts/result.js +85 -0
- package/ts/result.js.map +1 -0
- package/ts/result.test.d.ts +2 -0
- package/ts/result.test.d.ts.map +1 -0
- package/ts/result.test.js +79 -0
- package/ts/result.test.js.map +1 -0
- package/ts/runtime.d.ts +8 -0
- package/ts/runtime.d.ts.map +1 -0
- package/ts/runtime.js +26 -0
- package/ts/runtime.js.map +1 -0
- package/ts/sys-abstraction.d.ts +36 -0
- package/ts/sys-abstraction.d.ts.map +1 -0
- package/ts/sys-abstraction.js +31 -0
- package/ts/sys-abstraction.js.map +1 -0
- package/ts/sys-env.d.ts +48 -0
- package/ts/sys-env.d.ts.map +1 -0
- package/ts/sys-env.js +176 -0
- package/ts/sys-env.js.map +1 -0
- package/ts/sys-env.test.d.ts +2 -0
- package/ts/sys-env.test.d.ts.map +1 -0
- package/ts/sys-env.test.js +51 -0
- package/ts/sys-env.test.js.map +1 -0
- package/ts/test/log-write-stream.d.ts +27 -0
- package/ts/test/log-write-stream.d.ts.map +1 -0
- package/ts/test/log-write-stream.js +74 -0
- package/ts/test/log-write-stream.js.map +1 -0
- package/ts/test/mock-logger.d.ts +14 -0
- package/ts/test/mock-logger.d.ts.map +1 -0
- package/ts/test/mock-logger.js +29 -0
- package/ts/test/mock-logger.js.map +1 -0
- package/ts/test/mock-logger.test.d.ts +2 -0
- package/ts/test/mock-logger.test.d.ts.map +1 -0
- package/ts/test/mock-logger.test.js +63 -0
- package/ts/test/mock-logger.test.js.map +1 -0
- package/ts/test/test-exit-handler.d.ts +2 -0
- package/ts/test/test-exit-handler.d.ts.map +1 -0
- package/ts/test/test-exit-handler.js +57 -0
- package/ts/test/test-exit-handler.js.map +1 -0
- package/ts/time.d.ts +13 -0
- package/ts/time.d.ts.map +1 -0
- package/ts/time.js +14 -0
- package/ts/time.js.map +1 -0
- package/ts/tracer.d.ts +59 -0
- package/ts/tracer.d.ts.map +1 -0
- package/ts/tracer.js +148 -0
- package/ts/tracer.js.map +1 -0
- package/ts/tracer.test.d.ts +2 -0
- package/ts/tracer.test.d.ts.map +1 -0
- package/ts/tracer.test.js +311 -0
- package/ts/tracer.test.js.map +1 -0
- package/ts/txt-en-decoder.d.ts +10 -0
- package/ts/txt-en-decoder.d.ts.map +1 -0
- package/ts/txt-en-decoder.js +15 -0
- package/ts/txt-en-decoder.js.map +1 -0
- package/ts/uri.d.ts +67 -0
- package/ts/uri.d.ts.map +1 -0
- package/ts/uri.js +283 -0
- package/ts/uri.js.map +1 -0
- package/ts/uri.test.d.ts +2 -0
- package/ts/uri.test.d.ts.map +1 -0
- package/ts/uri.test.js +119 -0
- package/ts/uri.test.js.map +1 -0
- package/ts/utils/console-write-stream.d.ts +21 -0
- package/ts/utils/console-write-stream.d.ts.map +1 -0
- package/ts/utils/console-write-stream.js +62 -0
- package/ts/utils/console-write-stream.js.map +1 -0
- package/ts/utils/fanout-write-stream.d.ts +12 -0
- package/ts/utils/fanout-write-stream.d.ts.map +1 -0
- package/ts/utils/fanout-write-stream.js +24 -0
- package/ts/utils/fanout-write-stream.js.map +1 -0
- package/ts/utils/index.d.ts +7 -0
- package/ts/utils/index.d.ts.map +1 -0
- package/ts/utils/index.js +7 -0
- package/ts/utils/index.js.map +1 -0
- package/ts/utils/rebuffer.d.ts +3 -0
- package/ts/utils/rebuffer.d.ts.map +1 -0
- package/ts/utils/rebuffer.js +60 -0
- package/ts/utils/rebuffer.js.map +1 -0
- package/ts/utils/rebuffer.test.d.ts +2 -0
- package/ts/utils/rebuffer.test.d.ts.map +1 -0
- package/ts/utils/rebuffer.test.js +77 -0
- package/ts/utils/rebuffer.test.js.map +1 -0
- package/ts/utils/stream-map.d.ts +9 -0
- package/ts/utils/stream-map.d.ts.map +1 -0
- package/ts/utils/stream-map.js +62 -0
- package/ts/utils/stream-map.js.map +1 -0
- package/ts/utils/stream-map.test.d.ts +2 -0
- package/ts/utils/stream-map.test.d.ts.map +1 -0
- package/ts/utils/stream-map.test.js +87 -0
- package/ts/utils/stream-map.test.js.map +1 -0
- package/ts/utils/stream-test-helper.d.ts +17 -0
- package/ts/utils/stream-test-helper.d.ts.map +1 -0
- package/ts/utils/stream-test-helper.js +37 -0
- package/ts/utils/stream-test-helper.js.map +1 -0
- package/ts/utils/stream2string.d.ts +3 -0
- package/ts/utils/stream2string.d.ts.map +1 -0
- package/ts/utils/stream2string.js +48 -0
- package/ts/utils/stream2string.js.map +1 -0
- package/ts/utils/stream2string.test.d.ts +2 -0
- package/ts/utils/stream2string.test.d.ts.map +1 -0
- package/ts/utils/stream2string.test.js +29 -0
- package/ts/utils/stream2string.test.js.map +1 -0
- package/ts/utils/string2stream.d.ts +4 -0
- package/ts/utils/string2stream.d.ts.map +1 -0
- package/ts/utils/string2stream.js +13 -0
- package/ts/utils/string2stream.js.map +1 -0
- package/ts/utils/string2stream.test.d.ts +2 -0
- package/ts/utils/string2stream.test.d.ts.map +1 -0
- package/ts/utils/string2stream.test.js +6 -0
- package/ts/utils/string2stream.test.js.map +1 -0
- package/ts/version.d.ts +2 -0
- package/ts/version.d.ts.map +1 -0
- package/ts/version.js +4 -0
- package/ts/version.js.map +1 -0
- package/ts/web/index.d.ts +2 -0
- package/ts/web/index.d.ts.map +1 -0
- package/ts/web/index.js +2 -0
- package/ts/web/index.js.map +1 -0
- package/ts/web/web-sys-abstraction.d.ts +4 -0
- package/ts/web/web-sys-abstraction.d.ts.map +1 -0
- package/ts/web/web-sys-abstraction.js +64 -0
- package/ts/web/web-sys-abstraction.js.map +1 -0
- package/utils/index.cjs +0 -42
- package/utils/index.cjs.map +1 -1
- package/utils/index.d.cts +1 -2
- package/utils/index.d.ts +1 -2
- package/utils/index.js +2 -7
- package/web/index.cjs +25 -7
- package/web/index.cjs.map +1 -1
- package/web/index.d.cts +2 -1
- package/web/index.d.ts +2 -1
- package/web/index.js +3 -3
- package/chunk-DPIL5UIL.js.map +0 -1
- package/chunk-LCPYQVWT.js +0 -21
- package/chunk-OXD3YZZ7.js.map +0 -1
- package/chunk-P5RXA4C4.js.map +0 -1
- package/chunk-YDIUMYIE.js.map +0 -1
@@ -0,0 +1,99 @@
|
|
1
|
+
import { BaseSysAbstraction, WrapperSysAbstraction, } from "../base-sys-abstraction.js";
|
2
|
+
import { NodeFileService } from "./node-file-service.js";
|
3
|
+
import { envFactory } from "../sys-env.js";
|
4
|
+
import { Utf8EnDecoderSingleton } from "../txt-en-decoder.js";
|
5
|
+
import process from "node:process";
|
6
|
+
export class NodeExitServiceImpl {
|
7
|
+
constructor() {
|
8
|
+
this._exitHandlers = [];
|
9
|
+
this.invoked = false;
|
10
|
+
this._handleExit = async () => {
|
11
|
+
if (this.invoked) {
|
12
|
+
return;
|
13
|
+
}
|
14
|
+
this.invoked = true;
|
15
|
+
for (const h of this._exitHandlers) {
|
16
|
+
try {
|
17
|
+
const ret = h.hdl();
|
18
|
+
if (typeof ret.then === "function") {
|
19
|
+
await ret;
|
20
|
+
}
|
21
|
+
}
|
22
|
+
finally {
|
23
|
+
}
|
24
|
+
}
|
25
|
+
};
|
26
|
+
process.on("unhandledRejection", (reason, p) => {
|
27
|
+
this.exit(19);
|
28
|
+
});
|
29
|
+
process.on("uncaughtException", (error) => {
|
30
|
+
this.exit(18);
|
31
|
+
});
|
32
|
+
process.on("close", () => {
|
33
|
+
this.exit(0);
|
34
|
+
});
|
35
|
+
process.on("exit", () => {
|
36
|
+
this.exit(0);
|
37
|
+
});
|
38
|
+
process.on("SIGQUIT", () => {
|
39
|
+
this.exit(3);
|
40
|
+
});
|
41
|
+
process.on("SIGINT", () => {
|
42
|
+
this.exit(2);
|
43
|
+
});
|
44
|
+
process.on("SIGTERM", () => {
|
45
|
+
this.exit(9);
|
46
|
+
});
|
47
|
+
}
|
48
|
+
injectExitHandlers(hdls) {
|
49
|
+
this._exitHandlers = hdls;
|
50
|
+
}
|
51
|
+
exit(code) {
|
52
|
+
this._handleExit()
|
53
|
+
.then(() => {
|
54
|
+
process.exit(code);
|
55
|
+
})
|
56
|
+
.catch((err) => {
|
57
|
+
console.error("ExitService: failed to handle exit", err);
|
58
|
+
process.exit(code);
|
59
|
+
});
|
60
|
+
}
|
61
|
+
}
|
62
|
+
export class NodeSystemService {
|
63
|
+
constructor() {
|
64
|
+
this._exitService = new NodeExitServiceImpl();
|
65
|
+
this._exitService.injectExitHandlers(NodeSystemService._exitHandlers);
|
66
|
+
}
|
67
|
+
Env() {
|
68
|
+
return envFactory();
|
69
|
+
}
|
70
|
+
Args() {
|
71
|
+
return process.argv;
|
72
|
+
}
|
73
|
+
OnExit(hdl) {
|
74
|
+
const id = crypto.randomUUID();
|
75
|
+
NodeSystemService._exitHandlers.push({ hdl, id });
|
76
|
+
return () => {
|
77
|
+
const idx = NodeSystemService._exitHandlers.findIndex((h) => h.id === id);
|
78
|
+
if (idx >= 0) {
|
79
|
+
NodeSystemService._exitHandlers.splice(idx, 1);
|
80
|
+
}
|
81
|
+
};
|
82
|
+
}
|
83
|
+
Exit(code) {
|
84
|
+
this._exitService.exit(code);
|
85
|
+
}
|
86
|
+
}
|
87
|
+
NodeSystemService._exitHandlers = [];
|
88
|
+
let my = undefined;
|
89
|
+
export function NodeSysAbstraction(param) {
|
90
|
+
if (!my) {
|
91
|
+
my = new BaseSysAbstraction({
|
92
|
+
TxtEnDecoder: (param === null || param === void 0 ? void 0 : param.TxtEnDecoder) || Utf8EnDecoderSingleton(),
|
93
|
+
FileSystem: new NodeFileService(),
|
94
|
+
SystemService: new NodeSystemService(),
|
95
|
+
});
|
96
|
+
}
|
97
|
+
return new WrapperSysAbstraction(my, param);
|
98
|
+
}
|
99
|
+
//# sourceMappingURL=node-sys-abstraction.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"node-sys-abstraction.js","sourceRoot":"","sources":["../../../src/node/node-sys-abstraction.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAGlB,qBAAqB,GAEtB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAO,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,sBAA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AiB,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;YAC1E,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;gBACb,iBAAiB,CAAC,aAAa,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YACjD,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,IAAY;QACf,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;;AA3Be,+BAAa,GAAkB,EAAE,AAApB,CAAqB;AA8BpD,IAAI,EAAE,GAAmC,SAAS,CAAC;AACnD,MAAM,UAAU,kBAAkB,CAAC,KAAmC;IACpE,IAAI,CAAC,EAAE,EAAE,CAAC;QACR,EAAE,GAAG,IAAI,kBAAkB,CAAC;YAC1B,YAAY,EAAE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,YAAY,KAAI,sBAAsB,EAAE;YAC7D,UAAU,EAAE,IAAI,eAAe,EAAE;YACjC,aAAa,EAAE,IAAI,iBAAiB,EAAE;SACvC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,IAAI,qBAAqB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AAC9C,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"node-sys-abstraction.test.d.ts","sourceRoot":"","sources":["../../../src/node/node-sys-abstraction.test.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
import { runtimeFn } from "@adviser/cement";
|
2
|
+
function exitHandler(errCode, larg, done) {
|
3
|
+
return (err, stdout, stderr) => {
|
4
|
+
if (err) {
|
5
|
+
expect(err.code).toBe(errCode);
|
6
|
+
}
|
7
|
+
if (stdout) {
|
8
|
+
const res = stdout
|
9
|
+
.toString()
|
10
|
+
.split("\n")
|
11
|
+
.filter((line) => line.trim())
|
12
|
+
.map((line) => {
|
13
|
+
const out = JSON.parse(line);
|
14
|
+
return out;
|
15
|
+
})
|
16
|
+
.map((obj) => {
|
17
|
+
delete obj.pid;
|
18
|
+
return obj;
|
19
|
+
});
|
20
|
+
expect(res).toEqual([
|
21
|
+
{
|
22
|
+
larg: larg,
|
23
|
+
},
|
24
|
+
{
|
25
|
+
larg: larg,
|
26
|
+
msg: "Called OnExit 1",
|
27
|
+
},
|
28
|
+
{
|
29
|
+
larg: larg,
|
30
|
+
msg: "Called OnExit 2",
|
31
|
+
},
|
32
|
+
]);
|
33
|
+
done();
|
34
|
+
}
|
35
|
+
if (stderr) {
|
36
|
+
expect(stderr).toEqual({});
|
37
|
+
}
|
38
|
+
};
|
39
|
+
}
|
40
|
+
describe("node_sys", () => {
|
41
|
+
if (runtimeFn().isNodeIsh || runtimeFn().isDeno) {
|
42
|
+
let fnExec;
|
43
|
+
let execHandler = "tsx src/test/test-exit-handler.ts";
|
44
|
+
beforeAll(async () => {
|
45
|
+
const { exec } = await import("node:child_process");
|
46
|
+
fnExec = exec;
|
47
|
+
if (runtimeFn().isDeno) {
|
48
|
+
execHandler = "deno run --allow-net --allow-read --allow-run --unstable-sloppy-imports src/test/test-exit-handler.ts";
|
49
|
+
}
|
50
|
+
});
|
51
|
+
it("just-exit", () => {
|
52
|
+
return new Promise((done) => {
|
53
|
+
fnExec(`${execHandler} exit24`, exitHandler(24, "exit24", done));
|
54
|
+
});
|
55
|
+
});
|
56
|
+
it("throw", () => {
|
57
|
+
return new Promise((done) => {
|
58
|
+
fnExec(`${execHandler} throw`, exitHandler(19, "throw", done));
|
59
|
+
});
|
60
|
+
});
|
61
|
+
it("via sigint", () => {
|
62
|
+
return new Promise((done) => {
|
63
|
+
fnExec(`${execHandler} sigint`, exitHandler(2, "sigint", done));
|
64
|
+
});
|
65
|
+
});
|
66
|
+
it("via sigterm", () => {
|
67
|
+
return new Promise((done) => {
|
68
|
+
fnExec(`${execHandler} sigterm`, exitHandler(9, "sigterm", done));
|
69
|
+
});
|
70
|
+
});
|
71
|
+
it("via sigquit", () => {
|
72
|
+
return new Promise((done) => {
|
73
|
+
fnExec(`${execHandler} sigquit`, exitHandler(3, "sigquit", done));
|
74
|
+
});
|
75
|
+
});
|
76
|
+
}
|
77
|
+
else {
|
78
|
+
it.skip("nothing in browser", () => {
|
79
|
+
expect(true).toBe(true);
|
80
|
+
});
|
81
|
+
}
|
82
|
+
});
|
83
|
+
//# sourceMappingURL=node-sys-abstraction.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"node-sys-abstraction.test.js","sourceRoot":"","sources":["../../../src/node/node-sys-abstraction.test.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,SAAS,WAAW,CAAC,OAAe,EAAE,IAAY,EAAE,IAAgB;IAClE,OAAO,CAAC,GAAyB,EAAE,MAAuB,EAAE,MAAuB,EAAQ,EAAE;QAC3F,IAAI,GAAG,EAAE,CAAC;YACR,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC;QACD,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,GAAG,GAAG,MAAM;iBACf,QAAQ,EAAE;iBACV,KAAK,CAAC,IAAI,CAAC;iBACX,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;iBAC7B,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;gBACZ,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC7B,OAAO,GAAG,CAAC;YACb,CAAC,CAAC;iBACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;gBACX,OAAO,GAAG,CAAC,GAAG,CAAC;gBACf,OAAO,GAAG,CAAC;YACb,CAAC,CAAC,CAAC;YACL,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;gBAClB;oBACE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CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,YAAY,EAAE,GAAG,EAAE;YACpB,OAAO,IAAI,OAAO,CAAO,CAAC,IAAI,EAAE,EAAE;gBAChC,MAAM,CAAC,GAAG,WAAW,UAAU,EAAE,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;YACnE,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,aAAa,EAAE,GAAG,EAAE;YACrB,OAAO,IAAI,OAAO,CAAO,CAAC,IAAI,EAAE,EAAE;gBAChC,MAAM,CAAC,GAAG,WAAW,WAAW,EAAE,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;YACrE,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,aAAa,EAAE,GAAG,EAAE;YACrB,OAAO,IAAI,OAAO,CAAO,CAAC,IAAI,EAAE,EAAE;gBAChC,MAAM,CAAC,GAAG,WAAW,WAAW,EAAE,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;YACrE,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,GAAG,EAAE;YACjC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC"}
|
package/ts/option.d.ts
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
export declare abstract class Option<T> {
|
2
|
+
static Some<T>(t: T): Option<T>;
|
3
|
+
static None<T>(): Option<T>;
|
4
|
+
static Is<T>(t: unknown): t is Option<T>;
|
5
|
+
IsNone(): boolean;
|
6
|
+
IsSome(): boolean;
|
7
|
+
Unwrap(): T;
|
8
|
+
abstract is_none(): boolean;
|
9
|
+
abstract is_some(): boolean;
|
10
|
+
abstract unwrap(): T;
|
11
|
+
}
|
12
|
+
export declare class Some<T> extends Option<T> {
|
13
|
+
private _t;
|
14
|
+
constructor(_t: T);
|
15
|
+
is_none(): boolean;
|
16
|
+
is_some(): boolean;
|
17
|
+
unwrap(): T;
|
18
|
+
}
|
19
|
+
export declare class None<T> extends Option<T> {
|
20
|
+
is_none(): boolean;
|
21
|
+
is_some(): boolean;
|
22
|
+
unwrap(): T;
|
23
|
+
}
|
24
|
+
export type WithoutOption<T> = T extends Option<infer U> ? U : T;
|
25
|
+
//# sourceMappingURL=option.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"option.d.ts","sourceRoot":"","sources":["../../src/option.ts"],"names":[],"mappings":"AAAA,8BAAsB,MAAM,CAAC,CAAC;IAC5B,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;IAI/B,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC;IAI3B,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC;IAIxC,MAAM,IAAI,OAAO;IAIjB,MAAM,IAAI,OAAO;IAGjB,MAAM,IAAI,CAAC;IAIX,QAAQ,CAAC,OAAO,IAAI,OAAO;IAC3B,QAAQ,CAAC,OAAO,IAAI,OAAO;IAC3B,QAAQ,CAAC,MAAM,IAAI,CAAC;CACrB;AAED,qBAAa,IAAI,CAAC,CAAC,CAAE,SAAQ,MAAM,CAAC,CAAC,CAAC;IACpC,OAAO,CAAC,EAAE,CAAI;gBACF,EAAE,EAAE,CAAC;IAKjB,OAAO,IAAI,OAAO;IAGlB,OAAO,IAAI,OAAO;IAGlB,MAAM,IAAI,CAAC;CAGZ;AAED,qBAAa,IAAI,CAAC,CAAC,CAAE,SAAQ,MAAM,CAAC,CAAC,CAAC;IACpC,OAAO,IAAI,OAAO;IAGlB,OAAO,IAAI,OAAO;IAGlB,MAAM,IAAI,CAAC;CAGZ;AAED,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC"}
|
package/ts/option.js
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
export class Option {
|
2
|
+
static Some(t) {
|
3
|
+
return new Some(t);
|
4
|
+
}
|
5
|
+
static None() {
|
6
|
+
return new None();
|
7
|
+
}
|
8
|
+
static Is(t) {
|
9
|
+
return t instanceof Option;
|
10
|
+
}
|
11
|
+
IsNone() {
|
12
|
+
return this.is_none();
|
13
|
+
}
|
14
|
+
IsSome() {
|
15
|
+
return this.is_some();
|
16
|
+
}
|
17
|
+
Unwrap() {
|
18
|
+
return this.unwrap();
|
19
|
+
}
|
20
|
+
}
|
21
|
+
export class Some extends Option {
|
22
|
+
constructor(_t) {
|
23
|
+
super();
|
24
|
+
this._t = _t;
|
25
|
+
}
|
26
|
+
is_none() {
|
27
|
+
return false;
|
28
|
+
}
|
29
|
+
is_some() {
|
30
|
+
return true;
|
31
|
+
}
|
32
|
+
unwrap() {
|
33
|
+
return this._t;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
export class None extends Option {
|
37
|
+
is_none() {
|
38
|
+
return true;
|
39
|
+
}
|
40
|
+
is_some() {
|
41
|
+
return false;
|
42
|
+
}
|
43
|
+
unwrap() {
|
44
|
+
throw new Error("None.unwrap");
|
45
|
+
}
|
46
|
+
}
|
47
|
+
//# sourceMappingURL=option.js.map
|
package/ts/option.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"option.js","sourceRoot":"","sources":["../../src/option.ts"],"names":[],"mappings":"AAAA,MAAM,OAAgB,MAAM;IAC1B,MAAM,CAAC,IAAI,CAAI,CAAI;QACjB,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,IAAI;QACT,OAAO,IAAI,IAAI,EAAE,CAAC;IACpB,CAAC;IAED,MAAM,CAAC,EAAE,CAAI,CAAU;QACrB,OAAO,CAAC,YAAY,MAAM,CAAC;IAC7B,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IACD,MAAM;QACJ,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACvB,CAAC;CAKF;AAED,MAAM,OAAO,IAAQ,SAAQ,MAAS;IAEpC,YAAY,EAAK;QACf,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IAED,OAAO;QACL,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO;QACL,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM;QACJ,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;CACF;AAED,MAAM,OAAO,IAAQ,SAAQ,MAAS;IACpC,OAAO;QACL,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO;QACL,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM;QACJ,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;IACjC,CAAC;CACF"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"refcounted.d.ts","sourceRoot":"","sources":["../../src/refcounted.ts"],"names":[],"mappings":"AAKA,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAiBtE"}
|
package/ts/refcounted.js
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
export function wrapRefcounted(t, method) {
|
2
|
+
const my = t;
|
3
|
+
my.__refcounted = (my.__refcounted || 0) + 1;
|
4
|
+
if (my.__refcounted === 1) {
|
5
|
+
my.__unrefcounted = my[method];
|
6
|
+
const mRec = my;
|
7
|
+
mRec[method] = function () {
|
8
|
+
this.__refcounted--;
|
9
|
+
if (this.__refcounted === 0) {
|
10
|
+
this.__unrefcounted();
|
11
|
+
}
|
12
|
+
if (this.__refcounted < 0) {
|
13
|
+
throw new Error("already closed");
|
14
|
+
}
|
15
|
+
};
|
16
|
+
}
|
17
|
+
return t;
|
18
|
+
}
|
19
|
+
//# sourceMappingURL=refcounted.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"refcounted.js","sourceRoot":"","sources":["../../src/refcounted.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,cAAc,CAAsB,CAAI,EAAE,MAAS;IACjE,MAAM,EAAE,GAAG,CAAqB,CAAC;IACjC,EAAE,CAAC,YAAY,GAAG,CAAC,EAAE,CAAC,YAAY,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAC7C,IAAI,EAAE,CAAC,YAAY,KAAK,CAAC,EAAE,CAAC;QAC1B,EAAE,CAAC,cAAc,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC;QAC/B,MAAM,IAAI,GAAG,EAAgC,CAAC;QAC9C,IAAI,CAAC,MAAM,CAAC,GAAG;YACb,IAAI,CAAC,YAAY,EAAE,CAAC;YACpB,IAAI,IAAI,CAAC,YAAY,KAAK,CAAC,EAAE,CAAC;gBAC5B,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,CAAC;YACD,IAAI,IAAI,CAAC,YAAY,GAAG,CAAC,EAAE,CAAC;gBAC1B,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACpC,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"refcounted.test.d.ts","sourceRoot":"","sources":["../../src/refcounted.test.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { wrapRefcounted } from "./refcounted.js";
|
2
|
+
class RealInstance {
|
3
|
+
constructor(x) {
|
4
|
+
this.isOpen = true;
|
5
|
+
this.x = x;
|
6
|
+
}
|
7
|
+
wurst() {
|
8
|
+
return this.x++;
|
9
|
+
}
|
10
|
+
close() {
|
11
|
+
if (!this.isOpen) {
|
12
|
+
throw new Error("already closed");
|
13
|
+
}
|
14
|
+
this.isOpen = false;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
it("simple", () => {
|
18
|
+
const obj = wrapRefcounted(new RealInstance(42), "close");
|
19
|
+
expect(obj.wurst()).toBe(42);
|
20
|
+
obj.close();
|
21
|
+
expect(() => obj.close()).toThrowError("already closed");
|
22
|
+
});
|
23
|
+
it("nested", () => {
|
24
|
+
const ri = new RealInstance(42);
|
25
|
+
const obj1 = wrapRefcounted(ri, "close");
|
26
|
+
const obj2 = wrapRefcounted(ri, "close");
|
27
|
+
expect(obj1).toBe(obj2);
|
28
|
+
expect(obj1.wurst()).toBe(42);
|
29
|
+
expect(obj2.wurst()).toBe(43);
|
30
|
+
obj2.close();
|
31
|
+
expect(obj2.isOpen).toBe(true);
|
32
|
+
expect(obj2.wurst()).toBe(44);
|
33
|
+
expect(obj1.wurst()).toBe(45);
|
34
|
+
obj1.close();
|
35
|
+
expect(obj1.wurst()).toBe(46);
|
36
|
+
expect(obj2.isOpen).toBe(false);
|
37
|
+
expect(() => obj2.close()).toThrowError("already closed");
|
38
|
+
});
|
39
|
+
//# sourceMappingURL=refcounted.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"refcounted.test.js","sourceRoot":"","sources":["../../src/refcounted.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,YAAY;IAGhB,YAAY,CAAS;QADrB,WAAM,GAAG,IAAI,CAAC;QAEZ,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CA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AC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9B,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9B,IAAI,CAAC,KAAK,EAAE,CAAC;IACb,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;AAC5D,CAAC,CAAC,CAAC"}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import { Future } from "./future.js";
|
2
|
+
interface ResolveSeqItem<T, C> {
|
3
|
+
readonly future: Future<T>;
|
4
|
+
readonly fn: (c: C) => Promise<T>;
|
5
|
+
readonly id?: number;
|
6
|
+
}
|
7
|
+
export declare class ResolveSeq<T, C = void> {
|
8
|
+
readonly ctx: C;
|
9
|
+
constructor(ctx?: C);
|
10
|
+
reset(): void;
|
11
|
+
_step(item?: ResolveSeqItem<T, C> | undefined): Promise<void>;
|
12
|
+
readonly _seqFutures: ResolveSeqItem<T, C>[];
|
13
|
+
add(fn: (c: C) => Promise<T>, id?: number): Promise<T>;
|
14
|
+
}
|
15
|
+
export declare class ResolveOnce<T, CTX = void> {
|
16
|
+
_onceDone: boolean;
|
17
|
+
readonly _onceFutures: Future<T>[];
|
18
|
+
_onceOk: boolean;
|
19
|
+
_onceValue?: T;
|
20
|
+
_onceError?: Error;
|
21
|
+
_isPromise: boolean;
|
22
|
+
readonly ctx: CTX;
|
23
|
+
constructor(ctx?: CTX);
|
24
|
+
get ready(): boolean;
|
25
|
+
reset(): void;
|
26
|
+
once<R>(fn: (c: CTX) => R): R;
|
27
|
+
}
|
28
|
+
export declare class Keyed<T extends {
|
29
|
+
reset: () => void;
|
30
|
+
}, K = string> {
|
31
|
+
private readonly _map;
|
32
|
+
readonly factory: (key: K) => T;
|
33
|
+
constructor(factory: (key: K) => T);
|
34
|
+
asyncGet(key: () => Promise<K>): Promise<T>;
|
35
|
+
get(key: K | (() => K)): T;
|
36
|
+
unget(key: K): void;
|
37
|
+
reset(): void;
|
38
|
+
}
|
39
|
+
export declare class KeyedResolvOnce<T, K = string> extends Keyed<ResolveOnce<T, K>, K> {
|
40
|
+
constructor();
|
41
|
+
}
|
42
|
+
export declare class KeyedResolvSeq<T, K = string> extends Keyed<ResolveSeq<T, K>, K> {
|
43
|
+
constructor();
|
44
|
+
}
|
45
|
+
export {};
|
46
|
+
//# sourceMappingURL=resolve-once.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"resolve-once.d.ts","sourceRoot":"","sources":["../../src/resolve-once.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,UAAU,cAAc,CAAC,CAAC,EAAE,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAC3B,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,UAAU,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI;IACjC,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC;gBACJ,GAAG,CAAC,EAAE,CAAC;IAGnB,KAAK,IAAI,IAAI;IAGP,KAAK,CAAC,IAAI,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAcnE,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,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AQ,KAAK,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;;CAI9E;AAED,qBAAa,cAAc,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,CAAE,SAAQ,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;;CAI5E"}
|
@@ -0,0 +1,152 @@
|
|
1
|
+
import { Future } from "./future.js";
|
2
|
+
export class ResolveSeq {
|
3
|
+
constructor(ctx) {
|
4
|
+
this._seqFutures = [];
|
5
|
+
this.ctx = ctx;
|
6
|
+
}
|
7
|
+
reset() {
|
8
|
+
}
|
9
|
+
async _step(item) {
|
10
|
+
if (!item) {
|
11
|
+
return;
|
12
|
+
}
|
13
|
+
item
|
14
|
+
.fn(this.ctx)
|
15
|
+
.then((value) => item.future.resolve(value))
|
16
|
+
.catch((e) => item.future.reject(e))
|
17
|
+
.finally(() => {
|
18
|
+
this._seqFutures.shift();
|
19
|
+
this._step(this._seqFutures[0]);
|
20
|
+
});
|
21
|
+
}
|
22
|
+
async add(fn, id) {
|
23
|
+
const future = new Future();
|
24
|
+
this._seqFutures.push({ future, fn, id });
|
25
|
+
if (this._seqFutures.length === 1) {
|
26
|
+
this._step(this._seqFutures[0]);
|
27
|
+
}
|
28
|
+
return future.asPromise();
|
29
|
+
}
|
30
|
+
}
|
31
|
+
export class ResolveOnce {
|
32
|
+
constructor(ctx) {
|
33
|
+
this._onceDone = false;
|
34
|
+
this._onceFutures = [];
|
35
|
+
this._onceOk = false;
|
36
|
+
this._isPromise = false;
|
37
|
+
this.ctx = ctx;
|
38
|
+
}
|
39
|
+
get ready() {
|
40
|
+
return this._onceDone;
|
41
|
+
}
|
42
|
+
reset() {
|
43
|
+
this._onceDone = false;
|
44
|
+
this._onceOk = false;
|
45
|
+
this._onceValue = undefined;
|
46
|
+
this._onceError = undefined;
|
47
|
+
this._onceFutures.length = 0;
|
48
|
+
}
|
49
|
+
once(fn) {
|
50
|
+
if (this._onceDone) {
|
51
|
+
if (this._onceError) {
|
52
|
+
if (this._isPromise) {
|
53
|
+
return Promise.reject(this._onceError);
|
54
|
+
}
|
55
|
+
else {
|
56
|
+
throw this._onceError;
|
57
|
+
}
|
58
|
+
}
|
59
|
+
if (this._onceOk) {
|
60
|
+
if (this._isPromise) {
|
61
|
+
return Promise.resolve(this._onceValue);
|
62
|
+
}
|
63
|
+
else {
|
64
|
+
return this._onceValue;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
throw new Error("ResolveOnce.once impossible");
|
68
|
+
}
|
69
|
+
const future = new Future();
|
70
|
+
this._onceFutures.push(future);
|
71
|
+
if (this._onceFutures.length === 1) {
|
72
|
+
const okFn = (value) => {
|
73
|
+
this._onceValue = value;
|
74
|
+
this._onceOk = true;
|
75
|
+
this._onceDone = true;
|
76
|
+
if (this._isPromise) {
|
77
|
+
this._onceFutures.forEach((f) => f.resolve(this._onceValue));
|
78
|
+
}
|
79
|
+
this._onceFutures.length = 0;
|
80
|
+
};
|
81
|
+
const catchFn = (e) => {
|
82
|
+
this._onceError = e;
|
83
|
+
this._onceOk = false;
|
84
|
+
this._onceValue = undefined;
|
85
|
+
this._onceDone = true;
|
86
|
+
if (this._isPromise) {
|
87
|
+
this._onceFutures.forEach((f) => f.reject(this._onceError));
|
88
|
+
}
|
89
|
+
this._onceFutures.length = 0;
|
90
|
+
};
|
91
|
+
try {
|
92
|
+
const ret = fn(this.ctx);
|
93
|
+
if (typeof ret.then === "function") {
|
94
|
+
this._isPromise = true;
|
95
|
+
ret.then(okFn).catch(catchFn);
|
96
|
+
}
|
97
|
+
else {
|
98
|
+
okFn(ret);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
catch (e) {
|
102
|
+
catchFn(e);
|
103
|
+
}
|
104
|
+
}
|
105
|
+
if (this._isPromise) {
|
106
|
+
return future.asPromise();
|
107
|
+
}
|
108
|
+
else {
|
109
|
+
return this.once(fn);
|
110
|
+
}
|
111
|
+
}
|
112
|
+
}
|
113
|
+
export class Keyed {
|
114
|
+
constructor(factory) {
|
115
|
+
this._map = new Map();
|
116
|
+
this.factory = factory;
|
117
|
+
}
|
118
|
+
async asyncGet(key) {
|
119
|
+
return this.get(await key());
|
120
|
+
}
|
121
|
+
get(key) {
|
122
|
+
if (typeof key === "function") {
|
123
|
+
key = key();
|
124
|
+
}
|
125
|
+
let keyed = this._map.get(key);
|
126
|
+
if (!keyed) {
|
127
|
+
keyed = this.factory(key);
|
128
|
+
this._map.set(key, keyed);
|
129
|
+
}
|
130
|
+
return keyed;
|
131
|
+
}
|
132
|
+
unget(key) {
|
133
|
+
const keyed = this._map.get(key);
|
134
|
+
keyed === null || keyed === void 0 ? void 0 : keyed.reset();
|
135
|
+
this._map.delete(key);
|
136
|
+
}
|
137
|
+
reset() {
|
138
|
+
this._map.forEach((keyed) => keyed.reset());
|
139
|
+
this._map.clear();
|
140
|
+
}
|
141
|
+
}
|
142
|
+
export class KeyedResolvOnce extends Keyed {
|
143
|
+
constructor() {
|
144
|
+
super((key) => new ResolveOnce(key));
|
145
|
+
}
|
146
|
+
}
|
147
|
+
export class KeyedResolvSeq extends Keyed {
|
148
|
+
constructor() {
|
149
|
+
super((key) => new ResolveSeq(key));
|
150
|
+
}
|
151
|
+
}
|
152
|
+
//# sourceMappingURL=resolve-once.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"resolve-once.js","sourceRoot":"","sources":["../../src/resolve-once.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAQrC,MAAM,OAAO,UAAU;IAErB,YAAY,GAAO;QAoBV,gBAAW,GAA2B,EAAE,CAAC;QAnBhD,IAAI,CAAC,GAAG,GAAG,GAAQ,CAAC;IACtB,CAAC;IACD,KAAK;IAEL,CAAC;IACD,KAAK,CAAC,KAAK,CAAC,IAAuC;QACjD,IAAI,CAAC,IAAI,EAAE,CAAC;YAEV,OAAO;QACT,CAAC;QACD,IAAI;aACD,EA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