@carbonbox/domain 0.28.2 → 0.29.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.
Files changed (126) hide show
  1. package/build/carbonbox/purchase-management-system/purchase-contracts/domain/exceptions/InvalidContractStatusError.js +24 -7
  2. package/build/carbonbox/purchase-management-system/purchase-contracts/domain/exceptions/InvalidPaymentTermsError.js +24 -7
  3. package/build/carbonbox/reporting/report-instances/domain/value-objects/ReportInstanceId.js +52 -0
  4. package/build/carbonbox/reporting/report-templates/domain/enums/ReportTemplateStatus.js +26 -0
  5. package/build/carbonbox/reporting/report-templates/domain/types/ReportTemplatePrimitives.js +2 -0
  6. package/build/carbonbox/reporting/report-templates/domain/types/ReportTemplateProps.js +2 -0
  7. package/build/carbonbox/reporting/report-templates/domain/value-objects/ReportTemplateId.js +52 -0
  8. package/build/carbonbox/reporting/shared/domain/enums/BlockNature.js +30 -0
  9. package/build/carbonbox/reporting/shared/domain/enums/DataBindingSource.js +91 -0
  10. package/build/carbonbox/reporting/shared/domain/enums/ReportStatus.js +42 -0
  11. package/build/carbonbox/reporting/shared/domain/enums/ReportType.js +30 -0
  12. package/build/carbonbox/reporting/shared/domain/exceptions/EmptyReportSectionBlocksError.js +18 -0
  13. package/build/carbonbox/reporting/shared/domain/exceptions/InvalidReportInstanceIdError.js +18 -0
  14. package/build/carbonbox/reporting/shared/domain/exceptions/InvalidReportSectionIdError.js +18 -0
  15. package/build/carbonbox/reporting/shared/domain/exceptions/InvalidReportSectionOrderError.js +18 -0
  16. package/build/carbonbox/reporting/shared/domain/exceptions/InvalidReportSectionTitleError.js +18 -0
  17. package/build/carbonbox/reporting/shared/domain/exceptions/InvalidReportTemplateIdError.js +18 -0
  18. package/build/carbonbox/reporting/shared/domain/types/ReportBlockPrimitives.js +2 -0
  19. package/build/carbonbox/reporting/shared/domain/types/ReportSectionPrimitives.js +2 -0
  20. package/build/carbonbox/reporting/shared/domain/value-objects/ReportSection.js +67 -0
  21. package/build/carbonbox/reporting/text-banks/domain/value-objects/TextBankId.js +52 -0
  22. package/build/carbonbox/shared/domain/enums/ErrorCode.js +81 -0
  23. package/build/carbonbox/shared/domain/enums/SemanticUuidPrefix.js +6 -0
  24. package/build/carbonbox/shared/domain/exceptions/AccountLockedError.js +58 -0
  25. package/build/carbonbox/shared/domain/exceptions/CodedRootError.js +63 -0
  26. package/build/carbonbox/shared/domain/exceptions/ConfigurationNotFoundError.js +62 -0
  27. package/build/carbonbox/shared/domain/exceptions/ContractNotFoundError.js +58 -0
  28. package/build/carbonbox/shared/domain/exceptions/EmailNotVerifiedError.js +61 -0
  29. package/build/carbonbox/shared/domain/exceptions/InvalidBusinessStatusError.js +56 -0
  30. package/build/carbonbox/shared/domain/exceptions/InvalidCredentialsError.js +35 -0
  31. package/build/carbonbox/shared/domain/exceptions/InvalidCurrencyError.js +51 -6
  32. package/build/carbonbox/shared/domain/exceptions/InvalidDateFormatError.js +26 -6
  33. package/build/carbonbox/shared/domain/exceptions/InvalidEmailPolicyError.js +15 -7
  34. package/build/carbonbox/shared/domain/exceptions/MissingCredentialsError.js +53 -0
  35. package/build/carbonbox/shared/domain/exceptions/NullValueError.js +16 -7
  36. package/build/carbonbox/shared/domain/exceptions/OrderExceedsBudgetError.js +98 -0
  37. package/build/carbonbox/shared/domain/exceptions/ServiceCatalogNotFoundError.js +64 -0
  38. package/build/carbonbox/shared/domain/exceptions/StakeholderNotFoundError.js +49 -0
  39. package/build/carbonbox/shared/domain/exceptions/TokenExpiredError.js +48 -0
  40. package/build/carbonbox/shared/domain/interfaces/ICodedError.js +2 -0
  41. package/build/main/index.js +37 -7
  42. package/build/types/carbonbox/carbon-footprint-configurations/corporate-configurations/domain/repository/ICorporateCarbonFootprintConfigurationRepository.d.ts +1 -1
  43. package/build/types/carbonbox/carbon-footprint-configurations/corporate-configurations/domain/repository/ICorporateCarbonFootprintConfigurationRepository.d.ts.map +1 -1
  44. package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/exceptions/InvalidContractStatusError.d.ts +9 -3
  45. package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/exceptions/InvalidContractStatusError.d.ts.map +1 -1
  46. package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/exceptions/InvalidPaymentTermsError.d.ts +9 -3
  47. package/build/types/carbonbox/purchase-management-system/purchase-contracts/domain/exceptions/InvalidPaymentTermsError.d.ts.map +1 -1
  48. package/build/types/carbonbox/reporting/report-instances/domain/value-objects/ReportInstanceId.d.ts +14 -0
  49. package/build/types/carbonbox/reporting/report-instances/domain/value-objects/ReportInstanceId.d.ts.map +1 -0
  50. package/build/types/carbonbox/reporting/report-templates/domain/enums/ReportTemplateStatus.d.ts +23 -0
  51. package/build/types/carbonbox/reporting/report-templates/domain/enums/ReportTemplateStatus.d.ts.map +1 -0
  52. package/build/types/carbonbox/reporting/report-templates/domain/types/ReportTemplatePrimitives.d.ts +21 -0
  53. package/build/types/carbonbox/reporting/report-templates/domain/types/ReportTemplatePrimitives.d.ts.map +1 -0
  54. package/build/types/carbonbox/reporting/report-templates/domain/types/ReportTemplateProps.d.ts +17 -0
  55. package/build/types/carbonbox/reporting/report-templates/domain/types/ReportTemplateProps.d.ts.map +1 -0
  56. package/build/types/carbonbox/reporting/report-templates/domain/value-objects/ReportTemplateId.d.ts +14 -0
  57. package/build/types/carbonbox/reporting/report-templates/domain/value-objects/ReportTemplateId.d.ts.map +1 -0
  58. package/build/types/carbonbox/reporting/shared/domain/enums/BlockNature.d.ts +27 -0
  59. package/build/types/carbonbox/reporting/shared/domain/enums/BlockNature.d.ts.map +1 -0
  60. package/build/types/carbonbox/reporting/shared/domain/enums/DataBindingSource.d.ts +72 -0
  61. package/build/types/carbonbox/reporting/shared/domain/enums/DataBindingSource.d.ts.map +1 -0
  62. package/build/types/carbonbox/reporting/shared/domain/enums/ReportStatus.d.ts +39 -0
  63. package/build/types/carbonbox/reporting/shared/domain/enums/ReportStatus.d.ts.map +1 -0
  64. package/build/types/carbonbox/reporting/shared/domain/enums/ReportType.d.ts +27 -0
  65. package/build/types/carbonbox/reporting/shared/domain/enums/ReportType.d.ts.map +1 -0
  66. package/build/types/carbonbox/reporting/shared/domain/exceptions/EmptyReportSectionBlocksError.d.ts +7 -0
  67. package/build/types/carbonbox/reporting/shared/domain/exceptions/EmptyReportSectionBlocksError.d.ts.map +1 -0
  68. package/build/types/carbonbox/reporting/shared/domain/exceptions/InvalidReportInstanceIdError.d.ts +7 -0
  69. package/build/types/carbonbox/reporting/shared/domain/exceptions/InvalidReportInstanceIdError.d.ts.map +1 -0
  70. package/build/types/carbonbox/reporting/shared/domain/exceptions/InvalidReportSectionIdError.d.ts +7 -0
  71. package/build/types/carbonbox/reporting/shared/domain/exceptions/InvalidReportSectionIdError.d.ts.map +1 -0
  72. package/build/types/carbonbox/reporting/shared/domain/exceptions/InvalidReportSectionOrderError.d.ts +7 -0
  73. package/build/types/carbonbox/reporting/shared/domain/exceptions/InvalidReportSectionOrderError.d.ts.map +1 -0
  74. package/build/types/carbonbox/reporting/shared/domain/exceptions/InvalidReportSectionTitleError.d.ts +7 -0
  75. package/build/types/carbonbox/reporting/shared/domain/exceptions/InvalidReportSectionTitleError.d.ts.map +1 -0
  76. package/build/types/carbonbox/reporting/shared/domain/exceptions/InvalidReportTemplateIdError.d.ts +7 -0
  77. package/build/types/carbonbox/reporting/shared/domain/exceptions/InvalidReportTemplateIdError.d.ts.map +1 -0
  78. package/build/types/carbonbox/reporting/shared/domain/types/ReportBlockPrimitives.d.ts +16 -0
  79. package/build/types/carbonbox/reporting/shared/domain/types/ReportBlockPrimitives.d.ts.map +1 -0
  80. package/build/types/carbonbox/reporting/shared/domain/types/ReportSectionPrimitives.d.ts +10 -0
  81. package/build/types/carbonbox/reporting/shared/domain/types/ReportSectionPrimitives.d.ts.map +1 -0
  82. package/build/types/carbonbox/reporting/shared/domain/value-objects/ReportSection.d.ts +18 -0
  83. package/build/types/carbonbox/reporting/shared/domain/value-objects/ReportSection.d.ts.map +1 -0
  84. package/build/types/carbonbox/reporting/text-banks/domain/value-objects/TextBankId.d.ts +14 -0
  85. package/build/types/carbonbox/reporting/text-banks/domain/value-objects/TextBankId.d.ts.map +1 -0
  86. package/build/types/carbonbox/shared/domain/enums/ErrorCode.d.ts +71 -0
  87. package/build/types/carbonbox/shared/domain/enums/ErrorCode.d.ts.map +1 -0
  88. package/build/types/carbonbox/shared/domain/enums/SemanticUuidPrefix.d.ts +6 -1
  89. package/build/types/carbonbox/shared/domain/enums/SemanticUuidPrefix.d.ts.map +1 -1
  90. package/build/types/carbonbox/shared/domain/exceptions/AccountLockedError.d.ts +25 -0
  91. package/build/types/carbonbox/shared/domain/exceptions/AccountLockedError.d.ts.map +1 -0
  92. package/build/types/carbonbox/shared/domain/exceptions/CodedRootError.d.ts +44 -0
  93. package/build/types/carbonbox/shared/domain/exceptions/CodedRootError.d.ts.map +1 -0
  94. package/build/types/carbonbox/shared/domain/exceptions/ConfigurationNotFoundError.d.ts +29 -0
  95. package/build/types/carbonbox/shared/domain/exceptions/ConfigurationNotFoundError.d.ts.map +1 -0
  96. package/build/types/carbonbox/shared/domain/exceptions/ContractNotFoundError.d.ts +25 -0
  97. package/build/types/carbonbox/shared/domain/exceptions/ContractNotFoundError.d.ts.map +1 -0
  98. package/build/types/carbonbox/shared/domain/exceptions/EmailNotVerifiedError.d.ts +27 -0
  99. package/build/types/carbonbox/shared/domain/exceptions/EmailNotVerifiedError.d.ts.map +1 -0
  100. package/build/types/carbonbox/shared/domain/exceptions/InvalidBusinessStatusError.d.ts +25 -0
  101. package/build/types/carbonbox/shared/domain/exceptions/InvalidBusinessStatusError.d.ts.map +1 -0
  102. package/build/types/carbonbox/shared/domain/exceptions/InvalidCredentialsError.d.ts +13 -0
  103. package/build/types/carbonbox/shared/domain/exceptions/InvalidCredentialsError.d.ts.map +1 -0
  104. package/build/types/carbonbox/shared/domain/exceptions/InvalidCurrencyError.d.ts +23 -3
  105. package/build/types/carbonbox/shared/domain/exceptions/InvalidCurrencyError.d.ts.map +1 -1
  106. package/build/types/carbonbox/shared/domain/exceptions/InvalidDateFormatError.d.ts +3 -3
  107. package/build/types/carbonbox/shared/domain/exceptions/InvalidDateFormatError.d.ts.map +1 -1
  108. package/build/types/carbonbox/shared/domain/exceptions/InvalidEmailPolicyError.d.ts +2 -3
  109. package/build/types/carbonbox/shared/domain/exceptions/InvalidEmailPolicyError.d.ts.map +1 -1
  110. package/build/types/carbonbox/shared/domain/exceptions/MissingCredentialsError.d.ts +25 -0
  111. package/build/types/carbonbox/shared/domain/exceptions/MissingCredentialsError.d.ts.map +1 -0
  112. package/build/types/carbonbox/shared/domain/exceptions/NullValueError.d.ts +2 -3
  113. package/build/types/carbonbox/shared/domain/exceptions/NullValueError.d.ts.map +1 -1
  114. package/build/types/carbonbox/shared/domain/exceptions/OrderExceedsBudgetError.d.ts +42 -0
  115. package/build/types/carbonbox/shared/domain/exceptions/OrderExceedsBudgetError.d.ts.map +1 -0
  116. package/build/types/carbonbox/shared/domain/exceptions/ServiceCatalogNotFoundError.d.ts +29 -0
  117. package/build/types/carbonbox/shared/domain/exceptions/ServiceCatalogNotFoundError.d.ts.map +1 -0
  118. package/build/types/carbonbox/shared/domain/exceptions/StakeholderNotFoundError.d.ts +21 -0
  119. package/build/types/carbonbox/shared/domain/exceptions/StakeholderNotFoundError.d.ts.map +1 -0
  120. package/build/types/carbonbox/shared/domain/exceptions/TokenExpiredError.d.ts +21 -0
  121. package/build/types/carbonbox/shared/domain/exceptions/TokenExpiredError.d.ts.map +1 -0
  122. package/build/types/carbonbox/shared/domain/interfaces/ICodedError.d.ts +38 -0
  123. package/build/types/carbonbox/shared/domain/interfaces/ICodedError.d.ts.map +1 -0
  124. package/build/types/main/index.d.ts +14 -0
  125. package/build/types/main/index.d.ts.map +1 -1
  126. package/package.json +1 -1
