Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

@eslint/object-schema

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eslint/object-schema - npm Package Compare versions

Comparing version
2.1.6
to
2.1.7
+57
dist/cjs/types.cts
/**
* @fileoverview Types for object-schema package.
*/
/**
* Built-in validation strategies.
*/
export type BuiltInValidationStrategy =
| "array"
| "boolean"
| "number"
| "object"
| "object?"
| "string"
| "string!";
/**
* Built-in merge strategies.
*/
export type BuiltInMergeStrategy = "assign" | "overwrite" | "replace";
/**
* Property definition.
*/
export interface PropertyDefinition {
/**
* Indicates if the property is required.
*/
required: boolean;
/**
* The other properties that must be present when this property is used.
*/
requires?: string[];
/**
* The strategy to merge the property.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/eslint/rewrite/pull/90#discussion_r1687206213
merge: BuiltInMergeStrategy | ((target: any, source: any) => any);
/**
* The strategy to validate the property.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/eslint/rewrite/pull/90#discussion_r1687206213
validate: BuiltInValidationStrategy | ((value: any) => void);
/**
* The schema for the object value of this property.
*/
schema?: ObjectDefinition;
}
/**
* Object definition.
*/
export type ObjectDefinition = Record<string, PropertyDefinition>;
+8
-6

@@ -158,4 +158,5 @@ 'use strict';

/** @typedef {import("./types.ts").ObjectDefinition} ObjectDefinition */
/** @typedef {import("./types.ts").PropertyDefinition} PropertyDefinition */
/** @import * as $typests from "./types.ts"; */
/** @typedef {$typests.ObjectDefinition} ObjectDefinition */
/** @typedef {$typests.PropertyDefinition} PropertyDefinition */

@@ -171,5 +172,5 @@ //-----------------------------------------------------------------------------

* @returns {void}
* @throws {Error} When the strategy is missing a name.
* @throws {Error} When the strategy is missing a merge() method.
* @throws {Error} When the strategy is missing a validate() method.
* @throws {TypeError} When the strategy is missing a name.
* @throws {TypeError} When the strategy is missing a merge() method.
* @throws {TypeError} When the strategy is missing a validate() method.
*/

