Interface Planner

Interface representing a Planner responsible for generating and executing initialization and mutation plans for templates in a TemplateProcessor.

interface Planner {
    execute(plan): Promise<void>;
    executeDataChangeCallbacks(plan): Promise<void>;
    from(jsonPtr): string[];
    fromJSON(plan, snapshot, forks): ExecutionPlan;
    getInitializationPlan(jsonPointer): ExecutionPlan;
    getMutationPlan(jsonPtr, data, op): [ExecutionPlan, string[]];
    toJSON(mutationPlan): SerializableExecutionPlan;
}

Implemented by

Methods

  • Executes the specified execution plan.

    This method runs any plan that the Planner has generated, applying its operations to the template or its components.

    Parameters

    Returns Promise<void>

    A promise that resolves once execution is complete.

  • Returns a 'total ordering' of the dependency graph. A single array of JSON pointers is returned. From always uses the SerialPlanner therefore the returned array of json pointers should only be literally interpreted as the execution plan order when you are using a SerialPlanner. However, the point of from() is to give users of the command line a concise report on which parts of the output the dag will propagate to. In other words, the 'effects' that flow downstream from a mutation applied to jsonPtr

    Parameters

    • jsonPtr: string

    Returns string[]

    JsonPointerString[]

  • This is the inverse of the toJSON. It takes a serializable execution plan and returns an object that can be used in the runtime.The snapshot is necessary because it contains normalization structures that have to be used to rehydrate an ExecutionPlan from a SerializableExecutionPlan

    Parameters

    Returns ExecutionPlan

  • Generates an initialization plan for the specified JSON pointer.

    This method is typically queued by the TemplateProcessor during initialization. While the jsonPointer is often / (the root), it may point to a specific location in the template when $import is called to initialize an imported template.

    Parameters

    • jsonPointer: string

      The JSON pointer indicating the location for initialization.

    Returns ExecutionPlan

    The generated ExecutionPlan for initialization.

  • Generates a mutation plan for the specified JSON pointer and operation.

    This method creates a plan responsible for performing mutations on the template. Supported operations include initialize, set, delete, and forceSetInternal.

    Parameters

    • jsonPtr: string
    • data: any
    • op: Op

      The operation to perform. Supported values: "initialize", "set", "delete", "forceSetInternal".

    Returns [ExecutionPlan, string[]]

    [ExecutionPlan, JsonPointerString[]] The generated ExecutionPlan for the mutation and an array telling which expressions must be transitively re-evaluated as a result of the mutation.

    See

    Op

Generated using TypeDoc