@adviser/cement 0.2.37 → 0.2.38
Sign up to get free protection for your applications and to get access to all the features.
- package/{chunk-Q65HLCNL.js → chunk-F5W6VELE.js} +26 -17
- package/chunk-F5W6VELE.js.map +1 -0
- package/{chunk-WMMUXBDX.js → chunk-W2GV5KXV.js} +2 -2
- package/index.cjs +33 -17
- package/index.cjs.map +1 -1
- package/index.d.cts +6 -6
- package/index.d.ts +6 -6
- package/index.js +10 -3
- package/index.js.map +1 -1
- package/node/index.cjs +25 -16
- package/node/index.cjs.map +1 -1
- package/node/index.js +1 -1
- package/package.json +1 -1
- package/src/base-sys-abstraction.ts +44 -0
- package/src/jsr.json +1 -1
- package/src/log-writer-impl.ts +1 -1
- package/src/logger.ts +10 -1
- package/src/uri.ts +21 -8
- package/ts/base-sys-abstraction.d.ts.map +1 -1
- package/ts/base-sys-abstraction.js +30 -16
- package/ts/base-sys-abstraction.js.map +1 -1
- package/ts/logger.d.ts.map +1 -1
- package/ts/logger.js +9 -1
- package/ts/logger.js.map +1 -1
- package/ts/logger.test.js +19 -0
- package/ts/logger.test.js.map +1 -1
- package/ts/uri.d.ts +5 -5
- package/ts/uri.d.ts.map +1 -1
- package/ts/uri.js.map +1 -1
- package/web/index.cjs +25 -16
- package/web/index.cjs.map +1 -1
- package/web/index.js +2 -2
- package/chunk-Q65HLCNL.js.map +0 -1
- /package/{chunk-WMMUXBDX.js.map → chunk-W2GV5KXV.js.map} +0 -0
package/node/index.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/node/index.ts","../../../src/node/node-file-service.ts","../../../src/txt-en-decoder.ts","../../../src/time.ts","../../../src/base-sys-abstraction.ts","../../../src/future.ts","../../../src/resolve-once.ts","../../../src/sys-env.ts","../../../src/node/node-sys-abstraction.ts","../../../src/node/deno-sys-abstraction.ts","../../../src/node/deno-file-service.ts","../../../src/node/mock-file-service.ts"],"sourcesContent":["export * from \"./node-file-service.js\";\nexport * from \"./node-sys-abstraction.js\";\nexport * from \"./deno-sys-abstraction.js\";\nexport * from \"./mock-file-service.js\";\n","import path from \"node:path\";\nimport fs from \"node:fs\";\nimport process from \"node:process\";\nimport { FileService, NamedWritableStream } from \"../file-service.js\";\nimport { TxtEnDecoder, Utf8EnDecoderSingleton } from \"../txt-en-decoder.js\";\n\nexport class NodeFileService implements FileService {\n readonly baseDir: string;\n constructor(baseDir: string = process.cwd()) {\n this.baseDir = this.abs(baseDir);\n }\n\n // nodeImport(fname: string): string {\n // // console.log('nodeImport:'+ fname);\n // if (path.isAbsolute(fname)) {\n // return fname;\n // } else {\n // return \"./\" + path.normalize(fname);\n // }\n // }\n\n readFileString(fname: string): Promise<string> {\n return fs.promises.readFile(fname, { encoding: \"utf-8\" });\n }\n\n dirname(fname: string): string {\n return path.dirname(fname);\n }\n basename(fname: string): string {\n return path.basename(fname);\n }\n\n join(...paths: string[]): string {\n return path.join(...paths);\n }\n\n relative(from: string, to?: string): string {\n if (to === undefined) {\n to = from;\n from = process.cwd();\n }\n const ret = path.relative(from, to);\n // console.log('relative:'+ from + \" -> \" + to + \"= \" + ret);\n return ret;\n }\n\n abs(fname: string): string {\n if (path.isAbsolute(fname)) {\n return fname;\n } else {\n const cwd = process.cwd();\n return path.resolve(cwd, fname);\n }\n }\n\n isAbsolute(fname: string): boolean {\n return path.isAbsolute(fname);\n }\n\n async writeFileString(fname: string, content: string, ende: TxtEnDecoder = Utf8EnDecoderSingleton()): Promise<void> {\n const o = await this.create(fname);\n const wr = o.stream.getWriter();\n await wr.write(ende.encode(content));\n await wr.close();\n }\n\n async create(fname: string): Promise<NamedWritableStream> {\n let oName = fname;\n if (!path.isAbsolute(fname)) {\n oName = this.abs(fname);\n }\n\n const base = path.dirname(oName);\n await fs.promises.mkdir(base, { recursive: true });\n const out = fs.createWriteStream(oName);\n return {\n name: oName,\n stream: new WritableStream<Uint8Array>({\n write(chunk): void {\n out.write(chunk);\n },\n close(): void {\n out.close();\n },\n abort(): void {\n throw new Error(\"not implemented\");\n },\n }),\n };\n }\n}\n","export interface TxtEnDecoder {\n encode(str: string): Uint8Array;\n decode(data: Uint8Array): string;\n}\n\nconst encoder = new TextEncoder();\nconst decoder = new TextDecoder();\n\nexport class Utf8EnDecoder implements TxtEnDecoder {\n encode(str: string): Uint8Array {\n return encoder.encode(str);\n }\n decode(data: Uint8Array): string {\n return decoder.decode(data);\n }\n}\n\nconst utf8EnDecoder = new Utf8EnDecoder();\nexport function Utf8EnDecoderSingleton(): TxtEnDecoder {\n return utf8EnDecoder;\n}\n","export abstract class Time {\n abstract Now(add?: number): Date;\n abstract Sleep(duration: Duration): Promise<void>;\n TimeSince(start: Date): Duration {\n const now = this.Now();\n return now.getTime() - start.getTime();\n }\n}\n\nexport type Duration = number;\n\nexport enum TimeUnits {\n Microsecond = 1,\n // eslint-disable-next-line @typescript-eslint/prefer-literal-enum-member\n Second = 1000 * Microsecond,\n // eslint-disable-next-line @typescript-eslint/prefer-literal-enum-member\n Minute = 60 * Second,\n // eslint-disable-next-line @typescript-eslint/prefer-literal-enum-member\n Hour = 60 * Minute,\n}\n","import { FileService } from \"./file-service.js\";\nimport { TimeMode, RandomMode, IDMode, SystemService, VoidFunc, SysAbstraction } from \"./sys-abstraction.js\";\nimport { Time } from \"./time.js\";\nimport { TxtEnDecoder } from \"./txt-en-decoder.js\";\n\nexport class SysTime extends Time {\n Now(): Date {\n return new Date();\n }\n Sleep(duration: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve();\n }, duration);\n });\n }\n}\n\nexport class ConstTime extends Time {\n Now(): Date {\n return new Date(2021, 1, 1, 0, 0, 0, 0);\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n Sleep(duration: number): Promise<void> {\n return Promise.resolve();\n }\n}\n\nexport class StepTime extends Time {\n _step: Date;\n readonly _start: Date;\n constructor() {\n super();\n this._step = new ConstTime().Now();\n this._start = this._step;\n }\n Now(steps = 1): Date {\n // if (this._step.getTime() === 0) {\n // this._step = new ConstTime().Now();\n // return this._step;\n // }\n for (let i = 0; steps > 0 && i < steps; i++) {\n this._step = new Date(this._step.getTime() + 1000);\n }\n if (steps < 1) {\n this._step = new Date(this._start.getTime() + steps * -1000);\n }\n // this._step = new Date(this._step.getTime() + 1000);\n return this._step;\n }\n Sleep(duration: number): Promise<void> {\n this._step = new Date(this._step.getTime() + duration);\n return Promise.resolve();\n }\n}\n\nexport function TimeFactory(timeMode: TimeMode): Time {\n switch (timeMode) {\n case TimeMode.REAL:\n return new SysTime();\n case TimeMode.CONST:\n return new ConstTime();\n case TimeMode.STEP:\n return new StepTime();\n }\n return new SysTime();\n}\n\nexport class RandomService {\n readonly _mode: RandomMode;\n _step = 0;\n constructor(mode: RandomMode) {\n this._mode = mode;\n }\n Random0ToValue(value: number): number {\n switch (this._mode) {\n case RandomMode.CONST:\n return 0.5 * value;\n case RandomMode.STEP:\n this._step += 0.0001;\n return this._step * value;\n case RandomMode.RANDOM:\n return Math.random() * value;\n default:\n throw new Error(\"Unknown RandomMode\");\n }\n }\n}\n\nexport class IdService {\n readonly _mode: IDMode;\n _step = 0;\n constructor(mode?: IDMode) {\n if (!mode) {\n mode = IDMode.UUID;\n }\n this._mode = mode;\n }\n NextId(): string {\n switch (this._mode) {\n case IDMode.UUID:\n return crypto.randomUUID();\n case IDMode.CONST:\n return \"VeryUniqueID\";\n case IDMode.STEP:\n return `STEPId-${this._step++}`;\n default:\n throw new Error(\"Unknown IDMode\");\n }\n }\n}\n\nexport interface BaseSysAbstractionParams {\n readonly TxtEnDecoder: TxtEnDecoder;\n readonly FileSystem: FileService;\n readonly SystemService: SystemService;\n}\n\nexport interface ExitHandler {\n readonly hdl: VoidFunc;\n readonly id: string;\n}\n\nexport interface ExitService {\n injectExitHandlers(hdls: ExitHandler[]): void;\n exit(code: number): void;\n}\n\nexport class BaseSysAbstraction {\n readonly _time: SysTime = new SysTime();\n readonly _stdout: WritableStream;\n readonly _stderr: WritableStream;\n\n readonly _idService: IdService = new IdService();\n readonly _randomService: RandomService = new RandomService(RandomMode.RANDOM);\n readonly _fileSystem: FileService;\n readonly _systemService: SystemService;\n readonly _txtEnDe: TxtEnDecoder;\n\n constructor(params: BaseSysAbstractionParams) {\n this._fileSystem = params.FileSystem;\n this._systemService = params.SystemService;\n this._txtEnDe = params.TxtEnDecoder;\n const decoder = this._txtEnDe;\n this._stdout = new WritableStream({\n write(chunk): Promise<void> {\n return new Promise((resolve) => {\n const decoded = decoder.decode(chunk);\n // eslint-disable-next-line no-console\n console.log(decoded.trimEnd());\n resolve();\n });\n },\n });\n this._stderr = new WritableStream({\n write(chunk): Promise<void> {\n return new Promise((resolve) => {\n const decoded = decoder.decode(chunk);\n // eslint-disable-next-line no-console\n console.error(decoded.trimEnd());\n resolve();\n });\n },\n });\n }\n}\n\nexport interface WrapperSysAbstractionParams {\n readonly TimeMode?: TimeMode;\n readonly IdMode?: IDMode;\n readonly Stdout?: WritableStream<Uint8Array>;\n readonly Stderr?: WritableStream<Uint8Array>;\n readonly RandomMode?: RandomMode;\n readonly FileSystem?: FileService;\n readonly SystemService?: SystemService;\n readonly TxtEnDecoder?: TxtEnDecoder;\n}\n\nexport class WrapperSysAbstraction implements SysAbstraction {\n readonly _time: Time;\n readonly _stdout: WritableStream<Uint8Array>;\n readonly _stderr: WritableStream<Uint8Array>;\n readonly _idService: IdService;\n readonly _randomService: RandomService;\n readonly _fileSystem: FileService;\n readonly _systemService: SystemService;\n constructor(base: BaseSysAbstraction, params?: WrapperSysAbstractionParams) {\n this._time = base._time;\n this._stdout = base._stdout;\n this._stderr = base._stderr;\n this._idService = base._idService;\n this._randomService = base._randomService;\n this._fileSystem = base._fileSystem;\n this._systemService = base._systemService;\n if (params) {\n if (params.TimeMode) {\n this._time = TimeFactory(params.TimeMode);\n }\n if (params.Stdout) {\n this._stdout = params.Stdout;\n }\n if (params.Stderr) {\n this._stderr = params.Stderr;\n }\n if (params.IdMode) {\n this._idService = new IdService(params.IdMode);\n }\n if (params.RandomMode) {\n this._randomService = new RandomService(params.RandomMode);\n }\n if (params.FileSystem) {\n this._fileSystem = params.FileSystem;\n }\n if (params.SystemService) {\n this._systemService = params.SystemService;\n }\n }\n }\n Time(): Time {\n return this._time;\n }\n NextId(): string {\n return this._idService.NextId();\n }\n Random0ToValue(value: number): number {\n return this._randomService.Random0ToValue(value);\n }\n Stdout(): WritableStream {\n return this._stdout;\n }\n Stderr(): WritableStream {\n return this._stderr;\n }\n\n System(): SystemService {\n return this._systemService;\n }\n FileSystem(): FileService {\n return this._fileSystem;\n }\n}\n// export const BaseSysAbstraction = new BaseSysAbstractionImpl()\n","export class Future<T> {\n readonly #promise: Promise<T>;\n #resolveFn: (value: T) => void = () => {\n throw new Error(\"This Promise is not working as expected.\");\n };\n #rejectFn: (reason: unknown) => void = () => {\n throw new Error(\"This Promise is not working as expected.\");\n };\n\n constructor() {\n this.#promise = new Promise<T>((resolve, reject) => {\n this.#resolveFn = resolve;\n this.#rejectFn = reject;\n });\n }\n\n async asPromise(): Promise<T> {\n return this.#promise;\n }\n\n resolve(value: T): void {\n this.#resolveFn(value);\n }\n reject(reason: unknown): void {\n this.#rejectFn(reason);\n }\n}\n","import { Future } from \"./future.js\";\n\ninterface ResolveSeqItem<T, C> {\n readonly future: Future<T>;\n readonly fn: (c: C) => Promise<T>;\n readonly id?: number;\n}\n\nexport class ResolveSeq<T, C = void> {\n readonly ctx: C;\n constructor(ctx?: C) {\n this.ctx = ctx as C;\n }\n reset(): void {\n /* noop */\n }\n async _step(item?: ResolveSeqItem<T, C> | undefined): Promise<void> {\n if (!item) {\n // done\n return;\n }\n item\n .fn(this.ctx)\n .then((value) => item.future.resolve(value))\n .catch((e) => item.future.reject(e as Error))\n .finally(() => {\n this._seqFutures.shift();\n this._step(this._seqFutures[0]);\n });\n }\n readonly _seqFutures: ResolveSeqItem<T, C>[] = [];\n async add(fn: (c: C) => Promise<T>, id?: number): Promise<T> {\n const future = new Future<T>();\n this._seqFutures.push({ future, fn, id });\n if (this._seqFutures.length === 1) {\n this._step(this._seqFutures[0]);\n }\n return future.asPromise();\n }\n}\n\nexport class ResolveOnce<T, CTX = void> {\n _onceDone = false;\n readonly _onceFutures: Future<T>[] = [];\n _onceOk = false;\n _onceValue?: T;\n _onceError?: Error;\n _isPromise = false;\n\n readonly ctx: CTX;\n\n constructor(ctx?: CTX) {\n this.ctx = ctx as CTX;\n }\n\n get ready(): boolean {\n return this._onceDone;\n }\n\n reset(): void {\n this._onceDone = false;\n this._onceOk = false;\n this._onceValue = undefined;\n this._onceError = undefined;\n this._onceFutures.length = 0;\n }\n\n // T extends Option<infer U> ? U : T\n once<R>(fn: (c: CTX) => R): R {\n if (this._onceDone) {\n if (this._onceError) {\n if (this._isPromise) {\n return Promise.reject(this._onceError) as unknown as R;\n } else {\n throw this._onceError;\n }\n }\n if (this._onceOk) {\n if (this._isPromise) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return Promise.resolve(this._onceValue!) as unknown as R;\n } else {\n return this._onceValue as unknown as R;\n }\n }\n throw new Error(\"ResolveOnce.once impossible\");\n }\n const future = new Future<T>();\n this._onceFutures.push(future);\n if (this._onceFutures.length === 1) {\n const okFn = (value: T): void => {\n this._onceValue = value;\n this._onceOk = true;\n this._onceDone = true;\n if (this._isPromise) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this._onceFutures.forEach((f) => f.resolve(this._onceValue!));\n }\n this._onceFutures.length = 0;\n };\n const catchFn = (e: Error): void => {\n this._onceError = e as Error;\n this._onceOk = false;\n this._onceValue = undefined;\n this._onceDone = true;\n if (this._isPromise) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this._onceFutures.forEach((f) => f.reject(this._onceError!));\n }\n this._onceFutures.length = 0;\n };\n try {\n const ret = fn(this.ctx);\n if (typeof (ret as Promise<T>).then === \"function\") {\n this._isPromise = true;\n (ret as Promise<T>).then(okFn).catch(catchFn);\n } else {\n okFn(ret as unknown as T);\n }\n } catch (e) {\n catchFn(e as Error);\n }\n }\n if (this._isPromise) {\n return future.asPromise() as unknown as R;\n } else {\n // abit funky but i don't want to impl the return just once\n return this.once(fn);\n }\n }\n}\n\nexport class Keyed<T extends { reset: () => void }, K = string> {\n private readonly _map = new Map<K, T>();\n\n readonly factory: (key: K) => T;\n constructor(factory: (key: K) => T) {\n this.factory = factory;\n }\n\n async asyncGet(key: () => Promise<K>): Promise<T> {\n return this.get(await key());\n }\n\n get(key: K | (() => K)): T {\n if (typeof key === \"function\") {\n key = (key as () => K)();\n }\n let keyed = this._map.get(key);\n if (!keyed) {\n keyed = this.factory(key);\n this._map.set(key, keyed);\n }\n return keyed;\n }\n\n unget(key: K): void {\n const keyed = this._map.get(key);\n keyed?.reset();\n this._map.delete(key);\n }\n\n reset(): void {\n this._map.forEach((keyed) => keyed.reset());\n this._map.clear();\n }\n}\n\nexport class KeyedResolvOnce<T, K = string> extends Keyed<ResolveOnce<T, K>, K> {\n constructor() {\n super((key) => new ResolveOnce<T, K>(key));\n }\n}\n\nexport class KeyedResolvSeq<T, K = string> extends Keyed<ResolveSeq<T, K>, K> {\n constructor() {\n super((key) => new ResolveSeq<T, K>(key));\n }\n}\n","import { ResolveOnce } from \"./resolve-once.js\";\n\nexport interface EnvMap {\n get(key: string): string | undefined;\n set(key: string, value?: string): void;\n delete(key: string): void;\n keys(): string[];\n}\nexport interface EnvActions extends EnvMap {\n active(): boolean;\n register(env: Env): Env;\n}\n\nclass NodeEnvActions implements EnvActions {\n readonly #node = globalThis as unknown as { process: { env: Record<string, string> } };\n\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor, @typescript-eslint/no-unused-vars\n constructor(opts: Partial<EnvFactoryOpts>) {\n // do nothing\n }\n\n register(env: Env): Env {\n return env;\n }\n\n active(): boolean {\n return typeof this.#node === \"object\" && typeof this.#node.process === \"object\" && typeof this.#node.process.env === \"object\";\n }\n readonly _env = this.active() ? this.#node.process.env : {};\n keys(): string[] {\n return Object.keys(this._env);\n }\n get(key: string): string | undefined {\n return this._env[key];\n }\n set(key: string, value?: string): void {\n if (value) {\n this._env[key] = value;\n }\n }\n delete(key: string): void {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this._env[key];\n }\n}\n\nclass DenoEnvActions implements EnvActions {\n readonly #deno = globalThis as unknown as { Deno: { env: Map<string, string> } };\n\n get _env(): Map<string, string> {\n return this.#deno.Deno.env;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor, @typescript-eslint/no-unused-vars\n constructor(opts: Partial<EnvFactoryOpts>) {\n // do nothing\n }\n\n register(env: Env): Env {\n return env;\n }\n active(): boolean {\n return typeof this.#deno === \"object\" && typeof this.#deno.Deno === \"object\" && typeof this.#deno.Deno.env === \"object\";\n }\n keys(): string[] {\n return Array.from(this._env.keys());\n }\n get(key: string): string | undefined {\n return this._env.get(key);\n }\n set(key: string, value?: string): void {\n if (value) {\n this._env.set(key, value);\n }\n }\n delete(key: string): void {\n this._env.delete(key);\n }\n}\n\nexport class BrowserEnvActions implements EnvActions {\n readonly env: Map<string, string> = new Map<string, string>();\n readonly opts: Partial<EnvFactoryOpts>;\n constructor(opts: Partial<EnvFactoryOpts>) {\n this.opts = opts;\n }\n\n get(key: string): string | undefined {\n return this.env.get(key);\n }\n set(key: string, value?: string): void {\n if (value) {\n this.env.set(key, value);\n }\n }\n delete(key: string): void {\n this.env.delete(key);\n }\n keys(): string[] {\n return Array.from(this.env.keys());\n }\n active(): boolean {\n return true; // that should work on every runtime\n }\n\n register(env: Env): Env {\n const sym = Symbol.for(this.opts.symbol || \"CP_ENV\");\n const browser = globalThis as unknown as Record<symbol, Env>;\n browser[sym] = env;\n return env;\n }\n}\n\nexport interface EnvFactoryOpts {\n readonly symbol: string; // default \"CP_ENV\" used by BrowserEnvActions\n readonly presetEnv: Map<string, string>;\n}\n\ntype OnSetFn = (key: string, value?: string) => void;\nexport interface OnSetItem {\n readonly filter: Set<string>;\n readonly fn: OnSetFn;\n}\n\nexport interface Env extends EnvMap {\n onSet(fn: OnSetFn, ...filter: string[]): void;\n}\n\nconst _envFactory = new ResolveOnce<Env>();\nexport function envFactory(opts: Partial<EnvFactoryOpts> = {}): Env {\n return _envFactory.once(() => {\n const found = [new NodeEnvActions(opts), new DenoEnvActions(opts), new BrowserEnvActions(opts)].find((env) => env.active());\n if (!found) {\n throw new Error(\"SysContainer:envFactory: no env available\");\n }\n const ret = new EnvImpl(found, opts);\n found.register(ret);\n return ret;\n });\n}\n\nexport class EnvImpl implements Env {\n readonly _map: EnvMap;\n constructor(map: EnvMap, opts: Partial<EnvFactoryOpts> = {}) {\n this._map = map;\n this._updatePresets(opts.presetEnv);\n }\n _updatePresets(presetEnv?: Map<string, string>): void {\n if (!presetEnv) {\n return;\n }\n for (const [key, value] of presetEnv) {\n this._map.set(key, value);\n }\n }\n _applyOnSet(onSet: OnSetItem[], key?: string, value?: string): void {\n onSet.forEach((item) => {\n let keys: string[] = [];\n if (key) {\n keys = [key];\n } else {\n keys = this._map.keys();\n }\n keys\n .filter((k) => {\n if (item.filter.size === 0) {\n return true;\n }\n if (item.filter.has(k)) {\n return true;\n }\n return false;\n })\n .forEach((k) => {\n let v;\n if (!key && !value) {\n // init\n v = this._map.get(k);\n } else if (key && !value) {\n // del\n v = undefined;\n } else {\n // set\n v = value;\n }\n item.fn(k, v);\n });\n });\n }\n readonly _onSet: OnSetItem[] = [];\n keys(): string[] {\n return this._map.keys();\n }\n // filter is not set all sets passed\n onSet(fn: OnSetFn, ...filter: string[]): void {\n const item: OnSetItem = { filter: new Set(filter), fn };\n this._onSet.push(item);\n this._applyOnSet([item]);\n }\n get(key: string): string | undefined {\n return this._map.get(key);\n }\n set(key: string, value?: string): void {\n if (!value) {\n return;\n }\n this._map.set(key, value);\n this._applyOnSet(this._onSet, key, value);\n }\n delete(key: string): void {\n this._map.delete(key);\n this._applyOnSet(this._onSet, key);\n }\n}\n\n// export const envImpl = new EnvImpl();\n","import { SysAbstraction, SystemService, VoidFunc } from \"../sys-abstraction.js\";\nimport {\n BaseSysAbstraction,\n ExitHandler,\n ExitService,\n WrapperSysAbstraction,\n WrapperSysAbstractionParams,\n} from \"../base-sys-abstraction.js\";\nimport { NodeFileService } from \"./node-file-service.js\";\nimport { Env, envFactory } from \"../sys-env.js\";\nimport { Utf8EnDecoderSingleton } from \"../txt-en-decoder.js\";\nimport process from \"node:process\";\n\nexport class NodeExitServiceImpl implements ExitService {\n constructor() {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n process.on(\"unhandledRejection\", (reason: string, p: Promise<unknown>) => {\n this.exit(19);\n });\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n process.on(\"uncaughtException\", (error: Error) => {\n this.exit(18);\n });\n process.on(\"close\", () => {\n this.exit(0);\n });\n process.on(\"exit\", () => {\n this.exit(0);\n });\n process.on(\"SIGQUIT\", () => {\n this.exit(3);\n });\n process.on(\"SIGINT\", () => {\n this.exit(2);\n });\n process.on(\"SIGTERM\", () => {\n this.exit(9);\n });\n }\n _exitHandlers: ExitHandler[] = [];\n injectExitHandlers(hdls: ExitHandler[]): void {\n // console.log(\"ExitService: injecting exit handlers\", hdls)\n this._exitHandlers = hdls;\n }\n invoked = false;\n readonly _handleExit = async (): Promise<void> => {\n if (this.invoked) {\n // console.error(\"ExitService: already invoked\");\n return;\n }\n this.invoked = true;\n for (const h of this._exitHandlers) {\n try {\n // console.log(`ExitService: calling handler ${h.id}`)\n const ret = h.hdl();\n // console.log(`ExitService: called handler ${h.id}`, ret)\n if (typeof (ret as Promise<void>).then === \"function\") {\n await ret;\n }\n } finally {\n // ignore\n }\n }\n };\n\n exit(code: number): void {\n // console.log(\"ExitService: exit called\", code)\n this._handleExit()\n .then(() => {\n process.exit(code);\n })\n .catch((err) => {\n // eslint-disable-next-line no-console\n console.error(\"ExitService: failed to handle exit\", err);\n process.exit(code);\n });\n }\n}\n\nexport class NodeSystemService implements SystemService {\n static readonly _exitHandlers: ExitHandler[] = [];\n readonly _exitService: ExitService = new NodeExitServiceImpl();\n constructor() {\n this._exitService.injectExitHandlers(NodeSystemService._exitHandlers);\n }\n\n Env(): Env {\n return envFactory();\n }\n\n Args(): string[] {\n return process.argv;\n }\n\n OnExit(hdl: VoidFunc): VoidFunc {\n const id = crypto.randomUUID();\n NodeSystemService._exitHandlers.push({ hdl, id });\n return () => {\n const idx = NodeSystemService._exitHandlers.findIndex((h) => h.id === id);\n if (idx >= 0) {\n NodeSystemService._exitHandlers.splice(idx, 1);\n }\n };\n }\n\n Exit(code: number): void {\n this._exitService.exit(code);\n }\n}\n\nlet my: BaseSysAbstraction | undefined = undefined;\nexport function NodeSysAbstraction(param?: WrapperSysAbstractionParams): SysAbstraction {\n if (!my) {\n my = new BaseSysAbstraction({\n TxtEnDecoder: param?.TxtEnDecoder || Utf8EnDecoderSingleton(),\n FileSystem: new NodeFileService(),\n SystemService: new NodeSystemService(),\n });\n }\n return new WrapperSysAbstraction(my, param);\n}\n","import { SysAbstraction, SystemService, VoidFunc } from \"../sys-abstraction.js\";\nimport {\n BaseSysAbstraction,\n ExitHandler,\n ExitService,\n WrapperSysAbstraction,\n WrapperSysAbstractionParams,\n} from \"../base-sys-abstraction.js\";\nimport { Env, envFactory } from \"../sys-env.js\";\nimport { Utf8EnDecoderSingleton } from \"../txt-en-decoder.js\";\nimport * as process from \"node:process\";\nimport { DenoFileService } from \"./deno-file-service.js\";\n\nconst Deno = (globalThis as unknown as { Deno: unknown }).Deno as {\n addSignalListener(sig: string, hdl: () => void): void;\n exit(code?: number): void;\n};\n\nexport class DenoExitServiceImpl implements ExitService {\n constructor() {\n globalThis.addEventListener(\"unhandledrejection\", (e) => {\n e.preventDefault();\n this.exit(19);\n });\n globalThis.addEventListener(\"error\", () => {\n this.exit(19);\n });\n globalThis.addEventListener(\"uncaughtException\", () => {\n this.exit(19);\n });\n\n // process.on(\"close\", () => {\n // this.exit(0);\n // });\n globalThis.addEventListener(\"unload\", () => {\n this.exit(0);\n // console.log('goodbye!');\n });\n\n // process.on(\"exit\", () => {\n // });\n Deno.addSignalListener(\"SIGQUIT\", () => {\n this.exit(3);\n });\n Deno.addSignalListener(\"SIGINT\", () => {\n this.exit(2);\n });\n Deno.addSignalListener(\"SIGTERM\", () => {\n this.exit(9);\n });\n }\n _exitHandlers: ExitHandler[] = [];\n injectExitHandlers(hdls: ExitHandler[]): void {\n // console.log(\"ExitService: injecting exit handlers\", hdls)\n this._exitHandlers = hdls;\n }\n invoked = false;\n readonly _handleExit = async (): Promise<void> => {\n if (this.invoked) {\n // console.error(\"ExitService: already invoked\");\n return;\n }\n this.invoked = true;\n for (const h of this._exitHandlers) {\n try {\n // console.log(`ExitService: calling handler ${h.id}`)\n const ret = h.hdl();\n // console.log(`ExitService: called handler ${h.id}`, ret)\n if (typeof (ret as Promise<void>).then === \"function\") {\n await ret;\n }\n } finally {\n // ignore\n }\n }\n };\n\n exit(code: number): void {\n // console.log(\"ExitService: exit called\", code)\n this._handleExit()\n .then(() => {\n Deno.exit(code);\n })\n .catch((err) => {\n // eslint-disable-next-line no-console\n console.error(\"ExitService: failed to handle exit\", err);\n Deno.exit(code);\n });\n }\n}\n\nexport class DenoSystemService implements SystemService {\n static readonly _exitHandlers: ExitHandler[] = [];\n readonly _exitService: ExitService = new DenoExitServiceImpl();\n constructor() {\n this._exitService.injectExitHandlers(DenoSystemService._exitHandlers);\n }\n\n Env(): Env {\n return envFactory();\n }\n\n Args(): string[] {\n return process.argv;\n }\n\n OnExit(hdl: VoidFunc): VoidFunc {\n const id = crypto.randomUUID();\n DenoSystemService._exitHandlers.push({ hdl, id });\n return () => {\n const idx = DenoSystemService._exitHandlers.findIndex((h) => h.id === id);\n if (idx >= 0) {\n DenoSystemService._exitHandlers.splice(idx, 1);\n }\n };\n }\n\n Exit(code: number): void {\n this._exitService.exit(code);\n }\n}\n\nlet my: BaseSysAbstraction | undefined = undefined;\nexport function DenoSysAbstraction(param?: WrapperSysAbstractionParams): SysAbstraction {\n if (!my) {\n my = new BaseSysAbstraction({\n TxtEnDecoder: param?.TxtEnDecoder || Utf8EnDecoderSingleton(),\n FileSystem: new DenoFileService(),\n SystemService: new DenoSystemService(),\n });\n }\n return new WrapperSysAbstraction(my, param);\n}\n","import { FileService, NamedWritableStream } from \"../file-service.js\";\nimport { TxtEnDecoder, Utf8EnDecoderSingleton } from \"../txt-en-decoder.js\";\nimport * as path from \"node:path\";\n\nconst Deno = (globalThis as unknown as { Deno: unknown }).Deno as {\n cwd(): string;\n readFile(fname: string): Promise<Uint8Array>;\n mkdir(base: string, options: { recursive: boolean }): Promise<void>;\n open(fname: string, options: { write: boolean; create: boolean; truncate: boolean }): Promise<WritableStream>;\n};\n\nexport class DenoFileService implements FileService {\n readonly baseDir: string;\n readonly txtEnde: TxtEnDecoder;\n constructor(baseDir: string = Deno.cwd(), txtEnde: TxtEnDecoder = Utf8EnDecoderSingleton()) {\n this.baseDir = this.abs(baseDir);\n this.txtEnde = txtEnde;\n }\n\n // nodeImport(fname: string): string {\n // // console.log('nodeImport:'+ fname);\n // if (path.isAbsolute(fname)) {\n // return fname;\n // } else {\n // return \"./\" + path.normalize(fname);\n // }\n // }\n\n async readFileString(fname: string): Promise<string> {\n return this.txtEnde.decode(await Deno.readFile(fname));\n }\n\n dirname(fname: string): string {\n return path.dirname(fname);\n }\n basename(fname: string): string {\n return path.basename(fname);\n }\n\n join(...paths: string[]): string {\n return path.join(...paths);\n }\n\n relative(from: string, to?: string): string {\n if (to === undefined) {\n to = from;\n from = Deno.cwd();\n }\n const ret = path.relative(from, to);\n // console.log('relative:'+ from + \" -> \" + to + \"= \" + ret);\n return ret;\n }\n\n abs(fname: string): string {\n if (path.isAbsolute(fname)) {\n return fname;\n } else {\n const cwd = Deno.cwd();\n return path.resolve(cwd, fname);\n }\n }\n\n isAbsolute(fname: string): boolean {\n return path.isAbsolute(fname);\n }\n\n async writeFileString(fname: string, content: string, ende = Utf8EnDecoderSingleton()): Promise<void> {\n const o = await this.create(fname);\n const wr = o.stream.getWriter();\n await wr.write(ende.encode(content));\n await wr.close();\n }\n\n async create(fname: string): Promise<NamedWritableStream> {\n let oName = fname;\n if (!path.isAbsolute(fname)) {\n oName = this.abs(fname);\n }\n\n const base = path.dirname(oName);\n await Deno.mkdir(base, { recursive: true });\n const out = await Deno.open(oName, {\n write: true,\n create: true,\n truncate: true,\n });\n return {\n name: oName,\n stream: out,\n };\n }\n}\n","import { NamedWritableStream } from \"../file-service.js\";\nimport { NodeFileService } from \"./node-file-service.js\";\n\nexport interface FileCollector {\n readonly name: string;\n content: string;\n}\n\nexport class MockFileService extends NodeFileService {\n readonly files = {} as Record<string, FileCollector>;\n\n // override abs(fname: string): string {\n // return this.join(\"/mock/\", fname);\n // }\n\n override async create(fname: string): Promise<NamedWritableStream> {\n let oName = fname;\n if (!this.isAbsolute(fname)) {\n oName = await this.abs(fname);\n }\n\n const fc = {\n name: oName,\n content: \"\",\n };\n this.files[oName] = fc;\n this.files[fname] = fc;\n const decoder = new TextDecoder();\n\n return {\n name: oName,\n stream: new WritableStream<Uint8Array>({\n write(chunk): void {\n fc.content = fc.content + decoder.decode(chunk);\n },\n close(): void {\n // do nothing\n },\n abort(): void {\n throw new Error(\"not implemented\");\n },\n }),\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,uBAAiB;AACjB,qBAAe;AACf,0BAAoB;;;ACGpB,IAAM,UAAU,IAAI,YAAY;AAChC,IAAM,UAAU,IAAI,YAAY;AAEzB,IAAM,gBAAN,MAA4C;AAAA,EACjD,OAAO,KAAyB;AAC9B,WAAO,QAAQ,OAAO,GAAG;AAAA,EAC3B;AAAA,EACA,OAAO,MAA0B;AAC/B,WAAO,QAAQ,OAAO,IAAI;AAAA,EAC5B;AACF;AAEA,IAAM,gBAAgB,IAAI,cAAc;AACjC,SAAS,yBAAuC;AACrD,SAAO;AACT;;;ADdO,IAAM,kBAAN,MAA6C;AAAA,EAElD,YAAY,UAAkB,oBAAAA,Q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,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":["process","fs","path","resolve","decoder","resolve","import_node_process","process","process","path","Deno","my","decoder"]}
|
1
|
+
{"version":3,"sources":["../../../src/node/index.ts","../../../src/node/node-file-service.ts","../../../src/txt-en-decoder.ts","../../../src/time.ts","../../../src/base-sys-abstraction.ts","../../../src/future.ts","../../../src/resolve-once.ts","../../../src/sys-env.ts","../../../src/node/node-sys-abstraction.ts","../../../src/node/deno-sys-abstraction.ts","../../../src/node/deno-file-service.ts","../../../src/node/mock-file-service.ts"],"sourcesContent":["export * from \"./node-file-service.js\";\nexport * from \"./node-sys-abstraction.js\";\nexport * from \"./deno-sys-abstraction.js\";\nexport * from \"./mock-file-service.js\";\n","import path from \"node:path\";\nimport fs from \"node:fs\";\nimport process from \"node:process\";\nimport { FileService, NamedWritableStream } from \"../file-service.js\";\nimport { TxtEnDecoder, Utf8EnDecoderSingleton } from \"../txt-en-decoder.js\";\n\nexport class NodeFileService implements FileService {\n readonly baseDir: string;\n constructor(baseDir: string = process.cwd()) {\n this.baseDir = this.abs(baseDir);\n }\n\n // nodeImport(fname: string): string {\n // // console.log('nodeImport:'+ fname);\n // if (path.isAbsolute(fname)) {\n // return fname;\n // } else {\n // return \"./\" + path.normalize(fname);\n // }\n // }\n\n readFileString(fname: string): Promise<string> {\n return fs.promises.readFile(fname, { encoding: \"utf-8\" });\n }\n\n dirname(fname: string): string {\n return path.dirname(fname);\n }\n basename(fname: string): string {\n return path.basename(fname);\n }\n\n join(...paths: string[]): string {\n return path.join(...paths);\n }\n\n relative(from: string, to?: string): string {\n if (to === undefined) {\n to = from;\n from = process.cwd();\n }\n const ret = path.relative(from, to);\n // console.log('relative:'+ from + \" -> \" + to + \"= \" + ret);\n return ret;\n }\n\n abs(fname: string): string {\n if (path.isAbsolute(fname)) {\n return fname;\n } else {\n const cwd = process.cwd();\n return path.resolve(cwd, fname);\n }\n }\n\n isAbsolute(fname: string): boolean {\n return path.isAbsolute(fname);\n }\n\n async writeFileString(fname: string, content: string, ende: TxtEnDecoder = Utf8EnDecoderSingleton()): Promise<void> {\n const o = await this.create(fname);\n const wr = o.stream.getWriter();\n await wr.write(ende.encode(content));\n await wr.close();\n }\n\n async create(fname: string): Promise<NamedWritableStream> {\n let oName = fname;\n if (!path.isAbsolute(fname)) {\n oName = this.abs(fname);\n }\n\n const base = path.dirname(oName);\n await fs.promises.mkdir(base, { recursive: true });\n const out = fs.createWriteStream(oName);\n return {\n name: oName,\n stream: new WritableStream<Uint8Array>({\n write(chunk): void {\n out.write(chunk);\n },\n close(): void {\n out.close();\n },\n abort(): void {\n throw new Error(\"not implemented\");\n },\n }),\n };\n }\n}\n","export interface TxtEnDecoder {\n encode(str: string): Uint8Array;\n decode(data: Uint8Array): string;\n}\n\nconst encoder = new TextEncoder();\nconst decoder = new TextDecoder();\n\nexport class Utf8EnDecoder implements TxtEnDecoder {\n encode(str: string): Uint8Array {\n return encoder.encode(str);\n }\n decode(data: Uint8Array): string {\n return decoder.decode(data);\n }\n}\n\nconst utf8EnDecoder = new Utf8EnDecoder();\nexport function Utf8EnDecoderSingleton(): TxtEnDecoder {\n return utf8EnDecoder;\n}\n","export abstract class Time {\n abstract Now(add?: number): Date;\n abstract Sleep(duration: Duration): Promise<void>;\n TimeSince(start: Date): Duration {\n const now = this.Now();\n return now.getTime() - start.getTime();\n }\n}\n\nexport type Duration = number;\n\nexport enum TimeUnits {\n Microsecond = 1,\n // eslint-disable-next-line @typescript-eslint/prefer-literal-enum-member\n Second = 1000 * Microsecond,\n // eslint-disable-next-line @typescript-eslint/prefer-literal-enum-member\n Minute = 60 * Second,\n // eslint-disable-next-line @typescript-eslint/prefer-literal-enum-member\n Hour = 60 * Minute,\n}\n","import { FileService } from \"./file-service.js\";\nimport { TimeMode, RandomMode, IDMode, SystemService, VoidFunc, SysAbstraction } from \"./sys-abstraction.js\";\nimport { Time } from \"./time.js\";\nimport { TxtEnDecoder } from \"./txt-en-decoder.js\";\n\nexport class SysTime extends Time {\n Now(): Date {\n return new Date();\n }\n Sleep(duration: number): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve();\n }, duration);\n });\n }\n}\n\nexport class ConstTime extends Time {\n Now(): Date {\n return new Date(2021, 1, 1, 0, 0, 0, 0);\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n Sleep(duration: number): Promise<void> {\n return Promise.resolve();\n }\n}\n\nexport class StepTime extends Time {\n _step: Date;\n readonly _start: Date;\n constructor() {\n super();\n this._step = new ConstTime().Now();\n this._start = this._step;\n }\n Now(steps = 1): Date {\n // if (this._step.getTime() === 0) {\n // this._step = new ConstTime().Now();\n // return this._step;\n // }\n for (let i = 0; steps > 0 && i < steps; i++) {\n this._step = new Date(this._step.getTime() + 1000);\n }\n if (steps < 1) {\n this._step = new Date(this._start.getTime() + steps * -1000);\n }\n // this._step = new Date(this._step.getTime() + 1000);\n return this._step;\n }\n Sleep(duration: number): Promise<void> {\n this._step = new Date(this._step.getTime() + duration);\n return Promise.resolve();\n }\n}\n\nexport function TimeFactory(timeMode: TimeMode): Time {\n switch (timeMode) {\n case TimeMode.REAL:\n return new SysTime();\n case TimeMode.CONST:\n return new ConstTime();\n case TimeMode.STEP:\n return new StepTime();\n }\n return new SysTime();\n}\n\nexport class RandomService {\n readonly _mode: RandomMode;\n _step = 0;\n constructor(mode: RandomMode) {\n this._mode = mode;\n }\n Random0ToValue(value: number): number {\n switch (this._mode) {\n case RandomMode.CONST:\n return 0.5 * value;\n case RandomMode.STEP:\n this._step += 0.0001;\n return this._step * value;\n case RandomMode.RANDOM:\n return Math.random() * value;\n default:\n throw new Error(\"Unknown RandomMode\");\n }\n }\n}\n\nexport class IdService {\n readonly _mode: IDMode;\n _step = 0;\n constructor(mode?: IDMode) {\n if (!mode) {\n mode = IDMode.UUID;\n }\n this._mode = mode;\n }\n NextId(): string {\n switch (this._mode) {\n case IDMode.UUID:\n return crypto.randomUUID();\n case IDMode.CONST:\n return \"VeryUniqueID\";\n case IDMode.STEP:\n return `STEPId-${this._step++}`;\n default:\n throw new Error(\"Unknown IDMode\");\n }\n }\n}\n\nexport interface BaseSysAbstractionParams {\n readonly TxtEnDecoder: TxtEnDecoder;\n readonly FileSystem: FileService;\n readonly SystemService: SystemService;\n}\n\nexport interface ExitHandler {\n readonly hdl: VoidFunc;\n readonly id: string;\n}\n\nexport interface ExitService {\n injectExitHandlers(hdls: ExitHandler[]): void;\n exit(code: number): void;\n}\n\n// some black magic to make it work with CF workers\nfunction consumeReadableStream(\n reader: ReadableStreamDefaultReader<Uint8Array>,\n writeFn: (chunk: Uint8Array) => Promise<void>,\n): void {\n reader\n .read()\n .then(({ done, value }) => {\n if (done) {\n return;\n }\n writeFn(value)\n .then(() => {\n consumeReadableStream(reader, writeFn);\n })\n .catch((e) => {\n // eslint-disable-next-line no-console\n console.error(\"consumeReadableStream:writeFn\", e);\n });\n })\n .catch((e) => {\n // eslint-disable-next-line no-console\n console.error(\"consumeReadableStream:read\", e);\n });\n}\n\nfunction CFWriteableStream(writeFn: (chunk: Uint8Array) => Promise<void>): WritableStream {\n const ts = new TransformStream();\n consumeReadableStream(ts.readable.getReader(), writeFn);\n return ts.writable;\n}\n\nexport class BaseSysAbstraction {\n readonly _time: SysTime = new SysTime();\n readonly _stdout: WritableStream;\n readonly _stderr: WritableStream;\n\n readonly _idService: IdService = new IdService();\n readonly _randomService: RandomService = new RandomService(RandomMode.RANDOM);\n readonly _fileSystem: FileService;\n readonly _systemService: SystemService;\n readonly _txtEnDe: TxtEnDecoder;\n\n constructor(params: BaseSysAbstractionParams) {\n this._fileSystem = params.FileSystem;\n this._systemService = params.SystemService;\n this._txtEnDe = params.TxtEnDecoder;\n const decoder = this._txtEnDe;\n this._stdout = CFWriteableStream(async (chunk) => {\n const decoded = decoder.decode(chunk);\n // eslint-disable-next-line no-console\n console.log(decoded.trimEnd());\n });\n this._stderr = CFWriteableStream(async (chunk) => {\n const decoded = decoder.decode(chunk);\n // eslint-disable-next-line no-console\n console.error(decoded.trimEnd());\n });\n /* this is not CF worker compatible\n this._stdout = new WritableStream({\n write(chunk): Promise<void> {\n return new Promise((resolve) => {\n const decoded = decoder.decode(chunk);\n // eslint-disable-next-line no-console\n console.log(decoded.trimEnd());\n resolve();\n });\n },\n });\n this._stderr = new WritableStream({\n write(chunk): Promise<void> {\n return new Promise((resolve) => {\n const decoded = decoder.decode(chunk);\n // eslint-disable-next-line no-console\n console.error(decoded.trimEnd());\n resolve();\n });\n },\n });\n */\n }\n}\n\nexport interface WrapperSysAbstractionParams {\n readonly TimeMode?: TimeMode;\n readonly IdMode?: IDMode;\n readonly Stdout?: WritableStream<Uint8Array>;\n readonly Stderr?: WritableStream<Uint8Array>;\n readonly RandomMode?: RandomMode;\n readonly FileSystem?: FileService;\n readonly SystemService?: SystemService;\n readonly TxtEnDecoder?: TxtEnDecoder;\n}\n\nexport class WrapperSysAbstraction implements SysAbstraction {\n readonly _time: Time;\n readonly _stdout: WritableStream<Uint8Array>;\n readonly _stderr: WritableStream<Uint8Array>;\n readonly _idService: IdService;\n readonly _randomService: RandomService;\n readonly _fileSystem: FileService;\n readonly _systemService: SystemService;\n constructor(base: BaseSysAbstraction, params?: WrapperSysAbstractionParams) {\n this._time = base._time;\n this._stdout = base._stdout;\n this._stderr = base._stderr;\n this._idService = base._idService;\n this._randomService = base._randomService;\n this._fileSystem = base._fileSystem;\n this._systemService = base._systemService;\n if (params) {\n if (params.TimeMode) {\n this._time = TimeFactory(params.TimeMode);\n }\n if (params.Stdout) {\n this._stdout = params.Stdout;\n }\n if (params.Stderr) {\n this._stderr = params.Stderr;\n }\n if (params.IdMode) {\n this._idService = new IdService(params.IdMode);\n }\n if (params.RandomMode) {\n this._randomService = new RandomService(params.RandomMode);\n }\n if (params.FileSystem) {\n this._fileSystem = params.FileSystem;\n }\n if (params.SystemService) {\n this._systemService = params.SystemService;\n }\n }\n }\n Time(): Time {\n return this._time;\n }\n NextId(): string {\n return this._idService.NextId();\n }\n Random0ToValue(value: number): number {\n return this._randomService.Random0ToValue(value);\n }\n Stdout(): WritableStream {\n return this._stdout;\n }\n Stderr(): WritableStream {\n return this._stderr;\n }\n\n System(): SystemService {\n return this._systemService;\n }\n FileSystem(): FileService {\n return this._fileSystem;\n }\n}\n// export const BaseSysAbstraction = new BaseSysAbstractionImpl()\n","export class Future<T> {\n readonly #promise: Promise<T>;\n #resolveFn: (value: T) => void = () => {\n throw new Error(\"This Promise is not working as expected.\");\n };\n #rejectFn: (reason: unknown) => void = () => {\n throw new Error(\"This Promise is not working as expected.\");\n };\n\n constructor() {\n this.#promise = new Promise<T>((resolve, reject) => {\n this.#resolveFn = resolve;\n this.#rejectFn = reject;\n });\n }\n\n async asPromise(): Promise<T> {\n return this.#promise;\n }\n\n resolve(value: T): void {\n this.#resolveFn(value);\n }\n reject(reason: unknown): void {\n this.#rejectFn(reason);\n }\n}\n","import { Future } from \"./future.js\";\n\ninterface ResolveSeqItem<T, C> {\n readonly future: Future<T>;\n readonly fn: (c: C) => Promise<T>;\n readonly id?: number;\n}\n\nexport class ResolveSeq<T, C = void> {\n readonly ctx: C;\n constructor(ctx?: C) {\n this.ctx = ctx as C;\n }\n reset(): void {\n /* noop */\n }\n async _step(item?: ResolveSeqItem<T, C> | undefined): Promise<void> {\n if (!item) {\n // done\n return;\n }\n item\n .fn(this.ctx)\n .then((value) => item.future.resolve(value))\n .catch((e) => item.future.reject(e as Error))\n .finally(() => {\n this._seqFutures.shift();\n this._step(this._seqFutures[0]);\n });\n }\n readonly _seqFutures: ResolveSeqItem<T, C>[] = [];\n async add(fn: (c: C) => Promise<T>, id?: number): Promise<T> {\n const future = new Future<T>();\n this._seqFutures.push({ future, fn, id });\n if (this._seqFutures.length === 1) {\n this._step(this._seqFutures[0]);\n }\n return future.asPromise();\n }\n}\n\nexport class ResolveOnce<T, CTX = void> {\n _onceDone = false;\n readonly _onceFutures: Future<T>[] = [];\n _onceOk = false;\n _onceValue?: T;\n _onceError?: Error;\n _isPromise = false;\n\n readonly ctx: CTX;\n\n constructor(ctx?: CTX) {\n this.ctx = ctx as CTX;\n }\n\n get ready(): boolean {\n return this._onceDone;\n }\n\n reset(): void {\n this._onceDone = false;\n this._onceOk = false;\n this._onceValue = undefined;\n this._onceError = undefined;\n this._onceFutures.length = 0;\n }\n\n // T extends Option<infer U> ? U : T\n once<R>(fn: (c: CTX) => R): R {\n if (this._onceDone) {\n if (this._onceError) {\n if (this._isPromise) {\n return Promise.reject(this._onceError) as unknown as R;\n } else {\n throw this._onceError;\n }\n }\n if (this._onceOk) {\n if (this._isPromise) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return Promise.resolve(this._onceValue!) as unknown as R;\n } else {\n return this._onceValue as unknown as R;\n }\n }\n throw new Error(\"ResolveOnce.once impossible\");\n }\n const future = new Future<T>();\n this._onceFutures.push(future);\n if (this._onceFutures.length === 1) {\n const okFn = (value: T): void => {\n this._onceValue = value;\n this._onceOk = true;\n this._onceDone = true;\n if (this._isPromise) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this._onceFutures.forEach((f) => f.resolve(this._onceValue!));\n }\n this._onceFutures.length = 0;\n };\n const catchFn = (e: Error): void => {\n this._onceError = e as Error;\n this._onceOk = false;\n this._onceValue = undefined;\n this._onceDone = true;\n if (this._isPromise) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this._onceFutures.forEach((f) => f.reject(this._onceError!));\n }\n this._onceFutures.length = 0;\n };\n try {\n const ret = fn(this.ctx);\n if (typeof (ret as Promise<T>).then === \"function\") {\n this._isPromise = true;\n (ret as Promise<T>).then(okFn).catch(catchFn);\n } else {\n okFn(ret as unknown as T);\n }\n } catch (e) {\n catchFn(e as Error);\n }\n }\n if (this._isPromise) {\n return future.asPromise() as unknown as R;\n } else {\n // abit funky but i don't want to impl the return just once\n return this.once(fn);\n }\n }\n}\n\nexport class Keyed<T extends { reset: () => void }, K = string> {\n private readonly _map = new Map<K, T>();\n\n readonly factory: (key: K) => T;\n constructor(factory: (key: K) => T) {\n this.factory = factory;\n }\n\n async asyncGet(key: () => Promise<K>): Promise<T> {\n return this.get(await key());\n }\n\n get(key: K | (() => K)): T {\n if (typeof key === \"function\") {\n key = (key as () => K)();\n }\n let keyed = this._map.get(key);\n if (!keyed) {\n keyed = this.factory(key);\n this._map.set(key, keyed);\n }\n return keyed;\n }\n\n unget(key: K): void {\n const keyed = this._map.get(key);\n keyed?.reset();\n this._map.delete(key);\n }\n\n reset(): void {\n this._map.forEach((keyed) => keyed.reset());\n this._map.clear();\n }\n}\n\nexport class KeyedResolvOnce<T, K = string> extends Keyed<ResolveOnce<T, K>, K> {\n constructor() {\n super((key) => new ResolveOnce<T, K>(key));\n }\n}\n\nexport class KeyedResolvSeq<T, K = string> extends Keyed<ResolveSeq<T, K>, K> {\n constructor() {\n super((key) => new ResolveSeq<T, K>(key));\n }\n}\n","import { ResolveOnce } from \"./resolve-once.js\";\n\nexport interface EnvMap {\n get(key: string): string | undefined;\n set(key: string, value?: string): void;\n delete(key: string): void;\n keys(): string[];\n}\nexport interface EnvActions extends EnvMap {\n active(): boolean;\n register(env: Env): Env;\n}\n\nclass NodeEnvActions implements EnvActions {\n readonly #node = globalThis as unknown as { process: { env: Record<string, string> } };\n\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor, @typescript-eslint/no-unused-vars\n constructor(opts: Partial<EnvFactoryOpts>) {\n // do nothing\n }\n\n register(env: Env): Env {\n return env;\n }\n\n active(): boolean {\n return typeof this.#node === \"object\" && typeof this.#node.process === \"object\" && typeof this.#node.process.env === \"object\";\n }\n readonly _env = this.active() ? this.#node.process.env : {};\n keys(): string[] {\n return Object.keys(this._env);\n }\n get(key: string): string | undefined {\n return this._env[key];\n }\n set(key: string, value?: string): void {\n if (value) {\n this._env[key] = value;\n }\n }\n delete(key: string): void {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this._env[key];\n }\n}\n\nclass DenoEnvActions implements EnvActions {\n readonly #deno = globalThis as unknown as { Deno: { env: Map<string, string> } };\n\n get _env(): Map<string, string> {\n return this.#deno.Deno.env;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor, @typescript-eslint/no-unused-vars\n constructor(opts: Partial<EnvFactoryOpts>) {\n // do nothing\n }\n\n register(env: Env): Env {\n return env;\n }\n active(): boolean {\n return typeof this.#deno === \"object\" && typeof this.#deno.Deno === \"object\" && typeof this.#deno.Deno.env === \"object\";\n }\n keys(): string[] {\n return Array.from(this._env.keys());\n }\n get(key: string): string | undefined {\n return this._env.get(key);\n }\n set(key: string, value?: string): void {\n if (value) {\n this._env.set(key, value);\n }\n }\n delete(key: string): void {\n this._env.delete(key);\n }\n}\n\nexport class BrowserEnvActions implements EnvActions {\n readonly env: Map<string, string> = new Map<string, string>();\n readonly opts: Partial<EnvFactoryOpts>;\n constructor(opts: Partial<EnvFactoryOpts>) {\n this.opts = opts;\n }\n\n get(key: string): string | undefined {\n return this.env.get(key);\n }\n set(key: string, value?: string): void {\n if (value) {\n this.env.set(key, value);\n }\n }\n delete(key: string): void {\n this.env.delete(key);\n }\n keys(): string[] {\n return Array.from(this.env.keys());\n }\n active(): boolean {\n return true; // that should work on every runtime\n }\n\n register(env: Env): Env {\n const sym = Symbol.for(this.opts.symbol || \"CP_ENV\");\n const browser = globalThis as unknown as Record<symbol, Env>;\n browser[sym] = env;\n return env;\n }\n}\n\nexport interface EnvFactoryOpts {\n readonly symbol: string; // default \"CP_ENV\" used by BrowserEnvActions\n readonly presetEnv: Map<string, string>;\n}\n\ntype OnSetFn = (key: string, value?: string) => void;\nexport interface OnSetItem {\n readonly filter: Set<string>;\n readonly fn: OnSetFn;\n}\n\nexport interface Env extends EnvMap {\n onSet(fn: OnSetFn, ...filter: string[]): void;\n}\n\nconst _envFactory = new ResolveOnce<Env>();\nexport function envFactory(opts: Partial<EnvFactoryOpts> = {}): Env {\n return _envFactory.once(() => {\n const found = [new NodeEnvActions(opts), new DenoEnvActions(opts), new BrowserEnvActions(opts)].find((env) => env.active());\n if (!found) {\n throw new Error(\"SysContainer:envFactory: no env available\");\n }\n const ret = new EnvImpl(found, opts);\n found.register(ret);\n return ret;\n });\n}\n\nexport class EnvImpl implements Env {\n readonly _map: EnvMap;\n constructor(map: EnvMap, opts: Partial<EnvFactoryOpts> = {}) {\n this._map = map;\n this._updatePresets(opts.presetEnv);\n }\n _updatePresets(presetEnv?: Map<string, string>): void {\n if (!presetEnv) {\n return;\n }\n for (const [key, value] of presetEnv) {\n this._map.set(key, value);\n }\n }\n _applyOnSet(onSet: OnSetItem[], key?: string, value?: string): void {\n onSet.forEach((item) => {\n let keys: string[] = [];\n if (key) {\n keys = [key];\n } else {\n keys = this._map.keys();\n }\n keys\n .filter((k) => {\n if (item.filter.size === 0) {\n return true;\n }\n if (item.filter.has(k)) {\n return true;\n }\n return false;\n })\n .forEach((k) => {\n let v;\n if (!key && !value) {\n // init\n v = this._map.get(k);\n } else if (key && !value) {\n // del\n v = undefined;\n } else {\n // set\n v = value;\n }\n item.fn(k, v);\n });\n });\n }\n readonly _onSet: OnSetItem[] = [];\n keys(): string[] {\n return this._map.keys();\n }\n // filter is not set all sets passed\n onSet(fn: OnSetFn, ...filter: string[]): void {\n const item: OnSetItem = { filter: new Set(filter), fn };\n this._onSet.push(item);\n this._applyOnSet([item]);\n }\n get(key: string): string | undefined {\n return this._map.get(key);\n }\n set(key: string, value?: string): void {\n if (!value) {\n return;\n }\n this._map.set(key, value);\n this._applyOnSet(this._onSet, key, value);\n }\n delete(key: string): void {\n this._map.delete(key);\n this._applyOnSet(this._onSet, key);\n }\n}\n\n// export const envImpl = new EnvImpl();\n","import { SysAbstraction, SystemService, VoidFunc } from \"../sys-abstraction.js\";\nimport {\n BaseSysAbstraction,\n ExitHandler,\n ExitService,\n WrapperSysAbstraction,\n WrapperSysAbstractionParams,\n} from \"../base-sys-abstraction.js\";\nimport { NodeFileService } from \"./node-file-service.js\";\nimport { Env, envFactory } from \"../sys-env.js\";\nimport { Utf8EnDecoderSingleton } from \"../txt-en-decoder.js\";\nimport process from \"node:process\";\n\nexport class NodeExitServiceImpl implements ExitService {\n constructor() {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n process.on(\"unhandledRejection\", (reason: string, p: Promise<unknown>) => {\n this.exit(19);\n });\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n process.on(\"uncaughtException\", (error: Error) => {\n this.exit(18);\n });\n process.on(\"close\", () => {\n this.exit(0);\n });\n process.on(\"exit\", () => {\n this.exit(0);\n });\n process.on(\"SIGQUIT\", () => {\n this.exit(3);\n });\n process.on(\"SIGINT\", () => {\n this.exit(2);\n });\n process.on(\"SIGTERM\", () => {\n this.exit(9);\n });\n }\n _exitHandlers: ExitHandler[] = [];\n injectExitHandlers(hdls: ExitHandler[]): void {\n // console.log(\"ExitService: injecting exit handlers\", hdls)\n this._exitHandlers = hdls;\n }\n invoked = false;\n readonly _handleExit = async (): Promise<void> => {\n if (this.invoked) {\n // console.error(\"ExitService: already invoked\");\n return;\n }\n this.invoked = true;\n for (const h of this._exitHandlers) {\n try {\n // console.log(`ExitService: calling handler ${h.id}`)\n const ret = h.hdl();\n // console.log(`ExitService: called handler ${h.id}`, ret)\n if (typeof (ret as Promise<void>).then === \"function\") {\n await ret;\n }\n } finally {\n // ignore\n }\n }\n };\n\n exit(code: number): void {\n // console.log(\"ExitService: exit called\", code)\n this._handleExit()\n .then(() => {\n process.exit(code);\n })\n .catch((err) => {\n // eslint-disable-next-line no-console\n console.error(\"ExitService: failed to handle exit\", err);\n process.exit(code);\n });\n }\n}\n\nexport class NodeSystemService implements SystemService {\n static readonly _exitHandlers: ExitHandler[] = [];\n readonly _exitService: ExitService = new NodeExitServiceImpl();\n constructor() {\n this._exitService.injectExitHandlers(NodeSystemService._exitHandlers);\n }\n\n Env(): Env {\n return envFactory();\n }\n\n Args(): string[] {\n return process.argv;\n }\n\n OnExit(hdl: VoidFunc): VoidFunc {\n const id = crypto.randomUUID();\n NodeSystemService._exitHandlers.push({ hdl, id });\n return () => {\n const idx = NodeSystemService._exitHandlers.findIndex((h) => h.id === id);\n if (idx >= 0) {\n NodeSystemService._exitHandlers.splice(idx, 1);\n }\n };\n }\n\n Exit(code: number): void {\n this._exitService.exit(code);\n }\n}\n\nlet my: BaseSysAbstraction | undefined = undefined;\nexport function NodeSysAbstraction(param?: WrapperSysAbstractionParams): SysAbstraction {\n if (!my) {\n my = new BaseSysAbstraction({\n TxtEnDecoder: param?.TxtEnDecoder || Utf8EnDecoderSingleton(),\n FileSystem: new NodeFileService(),\n SystemService: new NodeSystemService(),\n });\n }\n return new WrapperSysAbstraction(my, param);\n}\n","import { SysAbstraction, SystemService, VoidFunc } from \"../sys-abstraction.js\";\nimport {\n BaseSysAbstraction,\n ExitHandler,\n ExitService,\n WrapperSysAbstraction,\n WrapperSysAbstractionParams,\n} from \"../base-sys-abstraction.js\";\nimport { Env, envFactory } from \"../sys-env.js\";\nimport { Utf8EnDecoderSingleton } from \"../txt-en-decoder.js\";\nimport * as process from \"node:process\";\nimport { DenoFileService } from \"./deno-file-service.js\";\n\nconst Deno = (globalThis as unknown as { Deno: unknown }).Deno as {\n addSignalListener(sig: string, hdl: () => void): void;\n exit(code?: number): void;\n};\n\nexport class DenoExitServiceImpl implements ExitService {\n constructor() {\n globalThis.addEventListener(\"unhandledrejection\", (e) => {\n e.preventDefault();\n this.exit(19);\n });\n globalThis.addEventListener(\"error\", () => {\n this.exit(19);\n });\n globalThis.addEventListener(\"uncaughtException\", () => {\n this.exit(19);\n });\n\n // process.on(\"close\", () => {\n // this.exit(0);\n // });\n globalThis.addEventListener(\"unload\", () => {\n this.exit(0);\n // console.log('goodbye!');\n });\n\n // process.on(\"exit\", () => {\n // });\n Deno.addSignalListener(\"SIGQUIT\", () => {\n this.exit(3);\n });\n Deno.addSignalListener(\"SIGINT\", () => {\n this.exit(2);\n });\n Deno.addSignalListener(\"SIGTERM\", () => {\n this.exit(9);\n });\n }\n _exitHandlers: ExitHandler[] = [];\n injectExitHandlers(hdls: ExitHandler[]): void {\n // console.log(\"ExitService: injecting exit handlers\", hdls)\n this._exitHandlers = hdls;\n }\n invoked = false;\n readonly _handleExit = async (): Promise<void> => {\n if (this.invoked) {\n // console.error(\"ExitService: already invoked\");\n return;\n }\n this.invoked = true;\n for (const h of this._exitHandlers) {\n try {\n // console.log(`ExitService: calling handler ${h.id}`)\n const ret = h.hdl();\n // console.log(`ExitService: called handler ${h.id}`, ret)\n if (typeof (ret as Promise<void>).then === \"function\") {\n await ret;\n }\n } finally {\n // ignore\n }\n }\n };\n\n exit(code: number): void {\n // console.log(\"ExitService: exit called\", code)\n this._handleExit()\n .then(() => {\n Deno.exit(code);\n })\n .catch((err) => {\n // eslint-disable-next-line no-console\n console.error(\"ExitService: failed to handle exit\", err);\n Deno.exit(code);\n });\n }\n}\n\nexport class DenoSystemService implements SystemService {\n static readonly _exitHandlers: ExitHandler[] = [];\n readonly _exitService: ExitService = new DenoExitServiceImpl();\n constructor() {\n this._exitService.injectExitHandlers(DenoSystemService._exitHandlers);\n }\n\n Env(): Env {\n return envFactory();\n }\n\n Args(): string[] {\n return process.argv;\n }\n\n OnExit(hdl: VoidFunc): VoidFunc {\n const id = crypto.randomUUID();\n DenoSystemService._exitHandlers.push({ hdl, id });\n return () => {\n const idx = DenoSystemService._exitHandlers.findIndex((h) => h.id === id);\n if (idx >= 0) {\n DenoSystemService._exitHandlers.splice(idx, 1);\n }\n };\n }\n\n Exit(code: number): void {\n this._exitService.exit(code);\n }\n}\n\nlet my: BaseSysAbstraction | undefined = undefined;\nexport function DenoSysAbstraction(param?: WrapperSysAbstractionParams): SysAbstraction {\n if (!my) {\n my = new BaseSysAbstraction({\n TxtEnDecoder: param?.TxtEnDecoder || Utf8EnDecoderSingleton(),\n FileSystem: new DenoFileService(),\n SystemService: new DenoSystemService(),\n });\n }\n return new WrapperSysAbstraction(my, param);\n}\n","import { FileService, NamedWritableStream } from \"../file-service.js\";\nimport { TxtEnDecoder, Utf8EnDecoderSingleton } from \"../txt-en-decoder.js\";\nimport * as path from \"node:path\";\n\nconst Deno = (globalThis as unknown as { Deno: unknown }).Deno as {\n cwd(): string;\n readFile(fname: string): Promise<Uint8Array>;\n mkdir(base: string, options: { recursive: boolean }): Promise<void>;\n open(fname: string, options: { write: boolean; create: boolean; truncate: boolean }): Promise<WritableStream>;\n};\n\nexport class DenoFileService implements FileService {\n readonly baseDir: string;\n readonly txtEnde: TxtEnDecoder;\n constructor(baseDir: string = Deno.cwd(), txtEnde: TxtEnDecoder = Utf8EnDecoderSingleton()) {\n this.baseDir = this.abs(baseDir);\n this.txtEnde = txtEnde;\n }\n\n // nodeImport(fname: string): string {\n // // console.log('nodeImport:'+ fname);\n // if (path.isAbsolute(fname)) {\n // return fname;\n // } else {\n // return \"./\" + path.normalize(fname);\n // }\n // }\n\n async readFileString(fname: string): Promise<string> {\n return this.txtEnde.decode(await Deno.readFile(fname));\n }\n\n dirname(fname: string): string {\n return path.dirname(fname);\n }\n basename(fname: string): string {\n return path.basename(fname);\n }\n\n join(...paths: string[]): string {\n return path.join(...paths);\n }\n\n relative(from: string, to?: string): string {\n if (to === undefined) {\n to = from;\n from = Deno.cwd();\n }\n const ret = path.relative(from, to);\n // console.log('relative:'+ from + \" -> \" + to + \"= \" + ret);\n return ret;\n }\n\n abs(fname: string): string {\n if (path.isAbsolute(fname)) {\n return fname;\n } else {\n const cwd = Deno.cwd();\n return path.resolve(cwd, fname);\n }\n }\n\n isAbsolute(fname: string): boolean {\n return path.isAbsolute(fname);\n }\n\n async writeFileString(fname: string, content: string, ende = Utf8EnDecoderSingleton()): Promise<void> {\n const o = await this.create(fname);\n const wr = o.stream.getWriter();\n await wr.write(ende.encode(content));\n await wr.close();\n }\n\n async create(fname: string): Promise<NamedWritableStream> {\n let oName = fname;\n if (!path.isAbsolute(fname)) {\n oName = this.abs(fname);\n }\n\n const base = path.dirname(oName);\n await Deno.mkdir(base, { recursive: true });\n const out = await Deno.open(oName, {\n write: true,\n create: true,\n truncate: true,\n });\n return {\n name: oName,\n stream: out,\n };\n }\n}\n","import { NamedWritableStream } from \"../file-service.js\";\nimport { NodeFileService } from \"./node-file-service.js\";\n\nexport interface FileCollector {\n readonly name: string;\n content: string;\n}\n\nexport class MockFileService extends NodeFileService {\n readonly files = {} as Record<string, FileCollector>;\n\n // override abs(fname: string): string {\n // return this.join(\"/mock/\", fname);\n // }\n\n override async create(fname: string): Promise<NamedWritableStream> {\n let oName = fname;\n if (!this.isAbsolute(fname)) {\n oName = await this.abs(fname);\n }\n\n const fc = {\n name: oName,\n content: \"\",\n };\n this.files[oName] = fc;\n this.files[fname] = fc;\n const decoder = new TextDecoder();\n\n return {\n name: oName,\n stream: new WritableStream<Uint8Array>({\n write(chunk): void {\n fc.content = fc.content + decoder.decode(chunk);\n },\n close(): void {\n // do nothing\n },\n abort(): void {\n throw new Error(\"not implemented\");\n },\n }),\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,uBAAiB;AACjB,qBAAe;AACf,0BAAoB;;;ACGpB,IAAM,UAAU,IAAI,YAAY;AAChC,IAAM,UAAU,IAAI,YAAY;AAEzB,IAAM,gBAAN,MAA4C;AAAA,EACjD,OAAO,KAAyB;AAC9B,WAAO,QAAQ,OAAO,GAAG;AAAA,EAC3B;AAAA,EACA,OAAO,MAA0B;AAC/B,WAAO,QAAQ,OAAO,IAAI;AAAA,EAC5B;AACF;AAEA,IAAM,gBAAgB,IAAI,cAAc;AACjC,SAAS,yBAAuC;AACrD,SAAO;AACT;;;ADdO,IAAM,kBAAN,MAA6C;AAAA,EAElD,YAAY,UAAkB,oBAAAA,QAAQ,IAAI,GAAG;AAC3C,SAAK,UAAU,KAAK,IAAI,OAAO;AAAA,EACjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,eAAe,OAAgC;AAC7C,WAAO,eAAAC,QAA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,OAAO,KAAK;AAAA,QAChD;AAAA,QACA,QAAc;AAAA,QAEd;AAAA,QACA,QAAc;AACZ,gBAAM,IAAI,MAAM,iBAAiB;AAAA,QACnC;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":["process","fs","path","resolve","decoder","resolve","import_node_process","process","process","path","Deno","my","decoder"]}
|
package/node/index.js
CHANGED
package/package.json
CHANGED
@@ -126,6 +126,38 @@ export interface ExitService {
|
|
126
126
|
exit(code: number): void;
|
127
127
|
}
|
128
128
|
|
129
|
+
// some black magic to make it work with CF workers
|
130
|
+
function consumeReadableStream(
|
131
|
+
reader: ReadableStreamDefaultReader<Uint8Array>,
|
132
|
+
writeFn: (chunk: Uint8Array) => Promise<void>,
|
133
|
+
): void {
|
134
|
+
reader
|
135
|
+
.read()
|
136
|
+
.then(({ done, value }) => {
|
137
|
+
if (done) {
|
138
|
+
return;
|
139
|
+
}
|
140
|
+
writeFn(value)
|
141
|
+
.then(() => {
|
142
|
+
consumeReadableStream(reader, writeFn);
|
143
|
+
})
|
144
|
+
.catch((e) => {
|
145
|
+
// eslint-disable-next-line no-console
|
146
|
+
console.error("consumeReadableStream:writeFn", e);
|
147
|
+
});
|
148
|
+
})
|
149
|
+
.catch((e) => {
|
150
|
+
// eslint-disable-next-line no-console
|
151
|
+
console.error("consumeReadableStream:read", e);
|
152
|
+
});
|
153
|
+
}
|
154
|
+
|
155
|
+
function CFWriteableStream(writeFn: (chunk: Uint8Array) => Promise<void>): WritableStream {
|
156
|
+
const ts = new TransformStream();
|
157
|
+
consumeReadableStream(ts.readable.getReader(), writeFn);
|
158
|
+
return ts.writable;
|
159
|
+
}
|
160
|
+
|
129
161
|
export class BaseSysAbstraction {
|
130
162
|
readonly _time: SysTime = new SysTime();
|
131
163
|
readonly _stdout: WritableStream;
|
@@ -142,6 +174,17 @@ export class BaseSysAbstraction {
|
|
142
174
|
this._systemService = params.SystemService;
|
143
175
|
this._txtEnDe = params.TxtEnDecoder;
|
144
176
|
const decoder = this._txtEnDe;
|
177
|
+
this._stdout = CFWriteableStream(async (chunk) => {
|
178
|
+
const decoded = decoder.decode(chunk);
|
179
|
+
// eslint-disable-next-line no-console
|
180
|
+
console.log(decoded.trimEnd());
|
181
|
+
});
|
182
|
+
this._stderr = CFWriteableStream(async (chunk) => {
|
183
|
+
const decoded = decoder.decode(chunk);
|
184
|
+
// eslint-disable-next-line no-console
|
185
|
+
console.error(decoded.trimEnd());
|
186
|
+
});
|
187
|
+
/* this is not CF worker compatible
|
145
188
|
this._stdout = new WritableStream({
|
146
189
|
write(chunk): Promise<void> {
|
147
190
|
return new Promise((resolve) => {
|
@@ -162,6 +205,7 @@ export class BaseSysAbstraction {
|
|
162
205
|
});
|
163
206
|
},
|
164
207
|
});
|
208
|
+
*/
|
165
209
|
}
|
166
210
|
}
|
167
211
|
|
package/src/jsr.json
CHANGED
package/src/log-writer-impl.ts
CHANGED
@@ -9,7 +9,7 @@ export class LogWriterStream {
|
|
9
9
|
write(encoded: Uint8Array): void {
|
10
10
|
const my = async (): Promise<void> => {
|
11
11
|
// const val = Math.random();
|
12
|
-
// console.log(">>>My:",
|
12
|
+
// console.log(">>>My:", encoded)
|
13
13
|
try {
|
14
14
|
const writer = this._out.getWriter();
|
15
15
|
await writer.ready;
|
package/src/logger.ts
CHANGED
@@ -78,7 +78,16 @@ export function logValue(val: LogValueArg, state: Set<unknown> = new Set<unknown
|
|
78
78
|
return new LogValue(() => "null");
|
79
79
|
}
|
80
80
|
if (ArrayBuffer.isView(val)) {
|
81
|
-
|
81
|
+
try {
|
82
|
+
// should be injected
|
83
|
+
const decoder = new TextDecoder();
|
84
|
+
const asStr = decoder.decode(val);
|
85
|
+
const obj = JSON.parse(asStr);
|
86
|
+
return logValue(obj, state);
|
87
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
88
|
+
} catch (e) {
|
89
|
+
return logValue(bin2string(val, 512));
|
90
|
+
}
|
82
91
|
}
|
83
92
|
if (Array.isArray(val)) {
|
84
93
|
return new LogValue(() => (val as Serialized[]).map((v) => logValue(v).value() as Serialized));
|
package/src/uri.ts
CHANGED
@@ -5,6 +5,23 @@ type NullOrUndef = null | undefined;
|
|
5
5
|
|
6
6
|
type OneKey<K extends string, V = string> = Record<K, V>;
|
7
7
|
|
8
|
+
export type MsgFn = (...keys: string[]) => string;
|
9
|
+
/*
|
10
|
+
if KeyParam is a Object
|
11
|
+
if the right side is a string, it is the default value
|
12
|
+
if the right side is a !string, it is required
|
13
|
+
*/
|
14
|
+
export type KeysParam = (string | MsgFn | Record<string, unknown>)[];
|
15
|
+
|
16
|
+
// type ReturnType<T extends (...args: KeysParam) => unknown> = T extends (...args: KeysParam) => infer R ? R : unknown;
|
17
|
+
|
18
|
+
// function fetchData<T extends (...args: any[]) => Promise<any>>(fn: T): ReturnType<T> {
|
19
|
+
// return fn();
|
20
|
+
// }
|
21
|
+
// type ReturnObject<T extends KeysParam> = {
|
22
|
+
// [K in keyof T]: string;
|
23
|
+
// };
|
24
|
+
|
8
25
|
export interface URIInterface<R extends URIInterface<R>> {
|
9
26
|
// readonly hostname: string;
|
10
27
|
// readonly port: string;
|
@@ -16,7 +33,7 @@ export interface URIInterface<R extends URIInterface<R>> {
|
|
16
33
|
hasParam(key: string): boolean;
|
17
34
|
getParam<T extends string | undefined>(key: string | OneKey<string>, def?: T): T extends string ? string : string | undefined;
|
18
35
|
getParamResult(key: string, msgFn?: (key: string) => string): Result<string>;
|
19
|
-
getParamsResult(...keys:
|
36
|
+
getParamsResult(...keys: KeysParam): Result<Record<string, string>>;
|
20
37
|
clone(): R;
|
21
38
|
asURL(): URL;
|
22
39
|
toString(): string;
|
@@ -237,12 +254,8 @@ function getParamResult(
|
|
237
254
|
return Result.Ok(val);
|
238
255
|
}
|
239
256
|
|
240
|
-
type msgFn = (...keys: string[]) => string;
|
241
|
-
// if right head of Record is string the key used and the value is the default value
|
242
|
-
type keysParam = (string | msgFn | Record<string, unknown>)[];
|
243
|
-
|
244
257
|
function getParamsResult(
|
245
|
-
keys:
|
258
|
+
keys: KeysParam,
|
246
259
|
getParam: { getParam: (key: string) => string | undefined },
|
247
260
|
): Result<Record<string, string>> {
|
248
261
|
const keyDef = keys.flat().reduce(
|
@@ -425,7 +438,7 @@ export class BuildURI implements URIInterface<BuildURI> {
|
|
425
438
|
return getParamResult(key, this.getParam(key), msgFn);
|
426
439
|
}
|
427
440
|
|
428
|
-
getParamsResult(...keys:
|
441
|
+
getParamsResult(...keys: KeysParam): Result<Record<string, string>> {
|
429
442
|
return getParamsResult(keys, this);
|
430
443
|
}
|
431
444
|
|
@@ -577,7 +590,7 @@ export class URI implements URIInterface<URI> {
|
|
577
590
|
return getParamResult(key, this.getParam(key), msgFn);
|
578
591
|
}
|
579
592
|
|
580
|
-
getParamsResult(...keys:
|
593
|
+
getParamsResult(...keys: KeysParam): Result<Record<string, string>> {
|
581
594
|
return getParamsResult(keys, this);
|
582
595
|
}
|
583
596
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"base-sys-abstraction.d.ts","sourceRoot":"","sources":["../../src/base-sys-abstraction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC7G,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,qBAAa,OAAQ,SAAQ,IAAI;IAC/B,GAAG,IAAI,IAAI;IAGX,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAOvC;AAED,qBAAa,SAAU,SAAQ,IAAI;IACjC,GAAG,IAAI,IAAI;IAIX,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGvC;AAED,qB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OAAO,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAC7C,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,QAAQ,CAAC,cAAc,EAAE,aAAa,CAAC;IACvC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,cAAc,EAAE,aAAa,CAAC;gBAC3B,IAAI,EAAE,kBAAkB,EAAE,MAAM,CAAC,EAAE,2BAA2B;IAgC1E,IAAI,IAAI,IAAI;IAGZ,MAAM,IAAI,MAAM;IAGhB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAGrC,MAAM,IAAI,cAAc;IAGxB,MAAM,IAAI,cAAc;IAIxB,MAAM,IAAI,aAAa;IAGvB,UAAU,IAAI,WAAW;CAG1B"}
|
@@ -91,6 +91,30 @@ export class IdService {
|
|
91
91
|
}
|
92
92
|
}
|
93
93
|
}
|
94
|
+
function consumeReadableStream(reader, writeFn) {
|
95
|
+
reader
|
96
|
+
.read()
|
97
|
+
.then(({ done, value }) => {
|
98
|
+
if (done) {
|
99
|
+
return;
|
100
|
+
}
|
101
|
+
writeFn(value)
|
102
|
+
.then(() => {
|
103
|
+
consumeReadableStream(reader, writeFn);
|
104
|
+
})
|
105
|
+
.catch((e) => {
|
106
|
+
console.error("consumeReadableStream:writeFn", e);
|
107
|
+
});
|
108
|
+
})
|
109
|
+
.catch((e) => {
|
110
|
+
console.error("consumeReadableStream:read", e);
|
111
|
+
});
|
112
|
+
}
|
113
|
+
function CFWriteableStream(writeFn) {
|
114
|
+
const ts = new TransformStream();
|
115
|
+
consumeReadableStream(ts.readable.getReader(), writeFn);
|
116
|
+
return ts.writable;
|
117
|
+
}
|
94
118
|
export class BaseSysAbstraction {
|
95
119
|
constructor(params) {
|
96
120
|
this._time = new SysTime();
|
@@ -100,23 +124,13 @@ export class BaseSysAbstraction {
|
|
100
124
|
this._systemService = params.SystemService;
|
101
125
|
this._txtEnDe = params.TxtEnDecoder;
|
102
126
|
const decoder = this._txtEnDe;
|
103
|
-
this._stdout =
|
104
|
-
|
105
|
-
|
106
|
-
const decoded = decoder.decode(chunk);
|
107
|
-
console.log(decoded.trimEnd());
|
108
|
-
resolve();
|
109
|
-
});
|
110
|
-
},
|
127
|
+
this._stdout = CFWriteableStream(async (chunk) => {
|
128
|
+
const decoded = decoder.decode(chunk);
|
129
|
+
console.log(decoded.trimEnd());
|
111
130
|
});
|
112
|
-
this._stderr =
|
113
|
-
|
114
|
-
|
115
|
-
const decoded = decoder.decode(chunk);
|
116
|
-
console.error(decoded.trimEnd());
|
117
|
-
resolve();
|
118
|
-
});
|
119
|
-
},
|
131
|
+
this._stderr = CFWriteableStream(async (chunk) => {
|
132
|
+
const decoded = decoder.decode(chunk);
|
133
|
+
console.error(decoded.trimEnd());
|
120
134
|
});
|
121
135
|
}
|
122
136
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"base-sys-abstraction.js","sourceRoot":"","sources":["../../src/base-sys-abstraction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAA2C,MAAM,sBAAsB,CAAC;AAC7G,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,MAAM,OAAO,OAAQ,SAAQ,IAAI;IAC/B,GAAG;QACD,OAAO,IAAI,IAAI,EAAE,CAAC;IACpB,CAAC;IACD,KAAK,CAAC,QAAgB;QACpB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,UAAU,CAAC,GAAG,EAAE;gBACd,OAAO,EAAE,CAAC;YACZ,CAAC,EAAE,QAAQ,CAAC,CAAC;QACf,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,OAAO,SAAU,SAAQ,IAAI;IACjC,GAAG;QACD,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CA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MAAM,WAAW,UAAW,SAAQ,eAAe,CAAC,UAAU,CAAC;IAC7D,MAAM,IAAI,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,OAAO;IACtB,OAAO,IAAI,KAAK,CAAC;IACjB,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,MAAO,SAAQ,eAAe,CAAC,MAAM,CAAC;IACrD,IAAI,IAAI,UAAU,CAAC;IAEnB,GAAG,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAChC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB"}
|
package/ts/logger.js
CHANGED
@@ -53,7 +53,15 @@ export function logValue(val, state = new Set([Math.random()])) {
|
|
53
53
|
return new LogValue(() => "null");
|
54
54
|
}
|
55
55
|
if (ArrayBuffer.isView(val)) {
|
56
|
-
|
56
|
+
try {
|
57
|
+
const decoder = new TextDecoder();
|
58
|
+
const asStr = decoder.decode(val);
|
59
|
+
const obj = JSON.parse(asStr);
|
60
|
+
return logValue(obj, state);
|
61
|
+
}
|
62
|
+
catch (e) {
|
63
|
+
return logValue(bin2string(val, 512));
|
64
|
+
}
|
57
65
|
}
|
58
66
|
if (Array.isArray(val)) {
|
59
67
|
return new LogValue(() => val.map((v) => logValue(v).value()));
|
package/ts/logger.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,MAAM,CAAN,IAAY,KAKX;AALD,WAAY,KAAK;IACf,sBAAa,CAAA;IACb,wBAAe,CAAA;IACf,sBAAa,CAAA;IACb,wBAAe,CAAA;AACjB,CAAC,EALW,KAAK,KAAL,KAAK,QAKhB;AAKD,MAAM,OAAO,QAAQ;IACnB,YAAqB,EAAgB;QAAhB,OAAE,GAAF,EAAE,CAAc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