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

@neo4j/graph-introspection

Package Overview
Dependencies
Maintainers
7
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@neo4j/graph-introspection

Library for introspecting Neo4j graph schemas

  • 1.0.0-next.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
7
Weekly downloads
 
Created
Source

Neo4j Schema Introspection

Usage

import neo4j, { session } from "neo4j-driver";
import { model } from "@neo4j/graph-schema-utils";
import { introspect, sessionFactory } from "@neo4j/graph-introspection";

async function main() {
  const driver = neo4j.driver(
    "neo4j://localhost:7687",
    neo4j.auth.basic("neo4j", "password")
  );

  // We want a session factory here so we can work in multiple sessions
  const graphSchema = await introspect(sessionFactory(driver, session.READ));

  // Put it in the JSON representation wrapper
  // this is only required if the serialized representation is the end goal
  const wrappedSchema = new model.GraphSchemaRepresentation(
    "1.0.0",
    graphSchema
  );

  // outputs standard graph schema JSON representation
  console.log(wrappedSchema.toJson(2));

  await driver.close();
}

main();

Testing

Running npm run test:integration will create a new database named integration.tests and delete it after the tests finish.
This means you'd need Neo4j Enterprise to run the integration tests and put credentials in .env file.

To spin up a docker container for running tests, run this command:

docker run \
    --name testneo4j \
    --rm \
    -p7474:7474 -p7687:7687 \
    --env NEO4J_ACCEPT_LICENSE_AGREEMENT=eval \
    --env NEO4J_AUTH=neo4j/password \
    neo4j:enterprise

Keywords

FAQs

Package last updated on 24 Jan 2024

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