From 20dece3f24c51ae3e5d4cd3d6c35250e5f6dfc48 Mon Sep 17 00:00:00 2001 From: ook37 Date: Sat, 18 Jan 2025 19:50:28 -0500 Subject: [PATCH] feat(api): make `baseChildren` available for parents --- client/src/types/package-info.ts | 1 + server/types/pac/script.go | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/client/src/types/package-info.ts b/client/src/types/package-info.ts index bcf2a52d..136ec98d 100644 --- a/client/src/types/package-info.ts +++ b/client/src/types/package-info.ts @@ -4,6 +4,7 @@ export default interface PackageInfo { packageBase: string baseIndex: int baseTotal: int + baseChildren: string[] description: string version: string sourceVersion: string diff --git a/server/types/pac/script.go b/server/types/pac/script.go index 840fef7e..93afaf04 100644 --- a/server/types/pac/script.go +++ b/server/types/pac/script.go @@ -48,6 +48,7 @@ type Script struct { PackageBase string `json:"packageBase"` BaseIndex int `json:"baseIndex"` BaseTotal int `json:"baseTotal"` + BaseChildren []string `json:"baseChildren"` Description string `json:"description"` Version string `json:"version"` SourceVersion string `json:"sourceVersion"` @@ -106,12 +107,17 @@ func (p *Script) Type() types.PackageTypeName { func FromSrcInfo(info srcinfo.Srcinfo) []*Script { var scripts []*Script if len(info.Packages) > 1 { + children := make([]string, len(info.Packages)) + for i, pkg := range info.Packages { + children[i] = pkg.Pkgname + } scripts = append(scripts, &Script{ PackageName: info.Pkgbase, PrettyName: "", PackageBase: info.Pkgbase, BaseIndex: 0, BaseTotal: len(info.Packages), + BaseChildren: children, Description: info.Pkgdesc, Version: info.Version(), SourceVersion: info.Pkgver, @@ -163,6 +169,7 @@ func FromSrcInfo(info srcinfo.Srcinfo) []*Script { PackageBase: info.Pkgbase, BaseIndex: i + 1, BaseTotal: len(info.Packages), + BaseChildren: nil, Description: fallback[string, string](pkg.Pkgdesc, info.Pkgdesc, nil), Version: info.Version(), SourceVersion: info.Pkgver,