diff --git a/web/projects/install-wizard/src/app/services/mock-api.service.ts b/web/projects/install-wizard/src/app/services/mock-api.service.ts index 9caf4f88e..5be394c67 100644 --- a/web/projects/install-wizard/src/app/services/mock-api.service.ts +++ b/web/projects/install-wizard/src/app/services/mock-api.service.ts @@ -17,12 +17,12 @@ export class MockApiService implements ApiService { label: null, capacity: 73264762332, used: null, - 'embassy-os': { + startOs: { version: '0.2.17', full: true, - 'password-hash': + passwordHash: '$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ', - 'wrapped-key': null, + wrappedKey: null, }, guid: null, }, @@ -40,12 +40,12 @@ export class MockApiService implements ApiService { label: null, capacity: 73264762332, used: null, - 'embassy-os': { + startOs: { version: '0.3.3', full: true, - 'password-hash': + passwordHash: '$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ', - 'wrapped-key': null, + wrappedKey: null, }, guid: null, }, @@ -63,12 +63,12 @@ export class MockApiService implements ApiService { label: null, capacity: 73264762332, used: null, - 'embassy-os': { + startOs: { version: '0.3.2', full: true, - 'password-hash': + passwordHash: '$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ', - 'wrapped-key': null, + wrappedKey: null, }, guid: 'guid-guid-guid-guid', }, diff --git a/web/projects/marketplace/src/pages/show/additional/additional.component.html b/web/projects/marketplace/src/pages/show/additional/additional.component.html index 511772365..21a27771d 100644 --- a/web/projects/marketplace/src/pages/show/additional/additional.component.html +++ b/web/projects/marketplace/src/pages/show/additional/additional.component.html @@ -4,7 +4,7 @@
diff --git a/web/projects/marketplace/src/pages/show/dependencies/dependencies.component.html b/web/projects/marketplace/src/pages/show/dependencies/dependencies.component.html index 6f1449d67..ecd726a84 100644 --- a/web/projects/marketplace/src/pages/show/dependencies/dependencies.component.html +++ b/web/projects/marketplace/src/pages/show/dependencies/dependencies.component.html @@ -1,10 +1,10 @@
- +
- {{ pkg['dependency-metadata'][dep.key].title || dep.key }} + {{ pkg.dependencyMetadata[dep.key].title || dep.key }}

@if (dep.value.optional) { diff --git a/web/projects/marketplace/src/pipes/filter-packages.pipe.ts b/web/projects/marketplace/src/pipes/filter-packages.pipe.ts index 9137392c3..5a81a4295 100644 --- a/web/projects/marketplace/src/pipes/filter-packages.pipe.ts +++ b/web/projects/marketplace/src/pipes/filter-packages.pipe.ts @@ -71,8 +71,7 @@ export class FilterPackagesPipe implements PipeTransform { .filter(p => category === 'all' || p.categories.includes(category!)) .sort((a, b) => { return ( - new Date(b['published-at']).valueOf() - - new Date(a['published-at']).valueOf() + new Date(b.publishedAt).valueOf() - new Date(a.publishedAt).valueOf() ) }) .map(a => ({ ...a })) diff --git a/web/projects/marketplace/src/types.ts b/web/projects/marketplace/src/types.ts index e35c0af59..15b1f4ccf 100644 --- a/web/projects/marketplace/src/types.ts +++ b/web/projects/marketplace/src/types.ts @@ -29,10 +29,10 @@ export interface MarketplacePkg { manifest: Manifest categories: string[] versions: string[] - 'dependency-metadata': { + dependencyMetadata: { [id: string]: DependencyMetadata } - 'published-at': string + publishedAt: string } export interface DependencyMetadata { @@ -46,19 +46,19 @@ export interface Manifest { id: string title: string version: string - 'git-hash'?: string + gitHash?: string description: { short: string long: string } replaces?: string[] - 'release-notes': string + releaseNotes: string license: string // name of license - 'wrapper-repo': Url - 'upstream-repo': Url - 'support-site': Url - 'marketing-site': Url - 'donation-url': Url | null + wrapperRepo: Url + upstreamRepo: Url + supportSite: Url + marketingSite: Url + donationUrl: Url | null alerts: { install: string | null uninstall: string | null @@ -67,8 +67,8 @@ export interface Manifest { stop: string | null } dependencies: Record - 'os-version': string - 'has-config': boolean + osVersion: string + hasConfig: boolean } export interface Dependency { diff --git a/web/projects/setup-wizard/src/app/services/api.service.ts b/web/projects/setup-wizard/src/app/services/api.service.ts index 019524eac..840674a7f 100644 --- a/web/projects/setup-wizard/src/app/services/api.service.ts +++ b/web/projects/setup-wizard/src/app/services/api.service.ts @@ -43,20 +43,20 @@ type Encrypted = { export type AttachReq = { guid: string - 'embassy-password': Encrypted + startOsPassword: Encrypted } export type ExecuteReq = { - 'embassy-logicalname': string - 'embassy-password': Encrypted - 'recovery-source': RecoverySource | null - 'recovery-password': Encrypted | null + startOsLogicalname: string + startOsPassword: Encrypted + recoverySource: RecoverySource | null + recoveryPassword: Encrypted | null } export type CompleteRes = { - 'tor-address': string - 'lan-address': string - 'root-ca': string + torAddress: string + lanAddress: string + rootCa: string } export type DiskBackupTarget = { @@ -66,7 +66,7 @@ export type DiskBackupTarget = { label: string | null capacity: number used: number | null - 'embassy-os': StartOSDiskInfo | null + startOs: StartOSDiskInfo | null } export type CifsBackupTarget = { @@ -74,7 +74,7 @@ export type CifsBackupTarget = { path: string username: string mountable: boolean - 'embassy-os': StartOSDiskInfo | null + startOs: StartOSDiskInfo | null } export type DiskRecoverySource = { diff --git a/web/projects/setup-wizard/src/app/services/live-api.service.ts b/web/projects/setup-wizard/src/app/services/live-api.service.ts index 666d2beb9..cabcd3603 100644 --- a/web/projects/setup-wizard/src/app/services/live-api.service.ts +++ b/web/projects/setup-wizard/src/app/services/live-api.service.ts @@ -76,11 +76,10 @@ export class LiveApiService extends ApiService { } async execute(setupInfo: ExecuteReq) { - if (setupInfo['recovery-source']?.type === 'backup') { - if (isCifsSource(setupInfo['recovery-source'].target)) { - setupInfo['recovery-source'].target.path = setupInfo[ - 'recovery-source' - ].target.path.replace('/\\/g', '/') + if (setupInfo.recoverySource?.type === 'backup') { + if (isCifsSource(setupInfo.recoverySource.target)) { + setupInfo.recoverySource.target.path = + setupInfo.recoverySource.target.path.replace('/\\/g', '/') } } @@ -106,7 +105,7 @@ export class LiveApiService extends ApiService { return { ...res, - 'root-ca': encodeBase64(res['root-ca']), + rootCa: encodeBase64(res.rootCa), } } diff --git a/web/projects/setup-wizard/src/app/services/mock-api.service.ts b/web/projects/setup-wizard/src/app/services/mock-api.service.ts index 00032ba9f..a7260825b 100644 --- a/web/projects/setup-wizard/src/app/services/mock-api.service.ts +++ b/web/projects/setup-wizard/src/app/services/mock-api.service.ts @@ -55,12 +55,12 @@ export class MockApiService extends ApiService { label: null, capacity: 1979120929996, used: null, - 'embassy-os': { + startOs: { version: '0.2.17', full: true, - 'password-hash': + passwordHash: '$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ', - 'wrapped-key': null, + wrappedKey: null, }, guid: null, }, @@ -78,12 +78,12 @@ export class MockApiService extends ApiService { label: null, capacity: 73264762332, used: null, - 'embassy-os': { + startOs: { version: '0.3.3', full: true, - 'password-hash': + passwordHash: '$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ', - 'wrapped-key': null, + wrappedKey: null, }, guid: null, }, @@ -101,12 +101,12 @@ export class MockApiService extends ApiService { label: null, capacity: 73264762332, used: null, - 'embassy-os': { + startOs: { version: '0.3.2', full: true, - 'password-hash': + passwordHash: '$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ', - 'wrapped-key': null, + wrappedKey: null, }, guid: 'guid-guid-guid-guid', }, @@ -122,9 +122,9 @@ export class MockApiService extends ApiService { return { version: '0.3.0', full: true, - 'password-hash': + passwordHash: '$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 { await pauseFor(1000) return { - 'tor-address': 'https://asdafsadasdasasdasdfasdfasdf.onion', - 'lan-address': 'https://adjective-noun.local', - 'root-ca': encodeBase64(rootCA), + torAddress: 'https://asdafsadasdasasdasdfasdfasdf.onion', + lanAddress: 'https://adjective-noun.local', + rootCa: encodeBase64(rootCA), } } diff --git a/web/projects/setup-wizard/src/app/services/state.service.ts b/web/projects/setup-wizard/src/app/services/state.service.ts index b4b5a1264..625af0739 100644 --- a/web/projects/setup-wizard/src/app/services/state.service.ts +++ b/web/projects/setup-wizard/src/app/services/state.service.ts @@ -14,7 +14,7 @@ export class StateService { async importDrive(guid: string, password: string): Promise { await this.api.attach({ guid, - 'embassy-password': await this.api.encrypt(password), + startOsPassword: await this.api.encrypt(password), }) } @@ -23,10 +23,10 @@ export class StateService { password: string, ): Promise { await this.api.execute({ - 'embassy-logicalname': storageLogicalname, - 'embassy-password': await this.api.encrypt(password), - 'recovery-source': this.recoverySource || null, - 'recovery-password': this.recoveryPassword + startOsLogicalname: storageLogicalname, + startOsPassword: await this.api.encrypt(password), + recoverySource: this.recoverySource || null, + recoveryPassword: this.recoveryPassword ? await this.api.encrypt(this.recoveryPassword) : null, }) diff --git a/web/projects/shared/src/types/api.ts b/web/projects/shared/src/types/api.ts index 895ce2cb2..4a64ba4a5 100644 --- a/web/projects/shared/src/types/api.ts +++ b/web/projects/shared/src/types/api.ts @@ -1,6 +1,6 @@ export type FollowLogsReq = {} export type FollowLogsRes = { - 'start-cursor': string + startCursor: string guid: string } @@ -12,8 +12,8 @@ export type FetchLogsReq = { export type FetchLogsRes = { entries: Log[] - 'start-cursor'?: string - 'end-cursor'?: string + startCursor?: string + endCursor?: string } export interface Log { @@ -37,19 +37,19 @@ export interface PartitionInfo { label: string | null capacity: number used: number | null - 'embassy-os': StartOSDiskInfo | null + startOs: StartOSDiskInfo | null guid: string | null } export type StartOSDiskInfo = { version: string full: boolean - 'password-hash': string | null - 'wrapped-key': string | null + passwordHash: string | null + wrappedKey: string | null } export interface SetupStatus { - 'bytes-transferred': number - 'total-bytes': number | null + bytesTransferred: number + totalBytes: number | null complete: boolean } diff --git a/web/projects/ui/src/app/app.component.ts b/web/projects/ui/src/app/app.component.ts index 93ff394da..28237452a 100644 --- a/web/projects/ui/src/app/app.component.ts +++ b/web/projects/ui/src/app/app.component.ts @@ -32,13 +32,12 @@ export class AppComponent implements OnInit { inject(ConnectionService).connected$, this.auth.isVerified$, this.patch - .watch$('server-info', 'status-info') - .pipe(startWith({ restarting: false, 'shutting-down': false })), + .watch$('serverInfo', 'statusInfo') + .pipe(startWith({ restarting: false, shuttingDown: false })), ]).pipe( map( ([verified, connected, status]) => - verified && - (!connected || status.restarting || status['shutting-down']), + verified && (!connected || status.restarting || status.shuttingDown), ), ) diff --git a/web/projects/ui/src/app/apps/diagnostic/services/mock-diagnostic.service.ts b/web/projects/ui/src/app/apps/diagnostic/services/mock-diagnostic.service.ts index f7c847a19..4fa730fdb 100644 --- a/web/projects/ui/src/app/apps/diagnostic/services/mock-diagnostic.service.ts +++ b/web/projects/ui/src/app/apps/diagnostic/services/mock-diagnostic.service.ts @@ -45,8 +45,8 @@ export class MockDiagnosticService implements DiagnosticService { } return { entries, - 'start-cursor': 'startCursor', - 'end-cursor': 'endCursor', + startCursor: 'start-cursor', + endCursor: 'end-cursor', } } } diff --git a/web/projects/ui/src/app/apps/portal/routes/system/backups/pipes/to-options.pipe.ts b/web/projects/ui/src/app/apps/portal/routes/system/backups/pipes/to-options.pipe.ts index 9f61c238a..83d32f4e9 100644 --- a/web/projects/ui/src/app/apps/portal/routes/system/backups/pipes/to-options.pipe.ts +++ b/web/projects/ui/src/app/apps/portal/routes/system/backups/pipes/to-options.pipe.ts @@ -26,7 +26,7 @@ export class ToOptionsPipe implements PipeTransform { id, installed: !!packageData[id], checked: false, - 'newer-eos': this.compare(packageBackups[id]['os-version']), + 'newer-eos': this.compare(packageBackups[id].osVersion), })) .sort((a, b) => b.title.toLowerCase() > a.title.toLowerCase() ? -1 : 1, diff --git a/web/projects/ui/src/app/services/api/api.fixures.ts b/web/projects/ui/src/app/services/api/api.fixures.ts index d6728e54c..3577fd80f 100644 --- a/web/projects/ui/src/app/services/api/api.fixures.ts +++ b/web/projects/ui/src/app/services/api/api.fixures.ts @@ -27,16 +27,16 @@ import { unionSelectKey } from '@start9labs/start-sdk/cjs/sdk/lib/config/configT export module Mock { export const ServerUpdated: ServerStatusInfo = { - 'current-backup': null, - 'update-progress': null, + currentBackup: null, + updateProgress: null, updated: true, restarting: false, - 'shutting-down': false, + shuttingDown: false, } export const MarketplaceEos: RR.GetMarketplaceEosRes = { version: '0.3.5.1', headline: 'Our biggest release ever.', - 'release-notes': { + releaseNotes: { '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.3': 'Some **Markdown** release _notes_ for 0.3.4.3', @@ -62,19 +62,19 @@ export module Mock { id: 'bitcoind', title: 'Bitcoin Core', version: '0.21.0', - 'git-hash': 'abcdefgh', + gitHash: 'abcdefgh', description: { short: 'A Bitcoin full node by Bitcoin Core.', long: 'Bitcoin is a decentralized consensus protocol and settlement network.', }, replaces: ['banks', 'governments'], - 'release-notes': 'Taproot, Schnorr, and more.', + releaseNotes: 'Taproot, Schnorr, and more.', license: 'MIT', - 'wrapper-repo': 'https://github.com/start9labs/bitcoind-wrapper', - 'upstream-repo': 'https://github.com/bitcoin/bitcoin', - 'support-site': 'https://bitcoin.org', - 'marketing-site': 'https://bitcoin.org', - 'donation-url': 'https://start9.com', + wrapperRepo: 'https://github.com/start9labs/bitcoind-wrapper', + upstreamRepo: 'https://github.com/bitcoin/bitcoin', + supportSite: 'https://bitcoin.org', + marketingSite: 'https://bitcoin.org', + donationUrl: 'https://start9.com', alerts: { install: 'Bitcoin can take over a week to sync.', uninstall: @@ -83,9 +83,9 @@ export module Mock { start: 'Starting Bitcoin is good for your health.', stop: null, }, - 'os-version': '0.2.12', + osVersion: '0.2.12', dependencies: {}, - 'has-config': true, + hasConfig: true, } export const MockManifestLnd: Manifest = { @@ -96,13 +96,13 @@ export module Mock { short: 'A bolt spec compliant client.', long: 'More info about LND. More info about LND. More info about LND.', }, - 'release-notes': 'Dual funded channels!', + releaseNotes: 'Dual funded channels!', license: 'MIT', - 'wrapper-repo': 'https://github.com/start9labs/lnd-wrapper', - 'upstream-repo': 'https://github.com/lightningnetwork/lnd', - 'support-site': 'https://lightning.engineering/', - 'marketing-site': 'https://lightning.engineering/', - 'donation-url': null, + wrapperRepo: 'https://github.com/start9labs/lnd-wrapper', + upstreamRepo: 'https://github.com/lightningnetwork/lnd', + supportSite: 'https://lightning.engineering/', + marketingSite: 'https://lightning.engineering/', + donationUrl: null, alerts: { install: null, uninstall: null, @@ -111,7 +111,7 @@ export module Mock { start: 'Starting LND is good for your health.', stop: null, }, - 'os-version': '0.2.12', + osVersion: '0.2.12', dependencies: { bitcoind: { description: 'LND needs bitcoin to live.', @@ -123,25 +123,25 @@ export module Mock { optional: true, }, }, - 'has-config': true, + hasConfig: true, } export const MockManifestBitcoinProxy: Manifest = { id: 'btc-rpc-proxy', title: 'Bitcoin Proxy', version: '0.2.2', - 'git-hash': 'lmnopqrx', + gitHash: 'lmnopqrx', description: { short: 'A super charger for your Bitcoin node.', 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', - 'wrapper-repo': 'https://github.com/start9labs/btc-rpc-proxy-wrapper', - 'upstream-repo': 'https://github.com/Kixunil/btc-rpc-proxy', - 'support-site': '', - 'marketing-site': '', - 'donation-url': 'https://start9.com', + wrapperRepo: 'https://github.com/start9labs/btc-rpc-proxy-wrapper', + upstreamRepo: 'https://github.com/Kixunil/btc-rpc-proxy', + supportSite: '', + marketingSite: '', + donationUrl: 'https://start9.com', alerts: { install: 'Testing install alert', uninstall: null, @@ -149,14 +149,14 @@ export module Mock { start: null, stop: null, }, - 'os-version': '0.2.12', + osVersion: '0.2.12', dependencies: { bitcoind: { description: 'Bitcoin Proxy requires a Bitcoin node.', optional: false, }, }, - 'has-config': false, + hasConfig: false, } export const BitcoinDep: DependencyMetadata = { @@ -189,8 +189,8 @@ export module Mock { }, categories: ['bitcoin', 'cryptocurrency', 'featured'], versions: ['0.19.0', '0.20.0', '0.21.0'], - 'dependency-metadata': {}, - 'published-at': new Date().toISOString(), + dependencyMetadata: {}, + publishedAt: new Date().toISOString(), }, '0.20.0': { icon: BTC_ICON, @@ -202,8 +202,8 @@ export module Mock { }, categories: ['bitcoin', 'cryptocurrency'], versions: ['0.19.0', '0.20.0', '0.21.0'], - 'dependency-metadata': {}, - 'published-at': new Date().toISOString(), + dependencyMetadata: {}, + publishedAt: new Date().toISOString(), }, '0.21.0': { icon: BTC_ICON, @@ -212,13 +212,13 @@ export module Mock { manifest: { ...Mock.MockManifestBitcoind, version: '0.21.0', - 'release-notes': + releaseNotes: 'For a complete list of changes, please visit https://bitcoincore.org/en/releases/0.21.0/

  • Taproot!
  • New RPCs
  • Experimental Descriptor Wallets
', }, categories: ['bitcoin', 'cryptocurrency'], versions: ['0.19.0', '0.20.0', '0.21.0'], - 'dependency-metadata': {}, - 'published-at': new Date().toISOString(), + dependencyMetadata: {}, + publishedAt: new Date().toISOString(), }, latest: { icon: BTC_ICON, @@ -227,13 +227,13 @@ export module Mock { screenshots: ['one.png', 'two.png', 'three.png'], manifest: { ...Mock.MockManifestBitcoind, - 'release-notes': + releaseNotes: 'For a complete list of changes, please visit https://bitcoincore.org/en/releases/0.21.0/
Or in [markdown](https://bitcoincore.org/en/releases/0.21.0/)
  • Taproot!
  • New RPCs
  • Experimental Descriptor Wallets
', }, categories: ['bitcoin', 'cryptocurrency'], versions: ['0.19.0', '0.20.0', '0.21.0'], - 'dependency-metadata': {}, - 'published-at': new Date().toISOString(), + dependencyMetadata: {}, + publishedAt: new Date().toISOString(), }, }, lnd: { @@ -244,15 +244,15 @@ export module Mock { manifest: { ...Mock.MockManifestLnd, 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'], versions: ['0.11.0', '0.11.1'], - 'dependency-metadata': { + dependencyMetadata: { bitcoind: BitcoinDep, 'btc-rpc-proxy': ProxyDep, }, - 'published-at': new Date().toISOString(), + publishedAt: new Date().toISOString(), }, '0.11.1': { icon: LND_ICON, @@ -261,15 +261,15 @@ export module Mock { manifest: { ...Mock.MockManifestLnd, 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'], versions: ['0.11.0', '0.11.1'], - 'dependency-metadata': { + dependencyMetadata: { bitcoind: BitcoinDep, 'btc-rpc-proxy': ProxyDep, }, - 'published-at': new Date().toISOString(), + publishedAt: new Date().toISOString(), }, latest: { icon: LND_ICON, @@ -278,11 +278,11 @@ export module Mock { manifest: Mock.MockManifestLnd, categories: ['bitcoin', 'lightning', 'cryptocurrency'], versions: ['0.11.0', '0.11.1'], - 'dependency-metadata': { + dependencyMetadata: { bitcoind: BitcoinDep, 'btc-rpc-proxy': ProxyDep, }, - 'published-at': new Date(new Date().valueOf() + 10).toISOString(), + publishedAt: new Date(new Date().valueOf() + 10).toISOString(), }, }, 'btc-rpc-proxy': { @@ -293,10 +293,10 @@ export module Mock { manifest: Mock.MockManifestBitcoinProxy, categories: ['bitcoin'], versions: ['0.2.2'], - 'dependency-metadata': { + dependencyMetadata: { bitcoind: BitcoinDep, }, - 'published-at': new Date().toISOString(), + publishedAt: new Date().toISOString(), }, }, } @@ -307,8 +307,8 @@ export module Mock { export const Notifications: ServerNotifications = [ { id: 1, - 'package-id': null, - 'created-at': '2019-12-26T14:20:30.872Z', + packageId: null, + createdAt: '2019-12-26T14:20:30.872Z', code: 1, level: NotificationLevel.Success, title: 'Backup Complete', @@ -328,8 +328,8 @@ export module Mock { }, { id: 2, - 'package-id': null, - 'created-at': '2019-12-26T14:20:30.872Z', + packageId: null, + createdAt: '2019-12-26T14:20:30.872Z', code: 2, level: NotificationLevel.Warning, title: 'SSH Key Added', @@ -339,8 +339,8 @@ export module Mock { }, { id: 3, - 'package-id': null, - 'created-at': '2019-12-26T14:20:30.872Z', + packageId: null, + createdAt: '2019-12-26T14:20:30.872Z', code: 3, level: NotificationLevel.Info, title: 'SSH Key Removed', @@ -350,8 +350,8 @@ export module Mock { }, { id: 4, - 'package-id': 'bitcoind', - 'created-at': '2019-12-26T14:20:30.872Z', + packageId: 'bitcoind', + createdAt: '2019-12-26T14:20:30.872Z', code: 4, level: NotificationLevel.Error, title: 'Service Crashed', @@ -377,7 +377,7 @@ export module Mock { }, }, memory: { - 'percentage-used': { + percentageUsed: { value: '30.7', unit: '%', }, @@ -393,29 +393,29 @@ export module Mock { value: '8784.97', unit: 'MiB', }, - 'zram-total': { + zramTotal: { value: '7992.00', unit: 'MiB', }, - 'zram-available': { + zramAvailable: { value: '7882.50', unit: 'MiB', }, - 'zram-used': { + zramUsed: { value: '109.50', unit: 'MiB', }, }, cpu: { - 'percentage-used': { + percentageUsed: { value: '8.4', unit: '%', }, - 'user-space': { + userSpace: { value: '7.0', unit: '%', }, - 'kernel-space': { + kernelSpace: { value: '1.4', unit: '%', }, @@ -441,7 +441,7 @@ export module Mock { value: '992.59', unit: 'GB', }, - 'percentage-used': { + percentageUsed: { value: '46.4', unit: '%', }, @@ -484,22 +484,22 @@ export module Mock { current: 'b7b1a9cef4284f00af9e9dda6e676177', sessions: { c54ddd8107d6d7b9d8aed7: { - 'last-active': '2021-07-14T20:49:17.774Z', - 'user-agent': 'AppleWebKit/{WebKit Rev} (KHTML, like Gecko)', + lastActive: '2021-07-14T20:49:17.774Z', + userAgent: 'AppleWebKit/{WebKit Rev} (KHTML, like Gecko)', metadata: { platforms: ['iphone', 'mobileweb', 'mobile', 'ios'], }, }, klndsfjhbwsajkdnaksj: { - 'last-active': '2019-07-14T20:49:17.774Z', - 'user-agent': 'AppleWebKit/{WebKit Rev} (KHTML, like Gecko)', + lastActive: '2019-07-14T20:49:17.774Z', + userAgent: 'AppleWebKit/{WebKit Rev} (KHTML, like Gecko)', metadata: { platforms: ['cli'], }, }, b7b1a9cef4284f00af9e9dda6e676177: { - 'last-active': '2021-06-14T20:49:17.774Z', - 'user-agent': + lastActive: '2021-06-14T20:49:17.774Z', + userAgent: 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0', metadata: { platforms: ['desktop'], @@ -518,13 +518,13 @@ export module Mock { export const SshKeys: RR.GetSSHKeysRes = [ { - 'created-at': new Date().toISOString(), + createdAt: new Date().toISOString(), alg: 'ed25519', hostname: 'Matt Key', 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', hostname: 'Aiden Key', 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 = { - 'created-at': new Date().toISOString(), + createdAt: new Date().toISOString(), alg: 'ed25519', hostname: 'Lucy Key', 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', country: 'US', - 'available-wifi': [ + availableWifi: [ { ssid: 'Goosers a billion', strength: 40, @@ -566,7 +566,7 @@ export module Mock { } export const BackupTargets: RR.GetBackupTargetsRes = { - 'unknown-disks': [ + unknownDisks: [ { logicalname: 'sbc4', label: 'My Backup Drive', @@ -574,6 +574,7 @@ export module Mock { used: 100000000000, model: 'T7', vendor: 'Samsung', + startOs: null, }, ], saved: [ @@ -585,13 +586,13 @@ export module Mock { path: '/Desktop/embassy-backups', username: 'TestUser', mountable: false, - 'embassy-os': { + startOs: { version: '0.3.0', full: true, - 'password-hash': + passwordHash: // password is asdfasdf '$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', path: '/Home/backups', mountable: true, - 'embassy-os': null, + startOs: null, }, { id: 'csgashbdjkasnd', @@ -611,7 +612,7 @@ export module Mock { path: '/Desktop/embassy-backups-2', username: 'TestUser', mountable: true, - 'embassy-os': null, + startOs: null, }, { id: 'powjefhjbnwhdva', @@ -625,13 +626,13 @@ export module Mock { vendor: 'SSK', mountable: true, path: '/HomeFolder/Documents', - 'embassy-os': { + startOs: { version: '0.3.0', full: true, // password is asdfasdf - 'password-hash': + passwordHash: '$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 = { version: '0.3.0', timestamp: new Date().toISOString(), - 'package-backups': { + packageBackups: { bitcoind: { title: 'Bitcoin Core', version: '0.21.0', - 'os-version': '0.3.0', + osVersion: '0.3.0', timestamp: new Date().toISOString(), }, 'btc-rpc-proxy': { title: 'Bitcoin Proxy', version: '0.2.2', - 'os-version': '0.3.0', + osVersion: '0.3.0', timestamp: new Date().toISOString(), }, }, @@ -1261,12 +1262,12 @@ export module Mock { export const MockDependencyConfig = MockConfig export const bitcoind: PackageDataEntry = { - 'state-info': { + stateInfo: { state: PackageState.Installed, manifest: MockManifestBitcoind, }, icon: '/assets/img/service-icons/bitcoind.svg', - 'last-backup': null, + lastBackup: null, status: { configured: true, main: { @@ -1274,10 +1275,10 @@ export module Mock { started: new Date().toISOString(), health: {}, }, - 'dependency-config-errors': {}, + dependencyConfigErrors: {}, }, actions: {}, // @TODO need mocks - 'service-interfaces': { + serviceInterfaces: { ui: { id: 'ui', hasPrimary: false, @@ -1493,30 +1494,29 @@ export module Mock { }, }, }, - 'current-dependencies': {}, - 'dependency-info': {}, - 'marketplace-url': 'https://registry.start9.com/', - 'developer-key': 'developer-key', - 'has-config': true, + currentDependencies: {}, + dependencyInfo: {}, + marketplaceUrl: 'https://registry.start9.com/', + developerKey: 'developer-key', outboundProxy: null, } export const bitcoinProxy: PackageDataEntry = { - 'state-info': { + stateInfo: { state: PackageState.Installed, manifest: MockManifestBitcoinProxy, }, icon: '/assets/img/service-icons/btc-rpc-proxy.png', - 'last-backup': null, + lastBackup: null, status: { configured: false, main: { status: PackageMainStatus.Stopped, }, - 'dependency-config-errors': {}, + dependencyConfigErrors: {}, }, actions: {}, - 'service-interfaces': { + serviceInterfaces: { ui: { id: 'ui', hasPrimary: false, @@ -1624,42 +1624,41 @@ export module Mock { }, }, }, - 'current-dependencies': { + currentDependencies: { bitcoind: { versionRange: '>=26.0.0', - 'health-checks': [], + healthChecks: [], }, }, - 'dependency-info': { + dependencyInfo: { bitcoind: { title: Mock.MockManifestBitcoind.title, icon: 'assets/img/service-icons/bitcoind.svg', }, }, - 'marketplace-url': 'https://registry.start9.com/', - 'developer-key': 'developer-key', - 'has-config': true, + marketplaceUrl: 'https://registry.start9.com/', + developerKey: 'developer-key', outboundProxy: null, } export const lnd: PackageDataEntry = { - 'state-info': { + stateInfo: { state: PackageState.Installed, manifest: MockManifestLnd, }, icon: '/assets/img/service-icons/lnd.png', - 'last-backup': null, + lastBackup: null, status: { configured: true, main: { status: PackageMainStatus.Stopped, }, - 'dependency-config-errors': { + dependencyConfigErrors: { 'btc-rpc-proxy': 'Username not found', }, }, actions: {}, - 'service-interfaces': { + serviceInterfaces: { grpc: { id: 'grpc', hasPrimary: false, @@ -1871,17 +1870,17 @@ export module Mock { }, }, }, - 'current-dependencies': { + currentDependencies: { bitcoind: { versionRange: '>=26.0.0', - 'health-checks': [], + healthChecks: [], }, 'btc-rpc-proxy': { versionRange: '>2.0.0', // @TODO - 'health-checks': [], + healthChecks: [], }, }, - 'dependency-info': { + dependencyInfo: { bitcoind: { title: Mock.MockManifestBitcoind.title, icon: 'assets/img/service-icons/bitcoind.svg', @@ -1891,9 +1890,8 @@ export module Mock { icon: 'assets/img/service-icons/btc-rpc-proxy.png', }, }, - 'marketplace-url': 'https://registry.start9.com/', - 'developer-key': 'developer-key', - 'has-config': true, + marketplaceUrl: 'https://registry.start9.com/', + developerKey: 'developer-key', outboundProxy: null, } diff --git a/web/projects/ui/src/app/services/api/api.types.ts b/web/projects/ui/src/app/services/api/api.types.ts index 2b143332f..4b7f87156 100644 --- a/web/projects/ui/src/app/services/api/api.types.ts +++ b/web/projects/ui/src/app/services/api/api.types.ts @@ -40,8 +40,8 @@ export module RR { export type LogoutRes = null export type ResetPasswordReq = { - 'old-password': string - 'new-password': string + oldPassword: string + newPassword: string } // auth.reset-password export type ResetPasswordRes = null @@ -68,7 +68,7 @@ export module RR { 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 SetServerClearnetAddressReq = { domainInfo: DomainInfo | null } // server.set-clearnet @@ -84,7 +84,7 @@ export module RR { export type SystemRebuildRes = null export type ResetTorReq = { - 'wipe-state': boolean + wipeState: boolean reason: string } // net.tor.reset export type ResetTorRes = null @@ -186,7 +186,7 @@ export module RR { connected: string | null country: string | null ethernet: boolean - 'available-wifi': AvailableWifi[] + availableWifi: AvailableWifi[] } export type AddWifiReq = { @@ -230,7 +230,7 @@ export module RR { export type GetBackupTargetsReq = {} // backup.target.list export type GetBackupTargetsRes = { - 'unknown-disks': UnknownDisk[] + unknownDisks: UnknownDisk[] saved: BackupTarget[] } @@ -276,9 +276,9 @@ export module RR { export type CreateBackupJobReq = { name: string - 'target-id': string + targetId: string cron: string - 'package-ids': string[] + packageIds: string[] now: boolean } // backup.job.create export type CreateBackupJobRes = BackupJob @@ -297,10 +297,10 @@ export module RR { export type DeleteBackupRunsReq = { ids: string[] } // backup.runs.delete 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 CreateBackupReq = { 'target-id': string; 'package-ids': string[] } // backup.create + export type CreateBackupReq = { targetId: string; packageIds: string[] } // backup.create export type CreateBackupRes = null // package @@ -316,9 +316,9 @@ export module RR { export type InstallPackageReq = { id: string - 'version-spec'?: string - 'version-priority'?: 'min' | 'max' - 'marketplace-url': string + versionSpec?: string + versionPriority?: 'min' | 'max' + marketplaceUrl: string } // package.install export type InstallPackageRes = null @@ -334,14 +334,15 @@ export module RR { export type RestorePackagesReq = { // package.backup.restore ids: string[] - 'target-id': string + targetId: string + oldPassword: string | null password: string } export type RestorePackagesRes = null export type ExecutePackageActionReq = { id: string - 'action-id': string + actionId: string input?: object } // package.action export type ExecutePackageActionRes = ActionResponse @@ -359,12 +360,12 @@ export module RR { export type UninstallPackageRes = null export type DryConfigureDependencyReq = { - 'dependency-id': string - 'dependent-id': string + dependencyId: string + dependentId: string } // package.dependency.configure.dry export type DryConfigureDependencyRes = { - 'old-config': object - 'new-config': object + oldConfig: object + newConfig: object spec: InputSpec } @@ -389,10 +390,10 @@ export module RR { // marketplace - export type GetMarketplaceInfoReq = { 'server-id': string } + export type GetMarketplaceInfoReq = { serverId: string } export type GetMarketplaceInfoRes = StoreInfo - export type GetMarketplaceEosReq = { 'server-id': string } + export type GetMarketplaceEosReq = { serverId: string } export type GetMarketplaceEosRes = MarketplaceEOS export type GetMarketplacePackagesReq = { @@ -401,7 +402,7 @@ export module RR { category?: string query?: string page?: number - 'per-page'?: number + perPage?: number } export type GetMarketplacePackagesRes = MarketplacePkg[] @@ -412,7 +413,7 @@ export module RR { export interface MarketplaceEOS { version: string headline: string - 'release-notes': { [version: string]: string } + releaseNotes: { [version: string]: string } } export interface Breakages { @@ -442,31 +443,31 @@ export interface Metrics { } memory: { total: MetricData - 'percentage-used': MetricData + percentageUsed: MetricData used: MetricData available: MetricData - 'zram-total': MetricData - 'zram-used': MetricData - 'zram-available': MetricData + zramTotal: MetricData + zramUsed: MetricData + zramAvailable: MetricData } cpu: { - 'percentage-used': MetricData + percentageUsed: MetricData idle: MetricData - 'user-space': MetricData - 'kernel-space': MetricData + userSpace: MetricData + kernelSpace: MetricData wait: MetricData } disk: { capacity: MetricData - 'percentage-used': MetricData + percentageUsed: MetricData used: MetricData available: MetricData } } export interface Session { - 'last-active': string - 'user-agent': string + lastActive: string + userAgent: string metadata: SessionMetadata } @@ -503,6 +504,7 @@ export interface UnknownDisk { label: string | null capacity: number used: number | null + startOs: StartOSDiskInfo | null } export interface BaseBackupTarget { @@ -511,7 +513,7 @@ export interface BaseBackupTarget { name: string mountable: boolean path: string - 'embassy-os': StartOSDiskInfo | null + startOs: StartOSDiskInfo | null } export interface DiskBackupTarget extends UnknownDisk, BaseBackupTarget { @@ -543,13 +545,13 @@ export interface BackupJob { name: string target: BackupTarget cron: string // '* * * * * *' https://cloud.google.com/scheduler/docs/configuring/cron-job-schedules - 'package-ids': string[] + packageIds: string[] } export interface BackupInfo { version: string timestamp: string - 'package-backups': { + packageBackups: { [id: string]: PackageBackupInfo } } @@ -557,7 +559,7 @@ export interface BackupInfo { export interface PackageBackupInfo { title: string version: string - 'os-version': string + osVersion: string timestamp: string } @@ -566,7 +568,7 @@ export interface ServerSpecs { } export interface SSHKey { - 'created-at': string + createdAt: string alg: string hostname: string fingerprint: string @@ -576,8 +578,8 @@ export type ServerNotifications = ServerNotification[] export interface ServerNotification { id: number - 'package-id': string | null - 'created-at': string + packageId: string | null + createdAt: string code: T level: NotificationLevel title: string @@ -596,8 +598,8 @@ export enum NotificationLevel { export type NotificationData = T extends 0 ? null : T extends 1 - ? BackupReport - : any + ? BackupReport + : any export interface BackupReport { server: { diff --git a/web/projects/ui/src/app/services/api/embassy-live-api.service.ts b/web/projects/ui/src/app/services/api/embassy-live-api.service.ts index 08b5784f8..ca777fb47 100644 --- a/web/projects/ui/src/app/services/api/embassy-live-api.service.ts +++ b/web/projects/ui/src/app/services/api/embassy-live-api.service.ts @@ -175,7 +175,7 @@ export class LiveApiService extends ApiService { async updateServer(url?: string): Promise { const params = { - 'marketplace-url': url || this.config.marketplace.start9, + marketplaceUrl: url || this.config.marketplace.start9, } return this.rpcRequest({ method: 'server.update', params }) } @@ -234,7 +234,7 @@ export class LiveApiService extends ApiService { async getEos(): Promise { const { id } = await getServerInfo(this.patch) - const qp: RR.GetMarketplaceEosReq = { 'server-id': id } + const qp: RR.GetMarketplaceEosReq = { serverId: id } return this.marketplaceProxy( '/eos/v0/latest', diff --git a/web/projects/ui/src/app/services/api/embassy-mock-api.service.ts b/web/projects/ui/src/app/services/api/embassy-mock-api.service.ts index 5d0f25e73..114cca97f 100644 --- a/web/projects/ui/src/app/services/api/embassy-mock-api.service.ts +++ b/web/projects/ui/src/app/services/api/embassy-mock-api.service.ts @@ -232,8 +232,8 @@ export class MockApiService extends ApiService { return { entries, - 'start-cursor': 'startCursor', - 'end-cursor': 'endCursor', + startCursor: 'start-cursor', + endCursor: 'end-cursor', } } @@ -245,8 +245,8 @@ export class MockApiService extends ApiService { return { entries, - 'start-cursor': 'startCursor', - 'end-cursor': 'endCursor', + startCursor: 'start-cursor', + endCursor: 'end-cursor', } } @@ -256,8 +256,8 @@ export class MockApiService extends ApiService { return { entries, - 'start-cursor': 'startCursor', - 'end-cursor': 'endCursor', + startCursor: 'startCursor', + endCursor: 'end-cursor', } } @@ -266,7 +266,7 @@ export class MockApiService extends ApiService { ): Promise { await pauseFor(2000) return { - 'start-cursor': 'start-cursor', + startCursor: 'start-cursor', guid: '7251d5be-645f-4362-a51b-3a85be92b31e', } } @@ -276,7 +276,7 @@ export class MockApiService extends ApiService { ): Promise { await pauseFor(2000) return { - 'start-cursor': 'start-cursor', + startCursor: 'start-cursor', guid: '7251d5be-645f-4362-a51b-3a85be92b31e', } } @@ -286,7 +286,7 @@ export class MockApiService extends ApiService { ): Promise { await pauseFor(2000) return { - 'start-cursor': 'start-cursor', + startCursor: 'start-cursor', guid: '7251d5be-645f-4362-a51b-3a85be92b31e', } } @@ -324,7 +324,7 @@ export class MockApiService extends ApiService { const patch = [ { op: PatchOp.REPLACE, - path: '/server-info/status-info/update-progress', + path: '/serverInfo/statusInfo/updateProgress', value: initialProgress, }, ] @@ -358,7 +358,7 @@ export class MockApiService extends ApiService { const patch = [ { op: PatchOp.REPLACE, - path: '/server-info/status-info/restarting', + path: '/serverInfo/statusInfo/restarting', value: true, }, ] @@ -368,7 +368,7 @@ export class MockApiService extends ApiService { const patch2 = [ { op: PatchOp.REPLACE, - path: '/server-info/status-info/restarting', + path: '/serverInfo/statusInfo/restarting', value: false, }, ] @@ -386,7 +386,7 @@ export class MockApiService extends ApiService { const patch = [ { op: PatchOp.REPLACE, - path: '/server-info/status-info/shutting-down', + path: '/serverInfo/statusInfo/shuttingDown', value: true, }, ] @@ -396,7 +396,7 @@ export class MockApiService extends ApiService { const patch2 = [ { op: PatchOp.REPLACE, - path: '/server-info/status-info/shutting-down', + path: '/serverInfo/statusInfo/shuttingDown', value: false, }, ] @@ -781,7 +781,7 @@ export class MockApiService extends ApiService { path: path.replace(/\\/g, '/'), username: 'mockusername', mountable: true, - 'embassy-os': null, + startOs: null, } } @@ -816,7 +816,7 @@ export class MockApiService extends ApiService { name: params.name, target: Mock.BackupTargets.saved[0], 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 { await pauseFor(2000) - const path = '/server-info/status-info/backup-progress' - const ids = params['package-ids'] + const path = '/serverInfo/statusInfo/backupProgress' + const ids = params.packageIds setTimeout(async () => { for (let i = 0; i < ids.length; i++) { const id = ids[i] - const appPath = `/package-data/${id}/status/main/status` + const appPath = `/packageData/${id}/status/main/status` const appPatch = [ { op: PatchOp.REPLACE, @@ -952,8 +952,8 @@ export class MockApiService extends ApiService { } return { entries, - 'start-cursor': 'startCursor', - 'end-cursor': 'endCursor', + startCursor: 'startCursor', + endCursor: 'end-cursor', } } @@ -962,7 +962,7 @@ export class MockApiService extends ApiService { ): Promise { await pauseFor(2000) return { - 'start-cursor': 'start-cursor', + startCursor: 'start-cursor', guid: '7251d5be-645f-4362-a51b-3a85be92b31e', } } @@ -976,17 +976,17 @@ export class MockApiService extends ApiService { this.updateProgress(params.id) }, 1000) - const manifest = Mock.LocalPkgs[params.id]['state-info'].manifest + const manifest = Mock.LocalPkgs[params.id].stateInfo.manifest const patch: Operation< PackageDataEntry >[] = [ { op: PatchOp.ADD, - path: `/package-data/${params.id}`, + path: `/packageData/${params.id}`, value: { ...Mock.LocalPkgs[params.id], - 'state-info': { + stateInfo: { // if installing state: PackageState.Installing, @@ -995,8 +995,8 @@ export class MockApiService extends ApiService { // manifest, // both - 'installing-info': { - 'new-manifest': manifest, + installingInfo: { + newManifest: manifest, progress: PROGRESS, }, }, @@ -1032,7 +1032,7 @@ export class MockApiService extends ApiService { const patch = [ { op: PatchOp.REPLACE, - path: `/package-data/${params.id}/status/configured`, + path: `/packageData/${params.id}/status/configured`, value: true, }, ] @@ -1052,13 +1052,13 @@ export class MockApiService extends ApiService { return { op: PatchOp.ADD, - path: `/package-data/${id}`, + path: `/packageData/${id}`, value: { ...Mock.LocalPkgs[id], - 'state-info': { + stateInfo: { state: PackageState.Restoring, - 'installing-info': { - 'new-manifest': Mock.LocalPkgs[id]['state-info'].manifest!, + installingInfo: { + newManifest: Mock.LocalPkgs[id].stateInfo.manifest!, progress: PROGRESS, }, }, @@ -1079,7 +1079,7 @@ export class MockApiService extends ApiService { } async startPackage(params: RR.StartPackageReq): Promise { - const path = `/package-data/${params.id}/status/main` + const path = `/packageData/${params.id}/status/main` await pauseFor(2000) @@ -1128,7 +1128,7 @@ export class MockApiService extends ApiService { ): Promise { // first enact stop await pauseFor(2000) - const path = `/package-data/${params.id}/status/main` + const path = `/packageData/${params.id}/status/main` setTimeout(async () => { const patch2: Operation[] = [ @@ -1204,7 +1204,7 @@ export class MockApiService extends ApiService { async stopPackage(params: RR.StopPackageReq): Promise { await pauseFor(2000) - const path = `/package-data/${params.id}/status/main` + const path = `/packageData/${params.id}/status/main` setTimeout(() => { const patch2 = [ @@ -1244,7 +1244,7 @@ export class MockApiService extends ApiService { const patch2: RemoveOperation[] = [ { op: PatchOp.REMOVE, - path: `/package-data/${params.id}`, + path: `/packageData/${params.id}`, }, ] this.mockRevision(patch2) @@ -1253,7 +1253,7 @@ export class MockApiService extends ApiService { const patch = [ { op: PatchOp.REPLACE, - path: `/package-data/${params.id}/state-info/state`, + path: `/packageData/${params.id}/stateInfo/state`, value: PackageState.Removing, }, ] @@ -1268,8 +1268,8 @@ export class MockApiService extends ApiService { ): Promise { await pauseFor(2000) return { - 'old-config': Mock.MockConfig, - 'new-config': Mock.MockDependencyConfig, + oldConfig: Mock.MockConfig, + newConfig: Mock.MockDependencyConfig, spec: await Mock.getInputSpec(), } } @@ -1327,7 +1327,7 @@ export class MockApiService extends ApiService { const patches: Operation[] = [ { 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, }, ] @@ -1340,7 +1340,7 @@ export class MockApiService extends ApiService { patches.push({ 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, }) } @@ -1357,7 +1357,7 @@ export class MockApiService extends ApiService { const patches: Operation[] = [ { 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, }, ] @@ -1370,7 +1370,7 @@ export class MockApiService extends ApiService { patches.push({ 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, }) } @@ -1382,7 +1382,7 @@ export class MockApiService extends ApiService { this.mockRevision([ { 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, }, ]) @@ -1395,7 +1395,7 @@ export class MockApiService extends ApiService { this.mockRevision([ { op: PatchOp.REPLACE, - path: `/package-data/${id}/state-info/installing-info/progress/overall`, + path: `/packageData/${id}/stateInfo/installingInfo/progress/overall`, value: true, }, ]) @@ -1404,10 +1404,10 @@ export class MockApiService extends ApiService { const patch2: Operation[] = [ { op: PatchOp.REPLACE, - path: `/package-data/${id}/state-info`, + path: `/packageData/${id}/stateInfo`, value: { 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 = [ { op: PatchOp.REPLACE, - path: `/server-info/status-info/update-progress/size`, + path: `/serverInfo/statusInfo/updateProgress/size`, value: size, }, ] @@ -1433,7 +1433,7 @@ export class MockApiService extends ApiService { const patch = [ { op: PatchOp.REPLACE, - path: `/server-info/status-info/update-progress/downloaded`, + path: `/serverInfo/statusInfo/updateProgress/downloaded`, value: downloaded, }, ] @@ -1443,7 +1443,7 @@ export class MockApiService extends ApiService { const patch2 = [ { op: PatchOp.REPLACE, - path: `/server-info/status-info/update-progress/downloaded`, + path: `/serverInfo/statusInfo/updateProgress/downloaded`, value: size, }, ] @@ -1453,12 +1453,12 @@ export class MockApiService extends ApiService { const patch3: Operation[] = [ { op: PatchOp.REPLACE, - path: '/server-info/status-info/updated', + path: '/serverInfo/statusInfo/updated', value: true, }, { op: PatchOp.REMOVE, - path: '/server-info/status-info/update-progress', + path: '/serverInfo/statusInfo/updateProgress', }, ] this.mockRevision(patch3) @@ -1467,7 +1467,7 @@ export class MockApiService extends ApiService { const patch6 = [ { op: PatchOp.REPLACE, - path: '/server-info/status-info', + path: '/serverInfo/statusInfo', value: Mock.ServerUpdated, }, ] diff --git a/web/projects/ui/src/app/services/api/mock-patch.ts b/web/projects/ui/src/app/services/api/mock-patch.ts index 17fe73c4f..12d319509 100644 --- a/web/projects/ui/src/app/services/api/mock-patch.ts +++ b/web/projects/ui/src/app/services/api/mock-patch.ts @@ -9,13 +9,13 @@ import { Mock } from './api.fixures' export const mockPatchData: DataModel = { ui: { name: `Matt's Server`, - 'ack-welcome': '1.0.0', + ackWelcome: '1.0.0', theme: 'Dark', desktop: ['lnd'], widgets: [], marketplace: { - 'selected-url': 'https://registry.start9.com/', - 'known-hosts': { + selectedUrl: 'https://registry.start9.com/', + knownHosts: { 'https://registry.start9.com/': { name: 'Start9 Registry', }, @@ -27,12 +27,12 @@ export const mockPatchData: DataModel = { }, gaming: { snake: { - 'high-score': 0, + highScore: 0, }, }, - 'ack-instructions': {}, + ackInstructions: {}, }, - 'server-info': { + serverInfo: { id: 'abcdefgh', version: '0.3.5.1', country: 'us', @@ -116,22 +116,22 @@ export const mockPatchData: DataModel = { }, outboundProxy: null, }, - 'last-backup': new Date(new Date().valueOf() - 604800001).toISOString(), + lastBackup: new Date(new Date().valueOf() - 604800001).toISOString(), unreadNotifications: { count: 4, recent: Mock.Notifications, }, - 'eos-version-compat': '>=0.3.0 <=0.3.0.1', - 'status-info': { - 'current-backup': null, + eosVersionCompat: '>=0.3.0 <=0.3.0.1', + statusInfo: { + currentBackup: null, updated: false, - 'update-progress': null, + updateProgress: null, restarting: false, - 'shutting-down': false, + shuttingDown: false, }, pubkey: 'npub1sg6plzptd64u62a878hep2kev88swjh3tw00gjsfl8f237lmu63q0uf63m', - 'ca-fingerprint': 'SHA-256: 63 2B 11 99 44 40 17 DF 37 FC C3 DF 0F 3D 15', - 'ntp-synced': false, + caFingerprint: 'SHA-256: 63 2B 11 99 44 40 17 DF 37 FC C3 DF 0F 3D 15', + ntpSynced: false, smtp: { server: '', port: 587, @@ -139,13 +139,13 @@ export const mockPatchData: DataModel = { login: '', password: '', }, - 'password-hash': + passwordHash: '$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ', platform: 'x86_64-nonfree', }, - 'package-data': { + packageData: { bitcoind: { - 'state-info': { + stateInfo: { state: PackageState.Installed, manifest: { ...Mock.MockManifestBitcoind, @@ -153,7 +153,7 @@ export const mockPatchData: DataModel = { }, }, icon: '/assets/img/service-icons/bitcoind.svg', - 'last-backup': null, + lastBackup: null, status: { configured: true, main: { @@ -185,10 +185,10 @@ export const mockPatchData: DataModel = { }, }, }, - 'dependency-config-errors': {}, + dependencyConfigErrors: {}, }, actions: {}, // @TODO - 'service-interfaces': { + serviceInterfaces: { ui: { id: 'ui', hasPrimary: false, @@ -404,15 +404,14 @@ export const mockPatchData: DataModel = { }, }, }, - 'current-dependencies': {}, - 'dependency-info': {}, - 'marketplace-url': 'https://registry.start9.com/', - 'developer-key': 'developer-key', - 'has-config': true, + currentDependencies: {}, + dependencyInfo: {}, + marketplaceUrl: 'https://registry.start9.com/', + developerKey: 'developer-key', outboundProxy: null, }, lnd: { - 'state-info': { + stateInfo: { state: PackageState.Installed, manifest: { ...Mock.MockManifestLnd, @@ -420,18 +419,18 @@ export const mockPatchData: DataModel = { }, }, icon: '/assets/img/service-icons/lnd.png', - 'last-backup': null, + lastBackup: null, status: { configured: true, main: { status: PackageMainStatus.Stopped, }, - 'dependency-config-errors': { + dependencyConfigErrors: { 'btc-rpc-proxy': 'This is a config unsatisfied error', }, }, actions: {}, - 'service-interfaces': { + serviceInterfaces: { grpc: { id: 'grpc', hasPrimary: false, @@ -641,17 +640,17 @@ export const mockPatchData: DataModel = { }, }, }, - 'current-dependencies': { + currentDependencies: { bitcoind: { versionRange: '>=26.0.0', - 'health-checks': [], + healthChecks: [], }, 'btc-rpc-proxy': { versionRange: '>2.0.0', - 'health-checks': [], + healthChecks: [], }, }, - 'dependency-info': { + dependencyInfo: { bitcoind: { title: 'Bitcoin Core', icon: 'assets/img/service-icons/bitcoind.svg', @@ -661,9 +660,8 @@ export const mockPatchData: DataModel = { icon: 'assets/img/service-icons/btc-rpc-proxy.png', }, }, - 'marketplace-url': 'https://registry.start9.com/', - 'developer-key': 'developer-key', - 'has-config': true, + marketplaceUrl: 'https://registry.start9.com/', + developerKey: 'developer-key', outboundProxy: null, }, }, diff --git a/web/projects/ui/src/app/services/config.service.ts b/web/projects/ui/src/app/services/config.service.ts index 37ac933e2..9a0512567 100644 --- a/web/projects/ui/src/app/services/config.service.ts +++ b/web/projects/ui/src/app/services/config.service.ts @@ -87,9 +87,7 @@ export class ConfigService { } /** ${scheme}://${username}@${host}:${externalPort}${suffix} */ - launchableAddress( - interfaces: PackageDataEntry['service-interfaces'], - ): string { + launchableAddress(interfaces: PackageDataEntry['serviceInterfaces']): string { const ui = Object.values(interfaces).find(i => i.type === 'ui') if (!ui) return '' @@ -168,7 +166,7 @@ export function removePort(str: string): string { } export function hasUi( - interfaces: PackageDataEntry['service-interfaces'], + interfaces: PackageDataEntry['serviceInterfaces'], ): boolean { return Object.values(interfaces).some(iface => iface.type === 'ui') } diff --git a/web/projects/ui/src/app/services/dep-error.service.ts b/web/projects/ui/src/app/services/dep-error.service.ts index 7206c070e..90a168587 100644 --- a/web/projects/ui/src/app/services/dep-error.service.ts +++ b/web/projects/ui/src/app/services/dep-error.service.ts @@ -22,7 +22,7 @@ export type PkgDependencyErrors = Record }) export class DepErrorService { readonly depErrors$: Observable = this.patch - .watch$('package-data') + .watch$('packageData') .pipe( map(pkgs => Object.keys(pkgs) @@ -56,7 +56,7 @@ export class DepErrorService { } private getDepErrors( - pkgs: DataModel['package-data'], + pkgs: DataModel['packageData'], pkgId: string, outerErrors: AllDependencyErrors, ): PkgDependencyErrors { @@ -74,7 +74,7 @@ export class DepErrorService { } private getDepError( - pkgs: DataModel['package-data'], + pkgs: DataModel['packageData'], pkg: PackageDataEntry, depId: string, outerErrors: AllDependencyErrors, @@ -82,14 +82,14 @@ export class DepErrorService { const dep = pkgs[depId] // not installed - if (!dep || dep['state-info'].state !== PackageState.Installed) { + if (!dep || dep.stateInfo.state !== PackageState.Installed) { return { type: DependencyErrorType.NotInstalled, } } - const versionRange = pkg['current-dependencies'][depId].versionRange - const depManifest = dep['state-info'].manifest + const versionRange = pkg.currentDependencies[depId].versionRange + const depManifest = dep.stateInfo.manifest // incorrect version if (!this.emver.satisfies(depManifest.version, versionRange)) { @@ -101,9 +101,7 @@ export class DepErrorService { } // invalid config - if ( - Object.values(pkg.status['dependency-config-errors']).some(err => !!err) - ) { + if (Object.values(pkg.status.dependencyConfigErrors).some(err => !!err)) { return { type: DependencyErrorType.ConfigUnsatisfied, } @@ -123,7 +121,7 @@ export class DepErrorService { // health check failure 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) { return { type: DependencyErrorType.HealthChecksFailed, @@ -147,14 +145,14 @@ export class DepErrorService { } } -function currentDeps(pkgs: DataModel['package-data'], id: string): string[] { - return Object.keys(pkgs[id]?.['current-dependencies'] || {}).filter( +function currentDeps(pkgs: DataModel['packageData'], id: string): string[] { + return Object.keys(pkgs[id]?.currentDependencies || {}).filter( depId => depId !== id, ) } function dependencyDepth( - pkgs: DataModel['package-data'], + pkgs: DataModel['packageData'], id: string, depth = 0, ): number { diff --git a/web/projects/ui/src/app/services/eos.service.ts b/web/projects/ui/src/app/services/eos.service.ts index 10c31ab2d..04a5f8ad4 100644 --- a/web/projects/ui/src/app/services/eos.service.ts +++ b/web/projects/ui/src/app/services/eos.service.ts @@ -14,13 +14,13 @@ export class EOSService { eos?: MarketplaceEOS updateAvailable$ = new BehaviorSubject(false) - readonly updating$ = this.patch.watch$('server-info', 'status-info').pipe( - map(status => !!status['update-progress'] || status.updated), + readonly updating$ = this.patch.watch$('serverInfo', 'statusInfo').pipe( + map(status => !!status.updateProgress || status.updated), distinctUntilChanged(), ) readonly backingUp$ = this.patch - .watch$('server-info', 'status-info', 'current-backup') + .watch$('serverInfo', 'statusInfo', 'currentBackup') .pipe( map(obj => !!obj), distinctUntilChanged(), diff --git a/web/projects/ui/src/app/services/marketplace.service.ts b/web/projects/ui/src/app/services/marketplace.service.ts index 8a5f4c74e..3281bfab9 100644 --- a/web/projects/ui/src/app/services/marketplace.service.ts +++ b/web/projects/ui/src/app/services/marketplace.service.ts @@ -38,7 +38,7 @@ import { ClientStorageService } from './client-storage.service' @Injectable() export class MarketplaceService implements AbstractMarketplaceService { private readonly knownHosts$: Observable = this.patch - .watch$('ui', 'marketplace', 'known-hosts') + .watch$('ui', 'marketplace', 'knownHosts') .pipe( map(hosts => { const { start9, community } = this.config.marketplace @@ -72,8 +72,8 @@ export class MarketplaceService implements AbstractMarketplaceService { private readonly selectedHost$: Observable = this.patch .watch$('ui', 'marketplace') .pipe( - distinctUntilKeyChanged('selected-url'), - map(({ 'selected-url': url, 'known-hosts': hosts }) => + distinctUntilKeyChanged('selectedUrl'), + map(({ selectedUrl: url, knownHosts: hosts }) => toStoreIdentity(url, hosts[url]), ), shareReplay({ bufferSize: 1, refCount: true }), @@ -196,9 +196,9 @@ export class MarketplaceService implements AbstractMarketplaceService { ): Observable { return this.patch.watch$('ui', 'marketplace').pipe( 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) } @@ -231,18 +231,18 @@ export class MarketplaceService implements AbstractMarketplaceService { ): Promise { const params: RR.InstallPackageReq = { id, - 'version-spec': `=${version}`, - 'marketplace-url': url, + versionSpec: `=${version}`, + marketplaceUrl: url, } await this.api.installPackage(params) } fetchInfo$(url: string): Observable { - return this.patch.watch$('server-info').pipe( + return this.patch.watch$('serverInfo').pipe( take(1), switchMap(serverInfo => { - const qp: RR.GetMarketplaceInfoReq = { 'server-id': serverInfo.id } + const qp: RR.GetMarketplaceInfoReq = { serverId: serverInfo.id } return this.api.marketplaceProxy( '/package/v0/info', qp, @@ -301,7 +301,7 @@ export class MarketplaceService implements AbstractMarketplaceService { const qp: RR.GetMarketplacePackagesReq = { ...params, page: 1, - 'per-page': 100, + perPage: 100, } if (qp.ids) qp.ids = JSON.stringify(qp.ids) @@ -331,7 +331,7 @@ export class MarketplaceService implements AbstractMarketplaceService { ): Promise { if (oldName !== newName) { this.api.setDbValue( - ['marketplace', 'known-hosts', url, 'name'], + ['marketplace', 'knownHosts', url, 'name'], newName, ) } diff --git a/web/projects/ui/src/app/services/patch-data.service.ts b/web/projects/ui/src/app/services/patch-data.service.ts index 4eb2e166d..a314f84cd 100644 --- a/web/projects/ui/src/app/services/patch-data.service.ts +++ b/web/projects/ui/src/app/services/patch-data.service.ts @@ -25,7 +25,7 @@ export class PatchDataService extends Observable { // check for updates to eOS and services this.checkForUpdates() // show eos welcome message - this.showEosWelcome(ui['ack-welcome']) + this.showEosWelcome(ui.ackWelcome) }), share(), ) @@ -60,7 +60,7 @@ export class PatchDataService extends Observable { .subscribe({ complete: () => { this.embassyApi - .setDbValue(['ack-welcome'], this.config.version) + .setDbValue(['ackWelcome'], this.config.version) .catch() }, }) diff --git a/web/projects/ui/src/app/services/patch-db/data-model.ts b/web/projects/ui/src/app/services/patch-db/data-model.ts index b171de7e9..5cda874ee 100644 --- a/web/projects/ui/src/app/services/patch-db/data-model.ts +++ b/web/projects/ui/src/app/services/patch-db/data-model.ts @@ -2,30 +2,30 @@ import { BackupJob, ServerNotifications } from '../api/api.types' import { Url } from '@start9labs/shared' import { Manifest } from '@start9labs/marketplace' import { types } from '@start9labs/start-sdk' -import { InputSpec } from '@start9labs/start-sdk/cjs/sdk/lib/config/configTypes' import { ActionMetadata, HostnameInfo, } from '@start9labs/start-sdk/cjs/sdk/lib/types' import { customSmtp } from '@start9labs/start-sdk/cjs/sdk/lib/config/configConstants' + type ServiceInterfaceWithHostInfo = types.ServiceInterfaceWithHostInfo export interface DataModel { - 'server-info': ServerInfo - 'package-data': { [id: string]: PackageDataEntry } + serverInfo: ServerInfo + packageData: { [id: string]: PackageDataEntry } ui: UIData } export interface UIData { name: string | null - 'ack-welcome': string // emver + ackWelcome: string // emver marketplace: UIMarketplaceData gaming: { snake: { - 'high-score': number + highScore: number } } - 'ack-instructions': Record + ackInstructions: Record theme: string widgets: readonly Widget[] desktop: readonly string[] @@ -45,8 +45,8 @@ export interface Widget { } export interface UIMarketplaceData { - 'selected-url': string - 'known-hosts': { + selectedUrl: string + knownHosts: { 'https://registry.start9.com/': UIStore 'https://community-registry.start9.com/': UIStore [url: string]: UIStore @@ -63,18 +63,18 @@ export interface ServerInfo { country: string ui: HostnameInfo[] network: NetworkInfo - 'last-backup': string | null + lastBackup: string | null unreadNotifications: { count: number recent: ServerNotifications } - 'status-info': ServerStatusInfo - 'eos-version-compat': string + statusInfo: ServerStatusInfo + eosVersionCompat: string pubkey: string - 'ca-fingerprint': string - 'ntp-synced': boolean + caFingerprint: string + ntpSynced: boolean smtp: typeof customSmtp.validator._TYPE - 'password-hash': string + passwordHash: string platform: string } @@ -154,18 +154,14 @@ export interface IpInfo { } export interface ServerStatusInfo { - 'current-backup': null | { + currentBackup: null | { job: BackupJob - 'backup-progress': { - [packageId: string]: { - complete: boolean - } - } + backupProgress: Record } updated: boolean - 'update-progress': { size: number | null; downloaded: number } | null + updateProgress: { size: number | null; downloaded: number } | null restarting: boolean - 'shutting-down': boolean + shuttingDown: boolean } export enum ServerStatus { @@ -175,22 +171,21 @@ export enum ServerStatus { } export type PackageDataEntry = { - 'state-info': T + stateInfo: T icon: Url status: Status actions: Record - 'last-backup': string | null - 'current-dependencies': { [id: string]: CurrentDependencyInfo } - 'dependency-info': { + lastBackup: string | null + currentDependencies: { [id: string]: CurrentDependencyInfo } + dependencyInfo: { [id: string]: { title: string icon: Url } } - 'service-interfaces': Record - 'marketplace-url': string | null - 'developer-key': string - 'has-config': boolean + serviceInterfaces: Record + marketplaceUrl: string | null + developerKey: string outboundProxy: ServiceOutboundProxy } @@ -203,12 +198,12 @@ export type InstalledState = { export type InstallingState = { state: PackageState.Installing | PackageState.Restoring - 'installing-info': InstallingInfo + installingInfo: InstallingInfo } export type UpdatingState = { state: PackageState.Updating - 'installing-info': InstallingInfo + installingInfo: InstallingInfo manifest: Manifest } @@ -222,13 +217,13 @@ export enum PackageState { export interface CurrentDependencyInfo { versionRange: string - 'health-checks': string[] // array of health check IDs + healthChecks: string[] // array of health check IDs } export interface Status { configured: boolean main: MainStatus - 'dependency-config-errors': { [id: string]: string | null } + dependencyConfigErrors: { [id: string]: string | null } } export type MainStatus = @@ -322,7 +317,7 @@ export interface HealthCheckResultFailure { export type InstallingInfo = { progress: FullProgress - 'new-manifest': Manifest + newManifest: Manifest } export type FullProgress = { diff --git a/web/projects/ui/src/app/services/pkg-status-rendering.service.ts b/web/projects/ui/src/app/services/pkg-status-rendering.service.ts index a32c800c1..5c7aa3b48 100644 --- a/web/projects/ui/src/app/services/pkg-status-rendering.service.ts +++ b/web/projects/ui/src/app/services/pkg-status-rendering.service.ts @@ -20,12 +20,12 @@ export function renderPkgStatus( let dependency: DependencyStatus | null = null let health: HealthStatus | null = null - if (pkg['state-info'].state === PackageState.Installed) { + if (pkg.stateInfo.state === PackageState.Installed) { primary = getPrimaryStatus(pkg.status) dependency = getDependencyStatus(depErrors) health = getHealthStatus(pkg.status) } else { - primary = pkg['state-info'].state as string as PrimaryStatus + primary = pkg.stateInfo.state as string as PrimaryStatus } return { primary, dependency, health } diff --git a/web/projects/ui/src/app/services/time-service.ts b/web/projects/ui/src/app/services/time-service.ts index 641144dae..3b58da744 100644 --- a/web/projects/ui/src/app/services/time-service.ts +++ b/web/projects/ui/src/app/services/time-service.ts @@ -32,7 +32,7 @@ export class TimeService { readonly now$ = combineLatest([ this.time$, - this.patch.watch$('server-info', 'ntp-synced'), + this.patch.watch$('serverInfo', 'ntpSynced'), ]).pipe( map(([time, synced]) => ({ value: time.now, diff --git a/web/projects/ui/src/app/util/dry-update.ts b/web/projects/ui/src/app/util/dry-update.ts index 36d220327..472a48389 100644 --- a/web/projects/ui/src/app/util/dry-update.ts +++ b/web/projects/ui/src/app/util/dry-update.ts @@ -4,16 +4,16 @@ import { getManifest } from './get-package-data' export function dryUpdate( { id, version }: { id: string; version: string }, - pkgs: DataModel['package-data'], + pkgs: DataModel['packageData'], emver: Emver, ): string[] { return Object.values(pkgs) .filter( pkg => - Object.keys(pkg['current-dependencies'] || {}).some( + Object.keys(pkg.currentDependencies || {}).some( pkgId => pkgId === id, ) && - !emver.satisfies(version, pkg['current-dependencies'][id].versionRange), + !emver.satisfies(version, pkg.currentDependencies[id].versionRange), ) .map(pkg => getManifest(pkg).title) } diff --git a/web/projects/ui/src/app/util/get-package-data.ts b/web/projects/ui/src/app/util/get-package-data.ts index 79834bbe7..244324501 100644 --- a/web/projects/ui/src/app/util/get-package-data.ts +++ b/web/projects/ui/src/app/util/get-package-data.ts @@ -14,49 +14,47 @@ export async function getPackage( patch: PatchDB, id: string, ): Promise { - return firstValueFrom(patch.watch$('package-data', id)) + return firstValueFrom(patch.watch$('packageData', id)) } export async function getAllPackages( patch: PatchDB, -): Promise { - return firstValueFrom(patch.watch$('package-data')) +): Promise { + return firstValueFrom(patch.watch$('packageData')) } export function getManifest(pkg: PackageDataEntry): Manifest { - if (isInstalled(pkg) || isRemoving(pkg)) return pkg['state-info'].manifest + if (isInstalled(pkg) || isRemoving(pkg)) return pkg.stateInfo.manifest - return (pkg['state-info'] as InstallingState)['installing-info'][ - 'new-manifest' - ] + return (pkg.stateInfo as InstallingState).installingInfo.newManifest } export function isInstalled( pkg: PackageDataEntry, ): pkg is PackageDataEntry { - return pkg['state-info'].state === PackageState.Installed + return pkg.stateInfo.state === PackageState.Installed } export function isRemoving( pkg: PackageDataEntry, ): pkg is PackageDataEntry { - return pkg['state-info'].state === PackageState.Removing + return pkg.stateInfo.state === PackageState.Removing } export function isInstalling( pkg: PackageDataEntry, ): pkg is PackageDataEntry { - return pkg['state-info'].state === PackageState.Installing + return pkg.stateInfo.state === PackageState.Installing } export function isRestoring( pkg: PackageDataEntry, ): pkg is PackageDataEntry { - return pkg['state-info'].state === PackageState.Restoring + return pkg.stateInfo.state === PackageState.Restoring } export function isUpdating( pkg: PackageDataEntry, ): pkg is PackageDataEntry { - return pkg['state-info'].state === PackageState.Updating + return pkg.stateInfo.state === PackageState.Updating } diff --git a/web/projects/ui/src/app/util/get-server-info.ts b/web/projects/ui/src/app/util/get-server-info.ts index 4500c4305..08eecd451 100644 --- a/web/projects/ui/src/app/util/get-server-info.ts +++ b/web/projects/ui/src/app/util/get-server-info.ts @@ -5,5 +5,5 @@ import { firstValueFrom } from 'rxjs' export async function getServerInfo( patch: PatchDB, ): Promise { - return firstValueFrom(patch.watch$('server-info')) + return firstValueFrom(patch.watch$('serverInfo')) } diff --git a/web/projects/ui/src/app/util/has-deps.ts b/web/projects/ui/src/app/util/has-deps.ts index b5c8c1f92..079990d1c 100644 --- a/web/projects/ui/src/app/util/has-deps.ts +++ b/web/projects/ui/src/app/util/has-deps.ts @@ -4,5 +4,5 @@ export function hasCurrentDeps( id: string, pkgs: Record, ): boolean { - return !!Object.values(pkgs).some(pkg => !!pkg['current-dependencies'][id]) + return !!Object.values(pkgs).some(pkg => !!pkg.currentDependencies[id]) }