Skip to content

Commit 4f54855

Browse files
authored
Merge pull request #4 from codenotary/feat/update_schema
Feat/update schema
2 parents eee4e6d + efc1477 commit 4f54855

File tree

8 files changed

+33
-20
lines changed

8 files changed

+33
-20
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ test/immudb
55
.nyc_output
66
test/root.json
77
.vscode
8+
rootfile

examples/batch-operations.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/*
2+
Copyright 2019-2020 vChain, Inc.
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
114
const ImmudbClient = require('../lib/client')
215

316
const IMMUDB_HOST = process.env.IMMUDB_HOST || '127.0.0.1'

examples/database-operations-long-index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ async function main(err, cl) {
8484
keyPrefix: rand,
8585
offset: '10',
8686
limit: 1,
87-
reverse: true,
87+
reverse: false,
8888
deep: false,
8989
}
9090
res = await cl.scan(req)

lib/client.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ require('dotenv').config()
33
const grpc = require('@grpc/grpc-js')
44
const empty = require('google-protobuf/google/protobuf/empty_pb');
55

6-
const messages = require('../proto/schema_pb')
7-
const services = require('../proto/schema_grpc_pb')
6+
const messages = require('../protos/build/schema_pb')
7+
const services = require('../protos/build/schema_grpc_pb')
88
const util = require('./util')
99
const proofs = require('./proofs')
1010
const root = require('./root')
@@ -841,7 +841,7 @@ const getBatch = (params, callback) => {
841841
}
842842

843843
callback(null, {
844-
items : result,
844+
items: result,
845845
})
846846
})
847847
} catch (err) {

lib/root.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const fs = require('fs')
22
const process = require('process')
33

4-
const messages = require('../proto/schema_pb')
4+
const messages = require('../protos/build/schema_pb')
55

66
let root = {}
77
let rootPath

lib/util.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ const utf8Encode = (val) => {
99
}
1010

1111
const utf8Decode = (val) => {
12-
if (val === '') {
13-
return val
14-
}
12+
if (val === '') { return val }
1513
return new util.TextDecoder("utf-8").decode(val)
1614
}
1715

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
},
3232
"tap": {
3333
"nyc-arg": [
34-
"--exclude=proto"
34+
"--exclude=protos"
3535
]
3636
},
3737
"keywords": [

pb_generator.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
set -e
22
set -x
33

4-
# ./node_modules/@grpc/grpc-js/packages/grpc-tools/bin/protoc.js \
5-
# --proto_path=proto \
6-
# --proto_path=./node_modules/protobufjs \
7-
# --js_out=import_style=commonjs,binary:proto \
8-
# --plugin==protc-gen-grpc=./node_modules/@grpc/grpc-js/packages/grpc-tools/bin/grpc_node_plugin \
9-
# --grpc_out=import_style=commonjs,binary:proto \
10-
# proto/schema.proto \
11-
# node_modules/protobufjs/google/**/*.proto
4+
SRC_PATH=protos
5+
DEST_PATH=$SRC_PATH/build
126

7+
# remove the dest directory
8+
if [ -d "$DEST_PATH" ]; then rm -Rf $DEST_PATH; fi
9+
10+
# recreate dest directory
11+
mkdir $DEST_PATH
12+
13+
# generate js codes via grpc_tools_node_protoc[CommonJS imports]
1314
grpc_tools_node_protoc \
14-
--js_out=import_style=commonjs,binary:./protos \
15-
--grpc_out=grpc_js:./protos \
16-
-I=./protos ./protos/*.proto
15+
--js_out=import_style=commonjs,binary:./$DEST_PATH \
16+
--grpc_out=grpc_js:./$DEST_PATH \
17+
-I=./protos ./$SRC_PATH/*.proto

0 commit comments

Comments
 (0)