@adviser/cement 0.2.17 → 0.2.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. package/{sys_abstraction-CmSCeK7b.d.cts → base-sys-abstraction-BzVP_lX0.d.cts} +77 -1
  2. package/{sys_abstraction-CmSCeK7b.d.ts → base-sys-abstraction-BzVP_lX0.d.ts} +77 -1
  3. package/chunk-AO7BGISE.js +353 -0
  4. package/chunk-AO7BGISE.js.map +1 -0
  5. package/{chunk-J2IM7FHM.js → chunk-I4NUGWZ6.js} +6 -1
  6. package/{chunk-XJF7FQUN.js → chunk-LJRKN3XI.js} +3 -3
  7. package/{chunk-XJF7FQUN.js.map → chunk-LJRKN3XI.js.map} +1 -1
  8. package/{chunk-O4F5AURC.js → chunk-P4FB5FHU.js} +185 -179
  9. package/chunk-P4FB5FHU.js.map +1 -0
  10. package/index-_GuS2IT4.d.cts +93 -0
  11. package/index-_GuS2IT4.d.ts +93 -0
  12. package/index.cjs +362 -102
  13. package/index.cjs.map +1 -1
  14. package/index.d.cts +8 -18
  15. package/index.d.ts +8 -18
  16. package/index.js +33 -98
  17. package/index.js.map +1 -1
  18. package/node/index.cjs +5 -5
  19. package/node/index.cjs.map +1 -1
  20. package/node/index.d.cts +1 -2
  21. package/node/index.d.ts +1 -2
  22. package/node/index.js +5 -5
  23. package/node/index.js.map +1 -1
  24. package/package.json +1 -1
  25. package/utils/index.cjs +98 -2
  26. package/utils/index.cjs.map +1 -1
  27. package/utils/index.d.cts +2 -36
  28. package/utils/index.d.ts +2 -36
  29. package/utils/index.js +21 -221
  30. package/utils/index.js.map +1 -1
  31. package/web/index.cjs +3 -3
  32. package/web/index.cjs.map +1 -1
  33. package/web/index.d.cts +1 -2
  34. package/web/index.d.ts +1 -2
  35. package/web/index.js +3 -3
  36. package/base_sys_abstraction-CJqRmTui.d.ts +0 -21
  37. package/base_sys_abstraction-nsNTl07w.d.cts +0 -21
  38. package/chunk-O4F5AURC.js.map +0 -1
  39. /package/{chunk-J2IM7FHM.js.map → chunk-I4NUGWZ6.js.map} +0 -0
@@ -109,4 +109,80 @@ interface SysAbstraction {
109
109
  FileSystem(): FileService;
110
110
  }
111
111
 
112
- export { BrowserEnvActions as B, type Duration as D, type EnvMap as E, type FileService as F, IDMode as I, type NamedWritableStream as N, type OnSetItem as O, RandomMode as R, type SysAbstraction as S, TimeMode as T, type VoidFunc as V, String2TimeMode as a, type SystemService as b, type EnvActions as c, type EnvFactoryOpts as d, type Env as e, envFactory as f, EnvImpl as g, Time as h, TimeUnits as i };
112
+ declare class SysTime extends Time {
113
+ Now(): Date;
114
+ Sleep(duration: number): Promise<void>;
115
+ }
116
+ declare class ConstTime extends Time {
117
+ Now(): Date;
118
+ Sleep(duration: number): Promise<void>;
119
+ }
120
+ declare class StepTime extends Time {
121
+ _step: Date;
122
+ constructor();
123
+ Now(): Date;
124
+ Sleep(duration: number): Promise<void>;
125
+ }
126
+ declare function TimeFactory(timeMode: TimeMode): Time;
127
+ declare class RandomService {
128
+ readonly _mode: RandomMode;
129
+ _step: number;
130
+ constructor(mode: RandomMode);
131
+ Random0ToValue(value: number): number;
132
+ }
133
+ declare class IdService {
134
+ readonly _mode: IDMode;
135
+ _step: number;
136
+ constructor(mode?: IDMode);
137
+ NextId(): string;
138
+ }
139
+ interface BaseSysAbstractionParams {
140
+ readonly FileSystem: FileService;
141
+ readonly SystemService: SystemService;
142
+ }
143
+ interface ExitHandler {
144
+ readonly hdl: VoidFunc;
145
+ readonly id: string;
146
+ }
147
+ interface ExitService {
148
+ injectExitHandlers(hdls: ExitHandler[]): void;
149
+ exit(code: number): void;
150
+ }
151
+ declare class BaseSysAbstraction {
152
+ readonly _time: SysTime;
153
+ readonly _stdout: WritableStream<any>;
154
+ readonly _stderr: WritableStream<any>;
155
+ readonly _idService: IdService;
156
+ readonly _randomService: RandomService;
157
+ readonly _fileSystem: FileService;
158
+ readonly _systemService: SystemService;
159
+ constructor(params: BaseSysAbstractionParams);
160
+ }
161
+ interface WrapperSysAbstractionParams {
162
+ readonly TimeMode?: TimeMode;
163
+ readonly IdMode?: IDMode;
164
+ readonly Stdout?: WritableStream<Uint8Array>;
165
+ readonly Stderr?: WritableStream<Uint8Array>;
166
+ readonly RandomMode?: RandomMode;
167
+ readonly FileSystem?: FileService;
168
+ readonly SystemService?: SystemService;
169
+ }
170
+ declare class WrapperSysAbstraction implements SysAbstraction {
171
+ readonly _time: Time;
172
+ readonly _stdout: WritableStream<Uint8Array>;
173
+ readonly _stderr: WritableStream<Uint8Array>;
174
+ readonly _idService: IdService;
175
+ readonly _randomService: RandomService;
176
+ readonly _fileSystem: FileService;
177
+ readonly _systemService: SystemService;
178
+ constructor(base: BaseSysAbstraction, params?: WrapperSysAbstractionParams);
179
+ Time(): Time;
180
+ NextId(): string;
181
+ Random0ToValue(value: number): number;
182
+ Stdout(): WritableStream;
183
+ Stderr(): WritableStream;
184
+ System(): SystemService;
185
+ FileSystem(): FileService;
186
+ }
187
+
188
+ export { BrowserEnvActions as B, ConstTime as C, type Duration as D, type EnvMap as E, type FileService as F, IDMode as I, type NamedWritableStream as N, type OnSetItem as O, RandomMode as R, type SysAbstraction as S, TimeMode as T, type VoidFunc as V, type WrapperSysAbstractionParams as W, String2TimeMode as a, type SystemService as b, type EnvActions as c, type EnvFactoryOpts as d, type Env as e, envFactory as f, EnvImpl as g, Time as h, TimeUnits as i, SysTime as j, StepTime as k, TimeFactory as l, RandomService as m, IdService as n, type BaseSysAbstractionParams as o, type ExitHandler as p, type ExitService as q, BaseSysAbstraction as r, WrapperSysAbstraction as s };
@@ -109,4 +109,80 @@ interface SysAbstraction {
109
109
  FileSystem(): FileService;
110
110
  }
