@abtnode/schema 1.15.17 → 1.16.0-beta-8ee536d7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -16
- package/lib/index.js +597 -186
- package/lib/schema.graphqls +597 -186
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -4,38 +4,82 @@ Defines data structure for ABT Node backend API, and maintains schema for GQL en
|
|
|
4
4
|
|
|
5
5
|
## Development
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
You can choose one of the following two ways to build schema.
|
|
8
|
+
It is recommended to build with Docker.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
- Other platform: https://www.gnu.org/software/sed/
|
|
10
|
+
### Option 1. Build schema with Docker
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Requirements:
|
|
13
|
+
|
|
14
|
+
- Docker
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
docker pull arcblock/blocklet-server-proto
|
|
18
|
+
docker run --rm -v {absolute path of core/schema}:/home/root/schema arcblock/blocklet-server-proto
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Option 2. Build schema with Go
|
|
22
|
+
|
|
23
|
+
Requirements:
|
|
24
|
+
|
|
25
|
+
- go 1.8+
|
|
26
|
+
|
|
27
|
+
#### Install go
|
|
28
|
+
|
|
29
|
+
- Mac: brew install go
|
|
30
|
+
- Other platform: https://go.dev/doc/install
|
|
31
|
+
|
|
32
|
+
```shell
|
|
33
|
+
# you can use `go env` to check the go environment
|
|
34
|
+
go env
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
#### Install gnu-sed(MacOS)
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Install(Mac OS), other platform: https://www.gnu.org/software/sed/
|
|
42
|
+
brew install gnu-sed
|
|
43
|
+
# Make `sed` command work, only for homebrew:
|
|
44
|
+
PATH="$(brew --prefix)/opt/gnu-sed/libexec/gnubin:$PATH"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
#### Install protobuf
|
|
13
48
|
|
|
14
49
|
- Mac: brew install protobuf
|
|
15
50
|
- Other platform: https://developers.google.com/protocol-buffers/docs/downloads
|
|
16
51
|
|
|
17
|
-
|
|
52
|
+
#### Add to `~/.profile`
|
|
53
|
+
|
|
54
|
+
```shell
|
|
55
|
+
|
|
56
|
+
vim ~/.profile
|
|
57
|
+
|
|
58
|
+
# add the profile to the end of the file
|
|
59
|
+
# ----------------------------------------------------------
|
|
18
60
|
|
|
19
|
-
```
|
|
20
61
|
export GO111MODULE=on
|
|
21
62
|
export GOPROXY=https://goproxy.cn
|
|
22
63
|
|
|
23
|
-
|
|
64
|
+
# you can query the GOROOT/GOPATH/GOBIN by `go env`
|
|
65
|
+
export GOROOT=/usr/local/Cellar/go/1.15.5/libexec // replace to your local go path
|
|
24
66
|
export GOPATH=$HOME/.golang
|
|
25
67
|
export GOBIN=$GOPATH/bin
|
|
26
68
|
export PATH=$PATH:$GOROOT:$GOPATH:$GOBIN
|
|
27
|
-
|
|
28
|
-
|
|
69
|
+
|
|
70
|
+
# ----------------------------------------------------------
|
|
29
71
|
|
|
30
72
|
source ~/.profile
|
|
31
73
|
|
|
32
|
-
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
#### Install other dependencies
|
|
33
77
|
|
|
34
78
|
Run `make init`
|
|
35
79
|
|
|
36
80
|
> If there is a network problem, try to change golang registry by https://goproxy.cn/
|
|
37
81
|
|
|
38
|
-
|
|
82
|
+
#### Build Schema
|
|
39
83
|
|
|
40
84
|
Run `make build`
|
|
41
85
|
|
|
@@ -45,21 +89,23 @@ Run `make build`
|
|
|
45
89
|
|
|
46
90
|
After update the schema proto, run `make build` get the latest schema.
|
|
47
91
|
|
|
48
|
-
|
|
92
|
+
> If you are using mac, you may need replace the `sed` command with `gsed`
|
|
93
|
+
|
|
94
|
+
### 2. go to core/webapp start a demo endpoint
|
|
49
95
|
|
|
50
96
|
just run:
|
|
51
97
|
|
|
52
|
-
```
|
|
53
|
-
node
|
|
98
|
+
```shell
|
|
99
|
+
node tools/start-upgrade-server.js
|
|
54
100
|
```
|
|
55
101
|
|
|
56
|
-
> should make sure the DB Proxy is running
|
|
102
|
+
> should make sure the DB Proxy is running, if not, run `yarn start` in a new terminal
|
|
57
103
|
|
|
58
104
|
### 3. go to core/client do finally update
|
|
59
105
|
|
|
60
106
|
just run:
|
|
61
107
|
|
|
62
|
-
```
|
|
108
|
+
```shell
|
|
63
109
|
npm run upgrade
|
|
64
110
|
```
|
|
65
111
|
|