mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
* update actions response types and partially implement in UI * further remove diagnostic ui * convert action response nested to array * prepare action res modal for Alex * ad dproperties action for Bitcoin * feat: add action success dialog (#2753) * feat: add action success dialog * mocks for string action res and hide properties from actions page --------- Co-authored-by: Matt Hill <mattnine@protonmail.com> * return null * remove properties from backend * misc fixes * make severity separate argument * rename ActionRequest to ActionRequestOptions * add clearRequests * fix s9pk build * remove config and properties, introduce action requests * better ux, better moocks, include icons * fix dependency types * add variant for versionCompat * fix dep icon display and patch operation display * misc fixes * misc fixes * alpha 12 * honor provided input to set values in action * fix: show full descriptions of action success items (#2758) * fix type * fix: fix build:deps command on Windows (#2752) * fix: fix build:deps command on Windows * fix: add escaped quotes --------- Co-authored-by: Aiden McClelland <me@drbonez.dev> * misc db compatibility fixes --------- Co-authored-by: Alex Inkin <alexander@inkin.ru> Co-authored-by: Aiden McClelland <me@drbonez.dev> Co-authored-by: Aiden McClelland <3732071+dr-bonez@users.noreply.github.com>
104 lines
3.2 KiB
TypeScript
104 lines
3.2 KiB
TypeScript
import * as T from "../../../base/lib/types"
|
|
import { ImageConfig, ImageId, VolumeId } from "../../../base/lib/types"
|
|
import {
|
|
SDKManifest,
|
|
SDKImageInputSpec,
|
|
} from "../../../base/lib/types/ManifestTypes"
|
|
import { SDKVersion } from "../StartSdk"
|
|
import { VersionGraph } from "../version/VersionGraph"
|
|
|
|
/**
|
|
* @description Use this function to define critical information about your package
|
|
*
|
|
* @param versions Every version of the package, imported from ./versions
|
|
* @param manifest Static properties of the package
|
|
*/
|
|
export function setupManifest<
|
|
Id extends string,
|
|
Dependencies extends Record<string, unknown>,
|
|
VolumesTypes extends VolumeId,
|
|
AssetTypes extends VolumeId,
|
|
ImagesTypes extends ImageId,
|
|
Manifest extends {
|
|
dependencies: Dependencies
|
|
id: Id
|
|
assets: AssetTypes[]
|
|
images: Record<ImagesTypes, SDKImageInputSpec>
|
|
volumes: VolumesTypes[]
|
|
},
|
|
>(manifest: SDKManifest & Manifest): SDKManifest & Manifest {
|
|
return manifest
|
|
}
|
|
|
|
export function buildManifest<
|
|
Id extends string,
|
|
Version extends string,
|
|
Dependencies extends Record<string, unknown>,
|
|
VolumesTypes extends VolumeId,
|
|
AssetTypes extends VolumeId,
|
|
ImagesTypes extends ImageId,
|
|
Manifest extends {
|
|
dependencies: Dependencies
|
|
id: Id
|
|
assets: AssetTypes[]
|
|
images: Record<ImagesTypes, SDKImageInputSpec>
|
|
volumes: VolumesTypes[]
|
|
},
|
|
>(
|
|
versions: VersionGraph<Version>,
|
|
manifest: SDKManifest & Manifest,
|
|
): Manifest & T.Manifest {
|
|
const images = Object.entries(manifest.images).reduce(
|
|
(images, [k, v]) => {
|
|
v.arch = v.arch || ["aarch64", "x86_64"]
|
|
if (v.emulateMissingAs === undefined)
|
|
v.emulateMissingAs = v.arch[0] || null
|
|
images[k] = v as ImageConfig
|
|
return images
|
|
},
|
|
{} as { [k: string]: ImageConfig },
|
|
)
|
|
return {
|
|
...manifest,
|
|
gitHash: null,
|
|
osVersion: SDKVersion,
|
|
version: versions.current.options.version,
|
|
releaseNotes: versions.current.options.releaseNotes,
|
|
satisfies: versions.current.options.satisfies || [],
|
|
canMigrateTo: versions.canMigrateTo().toString(),
|
|
canMigrateFrom: versions.canMigrateFrom().toString(),
|
|
images,
|
|
alerts: {
|
|
install: manifest.alerts?.install || null,
|
|
update: manifest.alerts?.update || null,
|
|
uninstall: manifest.alerts?.uninstall || null,
|
|
restore: manifest.alerts?.restore || null,
|
|
start: manifest.alerts?.start || null,
|
|
stop: manifest.alerts?.stop || null,
|
|
},
|
|
hardwareRequirements: {
|
|
device: Object.fromEntries(
|
|
Object.entries(manifest.hardwareRequirements?.device || {}).map(
|
|
([k, v]) => [k, v.source],
|
|
),
|
|
),
|
|
ram: manifest.hardwareRequirements?.ram || null,
|
|
arch:
|
|
manifest.hardwareRequirements?.arch === undefined
|
|
? Object.values(images).reduce(
|
|
(arch, inputSpec) => {
|
|
if (inputSpec.emulateMissingAs) {
|
|
return arch
|
|
}
|
|
if (arch === null) {
|
|
return inputSpec.arch
|
|
}
|
|
return arch.filter((a) => inputSpec.arch.includes(a))
|
|
},
|
|
null as string[] | null,
|
|
)
|
|
: manifest.hardwareRequirements?.arch,
|
|
},
|
|
}
|
|
}
|