@depup/typebox 1.3.27-depup.0 → 1.3.34-depup.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/build/compile/code.mjs +1 -2
- package/build/compile/validator.mjs +5 -1
- package/build/format/iri.mjs +16 -9
- package/build/guard/emit.mjs +2 -2
- package/build/guard/guard.d.mts +7 -5
- package/build/guard/guard.mjs +14 -9
- package/build/guard/index.mjs +6 -0
- package/build/guard/unicode/unicode.d.mts +6 -0
- package/build/guard/unicode/unicode.mjs +35 -0
- package/build/guard/{string.mjs → unicode/unicode_segment.mjs} +16 -19
- package/build/schema/build.mjs +4 -5
- package/build/schema/check.mjs +1 -1
- package/build/schema/engine/_context.d.mts +5 -1
- package/build/schema/engine/_context.mjs +16 -3
- package/build/schema/engine/_functions.d.mts +2 -2
- package/build/schema/engine/_functions.mjs +1 -1
- package/build/schema/engine/_pathing.d.mts +1 -0
- package/build/schema/engine/_pathing.mjs +11 -0
- package/build/schema/engine/_reducer.d.mts +3 -3
- package/build/schema/engine/_refine.d.mts +5 -5
- package/build/schema/engine/_refine.mjs +14 -9
- package/build/schema/engine/_stack.d.mts +34 -20
- package/build/schema/engine/_stack.mjs +143 -202
- package/build/schema/engine/additionalItems.d.mts +4 -4
- package/build/schema/engine/additionalProperties.d.mts +8 -8
- package/build/schema/engine/additionalProperties.mjs +12 -15
- package/build/schema/engine/allOf.d.mts +4 -4
- package/build/schema/engine/allOf.mjs +1 -1
- package/build/schema/engine/anyOf.d.mts +4 -4
- package/build/schema/engine/anyOf.mjs +4 -9
- package/build/schema/engine/boolean.d.mts +4 -4
- package/build/schema/engine/boolean.mjs +2 -6
- package/build/schema/engine/const.d.mts +4 -4
- package/build/schema/engine/const.mjs +2 -6
- package/build/schema/engine/contains.d.mts +4 -4
- package/build/schema/engine/contains.mjs +2 -6
- package/build/schema/engine/dependencies.d.mts +4 -4
- package/build/schema/engine/dependencies.mjs +5 -7
- package/build/schema/engine/dependentRequired.d.mts +4 -4
- package/build/schema/engine/dependentRequired.mjs +2 -6
- package/build/schema/engine/dependentSchemas.d.mts +4 -4
- package/build/schema/engine/dependentSchemas.mjs +2 -1
- package/build/schema/engine/dynamicRef.d.mts +4 -4
- package/build/schema/engine/dynamicRef.mjs +12 -8
- package/build/schema/engine/enum.d.mts +4 -4
- package/build/schema/engine/enum.mjs +2 -6
- package/build/schema/engine/exclusiveMaximum.d.mts +4 -4
- package/build/schema/engine/exclusiveMaximum.mjs +2 -6
- package/build/schema/engine/exclusiveMinimum.d.mts +4 -4
- package/build/schema/engine/exclusiveMinimum.mjs +2 -6
- package/build/schema/engine/format.d.mts +4 -4
- package/build/schema/engine/format.mjs +11 -8
- package/build/schema/engine/if.d.mts +4 -4
- package/build/schema/engine/if.mjs +5 -13
- package/build/schema/engine/items.d.mts +4 -4
- package/build/schema/engine/items.mjs +1 -1
- package/build/schema/engine/maxContains.d.mts +4 -4
- package/build/schema/engine/maxContains.mjs +2 -6
- package/build/schema/engine/maxItems.d.mts +4 -4
- package/build/schema/engine/maxItems.mjs +2 -6
- package/build/schema/engine/maxLength.d.mts +4 -4
- package/build/schema/engine/maxLength.mjs +2 -6
- package/build/schema/engine/maxProperties.d.mts +4 -4
- package/build/schema/engine/maxProperties.mjs +2 -6
- package/build/schema/engine/maximum.d.mts +4 -4
- package/build/schema/engine/maximum.mjs +2 -6
- package/build/schema/engine/minContains.d.mts +4 -4
- package/build/schema/engine/minContains.mjs +2 -6
- package/build/schema/engine/minItems.d.mts +5 -5
- package/build/schema/engine/minItems.mjs +2 -6
- package/build/schema/engine/minLength.d.mts +4 -4
- package/build/schema/engine/minLength.mjs +2 -6
- package/build/schema/engine/minProperties.d.mts +4 -4
- package/build/schema/engine/minProperties.mjs +2 -6
- package/build/schema/engine/minimum.d.mts +4 -4
- package/build/schema/engine/minimum.mjs +2 -6
- package/build/schema/engine/multipleOf.d.mts +4 -4
- package/build/schema/engine/multipleOf.mjs +2 -6
- package/build/schema/engine/not.d.mts +4 -4
- package/build/schema/engine/not.mjs +4 -8
- package/build/schema/engine/oneOf.d.mts +4 -4
- package/build/schema/engine/oneOf.mjs +5 -10
- package/build/schema/engine/pattern.d.mts +4 -4
- package/build/schema/engine/pattern.mjs +3 -7
- package/build/schema/engine/patternProperties.d.mts +4 -4
- package/build/schema/engine/patternProperties.mjs +4 -3
- package/build/schema/engine/prefixItems.d.mts +4 -4
- package/build/schema/engine/prefixItems.mjs +1 -1
- package/build/schema/engine/properties.d.mts +4 -4
- package/build/schema/engine/properties.mjs +4 -3
- package/build/schema/engine/propertyNames.d.mts +4 -4
- package/build/schema/engine/propertyNames.mjs +5 -8
- package/build/schema/engine/recursiveRef.d.mts +4 -4
- package/build/schema/engine/recursiveRef.mjs +12 -8
- package/build/schema/engine/ref.d.mts +4 -4
- package/build/schema/engine/ref.mjs +18 -14
- package/build/schema/engine/required.d.mts +4 -4
- package/build/schema/engine/required.mjs +2 -6
- package/build/schema/engine/schema.d.mts +7 -7
- package/build/schema/engine/schema.mjs +136 -138
- package/build/schema/engine/type.d.mts +4 -4
- package/build/schema/engine/type.mjs +2 -6
- package/build/schema/engine/unevaluatedItems.d.mts +4 -4
- package/build/schema/engine/unevaluatedItems.mjs +3 -7
- package/build/schema/engine/unevaluatedProperties.d.mts +4 -4
- package/build/schema/engine/unevaluatedProperties.mjs +3 -7
- package/build/schema/engine/uniqueItems.d.mts +4 -4
- package/build/schema/engine/uniqueItems.mjs +2 -6
- package/build/schema/errors.mjs +1 -1
- package/build/schema/intern/intern.d.mts +6 -9
- package/build/schema/intern/intern.mjs +90 -56
- package/build/schema/meta/draft_2019_09.d.mts +2 -0
- package/build/schema/meta/draft_2019_09.mjs +288 -0
- package/build/schema/meta/draft_2020_12.d.mts +2 -0
- package/build/schema/meta/draft_2020_12.mjs +300 -0
- package/build/schema/meta/draft_3.d.mts +2 -0
- package/build/schema/meta/draft_3.mjs +143 -0
- package/build/schema/meta/draft_4.d.mts +2 -0
- package/build/schema/meta/draft_4.mjs +149 -0
- package/build/schema/meta/draft_6.d.mts +2 -0
- package/build/schema/meta/draft_6.mjs +155 -0
- package/build/schema/meta/draft_7.d.mts +2 -0
- package/build/schema/meta/draft_7.mjs +172 -0
- package/build/schema/meta/index.d.mts +2 -0
- package/build/schema/meta/index.mjs +2 -0
- package/build/schema/meta/meta.d.mts +9 -0
- package/build/schema/meta/meta.mjs +15 -0
- package/build/schema/meta/schema.d.mts +6 -0
- package/build/schema/meta/schema.mjs +1 -0
- package/build/schema/parse.mjs +3 -0
- package/build/schema/pointer/pointer.d.mts +1 -6
- package/build/schema/pointer/pointer.mjs +47 -64
- package/build/schema/resolve/resolve.d.mts +6 -32
- package/build/schema/resolve/resolve.mjs +231 -227
- package/build/schema/schema.d.mts +1 -0
- package/build/schema/schema.mjs +1 -0
- package/build/system/settings/internal.d.mts +2 -0
- package/build/system/settings/internal.mjs +20 -0
- package/build/system/settings/settings.d.mts +11 -0
- package/build/system/settings/settings.mjs +14 -0
- package/build/type/extends/inference.d.mts +1 -1
- package/build/type/extends/inference.mjs +15 -2
- package/build/type/extends/tuple.d.mts +2 -1
- package/build/type/extends/tuple.mjs +21 -1
- package/build/value/parse/parse.mjs +10 -4
- package/changes.json +1 -1
- package/package.json +3 -3
- package/readme.md +52 -84
- /package/build/guard/{string.d.mts → unicode/unicode_segment.d.mts} +0 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
export const Draft_6 = {
|
|
2
|
+
'$schema': 'http://json-schema.org/draft-06/schema#',
|
|
3
|
+
'$id': 'http://json-schema.org/draft-06/schema#',
|
|
4
|
+
'title': 'Core schema meta-schema',
|
|
5
|
+
'definitions': {
|
|
6
|
+
'schemaArray': {
|
|
7
|
+
'type': 'array',
|
|
8
|
+
'minItems': 1,
|
|
9
|
+
'items': { '$ref': '#' }
|
|
10
|
+
},
|
|
11
|
+
'nonNegativeInteger': {
|
|
12
|
+
'type': 'integer',
|
|
13
|
+
'minimum': 0
|
|
14
|
+
},
|
|
15
|
+
'nonNegativeIntegerDefault0': {
|
|
16
|
+
'allOf': [
|
|
17
|
+
{ '$ref': '#/definitions/nonNegativeInteger' },
|
|
18
|
+
{ 'default': 0 }
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
'simpleTypes': {
|
|
22
|
+
'enum': [
|
|
23
|
+
'array',
|
|
24
|
+
'boolean',
|
|
25
|
+
'integer',
|
|
26
|
+
'null',
|
|
27
|
+
'number',
|
|
28
|
+
'object',
|
|
29
|
+
'string'
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
'stringArray': {
|
|
33
|
+
'type': 'array',
|
|
34
|
+
'items': { 'type': 'string' },
|
|
35
|
+
'uniqueItems': true,
|
|
36
|
+
'default': []
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
'type': ['object', 'boolean'],
|
|
40
|
+
'properties': {
|
|
41
|
+
'$id': {
|
|
42
|
+
'type': 'string',
|
|
43
|
+
'format': 'uri-reference'
|
|
44
|
+
},
|
|
45
|
+
'$schema': {
|
|
46
|
+
'type': 'string',
|
|
47
|
+
'format': 'uri'
|
|
48
|
+
},
|
|
49
|
+
'$ref': {
|
|
50
|
+
'type': 'string',
|
|
51
|
+
'format': 'uri-reference'
|
|
52
|
+
},
|
|
53
|
+
'title': {
|
|
54
|
+
'type': 'string'
|
|
55
|
+
},
|
|
56
|
+
'description': {
|
|
57
|
+
'type': 'string'
|
|
58
|
+
},
|
|
59
|
+
'default': {},
|
|
60
|
+
'examples': {
|
|
61
|
+
'type': 'array',
|
|
62
|
+
'items': {}
|
|
63
|
+
},
|
|
64
|
+
'multipleOf': {
|
|
65
|
+
'type': 'number',
|
|
66
|
+
'exclusiveMinimum': 0
|
|
67
|
+
},
|
|
68
|
+
'maximum': {
|
|
69
|
+
'type': 'number'
|
|
70
|
+
},
|
|
71
|
+
'exclusiveMaximum': {
|
|
72
|
+
'type': 'number'
|
|
73
|
+
},
|
|
74
|
+
'minimum': {
|
|
75
|
+
'type': 'number'
|
|
76
|
+
},
|
|
77
|
+
'exclusiveMinimum': {
|
|
78
|
+
'type': 'number'
|
|
79
|
+
},
|
|
80
|
+
'maxLength': { '$ref': '#/definitions/nonNegativeInteger' },
|
|
81
|
+
'minLength': { '$ref': '#/definitions/nonNegativeIntegerDefault0' },
|
|
82
|
+
'pattern': {
|
|
83
|
+
'type': 'string',
|
|
84
|
+
'format': 'regex'
|
|
85
|
+
},
|
|
86
|
+
'additionalItems': { '$ref': '#' },
|
|
87
|
+
'items': {
|
|
88
|
+
'anyOf': [
|
|
89
|
+
{ '$ref': '#' },
|
|
90
|
+
{ '$ref': '#/definitions/schemaArray' }
|
|
91
|
+
],
|
|
92
|
+
'default': {}
|
|
93
|
+
},
|
|
94
|
+
'maxItems': { '$ref': '#/definitions/nonNegativeInteger' },
|
|
95
|
+
'minItems': { '$ref': '#/definitions/nonNegativeIntegerDefault0' },
|
|
96
|
+
'uniqueItems': {
|
|
97
|
+
'type': 'boolean',
|
|
98
|
+
'default': false
|
|
99
|
+
},
|
|
100
|
+
'contains': { '$ref': '#' },
|
|
101
|
+
'maxProperties': { '$ref': '#/definitions/nonNegativeInteger' },
|
|
102
|
+
'minProperties': { '$ref': '#/definitions/nonNegativeIntegerDefault0' },
|
|
103
|
+
'required': { '$ref': '#/definitions/stringArray' },
|
|
104
|
+
'additionalProperties': { '$ref': '#' },
|
|
105
|
+
'definitions': {
|
|
106
|
+
'type': 'object',
|
|
107
|
+
'additionalProperties': { '$ref': '#' },
|
|
108
|
+
'default': {}
|
|
109
|
+
},
|
|
110
|
+
'properties': {
|
|
111
|
+
'type': 'object',
|
|
112
|
+
'additionalProperties': { '$ref': '#' },
|
|
113
|
+
'default': {}
|
|
114
|
+
},
|
|
115
|
+
'patternProperties': {
|
|
116
|
+
'type': 'object',
|
|
117
|
+
'additionalProperties': { '$ref': '#' },
|
|
118
|
+
'propertyNames': { 'format': 'regex' },
|
|
119
|
+
'default': {}
|
|
120
|
+
},
|
|
121
|
+
'dependencies': {
|
|
122
|
+
'type': 'object',
|
|
123
|
+
'additionalProperties': {
|
|
124
|
+
'anyOf': [
|
|
125
|
+
{ '$ref': '#' },
|
|
126
|
+
{ '$ref': '#/definitions/stringArray' }
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
'propertyNames': { '$ref': '#' },
|
|
131
|
+
'const': {},
|
|
132
|
+
'enum': {
|
|
133
|
+
'type': 'array',
|
|
134
|
+
'minItems': 1,
|
|
135
|
+
'uniqueItems': true
|
|
136
|
+
},
|
|
137
|
+
'type': {
|
|
138
|
+
'anyOf': [
|
|
139
|
+
{ '$ref': '#/definitions/simpleTypes' },
|
|
140
|
+
{
|
|
141
|
+
'type': 'array',
|
|
142
|
+
'items': { '$ref': '#/definitions/simpleTypes' },
|
|
143
|
+
'minItems': 1,
|
|
144
|
+
'uniqueItems': true
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
},
|
|
148
|
+
'format': { 'type': 'string' },
|
|
149
|
+
'allOf': { '$ref': '#/definitions/schemaArray' },
|
|
150
|
+
'anyOf': { '$ref': '#/definitions/schemaArray' },
|
|
151
|
+
'oneOf': { '$ref': '#/definitions/schemaArray' },
|
|
152
|
+
'not': { '$ref': '#' }
|
|
153
|
+
},
|
|
154
|
+
'default': {}
|
|
155
|
+
};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
export const Draft_7 = {
|
|
2
|
+
'$schema': 'http://json-schema.org/draft-07/schema#',
|
|
3
|
+
'$id': 'http://json-schema.org/draft-07/schema#',
|
|
4
|
+
'title': 'Core schema meta-schema',
|
|
5
|
+
'definitions': {
|
|
6
|
+
'schemaArray': {
|
|
7
|
+
'type': 'array',
|
|
8
|
+
'minItems': 1,
|
|
9
|
+
'items': { '$ref': '#' }
|
|
10
|
+
},
|
|
11
|
+
'nonNegativeInteger': {
|
|
12
|
+
'type': 'integer',
|
|
13
|
+
'minimum': 0
|
|
14
|
+
},
|
|
15
|
+
'nonNegativeIntegerDefault0': {
|
|
16
|
+
'allOf': [
|
|
17
|
+
{ '$ref': '#/definitions/nonNegativeInteger' },
|
|
18
|
+
{ 'default': 0 }
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
'simpleTypes': {
|
|
22
|
+
'enum': [
|
|
23
|
+
'array',
|
|
24
|
+
'boolean',
|
|
25
|
+
'integer',
|
|
26
|
+
'null',
|
|
27
|
+
'number',
|
|
28
|
+
'object',
|
|
29
|
+
'string'
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
'stringArray': {
|
|
33
|
+
'type': 'array',
|
|
34
|
+
'items': { 'type': 'string' },
|
|
35
|
+
'uniqueItems': true,
|
|
36
|
+
'default': []
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
'type': ['object', 'boolean'],
|
|
40
|
+
'properties': {
|
|
41
|
+
'$id': {
|
|
42
|
+
'type': 'string',
|
|
43
|
+
'format': 'uri-reference'
|
|
44
|
+
},
|
|
45
|
+
'$schema': {
|
|
46
|
+
'type': 'string',
|
|
47
|
+
'format': 'uri'
|
|
48
|
+
},
|
|
49
|
+
'$ref': {
|
|
50
|
+
'type': 'string',
|
|
51
|
+
'format': 'uri-reference'
|
|
52
|
+
},
|
|
53
|
+
'$comment': {
|
|
54
|
+
'type': 'string'
|
|
55
|
+
},
|
|
56
|
+
'title': {
|
|
57
|
+
'type': 'string'
|
|
58
|
+
},
|
|
59
|
+
'description': {
|
|
60
|
+
'type': 'string'
|
|
61
|
+
},
|
|
62
|
+
'default': true,
|
|
63
|
+
'readOnly': {
|
|
64
|
+
'type': 'boolean',
|
|
65
|
+
'default': false
|
|
66
|
+
},
|
|
67
|
+
'writeOnly': {
|
|
68
|
+
'type': 'boolean',
|
|
69
|
+
'default': false
|
|
70
|
+
},
|
|
71
|
+
'examples': {
|
|
72
|
+
'type': 'array',
|
|
73
|
+
'items': true
|
|
74
|
+
},
|
|
75
|
+
'multipleOf': {
|
|
76
|
+
'type': 'number',
|
|
77
|
+
'exclusiveMinimum': 0
|
|
78
|
+
},
|
|
79
|
+
'maximum': {
|
|
80
|
+
'type': 'number'
|
|
81
|
+
},
|
|
82
|
+
'exclusiveMaximum': {
|
|
83
|
+
'type': 'number'
|
|
84
|
+
},
|
|
85
|
+
'minimum': {
|
|
86
|
+
'type': 'number'
|
|
87
|
+
},
|
|
88
|
+
'exclusiveMinimum': {
|
|
89
|
+
'type': 'number'
|
|
90
|
+
},
|
|
91
|
+
'maxLength': { '$ref': '#/definitions/nonNegativeInteger' },
|
|
92
|
+
'minLength': { '$ref': '#/definitions/nonNegativeIntegerDefault0' },
|
|
93
|
+
'pattern': {
|
|
94
|
+
'type': 'string',
|
|
95
|
+
'format': 'regex'
|
|
96
|
+
},
|
|
97
|
+
'additionalItems': { '$ref': '#' },
|
|
98
|
+
'items': {
|
|
99
|
+
'anyOf': [
|
|
100
|
+
{ '$ref': '#' },
|
|
101
|
+
{ '$ref': '#/definitions/schemaArray' }
|
|
102
|
+
],
|
|
103
|
+
'default': true
|
|
104
|
+
},
|
|
105
|
+
'maxItems': { '$ref': '#/definitions/nonNegativeInteger' },
|
|
106
|
+
'minItems': { '$ref': '#/definitions/nonNegativeIntegerDefault0' },
|
|
107
|
+
'uniqueItems': {
|
|
108
|
+
'type': 'boolean',
|
|
109
|
+
'default': false
|
|
110
|
+
},
|
|
111
|
+
'contains': { '$ref': '#' },
|
|
112
|
+
'maxProperties': { '$ref': '#/definitions/nonNegativeInteger' },
|
|
113
|
+
'minProperties': { '$ref': '#/definitions/nonNegativeIntegerDefault0' },
|
|
114
|
+
'required': { '$ref': '#/definitions/stringArray' },
|
|
115
|
+
'additionalProperties': { '$ref': '#' },
|
|
116
|
+
'definitions': {
|
|
117
|
+
'type': 'object',
|
|
118
|
+
'additionalProperties': { '$ref': '#' },
|
|
119
|
+
'default': {}
|
|
120
|
+
},
|
|
121
|
+
'properties': {
|
|
122
|
+
'type': 'object',
|
|
123
|
+
'additionalProperties': { '$ref': '#' },
|
|
124
|
+
'default': {}
|
|
125
|
+
},
|
|
126
|
+
'patternProperties': {
|
|
127
|
+
'type': 'object',
|
|
128
|
+
'additionalProperties': { '$ref': '#' },
|
|
129
|
+
'propertyNames': { 'format': 'regex' },
|
|
130
|
+
'default': {}
|
|
131
|
+
},
|
|
132
|
+
'dependencies': {
|
|
133
|
+
'type': 'object',
|
|
134
|
+
'additionalProperties': {
|
|
135
|
+
'anyOf': [
|
|
136
|
+
{ '$ref': '#' },
|
|
137
|
+
{ '$ref': '#/definitions/stringArray' }
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
'propertyNames': { '$ref': '#' },
|
|
142
|
+
'const': true,
|
|
143
|
+
'enum': {
|
|
144
|
+
'type': 'array',
|
|
145
|
+
'items': true,
|
|
146
|
+
'minItems': 1,
|
|
147
|
+
'uniqueItems': true
|
|
148
|
+
},
|
|
149
|
+
'type': {
|
|
150
|
+
'anyOf': [
|
|
151
|
+
{ '$ref': '#/definitions/simpleTypes' },
|
|
152
|
+
{
|
|
153
|
+
'type': 'array',
|
|
154
|
+
'items': { '$ref': '#/definitions/simpleTypes' },
|
|
155
|
+
'minItems': 1,
|
|
156
|
+
'uniqueItems': true
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
},
|
|
160
|
+
'format': { 'type': 'string' },
|
|
161
|
+
'contentMediaType': { 'type': 'string' },
|
|
162
|
+
'contentEncoding': { 'type': 'string' },
|
|
163
|
+
'if': { '$ref': '#' },
|
|
164
|
+
'then': { '$ref': '#' },
|
|
165
|
+
'else': { '$ref': '#' },
|
|
166
|
+
'allOf': { '$ref': '#/definitions/schemaArray' },
|
|
167
|
+
'anyOf': { '$ref': '#/definitions/schemaArray' },
|
|
168
|
+
'oneOf': { '$ref': '#/definitions/schemaArray' },
|
|
169
|
+
'not': { '$ref': '#' }
|
|
170
|
+
},
|
|
171
|
+
'default': true
|
|
172
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** A collection of all meta schemas. */
|
|
2
|
+
export declare const Meta: {
|
|
3
|
+
'http://json-schema.org/draft-03/schema#': import("./schema.mjs").XMetaSchemaObject;
|
|
4
|
+
'http://json-schema.org/draft-04/schema#': import("./schema.mjs").XMetaSchemaObject;
|
|
5
|
+
'http://json-schema.org/draft-06/schema#': import("./schema.mjs").XMetaSchemaObject;
|
|
6
|
+
'http://json-schema.org/draft-07/schema#': import("./schema.mjs").XMetaSchemaObject;
|
|
7
|
+
'https://json-schema.org/draft/2019-09/schema': import("./schema.mjs").XMetaSchemaObject;
|
|
8
|
+
'https://json-schema.org/draft/2020-12/schema': import("./schema.mjs").XMetaSchemaObject;
|
|
9
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Draft_2020_12 } from './draft_2020_12.mjs';
|
|
2
|
+
import { Draft_2019_09 } from './draft_2019_09.mjs';
|
|
3
|
+
import { Draft_7 } from './draft_7.mjs';
|
|
4
|
+
import { Draft_6 } from './draft_6.mjs';
|
|
5
|
+
import { Draft_4 } from './draft_4.mjs';
|
|
6
|
+
import { Draft_3 } from './draft_3.mjs';
|
|
7
|
+
/** A collection of all meta schemas. */
|
|
8
|
+
export const Meta = {
|
|
9
|
+
'http://json-schema.org/draft-03/schema#': Draft_3,
|
|
10
|
+
'http://json-schema.org/draft-04/schema#': Draft_4,
|
|
11
|
+
'http://json-schema.org/draft-06/schema#': Draft_6,
|
|
12
|
+
'http://json-schema.org/draft-07/schema#': Draft_7,
|
|
13
|
+
'https://json-schema.org/draft/2019-09/schema': Draft_2019_09,
|
|
14
|
+
'https://json-schema.org/draft/2020-12/schema': Draft_2020_12
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/build/schema/parse.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
2
|
// deno-lint-ignore-file
|
|
3
|
+
import { EnableParseErrors, DisableParseErrors } from '../system/settings/internal.mjs';
|
|
3
4
|
import { Arguments } from '../system/arguments/index.mjs';
|
|
4
5
|
import { Check } from './check.mjs';
|
|
5
6
|
import { Errors } from './errors.mjs';
|
|
@@ -17,7 +18,9 @@ export class ParseError {
|
|
|
17
18
|
// ThrowParseError
|
|
18
19
|
// ------------------------------------------------------------------
|
|
19
20
|
export function ThrowParseError(context, schema, value) {
|
|
21
|
+
EnableParseErrors();
|
|
20
22
|
const result = Errors(context, schema, value);
|
|
23
|
+
DisableParseErrors();
|
|
21
24
|
throw new ParseError(schema, value, result[1]);
|
|
22
25
|
}
|
|
23
26
|
/** Parses a value against the provided schema */
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
/** Returns an array of path indices for the given pointer */
|
|
2
1
|
export declare function Indices(pointer: string): string[];
|
|
3
|
-
|
|
4
|
-
export declare function Has(value: unknown, pointer: string): unknown;
|
|
5
|
-
/** Gets a value at the pointer, or undefined if not exists */
|
|
2
|
+
export declare function Has(value: unknown, pointer: string): boolean;
|
|
6
3
|
export declare function Get(value: unknown, pointer: string): unknown;
|
|
7
|
-
/** Sets a value at the given pointer. May throw if the target value is not indexable */
|
|
8
4
|
export declare function Set(value: unknown, pointer: string, next: unknown): unknown;
|
|
9
|
-
/** Deletes the value at the given pointer. May throw if the target value is not indexable */
|
|
10
5
|
export declare function Delete(value: unknown, pointer: string): unknown;
|
|
@@ -1,106 +1,89 @@
|
|
|
1
1
|
// deno-fmt-ignore-file
|
|
2
2
|
import { Guard } from '../../guard/index.mjs';
|
|
3
3
|
// ------------------------------------------------------------------
|
|
4
|
-
//
|
|
4
|
+
// Throw
|
|
5
5
|
// ------------------------------------------------------------------
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
throw Error('Cannot set root');
|
|
6
|
+
function Throw(message) {
|
|
7
|
+
throw Error(message);
|
|
9
8
|
}
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
throw Error('Cannot set value');
|
|
9
|
+
function ThrowUnsafePropertyKey() {
|
|
10
|
+
Throw('Pointer contains unsafe property key');
|
|
13
11
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
throw Error('Pointer contains unsafe property key');
|
|
17
|
-
}
|
|
18
|
-
function AssertIndices(indices) {
|
|
19
|
-
for (const index of indices)
|
|
20
|
-
AssertIndex(index);
|
|
21
|
-
}
|
|
22
|
-
// ------------------------------------------------------------------
|
|
23
|
-
// Indices
|
|
24
|
-
// ------------------------------------------------------------------
|
|
25
|
-
function IsNumericIndex(index) {
|
|
26
|
-
return /^(0|[1-9]\d*)$/.test(index);
|
|
27
|
-
}
|
|
28
|
-
function TakeIndexRight(indices) {
|
|
29
|
-
return [
|
|
30
|
-
indices.slice(0, indices.length - 1),
|
|
31
|
-
indices.slice(indices.length - 1)[0]
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
|
-
function HasIndex(index, value) {
|
|
35
|
-
return Guard.IsObject(value) && Guard.HasPropertyKey(value, index);
|
|
36
|
-
}
|
|
37
|
-
function GetIndex(index, value) {
|
|
38
|
-
return Guard.IsObject(value) && !Guard.IsUnsafePropertyKey(index) ? value[index] : undefined;
|
|
39
|
-
}
|
|
40
|
-
function GetIndices(indices, value) {
|
|
41
|
-
return indices.reduce((value, index) => GetIndex(index, value), value);
|
|
12
|
+
function ThrowCannotSetRoot() {
|
|
13
|
+
Throw('Cannot set value');
|
|
42
14
|
}
|
|
43
15
|
// ------------------------------------------------------------------
|
|
44
16
|
// Indices
|
|
45
17
|
// ------------------------------------------------------------------
|
|
46
|
-
/** Returns an array of path indices for the given pointer */
|
|
47
18
|
export function Indices(pointer) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const indices = pointer.split("/").map(index => index.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
51
|
-
return (indices.length > 0 && indices[0] === '') ? indices.slice(1) : indices;
|
|
19
|
+
const indices = pointer.split('/').map(index => index.replace(/~1/g, '/').replace(/~0/g, '~'));
|
|
20
|
+
return indices[0] === '' ? indices.slice(1) : indices;
|
|
52
21
|
}
|
|
53
22
|
// ------------------------------------------------------------------
|
|
54
23
|
// Has
|
|
55
24
|
// ------------------------------------------------------------------
|
|
56
|
-
/** Returns true if a value exists at the current pointer */
|
|
57
25
|
export function Has(value, pointer) {
|
|
58
26
|
let current = value;
|
|
59
|
-
|
|
60
|
-
if (!
|
|
27
|
+
for (const index of Indices(pointer)) {
|
|
28
|
+
if (!Guard.IsObject(current) || !Guard.HasPropertyKey(current, index))
|
|
61
29
|
return false;
|
|
62
30
|
current = current[index];
|
|
63
|
-
|
|
64
|
-
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
65
33
|
}
|
|
66
34
|
// ------------------------------------------------------------------
|
|
67
35
|
// Get
|
|
68
36
|
// ------------------------------------------------------------------
|
|
69
|
-
/** Gets a value at the pointer, or undefined if not exists */
|
|
70
37
|
export function Get(value, pointer) {
|
|
71
|
-
|
|
72
|
-
|
|
38
|
+
let current = value;
|
|
39
|
+
for (const index of Indices(pointer)) {
|
|
40
|
+
if (!Guard.IsObject(current) || Guard.IsUnsafePropertyKey(index))
|
|
41
|
+
return undefined;
|
|
42
|
+
current = current[index];
|
|
43
|
+
}
|
|
44
|
+
return current;
|
|
45
|
+
}
|
|
46
|
+
// ------------------------------------------------------------------
|
|
47
|
+
// Get
|
|
48
|
+
// ------------------------------------------------------------------
|
|
49
|
+
function Parent(value, indices, last) {
|
|
50
|
+
let current = value;
|
|
51
|
+
for (const index of indices) {
|
|
52
|
+
if (Guard.IsUnsafePropertyKey(index))
|
|
53
|
+
ThrowUnsafePropertyKey();
|
|
54
|
+
current = Guard.IsObject(current) ? current[index] : undefined;
|
|
55
|
+
}
|
|
56
|
+
if (Guard.IsUnsafePropertyKey(last))
|
|
57
|
+
ThrowUnsafePropertyKey();
|
|
58
|
+
if (!Guard.IsObject(current))
|
|
59
|
+
ThrowCannotSetRoot();
|
|
60
|
+
return current;
|
|
73
61
|
}
|
|
74
62
|
// ------------------------------------------------------------------
|
|
75
63
|
// Set
|
|
76
64
|
// ------------------------------------------------------------------
|
|
77
|
-
/** Sets a value at the given pointer. May throw if the target value is not indexable */
|
|
78
65
|
export function Set(value, pointer, next) {
|
|
79
66
|
const indices = Indices(pointer);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
AssertCanSet(parent);
|
|
85
|
-
parent[index] = next;
|
|
67
|
+
const last = indices.pop();
|
|
68
|
+
if (Guard.IsUndefined(last))
|
|
69
|
+
ThrowCannotSetRoot();
|
|
70
|
+
Parent(value, indices, last)[last] = next;
|
|
86
71
|
return value;
|
|
87
72
|
}
|
|
88
73
|
// ------------------------------------------------------------------
|
|
89
74
|
// Delete
|
|
90
75
|
// ------------------------------------------------------------------
|
|
91
|
-
/** Deletes the value at the given pointer. May throw if the target value is not indexable */
|
|
92
76
|
export function Delete(value, pointer) {
|
|
93
77
|
const indices = Indices(pointer);
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const parent =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
parent.splice(+index, 1);
|
|
78
|
+
const last = indices.pop();
|
|
79
|
+
if (Guard.IsUndefined(last))
|
|
80
|
+
ThrowCannotSetRoot();
|
|
81
|
+
const parent = Parent(value, indices, last);
|
|
82
|
+
if (Guard.IsArray(parent) && /^(0|[1-9]\d*)$/.test(last)) {
|
|
83
|
+
parent.splice(Number(last), 1);
|
|
101
84
|
}
|
|
102
85
|
else {
|
|
103
|
-
delete parent[
|
|
86
|
+
delete parent[last];
|
|
104
87
|
}
|
|
105
88
|
return value;
|
|
106
89
|
}
|
|
@@ -1,35 +1,9 @@
|
|
|
1
1
|
import * as Schema from '../types/index.mjs';
|
|
2
|
-
|
|
3
|
-
export interface
|
|
4
|
-
context: Record<string, Schema.XSchema>;
|
|
5
|
-
root: Schema.XSchemaObject;
|
|
6
|
-
lexicalSchema: Schema.XSchemaObject;
|
|
7
|
-
lexicalBase: string;
|
|
8
|
-
referenceBase: string;
|
|
9
|
-
resourceBase: string;
|
|
10
|
-
ids: Schema.XId[];
|
|
11
|
-
recursiveAnchors: Schema.XRecursiveAnchor[];
|
|
12
|
-
dynamicAnchors: Schema.XDynamicAnchor[];
|
|
13
|
-
inRetrievedFrame: boolean;
|
|
14
|
-
}
|
|
15
|
-
export interface RetrievedResource {
|
|
16
|
-
target: Schema.XSchemaObject;
|
|
17
|
-
base: string;
|
|
18
|
-
root: Schema.XSchemaObject;
|
|
19
|
-
}
|
|
20
|
-
export interface ResolvedResource {
|
|
21
|
-
target: Schema.XSchemaObject;
|
|
22
|
-
resource: Schema.XId;
|
|
23
|
-
}
|
|
24
|
-
export interface RefResult {
|
|
2
|
+
import * as Stack from '../engine/_stack.mjs';
|
|
3
|
+
export interface XRefResult {
|
|
25
4
|
schema: Schema.XSchema | undefined;
|
|
26
|
-
|
|
27
|
-
resolvedResource?: ResolvedResource;
|
|
5
|
+
stack: Stack.XStack;
|
|
28
6
|
}
|
|
29
|
-
export declare function
|
|
30
|
-
export declare function
|
|
31
|
-
export declare function
|
|
32
|
-
export declare function DynamicRef(context: Record<string, Schema.XSchema>, root: Schema.XSchemaObject, base: string, schema: Schema.XSchemaObject, dynamicRef: Schema.XDynamicRef, dynamicAnchors: Schema.XDynamicAnchor[]): Schema.XSchema | undefined;
|
|
33
|
-
export declare function ResolveRef(stackframe: StackFrame, ref: Schema.XRef): RefResult;
|
|
34
|
-
export declare function ResolveRecursiveRef(stackframe: StackFrame, recursiveRef: Schema.XRecursiveRef): Schema.XSchema | undefined;
|
|
35
|
-
export declare function ResolveDynamicRef(stackframe: StackFrame, dynamicRef: Schema.XDynamicRef): Schema.XSchema | undefined;
|
|
7
|
+
export declare function Ref(stack: Stack.XStack, ref: Schema.XRef): XRefResult;
|
|
8
|
+
export declare function RecursiveRef(stack: Stack.XStack, recursiveRef: Schema.XRecursiveRef): Schema.XSchema | undefined;
|
|
9
|
+
export declare function DynamicRef(stack: Stack.XStack, dynamicRef: Schema.XDynamicRef): Schema.XSchema | undefined;
|