FDO SDK API Reference
    Preparing search index...

    Interface FDOGraph<RecordType>

    Represents a graph of FDO records, where each node is a record and each edge is a reference from one record to another.

    interface FDOGraph<RecordType extends FDORecord = FDORecord> {
        addRecord(
            record: FDORecord,
            options?: Partial<{ overwrite: boolean }>,
        ): void;
        build(): void;
        findRecord(predicate: (r: RecordType) => boolean): RecordType | undefined;
        getRecord(id: string): RecordType | undefined;
        getRecords(): RecordType[];
        removeRecord(id: string): void;
        toJSON(): Record<string, Record<string, RecordValue>>[];
        toString(): string;
    }

    Type Parameters

    Hierarchy (View Summary)

    Implemented by

    Index
    • Add a new record to the graph. If a record with the same identifier already exists, it will be silently overwritten.

      Parameters

      • record: FDORecord
      • Optionaloptions: Partial<{ overwrite: boolean }>

        Options for the add record method (e.g. overwrite)

      Returns void

    • Executes all recorded references, i.e. for every reference declaration the target record receives a back-reference via its toAttribute.

      Returns void

    • Find a record within the graph based on the predicate function. Returns the first match with arbitrary ordering.

      Parameters

      • predicate: (r: RecordType) => boolean

        Function that should evaluate to true for the record that should be returned.

      Returns RecordType | undefined

      the first record that matches the predicate, or undefined if no record matches the predicate

    • Remove a record in this graph by its local ID or global PID

      Parameters

      • id: string

        local identifier or global PID of the record to remove

      Returns void