mirror of
https://github.com/azure/login.git
synced 2026-03-15 09:20:56 -04:00
* Bump lodash from 4.17.15 to 4.17.19 (#52) Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Amruta Kawade <65217380+AmrutaKawade@users.noreply.github.com> * Bump @actions/core from 1.1.3 to 1.2.6 (#60) Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.1.3 to 1.2.6. - [Release notes](https://github.com/actions/toolkit/releases) - [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md) - [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Amruta Kawade <65217380+AmrutaKawade@users.noreply.github.com> * updating node_nodules * updated package-lock Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
103 lines
1.9 KiB
JavaScript
103 lines
1.9 KiB
JavaScript
var Ajv = require('ajv')
|
|
var HARError = require('./error')
|
|
var schemas = require('har-schema')
|
|
|
|
var ajv
|
|
|
|
function createAjvInstance () {
|
|
var ajv = new Ajv({
|
|
allErrors: true
|
|
})
|
|
ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-06.json'))
|
|
ajv.addSchema(schemas)
|
|
|
|
return ajv
|
|
}
|
|
|
|
function validate (name, data) {
|
|
data = data || {}
|
|
|
|
// validator config
|
|
ajv = ajv || createAjvInstance()
|
|
|
|
var validate = ajv.getSchema(name + '.json')
|
|
|
|
return new Promise(function (resolve, reject) {
|
|
var valid = validate(data)
|
|
|
|
!valid ? reject(new HARError(validate.errors)) : resolve(data)
|
|
})
|
|
}
|
|
|
|
exports.afterRequest = function (data) {
|
|
return validate('afterRequest', data)
|
|
}
|
|
|
|
exports.beforeRequest = function (data) {
|
|
return validate('beforeRequest', data)
|
|
}
|
|
|
|
exports.browser = function (data) {
|
|
return validate('browser', data)
|
|
}
|
|
|
|
exports.cache = function (data) {
|
|
return validate('cache', data)
|
|
}
|
|
|
|
exports.content = function (data) {
|
|
return validate('content', data)
|
|
}
|
|
|
|
exports.cookie = function (data) {
|
|
return validate('cookie', data)
|
|
}
|
|
|
|
exports.creator = function (data) {
|
|
return validate('creator', data)
|
|
}
|
|
|
|
exports.entry = function (data) {
|
|
return validate('entry', data)
|
|
}
|
|
|
|
exports.har = function (data) {
|
|
return validate('har', data)
|
|
}
|
|
|
|
exports.header = function (data) {
|
|
return validate('header', data)
|
|
}
|
|
|
|
exports.log = function (data) {
|
|
return validate('log', data)
|
|
}
|
|
|
|
exports.page = function (data) {
|
|
return validate('page', data)
|
|
}
|
|
|
|
exports.pageTimings = function (data) {
|
|
return validate('pageTimings', data)
|
|
}
|
|
|
|
exports.postData = function (data) {
|
|
return validate('postData', data)
|
|
}
|
|
|
|
exports.query = function (data) {
|
|
return validate('query', data)
|
|
}
|
|
|
|
exports.request = function (data) {
|
|
return validate('request', data)
|
|
}
|
|
|
|
exports.response = function (data) {
|
|
return validate('response', data)
|
|
}
|
|
|
|
exports.timings = function (data) {
|
|
return validate('timings', data)
|
|
}
|