MCPcopy
hub / github.com/CapSoftware/Cap / getAllDatasources

Function getAllDatasources

scripts/analytics/delete-all-data.js:6–25  ·  view source on GitHub ↗
(client)

Source from the content-addressed store, hash-verified

4import { createTinybirdClient, resolveTinybirdAuth } from "./shared.js";
5
6async function getAllDatasources(client) {
7 try {
8 const payload = await client.request(`/v0/datasources`);
9 const list = Array.isArray(payload?.datasources)
10 ? payload.datasources
11 : Array.isArray(payload?.data)
12 ? payload.data
13 : Array.isArray(payload)
14 ? payload
15 : [];
16 const names = list
17 .map((ds) => (typeof ds === "string" ? ds : ds?.name))
18 .filter(Boolean);
19 const unique = Array.from(new Set(names));
20 if (unique.length > 0) return unique;
21 } catch {
22 // fall through to fallback list
23 }
24 return ["analytics_events", "analytics_pages_mv", "analytics_sessions_mv"];
25}
26
27async function doubleConfirm({
28 workspaceName,

Callers 1

deleteAllDataFunction · 0.85

Calls 1

requestMethod · 0.45

Tested by

no test coverage detected