feat: add msglib display entity extraction

This commit is contained in:
zhaoyilun
2026-07-10 03:02:16 +08:00
parent 974fcaa018
commit 8be4a6a6c5
8 changed files with 459 additions and 26 deletions

View File

@@ -46,6 +46,7 @@ if (-not $self.ok -or $self.data.sidecar_name -ne "MsgLibReadSidecar" -or $self.
$providerChecked = $false
$displaySources = $null
$displayEntitySummaries = @()
if ($SQLiteDllPath -and $DbPath) {
if (-not (Test-Path -LiteralPath $SQLiteDllPath)) {
throw "SQLite DLL not found: $SQLiteDllPath"
@@ -66,7 +67,31 @@ if ($SQLiteDllPath -and $DbPath) {
}
}
if (-not $displaySources.ok -or -not $displaySources.data.metadata_only -or $displaySources.data.message_body_values_returned) {
throw "display_sources failed: $($displaySources | ConvertTo-Json -Depth 12 -Compress)"
throw "display_sources failed"
}
foreach ($entityType in @("contacts", "groups")) {
$displayEntities = Invoke-SidecarJson @{
protocol = "isphere.msglib.v1"
request_id = "verify-display-entities-$entityType"
op = "display_entities"
args = @{
sqlite_dll_path = $SQLiteDllPath
db_path = $DbPath
password = "123"
entity_type = $entityType
limit = 5
}
}
if (-not $displayEntities.ok -or -not $displayEntities.data.metadata_only -or -not $displayEntities.data.read_only -or $displayEntities.data.message_body_values_returned -or $displayEntities.data.raw_rows_returned) {
throw "display_entities failed for $entityType"
}
$sourceTables = @($displayEntities.data.entities | ForEach-Object { $_.source_table } | Sort-Object -Unique)
$displayEntitySummaries += [ordered]@{
entity_type = $entityType
entity_count = @($displayEntities.data.entities).Count
source_tables = $sourceTables
}
}
$providerChecked = $true
}
@@ -78,4 +103,5 @@ if ($SQLiteDllPath -and $DbPath) {
process_bits = $self.data.process_bits
provider_checked = $providerChecked
display_source_count = if ($displaySources) { $displaySources.data.display_sources.Count } else { 0 }
} | ConvertTo-Json -Depth 6 -Compress
display_entity_summaries = $displayEntitySummaries
} | ConvertTo-Json -Depth 8 -Compress