summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock11
-rw-r--r--Cargo.toml4
-rw-r--r--cargo/crates.bzl13
-rw-r--r--cargo/remote/BUILD.ctor-0.1.21.bazel57
-rw-r--r--common/rust/BUILD.bazel3
-rw-r--r--common/rust/cargo/BUILD.bazel18
-rw-r--r--common/rust/src/discord_models/slash_commands.rs2
-rw-r--r--common/rust/src/lib.rs18
-rw-r--r--common/rust/src/payloads.rs5
-rw-r--r--webhook/src/handler/tests/handler_integration.rs25
10 files changed, 128 insertions, 28 deletions
diff --git a/Cargo.lock b/Cargo.lock
index e8b87c7..50379df 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -314,6 +314,16 @@ dependencies = [
]
[[package]]
+name = "ctor"
+version = "0.1.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ccc0a48a9b826acdf4028595adc9db92caea352f7af011a3034acd172a52a0aa"
+dependencies = [
+ "quote",
+ "syn",
+]
+
+[[package]]
name = "curve25519-dalek"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2176,6 +2186,7 @@ name = "webhook"
version = "0.1.0"
dependencies = [
"common",
+ "ctor",
"hex",
"hyper",
"lazy_static",
diff --git a/Cargo.toml b/Cargo.toml
index 87ebe39..0a82844 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -51,7 +51,3 @@ compile_data_attr = "glob([\"*/**\"])"
additional_build_file = "bazel/patch/BUILD_script_patch"
gen_buildrs = false
additional_deps = [":libsodium_sys_build_script"]
-
-
-[package.metadata.raze.crates.value-bag.'*']
-gen_buildrs = false \ No newline at end of file
diff --git a/cargo/crates.bzl b/cargo/crates.bzl
index b0def28..78ffdaf 100644
--- a/cargo/crates.bzl
+++ b/cargo/crates.bzl
@@ -23,6 +23,7 @@ _DEPENDENCIES = {
},
"common/rust": {
"config": "@raze__config__0_11_0//:config",
+ "enumflags2": "@raze__enumflags2__0_7_1//:enumflags2",
"hyper": "@raze__hyper__0_14_12//:hyper",
"log": "@raze__log__0_4_14//:log",
"nats": "@raze__nats__0_15_2//:nats",
@@ -69,8 +70,10 @@ _DEPENDENCIES = {
# EXPERIMENTAL -- MAY CHANGE AT ANY TIME: A mapping of package names to a set of proc_macro dependencies for the Rust targets of that package.
_PROC_MACRO_DEPENDENCIES = {
"webhook": {
+ "ctor": "@raze__ctor__0_1_21//:ctor",
},
"common/rust": {
+ "serde_repr": "@raze__serde_repr__0_1_7//:serde_repr",
},
"gateway": {
"num-derive": "@raze__num_derive__0_3_3//:num_derive",
@@ -583,6 +586,16 @@ def raze_fetch_remote_crates():
maybe(
http_archive,
+ name = "raze__ctor__0_1_21",
+ url = "https://crates.io/api/v1/crates/ctor/0.1.21/download",
+ type = "tar.gz",
+ sha256 = "ccc0a48a9b826acdf4028595adc9db92caea352f7af011a3034acd172a52a0aa",
+ strip_prefix = "ctor-0.1.21",
+ build_file = Label("//cargo/remote:BUILD.ctor-0.1.21.bazel"),
+ )
+
+ maybe(
+ http_archive,
name = "raze__curve25519_dalek__3_2_0",
url = "https://crates.io/api/v1/crates/curve25519-dalek/3.2.0/download",
type = "tar.gz",
diff --git a/cargo/remote/BUILD.ctor-0.1.21.bazel b/cargo/remote/BUILD.ctor-0.1.21.bazel
new file mode 100644
index 0000000..9aac478
--- /dev/null
+++ b/cargo/remote/BUILD.ctor-0.1.21.bazel
@@ -0,0 +1,57 @@
+"""
+@generated
+cargo-raze crate build file.
+
+DO NOT EDIT! Replaced on runs of cargo-raze
+"""
+
+# buildifier: disable=load
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+# buildifier: disable=load
+load(
+ "@rules_rust//rust:rust.bzl",
+ "rust_binary",
+ "rust_library",
+ "rust_test",
+)
+
+package(default_visibility = [
+ # Public for visibility by "@raze__crate__version//" targets.
+ #
+ # Prefer access through "//cargo", which limits external
+ # visibility to explicit Cargo.toml dependencies.
+ "//visibility:public",
+])
+
+licenses([
+ "notice", # Apache-2.0 from expression "Apache-2.0 OR MIT"
+])
+
+# Generated Targets
+
+# Unsupported target "example" with type "example" omitted
+
+rust_library(
+ name = "ctor",
+ srcs = glob(["**/*.rs"]),
+ crate_features = [
+ ],
+ crate_root = "src/lib.rs",
+ crate_type = "proc-macro",
+ data = [],
+ edition = "2018",
+ rustc_flags = [
+ "--cap-lints=allow",
+ ],
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+ version = "0.1.21",
+ # buildifier: leave-alone
+ deps = [
+ "@raze__quote__1_0_9//:quote",
+ "@raze__syn__1_0_76//:syn",
+ ],
+)
diff --git a/common/rust/BUILD.bazel b/common/rust/BUILD.bazel
index 0fbd9b2..a1bbb4e 100644
--- a/common/rust/BUILD.bazel
+++ b/common/rust/BUILD.bazel
@@ -1,9 +1,10 @@
load("@rules_rust//rust:defs.bzl", "rust_library")
-load("//cargo:crates.bzl", "all_crate_deps")
+load("//cargo:crates.bzl", "all_crate_deps", "crate_deps")
rust_library(
name = "common",
srcs = glob(["src/**"]),
+ proc_macro_deps = crate_deps(["serde_repr"]),
visibility = ["//visibility:public"],
deps = all_crate_deps(),
)
diff --git a/common/rust/cargo/BUILD.bazel b/common/rust/cargo/BUILD.bazel
index e0e6aa6..1050df2 100644
--- a/common/rust/cargo/BUILD.bazel
+++ b/common/rust/cargo/BUILD.bazel
@@ -22,6 +22,15 @@ alias(
)
alias(
+ name = "enumflags2",
+ actual = "@raze__enumflags2__0_7_1//:enumflags2",
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+)
+
+alias(
name = "hyper",
actual = "@raze__hyper__0_14_12//:hyper",
tags = [
@@ -85,6 +94,15 @@ alias(
)
alias(
+ name = "serde_repr",
+ actual = "@raze__serde_repr__0_1_7//:serde_repr",
+ tags = [
+ "cargo-raze",
+ "manual",
+ ],
+)
+
+alias(
name = "testcontainers",
actual = "@raze__testcontainers__0_12_0//:testcontainers",
tags = [
diff --git a/common/rust/src/discord_models/slash_commands.rs b/common/rust/src/discord_models/slash_commands.rs
index ae0f190..181a622 100644
--- a/common/rust/src/discord_models/slash_commands.rs
+++ b/common/rust/src/discord_models/slash_commands.rs
@@ -93,7 +93,7 @@ pub struct Interaction {
#[serde(rename = "type")]
pub type_: InteractionRequestType,
/// i am not sure about this one https://canary.discord.com/developers/docs/interactions/slash-commands#interaction-object-application-command-interaction-data
- pub data: ApplicationCommand,
+ pub data: Option<ApplicationCommand>,
pub guild_id: Option<String>,
pub channel_id: Option<String>,
pub member: Option<GuildMember>,
diff --git a/common/rust/src/lib.rs b/common/rust/src/lib.rs
index 5418d0a..fa2c6fc 100644
--- a/common/rust/src/lib.rs
+++ b/common/rust/src/lib.rs
@@ -1,18 +1,18 @@
+pub use ::config as config_crate;
+pub use ::nats as nats_crate;
+pub use ::redis as redis_crate;
+pub use log;
+pub use prometheus;
+pub use serde;
+pub use testcontainers;
+
/// This crate is all the utilities shared by the nova rust projects
-/// It includes loging, config and protocols.
+/// It includes logging, config and protocols.
pub mod config;
pub mod discord_models;
pub mod error;
pub mod monitoring;
pub mod nats;
pub mod payloads;
-pub mod error;
pub mod redis;
-pub use log as log;
-pub use serde as serde;
-pub use ::config as config_crate;
-pub use prometheus as prometheus;
-pub use ::nats as nats_crate;
-pub use testcontainers as testcontainers;
-pub use ::redis as redis_crate;
diff --git a/common/rust/src/payloads.rs b/common/rust/src/payloads.rs
index d8d06f2..fd7717d 100644
--- a/common/rust/src/payloads.rs
+++ b/common/rust/src/payloads.rs
@@ -1,6 +1,7 @@
-use serde::{Deserialize, Serialize};
use std::fmt::Debug;
+use serde::{Deserialize, Serialize};
+
use crate::discord_models::{
application::Application,
channel::{Channel, Message, ThreadMember},
@@ -23,7 +24,7 @@ pub struct CachePayload {
pub data: CacheData,
}
-#[derive(Serialize, Deserialize, Debug)]
+#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Tracing {
pub node_id: String,
pub span: Option<String>,
diff --git a/webhook/src/handler/tests/handler_integration.rs b/webhook/src/handler/tests/handler_integration.rs
index 3ee0a09..6031428 100644
--- a/webhook/src/handler/tests/handler_integration.rs
+++ b/webhook/src/handler/tests/handler_integration.rs
@@ -1,23 +1,26 @@
use std::time::Duration;
-use crate::{
- config::Config,
- handler::tests::utils::{generate_keypair, sign_message},
- start,
-};
+
+use ctor;
+use hyper::{Body, Method, Request, StatusCode};
+use lazy_static::lazy_static;
+use serde_json::json;
+
use common::{
config::test_init,
nats_crate::Connection,
- testcontainers::{images::generic::WaitFor, Image},
+ testcontainers::{Image, images::generic::WaitFor},
};
use common::{
config::Settings,
log::info,
- testcontainers::{clients::Cli, images::generic::GenericImage, Container, Docker},
+ testcontainers::{clients::Cli, Container, Docker, images::generic::GenericImage},
+};
+
+use crate::{
+ config::Config,
+ handler::tests::utils::{generate_keypair, sign_message},
+ start,
};
-use hyper::{Body, Method, Request, StatusCode};
-use lazy_static::lazy_static;
-use serde_json::json;
-use ctor;
const fn nats_image<'a>() -> &'a str {
#[cfg(all(unix, target_arch = "x86_64"))]