lambdaorm-base
Version:
78 lines • 2.54 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SchemaService = void 0;
class SchemaService {
newSchema() {
return { version: '0.0.1', domain: this.newDomain() };
}
newInfrastructure() {
return { paths: this.newPathsApp(), mappings: [], sources: [], stages: [] };
}
newDomain() {
return { version: '0.0.1', entities: [] };
}
newApplication() {
return undefined;
}
newPathsApp() {
return { src: 'src', state: 'orm_state', domain: 'domain' };
}
complete(schema) {
if (!schema.domain) {
schema.domain = this.newDomain();
}
else {
if (!schema.domain.enums) {
schema.domain.enums = [];
}
if (!schema.domain.entities) {
schema.domain.entities = [];
}
}
if (!schema.infrastructure) {
schema.infrastructure = this.newInfrastructure();
}
else {
if (!schema.infrastructure.mappings) {
schema.infrastructure.mappings = [];
}
if (!schema.infrastructure.sources) {
schema.infrastructure.sources = [];
}
if (!schema.infrastructure.stages) {
schema.infrastructure.stages = [];
}
if (!schema.infrastructure.paths) {
schema.infrastructure.paths = this.newPathsApp();
}
if (!schema.infrastructure.paths.src) {
schema.infrastructure.paths.src = 'src';
}
if (!schema.infrastructure.paths.state) {
schema.infrastructure.paths.state = 'orm_state';
}
if (!schema.infrastructure.paths.domain) {
schema.infrastructure.paths.domain = 'domain';
}
if (!schema.infrastructure.views) {
schema.infrastructure.views = [];
}
}
if (!schema.application) {
schema.application = this.newApplication();
}
else {
if (!schema.application.start) {
schema.application.start = [];
}
if (!schema.application.end) {
schema.application.end = [];
}
if (!schema.application.listeners) {
schema.application.listeners = [];
}
}
}
}
exports.SchemaService = SchemaService;
//# sourceMappingURL=schemaService.js.map