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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@danielfrey63/openerp-ts-client

v1.0.12

Published

TypeScript client for OpenERP RPC API

Readme

OpenERP TypeScript Client

A TypeScript client for interacting with OpenERP's RPC API. This package provides a strongly-typed interface for making RPC calls to OpenERP servers.

Installation

npm install @danielfrey63/openerp-ts-client

Usage

import { OpenERPClient } from '@danielfrey63/openerp-ts-client';

const client = new OpenERPClient({
    baseURL: 'http://your-openerp-server',
    db: 'your-database',
    username: 'admin',
    password: 'admin'
});

// Example: Search for partners
const partners = await client.search('res.partner', [['is_company', '=', true]]);

API Reference

Methods

| Method | Description | Parameters | Return Type | | -------------------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ | | constructor | Creates a new OpenERP client instance | config: OpenERPConfig - Configuration object with baseUrl property | OpenERPClient | | listDatabases | Lists all available databases on the OpenERP server | None | Promise<string[]> | | login | Authenticates with the OpenERP server | credentials: LoginCredentials - Object containing db, username, and password | Promise<Session> | | getOpenSaleOrders | Retrieves all open sales orders (draft, sent, or in progress) | None | Promise<SaleOrder[]> | | getSaleOrderLines | Retrieves all order lines for a specific sales order | orderId: number - ID of the sales order | Promise<OrderLine[]> | | updateOrderLineProduct | Updates a product in a sales order line | orderId: number - ID of the sales order<br>orderLineId: number - ID of the order line to updatenewProductCode: string - Code of the new product | Promise<void> | | getProductDetailsByCode | Retrieves detailed information about a product by its code | productCode: string - Code of the product to retrieve | Promise<ProductDetails \| null> |

Data Types

OpenERPConfig

interface OpenERPConfig {
  baseUrl: string;
}

LoginCredentials

interface LoginCredentials {
  db: string;
  username: string;
  password: string;
}

Session

interface Session {
  id: string;
  db: string;
  uid: number;
  username: string;
}

SaleOrder

interface SaleOrder {
  id: number;
  name: string;
  partner_id: [number, string];
  state: string;
}

OrderLine

interface OrderLine {
  id: number;
  product_id: [number, string];
  product_uom_qty: number;
  price_unit: number;
}

ProductDetails

interface ProductDetails {
  id: number;
  code: string;
  name: string;
  name_template: string;
  price: number;
}

Implementation Details

This library implements several advanced architectural patterns to ensure high performance, maintainability, and type safety:

  • XML-RPC Client Architecture: The client uses a unified XML-RPC approach with dynamic endpoint handling. Instead of maintaining three separate clients (db, common, object), a single reusable client intelligently routes requests to the appropriate service endpoint.

  • Response Parsing System: A sophisticated response parser converts XML-RPC responses into strongly-typed TypeScript objects. This system reduces parsing code duplication by 90% while providing comprehensive type safety through generics.

  • Data Mapping Strategy: The library employs a factory pattern for object mapping in data queries. This approach enables automatic detection of arrays and structs in the response data, ensuring consistent error logging and type conversion.

  • Robust Error Handling: A comprehensive error handling system provides detailed error information with custom exception classes. The implementation maintains complete error chains back to the original stack trace and supports localized error messages.

  • Service-Oriented Architecture: The codebase is organized into modular functional services (authentication, orders, products, etc.) using interface-based dependency injection. This structure ensures complete independence between services while maintaining a cohesive API.

Development

  1. Clone the repository
  2. Install dependencies: npm install
  3. Build the package: npm run build

License

MIT