@vocdoni/proto 1.14.0

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.
Files changed (51) hide show
  1. package/.github/workflows/on-release.yml +19 -0
  2. package/.github/workflows/post-merge.yml +32 -0
  3. package/AUTHORS +7 -0
  4. package/LICENSE +661 -0
  5. package/Makefile +134 -0
  6. package/README.md +112 -0
  7. package/bin/protoc +0 -0
  8. package/code-of-conduct.md +77 -0
  9. package/dist/client-store/index.d.ts +3 -0
  10. package/dist/client-store/index.js +2689 -0
  11. package/dist/client-store/index.mjs +2676 -0
  12. package/dist/entity-35513b52.d.ts +1804 -0
  13. package/dist/index-45e93762.d.ts +1924 -0
  14. package/dist/index-7dfc19fc.d.ts +1972 -0
  15. package/dist/index-85137ec5.d.ts +9976 -0
  16. package/dist/index.d.ts +5 -0
  17. package/dist/index.js +9077 -0
  18. package/dist/index.mjs +9065 -0
  19. package/dist/metadata/index.d.ts +3 -0
  20. package/dist/metadata/index.js +3751 -0
  21. package/dist/metadata/index.mjs +3708 -0
  22. package/dist/vochain/index.d.ts +2 -0
  23. package/dist/vochain/index.js +5541 -0
  24. package/dist/vochain/index.mjs +5464 -0
  25. package/go.mod +8 -0
  26. package/go.sum +69 -0
  27. package/include/google/protobuf/any.proto +158 -0
  28. package/include/google/protobuf/api.proto +208 -0
  29. package/include/google/protobuf/compiler/plugin.proto +183 -0
  30. package/include/google/protobuf/descriptor.proto +909 -0
  31. package/include/google/protobuf/duration.proto +116 -0
  32. package/include/google/protobuf/empty.proto +52 -0
  33. package/include/google/protobuf/field_mask.proto +245 -0
  34. package/include/google/protobuf/source_context.proto +48 -0
  35. package/include/google/protobuf/struct.proto +95 -0
  36. package/include/google/protobuf/timestamp.proto +147 -0
  37. package/include/google/protobuf/type.proto +187 -0
  38. package/include/google/protobuf/wrappers.proto +123 -0
  39. package/package.json +44 -0
  40. package/src/client-store/account.proto +54 -0
  41. package/src/client-store/backup.proto +65 -0
  42. package/src/client-store/gateway.proto +35 -0
  43. package/src/client-store/wallet.proto +19 -0
  44. package/src/ipfsSync/ipfssync.proto +26 -0
  45. package/src/metadata/entity.proto +75 -0
  46. package/src/metadata/feed.proto +51 -0
  47. package/src/metadata/process.proto +38 -0
  48. package/src/vocdoni-node/statedb.proto +33 -0
  49. package/src/vochain/vochain.proto +473 -0
  50. package/tsconfig.json +15 -0
  51. package/tsup.config.ts +15 -0
