beyond
Version:
The Full Stack Universal Typescript Framework
44 lines (36 loc) • 1.42 kB
JavaScript
module.exports = class {
constructor(model) {
this.
}
async get(ids) {
if (!(ids instanceof Array)) throw new Error('Invalid parameters');
if (!ids.length) return;
ids = ids.map(id => `application//${id}`);
const collection = new this.
await collection.ready;
const promises = [];
collection.forEach(template => promises.push(template.global.ready));
await Promise.all(promises);
promises.size = 0;
collection.forEach(template => {
const processor = template.global.processors.get(this.
promises.push(processor.ready);
});
await Promise.all(promises);
const output = {};
for (const template of collection.values()) {
if (template.error) continue;
const processor = template.global.processors.get(this.
output[template.id] = {
id: template.id,
path: template.global.path,
processor: processor.instance?.name,
files: template.global.files,
errors: template.global.errors,
warnings: template.global.warnings,
};
}
return output;
}
}