feat(capabilities): advertise the FHIR REST face and share-link surface

Add a single canonical FHIR_REST_RESOURCE_TYPES catalogue (plus the
$everything operation and honoured search params) to fhir/rest.ts; the
metadata CapabilityStatement and the share-link resource-type enum now
derive from it so the advertised set can never drift from what is routed.

Extend GET /api/meta/capabilities with the FHIR REST descriptor
(restBaseUrl, readScope, resourceTypes, operations, searchParams) and a
clinician-share descriptor (supported, maxDays, resourceTypes, scopeable
sections) — every list sourced from its canonical registry, guarded by
the existing drift assertions. Grow the OpenAPI CapabilitiesResponse to
match.

Fill the clinician test-matrix gap: assert the clinician view never
requests a KVNR / identifier opt-in from the aggregator (default-OFF by
construction) and resolves a rolling window without reaching data older
than the frozen start.
This commit is contained in:
Marc-André Bombeck committed 2026-06-04 02:34:33 +02:00
1 parent 93694cacd0
commit d4686ea2a6
7 files changed
+240 -24

No files matched your search

+11 -13
View File
@@ -9,14 +9,12 @@
*/
import { apiHandler, requireAuth } from "@/lib/api-handler";
import { annotate } from "@/lib/logging/context";
import { FHIR_READ_SCOPE, fhirJsonResponse } from "@/lib/fhir/rest";
const READ_RESOURCES = [
"Patient",
"Observation",
"MedicationStatement",
"MedicationAdministration",
] as const;
import {
FHIR_READ_SCOPE,
FHIR_REST_RESOURCE_TYPES,
FHIR_SEARCH_PARAMS,
fhirJsonResponse,
} from "@/lib/fhir/rest";
export const GET = apiHandler(async () => {
await requireAuth(FHIR_READ_SCOPE);
@@ -35,13 +33,13 @@ export const GET = apiHandler(async () => {
documentation:
"Read-only access to the authenticated user's own health record.",
resource: [
...READ_RESOURCES.map((type) => ({
...FHIR_REST_RESOURCE_TYPES.map((type) => ({
type,
interaction: [{ code: "read" }, { code: "search-type" }],
searchParam: [
{ name: "_count", type: "number" },
{ name: "_offset", type: "number" },
],
searchParam: FHIR_SEARCH_PARAMS.map((name) => ({
name,
type: "number",
})),
})),
{
type: "Patient",