typebox 1.1.20 → 1.1.21
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/build/compile/compile.mjs +1 -0
- package/build/compile/validator.mjs +1 -1
- package/build/error/errors.mjs +1 -0
- package/build/format/iri-reference.mjs +1 -0
- package/build/format/uri-reference.mjs +1 -0
- package/build/guard/globals.d.mts +3 -3
- package/build/guard/guard.d.mts +1 -1
- package/build/schema/build.mjs +3 -3
- package/build/schema/engine/_functions.mjs +1 -1
- package/build/schema/engine/_guard.d.mts +3 -3
- package/build/schema/engine/_guard.mjs +3 -3
- package/build/schema/engine/_refine.d.mts +3 -3
- package/build/schema/engine/_refine.mjs +3 -3
- package/build/schema/engine/additionalProperties.d.mts +2 -2
- package/build/schema/engine/additionalProperties.mjs +2 -2
- package/build/schema/engine/anyOf.mjs +1 -1
- package/build/schema/engine/boolean.d.mts +2 -2
- package/build/schema/engine/boolean.mjs +2 -2
- package/build/schema/engine/const.d.mts +2 -2
- package/build/schema/engine/const.mjs +2 -2
- package/build/schema/engine/dependentRequired.d.mts +3 -3
- package/build/schema/engine/dependentRequired.mjs +3 -3
- package/build/schema/engine/enum.d.mts +2 -2
- package/build/schema/engine/enum.mjs +2 -2
- package/build/schema/engine/exclusiveMaximum.d.mts +2 -2
- package/build/schema/engine/exclusiveMaximum.mjs +2 -2
- package/build/schema/engine/exclusiveMinimum.d.mts +2 -2
- package/build/schema/engine/exclusiveMinimum.mjs +2 -2
- package/build/schema/engine/format.d.mts +2 -2
- package/build/schema/engine/format.mjs +2 -2
- package/build/schema/engine/maxItems.d.mts +2 -2
- package/build/schema/engine/maxItems.mjs +2 -2
- package/build/schema/engine/maxLength.d.mts +2 -2
- package/build/schema/engine/maxLength.mjs +2 -2
- package/build/schema/engine/maxProperties.d.mts +2 -2
- package/build/schema/engine/maxProperties.mjs +2 -2
- package/build/schema/engine/maximum.d.mts +2 -2
- package/build/schema/engine/maximum.mjs +2 -2
- package/build/schema/engine/minItems.d.mts +2 -2
- package/build/schema/engine/minItems.mjs +2 -2
- package/build/schema/engine/minLength.d.mts +2 -2
- package/build/schema/engine/minLength.mjs +2 -2
- package/build/schema/engine/minProperties.d.mts +2 -2
- package/build/schema/engine/minProperties.mjs +2 -2
- package/build/schema/engine/minimum.d.mts +2 -2
- package/build/schema/engine/minimum.mjs +2 -2
- package/build/schema/engine/multipleOf.d.mts +2 -2
- package/build/schema/engine/multipleOf.mjs +2 -2
- package/build/schema/engine/pattern.d.mts +2 -2
- package/build/schema/engine/pattern.mjs +2 -2
- package/build/schema/engine/recursiveRef.d.mts +1 -1
- package/build/schema/engine/recursiveRef.mjs +1 -1
- package/build/schema/engine/ref.d.mts +1 -1
- package/build/schema/engine/ref.mjs +1 -1
- package/build/schema/engine/required.d.mts +3 -3
- package/build/schema/engine/required.mjs +3 -3
- package/build/schema/engine/type.mjs +2 -2
- package/build/schema/engine/uniqueItems.d.mts +3 -3
- package/build/schema/engine/uniqueItems.mjs +3 -3
- package/build/schema/resolve/ref.mjs +1 -1
- package/build/schema/static/additionalProperties.mjs +1 -0
- package/build/schema/static/ref.mjs +1 -0
- package/build/schema/static/required.mjs +1 -0
- package/build/schema/static/static.mjs +1 -0
- package/build/schema/static/type.mjs +1 -0
- package/build/schema/static/unevaluatedProperties.mjs +1 -0
- package/build/system/environment/environment.d.mts +1 -1
- package/build/system/environment/environment.mjs +1 -1
- package/build/system/environment/evaluate.d.mts +9 -0
- package/build/system/environment/evaluate.mjs +37 -0
- package/build/system/memory/assign.mjs +1 -0
- package/build/system/memory/create.mjs +2 -1
- package/build/system/memory/discard.mjs +1 -0
- package/build/type/action/awaited.mjs +1 -0
- package/build/type/action/capitalize.mjs +1 -0
- package/build/type/action/conditional.mjs +1 -0
- package/build/type/action/constructor-parameters.mjs +1 -0
- package/build/type/action/evaluate.mjs +1 -0
- package/build/type/action/exclude.mjs +1 -0
- package/build/type/action/extract.mjs +1 -0
- package/build/type/action/indexed.mjs +1 -0
- package/build/type/action/instance-type.mjs +1 -0
- package/build/type/action/interface.mjs +1 -0
- package/build/type/action/keyof.mjs +1 -0
- package/build/type/action/lowercase.mjs +1 -0
- package/build/type/action/mapped.mjs +1 -0
- package/build/type/action/module.mjs +1 -0
- package/build/type/action/non-nullable.mjs +1 -0
- package/build/type/action/omit.mjs +1 -0
- package/build/type/action/options.mjs +1 -0
- package/build/type/action/parameters.mjs +1 -0
- package/build/type/action/partial.mjs +1 -0
- package/build/type/action/pick.mjs +1 -0
- package/build/type/action/readonly-type.mjs +1 -0
- package/build/type/action/required.mjs +1 -0
- package/build/type/action/return-type.mjs +1 -0
- package/build/type/action/uncapitalize.mjs +1 -0
- package/build/type/action/uppercase.mjs +1 -0
- package/build/type/engine/constructor-parameters/instantiate.mjs +1 -0
- package/build/type/engine/cyclic/extends.mjs +4 -4
- package/build/type/engine/cyclic/instantiate.mjs +1 -0
- package/build/type/engine/evaluate/broaden.mjs +1 -1
- package/build/type/engine/evaluate/compare.mjs +1 -0
- package/build/type/engine/exclude/instantiate.mjs +1 -0
- package/build/type/engine/extract/instantiate.mjs +1 -0
- package/build/type/engine/helpers/union.mjs +1 -0
- package/build/type/engine/indexed/from-array.mjs +1 -0
- package/build/type/engine/indexed/from-tuple.mjs +1 -0
- package/build/type/engine/interface/instantiate.mjs +1 -1
- package/build/type/engine/mapped/instantiate.mjs +1 -0
- package/build/type/engine/module/instantiate.mjs +1 -0
- package/build/type/engine/non-nullable/instantiate.mjs +1 -0
- package/build/type/engine/object/from-intersect.mjs +1 -0
- package/build/type/engine/object/from-type.mjs +1 -0
- package/build/type/engine/parameters/instantiate.mjs +1 -0
- package/build/type/engine/partial/from-type.mjs +1 -0
- package/build/type/engine/pick/instantiate.mjs +1 -0
- package/build/type/engine/record/from-key-integer.d.mts +2 -2
- package/build/type/engine/record/from-key-integer.mjs +1 -1
- package/build/type/engine/record/from-key-number.d.mts +1 -1
- package/build/type/engine/record/from-key-number.mjs +1 -1
- package/build/type/engine/required/from-type.mjs +1 -0
- package/build/type/engine/template-literal/encode.mjs +1 -1
- package/build/type/engine/template-literal/is-finite.mjs +1 -1
- package/build/type/engine/tuple/to-object.mjs +1 -0
- package/build/type/extends/extends-right.d.mts +1 -1
- package/build/type/extends/extends-right.mjs +1 -1
- package/build/type/extends/inference.mjs +1 -0
- package/build/type/extends/object.mjs +1 -0
- package/build/type/types/_codec.d.mts +1 -1
- package/build/type/types/_codec.mjs +1 -0
- package/build/type/types/base.d.mts +2 -2
- package/build/type/types/base.mjs +2 -2
- package/build/type/types/call.mjs +1 -0
- package/build/type/types/never.mjs +1 -0
- package/build/type/types/properties.mjs +0 -1
- package/build/type/types/record.mjs +1 -0
- package/build/type/types/ref.mjs +1 -0
- package/build/value/clean/from-base.d.mts +1 -1
- package/build/value/clean/from-base.mjs +1 -1
- package/build/value/codec/callback.mjs +2 -2
- package/build/value/codec/from-union.mjs +1 -1
- package/build/value/convert/from-base.d.mts +1 -1
- package/build/value/convert/from-base.mjs +1 -1
- package/build/value/convert/from-bigint.d.mts +1 -1
- package/build/value/convert/from-bigint.mjs +1 -1
- package/build/value/convert/from-boolean.d.mts +1 -1
- package/build/value/convert/from-boolean.mjs +1 -1
- package/build/value/convert/from-integer.d.mts +1 -1
- package/build/value/convert/from-integer.mjs +1 -1
- package/build/value/convert/from-literal.mjs +4 -4
- package/build/value/convert/from-null.d.mts +1 -1
- package/build/value/convert/from-null.mjs +1 -1
- package/build/value/convert/from-number.d.mts +1 -1
- package/build/value/convert/from-number.mjs +1 -1
- package/build/value/convert/from-string.d.mts +1 -1
- package/build/value/convert/from-string.mjs +1 -1
- package/build/value/convert/from-undefined.d.mts +1 -1
- package/build/value/convert/from-undefined.mjs +1 -1
- package/build/value/convert/from-void.d.mts +1 -1
- package/build/value/convert/from-void.mjs +1 -1
- package/build/value/create/from-async-iterator.d.mts +1 -1
- package/build/value/create/from-async-iterator.mjs +1 -1
- package/build/value/create/from-base.d.mts +1 -1
- package/build/value/create/from-base.mjs +1 -1
- package/build/value/create/from-bigint.d.mts +1 -1
- package/build/value/create/from-bigint.mjs +1 -1
- package/build/value/create/from-boolean.d.mts +1 -1
- package/build/value/create/from-boolean.mjs +1 -1
- package/build/value/create/from-default.d.mts +1 -1
- package/build/value/create/from-default.mjs +1 -1
- package/build/value/create/from-integer.d.mts +1 -1
- package/build/value/create/from-integer.mjs +1 -1
- package/build/value/create/from-iterator.d.mts +1 -1
- package/build/value/create/from-iterator.mjs +1 -1
- package/build/value/create/from-literal.d.mts +1 -1
- package/build/value/create/from-literal.mjs +1 -1
- package/build/value/create/from-never.d.mts +1 -1
- package/build/value/create/from-never.mjs +1 -1
- package/build/value/create/from-null.d.mts +1 -1
- package/build/value/create/from-null.mjs +1 -1
- package/build/value/create/from-number.d.mts +1 -1
- package/build/value/create/from-number.mjs +1 -1
- package/build/value/create/from-record.d.mts +1 -1
- package/build/value/create/from-record.mjs +1 -1
- package/build/value/create/from-string.d.mts +1 -1
- package/build/value/create/from-string.mjs +1 -1
- package/build/value/create/from-symbol.d.mts +1 -1
- package/build/value/create/from-symbol.mjs +1 -1
- package/build/value/create/from-undefined.d.mts +1 -1
- package/build/value/create/from-undefined.mjs +1 -1
- package/build/value/create/from-void.d.mts +1 -1
- package/build/value/create/from-void.mjs +1 -1
- package/package.json +1 -1
- package/build/system/environment/can-evaluate.d.mts +0 -2
- package/build/system/environment/can-evaluate.mjs +0 -26
|
@@ -70,7 +70,7 @@ export class Validator extends Base {
|
|
|
70
70
|
}
|
|
71
71
|
/** Inspects a value and returns a detailed list of validation errors. */
|
|
72
72
|
Errors(value) {
|
|
73
|
-
if (Environment.
|
|
73
|
+
if (Environment.CanEvaluate() && this.check(value))
|
|
74
74
|
return [];
|
|
75
75
|
return Errors(this.context, this.type, value);
|
|
76
76
|
}
|
package/build/error/errors.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// deno-lint-ignore-file no-control-regex
|
|
1
2
|
const UriReference = /^(?!.*[^\x00-\x7F])(?!.*\\)(?:(?:[a-z][a-z0-9+\-.]*:)?(?:\/\/[^\s[\]{}<>^`|]*)?|[^\s[\]{}<>^`|]*)(?:\?[^\s[\]{}<>^`|]*)?(?:#[^\s[\]{}<>^`|]*)?$/i;
|
|
2
3
|
/**
|
|
3
4
|
* Returns true if the value is a valid URI Reference.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare function IsBoolean(value: unknown): value is Boolean;
|
|
2
|
-
export declare function IsNumber(value: unknown): value is Number;
|
|
3
|
-
export declare function IsString(value: unknown): value is String;
|
|
1
|
+
export declare function IsBoolean(value: unknown): value is globalThis.Boolean;
|
|
2
|
+
export declare function IsNumber(value: unknown): value is globalThis.Number;
|
|
3
|
+
export declare function IsString(value: unknown): value is globalThis.String;
|
|
4
4
|
export type TTypeArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;
|
|
5
5
|
export declare function IsTypeArray(value: unknown): value is TTypeArray;
|
|
6
6
|
/** Returns true if the value is a Int8Array */
|
package/build/guard/guard.d.mts
CHANGED
|
@@ -9,7 +9,7 @@ export declare function IsBoolean(value: unknown): value is boolean;
|
|
|
9
9
|
/** Returns true if this value is a constructor */
|
|
10
10
|
export declare function IsConstructor(value: unknown): value is new (...args: never[]) => unknown;
|
|
11
11
|
/** Returns true if this value is a function */
|
|
12
|
-
export declare function IsFunction(value: unknown): value is Function;
|
|
12
|
+
export declare function IsFunction(value: unknown): value is globalThis.Function;
|
|
13
13
|
/** Returns true if this value is integer */
|
|
14
14
|
export declare function IsInteger(value: unknown): value is number;
|
|
15
15
|
/** Returns true if this value is an iterator */
|
package/build/schema/build.mjs
CHANGED
|
@@ -20,7 +20,7 @@ function CreateCode(build) {
|
|
|
20
20
|
// CreateEvaluatedCheck
|
|
21
21
|
// ------------------------------------------------------------------
|
|
22
22
|
function CreateEvaluatedCheck(build, code) {
|
|
23
|
-
const factory =
|
|
23
|
+
const factory = Environment.Evaluate('CheckContext', 'Guard', 'Format', 'Hashing', build.External().identifier, code);
|
|
24
24
|
return factory(Engine.CheckContext, Guard, Format, Hashing, build.External().variables);
|
|
25
25
|
}
|
|
26
26
|
// ------------------------------------------------------------------
|
|
@@ -35,7 +35,7 @@ function CreateDynamicCheck(build) {
|
|
|
35
35
|
// CreateCheck
|
|
36
36
|
// ------------------------------------------------------------------
|
|
37
37
|
function CreateCheck(build, code) {
|
|
38
|
-
return Environment.
|
|
38
|
+
return Environment.CanEvaluate()
|
|
39
39
|
? CreateEvaluatedCheck(build, code)
|
|
40
40
|
: CreateDynamicCheck(build);
|
|
41
41
|
}
|
|
@@ -79,7 +79,7 @@ export class BuildResult {
|
|
|
79
79
|
Evaluate() {
|
|
80
80
|
const Code = CreateCode(this);
|
|
81
81
|
const Check = CreateCheck(this, Code);
|
|
82
|
-
return { IsAccelerated: Environment.
|
|
82
|
+
return { IsAccelerated: Environment.CanEvaluate(), Code, Check };
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
/** Builds a schema into a optimized runtime validator */
|
|
@@ -7,7 +7,7 @@ const functions = new Map();
|
|
|
7
7
|
// ------------------------------------------------------------------
|
|
8
8
|
// CreateCallExpression
|
|
9
9
|
// ------------------------------------------------------------------
|
|
10
|
-
function CreateCallExpression(context,
|
|
10
|
+
function CreateCallExpression(context, _schema, hash, value) {
|
|
11
11
|
return context.UseUnevaluated()
|
|
12
12
|
? E.Call(`check_${hash}`, ['context', value])
|
|
13
13
|
: E.Call(`check_${hash}`, [value]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
2
|
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildGuard(
|
|
5
|
-
export declare function CheckGuard(
|
|
6
|
-
export declare function ErrorGuard(
|
|
4
|
+
export declare function BuildGuard(_stack: Stack, _context: BuildContext, schema: Schema.XGuard, value: string): string;
|
|
5
|
+
export declare function CheckGuard(_stack: Stack, _context: CheckContext, schema: Schema.XGuard, value: unknown): boolean;
|
|
6
|
+
export declare function ErrorGuard(_stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XGuard, value: unknown): boolean;
|
|
@@ -4,19 +4,19 @@ import { EmitGuard as E } from '../../guard/index.mjs';
|
|
|
4
4
|
// ------------------------------------------------------------------
|
|
5
5
|
// Build
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
|
-
export function BuildGuard(
|
|
7
|
+
export function BuildGuard(_stack, _context, schema, value) {
|
|
8
8
|
return E.Call(E.Member(E.Member(Externals.CreateVariable(schema), '~guard'), 'check'), [value]);
|
|
9
9
|
}
|
|
10
10
|
// ------------------------------------------------------------------
|
|
11
11
|
// Check
|
|
12
12
|
// ------------------------------------------------------------------
|
|
13
|
-
export function CheckGuard(
|
|
13
|
+
export function CheckGuard(_stack, _context, schema, value) {
|
|
14
14
|
return schema['~guard'].check(value);
|
|
15
15
|
}
|
|
16
16
|
// ------------------------------------------------------------------
|
|
17
17
|
// Error
|
|
18
18
|
// ------------------------------------------------------------------
|
|
19
|
-
export function ErrorGuard(
|
|
19
|
+
export function ErrorGuard(_stack, context, schemaPath, instancePath, schema, value) {
|
|
20
20
|
return schema['~guard'].check(value) || context.AddError({
|
|
21
21
|
keyword: '~guard',
|
|
22
22
|
schemaPath,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as S from '../types/index.mjs';
|
|
2
2
|
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildRefine(
|
|
5
|
-
export declare function CheckRefine(
|
|
6
|
-
export declare function ErrorRefine(
|
|
4
|
+
export declare function BuildRefine(_stack: Stack, _context: BuildContext, schema: S.XRefine, value: string): string;
|
|
5
|
+
export declare function CheckRefine(_stack: Stack, _context: CheckContext, schema: S.XRefine, value: unknown): boolean;
|
|
6
|
+
export declare function ErrorRefine(_stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: S.XRefine, value: unknown): boolean;
|
|
@@ -4,20 +4,20 @@ import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
|
|
|
4
4
|
// ------------------------------------------------------------------
|
|
5
5
|
// Build
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
|
-
export function BuildRefine(
|
|
7
|
+
export function BuildRefine(_stack, _context, schema, value) {
|
|
8
8
|
const refinements = V.CreateVariable(schema['~refine'].map((refinement) => refinement));
|
|
9
9
|
return E.Every(refinements, E.Constant(0), ['refinement', '_'], E.Call(E.Member('refinement', 'refine'), [value]));
|
|
10
10
|
}
|
|
11
11
|
// ------------------------------------------------------------------
|
|
12
12
|
// Check
|
|
13
13
|
// ------------------------------------------------------------------
|
|
14
|
-
export function CheckRefine(
|
|
14
|
+
export function CheckRefine(_stack, _context, schema, value) {
|
|
15
15
|
return G.Every(schema['~refine'], 0, (refinement, _) => refinement.refine(value));
|
|
16
16
|
}
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
18
|
// Error
|
|
19
19
|
// ------------------------------------------------------------------
|
|
20
|
-
export function ErrorRefine(
|
|
20
|
+
export function ErrorRefine(_stack, context, schemaPath, instancePath, schema, value) {
|
|
21
21
|
return G.EveryAll(schema['~refine'], 0, (refinement, index) => {
|
|
22
22
|
return refinement.refine(value) || context.AddError({
|
|
23
23
|
keyword: '~refine',
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as S from '../types/index.mjs';
|
|
2
2
|
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function CanAdditionalPropertiesFast(
|
|
5
|
-
export declare function BuildAdditionalPropertiesFast(
|
|
4
|
+
export declare function CanAdditionalPropertiesFast(_context: BuildContext, schema: S.XAdditionalProperties, _value: string): schema is S.XAdditionalProperties & S.XRequired;
|
|
5
|
+
export declare function BuildAdditionalPropertiesFast(_context: BuildContext, schema: S.XAdditionalProperties & S.XRequired, value: string): string;
|
|
6
6
|
export declare function BuildAdditionalPropertiesStandard(stack: Stack, context: BuildContext, schema: S.XAdditionalProperties, value: string): string;
|
|
7
7
|
export declare function BuildAdditionalProperties(stack: Stack, context: BuildContext, schema: S.XAdditionalProperties, value: string): string;
|
|
8
8
|
export declare function CheckAdditionalProperties(stack: Stack, context: CheckContext, schema: S.XAdditionalProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
@@ -43,14 +43,14 @@ function GetPropertiesPattern(schema) {
|
|
|
43
43
|
// we can generate a simplified and efficient runtime check.
|
|
44
44
|
//
|
|
45
45
|
// ------------------------------------------------------------------
|
|
46
|
-
export function CanAdditionalPropertiesFast(
|
|
46
|
+
export function CanAdditionalPropertiesFast(_context, schema, _value) {
|
|
47
47
|
return S.IsRequired(schema)
|
|
48
48
|
&& S.IsProperties(schema)
|
|
49
49
|
&& !S.IsPatternProperties(schema)
|
|
50
50
|
&& G.IsEqual(schema.additionalProperties, false)
|
|
51
51
|
&& G.IsEqual(G.Keys(schema.properties).length, schema.required.length);
|
|
52
52
|
}
|
|
53
|
-
export function BuildAdditionalPropertiesFast(
|
|
53
|
+
export function BuildAdditionalPropertiesFast(_context, schema, value) {
|
|
54
54
|
return E.IsEqual(E.Member(E.Call(E.Member('Object', 'getOwnPropertyNames'), [value]), 'length'), E.Constant(schema.required.length));
|
|
55
55
|
}
|
|
56
56
|
// ------------------------------------------------------------------
|
|
@@ -21,7 +21,7 @@ export function BuildAnyOf(stack, context, schema, value) {
|
|
|
21
21
|
// Check
|
|
22
22
|
// ------------------------------------------------------------------
|
|
23
23
|
export function CheckAnyOf(stack, context, schema, value) {
|
|
24
|
-
const results = schema.anyOf.reduce((result, schema
|
|
24
|
+
const results = schema.anyOf.reduce((result, schema) => {
|
|
25
25
|
const nextContext = new CheckContext();
|
|
26
26
|
return CheckSchema(stack, nextContext, schema, value) ? [...result, nextContext] : result;
|
|
27
27
|
}, []);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Stack } from './_stack.mjs';
|
|
2
2
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
3
|
-
export declare function BuildBooleanSchema(
|
|
4
|
-
export declare function CheckBooleanSchema(
|
|
3
|
+
export declare function BuildBooleanSchema(_stack: Stack, _context: BuildContext, schema: boolean, _value: string): string;
|
|
4
|
+
export declare function CheckBooleanSchema(_stack: Stack, _context: CheckContext, schema: boolean, _value: unknown): boolean;
|
|
5
5
|
export declare function ErrorBooleanSchema(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: boolean, value: unknown): boolean;
|
|
@@ -3,13 +3,13 @@ import { EmitGuard as E } from '../../guard/index.mjs';
|
|
|
3
3
|
// ------------------------------------------------------------------
|
|
4
4
|
// Build
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
|
-
export function BuildBooleanSchema(
|
|
6
|
+
export function BuildBooleanSchema(_stack, _context, schema, _value) {
|
|
7
7
|
return schema ? E.Constant(true) : E.Constant(false);
|
|
8
8
|
}
|
|
9
9
|
// ------------------------------------------------------------------
|
|
10
10
|
// Check
|
|
11
11
|
// ------------------------------------------------------------------
|
|
12
|
-
export function CheckBooleanSchema(
|
|
12
|
+
export function CheckBooleanSchema(_stack, _context, schema, _value) {
|
|
13
13
|
return schema;
|
|
14
14
|
}
|
|
15
15
|
// ------------------------------------------------------------------
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
2
|
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildConst(
|
|
5
|
-
export declare function CheckConst(
|
|
4
|
+
export declare function BuildConst(_stack: Stack, _context: BuildContext, schema: Schema.XConst, value: string): string;
|
|
5
|
+
export declare function CheckConst(_stack: Stack, _context: CheckContext, schema: Schema.XConst, value: unknown): boolean;
|
|
6
6
|
export declare function ErrorConst(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XConst, value: unknown): boolean;
|
|
@@ -4,7 +4,7 @@ import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
|
|
|
4
4
|
// ------------------------------------------------------------------
|
|
5
5
|
// Build
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
|
-
export function BuildConst(
|
|
7
|
+
export function BuildConst(_stack, _context, schema, value) {
|
|
8
8
|
return G.IsValueLike(schema.const)
|
|
9
9
|
? E.IsEqual(value, E.Constant(schema.const))
|
|
10
10
|
: E.IsDeepEqual(value, Externals.CreateVariable(schema.const));
|
|
@@ -12,7 +12,7 @@ export function BuildConst(stack, context, schema, value) {
|
|
|
12
12
|
// ------------------------------------------------------------------
|
|
13
13
|
// Check
|
|
14
14
|
// ------------------------------------------------------------------
|
|
15
|
-
export function CheckConst(
|
|
15
|
+
export function CheckConst(_stack, _context, schema, value) {
|
|
16
16
|
return G.IsValueLike(schema.const)
|
|
17
17
|
? G.IsEqual(value, schema.const)
|
|
18
18
|
: G.IsDeepEqual(value, schema.const);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
2
|
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildDependentRequired(
|
|
5
|
-
export declare function CheckDependentRequired(
|
|
6
|
-
export declare function ErrorDependentRequired(
|
|
4
|
+
export declare function BuildDependentRequired(_stack: Stack, _context: BuildContext, schema: Schema.XDependentRequired, value: string): string;
|
|
5
|
+
export declare function CheckDependentRequired(_stack: Stack, _context: CheckContext, schema: Schema.XDependentRequired, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
+
export declare function ErrorDependentRequired(_stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XDependentRequired, value: Record<PropertyKey, unknown>): boolean;
|
|
@@ -3,7 +3,7 @@ import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
|
|
|
3
3
|
// ------------------------------------------------------------------
|
|
4
4
|
// Build
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
|
-
export function BuildDependentRequired(
|
|
6
|
+
export function BuildDependentRequired(_stack, _context, schema, value) {
|
|
7
7
|
const isLength = E.IsEqual(E.Member(E.Keys(value), 'length'), E.Constant(0));
|
|
8
8
|
const isEvery = E.ReduceAnd(G.Entries(schema.dependentRequired).map(([key, keys]) => {
|
|
9
9
|
const notKey = E.Not(E.HasPropertyKey(value, E.Constant(key)));
|
|
@@ -15,7 +15,7 @@ export function BuildDependentRequired(stack, context, schema, value) {
|
|
|
15
15
|
// ------------------------------------------------------------------
|
|
16
16
|
// Check
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
|
-
export function CheckDependentRequired(
|
|
18
|
+
export function CheckDependentRequired(_stack, _context, schema, value) {
|
|
19
19
|
const isLength = G.IsEqual(G.Keys(value).length, 0);
|
|
20
20
|
const isEvery = G.Every(G.Entries(schema.dependentRequired), 0, ([key, keys]) => {
|
|
21
21
|
return !G.HasPropertyKey(value, key) ||
|
|
@@ -26,7 +26,7 @@ export function CheckDependentRequired(stack, context, schema, value) {
|
|
|
26
26
|
// ------------------------------------------------------------------
|
|
27
27
|
// Error
|
|
28
28
|
// ------------------------------------------------------------------
|
|
29
|
-
export function ErrorDependentRequired(
|
|
29
|
+
export function ErrorDependentRequired(_stack, context, schemaPath, instancePath, schema, value) {
|
|
30
30
|
const isLength = G.IsEqual(G.Keys(value).length, 0);
|
|
31
31
|
const isEveryEntry = G.EveryAll(G.Entries(schema.dependentRequired), 0, ([key, keys]) => {
|
|
32
32
|
return !G.HasPropertyKey(value, key) || G.EveryAll(keys, 0, (dependency) => G.HasPropertyKey(value, dependency) || context.AddError({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
2
|
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildEnum(
|
|
5
|
-
export declare function CheckEnum(
|
|
4
|
+
export declare function BuildEnum(_stack: Stack, _context: BuildContext, schema: Schema.XEnum, value: string): string;
|
|
5
|
+
export declare function CheckEnum(_stack: Stack, _context: CheckContext, schema: Schema.XEnum, value: unknown): boolean;
|
|
6
6
|
export declare function ErrorEnum(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XEnum, value: unknown): boolean;
|
|
@@ -4,7 +4,7 @@ import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
|
4
4
|
// ------------------------------------------------------------------
|
|
5
5
|
// Build
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
|
-
export function BuildEnum(
|
|
7
|
+
export function BuildEnum(_stack, _context, schema, value) {
|
|
8
8
|
return E.ReduceOr(schema.enum.map(option => {
|
|
9
9
|
if (G.IsValueLike(option))
|
|
10
10
|
return E.IsEqual(value, E.Constant(option));
|
|
@@ -15,7 +15,7 @@ export function BuildEnum(stack, context, schema, value) {
|
|
|
15
15
|
// ------------------------------------------------------------------
|
|
16
16
|
// Check
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
|
-
export function CheckEnum(
|
|
18
|
+
export function CheckEnum(_stack, _context, schema, value) {
|
|
19
19
|
return schema.enum.some(option => G.IsValueLike(option)
|
|
20
20
|
? G.IsEqual(value, option)
|
|
21
21
|
: G.IsDeepEqual(value, option));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
2
|
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildExclusiveMaximum(
|
|
5
|
-
export declare function CheckExclusiveMaximum(
|
|
4
|
+
export declare function BuildExclusiveMaximum(_stack: Stack, _context: BuildContext, schema: Schema.XExclusiveMaximum, value: string): string;
|
|
5
|
+
export declare function CheckExclusiveMaximum(_stack: Stack, _context: CheckContext, schema: Schema.XExclusiveMaximum, value: number | bigint): boolean;
|
|
6
6
|
export declare function ErrorExclusiveMaximum(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XExclusiveMaximum, value: number | bigint): boolean;
|
|
@@ -3,13 +3,13 @@ import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
|
3
3
|
// ------------------------------------------------------------------
|
|
4
4
|
// Build
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
|
-
export function BuildExclusiveMaximum(
|
|
6
|
+
export function BuildExclusiveMaximum(_stack, _context, schema, value) {
|
|
7
7
|
return E.IsLessThan(value, E.Constant(schema.exclusiveMaximum));
|
|
8
8
|
}
|
|
9
9
|
// ------------------------------------------------------------------
|
|
10
10
|
// Check
|
|
11
11
|
// ------------------------------------------------------------------
|
|
12
|
-
export function CheckExclusiveMaximum(
|
|
12
|
+
export function CheckExclusiveMaximum(_stack, _context, schema, value) {
|
|
13
13
|
return G.IsLessThan(value, schema.exclusiveMaximum);
|
|
14
14
|
}
|
|
15
15
|
// ------------------------------------------------------------------
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
2
|
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildExclusiveMinimum(
|
|
5
|
-
export declare function CheckExclusiveMinimum(
|
|
4
|
+
export declare function BuildExclusiveMinimum(_stack: Stack, _context: BuildContext, schema: Schema.XExclusiveMinimum, value: string): string;
|
|
5
|
+
export declare function CheckExclusiveMinimum(_stack: Stack, _context: CheckContext, schema: Schema.XExclusiveMinimum, value: number | bigint): boolean;
|
|
6
6
|
export declare function ErrorExclusiveMinimum(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XExclusiveMinimum, value: number | bigint): boolean;
|
|
@@ -3,13 +3,13 @@ import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
|
3
3
|
// ------------------------------------------------------------------
|
|
4
4
|
// Build
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
|
-
export function BuildExclusiveMinimum(
|
|
6
|
+
export function BuildExclusiveMinimum(_stack, _context, schema, value) {
|
|
7
7
|
return E.IsGreaterThan(value, E.Constant(schema.exclusiveMinimum));
|
|
8
8
|
}
|
|
9
9
|
// ------------------------------------------------------------------
|
|
10
10
|
// Check
|
|
11
11
|
// ------------------------------------------------------------------
|
|
12
|
-
export function CheckExclusiveMinimum(
|
|
12
|
+
export function CheckExclusiveMinimum(_stack, _context, schema, value) {
|
|
13
13
|
return G.IsGreaterThan(value, schema.exclusiveMinimum);
|
|
14
14
|
}
|
|
15
15
|
// ------------------------------------------------------------------
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
2
|
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildFormat(
|
|
5
|
-
export declare function CheckFormat(
|
|
4
|
+
export declare function BuildFormat(_stack: Stack, _context: BuildContext, schema: Schema.XFormat, value: string): string;
|
|
5
|
+
export declare function CheckFormat(_stack: Stack, _context: CheckContext, schema: Schema.XFormat, value: string): boolean;
|
|
6
6
|
export declare function ErrorFormat(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XFormat, value: string): boolean;
|
|
@@ -4,13 +4,13 @@ import { EmitGuard as E } from '../../guard/index.mjs';
|
|
|
4
4
|
// ------------------------------------------------------------------
|
|
5
5
|
// Build
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
|
-
export function BuildFormat(
|
|
7
|
+
export function BuildFormat(_stack, _context, schema, value) {
|
|
8
8
|
return E.Call(E.Member('Format', 'Test'), [E.Constant(schema.format), value]);
|
|
9
9
|
}
|
|
10
10
|
// ------------------------------------------------------------------
|
|
11
11
|
// Check
|
|
12
12
|
// ------------------------------------------------------------------
|
|
13
|
-
export function CheckFormat(
|
|
13
|
+
export function CheckFormat(_stack, _context, schema, value) {
|
|
14
14
|
return Format.Test(schema.format, value);
|
|
15
15
|
}
|
|
16
16
|
// ------------------------------------------------------------------
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
2
|
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildMaxItems(
|
|
5
|
-
export declare function CheckMaxItems(
|
|
4
|
+
export declare function BuildMaxItems(_stack: Stack, _context: BuildContext, schema: Schema.XMaxItems, value: string): string;
|
|
5
|
+
export declare function CheckMaxItems(_stack: Stack, _context: CheckContext, schema: Schema.XMaxItems, value: unknown[]): boolean;
|
|
6
6
|
export declare function ErrorMaxItems(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMaxItems, value: unknown[]): boolean;
|
|
@@ -3,13 +3,13 @@ import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
|
3
3
|
// ------------------------------------------------------------------
|
|
4
4
|
// Build
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
|
-
export function BuildMaxItems(
|
|
6
|
+
export function BuildMaxItems(_stack, _context, schema, value) {
|
|
7
7
|
return E.IsLessEqualThan(E.Member(value, 'length'), E.Constant(schema.maxItems));
|
|
8
8
|
}
|
|
9
9
|
// ------------------------------------------------------------------
|
|
10
10
|
// Check
|
|
11
11
|
// ------------------------------------------------------------------
|
|
12
|
-
export function CheckMaxItems(
|
|
12
|
+
export function CheckMaxItems(_stack, _context, schema, value) {
|
|
13
13
|
return G.IsLessEqualThan(value.length, schema.maxItems);
|
|
14
14
|
}
|
|
15
15
|
// ------------------------------------------------------------------
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
2
|
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildMaxLength(
|
|
5
|
-
export declare function CheckMaxLength(
|
|
4
|
+
export declare function BuildMaxLength(_stack: Stack, _context: BuildContext, schema: Schema.XMaxLength, value: string): string;
|
|
5
|
+
export declare function CheckMaxLength(_stack: Stack, _context: CheckContext, schema: Schema.XMaxLength, value: string): boolean;
|
|
6
6
|
export declare function ErrorMaxLength(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMaxLength, value: string): boolean;
|
|
@@ -3,13 +3,13 @@ import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
|
3
3
|
// ------------------------------------------------------------------
|
|
4
4
|
// Build
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
|
-
export function BuildMaxLength(
|
|
6
|
+
export function BuildMaxLength(_stack, _context, schema, value) {
|
|
7
7
|
return E.IsMaxLength(value, E.Constant(schema.maxLength));
|
|
8
8
|
}
|
|
9
9
|
// ------------------------------------------------------------------
|
|
10
10
|
// Check
|
|
11
11
|
// ------------------------------------------------------------------
|
|
12
|
-
export function CheckMaxLength(
|
|
12
|
+
export function CheckMaxLength(_stack, _context, schema, value) {
|
|
13
13
|
return G.IsMaxLength(value, schema.maxLength);
|
|
14
14
|
}
|
|
15
15
|
// ------------------------------------------------------------------
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
2
|
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildMaxProperties(
|
|
5
|
-
export declare function CheckMaxProperties(
|
|
4
|
+
export declare function BuildMaxProperties(_stack: Stack, _context: BuildContext, schema: Schema.XMaxProperties, value: string): string;
|
|
5
|
+
export declare function CheckMaxProperties(_stack: Stack, _context: CheckContext, schema: Schema.XMaxProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
6
6
|
export declare function ErrorMaxProperties(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMaxProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
@@ -3,13 +3,13 @@ import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
|
|
|
3
3
|
// ------------------------------------------------------------------
|
|
4
4
|
// Build
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
|
-
export function BuildMaxProperties(
|
|
6
|
+
export function BuildMaxProperties(_stack, _context, schema, value) {
|
|
7
7
|
return E.IsLessEqualThan(E.Member(E.Keys(value), 'length'), E.Constant(schema.maxProperties));
|
|
8
8
|
}
|
|
9
9
|
// ------------------------------------------------------------------
|
|
10
10
|
// Check
|
|
11
11
|
// ------------------------------------------------------------------
|
|
12
|
-
export function CheckMaxProperties(
|
|
12
|
+
export function CheckMaxProperties(_stack, _context, schema, value) {
|
|
13
13
|
return G.IsLessEqualThan(G.Keys(value).length, schema.maxProperties);
|
|
14
14
|
}
|
|
15
15
|
// ------------------------------------------------------------------
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
2
|
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildMaximum(
|
|
5
|
-
export declare function CheckMaximum(
|
|
4
|
+
export declare function BuildMaximum(_stack: Stack, _context: BuildContext, schema: Schema.XMaximum, value: string): string;
|
|
5
|
+
export declare function CheckMaximum(_stack: Stack, _context: CheckContext, schema: Schema.XMaximum, value: number | bigint): boolean;
|
|
6
6
|
export declare function ErrorMaximum(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMaximum, value: number | bigint): boolean;
|
|
@@ -3,13 +3,13 @@ import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
|
3
3
|
// ------------------------------------------------------------------
|
|
4
4
|
// Build
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
|
-
export function BuildMaximum(
|
|
6
|
+
export function BuildMaximum(_stack, _context, schema, value) {
|
|
7
7
|
return E.IsLessEqualThan(value, E.Constant(schema.maximum));
|
|
8
8
|
}
|
|
9
9
|
// ------------------------------------------------------------------
|
|
10
10
|
// Check
|
|
11
11
|
// ------------------------------------------------------------------
|
|
12
|
-
export function CheckMaximum(
|
|
12
|
+
export function CheckMaximum(_stack, _context, schema, value) {
|
|
13
13
|
return G.IsLessEqualThan(value, schema.maximum);
|
|
14
14
|
}
|
|
15
15
|
// ------------------------------------------------------------------
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Stack } from './_stack.mjs';
|
|
2
2
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
3
3
|
import * as Schema from '../types/index.mjs';
|
|
4
|
-
export declare function BuildMinItems(
|
|
5
|
-
export declare function CheckMinItems(
|
|
4
|
+
export declare function BuildMinItems(_stack: Stack, _context: BuildContext, schema: Schema.XMinItems, value: string): string;
|
|
5
|
+
export declare function CheckMinItems(_stack: Stack, _context: CheckContext, schema: Schema.XMinItems, value: unknown[]): boolean;
|
|
6
6
|
export declare function ErrorMinItems(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMinItems, value: unknown[]): boolean;
|
|
@@ -3,13 +3,13 @@ import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
|
3
3
|
// ------------------------------------------------------------------
|
|
4
4
|
// Build
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
|
-
export function BuildMinItems(
|
|
6
|
+
export function BuildMinItems(_stack, _context, schema, value) {
|
|
7
7
|
return E.IsGreaterEqualThan(E.Member(value, 'length'), E.Constant(schema.minItems));
|
|
8
8
|
}
|
|
9
9
|
// ------------------------------------------------------------------
|
|
10
10
|
// Check
|
|
11
11
|
// ------------------------------------------------------------------
|
|
12
|
-
export function CheckMinItems(
|
|
12
|
+
export function CheckMinItems(_stack, _context, schema, value) {
|
|
13
13
|
return G.IsGreaterEqualThan(value.length, schema.minItems);
|
|
14
14
|
}
|
|
15
15
|
// ------------------------------------------------------------------
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
2
|
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildMinLength(
|
|
5
|
-
export declare function CheckMinLength(
|
|
4
|
+
export declare function BuildMinLength(_stack: Stack, _context: BuildContext, schema: Schema.XMinLength, value: string): string;
|
|
5
|
+
export declare function CheckMinLength(_stack: Stack, _context: CheckContext, schema: Schema.XMinLength, value: string): boolean;
|
|
6
6
|
export declare function ErrorMinLength(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMinLength, value: string): boolean;
|
|
@@ -3,13 +3,13 @@ import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
|
3
3
|
// ------------------------------------------------------------------
|
|
4
4
|
// Build
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
|
-
export function BuildMinLength(
|
|
6
|
+
export function BuildMinLength(_stack, _context, schema, value) {
|
|
7
7
|
return E.IsMinLength(value, E.Constant(schema.minLength));
|
|
8
8
|
}
|
|
9
9
|
// ------------------------------------------------------------------
|
|
10
10
|
// Check
|
|
11
11
|
// ------------------------------------------------------------------
|
|
12
|
-
export function CheckMinLength(
|
|
12
|
+
export function CheckMinLength(_stack, _context, schema, value) {
|
|
13
13
|
return G.IsMinLength(value, schema.minLength);
|
|
14
14
|
}
|
|
15
15
|
// ------------------------------------------------------------------
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
2
|
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildMinProperties(
|
|
5
|
-
export declare function CheckMinProperties(
|
|
4
|
+
export declare function BuildMinProperties(_stack: Stack, _context: BuildContext, schema: Schema.XMinProperties, value: string): string;
|
|
5
|
+
export declare function CheckMinProperties(_stack: Stack, _context: CheckContext, schema: Schema.XMinProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
6
6
|
export declare function ErrorMinProperties(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMinProperties, value: Record<PropertyKey, unknown>): boolean;
|