@carbonbox/domain 0.37.0 → 0.38.0
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/build/carbonbox/reporting/report-instances/domain/entity/ReportInstance.js +3 -2
- package/build/carbonbox/reporting/report-preparation-questionnaires/domain/entity/IReportPreparationQuestionnaire.js +2 -0
- package/build/carbonbox/reporting/report-preparation-questionnaires/domain/entity/ReportPreparationQuestionnaire.js +284 -0
- package/build/carbonbox/reporting/report-preparation-questionnaires/domain/enums/ReportPreparationQuestionnaireStatus.js +22 -0
- package/build/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/DuplicatePreparationQuestionError.js +29 -0
- package/build/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/InvalidPreparationAnswerError.js +33 -0
- package/build/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/InvalidPreparationQuestionError.js +30 -0
- package/build/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/PreparationQuestionNotFoundError.js +29 -0
- package/build/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/ReportPreparationQuestionnaireCannotBeCompletedError.js +31 -0
- package/build/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/ReportPreparationQuestionnaireCannotBeModifiedError.js +29 -0
- package/build/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/ReportPreparationQuestionnaireCannotBeReopenedError.js +28 -0
- package/build/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/TemplateQuestionCannotBeRemovedError.js +29 -0
- package/build/carbonbox/reporting/report-preparation-questionnaires/domain/repository/IReportPreparationQuestionnaireRepository.js +2 -0
- package/build/carbonbox/reporting/report-preparation-questionnaires/domain/types/PreparationAnswerPrimitives.js +2 -0
- package/build/carbonbox/reporting/report-preparation-questionnaires/domain/types/PreparationQuestionPrimitives.js +2 -0
- package/build/carbonbox/reporting/report-preparation-questionnaires/domain/types/ReportPreparationQuestionnaireCompletionPrimitives.js +2 -0
- package/build/carbonbox/reporting/report-preparation-questionnaires/domain/types/ReportPreparationQuestionnairePrimitives.js +2 -0
- package/build/carbonbox/reporting/report-preparation-questionnaires/domain/types/ReportPreparationQuestionnaireProps.js +2 -0
- package/build/carbonbox/reporting/report-preparation-questionnaires/domain/value-objects/PreparationAnswer.js +56 -0
- package/build/carbonbox/reporting/report-preparation-questionnaires/domain/value-objects/PreparationQuestion.js +173 -0
- package/build/carbonbox/reporting/report-preparation-questionnaires/domain/value-objects/ReportPreparationQuestionnaireCompletion.js +47 -0
- package/build/carbonbox/reporting/report-preparation-questionnaires/domain/value-objects/ReportPreparationQuestionnaireId.js +52 -0
- package/build/carbonbox/reporting/shared/domain/enums/ClientInputFieldType.js +34 -0
- package/build/carbonbox/reporting/shared/domain/enums/QuestionnaireQuestionOrigin.js +18 -0
- package/build/carbonbox/reporting/shared/domain/exceptions/InvalidReportBlockClientInputError.js +31 -0
- package/build/carbonbox/reporting/shared/domain/types/ReportBlockClientInputPrimitives.js +2 -0
- package/build/carbonbox/reporting/shared/domain/value-objects/ReportSection.js +43 -0
- package/build/carbonbox/shared/domain/authorization/enums/Permission.js +6 -0
- package/build/carbonbox/shared/domain/enums/ErrorCode.js +9 -0
- package/build/carbonbox/shared/domain/enums/SemanticUuidPrefix.js +2 -0
- package/build/main/index.js +45 -8
- package/build/types/carbonbox/reporting/report-instances/domain/entity/ReportInstance.d.ts.map +1 -1
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/entity/IReportPreparationQuestionnaire.d.ts +28 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/entity/IReportPreparationQuestionnaire.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/entity/ReportPreparationQuestionnaire.d.ts +55 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/entity/ReportPreparationQuestionnaire.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/enums/ReportPreparationQuestionnaireStatus.d.ts +19 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/enums/ReportPreparationQuestionnaireStatus.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/DuplicatePreparationQuestionError.d.ts +7 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/DuplicatePreparationQuestionError.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/InvalidPreparationAnswerError.d.ts +7 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/InvalidPreparationAnswerError.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/InvalidPreparationQuestionError.d.ts +7 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/InvalidPreparationQuestionError.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/PreparationQuestionNotFoundError.d.ts +7 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/PreparationQuestionNotFoundError.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/ReportPreparationQuestionnaireCannotBeCompletedError.d.ts +8 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/ReportPreparationQuestionnaireCannotBeCompletedError.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/ReportPreparationQuestionnaireCannotBeModifiedError.d.ts +7 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/ReportPreparationQuestionnaireCannotBeModifiedError.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/ReportPreparationQuestionnaireCannotBeReopenedError.d.ts +7 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/ReportPreparationQuestionnaireCannotBeReopenedError.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/TemplateQuestionCannotBeRemovedError.d.ts +7 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/exceptions/TemplateQuestionCannotBeRemovedError.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/repository/IReportPreparationQuestionnaireRepository.d.ts +61 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/repository/IReportPreparationQuestionnaireRepository.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/types/PreparationAnswerPrimitives.d.ts +7 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/types/PreparationAnswerPrimitives.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/types/PreparationQuestionPrimitives.d.ts +17 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/types/PreparationQuestionPrimitives.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/types/ReportPreparationQuestionnaireCompletionPrimitives.d.ts +7 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/types/ReportPreparationQuestionnaireCompletionPrimitives.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/types/ReportPreparationQuestionnairePrimitives.d.ts +17 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/types/ReportPreparationQuestionnairePrimitives.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/types/ReportPreparationQuestionnaireProps.d.ts +15 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/types/ReportPreparationQuestionnaireProps.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/value-objects/PreparationAnswer.d.ts +16 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/value-objects/PreparationAnswer.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/value-objects/PreparationQuestion.d.ts +33 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/value-objects/PreparationQuestion.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/value-objects/ReportPreparationQuestionnaireCompletion.d.ts +17 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/value-objects/ReportPreparationQuestionnaireCompletion.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/value-objects/ReportPreparationQuestionnaireId.d.ts +14 -0
- package/build/types/carbonbox/reporting/report-preparation-questionnaires/domain/value-objects/ReportPreparationQuestionnaireId.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/shared/domain/enums/ClientInputFieldType.d.ts +31 -0
- package/build/types/carbonbox/reporting/shared/domain/enums/ClientInputFieldType.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/shared/domain/enums/QuestionnaireQuestionOrigin.d.ts +15 -0
- package/build/types/carbonbox/reporting/shared/domain/enums/QuestionnaireQuestionOrigin.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/shared/domain/exceptions/InvalidReportBlockClientInputError.d.ts +7 -0
- package/build/types/carbonbox/reporting/shared/domain/exceptions/InvalidReportBlockClientInputError.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/shared/domain/types/QuestionnaireAnswerPrimitives.d.ts +8 -2
- package/build/types/carbonbox/reporting/shared/domain/types/QuestionnaireAnswerPrimitives.d.ts.map +1 -1
- package/build/types/carbonbox/reporting/shared/domain/types/ReportBlockClientInputPrimitives.d.ts +14 -0
- package/build/types/carbonbox/reporting/shared/domain/types/ReportBlockClientInputPrimitives.d.ts.map +1 -0
- package/build/types/carbonbox/reporting/shared/domain/types/ReportBlockPrimitives.d.ts +2 -0
- package/build/types/carbonbox/reporting/shared/domain/types/ReportBlockPrimitives.d.ts.map +1 -1
- package/build/types/carbonbox/reporting/shared/domain/value-objects/ReportSection.d.ts +11 -0
- package/build/types/carbonbox/reporting/shared/domain/value-objects/ReportSection.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/authorization/enums/Permission.d.ts +7 -1
- package/build/types/carbonbox/shared/domain/authorization/enums/Permission.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/enums/ErrorCode.d.ts +9 -0
- package/build/types/carbonbox/shared/domain/enums/ErrorCode.d.ts.map +1 -1
- package/build/types/carbonbox/shared/domain/enums/SemanticUuidPrefix.d.ts +3 -1
- package/build/types/carbonbox/shared/domain/enums/SemanticUuidPrefix.d.ts.map +1 -1
- package/build/types/main/index.d.ts +25 -0
- package/build/types/main/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PreparationAnswer = void 0;
|
|
4
|
+
const ValueObject_1 = require("../../../../shared/domain/value-objects/ValueObject");
|
|
5
|
+
const InvalidPreparationAnswerError_1 = require("../exceptions/InvalidPreparationAnswerError");
|
|
6
|
+
class PreparationAnswer extends ValueObject_1.ValueObject {
|
|
7
|
+
constructor(value, skipDomainValidation) {
|
|
8
|
+
super(value, skipDomainValidation, PreparationAnswer.PROPERTY_NAME, PreparationAnswer.EXPECTED_TYPE);
|
|
9
|
+
if (!skipDomainValidation) {
|
|
10
|
+
this.validatePreparationAnswer(value);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
static create(value) {
|
|
14
|
+
return new PreparationAnswer(value, false);
|
|
15
|
+
}
|
|
16
|
+
static fromPrimitives(primitives) {
|
|
17
|
+
return new PreparationAnswer(primitives, true);
|
|
18
|
+
}
|
|
19
|
+
validatePreparationAnswer(value) {
|
|
20
|
+
if (!value.questionId || value.questionId.trim() === '') {
|
|
21
|
+
throw InvalidPreparationAnswerError_1.InvalidPreparationAnswerError.create(value.questionId, 'UNKNOWN', value.answer, 'questionId cannot be empty');
|
|
22
|
+
}
|
|
23
|
+
if (typeof value.answer !== 'string' || value.answer.trim() === '') {
|
|
24
|
+
throw InvalidPreparationAnswerError_1.InvalidPreparationAnswerError.create(value.questionId, 'UNKNOWN', String(value.answer), 'answer cannot be empty');
|
|
25
|
+
}
|
|
26
|
+
if (!value.answeredAt || Number.isNaN(Date.parse(value.answeredAt))) {
|
|
27
|
+
throw InvalidPreparationAnswerError_1.InvalidPreparationAnswerError.create(value.questionId, 'UNKNOWN', value.answer, 'answeredAt must be an ISO 8601 timestamp');
|
|
28
|
+
}
|
|
29
|
+
if (!value.answeredBy || value.answeredBy.trim() === '') {
|
|
30
|
+
throw InvalidPreparationAnswerError_1.InvalidPreparationAnswerError.create(value.questionId, 'UNKNOWN', value.answer, 'answeredBy cannot be empty');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
getQuestionId() {
|
|
34
|
+
return this.value.questionId;
|
|
35
|
+
}
|
|
36
|
+
getAnswer() {
|
|
37
|
+
return this.value.answer;
|
|
38
|
+
}
|
|
39
|
+
getAnsweredAt() {
|
|
40
|
+
return this.value.answeredAt;
|
|
41
|
+
}
|
|
42
|
+
getAnsweredBy() {
|
|
43
|
+
return this.value.answeredBy;
|
|
44
|
+
}
|
|
45
|
+
toPrimitives() {
|
|
46
|
+
return {
|
|
47
|
+
questionId: this.value.questionId,
|
|
48
|
+
answer: this.value.answer,
|
|
49
|
+
answeredAt: this.value.answeredAt,
|
|
50
|
+
answeredBy: this.value.answeredBy,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.PreparationAnswer = PreparationAnswer;
|
|
55
|
+
PreparationAnswer.PROPERTY_NAME = 'preparationAnswer';
|
|
56
|
+
PreparationAnswer.EXPECTED_TYPE = 'PreparationAnswerPrimitives';
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PreparationQuestion = void 0;
|
|
4
|
+
const ValueObject_1 = require("../../../../shared/domain/value-objects/ValueObject");
|
|
5
|
+
const ClientInputFieldType_1 = require("../../../shared/domain/enums/ClientInputFieldType");
|
|
6
|
+
const QuestionnaireQuestionOrigin_1 = require("../../../shared/domain/enums/QuestionnaireQuestionOrigin");
|
|
7
|
+
const InvalidPreparationQuestionError_1 = require("../exceptions/InvalidPreparationQuestionError");
|
|
8
|
+
const InvalidPreparationAnswerError_1 = require("../exceptions/InvalidPreparationAnswerError");
|
|
9
|
+
class PreparationQuestion extends ValueObject_1.ValueObject {
|
|
10
|
+
constructor(value, skipDomainValidation) {
|
|
11
|
+
super(value, skipDomainValidation, PreparationQuestion.PROPERTY_NAME, PreparationQuestion.EXPECTED_TYPE);
|
|
12
|
+
if (!skipDomainValidation) {
|
|
13
|
+
this.validatePreparationQuestion(value);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
static create(value) {
|
|
17
|
+
return new PreparationQuestion(value, false);
|
|
18
|
+
}
|
|
19
|
+
static fromPrimitives(primitives) {
|
|
20
|
+
return new PreparationQuestion(primitives, true);
|
|
21
|
+
}
|
|
22
|
+
validatePreparationQuestion(value) {
|
|
23
|
+
if (!value.id || value.id.trim() === '') {
|
|
24
|
+
throw InvalidPreparationQuestionError_1.InvalidPreparationQuestionError.create(value.id, 'id cannot be empty');
|
|
25
|
+
}
|
|
26
|
+
if (!Object.values(QuestionnaireQuestionOrigin_1.QuestionnaireQuestionOrigin).includes(value.origin)) {
|
|
27
|
+
throw InvalidPreparationQuestionError_1.InvalidPreparationQuestionError.create(value.id, `origin '${value.origin}' is not supported`);
|
|
28
|
+
}
|
|
29
|
+
if (!value.questionText || value.questionText.trim() === '') {
|
|
30
|
+
throw InvalidPreparationQuestionError_1.InvalidPreparationQuestionError.create(value.id, 'questionText cannot be empty');
|
|
31
|
+
}
|
|
32
|
+
if (!Object.values(ClientInputFieldType_1.ClientInputFieldType).includes(value.fieldType)) {
|
|
33
|
+
throw InvalidPreparationQuestionError_1.InvalidPreparationQuestionError.create(value.id, `fieldType '${value.fieldType}' is not supported`);
|
|
34
|
+
}
|
|
35
|
+
const isChoice = PreparationQuestion.CHOICE_FIELD_TYPES.includes(value.fieldType);
|
|
36
|
+
if (isChoice && (!Array.isArray(value.options) || value.options.length === 0)) {
|
|
37
|
+
throw InvalidPreparationQuestionError_1.InvalidPreparationQuestionError.create(value.id, `fieldType '${value.fieldType}' requires at least one option`);
|
|
38
|
+
}
|
|
39
|
+
if (!isChoice && Array.isArray(value.options) && value.options.length > 0) {
|
|
40
|
+
throw InvalidPreparationQuestionError_1.InvalidPreparationQuestionError.create(value.id, `fieldType '${value.fieldType}' must not define options`);
|
|
41
|
+
}
|
|
42
|
+
if (value.minLength !== null && (!Number.isInteger(value.minLength) || value.minLength < 0)) {
|
|
43
|
+
throw InvalidPreparationQuestionError_1.InvalidPreparationQuestionError.create(value.id, 'minLength must be a non-negative integer or null');
|
|
44
|
+
}
|
|
45
|
+
if (value.maxLength !== null && (!Number.isInteger(value.maxLength) || value.maxLength <= 0)) {
|
|
46
|
+
throw InvalidPreparationQuestionError_1.InvalidPreparationQuestionError.create(value.id, 'maxLength must be a positive integer or null');
|
|
47
|
+
}
|
|
48
|
+
if (value.minLength !== null && value.maxLength !== null && value.minLength > value.maxLength) {
|
|
49
|
+
throw InvalidPreparationQuestionError_1.InvalidPreparationQuestionError.create(value.id, 'minLength cannot exceed maxLength');
|
|
50
|
+
}
|
|
51
|
+
if (!Number.isInteger(value.order) || value.order < 0) {
|
|
52
|
+
throw InvalidPreparationQuestionError_1.InvalidPreparationQuestionError.create(value.id, 'order must be a non-negative integer');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Validates a candidate answer against the question field type and constraints.
|
|
57
|
+
* Throws InvalidPreparationAnswerError when the answer is not acceptable.
|
|
58
|
+
*/
|
|
59
|
+
validateAnswer(answer) {
|
|
60
|
+
const questionId = this.value.id;
|
|
61
|
+
const { fieldType } = this.value;
|
|
62
|
+
if (typeof answer !== 'string' || answer.trim() === '') {
|
|
63
|
+
throw InvalidPreparationAnswerError_1.InvalidPreparationAnswerError.create(questionId, fieldType, String(answer), 'answer cannot be empty');
|
|
64
|
+
}
|
|
65
|
+
const trimmedAnswer = answer.trim();
|
|
66
|
+
if (PreparationQuestion.TEXT_FIELD_TYPES.includes(fieldType)) {
|
|
67
|
+
this.validateTextAnswer(trimmedAnswer);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (fieldType === ClientInputFieldType_1.ClientInputFieldType.NUMBER) {
|
|
71
|
+
if (!Number.isFinite(Number(trimmedAnswer))) {
|
|
72
|
+
throw InvalidPreparationAnswerError_1.InvalidPreparationAnswerError.create(questionId, fieldType, trimmedAnswer, 'answer must be a numeric value');
|
|
73
|
+
}
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (fieldType === ClientInputFieldType_1.ClientInputFieldType.DATE) {
|
|
77
|
+
if (Number.isNaN(Date.parse(trimmedAnswer))) {
|
|
78
|
+
throw InvalidPreparationAnswerError_1.InvalidPreparationAnswerError.create(questionId, fieldType, trimmedAnswer, 'answer must be an ISO 8601 date');
|
|
79
|
+
}
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (fieldType === ClientInputFieldType_1.ClientInputFieldType.SINGLE_CHOICE) {
|
|
83
|
+
if (!this.value.options.includes(trimmedAnswer)) {
|
|
84
|
+
throw InvalidPreparationAnswerError_1.InvalidPreparationAnswerError.create(questionId, fieldType, trimmedAnswer, `answer must be one of: ${this.value.options.join(', ')}`);
|
|
85
|
+
}
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (fieldType === ClientInputFieldType_1.ClientInputFieldType.MULTIPLE_CHOICE) {
|
|
89
|
+
this.validateMultipleChoiceAnswer(trimmedAnswer);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
validateTextAnswer(answer) {
|
|
93
|
+
if (this.value.minLength !== null && answer.length < this.value.minLength) {
|
|
94
|
+
throw InvalidPreparationAnswerError_1.InvalidPreparationAnswerError.create(this.value.id, this.value.fieldType, answer, `answer must have at least ${this.value.minLength} characters`);
|
|
95
|
+
}
|
|
96
|
+
if (this.value.maxLength !== null && answer.length > this.value.maxLength) {
|
|
97
|
+
throw InvalidPreparationAnswerError_1.InvalidPreparationAnswerError.create(this.value.id, this.value.fieldType, answer, `answer must have at most ${this.value.maxLength} characters`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
validateMultipleChoiceAnswer(answer) {
|
|
101
|
+
let selectedOptions;
|
|
102
|
+
try {
|
|
103
|
+
selectedOptions = JSON.parse(answer);
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
throw InvalidPreparationAnswerError_1.InvalidPreparationAnswerError.create(this.value.id, this.value.fieldType, answer, 'answer must be a JSON array of selected options');
|
|
107
|
+
}
|
|
108
|
+
if (!Array.isArray(selectedOptions) || selectedOptions.length === 0) {
|
|
109
|
+
throw InvalidPreparationAnswerError_1.InvalidPreparationAnswerError.create(this.value.id, this.value.fieldType, answer, 'answer must be a non-empty JSON array of selected options');
|
|
110
|
+
}
|
|
111
|
+
const invalidOptions = selectedOptions.filter((option) => typeof option !== 'string' || !this.value.options.includes(option));
|
|
112
|
+
if (invalidOptions.length > 0) {
|
|
113
|
+
throw InvalidPreparationAnswerError_1.InvalidPreparationAnswerError.create(this.value.id, this.value.fieldType, answer, `selected options must be among: ${this.value.options.join(', ')}`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
getId() {
|
|
117
|
+
return this.value.id;
|
|
118
|
+
}
|
|
119
|
+
getOrigin() {
|
|
120
|
+
return this.value.origin;
|
|
121
|
+
}
|
|
122
|
+
getTargetSectionId() {
|
|
123
|
+
return this.value.targetSectionId;
|
|
124
|
+
}
|
|
125
|
+
getQuestionText() {
|
|
126
|
+
return this.value.questionText;
|
|
127
|
+
}
|
|
128
|
+
getFieldType() {
|
|
129
|
+
return this.value.fieldType;
|
|
130
|
+
}
|
|
131
|
+
getAiInstruction() {
|
|
132
|
+
return this.value.aiInstruction;
|
|
133
|
+
}
|
|
134
|
+
getOrder() {
|
|
135
|
+
return this.value.order;
|
|
136
|
+
}
|
|
137
|
+
isRequired() {
|
|
138
|
+
return this.value.isRequired;
|
|
139
|
+
}
|
|
140
|
+
isFromTemplate() {
|
|
141
|
+
return this.value.origin === QuestionnaireQuestionOrigin_1.QuestionnaireQuestionOrigin.TEMPLATE;
|
|
142
|
+
}
|
|
143
|
+
isCustom() {
|
|
144
|
+
return this.value.origin === QuestionnaireQuestionOrigin_1.QuestionnaireQuestionOrigin.CUSTOM;
|
|
145
|
+
}
|
|
146
|
+
toPrimitives() {
|
|
147
|
+
return {
|
|
148
|
+
id: this.value.id,
|
|
149
|
+
origin: this.value.origin,
|
|
150
|
+
targetSectionId: this.value.targetSectionId,
|
|
151
|
+
questionText: this.value.questionText,
|
|
152
|
+
helpText: this.value.helpText,
|
|
153
|
+
fieldType: this.value.fieldType,
|
|
154
|
+
options: [...this.value.options],
|
|
155
|
+
isRequired: this.value.isRequired,
|
|
156
|
+
aiInstruction: this.value.aiInstruction,
|
|
157
|
+
minLength: this.value.minLength,
|
|
158
|
+
maxLength: this.value.maxLength,
|
|
159
|
+
order: this.value.order,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
exports.PreparationQuestion = PreparationQuestion;
|
|
164
|
+
PreparationQuestion.PROPERTY_NAME = 'preparationQuestion';
|
|
165
|
+
PreparationQuestion.EXPECTED_TYPE = 'PreparationQuestionPrimitives';
|
|
166
|
+
PreparationQuestion.CHOICE_FIELD_TYPES = [
|
|
167
|
+
ClientInputFieldType_1.ClientInputFieldType.SINGLE_CHOICE,
|
|
168
|
+
ClientInputFieldType_1.ClientInputFieldType.MULTIPLE_CHOICE,
|
|
169
|
+
];
|
|
170
|
+
PreparationQuestion.TEXT_FIELD_TYPES = [
|
|
171
|
+
ClientInputFieldType_1.ClientInputFieldType.SHORT_TEXT,
|
|
172
|
+
ClientInputFieldType_1.ClientInputFieldType.LONG_TEXT,
|
|
173
|
+
];
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportPreparationQuestionnaireCompletion = void 0;
|
|
4
|
+
const ValueObject_1 = require("../../../../shared/domain/value-objects/ValueObject");
|
|
5
|
+
class ReportPreparationQuestionnaireCompletion extends ValueObject_1.ValueObject {
|
|
6
|
+
constructor(value, skipDomainValidation) {
|
|
7
|
+
super(value, skipDomainValidation, ReportPreparationQuestionnaireCompletion.PROPERTY_NAME, ReportPreparationQuestionnaireCompletion.EXPECTED_TYPE);
|
|
8
|
+
}
|
|
9
|
+
static create(value) {
|
|
10
|
+
return new ReportPreparationQuestionnaireCompletion(value, false);
|
|
11
|
+
}
|
|
12
|
+
static fromPrimitives(primitives) {
|
|
13
|
+
return new ReportPreparationQuestionnaireCompletion(primitives, true);
|
|
14
|
+
}
|
|
15
|
+
isComplete() {
|
|
16
|
+
return this.value.answeredRequired >= this.value.totalRequired;
|
|
17
|
+
}
|
|
18
|
+
getAnsweredRequired() {
|
|
19
|
+
return this.value.answeredRequired;
|
|
20
|
+
}
|
|
21
|
+
getTotalRequired() {
|
|
22
|
+
return this.value.totalRequired;
|
|
23
|
+
}
|
|
24
|
+
getAnsweredTotal() {
|
|
25
|
+
return this.value.answeredTotal;
|
|
26
|
+
}
|
|
27
|
+
getTotalQuestions() {
|
|
28
|
+
return this.value.totalQuestions;
|
|
29
|
+
}
|
|
30
|
+
getRequiredCompletionPercentage() {
|
|
31
|
+
if (this.value.totalRequired === 0) {
|
|
32
|
+
return 100;
|
|
33
|
+
}
|
|
34
|
+
return Math.round((this.value.answeredRequired / this.value.totalRequired) * 100);
|
|
35
|
+
}
|
|
36
|
+
toPrimitives() {
|
|
37
|
+
return {
|
|
38
|
+
answeredRequired: this.value.answeredRequired,
|
|
39
|
+
totalRequired: this.value.totalRequired,
|
|
40
|
+
answeredTotal: this.value.answeredTotal,
|
|
41
|
+
totalQuestions: this.value.totalQuestions,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.ReportPreparationQuestionnaireCompletion = ReportPreparationQuestionnaireCompletion;
|
|
46
|
+
ReportPreparationQuestionnaireCompletion.PROPERTY_NAME = 'completion';
|
|
47
|
+
ReportPreparationQuestionnaireCompletion.EXPECTED_TYPE = 'ReportPreparationQuestionnaireCompletionPrimitives';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportPreparationQuestionnaireId = void 0;
|
|
4
|
+
const AggregateId_1 = require("../../../../shared/domain/value-objects/AggregateId");
|
|
5
|
+
const SemanticUuidPrefix_1 = require("../../../../shared/domain/enums/SemanticUuidPrefix");
|
|
6
|
+
const InvalidAggregatePrefixError_1 = require("../../../../shared/domain/exceptions/InvalidAggregatePrefixError");
|
|
7
|
+
class ReportPreparationQuestionnaireId extends AggregateId_1.AggregateId {
|
|
8
|
+
constructor(value, skipDomainValidation) {
|
|
9
|
+
super(value, skipDomainValidation, ReportPreparationQuestionnaireId.PROPERTY_NAME);
|
|
10
|
+
}
|
|
11
|
+
static create(value) {
|
|
12
|
+
AggregateId_1.AggregateId.guardAgainstEmptyValue(value, ReportPreparationQuestionnaireId.PROPERTY_NAME);
|
|
13
|
+
AggregateId_1.AggregateId.guardAgainstInvalidType(value, ReportPreparationQuestionnaireId.PROPERTY_NAME);
|
|
14
|
+
AggregateId_1.AggregateId.guardAgainstInvalidId(value, ReportPreparationQuestionnaireId.PROPERTY_NAME);
|
|
15
|
+
// Validate that the prefix is valid for ReportPreparationQuestionnaire
|
|
16
|
+
ReportPreparationQuestionnaireId.guardAgainstInvalidPrefix(value);
|
|
17
|
+
return new ReportPreparationQuestionnaireId(value, false);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Validates that the UUID has a valid ReportPreparationQuestionnaire prefix
|
|
21
|
+
*/
|
|
22
|
+
static guardAgainstInvalidPrefix(value) {
|
|
23
|
+
try {
|
|
24
|
+
const tempInstance = new ReportPreparationQuestionnaireId(value, true);
|
|
25
|
+
const prefix = tempInstance.extractPrefix();
|
|
26
|
+
if (ReportPreparationQuestionnaireId.VALID_PREFIXES.includes(prefix) === false) {
|
|
27
|
+
throw InvalidAggregatePrefixError_1.InvalidAggregatePrefixError.create(value, 'ReportPreparationQuestionnaire', prefix, ReportPreparationQuestionnaireId.VALID_PREFIXES, ReportPreparationQuestionnaireId.PROPERTY_NAME);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
if (error instanceof InvalidAggregatePrefixError_1.InvalidAggregatePrefixError) {
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
if (error instanceof Error) {
|
|
35
|
+
throw InvalidAggregatePrefixError_1.InvalidAggregatePrefixError.create(value, 'ReportPreparationQuestionnaire', 'UNKNOWN', ReportPreparationQuestionnaireId.VALID_PREFIXES, ReportPreparationQuestionnaireId.PROPERTY_NAME);
|
|
36
|
+
}
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
static fromPrimitives(primitive) {
|
|
41
|
+
const value = primitive;
|
|
42
|
+
return new ReportPreparationQuestionnaireId(value, true);
|
|
43
|
+
}
|
|
44
|
+
toPrimitives() {
|
|
45
|
+
return this.value;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.ReportPreparationQuestionnaireId = ReportPreparationQuestionnaireId;
|
|
49
|
+
ReportPreparationQuestionnaireId.PROPERTY_NAME = 'id';
|
|
50
|
+
ReportPreparationQuestionnaireId.VALID_PREFIXES = [
|
|
51
|
+
SemanticUuidPrefix_1.SemanticUuidPrefix.RPT_PREPARATION_QUESTIONNAIRE,
|
|
52
|
+
];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientInputFieldType = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Client input field type enumeration
|
|
6
|
+
* Defines how a CLIENT_INPUT block (questionnaire question) is captured and validated
|
|
7
|
+
*/
|
|
8
|
+
var ClientInputFieldType;
|
|
9
|
+
(function (ClientInputFieldType) {
|
|
10
|
+
/**
|
|
11
|
+
* Short free text (single line)
|
|
12
|
+
*/
|
|
13
|
+
ClientInputFieldType["SHORT_TEXT"] = "SHORT_TEXT";
|
|
14
|
+
/**
|
|
15
|
+
* Long free text (paragraphs). Subject to block minLength/maxLength
|
|
16
|
+
*/
|
|
17
|
+
ClientInputFieldType["LONG_TEXT"] = "LONG_TEXT";
|
|
18
|
+
/**
|
|
19
|
+
* Numeric value (integer or decimal)
|
|
20
|
+
*/
|
|
21
|
+
ClientInputFieldType["NUMBER"] = "NUMBER";
|
|
22
|
+
/**
|
|
23
|
+
* Date value (ISO 8601 string)
|
|
24
|
+
*/
|
|
25
|
+
ClientInputFieldType["DATE"] = "DATE";
|
|
26
|
+
/**
|
|
27
|
+
* Exactly one option from the configured list
|
|
28
|
+
*/
|
|
29
|
+
ClientInputFieldType["SINGLE_CHOICE"] = "SINGLE_CHOICE";
|
|
30
|
+
/**
|
|
31
|
+
* One or more options from the configured list (answer is a JSON array of option strings)
|
|
32
|
+
*/
|
|
33
|
+
ClientInputFieldType["MULTIPLE_CHOICE"] = "MULTIPLE_CHOICE";
|
|
34
|
+
})(ClientInputFieldType || (exports.ClientInputFieldType = ClientInputFieldType = {}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QuestionnaireQuestionOrigin = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Questionnaire question origin enumeration
|
|
6
|
+
* Defines where a report preparation question comes from
|
|
7
|
+
*/
|
|
8
|
+
var QuestionnaireQuestionOrigin;
|
|
9
|
+
(function (QuestionnaireQuestionOrigin) {
|
|
10
|
+
/**
|
|
11
|
+
* Materialized from a CLIENT_INPUT block of the report template (question id = block id)
|
|
12
|
+
*/
|
|
13
|
+
QuestionnaireQuestionOrigin["TEMPLATE"] = "TEMPLATE";
|
|
14
|
+
/**
|
|
15
|
+
* Added by the client (or on its behalf) to provide extra information for the AI
|
|
16
|
+
*/
|
|
17
|
+
QuestionnaireQuestionOrigin["CUSTOM"] = "CUSTOM";
|
|
18
|
+
})(QuestionnaireQuestionOrigin || (exports.QuestionnaireQuestionOrigin = QuestionnaireQuestionOrigin = {}));
|
package/build/carbonbox/reporting/shared/domain/exceptions/InvalidReportBlockClientInputError.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidReportBlockClientInputError = void 0;
|
|
4
|
+
const CodedRootError_1 = require("../../../../shared/domain/exceptions/CodedRootError");
|
|
5
|
+
const ErrorCode_1 = require("../../../../shared/domain/enums/ErrorCode");
|
|
6
|
+
class InvalidReportBlockClientInputError extends CodedRootError_1.CodedRootError {
|
|
7
|
+
constructor(sectionId, blockId, reason) {
|
|
8
|
+
const technicalMessage = `Invalid client input configuration for block '${blockId}' in section '${sectionId}': ${reason}`;
|
|
9
|
+
const context = {
|
|
10
|
+
sectionId,
|
|
11
|
+
blockId,
|
|
12
|
+
reason,
|
|
13
|
+
timestamp: new Date().toISOString(),
|
|
14
|
+
};
|
|
15
|
+
const suggestions = [
|
|
16
|
+
'CLIENT_INPUT blocks must define a clientInput descriptor (questionText, fieldType, options, isRequired)',
|
|
17
|
+
'Blocks with any other nature must set clientInput to null',
|
|
18
|
+
'SINGLE_CHOICE and MULTIPLE_CHOICE questions must provide at least one option',
|
|
19
|
+
`Review the template definition of block '${blockId}' in section '${sectionId}'`,
|
|
20
|
+
];
|
|
21
|
+
super(ErrorCode_1.ErrorCode.INVALID_REPORT_BLOCK_CLIENT_INPUT, technicalMessage, context, suggestions);
|
|
22
|
+
this.name = 'InvalidReportBlockClientInputError';
|
|
23
|
+
}
|
|
24
|
+
static create(sectionId, blockId, reason) {
|
|
25
|
+
return new InvalidReportBlockClientInputError(sectionId, blockId, reason);
|
|
26
|
+
}
|
|
27
|
+
logError() {
|
|
28
|
+
return `${this.name}: ${this.technicalMessage}`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.InvalidReportBlockClientInputError = InvalidReportBlockClientInputError;
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ReportSection = void 0;
|
|
4
4
|
const ValueObject_1 = require("../../../../shared/domain/value-objects/ValueObject");
|
|
5
|
+
const BlockNature_1 = require("../enums/BlockNature");
|
|
6
|
+
const ClientInputFieldType_1 = require("../enums/ClientInputFieldType");
|
|
5
7
|
const InvalidReportSectionIdError_1 = require("../exceptions/InvalidReportSectionIdError");
|
|
6
8
|
const InvalidReportSectionTitleError_1 = require("../exceptions/InvalidReportSectionTitleError");
|
|
7
9
|
const InvalidReportSectionOrderError_1 = require("../exceptions/InvalidReportSectionOrderError");
|
|
8
10
|
const EmptyReportSectionBlocksError_1 = require("../exceptions/EmptyReportSectionBlocksError");
|
|
11
|
+
const InvalidReportBlockClientInputError_1 = require("../exceptions/InvalidReportBlockClientInputError");
|
|
9
12
|
class ReportSection extends ValueObject_1.ValueObject {
|
|
10
13
|
constructor(value, skipDomainValidation) {
|
|
11
14
|
super(value, skipDomainValidation, ReportSection.PROPERTY_NAME, ReportSection.EXPECTED_TYPE);
|
|
@@ -32,6 +35,36 @@ class ReportSection extends ValueObject_1.ValueObject {
|
|
|
32
35
|
if (!Array.isArray(value.blocks) || value.blocks.length === 0) {
|
|
33
36
|
throw EmptyReportSectionBlocksError_1.EmptyReportSectionBlocksError.create(value.id);
|
|
34
37
|
}
|
|
38
|
+
value.blocks.forEach((block) => this.validateBlockClientInput(value.id, block));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Invariant: a block has a clientInput descriptor if and only if its nature is CLIENT_INPUT.
|
|
42
|
+
* The descriptor is the questionnaire question the client answers to fill the block.
|
|
43
|
+
*/
|
|
44
|
+
validateBlockClientInput(sectionId, block) {
|
|
45
|
+
const isClientInput = block.nature === BlockNature_1.BlockNature.CLIENT_INPUT;
|
|
46
|
+
if (isClientInput && block.clientInput === null) {
|
|
47
|
+
throw InvalidReportBlockClientInputError_1.InvalidReportBlockClientInputError.create(sectionId, block.id, 'CLIENT_INPUT blocks must define a clientInput descriptor');
|
|
48
|
+
}
|
|
49
|
+
if (!isClientInput && block.clientInput !== null) {
|
|
50
|
+
throw InvalidReportBlockClientInputError_1.InvalidReportBlockClientInputError.create(sectionId, block.id, `clientInput must be null for blocks of nature '${block.nature}'`);
|
|
51
|
+
}
|
|
52
|
+
if (!isClientInput || block.clientInput === null) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (!block.clientInput.questionText || block.clientInput.questionText.trim() === '') {
|
|
56
|
+
throw InvalidReportBlockClientInputError_1.InvalidReportBlockClientInputError.create(sectionId, block.id, 'questionText cannot be empty');
|
|
57
|
+
}
|
|
58
|
+
if (!Object.values(ClientInputFieldType_1.ClientInputFieldType).includes(block.clientInput.fieldType)) {
|
|
59
|
+
throw InvalidReportBlockClientInputError_1.InvalidReportBlockClientInputError.create(sectionId, block.id, `fieldType '${block.clientInput.fieldType}' is not supported`);
|
|
60
|
+
}
|
|
61
|
+
const isChoice = ReportSection.CHOICE_FIELD_TYPES.includes(block.clientInput.fieldType);
|
|
62
|
+
if (isChoice && (!Array.isArray(block.clientInput.options) || block.clientInput.options.length === 0)) {
|
|
63
|
+
throw InvalidReportBlockClientInputError_1.InvalidReportBlockClientInputError.create(sectionId, block.id, `fieldType '${block.clientInput.fieldType}' requires at least one option`);
|
|
64
|
+
}
|
|
65
|
+
if (!isChoice && Array.isArray(block.clientInput.options) && block.clientInput.options.length > 0) {
|
|
66
|
+
throw InvalidReportBlockClientInputError_1.InvalidReportBlockClientInputError.create(sectionId, block.id, `fieldType '${block.clientInput.fieldType}' must not define options`);
|
|
67
|
+
}
|
|
35
68
|
}
|
|
36
69
|
getId() {
|
|
37
70
|
return this.value.id;
|
|
@@ -45,6 +78,12 @@ class ReportSection extends ValueObject_1.ValueObject {
|
|
|
45
78
|
getBlocks() {
|
|
46
79
|
return this.value.blocks;
|
|
47
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Blocks whose content is provided by the client through the report preparation questionnaire.
|
|
83
|
+
*/
|
|
84
|
+
getClientInputBlocks() {
|
|
85
|
+
return this.value.blocks.filter((block) => block.nature === BlockNature_1.BlockNature.CLIENT_INPUT);
|
|
86
|
+
}
|
|
48
87
|
isRequired() {
|
|
49
88
|
return this.value.isRequired;
|
|
50
89
|
}
|
|
@@ -65,3 +104,7 @@ class ReportSection extends ValueObject_1.ValueObject {
|
|
|
65
104
|
exports.ReportSection = ReportSection;
|
|
66
105
|
ReportSection.PROPERTY_NAME = 'reportSection';
|
|
67
106
|
ReportSection.EXPECTED_TYPE = 'ReportSectionPrimitives';
|
|
107
|
+
ReportSection.CHOICE_FIELD_TYPES = [
|
|
108
|
+
ClientInputFieldType_1.ClientInputFieldType.SINGLE_CHOICE,
|
|
109
|
+
ClientInputFieldType_1.ClientInputFieldType.MULTIPLE_CHOICE,
|
|
110
|
+
];
|
|
@@ -272,4 +272,10 @@ var Permission;
|
|
|
272
272
|
Permission["REPORTING_ADD_TEXT_BANK_ENTRY"] = "REPORTING_ADD_TEXT_BANK_ENTRY";
|
|
273
273
|
Permission["REPORTING_VIEW_TEXT_BANK"] = "REPORTING_VIEW_TEXT_BANK";
|
|
274
274
|
Permission["REPORTING_VIEW_TEXT_BANK_LIST"] = "REPORTING_VIEW_TEXT_BANK_LIST";
|
|
275
|
+
Permission["REPORTING_CREATE_REPORT_PREPARATION_QUESTIONNAIRE"] = "REPORTING_CREATE_REPORT_PREPARATION_QUESTIONNAIRE";
|
|
276
|
+
Permission["REPORTING_ANSWER_REPORT_PREPARATION_QUESTIONNAIRE"] = "REPORTING_ANSWER_REPORT_PREPARATION_QUESTIONNAIRE";
|
|
277
|
+
Permission["REPORTING_COMPLETE_REPORT_PREPARATION_QUESTIONNAIRE"] = "REPORTING_COMPLETE_REPORT_PREPARATION_QUESTIONNAIRE";
|
|
278
|
+
Permission["REPORTING_MANAGE_REPORT_PREPARATION_QUESTIONNAIRE_CUSTOM_QUESTIONS"] = "REPORTING_MANAGE_REPORT_PREPARATION_QUESTIONNAIRE_CUSTOM_QUESTIONS";
|
|
279
|
+
Permission["REPORTING_VIEW_REPORT_PREPARATION_QUESTIONNAIRE"] = "REPORTING_VIEW_REPORT_PREPARATION_QUESTIONNAIRE";
|
|
280
|
+
Permission["REPORTING_VIEW_REPORT_PREPARATION_QUESTIONNAIRE_LIST"] = "REPORTING_VIEW_REPORT_PREPARATION_QUESTIONNAIRE_LIST";
|
|
275
281
|
})(Permission || (exports.Permission = Permission = {}));
|
|
@@ -153,6 +153,15 @@ var ErrorCode;
|
|
|
153
153
|
ErrorCode["REPORT_TEMPLATE_CANNOT_BE_ACTIVATED"] = "CBX-RPT-015";
|
|
154
154
|
ErrorCode["REPORT_TEMPLATE_CANNOT_BE_DEPRECATED"] = "CBX-RPT-016";
|
|
155
155
|
ErrorCode["REPORT_TEMPLATE_CANNOT_BE_VERSIONED"] = "CBX-RPT-017";
|
|
156
|
+
ErrorCode["INVALID_REPORT_BLOCK_CLIENT_INPUT"] = "CBX-RPT-018";
|
|
157
|
+
ErrorCode["PREPARATION_QUESTION_NOT_FOUND"] = "CBX-RPT-019";
|
|
158
|
+
ErrorCode["INVALID_PREPARATION_ANSWER"] = "CBX-RPT-020";
|
|
159
|
+
ErrorCode["DUPLICATE_PREPARATION_QUESTION"] = "CBX-RPT-021";
|
|
160
|
+
ErrorCode["TEMPLATE_QUESTION_CANNOT_BE_REMOVED"] = "CBX-RPT-022";
|
|
161
|
+
ErrorCode["REPORT_PREPARATION_QUESTIONNAIRE_CANNOT_BE_MODIFIED"] = "CBX-RPT-023";
|
|
162
|
+
ErrorCode["REPORT_PREPARATION_QUESTIONNAIRE_CANNOT_BE_COMPLETED"] = "CBX-RPT-024";
|
|
163
|
+
ErrorCode["REPORT_PREPARATION_QUESTIONNAIRE_CANNOT_BE_REOPENED"] = "CBX-RPT-025";
|
|
164
|
+
ErrorCode["INVALID_PREPARATION_QUESTION"] = "CBX-RPT-026";
|
|
156
165
|
// Shared/Common Errors (CBX-SHR-XXX)
|
|
157
166
|
ErrorCode["INVALID_EMAIL"] = "CBX-SHR-001";
|
|
158
167
|
ErrorCode["INVALID_DATE_FORMAT"] = "CBX-SHR-002";
|
|
@@ -83,6 +83,8 @@ var SemanticUuidPrefix;
|
|
|
83
83
|
SemanticUuidPrefix["RPT_TEXT_BANK"] = "RPT-TXB";
|
|
84
84
|
SemanticUuidPrefix["RPT_SECTION"] = "RPT-SEC";
|
|
85
85
|
SemanticUuidPrefix["RPT_BLOCK"] = "RPT-BLK";
|
|
86
|
+
SemanticUuidPrefix["RPT_PREPARATION_QUESTIONNAIRE"] = "RPT-PRE";
|
|
87
|
+
SemanticUuidPrefix["RPT_PREPARATION_QUESTION"] = "RPT-PRE-QST";
|
|
86
88
|
// Future expansion examples (when system grows):
|
|
87
89
|
// ADC_SUB_FIELDS = 'ADC-SUB-FLD', // Activity Data Collection -> Submissions -> Fields
|
|
88
90
|
// USR_STH_CHO_MGT = 'USR-STH-CHO-MGT', // Users -> Stakeholders -> Carbon Host -> Management
|