feat: durable AUD0 outbox + dataset/search/ER HTTP surfaces + P065 stängd (kod, utan workflow-ändringar) #43

Merged
admin merged 68 commits from feat/aud0-outbox-code-20260907 into main 2026-09-07 17:53:04 +00:00
Showing only changes of commit f3a8cf6cc2 - Show all commits
+33
View File
@@ -0,0 +1,33 @@
import { createAud0Client } from "../clients/aud0-client";
import { resolveDependencyBaseUrl } from "../platform/dependency-mode";
import { SiaxError } from "../platform/errors";
import { createSearchDefinitionRepository } from "../repositories/search-definition-repository";
import { HttpOpenSearchAdapter } from "../search/opensearch-adapter";
import { SearchService } from "../search/search-service";
let singleton: SearchService | undefined;
export function getSearchService(): SearchService {
if (singleton) return singleton;
const baseUrl = resolveDependencyBaseUrl("opensearch", process.env.OPENSEARCH_URL);
if (!baseUrl) {
throw new SiaxError("DEPENDENCY_UNAVAILABLE", "opensearch", "OPENSEARCH_URL is required for the search HTTP surface");
}
singleton = new SearchService(
new HttpOpenSearchAdapter({
baseUrl,
...(process.env.OPENSEARCH_BASIC_AUTH
? { basicAuth: process.env.OPENSEARCH_BASIC_AUTH }
: {}),
}),
{
aud0Client: createAud0Client(),
definitionRepository: createSearchDefinitionRepository(),
},
);
return singleton;
}
export function resetSearchServiceForTests(): void {
singleton = undefined;
}