@amaabca/aws-lex-custom-resources
Version:
AWS Lex infrastructure as code via the CDK
33 lines (32 loc) • 923 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const __1 = require("..");
class default_1 {
constructor(props) {
this.props = props;
this.slots = [];
}
addSlot(props) {
let exists = false;
for (let i = 0; i < this.slots.length; i++) {
if (this.slots[i].props.slotName === props.slotName) {
exists = true;
break;
}
}
if (exists) {
throw new Error(`A slot with the name ${props.slotName} already exists!`);
}
else {
const slot = new __1.LexSlot(props);
this.slots.push(slot);
return slot;
}
}
definition() {
const configuration = { ...this.props };
configuration['CR.slots'] = this.slots.map((s) => s.definition());
return configuration;
}
}
exports.default = default_1;