async function writeSeedDataToApi(client, rawData) {
  let data = rawData || createDefaultDataset();
  data = JSON.parse(JSON.stringify(data));
  if (!data) throw new Error('TS cannot infer truth');

  if (rawData) {
    data.runs.forEach((run, i) => {
      run.lhr = rawData.runs[i].lhr;
    });
  }

  /** @type {Array<LHCI.ServerCommand.Project>} */
  const projects = [];
  for (const project of data.projects) {
    // @ts-expect-error - controlled deletion of test data, before sending to API.
    delete project.id;
    projects.push(await client.createProject(project));
  }

  /** @type {Array<LHCI.ServerCommand.Build>} */
  const builds = [];
  for (const build of data.builds) {
    // @ts-expect-error - controlled deletion of test data, before sending to API.
    delete build.id;
    const project = projects[Number(build.projectId)];
    build.projectId = project.id;
    build.lifecycle = 'unsealed';
    client.setBuildToken(project.token);
    builds.push(await client.createBuild(build));
  }

  for (const run of data.runs) {
    // @ts-expect-error - controlled deletion of test data, before sending to API.
    delete run.id;
    run.projectId = projects[Number(run.projectId)].id;
    run.buildId = builds[Number(run.buildId)].id;
    run.representative = false;
    await client.createRun({
      ...run,
      lhr:
        // @ts-expect-error - allow programmatic creation of LHR
        typeof run.lhr === 'function' ? run.lhr() : run.lhr,
    });
  }

  for (const build of builds) {
    await client.sealBuild(build.projectId, build.id);
  }
}
@param {ApiClient} client
@param {{projects: LHCI.ServerCommand.Project[], builds: LHCI.ServerCommand.Build[], runs: LHCI.ServerCommand.Run[]}} [rawData]