@aws-amplify/graphql-schema-generator
Version:
Amplify GraphQL schema generator
27 lines • 689 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Schema = void 0;
class Schema {
constructor(engine) {
this.engine = engine;
this.models = [];
}
getModels() {
return this.models;
}
getEngine() {
return this.engine;
}
addModel(model) {
const modelName = model.getName();
if (this.hasModel(modelName)) {
throw new Error(`Model "${modelName}" already exists`);
}
this.models.push(model);
}
hasModel(name) {
return this.models.some((model) => model.getName() === name);
}
}
exports.Schema = Schema;
//# sourceMappingURL=schema.js.map