CI / Web-Barrierefreiheitspruefung (axe, Tastatur, Reflow, Textabstaende) (push) Canceled after 0s
CI / Web-Barrierefreiheitspruefung (axe, Tastatur, Reflow, Textabstaende) (pull_request) Canceled after 0s
CI / Core-Modul (Build/Vet/Test) (push) Successful in 40s
CI / DMS Security-Test-Gate (AC5, Merge-Gate) (push) Successful in 2s
CI / Connect Security-Test-Gate (QA-01 AC4, Merge-Gate) (push) Successful in 3s
CI / DMS-Modul Supply-Chain-Scan (govulncheck) (push) Failing after 14s
CI / Web (dms-browser) (push) Failing after 49s
CI / Web (pdf-viewer) (push) Failing after 37s
CI / Web (shl) (push) Failing after 8s
Supply-Chain-Scan (Go) / govulncheck (push) Failing after 42s
CI / Core-Modul (Build/Vet/Test) (pull_request) Successful in 41s
CI / DMS Security-Test-Gate (AC5, Merge-Gate) (pull_request) Successful in 3s
CI / Connect Security-Test-Gate (QA-01 AC4, Merge-Gate) (pull_request) Successful in 2s
CI / DMS-Modul Supply-Chain-Scan (govulncheck) (pull_request) Failing after 16s
CI / Web (dms-browser) (pull_request) Failing after 55s
CI / Web (pdf-viewer) (pull_request) Failing after 38s
CI / Web (shl) (pull_request) Failing after 8s
Core-Schnittstellen-Vertragstests / contract-tests (pull_request) Successful in 22m20s
Supply-Chain-Scan (Go) / govulncheck (pull_request) Failing after 1m3s
Supply-Chain-Scan (npm) / npm-audit (pull_request) Failing after 1m54s
Core-Pflichttest-Gate / pflichttest-gate (pull_request) Successful in 23m46s
RBAC-Rollenhierarchie-Pflichtgate / rbac-policy-invariant (pull_request) Successful in 23m56s
DB-Integrationstests / db-tests (pull_request) Canceled after 0s
CI / DMS-Modul (Lint/Build/Test/Coverage/Artefakt) (pull_request) Canceled after 0s
CI / DMS-Modul (Lint/Build/Test/Coverage/Artefakt) (push) Canceled after 0s
connect/internal/bearerauth (wie workflow): verifiziertes Core-Token setzt
X-User-Id/X-Tenant-Slug, ohne Token nur mit NEXARCH_CONNECT_APP_ALLOW_HEADER_AUTH=1.
Mit JWKS ist NEXARCH_CONNECT_APP_TENANT_SLUG Pflicht (Mandant der Datenbank).
common auf v0.2.1 (moduleauth). Frontends nutzen createBearerClient("connect").
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
66 lines
2.0 KiB
TypeScript
66 lines
2.0 KiB
TypeScript
// Duenner Client fuer API-02 (connect/internal/statusapi) — enthaelt keine
|
|
// eigene Statuslogik, nur Datenabruf. Identitaet kommt uebergangsweise (wie
|
|
// bei workflow/approvalapi vor der zentralen Core-JWT-Anbindung) aus
|
|
// Umgebungsvariablen, die als Header durchgereicht werden.
|
|
|
|
import { apiFetch, bearerEnabled } from "./http";
|
|
|
|
export class UnauthorizedError extends Error {}
|
|
export class ApiError extends Error {}
|
|
|
|
function apiBase(): string {
|
|
const base = process.env.NEXT_PUBLIC_CONNECT_API_URL;
|
|
if (!base) {
|
|
throw new Error("NEXT_PUBLIC_CONNECT_API_URL ist nicht gesetzt (Umgebungsvariable erforderlich)");
|
|
}
|
|
return base;
|
|
}
|
|
|
|
function identityHeaders(): Record<string, string> {
|
|
if (bearerEnabled()) return {};
|
|
const userID = process.env.NEXT_PUBLIC_USER_ID;
|
|
const tenant = process.env.NEXT_PUBLIC_TENANT_SLUG;
|
|
const headers: Record<string, string> = {};
|
|
if (userID) headers["X-User-Id"] = userID;
|
|
if (tenant) headers["X-Tenant-Slug"] = tenant;
|
|
return headers;
|
|
}
|
|
|
|
async function req<T>(path: string, init?: RequestInit): Promise<T> {
|
|
const res = await apiFetch(`${apiBase()}${path}`, {
|
|
...init,
|
|
headers: {
|
|
...identityHeaders(),
|
|
...init?.headers,
|
|
},
|
|
});
|
|
if (res.status === 401) {
|
|
throw new UnauthorizedError("Anmeldung erforderlich, um den Verbindungsstatus zu sehen.");
|
|
}
|
|
if (!res.ok) {
|
|
const body = await res.json().catch(() => ({}));
|
|
throw new ApiError(body.error ?? `Anfrage fehlgeschlagen (${res.status})`);
|
|
}
|
|
return res.json().catch(() => undefined as T);
|
|
}
|
|
|
|
export type RunStatus = "running" | "succeeded" | "failed" | "retry_pending";
|
|
|
|
export interface ConnectorStatus {
|
|
job_id: string;
|
|
connector_name: string;
|
|
connector_instance_id: string;
|
|
interval_seconds: number;
|
|
next_run_at: string;
|
|
last_run_id?: string;
|
|
last_run_status?: RunStatus;
|
|
last_run_trigger?: "scheduled" | "manual";
|
|
last_run_started_at?: string;
|
|
last_run_finished_at?: string;
|
|
last_error?: string;
|
|
}
|
|
|
|
export function fetchConnectorStatus(): Promise<ConnectorStatus[]> {
|
|
return req("/connectors/status");
|
|
}
|