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

@venncity/base-dao

Package Overview
Dependencies
Maintainers
1
Versions
128
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@venncity/base-dao

![Coverage](https://api.venn.city/production/coverage/badge?branch=master&repository=@venncity/base-dao)

  • 2.5.4
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
410
increased by6.77%
Maintainers
1
Weekly downloads
 
Created
Source

Base DAO

Coverage

Base DAO exports a createEntityDAO function which creates a DAO with the following capabilities:

  • a set of CRUD operations, implemented using sequelize
  • authorization capabilities, using a daoAuth interface implemented by the consumer of the package
  • CRUD mutations notifications (e.g. can be used for auditing)
  • declarative cascade-delete mechanism
  • hooks mechanism, e.g. preSave, preDelete, postFetch, etc.

Quick start

Generate DAO classes using the following command:

$ generate-dao-schema --dataModelPath PATH_TO_YOUR_DATA_MODEL --generatedFolderPath PATH_TO_YOUR_GENERATED_FOLDER
  • dataModelPath is not required and the default value is src/schema/datamodel.graphql
  • generatedFolderPath is not required and the default value is src/schema/generated

Add the following scripts to your package.json:

"scripts": {
  "prebuild: "yarn generate-dao-schema",
  "prestart": "yarn generate-dao-schema",
  "generate-dao-schema": "generate-dao-schema"
}

Example of usage (assume that Survey entity exists)

import { SurveyDAO } from '../../generated';

const surveyDAO = new SurveyDAO({
    hooks,
    daoAuth, 
    publishCrudEvent
});
...
const createdSurvey = await surveyDAO.createSurvey(...);

FAQs

Package last updated on 02 Feb 2023

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