feat: cut over rust web main shell

This commit is contained in:
lix-2026
2026-04-29 12:24:44 +08:00
parent 7965c6c107
commit 048fe28a4d
97 changed files with 9396 additions and 1263 deletions
+41 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { buildSearchRequest } from "./request";
import { SEARCH_REQUEST_TRANSPORT_CONTRACT, buildSearchRequest } from "./request";
describe("buildSearchRequest", () => {
it("combines标题过滤与时间范围", () => {
@@ -42,4 +42,44 @@ describe("buildSearchRequest", () => {
expect(payload?.filters.onlyCurrentPage).toBe(false);
expect(payload?.documentId).toBeUndefined();
});
it("固定搜索请求将由 Rust Web search.documents transport 拥有", () => {
const payload = buildSearchRequest({
workspaceId: "ws-3",
activeDocumentId: "doc-3",
query: "Rust Web",
filters: {
titleOnly: false,
exact: true,
onlyCurrentPage: true,
includeOcr: true,
timeField: "updated",
customRange: undefined,
},
timeRange: "any",
});
expect(payload).toMatchObject({
workspaceId: "ws-3",
documentId: "doc-3",
query: "Rust Web",
filters: {
exact: true,
includeOcr: true,
onlyCurrentPage: true,
},
});
});
});
describe("SEARCH_REQUEST_TRANSPORT_CONTRACT", () => {
it("搜索请求 contract 固定为 Rust Web transport", () => {
expect(SEARCH_REQUEST_TRANSPORT_CONTRACT).toEqual({
shellOwner: "mnote-web",
queryName: "search.documents",
endpoint: "/api/search/documents",
runtimeRole: "rust_web_transport",
});
});
});