@adviser/cement 0.2.16 → 0.2.18
Sign up to get free protection for your applications and to get access to all the features.
- package/{sys_abstraction-CmSCeK7b.d.cts → base-sys-abstraction-BzVP_lX0.d.cts} +77 -1
- package/{sys_abstraction-CmSCeK7b.d.ts → base-sys-abstraction-BzVP_lX0.d.ts} +77 -1
- package/chunk-AO7BGISE.js +353 -0
- package/chunk-AO7BGISE.js.map +1 -0
- package/{chunk-J2IM7FHM.js → chunk-I4NUGWZ6.js} +6 -1
- package/{chunk-XJF7FQUN.js → chunk-LJRKN3XI.js} +3 -3
- package/{chunk-XJF7FQUN.js.map → chunk-LJRKN3XI.js.map} +1 -1
- package/{chunk-O4F5AURC.js → chunk-P4FB5FHU.js} +185 -179
- package/chunk-P4FB5FHU.js.map +1 -0
- package/index-_GuS2IT4.d.cts +93 -0
- package/index-_GuS2IT4.d.ts +93 -0
- package/index.cjs +416 -52
- package/index.cjs.map +1 -1
- package/index.d.cts +27 -21
- package/index.d.ts +27 -21
- package/index.js +86 -49
- package/index.js.map +1 -1
- package/node/index.cjs +5 -5
- package/node/index.cjs.map +1 -1
- package/node/index.d.cts +1 -2
- package/node/index.d.ts +1 -2
- package/node/index.js +5 -5
- package/node/index.js.map +1 -1
- package/package.json +4 -4
- package/utils/index.cjs +98 -2
- package/utils/index.cjs.map +1 -1
- package/utils/index.d.cts +2 -36
- package/utils/index.d.ts +2 -36
- package/utils/index.js +21 -221
- package/utils/index.js.map +1 -1
- package/web/index.cjs +3 -3
- package/web/index.cjs.map +1 -1
- package/web/index.d.cts +1 -2
- package/web/index.d.ts +1 -2
- package/web/index.js +3 -3
- package/base_sys_abstraction-CJqRmTui.d.ts +0 -21
- package/base_sys_abstraction-nsNTl07w.d.cts +0 -21
- package/chunk-O4F5AURC.js.map +0 -1
- /package/{chunk-J2IM7FHM.js.map → chunk-I4NUGWZ6.js.map} +0 -0
package/index.d.cts
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
-
import { S as SysAbstraction } from './
|
2
|
-
export { B as BrowserEnvActions, D as Duration, e as Env, c as EnvActions, d as EnvFactoryOpts, g as EnvImpl, E as EnvMap, F as FileService, I as IDMode, N as NamedWritableStream, O as OnSetItem, R as RandomMode, a as String2TimeMode, b as SystemService, h as Time, T as TimeMode, i as TimeUnits, V as VoidFunc, f as envFactory } from './
|
1
|
+
import { S as SysAbstraction } from './base-sys-abstraction-BzVP_lX0.cjs';
|
2
|
+
export { r as BaseSysAbstraction, o as BaseSysAbstractionParams, B as BrowserEnvActions, C as ConstTime, D as Duration, e as Env, c as EnvActions, d as EnvFactoryOpts, g as EnvImpl, E as EnvMap, p as ExitHandler, q as ExitService, F as FileService, I as IDMode, n as IdService, N as NamedWritableStream, O as OnSetItem, R as RandomMode, m as RandomService, k as StepTime, a as String2TimeMode, j as SysTime, b as SystemService, h as Time, l as TimeFactory, T as TimeMode, i as TimeUnits, V as VoidFunc, s as WrapperSysAbstraction, W as WrapperSysAbstractionParams, f as envFactory } from './base-sys-abstraction-BzVP_lX0.cjs';
|
3
|
+
export { i as utils } from './index-_GuS2IT4.cjs';
|
4
|
+
import 'vitest';
|
3
5
|
|
4
6
|
declare abstract class Result<T, E = Error> {
|
5
7
|
static Ok<T>(t: T): Result<T, Error>;
|
@@ -164,7 +166,7 @@ declare class LevelHandlerImpl implements LevelHandler {
|
|
164
166
|
setDebug(...modules: (string | string[])[]): void;
|
165
167
|
isEnabled(ilevel: unknown, module: unknown): boolean;
|
166
168
|
}
|
167
|
-
declare class
|
169
|
+
declare class LogWriterStream {
|
168
170
|
readonly _out: WritableStream<Uint8Array>;
|
169
171
|
readonly _toFlush: (() => Promise<void>)[];
|
170
172
|
constructor(out: WritableStream<Uint8Array>);
|
@@ -175,7 +177,7 @@ declare class LogWriter$1 {
|
|
175
177
|
}
|
176
178
|
interface LoggerImplParams {
|
177
179
|
readonly out?: WritableStream<Uint8Array>;
|
178
|
-
readonly logWriter?:
|
180
|
+
readonly logWriter?: LogWriterStream;
|
179
181
|
readonly sys?: SysAbstraction;
|
180
182
|
readonly withAttributes?: LogSerializable;
|
181
183
|
readonly levelHandler?: LevelHandler;
|
@@ -184,7 +186,7 @@ declare class LoggerImpl implements Logger {
|
|
184
186
|
readonly _sys: SysAbstraction;
|
185
187
|
readonly _attributes: LogSerializable;
|
186
188
|
readonly _withAttributes: LogSerializable;
|
187
|
-
readonly _logWriter:
|
189
|
+
readonly _logWriter: LogWriterStream;
|
188
190
|
readonly _levelHandler: LevelHandler;
|
189
191
|
constructor(params?: LoggerImplParams);
|
190
192
|
SetExposeStack(enable?: boolean): Logger;
|
@@ -220,13 +222,21 @@ declare class LoggerImpl implements Logger {
|
|
220
222
|
Msg(...args: string[]): AsError;
|
221
223
|
}
|
222
224
|
|
223
|
-
declare class
|
224
|
-
|
225
|
-
_resolveClosed: (value?: PromiseLike<undefined>) => void;
|
226
|
-
closed: Promise<undefined>;
|
227
|
-
desiredSize: number | null;
|
228
|
-
ready: Promise<undefined>;
|
225
|
+
declare class Future<T> {
|
226
|
+
#private;
|
229
227
|
constructor();
|
228
|
+
asPromise(): Promise<T>;
|
229
|
+
resolve(value: T): void;
|
230
|
+
reject(reason: unknown): void;
|
231
|
+
}
|
232
|
+
|
233
|
+
declare class LogWriteStream implements WritableStreamDefaultWriter<Uint8Array> {
|
234
|
+
private readonly _bufferArr;
|
235
|
+
constructor(bufferArr: Uint8Array[]);
|
236
|
+
readonly _resolveClosed: Future<undefined>;
|
237
|
+
readonly closed: Promise<undefined>;
|
238
|
+
readonly desiredSize: number | null;
|
239
|
+
readonly ready: Promise<undefined>;
|
230
240
|
abort(reason?: any): Promise<void>;
|
231
241
|
close(): Promise<void>;
|
232
242
|
releaseLock(): void;
|
@@ -234,7 +244,10 @@ declare class LogWriter implements WritableStreamDefaultWriter<Uint8Array> {
|
|
234
244
|
}
|
235
245
|
declare class LogCollector implements WritableStream<Uint8Array> {
|
236
246
|
readonly locked: boolean;
|
237
|
-
_writer
|
247
|
+
private _writer?;
|
248
|
+
private readonly _pass?;
|
249
|
+
private readonly _bufferArr;
|
250
|
+
constructor(pass?: WritableStreamDefaultWriter<Uint8Array>);
|
238
251
|
abort(reason?: Uint8Array): Promise<void>;
|
239
252
|
close(): Promise<void>;
|
240
253
|
getWriter(): WritableStreamDefaultWriter<Uint8Array>;
|
@@ -247,6 +260,7 @@ interface MockLoggerReturn {
|
|
247
260
|
}
|
248
261
|
declare function MockLogger(params?: {
|
249
262
|
readonly sys?: SysAbstraction;
|
263
|
+
readonly pass?: WritableStreamDefaultWriter<Uint8Array>;
|
250
264
|
moduleName?: string | string[];
|
251
265
|
readonly disableDebug?: boolean;
|
252
266
|
}): MockLoggerReturn;
|
@@ -276,14 +290,6 @@ declare class None<T> extends Option<T> {
|
|
276
290
|
}
|
277
291
|
type WithoutOption<T> = T extends Option<infer U> ? U : T;
|
278
292
|
|
279
|
-
declare class Future<T> {
|
280
|
-
#private;
|
281
|
-
constructor();
|
282
|
-
asPromise(): Promise<T>;
|
283
|
-
resolve(value: T): void;
|
284
|
-
reject(reason: unknown): void;
|
285
|
-
}
|
286
|
-
|
287
293
|
interface ResolveSeqItem<T, C> {
|
288
294
|
readonly future: Future<T>;
|
289
295
|
readonly fn: (c: C) => Promise<T>;
|
@@ -409,4 +415,4 @@ interface CryptoRuntime {
|
|
409
415
|
}
|
410
416
|
declare function toCryptoRuntime(cryptoOpts?: Partial<CryptoRuntime>): CryptoRuntime;
|
411
417
|
|
412
|
-
export { type AsError, BuildURI, type CTAesKeyAlgorithm, type CTAlgorithm, type CTAlgorithmIdentifier, type CTArrayBufferView, type CTBufferSource, type CTCryptoKey, type CTEcKeyImportParams, type CTHmacImportParams, type CTJsonWebKey, type CTKeyFormat, type CTKeyType, type CTKeyUsage, type CTNamedCurve, type CTRsaHashedImportParams, type CoerceURI, type CryptoRuntime, type FnSerialized, Future, IsLogger, Keyed, KeyedResolvOnce, KeyedResolvSeq, type Lengthed, Level, type LevelHandler, LevelHandlerImpl, LogCollector, type LogSerializable, LogValue,
|
418
|
+
export { type AsError, BuildURI, type CTAesKeyAlgorithm, type CTAlgorithm, type CTAlgorithmIdentifier, type CTArrayBufferView, type CTBufferSource, type CTCryptoKey, type CTEcKeyImportParams, type CTHmacImportParams, type CTJsonWebKey, type CTKeyFormat, type CTKeyType, type CTKeyUsage, type CTNamedCurve, type CTRsaHashedImportParams, type CoerceURI, type CryptoRuntime, type FnSerialized, Future, IsLogger, Keyed, KeyedResolvOnce, KeyedResolvSeq, type Lengthed, Level, type LevelHandler, LevelHandlerImpl, LogCollector, type LogSerializable, LogValue, LogWriteStream, LogWriterStream, type Logger, LoggerImpl, type LoggerImplParams, type LoggerInterface, MockLogger, type MockLoggerReturn, None, Option, ResolveOnce, ResolveSeq, Result, ResultError, ResultOK, type Runtime, type Serialized, type SizeOrLength, type Sized, Some, SysAbstraction, URI, type WithLogger, type WithoutOption, type WithoutResult, asyncLogValue, isURL, logValue, removeSelfRef, runtimeFn, toCryptoRuntime };
|
package/index.d.ts
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
-
import { S as SysAbstraction } from './
|
2
|
-
export { B as BrowserEnvActions, D as Duration, e as Env, c as EnvActions, d as EnvFactoryOpts, g as EnvImpl, E as EnvMap, F as FileService, I as IDMode, N as NamedWritableStream, O as OnSetItem, R as RandomMode, a as String2TimeMode, b as SystemService, h as Time, T as TimeMode, i as TimeUnits, V as VoidFunc, f as envFactory } from './
|
1
|
+
import { S as SysAbstraction } from './base-sys-abstraction-BzVP_lX0.js';
|
2
|
+
export { r as BaseSysAbstraction, o as BaseSysAbstractionParams, B as BrowserEnvActions, C as ConstTime, D as Duration, e as Env, c as EnvActions, d as EnvFactoryOpts, g as EnvImpl, E as EnvMap, p as ExitHandler, q as ExitService, F as FileService, I as IDMode, n as IdService, N as NamedWritableStream, O as OnSetItem, R as RandomMode, m as RandomService, k as StepTime, a as String2TimeMode, j as SysTime, b as SystemService, h as Time, l as TimeFactory, T as TimeMode, i as TimeUnits, V as VoidFunc, s as WrapperSysAbstraction, W as WrapperSysAbstractionParams, f as envFactory } from './base-sys-abstraction-BzVP_lX0.js';
|
3
|
+
export { i as utils } from './index-_GuS2IT4.js';
|
4
|
+
import 'vitest';
|
3
5
|
|
4
6
|
declare abstract class Result<T, E = Error> {
|
5
7
|
static Ok<T>(t: T): Result<T, Error>;
|
@@ -164,7 +166,7 @@ declare class LevelHandlerImpl implements LevelHandler {
|
|
164
166
|
setDebug(...modules: (string | string[])[]): void;
|
165
167
|
isEnabled(ilevel: unknown, module: unknown): boolean;
|
166
168
|
}
|
167
|
-
declare class
|
169
|
+
declare class LogWriterStream {
|
168
170
|
readonly _out: WritableStream<Uint8Array>;
|
169
171
|
readonly _toFlush: (() => Promise<void>)[];
|
170
172
|
constructor(out: WritableStream<Uint8Array>);
|
@@ -175,7 +177,7 @@ declare class LogWriter$1 {
|
|
175
177
|
}
|
176
178
|
interface LoggerImplParams {
|
177
179
|
readonly out?: WritableStream<Uint8Array>;
|
178
|
-
readonly logWriter?:
|
180
|
+
readonly logWriter?: LogWriterStream;
|
179
181
|
readonly sys?: SysAbstraction;
|
180
182
|
readonly withAttributes?: LogSerializable;
|
181
183
|
readonly levelHandler?: LevelHandler;
|
@@ -184,7 +186,7 @@ declare class LoggerImpl implements Logger {
|
|
184
186
|
readonly _sys: SysAbstraction;
|
185
187
|
readonly _attributes: LogSerializable;
|
186
188
|
readonly _withAttributes: LogSerializable;
|
187
|
-
readonly _logWriter:
|
189
|
+
readonly _logWriter: LogWriterStream;
|
188
190
|
readonly _levelHandler: LevelHandler;
|
189
191
|
constructor(params?: LoggerImplParams);
|
190
192
|
SetExposeStack(enable?: boolean): Logger;
|
@@ -220,13 +222,21 @@ declare class LoggerImpl implements Logger {
|
|
220
222
|
Msg(...args: string[]): AsError;
|
221
223
|
}
|
222
224
|
|
223
|
-
declare class
|
224
|
-
|
225
|
-
_resolveClosed: (value?: PromiseLike<undefined>) => void;
|
226
|
-
closed: Promise<undefined>;
|
227
|
-
desiredSize: number | null;
|
228
|
-
ready: Promise<undefined>;
|
225
|
+
declare class Future<T> {
|
226
|
+
#private;
|
229
227
|
constructor();
|
228
|
+
asPromise(): Promise<T>;
|
229
|
+
resolve(value: T): void;
|
230
|
+
reject(reason: unknown): void;
|
231
|
+
}
|
232
|
+
|
233
|
+
declare class LogWriteStream implements WritableStreamDefaultWriter<Uint8Array> {
|
234
|
+
private readonly _bufferArr;
|
235
|
+
constructor(bufferArr: Uint8Array[]);
|
236
|
+
readonly _resolveClosed: Future<undefined>;
|
237
|
+
readonly closed: Promise<undefined>;
|
238
|
+
readonly desiredSize: number | null;
|
239
|
+
readonly ready: Promise<undefined>;
|
230
240
|
abort(reason?: any): Promise<void>;
|
231
241
|
close(): Promise<void>;
|
232
242
|
releaseLock(): void;
|
@@ -234,7 +244,10 @@ declare class LogWriter implements WritableStreamDefaultWriter<Uint8Array> {
|
|
234
244
|
}
|
235
245
|
declare class LogCollector implements WritableStream<Uint8Array> {
|
236
246
|
readonly locked: boolean;
|
237
|
-
_writer
|
247
|
+
private _writer?;
|
248
|
+
private readonly _pass?;
|
249
|
+
private readonly _bufferArr;
|
250
|
+
constructor(pass?: WritableStreamDefaultWriter<Uint8Array>);
|
238
251
|
abort(reason?: Uint8Array): Promise<void>;
|
239
252
|
close(): Promise<void>;
|
240
253
|
getWriter(): WritableStreamDefaultWriter<Uint8Array>;
|
@@ -247,6 +260,7 @@ interface MockLoggerReturn {
|
|
247
260
|
}
|
248
261
|
declare function MockLogger(params?: {
|
249
262
|
readonly sys?: SysAbstraction;
|
263
|
+
readonly pass?: WritableStreamDefaultWriter<Uint8Array>;
|
250
264
|
moduleName?: string | string[];
|
251
265
|
readonly disableDebug?: boolean;
|
252
266
|
}): MockLoggerReturn;
|
@@ -276,14 +290,6 @@ declare class None<T> extends Option<T> {
|
|
276
290
|
}
|
277
291
|
type WithoutOption<T> = T extends Option<infer U> ? U : T;
|
278
292
|
|
279
|
-
declare class Future<T> {
|
280
|
-
#private;
|
281
|
-
constructor();
|
282
|
-
asPromise(): Promise<T>;
|
283
|
-
resolve(value: T): void;
|
284
|
-
reject(reason: unknown): void;
|
285
|
-
}
|
286
|
-
|
287
293
|
interface ResolveSeqItem<T, C> {
|
288
294
|
readonly future: Future<T>;
|
289
295
|
readonly fn: (c: C) => Promise<T>;
|
@@ -409,4 +415,4 @@ interface CryptoRuntime {
|
|
409
415
|
}
|
410
416
|
declare function toCryptoRuntime(cryptoOpts?: Partial<CryptoRuntime>): CryptoRuntime;
|
411
417
|
|
412
|
-
export { type AsError, BuildURI, type CTAesKeyAlgorithm, type CTAlgorithm, type CTAlgorithmIdentifier, type CTArrayBufferView, type CTBufferSource, type CTCryptoKey, type CTEcKeyImportParams, type CTHmacImportParams, type CTJsonWebKey, type CTKeyFormat, type CTKeyType, type CTKeyUsage, type CTNamedCurve, type CTRsaHashedImportParams, type CoerceURI, type CryptoRuntime, type FnSerialized, Future, IsLogger, Keyed, KeyedResolvOnce, KeyedResolvSeq, type Lengthed, Level, type LevelHandler, LevelHandlerImpl, LogCollector, type LogSerializable, LogValue,
|
418
|
+
export { type AsError, BuildURI, type CTAesKeyAlgorithm, type CTAlgorithm, type CTAlgorithmIdentifier, type CTArrayBufferView, type CTBufferSource, type CTCryptoKey, type CTEcKeyImportParams, type CTHmacImportParams, type CTJsonWebKey, type CTKeyFormat, type CTKeyType, type CTKeyUsage, type CTNamedCurve, type CTRsaHashedImportParams, type CoerceURI, type CryptoRuntime, type FnSerialized, Future, IsLogger, Keyed, KeyedResolvOnce, KeyedResolvSeq, type Lengthed, Level, type LevelHandler, LevelHandlerImpl, LogCollector, type LogSerializable, LogValue, LogWriteStream, LogWriterStream, type Logger, LoggerImpl, type LoggerImplParams, type LoggerInterface, MockLogger, type MockLoggerReturn, None, Option, ResolveOnce, ResolveSeq, Result, ResultError, ResultOK, type Runtime, type Serialized, type SizeOrLength, type Sized, Some, SysAbstraction, URI, type WithLogger, type WithoutOption, type WithoutResult, asyncLogValue, isURL, logValue, removeSelfRef, runtimeFn, toCryptoRuntime };
|
package/index.js
CHANGED
@@ -1,27 +1,40 @@
|
|
1
|
+
import {
|
2
|
+
ConsoleWriterStream,
|
3
|
+
FanoutWriteStream,
|
4
|
+
utils_exports
|
5
|
+
} from "./chunk-AO7BGISE.js";
|
1
6
|
import {
|
2
7
|
WebSysAbstraction
|
3
|
-
} from "./chunk-
|
8
|
+
} from "./chunk-LJRKN3XI.js";
|
4
9
|
import {
|
10
|
+
BaseSysAbstraction,
|
5
11
|
BrowserEnvActions,
|
12
|
+
ConstTime,
|
6
13
|
EnvImpl,
|
7
14
|
Future,
|
8
15
|
IDMode,
|
16
|
+
IdService,
|
9
17
|
Keyed,
|
10
18
|
KeyedResolvOnce,
|
11
19
|
KeyedResolvSeq,
|
12
20
|
RandomMode,
|
21
|
+
RandomService,
|
13
22
|
ResolveOnce,
|
14
23
|
ResolveSeq,
|
24
|
+
StepTime,
|
15
25
|
String2TimeMode,
|
26
|
+
SysTime,
|
16
27
|
Time,
|
28
|
+
TimeFactory,
|
17
29
|
TimeMode,
|
18
30
|
TimeUnits,
|
31
|
+
WrapperSysAbstraction,
|
19
32
|
envFactory
|
20
|
-
} from "./chunk-
|
33
|
+
} from "./chunk-P4FB5FHU.js";
|
21
34
|
import {
|
22
35
|
__spreadValues,
|
23
36
|
__yieldStar
|
24
|
-
} from "./chunk-
|
37
|
+
} from "./chunk-I4NUGWZ6.js";
|
25
38
|
|
26
39
|
// src/logger.ts
|
27
40
|
var Level = /* @__PURE__ */ ((Level2) => {
|
@@ -299,7 +312,30 @@ var URI = class _URI {
|
|
299
312
|
}
|
300
313
|
};
|
301
314
|
|
302
|
-
// src/
|
315
|
+
// src/runtime.ts
|
316
|
+
function isSet(value, ref = globalThis) {
|
317
|
+
const [head, ...tail] = value.split(".");
|
318
|
+
if (["object", "function"].includes(typeof ref) && ref && ["object", "function"].includes(typeof ref[head]) && ref[head]) {
|
319
|
+
if (tail.length <= 1) {
|
320
|
+
return true;
|
321
|
+
}
|
322
|
+
return isSet(tail.join("."), ref[head]);
|
323
|
+
}
|
324
|
+
return false;
|
325
|
+
}
|
326
|
+
function runtimeFn() {
|
327
|
+
const isReactNative = isSet("navigator.product") && globalThis.navigator.product === "ReactNative";
|
328
|
+
const isNodeIsh = isSet("process.versions.node") && !isReactNative;
|
329
|
+
const isDeno = isSet("Deno") && !isReactNative;
|
330
|
+
return {
|
331
|
+
isNodeIsh,
|
332
|
+
isBrowser: !(isNodeIsh || isDeno) && !isReactNative,
|
333
|
+
isDeno,
|
334
|
+
isReactNative
|
335
|
+
};
|
336
|
+
}
|
337
|
+
|
338
|
+
// src/logger-impl.ts
|
303
339
|
var encoder = new TextEncoder();
|
304
340
|
var LevelHandlerImpl = class {
|
305
341
|
constructor() {
|
@@ -377,7 +413,7 @@ var LevelHandlerImpl = class {
|
|
377
413
|
}
|
378
414
|
};
|
379
415
|
var levelSingleton = new LevelHandlerImpl();
|
380
|
-
var
|
416
|
+
var LogWriterStream = class {
|
381
417
|
constructor(out) {
|
382
418
|
this._toFlush = [];
|
383
419
|
this._flushIsRunning = false;
|
@@ -459,9 +495,20 @@ var LoggerImpl = class _LoggerImpl {
|
|
459
495
|
this._logWriter = params.logWriter;
|
460
496
|
} else {
|
461
497
|
if (!params.out) {
|
462
|
-
|
498
|
+
const rt = runtimeFn();
|
499
|
+
let stream;
|
500
|
+
if (rt.isBrowser) {
|
501
|
+
stream = new ConsoleWriterStream();
|
502
|
+
} else {
|
503
|
+
if (rt.isNodeIsh || rt.isReactNative) {
|
504
|
+
stream = this._sys.Stdout();
|
505
|
+
} else {
|
506
|
+
throw new Error("No output defined for runtime");
|
507
|
+
}
|
508
|
+
}
|
509
|
+
this._logWriter = new LogWriterStream(stream);
|
463
510
|
} else {
|
464
|
-
this._logWriter = new
|
511
|
+
this._logWriter = new LogWriterStream(params.out);
|
465
512
|
}
|
466
513
|
}
|
467
514
|
if (!params.withAttributes) {
|
@@ -757,29 +804,26 @@ var WithLoggerBuilder = class {
|
|
757
804
|
}
|
758
805
|
};
|
759
806
|
|
760
|
-
// src/test/
|
761
|
-
var
|
762
|
-
constructor() {
|
763
|
-
this.
|
807
|
+
// src/test/log-write-stream.ts
|
808
|
+
var LogWriteStream = class {
|
809
|
+
constructor(bufferArr) {
|
810
|
+
this._resolveClosed = new Future();
|
811
|
+
this.closed = this._resolveClosed.asPromise();
|
764
812
|
this.desiredSize = null;
|
765
813
|
this.ready = Promise.resolve(void 0);
|
766
|
-
this.
|
767
|
-
};
|
768
|
-
this.closed = new Promise((resolve) => {
|
769
|
-
this._resolveClosed = resolve;
|
770
|
-
});
|
814
|
+
this._bufferArr = bufferArr;
|
771
815
|
}
|
772
816
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
773
817
|
abort(reason) {
|
774
818
|
throw new Error("Method not implemented.");
|
775
819
|
}
|
776
|
-
close() {
|
777
|
-
this.
|
820
|
+
async close() {
|
821
|
+
await this.closed;
|
778
822
|
return Promise.resolve(void 0);
|
779
823
|
}
|
780
824
|
releaseLock() {
|
781
825
|
}
|
782
|
-
write(chunk) {
|
826
|
+
async write(chunk) {
|
783
827
|
if (chunk) {
|
784
828
|
this._bufferArr.push(chunk);
|
785
829
|
}
|
@@ -787,8 +831,10 @@ var LogWriter2 = class {
|
|
787
831
|
}
|
788
832
|
};
|
789
833
|
var LogCollector = class {
|
790
|
-
constructor() {
|
834
|
+
constructor(pass) {
|
791
835
|
this.locked = false;
|
836
|
+
this._bufferArr = [];
|
837
|
+
this._pass = pass;
|
792
838
|
}
|
793
839
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
794
840
|
abort(reason) {
|
@@ -804,7 +850,11 @@ var LogCollector = class {
|
|
804
850
|
}
|
805
851
|
getWriter() {
|
806
852
|
if (!this._writer) {
|
807
|
-
|
853
|
+
const dests = [new LogWriteStream(this._bufferArr)];
|
854
|
+
if (this._pass) {
|
855
|
+
dests.push(this._pass);
|
856
|
+
}
|
857
|
+
this._writer = new FanoutWriteStream(dests);
|
808
858
|
}
|
809
859
|
return this._writer;
|
810
860
|
}
|
@@ -819,7 +869,7 @@ var LogCollector = class {
|
|
819
869
|
for (const x of res) {
|
820
870
|
yield* __yieldStar(x);
|
821
871
|
}
|
822
|
-
}(this.
|
872
|
+
}(this._bufferArr)
|
823
873
|
)
|
824
874
|
);
|
825
875
|
const splitStr = jsonNlStr.split("\n");
|
@@ -829,9 +879,9 @@ var LogCollector = class {
|
|
829
879
|
}
|
830
880
|
};
|
831
881
|
|
832
|
-
// src/test/
|
882
|
+
// src/test/mock-logger.ts
|
833
883
|
function MockLogger(params) {
|
834
|
-
const lc = new LogCollector();
|
884
|
+
const lc = new LogCollector(params == null ? void 0 : params.pass);
|
835
885
|
let modNames = ["MockLogger"];
|
836
886
|
if (typeof (params == null ? void 0 : params.moduleName) === "string") {
|
837
887
|
modNames = [params == null ? void 0 : params.moduleName];
|
@@ -974,29 +1024,6 @@ var None = class extends Option {
|
|
974
1024
|
}
|
975
1025
|
};
|
976
1026
|
|
977
|
-
// src/runtime.ts
|
978
|
-
function isSet(value, ref = globalThis) {
|
979
|
-
const [head, ...tail] = value.split(".");
|
980
|
-
if (["object", "function"].includes(typeof ref) && ref && ["object", "function"].includes(typeof ref[head]) && ref[head]) {
|
981
|
-
if (tail.length <= 1) {
|
982
|
-
return true;
|
983
|
-
}
|
984
|
-
return isSet(tail.join("."), ref[head]);
|
985
|
-
}
|
986
|
-
return false;
|
987
|
-
}
|
988
|
-
function runtimeFn() {
|
989
|
-
const isReactNative = isSet("navigator.product") && globalThis.navigator.product === "ReactNative";
|
990
|
-
const isNodeIsh = isSet("process.versions.node") && !isReactNative;
|
991
|
-
const isDeno = isSet("Deno") && !isReactNative;
|
992
|
-
return {
|
993
|
-
isNodeIsh,
|
994
|
-
isBrowser: !(isNodeIsh || isDeno) && !isReactNative,
|
995
|
-
isDeno,
|
996
|
-
isReactNative
|
997
|
-
};
|
998
|
-
}
|
999
|
-
|
1000
1027
|
// src/crypto.ts
|
1001
1028
|
function randomBytes(size) {
|
1002
1029
|
const bytes = new Uint8Array(size);
|
@@ -1019,11 +1046,14 @@ function toCryptoRuntime(cryptoOpts = {}) {
|
|
1019
1046
|
return runtime;
|
1020
1047
|
}
|
1021
1048
|
export {
|
1049
|
+
BaseSysAbstraction,
|
1022
1050
|
BrowserEnvActions,
|
1023
1051
|
BuildURI,
|
1052
|
+
ConstTime,
|
1024
1053
|
EnvImpl,
|
1025
1054
|
Future,
|
1026
1055
|
IDMode,
|
1056
|
+
IdService,
|
1027
1057
|
IsLogger,
|
1028
1058
|
Keyed,
|
1029
1059
|
KeyedResolvOnce,
|
@@ -1032,29 +1062,36 @@ export {
|
|
1032
1062
|
LevelHandlerImpl,
|
1033
1063
|
LogCollector,
|
1034
1064
|
LogValue,
|
1035
|
-
|
1065
|
+
LogWriteStream,
|
1066
|
+
LogWriterStream,
|
1036
1067
|
LoggerImpl,
|
1037
1068
|
MockLogger,
|
1038
1069
|
None,
|
1039
1070
|
Option,
|
1040
1071
|
RandomMode,
|
1072
|
+
RandomService,
|
1041
1073
|
ResolveOnce,
|
1042
1074
|
ResolveSeq,
|
1043
1075
|
Result,
|
1044
1076
|
ResultError,
|
1045
1077
|
ResultOK,
|
1046
1078
|
Some,
|
1079
|
+
StepTime,
|
1047
1080
|
String2TimeMode,
|
1081
|
+
SysTime,
|
1048
1082
|
Time,
|
1083
|
+
TimeFactory,
|
1049
1084
|
TimeMode,
|
1050
1085
|
TimeUnits,
|
1051
1086
|
URI,
|
1087
|
+
WrapperSysAbstraction,
|
1052
1088
|
asyncLogValue,
|
1053
1089
|
envFactory,
|
1054
1090
|
isURL,
|
1055
1091
|
logValue,
|
1056
1092
|
removeSelfRef,
|
1057
1093
|
runtimeFn,
|
1058
|
-
toCryptoRuntime
|
1094
|
+
toCryptoRuntime,
|
1095
|
+
utils_exports as utils
|
1059
1096
|
};
|
1060
1097
|
//# sourceMappingURL=index.js.map
|