pi-proactive 0.2.0-beta.2 → 0.2.0-beta.3
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 +29 -0
- package/README.md +32 -28
- package/build/cli.mjs +121 -0
- package/build/extensions/proactive.js +47 -6
- package/build/src/commands.js +78 -2
- package/build/src/config.js +511 -4
- package/build/src/daemon-config.js +221 -0
- package/build/src/daemon-contact.js +103 -0
- package/build/src/daemon-host.js +84 -0
- package/build/src/daemon.js +193 -3
- package/build/src/health.js +84 -0
- package/build/src/lineage.js +41 -2
- package/build/src/notify.js +183 -0
- package/build/src/progress-eta.js +134 -0
- package/build/src/trigger.js +43 -0
- package/build/src/trust-loop.js +321 -0
- package/build/src/trust-metrics.js +236 -0
- package/build/src/trust-notify.js +73 -0
- package/build/src/trust-policy.js +58 -0
- package/build/src/trust-registry.js +323 -0
- package/daemon/launchd.plist +48 -0
- package/daemon/pi-proactive-daemon.service +29 -0
- package/daemon/run-daemon.sh +84 -0
- package/node_modules/typebox/build/compile/code.mjs +2 -1
- package/node_modules/typebox/build/compile/validator.mjs +1 -5
- package/node_modules/typebox/build/format/date_time.d.mts +1 -2
- package/node_modules/typebox/build/format/date_time.mjs +3 -12
- package/node_modules/typebox/build/format/duration.d.mts +2 -2
- package/node_modules/typebox/build/format/duration.mjs +2 -2
- package/node_modules/typebox/build/format/idn_email.d.mts +0 -1
- package/node_modules/typebox/build/format/idn_email.mjs +0 -1
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
- package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
- package/node_modules/typebox/build/format/ipv4.mjs +2 -2
- package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
- package/node_modules/typebox/build/format/ipv6.mjs +1 -1
- package/node_modules/typebox/build/format/iri.mjs +9 -16
- package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
- package/node_modules/typebox/build/guard/emit.mjs +2 -2
- package/node_modules/typebox/build/guard/guard.d.mts +5 -7
- package/node_modules/typebox/build/guard/guard.mjs +9 -14
- package/node_modules/typebox/build/guard/index.mjs +0 -6
- package/node_modules/typebox/build/guard/{unicode/unicode_segment.mjs → string.mjs} +19 -16
- package/node_modules/typebox/build/schema/build.mjs +5 -5
- package/node_modules/typebox/build/schema/check.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/_context.d.mts +1 -5
- package/node_modules/typebox/build/schema/engine/_context.mjs +3 -16
- package/node_modules/typebox/build/schema/engine/_functions.d.mts +2 -2
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/_reducer.d.mts +3 -3
- package/node_modules/typebox/build/schema/engine/_refine.d.mts +5 -5
- package/node_modules/typebox/build/schema/engine/_refine.mjs +9 -14
- package/node_modules/typebox/build/schema/engine/_stack.d.mts +20 -34
- package/node_modules/typebox/build/schema/engine/_stack.mjs +202 -143
- package/node_modules/typebox/build/schema/engine/_unique.d.mts +2 -4
- package/node_modules/typebox/build/schema/engine/_unique.mjs +3 -7
- package/node_modules/typebox/build/schema/engine/additionalItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +8 -5
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +32 -27
- package/node_modules/typebox/build/schema/engine/allOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/allOf.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/anyOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/anyOf.mjs +9 -4
- package/node_modules/typebox/build/schema/engine/boolean.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/boolean.mjs +6 -2
- package/node_modules/typebox/build/schema/engine/const.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/const.mjs +6 -2
- package/node_modules/typebox/build/schema/engine/contains.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/contains.mjs +9 -5
- package/node_modules/typebox/build/schema/engine/dependencies.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dependencies.mjs +7 -5
- package/node_modules/typebox/build/schema/engine/dependentRequired.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dependentRequired.mjs +6 -2
- package/node_modules/typebox/build/schema/engine/dependentSchemas.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dependentSchemas.mjs +1 -2
- package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +8 -12
- package/node_modules/typebox/build/schema/engine/enum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/enum.mjs +6 -2
- package/node_modules/typebox/build/schema/engine/exclusiveMaximum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/exclusiveMaximum.mjs +6 -2
- package/node_modules/typebox/build/schema/engine/exclusiveMinimum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/exclusiveMinimum.mjs +6 -2
- package/node_modules/typebox/build/schema/engine/format.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/format.mjs +8 -11
- package/node_modules/typebox/build/schema/engine/if.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/if.mjs +13 -5
- package/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
- package/node_modules/typebox/build/schema/engine/index.mjs +0 -1
- package/node_modules/typebox/build/schema/engine/items.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/items.mjs +5 -8
- package/node_modules/typebox/build/schema/engine/maxContains.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +8 -4
- package/node_modules/typebox/build/schema/engine/maxItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxItems.mjs +6 -2
- package/node_modules/typebox/build/schema/engine/maxLength.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxLength.mjs +6 -2
- package/node_modules/typebox/build/schema/engine/maxProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maxProperties.mjs +6 -2
- package/node_modules/typebox/build/schema/engine/maximum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/maximum.mjs +6 -2
- package/node_modules/typebox/build/schema/engine/minContains.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minContains.mjs +9 -5
- package/node_modules/typebox/build/schema/engine/minItems.d.mts +5 -5
- package/node_modules/typebox/build/schema/engine/minItems.mjs +6 -2
- package/node_modules/typebox/build/schema/engine/minLength.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minLength.mjs +6 -2
- package/node_modules/typebox/build/schema/engine/minProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minProperties.mjs +6 -2
- package/node_modules/typebox/build/schema/engine/minimum.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/minimum.mjs +6 -2
- package/node_modules/typebox/build/schema/engine/multipleOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/multipleOf.mjs +6 -2
- package/node_modules/typebox/build/schema/engine/not.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +8 -4
- package/node_modules/typebox/build/schema/engine/oneOf.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +11 -6
- package/node_modules/typebox/build/schema/engine/pattern.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/pattern.mjs +7 -3
- package/node_modules/typebox/build/schema/engine/patternProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +5 -6
- package/node_modules/typebox/build/schema/engine/prefixItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/prefixItems.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/properties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/properties.mjs +3 -4
- package/node_modules/typebox/build/schema/engine/propertyNames.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +10 -7
- package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +8 -12
- package/node_modules/typebox/build/schema/engine/ref.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/ref.mjs +14 -18
- package/node_modules/typebox/build/schema/engine/required.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/required.mjs +6 -2
- package/node_modules/typebox/build/schema/engine/schema.d.mts +7 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +138 -136
- package/node_modules/typebox/build/schema/engine/type.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +6 -2
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +9 -5
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +9 -5
- package/node_modules/typebox/build/schema/engine/uniqueItems.d.mts +4 -4
- package/node_modules/typebox/build/schema/engine/uniqueItems.mjs +6 -2
- package/node_modules/typebox/build/schema/errors.mjs +1 -1
- package/node_modules/typebox/build/schema/intern/intern.d.mts +9 -6
- package/node_modules/typebox/build/schema/intern/intern.mjs +56 -90
- package/node_modules/typebox/build/schema/parse.mjs +0 -3
- package/node_modules/typebox/build/schema/pointer/pointer.d.mts +6 -1
- package/node_modules/typebox/build/schema/pointer/pointer.mjs +64 -47
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +32 -6
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +227 -231
- package/node_modules/typebox/build/schema/schema.d.mts +0 -1
- package/node_modules/typebox/build/schema/schema.mjs +0 -1
- package/node_modules/typebox/build/system/hashing/hash.mjs +34 -63
- package/node_modules/typebox/build/system/locale/en_US.mjs +1 -2
- package/node_modules/typebox/build/system/memory/assign.d.mts +8 -2
- package/node_modules/typebox/build/system/memory/assign.mjs +6 -13
- package/node_modules/typebox/build/system/memory/clone.d.mts +5 -4
- package/node_modules/typebox/build/system/memory/clone.mjs +96 -8
- package/node_modules/typebox/build/system/memory/create.d.mts +5 -1
- package/node_modules/typebox/build/system/memory/create.mjs +13 -18
- package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
- package/node_modules/typebox/build/system/memory/discard.mjs +8 -9
- package/node_modules/typebox/build/system/memory/freeze.d.mts +4 -0
- package/node_modules/typebox/build/system/memory/freeze.mjs +6 -0
- package/node_modules/typebox/build/system/memory/update.d.mts +4 -1
- package/node_modules/typebox/build/system/memory/update.mjs +16 -43
- package/node_modules/typebox/build/system/settings/settings.d.mts +0 -11
- package/node_modules/typebox/build/system/settings/settings.mjs +0 -14
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +24 -2
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +29 -2
- package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +0 -1
- package/node_modules/typebox/build/type/engine/evaluate/index.mjs +0 -1
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +1 -5
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +1 -6
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +3 -1
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +4 -1
- package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
- package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +3 -1
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +4 -1
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +3 -1
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +4 -1
- package/node_modules/typebox/build/type/extends/inference.d.mts +1 -1
- package/node_modules/typebox/build/type/extends/inference.mjs +2 -15
- package/node_modules/typebox/build/type/extends/tuple.d.mts +1 -2
- package/node_modules/typebox/build/type/extends/tuple.mjs +1 -21
- package/node_modules/typebox/build/value/clean/from_object.mjs +1 -1
- package/node_modules/typebox/build/value/clone/clone.d.mts +3 -4
- package/node_modules/typebox/build/value/clone/clone.mjs +7 -5
- package/node_modules/typebox/build/value/parse/parse.mjs +4 -10
- package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +14 -25
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +84 -52
- package/package.json +11 -3
- package/skills/pi-proactive/SKILL.md +27 -24
- package/tools/cli.mjs +121 -0
- package/tools/daemon-install.sh +397 -0
- package/tools/daemon-uninstall.sh +226 -0
- package/node_modules/typebox/build/guard/unicode/unicode.d.mts +0 -6
- package/node_modules/typebox/build/guard/unicode/unicode.mjs +0 -35
- package/node_modules/typebox/build/schema/engine/_pathing.d.mts +0 -1
- package/node_modules/typebox/build/schema/engine/_pathing.mjs +0 -11
- package/node_modules/typebox/build/schema/meta/draft_2019_09.d.mts +0 -2
- package/node_modules/typebox/build/schema/meta/draft_2019_09.mjs +0 -288
- package/node_modules/typebox/build/schema/meta/draft_2020_12.d.mts +0 -2
- package/node_modules/typebox/build/schema/meta/draft_2020_12.mjs +0 -300
- package/node_modules/typebox/build/schema/meta/draft_3.d.mts +0 -2
- package/node_modules/typebox/build/schema/meta/draft_3.mjs +0 -143
- package/node_modules/typebox/build/schema/meta/draft_4.d.mts +0 -2
- package/node_modules/typebox/build/schema/meta/draft_4.mjs +0 -149
- package/node_modules/typebox/build/schema/meta/draft_6.d.mts +0 -2
- package/node_modules/typebox/build/schema/meta/draft_6.mjs +0 -155
- package/node_modules/typebox/build/schema/meta/draft_7.d.mts +0 -2
- package/node_modules/typebox/build/schema/meta/draft_7.mjs +0 -172
- package/node_modules/typebox/build/schema/meta/index.d.mts +0 -2
- package/node_modules/typebox/build/schema/meta/index.mjs +0 -2
- package/node_modules/typebox/build/schema/meta/meta.d.mts +0 -9
- package/node_modules/typebox/build/schema/meta/meta.mjs +0 -15
- package/node_modules/typebox/build/schema/meta/schema.d.mts +0 -6
- package/node_modules/typebox/build/schema/meta/schema.mjs +0 -1
- package/node_modules/typebox/build/system/memory/deep.d.mts +0 -2
- package/node_modules/typebox/build/system/memory/deep.mjs +0 -108
- package/node_modules/typebox/build/system/memory/finalize.d.mts +0 -4
- package/node_modules/typebox/build/system/memory/finalize.mjs +0 -30
- package/node_modules/typebox/build/system/memory/keys.d.mts +0 -2
- package/node_modules/typebox/build/system/memory/keys.mjs +0 -8
- package/node_modules/typebox/build/system/settings/internal.d.mts +0 -2
- package/node_modules/typebox/build/system/settings/internal.mjs +0 -20
- package/node_modules/typebox/build/type/engine/call/index.d.mts +0 -1
- package/node_modules/typebox/build/type/engine/call/index.mjs +0 -1
- package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +0 -30
- package/node_modules/typebox/build/type/engine/evaluate/property.mjs +0 -29
- package/node_modules/typebox/build/type/engine/this/index.d.mts +0 -1
- package/node_modules/typebox/build/type/engine/this/index.mjs +0 -1
- package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +0 -2
- package/node_modules/typebox/build/value/repair/from_cyclic.mjs +0 -6
- /package/node_modules/typebox/build/guard/{unicode/unicode_segment.d.mts → string.d.mts} +0 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import
|
|
5
|
-
import * as Pathing from './_pathing.mjs';
|
|
2
|
+
import * as S from '../types/index.mjs';
|
|
3
|
+
import * as V from './_externals.mjs';
|
|
4
|
+
import { Unique } from './_unique.mjs';
|
|
6
5
|
import { UnicodeRegExp } from './_regexp.mjs';
|
|
7
6
|
import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
|
|
8
7
|
import { BuildSchemaPushStack, CheckSchemaPushStack, ErrorSchemaPushStack } from './schema.mjs';
|
|
@@ -35,41 +34,43 @@ function GetPropertyKeyAsPattern(key) {
|
|
|
35
34
|
}
|
|
36
35
|
function GetPropertiesPattern(schema) {
|
|
37
36
|
const patterns = [];
|
|
38
|
-
if (
|
|
37
|
+
if (S.IsPatternProperties(schema))
|
|
39
38
|
patterns.push(...G.Keys(schema.patternProperties));
|
|
40
|
-
if (
|
|
39
|
+
if (S.IsProperties(schema))
|
|
41
40
|
patterns.push(...G.Keys(schema.properties).map(GetPropertyKeyAsPattern));
|
|
42
41
|
return G.IsEqual(patterns.length, 0) ? '(?!)' : `(${patterns.join('|')})`;
|
|
43
42
|
}
|
|
44
43
|
// ------------------------------------------------------------------
|
|
45
|
-
// BuildAdditionalPropertiesFast
|
|
44
|
+
// BuildAdditionalPropertiesFast
|
|
46
45
|
//
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
// -
|
|
46
|
+
// Optimized logic for schemas with `additionalProperties: false`.
|
|
47
|
+
//
|
|
48
|
+
// This fast-path applies only when:
|
|
49
|
+
// - `additionalProperties` is explicitly set to false,
|
|
50
|
+
// - the schema uses only `properties` (no `patternProperties`),
|
|
51
|
+
// - and all defined properties are required (i.e., no optional keys).
|
|
52
|
+
//
|
|
53
|
+
// This constraint is common when enforcing strict object shapes
|
|
54
|
+
// with only known, fixed keys. When all these conditions are met,
|
|
55
|
+
// we can generate a simplified and efficient runtime check.
|
|
50
56
|
//
|
|
51
57
|
// ------------------------------------------------------------------
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
&&
|
|
56
|
-
}
|
|
57
|
-
function CanAdditionalPropertiesFast(_context, schema, _value) {
|
|
58
|
-
return Schema.IsRequired(schema)
|
|
59
|
-
&& Schema.IsProperties(schema)
|
|
60
|
-
&& !Schema.IsPatternProperties(schema)
|
|
58
|
+
export function CanAdditionalPropertiesFast(_context, schema, _value) {
|
|
59
|
+
return S.IsRequired(schema)
|
|
60
|
+
&& S.IsProperties(schema)
|
|
61
|
+
&& !S.IsPatternProperties(schema)
|
|
61
62
|
&& G.IsEqual(schema.additionalProperties, false)
|
|
62
|
-
&&
|
|
63
|
+
&& G.IsEqual(G.Keys(schema.properties).length, schema.required.length);
|
|
63
64
|
}
|
|
64
|
-
function BuildAdditionalPropertiesFast(_context, schema, value) {
|
|
65
|
+
export function BuildAdditionalPropertiesFast(_context, schema, value) {
|
|
65
66
|
return E.IsEqual(E.Member(E.Call(E.Member('Object', 'getOwnPropertyNames'), [value]), 'length'), E.Constant(schema.required.length));
|
|
66
67
|
}
|
|
67
68
|
// ------------------------------------------------------------------
|
|
68
69
|
// BuildAdditionalPropertiesStandard
|
|
69
70
|
// ------------------------------------------------------------------
|
|
70
|
-
function BuildAdditionalPropertiesStandard(stack, context, schema, value) {
|
|
71
|
-
const [key, _index] = [Unique
|
|
72
|
-
const regexp =
|
|
71
|
+
export function BuildAdditionalPropertiesStandard(stack, context, schema, value) {
|
|
72
|
+
const [key, _index] = [Unique(), Unique()];
|
|
73
|
+
const regexp = V.CreateVariable(UnicodeRegExp(GetPropertiesPattern(schema)));
|
|
73
74
|
const isSchema = BuildSchemaPushStack(stack, context, schema.additionalProperties, `${value}[${key}]`);
|
|
74
75
|
const isKey = E.Call(E.Member(regexp, 'test'), [key]);
|
|
75
76
|
const addKey = context.AddKey(key);
|
|
@@ -106,13 +107,17 @@ export function ErrorAdditionalProperties(stack, context, schemaPath, instancePa
|
|
|
106
107
|
const additionalProperties = [];
|
|
107
108
|
const isAdditionalProperties = G.EveryAll(G.Keys(value), 0, (key, _index) => {
|
|
108
109
|
const nextSchemaPath = `${schemaPath}/additionalProperties`;
|
|
109
|
-
const nextInstancePath = `${instancePath}/${
|
|
110
|
+
const nextInstancePath = `${instancePath}/${key}`;
|
|
110
111
|
const isAdditionalProperty = regexp.test(key) ||
|
|
111
112
|
(ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema.additionalProperties, value[key]) && context.AddKey(key));
|
|
112
113
|
if (!isAdditionalProperty)
|
|
113
114
|
additionalProperties.push(key);
|
|
114
115
|
return isAdditionalProperty;
|
|
115
116
|
});
|
|
116
|
-
return isAdditionalProperties ||
|
|
117
|
-
|
|
117
|
+
return isAdditionalProperties || context.AddError({
|
|
118
|
+
keyword: 'additionalProperties',
|
|
119
|
+
schemaPath,
|
|
120
|
+
instancePath,
|
|
121
|
+
params: { additionalProperties },
|
|
122
|
+
});
|
|
118
123
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildAllOf(stack: Stack
|
|
5
|
-
export declare function CheckAllOf(stack: Stack
|
|
6
|
-
export declare function ErrorAllOf(stack: Stack
|
|
4
|
+
export declare function BuildAllOf(stack: Stack, context: BuildContext, schema: Schema.XAllOf, value: string): string;
|
|
5
|
+
export declare function CheckAllOf(stack: Stack, context: CheckContext, schema: Schema.XAllOf, value: unknown): boolean;
|
|
6
|
+
export declare function ErrorAllOf(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XAllOf, value: unknown): boolean;
|
|
@@ -42,6 +42,6 @@ export function ErrorAllOf(stack, context, schemaPath, instancePath, schema, val
|
|
|
42
42
|
}, []);
|
|
43
43
|
const isAllOf = G.IsEqual(results.length, schema.allOf.length) && context.Merge(results);
|
|
44
44
|
if (!isAllOf)
|
|
45
|
-
failedContexts.forEach(failed =>
|
|
45
|
+
failedContexts.forEach(failed => failed.GetErrors().forEach(error => context.AddError(error)));
|
|
46
46
|
return isAllOf;
|
|
47
47
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildAnyOf(stack: Stack
|
|
5
|
-
export declare function CheckAnyOf(stack: Stack
|
|
6
|
-
export declare function ErrorAnyOf(stack: Stack
|
|
4
|
+
export declare function BuildAnyOf(stack: Stack, context: BuildContext, schema: Schema.XAnyOf, value: string): string;
|
|
5
|
+
export declare function CheckAnyOf(stack: Stack, context: CheckContext, schema: Schema.XAnyOf, value: unknown): boolean;
|
|
6
|
+
export declare function ErrorAnyOf(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XAnyOf, value: unknown): boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import { Reducer } from './_reducer.mjs';
|
|
3
2
|
import { CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
import {
|
|
3
|
+
import { Reducer } from './_reducer.mjs';
|
|
5
4
|
import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
5
|
+
import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
7
|
// Build
|
|
8
8
|
// ------------------------------------------------------------------
|
|
@@ -42,6 +42,11 @@ export function ErrorAnyOf(stack, context, schemaPath, instancePath, schema, val
|
|
|
42
42
|
}, []);
|
|
43
43
|
const isAnyOf = G.IsGreaterThan(results.length, 0) && context.Merge(results);
|
|
44
44
|
if (!isAnyOf)
|
|
45
|
-
failedContexts.forEach(failed =>
|
|
46
|
-
return isAnyOf || context.AddError(
|
|
45
|
+
failedContexts.forEach(failed => failed.GetErrors().forEach(error => context.AddError(error)));
|
|
46
|
+
return isAnyOf || context.AddError({
|
|
47
|
+
keyword: 'anyOf',
|
|
48
|
+
schemaPath,
|
|
49
|
+
instancePath,
|
|
50
|
+
params: {}
|
|
51
|
+
});
|
|
47
52
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Stack } from './_stack.mjs';
|
|
2
2
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
3
|
-
export declare function BuildSchemaBoolean(_stack: Stack
|
|
4
|
-
export declare function CheckSchemaBoolean(_stack: Stack
|
|
5
|
-
export declare function ErrorSchemaBoolean(stack: Stack
|
|
3
|
+
export declare function BuildSchemaBoolean(_stack: Stack, _context: BuildContext, schema: boolean, _value: string): string;
|
|
4
|
+
export declare function CheckSchemaBoolean(_stack: Stack, _context: CheckContext, schema: boolean, _value: unknown): boolean;
|
|
5
|
+
export declare function ErrorSchemaBoolean(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: boolean, value: unknown): boolean;
|
|
@@ -16,6 +16,10 @@ export function CheckSchemaBoolean(_stack, _context, schema, _value) {
|
|
|
16
16
|
// Error
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
18
|
export function ErrorSchemaBoolean(stack, context, schemaPath, instancePath, schema, value) {
|
|
19
|
-
return CheckSchemaBoolean(stack, context, schema, value) ||
|
|
20
|
-
|
|
19
|
+
return CheckSchemaBoolean(stack, context, schema, value) || context.AddError({
|
|
20
|
+
keyword: 'boolean',
|
|
21
|
+
schemaPath,
|
|
22
|
+
instancePath,
|
|
23
|
+
params: {}
|
|
24
|
+
});
|
|
21
25
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildConst(_stack: Stack
|
|
5
|
-
export declare function CheckConst(_stack: Stack
|
|
6
|
-
export declare function ErrorConst(stack: Stack
|
|
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
|
+
export declare function ErrorConst(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XConst, value: unknown): boolean;
|
|
@@ -21,6 +21,10 @@ export function CheckConst(_stack, _context, schema, value) {
|
|
|
21
21
|
// Check
|
|
22
22
|
// ------------------------------------------------------------------
|
|
23
23
|
export function ErrorConst(stack, context, schemaPath, instancePath, schema, value) {
|
|
24
|
-
return CheckConst(stack, context, schema, value) ||
|
|
25
|
-
|
|
24
|
+
return CheckConst(stack, context, schema, value) || context.AddError({
|
|
25
|
+
keyword: 'const',
|
|
26
|
+
schemaPath,
|
|
27
|
+
instancePath,
|
|
28
|
+
params: { allowedValue: schema.const },
|
|
29
|
+
});
|
|
26
30
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildContains(stack: Stack
|
|
5
|
-
export declare function CheckContains(stack: Stack
|
|
6
|
-
export declare function ErrorContains(stack: Stack
|
|
4
|
+
export declare function BuildContains(stack: Stack, context: BuildContext, schema: Schema.XContains, value: string): string;
|
|
5
|
+
export declare function CheckContains(stack: Stack, context: CheckContext, schema: Schema.XContains, value: unknown[]): boolean;
|
|
6
|
+
export declare function ErrorContains(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XContains, value: unknown[]): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
2
|
import * as Schema from '../types/index.mjs';
|
|
3
|
-
import
|
|
3
|
+
import { Unique } from './_unique.mjs';
|
|
4
4
|
import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
|
|
5
5
|
import { BuildSchema, CheckSchema } from './schema.mjs';
|
|
6
6
|
// ------------------------------------------------------------------
|
|
@@ -13,13 +13,13 @@ function IsValid(schema) {
|
|
|
13
13
|
// Build
|
|
14
14
|
// ------------------------------------------------------------------
|
|
15
15
|
function BuildContainsStandard(stack, context, schema, value) {
|
|
16
|
-
const [item, index] = [Unique
|
|
16
|
+
const [item, index] = [Unique(), Unique()];
|
|
17
17
|
const isLength = E.Not(E.IsEqual(E.Member(value, 'length'), E.Constant(0)));
|
|
18
18
|
const isSome = E.SomeAll(value, [item, index], E.And(BuildSchema(stack, context, schema.contains, item), context.AddIndex(index)));
|
|
19
19
|
return E.And(isLength, isSome);
|
|
20
20
|
}
|
|
21
21
|
function BuildContainsFast(stack, context, schema, value) {
|
|
22
|
-
const [item] = [Unique
|
|
22
|
+
const [item] = [Unique()];
|
|
23
23
|
const isLength = E.Not(E.IsEqual(E.Member(value, 'length'), E.Constant(0)));
|
|
24
24
|
const isSome = E.Some(value, [item, '_'], BuildSchema(stack, context, schema.contains, item));
|
|
25
25
|
return E.And(isLength, isSome);
|
|
@@ -45,6 +45,10 @@ export function CheckContains(stack, context, schema, value) {
|
|
|
45
45
|
// Error
|
|
46
46
|
// ------------------------------------------------------------------
|
|
47
47
|
export function ErrorContains(stack, context, schemaPath, instancePath, schema, value) {
|
|
48
|
-
return CheckContains(stack, context, schema, value) ||
|
|
49
|
-
|
|
48
|
+
return CheckContains(stack, context, schema, value) || context.AddError({
|
|
49
|
+
keyword: 'contains',
|
|
50
|
+
schemaPath,
|
|
51
|
+
instancePath,
|
|
52
|
+
params: { minContains: 1 },
|
|
53
|
+
});
|
|
50
54
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildDependencies(stack: Stack
|
|
5
|
-
export declare function CheckDependencies(stack: Stack
|
|
6
|
-
export declare function ErrorDependencies(stack: Stack
|
|
4
|
+
export declare function BuildDependencies(stack: Stack, context: BuildContext, schema: Schema.XDependencies, value: string): string;
|
|
5
|
+
export declare function CheckDependencies(stack: Stack, context: CheckContext, schema: Schema.XDependencies, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
+
export declare function ErrorDependencies(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XDependencies, value: Record<PropertyKey, unknown>): boolean;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import * as Pathing from './_pathing.mjs';
|
|
3
2
|
import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
|
|
4
3
|
import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
|
|
5
4
|
// ------------------------------------------------------------------
|
|
@@ -33,11 +32,14 @@ export function CheckDependencies(stack, context, schema, value) {
|
|
|
33
32
|
export function ErrorDependencies(stack, context, schemaPath, instancePath, schema, value) {
|
|
34
33
|
const isLength = G.IsEqual(G.Keys(value).length, 0);
|
|
35
34
|
const isEvery = G.EveryAll(G.Entries(schema.dependencies), 0, ([key, schema]) => {
|
|
36
|
-
const nextSchemaPath = `${schemaPath}/dependencies/${
|
|
35
|
+
const nextSchemaPath = `${schemaPath}/dependencies/${key}`;
|
|
37
36
|
return !G.HasPropertyKey(value, key) || (G.IsArray(schema)
|
|
38
|
-
? schema.every((dependency) => G.HasPropertyKey(value, dependency) ||
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
? schema.every((dependency) => G.HasPropertyKey(value, dependency) || context.AddError({
|
|
38
|
+
keyword: 'dependencies',
|
|
39
|
+
schemaPath,
|
|
40
|
+
instancePath,
|
|
41
|
+
params: { property: key, dependencies: schema },
|
|
42
|
+
})) : ErrorSchema(stack, context, nextSchemaPath, instancePath, schema, value));
|
|
41
43
|
});
|
|
42
44
|
return isLength || isEvery;
|
|
43
45
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildDependentRequired(_stack: Stack
|
|
5
|
-
export declare function CheckDependentRequired(_stack: Stack
|
|
6
|
-
export declare function ErrorDependentRequired(_stack: Stack
|
|
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;
|
|
@@ -29,8 +29,12 @@ export function CheckDependentRequired(_stack, _context, schema, value) {
|
|
|
29
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
|
-
return !G.HasPropertyKey(value, key) || G.EveryAll(keys, 0, (dependency) => G.HasPropertyKey(value, dependency) ||
|
|
33
|
-
|
|
32
|
+
return !G.HasPropertyKey(value, key) || G.EveryAll(keys, 0, (dependency) => G.HasPropertyKey(value, dependency) || context.AddError({
|
|
33
|
+
keyword: 'dependentRequired',
|
|
34
|
+
schemaPath,
|
|
35
|
+
instancePath,
|
|
36
|
+
params: { property: key, dependencies: keys },
|
|
37
|
+
}));
|
|
34
38
|
});
|
|
35
39
|
return isLength || isEveryEntry;
|
|
36
40
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildDependentSchemas(stack: Stack
|
|
5
|
-
export declare function CheckDependentSchemas(stack: Stack
|
|
6
|
-
export declare function ErrorDependentSchemas(stack: Stack
|
|
4
|
+
export declare function BuildDependentSchemas(stack: Stack, context: BuildContext, schema: Schema.XDependentSchemas, value: string): string;
|
|
5
|
+
export declare function CheckDependentSchemas(stack: Stack, context: CheckContext, schema: Schema.XDependentSchemas, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
+
export declare function ErrorDependentSchemas(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XDependentSchemas, value: Record<PropertyKey, unknown>): boolean;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import * as Pathing from './_pathing.mjs';
|
|
3
2
|
import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
4
3
|
import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
|
|
5
4
|
// ------------------------------------------------------------------
|
|
@@ -31,7 +30,7 @@ export function CheckDependentSchemas(stack, context, schema, value) {
|
|
|
31
30
|
export function ErrorDependentSchemas(stack, context, schemaPath, instancePath, schema, value) {
|
|
32
31
|
const isLength = G.IsEqual(G.Keys(value).length, 0);
|
|
33
32
|
const isEvery = G.EveryAll(G.Entries(schema.dependentSchemas), 0, ([key, schema]) => {
|
|
34
|
-
const nextSchemaPath = `${schemaPath}/dependentSchemas/${
|
|
33
|
+
const nextSchemaPath = `${schemaPath}/dependentSchemas/${key}`;
|
|
35
34
|
return !G.HasPropertyKey(value, key) ||
|
|
36
35
|
ErrorSchema(stack, context, nextSchemaPath, instancePath, schema, value);
|
|
37
36
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildDynamicRef(stack: Stack
|
|
5
|
-
export declare function CheckDynamicRef(stack: Stack
|
|
6
|
-
export declare function ErrorDynamicRef(stack: Stack
|
|
4
|
+
export declare function BuildDynamicRef(stack: Stack, context: BuildContext, schema: Schema.XDynamicRef, value: string): string;
|
|
5
|
+
export declare function CheckDynamicRef(stack: Stack, context: CheckContext, schema: Schema.XDynamicRef, value: unknown): boolean;
|
|
6
|
+
export declare function ErrorDynamicRef(stack: Stack, context: ErrorContext, _schemaPath: string, instancePath: string, schema: Schema.XDynamicRef, value: unknown): boolean;
|
|
@@ -1,29 +1,25 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import * as Schema from '../types/index.mjs';
|
|
3
2
|
import * as Functions from './_functions.mjs';
|
|
4
|
-
import
|
|
3
|
+
import * as Schema from '../types/index.mjs';
|
|
5
4
|
import { CheckSchema, ErrorSchema } from './schema.mjs';
|
|
6
5
|
// ------------------------------------------------------------------
|
|
7
6
|
// Build
|
|
8
7
|
// ------------------------------------------------------------------
|
|
9
8
|
export function BuildDynamicRef(stack, context, schema, value) {
|
|
10
|
-
const target =
|
|
11
|
-
|
|
12
|
-
return Functions.CreateFunction(nextStack, context, target, value);
|
|
9
|
+
const target = stack.DynamicRef(schema) ?? false;
|
|
10
|
+
return Functions.CreateFunction(stack, context, target, value);
|
|
13
11
|
}
|
|
14
12
|
// ------------------------------------------------------------------
|
|
15
13
|
// Check
|
|
16
14
|
// ------------------------------------------------------------------
|
|
17
15
|
export function CheckDynamicRef(stack, context, schema, value) {
|
|
18
|
-
const target =
|
|
19
|
-
|
|
20
|
-
return (Schema.IsSchema(target) && CheckSchema(nextStack, context, target, value));
|
|
16
|
+
const target = stack.DynamicRef(schema) ?? false;
|
|
17
|
+
return (Schema.IsSchema(target) && CheckSchema(stack, context, target, value));
|
|
21
18
|
}
|
|
22
19
|
// ------------------------------------------------------------------
|
|
23
20
|
// Error
|
|
24
21
|
// ------------------------------------------------------------------
|
|
25
|
-
export function ErrorDynamicRef(stack, context,
|
|
26
|
-
const target =
|
|
27
|
-
|
|
28
|
-
return (Schema.IsSchema(target) && ErrorSchema(nextStack, context, schemaPath, instancePath, target, value));
|
|
22
|
+
export function ErrorDynamicRef(stack, context, _schemaPath, instancePath, schema, value) {
|
|
23
|
+
const target = stack.DynamicRef(schema) ?? false;
|
|
24
|
+
return (Schema.IsSchema(target) && ErrorSchema(stack, context, '#', instancePath, target, value));
|
|
29
25
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildEnum(_stack: Stack
|
|
5
|
-
export declare function CheckEnum(_stack: Stack
|
|
6
|
-
export declare function ErrorEnum(stack: Stack
|
|
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
|
+
export declare function ErrorEnum(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XEnum, value: unknown): boolean;
|
|
@@ -24,6 +24,10 @@ export function CheckEnum(_stack, _context, schema, value) {
|
|
|
24
24
|
// Error
|
|
25
25
|
// ------------------------------------------------------------------
|
|
26
26
|
export function ErrorEnum(stack, context, schemaPath, instancePath, schema, value) {
|
|
27
|
-
return CheckEnum(stack, context, schema, value) ||
|
|
28
|
-
|
|
27
|
+
return CheckEnum(stack, context, schema, value) || context.AddError({
|
|
28
|
+
keyword: 'enum',
|
|
29
|
+
schemaPath,
|
|
30
|
+
instancePath,
|
|
31
|
+
params: { allowedValues: schema.enum }
|
|
32
|
+
});
|
|
29
33
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildExclusiveMaximum(_stack: Stack
|
|
5
|
-
export declare function CheckExclusiveMaximum(_stack: Stack
|
|
6
|
-
export declare function ErrorExclusiveMaximum(stack: Stack
|
|
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
|
+
export declare function ErrorExclusiveMaximum(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XExclusiveMaximum, value: number | bigint): boolean;
|
|
@@ -16,6 +16,10 @@ export function CheckExclusiveMaximum(_stack, _context, schema, value) {
|
|
|
16
16
|
// Error
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
18
|
export function ErrorExclusiveMaximum(stack, context, schemaPath, instancePath, schema, value) {
|
|
19
|
-
return CheckExclusiveMaximum(stack, context, schema, value) ||
|
|
20
|
-
|
|
19
|
+
return CheckExclusiveMaximum(stack, context, schema, value) || context.AddError({
|
|
20
|
+
keyword: 'exclusiveMaximum',
|
|
21
|
+
schemaPath,
|
|
22
|
+
instancePath,
|
|
23
|
+
params: { comparison: '<', limit: schema.exclusiveMaximum }
|
|
24
|
+
});
|
|
21
25
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildExclusiveMinimum(_stack: Stack
|
|
5
|
-
export declare function CheckExclusiveMinimum(_stack: Stack
|
|
6
|
-
export declare function ErrorExclusiveMinimum(stack: Stack
|
|
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
|
+
export declare function ErrorExclusiveMinimum(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XExclusiveMinimum, value: number | bigint): boolean;
|
|
@@ -16,6 +16,10 @@ export function CheckExclusiveMinimum(_stack, _context, schema, value) {
|
|
|
16
16
|
// Error
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
18
|
export function ErrorExclusiveMinimum(stack, context, schemaPath, instancePath, schema, value) {
|
|
19
|
-
return CheckExclusiveMinimum(stack, context, schema, value) ||
|
|
20
|
-
|
|
19
|
+
return CheckExclusiveMinimum(stack, context, schema, value) || context.AddError({
|
|
20
|
+
keyword: 'exclusiveMinimum',
|
|
21
|
+
schemaPath,
|
|
22
|
+
instancePath,
|
|
23
|
+
params: { comparison: '>', limit: schema.exclusiveMinimum }
|
|
24
|
+
});
|
|
21
25
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildFormat(_stack: Stack
|
|
5
|
-
export declare function CheckFormat(_stack: Stack
|
|
6
|
-
export declare function ErrorFormat(stack: Stack
|
|
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
|
+
export declare function ErrorFormat(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XFormat, value: string): boolean;
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import * as Externals from './_externals.mjs';
|
|
3
2
|
import { Format } from '../../format/index.mjs';
|
|
4
3
|
import { EmitGuard as E } from '../../guard/index.mjs';
|
|
5
4
|
// ------------------------------------------------------------------
|
|
6
|
-
// Build
|
|
7
|
-
// ------------------------------------------------------------------
|
|
8
|
-
// export function BuildFormat(_stack: Stack.XStack, _context: BuildContext, schema: Schema.XFormat, value: string): string {
|
|
9
|
-
// return E.Call(E.Member('Format', 'Test'), [E.Constant(schema.format), value])
|
|
10
|
-
// }
|
|
11
|
-
// ------------------------------------------------------------------
|
|
12
|
-
// Build (Inline)
|
|
5
|
+
// Build
|
|
13
6
|
// ------------------------------------------------------------------
|
|
14
7
|
export function BuildFormat(_stack, _context, schema, value) {
|
|
15
|
-
return
|
|
8
|
+
return E.Call(E.Member('Format', 'Test'), [E.Constant(schema.format), value]);
|
|
16
9
|
}
|
|
17
10
|
// ------------------------------------------------------------------
|
|
18
11
|
// Check
|
|
@@ -24,6 +17,10 @@ export function CheckFormat(_stack, _context, schema, value) {
|
|
|
24
17
|
// Error
|
|
25
18
|
// ------------------------------------------------------------------
|
|
26
19
|
export function ErrorFormat(stack, context, schemaPath, instancePath, schema, value) {
|
|
27
|
-
return CheckFormat(stack, context, schema, value) ||
|
|
28
|
-
|
|
20
|
+
return CheckFormat(stack, context, schema, value) || context.AddError({
|
|
21
|
+
keyword: 'format',
|
|
22
|
+
schemaPath,
|
|
23
|
+
instancePath,
|
|
24
|
+
params: { format: schema.format },
|
|
25
|
+
});
|
|
29
26
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildIf(stack: Stack
|
|
5
|
-
export declare function CheckIf(stack: Stack
|
|
6
|
-
export declare function ErrorIf(stack: Stack
|
|
4
|
+
export declare function BuildIf(stack: Stack, context: BuildContext, schema: Schema.XIf, value: string): string;
|
|
5
|
+
export declare function CheckIf(stack: Stack, context: CheckContext, schema: Schema.XIf, value: unknown): boolean;
|
|
6
|
+
export declare function ErrorIf(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XIf, value: unknown): boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
2
|
import * as Schema from '../types/index.mjs';
|
|
3
3
|
import { ErrorContext } from './_context.mjs';
|
|
4
|
-
import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
|
|
5
4
|
import { EmitGuard as E } from '../../guard/index.mjs';
|
|
5
|
+
import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
7
|
// Build
|
|
8
8
|
// ------------------------------------------------------------------
|
|
@@ -29,10 +29,18 @@ export function ErrorIf(stack, context, schemaPath, instancePath, schema, value)
|
|
|
29
29
|
const elseSchema = Schema.IsElse(schema) ? schema.else : true;
|
|
30
30
|
const trueContext = new ErrorContext();
|
|
31
31
|
const isIf = ErrorSchema(stack, trueContext, `${schemaPath}/if`, instancePath, schema.if, value)
|
|
32
|
-
? ErrorSchema(stack, trueContext, `${schemaPath}/then`, instancePath, thenSchema, value) ||
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
? ErrorSchema(stack, trueContext, `${schemaPath}/then`, instancePath, thenSchema, value) || context.AddError({
|
|
33
|
+
keyword: 'if',
|
|
34
|
+
schemaPath,
|
|
35
|
+
instancePath,
|
|
36
|
+
params: { failingKeyword: 'then' },
|
|
37
|
+
})
|
|
38
|
+
: ErrorSchema(stack, context, `${schemaPath}/else`, instancePath, elseSchema, value) || context.AddError({
|
|
39
|
+
keyword: 'if',
|
|
40
|
+
schemaPath,
|
|
41
|
+
instancePath,
|
|
42
|
+
params: { failingKeyword: 'else' },
|
|
43
|
+
});
|
|
36
44
|
if (isIf)
|
|
37
45
|
context.Merge([trueContext]);
|
|
38
46
|
return isIf;
|
|
@@ -4,7 +4,6 @@ export * from './_functions.mjs';
|
|
|
4
4
|
export * from './_reducer.mjs';
|
|
5
5
|
export * from './_refine.mjs';
|
|
6
6
|
export * from './_stack.mjs';
|
|
7
|
-
export * from './_unique.mjs';
|
|
8
7
|
export * from './additionalItems.mjs';
|
|
9
8
|
export * from './additionalProperties.mjs';
|
|
10
9
|
export * from './allOf.mjs';
|
|
@@ -7,7 +7,6 @@ export * from './_functions.mjs';
|
|
|
7
7
|
export * from './_reducer.mjs';
|
|
8
8
|
export * from './_refine.mjs';
|
|
9
9
|
export * from './_stack.mjs';
|
|
10
|
-
export * from './_unique.mjs';
|
|
11
10
|
// ------------------------------------------------------------------
|
|
12
11
|
// Schematics
|
|
13
12
|
// ------------------------------------------------------------------
|