111
111
 
112
- export { BrowserEnvActions as B, type Duration as D, type EnvMap as E, type FileService as F, IDMode as I, type NamedWritableStream as N, type OnSetItem as O, RandomMode as R, type SysAbstraction as S, TimeMode as T, type VoidFunc as V, String2TimeMode as a, type SystemService as b, type EnvActions as c, type EnvFactoryOpts as d, type Env as e, envFactory as f, EnvImpl as g, Time as h, TimeUnits as i };
112
+ declare class SysTime extends Time {
113
+ Now(): Date;
114
+ Sleep(duration: number): Promise<void>;
115
+ }
116
+ declare class ConstTime extends Time {
117
+ Now(): Date;
118
+ Sleep(duration: number): Promise<void>;
119
+ }
120
+ declare class StepTime extends Time {
121
+ _step: Date;
122
+ constructor();
123
+ Now(): Date;
124
+ Sleep(duration: number): Promise<void>;
125
+ }
126
+ declare function TimeFactory(timeMode: TimeMode): Time;
127
+ declare class RandomService {
128
+ readonly _mode: RandomMode;
129
+ _step: number;
130
+ constructor(mode: RandomMode);
131
+ Random0ToValue(value: number): number;
132
+ }
133
+ declare class IdService {
134
+ readonly _mode: IDMode;
135
+ _step: number;
136
+ constructor(mode?: IDMode);
137
+ NextId(): string;
138
+ }
139
+ interface BaseSysAbstractionParams {
140
+ readonly FileSystem: FileService;
141
+ readonly SystemService: SystemService;
142
+ }
143
+ interface ExitHandler {
144
+ readonly hdl: VoidFunc;
145
+ readonly id: string;
146
+ }
147
+ interface ExitService {
148
+ injectExitHandlers(hdls: ExitHandler[]): void;
149
+ exit(code: number): void;
150
+ }
151
+ declare class BaseSysAbstraction {
152
+ readonly _time: SysTime;
153
+ readonly _stdout: WritableStream<any>;
154
+ readonly _stderr: WritableStream<any>;
155
+ readonly _idService: IdService;
156
+ readonly _randomService: RandomService;
157
+ readonly _fileSystem: FileService;
158
+ readonly _systemService: SystemService;
159
+ constructor(params: BaseSysAbstractionParams);
160
+ }
161
+ interface WrapperSysAbstractionParams {
162
+ readonly TimeMode?: TimeMode;
163
+ readonly IdMode?: IDMode;
164
+ readonly Stdout?: WritableStream<Uint8Array>;
165
+ readonly Stderr?: WritableStream<Uint8Array>;
166
+ readonly RandomMode?: RandomMode;
167
+ readonly FileSystem?: FileService;
168
+ readonly SystemService?: SystemService;
169
+ }
170
+ declare class WrapperSysAbstraction implements SysAbstraction {
171
+ readonly _time: Time;
172
+ readonly _stdout: WritableStream<Uint8Array>;
173
+ readonly _stderr: WritableStream<Uint8Array>;
174
+ readonly _idService: IdService;
175
+ readonly _randomService: RandomService;
176
+ readonly _fileSystem: FileService;
177
+ readonly _systemService: SystemService;
178
+ constructor(base: BaseSysAbstraction, params?: WrapperSysAbstractionParams);
179
+ Time(): Time;
180
+ NextId(): string;
181
+ Random0ToValue(value: number): number;
182
+ Stdout(): WritableStream;
183
+ Stderr(): WritableStream;
184
+ System(): SystemService;
185
+ FileSystem(): FileService;
186
+ }
187
+
188
+ export { BrowserEnvActions as B, ConstTime as C, type Duration as D, type EnvMap as E, type FileService as F, IDMode as I, type NamedWritableStream as N, type OnSetItem as O, RandomMode as R, type SysAbstraction as S, TimeMode as T, type VoidFunc as V, type WrapperSysAbstractionParams as W, String2TimeMode as a, type SystemService as b, type EnvActions as c, type EnvFactoryOpts as d, type Env as e, envFactory as f, EnvImpl as g, Time as h, TimeUnits as i, SysTime as j, StepTime as k, TimeFactory as l, RandomService as m, IdService as n, type BaseSysAbstractionParams as o, type ExitHandler as p, type ExitService as q, BaseSysAbstraction as r, WrapperSysAbstraction as s };
@@ -0,0 +1,353 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-I4NUGWZ6.js";
4
+
5
+ // src/utils/index.ts
6
+ var utils_exports = {};
7
+ __export(utils_exports, {
8
+ ConsoleWriterStream: () => ConsoleWriterStream,
9
+ ConsoleWriterStreamDefaultWriter: () => ConsoleWriterStreamDefaultWriter,
10
+ FanoutWriteStream: () => FanoutWriteStream,
11
+ array2stream: () => array2stream,
12
+ devnull: () => devnull,
13
+ rebuffer: () => rebuffer,
14
+ rebufferArray: () => rebufferArray,
15
+ receiveFromStream: () => receiveFromStream,
16
+ sendToStream: () => sendToStream,
17
+ stream2array: () => stream2array,
18
+ stream2string: () => stream2string,
19
+ stream2uint8array: () => stream2uint8array,
20
+ streamMap: () => streamMap,
21
+ string2stream: () => string2stream,
22
+ uint8array2stream: () => uint8array2stream
23
+ });
24
+
25
+ // src/utils/stream-map.ts
26
+ function streamMap(s, sm) {
27
+ const state = { reader: s.getReader(), streamMap: sm, idx: 0 };
28
+ return new ReadableStream({
29
+ async pull(controller) {
30
+ const { done, value } = await state.reader.read();
31
+ if (done) {
32
+ if (state.streamMap.Close) {
33
+ state.streamMap.Close();
34
+ }
35
+ controller.close();
36
+ return;
37
+ }
38
+ const promiseOrU = state.streamMap.Map(value, state.idx++);
39
+ let mapped;
40
+ if (promiseOrU instanceof Promise || typeof promiseOrU.then === "function") {
41
+ mapped = await promiseOrU;
42
+ } else {
43
+ mapped = promiseOrU;
44
+ }
45
+ controller.enqueue(mapped);
46
+ }
47
+ });
48
+ }
49
+ async function devnull(a) {
50
+ const reader = a.getReader();
51
+ let cnt = 0;
52
+ while (true) {
53
+ const { done } = await reader.read();
54
+ if (done) {
55
+ break;
56
+ }
57
+ cnt++;
58
+ }
59
+ return cnt;
60
+ }
61
+ function array2stream(a) {
62
+ let i = 0;
63
+ return new ReadableStream({
64
+ pull(controller) {
65
+ if (i >= a.length) {
66
+ controller.close();
67
+ return;
68
+ }
69
+ controller.enqueue(a[i]);
70
+ i++;
71
+ }
72
+ });
73
+ }
74
+ async function stream2array(a) {
75
+ const ret = [];
76
+ const reader = a.getReader();
77
+ while (true) {
78
+ const { done, value } = await reader.read();
79
+ if (done) {
80
+ break;
81
+ }
82
+ ret.push(value);
83
+ }
84
+ return ret;
85
+ }
86
+
87
+ // src/utils/rebuffer.ts
88
+ async function rebufferArray(a, chunkSize) {
89
+ return stream2array(rebuffer(array2stream(a), chunkSize));
90
+ }
91
+ function reChunk(cs, chunkSize) {
92
+ const len = cs.reduce((acc, v) => acc + v.length, 0);
93
+ const last = cs[cs.length - 1];
94
+ const lastOfs = len - last.length;
95
+ const rest = last.subarray(chunkSize - lastOfs);
96
+ cs[cs.length - 1] = last.subarray(0, chunkSize - lastOfs);
97
+ const chunk = new Uint8Array(chunkSize);
98
+ let ofs = 0;
99
+ for (const c of cs) {
100
+ chunk.set(c, ofs);
101
+ ofs += c.length;
102
+ }
103
+ return { rest, chunk };
104
+ }
105
+ function pump(ps, controller, next) {
106
+ ps.reader.read().then(({ done, value }) => {
107
+ if (done) {
108
+ if (ps.tmpLen > 0) {
109
+ controller.enqueue(reChunk(ps.tmp, ps.tmpLen).chunk);
110
+ }
111
+ controller.close();
112
+ next();
113
+ return;
114
+ }
115
+ if (ps.tmpLen + value.length > ps.chunkSize) {
116
+ ps.tmp.push(value);
117
+ const res = reChunk(ps.tmp, ps.chunkSize);
118
+ controller.enqueue(res.chunk);
119
+ ps.tmp = [res.rest];
120
+ ps.tmpLen = res.rest.length;
121
+ next();
122
+ return;
123
+ } else if (value.length) {
124
+ ps.tmp.push(value);
125
+ ps.tmpLen += value.length;
126
+ }
127
+ pump(ps, controller, next);
128
+ });
129
+ }
130
+ function rebuffer(a, chunkSize) {
131
+ const state = {
132
+ reader: a.getReader(),
133
+ tmp: [],
134
+ tmpLen: 0,
135
+ chunkSize
136
+ };
137
+ return new ReadableStream({
138
+ async pull(controller) {
139
+ return new Promise((resolve) => {
140
+ pump(state, controller, resolve);
141
+ });
142
+ }
143
+ });
144
+ }
145
+
146
+ // src/utils/stream2string.ts
147
+ async function stream2string(stream, maxSize) {
148
+ if (!stream) {
149
+ return Promise.resolve("");
150
+ }
151
+ const reader = stream.getReader();
152
+ let res = "";
153
+ const decoder = new TextDecoder();
154
+ let rSize = 0;
155
+ while (typeof maxSize === "undefined" || rSize < maxSize) {
156
+ try {
157
+ const read = await reader.read();
158
+ if (read.done) {
159
+ break;
160
+ }
161
+ if (maxSize && rSize + read.value.length > maxSize) {
162
+ read.value = read.value.slice(0, maxSize - rSize);
163
+ }
164
+ const block = decoder.decode(read.value, { stream: true });
165
+ rSize += read.value.length;
166
+ res += block;
167
+ } catch (err) {
168
+ return Promise.reject(err);
169
+ }
170
+ }
171
+ return Promise.resolve(res);
172
+ }
173
+ async function stream2uint8array(stream) {
174
+ if (!stream) {
175
+ return Promise.resolve(new Uint8Array());
176
+ }
177
+ const reader = stream.getReader();
178
+ let res = new Uint8Array();
179
+ while (1) {
180
+ try {
181
+ const { done, value } = await reader.read();
182
+ if (done) {
183
+ break;
184
+ }
185
+ res = new Uint8Array([...res, ...value]);
186
+ } catch (err) {
187
+ return Promise.reject(err);
188
+ }
189
+ }
190
+ return Promise.resolve(res);
191
+ }
192
+
193
+ // src/utils/stream-test-helper.ts
194
+ async function receiveFromStream(reb, state) {
195
+ return new Promise((resolve) => {
196
+ let reBufferCalls = 0;
197
+ const reader = reb.getReader();
198
+ function pump2() {
199
+ reader.read().then(({ done, value }) => {
200
+ state.CollectorFn({ done, value, fillCalls: state.fillCalls, reBufferCalls });
201
+ reBufferCalls++;
202
+ if (done) {
203
+ resolve();
204
+ return;
205
+ }
206
+ pump2();
207
+ });
208
+ }
209
+ pump2();
210
+ });
211
+ }
212
+ async function sendToStream(reb, state) {
213
+ return new Promise((resolve) => {
214
+ const writer = reb.getWriter();
215
+ function pump2(i) {
216
+ if (i >= state.sendChunks) {
217
+ writer.close();
218
+ resolve();
219
+ return;
220
+ }
221
+ writer.ready.then(() => {
222
+ state.fillCalls++;
223
+ writer.write(new Uint8Array(Array(state.sendChunkSize).fill(i)));
224
+ pump2(i + 1);
225
+ });
226
+ }
227
+ pump2(0);
228
+ });
229
+ }
230
+
231
+ // src/utils/string2stream.ts
232
+ function string2stream(str) {
233
+ const encoder = new TextEncoder();
234
+ return uint8array2stream(encoder.encode(str));
235
+ }
236
+ function uint8array2stream(str) {
237
+ return new ReadableStream({
238
+ start(controller) {
239
+ controller.enqueue(str);
240
+ controller.close();
241
+ }
242
+ });
243
+ }
244
+
245
+ // src/utils/console-write-stream.ts
246
+ var ConsoleWriterStreamDefaultWriter = class {
247
+ constructor(stream) {
248
+ this.stream = stream;
249
+ this.desiredSize = null;
250
+ this.decoder = new TextDecoder();
251
+ this._stream = stream;
252
+ this.ready = Promise.resolve(void 0);
253
+ this.closed = Promise.resolve(void 0);
254
+ }
255
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
256
+ abort(reason) {
257
+ throw new Error("Method not implemented.");
258
+ }
259
+ async close() {
260
+ }
261
+ releaseLock() {
262
+ this._stream.locked = false;
263
+ this.ready = Promise.resolve(void 0);
264
+ this.closed = Promise.resolve(void 0);
265
+ }
266
+ async write(chunk) {
267
+ const str = this.decoder.decode(chunk).trimEnd();
268
+ let output = "log";
269
+ try {
270
+ const decode = JSON.parse(str);
271
+ output = decode.level;
272
+ } catch (e) {
273
+ }
274
+ switch (output) {
275
+ case "error":
276
+ console.error(str);
277
+ break;
278
+ case "warn":
279
+ console.warn(str);
280
+ break;
281
+ default:
282
+ console.log(str);
283
+ }
284
+ }
285
+ };
286
+ var ConsoleWriterStream = class {
287
+ constructor() {
288
+ this.locked = false;
289
+ }
290
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
291
+ abort(reason) {
292
+ throw new Error("Method not implemented.");
293
+ }
294
+ async close() {
295
+ return;
296
+ }
297
+ getWriter() {
298
+ if (this.locked) {
299
+ throw new Error("Stream is locked");
300
+ }
301
+ this.locked = true;
302
+ if (!this._writer) {
303
+ this._writer = new ConsoleWriterStreamDefaultWriter(this);
304
+ }
305
+ return this._writer;
306
+ }
307
+ };
308
+
309
+ // src/utils/fanout-write-stream.ts
310
+ var FanoutWriteStream = class {
311
+ constructor(writers) {
312
+ this.desiredSize = null;
313
+ this._writers = writers;
314
+ this.ready = Promise.all(this._writers.map((w) => w.ready)).then(() => void 0);
315
+ this.closed = Promise.all(this._writers.map((w) => w.closed)).then(() => void 0);
316
+ }
317
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
318
+ abort(reason) {
319
+ return Promise.all(this._writers.map((w) => w.abort(reason))).then(() => {
320
+ });
321
+ }
322
+ close() {
323
+ return Promise.all(this._writers.map((w) => w.close())).then(() => {
324
+ });
325
+ }
326
+ releaseLock() {
327
+ this._writers.map((w) => w.releaseLock());
328
+ }
329
+ write(chunk) {
330
+ return Promise.all(this._writers.map((w) => w.write(chunk))).then(() => {
331
+ });
332
+ }
333
+ };
334
+
335
+ export {
336
+ ConsoleWriterStreamDefaultWriter,
337
+ ConsoleWriterStream,
338
+ FanoutWriteStream,
339
+ streamMap,
340
+ devnull,
341
+ array2stream,
342
+ stream2array,
343
+ rebufferArray,
344
+ rebuffer,
345
+ stream2string,
346
+ stream2uint8array,
347
+ receiveFromStream,
348
+ sendToStream,
349
+ string2stream,
350
+ uint8array2stream,
351
+ utils_exports
352
+ };
353
+ //# sourceMappingURL=chunk-AO7BGISE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/index.ts","../../src/utils/stream-map.ts","../../src/utils/rebuffer.ts","../../src/utils/stream2string.ts","../../src/utils/stream-test-helper.ts","../../src/utils/string2stream.ts","../../src/utils/console-write-stream.ts","../../src/utils/fanout-write-stream.ts"],"sourcesContent":["export * from \"./rebuffer\";\nexport * from \"./stream-map\";\nexport * from \"./stream2string\";\nexport * from \"./stream-test-helper\";\nexport * from \"./string2stream\";\nexport * from \"./console-write-stream\";\nexport * from \"./fanout-write-stream\";\n","export interface StreamMap<T, U> {\n Map(s: T, idx: number): U | Promise<U>;\n readonly Close?: () => void;\n}\nexport function streamMap<T, U>(s: ReadableStream<T>, sm: StreamMap<T, U>): ReadableStream<U> {\n const state = { reader: s.getReader(), streamMap: sm, idx: 0 };\n return new ReadableStream<U>({\n async pull(controller) {\n const { done, value } = await state.reader.read();\n if (done) {\n if (state.streamMap.Close) {\n state.streamMap.Close();\n }\n controller.close();\n return;\n }\n const promiseOrU = state.streamMap.Map(value, state.idx++);\n let mapped: U;\n if (promiseOrU instanceof Promise || typeof (promiseOrU as { then: () => void }).then === \"function\") {\n mapped = await promiseOrU;\n } else {\n mapped = promiseOrU;\n }\n controller.enqueue(mapped);\n },\n });\n}\n\nexport async function devnull<T>(a: ReadableStream<T>): Promise<number> {\n const reader = a.getReader();\n let cnt = 0;\n while (true) {\n const { done } = await reader.read();\n if (done) {\n break;\n }\n cnt++;\n }\n return cnt;\n}\n\nexport function array2stream<T>(a: T[]): ReadableStream<T> {\n let i = 0;\n return new ReadableStream<T>({\n pull(controller) {\n if (i >= a.length) {\n controller.close();\n return;\n }\n controller.enqueue(a[i]);\n i++;\n },\n });\n}\n\nexport async function stream2array<T>(a: ReadableStream<T>): Promise<T[]> {\n const ret: T[] = [];\n const reader = a.getReader();\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n ret.push(value);\n }\n return ret;\n}\n","import { array2stream, stream2array } from \"./stream-map\";\n\ninterface ReChunkResult {\n readonly rest: Uint8Array;\n readonly chunk: Uint8Array;\n}\n\nexport async function rebufferArray(a: Uint8Array[], chunkSize: number): Promise<Uint8Array[]> {\n return stream2array(rebuffer(array2stream(a), chunkSize));\n}\n\nfunction reChunk(cs: Uint8Array[], chunkSize: number): ReChunkResult {\n const len = cs.reduce((acc, v) => acc + v.length, 0);\n const last = cs[cs.length - 1];\n const lastOfs = len - last.length;\n // console.log(\"reChunk\", len, lastOfs, last.length, chunkSize, chunkSize - lastOfs)\n const rest = last.subarray(chunkSize - lastOfs);\n cs[cs.length - 1] = last.subarray(0, chunkSize - lastOfs);\n const chunk = new Uint8Array(chunkSize);\n let ofs = 0;\n for (const c of cs) {\n chunk.set(c, ofs);\n ofs += c.length;\n }\n return { rest, chunk };\n}\n\ninterface pumpState {\n readonly reader: ReadableStreamDefaultReader<Uint8Array>;\n tmp: Uint8Array[];\n tmpLen: number;\n readonly chunkSize: number;\n}\n\nfunction pump(ps: pumpState, controller: ReadableStreamDefaultController<Uint8Array>, next: () => void): void {\n ps.reader.read().then(({ done, value }) => {\n if (done) {\n if (ps.tmpLen > 0) {\n controller.enqueue(reChunk(ps.tmp, ps.tmpLen).chunk);\n }\n controller.close();\n next();\n return;\n }\n if (ps.tmpLen + value.length > ps.chunkSize) {\n ps.tmp.push(value);\n const res = reChunk(ps.tmp, ps.chunkSize);\n controller.enqueue(res.chunk);\n ps.tmp = [res.rest];\n ps.tmpLen = res.rest.length;\n next();\n return;\n } else if (value.length) {\n ps.tmp.push(value);\n ps.tmpLen += value.length;\n }\n pump(ps, controller, next);\n });\n}\n\nexport function rebuffer(a: ReadableStream<Uint8Array>, chunkSize: number): ReadableStream<Uint8Array> {\n const state: pumpState = {\n reader: a.getReader(),\n tmp: [],\n tmpLen: 0,\n chunkSize,\n };\n return new ReadableStream<Uint8Array>({\n async pull(controller) {\n return new Promise<void>((resolve) => {\n pump(state, controller, resolve);\n });\n },\n });\n}\n","export async function stream2string(stream?: ReadableStream<Uint8Array> | null, maxSize?: number): Promise<string> {\n if (!stream) {\n return Promise.resolve(\"\");\n }\n const reader = stream.getReader();\n let res = \"\";\n const decoder = new TextDecoder();\n let rSize = 0;\n while (typeof maxSize === \"undefined\" || rSize < maxSize) {\n try {\n const read = await reader.read();\n if (read.done) {\n break;\n }\n if (maxSize && rSize + read.value.length > maxSize) {\n read.value = read.value.slice(0, maxSize - rSize);\n }\n const block = decoder.decode(read.value, { stream: true });\n rSize += read.value.length;\n res += block;\n } catch (err) {\n return Promise.reject(err);\n }\n }\n return Promise.resolve(res);\n}\n\nexport async function stream2uint8array(stream?: ReadableStream<Uint8Array> | null): Promise<Uint8Array> {\n if (!stream) {\n return Promise.resolve(new Uint8Array());\n }\n const reader = stream.getReader();\n let res = new Uint8Array();\n // eslint-disable-next-line no-constant-condition\n while (1) {\n try {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n res = new Uint8Array([...res, ...value]);\n } catch (err) {\n return Promise.reject(err);\n }\n }\n return Promise.resolve(res);\n}\n","import { Mock } from \"vitest\";\n\ninterface mockValue {\n done: boolean;\n value: Uint8Array | undefined;\n fillCalls: number;\n reBufferCalls: number;\n}\nexport interface streamingTestState {\n readonly sendChunks: number;\n readonly sendChunkSize: number;\n fillCalls: number;\n CollectorFn: Mock<(mv: mockValue) => void>;\n}\n\nexport async function receiveFromStream(reb: ReadableStream<Uint8Array>, state: streamingTestState) {\n return new Promise<void>((resolve) => {\n let reBufferCalls = 0;\n const reader = reb.getReader();\n function pump() {\n reader.read().then(({ done, value }) => {\n state.CollectorFn({ done, value, fillCalls: state.fillCalls, reBufferCalls });\n reBufferCalls++;\n if (done) {\n resolve();\n return;\n }\n pump();\n });\n }\n pump();\n });\n}\n\nexport async function sendToStream(reb: WritableStream<Uint8Array>, state: streamingTestState) {\n return new Promise<void>((resolve) => {\n const writer = reb.getWriter();\n function pump(i: number) {\n if (i >= state.sendChunks) {\n writer.close();\n resolve();\n return;\n }\n writer.ready.then(() => {\n state.fillCalls++;\n writer.write(new Uint8Array(Array(state.sendChunkSize).fill(i)));\n pump(i + 1);\n });\n }\n pump(0);\n });\n}\n\n// it(\"does nothing\", () => {});\n","export function string2stream(str: string): ReadableStream<Uint8Array> {\n const encoder = new TextEncoder();\n return uint8array2stream(encoder.encode(str));\n}\n\nexport function uint8array2stream(str: Uint8Array): ReadableStream<Uint8Array> {\n return new ReadableStream<Uint8Array>({\n start(controller) {\n controller.enqueue(str);\n controller.close();\n },\n });\n}\n","export class ConsoleWriterStreamDefaultWriter implements WritableStreamDefaultWriter<Uint8Array> {\n readonly desiredSize: number | null = null;\n readonly decoder = new TextDecoder();\n\n closed: Promise<undefined>;\n ready: Promise<undefined>;\n readonly _stream: ConsoleWriterStream;\n\n constructor(private stream: ConsoleWriterStream) {\n this._stream = stream;\n this.ready = Promise.resolve(undefined);\n this.closed = Promise.resolve(undefined);\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any\n abort(reason?: any): Promise<void> {\n throw new Error(\"Method not implemented.\");\n }\n async close(): Promise<void> {\n // noop\n }\n releaseLock(): void {\n this._stream.locked = false;\n this.ready = Promise.resolve(undefined);\n this.closed = Promise.resolve(undefined);\n }\n async write(chunk?: Uint8Array | undefined): Promise<void> {\n const str = this.decoder.decode(chunk).trimEnd();\n let output = \"log\";\n try {\n const decode = JSON.parse(str);\n output = decode.level;\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (e) {\n /* noop */\n }\n switch (output) {\n case \"error\":\n // eslint-disable-next-line no-console\n console.error(str);\n break;\n case \"warn\":\n // eslint-disable-next-line no-console\n console.warn(str);\n break;\n default:\n // eslint-disable-next-line no-console\n console.log(str);\n }\n }\n}\n\nexport class ConsoleWriterStream implements WritableStream<Uint8Array> {\n locked = false;\n _writer?: WritableStreamDefaultWriter<Uint8Array>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars\n abort(reason?: any): Promise<void> {\n throw new Error(\"Method not implemented.\");\n }\n async close(): Promise<void> {\n return;\n }\n getWriter(): WritableStreamDefaultWriter<Uint8Array> {\n if (this.locked) {\n throw new Error(\"Stream is locked\");\n }\n this.locked = true;\n if (!this._writer) {\n this._writer = new ConsoleWriterStreamDefaultWriter(this);\n }\n return this._writer;\n }\n}\n","export class FanoutWriteStream implements WritableStreamDefaultWriter<Uint8Array> {\n readonly _writers: WritableStreamDefaultWriter<Uint8Array>[];\n readonly ready: Promise<undefined>;\n readonly closed: Promise<undefined>;\n readonly desiredSize: number | null = null;\n constructor(writers: WritableStreamDefaultWriter<Uint8Array>[]) {\n this._writers = writers;\n this.ready = Promise.all(this._writers.map((w) => w.ready)).then(() => undefined);\n this.closed = Promise.all(this._writers.map((w) => w.closed)).then(() => undefined);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n abort(reason?: any): Promise<void> {\n return Promise.all(this._writers.map((w) => w.abort(reason))).then(() => {\n /* do nothing */\n });\n }\n close(): Promise<void> {\n return Promise.all(this._writers.map((w) => w.close())).then(() => {\n /* do nothing */\n });\n }\n releaseLock(): void {\n this._writers.map((w) => w.releaseLock());\n }\n\n write(chunk?: Uint8Array | undefined): Promise<void> {\n return Promise.all(this._writers.map((w) => w.write(chunk))).then(() => {\n /* do nothing */\n });\n }\n}\n"],"mappings":";;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACIO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;AAAA,IACpC;AACA,SAAK,SAAS;AACd,QAAI,CAAC,KAAK,SAAS;AACjB,WAAK,UAAU,IAAI,iCAAiC,IAAI;AAAA,IAC1D;AACA,WAAO,KAAK;AAAA,EACd;AACF;;;ACvEO,IAAM,oBAAN,MAA2E;AAAA,EAKhF,YAAY,SAAoD;AADhE,SAAS,cAA6B;AAEpC,SAAK,WAAW;AAChB,SAAK,QAAQ,QAAQ,IAAI,KAAK,SAAS,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,MAAM,MAAS;AAChF,SAAK,SAAS,QAAQ,IAAI,KAAK,SAAS,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,MAAM,MAAS;AAAA,EACpF;AAAA;AAAA,EAGA,MAAM,QAA6B;AACjC,WAAO,QAAQ,IAAI,KAAK,SAAS,IAAI,CAAC,MAAM,EAAE,MAAM,MAAM,CAAC,CAAC,EAAE,KAAK,MAAM;AAAA,IAEzE,CAAC;AAAA,EACH;AAAA,EACA,QAAuB;AACrB,WAAO,QAAQ,IAAI,KAAK,SAAS,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,KAAK,MAAM;AAAA,IAEnE,CAAC;AAAA,EACH;AAAA,EACA,cAAoB;AAClB,SAAK,SAAS,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC;AAAA,EAC1C;AAAA,EAEA,MAAM,OAA+C;AACnD,WAAO,QAAQ,IAAI,KAAK,SAAS,IAAI,CAAC,MAAM,EAAE,MAAM,KAAK,CAAC,CAAC,EAAE,KAAK,MAAM;AAAA,IAExE,CAAC;AAAA,EACH;AACF;","names":["pump"]}
@@ -18,6 +18,10 @@ var __spreadValues = (a, b) => {
18
18
  }
