45 lines
1.9 KiB
TypeScript
45 lines
1.9 KiB
TypeScript
import { setupServer } from "msw/node";
|
|
import { http, HttpResponse } from "msw";
|
|
import type { CatalogMetrics } from "../api/catalog-databases";
|
|
import type { WorkspacePreprocessingStatus } from "../api/workspace-preprocessing";
|
|
|
|
export const emptyCatalogMetricsFixture = {
|
|
scope: "global",
|
|
databaseId: null,
|
|
tables: 0,
|
|
columns: 0,
|
|
sensitiveColumns: 0,
|
|
relationships: 0,
|
|
descriptionTargets: 0,
|
|
describedTargets: 0,
|
|
descriptionCoverage: 0,
|
|
updatedAt: null,
|
|
} satisfies CatalogMetrics;
|
|
|
|
export const server = setupServer(
|
|
http.get("/api/auth/config", () => HttpResponse.json({ mode: "local", localLogin: true, oidcLogin: false })),
|
|
http.get("/api/me", () => HttpResponse.json({
|
|
issuer: "mock", subject: "test-user", displayName: "Test user", roles: ["admin"],
|
|
permissions: [
|
|
"session.use", "session.read_all", "session.manage_all", "settings.manage",
|
|
"workspace.manage", "workspace.secrets.manage", "database.manage", "pi.manage", "auth.diagnostics.read",
|
|
], isAdmin: true, csrfToken: "c".repeat(43), session: null,
|
|
})),
|
|
http.get("/api/health/dwh", () => HttpResponse.json({ ok: true, detail: "ok" })),
|
|
http.get("/api/catalog/databases", () => HttpResponse.json([])),
|
|
http.get("/api/catalog/metrics", () => HttpResponse.json(emptyCatalogMetricsFixture)),
|
|
http.get("/api/catalog/metadata-generation/models", () => HttpResponse.json({ models: [], default: null })),
|
|
http.get("/api/catalog/description-generation-runs", () => HttpResponse.json([])),
|
|
http.get("/api/catalog/sensitive-data-suggestion-runs", () => HttpResponse.json([])),
|
|
http.get("/api/workspaces/:workspaceId/preprocessing", ({ params }) => HttpResponse.json({
|
|
schemaVersion: 1,
|
|
workspaceId: String(params.workspaceId),
|
|
state: "ready",
|
|
actionable: true,
|
|
clearable: true,
|
|
detail: "Catalog revision 1 is indexed.",
|
|
metadataRevision: 1,
|
|
preprocessedMetadataRevision: 1,
|
|
} satisfies WorkspacePreprocessingStatus)),
|
|
);
|