diff options
| author | Arman <[email protected]> | 2018-08-02 16:50:59 -0700 |
|---|---|---|
| committer | Arman <[email protected]> | 2018-08-02 16:50:59 -0700 |
| commit | 7d5a0696ccc642db0d14aae8677ecada40bf85d1 (patch) | |
| tree | 1bbbcf2f4c4a3a733326ac2401375f8d891cb2f1 /node_modules/har-validator/lib | |
| parent | dialog box for adding items (diff) | |
| download | launcher-7d5a0696ccc642db0d14aae8677ecada40bf85d1.tar.xz launcher-7d5a0696ccc642db0d14aae8677ecada40bf85d1.zip | |
inital commit
Diffstat (limited to 'node_modules/har-validator/lib')
| -rw-r--r-- | node_modules/har-validator/lib/async.js | 98 | ||||
| -rw-r--r-- | node_modules/har-validator/lib/error.js | 17 | ||||
| -rw-r--r-- | node_modules/har-validator/lib/promise.js | 95 |
3 files changed, 0 insertions, 210 deletions
diff --git a/node_modules/har-validator/lib/async.js b/node_modules/har-validator/lib/async.js deleted file mode 100644 index fc41667..0000000 --- a/node_modules/har-validator/lib/async.js +++ /dev/null @@ -1,98 +0,0 @@ -var Ajv = require('ajv') -var HARError = require('./error') -var schemas = require('har-schema') - -var ajv - -function validate (name, data, next) { - data = data || {} - - // validator config - ajv = ajv || new Ajv({ - allErrors: true, - schemas: schemas - }) - - var validate = ajv.getSchema(name + '.json') - - var valid = validate(data) - - // callback? - if (typeof next === 'function') { - return next(!valid ? new HARError(validate.errors) : null, valid) - } - - return valid -} - -exports.afterRequest = function (data, next) { - return validate('afterRequest', data, next) -} - -exports.beforeRequest = function (data, next) { - return validate('beforeRequest', data, next) -} - -exports.browser = function (data, next) { - return validate('browser', data, next) -} - -exports.cache = function (data, next) { - return validate('cache', data, next) -} - -exports.content = function (data, next) { - return validate('content', data, next) -} - -exports.cookie = function (data, next) { - return validate('cookie', data, next) -} - -exports.creator = function (data, next) { - return validate('creator', data, next) -} - -exports.entry = function (data, next) { - return validate('entry', data, next) -} - -exports.har = function (data, next) { - return validate('har', data, next) -} - -exports.header = function (data, next) { - return validate('header', data, next) -} - -exports.log = function (data, next) { - return validate('log', data, next) -} - -exports.page = function (data, next) { - return validate('page', data, next) -} - -exports.pageTimings = function (data, next) { - return validate('pageTimings', data, next) -} - -exports.postData = function (data, next) { - return validate('postData', data, next) -} - -exports.query = function (data, next) { - return validate('query', data, next) -} - -exports.request = function (data, next) { - return validate('request', data, next) -} - -exports.response = function (data, next) { - return validate('response', data, next) -} - -exports.timings = function (data, next) { - return validate('timings', data, next) -} diff --git a/node_modules/har-validator/lib/error.js b/node_modules/har-validator/lib/error.js deleted file mode 100644 index f2618dc..0000000 --- a/node_modules/har-validator/lib/error.js +++ /dev/null @@ -1,17 +0,0 @@ -function HARError (errors) { - var message = 'validation failed' - - this.name = 'HARError' - this.message = message - this.errors = errors - - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, this.constructor) - } else { - this.stack = (new Error(message)).stack - } -} - -HARError.prototype = Error.prototype - -module.exports = HARError diff --git a/node_modules/har-validator/lib/promise.js b/node_modules/har-validator/lib/promise.js deleted file mode 100644 index 1ab308c..0000000 --- a/node_modules/har-validator/lib/promise.js +++ /dev/null @@ -1,95 +0,0 @@ -var Ajv = require('ajv') -var HARError = require('./error') -var schemas = require('har-schema') - -var ajv - -function validate (name, data) { - data = data || {} - - // validator config - ajv = ajv || new Ajv({ - allErrors: true, - schemas: schemas - }) - - 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) -} |