mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 04:01:58 +00:00
switch all fe to camelCase
This commit is contained in:
@@ -4,16 +4,16 @@ import { getManifest } from './get-package-data'
|
||||
|
||||
export function dryUpdate(
|
||||
{ id, version }: { id: string; version: string },
|
||||
pkgs: DataModel['package-data'],
|
||||
pkgs: DataModel['packageData'],
|
||||
emver: Emver,
|
||||
): string[] {
|
||||
return Object.values(pkgs)
|
||||
.filter(
|
||||
pkg =>
|
||||
Object.keys(pkg['current-dependencies'] || {}).some(
|
||||
Object.keys(pkg.currentDependencies || {}).some(
|
||||
pkgId => pkgId === id,
|
||||
) &&
|
||||
!emver.satisfies(version, pkg['current-dependencies'][id].versionRange),
|
||||
!emver.satisfies(version, pkg.currentDependencies[id].versionRange),
|
||||
)
|
||||
.map(pkg => getManifest(pkg).title)
|
||||
}
|
||||
|
||||
@@ -14,49 +14,47 @@ export async function getPackage(
|
||||
patch: PatchDB<DataModel>,
|
||||
id: string,
|
||||
): Promise<PackageDataEntry | undefined> {
|
||||
return firstValueFrom(patch.watch$('package-data', id))
|
||||
return firstValueFrom(patch.watch$('packageData', id))
|
||||
}
|
||||
|
||||
export async function getAllPackages(
|
||||
patch: PatchDB<DataModel>,
|
||||
): Promise<DataModel['package-data']> {
|
||||
return firstValueFrom(patch.watch$('package-data'))
|
||||
): Promise<DataModel['packageData']> {
|
||||
return firstValueFrom(patch.watch$('packageData'))
|
||||
}
|
||||
|
||||
export function getManifest(pkg: PackageDataEntry): Manifest {
|
||||
if (isInstalled(pkg) || isRemoving(pkg)) return pkg['state-info'].manifest
|
||||
if (isInstalled(pkg) || isRemoving(pkg)) return pkg.stateInfo.manifest
|
||||
|
||||
return (pkg['state-info'] as InstallingState)['installing-info'][
|
||||
'new-manifest'
|
||||
]
|
||||
return (pkg.stateInfo as InstallingState).installingInfo.newManifest
|
||||
}
|
||||
|
||||
export function isInstalled(
|
||||
pkg: PackageDataEntry,
|
||||
): pkg is PackageDataEntry<InstalledState> {
|
||||
return pkg['state-info'].state === PackageState.Installed
|
||||
return pkg.stateInfo.state === PackageState.Installed
|
||||
}
|
||||
|
||||
export function isRemoving(
|
||||
pkg: PackageDataEntry,
|
||||
): pkg is PackageDataEntry<InstalledState> {
|
||||
return pkg['state-info'].state === PackageState.Removing
|
||||
return pkg.stateInfo.state === PackageState.Removing
|
||||
}
|
||||
|
||||
export function isInstalling(
|
||||
pkg: PackageDataEntry,
|
||||
): pkg is PackageDataEntry<InstallingState> {
|
||||
return pkg['state-info'].state === PackageState.Installing
|
||||
return pkg.stateInfo.state === PackageState.Installing
|
||||
}
|
||||
|
||||
export function isRestoring(
|
||||
pkg: PackageDataEntry,
|
||||
): pkg is PackageDataEntry<InstallingState> {
|
||||
return pkg['state-info'].state === PackageState.Restoring
|
||||
return pkg.stateInfo.state === PackageState.Restoring
|
||||
}
|
||||
|
||||
export function isUpdating(
|
||||
pkg: PackageDataEntry,
|
||||
): pkg is PackageDataEntry<UpdatingState> {
|
||||
return pkg['state-info'].state === PackageState.Updating
|
||||
return pkg.stateInfo.state === PackageState.Updating
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@ import { firstValueFrom } from 'rxjs'
|
||||
export async function getServerInfo(
|
||||
patch: PatchDB<DataModel>,
|
||||
): Promise<ServerInfo> {
|
||||
return firstValueFrom(patch.watch$('server-info'))
|
||||
return firstValueFrom(patch.watch$('serverInfo'))
|
||||
}
|
||||
|
||||
@@ -4,5 +4,5 @@ export function hasCurrentDeps(
|
||||
id: string,
|
||||
pkgs: Record<string, PackageDataEntry>,
|
||||
): boolean {
|
||||
return !!Object.values(pkgs).some(pkg => !!pkg['current-dependencies'][id])
|
||||
return !!Object.values(pkgs).some(pkg => !!pkg.currentDependencies[id])
|
||||
}
|
||||
|
||||
@@ -12,8 +12,6 @@ import matches, {
|
||||
arrayOf,
|
||||
} from 'ts-matches'
|
||||
|
||||
type ValidVersion = 1 | 2
|
||||
|
||||
type PropertiesV1 = typeof matchPropertiesV1._TYPE
|
||||
type PackagePropertiesV1 = PropertiesV1[]
|
||||
type PackagePropertiesV2 = {
|
||||
|
||||
Reference in New Issue
Block a user