This commit is contained in:
2026-03-15 12:22:42 +01:00
parent cd99275933
commit 311ba5e7f3
558 changed files with 55182 additions and 22981 deletions

View File

@@ -155,8 +155,9 @@ class ValidationStrategy {
// Types
//-----------------------------------------------------------------------------
/** @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 */
//-----------------------------------------------------------------------------
// Private
@@ -167,9 +168,9 @@ class ValidationStrategy {
* @param {string} name The name of the key this strategy is for.
* @param {PropertyDefinition} definition The strategy for the object key.
* @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.
*/
function validateDefinition(name, definition) {
let hasSchema = false;
@@ -294,6 +295,7 @@ class ObjectSchema {
/**
* Creates a new instance.
* @param {ObjectDefinition} definitions The schema definitions.
* @throws {Error} When the definitions are missing or invalid.
*/
constructor(definitions) {
if (!definitions) {
@@ -363,7 +365,7 @@ class ObjectSchema {
* strategy.
* @param {...Object} objects The objects to merge.
* @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.
*/
merge(...objects) {
// double check arguments

View File

@@ -1,5 +1,5 @@
export type ObjectDefinition = import("./types.cts").ObjectDefinition;
export type PropertyDefinition = import("./types.cts").PropertyDefinition;
export type ObjectDefinition = $typests.ObjectDefinition;
export type PropertyDefinition = $typests.PropertyDefinition;
/**
* @fileoverview Merge Strategy
*/
@@ -38,6 +38,7 @@ export class ObjectSchema {
/**
* Creates a new instance.
* @param {ObjectDefinition} definitions The schema definitions.
* @throws {Error} When the definitions are missing or invalid.
*/
constructor(definitions: ObjectDefinition);
/**
@@ -52,7 +53,7 @@ export class ObjectSchema {
* strategy.
* @param {...Object} objects The objects to merge.
* @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.
*/
merge(...objects: any[]): any;
/**
@@ -121,3 +122,4 @@ export class ValidationStrategy {
*/
static "string!"(value: any): void;
}
import type * as $typests from "./types.cts";

View File

@@ -1,5 +1,5 @@
export type ObjectDefinition = import("./types.ts").ObjectDefinition;
export type PropertyDefinition = import("./types.ts").PropertyDefinition;
export type ObjectDefinition = $typests.ObjectDefinition;
export type PropertyDefinition = $typests.PropertyDefinition;
/**
* @fileoverview Merge Strategy
*/
@@ -38,6 +38,7 @@ export class ObjectSchema {
/**
* Creates a new instance.
* @param {ObjectDefinition} definitions The schema definitions.
* @throws {Error} When the definitions are missing or invalid.
*/
constructor(definitions: ObjectDefinition);
/**
@@ -52,7 +53,7 @@ export class ObjectSchema {
* strategy.
* @param {...Object} objects The objects to merge.
* @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.
*/
merge(...objects: any[]): any;
/**
@@ -121,3 +122,4 @@ export class ValidationStrategy {
*/
static "string!"(value: any): void;
}
import type * as $typests from "./types.ts";

View File

@@ -154,8 +154,9 @@ class ValidationStrategy {
// Types
//-----------------------------------------------------------------------------
/** @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 */
//-----------------------------------------------------------------------------
// Private
@@ -166,9 +167,9 @@ class ValidationStrategy {
* @param {string} name The name of the key this strategy is for.
* @param {PropertyDefinition} definition The strategy for the object key.
* @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.
*/
function validateDefinition(name, definition) {
let hasSchema = false;
@@ -293,6 +294,7 @@ class ObjectSchema {
/**
* Creates a new instance.
* @param {ObjectDefinition} definitions The schema definitions.
* @throws {Error} When the definitions are missing or invalid.
*/
constructor(definitions) {
if (!definitions) {
@@ -362,7 +364,7 @@ class ObjectSchema {
* strategy.
* @param {...Object} objects The objects to merge.
* @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.
*/
merge(...objects) {
// double check arguments