@wisemen/nestjs-custom-fields 0.0.0 → 0.0.1
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
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { LocalizedString } from '@wisemen/localized-string';
|
|
2
|
+
import { CustomFieldChoice } from '#src/custom-field-choice.js';
|
|
3
|
+
import { CustomFieldDefinitionFieldsByType } from '#src/custom-field-definition.js';
|
|
4
|
+
import { CustomFieldRulesByType } from '#src/custom-field-rules.js';
|
|
5
|
+
import { CustomFieldChoicesModeByType, CustomFieldRulesModeByType } from '#src/custom-field-type-contract.js';
|
|
6
|
+
import { CustomFieldType } from '#src/enum/custom-field-type.enum.js';
|
|
7
|
+
type NullIfEmpty<T> = keyof T extends never ? null : T | null;
|
|
8
|
+
type CustomFieldRulesConfigByType<T extends CustomFieldType> = T extends RequiredRulesCustomField ? Omit<CustomFieldRulesByType<T>, 'type'> : NullIfEmpty<Omit<CustomFieldRulesByType<T>, 'type'>>;
|
|
9
|
+
export type RequiredRulesCustomField = {
|
|
10
|
+
[T in CustomFieldType]: CustomFieldRulesModeByType<T> extends 'required' ? T : never;
|
|
11
|
+
}[CustomFieldType];
|
|
12
|
+
export type NoRulesCustomField = {
|
|
13
|
+
[T in CustomFieldType]: CustomFieldRulesModeByType<T> extends 'none' ? T : never;
|
|
14
|
+
}[CustomFieldType];
|
|
15
|
+
export type OptionalRulesCustomField = Exclude<CustomFieldType, RequiredRulesCustomField | NoRulesCustomField>;
|
|
16
|
+
export type SelectCustomFieldType = {
|
|
17
|
+
[T in CustomFieldType]: CustomFieldChoicesModeByType<T> extends 'required' ? T : never;
|
|
18
|
+
}[CustomFieldType];
|
|
19
|
+
export type CustomFieldDefinitionMetadataFields = {
|
|
20
|
+
tenantUuid: string | null;
|
|
21
|
+
entityType: string;
|
|
22
|
+
key: string;
|
|
23
|
+
label: LocalizedString;
|
|
24
|
+
description: LocalizedString | null;
|
|
25
|
+
isRequired: boolean;
|
|
26
|
+
};
|
|
27
|
+
export type CustomFieldDefinitionDraft<T extends CustomFieldType = CustomFieldType> = CustomFieldDefinitionFieldsByType<T>;
|
|
28
|
+
type BaseCustomFieldInput<TType extends CustomFieldType> = CustomFieldDefinitionMetadataFields & {
|
|
29
|
+
type: TType;
|
|
30
|
+
};
|
|
31
|
+
type RulesInput<TType extends CustomFieldType> = TType extends RequiredRulesCustomField ? {
|
|
32
|
+
rules: CustomFieldRulesConfigByType<TType>;
|
|
33
|
+
} : TType extends OptionalRulesCustomField ? {
|
|
34
|
+
rules?: CustomFieldRulesConfigByType<TType>;
|
|
35
|
+
} : TType extends NoRulesCustomField ? Record<never, never> : never;
|
|
36
|
+
type SelectChoicesConfig<TType extends CustomFieldType> = TType extends SelectCustomFieldType ? {
|
|
37
|
+
choices: CustomFieldChoice[];
|
|
38
|
+
} : Record<never, never>;
|
|
39
|
+
export type CustomFieldDefinitionInput<TType extends CustomFieldType = CustomFieldType> = TType extends CustomFieldType ? BaseCustomFieldInput<TType> & RulesInput<TType> & SelectChoicesConfig<TType> : never;
|
|
40
|
+
export declare function customFieldDefinition<T extends CustomFieldType>(type: T, definition: Omit<CustomFieldDefinitionInput<T>, 'type'>): CustomFieldDefinitionDraft<T>;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { generateUuid } from '#src/custom-field-definition.uuid.js';
|
|
2
|
+
import { validateBooleanCustomFieldDefinition } from '#src/custom-field-types/boolean/boolean.definition-validation.js';
|
|
3
|
+
import { validateDateCustomFieldDefinition } from '#src/custom-field-types/date/date.definition-validation.js';
|
|
4
|
+
import { validateMonetaryCustomFieldDefinition } from '#src/custom-field-types/monetary/monetary.definition-validation.js';
|
|
5
|
+
import { validateMultiSelectCustomFieldDefinition } from '#src/custom-field-types/multi-select/multi-select.definition-validation.js';
|
|
6
|
+
import { validateNumberCustomFieldDefinition } from '#src/custom-field-types/number/number.definition-validation.js';
|
|
7
|
+
import { validateSingleSelectCustomFieldDefinition } from '#src/custom-field-types/single-select/single-select.definition-validation.js';
|
|
8
|
+
import { validateTextArrayCustomFieldDefinition } from '#src/custom-field-types/text-array/text-array.definition-validation.js';
|
|
9
|
+
import { validateTextCustomFieldDefinition } from '#src/custom-field-types/text/text.definition-validation.js';
|
|
10
|
+
import { validateTimestampCustomFieldDefinition } from '#src/custom-field-types/timestamp/timestamp.definition-validation.js';
|
|
11
|
+
import { exhaustiveCheck } from '#src/exhaustive-check.js';
|
|
12
|
+
import { CustomFieldType } from '#src/enum/custom-field-type.enum.js';
|
|
13
|
+
import { CustomFieldDefinitionError } from '#src/errors/custom-field-definition.error.js';
|
|
14
|
+
export function customFieldDefinition(type, definition) {
|
|
15
|
+
return normalizeCustomFieldDefinition(withCustomFieldType(type, definition));
|
|
16
|
+
}
|
|
17
|
+
function withCustomFieldType(type, definition) {
|
|
18
|
+
return {
|
|
19
|
+
...definition,
|
|
20
|
+
type
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function normalizeCustomFieldDefinition(definition) {
|
|
24
|
+
switch (definition.type) {
|
|
25
|
+
case CustomFieldType.TEXT:
|
|
26
|
+
case CustomFieldType.TEXT_ARRAY:
|
|
27
|
+
case CustomFieldType.NUMBER:
|
|
28
|
+
case CustomFieldType.BOOLEAN:
|
|
29
|
+
case CustomFieldType.DATE:
|
|
30
|
+
case CustomFieldType.TIMESTAMP:
|
|
31
|
+
case CustomFieldType.MONETARY: {
|
|
32
|
+
const customFieldDefinition = {
|
|
33
|
+
uuid: generateUuid(),
|
|
34
|
+
tenantUuid: definition.tenantUuid,
|
|
35
|
+
entityType: definition.entityType,
|
|
36
|
+
key: definition.key,
|
|
37
|
+
label: definition.label,
|
|
38
|
+
description: definition.description,
|
|
39
|
+
type: definition.type,
|
|
40
|
+
rules: normalizeRules(definition.type, 'rules' in definition ? definition.rules : null),
|
|
41
|
+
isRequired: definition.isRequired,
|
|
42
|
+
choices: null
|
|
43
|
+
};
|
|
44
|
+
validateCustomFieldDefinition(customFieldDefinition);
|
|
45
|
+
return customFieldDefinition;
|
|
46
|
+
}
|
|
47
|
+
case CustomFieldType.SINGLE_SELECT:
|
|
48
|
+
case CustomFieldType.MULTI_SELECT: {
|
|
49
|
+
const customFieldDefinition = {
|
|
50
|
+
uuid: generateUuid(),
|
|
51
|
+
tenantUuid: definition.tenantUuid,
|
|
52
|
+
entityType: definition.entityType,
|
|
53
|
+
key: definition.key,
|
|
54
|
+
label: definition.label,
|
|
55
|
+
description: definition.description,
|
|
56
|
+
type: definition.type,
|
|
57
|
+
rules: normalizeRules(definition.type, 'rules' in definition ? definition.rules : null),
|
|
58
|
+
isRequired: definition.isRequired,
|
|
59
|
+
choices: definition.choices
|
|
60
|
+
};
|
|
61
|
+
validateCustomFieldDefinition(customFieldDefinition);
|
|
62
|
+
return customFieldDefinition;
|
|
63
|
+
}
|
|
64
|
+
default:
|
|
65
|
+
return exhaustiveCheck(definition);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function normalizeRules(type, rules) {
|
|
69
|
+
if (rules == null) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
type,
|
|
74
|
+
...rules
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function validateCustomFieldDefinition(definition) {
|
|
78
|
+
if (definition.entityType.trim() === '') {
|
|
79
|
+
throw new CustomFieldDefinitionError('Custom field entityType can not be empty');
|
|
80
|
+
}
|
|
81
|
+
if (definition.key.trim() === '') {
|
|
82
|
+
throw new CustomFieldDefinitionError('Custom field key can not be empty');
|
|
83
|
+
}
|
|
84
|
+
if (definition.label.toJSON().length === 0) {
|
|
85
|
+
throw new CustomFieldDefinitionError('Custom field label must contain at least one translation');
|
|
86
|
+
}
|
|
87
|
+
if (definition.description !== null && definition.description.toJSON().length === 0) {
|
|
88
|
+
throw new CustomFieldDefinitionError('Custom field description must contain at least one translation');
|
|
89
|
+
}
|
|
90
|
+
if (definition.rules !== null && definition.rules.type !== definition.type) {
|
|
91
|
+
throw new CustomFieldDefinitionError('Custom field rules must match the field type');
|
|
92
|
+
}
|
|
93
|
+
switch (definition.type) {
|
|
94
|
+
case CustomFieldType.TEXT:
|
|
95
|
+
validateTextCustomFieldDefinition(definition);
|
|
96
|
+
return;
|
|
97
|
+
case CustomFieldType.TEXT_ARRAY:
|
|
98
|
+
validateTextArrayCustomFieldDefinition(definition);
|
|
99
|
+
return;
|
|
100
|
+
case CustomFieldType.NUMBER:
|
|
101
|
+
validateNumberCustomFieldDefinition(definition);
|
|
102
|
+
return;
|
|
103
|
+
case CustomFieldType.BOOLEAN:
|
|
104
|
+
validateBooleanCustomFieldDefinition(definition);
|
|
105
|
+
return;
|
|
106
|
+
case CustomFieldType.DATE:
|
|
107
|
+
validateDateCustomFieldDefinition(definition);
|
|
108
|
+
return;
|
|
109
|
+
case CustomFieldType.TIMESTAMP:
|
|
110
|
+
validateTimestampCustomFieldDefinition(definition);
|
|
111
|
+
return;
|
|
112
|
+
case CustomFieldType.SINGLE_SELECT:
|
|
113
|
+
validateSingleSelectCustomFieldDefinition(definition);
|
|
114
|
+
return;
|
|
115
|
+
case CustomFieldType.MULTI_SELECT:
|
|
116
|
+
validateMultiSelectCustomFieldDefinition(definition);
|
|
117
|
+
return;
|
|
118
|
+
case CustomFieldType.MONETARY:
|
|
119
|
+
validateMonetaryCustomFieldDefinition(definition);
|
|
120
|
+
return;
|
|
121
|
+
default:
|
|
122
|
+
exhaustiveCheck(definition);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=custom-field-definition.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-field-definition.factory.js","sourceRoot":"","sources":["../../lib/factory/custom-field-definition.factory.ts"],"names":[],"mappings":"AAGA,OAAO,EAA6B,YAAY,EAAE,MAAM,sCAAsC,CAAA;AAG9F,OAAO,EAAE,oCAAoC,EAAE,MAAM,kEAAkE,CAAA;AACvH,OAAO,EAAE,iCAAiC,EAAE,MAAM,4DAA4D,CAAA;AAC9G,OAAO,EAAE,qCAAqC,EAAE,MAAM,oEAAoE,CAAA;AAC1H,OAAO,EAAE,wCAAwC,EAAE,MAAM,4EAA4E,CAAA;AACrI,OAAO,EAAE,mCAAmC,EAAE,MAAM,gEAAgE,CAAA;AACpH,OAAO,EAAE,yCAAyC,EAAE,MAAM,8EAA8E,CAAA;AACxI,OAAO,EAAE,sCAAsC,EAAE,MA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5B,sCAAsC,CAAC,UAAU,CAAC,CAAA;YAClD,OAAM;QACR,KAAK,eAAe,CAAC,aAAa;YAChC,yCAAyC,CAAC,UAAU,CAAC,CAAA;YACrD,OAAM;QACR,KAAK,eAAe,CAAC,YAAY;YAC/B,wCAAwC,CAAC,UAAU,CAAC,CAAA;YACpD,OAAM;QACR,KAAK,eAAe,CAAC,QAAQ;YAC3B,qCAAqC,CAAC,UAAU,CAAC,CAAA;YACjD,OAAM;QACR;YACE,eAAe,CAAC,UAAU,CAAC,CAAA;IAC/B,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from './custom-field-choice.js';
|
|
2
|
+
export * from './custom-field-definition.js';
|
|
3
|
+
export type { CustomFieldDefinitionUuid } from './custom-field-definition.uuid.js';
|
|
4
|
+
export * from './custom-field-rules.js';
|
|
5
|
+
export * from './custom-field-value.js';
|
|
6
|
+
export * from './repositories/index.js';
|
|
7
|
+
export { IsCustomFieldsValues as IsCustomFields } from './decorators/is-custom-fields.decorator.js';
|
|
8
|
+
export { CustomFieldValueApiExtraModels, CustomFieldValueDtoApiProperty, BooleanCustomFieldValueDto, CustomFieldValueDto, DateCustomFieldValueDto, TimestampCustomFieldValueDto, MonetaryCustomFieldValueDto, MultiSelectCustomFieldValueDto, NumberCustomFieldValueDto, SingleSelectCustomFieldValueDto, TextArrayCustomFieldValueDto, TextCustomFieldValueDto } from './dto/custom-field-value.dto.js';
|
|
9
|
+
export { CustomFieldDefinitionError } from './errors/custom-field-definition.error.js';
|
|
10
|
+
export { customFieldDefinition } from './factory/custom-field-definition.factory.js';
|
|
11
|
+
export { CustomFieldDefinitionResponse } from './responses/custom-field-definition.response.js';
|
|
12
|
+
export { CustomFieldDefinitionData as CustomFieldDefinitionFields } from './custom-field-definition.js';
|
|
13
|
+
export { CustomFieldType, CustomFieldTypeApiProperty, CustomFieldTypeColumn } from './enum/custom-field-type.enum.js';
|
|
14
|
+
export { CustomFieldDefinition } from './typeorm/custom-field-definition.entity.js';
|
|
15
|
+
export { CustomFieldChoiceColumn } from './typeorm/custom-field-choice.column.js';
|
|
16
|
+
export { CustomFieldValueColumn } from './typeorm/custom-field-value.column.js';
|
|
17
|
+
export { CustomFieldValueValidationError } from './validators/custom-field-value-validation.error.js';
|
|
18
|
+
export { validateCustomFieldValue, validateCustomFieldValues } from './validators/custom-field-value.validator.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './custom-field-choice.js';
|
|
2
|
+
export * from './custom-field-definition.js';
|
|
3
|
+
export * from './custom-field-rules.js';
|
|
4
|
+
export * from './custom-field-value.js';
|
|
5
|
+
export * from './repositories/index.js';
|
|
6
|
+
export { IsCustomFieldsValues as IsCustomFields } from './decorators/is-custom-fields.decorator.js';
|
|
7
|
+
export { CustomFieldValueApiExtraModels, CustomFieldValueDtoApiProperty, BooleanCustomFieldValueDto, CustomFieldValueDto, DateCustomFieldValueDto, TimestampCustomFieldValueDto, MonetaryCustomFieldValueDto, MultiSelectCustomFieldValueDto, NumberCustomFieldValueDto, SingleSelectCustomFieldValueDto, TextArrayCustomFieldValueDto, TextCustomFieldValueDto } from './dto/custom-field-value.dto.js';
|
|
8
|
+
export { CustomFieldDefinitionError } from './errors/custom-field-definition.error.js';
|
|
9
|
+
export { customFieldDefinition } from './factory/custom-field-definition.factory.js';
|
|
10
|
+
export { CustomFieldDefinitionResponse } from './responses/custom-field-definition.response.js';
|
|
11
|
+
export { CustomFieldType, CustomFieldTypeApiProperty, CustomFieldTypeColumn } from './enum/custom-field-type.enum.js';
|
|
12
|
+
export { CustomFieldDefinition } from './typeorm/custom-field-definition.entity.js';
|
|
13
|
+
export { CustomFieldChoiceColumn } from './typeorm/custom-field-choice.column.js';
|
|
14
|
+
export { CustomFieldValueColumn } from './typeorm/custom-field-value.column.js';
|
|
15
|
+
export { CustomFieldValueValidationError } from './validators/custom-field-value-validation.error.js';
|
|
16
|
+
export { validateCustomFieldValue, validateCustomFieldValues } from './validators/custom-field-value.validator.js';
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,8BAA8B,CAAA;AAE5C,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,OAAO,EAAE,oBAAoB,IAAI,cAAc,EAAE,MAAM,4CAA4C,CAAA;AACnG,OAAO,EACL,8BAA8B,EAC9B,8BAA8B,EAC9B,0BAA0B,EAC1B,mBAAmB,EACnB,uBAAuB,EACvB,4BAA4B,EAC5B,2BAA2B,EAC3B,8BAA8B,EAC9B,yBAAyB,EACzB,+BAA+B,EAC/B,4BAA4B,EAC5B,uBAAuB,EACxB,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAA;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAA;AACpF,OAAO,EAAE,6BAA6B,EAAE,MAAM,iDAAiD,CAAA;AAE/F,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AACrH,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AACnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAA;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAA;AAC/E,OAAO,EAAE,+BAA+B,EAAE,MAAM,qDAAqD,CAAA;AACrG,OAAO,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
import { CustomFieldDefinitionsRepository } from '#src/repositories/custom-field-definitions.repository.js';
|
|
8
|
+
import { CustomFieldDefinition } from '#src/typeorm/custom-field-definition.entity.js';
|
|
9
|
+
import { Module } from '@nestjs/common';
|
|
10
|
+
import { TypeOrmModule } from '@wisemen/nestjs-typeorm';
|
|
11
|
+
let CustomFieldDefinitionRepositoryModule = class CustomFieldDefinitionRepositoryModule {
|
|
12
|
+
};
|
|
13
|
+
CustomFieldDefinitionRepositoryModule = __decorate([
|
|
14
|
+
Module({
|
|
15
|
+
imports: [
|
|
16
|
+
TypeOrmModule.forFeature([CustomFieldDefinition])
|
|
17
|
+
],
|
|
18
|
+
providers: [
|
|
19
|
+
CustomFieldDefinitionsRepository,
|
|
20
|
+
],
|
|
21
|
+
exports: [
|
|
22
|
+
CustomFieldDefinitionsRepository
|
|
23
|
+
]
|
|
24
|
+
})
|
|
25
|
+
], CustomFieldDefinitionRepositoryModule);
|
|
26
|
+
export { CustomFieldDefinitionRepositoryModule };
|
|
27
|
+
//# sourceMappingURL=custom-field-definition.repository.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-field-definition.repository.module.js","sourceRoot":"","sources":["../../lib/repositories/custom-field-definition.repository.module.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,0DAA0D,CAAA;AAC3G,OAAO,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAA;AACtF,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAahD,IAAM,qCAAqC,GAA3C,MAAM,qCAAqC;CAAG,CAAA;AAAxC,qCAAqC;IAXjD,MAAM,CAAC;QACN,OAAO,EAAE;YACP,aAAa,CAAC,UAAU,CAAC,CAAC,qBAAqB,CAAC,CAAC;SAClD;QACD,SAAS,EAAE;YACT,gCAAgC;SACjC;QACD,OAAO,EAAE;YACP,gCAAgC;SACjC;KACF,CAAC;GACW,qCAAqC,CAAG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Repository } from 'typeorm';
|
|
2
|
+
import { CustomFieldDefinition } from '#src/typeorm/custom-field-definition.entity.js';
|
|
3
|
+
export interface CustomFieldDefinitionsOptions {
|
|
4
|
+
tenantUuid?: string;
|
|
5
|
+
entityType?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class CustomFieldDefinitionsRepository {
|
|
8
|
+
private readonly repository;
|
|
9
|
+
constructor(repository: Repository<CustomFieldDefinition>);
|
|
10
|
+
findDefinitions(options?: CustomFieldDefinitionsOptions): Promise<CustomFieldDefinition[]>;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { after, before, beforeEach, describe, it } from 'node:test';
|
|
2
|
+
import { expect } from 'expect';
|
|
3
|
+
import { LocalizedString } from '@wisemen/localized-string';
|
|
4
|
+
import { dataSource } from '#src/tests/sql/datasource.js';
|
|
5
|
+
import { IntegrationTestSetup } from '#src/tests/test-setup.js';
|
|
6
|
+
import { CustomFieldType } from '#src/enum/custom-field-type.enum.js';
|
|
7
|
+
import { customFieldDefinition } from '#src/factory/custom-field-definition.factory.js';
|
|
8
|
+
import { CustomFieldDefinition } from '#src/typeorm/custom-field-definition.entity.js';
|
|
9
|
+
import { CustomFieldDefinitionsRepository } from './custom-field-definitions.repository.js';
|
|
10
|
+
describe('ViewCustomFieldDefinitionsRepository integration', () => {
|
|
11
|
+
const integrationTest = new IntegrationTestSetup();
|
|
12
|
+
before(async () => {
|
|
13
|
+
await integrationTest.setup();
|
|
14
|
+
});
|
|
15
|
+
beforeEach(async () => {
|
|
16
|
+
await integrationTest.clear(CustomFieldDefinition);
|
|
17
|
+
});
|
|
18
|
+
after(async () => {
|
|
19
|
+
await integrationTest.teardown();
|
|
20
|
+
});
|
|
21
|
+
it('returns global definitions for the requested entity type ordered by key', async () => {
|
|
22
|
+
const tenantUuid = '00000000-0000-0000-0000-000000000001';
|
|
23
|
+
const referenceDefinition = customFieldDefinition(CustomFieldType.TEXT, {
|
|
24
|
+
tenantUuid: null,
|
|
25
|
+
entityType: 'ticket',
|
|
26
|
+
key: 'reference',
|
|
27
|
+
label: new LocalizedString([{ locale: 'en', value: 'Reference' }]),
|
|
28
|
+
description: null,
|
|
29
|
+
isRequired: false
|
|
30
|
+
});
|
|
31
|
+
const priorityDefinition = customFieldDefinition(CustomFieldType.MULTI_SELECT, {
|
|
32
|
+
tenantUuid: null,
|
|
33
|
+
entityType: 'ticket',
|
|
34
|
+
key: 'priority',
|
|
35
|
+
label: new LocalizedString([{ locale: 'en', value: 'Priority' }]),
|
|
36
|
+
description: new LocalizedString([{ locale: 'en', value: 'Ticket priority' }]),
|
|
37
|
+
isRequired: true,
|
|
38
|
+
choices: [
|
|
39
|
+
{
|
|
40
|
+
value: 'high',
|
|
41
|
+
label: new LocalizedString([{ locale: 'en', value: 'High' }]),
|
|
42
|
+
order: 2
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
value: 'low',
|
|
46
|
+
label: new LocalizedString([{ locale: 'en', value: 'Low' }]),
|
|
47
|
+
order: 1
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
rules: {
|
|
51
|
+
minSelections: 1,
|
|
52
|
+
maxSelections: 2
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const tenantDefinition = customFieldDefinition(CustomFieldType.TEXT, {
|
|
56
|
+
tenantUuid,
|
|
57
|
+
entityType: 'ticket',
|
|
58
|
+
key: 'tenant-only',
|
|
59
|
+
label: new LocalizedString([{ locale: 'en', value: 'Tenant only' }]),
|
|
60
|
+
description: null,
|
|
61
|
+
isRequired: false
|
|
62
|
+
});
|
|
63
|
+
const otherEntityDefinition = customFieldDefinition(CustomFieldType.TEXT, {
|
|
64
|
+
tenantUuid: null,
|
|
65
|
+
entityType: 'project',
|
|
66
|
+
key: 'project-code',
|
|
67
|
+
label: new LocalizedString([{ locale: 'en', value: 'Project code' }]),
|
|
68
|
+
description: null,
|
|
69
|
+
isRequired: false
|
|
70
|
+
});
|
|
71
|
+
await dataSource.manager.save(CustomFieldDefinition, [
|
|
72
|
+
referenceDefinition,
|
|
73
|
+
priorityDefinition,
|
|
74
|
+
tenantDefinition,
|
|
75
|
+
otherEntityDefinition
|
|
76
|
+
]);
|
|
77
|
+
const repository = new CustomFieldDefinitionsRepository(dataSource.manager.getRepository(CustomFieldDefinition));
|
|
78
|
+
const response = await repository.findDefinitions({
|
|
79
|
+
entityType: 'ticket'
|
|
80
|
+
});
|
|
81
|
+
expect(response).toHaveLength(2);
|
|
82
|
+
expect(response.map(item => item.key)).toEqual(['priority', 'reference']);
|
|
83
|
+
expect(response).toEqual([
|
|
84
|
+
{
|
|
85
|
+
uuid: priorityDefinition.uuid,
|
|
86
|
+
tenantUuid: null,
|
|
87
|
+
entityType: 'ticket',
|
|
88
|
+
key: 'priority',
|
|
89
|
+
label: [{ locale: 'en', value: 'Priority' }],
|
|
90
|
+
description: [{ locale: 'en', value: 'Ticket priority' }],
|
|
91
|
+
type: CustomFieldType.MULTI_SELECT,
|
|
92
|
+
isRequired: true,
|
|
93
|
+
choices: [
|
|
94
|
+
{
|
|
95
|
+
value: 'high',
|
|
96
|
+
label: [{ locale: 'en', value: 'High' }],
|
|
97
|
+
order: 2
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
value: 'low',
|
|
101
|
+
label: [{ locale: 'en', value: 'Low' }],
|
|
102
|
+
order: 1
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
rules: {
|
|
106
|
+
type: CustomFieldType.MULTI_SELECT,
|
|
107
|
+
minSelections: 1,
|
|
108
|
+
maxSelections: 2
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
uuid: referenceDefinition.uuid,
|
|
113
|
+
tenantUuid: null,
|
|
114
|
+
entityType: 'ticket',
|
|
115
|
+
key: 'reference',
|
|
116
|
+
label: [{ locale: 'en', value: 'Reference' }],
|
|
117
|
+
description: null,
|
|
118
|
+
type: CustomFieldType.TEXT,
|
|
119
|
+
isRequired: false,
|
|
120
|
+
choices: null,
|
|
121
|
+
rules: null
|
|
122
|
+
}
|
|
123
|
+
]);
|
|
124
|
+
});
|
|
125
|
+
it('returns only definitions for the provided tenant', async () => {
|
|
126
|
+
const tenantUuid = '00000000-0000-0000-0000-000000000010';
|
|
127
|
+
const matchingDefinition = customFieldDefinition(CustomFieldType.TEXT, {
|
|
128
|
+
tenantUuid,
|
|
129
|
+
entityType: 'ticket',
|
|
130
|
+
key: 'alpha',
|
|
131
|
+
label: new LocalizedString([{ locale: 'en', value: 'Alpha' }]),
|
|
132
|
+
description: null,
|
|
133
|
+
isRequired: false
|
|
134
|
+
});
|
|
135
|
+
const secondMatchingDefinition = customFieldDefinition(CustomFieldType.TEXT, {
|
|
136
|
+
tenantUuid,
|
|
137
|
+
entityType: 'ticket',
|
|
138
|
+
key: 'zulu',
|
|
139
|
+
label: new LocalizedString([{ locale: 'en', value: 'Zulu' }]),
|
|
140
|
+
description: null,
|
|
141
|
+
isRequired: false
|
|
142
|
+
});
|
|
143
|
+
const otherTenantDefinition = customFieldDefinition(CustomFieldType.TEXT, {
|
|
144
|
+
tenantUuid: '00000000-0000-0000-0000-000000000011',
|
|
145
|
+
entityType: 'ticket',
|
|
146
|
+
key: 'other-tenant',
|
|
147
|
+
label: new LocalizedString([{ locale: 'en', value: 'Other tenant' }]),
|
|
148
|
+
description: null,
|
|
149
|
+
isRequired: false
|
|
150
|
+
});
|
|
151
|
+
const globalDefinition = customFieldDefinition(CustomFieldType.TEXT, {
|
|
152
|
+
tenantUuid: null,
|
|
153
|
+
entityType: 'ticket',
|
|
154
|
+
key: 'global',
|
|
155
|
+
label: new LocalizedString([{ locale: 'en', value: 'Global' }]),
|
|
156
|
+
description: null,
|
|
157
|
+
isRequired: false
|
|
158
|
+
});
|
|
159
|
+
await dataSource.manager.save(CustomFieldDefinition, [
|
|
160
|
+
matchingDefinition,
|
|
161
|
+
secondMatchingDefinition,
|
|
162
|
+
otherTenantDefinition,
|
|
163
|
+
globalDefinition
|
|
164
|
+
]);
|
|
165
|
+
const repository = new CustomFieldDefinitionsRepository(dataSource.manager.getRepository(CustomFieldDefinition));
|
|
166
|
+
const response = await repository.findDefinitions({
|
|
167
|
+
tenantUuid,
|
|
168
|
+
entityType: 'ticket'
|
|
169
|
+
});
|
|
170
|
+
expect(response.map(item => item.key)).toEqual(['alpha', 'zulu']);
|
|
171
|
+
expect(response.every(item => item.tenantUuid === tenantUuid)).toBe(true);
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
//# sourceMappingURL=custom-field-definitions.repository.integration.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-field-definitions.repository.integration.test.js","sourceRoot":"","sources":["../../lib/repositories/custom-field-definitions.repository.integration.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAA;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAE,eAAe,EA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AAI,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3E,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { Injectable } from '@nestjs/common';
|
|
14
|
+
import { Repository } from 'typeorm';
|
|
15
|
+
import { CustomFieldDefinition } from '#src/typeorm/custom-field-definition.entity.js';
|
|
16
|
+
import { InjectRepository } from '@wisemen/nestjs-typeorm';
|
|
17
|
+
let CustomFieldDefinitionsRepository = class CustomFieldDefinitionsRepository {
|
|
18
|
+
repository;
|
|
19
|
+
constructor(repository) {
|
|
20
|
+
this.repository = repository;
|
|
21
|
+
}
|
|
22
|
+
async findDefinitions(options) {
|
|
23
|
+
return this.repository.find({
|
|
24
|
+
where: {
|
|
25
|
+
entityType: options?.entityType,
|
|
26
|
+
tenantUuid: options?.tenantUuid
|
|
27
|
+
},
|
|
28
|
+
order: {
|
|
29
|
+
key: 'ASC'
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
CustomFieldDefinitionsRepository = __decorate([
|
|
35
|
+
Injectable(),
|
|
36
|
+
__param(0, InjectRepository(CustomFieldDefinition)),
|
|
37
|
+
__metadata("design:paramtypes", [Repository])
|
|
38
|
+
], CustomFieldDefinitionsRepository);
|
|
39
|
+
export { CustomFieldDefinitionsRepository };
|
|
40
|
+
//# sourceMappingURL=custom-field-definitions.repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-field-definitions.repository.js","sourceRoot":"","sources":["../../lib/repositories/custom-field-definitions.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gDAAgD,CAAA;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAQnD,IAAM,gCAAgC,GAAtC,MAAM,gCAAgC;IAGxB;IAFnB,YAEmB,UAA6C;QAA7C,eAAU,GAAV,UAAU,CAAmC;IAC5D,CAAC;IAEL,KAAK,CAAC,eAAe,CACnB,OAAwC;QAExC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAC1B,KAAK,EAAE;gBACL,UAAU,EAAE,OAAO,EAAE,UAAU;gBAC/B,UAAU,EAAE,OAAO,EAAE,UAAU;aAChC;YACD,KAAK,EAAE;gBACL,GAAG,EAAE,KAAK;aACX;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAnBY,gCAAgC;IAD5C,UAAU,EAAE;IAGR,WAAA,gBAAgB,CAAC,qBAAqB,CAAC,CAAA;qCACX,UAAU;GAH9B,gCAAgC,CAmB5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/repositories/index.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAA;AACxD,cAAc,gDAAgD,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LocalizedStringDto } from '@wisemen/localized-string';
|
|
2
|
+
import type { CustomFieldDefinitionData } from '#src/custom-field-definition.js';
|
|
3
|
+
import { CustomFieldType } from '#src/enum/custom-field-type.enum.js';
|
|
4
|
+
import type { CustomFieldDefinitionUuid } from '#src/custom-field-definition.uuid.js';
|
|
5
|
+
import type { CustomFieldRules } from '#src/custom-field-rules.js';
|
|
6
|
+
import { CustomFieldChoice } from '#src/custom-field-choice.js';
|
|
7
|
+
declare class CustomFieldChoiceResponse {
|
|
8
|
+
value: string;
|
|
9
|
+
label: LocalizedStringDto;
|
|
10
|
+
order: number;
|
|
11
|
+
constructor(choice: CustomFieldChoice);
|
|
12
|
+
}
|
|
13
|
+
export declare class CustomFieldDefinitionResponse {
|
|
14
|
+
uuid: CustomFieldDefinitionUuid;
|
|
15
|
+
tenantUuid: string | null;
|
|
16
|
+
entityType: string;
|
|
17
|
+
key: string;
|
|
18
|
+
label: LocalizedStringDto;
|
|
19
|
+
description: LocalizedStringDto | null;
|
|
20
|
+
type: CustomFieldType;
|
|
21
|
+
isRequired: boolean;
|
|
22
|
+
choices: CustomFieldChoiceResponse[] | null;
|
|
23
|
+
rules: CustomFieldRules | null;
|
|
24
|
+
constructor(definition: CustomFieldDefinitionData);
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,99 @@
|
|
|
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 { LocalizedStringDto } from '@wisemen/localized-string';
|
|
12
|
+
import { CustomFieldType, CustomFieldTypeApiProperty } from '#src/enum/custom-field-type.enum.js';
|
|
13
|
+
class CustomFieldChoiceResponse {
|
|
14
|
+
value;
|
|
15
|
+
label;
|
|
16
|
+
order;
|
|
17
|
+
constructor(choice) {
|
|
18
|
+
this.value = choice.value;
|
|
19
|
+
this.label = LocalizedStringDto.from(choice.label);
|
|
20
|
+
this.order = choice.order;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
__decorate([
|
|
24
|
+
ApiProperty({ type: String }),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], CustomFieldChoiceResponse.prototype, "value", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
ApiProperty({ type: LocalizedStringDto }),
|
|
29
|
+
__metadata("design:type", LocalizedStringDto)
|
|
30
|
+
], CustomFieldChoiceResponse.prototype, "label", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
ApiProperty({ type: Number }),
|
|
33
|
+
__metadata("design:type", Number)
|
|
34
|
+
], CustomFieldChoiceResponse.prototype, "order", void 0);
|
|
35
|
+
export class CustomFieldDefinitionResponse {
|
|
36
|
+
uuid;
|
|
37
|
+
tenantUuid;
|
|
38
|
+
entityType;
|
|
39
|
+
key;
|
|
40
|
+
label;
|
|
41
|
+
description;
|
|
42
|
+
type;
|
|
43
|
+
isRequired;
|
|
44
|
+
choices;
|
|
45
|
+
rules;
|
|
46
|
+
constructor(definition) {
|
|
47
|
+
this.uuid = definition.uuid;
|
|
48
|
+
this.tenantUuid = definition.tenantUuid;
|
|
49
|
+
this.entityType = definition.entityType;
|
|
50
|
+
this.key = definition.key;
|
|
51
|
+
this.label = LocalizedStringDto.from(definition.label);
|
|
52
|
+
this.description = LocalizedStringDto.from(definition.description);
|
|
53
|
+
this.type = definition.type;
|
|
54
|
+
this.isRequired = definition.isRequired;
|
|
55
|
+
this.choices = definition.choices?.map(choice => new CustomFieldChoiceResponse(choice)) ?? null;
|
|
56
|
+
this.rules = definition.rules;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
__decorate([
|
|
60
|
+
ApiProperty({ type: String, format: 'uuid' }),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], CustomFieldDefinitionResponse.prototype, "uuid", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
ApiProperty({ type: String, format: 'uuid', nullable: true }),
|
|
65
|
+
__metadata("design:type", Object)
|
|
66
|
+
], CustomFieldDefinitionResponse.prototype, "tenantUuid", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
ApiProperty({ type: String }),
|
|
69
|
+
__metadata("design:type", String)
|
|
70
|
+
], CustomFieldDefinitionResponse.prototype, "entityType", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
ApiProperty({ type: String }),
|
|
73
|
+
__metadata("design:type", String)
|
|
74
|
+
], CustomFieldDefinitionResponse.prototype, "key", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
ApiProperty({ type: LocalizedStringDto }),
|
|
77
|
+
__metadata("design:type", LocalizedStringDto)
|
|
78
|
+
], CustomFieldDefinitionResponse.prototype, "label", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
ApiProperty({ type: LocalizedStringDto, nullable: true }),
|
|
81
|
+
__metadata("design:type", Object)
|
|
82
|
+
], CustomFieldDefinitionResponse.prototype, "description", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
CustomFieldTypeApiProperty(),
|
|
85
|
+
__metadata("design:type", String)
|
|
86
|
+
], CustomFieldDefinitionResponse.prototype, "type", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
ApiProperty({ type: Boolean }),
|
|
89
|
+
__metadata("design:type", Boolean)
|
|
90
|
+
], CustomFieldDefinitionResponse.prototype, "isRequired", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
ApiProperty({ type: CustomFieldChoiceResponse, isArray: true, nullable: true }),
|
|
93
|
+
__metadata("design:type", Object)
|
|
94
|
+
], CustomFieldDefinitionResponse.prototype, "choices", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
ApiProperty({ type: Object, nullable: true }),
|
|
97
|
+
__metadata("design:type", Object)
|
|
98
|
+
], CustomFieldDefinitionResponse.prototype, "rules", void 0);
|
|
99
|
+
//# sourceMappingURL=custom-field-definition.response.js.map
|