@depup/typebox 1.3.27-depup.0 → 1.3.34-depup.0
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 +2 -2
- package/build/compile/code.mjs +1 -2
- package/build/compile/validator.mjs +5 -1
- package/build/format/iri.mjs +16 -9
- package/build/guard/emit.mjs +2 -2
- package/build/guard/guard.d.mts +7 -5
- package/build/guard/guard.mjs +14 -9
- package/build/guard/index.mjs +6 -0
- package/build/guard/unicode/unicode.d.mts +6 -0
- package/build/guard/unicode/unicode.mjs +35 -0
- package/build/guard/{string.mjs → unicode/unicode_segment.mjs} +16 -19
- package/build/schema/build.mjs +4 -5
- package/build/schema/check.mjs +1 -1
- package/build/schema/engine/_context.d.mts +5 -1
- package/build/schema/engine/_context.mjs +16 -3
- package/build/schema/engine/_functions.d.mts +2 -2
- package/build/schema/engine/_functions.mjs +1 -1
- package/build/schema/engine/_pathing.d.mts +1 -0
- package/build/schema/engine/_pathing.mjs +11 -0
- package/build/schema/engine/_reducer.d.mts +3 -3
- package/build/schema/engine/_refine.d.mts +5 -5
- package/build/schema/engine/_refine.mjs +14 -9
- package/build/schema/engine/_stack.d.mts +34 -20
- package/build/schema/engine/_stack.mjs +143 -202
- package/build/schema/engine/additionalItems.d.mts +4 -4
- package/build/schema/engine/additionalProperties.d.mts +8 -8
- package/build/schema/engine/additionalProperties.mjs +12 -15
- package/build/schema/engine/allOf.d.mts +4 -4
- package/build/schema/engine/allOf.mjs +1 -1
- package/build/schema/engine/anyOf.d.mts +4 -4
- package/build/schema/engine/anyOf.mjs +4 -9
- package/build/schema/engine/boolean.d.mts +4 -4
- package/build/schema/engine/boolean.mjs +2 -6
- package/build/schema/engine/const.d.mts +4 -4
- package/build/schema/engine/const.mjs +2 -6
- package/build/schema/engine/contains.d.mts +4 -4
- package/build/schema/engine/contains.mjs +2 -6
- package/build/schema/engine/dependencies.d.mts +4 -4
- package/build/schema/engine/dependencies.mjs +5 -7
- package/build/schema/engine/dependentRequired.d.mts +4 -4
- package/build/schema/engine/dependentRequired.mjs +2 -6
- package/build/schema/engine/dependentSchemas.d.mts +4 -4
- package/build/schema/engine/dependentSchemas.mjs +2 -1
- package/build/schema/engine/dynamicRef.d.mts +4 -4
- package/build/schema/engine/dynamicRef.mjs +12 -8
- package/build/schema/engine/enum.d.mts +4 -4
- package/build/schema/engine/enum.mjs +2 -6
- package/build/schema/engine/exclusiveMaximum.d.mts +4 -4
- package/build/schema/engine/exclusiveMaximum.mjs +2 -6
- package/build/schema/engine/exclusiveMinimum.d.mts +4 -4
- package/build/schema/engine/exclusiveMinimum.mjs +2 -6
- package/build/schema/engine/format.d.mts +4 -4
- package/build/schema/engine/format.mjs +11 -8
- package/build/schema/engine/if.d.mts +4 -4
- package/build/schema/engine/if.mjs +5 -13
- package/build/schema/engine/items.d.mts +4 -4
- package/build/schema/engine/items.mjs +1 -1
- package/build/schema/engine/maxContains.d.mts +4 -4
- package/build/schema/engine/maxContains.mjs +2 -6
- package/build/schema/engine/maxItems.d.mts +4 -4
- package/build/schema/engine/maxItems.mjs +2 -6
- package/build/schema/engine/maxLength.d.mts +4 -4
- package/build/schema/engine/maxLength.mjs +2 -6
- package/build/schema/engine/maxProperties.d.mts +4 -4
- package/build/schema/engine/maxProperties.mjs +2 -6
- package/build/schema/engine/maximum.d.mts +4 -4
- package/build/schema/engine/maximum.mjs +2 -6
- package/build/schema/engine/minContains.d.mts +4 -4
- package/build/schema/engine/minContains.mjs +2 -6
- package/build/schema/engine/minItems.d.mts +5 -5
- package/build/schema/engine/minItems.mjs +2 -6
- package/build/schema/engine/minLength.d.mts +4 -4
- package/build/schema/engine/minLength.mjs +2 -6
- package/build/schema/engine/minProperties.d.mts +4 -4
- package/build/schema/engine/minProperties.mjs +2 -6
- package/build/schema/engine/minimum.d.mts +4 -4
- package/build/schema/engine/minimum.mjs +2 -6
- package/build/schema/engine/multipleOf.d.mts +4 -4
- package/build/schema/engine/multipleOf.mjs +2 -6
- package/build/schema/engine/not.d.mts +4 -4
- package/build/schema/engine/not.mjs +4 -8
- package/build/schema/engine/oneOf.d.mts +4 -4
- package/build/schema/engine/oneOf.mjs +5 -10
- package/build/schema/engine/pattern.d.mts +4 -4
- package/build/schema/engine/pattern.mjs +3 -7
- package/build/schema/engine/patternProperties.d.mts +4 -4
- package/build/schema/engine/patternProperties.mjs +4 -3
- package/build/schema/engine/prefixItems.d.mts +4 -4
- package/build/schema/engine/prefixItems.mjs +1 -1
- package/build/schema/engine/properties.d.mts +4 -4
- package/build/schema/engine/properties.mjs +4 -3
- package/build/schema/engine/propertyNames.d.mts +4 -4
- package/build/schema/engine/propertyNames.mjs +5 -8
- package/build/schema/engine/recursiveRef.d.mts +4 -4
- package/build/schema/engine/recursiveRef.mjs +12 -8
- package/build/schema/engine/ref.d.mts +4 -4
- package/build/schema/engine/ref.mjs +18 -14
- package/build/schema/engine/required.d.mts +4 -4
- package/build/schema/engine/required.mjs +2 -6
- package/build/schema/engine/schema.d.mts +7 -7
- package/build/schema/engine/schema.mjs +136 -138
- package/build/schema/engine/type.d.mts +4 -4
- package/build/schema/engine/type.mjs +2 -6
- package/build/schema/engine/unevaluatedItems.d.mts +4 -4
- package/build/schema/engine/unevaluatedItems.mjs +3 -7
- package/build/schema/engine/unevaluatedProperties.d.mts +4 -4
- package/build/schema/engine/unevaluatedProperties.mjs +3 -7
- package/build/schema/engine/uniqueItems.d.mts +4 -4
- package/build/schema/engine/uniqueItems.mjs +2 -6
- package/build/schema/errors.mjs +1 -1
- package/build/schema/intern/intern.d.mts +6 -9
- package/build/schema/intern/intern.mjs +90 -56
- package/build/schema/meta/draft_2019_09.d.mts +2 -0
- package/build/schema/meta/draft_2019_09.mjs +288 -0
- package/build/schema/meta/draft_2020_12.d.mts +2 -0
- package/build/schema/meta/draft_2020_12.mjs +300 -0
- package/build/schema/meta/draft_3.d.mts +2 -0
- package/build/schema/meta/draft_3.mjs +143 -0
- package/build/schema/meta/draft_4.d.mts +2 -0
- package/build/schema/meta/draft_4.mjs +149 -0
- package/build/schema/meta/draft_6.d.mts +2 -0
- package/build/schema/meta/draft_6.mjs +155 -0
- package/build/schema/meta/draft_7.d.mts +2 -0
- package/build/schema/meta/draft_7.mjs +172 -0
- package/build/schema/meta/index.d.mts +2 -0
- package/build/schema/meta/index.mjs +2 -0
- package/build/schema/meta/meta.d.mts +9 -0
- package/build/schema/meta/meta.mjs +15 -0
- package/build/schema/meta/schema.d.mts +6 -0
- package/build/schema/meta/schema.mjs +1 -0
- package/build/schema/parse.mjs +3 -0
- package/build/schema/pointer/pointer.d.mts +1 -6
- package/build/schema/pointer/pointer.mjs +47 -64
- package/build/schema/resolve/resolve.d.mts +6 -32
- package/build/schema/resolve/resolve.mjs +231 -227
- package/build/schema/schema.d.mts +1 -0
- package/build/schema/schema.mjs +1 -0
- package/build/system/settings/internal.d.mts +2 -0
- package/build/system/settings/internal.mjs +20 -0
- package/build/system/settings/settings.d.mts +11 -0
- package/build/system/settings/settings.mjs +14 -0
- package/build/type/extends/inference.d.mts +1 -1
- package/build/type/extends/inference.mjs +15 -2
- package/build/type/extends/tuple.d.mts +2 -1
- package/build/type/extends/tuple.mjs +21 -1
- package/build/value/parse/parse.mjs +10 -4
- package/changes.json +1 -1
- package/package.json +3 -3
- package/readme.md +52 -84
- /package/build/guard/{string.d.mts → unicode/unicode_segment.d.mts} +0 -0
|
@@ -16,10 +16,6 @@ export function CheckMultipleOf(_stack, _context, schema, value) {
|
|
|
16
16
|
// Error
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
18
|
export function ErrorMultipleOf(stack, context, schemaPath, instancePath, schema, value) {
|
|
19
|
-
return CheckMultipleOf(stack, context, schema, value) ||
|
|
20
|
-
|
|
21
|
-
schemaPath,
|
|
22
|
-
instancePath,
|
|
23
|
-
params: { multipleOf: schema.multipleOf }
|
|
24
|
-
});
|
|
19
|
+
return CheckMultipleOf(stack, context, schema, value) ||
|
|
20
|
+
context.AddError('multipleOf', schemaPath, instancePath, { multipleOf: schema.multipleOf });
|
|
25
21
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildNot(stack: Stack, context: BuildContext, schema: Schema.XNot, value: string): string;
|
|
5
|
-
export declare function CheckNot(stack: Stack, context: CheckContext, schema: Schema.XNot, value: unknown): boolean;
|
|
6
|
-
export declare function ErrorNot(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XNot, value: unknown): boolean;
|
|
4
|
+
export declare function BuildNot(stack: Stack.XStack, context: BuildContext, schema: Schema.XNot, value: string): string;
|
|
5
|
+
export declare function CheckNot(stack: Stack.XStack, context: CheckContext, schema: Schema.XNot, value: unknown): boolean;
|
|
6
|
+
export declare function ErrorNot(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XNot, value: unknown): boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import { CheckContext } from './_context.mjs';
|
|
3
2
|
import { Reducer } from './_reducer.mjs';
|
|
4
|
-
import {
|
|
3
|
+
import { CheckContext } from './_context.mjs';
|
|
5
4
|
import { BuildSchema, CheckSchema } from './schema.mjs';
|
|
5
|
+
import { EmitGuard as E } from '../../guard/index.mjs';
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
7
|
// Build
|
|
8
8
|
// ------------------------------------------------------------------
|
|
@@ -30,10 +30,6 @@ export function CheckNot(stack, context, schema, value) {
|
|
|
30
30
|
// Error
|
|
31
31
|
// ------------------------------------------------------------------
|
|
32
32
|
export function ErrorNot(stack, context, schemaPath, instancePath, schema, value) {
|
|
33
|
-
return CheckNot(stack, context, schema, value) ||
|
|
34
|
-
|
|
35
|
-
schemaPath,
|
|
36
|
-
instancePath,
|
|
37
|
-
params: {},
|
|
38
|
-
});
|
|
33
|
+
return CheckNot(stack, context, schema, value) ||
|
|
34
|
+
context.AddError('not', schemaPath, instancePath, {});
|
|
39
35
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildOneOf(stack: Stack, context: BuildContext, schema: Schema.XOneOf, value: string): string;
|
|
5
|
-
export declare function CheckOneOf(stack: Stack, context: CheckContext, schema: Schema.XOneOf, value: unknown): boolean;
|
|
6
|
-
export declare function ErrorOneOf(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XOneOf, value: unknown): boolean;
|
|
4
|
+
export declare function BuildOneOf(stack: Stack.XStack, context: BuildContext, schema: Schema.XOneOf, value: string): string;
|
|
5
|
+
export declare function CheckOneOf(stack: Stack.XStack, context: CheckContext, schema: Schema.XOneOf, value: unknown): boolean;
|
|
6
|
+
export declare function ErrorOneOf(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XOneOf, value: unknown): boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import { CheckContext, ErrorContext } from './_context.mjs';
|
|
3
2
|
import { Reducer } from './_reducer.mjs';
|
|
4
|
-
import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
|
|
5
|
-
import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
|
|
6
3
|
import { Unique } from './_unique.mjs';
|
|
4
|
+
import { CheckContext, ErrorContext } from './_context.mjs';
|
|
5
|
+
import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
|
|
6
|
+
import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
|
|
7
7
|
// ------------------------------------------------------------------
|
|
8
8
|
// Build
|
|
9
9
|
// ------------------------------------------------------------------
|
|
@@ -49,11 +49,6 @@ export function ErrorOneOf(stack, context, schemaPath, instancePath, schema, val
|
|
|
49
49
|
}, []);
|
|
50
50
|
const isOneOf = G.IsEqual(passedContexts.length, 1) && context.Merge(passedContexts);
|
|
51
51
|
if (!isOneOf && G.IsEqual(passingSchemas.length, 0))
|
|
52
|
-
failedContexts.forEach(failed => failed.GetErrors()
|
|
53
|
-
return isOneOf || context.AddError({
|
|
54
|
-
keyword: 'oneOf',
|
|
55
|
-
schemaPath,
|
|
56
|
-
instancePath,
|
|
57
|
-
params: { passingSchemas },
|
|
58
|
-
});
|
|
52
|
+
failedContexts.forEach(failed => context.AddErrors(failed.GetErrors()));
|
|
53
|
+
return isOneOf || context.AddError('oneOf', schemaPath, instancePath, { passingSchemas });
|
|
59
54
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildPattern(_stack: Stack, _context: BuildContext, schema: Schema.XPattern, value: string): string;
|
|
5
|
-
export declare function CheckPattern(_stack: Stack, _context: CheckContext, schema: Schema.XPattern, value: string): boolean;
|
|
6
|
-
export declare function ErrorPattern(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XPattern, value: string): boolean;
|
|
4
|
+
export declare function BuildPattern(_stack: Stack.XStack, _context: BuildContext, schema: Schema.XPattern, value: string): string;
|
|
5
|
+
export declare function CheckPattern(_stack: Stack.XStack, _context: CheckContext, schema: Schema.XPattern, value: string): boolean;
|
|
6
|
+
export declare function ErrorPattern(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XPattern, value: string): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
2
|
import * as Externals from './_externals.mjs';
|
|
3
|
-
import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
4
3
|
import { UnicodeRegExp } from './_regexp.mjs';
|
|
4
|
+
import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
6
|
// Build
|
|
7
7
|
// ------------------------------------------------------------------
|
|
@@ -20,10 +20,6 @@ export function CheckPattern(_stack, _context, schema, value) {
|
|
|
20
20
|
// Error
|
|
21
21
|
// ------------------------------------------------------------------
|
|
22
22
|
export function ErrorPattern(stack, context, schemaPath, instancePath, schema, value) {
|
|
23
|
-
return CheckPattern(stack, context, schema, value) ||
|
|
24
|
-
|
|
25
|
-
schemaPath,
|
|
26
|
-
instancePath,
|
|
27
|
-
params: { pattern: schema.pattern }
|
|
28
|
-
});
|
|
23
|
+
return CheckPattern(stack, context, schema, value) ||
|
|
24
|
+
context.AddError('pattern', schemaPath, instancePath, { pattern: schema.pattern });
|
|
29
25
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildPatternProperties(stack: Stack, context: BuildContext, schema: Schema.XPatternProperties, value: string): string;
|
|
5
|
-
export declare function CheckPatternProperties(stack: Stack, context: CheckContext, schema: Schema.XPatternProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
-
export declare function ErrorPatternProperties(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XPatternProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
4
|
+
export declare function BuildPatternProperties(stack: Stack.XStack, context: BuildContext, schema: Schema.XPatternProperties, value: string): string;
|
|
5
|
+
export declare function CheckPatternProperties(stack: Stack.XStack, context: CheckContext, schema: Schema.XPatternProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
+
export declare function ErrorPatternProperties(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XPatternProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
2
|
import * as Externals from './_externals.mjs';
|
|
3
|
+
import * as Pathing from './_pathing.mjs';
|
|
3
4
|
import { Unique } from './_unique.mjs';
|
|
4
5
|
import { UnicodeRegExp } from './_regexp.mjs';
|
|
5
|
-
import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
6
6
|
import { BuildSchemaPushStack, CheckSchemaPushStack, ErrorSchemaPushStack } from './schema.mjs';
|
|
7
|
+
import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
7
8
|
// ------------------------------------------------------------------
|
|
8
9
|
// Build
|
|
9
10
|
// ------------------------------------------------------------------
|
|
@@ -34,10 +35,10 @@ export function CheckPatternProperties(stack, context, schema, value) {
|
|
|
34
35
|
// ------------------------------------------------------------------
|
|
35
36
|
export function ErrorPatternProperties(stack, context, schemaPath, instancePath, schema, value) {
|
|
36
37
|
return G.EveryAll(G.Entries(schema.patternProperties), 0, ([pattern, schema]) => {
|
|
37
|
-
const nextSchemaPath = `${schemaPath}/patternProperties/${pattern}`;
|
|
38
|
+
const nextSchemaPath = `${schemaPath}/patternProperties/${Pathing.EncodeFragment(pattern)}`;
|
|
38
39
|
const regexp = UnicodeRegExp(pattern);
|
|
39
40
|
return G.EveryAll(G.Entries(value), 0, ([key, value]) => {
|
|
40
|
-
const nextInstancePath = `${instancePath}/${key}`;
|
|
41
|
+
const nextInstancePath = `${instancePath}/${Pathing.EncodeFragment(key)}`;
|
|
41
42
|
const notKey = !regexp.test(key);
|
|
42
43
|
return notKey || ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema, value) && context.AddKey(key);
|
|
43
44
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildPrefixItems(stack: Stack, context: BuildContext, schema: Schema.XPrefixItems, value: string): string;
|
|
5
|
-
export declare function CheckPrefixItems(stack: Stack, context: CheckContext, schema: Schema.XPrefixItems, value: unknown[]): boolean;
|
|
6
|
-
export declare function ErrorPrefixItems(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XPrefixItems, value: unknown[]): boolean;
|
|
4
|
+
export declare function BuildPrefixItems(stack: Stack.XStack, context: BuildContext, schema: Schema.XPrefixItems, value: string): string;
|
|
5
|
+
export declare function CheckPrefixItems(stack: Stack.XStack, context: CheckContext, schema: Schema.XPrefixItems, value: unknown[]): boolean;
|
|
6
|
+
export declare function ErrorPrefixItems(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XPrefixItems, value: unknown[]): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
3
2
|
import { BuildSchemaPushStack, CheckSchemaPushStack, ErrorSchemaPushStack } from './schema.mjs';
|
|
3
|
+
import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
4
4
|
// ------------------------------------------------------------------
|
|
5
5
|
// Build
|
|
6
6
|
// ------------------------------------------------------------------
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildProperties(stack: Stack, context: BuildContext, schema: Schema.XProperties, value: string): string;
|
|
5
|
-
export declare function CheckProperties(stack: Stack, context: CheckContext, schema: Schema.XProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
-
export declare function ErrorProperties(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
4
|
+
export declare function BuildProperties(stack: Stack.XStack, context: BuildContext, schema: Schema.XProperties, value: string): string;
|
|
5
|
+
export declare function CheckProperties(stack: Stack.XStack, context: CheckContext, schema: Schema.XProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
+
export declare function ErrorProperties(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
2
|
import * as Schema from '../types/index.mjs';
|
|
3
|
-
import
|
|
3
|
+
import * as Pathing from './_pathing.mjs';
|
|
4
4
|
import { BuildSchemaPushStack, CheckSchemaPushStack, ErrorSchemaPushStack } from './schema.mjs';
|
|
5
5
|
import { InexactOptionalCheck, InexactOptionalBuild, IsExactOptional } from './_exact_optional.mjs';
|
|
6
|
+
import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
6
7
|
// ------------------------------------------------------------------
|
|
7
8
|
// Build
|
|
8
9
|
// ------------------------------------------------------------------
|
|
@@ -63,8 +64,8 @@ export function CheckProperties(stack, context, schema, value) {
|
|
|
63
64
|
export function ErrorProperties(stack, context, schemaPath, instancePath, schema, value) {
|
|
64
65
|
const required = Schema.IsRequired(schema) ? schema.required : [];
|
|
65
66
|
const isProperties = G.EveryAll(G.Entries(schema.properties), 0, ([key, schema]) => {
|
|
66
|
-
const nextSchemaPath = `${schemaPath}/properties/${key}`;
|
|
67
|
-
const nextInstancePath = `${instancePath}/${key}`;
|
|
67
|
+
const nextSchemaPath = `${schemaPath}/properties/${Pathing.EncodeFragment(key)}`;
|
|
68
|
+
const nextInstancePath = `${instancePath}/${Pathing.EncodeFragment(key)}`;
|
|
68
69
|
// Defer error generation for IsExactOptional
|
|
69
70
|
const isProperty = () => (!G.HasPropertyKey(value, key) || (ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema, value[key]) && context.AddKey(key)));
|
|
70
71
|
return IsExactOptional(required, key)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildPropertyNames(stack: Stack, context: BuildContext, schema: Schema.XPropertyNames, value: string): string;
|
|
5
|
-
export declare function CheckPropertyNames(stack: Stack, context: CheckContext, schema: Schema.XPropertyNames, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
-
export declare function ErrorPropertyNames(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XPropertyNames, value: Record<PropertyKey, unknown>): boolean;
|
|
4
|
+
export declare function BuildPropertyNames(stack: Stack.XStack, context: BuildContext, schema: Schema.XPropertyNames, value: string): string;
|
|
5
|
+
export declare function CheckPropertyNames(stack: Stack.XStack, context: CheckContext, schema: Schema.XPropertyNames, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
+
export declare function ErrorPropertyNames(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XPropertyNames, value: Record<PropertyKey, unknown>): boolean;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
+
import * as Pathing from './_pathing.mjs';
|
|
2
3
|
import { Unique } from './_unique.mjs';
|
|
3
|
-
import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
|
|
4
4
|
import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
|
|
5
|
+
import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
|
|
5
6
|
// ------------------------------------------------------------------
|
|
6
7
|
// Build
|
|
7
8
|
// ------------------------------------------------------------------
|
|
@@ -21,17 +22,13 @@ export function CheckPropertyNames(stack, context, schema, value) {
|
|
|
21
22
|
export function ErrorPropertyNames(stack, context, schemaPath, instancePath, schema, value) {
|
|
22
23
|
const propertyNames = [];
|
|
23
24
|
const isPropertyNames = G.EveryAll(G.Keys(value), 0, (key, _index) => {
|
|
24
|
-
const nextInstancePath = `${instancePath}/${key}`;
|
|
25
|
+
const nextInstancePath = `${instancePath}/${Pathing.EncodeFragment(key)}`;
|
|
25
26
|
const nextSchemaPath = `${schemaPath}/propertyNames`;
|
|
26
27
|
const isPropertyName = ErrorSchema(stack, context, nextSchemaPath, nextInstancePath, schema.propertyNames, key);
|
|
27
28
|
if (!isPropertyName)
|
|
28
29
|
propertyNames.push(key);
|
|
29
30
|
return isPropertyName;
|
|
30
31
|
});
|
|
31
|
-
return isPropertyNames ||
|
|
32
|
-
|
|
33
|
-
schemaPath,
|
|
34
|
-
instancePath,
|
|
35
|
-
params: { propertyNames }
|
|
36
|
-
});
|
|
32
|
+
return isPropertyNames ||
|
|
33
|
+
context.AddError('propertyNames', schemaPath, instancePath, { propertyNames });
|
|
37
34
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildRecursiveRef(stack: Stack, context: BuildContext, schema: Schema.XRecursiveRef, value: string): string;
|
|
5
|
-
export declare function CheckRecursiveRef(stack: Stack, context: CheckContext, schema: Schema.XRecursiveRef, value: unknown): boolean;
|
|
6
|
-
export declare function ErrorRecursiveRef(stack: Stack, context: ErrorContext,
|
|
4
|
+
export declare function BuildRecursiveRef(stack: Stack.XStack, context: BuildContext, schema: Schema.XRecursiveRef, value: string): string;
|
|
5
|
+
export declare function CheckRecursiveRef(stack: Stack.XStack, context: CheckContext, schema: Schema.XRecursiveRef, value: unknown): boolean;
|
|
6
|
+
export declare function ErrorRecursiveRef(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XRecursiveRef, value: unknown): boolean;
|
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import * as Functions from './_functions.mjs';
|
|
3
2
|
import * as Schema from '../types/index.mjs';
|
|
3
|
+
import * as Functions from './_functions.mjs';
|
|
4
|
+
import { Resolve } from '../resolve/index.mjs';
|
|
4
5
|
import { CheckSchema, ErrorSchema } from './schema.mjs';
|
|
5
6
|
// ------------------------------------------------------------------
|
|
6
7
|
// Build
|
|
7
8
|
// ------------------------------------------------------------------
|
|
8
9
|
export function BuildRecursiveRef(stack, context, schema, value) {
|
|
9
|
-
const target =
|
|
10
|
-
|
|
10
|
+
const target = Resolve.RecursiveRef(stack, schema) ?? false;
|
|
11
|
+
const nextStack = target ? { ...stack, pendingResource: true } : stack;
|
|
12
|
+
return Functions.CreateFunction(nextStack, context, target, value);
|
|
11
13
|
}
|
|
12
14
|
// ------------------------------------------------------------------
|
|
13
15
|
// Check
|
|
14
16
|
// ------------------------------------------------------------------
|
|
15
17
|
export function CheckRecursiveRef(stack, context, schema, value) {
|
|
16
|
-
const target =
|
|
17
|
-
|
|
18
|
+
const target = Resolve.RecursiveRef(stack, schema) ?? false;
|
|
19
|
+
const nextStack = target ? { ...stack, pendingResource: true } : stack;
|
|
20
|
+
return (Schema.IsSchema(target) && CheckSchema(nextStack, context, target, value));
|
|
18
21
|
}
|
|
19
22
|
// ------------------------------------------------------------------
|
|
20
23
|
// Error
|
|
21
24
|
// ------------------------------------------------------------------
|
|
22
|
-
export function ErrorRecursiveRef(stack, context,
|
|
23
|
-
const target =
|
|
24
|
-
|
|
25
|
+
export function ErrorRecursiveRef(stack, context, schemaPath, instancePath, schema, value) {
|
|
26
|
+
const target = Resolve.RecursiveRef(stack, schema) ?? false;
|
|
27
|
+
const nextStack = target ? { ...stack, pendingResource: true } : stack;
|
|
28
|
+
return (Schema.IsSchema(target) && ErrorSchema(nextStack, context, schemaPath, instancePath, target, value));
|
|
25
29
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildRef(stack: Stack, context: BuildContext, schema: Schema.XRef, value: string): string;
|
|
5
|
-
export declare function CheckRef(stack: Stack, context: CheckContext, schema: Schema.XRef, value: unknown): boolean;
|
|
6
|
-
export declare function ErrorRef(stack: Stack, context: ErrorContext,
|
|
4
|
+
export declare function BuildRef(stack: Stack.XStack, context: BuildContext, schema: Schema.XRef, value: string): string;
|
|
5
|
+
export declare function CheckRef(stack: Stack.XStack, context: CheckContext, schema: Schema.XRef, value: unknown): boolean;
|
|
6
|
+
export declare function ErrorRef(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XRef, value: unknown): boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
2
|
import * as Functions from './_functions.mjs';
|
|
3
3
|
import * as Schema from '../types/index.mjs';
|
|
4
|
+
import { Resolve } from '../resolve/index.mjs';
|
|
4
5
|
import { CheckContext, ErrorContext } from './_context.mjs';
|
|
5
6
|
import { EmitGuard as E } from '../../guard/index.mjs';
|
|
6
7
|
import { CheckSchema, ErrorSchema } from './schema.mjs';
|
|
@@ -21,32 +22,35 @@ function BuildRefFast(stack, context, target, value) {
|
|
|
21
22
|
return Functions.CreateFunction(stack, context, target, value);
|
|
22
23
|
}
|
|
23
24
|
export function BuildRef(stack, context, schema, value) {
|
|
24
|
-
const
|
|
25
|
+
const result = Resolve.Ref(stack, schema);
|
|
26
|
+
const target = result.schema ?? false;
|
|
25
27
|
return context.UseUnevaluated()
|
|
26
|
-
? BuildRefStandard(stack, context, target, value)
|
|
27
|
-
: BuildRefFast(stack, context, target, value);
|
|
28
|
+
? BuildRefStandard(result.stack, context, target, value)
|
|
29
|
+
: BuildRefFast(result.stack, context, target, value);
|
|
28
30
|
}
|
|
29
31
|
// ------------------------------------------------------------------
|
|
30
32
|
// Check
|
|
31
33
|
// ------------------------------------------------------------------
|
|
32
34
|
export function CheckRef(stack, context, schema, value) {
|
|
33
|
-
const
|
|
35
|
+
const result = Resolve.Ref(stack, schema);
|
|
36
|
+
const target = result.schema ?? false;
|
|
34
37
|
const nextContext = new CheckContext();
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
38
|
+
const valid = (Schema.IsSchema(target) && CheckSchema(result.stack, nextContext, target, value));
|
|
39
|
+
if (valid)
|
|
37
40
|
context.Merge([nextContext]);
|
|
38
|
-
return
|
|
41
|
+
return valid;
|
|
39
42
|
}
|
|
40
43
|
// ------------------------------------------------------------------
|
|
41
44
|
// Error
|
|
42
45
|
// ------------------------------------------------------------------
|
|
43
|
-
export function ErrorRef(stack, context,
|
|
44
|
-
const
|
|
46
|
+
export function ErrorRef(stack, context, schemaPath, instancePath, schema, value) {
|
|
47
|
+
const result = Resolve.Ref(stack, schema);
|
|
48
|
+
const target = result.schema ?? false;
|
|
45
49
|
const nextContext = new ErrorContext();
|
|
46
|
-
const
|
|
47
|
-
if (
|
|
50
|
+
const valid = (Schema.IsSchema(target) && ErrorSchema(result.stack, nextContext, schemaPath, instancePath, target, value));
|
|
51
|
+
if (valid)
|
|
48
52
|
context.Merge([nextContext]);
|
|
49
|
-
if (!
|
|
50
|
-
nextContext.GetErrors()
|
|
51
|
-
return
|
|
53
|
+
if (!valid)
|
|
54
|
+
context.AddErrors(nextContext.GetErrors());
|
|
55
|
+
return valid;
|
|
52
56
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import * as Stack from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildRequired(_stack: Stack, _context: BuildContext, schema: Schema.XRequired, value: string): string;
|
|
5
|
-
export declare function CheckRequired(_stack: Stack, _context: CheckContext, schema: Schema.XRequired, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
-
export declare function ErrorRequired(_stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XRequired, value: Record<PropertyKey, unknown>): boolean;
|
|
4
|
+
export declare function BuildRequired(_stack: Stack.XStack, _context: BuildContext, schema: Schema.XRequired, value: string): string;
|
|
5
|
+
export declare function CheckRequired(_stack: Stack.XStack, _context: CheckContext, schema: Schema.XRequired, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
+
export declare function ErrorRequired(_stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XRequired, value: Record<PropertyKey, unknown>): boolean;
|
|
@@ -23,10 +23,6 @@ export function ErrorRequired(_stack, context, schemaPath, instancePath, schema,
|
|
|
23
23
|
requiredProperties.push(key);
|
|
24
24
|
return hasKey;
|
|
25
25
|
});
|
|
26
|
-
return isRequired ||
|
|
27
|
-
|
|
28
|
-
schemaPath,
|
|
29
|
-
instancePath,
|
|
30
|
-
params: { requiredProperties }
|
|
31
|
-
});
|
|
26
|
+
return isRequired ||
|
|
27
|
+
context.AddError('required', schemaPath, instancePath, { requiredProperties });
|
|
32
28
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import { Stack } from './_stack.mjs';
|
|
3
2
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
3
|
+
import * as Stack from './_stack.mjs';
|
|
4
|
+
export declare function BuildSchemaPushStack(stack: Stack.XStack, context: BuildContext, schema: Schema.XSchema, value: string): string;
|
|
5
|
+
export declare function BuildSchema(stack: Stack.XStack, context: BuildContext, schema: Schema.XSchema, value: string): string;
|
|
6
|
+
export declare function CheckSchemaPushStack(stack: Stack.XStack, context: CheckContext, schema: Schema.XSchema, value: unknown): boolean;
|
|
7
|
+
export declare function CheckSchema(stack: Stack.XStack, context: CheckContext, schema: Schema.XSchema, value: unknown): boolean;
|
|
8
|
+
export declare function ErrorSchemaPushStack(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XSchema, value: unknown): boolean;
|
|
9
|
+
export declare function ErrorSchema(stack: Stack.XStack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XSchema, value: unknown): boolean;
|