diff --git a/docs/en/v1/api/clean/castConstraint.md b/docs/en/v1/api/clean/castConstraint.md
new file mode 100644
index 000000000..1bf397172
--- /dev/null
+++ b/docs/en/v1/api/clean/castConstraint.md
@@ -0,0 +1,48 @@
+---
+outline: [2, 3]
+prev:
+ text: "Constraints"
+ link: "/en/v1/api/clean/constraints"
+next:
+ text: "NewType"
+ link: "/en/v1/api/clean/newType"
+description: "Extends the typing of a constrained value by adding compatible constraints without re-validating it."
+---
+
+# castConstraint
+
+`castConstraint` extends the typing of an already constrained value by adding one or more compatible constraints.
+It does not re-validate the value; it only adds constraint markers. TypeScript prevents invalid casts.
+
+## Interactive example
+
+
+
+## Syntax
+
+### Classic signature
+
+```typescript
+function castConstraint(
+ constrainedType: ConstrainedType,
+ constraintHandler: ConstraintHandler | ConstraintHandler[]
+): ConstrainedType
+```
+
+## Parameters
+
+- `constrainedType`: A value already carrying one or more constraints.
+- `constraintHandler`: A constraint handler (or an array of handlers) to add.
+
+## Return value
+
+A new constrained value with the same wrapped value and the additional constraint markers.
+
+## See also
+
+- [`constraints`](/en/v1/api/clean/constraints)
+- [`newType`](/en/v1/api/clean/newType)
diff --git a/docs/en/v1/api/clean/constraints.md b/docs/en/v1/api/clean/constraints.md
index 095690da7..8d0c09fb7 100644
--- a/docs/en/v1/api/clean/constraints.md
+++ b/docs/en/v1/api/clean/constraints.md
@@ -5,8 +5,8 @@ prev:
text: "Primitives"
link: "/en/v1/api/clean/primitives"
next:
- text: "NewType"
- link: "/en/v1/api/clean/newType"
+ text: "castConstraint"
+ link: "/en/v1/api/clean/castConstraint"
---
# Constraints
@@ -105,14 +105,6 @@ function is(
The unique name of the constraint (e.g. `"email"`, `"int"`, ...).
-#### `checkers`
-
-The list of `DDataParser` checkers used to validate the value.
-
-#### `primitiveHandler`
-
-The primitive to which the constraint applies (e.g. `C.String`, `C.Number`).
-
## Constraints provided by the library
The library exports a few ready-to-use constraints via `C.*`:
@@ -177,16 +169,6 @@ Validates a strictly positive number (>= 1).
height="240px"
/>
-### `PositiveInt`
-
-Validates a strictly positive integer (>= 1).
-
-
-
### `Negative`
Validates a strictly negative number (<= -1).
diff --git a/docs/en/v1/api/clean/entity.md b/docs/en/v1/api/clean/entity.md
index b5dca6360..6ae6cbde2 100644
--- a/docs/en/v1/api/clean/entity.md
+++ b/docs/en/v1/api/clean/entity.md
@@ -143,10 +143,6 @@ The unique name of the entity (e.g. `"User"`), used as a runtime identifier.
The properties definition (as declared in `createEntity`).
-#### `mapDataParser`
-
-The `DataParser` generated from `propertiesDefinition` (handy if you want to reuse validation/transform elsewhere). It accepts `unknown` input and produces typed entity properties.
-
## Get the type
To retrieve the type of the generated entity:
diff --git a/docs/en/v1/api/clean/index.md b/docs/en/v1/api/clean/index.md
index 3900edc6d..133c64073 100644
--- a/docs/en/v1/api/clean/index.md
+++ b/docs/en/v1/api/clean/index.md
@@ -28,6 +28,9 @@ Primitives let you handle base types (`String`, `Number`, `Date`, …) in busine
## [Constraints](/en/v1/api/clean/constraints)
Constraints allow adding additional rules on primitives.
+## [castConstraint](/en/v1/api/clean/castConstraint)
+Extends a constrained value with compatible constraints without re-validating it.
+
## [NewType](/en/v1/api/clean/newType)
Creates a `NewType` (brand) backed by a `DataParser`, with optional constraints.
diff --git a/docs/en/v1/api/clean/newType.md b/docs/en/v1/api/clean/newType.md
index 2505daf26..30ba5d2c8 100644
--- a/docs/en/v1/api/clean/newType.md
+++ b/docs/en/v1/api/clean/newType.md
@@ -2,8 +2,8 @@
outline: [2, 3]
description: "A NewType is a type designed to meet business requirements, while being based on an existing primitive type (or data structure). It allows you to add constraints and specific rules, ensuring that values satisfy the conditions defined by the business."
prev:
- text: "Constraints"
- link: "/en/v1/api/clean/constraints"
+ text: "castConstraint"
+ link: "/en/v1/api/clean/castConstraint"
next:
text: "Entities"
link: "/en/v1/api/clean/entity"
@@ -108,14 +108,6 @@ function getConstraint(
The unique name of the `NewType` (e.g. `"userId"`).
-#### `dataParser`
-
-The `DataParser` used to validate the data (including checkers added by constraints).
-
-#### `constrains`
-
-The list of constraints applied to the `NewType`.
-
## See also
- [Primitives](/en/v1/api/clean/primitives/)
diff --git a/docs/en/v1/api/clean/primitives/index.md b/docs/en/v1/api/clean/primitives/index.md
index 056b71193..1b8c27220 100644
--- a/docs/en/v1/api/clean/primitives/index.md
+++ b/docs/en/v1/api/clean/primitives/index.md
@@ -91,12 +91,6 @@ function is(
): value is Primitive
```
-### Properties
-
-#### `dataParser`
-
-Corresponds to the [dataParser](/en/v1/api/dataParser/) that validates the primitive.
-
## Operators
### [equal](/en/v1/api/clean/primitives/operators/equal)
diff --git a/docs/examples/v1/api/clean/castConstraint/tryout.doc.ts b/docs/examples/v1/api/clean/castConstraint/tryout.doc.ts
new file mode 100644
index 000000000..7bb86383b
--- /dev/null
+++ b/docs/examples/v1/api/clean/castConstraint/tryout.doc.ts
@@ -0,0 +1,28 @@
+import { C, type ExpectType } from "@duplojs/utils";
+
+const baseMin = C.NumberMin(5).createOrThrow(7);
+const widenedMin = C.castConstraint(baseMin, C.NumberMin(3));
+
+type CheckWidenedMin = ExpectType<
+ typeof widenedMin,
+ & C.ConstrainedType<"number-min-5", 7>
+ & C.ConstrainedType<"number-min-3", number>,
+ "strict"
+>;
+
+const baseMax = C.NumberMax(5).createOrThrow(-2);
+const widenedMax = C.castConstraint(
+ baseMax,
+ [
+ C.NumberMax(8),
+ C.NumberMax(10),
+ ],
+);
+
+type CheckWidenedMax = ExpectType<
+ typeof widenedMax,
+ & C.ConstrainedType<"number-max-5", -2>
+ & C.ConstrainedType<"number-max-8", number>
+ & C.ConstrainedType<"number-max-10", number>,
+ "strict"
+>;
diff --git a/docs/examples/v1/api/clean/constraints/positiveInt.doc.ts b/docs/examples/v1/api/clean/constraints/positiveInt.doc.ts
deleted file mode 100644
index bb585cb55..000000000
--- a/docs/examples/v1/api/clean/constraints/positiveInt.doc.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { type ExpectType, C, DP } from "@duplojs/utils";
-
-const Score = C.createNewType("score", DP.number(), C.PositiveInt);
-
-const score = Score.createOrThrow(42);
-
-type check = ExpectType<
- typeof score,
- C.NewType<"score", 42, "positive-int">,
- "strict"
->;
diff --git a/docs/examples/v1/api/clean/maybe/tryout.doc.ts b/docs/examples/v1/api/clean/maybe/tryout.doc.ts
index 6c89ec91a..c3d2126c0 100644
--- a/docs/examples/v1/api/clean/maybe/tryout.doc.ts
+++ b/docs/examples/v1/api/clean/maybe/tryout.doc.ts
@@ -1,6 +1,6 @@
import { C, DP, type ExpectType } from "@duplojs/utils";
-const UserId = C.createNewType("userId", DP.number(), C.PositiveInt);
+const UserId = C.createNewType("userId", DP.number(), C.Positive);
const User = C.createEntity("User", () => ({
id: UserId,
}));
diff --git a/docs/fr/v1/api/clean/castConstraint.md b/docs/fr/v1/api/clean/castConstraint.md
new file mode 100644
index 000000000..d9cde4dc5
--- /dev/null
+++ b/docs/fr/v1/api/clean/castConstraint.md
@@ -0,0 +1,48 @@
+---
+outline: [2, 3]
+prev:
+ text: "Contraintes"
+ link: "/fr/v1/api/clean/constraints"
+next:
+ text: "NewType"
+ link: "/fr/v1/api/clean/newType"
+description: "Étend le typage d'une valeur contrainte en ajoutant des contraintes compatibles sans revalider."
+---
+
+# castConstraint
+
+`castConstraint` étend le typage d'une valeur déjà contrainte en ajoutant une ou plusieurs contraintes compatibles.
+La valeur n'est pas revalidée : seules les marques de contraintes sont ajoutées. TypeScript empêche les casts invalides.
+
+## Exemple interactif
+
+
+
+## Syntaxe
+
+### Signature classique
+
+```typescript
+function castConstraint(
+ constrainedType: ConstrainedType,
+ constraintHandler: ConstraintHandler | ConstraintHandler[]
+): ConstrainedType
+```
+
+## Paramètres
+
+- `constrainedType` : Une valeur qui porte déjà une ou plusieurs contraintes.
+- `constraintHandler` : Une contrainte (ou un tableau de contraintes) à ajouter.
+
+## Valeur de retour
+
+Une nouvelle valeur contrainte avec la même valeur wrappée et les contraintes ajoutées.
+
+## Voir aussi
+
+- [`constraints`](/fr/v1/api/clean/constraints)
+- [`newType`](/fr/v1/api/clean/newType)
diff --git a/docs/fr/v1/api/clean/constraints.md b/docs/fr/v1/api/clean/constraints.md
index bd207a70a..889def9ef 100644
--- a/docs/fr/v1/api/clean/constraints.md
+++ b/docs/fr/v1/api/clean/constraints.md
@@ -5,8 +5,8 @@ prev:
text: "Primitives"
link: "/fr/v1/api/clean/primitives"
next:
- text: "NewType"
- link: "/fr/v1/api/clean/newType"
+ text: "castConstraint"
+ link: "/fr/v1/api/clean/castConstraint"
---
# Contraintes
@@ -105,14 +105,6 @@ function is(
Le nom unique de la contrainte (ex: `"email"`, `"int"`, ...).
-#### `checkers`
-
-La liste des checkers du `DDataParser` utilisés pour valider la valeur.
-
-#### `primitiveHandler`
-
-La primitive sur laquelle s'applique la contrainte (ex: `C.String`, `C.Number`).
-
## Contraintes fournies par la librairie
La librairie exporte quelques contraintes prêtes à l'emploi via `C.*` :
@@ -177,16 +169,6 @@ Valide un nombre strictement positif (>= 1).
height="240px"
/>
-### `PositiveInt`
-
-Valide un nombre entier strictement positif (>= 1).
-
-
-
### `Negative`
Valide un nombre strictement négatif (<= -1).
diff --git a/docs/fr/v1/api/clean/entity.md b/docs/fr/v1/api/clean/entity.md
index 59493ecd0..042d1ca03 100644
--- a/docs/fr/v1/api/clean/entity.md
+++ b/docs/fr/v1/api/clean/entity.md
@@ -143,10 +143,6 @@ Le nom unique de l'entité (ex: `"User"`), utilisé comme identifiant runtime.
La définition des propriétés (telle que déclarée dans `createEntity`).
-#### `mapDataParser`
-
-Le `DataParser` généré à partir de `propertiesDefinition` (pratique si vous voulez réutiliser la validation/transform ailleurs). Il accepte une entrée `unknown` et produit des propriétés d'entité typées.
-
## Récupérer le type
Pour récupérer le type de l'entité générée :
diff --git a/docs/fr/v1/api/clean/index.md b/docs/fr/v1/api/clean/index.md
index 003888d31..469a4f31b 100644
--- a/docs/fr/v1/api/clean/index.md
+++ b/docs/fr/v1/api/clean/index.md
@@ -28,6 +28,9 @@ Les primitives permettent de manipuler dans du métier des types de base (`Strin
## [Contraintes](/fr/v1/api/clean/constraints)
Les contraintes permettent d'ajouter des règles supplémentaires sur les primitives.
+## [castConstraint](/fr/v1/api/clean/castConstraint)
+Étend une valeur contrainte avec des contraintes compatibles sans revalidation.
+
## [NewType](/fr/v1/api/clean/newType)
Crée un `NewType` (brand) adossé à un `DataParser`, avec contraintes optionnelles.
diff --git a/docs/fr/v1/api/clean/newType.md b/docs/fr/v1/api/clean/newType.md
index 14df6f796..e1c974a28 100644
--- a/docs/fr/v1/api/clean/newType.md
+++ b/docs/fr/v1/api/clean/newType.md
@@ -2,8 +2,8 @@
outline: [2, 3]
description: "Un NewType est un type conçu pour répondre aux exigences métier, tout en étant basé sur un type primitif (ou une structure de données) existant. Il permet d'ajouter des contraintes et des règles spécifiques, garantissant que les valeurs respectent les conditions définies par le métier."
prev:
- text: "Contraintes"
- link: "/fr/v1/api/clean/constraints"
+ text: "castConstraint"
+ link: "/fr/v1/api/clean/castConstraint"
next:
text: "Entités"
link: "/fr/v1/api/clean/entity"
@@ -108,14 +108,6 @@ function getConstraint(
Le nom unique du `NewType` (ex: `"userId"`).
-#### `dataParser`
-
-Le `DataParser` utilisé pour valider la donnée (incluant les checkers ajoutés par les contraintes).
-
-#### `constrains`
-
-La liste des contraintes appliquées au `NewType`.
-
## Voir aussi
- [Primitives](/fr/v1/api/clean/primitives/)
diff --git a/docs/fr/v1/api/clean/primitives/index.md b/docs/fr/v1/api/clean/primitives/index.md
index 4384ae576..4cf307c62 100644
--- a/docs/fr/v1/api/clean/primitives/index.md
+++ b/docs/fr/v1/api/clean/primitives/index.md
@@ -91,12 +91,6 @@ function is(
): value is Primitive
```
-### Propriétés
-
-#### `dataParser`
-
-Correspond au [dataParser](/fr/v1/api/dataParser/) qui valide la primitive.
-
## Opérateurs
### [equal](/fr/v1/api/clean/primitives/operators/equal)
diff --git a/docs/public/libs/v1/array/types/createTuple.d.ts b/docs/public/libs/v1/array/types/createTuple.d.ts
index 927953527..8d87d6881 100644
--- a/docs/public/libs/v1/array/types/createTuple.d.ts
+++ b/docs/public/libs/v1/array/types/createTuple.d.ts
@@ -1,2 +1,2 @@
import { type IsEqual } from "../../common/types/isEqual";
-export type CreateTuple = IsEqual extends true ? GenericValue[] : IsEqual extends true ? [] : [...GenericLastTuple, GenericValue] extends infer InferredResult extends any[] ? IsEqual extends true ? InferredResult : IsEqual extends true ? [...InferredResult, ...GenericValue[]] : CreateTuple : never;
+export type CreateTuple = IsEqual extends true ? GenericValue[] : IsEqual extends true ? [] : [...GenericLastTuple, GenericValue] extends infer InferredResult extends any[] ? IsEqual extends true ? InferredResult : IsEqual extends true ? [...InferredResult, ...GenericValue[]] : CreateTuple : never;
diff --git a/docs/public/libs/v1/clean/constraint/base.cjs b/docs/public/libs/v1/clean/constraint/base.cjs
index 9defc9826..07e49c970 100644
--- a/docs/public/libs/v1/clean/constraint/base.cjs
+++ b/docs/public/libs/v1/clean/constraint/base.cjs
@@ -33,6 +33,7 @@ function createConstraint(name, primitiveHandler, checker) {
const dataParserWithCheckers = primitiveHandler
.dataParser
.addChecker(...checkers);
+ const constraintKindValue = { [name]: null };
function create$2(data) {
const result = dataParserWithCheckers.parse(unwrap.unwrap(data));
if (is.isLeft(result)) {
@@ -68,6 +69,12 @@ function createConstraint(name, primitiveHandler, checker) {
name,
primitiveHandler,
checkers,
+ internal: {
+ primitiveHandler,
+ dataParser: dataParserWithCheckers,
+ checkers,
+ constraintKindValue,
+ },
create: create$2,
createOrThrow,
createWithUnknown: create$2,
diff --git a/docs/public/libs/v1/clean/constraint/base.d.ts b/docs/public/libs/v1/clean/constraint/base.d.ts
index cfb86ae1f..bc8a84eb4 100644
--- a/docs/public/libs/v1/clean/constraint/base.d.ts
+++ b/docs/public/libs/v1/clean/constraint/base.d.ts
@@ -4,7 +4,7 @@ import * as DArray from "../../array";
import * as DEither from "../../either";
import type * as DDataParser from "../../dataParser";
export declare const constrainedTypeKind: import("../..").KindHandler>>;
-export interface ConstrainedType extends Kind>, WrappedValue {
+export interface ConstrainedType extends Kind>, WrappedValue {
}
export declare const constraintHandlerKind: import("../..").KindHandler>;
export interface ConstraintHandler extends Kind {
@@ -14,15 +14,35 @@ export interface ConstraintHandler;
+ readonly internal: {
+ /**
+ * The DataParser with the constraint checkers applied.
+ *
+ */
+ readonly dataParser: DDataParser.Contract;
+ /**
+ * The primitive handler on which the constraint applies (String, Number, etc.).
+ *
+ */
+ readonly primitiveHandler: PrimitiveHandler;
+ /**
+ * The list of DataParser checkers used to validate the primitive.
+ *
+ */
+ readonly checkers: GenericCheckers;
+ /**
+ * The constraint kind metadata used to tag constrained values.
+ *
+ */
+ readonly constraintKindValue: Record;
+ };
/**
* Creates a constrained value and returns an Either.
*
@@ -143,5 +163,5 @@ export declare function createConstraint[], unknown>>;
}
-export type GetConstraint = DDataParser.InputChecker> = Extract, any>;
+export type GetConstraint = DDataParser.InputChecker> = Extract, any>;
export {};
diff --git a/docs/public/libs/v1/clean/constraint/base.mjs b/docs/public/libs/v1/clean/constraint/base.mjs
index cfe9d1b18..8994808f8 100644
--- a/docs/public/libs/v1/clean/constraint/base.mjs
+++ b/docs/public/libs/v1/clean/constraint/base.mjs
@@ -31,6 +31,7 @@ function createConstraint(name, primitiveHandler, checker) {
const dataParserWithCheckers = primitiveHandler
.dataParser
.addChecker(...checkers);
+ const constraintKindValue = { [name]: null };
function create(data) {
const result = dataParserWithCheckers.parse(unwrap(data));
if (isLeft(result)) {
@@ -66,6 +67,12 @@ function createConstraint(name, primitiveHandler, checker) {
name,
primitiveHandler,
checkers,
+ internal: {
+ primitiveHandler,
+ dataParser: dataParserWithCheckers,
+ checkers,
+ constraintKindValue,
+ },
create,
createOrThrow,
createWithUnknown: create,
diff --git a/docs/public/libs/v1/clean/constraint/cast.cjs b/docs/public/libs/v1/clean/constraint/cast.cjs
new file mode 100644
index 000000000..c3fc18731
--- /dev/null
+++ b/docs/public/libs/v1/clean/constraint/cast.cjs
@@ -0,0 +1,18 @@
+'use strict';
+
+var base = require('./base.cjs');
+var coalescing = require('../../array/coalescing.cjs');
+
+function castConstraint(constrainedType, constraintHandler) {
+ const preparedConstraintHandler = coalescing.coalescing(constraintHandler);
+ const newConstraints = {
+ ...base.constrainedTypeKind.getValue(constrainedType),
+ };
+ for (let index = 0; index < preparedConstraintHandler.length; index++) {
+ const constraintHandler = preparedConstraintHandler[index];
+ newConstraints[constraintHandler.name] = null;
+ }
+ return base.constrainedTypeKind.addTo(constrainedType, newConstraints);
+}
+
+exports.castConstraint = castConstraint;
diff --git a/docs/public/libs/v1/clean/constraint/cast.d.ts b/docs/public/libs/v1/clean/constraint/cast.d.ts
new file mode 100644
index 000000000..87f535d79
--- /dev/null
+++ b/docs/public/libs/v1/clean/constraint/cast.d.ts
@@ -0,0 +1,29 @@
+import { type UnionToIntersection, type SimplifyTopLevel, type NeverCoalescing, type And, type Not, type IsEqual } from "../../common";
+import { type ConstraintHandler, type ConstrainedType, type GetConstraint } from "./base";
+import { type Negative, type NumberMaxHandlerInternal, type NumberMaxInternal, type NumberMinHandlerInternal, type NumberMinInternal, type Positive, type StringMaxHandlerInternal, type StringMaxInternal, type StringMinHandlerInternal, type StringMinInternal } from "./defaultConstraint";
+import { type IsLess, type IsGreater } from "../../number";
+declare const SymbolCastErrorMessage: unique symbol;
+type CastConstraintError = SimplifyTopLevel<{
+ [SymbolCastErrorMessage]: `The constraint "${GenericConstrainHandler["name"]}" is not applicable: ${GenericReason}.`;
+}>;
+type ForbiddenBadCast = ((GenericConstrainHandler extends NumberMinHandlerInternal ? GenericConstrainedType extends Positive ? IsLess extends true ? never : CastConstraintError : GenericConstrainedType extends NumberMinInternal ? And<[
+ IsLess,
+ Not>
+]> extends true ? never : CastConstraintError : CastConstraintError : never) | (GenericConstrainHandler extends NumberMaxHandlerInternal ? GenericConstrainedType extends Negative ? IsGreater extends true ? never : CastConstraintError : GenericConstrainedType extends NumberMaxInternal ? And<[
+ IsGreater,
+ Not>
+]> extends true ? never : CastConstraintError : CastConstraintError : never) | (GenericConstrainHandler extends StringMinHandlerInternal ? GenericConstrainedType extends StringMinInternal ? And<[
+ IsLess,
+ Not>
+]> extends true ? never : CastConstraintError : CastConstraintError : never) | (GenericConstrainHandler extends StringMaxHandlerInternal ? GenericConstrainedType extends StringMaxInternal ? And<[
+ IsGreater,
+ Not>
+]> extends true ? never : CastConstraintError : CastConstraintError : never) | (GenericConstrainHandler extends typeof Positive ? GenericConstrainedType extends NumberMinInternal ? And<[
+ IsLess<0, InferredReferenceValue>,
+ Not>
+]> extends true ? never : CastConstraintError : CastConstraintError : never) | (GenericConstrainHandler extends typeof Negative ? GenericConstrainedType extends NumberMaxInternal ? And<[
+ IsGreater<0, InferredReferenceValue>,
+ Not>
+]> extends true ? never : CastConstraintError : CastConstraintError : never) | (GenericConstrainHandler extends (typeof Negative | typeof Positive | StringMaxHandlerInternal | StringMinHandlerInternal | NumberMaxHandlerInternal | NumberMinHandlerInternal) ? never : CastConstraintError)) extends infer InferredResult ? NeverCoalescing : never;
+export declare function castConstraint(constrainedType: (GenericConstrainedType & ForbiddenBadCast), constraintHandler: GenericConstrainHandler | GenericConstrainHandler[]): (GenericConstrainedType & UnionToIntersection : never>);
+export {};
diff --git a/docs/public/libs/v1/clean/constraint/cast.mjs b/docs/public/libs/v1/clean/constraint/cast.mjs
new file mode 100644
index 000000000..ae69f1f5a
--- /dev/null
+++ b/docs/public/libs/v1/clean/constraint/cast.mjs
@@ -0,0 +1,16 @@
+import { constrainedTypeKind } from './base.mjs';
+import { coalescing } from '../../array/coalescing.mjs';
+
+function castConstraint(constrainedType, constraintHandler) {
+ const preparedConstraintHandler = coalescing(constraintHandler);
+ const newConstraints = {
+ ...constrainedTypeKind.getValue(constrainedType),
+ };
+ for (let index = 0; index < preparedConstraintHandler.length; index++) {
+ const constraintHandler = preparedConstraintHandler[index];
+ newConstraints[constraintHandler.name] = null;
+ }
+ return constrainedTypeKind.addTo(constrainedType, newConstraints);
+}
+
+export { castConstraint };
diff --git a/docs/public/libs/v1/clean/constraint/defaultConstraint/number.cjs b/docs/public/libs/v1/clean/constraint/defaultConstraint/number.cjs
index 95be9f5ce..3a5953865 100644
--- a/docs/public/libs/v1/clean/constraint/defaultConstraint/number.cjs
+++ b/docs/public/libs/v1/clean/constraint/defaultConstraint/number.cjs
@@ -13,11 +13,11 @@ const Int = base.createConstraint("int", base$1.Number, int.checkerInt());
/**
* {@include clean/Positive/index.md}
*/
-const Positive = base.createConstraint("positive", base$1.Number, min.checkerNumberMin(1));
+const Positive = base.createConstraint("positive", base$1.Number, min.checkerNumberMin(0));
/**
* {@include clean/Negative/index.md}
*/
-const Negative = base.createConstraint("negative", base$1.Number, max.checkerNumberMax(-1));
+const Negative = base.createConstraint("negative", base$1.Number, max.checkerNumberMax(0));
/**
* {@include clean/NumberMin/index.md}
*/
@@ -30,17 +30,9 @@ function NumberMin(value) {
function NumberMax(value) {
return base.createConstraint(`number-max-${value}`, base$1.Number, max.checkerNumberMax(value));
}
-/**
- * {@include clean/PositiveInt/index.md}
- */
-const PositiveInt = base.createConstraint("positive-int", base$1.Number, [
- int.checkerInt(),
- min.checkerNumberMin(1),
-]);
exports.Int = Int;
exports.Negative = Negative;
exports.NumberMax = NumberMax;
exports.NumberMin = NumberMin;
exports.Positive = Positive;
-exports.PositiveInt = PositiveInt;
diff --git a/docs/public/libs/v1/clean/constraint/defaultConstraint/number.d.ts b/docs/public/libs/v1/clean/constraint/defaultConstraint/number.d.ts
index b757969c6..2d636fb14 100644
--- a/docs/public/libs/v1/clean/constraint/defaultConstraint/number.d.ts
+++ b/docs/public/libs/v1/clean/constraint/defaultConstraint/number.d.ts
@@ -1,4 +1,4 @@
-import { type GetConstraint } from "../base";
+import { type ConstraintHandler, type GetConstraint } from "../base";
import * as DDataParser from "../../../dataParser";
import { type OnlyLiteralNumber } from "../../../common";
/**
@@ -28,7 +28,7 @@ import { type OnlyLiteralNumber } from "../../../common";
* @namespace C
*
*/
-export declare const Int: import("..").ConstraintHandler<"int", number, readonly [DDataParser.DataParserCheckerInt], never>;
+export declare const Int: ConstraintHandler<"int", number, readonly [DDataParser.DataParserCheckerInt], never>;
export type Int = GetConstraint;
/**
* Constraint handler that validates strictly positive numbers (>= 1).
@@ -57,7 +57,7 @@ export type Int = GetConstraint;
* @namespace C
*
*/
-export declare const Positive: import("..").ConstraintHandler<"positive", number, readonly [DDataParser.DataParserCheckerNumberMin], never>;
+export declare const Positive: ConstraintHandler<"positive", number, readonly [DDataParser.DataParserCheckerNumberMin], never>;
export type Positive = GetConstraint;
/**
* Constraint handler that validates strictly negative numbers (<= -1).
@@ -86,8 +86,10 @@ export type Positive = GetConstraint;
* @namespace C
*
*/
-export declare const Negative: import("..").ConstraintHandler<"negative", number, readonly [DDataParser.DataParserCheckerNumberMax], never>;
+export declare const Negative: ConstraintHandler<"negative", number, readonly [DDataParser.DataParserCheckerNumberMax], never>;
export type Negative = GetConstraint;
+export type NumberMinHandlerInternal = Extract, any>;
+export type NumberMinInternal = GetConstraint>;
/**
* Constraint factory that validates numbers greater than or equal to a minimum.
*
@@ -116,8 +118,10 @@ export type Negative = GetConstraint;
* @namespace C
*
*/
-export declare function NumberMin(value: GenericValue & OnlyLiteralNumber): import("..").ConstraintHandler<`number-min-${GenericValue & OnlyLiteralNumber}`, number, readonly [DDataParser.DataParserCheckerNumberMin], never>;
-export type NumberMin = ReturnType>;
+export declare function NumberMin(value: GenericValue & OnlyLiteralNumber): NumberMinHandlerInternal;
+export type NumberMin = GetConstraint>>;
+export type NumberMaxHandlerInternal = Extract, any>;
+export type NumberMaxInternal = GetConstraint>;
/**
* Constraint factory that validates numbers less than or equal to a maximum.
*
@@ -146,34 +150,5 @@ export type NumberMin = ReturnType(value: GenericValue & OnlyLiteralNumber): import("..").ConstraintHandler<`number-max-${GenericValue & OnlyLiteralNumber}`, number, readonly [DDataParser.DataParserCheckerNumberMax], never>;
-export type NumberMax = ReturnType>;
-/**
- * Constraint handler that validates strictly positive integers (>= 1).
- *
- * **Supported call styles:**
- * - Classic: `PositiveInt.create(value)` -> returns Either
- *
- * Use it as a reusable rule to validate inputs and to constrain NewTypes to positive integer numbers.
- *
- * ```ts
- * const result = C.PositiveInt.create(4);
- *
- * if (E.isRight(result)) {
- * // result: E.Right<"createConstrainedType", C.ConstrainedType<"positive-int", 4>>
- * }
- *
- * const value = C.PositiveInt.createOrThrow(10);
- * // value: C.ConstrainedType<"positive-int", 10>
- *
- * C.PositiveInt.is(value); // type guard
- *
- * ```
- *
- * @see https://utils.duplojs.dev/en/v1/api/clean/constraints
- *
- * @namespace C
- *
- */
-export declare const PositiveInt: import("..").ConstraintHandler<"positive-int", number, readonly [DDataParser.DataParserCheckerInt, DDataParser.DataParserCheckerNumberMin], never>;
-export type PositiveInt = GetConstraint;
+export declare function NumberMax(value: GenericValue & OnlyLiteralNumber): NumberMaxHandlerInternal;
+export type NumberMax = GetConstraint>>;
diff --git a/docs/public/libs/v1/clean/constraint/defaultConstraint/number.mjs b/docs/public/libs/v1/clean/constraint/defaultConstraint/number.mjs
index ae09c6337..962e1b2ed 100644
--- a/docs/public/libs/v1/clean/constraint/defaultConstraint/number.mjs
+++ b/docs/public/libs/v1/clean/constraint/defaultConstraint/number.mjs
@@ -11,11 +11,11 @@ const Int = createConstraint("int", Number, checkerInt());
/**
* {@include clean/Positive/index.md}
*/
-const Positive = createConstraint("positive", Number, checkerNumberMin(1));
+const Positive = createConstraint("positive", Number, checkerNumberMin(0));
/**
* {@include clean/Negative/index.md}
*/
-const Negative = createConstraint("negative", Number, checkerNumberMax(-1));
+const Negative = createConstraint("negative", Number, checkerNumberMax(0));
/**
* {@include clean/NumberMin/index.md}
*/
@@ -28,12 +28,5 @@ function NumberMin(value) {
function NumberMax(value) {
return createConstraint(`number-max-${value}`, Number, checkerNumberMax(value));
}
-/**
- * {@include clean/PositiveInt/index.md}
- */
-const PositiveInt = createConstraint("positive-int", Number, [
- checkerInt(),
- checkerNumberMin(1),
-]);
-export { Int, Negative, NumberMax, NumberMin, Positive, PositiveInt };
+export { Int, Negative, NumberMax, NumberMin, Positive };
diff --git a/docs/public/libs/v1/clean/constraint/defaultConstraint/string.d.ts b/docs/public/libs/v1/clean/constraint/defaultConstraint/string.d.ts
index 3a45f915f..3555bf612 100644
--- a/docs/public/libs/v1/clean/constraint/defaultConstraint/string.d.ts
+++ b/docs/public/libs/v1/clean/constraint/defaultConstraint/string.d.ts
@@ -1,4 +1,4 @@
-import { type GetConstraint } from "../base";
+import { type ConstraintHandler, type GetConstraint } from "../base";
import * as DDataParser from "../../../dataParser";
import { type OnlyLiteralNumber } from "../../../common";
/**
@@ -28,7 +28,7 @@ import { type OnlyLiteralNumber } from "../../../common";
* @namespace C
*
*/
-export declare const Email: import("..").ConstraintHandler<"email", string, readonly [DDataParser.DataParserCheckerEmail], never>;
+export declare const Email: ConstraintHandler<"email", string, readonly [DDataParser.DataParserCheckerEmail], never>;
export type Email = GetConstraint;
/**
* Constraint handler that validates a URL string.
@@ -57,8 +57,10 @@ export type Email = GetConstraint;
* @namespace C
*
*/
-export declare const Url: import("..").ConstraintHandler<"url", string, readonly [DDataParser.DataParserCheckerUrl], never>;
+export declare const Url: ConstraintHandler<"url", string, readonly [DDataParser.DataParserCheckerUrl], never>;
export type Url = GetConstraint;
+export type StringMinHandlerInternal = Extract, any>;
+export type StringMinInternal = GetConstraint>;
/**
* Constraint factory that validates strings with a minimum length.
*
@@ -87,8 +89,10 @@ export type Url = GetConstraint;
* @namespace C
*
*/
-export declare function StringMin(value: GenericValue & OnlyLiteralNumber): import("..").ConstraintHandler<`string-min-${GenericValue & OnlyLiteralNumber}`, string, readonly [DDataParser.DataParserCheckerStringMin], never>;
+export declare function StringMin(value: GenericValue & OnlyLiteralNumber): StringMinHandlerInternal;
export type StringMin = GetConstraint>>;
+export type StringMaxHandlerInternal = Extract, any>;
+export type StringMaxInternal = GetConstraint>;
/**
* Constraint factory that validates strings with a maximum length.
*
@@ -117,5 +121,5 @@ export type StringMin = GetConstraint(value: GenericValue & OnlyLiteralNumber): import("..").ConstraintHandler<`string-max-${GenericValue & OnlyLiteralNumber}`, string, readonly [DDataParser.DataParserCheckerStringMax], never>;
+export declare function StringMax(value: GenericValue & OnlyLiteralNumber): StringMaxHandlerInternal;
export type StringMax = GetConstraint>>;
diff --git a/docs/public/libs/v1/clean/constraint/index.d.ts b/docs/public/libs/v1/clean/constraint/index.d.ts
index 3a7aea1cb..626baee44 100644
--- a/docs/public/libs/v1/clean/constraint/index.d.ts
+++ b/docs/public/libs/v1/clean/constraint/index.d.ts
@@ -1,3 +1,4 @@
export * from "./base";
+export * from "./cast";
export * from "./defaultConstraint";
export * from "./set";
diff --git a/docs/public/libs/v1/clean/constraint/set.cjs b/docs/public/libs/v1/clean/constraint/set.cjs
index 03936f5f2..b7a01b530 100644
--- a/docs/public/libs/v1/clean/constraint/set.cjs
+++ b/docs/public/libs/v1/clean/constraint/set.cjs
@@ -32,7 +32,7 @@ class CreateConstraintsSetError extends kind$1.kindHeritage("create-constraint-s
*/
function createConstraintsSet(primitiveHandler, constraint) {
const constraints = coalescing.coalescing(constraint);
- const checkers = flatMap.flatMap(constraints, ({ checkers }) => checkers);
+ const checkers = flatMap.flatMap(constraints, ({ internal }) => internal.checkers);
const dataParserWithCheckers = primitiveHandler
.dataParser
.addChecker(...checkers);
@@ -80,6 +80,12 @@ function createConstraintsSet(primitiveHandler, constraint) {
return pipe.pipe({
primitiveHandler,
constraints,
+ internal: {
+ primitiveHandler,
+ constraints,
+ constraintKindValue,
+ dataParser: dataParserWithCheckers,
+ },
getConstraint,
create: create$2,
createOrThrow,
diff --git a/docs/public/libs/v1/clean/constraint/set.d.ts b/docs/public/libs/v1/clean/constraint/set.d.ts
index 61a788da0..32586358c 100644
--- a/docs/public/libs/v1/clean/constraint/set.d.ts
+++ b/docs/public/libs/v1/clean/constraint/set.d.ts
@@ -7,15 +7,35 @@ import type * as DDataParser from "../../dataParser";
export declare const constraintsSetHandlerKind: import("../..").KindHandler>;
export interface ConstraintsSetHandler extends Kind {
/**
- * The primitive handler used to validate and wrap values (e.g. `C.String`, `C.Number`).
- *
+ * @deprecated
*/
readonly primitiveHandler: PrimitiveHandler;
/**
- * The list of constraint handlers applied by this set.
- *
+ * @deprecated
*/
readonly constraints: GenericConstraintsHandler;
+ readonly internal: {
+ /**
+ * The DataParser with all constraint checkers from the set applied.
+ *
+ */
+ readonly dataParser: DDataParser.Contract;
+ /**
+ * The primitive handler used to validate and wrap values (e.g. `C.String`, `C.Number`).
+ *
+ */
+ readonly primitiveHandler: PrimitiveHandler;
+ /**
+ * The list of constraint handlers applied by this set.
+ *
+ */
+ readonly constraints: GenericConstraintsHandler;
+ /**
+ * The constraint kind metadata applied by the set.
+ *
+ */
+ readonly constraintKindValue: Record;
+ };
/**
* Creates a constrained value and returns an Either.
*
@@ -145,5 +165,5 @@ export declare function createConstraintsSet>;
}
-export type GetConstraints> = Extract : never : never> : never, any>;
+export type GetConstraints> = Extract : never : never> : never, any>;
export {};
diff --git a/docs/public/libs/v1/clean/constraint/set.mjs b/docs/public/libs/v1/clean/constraint/set.mjs
index 120bf11f2..a13cfa346 100644
--- a/docs/public/libs/v1/clean/constraint/set.mjs
+++ b/docs/public/libs/v1/clean/constraint/set.mjs
@@ -30,7 +30,7 @@ class CreateConstraintsSetError extends kindHeritage("create-constraint-set-erro
*/
function createConstraintsSet(primitiveHandler, constraint) {
const constraints = coalescing(constraint);
- const checkers = flatMap(constraints, ({ checkers }) => checkers);
+ const checkers = flatMap(constraints, ({ internal }) => internal.checkers);
const dataParserWithCheckers = primitiveHandler
.dataParser
.addChecker(...checkers);
@@ -78,6 +78,12 @@ function createConstraintsSet(primitiveHandler, constraint) {
return pipe({
primitiveHandler,
constraints,
+ internal: {
+ primitiveHandler,
+ constraints,
+ constraintKindValue,
+ dataParser: dataParserWithCheckers,
+ },
getConstraint,
create,
createOrThrow,
diff --git a/docs/public/libs/v1/clean/entity/index.cjs b/docs/public/libs/v1/clean/entity/index.cjs
index 478174c0d..13e5947fd 100644
--- a/docs/public/libs/v1/clean/entity/index.cjs
+++ b/docs/public/libs/v1/clean/entity/index.cjs
@@ -7,12 +7,12 @@ var kind$1 = require('../../common/kind.cjs');
var pipe = require('../../common/pipe.cjs');
var map = require('../../array/map.cjs');
var entry = require('../../object/entry.cjs');
-var fromEntries = require('../../object/fromEntries.cjs');
var transform = require('../../dataParser/parsers/transform.cjs');
var entries = require('../../object/entries.cjs');
var forward = require('../../common/forward.cjs');
var errorKindNamespace = require('../../common/errorKindNamespace.cjs');
var index = require('../../dataParser/parsers/object/index.cjs');
+var fromEntries = require('../../object/fromEntries.cjs');
var base = require('../constraint/base.cjs');
var wrapValue = require('../../common/wrapValue.cjs');
var override = require('../../common/override.cjs');
@@ -40,10 +40,7 @@ function createEntity(name, getPropertiesDefinition) {
return entityKind.addTo(properties, name);
}
const propertiesDefinition = getPropertiesDefinition(property.entityPropertyDefinitionTools);
- const mapDataParser = pipe.pipe(forward.forward(propertiesDefinition), entries.entries, map.map(([key, property$1]) => entry.entry(key, property.entityPropertyDefinitionToDataParser(property$1, (newTypeHandler) => {
- const constraintKindValue = pipe.pipe(newTypeHandler.constraints, map.map(({ name }) => entry.entry(name, null)), fromEntries.fromEntries);
- return transform.transform(newTypeHandler.dataParser, (value) => base.constrainedTypeKind.setTo(newType.newTypeKind.setTo(wrapValue.wrapValue(value), newTypeHandler.name), constraintKindValue));
- }))), fromEntries.fromEntries, index.object, (dataParser) => transform.transform(dataParser, (value) => entityKind.setTo(value, name)));
+ const mapDataParser = pipe.pipe(forward.forward(propertiesDefinition), entries.entries, map.map(([key, property$1]) => entry.entry(key, property.entityPropertyDefinitionToDataParser(property$1, (newTypeHandler) => transform.transform(newTypeHandler.internal.dataParser, (value) => base.constrainedTypeKind.setTo(newType.newTypeKind.setTo(wrapValue.wrapValue(value), newTypeHandler.name), newTypeHandler.internal.constraintKindValue))))), fromEntries.fromEntries, index.object, (dataParser) => transform.transform(dataParser, (value) => entityKind.setTo(value, name)));
function map$1(rawProperties) {
const result = mapDataParser.parse(rawProperties);
if (is.isLeft(result)) {
@@ -74,6 +71,9 @@ function createEntity(name, getPropertiesDefinition) {
name,
propertiesDefinition,
mapDataParser,
+ internal: {
+ mapDataParser,
+ },
new: theNew,
map: map$1,
mapOrThrow,
@@ -92,4 +92,5 @@ exports.entityPropertyStructureKind = property.entityPropertyStructureKind;
exports.entityPropertyUnionKind = property.entityPropertyUnionKind;
exports.CreateEntityError = CreateEntityError;
exports.createEntity = createEntity;
+exports.entityHandlerKind = entityHandlerKind;
exports.entityKind = entityKind;
diff --git a/docs/public/libs/v1/clean/entity/index.d.ts b/docs/public/libs/v1/clean/entity/index.d.ts
index 6a2ac8257..1fe4e099d 100644
--- a/docs/public/libs/v1/clean/entity/index.d.ts
+++ b/docs/public/libs/v1/clean/entity/index.d.ts
@@ -18,7 +18,7 @@ export type PropertiesToMapOfEntity>;
export interface Entity extends Kind {
}
-declare const entityHandlerKind: import("../../common").KindHandler>;
+export declare const entityHandlerKind: import("../../common").KindHandler>;
export interface EntityHandler extends Kind {
/**
* The entity name used as a runtime identifier (for example "User").
@@ -30,7 +30,17 @@ export interface EntityHandler, unknown>;
+ readonly internal: {
+ /**
+ * The DataParser used internally to map raw properties into an entity.
+ *
+ */
+ readonly mapDataParser: DDataParser.Contract, unknown>;
+ };
/**
* Builds an entity from already typed properties.
*
diff --git a/docs/public/libs/v1/clean/entity/index.mjs b/docs/public/libs/v1/clean/entity/index.mjs
index 3d65fda16..8f5418fe0 100644
--- a/docs/public/libs/v1/clean/entity/index.mjs
+++ b/docs/public/libs/v1/clean/entity/index.mjs
@@ -6,12 +6,12 @@ import { kindHeritage } from '../../common/kind.mjs';
import { pipe } from '../../common/pipe.mjs';
import { map } from '../../array/map.mjs';
import { entry } from '../../object/entry.mjs';
-import { fromEntries } from '../../object/fromEntries.mjs';
import { transform } from '../../dataParser/parsers/transform.mjs';
import { entries } from '../../object/entries.mjs';
import { forward } from '../../common/forward.mjs';
import { createErrorKind } from '../../common/errorKindNamespace.mjs';
import { object } from '../../dataParser/parsers/object/index.mjs';
+import { fromEntries } from '../../object/fromEntries.mjs';
import { constrainedTypeKind } from '../constraint/base.mjs';
import { wrapValue } from '../../common/wrapValue.mjs';
import { createOverride } from '../../common/override.mjs';
@@ -39,10 +39,7 @@ function createEntity(name, getPropertiesDefinition) {
return entityKind.addTo(properties, name);
}
const propertiesDefinition = getPropertiesDefinition(entityPropertyDefinitionTools);
- const mapDataParser = pipe(forward(propertiesDefinition), entries, map(([key, property]) => entry(key, entityPropertyDefinitionToDataParser(property, (newTypeHandler) => {
- const constraintKindValue = pipe(newTypeHandler.constraints, map(({ name }) => entry(name, null)), fromEntries);
- return transform(newTypeHandler.dataParser, (value) => constrainedTypeKind.setTo(newTypeKind.setTo(wrapValue(value), newTypeHandler.name), constraintKindValue));
- }))), fromEntries, object, (dataParser) => transform(dataParser, (value) => entityKind.setTo(value, name)));
+ const mapDataParser = pipe(forward(propertiesDefinition), entries, map(([key, property]) => entry(key, entityPropertyDefinitionToDataParser(property, (newTypeHandler) => transform(newTypeHandler.internal.dataParser, (value) => constrainedTypeKind.setTo(newTypeKind.setTo(wrapValue(value), newTypeHandler.name), newTypeHandler.internal.constraintKindValue))))), fromEntries, object, (dataParser) => transform(dataParser, (value) => entityKind.setTo(value, name)));
function map$1(rawProperties) {
const result = mapDataParser.parse(rawProperties);
if (isLeft(result)) {
@@ -73,6 +70,9 @@ function createEntity(name, getPropertiesDefinition) {
name,
propertiesDefinition,
mapDataParser,
+ internal: {
+ mapDataParser,
+ },
new: theNew,
map: map$1,
mapOrThrow,
@@ -82,4 +82,4 @@ function createEntity(name, getPropertiesDefinition) {
}
createEntity.overrideHandler = createOverride("@duplojs/utils/clean/entity");
-export { CreateEntityError, createEntity, entityKind, entityPropertyDefinitionToDataParser, entityPropertyDefinitionTools };
+export { CreateEntityError, createEntity, entityHandlerKind, entityKind, entityPropertyDefinitionToDataParser, entityPropertyDefinitionTools };
diff --git a/docs/public/libs/v1/clean/index.cjs b/docs/public/libs/v1/clean/index.cjs
index 482825775..82da38ac7 100644
--- a/docs/public/libs/v1/clean/index.cjs
+++ b/docs/public/libs/v1/clean/index.cjs
@@ -7,9 +7,11 @@ var repository = require('./repository.cjs');
var useCase = require('./useCase.cjs');
var flag = require('./flag.cjs');
var maybe = require('./maybe.cjs');
+var toMapDataParser = require('./toMapDataParser.cjs');
var property = require('./entity/property.cjs');
var unwrap = require('./entity/unwrap.cjs');
var base = require('./constraint/base.cjs');
+var cast = require('./constraint/cast.cjs');
var number = require('./constraint/defaultConstraint/number.cjs');
var string = require('./constraint/defaultConstraint/string.cjs');
var time = require('./constraint/defaultConstraint/time.cjs');
@@ -52,6 +54,7 @@ exports.newTypeHandlerKind = newType.newTypeHandlerKind;
exports.newTypeKind = newType.newTypeKind;
exports.CreateEntityError = index.CreateEntityError;
exports.createEntity = index.createEntity;
+exports.entityHandlerKind = index.entityHandlerKind;
exports.entityKind = index.entityKind;
exports.createRepository = repository.createRepository;
exports.repositoryHandlerKind = repository.repositoryHandlerKind;
@@ -62,6 +65,7 @@ exports.createFlag = flag.createFlag;
exports.flagKind = flag.flagKind;
exports.none = maybe.none;
exports.some = maybe.some;
+exports.toMapDataParser = toMapDataParser.toMapDataParser;
exports.entityPropertyArrayKind = property.entityPropertyArrayKind;
exports.entityPropertyDefinitionToDataParser = property.entityPropertyDefinitionToDataParser;
exports.entityPropertyDefinitionTools = property.entityPropertyDefinitionTools;
@@ -75,12 +79,12 @@ exports.CreateConstrainedTypeError = base.CreateConstrainedTypeError;
exports.constrainedTypeKind = base.constrainedTypeKind;
exports.constraintHandlerKind = base.constraintHandlerKind;
exports.createConstraint = base.createConstraint;
+exports.castConstraint = cast.castConstraint;
exports.Int = number.Int;
exports.Negative = number.Negative;
exports.NumberMax = number.NumberMax;
exports.NumberMin = number.NumberMin;
exports.Positive = number.Positive;
-exports.PositiveInt = number.PositiveInt;
exports.Email = string.Email;
exports.StringMax = string.StringMax;
exports.StringMin = string.StringMin;
diff --git a/docs/public/libs/v1/clean/index.d.ts b/docs/public/libs/v1/clean/index.d.ts
index a7a8d2cb7..51749bb7d 100644
--- a/docs/public/libs/v1/clean/index.d.ts
+++ b/docs/public/libs/v1/clean/index.d.ts
@@ -33,3 +33,4 @@ export * from "./repository";
export * from "./useCase";
export * from "./flag";
export * from "./maybe";
+export * from "./toMapDataParser";
diff --git a/docs/public/libs/v1/clean/index.mjs b/docs/public/libs/v1/clean/index.mjs
index 8e0178ebb..a3d87eb04 100644
--- a/docs/public/libs/v1/clean/index.mjs
+++ b/docs/public/libs/v1/clean/index.mjs
@@ -1,14 +1,16 @@
export { createCleanKind } from './kind.mjs';
export { CreateNewTypeError, createNewType, newTypeHandlerKind, newTypeKind } from './newType.mjs';
-export { CreateEntityError, createEntity, entityKind } from './entity/index.mjs';
+export { CreateEntityError, createEntity, entityHandlerKind, entityKind } from './entity/index.mjs';
export { createRepository, repositoryHandlerKind } from './repository.mjs';
export { createUseCase, useCaseHandlerKind, useCaseInstances } from './useCase.mjs';
export { createFlag, flagKind } from './flag.mjs';
export { none, some } from './maybe.mjs';
+export { toMapDataParser } from './toMapDataParser.mjs';
export { entityPropertyArrayKind, entityPropertyDefinitionToDataParser, entityPropertyDefinitionTools, entityPropertyIdentifierKind, entityPropertyNullableKind, entityPropertyStructureKind, entityPropertyUnionKind } from './entity/property.mjs';
export { unwrapEntity, unwrapEntityProperty } from './entity/unwrap.mjs';
export { CreateConstrainedTypeError, constrainedTypeKind, constraintHandlerKind, createConstraint } from './constraint/base.mjs';
-export { Int, Negative, NumberMax, NumberMin, Positive, PositiveInt } from './constraint/defaultConstraint/number.mjs';
+export { castConstraint } from './constraint/cast.mjs';
+export { Int, Negative, NumberMax, NumberMin, Positive } from './constraint/defaultConstraint/number.mjs';
export { Email, StringMax, StringMin, Url } from './constraint/defaultConstraint/string.mjs';
export { NegativeTime, PositiveTime } from './constraint/defaultConstraint/time.mjs';
export { CreateConstraintsSetError, constraintsSetHandlerKind, createConstraintsSet } from './constraint/set.mjs';
diff --git a/docs/public/libs/v1/clean/newType.cjs b/docs/public/libs/v1/clean/newType.cjs
index 63407c1e4..8084ca085 100644
--- a/docs/public/libs/v1/clean/newType.cjs
+++ b/docs/public/libs/v1/clean/newType.cjs
@@ -35,7 +35,7 @@ class CreateNewTypeError extends kind$1.kindHeritage("create-new-type-error", er
*/
function createNewType(name, dataParser, constraint) {
const constraints = coalescing.coalescing(constraint ?? []);
- const checkers = flatMap.flatMap(constraints, ({ checkers }) => checkers);
+ const checkers = flatMap.flatMap(constraints, ({ internal }) => internal.checkers);
const dataParserWithCheckers = constraint
? dataParser.addChecker(...checkers)
: dataParser;
@@ -85,6 +85,11 @@ function createNewType(name, dataParser, constraint) {
name,
dataParser: dataParserWithCheckers,
constraints,
+ internal: {
+ dataParser: dataParserWithCheckers,
+ constraints,
+ constraintKindValue,
+ },
getConstraint,
create: create$2,
createOrThrow,
diff --git a/docs/public/libs/v1/clean/newType.d.ts b/docs/public/libs/v1/clean/newType.d.ts
index 1deb44c26..9d4df1335 100644
--- a/docs/public/libs/v1/clean/newType.d.ts
+++ b/docs/public/libs/v1/clean/newType.d.ts
@@ -17,15 +17,30 @@ export interface NewTypeHandler;
/**
- * The list of constraints applied to this NewType.
- *
+ * @deprecated
*/
readonly constraints: GenericConstraintsHandler;
+ readonly internal: {
+ /**
+ * The DataParser used to validate and transform raw inputs.
+ *
+ */
+ readonly dataParser: DDataParser.Contract;
+ /**
+ * The list of constraints applied to this NewType.
+ *
+ */
+ readonly constraints: GenericConstraintsHandler;
+ /**
+ * The constraint kind metadata applied to this NewType.
+ *
+ */
+ readonly constraintKindValue: Record;
+ };
/**
* Creates a NewType value and returns an Either.
*
@@ -156,5 +171,5 @@ export declare function createNewType[], unknown>[], unknown>>;
}
-export type GetNewType, GenericValue extends DDataParser.Output = DDataParser.Output> = Extract : never, any>;
+export type GetNewType, GenericValue extends DDataParser.Output = DDataParser.Output> = Extract : never, any>;
export {};
diff --git a/docs/public/libs/v1/clean/newType.mjs b/docs/public/libs/v1/clean/newType.mjs
index e793a160d..a337a3a8c 100644
--- a/docs/public/libs/v1/clean/newType.mjs
+++ b/docs/public/libs/v1/clean/newType.mjs
@@ -33,7 +33,7 @@ class CreateNewTypeError extends kindHeritage("create-new-type-error", createErr
*/
function createNewType(name, dataParser, constraint) {
const constraints = coalescing(constraint ?? []);
- const checkers = flatMap(constraints, ({ checkers }) => checkers);
+ const checkers = flatMap(constraints, ({ internal }) => internal.checkers);
const dataParserWithCheckers = constraint
? dataParser.addChecker(...checkers)
: dataParser;
@@ -83,6 +83,11 @@ function createNewType(name, dataParser, constraint) {
name,
dataParser: dataParserWithCheckers,
constraints,
+ internal: {
+ dataParser: dataParserWithCheckers,
+ constraints,
+ constraintKindValue,
+ },
getConstraint,
create,
createOrThrow,
diff --git a/docs/public/libs/v1/clean/primitive/operations/equal.cjs b/docs/public/libs/v1/clean/primitive/operations/equal.cjs
index 30f3d3a04..d17a682bd 100644
--- a/docs/public/libs/v1/clean/primitive/operations/equal.cjs
+++ b/docs/public/libs/v1/clean/primitive/operations/equal.cjs
@@ -8,6 +8,9 @@ function equal(...args) {
return (input) => equal(input, value);
}
const [input, value] = args;
+ if (input === null || value === null) {
+ return input === value;
+ }
return unwrap.unwrap(input).toString() === unwrap.unwrap(value).toString();
}
diff --git a/docs/public/libs/v1/clean/primitive/operations/equal.d.ts b/docs/public/libs/v1/clean/primitive/operations/equal.d.ts
index aa741d98f..cb9da7aeb 100644
--- a/docs/public/libs/v1/clean/primitive/operations/equal.d.ts
+++ b/docs/public/libs/v1/clean/primitive/operations/equal.d.ts
@@ -34,5 +34,5 @@ import { type Primitive, type Primitives } from "../base";
* @namespace C
*
*/
-export declare function equal> | Unwrap)>(value: GenericValue): (input: GenericInput) => input is GenericInput & Primitive>;
-export declare function equal> | Unwrap)>(input: GenericInput, value: GenericValue): input is GenericInput & Primitive>;
+export declare function equal>> | Unwrap)>(value: GenericValue): (input: GenericInput) => input is (GenericInput & (GenericValue extends null ? GenericValue : Primitive>>));
+export declare function equal>> | Unwrap)>(input: GenericInput, value: GenericValue): input is (GenericInput & (GenericValue extends null ? GenericValue : Primitive>>));
diff --git a/docs/public/libs/v1/clean/primitive/operations/equal.mjs b/docs/public/libs/v1/clean/primitive/operations/equal.mjs
index b284062e0..3d9b0833c 100644
--- a/docs/public/libs/v1/clean/primitive/operations/equal.mjs
+++ b/docs/public/libs/v1/clean/primitive/operations/equal.mjs
@@ -6,6 +6,9 @@ function equal(...args) {
return (input) => equal(input, value);
}
const [input, value] = args;
+ if (input === null || value === null) {
+ return input === value;
+ }
return unwrap(input).toString() === unwrap(value).toString();
}
diff --git a/docs/public/libs/v1/clean/toMapDataParser.cjs b/docs/public/libs/v1/clean/toMapDataParser.cjs
new file mode 100644
index 000000000..20da7ffaa
--- /dev/null
+++ b/docs/public/libs/v1/clean/toMapDataParser.cjs
@@ -0,0 +1,52 @@
+'use strict';
+
+var newType = require('./newType.cjs');
+var base = require('./primitive/base.cjs');
+var base$1 = require('./constraint/base.cjs');
+var set = require('./constraint/set.cjs');
+var hasSomeKinds = require('../common/hasSomeKinds.cjs');
+var index = require('../pattern/match/index.cjs');
+var transform = require('../dataParser/parsers/transform.cjs');
+var index$1 = require('../dataParser/parsers/string/index.cjs');
+var index$2 = require('../dataParser/parsers/number/index.cjs');
+var index$3 = require('../dataParser/parsers/bigint/index.cjs');
+var boolean = require('../dataParser/parsers/boolean.cjs');
+var date = require('../dataParser/parsers/date.cjs');
+var index$4 = require('../dataParser/parsers/time/index.cjs');
+var empty = require('../dataParser/parsers/empty.cjs');
+var nil = require('../dataParser/parsers/nil.cjs');
+var wrapValue = require('../common/wrapValue.cjs');
+
+function toMapDataParser(input, params) {
+ const dataParser = (base.primitiveHandlerKind.has(input)
+ ? input.dataParser.clone()
+ : input.internal.dataParser.clone());
+ if (params?.coerce
+ && hasSomeKinds.hasSomeKinds(dataParser, [
+ index$1.stringKind,
+ index$2.numberKind,
+ index$3.bigIntKind,
+ index$3.bigIntKind,
+ boolean.booleanKind,
+ date.dateKind,
+ index$4.timeKind,
+ empty.emptyKind,
+ nil.nilKind,
+ ])) {
+ dataParser.definition.coerce = true;
+ }
+ const valueContainer = index.match(input)
+ .when(newType.newTypeHandlerKind.has, (newType$1) => ({
+ ...newType.newTypeKind.setTo({}, newType$1.name),
+ ...base$1.constrainedTypeKind.setTo({}, newType$1.internal.constraintKindValue),
+ }))
+ .when(hasSomeKinds.hasSomeKinds([base$1.constraintHandlerKind, set.constraintsSetHandlerKind]), (constraintOrSet) => base$1.constrainedTypeKind.setTo({}, constraintOrSet.internal.constraintKindValue))
+ .when(base.primitiveHandlerKind.has, () => ({}))
+ .exhaustive();
+ return transform.transform(dataParser, (value) => ({
+ ...valueContainer,
+ [wrapValue.keyWrappedValue]: value,
+ }));
+}
+
+exports.toMapDataParser = toMapDataParser;
diff --git a/docs/public/libs/v1/clean/toMapDataParser.d.ts b/docs/public/libs/v1/clean/toMapDataParser.d.ts
new file mode 100644
index 000000000..8ef67f6ac
--- /dev/null
+++ b/docs/public/libs/v1/clean/toMapDataParser.d.ts
@@ -0,0 +1,53 @@
+import * as DDataParser from "../dataParser";
+import { type ConstraintHandler, type ConstraintsSetHandler, type GetConstraint, type GetConstraints } from "./constraint";
+import { type GetNewType, type NewTypeHandler } from "./newType";
+import { type PrimitiveHandler } from "./primitive";
+type ToMapDataParserInput = NewTypeHandler | ConstraintHandler | ConstraintsSetHandler | PrimitiveHandler;
+type OutputDataParser = GenericInput extends NewTypeHandler ? GetNewType : GenericInput extends ConstraintHandler ? GetConstraint : GenericInput extends ConstraintsSetHandler ? GetConstraints : GenericInput extends PrimitiveHandler ? ReturnType : never;
+interface ToMapDataParserParams {
+ coerce?: boolean;
+}
+/**
+ * Creates a DataParser that maps Clean handlers or primitives into a wrapped value object.
+ *
+ * **Supported call styles:**
+ * - Classic: `toMapDataParser(handler, params?)` -> returns a DataParser
+ * - Pipe: `pipe(handler, toMapDataParser)` -> returns a DataParser
+ *
+ * The resulting parser preserves kind tags (`newTypeKind`, `constrainedTypeKind`) and stores the parsed value under the wrapped value key. When `coerce` is enabled, compatible primitive parsers will coerce inputs before validation.
+ *
+ * ```ts
+ * const ShortLabel = C.createNewType(
+ * "ShortLabel",
+ * DP.string(),
+ * [C.StringMax(5)],
+ * );
+ *
+ * const labelParser = C.toMapDataParser(ShortLabel);
+ * labelParser.parseOrThrow("hello");
+ *
+ * const userIdParser = pipe(
+ * C.Number,
+ * C.toMapDataParser,
+ * );
+ * userIdParser.parseOrThrow(42);
+ *
+ * const coerceParser = C.toMapDataParser(
+ * C.String,
+ * { coerce: true },
+ * );
+ * coerceParser.parseOrThrow(123);
+ *
+ * ```
+ *
+ * @remarks
+ * - Supported inputs: `NewTypeHandler`, `ConstraintHandler`, `ConstraintsSetHandler`, and `PrimitiveHandler`.
+ * - Use `coerce: true` to allow conversions (e.g. number to string) on compatible parsers.
+ *
+ * @see https://utils.duplojs.dev/en/v1/api/clean/toMapDataParser
+ *
+ * @namespace C
+ *
+ */
+export declare function toMapDataParser(input: GenericInput, params?: ToMapDataParserParams): DDataParser.Contract, GenericInputDataParser>;
+export {};
diff --git a/docs/public/libs/v1/clean/toMapDataParser.mjs b/docs/public/libs/v1/clean/toMapDataParser.mjs
new file mode 100644
index 000000000..9e8412450
--- /dev/null
+++ b/docs/public/libs/v1/clean/toMapDataParser.mjs
@@ -0,0 +1,50 @@
+import { newTypeHandlerKind, newTypeKind } from './newType.mjs';
+import { primitiveHandlerKind } from './primitive/base.mjs';
+import { constrainedTypeKind, constraintHandlerKind } from './constraint/base.mjs';
+import { constraintsSetHandlerKind } from './constraint/set.mjs';
+import { hasSomeKinds } from '../common/hasSomeKinds.mjs';
+import { match } from '../pattern/match/index.mjs';
+import { transform } from '../dataParser/parsers/transform.mjs';
+import { stringKind } from '../dataParser/parsers/string/index.mjs';
+import { numberKind } from '../dataParser/parsers/number/index.mjs';
+import { bigIntKind } from '../dataParser/parsers/bigint/index.mjs';
+import { booleanKind } from '../dataParser/parsers/boolean.mjs';
+import { dateKind } from '../dataParser/parsers/date.mjs';
+import { timeKind } from '../dataParser/parsers/time/index.mjs';
+import { emptyKind } from '../dataParser/parsers/empty.mjs';
+import { nilKind } from '../dataParser/parsers/nil.mjs';
+import { keyWrappedValue } from '../common/wrapValue.mjs';
+
+function toMapDataParser(input, params) {
+ const dataParser = (primitiveHandlerKind.has(input)
+ ? input.dataParser.clone()
+ : input.internal.dataParser.clone());
+ if (params?.coerce
+ && hasSomeKinds(dataParser, [
+ stringKind,
+ numberKind,
+ bigIntKind,
+ bigIntKind,
+ booleanKind,
+ dateKind,
+ timeKind,
+ emptyKind,
+ nilKind,
+ ])) {
+ dataParser.definition.coerce = true;
+ }
+ const valueContainer = match(input)
+ .when(newTypeHandlerKind.has, (newType) => ({
+ ...newTypeKind.setTo({}, newType.name),
+ ...constrainedTypeKind.setTo({}, newType.internal.constraintKindValue),
+ }))
+ .when(hasSomeKinds([constraintHandlerKind, constraintsSetHandlerKind]), (constraintOrSet) => constrainedTypeKind.setTo({}, constraintOrSet.internal.constraintKindValue))
+ .when(primitiveHandlerKind.has, () => ({}))
+ .exhaustive();
+ return transform(dataParser, (value) => ({
+ ...valueContainer,
+ [keyWrappedValue]: value,
+ }));
+}
+
+export { toMapDataParser };
diff --git a/docs/public/libs/v1/common/index.d.ts b/docs/public/libs/v1/common/index.d.ts
index 075e600b1..98df42d00 100644
--- a/docs/public/libs/v1/common/index.d.ts
+++ b/docs/public/libs/v1/common/index.d.ts
@@ -80,3 +80,4 @@ export * from "./toRegExp";
export * from "./justExec";
export * from "./callThen";
export * from "./queue";
+export * from "./printer";
diff --git a/docs/public/libs/v1/common/printer.cjs b/docs/public/libs/v1/common/printer.cjs
new file mode 100644
index 000000000..0c6915620
--- /dev/null
+++ b/docs/public/libs/v1/common/printer.cjs
@@ -0,0 +1,73 @@
+'use strict';
+
+var repeat = require('../string/repeat.cjs');
+
+exports.Printer = void 0;
+(function (Printer) {
+ const codeColors = {
+ red: "\x1b[31m",
+ green: "\x1b[32m",
+ yellow: "\x1b[33m",
+ blue: "\x1b[34m",
+ magenta: "\x1b[35m",
+ cyan: "\x1b[36m",
+ gray: "\x1b[90m",
+ };
+ const codeBold = "\x1b[1m";
+ const codeReset = "\x1b[0m";
+ Printer.tab = "\t";
+ Printer.back = "\n";
+ Printer.dash = "-";
+ function colorized(...args) {
+ if (args.length === 1) {
+ const [color] = args;
+ return (input) => colorized(input, color);
+ }
+ const [input, color] = args;
+ return `${codeColors[color]}${input}${codeReset}`;
+ }
+ Printer.colorized = colorized;
+ /**
+ * {@include common/printer/bold/index.md}
+ */
+ function bold(input) {
+ return `${codeBold}${input}${codeReset}`;
+ }
+ Printer.bold = bold;
+ function colorizedBold(...args) {
+ if (args.length === 1) {
+ const [color] = args;
+ return (input) => colorizedBold(input, color);
+ }
+ const [input, color] = args;
+ return bold(colorized(input, color));
+ }
+ Printer.colorizedBold = colorizedBold;
+ function indent(level) {
+ return repeat.repeat(Printer.tab, level);
+ }
+ Printer.indent = indent;
+ function stringify(value) {
+ try {
+ return JSON.stringify(value);
+ }
+ catch {
+ return String(value);
+ }
+ }
+ Printer.stringify = stringify;
+ function render(...args) {
+ if (args.length === 1) {
+ const [joinCharacter] = args;
+ return (values) => render(values, joinCharacter);
+ }
+ const [values, joinCharacter] = args;
+ return values
+ .flat(Infinity)
+ .filter((value) => typeof value === "string" || value === true)
+ .join(joinCharacter);
+ }
+ Printer.render = render;
+ Printer.renderLine = render(" ");
+ Printer.renderParagraph = render(Printer.back);
+})(exports.Printer || (exports.Printer = {}));
diff --git a/docs/public/libs/v1/common/printer.d.ts b/docs/public/libs/v1/common/printer.d.ts
new file mode 100644
index 000000000..958cd47af
--- /dev/null
+++ b/docs/public/libs/v1/common/printer.d.ts
@@ -0,0 +1,139 @@
+export declare namespace Printer {
+ const codeColors: {
+ readonly red: "\u001B[31m";
+ readonly green: "\u001B[32m";
+ readonly yellow: "\u001B[33m";
+ readonly blue: "\u001B[34m";
+ readonly magenta: "\u001B[35m";
+ readonly cyan: "\u001B[36m";
+ readonly gray: "\u001B[90m";
+ };
+ export const tab = "\t";
+ export const back = "\n";
+ export const dash = "-";
+ export type Colors = keyof typeof codeColors;
+ /**
+ * Wraps a string with the ANSI escape sequence of the selected color. Exists in immediate or curried form.
+ *
+ * **Supported call styles:**
+ * - Classic: `Printer.colorized(input, color)` -> returns the colored string
+ * - Curried: `Printer.colorized(color)` -> returns a function waiting for the string
+ *
+ * The function only adds the opening color code and the reset code around the input string.
+ *
+ * ```ts
+ * const directResult = Printer.colorized("Hello", "green");
+ * // directResult: "\x1b[32mHello\x1b[0m"
+ *
+ * const pipedResult = pipe(
+ * "Warning",
+ * Printer.colorized("yellow"),
+ * );
+ * // pipedResult: "\x1b[33mWarning\x1b[0m"
+ *
+ * const errorResult = Printer.colorized("Error", "red");
+ * // errorResult: "\x1b[31mError\x1b[0m"
+ *
+ * ```
+ *
+ * @see https://utils.duplojs.dev/en/v1/api/common/printer/colorized
+ *
+ */
+ export function colorized(color: Colors): (input: GenericInput) => string;
+ export function colorized(input: GenericInput, color: Colors): string;
+ /**
+ * Wraps a string with the ANSI escape sequence for bold text.
+ *
+ * Signature: `Printer.bold(input)` -> returns the bold string
+ *
+ * The function prepends the bold code and appends the reset code without altering the input content.
+ *
+ * ```ts
+ * const title = Printer.bold("Build report");
+ * // title: "\x1b[1mBuild report\x1b[0m"
+ *
+ * const symbol = Printer.bold("!");
+ * // symbol: "\x1b[1m!\x1b[0m"
+ *
+ * const empty = Printer.bold("");
+ * // empty: "\x1b[1m\x1b[0m"
+ *
+ * ```
+ *
+ * @see https://utils.duplojs.dev/en/v1/api/common/printer/bold
+ *
+ */
+ export function bold(input: string): string;
+ /**
+ * Applies a color and bold formatting to a string by combining `Printer.colorized()` and `Printer.bold()`. Exists in immediate or curried form.
+ *
+ * **Supported call styles:**
+ * - Classic: `Printer.colorizedBold(input, color)` -> returns the formatted string
+ * - Curried: `Printer.colorizedBold(color)` -> returns a function waiting for the string
+ *
+ * The produced string contains the bold ANSI code, then the colorized content, and finally the reset codes.
+ *
+ * ```ts
+ * const directResult = Printer.colorizedBold("Fatal", "red");
+ * // directResult: "\x1b[1m\x1b[31mFatal\x1b[0m\x1b[0m"
+ *
+ * const pipedResult = pipe(
+ * "Info",
+ * Printer.colorizedBold("cyan"),
+ * );
+ * // pipedResult: "\x1b[1m\x1b[36mInfo\x1b[0m\x1b[0m"
+ *
+ * const successResult = Printer.colorizedBold("Done", "green");
+ * // successResult: "\x1b[1m\x1b[32mDone\x1b[0m\x1b[0m"
+ *
+ * ```
+ *
+ * @see https://utils.duplojs.dev/en/v1/api/common/printer/colorizedBold
+ *
+ */
+ export function colorizedBold(color: Colors): (input: GenericInput) => string;
+ export function colorizedBold(input: GenericInput, color: Colors): string;
+ export function indent(level: number): string;
+ export function stringify(value: unknown): string;
+ export type RenderInput = string | boolean | null | undefined | RenderInput[];
+ /**
+ * Flattens printable values, keeps strings and `true`, then joins the result with a custom separator. Exists in immediate or curried form.
+ *
+ * **Supported call styles:**
+ * - Classic: `Printer.render(values, joinCharacter)` -> returns the rendered string
+ * - Curried: `Printer.render(joinCharacter)` -> returns a function waiting for the values array
+ *
+ * Nested arrays are flattened recursively. `false`, `null`, and `undefined` are ignored, while `true` is kept as the string `"true"`.
+ * The namespace also exposes two ready-to-use defaults: `Printer.renderLine`, which joins with a space, and `Printer.renderParagraph`, which joins with `Printer.back`.
+ *
+ * ```ts
+ * const customResult = Printer.render(
+ * ["alpha", ["beta", false], true, undefined],
+ * " | ",
+ * );
+ * // customResult: "alpha | beta | true"
+ *
+ * const lineResult = Printer.renderLine([
+ * "hello",
+ * ["world", null],
+ * true,
+ * ]);
+ * // lineResult: "hello world true"
+ *
+ * const paragraphResult = pipe(
+ * ["title", ["", "body"], false, true] as const,
+ * Printer.renderParagraph,
+ * );
+ * // paragraphResult: "title\n\nbody\ntrue"
+ *
+ * ```
+ *
+ * @see https://utils.duplojs.dev/en/v1/api/common/printer/render
+ *
+ */
+ export function render(joinCharacter: string): (values: GenericValues) => string;
+ export function render(values: GenericValues, joinCharacter: string): string;
+ export const renderLine: (values: readonly RenderInput[]) => string;
+ export const renderParagraph: (values: readonly RenderInput[]) => string;
+ export {};
+}
diff --git a/docs/public/libs/v1/common/printer.mjs b/docs/public/libs/v1/common/printer.mjs
new file mode 100644
index 000000000..8a1a420da
--- /dev/null
+++ b/docs/public/libs/v1/common/printer.mjs
@@ -0,0 +1,73 @@
+import { repeat } from '../string/repeat.mjs';
+
+var Printer;
+(function (Printer) {
+ const codeColors = {
+ red: "\x1b[31m",
+ green: "\x1b[32m",
+ yellow: "\x1b[33m",
+ blue: "\x1b[34m",
+ magenta: "\x1b[35m",
+ cyan: "\x1b[36m",
+ gray: "\x1b[90m",
+ };
+ const codeBold = "\x1b[1m";
+ const codeReset = "\x1b[0m";
+ Printer.tab = "\t";
+ Printer.back = "\n";
+ Printer.dash = "-";
+ function colorized(...args) {
+ if (args.length === 1) {
+ const [color] = args;
+ return (input) => colorized(input, color);
+ }
+ const [input, color] = args;
+ return `${codeColors[color]}${input}${codeReset}`;
+ }
+ Printer.colorized = colorized;
+ /**
+ * {@include common/printer/bold/index.md}
+ */
+ function bold(input) {
+ return `${codeBold}${input}${codeReset}`;
+ }
+ Printer.bold = bold;
+ function colorizedBold(...args) {
+ if (args.length === 1) {
+ const [color] = args;
+ return (input) => colorizedBold(input, color);
+ }
+ const [input, color] = args;
+ return bold(colorized(input, color));
+ }
+ Printer.colorizedBold = colorizedBold;
+ function indent(level) {
+ return repeat(Printer.tab, level);
+ }
+ Printer.indent = indent;
+ function stringify(value) {
+ try {
+ return JSON.stringify(value);
+ }
+ catch {
+ return String(value);
+ }
+ }
+ Printer.stringify = stringify;
+ function render(...args) {
+ if (args.length === 1) {
+ const [joinCharacter] = args;
+ return (values) => render(values, joinCharacter);
+ }
+ const [values, joinCharacter] = args;
+ return values
+ .flat(Infinity)
+ .filter((value) => typeof value === "string" || value === true)
+ .join(joinCharacter);
+ }
+ Printer.render = render;
+ Printer.renderLine = render(" ");
+ Printer.renderParagraph = render(Printer.back);
+})(Printer || (Printer = {}));
+
+export { Printer };
diff --git a/docs/public/libs/v1/common/types/and.d.ts b/docs/public/libs/v1/common/types/and.d.ts
index f4a10d519..1d4f83c5c 100644
--- a/docs/public/libs/v1/common/types/and.d.ts
+++ b/docs/public/libs/v1/common/types/and.d.ts
@@ -1,2 +1 @@
-import { type IsEqual } from "./isEqual";
-export type And = IsEqual;
+export type And = GenericBooleans[number] extends true ? true : false;
diff --git a/docs/public/libs/v1/common/types/or.d.ts b/docs/public/libs/v1/common/types/or.d.ts
index fee465311..8da4c0e26 100644
--- a/docs/public/libs/v1/common/types/or.d.ts
+++ b/docs/public/libs/v1/common/types/or.d.ts
@@ -1,2 +1 @@
-import { type IsEqual } from "./isEqual";
-export type Or = IsEqual;
+export type Or = GenericBooleans[number] extends false ? false : true;
diff --git a/docs/public/libs/v1/dataParser/base.cjs b/docs/public/libs/v1/dataParser/base.cjs
index 870d36f10..fa2de3cc3 100644
--- a/docs/public/libs/v1/dataParser/base.cjs
+++ b/docs/public/libs/v1/dataParser/base.cjs
@@ -11,8 +11,6 @@ var errorKindNamespace = require('../common/errorKindNamespace.cjs');
var error$1 = require('../either/left/error.cjs');
var success = require('../either/right/success.cjs');
-const SymbolDataParserErrorLabel = "SymbolDataParserError";
-const SymbolDataParserError = Symbol.for(SymbolDataParserErrorLabel);
const checkerKind = kind.createDataParserKind("checker");
function dataParserCheckerInit(kind, params, exec) {
return kind.setTo(checkerKind.setTo({
@@ -22,9 +20,7 @@ function dataParserCheckerInit(kind, params, exec) {
}
const dataParserKind = kind.createDataParserKind("base");
// This allows for better performance WTF ???
-const SDPEI = error.SymbolDataParserErrorIssue;
-const SDPEPI = error.SymbolDataParserErrorPromiseIssue;
-const SDPE = SymbolDataParserError;
+const SDPE = error.SymbolDataParserError;
const DPE = error.createError();
const EE = error$1.error(null);
const ES = success.success(null);
@@ -44,22 +40,13 @@ function dataParserInit(kind, definition, exec, specificOverrideHandler) {
async: exec,
isAsynchronous: () => false,
};
- function middleExec(data, error$1) {
- let result = formattedExec.sync(data, error$1, self);
- if (result === SDPEI) {
- error.addIssue(error$1, self, data);
- return SDPE;
- }
- else if (result === SDPEPI) {
- error.addPromiseIssue(error$1, self, data);
- return SDPE;
- }
- else if (result !== SDPE
+ function middleExec(data, error) {
+ let result = formattedExec.sync(data, error, self);
+ if (result !== SDPE
&& self.definition.checkers.length) {
for (const checker of self.definition.checkers) {
- const checkerResult = checker.exec(result, checker);
- if (checkerResult === SDPEI) {
- error.addIssue(error$1, checker, result);
+ const checkerResult = checker.exec(result, error, checker);
+ if (checkerResult === SDPE) {
return SDPE;
}
else {
@@ -69,22 +56,13 @@ function dataParserInit(kind, definition, exec, specificOverrideHandler) {
}
return result;
}
- async function middleAsyncExec(data, error$1) {
- let result = await formattedExec.async(data, error$1, self);
- if (result === SDPEI) {
- error.addIssue(error$1, self, data);
- return SDPE;
- }
- else if (result === SDPEPI) {
- error.addPromiseIssue(error$1, self, data);
- return SDPE;
- }
- else if (result !== SDPE
+ async function middleAsyncExec(data, error) {
+ let result = await formattedExec.async(data, error, self);
+ if (result !== SDPE
&& self.definition.checkers.length) {
for (const checker of self.definition.checkers) {
- const checkerResult = checker.exec(result, checker);
- if (checkerResult === SDPEI) {
- error.addIssue(error$1, checker, result);
+ const checkerResult = checker.exec(result, error, checker);
+ if (checkerResult === SDPE) {
return SDPE;
}
else {
@@ -172,9 +150,8 @@ function dataParserInit(kind, definition, exec, specificOverrideHandler) {
}
dataParserInit.overrideHandler = override.createOverride("@duplojs/utils/data-parser/base");
+exports.SymbolDataParserError = error.SymbolDataParserError;
exports.DataParserThrowError = DataParserThrowError;
-exports.SymbolDataParserError = SymbolDataParserError;
-exports.SymbolDataParserErrorLabel = SymbolDataParserErrorLabel;
exports.checkerKind = checkerKind;
exports.dataParserCheckerInit = dataParserCheckerInit;
exports.dataParserInit = dataParserInit;
diff --git a/docs/public/libs/v1/dataParser/base.d.ts b/docs/public/libs/v1/dataParser/base.d.ts
index adb655610..a5ce5889c 100644
--- a/docs/public/libs/v1/dataParser/base.d.ts
+++ b/docs/public/libs/v1/dataParser/base.d.ts
@@ -1,19 +1,17 @@
import { type GetKind, type GetKindHandler, type GetKindValue, type IsEqual, type Kind, type KindHandler, type OverrideHandler, type RemoveKind } from "../common";
-import { SymbolDataParserErrorIssue, SymbolDataParserErrorPromiseIssue, type DataParserError } from "./error";
+import { SymbolDataParserError, type DataParserError } from "./error";
import * as DEither from "../either";
-export declare const SymbolDataParserErrorLabel = "SymbolDataParserError";
-export declare const SymbolDataParserError: unique symbol;
-export type SymbolDataParserError = typeof SymbolDataParserError;
+export { SymbolDataParserError } from "./error";
export declare const checkerKind: KindHandler>;
export interface DataParserCheckerDefinition {
readonly errorMessage?: string;
}
export interface DataParserChecker extends Kind {
readonly definition: GenericDefinition;
- exec(data: GenericInput, self: this): GenericInput | SymbolDataParserErrorIssue;
+ exec(data: GenericInput, error: DataParserError, self: this): GenericInput | SymbolDataParserError;
}
export type InputChecker = Parameters[0];
-export declare function dataParserCheckerInit(kind: Exclude, typeof checkerKind>, params: NoInfer, "exec">>, exec: (...args: Parameters) => GetKindValue | SymbolDataParserErrorIssue): GenericDataParserChecker;
+export declare function dataParserCheckerInit(kind: Exclude, typeof checkerKind>, params: NoInfer, "exec">>, exec: (...args: Parameters) => GetKindValue | SymbolDataParserError): GenericDataParserChecker;
export declare const dataParserKind: KindHandler {
- sync(...args: [...Parameters, self: GenericDataParser]): (GetKindValue["output"] | SymbolDataParserError | SymbolDataParserErrorIssue | SymbolDataParserErrorPromiseIssue);
- async(...args: [...Parameters, self: GenericDataParser]): Promise["output"] | SymbolDataParserError | SymbolDataParserErrorIssue | SymbolDataParserErrorPromiseIssue>;
+ sync(...args: [...Parameters, self: GenericDataParser]): (GetKindValue["output"] | SymbolDataParserError);
+ async(...args: [...Parameters, self: GenericDataParser]): Promise["output"] | SymbolDataParserError>;
isAsynchronous(self: GenericDataParser): boolean;
}
declare const DataParserThrowError_base: new (params: {
@@ -261,4 +259,3 @@ export type AdvancedContract = (GetKind;
clone(): AdvancedContract;
});
-export {};
diff --git a/docs/public/libs/v1/dataParser/base.mjs b/docs/public/libs/v1/dataParser/base.mjs
index e74c7a029..8f56f5aa9 100644
--- a/docs/public/libs/v1/dataParser/base.mjs
+++ b/docs/public/libs/v1/dataParser/base.mjs
@@ -1,4 +1,4 @@
-import { createError, addIssue, addPromiseIssue, SymbolDataParserErrorIssue, SymbolDataParserErrorPromiseIssue } from './error.mjs';
+import { createError, SymbolDataParserError } from './error.mjs';
import { createDataParserKind } from './kind.mjs';
import { simpleClone } from '../common/simpleClone.mjs';
import { keyWrappedValue } from '../common/wrapValue.mjs';
@@ -9,8 +9,6 @@ import { createErrorKind } from '../common/errorKindNamespace.mjs';
import { error } from '../either/left/error.mjs';
import { success } from '../either/right/success.mjs';
-const SymbolDataParserErrorLabel = "SymbolDataParserError";
-const SymbolDataParserError = Symbol.for(SymbolDataParserErrorLabel);
const checkerKind = createDataParserKind("checker");
function dataParserCheckerInit(kind, params, exec) {
return kind.setTo(checkerKind.setTo({
@@ -20,8 +18,6 @@ function dataParserCheckerInit(kind, params, exec) {
}
const dataParserKind = createDataParserKind("base");
// This allows for better performance WTF ???
-const SDPEI = SymbolDataParserErrorIssue;
-const SDPEPI = SymbolDataParserErrorPromiseIssue;
const SDPE = SymbolDataParserError;
const DPE = createError();
const EE = error(null);
@@ -44,20 +40,11 @@ function dataParserInit(kind, definition, exec, specificOverrideHandler) {
};
function middleExec(data, error) {
let result = formattedExec.sync(data, error, self);
- if (result === SDPEI) {
- addIssue(error, self, data);
- return SDPE;
- }
- else if (result === SDPEPI) {
- addPromiseIssue(error, self, data);
- return SDPE;
- }
- else if (result !== SDPE
+ if (result !== SDPE
&& self.definition.checkers.length) {
for (const checker of self.definition.checkers) {
- const checkerResult = checker.exec(result, checker);
- if (checkerResult === SDPEI) {
- addIssue(error, checker, result);
+ const checkerResult = checker.exec(result, error, checker);
+ if (checkerResult === SDPE) {
return SDPE;
}
else {
@@ -69,20 +56,11 @@ function dataParserInit(kind, definition, exec, specificOverrideHandler) {
}
async function middleAsyncExec(data, error) {
let result = await formattedExec.async(data, error, self);
- if (result === SDPEI) {
- addIssue(error, self, data);
- return SDPE;
- }
- else if (result === SDPEPI) {
- addPromiseIssue(error, self, data);
- return SDPE;
- }
- else if (result !== SDPE
+ if (result !== SDPE
&& self.definition.checkers.length) {
for (const checker of self.definition.checkers) {
- const checkerResult = checker.exec(result, checker);
- if (checkerResult === SDPEI) {
- addIssue(error, checker, result);
+ const checkerResult = checker.exec(result, error, checker);
+ if (checkerResult === SDPE) {
return SDPE;
}
else {
@@ -170,4 +148,4 @@ function dataParserInit(kind, definition, exec, specificOverrideHandler) {
}
dataParserInit.overrideHandler = createOverride("@duplojs/utils/data-parser/base");
-export { DataParserThrowError, SymbolDataParserError, SymbolDataParserErrorLabel, checkerKind, dataParserCheckerInit, dataParserInit, dataParserKind };
+export { DataParserThrowError, SymbolDataParserError, checkerKind, dataParserCheckerInit, dataParserInit, dataParserKind };
diff --git a/docs/public/libs/v1/dataParser/error.cjs b/docs/public/libs/v1/dataParser/error.cjs
index 7ff7562ad..4649944c1 100644
--- a/docs/public/libs/v1/dataParser/error.cjs
+++ b/docs/public/libs/v1/dataParser/error.cjs
@@ -1,13 +1,20 @@
'use strict';
var kind = require('./kind.cjs');
+var printer = require('../common/printer.cjs');
+var unwrap = require('../common/unwrap.cjs');
-const SymbolDataParserErrorIssueLabel = "SymbolDataParserErrorIssue";
+const SymbolDataParserErrorLabel = "SymbolDataParserError";
+const SymbolDataParserError = Symbol.for(SymbolDataParserErrorLabel);
+/**
+ * @deprecated
+ */
+const SymbolDataParserErrorIssueLabel = "SymbolDataParserError";
+/**
+ * @deprecated
+ */
const SymbolDataParserErrorIssue = Symbol.for(SymbolDataParserErrorIssueLabel);
const errorIssueKind = kind.createDataParserKind("error-issue");
-const SymbolDataParserErrorPromiseIssueLabel = "SymbolDataParserErrorPromiseIssue";
-const SymbolDataParserErrorPromiseIssue = Symbol.for(SymbolDataParserErrorPromiseIssueLabel);
-const errorPromiseIssueKind = kind.createDataParserKind("error-issue-promise");
const errorKind = kind.createDataParserKind("error");
function createError() {
return errorKind.setTo({
@@ -15,23 +22,14 @@ function createError() {
currentPath: [],
});
}
-function addIssue(error, source, data, moreInformation) {
+function addIssue(error, expected, data, message) {
error.issues.push(errorIssueKind.setTo({
- source,
+ expected,
path: error.currentPath.join("."),
data,
- moreInformation,
+ message,
}));
- return error;
-}
-function addPromiseIssue(error, source, data, moreInformation) {
- error.issues.push(errorPromiseIssueKind.setTo({
- source,
- path: error.currentPath.join("."),
- data,
- moreInformation,
- }));
- return error;
+ return SymbolDataParserError;
}
function setErrorPath(error, value, index) {
error.currentPath[index] = value;
@@ -41,16 +39,36 @@ function popErrorPath(error) {
error.currentPath.pop();
return error;
}
+function interpretError(error) {
+ const dataParserError = errorKind.has(error)
+ ? error
+ : unwrap.unwrap(error);
+ return printer.Printer.renderParagraph([
+ printer.Printer.colorizedBold("Validation failed", "red"),
+ dataParserError.issues.map((issue) => printer.Printer.renderParagraph([
+ "",
+ printer.Printer.renderLine([
+ printer.Printer.colorizedBold("✖", "red"),
+ printer.Printer.colorizedBold(issue.path || "", "cyan"),
+ "expected",
+ printer.Printer.colorized(issue.expected, "green"),
+ "but received",
+ printer.Printer.colorized(printer.Printer.stringify(issue.data), "red"),
+ ]),
+ issue.message !== undefined && `${printer.Printer.indent(1)}↳ ${issue.message}`,
+ ])),
+ dataParserError.issues.length === 0 && "No issue found",
+ ]);
+}
+exports.SymbolDataParserError = SymbolDataParserError;
exports.SymbolDataParserErrorIssue = SymbolDataParserErrorIssue;
exports.SymbolDataParserErrorIssueLabel = SymbolDataParserErrorIssueLabel;
-exports.SymbolDataParserErrorPromiseIssue = SymbolDataParserErrorPromiseIssue;
-exports.SymbolDataParserErrorPromiseIssueLabel = SymbolDataParserErrorPromiseIssueLabel;
+exports.SymbolDataParserErrorLabel = SymbolDataParserErrorLabel;
exports.addIssue = addIssue;
-exports.addPromiseIssue = addPromiseIssue;
exports.createError = createError;
exports.errorIssueKind = errorIssueKind;
exports.errorKind = errorKind;
-exports.errorPromiseIssueKind = errorPromiseIssueKind;
+exports.interpretError = interpretError;
exports.popErrorPath = popErrorPath;
exports.setErrorPath = setErrorPath;
diff --git a/docs/public/libs/v1/dataParser/error.d.ts b/docs/public/libs/v1/dataParser/error.d.ts
index 1c964526e..560009e6c 100644
--- a/docs/public/libs/v1/dataParser/error.d.ts
+++ b/docs/public/libs/v1/dataParser/error.d.ts
@@ -1,34 +1,34 @@
import { type Kind } from "../common";
-import { type DataParserTransform } from "./parsers";
-import { type DataParser } from "./base";
-import { type DataParserCheckers } from "./types";
-export declare const SymbolDataParserErrorIssueLabel = "SymbolDataParserErrorIssue";
+import type * as DEither from "../either";
+export declare const SymbolDataParserErrorLabel = "SymbolDataParserError";
+export declare const SymbolDataParserError: unique symbol;
+export type SymbolDataParserError = typeof SymbolDataParserError;
+/**
+ * @deprecated
+ */
+export declare const SymbolDataParserErrorIssueLabel = "SymbolDataParserError";
+/**
+ * @deprecated
+ */
export declare const SymbolDataParserErrorIssue: unique symbol;
+/**
+ * @deprecated
+ */
export type SymbolDataParserErrorIssue = typeof SymbolDataParserErrorIssue;
export declare const errorIssueKind: import("../common").KindHandler>;
export interface DataParserErrorIssue extends Kind {
- readonly source: DataParser | DataParserCheckers;
+ readonly expected: string;
readonly path: string;
readonly data: unknown;
- readonly moreInformation?: string;
-}
-export declare const SymbolDataParserErrorPromiseIssueLabel = "SymbolDataParserErrorPromiseIssue";
-export declare const SymbolDataParserErrorPromiseIssue: unique symbol;
-export type SymbolDataParserErrorPromiseIssue = typeof SymbolDataParserErrorPromiseIssue;
-export declare const errorPromiseIssueKind: import("../common").KindHandler>;
-export interface DataParserErrorPromiseIssue extends Kind {
- readonly source: DataParserTransform;
- readonly path: string;
- readonly data: unknown;
- readonly moreInformation?: string;
+ readonly message: string | undefined;
}
export declare const errorKind: import("../common").KindHandler>;
export interface DataParserError extends Kind {
- readonly issues: (DataParserErrorIssue | DataParserErrorPromiseIssue)[];
+ readonly issues: DataParserErrorIssue[];
readonly currentPath: string[];
}
export declare function createError(): DataParserError;
-export declare function addIssue(error: DataParserError, source: DataParser | DataParserCheckers, data: unknown, moreInformation?: string): DataParserError;
-export declare function addPromiseIssue(error: DataParserError, source: DataParserTransform, data: unknown, moreInformation?: string): DataParserError;
+export declare function addIssue(error: DataParserError, expected: string, data: unknown, message: string | undefined): SymbolDataParserError;
export declare function setErrorPath(error: DataParserError, value: string, index: number): DataParserError;
export declare function popErrorPath(error: DataParserError): DataParserError;
+export declare function interpretError(error: DataParserError | DEither.Left): string;
diff --git a/docs/public/libs/v1/dataParser/error.mjs b/docs/public/libs/v1/dataParser/error.mjs
index bc002a79c..f771fc762 100644
--- a/docs/public/libs/v1/dataParser/error.mjs
+++ b/docs/public/libs/v1/dataParser/error.mjs
@@ -1,11 +1,18 @@
import { createDataParserKind } from './kind.mjs';
+import { Printer } from '../common/printer.mjs';
+import { unwrap } from '../common/unwrap.mjs';
-const SymbolDataParserErrorIssueLabel = "SymbolDataParserErrorIssue";
+const SymbolDataParserErrorLabel = "SymbolDataParserError";
+const SymbolDataParserError = Symbol.for(SymbolDataParserErrorLabel);
+/**
+ * @deprecated
+ */
+const SymbolDataParserErrorIssueLabel = "SymbolDataParserError";
+/**
+ * @deprecated
+ */
const SymbolDataParserErrorIssue = Symbol.for(SymbolDataParserErrorIssueLabel);
const errorIssueKind = createDataParserKind("error-issue");
-const SymbolDataParserErrorPromiseIssueLabel = "SymbolDataParserErrorPromiseIssue";
-const SymbolDataParserErrorPromiseIssue = Symbol.for(SymbolDataParserErrorPromiseIssueLabel);
-const errorPromiseIssueKind = createDataParserKind("error-issue-promise");
const errorKind = createDataParserKind("error");
function createError() {
return errorKind.setTo({
@@ -13,23 +20,14 @@ function createError() {
currentPath: [],
});
}
-function addIssue(error, source, data, moreInformation) {
+function addIssue(error, expected, data, message) {
error.issues.push(errorIssueKind.setTo({
- source,
+ expected,
path: error.currentPath.join("."),
data,
- moreInformation,
+ message,
}));
- return error;
-}
-function addPromiseIssue(error, source, data, moreInformation) {
- error.issues.push(errorPromiseIssueKind.setTo({
- source,
- path: error.currentPath.join("."),
- data,
- moreInformation,
- }));
- return error;
+ return SymbolDataParserError;
}
function setErrorPath(error, value, index) {
error.currentPath[index] = value;
@@ -39,5 +37,26 @@ function popErrorPath(error) {
error.currentPath.pop();
return error;
}
+function interpretError(error) {
+ const dataParserError = errorKind.has(error)
+ ? error
+ : unwrap(error);
+ return Printer.renderParagraph([
+ Printer.colorizedBold("Validation failed", "red"),
+ dataParserError.issues.map((issue) => Printer.renderParagraph([
+ "",
+ Printer.renderLine([
+ Printer.colorizedBold("✖", "red"),
+ Printer.colorizedBold(issue.path || "", "cyan"),
+ "expected",
+ Printer.colorized(issue.expected, "green"),
+ "but received",
+ Printer.colorized(Printer.stringify(issue.data), "red"),
+ ]),
+ issue.message !== undefined && `${Printer.indent(1)}↳ ${issue.message}`,
+ ])),
+ dataParserError.issues.length === 0 && "No issue found",
+ ]);
+}
-export { SymbolDataParserErrorIssue, SymbolDataParserErrorIssueLabel, SymbolDataParserErrorPromiseIssue, SymbolDataParserErrorPromiseIssueLabel, addIssue, addPromiseIssue, createError, errorIssueKind, errorKind, errorPromiseIssueKind, popErrorPath, setErrorPath };
+export { SymbolDataParserError, SymbolDataParserErrorIssue, SymbolDataParserErrorIssueLabel, SymbolDataParserErrorLabel, addIssue, createError, errorIssueKind, errorKind, interpretError, popErrorPath, setErrorPath };
diff --git a/docs/public/libs/v1/dataParser/extended/index.cjs b/docs/public/libs/v1/dataParser/extended/index.cjs
index 37fd53ca8..0cba8786d 100644
--- a/docs/public/libs/v1/dataParser/extended/index.cjs
+++ b/docs/public/libs/v1/dataParser/extended/index.cjs
@@ -53,15 +53,14 @@ exports.templateLiteral = templateLiteral.templateLiteral;
exports.tuple = tuple.tuple;
exports.unknown = unknown.unknown;
exports.recover = recover.recover;
+exports.SymbolDataParserError = error.SymbolDataParserError;
exports.SymbolDataParserErrorIssue = error.SymbolDataParserErrorIssue;
exports.SymbolDataParserErrorIssueLabel = error.SymbolDataParserErrorIssueLabel;
-exports.SymbolDataParserErrorPromiseIssue = error.SymbolDataParserErrorPromiseIssue;
-exports.SymbolDataParserErrorPromiseIssueLabel = error.SymbolDataParserErrorPromiseIssueLabel;
+exports.SymbolDataParserErrorLabel = error.SymbolDataParserErrorLabel;
exports.addIssue = error.addIssue;
-exports.addPromiseIssue = error.addPromiseIssue;
exports.createError = error.createError;
exports.errorIssueKind = error.errorIssueKind;
exports.errorKind = error.errorKind;
-exports.errorPromiseIssueKind = error.errorPromiseIssueKind;
+exports.interpretError = error.interpretError;
exports.popErrorPath = error.popErrorPath;
exports.setErrorPath = error.setErrorPath;
diff --git a/docs/public/libs/v1/dataParser/extended/index.mjs b/docs/public/libs/v1/dataParser/extended/index.mjs
index 4bb79e15d..e84f29d9b 100644
--- a/docs/public/libs/v1/dataParser/extended/index.mjs
+++ b/docs/public/libs/v1/dataParser/extended/index.mjs
@@ -22,4 +22,4 @@ export { templateLiteral } from './templateLiteral.mjs';
export { tuple } from './tuple.mjs';
export { unknown } from './unknown.mjs';
export { recover } from './recover.mjs';
-export { SymbolDataParserErrorIssue, SymbolDataParserErrorIssueLabel, SymbolDataParserErrorPromiseIssue, SymbolDataParserErrorPromiseIssueLabel, addIssue, addPromiseIssue, createError, errorIssueKind, errorKind, errorPromiseIssueKind, popErrorPath, setErrorPath } from '../error.mjs';
+export { SymbolDataParserError, SymbolDataParserErrorIssue, SymbolDataParserErrorIssueLabel, SymbolDataParserErrorLabel, addIssue, createError, errorIssueKind, errorKind, interpretError, popErrorPath, setErrorPath } from '../error.mjs';
diff --git a/docs/public/libs/v1/dataParser/identifier.d.ts b/docs/public/libs/v1/dataParser/identifier.d.ts
index 47a0baf42..fd612d298 100644
--- a/docs/public/libs/v1/dataParser/identifier.d.ts
+++ b/docs/public/libs/v1/dataParser/identifier.d.ts
@@ -8,13 +8,13 @@ import { type DataParser } from "./base";
* parsers, the correct type can be retrieved.
*/
export declare const identifier: {
- > | import("../common").KindHandler> | import("../common").KindHandler> | import("../common").KindHandler> | import("../common").KindHandler> | import("../common").KindHandler