Socket
Socket
Sign inDemoInstall

grunt-tv4

Package Overview
Dependencies
Maintainers
0
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-tv4 - npm Package Compare versions

Comparing version 5.0.1 to 5.0.2

generate-cert.sh

30

CHANGELOG.md

@@ -5,2 +5,30 @@ # Change Log

## [5.0.2] - 2024-07-09
### Added
- @snyk/protect
- npm-run-all2
- volta pin node@10 and npm@6
### Updated
- Updated code to match new xo rules
- grunt@1.5.3
- miniwrite@0.1.4
- prettier@2.8.8
- tv4-reporter@4.3.3
- tv4@1.3.0
- xo@0.39.1
- actions/checkout@v4
- actions/setup-node@v4
- github/codeql-action/analyze@v3
- github/codeql-action/autobuild@v3
- github/codeql-action/init@v3
### Removed
- npm-run-all
- snyk (use @snyk/protect instead)
## [5.0.1] - 2020-11-21
### Added
- https support, and tests to verify this
## [5.0.0] - 2020-11-20

@@ -210,2 +238,4 @@

[5.0.2]: https://github.com/timbeadle/grunt-tv4/compare/5.0.1...5.0.2
[5.0.1]: https://github.com/timbeadle/grunt-tv4/compare/5.0.0...5.0.1
[5.0.0]: https://github.com/timbeadle/grunt-tv4/compare/4.2.0...5.0.0

@@ -212,0 +242,0 @@ [4.2.0]: https://github.com/timbeadle/grunt-tv4/compare/4.1.0...4.2.0

229

Gruntfile.js

@@ -33,3 +33,3 @@ /*

options: {
configFile: '.eslintrc.yml'
configFile: '.eslintrc.yml',
},

@@ -39,4 +39,4 @@ src: [

'lib/**/*.js',
'tasks/**/*.js'
]
'tasks/**/*.js',
],
},

@@ -48,3 +48,3 @@ connect: {

base: 'test/fixtures/',
}
},
},

@@ -56,4 +56,4 @@ https: {

protocol: 'https',
}
}
},
},
},

@@ -65,7 +65,7 @@ tv4: {

fresh: true,
root: 'test/fixtures/object_props/schema.json'
root: 'test/fixtures/object_props/schema.json',
},
src: [
'test/fixtures/object_props/pass_a.json'
]
'test/fixtures/object_props/pass_a.json',
],
},

@@ -75,3 +75,3 @@ pass_many: {

fresh: true,
root: 'test/fixtures/object_props/schema.json'
root: 'test/fixtures/object_props/schema.json',
},

@@ -81,4 +81,4 @@ src: [

'test/fixtures/object_props/pass_b.json',
'test/fixtures/object_props/pass_c.json'
]
'test/fixtures/object_props/pass_c.json',
],
},

@@ -89,8 +89,8 @@ pass_remote: {

fresh: true,
root: 'http://localhost:9090/remote/schema/schema.json'
root: 'http://127.0.0.1:9090/remote/schema/schema.json',
},
src: [
'test/fixtures/remote/pass.json',
'test/fixtures/remote/pass.json'
]
'test/fixtures/remote/pass.json',
],
},

@@ -101,8 +101,8 @@ pass_remote_https: {

fresh: true,
root: 'https://localhost:9091/remote-https/schema/schema.json'
root: 'https://127.0.0.1:9091/remote-https/schema/schema.json',
},
src: [
'test/fixtures/remote-https/pass.json',
'test/fixtures/remote-https/pass.json'
]
'test/fixtures/remote-https/pass.json',
],
},

@@ -113,8 +113,8 @@ pass_remote_local: {

fresh: true,
root: 'test/fixtures/remote/schema/schema.json'
root: 'test/fixtures/remote/schema/schema.json',
},
src: [
'test/fixtures/remote/pass.json',
'test/fixtures/remote/pass.json'
]
'test/fixtures/remote/pass.json',
],
},

@@ -124,8 +124,8 @@ fail_single: {

fresh: true,
root: 'test/fixtures/object_props/schema.json'
root: 'test/fixtures/object_props/schema.json',
},
src: [
'test/fixtures/object_props/pass_a.json',
'test/fixtures/object_props/fail_a.json'
]
'test/fixtures/object_props/fail_a.json',
],
},

