@dashevo/dapi-grpc 4.0.0 → 4.1.0-beta.2

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 (3) hide show
  1. package/build.rs +4 -0
  2. package/package.json +2 -2
  3. package/src/lib.rs +42 -0
package/build.rs CHANGED
@@ -466,6 +466,10 @@ impl MappingConfig {
466
466
  let builder = typ
467
467
  .configure(tonic_prost_build::configure())
468
468
  .out_dir(out_dir.clone())
469
+ // Emit the FileDescriptorSet alongside the generated code so
470
+ // consumers can enumerate the served rpcs at test time (e.g.
471
+ // rs-dapi asserts its metrics allowlist covers every method).
472
+ .file_descriptor_set_path(out_dir.join("descriptor.bin"))
469
473
  .protoc_arg("--experimental_allow_proto3_optional");
470
474
 
471
475
  Self {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashevo/dapi-grpc",
3
- "version": "4.0.0",
3
+ "version": "4.1.0-beta.2",
4
4
  "description": "DAPI GRPC definition file and generated clients",
5
5
  "browser": "browser.js",
6
6
  "main": "node.js",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "homepage": "https://github.com/dashevo/dapi-grpc#readme",
47
47
  "dependencies": {
48
- "@dashevo/grpc-common": "4.0.0",
48
+ "@dashevo/grpc-common": "4.1.0-beta.2",
49
49
  "@dashevo/protobufjs": "6.10.5",
50
50
  "@grpc/grpc-js": "^1.14.3",
51
51
  "@improbable-eng/grpc-web": "^0.15.0",
package/src/lib.rs CHANGED
@@ -26,6 +26,26 @@ pub mod core {
26
26
  env!("DAPI_GRPC_OUT_DIR"),
27
27
  "/core/wasm/org.dash.platform.dapi.v0.rs"
28
28
  ));
29
+
30
+ /// Serialized `FileDescriptorSet` for the Core proto — lets consumers
31
+ /// enumerate the served rpcs (e.g. to assert metrics allowlists).
32
+ #[cfg(all(feature = "server", not(target_arch = "wasm32")))]
33
+ pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!(concat!(
34
+ env!("DAPI_GRPC_OUT_DIR"),
35
+ "/core/server/descriptor.bin"
36
+ ));
37
+
38
+ /// Serialized `FileDescriptorSet` for the Core proto — lets consumers
39
+ /// enumerate the served rpcs (e.g. to assert metrics allowlists).
40
+ #[cfg(all(
41
+ feature = "client",
42
+ not(feature = "server"),
43
+ not(target_arch = "wasm32")
44
+ ))]
45
+ pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!(concat!(
46
+ env!("DAPI_GRPC_OUT_DIR"),
47
+ "/core/client/descriptor.bin"
48
+ ));
29
49
  }
30
50
  }
31
51
 
@@ -53,6 +73,28 @@ pub mod platform {
53
73
  env!("DAPI_GRPC_OUT_DIR"),
54
74
  "/platform/wasm/org.dash.platform.dapi.v0.rs"
55
75
  ));
76
+
77
+ /// Serialized `FileDescriptorSet` for the Platform proto — lets
78
+ /// consumers enumerate the served rpcs (e.g. to assert metrics
79
+ /// allowlists).
80
+ #[cfg(all(feature = "server", not(target_arch = "wasm32")))]
81
+ pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!(concat!(
82
+ env!("DAPI_GRPC_OUT_DIR"),
83
+ "/platform/server/descriptor.bin"
84
+ ));
85
+
86
+ /// Serialized `FileDescriptorSet` for the Platform proto — lets
87
+ /// consumers enumerate the served rpcs (e.g. to assert metrics
88
+ /// allowlists).
89
+ #[cfg(all(
90
+ feature = "client",
91
+ not(feature = "server"),
92
+ not(target_arch = "wasm32")
93
+ ))]
94
+ pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!(concat!(
95
+ env!("DAPI_GRPC_OUT_DIR"),
96
+ "/platform/client/descriptor.bin"
97
+ ));
56
98
  }
57
99
 
58
100
  #[cfg(feature = "tenderdash-proto")]