@antithesishq/ bombadil/ actions #
Exports #
ActionGenerator #
A generator of action templates. Instances of this type is what you need to export from your specification module in order for Bombadil to register your generators.
class ActionGenerator<A> {
generate: () => Tree<A>;
constructor(generate: () => Tree<A>);
}CharSet #
Encodes characther ranges or literal strings for use in action templates, where Bombadil will generate concrete strings based on the charsets.
namespace CharSet {
type Entry = {
Range: Range;
} | {
Literal: string;
};
type Entries = Entry[];
function fromRange(from: number, to: number): CharSet.Entries;
function fromLiterals(...literals: string[]): CharSet.Entries;
function union(...sets: CharSet.Entries[]): CharSet.Entries;
}Range #
type Range = number | [number, number]StringGenerator #
type StringGenerator = "Email" | {
Text: Range;
} | {
CharSet: CharSet.Entries;
} | {
Regexp: string;
}Tree #
type Tree<T> = {
value: T;
} | {
branches: [number, Tree<T>][];
}actions #
function actions<A>(generate: () => Tree<A> | A[]): ActionGenerator<A>;branch #
function branch<T>(branches: [number, Tree<T>][]): Tree<T>;leaf #
function leaf<T>(value: T): Tree<T>;weighted #
function weighted<A>(value: [number, A | ActionGenerator<A>][]): ActionGenerator<A>;