tyneq 1.0.0 → 1.0.2
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/README.md +67 -1
- package/dist/{TyneqCachedTerminalOperator.d.ts → TyneqCachedTerminalOperator-BrW77zIy.d.ts} +328 -173
- package/dist/{TyneqCachedTerminalOperator.d.cts → TyneqCachedTerminalOperator-EaNiNt61.d.cts} +328 -173
- package/dist/chunk-5R4AALC7.js +680 -0
- package/dist/chunk-C5PBY3ZU.cjs +46 -0
- package/dist/chunk-OWKUE3AC.cjs +680 -0
- package/dist/chunk-PCBN5AFG.js +46 -0
- package/dist/chunk-VJAICXA6.cjs +3788 -0
- package/dist/chunk-ZP6WMZCK.js +3788 -0
- package/dist/core-C54TSmgW.d.cts +1390 -0
- package/dist/core-C54TSmgW.d.ts +1390 -0
- package/dist/index.cjs +638 -843
- package/dist/index.d.cts +405 -605
- package/dist/index.d.ts +405 -605
- package/dist/index.js +630 -781
- package/dist/plugin/index.cjs +51 -24
- package/dist/plugin/index.d.cts +35 -38
- package/dist/plugin/index.d.ts +35 -38
- package/dist/plugin/index.js +51 -2
- package/dist/utility/index.cjs +18 -9
- package/dist/utility/index.d.cts +312 -2
- package/dist/utility/index.d.ts +312 -2
- package/dist/utility/index.js +18 -3
- package/package.json +5 -5
- package/dist/Lazy.cjs +0 -762
- package/dist/Lazy.cjs.map +0 -1
- package/dist/Lazy.js +0 -691
- package/dist/Lazy.js.map +0 -1
- package/dist/TyneqCachedTerminalOperator.cjs +0 -4950
- package/dist/TyneqCachedTerminalOperator.cjs.map +0 -1
- package/dist/TyneqCachedTerminalOperator.d.cts.map +0 -1
- package/dist/TyneqCachedTerminalOperator.d.ts.map +0 -1
- package/dist/TyneqCachedTerminalOperator.js +0 -4741
- package/dist/TyneqCachedTerminalOperator.js.map +0 -1
- package/dist/ValidationBuilder.cjs +0 -80
- package/dist/ValidationBuilder.cjs.map +0 -1
- package/dist/ValidationBuilder.d.cts +0 -319
- package/dist/ValidationBuilder.d.cts.map +0 -1
- package/dist/ValidationBuilder.d.ts +0 -319
- package/dist/ValidationBuilder.d.ts.map +0 -1
- package/dist/ValidationBuilder.js +0 -69
- package/dist/ValidationBuilder.js.map +0 -1
- package/dist/core.d.cts +0 -1393
- package/dist/core.d.cts.map +0 -1
- package/dist/core.d.ts +0 -1393
- package/dist/core.d.ts.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/plugin/index.d.cts.map +0 -1
- package/dist/plugin/index.d.ts.map +0 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ArgumentError
|
|
3
|
+
} from "./chunk-5R4AALC7.js";
|
|
4
|
+
|
|
5
|
+
// src/core/errors/argument/ValidationError.ts
|
|
6
|
+
var ValidationError = class extends ArgumentError {
|
|
7
|
+
constructor(errors) {
|
|
8
|
+
super(
|
|
9
|
+
`${errors.length} validation error(s):
|
|
10
|
+
${errors.map((e, i) => ` ${i + 1}. ${e}`).join("\n")}`
|
|
11
|
+
);
|
|
12
|
+
this.errors = errors;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// src/utility/ValidationBuilder.ts
|
|
17
|
+
var ValidationBuilder = class {
|
|
18
|
+
constructor() {
|
|
19
|
+
this.errors = [];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Runs `fn` and collects any thrown error message. Returns `this` for chaining.
|
|
23
|
+
*/
|
|
24
|
+
check(fn) {
|
|
25
|
+
try {
|
|
26
|
+
fn();
|
|
27
|
+
} catch (e) {
|
|
28
|
+
this.errors.push(e instanceof Error ? e.message : String(e));
|
|
29
|
+
}
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Throws a `ValidationError` with all collected messages if any `check` calls failed.
|
|
34
|
+
* Does nothing when no errors were collected.
|
|
35
|
+
*/
|
|
36
|
+
throwIfAny() {
|
|
37
|
+
if (this.errors.length > 0) {
|
|
38
|
+
throw new ValidationError(this.errors);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
ValidationError,
|
|
45
|
+
ValidationBuilder
|
|
46
|
+
};
|