Compare commits

...

5 Commits

Author SHA1 Message Date
wmantly 2d202b4979 chore: release v1.19.2 2026-08-02 12:06:09 -04:00
wmantly 8f04c20cd7 fix: process edges during discovery reconciliation to correctly link merged resources 2026-08-02 12:05:46 -04:00
wmantly df330c6c0f Merge pull request #141 from theta42/release-v1.19.0
Release v1.19.0
2026-08-02 11:20:49 -04:00
wmantly 522093e898 fix: remove missing documentation files from Docker build context
Pull Request Tests / Run Tests (18.x) (push) Failing after 1m36s
Pull Request Tests / Run Tests (20.x) (push) Failing after 28s
Pull Request Tests / Run Tests (22.x) (push) Failing after 28s
Pull Request Tests / Test Summary (push) Failing after 4s
2026-08-02 02:14:30 -04:00
wmantly 7b84a10420 fix: regex syntax error in docker discovery plugin 2026-08-02 02:09:19 -04:00
7 changed files with 46 additions and 12 deletions
-2
View File
@@ -182,10 +182,8 @@ COPY tos.md /tos.md
# without internet access. Same flattened-path convention as tos.md above. # without internet access. Same flattened-path convention as tos.md above.
COPY README.md /README.md COPY README.md /README.md
COPY CHANGELOG.md /CHANGELOG.md COPY CHANGELOG.md /CHANGELOG.md
COPY DEPLOYMENT.md /DEPLOYMENT.md
COPY API.md /API.md COPY API.md /API.md
COPY directory_spec.md /directory_spec.md COPY directory_spec.md /directory_spec.md
COPY docs /docs
# Baked commit hash from the gitinfo stage (see build_info.js). # Baked commit hash from the gitinfo stage (see build_info.js).
COPY --from=gitinfo /commit.txt ./.build_commit COPY --from=gitinfo /commit.txt ./.build_commit
-2
View File
@@ -36,10 +36,8 @@ RUN mkdir -p /app/config
COPY tos.md /tos.md COPY tos.md /tos.md
COPY README.md /README.md COPY README.md /README.md
COPY CHANGELOG.md /CHANGELOG.md COPY CHANGELOG.md /CHANGELOG.md
COPY DEPLOYMENT.md /DEPLOYMENT.md
COPY API.md /API.md COPY API.md /API.md
COPY directory_spec.md /directory_spec.md COPY directory_spec.md /directory_spec.md
COPY docs /docs
# Seed script and utility # Seed script and utility
COPY test_seed.js ./test_seed.js COPY test_seed.js ./test_seed.js
Binary file not shown.
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "t42-sso-manager", "name": "t42-sso-manager",
"version": "1.19.0", "version": "1.19.2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "t42-sso-manager", "name": "t42-sso-manager",
"version": "1.19.0", "version": "1.19.2",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-free": "^7.3.0", "@fortawesome/fontawesome-free": "^7.3.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "t42-sso-manager", "name": "t42-sso-manager",
"version": "1.19.0", "version": "1.19.2",
"description": "A very simple LDAP management and SSO system", "description": "A very simple LDAP management and SSO system",
"author": [ "author": [
{ {
+1 -1
View File
@@ -49,7 +49,7 @@ module.exports = {
const edges = []; const edges = [];
for (const c of containers) { for (const c of containers) {
const name = c.Names && c.Names.length > 0 ? c.Names[0].replace(/^\\//, '') : c.Id.substring(0, 12); const name = c.Names && c.Names.length > 0 ? c.Names[0].replace(/^\//, '') : c.Id.substring(0, 12);
const slug = `docker-cnt-${c.Id.substring(0, 12)}`; const slug = `docker-cnt-${c.Id.substring(0, 12)}`;
const ports = (c.Ports || []).map(p => p.PublicPort ? `${p.PublicPort}:${p.PrivatePort}` : `${p.PrivatePort}`).join(', '); const ports = (c.Ports || []).map(p => p.PublicPort ? `${p.PublicPort}:${p.PrivatePort}` : `${p.PrivatePort}`).join(', ');
+42 -4
View File
@@ -9,6 +9,7 @@ class DiscoveryReconciler {
for (const res of resources) { for (const res of resources) {
if (!res.metadata) res.metadata = {}; if (!res.metadata) res.metadata = {};
res._originalSlug = res.slug; // Keep track for edge mapping
let existing = null; let existing = null;
@@ -94,10 +95,11 @@ class DiscoveryReconciler {
metadata: mergedMeta, metadata: mergedMeta,
updated_on: Math.floor(Date.now() / 1000) updated_on: Math.floor(Date.now() / 1000)
}); });
res._actualId = existing.id;
} else { } else {
// Create new // Create new
const sources = [sourceName]; const sources = new Set([sourceName]);
res.metadata.discovery_sources = sources; res.metadata.discovery_sources = [...sources];
res.metadata.last_seen = Date.now(); res.metadata.last_seen = Date.now();
const slug = res.slug || `${res.kind}-${crypto.randomBytes(4).toString('hex')}`; const slug = res.slug || `${res.kind}-${crypto.randomBytes(4).toString('hex')}`;
@@ -112,12 +114,48 @@ class DiscoveryReconciler {
}); });
newDevices++; newDevices++;
res._actualId = created.id; // Map original slug to actual ID
WebhookEmitter.emit('discovery.new_device', created.toJSON()); WebhookEmitter.emit('discovery.new_device', created.toJSON());
} }
} }
// We can handle edges similarly if needed, but for simplicity we assume edges are managed elsewhere // Now process edges
// or we just trust the plugins to give us explicit parent-child mappings by slug. const allRes = await Resource.list();
const existingEdges = await ResourceEdge.list();
for (const edge of edges) {
// Find parent ID. It might be in the current payload (mapped to _actualId) or in DB by slug
let parentId = null;
const parentResInPayload = resources.find(r => r._originalSlug === edge.parentSlug);
if (parentResInPayload && parentResInPayload._actualId) {
parentId = parentResInPayload._actualId;
} else {
const parentResInDb = allRes.find(r => r.slug === edge.parentSlug);
if (parentResInDb) parentId = parentResInDb.id;
}
// Find child ID
let childId = null;
const childResInPayload = resources.find(r => r._originalSlug === edge.childSlug);
if (childResInPayload && childResInPayload._actualId) {
childId = childResInPayload._actualId;
} else {
const childResInDb = allRes.find(r => r.slug === edge.childSlug);
if (childResInDb) childId = childResInDb.id;
}
if (parentId && childId) {
const edgeExists = existingEdges.find(e => e.parentId === parentId && e.childId === childId && e.relation === edge.relation);
if (!edgeExists) {
await ResourceEdge.create({
id: crypto.randomUUID(),
parentId,
childId,
relation: edge.relation
});
}
}
}
if (newDevices > 0) { if (newDevices > 0) {
console.log(`[DiscoveryReconciler] Source ${sourceName} discovered ${newDevices} new devices.`); console.log(`[DiscoveryReconciler] Source ${sourceName} discovered ${newDevices} new devices.`);