in src/commands/repair-package-data.ts [283:310]
for await (const { Contents: objects } of paginateListObjectsV2({ client: S3 }, { Bucket: bucketName, Prefix: prefix })) {
if (!objects) { continue; }
let matches: RegExpMatchArray | null = null;
for (const { Key: key } of objects) {
if (!key) { continue; }
if (key.endsWith('/assembly.json')) {
result.assemblyKey = key;
} else if (key.endsWith('/metadata.json')) {
result.metadataKey = key;
} else if (key.endsWith('/package.tgz')) {
result.tarballKey = key;
} else if ((matches = /^.*\/docs-([^-]+-)?([a-z]+)\.md(\.not-supported)?$/.exec(key)) != null) {
const [, submodule, lang, unsupported] = matches;
const status = unsupported ? DocStatus.UNSUPPORTED : DocStatus.PRESENT;
if (submodule) {
if (!result.submodules.has(submodule)) {
result.submodules.set(submodule, new Map());
}
result.submodules.get(submodule)!.set(lang, status);
} else {
result.docs.set(lang, status);
}
} else {
console.error(`Unexpected key could not be attributed to any document category: ${key}`);
process.exit(-1);
}
}
}