Socket
Socket
Sign inDemoInstall

@rushstack/node-core-library

Package Overview
Dependencies
Maintainers
3
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rushstack/node-core-library - npm Package Compare versions

Comparing version 5.5.1 to 5.6.0

9

CHANGELOG.md
# Change Log - @rushstack/node-core-library
This log was last generated on Sat, 27 Jul 2024 00:10:27 GMT and should not be manually modified.
This log was last generated on Mon, 12 Aug 2024 22:16:04 GMT and should not be manually modified.
## 5.6.0
Mon, 12 Aug 2024 22:16:04 GMT
### Minor changes
- Add a `ignoreSchemaField` option to the `JsonSchema.validateObject` options to ignore `$schema` properties and add an options object argument to `JsonSchema.validateObjectWithCallback` with the same `ignoreSchemaField` option.
## 5.5.1

@@ -6,0 +13,0 @@ Sat, 27 Jul 2024 00:10:27 GMT

2

lib/index.d.ts

@@ -18,3 +18,3 @@ /**

export { type JsonObject, type JsonNull, JsonSyntax, type IJsonFileParseOptions, type IJsonFileLoadAndValidateOptions, type IJsonFileStringifyOptions, type IJsonFileSaveOptions, JsonFile } from './JsonFile';
export { type IJsonSchemaErrorInfo, type IJsonSchemaFromFileOptions, type IJsonSchemaFromObjectOptions, type IJsonSchemaLoadOptions, type IJsonSchemaValidateOptions, JsonSchema, type JsonSchemaVersion } from './JsonSchema';
export { type IJsonSchemaErrorInfo, type IJsonSchemaFromFileOptions, type IJsonSchemaFromObjectOptions, type IJsonSchemaLoadOptions, type IJsonSchemaValidateOptions, type IJsonSchemaValidateObjectWithOptions, JsonSchema, type JsonSchemaVersion } from './JsonSchema';
export { LockFile } from './LockFile';

@@ -21,0 +21,0 @@ export { MapExtensions } from './MapExtensions';

@@ -9,3 +9,3 @@ import { type JsonObject } from './JsonFile';

/**
* Callback function arguments for JsonSchema.validateObjectWithCallback();
* Callback function arguments for {@link JsonSchema.validateObjectWithCallback}
* @public

@@ -20,7 +20,18 @@ */

/**
* Options for JsonSchema.validateObject()
* Options for {@link JsonSchema.validateObjectWithCallback}
* @public
*/
export interface IJsonSchemaValidateOptions {
export interface IJsonSchemaValidateObjectWithOptions {
/**
* If true, the root-level `$schema` property in a JSON object being validated will be ignored during validation.
* If this is set to `true` and the schema requires a `$schema` property, validation will fail.
*/
ignoreSchemaField?: boolean;
}
/**
* Options for {@link JsonSchema.validateObject}
* @public
*/
export interface IJsonSchemaValidateOptions extends IJsonSchemaValidateObjectWithOptions {
/**
* A custom header that will be used to report schema errors.

@@ -36,3 +47,3 @@ * @remarks

/**
* Options for JsonSchema.fromFile() and JsonSchema.fromLoadedObject()
* Options for {@link JsonSchema.fromFile} and {@link JsonSchema.fromLoadedObject}
* @public

@@ -67,3 +78,3 @@ */

/**
* Options for JsonSchema.fromFile()
* Options for {@link JsonSchema.fromFile}
* @public

@@ -73,3 +84,3 @@ */

/**
* Options for JsonSchema.fromLoadedObject()
* Options for {@link JsonSchema.fromLoadedObject}
* @public

@@ -140,5 +151,5 @@ */

*/
validateObjectWithCallback(jsonObject: JsonObject, errorCallback: (errorInfo: IJsonSchemaErrorInfo) => void): void;
validateObjectWithCallback(jsonObject: JsonObject, errorCallback: (errorInfo: IJsonSchemaErrorInfo) => void, options?: IJsonSchemaValidateObjectWithOptions): void;
private _ensureLoaded;
}
//# sourceMappingURL=JsonSchema.d.ts.map

@@ -27,2 +27,13 @@ "use strict";

};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -226,5 +237,6 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

this.validateObjectWithCallback(jsonObject, (errorInfo) => {
const prefix = options && options.customErrorHeader ? options.customErrorHeader : 'JSON validation failed:';
var _a;
const prefix = (_a = options === null || options === void 0 ? void 0 : options.customErrorHeader) !== null && _a !== void 0 ? _a : 'JSON validation failed:';
throw new Error(prefix + os.EOL + filenameForErrors + os.EOL + errorInfo.details);
});
}, options);
}

@@ -235,4 +247,10 @@ /**

*/
validateObjectWithCallback(jsonObject, errorCallback) {
validateObjectWithCallback(jsonObject, errorCallback, options) {
this.ensureCompiled();
if (options === null || options === void 0 ? void 0 : options.ignoreSchemaField) {
const {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
$schema } = jsonObject, remainder = __rest(jsonObject, ["$schema"]);
jsonObject = remainder;
}
if (this._validator && !this._validator(jsonObject)) {

@@ -239,0 +257,0 @@ const errorDetails = JsonSchema._formatErrorDetails(this._validator.errors);

{
"name": "@rushstack/node-core-library",
"version": "5.5.1",
"version": "5.6.0",
"description": "Core libraries that every NodeJS toolchain project should use",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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