@x12i/memorix-service 3.7.1 → 3.7.7
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/dist/activity-ring.d.ts +185 -0
- package/dist/activity-ring.d.ts.map +1 -0
- package/dist/activity-ring.js +249 -0
- package/dist/activity-ring.js.map +1 -0
- package/dist/activity-routes.d.ts +3 -0
- package/dist/activity-routes.d.ts.map +1 -0
- package/dist/activity-routes.js +47 -0
- package/dist/activity-routes.js.map +1 -0
- package/dist/activity-ui.d.ts +3 -0
- package/dist/activity-ui.d.ts.map +1 -0
- package/dist/activity-ui.js +1105 -0
- package/dist/activity-ui.js.map +1 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +21 -2
- package/dist/app.js.map +1 -1
- package/dist/caller-identity.d.ts +3 -2
- package/dist/caller-identity.d.ts.map +1 -1
- package/dist/caller-identity.js.map +1 -1
- package/dist/catalog-bridge.d.ts.map +1 -1
- package/dist/catalog-bridge.js +7 -1
- package/dist/catalog-bridge.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +12 -0
- package/dist/cli.js.map +1 -1
- package/dist/connector-catalog.d.ts +1 -1
- package/dist/connector-ops/attempt-store.d.ts.map +1 -1
- package/dist/connector-ops/attempt-store.js +1 -3
- package/dist/connector-ops/attempt-store.js.map +1 -1
- package/dist/connector-ops/checkpoint-store.d.ts.map +1 -1
- package/dist/connector-ops/checkpoint-store.js +1 -3
- package/dist/connector-ops/checkpoint-store.js.map +1 -1
- package/dist/connector-ops/override-store.d.ts.map +1 -1
- package/dist/connector-ops/override-store.js +1 -3
- package/dist/connector-ops/override-store.js.map +1 -1
- package/dist/connector-ops/run-store.d.ts.map +1 -1
- package/dist/connector-ops/run-store.js +1 -3
- package/dist/connector-ops/run-store.js.map +1 -1
- package/dist/connector-ops/schedule-lease-store.d.ts.map +1 -1
- package/dist/connector-ops/schedule-lease-store.js +1 -3
- package/dist/connector-ops/schedule-lease-store.js.map +1 -1
- package/dist/data-changes-routes.d.ts +7 -0
- package/dist/data-changes-routes.d.ts.map +1 -0
- package/dist/data-changes-routes.js +27 -0
- package/dist/data-changes-routes.js.map +1 -0
- package/dist/data-changes-ui.d.ts +3 -0
- package/dist/data-changes-ui.d.ts.map +1 -0
- package/dist/data-changes-ui.js +239 -0
- package/dist/data-changes-ui.js.map +1 -0
- package/dist/data-changes.d.ts +51 -0
- package/dist/data-changes.d.ts.map +1 -0
- package/dist/data-changes.js +218 -0
- package/dist/data-changes.js.map +1 -0
- package/dist/errors.d.ts +3 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +36 -3
- package/dist/errors.js.map +1 -1
- package/dist/graph-ui.d.ts +3 -0
- package/dist/graph-ui.d.ts.map +1 -0
- package/dist/graph-ui.js +676 -0
- package/dist/graph-ui.js.map +1 -0
- package/dist/identity-alias.d.ts +12 -0
- package/dist/identity-alias.d.ts.map +1 -0
- package/dist/identity-alias.js +22 -0
- package/dist/identity-alias.js.map +1 -0
- package/dist/incremental-state/state-store.d.ts.map +1 -1
- package/dist/incremental-state/state-store.js +1 -3
- package/dist/incremental-state/state-store.js.map +1 -1
- package/dist/integrations/instance-store.d.ts.map +1 -1
- package/dist/integrations/instance-store.js +1 -3
- package/dist/integrations/instance-store.js.map +1 -1
- package/dist/isolation.d.ts.map +1 -1
- package/dist/isolation.js +3 -2
- package/dist/isolation.js.map +1 -1
- package/dist/knowledge-upstream.d.ts +13 -0
- package/dist/knowledge-upstream.d.ts.map +1 -0
- package/dist/knowledge-upstream.js +38 -0
- package/dist/knowledge-upstream.js.map +1 -0
- package/dist/land-v2-guards.d.ts +22 -0
- package/dist/land-v2-guards.d.ts.map +1 -0
- package/dist/land-v2-guards.js +57 -0
- package/dist/land-v2-guards.js.map +1 -0
- package/dist/live-ops-nav.d.ts +2 -0
- package/dist/live-ops-nav.d.ts.map +1 -0
- package/dist/live-ops-nav.js +53 -0
- package/dist/live-ops-nav.js.map +1 -0
- package/dist/live.d.ts.map +1 -1
- package/dist/mcp/nexum-tools.d.ts +28 -0
- package/dist/mcp/nexum-tools.d.ts.map +1 -0
- package/dist/mcp/nexum-tools.js +257 -0
- package/dist/mcp/nexum-tools.js.map +1 -0
- package/dist/mcp/service-public-url.d.ts +7 -0
- package/dist/mcp/service-public-url.d.ts.map +1 -0
- package/dist/mcp/service-public-url.js +19 -0
- package/dist/mcp/service-public-url.js.map +1 -0
- package/dist/nexum-analysis/backfill.d.ts +59 -0
- package/dist/nexum-analysis/backfill.d.ts.map +1 -0
- package/dist/nexum-analysis/backfill.js +199 -0
- package/dist/nexum-analysis/backfill.js.map +1 -0
- package/dist/nexum-analysis/enqueue.d.ts +29 -0
- package/dist/nexum-analysis/enqueue.d.ts.map +1 -0
- package/dist/nexum-analysis/enqueue.js +190 -0
- package/dist/nexum-analysis/enqueue.js.map +1 -0
- package/dist/nexum-analysis/outbox.d.ts +44 -0
- package/dist/nexum-analysis/outbox.d.ts.map +1 -0
- package/dist/nexum-analysis/outbox.js +176 -0
- package/dist/nexum-analysis/outbox.js.map +1 -0
- package/dist/nexum-analysis/policy.d.ts +48 -0
- package/dist/nexum-analysis/policy.d.ts.map +1 -0
- package/dist/nexum-analysis/policy.js +165 -0
- package/dist/nexum-analysis/policy.js.map +1 -0
- package/dist/nexum-analysis/reconcile.d.ts +8 -0
- package/dist/nexum-analysis/reconcile.d.ts.map +1 -0
- package/dist/nexum-analysis/reconcile.js +37 -0
- package/dist/nexum-analysis/reconcile.js.map +1 -0
- package/dist/openapi/openapi.json +591 -4
- package/dist/operational-db.d.ts +6 -0
- package/dist/operational-db.d.ts.map +1 -0
- package/dist/operational-db.js +22 -0
- package/dist/operational-db.js.map +1 -0
- package/dist/platform.d.ts +4 -1
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +67 -14
- package/dist/platform.js.map +1 -1
- package/dist/request-countex.d.ts +25 -0
- package/dist/request-countex.d.ts.map +1 -1
- package/dist/request-countex.js +103 -18
- package/dist/request-countex.js.map +1 -1
- package/dist/restricted-store/object-store.d.ts.map +1 -1
- package/dist/restricted-store/object-store.js +1 -3
- package/dist/restricted-store/object-store.js.map +1 -1
- package/dist/routes/connector-invocations.d.ts.map +1 -1
- package/dist/routes/connector-invocations.js +7 -1
- package/dist/routes/connector-invocations.js.map +1 -1
- package/dist/routes/data.d.ts.map +1 -1
- package/dist/routes/data.js +113 -14
- package/dist/routes/data.js.map +1 -1
- package/dist/routes/knowledge.d.ts +8 -0
- package/dist/routes/knowledge.d.ts.map +1 -0
- package/dist/routes/knowledge.js +86 -0
- package/dist/routes/knowledge.js.map +1 -0
- package/dist/routes/memory.d.ts.map +1 -1
- package/dist/routes/memory.js +33 -9
- package/dist/routes/memory.js.map +1 -1
- package/dist/routes/metadata.d.ts.map +1 -1
- package/dist/routes/metadata.js +102 -1
- package/dist/routes/metadata.js.map +1 -1
- package/dist/routes/mgc-landing.d.ts.map +1 -1
- package/dist/routes/mgc-landing.js +90 -1
- package/dist/routes/mgc-landing.js.map +1 -1
- package/dist/routes/nexum-mcp.d.ts +9 -0
- package/dist/routes/nexum-mcp.d.ts.map +1 -0
- package/dist/routes/nexum-mcp.js +95 -0
- package/dist/routes/nexum-mcp.js.map +1 -0
- package/dist/routes/operations.d.ts.map +1 -1
- package/dist/routes/operations.js +39 -2
- package/dist/routes/operations.js.map +1 -1
- package/dist/routes/publications.d.ts +4 -0
- package/dist/routes/publications.d.ts.map +1 -0
- package/dist/routes/publications.js +111 -0
- package/dist/routes/publications.js.map +1 -0
- package/dist/routes/workflow.d.ts.map +1 -1
- package/dist/routes/workflow.js +18 -9
- package/dist/routes/workflow.js.map +1 -1
- package/dist/safe-query.d.ts +28 -0
- package/dist/safe-query.d.ts.map +1 -0
- package/dist/safe-query.js +104 -0
- package/dist/safe-query.js.map +1 -0
- package/openapi/openapi.json +591 -4
- package/package.json +5 -5
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FastifyInstance } from "fastify";
|
|
2
|
+
import type { MongoClient } from "mongodb";
|
|
3
|
+
export type DataChangesRouteDeps = {
|
|
4
|
+
getMongoClient: () => MongoClient | null;
|
|
5
|
+
};
|
|
6
|
+
export declare function registerDataChangesRoutes(app: FastifyInstance, deps: DataChangesRouteDeps): void;
|
|
7
|
+
//# sourceMappingURL=data-changes-routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-changes-routes.d.ts","sourceRoot":"","sources":["../src/data-changes-routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAI3C,MAAM,MAAM,oBAAoB,GAAG;IACjC,cAAc,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;CAC1C,CAAC;AAEF,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,eAAe,EACpB,IAAI,EAAE,oBAAoB,GACzB,IAAI,CA2BN"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { scanDataChanges } from "./data-changes.js";
|
|
2
|
+
import { dataChangesHtml } from "./data-changes-ui.js";
|
|
3
|
+
export function registerDataChangesRoutes(app, deps) {
|
|
4
|
+
app.get("/_live/changes", async (_req, reply) => {
|
|
5
|
+
return reply.type("text/html; charset=utf-8").send(dataChangesHtml());
|
|
6
|
+
});
|
|
7
|
+
app.get("/_live/api/data-changes", async (req, reply) => {
|
|
8
|
+
const client = deps.getMongoClient();
|
|
9
|
+
if (!client) {
|
|
10
|
+
return reply.code(503).send({
|
|
11
|
+
ok: false,
|
|
12
|
+
error: {
|
|
13
|
+
code: "MONGO_UNAVAILABLE",
|
|
14
|
+
message: "Durable Mongo is not configured on this process",
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
const q = req.query;
|
|
19
|
+
const report = await scanDataChanges({
|
|
20
|
+
client,
|
|
21
|
+
orgId: q.orgId,
|
|
22
|
+
includeZeros: q.includeZeros === "1" || q.includeZeros === "true",
|
|
23
|
+
});
|
|
24
|
+
return { ok: true, ...report };
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=data-changes-routes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-changes-routes.js","sourceRoot":"","sources":["../src/data-changes-routes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAMvD,MAAM,UAAU,yBAAyB,CACvC,GAAoB,EACpB,IAA0B;IAE1B,GAAG,CAAC,GAAG,CAAC,gBAAgB,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QAC9C,OAAO,KAAK,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,GAAG,CAAC,yBAAyB,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;QACtD,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QACrC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBAC1B,EAAE,EAAE,KAAK;gBACT,KAAK,EAAE;oBACL,IAAI,EAAE,mBAAmB;oBACzB,OAAO,EAAE,iDAAiD;iBAC3D;aACF,CAAC,CAAC;QACL,CAAC;QACD,MAAM,CAAC,GAAG,GAAG,CAAC,KAGb,CAAC;QACF,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC;YACnC,MAAM;YACN,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,YAAY,EAAE,CAAC,CAAC,YAAY,KAAK,GAAG,IAAI,CAAC,CAAC,YAAY,KAAK,MAAM;SAClE,CAAC,CAAC;QACH,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-changes-ui.d.ts","sourceRoot":"","sources":["../src/data-changes-ui.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,wBAAgB,eAAe,IAAI,MAAM,CA4OxC"}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/** HTML for GET /_live/changes — OT×CT change matrix by collection target. */
|
|
2
|
+
export function dataChangesHtml() {
|
|
3
|
+
return `<!DOCTYPE html>
|
|
4
|
+
<html lang="en">
|
|
5
|
+
<head>
|
|
6
|
+
<meta charset="utf-8" />
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
8
|
+
<title>Memorix · Data changes</title>
|
|
9
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
10
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
11
|
+
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap" rel="stylesheet" />
|
|
12
|
+
<style>
|
|
13
|
+
:root {
|
|
14
|
+
--bg: #0a0c10; --bg-elev: #10141b; --bg-row: #141922; --line: #242b38;
|
|
15
|
+
--text: #e8ebe6; --muted: #8a9288; --dim: #5c645c;
|
|
16
|
+
--ok: #3dba7a; --accent: #c8f082; --accent-ink: #0a0c10;
|
|
17
|
+
--sans: "IBM Plex Sans", system-ui, sans-serif;
|
|
18
|
+
--mono: "IBM Plex Mono", ui-monospace, monospace;
|
|
19
|
+
}
|
|
20
|
+
* { box-sizing: border-box; }
|
|
21
|
+
html, body { height: 100%; margin: 0; }
|
|
22
|
+
body {
|
|
23
|
+
font-family: var(--sans);
|
|
24
|
+
background:
|
|
25
|
+
radial-gradient(1200px 600px at 10% -10%, #1a2214 0%, transparent 55%),
|
|
26
|
+
radial-gradient(900px 500px at 100% 0%, #121820 0%, transparent 50%),
|
|
27
|
+
var(--bg);
|
|
28
|
+
color: var(--text); font-size: 14px; line-height: 1.45;
|
|
29
|
+
}
|
|
30
|
+
a { color: var(--accent); }
|
|
31
|
+
.shell { max-width: 1200px; margin: 0 auto; padding: 36px 28px 64px; }
|
|
32
|
+
header {
|
|
33
|
+
display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
|
|
34
|
+
margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--line);
|
|
35
|
+
}
|
|
36
|
+
.brand { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
|
|
37
|
+
.brand span { color: var(--accent); }
|
|
38
|
+
.sub { margin-top: 8px; color: var(--muted); font-size: 13px; max-width: 62ch; }
|
|
39
|
+
.meta { text-align: right; font-family: var(--mono); font-size: 11px; color: var(--dim); display: grid; gap: 4px; }
|
|
40
|
+
.toolbar {
|
|
41
|
+
display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
|
|
42
|
+
margin-bottom: 16px;
|
|
43
|
+
}
|
|
44
|
+
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
|
|
45
|
+
.tab, .btn, select, input {
|
|
46
|
+
appearance: none; border: 1px solid var(--line); background: var(--bg-row); color: var(--text);
|
|
47
|
+
font: 500 12px/1 var(--sans); padding: 10px 14px; border-radius: 2px;
|
|
48
|
+
}
|
|
49
|
+
.tab { cursor: pointer; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: transparent; }
|
|
50
|
+
.tab[aria-selected="true"] {
|
|
51
|
+
background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
|
|
52
|
+
}
|
|
53
|
+
.btn { cursor: pointer; }
|
|
54
|
+
.btn:hover { border-color: var(--accent); }
|
|
55
|
+
input, select { min-width: 140px; }
|
|
56
|
+
.summary {
|
|
57
|
+
display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 14px;
|
|
58
|
+
font-family: var(--mono); font-size: 12px; color: var(--muted);
|
|
59
|
+
}
|
|
60
|
+
.summary strong { color: var(--text); font-weight: 500; }
|
|
61
|
+
table { width: 100%; border-collapse: collapse; background: var(--bg-elev); border: 1px solid var(--line); }
|
|
62
|
+
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
|
|
63
|
+
th {
|
|
64
|
+
font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
|
|
65
|
+
color: var(--dim); font-weight: 500; background: #0d1016; position: sticky; top: 0;
|
|
66
|
+
}
|
|
67
|
+
tr:last-child td { border-bottom: 0; }
|
|
68
|
+
tr:hover td { background: var(--bg-row); }
|
|
69
|
+
.mono { font-family: var(--mono); font-size: 12px; color: var(--muted); }
|
|
70
|
+
.num { font-family: var(--mono); font-size: 12px; text-align: right; white-space: nowrap; }
|
|
71
|
+
.db { color: var(--accent); }
|
|
72
|
+
.muted { color: var(--muted); }
|
|
73
|
+
.err { color: #e25a5a; margin: 12px 0; }
|
|
74
|
+
.group-head td {
|
|
75
|
+
background: #0d1016; font-family: var(--mono); font-size: 11px;
|
|
76
|
+
color: var(--dim); letter-spacing: 0.04em; text-transform: uppercase;
|
|
77
|
+
}
|
|
78
|
+
footer { margin-top: 28px; color: var(--dim); font-size: 12px; }
|
|
79
|
+
</style>
|
|
80
|
+
</head>
|
|
81
|
+
<body>
|
|
82
|
+
<div class="shell">
|
|
83
|
+
<header>
|
|
84
|
+
<div>
|
|
85
|
+
<div class="brand">Memorix <span>data changes</span></div>
|
|
86
|
+
<p class="sub">Records touched per collection <strong>target</strong> (database × objectType × contentType), from <span class="mono">_system.modifiedAt</span> / <span class="mono">createdAt</span>.</p>
|
|
87
|
+
</div>
|
|
88
|
+
<div class="meta">
|
|
89
|
+
<div><strong>UI</strong> /_live/changes</div>
|
|
90
|
+
<div><strong>API</strong> /_live/api/data-changes</div>
|
|
91
|
+
<div><a href="/_live">← live view</a> · <a href="/_live/activity">activity</a> · <a href="/_live/graph">stored graph</a></div>
|
|
92
|
+
</div>
|
|
93
|
+
</header>
|
|
94
|
+
|
|
95
|
+
<div class="toolbar">
|
|
96
|
+
<nav class="tabs" role="tablist">
|
|
97
|
+
<button class="tab" role="tab" aria-selected="true" data-window="1h">Last hour</button>
|
|
98
|
+
<button class="tab" role="tab" aria-selected="false" data-window="24h">Last 24 hours</button>
|
|
99
|
+
</nav>
|
|
100
|
+
<label class="muted">Org
|
|
101
|
+
<select id="org"></select>
|
|
102
|
+
</label>
|
|
103
|
+
<label class="muted" style="display:flex;align-items:center;gap:6px">
|
|
104
|
+
<input type="checkbox" id="zeros" /> include zeros
|
|
105
|
+
</label>
|
|
106
|
+
<button class="btn" id="refresh" type="button">Refresh</button>
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<div class="summary" id="summary"></div>
|
|
110
|
+
<div id="error" class="err" hidden></div>
|
|
111
|
+
<div id="table-wrap"></div>
|
|
112
|
+
<footer>Counts are live Mongo scans · windows are rolling from request time · reserved collections skipped</footer>
|
|
113
|
+
</div>
|
|
114
|
+
<script>
|
|
115
|
+
const $ = (id) => document.getElementById(id);
|
|
116
|
+
let report = null;
|
|
117
|
+
let activeWindow = "1h";
|
|
118
|
+
|
|
119
|
+
document.querySelectorAll(".tab").forEach((tab) => {
|
|
120
|
+
tab.addEventListener("click", () => {
|
|
121
|
+
document.querySelectorAll(".tab").forEach((t) => t.setAttribute("aria-selected", "false"));
|
|
122
|
+
tab.setAttribute("aria-selected", "true");
|
|
123
|
+
activeWindow = tab.dataset.window;
|
|
124
|
+
render();
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
$("refresh").onclick = () => load({ forceOrg: true });
|
|
128
|
+
$("org").onchange = () => load();
|
|
129
|
+
$("zeros").onchange = () => load();
|
|
130
|
+
|
|
131
|
+
function fmt(n) {
|
|
132
|
+
return new Intl.NumberFormat().format(n ?? 0);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function escapeHtml(s) {
|
|
136
|
+
return String(s ?? "").replace(/[&<>"']/g, (c) => ({
|
|
137
|
+
"&": "&", "<": "<", ">": ">", '"': """, "'": "'"
|
|
138
|
+
})[c]);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async function load(opts = {}) {
|
|
142
|
+
$("error").hidden = true;
|
|
143
|
+
$("summary").textContent = "Scanning…";
|
|
144
|
+
$("table-wrap").innerHTML = "";
|
|
145
|
+
const params = new URLSearchParams();
|
|
146
|
+
const org = $("org").value;
|
|
147
|
+
if (org && org !== "*") params.set("orgId", org);
|
|
148
|
+
if ($("zeros").checked) params.set("includeZeros", "1");
|
|
149
|
+
try {
|
|
150
|
+
const res = await fetch("/_live/api/data-changes?" + params.toString());
|
|
151
|
+
const body = await res.json();
|
|
152
|
+
if (!res.ok || body.ok === false) {
|
|
153
|
+
throw new Error(body?.error?.message || ("HTTP " + res.status));
|
|
154
|
+
}
|
|
155
|
+
report = body;
|
|
156
|
+
if (opts.forceOrg || $("org").options.length <= 1) {
|
|
157
|
+
fillOrgs(body.orgIds || [], org);
|
|
158
|
+
}
|
|
159
|
+
render();
|
|
160
|
+
} catch (e) {
|
|
161
|
+
$("summary").textContent = "";
|
|
162
|
+
$("error").hidden = false;
|
|
163
|
+
$("error").textContent = e.message || String(e);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function fillOrgs(orgIds, selected) {
|
|
168
|
+
const sel = $("org");
|
|
169
|
+
const keep = selected || sel.value || "*";
|
|
170
|
+
sel.innerHTML = "";
|
|
171
|
+
const all = document.createElement("option");
|
|
172
|
+
all.value = "*";
|
|
173
|
+
all.textContent = "All orgs";
|
|
174
|
+
sel.appendChild(all);
|
|
175
|
+
for (const id of orgIds) {
|
|
176
|
+
const o = document.createElement("option");
|
|
177
|
+
o.value = id;
|
|
178
|
+
o.textContent = id;
|
|
179
|
+
sel.appendChild(o);
|
|
180
|
+
}
|
|
181
|
+
sel.value = [...sel.options].some((o) => o.value === keep) ? keep : "*";
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function render() {
|
|
185
|
+
if (!report) return;
|
|
186
|
+
const win = report.windows?.[activeWindow];
|
|
187
|
+
if (!win) {
|
|
188
|
+
$("summary").textContent = "No window data";
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
$("summary").innerHTML =
|
|
192
|
+
"<span>since <strong>" + escapeHtml(win.since) + "</strong></span>" +
|
|
193
|
+
"<span>collections <strong>" + fmt(win.totals.collections) + "</strong></span>" +
|
|
194
|
+
"<span>with changes <strong>" + fmt(win.totals.changedCollections) + "</strong></span>" +
|
|
195
|
+
"<span>modified <strong>" + fmt(win.totals.changed) + "</strong></span>" +
|
|
196
|
+
"<span>created <strong>" + fmt(win.totals.created) + "</strong></span>" +
|
|
197
|
+
"<span>generated <strong>" + escapeHtml(report.generatedAt) + "</strong></span>";
|
|
198
|
+
|
|
199
|
+
const rows = win.rows || [];
|
|
200
|
+
if (!rows.length) {
|
|
201
|
+
$("table-wrap").innerHTML = "<p class='muted'>No matching content targets in this window.</p>";
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
let html = "<table><thead><tr>" +
|
|
206
|
+
"<th>Org</th><th>Database</th><th>Kind</th><th>Object type</th><th>Content type</th>" +
|
|
207
|
+
"<th class='num'>Changed</th><th class='num'>Created</th><th class='num'>Total</th><th>Collection target</th>" +
|
|
208
|
+
"</tr></thead><tbody>";
|
|
209
|
+
|
|
210
|
+
let lastDb = "";
|
|
211
|
+
for (const r of rows) {
|
|
212
|
+
if (r.databaseName !== lastDb) {
|
|
213
|
+
lastDb = r.databaseName;
|
|
214
|
+
html += "<tr class='group-head'><td colspan='9'>" +
|
|
215
|
+
escapeHtml(r.orgId) + " · " + escapeHtml(r.databaseName) +
|
|
216
|
+
"</td></tr>";
|
|
217
|
+
}
|
|
218
|
+
html += "<tr>" +
|
|
219
|
+
"<td class='mono'>" + escapeHtml(r.orgId) + "</td>" +
|
|
220
|
+
"<td class='mono db'>" + escapeHtml(r.databaseName) + "</td>" +
|
|
221
|
+
"<td class='mono'>" + escapeHtml(r.kind) + "</td>" +
|
|
222
|
+
"<td>" + escapeHtml(r.objectType) + "</td>" +
|
|
223
|
+
"<td>" + escapeHtml(r.contentType) + "</td>" +
|
|
224
|
+
"<td class='num'>" + fmt(r.changed) + "</td>" +
|
|
225
|
+
"<td class='num'>" + fmt(r.created) + "</td>" +
|
|
226
|
+
"<td class='num'>" + fmt(r.total) + "</td>" +
|
|
227
|
+
"<td class='mono'>" + escapeHtml(r.collectionName) + "</td>" +
|
|
228
|
+
"</tr>";
|
|
229
|
+
}
|
|
230
|
+
html += "</tbody></table>";
|
|
231
|
+
$("table-wrap").innerHTML = html;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
load({ forceOrg: true });
|
|
235
|
+
</script>
|
|
236
|
+
</body>
|
|
237
|
+
</html>`;
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=data-changes-ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-changes-ui.js","sourceRoot":"","sources":["../src/data-changes-ui.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,MAAM,UAAU,eAAe;IAC7B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA0OD,CAAC;AACT,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scan org category databases for content-collection change counts
|
|
3
|
+
* (`_system.modifiedAt`) over rolling windows, keyed by collection target.
|
|
4
|
+
*/
|
|
5
|
+
import type { MongoClient } from "mongodb";
|
|
6
|
+
import { type DatabaseKind } from "@x12i/memorix-data";
|
|
7
|
+
export type DataChangeWindowId = "1h" | "24h";
|
|
8
|
+
export type CollectionChangeTarget = {
|
|
9
|
+
orgId: string;
|
|
10
|
+
kind: DatabaseKind;
|
|
11
|
+
databaseName: string;
|
|
12
|
+
collectionName: string;
|
|
13
|
+
objectType: string;
|
|
14
|
+
contentType: string;
|
|
15
|
+
};
|
|
16
|
+
export type CollectionChangeCounts = CollectionChangeTarget & {
|
|
17
|
+
total: number;
|
|
18
|
+
changed: number;
|
|
19
|
+
created: number;
|
|
20
|
+
};
|
|
21
|
+
export type DataChangesWindowResult = {
|
|
22
|
+
window: DataChangeWindowId;
|
|
23
|
+
since: string;
|
|
24
|
+
until: string;
|
|
25
|
+
rows: CollectionChangeCounts[];
|
|
26
|
+
totals: {
|
|
27
|
+
collections: number;
|
|
28
|
+
changedCollections: number;
|
|
29
|
+
changed: number;
|
|
30
|
+
created: number;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export type DataChangesReport = {
|
|
34
|
+
generatedAt: string;
|
|
35
|
+
orgIds: string[];
|
|
36
|
+
windows: Record<DataChangeWindowId, DataChangesWindowResult>;
|
|
37
|
+
};
|
|
38
|
+
/** Longest objectType prefix match → contentType remainder. */
|
|
39
|
+
export declare function resolveObjectAndContentType(collectionName: string, objectTypes: readonly string[]): {
|
|
40
|
+
objectType: string;
|
|
41
|
+
contentType: string;
|
|
42
|
+
};
|
|
43
|
+
export type ScanDataChangesOpts = {
|
|
44
|
+
client: MongoClient;
|
|
45
|
+
/** Limit to one org; default all orgs with an operational DB. */
|
|
46
|
+
orgId?: string;
|
|
47
|
+
/** Include rows with zero changes in both windows (default false). */
|
|
48
|
+
includeZeros?: boolean;
|
|
49
|
+
};
|
|
50
|
+
export declare function scanDataChanges(opts: ScanDataChangesOpts): Promise<DataChangesReport>;
|
|
51
|
+
//# sourceMappingURL=data-changes.d.ts.map
|
|
@@ -0,0 +1 @@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S,MAAM,EAAE,GAC7B;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAsB7C;AAiFD,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,WAAW,CAAC;IACpB,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,wBAAsB,eAAe,CACnC,IAAI,EAAE,mBAAmB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAsH5B"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { databaseNameFor } from "@x12i/memorix-data";
|
|
2
|
+
import { isOperationalDbName, orgIdFromOperationalDbName, } from "./operational-db.js";
|
|
3
|
+
const DATABASE_KINDS = [
|
|
4
|
+
"entity",
|
|
5
|
+
"event",
|
|
6
|
+
"knowledge",
|
|
7
|
+
"operational",
|
|
8
|
+
];
|
|
9
|
+
const RESERVED_COLLECTIONS = new Set([
|
|
10
|
+
"relationships",
|
|
11
|
+
"record-directory",
|
|
12
|
+
"system.profile",
|
|
13
|
+
]);
|
|
14
|
+
/** Skip ops / underscore collections that are not OT-CT content targets. */
|
|
15
|
+
function isContentCollectionName(name) {
|
|
16
|
+
if (!name || RESERVED_COLLECTIONS.has(name))
|
|
17
|
+
return false;
|
|
18
|
+
if (name.startsWith("system."))
|
|
19
|
+
return false;
|
|
20
|
+
if (name.includes("_"))
|
|
21
|
+
return false;
|
|
22
|
+
if (!name.includes("-"))
|
|
23
|
+
return false;
|
|
24
|
+
return /^[a-z][a-z0-9-]*$/.test(name);
|
|
25
|
+
}
|
|
26
|
+
function windowMs(id) {
|
|
27
|
+
return id === "1h" ? 3_600_000 : 86_400_000;
|
|
28
|
+
}
|
|
29
|
+
/** Longest objectType prefix match → contentType remainder. */
|
|
30
|
+
export function resolveObjectAndContentType(collectionName, objectTypes) {
|
|
31
|
+
const sorted = [...objectTypes].sort((a, b) => b.length - a.length);
|
|
32
|
+
for (const objectType of sorted) {
|
|
33
|
+
const prefix = `${objectType}-`;
|
|
34
|
+
if (collectionName.startsWith(prefix) &&
|
|
35
|
+
collectionName.length > prefix.length) {
|
|
36
|
+
return {
|
|
37
|
+
objectType,
|
|
38
|
+
contentType: collectionName.slice(prefix.length),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const i = collectionName.lastIndexOf("-");
|
|
43
|
+
if (i > 0) {
|
|
44
|
+
return {
|
|
45
|
+
objectType: collectionName.slice(0, i),
|
|
46
|
+
contentType: collectionName.slice(i + 1),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return { objectType: collectionName, contentType: "" };
|
|
50
|
+
}
|
|
51
|
+
async function listOrgIds(client) {
|
|
52
|
+
const listed = await client.db().admin().listDatabases();
|
|
53
|
+
const ids = new Set();
|
|
54
|
+
for (const db of listed.databases ?? []) {
|
|
55
|
+
const name = String(db.name ?? "");
|
|
56
|
+
if (!isOperationalDbName(name))
|
|
57
|
+
continue;
|
|
58
|
+
const orgId = orgIdFromOperationalDbName(name);
|
|
59
|
+
if (orgId)
|
|
60
|
+
ids.add(orgId);
|
|
61
|
+
}
|
|
62
|
+
return [...ids].sort((a, b) => a.localeCompare(b));
|
|
63
|
+
}
|
|
64
|
+
async function objectTypesForOrg(client, orgId) {
|
|
65
|
+
const dbName = databaseNameFor(orgId, "operational");
|
|
66
|
+
try {
|
|
67
|
+
const types = await client
|
|
68
|
+
.db(dbName)
|
|
69
|
+
.collection("record-directory")
|
|
70
|
+
.distinct("objectType");
|
|
71
|
+
return types
|
|
72
|
+
.map((t) => String(t))
|
|
73
|
+
.filter((t) => t.length > 0)
|
|
74
|
+
.sort((a, b) => b.length - a.length || a.localeCompare(b));
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async function countBothWindows(client, target, since1h, since24h) {
|
|
81
|
+
const coll = client
|
|
82
|
+
.db(target.databaseName)
|
|
83
|
+
.collection(target.collectionName);
|
|
84
|
+
const [total, changed1h, created1h, changed24h, created24h] = await Promise.all([
|
|
85
|
+
coll.estimatedDocumentCount(),
|
|
86
|
+
coll.countDocuments({ "_system.modifiedAt": { $gte: since1h } }),
|
|
87
|
+
coll.countDocuments({ "_system.createdAt": { $gte: since1h } }),
|
|
88
|
+
coll.countDocuments({ "_system.modifiedAt": { $gte: since24h } }),
|
|
89
|
+
coll.countDocuments({ "_system.createdAt": { $gte: since24h } }),
|
|
90
|
+
]);
|
|
91
|
+
return { total, changed1h, created1h, changed24h, created24h };
|
|
92
|
+
}
|
|
93
|
+
function sortRows(rows) {
|
|
94
|
+
rows.sort((a, b) => {
|
|
95
|
+
if (a.orgId !== b.orgId)
|
|
96
|
+
return a.orgId.localeCompare(b.orgId);
|
|
97
|
+
if (a.databaseName !== b.databaseName) {
|
|
98
|
+
return a.databaseName.localeCompare(b.databaseName);
|
|
99
|
+
}
|
|
100
|
+
if (b.changed !== a.changed)
|
|
101
|
+
return b.changed - a.changed;
|
|
102
|
+
return a.collectionName.localeCompare(b.collectionName);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function summarize(rows) {
|
|
106
|
+
return {
|
|
107
|
+
collections: rows.length,
|
|
108
|
+
changedCollections: rows.filter((r) => r.changed > 0).length,
|
|
109
|
+
changed: rows.reduce((n, r) => n + r.changed, 0),
|
|
110
|
+
created: rows.reduce((n, r) => n + r.created, 0),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
export async function scanDataChanges(opts) {
|
|
114
|
+
const until = new Date();
|
|
115
|
+
const untilIso = until.toISOString();
|
|
116
|
+
const since1h = new Date(until.getTime() - windowMs("1h")).toISOString();
|
|
117
|
+
const since24h = new Date(until.getTime() - windowMs("24h")).toISOString();
|
|
118
|
+
let orgIds = await listOrgIds(opts.client);
|
|
119
|
+
if (opts.orgId?.trim()) {
|
|
120
|
+
const want = opts.orgId.trim().toLowerCase();
|
|
121
|
+
orgIds = orgIds.filter((id) => id.toLowerCase() === want);
|
|
122
|
+
if (orgIds.length === 0)
|
|
123
|
+
orgIds = [opts.orgId.trim()];
|
|
124
|
+
}
|
|
125
|
+
const targets = [];
|
|
126
|
+
for (const orgId of orgIds) {
|
|
127
|
+
const objectTypes = await objectTypesForOrg(opts.client, orgId);
|
|
128
|
+
for (const kind of DATABASE_KINDS) {
|
|
129
|
+
const databaseName = databaseNameFor(orgId, kind);
|
|
130
|
+
let names = [];
|
|
131
|
+
try {
|
|
132
|
+
const cols = await opts.client
|
|
133
|
+
.db(databaseName)
|
|
134
|
+
.listCollections()
|
|
135
|
+
.toArray();
|
|
136
|
+
names = cols.map((c) => String(c.name));
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
if (names.length === 0)
|
|
142
|
+
continue;
|
|
143
|
+
for (const collectionName of names) {
|
|
144
|
+
if (!isContentCollectionName(collectionName))
|
|
145
|
+
continue;
|
|
146
|
+
const { objectType, contentType } = resolveObjectAndContentType(collectionName, objectTypes);
|
|
147
|
+
targets.push({
|
|
148
|
+
orgId,
|
|
149
|
+
kind,
|
|
150
|
+
databaseName,
|
|
151
|
+
collectionName,
|
|
152
|
+
objectType,
|
|
153
|
+
contentType,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const rows1h = [];
|
|
159
|
+
const rows24h = [];
|
|
160
|
+
const concurrency = 8;
|
|
161
|
+
let idx = 0;
|
|
162
|
+
async function worker() {
|
|
163
|
+
while (idx < targets.length) {
|
|
164
|
+
const my = idx++;
|
|
165
|
+
const target = targets[my];
|
|
166
|
+
try {
|
|
167
|
+
const counts = await countBothWindows(opts.client, target, since1h, since24h);
|
|
168
|
+
const has1h = counts.changed1h > 0 || counts.created1h > 0;
|
|
169
|
+
const has24h = counts.changed24h > 0 || counts.created24h > 0;
|
|
170
|
+
if (!opts.includeZeros && !has1h && !has24h)
|
|
171
|
+
continue;
|
|
172
|
+
if (opts.includeZeros || has1h) {
|
|
173
|
+
rows1h.push({
|
|
174
|
+
...target,
|
|
175
|
+
total: counts.total,
|
|
176
|
+
changed: counts.changed1h,
|
|
177
|
+
created: counts.created1h,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
if (opts.includeZeros || has24h) {
|
|
181
|
+
rows24h.push({
|
|
182
|
+
...target,
|
|
183
|
+
total: counts.total,
|
|
184
|
+
changed: counts.changed24h,
|
|
185
|
+
created: counts.created24h,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
/* skip unreadable collections */
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
await Promise.all(Array.from({ length: Math.min(concurrency, Math.max(targets.length, 1)) }, () => worker()));
|
|
195
|
+
sortRows(rows1h);
|
|
196
|
+
sortRows(rows24h);
|
|
197
|
+
return {
|
|
198
|
+
generatedAt: untilIso,
|
|
199
|
+
orgIds,
|
|
200
|
+
windows: {
|
|
201
|
+
"1h": {
|
|
202
|
+
window: "1h",
|
|
203
|
+
since: since1h,
|
|
204
|
+
until: untilIso,
|
|
205
|
+
rows: rows1h,
|
|
206
|
+
totals: summarize(rows1h),
|
|
207
|
+
},
|
|
208
|
+
"24h": {
|
|
209
|
+
window: "24h",
|
|
210
|
+
since: since24h,
|
|
211
|
+
until: untilIso,
|
|
212
|
+
rows: rows24h,
|
|
213
|
+
totals: summarize(rows24h),
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=data-changes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-changes.js","sourceRoot":"","sources":["../src/data-changes.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAqB,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAC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rB,MAAM;QACN,OAAO,EAAE;YACP,IAAI,EAAE;gBACJ,MAAM,EAAE,IAAI;gBACZ,KAAK,EAAE,OAAO;gBACd,KAAK,EAAE,QAAQ;gBACf,IAAI,EAAE,MAAM;gBACZ,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC;aAC1B;YACD,KAAK,EAAE;gBACL,MAAM,EAAE,KAAK;gBACb,KAAK,EAAE,QAAQ;gBACf,KAAK,EAAE,QAAQ;gBACf,IAAI,EAAE,OAAO;gBACb,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC;aAC3B;SACF;KACF,CAAC;AACJ,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -10,6 +10,9 @@ export type ServiceErrorBody = {
|
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
+
/** Actionable next step for undeclared OT/CT or a rejected metadata ensure handshake. */
|
|
14
|
+
export declare const METADATA_ENSURE_NEXT = "POST /api/metadata/ensure with your metadata pack and confirm:true before writing. pack.agentId must be one of x-memorix-agent-ids. Then retry this write. A 404 on /api/metadata/ensure means this host is older than @x12i/memorix-service@3.7.6.";
|
|
15
|
+
export declare const METADATA_ENSURE_BODY_NEXT = "Call POST /api/metadata/ensure with body { pack: <MetadataPack>, confirm: true }. pack.agentId must be one of x-memorix-agent-ids. Do not invent objectType/contentType on POST /api/data/content.";
|
|
13
16
|
export declare class ServiceError extends Error {
|
|
14
17
|
readonly code: string;
|
|
15
18
|
readonly statusCode: number;
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,aAAa,EAAE,MAAM,CAAC;QACtB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,KAA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