@punks/backend-entity-manager 0.0.495 → 0.0.498

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/cjs/index.js CHANGED
@@ -41165,9 +41165,25 @@ const fieldRequiredValidator = (item, selector) => {
41165
41165
  const fieldNumericValidator = (item, selector, params) => {
41166
41166
  const value = selector(item);
41167
41167
  const isInvalid = value && !isNaN(value);
41168
+ const errors = [];
41169
+ if (!!value && !isNaN(value)) {
41170
+ errors.push({ errorCode: "notNumeric" });
41171
+ }
41172
+ if (!!params?.min && !!value && value < params.min) {
41173
+ errors.push({
41174
+ errorCode: "min",
41175
+ payload: { current: value, expected: params.min },
41176
+ });
41177
+ }
41178
+ if (!!params?.max && !!value && value > params.max) {
41179
+ errors.push({
41180
+ errorCode: "max",
41181
+ payload: { current: value, expected: params.max },
41182
+ });
41183
+ }
41168
41184
  return {
41169
41185
  isValid: !isInvalid,
41170
- validationErrors: isInvalid ? [{ errorCode: "notNumeric" }] : [],
41186
+ validationErrors: errors,
41171
41187
  };
41172
41188
  };
41173
41189
  const fieldTextValidator = (item, selector, params) => {