monora-ai 2.0.0 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +441 -150
- package/dist/aims_governance.d.ts +238 -0
- package/dist/aims_governance.d.ts.map +1 -0
- package/dist/aims_governance.js +922 -0
- package/dist/alerts.d.ts +16 -0
- package/dist/alerts.d.ts.map +1 -1
- package/dist/alerts.js +16 -0
- package/dist/api.d.ts +6 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +6 -0
- package/dist/assessment.d.ts +269 -0
- package/dist/assessment.d.ts.map +1 -0
- package/dist/assessment.js +1232 -0
- package/dist/attestation.js +23 -1
- package/dist/attribution.d.ts +349 -0
- package/dist/attribution.d.ts.map +1 -0
- package/dist/attribution.js +987 -0
- package/dist/autodetect.d.ts +69 -1
- package/dist/autodetect.d.ts.map +1 -1
- package/dist/autodetect.js +644 -1
- package/dist/bias.d.ts +130 -0
- package/dist/bias.d.ts.map +1 -0
- package/dist/bias.js +223 -0
- package/dist/circuit_breaker.js +3 -3
- package/dist/cli/diagnostics.d.ts +5 -1
- package/dist/cli/diagnostics.d.ts.map +1 -1
- package/dist/cli/diagnostics.js +31 -8
- package/dist/cli/doctor.d.ts +25 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +381 -0
- package/dist/cli/fix.d.ts +16 -0
- package/dist/cli/fix.d.ts.map +1 -0
- package/dist/cli/fix.js +284 -0
- package/dist/cli/init.d.ts +57 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +205 -0
- package/dist/cli.js +1611 -126
- package/dist/complianceTargets.d.ts +111 -0
- package/dist/complianceTargets.d.ts.map +1 -0
- package/dist/complianceTargets.js +521 -0
- package/dist/config.d.ts +301 -17
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +428 -36
- package/dist/config_migrations.d.ts +41 -0
- package/dist/config_migrations.d.ts.map +1 -1
- package/dist/config_migrations.js +205 -0
- package/dist/config_schema.d.ts +2900 -731
- package/dist/config_schema.d.ts.map +1 -1
- package/dist/config_schema.js +257 -55
- package/dist/context.d.ts +34 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +118 -7
- package/dist/control_backbone.d.ts +122 -0
- package/dist/control_backbone.d.ts.map +1 -0
- package/dist/control_backbone.js +698 -0
- package/dist/data-governance.d.ts +187 -0
- package/dist/data-governance.d.ts.map +1 -0
- package/dist/data-governance.js +424 -0
- package/dist/dataResidency.d.ts +44 -0
- package/dist/dataResidency.d.ts.map +1 -0
- package/dist/dataResidency.js +203 -0
- package/dist/dispatcher.d.ts +32 -0
- package/dist/dispatcher.d.ts.map +1 -1
- package/dist/dispatcher.js +91 -4
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +38 -0
- package/dist/evidence_store.d.ts +103 -0
- package/dist/evidence_store.d.ts.map +1 -0
- package/dist/evidence_store.js +459 -0
- package/dist/executiveSummary.d.ts +65 -8
- package/dist/executiveSummary.d.ts.map +1 -1
- package/dist/executiveSummary.js +289 -26
- package/dist/identity.d.ts +143 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +231 -0
- package/dist/impact-assessment.d.ts +350 -0
- package/dist/impact-assessment.d.ts.map +1 -0
- package/dist/impact-assessment.js +580 -0
- package/dist/index.d.ts +25 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +300 -4
- package/dist/instrumentation.d.ts +1 -1
- package/dist/instrumentation.d.ts.map +1 -1
- package/dist/instrumentation.js +243 -27
- package/dist/integrations/anthropic.d.ts +3 -0
- package/dist/integrations/anthropic.d.ts.map +1 -1
- package/dist/integrations/anthropic.js +284 -79
- package/dist/integrations/governance.d.ts +33 -0
- package/dist/integrations/governance.d.ts.map +1 -0
- package/dist/integrations/governance.js +208 -0
- package/dist/integrations/langchain.d.ts +7 -0
- package/dist/integrations/langchain.d.ts.map +1 -1
- package/dist/integrations/langchain.js +387 -143
- package/dist/integrations/openai.d.ts +9 -0
- package/dist/integrations/openai.d.ts.map +1 -1
- package/dist/integrations/openai.js +673 -73
- package/dist/iso42001_consolidation.d.ts +16 -0
- package/dist/iso42001_consolidation.d.ts.map +1 -0
- package/dist/iso42001_consolidation.js +413 -0
- package/dist/iso42001_workflows.d.ts +263 -0
- package/dist/iso42001_workflows.d.ts.map +1 -0
- package/dist/iso42001_workflows.js +781 -0
- package/dist/lifecycle.d.ts +299 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/lifecycle.js +624 -0
- package/dist/lineage.d.ts +2 -2
- package/dist/lineage.d.ts.map +1 -1
- package/dist/lineage.js +12 -17
- package/dist/middleware/express.d.ts.map +1 -1
- package/dist/middleware/express.js +33 -3
- package/dist/middleware/nextjs.d.ts.map +1 -1
- package/dist/middleware/nextjs.js +42 -68
- package/dist/model.d.ts +143 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +371 -0
- package/dist/onboarding.d.ts +42 -0
- package/dist/onboarding.d.ts.map +1 -0
- package/dist/onboarding.js +1022 -0
- package/dist/oversight.d.ts +264 -0
- package/dist/oversight.d.ts.map +1 -0
- package/dist/oversight.js +497 -0
- package/dist/pdf_report.d.ts.map +1 -1
- package/dist/pdf_report.js +42 -21
- package/dist/presets.d.ts +88 -0
- package/dist/presets.d.ts.map +1 -0
- package/dist/presets.js +520 -0
- package/dist/propagation.d.ts.map +1 -1
- package/dist/propagation.js +34 -2
- package/dist/quotas.d.ts +171 -0
- package/dist/quotas.d.ts.map +1 -0
- package/dist/quotas.js +259 -0
- package/dist/register.d.ts +13 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +99 -0
- package/dist/registry.d.ts +1 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +7 -0
- package/dist/registryData.json +43 -6
- package/dist/report.d.ts +2 -1
- package/dist/report.d.ts.map +1 -1
- package/dist/report.js +189 -2
- package/dist/reporting.d.ts +125 -0
- package/dist/reporting.d.ts.map +1 -1
- package/dist/reporting.js +196 -5
- package/dist/resources.d.ts +285 -0
- package/dist/resources.d.ts.map +1 -0
- package/dist/resources.js +643 -0
- package/dist/risk.d.ts +120 -0
- package/dist/risk.d.ts.map +1 -0
- package/dist/risk.js +220 -0
- package/dist/runtime.d.ts +74 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +598 -22
- package/dist/schemaInference.d.ts +92 -0
- package/dist/schemaInference.d.ts.map +1 -0
- package/dist/schemaInference.js +466 -0
- package/dist/schema_validation.js +2 -2
- package/dist/schemas/config.schema.json +169 -6
- package/dist/schemas/event.schema.json +4 -0
- package/dist/security_report.js +4 -4
- package/dist/signing.d.ts +1 -1
- package/dist/signing.d.ts.map +1 -1
- package/dist/signing.js +4 -0
- package/dist/sinks/file.d.ts +19 -1
- package/dist/sinks/file.d.ts.map +1 -1
- package/dist/sinks/file.js +82 -13
- package/dist/sinks/https.d.ts +10 -0
- package/dist/sinks/https.d.ts.map +1 -1
- package/dist/sinks/https.js +76 -16
- package/dist/sinks/stdout.d.ts +1 -0
- package/dist/sinks/stdout.d.ts.map +1 -1
- package/dist/sinks/stdout.js +12 -1
- package/dist/spec.d.ts +159 -0
- package/dist/spec.d.ts.map +1 -0
- package/dist/spec.js +391 -0
- package/dist/stakeholders.d.ts +199 -0
- package/dist/stakeholders.d.ts.map +1 -0
- package/dist/stakeholders.js +398 -0
- package/dist/standards.d.ts.map +1 -1
- package/dist/standards.js +160 -2
- package/dist/standards_ingest.d.ts +2 -2
- package/dist/standards_ingest.d.ts.map +1 -1
- package/dist/standards_ingest.js +105 -23
- package/dist/streaming.d.ts.map +1 -1
- package/dist/streaming.js +7 -2
- package/dist/telemetry.d.ts +16 -2
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +79 -14
- package/dist/templates/controls/iso42001_control_catalog.json +1443 -0
- package/dist/traced_emitter.d.ts +3 -0
- package/dist/traced_emitter.d.ts.map +1 -1
- package/dist/traced_emitter.js +142 -25
- package/dist/trust_package.d.ts +21 -1
- package/dist/trust_package.d.ts.map +1 -1
- package/dist/trust_package.js +101 -4
- package/dist/verify.d.ts.map +1 -1
- package/dist/verify.js +9 -2
- package/dist/wal.d.ts.map +1 -1
- package/dist/wal.js +2 -1
- package/package.json +14 -1
- package/scripts/postinstall.js +119 -97
- package/templates/controls/iso42001_control_catalog.json +1443 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Consolidation and gap analysis helpers for ISO 42001 workflows.
|
|
3
|
+
*/
|
|
4
|
+
export declare function consolidateLegacyIso42001Modules(options?: {
|
|
5
|
+
ownerFallback?: string;
|
|
6
|
+
}): Record<string, any>;
|
|
7
|
+
export declare function identifyIso42001RemainingGaps(options?: {
|
|
8
|
+
catalog?: Record<string, any>;
|
|
9
|
+
targetCoverage?: number;
|
|
10
|
+
}): Record<string, any>;
|
|
11
|
+
export declare function consolidateAndIdentifyIso42001Gaps(options?: {
|
|
12
|
+
catalog?: Record<string, any>;
|
|
13
|
+
ownerFallback?: string;
|
|
14
|
+
targetCoverage?: number;
|
|
15
|
+
}): Record<string, any>;
|
|
16
|
+
//# sourceMappingURL=iso42001_consolidation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iso42001_consolidation.d.ts","sourceRoot":"","sources":["../src/iso42001_consolidation.ts"],"names":[],"mappings":"AAAA;;GAEG;AA6DH,wBAAgB,gCAAgC,CAAC,OAAO,CAAC,EAAE;IACzD,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CA2XtB;AAED,wBAAgB,6BAA6B,CAAC,OAAO,CAAC,EAAE;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CA0BtB;AAED,wBAAgB,kCAAkC,CAAC,OAAO,CAAC,EAAE;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAQtB"}
|
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Consolidation and gap analysis helpers for ISO 42001 workflows.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.consolidateLegacyIso42001Modules = consolidateLegacyIso42001Modules;
|
|
7
|
+
exports.identifyIso42001RemainingGaps = identifyIso42001RemainingGaps;
|
|
8
|
+
exports.consolidateAndIdentifyIso42001Gaps = consolidateAndIdentifyIso42001Gaps;
|
|
9
|
+
const control_backbone_1 = require("./control_backbone");
|
|
10
|
+
const iso42001_workflows_1 = require("./iso42001_workflows");
|
|
11
|
+
function asList(value) {
|
|
12
|
+
if (value === null || value === undefined) {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
return Array.isArray(value) ? value : [value];
|
|
16
|
+
}
|
|
17
|
+
function text(value, fallback = '') {
|
|
18
|
+
const normalized = String(value || '').trim();
|
|
19
|
+
return normalized || fallback;
|
|
20
|
+
}
|
|
21
|
+
function loadLegacyModule(modulePath) {
|
|
22
|
+
try {
|
|
23
|
+
// Lazy-load legacy modules to avoid hard type-coupling in the consolidated API.
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
25
|
+
return require(modulePath);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function consolidateLegacyIso42001Modules(options) {
|
|
32
|
+
const ownerFallback = options?.ownerFallback || 'AI Governance Lead';
|
|
33
|
+
const counts = {
|
|
34
|
+
impact_assessments: 0,
|
|
35
|
+
lifecycle_records: 0,
|
|
36
|
+
data_governance_records: 0,
|
|
37
|
+
stakeholder_records: 0,
|
|
38
|
+
resource_records: 0,
|
|
39
|
+
};
|
|
40
|
+
const warnings = [];
|
|
41
|
+
const impactModule = loadLegacyModule('./impact-assessment');
|
|
42
|
+
const lifecycleModule = loadLegacyModule('./lifecycle');
|
|
43
|
+
const dataGovernanceModule = loadLegacyModule('./data-governance');
|
|
44
|
+
const stakeholdersModule = loadLegacyModule('./stakeholders');
|
|
45
|
+
const resourcesModule = loadLegacyModule('./resources');
|
|
46
|
+
try {
|
|
47
|
+
const assessments = typeof impactModule.getAllAssessments === 'function' ? impactModule.getAllAssessments() : [];
|
|
48
|
+
for (const assessment of assessments) {
|
|
49
|
+
(0, iso42001_workflows_1.recordImpactAssessment)({
|
|
50
|
+
title: `Consolidated impact assessment: ${text(assessment.assessmentId, 'legacy')}`,
|
|
51
|
+
owner: text(assessment.assessor, ownerFallback),
|
|
52
|
+
systemId: text(assessment.systemId, 'unknown-system'),
|
|
53
|
+
methodology: 'legacy_impact_assessment',
|
|
54
|
+
individualImpacts: asList(assessment.individualImpacts).map((item) => text(item?.description, 'impact')),
|
|
55
|
+
societalImpacts: asList(assessment.societalImpacts).map((item) => text(item?.description, 'societal_impact')),
|
|
56
|
+
mitigations: asList(assessment.riskMitigations).map((item) => text(item?.description, 'mitigation')),
|
|
57
|
+
approvedBy: asList(assessment.approvals).length > 0 ? text(asList(assessment.approvals)[0]?.approverName) : undefined,
|
|
58
|
+
metadata: { source: 'legacy_impact_assessment', assessment },
|
|
59
|
+
});
|
|
60
|
+
counts.impact_assessments += 1;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
warnings.push(`impact_assessment_consolidation_failed: ${String(error)}`);
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
const systems = typeof lifecycleModule.getAllSystems === 'function' ? lifecycleModule.getAllSystems() : [];
|
|
68
|
+
for (const system of systems) {
|
|
69
|
+
const systemId = text(system.systemId, 'legacy-system');
|
|
70
|
+
const owner = text(system.owner || system.createdBy, ownerFallback);
|
|
71
|
+
const objectives = asList(system.developmentObjectives).map((item) => text(item?.description, 'objective'));
|
|
72
|
+
if (objectives.length > 0) {
|
|
73
|
+
(0, iso42001_workflows_1.recordResponsibleDevelopmentObjectives)({
|
|
74
|
+
title: `Consolidated objectives: ${systemId}`,
|
|
75
|
+
owner,
|
|
76
|
+
objectives,
|
|
77
|
+
linkedRisks: asList(system.riskLinks),
|
|
78
|
+
metadata: { source: 'legacy_lifecycle', system },
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
const processSteps = asList(system.designDocuments).map((item) => text(item?.title, 'design_doc'));
|
|
82
|
+
if (processSteps.length > 0) {
|
|
83
|
+
(0, iso42001_workflows_1.recordResponsibleDevelopmentProcess)({
|
|
84
|
+
title: `Consolidated development process: ${systemId}`,
|
|
85
|
+
owner,
|
|
86
|
+
processSteps,
|
|
87
|
+
metadata: { source: 'legacy_lifecycle', system },
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
const requirements = asList(system.requirements).map((item) => text(item?.description, 'requirement'));
|
|
91
|
+
if (requirements.length > 0) {
|
|
92
|
+
(0, iso42001_workflows_1.recordRequirementsSpecification)({
|
|
93
|
+
title: `Consolidated requirements: ${systemId}`,
|
|
94
|
+
owner,
|
|
95
|
+
systemId,
|
|
96
|
+
requirements,
|
|
97
|
+
stakeholderGroups: asList(system.stakeholders),
|
|
98
|
+
metadata: { source: 'legacy_lifecycle', system },
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
const vvCriteria = asList(system.verificationRecords)
|
|
102
|
+
.map((item) => text(item?.method, 'verification'))
|
|
103
|
+
.concat(asList(system.validationRecords).map((item) => text(item?.method, 'validation')));
|
|
104
|
+
if (vvCriteria.length > 0) {
|
|
105
|
+
(0, iso42001_workflows_1.recordVerificationValidationPlan)({
|
|
106
|
+
title: `Consolidated V&V: ${systemId}`,
|
|
107
|
+
owner,
|
|
108
|
+
criteria: vvCriteria,
|
|
109
|
+
metadata: { source: 'legacy_lifecycle', system },
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
const deployment = system.deploymentPlan;
|
|
113
|
+
if (deployment) {
|
|
114
|
+
(0, iso42001_workflows_1.recordDeploymentPlan)({
|
|
115
|
+
title: `Consolidated deployment plan: ${systemId}`,
|
|
116
|
+
owner,
|
|
117
|
+
releaseScope: text(deployment.description, systemId),
|
|
118
|
+
rollbackPlan: text(deployment.rollbackPlan, 'legacy_rollback_plan'),
|
|
119
|
+
approvers: asList(deployment.approvers),
|
|
120
|
+
metadata: { source: 'legacy_lifecycle', system },
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
const transitions = asList(system.stageTransitions).map((item) => text(item?.toStage, 'stage'));
|
|
124
|
+
if (transitions.length > 0) {
|
|
125
|
+
(0, iso42001_workflows_1.recordOperationsMonitoringPlan)({
|
|
126
|
+
title: `Consolidated operations monitoring: ${systemId}`,
|
|
127
|
+
owner,
|
|
128
|
+
monitoringSignals: ['stage_transitions'],
|
|
129
|
+
maintenanceTasks: transitions,
|
|
130
|
+
metadata: { source: 'legacy_lifecycle', system },
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
const docs = asList(system.designDocuments).map((item) => text(item?.pathOrUrl, 'doc_ref'));
|
|
134
|
+
if (docs.length > 0) {
|
|
135
|
+
(0, iso42001_workflows_1.recordStakeholderTechnicalDocumentation)({
|
|
136
|
+
title: `Consolidated technical documentation: ${systemId}`,
|
|
137
|
+
owner,
|
|
138
|
+
audience: asList(system.stakeholders).length > 0 ? asList(system.stakeholders) : ['internal'],
|
|
139
|
+
documentRefs: docs,
|
|
140
|
+
metadata: { source: 'legacy_lifecycle', system },
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
(0, iso42001_workflows_1.recordLifecycleEventLoggingPolicy)({
|
|
144
|
+
title: `Consolidated lifecycle event logging policy: ${systemId}`,
|
|
145
|
+
owner,
|
|
146
|
+
logScope: ['lifecycle_events', 'stage_transitions'],
|
|
147
|
+
retentionDays: 365,
|
|
148
|
+
integrityControls: ['hash_chain', 'signature_verification'],
|
|
149
|
+
metadata: { source: 'legacy_lifecycle', system },
|
|
150
|
+
});
|
|
151
|
+
counts.lifecycle_records += 1;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
warnings.push(`lifecycle_consolidation_failed: ${String(error)}`);
|
|
156
|
+
}
|
|
157
|
+
try {
|
|
158
|
+
const datasets = typeof dataGovernanceModule.getAllDatasets === 'function' ? dataGovernanceModule.getAllDatasets() : [];
|
|
159
|
+
for (const dataset of datasets) {
|
|
160
|
+
const datasetId = text(dataset.datasetId, 'legacy-dataset');
|
|
161
|
+
const owner = text(dataset.owner || dataset.createdBy, ownerFallback);
|
|
162
|
+
(0, iso42001_workflows_1.recordDataAcquisition)({
|
|
163
|
+
title: `Consolidated data acquisition: ${datasetId}`,
|
|
164
|
+
owner,
|
|
165
|
+
dataSources: asList(dataset.sources).length > 0 ? asList(dataset.sources) : [text(dataset.name, datasetId)],
|
|
166
|
+
consentBasis: asList(dataset.consentBasis).length > 0 ? asList(dataset.consentBasis) : ['legacy_basis'],
|
|
167
|
+
owners: asList(dataset.dataOwners).length > 0 ? asList(dataset.dataOwners) : [owner],
|
|
168
|
+
metadata: { source: 'legacy_data_governance', dataset },
|
|
169
|
+
});
|
|
170
|
+
const quality = (dataset.qualityMetrics || {});
|
|
171
|
+
if (Object.keys(quality).length > 0) {
|
|
172
|
+
(0, iso42001_workflows_1.recordDataQualityCriteria)({
|
|
173
|
+
title: `Consolidated data quality criteria: ${datasetId}`,
|
|
174
|
+
owner,
|
|
175
|
+
qualityDimensions: Object.keys(quality),
|
|
176
|
+
thresholds: quality,
|
|
177
|
+
validationSchedule: text(dataset.qualityCheckSchedule, 'legacy'),
|
|
178
|
+
metadata: { source: 'legacy_data_governance', dataset },
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
const lineage = asList(dataset.lineageParents);
|
|
182
|
+
if (lineage.length > 0) {
|
|
183
|
+
(0, iso42001_workflows_1.recordDataProvenanceProcess)({
|
|
184
|
+
title: `Consolidated data provenance process: ${datasetId}`,
|
|
185
|
+
owner,
|
|
186
|
+
lineageMethod: 'legacy_lineage',
|
|
187
|
+
systems: lineage,
|
|
188
|
+
metadata: { source: 'legacy_data_governance', dataset },
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
const preparationSteps = asList(dataset.preparationSteps).map((item) => text(item?.description, 'prep_step'));
|
|
192
|
+
if (preparationSteps.length > 0) {
|
|
193
|
+
(0, iso42001_workflows_1.recordDataPreparationCriteria)({
|
|
194
|
+
title: `Consolidated data preparation criteria: ${datasetId}`,
|
|
195
|
+
owner,
|
|
196
|
+
preparationSteps,
|
|
197
|
+
acceptanceCriteria: asList(dataset.acceptanceCriteria).length > 0 ? asList(dataset.acceptanceCriteria) : ['legacy_criteria'],
|
|
198
|
+
metadata: { source: 'legacy_data_governance', dataset },
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
counts.data_governance_records += 1;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
warnings.push(`data_governance_consolidation_failed: ${String(error)}`);
|
|
206
|
+
}
|
|
207
|
+
try {
|
|
208
|
+
const stakeholders = typeof stakeholdersModule.getAllStakeholders === 'function' ? stakeholdersModule.getAllStakeholders() : [];
|
|
209
|
+
for (const stakeholder of stakeholders) {
|
|
210
|
+
const owner = text(stakeholder.owner || stakeholder.name, ownerFallback);
|
|
211
|
+
const requirements = asList(stakeholder.informationRequirements);
|
|
212
|
+
(0, iso42001_workflows_1.recordTransparencyDisclosure)({
|
|
213
|
+
title: `Consolidated stakeholder disclosure: ${text(stakeholder.partyId, 'stakeholder')}`,
|
|
214
|
+
owner,
|
|
215
|
+
channels: [text(stakeholder.communicationChannel, 'email')],
|
|
216
|
+
disclosureScope: text(stakeholder.type, 'stakeholder_disclosure'),
|
|
217
|
+
metadata: { source: 'legacy_stakeholders', stakeholder },
|
|
218
|
+
});
|
|
219
|
+
(0, iso42001_workflows_1.recordResponsibleUseProcess)({
|
|
220
|
+
title: `Consolidated responsible use process: ${text(stakeholder.partyId, 'stakeholder')}`,
|
|
221
|
+
owner,
|
|
222
|
+
processSteps: requirements.length > 0 ? requirements : ['legacy_responsible_use_process'],
|
|
223
|
+
metadata: { source: 'legacy_stakeholders', stakeholder },
|
|
224
|
+
});
|
|
225
|
+
(0, iso42001_workflows_1.recordResponsibleUseObjectives)({
|
|
226
|
+
title: `Consolidated responsible use objectives: ${text(stakeholder.partyId, 'stakeholder')}`,
|
|
227
|
+
owner,
|
|
228
|
+
objectives: requirements.length > 0 ? requirements : ['legacy_responsible_use_objective'],
|
|
229
|
+
metadata: { source: 'legacy_stakeholders', stakeholder },
|
|
230
|
+
});
|
|
231
|
+
(0, iso42001_workflows_1.recordIntendedUseStatement)({
|
|
232
|
+
title: `Consolidated intended use statement: ${text(stakeholder.partyId, 'stakeholder')}`,
|
|
233
|
+
owner,
|
|
234
|
+
intendedUses: requirements.length > 0 ? requirements : ['legacy_intended_use'],
|
|
235
|
+
prohibitedUses: ['unspecified_out_of_scope_use'],
|
|
236
|
+
enforcementHooks: ['legacy_policy_enforcement'],
|
|
237
|
+
metadata: { source: 'legacy_stakeholders', stakeholder },
|
|
238
|
+
});
|
|
239
|
+
counts.stakeholder_records += 1;
|
|
240
|
+
}
|
|
241
|
+
const suppliers = typeof stakeholdersModule.getAllSuppliers === 'function' ? stakeholdersModule.getAllSuppliers() : [];
|
|
242
|
+
for (const supplier of suppliers) {
|
|
243
|
+
const owner = text(supplier.owner || supplier.name, ownerFallback);
|
|
244
|
+
const responsibilities = asList(supplier.responsibilities).map((item) => text(item?.description, 'responsibility'));
|
|
245
|
+
(0, iso42001_workflows_1.recordThirdPartyResponsibilityMatrix)({
|
|
246
|
+
title: `Consolidated third-party matrix: ${text(supplier.supplierId, 'supplier')}`,
|
|
247
|
+
owner,
|
|
248
|
+
responsibilityAllocations: responsibilities.length > 0 ? responsibilities : ['legacy_supplier_responsibility'],
|
|
249
|
+
metadata: { source: 'legacy_stakeholders', supplier },
|
|
250
|
+
});
|
|
251
|
+
(0, iso42001_workflows_1.recordSupplierAssurance)({
|
|
252
|
+
title: `Consolidated supplier assurance: ${text(supplier.supplierId, 'supplier')}`,
|
|
253
|
+
owner,
|
|
254
|
+
supplier: text(supplier.name, 'legacy_supplier'),
|
|
255
|
+
assuranceChecks: asList(supplier.assuranceChecks).length > 0 ? asList(supplier.assuranceChecks) : ['legacy_supplier_check'],
|
|
256
|
+
reviewOutcome: text(supplier.status, 'legacy_status'),
|
|
257
|
+
metadata: { source: 'legacy_stakeholders', supplier },
|
|
258
|
+
});
|
|
259
|
+
counts.stakeholder_records += 1;
|
|
260
|
+
}
|
|
261
|
+
const customers = typeof stakeholdersModule.getAllCustomers === 'function' ? stakeholdersModule.getAllCustomers() : [];
|
|
262
|
+
for (const customer of customers) {
|
|
263
|
+
const owner = text(customer.owner || customer.name, ownerFallback);
|
|
264
|
+
(0, iso42001_workflows_1.recordCustomerExpectationAlignment)({
|
|
265
|
+
title: `Consolidated customer alignment: ${text(customer.customerId, 'customer')}`,
|
|
266
|
+
owner,
|
|
267
|
+
customerSegments: asList(customer.segments).length > 0 ? asList(customer.segments) : [text(customer.name, 'customer')],
|
|
268
|
+
requirementMappings: asList(customer.requirements).length > 0 ? asList(customer.requirements) : ['legacy_customer_requirement'],
|
|
269
|
+
metadata: { source: 'legacy_stakeholders', customer },
|
|
270
|
+
});
|
|
271
|
+
counts.stakeholder_records += 1;
|
|
272
|
+
}
|
|
273
|
+
if (counts.stakeholder_records > 0) {
|
|
274
|
+
(0, iso42001_workflows_1.recordAdverseImpactReporting)({
|
|
275
|
+
title: 'Consolidated adverse impact reporting',
|
|
276
|
+
owner: ownerFallback,
|
|
277
|
+
channels: ['legacy_reporting_channel'],
|
|
278
|
+
triageSla: 'legacy_sla',
|
|
279
|
+
metadata: { source: 'legacy_stakeholders' },
|
|
280
|
+
});
|
|
281
|
+
(0, iso42001_workflows_1.recordIncidentCommunicationPlan)({
|
|
282
|
+
title: 'Consolidated incident communication plan',
|
|
283
|
+
owner: ownerFallback,
|
|
284
|
+
communicationMatrix: ['legacy_incident_matrix'],
|
|
285
|
+
escalationContacts: ['legacy_oncall'],
|
|
286
|
+
metadata: { source: 'legacy_stakeholders' },
|
|
287
|
+
});
|
|
288
|
+
(0, iso42001_workflows_1.recordReportingObligations)({
|
|
289
|
+
title: 'Consolidated reporting obligations',
|
|
290
|
+
owner: ownerFallback,
|
|
291
|
+
obligations: ['legacy_reporting_obligation'],
|
|
292
|
+
recipients: ['interested_parties'],
|
|
293
|
+
metadata: { source: 'legacy_stakeholders' },
|
|
294
|
+
});
|
|
295
|
+
(0, iso42001_workflows_1.recordPolicyAlignment)({
|
|
296
|
+
title: 'Consolidated policy alignment',
|
|
297
|
+
owner: ownerFallback,
|
|
298
|
+
alignedPolicies: ['legacy_policy'],
|
|
299
|
+
rationale: 'legacy consolidation',
|
|
300
|
+
metadata: { source: 'legacy_stakeholders' },
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
catch (error) {
|
|
305
|
+
warnings.push(`stakeholder_consolidation_failed: ${String(error)}`);
|
|
306
|
+
}
|
|
307
|
+
try {
|
|
308
|
+
const registry = typeof resourcesModule.getRegistry === 'function' ? resourcesModule.getRegistry() : null;
|
|
309
|
+
const inventories = registry && typeof registry.listInventories === 'function' ? registry.listInventories() : [];
|
|
310
|
+
for (const inventory of inventories) {
|
|
311
|
+
const owner = text(inventory.owner || inventory.name, ownerFallback);
|
|
312
|
+
(0, iso42001_workflows_1.recordResourceInventory)({
|
|
313
|
+
title: `Consolidated resource inventory: ${text(inventory.inventoryId, 'inventory')}`,
|
|
314
|
+
owner,
|
|
315
|
+
dataResources: asList(inventory.dataResources),
|
|
316
|
+
toolingResources: asList(inventory.toolingResources).map((item) => text(item?.name, 'tooling')),
|
|
317
|
+
computeResources: asList(inventory.computeResources).map((item) => text(item?.provider, 'compute')),
|
|
318
|
+
humanResources: asList(inventory.humanResources).map((item) => text(item?.role, 'role')),
|
|
319
|
+
metadata: { source: 'legacy_resources', inventory },
|
|
320
|
+
});
|
|
321
|
+
(0, iso42001_workflows_1.recordResourceCompetency)({
|
|
322
|
+
title: `Consolidated resource competency: ${text(inventory.inventoryId, 'inventory')}`,
|
|
323
|
+
owner,
|
|
324
|
+
roles: asList(inventory.humanResources).map((item) => text(item?.role, 'role')).length > 0
|
|
325
|
+
? asList(inventory.humanResources).map((item) => text(item?.role, 'role'))
|
|
326
|
+
: ['legacy_role'],
|
|
327
|
+
requiredCompetencies: ['legacy_competency'],
|
|
328
|
+
trainingPlan: ['legacy_training_plan'],
|
|
329
|
+
metadata: { source: 'legacy_resources', inventory },
|
|
330
|
+
});
|
|
331
|
+
counts.resource_records += 1;
|
|
332
|
+
}
|
|
333
|
+
const policyReviews = registry && typeof registry.listPolicyReviews === 'function' ? registry.listPolicyReviews() : [];
|
|
334
|
+
for (const review of policyReviews) {
|
|
335
|
+
const owner = text(review.reviewer || review.policyName, ownerFallback);
|
|
336
|
+
const findings = asList(review.findings);
|
|
337
|
+
const recommendations = asList(review.recommendations);
|
|
338
|
+
const actions = asList(review.actionItems);
|
|
339
|
+
(0, iso42001_workflows_1.recordInternalAuditReport)({
|
|
340
|
+
title: `Consolidated internal audit: ${text(review.reviewId, 'review')}`,
|
|
341
|
+
owner,
|
|
342
|
+
auditScope: text(review.policyName, 'legacy_policy_scope'),
|
|
343
|
+
findings: findings.length > 0 ? findings : ['legacy_policy_review_finding'],
|
|
344
|
+
nonconformities: asList(review.nonconformities),
|
|
345
|
+
recommendations,
|
|
346
|
+
metadata: { source: 'legacy_resources', policy_review: review },
|
|
347
|
+
});
|
|
348
|
+
(0, iso42001_workflows_1.recordManagementReviewMinutes)({
|
|
349
|
+
title: `Consolidated management review: ${text(review.reviewId, 'review')}`,
|
|
350
|
+
owner,
|
|
351
|
+
attendees: [ownerFallback],
|
|
352
|
+
reviewTopics: [text(review.policyType, 'legacy_policy_review_topic')],
|
|
353
|
+
decisions: [text(review.policyStatus, 'legacy_policy_decision')],
|
|
354
|
+
actionItems: actions,
|
|
355
|
+
metadata: { source: 'legacy_resources', policy_review: review },
|
|
356
|
+
});
|
|
357
|
+
if (actions.length > 0) {
|
|
358
|
+
(0, iso42001_workflows_1.recordCorrectiveActionLog)({
|
|
359
|
+
title: `Consolidated corrective action: ${text(review.reviewId, 'review')}`,
|
|
360
|
+
owner,
|
|
361
|
+
issueReference: text(review.reviewId, 'legacy_review_issue'),
|
|
362
|
+
rootCause: text(review.policyStatus, 'legacy_root_cause'),
|
|
363
|
+
correctiveActions: actions,
|
|
364
|
+
preventiveActions: recommendations,
|
|
365
|
+
status: text(review.status) === 'completed' ? 'closed' : 'open',
|
|
366
|
+
metadata: { source: 'legacy_resources', policy_review: review },
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
catch (error) {
|
|
372
|
+
warnings.push(`resource_consolidation_failed: ${String(error)}`);
|
|
373
|
+
}
|
|
374
|
+
return {
|
|
375
|
+
consolidated_counts: counts,
|
|
376
|
+
total_consolidated: Object.values(counts).reduce((total, value) => total + value, 0),
|
|
377
|
+
warnings,
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
function identifyIso42001RemainingGaps(options) {
|
|
381
|
+
const catalog = options?.catalog || (0, control_backbone_1.loadDefaultIso42001Catalog)();
|
|
382
|
+
const targetCoverage = options?.targetCoverage ?? 0.9;
|
|
383
|
+
const report = (0, control_backbone_1.generateControlCoverageReport)({ catalog, targetCoverage });
|
|
384
|
+
const remainingRows = Array.isArray(report.controls)
|
|
385
|
+
? report.controls.filter((row) => !row?.reportable)
|
|
386
|
+
: [];
|
|
387
|
+
const remainingControls = remainingRows
|
|
388
|
+
.map((row) => String(row.control_id || '').trim())
|
|
389
|
+
.filter(Boolean);
|
|
390
|
+
return {
|
|
391
|
+
summary: {
|
|
392
|
+
...(report.summary || {}),
|
|
393
|
+
remaining_control_count: remainingControls.length,
|
|
394
|
+
target_coverage: targetCoverage,
|
|
395
|
+
},
|
|
396
|
+
remaining_controls: remainingRows.map((row) => ({
|
|
397
|
+
control_id: row.control_id,
|
|
398
|
+
status: row.status,
|
|
399
|
+
gaps: Array.isArray(row.gaps) ? row.gaps : [],
|
|
400
|
+
missing_evidence_types: Array.isArray(row.missing_evidence_types) ? row.missing_evidence_types : [],
|
|
401
|
+
})),
|
|
402
|
+
prioritized_missing_modules: (0, control_backbone_1.prioritizeMissingWorkflowModules)(remainingControls),
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
function consolidateAndIdentifyIso42001Gaps(options) {
|
|
406
|
+
return {
|
|
407
|
+
consolidation: consolidateLegacyIso42001Modules({ ownerFallback: options?.ownerFallback }),
|
|
408
|
+
gaps: identifyIso42001RemainingGaps({
|
|
409
|
+
catalog: options?.catalog,
|
|
410
|
+
targetCoverage: options?.targetCoverage,
|
|
411
|
+
}),
|
|
412
|
+
};
|
|
413
|
+
}
|