Update hivegrid-cloud reference to latest main

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
davidandClaude Fable 5 committed 2026-07-08 16:15:37 +02:00
1 parent e98d38e716
commit 7b21524c86
3781 files changed
+373484 -225607

No files matched your search

@@ -1,4 +1,4 @@
import { IpAddressLog } from "@toolctrl/db/prisma-browser";
import { IpAddressLog } from "@hivegrid/db/prisma-browser";
import Constants from "~/application/Constants";
import { PaginationDto } from "~/application/dtos/data/PaginationDto";
import { db } from "~/utils/db.server";
@@ -1,4 +1,4 @@
import { IpAddress } from "@toolctrl/db/prisma-browser";
import { IpAddress } from "@hivegrid/db/prisma-browser";
import Constants from "~/application/Constants";
import { PaginationDto } from "~/application/dtos/data/PaginationDto";
import { db } from "~/utils/db.server";
@@ -0,0 +1,34 @@
import type { TFunction } from "i18next";
import { describe, expect, it } from "vitest";
import {
translateIpAddressLogAction,
translateIpAddressLogDescription,
translateIpAddressLogError,
} from "./ipAddressLogLabels";
const t = ((key: string, options?: Record<string, unknown>) => (options?.value ? `${key}:${String(options.value)}` : key)) as TFunction;
describe("IP address log labels", () => {
it("translates known action codes and wraps unknown values in a semantic key", () => {
expect(translateIpAddressLogAction(t, "login")).toBe("admin.accounts.ipAddresses.logs.actions.login");
expect(translateIpAddressLogAction(t, "register")).toBe("admin.accounts.ipAddresses.logs.actions.register");
expect(translateIpAddressLogAction(t, "reset")).toBe("admin.accounts.ipAddresses.logs.actions.reset");
expect(translateIpAddressLogAction(t, "forgot-password")).toBe("admin.accounts.ipAddresses.logs.actions.forgotPassword");
expect(translateIpAddressLogAction(t, "reset-password")).toBe("admin.accounts.ipAddresses.logs.actions.resetPassword");
expect(translateIpAddressLogAction(t, " custom-action ")).toBe("admin.accounts.ipAddresses.logs.actions.unknownWithValue:custom-action");
expect(translateIpAddressLogAction(t, " ")).toBe("");
});
it("translates known description codes and wraps unknown values in a semantic key", () => {
expect(translateIpAddressLogDescription(t, "registration-attempt")).toBe("admin.accounts.ipAddresses.logs.descriptions.registrationAttempt");
expect(translateIpAddressLogDescription(t, "{empty email}")).toBe("admin.accounts.ipAddresses.logs.descriptions.emptyEmail");
expect(translateIpAddressLogDescription(t, "custom description")).toBe("admin.accounts.ipAddresses.logs.descriptions.unknownWithValue:custom description");
expect(translateIpAddressLogDescription(t, null)).toBe("");
});
it("translates known error codes and wraps unknown values in a semantic key", () => {
expect(translateIpAddressLogError(t, "blacklisted")).toBe("admin.accounts.ipAddresses.errors.blacklisted");
expect(translateIpAddressLogError(t, "Unauthorized.")).toBe("admin.accounts.ipAddresses.errors.unauthorized");
expect(translateIpAddressLogError(t, "provider error")).toBe("admin.accounts.ipAddresses.errors.unknownWithValue:provider error");
});
});
@@ -0,0 +1,52 @@
import type { TFunction } from "i18next";
export function translateIpAddressLogAction(t: TFunction, action?: string | null) {
const normalized = action?.trim();
if (!normalized) {
return "";
}
if (normalized === "login") {
return t("admin.accounts.ipAddresses.logs.actions.login");
}
if (normalized === "register") {
return t("admin.accounts.ipAddresses.logs.actions.register");
}
if (normalized === "reset") {
return t("admin.accounts.ipAddresses.logs.actions.reset");
}
if (normalized === "forgot-password") {
return t("admin.accounts.ipAddresses.logs.actions.forgotPassword");
}
if (normalized === "reset-password") {
return t("admin.accounts.ipAddresses.logs.actions.resetPassword");
}
return t("admin.accounts.ipAddresses.logs.actions.unknownWithValue", { value: normalized });
}
export function translateIpAddressLogDescription(t: TFunction, description?: string | null) {
const normalized = description?.trim();
if (!normalized) {
return "";
}
if (normalized === "registration-attempt") {
return t("admin.accounts.ipAddresses.logs.descriptions.registrationAttempt");
}
if (normalized === "{empty email}") {
return t("admin.accounts.ipAddresses.logs.descriptions.emptyEmail");
}
return t("admin.accounts.ipAddresses.logs.descriptions.unknownWithValue", { value: normalized });
}
export function translateIpAddressLogError(t: TFunction, error?: string | null) {
const normalized = error?.trim();
if (!normalized) {
return "";
}
if (normalized === "blacklisted" || normalized === "Blacklisted") {
return t("admin.accounts.ipAddresses.errors.blacklisted");
}
if (normalized === "unauthorized" || normalized === "Unauthorized" || normalized === "Unauthorized.") {
return t("admin.accounts.ipAddresses.errors.unauthorized");
}
return t("admin.accounts.ipAddresses.errors.unknownWithValue", { value: normalized });
}
@@ -72,7 +72,7 @@ describe("IpAddressServiceServer", () => {
});
it("speichert nur den IP-Hash, nie die Klartext-IP (AD-22)", async () => {
const request = new Request("https://admin.boiler.saas-ctrl.com/login");
const request = new Request("https://admin.hivegrid.de/login");
await expect(
IpAddressServiceServer.log(request, { action: "login", description: "admin@example.com" })
@@ -89,7 +89,7 @@ describe("IpAddressServiceServer", () => {
});
it("ersetzt die Request-IP nicht durch eine fixe Dev-Adresse", async () => {
const request = new Request("https://admin.boiler.saas-ctrl.com/login");
const request = new Request("https://admin.hivegrid.de/login");
await expect(
IpAddressServiceServer.log(request, { action: "login", description: "admin@example.com" })
@@ -101,7 +101,7 @@ describe("IpAddressServiceServer", () => {
it("speichert stabile blacklisted-Fehlercodes mit gehashter IP", async () => {
findInBlacklistMock.mockResolvedValue({ id: "blacklist_1" } as never);
const request = new Request("https://admin.boiler.saas-ctrl.com/login");
const request = new Request("https://admin.hivegrid.de/login");
await expect(
IpAddressServiceServer.log(request, { action: "login", description: "admin@example.com" })
@@ -135,7 +135,7 @@ describe("IpAddressServiceServer", () => {
createdAt: new Date("2026-01-01T00:00:00.000Z"),
updatedAt: new Date("2026-01-01T00:00:00.000Z"),
});
const request = new Request("https://admin.boiler.saas-ctrl.com/login");
const request = new Request("https://admin.hivegrid.de/login");
await expect(
IpAddressServiceServer.log(request, { action: "login", description: "admin@example.com" })
@@ -4,7 +4,7 @@ import { cachified, clearCacheKey } from "~/utils/cache.server";
import { db } from "~/utils/db.server";
import { addBlacklistAttempt, addToBlacklist, findInBlacklist } from "~/utils/db/blacklist.db.server";
import { createScopedLogger } from "~/utils/logger.server";
import type { IpAddress } from "@toolctrl/db/prisma-browser";
import type { IpAddress } from "@hivegrid/db/prisma-browser";
import { hashIp, lookupCountry } from "./geoip.server";
const ipAddressLogger = createScopedLogger("ipAddress");
@@ -1,6 +1,6 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
vi.mock("@toolctrl/config", () => ({
vi.mock("@hivegrid/config", () => ({
loadWebConfig: vi.fn(() => ({ config: { ipGeo: { hashPepper: "test-pepper", dbPath: undefined } } })),
}));
vi.mock("~/utils/logger.server", () => ({
@@ -9,7 +9,7 @@ vi.mock("~/utils/logger.server", () => ({
import { createHmac } from "node:crypto";
import { hashIp, lookupCountry, __resetGeoipReaderForTests } from "./geoip.server";
import { loadWebConfig } from "@toolctrl/config";
import { loadWebConfig } from "@hivegrid/config";
describe("geoip.hashIp", () => {
beforeEach(() => {
@@ -1,6 +1,6 @@
import { createHash, createHmac } from "node:crypto";
import { open } from "maxmind";
import { loadWebConfig } from "@toolctrl/config";
import { loadWebConfig } from "@hivegrid/config";
import { createScopedLogger } from "~/utils/logger.server";
/**