API

Interface IFlowGraphHostResolver

Lets the environment hosting a flow graph decide how runtime entities are represented as opaque reference values, so the graph engine itself stays agnostic of the host's object model.

A host (e.g. a glTF loader extension) provides an implementation through IFlowGraphCoordinatorConfiguration.hostResolver. Every member is optional; the engine falls back to a neutral built-in representation for anything the host does not provide.

interface IFlowGraphHostResolver {
    decodeEventReference?(reference: string): string | undefined;
    decodeIndexReference?(
        reference: string,
        collection?: string,
    ): number | undefined;
    encodeEventReference?(key: string): string;
    getObjectReference?(object: object, hint?: string): string | undefined;
}
Index
  • Decodes the array index denoted by a reference, for cases where a reference addresses an element of one of the host's collections. Must return undefined for values the host does not recognise as an indexed reference.

    Parameters

    • reference: string

      the reference to decode

    • Optionalcollection: string

      optional host collection the decoded reference must address

    Returns number | undefined

    the index the reference denotes, or undefined when it does not denote one

  • Encodes an event source key as the opaque reference exposed by event blocks on their event output.

    References must be stable: two calls with the same key must produce equal values so that equality comparisons of two event outputs of the same source succeed.

    Parameters

    • key: string

      the event source key

    Returns string

    the reference representing the event source

  • Maps a runtime object to the reference the host addresses it by, for example the JSON Pointer of the resource a loaded object originates from.

    Used when an object value is supplied to a templated path input. Returning undefined means the host cannot address the object, and the value is rejected.

    Parameters

    • object: object

      the runtime object to address

    • Optionalhint: string

      optional disambiguation hint, taken from the path segment preceding the template parameter being resolved. A single object may be addressable in several ways, and the hint tells the host which kind of reference the graph is asking for.

    Returns string | undefined

    the reference for the object, or undefined when it cannot be addressed