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.7.0 to 5.8.0

9

CHANGELOG.md
# Change Log - @rushstack/node-core-library
This log was last generated on Wed, 21 Aug 2024 05:43:04 GMT and should not be manually modified.
This log was last generated on Tue, 10 Sep 2024 20:08:11 GMT and should not be manually modified.
## 5.8.0
Tue, 10 Sep 2024 20:08:11 GMT
### Minor changes
- Add a `customFormats` option to `JsonSchema`.
## 5.7.0

@@ -6,0 +13,0 @@ Wed, 21 Aug 2024 05:43:04 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, type IJsonSchemaValidateObjectWithOptions, JsonSchema, type JsonSchemaVersion } from './JsonSchema';
export { type IJsonSchemaErrorInfo, type IJsonSchemaCustomFormat, 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,2 +9,18 @@ import { type JsonObject } from './JsonFile';

/**
* A definition for a custom format to consider during validation.
* @public
*/
export interface IJsonSchemaCustomFormat<T extends string | number> {
/**
* The base JSON type.
*/
type: T extends string ? 'string' : T extends number ? 'number' : never;
/**
* A validation function for the format.
* @param data - The raw field data to validate.
* @returns whether the data is valid according to the format.
*/
validate: (data: T) => boolean;
}
/**
* Callback function arguments for {@link JsonSchema.validateObjectWithCallback}

@@ -74,2 +90,8 @@ * @public

schemaVersion?: JsonSchemaVersion;
/**
* Any custom formats to consider during validation. Some standard formats are supported
* out-of-the-box (e.g. emails, uris), but additional formats can be defined here. You could
* for example define generic numeric formats (e.g. uint8) or domain-specific formats.
*/
customFormats?: Record<string, IJsonSchemaCustomFormat<string> | IJsonSchemaCustomFormat<number>>;
}

@@ -101,2 +123,3 @@ /**

private _schemaVersion;
private _customFormats;
private constructor();

@@ -103,0 +126,0 @@ /**

@@ -82,2 +82,3 @@ "use strict";

this._schemaVersion = undefined;
this._customFormats = undefined;
}

@@ -101,2 +102,3 @@ /**

schema._schemaVersion = options.schemaVersion;
schema._customFormats = options.customFormats;
}

@@ -114,2 +116,3 @@ return schema;

schema._schemaVersion = options.schemaVersion;
schema._customFormats = options.customFormats;
}

@@ -211,2 +214,7 @@ return schema;

(0, ajv_formats_1.default)(validator);
if (this._customFormats) {
for (const [name, format] of Object.entries(this._customFormats)) {
validator.addFormat(name, Object.assign(Object.assign({}, format), { async: false }));
}
}
const collectedSchemas = [];

@@ -213,0 +221,0 @@ const seenObjects = new Set();

{
"name": "@rushstack/node-core-library",
"version": "5.7.0",
"version": "5.8.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