Socket
Socket
Sign inDemoInstall

@pdftron/collab-db-postgresql

Package Overview
Dependencies
64
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @pdftron/collab-db-postgresql

A package containing a PostgreSQL database and a default set of resolvers that plug into `@pdftron/collab-server`.


Version published
Weekly downloads
94
increased by1.08%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Realtime collab - PostgreSQL database

A package containing a PostgreSQL database and a default set of resolvers that plug into @pdftron/collab-server.

Spec (internal)

This module should contain a few things.

  1. A script that connects to a PostgreSQL server and creates a new database with the necessary architecture. This script should accept params for the name of the database and anything else the user might want to configure, as well as the URL & port we should connect to to create the database.

This might look something like this:

node @pdftron/collab-db-postgresql/dist/create.js --host=1.1.1.1 --port=9000 --username=root --password=password --dbName=myDB
  1. A package that exports the resolvers to plug into @pdftron/collab-server

The required resolvers can be found in packages/collab-server/src/index.ts

This might look something like this:

import CollabServer from '@pdftron/collab-server'
import CollabDatabase from '@pdftron/collab-db-postgresql';

const db = new CollabDatabase({
  host: '1.1.1.1',
  port: '9000',
  dbName: 'nameOfDb',
  username: 'db_user',
  password: 'db_user'
})

const resolvers = db.getResolvers();

// example of what 'resolvers' might look like
// {
//   Query: {
//     user: (id) => postgreqConnection.query(`SELECT * FROM users WHERE id == ${id} LIMIT 1`),
//     ...
//   },
//   Mutation: {
//     addAnnotation: (annot) => postgreqConnection.query(`INSERT annot into annotations etc..`),
//     ...
//   }
// }

const server = new CollabServer(resolvers)

server.start();

Requirements

Strict error handling / error checking

  • If a table doesn't exist that we expect to exist, let the user know
  • If we cannot connect to the DB, let them know why if possible

Ease of use

  • This should be useable by anyone with very little database knowledge
  • As little configuration as possible. We are allowed to make assumptions here

Reabable

  • This will be an open source module. Keep code clean and easy to follow
  • The module should be written in Typescript

Secure

  • This is an open source module, so do not commit and private keys or anything the public should not see. If you need help with this, ask Logan for more info.

FAQs

Last updated on 30 Oct 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc