feat(search): search the record from one endpoint

This commit is contained in:
Marc-André Bombeck committed 2026-10-11 12:27:28 +02:00
1 parent 42ba471765
commit 1766ffa3d2
14 files changed
+1564 -10

No files matched your search

@@ -68,6 +68,7 @@ import {
import { TREND_CHART_CONFIG } from "@/lib/insights/trend-chart-select";
import { SYMPTOM_CHANNEL_PREFIX } from "@/lib/symptoms/shared";
import { DAY_SECTION_KEYS, TIMELINE_LANE_KEYS } from "@/lib/day/contract";
import { SEARCH_SOURCE_KEYS } from "@/lib/search/sources";
import {
SURFACE_KINDS,
SURFACE_MODULE,
@@ -171,6 +172,13 @@ describe("every surface id names a surface that exists", () => {
}
});
it("search: a source the record search reads", () => {
const keys = new Set<string>(SEARCH_SOURCE_KEYS);
for (const id of localIds("search")) {
expect(keys.has(id), id).toBe(true);
}
});
it("correlation: a discovery channel, a weather field or the lab pass", () => {
const channels = new Set<string>([
...DISCOVERY_BEHAVIOURS,
@@ -289,6 +297,9 @@ describe("every surface that shows a module's data is owned by it", () => {
["day-section:lifeEvents", "timeline"],
["day-section:symptoms", "illness"],
["timeline-lane:documents", "inboundDocuments"],
["search:document", "inboundDocuments"],
["search:moodNote", "mood"],
["search:symptomNote", "illness"],
])("%s is owned by %s", (id, owner) => {
expect(surfaceModule(id)).toBe(owner);
});
+18
View File
@@ -52,6 +52,8 @@ import type { ModuleKey } from "@/lib/modules/registry";
* day loader blanks a section whose owner is off, and the views drop it.
* - `timeline-lane`: a lane of the timeline, by its `TimelineLaneKey`; the
* readiness inventory leaves it out the same way.
* - `search`: a source the in-app record search reads, by its
* `SearchSourceKey`. A source whose owner is off is not read at all.
*/
export const SURFACE_KINDS = [
"nav",
@@ -68,6 +70,7 @@ export const SURFACE_KINDS = [
"score-ring",
"day-section",
"timeline-lane",
"search",
] as const;
export type SurfaceKind = (typeof SURFACE_KINDS)[number];
@@ -247,6 +250,21 @@ const STATIC_SURFACE_MODULE = {
"timeline-lane:labs": "labs",
"timeline-lane:documents": "inboundDocuments",
"timeline-lane:cycle": "cycle",
// ── Record search sources (v1.42.2) ──
// Visits are core. Notes on readings follow the owner of the reading's
// type and are filtered item by item, like the timeline's `life` lane.
"search:condition": "illness",
"search:document": "inboundDocuments",
"search:vaccination": "vaccinations",
"search:labAnalyte": "labs",
"search:labNote": "labs",
"search:medication": "medications",
"search:symptom": "illness",
"search:symptomNote": "illness",
"search:workout": "workouts",
"search:moodNote": "mood",
"search:illnessNote": "illness",
} as const satisfies Record<string, ModuleKey>;
/** A surface id the map declares literally. */