@wisemen/nestjs-custom-fields 0.0.0 → 0.0.2
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/LICENSE.md +59 -0
- package/README.md +279 -0
- package/dist/custom-field-choice.d.ts +6 -0
- package/dist/custom-field-choice.js +2 -0
- package/dist/custom-field-choice.js.map +1 -0
- package/dist/custom-field-definition.d.ts +41 -0
- package/dist/custom-field-definition.js +2 -0
- package/dist/custom-field-definition.js.map +1 -0
- package/dist/custom-field-definition.uuid.d.ts +7 -0
- package/dist/custom-field-definition.uuid.js +4 -0
- package/dist/custom-field-definition.uuid.js.map +1 -0
- package/dist/custom-field-rules.d.ts +28 -0
- package/dist/custom-field-rules.js +2 -0
- package/dist/custom-field-rules.js.map +1 -0
- package/dist/custom-field-type-contract.d.ts +38 -0
- package/dist/custom-field-type-contract.js +2 -0
- package/dist/custom-field-type-contract.js.map +1 -0
- package/dist/custom-field-types/boolean/boolean.contract.d.ts +8 -0
- package/dist/custom-field-types/boolean/boolean.contract.js +2 -0
- package/dist/custom-field-types/boolean/boolean.contract.js.map +1 -0
- package/dist/custom-field-types/boolean/boolean.custom-field-definition.factory.unit.test.d.ts +1 -0
- package/dist/custom-field-types/boolean/boolean.custom-field-definition.factory.unit.test.js +21 -0
- package/dist/custom-field-types/boolean/boolean.custom-field-definition.factory.unit.test.js.map +1 -0
- package/dist/custom-field-types/boolean/boolean.custom-field-value.validator.d.ts +1 -0
- package/dist/custom-field-types/boolean/boolean.custom-field-value.validator.js +2 -0
- package/dist/custom-field-types/boolean/boolean.custom-field-value.validator.js.map +1 -0
- package/dist/custom-field-types/boolean/boolean.custom-field-value.validator.unit.test.d.ts +1 -0
- package/dist/custom-field-types/boolean/boolean.custom-field-value.validator.unit.test.js +24 -0
- package/dist/custom-field-types/boolean/boolean.custom-field-value.validator.unit.test.js.map +1 -0
- package/dist/custom-field-types/boolean/boolean.definition-validation.d.ts +7 -0
- package/dist/custom-field-types/boolean/boolean.definition-validation.js +10 -0
- package/dist/custom-field-types/boolean/boolean.definition-validation.js.map +1 -0
- package/dist/custom-field-types/boolean/boolean.dto.d.ts +9 -0
- package/dist/custom-field-types/boolean/boolean.dto.js +33 -0
- package/dist/custom-field-types/boolean/boolean.dto.js.map +1 -0
- package/dist/custom-field-types/boolean/boolean.rules.d.ts +5 -0
- package/dist/custom-field-types/boolean/boolean.rules.js +2 -0
- package/dist/custom-field-types/boolean/boolean.rules.js.map +1 -0
- package/dist/custom-field-types/boolean/boolean.value.d.ts +5 -0
- package/dist/custom-field-types/boolean/boolean.value.js +2 -0
- package/dist/custom-field-types/boolean/boolean.value.js.map +1 -0
- package/dist/custom-field-types/boolean/index.d.ts +6 -0
- package/dist/custom-field-types/boolean/index.js +7 -0
- package/dist/custom-field-types/boolean/index.js.map +1 -0
- package/dist/custom-field-types/date/date.contract.d.ts +12 -0
- package/dist/custom-field-types/date/date.contract.js +2 -0
- package/dist/custom-field-types/date/date.contract.js.map +1 -0
- package/dist/custom-field-types/date/date.custom-field-definition.factory.unit.test.d.ts +1 -0
- package/dist/custom-field-types/date/date.custom-field-definition.factory.unit.test.js +70 -0
- package/dist/custom-field-types/date/date.custom-field-definition.factory.unit.test.js.map +1 -0
- package/dist/custom-field-types/date/date.custom-field-value.validator.d.ts +6 -0
- package/dist/custom-field-types/date/date.custom-field-value.validator.js +14 -0
- package/dist/custom-field-types/date/date.custom-field-value.validator.js.map +1 -0
- package/dist/custom-field-types/date/date.custom-field-value.validator.unit.test.d.ts +1 -0
- package/dist/custom-field-types/date/date.custom-field-value.validator.unit.test.js +47 -0
- package/dist/custom-field-types/date/date.custom-field-value.validator.unit.test.js.map +1 -0
- package/dist/custom-field-types/date/date.definition-validation.d.ts +7 -0
- package/dist/custom-field-types/date/date.definition-validation.js +35 -0
- package/dist/custom-field-types/date/date.definition-validation.js.map +1 -0
- package/dist/custom-field-types/date/date.dto.d.ts +9 -0
- package/dist/custom-field-types/date/date.dto.js +34 -0
- package/dist/custom-field-types/date/date.dto.js.map +1 -0
- package/dist/custom-field-types/date/date.rules.d.ts +5 -0
- package/dist/custom-field-types/date/date.rules.js +2 -0
- package/dist/custom-field-types/date/date.rules.js.map +1 -0
- package/dist/custom-field-types/date/date.value.d.ts +5 -0
- package/dist/custom-field-types/date/date.value.js +2 -0
- package/dist/custom-field-types/date/date.value.js.map +1 -0
- package/dist/custom-field-types/date/index.d.ts +6 -0
- package/dist/custom-field-types/date/index.js +7 -0
- package/dist/custom-field-types/date/index.js.map +1 -0
- package/dist/custom-field-types/index.d.ts +9 -0
- package/dist/custom-field-types/index.js +10 -0
- package/dist/custom-field-types/index.js.map +1 -0
- package/dist/custom-field-types/monetary/index.d.ts +6 -0
- package/dist/custom-field-types/monetary/index.js +7 -0
- package/dist/custom-field-types/monetary/index.js.map +1 -0
- package/dist/custom-field-types/monetary/monetary.contract.d.ts +14 -0
- package/dist/custom-field-types/monetary/monetary.contract.js +2 -0
- package/dist/custom-field-types/monetary/monetary.contract.js.map +1 -0
- package/dist/custom-field-types/monetary/monetary.custom-field-definition.factory.unit.test.d.ts +1 -0
- package/dist/custom-field-types/monetary/monetary.custom-field-definition.factory.unit.test.js +98 -0
- package/dist/custom-field-types/monetary/monetary.custom-field-definition.factory.unit.test.js.map +1 -0
- package/dist/custom-field-types/monetary/monetary.custom-field-value.validator.d.ts +6 -0
- package/dist/custom-field-types/monetary/monetary.custom-field-value.validator.js +27 -0
- package/dist/custom-field-types/monetary/monetary.custom-field-value.validator.js.map +1 -0
- package/dist/custom-field-types/monetary/monetary.custom-field-value.validator.unit.test.d.ts +1 -0
- package/dist/custom-field-types/monetary/monetary.custom-field-value.validator.unit.test.js +130 -0
- package/dist/custom-field-types/monetary/monetary.custom-field-value.validator.unit.test.js.map +1 -0
- package/dist/custom-field-types/monetary/monetary.definition-validation.d.ts +7 -0
- package/dist/custom-field-types/monetary/monetary.definition-validation.js +25 -0
- package/dist/custom-field-types/monetary/monetary.definition-validation.js.map +1 -0
- package/dist/custom-field-types/monetary/monetary.dto.d.ts +10 -0
- package/dist/custom-field-types/monetary/monetary.dto.js +34 -0
- package/dist/custom-field-types/monetary/monetary.dto.js.map +1 -0
- package/dist/custom-field-types/monetary/monetary.rules.d.ts +5 -0
- package/dist/custom-field-types/monetary/monetary.rules.js +2 -0
- package/dist/custom-field-types/monetary/monetary.rules.js.map +1 -0
- package/dist/custom-field-types/monetary/monetary.value.d.ts +5 -0
- package/dist/custom-field-types/monetary/monetary.value.js +2 -0
- package/dist/custom-field-types/monetary/monetary.value.js.map +1 -0
- package/dist/custom-field-types/multi-select/index.d.ts +6 -0
- package/dist/custom-field-types/multi-select/index.js +7 -0
- package/dist/custom-field-types/multi-select/index.js.map +1 -0
- package/dist/custom-field-types/multi-select/multi-select.contract.d.ts +11 -0
- package/dist/custom-field-types/multi-select/multi-select.contract.js +2 -0
- package/dist/custom-field-types/multi-select/multi-select.contract.js.map +1 -0
- package/dist/custom-field-types/multi-select/multi-select.custom-field-definition.factory.unit.test.d.ts +1 -0
- package/dist/custom-field-types/multi-select/multi-select.custom-field-definition.factory.unit.test.js +169 -0
- package/dist/custom-field-types/multi-select/multi-select.custom-field-definition.factory.unit.test.js.map +1 -0
- package/dist/custom-field-types/multi-select/multi-select.custom-field-value.validator.d.ts +5 -0
- package/dist/custom-field-types/multi-select/multi-select.custom-field-value.validator.js +25 -0
- package/dist/custom-field-types/multi-select/multi-select.custom-field-value.validator.js.map +1 -0
- package/dist/custom-field-types/multi-select/multi-select.custom-field-value.validator.unit.test.d.ts +1 -0
- package/dist/custom-field-types/multi-select/multi-select.custom-field-value.validator.unit.test.js +122 -0
- package/dist/custom-field-types/multi-select/multi-select.custom-field-value.validator.unit.test.js.map +1 -0
- package/dist/custom-field-types/multi-select/multi-select.definition-validation.d.ts +7 -0
- package/dist/custom-field-types/multi-select/multi-select.definition-validation.js +45 -0
- package/dist/custom-field-types/multi-select/multi-select.definition-validation.js.map +1 -0
- package/dist/custom-field-types/multi-select/multi-select.dto.d.ts +9 -0
- package/dist/custom-field-types/multi-select/multi-select.dto.js +36 -0
- package/dist/custom-field-types/multi-select/multi-select.dto.js.map +1 -0
- package/dist/custom-field-types/multi-select/multi-select.rules.d.ts +5 -0
- package/dist/custom-field-types/multi-select/multi-select.rules.js +2 -0
- package/dist/custom-field-types/multi-select/multi-select.rules.js.map +1 -0
- package/dist/custom-field-types/multi-select/multi-select.value.d.ts +5 -0
- package/dist/custom-field-types/multi-select/multi-select.value.js +2 -0
- package/dist/custom-field-types/multi-select/multi-select.value.js.map +1 -0
- package/dist/custom-field-types/number/index.d.ts +6 -0
- package/dist/custom-field-types/number/index.js +7 -0
- package/dist/custom-field-types/number/index.js.map +1 -0
- package/dist/custom-field-types/number/number.contract.d.ts +11 -0
- package/dist/custom-field-types/number/number.contract.js +2 -0
- package/dist/custom-field-types/number/number.contract.js.map +1 -0
- package/dist/custom-field-types/number/number.custom-field-definition.factory.unit.test.d.ts +1 -0
- package/dist/custom-field-types/number/number.custom-field-definition.factory.unit.test.js +44 -0
- package/dist/custom-field-types/number/number.custom-field-definition.factory.unit.test.js.map +1 -0
- package/dist/custom-field-types/number/number.custom-field-value.validator.d.ts +5 -0
- package/dist/custom-field-types/number/number.custom-field-value.validator.js +14 -0
- package/dist/custom-field-types/number/number.custom-field-value.validator.js.map +1 -0
- package/dist/custom-field-types/number/number.custom-field-value.validator.unit.test.d.ts +1 -0
- package/dist/custom-field-types/number/number.custom-field-value.validator.unit.test.js +46 -0
- package/dist/custom-field-types/number/number.custom-field-value.validator.unit.test.js.map +1 -0
- package/dist/custom-field-types/number/number.definition-validation.d.ts +7 -0
- package/dist/custom-field-types/number/number.definition-validation.js +16 -0
- package/dist/custom-field-types/number/number.definition-validation.js.map +1 -0
- package/dist/custom-field-types/number/number.dto.d.ts +9 -0
- package/dist/custom-field-types/number/number.dto.js +33 -0
- package/dist/custom-field-types/number/number.dto.js.map +1 -0
- package/dist/custom-field-types/number/number.rules.d.ts +5 -0
- package/dist/custom-field-types/number/number.rules.js +2 -0
- package/dist/custom-field-types/number/number.rules.js.map +1 -0
- package/dist/custom-field-types/number/number.value.d.ts +5 -0
- package/dist/custom-field-types/number/number.value.js +2 -0
- package/dist/custom-field-types/number/number.value.js.map +1 -0
- package/dist/custom-field-types/single-select/index.d.ts +6 -0
- package/dist/custom-field-types/single-select/index.js +7 -0
- package/dist/custom-field-types/single-select/index.js.map +1 -0
- package/dist/custom-field-types/single-select/single-select.contract.d.ts +8 -0
- package/dist/custom-field-types/single-select/single-select.contract.js +2 -0
- package/dist/custom-field-types/single-select/single-select.contract.js.map +1 -0
- package/dist/custom-field-types/single-select/single-select.custom-field-definition.factory.unit.test.d.ts +1 -0
- package/dist/custom-field-types/single-select/single-select.custom-field-definition.factory.unit.test.js +100 -0
- package/dist/custom-field-types/single-select/single-select.custom-field-definition.factory.unit.test.js.map +1 -0
- package/dist/custom-field-types/single-select/single-select.custom-field-value.validator.d.ts +5 -0
- package/dist/custom-field-types/single-select/single-select.custom-field-value.validator.js +10 -0
- package/dist/custom-field-types/single-select/single-select.custom-field-value.validator.js.map +1 -0
- package/dist/custom-field-types/single-select/single-select.custom-field-value.validator.unit.test.d.ts +1 -0
- package/dist/custom-field-types/single-select/single-select.custom-field-value.validator.unit.test.js +57 -0
- package/dist/custom-field-types/single-select/single-select.custom-field-value.validator.unit.test.js.map +1 -0
- package/dist/custom-field-types/single-select/single-select.definition-validation.d.ts +7 -0
- package/dist/custom-field-types/single-select/single-select.definition-validation.js +25 -0
- package/dist/custom-field-types/single-select/single-select.definition-validation.js.map +1 -0
- package/dist/custom-field-types/single-select/single-select.dto.d.ts +9 -0
- package/dist/custom-field-types/single-select/single-select.dto.js +34 -0
- package/dist/custom-field-types/single-select/single-select.dto.js.map +1 -0
- package/dist/custom-field-types/single-select/single-select.rules.d.ts +5 -0
- package/dist/custom-field-types/single-select/single-select.rules.js +2 -0
- package/dist/custom-field-types/single-select/single-select.rules.js.map +1 -0
- package/dist/custom-field-types/single-select/single-select.value.d.ts +5 -0
- package/dist/custom-field-types/single-select/single-select.value.js +2 -0
- package/dist/custom-field-types/single-select/single-select.value.js.map +1 -0
- package/dist/custom-field-types/text/index.d.ts +6 -0
- package/dist/custom-field-types/text/index.js +7 -0
- package/dist/custom-field-types/text/index.js.map +1 -0
- package/dist/custom-field-types/text/text.contract.d.ts +12 -0
- package/dist/custom-field-types/text/text.contract.js +2 -0
- package/dist/custom-field-types/text/text.contract.js.map +1 -0
- package/dist/custom-field-types/text/text.custom-field-definition.factory.unit.test.d.ts +1 -0
- package/dist/custom-field-types/text/text.custom-field-definition.factory.unit.test.js +128 -0
- package/dist/custom-field-types/text/text.custom-field-definition.factory.unit.test.js.map +1 -0
- package/dist/custom-field-types/text/text.custom-field-value.validator.d.ts +5 -0
- package/dist/custom-field-types/text/text.custom-field-value.validator.js +17 -0
- package/dist/custom-field-types/text/text.custom-field-value.validator.js.map +1 -0
- package/dist/custom-field-types/text/text.custom-field-value.validator.unit.test.d.ts +1 -0
- package/dist/custom-field-types/text/text.custom-field-value.validator.unit.test.js +64 -0
- package/dist/custom-field-types/text/text.custom-field-value.validator.unit.test.js.map +1 -0
- package/dist/custom-field-types/text/text.definition-validation.d.ts +7 -0
- package/dist/custom-field-types/text/text.definition-validation.js +30 -0
- package/dist/custom-field-types/text/text.definition-validation.js.map +1 -0
- package/dist/custom-field-types/text/text.dto.d.ts +9 -0
- package/dist/custom-field-types/text/text.dto.js +33 -0
- package/dist/custom-field-types/text/text.dto.js.map +1 -0
- package/dist/custom-field-types/text/text.rules.d.ts +5 -0
- package/dist/custom-field-types/text/text.rules.js +2 -0
- package/dist/custom-field-types/text/text.rules.js.map +1 -0
- package/dist/custom-field-types/text/text.value.d.ts +5 -0
- package/dist/custom-field-types/text/text.value.js +2 -0
- package/dist/custom-field-types/text/text.value.js.map +1 -0
- package/dist/custom-field-types/text-array/index.d.ts +6 -0
- package/dist/custom-field-types/text-array/index.js +7 -0
- package/dist/custom-field-types/text-array/index.js.map +1 -0
- package/dist/custom-field-types/text-array/text-array.contract.d.ts +11 -0
- package/dist/custom-field-types/text-array/text-array.contract.js +2 -0
- package/dist/custom-field-types/text-array/text-array.contract.js.map +1 -0
- package/dist/custom-field-types/text-array/text-array.custom-field-definition.factory.unit.test.d.ts +1 -0
- package/dist/custom-field-types/text-array/text-array.custom-field-definition.factory.unit.test.js +71 -0
- package/dist/custom-field-types/text-array/text-array.custom-field-definition.factory.unit.test.js.map +1 -0
- package/dist/custom-field-types/text-array/text-array.custom-field-value.validator.d.ts +5 -0
- package/dist/custom-field-types/text-array/text-array.custom-field-value.validator.js +14 -0
- package/dist/custom-field-types/text-array/text-array.custom-field-value.validator.js.map +1 -0
- package/dist/custom-field-types/text-array/text-array.custom-field-value.validator.unit.test.d.ts +1 -0
- package/dist/custom-field-types/text-array/text-array.custom-field-value.validator.unit.test.js +46 -0
- package/dist/custom-field-types/text-array/text-array.custom-field-value.validator.unit.test.js.map +1 -0
- package/dist/custom-field-types/text-array/text-array.definition-validation.d.ts +7 -0
- package/dist/custom-field-types/text-array/text-array.definition-validation.js +22 -0
- package/dist/custom-field-types/text-array/text-array.definition-validation.js.map +1 -0
- package/dist/custom-field-types/text-array/text-array.dto.d.ts +9 -0
- package/dist/custom-field-types/text-array/text-array.dto.js +36 -0
- package/dist/custom-field-types/text-array/text-array.dto.js.map +1 -0
- package/dist/custom-field-types/text-array/text-array.rules.d.ts +5 -0
- package/dist/custom-field-types/text-array/text-array.rules.js +2 -0
- package/dist/custom-field-types/text-array/text-array.rules.js.map +1 -0
- package/dist/custom-field-types/text-array/text-array.value.d.ts +5 -0
- package/dist/custom-field-types/text-array/text-array.value.js +2 -0
- package/dist/custom-field-types/text-array/text-array.value.js.map +1 -0
- package/dist/custom-field-types/timestamp/index.d.ts +6 -0
- package/dist/custom-field-types/timestamp/index.js +7 -0
- package/dist/custom-field-types/timestamp/index.js.map +1 -0
- package/dist/custom-field-types/timestamp/timestamp.contract.d.ts +12 -0
- package/dist/custom-field-types/timestamp/timestamp.contract.js +2 -0
- package/dist/custom-field-types/timestamp/timestamp.contract.js.map +1 -0
- package/dist/custom-field-types/timestamp/timestamp.custom-field-definition.factory.unit.test.d.ts +1 -0
- package/dist/custom-field-types/timestamp/timestamp.custom-field-definition.factory.unit.test.js +70 -0
- package/dist/custom-field-types/timestamp/timestamp.custom-field-definition.factory.unit.test.js.map +1 -0
- package/dist/custom-field-types/timestamp/timestamp.custom-field-value.validator.d.ts +6 -0
- package/dist/custom-field-types/timestamp/timestamp.custom-field-value.validator.js +14 -0
- package/dist/custom-field-types/timestamp/timestamp.custom-field-value.validator.js.map +1 -0
- package/dist/custom-field-types/timestamp/timestamp.custom-field-value.validator.unit.test.d.ts +1 -0
- package/dist/custom-field-types/timestamp/timestamp.custom-field-value.validator.unit.test.js +47 -0
- package/dist/custom-field-types/timestamp/timestamp.custom-field-value.validator.unit.test.js.map +1 -0
- package/dist/custom-field-types/timestamp/timestamp.definition-validation.d.ts +7 -0
- package/dist/custom-field-types/timestamp/timestamp.definition-validation.js +38 -0
- package/dist/custom-field-types/timestamp/timestamp.definition-validation.js.map +1 -0
- package/dist/custom-field-types/timestamp/timestamp.dto.d.ts +9 -0
- package/dist/custom-field-types/timestamp/timestamp.dto.js +35 -0
- package/dist/custom-field-types/timestamp/timestamp.dto.js.map +1 -0
- package/dist/custom-field-types/timestamp/timestamp.rules.d.ts +5 -0
- package/dist/custom-field-types/timestamp/timestamp.rules.js +2 -0
- package/dist/custom-field-types/timestamp/timestamp.rules.js.map +1 -0
- package/dist/custom-field-types/timestamp/timestamp.value.d.ts +5 -0
- package/dist/custom-field-types/timestamp/timestamp.value.js +2 -0
- package/dist/custom-field-types/timestamp/timestamp.value.js.map +1 -0
- package/dist/custom-field-value.d.ts +17 -0
- package/dist/custom-field-value.js +2 -0
- package/dist/custom-field-value.js.map +1 -0
- package/dist/decorators/is-custom-fields.decorator.d.ts +1 -0
- package/dist/decorators/is-custom-fields.decorator.js +14 -0
- package/dist/decorators/is-custom-fields.decorator.js.map +1 -0
- package/dist/dto/base-custom-field-value.dto.d.ts +15 -0
- package/dist/dto/base-custom-field-value.dto.js +33 -0
- package/dist/dto/base-custom-field-value.dto.js.map +1 -0
- package/dist/dto/custom-field-value.dto.d.ts +46 -0
- package/dist/dto/custom-field-value.dto.js +72 -0
- package/dist/dto/custom-field-value.dto.js.map +1 -0
- package/dist/dto/custom-field-value.dto.unit.test.d.ts +1 -0
- package/dist/dto/custom-field-value.dto.unit.test.js +74 -0
- package/dist/dto/custom-field-value.dto.unit.test.js.map +1 -0
- package/dist/enum/custom-field-type.enum.d.ts +15 -0
- package/dist/enum/custom-field-type.enum.js +28 -0
- package/dist/enum/custom-field-type.enum.js.map +1 -0
- package/dist/errors/custom-field-definition.error.d.ts +2 -0
- package/dist/errors/custom-field-definition.error.js +3 -0
- package/dist/errors/custom-field-definition.error.js.map +1 -0
- package/dist/exhaustive-check.d.ts +1 -0
- package/dist/exhaustive-check.js +4 -0
- package/dist/exhaustive-check.js.map +1 -0
- package/dist/factory/custom-field-definition.factory.d.ts +41 -0
- package/dist/factory/custom-field-definition.factory.js +125 -0
- package/dist/factory/custom-field-definition.factory.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/repositories/custom-field-definition.repository.module.d.ts +2 -0
- package/dist/repositories/custom-field-definition.repository.module.js +27 -0
- package/dist/repositories/custom-field-definition.repository.module.js.map +1 -0
- package/dist/repositories/custom-field-definitions.repository.d.ts +11 -0
- package/dist/repositories/custom-field-definitions.repository.integration.test.d.ts +1 -0
- package/dist/repositories/custom-field-definitions.repository.integration.test.js +174 -0
- package/dist/repositories/custom-field-definitions.repository.integration.test.js.map +1 -0
- package/dist/repositories/custom-field-definitions.repository.js +40 -0
- package/dist/repositories/custom-field-definitions.repository.js.map +1 -0
- package/dist/repositories/index.d.ts +2 -0
- package/dist/repositories/index.js +3 -0
- package/dist/repositories/index.js.map +1 -0
- package/dist/responses/custom-field-definition.response.d.ts +26 -0
- package/dist/responses/custom-field-definition.response.js +99 -0
- package/dist/responses/custom-field-definition.response.js.map +1 -0
- package/dist/responses/custom-field-definition.response.unit.test.d.ts +1 -0
- package/dist/responses/custom-field-definition.response.unit.test.js +96 -0
- package/dist/responses/custom-field-definition.response.unit.test.js.map +1 -0
- package/dist/tests/sql/datasource.d.ts +2 -0
- package/dist/tests/sql/datasource.js +17 -0
- package/dist/tests/sql/datasource.js.map +1 -0
- package/dist/tests/test-setup.d.ts +8 -0
- package/dist/tests/test-setup.js +46 -0
- package/dist/tests/test-setup.js.map +1 -0
- package/dist/typeorm/custom-field-choice.column.d.ts +2 -0
- package/dist/typeorm/custom-field-choice.column.js +49 -0
- package/dist/typeorm/custom-field-choice.column.js.map +1 -0
- package/dist/typeorm/custom-field-definition.entity.d.ts +20 -0
- package/dist/typeorm/custom-field-definition.entity.js +82 -0
- package/dist/typeorm/custom-field-definition.entity.js.map +1 -0
- package/dist/typeorm/custom-field-value.column.d.ts +2 -0
- package/dist/typeorm/custom-field-value.column.js +102 -0
- package/dist/typeorm/custom-field-value.column.js.map +1 -0
- package/dist/validators/custom-field-value-validation.error.d.ts +6 -0
- package/dist/validators/custom-field-value-validation.error.js +22 -0
- package/dist/validators/custom-field-value-validation.error.js.map +1 -0
- package/dist/validators/custom-field-value.validator.d.ts +4 -0
- package/dist/validators/custom-field-value.validator.js +81 -0
- package/dist/validators/custom-field-value.validator.js.map +1 -0
- package/dist/validators/custom-field-value.validator.unit.test.d.ts +1 -0
- package/dist/validators/custom-field-value.validator.unit.test.js +166 -0
- package/dist/validators/custom-field-value.validator.unit.test.js.map +1 -0
- package/package.json +56 -3
- package/skills/getting-started/SKILL.md +263 -0
package/dist/custom-field-types/multi-select/multi-select.custom-field-value.validator.unit.test.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { describe, it } from 'node:test';
|
|
2
|
+
import { LocalizedString } from '@wisemen/localized-string';
|
|
3
|
+
import { customFieldDefinition } from '#src/factory/custom-field-definition.factory.js';
|
|
4
|
+
import { CustomFieldType } from '#src/enum/custom-field-type.enum.js';
|
|
5
|
+
import { validateCustomFieldValue } from '#src/validators/custom-field-value.validator.js';
|
|
6
|
+
import { CustomFieldValueValidationError } from '#src/validators/custom-field-value-validation.error.js';
|
|
7
|
+
import { expect } from 'expect';
|
|
8
|
+
describe('multi select validateCustomFieldValue', () => {
|
|
9
|
+
it('rejects a multi select custom field value containing an undefined choice', () => {
|
|
10
|
+
const definition = customFieldDefinition(CustomFieldType.MULTI_SELECT, {
|
|
11
|
+
tenantUuid: null,
|
|
12
|
+
entityType: 'invoice',
|
|
13
|
+
key: 'labels',
|
|
14
|
+
label: new LocalizedString([{ locale: 'en', value: 'Labels' }]),
|
|
15
|
+
description: null,
|
|
16
|
+
isRequired: false,
|
|
17
|
+
choices: [
|
|
18
|
+
{
|
|
19
|
+
value: 'finance',
|
|
20
|
+
label: new LocalizedString([{ locale: 'en', value: 'Finance' }]),
|
|
21
|
+
order: 1
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
});
|
|
25
|
+
expect(() => validateCustomFieldValue(definition, {
|
|
26
|
+
definitionUuid: definition.uuid,
|
|
27
|
+
type: CustomFieldType.MULTI_SELECT,
|
|
28
|
+
value: ['finance', 'missing']
|
|
29
|
+
})).toThrow(new CustomFieldValueValidationError('Multi select custom field value must only contain defined choices'));
|
|
30
|
+
});
|
|
31
|
+
it('rejects a multi select custom field value containing duplicate selections', () => {
|
|
32
|
+
const definition = customFieldDefinition(CustomFieldType.MULTI_SELECT, {
|
|
33
|
+
tenantUuid: null,
|
|
34
|
+
entityType: 'invoice',
|
|
35
|
+
key: 'labels',
|
|
36
|
+
label: new LocalizedString([{ locale: 'en', value: 'Labels' }]),
|
|
37
|
+
description: null,
|
|
38
|
+
isRequired: false,
|
|
39
|
+
choices: [
|
|
40
|
+
{
|
|
41
|
+
value: 'finance',
|
|
42
|
+
label: new LocalizedString([{ locale: 'en', value: 'Finance' }]),
|
|
43
|
+
order: 1
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
value: 'priority',
|
|
47
|
+
label: new LocalizedString([{ locale: 'en', value: 'Priority' }]),
|
|
48
|
+
order: 2
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
rules: {
|
|
52
|
+
minSelections: 2
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
expect(() => validateCustomFieldValue(definition, {
|
|
56
|
+
definitionUuid: definition.uuid,
|
|
57
|
+
type: CustomFieldType.MULTI_SELECT,
|
|
58
|
+
value: ['finance', 'finance']
|
|
59
|
+
})).toThrow(new CustomFieldValueValidationError('Multi select custom field value can not contain duplicate values'));
|
|
60
|
+
});
|
|
61
|
+
it('rejects a multi select custom field value with fewer than minSelections', () => {
|
|
62
|
+
const definition = customFieldDefinition(CustomFieldType.MULTI_SELECT, {
|
|
63
|
+
tenantUuid: null,
|
|
64
|
+
entityType: 'invoice',
|
|
65
|
+
key: 'labels',
|
|
66
|
+
label: new LocalizedString([{ locale: 'en', value: 'Labels' }]),
|
|
67
|
+
description: null,
|
|
68
|
+
isRequired: false,
|
|
69
|
+
choices: [
|
|
70
|
+
{
|
|
71
|
+
value: 'finance',
|
|
72
|
+
label: new LocalizedString([{ locale: 'en', value: 'Finance' }]),
|
|
73
|
+
order: 1
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
value: 'priority',
|
|
77
|
+
label: new LocalizedString([{ locale: 'en', value: 'Priority' }]),
|
|
78
|
+
order: 2
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
rules: {
|
|
82
|
+
minSelections: 2
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
expect(() => validateCustomFieldValue(definition, {
|
|
86
|
+
definitionUuid: definition.uuid,
|
|
87
|
+
type: CustomFieldType.MULTI_SELECT,
|
|
88
|
+
value: ['finance']
|
|
89
|
+
})).toThrow(new CustomFieldValueValidationError('Multi select custom field value can not contain fewer than minSelections'));
|
|
90
|
+
});
|
|
91
|
+
it('rejects a multi select custom field value with more than maxSelections', () => {
|
|
92
|
+
const definition = customFieldDefinition(CustomFieldType.MULTI_SELECT, {
|
|
93
|
+
tenantUuid: null,
|
|
94
|
+
entityType: 'invoice',
|
|
95
|
+
key: 'labels',
|
|
96
|
+
label: new LocalizedString([{ locale: 'en', value: 'Labels' }]),
|
|
97
|
+
description: null,
|
|
98
|
+
isRequired: false,
|
|
99
|
+
choices: [
|
|
100
|
+
{
|
|
101
|
+
value: 'finance',
|
|
102
|
+
label: new LocalizedString([{ locale: 'en', value: 'Finance' }]),
|
|
103
|
+
order: 1
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
value: 'priority',
|
|
107
|
+
label: new LocalizedString([{ locale: 'en', value: 'Priority' }]),
|
|
108
|
+
order: 2
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
rules: {
|
|
112
|
+
maxSelections: 1
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
expect(() => validateCustomFieldValue(definition, {
|
|
116
|
+
definitionUuid: definition.uuid,
|
|
117
|
+
type: CustomFieldType.MULTI_SELECT,
|
|
118
|
+
value: ['finance', 'priority']
|
|
119
|
+
})).toThrow(new CustomFieldValueValidationError('Multi select custom field value can not contain more than maxSelections'));
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
//# sourceMappingURL=multi-select.custom-field-value.validator.unit.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-select.custom-field-value.validator.unit.test.js","sourceRoot":"","sources":["../../../lib/custom-field-types/multi-select/multi-select.custom-field-value.validator.unit.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,iDAAiD,CAAA;AACvF,OAAO,EAAE,eAAe,EA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BACT;gBACD;oBACE,KAAK,EAAE,UAAU;oBACjB,KAAK,EAAE,IAAI,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;oBACjE,KAAK,EAAE,CAAC;iBACT;aACF;YACD,KAAK,EAAE;gBACL,aAAa,EAAE,CAAC;aACjB;SACF,CAAC,CAAA;QAEF,MAAM,CAAC,GAAG,EAAE,CAAC,wBAAwB,CAAC,UAAU,EAAE;YAChD,cAAc,EAAE,UAAU,CAAC,IAAI;YAC/B,IAAI,EAAE,eAAe,CAAC,YAAY;YAClC,KAAK,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC;SAC/B,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,+BAA+B,CAAC,yEAAyE,CAAC,CAAC,CAAA;IAC7H,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ResolvedCustomFieldDefinitionFields } from '#src/custom-field-definition.js';
|
|
2
|
+
import { CustomFieldType } from '#src/enum/custom-field-type.enum.js';
|
|
3
|
+
type MultiSelectCustomFieldDefinition = Extract<ResolvedCustomFieldDefinitionFields, {
|
|
4
|
+
type: CustomFieldType.MULTI_SELECT;
|
|
5
|
+
}>;
|
|
6
|
+
export declare function validateMultiSelectCustomFieldDefinition(definition: MultiSelectCustomFieldDefinition): void;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { CustomFieldDefinitionError } from '#src/errors/custom-field-definition.error.js';
|
|
2
|
+
export function validateMultiSelectCustomFieldDefinition(definition) {
|
|
3
|
+
validateSelectChoices(definition.choices);
|
|
4
|
+
const rules = definition.rules;
|
|
5
|
+
if (rules === null) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
if (rules.minSelections !== undefined && rules.minSelections < 0) {
|
|
9
|
+
throw new CustomFieldDefinitionError('Multi select custom field minSelections can not be negative');
|
|
10
|
+
}
|
|
11
|
+
if (rules.maxSelections !== undefined && rules.maxSelections < 0) {
|
|
12
|
+
throw new CustomFieldDefinitionError('Multi select custom field maxSelections can not be negative');
|
|
13
|
+
}
|
|
14
|
+
if (rules.minSelections !== undefined
|
|
15
|
+
&& rules.maxSelections !== undefined
|
|
16
|
+
&& rules.minSelections > rules.maxSelections) {
|
|
17
|
+
throw new CustomFieldDefinitionError('Multi select custom field minSelections can not be greater than maxSelections');
|
|
18
|
+
}
|
|
19
|
+
if (rules.maxSelections !== undefined
|
|
20
|
+
&& rules.maxSelections > definition.choices.length) {
|
|
21
|
+
throw new CustomFieldDefinitionError('Multi select custom field maxSelections can not exceed the amount of choices');
|
|
22
|
+
}
|
|
23
|
+
if (rules.minSelections !== undefined
|
|
24
|
+
&& rules.minSelections > definition.choices.length) {
|
|
25
|
+
throw new CustomFieldDefinitionError('Multi select custom field minSelections can not exceed the amount of choices');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function validateSelectChoices(choices) {
|
|
29
|
+
if (choices.length === 0) {
|
|
30
|
+
throw new CustomFieldDefinitionError('Select custom field must define at least one choice');
|
|
31
|
+
}
|
|
32
|
+
const choiceValues = new Set();
|
|
33
|
+
const choiceOrders = new Set();
|
|
34
|
+
for (const choice of choices) {
|
|
35
|
+
if (choiceValues.has(choice.value)) {
|
|
36
|
+
throw new CustomFieldDefinitionError('Custom field choice value must be unique');
|
|
37
|
+
}
|
|
38
|
+
if (choiceOrders.has(choice.order)) {
|
|
39
|
+
throw new CustomFieldDefinitionError('Custom field choice order must be unique');
|
|
40
|
+
}
|
|
41
|
+
choiceValues.add(choice.value);
|
|
42
|
+
choiceOrders.add(choice.order);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=multi-select.definition-validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-select.definition-validation.js","sourceRoot":"","sources":["../../../lib/custom-field-types/multi-select/multi-select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AC,EAAE,CAAC;QACzB,MAAM,IAAI,0BAA0B,CAAC,qDAAqD,CAAC,CAAA;IAC7F,CAAC;IAED,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU,CAAA;IACtC,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU,CAAA;IAEtC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,0BAA0B,CAAC,0CAA0C,CAAC,CAAA;QAClF,CAAC;QAED,IAAI,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,0BAA0B,CAAC,0CAA0C,CAAC,CAAA;QAClF,CAAC;QAED,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QAC9B,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAChC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseCustomFieldValueDto } from '#src/dto/base-custom-field-value.dto.js';
|
|
2
|
+
import { CustomFieldType } from '#src/enum/custom-field-type.enum.js';
|
|
3
|
+
import { MultiSelectCustomFieldValue } from '#src/custom-field-types/multi-select/multi-select.value.js';
|
|
4
|
+
export declare class MultiSelectCustomFieldValueDto extends BaseCustomFieldValueDto {
|
|
5
|
+
type: CustomFieldType.MULTI_SELECT;
|
|
6
|
+
value: string[];
|
|
7
|
+
parse(): MultiSelectCustomFieldValue;
|
|
8
|
+
static from(customFieldValue: MultiSelectCustomFieldValue): MultiSelectCustomFieldValueDto;
|
|
9
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
11
|
+
import { ArrayUnique, IsArray, IsEnum, IsNotEmpty, IsString } from 'class-validator';
|
|
12
|
+
import { BaseCustomFieldValueDto, createCustomFieldValueDto } from '#src/dto/base-custom-field-value.dto.js';
|
|
13
|
+
import { CustomFieldType } from '#src/enum/custom-field-type.enum.js';
|
|
14
|
+
export class MultiSelectCustomFieldValueDto extends BaseCustomFieldValueDto {
|
|
15
|
+
value;
|
|
16
|
+
parse() {
|
|
17
|
+
return this.toCustomFieldValue(CustomFieldType.MULTI_SELECT, this.value);
|
|
18
|
+
}
|
|
19
|
+
static from(customFieldValue) {
|
|
20
|
+
return createCustomFieldValueDto(new MultiSelectCustomFieldValueDto(), CustomFieldType.MULTI_SELECT, customFieldValue.definitionUuid, customFieldValue.value);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
__decorate([
|
|
24
|
+
ApiProperty({ enum: [CustomFieldType.MULTI_SELECT] }),
|
|
25
|
+
IsEnum([CustomFieldType.MULTI_SELECT]),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], MultiSelectCustomFieldValueDto.prototype, "type", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
ApiProperty({ type: String, isArray: true }),
|
|
30
|
+
IsString({ each: true }),
|
|
31
|
+
IsNotEmpty({ each: true }),
|
|
32
|
+
IsArray(),
|
|
33
|
+
ArrayUnique(),
|
|
34
|
+
__metadata("design:type", Array)
|
|
35
|
+
], MultiSelectCustomFieldValueDto.prototype, "value", void 0);
|
|
36
|
+
//# sourceMappingURL=multi-select.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-select.dto.js","sourceRoot":"","sources":["../../../lib/custom-field-types/multi-select/multi-select.dto.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACpF,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAA;AAC5G,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAGrE,MAAM,OAAO,8BAA+B,SAAQ,uBAAuB;IAUzE,KAAK,CAAU;IAEf,KAAK;QACH,OAAO,IAAI,CAAC,kBAAkB,CAAC,eAAe,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;IAC1E,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,gBAA6C;QACvD,OAAO,yBAAyB,CAAC,IAAI,8BAA8B,EAAE,EAAE,eAAe,CAAC,YAAY,EAAE,gBAAgB,CAAC,cAAc,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAA;IAC/J,CAAC;CACF;AAhBS;IAFP,WAAW,CAAC,EAAE,IAAI,EAAE,CAAC,eAAe,CAAC,YAAY,CAAC,EAAE,CAAC;IACrD,MAAM,CAAC,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;;4DACG;AAO1C;IALC,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC5C,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACxB,UAAU,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC1B,OAAO,EAAE;IACT,WAAW,EAAE;;6DACC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CustomFieldType } from '#src/enum/custom-field-type.enum.js';
|
|
2
|
+
import type { MultiSelectCustomFieldTypeContract } from './multi-select.contract.js';
|
|
3
|
+
export type MultiSelectCustomFieldRules = {
|
|
4
|
+
type: CustomFieldType.MULTI_SELECT;
|
|
5
|
+
} & MultiSelectCustomFieldTypeContract['rules'];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-select.rules.js","sourceRoot":"","sources":["../../../lib/custom-field-types/multi-select/multi-select.rules.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BaseCustomFieldValue } from '#src/custom-field-value.js';
|
|
2
|
+
import { CustomFieldType } from '#src/enum/custom-field-type.enum.js';
|
|
3
|
+
import type { MultiSelectCustomFieldTypeContract } from './multi-select.contract.js';
|
|
4
|
+
export type MultiSelectCustomFieldValue = BaseCustomFieldValue<CustomFieldType.MULTI_SELECT, MultiSelectCustomFieldTypeContract['value']>;
|
|
5
|
+
export type MultiSelectCustomFieldColumnValue = BaseCustomFieldValue<CustomFieldType.MULTI_SELECT, MultiSelectCustomFieldTypeContract['columnValue']>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-select.value.js","sourceRoot":"","sources":["../../../lib/custom-field-types/multi-select/multi-select.value.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './number.contract.js';
|
|
2
|
+
export * from './number.definition-validation.js';
|
|
3
|
+
export * from './number.dto.js';
|
|
4
|
+
export * from './number.rules.js';
|
|
5
|
+
export * from './number.custom-field-value.validator.js';
|
|
6
|
+
export * from './number.value.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/custom-field-types/number/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,mCAAmC,CAAA;AACjD,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,0CAA0C,CAAA;AACxD,cAAc,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DefineContract } from '#src/custom-field-type-contract.js';
|
|
2
|
+
export type NumberCustomFieldTypeContract = DefineContract<{
|
|
3
|
+
value: number;
|
|
4
|
+
columnValue: number;
|
|
5
|
+
rules: {
|
|
6
|
+
min?: number;
|
|
7
|
+
max?: number;
|
|
8
|
+
};
|
|
9
|
+
rulesMode: 'optional';
|
|
10
|
+
choicesMode: 'none';
|
|
11
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.contract.js","sourceRoot":"","sources":["../../../lib/custom-field-types/number/number.contract.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { describe, it } from 'node:test';
|
|
2
|
+
import { expect } from 'expect';
|
|
3
|
+
import { LocalizedString } from '@wisemen/localized-string';
|
|
4
|
+
import { CustomFieldDefinitionError } from '#src/errors/custom-field-definition.error.js';
|
|
5
|
+
import { CustomFieldType } from '#src/enum/custom-field-type.enum.js';
|
|
6
|
+
import { customFieldDefinition } from '#src/factory/custom-field-definition.factory.js';
|
|
7
|
+
describe('number customFieldDefinition', () => {
|
|
8
|
+
it('creates a number custom field definition', () => {
|
|
9
|
+
const definition = customFieldDefinition(CustomFieldType.NUMBER, {
|
|
10
|
+
tenantUuid: null,
|
|
11
|
+
entityType: 'invoice',
|
|
12
|
+
key: 'priority',
|
|
13
|
+
label: new LocalizedString([{ locale: 'en', value: 'Priority' }]),
|
|
14
|
+
description: null,
|
|
15
|
+
isRequired: false,
|
|
16
|
+
rules: {
|
|
17
|
+
min: 1,
|
|
18
|
+
max: 5
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
expect(definition.type).toBe(CustomFieldType.NUMBER);
|
|
22
|
+
expect(definition.choices).toBeNull();
|
|
23
|
+
expect(definition.rules).toEqual({
|
|
24
|
+
type: CustomFieldType.NUMBER,
|
|
25
|
+
min: 1,
|
|
26
|
+
max: 5
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
it('rejects a number field whose min exceeds max', () => {
|
|
30
|
+
expect(() => customFieldDefinition(CustomFieldType.NUMBER, {
|
|
31
|
+
tenantUuid: null,
|
|
32
|
+
entityType: 'invoice',
|
|
33
|
+
key: 'priority',
|
|
34
|
+
label: new LocalizedString([{ locale: 'en', value: 'Priority' }]),
|
|
35
|
+
description: null,
|
|
36
|
+
isRequired: false,
|
|
37
|
+
rules: {
|
|
38
|
+
min: 10,
|
|
39
|
+
max: 5
|
|
40
|
+
}
|
|
41
|
+
})).toThrow(new CustomFieldDefinitionError('Number custom field min can not be greater than max'));
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=number.custom-field-definition.factory.unit.test.js.map
|
package/dist/custom-field-types/number/number.custom-field-definition.factory.unit.test.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.custom-field-definition.factory.unit.test.js","sourceRoot":"","sources":["../../../lib/custom-field-types/number/number.custom-field-definition.factory.unit.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAA;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iDAAiD,CAAA;AAEvF,QAAQ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CAAC,CAAC,OAAO,CAAC,IAAI,0BAA0B,CAAC,qDAAqD,CAAC,CAAC,CAAA;IACpG,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CustomFieldDefinitionFieldsByType } from '#src/custom-field-definition.js';
|
|
2
|
+
import { CustomFieldType } from '#src/enum/custom-field-type.enum.js';
|
|
3
|
+
type NumberCustomFieldDefinition = CustomFieldDefinitionFieldsByType<CustomFieldType.NUMBER>;
|
|
4
|
+
export declare function validateNumberCustomFieldValue(definition: NumberCustomFieldDefinition, value: number): void;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CustomFieldValueValidationError } from '#src/validators/custom-field-value-validation.error.js';
|
|
2
|
+
export function validateNumberCustomFieldValue(definition, value) {
|
|
3
|
+
const rules = definition.rules;
|
|
4
|
+
if (rules === null) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
if (rules.min !== undefined && value < rules.min) {
|
|
8
|
+
throw new CustomFieldValueValidationError('Number custom field value can not be lower than min');
|
|
9
|
+
}
|
|
10
|
+
if (rules.max !== undefined && value > rules.max) {
|
|
11
|
+
throw new CustomFieldValueValidationError('Number custom field value can not be greater than max');
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=number.custom-field-value.validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.custom-field-value.validator.js","sourceRoot":"","sources":["../../../lib/custom-field-types/number/number.custom-field-value.validator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAAE,MAAM,wDAAwD,CAAA;AAKxG,MAAM,UAAU,8BAA8B,CAC5C,UAAuC,EACvC,KAAa;IAEb,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAA;IAE9B,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,OAAM;IACR,CAAC;IAED,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS,IAAI,KAAK,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC;QACjD,MAAM,IAAI,+BAA+B,CAAC,qDAAqD,CAAC,CAAA;IAClG,CAAC;IAED,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS,IAAI,KAAK,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC;QACjD,MAAM,IAAI,+BAA+B,CAAC,uDAAuD,CAAC,CAAA;IACpG,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { describe, it } from 'node:test';
|
|
2
|
+
import { LocalizedString } from '@wisemen/localized-string';
|
|
3
|
+
import { customFieldDefinition } from '#src/factory/custom-field-definition.factory.js';
|
|
4
|
+
import { CustomFieldType } from '#src/enum/custom-field-type.enum.js';
|
|
5
|
+
import { validateCustomFieldValue } from '#src/validators/custom-field-value.validator.js';
|
|
6
|
+
import { CustomFieldValueValidationError } from '#src/validators/custom-field-value-validation.error.js';
|
|
7
|
+
import { expect } from 'expect';
|
|
8
|
+
describe('number validateCustomFieldValue', () => {
|
|
9
|
+
it('rejects a number custom field value lower than min', () => {
|
|
10
|
+
const definition = customFieldDefinition(CustomFieldType.NUMBER, {
|
|
11
|
+
tenantUuid: null,
|
|
12
|
+
entityType: 'invoice',
|
|
13
|
+
key: 'priority',
|
|
14
|
+
label: new LocalizedString([{ locale: 'en', value: 'Priority' }]),
|
|
15
|
+
description: null,
|
|
16
|
+
isRequired: false,
|
|
17
|
+
rules: {
|
|
18
|
+
min: 2
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
expect(() => validateCustomFieldValue(definition, {
|
|
22
|
+
definitionUuid: definition.uuid,
|
|
23
|
+
type: CustomFieldType.NUMBER,
|
|
24
|
+
value: 1
|
|
25
|
+
})).toThrow(new CustomFieldValueValidationError('Number custom field value can not be lower than min'));
|
|
26
|
+
});
|
|
27
|
+
it('rejects a number custom field value greater than max', () => {
|
|
28
|
+
const definition = customFieldDefinition(CustomFieldType.NUMBER, {
|
|
29
|
+
tenantUuid: null,
|
|
30
|
+
entityType: 'invoice',
|
|
31
|
+
key: 'priority',
|
|
32
|
+
label: new LocalizedString([{ locale: 'en', value: 'Priority' }]),
|
|
33
|
+
description: null,
|
|
34
|
+
isRequired: false,
|
|
35
|
+
rules: {
|
|
36
|
+
max: 2
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
expect(() => validateCustomFieldValue(definition, {
|
|
40
|
+
definitionUuid: definition.uuid,
|
|
41
|
+
type: CustomFieldType.NUMBER,
|
|
42
|
+
value: 3
|
|
43
|
+
})).toThrow(new CustomFieldValueValidationError('Number custom field value can not be greater than max'));
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=number.custom-field-value.validator.unit.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.custom-field-value.validator.unit.test.js","sourceRoot":"","sources":["../../../lib/custom-field-types/number/number.custom-field-value.validator.unit.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,iDAAiD,CAAA;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAA;AAC1F,OAAO,EAAE,+BAA+B,EAAE,MAAM,wDAAwD,CAAA;AACxG,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,QAAQ,CAAC,iCAAiC,EAAE,GAAG,EAAE;IAC/C,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;QAC5D,MAAM,UAAU,GAAG,qBAAqB,CAAC,eAAe,CAAC,MAAM,EAAE;YAC/D,UAAU,E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CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ResolvedCustomFieldDefinitionFields } from '#src/custom-field-definition.js';
|
|
2
|
+
import { CustomFieldType } from '#src/enum/custom-field-type.enum.js';
|
|
3
|
+
type NumberCustomFieldDefinition = Extract<ResolvedCustomFieldDefinitionFields, {
|
|
4
|
+
type: CustomFieldType.NUMBER;
|
|
5
|
+
}>;
|
|
6
|
+
export declare function validateNumberCustomFieldDefinition(definition: NumberCustomFieldDefinition): void;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CustomFieldDefinitionError } from '#src/errors/custom-field-definition.error.js';
|
|
2
|
+
export function validateNumberCustomFieldDefinition(definition) {
|
|
3
|
+
if (definition.choices !== null) {
|
|
4
|
+
throw new CustomFieldDefinitionError('Only select custom fields can define choices');
|
|
5
|
+
}
|
|
6
|
+
const rules = definition.rules;
|
|
7
|
+
if (rules === null) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (rules.min !== undefined
|
|
11
|
+
&& rules.max !== undefined
|
|
12
|
+
&& rules.min > rules.max) {
|
|
13
|
+
throw new CustomFieldDefinitionError('Number custom field min can not be greater than max');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=number.definition-validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.definition-validation.js","sourceRoot":"","sources":["../../../lib/custom-field-types/number/number.definition-validation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAA;AAKzF,MAAM,UAAU,mCAAmC,CAAC,UAAuC;IACzF,IAAI,UAAU,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QAChC,MAAM,IAAI,0BAA0B,CAAC,8CAA8C,CAAC,CAAA;IACtF,CAAC;IAED,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAA;IAE9B,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,OAAM;IACR,CAAC;IAED,IACE,KAAK,CAAC,GAAG,KAAK,SAAS;WACpB,KAAK,CAAC,GAAG,KAAK,SAAS;WACvB,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,EACxB,CAAC;QACD,MAAM,IAAI,0BAA0B,CAAC,qDAAqD,CAAC,CAAA;IAC7F,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseCustomFieldValueDto } from '#src/dto/base-custom-field-value.dto.js';
|
|
2
|
+
import { CustomFieldType } from '#src/enum/custom-field-type.enum.js';
|
|
3
|
+
import { NumberCustomFieldValue } from '#src/custom-field-types/number/number.value.js';
|
|
4
|
+
export declare class NumberCustomFieldValueDto extends BaseCustomFieldValueDto {
|
|
5
|
+
type: CustomFieldType.NUMBER;
|
|
6
|
+
value: number;
|
|
7
|
+
parse(): NumberCustomFieldValue;
|
|
8
|
+
static from(customFieldValue: NumberCustomFieldValue): NumberCustomFieldValueDto;
|
|
9
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { ApiProperty } from '@nestjs/swagger';
|
|
11
|
+
import { IsEnum, IsNumber } from 'class-validator';
|
|
12
|
+
import { BaseCustomFieldValueDto, createCustomFieldValueDto } from '#src/dto/base-custom-field-value.dto.js';
|
|
13
|
+
import { CustomFieldType } from '#src/enum/custom-field-type.enum.js';
|
|
14
|
+
export class NumberCustomFieldValueDto extends BaseCustomFieldValueDto {
|
|
15
|
+
value;
|
|
16
|
+
parse() {
|
|
17
|
+
return this.toCustomFieldValue(CustomFieldType.NUMBER, this.value);
|
|
18
|
+
}
|
|
19
|
+
static from(customFieldValue) {
|
|
20
|
+
return createCustomFieldValueDto(new NumberCustomFieldValueDto(), CustomFieldType.NUMBER, customFieldValue.definitionUuid, customFieldValue.value);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
__decorate([
|
|
24
|
+
ApiProperty({ enum: [CustomFieldType.NUMBER] }),
|
|
25
|
+
IsEnum([CustomFieldType.NUMBER]),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], NumberCustomFieldValueDto.prototype, "type", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
ApiProperty({ type: Number }),
|
|
30
|
+
IsNumber(),
|
|
31
|
+
__metadata("design:type", Number)
|
|
32
|
+
], NumberCustomFieldValueDto.prototype, "value", void 0);
|
|
33
|
+
//# sourceMappingURL=number.dto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.dto.js","sourceRoot":"","sources":["../../../lib/custom-field-types/number/number.dto.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAA;AAC5G,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAGrE,MAAM,OAAO,yBAA0B,SAAQ,uBAAuB;IAOpE,KAAK,CAAQ;IAEb,KAAK;QACH,OAAO,IAAI,CAAC,kBAAkB,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;IACpE,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,gBAAwC;QAClD,OAAO,yBAAyB,CAAC,IAAI,yBAAyB,EAAE,EAAE,eAAe,CAAC,MAAM,EAAE,gBAAgB,CAAC,cAAc,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAA;IACpJ,CAAC;CACF;AAbS;IAFP,WAAW,CAAC,EAAE,IAAI,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;IAC/C,MAAM,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;;uDACG;AAIpC;IAFC,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC7B,QAAQ,EAAE;;wDACE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.rules.js","sourceRoot":"","sources":["../../../lib/custom-field-types/number/number.rules.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BaseCustomFieldValue } from '#src/custom-field-value.js';
|
|
2
|
+
import { CustomFieldType } from '#src/enum/custom-field-type.enum.js';
|
|
3
|
+
import type { NumberCustomFieldTypeContract } from './number.contract.js';
|
|
4
|
+
export type NumberCustomFieldValue = BaseCustomFieldValue<CustomFieldType.NUMBER, NumberCustomFieldTypeContract['value']>;
|
|
5
|
+
export type NumberCustomFieldColumnValue = BaseCustomFieldValue<CustomFieldType.NUMBER, NumberCustomFieldTypeContract['columnValue']>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.value.js","sourceRoot":"","sources":["../../../lib/custom-field-types/number/number.value.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './single-select.contract.js';
|
|
2
|
+
export * from './single-select.definition-validation.js';
|
|
3
|
+
export * from './single-select.dto.js';
|
|
4
|
+
export * from './single-select.rules.js';
|
|
5
|
+
export * from './single-select.custom-field-value.validator.js';
|
|
6
|
+
export * from './single-select.value.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './single-select.contract.js';
|
|
2
|
+
export * from './single-select.definition-validation.js';
|
|
3
|
+
export * from './single-select.dto.js';
|
|
4
|
+
export * from './single-select.rules.js';
|
|
5
|
+
export * from './single-select.custom-field-value.validator.js';
|
|
6
|
+
export * from './single-select.value.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/custom-field-types/single-select/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA;AAC3C,cAAc,0CAA0C,CAAA;AACxD,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,iDAAiD,CAAA;AAC/D,cAAc,0BAA0B,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DefineContract } from '#src/custom-field-type-contract.js';
|
|
2
|
+
export type SingleSelectCustomFieldTypeContract = DefineContract<{
|
|
3
|
+
value: string;
|
|
4
|
+
columnValue: string;
|
|
5
|
+
rules: Record<never, never>;
|
|
6
|
+
rulesMode: 'none';
|
|
7
|
+
choicesMode: 'required';
|
|
8
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"single-select.contract.js","sourceRoot":"","sources":["../../../lib/custom-field-types/single-select/single-select.contract.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|