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

zotero-client-ts

v0.1.2

Published

A lightweight, minimalistic TypeScript client for the Zotero API. Complete TypeScript re-implementation with 100% API compatibility, full type safety, and modern ESM/CJS builds.

Readme

zotero-client-ts

A lightweight, minimalistic TypeScript client for the Zotero API.

Test Coverage

159/159 Tests Passing (100%)

All unit and integration tests passing.

api.spec.ts - 84 tests

  • Request parameter handling (13 tests)
  • GET request construction (24 tests)
  • Write request construction (13 tests)
  • Attachment requests (7 tests)
  • Meta requests (9 tests)
  • Pretend calls (3 tests)
  • Access validation (1 test)
  • Invalid call handling (8 tests)
  • Extension/plugin system (5 tests)

request.spec.ts - 69 tests

  • Meta read requests (4 tests)
  • Item read requests (17 tests)
  • Misc read requests (16 tests)
  • GET requests with extra params (4 tests)
  • Failing/empty/raw responses (6 tests)
  • Item write & delete requests (12 tests)
  • Failing write & delete requests (3 tests)
  • File upload (13 tests - 3-stage process, error handling)
  • File download (2 tests)
  • Configuration (1 test)

smoke.test.ts - 6 tests

  • Basic functionality smoke tests

Test Commands

# Run all tests
bun test
# Result: 159 pass, 0 fail, 650 expect() calls

# Run specific test suite
bun test test/api.spec.ts
bun test test/request.spec.ts
bun test test/smoke.test.ts

Development Notes

Architecture

The library follows the original's three-layer architecture:

  • API Layer (src/api.ts): Fluent chainable interface using closure-based state
  • Request Layer (src/request.ts): HTTP communication, retry logic, file handling
  • Response Layer (src/response.ts): Specialized response classes for different operations

Key Design Decisions

  • 100% API Compatibility: Every method signature matches the original exactly
  • Modern TypeScript: Leveraging TypeScript's type system for better DX
  • Bun-first: Optimized for Bun runtime, but works in Node.js 18+

Testing Strategy

  1. Unit Tests: Each module tested in isolation
  2. Integration Tests: Full request/response cycles with mocks
  3. Compatibility Tests: Side-by-side with original library

Build Artifacts

dist/
├── index.js       - ESM bundle (31.4 KB)
├── index.cjs      - CommonJS bundle
└── *.d.ts         - TypeScript definitions

Quick Start

# Install dependencies
bun install

# Build the project
bun run build

# Run tests
bun test

# Type checking
bun run lint

Usage Example

import api from "zotero-client-ts";

// Initialize with API key
const zotero = api("YOUR_API_KEY").library("user", 12345).items().top();

// Fetch items
const response = await zotero.get();
console.log(response.getData());

// Chainable API
const item = await api("KEY").library("user", 123).items("ITEMKEY").version(42).get();

License

MIT License - see LICENSE file for details.