plan method

Works out what applying request would change, without changing anything.

Implementation

Future<BlueprintPlanResult> plan(BlueprintPlanRequest request) async {
  final ledger = await ledgers.read(request.blueprint.blueprint.value);
  final reading = await _read(request.blueprint);
  final notes = [...reading.notes];

  return BlueprintPlanResult(
    requestId: request.requestId,
    changes: _diff(request.blueprint, reading.states, ledger, notes),
    states: reading.states.values.toList(),
    appliedHash: ledger?.hash ?? '',
    expectedHash: request.blueprint.hash,
    notes: notes,
  );
}