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

age-schema-client

v0.6.0

Published

A TypeScript library for Apache AGE graph databases with schema validation

Readme

ageSchemaClient

A TypeScript library for Apache AGE graph databases with schema validation and efficient data loading.

📚 Full Documentation | 🚀 Getting Started | 📖 API Reference

Features

  • Schema-aware graph database operations
  • Type-safe query building
  • SQL generation for batch operations
  • Efficient data loading with single-function approach
  • Extensible connection pool system - Support for multiple PostgreSQL extensions
  • Transaction management
  • Progress tracking for large operations
  • Comprehensive error handling
  • Support for both Node.js and browser environments

Installation

# Using pnpm
pnpm add age-schema-client

# Using npm
npm install age-schema-client

# Using yarn
yarn add age-schema-client

Quick Start

import { AgeSchemaClient } from 'age-schema-client';

// 1. Create client instance
const client = new AgeSchemaClient({
  host: 'localhost',
  port: 5432,
  database: 'my_database',
  user: 'postgres',
  password: 'postgres',
  graph: 'my_graph'
});

// 2. Connect to the database
await client.connect();

// 3. Define a schema
const schema = {
  version: '1.0.0',
  vertices: {
    Person: {
      properties: {
        name: { type: 'string', required: true },
        age: { type: 'number' }
      }
    },
    Movie: {
      properties: {
        title: { type: 'string', required: true },
        year: { type: 'number' }
      }
    }
  },
  edges: {
    ACTED_IN: {
      properties: {
        role: { type: 'string' }
      },
      from: ['Person'],
      to: ['Movie']
    }
  }
};

// 4. Set the schema
await client.setSchema(schema);

// 5. Get a query builder and execute queries
const queryBuilder = client.queryBuilder();

const result = await queryBuilder
  .match('Person', 'p')
  .where('p.name = $actorName')
  .withParam('actorName', 'Tom Hanks')
  .outgoing('ACTED_IN', 'r', 'Movie', 'm')
  .return('p.name', 'm.title', 'r.role')
  .execute();

// 6. Clean up
await client.disconnect();

Documentation

📚 Full documentation is available at https://standardbeagle.github.io/ageSchemaClient/

Quick Links

Key Topics

API Reference

A comprehensive API reference is available in the online documentation. This includes detailed information about:

  • Connection Management
  • Query Execution
  • SQL Generation
  • Vertex Operations
  • Edge Operations
  • Batch Operations
  • Schema Migration
  • Error Handling
  • SchemaLoader Operations

Examples

Basic Usage

See basic-usage.ts for a simple example of using the client.

Transactions

See schema-loader-transaction.ts for an example of using transactions.

Progress Tracking

See schema-loader-progress.ts for an example of tracking progress during data loading.

Error Handling

See schema-loader-error-handling.ts for examples of handling various error scenarios.

Connection Options

For detailed information about connection options, including PostgreSQL-specific options like search_path, see the Connection Configuration guide in our documentation.

Apache AGE Integration

This library is designed to work with Apache AGE, a PostgreSQL extension for graph database functionality. It handles the complexities of working with AGE, including:

  • Proper parameter passing using temporary tables
  • Handling AGE-specific data types (agtype)
  • Optimizing queries for performance
  • Managing graph data loading efficiently
  • Ensuring ag_catalog is in the search path

Important AGE-Specific Considerations

  1. Search Path: Always include ag_catalog in the search path:

    searchPath: 'ag_catalog, "$user", public'
  2. Loading AGE Extension: The library automatically loads the AGE extension with LOAD 'age'; for each new connection.

  3. Parameter Passing: Due to AGE limitations with dynamic parameters, the library uses temporary tables for parameter passing.

  4. AGE Data Types: The library properly handles the ag_catalog.agtype data type, including proper string formatting.

  5. Query Structure: For optimal performance with AGE, the library structures queries to minimize the number of database roundtrips.

Development

Prerequisites

  • Node.js 16+
  • pnpm 10+

Setup

# Clone the repository
git clone https://github.com/beagle/age-schema-client.git
cd age-schema-client

# Install dependencies
pnpm install

# Build the library
pnpm build

# Run tests
pnpm test

License

MIT