feat(nacos): improve configuration batch management

This commit is contained in:
二丫讲梵 authored and GitHub committed 2026-08-11 21:32:46 +08:00
1 parent 9808660559
commit da6e2738ce
16 files changed
+847 -95

No files matched your search

+67 -2
View File
@@ -2706,12 +2706,48 @@ fn parse_config_history_item(
operator: optional_string_field(&item, &["operator", "opUser", "srcUser", "createUser", "modifyUser", "user"]),
last_modified_time: optional_string_field(
&item,
&["lastModifiedTime", "lastModifiedTs", "gmtModified", "modifiedTime", "opTime", "createdTime"],
&[
"lastModifiedTime",
"lastModifiedTs",
"lastModified",
"last_modified_time",
"last_modified",
"gmtModified",
"gmt_modified",
"modifiedTime",
"modifyTime",
"updateTime",
"update_time",
"publishTime",
"publish_time",
"opTime",
"createdTime",
"createTime",
"create_time",
],
)
.or_else(|| {
optional_u64_field(
&item,
&["lastModifiedTime", "lastModifiedTs", "gmtModified", "modifiedTime", "opTime", "createdTime"],
&[
"lastModifiedTime",
"lastModifiedTs",
"lastModified",
"last_modified_time",
"last_modified",
"gmtModified",
"gmt_modified",
"modifiedTime",
"modifyTime",
"updateTime",
"update_time",
"publishTime",
"publish_time",
"opTime",
"createdTime",
"createTime",
"create_time",
],
)
.map(|value| value.to_string())
}),
@@ -5282,6 +5318,35 @@ mod tests {
assert_eq!(parsed.items[0].operation.as_deref(), Some("publish"));
}
#[test]
fn parses_history_last_modified_aliases() {
let parsed = parse_config_history_list(
serde_json::json!({
"data": {
"pageItems": [{
"id": 7,
"dataId": "app.yaml",
"group": "DEFAULT_GROUP",
"lastModified": "2026-08-11 15:07:48"
}, {
"id": 8,
"dataId": "app.yaml",
"group": "DEFAULT_GROUP",
"publish_time": 1786430868000i64
}]
}
}),
"public".to_string(),
1,
20,
"fallback.yaml",
"DEFAULT_GROUP",
);
assert_eq!(parsed.items[0].last_modified_time.as_deref(), Some("2026-08-11 15:07:48"));
assert_eq!(parsed.items[1].last_modified_time.as_deref(), Some("1786430868000"));
}
#[test]
fn parses_config_history_detail_shape() {
let parsed = parse_config_history_detail(