@blueking/bkui-form 1.0.1-beta.3 → 1.0.1-beta.4
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/adapter/common/FieldGroupWrap.d.ts +209 -0
- package/dist/adapter/field/ArrayField.d.ts +147 -0
- package/dist/adapter/field/BooleanField.d.ts +145 -0
- package/dist/adapter/field/CompositionField.d.ts +151 -0
- package/dist/adapter/field/FieldProps.d.ts +70 -0
- package/dist/adapter/field/NumberField.d.ts +145 -0
- package/dist/adapter/field/ObjectField.d.ts +147 -0
- package/dist/adapter/field/SchemaField.d.ts +145 -0
- package/dist/adapter/field/StringField.d.ts +4 -0
- package/dist/adapter/widget/ArrayWidget.d.ts +154 -0
- package/dist/adapter/widget/ButtonWidget.d.ts +16 -0
- package/dist/adapter/widget/CheckboxWidget.d.ts +34 -0
- package/dist/adapter/widget/CollapseGroupWidget.d.ts +196 -0
- package/dist/adapter/widget/ColorPickerWidget.d.ts +8 -0
- package/dist/adapter/widget/InputWidget.d.ts +30 -0
- package/dist/adapter/widget/KeyValueArrayWidget.d.ts +157 -0
- package/dist/adapter/widget/RadioWidget.d.ts +37 -0
- package/dist/adapter/widget/SelectWidget.d.ts +37 -0
- package/dist/adapter/widget/SwitchWidget.d.ts +10 -0
- package/dist/adapter/widget/TabGroupWidget.d.ts +187 -0
- package/dist/adapter/widget/TableWidget.d.ts +154 -0
- package/dist/adapter/widget/Widget.d.ts +182 -0
- package/dist/controller/form.d.ts +141 -0
- package/dist/controller/props.d.ts +62 -0
- package/dist/core/events.d.ts +10 -0
- package/dist/core/expression.d.ts +13 -0
- package/dist/core/form.d.ts +5 -0
- package/dist/core/lang.d.ts +1 -0
- package/dist/core/layout.d.ts +20 -0
- package/dist/core/lifecycle.d.ts +0 -0
- package/dist/core/path.d.ts +9 -0
- package/dist/core/proxy.d.ts +3 -0
- package/dist/core/reaction.d.ts +5 -0
- package/dist/core/register.d.ts +19 -0
- package/dist/core/schema.d.ts +26 -0
- package/dist/core/validator.d.ts +35 -0
- package/dist/core/widgetTree.d.ts +40 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.es.js +7443 -0
- package/dist/index.umd.js +12 -0
- package/dist/style.css +1 -0
- package/dist/util/fetch.d.ts +10 -0
- package/dist/util/index.d.ts +23 -0
- package/package.json +24 -12
- package/esm/adapter/common/FieldGroupWrap.tsx.js +0 -199
- package/esm/adapter/field/ArrayField.tsx.js +0 -55
- package/esm/adapter/field/BooleanField.tsx.js +0 -41
- package/esm/adapter/field/CompositionField.tsx.js +0 -113
- package/esm/adapter/field/FieldProps.ts.js +0 -85
- package/esm/adapter/field/NumberField.tsx.js +0 -19
- package/esm/adapter/field/ObjectField.tsx.js +0 -58
- package/esm/adapter/field/SchemaField.tsx.js +0 -28
- package/esm/adapter/field/StringField.tsx.js +0 -4
- package/esm/adapter/widget/ArrayWidget.ts.js +0 -196
- package/esm/adapter/widget/ButtonWidget.ts.js +0 -76
- package/esm/adapter/widget/CheckboxWidget.ts.js +0 -101
- package/esm/adapter/widget/CollapseGroupWidget.ts.js +0 -140
- package/esm/adapter/widget/ColorPickerWidget.ts.js +0 -71
- package/esm/adapter/widget/InputWidget.ts.js +0 -79
- package/esm/adapter/widget/KeyValueArrayWidget.tsx.js +0 -156
- package/esm/adapter/widget/RadioWidget.ts.js +0 -98
- package/esm/adapter/widget/SelectWidget.ts.js +0 -98
- package/esm/adapter/widget/SwitchWidget.ts.js +0 -73
- package/esm/adapter/widget/TabGroupWidget.ts.js +0 -145
- package/esm/adapter/widget/TableWidget.ts.js +0 -205
- package/esm/adapter/widget/Widget.ts.js +0 -497
- package/esm/assets/fonts/iconcool.eot +0 -0
- package/esm/assets/fonts/iconcool.svg +0 -53
- package/esm/assets/fonts/iconcool.ttf +0 -0
- package/esm/assets/fonts/iconcool.woff +0 -0
- package/esm/assets/style.css +0 -43
- package/esm/controller/form.css +0 -164
- package/esm/controller/form.tsx.js +0 -159
- package/esm/controller/props.ts.js +0 -75
- package/esm/core/events.ts.js +0 -74
- package/esm/core/expression.ts.js +0 -67
- package/esm/core/lang.ts.js +0 -25
- package/esm/core/layout.ts.js +0 -149
- package/esm/core/path.ts.js +0 -60
- package/esm/core/proxy.ts.js +0 -10
- package/esm/core/reaction.ts.js +0 -116
- package/esm/core/register.ts.js +0 -74
- package/esm/core/schema.ts.js +0 -302
- package/esm/core/validator.ts.js +0 -248
- package/esm/core/widgetTree.ts.js +0 -163
- package/esm/index.ts.js +0 -6
- package/esm/node_modules/@blueking/cli-service/dist/lib/path.js +0 -35
- package/esm/node_modules/@blueking/cli-service/dist/lib/util.js +0 -233
- package/esm/node_modules/@blueking/cli-service/dist/tools/rust/helper/path.js +0 -172
- package/esm/node_modules/ajv/dist/ajv.js +0 -50
- package/esm/node_modules/ajv/dist/compile/codegen/code.js +0 -156
- package/esm/node_modules/ajv/dist/compile/codegen/index.js +0 -697
- package/esm/node_modules/ajv/dist/compile/codegen/scope.js +0 -143
- package/esm/node_modules/ajv/dist/compile/errors.js +0 -123
- package/esm/node_modules/ajv/dist/compile/index.js +0 -242
- package/esm/node_modules/ajv/dist/compile/names.js +0 -28
- package/esm/node_modules/ajv/dist/compile/ref_error.js +0 -12
- package/esm/node_modules/ajv/dist/compile/resolve.js +0 -155
- package/esm/node_modules/ajv/dist/compile/rules.js +0 -26
- package/esm/node_modules/ajv/dist/compile/util.js +0 -178
- package/esm/node_modules/ajv/dist/compile/validate/applicability.js +0 -19
- package/esm/node_modules/ajv/dist/compile/validate/boolSchema.js +0 -50
- package/esm/node_modules/ajv/dist/compile/validate/dataType.js +0 -203
- package/esm/node_modules/ajv/dist/compile/validate/defaults.js +0 -35
- package/esm/node_modules/ajv/dist/compile/validate/index.js +0 -520
- package/esm/node_modules/ajv/dist/compile/validate/keyword.js +0 -124
- package/esm/node_modules/ajv/dist/compile/validate/subschema.js +0 -81
- package/esm/node_modules/ajv/dist/core.js +0 -618
- package/esm/node_modules/ajv/dist/refs/data.json +0 -13
- package/esm/node_modules/ajv/dist/refs/json-schema-draft-07.json +0 -151
- package/esm/node_modules/ajv/dist/runtime/equal.js +0 -7
- package/esm/node_modules/ajv/dist/runtime/ucs2length.js +0 -24
- package/esm/node_modules/ajv/dist/runtime/uri.js +0 -6
- package/esm/node_modules/ajv/dist/runtime/validation_error.js +0 -11
- package/esm/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +0 -49
- package/esm/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +0 -106
- package/esm/node_modules/ajv/dist/vocabularies/applicator/allOf.js +0 -23
- package/esm/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +0 -12
- package/esm/node_modules/ajv/dist/vocabularies/applicator/contains.js +0 -95
- package/esm/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +0 -85
- package/esm/node_modules/ajv/dist/vocabularies/applicator/if.js +0 -66
- package/esm/node_modules/ajv/dist/vocabularies/applicator/index.js +0 -44
- package/esm/node_modules/ajv/dist/vocabularies/applicator/items.js +0 -52
- package/esm/node_modules/ajv/dist/vocabularies/applicator/items2020.js +0 -30
- package/esm/node_modules/ajv/dist/vocabularies/applicator/not.js +0 -26
- package/esm/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +0 -60
- package/esm/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +0 -75
- package/esm/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +0 -12
- package/esm/node_modules/ajv/dist/vocabularies/applicator/properties.js +0 -54
- package/esm/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +0 -38
- package/esm/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +0 -13
- package/esm/node_modules/ajv/dist/vocabularies/code.js +0 -131
- package/esm/node_modules/ajv/dist/vocabularies/core/id.js +0 -10
- package/esm/node_modules/ajv/dist/vocabularies/core/index.js +0 -16
- package/esm/node_modules/ajv/dist/vocabularies/core/ref.js +0 -122
- package/esm/node_modules/ajv/dist/vocabularies/discriminator/index.js +0 -104
- package/esm/node_modules/ajv/dist/vocabularies/discriminator/types.js +0 -9
- package/esm/node_modules/ajv/dist/vocabularies/draft7.js +0 -17
- package/esm/node_modules/ajv/dist/vocabularies/format/format.js +0 -92
- package/esm/node_modules/ajv/dist/vocabularies/format/index.js +0 -6
- package/esm/node_modules/ajv/dist/vocabularies/metadata.js +0 -18
- package/esm/node_modules/ajv/dist/vocabularies/validation/const.js +0 -25
- package/esm/node_modules/ajv/dist/vocabularies/validation/enum.js +0 -48
- package/esm/node_modules/ajv/dist/vocabularies/validation/index.js +0 -33
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitItems.js +0 -24
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitLength.js +0 -27
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +0 -27
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +0 -24
- package/esm/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +0 -26
- package/esm/node_modules/ajv/dist/vocabularies/validation/pattern.js +0 -24
- package/esm/node_modules/ajv/dist/vocabularies/validation/required.js +0 -79
- package/esm/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +0 -64
- package/esm/node_modules/ajv-formats/dist/formats.js +0 -173
- package/esm/node_modules/ajv-formats/dist/index.js +0 -37
- package/esm/node_modules/ajv-formats/dist/limit.js +0 -69
- package/esm/node_modules/ajv-i18n/localize/zh/index.js +0 -154
- package/esm/node_modules/fast-deep-equal/index.js +0 -46
- package/esm/node_modules/fast-uri/index.js +0 -303
- package/esm/node_modules/fast-uri/lib/schemes.js +0 -188
- package/esm/node_modules/fast-uri/lib/scopedChars.js +0 -30
- package/esm/node_modules/fast-uri/lib/utils.js +0 -244
- package/esm/node_modules/json-schema-traverse/index.js +0 -89
- package/esm/node_modules/semver/classes/comparator.js +0 -143
- package/esm/node_modules/semver/classes/range.js +0 -557
- package/esm/node_modules/semver/classes/semver.js +0 -333
- package/esm/node_modules/semver/functions/clean.js +0 -8
- package/esm/node_modules/semver/functions/cmp.js +0 -54
- package/esm/node_modules/semver/functions/coerce.js +0 -62
- package/esm/node_modules/semver/functions/compare-build.js +0 -9
- package/esm/node_modules/semver/functions/compare-loose.js +0 -5
- package/esm/node_modules/semver/functions/compare.js +0 -7
- package/esm/node_modules/semver/functions/diff.js +0 -60
- package/esm/node_modules/semver/functions/eq.js +0 -5
- package/esm/node_modules/semver/functions/gt.js +0 -5
- package/esm/node_modules/semver/functions/gte.js +0 -5
- package/esm/node_modules/semver/functions/inc.js +0 -21
- package/esm/node_modules/semver/functions/lt.js +0 -5
- package/esm/node_modules/semver/functions/lte.js +0 -5
- package/esm/node_modules/semver/functions/major.js +0 -5
- package/esm/node_modules/semver/functions/minor.js +0 -5
- package/esm/node_modules/semver/functions/neq.js +0 -5
- package/esm/node_modules/semver/functions/parse.js +0 -18
- package/esm/node_modules/semver/functions/patch.js +0 -5
- package/esm/node_modules/semver/functions/prerelease.js +0 -8
- package/esm/node_modules/semver/functions/rcompare.js +0 -5
- package/esm/node_modules/semver/functions/rsort.js +0 -5
- package/esm/node_modules/semver/functions/satisfies.js +0 -12
- package/esm/node_modules/semver/functions/sort.js +0 -5
- package/esm/node_modules/semver/functions/valid.js +0 -8
- package/esm/node_modules/semver/index.js +0 -91
- package/esm/node_modules/semver/internal/constants.js +0 -37
- package/esm/node_modules/semver/internal/debug.js +0 -11
- package/esm/node_modules/semver/internal/identifiers.js +0 -29
- package/esm/node_modules/semver/internal/lrucache.js +0 -42
- package/esm/node_modules/semver/internal/parse-options.js +0 -17
- package/esm/node_modules/semver/internal/re.js +0 -223
- package/esm/node_modules/semver/ranges/gtr.js +0 -6
- package/esm/node_modules/semver/ranges/intersects.js +0 -9
- package/esm/node_modules/semver/ranges/ltr.js +0 -6
- package/esm/node_modules/semver/ranges/max-satisfying.js +0 -27
- package/esm/node_modules/semver/ranges/min-satisfying.js +0 -26
- package/esm/node_modules/semver/ranges/min-version.js +0 -63
- package/esm/node_modules/semver/ranges/outside.js +0 -82
- package/esm/node_modules/semver/ranges/simplify.js +0 -49
- package/esm/node_modules/semver/ranges/subset.js +0 -249
- package/esm/node_modules/semver/ranges/to-comparators.js +0 -10
- package/esm/node_modules/semver/ranges/valid.js +0 -13
- package/esm/util/fetch.ts.js +0 -190
- package/esm/util/index.ts.js +0 -276
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const additionalItems_1 = require('./additionalItems.js');
|
|
4
|
-
const prefixItems_1 = require('./prefixItems.js');
|
|
5
|
-
const items_1 = require('./items.js');
|
|
6
|
-
const items2020_1 = require('./items2020.js');
|
|
7
|
-
const contains_1 = require('./contains.js');
|
|
8
|
-
const dependencies_1 = require('./dependencies.js');
|
|
9
|
-
const propertyNames_1 = require('./propertyNames.js');
|
|
10
|
-
const additionalProperties_1 = require('./additionalProperties.js');
|
|
11
|
-
const properties_1 = require('./properties.js');
|
|
12
|
-
const patternProperties_1 = require('./patternProperties.js');
|
|
13
|
-
const not_1 = require('./not.js');
|
|
14
|
-
const anyOf_1 = require('./anyOf.js');
|
|
15
|
-
const oneOf_1 = require('./oneOf.js');
|
|
16
|
-
const allOf_1 = require('./allOf.js');
|
|
17
|
-
const if_1 = require('./if.js');
|
|
18
|
-
const thenElse_1 = require('./thenElse.js');
|
|
19
|
-
function getApplicator(draft2020 = false) {
|
|
20
|
-
const applicator = [
|
|
21
|
-
// any
|
|
22
|
-
not_1.default,
|
|
23
|
-
anyOf_1.default,
|
|
24
|
-
oneOf_1.default,
|
|
25
|
-
allOf_1.default,
|
|
26
|
-
if_1.default,
|
|
27
|
-
thenElse_1.default,
|
|
28
|
-
// object
|
|
29
|
-
propertyNames_1.default,
|
|
30
|
-
additionalProperties_1.default,
|
|
31
|
-
dependencies_1.default,
|
|
32
|
-
properties_1.default,
|
|
33
|
-
patternProperties_1.default,
|
|
34
|
-
];
|
|
35
|
-
// array
|
|
36
|
-
if (draft2020)
|
|
37
|
-
applicator.push(prefixItems_1.default, items2020_1.default);
|
|
38
|
-
else
|
|
39
|
-
applicator.push(additionalItems_1.default, items_1.default);
|
|
40
|
-
applicator.push(contains_1.default);
|
|
41
|
-
return applicator;
|
|
42
|
-
}
|
|
43
|
-
exports.default = getApplicator;
|
|
44
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateTuple = void 0;
|
|
4
|
-
const codegen_1 = require('../../compile/codegen/index.js');
|
|
5
|
-
const util_1 = require('../../compile/util.js');
|
|
6
|
-
const code_1 = require('../code.js');
|
|
7
|
-
const def = {
|
|
8
|
-
keyword: "items",
|
|
9
|
-
type: "array",
|
|
10
|
-
schemaType: ["object", "array", "boolean"],
|
|
11
|
-
before: "uniqueItems",
|
|
12
|
-
code(cxt) {
|
|
13
|
-
const { schema, it } = cxt;
|
|
14
|
-
if (Array.isArray(schema))
|
|
15
|
-
return validateTuple(cxt, "additionalItems", schema);
|
|
16
|
-
it.items = true;
|
|
17
|
-
if ((0, util_1.alwaysValidSchema)(it, schema))
|
|
18
|
-
return;
|
|
19
|
-
cxt.ok((0, code_1.validateArray)(cxt));
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
function validateTuple(cxt, extraItems, schArr = cxt.schema) {
|
|
23
|
-
const { gen, parentSchema, data, keyword, it } = cxt;
|
|
24
|
-
checkStrictTuple(parentSchema);
|
|
25
|
-
if (it.opts.unevaluated && schArr.length && it.items !== true) {
|
|
26
|
-
it.items = util_1.mergeEvaluated.items(gen, schArr.length, it.items);
|
|
27
|
-
}
|
|
28
|
-
const valid = gen.name("valid");
|
|
29
|
-
const len = gen.const("len", (0, codegen_1._) `${data}.length`);
|
|
30
|
-
schArr.forEach((sch, i) => {
|
|
31
|
-
if ((0, util_1.alwaysValidSchema)(it, sch))
|
|
32
|
-
return;
|
|
33
|
-
gen.if((0, codegen_1._) `${len} > ${i}`, () => cxt.subschema({
|
|
34
|
-
keyword,
|
|
35
|
-
schemaProp: i,
|
|
36
|
-
dataProp: i,
|
|
37
|
-
}, valid));
|
|
38
|
-
cxt.ok(valid);
|
|
39
|
-
});
|
|
40
|
-
function checkStrictTuple(sch) {
|
|
41
|
-
const { opts, errSchemaPath } = it;
|
|
42
|
-
const l = schArr.length;
|
|
43
|
-
const fullTuple = l === sch.minItems && (l === sch.maxItems || sch[extraItems] === false);
|
|
44
|
-
if (opts.strictTuples && !fullTuple) {
|
|
45
|
-
const msg = `"${keyword}" is ${l}-tuple, but minItems or maxItems/${extraItems} are not specified or different at path "${errSchemaPath}"`;
|
|
46
|
-
(0, util_1.checkStrictMode)(it, msg, opts.strictTuples);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.validateTuple = validateTuple;
|
|
51
|
-
exports.default = def;
|
|
52
|
-
//# sourceMappingURL=items.js.map
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const codegen_1 = require('../../compile/codegen/index.js');
|
|
4
|
-
const util_1 = require('../../compile/util.js');
|
|
5
|
-
const code_1 = require('../code.js');
|
|
6
|
-
const additionalItems_1 = require('./additionalItems.js');
|
|
7
|
-
const error = {
|
|
8
|
-
message: ({ params: { len } }) => (0, codegen_1.str) `must NOT have more than ${len} items`,
|
|
9
|
-
params: ({ params: { len } }) => (0, codegen_1._) `{limit: ${len}}`,
|
|
10
|
-
};
|
|
11
|
-
const def = {
|
|
12
|
-
keyword: "items",
|
|
13
|
-
type: "array",
|
|
14
|
-
schemaType: ["object", "boolean"],
|
|
15
|
-
before: "uniqueItems",
|
|
16
|
-
error,
|
|
17
|
-
code(cxt) {
|
|
18
|
-
const { schema, parentSchema, it } = cxt;
|
|
19
|
-
const { prefixItems } = parentSchema;
|
|
20
|
-
it.items = true;
|
|
21
|
-
if ((0, util_1.alwaysValidSchema)(it, schema))
|
|
22
|
-
return;
|
|
23
|
-
if (prefixItems)
|
|
24
|
-
(0, additionalItems_1.validateAdditionalItems)(cxt, prefixItems);
|
|
25
|
-
else
|
|
26
|
-
cxt.ok((0, code_1.validateArray)(cxt));
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
exports.default = def;
|
|
30
|
-
//# sourceMappingURL=items2020.js.map
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const util_1 = require('../../compile/util.js');
|
|
4
|
-
const def = {
|
|
5
|
-
keyword: "not",
|
|
6
|
-
schemaType: ["object", "boolean"],
|
|
7
|
-
trackErrors: true,
|
|
8
|
-
code(cxt) {
|
|
9
|
-
const { gen, schema, it } = cxt;
|
|
10
|
-
if ((0, util_1.alwaysValidSchema)(it, schema)) {
|
|
11
|
-
cxt.fail();
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
const valid = gen.name("valid");
|
|
15
|
-
cxt.subschema({
|
|
16
|
-
keyword: "not",
|
|
17
|
-
compositeRule: true,
|
|
18
|
-
createErrors: false,
|
|
19
|
-
allErrors: false,
|
|
20
|
-
}, valid);
|
|
21
|
-
cxt.failResult(valid, () => cxt.reset(), () => cxt.error());
|
|
22
|
-
},
|
|
23
|
-
error: { message: "must NOT be valid" },
|
|
24
|
-
};
|
|
25
|
-
exports.default = def;
|
|
26
|
-
//# sourceMappingURL=not.js.map
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const codegen_1 = require('../../compile/codegen/index.js');
|
|
4
|
-
const util_1 = require('../../compile/util.js');
|
|
5
|
-
const error = {
|
|
6
|
-
message: "must match exactly one schema in oneOf",
|
|
7
|
-
params: ({ params }) => (0, codegen_1._) `{passingSchemas: ${params.passing}}`,
|
|
8
|
-
};
|
|
9
|
-
const def = {
|
|
10
|
-
keyword: "oneOf",
|
|
11
|
-
schemaType: "array",
|
|
12
|
-
trackErrors: true,
|
|
13
|
-
error,
|
|
14
|
-
code(cxt) {
|
|
15
|
-
const { gen, schema, parentSchema, it } = cxt;
|
|
16
|
-
/* istanbul ignore if */
|
|
17
|
-
if (!Array.isArray(schema))
|
|
18
|
-
throw new Error("ajv implementation error");
|
|
19
|
-
if (it.opts.discriminator && parentSchema.discriminator)
|
|
20
|
-
return;
|
|
21
|
-
const schArr = schema;
|
|
22
|
-
const valid = gen.let("valid", false);
|
|
23
|
-
const passing = gen.let("passing", null);
|
|
24
|
-
const schValid = gen.name("_valid");
|
|
25
|
-
cxt.setParams({ passing });
|
|
26
|
-
// TODO possibly fail straight away (with warning or exception) if there are two empty always valid schemas
|
|
27
|
-
gen.block(validateOneOf);
|
|
28
|
-
cxt.result(valid, () => cxt.reset(), () => cxt.error(true));
|
|
29
|
-
function validateOneOf() {
|
|
30
|
-
schArr.forEach((sch, i) => {
|
|
31
|
-
let schCxt;
|
|
32
|
-
if ((0, util_1.alwaysValidSchema)(it, sch)) {
|
|
33
|
-
gen.var(schValid, true);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
schCxt = cxt.subschema({
|
|
37
|
-
keyword: "oneOf",
|
|
38
|
-
schemaProp: i,
|
|
39
|
-
compositeRule: true,
|
|
40
|
-
}, schValid);
|
|
41
|
-
}
|
|
42
|
-
if (i > 0) {
|
|
43
|
-
gen
|
|
44
|
-
.if((0, codegen_1._) `${schValid} && ${valid}`)
|
|
45
|
-
.assign(valid, false)
|
|
46
|
-
.assign(passing, (0, codegen_1._) `[${passing}, ${i}]`)
|
|
47
|
-
.else();
|
|
48
|
-
}
|
|
49
|
-
gen.if(schValid, () => {
|
|
50
|
-
gen.assign(valid, true);
|
|
51
|
-
gen.assign(passing, i);
|
|
52
|
-
if (schCxt)
|
|
53
|
-
cxt.mergeEvaluated(schCxt, codegen_1.Name);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
exports.default = def;
|
|
60
|
-
//# sourceMappingURL=oneOf.js.map
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const code_1 = require('../code.js');
|
|
4
|
-
const codegen_1 = require('../../compile/codegen/index.js');
|
|
5
|
-
const util_1 = require('../../compile/util.js');
|
|
6
|
-
const util_2 = require('../../compile/util.js');
|
|
7
|
-
const def = {
|
|
8
|
-
keyword: "patternProperties",
|
|
9
|
-
type: "object",
|
|
10
|
-
schemaType: "object",
|
|
11
|
-
code(cxt) {
|
|
12
|
-
const { gen, schema, data, parentSchema, it } = cxt;
|
|
13
|
-
const { opts } = it;
|
|
14
|
-
const patterns = (0, code_1.allSchemaProperties)(schema);
|
|
15
|
-
const alwaysValidPatterns = patterns.filter((p) => (0, util_1.alwaysValidSchema)(it, schema[p]));
|
|
16
|
-
if (patterns.length === 0 ||
|
|
17
|
-
(alwaysValidPatterns.length === patterns.length &&
|
|
18
|
-
(!it.opts.unevaluated || it.props === true))) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const checkProperties = opts.strictSchema && !opts.allowMatchingProperties && parentSchema.properties;
|
|
22
|
-
const valid = gen.name("valid");
|
|
23
|
-
if (it.props !== true && !(it.props instanceof codegen_1.Name)) {
|
|
24
|
-
it.props = (0, util_2.evaluatedPropsToName)(gen, it.props);
|
|
25
|
-
}
|
|
26
|
-
const { props } = it;
|
|
27
|
-
validatePatternProperties();
|
|
28
|
-
function validatePatternProperties() {
|
|
29
|
-
for (const pat of patterns) {
|
|
30
|
-
if (checkProperties)
|
|
31
|
-
checkMatchingProperties(pat);
|
|
32
|
-
if (it.allErrors) {
|
|
33
|
-
validateProperties(pat);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
gen.var(valid, true); // TODO var
|
|
37
|
-
validateProperties(pat);
|
|
38
|
-
gen.if(valid);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function checkMatchingProperties(pat) {
|
|
43
|
-
for (const prop in checkProperties) {
|
|
44
|
-
if (new RegExp(pat).test(prop)) {
|
|
45
|
-
(0, util_1.checkStrictMode)(it, `property ${prop} matches pattern ${pat} (use allowMatchingProperties)`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
function validateProperties(pat) {
|
|
50
|
-
gen.forIn("key", data, (key) => {
|
|
51
|
-
gen.if((0, codegen_1._) `${(0, code_1.usePattern)(cxt, pat)}.test(${key})`, () => {
|
|
52
|
-
const alwaysValid = alwaysValidPatterns.includes(pat);
|
|
53
|
-
if (!alwaysValid) {
|
|
54
|
-
cxt.subschema({
|
|
55
|
-
keyword: "patternProperties",
|
|
56
|
-
schemaProp: pat,
|
|
57
|
-
dataProp: key,
|
|
58
|
-
dataPropType: util_2.Type.Str,
|
|
59
|
-
}, valid);
|
|
60
|
-
}
|
|
61
|
-
if (it.opts.unevaluated && props !== true) {
|
|
62
|
-
gen.assign((0, codegen_1._) `${props}[${key}]`, true);
|
|
63
|
-
}
|
|
64
|
-
else if (!alwaysValid && !it.allErrors) {
|
|
65
|
-
// can short-circuit if `unevaluatedProperties` is not supported (opts.next === false)
|
|
66
|
-
// or if all properties were evaluated (props === true)
|
|
67
|
-
gen.if((0, codegen_1.not)(valid), () => gen.break());
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
exports.default = def;
|
|
75
|
-
//# sourceMappingURL=patternProperties.js.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const items_1 = require('./items.js');
|
|
4
|
-
const def = {
|
|
5
|
-
keyword: "prefixItems",
|
|
6
|
-
type: "array",
|
|
7
|
-
schemaType: ["array"],
|
|
8
|
-
before: "uniqueItems",
|
|
9
|
-
code: (cxt) => (0, items_1.validateTuple)(cxt, "items"),
|
|
10
|
-
};
|
|
11
|
-
exports.default = def;
|
|
12
|
-
//# sourceMappingURL=prefixItems.js.map
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const validate_1 = require('../../compile/validate/index.js');
|
|
4
|
-
const code_1 = require('../code.js');
|
|
5
|
-
const util_1 = require('../../compile/util.js');
|
|
6
|
-
const additionalProperties_1 = require('./additionalProperties.js');
|
|
7
|
-
const def = {
|
|
8
|
-
keyword: "properties",
|
|
9
|
-
type: "object",
|
|
10
|
-
schemaType: "object",
|
|
11
|
-
code(cxt) {
|
|
12
|
-
const { gen, schema, parentSchema, data, it } = cxt;
|
|
13
|
-
if (it.opts.removeAdditional === "all" && parentSchema.additionalProperties === undefined) {
|
|
14
|
-
additionalProperties_1.default.code(new validate_1.KeywordCxt(it, additionalProperties_1.default, "additionalProperties"));
|
|
15
|
-
}
|
|
16
|
-
const allProps = (0, code_1.allSchemaProperties)(schema);
|
|
17
|
-
for (const prop of allProps) {
|
|
18
|
-
it.definedProperties.add(prop);
|
|
19
|
-
}
|
|
20
|
-
if (it.opts.unevaluated && allProps.length && it.props !== true) {
|
|
21
|
-
it.props = util_1.mergeEvaluated.props(gen, (0, util_1.toHash)(allProps), it.props);
|
|
22
|
-
}
|
|
23
|
-
const properties = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema[p]));
|
|
24
|
-
if (properties.length === 0)
|
|
25
|
-
return;
|
|
26
|
-
const valid = gen.name("valid");
|
|
27
|
-
for (const prop of properties) {
|
|
28
|
-
if (hasDefault(prop)) {
|
|
29
|
-
applyPropertySchema(prop);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties));
|
|
33
|
-
applyPropertySchema(prop);
|
|
34
|
-
if (!it.allErrors)
|
|
35
|
-
gen.else().var(valid, true);
|
|
36
|
-
gen.endIf();
|
|
37
|
-
}
|
|
38
|
-
cxt.it.definedProperties.add(prop);
|
|
39
|
-
cxt.ok(valid);
|
|
40
|
-
}
|
|
41
|
-
function hasDefault(prop) {
|
|
42
|
-
return it.opts.useDefaults && !it.compositeRule && schema[prop].default !== undefined;
|
|
43
|
-
}
|
|
44
|
-
function applyPropertySchema(prop) {
|
|
45
|
-
cxt.subschema({
|
|
46
|
-
keyword: "properties",
|
|
47
|
-
schemaProp: prop,
|
|
48
|
-
dataProp: prop,
|
|
49
|
-
}, valid);
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
exports.default = def;
|
|
54
|
-
//# sourceMappingURL=properties.js.map
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const codegen_1 = require('../../compile/codegen/index.js');
|
|
4
|
-
const util_1 = require('../../compile/util.js');
|
|
5
|
-
const error = {
|
|
6
|
-
message: "property name must be valid",
|
|
7
|
-
params: ({ params }) => (0, codegen_1._) `{propertyName: ${params.propertyName}}`,
|
|
8
|
-
};
|
|
9
|
-
const def = {
|
|
10
|
-
keyword: "propertyNames",
|
|
11
|
-
type: "object",
|
|
12
|
-
schemaType: ["object", "boolean"],
|
|
13
|
-
error,
|
|
14
|
-
code(cxt) {
|
|
15
|
-
const { gen, schema, data, it } = cxt;
|
|
16
|
-
if ((0, util_1.alwaysValidSchema)(it, schema))
|
|
17
|
-
return;
|
|
18
|
-
const valid = gen.name("valid");
|
|
19
|
-
gen.forIn("key", data, (key) => {
|
|
20
|
-
cxt.setParams({ propertyName: key });
|
|
21
|
-
cxt.subschema({
|
|
22
|
-
keyword: "propertyNames",
|
|
23
|
-
data: key,
|
|
24
|
-
dataTypes: ["string"],
|
|
25
|
-
propertyName: key,
|
|
26
|
-
compositeRule: true,
|
|
27
|
-
}, valid);
|
|
28
|
-
gen.if((0, codegen_1.not)(valid), () => {
|
|
29
|
-
cxt.error(true);
|
|
30
|
-
if (!it.allErrors)
|
|
31
|
-
gen.break();
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
cxt.ok(valid);
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
exports.default = def;
|
|
38
|
-
//# sourceMappingURL=propertyNames.js.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const util_1 = require('../../compile/util.js');
|
|
4
|
-
const def = {
|
|
5
|
-
keyword: ["then", "else"],
|
|
6
|
-
schemaType: ["object", "boolean"],
|
|
7
|
-
code({ keyword, parentSchema, it }) {
|
|
8
|
-
if (parentSchema.if === undefined)
|
|
9
|
-
(0, util_1.checkStrictMode)(it, `"${keyword}" without "if" is ignored`);
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
exports.default = def;
|
|
13
|
-
//# sourceMappingURL=thenElse.js.map
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateUnion = exports.validateArray = exports.usePattern = exports.callValidateCode = exports.schemaProperties = exports.allSchemaProperties = exports.noPropertyInData = exports.propertyInData = exports.isOwnProperty = exports.hasPropFunc = exports.reportMissingProp = exports.checkMissingProp = exports.checkReportMissingProp = void 0;
|
|
4
|
-
const codegen_1 = require('../compile/codegen/index.js');
|
|
5
|
-
const util_1 = require('../compile/util.js');
|
|
6
|
-
const names_1 = require('../compile/names.js');
|
|
7
|
-
const util_2 = require('../compile/util.js');
|
|
8
|
-
function checkReportMissingProp(cxt, prop) {
|
|
9
|
-
const { gen, data, it } = cxt;
|
|
10
|
-
gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => {
|
|
11
|
-
cxt.setParams({ missingProperty: (0, codegen_1._) `${prop}` }, true);
|
|
12
|
-
cxt.error();
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
exports.checkReportMissingProp = checkReportMissingProp;
|
|
16
|
-
function checkMissingProp({ gen, data, it: { opts } }, properties, missing) {
|
|
17
|
-
return (0, codegen_1.or)(...properties.map((prop) => (0, codegen_1.and)(noPropertyInData(gen, data, prop, opts.ownProperties), (0, codegen_1._) `${missing} = ${prop}`)));
|
|
18
|
-
}
|
|
19
|
-
exports.checkMissingProp = checkMissingProp;
|
|
20
|
-
function reportMissingProp(cxt, missing) {
|
|
21
|
-
cxt.setParams({ missingProperty: missing }, true);
|
|
22
|
-
cxt.error();
|
|
23
|
-
}
|
|
24
|
-
exports.reportMissingProp = reportMissingProp;
|
|
25
|
-
function hasPropFunc(gen) {
|
|
26
|
-
return gen.scopeValue("func", {
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
28
|
-
ref: Object.prototype.hasOwnProperty,
|
|
29
|
-
code: (0, codegen_1._) `Object.prototype.hasOwnProperty`,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
exports.hasPropFunc = hasPropFunc;
|
|
33
|
-
function isOwnProperty(gen, data, property) {
|
|
34
|
-
return (0, codegen_1._) `${hasPropFunc(gen)}.call(${data}, ${property})`;
|
|
35
|
-
}
|
|
36
|
-
exports.isOwnProperty = isOwnProperty;
|
|
37
|
-
function propertyInData(gen, data, property, ownProperties) {
|
|
38
|
-
const cond = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(property)} !== undefined`;
|
|
39
|
-
return ownProperties ? (0, codegen_1._) `${cond} && ${isOwnProperty(gen, data, property)}` : cond;
|
|
40
|
-
}
|
|
41
|
-
exports.propertyInData = propertyInData;
|
|
42
|
-
function noPropertyInData(gen, data, property, ownProperties) {
|
|
43
|
-
const cond = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(property)} === undefined`;
|
|
44
|
-
return ownProperties ? (0, codegen_1.or)(cond, (0, codegen_1.not)(isOwnProperty(gen, data, property))) : cond;
|
|
45
|
-
}
|
|
46
|
-
exports.noPropertyInData = noPropertyInData;
|
|
47
|
-
function allSchemaProperties(schemaMap) {
|
|
48
|
-
return schemaMap ? Object.keys(schemaMap).filter((p) => p !== "__proto__") : [];
|
|
49
|
-
}
|
|
50
|
-
exports.allSchemaProperties = allSchemaProperties;
|
|
51
|
-
function schemaProperties(it, schemaMap) {
|
|
52
|
-
return allSchemaProperties(schemaMap).filter((p) => !(0, util_1.alwaysValidSchema)(it, schemaMap[p]));
|
|
53
|
-
}
|
|
54
|
-
exports.schemaProperties = schemaProperties;
|
|
55
|
-
function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }, func, context, passSchema) {
|
|
56
|
-
const dataAndSchema = passSchema ? (0, codegen_1._) `${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data;
|
|
57
|
-
const valCxt = [
|
|
58
|
-
[names_1.default.instancePath, (0, codegen_1.strConcat)(names_1.default.instancePath, errorPath)],
|
|
59
|
-
[names_1.default.parentData, it.parentData],
|
|
60
|
-
[names_1.default.parentDataProperty, it.parentDataProperty],
|
|
61
|
-
[names_1.default.rootData, names_1.default.rootData],
|
|
62
|
-
];
|
|
63
|
-
if (it.opts.dynamicRef)
|
|
64
|
-
valCxt.push([names_1.default.dynamicAnchors, names_1.default.dynamicAnchors]);
|
|
65
|
-
const args = (0, codegen_1._) `${dataAndSchema}, ${gen.object(...valCxt)}`;
|
|
66
|
-
return context !== codegen_1.nil ? (0, codegen_1._) `${func}.call(${context}, ${args})` : (0, codegen_1._) `${func}(${args})`;
|
|
67
|
-
}
|
|
68
|
-
exports.callValidateCode = callValidateCode;
|
|
69
|
-
const newRegExp = (0, codegen_1._) `new RegExp`;
|
|
70
|
-
function usePattern({ gen, it: { opts } }, pattern) {
|
|
71
|
-
const u = opts.unicodeRegExp ? "u" : "";
|
|
72
|
-
const { regExp } = opts.code;
|
|
73
|
-
const rx = regExp(pattern, u);
|
|
74
|
-
return gen.scopeValue("pattern", {
|
|
75
|
-
key: rx.toString(),
|
|
76
|
-
ref: rx,
|
|
77
|
-
code: (0, codegen_1._) `${regExp.code === "new RegExp" ? newRegExp : (0, util_2.useFunc)(gen, regExp)}(${pattern}, ${u})`,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
exports.usePattern = usePattern;
|
|
81
|
-
function validateArray(cxt) {
|
|
82
|
-
const { gen, data, keyword, it } = cxt;
|
|
83
|
-
const valid = gen.name("valid");
|
|
84
|
-
if (it.allErrors) {
|
|
85
|
-
const validArr = gen.let("valid", true);
|
|
86
|
-
validateItems(() => gen.assign(validArr, false));
|
|
87
|
-
return validArr;
|
|
88
|
-
}
|
|
89
|
-
gen.var(valid, true);
|
|
90
|
-
validateItems(() => gen.break());
|
|
91
|
-
return valid;
|
|
92
|
-
function validateItems(notValid) {
|
|
93
|
-
const len = gen.const("len", (0, codegen_1._) `${data}.length`);
|
|
94
|
-
gen.forRange("i", 0, len, (i) => {
|
|
95
|
-
cxt.subschema({
|
|
96
|
-
keyword,
|
|
97
|
-
dataProp: i,
|
|
98
|
-
dataPropType: util_1.Type.Num,
|
|
99
|
-
}, valid);
|
|
100
|
-
gen.if((0, codegen_1.not)(valid), notValid);
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
exports.validateArray = validateArray;
|
|
105
|
-
function validateUnion(cxt) {
|
|
106
|
-
const { gen, schema, keyword, it } = cxt;
|
|
107
|
-
/* istanbul ignore if */
|
|
108
|
-
if (!Array.isArray(schema))
|
|
109
|
-
throw new Error("ajv implementation error");
|
|
110
|
-
const alwaysValid = schema.some((sch) => (0, util_1.alwaysValidSchema)(it, sch));
|
|
111
|
-
if (alwaysValid && !it.opts.unevaluated)
|
|
112
|
-
return;
|
|
113
|
-
const valid = gen.let("valid", false);
|
|
114
|
-
const schValid = gen.name("_valid");
|
|
115
|
-
gen.block(() => schema.forEach((_sch, i) => {
|
|
116
|
-
const schCxt = cxt.subschema({
|
|
117
|
-
keyword,
|
|
118
|
-
schemaProp: i,
|
|
119
|
-
compositeRule: true,
|
|
120
|
-
}, schValid);
|
|
121
|
-
gen.assign(valid, (0, codegen_1._) `${valid} || ${schValid}`);
|
|
122
|
-
const merged = cxt.mergeValidEvaluated(schCxt, schValid);
|
|
123
|
-
// can short-circuit if `unevaluatedProperties/Items` not supported (opts.unevaluated !== true)
|
|
124
|
-
// or if all properties and items were evaluated (it.props === true && it.items === true)
|
|
125
|
-
if (!merged)
|
|
126
|
-
gen.if((0, codegen_1.not)(valid));
|
|
127
|
-
}));
|
|
128
|
-
cxt.result(valid, () => cxt.reset(), () => cxt.error(true));
|
|
129
|
-
}
|
|
130
|
-
exports.validateUnion = validateUnion;
|
|
131
|
-
//# sourceMappingURL=code.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const def = {
|
|
4
|
-
keyword: "id",
|
|
5
|
-
code() {
|
|
6
|
-
throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID');
|
|
7
|
-
},
|
|
8
|
-
};
|
|
9
|
-
exports.default = def;
|
|
10
|
-
//# sourceMappingURL=id.js.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const id_1 = require('./id.js');
|
|
4
|
-
const ref_1 = require('./ref.js');
|
|
5
|
-
const core = [
|
|
6
|
-
"$schema",
|
|
7
|
-
"$id",
|
|
8
|
-
"$defs",
|
|
9
|
-
"$vocabulary",
|
|
10
|
-
{ keyword: "$comment" },
|
|
11
|
-
"definitions",
|
|
12
|
-
id_1.default,
|
|
13
|
-
ref_1.default,
|
|
14
|
-
];
|
|
15
|
-
exports.default = core;
|
|
16
|
-
//# sourceMappingURL=index.js.map
|