Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

notabase

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

notabase

API Wrapper For Notion's Database

  • 0.7.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
52
decreased by-43.48%
Maintainers
1
Weekly downloads
 
Created
Source

Notabase (WIP)

API Wrapper For Notion's Database

Getting Started

Installing

yarn add notabase

Example

import Notabase from 'notabase'

// node env

// just Read public data
let nb = new Notabase()

// CRUD support
let nb = new Notabase({
  token: <token_v2>
})

// browser env
// without authCode Read public data
// with authCode CRUD support
let nb = new Notabase({
  proxy: {
    url: <cloudflare worker url>,
    authCode: <>
  }
})
 

// get my music data
let db = await nb.fetchAll({
  songs: "https://www.notion.so/2628769120ad41d998ec068d6e2eb410?v=e8e69ac68a8d483792c54541e4d8ba72",
  albums: "https://www.notion.so/15f1759f38a34fedaa79262812b707f0?v=b385656739214101b2b8a159092a52e8",
  artists: "https://www.notion.so/31b8544ffb034964b1aa56bfa78497c1?v=1d9cbfcd279d4534964acdd374c9824e"
})

// get all songs
let allSongs = db.songs.rows
 
// get song by index
let song = allSongs[0]

// get one song's title (base props)
console.log(`${song.tile}`)

// get artist's name of the song (related props)
console.log(`${song.artist[0].Name}`) // a song maybe has two or more artists

// search song by title in song's table
let aSong = allSongs.find(song=> song.title === "Bad Guy")

// search all song by artist's name in song's table
let songByArtistName = allSongs.filter(song=> song.artist[0].name === "someone")
// search all song by artist's name in artist's table
songByArtistName = db.artists.rows.filter(a=> a.name === "someone").songs


add new row

// create then modify
let newRow = collection.addRow()
newRow.Tags = [tag1]

// create with value
collection.addRow({title:"",Tags:["tag1"]}) 

update schema

// change
collection.schema.Tags.options.push({
  id:nb.genId(),
  value: "new tag",
  color: "pink"
})

// commit
collection.updateSchame()

Todos

collection

  • collection.addRow({title:"",Tags:["tag1"]}) // add new row
  • updateSchema // update schema

row

  • row.delete() // delete a row

FAQs

Package last updated on 25 Sep 2019

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc