Socket
Book a DemoInstallSign in
Socket

loyverse

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loyverse

Modern Node.js client for the Loyverse API

0.1.7
latest
Source
npmnpm
Version published
Weekly downloads
2
-33.33%
Maintainers
0
Weekly downloads
 
Created
Source

Loyverse API Client

An unofficial Node.js client for the Loyverse API. Modern, lightweight.

⚠️ This is not an official Loyverse product. Use at your own risk.

Features

  • Full TypeScript support
  • Automatic retry on rate limits
  • Async iterator pagination
  • Bulk operations helper
  • ESM & CommonJS support

Installation

npm install loyverse

Quick Start

import Loyverse from 'loyverse';

const client = new Loyverse('your-api-token');

// List all items with automatic pagination
for await (const item of client.items.listAll()) {
  console.log(item);
}

// Bulk create customers with concurrent operations
const customers = [
  { name: 'John', email: 'john@example.com' },
  { name: 'Jane', email: 'jane@example.com' }
];

const { results, errors } = await client.bulkOperation(
  customers,
  customer => client.customers.create(customer),
  3 // Concurrency
);

Advanced Usage

Retry Configuration

const client = new Loyverse('token', {
  retryConfig: {
    maxRetries: 5,
    initialDelay: 1000,
    maxDelay: 30000
  }
});

Pagination Helper

// Automatic pagination handling
for await (const category of client.categories.listAll()) {
  console.log(category);
}

// Manual pagination
const { items, cursor } = await client.categories.list({ limit: 50 });

Error Handling

try {
  await client.items.get('invalid-id');
} catch (error) {
  if (error.name === 'LoyverseError') {
    console.log(error.status);  // HTTP status
    console.log(error.errors);  // Detailed error info
  }
}

Available Resources

  • Categories
  • Customers
  • Inventory
  • Items
  • Receipts
  • Merchants
  • Variants
  • Stores
  • Employees
  • Payment Types

Each resource provides standard CRUD operations where applicable.

Contributing

PRs welcome! Please read CONTRIBUTING.md for details.

License

MIT

Keywords

loyverse

FAQs

Package last updated on 08 Feb 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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.