Giter Site home page Giter Site logo

reinforz / nishan Goto Github PK

View Code? Open in Web Editor NEW
172.0 5.0 13.0 11.21 MB

An ecosystem of packages for notion written in typescript.

Home Page: https://nishan-docs.netlify.app/

License: MIT License

TypeScript 98.86% JavaScript 0.39% HTML 0.19% CSS 0.35% Shell 0.04% SCSS 0.17%
notion-api typescript monorepo notion-client notion-wrapper

nishan's Introduction

Nishan logo

Nishan

An ecosystem of packages for notion written in typescript.

This monorepo contains/will contain the following packages and apps:-

Packages

  • @nishans/cache Github NPM: A cache specially designed to retrieve and store notion data in memory
  • @nishans/cli Github: A package to interact with @nishans/core from the terminal
  • @nishans/cms Github: A cms for notion
  • @nishans/constants Github NPM: A small package for all notion specific constants
  • @nishans/core Github Docs NPM: Unofficial Notion api for node.js with all crud functionalities for Space, User, Block, Page and many more
  • @nishans/discord-bot Github: A general purpose discord bot for working with @nishans/core from the discord chat textbox
  • @nishans/discourse Github NPM: A package for working with notion discussions & comments
  • @nishans/endpoints Github Docs NPM: A package to expose all notion endpoints for queries and mutations
  • @nishans/errors Github NPM: A small package containing various notion specific error classes
  • @nishans/extract Github NPM: A small package to extract required notion data
  • @nishans/fabricator Github NPM: A package to generate notion blocks using a simple api
  • @nishans/graphql Github NPM: A graphql server for notion built using @nishans/core
  • @nishans/idz Github NPM: A small package to validate, generate and parse notion ids
  • @nishans/init Github NPM: A package to initialize notion view & block data
  • @nishans/inline-blocks Github NPM: Package providing an easy to use api to generate contents for notion inline blocks
  • @nishans/lineage Github NPM: A package to work with notion child data
  • @nishans/logger Github NPM: A logger built specifically for nishan ecosystem
  • @nishans/markdown Github Docs: A package to upload markdown content into notion
  • @nishans/notion-formula Github Docs NPM: A package to generate notion formula with ease
  • @nishans/operations Github NPM: A package to inspect, modify and store notion operations
  • @nishans/orm Github: A package to use notion as a database by providing an easy to use orm api
  • @nishans/permissions Github NPM: A package to easily deal with notion permissions
  • @nishans/react-filters Github: A react component that emulates notions advanced filter
  • @nishans/remark-notion Github: A remark plugin to support custom notion specific syntax for @nishans/markdown package
  • @nishans/schema-builder Github: A package to create notion collection schema painlessly
  • @nishans/sync Github Docs NPM: A package to keep local notion data in sync with remote one by storing and restoring it
  • @nishans/tasks Github NPM: A package to enqueue and poll notion tasks
  • @nishans/traverser Github NPM: Traverse notion data with ease
  • @nishans/typegen Github: A package to automatically generate typescript definitions from a remote notion collection schema
  • @nishans/types Github Docs NPM: Typescript type definitions for notion
  • @nishans/utils Github Docs NPM: A bunch of small utility modules used across nishans ecosystem
  • @nishans/validators Github NPM: A group of modules to validate various things related to notion

Apps

A few apps built/that will be built using the above packages

  1. markdown-web (NSY): A react powered web app to upload markdown content as notion pages using @nishans/markdown
  2. markdown-desktop (NSY): An electron powered desktop app to upload markdown content as notion pages using @nishans/markdown
  3. markdown-vscode (NSY): A vscode extension to upload markdown content as notion pages using @nishans/markdown
  4. markdown-native (NSY): A react native powered mobile app to upload markdown content as notion pages using @nishans/markdown
  5. notion-formula-web (NSY): A react powered web app to view the generated notion formula ast from array, object or string representation using @nishans/notion-formula package

NOTE: The scope was originally named nishan, but unfortunately that name was already taken in npm. I'll use the term nishan everywhere except in case of the scope, where its nishans.

Contributors

  1. Safwan Shaheer github Author, Maintainer
  2. Matt Casey github Contributor

How to contribute

  1. Clone the repo locally by typing git clone https://github.com/Devorein/Nishan.git on the terminal.
  2. Make sure you have yarn installed
  3. Install all the dependencies using yarn install.
  4. Run all the tests using yarn test.

Feel free to submit a pull request or open a new issue, contributions are more than welcome !!!

Implementations in other languages

  1. Python: notion-py
  2. Go: notionapi
  3. Ruby: notion-ruby
  4. Kotlin: notion-sdk-kotlin

