npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@alt-javascript/camel-lite-core

v1.1.1

Published

[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](../../LICENSE)

Readme

camel-lite-core

License: MIT

Core framework for camel-lite — the CamelContext, routing DSL, Exchange, Pipeline, ProducerTemplate, ConsumerTemplate, and RouteLoader.

Install

npm install camel-lite-core

Quick Start

import { CamelContext, RouteBuilder, ProducerTemplate } from 'camel-lite-core';
import { DirectComponent } from 'camel-lite-component-direct';

const context = new CamelContext();
context.addComponent('direct', new DirectComponent());

const builder = new RouteBuilder();
builder.from('direct:hello')
  .process(ex => { ex.in.body = `Hello, ${ex.in.body}!`; });

context.addRoutes(builder);
await context.start();

const pt = new ProducerTemplate(context);
const exchange = await pt.sendBody('direct:hello', 'world');
console.log(exchange.in.body); // Hello, world!

await context.stop();

RouteDefinition DSL

| Method | Description | |---|---| | process(fn\|obj) | Run a processor — async fn(exchange) or { process(exchange) } | | to(uri) | Send to another endpoint | | filter(expr) | Stop processing if predicate returns false | | transform(expr) | Replace body with expression result | | setBody(expr) | Set exchange.in.body | | setHeader(name, expr) | Set a header | | setProperty(name, expr) | Set an exchange property | | removeHeader(name) | Remove a header | | choice() | Content-based router — .when(expr).to(uri)…​.otherwise().to(uri).end() | | split(expr) | Split body into sub-exchanges | | aggregate(expr, strategy) | Aggregate sub-exchanges | | marshal(format) | Serialise body (default: json) | | unmarshal(format) | Deserialise body | | convertBodyTo(type) | Convert body type | | bean(name) | Invoke named bean from context | | log(expr) | Log expression result | | stop() | Stop processing | | deadLetterChannel(uri) | Route failed exchanges to this URI | | onException(ErrorClass) | Handle a specific exception type |

Expressions

import { simple, js, constant } from 'camel-lite-core';

simple('${body}')                    // exchange body
simple('${header.X-Auth}')           // header value
simple('${exchangeProperty.key}')    // exchange property
js('exchange.in.body.toUpperCase()') // arbitrary JS via new Function()
constant('fixed value')              // literal constant

Note: simple() does not support mixed literal + token strings (e.g. 'Prefix: ${body}'). Use js() or a process() step for string building. See ADR-006.

RouteLoader

import { RouteLoader } from 'camel-lite-core';

// From file — extension auto-detects format (.yaml/.yml/.json); unknown → content-sniff
const builder = await RouteLoader.loadFile('routes.yaml');

// From readable stream — content-sniffed (use for stdin or HTTP responses)
const builder = await RouteLoader.loadStream(process.stdin);

// From string
const builder = RouteLoader.loadString(yamlOrJsonString);

// From already-parsed object (e.g. from @alt-javascript/config at boot time)
const builder = RouteLoader.loadObject({ route: { from: { uri: 'direct:x', steps: [] } } });

YAML route format

route:
  id: my-route
  from:
    uri: direct:hello
    steps:
      - setBody:
          simple: "${body}"
      - to: log:hello
      - choice:
          when:
            - simple: "${body} == 'ping'"
              to: direct:pong
          otherwise:
            to: direct:default

ProducerTemplate

const pt = new ProducerTemplate(context);

// InOnly — returns the exchange after completion
const exchange = await pt.sendBody('direct:hello', 'world', { 'X-Header': 'value' });

// InOut — returns the result body (exchange.out.body, fallback to exchange.in.body)
const result = await pt.requestBody('direct:hello', 'world');

ConsumerTemplate

Polls from seda: endpoints. Direct: and other push-model endpoints are not supported.

const ct = new ConsumerTemplate(context);

const exchange = await ct.receive('seda:work', 5000);   // Exchange or null on timeout
const body     = await ct.receiveBody('seda:work', 5000); // body or null on timeout

Error Handling

builder.from('direct:input')
  .onException(Error)
    .to('direct:errors')
    .end()
  .process(ex => { throw new Error('oops'); });

Configure redelivery via Pipeline options:

import { Pipeline } from 'camel-lite-core';

new Pipeline(processors, {
  maximumRedeliveries: 3,
  redeliveryDelay: 1000,
  deadLetterUri: 'direct:dlq',
});

See Also