@maxclicks/utilities 1.13.0 → 1.15.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/dist/helpers/haveSameContents.d.ts.map +1 -1
- package/dist/helpers/haveSameContents.js +4 -2
- package/dist/helpers/haveSameContents.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/modules/primitives/definitions/Address.js +1 -1
- package/dist/modules/primitives/definitions/Address.js.map +1 -1
- package/dist/types/Json/Json.d.ts +5 -63
- package/dist/types/Json/Json.d.ts.map +1 -1
- package/dist/types/Json/Json.js +2 -12
- package/dist/types/Json/Json.js.map +1 -1
- package/dist/types/Json/JsonSchema/JsonSchema.d.ts +103 -0
- package/dist/types/Json/JsonSchema/JsonSchema.d.ts.map +1 -0
- package/dist/types/Json/JsonSchema/JsonSchema.js +95 -0
- package/dist/types/Json/JsonSchema/JsonSchema.js.map +1 -0
- package/dist/types/Json/JsonSchema/index.d.ts +2 -0
- package/dist/types/Json/JsonSchema/index.d.ts.map +1 -0
- package/dist/types/Json/JsonSchema/index.js +2 -0
- package/dist/types/Json/JsonSchema/index.js.map +1 -0
- package/dist/types/Json/JsonSchema/isJsonSchemaNullable.d.ts +5 -0
- package/dist/types/Json/JsonSchema/isJsonSchemaNullable.d.ts.map +1 -0
- package/dist/types/Json/JsonSchema/isJsonSchemaNullable.js +15 -0
- package/dist/types/Json/JsonSchema/isJsonSchemaNullable.js.map +1 -0
- package/dist/types/Json/JsonSchema/isJsonSchemaWiderThan.d.ts +28 -0
- package/dist/types/Json/JsonSchema/isJsonSchemaWiderThan.d.ts.map +1 -0
- package/dist/types/Json/JsonSchema/isJsonSchemaWiderThan.js +322 -0
- package/dist/types/Json/JsonSchema/isJsonSchemaWiderThan.js.map +1 -0
- package/dist/types/Json/JsonSchema/jsonSchemaNormalizer.d.ts +5 -0
- package/dist/types/Json/JsonSchema/jsonSchemaNormalizer.d.ts.map +1 -0
- package/dist/types/Json/JsonSchema/jsonSchemaNormalizer.js +136 -0
- package/dist/types/Json/JsonSchema/jsonSchemaNormalizer.js.map +1 -0
- package/dist/types/Json/JsonSchema/jsonSchemaNullable.d.ts +5 -0
- package/dist/types/Json/JsonSchema/jsonSchemaNullable.d.ts.map +1 -0
- package/dist/types/Json/JsonSchema/jsonSchemaNullable.js +31 -0
- package/dist/types/Json/JsonSchema/jsonSchemaNullable.js.map +1 -0
- package/dist/types/Json/jsonNormalizer.d.ts +1 -0
- package/dist/types/Json/jsonNormalizer.d.ts.map +1 -1
- package/dist/types/Json/jsonNormalizer.js.map +1 -1
- package/dist/types/Json/jsonNormalizerWithSchemaFactory.d.ts +3 -1
- package/dist/types/Json/jsonNormalizerWithSchemaFactory.d.ts.map +1 -1
- package/dist/types/Json/jsonNormalizerWithSchemaFactory.js +184 -149
- package/dist/types/Json/jsonNormalizerWithSchemaFactory.js.map +1 -1
- package/dist/types/Normalizer.d.ts +2 -2
- package/dist/types/Normalizer.d.ts.map +1 -1
- package/dist/types/Normalizer.js +9 -3
- package/dist/types/Normalizer.js.map +1 -1
- package/package.json +1 -1
- package/dist/helpers/optional.d.ts +0 -13
- package/dist/helpers/optional.d.ts.map +0 -1
- package/dist/helpers/optional.js +0 -17
- package/dist/helpers/optional.js.map +0 -1
- package/dist/types/Json/jsonSchemaNormalizer.d.ts +0 -3
- package/dist/types/Json/jsonSchemaNormalizer.d.ts.map +0 -1
- package/dist/types/Json/jsonSchemaNormalizer.js +0 -181
- package/dist/types/Json/jsonSchemaNormalizer.js.map +0 -1
- package/dist/types/Json/jsonSchemaNullable.d.ts +0 -3
- package/dist/types/Json/jsonSchemaNullable.d.ts.map +0 -1
- package/dist/types/Json/jsonSchemaNullable.js +0 -32
- package/dist/types/Json/jsonSchemaNullable.js.map +0 -1
- package/dist/types/Json/jsonSchemaSatisfies.d.ts +0 -12
- package/dist/types/Json/jsonSchemaSatisfies.d.ts.map +0 -1
- package/dist/types/Json/jsonSchemaSatisfies.js +0 -290
- package/dist/types/Json/jsonSchemaSatisfies.js.map +0 -1
- package/dist/types/Json/jsonSchemaSimplifiedSatisfies.d.ts +0 -4
- package/dist/types/Json/jsonSchemaSimplifiedSatisfies.d.ts.map +0 -1
- package/dist/types/Json/jsonSchemaSimplifiedSatisfies.js +0 -222
- package/dist/types/Json/jsonSchemaSimplifiedSatisfies.js.map +0 -1
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { objectHelpers } from '../../helpers/native/objectHelpers';
|
|
2
|
-
import { jsonNormalizer } from './jsonNormalizer';
|
|
3
|
-
export const jsonSchemaNormalizer = jsonNormalizer.chain((value, warn) => {
|
|
4
|
-
if (value === null)
|
|
5
|
-
return null;
|
|
6
|
-
if (typeof value !== 'object' || Array.isArray(value))
|
|
7
|
-
throw new Error('Schema must be an object.');
|
|
8
|
-
const schema = value;
|
|
9
|
-
// Extract and validate annotations
|
|
10
|
-
const { $comment, title, description, default: defaultValue, examples, ...rest } = schema;
|
|
11
|
-
if ($comment !== undefined && typeof $comment !== 'string')
|
|
12
|
-
throw new Error('"$comment" must be a string.');
|
|
13
|
-
if (title !== undefined && typeof title !== 'string')
|
|
14
|
-
throw new Error('"title" must be a string.');
|
|
15
|
-
if (description !== undefined && typeof description !== 'string')
|
|
16
|
-
throw new Error('"description" must be a string.');
|
|
17
|
-
if (examples !== undefined && !Array.isArray(examples))
|
|
18
|
-
throw new Error('"examples" must be an array.');
|
|
19
|
-
// Check for const validation
|
|
20
|
-
if ('const' in rest) {
|
|
21
|
-
const { const: constValue, ...afterConst } = rest;
|
|
22
|
-
const unsupportedKeys = objectHelpers.keys(afterConst);
|
|
23
|
-
if (unsupportedKeys.length > 0)
|
|
24
|
-
throw new Error(`When "const" is declared, these properties are not supported: ${unsupportedKeys.map(k => `"${k}"`).join(', ')}.`);
|
|
25
|
-
return value;
|
|
26
|
-
}
|
|
27
|
-
// Check for enum validation
|
|
28
|
-
if ('enum' in rest) {
|
|
29
|
-
const { enum: enumValue, ...afterEnum } = rest;
|
|
30
|
-
if (!Array.isArray(enumValue))
|
|
31
|
-
throw new Error('"enum" must be an array.');
|
|
32
|
-
if (enumValue.length === 0)
|
|
33
|
-
throw new Error('"enum" must have at least one value.');
|
|
34
|
-
const unsupportedKeys = objectHelpers.keys(afterEnum);
|
|
35
|
-
if (unsupportedKeys.length > 0)
|
|
36
|
-
throw new Error(`When "enum" is declared, these properties are not supported: ${unsupportedKeys.map(k => `"${k}"`).join(', ')}.`);
|
|
37
|
-
return value;
|
|
38
|
-
}
|
|
39
|
-
const { type, ...afterType } = rest;
|
|
40
|
-
// Any validation (no type or type: 'any')
|
|
41
|
-
if (type === undefined || type === 'any') {
|
|
42
|
-
const unsupportedKeys = objectHelpers.keys(afterType);
|
|
43
|
-
if (unsupportedKeys.length > 0)
|
|
44
|
-
throw new Error(`When ${type === undefined ? 'no type is specified' : 'type is "any"'}, these properties are not supported: ${unsupportedKeys.map(k => `"${k}"`).join(', ')}.`);
|
|
45
|
-
return value;
|
|
46
|
-
}
|
|
47
|
-
// Parse type (handle nullable types like ['string', 'null'])
|
|
48
|
-
const typeArray = Array.isArray(type) ? type : null;
|
|
49
|
-
const nullable = typeArray !== null && typeArray.includes('null');
|
|
50
|
-
const typeValues = typeArray ? typeArray.filter(t => t !== 'null') : [type];
|
|
51
|
-
if (typeValues.length !== 1)
|
|
52
|
-
throw new Error('Type must be a single type or a tuple of [type, "null"] for nullable types.');
|
|
53
|
-
const typeValue = typeValues[0];
|
|
54
|
-
if (typeof typeValue !== 'string')
|
|
55
|
-
throw new Error('"type" must be a string or an array of strings.');
|
|
56
|
-
// Null validation
|
|
57
|
-
if (typeValue === 'null') {
|
|
58
|
-
const unsupportedKeys = objectHelpers.keys(afterType);
|
|
59
|
-
if (unsupportedKeys.length > 0)
|
|
60
|
-
throw new Error(`When type is "null", these properties are not supported: ${unsupportedKeys.map(k => `"${k}"`).join(', ')}.`);
|
|
61
|
-
return value;
|
|
62
|
-
}
|
|
63
|
-
// String validation
|
|
64
|
-
if (typeValue === 'string') {
|
|
65
|
-
const { minLength, maxLength, format, ...remaining } = afterType;
|
|
66
|
-
const unsupportedKeys = objectHelpers.keys(remaining);
|
|
67
|
-
if (unsupportedKeys.length > 0)
|
|
68
|
-
throw new Error(`When type is "string", these properties are not supported: ${unsupportedKeys.map(k => `"${k}"`).join(', ')}.`);
|
|
69
|
-
if (minLength !== undefined) {
|
|
70
|
-
if (typeof minLength !== 'number')
|
|
71
|
-
throw new Error('"minLength" must be a number.');
|
|
72
|
-
if (minLength < 0)
|
|
73
|
-
throw new Error('"minLength" cannot be negative.');
|
|
74
|
-
if (minLength % 1 !== 0)
|
|
75
|
-
throw new Error('"minLength" must be an integer.');
|
|
76
|
-
}
|
|
77
|
-
if (maxLength !== undefined) {
|
|
78
|
-
if (typeof maxLength !== 'number')
|
|
79
|
-
throw new Error('"maxLength" must be a number.');
|
|
80
|
-
if (maxLength < 0)
|
|
81
|
-
throw new Error('"maxLength" cannot be negative.');
|
|
82
|
-
if (maxLength % 1 !== 0)
|
|
83
|
-
throw new Error('"maxLength" must be an integer.');
|
|
84
|
-
if (minLength !== undefined && maxLength < minLength)
|
|
85
|
-
throw new Error('"maxLength" cannot be less than "minLength".');
|
|
86
|
-
}
|
|
87
|
-
if (format !== undefined && typeof format !== 'string')
|
|
88
|
-
throw new Error('"format" must be a string.');
|
|
89
|
-
return value;
|
|
90
|
-
}
|
|
91
|
-
// Number/Integer validation
|
|
92
|
-
if (typeValue === 'number' || typeValue === 'integer') {
|
|
93
|
-
const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, ...remaining } = afterType;
|
|
94
|
-
const unsupportedKeys = objectHelpers.keys(remaining);
|
|
95
|
-
if (unsupportedKeys.length > 0)
|
|
96
|
-
throw new Error(`When type is "${typeValue}", these properties are not supported: ${unsupportedKeys.map(k => `"${k}"`).join(', ')}.`);
|
|
97
|
-
if (minimum !== undefined && typeof minimum !== 'number')
|
|
98
|
-
throw new Error('"minimum" must be a number.');
|
|
99
|
-
if (maximum !== undefined && typeof maximum !== 'number')
|
|
100
|
-
throw new Error('"maximum" must be a number.');
|
|
101
|
-
if (minimum !== undefined && maximum !== undefined && maximum < minimum)
|
|
102
|
-
throw new Error('"maximum" cannot be less than "minimum".');
|
|
103
|
-
if (exclusiveMinimum !== undefined && typeof exclusiveMinimum !== 'number')
|
|
104
|
-
throw new Error('"exclusiveMinimum" must be a number.');
|
|
105
|
-
if (exclusiveMaximum !== undefined && typeof exclusiveMaximum !== 'number')
|
|
106
|
-
throw new Error('"exclusiveMaximum" must be a number.');
|
|
107
|
-
if (exclusiveMinimum !== undefined &&
|
|
108
|
-
exclusiveMaximum !== undefined &&
|
|
109
|
-
exclusiveMaximum <= exclusiveMinimum)
|
|
110
|
-
throw new Error('"exclusiveMaximum" must be greater than "exclusiveMinimum".');
|
|
111
|
-
if (multipleOf !== undefined) {
|
|
112
|
-
if (typeof multipleOf !== 'number')
|
|
113
|
-
throw new Error('"multipleOf" must be a number.');
|
|
114
|
-
if (multipleOf <= 0)
|
|
115
|
-
throw new Error('"multipleOf" must be positive.');
|
|
116
|
-
}
|
|
117
|
-
return value;
|
|
118
|
-
}
|
|
119
|
-
// Boolean validation
|
|
120
|
-
if (typeValue === 'boolean') {
|
|
121
|
-
const unsupportedKeys = objectHelpers.keys(afterType);
|
|
122
|
-
if (unsupportedKeys.length > 0)
|
|
123
|
-
throw new Error(`When type is "boolean", these properties are not supported: ${unsupportedKeys.map(k => `"${k}"`).join(', ')}.`);
|
|
124
|
-
return value;
|
|
125
|
-
}
|
|
126
|
-
// Array validation
|
|
127
|
-
if (typeValue === 'array') {
|
|
128
|
-
const { items, minItems, maxItems, ...remaining } = afterType;
|
|
129
|
-
const unsupportedKeys = objectHelpers.keys(remaining);
|
|
130
|
-
if (unsupportedKeys.length > 0)
|
|
131
|
-
throw new Error(`When type is "array", these properties are not supported: ${unsupportedKeys.map(k => `"${k}"`).join(', ')}.`);
|
|
132
|
-
jsonSchemaNormalizer.required.normalizeIfExists(items).getValue('items', warn);
|
|
133
|
-
if (minItems !== undefined) {
|
|
134
|
-
if (typeof minItems !== 'number')
|
|
135
|
-
throw new Error('"minItems" must be a number.');
|
|
136
|
-
if (minItems < 0)
|
|
137
|
-
throw new Error('"minItems" cannot be negative.');
|
|
138
|
-
if (minItems % 1 !== 0)
|
|
139
|
-
throw new Error('"minItems" must be an integer.');
|
|
140
|
-
}
|
|
141
|
-
if (maxItems !== undefined) {
|
|
142
|
-
if (typeof maxItems !== 'number')
|
|
143
|
-
throw new Error('"maxItems" must be a number.');
|
|
144
|
-
if (maxItems < 0)
|
|
145
|
-
throw new Error('"maxItems" cannot be negative.');
|
|
146
|
-
if (maxItems % 1 !== 0)
|
|
147
|
-
throw new Error('"maxItems" must be an integer.');
|
|
148
|
-
if (minItems !== undefined && maxItems < minItems)
|
|
149
|
-
throw new Error('"maxItems" cannot be less than "minItems".');
|
|
150
|
-
}
|
|
151
|
-
return value;
|
|
152
|
-
}
|
|
153
|
-
// Object validation
|
|
154
|
-
if (typeValue === 'object') {
|
|
155
|
-
const { properties, additionalProperties, required, ...remaining } = afterType;
|
|
156
|
-
const unsupportedKeys = objectHelpers.keys(remaining);
|
|
157
|
-
if (unsupportedKeys.length > 0)
|
|
158
|
-
throw new Error(`When type is "object", these properties are not supported: ${unsupportedKeys.map(k => `"${k}"`).join(', ')}.`);
|
|
159
|
-
if (properties !== undefined) {
|
|
160
|
-
if (typeof properties !== 'object' || properties === null || Array.isArray(properties))
|
|
161
|
-
throw new Error('"properties" must be an object.');
|
|
162
|
-
for (const [key, propertySchema] of Object.entries(properties)) {
|
|
163
|
-
jsonSchemaNormalizer.required.normalize(propertySchema).getValue(`properties.${key}`, warn);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
if (additionalProperties !== undefined && additionalProperties !== true) {
|
|
167
|
-
jsonSchemaNormalizer.required.normalize(additionalProperties).getValue('additionalProperties', warn);
|
|
168
|
-
}
|
|
169
|
-
if (required !== undefined) {
|
|
170
|
-
if (!Array.isArray(required))
|
|
171
|
-
throw new Error('"required" must be an array.');
|
|
172
|
-
for (const item of required) {
|
|
173
|
-
if (typeof item !== 'string')
|
|
174
|
-
throw new Error('"required" array must contain only strings.');
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return value;
|
|
178
|
-
}
|
|
179
|
-
throw new Error(`Unsupported type "${typeValue}".`);
|
|
180
|
-
});
|
|
181
|
-
//# sourceMappingURL=jsonSchemaNormalizer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonSchemaNormalizer.js","sourceRoot":"","sources":["../../../src/types/Json/jsonSchemaNormalizer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAElE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,IAAI,EAAsB,EAAE;IAC3F,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAA;IAE/B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;IAEnG,MAAM,MAAM,GAAG,KAA6B,CAAA;IAE5C,mCAAmC;IACnC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAA;IAEzF,IAAI,QAAQ,KAAK,SAAS,IAAI,OAAO,QAAQ,KAAK,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;IAC3G,IAAI,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ;QAA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AC5B,IAAI,OAAO,IAAI,KAAK,QAAQ;oBAAE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;YAC9F,CAAC;QACH,CAAC;QACD,OAAO,KAAoB,CAAA;IAC7B,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,qBAAqB,SAAS,IAAI,CAAC,CAAA;AACrD,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonSchemaNullable.d.ts","sourceRoot":"","sources":["../../../src/types/Json/jsonSchemaNullable.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CA6BvE"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { arrayHelpers } from '../../helpers/native/arrayHelpers';
|
|
2
|
-
import { objectHelpers } from '../../helpers/native/objectHelpers';
|
|
3
|
-
export function jsonSchemaNullable(jsonSchema) {
|
|
4
|
-
if (!jsonSchema.type) {
|
|
5
|
-
if ('const' in jsonSchema) {
|
|
6
|
-
if (jsonSchema.const === null)
|
|
7
|
-
return jsonSchema;
|
|
8
|
-
return {
|
|
9
|
-
...objectHelpers.omit(jsonSchema, 'const'),
|
|
10
|
-
enum: [jsonSchema.const, null],
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
if ('enum' in jsonSchema) {
|
|
14
|
-
if (jsonSchema.enum.includes(null))
|
|
15
|
-
return jsonSchema;
|
|
16
|
-
return {
|
|
17
|
-
...jsonSchema,
|
|
18
|
-
enum: [...jsonSchema.enum, null],
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
return jsonSchema;
|
|
22
|
-
}
|
|
23
|
-
if (arrayHelpers.isArray(jsonSchema.type))
|
|
24
|
-
return jsonSchema;
|
|
25
|
-
if (jsonSchema.type === 'any' || jsonSchema.type === 'null')
|
|
26
|
-
return jsonSchema;
|
|
27
|
-
return {
|
|
28
|
-
...jsonSchema,
|
|
29
|
-
type: [jsonSchema.type, 'null'],
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=jsonSchemaNullable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonSchemaNullable.js","sourceRoot":"","sources":["../../../src/types/Json/jsonSchemaNullable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAGlE,MAAM,UAAU,kBAAkB,CAAC,UAAuB;IACxD,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QACrB,IAAI,OAAO,IAAI,UAAU,EAAE,CAAC;YAC1B,IAAI,UAAU,CAAC,KAAK,KAAK,IAAI;gBAAE,OAAO,UAAU,CAAA;YAChD,OAAO;gBACL,GAAG,aAAa,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC;gBAC1C,IAAI,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC;aAC/B,CAAA;QACH,CAAC;QAED,IAAI,MAAM,IAAI,UAAU,EAAE,CAAC;YACzB,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAAE,OAAO,UAAU,CAAA;YACrD,OAAO;gBACL,GAAG,UAAU;gBACb,IAAI,EAAE,CAAC,GAAG,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC;aACjC,CAAA;QACH,CAAC;QAED,OAAO,UAAU,CAAA;IACnB,CAAC;IAED,IAAI,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,UAAU,CAAA;IAE5D,IAAI,UAAU,CAAC,IAAI,KAAK,KAAK,IAAI,UAAU,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,UAAU,CAAA;IAE9E,OAAO;QACL,GAAG,UAAU;QACb,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC;KACjB,CAAA;AAClB,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Json } from './Json';
|
|
2
|
-
/**
|
|
3
|
-
* Checks if the `provided` schema satisfies the `required` schema.
|
|
4
|
-
* In other words, any JSON value valid under `required` (old schema) will also be valid under `provided` (new schema).
|
|
5
|
-
* This is useful for checking backward compatibility when updating schemas.
|
|
6
|
-
*
|
|
7
|
-
* @param provided - The new schema (what the provider now offers)
|
|
8
|
-
* @param required - The old schema (what consumers expect)
|
|
9
|
-
* @returns true if the provided schema accepts all values that required schema accepts
|
|
10
|
-
*/
|
|
11
|
-
export declare function jsonSchemaSatisfies(provided: Json.Schema, required: Json.Schema): boolean;
|
|
12
|
-
//# sourceMappingURL=jsonSchemaSatisfies.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonSchemaSatisfies.d.ts","sourceRoot":"","sources":["../../../src/types/Json/jsonSchemaSatisfies.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,GAAG,OAAO,CAuEzF"}
|
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
import { haveSameContents } from '../../helpers/haveSameContents';
|
|
2
|
-
/**
|
|
3
|
-
* Checks if the `provided` schema satisfies the `required` schema.
|
|
4
|
-
* In other words, any JSON value valid under `required` (old schema) will also be valid under `provided` (new schema).
|
|
5
|
-
* This is useful for checking backward compatibility when updating schemas.
|
|
6
|
-
*
|
|
7
|
-
* @param provided - The new schema (what the provider now offers)
|
|
8
|
-
* @param required - The old schema (what consumers expect)
|
|
9
|
-
* @returns true if the provided schema accepts all values that required schema accepts
|
|
10
|
-
*/
|
|
11
|
-
export function jsonSchemaSatisfies(provided, required) {
|
|
12
|
-
// If provided accepts any value, it satisfies any required schema
|
|
13
|
-
if (isAnySchema(provided))
|
|
14
|
-
return true;
|
|
15
|
-
// If required accepts any value, provided must also accept any value
|
|
16
|
-
if (isAnySchema(required))
|
|
17
|
-
return isAnySchema(provided);
|
|
18
|
-
// Handle const in required
|
|
19
|
-
if ('const' in required) {
|
|
20
|
-
if ('const' in provided)
|
|
21
|
-
return haveSameContents(provided.const, required.const);
|
|
22
|
-
if ('enum' in provided)
|
|
23
|
-
return provided.enum.some(value => haveSameContents(value, required.const));
|
|
24
|
-
// Provided is a typed schema - check if it would accept the const value
|
|
25
|
-
return schemaAcceptsValue(provided, required.const);
|
|
26
|
-
}
|
|
27
|
-
// Handle enum in required
|
|
28
|
-
if ('enum' in required) {
|
|
29
|
-
if ('const' in provided)
|
|
30
|
-
return required.enum.length === 1 && haveSameContents(provided.const, required.enum[0]);
|
|
31
|
-
if ('enum' in provided)
|
|
32
|
-
return required.enum.every(requiredValue => provided.enum.some(providedValue => haveSameContents(providedValue, requiredValue)));
|
|
33
|
-
// Provided is a typed schema - check if it would accept all enum values
|
|
34
|
-
return required.enum.every(value => schemaAcceptsValue(provided, value));
|
|
35
|
-
}
|
|
36
|
-
// Handle const/enum in provided when required is a typed schema
|
|
37
|
-
// const/enum are more restrictive than type-based schemas
|
|
38
|
-
if ('const' in provided || 'enum' in provided)
|
|
39
|
-
return false;
|
|
40
|
-
// Both schemas are type-based - compare types and constraints
|
|
41
|
-
const providedBaseType = getBaseType(provided.type);
|
|
42
|
-
const requiredBaseType = getBaseType(required.type);
|
|
43
|
-
const providedNullable = isNullable(provided.type);
|
|
44
|
-
const requiredNullable = isNullable(required.type);
|
|
45
|
-
// If required accepts null, provided must also accept null
|
|
46
|
-
if (requiredNullable && !providedNullable)
|
|
47
|
-
return false;
|
|
48
|
-
// Handle null type
|
|
49
|
-
if (requiredBaseType === 'null')
|
|
50
|
-
return providedBaseType === 'null' || providedNullable;
|
|
51
|
-
// Types must match (with special case: number satisfies integer since number is more permissive)
|
|
52
|
-
if (providedBaseType !== requiredBaseType) {
|
|
53
|
-
if (!(providedBaseType === 'number' && requiredBaseType === 'integer'))
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
// Type-specific constraint checks
|
|
57
|
-
switch (requiredBaseType) {
|
|
58
|
-
case 'string':
|
|
59
|
-
return stringSchemasSatisfy(provided, required);
|
|
60
|
-
case 'number':
|
|
61
|
-
case 'integer':
|
|
62
|
-
return numberSchemasSatisfy(provided, required);
|
|
63
|
-
case 'boolean':
|
|
64
|
-
return true; // No additional constraints for boolean
|
|
65
|
-
case 'array':
|
|
66
|
-
return arraySchemasSatisfy(provided, required);
|
|
67
|
-
case 'object':
|
|
68
|
-
return objectSchemasSatisfy(provided, required);
|
|
69
|
-
default:
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
function isAnySchema(schema) {
|
|
74
|
-
return !('const' in schema) && !('enum' in schema) && (schema.type === undefined || schema.type === 'any');
|
|
75
|
-
}
|
|
76
|
-
function getBaseType(type) {
|
|
77
|
-
if (type === undefined)
|
|
78
|
-
return 'any';
|
|
79
|
-
if (Array.isArray(type))
|
|
80
|
-
return type.find(t => t !== 'null');
|
|
81
|
-
return type;
|
|
82
|
-
}
|
|
83
|
-
function isNullable(type) {
|
|
84
|
-
if (type === 'null')
|
|
85
|
-
return true;
|
|
86
|
-
if (Array.isArray(type))
|
|
87
|
-
return type.includes('null');
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Check if a typed schema would accept a specific JSON value.
|
|
92
|
-
* Used when required has const/enum and provided is type-based.
|
|
93
|
-
*/
|
|
94
|
-
function schemaAcceptsValue(schema, value) {
|
|
95
|
-
if (isAnySchema(schema))
|
|
96
|
-
return true;
|
|
97
|
-
const baseType = getBaseType(schema.type);
|
|
98
|
-
const nullable = isNullable(schema.type);
|
|
99
|
-
if (value === null)
|
|
100
|
-
return nullable || baseType === 'null';
|
|
101
|
-
switch (baseType) {
|
|
102
|
-
case 'null':
|
|
103
|
-
return value === null;
|
|
104
|
-
case 'string': {
|
|
105
|
-
if (typeof value !== 'string')
|
|
106
|
-
return false;
|
|
107
|
-
const stringSchema = schema;
|
|
108
|
-
if (stringSchema.minLength !== undefined && value.length < stringSchema.minLength)
|
|
109
|
-
return false;
|
|
110
|
-
if (stringSchema.maxLength !== undefined && value.length > stringSchema.maxLength)
|
|
111
|
-
return false;
|
|
112
|
-
// Note: format validation is lenient here - we assume the const/enum value is well-formed
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
case 'number':
|
|
116
|
-
case 'integer': {
|
|
117
|
-
if (typeof value !== 'number')
|
|
118
|
-
return false;
|
|
119
|
-
if (baseType === 'integer' && value % 1 !== 0)
|
|
120
|
-
return false;
|
|
121
|
-
const numberSchema = schema;
|
|
122
|
-
if (numberSchema.minimum !== undefined && value < numberSchema.minimum)
|
|
123
|
-
return false;
|
|
124
|
-
if (numberSchema.maximum !== undefined && value > numberSchema.maximum)
|
|
125
|
-
return false;
|
|
126
|
-
if (numberSchema.exclusiveMinimum !== undefined && value <= numberSchema.exclusiveMinimum)
|
|
127
|
-
return false;
|
|
128
|
-
if (numberSchema.exclusiveMaximum !== undefined && value >= numberSchema.exclusiveMaximum)
|
|
129
|
-
return false;
|
|
130
|
-
if (numberSchema.multipleOf !== undefined && value % numberSchema.multipleOf !== 0)
|
|
131
|
-
return false;
|
|
132
|
-
return true;
|
|
133
|
-
}
|
|
134
|
-
case 'boolean':
|
|
135
|
-
return typeof value === 'boolean';
|
|
136
|
-
case 'array': {
|
|
137
|
-
if (!Array.isArray(value))
|
|
138
|
-
return false;
|
|
139
|
-
const arraySchema = schema;
|
|
140
|
-
if (arraySchema.minItems !== undefined && value.length < arraySchema.minItems)
|
|
141
|
-
return false;
|
|
142
|
-
if (arraySchema.maxItems !== undefined && value.length > arraySchema.maxItems)
|
|
143
|
-
return false;
|
|
144
|
-
if (arraySchema.items !== undefined)
|
|
145
|
-
return value.every(item => schemaAcceptsValue(arraySchema.items, item));
|
|
146
|
-
return true;
|
|
147
|
-
}
|
|
148
|
-
case 'object': {
|
|
149
|
-
if (typeof value !== 'object' || Array.isArray(value) || value === null)
|
|
150
|
-
return false;
|
|
151
|
-
const objectSchema = schema;
|
|
152
|
-
const objectValue = value;
|
|
153
|
-
if (objectSchema.required) {
|
|
154
|
-
for (const key of objectSchema.required) {
|
|
155
|
-
if (!(key in objectValue))
|
|
156
|
-
return false;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
for (const [key, propertyValue] of Object.entries(objectValue)) {
|
|
160
|
-
if (objectSchema.properties && key in objectSchema.properties) {
|
|
161
|
-
if (!schemaAcceptsValue(objectSchema.properties[key], propertyValue))
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
else if (objectSchema.additionalProperties !== undefined && objectSchema.additionalProperties !== true) {
|
|
165
|
-
if (!schemaAcceptsValue(objectSchema.additionalProperties, propertyValue))
|
|
166
|
-
return false;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
return true;
|
|
170
|
-
}
|
|
171
|
-
default:
|
|
172
|
-
return false;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
function stringSchemasSatisfy(provided, required) {
|
|
176
|
-
// Provided minLength must be <= required minLength (or undefined = no constraint)
|
|
177
|
-
if (required.minLength !== undefined) {
|
|
178
|
-
if (provided.minLength !== undefined && provided.minLength > required.minLength)
|
|
179
|
-
return false;
|
|
180
|
-
}
|
|
181
|
-
// Provided maxLength must be >= required maxLength (or undefined = no constraint)
|
|
182
|
-
if (required.maxLength !== undefined) {
|
|
183
|
-
if (provided.maxLength !== undefined && provided.maxLength < required.maxLength)
|
|
184
|
-
return false;
|
|
185
|
-
}
|
|
186
|
-
// Format: if required has a format, provided must have the same format or no format (more permissive)
|
|
187
|
-
if (required.format !== undefined) {
|
|
188
|
-
if (provided.format !== undefined && provided.format !== required.format)
|
|
189
|
-
return false;
|
|
190
|
-
}
|
|
191
|
-
return true;
|
|
192
|
-
}
|
|
193
|
-
function numberSchemasSatisfy(provided, required) {
|
|
194
|
-
// Provided minimum must be <= required minimum
|
|
195
|
-
if (required.minimum !== undefined) {
|
|
196
|
-
if (provided.minimum !== undefined && provided.minimum > required.minimum)
|
|
197
|
-
return false;
|
|
198
|
-
}
|
|
199
|
-
// Provided maximum must be >= required maximum
|
|
200
|
-
if (required.maximum !== undefined) {
|
|
201
|
-
if (provided.maximum !== undefined && provided.maximum < required.maximum)
|
|
202
|
-
return false;
|
|
203
|
-
}
|
|
204
|
-
// Provided exclusiveMinimum must be <= required exclusiveMinimum
|
|
205
|
-
if (required.exclusiveMinimum !== undefined) {
|
|
206
|
-
if (provided.exclusiveMinimum !== undefined && provided.exclusiveMinimum > required.exclusiveMinimum)
|
|
207
|
-
return false;
|
|
208
|
-
}
|
|
209
|
-
// Provided exclusiveMaximum must be >= required exclusiveMaximum
|
|
210
|
-
if (required.exclusiveMaximum !== undefined) {
|
|
211
|
-
if (provided.exclusiveMaximum !== undefined && provided.exclusiveMaximum < required.exclusiveMaximum)
|
|
212
|
-
return false;
|
|
213
|
-
}
|
|
214
|
-
// multipleOf: provided's multipleOf must divide required's multipleOf
|
|
215
|
-
// e.g., if required is multipleOf: 6, provided can be multipleOf: 2 or 3 (accepts more values)
|
|
216
|
-
if (required.multipleOf !== undefined) {
|
|
217
|
-
if (provided.multipleOf !== undefined && required.multipleOf % provided.multipleOf !== 0)
|
|
218
|
-
return false;
|
|
219
|
-
}
|
|
220
|
-
return true;
|
|
221
|
-
}
|
|
222
|
-
function arraySchemasSatisfy(provided, required) {
|
|
223
|
-
// Provided minItems must be <= required minItems
|
|
224
|
-
if (required.minItems !== undefined) {
|
|
225
|
-
if (provided.minItems !== undefined && provided.minItems > required.minItems)
|
|
226
|
-
return false;
|
|
227
|
-
}
|
|
228
|
-
// Provided maxItems must be >= required maxItems
|
|
229
|
-
if (required.maxItems !== undefined) {
|
|
230
|
-
if (provided.maxItems !== undefined && provided.maxItems < required.maxItems)
|
|
231
|
-
return false;
|
|
232
|
-
}
|
|
233
|
-
// Items schema: provided's items must satisfy required's items
|
|
234
|
-
if (required.items !== undefined) {
|
|
235
|
-
if (provided.items === undefined)
|
|
236
|
-
return true; // No constraint = accepts any items
|
|
237
|
-
return jsonSchemaSatisfies(provided.items, required.items);
|
|
238
|
-
}
|
|
239
|
-
return true;
|
|
240
|
-
}
|
|
241
|
-
function objectSchemasSatisfy(provided, required) {
|
|
242
|
-
// Required properties: provided can have fewer required properties (more permissive)
|
|
243
|
-
// But if provided requires a property that required doesn't, it's more restrictive
|
|
244
|
-
if (provided.required) {
|
|
245
|
-
for (const key of provided.required) {
|
|
246
|
-
if (!required.required?.includes(key)) {
|
|
247
|
-
// Provided requires a property that required doesn't - check if required schema would accept objects without it
|
|
248
|
-
// If the property is in required.properties but not required.required, it's optional in required
|
|
249
|
-
// So provided making it required is more restrictive
|
|
250
|
-
return false;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
// Properties: for each property in required, check if provided's schema for that property satisfies it
|
|
255
|
-
if (required.properties) {
|
|
256
|
-
for (const [key, requiredPropertySchema] of Object.entries(required.properties)) {
|
|
257
|
-
if (provided.properties && key in provided.properties) {
|
|
258
|
-
if (!jsonSchemaSatisfies(provided.properties[key], requiredPropertySchema))
|
|
259
|
-
return false;
|
|
260
|
-
}
|
|
261
|
-
else if (provided.additionalProperties !== undefined) {
|
|
262
|
-
// Property is covered by additionalProperties in provided
|
|
263
|
-
if (provided.additionalProperties === true)
|
|
264
|
-
continue; // Accepts any value
|
|
265
|
-
if (!jsonSchemaSatisfies(provided.additionalProperties, requiredPropertySchema))
|
|
266
|
-
return false;
|
|
267
|
-
}
|
|
268
|
-
// If property not in provided.properties and no additionalProperties, provided accepts any value for it
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
// Additional properties: if required allows additional properties, provided must also allow them
|
|
272
|
-
if (required.additionalProperties !== undefined) {
|
|
273
|
-
if (provided.additionalProperties === undefined) {
|
|
274
|
-
// Provided has no additionalProperties constraint - implicitly accepts any
|
|
275
|
-
return true;
|
|
276
|
-
}
|
|
277
|
-
if (required.additionalProperties === true) {
|
|
278
|
-
// Required accepts any additional properties
|
|
279
|
-
return provided.additionalProperties === true;
|
|
280
|
-
}
|
|
281
|
-
if (provided.additionalProperties === true) {
|
|
282
|
-
// Provided accepts any additional properties - satisfies any schema
|
|
283
|
-
return true;
|
|
284
|
-
}
|
|
285
|
-
// Both have schema constraints - provided must satisfy required
|
|
286
|
-
return jsonSchemaSatisfies(provided.additionalProperties, required.additionalProperties);
|
|
287
|
-
}
|
|
288
|
-
return true;
|
|
289
|
-
}
|
|
290
|
-
//# sourceMappingURL=jsonSchemaSatisfies.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonSchemaSatisfies.js","sourceRoot":"","sources":["../../../src/types/Json/jsonSchemaSatisfies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AAGjE;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAqB,EAAE,QAAqB;IAC9E,kEAAkE;IAClE,IAAI,WAAW,CAAC,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAA;IAEtC,qEAAqE;IACrE,IAAI,WAAW,CAAC,QAAQ,CAAC;QAAE,OAAO,WAAW,CAAC,QAAQ,CAAC,CAAA;IAEvD,2BAA2B;IAC3B,IAAI,OAAO,IAAI,QAAQ,EAAE,CAAC;QACxB,IAAI,OAAO,IAAI,QAAQ;YAAE,OAAO,gBAAgB,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAA;QAChF,IAAI,MAAM,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,K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K,SAAS,EAAE,CAAC;YAChD,2EAA2E;YAC3E,OAAO,IAAI,CAAA;QACb,CAAC;QACD,IAAI,QAAQ,CAAC,oBAAoB,KAAK,IAAI,EAAE,CAAC;YAC3C,6CAA6C;YAC7C,OAAO,QAAQ,CAAC,oBAAoB,KAAK,IAAI,CAAA;QAC/C,CAAC;QACD,IAAI,QAAQ,CAAC,oBAAoB,KAAK,IAAI,EAAE,CAAC;YAC3C,oEAAoE;YACpE,OAAO,IAAI,CAAA;QACb,CAAC;QACD,gEAAgE;QAChE,OAAO,mBAAmB,CAAC,QAAQ,CAAC,oBAAoB,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAAA;IAC1F,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Json } from './Json';
|
|
2
|
-
/** Checks if any JSON value valid under `required` (old) will also be valid under `provided` (new). */
|
|
3
|
-
export declare function jsonSchemaSatisfies(provided: Json.Schema, required: Json.Schema): boolean;
|
|
4
|
-
//# sourceMappingURL=jsonSchemaSimplifiedSatisfies.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonSchemaSimplifiedSatisfies.d.ts","sourceRoot":"","sources":["../../../src/types/Json/jsonSchemaSimplifiedSatisfies.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAE7B,uGAAuG;AACvG,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,GAAG,OAAO,CAyDzF"}
|