async function getSharedCredentialsLegacyFormat()

in update-script.js [26:44]


async function getSharedCredentialsLegacyFormat() {
  const credentialEntries = await Promise.all([
    getSourceRecords(SHARED_CREDENTIALS_API_ENDPOINT),
    getSourceRecords(SHARED_CREDENTIALS_HISTORICAL_API_ENDPOINT),
  ]);
  const legacyOutput = [];

  for (const entry of credentialEntries.flat()) {
    if (entry.shared) {
      legacyOutput.push(entry.shared);
    } else if (entry.from && entry.to) {
      legacyOutput.push([...entry.from, ...entry.to]);
    } else {
      console.error("ERROR: Could not convert entry to legacy format.", entry);
    }
  }

  return legacyOutput.sort();
}