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