* Converts a v1 CQL search result item to a lightweight metadata stub.
(item: Record<string, unknown>, domain: string)
| 130 | * Converts a v1 CQL search result item to a lightweight metadata stub. |
| 131 | */ |
| 132 | function cqlResultToStub(item: Record<string, unknown>, domain: string): ExternalDocument { |
| 133 | const links = item._links as Record<string, string> | undefined |
| 134 | const metadata = item.metadata as Record<string, unknown> | undefined |
| 135 | const labelsWrapper = metadata?.labels as Record<string, unknown> | undefined |
| 136 | const labelResults = (labelsWrapper?.results || []) as Record<string, unknown>[] |
| 137 | const labels = labelResults.map((l) => l.name as string) |
| 138 | |
| 139 | return pageToStub(item, { |
| 140 | spaceId: (item.space as Record<string, unknown>)?.key, |
| 141 | labels, |
| 142 | sourceUrl: links?.webui ? `https://${domain}/wiki${links.webui}` : undefined, |
| 143 | }) |
| 144 | } |
| 145 | |
| 146 | export const confluenceConnector: ConnectorConfig = { |
| 147 | ...confluenceConnectorMeta, |
no test coverage detected