https://support.atlassian.com/bitbucket-cloud/docs/configure-your-dvcs-username-for-commits/
https://www.devextent.com/import-es-modules-in-nodejs-with-typescript-and-babel/
First run immudb docker image with exposed ports:
docker run -d -it --rm -p 8080:8080 -p 3322:3322 -p 9497:9497 -p 5432:5432 --name immudb codenotary/immudb:latest
Then install node dependencies, and run example.
npm install
npm run build && node ./dist/src/index.js
First get code of immudb submodule:
git submodule --init
then copy latest proto file using powershell:
Copy-Item .\immudb\pkg\api\schema\schema.proto -Destination .\proto
or bash:
cp ./immudb/pkg/api/schema/schema.proto -Destination ./proto
Now repair synthax errors in copied .proto
file.
Following lines should be commented:
import "google/api/annotations.proto";
import "protoc-gen-swagger/options/annotations.proto";
Also:
;
semicolon aftertitle: "immudb REST API";
should be removed;
semicolon afterinfo: { ... };
should be removed
To generate code and types in src/proto
directory:
npx proto-loader-gen-types \
--longs=Long \
--enums=String \
--bytes=Buffer \
--defaults \
--arrays \
--objects \
--oneofs \
--json \
--grpcLib=@grpc/grpc-js \
--outDir=src/proto/ \
proto/schema.proto
npx proto-loader-gen-types `
--longs=Long `
--enums=String `
--bytes=Buffer `
--defaults `
--arrays `
--objects `
--oneofs `
--json `
--grpcLib=@grpc/grpc-js `
--outDir=src/proto/ `
proto/schema.proto
To generate static protobuf code in file pb/immu.js
:
npx pbjs --target static-module --force-long --es6 --wrap es6 --out pb/immu.js proto/schema.proto
To use as a module and generate typedefinitions change second line on pb/immu.js
to:
import $protobuf from "protobufjs";
To generate typescript type definitions in file pb/immu.d.ts
:
npx pbjs --target static-module --force-long --es6 --wrap es6 proto/schema.proto | npx pbts -o pb/immu.d.ts -