@adviser/cement 0.2.27 → 0.2.29
Sign up to get free protection for your applications and to get access to all the features.
- package/{base-sys-abstraction-C9WW3w57.d.cts → base-sys-abstraction-BkEiLHl0.d.ts} +8 -4
- package/{base-sys-abstraction-C9WW3w57.d.ts → base-sys-abstraction-Qj7pkY1N.d.cts} +8 -4
- package/{chunk-OXD3YZZ7.js → chunk-7KFVMTOS.js} +3 -47
- package/chunk-7KFVMTOS.js.map +1 -0
- package/{chunk-P5RXA4C4.js → chunk-GES3MUGV.js} +24 -27
- package/{chunk-LCPYQVWT.js.map → chunk-GES3MUGV.js.map} +1 -1
- package/{chunk-YDIUMYIE.js → chunk-Q65HLCNL.js} +8 -7
- package/chunk-Q65HLCNL.js.map +1 -0
- package/{chunk-DPIL5UIL.js → chunk-WMMUXBDX.js} +6 -2
- package/chunk-WMMUXBDX.js.map +1 -0
- package/{index-Dhb2fQiw.d.cts → index-Q3phXzYr.d.cts} +2 -21
- package/{index-CcsGcehs.d.ts → index-tIGZMHTc.d.ts} +2 -21
- package/index.cjs +265 -7343
- package/index.cjs.map +1 -1
- package/index.d.cts +73 -12
- package/index.d.ts +73 -12
- package/index.js +218 -7265
- package/index.js.map +1 -1
- package/node/index.cjs +220 -39
- package/node/index.cjs.map +1 -1
- package/node/index.d.cts +22 -4
- package/node/index.d.ts +22 -4
- package/node/index.js +201 -25
- package/node/index.js.map +1 -1
- package/package.json +23 -12
- package/src/LICENSE +201 -0
- package/src/README.md +39 -0
- package/src/base-sys-abstraction.test.ts +95 -0
- package/src/base-sys-abstraction.ts +242 -0
- package/src/bin2text.test.ts +59 -0
- package/src/bin2text.ts +47 -0
- package/src/crypto.test.ts +15 -0
- package/src/crypto.ts +125 -0
- package/src/file-service.ts +24 -0
- package/src/future.test.ts +32 -0
- package/src/future.ts +27 -0
- package/src/index.ts +22 -0
- package/src/jsr.json +20 -0
- package/src/log-level-impl.ts +87 -0
- package/src/log-writer-impl.ts +58 -0
- package/src/logger-impl.ts +498 -0
- package/src/logger.test.ts +1132 -0
- package/src/logger.ts +208 -0
- package/src/node/deno-file-service.ts +92 -0
- package/src/node/deno-sys-abstraction.ts +133 -0
- package/src/node/index.ts +4 -0
- package/src/node/mock-file-service.ts +45 -0
- package/src/node/node-file-service.ts +91 -0
- package/src/node/node-sys-abstraction.ts +121 -0
- package/src/option.ts +60 -0
- package/src/resolve-once.test.ts +321 -0
- package/src/resolve-once.ts +179 -0
- package/src/result.test.ts +102 -0
- package/src/result.ts +165 -0
- package/src/runtime.ts +36 -0
- package/src/sys-abstraction.ts +53 -0
- package/src/sys-env.test.ts +53 -0
- package/src/sys-env.ts +216 -0
- package/src/test/log-write-stream.ts +95 -0
- package/src/test/mock-logger.ts +40 -0
- package/src/time.ts +20 -0
- package/src/tracer.test.ts +314 -0
- package/src/tracer.ts +222 -0
- package/src/txt-en-decoder.ts +21 -0
- package/src/uri.test.ts +155 -0
- package/src/uri.ts +421 -0
- package/src/utils/console-write-stream.ts +72 -0
- package/src/utils/fanout-write-stream.ts +32 -0
- package/src/utils/index.ts +6 -0
- package/src/utils/rebuffer.ts +75 -0
- package/src/utils/stream-map.ts +67 -0
- package/src/utils/stream2string.ts +47 -0
- package/src/utils/string2stream.ts +14 -0
- package/src/version.ts +3 -0
- package/src/web/index.ts +1 -0
- package/src/web/web-sys-abstraction.ts +80 -0
- package/ts/base-sys-abstraction.d.ts +84 -0
- package/ts/base-sys-abstraction.d.ts.map +1 -0
- package/ts/base-sys-abstraction.js +178 -0
- package/ts/base-sys-abstraction.js.map +1 -0
- package/ts/base-sys-abstraction.test.d.ts +2 -0
- package/ts/base-sys-abstraction.test.d.ts.map +1 -0
- package/ts/base-sys-abstraction.test.js +82 -0
- package/ts/base-sys-abstraction.test.js.map +1 -0
- package/ts/bin2text.d.ts +3 -0
- package/ts/bin2text.d.ts.map +1 -0
- package/ts/bin2text.js +43 -0
- package/ts/bin2text.js.map +1 -0
- package/ts/bin2text.test.d.ts +2 -0
- package/ts/bin2text.test.d.ts.map +1 -0
- package/ts/bin2text.test.js +51 -0
- package/ts/bin2text.test.js.map +1 -0
- package/ts/crypto.d.ts +76 -0
- package/ts/crypto.d.ts.map +1 -0
- package/ts/crypto.js +22 -0
- package/ts/crypto.js.map +1 -0
- package/ts/crypto.test.d.ts +2 -0
- package/ts/crypto.test.d.ts.map +1 -0
- package/ts/crypto.test.js +14 -0
- package/ts/crypto.test.js.map +1 -0
- package/ts/file-service.d.ts +17 -0
- package/ts/file-service.d.ts.map +1 -0
- package/ts/file-service.js +2 -0
- package/ts/file-service.js.map +1 -0
- package/ts/future.d.ts +8 -0
- package/ts/future.d.ts.map +1 -0
- package/ts/future.js +38 -0
- package/ts/future.js.map +1 -0
- package/ts/future.test.d.ts +2 -0
- package/ts/future.test.d.ts.map +1 -0
- package/ts/future.test.js +28 -0
- package/ts/future.test.js.map +1 -0
- package/ts/index.d.ts +23 -0
- package/ts/index.d.ts.map +1 -0
- package/ts/index.js +23 -0
- package/ts/index.js.map +1 -0
- package/ts/log-level-impl.d.ts +14 -0
- package/ts/log-level-impl.d.ts.map +1 -0
- package/ts/log-level-impl.js +72 -0
- package/ts/log-level-impl.js.map +1 -0
- package/ts/log-writer-impl.d.ts +10 -0
- package/ts/log-writer-impl.d.ts.map +1 -0
- package/ts/log-writer-impl.js +45 -0
- package/ts/log-writer-impl.js.map +1 -0
- package/ts/logger-impl.d.ts +71 -0
- package/ts/logger-impl.d.ts.map +1 -0
- package/ts/logger-impl.js +412 -0
- package/ts/logger-impl.js.map +1 -0
- package/ts/logger.d.ts +84 -0
- package/ts/logger.d.ts.map +1 -0
- package/ts/logger.js +114 -0
- package/ts/logger.js.map +1 -0
- package/ts/logger.test.d.ts +2 -0
- package/ts/logger.test.d.ts.map +1 -0
- package/ts/logger.test.js +1023 -0
- package/ts/logger.test.js.map +1 -0
- package/ts/node/deno-file-service.d.ts +17 -0
- package/ts/node/deno-file-service.d.ts.map +1 -0
- package/ts/node/deno-file-service.js +65 -0
- package/ts/node/deno-file-service.js.map +1 -0
- package/ts/node/deno-sys-abstraction.d.ts +22 -0
- package/ts/node/deno-sys-abstraction.d.ts.map +1 -0
- package/ts/node/deno-sys-abstraction.js +101 -0
- package/ts/node/deno-sys-abstraction.js.map +1 -0
- package/ts/node/index.d.ts +5 -0
- package/ts/node/index.d.ts.map +1 -0
- package/ts/node/index.js +5 -0
- package/ts/node/index.js.map +1 -0
- package/ts/node/mock-file-service.d.ts +11 -0
- package/ts/node/mock-file-service.d.ts.map +1 -0
- package/ts/node/mock-file-service.js +34 -0
- package/ts/node/mock-file-service.js.map +1 -0
- package/ts/node/mock-file-service.test.d.ts +2 -0
- package/ts/node/mock-file-service.test.d.ts.map +1 -0
- package/ts/node/mock-file-service.test.js +31 -0
- package/ts/node/mock-file-service.test.js.map +1 -0
- package/ts/node/node-file-service.d.ts +16 -0
- package/ts/node/node-file-service.d.ts.map +1 -0
- package/ts/node/node-file-service.js +71 -0
- package/ts/node/node-file-service.js.map +1 -0
- package/ts/node/node-sys-abstraction.d.ts +22 -0
- package/ts/node/node-sys-abstraction.d.ts.map +1 -0
- package/ts/node/node-sys-abstraction.js +99 -0
- package/ts/node/node-sys-abstraction.js.map +1 -0
- package/ts/node/node-sys-abstraction.test.d.ts +2 -0
- package/ts/node/node-sys-abstraction.test.d.ts.map +1 -0
- package/ts/node/node-sys-abstraction.test.js +87 -0
- package/ts/node/node-sys-abstraction.test.js.map +1 -0
- package/ts/option.d.ts +25 -0
- package/ts/option.d.ts.map +1 -0
- package/ts/option.js +47 -0
- package/ts/option.js.map +1 -0
- package/ts/resolve-once.d.ts +46 -0
- package/ts/resolve-once.d.ts.map +1 -0
- package/ts/resolve-once.js +152 -0
- package/ts/resolve-once.js.map +1 -0
- package/ts/resolve-once.test.d.ts +2 -0
- package/ts/resolve-once.test.d.ts.map +1 -0
- package/ts/resolve-once.test.js +283 -0
- package/ts/resolve-once.test.js.map +1 -0
- package/ts/result.d.ts +34 -0
- package/ts/result.d.ts.map +1 -0
- package/ts/result.js +85 -0
- package/ts/result.js.map +1 -0
- package/ts/result.test.d.ts +2 -0
- package/ts/result.test.d.ts.map +1 -0
- package/ts/result.test.js +79 -0
- package/ts/result.test.js.map +1 -0
- package/ts/runtime.d.ts +8 -0
- package/ts/runtime.d.ts.map +1 -0
- package/ts/runtime.js +26 -0
- package/ts/runtime.js.map +1 -0
- package/ts/sys-abstraction.d.ts +36 -0
- package/ts/sys-abstraction.d.ts.map +1 -0
- package/ts/sys-abstraction.js +31 -0
- package/ts/sys-abstraction.js.map +1 -0
- package/ts/sys-env.d.ts +48 -0
- package/ts/sys-env.d.ts.map +1 -0
- package/ts/sys-env.js +176 -0
- package/ts/sys-env.js.map +1 -0
- package/ts/sys-env.test.d.ts +2 -0
- package/ts/sys-env.test.d.ts.map +1 -0
- package/ts/sys-env.test.js +51 -0
- package/ts/sys-env.test.js.map +1 -0
- package/ts/test/log-write-stream.d.ts +27 -0
- package/ts/test/log-write-stream.d.ts.map +1 -0
- package/ts/test/log-write-stream.js +74 -0
- package/ts/test/log-write-stream.js.map +1 -0
- package/ts/test/mock-logger.d.ts +14 -0
- package/ts/test/mock-logger.d.ts.map +1 -0
- package/ts/test/mock-logger.js +29 -0
- package/ts/test/mock-logger.js.map +1 -0
- package/ts/test/mock-logger.test.d.ts +2 -0
- package/ts/test/mock-logger.test.d.ts.map +1 -0
- package/ts/test/mock-logger.test.js +63 -0
- package/ts/test/mock-logger.test.js.map +1 -0
- package/ts/test/test-exit-handler.d.ts +2 -0
- package/ts/test/test-exit-handler.d.ts.map +1 -0
- package/ts/test/test-exit-handler.js +57 -0
- package/ts/test/test-exit-handler.js.map +1 -0
- package/ts/time.d.ts +13 -0
- package/ts/time.d.ts.map +1 -0
- package/ts/time.js +14 -0
- package/ts/time.js.map +1 -0
- package/ts/tracer.d.ts +59 -0
- package/ts/tracer.d.ts.map +1 -0
- package/ts/tracer.js +148 -0
- package/ts/tracer.js.map +1 -0
- package/ts/tracer.test.d.ts +2 -0
- package/ts/tracer.test.d.ts.map +1 -0
- package/ts/tracer.test.js +311 -0
- package/ts/tracer.test.js.map +1 -0
- package/ts/txt-en-decoder.d.ts +10 -0
- package/ts/txt-en-decoder.d.ts.map +1 -0
- package/ts/txt-en-decoder.js +15 -0
- package/ts/txt-en-decoder.js.map +1 -0
- package/ts/uri.d.ts +67 -0
- package/ts/uri.d.ts.map +1 -0
- package/ts/uri.js +283 -0
- package/ts/uri.js.map +1 -0
- package/ts/uri.test.d.ts +2 -0
- package/ts/uri.test.d.ts.map +1 -0
- package/ts/uri.test.js +119 -0
- package/ts/uri.test.js.map +1 -0
- package/ts/utils/console-write-stream.d.ts +21 -0
- package/ts/utils/console-write-stream.d.ts.map +1 -0
- package/ts/utils/console-write-stream.js +62 -0
- package/ts/utils/console-write-stream.js.map +1 -0
- package/ts/utils/fanout-write-stream.d.ts +12 -0
- package/ts/utils/fanout-write-stream.d.ts.map +1 -0
- package/ts/utils/fanout-write-stream.js +24 -0
- package/ts/utils/fanout-write-stream.js.map +1 -0
- package/ts/utils/index.d.ts +7 -0
- package/ts/utils/index.d.ts.map +1 -0
- package/ts/utils/index.js +7 -0
- package/ts/utils/index.js.map +1 -0
- package/ts/utils/rebuffer.d.ts +3 -0
- package/ts/utils/rebuffer.d.ts.map +1 -0
- package/ts/utils/rebuffer.js +60 -0
- package/ts/utils/rebuffer.js.map +1 -0
- package/ts/utils/rebuffer.test.d.ts +2 -0
- package/ts/utils/rebuffer.test.d.ts.map +1 -0
- package/ts/utils/rebuffer.test.js +77 -0
- package/ts/utils/rebuffer.test.js.map +1 -0
- package/ts/utils/stream-map.d.ts +9 -0
- package/ts/utils/stream-map.d.ts.map +1 -0
- package/ts/utils/stream-map.js +62 -0
- package/ts/utils/stream-map.js.map +1 -0
- package/ts/utils/stream-map.test.d.ts +2 -0
- package/ts/utils/stream-map.test.d.ts.map +1 -0
- package/ts/utils/stream-map.test.js +87 -0
- package/ts/utils/stream-map.test.js.map +1 -0
- package/ts/utils/stream-test-helper.d.ts +17 -0
- package/ts/utils/stream-test-helper.d.ts.map +1 -0
- package/ts/utils/stream-test-helper.js +37 -0
- package/ts/utils/stream-test-helper.js.map +1 -0
- package/ts/utils/stream2string.d.ts +3 -0
- package/ts/utils/stream2string.d.ts.map +1 -0
- package/ts/utils/stream2string.js +48 -0
- package/ts/utils/stream2string.js.map +1 -0
- package/ts/utils/stream2string.test.d.ts +2 -0
- package/ts/utils/stream2string.test.d.ts.map +1 -0
- package/ts/utils/stream2string.test.js +29 -0
- package/ts/utils/stream2string.test.js.map +1 -0
- package/ts/utils/string2stream.d.ts +4 -0
- package/ts/utils/string2stream.d.ts.map +1 -0
- package/ts/utils/string2stream.js +13 -0
- package/ts/utils/string2stream.js.map +1 -0
- package/ts/utils/string2stream.test.d.ts +2 -0
- package/ts/utils/string2stream.test.d.ts.map +1 -0
- package/ts/utils/string2stream.test.js +6 -0
- package/ts/utils/string2stream.test.js.map +1 -0
- package/ts/version.d.ts +2 -0
- package/ts/version.d.ts.map +1 -0
- package/ts/version.js +4 -0
- package/ts/version.js.map +1 -0
- package/ts/web/index.d.ts +2 -0
- package/ts/web/index.d.ts.map +1 -0
- package/ts/web/index.js +2 -0
- package/ts/web/index.js.map +1 -0
- package/ts/web/web-sys-abstraction.d.ts +4 -0
- package/ts/web/web-sys-abstraction.d.ts.map +1 -0
- package/ts/web/web-sys-abstraction.js +64 -0
- package/ts/web/web-sys-abstraction.js.map +1 -0
- package/utils/index.cjs +0 -42
- package/utils/index.cjs.map +1 -1
- package/utils/index.d.cts +1 -2
- package/utils/index.d.ts +1 -2
- package/utils/index.js +2 -7
- package/web/index.cjs +25 -7
- package/web/index.cjs.map +1 -1
- package/web/index.d.cts +2 -1
- package/web/index.d.ts +2 -1
- package/web/index.js +3 -3
- package/chunk-DPIL5UIL.js.map +0 -1
- package/chunk-LCPYQVWT.js +0 -21
- package/chunk-OXD3YZZ7.js.map +0 -1
- package/chunk-P5RXA4C4.js.map +0 -1
- package/chunk-YDIUMYIE.js.map +0 -1
package/ts/crypto.d.ts
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
export interface CTJsonWebKey {
|
2
|
+
alg?: string;
|
3
|
+
crv?: string;
|
4
|
+
d?: string;
|
5
|
+
dp?: string;
|
6
|
+
dq?: string;
|
7
|
+
e?: string;
|
8
|
+
ext?: boolean;
|
9
|
+
k?: string;
|
10
|
+
key_ops?: string[];
|
11
|
+
kty?: string;
|
12
|
+
n?: string;
|
13
|
+
oth?: RsaOtherPrimesInfo[];
|
14
|
+
p?: string;
|
15
|
+
q?: string;
|
16
|
+
qi?: string;
|
17
|
+
use?: string;
|
18
|
+
x?: string;
|
19
|
+
y?: string;
|
20
|
+
}
|
21
|
+
export type CTKeyFormat = "jwk" | "pkcs8" | "raw" | "spki";
|
22
|
+
export type CTKeyUsage = "decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey";
|
23
|
+
export interface CTAlgorithm {
|
24
|
+
name: string;
|
25
|
+
}
|
26
|
+
export type CTAlgorithmIdentifier = CTAlgorithm | string;
|
27
|
+
export interface CTRsaHashedImportParams extends CTAlgorithm {
|
28
|
+
hash: CTAlgorithmIdentifier;
|
29
|
+
}
|
30
|
+
export type CTNamedCurve = string;
|
31
|
+
export interface CTEcKeyImportParams extends CTAlgorithm {
|
32
|
+
namedCurve: CTNamedCurve;
|
33
|
+
}
|
34
|
+
export interface CTHmacImportParams extends CTAlgorithm {
|
35
|
+
hash: CTAlgorithmIdentifier;
|
36
|
+
length?: number;
|
37
|
+
}
|
38
|
+
export interface CTAesKeyAlgorithm extends CTAlgorithm {
|
39
|
+
length: number;
|
40
|
+
}
|
41
|
+
export type CTKeyType = "private" | "public" | "secret";
|
42
|
+
export interface CTCryptoKey {
|
43
|
+
readonly algorithm: CTAlgorithm;
|
44
|
+
readonly extractable: boolean;
|
45
|
+
readonly type: CTKeyType;
|
46
|
+
readonly usages: CTKeyUsage[];
|
47
|
+
}
|
48
|
+
interface CTArrayBufferTypes {
|
49
|
+
ArrayBuffer: ArrayBuffer;
|
50
|
+
}
|
51
|
+
type CTArrayBufferLike = CTArrayBufferTypes[keyof CTArrayBufferTypes];
|
52
|
+
export interface CTArrayBufferView {
|
53
|
+
buffer: CTArrayBufferLike;
|
54
|
+
byteLength: number;
|
55
|
+
byteOffset: number;
|
56
|
+
}
|
57
|
+
export type CTBufferSource = CTArrayBufferView | ArrayBuffer;
|
58
|
+
export interface CryptoRuntime {
|
59
|
+
importKey(format: CTKeyFormat, keyData: CTJsonWebKey | CTBufferSource, algorithm: CTAlgorithmIdentifier | CTRsaHashedImportParams | CTEcKeyImportParams | CTHmacImportParams | CTAesKeyAlgorithm, extractable: boolean, keyUsages: CTKeyUsage[]): Promise<CTCryptoKey>;
|
60
|
+
exportKey(format: CTKeyFormat, key: CTCryptoKey): Promise<CTJsonWebKey | ArrayBuffer>;
|
61
|
+
decrypt(algo: {
|
62
|
+
name: string;
|
63
|
+
iv: Uint8Array;
|
64
|
+
tagLength: number;
|
65
|
+
}, key: CTCryptoKey, data: Uint8Array): Promise<ArrayBuffer>;
|
66
|
+
encrypt(algo: {
|
67
|
+
name: string;
|
68
|
+
iv: Uint8Array;
|
69
|
+
tagLength: number;
|
70
|
+
}, key: CTCryptoKey, data: Uint8Array): Promise<ArrayBuffer>;
|
71
|
+
digestSHA256(data: Uint8Array): Promise<ArrayBuffer>;
|
72
|
+
randomBytes(size: number): Uint8Array;
|
73
|
+
}
|
74
|
+
export declare function toCryptoRuntime(cryptoOpts?: Partial<CryptoRuntime>): CryptoRuntime;
|
75
|
+
export {};
|
76
|
+
//# sourceMappingURL=crypto.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src/crypto.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,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I,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,UAAU,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC7H,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACrD,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;CACvC;AAcD,wBAAgB,eAAe,CAAC,UAAU,GAAE,OAAO,CAAC,aAAa,CAAM,GAAG,aAAa,CAWtF"}
|
package/ts/crypto.js
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
function randomBytes(size) {
|
2
|
+
const bytes = new Uint8Array(size);
|
3
|
+
if (size > 0) {
|
4
|
+
crypto.getRandomValues(bytes);
|
5
|
+
}
|
6
|
+
return bytes;
|
7
|
+
}
|
8
|
+
function digestSHA256(data) {
|
9
|
+
return Promise.resolve(crypto.subtle.digest("SHA-256", data));
|
10
|
+
}
|
11
|
+
export function toCryptoRuntime(cryptoOpts = {}) {
|
12
|
+
const runtime = {
|
13
|
+
importKey: cryptoOpts.importKey || crypto.subtle.importKey.bind(crypto.subtle),
|
14
|
+
exportKey: cryptoOpts.exportKey || crypto.subtle.exportKey.bind(crypto.subtle),
|
15
|
+
encrypt: cryptoOpts.encrypt || crypto.subtle.encrypt.bind(crypto.subtle),
|
16
|
+
decrypt: cryptoOpts.decrypt || crypto.subtle.decrypt.bind(crypto.subtle),
|
17
|
+
randomBytes: cryptoOpts.randomBytes || randomBytes,
|
18
|
+
digestSHA256: cryptoOpts.digestSHA256 || digestSHA256,
|
19
|
+
};
|
20
|
+
return runtime;
|
21
|
+
}
|
22
|
+
//# sourceMappingURL=crypto.js.map
|
package/ts/crypto.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../src/crypto.ts"],"names":[],"mappings":"AAqGA,SAAS,WAAW,CAAC,IAAY;IAC/B,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC;QACb,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,YAAY,CAAC,IAAgB;IACpC,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,aAAqC,EAAE;IACrE,MAAM,OAAO,GAAG;QACd,SAAS,EAAE,UAAU,CAAC,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QAC9E,SAAS,EAAE,UAAU,CAAC,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QAC9E,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QACxE,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QACxE,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,WAAW;QAClD,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,YAAY;KACtD,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"crypto.test.d.ts","sourceRoot":"","sources":["../../src/crypto.test.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { toCryptoRuntime } from "./crypto.js";
|
2
|
+
it("not extractable import -> export", async () => {
|
3
|
+
const cp = toCryptoRuntime();
|
4
|
+
const key = cp.randomBytes(32);
|
5
|
+
const x = await cp.importKey("raw", key, "AES-CBC", false, ["encrypt"]);
|
6
|
+
expect(cp.exportKey("raw", x)).rejects.toThrowError(/key is not extractable/i);
|
7
|
+
});
|
8
|
+
it("extractable import -> export", async () => {
|
9
|
+
const cp = toCryptoRuntime();
|
10
|
+
const key = cp.randomBytes(32);
|
11
|
+
const x = await cp.importKey("raw", key, "AES-CBC", true, ["encrypt"]);
|
12
|
+
expect(new Uint8Array((await cp.exportKey("raw", x)))).toEqual(key);
|
13
|
+
});
|
14
|
+
//# sourceMappingURL=crypto.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"crypto.test.js","sourceRoot":"","sources":["../../src/crypto.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,EAAE,CAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;IAChD,MAAM,EAAE,GAAG,eAAe,EAAE,CAAC;IAC7B,MAAM,GAAG,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAC/B,MAAM,CAAC,GAAG,MAAM,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IACxE,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,yBAAyB,CAAC,CAAC;AACjF,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,8BAA8B,EAAE,KAAK,IAAI,EAAE;IAC5C,MAAM,EAAE,GAAG,eAAe,EAAE,CAAC;IAC7B,MAAM,GAAG,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAC/B,MAAM,CAAC,GAAG,MAAM,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IACvE,MAAM,CAAC,IAAI,UAAU,CAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,CAAgB,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AACrF,CAAC,CAAC,CAAC"}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
export interface NamedWritableStream {
|
2
|
+
readonly name: string;
|
3
|
+
readonly stream: WritableStream<Uint8Array>;
|
4
|
+
}
|
5
|
+
export interface FileService {
|
6
|
+
readonly baseDir: string;
|
7
|
+
create(fname: string): Promise<NamedWritableStream>;
|
8
|
+
readFileString(fname: string): Promise<string>;
|
9
|
+
writeFileString(fname: string, content: string): Promise<void>;
|
10
|
+
abs(fname: string): string;
|
11
|
+
join(...paths: string[]): string;
|
12
|
+
relative(from: string, to?: string): string;
|
13
|
+
dirname(fname: string): string;
|
14
|
+
basename(fname: string): string;
|
15
|
+
isAbsolute(fname: string): boolean;
|
16
|
+
}
|
17
|
+
//# sourceMappingURL=file-service.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"file-service.d.ts","sourceRoot":"","sources":["../../src/file-service.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACpD,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/C,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/D,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAE3B,IAAI,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAEjC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE5C,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAIhC,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CACpC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"file-service.js","sourceRoot":"","sources":["../../src/file-service.ts"],"names":[],"mappings":""}
|
package/ts/future.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"future.d.ts","sourceRoot":"","sources":["../../src/future.ts"],"names":[],"mappings":"AAAA,qBAAa,MAAM,CAAC,CAAC;;;IAgBb,SAAS,IAAI,OAAO,CAAC,CAAC,CAAC;IAI7B,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI;IAGvB,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;CAG9B"}
|
package/ts/future.js
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
6
|
+
};
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
11
|
+
};
|
12
|
+
var _Future_promise, _Future_resolveFn, _Future_rejectFn;
|
13
|
+
export class Future {
|
14
|
+
constructor() {
|
15
|
+
_Future_promise.set(this, void 0);
|
16
|
+
_Future_resolveFn.set(this, () => {
|
17
|
+
throw new Error("This Promise is not working as expected.");
|
18
|
+
});
|
19
|
+
_Future_rejectFn.set(this, () => {
|
20
|
+
throw new Error("This Promise is not working as expected.");
|
21
|
+
});
|
22
|
+
__classPrivateFieldSet(this, _Future_promise, new Promise((resolve, reject) => {
|
23
|
+
__classPrivateFieldSet(this, _Future_resolveFn, resolve, "f");
|
24
|
+
__classPrivateFieldSet(this, _Future_rejectFn, reject, "f");
|
25
|
+
}), "f");
|
26
|
+
}
|
27
|
+
async asPromise() {
|
28
|
+
return __classPrivateFieldGet(this, _Future_promise, "f");
|
29
|
+
}
|
30
|
+
resolve(value) {
|
31
|
+
__classPrivateFieldGet(this, _Future_resolveFn, "f").call(this, value);
|
32
|
+
}
|
33
|
+
reject(reason) {
|
34
|
+
__classPrivateFieldGet(this, _Future_rejectFn, "f").call(this, reason);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
_Future_promise = new WeakMap(), _Future_resolveFn = new WeakMap(), _Future_rejectFn = new WeakMap();
|
38
|
+
//# sourceMappingURL=future.js.map
|
package/ts/future.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"future.js","sourceRoot":"","sources":["../../src/future.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,MAAM,OAAO,MAAM;IASjB;QARS,kCAAqB;QAC9B,4BAAiC,GAAG,EAAE;YACpC,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC,EAAC;QACF,2BAAuC,GAAG,EAAE;YAC1C,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC,EAAC;QAGA,uBAAA,IAAI,mBAAY,IAAI,OAAO,CAAI,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACjD,uBAAA,IAAI,qBAAc,OAAO,MAAA,CAAC;YAC1B,uBAAA,IAAI,oBAAa,MAAM,MAAA,CAAC;QAC1B,CAAC,CAAC,MAAA,CAAC;IACL,CAAC;IAED,KAAK,CAAC,SAAS;QACb,OAAO,uBAAA,IAAI,uBAAS,CAAC;IACvB,CAAC;IAED,OAAO,CAAC,KAAQ;QACd,uBAAA,IAAI,yBAAW,MAAf,IAAI,EAAY,KAAK,CAAC,CAAC;IACzB,CAAC;IACD,MAAM,CAAC,MAAe;QACpB,uBAAA,IAAI,wBAAU,MAAd,IAAI,EAAW,MAAM,CAAC,CAAC;IACzB,CAAC;CACF"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"future.test.d.ts","sourceRoot":"","sources":["../../src/future.test.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { Future } from "@adviser/cement";
|
2
|
+
it("Create Future Happy", async () => {
|
3
|
+
const future = new Future();
|
4
|
+
const promise = future.asPromise();
|
5
|
+
expect(promise).toBeInstanceOf(Promise);
|
6
|
+
const asynced = new Promise((resolve, reject) => {
|
7
|
+
promise.then(resolve).catch(reject);
|
8
|
+
});
|
9
|
+
future.resolve("Hello World");
|
10
|
+
expect(await asynced).toBe("Hello World");
|
11
|
+
});
|
12
|
+
it("Create Future Sad", async () => {
|
13
|
+
const future = new Future();
|
14
|
+
const promise = future.asPromise();
|
15
|
+
expect(promise).toBeInstanceOf(Promise);
|
16
|
+
const asynced = new Promise((resolve, reject) => {
|
17
|
+
promise.then(resolve).catch(reject);
|
18
|
+
});
|
19
|
+
future.reject("Sad World");
|
20
|
+
try {
|
21
|
+
await asynced;
|
22
|
+
expect("Why").toBe("Sad World");
|
23
|
+
}
|
24
|
+
catch (error) {
|
25
|
+
expect(error).toBe("Sad World");
|
26
|
+
}
|
27
|
+
});
|
28
|
+
//# sourceMappingURL=future.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"future.test.js","sourceRoot":"","sources":["../../src/future.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,EAAE,CAAC,qBAAqB,EAAE,KAAK,IAAI,EAAE;IACnC,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;IAC5B,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;IACnC,MAAM,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAExC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC9C,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAE9B,MAAM,CAAC,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AAC5C,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,mBAAmB,EAAE,KAAK,IAAI,EAAE;IACjC,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;IAC5B,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;IACnC,MAAM,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAExC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC9C,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAE3B,IAAI,CAAC;QACH,MAAM,OAAO,CAAC;QACd,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAClC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAClC,CAAC;AACH,CAAC,CAAC,CAAC"}
|
package/ts/index.d.ts
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
export * from "./file-service.js";
|
2
|
+
export * from "./logger-impl.js";
|
3
|
+
export * from "./logger.js";
|
4
|
+
export * from "./sys-abstraction.js";
|
5
|
+
export * from "./sys-env.js";
|
6
|
+
export * from "./time.js";
|
7
|
+
export * from "./test/log-write-stream.js";
|
8
|
+
export * from "./test/mock-logger.js";
|
9
|
+
export * from "./txt-en-decoder.js";
|
10
|
+
export * from "./log-level-impl.js";
|
11
|
+
export * from "./result.js";
|
12
|
+
export * from "./option.js";
|
13
|
+
export * from "./future.js";
|
14
|
+
export * from "./tracer.js";
|
15
|
+
export * from "./resolve-once.js";
|
16
|
+
export * from "./runtime.js";
|
17
|
+
export * from "./uri.js";
|
18
|
+
export * from "./crypto.js";
|
19
|
+
export * from "./base-sys-abstraction.js";
|
20
|
+
export * from "./bin2text.js";
|
21
|
+
export * from "./version.js";
|
22
|
+
export * as utils from "./utils/index.js";
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC"}
|
package/ts/index.js
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
export * from "./file-service.js";
|
2
|
+
export * from "./logger-impl.js";
|
3
|
+
export * from "./logger.js";
|
4
|
+
export * from "./sys-abstraction.js";
|
5
|
+
export * from "./sys-env.js";
|
6
|
+
export * from "./time.js";
|
7
|
+
export * from "./test/log-write-stream.js";
|
8
|
+
export * from "./test/mock-logger.js";
|
9
|
+
export * from "./txt-en-decoder.js";
|
10
|
+
export * from "./log-level-impl.js";
|
11
|
+
export * from "./result.js";
|
12
|
+
export * from "./option.js";
|
13
|
+
export * from "./future.js";
|
14
|
+
export * from "./tracer.js";
|
15
|
+
export * from "./resolve-once.js";
|
16
|
+
export * from "./runtime.js";
|
17
|
+
export * from "./uri.js";
|
18
|
+
export * from "./crypto.js";
|
19
|
+
export * from "./base-sys-abstraction.js";
|
20
|
+
export * from "./bin2text.js";
|
21
|
+
export * from "./version.js";
|
22
|
+
export * as utils from "./utils/index.js";
|
23
|
+
//# sourceMappingURL=index.js.map
|
package/ts/index.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { LevelHandler, Level } from "./logger.js";
|
2
|
+
export declare class LevelHandlerImpl implements LevelHandler {
|
3
|
+
readonly _globalLevels: Set<Level>;
|
4
|
+
readonly _modules: Map<string, Set<Level>>;
|
5
|
+
isStackExposed: boolean;
|
6
|
+
enableLevel(level: Level, ...modules: string[]): void;
|
7
|
+
disableLevel(level: Level, ...modules: string[]): void;
|
8
|
+
setExposeStack(enable?: boolean): void;
|
9
|
+
forModules(level: Level, fnAction: (p: string) => void, ...modules: (string | string[])[]): void;
|
10
|
+
setDebug(...modules: (string | string[])[]): void;
|
11
|
+
isEnabled(ilevel: unknown, module: unknown): boolean;
|
12
|
+
}
|
13
|
+
export declare function LevelHandlerSingleton(): LevelHandler;
|
14
|
+
//# sourceMappingURL=log-level-impl.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"log-level-impl.d.ts","sourceRoot":"","sources":["../../src/log-level-impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAElD,qBAAa,gBAAiB,YAAW,YAAY;IACnD,QAAQ,CAAC,aAAa,EAAE,GAAG,CAAC,KAAK,CAAC,CAAyD;IAC3F,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAiC;IAC3E,cAAc,UAAS;IACvB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;IAarD,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;IActD,cAAc,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI;IAItC,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,GAAG,IAAI;IAchG,QAAQ,CAAC,GAAG,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,GAAG,IAAI;IASjD,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO;CAoBrD;AAID,wBAAgB,qBAAqB,IAAI,YAAY,CAEpD"}
|
@@ -0,0 +1,72 @@
|
|
1
|
+
import { Level } from "./logger.js";
|
2
|
+
export class LevelHandlerImpl {
|
3
|
+
constructor() {
|
4
|
+
this._globalLevels = new Set([Level.INFO, Level.ERROR, Level.WARN]);
|
5
|
+
this._modules = new Map();
|
6
|
+
this.isStackExposed = false;
|
7
|
+
}
|
8
|
+
enableLevel(level, ...modules) {
|
9
|
+
if (modules.length == 0) {
|
10
|
+
this._globalLevels.add(level);
|
11
|
+
return;
|
12
|
+
}
|
13
|
+
this.forModules(level, (p) => {
|
14
|
+
this._modules.set(p, new Set([...this._globalLevels, level]));
|
15
|
+
}, ...modules);
|
16
|
+
}
|
17
|
+
disableLevel(level, ...modules) {
|
18
|
+
if (modules.length == 0) {
|
19
|
+
this._globalLevels.delete(level);
|
20
|
+
return;
|
21
|
+
}
|
22
|
+
this.forModules(level, (p) => {
|
23
|
+
this._modules.delete(p);
|
24
|
+
}, ...modules);
|
25
|
+
}
|
26
|
+
setExposeStack(enable) {
|
27
|
+
this.isStackExposed = !!enable;
|
28
|
+
}
|
29
|
+
forModules(level, fnAction, ...modules) {
|
30
|
+
for (const m of modules.flat()) {
|
31
|
+
if (typeof m !== "string") {
|
32
|
+
continue;
|
33
|
+
}
|
34
|
+
const parts = m
|
35
|
+
.split(",")
|
36
|
+
.map((s) => s.trim())
|
37
|
+
.filter((s) => s.length);
|
38
|
+
for (const p of parts) {
|
39
|
+
fnAction(p);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
setDebug(...modules) {
|
44
|
+
this.forModules(Level.DEBUG, (p) => {
|
45
|
+
this._modules.set(p, new Set([...this._globalLevels, Level.DEBUG]));
|
46
|
+
}, ...modules);
|
47
|
+
}
|
48
|
+
isEnabled(ilevel, module) {
|
49
|
+
const level = ilevel;
|
50
|
+
if (typeof module === "string") {
|
51
|
+
const levels = this._modules.get(module);
|
52
|
+
if (levels && levels.has(level)) {
|
53
|
+
return true;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
const wlevel = this._modules.get("*");
|
57
|
+
if (wlevel && typeof level === "string") {
|
58
|
+
if (wlevel.has(level)) {
|
59
|
+
return true;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
if (typeof level !== "string") {
|
63
|
+
return true;
|
64
|
+
}
|
65
|
+
return this._globalLevels.has(level);
|
66
|
+
}
|
67
|
+
}
|
68
|
+
const levelSingleton = new LevelHandlerImpl();
|
69
|
+
export function LevelHandlerSingleton() {
|
70
|
+
return levelSingleton;
|
71
|
+
}
|
72
|
+
//# sourceMappingURL=log-level-impl.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"log-level-impl.js","sourceRoot":"","sources":["../../src/log-level-impl.ts"],"names":[],"mappings":"A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KAAK,KAAK,QAAQ,EAAE,CAAC;YACxC,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBACtB,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAE9B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;CACF;AAED,MAAM,cAAc,GAAG,IAAI,gBAAgB,EAAE,CAAC;AAE9C,MAAM,UAAU,qBAAqB;IACnC,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
export declare class LogWriterStream {
|
2
|
+
readonly _out: WritableStream<Uint8Array>;
|
3
|
+
readonly _toFlush: (() => Promise<void>)[];
|
4
|
+
constructor(out: WritableStream<Uint8Array>);
|
5
|
+
write(encoded: Uint8Array): void;
|
6
|
+
_flushIsRunning: boolean;
|
7
|
+
_flushDoneFns: (() => void)[];
|
8
|
+
_flush(toFlush?: (() => Promise<void>)[] | undefined, done?: () => void): void;
|
9
|
+
}
|
10
|
+
//# sourceMappingURL=log-writer-impl.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"log-writer-impl.d.ts","sourceRoot":"","sources":["../../src/log-writer-impl.ts"],"names":[],"mappings":"AAAA,qBAAa,eAAe;IAC1B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAC1C,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAM;gBAEpC,GAAG,EAAE,cAAc,CAAC,UAAU,CAAC;IAI3C,KAAK,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI;IAmBhC,eAAe,UAAS;IACxB,aAAa,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,CAAM;IACnC,MAAM,CAAC,OAAO,GAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,SAAqB,EAAE,IAAI,CAAC,EAAE,MAAM,IAAI,GAAG,IAAI;CA4B1F"}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
export class LogWriterStream {
|
2
|
+
constructor(out) {
|
3
|
+
this._toFlush = [];
|
4
|
+
this._flushIsRunning = false;
|
5
|
+
this._flushDoneFns = [];
|
6
|
+
this._out = out;
|
7
|
+
}
|
8
|
+
write(encoded) {
|
9
|
+
const my = async () => {
|
10
|
+
try {
|
11
|
+
const writer = this._out.getWriter();
|
12
|
+
await writer.ready;
|
13
|
+
await writer.write(encoded);
|
14
|
+
await writer.releaseLock();
|
15
|
+
}
|
16
|
+
catch (err) {
|
17
|
+
console.error("Chunk error:", err);
|
18
|
+
}
|
19
|
+
};
|
20
|
+
this._toFlush.push(my);
|
21
|
+
this._flush();
|
22
|
+
}
|
23
|
+
_flush(toFlush = undefined, done) {
|
24
|
+
if (done) {
|
25
|
+
this._flushDoneFns.push(done);
|
26
|
+
}
|
27
|
+
if (this._toFlush.length == 0) {
|
28
|
+
this._flushIsRunning = false;
|
29
|
+
this._flushDoneFns.forEach((fn) => fn());
|
30
|
+
this._flushDoneFns = [];
|
31
|
+
return;
|
32
|
+
}
|
33
|
+
if (!toFlush && this._toFlush.length == 1 && !this._flushIsRunning) {
|
34
|
+
this._flushIsRunning = true;
|
35
|
+
}
|
36
|
+
else if (!toFlush) {
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
const my = this._toFlush.shift();
|
40
|
+
my === null || my === void 0 ? void 0 : my().finally(() => {
|
41
|
+
this._flush(this._toFlush);
|
42
|
+
});
|
43
|
+
}
|
44
|
+
}
|
45
|
+
//# sourceMappingURL=log-writer-impl.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"log-writer-impl.js","sourceRoot":"","sources":["../../src/log-writer-impl.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,eAAe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AE,CAAC;YACnE,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAE9B,CAAC;aAAM,IAAI,CAAC,OAAO,EAAE,CAAC;YAEpB,OAAO;QACT,CAAC;QAGD,MAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACjC,EAAE,aAAF,EAAE,uBAAF,EAAE,GAAK,OAAO,CAAC,GAAG,EAAE;YAElB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
@@ -0,0 +1,71 @@
|
|
1
|
+
import { AsError, FnSerialized, LogSerializable, Level, Logger, WithLogger, LevelHandler, LogFormatter } from "./logger.js";
|
2
|
+
import { SysAbstraction } from "./sys-abstraction.js";
|
3
|
+
import { Result } from "./result.js";
|
4
|
+
import { CoerceURI } from "./uri.js";
|
5
|
+
import { LogWriterStream } from "./log-writer-impl.js";
|
6
|
+
import { TxtEnDecoder } from "./txt-en-decoder.js";
|
7
|
+
export declare class JSONFormatter implements LogFormatter {
|
8
|
+
private readonly _txtEnDe;
|
9
|
+
private readonly _space?;
|
10
|
+
constructor(txtEnde: TxtEnDecoder, space?: number);
|
11
|
+
format(attr: LogSerializable): Uint8Array;
|
12
|
+
}
|
13
|
+
export declare class YAMLFormatter implements LogFormatter {
|
14
|
+
private readonly _txtEnDe;
|
15
|
+
private readonly _space?;
|
16
|
+
constructor(txtEnde: TxtEnDecoder, space?: number);
|
17
|
+
format(attr: LogSerializable): Uint8Array;
|
18
|
+
}
|
19
|
+
export interface LoggerImplParams {
|
20
|
+
readonly out?: WritableStream<Uint8Array>;
|
21
|
+
readonly logWriter?: LogWriterStream;
|
22
|
+
readonly sys?: SysAbstraction;
|
23
|
+
readonly withAttributes?: LogSerializable;
|
24
|
+
readonly levelHandler?: LevelHandler;
|
25
|
+
readonly txtEnDe?: TxtEnDecoder;
|
26
|
+
readonly formatter?: LogFormatter;
|
27
|
+
}
|
28
|
+
export declare class LoggerImpl implements Logger {
|
29
|
+
readonly _sys: SysAbstraction;
|
30
|
+
readonly _attributes: LogSerializable;
|
31
|
+
readonly _withAttributes: LogSerializable;
|
32
|
+
readonly _logWriter: LogWriterStream;
|
33
|
+
readonly _levelHandler: LevelHandler;
|
34
|
+
readonly _txtEnDe: TxtEnDecoder;
|
35
|
+
_formatter: LogFormatter;
|
36
|
+
constructor(params?: LoggerImplParams);
|
37
|
+
TxtEnDe(): TxtEnDecoder;
|
38
|
+
Attributes(): Record<string, unknown>;
|
39
|
+
SetExposeStack(enable?: boolean): Logger;
|
40
|
+
EnableLevel(level: Level, ...modules: string[]): Logger;
|
41
|
+
DisableLevel(level: Level, ...modules: string[]): Logger;
|
42
|
+
Module(key: string): Logger;
|
43
|
+
SetDebug(...modules: (string | string[])[]): Logger;
|
44
|
+
SetFormatter(formatter: LogFormatter): Logger;
|
45
|
+
Timestamp(): Logger;
|
46
|
+
Warn(): Logger;
|
47
|
+
Log(): Logger;
|
48
|
+
Debug(): Logger;
|
49
|
+
Error(): Logger;
|
50
|
+
Info(): Logger;
|
51
|
+
Err(err: unknown | Result<unknown> | Error): Logger;
|
52
|
+
WithLevel(l: Level): Logger;
|
53
|
+
Ref(key: string, action: {
|
54
|
+
toString: () => string;
|
55
|
+
} | FnSerialized): Logger;
|
56
|
+
Bool(key: string, value: unknown): Logger;
|
57
|
+
Result<T>(key: string, res: Result<T, Error>): Logger;
|
58
|
+
Len(value: unknown, key?: string): Logger;
|
59
|
+
Hash(value: unknown, key?: string): Logger;
|
60
|
+
Url(url: CoerceURI, key?: string): Logger;
|
61
|
+
Str(key: string, value?: string): Logger;
|
62
|
+
Any(key: string, value?: string | number | boolean | LogSerializable): Logger;
|
63
|
+
Dur(key: string, nsec: number): Logger;
|
64
|
+
Uint64(key: string, value: number): Logger;
|
65
|
+
Int(key: string, value: number): Logger;
|
66
|
+
Flush(): Promise<void>;
|
67
|
+
With(): WithLogger;
|
68
|
+
_resetAttributes(fn: () => () => Uint8Array): () => Uint8Array;
|
69
|
+
Msg(...args: string[]): AsError;
|
70
|
+
}
|
71
|
+
//# sourceMappingURL=logger-impl.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"logger-impl.d.ts","sourceRoot":"","sources":["../../src/logger-impl.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,OAAO,EACP,YAAY,EACZ,eAAe,EACf,KAAK,EACL,MAAM,EAGN,UAAU,EAMV,YAAY,EACZ,YAAY,EAEb,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAO,MAAM,UAAU,CAAC;AAG1C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,YAAY,EAA0B,MAAM,qBAAqB,CAAC;AAkC3E,qBAAa,aAAc,YAAW,YAAY;IAChD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAS;gBACrB,OAAO,EAAE,YAAY,EAAE,KAAK,CAAC,EAAE,MAAM;IAIjD,MAAM,CAAC,IAAI,EAAE,eAAe,GAAG,UAAU;CAG1C;AAED,qBAAa,aAAc,YAAW,YAAY;IAChD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAS;gBACrB,OAAO,EAAE,YAAY,EAAE,KAAK,CAAC,EAAE,MAAM;IAIjD,MAAM,CAAC,IAAI,EAAE,eAAe,GAAG,UAAU;CAG1C;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAC1C,QAAQ,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC;IACrC,QAAQ,CAAC,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