"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const normalize_1=require("./normalize"),responseCode_1=require("./responseCode");function validate(d,a,b=!1){try{b?d.validate(a,d.request.query):d.validate(a)}catch(a){console.error(a);const b=a.errors&&Array.isArray(a.errors)&&a.errors.length?a.errors.map(b=>`${b.message} ${b.field} ${b.code}`).join(", "):"param validation failed";return d.response.body=normalize_1.NMLResponse(responseCode_1.ResponseCode.PARAM_ERROR,null,b),!1}return!0}exports.validate=validate;