Installation

Core ist framework-unabhängig, und die Funktionen von Next.js und RSocket werden nur importiert, wenn sie verwendet werden.


npm installieren

bash
npm i @byeolnaerim/typed-rx-http rxjs

Core (framework-unabhängig)

ts
import {
  createHttpClient,
  createHeaderStore,
  createCsrCache,
  createSessionAuth,
  HttpResponseError,
  isHttpResponseError,
  type ServiceArguments,
  type CacheForService,
} from "@byeolnaerim/typed-rx-http";

Allgemeine HTTP-Anfragen, NDJSON-Streaming, HeaderStore, Sitzungsauthentifizierung und CSR-Cache sind im Standard-Einstiegspunkt enthalten. Core kann auch ohne Next.js verwendet werden.

Next.js Adapter (optional)

ts
import {
  callApiSsrCache,
  redirectToUnauthorizedOnServer401,
} from "@byeolnaerim/typed-rx-http/next";

RSocket Adapter (optional)

Installieren Sie das Peer-Paket nur in Projekten, die RSocket verwenden.

bash
npm i rsocket-core rsocket-types rsocket-websocket-client
ts
import { createRSocketApi } from "@byeolnaerim/typed-rx-http/rsocket";

const api = createRSocketApi("ws://localhost:7000/rsocket", jwt);

api.mono<User>("user.findById", { id: 1 }).subscribe((user) => {
  console.log(user);
});

api.stream<Notification>("notification.stream").subscribe((notification) => {
  console.log(notification);
});

OpenAPI/Swagger Auto Node Script (optional)

Zusätzlich zum Laufzeit-HTTP-Client enthält das Node-Skript, das TypeScript-Typen und Service-Dateien aus OpenAPI/Swagger JSON generiert. Diese Funktion ist optional und nicht erforderlich für die Verwendung von Core, /next, /rsocket.

ts
import {
  connectToSwaggerEventStream,
  generateSwaggerFromHttp,
  generateSwaggerFromFile,
} from "@byeolnaerim/typed-rx-http/auto-node-script/openapi";
© 2026 Byeolnaerim. Alle Rechte vorbehalten.EinführungDatenschutzrichtlinie