# graphcontrol

> Neo4j Schema Library

Latest version **0.1.13** (published 2022-02-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install graphcontrol
pnpm add graphcontrol
yarn add graphcontrol
bun add graphcontrol
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.13 |
| Published | 2022-02-08 |
| First published | 2021-09-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 193.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Tobias Reinbold |
| Maintainers | tobireinbo |

## Links

- npm: https://www.npmjs.com/package/graphcontrol
- npm.io page: https://npm.io/package/graphcontrol

## Recent versions

- 0.1.13 (latest) — 2022-02-08
- 0.1.12 — 2021-10-27
- 0.1.11 — 2021-10-10
- 0.1.10 — 2021-09-16
- 0.1.9 — 2021-09-16
- 0.1.8 — 2021-09-16
- 0.1.7 — 2021-09-16

## README

# Graphcontrol

Graphcontrol is a OGM for Neo4j. It is intended for use in TypeScript, so you don't have to know any Cypher in order to query a Neo4j Database. This library isn't really suited for more complex Cypher Queries.


## Installation
It can be installed via npm.

    npm i graphcontrol
 
 ## API
 Setting up a Schema
 

    const provider = new Neo4jProvider({
		url: "bolt://localhost:7687",
		username: "neo4j",
		password: "password"
	});
	
	type PersonProps = {
		name: string;
		age: number;
	}
	
	const Person = new Schema<PersonProps>(provider, "Person");
Relations can be defined the following way:

	const relations = [{
		id: "car", //id to reference by
		schema: "Car", //label of the targeted Schema
		label: "OWNS", //relation label, e.g. ()-[:OWNS]->()
		direction: "to" //relation direction
	}];
    const PersonWithRelations = new Schema<PersonProps>(provider, "Person", relations);

getting nodes of a Schema

    //all Nodes
    await Person.getNodes();
    
    //Person by Name
    await Person.getNodes({where: {name: "John"}});
    
    //find People named John and optionally their blue car(s)
    await Person.getNodes({
	    where: {name: "John"},
	    relations: [{
		    id: "car",
		    where: {color: "blue"}
	    }]
    });
   
   
WIP

---
_Source: https://npm.io/package/graphcontrol · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
