Integrate validated catalog loading (T-201)
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
package catalog
|
||||
|
||||
// ManifestChannel separates modern and Win7 delivery tracks.
|
||||
type ManifestChannel string
|
||||
|
||||
const (
|
||||
ChannelModern ManifestChannel = "modern"
|
||||
ChannelWin7 ManifestChannel = "win7"
|
||||
)
|
||||
|
||||
// ReleaseChannel is the app release track supported by the MVP.
|
||||
type ReleaseChannel string
|
||||
|
||||
const (
|
||||
ReleaseStable ReleaseChannel = "stable"
|
||||
)
|
||||
|
||||
// AppCatalogStatus controls catalog visibility and installability.
|
||||
type AppCatalogStatus string
|
||||
|
||||
const (
|
||||
CatalogStatusActive AppCatalogStatus = "active"
|
||||
CatalogStatusDeprecated AppCatalogStatus = "deprecated"
|
||||
CatalogStatusHidden AppCatalogStatus = "hidden"
|
||||
)
|
||||
|
||||
// Architecture identifies a Windows package architecture.
|
||||
type Architecture string
|
||||
|
||||
const (
|
||||
Architecture386 Architecture = "386"
|
||||
ArchitectureAMD64 Architecture = "amd64"
|
||||
)
|
||||
|
||||
// WindowsRelease is an ordered minimum Windows release identifier.
|
||||
type WindowsRelease string
|
||||
|
||||
const (
|
||||
Windows7SP1 WindowsRelease = "windows-7-sp1"
|
||||
Windows10 WindowsRelease = "windows-10"
|
||||
Windows11 WindowsRelease = "windows-11"
|
||||
)
|
||||
|
||||
// Manifest is the signed Catalog protocol v1 document.
|
||||
type Manifest struct {
|
||||
SchemaVersion int `json:"schema_version"`
|
||||
Channel ManifestChannel `json:"channel"`
|
||||
GeneratedAt string `json:"generated_at"`
|
||||
MinBoxVersion string `json:"min_box_version"`
|
||||
Apps []App `json:"apps"`
|
||||
Signature string `json:"signature"`
|
||||
}
|
||||
|
||||
// App is one published product in a Manifest.
|
||||
type App struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Version string `json:"version"`
|
||||
Channel ReleaseChannel `json:"channel"`
|
||||
Status AppCatalogStatus `json:"status"`
|
||||
Category string `json:"category"`
|
||||
Tags []string `json:"tags"`
|
||||
Icon string `json:"icon,omitempty"`
|
||||
Homepage string `json:"homepage,omitempty"`
|
||||
Tutorial string `json:"tutorial,omitempty"`
|
||||
MinOS WindowsRelease `json:"min_os"`
|
||||
Architectures []Architecture `json:"architectures"`
|
||||
EntryEXE string `json:"entry_exe"`
|
||||
RequiresAdmin bool `json:"requires_admin"`
|
||||
Packages map[Architecture]Package `json:"packages"`
|
||||
}
|
||||
|
||||
// Package describes one downloadable ZIP artifact.
|
||||
type Package struct {
|
||||
URL string `json:"url"`
|
||||
Size int64 `json:"size"`
|
||||
SHA256 string `json:"sha256"`
|
||||
Signature string `json:"signature"`
|
||||
}
|
||||
|
||||
// Target describes the client build and operating system consuming a Catalog.
|
||||
type Target struct {
|
||||
Channel ManifestChannel
|
||||
OS WindowsRelease
|
||||
Architecture Architecture
|
||||
}
|
||||
|
||||
// AvailabilityReason is stable data for UI localization and action gating.
|
||||
type AvailabilityReason string
|
||||
|
||||
const (
|
||||
ReasonNone AvailabilityReason = ""
|
||||
ReasonDeprecated AvailabilityReason = "deprecated"
|
||||
ReasonMinimumOS AvailabilityReason = "minimum_os"
|
||||
ReasonArchitecture AvailabilityReason = "architecture"
|
||||
)
|
||||
|
||||
// Entry is a visible app after target filtering.
|
||||
type Entry struct {
|
||||
App App
|
||||
Package *Package
|
||||
Installable bool
|
||||
Reason AvailabilityReason
|
||||
}
|
||||
|
||||
// Catalog is a verified, validated and target-filtered Manifest.
|
||||
type Catalog struct {
|
||||
Manifest Manifest
|
||||
Entries []Entry
|
||||
Source LoadSource
|
||||
Warning error
|
||||
}
|
||||
Reference in New Issue
Block a user