File tree Expand file tree Collapse file tree 5 files changed +48
-75
lines changed Expand file tree Collapse file tree 5 files changed +48
-75
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- // DB Flags
2
- // Database error due to violation of duplicate constraint
3
- exports . OBJECT_DUPLICATE = 'OBJECT_DUPLICATE' ;
4
- // Object matching query does not exist
5
- exports . OBJECT_NOT_FOUND = 'OBJECT_NOT_FOUND' ;
1
+ exports . codes = require ( "./lib/codes" ) ;
6
2
7
- // Token Flags
8
- // Expiration time is passed
9
- exports . TOKEN_EXPIRED = 'TOKEN_EXPIRED' ;
10
- // Token does not contain expected parts after decrypting
11
- exports . TOKEN_MALFORMED = 'TOKEN_MALFORMED' ;
12
-
13
- // Permissions Flags
14
- // User has insufficient permissions for the desired action
15
- exports . ACCESS_DENIED = 'ACCESS_DENIED' ;
16
- // Failed to authorize the user
17
- exports . UNAUTHORIZED = 'UNAUTHORIZED' ;
18
-
19
- // Query Flags
20
- // Layers of query exceed maximum allowed limit
21
- exports . QUERY_DEPTH_EXCEEDED = 'QUERY_DEPTH_EXCEEDED' ;
22
- // Calculated complexity exceeds the maximum allowed limit
23
- exports . QUERY_COMPLEXITY_EXCEEDED = 'QUERY_COMPLEXITY_EXCEEDED' ;
24
- // At least one layer contains nodes exceeding the maximum allowed limit
25
- exports . QUERY_BREADTH_EXCEEDED = 'QUERY_BREADTH_EXCEEDED' ;
26
-
27
- // Mystery Flags
28
- // New phone, who dis?
29
- exports . UNKNOWN_ERROR = 'UKNOWN_ERROR' ;
3
+ exports . isValidCode = code => Object . keys ( exports . codes ) . includes ( code ) ;
Original file line number Diff line number Diff line change
1
+ // DB Flags
2
+ // Database error due to violation of duplicate constraint
3
+ exports . OBJECT_DUPLICATE = "OBJECT_DUPLICATE" ;
4
+ // Object matching query does not exist
5
+ exports . OBJECT_NOT_FOUND = "OBJECT_NOT_FOUND" ;
6
+
7
+ // Token Flags
8
+ // Expiration time is passed
9
+ exports . TOKEN_EXPIRED = "TOKEN_EXPIRED" ;
10
+ // Token does not contain expected parts after decrypting
11
+ exports . TOKEN_MALFORMED = "TOKEN_MALFORMED" ;
12
+
13
+ // Permissions Flags
14
+ // User has insufficient permissions for the desired action
15
+ exports . ACCESS_DENIED = "ACCESS_DENIED" ;
16
+ // User input an invalid email or password
17
+ exports . INVALID_CREDENTIALS = "INVALID_CREDENTIALS" ;
18
+
19
+ // Query Flags
20
+ // Layers of query exceed maximum allowed limit
21
+ exports . QUERY_DEPTH_EXCEEDED = "QUERY_DEPTH_EXCEEDED" ;
22
+ // Calculated complexity exceeds the maximum allowed limit
23
+ exports . QUERY_COMPLEXITY_EXCEEDED = "QUERY_COMPLEXITY_EXCEEDED" ;
24
+ // At least one layer contains nodes exceeding the maximum allowed limit
25
+ exports . QUERY_BREADTH_EXCEEDED = "QUERY_BREADTH_EXCEEDED" ;
26
+
27
+ // Mystery Flags
28
+ // New phone, who dis?
29
+ exports . UNKNOWN_ERROR = "UKNOWN_ERROR" ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @adgorithmics/graphql-errors" ,
3
- "version" : " 1.0.0 " ,
3
+ "version" : " 1.0.1 " ,
4
4
"description" : " Response erorr codes for graphql." ,
5
5
"main" : " index.js" ,
6
6
"scripts" : {
20
20
"homepage" : " https://github.com/adgorithmics-inc/graphql-errors#readme" ,
21
21
"dependencies" : {},
22
22
"devDependencies" : {
23
+ "@adgorithmics/eslint-config-base" : " ^1.3.0" ,
23
24
"eslint" : " 6.1.0"
24
25
}
25
26
}
You can’t perform that action at this time.
0 commit comments