feat: add msglib message source metadata

This commit is contained in:
zhaoyilun
2026-07-10 08:36:34 +08:00
parent 1a21a01184
commit c8ecf5b36e
8 changed files with 380 additions and 15 deletions

View File

@@ -47,6 +47,8 @@ if (-not $self.ok -or $self.data.sidecar_name -ne "MsgLibReadSidecar" -or $self.
$providerChecked = $false
$displaySources = $null
$displayEntitySummaries = @()
$messageSources = $null
$messageSourceSummaries = @()
if ($SQLiteDllPath -and $DbPath) {
if (-not (Test-Path -LiteralPath $SQLiteDllPath)) {
throw "SQLite DLL not found: $SQLiteDllPath"
@@ -70,6 +72,29 @@ if ($SQLiteDllPath -and $DbPath) {
throw "display_sources failed"
}
$messageSources = Invoke-SidecarJson @{
protocol = "isphere.msglib.v1"
request_id = "verify-message-sources"
op = "message_sources"
args = @{
sqlite_dll_path = $SQLiteDllPath
db_path = $DbPath
password = "123"
}
}
if (-not $messageSources.ok -or -not $messageSources.data.metadata_only -or -not $messageSources.data.read_only -or $messageSources.data.message_body_values_returned -or $messageSources.data.raw_rows_returned -or $messageSources.data.file_paths_returned) {
throw "message_sources failed"
}
foreach ($source in @($messageSources.data.message_sources)) {
$messageSourceSummaries += [ordered]@{
source = $source.source
table = $source.table
role = $source.role
available = $source.available
row_count = $source.row_count
}
}
foreach ($entityType in @("contacts", "groups")) {
$displayEntities = Invoke-SidecarJson @{
protocol = "isphere.msglib.v1"
@@ -104,4 +129,9 @@ if ($SQLiteDllPath -and $DbPath) {
provider_checked = $providerChecked
display_source_count = if ($displaySources) { $displaySources.data.display_sources.Count } else { 0 }
display_entity_summaries = $displayEntitySummaries
message_source_count = if ($messageSources) { $messageSources.data.message_sources.Count } else { 0 }
message_source_summaries = $messageSourceSummaries
message_body_values_returned = $false
raw_rows_returned = $false
file_paths_returned = $false
} | ConvertTo-Json -Depth 8 -Compress