19
19
  return a;
20
20
  };
21
+ var __export = (target, all) => {
22
+ for (var name in all)
23
+ __defProp(target, name, { get: all[name], enumerable: true });
24
+ };
21
25
  var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
22
26
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
23
27
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
@@ -57,9 +61,10 @@ var __yieldStar = (value) => {
57
61
 
58
62
  export {
59
63
  __spreadValues,
64
+ __export,
60
65
  __privateGet,
61
66
  __privateAdd,
62
67
  __privateSet,
63
68
  __yieldStar
64
69
  };
65
- //# sourceMappingURL=chunk-J2IM7FHM.js.map
70
+ //# sourceMappingURL=chunk-I4NUGWZ6.js.map
@@ -2,9 +2,9 @@ import {
2
2
  BaseSysAbstraction,
3
3
  WrapperSysAbstraction,
4
4
  envFactory
5
- } from "./chunk-O4F5AURC.js";
5
+ } from "./chunk-P4FB5FHU.js";
6
6
 
7
- // src/web/web_sys_abstraction.ts
7
+ // src/web/web-sys-abstraction.ts
8
8
  var WebFileService = class {
9
9
  get baseDir() {
10
10
  throw new Error("basedir-Method not implemented.");
@@ -80,4 +80,4 @@ function WebSysAbstraction(param) {
80
80
  export {
81
81
  WebSysAbstraction
82
82
  };
83
- //# sourceMappingURL=chunk-XJF7FQUN.js.map
83
+ //# sourceMappingURL=chunk-LJRKN3XI.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/web/web_sys_abstraction.ts"],"sourcesContent":["import { BaseSysAbstraction, WrapperSysAbstraction, WrapperSysAbstractionParams } from \"../base_sys_abstraction\";\nimport { FileService, NamedWritableStream } from \"../file_service\";\nimport { SysAbstraction, SystemService, VoidFunc } from \"../sys_abstraction\";\nimport { envFactory } from \"../sys_env\";\n\nclass WebFileService implements FileService {\n get baseDir(): string {\n throw new Error(\"basedir-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n create(fname: string): Promise<NamedWritableStream> {\n throw new Error(\"create-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n readFileString(fname: string): Promise<string> {\n throw new Error(\"readFileString-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n writeFileString(fname: string, content: string): Promise<void> {\n throw new Error(\"writeFileString-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n abs(fname: string): string {\n throw new Error(\"abs-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n join(...paths: string[]): string {\n throw new Error(\"join-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n relative(from: string, to?: string | undefined): string {\n throw new Error(\"relative-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n dirname(fname: string): string {\n throw new Error(\"dirname-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n basename(fname: string): string {\n throw new Error(\"basename-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n nodeImport(fname: string): string {\n throw new Error(\"nodeImport-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n isAbsolute(fname: string): boolean {\n throw new Error(\"isAbsolute-Method not implemented.\");\n }\n}\n\nclass WebSystemService implements SystemService {\n Env() {\n return envFactory();\n }\n Args(): string[] {\n throw new Error(\"Args-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n OnExit(hdl: VoidFunc): VoidFunc {\n throw new Error(\"OnExit-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n Exit(code: number): void {\n throw new Error(\"Exit-Method not implemented.\");\n }\n}\n\nlet my: BaseSysAbstraction | undefined = undefined;\nexport function WebSysAbstraction(param?: WrapperSysAbstractionParams): SysAbstraction {\n if (!my) {\n my = new BaseSysAbstraction({\n FileSystem: new WebFileService(),\n SystemService: new WebSystemService(),\n });\n }\n return new WrapperSysAbstraction(my, param);\n}\n"],"mappings":";;;;;;;AAKA,IAAM,iBAAN,MAA4C;AAAA,EA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I,mBAAmB;AAAA,MAC1B,YAAY,IAAI,eAAe;AAAA,MAC/B,eAAe,IAAI,iBAAiB;AAAA,IACtC,CAAC;AAAA,EACH;AACA,SAAO,IAAI,sBAAsB,IAAI,KAAK;AAC5C;","names":[]}
1
+ {"version":3,"sources":["../../src/web/web-sys-abstraction.ts"],"sourcesContent":["import { BaseSysAbstraction, WrapperSysAbstraction, WrapperSysAbstractionParams } from \"../base-sys-abstraction\";\nimport { FileService, NamedWritableStream } from \"../file-service\";\nimport { SysAbstraction, SystemService, VoidFunc } from \"../sys-abstraction\";\nimport { envFactory } from \"../sys-env\";\n\nclass WebFileService implements FileService {\n get baseDir(): string {\n throw new Error(\"basedir-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n create(fname: string): Promise<NamedWritableStream> {\n throw new Error(\"create-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n readFileString(fname: string): Promise<string> {\n throw new Error(\"readFileString-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n writeFileString(fname: string, content: string): Promise<void> {\n throw new Error(\"writeFileString-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n abs(fname: string): string {\n throw new Error(\"abs-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n join(...paths: string[]): string {\n throw new Error(\"join-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n relative(from: string, to?: string | undefined): string {\n throw new Error(\"relative-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n dirname(fname: string): string {\n throw new Error(\"dirname-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n basename(fname: string): string {\n throw new Error(\"basename-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n nodeImport(fname: string): string {\n throw new Error(\"nodeImport-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n isAbsolute(fname: string): boolean {\n throw new Error(\"isAbsolute-Method not implemented.\");\n }\n}\n\nclass WebSystemService implements SystemService {\n Env() {\n return envFactory();\n }\n Args(): string[] {\n throw new Error(\"Args-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n OnExit(hdl: VoidFunc): VoidFunc {\n throw new Error(\"OnExit-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n Exit(code: number): void {\n throw new Error(\"Exit-Method not implemented.\");\n }\n}\n\nlet my: BaseSysAbstraction | undefined = undefined;\nexport function WebSysAbstraction(param?: WrapperSysAbstractionParams): SysAbstraction {\n if (!my) {\n my = new BaseSysAbstraction({\n FileSystem: new WebFileService(),\n SystemService: new WebSystemService(),\n });\n }\n return new WrapperSysAbstraction(my, param);\n}\n"],"mappings":";;;;;;;AAKA,IAAM,iBAAN,MAA4C;AAAA,EAC1C,IAAI,UAAkB;AACpB,UAAM,IAAI,MAAM,iCAAiC;AAAA,EACnD;AAAA;AAAA,EAEA,OAAO,OAA6C;AAClD,UAAM,IAAI,MAAM,gCAAgC;AAAA,EAClD;AAAA;AAAA,EAEA,eAAe,OAAgC;AAC7C,UAAM,IAAI,MAAM,wCAAwC;AAAA,EAC1D;AAAA;AAAA,EAEA,gBAAgB,OAAe,SAAgC;AAC7D,UAAM,IAAI,MAAM,yCAAyC;AAAA,EAC3D;AAAA;AAAA,EAEA,IAAI,OAAuB;AACzB,UAAM,IAAI,MAAM,6BAA6B;AAAA,EAC/C;AAAA;AAAA,EAEA,QAAQ,OAAyB;AAC/B,UAAM,IAAI,MAAM,8BAA8B;AAAA,EAChD;AAAA;AAAA,EAEA,SAAS,MAAc,IAAiC;AACtD,UAAM,IAAI,MAAM,kCAAkC;AAAA,EACpD;AAAA;AAAA,EAEA,QAAQ,OAAuB;AAC7B,UAAM,IAAI,MAAM,iCAAiC;AAAA,EACnD;AAAA;AAAA,EAEA,SAAS,OAA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