@atscript/typescript 0.1.102 → 0.1.103
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/dist/cli.cjs +244 -78
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{json-schema-CW_50s1W.mjs → json-schema-BGYiqs-J.mjs} +202 -69
- package/dist/{json-schema-B9xrfeoQ.cjs → json-schema-L8xJQiLc.cjs} +202 -69
- package/dist/{plugin-DORafTJq.cjs → plugin-2TNKdtc6.cjs} +43 -10
- package/dist/{plugin-CECXHL6M.mjs → plugin-BN6tnRsJ.mjs} +43 -10
- package/dist/test-utils.cjs +1 -1
- package/dist/test-utils.mjs +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.ts +14 -0
- package/dist/utils.mjs +1 -1
- package/package.json +2 -2
package/dist/utils.d.ts
CHANGED
|
@@ -91,14 +91,28 @@ declare class Validator<T extends TAtscriptAnnotatedType = TAtscriptAnnotatedTyp
|
|
|
91
91
|
protected get path(): string;
|
|
92
92
|
protected validateAnnotatedType(def: TAtscriptAnnotatedType, value: any): boolean;
|
|
93
93
|
protected validateUnion(def: TAtscriptAnnotatedType<TAtscriptTypeComplex>, value: any): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Constraints annotated on the union itself (`@expect.min 0` on `number | null`)
|
|
96
|
+
* apply to the non-null value that matched `branch`, on top of the branch's own.
|
|
97
|
+
* A literal branch (an enum value) is exempt: its value is fixed.
|
|
98
|
+
*/
|
|
99
|
+
protected validateUnionConstraints(def: TAtscriptAnnotatedType<TAtscriptTypeComplex>, branch: TAtscriptAnnotatedType, value: any): boolean;
|
|
94
100
|
protected validateIntersection(def: TAtscriptAnnotatedType<TAtscriptTypeComplex>, value: any): boolean;
|
|
95
101
|
protected validateTuple(def: TAtscriptAnnotatedType<TAtscriptTypeComplex>, value: any): boolean;
|
|
96
102
|
protected validateArray(def: TAtscriptAnnotatedType<TAtscriptTypeArray>, value: any): boolean;
|
|
103
|
+
/** `@expect.minLength` / `maxLength` / `array.uniqueItems` checks for an array value. */
|
|
104
|
+
protected validateArrayConstraints(metadata: TMetadataMap<AtscriptMetadata>, value: any[], of?: TAtscriptAnnotatedType): boolean;
|
|
97
105
|
protected validateObject(def: TAtscriptAnnotatedType<TAtscriptTypeObject>, value: any): boolean;
|
|
98
106
|
protected validatePrimitive(def: TAtscriptAnnotatedType<TAtscriptTypeFinal>, value: any): boolean;
|
|
99
107
|
protected validateString(def: TAtscriptAnnotatedType<TAtscriptTypeFinal>, value: string): boolean;
|
|
108
|
+
/** `@meta.required` / `@expect.minLength` / `maxLength` / `pattern` checks for a string value. */
|
|
109
|
+
protected validateStringConstraints(metadata: TMetadataMap<AtscriptMetadata>, value: string): boolean;
|
|
100
110
|
protected validateNumber(def: TAtscriptAnnotatedType<TAtscriptTypeFinal>, value: number): boolean;
|
|
111
|
+
/** `@expect.int` / `min` / `max` checks for a number value. */
|
|
112
|
+
protected validateNumberConstraints(metadata: TMetadataMap<AtscriptMetadata>, value: number): boolean;
|
|
101
113
|
protected validateBoolean(def: TAtscriptAnnotatedType<TAtscriptTypeFinal>, value: boolean): boolean;
|
|
114
|
+
/** `@meta.required` check for a boolean value (must be `true`). */
|
|
115
|
+
protected validateBooleanConstraints(metadata: TMetadataMap<AtscriptMetadata>, value: boolean): boolean;
|
|
102
116
|
}
|
|
103
117
|
/** Error thrown by {@link Validator.validate} when validation fails. Contains structured error details. */
|
|
104
118
|
declare class ValidatorError extends Error {
|
package/dist/utils.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as forAnnotatedType, c as createAnnotatedTypeNode, d as isAnnotatedTypeOfPrimitive, f as isPhantomType, i as mergeJsonSchemas, l as defineAnnotatedType, m as ValidatorError, n as detectDiscriminator, o as annotate, p as Validator, r as fromJsonSchema, s as cloneRefProp, t as buildJsonSchema, u as isAnnotatedType } from "./json-schema-
|
|
1
|
+
import { a as forAnnotatedType, c as createAnnotatedTypeNode, d as isAnnotatedTypeOfPrimitive, f as isPhantomType, i as mergeJsonSchemas, l as defineAnnotatedType, m as ValidatorError, n as detectDiscriminator, o as annotate, p as Validator, r as fromJsonSchema, s as cloneRefProp, t as buildJsonSchema, u as isAnnotatedType } from "./json-schema-BGYiqs-J.mjs";
|
|
2
2
|
|
|
3
3
|
//#region packages/typescript/src/runtime/coerce.ts
|
|
4
4
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atscript/typescript",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.103",
|
|
4
4
|
"description": "Atscript: typescript-gen support.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"annotations",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"@atscript/db": "^0.1.97",
|
|
76
|
-
"@atscript/core": "^0.1.
|
|
76
|
+
"@atscript/core": "^0.1.103"
|
|
77
77
|
},
|
|
78
78
|
"peerDependenciesMeta": {
|
|
79
79
|
"@atscript/db": {
|