lex-model-validator
Version:
Validate lex-language-models with ease.
74 lines (73 loc) • 2.57 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var __1 = require("../..");
var ResourceValidator = /** @class */ (function (_super) {
__extends(ResourceValidator, _super);
function ResourceValidator($master, $parent) {
var _this = _super.call(this, $master, $parent) || this;
_this.$master = $master;
_this.$parent = $parent;
return _this;
}
ResourceValidator.prototype.getConstraints = function () {
return {
resource: {
type: 'object'
},
'resource.name': {
type: 'string',
minLength: 2
},
'resource.version': {
type: 'string',
minLength: 1
},
'resource.locale': {
type: 'string',
minLength: 2
},
'resource.childDirected': {
type: 'boolean'
},
'resource.idleSessionTTLInSeconds': {
type: 'number',
min: 0
},
'resource.clarificationPrompt': {
type: 'object'
},
'resource.clarificationPrompt.messages': {
isArray: true,
minLength: 1,
validate: __1.VALIDATION_FUNCTION_STATEMENT_MESSAGES
},
'resource.clarificationPrompt.maxAttempts': {
type: 'number',
min: 1
},
'resource.abortStatement': {
type: 'object'
},
'resource.abortStatement.messages': {
isArray: true,
minLength: 1,
validate: __1.VALIDATION_FUNCTION_STATEMENT_MESSAGES
}
};
};
return ResourceValidator;
}(__1.Validator));
exports.ResourceValidator = ResourceValidator;