@@ -136,7 +136,7 @@ fail_multi: {

multi: true,
root: 'test/fixtures/object_props/schema.json'
root: 'test/fixtures/object_props/schema.json',
},
src: [
'test/fixtures/object_props/fail_a.json'
]
'test/fixtures/object_props/fail_a.json',
],
},

@@ -147,3 +147,3 @@ fail_many_multi: {

multi: true,
root: 'test/fixtures/object_props/schema.json'
root: 'test/fixtures/object_props/schema.json',
},

@@ -153,4 +153,4 @@ src: [

'test/fixtures/object_props/fail_b.json',
'test/fixtures/object_props/fail_c.json'
]
'test/fixtures/object_props/fail_c.json',
],
},

@@ -160,7 +160,7 @@ fail_remote: {

fresh: true,
root: 'http://localhost:9090/remote/schema/schema.json'
root: 'http://127.0.0.1:9090/remote/schema/schema.json',
},
src: [
'test/fixtures/remote/fail.json'
]
'test/fixtures/remote/fail.json',
],
},

@@ -170,7 +170,7 @@ fail_remote_https: {

fresh: true,
root: 'https://localhost:9091/remote-https/schema/schema.json'
root: 'https://127.0.0.1:9091/remote-https/schema/schema.json',
},
src: [
'test/fixtures/remote-https/fail.json'
]
'test/fixtures/remote-https/fail.json',
],
},

@@ -180,7 +180,7 @@ fail_remoteNotFound: {

fresh: true,
root: 'http://localhost:9090/remote/schema/non-existing.json'
root: 'http://127.0.0.1:9090/remote/schema/non-existing.json',
},
src: [
'test/fixtures/remote/pass.json'
]
'test/fixtures/remote/pass.json',
],
},

@@ -190,7 +190,7 @@ fail_remoteNotFound_https: {

fresh: true,
root: 'https://localhost:9091/remote-https/schema/non-existing.json'
root: 'https://127.0.0.1:9091/remote-https/schema/non-existing.json',
},
src: [
'test/fixtures/remote-https/pass.json'
]
'test/fixtures/remote-https/pass.json',
],
},

@@ -202,8 +202,8 @@ pass_format: {

formats: {
date: dateValidateCallback
}
date: dateValidateCallback,
},
},
src: [
'test/fixtures/format/pass.json'
]
'test/fixtures/format/pass.json',
],
},

@@ -215,8 +215,8 @@ fail_format: {

formats: {
'date': dateValidateCallback
}
date: dateValidateCallback,
},
},
src: [
'test/fixtures/format/fail.json'
]
'test/fixtures/format/fail.json',
],
},

@@ -229,9 +229,9 @@ pass_bulk: {

grunt.file.readJSON('test/fixtures/bulk/schema/alpha.json'),
grunt.file.readJSON('test/fixtures/bulk/schema/beta.json')
]
grunt.file.readJSON('test/fixtures/bulk/schema/beta.json'),
],
},
src: [
'test/fixtures/bulk/pass.json',
'test/fixtures/bulk/pass.json'
]
'test/fixtures/bulk/pass.json',
],
},

@@ -244,8 +244,8 @@ fail_bulk: {

grunt.file.readJSON('test/fixtures/bulk/schema/alpha.json'),
grunt.file.readJSON('test/fixtures/bulk/schema/beta.json')
]
grunt.file.readJSON('test/fixtures/bulk/schema/beta.json'),
],
},
src: [
'test/fixtures/bulk/fail.json'
]
'test/fixtures/bulk/fail.json',
],
},

@@ -258,9 +258,9 @@ pass_rootObject: {

grunt.file.readJSON('test/fixtures/bulk/schema/alpha.json'),
grunt.file.readJSON('test/fixtures/bulk/schema/beta.json')
]
grunt.file.readJSON('test/fixtures/bulk/schema/beta.json'),
],
},
src: [
'test/fixtures/bulk/pass.json',
'test/fixtures/bulk/pass.json'
]
'test/fixtures/bulk/pass.json',
],
},

@@ -270,14 +270,12 @@ pass_rootObject_cb: {

fresh: true,
root: () => {
return grunt.file.readJSON('test/fixtures/bulk/schema/schema.json');
},
root: () => grunt.file.readJSON('test/fixtures/bulk/schema/schema.json'),
add: [
grunt.file.readJSON('test/fixtures/bulk/schema/alpha.json'),
grunt.file.readJSON('test/fixtures/bulk/schema/beta.json')
]
grunt.file.readJSON('test/fixtures/bulk/schema/beta.json'),
],
},
src: [
'test/fixtures/bulk/pass.json',
'test/fixtures/bulk/pass.json'
]
'test/fixtures/bulk/pass.json',
],
},

