Skip to content
This repository was archived by the owner on Sep 3, 2021. It is now read-only.

Commit d711bcd

Browse files
author
Daniel Kaminski de Souza
committed
🎨➕ Improve code syntax with gql where applicable. Add .env file reading feature to script.
➕ Add clean leftovers from neo4j installation feature. ➕ Add cache_downloads feature, automate start and start-gateway with prestarts of the neo4j server. :: Add neo4j and .download_cache to ignore list. 🎨 Rebase. 🎨 Code format.
1 parent 53733c5 commit d711bcd

31 files changed

+638
-325
lines changed

.env

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
NEO4J_DIST='enterprise'
2+
NEO4J_VERSION='4.2.0'
3+
APOC_VERSION='4.2.0.0'
4+
DATASTORE_VERSION='4_0'
5+
NEO4J_USER=neo4j
6+
NEO4J_PASSWORD=letmein
7+
BOLT_PORT=7687
8+
HTTP_PORT=3000
9+
NEO4J_URI="bolt://localhost:{$BOLT_PORT}"

.env.example

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
NEO4J_DIST='enterprise'
2+
NEO4J_VERSION='4.2.0'
3+
APOC_VERSION='4.2.0.0'
4+
DATASTORE_VERSION='4_0'
5+
NEO4J_USER=neo4j
6+
NEO4J_PASSWORD=letmein
7+
BOLT_PORT=7687
8+
HTTP_PORT=3000
9+
NEO4J_URI="bolt://localhost:{$BOLT_PORT}"

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,7 @@ neo4j-version
6969
test/tck/*
7070
!test/tck/.gitkeep
7171

72-
.history
72+
.history
73+
74+
.download_cache
75+
neo4j
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"vars":[{"line":0,"kind":2,"name":"strict","containerName":""},{"line":1,"name":"$regex","containerName":null,"kind":13,"localvar":"my","defintion":"my"},{"line":4,"name":"@ARGV","containerName":null,"kind":13}],"version":3}

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"avaExplorer.cwd": "test"
3+
}

example/apollo-federation/gateway.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ import { inventorySchema } from './services/inventory';
55
import { productsSchema } from './services/products';
66
import { reviewsSchema } from './services/reviews';
77
import neo4j from 'neo4j-driver';
8+
import dotenv from 'dotenv';
9+
10+
dotenv.config();
811

912
// The schema and seed data are based on the Apollo Federation demo
1013
// See: https://github.com/apollographql/federation-demo
1114

1215
const driver = neo4j.driver(
1316
process.env.NEO4J_URI || 'bolt://localhost:7687',
14-
neo4j.auth.basic(
15-
process.env.NEO4J_USER || 'neo4j',
16-
process.env.NEO4J_PASSWORD || 'letmein'
17-
)
17+
neo4j.auth.basic(process.env.NEO4J_USER, process.env.NEO4J_PASSWORD)
1818
);
1919

2020
// Start Accounts

example/apollo-server/authScopes.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { gql } from 'apollo-server';
12
import { makeAugmentedSchema } from '../../src/index';
23
import { ApolloServer } from 'apollo-server';
34
import neo4j from 'neo4j-driver';
@@ -11,15 +12,15 @@ import neo4j from 'neo4j-driver';
1112
// JWT_SECRET
1213
// oqldBPU1yMXcrTwcha1a9PGi9RHlPVzQ
1314

14-
const typeDefs = `
15-
type User {
15+
const typeDefs = gql`
16+
type User {
1617
userId: ID!
1718
name: String
18-
}
19+
}
1920
20-
type Business {
21+
type Business {
2122
name: String
22-
}
23+
}
2324
`;
2425

2526
const schema = makeAugmentedSchema({

example/apollo-server/bookmarks.js

+37-37
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
1+
import { gql } from 'apollo-server';
12
import { makeAugmentedSchema } from '../../src/index';
23
import { ApolloServer } from 'apollo-server';
34
import neo4j from 'neo4j-driver';
45

5-
const typeDefs = `
6-
type Person {
7-
_id: Long!
8-
born: Int
9-
name: String!
10-
acted_in: [Movie] @relation(name: "ACTED_IN", direction: "OUT")
11-
ACTED_IN_rel: [ACTED_IN]
12-
directed: [Movie] @relation(name: "DIRECTED", direction: "OUT")
13-
produced: [Movie] @relation(name: "PRODUCED", direction: "OUT")
14-
wrote: [Movie] @relation(name: "WROTE", direction: "OUT")
15-
follows: [Person] @relation(name: "FOLLOWS", direction: "OUT")
16-
reviewed: [Movie] @relation(name: "REVIEWED", direction: "OUT")
17-
REVIEWED_rel: [REVIEWED]
18-
}
19-
20-
type Movie {
21-
_id: Long!
22-
released: Int!
23-
tagline: String
24-
title: String!
25-
persons_acted_in: [Person] @relation(name: "ACTED_IN", direction: "IN")
26-
persons_directed: [Person] @relation(name: "DIRECTED", direction: "IN")
27-
persons_produced: [Person] @relation(name: "PRODUCED", direction: "IN")
28-
persons_wrote: [Person] @relation(name: "WROTE", direction: "IN")
29-
persons_reviewed: [Person] @relation(name: "REVIEWED", direction: "IN")
30-
}
6+
const typeDefs = gql`
7+
type Person {
8+
_id: Long!
9+
born: Int
10+
name: String!
11+
acted_in: [Movie] @relation(name: "ACTED_IN", direction: "OUT")
12+
ACTED_IN_rel: [ACTED_IN]
13+
directed: [Movie] @relation(name: "DIRECTED", direction: "OUT")
14+
produced: [Movie] @relation(name: "PRODUCED", direction: "OUT")
15+
wrote: [Movie] @relation(name: "WROTE", direction: "OUT")
16+
follows: [Person] @relation(name: "FOLLOWS", direction: "OUT")
17+
reviewed: [Movie] @relation(name: "REVIEWED", direction: "OUT")
18+
REVIEWED_rel: [REVIEWED]
19+
}
3120
32-
type ACTED_IN @relation(name: "ACTED_IN") {
33-
from: Person!
34-
to: Movie!
35-
roles: [String]!
36-
}
21+
type Movie {
22+
_id: Long!
23+
released: Int!
24+
tagline: String
25+
title: String!
26+
persons_acted_in: [Person] @relation(name: "ACTED_IN", direction: "IN")
27+
persons_directed: [Person] @relation(name: "DIRECTED", direction: "IN")
28+
persons_produced: [Person] @relation(name: "PRODUCED", direction: "IN")
29+
persons_wrote: [Person] @relation(name: "WROTE", direction: "IN")
30+
persons_reviewed: [Person] @relation(name: "REVIEWED", direction: "IN")
31+
}
3732
38-
type REVIEWED @relation(name: "REVIEWED") {
39-
from: Person!
40-
to: Movie!
41-
rating: Int!
42-
summary: String!
43-
}
33+
type ACTED_IN @relation(name: "ACTED_IN") {
34+
from: Person!
35+
to: Movie!
36+
roles: [String]!
37+
}
4438
39+
type REVIEWED @relation(name: "REVIEWED") {
40+
from: Person!
41+
to: Movie!
42+
rating: Int!
43+
summary: String!
44+
}
4545
`;
4646

4747
const schema = makeAugmentedSchema({ typeDefs });

example/apollo-server/interface-union-example.js

+18-14
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1+
import { gql } from 'apollo-server';
12
import { makeAugmentedSchema } from '../../src/index';
23
const { ApolloServer } = require('apollo-server');
34
const neo4j = require('neo4j-driver');
45

5-
const __unionTypeDefs = `
6-
union SearchResult = Blog | Movie
6+
const __unionTypeDefs = gql`
7+
union SearchResult = Blog | Movie
78
8-
type Blog {
9-
blogId: ID!
10-
created: DateTime
11-
content: String
12-
}
9+
type Blog {
10+
blogId: ID!
11+
created: DateTime
12+
content: String
13+
}
1314
14-
type Movie {
15-
movieId: ID!
16-
title: String
17-
}
15+
type Movie {
16+
movieId: ID!
17+
title: String
18+
}
1819
19-
type Query {
20-
search(searchString: String!): [SearchResult] @cypher(statement:"CALL db.index.fulltext.queryNodes('searchIndex', $searchString) YIELD node RETURN node")
21-
}
20+
type Query {
21+
search(searchString: String!): [SearchResult]
22+
@cypher(
23+
statement: "CALL db.index.fulltext.queryNodes('searchIndex', $searchString) YIELD node RETURN node"
24+
)
25+
}
2226
`;
2327

2428
const __interfaceTypeDefs = `

0 commit comments

Comments
 (0)