package/Makefile ADDED
@@ -0,0 +1,134 @@
1
+ SHELL := /bin/bash
2
+ PATH := $(PATH):$(HOME)/.pub-cache/bin:$(PWD)/bin:$(HOME)/go/bin
3
+ .DEFAULT_GOAL := help
4
+
5
+ PROJECT_NAME=$(shell basename "$(PWD)")
6
+ CLIENT_STORE_SOURCES=$(wildcard src/client-store/*.proto)
7
+ METADATA_SOURCES=$(wildcard src/metadata/*.proto)
8
+ VOCHAIN_SOURCES=$(wildcard src/vochain/*.proto)
9
+ IPFSSYNC_SOURCES=$(wildcard src/ipfsSync/*.proto)
10
+ VOCDONI_NODE_SOURCES=$(wildcard src/vocdoni-node/*.proto)
11
+
12
+ PROTOC?=$(shell which protoc)
13
+ $(if $(PROTOC),,$(eval PROTOC=bin/protoc))
14
+ PROTOC_TS_PLUGIN := ./node_modules/.bin/protoc-gen-ts_proto
15
+
16
+ define install_protoc
17
+ @if [ "$(PROTOC)" == "bin/protoc" -a ! -x bin/protoc ]; then \
18
+ case "$$(uname)" in \
19
+ linux|Linux) \
20
+ curl -L https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protoc-3.15.8-linux-x86_64.zip > protoc.zip \
21
+ ;;\
22
+ darwin|Darwin) \
23
+ curl -L https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protoc-3.15.8-osx-x86_64.zip > protoc.zip \
24
+ ;;\
25
+ *) \
26
+ echo "Unsupported platform: $$(uname)" ;\
27
+ exit 1 ;\
28
+ esac ;\
29
+ unzip -d . protoc.zip ;\
30
+ rm protoc.zip readme.txt;\
31
+ fi
32
+ endef
33
+
34
+ define install_protoc_go
35
+ @if [ "$(PROTOC)" == "bin/protoc" -a ! -x bin/protoc-gen-go ]; then \
36
+ if [ ! -d "$$GOPATH" ] ; then \
37
+ export GOPATH="$$HOME/go" ;\
38
+ fi ; \
39
+ go install google.golang.org/protobuf/cmd/protoc-gen-go ;\
40
+ fi
41
+ endef
42
+
43
+ #-----------------------------------------------------------------------
44
+ # HELP
45
+ #-----------------------------------------------------------------------
46
+
47
+ ## help: Display this message
48
+
49
+ .PHONY: help
50
+ help:
51
+ @echo
52
+ @echo " Available actions in "$(PROJECT_NAME)":"
53
+ @echo
54
+ @sed -n 's/^##//p' Makefile | column -t -s ':' | sed -e 's/^/ /'
55
+ @echo
56
+
57
+ ## :
58
+
59
+ ## init: Install external dependencies
60
+ init: protoc protoc-dart-plugin $(PROTOC_TS_PLUGIN) protoc-go-plugin
61
+
62
+ ## clean: Remove the build artifacts
63
+ clean:
64
+ rm -Rf build include dist
65
+
66
+ ## :
67
+
68
+ #-----------------------------------------------------------------------
69
+ # RECIPES
70
+ #-----------------------------------------------------------------------
71
+
72
+
73
+ ## all: Generate the source code for all supported languages
74
+ all: protoc build/dart build/ts build/go/models
75
+
76
+ ## golang: Generate the Golang protobuf artifacts
77
+ golang: protoc protoc-go-plugin build/go/models
78
+
79
+ build/go/models: $(VOCHAIN_SOURCES) $(VOCDONI_NODE_SOURCES) $(IPFSSYNC_SOURCES)
80
+ rm -rf $@
81
+ mkdir -p $@
82
+ for f in $^ ; do \
83
+ $(PROTOC) --go_opt=paths=source_relative --experimental_allow_proto3_optional -I=$(PWD)/src --go_out=$@ $(PWD)/$$f ; \
84
+ done
85
+ find $@ -iname "*.go" -type f -exec mv {} $@ \;
86
+ find $@ -type d -empty -delete
87
+ @touch $@
88
+
89
+
90
+ ## dart: Generate the Dart protobuf artifacts
91
+ dart: protoc protoc-dart-plugin build/dart
92
+
93
+ build/dart: $(CLIENT_STORE_SOURCES) $(METADATA_SOURCES) $(VOCHAIN_SOURCES)
94
+ mkdir -p $@
95
+ for f in $^ ; do \
96
+ $(PROTOC) --experimental_allow_proto3_optional -I=$(PWD)/src --dart_out=$(PWD)/$@ $(PWD)/$$f ; \
97
+ done
98
+ @touch $@
99
+
100
+ ## js: Generate the TypeScript protobuf artifacts
101
+ js: protoc $(PROTOC_TS_PLUGIN) build/ts
102
+ ts: js
103
+
104
+ build/ts: $(VOCHAIN_SOURCES) $(CLIENT_STORE_SOURCES) $(METADATA_SOURCES)
105
+ mkdir -p build
106
+ cp -r typescript build/ts
107
+ mkdir -p $@
108
+ for f in $^ ; do \
109
+ $(PROTOC) -I=$(PWD)/src --plugin=$(PROTOC_TS_PLUGIN) --experimental_allow_proto3_optional --ts_proto_opt=esModuleInterop=true --ts_proto_opt=exportCommonSymbols=false --ts_proto_opt=oneof=unions --ts_proto_out=$@ $(PWD)/$$f ; \
110
+ done
111
+ @touch $@
112
+ npm i --no-package-lock
113
+
114
+ #-----------------------------------------------------------------------
115
+ # COMPILERS
116
+ #-----------------------------------------------------------------------
117
+
118
+ .PHONY: protoc
119
+ protoc:
120
+ $(call install_protoc)
121
+
122
+ # DART
123
+ .PHONY: protoc-dart-plugin
124
+ protoc-dart-plugin:
125
+ dart pub global activate protoc_plugin
126
+
127
+ # TS
128
+ $(PROTOC_TS_PLUGIN):
129
+ @npm install ts-proto --no-package-lock
130
+
131
+ # GO
132
+ .PHONY: protoc-go-plugin
133
+ protoc-go-plugin:
134
+ $(call install_protoc_go)
package/README.md ADDED
@@ -0,0 +1,112 @@
1
+ # DVote Protobuf
2
+
3
+ Protobuf definitions for messages and services used by the Vocdoni open stack.
4
+
5
+ Check out the source code generated for each of the available languages.
6
+
7
+ ## Important note
8
+
9
+ - In protobuf, new fields can be added, renamed and removed with future-compatibility.
10
+ - However, **once an ID has been used, it can't never be reused by any other field again**
11
+
12
+ ## Get started
13
+
14
+ In order to be able to build this project, you need some dependencies in your machine:
15
+
16
+ - [go](https://golang.org/doc/install) for the go bindings
17
+ - [dart](https://dart.dev/get-dart) for the dart bindings
18
+ - [npm & node](https://nodejs.org/en/download/) for the ts bindings
19
+ - build essentials like `make`
20
+
21
+ If `protoc` is installed in the host system, it will be used by default.
22
+ To force installing protoc, set PROTOC variable to blank: `PROTOC= make <action>`
23
+
24
+ To install `protoc` and the plugins for Dart, Go and TS:
25
+
26
+ ```sh
27
+ $ make init
28
+ ```
29
+
30
+ Or optionally:
31
+
32
+ ```sh
33
+ $ make protoc/bin/protoc
34
+ $ make protoc-dart-plugin
35
+ $ make protoc-ts-plugin
36
+ $ make protoc-go-plugin
37
+ ```
38
+
39
+ Then, run `make all` to build all the targets
40
+
41
+ ## Available models
42
+
43
+ - `client-store`
44
+ - Data types used for client apps to store local data
45
+ - `common`
46
+ - Types shared across many components
47
+ - `metadata`
48
+ - Human readable data for organizations, governance processes, news feeds, etc.
49
+ - `vochain`
50
+ - Specific data types for the Vocdoni Vochain
51
+
52
+ ## Build
53
+
54
+ + Build DART models: `make dart`
55
+ + Build JS/TS models: `make ts`
56
+ + Build GoLang models: `make golang`
57
+
58
+ ## Artifacts
59
+
60
+ Import the files from:
61
+ - `build/dart/*`
62
+ - `go-vocdonitypes/*`
63
+
64
+ ## Usage
65
+
66
+ ### Typescript/Nodejs
67
+
68
+ You can either import things from the main package or from the individual exports
69
+
70
+ ~~~js
71
+ const { Vochain } = require('@vocdoni/proto')
72
+ // this is the same as
73
+ const Vochain = require('@vocdoni/proto/vochain')
74
+ ~~~
75
+
76
+ Using the individual exports is useful if you want to import only a specific part
77
+ and not the entire bundle. It's also less boilerplate, since you can directly access
78
+ the types without having to use the required namespace:
79
+
80
+ ~~~js
81
+ import { TxType } from '@vocdoni/proto/vochain'
82
+ // this is the same as
83
+
84
+ import { Vochain } from '@vocdoni/proto'
85
+ const { TxType } = Vochain
86
+ ~~~
87
+
88
+ > Note: required namespaces can be `Vochain`, `Metadata` and `ClientStore`.
89
+ > Named exports are dashed: `vochain`, `metadata` and `client-store`.
90
+
91
+ ## License
92
+
93
+ This SDK is licensed under the [GNU Affero General Public License v3.0][license].
94
+
95
+ Vocdoni Proto - Protobuf definitions for messages and services used by the
96
+ Vocdoni open stack.
97
+ Copyright (C) 2022 Vocdoni Roots MCU
98
+
99
+ This program is free software: you can redistribute it and/or modify
100
+ it under the terms of the GNU Affero General Public License as published by
101
+ the Free Software Foundation, either version 3 of the License, or
102
+ (at your option) any later version.
103
+
104
+ This program is distributed in the hope that it will be useful,
105
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
106
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
107
+ GNU Affero General Public License for more details.
108
+
109
+ You should have received a copy of the GNU Affero General Public License
110
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
111
+
112
+ [license]: ./LICENSE
package/bin/protoc ADDED
Binary file
@@ -0,0 +1,77 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies within all project spaces, and it also applies when
49
+ an individual is representing the project or its community in public spaces.
50
+ Examples of representing a project or community include using an official
51
+ project e-mail address, posting via an official social media account, or acting
52
+ as an appointed representative at an online or offline event. Representation of
53
+ a project may be further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ [homepage]: https://www.contributor-covenant.org
74
+
75
+ For answers to common questions about this code of conduct, see
76
+ https://www.contributor-covenant.org/faq
77
+
@@ -0,0 +1,3 @@
1
+ export { a as Account, b as Backup, g as Gateway, w as Wallet } from '../index-45e93762.js';
2
+ import 'protobufjs/minimal';
3
+ import '../entity-35513b52.js';