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,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 BuildItems(stack: Stack
|
|
5
|
-
export declare function CheckItems(stack: Stack
|
|
6
|
-
export declare function ErrorItems(stack: Stack
|
|
4
|
+
export declare function BuildItems(stack: Stack, context: BuildContext, schema: Schema.XItems, value: string): string;
|
|
5
|
+
export declare function CheckItems(stack: Stack, context: CheckContext, schema: Schema.XItems, value: unknown[]): boolean;
|
|
6
|
+
export declare function ErrorItems(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XItems, value: unknown[]): boolean;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
2
|
import * as Schema from '../types/index.mjs';
|
|
3
|
-
import * as Unique from './_unique.mjs';
|
|
4
|
-
import { BuildSchemaPushStack, CheckSchemaPushStack, ErrorSchemaPushStack } from './schema.mjs';
|
|
5
3
|
import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
4
|
+
import { BuildSchemaPushStack, CheckSchemaPushStack, ErrorSchemaPushStack } from './schema.mjs';
|
|
6
5
|
// ------------------------------------------------------------------
|
|
7
6
|
// ItemsSized
|
|
8
7
|
// ------------------------------------------------------------------
|
|
@@ -45,16 +44,14 @@ function ErrorItemsSized(stack, context, schemaPath, instancePath, schema, value
|
|
|
45
44
|
// ------------------------------------------------------------------
|
|
46
45
|
function BuildItemsUnsizedStandard(stack, context, schema, value) {
|
|
47
46
|
const offset = Schema.IsPrefixItems(schema) ? schema.prefixItems.length : 0;
|
|
48
|
-
const
|
|
49
|
-
const isSchema = BuildSchemaPushStack(stack, context, schema.items, item);
|
|
47
|
+
const isSchema = BuildSchemaPushStack(stack, context, schema.items, 'element');
|
|
50
48
|
const addIndex = context.AddIndex('index');
|
|
51
|
-
return E.Every(value, E.Constant(offset), [
|
|
49
|
+
return E.Every(value, E.Constant(offset), ['element', 'index'], E.And(isSchema, addIndex));
|
|
52
50
|
}
|
|
53
51
|
function BuildItemsUnsizedFast(stack, context, schema, value) {
|
|
54
52
|
const offset = Schema.IsPrefixItems(schema) ? schema.prefixItems.length : 0;
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
return E.Every(value, E.Constant(offset), [item, 'index'], isSchema);
|
|
53
|
+
const isSchema = BuildSchemaPushStack(stack, context, schema.items, 'element');
|
|
54
|
+
return E.Every(value, E.Constant(offset), ['element', 'index'], isSchema);
|
|
58
55
|
}
|
|
59
56
|
function BuildItemsUnsized(stack, context, schema, value) {
|
|
60
57
|
return context.UseUnevaluated()
|
|
@@ -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 BuildMaxContains(stack: Stack
|
|
5
|
-
export declare function CheckMaxContains(stack: Stack
|
|
6
|
-
export declare function ErrorMaxContains(stack: Stack
|
|
4
|
+
export declare function BuildMaxContains(stack: Stack, context: BuildContext, schema: Schema.XMaxContains, value: string): string;
|
|
5
|
+
export declare function CheckMaxContains(stack: Stack, context: CheckContext, schema: Schema.XMaxContains, value: unknown[]): boolean;
|
|
6
|
+
export declare function ErrorMaxContains(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMaxContains, 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 { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
5
5
|
import { BuildSchema, CheckSchema } from './schema.mjs';
|
|
6
6
|
// ------------------------------------------------------------------
|
|
@@ -15,7 +15,7 @@ function IsValid(schema) {
|
|
|
15
15
|
export function BuildMaxContains(stack, context, schema, value) {
|
|
16
16
|
if (!IsValid(schema))
|
|
17
17
|
return E.Constant(true);
|
|
18
|
-
const [item] = [Unique
|
|
18
|
+
const [item] = [Unique()];
|
|
19
19
|
const count = E.Counted(value, [item, '_'], BuildSchema(stack, context, schema.contains, item));
|
|
20
20
|
return E.IsLessEqualThan(count, E.Constant(schema.maxContains));
|
|
21
21
|
}
|
|
@@ -33,6 +33,10 @@ export function CheckMaxContains(stack, context, schema, value) {
|
|
|
33
33
|
// ------------------------------------------------------------------
|
|
34
34
|
export function ErrorMaxContains(stack, context, schemaPath, instancePath, schema, value) {
|
|
35
35
|
const minContains = Schema.IsMinContains(schema) ? schema.minContains : 1;
|
|
36
|
-
return CheckMaxContains(stack, context, schema, value) ||
|
|
37
|
-
|
|
36
|
+
return CheckMaxContains(stack, context, schema, value) || context.AddError({
|
|
37
|
+
keyword: 'contains',
|
|
38
|
+
schemaPath,
|
|
39
|
+
instancePath,
|
|
40
|
+
params: { minContains, maxContains: schema.maxContains },
|
|
41
|
+
});
|
|
38
42
|
}
|
|
@@ -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 BuildMaxItems(_stack: Stack
|
|
5
|
-
export declare function CheckMaxItems(_stack: Stack
|
|
6
|
-
export declare function ErrorMaxItems(stack: Stack
|
|
4
|
+
export declare function BuildMaxItems(_stack: Stack, _context: BuildContext, schema: Schema.XMaxItems, value: string): string;
|
|
5
|
+
export declare function CheckMaxItems(_stack: Stack, _context: CheckContext, schema: Schema.XMaxItems, value: unknown[]): boolean;
|
|
6
|
+
export declare function ErrorMaxItems(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMaxItems, value: unknown[]): boolean;
|
|
@@ -16,6 +16,10 @@ export function CheckMaxItems(_stack, _context, schema, value) {
|
|
|
16
16
|
// Error
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
18
|
export function ErrorMaxItems(stack, context, schemaPath, instancePath, schema, value) {
|
|
19
|
-
return CheckMaxItems(stack, context, schema, value) ||
|
|
20
|
-
|
|
19
|
+
return CheckMaxItems(stack, context, schema, value) || context.AddError({
|
|
20
|
+
keyword: 'maxItems',
|
|
21
|
+
schemaPath,
|
|
22
|
+
instancePath,
|
|
23
|
+
params: { limit: schema.maxItems }
|
|
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 BuildMaxLength(_stack: Stack
|
|
5
|
-
export declare function CheckMaxLength(_stack: Stack
|
|
6
|
-
export declare function ErrorMaxLength(stack: Stack
|
|
4
|
+
export declare function BuildMaxLength(_stack: Stack, _context: BuildContext, schema: Schema.XMaxLength, value: string): string;
|
|
5
|
+
export declare function CheckMaxLength(_stack: Stack, _context: CheckContext, schema: Schema.XMaxLength, value: string): boolean;
|
|
6
|
+
export declare function ErrorMaxLength(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMaxLength, value: string): boolean;
|
|
@@ -16,6 +16,10 @@ export function CheckMaxLength(_stack, _context, schema, value) {
|
|
|
16
16
|
// Error
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
18
|
export function ErrorMaxLength(stack, context, schemaPath, instancePath, schema, value) {
|
|
19
|
-
return CheckMaxLength(stack, context, schema, value) ||
|
|
20
|
-
|
|
19
|
+
return CheckMaxLength(stack, context, schema, value) || context.AddError({
|
|
20
|
+
keyword: 'maxLength',
|
|
21
|
+
schemaPath,
|
|
22
|
+
instancePath,
|
|
23
|
+
params: { limit: schema.maxLength }
|
|
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 BuildMaxProperties(_stack: Stack
|
|
5
|
-
export declare function CheckMaxProperties(_stack: Stack
|
|
6
|
-
export declare function ErrorMaxProperties(stack: Stack
|
|
4
|
+
export declare function BuildMaxProperties(_stack: Stack, _context: BuildContext, schema: Schema.XMaxProperties, value: string): string;
|
|
5
|
+
export declare function CheckMaxProperties(_stack: Stack, _context: CheckContext, schema: Schema.XMaxProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
+
export declare function ErrorMaxProperties(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMaxProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
@@ -16,6 +16,10 @@ export function CheckMaxProperties(_stack, _context, schema, value) {
|
|
|
16
16
|
// Check
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
18
|
export function ErrorMaxProperties(stack, context, schemaPath, instancePath, schema, value) {
|
|
19
|
-
return CheckMaxProperties(stack, context, schema, value) ||
|
|
20
|
-
|
|
19
|
+
return CheckMaxProperties(stack, context, schema, value) || context.AddError({
|
|
20
|
+
keyword: 'maxProperties',
|
|
21
|
+
schemaPath,
|
|
22
|
+
instancePath,
|
|
23
|
+
params: { limit: schema.maxProperties },
|
|
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 BuildMaximum(_stack: Stack
|
|
5
|
-
export declare function CheckMaximum(_stack: Stack
|
|
6
|
-
export declare function ErrorMaximum(stack: Stack
|
|
4
|
+
export declare function BuildMaximum(_stack: Stack, _context: BuildContext, schema: Schema.XMaximum, value: string): string;
|
|
5
|
+
export declare function CheckMaximum(_stack: Stack, _context: CheckContext, schema: Schema.XMaximum, value: number | bigint): boolean;
|
|
6
|
+
export declare function ErrorMaximum(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMaximum, value: number | bigint): boolean;
|
|
@@ -16,6 +16,10 @@ export function CheckMaximum(_stack, _context, schema, value) {
|
|
|
16
16
|
// Error
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
18
|
export function ErrorMaximum(stack, context, schemaPath, instancePath, schema, value) {
|
|
19
|
-
return CheckMaximum(stack, context, schema, value) ||
|
|
20
|
-
|
|
19
|
+
return CheckMaximum(stack, context, schema, value) || context.AddError({
|
|
20
|
+
keyword: 'maximum',
|
|
21
|
+
schemaPath,
|
|
22
|
+
instancePath,
|
|
23
|
+
params: { comparison: '<=', limit: schema.maximum }
|
|
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 BuildMinContains(stack: Stack
|
|
5
|
-
export declare function CheckMinContains(stack: Stack
|
|
6
|
-
export declare function ErrorMinContains(stack: Stack
|
|
4
|
+
export declare function BuildMinContains(stack: Stack, context: BuildContext, schema: Schema.XMinContains, value: string): string;
|
|
5
|
+
export declare function CheckMinContains(stack: Stack, context: CheckContext, schema: Schema.XMinContains, value: unknown[]): boolean;
|
|
6
|
+
export declare function ErrorMinContains(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMinContains, 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 { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
5
5
|
import { BuildSchema, CheckSchema } from './schema.mjs';
|
|
6
6
|
// ------------------------------------------------------------------
|
|
@@ -13,12 +13,12 @@ function IsValid(schema) {
|
|
|
13
13
|
// Build
|
|
14
14
|
// ------------------------------------------------------------------
|
|
15
15
|
function BuildMinContainsStandard(stack, context, schema, value) {
|
|
16
|
-
const [item, index] = [Unique
|
|
16
|
+
const [item, index] = [Unique(), Unique()];
|
|
17
17
|
const count = E.Counted(value, [item, index], E.And(BuildSchema(stack, context, schema.contains, item), context.AddIndex(index)));
|
|
18
18
|
return E.IsGreaterEqualThan(count, E.Constant(schema.minContains));
|
|
19
19
|
}
|
|
20
20
|
function BuildMinContainsFast(stack, context, schema, value) {
|
|
21
|
-
const [item] = [Unique
|
|
21
|
+
const [item] = [Unique()];
|
|
22
22
|
const count = E.Counted(value, [item, '_'], BuildSchema(stack, context, schema.contains, item));
|
|
23
23
|
return E.IsGreaterEqualThan(count, E.Constant(schema.minContains));
|
|
24
24
|
}
|
|
@@ -42,6 +42,10 @@ export function CheckMinContains(stack, context, schema, value) {
|
|
|
42
42
|
// Error
|
|
43
43
|
// ------------------------------------------------------------------
|
|
44
44
|
export function ErrorMinContains(stack, context, schemaPath, instancePath, schema, value) {
|
|
45
|
-
return CheckMinContains(stack, context, schema, value) ||
|
|
46
|
-
|
|
45
|
+
return CheckMinContains(stack, context, schema, value) || context.AddError({
|
|
46
|
+
keyword: 'contains',
|
|
47
|
+
schemaPath,
|
|
48
|
+
instancePath,
|
|
49
|
+
params: { minContains: schema.minContains }
|
|
50
|
+
});
|
|
47
51
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as Stack from './_stack.mjs';
|
|
1
|
+
import { Stack } from './_stack.mjs';
|
|
3
2
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
3
|
+
import * as Schema from '../types/index.mjs';
|
|
4
|
+
export declare function BuildMinItems(_stack: Stack, _context: BuildContext, schema: Schema.XMinItems, value: string): string;
|
|
5
|
+
export declare function CheckMinItems(_stack: Stack, _context: CheckContext, schema: Schema.XMinItems, value: unknown[]): boolean;
|
|
6
|
+
export declare function ErrorMinItems(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMinItems, value: unknown[]): boolean;
|
|
@@ -16,6 +16,10 @@ export function CheckMinItems(_stack, _context, schema, value) {
|
|
|
16
16
|
// Error
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
18
|
export function ErrorMinItems(stack, context, schemaPath, instancePath, schema, value) {
|
|
19
|
-
return CheckMinItems(stack, context, schema, value) ||
|
|
20
|
-
|
|
19
|
+
return CheckMinItems(stack, context, schema, value) || context.AddError({
|
|
20
|
+
keyword: 'minItems',
|
|
21
|
+
schemaPath,
|
|
22
|
+
instancePath,
|
|
23
|
+
params: { limit: schema.minItems }
|
|
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 BuildMinLength(_stack: Stack
|
|
5
|
-
export declare function CheckMinLength(_stack: Stack
|
|
6
|
-
export declare function ErrorMinLength(stack: Stack
|
|
4
|
+
export declare function BuildMinLength(_stack: Stack, _context: BuildContext, schema: Schema.XMinLength, value: string): string;
|
|
5
|
+
export declare function CheckMinLength(_stack: Stack, _context: CheckContext, schema: Schema.XMinLength, value: string): boolean;
|
|
6
|
+
export declare function ErrorMinLength(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMinLength, value: string): boolean;
|
|
@@ -16,6 +16,10 @@ export function CheckMinLength(_stack, _context, schema, value) {
|
|
|
16
16
|
// Error
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
18
|
export function ErrorMinLength(stack, context, schemaPath, instancePath, schema, value) {
|
|
19
|
-
return CheckMinLength(stack, context, schema, value) ||
|
|
20
|
-
|
|
19
|
+
return CheckMinLength(stack, context, schema, value) || context.AddError({
|
|
20
|
+
keyword: 'minLength',
|
|
21
|
+
schemaPath,
|
|
22
|
+
instancePath,
|
|
23
|
+
params: { limit: schema.minLength }
|
|
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 BuildMinProperties(_stack: Stack
|
|
5
|
-
export declare function CheckMinProperties(_stack: Stack
|
|
6
|
-
export declare function ErrorMinProperties(stack: Stack
|
|
4
|
+
export declare function BuildMinProperties(_stack: Stack, _context: BuildContext, schema: Schema.XMinProperties, value: string): string;
|
|
5
|
+
export declare function CheckMinProperties(_stack: Stack, _context: CheckContext, schema: Schema.XMinProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
+
export declare function ErrorMinProperties(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMinProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
@@ -16,6 +16,10 @@ export function CheckMinProperties(_stack, _context, schema, value) {
|
|
|
16
16
|
// Error
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
18
|
export function ErrorMinProperties(stack, context, schemaPath, instancePath, schema, value) {
|
|
19
|
-
return CheckMinProperties(stack, context, schema, value) ||
|
|
20
|
-
|
|
19
|
+
return CheckMinProperties(stack, context, schema, value) || context.AddError({
|
|
20
|
+
keyword: 'minProperties',
|
|
21
|
+
schemaPath,
|
|
22
|
+
instancePath,
|
|
23
|
+
params: { limit: schema.minProperties },
|
|
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 BuildMinimum(_stack: Stack
|
|
5
|
-
export declare function CheckMinimum(_stack: Stack
|
|
6
|
-
export declare function ErrorMinimum(stack: Stack
|
|
4
|
+
export declare function BuildMinimum(_stack: Stack, _context: BuildContext, schema: Schema.XMinimum, value: string): string;
|
|
5
|
+
export declare function CheckMinimum(_stack: Stack, _context: CheckContext, schema: Schema.XMinimum, value: number | bigint): boolean;
|
|
6
|
+
export declare function ErrorMinimum(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMinimum, value: number | bigint): boolean;
|
|
@@ -16,6 +16,10 @@ export function CheckMinimum(_stack, _context, schema, value) {
|
|
|
16
16
|
// Error
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
18
|
export function ErrorMinimum(stack, context, schemaPath, instancePath, schema, value) {
|
|
19
|
-
return CheckMinimum(stack, context, schema, value) ||
|
|
20
|
-
|
|
19
|
+
return CheckMinimum(stack, context, schema, value) || context.AddError({
|
|
20
|
+
keyword: 'minimum',
|
|
21
|
+
schemaPath,
|
|
22
|
+
instancePath,
|
|
23
|
+
params: { comparison: '>=', limit: schema.minimum }
|
|
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 BuildMultipleOf(_stack: Stack
|
|
5
|
-
export declare function CheckMultipleOf(_stack: Stack
|
|
6
|
-
export declare function ErrorMultipleOf(stack: Stack
|
|
4
|
+
export declare function BuildMultipleOf(_stack: Stack, _context: BuildContext, schema: Schema.XMultipleOf, value: string): string;
|
|
5
|
+
export declare function CheckMultipleOf(_stack: Stack, _context: CheckContext, schema: Schema.XMultipleOf, value: number | bigint): boolean;
|
|
6
|
+
export declare function ErrorMultipleOf(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XMultipleOf, value: number | bigint): boolean;
|
|
@@ -16,6 +16,10 @@ export function CheckMultipleOf(_stack, _context, schema, value) {
|
|
|
16
16
|
// Error
|
|
17
17
|
// ------------------------------------------------------------------
|
|
18
18
|
export function ErrorMultipleOf(stack, context, schemaPath, instancePath, schema, value) {
|
|
19
|
-
return CheckMultipleOf(stack, context, schema, value) ||
|
|
20
|
-
|
|
19
|
+
return CheckMultipleOf(stack, context, schema, value) || context.AddError({
|
|
20
|
+
keyword: 'multipleOf',
|
|
21
|
+
schemaPath,
|
|
22
|
+
instancePath,
|
|
23
|
+
params: { multipleOf: schema.multipleOf }
|
|
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 BuildNot(stack: Stack
|
|
5
|
-
export declare function CheckNot(stack: Stack
|
|
6
|
-
export declare function ErrorNot(stack: Stack
|
|
4
|
+
export declare function BuildNot(stack: Stack, context: BuildContext, schema: Schema.XNot, value: string): string;
|
|
5
|
+
export declare function CheckNot(stack: Stack, context: CheckContext, schema: Schema.XNot, value: unknown): boolean;
|
|
6
|
+
export declare function ErrorNot(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XNot, value: unknown): boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import { Reducer } from './_reducer.mjs';
|
|
3
2
|
import { CheckContext } from './_context.mjs';
|
|
4
|
-
import {
|
|
3
|
+
import { Reducer } from './_reducer.mjs';
|
|
5
4
|
import { EmitGuard as E } from '../../guard/index.mjs';
|
|
5
|
+
import { BuildSchema, CheckSchema } from './schema.mjs';
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
7
|
// Build
|
|
8
8
|
// ------------------------------------------------------------------
|
|
@@ -30,6 +30,10 @@ export function CheckNot(stack, context, schema, value) {
|
|
|
30
30
|
// Error
|
|
31
31
|
// ------------------------------------------------------------------
|
|
32
32
|
export function ErrorNot(stack, context, schemaPath, instancePath, schema, value) {
|
|
33
|
-
return CheckNot(stack, context, schema, value) ||
|
|
34
|
-
|
|
33
|
+
return CheckNot(stack, context, schema, value) || context.AddError({
|
|
34
|
+
keyword: 'not',
|
|
35
|
+
schemaPath,
|
|
36
|
+
instancePath,
|
|
37
|
+
params: {},
|
|
38
|
+
});
|
|
35
39
|
}
|
|
@@ -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 BuildOneOf(stack: Stack
|
|
5
|
-
export declare function CheckOneOf(stack: Stack
|
|
6
|
-
export declare function ErrorOneOf(stack: Stack
|
|
4
|
+
export declare function BuildOneOf(stack: Stack, context: BuildContext, schema: Schema.XOneOf, value: string): string;
|
|
5
|
+
export declare function CheckOneOf(stack: Stack, context: CheckContext, schema: Schema.XOneOf, value: unknown): boolean;
|
|
6
|
+
export declare function ErrorOneOf(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XOneOf, value: unknown): boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import { Reducer } from './_reducer.mjs';
|
|
3
|
-
import * as Unique from './_unique.mjs';
|
|
4
2
|
import { CheckContext, ErrorContext } from './_context.mjs';
|
|
5
|
-
import {
|
|
3
|
+
import { Reducer } from './_reducer.mjs';
|
|
6
4
|
import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
|
|
5
|
+
import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
|
|
6
|
+
import { Unique } from './_unique.mjs';
|
|
7
7
|
// ------------------------------------------------------------------
|
|
8
8
|
// Build
|
|
9
9
|
// ------------------------------------------------------------------
|
|
@@ -11,7 +11,7 @@ function BuildOneOfStandard(stack, context, schema, value) {
|
|
|
11
11
|
return Reducer(stack, context, schema.oneOf, value, E.IsEqual(E.Member('results', 'length'), E.Constant(1)));
|
|
12
12
|
}
|
|
13
13
|
function BuildOneOfFast(stack, context, schema, value) {
|
|
14
|
-
const [result] = [Unique
|
|
14
|
+
const [result] = [Unique()];
|
|
15
15
|
const results = E.ArrayLiteral(schema.oneOf.map((schema) => BuildSchema(stack, context, schema, value)));
|
|
16
16
|
const count = E.Counted(results, [result, '_'], E.IsEqual(result, E.Constant(true)));
|
|
17
17
|
return E.IsEqual(count, E.Constant(1));
|
|
@@ -49,6 +49,11 @@ export function ErrorOneOf(stack, context, schemaPath, instancePath, schema, val
|
|
|
49
49
|
}, []);
|
|
50
50
|
const isOneOf = G.IsEqual(passedContexts.length, 1) && context.Merge(passedContexts);
|
|
51
51
|
if (!isOneOf && G.IsEqual(passingSchemas.length, 0))
|
|
52
|
-
failedContexts.forEach(failed =>
|
|
53
|
-
return isOneOf || context.AddError(
|
|
52
|
+
failedContexts.forEach(failed => failed.GetErrors().forEach(error => context.AddError(error)));
|
|
53
|
+
return isOneOf || context.AddError({
|
|
54
|
+
keyword: 'oneOf',
|
|
55
|
+
schemaPath,
|
|
56
|
+
instancePath,
|
|
57
|
+
params: { passingSchemas },
|
|
58
|
+
});
|
|
54
59
|
}
|
|
@@ -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 BuildPattern(_stack: Stack
|
|
5
|
-
export declare function CheckPattern(_stack: Stack
|
|
6
|
-
export declare function ErrorPattern(stack: Stack
|
|
4
|
+
export declare function BuildPattern(_stack: Stack, _context: BuildContext, schema: Schema.XPattern, value: string): string;
|
|
5
|
+
export declare function CheckPattern(_stack: Stack, _context: CheckContext, schema: Schema.XPattern, value: string): boolean;
|
|
6
|
+
export declare function ErrorPattern(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XPattern, value: string): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
2
|
import * as Externals from './_externals.mjs';
|
|
3
|
-
import { UnicodeRegExp } from './_regexp.mjs';
|
|
4
3
|
import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
4
|
+
import { UnicodeRegExp } from './_regexp.mjs';
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
6
|
// Build
|
|
7
7
|
// ------------------------------------------------------------------
|
|
@@ -20,6 +20,10 @@ export function CheckPattern(_stack, _context, schema, value) {
|
|
|
20
20
|
// Error
|
|
21
21
|
// ------------------------------------------------------------------
|
|
22
22
|
export function ErrorPattern(stack, context, schemaPath, instancePath, schema, value) {
|
|
23
|
-
return CheckPattern(stack, context, schema, value) ||
|
|
24
|
-
|
|
23
|
+
return CheckPattern(stack, context, schema, value) || context.AddError({
|
|
24
|
+
keyword: 'pattern',
|
|
25
|
+
schemaPath,
|
|
26
|
+
instancePath,
|
|
27
|
+
params: { pattern: schema.pattern }
|
|
28
|
+
});
|
|
25
29
|
}
|
|
@@ -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 BuildPatternProperties(stack: Stack
|
|
5
|
-
export declare function CheckPatternProperties(stack: Stack
|
|
6
|
-
export declare function ErrorPatternProperties(stack: Stack
|
|
4
|
+
export declare function BuildPatternProperties(stack: Stack, context: BuildContext, schema: Schema.XPatternProperties, value: string): string;
|
|
5
|
+
export declare function CheckPatternProperties(stack: Stack, context: CheckContext, schema: Schema.XPatternProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
+
export declare function ErrorPatternProperties(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XPatternProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import * as Unique from './_unique.mjs';
|
|
3
2
|
import * as Externals from './_externals.mjs';
|
|
4
|
-
import
|
|
3
|
+
import { Unique } from './_unique.mjs';
|
|
5
4
|
import { UnicodeRegExp } from './_regexp.mjs';
|
|
6
|
-
import { BuildSchemaPushStack, CheckSchemaPushStack, ErrorSchemaPushStack } from './schema.mjs';
|
|
7
5
|
import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
6
|
+
import { BuildSchemaPushStack, CheckSchemaPushStack, ErrorSchemaPushStack } from './schema.mjs';
|
|
8
7
|
// ------------------------------------------------------------------
|
|
9
8
|
// Build
|
|
10
9
|
// ------------------------------------------------------------------
|
|
11
10
|
export function BuildPatternProperties(stack, context, schema, value) {
|
|
12
11
|
return E.ReduceAnd(G.Entries(schema.patternProperties).map(([pattern, schema]) => {
|
|
13
|
-
const [key, prop] = [Unique
|
|
12
|
+
const [key, prop] = [Unique(), Unique()];
|
|
14
13
|
const regexp = Externals.CreateVariable(UnicodeRegExp(pattern));
|
|
15
14
|
const notKey = E.Not(E.Call(E.Member(regexp, 'test'), [key]));
|
|
16
15
|
const isSchema = BuildSchemaPushStack(stack, context, schema, prop);
|
|
@@ -35,10 +34,10 @@ export function CheckPatternProperties(stack, context, schema, value) {
|
|
|
35
34
|
// ------------------------------------------------------------------
|
|
36
35
|
export function ErrorPatternProperties(stack, context, schemaPath, instancePath, schema, value) {
|
|
37
36
|
return G.EveryAll(G.Entries(schema.patternProperties), 0, ([pattern, schema]) => {
|
|
38
|
-
const nextSchemaPath = `${schemaPath}/patternProperties/${
|
|
37
|
+
const nextSchemaPath = `${schemaPath}/patternProperties/${pattern}`;
|
|
39
38
|
const regexp = UnicodeRegExp(pattern);
|
|
40
39
|
return G.EveryAll(G.Entries(value), 0, ([key, value]) => {
|
|
41
|
-
const nextInstancePath = `${instancePath}/${
|
|
40
|
+
const nextInstancePath = `${instancePath}/${key}`;
|
|
42
41
|
const notKey = !regexp.test(key);
|
|
43
42
|
return notKey || ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema, value) && context.AddKey(key);
|
|
44
43
|
});
|
|
@@ -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 BuildPrefixItems(stack: Stack
|
|
5
|
-
export declare function CheckPrefixItems(stack: Stack
|
|
6
|
-
export declare function ErrorPrefixItems(stack: Stack
|
|
4
|
+
export declare function BuildPrefixItems(stack: Stack, context: BuildContext, schema: Schema.XPrefixItems, value: string): string;
|
|
5
|
+
export declare function CheckPrefixItems(stack: Stack, context: CheckContext, schema: Schema.XPrefixItems, value: unknown[]): boolean;
|
|
6
|
+
export declare function ErrorPrefixItems(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XPrefixItems, value: unknown[]): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
|
-
import { BuildSchemaPushStack, CheckSchemaPushStack, ErrorSchemaPushStack } from './schema.mjs';
|
|
3
2
|
import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
|
|
3
|
+
import { BuildSchemaPushStack, CheckSchemaPushStack, ErrorSchemaPushStack } from './schema.mjs';
|
|
4
4
|
// ------------------------------------------------------------------
|
|
5
5
|
// Build
|
|
6
6
|
// ------------------------------------------------------------------
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
import
|
|
2
|
+
import { Stack } from './_stack.mjs';
|
|
3
3
|
import { BuildContext, CheckContext, ErrorContext } from './_context.mjs';
|
|
4
|
-
export declare function BuildProperties(stack: Stack
|
|
5
|
-
export declare function CheckProperties(stack: Stack
|
|
6
|
-
export declare function ErrorProperties(stack: Stack
|
|
4
|
+
export declare function BuildProperties(stack: Stack, context: BuildContext, schema: Schema.XProperties, value: string): string;
|
|
5
|
+
export declare function CheckProperties(stack: Stack, context: CheckContext, schema: Schema.XProperties, value: Record<PropertyKey, unknown>): boolean;
|
|
6
|
+
export declare function ErrorProperties(stack: Stack, context: ErrorContext, schemaPath: string, instancePath: string, schema: Schema.XProperties, value: Record<PropertyKey, unknown>): boolean;
|