@punks/backend-entity-manager 0.0.494 → 0.0.496

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
@@ -41162,6 +41162,30 @@ const fieldRequiredValidator = (item, selector) => {
41162
41162
  validationErrors: value ? [] : [{ errorCode: "required" }],
41163
41163
  };
41164
41164
  };
41165
+ const fieldNumericValidator = (item, selector, params) => {
41166
+ const value = selector(item);
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
+ }
41184
+ return {
41185
+ isValid: !isInvalid,
41186
+ validationErrors: errors,
41187
+ };
41188
+ };
41165
41189
  const fieldTextValidator = (item, selector, params) => {
41166
41190
  const value = selector(item);
41167
41191
  const values = Array.isArray(value)
@@ -45533,6 +45557,7 @@ exports.buildRolesGuard = buildRolesGuard;
45533
45557
  exports.createContainer = createContainer;
45534
45558
  exports.createExpressFileResponse = createExpressFileResponse;
45535
45559
  exports.fieldEmailValidator = fieldEmailValidator;
45560
+ exports.fieldNumericValidator = fieldNumericValidator;
45536
45561
  exports.fieldOptionValidator = fieldOptionValidator;
45537
45562
  exports.fieldOptionsValidator = fieldOptionsValidator;
45538
45563
  exports.fieldRequiredValidator = fieldRequiredValidator;