Socket
Book a DemoInstallSign in
Socket

@orama/oramacore-events-parser

Package Overview
Dependencies
Maintainers
8
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@orama/oramacore-events-parser

JavaScript and TypeScript client for OramaCore

latest
Source
npmnpm
Version
0.0.5
Version published
Maintainers
8
Created
Source

@orama/oramacore-events-parser

A JavaScript/TypeScript library for parsing OramaCore Server-Sent Events (SSE) streams, with a simple, strongly-typed event subscription API.

Features

  • Parse SSE streams from OramaCore's /generate/answer and /generate/nlp_query endpoints
  • Subscribe to specific event types with .on('event_name', handler)
  • Statically-typed helpers: .onStateChange(handler) and .onProgress(handler)

Installation

npm i @orama/oramacore-events-parser

Usage

Parse Answer Stream

const emitter = parseAnswerStream(response.body!);

emitter.on('answer_token', (event) => {
  console.log('Token:', event.token);
});

emitter.onStateChange((event) => {
  console.log('State changed:', event.state, event.message);
});

emitter.onProgress((event) => {
  console.log('Progress:', event.current_step, '/', event.total_steps);
});

Parse NLP Query Stream

const emitter = parseNLPQueryStream(response.body!);

emitter.on('search_results', (event) => {
  console.log('Results:', event.results);
});

emitter.onStateChange((event) => {
  console.log('State changed:', event.state, event.message);
});

API

  • .on(eventName, handler) — Subscribe to any event type
  • .onStateChange(handler) — Subscribe to state_changed events (typed)
  • .onProgress(handler) — Subscribe to progress events (typed)

License

AGPLv3

FAQs

Package last updated on 23 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts