Add analytics meta for downloading dependent projects (#6318)

* Send dependent mod info to backend

* Parse meta from query

* condense dependent_on and modpack

* Analytics dependents response
This commit is contained in:
aecsocket
2026-06-09 16:47:52 +01:00
committed by GitHub
parent 3258d7dbdf
commit bc5a761312
15 changed files with 363 additions and 22 deletions
+2
View File
@@ -197,11 +197,13 @@ export async function add_project_from_version(
path: string,
versionId: string,
reason: DownloadReason,
dependentOnVersionId?: string,
): Promise<string> {
return await invoke('plugin:profile|profile_add_project_from_version', {
path,
versionId,
reason,
dependentOnVersionId,
})
}
+9 -5
View File
@@ -71,7 +71,7 @@ export const installVersionDependencies = async (profile, version, reason, onDep
return installed
}
const queueInstall = async (projectId, resolvedVersion) => {
const queueInstall = async (projectId, resolvedVersion, dependentOn) => {
if (!resolvedVersion?.id) return false
const versionId = resolvedVersion.id
@@ -91,7 +91,11 @@ export const installVersionDependencies = async (profile, version, reason, onDep
if (resolvedProjectId) {
queuedProjectVersions.set(resolvedProjectId, versionId)
}
queuedInstalls.push({ versionId, projectId: resolvedProjectId })
queuedInstalls.push({
versionId,
projectId: resolvedProjectId,
dependentOnVersionId: dependentOn?.id,
})
return true
}
@@ -159,7 +163,7 @@ export const installVersionDependencies = async (profile, version, reason, onDep
if (!resolved) continue
const { depVersion, depProjectId } = resolved
const queued = await queueInstall(depProjectId, depVersion)
const queued = await queueInstall(depProjectId, depVersion, inputVersion)
if (queued && depProjectId) {
await announceDependency(depProjectId, depVersion)
}
@@ -176,8 +180,8 @@ export const installVersionDependencies = async (profile, version, reason, onDep
for (let i = 0; i < queuedInstalls.length; i += batchSize) {
const batch = queuedInstalls.slice(i, i + batchSize)
await Promise.all(
batch.map(async ({ versionId }) => {
await add_project_from_version(profile.path, versionId, reason)
batch.map(async ({ versionId, dependentOnVersionId }) => {
await add_project_from_version(profile.path, versionId, reason, dependentOnVersionId)
}),
)
}