Chore/unexport api ts (#2585)

* don't export api params

* import from SDK instead of BE

---------

Co-authored-by: Aiden McClelland <me@drbonez.dev>
This commit is contained in:
Matt Hill
2024-04-01 14:47:03 -06:00
committed by GitHub
parent f021ad9b0a
commit 71b83245b4
105 changed files with 88 additions and 464 deletions

View File

@@ -6,11 +6,10 @@ import { Metric, NotificationLevel, RR, ServerNotifications } from './api.types'
import { BTC_ICON, LND_ICON, PROXY_ICON } from './api-icons'
import { DependencyMetadata, MarketplacePkg } from '@start9labs/marketplace'
import { Log } from '@start9labs/shared'
import { ServerStatus } from '../../../../../../../core/startos/bindings/ServerStatus'
import { Manifest } from '../../../../../../../core/startos/bindings/Manifest'
import { T } from '@start9labs/start-sdk'
export module Mock {
export const ServerUpdated: ServerStatus = {
export const ServerUpdated: T.ServerStatus = {
backupProgress: null,
updateProgress: null,
updated: true,
@@ -42,7 +41,7 @@ export module Mock {
'0.19.0': 'release notes for Bitcoin 0.19.0',
}
export const MockManifestBitcoind: Manifest = {
export const MockManifestBitcoind: T.Manifest = {
id: 'bitcoind',
title: 'Bitcoin Core',
version: '0.21.0',
@@ -80,7 +79,7 @@ export module Mock {
},
}
export const MockManifestLnd: Manifest = {
export const MockManifestLnd: T.Manifest = {
id: 'lnd',
title: 'Lightning Network Daemon',
version: '0.11.1',
@@ -128,7 +127,7 @@ export module Mock {
},
}
export const MockManifestBitcoinProxy: Manifest = {
export const MockManifestBitcoinProxy: T.Manifest = {
id: 'btc-rpc-proxy',
title: 'Bitcoin Proxy',
version: '0.2.2',

View File

@@ -4,8 +4,7 @@ import { PackagePropertiesVersioned } from 'src/app/util/properties.util'
import { ConfigSpec } from 'src/app/pkg-config/config-types'
import { DataModel } from 'src/app/services/patch-db/data-model'
import { StartOSDiskInfo, LogsRes, ServerLogsReq } from '@start9labs/shared'
import { HealthCheckResult } from '../../../../../../../core/startos/bindings/HealthCheckResult'
import { Manifest } from '../../../../../../../core/startos/bindings/Manifest'
import { T } from '@start9labs/start-sdk'
export module RR {
// DB
@@ -245,7 +244,7 @@ export module RR {
}
export type SideloadPackageReq = {
manifest: Manifest
manifest: T.Manifest
icon: string // base64
}
export type SideloadPacakgeRes = string //guid
@@ -515,7 +514,7 @@ export interface DependencyErrorConfigUnsatisfied {
export interface DependencyErrorHealthChecksFailed {
type: 'healthChecksFailed'
check: HealthCheckResult
check: T.HealthCheckResult
}
export interface DependencyErrorTransitive {

View File

@@ -37,10 +37,9 @@ import { WebSocketSubjectConfig } from 'rxjs/webSocket'
import { AuthService } from '../auth.service'
import { ConnectionService } from '../connection.service'
import { StoreInfo } from '@start9labs/marketplace'
import { FullProgress } from '../../../../../../../core/startos/bindings/FullProgress'
import { ServerStatus } from '../../../../../../../core/startos/bindings/ServerStatus'
import { T } from '@start9labs/start-sdk'
const PROGRESS: FullProgress = {
const PROGRESS: T.FullProgress = {
overall: {
done: 0,
total: 120,

View File

@@ -1,13 +1,8 @@
import { DOCUMENT } from '@angular/common'
import { Inject, Injectable } from '@angular/core'
import { WorkspaceConfig } from '@start9labs/shared'
import { types } from '@start9labs/start-sdk'
import { PackageDataEntry } from 'src/app/services/patch-db/data-model'
import { PackageState } from '../../../../../../core/startos/bindings/PackageState'
import { MainStatus } from '../../../../../../core/startos/bindings/MainStatus'
import { ExportedOnionHostname } from '../../../../../../core/startos/bindings/ExportedOnionHostname'
import { ExportedIpHostname } from '../../../../../../core/startos/bindings/ExportedIpHostname'
import { ExportedHostnameInfo } from '../../../../../../core/startos/bindings/ExportedHostnameInfo'
import { T } from '@start9labs/start-sdk'
import { PackageDataEntry } from './patch-db/data-model'
const {
gitHash,
@@ -55,8 +50,8 @@ export class ConfigService {
}
isLaunchable(
state: PackageState['state'],
status: MainStatus['status'],
state: T.PackageState['state'],
status: T.MainStatus['status'],
): boolean {
return state === 'installed' && status === 'running'
}
@@ -76,13 +71,13 @@ export class ConfigService {
if (host.kind === 'multi') {
const onionHostname = host.hostnames.find(h => h.kind === 'onion')
?.hostname as ExportedOnionHostname
?.hostname as T.ExportedOnionHostname
if (this.isTor() && onionHostname) {
url.hostname = onionHostname.value
} else {
const ipHostname = host.hostnames.find(h => h.kind === 'ip')
?.hostname as ExportedIpHostname
?.hostname as T.ExportedIpHostname
if (!ipHostname) return ''
@@ -91,16 +86,16 @@ export class ConfigService {
}
} else {
throw new Error('unimplemented')
const hostname = {} as ExportedHostnameInfo // host.hostname
// const hostname = {} as T.ExportedHostnameInfo // host.hostname
if (!hostname) return ''
// if (!hostname) return ''
if (this.isTor() && hostname.kind === 'onion') {
url.hostname = (hostname.hostname as ExportedOnionHostname).value
} else {
url.hostname = this.hostname
url.port = String(hostname.hostname.sslPort || hostname.hostname.port)
}
// if (this.isTor() && hostname.kind === 'onion') {
// url.hostname = (hostname.hostname as T.ExportedOnionHostname).value
// } else {
// url.hostname = this.hostname
// url.port = String(hostname.hostname.sslPort || hostname.hostname.port)
// }
}
return url.href

View File

@@ -1,13 +1,6 @@
import { Url } from '@start9labs/shared'
import { types } from '@start9labs/start-sdk'
import { ActionMetadata } from '@start9labs/start-sdk/cjs/sdk/lib/types'
import { Public } from '../../../../../../../core/startos/bindings/Public'
import { PackageDataEntry as PDE } from '../../../../../../../core/startos/bindings/PackageDataEntry'
import { FullProgress } from '../../../../../../../core/startos/bindings/FullProgress'
import { Manifest } from '../../../../../../../core/startos/bindings/Manifest'
type ServiceInterfaceWithHostInfo = types.ServiceInterfaceWithHostInfo
import { T } from '@start9labs/start-sdk'
export type DataModel = Public & {
export type DataModel = T.Public & {
ui: UIData
packageData: Record<string, PackageDataEntry>
}
@@ -52,15 +45,16 @@ export interface UIStore {
name?: string
}
export type PackageDataEntry<T extends StateInfo = StateInfo> = PDE & {
stateInfo: T
}
export type PackageDataEntry<T extends StateInfo = StateInfo> =
T.PackageDataEntry & {
stateInfo: T
}
export type StateInfo = InstalledState | InstallingState | UpdatingState
export type InstalledState = {
state: 'installed' | 'removing'
manifest: Manifest
manifest: T.Manifest
installingInfo?: undefined
}
@@ -73,10 +67,10 @@ export type InstallingState = {
export type UpdatingState = {
state: 'updating'
installingInfo: InstallingInfo
manifest: Manifest
manifest: T.Manifest
}
export type InstallingInfo = {
progress: FullProgress
newManifest: Manifest
progress: T.FullProgress
newManifest: T.Manifest
}

View File

@@ -1,6 +1,5 @@
import { PackageDataEntry } from 'src/app/services/patch-db/data-model'
import { PkgDependencyErrors } from './dep-error.service'
import { Status } from '../../../../../../core/startos/bindings/Status'
import { T } from '@start9labs/start-sdk'
export interface PackageStatus {
@@ -28,7 +27,7 @@ export function renderPkgStatus(
return { primary, dependency, health }
}
function getInstalledPrimaryStatus(status: Status): PrimaryStatus {
function getInstalledPrimaryStatus(status: T.Status): PrimaryStatus {
if (!status.configured) {
return 'needsConfig'
} else {
@@ -40,7 +39,7 @@ function getDependencyStatus(depErrors: PkgDependencyErrors): DependencyStatus {
return Object.values(depErrors).some(err => !!err) ? 'warning' : 'satisfied'
}
function getHealthStatus(status: Status): T.HealthStatus | null {
function getHealthStatus(status: T.Status): T.HealthStatus | null {
if (status.main.status !== 'running' || !status.main.health) {
return null
}