-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from bitnine-oss/develop
Merge: Develop
- Loading branch information
Showing
21 changed files
with
2,245 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
"plugins": [ | ||
[ | ||
"@babel/transform-runtime" | ||
] | ||
], | ||
"@babel/plugin-proposal-class-properties" | ||
] | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,52 @@ | ||
{ | ||
"name": "ag-viewer-backend", | ||
"version": "0.4.0", | ||
"private": true, | ||
"scripts": { | ||
"test": "mocha -r @babel/register --exit --timeout 100000", | ||
"test:connector": "mocha -r @babel/register --exit --timeout 10000 ./test/connector.api.test.js", | ||
"test:metachart": "mocha -r @babel/register --exit --timeout 10000 ./test/meta.api.test.js", | ||
"test:cypher": "mocha -r @babel/register --exit --timeout 10000 ./test/cypher.api.test.js", | ||
"test:session": "mocha -r @babel/register --exit --timeout 10000 ./test/session.api.test.js", | ||
"test:query": "mocha -r @babel/register --exit --timeout 10000 ./test/cypher.service.test.js", | ||
"start": "babel-node src/bin/www", | ||
"start:dev": "nodemon --watch src/app.js --watch src/ --exec 'babel-node' src/bin/www", | ||
"build": "babel -d ./build ./src -s", | ||
"start:production": "node ./build/bin/www.js" | ||
}, | ||
"dependencies": { | ||
"@bitnine-oss/ag-driver": "^0.1.0", | ||
"cookie-parser": "~1.4.5", | ||
"cors": "^2.8.5", | ||
"debug": "~4.3.1", | ||
"ejs": "^3.1.6", | ||
"express": "~4.17.1", | ||
"express-session": "^1.17.1", | ||
"http-status": "^1.5.0", | ||
"morgan": "~1.10.0", | ||
"node-uuid": "^1.4.8", | ||
"npm-run-all": "^4.1.5", | ||
"pegjs": "^0.10.0", | ||
"pg": "^8.5.1", | ||
"pg-types": "^2.2.0", | ||
"winston": "^3.3.3", | ||
"winston-daily-rotate-file": "^4.5.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.12.13", | ||
"@babel/core": "^7.12.13", | ||
"@babel/node": "^7.12.13", | ||
"@babel/plugin-transform-runtime": "^7.12.15", | ||
"@babel/preset-env": "^7.12.13", | ||
"@babel/register": "^7.12.13", | ||
"mocha": "^8.2.1", | ||
"nodemon": "^2.0.7", | ||
"supertest": "^6.0.1", | ||
"supertest-session": "^4.1.0" | ||
} | ||
"name": "ag-viewer-backend", | ||
"version": "0.4.0", | ||
"private": true, | ||
"scripts": { | ||
"test": "mocha -r @babel/register --exit --timeout 100000", | ||
"test:connector": "mocha -r @babel/register --exit --timeout 10000 ./test/connector.api.test.js", | ||
"test:metachart": "mocha -r @babel/register --exit --timeout 10000 ./test/meta.api.test.js", | ||
"test:cypher": "mocha -r @babel/register --exit --timeout 10000 ./test/cypher.api.test.js", | ||
"test:session": "mocha -r @babel/register --exit --timeout 10000 ./test/session.api.test.js", | ||
"test:query": "mocha -r @babel/register --exit --timeout 10000 ./test/cypher.service.test.js", | ||
"start": "babel-node src/bin/www", | ||
"start:dev": "nodemon --watch src/app.js --watch src/ --exec 'babel-node' src/bin/www", | ||
"build": "babel -d ./build ./src -s", | ||
"start:production": "node ./build/bin/www.js" | ||
}, | ||
"dependencies": { | ||
"@bitnine-oss/ag-driver": "^0.1.0", | ||
"antlr4": "^4.9.2", | ||
"cookie-parser": "~1.4.5", | ||
"cors": "^2.8.5", | ||
"debug": "~4.3.1", | ||
"ejs": "^3.1.6", | ||
"express": "~4.17.1", | ||
"express-session": "^1.17.1", | ||
"http-status": "^1.5.0", | ||
"morgan": "~1.10.0", | ||
"node-uuid": "^1.4.8", | ||
"npm-run-all": "^4.1.5", | ||
"pegjs": "^0.10.0", | ||
"pg": "^8.5.1", | ||
"pg-types": "^2.2.0", | ||
"winston": "^3.3.3", | ||
"winston-daily-rotate-file": "^4.5.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.12.13", | ||
"@babel/core": "^7.12.13", | ||
"@babel/node": "^7.12.13", | ||
"@babel/plugin-proposal-class-properties": "^7.13.0", | ||
"@babel/plugin-transform-runtime": "^7.12.15", | ||
"@babel/preset-env": "^7.12.13", | ||
"@babel/register": "^7.12.13", | ||
"babel-plugin-polyfill-corejs2": "^0.2.0", | ||
"babel-plugin-polyfill-corejs3": "^0.2.0", | ||
"babel-plugin-polyfill-regenerator": "^0.2.0", | ||
"mocha": "^8.2.1", | ||
"nodemon": "^2.0.7", | ||
"supertest": "^6.0.1", | ||
"supertest-session": "^4.1.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
SELECT name as label, 0 as cnt | ||
FROM ag_catalog.ag_label | ||
WHERE graph = (SELECT oid FROM ag_catalog.ag_graph where name = '%s') | ||
AND kind = 'e'; | ||
SELECT label, count(label) as cnt | ||
FROM ( | ||
SELECT ag_catalog._label_name(oid, v)::text as label | ||
from cypher('%s', $$ | ||
MATCH ()-[V]-() | ||
RETURN id(V) | ||
$$) as (V agtype), (SELECT oid FROM ag_catalog.ag_graph where name = '%s') as oid | ||
) b | ||
GROUP BY b.label; | ||
|
||
-- TODO: COUNT needs AGE supporting or Client-side processing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ UNION ALL | |
MATCH (v)-[e]-(v2) RETURN DISTINCT label(e) AS label, count(e) AS cnt | ||
ORDER BY label | ||
|
||
-- %s | ||
-- %s %s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
SELECT name as label, 0 as cnt | ||
FROM ag_catalog.ag_label | ||
WHERE graph = (SELECT oid FROM ag_catalog.ag_graph where name = '%s') | ||
AND kind = 'v'; | ||
SELECT label, count(label) as cnt | ||
FROM ( | ||
SELECT ag_catalog._label_name(oid, v)::text as label | ||
from cypher('%s', $$ | ||
MATCH (V:_ag_label_vertex) | ||
RETURN id(V) | ||
$$) as (V agtype), (SELECT oid FROM ag_catalog.ag_graph where name = '%s') as oid | ||
) b | ||
GROUP BY b.label; | ||
|
||
-- TODO: COUNT needs AGE supporting or Client-side processing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
grammar Agtype; | ||
|
||
agType | ||
: agValue EOF | ||
; | ||
|
||
agValue | ||
: value typeAnnotation? | ||
; | ||
|
||
value | ||
: STRING #StringValue | ||
| INTEGER #IntegerValue | ||
| floatLiteral #FloatValue | ||
| 'true' #TrueBoolean | ||
| 'false' #FalseBoolean | ||
| 'null' #NullValue | ||
| obj #ObjectValue | ||
| array #ArrayValue | ||
; | ||
|
||
obj | ||
: '{' pair (',' pair)* '}' | ||
| '{' '}' | ||
; | ||
|
||
pair | ||
: STRING ':' agValue | ||
; | ||
|
||
array | ||
: '[' agValue (',' agValue)* ']' | ||
| '[' ']' | ||
; | ||
|
||
typeAnnotation | ||
: '::' IDENT | ||
; | ||
|
||
IDENT | ||
: [A-Z_a-z][$0-9A-Z_a-z]* | ||
; | ||
|
||
STRING | ||
: '"' (ESC | SAFECODEPOINT)* '"' | ||
; | ||
|
||
fragment ESC | ||
: '\\' (["\\/bfnrt] | UNICODE) | ||
; | ||
fragment UNICODE | ||
: 'u' HEX HEX HEX HEX | ||
; | ||
fragment HEX | ||
: [0-9a-fA-F] | ||
; | ||
fragment SAFECODEPOINT | ||
: ~ ["\\\u0000-\u001F] | ||
; | ||
|
||
INTEGER | ||
: '-'? INT | ||
; | ||
|
||
fragment INT | ||
: '0' | [1-9] [0-9]* | ||
; | ||
|
||
floatLiteral | ||
: RegularFloat | ||
| ExponentFloat | ||
| '-'? 'Infinity' | ||
| 'NaN' | ||
; | ||
|
||
RegularFloat | ||
: '-'? INT DECIMAL | ||
; | ||
|
||
ExponentFloat | ||
: '-'? INT DECIMAL? SCIENTIFIC | ||
; | ||
|
||
fragment DECIMAL | ||
: '.' [0-9]+ | ||
; | ||
|
||
fragment SCIENTIFIC | ||
: [Ee][+-]? [0-9]+ | ||
; | ||
|
||
WS | ||
: [ \t\n\r] + -> skip | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
token literal names: | ||
null | ||
'true' | ||
'false' | ||
'null' | ||
'{' | ||
',' | ||
'}' | ||
':' | ||
'[' | ||
']' | ||
'::' | ||
'-' | ||
'Infinity' | ||
'NaN' | ||
null | ||
null | ||
null | ||
null | ||
null | ||
null | ||
|
||
token symbolic names: | ||
null | ||
null | ||
null | ||
null | ||
null | ||
null | ||
null | ||
null | ||
null | ||
null | ||
null | ||
null | ||
null | ||
null | ||
IDENT | ||
STRING | ||
INTEGER | ||
RegularFloat | ||
ExponentFloat | ||
WS | ||
|
||
rule names: | ||
agType | ||
agValue | ||
value | ||
obj | ||
pair | ||
array | ||
typeAnnotation | ||
floatLiteral | ||
|
||
|
||
atn: | ||
[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 21, 82, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 5, 3, 24, 10, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 5, 4, 34, 10, 4, 3, 5, 3, 5, 3, 5, 3, 5, 7, 5, 40, 10, 5, 12, 5, 14, 5, 43, 11, 5, 3, 5, 3, 5, 3, 5, 3, 5, 5, 5, 49, 10, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 7, 7, 7, 59, 10, 7, 12, 7, 14, 7, 62, 11, 7, 3, 7, 3, 7, 3, 7, 3, 7, 5, 7, 68, 10, 7, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 5, 9, 76, 10, 9, 3, 9, 3, 9, 5, 9, 80, 10, 9, 3, 9, 2, 2, 10, 2, 4, 6, 8, 10, 12, 14, 16, 2, 2, 2, 89, 2, 18, 3, 2, 2, 2, 4, 21, 3, 2, 2, 2, 6, 33, 3, 2, 2, 2, 8, 48, 3, 2, 2, 2, 10, 50, 3, 2, 2, 2, 12, 67, 3, 2, 2, 2, 14, 69, 3, 2, 2, 2, 16, 79, 3, 2, 2, 2, 18, 19, 5, 4, 3, 2, 19, 20, 7, 2, 2, 3, 20, 3, 3, 2, 2, 2, 21, 23, 5, 6, 4, 2, 22, 24, 5, 14, 8, 2, 23, 22, 3, 2, 2, 2, 23, 24, 3, 2, 2, 2, 24, 5, 3, 2, 2, 2, 25, 34, 7, 17, 2, 2, 26, 34, 7, 18, 2, 2, 27, 34, 5, 16, 9, 2, 28, 34, 7, 3, 2, 2, 29, 34, 7, 4, 2, 2, 30, 34, 7, 5, 2, 2, 31, 34, 5, 8, 5, 2, 32, 34, 5, 12, 7, 2, 33, 25, 3, 2, 2, 2, 33, 26, 3, 2, 2, 2, 33, 27, 3, 2, 2, 2, 33, 28, 3, 2, 2, 2, 33, 29, 3, 2, 2, 2, 33, 30, 3, 2, 2, 2, 33, 31, 3, 2, 2, 2, 33, 32, 3, 2, 2, 2, 34, 7, 3, 2, 2, 2, 35, 36, 7, 6, 2, 2, 36, 41, 5, 10, 6, 2, 37, 38, 7, 7, 2, 2, 38, 40, 5, 10, 6, 2, 39, 37, 3, 2, 2, 2, 40, 43, 3, 2, 2, 2, 41, 39, 3, 2, 2, 2, 41, 42, 3, 2, 2, 2, 42, 44, 3, 2, 2, 2, 43, 41, 3, 2, 2, 2, 44, 45, 7, 8, 2, 2, 45, 49, 3, 2, 2, 2, 46, 47, 7, 6, 2, 2, 47, 49, 7, 8, 2, 2, 48, 35, 3, 2, 2, 2, 48, 46, 3, 2, 2, 2, 49, 9, 3, 2, 2, 2, 50, 51, 7, 17, 2, 2, 51, 52, 7, 9, 2, 2, 52, 53, 5, 4, 3, 2, 53, 11, 3, 2, 2, 2, 54, 55, 7, 10, 2, 2, 55, 60, 5, 4, 3, 2, 56, 57, 7, 7, 2, 2, 57, 59, 5, 4, 3, 2, 58, 56, 3, 2, 2, 2, 59, 62, 3, 2, 2, 2, 60, 58, 3, 2, 2, 2, 60, 61, 3, 2, 2, 2, 61, 63, 3, 2, 2, 2, 62, 60, 3, 2, 2, 2, 63, 64, 7, 11, 2, 2, 64, 68, 3, 2, 2, 2, 65, 66, 7, 10, 2, 2, 66, 68, 7, 11, 2, 2, 67, 54, 3, 2, 2, 2, 67, 65, 3, 2, 2, 2, 68, 13, 3, 2, 2, 2, 69, 70, 7, 12, 2, 2, 70, 71, 7, 16, 2, 2, 71, 15, 3, 2, 2, 2, 72, 80, 7, 19, 2, 2, 73, 80, 7, 20, 2, 2, 74, 76, 7, 13, 2, 2, 75, 74, 3, 2, 2, 2, 75, 76, 3, 2, 2, 2, 76, 77, 3, 2, 2, 2, 77, 80, 7, 14, 2, 2, 78, 80, 7, 15, 2, 2, 79, 72, 3, 2, 2, 2, 79, 73, 3, 2, 2, 2, 79, 75, 3, 2, 2, 2, 79, 78, 3, 2, 2, 2, 80, 17, 3, 2, 2, 2, 10, 23, 33, 41, 48, 60, 67, 75, 79] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
T__0=1 | ||
T__1=2 | ||
T__2=3 | ||
T__3=4 | ||
T__4=5 | ||
T__5=6 | ||
T__6=7 | ||
T__7=8 | ||
T__8=9 | ||
T__9=10 | ||
T__10=11 | ||
T__11=12 | ||
T__12=13 | ||
IDENT=14 | ||
STRING=15 | ||
INTEGER=16 | ||
RegularFloat=17 | ||
ExponentFloat=18 | ||
WS=19 | ||
'true'=1 | ||
'false'=2 | ||
'null'=3 | ||
'{'=4 | ||
','=5 | ||
'}'=6 | ||
':'=7 | ||
'['=8 | ||
']'=9 | ||
'::'=10 | ||
'-'=11 | ||
'Infinity'=12 | ||
'NaN'=13 |
Oops, something went wrong.