Merge branch 'update/camelCase' of github.com:Start9Labs/start-os into rebase/feat/domains

This commit is contained in:
Matt Hill
2024-03-22 13:09:11 -06:00
30 changed files with 406 additions and 422 deletions

View File

@@ -17,12 +17,12 @@ export class MockApiService implements ApiService {
label: null, label: null,
capacity: 73264762332, capacity: 73264762332,
used: null, used: null,
'embassy-os': { startOs: {
version: '0.2.17', version: '0.2.17',
full: true, full: true,
'password-hash': passwordHash:
'$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ', '$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ',
'wrapped-key': null, wrappedKey: null,
}, },
guid: null, guid: null,
}, },
@@ -40,12 +40,12 @@ export class MockApiService implements ApiService {
label: null, label: null,
capacity: 73264762332, capacity: 73264762332,
used: null, used: null,
'embassy-os': { startOs: {
version: '0.3.3', version: '0.3.3',
full: true, full: true,
'password-hash': passwordHash:
'$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ', '$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ',
'wrapped-key': null, wrappedKey: null,
}, },
guid: null, guid: null,
}, },
@@ -63,12 +63,12 @@ export class MockApiService implements ApiService {
label: null, label: null,
capacity: 73264762332, capacity: 73264762332,
used: null, used: null,
'embassy-os': { startOs: {
version: '0.3.2', version: '0.3.2',
full: true, full: true,
'password-hash': passwordHash:
'$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ', '$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ',
'wrapped-key': null, wrappedKey: null,
}, },
guid: 'guid-guid-guid-guid', guid: 'guid-guid-guid-guid',
}, },

View File

@@ -4,7 +4,7 @@
<div class="detail-container"> <div class="detail-container">
<!-- git hash --> <!-- git hash -->
<div <div
*ngIf="pkg.manifest['git-hash'] as gitHash; else noHash" *ngIf="pkg.manifest.gitHash as gitHash; else noHash"
button button
detail="false" detail="false"
class="detail-container-item item-padding item-copy" class="detail-container-item item-padding item-copy"
@@ -66,26 +66,26 @@
</ng-template> </ng-template>
<!-- links --> <!-- links -->
<marketplace-additional-link <marketplace-additional-link
[url]="pkg.manifest['marketing-site']" *ngIf="pkg.manifest.marketingSite"
*ngIf="pkg.manifest['marketing-site']" [url]="pkg.manifest.marketingSite"
label="Marketing Site" label="Marketing Site"
class="item-padding item-pointer" class="item-padding item-pointer"
></marketplace-additional-link> ></marketplace-additional-link>
<marketplace-additional-link <marketplace-additional-link
[url]="pkg.manifest['upstream-repo']" *ngIf="pkg.manifest.upstreamRepo"
*ngIf="pkg.manifest['upstream-repo']" [url]="pkg.manifest.upstreamRepo"
label="Source Repository" label="Source Repository"
class="item-padding item-pointer" class="item-padding item-pointer"
></marketplace-additional-link> ></marketplace-additional-link>
<marketplace-additional-link <marketplace-additional-link
[url]="pkg.manifest['wrapper-repo']" *ngIf="pkg.manifest.wrapperRepo"
*ngIf="pkg.manifest['wrapper-repo']" [url]="pkg.manifest.wrapperRepo"
label="Wrapper Repository" label="Wrapper Repository"
class="item-padding item-pointer" class="item-padding item-pointer"
></marketplace-additional-link> ></marketplace-additional-link>
<marketplace-additional-link <marketplace-additional-link
[url]="pkg.manifest['support-site']" *ngIf="pkg.manifest.supportSite"
*ngIf="pkg.manifest['support-site']" [url]="pkg.manifest.supportSite"
label="Support Site" label="Support Site"
class="item-padding item-pointer" class="item-padding item-pointer"
></marketplace-additional-link> ></marketplace-additional-link>

View File

