patchRun method

int patchRun(
  1. String runId,
  2. List<JsonMap> ops
)

Applies the RFC 6902 ops (add, replace, remove) to the document of runId, raises its version and returns the previous version (04 11.2).

Implementation

int patchRun(String runId, List<JsonMap> ops) {
  final run = runs[runId]!;
  final base = run['version']! as int;
  for (final op in ops) {
    _applyOp(run, op);
  }
  run['version'] = base + 1;
  for (final hook in List.of(runPatchHooks)) {
    hook(runId, base, base + 1, [for (final op in ops) _copy(op)]);
  }
  return base;
}