Skip to main content

@svatah/yam-spec

Flow reader, grammar, target dictionary, signatures

Exports

ExportKindSignature
ApiCatalogueinterfaceexport interface ApiCatalogue
buildApiCataloguefunctionexport function buildApiCatalogue(Build a catalogue from files already read, rejecting duplicate names.
dataAtfunctionexport function dataAt(data: ProjectData, path: string): unknownRead one dotted path, for {data.user.email}.
DEFAULT_METAvariableDEFAULT_META: StoryMeta = { enabled: true, onFailure: "stop", tags: [] }
diagnosticfunctionexport function diagnostic(
Diagnosticinterfaceexport interface Diagnostic
DiagnosticCodetypealiasexport type DiagnosticCode = ErrorCode | WarningCode;
DictionaryEntryinterfaceexport interface DictionaryEntry
elementIdfunctionexport function elementId(phrase: string): stringA target phrase's element id: the leading article dropped, lower-cased, every
EMPTY_APISvariableEMPTY_APIS: ApiCatalogue = { requests: new Map(), files: new Map() }
EMPTY_DATAvariableEMPTY_DATA: ProjectData = { values: {}, secrets: new Set() }
ERROR_CODESvariableERROR_CODES = [Codes that fail a compile.
ErrorCodetypealiasexport type ErrorCode = (typeof ERROR_CODES)[number];
errorsInfunctionexport function errorsIn(diagnostics: readonly Diagnostic[]): Diagnostic[]The errors among a set of diagnostics.
FlowBlocktypealiasexport type FlowBlock = StoryBlock | ListBlock;
FlowFileinterfaceexport interface FlowFile
formatDiagnosticfunctionexport function formatDiagnostic(diagnostic: Diagnostic): stringOne line per diagnostic, in the shape editors and terminals both parse.
generateActionsYamlfunctionexport function generateActionsYaml(vocabulary: readonly Verb[] = VOCABULARY): stringThe exact bytes packages/spec/actions.yaml holds.
isEmptySignaturefunctionexport function isEmpty(signature: Signature): booleanWhether a signature says anything, so an empty one is left off the story.
isErrorfunctionexport function isError(code: DiagnosticCode): boolean
isRunBlockfunctionexport function isRunBlock(block: FlowBlock): block is ListBlock
isSecretPathfunctionexport function isSecretPath(data: ProjectData, path: string): booleanWhether a dotted path was declared secret, or sits under one that was.
isStoryBlockfunctionexport function isStoryBlock(block: FlowBlock): block is StoryBlock
ListBlockinterfaceexport interface ListBlockA compose: or test:/run: block: a name and an ordered list of names.
META_KEYSvariableMETA_KEYS = [The keys REQ-LANG-2 allows, and nothing else.
normaliseWordsfunctionexport function normaliseWords(text: string): stringLower-cased, whitespace collapsed. Nothing else.
parseMetafunctionexport function parseMeta(raw: string, where: Where): { meta: StoryMeta; diagnostics: Diagnostic[] }Parse the metadata inside a header's parentheses.
parseOnFailurefunctionexport function parseOnFailure(stop | continue | compensate:<story> (REQ-AUTO-4).
parseTargetsfunctionexport function parseTargets(Read a targets.yaml body.
phraseKeyfunctionexport function phraseKey(phrase: string): stringThe form two phrases are compared by when deciding they name the same thing.
Projectinterfaceexport interface Project
ProjectDatainterfaceexport interface ProjectData
ProjectPathsinterfaceexport interface ProjectPaths
ProjectSourceinterfaceexport interface ProjectSource
RawStepinterfaceexport interface RawStepA step line, with the guard that applies to it if there is one.
readApiRequestfunctionexport function readApiRequest(Read one api/*.yaml.
readDatafunctionexport function readData(Read data.yaml (or a JSON file with the same shape).
readFlowfunctionexport function readFlow(text: string, file: string): { flow: FlowFile; diagnostics: Diagnostic[] }Read one flow file.
readProjectfunctionexport function readProject(source: ProjectSource):
readProjectFromfunctionexport function readProjectFrom(paths: ProjectPaths):Read a project from disk. Paths in diagnostics are relative to root.
readSignatureLinefunctionexport function readSignatureLine(Read one inputs: or outputs: line into the signature being built.
StoryBlockinterfaceexport interface StoryBlock
TargetDeclarationtypealiasexport type TargetDeclaration What targets.yaml may say about one element.
TargetDictionaryclassexport class TargetDictionary
TargetResolutioninterfaceexport interface TargetResolution
TargetScopetypealiasexport type TargetScope = "page" | "dialog" | "frame" | "desktop" | "window";Where an element lives, when it is not on the page itself (LLD §3.2).
TargetStatustypealiasexport type TargetStatus = "bound" | "unbound" | "ambiguous";
Verbinterfaceexport interface Verb
VerbMatchinterfaceexport interface VerbMatch
VERBSvariableVERBS = new VerbTrie()The vocabulary as one trie, built once.
VerbTrieclassexport class VerbTrie
VOCABULARYvariableVOCABULARY: readonly Verb[] = [
WARNING_CODESvariableWARNING_CODES = [Codes yam lint reports without failing.
WarningCodetypealiasexport type WarningCode = (typeof WARNING_CODES)[number];