Rokad
Gesamte Dokumentation
dhal-Dokumentation

API und v1-Vertrag

Nutzen Sie stabile Exports, Motor, Subpaths und Kompatibilitätsgarantien von Dhal v1.

Repository ansehen
dhal-Dokumentation
Seite 9 von 9

Dhal 1.x bietet einen stabilen Vertrag für Paket, CLI und Konfiguration. Experimentelle Oberflächen werden ausdrücklich gekennzeichnet.

Motor

ts
import { createDhal } from "@rokadhq/dhal";
const protection = createDhal({ configPath: "dhal.json" });

DhalEngine stellt bereit:

  • config: aufgelöste Konfiguration;
  • events: Event-Bus;
  • inspect(request): Sicherheitsentscheidung;
  • recordOutcome(request, outcome): Ergebnis für Credential-Signale;
  • flush(timeoutMs?): Telemetrie leeren;
  • close(timeoutMs?): schließen und leeren;
  • getRuntimeSnapshot(): Zähler und Zustand.

Eine DhalDecision enthält action, statusCode, reason, score und optional ruleId, severity, wouldBlock und meta. Im Monitor-Modus wird eine blockierende Entscheidung mit wouldBlock: true erlaubt.

DhalOptions unterstützt config, configPath, logger, rateLimitStore, signalStore, ipReputationProvider und telemetry.

Stabile Subpaths

  • @rokadhq/dhal
  • @rokadhq/dhal/express
  • @rokadhq/dhal/fastify
  • @rokadhq/dhal/node-http
  • @rokadhq/dhal/stores/redis
  • @rokadhq/dhal/stores/redis-signal
  • @rokadhq/dhal/stores/memory-signal
  • @rokadhq/dhal/reputation/abuseipdb
  • @rokadhq/dhal/telemetry/otel
  • @rokadhq/dhal/telemetry/webhook
  • @rokadhq/dhal/config-schema
  • @rokadhq/dhal/doctor
  • @rokadhq/dhal/rules/catalog
  • @rokadhq/dhal/presets
  • @rokadhq/dhal/report
  • @rokadhq/dhal/compatibility
  • @rokadhq/dhal/readiness
  • @rokadhq/dhal/migrations
  • @rokadhq/dhal/stability
  • @rokadhq/dhal/v1-contract

Maschinenlesbarer Vertrag

ts
import {
  DHAL_V1_PUBLIC_EXPORTS,
  DHAL_V1_CLI_COMMANDS,
  getDhalV1Contract,
  validateDhalV1Contract
} from "@rokadhq/dhal/v1-contract";

Innerhalb von 1.x werden stabile Exports nicht entfernt oder umbenannt, stabile CLI-Befehle bleiben verfügbar, Schema 1 bleibt kompatibel und Deprecations erhalten vor einer künftigen Hauptversion Migrationshinweise.

KI-gestütztes Autosetup ist experimentell.

Upgrade

bash
npm install @rokadhq/dhal@latest
npx dhal migrate --check
npx dhal test-config
npx dhal doctor
npx dhal readiness --production
npx dhal replay fixtures.replay.json

Prüfen Sie das Changelog und behalten Sie einen getesteten Rollback zur vorherigen Version und zum Modus monitor.