mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-12 09:12:40 +02:00
test(web): add Composio Gmail E2E journey
This commit is contained in:
parent
f2e62a09b3
commit
b01173fe07
5 changed files with 187 additions and 3 deletions
|
|
@ -128,6 +128,35 @@ export async function triggerIndex(
|
|||
return { ok: true };
|
||||
}
|
||||
|
||||
export async function triggerIndexByDateRange(
|
||||
request: APIRequestContext,
|
||||
token: string,
|
||||
connectorId: number,
|
||||
searchSpaceId: number,
|
||||
options: { startDate?: string; endDate?: string } = {}
|
||||
): Promise<{ ok: true }> {
|
||||
const params = new URLSearchParams({ search_space_id: String(searchSpaceId) });
|
||||
if (options.startDate) params.set("start_date", options.startDate);
|
||||
if (options.endDate) params.set("end_date", options.endDate);
|
||||
|
||||
const response = await request.post(
|
||||
`${BACKEND_URL}/api/v1/search-source-connectors/${connectorId}/index?${params.toString()}`,
|
||||
{ headers: authHeaders(token) }
|
||||
);
|
||||
if (!response.ok()) {
|
||||
throw new Error(
|
||||
`triggerIndexByDateRange(${connectorId}) failed (${response.status()}): ${await response.text()}`
|
||||
);
|
||||
}
|
||||
const body = (await response.json()) as { indexing_started?: boolean; message?: string };
|
||||
if (body.indexing_started === false) {
|
||||
throw new Error(
|
||||
`triggerIndexByDateRange(${connectorId}) did not start indexing: ${body.message ?? "no message"}`
|
||||
);
|
||||
}
|
||||
return { ok: true };
|
||||
}
|
||||
|
||||
/**
|
||||
* Drives the OAuth flow for a Composio toolkit programmatically.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue