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
package/dist/context.js
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.registerTraceCompletionHandler = registerTraceCompletionHandler;
|
|
7
|
+
exports.registerTraceStartHandler = registerTraceStartHandler;
|
|
8
|
+
exports.recordTraceStart = recordTraceStart;
|
|
9
|
+
exports.clearTraceStart = clearTraceStart;
|
|
10
|
+
exports.getTraceStartTime = getTraceStartTime;
|
|
7
11
|
exports.getCurrentContext = getCurrentContext;
|
|
8
12
|
exports.getCurrentSpan = getCurrentSpan;
|
|
9
13
|
exports.pushSpan = pushSpan;
|
|
@@ -13,19 +17,37 @@ exports.traceAsync = traceAsync;
|
|
|
13
17
|
exports.startSpan = startSpan;
|
|
14
18
|
exports.nextStepNumber = nextStepNumber;
|
|
15
19
|
exports.nextEventSequence = nextEventSequence;
|
|
20
|
+
exports.completeTrace = completeTrace;
|
|
21
|
+
exports.completeTraceSync = completeTraceSync;
|
|
16
22
|
exports.captureContext = captureContext;
|
|
17
23
|
exports.runInContext = runInContext;
|
|
18
24
|
exports.bindContext = bindContext;
|
|
19
25
|
const async_hooks_1 = require("async_hooks");
|
|
20
26
|
const ids_1 = require("./ids");
|
|
21
27
|
const logger_1 = require("./logger");
|
|
28
|
+
const lineage_1 = require("./lineage");
|
|
22
29
|
// AsyncLocalStorage for Node.js context propagation
|
|
23
30
|
const asyncLocalStorage = new async_hooks_1.AsyncLocalStorage();
|
|
31
|
+
const traceStartTimes = new Map();
|
|
24
32
|
const traceCompletionHandlers = new Set();
|
|
33
|
+
const traceStartHandlers = new Set();
|
|
25
34
|
function registerTraceCompletionHandler(handler) {
|
|
26
35
|
traceCompletionHandlers.add(handler);
|
|
27
36
|
return () => traceCompletionHandlers.delete(handler);
|
|
28
37
|
}
|
|
38
|
+
function registerTraceStartHandler(handler) {
|
|
39
|
+
traceStartHandlers.add(handler);
|
|
40
|
+
return () => traceStartHandlers.delete(handler);
|
|
41
|
+
}
|
|
42
|
+
function recordTraceStart(traceId, startTime) {
|
|
43
|
+
traceStartTimes.set(traceId, startTime);
|
|
44
|
+
}
|
|
45
|
+
function clearTraceStart(traceId) {
|
|
46
|
+
traceStartTimes.delete(traceId);
|
|
47
|
+
}
|
|
48
|
+
function getTraceStartTime(traceId) {
|
|
49
|
+
return traceStartTimes.get(traceId);
|
|
50
|
+
}
|
|
29
51
|
function getCurrentContext() {
|
|
30
52
|
return asyncLocalStorage.getStore();
|
|
31
53
|
}
|
|
@@ -42,6 +64,18 @@ function pushSpan(span) {
|
|
|
42
64
|
ctx.spanStack.push(span);
|
|
43
65
|
ctx.currentSpan = span;
|
|
44
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Pop and return the top span from the current trace context.
|
|
69
|
+
*
|
|
70
|
+
* When the span stack becomes empty, this also clears the trace start time
|
|
71
|
+
* to prevent memory leaks.
|
|
72
|
+
*
|
|
73
|
+
* @returns The popped span, or null if no context or empty stack.
|
|
74
|
+
*
|
|
75
|
+
* @remarks
|
|
76
|
+
* Cross-SDK Parity: Both Python and Node.js clear trace start times when
|
|
77
|
+
* the span stack becomes empty to prevent memory leaks in long-running processes.
|
|
78
|
+
*/
|
|
45
79
|
function popSpan() {
|
|
46
80
|
const ctx = getCurrentContext();
|
|
47
81
|
if (!ctx || ctx.spanStack.length === 0) {
|
|
@@ -54,11 +88,14 @@ function popSpan() {
|
|
|
54
88
|
}
|
|
55
89
|
else {
|
|
56
90
|
ctx.currentSpan = null;
|
|
91
|
+
// Clean up trace start time to prevent memory leaks (matches Python SDK)
|
|
92
|
+
clearTraceStart(span.traceId);
|
|
57
93
|
}
|
|
58
94
|
return span;
|
|
59
95
|
}
|
|
60
96
|
function trace(name, fn, options) {
|
|
61
97
|
const rootTraceId = options?.traceId || (0, ids_1.generateUlid)('trc');
|
|
98
|
+
const startTime = Date.now();
|
|
62
99
|
const span = {
|
|
63
100
|
traceId: rootTraceId,
|
|
64
101
|
spanId: (0, ids_1.generateUlid)('spn'),
|
|
@@ -69,10 +106,16 @@ function trace(name, fn, options) {
|
|
|
69
106
|
const ctx = {
|
|
70
107
|
currentSpan: span,
|
|
71
108
|
spanStack: [span],
|
|
109
|
+
startTime,
|
|
72
110
|
stepCounter: 0,
|
|
73
111
|
eventCounter: 0,
|
|
74
112
|
};
|
|
75
|
-
|
|
113
|
+
recordTraceStart(rootTraceId, startTime);
|
|
114
|
+
const lineageStorage = (0, lineage_1.getLineageStorage)();
|
|
115
|
+
const lineageContext = lineageStorage.getStore() || (0, lineage_1.createLineageContext)();
|
|
116
|
+
ctx.lineageContext = lineageContext;
|
|
117
|
+
const run = () => asyncLocalStorage.run(ctx, () => {
|
|
118
|
+
runTraceStartHandlersSync(span);
|
|
76
119
|
let result;
|
|
77
120
|
try {
|
|
78
121
|
result = fn(span);
|
|
@@ -87,9 +130,14 @@ function trace(name, fn, options) {
|
|
|
87
130
|
runTraceCompletionHandlersSync(span);
|
|
88
131
|
return result;
|
|
89
132
|
});
|
|
133
|
+
if (lineageStorage.getStore()) {
|
|
134
|
+
return run();
|
|
135
|
+
}
|
|
136
|
+
return lineageStorage.run(lineageContext, run);
|
|
90
137
|
}
|
|
91
138
|
async function traceAsync(name, fn, options) {
|
|
92
139
|
const rootTraceId = options?.traceId || (0, ids_1.generateUlid)('trc');
|
|
140
|
+
const startTime = Date.now();
|
|
93
141
|
const span = {
|
|
94
142
|
traceId: rootTraceId,
|
|
95
143
|
spanId: (0, ids_1.generateUlid)('spn'),
|
|
@@ -100,10 +148,16 @@ async function traceAsync(name, fn, options) {
|
|
|
100
148
|
const ctx = {
|
|
101
149
|
currentSpan: span,
|
|
102
150
|
spanStack: [span],
|
|
151
|
+
startTime,
|
|
103
152
|
stepCounter: 0,
|
|
104
153
|
eventCounter: 0,
|
|
105
154
|
};
|
|
106
|
-
|
|
155
|
+
recordTraceStart(rootTraceId, startTime);
|
|
156
|
+
const lineageStorage = (0, lineage_1.getLineageStorage)();
|
|
157
|
+
const lineageContext = lineageStorage.getStore() || (0, lineage_1.createLineageContext)();
|
|
158
|
+
ctx.lineageContext = lineageContext;
|
|
159
|
+
const run = () => asyncLocalStorage.run(ctx, async () => {
|
|
160
|
+
await runTraceStartHandlers(span);
|
|
107
161
|
try {
|
|
108
162
|
return await fn(span);
|
|
109
163
|
}
|
|
@@ -111,15 +165,32 @@ async function traceAsync(name, fn, options) {
|
|
|
111
165
|
await runTraceCompletionHandlers(span);
|
|
112
166
|
}
|
|
113
167
|
});
|
|
168
|
+
if (lineageStorage.getStore()) {
|
|
169
|
+
return run();
|
|
170
|
+
}
|
|
171
|
+
return lineageStorage.run(lineageContext, run);
|
|
114
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Create and push a child span, returning it.
|
|
175
|
+
*
|
|
176
|
+
* @param name - Name for the new span.
|
|
177
|
+
* @param metadata - Optional metadata object for the span.
|
|
178
|
+
* @returns The created Span object.
|
|
179
|
+
* @throws Error if no active trace context exists.
|
|
180
|
+
*
|
|
181
|
+
* @remarks
|
|
182
|
+
* Cross-SDK Parity: Both Python and Node.js require an active trace
|
|
183
|
+
* context. Use trace() or traceAsync() before calling startSpan().
|
|
184
|
+
*/
|
|
115
185
|
function startSpan(name, metadata) {
|
|
116
186
|
const current = getCurrentSpan();
|
|
117
|
-
|
|
118
|
-
|
|
187
|
+
if (!current) {
|
|
188
|
+
throw new Error('No active trace context; use trace() or traceAsync() before calling startSpan().');
|
|
189
|
+
}
|
|
119
190
|
const span = {
|
|
120
|
-
traceId,
|
|
191
|
+
traceId: current.traceId,
|
|
121
192
|
spanId: (0, ids_1.generateUlid)('spn'),
|
|
122
|
-
parentSpanId,
|
|
193
|
+
parentSpanId: current.spanId,
|
|
123
194
|
name,
|
|
124
195
|
metadata: metadata || {},
|
|
125
196
|
};
|
|
@@ -142,6 +213,31 @@ function nextEventSequence() {
|
|
|
142
213
|
ctx.eventCounter += 1;
|
|
143
214
|
return ctx.eventCounter;
|
|
144
215
|
}
|
|
216
|
+
function runTraceStartHandlersSync(span) {
|
|
217
|
+
for (const handler of traceStartHandlers) {
|
|
218
|
+
try {
|
|
219
|
+
const result = handler(span);
|
|
220
|
+
if (result && typeof result.then === 'function') {
|
|
221
|
+
result.catch((error) => {
|
|
222
|
+
logger_1.logger.error('Trace start handler failed: %s', error);
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
catch (error) {
|
|
227
|
+
logger_1.logger.error('Trace start handler failed: %s', error);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
async function runTraceStartHandlers(span) {
|
|
232
|
+
for (const handler of traceStartHandlers) {
|
|
233
|
+
try {
|
|
234
|
+
await handler(span);
|
|
235
|
+
}
|
|
236
|
+
catch (error) {
|
|
237
|
+
logger_1.logger.error('Trace start handler failed: %s', error);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
145
241
|
function runTraceCompletionHandlersSync(span) {
|
|
146
242
|
for (const handler of traceCompletionHandlers) {
|
|
147
243
|
try {
|
|
@@ -156,6 +252,7 @@ function runTraceCompletionHandlersSync(span) {
|
|
|
156
252
|
logger_1.logger.error('Trace completion handler failed: %s', error);
|
|
157
253
|
}
|
|
158
254
|
}
|
|
255
|
+
clearTraceStart(span.traceId);
|
|
159
256
|
}
|
|
160
257
|
async function runTraceCompletionHandlers(span) {
|
|
161
258
|
for (const handler of traceCompletionHandlers) {
|
|
@@ -166,6 +263,13 @@ async function runTraceCompletionHandlers(span) {
|
|
|
166
263
|
logger_1.logger.error('Trace completion handler failed: %s', error);
|
|
167
264
|
}
|
|
168
265
|
}
|
|
266
|
+
clearTraceStart(span.traceId);
|
|
267
|
+
}
|
|
268
|
+
function completeTrace(span) {
|
|
269
|
+
return runTraceCompletionHandlers(span);
|
|
270
|
+
}
|
|
271
|
+
function completeTraceSync(span) {
|
|
272
|
+
runTraceCompletionHandlersSync(span);
|
|
169
273
|
}
|
|
170
274
|
function isPromise(value) {
|
|
171
275
|
return value && typeof value.then === 'function';
|
|
@@ -195,7 +299,14 @@ function runInContext(ctx, fn) {
|
|
|
195
299
|
if (!ctx) {
|
|
196
300
|
return fn();
|
|
197
301
|
}
|
|
198
|
-
|
|
302
|
+
const lineageStorage = (0, lineage_1.getLineageStorage)();
|
|
303
|
+
const run = () => asyncLocalStorage.run(ctx, fn);
|
|
304
|
+
if (lineageStorage.getStore()) {
|
|
305
|
+
return run();
|
|
306
|
+
}
|
|
307
|
+
const lineageContext = ctx.lineageContext || (0, lineage_1.createLineageContext)();
|
|
308
|
+
ctx.lineageContext = lineageContext;
|
|
309
|
+
return lineageStorage.run(lineageContext, run);
|
|
199
310
|
}
|
|
200
311
|
/**
|
|
201
312
|
* Bind a function to the current trace context.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Control/evidence workflow backbone for ISO 42001 coverage reporting.
|
|
3
|
+
*/
|
|
4
|
+
export type WorkflowStatus = 'draft' | 'in_review' | 'approved' | 'expired';
|
|
5
|
+
export interface WorkflowHistoryEntry {
|
|
6
|
+
timestamp: string;
|
|
7
|
+
event: string;
|
|
8
|
+
actor?: string;
|
|
9
|
+
from_status?: WorkflowStatus;
|
|
10
|
+
to_status?: WorkflowStatus;
|
|
11
|
+
note?: string;
|
|
12
|
+
metadata?: Record<string, any>;
|
|
13
|
+
}
|
|
14
|
+
export interface ControlWorkflow {
|
|
15
|
+
workflow_id: string;
|
|
16
|
+
control_id: string;
|
|
17
|
+
title: string;
|
|
18
|
+
status: WorkflowStatus;
|
|
19
|
+
owner?: string;
|
|
20
|
+
created_at: string;
|
|
21
|
+
updated_at: string;
|
|
22
|
+
created_by?: string;
|
|
23
|
+
approved_at?: string;
|
|
24
|
+
approved_by?: string;
|
|
25
|
+
due_at?: string;
|
|
26
|
+
evidence_ids: string[];
|
|
27
|
+
notes?: string;
|
|
28
|
+
metadata?: Record<string, any>;
|
|
29
|
+
history: WorkflowHistoryEntry[];
|
|
30
|
+
}
|
|
31
|
+
export interface ControlCoverageRow {
|
|
32
|
+
control_id: string;
|
|
33
|
+
title: string;
|
|
34
|
+
clause?: string;
|
|
35
|
+
owner?: string;
|
|
36
|
+
frequency?: string;
|
|
37
|
+
required_evidence_types: string[];
|
|
38
|
+
evidence_types_collected: string[];
|
|
39
|
+
missing_evidence_types: string[];
|
|
40
|
+
linked_evidence_ids: string[];
|
|
41
|
+
approved_evidence_ids: string[];
|
|
42
|
+
workflow_ids: string[];
|
|
43
|
+
status: 'covered' | 'partial' | 'gap';
|
|
44
|
+
reportable: boolean;
|
|
45
|
+
gaps: string[];
|
|
46
|
+
}
|
|
47
|
+
interface GenerateCoverageOptions {
|
|
48
|
+
catalog?: Record<string, any> | string | null;
|
|
49
|
+
evidenceItems?: Array<Record<string, any>> | null;
|
|
50
|
+
workflows?: Array<Record<string, any>> | null;
|
|
51
|
+
targetCoverage?: number;
|
|
52
|
+
}
|
|
53
|
+
interface AttachEvidenceOptions {
|
|
54
|
+
controlId: string;
|
|
55
|
+
evidence: Record<string, any>;
|
|
56
|
+
workflowId?: string;
|
|
57
|
+
evidenceType?: string;
|
|
58
|
+
actor?: string;
|
|
59
|
+
note?: string;
|
|
60
|
+
}
|
|
61
|
+
export declare function clearControlRuntime(): void;
|
|
62
|
+
export declare function setControlCatalog(catalog: Record<string, any>): Record<string, any>;
|
|
63
|
+
export declare function loadControlCatalog(filePath: string): Record<string, any>;
|
|
64
|
+
export declare function getControlCatalog(): Record<string, any> | null;
|
|
65
|
+
export declare function loadDefaultIso42001Catalog(): Record<string, any>;
|
|
66
|
+
export declare function resolveControlIdsForEvidenceTypes(evidenceTypes: string[], catalog?: Record<string, any> | null): string[];
|
|
67
|
+
export declare function createWorkflowTask(options: {
|
|
68
|
+
controlId: string;
|
|
69
|
+
title?: string;
|
|
70
|
+
owner?: string;
|
|
71
|
+
dueAt?: string;
|
|
72
|
+
createdBy?: string;
|
|
73
|
+
notes?: string;
|
|
74
|
+
metadata?: Record<string, any>;
|
|
75
|
+
}): ControlWorkflow;
|
|
76
|
+
export declare function getWorkflowTask(workflowId: string): ControlWorkflow | null;
|
|
77
|
+
export declare function listWorkflowTasks(options?: {
|
|
78
|
+
controlId?: string;
|
|
79
|
+
status?: WorkflowStatus;
|
|
80
|
+
}): ControlWorkflow[];
|
|
81
|
+
export declare function transitionWorkflowTask(workflowId: string, options: {
|
|
82
|
+
toStatus: WorkflowStatus;
|
|
83
|
+
actor?: string;
|
|
84
|
+
note?: string;
|
|
85
|
+
}): ControlWorkflow;
|
|
86
|
+
export declare function submitWorkflowTask(workflowId: string, options?: {
|
|
87
|
+
actor?: string;
|
|
88
|
+
note?: string;
|
|
89
|
+
}): ControlWorkflow;
|
|
90
|
+
export declare function approveControlEvidence(workflowId: string, options?: {
|
|
91
|
+
actor?: string;
|
|
92
|
+
note?: string;
|
|
93
|
+
}): ControlWorkflow;
|
|
94
|
+
export declare function expireWorkflowTask(workflowId: string, options?: {
|
|
95
|
+
actor?: string;
|
|
96
|
+
note?: string;
|
|
97
|
+
}): ControlWorkflow;
|
|
98
|
+
export declare function attachControlEvidence(options: AttachEvidenceOptions): Record<string, any>;
|
|
99
|
+
export declare function importEvidenceManifest(manifest: Record<string, any>, options?: {
|
|
100
|
+
clearExisting?: boolean;
|
|
101
|
+
}): number;
|
|
102
|
+
export declare function bootstrapWorkflowsFromCatalog(catalog?: Record<string, any> | null, options?: {
|
|
103
|
+
createdBy?: string;
|
|
104
|
+
ownerFallback?: string;
|
|
105
|
+
}): ControlWorkflow[];
|
|
106
|
+
export declare function prioritizeMissingWorkflowModules(uncoveredControls: string[]): Array<Record<string, any>>;
|
|
107
|
+
export declare function generateControlCoverageReport(options?: GenerateCoverageOptions): Record<string, any>;
|
|
108
|
+
export declare function buildWorkflowStatePayload(options?: {
|
|
109
|
+
catalog?: Record<string, any> | string | null;
|
|
110
|
+
workflows?: Array<Record<string, any>>;
|
|
111
|
+
evidenceItems?: Array<Record<string, any>>;
|
|
112
|
+
}): Record<string, any>;
|
|
113
|
+
export declare function exportWorkflowState(outputPath: string, options?: {
|
|
114
|
+
catalog?: Record<string, any> | string | null;
|
|
115
|
+
workflows?: Array<Record<string, any>>;
|
|
116
|
+
evidenceItems?: Array<Record<string, any>>;
|
|
117
|
+
}): Record<string, any>;
|
|
118
|
+
export declare function loadWorkflowState(filePath: string, options?: {
|
|
119
|
+
replaceRuntime?: boolean;
|
|
120
|
+
}): Record<string, any>;
|
|
121
|
+
export {};
|
|
122
|
+
//# sourceMappingURL=control_backbone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"control_backbone.d.ts","sourceRoot":"","sources":["../src/control_backbone.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,CAAC;AAE5E,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU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