feat: add msglib bounded message listing
This commit is contained in:
@@ -49,6 +49,10 @@ $displaySources = $null
|
||||
$displayEntitySummaries = @()
|
||||
$messageSources = $null
|
||||
$messageSourceSummaries = @()
|
||||
$messageList = $null
|
||||
$messageListSources = @()
|
||||
$messageListContentTextNonEmptyCount = 0
|
||||
$messageListDownloadRefNonEmptyCount = 0
|
||||
if ($SQLiteDllPath -and $DbPath) {
|
||||
if (-not (Test-Path -LiteralPath $SQLiteDllPath)) {
|
||||
throw "SQLite DLL not found: $SQLiteDllPath"
|
||||
@@ -95,6 +99,31 @@ if ($SQLiteDllPath -and $DbPath) {
|
||||
}
|
||||
}
|
||||
|
||||
$messageList = Invoke-SidecarJson @{
|
||||
protocol = "isphere.msglib.v1"
|
||||
request_id = "verify-list-messages"
|
||||
op = "list_messages"
|
||||
args = @{
|
||||
sqlite_dll_path = $SQLiteDllPath
|
||||
db_path = $DbPath
|
||||
password = "123"
|
||||
conversation_type = "auto"
|
||||
limit = 5
|
||||
include_body = $false
|
||||
include_attachment_metadata = $true
|
||||
}
|
||||
}
|
||||
if (-not $messageList.ok -or -not $messageList.data.read_only -or $messageList.data.message_body_values_returned -or $messageList.data.raw_rows_returned -or $messageList.data.file_paths_returned) {
|
||||
throw "list_messages failed"
|
||||
}
|
||||
$messageListRows = @($messageList.data.messages)
|
||||
$messageListSources = @($messageList.data.source_tables)
|
||||
$messageListContentTextNonEmptyCount = @($messageListRows | Where-Object { $_.content_text -or $_.text }).Count
|
||||
$messageListDownloadRefNonEmptyCount = @($messageListRows | ForEach-Object { @($_.attachments) } | Where-Object { $_.download_ref }).Count
|
||||
if ($messageListContentTextNonEmptyCount -ne 0 -or $messageListDownloadRefNonEmptyCount -ne 0) {
|
||||
throw "list_messages returned body text or download refs while include_body=false"
|
||||
}
|
||||
|
||||
foreach ($entityType in @("contacts", "groups")) {
|
||||
$displayEntities = Invoke-SidecarJson @{
|
||||
protocol = "isphere.msglib.v1"
|
||||
@@ -131,6 +160,13 @@ if ($SQLiteDllPath -and $DbPath) {
|
||||
display_entity_summaries = $displayEntitySummaries
|
||||
message_source_count = if ($messageSources) { $messageSources.data.message_sources.Count } else { 0 }
|
||||
message_source_summaries = $messageSourceSummaries
|
||||
message_list_count = if ($messageList) { @($messageList.data.messages).Count } else { 0 }
|
||||
message_list_sources = $messageListSources
|
||||
message_list_body_values_returned = if ($messageList) { [bool]$messageList.data.message_body_values_returned } else { $false }
|
||||
message_list_raw_rows_returned = if ($messageList) { [bool]$messageList.data.raw_rows_returned } else { $false }
|
||||
message_list_file_paths_returned = if ($messageList) { [bool]$messageList.data.file_paths_returned } else { $false }
|
||||
message_list_content_values_omitted = ($messageListContentTextNonEmptyCount -eq 0)
|
||||
message_list_download_refs_omitted = ($messageListDownloadRefNonEmptyCount -eq 0)
|
||||
message_body_values_returned = $false
|
||||
raw_rows_returned = $false
|
||||
file_paths_returned = $false
|
||||
|
||||
Reference in New Issue
Block a user