Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FormationProcessor<Data>

A base class for a formation processor. It will call derived functions with the correctly cast types as it walks the formation tree. It can be driven externally through the formation tree as an iterator.

example
class MyProcessor extends Processor<string> {
  // implement the abstract discourse processing functions
}

const processor = new Processor({ cache, id: 'the-starting-guid'});
await process.next();  // Process the formation
await process.next();  // Process the next formation
await process.next('a-guid-to-skip-to');  // Jump to a specific formation
for await (const id of process) {  // Process formations until the end of time
  console.log(`${id}`);
}

Type parameters

  • Data

Hierarchy

  • FormationProcessor

Implements

  • AsyncIterableIterator<IGuidImmutable>

Index

Constructors

constructor

Accessors

cache

discourse

features

  • get features(): ReadonlySet<string>

id

  • get id(): IGuidImmutable

link

  • The current formation link. This can be used to determine what the next formation will be. It is highly likely you will need to use redirect as well

    Returns ILinkImmutable | undefined

    undefined when the current formation is not known

meta

options

  • get options(): ILinkProcessOptions
  • set options(value: ILinkProcessOptions): void

redirect

  • get redirect(): IGuidImmutable | undefined
  • This is the current redirection state of the walker. This is used to ignore the link target and go straight to this GUID. This can be used with link to determine which formation will be walked to.

    Returns IGuidImmutable | undefined

start

  • get start(): IGuidImmutable

tags

  • get tags(): ReadonlyArray<string>

Methods

__@asyncIterator

  • __@asyncIterator(): AsyncIterableIterator<IGuidImmutable>

Protected Abstract expected

next

  • next(id?: GuidAccepted): Promise<IteratorResult<IGuidImmutable>>
  • Moves to the next formation.

    Parameters

    • Optional id: GuidAccepted

      can be provided to override the formation to move to

    Returns Promise<IteratorResult<IGuidImmutable>>

return

  • return(): Promise<IteratorResult<IGuidImmutable>>

Protected Abstract statement

throw

  • throw(error: Error): Promise<IteratorResult<IGuidImmutable>>
  • Throws an exception into the iterator. Cleans up the iterator and then throws the exception into the iterator context

    Parameters

    • error: Error

      the error given by the calling context into the iterator

    Returns Promise<IteratorResult<IGuidImmutable>>