@@ -1,19 +1,36 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InvalidContractStatusError = void 0;
4
- const RootError_1 = require("../../../../shared/domain/exceptions/RootError");
5
- class InvalidContractStatusError extends RootError_1.RootError {
4
+ const CodedRootError_1 = require("../../../../shared/domain/exceptions/CodedRootError");
5
+ const ErrorCode_1 = require("../../../../shared/domain/enums/ErrorCode");
6
+ /**
7
+ * Exception thrown when an invalid contract status is provided
8
+ * This error occurs when the contract status doesn't match allowed values
9
+ *
10
+ * Error code: CBX-PMS-002
11
+ * @since 1.0.0
12
+ */
13
+ class InvalidContractStatusError extends CodedRootError_1.CodedRootError {
6
14
  constructor(contractStatus, validStatuses) {
15
+ const errorCode = ErrorCode_1.ErrorCode.INVALID_CONTRACT_STATUS;
7
16
  const validStatusesText = validStatuses.join(', ');
8
- const message = `Invalid contract status '${contractStatus}'. Valid contract statuses are: ${validStatusesText}`;
9
- super(message);
17
+ const technicalMessage = `Invalid contract status '${contractStatus}'. Valid contract statuses are: ${validStatusesText}`;
18
+ const context = {
19
+ providedStatus: contractStatus,
20
+ validStatuses,
21
+ timestamp: new Date().toISOString(),
22
+ };
23
+ const suggestions = [
24
+ `Use one of the valid contract statuses: ${validStatusesText}`,
25
+ 'Common statuses include: DRAFT, ACTIVE, SUSPENDED, TERMINATED, EXPIRED',
26
+ 'Check the contract lifecycle for valid status transitions',
27
+ 'Contact contract administration for status change requests',
28
+ ];
29
+ super(errorCode, technicalMessage, context, suggestions);
10
30
  this.name = 'InvalidContractStatusError';
11
31
  }
12
32
  static create(contractStatus, validStatuses) {
13
33
  return new InvalidContractStatusError(contractStatus, validStatuses);
14
34
  }
15
- logError() {
16
- return `${this.name}: ${this.message}`;
17
- }
18
35
  }
19
36
  exports.InvalidContractStatusError = InvalidContractStatusError;
@@ -1,19 +1,36 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InvalidPaymentTermsError = void 0;
4
- const RootError_1 = require("../../../../shared/domain/exceptions/RootError");
5
- class InvalidPaymentTermsError extends RootError_1.RootError {
4
+ const CodedRootError_1 = require("../../../../shared/domain/exceptions/CodedRootError");
5
+ const ErrorCode_1 = require("../../../../shared/domain/enums/ErrorCode");
6
+ /**
7
+ * Exception thrown when invalid payment terms are provided for a contract
8
+ * This error occurs when the payment terms don't match allowed values
9
+ *
10
+ * Error code: CBX-PMS-003
11
+ * @since 1.0.0
12
+ */
13
+ class InvalidPaymentTermsError extends CodedRootError_1.CodedRootError {
6
14
  constructor(paymentTerms, validTerms) {
15
+ const errorCode = ErrorCode_1.ErrorCode.INVALID_PAYMENT_TERMS;
7
16
  const validTermsText = validTerms.join(', ');
8
- const message = `Invalid payment terms '${paymentTerms}'. Valid payment terms are: ${validTermsText}`;
9
- super(message);
17
+ const technicalMessage = `Invalid payment terms '${paymentTerms}'. Valid payment terms are: ${validTermsText}`;
18
+ const context = {
19
+ providedTerms: paymentTerms,
20
+ validTerms,
21
+ timestamp: new Date().toISOString(),
22
+ };
23
+ const suggestions = [
24
+ `Use one of the valid payment terms: ${validTermsText}`,
25
+ 'Common payment terms include: NET30, NET60, NET90, IMMEDIATE',
26
+ 'Check contract requirements for specific payment terms',
27
+ 'Contact the finance team for special payment term requests',
28
+ ];
29
+ super(errorCode, technicalMessage, context, suggestions);
10
30
  this.name = 'InvalidPaymentTermsError';
11
31
  }
12
32
  static create(paymentTerms, validTerms) {
13
33
  return new InvalidPaymentTermsError(paymentTerms, validTerms);
14
34
  }
15
- logError() {
16
- return `${this.name}: ${this.message}`;
17
- }
18
35
  }
19
36
  exports.InvalidPaymentTermsError = InvalidPaymentTermsError;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReportInstanceId = 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 ReportInstanceId extends AggregateId_1.AggregateId {
8
+ constructor(value, skipDomainValidation) {
9
+ super(value, skipDomainValidation, ReportInstanceId.PROPERTY_NAME);
10
+ }
11
+ static create(value) {
12
+ AggregateId_1.AggregateId.guardAgainstEmptyValue(value, ReportInstanceId.PROPERTY_NAME);
13
+ AggregateId_1.AggregateId.guardAgainstInvalidType(value, ReportInstanceId.PROPERTY_NAME);
14
+ AggregateId_1.AggregateId.guardAgainstInvalidId(value, ReportInstanceId.PROPERTY_NAME);
15
+ // Validate that the prefix is valid for ReportInstance
16
+ ReportInstanceId.guardAgainstInvalidPrefix(value);
17
+ return new ReportInstanceId(value, false);
18
+ }
19
+ /**
20
+ * Validates that the UUID has a valid ReportInstance prefix
21
+ */
22
+ static guardAgainstInvalidPrefix(value) {
23
+ try {
24
+ const tempInstance = new ReportInstanceId(value, true);
25
+ const prefix = tempInstance.extractPrefix();
26
+ if (ReportInstanceId.VALID_PREFIXES.includes(prefix) === false) {
27
+ throw InvalidAggregatePrefixError_1.InvalidAggregatePrefixError.create(value, 'ReportInstance', prefix, ReportInstanceId.VALID_PREFIXES, ReportInstanceId.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, 'ReportInstance', 'UNKNOWN', ReportInstanceId.VALID_PREFIXES, ReportInstanceId.PROPERTY_NAME);
36
+ }
37
+ throw error;
38
+ }
39
+ }
40
+ static fromPrimitives(primitive) {
41
+ const value = primitive;
42
+ return new ReportInstanceId(value, true);
43
+ }
44
+ toPrimitives() {
45
+ return this.value;
46
+ }
47
+ }
48
+ exports.ReportInstanceId = ReportInstanceId;
49
+ ReportInstanceId.PROPERTY_NAME = 'id';
50
+ ReportInstanceId.VALID_PREFIXES = [
51
+ SemanticUuidPrefix_1.SemanticUuidPrefix.RPT_INSTANCE,
52
+ ];
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReportTemplateStatus = void 0;
4
+ /**
5
+ * Report template status enumeration
6
+ * Defines the lifecycle states of a report template
7
+ */
8
+ var ReportTemplateStatus;
9
+ (function (ReportTemplateStatus) {
10
+ /**
11
+ * Draft - Template is being edited
12
+ */
13
+ ReportTemplateStatus["DRAFT"] = "DRAFT";
14
+ /**
15
+ * Active - Template is available for use
16
+ */
17
+ ReportTemplateStatus["ACTIVE"] = "ACTIVE";
18
+ /**
19
+ * Deprecated - Template is no longer recommended but still accessible
20
+ */
21
+ ReportTemplateStatus["DEPRECATED"] = "DEPRECATED";
22
+ /**
23
+ * Archived - Template is soft deleted
24
+ */
25
+ ReportTemplateStatus["ARCHIVED"] = "ARCHIVED";
26
+ })(ReportTemplateStatus || (exports.ReportTemplateStatus = ReportTemplateStatus = {}));
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReportTemplateId = 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 ReportTemplateId extends AggregateId_1.AggregateId {
8
+ constructor(value, skipDomainValidation) {
9
+ super(value, skipDomainValidation, ReportTemplateId.PROPERTY_NAME);
10
+ }
11
+ static create(value) {
12
+ AggregateId_1.AggregateId.guardAgainstEmptyValue(value, ReportTemplateId.PROPERTY_NAME);
13
+ AggregateId_1.AggregateId.guardAgainstInvalidType(value, ReportTemplateId.PROPERTY_NAME);
14
+ AggregateId_1.AggregateId.guardAgainstInvalidId(value, ReportTemplateId.PROPERTY_NAME);
15
+ // Validate that the prefix is valid for ReportTemplate
16
+ ReportTemplateId.guardAgainstInvalidPrefix(value);
17
+ return new ReportTemplateId(value, false);
18
+ }
19
+ /**
20
+ * Validates that the UUID has a valid ReportTemplate prefix
21
+ */
22
+ static guardAgainstInvalidPrefix(value) {
23
+ try {
24
+ const tempInstance = new ReportTemplateId(value, true);
25
+ const prefix = tempInstance.extractPrefix();
26
+ if (ReportTemplateId.VALID_PREFIXES.includes(prefix) === false) {
27
+ throw InvalidAggregatePrefixError_1.InvalidAggregatePrefixError.create(value, 'ReportTemplate', prefix, ReportTemplateId.VALID_PREFIXES, ReportTemplateId.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, 'ReportTemplate', 'UNKNOWN', ReportTemplateId.VALID_PREFIXES, ReportTemplateId.PROPERTY_NAME);
36
+ }
37
+ throw error;
38
+ }
39
+ }
40
+ static fromPrimitives(primitive) {
41
+ const value = primitive;
42
+ return new ReportTemplateId(value, true);
43
+ }
44
+ toPrimitives() {
45
+ return this.value;
46
+ }
47
+ }
48
+ exports.ReportTemplateId = ReportTemplateId;
49
+ ReportTemplateId.PROPERTY_NAME = 'id';
50
+ ReportTemplateId.VALID_PREFIXES = [
51
+ SemanticUuidPrefix_1.SemanticUuidPrefix.RPT_TEMPLATE,
52
+ ];
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BlockNature = void 0;
4
+ /**
5
+ * Block nature enumeration
6
+ * Defines how each block in a report template should be filled
7
+ */
8
+ var BlockNature;
9
+ (function (BlockNature) {
10
+ /**
11
+ * Fixed content - Static text defined at template level
12
+ * Can be parametrized by country or standard
13
+ */
14
+ BlockNature["FIXED"] = "FIXED";
15
+ /**
16
+ * Curated bank - Content selected from pre-approved options
17
+ * Host provides options, client selects or adapts
18
+ */
19
+ BlockNature["CURATED_BANK"] = "CURATED_BANK";
20
+ /**
21
+ * Client input - Direct input from the client
22
+ * Collected via questionnaire with validation limits
23
+ */
24
+ BlockNature["CLIENT_INPUT"] = "CLIENT_INPUT";
25
+ /**
26
+ * Data bound - Automatic binding to snapshot data
27
+ * References specific data points (aggregations, factors, etc.)
28
+ */
29
+ BlockNature["DATA_BOUND"] = "DATA_BOUND";
30
+ })(BlockNature || (exports.BlockNature = BlockNature = {}));
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DataBindingSource = void 0;
4
+ /**
5
+ * Data binding source enumeration
6
+ * Defines all possible data sources for DATA_BOUND blocks
7
+ * This is a closed catalog to ensure determinism
8
+ */
9
+ var DataBindingSource;
10
+ (function (DataBindingSource) {
11
+ // Client Profile
12
+ DataBindingSource["CLIENT_PROFILE_NAME"] = "client.profile.name";
13
+ DataBindingSource["CLIENT_PROFILE_LEGAL_NAME"] = "client.profile.legalBusinessName";
14
+ DataBindingSource["CLIENT_PROFILE_TAX_ID"] = "client.profile.taxId";
15
+ DataBindingSource["CLIENT_PROFILE_COUNTRY"] = "client.profile.country";
16
+ DataBindingSource["CLIENT_PROFILE_ADDRESS"] = "client.profile.address";
17
+ DataBindingSource["CLIENT_PROFILE_CITY"] = "client.profile.city";
18
+ DataBindingSource["CLIENT_PROFILE_POSTAL_CODE"] = "client.profile.postalCode";
19
+ DataBindingSource["CLIENT_PROFILE_WEBSITE"] = "client.profile.website";
20
+ DataBindingSource["CLIENT_PROFILE_INDUSTRY"] = "client.profile.industry";
21
+ // Period
22
+ DataBindingSource["PERIOD_START_DATE"] = "period.startDate";
23
+ DataBindingSource["PERIOD_END_DATE"] = "period.endDate";
24
+ DataBindingSource["PERIOD_DURATION_MONTHS"] = "period.durationMonths";
25
+ DataBindingSource["PERIOD_YEAR"] = "period.year";
26
+ // Aggregations - Total
27
+ DataBindingSource["AGGREGATION_TOTAL"] = "aggregation.total";
28
+ DataBindingSource["AGGREGATION_TOTAL_TCO2E"] = "aggregation.totalTCO2e";
29
+ // Aggregations - By Scope
30
+ DataBindingSource["AGGREGATION_SCOPE_1"] = "aggregation.scope1";
31
+ DataBindingSource["AGGREGATION_SCOPE_2"] = "aggregation.scope2";
32
+ DataBindingSource["AGGREGATION_SCOPE_3"] = "aggregation.scope3";
33
+ DataBindingSource["AGGREGATION_BY_SCOPE"] = "aggregation.byScope";
34
+ // Aggregations - By Category
35
+ DataBindingSource["AGGREGATION_BY_CATEGORY"] = "aggregation.byCategory";
36
+ DataBindingSource["AGGREGATION_CATEGORY_ENERGY"] = "aggregation.category.energy";
37
+ DataBindingSource["AGGREGATION_CATEGORY_TRANSPORT"] = "aggregation.category.transport";
38
+ DataBindingSource["AGGREGATION_CATEGORY_WASTE"] = "aggregation.category.waste";
39
+ // Aggregations - By Gas
40
+ DataBindingSource["AGGREGATION_BY_GAS"] = "aggregation.byGas";
41
+ DataBindingSource["AGGREGATION_GAS_CO2"] = "aggregation.gas.co2";
42
+ DataBindingSource["AGGREGATION_GAS_CH4"] = "aggregation.gas.ch4";
43
+ DataBindingSource["AGGREGATION_GAS_N2O"] = "aggregation.gas.n2o";
44
+ // Aggregations - By Segment
45
+ DataBindingSource["AGGREGATION_BY_SEGMENT"] = "aggregation.bySegment";
46
+ // Aggregations - Biogenic
47
+ DataBindingSource["AGGREGATION_BIOGENIC"] = "aggregation.biogenic";
48
+ DataBindingSource["AGGREGATION_BIOGENIC_CO2"] = "aggregation.biogenicCO2";
49
+ // Emission Factors
50
+ DataBindingSource["EMISSION_FACTOR_VALUE"] = "emissionFactor.value";
51
+ DataBindingSource["EMISSION_FACTOR_UNIT"] = "emissionFactor.unit";
52
+ DataBindingSource["EMISSION_FACTOR_INFORMATION_SOURCE"] = "emissionFactor.informationSource";
53
+ DataBindingSource["EMISSION_FACTOR_CODE"] = "emissionFactor.code";
54
+ DataBindingSource["EMISSION_FACTOR_NAME"] = "emissionFactor.name";
55
+ DataBindingSource["EMISSION_FACTOR_IPCC_CODE"] = "emissionFactor.ipccCode";
56
+ DataBindingSource["EMISSION_FACTOR_IPCC_SUBCATEGORY"] = "emissionFactor.ipccSubcategory";
57
+ DataBindingSource["EMISSION_FACTOR_METHODOLOGICAL_TIER"] = "emissionFactor.methodologicalTier";
58
+ // Global Warming Potential (GWP)
59
+ DataBindingSource["GWP_PROTOCOL_VERSION"] = "gwp.protocolVersion";
60
+ DataBindingSource["GWP_POTENTIAL"] = "gwp.potential";
61
+ DataBindingSource["GWP_INFORMATION_SOURCE"] = "gwp.informationSource";
62
+ DataBindingSource["GWP_AR_VERSION"] = "gwp.arVersion";
63
+ // Calculation Formulas
64
+ DataBindingSource["FORMULA_EXPRESSION"] = "formula.expression";
65
+ DataBindingSource["FORMULA_INFORMATION_SOURCE"] = "formula.informationSource";
66
+ DataBindingSource["FORMULA_METHODOLOGICAL_TIER"] = "formula.methodologicalTier";
67
+ DataBindingSource["FORMULA_EMISSION_SOURCE"] = "formula.emissionSource";
68
+ DataBindingSource["FORMULA_APPLICABLE_GASES"] = "formula.applicableGases";
69
+ // Charts and Visualizations
70
+ DataBindingSource["CHART_BY_SCOPE"] = "chart.byScope";
71
+ DataBindingSource["CHART_BY_SUBCATEGORY"] = "chart.bySubcategory";
72
+ DataBindingSource["CHART_BY_SEGMENT"] = "chart.bySegment";
73
+ DataBindingSource["CHART_BY_GAS"] = "chart.byGas";
74
+ DataBindingSource["CHART_TREND_ANALYSIS"] = "chart.trendAnalysis";
75
+ // Facilities/Locations
76
+ DataBindingSource["FACILITIES_COUNT"] = "facilities.count";
77
+ DataBindingSource["FACILITIES_LIST"] = "facilities.list";
78
+ DataBindingSource["FACILITIES_BY_COUNTRY"] = "facilities.byCountry";
79
+ // Organizational Boundaries
80
+ DataBindingSource["ORGANIZATIONAL_APPROACH"] = "organizational.approach";
81
+ DataBindingSource["ORGANIZATIONAL_EQUITY_SHARE"] = "organizational.equityShare";
82
+ DataBindingSource["ORGANIZATIONAL_CONTROL_TYPE"] = "organizational.controlType";
83
+ // Standards and Compliance
84
+ DataBindingSource["REPORTING_STANDARD"] = "standard.name";
85
+ DataBindingSource["STANDARD_VERSION"] = "standard.version";
86
+ DataBindingSource["STANDARD_REQUIREMENTS"] = "standard.requirements";
87
+ // Metadata
88
+ DataBindingSource["REPORT_GENERATION_DATE"] = "metadata.generationDate";
89
+ DataBindingSource["REPORT_VERSION"] = "metadata.version";
90
+ DataBindingSource["REPORT_TEMPLATE_VERSION"] = "metadata.templateVersion";
91
+ })(DataBindingSource || (exports.DataBindingSource = DataBindingSource = {}));
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReportStatus = void 0;
4
+ /**
5
+ * Report status enumeration
6
+ * Defines the lifecycle states of a report instance
7
+ */
8
+ var ReportStatus;
9
+ (function (ReportStatus) {
10
+ /**
11
+ * Draft - Initial state, content being prepared
12
+ */
13
+ ReportStatus["DRAFT"] = "DRAFT";
14
+ /**
15
+ * Generating - AI is generating content
16
+ */
17
+ ReportStatus["GENERATING"] = "GENERATING";
18
+ /**
19
+ * Pending internal approval - Awaiting internal review
20
+ */
21
+ ReportStatus["PENDING_INTERNAL"] = "PENDING_INTERNAL";
22
+ /**
23
+ * Pending client approval - Awaiting client review
24
+ */
25
+ ReportStatus["PENDING_CLIENT"] = "PENDING_CLIENT";
26
+ /**
27
+ * Approved - All approvals received
28
+ */
29
+ ReportStatus["APPROVED"] = "APPROVED";
30
+ /**
31
+ * Published - Report is finalized and available
32
+ */
33
+ ReportStatus["PUBLISHED"] = "PUBLISHED";
34
+ /**
35
+ * Rejected - Report was rejected and needs revision
36
+ */
37
+ ReportStatus["REJECTED"] = "REJECTED";
38
+ /**
39
+ * Archived - Report is archived (soft delete)
40
+ */
41
+ ReportStatus["ARCHIVED"] = "ARCHIVED";
42
+ })(ReportStatus || (exports.ReportStatus = ReportStatus = {}));
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReportType = void 0;
4
+ /**
5
+ * Report type enumeration
6
+ * Defines the different types of reports that can be generated
7
+ */
8
+ var ReportType;
9
+ (function (ReportType) {
10
+ /**
11
+ * Auditable report - Formal report for external audits
12
+ * Requires strict compliance and double approval
13
+ */
14
+ ReportType["AUDITABLE"] = "AUDITABLE";
15
+ /**
16
+ * Technical report - Detailed technical analysis
17
+ * Includes methodologies and calculation details
18
+ */
19
+ ReportType["TECHNICAL"] = "TECHNICAL";
20
+ /**
21
+ * Executive report - High-level summary for management
22
+ * Focus on key insights and recommendations
23
+ */
24
+ ReportType["EXECUTIVE"] = "EXECUTIVE";
25
+ /**
26
+ * Custom report - User-defined structure
27
+ * Flexible format based on client needs
28
+ */
29
+ ReportType["CUSTOM"] = "CUSTOM";
30
+ })(ReportType || (exports.ReportType = ReportType = {}));
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EmptyReportSectionBlocksError = void 0;
4
+ const RootError_1 = require("../../../../shared/domain/exceptions/RootError");
5
+ class EmptyReportSectionBlocksError extends RootError_1.RootError {
6
+ constructor(sectionId) {
7
+ const message = `Report section '${sectionId}' must have at least one block.`;
8
+ super(message);
9
+ this.name = 'EmptyReportSectionBlocksError';
10
+ }
11
+ static create(sectionId) {
12
+ return new EmptyReportSectionBlocksError(sectionId);
13
+ }
14
+ logError() {
15
+ return `${this.name}: ${this.message}`;
16
+ }
17
+ }
18
+ exports.EmptyReportSectionBlocksError = EmptyReportSectionBlocksError;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InvalidReportInstanceIdError = void 0;
4
+ const RootError_1 = require("../../../../shared/domain/exceptions/RootError");
5
+ class InvalidReportInstanceIdError extends RootError_1.RootError {
6
+ constructor(receivedValue) {
7
+ const message = `Invalid report instance ID '${receivedValue}': must start with 'RPT-INS-' and be 30 characters long.`;
8
+ super(message);
9
+ this.name = 'InvalidReportInstanceIdError';
10
+ }
11
+ static create(receivedValue) {
12
+ return new InvalidReportInstanceIdError(receivedValue);
13
+ }
14
+ logError() {
15
+ return `${this.name}: ${this.message}`;
16
+ }
17
+ }
18
+ exports.InvalidReportInstanceIdError = InvalidReportInstanceIdError;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InvalidReportSectionIdError = void 0;
4
+ const RootError_1 = require("../../../../shared/domain/exceptions/RootError");
5
+ class InvalidReportSectionIdError extends RootError_1.RootError {
6
+ constructor(receivedValue) {
7
+ const message = `Invalid report section ID '${receivedValue}': cannot be empty.`;
8
+ super(message);
9
+ this.name = 'InvalidReportSectionIdError';
10
+ }
11
+ static create(receivedValue) {
12
+ return new InvalidReportSectionIdError(receivedValue);
13
+ }
14
+ logError() {
15
+ return `${this.name}: ${this.message}`;
16
+ }
17
+ }
18
+ exports.InvalidReportSectionIdError = InvalidReportSectionIdError;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InvalidReportSectionOrderError = void 0;
4
+ const RootError_1 = require("../../../../shared/domain/exceptions/RootError");
5
+ class InvalidReportSectionOrderError extends RootError_1.RootError {
6
+ constructor(receivedValue) {
7
+ const message = `Invalid report section order '${receivedValue}': must be non-negative.`;
8
+ super(message);
9
+ this.name = 'InvalidReportSectionOrderError';
10
+ }
11
+ static create(receivedValue) {
12
+ return new InvalidReportSectionOrderError(receivedValue);
13
+ }
14
+ logError() {
15
+ return `${this.name}: ${this.message}`;
16
+ }
17
+ }
18
+ exports.InvalidReportSectionOrderError = InvalidReportSectionOrderError;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InvalidReportSectionTitleError = void 0;
4
+ const RootError_1 = require("../../../../shared/domain/exceptions/RootError");
5
+ class InvalidReportSectionTitleError extends RootError_1.RootError {
6
+ constructor(receivedValue) {
7
+ const message = `Invalid report section title '${receivedValue}': cannot be empty.`;
8
+ super(message);
9
+ this.name = 'InvalidReportSectionTitleError';
10
+ }
11
+ static create(receivedValue) {
12
+ return new InvalidReportSectionTitleError(receivedValue);
13
+ }
14
+ logError() {
15
+ return `${this.name}: ${this.message}`;
16
+ }
17
+ }
18
+ exports.InvalidReportSectionTitleError = InvalidReportSectionTitleError;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InvalidReportTemplateIdError = void 0;
4
+ const RootError_1 = require("../../../../shared/domain/exceptions/RootError");
5
+ class InvalidReportTemplateIdError extends RootError_1.RootError {
6
+ constructor(receivedValue) {
7
+ const message = `Invalid report template ID '${receivedValue}': must start with 'RPT-TPL-' and be 30 characters long.`;
8
+ super(message);
9
+ this.name = 'InvalidReportTemplateIdError';
10
+ }
11
+ static create(receivedValue) {
12
+ return new InvalidReportTemplateIdError(receivedValue);
13
+ }
14
+ logError() {
15
+ return `${this.name}: ${this.message}`;
16
+ }
17
+ }
18
+ exports.InvalidReportTemplateIdError = InvalidReportTemplateIdError;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReportSection = void 0;
4
+ const ValueObject_1 = require("../../../../shared/domain/value-objects/ValueObject");
5
+ const InvalidReportSectionIdError_1 = require("../exceptions/InvalidReportSectionIdError");
6
+ const InvalidReportSectionTitleError_1 = require("../exceptions/InvalidReportSectionTitleError");
7
+ const InvalidReportSectionOrderError_1 = require("../exceptions/InvalidReportSectionOrderError");
8
+ const EmptyReportSectionBlocksError_1 = require("../exceptions/EmptyReportSectionBlocksError");
9
+ class ReportSection extends ValueObject_1.ValueObject {
10
+ constructor(value, skipDomainValidation) {
11
+ super(value, skipDomainValidation, ReportSection.PROPERTY_NAME, ReportSection.EXPECTED_TYPE);
12
+ if (!skipDomainValidation) {
13
+ this.validateReportSection(value);
14
+ }
15
+ }
16
+ static create(value) {
17
+ return new ReportSection(value, false);
18
+ }
19
+ static fromPrimitives(primitives) {
20
+ return new ReportSection(primitives, true);
21
+ }
22
+ validateReportSection(value) {
23
+ if (!value.id || value.id.trim() === '') {
24
+ throw InvalidReportSectionIdError_1.InvalidReportSectionIdError.create(value.id);
25
+ }
26
+ if (!value.title || value.title.trim() === '') {
27
+ throw InvalidReportSectionTitleError_1.InvalidReportSectionTitleError.create(value.title);
28
+ }
29
+ if (value.order < 0) {
30
+ throw InvalidReportSectionOrderError_1.InvalidReportSectionOrderError.create(value.order);
31
+ }
32
+ if (!Array.isArray(value.blocks) || value.blocks.length === 0) {
33
+ throw EmptyReportSectionBlocksError_1.EmptyReportSectionBlocksError.create(value.id);
34
+ }
35
+ }
36
+ getId() {
37
+ return this.value.id;
38
+ }
39
+ getTitle() {
40
+ return this.value.title;
41
+ }
42
+ getOrder() {
43
+ return this.value.order;
44
+ }
45
+ getBlocks() {
46
+ return this.value.blocks;
47
+ }
48
+ isRequired() {
49
+ return this.value.isRequired;
50
+ }
51
+ isVisible() {
52
+ return this.value.isVisible;
53
+ }
54
+ toPrimitives() {
55
+ return {
56
+ id: this.value.id,
57
+ title: this.value.title,
58
+ order: this.value.order,
59
+ blocks: [...this.value.blocks],
60
+ isRequired: this.value.isRequired,
61
+ isVisible: this.value.isVisible,
62
+ };
63
+ }
64
+ }
65
+ exports.ReportSection = ReportSection;
66
+ ReportSection.PROPERTY_NAME = 'reportSection';
67
+ ReportSection.EXPECTED_TYPE = 'ReportSectionPrimitives';