@@ -288,13 +286,11 @@ pass_rootObject_add_cb: {

root: grunt.file.readJSON('test/fixtures/bulk/schema/schema.json'),
add: () => {
return [
grunt.file.readJSON('test/fixtures/bulk/schema/alpha.json'),
grunt.file.readJSON('test/fixtures/bulk/schema/beta.json')
];
}
add: () => [
grunt.file.readJSON('test/fixtures/bulk/schema/alpha.json'),
grunt.file.readJSON('test/fixtures/bulk/schema/beta.json'),
],
},
src: [
'test/fixtures/bulk/pass.json',
'test/fixtures/bulk/pass.json'
]
'test/fixtures/bulk/pass.json',
],
},

@@ -307,8 +303,8 @@ fail_rootObject: {

grunt.file.readJSON('test/fixtures/bulk/schema/alpha.json'),
grunt.file.readJSON('test/fixtures/bulk/schema/beta.json')
]
grunt.file.readJSON('test/fixtures/bulk/schema/beta.json'),
],
},
src: [
'test/fixtures/bulk/fail.json'
]
'test/fixtures/bulk/fail.json',
],
},

@@ -318,7 +314,7 @@ pass_subError: {

fresh: true,
root: grunt.file.readJSON('test/fixtures/subError/schema.json')
root: grunt.file.readJSON('test/fixtures/subError/schema.json'),
},
src: [
'test/fixtures/subError/pass.json'
]
'test/fixtures/subError/pass.json',
],
},

@@ -328,8 +324,8 @@ fail_subError: {

fresh: true,
root: grunt.file.readJSON('test/fixtures/subError/schema.json')
root: grunt.file.readJSON('test/fixtures/subError/schema.json'),
},
src: [
'test/fixtures/subError/fail.json',
'test/fixtures/subError/fail_deeper.json'
]
'test/fixtures/subError/fail_deeper.json',
],
},

@@ -340,7 +336,7 @@ fail_subErrorMulti: {

multi: true,
root: grunt.file.readJSON('test/fixtures/subError/schema.json')
root: grunt.file.readJSON('test/fixtures/subError/schema.json'),
},
src: [
'test/fixtures/subError/fail_deeper.json'
]
'test/fixtures/subError/fail_deeper.json',
],
},

@@ -352,9 +348,9 @@ pass_values: {

root: {
type: 'string'
}
type: 'string',
},
},
values: [
'valueAlpha',
'valueBravo'
]
'valueBravo',
],
},

@@ -366,9 +362,9 @@ fail_valuesArray: {

root: {
type: 'string'
}
type: 'string',
},
},
values: [
false,
123
]
123,
],
},

@@ -380,9 +376,9 @@ fail_valuesObject: {

root: {
type: 'string'
}
type: 'string',
},
},
values: {
'myBooleanValue': false,
'myNumberValue': 1
}
myBooleanValue: false,
myNumberValue: 1,
},
},

@@ -394,11 +390,9 @@ fail_valuesCallback: {

root: {
type: 'string'
}
type: 'string',
},
},
values: () => {
return {
'callbackBoolean': false,
'callbackNumber': 1
};
}
values: () => ({
callbackBoolean: false,
callbackNumber: 1,
}),
},

@@ -409,7 +403,7 @@ pass_package: {

multi: false,
root: require('package.json-schema').get()
root: require('package.json-schema').get(),
},
'src': ['./package.json']
}
}
src: ['./package.json'],
},
},
});

@@ -421,4 +415,5 @@

const conf = grunt.config.get('tv4');
const confKeys = Object.keys(conf).sort();
Object.keys(conf).sort().forEach((name) => {
for (const name of confKeys) {
if (name.startsWith('pass_')) {

@@ -437,3 +432,3 @@ passNames.push('tv4:' + name);

}
});
}

@@ -440,0 +435,0 @@ grunt.registerTask('pass', passNames);

@@ -25,13 +25,13 @@ const fs = require('fs');

