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

@visus-io/notion-sdk-ts

v2.0.1

Published

TypeScript SDK for the Notion API

Downloads

350

Readme

@visus-io/notion-sdk-ts

GitHub Workflow Status (with event)

Sonar Quality Gate Sonar Coverage

NPM Version NPM Downloads GitHub

A type-safe TypeScript SDK for the Notion API with Zod validation, OOP models, and ergonomic helpers.

Features

  • Type-safe Zod v4 runtime validation on every API response; full TypeScript declarations
  • Complete API coverage Pages, Blocks, Databases, Data Sources, Comments, Search, Users, File Uploads
  • Ergonomic helpers block, richText, filter, sort, prop, parent, icon, cover, paginate factories eliminate verbose JSON
  • OOP models Page, Block, Database, User, Comment, DataSource, FileUpload, RichText with convenience methods
  • Automatic pagination paginate() and paginateIterator() helpers automatically fetch all pages
  • Automatic rate limiting Respects Retry-After header with exponential backoff fallback (configurable)
  • Client-side size validation Enforces Notion API size limits before sending requests
  • Zero bloat Single runtime dependency (zod); uses built-in fetch (Node 18+)

Installation

npm install @visus-io/notion-sdk-ts

Requirements: Node.js 18+ (uses native fetch)

Quick Start

import { Notion, block, richText, filter, sort, prop, parent } from '@visus-io/notion-sdk-ts';

const notion = new Notion({ auth: process.env.NOTION_TOKEN });

// Retrieve a page
const page = await notion.pages.retrieve('page-id');
console.log(page.getTitle());

// Create a page in a database
const database = await notion.databases.retrieve('database-id');
const dataSourceId = database.dataSources[0].id;

await notion.pages.create({
  parent: parent.dataSource(dataSourceId, database.id),
  properties: {
    Name: prop.title('New Task'),
    Status: prop.status('In Progress'),
    Priority: prop.select('High'),
  },
});

// Append blocks to a page
await notion.blocks.children.append('page-id', {
  children: [
    block.heading2('Meeting Notes'),
    block.paragraph('Discussed the roadmap for Q2.'),
    block.toDo('Follow up with design', { checked: false }),
  ],
});

// Query a database with filters
const results = await notion.databases.query('database-id', {
  filter: filter.and(
    filter.status('Status').equals('In Progress'),
    filter.select('Priority').equals('High'),
  ),
  sorts: [sort.property('Due Date').ascending()],
});

Documentation

Comprehensive documentation is available in the GitHub Wiki:

Getting Started

Core Concepts

  • Helpers - Rich Text, Block Builder, Properties, Filters, Sorting
  • Models - Page, Block, Database, DataSource, User, Comment, FileUpload
  • API Reference - Complete API endpoint documentation

Configuration & Advanced Topics

Development

Migration Notice

This SDK now defaults to Notion API version 2025-09-03 (previously 2022-06-28). This version introduces breaking changes for multi-source database support.

Key Changes

  • Database creation: Properties moved to initial_data_source.properties
  • Database updates: Use Data Sources API for property changes
  • Page creation: Requires both data source ID and database ID
  • Search API: Returns DataSource objects instead of Database

Quick Migration Example

// OLD (2022-06-28)
await notion.pages.create({
  parent: parent.database('database-id'),
  properties: { Name: prop.title('Task') },
});

// NEW (2025-09-03)
const db = await notion.databases.retrieve('database-id');
const dataSourceId = db.dataSources[0].id;

await notion.pages.create({
  parent: parent.dataSource(dataSourceId, db.id),
  properties: { Name: prop.title('Task') },
});

See the Migration Guide for complete details.

Development

npm install              # Install dependencies
npm run build            # Compile TypeScript

npm test                 # Run tests
npm run test:watch       # Watch mode
npm run test:coverage    # Coverage report

npm run lint             # ESLint
npm run lint:fix         # Auto-fix
npm run format           # Prettier

See Development & Contributing for more details.

Links