@x12i/memorix-service 3.12.4 → 3.13.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.
- package/README.md +1 -1
- package/dist/anomaly/catalog.d.ts +4 -0
- package/dist/anomaly/catalog.d.ts.map +1 -0
- package/dist/anomaly/catalog.js +315 -0
- package/dist/anomaly/catalog.js.map +1 -0
- package/dist/anomaly/descriptors.d.ts +11 -0
- package/dist/anomaly/descriptors.d.ts.map +1 -0
- package/dist/anomaly/descriptors.js +113 -0
- package/dist/anomaly/descriptors.js.map +1 -0
- package/dist/anomaly/index.d.ts +6 -0
- package/dist/anomaly/index.d.ts.map +1 -0
- package/dist/anomaly/index.js +5 -0
- package/dist/anomaly/index.js.map +1 -0
- package/dist/anomaly/records.d.ts +28 -0
- package/dist/anomaly/records.d.ts.map +1 -0
- package/dist/anomaly/records.js +384 -0
- package/dist/anomaly/records.js.map +1 -0
- package/dist/anomaly/types.d.ts +116 -0
- package/dist/anomaly/types.d.ts.map +1 -0
- package/dist/anomaly/types.js +24 -0
- package/dist/anomaly/types.js.map +1 -0
- package/dist/anomaly/values.d.ts +31 -0
- package/dist/anomaly/values.d.ts.map +1 -0
- package/dist/anomaly/values.js +171 -0
- package/dist/anomaly/values.js.map +1 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +12 -0
- package/dist/app.js.map +1 -1
- package/dist/catalog-bridge.d.ts +18 -0
- package/dist/catalog-bridge.d.ts.map +1 -1
- package/dist/catalog-bridge.js +85 -0
- package/dist/catalog-bridge.js.map +1 -1
- package/dist/errors.d.ts +5 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +18 -0
- package/dist/errors.js.map +1 -1
- package/dist/knowledge-upstream.d.ts +32 -0
- package/dist/knowledge-upstream.d.ts.map +1 -1
- package/dist/knowledge-upstream.js +86 -2
- package/dist/knowledge-upstream.js.map +1 -1
- package/dist/mcp/nexum-tools.d.ts +1 -1
- package/dist/mcp/nexum-tools.d.ts.map +1 -1
- package/dist/mcp/nexum-tools.js +39 -22
- package/dist/mcp/nexum-tools.js.map +1 -1
- package/dist/nexum-analysis/enqueue.d.ts.map +1 -1
- package/dist/nexum-analysis/enqueue.js +2 -1
- package/dist/nexum-analysis/enqueue.js.map +1 -1
- package/dist/nexum-analysis/knowledge-read.d.ts +45 -0
- package/dist/nexum-analysis/knowledge-read.d.ts.map +1 -0
- package/dist/nexum-analysis/knowledge-read.js +26 -0
- package/dist/nexum-analysis/knowledge-read.js.map +1 -0
- package/dist/openapi/openapi.json +18354 -17718
- package/dist/patches/access.d.ts +15 -0
- package/dist/patches/access.d.ts.map +1 -0
- package/dist/patches/access.js +27 -0
- package/dist/patches/access.js.map +1 -0
- package/dist/patches/engine.d.ts +67 -0
- package/dist/patches/engine.d.ts.map +1 -0
- package/dist/patches/engine.js +966 -0
- package/dist/patches/engine.js.map +1 -0
- package/dist/patches/guards.d.ts +23 -0
- package/dist/patches/guards.d.ts.map +1 -0
- package/dist/patches/guards.js +77 -0
- package/dist/patches/guards.js.map +1 -0
- package/dist/patches/legacy-rows.d.ts +56 -0
- package/dist/patches/legacy-rows.d.ts.map +1 -0
- package/dist/patches/legacy-rows.js +162 -0
- package/dist/patches/legacy-rows.js.map +1 -0
- package/dist/patches/ops.d.ts +24 -0
- package/dist/patches/ops.d.ts.map +1 -0
- package/dist/patches/ops.js +204 -0
- package/dist/patches/ops.js.map +1 -0
- package/dist/patches/parse.d.ts +5 -0
- package/dist/patches/parse.d.ts.map +1 -0
- package/dist/patches/parse.js +323 -0
- package/dist/patches/parse.js.map +1 -0
- package/dist/patches/paths.d.ts +38 -0
- package/dist/patches/paths.d.ts.map +1 -0
- package/dist/patches/paths.js +204 -0
- package/dist/patches/paths.js.map +1 -0
- package/dist/patches/service.d.ts +16 -0
- package/dist/patches/service.d.ts.map +1 -0
- package/dist/patches/service.js +128 -0
- package/dist/patches/service.js.map +1 -0
- package/dist/patches/store.d.ts +87 -0
- package/dist/patches/store.d.ts.map +1 -0
- package/dist/patches/store.js +27 -0
- package/dist/patches/store.js.map +1 -0
- package/dist/patches/types.d.ts +112 -0
- package/dist/patches/types.d.ts.map +1 -0
- package/dist/patches/types.js +5 -0
- package/dist/patches/types.js.map +1 -0
- package/dist/platform.d.ts +8 -0
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +98 -4
- package/dist/platform.js.map +1 -1
- package/dist/routes/anomaly.d.ts +5 -0
- package/dist/routes/anomaly.d.ts.map +1 -0
- package/dist/routes/anomaly.js +308 -0
- package/dist/routes/anomaly.js.map +1 -0
- package/dist/routes/data.d.ts.map +1 -1
- package/dist/routes/data.js +190 -202
- package/dist/routes/data.js.map +1 -1
- package/dist/routes/knowledge.d.ts.map +1 -1
- package/dist/routes/knowledge.js +6 -22
- package/dist/routes/knowledge.js.map +1 -1
- package/dist/routes/metadata.d.ts.map +1 -1
- package/dist/routes/metadata.js +28 -1
- package/dist/routes/metadata.js.map +1 -1
- package/dist/routes/patches.d.ts +7 -0
- package/dist/routes/patches.d.ts.map +1 -0
- package/dist/routes/patches.js +111 -0
- package/dist/routes/patches.js.map +1 -0
- package/dist/routes/subject-roots-backfill.d.ts +4 -0
- package/dist/routes/subject-roots-backfill.d.ts.map +1 -0
- package/dist/routes/subject-roots-backfill.js +15 -0
- package/dist/routes/subject-roots-backfill.js.map +1 -0
- package/dist/single-read-discriminator.d.ts +17 -0
- package/dist/single-read-discriminator.d.ts.map +1 -0
- package/dist/single-read-discriminator.js +67 -0
- package/dist/single-read-discriminator.js.map +1 -0
- package/dist/subject-roots-backfill.d.ts +24 -0
- package/dist/subject-roots-backfill.d.ts.map +1 -0
- package/dist/subject-roots-backfill.js +133 -0
- package/dist/subject-roots-backfill.js.map +1 -0
- package/dist/write-precondition.d.ts +5 -1
- package/dist/write-precondition.d.ts.map +1 -1
- package/dist/write-precondition.js +11 -3
- package/dist/write-precondition.js.map +1 -1
- package/dist/writes/content-write.d.ts +170 -0
- package/dist/writes/content-write.d.ts.map +1 -0
- package/dist/writes/content-write.js +569 -0
- package/dist/writes/content-write.js.map +1 -0
- package/dist/writes/effects.d.ts +13 -0
- package/dist/writes/effects.d.ts.map +1 -0
- package/dist/writes/effects.js +28 -0
- package/dist/writes/effects.js.map +1 -0
- package/dist/writes/error-shape.d.ts +11 -0
- package/dist/writes/error-shape.d.ts.map +1 -0
- package/dist/writes/error-shape.js +100 -0
- package/dist/writes/error-shape.js.map +1 -0
- package/dist/writes/receipt-store.d.ts +81 -0
- package/dist/writes/receipt-store.d.ts.map +1 -0
- package/dist/writes/receipt-store.js +171 -0
- package/dist/writes/receipt-store.js.map +1 -0
- package/dist/writes/worker.d.ts +9 -0
- package/dist/writes/worker.d.ts.map +1 -0
- package/dist/writes/worker.js +20 -0
- package/dist/writes/worker.js.map +1 -0
- package/openapi/openapi.json +18354 -17718
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -163,7 +163,7 @@ curl -s http://127.0.0.1:5100/api/diagnostics/scope \
|
|
|
163
163
|
| `/api/pipelines` | Definitions, start, runs, retry/resume |
|
|
164
164
|
| `/api/operations` | Operational helpers |
|
|
165
165
|
| `/api/workflow` | Workflow sibling content |
|
|
166
|
-
| `/api/intelligence` | Profiles / proposals (never auto-install) |
|
|
166
|
+
| `/api/intelligence` | Profiles / proposals (never auto-install). Anomaly tools: `GET /api/intelligence/anomalies/tools`, `POST .../records`, `.../object-types`, `.../content-types` |
|
|
167
167
|
| `/api/data-journey` | Evidence cone + expected-vs-filled coverage |
|
|
168
168
|
| `/api/ai-services` | Companion AI-services (function / skill / task / graph) — list, items, invoke proxy |
|
|
169
169
|
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AnomalyDetectOptions, AnomalyRecord, AnomalyReport, ContentTypeAnomalyItem, ObjectTypeAnomalyItem, ObjectTypeDescriptor } from "./types.js";
|
|
2
|
+
export declare function detectObjectTypeAnomalies(descriptors: ObjectTypeDescriptor[], records: AnomalyRecord[] | null, options?: AnomalyDetectOptions): AnomalyReport<ObjectTypeAnomalyItem>;
|
|
3
|
+
export declare function detectContentTypeAnomalies(descriptors: ObjectTypeDescriptor[], records: AnomalyRecord[] | null, options?: AnomalyDetectOptions): AnomalyReport<ContentTypeAnomalyItem>;
|
|
4
|
+
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/anomaly/catalog.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EAEpB,aAAa,EACb,aAAa,EACb,sBAAsB,EAGtB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAkRpB,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,oBAAoB,EAAE,EACnC,OAAO,EAAE,aAAa,EAAE,GAAG,IAAI,EAC/B,OAAO,CAAC,EAAE,oBAAoB,GAC7B,aAAa,CAAC,qBAAqB,CAAC,CAkDtC;AAuID,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,oBAAoB,EAAE,EACnC,OAAO,EAAE,aAAa,EAAE,GAAG,IAAI,EAC/B,OAAO,CAAC,EAAE,oBAAoB,GAC7B,aAAa,CAAC,sBAAsB,CAAC,CA+CvC"}
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { classifyRecords, driftBy } from "./records.js";
|
|
2
|
+
import { DATA_CATEGORIES, finding, isCountOutlier, majority, topCodes, } from "./values.js";
|
|
3
|
+
const DRIFT_RATE = 0.34;
|
|
4
|
+
const PEER_SHARE = 0.75;
|
|
5
|
+
function wants(options, check) {
|
|
6
|
+
const checks = options?.checks ?? ["descriptor", "peer"];
|
|
7
|
+
return checks.includes(check);
|
|
8
|
+
}
|
|
9
|
+
function uniqueObjectTypes(descriptors) {
|
|
10
|
+
const seen = new Set();
|
|
11
|
+
const out = [];
|
|
12
|
+
for (const objectType of descriptors) {
|
|
13
|
+
if (seen.has(objectType.id))
|
|
14
|
+
continue;
|
|
15
|
+
seen.add(objectType.id);
|
|
16
|
+
out.push(objectType);
|
|
17
|
+
}
|
|
18
|
+
return out;
|
|
19
|
+
}
|
|
20
|
+
function fieldKey(field) {
|
|
21
|
+
return `${field.contentType ?? "*"}:${field.path}`;
|
|
22
|
+
}
|
|
23
|
+
function declarationFindings(objectType, all) {
|
|
24
|
+
const findings = [];
|
|
25
|
+
const where = { objectType: objectType.id };
|
|
26
|
+
if (!DATA_CATEGORIES.has(objectType.dataCategory)) {
|
|
27
|
+
findings.push(finding("descriptor", "OT_CATEGORY", `Object type "${objectType.id}" dataCategory "${objectType.dataCategory || "(empty)"}" is not entity, event, or knowledge.`, { ...where, actual: objectType.dataCategory }));
|
|
28
|
+
}
|
|
29
|
+
if (objectType.contentTypes.length === 0) {
|
|
30
|
+
findings.push(finding("descriptor", "OT_CONTENT_TYPES_EMPTY", `Object type "${objectType.id}" declares no content types.`, where));
|
|
31
|
+
}
|
|
32
|
+
const ids = objectType.contentTypes.map((ct) => ct.id);
|
|
33
|
+
const dupes = ids.filter((id, index) => ids.indexOf(id) !== index);
|
|
34
|
+
for (const id of [...new Set(dupes)]) {
|
|
35
|
+
findings.push(finding("descriptor", "OT_DUPLICATE_CONTENT_TYPE", `Object type "${objectType.id}" declares content type "${id}" more than once.`, { ...where, contentType: id }));
|
|
36
|
+
}
|
|
37
|
+
const leading = objectType.contentTypes.filter((ct) => ct.leading);
|
|
38
|
+
if (leading.length > 1) {
|
|
39
|
+
findings.push(finding("descriptor", "OT_LEADING_MULTIPLE", `Object type "${objectType.id}" has more than one leading content type.`, { ...where, actual: leading.map((ct) => ct.id) }));
|
|
40
|
+
}
|
|
41
|
+
const declared = new Set(ids);
|
|
42
|
+
for (const contentType of objectType.contentTypes) {
|
|
43
|
+
if (contentType.allowSnapshotBuckets === undefined) {
|
|
44
|
+
findings.push(finding("descriptor", "CT_PROFILE_MISSING", `Content type "${contentType.id}" on "${objectType.id}" does not declare allowSnapshotBuckets.`, { ...where, contentType: contentType.id }));
|
|
45
|
+
}
|
|
46
|
+
if (contentType.required && !contentType.requiredReason) {
|
|
47
|
+
findings.push(finding("descriptor", "CT_REQUIRED_REASON", `Content type "${contentType.id}" is required on "${objectType.id}" without a requiredReason.`, { ...where, contentType: contentType.id }));
|
|
48
|
+
}
|
|
49
|
+
if (contentType.discriminator && !contentType.discriminator.path) {
|
|
50
|
+
findings.push(finding("descriptor", "CT_DISCRIMINATOR_PATH", `Content type "${contentType.id}" on "${objectType.id}" sets a discriminator without a path.`, { ...where, contentType: contentType.id }));
|
|
51
|
+
}
|
|
52
|
+
if (contentType.allowSnapshotBuckets === undefined)
|
|
53
|
+
continue;
|
|
54
|
+
const others = all.filter((ot) => ot.id !== objectType.id);
|
|
55
|
+
for (const other of others) {
|
|
56
|
+
const match = other.contentTypes.find((ct) => ct.id === contentType.id);
|
|
57
|
+
if (!match || match.allowSnapshotBuckets === undefined)
|
|
58
|
+
continue;
|
|
59
|
+
if (match.allowSnapshotBuckets === contentType.allowSnapshotBuckets)
|
|
60
|
+
continue;
|
|
61
|
+
findings.push(finding("descriptor", "CT_PROFILE_CONFLICT", `Content type "${contentType.id}" allows snapshot buckets on "${objectType.id}" (${String(contentType.allowSnapshotBuckets)}) and not the same way on "${other.id}" (${String(match.allowSnapshotBuckets)}).`, {
|
|
62
|
+
...where,
|
|
63
|
+
contentType: contentType.id,
|
|
64
|
+
expected: match.allowSnapshotBuckets,
|
|
65
|
+
actual: contentType.allowSnapshotBuckets,
|
|
66
|
+
}));
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const seenFields = new Map();
|
|
71
|
+
for (const field of objectType.fields) {
|
|
72
|
+
if (field.contentType && !declared.has(field.contentType)) {
|
|
73
|
+
findings.push(finding("descriptor", "OT_FIELD_CONTENT_TYPE", `Field ${field.path} on "${objectType.id}" names content type "${field.contentType}", which is not declared there.`, { ...where, path: field.path, contentType: field.contentType }));
|
|
74
|
+
}
|
|
75
|
+
if (field.enum && field.enum.length === 0) {
|
|
76
|
+
findings.push(finding("descriptor", "OT_ENUM_EMPTY", `Field ${field.path} on "${objectType.id}" declares an empty vocabulary.`, { ...where, path: field.path }));
|
|
77
|
+
}
|
|
78
|
+
const previous = seenFields.get(fieldKey(field));
|
|
79
|
+
if (previous && (previous.valueType !== field.valueType || enumText(previous) !== enumText(field))) {
|
|
80
|
+
findings.push(finding("descriptor", "OT_FIELD_CONFLICT", `Field ${field.path} is declared more than once on "${objectType.id}" with different descriptors.`, {
|
|
81
|
+
...where,
|
|
82
|
+
path: field.path,
|
|
83
|
+
...(field.contentType ? { contentType: field.contentType } : {}),
|
|
84
|
+
expected: previous.valueType,
|
|
85
|
+
actual: field.valueType,
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
else if (!previous) {
|
|
89
|
+
seenFields.set(fieldKey(field), field);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return findings;
|
|
93
|
+
}
|
|
94
|
+
function enumText(field) {
|
|
95
|
+
return (field.enum ?? []).join("\0");
|
|
96
|
+
}
|
|
97
|
+
function peerObjectTypeFindings(objectType, all) {
|
|
98
|
+
const others = all.filter((ot) => ot.id !== objectType.id);
|
|
99
|
+
if (others.length < 3)
|
|
100
|
+
return [];
|
|
101
|
+
const findings = [];
|
|
102
|
+
const categories = majority(others.map((ot) => ot.dataCategory).filter(Boolean));
|
|
103
|
+
if (categories && categories.share >= PEER_SHARE && objectType.dataCategory !== categories.value) {
|
|
104
|
+
findings.push(finding("peer", "PEER_CATEGORY", `Object type "${objectType.id}" is ${objectType.dataCategory || "unspecified"}; ${Math.round(categories.share * 100)}% of the other object types are ${categories.value}.`, { objectType: objectType.id, expected: categories.value, actual: objectType.dataCategory }));
|
|
105
|
+
}
|
|
106
|
+
const withFields = others.filter((ot) => ot.fields.length > 0).length / others.length;
|
|
107
|
+
const hasFields = objectType.fields.length > 0;
|
|
108
|
+
if ((withFields >= PEER_SHARE && !hasFields) || (withFields <= 1 - PEER_SHARE && hasFields)) {
|
|
109
|
+
findings.push(finding("peer", "PEER_FIELDS", hasFields
|
|
110
|
+
? `Object type "${objectType.id}" declares fields; most other object types do not.`
|
|
111
|
+
: `Object type "${objectType.id}" declares no fields; most other object types do.`, { objectType: objectType.id, actual: objectType.fields.length }));
|
|
112
|
+
}
|
|
113
|
+
if (isCountOutlier(objectType.contentTypes.length, others.map((ot) => ot.contentTypes.length))) {
|
|
114
|
+
findings.push(finding("peer", "PEER_CONTENT_TYPE_COUNT", `Object type "${objectType.id}" declares ${objectType.contentTypes.length} content types, unlike the common object types.`, { objectType: objectType.id, actual: objectType.contentTypes.length }));
|
|
115
|
+
}
|
|
116
|
+
return findings;
|
|
117
|
+
}
|
|
118
|
+
function driftFindings(label, bucket, minCohort, checks, scope) {
|
|
119
|
+
if (!bucket || bucket.scanned < minCohort)
|
|
120
|
+
return [];
|
|
121
|
+
const findings = [];
|
|
122
|
+
if (checks.descriptor && bucket.descriptorAnomalies / bucket.scanned >= DRIFT_RATE) {
|
|
123
|
+
findings.push(finding("descriptor", "RECORD_DRIFT", `${bucket.descriptorAnomalies} of ${bucket.scanned} scanned records on ${label} do not match their descriptors.`, { ...scope, actual: topCodes(bucket.descriptorFindings) }));
|
|
124
|
+
}
|
|
125
|
+
if (checks.peer && bucket.peerAnomalies / bucket.scanned >= DRIFT_RATE) {
|
|
126
|
+
findings.push(finding("peer", "RECORD_SPREAD", `${bucket.peerAnomalies} of ${bucket.scanned} scanned records on ${label} differ from the common records.`, { ...scope, actual: topCodes(bucket.peerFindings) }));
|
|
127
|
+
}
|
|
128
|
+
return findings;
|
|
129
|
+
}
|
|
130
|
+
function duplicateFindings(descriptors) {
|
|
131
|
+
const counts = new Map();
|
|
132
|
+
for (const objectType of descriptors)
|
|
133
|
+
counts.set(objectType.id, (counts.get(objectType.id) ?? 0) + 1);
|
|
134
|
+
const findings = new Map();
|
|
135
|
+
for (const [id, count] of counts) {
|
|
136
|
+
if (count < 2)
|
|
137
|
+
continue;
|
|
138
|
+
findings.set(id, finding("descriptor", "OT_DUPLICATE", `Object type "${id}" is declared ${count} times in the effective descriptors.`, { objectType: id, actual: count }));
|
|
139
|
+
}
|
|
140
|
+
return findings;
|
|
141
|
+
}
|
|
142
|
+
export function detectObjectTypeAnomalies(descriptors, records, options) {
|
|
143
|
+
const unique = uniqueObjectTypes(descriptors);
|
|
144
|
+
const duplicates = duplicateFindings(descriptors);
|
|
145
|
+
const rows = records ? classifyRecords(unique, records, options) : [];
|
|
146
|
+
const drift = driftBy(rows, (record) => record.objectType);
|
|
147
|
+
const minCohort = options?.minCohort ?? 4;
|
|
148
|
+
const descriptorOn = wants(options, "descriptor");
|
|
149
|
+
const peerOn = wants(options, "peer");
|
|
150
|
+
const items = [];
|
|
151
|
+
for (const objectType of unique) {
|
|
152
|
+
const findings = [];
|
|
153
|
+
if (descriptorOn) {
|
|
154
|
+
const duplicate = duplicates.get(objectType.id);
|
|
155
|
+
if (duplicate)
|
|
156
|
+
findings.push(duplicate);
|
|
157
|
+
findings.push(...declarationFindings(objectType, unique));
|
|
158
|
+
findings.push(...driftFindings(`object type "${objectType.id}"`, drift.get(objectType.id), minCohort, {
|
|
159
|
+
descriptor: true,
|
|
160
|
+
peer: false,
|
|
161
|
+
}, { objectType: objectType.id }));
|
|
162
|
+
}
|
|
163
|
+
if (peerOn) {
|
|
164
|
+
findings.push(...peerObjectTypeFindings(objectType, unique));
|
|
165
|
+
findings.push(...driftFindings(`object type "${objectType.id}"`, drift.get(objectType.id), minCohort, {
|
|
166
|
+
descriptor: false,
|
|
167
|
+
peer: true,
|
|
168
|
+
}, { objectType: objectType.id }));
|
|
169
|
+
}
|
|
170
|
+
if (findings.length === 0)
|
|
171
|
+
continue;
|
|
172
|
+
items.push({
|
|
173
|
+
objectType: objectType.id,
|
|
174
|
+
name: objectType.name,
|
|
175
|
+
dataCategory: objectType.dataCategory,
|
|
176
|
+
findings,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
items.sort((a, b) => b.findings.length - a.findings.length || a.objectType.localeCompare(b.objectType));
|
|
180
|
+
const limit = options?.limit ?? 100;
|
|
181
|
+
return {
|
|
182
|
+
scannedRecords: records ? records.length : null,
|
|
183
|
+
truncated: Boolean(options?.truncated),
|
|
184
|
+
limited: items.length > limit,
|
|
185
|
+
anomalous: items.length,
|
|
186
|
+
items: items.slice(0, limit),
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function contentTypeUses(objectTypes) {
|
|
190
|
+
const byId = new Map();
|
|
191
|
+
for (const objectType of objectTypes) {
|
|
192
|
+
for (const contentType of objectType.contentTypes) {
|
|
193
|
+
let use = byId.get(contentType.id);
|
|
194
|
+
if (!use) {
|
|
195
|
+
use = { id: contentType.id, objectTypes: [], declarations: [], fields: [] };
|
|
196
|
+
byId.set(contentType.id, use);
|
|
197
|
+
}
|
|
198
|
+
if (!use.objectTypes.includes(objectType.id))
|
|
199
|
+
use.objectTypes.push(objectType.id);
|
|
200
|
+
use.declarations.push({ objectType: objectType.id, contentType });
|
|
201
|
+
}
|
|
202
|
+
for (const field of objectType.fields) {
|
|
203
|
+
const targets = field.contentType
|
|
204
|
+
? [field.contentType]
|
|
205
|
+
: objectType.contentTypes.map((ct) => ct.id);
|
|
206
|
+
for (const contentTypeId of targets) {
|
|
207
|
+
const use = byId.get(contentTypeId);
|
|
208
|
+
if (!use)
|
|
209
|
+
continue;
|
|
210
|
+
use.fields.push({ objectType: objectType.id, field });
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return [...byId.values()].sort((a, b) => a.id.localeCompare(b.id));
|
|
215
|
+
}
|
|
216
|
+
function contentTypeDescriptorFindings(use) {
|
|
217
|
+
const findings = [];
|
|
218
|
+
const flags = new Map();
|
|
219
|
+
for (const decl of use.declarations) {
|
|
220
|
+
if (decl.contentType.allowSnapshotBuckets === undefined) {
|
|
221
|
+
findings.push(finding("descriptor", "CT_PROFILE_MISSING", `Content type "${use.id}" on "${decl.objectType}" does not declare allowSnapshotBuckets.`, { contentType: use.id, objectType: decl.objectType }));
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
const key = String(decl.contentType.allowSnapshotBuckets);
|
|
225
|
+
const hosts = flags.get(key) ?? [];
|
|
226
|
+
hosts.push(decl.objectType);
|
|
227
|
+
flags.set(key, hosts);
|
|
228
|
+
}
|
|
229
|
+
if (flags.size > 1) {
|
|
230
|
+
findings.push(finding("descriptor", "CT_PROFILE_CONFLICT", `Content type "${use.id}" does not declare allowSnapshotBuckets the same way on every object type.`, { contentType: use.id, actual: Object.fromEntries(flags) }));
|
|
231
|
+
}
|
|
232
|
+
const paths = new Set(use.declarations
|
|
233
|
+
.map((decl) => decl.contentType.discriminator?.path)
|
|
234
|
+
.filter((path) => Boolean(path)));
|
|
235
|
+
if (paths.size > 1) {
|
|
236
|
+
findings.push(finding("descriptor", "CT_DISCRIMINATOR_CONFLICT", `Content type "${use.id}" uses different discriminator paths across object types.`, { contentType: use.id, actual: [...paths] }));
|
|
237
|
+
}
|
|
238
|
+
const byPath = new Map();
|
|
239
|
+
for (const { objectType, field } of use.fields) {
|
|
240
|
+
const previous = byPath.get(field.path);
|
|
241
|
+
if (previous && previous.valueType !== field.valueType) {
|
|
242
|
+
findings.push(finding("descriptor", "CT_FIELD_CONFLICT", `Field ${field.path} on content type "${use.id}" is ${previous.valueType} on "${previous.objectType}" and ${field.valueType} on "${objectType}".`, {
|
|
243
|
+
contentType: use.id,
|
|
244
|
+
path: field.path,
|
|
245
|
+
expected: previous.valueType,
|
|
246
|
+
actual: field.valueType,
|
|
247
|
+
}));
|
|
248
|
+
}
|
|
249
|
+
else if (!previous) {
|
|
250
|
+
byPath.set(field.path, { valueType: field.valueType, objectType });
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return findings;
|
|
254
|
+
}
|
|
255
|
+
function peerContentTypeFindings(use, all) {
|
|
256
|
+
const others = all.filter((item) => item.id !== use.id);
|
|
257
|
+
if (others.length < 3)
|
|
258
|
+
return [];
|
|
259
|
+
const findings = [];
|
|
260
|
+
if (isCountOutlier(use.objectTypes.length, others.map((item) => item.objectTypes.length))) {
|
|
261
|
+
findings.push(finding("peer", "PEER_HOST_COUNT", `Content type "${use.id}" is declared on ${use.objectTypes.length} object types, unlike the common content types.`, { contentType: use.id, actual: use.objectTypes.length }));
|
|
262
|
+
}
|
|
263
|
+
const withFields = others.filter((item) => item.fields.length > 0).length / others.length;
|
|
264
|
+
const hasFields = use.fields.length > 0;
|
|
265
|
+
if ((withFields >= PEER_SHARE && !hasFields) || (withFields <= 1 - PEER_SHARE && hasFields)) {
|
|
266
|
+
findings.push(finding("peer", "PEER_FIELDS", hasFields
|
|
267
|
+
? `Content type "${use.id}" has field descriptors; most other content types do not.`
|
|
268
|
+
: `Content type "${use.id}" has no field descriptors; most other content types do.`, { contentType: use.id, actual: use.fields.length }));
|
|
269
|
+
}
|
|
270
|
+
return findings;
|
|
271
|
+
}
|
|
272
|
+
export function detectContentTypeAnomalies(descriptors, records, options) {
|
|
273
|
+
const unique = uniqueObjectTypes(descriptors);
|
|
274
|
+
const uses = contentTypeUses(unique);
|
|
275
|
+
const rows = records ? classifyRecords(unique, records, options) : [];
|
|
276
|
+
const drift = driftBy(rows, (record) => record.contentType);
|
|
277
|
+
const minCohort = options?.minCohort ?? 4;
|
|
278
|
+
const descriptorOn = wants(options, "descriptor");
|
|
279
|
+
const peerOn = wants(options, "peer");
|
|
280
|
+
const items = [];
|
|
281
|
+
for (const use of uses) {
|
|
282
|
+
const findings = [];
|
|
283
|
+
if (descriptorOn) {
|
|
284
|
+
findings.push(...contentTypeDescriptorFindings(use));
|
|
285
|
+
findings.push(...driftFindings(`content type "${use.id}"`, drift.get(use.id), minCohort, {
|
|
286
|
+
descriptor: true,
|
|
287
|
+
peer: false,
|
|
288
|
+
}, { contentType: use.id }));
|
|
289
|
+
}
|
|
290
|
+
if (peerOn) {
|
|
291
|
+
findings.push(...peerContentTypeFindings(use, uses));
|
|
292
|
+
findings.push(...driftFindings(`content type "${use.id}"`, drift.get(use.id), minCohort, {
|
|
293
|
+
descriptor: false,
|
|
294
|
+
peer: true,
|
|
295
|
+
}, { contentType: use.id }));
|
|
296
|
+
}
|
|
297
|
+
if (findings.length === 0)
|
|
298
|
+
continue;
|
|
299
|
+
items.push({
|
|
300
|
+
contentType: use.id,
|
|
301
|
+
objectTypes: [...use.objectTypes].sort((a, b) => a.localeCompare(b)),
|
|
302
|
+
findings,
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
items.sort((a, b) => b.findings.length - a.findings.length || a.contentType.localeCompare(b.contentType));
|
|
306
|
+
const limit = options?.limit ?? 100;
|
|
307
|
+
return {
|
|
308
|
+
scannedRecords: records ? records.length : null,
|
|
309
|
+
truncated: Boolean(options?.truncated),
|
|
310
|
+
limited: items.length > limit,
|
|
311
|
+
anomalous: items.length,
|
|
312
|
+
items: items.slice(0, limit),
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
//# sourceMappingURL=catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/anomaly/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAoB,MAAM,cAAc,CAAC;AAY1E,OAAO,EACL,eAAe,EACf,OAAO,EACP,cAAc,EACd,QAAQ,EACR,QAAQ,GACT,MAAM,aAAa,CAAC;AAErB,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,UAAU,GAAG,IAAI,CAAC;AAExB,SAAS,KAAK,CAAC,OAAyC,EAAE,KAA4B;IACpF,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IACzD,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAED,SAAS,iBAAiB,CAAC,WAAmC;IAC5D,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,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IAAI,GAAG,CAAC;IACpC,OAAO;QACL,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI;QAC/C,SAAS,EAAE,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC;QACtC,OAAO,EAAE,KAAK,CAAC,MAAM,GAAG,KAAK;QAC7B,SAAS,EAAE,KAAK,CAAC,MAAM;QACvB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC;KAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ContentTypeDescriptor, FieldDescriptor, ObjectTypeDescriptor } from "./types.js";
|
|
2
|
+
type EffectiveEntry = {
|
|
3
|
+
kind?: string;
|
|
4
|
+
id?: string;
|
|
5
|
+
definition?: unknown;
|
|
6
|
+
};
|
|
7
|
+
export declare function objectTypesFromEffective(entries: EffectiveEntry[]): ObjectTypeDescriptor[];
|
|
8
|
+
export declare function fieldsFor(objectType: ObjectTypeDescriptor, contentType: string): FieldDescriptor[];
|
|
9
|
+
export declare function contentTypeOf(objectType: ObjectTypeDescriptor, contentType: string): ContentTypeDescriptor | undefined;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=descriptors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptors.d.ts","sourceRoot":"","sources":["../../src/anomaly/descriptors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EACf,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAEpB,KAAK,cAAc,GAAG;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAoGF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,oBAAoB,EAAE,CAO1F;AAED,wBAAgB,SAAS,CACvB,UAAU,EAAE,oBAAoB,EAChC,WAAW,EAAE,MAAM,GAClB,eAAe,EAAE,CAEnB;AAED,wBAAgB,aAAa,CAC3B,UAAU,EAAE,oBAAoB,EAChC,WAAW,EAAE,MAAM,GAClB,qBAAqB,GAAG,SAAS,CAEnC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
function text(value) {
|
|
2
|
+
return typeof value === "string" ? value.trim() : "";
|
|
3
|
+
}
|
|
4
|
+
function parseContentType(raw) {
|
|
5
|
+
if (typeof raw === "string") {
|
|
6
|
+
const id = raw.trim();
|
|
7
|
+
if (!id)
|
|
8
|
+
return null;
|
|
9
|
+
return { id, required: false, leading: false };
|
|
10
|
+
}
|
|
11
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw))
|
|
12
|
+
return null;
|
|
13
|
+
const body = raw;
|
|
14
|
+
const id = text(body.id);
|
|
15
|
+
if (!id)
|
|
16
|
+
return null;
|
|
17
|
+
const profile = body.profile;
|
|
18
|
+
const allow = profile && typeof profile === "object" && !Array.isArray(profile)
|
|
19
|
+
? profile.allowSnapshotBuckets
|
|
20
|
+
: undefined;
|
|
21
|
+
const disc = body.discriminator;
|
|
22
|
+
let discriminator;
|
|
23
|
+
if (disc && typeof disc === "object" && !Array.isArray(disc)) {
|
|
24
|
+
const d = disc;
|
|
25
|
+
const path = text(d.path);
|
|
26
|
+
const defaultValue = text(d.defaultValue);
|
|
27
|
+
discriminator = {
|
|
28
|
+
...(path ? { path } : {}),
|
|
29
|
+
required: d.required === true,
|
|
30
|
+
...(defaultValue ? { defaultValue } : {}),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const reason = text(body.requiredReason);
|
|
34
|
+
return {
|
|
35
|
+
id,
|
|
36
|
+
...(typeof allow === "boolean" ? { allowSnapshotBuckets: allow } : {}),
|
|
37
|
+
required: body.required === true,
|
|
38
|
+
...(reason ? { requiredReason: reason } : {}),
|
|
39
|
+
leading: body.leading === true,
|
|
40
|
+
...(discriminator ? { discriminator } : {}),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function parseField(raw) {
|
|
44
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw))
|
|
45
|
+
return null;
|
|
46
|
+
const body = raw;
|
|
47
|
+
const path = text(body.path);
|
|
48
|
+
if (!path)
|
|
49
|
+
return null;
|
|
50
|
+
const valueType = text(body.valueType) || "string";
|
|
51
|
+
const contentType = text(body.contentType);
|
|
52
|
+
const enumValues = Array.isArray(body.enum)
|
|
53
|
+
? body.enum.filter((item) => typeof item === "string")
|
|
54
|
+
: undefined;
|
|
55
|
+
const refers = body.refersTo;
|
|
56
|
+
const refersTo = refers && typeof refers === "object" && !Array.isArray(refers)
|
|
57
|
+
? text(refers.objectType)
|
|
58
|
+
: "";
|
|
59
|
+
const gate = body.when;
|
|
60
|
+
const when = gate && typeof gate === "object" && !Array.isArray(gate)
|
|
61
|
+
? {
|
|
62
|
+
path: text(gate.path),
|
|
63
|
+
equals: typeof gate.equals === "string" ? gate.equals : "",
|
|
64
|
+
}
|
|
65
|
+
: undefined;
|
|
66
|
+
return {
|
|
67
|
+
path,
|
|
68
|
+
valueType,
|
|
69
|
+
...(contentType ? { contentType } : {}),
|
|
70
|
+
...(enumValues ? { enum: enumValues } : {}),
|
|
71
|
+
...(when?.path && when.equals ? { when: { path: when.path, equals: when.equals } } : {}),
|
|
72
|
+
...(refersTo ? { refersTo: { objectType: refersTo } } : {}),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function parseObjectType(entry) {
|
|
76
|
+
if (entry.kind !== "object-types")
|
|
77
|
+
return null;
|
|
78
|
+
const def = entry.definition && typeof entry.definition === "object" && !Array.isArray(entry.definition)
|
|
79
|
+
? entry.definition
|
|
80
|
+
: {};
|
|
81
|
+
const id = text(def.id) || text(entry.id);
|
|
82
|
+
if (!id)
|
|
83
|
+
return null;
|
|
84
|
+
const contentTypes = Array.isArray(def.contentTypes)
|
|
85
|
+
? def.contentTypes.map(parseContentType).filter((ct) => !!ct)
|
|
86
|
+
: [];
|
|
87
|
+
const fields = Array.isArray(def.fields)
|
|
88
|
+
? def.fields.map(parseField).filter((field) => !!field)
|
|
89
|
+
: [];
|
|
90
|
+
return {
|
|
91
|
+
id,
|
|
92
|
+
name: text(def.name) || id,
|
|
93
|
+
dataCategory: text(def.dataCategory),
|
|
94
|
+
contentTypes,
|
|
95
|
+
fields,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export function objectTypesFromEffective(entries) {
|
|
99
|
+
const out = [];
|
|
100
|
+
for (const entry of entries) {
|
|
101
|
+
const parsed = parseObjectType(entry);
|
|
102
|
+
if (parsed)
|
|
103
|
+
out.push(parsed);
|
|
104
|
+
}
|
|
105
|
+
return out;
|
|
106
|
+
}
|
|
107
|
+
export function fieldsFor(objectType, contentType) {
|
|
108
|
+
return objectType.fields.filter((field) => !field.contentType || field.contentType === contentType);
|
|
109
|
+
}
|
|
110
|
+
export function contentTypeOf(objectType, contentType) {
|
|
111
|
+
return objectType.contentTypes.find((ct) => ct.id === contentType);
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=descriptors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptors.js","sourceRoot":"","sources":["../../src/anomaly/descriptors.ts"],"names":[],"mappings":"AAYA,SAAS,IAAI,CAAC,KAAc;IAC1B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACvD,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAY;IACpC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,EAAE,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;QACtB,IAAI,CAAC,EAAE;YAAE,OAAO,IAAI,CAAC;QACrB,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,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YAAE,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,UAAU,SAAS,CACvB,UAAgC,EAChC,WAAmB;IAEnB,OAAO,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,WAAW,KAAK,WAAW,CAAC,CAAC;AACtG,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,UAAgC,EAChC,WAAmB;IAEnB,OAAO,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,WAAW,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { AnomalyCheck, AnomalyDetectOptions, AnomalyFinding, AnomalyRecord, AnomalyReport, ContentTypeAnomalyItem, ContentTypeDescriptor, FieldDescriptor, ObjectTypeAnomalyItem, ObjectTypeDescriptor, RecordAnomalyItem, } from "./types.js";
|
|
2
|
+
export { ANOMALY_TOOLS } from "./types.js";
|
|
3
|
+
export { objectTypesFromEffective } from "./descriptors.js";
|
|
4
|
+
export { classifyRecords, detectRecordAnomalies } from "./records.js";
|
|
5
|
+
export { detectContentTypeAnomalies, detectObjectTypeAnomalies } from "./catalog.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/anomaly/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,aAAa,EACb,aAAa,EACb,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ANOMALY_TOOLS } from "./types.js";
|
|
2
|
+
export { objectTypesFromEffective } from "./descriptors.js";
|
|
3
|
+
export { classifyRecords, detectRecordAnomalies } from "./records.js";
|
|
4
|
+
export { detectContentTypeAnomalies, detectObjectTypeAnomalies } from "./catalog.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/anomaly/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AnomalyDetectOptions, AnomalyFinding, AnomalyRecord, AnomalyReport, ObjectTypeDescriptor, RecordAnomalyItem } from "./types.js";
|
|
2
|
+
type NormalizedRecord = {
|
|
3
|
+
recordId: string;
|
|
4
|
+
objectType: string;
|
|
5
|
+
contentType: string;
|
|
6
|
+
data: unknown;
|
|
7
|
+
analytics?: unknown;
|
|
8
|
+
enrichment?: unknown;
|
|
9
|
+
insights?: unknown;
|
|
10
|
+
};
|
|
11
|
+
type Classified = {
|
|
12
|
+
record: NormalizedRecord;
|
|
13
|
+
descriptor: AnomalyFinding[];
|
|
14
|
+
peer: AnomalyFinding[];
|
|
15
|
+
};
|
|
16
|
+
export declare function normalizeRecords(records: AnomalyRecord[]): NormalizedRecord[];
|
|
17
|
+
export declare function classifyRecords(descriptors: ObjectTypeDescriptor[], records: AnomalyRecord[], options?: AnomalyDetectOptions): Classified[];
|
|
18
|
+
export declare function detectRecordAnomalies(descriptors: ObjectTypeDescriptor[], records: AnomalyRecord[], options?: AnomalyDetectOptions): AnomalyReport<RecordAnomalyItem>;
|
|
19
|
+
export type DriftBucket = {
|
|
20
|
+
scanned: number;
|
|
21
|
+
descriptorAnomalies: number;
|
|
22
|
+
peerAnomalies: number;
|
|
23
|
+
descriptorFindings: AnomalyFinding[];
|
|
24
|
+
peerFindings: AnomalyFinding[];
|
|
25
|
+
};
|
|
26
|
+
export declare function driftBy(rows: Classified[], keyOf: (record: NormalizedRecord) => string): Map<string, DriftBucket>;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=records.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../src/anomaly/records.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,cAAc,EACd,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAqBpB,KAAK,gBAAgB,GAAG;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,KAAK,UAAU,GAAG;IAChB,MAAM,EAAE,gBAAgB,CAAC;IACzB,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B,IAAI,EAAE,cAAc,EAAE,CAAC;CACxB,CAAC;AAkBF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,EAAE,G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