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,7 +1,6 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
2
|
import * as Schema from '../types/index.mjs';
|
|
3
3
|
import { BuildRefine, CheckRefine, ErrorRefine } from './_refine.mjs';
|
|
4
|
-
import * as Stack from './_stack.mjs';
|
|
5
4
|
import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
|
|
6
5
|
import { BuildAdditionalItems, CheckAdditionalItems, ErrorAdditionalItems } from './additionalItems.mjs';
|
|
7
6
|
import { BuildAdditionalProperties, CheckAdditionalProperties, ErrorAdditionalProperties } from './additionalProperties.mjs';
|
|
@@ -133,34 +132,34 @@ export function BuildSchemaPushStack(stack, context, schema, value) {
|
|
|
133
132
|
: BuildSchema(stack, context, schema, value);
|
|
134
133
|
}
|
|
135
134
|
export function BuildSchema(stack, context, schema, value) {
|
|
136
|
-
|
|
135
|
+
stack.Push(schema);
|
|
137
136
|
const conditions = [];
|
|
138
137
|
if (Schema.IsSchemaBoolean(schema))
|
|
139
|
-
return BuildSchemaBoolean(
|
|
138
|
+
return BuildSchemaBoolean(stack, context, schema, value);
|
|
140
139
|
if (Schema.IsType(schema))
|
|
141
|
-
conditions.push(BuildType(
|
|
140
|
+
conditions.push(BuildType(stack, context, schema, value));
|
|
142
141
|
if (HasObjectKeywords(schema)) {
|
|
143
142
|
const constraints = [];
|
|
144
143
|
if (Schema.IsRequired(schema))
|
|
145
|
-
constraints.push(BuildRequired(
|
|
144
|
+
constraints.push(BuildRequired(stack, context, schema, value));
|
|
146
145
|
if (Schema.IsAdditionalProperties(schema))
|
|
147
|
-
constraints.push(BuildAdditionalProperties(
|
|
146
|
+
constraints.push(BuildAdditionalProperties(stack, context, schema, value));
|
|
148
147
|
if (Schema.IsDependencies(schema))
|
|
149
|
-
constraints.push(BuildDependencies(
|
|
148
|
+
constraints.push(BuildDependencies(stack, context, schema, value));
|
|
150
149
|
if (Schema.IsDependentRequired(schema))
|
|
151
|
-
constraints.push(BuildDependentRequired(
|
|
150
|
+
constraints.push(BuildDependentRequired(stack, context, schema, value));
|
|
152
151
|
if (Schema.IsDependentSchemas(schema))
|
|
153
|
-
constraints.push(BuildDependentSchemas(
|
|
152
|
+
constraints.push(BuildDependentSchemas(stack, context, schema, value));
|
|
154
153
|
if (Schema.IsPatternProperties(schema))
|
|
155
|
-
constraints.push(BuildPatternProperties(
|
|
154
|
+
constraints.push(BuildPatternProperties(stack, context, schema, value));
|
|
156
155
|
if (Schema.IsProperties(schema))
|
|
157
|
-
constraints.push(BuildProperties(
|
|
156
|
+
constraints.push(BuildProperties(stack, context, schema, value));
|
|
158
157
|
if (Schema.IsPropertyNames(schema))
|
|
159
|
-
constraints.push(BuildPropertyNames(
|
|
158
|
+
constraints.push(BuildPropertyNames(stack, context, schema, value));
|
|
160
159
|
if (Schema.IsMinProperties(schema))
|
|
161
|
-
constraints.push(BuildMinProperties(
|
|
160
|
+
constraints.push(BuildMinProperties(stack, context, schema, value));
|
|
162
161
|
if (Schema.IsMaxProperties(schema))
|
|
163
|
-
constraints.push(BuildMaxProperties(
|
|
162
|
+
constraints.push(BuildMaxProperties(stack, context, schema, value));
|
|
164
163
|
const reduced = E.ReduceAnd(constraints);
|
|
165
164
|
const guarded = E.Or(E.Not(E.IsObjectNotArray(value)), reduced);
|
|
166
165
|
conditions.push(HasObjectType(schema) ? reduced : guarded);
|
|
@@ -168,84 +167,85 @@ export function BuildSchema(stack, context, schema, value) {
|
|
|
168
167
|
if (HasArrayKeywords(schema)) {
|
|
169
168
|
const constraints = [];
|
|
170
169
|
if (Schema.IsAdditionalItems(schema))
|
|
171
|
-
constraints.push(BuildAdditionalItems(
|
|
170
|
+
constraints.push(BuildAdditionalItems(stack, context, schema, value));
|
|
172
171
|
if (Schema.IsContains(schema))
|
|
173
|
-
constraints.push(BuildContains(
|
|
172
|
+
constraints.push(BuildContains(stack, context, schema, value));
|
|
174
173
|
if (Schema.IsItems(schema))
|
|
175
|
-
constraints.push(BuildItems(
|
|
176
|
-
if (Schema.IsMinContains(schema))
|
|
177
|
-
constraints.push(BuildMinContains(current, context, schema, value));
|
|
174
|
+
constraints.push(BuildItems(stack, context, schema, value));
|
|
178
175
|
if (Schema.IsMaxContains(schema))
|
|
179
|
-
constraints.push(BuildMaxContains(
|
|
180
|
-
if (Schema.IsMinItems(schema))
|
|
181
|
-
constraints.push(BuildMinItems(current, context, schema, value));
|
|
176
|
+
constraints.push(BuildMaxContains(stack, context, schema, value));
|
|
182
177
|
if (Schema.IsMaxItems(schema))
|
|
183
|
-
constraints.push(BuildMaxItems(
|
|
178
|
+
constraints.push(BuildMaxItems(stack, context, schema, value));
|
|
179
|
+
if (Schema.IsMinContains(schema))
|
|
180
|
+
constraints.push(BuildMinContains(stack, context, schema, value));
|
|
181
|
+
if (Schema.IsMinItems(schema))
|
|
182
|
+
constraints.push(BuildMinItems(stack, context, schema, value));
|
|
184
183
|
if (Schema.IsPrefixItems(schema))
|
|
185
|
-
constraints.push(BuildPrefixItems(
|
|
184
|
+
constraints.push(BuildPrefixItems(stack, context, schema, value));
|
|
186
185
|
if (Schema.IsUniqueItems(schema))
|
|
187
|
-
constraints.push(BuildUniqueItems(
|
|
186
|
+
constraints.push(BuildUniqueItems(stack, context, schema, value));
|
|
188
187
|
const reduced = E.ReduceAnd(constraints);
|
|
189
188
|
const guarded = E.Or(E.Not(E.IsArray(value)), reduced);
|
|
190
189
|
conditions.push(HasArrayType(schema) ? reduced : guarded);
|
|
191
190
|
}
|
|
192
191
|
if (HasStringKeywords(schema)) {
|
|
193
192
|
const constraints = [];
|
|
194
|
-
if (Schema.IsMinLength(schema))
|
|
195
|
-
constraints.push(BuildMinLength(current, context, schema, value));
|
|
196
193
|
if (Schema.IsMaxLength(schema))
|
|
197
|
-
constraints.push(BuildMaxLength(
|
|
194
|
+
constraints.push(BuildMaxLength(stack, context, schema, value));
|
|
195
|
+
if (Schema.IsMinLength(schema))
|
|
196
|
+
constraints.push(BuildMinLength(stack, context, schema, value));
|
|
198
197
|
if (Schema.IsFormat(schema))
|
|
199
|
-
constraints.push(BuildFormat(
|
|
198
|
+
constraints.push(BuildFormat(stack, context, schema, value));
|
|
200
199
|
if (Schema.IsPattern(schema))
|
|
201
|
-
constraints.push(BuildPattern(
|
|
200
|
+
constraints.push(BuildPattern(stack, context, schema, value));
|
|
202
201
|
const reduced = E.ReduceAnd(constraints);
|
|
203
202
|
const guarded = E.Or(E.Not(E.IsString(value)), reduced);
|
|
204
203
|
conditions.push(HasStringType(schema) ? reduced : guarded);
|
|
205
204
|
}
|
|
206
205
|
if (HasNumberKeywords(schema)) {
|
|
207
206
|
const constraints = [];
|
|
208
|
-
if (Schema.IsExclusiveMinimum(schema))
|
|
209
|
-
constraints.push(BuildExclusiveMinimum(current, context, schema, value));
|
|
210
207
|
if (Schema.IsExclusiveMaximum(schema))
|
|
211
|
-
constraints.push(BuildExclusiveMaximum(
|
|
212
|
-
if (Schema.
|
|
213
|
-
constraints.push(
|
|
208
|
+
constraints.push(BuildExclusiveMaximum(stack, context, schema, value));
|
|
209
|
+
if (Schema.IsExclusiveMinimum(schema))
|
|
210
|
+
constraints.push(BuildExclusiveMinimum(stack, context, schema, value));
|
|
214
211
|
if (Schema.IsMaximum(schema))
|
|
215
|
-
constraints.push(BuildMaximum(
|
|
212
|
+
constraints.push(BuildMaximum(stack, context, schema, value));
|
|
213
|
+
if (Schema.IsMinimum(schema))
|
|
214
|
+
constraints.push(BuildMinimum(stack, context, schema, value));
|
|
216
215
|
if (Schema.IsMultipleOf(schema))
|
|
217
|
-
constraints.push(BuildMultipleOf(
|
|
216
|
+
constraints.push(BuildMultipleOf(stack, context, schema, value));
|
|
218
217
|
const reduced = E.ReduceAnd(constraints);
|
|
219
218
|
const guarded = E.Or(E.Not(E.Or(E.IsNumber(value), E.IsBigInt(value))), reduced);
|
|
220
219
|
conditions.push(HasNumberType(schema) ? reduced : guarded);
|
|
221
220
|
}
|
|
222
221
|
if (Schema.IsRef(schema))
|
|
223
|
-
conditions.push(BuildRef(
|
|
222
|
+
conditions.push(BuildRef(stack, context, schema, value));
|
|
224
223
|
if (Schema.IsRecursiveRef(schema))
|
|
225
|
-
conditions.push(BuildRecursiveRef(
|
|
224
|
+
conditions.push(BuildRecursiveRef(stack, context, schema, value));
|
|
226
225
|
if (Schema.IsDynamicRef(schema))
|
|
227
|
-
conditions.push(BuildDynamicRef(
|
|
226
|
+
conditions.push(BuildDynamicRef(stack, context, schema, value));
|
|
228
227
|
if (Schema.IsConst(schema))
|
|
229
|
-
conditions.push(BuildConst(
|
|
228
|
+
conditions.push(BuildConst(stack, context, schema, value));
|
|
230
229
|
if (Schema.IsEnum(schema))
|
|
231
|
-
conditions.push(BuildEnum(
|
|
230
|
+
conditions.push(BuildEnum(stack, context, schema, value));
|
|
232
231
|
if (Schema.IsIf(schema))
|
|
233
|
-
conditions.push(BuildIf(
|
|
232
|
+
conditions.push(BuildIf(stack, context, schema, value));
|
|
234
233
|
if (Schema.IsNot(schema))
|
|
235
|
-
conditions.push(BuildNot(
|
|
234
|
+
conditions.push(BuildNot(stack, context, schema, value));
|
|
236
235
|
if (Schema.IsAllOf(schema))
|
|
237
|
-
conditions.push(BuildAllOf(
|
|
236
|
+
conditions.push(BuildAllOf(stack, context, schema, value));
|
|
238
237
|
if (Schema.IsAnyOf(schema))
|
|
239
|
-
conditions.push(BuildAnyOf(
|
|
238
|
+
conditions.push(BuildAnyOf(stack, context, schema, value));
|
|
240
239
|
if (Schema.IsOneOf(schema))
|
|
241
|
-
conditions.push(BuildOneOf(
|
|
240
|
+
conditions.push(BuildOneOf(stack, context, schema, value));
|
|
242
241
|
if (Schema.IsUnevaluatedItems(schema))
|
|
243
|
-
conditions.push(E.Or(E.Not(E.IsArray(value)), BuildUnevaluatedItems(
|
|
242
|
+
conditions.push(E.Or(E.Not(E.IsArray(value)), BuildUnevaluatedItems(stack, context, schema, value)));
|
|
244
243
|
if (Schema.IsUnevaluatedProperties(schema))
|
|
245
|
-
conditions.push(E.Or(E.Not(E.IsObject(value)), BuildUnevaluatedProperties(
|
|
244
|
+
conditions.push(E.Or(E.Not(E.IsObject(value)), BuildUnevaluatedProperties(stack, context, schema, value)));
|
|
246
245
|
if (Schema.IsRefine(schema))
|
|
247
|
-
conditions.push(BuildRefine(
|
|
246
|
+
conditions.push(BuildRefine(stack, context, schema, value));
|
|
248
247
|
const result = E.ReduceAnd(conditions);
|
|
248
|
+
stack.Pop(schema);
|
|
249
249
|
return result;
|
|
250
250
|
}
|
|
251
251
|
// ----------------------------------------------------------------
|
|
@@ -255,49 +255,50 @@ export function CheckSchemaPushStack(stack, context, schema, value) {
|
|
|
255
255
|
return (context.Push() && CheckSchema(stack, context, schema, value)) && context.Pop();
|
|
256
256
|
}
|
|
257
257
|
export function CheckSchema(stack, context, schema, value) {
|
|
258
|
-
|
|
259
|
-
const result = Schema.IsSchemaBoolean(schema) ? CheckSchemaBoolean(
|
|
260
|
-
(!(G.IsObject(value) && !G.IsArray(value)) || ((!Schema.IsRequired(schema) || CheckRequired(
|
|
261
|
-
(!Schema.IsAdditionalProperties(schema) || CheckAdditionalProperties(
|
|
262
|
-
(!Schema.IsDependencies(schema) || CheckDependencies(
|
|
263
|
-
(!Schema.IsDependentRequired(schema) || CheckDependentRequired(
|
|
264
|
-
(!Schema.IsDependentSchemas(schema) || CheckDependentSchemas(
|
|
265
|
-
(!Schema.IsPatternProperties(schema) || CheckPatternProperties(
|
|
266
|
-
(!Schema.IsProperties(schema) || CheckProperties(
|
|
267
|
-
(!Schema.IsPropertyNames(schema) || CheckPropertyNames(
|
|
268
|
-
(!Schema.IsMinProperties(schema) || CheckMinProperties(
|
|
269
|
-
(!Schema.IsMaxProperties(schema) || CheckMaxProperties(
|
|
270
|
-
(!G.IsArray(value) || ((!Schema.IsAdditionalItems(schema) || CheckAdditionalItems(
|
|
271
|
-
(!Schema.IsContains(schema) || CheckContains(
|
|
272
|
-
(!Schema.IsItems(schema) || CheckItems(
|
|
273
|
-
(!Schema.
|
|
274
|
-
(!Schema.
|
|
275
|
-
(!Schema.
|
|
276
|
-
(!Schema.
|
|
277
|
-
(!Schema.IsPrefixItems(schema) || CheckPrefixItems(
|
|
278
|
-
(!Schema.IsUniqueItems(schema) || CheckUniqueItems(
|
|
279
|
-
(!G.IsString(value) || ((!Schema.
|
|
280
|
-
(!Schema.
|
|
281
|
-
(!Schema.IsFormat(schema) || CheckFormat(
|
|
282
|
-
(!Schema.IsPattern(schema) || CheckPattern(
|
|
283
|
-
(!(G.IsNumber(value) || G.IsBigInt(value)) || ((!Schema.
|
|
284
|
-
(!Schema.
|
|
285
|
-
(!Schema.
|
|
286
|
-
(!Schema.
|
|
287
|
-
(!Schema.IsMultipleOf(schema) || CheckMultipleOf(
|
|
288
|
-
(!Schema.IsRef(schema) || CheckRef(
|
|
289
|
-
(!Schema.IsRecursiveRef(schema) || CheckRecursiveRef(
|
|
290
|
-
(!Schema.IsDynamicRef(schema) || CheckDynamicRef(
|
|
291
|
-
(!Schema.IsConst(schema) || CheckConst(
|
|
292
|
-
(!Schema.IsEnum(schema) || CheckEnum(
|
|
293
|
-
(!Schema.IsIf(schema) || CheckIf(
|
|
294
|
-
(!Schema.IsNot(schema) || CheckNot(
|
|
295
|
-
(!Schema.IsAllOf(schema) || CheckAllOf(
|
|
296
|
-
(!Schema.IsAnyOf(schema) || CheckAnyOf(
|
|
297
|
-
(!Schema.IsOneOf(schema) || CheckOneOf(
|
|
298
|
-
(!Schema.IsUnevaluatedItems(schema) || (!G.IsArray(value) || CheckUnevaluatedItems(
|
|
299
|
-
(!Schema.IsUnevaluatedProperties(schema) || (!G.IsObject(value) || CheckUnevaluatedProperties(
|
|
300
|
-
(!Schema.IsRefine(schema) || CheckRefine(
|
|
258
|
+
stack.Push(schema);
|
|
259
|
+
const result = Schema.IsSchemaBoolean(schema) ? CheckSchemaBoolean(stack, context, schema, value) : ((!Schema.IsType(schema) || CheckType(stack, context, schema, value)) &&
|
|
260
|
+
(!(G.IsObject(value) && !G.IsArray(value)) || ((!Schema.IsRequired(schema) || CheckRequired(stack, context, schema, value)) &&
|
|
261
|
+
(!Schema.IsAdditionalProperties(schema) || CheckAdditionalProperties(stack, context, schema, value)) &&
|
|
262
|
+
(!Schema.IsDependencies(schema) || CheckDependencies(stack, context, schema, value)) &&
|
|
263
|
+
(!Schema.IsDependentRequired(schema) || CheckDependentRequired(stack, context, schema, value)) &&
|
|
264
|
+
(!Schema.IsDependentSchemas(schema) || CheckDependentSchemas(stack, context, schema, value)) &&
|
|
265
|
+
(!Schema.IsPatternProperties(schema) || CheckPatternProperties(stack, context, schema, value)) &&
|
|
266
|
+
(!Schema.IsProperties(schema) || CheckProperties(stack, context, schema, value)) &&
|
|
267
|
+
(!Schema.IsPropertyNames(schema) || CheckPropertyNames(stack, context, schema, value)) &&
|
|
268
|
+
(!Schema.IsMinProperties(schema) || CheckMinProperties(stack, context, schema, value)) &&
|
|
269
|
+
(!Schema.IsMaxProperties(schema) || CheckMaxProperties(stack, context, schema, value)))) &&
|
|
270
|
+
(!G.IsArray(value) || ((!Schema.IsAdditionalItems(schema) || CheckAdditionalItems(stack, context, schema, value)) &&
|
|
271
|
+
(!Schema.IsContains(schema) || CheckContains(stack, context, schema, value)) &&
|
|
272
|
+
(!Schema.IsItems(schema) || CheckItems(stack, context, schema, value)) &&
|
|
273
|
+
(!Schema.IsMaxContains(schema) || CheckMaxContains(stack, context, schema, value)) &&
|
|
274
|
+
(!Schema.IsMaxItems(schema) || CheckMaxItems(stack, context, schema, value)) &&
|
|
275
|
+
(!Schema.IsMinContains(schema) || CheckMinContains(stack, context, schema, value)) &&
|
|
276
|
+
(!Schema.IsMinItems(schema) || CheckMinItems(stack, context, schema, value)) &&
|
|
277
|
+
(!Schema.IsPrefixItems(schema) || CheckPrefixItems(stack, context, schema, value)) &&
|
|
278
|
+
(!Schema.IsUniqueItems(schema) || CheckUniqueItems(stack, context, schema, value)))) &&
|
|
279
|
+
(!G.IsString(value) || ((!Schema.IsMaxLength(schema) || CheckMaxLength(stack, context, schema, value)) &&
|
|
280
|
+
(!Schema.IsMinLength(schema) || CheckMinLength(stack, context, schema, value)) &&
|
|
281
|
+
(!Schema.IsFormat(schema) || CheckFormat(stack, context, schema, value)) &&
|
|
282
|
+
(!Schema.IsPattern(schema) || CheckPattern(stack, context, schema, value)))) &&
|
|
283
|
+
(!(G.IsNumber(value) || G.IsBigInt(value)) || ((!Schema.IsExclusiveMaximum(schema) || CheckExclusiveMaximum(stack, context, schema, value)) &&
|
|
284
|
+
(!Schema.IsExclusiveMinimum(schema) || CheckExclusiveMinimum(stack, context, schema, value)) &&
|
|
285
|
+
(!Schema.IsMaximum(schema) || CheckMaximum(stack, context, schema, value)) &&
|
|
286
|
+
(!Schema.IsMinimum(schema) || CheckMinimum(stack, context, schema, value)) &&
|
|
287
|
+
(!Schema.IsMultipleOf(schema) || CheckMultipleOf(stack, context, schema, value)))) &&
|
|
288
|
+
(!Schema.IsRef(schema) || CheckRef(stack, context, schema, value)) &&
|
|
289
|
+
(!Schema.IsRecursiveRef(schema) || CheckRecursiveRef(stack, context, schema, value)) &&
|
|
290
|
+
(!Schema.IsDynamicRef(schema) || CheckDynamicRef(stack, context, schema, value)) &&
|
|
291
|
+
(!Schema.IsConst(schema) || CheckConst(stack, context, schema, value)) &&
|
|
292
|
+
(!Schema.IsEnum(schema) || CheckEnum(stack, context, schema, value)) &&
|
|
293
|
+
(!Schema.IsIf(schema) || CheckIf(stack, context, schema, value)) &&
|
|
294
|
+
(!Schema.IsNot(schema) || CheckNot(stack, context, schema, value)) &&
|
|
295
|
+
(!Schema.IsAllOf(schema) || CheckAllOf(stack, context, schema, value)) &&
|
|
296
|
+
(!Schema.IsAnyOf(schema) || CheckAnyOf(stack, context, schema, value)) &&
|
|
297
|
+
(!Schema.IsOneOf(schema) || CheckOneOf(stack, context, schema, value)) &&
|
|
298
|
+
(!Schema.IsUnevaluatedItems(schema) || (!G.IsArray(value) || CheckUnevaluatedItems(stack, context, schema, value))) &&
|
|
299
|
+
(!Schema.IsUnevaluatedProperties(schema) || (!G.IsObject(value) || CheckUnevaluatedProperties(stack, context, schema, value))) &&
|
|
300
|
+
(!Schema.IsRefine(schema) || CheckRefine(stack, context, schema, value)));
|
|
301
|
+
stack.Pop(schema);
|
|
301
302
|
return result;
|
|
302
303
|
}
|
|
303
304
|
// ----------------------------------------------------------------
|
|
@@ -313,48 +314,49 @@ export function ErrorSchema(stack, context, schemaPath, instancePath, schema, va
|
|
|
313
314
|
// full set of errors accumulated by the schema as a whole. (review)
|
|
314
315
|
if (context.AtCapacity())
|
|
315
316
|
return false;
|
|
316
|
-
|
|
317
|
-
const result = (Schema.IsSchemaBoolean(schema)) ? ErrorSchemaBoolean(
|
|
318
|
-
+(!(G.IsObject(value) && !G.IsArray(value)) || !!(+(!Schema.IsRequired(schema) || ErrorRequired(
|
|
319
|
-
+(!Schema.IsAdditionalProperties(schema) || ErrorAdditionalProperties(
|
|
320
|
-
+(!Schema.IsDependencies(schema) || ErrorDependencies(
|
|
321
|
-
+(!Schema.IsDependentRequired(schema) || ErrorDependentRequired(
|
|
322
|
-
+(!Schema.IsDependentSchemas(schema) || ErrorDependentSchemas(
|
|
323
|
-
+(!Schema.IsPatternProperties(schema) || ErrorPatternProperties(
|
|
324
|
-
+(!Schema.IsProperties(schema) || ErrorProperties(
|
|
325
|
-
+(!Schema.IsPropertyNames(schema) || ErrorPropertyNames(
|
|
326
|
-
+(!Schema.IsMinProperties(schema) || ErrorMinProperties(
|
|
327
|
-
+(!Schema.IsMaxProperties(schema) || ErrorMaxProperties(
|
|
328
|
-
+(!G.IsArray(value) || !!(+(!Schema.IsAdditionalItems(schema) || ErrorAdditionalItems(
|
|
329
|
-
+(!Schema.IsContains(schema) || ErrorContains(
|
|
330
|
-
+(!Schema.IsItems(schema) || ErrorItems(
|
|
331
|
-
+(!Schema.
|
|
332
|
-
+(!Schema.
|
|
333
|
-
+(!Schema.
|
|
334
|
-
+(!Schema.
|
|
335
|
-
+(!Schema.IsPrefixItems(schema) || ErrorPrefixItems(
|
|
336
|
-
+(!Schema.IsUniqueItems(schema) || ErrorUniqueItems(
|
|
337
|
-
+(!G.IsString(value) || !!(+(!Schema.
|
|
338
|
-
+(!Schema.
|
|
339
|
-
+(!Schema.IsFormat(schema) || ErrorFormat(
|
|
340
|
-
+(!Schema.IsPattern(schema) || ErrorPattern(
|
|
341
|
-
+(!(G.IsNumber(value) || G.IsBigInt(value)) || !!(+(!Schema.
|
|
342
|
-
+(!Schema.
|
|
343
|
-
+(!Schema.
|
|
344
|
-
+(!Schema.
|
|
345
|
-
+(!Schema.IsMultipleOf(schema) || ErrorMultipleOf(
|
|
346
|
-
+(!Schema.IsRef(schema) || ErrorRef(
|
|
347
|
-
+(!Schema.IsRecursiveRef(schema) || ErrorRecursiveRef(
|
|
348
|
-
+(!Schema.IsDynamicRef(schema) || ErrorDynamicRef(
|
|
349
|
-
+(!Schema.IsConst(schema) || ErrorConst(
|
|
350
|
-
+(!Schema.IsEnum(schema) || ErrorEnum(
|
|
351
|
-
+(!Schema.IsIf(schema) || ErrorIf(
|
|
352
|
-
+(!Schema.IsNot(schema) || ErrorNot(
|
|
353
|
-
+(!Schema.IsAllOf(schema) || ErrorAllOf(
|
|
354
|
-
+(!Schema.IsAnyOf(schema) || ErrorAnyOf(
|
|
355
|
-
+(!Schema.IsOneOf(schema) || ErrorOneOf(
|
|
356
|
-
+(!Schema.IsUnevaluatedItems(schema) || (!G.IsArray(value) || ErrorUnevaluatedItems(
|
|
357
|
-
+(!Schema.IsUnevaluatedProperties(schema) || (!G.IsObject(value) || ErrorUnevaluatedProperties(
|
|
358
|
-
(!Schema.IsRefine(schema) || ErrorRefine(
|
|
317
|
+
stack.Push(schema);
|
|
318
|
+
const result = (Schema.IsSchemaBoolean(schema)) ? ErrorSchemaBoolean(stack, context, schemaPath, instancePath, schema, value) : (!!(+(!Schema.IsType(schema) || ErrorType(stack, context, schemaPath, instancePath, schema, value)) &
|
|
319
|
+
+(!(G.IsObject(value) && !G.IsArray(value)) || !!(+(!Schema.IsRequired(schema) || ErrorRequired(stack, context, schemaPath, instancePath, schema, value)) &
|
|
320
|
+
+(!Schema.IsAdditionalProperties(schema) || ErrorAdditionalProperties(stack, context, schemaPath, instancePath, schema, value)) &
|
|
321
|
+
+(!Schema.IsDependencies(schema) || ErrorDependencies(stack, context, schemaPath, instancePath, schema, value)) &
|
|
322
|
+
+(!Schema.IsDependentRequired(schema) || ErrorDependentRequired(stack, context, schemaPath, instancePath, schema, value)) &
|
|
323
|
+
+(!Schema.IsDependentSchemas(schema) || ErrorDependentSchemas(stack, context, schemaPath, instancePath, schema, value)) &
|
|
324
|
+
+(!Schema.IsPatternProperties(schema) || ErrorPatternProperties(stack, context, schemaPath, instancePath, schema, value)) &
|
|
325
|
+
+(!Schema.IsProperties(schema) || ErrorProperties(stack, context, schemaPath, instancePath, schema, value)) &
|
|
326
|
+
+(!Schema.IsPropertyNames(schema) || ErrorPropertyNames(stack, context, schemaPath, instancePath, schema, value)) &
|
|
327
|
+
+(!Schema.IsMinProperties(schema) || ErrorMinProperties(stack, context, schemaPath, instancePath, schema, value)) &
|
|
328
|
+
+(!Schema.IsMaxProperties(schema) || ErrorMaxProperties(stack, context, schemaPath, instancePath, schema, value)))) &
|
|
329
|
+
+(!G.IsArray(value) || !!(+(!Schema.IsAdditionalItems(schema) || ErrorAdditionalItems(stack, context, schemaPath, instancePath, schema, value)) &
|
|
330
|
+
+(!Schema.IsContains(schema) || ErrorContains(stack, context, schemaPath, instancePath, schema, value)) &
|
|
331
|
+
+(!Schema.IsItems(schema) || ErrorItems(stack, context, schemaPath, instancePath, schema, value)) &
|
|
332
|
+
+(!Schema.IsMaxContains(schema) || ErrorMaxContains(stack, context, schemaPath, instancePath, schema, value)) &
|
|
333
|
+
+(!Schema.IsMaxItems(schema) || ErrorMaxItems(stack, context, schemaPath, instancePath, schema, value)) &
|
|
334
|
+
+(!Schema.IsMinContains(schema) || ErrorMinContains(stack, context, schemaPath, instancePath, schema, value)) &
|
|
335
|
+
+(!Schema.IsMinItems(schema) || ErrorMinItems(stack, context, schemaPath, instancePath, schema, value)) &
|
|
336
|
+
+(!Schema.IsPrefixItems(schema) || ErrorPrefixItems(stack, context, schemaPath, instancePath, schema, value)) &
|
|
337
|
+
+(!Schema.IsUniqueItems(schema) || ErrorUniqueItems(stack, context, schemaPath, instancePath, schema, value)))) &
|
|
338
|
+
+(!G.IsString(value) || !!(+(!Schema.IsMaxLength(schema) || ErrorMaxLength(stack, context, schemaPath, instancePath, schema, value)) &
|
|
339
|
+
+(!Schema.IsMinLength(schema) || ErrorMinLength(stack, context, schemaPath, instancePath, schema, value)) &
|
|
340
|
+
+(!Schema.IsFormat(schema) || ErrorFormat(stack, context, schemaPath, instancePath, schema, value)) &
|
|
341
|
+
+(!Schema.IsPattern(schema) || ErrorPattern(stack, context, schemaPath, instancePath, schema, value)))) &
|
|
342
|
+
+(!(G.IsNumber(value) || G.IsBigInt(value)) || !!(+(!Schema.IsExclusiveMaximum(schema) || ErrorExclusiveMaximum(stack, context, schemaPath, instancePath, schema, value)) &
|
|
343
|
+
+(!Schema.IsExclusiveMinimum(schema) || ErrorExclusiveMinimum(stack, context, schemaPath, instancePath, schema, value)) &
|
|
344
|
+
+(!Schema.IsMaximum(schema) || ErrorMaximum(stack, context, schemaPath, instancePath, schema, value)) &
|
|
345
|
+
+(!Schema.IsMinimum(schema) || ErrorMinimum(stack, context, schemaPath, instancePath, schema, value)) &
|
|
346
|
+
+(!Schema.IsMultipleOf(schema) || ErrorMultipleOf(stack, context, schemaPath, instancePath, schema, value)))) &
|
|
347
|
+
+(!Schema.IsRef(schema) || ErrorRef(stack, context, schemaPath, instancePath, schema, value)) &
|
|
348
|
+
+(!Schema.IsRecursiveRef(schema) || ErrorRecursiveRef(stack, context, schemaPath, instancePath, schema, value)) &
|
|
349
|
+
+(!Schema.IsDynamicRef(schema) || ErrorDynamicRef(stack, context, schemaPath, instancePath, schema, value)) &
|
|
350
|
+
+(!Schema.IsConst(schema) || ErrorConst(stack, context, schemaPath, instancePath, schema, value)) &
|
|
351
|
+
+(!Schema.IsEnum(schema) || ErrorEnum(stack, context, schemaPath, instancePath, schema, value)) &
|
|
352
|
+
+(!Schema.IsIf(schema) || ErrorIf(stack, context, schemaPath, instancePath, schema, value)) &
|
|
353
|
+
+(!Schema.IsNot(schema) || ErrorNot(stack, context, schemaPath, instancePath, schema, value)) &
|
|
354
|
+
+(!Schema.IsAllOf(schema) || ErrorAllOf(stack, context, schemaPath, instancePath, schema, value)) &
|
|
355
|
+
+(!Schema.IsAnyOf(schema) || ErrorAnyOf(stack, context, schemaPath, instancePath, schema, value)) &
|
|
356
|
+
+(!Schema.IsOneOf(schema) || ErrorOneOf(stack, context, schemaPath, instancePath, schema, value)) &
|
|
357
|
+
+(!Schema.IsUnevaluatedItems(schema) || (!G.IsArray(value) || ErrorUnevaluatedItems(stack, context, schemaPath, instancePath, schema, value))) &
|
|
358
|
+
+(!Schema.IsUnevaluatedProperties(schema) || (!G.IsObject(value) || ErrorUnevaluatedProperties(stack, context, schemaPath, instancePath, schema, value)))) &&
|
|
359
|
+
(!Schema.IsRefine(schema) || ErrorRefine(stack, context, schemaPath, instancePath, schema, value)));
|
|
360
|
+
stack.Pop(schema);
|
|
359
361
|
return result;
|
|
360
362
|
}
|
|
@@ -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 BuildType(stack: Stack
|
|
5
|
-
export declare function CheckType(stack: Stack
|
|
6
|
-
export declare function ErrorType(stack: Stack
|
|
4
|
+
export declare function BuildType(stack: Stack, context: BuildContext, schema: Schema.XType, value: string): string;
|
|
5
|
+
export declare function CheckType(stack: Stack, context: CheckContext, schema: Schema.XType, value: unknown): boolean;
|
|
6
|
+
export declare function ErrorType(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XType, value: unknown): boolean;
|
|
@@ -61,6 +61,10 @@ export function CheckType(stack, context, schema, value) {
|
|
|
61
61
|
}
|
|
62
62
|
export function ErrorType(stack, context, schemaPath, instancePath, schema, value) {
|
|
63
63
|
const isType = G.IsArray(schema.type) ? CheckTypeNames(stack, context, schema.type, schema, value) : CheckTypeName(stack, context, schema.type, schema, value);
|
|
64
|
-
return isType ||
|
|
65
|
-
|
|
64
|
+
return isType || context.AddError({
|
|
65
|
+
keyword: 'type',
|
|
66
|
+
schemaPath,
|
|
67
|
+
instancePath,
|
|
68
|
+
params: { type: schema.type }
|
|
69
|
+
});
|
|
66
70
|
}
|
|
@@ -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 BuildUnevaluatedItems(stack: Stack
|
|
5
|
-
export declare function CheckUnevaluatedItems(stack: Stack
|
|
6
|
-
export declare function ErrorUnevaluatedItems(stack: Stack
|
|
4
|
+
export declare function BuildUnevaluatedItems(stack: Stack, context: BuildContext, schema: Schema.XUnevaluatedItems, value: string): string;
|
|
5
|
+
export declare function CheckUnevaluatedItems(stack: Stack, context: CheckContext, schema: Schema.XUnevaluatedItems, value: unknown[]): boolean;
|
|
6
|
+
export declare function ErrorUnevaluatedItems(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XUnevaluatedItems, value: unknown[]): boolean;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import
|
|
2
|
+
import { Unique } from './_unique.mjs';
|
|
3
3
|
import { ErrorContext } from './_context.mjs';
|
|
4
|
-
import { BuildSchema, CheckSchema, ErrorSchema } from './schema.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
|
// ------------------------------------------------------------------
|
|
9
9
|
export function BuildUnevaluatedItems(stack, context, schema, value) {
|
|
10
|
-
const [index, item] = [Unique
|
|
10
|
+
const [index, item] = [Unique(), Unique()];
|
|
11
11
|
const indices = E.Call(E.Member('context', 'GetIndices'), []);
|
|
12
12
|
const hasIndex = E.Call(E.Member('indices', 'has'), [index]);
|
|
13
13
|
const isSchema = BuildSchema(stack, context, schema.unevaluatedItems, item);
|
|
@@ -42,6 +42,10 @@ export function ErrorUnevaluatedItems(stack, context, schemaPath, instancePath,
|
|
|
42
42
|
unevaluatedItems.push(index);
|
|
43
43
|
return isEvaluatedItem;
|
|
44
44
|
});
|
|
45
|
-
return isUnevaluatedItems ||
|
|
46
|
-
|
|
45
|
+
return isUnevaluatedItems || context.AddError({
|
|
46
|
+
keyword: 'unevaluatedItems',
|
|
47
|
+
schemaPath,
|
|
48
|
+
instancePath,
|
|
49
|
+
params: { unevaluatedItems }
|
|
50
|
+
});
|
|
47
51
|
}
|
|
@@ -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 BuildUnevaluatedProperties(stack: Stack
|
|
5
|
-
export declare function CheckUnevaluatedProperties(stack: Stack
|
|
6
|
-
export declare function ErrorUnevaluatedProperties(stack: Stack
|
|
4
|
+
export declare function BuildUnevaluatedProperties(stack: Stack, context: BuildContext, schema: Schema.XUnevaluatedProperties, value: string): string;
|
|
5
|
+
export declare function CheckUnevaluatedProperties(stack: Stack, context: CheckContext, schema: Schema.XUnevaluatedProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
+
export declare function ErrorUnevaluatedProperties(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XUnevaluatedProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import
|
|
2
|
+
import { Unique } from './_unique.mjs';
|
|
3
3
|
import { ErrorContext } from './_context.mjs';
|
|
4
|
-
import { BuildSchema, CheckSchema, ErrorSchema } from './schema.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
|
// ------------------------------------------------------------------
|
|
9
9
|
export function BuildUnevaluatedProperties(stack, context, schema, value) {
|
|
10
|
-
const [key, prop] = [Unique
|
|
10
|
+
const [key, prop] = [Unique(), Unique()];
|
|
11
11
|
const keys = E.Call(E.Member('context', 'GetKeys'), []);
|
|
12
12
|
const hasKey = E.Call(E.Member('keys', 'has'), [key]);
|
|
13
13
|
const addKey = E.Call(E.Member('context', 'AddKey'), [key]);
|
|
@@ -42,6 +42,10 @@ export function ErrorUnevaluatedProperties(stack, context, schemaPath, instanceP
|
|
|
42
42
|
unevaluatedProperties.push(key);
|
|
43
43
|
return isEvaluatedProperty;
|
|
44
44
|
});
|
|
45
|
-
return isUnevaluatedProperties ||
|
|
46
|
-
|
|
45
|
+
return isUnevaluatedProperties || context.AddError({
|
|
46
|
+
keyword: 'unevaluatedProperties',
|
|
47
|
+
schemaPath,
|
|
48
|
+
instancePath,
|
|
49
|
+
params: { unevaluatedProperties }
|
|
50
|
+
});
|
|
47
51
|
}
|
|
@@ -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 BuildUniqueItems(_stack: Stack
|
|
5
|
-
export declare function CheckUniqueItems(_stack: Stack
|
|
6
|
-
export declare function ErrorUniqueItems(_stack: Stack
|
|
4
|
+
export declare function BuildUniqueItems(_stack: Stack, _context: BuildContext, schema: Schema.XUniqueItems, value: string): string;
|
|
5
|
+
export declare function CheckUniqueItems(_stack: Stack, _context: CheckContext, schema: Schema.XUniqueItems, value: unknown[]): boolean;
|
|
6
|
+
export declare function ErrorUniqueItems(_stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XUniqueItems, value: unknown[]): boolean;
|
|
@@ -42,6 +42,10 @@ export function ErrorUniqueItems(_stack, context, schemaPath, instancePath, sche
|
|
|
42
42
|
return result;
|
|
43
43
|
}, []);
|
|
44
44
|
const isUniqueItems = G.IsEqual(duplicateItems.length, 0);
|
|
45
|
-
return isUniqueItems ||
|
|
46
|
-
|
|
45
|
+
return isUniqueItems || context.AddError({
|
|
46
|
+
keyword: 'uniqueItems',
|
|
47
|
+
schemaPath,
|
|
48
|
+
instancePath,
|
|
49
|
+
params: { duplicateItems },
|
|
50
|
+
});
|
|
47
51
|
}
|
|
@@ -8,7 +8,7 @@ export function Errors(...args) {
|
|
|
8
8
|
3: (context, schema, value) => [context, schema, value],
|
|
9
9
|
2: (schema, value) => [{}, schema, value]
|
|
10
10
|
});
|
|
11
|
-
const stack = Engine.Stack(context, schema);
|
|
11
|
+
const stack = new Engine.Stack(context, schema);
|
|
12
12
|
const errorContext = new Engine.ErrorContext();
|
|
13
13
|
const result = Engine.ErrorSchema(stack, errorContext, '#', '', schema, value);
|
|
14
14
|
const errors = errorContext.GetErrors();
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import * as Schema from '../types/index.mjs';
|
|
2
1
|
import { type XStatic } from '../static/index.mjs';
|
|
2
|
+
import * as S from '../types/index.mjs';
|
|
3
3
|
export interface XIntern<Type extends unknown = unknown> {
|
|
4
4
|
'~unsafe': Type;
|
|
5
5
|
$ref: string;
|
|
6
|
-
$defs: Record<string,
|
|
6
|
+
$defs: Record<string, S.XSchemaObject>;
|
|
7
7
|
}
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
/**
|
|
9
|
+
* [Experimental] Performs a Common Subexpression Elimination (CSE) transform on the given
|
|
10
|
+
* schema. This function restructures the schema such that each distinct sub-schema is stored
|
|
11
|
+
* exactly once in a $defs object and keyed by content hash. This function can be used to
|
|
12
|
+
* both compress and optimize schemas prior to compilation.
|
|
13
|
+
*/
|
|
14
|
+
export declare function Intern<const Schema extends S.XSchema>(schema: Schema): XIntern<XStatic<Schema>>;
|