feat(platform): add the notification inbox and deterministic match search

This commit is contained in:
shira committed 2026-10-09 13:14:46 +03:00
1 parent 5edff21d2d
commit 0b11021b16
169 files changed
+17083 -443

No files matched your search

@@ -111,6 +111,7 @@ function matchResponseFixture(): MatchSearchResponseOutput {
},
],
},
truncated: false,
});
}
@@ -195,6 +196,15 @@ describe("match response adapter", () => {
expect(matchSearchFromTransport(roundTrip)).toEqual(model);
});
it("keeps the truncation flag, which carries no count", () => {
const response = { ...matchResponseFixture(), truncated: true };
const model = matchSearchFromTransport(response);
expect(model.truncated).toBe(true);
expect(matchSearchToTransport(model)).toEqual(response);
expect(() => matchSearchFromTransport({ ...response, truncated: undefined })).toThrow();
});
it("round-trips a need source using its requirements version", () => {
const response = matchResponseFixture();
const needResponse = {
@@ -84,6 +84,8 @@ export type MatchCardModel = MatchConfirmedCardModel | MatchUnconfirmedCardModel
export type MatchSearchModel = {
readonly source: MatchSearchSourceModel;
readonly cards: readonly MatchCardModel[];
/** True when the output is not the whole ranked result; it carries no count. */
readonly truncated: boolean;
};
function isRecord(value: unknown): value is Record<string, unknown> {
@@ -258,6 +260,7 @@ export function matchSearchFromTransport(value: unknown, status = 200): MatchSea
...response.groups.near.map((candidate) => confirmedFromTransport("near", candidate)),
...response.groups.unconfirmed.map(unconfirmedFromTransport),
],
truncated: response.truncated,
};
}
@@ -316,5 +319,6 @@ export function matchSearchToTransport(model: MatchSearchModel): MatchSearchResp
return matchSearchResponseSchema.parse({
source: sourceToTransport(model.source),
groups,
truncated: model.truncated,
});
}