business-as-code 0.2.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/.turbo/turbo-build.log +5 -0
  2. package/CHANGELOG.md +17 -0
  3. package/IMPLEMENTATION.md +226 -0
  4. package/README.md +1133 -193
  5. package/dist/business.d.ts +62 -0
  6. package/dist/business.d.ts.map +1 -0
  7. package/dist/business.js +109 -0
  8. package/dist/business.js.map +1 -0
  9. package/dist/dollar.d.ts +60 -0
  10. package/dist/dollar.d.ts.map +1 -0
  11. package/dist/dollar.js +107 -0
  12. package/dist/dollar.js.map +1 -0
  13. package/dist/entities/assets.d.ts +21 -0
  14. package/dist/entities/assets.d.ts.map +1 -0
  15. package/dist/entities/assets.js +323 -0
  16. package/dist/entities/assets.js.map +1 -0
  17. package/dist/entities/business.d.ts +36 -0
  18. package/dist/entities/business.d.ts.map +1 -0
  19. package/dist/entities/business.js +370 -0
  20. package/dist/entities/business.js.map +1 -0
  21. package/dist/entities/communication.d.ts +21 -0
  22. package/dist/entities/communication.d.ts.map +1 -0
  23. package/dist/entities/communication.js +255 -0
  24. package/dist/entities/communication.js.map +1 -0
  25. package/dist/entities/customers.d.ts +58 -0
  26. package/dist/entities/customers.d.ts.map +1 -0
  27. package/dist/entities/customers.js +989 -0
  28. package/dist/entities/customers.js.map +1 -0
  29. package/dist/entities/financials.d.ts +59 -0
  30. package/dist/entities/financials.d.ts.map +1 -0
  31. package/dist/entities/financials.js +932 -0
  32. package/dist/entities/financials.js.map +1 -0
  33. package/dist/entities/goals.d.ts +58 -0
  34. package/dist/entities/goals.d.ts.map +1 -0
  35. package/dist/entities/goals.js +800 -0
  36. package/dist/entities/goals.js.map +1 -0
  37. package/dist/entities/index.d.ts +299 -0
  38. package/dist/entities/index.d.ts.map +1 -0
  39. package/dist/entities/index.js +198 -0
  40. package/dist/entities/index.js.map +1 -0
  41. package/dist/entities/legal.d.ts +21 -0
  42. package/dist/entities/legal.d.ts.map +1 -0
  43. package/dist/entities/legal.js +301 -0
  44. package/dist/entities/legal.js.map +1 -0
  45. package/dist/entities/market.d.ts +21 -0
  46. package/dist/entities/market.d.ts.map +1 -0
  47. package/dist/entities/market.js +301 -0
  48. package/dist/entities/market.js.map +1 -0
  49. package/dist/entities/marketing.d.ts +67 -0
  50. package/dist/entities/marketing.d.ts.map +1 -0
  51. package/dist/entities/marketing.js +1157 -0
  52. package/dist/entities/marketing.js.map +1 -0
  53. package/dist/entities/offerings.d.ts +51 -0
  54. package/dist/entities/offerings.d.ts.map +1 -0
  55. package/dist/entities/offerings.js +727 -0
  56. package/dist/entities/offerings.js.map +1 -0
  57. package/dist/entities/operations.d.ts +58 -0
  58. package/dist/entities/operations.d.ts.map +1 -0
  59. package/dist/entities/operations.js +787 -0
  60. package/dist/entities/operations.js.map +1 -0
  61. package/dist/entities/organization.d.ts +57 -0
  62. package/dist/entities/organization.d.ts.map +1 -0
  63. package/dist/entities/organization.js +807 -0
  64. package/dist/entities/organization.js.map +1 -0
  65. package/dist/entities/partnerships.d.ts +21 -0
  66. package/dist/entities/partnerships.d.ts.map +1 -0
  67. package/dist/entities/partnerships.js +300 -0
  68. package/dist/entities/partnerships.js.map +1 -0
  69. package/dist/entities/planning.d.ts +87 -0
  70. package/dist/entities/planning.d.ts.map +1 -0
  71. package/dist/entities/planning.js +271 -0
  72. package/dist/entities/planning.js.map +1 -0
  73. package/dist/entities/projects.d.ts +25 -0
  74. package/dist/entities/projects.d.ts.map +1 -0
  75. package/dist/entities/projects.js +349 -0
  76. package/dist/entities/projects.js.map +1 -0
  77. package/dist/entities/risk.d.ts +21 -0
  78. package/dist/entities/risk.d.ts.map +1 -0
  79. package/dist/entities/risk.js +293 -0
  80. package/dist/entities/risk.js.map +1 -0
  81. package/dist/entities/sales.d.ts +72 -0
  82. package/dist/entities/sales.d.ts.map +1 -0
  83. package/dist/entities/sales.js +1248 -0
  84. package/dist/entities/sales.js.map +1 -0
  85. package/dist/financials.d.ts +130 -0
  86. package/dist/financials.d.ts.map +1 -0
  87. package/dist/financials.js +297 -0
  88. package/dist/financials.js.map +1 -0
  89. package/dist/goals.d.ts +87 -0
  90. package/dist/goals.d.ts.map +1 -0
  91. package/dist/goals.js +215 -0
  92. package/dist/goals.js.map +1 -0
  93. package/dist/index.d.ts +97 -4
  94. package/dist/index.d.ts.map +1 -0
  95. package/dist/index.js +131 -1079
  96. package/dist/index.js.map +1 -1
  97. package/dist/kpis.d.ts +118 -0
  98. package/dist/kpis.d.ts.map +1 -0
  99. package/dist/kpis.js +232 -0
  100. package/dist/kpis.js.map +1 -0
  101. package/dist/metrics.d.ts +448 -0
  102. package/dist/metrics.d.ts.map +1 -0
  103. package/dist/metrics.js +325 -0
  104. package/dist/metrics.js.map +1 -0
  105. package/dist/okrs.d.ts +123 -0
  106. package/dist/okrs.d.ts.map +1 -0
  107. package/dist/okrs.js +269 -0
  108. package/dist/okrs.js.map +1 -0
  109. package/dist/organization.d.ts +585 -0
  110. package/dist/organization.d.ts.map +1 -0
  111. package/dist/organization.js +173 -0
  112. package/dist/organization.js.map +1 -0
  113. package/dist/process.d.ts +112 -0
  114. package/dist/process.d.ts.map +1 -0
  115. package/dist/process.js +241 -0
  116. package/dist/process.js.map +1 -0
  117. package/dist/product.d.ts +85 -0
  118. package/dist/product.d.ts.map +1 -0
  119. package/dist/product.js +145 -0
  120. package/dist/product.js.map +1 -0
  121. package/dist/queries.d.ts +304 -0
  122. package/dist/queries.d.ts.map +1 -0
  123. package/dist/queries.js +415 -0
  124. package/dist/queries.js.map +1 -0
  125. package/dist/roles.d.ts +340 -0
  126. package/dist/roles.d.ts.map +1 -0
  127. package/dist/roles.js +255 -0
  128. package/dist/roles.js.map +1 -0
  129. package/dist/service.d.ts +61 -0
  130. package/dist/service.d.ts.map +1 -0
  131. package/dist/service.js +140 -0
  132. package/dist/service.js.map +1 -0
  133. package/dist/types.d.ts +459 -0
  134. package/dist/types.d.ts.map +1 -0
  135. package/dist/types.js +5 -0
  136. package/dist/types.js.map +1 -0
  137. package/dist/vision.d.ts +38 -0
  138. package/dist/vision.d.ts.map +1 -0
  139. package/dist/vision.js +68 -0
  140. package/dist/vision.js.map +1 -0
  141. package/dist/workflow.d.ts +115 -0
  142. package/dist/workflow.d.ts.map +1 -0
  143. package/dist/workflow.js +247 -0
  144. package/dist/workflow.js.map +1 -0
  145. package/examples/basic-usage.ts +307 -0
  146. package/package.json +19 -60
  147. package/src/business.ts +121 -0
  148. package/src/dollar.ts +132 -0
  149. package/src/entities/assets.ts +332 -0
  150. package/src/entities/business.ts +406 -0
  151. package/src/entities/communication.ts +264 -0
  152. package/src/entities/customers.ts +1072 -0
  153. package/src/entities/financials.ts +1011 -0
  154. package/src/entities/goals.ts +871 -0
  155. package/src/entities/index.ts +383 -0
  156. package/src/entities/legal.ts +310 -0
  157. package/src/entities/market.ts +310 -0
  158. package/src/entities/marketing.ts +1249 -0
  159. package/src/entities/offerings.ts +789 -0
  160. package/src/entities/operations.ts +861 -0
  161. package/src/entities/organization.ts +876 -0
  162. package/src/entities/partnerships.ts +309 -0
  163. package/src/entities/planning.ts +307 -0
  164. package/src/entities/projects.ts +360 -0
  165. package/src/entities/risk.ts +302 -0
  166. package/src/entities/sales.ts +1352 -0
  167. package/src/financials.ts +352 -0
  168. package/src/goals.ts +250 -0
  169. package/src/index.test.ts +336 -0
  170. package/src/index.ts +530 -0
  171. package/src/kpis.ts +275 -0
  172. package/src/metrics.ts +825 -0
  173. package/src/okrs.ts +325 -0
  174. package/src/organization.ts +909 -0
  175. package/src/process.ts +272 -0
  176. package/src/product.ts +178 -0
  177. package/src/queries.ts +767 -0
  178. package/src/roles.ts +686 -0
  179. package/src/service.ts +164 -0
  180. package/src/types.ts +493 -0
  181. package/src/vision.ts +88 -0
  182. package/src/workflow.ts +280 -0
  183. package/tsconfig.json +9 -0
  184. package/dist/loaders/index.d.ts +0 -174
  185. package/dist/loaders/index.js +0 -366
  186. package/dist/loaders/index.js.map +0 -1
  187. package/dist/schema/index.d.ts +0 -146
  188. package/dist/schema/index.js +0 -716
  189. package/dist/schema/index.js.map +0 -1
  190. package/dist/types-CJ9eGS_C.d.ts +0 -86
