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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@narkdown/notion-faker

v0.5.1

Published

Generate massive amounts of fake contextual data for Notion

Downloads

53

Readme

@narkdown/notion-faker

Generate massive amounts of fake contextual data for Notion

codecov XO code style Version: v0.5.0 license: MIT

Demo

Demo Notion Page

demo-notion-faker

Why?

To mocking Notion API request data.

Install

$ npm install @narkdown/notion-faker

Usage

const {NotionFaker} = require('@narkdown/notion-faker');

const notionFaker = new NotionFaker({
  seedValue: 100,
  locale: 'en',
});

Example

Prep Work

  1. Create a Notion API Integration
  2. Create Page in Notion to add database.
  3. Create an Example Database with your own properties.
  4. Share Page with your integration
const {Client} = require('@notionhq/client');
const {NotionFaker} = require('@narkdown/notion-faker');

const NOTION_API_KEY = ''; // Notion API Key
const EXAMPLE_DATABASE_ID = ''; // Database for importing Property Scheme.
const PARENT_PAGE_ID = ''; // Parent page to create database.
const ROW_COUNT = 100; // ⚠️ Creating too many pages using the Notion API is a heavy task.

const notion = new Client({auth: NOTION_API_KEY});
const notionFaker = new NotionFaker();

(async () => {
  const {properties: scheme} = await notion.databases.retrieve({
    database_id: EXAMPLE_DATABASE_ID,
  });

  const {id: databaseId} = await notion.databases.create({
    parent: {
      page_id: PARENT_PAGE_ID,
    },
    title: notionFaker.database.title()()(),
    properties: notionFaker.database.properties.propertiesByScheme(scheme),
    icon: notionFaker.icon.emoji(),
    cover: notionFaker.cover()(),
  });

  for (const _ of Array.from({length: ROW_COUNT})) {
    await narkdown.pages.create({
      parent: {database_id: TEST_DATABASE_ID},
      properties: notionFaker.page.properties.propertiesByScheme(scheme),
    });
  }
})();

API

const notionFaker = new NotionFaker(options?)

notionFaker.icon.emoji()

notionFaker.icon.external(methodPath?)(...args?)

notionFaker.cover(methodPath?)(...args?)

notionFaker.database.title(methodPath?)(...args?)(options?)

notionFaker.database.properties

  • title(options?)
  • rich_text(options?)
  • number(options?)
  • select(options?)
  • multi_select(options?)
  • date(options?)
  • files(options?)
  • checkbox(options?)
  • url(options?)
  • email(options?)
  • phone_number(options?)
  • formula(options?)
  • relation(options)
  • rollup(options)
  • people(options?)
  • created_by(options?)
  • created_time(options?)
  • last_edited_by(options?)
  • last_edited_time(options?)
  • propertiesByScheme(propertyScheme)

notionFaker.page.properties

  • title(methodPath?)(...args)(options?),
  • rich_text(methodPath?)(...args)(options?),
  • number(methodPath?)(...args),
  • select(methodPath?)(...args)(options?),
  • multi_select(methodPath?)(...args)(options?),
  • date(methodPath?)(...args)(options?),
  • files(methodPath?)(...args)(options?),
  • checkbox(),
  • url(),
  • email(...args),
  • phone_number(methodPath?)(...args)(options?),
  • propertiesByScheme(propertyScheme)

Support

Database Object

| Property | Supported | | ------------------ | --------- | | object | ❌ | | id | ❌ | | created_time | ❌ | | last_edited_time | ❌ | | title | ✅ | | icon | ✅ | | cover | ✅ | | properties | ✅ | | parent | ❌ | | url | ❌ |

Page Object

| Property | Supported | | ------------------ | --------- | | object | ❌ | | id | ❌ | | created_time | ❌ | | last_edited_time | ❌ | | archived | ❌ | | icon | ✅ | | cover | ✅ | | properties | ⚠️ | | parent | ❌ | | url | ❌ |

Property Object

| Property | Page (Child of Database) | Page (Child of Page) | | ------------------ | ------------------------ | -------------------- | | title | ✅ | ✅ | | rich_text | ✅ | ❌ | | number | ✅ | ❌ | | select | ✅ | ❌ | | multi_select | ✅ | ❌ | | date | ✅ | ❌ | | files | ✅ | ❌ | | checkbox | ✅ | ❌ | | url | ✅ | ❌ | | email | ✅ | ❌ | | phone_number | ✅ | ❌ | | formula | ❌ | ❌ | | relation | ❌ | ❌ | | rollup | ❌ | ❌ | | people | ❌ | ❌ | | created_by | ❌ | ❌ | | created_time | ❌ | ❌ | | last_edited_by | ❌ | ❌ | | last_edited_time | ❌ | ❌ |

Related

License

MIT