Skip to content

Commit bf14a6e

Browse files
committed
Merge branch 'main' of https://github.com/ideal-world/bios
2 parents 933b12a + 3cdcc1b commit bf14a6e

File tree

25 files changed

+90
-51
lines changed

25 files changed

+90
-51
lines changed

Cargo.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ members = [
2525
"frontend/sdks/*",
2626
"frontend/clients/*",
2727
]
28-
28+
resolver = "2"
2929
[workspace.package]
3030
version = "0.1.0"
3131
authors = [
@@ -61,9 +61,9 @@ run_script = { version = "0.10" }
6161
testcontainers-modules = { version = "0.3", features = ["redis"] }
6262
strum = { version = "0.26", features = ["derive"] }
6363
# tardis
64-
# tardis = { version = "0.1.0-rc.10" }
64+
tardis = { version = "0.1.0-rc.11" }
6565
# tardis = { path = "../tardis/tardis" }
66-
tardis = { git = "https://github.com/ideal-world/tardis.git", rev = "191f3ec" }
66+
# tardis = { git = "https://github.com/ideal-world/tardis.git", rev = "191f3ec" }
6767
#spacegate
6868

6969
# spacegate-kernel = { git = "https://github.com/ideal-world/spacegate.git", rev = "f37a81a", features = [
@@ -80,8 +80,7 @@ tardis = { git = "https://github.com/ideal-world/tardis.git", rev = "191f3ec" }
8080
spacegate-shell = { git = "https://github.com/ideal-world/spacegate.git", branch = "master", features = [
8181
"cache",
8282
"k8s",
83-
"ext-redis",
84-
"ext-axum",
83+
# "ext-redis",
8584
] }
8685

8786
spacegate-plugin = { git = "https://github.com/ideal-world/spacegate.git", branch = "master" }

backend/middlewares/event/src/event_initializer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ async fn init_log_ws_client() -> TardisWSClient {
126126
let conf = funs.conf::<EventConfig>();
127127
let mut event_conf = conf.log_event.clone();
128128
if event_conf.avatars.is_empty() {
129-
event_conf.avatars.push(format!("{}/{}", event_conf.topic_code, tardis::pkg!()))
129+
event_conf.avatars.push(format!("{}/{}", event_conf.topic_code, env!("CARGO_PKG_NAME")))
130130
}
131131
let default_avatar = event_conf.avatars[0].clone();
132132
set_default_log_avatar(default_avatar);

backend/middlewares/flow/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ async-trait.workspace = true
2222
async-recursion.workspace = true
2323
lazy_static.workspace = true
2424
itertools.workspace = true
25-
tardis = { workspace = true, features = ["reldb-postgres", "web-client", "build-info"] }
25+
tardis = { workspace = true, features = ["reldb-postgres", "web-client"] }
2626
bios-basic = { path = "../../basic", features = ["default"] }
2727
bios-sdk-invoke = { path = "../../../frontend/sdks/invoke", features = ["default"] }
2828
[dev-dependencies]

backend/middlewares/flow/src/event.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub async fn start_flow_event_service(config: &EventTopicConfig) -> TardisResult
2121
let client = event_client::EventClient::new(config.base_url.as_str(), &funs);
2222
let mut event_conf = config.clone();
2323
if event_conf.avatars.is_empty() {
24-
event_conf.avatars.push(format!("{}/{}", event_conf.topic_code, tardis::pkg!()))
24+
event_conf.avatars.push(format!("{}/{}", event_conf.topic_code, env!("CARGO_PKG_NAME")))
2525
}
2626
let resp = client.register(&event_conf.into()).await?;
2727
let ws_client = TardisFuns::ws_client(&resp.ws_addr, |message| async move {

backend/middlewares/flow/src/flow_initializer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ async fn init_ws_flow_client() -> Option<TardisWSClient> {
887887
return None;
888888
}
889889
if event_conf.avatars.is_empty() {
890-
event_conf.avatars.push(format!("{}/{}", event_conf.topic_code, tardis::pkg!()))
890+
event_conf.avatars.push(format!("{}/{}", event_conf.topic_code, env!("CARGO_PKG_NAME")))
891891
}
892892
let default_avatar = event_conf.avatars[0].clone();
893893
set_default_flow_avatar(default_avatar);

backend/middlewares/schedule/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ git = "https://github.com/4t145/tokio-cron-scheduler.git"
3232
branch = "time-local"
3333
features = ["cron_local"]
3434
[dev-dependencies]
35-
tardis = { workspace = true, features = ["test", "ws-client", "build-info"] }
35+
tardis = { workspace = true, features = ["test", "ws-client"] }
3636
bios-basic = { path = "../../basic", features = ["default", "test"] }
3737
bios-spi-kv = { path = "../../spi/spi-kv" }
3838
bios-spi-log = { path = "../../spi/spi-log" }

backend/middlewares/schedule/src/schedule_initializer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ async fn init_ws_client() -> TardisWSClient {
3737
let conf = funs.conf::<ScheduleConfig>();
3838
let mut event_conf = conf.event.clone();
3939
if event_conf.avatars.is_empty() {
40-
event_conf.avatars.push(format!("{}/{}", event_conf.topic_code, tardis::pkg!()))
40+
event_conf.avatars.push(format!("{}/{}", event_conf.topic_code, env!("CARGO_PKG_NAME")))
4141
}
4242
let default_avatar = event_conf.avatars[0].clone();
4343
set_default_avatar(default_avatar);

backend/services/bios-all/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ publish.workspace = true
1212

1313
[dependencies]
1414
serde.workspace = true
15-
tardis = { workspace = true, features = ["web-server", "conf-remote", "cluster", "k8s", "build-info"] }
15+
tardis = { workspace = true, features = ["web-server", "conf-remote", "cluster", "k8s"] }
1616
bios-iam = { path = "../../supports/iam", features = ["spi_search", "spi_kv"] }
1717
bios-auth = { path = "../../supports/auth", features = ["web-server"] }
1818
bios-reach = { path = "../../supports/reach" }

backend/services/spacegate/Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@ lazy_static.workspace = true
1818
spacegate-shell = { workspace = true, features = [
1919
"k8s",
2020
"plugin-all",
21-
"ext-redis",
22-
"ext-axum",
21+
# "ext-redis",
2322
"cache",
2423
] }
25-
tardis = { workerspace = true }
24+
tardis = { workspace = true }
2625
spacegate-plugins = { path = "../../gateways/spacegate-plugins" }
2726
envy = "0.4"
2827
[dev-dependencies]

backend/spi/spi-conf/tests/spi_conf_nacos_compatible_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use bios_spi_conf::{
55
conf_constants::DOMAIN_CODE,
66
dto::conf_auth_dto::{RegisterRequest, RegisterResponse},
77
};
8-
use tardis::web::reqwest::header::HeaderName;
8+
use tardis::web::reqwest::{self, header::HeaderName};
99
use tardis::{
1010
basic::{dto::TardisContext, field::TrimString, result::TardisResult},
1111
log,

backend/spi/spi-log/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ serde.workspace = true
2323
tardis = { workspace = true, features = [
2424
"reldb-postgres",
2525
"web-server",
26-
"build-info"
2726
] }
2827
bios-basic = { path = "../../basic", features = ["default"] }
2928
bios-sdk-invoke = { path = "../../../frontend/sdks/invoke", features = [

backend/spi/spi-log/src/event.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub async fn start_log_event_service(config: &EventTopicConfig) -> TardisResult<
1717
let client = event_client::EventClient::new(config.base_url.as_str(), &funs);
1818
let mut event_conf = config.clone();
1919
if event_conf.avatars.is_empty() {
20-
event_conf.avatars.push(format!("{}/{}", event_conf.topic_code, tardis::pkg!()))
20+
event_conf.avatars.push(format!("{}/{}", event_conf.topic_code, env!("CARGO_PKG_NAME")))
2121
}
2222
let resp = client.register(&event_conf.into()).await?;
2323
let ws_client = TardisFuns::ws_client(&resp.ws_addr, |message| async move {

backend/spi/spi-plugin/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ async-trait.workspace = true
2424
tardis = { workspace = true, features = ["reldb-postgres", "web-server"] }
2525
bios-basic = { path = "../../basic", features = ["default"] }
2626
bios-sdk-invoke = { path = "../../../frontend/sdks/invoke", features = ["default"] }
27-
strum = { workerspace = true, features = ["derive"] }
27+
strum = { workspace = true, features = ["derive"] }
2828

2929
[dev-dependencies]
3030
tardis = { workspace = true, features = ["test", "ws-client"] }

backend/spi/spi-search/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ tardis = { workspace = true, features = [
2626
"web-server",
2727
"web-client",
2828
"openapi-rapidoc",
29-
"build-info"
3029
] }
3130
bios-basic = { path = "../../basic", features = ["default"] }
32-
strum = { workerspace = true, features = ["derive"] }
31+
strum = { workspace = true, features = ["derive"] }
3332
pinyin = { version = "0.10" }
3433
bios-sdk-invoke = { path = "../../../frontend/sdks/invoke", features = [
3534
"event",

backend/spi/spi-search/src/event.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub async fn start_search_event_service(config: &EventTopicConfig) -> TardisResu
2626
let client = event_client::EventClient::new(config.base_url.as_str(), &funs);
2727
let mut event_conf = config.clone();
2828
if event_conf.avatars.is_empty() {
29-
event_conf.avatars.push(format!("{}/{}", event_conf.topic_code, tardis::pkg!()))
29+
event_conf.avatars.push(format!("{}/{}", event_conf.topic_code, env!("CARGO_PKG_NAME")))
3030
}
3131
let resp = client.register(&event_conf.into()).await?;
3232
let ws_client = TardisFuns::ws_client(&resp.ws_addr, |message| async move {

backend/spi/spi-stats/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ lazy_static.workspace = true
2525
itertools.workspace = true
2626
tardis = { workspace = true, features = ["reldb-postgres", "web-server"] }
2727
serde_json = { workspace = true, features = ["preserve_order"] }
28-
strum = { workerspace = true, features = ["derive"] }
28+
strum = { workspace = true, features = ["derive"] }
2929

3030
[dev-dependencies]
3131
tardis = { workspace = true, features = ["test"] }

backend/spi/spi-stats/src/serv/pg/stats_pg_record_serv.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ pub(crate) async fn fact_record_load(
150150
let latest_data_resp = fact_get_latest_record_raw(fact_conf_key, fact_record_key, &conn, ctx).await?;
151151
fields.push("ext".to_string());
152152
if let Some(latest_data) = latest_data_resp.as_ref() {
153-
merge(&mut latest_data.try_get("", "ext")?, add_req.ext.unwrap_or(TardisFuns::json.str_to_json("{}")?));
153+
let mut storage_ext = latest_data.try_get("", "ext")?;
154+
merge(&mut storage_ext, add_req.ext.unwrap_or(TardisFuns::json.str_to_json("{}")?));
155+
values.push(Value::from(storage_ext.clone()));
154156
} else {
155157
values.push(add_req.ext.unwrap_or(TardisFuns::json.str_to_json("{}")?).into());
156158
}

backend/supports/iam/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ tardis = { workspace = true, features = [
3535
"web-client",
3636
"mail",
3737
"k8s",
38-
"build-info"
3938
] }
4039
bios-basic = { path = "../../basic", features = ["default", "with-mq"] }
4140
bios-sdk-invoke = { path = "../../../frontend/sdks/invoke", features = ["default", "event"] }
@@ -46,8 +45,8 @@ tokio-util = { version = "0.7", optional = true }
4645
ldap3 = { version = "0.11", optional = true }
4746
# todo Wait for tardis field to upgrade during removal
4847
nanoid = { version = "0.4" }
49-
strum = { workerspace = true, features = ["derive"] }
5048

49+
strum = { workspace = true, features = ["derive"] }
5150
[dev-dependencies]
5251
tardis = { workspace = true, features = ["test"] }
5352
bios-basic = { path = "../../basic", features = ["default", "test"] }

backend/supports/iam/src/basic/serv/iam_open_serv.rs

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -400,21 +400,55 @@ impl IamOpenServ {
400400
Ok(())
401401
}
402402

403-
pub async fn get_rule_info(cert_id: String, funs: &TardisFunsInst, ctx: &TardisContext) -> TardisResult<IamOpenRuleResp> {
404-
let ak = RbumCertServ::find_one_detail_rbum(
405-
&RbumCertFilterReq {
406-
id: Some(cert_id.to_string()),
407-
..Default::default()
408-
},
409-
funs,
410-
ctx,
411-
)
412-
.await?
413-
.ok_or_else(|| funs.err().internal_error("iam_open", "get_rule_info", "cert not found", "404-iam-res-not-exist"))?
414-
.ak;
403+
pub async fn get_rule_info(cert_id_req: Option<String>, ak_req: Option<String>, funs: &TardisFunsInst, ctx: &TardisContext) -> TardisResult<IamOpenRuleResp> {
404+
if cert_id_req.is_none() && ak_req.is_none() {
405+
return Err(funs.err().internal_error("iam_open", "get_rule_info", "illegal response", "404-iam-res-not-exist"));
406+
}
407+
let cert_id = if let Some(cert_id) = cert_id_req.clone() {
408+
cert_id
409+
} else {
410+
RbumCertServ::find_one_detail_rbum(
411+
&RbumCertFilterReq {
412+
basic: RbumBasicFilterReq {
413+
with_sub_own_paths: true,
414+
..Default::default()
415+
},
416+
ak: ak_req.clone(),
417+
..Default::default()
418+
},
419+
funs,
420+
ctx,
421+
)
422+
.await?
423+
.ok_or_else(|| funs.err().internal_error("iam_open", "get_rule_info", "cert not found", "404-iam-res-not-exist"))?
424+
.id
425+
};
426+
let ak = if let Some(ak) = ak_req.clone() {
427+
ak
428+
} else {
429+
RbumCertServ::find_one_detail_rbum(
430+
&RbumCertFilterReq {
431+
basic: RbumBasicFilterReq {
432+
with_sub_own_paths: true,
433+
..Default::default()
434+
},
435+
id: cert_id_req.clone(),
436+
..Default::default()
437+
},
438+
funs,
439+
ctx,
440+
)
441+
.await?
442+
.ok_or_else(|| funs.err().internal_error("iam_open", "get_rule_info", "cert not found", "404-iam-res-not-exist"))?
443+
.ak
444+
};
415445
// let spec_id = IamRelServ::find_from_id_rels(&IamRelKind::IamCertSpec, false, &cert_id, None, None, funs, ctx).await?.pop().unwrap_or_default();
416446
let spec_id = RbumRelServ::find_detail_rbums(
417447
&RbumRelFilterReq {
448+
basic: RbumBasicFilterReq {
449+
with_sub_own_paths: true,
450+
..Default::default()
451+
},
418452
from_rbum_id: Some(cert_id.to_string()),
419453
from_rbum_kind: Some(RbumRelFromKind::Cert),
420454
tag: Some(IamRelKind::IamCertSpec.to_string()),
@@ -433,6 +467,7 @@ impl IamOpenServ {
433467
let spec_code = IamResServ::find_one_detail_item(
434468
&IamResFilterReq {
435469
basic: RbumBasicFilterReq {
470+
with_sub_own_paths: true,
436471
ids: Some(vec![spec_id]),
437472
..Default::default()
438473
},

backend/supports/iam/src/console_interface/api/iam_ci_open_api.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,16 @@ impl IamCiOpenApi {
6868

6969
/// Get account rule info / 获取账号规则信息
7070
#[oai(path = "/", method = "get")]
71-
async fn get_rule_info(&self, cert_id: Query<String>, mut ctx: TardisContextExtractor, request: &Request) -> TardisApiResult<IamOpenRuleResp> {
71+
async fn get_rule_info(&self, cert_id: Query<Option<String>>, ak: Query<Option<String>>, _request: &Request) -> TardisApiResult<IamOpenRuleResp> {
7272
let mut funs = iam_constants::get_tardis_inst();
73-
check_without_owner_and_unsafe_fill_ctx(request, &funs, &mut ctx.0)?;
74-
add_remote_ip(request, &ctx.0).await?;
73+
let global_ctx = TardisContext {
74+
own_paths: "".to_string(),
75+
..Default::default()
76+
};
7577
funs.begin().await?;
76-
let result = IamOpenServ::get_rule_info(cert_id.0, &funs, &ctx.0).await?;
78+
let result = IamOpenServ::get_rule_info(cert_id.0, ak.0, &funs, &global_ctx).await?;
7779
funs.commit().await?;
78-
ctx.0.execute_task().await?;
80+
global_ctx.execute_task().await?;
7981
TardisResp::ok(result)
8082
}
8183

backend/supports/iam/src/iam_initializer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ async fn init_ws_log_client() -> Option<TardisWSClient> {
743743
return None;
744744
}
745745
if event_conf.avatars.is_empty() {
746-
event_conf.avatars.push(format!("{}/{}", event_conf.topic_code, tardis::pkg!()))
746+
event_conf.avatars.push(format!("{}/{}", event_conf.topic_code, env!("CARGO_PKG_NAME")))
747747
}
748748
let default_avatar = event_conf.avatars[0].clone();
749749
set_default_log_avatar(default_avatar);
@@ -782,7 +782,7 @@ async fn init_ws_search_client() -> Option<TardisWSClient> {
782782
return None;
783783
}
784784
if event_conf.avatars.is_empty() {
785-
event_conf.avatars.push(format!("{}/{}", event_conf.topic_code, tardis::pkg!()))
785+
event_conf.avatars.push(format!("{}/{}", event_conf.topic_code, env!("CARGO_PKG_NAME")))
786786
}
787787
let default_avatar = event_conf.avatars[0].clone();
788788
set_default_search_avatar(default_avatar);
@@ -821,7 +821,7 @@ async fn init_ws_iam_send_event_client() -> Option<TardisWSClient> {
821821
return None;
822822
}
823823
if event_conf.avatars.is_empty() {
824-
event_conf.avatars.push(format!("{}/{}", event_conf.topic_code, tardis::pkg!()))
824+
event_conf.avatars.push(format!("{}/{}", event_conf.topic_code, env!("CARGO_PKG_NAME")))
825825
}
826826
let default_avatar = event_conf.avatars[0].clone();
827827
set_default_iam_send_avatar(default_avatar);
@@ -853,7 +853,7 @@ pub async fn init_ws_iam_event_client() -> TardisResult<()> {
853853
let conf = funs.conf::<IamConfig>();
854854
let mut event_conf = conf.iam_event_bus.clone();
855855
if event_conf.avatars.is_empty() {
856-
event_conf.avatars.push(format!("{}/{}", event_conf.topic_code, tardis::pkg!()))
856+
event_conf.avatars.push(format!("{}/{}", event_conf.topic_code, env!("CARGO_PKG_NAME")))
857857
}
858858
let client = bios_sdk_invoke::clients::event_client::EventClient::new(&event_conf.base_url, &funs);
859859
let addr = loop {

backend/supports/iam/tests/test_ci_open.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,11 @@ pub async fn test(context1: &TardisContext) -> TardisResult<()> {
110110
)
111111
.await?;
112112
info!("【test_ci_open】 : Get account info");
113-
let info = IamOpenServ::get_rule_info(cert_id.clone(), &funs, context1).await?;
113+
let global_ctx = TardisContext {
114+
own_paths: "".to_string(),
115+
..Default::default()
116+
};
117+
let info = IamOpenServ::get_rule_info(Some(cert_id.clone()), None, &funs, &global_ctx).await?;
114118
assert_eq!(info.cert_id, cert_id.clone());
115119
assert_eq!(info.spec_code, spec1_code.clone());
116120
assert_eq!(info.api_call_frequency, Some(500));

backend/supports/iam/tests/test_iam_cert_sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ pub async fn test(ldap_account_num: u64, conf_ldap_add_or_modify_req: IamCertCon
130130
let mut is_finish = false;
131131
while is_finish {
132132
sleep(Duration::from_millis(100)).await;
133-
is_finish = TaskProcessor::check_status(&funs.conf::<IamConfig>().cache_key_async_task_status, task_id.parse::<i64>().unwrap(), &funs.cache()).await.unwrap();
133+
is_finish = TaskProcessor::check_status(&funs.conf::<IamConfig>().cache_key_async_task_status, task_id.parse::<u64>().unwrap(), &funs.cache()).await.unwrap();
134134
}
135135
}
136136
let account_page = IamAccountServ::paginate_account_summary_aggs(

frontend/enhance-wasm/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ license.workspace = true
99
edition.workspace = true
1010
readme.workspace = true
1111
publish.workspace = true
12-
1312
[lib]
1413
name = "bios_enhance_wasm"
1514
path = "src/lib.rs"
@@ -33,6 +32,8 @@ wasm-bindgen-futures = { version = "0" }
3332
serde-wasm-bindgen = { version = "0" }
3433
js-sys = { version = "0" }
3534
web-sys = { version = "0", features = [
35+
'MessageEvent',
36+
'Event',
3637
'Headers',
3738
'Request',
3839
'RequestInit',

frontend/sdks/invoke/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ simple-invoke-client-macro = { path = "../simple-invoke-client-macro" }
4141

4242
[[test]]
4343
name = "test_macros"
44-
features = ["macro"]
44+
required-features = ["macro"]

0 commit comments

Comments
 (0)