UNPKG

@firfi/quint-connect

Version:

Model-based testing framework connecting Quint specifications to TypeScript implementations

19 lines 999 B
import { ITFVariant, UntypedTraceSchema } from "@firfi/itf-trace-parser/effect"; import { Schema } from "effect"; export { ITFBigInt, ITFList, ITFMap, ITFSet, ITFTuple, ITFUnserializable, ITFVariant, UntypedTraceSchema } from "@firfi/itf-trace-parser/effect"; // Quint encodes nondet picks as Option variants: // Some(x) = { tag: "Some", value: x } // None = { tag: "None", value: { "#tup": [] } } export const ItfOption = (inner) => Schema.transform(ITFVariant({ Some: inner, None: Schema.Unknown }), Schema.UndefinedOr(Schema.typeSchema(inner)), { strict: true, decode: (v) => v.tag === "Some" ? v.value : undefined, encode: (v) => v !== undefined ? { tag: "Some", value: v } : { tag: "None", value: { "#tup": [] } } }); export const MbtMeta = Schema.Struct({ "mbt::actionTaken": Schema.String, "mbt::nondetPicks": Schema.Record({ key: Schema.String, value: Schema.Unknown }) }); export const ItfTrace = UntypedTraceSchema; //# sourceMappingURL=schema.js.map