@adviser/cement 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/base_sys_abstraction.d.ts +79 -0
- package/base_sys_abstraction.d.ts.map +1 -0
- package/base_sys_abstraction.js +186 -0
- package/base_sys_abstraction.js.map +1 -0
- package/base_sys_abstraction.test.d.ts +2 -0
- package/base_sys_abstraction.test.d.ts.map +1 -0
- package/base_sys_abstraction.test.js +77 -0
- package/base_sys_abstraction.test.js.map +1 -0
- package/index.d.ts +3 -0
- package/index.d.ts.map +1 -1
- package/index.js +3 -0
- package/index.js.map +1 -1
- package/logger.test.js +4 -3
- package/logger.test.js.map +1 -1
- package/logger_impl.js +1 -1
- package/logger_impl.js.map +1 -1
- package/node_sys_abstraction.d.ts +4 -74
- package/node_sys_abstraction.d.ts.map +1 -1
- package/node_sys_abstraction.js +10 -174
- package/node_sys_abstraction.js.map +1 -1
- package/node_sys_abstraction.test.js +0 -66
- package/node_sys_abstraction.test.js.map +1 -1
- package/option.d.ts +1 -0
- package/option.d.ts.map +1 -1
- package/package.json +2 -2
- package/test/test-exit-handler.js +1 -1
- package/test/test-exit-handler.js.map +1 -1
- package/web_sys_abstraction.d.ts +4 -0
- package/web_sys_abstraction.d.ts.map +1 -0
- package/web_sys_abstraction.js +65 -0
- package/web_sys_abstraction.js.map +1 -0
@@ -0,0 +1,79 @@
|
|
1
|
+
import { FileService } from "./file_service";
|
2
|
+
import { TimeMode, RandomMode, IDMode, SystemService, VoidFunc, SysAbstraction } from "./sys_abstraction";
|
3
|
+
import { Time } from "./time";
|
4
|
+
export declare class SysTime extends Time {
|
5
|
+
Now(): Date;
|
6
|
+
Sleep(duration: number): Promise<void>;
|
7
|
+
}
|
8
|
+
export declare class ConstTime extends Time {
|
9
|
+
Now(): Date;
|
10
|
+
Sleep(duration: number): Promise<void>;
|
11
|
+
}
|
12
|
+
export declare class StepTime extends Time {
|
13
|
+
_step: Date;
|
14
|
+
constructor();
|
15
|
+
Now(): Date;
|
16
|
+
Sleep(duration: number): Promise<void>;
|
17
|
+
}
|
18
|
+
export declare function TimeFactory(timeMode: TimeMode): Time;
|
19
|
+
export declare class RandomService {
|
20
|
+
readonly _mode: RandomMode;
|
21
|
+
_step: number;
|
22
|
+
constructor(mode: RandomMode);
|
23
|
+
Random0ToValue(value: number): number;
|
24
|
+
}
|
25
|
+
export declare class IdService {
|
26
|
+
readonly _mode: IDMode;
|
27
|
+
_step: number;
|
28
|
+
constructor(mode?: IDMode);
|
29
|
+
NextId(): string;
|
30
|
+
}
|
31
|
+
export interface BaseSysAbstractionParams {
|
32
|
+
readonly FileSystem: FileService;
|
33
|
+
readonly SystemService: SystemService;
|
34
|
+
}
|
35
|
+
export interface ExitHandler {
|
36
|
+
readonly hdl: VoidFunc;
|
37
|
+
readonly id: string;
|
38
|
+
}
|
39
|
+
export interface ExitService {
|
40
|
+
injectExitHandlers(hdls: ExitHandler[]): void;
|
41
|
+
exit(code: number): void;
|
42
|
+
}
|
43
|
+
export declare class BaseSysAbstraction {
|
44
|
+
readonly _time: SysTime;
|
45
|
+
readonly _stdout: WritableStream<any>;
|
46
|
+
readonly _stderr: WritableStream<any>;
|
47
|
+
readonly _idService: IdService;
|
48
|
+
readonly _randomService: RandomService;
|
49
|
+
readonly _fileSystem: FileService;
|
50
|
+
readonly _systemService: SystemService;
|
51
|
+
constructor(params: BaseSysAbstractionParams);
|
52
|
+
}
|
53
|
+
export interface WrapperSysAbstractionParams {
|
54
|
+
readonly TimeMode?: TimeMode;
|
55
|
+
readonly IdMode?: IDMode;
|
56
|
+
readonly Stdout?: WritableStream<Uint8Array>;
|
57
|
+
readonly Stderr?: WritableStream<Uint8Array>;
|
58
|
+
readonly RandomMode?: RandomMode;
|
59
|
+
readonly FileSystem?: FileService;
|
60
|
+
readonly SystemService?: SystemService;
|
61
|
+
}
|
62
|
+
export declare class WrapperSysAbstraction implements SysAbstraction {
|
63
|
+
readonly _time: Time;
|
64
|
+
readonly _stdout: WritableStream<Uint8Array>;
|
65
|
+
readonly _stderr: WritableStream<Uint8Array>;
|
66
|
+
readonly _idService: IdService;
|
67
|
+
readonly _randomService: RandomService;
|
68
|
+
readonly _fileSystem: FileService;
|
69
|
+
readonly _systemService: SystemService;
|
70
|
+
constructor(base: BaseSysAbstraction, params?: WrapperSysAbstractionParams);
|
71
|
+
Time(): Time;
|
72
|
+
NextId(): string;
|
73
|
+
Random0ToValue(value: number): number;
|
74
|
+
Stdout(): WritableStream;
|
75
|
+
Stderr(): WritableStream;
|
76
|
+
System(): SystemService;
|
77
|
+
FileSystem(): FileService;
|
78
|
+
}
|
79
|
+
//# sourceMappingURL=base_sys_abstraction.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"base_sys_abstraction.d.ts","sourceRoot":"","sources":["../src/base_sys_abstraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC1G,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,qBAAa,OAAQ,SAAQ,IAAI;IAC/B,GAAG,IAAI,IAAI;IAGX,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAOvC;AAED,qBAAa,SAAU,SAAQ,IAAI;IACjC,GAAG,IAAI,IAAI;IAIX,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGvC;AAED,qBAAa,QAAS,SAAQ,IAAI;IAChC,KAAK,EAAE,IAAI,CAAC;;IAKZ,GAAG;IAQH,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAIvC;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAUpD;AAED,qBAAa,aAAa;IACxB,QAAQ,CAAC,K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AU,CAAC,CAAC;IAC7C,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC;CACxC;AAED,qBAAa,qBAAsB,YAAW,cAAc;IAC1D,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAC7C,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAC7C,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,aAAa,CAAC;IACvC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,cAAc,EAAE,aAAa,CAAC;gBAC3B,IAAI,EAAE,kBAAkB,EAAE,MAAM,CAAC,EAAE,2BAA2B;IAgC1E,IAAI,IAAI,IAAI;IAGZ,MAAM,IAAI,MAAM;IAGhB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAGrC,MAAM,IAAI,cAAc;IAGxB,MAAM,IAAI,cAAc;IAIxB,MAAM,IAAI,aAAa;IAGvB,UAAU,IAAI,WAAW;CAG1B"}
|
@@ -0,0 +1,186 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.WrapperSysAbstraction = exports.BaseSysAbstraction = exports.IdService = exports.RandomService = exports.TimeFactory = exports.StepTime = exports.ConstTime = exports.SysTime = void 0;
|
4
|
+
const sys_abstraction_1 = require("./sys_abstraction");
|
5
|
+
const time_1 = require("./time");
|
6
|
+
class SysTime extends time_1.Time {
|
7
|
+
Now() {
|
8
|
+
return new Date();
|
9
|
+
}
|
10
|
+
Sleep(duration) {
|
11
|
+
return new Promise((resolve) => {
|
12
|
+
setTimeout(() => {
|
13
|
+
resolve();
|
14
|
+
}, duration);
|
15
|
+
});
|
16
|
+
}
|
17
|
+
}
|
18
|
+
exports.SysTime = SysTime;
|
19
|
+
class ConstTime extends time_1.Time {
|
20
|
+
Now() {
|
21
|
+
return new Date(2021, 1, 1, 0, 0, 0, 0);
|
22
|
+
}
|
23
|
+
Sleep(duration) {
|
24
|
+
return Promise.resolve();
|
25
|
+
}
|
26
|
+
}
|
27
|
+
exports.ConstTime = ConstTime;
|
28
|
+
class StepTime extends time_1.Time {
|
29
|
+
constructor() {
|
30
|
+
super();
|
31
|
+
this._step = new ConstTime().Now();
|
32
|
+
}
|
33
|
+
Now() {
|
34
|
+
if (this._step.getTime() === 0) {
|
35
|
+
this._step = new ConstTime().Now();
|
36
|
+
return this._step;
|
37
|
+
}
|
38
|
+
this._step = new Date(this._step.getTime() + 1000);
|
39
|
+
return this._step;
|
40
|
+
}
|
41
|
+
Sleep(duration) {
|
42
|
+
this._step = new Date(this._step.getTime() + duration);
|
43
|
+
return Promise.resolve();
|
44
|
+
}
|
45
|
+
}
|
46
|
+
exports.StepTime = StepTime;
|
47
|
+
function TimeFactory(timeMode) {
|
48
|
+
switch (timeMode) {
|
49
|
+
case sys_abstraction_1.TimeMode.REAL:
|
50
|
+
return new SysTime();
|
51
|
+
case sys_abstraction_1.TimeMode.CONST:
|
52
|
+
return new ConstTime();
|
53
|
+
case sys_abstraction_1.TimeMode.STEP:
|
54
|
+
return new StepTime();
|
55
|
+
}
|
56
|
+
return new SysTime();
|
57
|
+
}
|
58
|
+
exports.TimeFactory = TimeFactory;
|
59
|
+
class RandomService {
|
60
|
+
constructor(mode) {
|
61
|
+
this._step = 0;
|
62
|
+
this._mode = mode;
|
63
|
+
}
|
64
|
+
Random0ToValue(value) {
|
65
|
+
switch (this._mode) {
|
66
|
+
case sys_abstraction_1.RandomMode.CONST:
|
67
|
+
return 0.5 * value;
|
68
|
+
case sys_abstraction_1.RandomMode.STEP:
|
69
|
+
this._step += 0.0001;
|
70
|
+
return this._step * value;
|
71
|
+
case sys_abstraction_1.RandomMode.RANDOM:
|
72
|
+
return Math.random() * value;
|
73
|
+
default:
|
74
|
+
throw new Error("Unknown RandomMode");
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
78
|
+
exports.RandomService = RandomService;
|
79
|
+
class IdService {
|
80
|
+
constructor(mode) {
|
81
|
+
this._step = 0;
|
82
|
+
if (!mode) {
|
83
|
+
mode = sys_abstraction_1.IDMode.UUID;
|
84
|
+
}
|
85
|
+
this._mode = mode;
|
86
|
+
}
|
87
|
+
NextId() {
|
88
|
+
switch (this._mode) {
|
89
|
+
case sys_abstraction_1.IDMode.UUID:
|
90
|
+
return crypto.randomUUID();
|
91
|
+
case sys_abstraction_1.IDMode.CONST:
|
92
|
+
return "VeryUniqueID";
|
93
|
+
case sys_abstraction_1.IDMode.STEP:
|
94
|
+
return `STEPId-${this._step++}`;
|
95
|
+
default:
|
96
|
+
throw new Error("Unknown IDMode");
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
100
|
+
exports.IdService = IdService;
|
101
|
+
const decoder = new TextDecoder();
|
102
|
+
class BaseSysAbstraction {
|
103
|
+
constructor(params) {
|
104
|
+
this._time = new SysTime();
|
105
|
+
this._stdout = new WritableStream({
|
106
|
+
write(chunk) {
|
107
|
+
return new Promise((resolve) => {
|
108
|
+
const decoded = decoder.decode(chunk);
|
109
|
+
console.log(decoded.trimEnd());
|
110
|
+
resolve();
|
111
|
+
});
|
112
|
+
},
|
113
|
+
});
|
114
|
+
this._stderr = new WritableStream({
|
115
|
+
write(chunk) {
|
116
|
+
return new Promise((resolve) => {
|
117
|
+
const decoded = decoder.decode(chunk);
|
118
|
+
console.error(decoded.trimEnd());
|
119
|
+
resolve();
|
120
|
+
});
|
121
|
+
},
|
122
|
+
});
|
123
|
+
this._idService = new IdService();
|
124
|
+
this._randomService = new RandomService(sys_abstraction_1.RandomMode.RANDOM);
|
125
|
+
this._fileSystem = params.FileSystem;
|
126
|
+
this._systemService = params.SystemService;
|
127
|
+
}
|
128
|
+
}
|
129
|
+
exports.BaseSysAbstraction = BaseSysAbstraction;
|
130
|
+
class WrapperSysAbstraction {
|
131
|
+
constructor(base, params) {
|
132
|
+
this._time = base._time;
|
133
|
+
this._stdout = base._stdout;
|
134
|
+
this._stderr = base._stderr;
|
135
|
+
this._idService = base._idService;
|
136
|
+
this._randomService = base._randomService;
|
137
|
+
this._fileSystem = base._fileSystem;
|
138
|
+
this._systemService = base._systemService;
|
139
|
+
if (params) {
|
140
|
+
if (params.TimeMode) {
|
141
|
+
this._time = TimeFactory(params.TimeMode);
|
142
|
+
}
|
143
|
+
if (params.Stdout) {
|
144
|
+
this._stdout = params.Stdout;
|
145
|
+
}
|
146
|
+
if (params.Stderr) {
|
147
|
+
this._stderr = params.Stderr;
|
148
|
+
}
|
149
|
+
if (params.IdMode) {
|
150
|
+
this._idService = new IdService(params.IdMode);
|
151
|
+
}
|
152
|
+
if (params.RandomMode) {
|
153
|
+
this._randomService = new RandomService(params.RandomMode);
|
154
|
+
}
|
155
|
+
if (params.FileSystem) {
|
156
|
+
this._fileSystem = params.FileSystem;
|
157
|
+
}
|
158
|
+
if (params.SystemService) {
|
159
|
+
this._systemService = params.SystemService;
|
160
|
+
}
|
161
|
+
}
|
162
|
+
}
|
163
|
+
Time() {
|
164
|
+
return this._time;
|
165
|
+
}
|
166
|
+
NextId() {
|
167
|
+
return this._idService.NextId();
|
168
|
+
}
|
169
|
+
Random0ToValue(value) {
|
170
|
+
return this._randomService.Random0ToValue(value);
|
171
|
+
}
|
172
|
+
Stdout() {
|
173
|
+
return this._stdout;
|
174
|
+
}
|
175
|
+
Stderr() {
|
176
|
+
return this._stderr;
|
177
|
+
}
|
178
|
+
System() {
|
179
|
+
return this._systemService;
|
180
|
+
}
|
181
|
+
FileSystem() {
|
182
|
+
return this._fileSystem;
|
183
|
+
}
|
184
|
+
}
|
185
|
+
exports.WrapperSysAbstraction = WrapperSysAbstraction;
|
186
|
+
//# sourceMappingURL=base_sys_abstraction.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D,CAAC;YACD,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;gBACtB,IAAI,CAAC,cAAc,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YAC7D,CAAC;YACD,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;gBACtB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;YACvC,CAAC;YACD,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;gBACzB,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,aAAa,CAAC;YAC7C,CAAC;QACH,CAAC;IACH,CAAC;IACD,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IACD,MAAM;QACJ,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;IAClC,CAAC;IACD,cAAc,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC;IACD,MAAM;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IACD,MAAM;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IACD,UAAU;QACR,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CACF;AA9DD,sDA8DC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"base_sys_abstraction.test.d.ts","sourceRoot":"","sources":["../src/base_sys_abstraction.test.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,77 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const node_sys_abstraction_1 = require("./node_sys_abstraction");
|
4
|
+
const sys_abstraction_1 = require("./sys_abstraction");
|
5
|
+
const web_sys_abstraction_1 = require("./web_sys_abstraction");
|
6
|
+
for (const abstraction of [
|
7
|
+
{ name: "NodeSysAbstraction", fn: node_sys_abstraction_1.NodeSysAbstraction },
|
8
|
+
{ name: "WebSysAbstraction", fn: web_sys_abstraction_1.WebSysAbstraction },
|
9
|
+
]) {
|
10
|
+
describe(abstraction.name, () => {
|
11
|
+
it("IdService UUID", () => {
|
12
|
+
const sys = abstraction.fn();
|
13
|
+
const id1 = sys.NextId();
|
14
|
+
const id2 = sys.NextId();
|
15
|
+
expect(id1).not.toEqual(id2);
|
16
|
+
});
|
17
|
+
it("IdService explict UUID", () => {
|
18
|
+
const sys = abstraction.fn({ IdMode: sys_abstraction_1.IDMode.UUID });
|
19
|
+
const id1 = sys.NextId();
|
20
|
+
const id2 = sys.NextId();
|
21
|
+
expect(id1).not.toEqual(id2);
|
22
|
+
});
|
23
|
+
it("IdService const", () => {
|
24
|
+
const sys = abstraction.fn({ IdMode: sys_abstraction_1.IDMode.CONST });
|
25
|
+
const id1 = sys.NextId();
|
26
|
+
const id2 = sys.NextId();
|
27
|
+
expect(id1).toEqual(id2);
|
28
|
+
});
|
29
|
+
it("IdService set", () => {
|
30
|
+
for (let i = 0; i < 10; i++) {
|
31
|
+
const sys = abstraction.fn({ IdMode: sys_abstraction_1.IDMode.STEP });
|
32
|
+
const id1 = sys.NextId();
|
33
|
+
const id2 = sys.NextId();
|
34
|
+
expect(id1).toEqual("STEPId-0");
|
35
|
+
expect(id2).toEqual("STEPId-1");
|
36
|
+
}
|
37
|
+
});
|
38
|
+
it("time sleep", async () => {
|
39
|
+
const sys = abstraction.fn();
|
40
|
+
const start = sys.Time().Now();
|
41
|
+
await sys.Time().Sleep(100);
|
42
|
+
expect(sys.Time().TimeSince(start)).toBeGreaterThan(90);
|
43
|
+
});
|
44
|
+
it("time sleep const", async () => {
|
45
|
+
const sys = abstraction.fn({ TimeMode: sys_abstraction_1.TimeMode.REAL });
|
46
|
+
const start = new Date();
|
47
|
+
await sys.Time().Sleep(100);
|
48
|
+
const end = new Date();
|
49
|
+
expect(end.getTime() - start.getTime()).toBeGreaterThan(90);
|
50
|
+
});
|
51
|
+
it("time sleep step", async () => {
|
52
|
+
const sys = abstraction.fn({ TimeMode: sys_abstraction_1.TimeMode.STEP });
|
53
|
+
const start = sys.Time().Now();
|
54
|
+
await sys.Time().Sleep(86400500);
|
55
|
+
expect(sys.Time().Now().getTime() - start.getTime()).toEqual(86401500);
|
56
|
+
});
|
57
|
+
it("const random", () => {
|
58
|
+
const sys = abstraction.fn({ RandomMode: sys_abstraction_1.RandomMode.CONST });
|
59
|
+
expect(sys.Random0ToValue(10)).toEqual(5);
|
60
|
+
expect(sys.Random0ToValue(10)).toEqual(5);
|
61
|
+
});
|
62
|
+
it("step random", () => {
|
63
|
+
const sys = abstraction.fn({ RandomMode: sys_abstraction_1.RandomMode.STEP });
|
64
|
+
expect(sys.Random0ToValue(10000)).toEqual(1);
|
65
|
+
expect(sys.Random0ToValue(10000)).toEqual(2);
|
66
|
+
});
|
67
|
+
it("random", () => {
|
68
|
+
const sys = abstraction.fn({});
|
69
|
+
for (let i = 0; i < 100; i++) {
|
70
|
+
const val = sys.Random0ToValue(10);
|
71
|
+
expect(val).toBeGreaterThanOrEqual(0);
|
72
|
+
expect(val).toBeLessThanOrEqual(10);
|
73
|
+
}
|
74
|
+
});
|
75
|
+
});
|
76
|
+
}
|
77
|
+
//# sourceMappingURL=base_sys_abstraction.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"base_sys_abstraction.test.js","sourceRoot":"","sources":["../src/base_sys_abstraction.test.ts"],"names":[],"mappings":";;AAAA,iEAA4D;AAC5D,uDAAiE;AACjE,+DAA0D;AAE1D,KAAK,MAAM,WAAW,IAAI;IACxB,EAAE,IAAI,EAAE,oBAAoB,EAAE,EAAE,EAAE,yCAAkB,EAAE;IACtD,EAAE,IAAI,EAAE,mBAAmB,EAAE,EAAE,EAAE,uCAAiB,EAAE;CACrD,EAAE,CAAC;IACF,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE;QAC9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AE,CAAC,CAAC;YAC/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC7B,MAAM,GAAG,GAAG,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;gBACnC,MAAM,CAAC,GAAG,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;gBACtC,MAAM,CAAC,GAAG,CAAC,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;YACtC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/index.d.ts
CHANGED
@@ -4,8 +4,11 @@ export * from "./mock_file_service";
|
|
4
4
|
export * from "./logger_impl";
|
5
5
|
export * from "./logger";
|
6
6
|
export * from "./node_sys_abstraction";
|
7
|
+
export * from "./web_sys_abstraction";
|
7
8
|
export * from "./sys_abstraction";
|
8
9
|
export * from "./time";
|
9
10
|
export * from "./test/log_collector";
|
10
11
|
export * from "./test/mock_logger";
|
12
|
+
export * from "./result";
|
13
|
+
export * from "./option";
|
11
14
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
|
package/index.js
CHANGED
@@ -20,8 +20,11 @@ __exportStar(require("./mock_file_service"), exports);
|
|
20
20
|
__exportStar(require("./logger_impl"), exports);
|
21
21
|
__exportStar(require("./logger"), exports);
|
22
22
|
__exportStar(require("./node_sys_abstraction"), exports);
|
23
|
+
__exportStar(require("./web_sys_abstraction"), exports);
|
23
24
|
__exportStar(require("./sys_abstraction"), exports);
|
24
25
|
__exportStar(require("./time"), exports);
|
25
26
|
__exportStar(require("./test/log_collector"), exports);
|
26
27
|
__exportStar(require("./test/mock_logger"), exports);
|
28
|
+
__exportStar(require("./result"), exports);
|
29
|
+
__exportStar(require("./option"), exports);
|
27
30
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,sDAAoC;AACpC,sDAAoC;AACpC,gDAA8B;AAC9B,2CAAyB;AACzB,yDAAuC;AACvC,oDAAkC;AAClC,yCAAuB;AACvB,uDAAqC;AACrC,qDAAmC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,sDAAoC;AACpC,sDAAoC;AACpC,gDAA8B;AAC9B,2CAAyB;AACzB,yDAAuC;AACvC,wDAAsC;AACtC,oDAAkC;AAClC,yCAAuB;AACvB,uDAAqC;AACrC,qDAAmC;AACnC,2CAAyB;AACzB,2CAAyB"}
|
package/logger.test.js
CHANGED
@@ -5,6 +5,7 @@ const log_collector_1 = require("./test/log_collector");
|
|
5
5
|
const logger_1 = require("./logger");
|
6
6
|
const sys_abstraction_1 = require("./sys_abstraction");
|
7
7
|
const node_sys_abstraction_1 = require("./node_sys_abstraction");
|
8
|
+
const base_sys_abstraction_1 = require("./base_sys_abstraction");
|
8
9
|
describe("TestLogger", () => {
|
9
10
|
let logCollector;
|
10
11
|
let logger;
|
@@ -12,7 +13,7 @@ describe("TestLogger", () => {
|
|
12
13
|
logCollector = new log_collector_1.LogCollector();
|
13
14
|
logger = new logger_impl_1.LoggerImpl({
|
14
15
|
out: logCollector,
|
15
|
-
sys:
|
16
|
+
sys: (0, node_sys_abstraction_1.NodeSysAbstraction)({ TimeMode: sys_abstraction_1.TimeMode.STEP }),
|
16
17
|
});
|
17
18
|
});
|
18
19
|
describe("Error()", () => {
|
@@ -101,7 +102,7 @@ describe("TestLogger", () => {
|
|
101
102
|
timelog.Msg("2");
|
102
103
|
timelog.Timestamp().Msg("3");
|
103
104
|
await timelog.Flush();
|
104
|
-
const timer = (0,
|
105
|
+
const timer = (0, base_sys_abstraction_1.TimeFactory)(sys_abstraction_1.TimeMode.STEP);
|
105
106
|
expect(logCollector.Logs()).toEqual([
|
106
107
|
{
|
107
108
|
key: "withconstant2",
|
@@ -129,7 +130,7 @@ describe("TestLogger", () => {
|
|
129
130
|
timelog.Msg("2");
|
130
131
|
timelog.Timestamp().Msg("3");
|
131
132
|
await timelog.Flush();
|
132
|
-
const timer = (0,
|
133
|
+
const timer = (0, base_sys_abstraction_1.TimeFactory)(sys_abstraction_1.TimeMode.STEP);
|
133
134
|
expect(logCollector.Logs()).toEqual([
|
134
135
|
{ msg: "1" },
|
135
136
|
{ msg: "2" },
|
package/logger.test.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"logger.test.js","sourceRoot":"","sources":["../src/logger.test.ts"],"names":[],"mappings":";;AAAA,+CAA2C;AAC3C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EAAE,KAAK;gBACb,GAAG,EAAE,KAAK;aACX;YACD;gBACE,KAAK,EAAE,OAAO;gBACd,MAAM,EAAE,KAAK;gBACb,GAAG,EAAE,OAAO;gBACZ,KAAK,EAAE,MAAM;aACd;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/logger_impl.js
CHANGED
package/logger_impl.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"logger_impl.js","sourceRoot":"","sources":["../src/logger_impl.ts"],"names":[],"mappings":";;;AACA,qCAAqD;AACrD,iEAA4D;AAG5D,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAIlC,MAAa,SAAS;IAKpB,YAAY,GAA+B;QAHlC,aAAQ,GAA+B,EAAE,CAAC;QAC1C,YAAO,GAAgB,IAAI,GAAG,EAAE,CAAC;QAwB1C,oBAAe,GAAG,KAAK,CAAC;QACxB,kBAAa,GAAG,KAAK,EAAc,CAAC;QAtBlC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,OAAmB;QACvB,MAAM,EAAE,GAAG,KAAK,IAAI,EAAE;YAGpB,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;gBACrC,MAAM,MAAM,CAAC,KAAK,CAAC;gBACnB,MAAM,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBAC5B,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC;YAC7B,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;YACrC,CAAC;QAEH,CAAC,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACvB,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAID,MAAM,CAAC,UAAkD,SAA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,KAAa;QAC/B,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
@@ -1,51 +1,5 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import { NodeFileService } from "./node_file_service";
|
4
|
-
import { Time } from "./time";
|
5
|
-
declare class SysTime extends Time {
|
6
|
-
Now(): Date;
|
7
|
-
Sleep(duration: number): Promise<void>;
|
8
|
-
}
|
9
|
-
export declare class ConstTime extends Time {
|
10
|
-
Now(): Date;
|
11
|
-
Sleep(duration: number): Promise<void>;
|
12
|
-
}
|
13
|
-
export declare class StepTime extends Time {
|
14
|
-
_step: Date;
|
15
|
-
constructor();
|
16
|
-
Now(): Date;
|
17
|
-
Sleep(duration: number): Promise<void>;
|
18
|
-
}
|
19
|
-
export declare function TimeFactory(timeMode: TimeMode): Time;
|
20
|
-
export declare class RandomService {
|
21
|
-
readonly _mode: RandomMode;
|
22
|
-
_step: number;
|
23
|
-
constructor(mode: RandomMode);
|
24
|
-
Random0ToValue(value: number): number;
|
25
|
-
}
|
26
|
-
export interface SystemAbstractionImplParams {
|
27
|
-
readonly TimeMode?: TimeMode;
|
28
|
-
readonly IdMode?: IDMode;
|
29
|
-
readonly Stdout?: WritableStream<Uint8Array>;
|
30
|
-
readonly Stderr?: WritableStream<Uint8Array>;
|
31
|
-
readonly RandomMode?: RandomMode;
|
32
|
-
readonly FileSystem?: FileService;
|
33
|
-
readonly SystemService?: SystemService;
|
34
|
-
}
|
35
|
-
export declare class IdService {
|
36
|
-
readonly _mode: IDMode;
|
37
|
-
_step: number;
|
38
|
-
constructor(mode?: IDMode);
|
39
|
-
NextId(): string;
|
40
|
-
}
|
41
|
-
interface ExitHandler {
|
42
|
-
readonly hdl: VoidFunc;
|
43
|
-
readonly id: string;
|
44
|
-
}
|
45
|
-
export interface ExitService {
|
46
|
-
injectExitHandlers(hdls: ExitHandler[]): void;
|
47
|
-
exit(code: number): void;
|
48
|
-
}
|
1
|
+
import { SysAbstraction, SystemService, VoidFunc } from "./sys_abstraction";
|
2
|
+
import { ExitHandler, ExitService, WrapperSysAbstractionParams } from "./base_sys_abstraction";
|
49
3
|
export declare class ExitServiceImpl implements ExitService {
|
50
4
|
constructor();
|
51
5
|
_exitHandlers: ExitHandler[];
|
@@ -56,36 +10,12 @@ export declare class ExitServiceImpl implements ExitService {
|
|
56
10
|
}
|
57
11
|
export declare class NodeSystemService implements SystemService {
|
58
12
|
static readonly _exitHandlers: ExitHandler[];
|
59
|
-
readonly _exitService:
|
13
|
+
readonly _exitService: ExitService;
|
60
14
|
constructor();
|
61
15
|
Env(): Record<string, string>;
|
62
16
|
Args(): string[];
|
63
17
|
OnExit(hdl: VoidFunc): VoidFunc;
|
64
18
|
Exit(code: number): void;
|
65
19
|
}
|
66
|
-
export declare
|
67
|
-
static readonly _time: SysTime;
|
68
|
-
static readonly _stdout: WritableStream<any>;
|
69
|
-
static readonly _stderr: WritableStream<any>;
|
70
|
-
static readonly _idService: IdService;
|
71
|
-
static readonly _randomService: RandomService;
|
72
|
-
static readonly _fileSystem: NodeFileService;
|
73
|
-
static readonly _systemService: NodeSystemService;
|
74
|
-
readonly _time: Time;
|
75
|
-
readonly _stdout: WritableStream;
|
76
|
-
readonly _stderr: WritableStream;
|
77
|
-
readonly _idService: IdService;
|
78
|
-
readonly _randomService: RandomService;
|
79
|
-
readonly _fileSystem: FileService;
|
80
|
-
readonly _systemService: SystemService;
|
81
|
-
constructor(params?: SystemAbstractionImplParams);
|
82
|
-
Time(): Time;
|
83
|
-
NextId(): string;
|
84
|
-
Random0ToValue(value: number): number;
|
85
|
-
Stdout(): WritableStream;
|
86
|
-
Stderr(): WritableStream;
|
87
|
-
System(): SystemService;
|
88
|
-
FileSystem(): FileService;
|
89
|
-
}
|
90
|
-
export {};
|
20
|
+
export declare function NodeSysAbstraction(param?: WrapperSysAbstractionParams): SysAbstraction;
|
91
21
|
//# sourceMappingURL=node_sys_abstraction.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"node_sys_abstraction.d.ts","sourceRoot":"","sources":["../src/node_sys_abstraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"node_sys_abstraction.d.ts","sourceRoot":"","sources":["../src/node_sys_abstraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAEL,WAAW,EACX,WAAW,EAEX,2BAA2B,EAC5B,MAAM,wBAAwB,CAAC;AAGhC,qBAAa,eAAgB,YAAW,WAAW;;IA0BjD,aAAa,EAAE,WAAW,EAAE,CAAM;IAClC,kBAAkB,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,IAAI;IAI7C,OAAO,UAAS;IAChB,QAAQ,CAAC,WAAW,QAAa,QAAQ,IAAI,CAAC,CAkB5C;IAEF,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAWzB;AAED,qBAAa,iBAAkB,YAAW,aAAa;IACrD,MAAM,CAAC,QAAQ,CAAC,aAAa,EAAE,WAAW,EAAE,CAAM;IAClD,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAyB;;IAK3D,GAAG;IAIH,IAAI;IAIJ,MAAM,CAAC,GAAG,EAAE,QAAQ,GAAG,QAAQ;IAW/B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAGzB;AAGD,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,2BAA2B,GAAG,cAAc,CAQtF"}
|
package/node_sys_abstraction.js
CHANGED
@@ -1,104 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.NodeSysAbstraction = exports.NodeSystemService = exports.ExitServiceImpl =
|
4
|
-
const
|
3
|
+
exports.NodeSysAbstraction = exports.NodeSystemService = exports.ExitServiceImpl = void 0;
|
4
|
+
const base_sys_abstraction_1 = require("./base_sys_abstraction");
|
5
5
|
const node_file_service_1 = require("./node_file_service");
|
6
|
-
const time_1 = require("./time");
|
7
|
-
class SysTime extends time_1.Time {
|
8
|
-
Now() {
|
9
|
-
return new Date();
|
10
|
-
}
|
11
|
-
Sleep(duration) {
|
12
|
-
return new Promise((resolve) => {
|
13
|
-
setTimeout(() => {
|
14
|
-
resolve();
|
15
|
-
}, duration);
|
16
|
-
});
|
17
|
-
}
|
18
|
-
}
|
19
|
-
class ConstTime extends time_1.Time {
|
20
|
-
Now() {
|
21
|
-
return new Date(2021, 1, 1, 0, 0, 0, 0);
|
22
|
-
}
|
23
|
-
Sleep(duration) {
|
24
|
-
return Promise.resolve();
|
25
|
-
}
|
26
|
-
}
|
27
|
-
exports.ConstTime = ConstTime;
|
28
|
-
class StepTime extends time_1.Time {
|
29
|
-
constructor() {
|
30
|
-
super();
|
31
|
-
this._step = new ConstTime().Now();
|
32
|
-
}
|
33
|
-
Now() {
|
34
|
-
if (this._step.getTime() === 0) {
|
35
|
-
this._step = new ConstTime().Now();
|
36
|
-
return this._step;
|
37
|
-
}
|
38
|
-
this._step = new Date(this._step.getTime() + 1000);
|
39
|
-
return this._step;
|
40
|
-
}
|
41
|
-
Sleep(duration) {
|
42
|
-
this._step = new Date(this._step.getTime() + duration);
|
43
|
-
return Promise.resolve();
|
44
|
-
}
|
45
|
-
}
|
46
|
-
exports.StepTime = StepTime;
|
47
|
-
function TimeFactory(timeMode) {
|
48
|
-
switch (timeMode) {
|
49
|
-
case sys_abstraction_1.TimeMode.REAL:
|
50
|
-
return new SysTime();
|
51
|
-
case sys_abstraction_1.TimeMode.CONST:
|
52
|
-
return new ConstTime();
|
53
|
-
case sys_abstraction_1.TimeMode.STEP:
|
54
|
-
return new StepTime();
|
55
|
-
}
|
56
|
-
return new SysTime();
|
57
|
-
}
|
58
|
-
exports.TimeFactory = TimeFactory;
|
59
|
-
const decoder = new TextDecoder();
|
60
|
-
class RandomService {
|
61
|
-
constructor(mode) {
|
62
|
-
this._step = 0;
|
63
|
-
this._mode = mode;
|
64
|
-
}
|
65
|
-
Random0ToValue(value) {
|
66
|
-
switch (this._mode) {
|
67
|
-
case sys_abstraction_1.RandomMode.CONST:
|
68
|
-
return 0.5 * value;
|
69
|
-
case sys_abstraction_1.RandomMode.STEP:
|
70
|
-
this._step += 0.0001;
|
71
|
-
return this._step * value;
|
72
|
-
case sys_abstraction_1.RandomMode.RANDOM:
|
73
|
-
return Math.random() * value;
|
74
|
-
default:
|
75
|
-
throw new Error("Unknown RandomMode");
|
76
|
-
}
|
77
|
-
}
|
78
|
-
}
|
79
|
-
exports.RandomService = RandomService;
|
80
|
-
class IdService {
|
81
|
-
constructor(mode) {
|
82
|
-
this._step = 0;
|
83
|
-
if (!mode) {
|
84
|
-
mode = sys_abstraction_1.IDMode.UUID;
|
85
|
-
}
|
86
|
-
this._mode = mode;
|
87
|
-
}
|
88
|
-
NextId() {
|
89
|
-
switch (this._mode) {
|
90
|
-
case sys_abstraction_1.IDMode.UUID:
|
91
|
-
return crypto.randomUUID();
|
92
|
-
case sys_abstraction_1.IDMode.CONST:
|
93
|
-
return "VeryUniqueID";
|
94
|
-
case sys_abstraction_1.IDMode.STEP:
|
95
|
-
return `STEPId-${this._step++}`;
|
96
|
-
default:
|
97
|
-
throw new Error("Unknown IDMode");
|
98
|
-
}
|
99
|
-
}
|
100
|
-
}
|
101
|
-
exports.IdService = IdService;
|
102
6
|
class ExitServiceImpl {
|
103
7
|
constructor() {
|
104
8
|
this._exitHandlers = [];
|
@@ -183,83 +87,15 @@ class NodeSystemService {
|
|
183
87
|
}
|
184
88
|
exports.NodeSystemService = NodeSystemService;
|
185
89
|
NodeSystemService._exitHandlers = [];
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
this._fileSystem = NodeSysAbstraction._fileSystem;
|
194
|
-
this._systemService = NodeSysAbstraction._systemService;
|
195
|
-
if (params) {
|
196
|
-
if (params.TimeMode) {
|
197
|
-
this._time = TimeFactory(params.TimeMode);
|
198
|
-
}
|
199
|
-
if (params.Stdout) {
|
200
|
-
this._stdout = params.Stdout;
|
201
|
-
}
|
202
|
-
if (params.Stderr) {
|
203
|
-
this._stderr = params.Stderr;
|
204
|
-
}
|
205
|
-
if (params.IdMode) {
|
206
|
-
this._idService = new IdService(params.IdMode);
|
207
|
-
}
|
208
|
-
if (params.RandomMode) {
|
209
|
-
this._randomService = new RandomService(params.RandomMode);
|
210
|
-
}
|
211
|
-
if (params.FileSystem) {
|
212
|
-
this._fileSystem = params.FileSystem;
|
213
|
-
}
|
214
|
-
if (params.SystemService) {
|
215
|
-
this._systemService = params.SystemService;
|
216
|
-
}
|
217
|
-
}
|
218
|
-
}
|
219
|
-
Time() {
|
220
|
-
return this._time;
|
221
|
-
}
|
222
|
-
NextId() {
|
223
|
-
return this._idService.NextId();
|
224
|
-
}
|
225
|
-
Random0ToValue(value) {
|
226
|
-
return this._randomService.Random0ToValue(value);
|
227
|
-
}
|
228
|
-
Stdout() {
|
229
|
-
return this._stdout;
|
230
|
-
}
|
231
|
-
Stderr() {
|
232
|
-
return this._stderr;
|
233
|
-
}
|
234
|
-
System() {
|
235
|
-
return this._systemService;
|
236
|
-
}
|
237
|
-
FileSystem() {
|
238
|
-
return this._fileSystem;
|
90
|
+
let my = undefined;
|
91
|
+
function NodeSysAbstraction(param) {
|
92
|
+
if (!my) {
|
93
|
+
my = new base_sys_abstraction_1.BaseSysAbstraction({
|
94
|
+
FileSystem: new node_file_service_1.NodeFileService(),
|
95
|
+
SystemService: new NodeSystemService(),
|
96
|
+
});
|
239
97
|
}
|
98
|
+
return new base_sys_abstraction_1.WrapperSysAbstraction(my, param);
|
240
99
|
}
|
241
100
|
exports.NodeSysAbstraction = NodeSysAbstraction;
|
242
|
-
NodeSysAbstraction._time = new SysTime();
|
243
|
-
NodeSysAbstraction._stdout = new WritableStream({
|
244
|
-
write(chunk) {
|
245
|
-
return new Promise((resolve) => {
|
246
|
-
const decoded = decoder.decode(chunk);
|
247
|
-
console.log(decoded.trimEnd());
|
248
|
-
resolve();
|
249
|
-
});
|
250
|
-
},
|
251
|
-
});
|
252
|
-
NodeSysAbstraction._stderr = new WritableStream({
|
253
|
-
write(chunk) {
|
254
|
-
return new Promise((resolve) => {
|
255
|
-
const decoded = decoder.decode(chunk);
|
256
|
-
console.error(decoded.trimEnd());
|
257
|
-
resolve();
|
258
|
-
});
|
259
|
-
},
|
260
|
-
});
|
261
|
-
NodeSysAbstraction._idService = new IdService();
|
262
|
-
NodeSysAbstraction._randomService = new RandomService(sys_abstraction_1.RandomMode.RANDOM);
|
263
|
-
NodeSysAbstraction._fileSystem = new node_file_service_1.NodeFileService();
|
264
|
-
NodeSysAbstraction._systemService = new NodeSystemService();
|
265
101
|
//# sourceMappingURL=node_sys_abstraction.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"node_sys_abstraction.js","sourceRoot":"","sources":["../src/node_sys_abstraction.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"node_sys_abstraction.js","sourceRoot":"","sources":["../src/node_sys_abstraction.ts"],"names":[],"mappings":";;;AACA,iEAMgC;AAChC,2DAAsD;AAEtD,MAAa,eAAe;IAC1B;QAyBA,kBAAa,GAAkB,EAAE,CAAC;QAKlC,YAAO,GAAG,KAAK,CAAC;QACP,gBAAW,GAAG,KAAK,IAAmB,EAAE;YAC/C,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBAEjB,OAAO;YACT,CAAC;YACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;gBACnC,IAAI,CAAC;oBAEH,MAAM,GAAG,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;oBAEpB,IAAI,OAAQ,GAAqB,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;wBACtD,MAAM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,EAAE,EAAE,CAAC;QACR,EAAE,GAAG,IAAI,yCAAkB,CAAC;YAC1B,UAAU,EAAE,IAAI,mCAAe,EAAE;YACjC,aAAa,EAAE,IAAI,iBAAiB,EAAE;SACvC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,IAAI,4CAAqB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AAC9C,CAAC;AARD,gDAQC"}
|
@@ -1,72 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const sys_abstraction_1 = require("./sys_abstraction");
|
4
|
-
const node_sys_abstraction_1 = require("./node_sys_abstraction");
|
5
3
|
const node_child_process_1 = require("node:child_process");
|
6
|
-
it("IdService UUID", () => {
|
7
|
-
const sys = new node_sys_abstraction_1.NodeSysAbstraction();
|
8
|
-
const id1 = sys.NextId();
|
9
|
-
const id2 = sys.NextId();
|
10
|
-
expect(id1).not.toEqual(id2);
|
11
|
-
});
|
12
|
-
it("IdService explict UUID", () => {
|
13
|
-
const sys = new node_sys_abstraction_1.NodeSysAbstraction({ IdMode: sys_abstraction_1.IDMode.UUID });
|
14
|
-
const id1 = sys.NextId();
|
15
|
-
const id2 = sys.NextId();
|
16
|
-
expect(id1).not.toEqual(id2);
|
17
|
-
});
|
18
|
-
it("IdService const", () => {
|
19
|
-
const sys = new node_sys_abstraction_1.NodeSysAbstraction({ IdMode: sys_abstraction_1.IDMode.CONST });
|
20
|
-
const id1 = sys.NextId();
|
21
|
-
const id2 = sys.NextId();
|
22
|
-
expect(id1).toEqual(id2);
|
23
|
-
});
|
24
|
-
it("IdService set", () => {
|
25
|
-
for (let i = 0; i < 10; i++) {
|
26
|
-
const sys = new node_sys_abstraction_1.NodeSysAbstraction({ IdMode: sys_abstraction_1.IDMode.STEP });
|
27
|
-
const id1 = sys.NextId();
|
28
|
-
const id2 = sys.NextId();
|
29
|
-
expect(id1).toEqual("STEPId-0");
|
30
|
-
expect(id2).toEqual("STEPId-1");
|
31
|
-
}
|
32
|
-
});
|
33
|
-
it("time sleep", async () => {
|
34
|
-
const sys = new node_sys_abstraction_1.NodeSysAbstraction();
|
35
|
-
const start = sys.Time().Now();
|
36
|
-
await sys.Time().Sleep(100);
|
37
|
-
expect(sys.Time().TimeSince(start)).toBeGreaterThan(90);
|
38
|
-
});
|
39
|
-
it("time sleep const", async () => {
|
40
|
-
const sys = new node_sys_abstraction_1.NodeSysAbstraction({ TimeMode: sys_abstraction_1.TimeMode.REAL });
|
41
|
-
const start = new Date();
|
42
|
-
await sys.Time().Sleep(100);
|
43
|
-
const end = new Date();
|
44
|
-
expect(end.getTime() - start.getTime()).toBeGreaterThan(90);
|
45
|
-
});
|
46
|
-
it("time sleep step", async () => {
|
47
|
-
const sys = new node_sys_abstraction_1.NodeSysAbstraction({ TimeMode: sys_abstraction_1.TimeMode.STEP });
|
48
|
-
const start = sys.Time().Now();
|
49
|
-
await sys.Time().Sleep(86400500);
|
50
|
-
expect(sys.Time().Now().getTime() - start.getTime()).toEqual(86401500);
|
51
|
-
});
|
52
|
-
it("const random", () => {
|
53
|
-
const sys = new node_sys_abstraction_1.NodeSysAbstraction({ RandomMode: sys_abstraction_1.RandomMode.CONST });
|
54
|
-
expect(sys.Random0ToValue(10)).toEqual(5);
|
55
|
-
expect(sys.Random0ToValue(10)).toEqual(5);
|
56
|
-
});
|
57
|
-
it("step random", () => {
|
58
|
-
const sys = new node_sys_abstraction_1.NodeSysAbstraction({ RandomMode: sys_abstraction_1.RandomMode.STEP });
|
59
|
-
expect(sys.Random0ToValue(10000)).toEqual(1);
|
60
|
-
expect(sys.Random0ToValue(10000)).toEqual(2);
|
61
|
-
});
|
62
|
-
it("random", () => {
|
63
|
-
const sys = new node_sys_abstraction_1.NodeSysAbstraction({});
|
64
|
-
for (let i = 0; i < 100; i++) {
|
65
|
-
const val = sys.Random0ToValue(10);
|
66
|
-
expect(val).toBeGreaterThanOrEqual(0);
|
67
|
-
expect(val).toBeLessThanOrEqual(10);
|
68
|
-
}
|
69
|
-
});
|
70
4
|
function exitHandler(errCode, larg, done) {
|
71
5
|
return (err, stdout, stderr) => {
|
72
6
|
if (err) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"node_sys_abstraction.test.js","sourceRoot":"","sources":["../src/node_sys_abstraction.test.ts"],"names":[],"mappings":";;AAAA,
|
1
|
+
{"version":3,"file":"node_sys_abstraction.test.js","sourceRoot":"","sources":["../src/node_sys_abstraction.test.ts"],"names":[],"mappings":";;AAAA,2DAAyD;AAEzD,SAAS,WAAW,CAAC,OAAe,EAAE,IAAY,EAAE,IAAgB;IAClE,OAAO,CAAC,GAAyB,EAAE,MAAuB,EAAE,MAAuB,EAAE,EAAE;QACrF,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,IAAI,EAAE,IAAI;iBACX;gBACD;oBACE,IAAI,EAAE,IAAI;oBACV,GAAG,EAAE,iBAAiB;iBACvB;gBACD;oBACE,IAAI,EAAE,IAAI;oBACV,GAAG,EAAE,iBAAiB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M,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/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@adviser/cement",
|
3
|
-
"version": "0.0
|
3
|
+
"version": "0.1.0",
|
4
4
|
"description": "better try/catch/finally handling",
|
5
5
|
"main": "index.js",
|
6
6
|
"keywords": [],
|
@@ -12,7 +12,7 @@
|
|
12
12
|
"homepage": "https://github.com/mabels/cement#readme",
|
13
13
|
"devDependencies": {
|
14
14
|
"@types/jest": "^29.5.12",
|
15
|
-
"@types/node": "^20.11.
|
15
|
+
"@types/node": "^20.11.17",
|
16
16
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
17
17
|
"@typescript-eslint/parser": "^6.21.0",
|
18
18
|
"eslint": "^8.56.0",
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
24
24
|
};
|
25
25
|
(async () => {
|
26
26
|
const sa = await Promise.resolve().then(() => __importStar(require("../node_sys_abstraction")));
|
27
|
-
const my =
|
27
|
+
const my = sa.NodeSysAbstraction();
|
28
28
|
const larg = process.argv[process.argv.length - 1];
|
29
29
|
console.log(JSON.stringify({
|
30
30
|
larg,
|
@@ -1 +1 @@
|
|
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,yBAAyB,GAAC,CAAC;IAEnD,MAAM,EAAE,GAAG,
|
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,yBAAyB,GAAC,CAAC;IAEnD,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,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;QACR,KAAK,QAAQ,CAAC;QACd;YACE,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACzB,CAAC;AACH,CAAC,CAAC,EAAE,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"web_sys_abstraction.d.ts","sourceRoot":"","sources":["../src/web_sys_abstraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6C,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAEhH,OAAO,EAAE,cAAc,EAA2B,MAAM,mBAAmB,CAAC;AAkE5E,wBAAgB,iBAAiB,CAAC,KAAK,CAAC,EAAE,2BAA2B,GAAG,cAAc,CAQrF"}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.WebSysAbstraction = void 0;
|
4
|
+
const base_sys_abstraction_1 = require("./base_sys_abstraction");
|
5
|
+
class WebFileService {
|
6
|
+
get baseDir() {
|
7
|
+
throw new Error("basedir-Method not implemented.");
|
8
|
+
}
|
9
|
+
create(fname) {
|
10
|
+
throw new Error("create-Method not implemented.");
|
11
|
+
}
|
12
|
+
readFileString(fname) {
|
13
|
+
throw new Error("readFileString-Method not implemented.");
|
14
|
+
}
|
15
|
+
writeFileString(fname, content) {
|
16
|
+
throw new Error("writeFileString-Method not implemented.");
|
17
|
+
}
|
18
|
+
abs(fname) {
|
19
|
+
throw new Error("abs-Method not implemented.");
|
20
|
+
}
|
21
|
+
join(...paths) {
|
22
|
+
throw new Error("join-Method not implemented.");
|
23
|
+
}
|
24
|
+
relative(from, to) {
|
25
|
+
throw new Error("relative-Method not implemented.");
|
26
|
+
}
|
27
|
+
dirname(fname) {
|
28
|
+
throw new Error("dirname-Method not implemented.");
|
29
|
+
}
|
30
|
+
basename(fname) {
|
31
|
+
throw new Error("basename-Method not implemented.");
|
32
|
+
}
|
33
|
+
nodeImport(fname) {
|
34
|
+
throw new Error("nodeImport-Method not implemented.");
|
35
|
+
}
|
36
|
+
isAbsolute(fname) {
|
37
|
+
throw new Error("isAbsolute-Method not implemented.");
|
38
|
+
}
|
39
|
+
}
|
40
|
+
class WebSystemService {
|
41
|
+
Env() {
|
42
|
+
throw new Error("Env-Method not implemented.");
|
43
|
+
}
|
44
|
+
Args() {
|
45
|
+
throw new Error("Args-Method not implemented.");
|
46
|
+
}
|
47
|
+
OnExit(hdl) {
|
48
|
+
throw new Error("OnExit-Method not implemented.");
|
49
|
+
}
|
50
|
+
Exit(code) {
|
51
|
+
throw new Error("Exit-Method not implemented.");
|
52
|
+
}
|
53
|
+
}
|
54
|
+
let my = undefined;
|
55
|
+
function WebSysAbstraction(param) {
|
56
|
+
if (!my) {
|
57
|
+
my = new base_sys_abstraction_1.BaseSysAbstraction({
|
58
|
+
FileSystem: new WebFileService(),
|
59
|
+
SystemService: new WebSystemService(),
|
60
|
+
});
|
61
|
+
}
|
62
|
+
return new base_sys_abstraction_1.WrapperSysAbstraction(my, param);
|
63
|
+
}
|
64
|
+
exports.WebSysAbstraction = WebSysAbstraction;
|
65
|
+
//# sourceMappingURL=web_sys_abstraction.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"web_sys_abstraction.js","sourceRoot":"","sources":["../src/web_sys_abstraction.ts"],"names":[],"mappings":";;;AAAA,iEAAgH;AAIhH,MAAM,cAAc;IAClB,IAAI,OAAO;QACT,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACrD,CAAC;IAED,MAAM,CAAC,KAAa;QAClB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;IAED,cAAc,CAAC,KAAa;QAC1B,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;IAED,eAAe,CAAC,KAAa,EAAE,OAAe;QAC5C,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC7D,CAAC;IAED,GAAG,CAAC,KAA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