silentium-validation 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +11 -1
- package/package.json +6 -6
- package/src/models/Validated.test.ts +2 -2
- package/src/models/ValidationErrors.test.ts +0 -15
- package/src/models/ValidationErrorsSummary.test.ts +2 -2
- package/src/models/ValidationErrorsTouched.test.ts +2 -2
- package/src/models/ValidationItems.test.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.0.4](https://github.com/silentium-lab/silentium-validation/compare/v0.0.3...v0.0.4) (2025-12-05)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **main:** update deps ([8a6298c](https://github.com/silentium-lab/silentium-validation/commit/8a6298c00e24ef25382e02215ceaaccb8f4678e4))
|
|
11
|
+
|
|
12
|
+
### [0.0.3](https://github.com/silentium-lab/silentium-validation/compare/v0.0.2...v0.0.3) (2025-12-02)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **main:** fix links in package json ([5e42621](https://github.com/silentium-lab/silentium-validation/commit/5e42621f10e90a334f8e45d722787e3029f034ac))
|
|
18
|
+
* **main:** readme header ([af23f16](https://github.com/silentium-lab/silentium-validation/commit/af23f168abc06789f2d634bfe4d04e3b549d9661))
|
|
19
|
+
|
|
5
20
|
### 0.0.2 (2025-12-02)
|
|
6
21
|
|
|
7
22
|
|
package/README.md
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://silentium-lab.github.io/silentium/#/en/" target="_blank" rel="noopener noreferrer" style="display:flex">
|
|
3
|
+
<img width="180" src="https://silentium-lab.github.io/silentium/assets/img/logo.svg" alt="logo">
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
<h1 align="center">Silentium Validation</h1>
|
|
7
|
+
<br/>
|
|
8
|
+
<p align="center">
|
|
9
|
+
<a href="https://npmjs.com/package/silentium"><img src="https://img.shields.io/npm/v/silentium-validation.svg" alt="npm package"></a>
|
|
10
|
+
</p>
|
|
11
|
+
<br/>
|
|
2
12
|
|
|
3
13
|
A reactive validation library built on the Silentium library for TypeScript applications. Provides asynchronous and reactive validation capabilities with a simple, composable API.
|
|
4
14
|
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "silentium-validation",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Validation library based on silentium",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Silentium Lab",
|
|
7
7
|
"type": "module",
|
|
8
|
-
"main": "dist/
|
|
9
|
-
"module": "dist/
|
|
10
|
-
"typings": "dist/
|
|
8
|
+
"main": "dist/silentium_validation.js",
|
|
9
|
+
"module": "dist/silentium_validation.mjs",
|
|
10
|
+
"typings": "dist/silentium_validation.d.ts",
|
|
11
11
|
"keywords": [
|
|
12
12
|
"validation",
|
|
13
13
|
"vanilla",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"vitest": "^4.0.14"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"silentium": "^0.0.
|
|
51
|
-
"silentium-components": "^0.0.
|
|
50
|
+
"silentium": "^0.0.169",
|
|
51
|
+
"silentium-components": "^0.0.94"
|
|
52
52
|
},
|
|
53
53
|
"config": {
|
|
54
54
|
"commitizen": {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Computed,
|
|
1
|
+
import { Computed, Late } from "silentium";
|
|
2
2
|
import { describe, expect, test } from "vitest";
|
|
3
3
|
import { Validated } from "@/models/Validated";
|
|
4
4
|
|
|
5
5
|
describe("Validated.test", () => {
|
|
6
6
|
test("should handle empty form", async () => {
|
|
7
|
-
const $errors =
|
|
7
|
+
const $errors = Late<any>({
|
|
8
8
|
name: ["too long"],
|
|
9
9
|
});
|
|
10
10
|
const $validated = Computed(Validated, $errors);
|
|
@@ -90,21 +90,6 @@ describe("ValidationErrors", () => {
|
|
|
90
90
|
});
|
|
91
91
|
});
|
|
92
92
|
|
|
93
|
-
it("should handle undefined results from rules", async () => {
|
|
94
|
-
const mockForm: ValidationItem[] = [
|
|
95
|
-
{
|
|
96
|
-
key: "test",
|
|
97
|
-
value: "value",
|
|
98
|
-
rules: [() => undefined as any],
|
|
99
|
-
},
|
|
100
|
-
];
|
|
101
|
-
const $errors = ValidationErrors(mockForm);
|
|
102
|
-
const errors = await $errors;
|
|
103
|
-
expect(errors).toStrictEqual({
|
|
104
|
-
test: [undefined],
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
|
|
108
93
|
it("should handle duplicate keys, keeping the last", async () => {
|
|
109
94
|
const mockForm: ValidationItem[] = [
|
|
110
95
|
{
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Computed,
|
|
1
|
+
import { Computed, Late } from "silentium";
|
|
2
2
|
import { describe, expect, test } from "vitest";
|
|
3
3
|
import { ValidationErrorType } from "@/types";
|
|
4
4
|
import { ValidationErrorsSummary } from "@/models/ValidationErrorsSummary";
|
|
5
5
|
|
|
6
6
|
describe("ValidationErrorsSummary.test", () => {
|
|
7
7
|
test("regular", async () => {
|
|
8
|
-
const $errors =
|
|
8
|
+
const $errors = Late<ValidationErrorType>({});
|
|
9
9
|
const $summary = Computed(ValidationErrorsSummary, $errors);
|
|
10
10
|
expect(await $summary).toStrictEqual([]);
|
|
11
11
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, test } from "vitest";
|
|
2
2
|
import { ValidationErrorsTouched } from "@/models/ValidationErrorsTouched";
|
|
3
|
-
import { Computed,
|
|
3
|
+
import { Computed, Late } from "silentium";
|
|
4
4
|
import { ValidationErrors } from "@/models/ValidationErrors";
|
|
5
5
|
import { ValidationItems } from "@/models/ValidationItems";
|
|
6
6
|
import { Integer, Required } from "@/rules";
|
|
@@ -9,7 +9,7 @@ describe("ValidationErrorsTouched.test", () => {
|
|
|
9
9
|
test("regular", async () => {
|
|
10
10
|
expect(true).toBe(true);
|
|
11
11
|
|
|
12
|
-
const $form =
|
|
12
|
+
const $form = Late<any>({
|
|
13
13
|
name: "",
|
|
14
14
|
age: 0,
|
|
15
15
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ValidationErrors } from "@/models/ValidationErrors";
|
|
2
2
|
import { ValidationItems } from "@/models/ValidationItems";
|
|
3
3
|
import { Integer, Required } from "@/rules";
|
|
4
|
-
import { Computed,
|
|
4
|
+
import { Computed, Late } from "silentium";
|
|
5
5
|
import { describe, expect, test } from "vitest";
|
|
6
6
|
|
|
7
7
|
describe("ValidationItems", () => {
|
|
@@ -29,7 +29,7 @@ describe("ValidationItems", () => {
|
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
test("reactive variant", async () => {
|
|
32
|
-
const form =
|
|
32
|
+
const form = Late({ name: "John", age: 30 });
|
|
33
33
|
const rules = {
|
|
34
34
|
name: [Required],
|
|
35
35
|
age: [Integer],
|