@vulcan-sql/build
Version:
VulcanSQL package for building projects
34 lines • 1.52 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DocumentGenerator = void 0;
const tslib_1 = require("tslib");
const core_1 = require("@vulcan-sql/core");
const inversify_1 = require("inversify");
const types_1 = require("../../containers/types");
let DocumentGenerator = class DocumentGenerator {
constructor(specGeneratorFactory, options, artifactBuilder) {
this.specGenerators = [];
for (const spec of options.specs) {
this.specGenerators.push(specGeneratorFactory(spec));
}
this.artifactBuilder = artifactBuilder;
}
generateDocuments(schemas) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const specs = {};
for (const generator of this.specGenerators) {
specs[generator.getExtensionId()] = generator.getSpec(schemas);
}
this.artifactBuilder.addArtifact(core_1.BuiltInArtifactKeys.Specs, specs);
});
}
};
DocumentGenerator = tslib_1.__decorate([
(0, inversify_1.injectable)(),
tslib_1.__param(0, (0, inversify_1.inject)(types_1.TYPES.Factory_SpecGenerator)),
tslib_1.__param(1, (0, inversify_1.inject)(core_1.TYPES.DocumentOptions)),
tslib_1.__param(2, (0, inversify_1.inject)(core_1.TYPES.ArtifactBuilder)),
tslib_1.__metadata("design:paramtypes", [Function, core_1.DocumentOptions, Object])
], DocumentGenerator);
exports.DocumentGenerator = DocumentGenerator;
//# sourceMappingURL=documentGenerator.js.map