_validateIndex : function _validateIndex(options) { return validateOptions(options, { unique: { is : ["boolean", "undefined"] }, multiEntry : { is : ["boolean", "undefined"] } }); },
_validateObjectStore : function _validateObjectStore(options) { return validateOptions(options, { keyPath: { is : ["string", "null", "undefined"] }, autoIncrement : { is : ["boolean", "undefined"] } }); },
let validate = exports.validate = function (packet) { //let errors = []; //let good = true; let rules = { "person_id": vstring('person_id', false), // "c1dd81f2-6ece-11e4-8a01-843a4bc832e4", "survey_id": vstring('survey_id', false), //"lunch", "flow_id": vstring('flow_id', false), // "20141117_attempt1", "question_id": vstring('question_id', false), //"howwaslunch", "response_version": vNumber("response_version", false), // 1 "updated_ts": vTimestamp('updated_ts', false), // 1416011156000, "question_text": vstring('question_text', false), //"how was lunch?", "variation_id": vstring('variation_id', false), // "1", "experiment_version": vstring('experiment_version', false), // "1" // fields for this study... "score": vScore("score"), // null, 0 is a valid score for nps "max_score": vScore("max_score"), // "flow_began_ts": vTimestamp("flow_began_ts"), // "flow_offered_ts": vTimestamp("flow_offered_ts"), // "flow_voted_ts": vTimestamp("flow_voted_ts"), // "flow_engaged_ts": vTimestamp("flow_engaged_ts"), // // system "platform": vstring('platform', false), // "channel": vstring('channel', false), // "version": vstring('version', false), // "locale": vstring('locale', false), // "build_id": vstring('build_id', false), // "partner_id": vstring('partner_id', false), // "profile_age": vNumber('profile_age'), // "profile_usage": vJsonableObject("profile_usage"), // "addons": vJsonableObject("addons"), // lets do {addons} ... vArray("addons"), // "extra": vJsonableObject("extra"), // is packet real? "is_test": vboolean('is_test'), //true }; return apiUtils.validateOptions(packet, rules); };