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

lemon-model

v1.2.3

Published

Common shared model definitions for Lemon Micro-Service Platform

Readme

lemon-model

Common shared model definitions for both backend and frontend.

Usage

!TIP! to develop backend api, use lemon-core instead of this.

# install with npm
npm install --save lemon-model

Backend API services that need the full Lemon runtime should use lemon-core.

Import

import type { NextContext } from 'lemon-model';
const { HttpAbstractGenAI } = require('lemon-model');

Frontend bundlers use the ESM build. Existing Node require() consumers use the CommonJS build.

Package Map

| Area | Responsibility | Detail Doc | | --- | --- | --- | | types | Shared request, identity, storage, and service shapes | Source types | | cores | Small shared transform helpers | Source tests | | socket | Peer socket, network contract, WebSocket bridge, JSON chunk transport | src/socket/README.md | | buffer | Provider-neutral GenAI stream buffering and network adapters | src/buffer/README.md | | genai | Gemini-like generateContent() adapter over Lemon agents APIs | src/genai/README.md | | samples | Real usage cases and PR-ready sample notes | samples/README.md |

User Sequence

sequenceDiagram
    participant App as App or service
    participant Package as lemon-model
    participant TS as TypeScript
    participant Runtime

    App->>Package: Install package
    App->>Package: Import selected type or helper
    Package-->>TS: Shared declarations
    TS-->>App: Contract check
    App->>Runtime: Run selected helper
    Runtime-->>App: Typed result
  1. App installs lemon-model
  2. App imports only the needed type or helper
  3. TypeScript checks shared contracts
  4. Runtime loads CJS or ESM build
  5. Selected module handles its own job
  6. Module README owns detailed behavior

Choosing A Module

flowchart TD
    A[Need shared code] --> B{Need runtime behavior}
    B -- No --> C[Use types]
    B -- Yes --> D{Which behavior}
    D -- Data transforms --> E[Use cores]
    D -- Socket or network test --> F[Use socket]
    D -- GenAI stream batching --> J[Use buffer]
    D -- Agents generateContent --> G[Use genai]
    F --> H[Read src/socket/README.md]
    G --> I[Read src/genai/README.md]
    J --> K[Read src/buffer/README.md]

Main branch: type-only, transform helper, socket flow, GenAI stream buffer, or GenAI proxy.

Buffer

buffer provides provider-neutral stream primitives for GenAI responses.

import { GenAIStreamBuffer, createGenAIStreamNetworkConsumer } from 'lemon-model';

Use it when a provider emits small stream fragments and the app needs consistent start, chunk, progress, flush, eof, and error events.

The network adapter can send GenAIStreamEvent over the shared socket/json-transport layer. Diagnostic helpers live under lemon-model/buffer/testing.

Provider probe tools are available under tools/, but provider SDKs are not part of the runtime package contract. Install the matching SDK in the workspace where you run a probe.

Build Formats

  • CommonJS entry: dist/index.js
  • ESM entry: dist/esm/index.js
  • Type declarations: dist/index.d.ts
  • Package export: import { ... } from 'lemon-model'
  • Test helper exports: lemon-model/genai/testing, lemon-model/buffer/testing, lemon-model/socket/testing

Module Docs

  • src/socket/README.md: peer socket and network contract
  • src/socket/JSON_TRANSPORT_SPEC.md: JSON chunk transport protocol
  • src/buffer/README.md: GenAI stream buffering and network adapter contract
  • src/genai/README.md: GenAI adapter contract
  • samples/README.md: sample case rules

Contribution

Plz, request PR.

See CODE_OF_CONDUCT

LICENSE

MIT - (C) 2019 LemonCloud Co Ltd. - All Rights Reserved.„


VERSION INFO

| Version | Description |-- |-- | 1.0.6 | optimized SearchBody with knn support. | 1.0.5 | optimized NextIdentity with authorization. | 1.0.4 | optimized NextIdentity with referer and origin. | 1.0.3 | optimized NextIdentityCognito | 1.0.0 | initial types out of the original [email protected]