@@ -299,2 +300,3 @@ function validateDefinition(name, definition) {

* @param {ObjectDefinition} definitions The schema definitions.
* @throws {Error} When the definitions are missing or invalid.
*/

@@ -369,3 +371,3 @@ constructor(definitions) {

* @returns {Object} A new object with a mix of all objects' keys.
* @throws {Error} If any object is invalid.
* @throws {TypeError} If any object is invalid.
*/

@@ -372,0 +374,0 @@ merge(...objects) {

@@ -1,3 +0,3 @@

export type ObjectDefinition = import("./types.cts").ObjectDefinition;
export type PropertyDefinition = import("./types.cts").PropertyDefinition;
export type ObjectDefinition = $typests.ObjectDefinition;
export type PropertyDefinition = $typests.PropertyDefinition;
/**

@@ -41,2 +41,3 @@ * @fileoverview Merge Strategy

* @param {ObjectDefinition} definitions The schema definitions.
* @throws {Error} When the definitions are missing or invalid.
*/

@@ -56,3 +57,3 @@ constructor(definitions: ObjectDefinition);

* @returns {Object} A new object with a mix of all objects' keys.
* @throws {Error} If any object is invalid.
* @throws {TypeError} If any object is invalid.
*/

@@ -126,1 +127,2 @@ merge(...objects: any[]): any;

}
import type * as $typests from "./types.cts";

@@ -1,3 +0,3 @@

export type ObjectDefinition = import("./types.ts").ObjectDefinition;
export type PropertyDefinition = import("./types.ts").PropertyDefinition;
export type ObjectDefinition = $typests.ObjectDefinition;
export type PropertyDefinition = $typests.PropertyDefinition;
/**

@@ -41,2 +41,3 @@ * @fileoverview Merge Strategy

* @param {ObjectDefinition} definitions The schema definitions.
* @throws {Error} When the definitions are missing or invalid.
*/

@@ -56,3 +57,3 @@ constructor(definitions: ObjectDefinition);

* @returns {Object} A new object with a mix of all objects' keys.
* @throws {Error} If any object is invalid.
* @throws {TypeError} If any object is invalid.
*/

@@ -126,1 +127,2 @@ merge(...objects: any[]): any;

}
import type * as $typests from "./types.ts";

@@ -157,4 +157,5 @@ // @ts-self-types="./index.d.ts"

/** @typedef {import("./types.ts").ObjectDefinition} ObjectDefinition */
/** @typedef {import("./types.ts").PropertyDefinition} PropertyDefinition */
/** @import * as $typests from "./types.ts"; */
/** @typedef {$typests.ObjectDefinition} ObjectDefinition */
/** @typedef {$typests.PropertyDefinition} PropertyDefinition */

@@ -170,5 +171,5 @@ //-----------------------------------------------------------------------------

* @returns {void}
* @throws {Error} When the strategy is missing a name.
* @throws {Error} When the strategy is missing a merge() method.
* @throws {Error} When the strategy is missing a validate() method.
* @throws {TypeError} When the strategy is missing a name.
* @throws {TypeError} When the strategy is missing a merge() method.
* @throws {TypeError} When the strategy is missing a validate() method.
*/

@@ -298,2 +299,3 @@ function validateDefinition(name, definition) {

* @param {ObjectDefinition} definitions The schema definitions.
* @throws {Error} When the definitions are missing or invalid.
*/

@@ -368,3 +370,3 @@ constructor(definitions) {

* @returns {Object} A new object with a mix of all objects' keys.
* @throws {Error} If any object is invalid.
* @throws {TypeError} If any object is invalid.
*/

@@ -371,0 +373,0 @@ merge(...objects) {

{
"name": "@eslint/object-schema",
"version": "2.1.6",
"version": "2.1.7",
"description": "An object schema merger/validator",

@@ -28,11 +28,14 @@ "type": "module",

"scripts": {
"build:dedupe-types": "node ../../tools/dedupe-types.js dist/cjs/index.cjs dist/esm/index.js",
"build:cts": "node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts",
"build": "rollup -c && tsc -p tsconfig.esm.json && npm run build:cts",
"build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts",
"test": "mocha \"tests/**/*.test.js\"",
"test:coverage": "c8 npm test",
"test:jsr": "npx jsr@latest publish --dry-run",
"test": "mocha tests/",
"test:coverage": "c8 npm test"
"test:types": "tsc -p tests/types/tsconfig.json"
},
"repository": {
"type": "git",
"url": "git+https://github.com/eslint/rewrite.git"
"url": "git+https://github.com/eslint/rewrite.git",
"directory": "packages/object-schema"
},

@@ -50,9 +53,5 @@ "keywords": [

},
"homepage": "https://github.com/eslint/rewrite#readme",
"homepage": "https://github.com/eslint/rewrite/tree/main/packages/object-schema#readme",
"devDependencies": {
"c8": "^9.1.0",
"mocha": "^10.4.0",
"rollup": "^4.16.2",
"rollup-plugin-copy": "^3.5.0",
"typescript": "^5.4.5"
"rollup-plugin-copy": "^3.5.0"
},

@@ -59,0 +58,0 @@ "engines": {

@@ -18,3 +18,3 @@ # ObjectSchema Package

# or
bun install @eslint/object-schema
bun add @eslint/object-schema
```

@@ -237,5 +237,5 @@

<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3>
<p><a href="https://qlty.sh/"><img src="https://images.opencollective.com/qltysh/33d157d/logo.png" alt="Qlty Software" height="96"></a> <a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a></p><h3>Silver Sponsors</h3>
<p><a href="https://www.serptriumph.com/"><img src="https://images.opencollective.com/serp-triumph5/fea3074/logo.png" alt="SERP Triumph" height="64"></a> <a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301" alt="American Express" height="64"></a></p><h3>Bronze Sponsors</h3>
<p><a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340" alt="GitBook" height="32"></a> <a href="https://nolebase.ayaka.io"><img src="https://avatars.githubusercontent.com/u/11081491" alt="Neko" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104" alt="Nx" height="32"></a> <a href="https://opensource.mercedes-benz.com/"><img src="https://avatars.githubusercontent.com/u/34240465" alt="Mercedes-Benz Group" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774" alt="HeroCoders" height="32"></a></p>
<p><a href="https://qlty.sh/"><img src="https://images.opencollective.com/qltysh/33d157d/logo.png" alt="Qlty Software" height="96"></a> <a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a> <a href="https://shopify.engineering/"><img src="https://avatars.githubusercontent.com/u/8085" alt="Shopify" height="96"></a></p><h3>Silver Sponsors</h3>
<p><a href="https://vite.dev/"><img src="https://images.opencollective.com/vite/e6d15e1/logo.png" alt="Vite" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301" alt="American Express" height="64"></a> <a href="https://stackblitz.com"><img src="https://avatars.githubusercontent.com/u/28635252" alt="StackBlitz" height="64"></a></p><h3>Bronze Sponsors</h3>
<p><a href="https://syntax.fm"><img src="https://github.com/syntaxfm.png" alt="Syntax" height="32"></a> <a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://sentry.io"><img src="https://github.com/getsentry.png" alt="Sentry" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104" alt="Nx" height="32"></a> <a href="https://opensource.mercedes-benz.com/"><img src="https://avatars.githubusercontent.com/u/34240465" alt="Mercedes-Benz Group" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774" alt="HeroCoders" height="32"></a> <a href="https://www.lambdatest.com"><img src="https://avatars.githubusercontent.com/u/171592363" alt="LambdaTest" height="32"></a></p>
<h3>Technology Sponsors</h3>

@@ -242,0 +242,0 @@ Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.

/**
* @fileoverview Types for object-schema package.
*/
/**
* Built-in validation strategies.
*/
export type BuiltInValidationStrategy =
| "array"
| "boolean"
| "number"
| "object"
| "object?"
| "string"
| "string!";
/**
* Built-in merge strategies.
*/
export type BuiltInMergeStrategy = "assign" | "overwrite" | "replace";
/**
* Property definition.
*/
export interface PropertyDefinition {
/**
* Indicates if the property is required.
*/
required: boolean;
/**
* The other properties that must be present when this property is used.
*/
requires?: string[];
/**
* The strategy to merge the property.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/eslint/rewrite/pull/90#discussion_r1687206213
merge: BuiltInMergeStrategy | ((target: any, source: any) => any);
/**
* The strategy to validate the property.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- https://github.com/eslint/rewrite/pull/90#discussion_r1687206213
validate: BuiltInValidationStrategy | ((value: any) => void);
/**
* The schema for the object value of this property.
*/
schema?: ObjectDefinition;
}
/**
* Object definition.
*/
export type ObjectDefinition = Record<string, PropertyDefinition>;