@@ -1,10 +1,10 @@
<div class="outer-container"> <div class="outer-container">
<div class="inner-container"> <div class="inner-container">
<tui-avatar class="dep-img" [src]="pkg['dependency-metadata'][dep.key].icon"></tui-avatar> <tui-avatar class="dep-img" [src]="pkg.dependencyMetadata[dep.key].icon"></tui-avatar>
<div class="wrapper-margin"> <div class="wrapper-margin">
<div class="inner-container-title"> <div class="inner-container-title">
<span> <span>
{{ pkg['dependency-metadata'][dep.key].title || dep.key }} {{ pkg.dependencyMetadata[dep.key].title || dep.key }}
</span> </span>
<p> <p>
@if (dep.value.optional) { @if (dep.value.optional) {

View File

@@ -71,8 +71,7 @@ export class FilterPackagesPipe implements PipeTransform {
.filter(p => category === 'all' || p.categories.includes(category!)) .filter(p => category === 'all' || p.categories.includes(category!))
.sort((a, b) => { .sort((a, b) => {
return ( return (
new Date(b['published-at']).valueOf() - new Date(b.publishedAt).valueOf() - new Date(a.publishedAt).valueOf()
new Date(a['published-at']).valueOf()
) )
}) })
.map(a => ({ ...a })) .map(a => ({ ...a }))

View File

@@ -29,10 +29,10 @@ export interface MarketplacePkg {
manifest: Manifest manifest: Manifest
categories: string[] categories: string[]
versions: string[] versions: string[]
'dependency-metadata': { dependencyMetadata: {
[id: string]: DependencyMetadata [id: string]: DependencyMetadata
} }
'published-at': string publishedAt: string
} }
export interface DependencyMetadata { export interface DependencyMetadata {
@@ -46,19 +46,19 @@ export interface Manifest {
id: string id: string
title: string title: string
version: string version: string
'git-hash'?: string gitHash?: string
description: { description: {
short: string short: string
long: string long: string
} }
replaces?: string[] replaces?: string[]
'release-notes': string releaseNotes: string
license: string // name of license license: string // name of license
'wrapper-repo': Url wrapperRepo: Url
'upstream-repo': Url upstreamRepo: Url
'support-site': Url supportSite: Url
'marketing-site': Url marketingSite: Url
'donation-url': Url | null donationUrl: Url | null
alerts: { alerts: {
install: string | null install: string | null
uninstall: string | null uninstall: string | null
@@ -67,8 +67,8 @@ export interface Manifest {
stop: string | null stop: string | null
} }
dependencies: Record<string, Dependency> dependencies: Record<string, Dependency>
'os-version': string osVersion: string
'has-config': boolean hasConfig: boolean
} }
export interface Dependency { export interface Dependency {

View File

@@ -43,20 +43,20 @@ type Encrypted = {
export type AttachReq = { export type AttachReq = {
guid: string guid: string
'embassy-password': Encrypted startOsPassword: Encrypted
} }
export type ExecuteReq = { export type ExecuteReq = {
'embassy-logicalname': string startOsLogicalname: string
'embassy-password': Encrypted startOsPassword: Encrypted
'recovery-source': RecoverySource | null recoverySource: RecoverySource | null
'recovery-password': Encrypted | null recoveryPassword: Encrypted | null
} }
export type CompleteRes = { export type CompleteRes = {
'tor-address': string torAddress: string
'lan-address': string lanAddress: string
'root-ca': string rootCa: string
} }
export type DiskBackupTarget = { export type DiskBackupTarget = {
@@ -66,7 +66,7 @@ export type DiskBackupTarget = {
label: string | null label: string | null
capacity: number capacity: number
used: number | null used: number | null
'embassy-os': StartOSDiskInfo | null startOs: StartOSDiskInfo | null
} }
export type CifsBackupTarget = { export type CifsBackupTarget = {
@@ -74,7 +74,7 @@ export type CifsBackupTarget = {
path: string path: string
username: string username: string
mountable: boolean mountable: boolean
'embassy-os': StartOSDiskInfo | null startOs: StartOSDiskInfo | null
} }
export type DiskRecoverySource = { export type DiskRecoverySource = {

View File

@@ -76,11 +76,10 @@ export class LiveApiService extends ApiService {
} }
async execute(setupInfo: ExecuteReq) { async execute(setupInfo: ExecuteReq) {
if (setupInfo['recovery-source']?.type === 'backup') { if (setupInfo.recoverySource?.type === 'backup') {
if (isCifsSource(setupInfo['recovery-source'].target)) { if (isCifsSource(setupInfo.recoverySource.target)) {
setupInfo['recovery-source'].target.path = setupInfo[ setupInfo.recoverySource.target.path =
'recovery-source' setupInfo.recoverySource.target.path.replace('/\\/g', '/')
].target.path.replace('/\\/g', '/')
} }
} }
@@ -106,7 +105,7 @@ export class LiveApiService extends ApiService {
return { return {
...res, ...res,
'root-ca': encodeBase64(res['root-ca']), rootCa: encodeBase64(res.rootCa),
} }
} }

View File

@@ -55,12 +55,12 @@ export class MockApiService extends ApiService {
label: null, label: null,
capacity: 1979120929996, capacity: 1979120929996,
used: null, used: null,
'embassy-os': { startOs: {
version: '0.2.17', version: '0.2.17',
full: true, full: true,
'password-hash': passwordHash:
'$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ', '$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ',
'wrapped-key': null, wrappedKey: null,
}, },
guid: null, guid: null,
}, },
@@ -78,12 +78,12 @@ export class MockApiService extends ApiService {
label: null, label: null,
capacity: 73264762332, capacity: 73264762332,
used: null, used: null,
'embassy-os': { startOs: {
version: '0.3.3', version: '0.3.3',
full: true, full: true,
'password-hash': passwordHash:
'$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ', '$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ',
'wrapped-key': null, wrappedKey: null,
}, },
guid: null, guid: null,
}, },
@@ -101,12 +101,12 @@ export class MockApiService extends ApiService {
label: null, label: null,
capacity: 73264762332, capacity: 73264762332,
used: null, used: null,
'embassy-os': { startOs: {
version: '0.3.2', version: '0.3.2',
full: true, full: true,
'password-hash': passwordHash:
'$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ', '$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ',
'wrapped-key': null, wrappedKey: null,
}, },
guid: 'guid-guid-guid-guid', guid: 'guid-guid-guid-guid',
}, },
@@ -122,9 +122,9 @@ export class MockApiService extends ApiService {
return { return {
version: '0.3.0', version: '0.3.0',
full: true, full: true,
'password-hash': passwordHash:
'$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ', '$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ',
'wrapped-key': '', wrappedKey: '',
} }
} }
@@ -156,9 +156,9 @@ export class MockApiService extends ApiService {
async complete(): Promise<CompleteRes> { async complete(): Promise<CompleteRes> {
await pauseFor(1000) await pauseFor(1000)
return { return {
'tor-address': 'https://asdafsadasdasasdasdfasdfasdf.onion', torAddress: 'https://asdafsadasdasasdasdfasdfasdf.onion',
'lan-address': 'https://adjective-noun.local', lanAddress: 'https://adjective-noun.local',
'root-ca': encodeBase64(rootCA), rootCa: encodeBase64(rootCA),
} }
} }

View File

@@ -14,7 +14,7 @@ export class StateService {
async importDrive(guid: string, password: string): Promise<void> { async importDrive(guid: string, password: string): Promise<void> {
await this.api.attach({ await this.api.attach({
guid, guid,
'embassy-password': await this.api.encrypt(password), startOsPassword: await this.api.encrypt(password),
}) })
} }
@@ -23,10 +23,10 @@ export class StateService {
password: string, password: string,
): Promise<void> { ): Promise<void> {
await this.api.execute({ await this.api.execute({
'embassy-logicalname': storageLogicalname, startOsLogicalname: storageLogicalname,
'embassy-password': await this.api.encrypt(password), startOsPassword: await this.api.encrypt(password),
'recovery-source': this.recoverySource || null, recoverySource: this.recoverySource || null,
'recovery-password': this.recoveryPassword recoveryPassword: this.recoveryPassword
? await this.api.encrypt(this.recoveryPassword) ? await this.api.encrypt(this.recoveryPassword)
: null, : null,
}) })

View File

@@ -1,6 +1,6 @@
export type FollowLogsReq = {} export type FollowLogsReq = {}
export type FollowLogsRes = { export type FollowLogsRes = {
'start-cursor': string startCursor: string
guid: string guid: string
} }
@@ -12,8 +12,8 @@ export type FetchLogsReq = {
export type FetchLogsRes = { export type FetchLogsRes = {
entries: Log[] entries: Log[]
'start-cursor'?: string startCursor?: string
'end-cursor'?: string endCursor?: string
} }
export interface Log { export interface Log {
@@ -37,19 +37,19 @@ export interface PartitionInfo {
label: string | null label: string | null
capacity: number capacity: number
used: number | null used: number | null
'embassy-os': StartOSDiskInfo | null startOs: StartOSDiskInfo | null
guid: string | null guid: string | null
} }
export type StartOSDiskInfo = { export type StartOSDiskInfo = {
version: string version: string
full: boolean full: boolean
'password-hash': string | null passwordHash: string | null
'wrapped-key': string | null wrappedKey: string | null
} }
export interface SetupStatus { export interface SetupStatus {
'bytes-transferred': number bytesTransferred: number
'total-bytes': number | null totalBytes: number | null
complete: boolean complete: boolean
} }

View File

@@ -32,13 +32,12 @@ export class AppComponent implements OnInit {
inject(ConnectionService).connected$, inject(ConnectionService).connected$,
this.auth.isVerified$, this.auth.isVerified$,
this.patch this.patch
.watch$('server-info', 'status-info') .watch$('serverInfo', 'statusInfo')
.pipe(startWith({ restarting: false, 'shutting-down': false })), .pipe(startWith({ restarting: false, shuttingDown: false })),
]).pipe( ]).pipe(
map( map(
([verified, connected, status]) => ([verified, connected, status]) =>
verified && verified && (!connected || status.restarting || status.shuttingDown),
(!connected || status.restarting || status['shutting-down']),
), ),
) )

View File

@@ -45,8 +45,8 @@ export class MockDiagnosticService implements DiagnosticService {
} }
return { return {
entries, entries,
'start-cursor': 'startCursor', startCursor: 'start-cursor',
'end-cursor': 'endCursor', endCursor: 'end-cursor',
} }
} }
} }

View File

@@ -26,7 +26,7 @@ export class ToOptionsPipe implements PipeTransform {
id, id,
installed: !!packageData[id], installed: !!packageData[id],
checked: false, checked: false,
'newer-eos': this.compare(packageBackups[id]['os-version']), 'newer-eos': this.compare(packageBackups[id].osVersion),
})) }))
.sort((a, b) => .sort((a, b) =>
b.title.toLowerCase() > a.title.toLowerCase() ? -1 : 1, b.title.toLowerCase() > a.title.toLowerCase() ? -1 : 1,

View File

@@ -27,16 +27,16 @@ import { unionSelectKey } from '@start9labs/start-sdk/cjs/sdk/lib/config/configT
export module Mock { export module Mock {
export const ServerUpdated: ServerStatusInfo = { export const ServerUpdated: ServerStatusInfo = {
'current-backup': null, currentBackup: null,
'update-progress': null, updateProgress: null,
updated: true, updated: true,
restarting: false, restarting: false,
'shutting-down': false, shuttingDown: false,
} }
export const MarketplaceEos: RR.GetMarketplaceEosRes = { export const MarketplaceEos: RR.GetMarketplaceEosRes = {
version: '0.3.5.1', version: '0.3.5.1',
headline: 'Our biggest release ever.', headline: 'Our biggest release ever.',
'release-notes': { releaseNotes: {
'0.3.5.1': 'Some **Markdown** release _notes_ for 0.3.5.1', '0.3.5.1': 'Some **Markdown** release _notes_ for 0.3.5.1',
'0.3.4.4': 'Some **Markdown** release _notes_ for 0.3.4.4', '0.3.4.4': 'Some **Markdown** release _notes_ for 0.3.4.4',
'0.3.4.3': 'Some **Markdown** release _notes_ for 0.3.4.3', '0.3.4.3': 'Some **Markdown** release _notes_ for 0.3.4.3',
@@ -62,19 +62,19 @@ export module Mock {
id: 'bitcoind', id: 'bitcoind',
title: 'Bitcoin Core', title: 'Bitcoin Core',
version: '0.21.0', version: '0.21.0',
'git-hash': 'abcdefgh', gitHash: 'abcdefgh',
description: { description: {
short: 'A Bitcoin full node by Bitcoin Core.', short: 'A Bitcoin full node by Bitcoin Core.',
long: 'Bitcoin is a decentralized consensus protocol and settlement network.', long: 'Bitcoin is a decentralized consensus protocol and settlement network.',
}, },
replaces: ['banks', 'governments'], replaces: ['banks', 'governments'],
'release-notes': 'Taproot, Schnorr, and more.', releaseNotes: 'Taproot, Schnorr, and more.',
license: 'MIT', license: 'MIT',
'wrapper-repo': 'https://github.com/start9labs/bitcoind-wrapper', wrapperRepo: 'https://github.com/start9labs/bitcoind-wrapper',
'upstream-repo': 'https://github.com/bitcoin/bitcoin', upstreamRepo: 'https://github.com/bitcoin/bitcoin',
'support-site': 'https://bitcoin.org', supportSite: 'https://bitcoin.org',
'marketing-site': 'https://bitcoin.org', marketingSite: 'https://bitcoin.org',
'donation-url': 'https://start9.com', donationUrl: 'https://start9.com',
alerts: { alerts: {
install: 'Bitcoin can take over a week to sync.', install: 'Bitcoin can take over a week to sync.',
uninstall: uninstall:
@@ -83,9 +83,9 @@ export module Mock {
start: 'Starting Bitcoin is good for your health.', start: 'Starting Bitcoin is good for your health.',
stop: null, stop: null,
}, },
'os-version': '0.2.12', osVersion: '0.2.12',
dependencies: {}, dependencies: {},
'has-config': true, hasConfig: true,
} }
export const MockManifestLnd: Manifest = { export const MockManifestLnd: Manifest = {
@@ -96,13 +96,13 @@ export module Mock {
short: 'A bolt spec compliant client.', short: 'A bolt spec compliant client.',
long: 'More info about LND. More info about LND. More info about LND.', long: 'More info about LND. More info about LND. More info about LND.',
}, },
'release-notes': 'Dual funded channels!', releaseNotes: 'Dual funded channels!',
license: 'MIT', license: 'MIT',
'wrapper-repo': 'https://github.com/start9labs/lnd-wrapper', wrapperRepo: 'https://github.com/start9labs/lnd-wrapper',
'upstream-repo': 'https://github.com/lightningnetwork/lnd', upstreamRepo: 'https://github.com/lightningnetwork/lnd',
'support-site': 'https://lightning.engineering/', supportSite: 'https://lightning.engineering/',
'marketing-site': 'https://lightning.engineering/', marketingSite: 'https://lightning.engineering/',
'donation-url': null, donationUrl: null,
alerts: { alerts: {
install: null, install: null,
uninstall: null, uninstall: null,
@@ -111,7 +111,7 @@ export module Mock {
start: 'Starting LND is good for your health.', start: 'Starting LND is good for your health.',
stop: null, stop: null,
}, },
'os-version': '0.2.12', osVersion: '0.2.12',
dependencies: { dependencies: {
bitcoind: { bitcoind: {
description: 'LND needs bitcoin to live.', description: 'LND needs bitcoin to live.',
@@ -123,25 +123,25 @@ export module Mock {
optional: true, optional: true,
}, },
}, },
'has-config': true, hasConfig: true,
} }
export const MockManifestBitcoinProxy: Manifest = { export const MockManifestBitcoinProxy: Manifest = {
id: 'btc-rpc-proxy', id: 'btc-rpc-proxy',
title: 'Bitcoin Proxy', title: 'Bitcoin Proxy',
version: '0.2.2', version: '0.2.2',
'git-hash': 'lmnopqrx', gitHash: 'lmnopqrx',
description: { description: {
short: 'A super charger for your Bitcoin node.', short: 'A super charger for your Bitcoin node.',
long: 'More info about Bitcoin Proxy. More info about Bitcoin Proxy. More info about Bitcoin Proxy.', long: 'More info about Bitcoin Proxy. More info about Bitcoin Proxy. More info about Bitcoin Proxy.',
}, },
'release-notes': 'Even better support for Bitcoin and wallets!', releaseNotes: 'Even better support for Bitcoin and wallets!',
license: 'MIT', license: 'MIT',
'wrapper-repo': 'https://github.com/start9labs/btc-rpc-proxy-wrapper', wrapperRepo: 'https://github.com/start9labs/btc-rpc-proxy-wrapper',
'upstream-repo': 'https://github.com/Kixunil/btc-rpc-proxy', upstreamRepo: 'https://github.com/Kixunil/btc-rpc-proxy',
'support-site': '', supportSite: '',
'marketing-site': '', marketingSite: '',
'donation-url': 'https://start9.com', donationUrl: 'https://start9.com',
alerts: { alerts: {
install: 'Testing install alert', install: 'Testing install alert',
uninstall: null, uninstall: null,
@@ -149,14 +149,14 @@ export module Mock {
start: null, start: null,
stop: null, stop: null,
}, },
'os-version': '0.2.12', osVersion: '0.2.12',
dependencies: { dependencies: {
bitcoind: { bitcoind: {
description: 'Bitcoin Proxy requires a Bitcoin node.', description: 'Bitcoin Proxy requires a Bitcoin node.',
optional: false, optional: false,
}, },
}, },
'has-config': false, hasConfig: false,
} }
export const BitcoinDep: DependencyMetadata = { export const BitcoinDep: DependencyMetadata = {
@@ -189,8 +189,8 @@ export module Mock {
}, },
categories: ['bitcoin', 'cryptocurrency', 'featured'], categories: ['bitcoin', 'cryptocurrency', 'featured'],
versions: ['0.19.0', '0.20.0', '0.21.0'], versions: ['0.19.0', '0.20.0', '0.21.0'],
'dependency-metadata': {}, dependencyMetadata: {},
'published-at': new Date().toISOString(), publishedAt: new Date().toISOString(),
}, },
'0.20.0': { '0.20.0': {
icon: BTC_ICON, icon: BTC_ICON,
@@ -202,8 +202,8 @@ export module Mock {
}, },
categories: ['bitcoin', 'cryptocurrency'], categories: ['bitcoin', 'cryptocurrency'],
versions: ['0.19.0', '0.20.0', '0.21.0'], versions: ['0.19.0', '0.20.0', '0.21.0'],
'dependency-metadata': {}, dependencyMetadata: {},
'published-at': new Date().toISOString(), publishedAt: new Date().toISOString(),
}, },
'0.21.0': { '0.21.0': {
icon: BTC_ICON, icon: BTC_ICON,
@@ -212,13 +212,13 @@ export module Mock {
manifest: { manifest: {
...Mock.MockManifestBitcoind, ...Mock.MockManifestBitcoind,
version: '0.21.0', version: '0.21.0',
'release-notes': releaseNotes:
'For a complete list of changes, please visit <a href="https://bitcoincore.org/en/releases/0.21.0/">https://bitcoincore.org/en/releases/0.21.0/</a><br /><ul><li>Taproot!</li><li>New RPCs</li><li>Experimental Descriptor Wallets</li></ul>', 'For a complete list of changes, please visit <a href="https://bitcoincore.org/en/releases/0.21.0/">https://bitcoincore.org/en/releases/0.21.0/</a><br /><ul><li>Taproot!</li><li>New RPCs</li><li>Experimental Descriptor Wallets</li></ul>',
}, },
categories: ['bitcoin', 'cryptocurrency'], categories: ['bitcoin', 'cryptocurrency'],
versions: ['0.19.0', '0.20.0', '0.21.0'], versions: ['0.19.0', '0.20.0', '0.21.0'],
'dependency-metadata': {}, dependencyMetadata: {},
'published-at': new Date().toISOString(), publishedAt: new Date().toISOString(),
}, },
latest: { latest: {
icon: BTC_ICON, icon: BTC_ICON,
@@ -227,13 +227,13 @@ export module Mock {
screenshots: ['one.png', 'two.png', 'three.png'], screenshots: ['one.png', 'two.png', 'three.png'],
manifest: { manifest: {
...Mock.MockManifestBitcoind, ...Mock.MockManifestBitcoind,
'release-notes': releaseNotes:
'For a complete list of changes, please visit <a href="https://bitcoincore.org/en/releases/0.21.0/" target="_blank">https://bitcoincore.org/en/releases/0.21.0/</a><br />Or in [markdown](https://bitcoincore.org/en/releases/0.21.0/)<ul><li>Taproot!</li><li>New RPCs</li><li>Experimental Descriptor Wallets</li></ul>', 'For a complete list of changes, please visit <a href="https://bitcoincore.org/en/releases/0.21.0/" target="_blank">https://bitcoincore.org/en/releases/0.21.0/</a><br />Or in [markdown](https://bitcoincore.org/en/releases/0.21.0/)<ul><li>Taproot!</li><li>New RPCs</li><li>Experimental Descriptor Wallets</li></ul>',
}, },
categories: ['bitcoin', 'cryptocurrency'], categories: ['bitcoin', 'cryptocurrency'],
versions: ['0.19.0', '0.20.0', '0.21.0'], versions: ['0.19.0', '0.20.0', '0.21.0'],
'dependency-metadata': {}, dependencyMetadata: {},
'published-at': new Date().toISOString(), publishedAt: new Date().toISOString(),
}, },
}, },
lnd: { lnd: {
@@ -244,15 +244,15 @@ export module Mock {
manifest: { manifest: {
...Mock.MockManifestLnd, ...Mock.MockManifestLnd,
version: '0.11.0', version: '0.11.0',
'release-notes': 'release notes for LND 0.11.0', releaseNotes: 'release notes for LND 0.11.0',
}, },
categories: ['bitcoin', 'lightning', 'cryptocurrency'], categories: ['bitcoin', 'lightning', 'cryptocurrency'],
versions: ['0.11.0', '0.11.1'], versions: ['0.11.0', '0.11.1'],
'dependency-metadata': { dependencyMetadata: {
bitcoind: BitcoinDep, bitcoind: BitcoinDep,
'btc-rpc-proxy': ProxyDep, 'btc-rpc-proxy': ProxyDep,
}, },
'published-at': new Date().toISOString(), publishedAt: new Date().toISOString(),
}, },
'0.11.1': { '0.11.1': {
icon: LND_ICON, icon: LND_ICON,
@@ -261,15 +261,15 @@ export module Mock {
manifest: { manifest: {
...Mock.MockManifestLnd, ...Mock.MockManifestLnd,
version: '0.11.1', version: '0.11.1',
'release-notes': 'release notes for LND 0.11.1', releaseNotes: 'release notes for LND 0.11.1',
}, },
categories: ['bitcoin', 'lightning', 'cryptocurrency'], categories: ['bitcoin', 'lightning', 'cryptocurrency'],
versions: ['0.11.0', '0.11.1'], versions: ['0.11.0', '0.11.1'],
'dependency-metadata': { dependencyMetadata: {
bitcoind: BitcoinDep, bitcoind: BitcoinDep,
'btc-rpc-proxy': ProxyDep, 'btc-rpc-proxy': ProxyDep,
}, },
'published-at': new Date().toISOString(), publishedAt: new Date().toISOString(),
}, },
latest: { latest: {
icon: LND_ICON, icon: LND_ICON,
@@ -278,11 +278,11 @@ export module Mock {
manifest: Mock.MockManifestLnd, manifest: Mock.MockManifestLnd,
categories: ['bitcoin', 'lightning', 'cryptocurrency'], categories: ['bitcoin', 'lightning', 'cryptocurrency'],
versions: ['0.11.0', '0.11.1'], versions: ['0.11.0', '0.11.1'],
'dependency-metadata': { dependencyMetadata: {
bitcoind: BitcoinDep, bitcoind: BitcoinDep,
'btc-rpc-proxy': ProxyDep, 'btc-rpc-proxy': ProxyDep,
}, },
'published-at': new Date(new Date().valueOf() + 10).toISOString(), publishedAt: new Date(new Date().valueOf() + 10).toISOString(),
}, },
}, },
'btc-rpc-proxy': { 'btc-rpc-proxy': {
@@ -293,10 +293,10 @@ export module Mock {
manifest: Mock.MockManifestBitcoinProxy, manifest: Mock.MockManifestBitcoinProxy,
categories: ['bitcoin'], categories: ['bitcoin'],
versions: ['0.2.2'], versions: ['0.2.2'],
'dependency-metadata': { dependencyMetadata: {
bitcoind: BitcoinDep, bitcoind: BitcoinDep,
}, },
'published-at': new Date().toISOString(), publishedAt: new Date().toISOString(),
}, },
}, },
} }
@@ -307,8 +307,8 @@ export module Mock {
export const Notifications: ServerNotifications = [ export const Notifications: ServerNotifications = [
{ {
id: 1, id: 1,
'package-id': null, packageId: null,
'created-at': '2019-12-26T14:20:30.872Z', createdAt: '2019-12-26T14:20:30.872Z',
code: 1, code: 1,
level: NotificationLevel.Success, level: NotificationLevel.Success,
title: 'Backup Complete', title: 'Backup Complete',
@@ -328,8 +328,8 @@ export module Mock {
}, },
{ {
id: 2, id: 2,
'package-id': null, packageId: null,
'created-at': '2019-12-26T14:20:30.872Z', createdAt: '2019-12-26T14:20:30.872Z',
code: 2, code: 2,
level: NotificationLevel.Warning, level: NotificationLevel.Warning,
title: 'SSH Key Added', title: 'SSH Key Added',
@@ -339,8 +339,8 @@ export module Mock {
}, },
{ {
id: 3, id: 3,
'package-id': null, packageId: null,
'created-at': '2019-12-26T14:20:30.872Z', createdAt: '2019-12-26T14:20:30.872Z',
code: 3, code: 3,
level: NotificationLevel.Info, level: NotificationLevel.Info,
title: 'SSH Key Removed', title: 'SSH Key Removed',
@@ -350,8 +350,8 @@ export module Mock {
}, },
{ {
id: 4, id: 4,
'package-id': 'bitcoind', packageId: 'bitcoind',
'created-at': '2019-12-26T14:20:30.872Z', createdAt: '2019-12-26T14:20:30.872Z',
code: 4, code: 4,
level: NotificationLevel.Error, level: NotificationLevel.Error,
title: 'Service Crashed', title: 'Service Crashed',
@@ -377,7 +377,7 @@ export module Mock {
}, },
}, },
memory: { memory: {
'percentage-used': { percentageUsed: {
value: '30.7', value: '30.7',
unit: '%', unit: '%',
}, },
@@ -393,29 +393,29 @@ export module Mock {
value: '8784.97', value: '8784.97',
unit: 'MiB', unit: 'MiB',
}, },
'zram-total': { zramTotal: {
value: '7992.00', value: '7992.00',
unit: 'MiB', unit: 'MiB',
}, },
'zram-available': { zramAvailable: {
value: '7882.50', value: '7882.50',
unit: 'MiB', unit: 'MiB',
}, },
'zram-used': { zramUsed: {
value: '109.50', value: '109.50',
unit: 'MiB', unit: 'MiB',
}, },
}, },
cpu: { cpu: {
'percentage-used': { percentageUsed: {
value: '8.4', value: '8.4',
unit: '%', unit: '%',
}, },
'user-space': { userSpace: {
value: '7.0', value: '7.0',
unit: '%', unit: '%',
}, },
'kernel-space': { kernelSpace: {
value: '1.4', value: '1.4',
unit: '%', unit: '%',
}, },
@@ -441,7 +441,7 @@ export module Mock {
value: '992.59', value: '992.59',
unit: 'GB', unit: 'GB',
}, },
'percentage-used': { percentageUsed: {
value: '46.4', value: '46.4',
unit: '%', unit: '%',
}, },
@@ -484,22 +484,22 @@ export module Mock {
current: 'b7b1a9cef4284f00af9e9dda6e676177', current: 'b7b1a9cef4284f00af9e9dda6e676177',
sessions: { sessions: {
c54ddd8107d6d7b9d8aed7: { c54ddd8107d6d7b9d8aed7: {
'last-active': '2021-07-14T20:49:17.774Z', lastActive: '2021-07-14T20:49:17.774Z',
'user-agent': 'AppleWebKit/{WebKit Rev} (KHTML, like Gecko)', userAgent: 'AppleWebKit/{WebKit Rev} (KHTML, like Gecko)',
metadata: { metadata: {
platforms: ['iphone', 'mobileweb', 'mobile', 'ios'], platforms: ['iphone', 'mobileweb', 'mobile', 'ios'],
}, },
}, },
klndsfjhbwsajkdnaksj: { klndsfjhbwsajkdnaksj: {
'last-active': '2019-07-14T20:49:17.774Z', lastActive: '2019-07-14T20:49:17.774Z',
'user-agent': 'AppleWebKit/{WebKit Rev} (KHTML, like Gecko)', userAgent: 'AppleWebKit/{WebKit Rev} (KHTML, like Gecko)',
metadata: { metadata: {
platforms: ['cli'], platforms: ['cli'],
}, },
}, },
b7b1a9cef4284f00af9e9dda6e676177: { b7b1a9cef4284f00af9e9dda6e676177: {
'last-active': '2021-06-14T20:49:17.774Z', lastActive: '2021-06-14T20:49:17.774Z',
'user-agent': userAgent:
'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0', 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0',
metadata: { metadata: {
platforms: ['desktop'], platforms: ['desktop'],
@@ -518,13 +518,13 @@ export module Mock {
export const SshKeys: RR.GetSSHKeysRes = [ export const SshKeys: RR.GetSSHKeysRes = [
{ {
'created-at': new Date().toISOString(), createdAt: new Date().toISOString(),
alg: 'ed25519', alg: 'ed25519',
hostname: 'Matt Key', hostname: 'Matt Key',
fingerprint: '28:d2:7e:78:61:b4:bf:g2:de:24:15:96:4e:d4:15:53', fingerprint: '28:d2:7e:78:61:b4:bf:g2:de:24:15:96:4e:d4:15:53',
}, },
{ {
'created-at': new Date().toISOString(), createdAt: new Date().toISOString(),
alg: 'ed25519', alg: 'ed25519',
hostname: 'Aiden Key', hostname: 'Aiden Key',
fingerprint: '12:f8:7e:78:61:b4:bf:e2:de:24:15:96:4e:d4:72:53', fingerprint: '12:f8:7e:78:61:b4:bf:e2:de:24:15:96:4e:d4:72:53',
@@ -532,7 +532,7 @@ export module Mock {
] ]
export const SshKey: RR.AddSSHKeyRes = { export const SshKey: RR.AddSSHKeyRes = {
'created-at': new Date().toISOString(), createdAt: new Date().toISOString(),
alg: 'ed25519', alg: 'ed25519',
hostname: 'Lucy Key', hostname: 'Lucy Key',
fingerprint: '44:44:7e:78:61:b4:bf:g2:de:24:15:96:4e:d4:15:53', fingerprint: '44:44:7e:78:61:b4:bf:g2:de:24:15:96:4e:d4:15:53',
@@ -546,7 +546,7 @@ export module Mock {
}, },
connected: 'Goosers', connected: 'Goosers',
country: 'US', country: 'US',
'available-wifi': [ availableWifi: [
{ {
ssid: 'Goosers a billion', ssid: 'Goosers a billion',
strength: 40, strength: 40,
@@ -566,7 +566,7 @@ export module Mock {
} }
export const BackupTargets: RR.GetBackupTargetsRes = { export const BackupTargets: RR.GetBackupTargetsRes = {
'unknown-disks': [ unknownDisks: [
{ {
logicalname: 'sbc4', logicalname: 'sbc4',
label: 'My Backup Drive', label: 'My Backup Drive',
@@ -574,6 +574,7 @@ export module Mock {
used: 100000000000, used: 100000000000,
model: 'T7', model: 'T7',
vendor: 'Samsung', vendor: 'Samsung',
startOs: null,
}, },
], ],
saved: [ saved: [
@@ -585,13 +586,13 @@ export module Mock {
path: '/Desktop/embassy-backups', path: '/Desktop/embassy-backups',
username: 'TestUser', username: 'TestUser',
mountable: false, mountable: false,
'embassy-os': { startOs: {
version: '0.3.0', version: '0.3.0',
full: true, full: true,
'password-hash': passwordHash:
// password is asdfasdf // password is asdfasdf
'$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ', '$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ',
'wrapped-key': '', wrappedKey: '',
}, },
}, },
{ {
@@ -601,7 +602,7 @@ export module Mock {
provider: 'dropbox', provider: 'dropbox',
path: '/Home/backups', path: '/Home/backups',
mountable: true, mountable: true,
'embassy-os': null, startOs: null,
}, },
{ {
id: 'csgashbdjkasnd', id: 'csgashbdjkasnd',
@@ -611,7 +612,7 @@ export module Mock {
path: '/Desktop/embassy-backups-2', path: '/Desktop/embassy-backups-2',
username: 'TestUser', username: 'TestUser',
mountable: true, mountable: true,
'embassy-os': null, startOs: null,
}, },
{ {
id: 'powjefhjbnwhdva', id: 'powjefhjbnwhdva',
@@ -625,13 +626,13 @@ export module Mock {
vendor: 'SSK', vendor: 'SSK',
mountable: true, mountable: true,
path: '/HomeFolder/Documents', path: '/HomeFolder/Documents',
'embassy-os': { startOs: {
version: '0.3.0', version: '0.3.0',
full: true, full: true,
// password is asdfasdf // password is asdfasdf
'password-hash': passwordHash:
'$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ', '$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ',
'wrapped-key': '', wrappedKey: '',
}, },
}, },
], ],
@@ -694,17 +695,17 @@ export module Mock {
export const BackupInfo: RR.GetBackupInfoRes = { export const BackupInfo: RR.GetBackupInfoRes = {
version: '0.3.0', version: '0.3.0',
timestamp: new Date().toISOString(), timestamp: new Date().toISOString(),
'package-backups': { packageBackups: {
bitcoind: { bitcoind: {
title: 'Bitcoin Core', title: 'Bitcoin Core',
version: '0.21.0', version: '0.21.0',
'os-version': '0.3.0', osVersion: '0.3.0',
timestamp: new Date().toISOString(), timestamp: new Date().toISOString(),
}, },
'btc-rpc-proxy': { 'btc-rpc-proxy': {
title: 'Bitcoin Proxy', title: 'Bitcoin Proxy',
version: '0.2.2', version: '0.2.2',
'os-version': '0.3.0', osVersion: '0.3.0',
timestamp: new Date().toISOString(), timestamp: new Date().toISOString(),
}, },
}, },
@@ -1261,12 +1262,12 @@ export module Mock {
export const MockDependencyConfig = MockConfig export const MockDependencyConfig = MockConfig
export const bitcoind: PackageDataEntry<InstalledState> = { export const bitcoind: PackageDataEntry<InstalledState> = {
'state-info': { stateInfo: {
state: PackageState.Installed, state: PackageState.Installed,
manifest: MockManifestBitcoind, manifest: MockManifestBitcoind,
}, },
icon: '/assets/img/service-icons/bitcoind.svg', icon: '/assets/img/service-icons/bitcoind.svg',
'last-backup': null, lastBackup: null,
status: { status: {
configured: true, configured: true,
main: { main: {
@@ -1274,10 +1275,10 @@ export module Mock {
started: new Date().toISOString(), started: new Date().toISOString(),
health: {}, health: {},
}, },
'dependency-config-errors': {}, dependencyConfigErrors: {},
}, },
actions: {}, // @TODO need mocks actions: {}, // @TODO need mocks
'service-interfaces': { serviceInterfaces: {
ui: { ui: {
id: 'ui', id: 'ui',
hasPrimary: false, hasPrimary: false,
@@ -1493,30 +1494,29 @@ export module Mock {
}, },
}, },
}, },
'current-dependencies': {}, currentDependencies: {},
'dependency-info': {}, dependencyInfo: {},
'marketplace-url': 'https://registry.start9.com/', marketplaceUrl: 'https://registry.start9.com/',
'developer-key': 'developer-key', developerKey: 'developer-key',
'has-config': true,
outboundProxy: null, outboundProxy: null,
} }
export const bitcoinProxy: PackageDataEntry<InstalledState> = { export const bitcoinProxy: PackageDataEntry<InstalledState> = {
'state-info': { stateInfo: {
state: PackageState.Installed, state: PackageState.Installed,
manifest: MockManifestBitcoinProxy, manifest: MockManifestBitcoinProxy,
}, },
icon: '/assets/img/service-icons/btc-rpc-proxy.png', icon: '/assets/img/service-icons/btc-rpc-proxy.png',
'last-backup': null, lastBackup: null,
status: { status: {
configured: false, configured: false,
main: { main: {
status: PackageMainStatus.Stopped, status: PackageMainStatus.Stopped,
}, },
'dependency-config-errors': {}, dependencyConfigErrors: {},
}, },
actions: {}, actions: {},
'service-interfaces': { serviceInterfaces: {
ui: { ui: {
id: 'ui', id: 'ui',
hasPrimary: false, hasPrimary: false,
@@ -1624,42 +1624,41 @@ export module Mock {
}, },
}, },
}, },
'current-dependencies': { currentDependencies: {
bitcoind: { bitcoind: {
versionRange: '>=26.0.0', versionRange: '>=26.0.0',
'health-checks': [], healthChecks: [],
}, },
}, },
'dependency-info': { dependencyInfo: {
bitcoind: { bitcoind: {
title: Mock.MockManifestBitcoind.title, title: Mock.MockManifestBitcoind.title,
icon: 'assets/img/service-icons/bitcoind.svg', icon: 'assets/img/service-icons/bitcoind.svg',
}, },
}, },
'marketplace-url': 'https://registry.start9.com/', marketplaceUrl: 'https://registry.start9.com/',
'developer-key': 'developer-key', developerKey: 'developer-key',
'has-config': true,
outboundProxy: null, outboundProxy: null,
} }
export const lnd: PackageDataEntry<InstalledState> = { export const lnd: PackageDataEntry<InstalledState> = {
'state-info': { stateInfo: {
state: PackageState.Installed, state: PackageState.Installed,
manifest: MockManifestLnd, manifest: MockManifestLnd,
}, },
icon: '/assets/img/service-icons/lnd.png', icon: '/assets/img/service-icons/lnd.png',
'last-backup': null, lastBackup: null,
status: { status: {
configured: true, configured: true,
main: { main: {
status: PackageMainStatus.Stopped, status: PackageMainStatus.Stopped,
}, },
'dependency-config-errors': { dependencyConfigErrors: {
'btc-rpc-proxy': 'Username not found', 'btc-rpc-proxy': 'Username not found',
}, },
}, },
actions: {}, actions: {},
'service-interfaces': { serviceInterfaces: {
grpc: { grpc: {
id: 'grpc', id: 'grpc',
hasPrimary: false, hasPrimary: false,
@@ -1871,17 +1870,17 @@ export module Mock {
}, },
}, },
}, },
'current-dependencies': { currentDependencies: {
bitcoind: { bitcoind: {
versionRange: '>=26.0.0', versionRange: '>=26.0.0',
'health-checks': [], healthChecks: [],
}, },
'btc-rpc-proxy': { 'btc-rpc-proxy': {
versionRange: '>2.0.0', // @TODO versionRange: '>2.0.0', // @TODO
'health-checks': [], healthChecks: [],
}, },
}, },
'dependency-info': { dependencyInfo: {
bitcoind: { bitcoind: {
title: Mock.MockManifestBitcoind.title, title: Mock.MockManifestBitcoind.title,
icon: 'assets/img/service-icons/bitcoind.svg', icon: 'assets/img/service-icons/bitcoind.svg',
@@ -1891,9 +1890,8 @@ export module Mock {
icon: 'assets/img/service-icons/btc-rpc-proxy.png', icon: 'assets/img/service-icons/btc-rpc-proxy.png',
}, },
}, },
'marketplace-url': 'https://registry.start9.com/', marketplaceUrl: 'https://registry.start9.com/',
'developer-key': 'developer-key', developerKey: 'developer-key',
'has-config': true,
outboundProxy: null, outboundProxy: null,
} }

View File

@@ -40,8 +40,8 @@ export module RR {
export type LogoutRes = null export type LogoutRes = null
export type ResetPasswordReq = { export type ResetPasswordReq = {
'old-password': string oldPassword: string
'new-password': string newPassword: string
} // auth.reset-password } // auth.reset-password
export type ResetPasswordRes = null export type ResetPasswordRes = null
@@ -68,7 +68,7 @@ export module RR {
metrics: Metrics metrics: Metrics
} }
export type UpdateServerReq = { 'marketplace-url': string } // server.update export type UpdateServerReq = { marketplaceUrl: string } // server.update
export type UpdateServerRes = 'updating' | 'no-updates' export type UpdateServerRes = 'updating' | 'no-updates'
export type SetServerClearnetAddressReq = { domainInfo: DomainInfo | null } // server.set-clearnet export type SetServerClearnetAddressReq = { domainInfo: DomainInfo | null } // server.set-clearnet
@@ -84,7 +84,7 @@ export module RR {
export type SystemRebuildRes = null export type SystemRebuildRes = null
export type ResetTorReq = { export type ResetTorReq = {
'wipe-state': boolean wipeState: boolean
reason: string reason: string
} // net.tor.reset } // net.tor.reset
export type ResetTorRes = null export type ResetTorRes = null
@@ -186,7 +186,7 @@ export module RR {
connected: string | null connected: string | null
country: string | null country: string | null
ethernet: boolean ethernet: boolean
'available-wifi': AvailableWifi[] availableWifi: AvailableWifi[]
} }
export type AddWifiReq = { export type AddWifiReq = {
@@ -230,7 +230,7 @@ export module RR {
export type GetBackupTargetsReq = {} // backup.target.list export type GetBackupTargetsReq = {} // backup.target.list
export type GetBackupTargetsRes = { export type GetBackupTargetsRes = {
'unknown-disks': UnknownDisk[] unknownDisks: UnknownDisk[]
saved: BackupTarget[] saved: BackupTarget[]
} }
@@ -276,9 +276,9 @@ export module RR {
export type CreateBackupJobReq = { export type CreateBackupJobReq = {
name: string name: string
'target-id': string targetId: string
cron: string cron: string
'package-ids': string[] packageIds: string[]
now: boolean now: boolean
} // backup.job.create } // backup.job.create
export type CreateBackupJobRes = BackupJob export type CreateBackupJobRes = BackupJob
@@ -297,10 +297,10 @@ export module RR {
export type DeleteBackupRunsReq = { ids: string[] } // backup.runs.delete export type DeleteBackupRunsReq = { ids: string[] } // backup.runs.delete
export type DeleteBackupRunsRes = null export type DeleteBackupRunsRes = null
export type GetBackupInfoReq = { 'target-id': string; password: string } // backup.target.info export type GetBackupInfoReq = { targetId: string; password: string } // backup.target.info
export type GetBackupInfoRes = BackupInfo export type GetBackupInfoRes = BackupInfo
export type CreateBackupReq = { 'target-id': string; 'package-ids': string[] } // backup.create export type CreateBackupReq = { targetId: string; packageIds: string[] } // backup.create
export type CreateBackupRes = null export type CreateBackupRes = null
// package // package
@@ -316,9 +316,9 @@ export module RR {
export type InstallPackageReq = { export type InstallPackageReq = {
id: string id: string
'version-spec'?: string versionSpec?: string
'version-priority'?: 'min' | 'max' versionPriority?: 'min' | 'max'
'marketplace-url': string marketplaceUrl: string
} // package.install } // package.install
export type InstallPackageRes = null export type InstallPackageRes = null
@@ -334,14 +334,15 @@ export module RR {
export type RestorePackagesReq = { export type RestorePackagesReq = {
// package.backup.restore // package.backup.restore
ids: string[] ids: string[]
'target-id': string targetId: string
oldPassword: string | null
password: string password: string
} }
export type RestorePackagesRes = null export type RestorePackagesRes = null
export type ExecutePackageActionReq = { export type ExecutePackageActionReq = {
id: string id: string
'action-id': string actionId: string
input?: object input?: object
} // package.action } // package.action
export type ExecutePackageActionRes = ActionResponse export type ExecutePackageActionRes = ActionResponse
@@ -359,12 +360,12 @@ export module RR {
export type UninstallPackageRes = null export type UninstallPackageRes = null
export type DryConfigureDependencyReq = { export type DryConfigureDependencyReq = {
'dependency-id': string dependencyId: string
'dependent-id': string dependentId: string
} // package.dependency.configure.dry } // package.dependency.configure.dry
export type DryConfigureDependencyRes = { export type DryConfigureDependencyRes = {
'old-config': object oldConfig: object
'new-config': object newConfig: object
spec: InputSpec spec: InputSpec
} }
@@ -389,10 +390,10 @@ export module RR {
// marketplace // marketplace
export type GetMarketplaceInfoReq = { 'server-id': string } export type GetMarketplaceInfoReq = { serverId: string }
export type GetMarketplaceInfoRes = StoreInfo export type GetMarketplaceInfoRes = StoreInfo
export type GetMarketplaceEosReq = { 'server-id': string } export type GetMarketplaceEosReq = { serverId: string }
export type GetMarketplaceEosRes = MarketplaceEOS export type GetMarketplaceEosRes = MarketplaceEOS
export type GetMarketplacePackagesReq = { export type GetMarketplacePackagesReq = {
@@ -401,7 +402,7 @@ export module RR {
category?: string category?: string
query?: string query?: string
page?: number page?: number
'per-page'?: number perPage?: number
} }
export type GetMarketplacePackagesRes = MarketplacePkg[] export type GetMarketplacePackagesRes = MarketplacePkg[]
@@ -412,7 +413,7 @@ export module RR {
export interface MarketplaceEOS { export interface MarketplaceEOS {
version: string version: string
headline: string headline: string
'release-notes': { [version: string]: string } releaseNotes: { [version: string]: string }
} }
export interface Breakages { export interface Breakages {
@@ -442,31 +443,31 @@ export interface Metrics {
} }
memory: { memory: {
total: MetricData total: MetricData
'percentage-used': MetricData percentageUsed: MetricData
used: MetricData used: MetricData
available: MetricData available: MetricData
'zram-total': MetricData zramTotal: MetricData
'zram-used': MetricData zramUsed: MetricData
'zram-available': MetricData zramAvailable: MetricData
} }
cpu: { cpu: {
'percentage-used': MetricData percentageUsed: MetricData
idle: MetricData idle: MetricData
'user-space': MetricData userSpace: MetricData
'kernel-space': MetricData kernelSpace: MetricData
wait: MetricData wait: MetricData
} }
disk: { disk: {
capacity: MetricData capacity: MetricData
'percentage-used': MetricData percentageUsed: MetricData
used: MetricData used: MetricData
available: MetricData available: MetricData
} }
} }
export interface Session { export interface Session {
'last-active': string lastActive: string
'user-agent': string userAgent: string
metadata: SessionMetadata metadata: SessionMetadata
} }
@@ -503,6 +504,7 @@ export interface UnknownDisk {
label: string | null label: string | null
capacity: number capacity: number
used: number | null used: number | null
startOs: StartOSDiskInfo | null
} }
export interface BaseBackupTarget { export interface BaseBackupTarget {
@@ -511,7 +513,7 @@ export interface BaseBackupTarget {
name: string name: string
mountable: boolean mountable: boolean
path: string path: string
'embassy-os': StartOSDiskInfo | null startOs: StartOSDiskInfo | null
} }
export interface DiskBackupTarget extends UnknownDisk, BaseBackupTarget { export interface DiskBackupTarget extends UnknownDisk, BaseBackupTarget {
@@ -543,13 +545,13 @@ export interface BackupJob {
name: string name: string
target: BackupTarget target: BackupTarget
cron: string // '* * * * * *' https://cloud.google.com/scheduler/docs/configuring/cron-job-schedules cron: string // '* * * * * *' https://cloud.google.com/scheduler/docs/configuring/cron-job-schedules
'package-ids': string[] packageIds: string[]
} }
export interface BackupInfo { export interface BackupInfo {
version: string version: string
timestamp: string timestamp: string
'package-backups': { packageBackups: {
[id: string]: PackageBackupInfo [id: string]: PackageBackupInfo
} }
} }
@@ -557,7 +559,7 @@ export interface BackupInfo {
export interface PackageBackupInfo { export interface PackageBackupInfo {
title: string title: string
version: string version: string
'os-version': string osVersion: string
timestamp: string timestamp: string
} }
@@ -566,7 +568,7 @@ export interface ServerSpecs {
} }
export interface SSHKey { export interface SSHKey {
'created-at': string createdAt: string
alg: string alg: string
hostname: string hostname: string
fingerprint: string fingerprint: string
@@ -576,8 +578,8 @@ export type ServerNotifications = ServerNotification<number>[]
export interface ServerNotification<T extends number> { export interface ServerNotification<T extends number> {
id: number id: number
'package-id': string | null packageId: string | null
'created-at': string createdAt: string
code: T code: T
level: NotificationLevel level: NotificationLevel
title: string title: string
@@ -596,8 +598,8 @@ export enum NotificationLevel {
export type NotificationData<T> = T extends 0 export type NotificationData<T> = T extends 0
? null ? null
: T extends 1 : T extends 1
? BackupReport ? BackupReport
: any : any
export interface BackupReport { export interface BackupReport {
server: { server: {

View File

@@ -175,7 +175,7 @@ export class LiveApiService extends ApiService {
async updateServer(url?: string): Promise<RR.UpdateServerRes> { async updateServer(url?: string): Promise<RR.UpdateServerRes> {
const params = { const params = {
'marketplace-url': url || this.config.marketplace.start9, marketplaceUrl: url || this.config.marketplace.start9,
} }
return this.rpcRequest({ method: 'server.update', params }) return this.rpcRequest({ method: 'server.update', params })
} }
@@ -234,7 +234,7 @@ export class LiveApiService extends ApiService {
async getEos(): Promise<RR.GetMarketplaceEosRes> { async getEos(): Promise<RR.GetMarketplaceEosRes> {
const { id } = await getServerInfo(this.patch) const { id } = await getServerInfo(this.patch)
const qp: RR.GetMarketplaceEosReq = { 'server-id': id } const qp: RR.GetMarketplaceEosReq = { serverId: id }
return this.marketplaceProxy( return this.marketplaceProxy(
'/eos/v0/latest', '/eos/v0/latest',

View File

@@ -232,8 +232,8 @@ export class MockApiService extends ApiService {
return { return {
entries, entries,
'start-cursor': 'startCursor', startCursor: 'start-cursor',
'end-cursor': 'endCursor', endCursor: 'end-cursor',
} }
} }
@@ -245,8 +245,8 @@ export class MockApiService extends ApiService {
return { return {
entries, entries,
'start-cursor': 'startCursor', startCursor: 'start-cursor',
'end-cursor': 'endCursor', endCursor: 'end-cursor',
} }
} }
@@ -256,8 +256,8 @@ export class MockApiService extends ApiService {
return { return {
entries, entries,
'start-cursor': 'startCursor', startCursor: 'startCursor',
'end-cursor': 'endCursor', endCursor: 'end-cursor',
} }
} }
@@ -266,7 +266,7 @@ export class MockApiService extends ApiService {
): Promise<RR.FollowServerLogsRes> { ): Promise<RR.FollowServerLogsRes> {
await pauseFor(2000) await pauseFor(2000)
return { return {
'start-cursor': 'start-cursor', startCursor: 'start-cursor',
guid: '7251d5be-645f-4362-a51b-3a85be92b31e', guid: '7251d5be-645f-4362-a51b-3a85be92b31e',
} }
} }
@@ -276,7 +276,7 @@ export class MockApiService extends ApiService {
): Promise<RR.FollowServerLogsRes> { ): Promise<RR.FollowServerLogsRes> {
await pauseFor(2000) await pauseFor(2000)
return { return {
'start-cursor': 'start-cursor', startCursor: 'start-cursor',
guid: '7251d5be-645f-4362-a51b-3a85be92b31e', guid: '7251d5be-645f-4362-a51b-3a85be92b31e',
} }
} }
@@ -286,7 +286,7 @@ export class MockApiService extends ApiService {
): Promise<RR.FollowServerLogsRes> { ): Promise<RR.FollowServerLogsRes> {
await pauseFor(2000) await pauseFor(2000)
return { return {
'start-cursor': 'start-cursor', startCursor: 'start-cursor',
guid: '7251d5be-645f-4362-a51b-3a85be92b31e', guid: '7251d5be-645f-4362-a51b-3a85be92b31e',
} }
} }
@@ -324,7 +324,7 @@ export class MockApiService extends ApiService {
const patch = [ const patch = [
{ {
op: PatchOp.REPLACE, op: PatchOp.REPLACE,
path: '/server-info/status-info/update-progress', path: '/serverInfo/statusInfo/updateProgress',
value: initialProgress, value: initialProgress,
}, },
] ]
@@ -358,7 +358,7 @@ export class MockApiService extends ApiService {
const patch = [ const patch = [
{ {
op: PatchOp.REPLACE, op: PatchOp.REPLACE,
path: '/server-info/status-info/restarting', path: '/serverInfo/statusInfo/restarting',
value: true, value: true,
}, },
] ]
@@ -368,7 +368,7 @@ export class MockApiService extends ApiService {
const patch2 = [ const patch2 = [
{ {
op: PatchOp.REPLACE, op: PatchOp.REPLACE,
path: '/server-info/status-info/restarting', path: '/serverInfo/statusInfo/restarting',
value: false, value: false,
}, },
] ]
@@ -386,7 +386,7 @@ export class MockApiService extends ApiService {
const patch = [ const patch = [
{ {
op: PatchOp.REPLACE, op: PatchOp.REPLACE,
path: '/server-info/status-info/shutting-down', path: '/serverInfo/statusInfo/shuttingDown',
value: true, value: true,
}, },
] ]
@@ -396,7 +396,7 @@ export class MockApiService extends ApiService {
const patch2 = [ const patch2 = [
{ {
op: PatchOp.REPLACE, op: PatchOp.REPLACE,
path: '/server-info/status-info/shutting-down', path: '/serverInfo/statusInfo/shuttingDown',
value: false, value: false,
}, },
] ]
@@ -781,7 +781,7 @@ export class MockApiService extends ApiService {
path: path.replace(/\\/g, '/'), path: path.replace(/\\/g, '/'),
username: 'mockusername', username: 'mockusername',
mountable: true, mountable: true,
'embassy-os': null, startOs: null,
} }
} }
@@ -816,7 +816,7 @@ export class MockApiService extends ApiService {
name: params.name, name: params.name,
target: Mock.BackupTargets.saved[0], target: Mock.BackupTargets.saved[0],
cron: params.cron, cron: params.cron,
'package-ids': params['package-ids'], packageIds: params.packageIds,
} }
} }
@@ -860,13 +860,13 @@ export class MockApiService extends ApiService {
async createBackup(params: RR.CreateBackupReq): Promise<RR.CreateBackupRes> { async createBackup(params: RR.CreateBackupReq): Promise<RR.CreateBackupRes> {
await pauseFor(2000) await pauseFor(2000)
const path = '/server-info/status-info/backup-progress' const path = '/serverInfo/statusInfo/backupProgress'
const ids = params['package-ids'] const ids = params.packageIds
setTimeout(async () => { setTimeout(async () => {
for (let i = 0; i < ids.length; i++) { for (let i = 0; i < ids.length; i++) {
const id = ids[i] const id = ids[i]
const appPath = `/package-data/${id}/status/main/status` const appPath = `/packageData/${id}/status/main/status`
const appPatch = [ const appPatch = [
{ {
op: PatchOp.REPLACE, op: PatchOp.REPLACE,
@@ -952,8 +952,8 @@ export class MockApiService extends ApiService {
} }
return { return {
entries, entries,
'start-cursor': 'startCursor', startCursor: 'startCursor',
'end-cursor': 'endCursor', endCursor: 'end-cursor',
} }
} }
@@ -962,7 +962,7 @@ export class MockApiService extends ApiService {
): Promise<RR.FollowPackageLogsRes> { ): Promise<RR.FollowPackageLogsRes> {
await pauseFor(2000) await pauseFor(2000)
return { return {
'start-cursor': 'start-cursor', startCursor: 'start-cursor',
guid: '7251d5be-645f-4362-a51b-3a85be92b31e', guid: '7251d5be-645f-4362-a51b-3a85be92b31e',
} }
} }
@@ -976,17 +976,17 @@ export class MockApiService extends ApiService {
this.updateProgress(params.id) this.updateProgress(params.id)
}, 1000) }, 1000)
const manifest = Mock.LocalPkgs[params.id]['state-info'].manifest const manifest = Mock.LocalPkgs[params.id].stateInfo.manifest
const patch: Operation< const patch: Operation<
PackageDataEntry<InstallingState | UpdatingState> PackageDataEntry<InstallingState | UpdatingState>
>[] = [ >[] = [
{ {
op: PatchOp.ADD, op: PatchOp.ADD,
path: `/package-data/${params.id}`, path: `/packageData/${params.id}`,
value: { value: {
...Mock.LocalPkgs[params.id], ...Mock.LocalPkgs[params.id],
'state-info': { stateInfo: {
// if installing // if installing
state: PackageState.Installing, state: PackageState.Installing,
@@ -995,8 +995,8 @@ export class MockApiService extends ApiService {
// manifest, // manifest,
// both // both
'installing-info': { installingInfo: {
'new-manifest': manifest, newManifest: manifest,
progress: PROGRESS, progress: PROGRESS,
}, },
}, },
@@ -1032,7 +1032,7 @@ export class MockApiService extends ApiService {
const patch = [ const patch = [
{ {
op: PatchOp.REPLACE, op: PatchOp.REPLACE,
path: `/package-data/${params.id}/status/configured`, path: `/packageData/${params.id}/status/configured`,
value: true, value: true,
}, },
] ]
@@ -1052,13 +1052,13 @@ export class MockApiService extends ApiService {
return { return {
op: PatchOp.ADD, op: PatchOp.ADD,
path: `/package-data/${id}`, path: `/packageData/${id}`,
value: { value: {
...Mock.LocalPkgs[id], ...Mock.LocalPkgs[id],
'state-info': { stateInfo: {
state: PackageState.Restoring, state: PackageState.Restoring,
'installing-info': { installingInfo: {
'new-manifest': Mock.LocalPkgs[id]['state-info'].manifest!, newManifest: Mock.LocalPkgs[id].stateInfo.manifest!,
progress: PROGRESS, progress: PROGRESS,
}, },
}, },
@@ -1079,7 +1079,7 @@ export class MockApiService extends ApiService {
} }
async startPackage(params: RR.StartPackageReq): Promise<RR.StartPackageRes> { async startPackage(params: RR.StartPackageReq): Promise<RR.StartPackageRes> {
const path = `/package-data/${params.id}/status/main` const path = `/packageData/${params.id}/status/main`
await pauseFor(2000) await pauseFor(2000)
@@ -1128,7 +1128,7 @@ export class MockApiService extends ApiService {
): Promise<RR.RestartPackageRes> { ): Promise<RR.RestartPackageRes> {
// first enact stop // first enact stop
await pauseFor(2000) await pauseFor(2000)
const path = `/package-data/${params.id}/status/main` const path = `/packageData/${params.id}/status/main`
setTimeout(async () => { setTimeout(async () => {
const patch2: Operation<any>[] = [ const patch2: Operation<any>[] = [
@@ -1204,7 +1204,7 @@ export class MockApiService extends ApiService {
async stopPackage(params: RR.StopPackageReq): Promise<RR.StopPackageRes> { async stopPackage(params: RR.StopPackageReq): Promise<RR.StopPackageRes> {
await pauseFor(2000) await pauseFor(2000)
const path = `/package-data/${params.id}/status/main` const path = `/packageData/${params.id}/status/main`
setTimeout(() => { setTimeout(() => {
const patch2 = [ const patch2 = [
@@ -1244,7 +1244,7 @@ export class MockApiService extends ApiService {
const patch2: RemoveOperation[] = [ const patch2: RemoveOperation[] = [
{ {
op: PatchOp.REMOVE, op: PatchOp.REMOVE,
path: `/package-data/${params.id}`, path: `/packageData/${params.id}`,
}, },
] ]
this.mockRevision(patch2) this.mockRevision(patch2)
@@ -1253,7 +1253,7 @@ export class MockApiService extends ApiService {
const patch = [ const patch = [
{ {
op: PatchOp.REPLACE, op: PatchOp.REPLACE,
path: `/package-data/${params.id}/state-info/state`, path: `/packageData/${params.id}/stateInfo/state`,
value: PackageState.Removing, value: PackageState.Removing,
}, },
] ]
@@ -1268,8 +1268,8 @@ export class MockApiService extends ApiService {
): Promise<RR.DryConfigureDependencyRes> { ): Promise<RR.DryConfigureDependencyRes> {
await pauseFor(2000) await pauseFor(2000)
return { return {
'old-config': Mock.MockConfig, oldConfig: Mock.MockConfig,
'new-config': Mock.MockDependencyConfig, newConfig: Mock.MockDependencyConfig,
spec: await Mock.getInputSpec(), spec: await Mock.getInputSpec(),
} }
} }
@@ -1327,7 +1327,7 @@ export class MockApiService extends ApiService {
const patches: Operation<any>[] = [ const patches: Operation<any>[] = [
{ {
op: PatchOp.REPLACE, op: PatchOp.REPLACE,
path: `/package-data/${id}/state-info/installing-info/progress/phases/${i}/progress`, path: `/packageData/${id}/stateInfo/installingInfo/progress/phases/${i}/progress`,
value: true, value: true,
}, },
] ]
@@ -1340,7 +1340,7 @@ export class MockApiService extends ApiService {
patches.push({ patches.push({
op: PatchOp.REPLACE, op: PatchOp.REPLACE,
path: `/package-data/${id}/state-info/installing-info/progress/overall/done`, path: `/packageData/${id}/stateInfo/installingInfo/progress/overall/done`,
value: progress.overall.done, value: progress.overall.done,
}) })
} }
@@ -1357,7 +1357,7 @@ export class MockApiService extends ApiService {
const patches: Operation<any>[] = [ const patches: Operation<any>[] = [
{ {
op: PatchOp.REPLACE, op: PatchOp.REPLACE,
path: `/package-data/${id}/state-info/installing-info/progress/phases/${i}/progress/done`, path: `/packageData/${id}/stateInfo/installingInfo/progress/phases/${i}/progress/done`,
value: phase.progress.done, value: phase.progress.done,
}, },
] ]
@@ -1370,7 +1370,7 @@ export class MockApiService extends ApiService {
patches.push({ patches.push({
op: PatchOp.REPLACE, op: PatchOp.REPLACE,
path: `/package-data/${id}/state-info/installing-info/progress/overall/done`, path: `/packageData/${id}/stateInfo/installingInfo/progress/overall/done`,
value: progress.overall.done, value: progress.overall.done,
}) })
} }
@@ -1382,7 +1382,7 @@ export class MockApiService extends ApiService {
this.mockRevision([ this.mockRevision([
{ {
op: PatchOp.REPLACE, op: PatchOp.REPLACE,
path: `/package-data/${id}/state-info/installing-info/progress/phases/${i}/progress`, path: `/packageData/${id}/stateInfo/installingInfo/progress/phases/${i}/progress`,
value: true, value: true,
}, },
]) ])
@@ -1395,7 +1395,7 @@ export class MockApiService extends ApiService {
this.mockRevision([ this.mockRevision([
{ {
op: PatchOp.REPLACE, op: PatchOp.REPLACE,
path: `/package-data/${id}/state-info/installing-info/progress/overall`, path: `/packageData/${id}/stateInfo/installingInfo/progress/overall`,
value: true, value: true,
}, },
]) ])
@@ -1404,10 +1404,10 @@ export class MockApiService extends ApiService {
const patch2: Operation<StateInfo>[] = [ const patch2: Operation<StateInfo>[] = [
{ {
op: PatchOp.REPLACE, op: PatchOp.REPLACE,
path: `/package-data/${id}/state-info`, path: `/packageData/${id}/stateInfo`,
value: { value: {
state: PackageState.Installed, state: PackageState.Installed,
manifest: Mock.LocalPkgs[id]['state-info'].manifest, manifest: Mock.LocalPkgs[id].stateInfo.manifest,
}, },
}, },
] ]
@@ -1421,7 +1421,7 @@ export class MockApiService extends ApiService {
const patch0 = [ const patch0 = [
{ {
op: PatchOp.REPLACE, op: PatchOp.REPLACE,
path: `/server-info/status-info/update-progress/size`, path: `/serverInfo/statusInfo/updateProgress/size`,
value: size, value: size,
}, },
] ]
@@ -1433,7 +1433,7 @@ export class MockApiService extends ApiService {
const patch = [ const patch = [
{ {
op: PatchOp.REPLACE, op: PatchOp.REPLACE,
path: `/server-info/status-info/update-progress/downloaded`, path: `/serverInfo/statusInfo/updateProgress/downloaded`,
value: downloaded, value: downloaded,
}, },
] ]
@@ -1443,7 +1443,7 @@ export class MockApiService extends ApiService {
const patch2 = [ const patch2 = [
{ {
op: PatchOp.REPLACE, op: PatchOp.REPLACE,
path: `/server-info/status-info/update-progress/downloaded`, path: `/serverInfo/statusInfo/updateProgress/downloaded`,
value: size, value: size,
}, },
] ]
@@ -1453,12 +1453,12 @@ export class MockApiService extends ApiService {
const patch3: Operation<boolean>[] = [ const patch3: Operation<boolean>[] = [
{ {
op: PatchOp.REPLACE, op: PatchOp.REPLACE,
path: '/server-info/status-info/updated', path: '/serverInfo/statusInfo/updated',
value: true, value: true,
}, },
{ {
op: PatchOp.REMOVE, op: PatchOp.REMOVE,
path: '/server-info/status-info/update-progress', path: '/serverInfo/statusInfo/updateProgress',
}, },
] ]
this.mockRevision(patch3) this.mockRevision(patch3)
@@ -1467,7 +1467,7 @@ export class MockApiService extends ApiService {
const patch6 = [ const patch6 = [
{ {
op: PatchOp.REPLACE, op: PatchOp.REPLACE,
path: '/server-info/status-info', path: '/serverInfo/statusInfo',
value: Mock.ServerUpdated, value: Mock.ServerUpdated,
}, },
] ]

View File

@@ -9,13 +9,13 @@ import { Mock } from './api.fixures'
export const mockPatchData: DataModel = { export const mockPatchData: DataModel = {
ui: { ui: {
name: `Matt's Server`, name: `Matt's Server`,
'ack-welcome': '1.0.0', ackWelcome: '1.0.0',
theme: 'Dark', theme: 'Dark',
desktop: ['lnd'], desktop: ['lnd'],
widgets: [], widgets: [],
marketplace: { marketplace: {
'selected-url': 'https://registry.start9.com/', selectedUrl: 'https://registry.start9.com/',
'known-hosts': { knownHosts: {
'https://registry.start9.com/': { 'https://registry.start9.com/': {
name: 'Start9 Registry', name: 'Start9 Registry',
}, },
@@ -27,12 +27,12 @@ export const mockPatchData: DataModel = {
}, },
gaming: { gaming: {
snake: { snake: {
'high-score': 0, highScore: 0,
}, },
}, },
'ack-instructions': {}, ackInstructions: {},
}, },
'server-info': { serverInfo: {
id: 'abcdefgh', id: 'abcdefgh',
version: '0.3.5.1', version: '0.3.5.1',
country: 'us', country: 'us',
@@ -116,22 +116,22 @@ export const mockPatchData: DataModel = {
}, },
outboundProxy: null, outboundProxy: null,
}, },
'last-backup': new Date(new Date().valueOf() - 604800001).toISOString(), lastBackup: new Date(new Date().valueOf() - 604800001).toISOString(),
unreadNotifications: { unreadNotifications: {
count: 4, count: 4,
recent: Mock.Notifications, recent: Mock.Notifications,
}, },
'eos-version-compat': '>=0.3.0 <=0.3.0.1', eosVersionCompat: '>=0.3.0 <=0.3.0.1',
'status-info': { statusInfo: {
'current-backup': null, currentBackup: null,
updated: false, updated: false,
'update-progress': null, updateProgress: null,
restarting: false, restarting: false,
'shutting-down': false, shuttingDown: false,
}, },
pubkey: 'npub1sg6plzptd64u62a878hep2kev88swjh3tw00gjsfl8f237lmu63q0uf63m', pubkey: 'npub1sg6plzptd64u62a878hep2kev88swjh3tw00gjsfl8f237lmu63q0uf63m',
'ca-fingerprint': 'SHA-256: 63 2B 11 99 44 40 17 DF 37 FC C3 DF 0F 3D 15', caFingerprint: 'SHA-256: 63 2B 11 99 44 40 17 DF 37 FC C3 DF 0F 3D 15',
'ntp-synced': false, ntpSynced: false,
smtp: { smtp: {
server: '', server: '',
port: 587, port: 587,
@@ -139,13 +139,13 @@ export const mockPatchData: DataModel = {
login: '', login: '',
password: '', password: '',
}, },
'password-hash': passwordHash:
'$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ', '$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ',
platform: 'x86_64-nonfree', platform: 'x86_64-nonfree',
}, },
'package-data': { packageData: {
bitcoind: { bitcoind: {
'state-info': { stateInfo: {
state: PackageState.Installed, state: PackageState.Installed,
manifest: { manifest: {
...Mock.MockManifestBitcoind, ...Mock.MockManifestBitcoind,
@@ -153,7 +153,7 @@ export const mockPatchData: DataModel = {
}, },
}, },
icon: '/assets/img/service-icons/bitcoind.svg', icon: '/assets/img/service-icons/bitcoind.svg',
'last-backup': null, lastBackup: null,
status: { status: {
configured: true, configured: true,
main: { main: {
@@ -185,10 +185,10 @@ export const mockPatchData: DataModel = {
}, },
}, },
}, },
'dependency-config-errors': {}, dependencyConfigErrors: {},
}, },
actions: {}, // @TODO actions: {}, // @TODO
'service-interfaces': { serviceInterfaces: {
ui: { ui: {
id: 'ui', id: 'ui',
hasPrimary: false, hasPrimary: false,
@@ -404,15 +404,14 @@ export const mockPatchData: DataModel = {
}, },
}, },
}, },
'current-dependencies': {}, currentDependencies: {},
'dependency-info': {}, dependencyInfo: {},
'marketplace-url': 'https://registry.start9.com/', marketplaceUrl: 'https://registry.start9.com/',
'developer-key': 'developer-key', developerKey: 'developer-key',
'has-config': true,
outboundProxy: null, outboundProxy: null,
}, },
lnd: { lnd: {
'state-info': { stateInfo: {
state: PackageState.Installed, state: PackageState.Installed,
manifest: { manifest: {
...Mock.MockManifestLnd, ...Mock.MockManifestLnd,
@@ -420,18 +419,18 @@ export const mockPatchData: DataModel = {
}, },
}, },
icon: '/assets/img/service-icons/lnd.png', icon: '/assets/img/service-icons/lnd.png',
'last-backup': null, lastBackup: null,
status: { status: {
configured: true, configured: true,
main: { main: {
status: PackageMainStatus.Stopped, status: PackageMainStatus.Stopped,
}, },
'dependency-config-errors': { dependencyConfigErrors: {
'btc-rpc-proxy': 'This is a config unsatisfied error', 'btc-rpc-proxy': 'This is a config unsatisfied error',
}, },
}, },
actions: {}, actions: {},
'service-interfaces': { serviceInterfaces: {
grpc: { grpc: {
id: 'grpc', id: 'grpc',
hasPrimary: false, hasPrimary: false,
@@ -641,17 +640,17 @@ export const mockPatchData: DataModel = {
}, },
}, },
}, },
'current-dependencies': { currentDependencies: {
bitcoind: { bitcoind: {
versionRange: '>=26.0.0', versionRange: '>=26.0.0',
'health-checks': [], healthChecks: [],
}, },
'btc-rpc-proxy': { 'btc-rpc-proxy': {
versionRange: '>2.0.0', versionRange: '>2.0.0',
'health-checks': [], healthChecks: [],
}, },
}, },
'dependency-info': { dependencyInfo: {
bitcoind: { bitcoind: {
title: 'Bitcoin Core', title: 'Bitcoin Core',
icon: 'assets/img/service-icons/bitcoind.svg', icon: 'assets/img/service-icons/bitcoind.svg',
@@ -661,9 +660,8 @@ export const mockPatchData: DataModel = {
icon: 'assets/img/service-icons/btc-rpc-proxy.png', icon: 'assets/img/service-icons/btc-rpc-proxy.png',
}, },
}, },
'marketplace-url': 'https://registry.start9.com/', marketplaceUrl: 'https://registry.start9.com/',
'developer-key': 'developer-key', developerKey: 'developer-key',
'has-config': true,
outboundProxy: null, outboundProxy: null,
}, },
}, },

View File

@@ -87,9 +87,7 @@ export class ConfigService {
} }
/** ${scheme}://${username}@${host}:${externalPort}${suffix} */ /** ${scheme}://${username}@${host}:${externalPort}${suffix} */
launchableAddress( launchableAddress(interfaces: PackageDataEntry['serviceInterfaces']): string {
interfaces: PackageDataEntry['service-interfaces'],
): string {
const ui = Object.values(interfaces).find(i => i.type === 'ui') const ui = Object.values(interfaces).find(i => i.type === 'ui')
if (!ui) return '' if (!ui) return ''
@@ -168,7 +166,7 @@ export function removePort(str: string): string {
} }
export function hasUi( export function hasUi(
interfaces: PackageDataEntry['service-interfaces'], interfaces: PackageDataEntry['serviceInterfaces'],
): boolean { ): boolean {
return Object.values(interfaces).some(iface => iface.type === 'ui') return Object.values(interfaces).some(iface => iface.type === 'ui')
} }

View File

@@ -22,7 +22,7 @@ export type PkgDependencyErrors = Record<string, DependencyError | null>
}) })
export class DepErrorService { export class DepErrorService {
readonly depErrors$: Observable<AllDependencyErrors> = this.patch readonly depErrors$: Observable<AllDependencyErrors> = this.patch
.watch$('package-data') .watch$('packageData')
.pipe( .pipe(
map(pkgs => map(pkgs =>
Object.keys(pkgs) Object.keys(pkgs)
@@ -56,7 +56,7 @@ export class DepErrorService {
} }
private getDepErrors( private getDepErrors(
pkgs: DataModel['package-data'], pkgs: DataModel['packageData'],
pkgId: string, pkgId: string,
outerErrors: AllDependencyErrors, outerErrors: AllDependencyErrors,
): PkgDependencyErrors { ): PkgDependencyErrors {
@@ -74,7 +74,7 @@ export class DepErrorService {
} }
private getDepError( private getDepError(
pkgs: DataModel['package-data'], pkgs: DataModel['packageData'],
pkg: PackageDataEntry<InstalledState>, pkg: PackageDataEntry<InstalledState>,
depId: string, depId: string,
outerErrors: AllDependencyErrors, outerErrors: AllDependencyErrors,
@@ -82,14 +82,14 @@ export class DepErrorService {
const dep = pkgs[depId] const dep = pkgs[depId]
// not installed // not installed
if (!dep || dep['state-info'].state !== PackageState.Installed) { if (!dep || dep.stateInfo.state !== PackageState.Installed) {
return { return {
type: DependencyErrorType.NotInstalled, type: DependencyErrorType.NotInstalled,
} }
} }
const versionRange = pkg['current-dependencies'][depId].versionRange const versionRange = pkg.currentDependencies[depId].versionRange
const depManifest = dep['state-info'].manifest const depManifest = dep.stateInfo.manifest
// incorrect version // incorrect version
if (!this.emver.satisfies(depManifest.version, versionRange)) { if (!this.emver.satisfies(depManifest.version, versionRange)) {
@@ -101,9 +101,7 @@ export class DepErrorService {
} }
// invalid config // invalid config
if ( if (Object.values(pkg.status.dependencyConfigErrors).some(err => !!err)) {
Object.values(pkg.status['dependency-config-errors']).some(err => !!err)
) {
return { return {
type: DependencyErrorType.ConfigUnsatisfied, type: DependencyErrorType.ConfigUnsatisfied,
} }
@@ -123,7 +121,7 @@ export class DepErrorService {
// health check failure // health check failure
if (depStatus === PackageMainStatus.Running) { if (depStatus === PackageMainStatus.Running) {
for (let id of pkg['current-dependencies'][depId]['health-checks']) { for (let id of pkg.currentDependencies[depId].healthChecks) {
if (dep.status.main.health[id]?.result !== HealthResult.Success) { if (dep.status.main.health[id]?.result !== HealthResult.Success) {
return { return {
type: DependencyErrorType.HealthChecksFailed, type: DependencyErrorType.HealthChecksFailed,
@@ -147,14 +145,14 @@ export class DepErrorService {
} }
} }
function currentDeps(pkgs: DataModel['package-data'], id: string): string[] { function currentDeps(pkgs: DataModel['packageData'], id: string): string[] {
return Object.keys(pkgs[id]?.['current-dependencies'] || {}).filter( return Object.keys(pkgs[id]?.currentDependencies || {}).filter(
depId => depId !== id, depId => depId !== id,
) )
} }
function dependencyDepth( function dependencyDepth(
pkgs: DataModel['package-data'], pkgs: DataModel['packageData'],
id: string, id: string,
depth = 0, depth = 0,
): number { ): number {

View File

@@ -14,13 +14,13 @@ export class EOSService {
eos?: MarketplaceEOS eos?: MarketplaceEOS
updateAvailable$ = new BehaviorSubject<boolean>(false) updateAvailable$ = new BehaviorSubject<boolean>(false)
readonly updating$ = this.patch.watch$('server-info', 'status-info').pipe( readonly updating$ = this.patch.watch$('serverInfo', 'statusInfo').pipe(
map(status => !!status['update-progress'] || status.updated), map(status => !!status.updateProgress || status.updated),
distinctUntilChanged(), distinctUntilChanged(),
) )
readonly backingUp$ = this.patch readonly backingUp$ = this.patch
.watch$('server-info', 'status-info', 'current-backup') .watch$('serverInfo', 'statusInfo', 'currentBackup')
.pipe( .pipe(
map(obj => !!obj), map(obj => !!obj),
distinctUntilChanged(), distinctUntilChanged(),

View File

@@ -38,7 +38,7 @@ import { ClientStorageService } from './client-storage.service'
@Injectable() @Injectable()
export class MarketplaceService implements AbstractMarketplaceService { export class MarketplaceService implements AbstractMarketplaceService {
private readonly knownHosts$: Observable<StoreIdentity[]> = this.patch private readonly knownHosts$: Observable<StoreIdentity[]> = this.patch
.watch$('ui', 'marketplace', 'known-hosts') .watch$('ui', 'marketplace', 'knownHosts')
.pipe( .pipe(
map(hosts => { map(hosts => {
const { start9, community } = this.config.marketplace const { start9, community } = this.config.marketplace
@@ -72,8 +72,8 @@ export class MarketplaceService implements AbstractMarketplaceService {
private readonly selectedHost$: Observable<StoreIdentity> = this.patch private readonly selectedHost$: Observable<StoreIdentity> = this.patch
.watch$('ui', 'marketplace') .watch$('ui', 'marketplace')
.pipe( .pipe(
distinctUntilKeyChanged('selected-url'), distinctUntilKeyChanged('selectedUrl'),
map(({ 'selected-url': url, 'known-hosts': hosts }) => map(({ selectedUrl: url, knownHosts: hosts }) =>
toStoreIdentity(url, hosts[url]), toStoreIdentity(url, hosts[url]),
), ),
shareReplay({ bufferSize: 1, refCount: true }), shareReplay({ bufferSize: 1, refCount: true }),
@@ -196,9 +196,9 @@ export class MarketplaceService implements AbstractMarketplaceService {
): Observable<MarketplacePkg> { ): Observable<MarketplacePkg> {
return this.patch.watch$('ui', 'marketplace').pipe( return this.patch.watch$('ui', 'marketplace').pipe(
switchMap(uiMarketplace => { switchMap(uiMarketplace => {
const url = optionalUrl || uiMarketplace['selected-url'] const url = optionalUrl || uiMarketplace.selectedUrl
if (version !== '*' || !uiMarketplace['known-hosts'][url]) { if (version !== '*' || !uiMarketplace.knownHosts[url]) {
return this.fetchPackage$(id, version, url) return this.fetchPackage$(id, version, url)
} }
@@ -231,18 +231,18 @@ export class MarketplaceService implements AbstractMarketplaceService {
): Promise<void> { ): Promise<void> {
const params: RR.InstallPackageReq = { const params: RR.InstallPackageReq = {
id, id,
'version-spec': `=${version}`, versionSpec: `=${version}`,
'marketplace-url': url, marketplaceUrl: url,
} }
await this.api.installPackage(params) await this.api.installPackage(params)
} }
fetchInfo$(url: string): Observable<StoreInfo> { fetchInfo$(url: string): Observable<StoreInfo> {
return this.patch.watch$('server-info').pipe( return this.patch.watch$('serverInfo').pipe(
take(1), take(1),
switchMap(serverInfo => { switchMap(serverInfo => {
const qp: RR.GetMarketplaceInfoReq = { 'server-id': serverInfo.id } const qp: RR.GetMarketplaceInfoReq = { serverId: serverInfo.id }
return this.api.marketplaceProxy<RR.GetMarketplaceInfoRes>( return this.api.marketplaceProxy<RR.GetMarketplaceInfoRes>(
'/package/v0/info', '/package/v0/info',
qp, qp,
@@ -301,7 +301,7 @@ export class MarketplaceService implements AbstractMarketplaceService {
const qp: RR.GetMarketplacePackagesReq = { const qp: RR.GetMarketplacePackagesReq = {
...params, ...params,
page: 1, page: 1,
'per-page': 100, perPage: 100,
} }
if (qp.ids) qp.ids = JSON.stringify(qp.ids) if (qp.ids) qp.ids = JSON.stringify(qp.ids)
@@ -331,7 +331,7 @@ export class MarketplaceService implements AbstractMarketplaceService {
): Promise<void> { ): Promise<void> {
if (oldName !== newName) { if (oldName !== newName) {
this.api.setDbValue<string>( this.api.setDbValue<string>(
['marketplace', 'known-hosts', url, 'name'], ['marketplace', 'knownHosts', url, 'name'],
newName, newName,
) )
} }

View File

@@ -25,7 +25,7 @@ export class PatchDataService extends Observable<DataModel> {
// check for updates to eOS and services // check for updates to eOS and services
this.checkForUpdates() this.checkForUpdates()
// show eos welcome message // show eos welcome message
this.showEosWelcome(ui['ack-welcome']) this.showEosWelcome(ui.ackWelcome)
}), }),
share(), share(),
) )
@@ -60,7 +60,7 @@ export class PatchDataService extends Observable<DataModel> {
.subscribe({ .subscribe({
complete: () => { complete: () => {
this.embassyApi this.embassyApi
.setDbValue<string>(['ack-welcome'], this.config.version) .setDbValue<string>(['ackWelcome'], this.config.version)
.catch() .catch()
}, },
}) })

View File

@@ -2,30 +2,30 @@ import { BackupJob, ServerNotifications } from '../api/api.types'
import { Url } from '@start9labs/shared' import { Url } from '@start9labs/shared'
import { Manifest } from '@start9labs/marketplace' import { Manifest } from '@start9labs/marketplace'
import { types } from '@start9labs/start-sdk' import { types } from '@start9labs/start-sdk'
import { InputSpec } from '@start9labs/start-sdk/cjs/sdk/lib/config/configTypes'
import { import {
ActionMetadata, ActionMetadata,
HostnameInfo, HostnameInfo,
} from '@start9labs/start-sdk/cjs/sdk/lib/types' } from '@start9labs/start-sdk/cjs/sdk/lib/types'
import { customSmtp } from '@start9labs/start-sdk/cjs/sdk/lib/config/configConstants' import { customSmtp } from '@start9labs/start-sdk/cjs/sdk/lib/config/configConstants'
type ServiceInterfaceWithHostInfo = types.ServiceInterfaceWithHostInfo type ServiceInterfaceWithHostInfo = types.ServiceInterfaceWithHostInfo
export interface DataModel { export interface DataModel {
'server-info': ServerInfo serverInfo: ServerInfo
'package-data': { [id: string]: PackageDataEntry } packageData: { [id: string]: PackageDataEntry }
ui: UIData ui: UIData
} }
export interface UIData { export interface UIData {
name: string | null name: string | null
'ack-welcome': string // emver ackWelcome: string // emver
marketplace: UIMarketplaceData marketplace: UIMarketplaceData
gaming: { gaming: {
snake: { snake: {
'high-score': number highScore: number
} }
} }
'ack-instructions': Record<string, boolean> ackInstructions: Record<string, boolean>
theme: string theme: string
widgets: readonly Widget[] widgets: readonly Widget[]
desktop: readonly string[] desktop: readonly string[]
@@ -45,8 +45,8 @@ export interface Widget {
} }
export interface UIMarketplaceData { export interface UIMarketplaceData {
'selected-url': string selectedUrl: string
'known-hosts': { knownHosts: {
'https://registry.start9.com/': UIStore 'https://registry.start9.com/': UIStore
'https://community-registry.start9.com/': UIStore 'https://community-registry.start9.com/': UIStore
[url: string]: UIStore [url: string]: UIStore
@@ -63,18 +63,18 @@ export interface ServerInfo {
country: string country: string
ui: HostnameInfo[] ui: HostnameInfo[]
network: NetworkInfo network: NetworkInfo
'last-backup': string | null lastBackup: string | null
unreadNotifications: { unreadNotifications: {
count: number count: number
recent: ServerNotifications recent: ServerNotifications
} }
'status-info': ServerStatusInfo statusInfo: ServerStatusInfo
'eos-version-compat': string eosVersionCompat: string
pubkey: string pubkey: string
'ca-fingerprint': string caFingerprint: string
'ntp-synced': boolean ntpSynced: boolean
smtp: typeof customSmtp.validator._TYPE smtp: typeof customSmtp.validator._TYPE
'password-hash': string passwordHash: string
platform: string platform: string
} }
@@ -154,18 +154,14 @@ export interface IpInfo {
} }
export interface ServerStatusInfo { export interface ServerStatusInfo {
'current-backup': null | { currentBackup: null | {
job: BackupJob job: BackupJob
'backup-progress': { backupProgress: Record<string, boolean>
[packageId: string]: {
complete: boolean
}
}
} }
updated: boolean updated: boolean
'update-progress': { size: number | null; downloaded: number } | null updateProgress: { size: number | null; downloaded: number } | null
restarting: boolean restarting: boolean
'shutting-down': boolean shuttingDown: boolean
} }
export enum ServerStatus { export enum ServerStatus {
@@ -175,22 +171,21 @@ export enum ServerStatus {
} }
export type PackageDataEntry<T extends StateInfo = StateInfo> = { export type PackageDataEntry<T extends StateInfo = StateInfo> = {
'state-info': T stateInfo: T
icon: Url icon: Url
status: Status status: Status
actions: Record<string, ActionMetadata> actions: Record<string, ActionMetadata>
'last-backup': string | null lastBackup: string | null
'current-dependencies': { [id: string]: CurrentDependencyInfo } currentDependencies: { [id: string]: CurrentDependencyInfo }
'dependency-info': { dependencyInfo: {
[id: string]: { [id: string]: {
title: string title: string
icon: Url icon: Url
} }
} }
'service-interfaces': Record<string, ServiceInterfaceWithHostInfo> serviceInterfaces: Record<string, ServiceInterfaceWithHostInfo>
'marketplace-url': string | null marketplaceUrl: string | null
'developer-key': string developerKey: string
'has-config': boolean
outboundProxy: ServiceOutboundProxy outboundProxy: ServiceOutboundProxy
} }
@@ -203,12 +198,12 @@ export type InstalledState = {
export type InstallingState = { export type InstallingState = {
state: PackageState.Installing | PackageState.Restoring state: PackageState.Installing | PackageState.Restoring
'installing-info': InstallingInfo installingInfo: InstallingInfo
} }
export type UpdatingState = { export type UpdatingState = {
state: PackageState.Updating state: PackageState.Updating
'installing-info': InstallingInfo installingInfo: InstallingInfo
manifest: Manifest manifest: Manifest
} }
@@ -222,13 +217,13 @@ export enum PackageState {
export interface CurrentDependencyInfo { export interface CurrentDependencyInfo {
versionRange: string versionRange: string
'health-checks': string[] // array of health check IDs healthChecks: string[] // array of health check IDs
} }
export interface Status { export interface Status {
configured: boolean configured: boolean
main: MainStatus main: MainStatus
'dependency-config-errors': { [id: string]: string | null } dependencyConfigErrors: { [id: string]: string | null }
} }
export type MainStatus = export type MainStatus =
@@ -322,7 +317,7 @@ export interface HealthCheckResultFailure {
export type InstallingInfo = { export type InstallingInfo = {
progress: FullProgress progress: FullProgress
'new-manifest': Manifest newManifest: Manifest
} }
export type FullProgress = { export type FullProgress = {

View File

@@ -20,12 +20,12 @@ export function renderPkgStatus(
let dependency: DependencyStatus | null = null let dependency: DependencyStatus | null = null
let health: HealthStatus | null = null let health: HealthStatus | null = null
if (pkg['state-info'].state === PackageState.Installed) { if (pkg.stateInfo.state === PackageState.Installed) {
primary = getPrimaryStatus(pkg.status) primary = getPrimaryStatus(pkg.status)
dependency = getDependencyStatus(depErrors) dependency = getDependencyStatus(depErrors)
health = getHealthStatus(pkg.status) health = getHealthStatus(pkg.status)
} else { } else {
primary = pkg['state-info'].state as string as PrimaryStatus primary = pkg.stateInfo.state as string as PrimaryStatus
} }
return { primary, dependency, health } return { primary, dependency, health }

View File

@@ -32,7 +32,7 @@ export class TimeService {
readonly now$ = combineLatest([ readonly now$ = combineLatest([
this.time$, this.time$,
this.patch.watch$('server-info', 'ntp-synced'), this.patch.watch$('serverInfo', 'ntpSynced'),
]).pipe( ]).pipe(
map(([time, synced]) => ({ map(([time, synced]) => ({
value: time.now, value: time.now,

View File

@@ -4,16 +4,16 @@ import { getManifest } from './get-package-data'
export function dryUpdate( export function dryUpdate(
{ id, version }: { id: string; version: string }, { id, version }: { id: string; version: string },
pkgs: DataModel['package-data'], pkgs: DataModel['packageData'],
emver: Emver, emver: Emver,
): string[] { ): string[] {
return Object.values(pkgs) return Object.values(pkgs)
.filter( .filter(
pkg => pkg =>
Object.keys(pkg['current-dependencies'] || {}).some( Object.keys(pkg.currentDependencies || {}).some(
pkgId => pkgId === id, pkgId => pkgId === id,
) && ) &&
!emver.satisfies(version, pkg['current-dependencies'][id].versionRange), !emver.satisfies(version, pkg.currentDependencies[id].versionRange),
) )
.map(pkg => getManifest(pkg).title) .map(pkg => getManifest(pkg).title)
} }

View File

@@ -14,49 +14,47 @@ export async function getPackage(
patch: PatchDB<DataModel>, patch: PatchDB<DataModel>,
id: string, id: string,
): Promise<PackageDataEntry | undefined> { ): Promise<PackageDataEntry | undefined> {
return firstValueFrom(patch.watch$('package-data', id)) return firstValueFrom(patch.watch$('packageData', id))
} }
export async function getAllPackages( export async function getAllPackages(
patch: PatchDB<DataModel>, patch: PatchDB<DataModel>,
): Promise<DataModel['package-data']> { ): Promise<DataModel['packageData']> {
return firstValueFrom(patch.watch$('package-data')) return firstValueFrom(patch.watch$('packageData'))
} }
export function getManifest(pkg: PackageDataEntry): Manifest { 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'][ return (pkg.stateInfo as InstallingState).installingInfo.newManifest
'new-manifest'
]
} }
export function isInstalled( export function isInstalled(
pkg: PackageDataEntry, pkg: PackageDataEntry,
): pkg is PackageDataEntry<InstalledState> { ): pkg is PackageDataEntry<InstalledState> {
return pkg['state-info'].state === PackageState.Installed return pkg.stateInfo.state === PackageState.Installed
} }
export function isRemoving( export function isRemoving(
pkg: PackageDataEntry, pkg: PackageDataEntry,
): pkg is PackageDataEntry<InstalledState> { ): pkg is PackageDataEntry<InstalledState> {
return pkg['state-info'].state === PackageState.Removing return pkg.stateInfo.state === PackageState.Removing
} }
export function isInstalling( export function isInstalling(
pkg: PackageDataEntry, pkg: PackageDataEntry,
): pkg is PackageDataEntry<InstallingState> { ): pkg is PackageDataEntry<InstallingState> {
return pkg['state-info'].state === PackageState.Installing return pkg.stateInfo.state === PackageState.Installing
} }
export function isRestoring( export function isRestoring(
pkg: PackageDataEntry, pkg: PackageDataEntry,
): pkg is PackageDataEntry<InstallingState> { ): pkg is PackageDataEntry<InstallingState> {
return pkg['state-info'].state === PackageState.Restoring return pkg.stateInfo.state === PackageState.Restoring
} }
export function isUpdating( export function isUpdating(
pkg: PackageDataEntry, pkg: PackageDataEntry,
): pkg is PackageDataEntry<UpdatingState> { ): pkg is PackageDataEntry<UpdatingState> {
return pkg['state-info'].state === PackageState.Updating return pkg.stateInfo.state === PackageState.Updating
} }

View File

@@ -5,5 +5,5 @@ import { firstValueFrom } from 'rxjs'
export async function getServerInfo( export async function getServerInfo(
patch: PatchDB<DataModel>, patch: PatchDB<DataModel>,
): Promise<ServerInfo> { ): Promise<ServerInfo> {
return firstValueFrom(patch.watch$('server-info')) return firstValueFrom(patch.watch$('serverInfo'))
} }

View File

@@ -4,5 +4,5 @@ export function hasCurrentDeps(
id: string, id: string,
pkgs: Record<string, PackageDataEntry>, pkgs: Record<string, PackageDataEntry>,
): boolean { ): boolean {
return !!Object.values(pkgs).some(pkg => !!pkg['current-dependencies'][id]) return !!Object.values(pkgs).some(pkg => !!pkg.currentDependencies[id])
} }