cifru
TypeScript icon, indicating that this package has built-in type declarations

0.4.0-alpha.0 • Public • Published

cifru

NPM version NPM downloads

Cifru (🗣 [ˈt͡ʃifru]): cypher queries with no strings attached! Dive into our lightweight ORM that makes writing production-ready queries feel like a breeze.

  • String validation at compile time: uses TypeScript template literals to validate node and relation names, ensuring correct format before runtime.

Installation

yarn add cifru

Usage

import c, { Direction } from 'cifru';

const query = c
  .match(
    c
      .node({
        variable: 'a',
        labels: ['Actor'],
        properties: { name: 'Cami' },
      })
      .relation({
        direction: Direction.Outgoing,
        variable: 'r',
        labels: ['ACTED_IN'],
        properties: { roles: ['Trinity'] },
      })
      .node({
        variable: 'm',
        labels: ['Movie'],
        properties: { name: 'The Matrix' },
      }),
  )
  .return('a')
  .query();

console.log(query);
// => MATCH (a:Actor {name: 'Cami'})-[r:ACTED_IN {roles: Trinity}]->(m:Movie {name: 'The Matrix'})
//    RETURN a

Testing

yarn test

Package Sidebar

Install

npm i cifru

Weekly Downloads

1

Version

0.4.0-alpha.0

License

MIT

Unpacked Size

13.1 kB

Total Files

4

Last publish

Collaborators

  • gamote