update patch types for current dependencies

This commit is contained in:
Matt Hill
2024-03-27 10:25:07 -06:00
parent f9edff8bf4
commit 22d8d08355
10 changed files with 52 additions and 68 deletions

View File

@@ -1608,7 +1608,6 @@ export module Mock {
},
},
currentDependencies: {},
dependencyInfo: {},
marketplaceUrl: 'https://registry.start9.com/',
developerKey: 'developer-key',
}
@@ -1737,15 +1736,13 @@ export module Mock {
},
},
currentDependencies: {
bitcoind: {
versionRange: '>=26.0.0',
healthChecks: [],
},
},
dependencyInfo: {
bitcoind: {
title: Mock.MockManifestBitcoind.title,
icon: 'assets/img/service-icons/bitcoind.svg',
kind: 'running',
registryUrl: '',
versionSpec: '>=26.0.0',
healthChecks: [],
},
},
marketplaceUrl: 'https://registry.start9.com/',
@@ -1982,23 +1979,21 @@ export module Mock {
},
},
currentDependencies: {
bitcoind: {
versionRange: '>=26.0.0',
healthChecks: [],
},
'btc-rpc-proxy': {
versionRange: '>2.0.0', // @TODO
healthChecks: [],
},
},
dependencyInfo: {
bitcoind: {
title: Mock.MockManifestBitcoind.title,
icon: 'assets/img/service-icons/bitcoind.svg',
kind: 'running',
registryUrl: 'https://registry.start9.com',
versionSpec: '>=26.0.0',
healthChecks: [],
},
'btc-rpc-proxy': {
title: Mock.MockManifestBitcoinProxy.title,
icon: 'assets/img/service-icons/btc-rpc-proxy.png',
kind: 'exists',
registryUrl: 'https://community-registry.start9.com',
versionSpec: '>2.0.0', // @TODO
healthChecks: [],
},
},
marketplaceUrl: 'https://registry.start9.com/',

View File

@@ -679,8 +679,6 @@ export class MockApiService extends ApiService {
this.updateProgress(params.id)
}, 1000)
const manifest = Mock.LocalPkgs[params.id].stateInfo.manifest
const patch: Operation<
PackageDataEntry<InstallingState | UpdatingState>
>[] = [
@@ -691,15 +689,15 @@ export class MockApiService extends ApiService {
...Mock.LocalPkgs[params.id],
stateInfo: {
// if installing
state: PackageState.Installing,
// state: PackageState.Installing,
// if updating
// state: PackageState.Updating,
// manifest,
state: PackageState.Updating,
manifest: mockPatchData.packageData[params.id].stateInfo.manifest!,
// both
installingInfo: {
newManifest: manifest,
newManifest: Mock.LocalPkgs[params.id].stateInfo.manifest,
progress: PROGRESS,
},
},

View File

@@ -335,7 +335,6 @@ export const mockPatchData: DataModel = {
},
},
currentDependencies: {},
dependencyInfo: {},
marketplaceUrl: 'https://registry.start9.com/',
developerKey: 'developer-key',
},
@@ -570,23 +569,21 @@ export const mockPatchData: DataModel = {
},
},
currentDependencies: {
bitcoind: {
versionRange: '>=26.0.0',
healthChecks: [],
},
'btc-rpc-proxy': {
versionRange: '>2.0.0',
healthChecks: [],
},
},
dependencyInfo: {
bitcoind: {
title: 'Bitcoin Core',
icon: 'assets/img/service-icons/bitcoind.svg',
kind: 'running',
registryUrl: 'https://registry.start9.com',
versionSpec: '>=26.0.0',
healthChecks: [],
},
'btc-rpc-proxy': {
title: 'Bitcoin Proxy',
icon: 'assets/img/service-icons/btc-rpc-proxy.png',
kind: 'running',
registryUrl: 'https://community-registry.start9.com',
versionSpec: '>2.0.0',
healthChecks: [],
},
},
marketplaceUrl: 'https://registry.start9.com/',

View File

@@ -85,14 +85,14 @@ export class DepErrorService {
}
}
const versionRange = pkg.currentDependencies[depId].versionRange
const versionSpec = pkg.currentDependencies[depId].versionSpec
const depManifest = dep.stateInfo.manifest
// incorrect version
if (!this.emver.satisfies(depManifest.version, versionRange)) {
if (!this.emver.satisfies(depManifest.version, versionSpec)) {
return {
type: DependencyErrorType.IncorrectVersion,
expected: versionRange,
expected: versionSpec,
received: depManifest.version,
}
}

View File

@@ -100,13 +100,7 @@ export type PackageDataEntry<T extends StateInfo = StateInfo> = {
status: Status
actions: Record<string, ActionMetadata>
lastBackup: string | null
currentDependencies: { [id: string]: CurrentDependencyInfo }
dependencyInfo: {
[id: string]: {
title: string
icon: Url
}
}
currentDependencies: Record<string, CurrentDependencyInfo>
serviceInterfaces: Record<string, ServiceInterfaceWithHostInfo>
marketplaceUrl: string | null
developerKey: string
@@ -117,11 +111,13 @@ export type StateInfo = InstalledState | InstallingState | UpdatingState
export type InstalledState = {
state: PackageState.Installed | PackageState.Removing
manifest: Manifest
installingInfo?: undefined
}
export type InstallingState = {
state: PackageState.Installing | PackageState.Restoring
installingInfo: InstallingInfo
manifest?: undefined
}
export type UpdatingState = {
@@ -139,8 +135,10 @@ export enum PackageState {
}
export interface CurrentDependencyInfo {
title: string
icon: string
kind: 'exists' | 'running'
url: string
registryUrl: string
versionSpec: string
healthChecks: string[] // array of health check IDs
}