kanun 1.0.6 → 1.0.8
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/index.cjs +4 -5
- package/dist/index.js +4 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1470,8 +1470,9 @@ var validateAttributes = class {
|
|
|
1470
1470
|
}
|
|
1471
1471
|
getAttributeValue(attribute) {
|
|
1472
1472
|
const dataValue = deepFind(this.data, attribute);
|
|
1473
|
-
|
|
1474
|
-
|
|
1473
|
+
const fileValue = deepFind(this.context.requestFiles ?? {}, attribute);
|
|
1474
|
+
if (typeof fileValue !== "undefined" && (typeof dataValue === "undefined" || dataValue === null || dataValue === "")) return fileValue;
|
|
1475
|
+
return dataValue;
|
|
1475
1476
|
}
|
|
1476
1477
|
getDistinctValues(primaryAttribute) {
|
|
1477
1478
|
const gathered = validationData.initializeAndGatherData(primaryAttribute, this.data);
|
|
@@ -2300,7 +2301,6 @@ var BaseValidator = class BaseValidator {
|
|
|
2300
2301
|
*/
|
|
2301
2302
|
withContext(context = {}) {
|
|
2302
2303
|
this.context = context;
|
|
2303
|
-
this.addRules(this.initalRules);
|
|
2304
2304
|
return this;
|
|
2305
2305
|
}
|
|
2306
2306
|
/**
|
|
@@ -2551,8 +2551,7 @@ var BaseValidator = class BaseValidator {
|
|
|
2551
2551
|
* Parse the given rules add assign them to the current rules
|
|
2552
2552
|
*/
|
|
2553
2553
|
addRules(rules) {
|
|
2554
|
-
const
|
|
2555
|
-
const response = validationRuleParser.explodeRules(dotify(rules, true), availableData);
|
|
2554
|
+
const response = validationRuleParser.explodeRules(dotify(rules, true), this.data);
|
|
2556
2555
|
this.rules = response.rules;
|
|
2557
2556
|
this.implicitAttributes = response.implicitAttributes;
|
|
2558
2557
|
}
|
package/dist/index.js
CHANGED
|
@@ -1440,8 +1440,9 @@ var validateAttributes = class {
|
|
|
1440
1440
|
}
|
|
1441
1441
|
getAttributeValue(attribute) {
|
|
1442
1442
|
const dataValue = deepFind(this.data, attribute);
|
|
1443
|
-
|
|
1444
|
-
|
|
1443
|
+
const fileValue = deepFind(this.context.requestFiles ?? {}, attribute);
|
|
1444
|
+
if (typeof fileValue !== "undefined" && (typeof dataValue === "undefined" || dataValue === null || dataValue === "")) return fileValue;
|
|
1445
|
+
return dataValue;
|
|
1445
1446
|
}
|
|
1446
1447
|
getDistinctValues(primaryAttribute) {
|
|
1447
1448
|
const gathered = validationData.initializeAndGatherData(primaryAttribute, this.data);
|
|
@@ -2270,7 +2271,6 @@ var BaseValidator = class BaseValidator {
|
|
|
2270
2271
|
*/
|
|
2271
2272
|
withContext(context = {}) {
|
|
2272
2273
|
this.context = context;
|
|
2273
|
-
this.addRules(this.initalRules);
|
|
2274
2274
|
return this;
|
|
2275
2275
|
}
|
|
2276
2276
|
/**
|
|
@@ -2521,8 +2521,7 @@ var BaseValidator = class BaseValidator {
|
|
|
2521
2521
|
* Parse the given rules add assign them to the current rules
|
|
2522
2522
|
*/
|
|
2523
2523
|
addRules(rules) {
|
|
2524
|
-
const
|
|
2525
|
-
const response = validationRuleParser.explodeRules(dotify(rules, true), availableData);
|
|
2524
|
+
const response = validationRuleParser.explodeRules(dotify(rules, true), this.data);
|
|
2526
2525
|
this.rules = response.rules;
|
|
2527
2526
|
this.implicitAttributes = response.implicitAttributes;
|
|
2528
2527
|
}
|