chore: automated housekeeping...

This commit is contained in:
Pieter Vander Vennet 2024-07-21 10:52:51 +02:00
parent 14b2799f08
commit 4add2d1aff
151 changed files with 4561 additions and 3315 deletions

View file

@ -41,7 +41,7 @@ export abstract class Conversion<TIn, TOut> {
fixed = this.convert(json, context)
} catch (e) {
console.error(e)
context.err("ERROR WHILE RUNNING STEP " + this.name+": "+e)
context.err("ERROR WHILE RUNNING STEP " + this.name + ": " + e)
fixed = undefined
}
for (const msg of context.messages) {
@ -54,12 +54,11 @@ export abstract class Conversion<TIn, TOut> {
throw new Error(
[
"Detected one or more errors, stopping now:",
context.getAll("error").map((e) => e.context.path.join(".") + ": " + e.message)
context.getAll("error").map((e) => e.context.path.join(".") + ": " + e.message),
].join("\n\t")
)
}
return fixed
}
public andThenF<X>(f: (tout: TOut) => X): Conversion<TIn, X> {
@ -69,8 +68,7 @@ export abstract class Conversion<TIn, TOut> {
public abstract convert(json: TIn, context: ConversionContext): TOut
}
export abstract class DesugaringStep<T> extends Conversion<T, T> {
}
export abstract class DesugaringStep<T> extends Conversion<T, T> {}
export class Pipe<TIn, TInter, TOut> extends Conversion<TIn, TOut> {
private readonly _step0: Conversion<TIn, TInter>
@ -257,7 +255,7 @@ export class Cached<TIn, TOut> extends Conversion<TIn, TOut> {
const converted = this._step.convert(json, context)
Object.defineProperty(json, this.key, {
value: converted,
enumerable: false
enumerable: false,
})
return converted
}
@ -270,8 +268,8 @@ export class Fuse<T> extends DesugaringStep<T> {
constructor(doc: string, ...steps: DesugaringStep<T>[]) {
super(
(doc ?? "") +
"This fused pipeline of the following steps: " +
steps.map((s) => s.name).join(", "),
"This fused pipeline of the following steps: " +
steps.map((s) => s.name).join(", "),
Utils.Dedup([].concat(...steps.map((step) => step.modifiedAttributes))),
"Fuse(" + steps.map((s) => s.name).join(", ") + ")"
)