@altopelago/aeos-core 0.9.0 → 0.9.2
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/LICENSE +21 -0
- package/dist/diag/codes.d.ts +4 -0
- package/dist/diag/codes.d.ts.map +1 -1
- package/dist/diag/codes.js +4 -0
- package/dist/diag/codes.js.map +1 -1
- package/dist/rules/numericForm.d.ts +1 -0
- package/dist/rules/numericForm.d.ts.map +1 -1
- package/dist/rules/numericForm.js +106 -18
- package/dist/rules/numericForm.js.map +1 -1
- package/dist/rules/presence.d.ts.map +1 -1
- package/dist/rules/presence.js +2 -0
- package/dist/rules/presence.js.map +1 -1
- package/dist/rules/referenceForm.d.ts.map +1 -1
- package/dist/rules/referenceForm.js +5 -1
- package/dist/rules/referenceForm.js.map +1 -1
- package/dist/rules/schemaIndex.d.ts.map +1 -1
- package/dist/rules/schemaIndex.js +234 -12
- package/dist/rules/schemaIndex.js.map +1 -1
- package/dist/rules/stringForm.d.ts +3 -2
- package/dist/rules/stringForm.d.ts.map +1 -1
- package/dist/rules/stringForm.js +35 -24
- package/dist/rules/stringForm.js.map +1 -1
- package/dist/rules/typeCheck.d.ts.map +1 -1
- package/dist/rules/typeCheck.js +22 -2
- package/dist/rules/typeCheck.js.map +1 -1
- package/dist/types/schema.d.ts +43 -4
- package/dist/types/schema.d.ts.map +1 -1
- package/dist/types/schema.js +11 -0
- package/dist/types/schema.js.map +1 -1
- package/dist/validate.d.ts +3 -0
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +710 -39
- package/dist/validate.js.map +1 -1
- package/package.json +28 -3
package/dist/types/schema.d.ts
CHANGED
|
@@ -13,11 +13,25 @@ export interface ConstraintsV1 {
|
|
|
13
13
|
readonly required?: boolean;
|
|
14
14
|
/** Expected literal kind (StringLiteral, IntegerLiteral, etc.) */
|
|
15
15
|
readonly type?: string;
|
|
16
|
+
/** Accept when any listed constraint branch matches */
|
|
17
|
+
readonly any_of?: readonly ConstraintsV1[];
|
|
18
|
+
/** Allow NullLiteral to satisfy this type constraint */
|
|
19
|
+
readonly nullable?: boolean;
|
|
20
|
+
/** Allow InfinityLiteral to satisfy numeric type constraints */
|
|
21
|
+
readonly allow_infinity?: boolean;
|
|
22
|
+
/** Allow NaNLiteral to satisfy numeric type constraints */
|
|
23
|
+
readonly allow_nan?: boolean;
|
|
24
|
+
/** Required null sentinel value when the accepted value is NullLiteral */
|
|
25
|
+
readonly null_value?: string;
|
|
26
|
+
/** Accepted null sentinel values when the accepted value is NullLiteral */
|
|
27
|
+
readonly null_values?: readonly string[];
|
|
28
|
+
/** Required toggle lexical pair */
|
|
29
|
+
readonly toggle_pair?: 'any' | 'yes_no' | 'on_off';
|
|
16
30
|
/** Reference form policy for the path */
|
|
17
31
|
readonly reference?: 'allow' | 'forbid' | 'require';
|
|
18
32
|
/** Required reference kind when reference='require' */
|
|
19
33
|
readonly reference_kind?: 'clone' | 'pointer' | 'either';
|
|
20
|
-
/**
|
|
34
|
+
/** AEOS portable pattern matched against the canonicalized reference target path */
|
|
21
35
|
readonly reference_target_pattern?: string;
|
|
22
36
|
/** Resolve reference chains before applying form/type constraints on this path */
|
|
23
37
|
readonly resolve_reference_form?: boolean;
|
|
@@ -25,12 +39,20 @@ export interface ConstraintsV1 {
|
|
|
25
39
|
readonly type_is?: 'list' | 'tuple';
|
|
26
40
|
/** Core v1 exact container arity constraint */
|
|
27
41
|
readonly length_exact?: number;
|
|
42
|
+
/** Core v1 minimum immediate child count constraint */
|
|
43
|
+
readonly min_children?: number;
|
|
44
|
+
/** Core v1 maximum immediate child count constraint */
|
|
45
|
+
readonly max_children?: number;
|
|
28
46
|
/** For integers: 'signed' or 'unsigned' syntax */
|
|
29
47
|
readonly sign?: 'signed' | 'unsigned';
|
|
30
48
|
/** Minimum ASCII digit count (excludes sign) */
|
|
31
49
|
readonly min_digits?: number;
|
|
32
50
|
/** Maximum ASCII digit count (excludes sign) */
|
|
33
51
|
readonly max_digits?: number;
|
|
52
|
+
/** Exact radix/base required for RadixLiteral digit forms */
|
|
53
|
+
readonly radix?: number;
|
|
54
|
+
/** Allow RadixLiteral values without a matching radix datatype declaration */
|
|
55
|
+
readonly allow_unspecified_radix?: boolean;
|
|
34
56
|
/** Minimum integer value (inclusive), encoded as base-10 string for exactness */
|
|
35
57
|
readonly min_value?: string;
|
|
36
58
|
/** Maximum integer value (inclusive), encoded as base-10 string for exactness */
|
|
@@ -39,7 +61,7 @@ export interface ConstraintsV1 {
|
|
|
39
61
|
readonly min_length?: number;
|
|
40
62
|
/** Maximum string length in UTF-16 code units (JavaScript string.length) */
|
|
41
63
|
readonly max_length?: number;
|
|
42
|
-
/**
|
|
64
|
+
/** AEOS portable pattern for string matching */
|
|
43
65
|
readonly pattern?: string;
|
|
44
66
|
/** Datatype label (presence check only, no capacity) */
|
|
45
67
|
readonly datatype?: string;
|
|
@@ -49,11 +71,13 @@ export interface ConstraintsV1 {
|
|
|
49
71
|
readonly closed_attributes?: boolean;
|
|
50
72
|
}
|
|
51
73
|
/**
|
|
52
|
-
* Schema rule for a canonical path
|
|
74
|
+
* Schema rule for a canonical path or selector
|
|
53
75
|
*/
|
|
54
76
|
export interface SchemaRule {
|
|
55
77
|
/** Canonical path this rule applies to */
|
|
56
|
-
readonly path
|
|
78
|
+
readonly path?: string;
|
|
79
|
+
/** Canonical path selector this rule applies to */
|
|
80
|
+
readonly selector?: string;
|
|
57
81
|
/** Constraints to apply */
|
|
58
82
|
readonly constraints: ConstraintsV1;
|
|
59
83
|
}
|
|
@@ -67,8 +91,23 @@ export interface SchemaV1 {
|
|
|
67
91
|
readonly world?: 'open' | 'closed';
|
|
68
92
|
/** Optional schema-wide reference policy */
|
|
69
93
|
readonly reference_policy?: 'allow' | 'forbid';
|
|
94
|
+
/** Optional schema-wide attribute policy */
|
|
95
|
+
readonly attribute_policy?: 'inherit_world' | 'forbid';
|
|
70
96
|
/** Optional datatype-wide constraints keyed by datatype base label */
|
|
71
97
|
readonly datatype_rules?: Readonly<Record<string, ConstraintsV1>>;
|
|
98
|
+
/** Optional consumer-controlled validation resource limits */
|
|
99
|
+
readonly resource_policy?: ResourcePolicyV1;
|
|
100
|
+
}
|
|
101
|
+
export interface ResourcePolicyV1 {
|
|
102
|
+
readonly max_events?: number;
|
|
103
|
+
readonly max_rules?: number;
|
|
104
|
+
readonly max_any_of_cases?: number;
|
|
105
|
+
readonly max_schema_depth?: number;
|
|
106
|
+
readonly max_path_length?: number;
|
|
107
|
+
readonly max_reference_resolution_steps?: number;
|
|
108
|
+
readonly max_selector_expansions?: number;
|
|
109
|
+
readonly max_string_length_default?: number;
|
|
110
|
+
readonly max_container_children_default?: number;
|
|
72
111
|
}
|
|
73
112
|
/**
|
|
74
113
|
* Known constraint keys for validation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/types/schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,aAAa;CAAG;AAEhE,MAAM,WAAW,aAAa;IAC1B,6BAA6B;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAE5B,kEAAkE;IAClE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB,yCAAyC;IACzC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;IAEpD,uDAAuD;IACvD,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC;IAEzD,
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/types/schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,aAAa;CAAG;AAEhE,MAAM,WAAW,aAAa;IAC1B,6BAA6B;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CA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|
+
'nullable',
|
|
14
|
+
'allow_infinity',
|
|
15
|
+
'allow_nan',
|
|
16
|
+
'null_value',
|
|
17
|
+
'null_values',
|
|
18
|
+
'toggle_pair',
|
|
12
19
|
'reference',
|
|
13
20
|
'reference_kind',
|
|
14
21
|
'reference_target_pattern',
|
|
15
22
|
'resolve_reference_form',
|
|
16
23
|
'type_is',
|
|
17
24
|
'length_exact',
|
|
25
|
+
'min_children',
|
|
26
|
+
'max_children',
|
|
18
27
|
'sign',
|
|
19
28
|
'min_digits',
|
|
20
29
|
'max_digits',
|
|
30
|
+
'radix',
|
|
31
|
+
'allow_unspecified_radix',
|
|
21
32
|
'min_value',
|
|
22
33
|
'max_value',
|
|
23
34
|
'min_length',
|
package/dist/types/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/types/schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/types/schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoJH;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAwB,IAAI,GAAG,CAAC;IAC9D,UAAU;IACV,MAAM;IACN,QAAQ;IACR,UAAU;IACV,gBAAgB;IAChB,WAAW;IACX,YAAY;IACZ,aAAa;IACb,aAAa;IACb,WAAW;IACX,gBAAgB;IAChB,0BAA0B;IAC1B,wBAAwB;IACxB,SAAS;IACT,cAAc;IACd,cAAc;IACd,cAAc;IACd,MAAM;IACN,YAAY;IACZ,YAAY;IACZ,OAAO;IACP,yBAAyB;IACzB,WAAW;IACX,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,SAAS;IACT,UAAU;IACV,YAAY;IACZ,mBAAmB;CACtB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,WAAoC;IACzE,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;QACzC,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC;QAChB,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
package/dist/validate.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import type { AES } from './types/aes.js';
|
|
7
7
|
import type { SchemaV1 } from './types/schema.js';
|
|
8
8
|
import type { ResultEnvelope } from './types/envelope.js';
|
|
9
|
+
import type { ResourcePolicyV1 } from './types/schema.js';
|
|
9
10
|
/**
|
|
10
11
|
* Validation options
|
|
11
12
|
*/
|
|
@@ -21,6 +22,8 @@ export interface ValidateOptions {
|
|
|
21
22
|
* - error: emit error
|
|
22
23
|
*/
|
|
23
24
|
readonly trailingSeparatorDelimiterPolicy?: 'off' | 'warn' | 'error';
|
|
25
|
+
/** Optional consumer-controlled validation resource limits. */
|
|
26
|
+
readonly resourcePolicy?: ResourcePolicyV1;
|
|
24
27
|
}
|
|
25
28
|
/**
|
|
26
29
|
* Validate an AES against a schema.
|
package/dist/validate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,EAAc,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAW1D,OAAO,KAAK,EAAiB,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAkDzE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B;;OAEG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;OAKG;IACH,QAAQ,CAAC,gCAAgC,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;IAErE,+DAA+D;IAC/D,QAAQ,CAAC,cAAc,CAAC,EAAE,gBAAgB,CAAC;CAE9C;AAgJD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,QAAQ,CACpB,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,QAAQ,EAChB,OAAO,GAAE,eAAoB,GAC9B,cAAc,CAuWhB"}
|