This repository was archived by the owner on Nov 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +77
-42
lines changed Expand file tree Collapse file tree 5 files changed +77
-42
lines changed Original file line number Diff line number Diff line change
1
+ FROM node:12
2
+
3
+ RUN mkdir api
4
+
5
+ WORKDIR /api
6
+
7
+ COPY . .
8
+
9
+ RUN npm ci --only=prod
10
+
11
+ CMD ["node" , "src/cli.js" ]
Original file line number Diff line number Diff line change 26
26
- [ POST|PUT /db/: dbname /put] ( #postput-dbdbnameput )
27
27
- [ POST|PUT /db/: dbname /inc] ( #postput-dbdbnameinc )
28
28
- [ POST|PUT /db/: dbname /inc/: val ] ( #postput-dbdbnameincval )
29
- - [ POST|PUT /db/: dbname /access/writ ] ( #postput-dbdbnameaccesswrite )
29
+ - [ POST|PUT /db/: dbname /access/write ] ( #postput-dbdbnameaccesswrite )
30
30
- [ DELETE /db/: dbname ] ( #delete-dbdbname )
31
31
- [ DELETE /db/: dbname /: item ] ( #delete-dbdbnameitem )
32
32
- [ Contribute] ( #contribute )
Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " orbit-db-http-api" ,
3
- "version" : " 0.3.0-rc.4" ,
4
- "description" : " An HTTP API Server for the OrbitDB distributed peer-to-peer database" ,
5
- "main" : " src/cli.js" ,
6
- "keywords" : [
7
- " orbitdb" ,
8
- " orbit-db" ,
9
- " http" ,
10
- " api" ,
11
- " server" ,
12
- " peer-to-peer" ,
13
- " database" ,
14
- " db"
15
- ],
16
- "scripts" : {
17
- "test" : " echo \" Error: no test specified\" && exit 1"
18
- },
19
- "author" : " Phillip Mackintosh, Hayden Young" ,
20
- "license" : " MIT" ,
21
- "repository" : {
22
- "type" : " git" ,
23
- "url" : " https://github.com/orbitdb/orbit-db-http-api.git"
24
- },
25
- "engines" : {
26
- "node" : " >=10.0.0"
27
- },
28
- "dependencies" : {
29
- "docopt" : " ~0.6.2" ,
30
- "hapi" : " >17.0.0" ,
31
- "http2" :" ^3.2.0" ,
32
- "ipfs" : " ^0.36.3" ,
33
- "ipfs-http-client" : " ^30.0.0" ,
34
- "orbit-db " : " ^0.21.1 " ,
35
- "susie " : " ^3.0.0 "
36
- }
2
+ "name" : " orbit-db-http-api" ,
3
+ "version" : " 0.3.0-rc.4" ,
4
+ "description" : " An HTTP API Server for the OrbitDB distributed peer-to-peer database" ,
5
+ "main" : " src/cli.js" ,
6
+ "keywords" : [
7
+ " orbitdb" ,
8
+ " orbit-db" ,
9
+ " http" ,
10
+ " api" ,
11
+ " server" ,
12
+ " peer-to-peer" ,
13
+ " database" ,
14
+ " db"
15
+ ],
16
+ "scripts" : {
17
+ "test" : " echo \" Error: no test specified\" && exit 1"
18
+ },
19
+ "author" : " Phillip Mackintosh, Hayden Young" ,
20
+ "license" : " MIT" ,
21
+ "repository" : {
22
+ "type" : " git" ,
23
+ "url" : " https://github.com/orbitdb/orbit-db-http-api.git"
24
+ },
25
+ "engines" : {
26
+ "node" : " >=10.0.0"
27
+ },
28
+ "dependencies" : {
29
+ "docopt" : " ~0.6.2" ,
30
+ "hapi" : " >17.0.0" ,
31
+ "http2" : " ^3.2.0" ,
32
+ "ipfs" : " ^0.36.3" ,
33
+ "ipfs-http-client" : " ^30.0.0" ,
34
+ "js-logger " : " ^1.6.0 " ,
35
+ "orbit-db " : " ^0.21.1 " ,
36
+ "susie" : " ^3.0.0 "
37
37
}
38
+ }
Original file line number Diff line number Diff line change @@ -50,9 +50,25 @@ class DBManager {
50
50
return JSON . stringify ( db_info_list ) ;
51
51
} ;
52
52
53
+ let _db_write = ( db ) => {
54
+ return (
55
+ db . access . write ||
56
+ ( typeof db . access . get == 'function' && db . access . get ( 'write' ) ) ||
57
+ db . access . _options . write ||
58
+ 'unavaliable'
59
+ ) ;
60
+ }
61
+
62
+ this . db_write = ( dbn ) => {
63
+ let db = find_db ( dbn ) ;
64
+ if ( ! db ) return { } ;
65
+ return _db_write ( db ) ;
66
+ }
67
+
53
68
this . db_info = ( dbn ) => {
54
69
let db = find_db ( dbn ) ;
55
70
if ( ! db ) return { } ;
71
+ let __db_write = _db_write ( db )
56
72
return {
57
73
address : db . address ,
58
74
dbname : db . dbname ,
@@ -66,10 +82,12 @@ class DBManager {
66
82
path : db . options . path ,
67
83
replicate : db . options . replicate ,
68
84
} ,
69
- canAppend : db . access . write . includes ( orbitdb . identity . id ) ,
70
- write : db . access . write ,
85
+ canAppend : __db_write . includes ( orbitdb . identity . id ) ,
86
+ write : __db_write ,
71
87
type : db . type ,
72
88
uid : db . uid ,
89
+ indexLength : db . index . length || Object . keys ( db . index ) . length ,
90
+ accessControlerType : db . access . type || 'custom' ,
73
91
capabilities : Object . keys ( //TODO: cleanup this mess once tc39 object.fromEntries aproved
74
92
Object . assign ( { } , ... // https://tc39.github.io/proposal-object-from-entries
75
93
Object . entries ( {
You can’t perform that action at this time.
0 commit comments