@@ -0,0 +1,302 @@
1
+ import type { Noun } from 'ai-database'
2
+
3
+ /**
4
+ * Risk Management Entities
5
+ * Risk, Mitigation, Incident, Control, Assessment, Issue
6
+ */
7
+
8
+ export const Risk: Noun = {
9
+ singular: 'risk',
10
+ plural: 'risks',
11
+ description: 'A potential risk that could impact the organization',
12
+ properties: {
13
+ name: { type: 'string', description: 'Risk name' },
14
+ description: { type: 'string', description: 'Risk description' },
15
+ type: { type: 'string', description: 'Type of risk', examples: ['strategic', 'operational', 'financial', 'compliance', 'reputational', 'security', 'technology', 'market', 'legal', 'environmental'] },
16
+ category: { type: 'string', description: 'Risk category', examples: ['cyber', 'data', 'vendor', 'regulatory', 'fraud', 'business-continuity', 'project', 'HR', 'supply-chain'] },
17
+ status: { type: 'string', description: 'Risk status', examples: ['identified', 'assessed', 'mitigating', 'accepted', 'transferred', 'avoided', 'closed', 'realized'] },
18
+ source: { type: 'string', description: 'Risk source', examples: ['internal', 'external', 'third-party', 'regulatory', 'market', 'technology'] },
19
+ likelihood: { type: 'string', description: 'Probability of occurrence', examples: ['rare', 'unlikely', 'possible', 'likely', 'almost-certain'] },
20
+ likelihoodScore: { type: 'number', description: 'Likelihood score (1-5)' },
21
+ impact: { type: 'string', description: 'Potential impact level', examples: ['negligible', 'minor', 'moderate', 'major', 'severe'] },
22
+ impactScore: { type: 'number', description: 'Impact score (1-5)' },
23
+ riskScore: { type: 'number', description: 'Overall risk score (likelihood x impact)' },
24
+ riskLevel: { type: 'string', description: 'Risk level', examples: ['low', 'medium', 'high', 'critical'] },
25
+ inherentRiskScore: { type: 'number', description: 'Inherent risk score (before controls)' },
26
+ residualRiskScore: { type: 'number', description: 'Residual risk score (after controls)' },
27
+ riskAppetite: { type: 'string', description: 'Risk appetite threshold', examples: ['averse', 'minimal', 'cautious', 'open', 'hungry'] },
28
+ treatment: { type: 'string', description: 'Risk treatment strategy', examples: ['accept', 'mitigate', 'transfer', 'avoid', 'escalate'] },
29
+ financialImpact: { type: 'number', description: 'Estimated financial impact' },
30
+ impactAreas: { type: 'string[]', description: 'Areas of impact', examples: ['revenue', 'reputation', 'operations', 'compliance', 'safety', 'legal'] },
31
+ affectedAssets: { type: 'string[]', description: 'Affected assets or systems' },
32
+ affectedProcesses: { type: 'string[]', description: 'Affected business processes' },
33
+ triggers: { type: 'string[]', description: 'Risk triggers or indicators' },
34
+ consequences: { type: 'string[]', description: 'Potential consequences' },
35
+ owner: { type: 'string', description: 'Risk owner' },
36
+ assignee: { type: 'string', description: 'Assigned risk manager' },
37
+ identifiedDate: { type: 'date', description: 'Date risk identified' },
38
+ assessmentDate: { type: 'date', description: 'Last assessment date' },
39
+ nextReviewDate: { type: 'date', description: 'Next review date' },
40
+ reviewFrequency: { type: 'string', description: 'Review frequency', examples: ['monthly', 'quarterly', 'semi-annual', 'annual'] },
41
+ dueDate: { type: 'date', description: 'Mitigation due date', optional: true },
42
+ closedDate: { type: 'date', description: 'Date risk closed', optional: true },
43
+ notes: { type: 'string', description: 'Internal notes', optional: true },
44
+ tags: { type: 'string[]', description: 'Risk tags' },
45
+ metadata: { type: 'object', description: 'Additional metadata', optional: true },
46
+ },
47
+ relationships: {
48
+ mitigations: { type: 'mitigation[]', description: 'Risk mitigations', backref: 'risk', required: false },
49
+ controls: { type: 'control[]', description: 'Risk controls', backref: 'risks' },
50
+ incidents: { type: 'incident[]', description: 'Related incidents', backref: 'risks' },
51
+ compliance: { type: 'compliance[]', description: 'Related compliance', backref: 'risks' },
52
+ parentRisk: { type: 'risk', description: 'Parent risk', backref: 'childRisks' },
53
+ childRisks: { type: 'risk[]', description: 'Child risks', backref: 'parentRisk' },
54
+ relatedRisks: { type: 'risk[]', description: 'Related risks', backref: 'relatedRisks' },
55
+ },
56
+ actions: ['create', 'update', 'assess', 'escalate', 'accept', 'mitigate', 'transfer', 'avoid', 'review', 'close', 'reopen', 'monitor'],
57
+ events: ['created', 'updated', 'assessed', 'escalated', 'accepted', 'mitigated', 'transferred', 'avoided', 'reviewed', 'closed', 'reopened', 'monitored'],
58
+ }
59
+
60
+ export const Mitigation: Noun = {
61
+ singular: 'mitigation',
62
+ plural: 'mitigations',
63
+ description: 'A mitigation action to reduce or eliminate a risk',
64
+ properties: {
65
+ name: { type: 'string', description: 'Mitigation name' },
66
+ description: { type: 'string', description: 'Mitigation description' },
67
+ type: { type: 'string', description: 'Type of mitigation', examples: ['preventive', 'detective', 'corrective', 'compensating', 'deterrent'] },
68
+ status: { type: 'string', description: 'Mitigation status', examples: ['planned', 'in-progress', 'implemented', 'verified', 'failed', 'deferred', 'cancelled'] },
69
+ priority: { type: 'string', description: 'Mitigation priority', examples: ['critical', 'high', 'medium', 'low'] },
70
+ strategy: { type: 'string', description: 'Mitigation strategy', examples: ['reduce-likelihood', 'reduce-impact', 'both', 'transfer', 'avoid'] },
71
+ actions: { type: 'string[]', description: 'Specific actions required' },
72
+ expectedReduction: { type: 'number', description: 'Expected risk reduction percentage' },
73
+ actualReduction: { type: 'number', description: 'Actual risk reduction achieved' },
74
+ cost: { type: 'number', description: 'Mitigation cost' },
75
+ estimatedEffort: { type: 'string', description: 'Estimated effort' },
76
+ owner: { type: 'string', description: 'Mitigation owner' },
77
+ assignee: { type: 'string', description: 'Assigned implementer' },
78
+ plannedStartDate: { type: 'date', description: 'Planned start date' },
79
+ plannedEndDate: { type: 'date', description: 'Planned end date' },
80
+ actualStartDate: { type: 'date', description: 'Actual start date', optional: true },
81
+ actualEndDate: { type: 'date', description: 'Actual end date', optional: true },
82
+ verificationDate: { type: 'date', description: 'Verification date', optional: true },
83
+ verificationMethod: { type: 'string', description: 'How effectiveness will be verified' },
84
+ effectiveness: { type: 'string', description: 'Effectiveness rating', examples: ['highly-effective', 'effective', 'partially-effective', 'ineffective'] },
85
+ resources: { type: 'string[]', description: 'Required resources' },
86
+ dependencies: { type: 'string[]', description: 'Dependencies' },
87
+ blockers: { type: 'string[]', description: 'Current blockers' },
88
+ progress: { type: 'number', description: 'Progress percentage' },
89
+ notes: { type: 'string', description: 'Internal notes', optional: true },
90
+ tags: { type: 'string[]', description: 'Mitigation tags' },
91
+ metadata: { type: 'object', description: 'Additional metadata', optional: true },
92
+ },
93
+ relationships: {
94
+ risk: { type: 'risk', description: 'Associated risk', backref: 'mitigations', required: true },
95
+ tasks: { type: 'task[]', description: 'Implementation tasks', backref: 'mitigation' },
96
+ controls: { type: 'control[]', description: 'Related controls', backref: 'mitigations' },
97
+ },
98
+ actions: ['create', 'update', 'plan', 'start', 'implement', 'verify', 'complete', 'fail', 'defer', 'cancel'],
99
+ events: ['created', 'updated', 'planned', 'started', 'implemented', 'verified', 'completed', 'failed', 'deferred', 'cancelled'],
100
+ }
101
+
102
+ export const Incident: Noun = {
103
+ singular: 'incident',
104
+ plural: 'incidents',
105
+ description: 'A security, operational, or business incident',
106
+ properties: {
107
+ name: { type: 'string', description: 'Incident name or title' },
108
+ description: { type: 'string', description: 'Incident description' },
109
+ type: { type: 'string', description: 'Type of incident', examples: ['security', 'data-breach', 'system-outage', 'operational', 'compliance', 'safety', 'fraud', 'natural-disaster', 'vendor'] },
110
+ category: { type: 'string', description: 'Incident category', examples: ['cyber-attack', 'data-loss', 'service-disruption', 'physical', 'human-error', 'third-party', 'regulatory'] },
111
+ status: { type: 'string', description: 'Incident status', examples: ['detected', 'confirmed', 'investigating', 'contained', 'eradicating', 'recovering', 'resolved', 'closed', 'post-mortem'] },
112
+ severity: { type: 'string', description: 'Incident severity', examples: ['critical', 'high', 'medium', 'low', 'informational'] },
113
+ priority: { type: 'string', description: 'Response priority', examples: ['P1', 'P2', 'P3', 'P4'] },
114
+ impact: { type: 'string', description: 'Impact assessment', examples: ['critical', 'significant', 'moderate', 'minor', 'none'] },
115
+ impactedUsers: { type: 'number', description: 'Number of impacted users' },
116
+ impactedSystems: { type: 'string[]', description: 'Impacted systems' },
117
+ impactedServices: { type: 'string[]', description: 'Impacted services' },
118
+ impactedRegions: { type: 'string[]', description: 'Impacted geographic regions' },
119
+ rootCause: { type: 'string', description: 'Root cause analysis', optional: true },
120
+ attackVector: { type: 'string', description: 'Attack vector (if security)', optional: true },
121
+ dataCompromised: { type: 'boolean', description: 'Data was compromised' },
122
+ dataTypes: { type: 'string[]', description: 'Types of data affected', optional: true },
123
+ recordsAffected: { type: 'number', description: 'Number of records affected', optional: true },
124
+ financialImpact: { type: 'number', description: 'Financial impact' },
125
+ reputationalImpact: { type: 'string', description: 'Reputational impact assessment', optional: true },
126
+ detectionMethod: { type: 'string', description: 'How incident was detected', examples: ['monitoring', 'alert', 'user-report', 'audit', 'third-party', 'automated'] },
127
+ detectedAt: { type: 'date', description: 'When incident was detected' },
128
+ reportedAt: { type: 'date', description: 'When incident was reported' },
129
+ confirmedAt: { type: 'date', description: 'When incident was confirmed' },
130
+ containedAt: { type: 'date', description: 'When incident was contained', optional: true },
131
+ resolvedAt: { type: 'date', description: 'When incident was resolved', optional: true },
132
+ closedAt: { type: 'date', description: 'When incident was closed', optional: true },
133
+ timeToDetect: { type: 'number', description: 'Time to detect (minutes)' },
134
+ timeToContain: { type: 'number', description: 'Time to contain (minutes)' },
135
+ timeToResolve: { type: 'number', description: 'Time to resolve (minutes)' },
136
+ reporter: { type: 'string', description: 'Person who reported' },
137
+ incidentCommander: { type: 'string', description: 'Incident commander' },
138
+ responseTeam: { type: 'string[]', description: 'Response team members' },
139
+ externalParties: { type: 'string[]', description: 'External parties involved' },
140
+ notificationRequired: { type: 'boolean', description: 'Regulatory notification required' },
141
+ notificationSent: { type: 'boolean', description: 'Notifications sent' },
142
+ notificationDate: { type: 'date', description: 'Notification date', optional: true },
143
+ lessonsLearned: { type: 'string[]', description: 'Lessons learned' },
144
+ postMortemUrl: { type: 'string', description: 'Post-mortem document URL', optional: true },
145
+ ticketId: { type: 'string', description: 'External ticket ID' },
146
+ notes: { type: 'string', description: 'Internal notes', optional: true },
147
+ tags: { type: 'string[]', description: 'Incident tags' },
148
+ metadata: { type: 'object', description: 'Additional metadata', optional: true },
149
+ },
150
+ relationships: {
151
+ risks: { type: 'risk[]', description: 'Related risks', backref: 'incidents' },
152
+ compliance: { type: 'compliance[]', description: 'Related compliance', backref: 'incidents' },
153
+ tasks: { type: 'task[]', description: 'Response tasks', backref: 'incident' },
154
+ relatedIncidents: { type: 'incident[]', description: 'Related incidents', backref: 'relatedIncidents' },
155
+ },
156
+ actions: ['create', 'update', 'detect', 'confirm', 'escalate', 'investigate', 'contain', 'eradicate', 'recover', 'resolve', 'close', 'reopen', 'notify', 'postMortem'],
157
+ events: ['created', 'updated', 'detected', 'confirmed', 'escalated', 'investigated', 'contained', 'eradicated', 'recovered', 'resolved', 'closed', 'reopened', 'notified', 'postMortemCompleted'],
158
+ }
159
+
160
+ export const Control: Noun = {
161
+ singular: 'control',
162
+ plural: 'controls',
163
+ description: 'A control measure to manage risk',
164
+ properties: {
165
+ name: { type: 'string', description: 'Control name' },
166
+ description: { type: 'string', description: 'Control description' },
167
+ type: { type: 'string', description: 'Type of control', examples: ['preventive', 'detective', 'corrective', 'compensating', 'deterrent', 'directive'] },
168
+ category: { type: 'string', description: 'Control category', examples: ['technical', 'administrative', 'physical', 'operational', 'managerial'] },
169
+ status: { type: 'string', description: 'Control status', examples: ['planned', 'implementing', 'operational', 'ineffective', 'deprecated'] },
170
+ controlId: { type: 'string', description: 'Control identifier (e.g., AC-1, ISO-A.5.1)' },
171
+ framework: { type: 'string', description: 'Control framework', examples: ['NIST', 'ISO27001', 'SOC2', 'CIS', 'COBIT', 'custom'] },
172
+ objective: { type: 'string', description: 'Control objective' },
173
+ implementation: { type: 'string', description: 'Implementation details' },
174
+ frequency: { type: 'string', description: 'Control frequency', examples: ['continuous', 'daily', 'weekly', 'monthly', 'quarterly', 'annual', 'on-demand'] },
175
+ automationLevel: { type: 'string', description: 'Automation level', examples: ['manual', 'semi-automated', 'automated'] },
176
+ effectiveness: { type: 'string', description: 'Effectiveness rating', examples: ['highly-effective', 'effective', 'partially-effective', 'ineffective', 'not-tested'] },
177
+ maturity: { type: 'string', description: 'Maturity level', examples: ['initial', 'developing', 'defined', 'managed', 'optimized'] },
178
+ testingMethod: { type: 'string', description: 'Testing method' },
179
+ lastTestDate: { type: 'date', description: 'Last test date' },
180
+ nextTestDate: { type: 'date', description: 'Next scheduled test' },
181
+ testResults: { type: 'string', description: 'Latest test results' },
182
+ evidenceUrl: { type: 'string', description: 'Evidence location' },
183
+ owner: { type: 'string', description: 'Control owner' },
184
+ operator: { type: 'string', description: 'Control operator' },
185
+ implementationDate: { type: 'date', description: 'Implementation date' },
186
+ reviewDate: { type: 'date', description: 'Last review date' },
187
+ cost: { type: 'number', description: 'Control cost' },
188
+ notes: { type: 'string', description: 'Internal notes', optional: true },
189
+ tags: { type: 'string[]', description: 'Control tags' },
190
+ metadata: { type: 'object', description: 'Additional metadata', optional: true },
191
+ },
192
+ relationships: {
193
+ risks: { type: 'risk[]', description: 'Controlled risks', backref: 'controls' },
194
+ mitigations: { type: 'mitigation[]', description: 'Related mitigations', backref: 'controls' },
195
+ compliance: { type: 'compliance[]', description: 'Related compliance', backref: 'controls' },
196
+ parentControl: { type: 'control', description: 'Parent control', backref: 'childControls' },
197
+ childControls: { type: 'control[]', description: 'Child controls', backref: 'parentControl' },
198
+ },
199
+ actions: ['create', 'update', 'implement', 'test', 'review', 'deprecate', 'remediate', 'evidence'],
200
+ events: ['created', 'updated', 'implemented', 'tested', 'reviewed', 'deprecated', 'remediated', 'evidenced'],
201
+ }
202
+
203
+ export const Assessment: Noun = {
204
+ singular: 'assessment',
205
+ plural: 'assessments',
206
+ description: 'A risk or compliance assessment',
207
+ properties: {
208
+ name: { type: 'string', description: 'Assessment name' },
209
+ type: { type: 'string', description: 'Type of assessment', examples: ['risk', 'security', 'compliance', 'vendor', 'impact', 'vulnerability', 'audit', 'privacy'] },
210
+ status: { type: 'string', description: 'Assessment status', examples: ['planned', 'in-progress', 'review', 'completed', 'cancelled'] },
211
+ scope: { type: 'string', description: 'Assessment scope' },
212
+ methodology: { type: 'string', description: 'Assessment methodology' },
213
+ framework: { type: 'string', description: 'Assessment framework', optional: true },
214
+ objectives: { type: 'string[]', description: 'Assessment objectives' },
215
+ criteria: { type: 'string[]', description: 'Assessment criteria' },
216
+ assessor: { type: 'string', description: 'Lead assessor' },
217
+ team: { type: 'string[]', description: 'Assessment team' },
218
+ sponsor: { type: 'string', description: 'Executive sponsor' },
219
+ scheduledStart: { type: 'date', description: 'Scheduled start date' },
220
+ scheduledEnd: { type: 'date', description: 'Scheduled end date' },
221
+ actualStart: { type: 'date', description: 'Actual start date', optional: true },
222
+ actualEnd: { type: 'date', description: 'Actual end date', optional: true },
223
+ findings: { type: 'number', description: 'Total findings' },
224
+ criticalFindings: { type: 'number', description: 'Critical findings' },
225
+ highFindings: { type: 'number', description: 'High findings' },
226
+ mediumFindings: { type: 'number', description: 'Medium findings' },
227
+ lowFindings: { type: 'number', description: 'Low findings' },
228
+ overallRating: { type: 'string', description: 'Overall rating', examples: ['satisfactory', 'needs-improvement', 'unsatisfactory'] },
229
+ riskScore: { type: 'number', description: 'Overall risk score' },
230
+ recommendations: { type: 'string[]', description: 'Recommendations' },
231
+ reportUrl: { type: 'string', description: 'Assessment report URL' },
232
+ evidenceUrl: { type: 'string', description: 'Evidence repository URL' },
233
+ remediationDeadline: { type: 'date', description: 'Remediation deadline', optional: true },
234
+ followUpDate: { type: 'date', description: 'Follow-up date', optional: true },
235
+ notes: { type: 'string', description: 'Internal notes', optional: true },
236
+ tags: { type: 'string[]', description: 'Assessment tags' },
237
+ metadata: { type: 'object', description: 'Additional metadata', optional: true },
238
+ },
239
+ relationships: {
240
+ risks: { type: 'risk[]', description: 'Identified risks', backref: 'assessments' },
241
+ controls: { type: 'control[]', description: 'Assessed controls', backref: 'assessments' },
242
+ compliance: { type: 'compliance', description: 'Related compliance', backref: 'assessments' },
243
+ vendor: { type: 'vendor', description: 'Assessed vendor', backref: 'assessments' },
244
+ tasks: { type: 'task[]', description: 'Follow-up tasks', backref: 'assessment' },
245
+ },
246
+ actions: ['create', 'update', 'schedule', 'start', 'conduct', 'review', 'complete', 'cancel', 'report', 'followUp'],
247
+ events: ['created', 'updated', 'scheduled', 'started', 'conducted', 'reviewed', 'completed', 'cancelled', 'reported', 'followedUp'],
248
+ }
249
+
250
+ export const Issue: Noun = {
251
+ singular: 'issue',
252
+ plural: 'issues',
253
+ description: 'A business or operational issue requiring resolution',
254
+ properties: {
255
+ name: { type: 'string', description: 'Issue name' },
256
+ description: { type: 'string', description: 'Issue description' },
257
+ type: { type: 'string', description: 'Type of issue', examples: ['operational', 'technical', 'process', 'compliance', 'vendor', 'customer', 'quality', 'resource'] },
258
+ status: { type: 'string', description: 'Issue status', examples: ['open', 'investigating', 'in-progress', 'blocked', 'resolved', 'closed', 'reopened'] },
259
+ severity: { type: 'string', description: 'Issue severity', examples: ['critical', 'high', 'medium', 'low'] },
260
+ priority: { type: 'string', description: 'Issue priority', examples: ['urgent', 'high', 'medium', 'low'] },
261
+ impact: { type: 'string', description: 'Business impact' },
262
+ rootCause: { type: 'string', description: 'Root cause', optional: true },
263
+ resolution: { type: 'string', description: 'Resolution details', optional: true },
264
+ workaround: { type: 'string', description: 'Temporary workaround', optional: true },
265
+ reporter: { type: 'string', description: 'Issue reporter' },
266
+ owner: { type: 'string', description: 'Issue owner' },
267
+ assignee: { type: 'string', description: 'Assigned resolver' },
268
+ reportedDate: { type: 'date', description: 'Date reported' },
269
+ dueDate: { type: 'date', description: 'Target resolution date' },
270
+ resolvedDate: { type: 'date', description: 'Actual resolution date', optional: true },
271
+ closedDate: { type: 'date', description: 'Date closed', optional: true },
272
+ escalated: { type: 'boolean', description: 'Has been escalated' },
273
+ escalatedTo: { type: 'string', description: 'Escalated to', optional: true },
274
+ escalatedDate: { type: 'date', description: 'Escalation date', optional: true },
275
+ category: { type: 'string', description: 'Issue category' },
276
+ source: { type: 'string', description: 'Issue source', examples: ['internal', 'customer', 'audit', 'incident', 'assessment'] },
277
+ affectedAreas: { type: 'string[]', description: 'Affected areas' },
278
+ notes: { type: 'string', description: 'Internal notes', optional: true },
279
+ tags: { type: 'string[]', description: 'Issue tags' },
280
+ metadata: { type: 'object', description: 'Additional metadata', optional: true },
281
+ },
282
+ relationships: {
283
+ risk: { type: 'risk', description: 'Related risk', backref: 'issues' },
284
+ incident: { type: 'incident', description: 'Related incident', backref: 'issues' },
285
+ tasks: { type: 'task[]', description: 'Resolution tasks', backref: 'issue' },
286
+ relatedIssues: { type: 'issue[]', description: 'Related issues', backref: 'relatedIssues' },
287
+ },
288
+ actions: ['create', 'update', 'investigate', 'escalate', 'assign', 'resolve', 'close', 'reopen', 'workaround'],
289
+ events: ['created', 'updated', 'investigated', 'escalated', 'assigned', 'resolved', 'closed', 'reopened', 'workaroundApplied'],
290
+ }
291
+
292
+ // Export all risk entities
293
+ export const RiskEntities = {
294
+ Risk,
295
+ Mitigation,
296
+ Incident,
297
+ Control,
298
+ Assessment,
299
+ Issue,
300
+ }
301
+
302
+ export default RiskEntities