perf: clean integration barrel — remove 46 concrete class re-exports

- Remove all concrete integration class re-exports from barrel
- Replace instanceof check with kind check in health-monitoring
- Document cache invalidation as preparatory (cacheTag follow-up)
This commit is contained in:
Thomas Camlong committed 2026-08-07 19:22:32 +02:00
1 parent 451dc3ce39
commit 37930e44cc
4 files changed
+17 -58

No files matched your search

+4
View File
@@ -1,3 +1,7 @@
// ponytail: invalidation is wired now; `cacheTag()` on RSC read paths is Phase 1 follow-up.
// Until reads use `"use cache"` + `cacheTag()`, these calls affect only Next.js-internal
// cached segments (layout shells, static params) via cacheComponents, not cross-request DB queries.
import { revalidateTag } from "next/cache";
import { cacheTags } from "./cache-tags";
@@ -1,6 +1,7 @@
import { describe, expect, test, vi } from "vitest";
import * as homarrDefinitions from "@homarr/definitions";
import type { IntegrationInstanceOfKind } from "@homarr/integrations";
import * as homarrIntegrations from "@homarr/integrations";
import { testConnectionAsync } from "../../integration/integration-test-connection";
@@ -23,7 +24,7 @@ describe("testConnectionAsync should run test connection of integration", () =>
factorySpy.mockReturnValue(
Promise.resolve({
testConnectionAsync: async () => await Promise.resolve({ success: true }),
} as homarrIntegrations.PiHoleIntegrationV6),
} as IntegrationInstanceOfKind<"piHole">),
);
optionsSpy.mockReturnValue([["apiKey"]]);
@@ -66,7 +67,7 @@ describe("testConnectionAsync should run test connection of integration", () =>
factorySpy.mockReturnValue(
Promise.resolve({
testConnectionAsync: async () => await Promise.resolve({ success: true }),
} as homarrIntegrations.PiHoleIntegrationV6),
} as IntegrationInstanceOfKind<"piHole">),
);
optionsSpy.mockReturnValue([["apiKey"]]);
@@ -116,7 +117,7 @@ describe("testConnectionAsync should run test connection of integration", () =>
factorySpy.mockReturnValue(
Promise.resolve({
testConnectionAsync: async () => await Promise.resolve({ success: true }),
} as homarrIntegrations.PiHoleIntegrationV6),
} as IntegrationInstanceOfKind<"piHole">),
);
optionsSpy.mockReturnValue([["apiKey"]]);
@@ -166,7 +167,7 @@ describe("testConnectionAsync should run test connection of integration", () =>
factorySpy.mockReturnValue(
Promise.resolve({
testConnectionAsync: async () => await Promise.resolve({ success: true }),
} as homarrIntegrations.PiHoleIntegrationV6),
} as IntegrationInstanceOfKind<"piHole">),
);
optionsSpy.mockReturnValue([["username", "password"], ["apiKey"]]);
@@ -220,7 +221,7 @@ describe("testConnectionAsync should run test connection of integration", () =>
factorySpy.mockReturnValue(
Promise.resolve({
testConnectionAsync: async () => await Promise.resolve({ success: true }),
} as homarrIntegrations.PiHoleIntegrationV6),
} as IntegrationInstanceOfKind<"piHole">),
);
optionsSpy.mockReturnValue([["username", "password"], ["apiKey"]]);
@@ -1,5 +1,4 @@
import { createIntegrationAsync } from "@homarr/integrations";
import { SynologyIntegration } from "@homarr/integrations";
import { clusterInfoRequestHandler, systemInfoRequestHandler } from "@homarr/request-handler/health-monitoring";
import { createManyIntegrationMiddleware, createOneIntegrationMiddleware } from "../../middlewares/integration";
@@ -51,11 +50,12 @@ export const healthMonitoringRouter = createTRPCRouter({
})
.concat(createOneIntegrationMiddleware("query", "synology"))
.query(async ({ ctx }) => {
const integrationInstance = await createIntegrationAsync(ctx.integration);
if (!(integrationInstance instanceof SynologyIntegration)) {
if (ctx.integration.kind !== "synology") {
throw new Error("Expected Synology integration");
}
const integrationInstance = await createIntegrationAsync(ctx.integration);
return await integrationInstance.listStorageVolumesAsync();
}),
getClusterHealthStatus: publicProcedure