const { statusCode } = response;
let err;
let error;
if (statusCode !== 200) {
err = new Error('Request Failed.\n' +
error = new Error('Request Failed.\n' +
`Status Code: ${statusCode}`);
}
if (err) {
if (error) {
// Consume response data to free up memory
response.resume();
return callback(err);
return callback(error);
}

@@ -59,6 +59,6 @@

const loadPath = (src, options, callback) => {
fs.readFile(src, 'utf8', (err, string_) => {
fs.readFile(src, 'utf8', (error, string_) => {
string_ = string_.replace(/^\uFEFF/, ''); // Strip BOM if it exists
if (err) {
return callback(err);
if (error) {
return callback(error);
}

@@ -65,0 +65,0 @@

@@ -21,6 +21,6 @@ /* eslint no-warning-comments: 0 */

const step = (err, callback) => {
const step = (error, callback) => {
nextTick(() => {
if (err) {
return callback(err);
if (error) {
return callback(error);
}

@@ -34,4 +34,4 @@

iter(items[key], key, (err) => {
step(err, callback);
iter(items[key], key, (error) => {
step(error, callback);
});

@@ -46,3 +46,4 @@ });

if (source) {
Object.keys(source).forEach((key) => {
const sourceKeys = Object.keys(source);
for (const key of sourceKeys) {
if (recursive && typeof source[key] === 'object') {

@@ -54,3 +55,3 @@ target[key] = copyProps((Array.isArray(source[key]) ? [] : {}), source[key], recursive);

target[key] = source[key];
});
}
}

@@ -162,5 +163,5 @@

// Start the flow
loadSchemaList(job, job.context.tv4.getMissingUris(), (err) => {
if (err) {
return finaliseTask(err, job, callback);
loadSchemaList(job, job.context.tv4.getMissingUris(), (error) => {
if (error) {
return finaliseTask(error, job, callback);
}

@@ -172,4 +173,4 @@

}, (err) => {
finaliseTask(err, job, callback);
}, (error) => {
finaliseTask(error, job, callback);
});

@@ -191,3 +192,3 @@ });

const finaliseTask = (err, job, callback) => {
const finaliseTask = (error, job, callback) => {
job.success = (job.success && !job.error && job.failed.length === 0);

@@ -204,7 +205,7 @@

if (err) {
if (error) {
out.writeln('');
out.writeln(style.error('error: ') + err);
out.writeln(style.error('error: ') + error);
out.writeln('');
callback(err, job);
callback(error, job);

@@ -221,3 +222,3 @@ return;

const loadSchemaList = (job, uris, callback) => {
uris = uris.filter(function (value) {
uris = uris.filter((value) => {
return Boolean(value);

@@ -227,3 +228,3 @@ });

if (uris.length === 0) {
nextTick(function () {
nextTick(() => {
callback();

@@ -249,5 +250,5 @@ });

loader.load(uri, job.context.options, function (err, schema) {
if (err) {
return callback(err);
loader.load(uri, job.context.options, (error, schema) => {
if (error) {
return callback(error);
}

@@ -260,5 +261,5 @@

});
}, (err) => {
if (err) {
job.error = err;
}, (error) => {
if (error) {
job.error = error;

@@ -312,3 +313,3 @@ return callback(null);

// Test for bad fragment pointer fall-through
if (!object.result.missing.every(function (value) {
if (!object.result.missing.every((value) => {
return (value !== '');

@@ -325,5 +326,5 @@ })) {

// Auto load missing (if loading has an error we'll bail way back)
loadSchemaList(job, object.result.missing, function (err) {
if (err) {
return callback(err);
loadSchemaList(job, object.result.missing, (error) => {
if (error) {
return callback(error);
}

@@ -338,5 +339,5 @@

// Pre-fetch (saves a validation round)
loadSchemaList(job, job.context.tv4.getMissingUris(), function (err) {
if (err) {
return callback(err);
loadSchemaList(job, job.context.tv4.getMissingUris(), (error) => {
if (error) {
return callback(error);
}

@@ -351,7 +352,7 @@

if (typeof object.value === 'undefined') {
const onLoad = (err, object_) => {
if (err) {
job.error = err;
const onLoad = (error, object_) => {
if (error) {
job.error = error;
return callback(err);
return callback(error);
}

@@ -416,5 +417,5 @@

loader.load(object.root, job.context.options, (err, schema) => {
if (err) {
job.error = err;
loader.load(object.root, job.context.options, (error, schema) => {
if (error) {
job.error = error;
return callback(job.error);

@@ -421,0 +422,0 @@ }

{
"name": "grunt-tv4",
"description": "Validate values against json-schema v4",
"version": "5.0.1",
"version": "5.0.2",
"homepage": "https://github.com/timbeadle/grunt-tv4",

@@ -43,14 +43,14 @@ "author": {

"test:snyk": "snyk test --dev",
"snyk-protect": "snyk protect",
"snyk-protect": "snyk-protect",
"prepare": "npm run snyk-protect"
},
"dependencies": {
"grunt": "^1.3.0",
"@snyk/protect": "^1.1292.1",
"grunt": "^1.5.3",
"grunt-contrib-connect": "^3.0.0",
"jsonpointer.js": "~0.4.0",
"ministyle": "~0.1.4",
"miniwrite": "~0.1.3",
"snyk": "^1.430.0",
"tv4": "^1.1.0",
"tv4-reporter": "^4.3.0"
"miniwrite": "~0.1.4",
"tv4": "^1.3.0",
"tv4-reporter": "^4.3.3"
},

@@ -60,6 +60,6 @@ "devDependencies": {

"load-grunt-tasks": "^5.1.0",
"npm-run-all": "^4.1.5",
"npm-run-all2": "^5.0.2",
"package.json-schema": "~0.2.0",
"prettier": "^2.2.0",
"xo": "^0.35.0"
"prettier": "^2.8.8",
"xo": "^0.39.1"
},

@@ -75,3 +75,7 @@ "peerDependencies": {

"prettier": true
},
"volta": {
"node": "10.24.1",
"npm": "6.14.18"
}
}

@@ -9,2 +9,4 @@ /*

/* eslint unicorn/no-array-callback-reference: 0 */
'use strict';

@@ -16,7 +18,6 @@

const miniwrite = require('miniwrite');
const loader = require('../lib/loader');
const runnerModule = require('../lib/runner');
const loader = require('../lib/loader.js');
const runnerModule = require('../lib/runner.js');
module.exports = (grunt) => {
const out = miniwrite.grunt(grunt);

@@ -29,6 +30,6 @@ const style = ministyle.grunt();

out,
style
style,
);
grunt.registerMultiTask('tv4', 'Validate values against json-schema v4.', function() {
grunt.registerMultiTask('tv4', 'Validate values against json-schema v4.', function () {
const done = this.async();

@@ -38,3 +39,3 @@

const context = runner.getContext(this.options(runner.getOptions({
timeout: 5000
timeout: 5000,
})));

@@ -44,9 +45,7 @@

if (context.options.fresh) {
context.tv4 = taskTv4.freshApi();
} else {
context.tv4 = taskTv4;
}
context.tv4 = context.options.fresh
? taskTv4.freshApi()
: taskTv4;
grunt.util._.each(context.options.schemas, function (schema, uri) {
grunt.util._.each(context.options.schemas, (schema, uri) => {
context.tv4.addSchema(uri, schema);

@@ -57,3 +56,3 @@ });

grunt.util._.each(context.options.languages, function (language, id) {
grunt.util._.each(context.options.languages, (language, id) => {
context.tv4.addLanguage(id, language);

@@ -67,4 +66,4 @@ });

// Flatten list for sanity
grunt.util._.each(this.files, function (f) {
grunt.util._.some(f.src, function (filePath) { // eslint-disable-line unicorn/no-fn-reference-in-iterator
grunt.util._.each(this.files, (f) => {
grunt.util._.some(f.src, (filePath) => {
if (!grunt.file.exists(filePath)) {

@@ -78,3 +77,3 @@ grunt.log.warn('file "' + filePath + '" not found.');

label: filePath,
root: context.options.root
root: context.options.root,
});

@@ -93,3 +92,3 @@ });

const keyPrefix = (Array.isArray(values) ? 'value #' : '');
grunt.util._.some(values, function (value, key) { // eslint-disable-line unicorn/no-fn-reference-in-iterator
grunt.util._.some(values, (value, key) => {
objects.push({

@@ -105,3 +104,3 @@ label: keyPrefix + key,

if (context.options.add && Array.isArray(context.options.add)) {
grunt.util._.some(context.options.add, function (schema) { // eslint-disable-line unicorn/no-fn-reference-in-iterator
grunt.util._.some(context.options.add, (schema) => {
if (typeof schema === 'string') {

@@ -128,5 +127,5 @@ // Juggle

context.validate(objects, function (err, job) {
if (err) {
throw err;
context.validate(objects, (error, job) => {
if (error) {
throw error;
}

@@ -133,0 +132,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc