jsonpolice
Advanced tools
Comparing version 8.2.2 to 9.0.0
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.StaticSchema = exports.Schema = void 0; | ||
const refs = require("jsonref"); | ||
const _ = require("lodash"); | ||
const refs = __importStar(require("jsonref")); | ||
const _ = __importStar(require("lodash")); | ||
const errors_1 = require("./errors"); | ||
@@ -224,3 +247,3 @@ const utils_1 = require("./utils"); | ||
} | ||
else if (!utils_1.testRegExp(spec.pattern, data)) { | ||
else if (!(0, utils_1.testRegExp)(spec.pattern, data)) { | ||
throw new errors_1.ValidationError(path, Schema.scope(spec), 'pattern'); | ||
@@ -360,3 +383,2 @@ } | ||
requiredValidator(data, spec, path, opts) { | ||
var _a, _b, _c, _d; | ||
if (data !== null && typeof data === 'object' && !Array.isArray(data)) { | ||
@@ -371,4 +393,4 @@ if (!Array.isArray(spec.required)) { | ||
else if (!(i in data) && | ||
(typeof ((_b = (_a = spec.properties) === null || _a === void 0 ? void 0 : _a[i]) === null || _b === void 0 ? void 0 : _b.readOnly) === 'undefined' || (spec.properties[i].readOnly === true && opts.context !== 'write')) && | ||
(typeof ((_d = (_c = spec.properties) === null || _c === void 0 ? void 0 : _c[i]) === null || _d === void 0 ? void 0 : _d.writeOnly) === 'undefined' || (spec.properties[i].writeOnly === true && opts.context !== 'read'))) { | ||
(typeof spec.properties?.[i]?.readOnly === 'undefined' || (spec.properties[i].readOnly === true && opts.context !== 'write')) && | ||
(typeof spec.properties?.[i]?.writeOnly === 'undefined' || (spec.properties[i].writeOnly === true && opts.context !== 'read'))) { | ||
throw new errors_1.ValidationError(`${path}/${i}`, Schema.scope(spec), 'required'); | ||
@@ -421,3 +443,3 @@ } | ||
for (let p in spec.patternProperties) { | ||
if (utils_1.testRegExp(p, i)) { | ||
if ((0, utils_1.testRegExp)(p, i)) { | ||
try { | ||
@@ -448,3 +470,3 @@ if ((opts.context === 'write' && spec.patternProperties[p].readOnly === true) || | ||
for (let i in data) { | ||
if ((!spec.properties || !spec.properties[i]) && (!spec.patternProperties || !Object.keys(spec.patternProperties).find((p) => utils_1.testRegExp(p, i)))) { | ||
if ((!spec.properties || !spec.properties[i]) && (!spec.patternProperties || !Object.keys(spec.patternProperties).find((p) => (0, utils_1.testRegExp)(p, i)))) { | ||
try { | ||
@@ -451,0 +473,0 @@ if ((opts.context === 'write' && spec.additionalProperties.readOnly === true) || |
{ | ||
"name": "jsonpolice", | ||
"version": "8.2.2", | ||
"version": "9.0.0", | ||
"description": "JSON Schema parser and validator", | ||
@@ -50,27 +50,30 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@commitlint/config-conventional": "^11.0.0", | ||
"@types/chai": "^4.2.14", | ||
"@types/chai-as-promised": "^7.1.3", | ||
"@commitlint/config-conventional": "^16.2.1", | ||
"@types/chai": "^4.3.0", | ||
"@types/chai-as-promised": "^7.1.5", | ||
"@types/chai-spies": "^1.0.3", | ||
"@types/mocha": "^8.2.0", | ||
"@types/node": "^14.14.25", | ||
"chai": "^4.3.0", | ||
"@types/mocha": "^9.1.0", | ||
"@types/node": "^16.11.26", | ||
"chai": "^4.3.6", | ||
"chai-as-promised": "^7.1.1", | ||
"chai-spies": "^1.0.0", | ||
"commitizen": "^4.2.3", | ||
"commitlint": "^11.0.0", | ||
"coveralls": "^3.1.0", | ||
"commitizen": "^4.2.4", | ||
"commitlint": "^16.2.1", | ||
"coveralls": "^3.1.1", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"husky": "^5.0.9", | ||
"mocha": "^8.2.1", | ||
"mochawesome": "^6.2.1", | ||
"husky": "^7.0.4", | ||
"mocha": "^9.2.1", | ||
"mochawesome": "^7.1.0", | ||
"nyc": "^15.1.0", | ||
"rimraf": "^3.0.2", | ||
"semantic-release": "^17.3.8", | ||
"typescript": "^4.1.3" | ||
"semantic-release": "^19.0.2", | ||
"typescript": "^4.6.2" | ||
}, | ||
"dependencies": { | ||
"jsonref": "^6.0.0", | ||
"lodash": "^4.17.20" | ||
"jsonref": "^7.0.0", | ||
"lodash": "^4.17.21" | ||
}, | ||
"engines": { | ||
"node": ">=16.14.0" | ||
}, | ||
"config": { | ||
@@ -77,0 +80,0 @@ "commitizen": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
42991
848
0
+ Addedjsonref@7.0.0(transitive)
- Removedjsonref@6.0.3(transitive)
Updatedjsonref@^7.0.0
Updatedlodash@^4.17.21