rename(phase 1): CapaKraken → Nexus across code, UI, docs, CI (#61)
CI / Architecture Guardrails (push) Successful in 2m38s
CI / Assistant Split Regression (push) Successful in 3m33s
CI / Typecheck (push) Successful in 3m51s
CI / Lint (push) Successful in 5m2s
CI / E2E Tests (push) Has been cancelled
CI / Fresh-Linux Docker Deploy (push) Has been cancelled
CI / Release Images (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Architecture Guardrails (push) Successful in 2m38s
CI / Assistant Split Regression (push) Successful in 3m33s
CI / Typecheck (push) Successful in 3m51s
CI / Lint (push) Successful in 5m2s
CI / E2E Tests (push) Has been cancelled
CI / Fresh-Linux Docker Deploy (push) Has been cancelled
CI / Release Images (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
rename(phase 1): CapaKraken → Nexus across code, UI, docs, CI (#61) Co-authored-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com> Co-committed-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com>
This commit was merged in pull request #61.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { prisma } from "@capakraken/db";
|
||||
import { prisma } from "@nexus/db";
|
||||
|
||||
/** Window over which auth events are analysed. */
|
||||
const WINDOW_MS = 30 * 60 * 1000; // 30 minutes
|
||||
|
||||
@@ -17,7 +17,7 @@ import { THRESHOLDS } from "./detect.js";
|
||||
const auditLogFindManyMock = vi.hoisted(() => vi.fn());
|
||||
const userFindManyMock = vi.hoisted(() => vi.fn());
|
||||
|
||||
vi.mock("@capakraken/db", () => ({
|
||||
vi.mock("@nexus/db", () => ({
|
||||
prisma: {
|
||||
auditLog: { findMany: auditLogFindManyMock },
|
||||
user: { findMany: userFindManyMock },
|
||||
@@ -27,11 +27,11 @@ vi.mock("@capakraken/db", () => ({
|
||||
// ─── createNotificationsForUsers mock ─────────────────────────────────────────
|
||||
const createNotificationsMock = vi.hoisted(() => vi.fn().mockResolvedValue(undefined));
|
||||
|
||||
vi.mock("@capakraken/api", () => ({
|
||||
vi.mock("@nexus/api", () => ({
|
||||
createNotificationsForUsers: createNotificationsMock,
|
||||
}));
|
||||
|
||||
vi.mock("@capakraken/api/lib/logger", () => ({
|
||||
vi.mock("@nexus/api/lib/logger", () => ({
|
||||
logger: { warn: vi.fn(), error: vi.fn(), info: vi.fn() },
|
||||
}));
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@capakraken/db";
|
||||
import { createNotificationsForUsers } from "@capakraken/api";
|
||||
import { logger } from "@capakraken/api/lib/logger";
|
||||
import { prisma } from "@nexus/db";
|
||||
import { createNotificationsForUsers } from "@nexus/api";
|
||||
import { logger } from "@nexus/api/lib/logger";
|
||||
import { verifyCronSecret } from "~/lib/cron-auth.js";
|
||||
import { detectAuthAnomalies } from "./detect.js";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@capakraken/db";
|
||||
import { checkChargeabilityAlerts } from "@capakraken/api";
|
||||
import { logger } from "@capakraken/api/lib/logger";
|
||||
import { prisma } from "@nexus/db";
|
||||
import { checkChargeabilityAlerts } from "@nexus/api";
|
||||
import { logger } from "@nexus/api/lib/logger";
|
||||
import { verifyCronSecret } from "~/lib/cron-auth.js";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@capakraken/db";
|
||||
import { checkPendingEstimateReminders } from "@capakraken/api";
|
||||
import { logger } from "@capakraken/api/lib/logger";
|
||||
import { prisma } from "@nexus/db";
|
||||
import { checkPendingEstimateReminders } from "@nexus/api";
|
||||
import { logger } from "@nexus/api/lib/logger";
|
||||
import { verifyCronSecret } from "~/lib/cron-auth.js";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@capakraken/db";
|
||||
import { createNotificationsForUsers } from "@capakraken/api";
|
||||
import { logger } from "@capakraken/api/lib/logger";
|
||||
import { prisma } from "@nexus/db";
|
||||
import { createNotificationsForUsers } from "@nexus/api";
|
||||
import { logger } from "@nexus/api/lib/logger";
|
||||
import { createConnection } from "net";
|
||||
import { verifyCronSecret } from "~/lib/cron-auth.js";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@capakraken/db";
|
||||
import { autoImportPublicHolidays } from "@capakraken/api";
|
||||
import { logger } from "@capakraken/api/lib/logger";
|
||||
import { prisma } from "@nexus/db";
|
||||
import { autoImportPublicHolidays } from "@nexus/api";
|
||||
import { logger } from "@nexus/api/lib/logger";
|
||||
import { verifyCronSecret } from "~/lib/cron-auth.js";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
@@ -45,10 +45,10 @@ export async function GET(request: Request) {
|
||||
skippedExisting: result.skippedExisting,
|
||||
});
|
||||
} catch (error) {
|
||||
logger.error({ error, route: "/api/cron/public-holidays", year }, "Public holiday import cron failed");
|
||||
return NextResponse.json(
|
||||
{ ok: false, error: "Internal error" },
|
||||
{ status: 500 },
|
||||
logger.error(
|
||||
{ error, route: "/api/cron/public-holidays", year },
|
||||
"Public holiday import cron failed",
|
||||
);
|
||||
return NextResponse.json({ ok: false, error: "Internal error" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@capakraken/db";
|
||||
import { createNotificationsForUsers } from "@capakraken/api";
|
||||
import { logger } from "@capakraken/api/lib/logger";
|
||||
import { prisma } from "@nexus/db";
|
||||
import { createNotificationsForUsers } from "@nexus/api";
|
||||
import { logger } from "@nexus/api/lib/logger";
|
||||
import { readFileSync } from "fs";
|
||||
import { join } from "path";
|
||||
import { verifyCronSecret } from "~/lib/cron-auth.js";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@capakraken/db";
|
||||
import { sendWeeklyDigest } from "@capakraken/api";
|
||||
import { logger } from "@capakraken/api/lib/logger";
|
||||
import { prisma } from "@nexus/db";
|
||||
import { sendWeeklyDigest } from "@nexus/api";
|
||||
import { logger } from "@nexus/api/lib/logger";
|
||||
import { verifyCronSecret } from "~/lib/cron-auth.js";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@capakraken/db";
|
||||
import { prisma } from "@nexus/db";
|
||||
import { createConnection } from "net";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
@@ -30,8 +30,14 @@ async function checkRedis(): Promise<"ok" | "error"> {
|
||||
socket.destroy();
|
||||
resolve(data.toString().includes("PONG") ? "ok" : "error");
|
||||
});
|
||||
socket.on("timeout", () => { socket.destroy(); resolve("error"); });
|
||||
socket.on("error", () => { socket.destroy(); resolve("error"); });
|
||||
socket.on("timeout", () => {
|
||||
socket.destroy();
|
||||
resolve("error");
|
||||
});
|
||||
socket.on("error", () => {
|
||||
socket.destroy();
|
||||
resolve("error");
|
||||
});
|
||||
} catch {
|
||||
resolve("error");
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
vi.mock("@capakraken/api/sse", () => ({
|
||||
vi.mock("@nexus/api/sse", () => ({
|
||||
eventBus: { subscriberCount: 0 },
|
||||
}));
|
||||
|
||||
@@ -33,7 +33,7 @@ describe("GET /api/perf — security hardening", () => {
|
||||
const response = await GET(request);
|
||||
expect(response.status).toBe(200);
|
||||
|
||||
const body = await response.json() as { timestamp: string; uptime: unknown; memory: unknown };
|
||||
const body = (await response.json()) as { timestamp: string; uptime: unknown; memory: unknown };
|
||||
expect(typeof body.timestamp).toBe("string");
|
||||
expect(body.uptime).toBeDefined();
|
||||
expect(body.memory).toBeDefined();
|
||||
@@ -81,7 +81,11 @@ describe("GET /api/perf — security hardening", () => {
|
||||
const response = await GET(request);
|
||||
expect(response.status).toBe(401);
|
||||
|
||||
const body = await response.json() as { error?: string; timestamp?: string; memory?: unknown };
|
||||
const body = (await response.json()) as {
|
||||
error?: string;
|
||||
timestamp?: string;
|
||||
memory?: unknown;
|
||||
};
|
||||
expect(body.timestamp).toBeUndefined();
|
||||
expect(body.memory).toBeUndefined();
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { eventBus } from "@capakraken/api/sse";
|
||||
import { eventBus } from "@nexus/api/sse";
|
||||
import { verifyCronSecret } from "~/lib/cron-auth.js";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@capakraken/db";
|
||||
import { prisma } from "@nexus/db";
|
||||
import { createConnection } from "net";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
@@ -18,7 +18,7 @@ async function checkPostgres(): Promise<"ok" | "error"> {
|
||||
|
||||
/**
|
||||
* Lightweight Redis PING check using a raw TCP socket.
|
||||
* Avoids importing ioredis (which is only a dependency of @capakraken/api).
|
||||
* Avoids importing ioredis (which is only a dependency of @nexus/api).
|
||||
*/
|
||||
async function checkRedis(): Promise<"ok" | "error"> {
|
||||
return new Promise((resolve) => {
|
||||
@@ -58,10 +58,7 @@ async function checkRedis(): Promise<"ok" | "error"> {
|
||||
}
|
||||
|
||||
export async function GET() {
|
||||
const [postgres, redis] = await Promise.all([
|
||||
checkPostgres(),
|
||||
checkRedis(),
|
||||
]);
|
||||
const [postgres, redis] = await Promise.all([checkPostgres(), checkRedis()]);
|
||||
|
||||
const allHealthy = postgres === "ok" && redis === "ok";
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ const authMock = vi.hoisted(() => vi.fn());
|
||||
vi.mock("~/server/auth.js", () => ({ auth: authMock }));
|
||||
|
||||
// ─── heavy dep stubs ─────────────────────────────────────────────────────────
|
||||
vi.mock("@capakraken/db", () => ({
|
||||
vi.mock("@nexus/db", () => ({
|
||||
prisma: {
|
||||
demandRequirement: { findMany: vi.fn().mockResolvedValue([]) },
|
||||
assignment: { findMany: vi.fn().mockResolvedValue([]) },
|
||||
@@ -21,11 +21,11 @@ vi.mock("@capakraken/db", () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("@capakraken/application", () => ({
|
||||
vi.mock("@nexus/application", () => ({
|
||||
buildSplitAllocationReadModel: vi.fn().mockReturnValue({ assignments: [] }),
|
||||
}));
|
||||
|
||||
vi.mock("@capakraken/api", () => ({
|
||||
vi.mock("@nexus/api", () => ({
|
||||
anonymizeResource: vi.fn((r: unknown) => r),
|
||||
getAnonymizationDirectory: vi.fn().mockResolvedValue({}),
|
||||
}));
|
||||
|
||||
@@ -2,10 +2,10 @@ import { renderToBuffer } from "@react-pdf/renderer";
|
||||
import { createElement } from "react";
|
||||
import { NextResponse } from "next/server";
|
||||
import { z } from "zod";
|
||||
import { buildSplitAllocationReadModel } from "@capakraken/application";
|
||||
import { anonymizeResource, getAnonymizationDirectory } from "@capakraken/api";
|
||||
import { prisma } from "@capakraken/db";
|
||||
import type { AllocationLike } from "@capakraken/shared";
|
||||
import { buildSplitAllocationReadModel } from "@nexus/application";
|
||||
import { anonymizeResource, getAnonymizationDirectory } from "@nexus/api";
|
||||
import { prisma } from "@nexus/db";
|
||||
import type { AllocationLike } from "@nexus/shared";
|
||||
import { auth } from "~/server/auth.js";
|
||||
import { AllocationReport } from "~/components/reports/AllocationReport.js";
|
||||
import { createWorkbookArrayBuffer } from "~/lib/workbook-export.js";
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { loadRoleDefaults } from "@capakraken/api";
|
||||
import { deriveUserSseSubscription, eventBus } from "@capakraken/api/sse";
|
||||
import { startReminderScheduler } from "@capakraken/api/lib/reminder-scheduler";
|
||||
import { prisma } from "@capakraken/db";
|
||||
import type { SystemRole } from "@capakraken/shared";
|
||||
import { SSE_EVENT_TYPES, type PermissionOverrides } from "@capakraken/shared";
|
||||
import { loadRoleDefaults } from "@nexus/api";
|
||||
import { deriveUserSseSubscription, eventBus } from "@nexus/api/sse";
|
||||
import { startReminderScheduler } from "@nexus/api/lib/reminder-scheduler";
|
||||
import { prisma } from "@nexus/db";
|
||||
import type { SystemRole } from "@nexus/shared";
|
||||
import { SSE_EVENT_TYPES, type PermissionOverrides } from "@nexus/shared";
|
||||
import { auth } from "~/server/auth.js";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createTRPCContext, loadRoleDefaults } from "@capakraken/api";
|
||||
import { appRouter } from "@capakraken/api/router";
|
||||
import { prisma } from "@capakraken/db";
|
||||
import { createTRPCContext, loadRoleDefaults } from "@nexus/api";
|
||||
import { appRouter } from "@nexus/api/router";
|
||||
import { prisma } from "@nexus/db";
|
||||
import { fetchRequestHandler } from "@trpc/server/adapters/fetch";
|
||||
import { getToken } from "next-auth/jwt";
|
||||
import type { NextRequest } from "next/server";
|
||||
|
||||
Reference in New Issue
Block a user