Related Projects

  1. react-notion-x Fast and accurate React renderer for Notion. TS batteries included.
  2. ntast Notion Abstract Syntax Tree specification.

nishan's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar devorein avatar mattcasey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nishan's Issues

Having some issues creating pages

Hey @Devorein, I've been trying to create a collection view page and i've been having some trouble. it goes through without any errors, but when I check notion no page has been created... I've included the logs & code.

image
image
image

Am I doing something wrong here? My apologies if I am missing something obvious.

EDIT: I thought I might add in yes, I have tried restarting notion and checking it on another device

Question: Is it possible to list rows in a database?

I'm trying to understand the hierarchy of the Nishan client, and I'm not 100% sure how to query the data I'm after.
My page structure is such:

  • Top level page
    • Nested database
      • Row A
      • Row B
      • Row C
    • Other nested page

I want to be able to retrieve Row A, Row B, Row C as entries, but after reviewing the code I'm not sure this is exposed?

Thanks in advance

How to create a page in a workspace

Hello @Devorein, I just found this project here, I realize it's a project in the working. I've read through your code trying to figure out how can I create a page in a workspace.
I only understood how to fetch things, but not creating.
Can you please, publish an example on how to create a page, then add a headline, text, image ?

Expose code to allow me to import HTML

Is your feature request related to a problem? Please describe.
I want to save HTML inside of Notion. It turns out they have an API to import html AND this library has a method called enqueueAndPollTask() which has the types to do it using the "importFile" event!

Describe the solution you'd like
At minimum, just a way to call enqueueAndPollTask() myself, using any one of the tasks available.

Describe alternatives you've considered
It might already be exposed, but I couldn't figure it out :)

Add support for transclusion_reference

Is your feature request related to a problem? Please describe.
I can not reference the transclusion_reference type block. When I do it, the following error is displayed:

Block type is not of the supported types
Given type: transclusion_reference

Describe the solution you'd like
I would like to get support for this block, the @nishan/types already has all typing for it, the @nishan/core seems to be out of date.

Additional context
I have the following dependencies specified in my application:

"@nishans/core": "^0.0.35",
"@nishans/types": "^0.0.57",

The example of code, which may cause this issue:

const syncedBlocks = await page.getBlocks((block) => block.type.includes('transclusion'), true);

Please note, the page should include the synced block on it to throw this error.

Nishan documentation not upto date

Hey I just found out by analyzing your latest code that nishan's official documentation is not upto date with the api. It'd be wonderful if you could update it to the latest documentation.

Docs link on homepage leads to dead page

Describe the bug
I was trying to pull up the docs to look into some of the packages available and was greeted with the following error after clicking Docs at the top of the site:

image

To Reproduce
Steps to reproduce the behavior:

  1. Go to Nishan homepage.
  2. Click on 'Docs' in the toolbar.
  3. Note the error received, and the path attempted (/docs/root).

Expected behavior
I'd expect to be directed to the /docs endpoint with the documentation.

Screenshots
I've attached screenshots above.

Desktop (please complete the following information):

  • OS: macOS Version 11.2.1 (Build 20D74)
  • Browser: Chrome
  • Version 89.0.4389.90 (Official Build) (x86_64)

Additional context
From what I can tell, it's simply the Docs element/tag routing to an invalid path (/docs/root) instead of the correct one (/docs).

Permission error

Describe the bug
For some reason, despite being an admin in my workspace, I get 401 when trying to write the data on the page. I can notice that the x-notion-active-user-header I see on the website transaction requests and in my console differs. It might be the reason behind the problem. The token_v2 is valid through. I can not find any way to switch to the proper x-notion-active-user-header.

Additional context
The other workspace, where I initially testes the code and which is totally owned by me works and shows no permission problems.

Unable to copy a page and have it save

Context

I have a nested database with some rows. I want to script creating a new row by coping an existing row OR by using a template.

Describe the bug
Unable to copy a page and have it save

To Reproduce
I first tried to do this outside of a database, just for a regular page but couldn't get it to work.

import { NotionCore } from "@nishans/core";

const nishan = new NotionCore.Api.Nishan({
  token: "XXXXX",
  logger: true,
});

(async () => {
  const pageId = "some-UUID";
  const pages = await nishan.getPagesById([pageId]);
  const page = pages.page.get(pageId);
  const res = await page?.duplicate(1);
  console.log(res);
})();

It outputs some JSON, but I can't find the relevant page on notion or where its copied to. Any ideas on how to do this correctly?

2 additional questions:

  1. Is there a way to create a new row in a collection/database using a template? Or copy a row in a database into a new row?
  2. Is there a full working example I can use as a reference?
  3. Could you update the discord invite? The current link everywhere is invalid.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.