From 7e9d453a2c55673463b41e0213d5d09939996fb6 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Fri, 22 Mar 2024 12:05:41 -0600 Subject: [PATCH] switch all fe to camelCase --- .../src/app/pages/logs/logs.page.ts | 2 +- .../src/app/services/api/mock-api.service.ts | 4 +- .../src/app/services/api/mock-api.service.ts | 18 +- .../src/pages/show/about/about.component.html | 7 +- .../show/additional/additional.component.html | 16 +- .../dependencies/dependencies.component.html | 4 +- .../dependencies/dependencies.component.ts | 2 +- .../pages/show/package/package.component.html | 4 +- .../src/pipes/filter-packages.pipe.ts | 3 +- web/projects/marketplace/src/types.ts | 22 +- .../app/modals/cifs-modal/cifs-modal.page.ts | 2 +- .../src/app/modals/password/password.page.ts | 4 +- .../src/app/pages/loading/loading.page.ts | 5 +- .../src/app/pages/recover/recover.page.ts | 6 +- .../src/app/pages/success/success.page.ts | 6 +- .../src/app/services/api/api.service.ts | 24 +- .../src/app/services/api/live-api.service.ts | 11 +- .../src/app/services/api/mock-api.service.ts | 32 +-- .../src/app/services/state.service.ts | 10 +- web/projects/shared/src/types/api.ts | 10 +- web/projects/ui/src/app/app-routing.module.ts | 9 - web/projects/ui/src/app/app.component.ts | 7 +- .../ui/src/app/app/footer/footer.component.ts | 2 +- .../ui/src/app/app/menu/menu.component.ts | 26 +- .../backup-drives/backup.service.ts | 2 +- .../badge-menu-button/badge-menu.component.ts | 4 +- .../connection-bar.component.ts | 6 +- .../src/app/components/logs/logs.component.ts | 4 +- .../notifications-toast.service.ts | 2 +- .../refresh-alert/refresh-alert.service.ts | 2 +- .../update-toast/update-toast.service.ts | 2 +- .../modals/app-config/app-config.page.html | 14 +- .../app/modals/app-config/app-config.page.ts | 20 +- .../app-recover-select.page.html | 2 +- .../app-recover-select.page.ts | 6 +- .../app-recover-select/to-options.pipe.ts | 2 +- .../backup-select/backup-select.page.ts | 4 +- .../marketplace-settings.page.ts | 8 +- .../app/modals/os-update/os-update.page.ts | 2 +- .../app-actions/app-actions.page.html | 4 +- .../app-actions/app-actions.page.ts | 4 +- .../app-interfaces/app-interfaces.page.ts | 2 +- .../app-list-pkg/app-list-pkg.component.html | 8 +- .../app-list-pkg/app-list-pkg.component.ts | 2 +- .../apps-routes/app-list/app-list.page.ts | 2 +- .../apps-routes/app-list/package-info.pipe.ts | 2 +- .../app-properties/app-properties.page.ts | 2 +- .../apps-routes/app-show/app-show.page.html | 4 +- .../apps-routes/app-show/app-show.page.ts | 10 +- .../app-show-additional.component.html | 28 +- .../app-show-status.component.html | 4 +- .../app-show-status.component.ts | 6 +- .../app-show/pipes/to-buttons.pipe.ts | 8 +- .../app-show/pipes/to-health-checks.pipe.ts | 20 +- .../dev-config/dev-config.module.ts | 30 -- .../dev-config/dev-config.page.html | 28 -- .../dev-config/dev-config.page.scss | 0 .../dev-config/dev-config.page.ts | 82 ------ .../dev-instructions.module.ts | 30 -- .../dev-instructions.page.html | 28 -- .../dev-instructions.page.scss | 0 .../dev-instructions/dev-instructions.page.ts | 69 ----- .../dev-manifest/dev-manifest.module.ts | 30 -- .../dev-manifest/dev-manifest.page.html | 17 -- .../dev-manifest/dev-manifest.page.scss | 0 .../dev-manifest/dev-manifest.page.ts | 32 --- .../developer-list/developer-list.module.ts | 26 -- .../developer-list/developer-list.page.html | 37 --- .../developer-list/developer-list.page.scss | 0 .../developer-list/developer-list.page.ts | 266 ------------------ .../developer-menu/developer-menu.module.ts | 34 --- .../developer-menu/developer-menu.page.html | 51 ---- .../developer-menu/developer-menu.page.scss | 0 .../developer-menu/developer-menu.page.ts | 68 ----- .../developer-menu/form-info.ts | 171 ----------- .../developer-routing.module.ts | 49 ---- .../marketplace-list/marketplace-list.page.ts | 2 +- .../marketplace-show-controls.component.html | 2 +- .../marketplace-show-controls.component.ts | 7 +- .../marketplace-show/marketplace-show.page.ts | 2 +- .../marketplace-status.component.html | 2 +- .../notifications/notifications.page.html | 8 +- .../pages/notifications/notifications.page.ts | 4 +- .../restore/restore.component.ts | 4 +- .../backing-up/backing-up.component.ts | 10 +- .../server-backup/server-backup.page.ts | 15 +- .../server-metrics/server-metrics.page.html | 16 +- .../server-show/server-show.page.html | 16 +- .../server-show/server-show.page.ts | 10 +- .../server-specs/server-specs.page.html | 20 +- .../server-specs/server-specs.page.ts | 2 +- .../server-routes/sessions/sessions.page.html | 10 +- .../server-routes/sessions/sessions.page.ts | 3 +- .../server-routes/ssh-keys/ssh-keys.page.html | 2 +- .../pages/server-routes/wifi/wifi.page.html | 2 +- .../src/app/pages/updates/updates.page.html | 11 +- .../ui/src/app/pages/updates/updates.page.ts | 4 +- .../built-in/health/health.component.ts | 2 +- web/projects/ui/src/app/pipes/ui/ui.pipe.ts | 2 +- .../ui/src/app/pkg-config/config-types.ts | 12 - .../ui/src/app/services/api/api.fixures.ts | 236 ++++++++-------- .../ui/src/app/services/api/api.types.ts | 82 +++--- .../services/api/embassy-live-api.service.ts | 4 +- .../services/api/embassy-mock-api.service.ts | 108 +++---- .../ui/src/app/services/api/mock-patch.ts | 79 +++--- .../ui/src/app/services/config.service.ts | 6 +- .../ui/src/app/services/dep-error.service.ts | 24 +- .../ui/src/app/services/eos.service.ts | 6 +- .../ui/src/app/services/form.service.ts | 1 - .../src/app/services/marketplace.service.ts | 22 +- .../ui/src/app/services/patch-data.service.ts | 4 +- .../src/app/services/patch-db/data-model.ts | 80 +++--- .../services/pkg-status-rendering.service.ts | 4 +- .../ui/src/app/services/time-service.ts | 2 +- .../src/app/services/ui-launcher.service.ts | 2 +- web/projects/ui/src/app/util/dry-update.ts | 6 +- .../ui/src/app/util/get-package-data.ts | 22 +- .../ui/src/app/util/get-server-info.ts | 2 +- web/projects/ui/src/app/util/has-deps.ts | 2 +- .../ui/src/app/util/properties.util.ts | 2 - 120 files changed, 593 insertions(+), 1739 deletions(-) delete mode 100644 web/projects/ui/src/app/pages/developer-routes/dev-config/dev-config.module.ts delete mode 100644 web/projects/ui/src/app/pages/developer-routes/dev-config/dev-config.page.html delete mode 100644 web/projects/ui/src/app/pages/developer-routes/dev-config/dev-config.page.scss delete mode 100644 web/projects/ui/src/app/pages/developer-routes/dev-config/dev-config.page.ts delete mode 100644 web/projects/ui/src/app/pages/developer-routes/dev-instructions/dev-instructions.module.ts delete mode 100644 web/projects/ui/src/app/pages/developer-routes/dev-instructions/dev-instructions.page.html delete mode 100644 web/projects/ui/src/app/pages/developer-routes/dev-instructions/dev-instructions.page.scss delete mode 100644 web/projects/ui/src/app/pages/developer-routes/dev-instructions/dev-instructions.page.ts delete mode 100644 web/projects/ui/src/app/pages/developer-routes/dev-manifest/dev-manifest.module.ts delete mode 100644 web/projects/ui/src/app/pages/developer-routes/dev-manifest/dev-manifest.page.html delete mode 100644 web/projects/ui/src/app/pages/developer-routes/dev-manifest/dev-manifest.page.scss delete mode 100644 web/projects/ui/src/app/pages/developer-routes/dev-manifest/dev-manifest.page.ts delete mode 100644 web/projects/ui/src/app/pages/developer-routes/developer-list/developer-list.module.ts delete mode 100644 web/projects/ui/src/app/pages/developer-routes/developer-list/developer-list.page.html delete mode 100644 web/projects/ui/src/app/pages/developer-routes/developer-list/developer-list.page.scss delete mode 100644 web/projects/ui/src/app/pages/developer-routes/developer-list/developer-list.page.ts delete mode 100644 web/projects/ui/src/app/pages/developer-routes/developer-menu/developer-menu.module.ts delete mode 100644 web/projects/ui/src/app/pages/developer-routes/developer-menu/developer-menu.page.html delete mode 100644 web/projects/ui/src/app/pages/developer-routes/developer-menu/developer-menu.page.scss delete mode 100644 web/projects/ui/src/app/pages/developer-routes/developer-menu/developer-menu.page.ts delete mode 100644 web/projects/ui/src/app/pages/developer-routes/developer-menu/form-info.ts delete mode 100644 web/projects/ui/src/app/pages/developer-routes/developer-routing.module.ts diff --git a/web/projects/diagnostic-ui/src/app/pages/logs/logs.page.ts b/web/projects/diagnostic-ui/src/app/pages/logs/logs.page.ts index 317cd1ea3..44c314a96 100644 --- a/web/projects/diagnostic-ui/src/app/pages/logs/logs.page.ts +++ b/web/projects/diagnostic-ui/src/app/pages/logs/logs.page.ts @@ -49,7 +49,7 @@ export class LogsPage { private async getLogs() { try { - const { 'start-cursor': startCursor, entries } = await this.api.getLogs({ + const { startCursor, entries } = await this.api.getLogs({ cursor: this.startCursor, before: !!this.startCursor, limit: this.limit, diff --git a/web/projects/diagnostic-ui/src/app/services/api/mock-api.service.ts b/web/projects/diagnostic-ui/src/app/services/api/mock-api.service.ts index 5d8c13a4f..d991edd32 100644 --- a/web/projects/diagnostic-ui/src/app/services/api/mock-api.service.ts +++ b/web/projects/diagnostic-ui/src/app/services/api/mock-api.service.ts @@ -45,8 +45,8 @@ export class MockApiService implements ApiService { } return { entries, - 'start-cursor': 'startCursor', - 'end-cursor': 'endCursor', + startCursor: 'start-cursor', + endCursor: 'end-cursor', } } } diff --git a/web/projects/install-wizard/src/app/services/api/mock-api.service.ts b/web/projects/install-wizard/src/app/services/api/mock-api.service.ts index 9caf4f88e..5be394c67 100644 --- a/web/projects/install-wizard/src/app/services/api/mock-api.service.ts +++ b/web/projects/install-wizard/src/app/services/api/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/about/about.component.html b/web/projects/marketplace/src/pages/show/about/about.component.html index c1d76dd2c..1126f8b54 100644 --- a/web/projects/marketplace/src/pages/show/about/about.component.html +++ b/web/projects/marketplace/src/pages/show/about/about.component.html @@ -4,7 +4,7 @@ -
+
@@ -18,10 +18,7 @@

{{ pkg.manifest.description.long }}

-
+
View website 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 8937e8c74..d362991e3 100644 --- a/web/projects/marketplace/src/pages/show/additional/additional.component.html +++ b/web/projects/marketplace/src/pages/show/additional/additional.component.html @@ -15,7 +15,7 @@

Source Repository

-

{{ manifest['upstream-repo'] }}

+

{{ manifest.upstreamRepo }}

Wrapper Repository

-

{{ manifest['wrapper-repo'] }}

+

{{ manifest.wrapperRepo }}

Support Site

-

{{ manifest['support-site'] || 'Not provided' }}

+

{{ manifest.supportSite || 'Not provided' }}

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 e5711b432..4c1bfcc65 100644 --- a/web/projects/marketplace/src/pages/show/dependencies/dependencies.component.html +++ b/web/projects/marketplace/src/pages/show/dependencies/dependencies.component.html @@ -17,10 +17,10 @@

- {{ pkg['dependency-metadata'][dep.key].title }} + {{ pkg.dependencyMetadata[dep.key].title }} (optional) - (optional) + (Required)

{{ dep.value.description }}

diff --git a/web/projects/marketplace/src/pages/show/dependencies/dependencies.component.ts b/web/projects/marketplace/src/pages/show/dependencies/dependencies.component.ts index 0626f4817..a1fed6cca 100644 --- a/web/projects/marketplace/src/pages/show/dependencies/dependencies.component.ts +++ b/web/projects/marketplace/src/pages/show/dependencies/dependencies.component.ts @@ -11,6 +11,6 @@ export class DependenciesComponent { pkg!: MarketplacePkg getImg(key: string): string { - return this.pkg['dependency-metadata'][key].icon + return this.pkg.dependencyMetadata[key].icon } } diff --git a/web/projects/marketplace/src/pages/show/package/package.component.html b/web/projects/marketplace/src/pages/show/package/package.component.html index 1e0ad89eb..94e7006b1 100644 --- a/web/projects/marketplace/src/pages/show/package/package.component.html +++ b/web/projects/marketplace/src/pages/show/package/package.component.html @@ -3,9 +3,7 @@

{{ pkg.manifest.title }}

{{ pkg.manifest.version | displayEmver }}

-

- Released: {{ pkg['published-at'] | date: 'medium' }} -

+

Released: {{ pkg.publishedAt | date: 'medium' }}

diff --git a/web/projects/marketplace/src/pipes/filter-packages.pipe.ts b/web/projects/marketplace/src/pipes/filter-packages.pipe.ts index 5b0bb52b1..48313376f 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() ) }) } diff --git a/web/projects/marketplace/src/types.ts b/web/projects/marketplace/src/types.ts index 7007ee806..7f69c3747 100644 --- a/web/projects/marketplace/src/types.ts +++ b/web/projects/marketplace/src/types.ts @@ -28,10 +28,10 @@ export interface MarketplacePkg { manifest: Manifest categories: string[] versions: string[] - 'dependency-metadata': { + dependencyMetadata: { [id: string]: DependencyMetadata } - 'published-at': string + publishedAt: string } export interface DependencyMetadata { @@ -45,19 +45,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 @@ -66,8 +66,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/modals/cifs-modal/cifs-modal.page.ts b/web/projects/setup-wizard/src/app/modals/cifs-modal/cifs-modal.page.ts index 7f293f5e0..0664be38f 100644 --- a/web/projects/setup-wizard/src/app/modals/cifs-modal/cifs-modal.page.ts +++ b/web/projects/setup-wizard/src/app/modals/cifs-modal/cifs-modal.page.ts @@ -61,7 +61,7 @@ export class CifsModal { const target: CifsBackupTarget = { ...this.cifs, mountable: true, - 'embassy-os': diskInfo, + startOs: diskInfo, } const modal = await this.modalController.create({ diff --git a/web/projects/setup-wizard/src/app/modals/password/password.page.ts b/web/projects/setup-wizard/src/app/modals/password/password.page.ts index 98de93e1a..8ea00ce0c 100644 --- a/web/projects/setup-wizard/src/app/modals/password/password.page.ts +++ b/web/projects/setup-wizard/src/app/modals/password/password.page.ts @@ -31,11 +31,11 @@ export class PasswordPage { } async verifyPw() { - if (!this.target || !this.target['embassy-os']) + if (!this.target || !this.target.startOs) this.pwError = 'No recovery target' // unreachable try { - const passwordHash = this.target!['embassy-os']?.['password-hash'] || '' + const passwordHash = this.target!.startOs?.passwordHash || '' argon2.verify(passwordHash, this.password) this.modalController.dismiss({ password: this.password }, 'success') diff --git a/web/projects/setup-wizard/src/app/pages/loading/loading.page.ts b/web/projects/setup-wizard/src/app/pages/loading/loading.page.ts index 10ec47d31..ce1a1b3c0 100644 --- a/web/projects/setup-wizard/src/app/pages/loading/loading.page.ts +++ b/web/projects/setup-wizard/src/app/pages/loading/loading.page.ts @@ -38,10 +38,7 @@ export class LoadingPage { if (!progress) return - const { - 'total-bytes': totalBytes, - 'bytes-transferred': bytesTransferred, - } = progress + const { totalBytes, bytesTransferred } = progress this.progress$.next({ totalBytes, diff --git a/web/projects/setup-wizard/src/app/pages/recover/recover.page.ts b/web/projects/setup-wizard/src/app/pages/recover/recover.page.ts index a8cd194ba..f9e5adbb1 100644 --- a/web/projects/setup-wizard/src/app/pages/recover/recover.page.ts +++ b/web/projects/setup-wizard/src/app/pages/recover/recover.page.ts @@ -35,7 +35,7 @@ export class RecoverPage { } driveClickable(mapped: MappedDisk) { - return mapped.drive['embassy-os']?.full + return mapped.drive.startOs?.full } async getDrives() { @@ -53,10 +53,10 @@ export class RecoverPage { label: p.label, capacity: p.capacity, used: p.used, - 'embassy-os': p['embassy-os'], + startOs: p.startOs, } this.mappedDrives.push({ - hasValidBackup: !!p['embassy-os']?.full, + hasValidBackup: !!p.startOs?.full, drive, }) }) diff --git a/web/projects/setup-wizard/src/app/pages/success/success.page.ts b/web/projects/setup-wizard/src/app/pages/success/success.page.ts index c1d175aaa..71566580a 100644 --- a/web/projects/setup-wizard/src/app/pages/success/success.page.ts +++ b/web/projects/setup-wizard/src/app/pages/success/success.page.ts @@ -76,9 +76,9 @@ export class SuccessPage { try { const ret = await this.api.complete() if (!this.isKiosk) { - this.torAddress = ret['tor-address'].replace(/^https:/, 'http:') - this.lanAddress = ret['lan-address'].replace(/^https:/, 'http:') - this.cert = ret['root-ca'] + this.torAddress = ret.torAddress.replace(/^https:/, 'http:') + this.lanAddress = ret.lanAddress.replace(/^https:/, 'http:') + this.cert = ret.rootCa await this.api.exit() } diff --git a/web/projects/setup-wizard/src/app/services/api/api.service.ts b/web/projects/setup-wizard/src/app/services/api/api.service.ts index df9636093..375e64a78 100644 --- a/web/projects/setup-wizard/src/app/services/api/api.service.ts +++ b/web/projects/setup-wizard/src/app/services/api/api.service.ts @@ -28,27 +28,27 @@ type Encrypted = { } export type StatusRes = { - 'bytes-transferred': number - 'total-bytes': number | null + bytesTransferred: number + totalBytes: number | null complete: boolean } | null 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 = { @@ -58,7 +58,7 @@ export type DiskBackupTarget = { label: string | null capacity: number used: number | null - 'embassy-os': StartOSDiskInfo | null + startOs: StartOSDiskInfo | null } export type CifsBackupTarget = { @@ -66,7 +66,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/api/live-api.service.ts b/web/projects/setup-wizard/src/app/services/api/live-api.service.ts index ab67db5d0..566cc84cf 100644 --- a/web/projects/setup-wizard/src/app/services/api/live-api.service.ts +++ b/web/projects/setup-wizard/src/app/services/api/live-api.service.ts @@ -73,11 +73,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', '/') } } @@ -95,7 +94,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/api/mock-api.service.ts b/web/projects/setup-wizard/src/app/services/api/mock-api.service.ts index 51acf4e7b..df32bd09e 100644 --- a/web/projects/setup-wizard/src/app/services/api/mock-api.service.ts +++ b/web/projects/setup-wizard/src/app/services/api/mock-api.service.ts @@ -30,8 +30,8 @@ export class MockApiService extends ApiService { const progress = tries > 4 ? (tries - 4) * 268435456 : 0 return { - 'bytes-transferred': restoreOrMigrate ? progress : 0, - 'total-bytes': restoreOrMigrate ? total : null, + bytesTransferred: restoreOrMigrate ? progress : 0, + totalBytes: restoreOrMigrate ? total : null, complete: progress === total, } } @@ -65,12 +65,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, }, @@ -88,12 +88,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, }, @@ -111,12 +111,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', }, @@ -132,9 +132,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: '', } } @@ -149,9 +149,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 e70478559..916b066ee 100644 --- a/web/projects/setup-wizard/src/app/services/state.service.ts +++ b/web/projects/setup-wizard/src/app/services/state.service.ts @@ -15,7 +15,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), }) } @@ -24,10 +24,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 1473dc16a..26cd00218 100644 --- a/web/projects/shared/src/types/api.ts +++ b/web/projects/shared/src/types/api.ts @@ -6,8 +6,8 @@ export type ServerLogsReq = { export type LogsRes = { entries: Log[] - 'start-cursor'?: string - 'end-cursor'?: string + startCursor?: string + endCursor?: string } export interface Log { @@ -31,13 +31,13 @@ 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 } diff --git a/web/projects/ui/src/app/app-routing.module.ts b/web/projects/ui/src/app/app-routing.module.ts index b1b79c05d..ddb66d3c5 100644 --- a/web/projects/ui/src/app/app-routing.module.ts +++ b/web/projects/ui/src/app/app-routing.module.ts @@ -63,15 +63,6 @@ const routes: Routes = [ m => m.AppsRoutingModule, ), }, - { - path: 'developer', - canActivate: [AuthGuard], - canActivateChild: [AuthGuard], - loadChildren: () => - import('./pages/developer-routes/developer-routing.module').then( - m => m.DeveloperRoutingModule, - ), - }, ] @NgModule({ diff --git a/web/projects/ui/src/app/app.component.ts b/web/projects/ui/src/app/app.component.ts index 5675fbf5c..1210eba7a 100644 --- a/web/projects/ui/src/app/app.component.ts +++ b/web/projects/ui/src/app/app.component.ts @@ -29,13 +29,12 @@ export class AppComponent implements OnDestroy { this.authService.isVerified$, this.connection.connected$, 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/app/footer/footer.component.ts b/web/projects/ui/src/app/app/footer/footer.component.ts index 9a16f5a47..adbb27fe3 100644 --- a/web/projects/ui/src/app/app/footer/footer.component.ts +++ b/web/projects/ui/src/app/app/footer/footer.component.ts @@ -13,7 +13,7 @@ import { DataModel } from '../../services/patch-db/data-model' }) export class FooterComponent { readonly progress$ = this.patch - .watch$('server-info', 'status-info', 'update-progress') + .watch$('serverInfo', 'statusInfo', 'updateProgress') .pipe(map(a => a && { ...a })) readonly animation = { diff --git a/web/projects/ui/src/app/app/menu/menu.component.ts b/web/projects/ui/src/app/app/menu/menu.component.ts index 540dee7b9..d44781a41 100644 --- a/web/projects/ui/src/app/app/menu/menu.component.ts +++ b/web/projects/ui/src/app/app/menu/menu.component.ts @@ -11,9 +11,7 @@ import { filter, first, map, - merge, Observable, - of, pairwise, startWith, switchMap, @@ -24,14 +22,7 @@ import { DataModel, PackageState } from 'src/app/services/patch-db/data-model' import { SplitPaneTracker } from 'src/app/services/split-pane.service' import { Emver, THEME } from '@start9labs/shared' import { ConnectionService } from 'src/app/services/connection.service' -import { ConfigService } from 'src/app/services/config.service' -import { - getManifest, - isInstalled, - isInstalling, - isRestoring, - isUpdating, -} from 'src/app/util/get-package-data' +import { getManifest } from 'src/app/util/get-package-data' @Component({ selector: 'app-menu', @@ -69,19 +60,19 @@ export class MenuComponent { ] readonly notificationCount$ = this.patch.watch$( - 'server-info', - 'unread-notification-count', + 'serverInfo', + 'unreadNotificationCount', ) - readonly snekScore$ = this.patch.watch$('ui', 'gaming', 'snake', 'high-score') + readonly snekScore$ = this.patch.watch$('ui', 'gaming', 'snake', 'highScore') readonly showEOSUpdate$ = this.eosService.showUpdate$ private readonly local$ = this.connectionService.connected$.pipe( filter(Boolean), - switchMap(() => this.patch.watch$('package-data').pipe(first())), + switchMap(() => this.patch.watch$('packageData').pipe(first())), switchMap(outer => - this.patch.watch$('package-data').pipe( + this.patch.watch$('packageData').pipe( pairwise(), filter(([prev, curr]) => Object.values(prev).some( @@ -90,9 +81,9 @@ export class MenuComponent { PackageState.Installing, PackageState.Updating, PackageState.Restoring, - ].includes(p['state-info'].state) && + ].includes(p.stateInfo.state) && [PackageState.Installed, PackageState.Removing].includes( - curr[getManifest(p).id]['state-info'].state, + curr[getManifest(p).id].stateInfo.state, ), ), ), @@ -136,6 +127,5 @@ export class MenuComponent { private readonly splitPane: SplitPaneTracker, private readonly emver: Emver, private readonly connectionService: ConnectionService, - private readonly config: ConfigService, ) {} } diff --git a/web/projects/ui/src/app/components/backup-drives/backup.service.ts b/web/projects/ui/src/app/components/backup-drives/backup.service.ts index 381110de4..6beec7e2d 100644 --- a/web/projects/ui/src/app/components/backup-drives/backup.service.ts +++ b/web/projects/ui/src/app/components/backup-drives/backup.service.ts @@ -56,7 +56,7 @@ export class BackupService { } hasValidBackup(target: BackupTarget): boolean { - const backup = target['embassy-os'] + const backup = target.startOs return !!backup && this.emver.compare(backup.version, '0.3.0') !== -1 } } diff --git a/web/projects/ui/src/app/components/badge-menu-button/badge-menu.component.ts b/web/projects/ui/src/app/components/badge-menu-button/badge-menu.component.ts index 3f91da5c4..5fe9b621e 100644 --- a/web/projects/ui/src/app/components/badge-menu-button/badge-menu.component.ts +++ b/web/projects/ui/src/app/components/badge-menu-button/badge-menu.component.ts @@ -21,8 +21,8 @@ const { enableWidgets } = }) export class BadgeMenuComponent { readonly unreadCount$ = this.patch.watch$( - 'server-info', - 'unread-notification-count', + 'serverInfo', + 'unreadNotificationCount', ) readonly sidebarOpen$ = this.splitPane.sidebarOpen$ readonly widgetDrawer$ = this.clientStorageService.widgetDrawer$ diff --git a/web/projects/ui/src/app/components/connection-bar/connection-bar.component.ts b/web/projects/ui/src/app/components/connection-bar/connection-bar.component.ts index 9c4b07b7f..da28f805f 100644 --- a/web/projects/ui/src/app/components/connection-bar/connection-bar.component.ts +++ b/web/projects/ui/src/app/components/connection-bar/connection-bar.component.ts @@ -22,8 +22,8 @@ export class ConnectionBarComponent { this.connectionService.networkConnected$, this.websocket$.pipe(startWith(false)), 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(([network, websocket, status]) => { if (!network) @@ -40,7 +40,7 @@ export class ConnectionBarComponent { icon: 'cloud-offline-outline', dots: true, } - if (status['shutting-down']) + if (status.shuttingDown) return { message: 'Shutting Down', color: 'dark', diff --git a/web/projects/ui/src/app/components/logs/logs.component.ts b/web/projects/ui/src/app/components/logs/logs.component.ts index 5f0688757..5d033fc83 100644 --- a/web/projects/ui/src/app/components/logs/logs.component.ts +++ b/web/projects/ui/src/app/components/logs/logs.component.ts @@ -78,7 +78,7 @@ export class LogsComponent { async ngOnInit() { from(this.followLogs({ limit: this.limit })) .pipe( - switchMap(({ 'start-cursor': startCursor, guid }) => { + switchMap(({ startCursor, guid }) => { this.startCursor = startCursor return this.connect$(guid) }), @@ -206,7 +206,7 @@ export class LogsComponent { } private processRes(res: LogsRes) { - const { entries, 'start-cursor': startCursor } = res + const { entries, startCursor } = res if (!entries.length) return diff --git a/web/projects/ui/src/app/components/toast-container/notifications-toast/notifications-toast.service.ts b/web/projects/ui/src/app/components/toast-container/notifications-toast/notifications-toast.service.ts index 52d35ea3c..a2368438d 100644 --- a/web/projects/ui/src/app/components/toast-container/notifications-toast/notifications-toast.service.ts +++ b/web/projects/ui/src/app/components/toast-container/notifications-toast/notifications-toast.service.ts @@ -7,7 +7,7 @@ import { DataModel } from 'src/app/services/patch-db/data-model' @Injectable({ providedIn: 'root' }) export class NotificationsToastService extends Observable { private readonly stream$ = this.patch - .watch$('server-info', 'unread-notification-count') + .watch$('serverInfo', 'unreadNotificationCount') .pipe( pairwise(), map(([prev, cur]) => cur > prev), diff --git a/web/projects/ui/src/app/components/toast-container/refresh-alert/refresh-alert.service.ts b/web/projects/ui/src/app/components/toast-container/refresh-alert/refresh-alert.service.ts index 43c7f82c4..50cbc5a56 100644 --- a/web/projects/ui/src/app/components/toast-container/refresh-alert/refresh-alert.service.ts +++ b/web/projects/ui/src/app/components/toast-container/refresh-alert/refresh-alert.service.ts @@ -8,7 +8,7 @@ import { DataModel } from 'src/app/services/patch-db/data-model' @Injectable({ providedIn: 'root' }) export class RefreshAlertService extends Observable { - private readonly stream$ = this.patch.watch$('server-info', 'version').pipe( + private readonly stream$ = this.patch.watch$('serverInfo', 'version').pipe( map(version => !!this.emver.compare(this.config.version, version)), endWith(false), ) diff --git a/web/projects/ui/src/app/components/toast-container/update-toast/update-toast.service.ts b/web/projects/ui/src/app/components/toast-container/update-toast/update-toast.service.ts index 5eb650869..819ed3dc6 100644 --- a/web/projects/ui/src/app/components/toast-container/update-toast/update-toast.service.ts +++ b/web/projects/ui/src/app/components/toast-container/update-toast/update-toast.service.ts @@ -7,7 +7,7 @@ import { DataModel } from 'src/app/services/patch-db/data-model' @Injectable({ providedIn: 'root' }) export class UpdateToastService extends Observable { private readonly stream$ = this.patch - .watch$('server-info', 'status-info', 'updated') + .watch$('serverInfo', 'statusInfo', 'updated') .pipe(distinctUntilChanged(), filter(Boolean), endWith(false)) constructor(private readonly patch: PatchDB) { diff --git a/web/projects/ui/src/app/modals/app-config/app-config.page.html b/web/projects/ui/src/app/modals/app-config/app-config.page.html index b781e8cad..42eb6cf39 100644 --- a/web/projects/ui/src/app/modals/app-config/app-config.page.html +++ b/web/projects/ui/src/app/modals/app-config/app-config.page.html @@ -9,7 +9,7 @@ - + - +

No config options for {{ manifest.title }} {{ manifest.version }}. @@ -111,11 +111,7 @@ - + Reset Defaults @@ -123,7 +119,7 @@ , ) {} + get hasConfig() { + return this.pkg.stateInfo.manifest.hasConfig + } + async ngOnInit() { try { const pkg = await getPackage(this.patch, this.pkgId) @@ -78,7 +80,7 @@ export class AppConfigPage { this.pkg = pkg - if (!this.pkg['state-info'].manifest['has-config']) return + if (!this.hasConfig) return let newConfig: object | undefined let patch: Operation[] | undefined @@ -86,12 +88,12 @@ export class AppConfigPage { if (this.dependentInfo) { this.loadingText = `Setting properties to accommodate ${this.dependentInfo.title}` const { - 'old-config': oc, - 'new-config': nc, + oldConfig: oc, + newConfig: nc, spec: s, } = await this.embassyApi.dryConfigureDependency({ - 'dependency-id': this.pkgId, - 'dependent-id': this.dependentInfo.id, + dependencyId: this.pkgId, + dependentId: this.dependentInfo.id, }) this.original = oc newConfig = nc @@ -111,10 +113,6 @@ export class AppConfigPage { newConfig || this.original, ) - this.hasOptions = !!Object.values(this.configSpec).find( - valSpec => valSpec.type !== 'pointer', - ) - if (patch) { this.diff = this.getDiff(patch) this.markDirty(patch) diff --git a/web/projects/ui/src/app/modals/app-recover-select/app-recover-select.page.html b/web/projects/ui/src/app/modals/app-recover-select/app-recover-select.page.html index 09a055650..9dfb72da9 100644 --- a/web/projects/ui/src/app/modals/app-recover-select/app-recover-select.page.html +++ b/web/projects/ui/src/app/modals/app-recover-select/app-recover-select.page.html @@ -1,5 +1,5 @@ diff --git a/web/projects/ui/src/app/modals/app-recover-select/app-recover-select.page.ts b/web/projects/ui/src/app/modals/app-recover-select/app-recover-select.page.ts index 65f61e643..15bec3d4f 100644 --- a/web/projects/ui/src/app/modals/app-recover-select/app-recover-select.page.ts +++ b/web/projects/ui/src/app/modals/app-recover-select/app-recover-select.page.ts @@ -23,7 +23,7 @@ export class AppRecoverSelectPage { @Input() password!: string @Input() oldPassword?: string - readonly packageData$ = this.patch.watch$('package-data').pipe(take(1)) + readonly packageData$ = this.patch.watch$('packageData').pipe(take(1)) hasSelection = false error: string | IonicSafeString = '' @@ -53,8 +53,8 @@ export class AppRecoverSelectPage { try { await this.embassyApi.restorePackages({ ids, - 'target-id': this.id, - 'old-password': this.oldPassword || null, + targetId: this.id, + oldPassword: this.oldPassword || null, password: this.password, }) this.modalCtrl.dismiss(undefined, 'success') diff --git a/web/projects/ui/src/app/modals/app-recover-select/to-options.pipe.ts b/web/projects/ui/src/app/modals/app-recover-select/to-options.pipe.ts index 2ac688a6b..6a81df4bc 100644 --- a/web/projects/ui/src/app/modals/app-recover-select/to-options.pipe.ts +++ b/web/projects/ui/src/app/modals/app-recover-select/to-options.pipe.ts @@ -34,7 +34,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/modals/backup-select/backup-select.page.ts b/web/projects/ui/src/app/modals/backup-select/backup-select.page.ts index b1b6cf5e6..861e4c29f 100644 --- a/web/projects/ui/src/app/modals/backup-select/backup-select.page.ts +++ b/web/projects/ui/src/app/modals/backup-select/backup-select.page.ts @@ -29,7 +29,7 @@ export class BackupSelectPage { async ngOnInit() { this.pkgs = await firstValueFrom( - this.patch.watch$('package-data').pipe( + this.patch.watch$('packageData').pipe( map(pkgs => { return Object.values(pkgs) .map(pkg => { @@ -38,7 +38,7 @@ export class BackupSelectPage { id, title, icon: pkg.icon, - disabled: pkg['state-info'].state !== PackageState.Installed, + disabled: pkg.stateInfo.state !== PackageState.Installed, checked: false, } }) diff --git a/web/projects/ui/src/app/modals/marketplace-settings/marketplace-settings.page.ts b/web/projects/ui/src/app/modals/marketplace-settings/marketplace-settings.page.ts index 9743e531c..f62331819 100644 --- a/web/projects/ui/src/app/modals/marketplace-settings/marketplace-settings.page.ts +++ b/web/projects/ui/src/app/modals/marketplace-settings/marketplace-settings.page.ts @@ -200,7 +200,7 @@ export class MarketplaceSettingsPage { ): Promise { // Error on duplicates const hosts = await firstValueFrom( - this.patch.watch$('ui', 'marketplace', 'known-hosts'), + this.patch.watch$('ui', 'marketplace', 'knownHosts'), ) const currentUrls = Object.keys(hosts).map(toUrl) if (currentUrls.includes(url)) throw new Error('marketplace already added') @@ -217,7 +217,7 @@ export class MarketplaceSettingsPage { loader.message = 'Saving...' await this.api.setDbValue<{ name: string }>( - ['marketplace', 'known-hosts', url], + ['marketplace', 'knownHosts', url], { name }, ) } @@ -229,7 +229,7 @@ export class MarketplaceSettingsPage { await loader.present() const hosts = await firstValueFrom( - this.patch.watch$('ui', 'marketplace', 'known-hosts'), + this.patch.watch$('ui', 'marketplace', 'knownHosts'), ) const filtered: { [url: string]: UIStore } = Object.keys(hosts) @@ -244,7 +244,7 @@ export class MarketplaceSettingsPage { try { await this.api.setDbValue<{ [url: string]: UIStore }>( - ['marketplace', 'known-hosts'], + ['marketplace', 'knownHosts'], filtered, ) } catch (e: any) { diff --git a/web/projects/ui/src/app/modals/os-update/os-update.page.ts b/web/projects/ui/src/app/modals/os-update/os-update.page.ts index eb9de93db..9c49b72bf 100644 --- a/web/projects/ui/src/app/modals/os-update/os-update.page.ts +++ b/web/projects/ui/src/app/modals/os-update/os-update.page.ts @@ -22,7 +22,7 @@ export class OSUpdatePage { ) {} ngOnInit() { - const releaseNotes = this.eosService.eos?.['release-notes']! + const releaseNotes = this.eosService.eos?.releaseNotes! this.versions = Object.keys(releaseNotes) .sort() diff --git a/web/projects/ui/src/app/pages/apps-routes/app-actions/app-actions.page.html b/web/projects/ui/src/app/pages/apps-routes/app-actions/app-actions.page.html index bb5374856..ec425f8bb 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-actions/app-actions.page.html +++ b/web/projects/ui/src/app/pages/apps-routes/app-actions/app-actions.page.html @@ -9,7 +9,7 @@ - + Standard Actions - Actions for {{ pkg['state-info'].manifest.title }} + Actions for {{ pkg.stateInfo.manifest.title }} { const sorted = Object.values(interfaces) diff --git a/web/projects/ui/src/app/pages/apps-routes/app-list/app-list-pkg/app-list-pkg.component.html b/web/projects/ui/src/app/pages/apps-routes/app-list/app-list-pkg/app-list-pkg.component.html index 3849b4327..9173de39f 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-list/app-list-pkg/app-list-pkg.component.html +++ b/web/projects/ui/src/app/pages/apps-routes/app-list/app-list-pkg/app-list-pkg.component.html @@ -14,20 +14,20 @@

{{ manifest.version | displayEmver }}

diff --git a/web/projects/ui/src/app/pages/apps-routes/app-list/app-list-pkg/app-list-pkg.component.ts b/web/projects/ui/src/app/pages/apps-routes/app-list/app-list-pkg/app-list-pkg.component.ts index 95f8785f5..04d05a1d8 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-list/app-list-pkg/app-list-pkg.component.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-list/app-list-pkg/app-list-pkg.component.ts @@ -32,7 +32,7 @@ export class AppListPkgComponent { : null } - launchUi(e: Event, interfaces: PackageDataEntry['service-interfaces']): void { + launchUi(e: Event, interfaces: PackageDataEntry['serviceInterfaces']): void { e.stopPropagation() e.preventDefault() this.launcherService.launch(interfaces) diff --git a/web/projects/ui/src/app/pages/apps-routes/app-list/app-list.page.ts b/web/projects/ui/src/app/pages/apps-routes/app-list/app-list.page.ts index e88067ede..8c36d22dc 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-list/app-list.page.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-list/app-list.page.ts @@ -11,7 +11,7 @@ import { getManifest } from 'src/app/util/get-package-data' changeDetection: ChangeDetectionStrategy.OnPush, }) export class AppListPage { - readonly pkgs$ = this.patch.watch$('package-data').pipe( + readonly pkgs$ = this.patch.watch$('packageData').pipe( map(pkgs => Object.values(pkgs)), startWith([]), pairwise(), diff --git a/web/projects/ui/src/app/pages/apps-routes/app-list/package-info.pipe.ts b/web/projects/ui/src/app/pages/apps-routes/app-list/package-info.pipe.ts index 17eda2827..3695c4536 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-list/package-info.pipe.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-list/package-info.pipe.ts @@ -17,7 +17,7 @@ export class PackageInfoPipe implements PipeTransform { transform(pkgId: string): Observable { return combineLatest([ - this.patch.watch$('package-data', pkgId).pipe(filter(Boolean)), + this.patch.watch$('packageData', pkgId).pipe(filter(Boolean)), this.depErrorService.getPkgDepErrors$(pkgId), ]).pipe(map(([pkg, depErrors]) => getPackageInfo(pkg, depErrors))) } diff --git a/web/projects/ui/src/app/pages/apps-routes/app-properties/app-properties.page.ts b/web/projects/ui/src/app/pages/apps-routes/app-properties/app-properties.page.ts index 15af441a7..e3b4508a7 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-properties/app-properties.page.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-properties/app-properties.page.ts @@ -41,7 +41,7 @@ export class AppPropertiesPage { unmasked: { [key: string]: boolean } = {} stopped$ = this.patch - .watch$('package-data', this.pkgId, 'status', 'main', 'status') + .watch$('packageData', this.pkgId, 'status', 'main', 'status') .pipe(map(status => status === PackageMainStatus.Stopped)) @ViewChild(IonBackButtonDelegate, { static: false }) diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.html b/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.html index 476ab940c..238d1d208 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.html +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.html @@ -7,7 +7,7 @@ @@ -35,7 +35,7 @@ diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.ts b/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.ts index d30bb0aff..840c647d2 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/app-show.page.ts @@ -47,7 +47,7 @@ export class AppShowPage { private readonly pkgId = getPkgId(this.route) readonly pkgPlus$ = combineLatest([ - this.patch.watch$('package-data', this.pkgId), + this.patch.watch$('packageData', this.pkgId), this.depErrorService.getPkgDepErrors$(this.pkgId), ]).pipe( tap(([pkg, _]) => { @@ -85,7 +85,7 @@ export class AppShowPage { ): DependencyInfo[] { const manifest = getManifest(pkg) - return Object.keys(pkg['current-dependencies']) + return Object.keys(pkg.currentDependencies) .filter(id => !!manifest.dependencies[id]) .map(id => this.getDepValues(pkg, manifest, id, depErrors)) } @@ -103,11 +103,11 @@ export class AppShowPage { depErrors, ) - const depInfo = pkg['dependency-info'][depId] + const depInfo = pkg.dependencyInfo[depId] return { id: depId, - version: pkg['current-dependencies'][depId].versionRange, // @TODO do we want this version range? + version: pkg.currentDependencies[depId].versionRange, // @TODO do we want this version range? title: depInfo?.title || depId, icon: depInfo?.icon || '', errorText: errorText @@ -184,7 +184,7 @@ export class AppShowPage { const dependentInfo: DependentInfo = { id: pkgManifest.id, title: pkgManifest.title, - version: pkg['current-dependencies'][depId].versionRange, + version: pkg.currentDependencies[depId].versionRange, } const navigationExtras: NavigationExtras = { state: { dependentInfo }, diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-additional/app-show-additional.component.html b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-additional/app-show-additional.component.html index 240eccff2..73fc2158b 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-additional/app-show-additional.component.html +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-additional/app-show-additional.component.html @@ -10,7 +10,7 @@

Marketing Site

-

{{ manifest['marketing-site'] || 'Not provided' }}

+

{{ manifest.marketingSite || 'Not provided' }}

@@ -54,52 +54,52 @@

Source Repository

-

{{ manifest['upstream-repo'] }}

+

{{ manifest.upstreamRepo }}

Wrapper Repository

-

{{ manifest['wrapper-repo'] }}

+

{{ manifest.wrapperRepo }}

Support Site

-

{{ manifest['support-site'] || 'Not provided' }}

+

{{ manifest.supportSite || 'Not provided' }}

Donation Link

-

{{ manifest['donation-url'] || 'Not provided' }}

+

{{ manifest.donationUrl || 'Not provided' }}

diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.html b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.html index 4521f8e5e..f9db34c73 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.html +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.html @@ -4,7 +4,7 @@ @@ -60,7 +60,7 @@ class="action-button" color="primary" [disabled]=" - !(pkg['state-info'].state | isLaunchable: pkgStatus.main.status) + !(pkg.stateInfo.state | isLaunchable: pkgStatus.main.status) " (click)="launchUi(interfaces)" > diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.ts b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.ts index 6f26d2eb6..2a1c47af7 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/components/app-show-status/app-show-status.component.ts @@ -55,8 +55,8 @@ export class AppShowStatusComponent { private readonly patch: PatchDB, ) {} - get interfaces(): PackageDataEntry['service-interfaces'] { - return this.pkg['service-interfaces'] + get interfaces(): PackageDataEntry['serviceInterfaces'] { + return this.pkg.serviceInterfaces } get pkgStatus(): Status { @@ -89,7 +89,7 @@ export class AppShowStatusComponent { : null } - launchUi(interfaces: PackageDataEntry['service-interfaces']): void { + launchUi(interfaces: PackageDataEntry['serviceInterfaces']): void { this.launcherService.launch(interfaces) } diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/pipes/to-buttons.pipe.ts b/web/projects/ui/src/app/pages/apps-routes/app-show/pipes/to-buttons.pipe.ts index 2eda6f296..f26addee9 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/pipes/to-buttons.pipe.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/pipes/to-buttons.pipe.ts @@ -36,7 +36,7 @@ export class ToButtonsPipe implements PipeTransform { ) {} transform(pkg: PackageDataEntry): Button[] { - const manifest = pkg['state-info'].manifest + const manifest = pkg.stateInfo.manifest return [ // instructions @@ -46,7 +46,7 @@ export class ToButtonsPipe implements PipeTransform { description: `Understand how to use ${manifest.title}`, icon: 'list-outline', highlighted$: this.patch - .watch$('ui', 'ack-instructions', manifest.id) + .watch$('ui', 'ackInstructions', manifest.id) .pipe(map(seen => !seen)), }, // config @@ -122,7 +122,7 @@ export class ToButtonsPipe implements PipeTransform { private viewInMarketplaceButton( pkg: PackageDataEntry, ): Button { - const url = pkg['marketplace-url'] + const url = pkg.marketplaceUrl const queryParams = url ? { url } : {} let button: Button = { @@ -130,7 +130,7 @@ export class ToButtonsPipe implements PipeTransform { icon: 'storefront-outline', action: () => this.navCtrl.navigateForward( - [`marketplace/${pkg['state-info'].manifest.id}`], + [`marketplace/${pkg.stateInfo.manifest.id}`], { queryParams, }, diff --git a/web/projects/ui/src/app/pages/apps-routes/app-show/pipes/to-health-checks.pipe.ts b/web/projects/ui/src/app/pages/apps-routes/app-show/pipes/to-health-checks.pipe.ts index e099cb356..98265152b 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-show/pipes/to-health-checks.pipe.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-show/pipes/to-health-checks.pipe.ts @@ -19,16 +19,14 @@ export class ToHealthChecksPipe implements PipeTransform { transform( manifest: Manifest, ): Observable | null> { - return this.patch - .watch$('package-data', manifest.id, 'status', 'main') - .pipe( - map(main => { - return main.status === PackageMainStatus.Running && - !isEmptyObject(main.health) - ? main.health - : null - }), - startWith(null), - ) + return this.patch.watch$('packageData', manifest.id, 'status', 'main').pipe( + map(main => { + return main.status === PackageMainStatus.Running && + !isEmptyObject(main.health) + ? main.health + : null + }), + startWith(null), + ) } } diff --git a/web/projects/ui/src/app/pages/developer-routes/dev-config/dev-config.module.ts b/web/projects/ui/src/app/pages/developer-routes/dev-config/dev-config.module.ts deleted file mode 100644 index 649ab7dfc..000000000 --- a/web/projects/ui/src/app/pages/developer-routes/dev-config/dev-config.module.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { NgModule } from '@angular/core' -import { CommonModule } from '@angular/common' -import { IonicModule } from '@ionic/angular' -import { RouterModule, Routes } from '@angular/router' -import { DevConfigPage } from './dev-config.page' -import { BadgeMenuComponentModule } from 'src/app/components/badge-menu-button/badge-menu.component.module' -import { BackupReportPageModule } from 'src/app/modals/backup-report/backup-report.module' -import { FormsModule } from '@angular/forms' -import { MonacoEditorModule } from '@materia-ui/ngx-monaco-editor' - -const routes: Routes = [ - { - path: '', - component: DevConfigPage, - }, -] - -@NgModule({ - imports: [ - CommonModule, - IonicModule, - RouterModule.forChild(routes), - BadgeMenuComponentModule, - BackupReportPageModule, - FormsModule, - MonacoEditorModule, - ], - declarations: [DevConfigPage], -}) -export class DevConfigPageModule {} diff --git a/web/projects/ui/src/app/pages/developer-routes/dev-config/dev-config.page.html b/web/projects/ui/src/app/pages/developer-routes/dev-config/dev-config.page.html deleted file mode 100644 index 334236d1e..000000000 --- a/web/projects/ui/src/app/pages/developer-routes/dev-config/dev-config.page.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - Config - - - - Preview - - - - - - - diff --git a/web/projects/ui/src/app/pages/developer-routes/dev-config/dev-config.page.scss b/web/projects/ui/src/app/pages/developer-routes/dev-config/dev-config.page.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/web/projects/ui/src/app/pages/developer-routes/dev-config/dev-config.page.ts b/web/projects/ui/src/app/pages/developer-routes/dev-config/dev-config.page.ts deleted file mode 100644 index 6dc4c7e13..000000000 --- a/web/projects/ui/src/app/pages/developer-routes/dev-config/dev-config.page.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { Component } from '@angular/core' -import { ActivatedRoute } from '@angular/router' -import { ModalController } from '@ionic/angular' -import { debounce, ErrorToastService } from '@start9labs/shared' -import * as yaml from 'js-yaml' -import { filter, take } from 'rxjs/operators' -import { ApiService } from 'src/app/services/api/embassy-api.service' -import { PatchDB } from 'patch-db-client' -import { getProjectId } from 'src/app/util/get-project-id' -import { GenericFormPage } from '../../../modals/generic-form/generic-form.page' -import { DataModel } from 'src/app/services/patch-db/data-model' - -@Component({ - selector: 'dev-config', - templateUrl: 'dev-config.page.html', - styleUrls: ['dev-config.page.scss'], -}) -export class DevConfigPage { - readonly projectId = getProjectId(this.route) - editorOptions = { theme: 'vs-dark', language: 'yaml' } - code: string = '' - saving: boolean = false - - constructor( - private readonly route: ActivatedRoute, - private readonly errToast: ErrorToastService, - private readonly modalCtrl: ModalController, - private readonly patch: PatchDB, - private readonly api: ApiService, - ) {} - - ngOnInit() { - this.patch - .watch$('ui', 'dev', this.projectId, 'config') - .pipe(filter(Boolean), take(1)) - .subscribe(config => { - this.code = config - }) - } - - async preview() { - let doc: any - try { - doc = yaml.load(this.code) - } catch (e: any) { - this.errToast.present(e) - } - - const modal = await this.modalCtrl.create({ - component: GenericFormPage, - componentProps: { - title: 'Config Sample', - spec: JSON.parse(JSON.stringify(doc, null, 2)), - buttons: [ - { - text: 'OK', - handler: () => { - return - }, - isSubmit: true, - }, - ], - }, - }) - await modal.present() - } - - @debounce(1000) - async save() { - this.saving = true - try { - await this.api.setDbValue( - ['dev', this.projectId, 'config'], - this.code, - ) - } catch (e: any) { - this.errToast.present(e) - } finally { - this.saving = false - } - } -} diff --git a/web/projects/ui/src/app/pages/developer-routes/dev-instructions/dev-instructions.module.ts b/web/projects/ui/src/app/pages/developer-routes/dev-instructions/dev-instructions.module.ts deleted file mode 100644 index ce15130e5..000000000 --- a/web/projects/ui/src/app/pages/developer-routes/dev-instructions/dev-instructions.module.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { NgModule } from '@angular/core' -import { CommonModule } from '@angular/common' -import { IonicModule } from '@ionic/angular' -import { RouterModule, Routes } from '@angular/router' -import { DevInstructionsPage } from './dev-instructions.page' -import { BadgeMenuComponentModule } from 'src/app/components/badge-menu-button/badge-menu.component.module' -import { BackupReportPageModule } from 'src/app/modals/backup-report/backup-report.module' -import { FormsModule } from '@angular/forms' -import { MonacoEditorModule } from '@materia-ui/ngx-monaco-editor' - -const routes: Routes = [ - { - path: '', - component: DevInstructionsPage, - }, -] - -@NgModule({ - imports: [ - CommonModule, - IonicModule, - RouterModule.forChild(routes), - BadgeMenuComponentModule, - BackupReportPageModule, - FormsModule, - MonacoEditorModule, - ], - declarations: [DevInstructionsPage], -}) -export class DevInstructionsPageModule {} diff --git a/web/projects/ui/src/app/pages/developer-routes/dev-instructions/dev-instructions.page.html b/web/projects/ui/src/app/pages/developer-routes/dev-instructions/dev-instructions.page.html deleted file mode 100644 index 8775ec175..000000000 --- a/web/projects/ui/src/app/pages/developer-routes/dev-instructions/dev-instructions.page.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - Instructions - - - - Preview - - - - - - - diff --git a/web/projects/ui/src/app/pages/developer-routes/dev-instructions/dev-instructions.page.scss b/web/projects/ui/src/app/pages/developer-routes/dev-instructions/dev-instructions.page.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/web/projects/ui/src/app/pages/developer-routes/dev-instructions/dev-instructions.page.ts b/web/projects/ui/src/app/pages/developer-routes/dev-instructions/dev-instructions.page.ts deleted file mode 100644 index bf3fa0b56..000000000 --- a/web/projects/ui/src/app/pages/developer-routes/dev-instructions/dev-instructions.page.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { Component } from '@angular/core' -import { ActivatedRoute } from '@angular/router' -import { ModalController } from '@ionic/angular' -import { filter, take } from 'rxjs/operators' -import { ApiService } from 'src/app/services/api/embassy-api.service' -import { - debounce, - ErrorToastService, - MarkdownComponent, -} from '@start9labs/shared' -import { PatchDB } from 'patch-db-client' -import { getProjectId } from 'src/app/util/get-project-id' -import { DataModel } from 'src/app/services/patch-db/data-model' - -@Component({ - selector: 'dev-instructions', - templateUrl: 'dev-instructions.page.html', - styleUrls: ['dev-instructions.page.scss'], -}) -export class DevInstructionsPage { - readonly projectId = getProjectId(this.route) - editorOptions = { theme: 'vs-dark', language: 'markdown' } - code = '' - saving = false - - constructor( - private readonly route: ActivatedRoute, - private readonly errToast: ErrorToastService, - private readonly modalCtrl: ModalController, - private readonly patch: PatchDB, - private readonly api: ApiService, - ) {} - - ngOnInit() { - this.patch - .watch$('ui', 'dev', this.projectId, 'instructions') - .pipe(filter(Boolean), take(1)) - .subscribe(config => { - this.code = config - }) - } - - async preview() { - const modal = await this.modalCtrl.create({ - componentProps: { - title: 'Instructions Sample', - content: this.code, - }, - component: MarkdownComponent, - }) - - await modal.present() - } - - @debounce(1000) - async save() { - this.saving = true - try { - await this.api.setDbValue( - ['dev', this.projectId, 'instructions'], - this.code, - ) - } catch (e: any) { - this.errToast.present(e) - } finally { - this.saving = false - } - } -} diff --git a/web/projects/ui/src/app/pages/developer-routes/dev-manifest/dev-manifest.module.ts b/web/projects/ui/src/app/pages/developer-routes/dev-manifest/dev-manifest.module.ts deleted file mode 100644 index 49d738fe8..000000000 --- a/web/projects/ui/src/app/pages/developer-routes/dev-manifest/dev-manifest.module.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { NgModule } from '@angular/core' -import { CommonModule } from '@angular/common' -import { IonicModule } from '@ionic/angular' -import { RouterModule, Routes } from '@angular/router' -import { DevManifestPage } from './dev-manifest.page' -import { BadgeMenuComponentModule } from 'src/app/components/badge-menu-button/badge-menu.component.module' -import { BackupReportPageModule } from 'src/app/modals/backup-report/backup-report.module' -import { FormsModule } from '@angular/forms' -import { MonacoEditorModule } from '@materia-ui/ngx-monaco-editor' - -const routes: Routes = [ - { - path: '', - component: DevManifestPage, - }, -] - -@NgModule({ - imports: [ - CommonModule, - IonicModule, - RouterModule.forChild(routes), - BadgeMenuComponentModule, - BackupReportPageModule, - FormsModule, - MonacoEditorModule, - ], - declarations: [DevManifestPage], -}) -export class DevManifestPageModule {} diff --git a/web/projects/ui/src/app/pages/developer-routes/dev-manifest/dev-manifest.page.html b/web/projects/ui/src/app/pages/developer-routes/dev-manifest/dev-manifest.page.html deleted file mode 100644 index 595adb6c3..000000000 --- a/web/projects/ui/src/app/pages/developer-routes/dev-manifest/dev-manifest.page.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - Manifest - - - - - - diff --git a/web/projects/ui/src/app/pages/developer-routes/dev-manifest/dev-manifest.page.scss b/web/projects/ui/src/app/pages/developer-routes/dev-manifest/dev-manifest.page.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/web/projects/ui/src/app/pages/developer-routes/dev-manifest/dev-manifest.page.ts b/web/projects/ui/src/app/pages/developer-routes/dev-manifest/dev-manifest.page.ts deleted file mode 100644 index f039abbd8..000000000 --- a/web/projects/ui/src/app/pages/developer-routes/dev-manifest/dev-manifest.page.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Component } from '@angular/core' -import { ActivatedRoute } from '@angular/router' -import * as yaml from 'js-yaml' -import { take } from 'rxjs/operators' -import { PatchDB } from 'patch-db-client' -import { getProjectId } from 'src/app/util/get-project-id' -import { DataModel } from 'src/app/services/patch-db/data-model' - -@Component({ - selector: 'dev-manifest', - templateUrl: 'dev-manifest.page.html', - styleUrls: ['dev-manifest.page.scss'], -}) -export class DevManifestPage { - readonly projectId = getProjectId(this.route) - editorOptions = { theme: 'vs-dark', language: 'yaml', readOnly: true } - manifest: string = '' - - constructor( - private readonly route: ActivatedRoute, - private readonly patch: PatchDB, - ) {} - - ngOnInit() { - this.patch - .watch$('ui', 'dev', this.projectId) - .pipe(take(1)) - .subscribe(devData => { - this.manifest = yaml.dump(devData['basic-info']) - }) - } -} diff --git a/web/projects/ui/src/app/pages/developer-routes/developer-list/developer-list.module.ts b/web/projects/ui/src/app/pages/developer-routes/developer-list/developer-list.module.ts deleted file mode 100644 index ea0c78423..000000000 --- a/web/projects/ui/src/app/pages/developer-routes/developer-list/developer-list.module.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { NgModule } from '@angular/core' -import { CommonModule } from '@angular/common' -import { IonicModule } from '@ionic/angular' -import { RouterModule, Routes } from '@angular/router' -import { DeveloperListPage } from './developer-list.page' -import { BadgeMenuComponentModule } from 'src/app/components/badge-menu-button/badge-menu.component.module' -import { BackupReportPageModule } from 'src/app/modals/backup-report/backup-report.module' - -const routes: Routes = [ - { - path: '', - component: DeveloperListPage, - }, -] - -@NgModule({ - imports: [ - CommonModule, - IonicModule, - RouterModule.forChild(routes), - BadgeMenuComponentModule, - BackupReportPageModule, - ], - declarations: [DeveloperListPage], -}) -export class DeveloperListPageModule {} diff --git a/web/projects/ui/src/app/pages/developer-routes/developer-list/developer-list.page.html b/web/projects/ui/src/app/pages/developer-routes/developer-list/developer-list.page.html deleted file mode 100644 index e00330448..000000000 --- a/web/projects/ui/src/app/pages/developer-routes/developer-list/developer-list.page.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - Developer Tools - - - - - - - - Projects - - - - - Create project - - - - -

{{ entry.value.name }}

- - - -
-
diff --git a/web/projects/ui/src/app/pages/developer-routes/developer-list/developer-list.page.scss b/web/projects/ui/src/app/pages/developer-routes/developer-list/developer-list.page.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/web/projects/ui/src/app/pages/developer-routes/developer-list/developer-list.page.ts b/web/projects/ui/src/app/pages/developer-routes/developer-list/developer-list.page.ts deleted file mode 100644 index 96aa6126a..000000000 --- a/web/projects/ui/src/app/pages/developer-routes/developer-list/developer-list.page.ts +++ /dev/null @@ -1,266 +0,0 @@ -import { Component } from '@angular/core' -import { - ActionSheetButton, - ActionSheetController, - AlertController, - LoadingController, - ModalController, -} from '@ionic/angular' -import { - GenericInputComponent, - GenericInputOptions, -} from 'src/app/modals/generic-input/generic-input.component' -import { PatchDB } from 'patch-db-client' -import { ApiService } from 'src/app/services/api/embassy-api.service' -import { ConfigSpec } from 'src/app/pkg-config/config-types' -import * as yaml from 'js-yaml' -import { v4 } from 'uuid' -import { DataModel, DevData } from 'src/app/services/patch-db/data-model' -import { ErrorToastService } from '@start9labs/shared' -import { TuiDestroyService } from '@taiga-ui/cdk' -import { takeUntil } from 'rxjs/operators' - -@Component({ - selector: 'developer-list', - templateUrl: 'developer-list.page.html', - styleUrls: ['developer-list.page.scss'], - providers: [TuiDestroyService], -}) -export class DeveloperListPage { - devData: DevData = {} - - constructor( - private readonly modalCtrl: ModalController, - private readonly api: ApiService, - private readonly loadingCtrl: LoadingController, - private readonly errToast: ErrorToastService, - private readonly alertCtrl: AlertController, - private readonly destroy$: TuiDestroyService, - private readonly patch: PatchDB, - private readonly actionCtrl: ActionSheetController, - ) {} - - ngOnInit() { - this.patch - .watch$('ui', 'dev') - .pipe(takeUntil(this.destroy$)) - .subscribe(dd => { - this.devData = dd - }) - } - - async openCreateProjectModal() { - const projNumber = Object.keys(this.devData).length + 1 - const options: GenericInputOptions = { - title: 'Add new project', - message: 'Create a new dev project.', - label: 'New project', - useMask: false, - placeholder: `Project ${projNumber}`, - nullable: true, - initialValue: `Project ${projNumber}`, - buttonText: 'Save', - submitFn: (value: string) => this.createProject(value), - } - - const modal = await this.modalCtrl.create({ - componentProps: { options }, - cssClass: 'alertlike-modal', - presentingElement: await this.modalCtrl.getTop(), - component: GenericInputComponent, - }) - - await modal.present() - } - - async presentAction(id: string, event: Event) { - event.stopPropagation() - event.preventDefault() - const buttons: ActionSheetButton[] = [ - { - text: 'Edit Name', - icon: 'pencil', - handler: () => { - this.openEditNameModal(id) - }, - }, - { - text: 'Delete', - icon: 'trash', - role: 'destructive', - handler: () => { - this.presentAlertDelete(id) - }, - }, - ] - - const action = await this.actionCtrl.create({ - header: this.devData[id].name, - subHeader: 'Manage project', - mode: 'ios', - buttons, - }) - - await action.present() - } - - async openEditNameModal(id: string) { - const curName = this.devData[id].name - const options: GenericInputOptions = { - title: 'Edit Name', - message: 'Edit the name of your project.', - label: 'Name', - useMask: false, - placeholder: curName, - nullable: true, - initialValue: curName, - buttonText: 'Save', - submitFn: (value: string) => this.editName(id, value), - } - - const modal = await this.modalCtrl.create({ - componentProps: { options }, - cssClass: 'alertlike-modal', - presentingElement: await this.modalCtrl.getTop(), - component: GenericInputComponent, - }) - - await modal.present() - } - - async createProject(name: string) { - // fail silently if duplicate project name - if ( - Object.values(this.devData) - .map(v => v.name) - .includes(name) - ) - return - - const loader = await this.loadingCtrl.create({ - message: 'Creating Project...', - }) - await loader.present() - - try { - const id = v4() - const config = yaml - .dump(SAMPLE_CONFIG) - .replace(/warning:/g, '# Optional\n warning:') - - const def = { name, config, instructions: SAMPLE_INSTUCTIONS } - await this.api.setDbValue<{ - name: string - config: string - instructions: string - }>(['dev', id], def) - } catch (e: any) { - this.errToast.present(e) - } finally { - loader.dismiss() - } - } - - async presentAlertDelete(id: string) { - const alert = await this.alertCtrl.create({ - header: 'Caution', - message: `Are you sure you want to delete this project?`, - buttons: [ - { - text: 'Cancel', - role: 'cancel', - }, - { - text: 'Delete', - handler: () => { - this.delete(id) - }, - cssClass: 'enter-click', - }, - ], - }) - await alert.present() - } - - async editName(id: string, newName: string) { - const loader = await this.loadingCtrl.create({ - message: 'Saving...', - }) - await loader.present() - - try { - await this.api.setDbValue(['dev', id, 'name'], newName) - } catch (e: any) { - this.errToast.present(e) - } finally { - loader.dismiss() - } - } - - async delete(id: string) { - const loader = await this.loadingCtrl.create({ - message: 'Removing Project...', - }) - await loader.present() - - try { - const devDataToSave: DevData = JSON.parse(JSON.stringify(this.devData)) - delete devDataToSave[id] - await this.api.setDbValue(['dev'], devDataToSave) - } catch (e: any) { - this.errToast.present(e) - } finally { - loader.dismiss() - } - } -} - -const SAMPLE_INSTUCTIONS = `# Create Instructions using Markdown! :)` - -const SAMPLE_CONFIG: ConfigSpec = { - 'sample-string': { - type: 'string', - name: 'Example String Input', - nullable: false, - masked: false, - copyable: false, - // optional - description: 'Example description for required string input.', - placeholder: 'Enter string value', - pattern: '^[a-zA-Z0-9! _]+$', - 'pattern-description': 'Must be alphanumeric (may contain underscore).', - }, - 'sample-number': { - type: 'number', - name: 'Example Number Input', - nullable: false, - range: '[5,1000000]', - integral: true, - // optional - warning: 'Example warning to display when changing this number value.', - units: 'ms', - description: 'Example description for optional number input.', - placeholder: 'Enter number value', - }, - 'sample-boolean': { - type: 'boolean', - name: 'Example Boolean Toggle', - // optional - description: 'Example description for boolean toggle', - default: true, - }, - 'sample-enum': { - type: 'enum', - name: 'Example Enum Select', - values: ['red', 'blue', 'green'], - 'value-names': { - red: 'Red', - blue: 'Blue', - green: 'Green', - }, - // optional - warning: 'Example warning to display when changing this enum value.', - description: 'Example description for enum select', - default: 'red', - }, -} diff --git a/web/projects/ui/src/app/pages/developer-routes/developer-menu/developer-menu.module.ts b/web/projects/ui/src/app/pages/developer-routes/developer-menu/developer-menu.module.ts deleted file mode 100644 index d33ecf47f..000000000 --- a/web/projects/ui/src/app/pages/developer-routes/developer-menu/developer-menu.module.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { NgModule } from '@angular/core' -import { CommonModule } from '@angular/common' -import { IonicModule } from '@ionic/angular' -import { RouterModule, Routes } from '@angular/router' -import { DeveloperMenuPage } from './developer-menu.page' -import { BadgeMenuComponentModule } from 'src/app/components/badge-menu-button/badge-menu.component.module' -import { BackupReportPageModule } from 'src/app/modals/backup-report/backup-report.module' -import { GenericFormPageModule } from 'src/app/modals/generic-form/generic-form.module' -import { MonacoEditorModule } from '@materia-ui/ngx-monaco-editor' -import { FormsModule } from '@angular/forms' -import { SharedPipesModule } from '@start9labs/shared' - -const routes: Routes = [ - { - path: '', - component: DeveloperMenuPage, - }, -] - -@NgModule({ - imports: [ - CommonModule, - IonicModule, - RouterModule.forChild(routes), - BadgeMenuComponentModule, - BackupReportPageModule, - GenericFormPageModule, - FormsModule, - MonacoEditorModule, - SharedPipesModule, - ], - declarations: [DeveloperMenuPage], -}) -export class DeveloperMenuPageModule {} diff --git a/web/projects/ui/src/app/pages/developer-routes/developer-menu/developer-menu.page.html b/web/projects/ui/src/app/pages/developer-routes/developer-menu/developer-menu.page.html deleted file mode 100644 index ee10e7fc6..000000000 --- a/web/projects/ui/src/app/pages/developer-routes/developer-menu/developer-menu.page.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - {{ (projectData$ | async)?.name || '' }} - - View Manifest - - - - - - - - -

Basic Info

-

Complete basic info for your package

-
- - -
- - - -

Instructions Generator

-

Create instructions and see how they will appear to the end user

-
-
- - - -

Config Generator

-

Edit the config with YAML and see it in real time

-
-
-
diff --git a/web/projects/ui/src/app/pages/developer-routes/developer-menu/developer-menu.page.scss b/web/projects/ui/src/app/pages/developer-routes/developer-menu/developer-menu.page.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/web/projects/ui/src/app/pages/developer-routes/developer-menu/developer-menu.page.ts b/web/projects/ui/src/app/pages/developer-routes/developer-menu/developer-menu.page.ts deleted file mode 100644 index 3ae2b394c..000000000 --- a/web/projects/ui/src/app/pages/developer-routes/developer-menu/developer-menu.page.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { ChangeDetectionStrategy, Component } from '@angular/core' -import { ActivatedRoute } from '@angular/router' -import { LoadingController, ModalController } from '@ionic/angular' -import { GenericFormPage } from 'src/app/modals/generic-form/generic-form.page' -import { BasicInfo, getBasicInfoSpec } from './form-info' -import { PatchDB } from 'patch-db-client' -import { ApiService } from 'src/app/services/api/embassy-api.service' -import { ErrorToastService } from '@start9labs/shared' -import { getProjectId } from 'src/app/util/get-project-id' -import { DataModel, DevProjectData } from 'src/app/services/patch-db/data-model' - -@Component({ - selector: 'developer-menu', - templateUrl: 'developer-menu.page.html', - styleUrls: ['developer-menu.page.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class DeveloperMenuPage { - readonly projectId = getProjectId(this.route) - readonly projectData$ = this.patch.watch$('ui', 'dev', this.projectId) - - constructor( - private readonly route: ActivatedRoute, - private readonly modalCtrl: ModalController, - private readonly loadingCtrl: LoadingController, - private readonly api: ApiService, - private readonly errToast: ErrorToastService, - private readonly patch: PatchDB, - ) {} - - async openBasicInfoModal(data: DevProjectData) { - const modal = await this.modalCtrl.create({ - component: GenericFormPage, - componentProps: { - title: 'Basic Info', - spec: getBasicInfoSpec(data), - buttons: [ - { - text: 'Save', - handler: (basicInfo: BasicInfo) => { - this.saveBasicInfo(basicInfo) - }, - isSubmit: true, - }, - ], - }, - }) - await modal.present() - } - - async saveBasicInfo(basicInfo: BasicInfo) { - const loader = await this.loadingCtrl.create({ - message: 'Saving...', - }) - await loader.present() - - try { - await this.api.setDbValue( - ['dev', this.projectId, 'basic-info'], - basicInfo, - ) - } catch (e: any) { - this.errToast.present(e) - } finally { - loader.dismiss() - } - } -} diff --git a/web/projects/ui/src/app/pages/developer-routes/developer-menu/form-info.ts b/web/projects/ui/src/app/pages/developer-routes/developer-menu/form-info.ts deleted file mode 100644 index b8a848f12..000000000 --- a/web/projects/ui/src/app/pages/developer-routes/developer-menu/form-info.ts +++ /dev/null @@ -1,171 +0,0 @@ -import { ConfigSpec } from 'src/app/pkg-config/config-types' -import { DevProjectData } from 'src/app/services/patch-db/data-model' - -export type BasicInfo = { - id: string - title: string - 'service-version-number': string - 'release-notes': string - license: string - 'wrapper-repo': string - 'upstream-repo'?: string - 'support-site'?: string - 'marketing-site'?: string - description: { - short: string - long: string - } -} - -export function getBasicInfoSpec(devData: DevProjectData): ConfigSpec { - const basicInfo = devData['basic-info'] - return { - id: { - type: 'string', - name: 'ID', - description: 'The package identifier used by the OS', - placeholder: 'e.g. bitcoind', - nullable: false, - masked: false, - copyable: false, - pattern: '^([a-z][a-z0-9]*)(-[a-z0-9]+)*$', - 'pattern-description': 'Must be kebab case', - default: basicInfo?.id, - }, - title: { - type: 'string', - name: 'Service Name', - description: 'A human readable service title', - placeholder: 'e.g. Bitcoin Core', - nullable: false, - masked: false, - copyable: false, - default: basicInfo ? basicInfo.title : devData.name, - }, - 'service-version-number': { - type: 'string', - name: 'Service Version', - description: - 'Service version - accepts up to four digits, where the last confirms to revisions necessary for StartOS - see documentation: https://github.com/Start9Labs/emver-rs. This value will change with each release of the service', - placeholder: 'e.g. 0.1.2.3', - nullable: false, - masked: false, - copyable: false, - pattern: '^([0-9]+).([0-9]+).([0-9]+).([0-9]+)$', - 'pattern-description': 'Must be valid Emver version', - default: basicInfo?.['service-version-number'], - }, - description: { - type: 'object', - name: 'Marketplace Descriptions', - spec: { - short: { - type: 'string', - name: 'Short Description', - description: - 'This is the first description visible to the user in the marketplace', - nullable: false, - masked: false, - copyable: false, - textarea: true, - default: basicInfo?.description?.short, - pattern: '^.{1,320}$', - 'pattern-description': 'Must be shorter than 320 characters', - }, - long: { - type: 'string', - name: 'Long Description', - description: `This description will display with additional details in the service's individual marketplace page`, - nullable: false, - masked: false, - copyable: false, - textarea: true, - default: basicInfo?.description?.long, - pattern: '^.{1,5000}$', - 'pattern-description': 'Must be shorter than 5000 characters', - }, - }, - }, - 'release-notes': { - type: 'string', - name: 'Release Notes', - description: - 'Markdown supported release notes for this version of this service.', - placeholder: 'e.g. Markdown _release notes_ for **Bitcoin Core**', - nullable: false, - masked: false, - copyable: false, - textarea: true, - default: basicInfo?.['release-notes'], - }, - license: { - type: 'enum', - name: 'License', - values: [ - 'gnu-agpl-v3', - 'gnu-gpl-v3', - 'gnu-lgpl-v3', - 'mozilla-public-license-2.0', - 'apache-license-2.0', - 'mit', - 'boost-software-license-1.0', - 'the-unlicense', - 'custom', - ], - 'value-names': { - 'gnu-agpl-v3': 'GNU AGPLv3', - 'gnu-gpl-v3': 'GNU GPLv3', - 'gnu-lgpl-v3': 'GNU LGPLv3', - 'mozilla-public-license-2.0': 'Mozilla Public License 2.0', - 'apache-license-2.0': 'Apache License 2.0', - mit: 'mit', - 'boost-software-license-1.0': 'Boost Software License 1.0', - 'the-unlicense': 'The Unlicense', - custom: 'Custom', - }, - description: 'Example description for enum select', - default: 'mit', - }, - 'wrapper-repo': { - type: 'string', - name: 'Wrapper Repo', - description: - 'The Start9 wrapper repository URL for the package. This repo contains the manifest file (this), any scripts necessary for configuration, backups, actions, or health checks', - placeholder: 'e.g. www.github.com/example', - nullable: false, - masked: false, - copyable: false, - default: basicInfo?.['wrapper-repo'], - }, - 'upstream-repo': { - type: 'string', - name: 'Upstream Repo', - description: 'The original project repository URL', - placeholder: 'e.g. www.github.com/example', - nullable: true, - masked: false, - copyable: false, - default: basicInfo?.['upstream-repo'], - }, - 'support-site': { - type: 'string', - name: 'Support Site', - description: 'URL to the support site / channel for the project', - placeholder: 'e.g. start9.com/support', - nullable: true, - masked: false, - copyable: false, - default: basicInfo?.['support-site'], - }, - 'marketing-site': { - type: 'string', - name: 'Marketing Site', - description: 'URL to the marketing site / channel for the project', - placeholder: 'e.g. start9.com', - nullable: true, - masked: false, - copyable: false, - default: basicInfo?.['marketing-site'], - }, - } -} diff --git a/web/projects/ui/src/app/pages/developer-routes/developer-routing.module.ts b/web/projects/ui/src/app/pages/developer-routes/developer-routing.module.ts deleted file mode 100644 index 03720d87d..000000000 --- a/web/projects/ui/src/app/pages/developer-routes/developer-routing.module.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { NgModule } from '@angular/core' -import { Routes, RouterModule } from '@angular/router' - -const routes: Routes = [ - { - path: '', - redirectTo: 'projects', - pathMatch: 'full', - }, - { - path: 'projects', - loadChildren: () => - import('./developer-list/developer-list.module').then( - m => m.DeveloperListPageModule, - ), - }, - { - path: 'projects/:projectId', - loadChildren: () => - import('./developer-menu/developer-menu.module').then( - m => m.DeveloperMenuPageModule, - ), - }, - { - path: 'projects/:projectId/config', - loadChildren: () => - import('./dev-config/dev-config.module').then(m => m.DevConfigPageModule), - }, - { - path: 'projects/:projectId/instructions', - loadChildren: () => - import('./dev-instructions/dev-instructions.module').then( - m => m.DevInstructionsPageModule, - ), - }, - { - path: 'projects/:projectId/manifest', - loadChildren: () => - import('./dev-manifest/dev-manifest.module').then( - m => m.DevManifestPageModule, - ), - }, -] - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule], -}) -export class DeveloperRoutingModule {} diff --git a/web/projects/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.ts b/web/projects/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.ts index 089b66139..6792b917a 100644 --- a/web/projects/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.ts +++ b/web/projects/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.ts @@ -29,7 +29,7 @@ export class MarketplaceListPage { }), ) - readonly localPkgs$ = this.patch.watch$('package-data') + readonly localPkgs$ = this.patch.watch$('packageData') readonly details$ = this.marketplaceService.getSelectedHost$().pipe( map(({ url, name }) => { diff --git a/web/projects/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show-controls/marketplace-show-controls.component.html b/web/projects/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show-controls/marketplace-show-controls.component.html index a1edbb593..6995dde5e 100644 --- a/web/projects/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show-controls/marketplace-show-controls.component.html +++ b/web/projects/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show-controls/marketplace-show-controls.component.html @@ -10,7 +10,7 @@ diff --git a/web/projects/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show-controls/marketplace-show-controls.component.ts b/web/projects/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show-controls/marketplace-show-controls.component.ts index af605a8a9..10717cc19 100644 --- a/web/projects/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show-controls/marketplace-show-controls.component.ts +++ b/web/projects/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show-controls/marketplace-show-controls.component.ts @@ -66,7 +66,7 @@ export class MarketplaceShowControlsComponent { if (!this.localPkg) { this.alertInstall(url) } else { - const originalUrl = this.localPkg['marketplace-url'] + const originalUrl = this.localPkg.marketplaceUrl if (!sameUrl(url, originalUrl)) { const proceed = await this.presentAlertDifferentMarketplace( @@ -98,12 +98,11 @@ export class MarketplaceShowControlsComponent { this.patch.watch$('ui', 'marketplace'), ) - const name: string = marketplaces['known-hosts'][url]?.name || url + const name: string = marketplaces.knownHosts[url]?.name || url let originalName: string | undefined if (originalUrl) { - originalName = - marketplaces['known-hosts'][originalUrl]?.name || originalUrl + originalName = marketplaces.knownHosts[originalUrl]?.name || originalUrl } return new Promise(async resolve => { diff --git a/web/projects/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show.page.ts b/web/projects/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show.page.ts index dcb6e48d1..876e71924 100644 --- a/web/projects/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show.page.ts +++ b/web/projects/ui/src/app/pages/marketplace-routes/marketplace-show/marketplace-show.page.ts @@ -20,7 +20,7 @@ export class MarketplaceShowPage { readonly loadVersion$ = new BehaviorSubject('*') readonly localPkg$ = this.patch - .watch$('package-data', this.pkgId) + .watch$('packageData', this.pkgId) .pipe(filter(Boolean), shareReplay({ bufferSize: 1, refCount: true })) readonly pkg$ = this.loadVersion$.pipe( diff --git a/web/projects/ui/src/app/pages/marketplace-routes/marketplace-status/marketplace-status.component.html b/web/projects/ui/src/app/pages/marketplace-routes/marketplace-status/marketplace-status.component.html index c76c5138a..8958cdda2 100644 --- a/web/projects/ui/src/app/pages/marketplace-routes/marketplace-status/marketplace-status.component.html +++ b/web/projects/ui/src/app/pages/marketplace-routes/marketplace-status/marketplace-status.component.html @@ -28,7 +28,7 @@ >

- + {{ packageData[pkgId] ? (packageData[pkgId] | toManifest).title : pkgId }} - @@ -104,7 +104,7 @@ View Full Message

-

{{ not['created-at'] | date: 'medium' }}

+

{{ not.createdAt | date: 'medium' }}

View Service diff --git a/web/projects/ui/src/app/pages/notifications/notifications.page.ts b/web/projects/ui/src/app/pages/notifications/notifications.page.ts index 71bf50370..933c50e67 100644 --- a/web/projects/ui/src/app/pages/notifications/notifications.page.ts +++ b/web/projects/ui/src/app/pages/notifications/notifications.page.ts @@ -29,7 +29,7 @@ export class NotificationsPage { needInfinite = false fromToast = !!this.route.snapshot.queryParamMap.get('toast') readonly perPage = 40 - readonly packageData$ = this.patch.watch$('package-data').pipe(first()) + readonly packageData$ = this.patch.watch$('packageData').pipe(first()) constructor( private readonly embassyApi: ApiService, @@ -116,7 +116,7 @@ export class NotificationsPage { component: BackupReportPage, componentProps: { report: notification.data, - timestamp: notification['created-at'], + timestamp: notification.createdAt, }, }) await modal.present() diff --git a/web/projects/ui/src/app/pages/server-routes/restore/restore.component.ts b/web/projects/ui/src/app/pages/server-routes/restore/restore.component.ts index 24adff639..88e9cb4a8 100644 --- a/web/projects/ui/src/app/pages/server-routes/restore/restore.component.ts +++ b/web/projects/ui/src/app/pages/server-routes/restore/restore.component.ts @@ -43,7 +43,7 @@ export class RestorePage { useMask: true, buttonText: 'Next', submitFn: async (password: string) => { - const passwordHash = target.entry['embassy-os']?.['password-hash'] || '' + const passwordHash = target.entry.startOs?.passwordHash || '' argon2.verify(passwordHash, password) await this.restoreFromBackup(target, password) }, @@ -71,7 +71,7 @@ export class RestorePage { try { const backupInfo = await this.embassyApi.getBackupInfo({ - 'target-id': target.id, + targetId: target.id, password, }) this.presentModalSelect(target.id, backupInfo, password, oldPassword) diff --git a/web/projects/ui/src/app/pages/server-routes/server-backup/backing-up/backing-up.component.ts b/web/projects/ui/src/app/pages/server-routes/server-backup/backing-up/backing-up.component.ts index 125e9f28e..31d3bce1e 100644 --- a/web/projects/ui/src/app/pages/server-routes/server-backup/backing-up/backing-up.component.ts +++ b/web/projects/ui/src/app/pages/server-routes/server-backup/backing-up/backing-up.component.ts @@ -18,11 +18,11 @@ import { Observable } from 'rxjs' changeDetection: ChangeDetectionStrategy.OnPush, }) export class BackingUpComponent { - readonly pkgs$ = this.patch.watch$('package-data').pipe(take(1)) + readonly pkgs$ = this.patch.watch$('packageData').pipe(take(1)) readonly backupProgress$ = this.patch.watch$( - 'server-info', - 'status-info', - 'backup-progress', + 'serverInfo', + 'statusInfo', + 'backupProgress', ) constructor(private readonly patch: PatchDB) {} @@ -33,7 +33,7 @@ export class BackingUpComponent { }) export class PkgMainStatusPipe implements PipeTransform { transform(pkgId: string): Observable { - return this.patch.watch$('package-data', pkgId, 'status', 'main', 'status') + return this.patch.watch$('packageData', pkgId, 'status', 'main', 'status') } constructor(private readonly patch: PatchDB) {} diff --git a/web/projects/ui/src/app/pages/server-routes/server-backup/server-backup.page.ts b/web/projects/ui/src/app/pages/server-routes/server-backup/server-backup.page.ts index 2d4d3901e..0467df102 100644 --- a/web/projects/ui/src/app/pages/server-routes/server-backup/server-backup.page.ts +++ b/web/projects/ui/src/app/pages/server-routes/server-backup/server-backup.page.ts @@ -84,9 +84,7 @@ export class ServerBackupPage { buttonText: 'Create Backup', submitFn: async (password: string) => { // confirm password matches current master password - const { 'password-hash': passwordHash } = await getServerInfo( - this.patch, - ) + const { passwordHash } = await getServerInfo(this.patch) argon2.verify(passwordHash, password) // first time backup @@ -95,8 +93,7 @@ export class ServerBackupPage { // existing backup } else { try { - const passwordHash = - target.entry['embassy-os']?.['password-hash'] || '' + const passwordHash = target.entry.startOs?.passwordHash || '' argon2.verify(passwordHash, password) } catch { @@ -133,7 +130,7 @@ export class ServerBackupPage { useMask: true, buttonText: 'Create Backup', submitFn: async (oldPassword: string) => { - const passwordHash = target.entry['embassy-os']?.['password-hash'] || '' + const passwordHash = target.entry.startOs?.passwordHash || '' argon2.verify(passwordHash, oldPassword) await this.createBackup(target, password, oldPassword) @@ -161,9 +158,9 @@ export class ServerBackupPage { try { await this.embassyApi.createBackup({ - 'target-id': target.id, - 'package-ids': this.serviceIds, - 'old-password': oldPassword || null, + targetId: target.id, + packageIds: this.serviceIds, + oldPassword: oldPassword || null, password, }) } finally { diff --git a/web/projects/ui/src/app/pages/server-routes/server-metrics/server-metrics.page.html b/web/projects/ui/src/app/pages/server-routes/server-metrics/server-metrics.page.html index 0926334aa..70b977ecc 100644 --- a/web/projects/ui/src/app/pages/server-routes/server-metrics/server-metrics.page.html +++ b/web/projects/ui/src/app/pages/server-routes/server-metrics/server-metrics.page.html @@ -74,7 +74,7 @@ Memory Percentage Used - {{ memory['percentage-used'].value }} % + {{ memory.percentageUsed }} % Total @@ -94,15 +94,15 @@ zram Used - {{ memory['zram-used'].value }} MiB + {{ memory.zramUsed.value }} MiB zram Total - {{ memory['zram-total'].value }} MiB + {{ memory.zramTotal }} MiB zram Available - {{ memory['zram-available'].value }} MiB + {{ memory.available.value }} MiB @@ -110,18 +110,18 @@ CPU Percentage Used - {{ cpu['percentage-used'].value }} % + {{ cpu.percentageUsed.value }} % User Space - {{ cpu['user-space'].value }} % + {{ cpu.userSpace.value }} % Kernel Space - {{ cpu['kernel-space'].value }} % + {{ cpu.kernelSpace.value }} % @@ -138,7 +138,7 @@ Disk Percentage Used - {{ disk['percentage-used'].value }} % + {{ disk.percentageUsed.value }} % Capacity diff --git a/web/projects/ui/src/app/pages/server-routes/server-show/server-show.page.html b/web/projects/ui/src/app/pages/server-routes/server-show/server-show.page.html index f16066874..02cba9052 100644 --- a/web/projects/ui/src/app/pages/server-routes/server-show/server-show.page.html +++ b/web/projects/ui/src/app/pages/server-routes/server-show/server-show.page.html @@ -16,7 +16,7 @@ @@ -62,15 +62,15 @@

- + - Last Backup: {{ server['last-backup'] ? (server['last-backup'] | - date: 'medium') : 'never' }} + Last Backup: {{ server.lastBackup ? (server.lastBackup | date: + 'medium') : 'never' }} - +

diff --git a/web/projects/ui/src/app/pages/server-routes/server-show/server-show.page.ts b/web/projects/ui/src/app/pages/server-routes/server-show/server-show.page.ts index ff9cfc775..b479f1750 100644 --- a/web/projects/ui/src/app/pages/server-routes/server-show/server-show.page.ts +++ b/web/projects/ui/src/app/pages/server-routes/server-show/server-show.page.ts @@ -37,7 +37,7 @@ export class ServerShowPage { manageClicks = 0 powerClicks = 0 - readonly server$ = this.patch.watch$('server-info') + readonly server$ = this.patch.watch$('serverInfo') readonly showUpdate$ = this.eosService.showUpdate$ readonly showDiskRepair$ = this.ClientStorageService.showDiskRepair$ @@ -141,7 +141,7 @@ export class ServerShowPage { } // confirm current password is correct - const { 'password-hash': passwordHash } = await getServerInfo(this.patch) + const { passwordHash } = await getServerInfo(this.patch) try { argon2.verify(passwordHash, value.currPass) } catch (e) { @@ -160,8 +160,8 @@ export class ServerShowPage { try { await this.embassyApi.resetPassword({ - 'old-password': value.currPass, - 'new-password': value.newPass, + oldPassword: value.currPass, + newPassword: value.newPass, }) const toast = await this.toastCtrl.create({ header: 'Password changed!', @@ -221,7 +221,7 @@ export class ServerShowPage { try { await this.embassyApi.resetTor({ - 'wipe-state': wipeState, + wipeState: wipeState, reason: 'User triggered', }) const toast = await this.toastCtrl.create({ diff --git a/web/projects/ui/src/app/pages/server-routes/server-specs/server-specs.page.html b/web/projects/ui/src/app/pages/server-routes/server-specs/server-specs.page.html index 87dd8ef24..f9df6eb37 100644 --- a/web/projects/ui/src/app/pages/server-routes/server-specs/server-specs.page.html +++ b/web/projects/ui/src/app/pages/server-routes/server-specs/server-specs.page.html @@ -30,17 +30,17 @@

Tor

-

{{ server['tor-address'] }}

+

{{ server.torAddress }}

- + - +

LAN

-

{{ server['lan-address'] }}

+

{{ server.lanAddress }}

- + - +

{{ iface.key }} (IPv4)

@@ -92,13 +92,9 @@

CA fingerprint

-

{{ server['ca-fingerprint'] }}

+

{{ server.caFingerprint }}

- +
diff --git a/web/projects/ui/src/app/pages/server-routes/server-specs/server-specs.page.ts b/web/projects/ui/src/app/pages/server-routes/server-specs/server-specs.page.ts index c80003bb1..0055ff6c1 100644 --- a/web/projects/ui/src/app/pages/server-routes/server-specs/server-specs.page.ts +++ b/web/projects/ui/src/app/pages/server-routes/server-specs/server-specs.page.ts @@ -13,7 +13,7 @@ import { DataModel } from 'src/app/services/patch-db/data-model' changeDetection: ChangeDetectionStrategy.OnPush, }) export class ServerSpecsPage { - readonly server$ = this.patch.watch$('server-info') + readonly server$ = this.patch.watch$('serverInfo') constructor( private readonly toastCtrl: ToastController, diff --git a/web/projects/ui/src/app/pages/server-routes/sessions/sessions.page.html b/web/projects/ui/src/app/pages/server-routes/sessions/sessions.page.html index 4e291b5fc..3e349b49b 100644 --- a/web/projects/ui/src/app/pages/server-routes/sessions/sessions.page.html +++ b/web/projects/ui/src/app/pages/server-routes/sessions/sessions.page.html @@ -52,10 +52,8 @@ >

{{ getPlatformName(currentSession.metadata.platforms) }}

-

- Last Active: {{ currentSession['last-active'] | date : 'medium' }} -

-

{{ currentSession['user-agent'] }}

+

Last Active: {{ currentSession.lastActive| date : 'medium' }}

+

{{ currentSession.userAgent }}

@@ -80,8 +78,8 @@ >

{{ getPlatformName(session.metadata.platforms) }}

-

Last Active: {{ session['last-active'] | date : 'medium' }}

-

{{ session['user-agent'] }}

+

Last Active: {{ session.lastActive | date : 'medium' }}

+

{{ session.userAgent }}

{ return ( - new Date(b['last-active']).valueOf() - - new Date(a['last-active']).valueOf() + new Date(b.lastActive).valueOf() - new Date(a.lastActive).valueOf() ) }) } catch (e: any) { diff --git a/web/projects/ui/src/app/pages/server-routes/ssh-keys/ssh-keys.page.html b/web/projects/ui/src/app/pages/server-routes/ssh-keys/ssh-keys.page.html index 4ac7d5439..61737639b 100644 --- a/web/projects/ui/src/app/pages/server-routes/ssh-keys/ssh-keys.page.html +++ b/web/projects/ui/src/app/pages/server-routes/ssh-keys/ssh-keys.page.html @@ -66,7 +66,7 @@

{{ ssh.hostname }}

-

{{ ssh['created-at'] | date: 'medium' }}

+

{{ ssh.createdAt| date: 'medium' }}

{{ ssh.alg }} {{ ssh.fingerprint }}

Available Networks - + {{ pkg.manifest.title }}

- {{ local['state-info'].manifest.version | displayEmver - }} + {{ local.stateInfo.manifest.version | displayEmver }}   @@ -57,8 +56,8 @@
What's new
-

+

= combineLatest({ hosts: this.marketplaceService.getKnownHosts$(true), marketplace: this.marketplaceService.getMarketplace$(), - localPkgs: this.patch.watch$('package-data').pipe( + localPkgs: this.patch.watch$('packageData').pipe( map(pkgs => Object.values(pkgs).reduce((acc, curr) => { if (isInstalled(curr) || isUpdating(curr)) return { ...acc, curr } @@ -171,7 +171,7 @@ export class FilterUpdatesPipe implements PipeTransform { localPkg && this.emver.compare( manifest.version, - localPkg['state-info'].manifest.version, + localPkg.stateInfo.manifest.version, ) === 1 ) }) diff --git a/web/projects/ui/src/app/pages/widgets/built-in/health/health.component.ts b/web/projects/ui/src/app/pages/widgets/built-in/health/health.component.ts index 5a0f74767..bc496b219 100644 --- a/web/projects/ui/src/app/pages/widgets/built-in/health/health.component.ts +++ b/web/projects/ui/src/app/pages/widgets/built-in/health/health.component.ts @@ -27,7 +27,7 @@ export class HealthComponent { ] as const readonly data$ = combineLatest([ - inject(PatchDB).watch$('package-data'), + inject(PatchDB).watch$('packageData'), inject(DepErrorService).depErrors$, ]).pipe( map(([data, depErrors]) => { diff --git a/web/projects/ui/src/app/pipes/ui/ui.pipe.ts b/web/projects/ui/src/app/pipes/ui/ui.pipe.ts index 0c9bab5df..a6bbb52be 100644 --- a/web/projects/ui/src/app/pipes/ui/ui.pipe.ts +++ b/web/projects/ui/src/app/pipes/ui/ui.pipe.ts @@ -8,7 +8,7 @@ import { Manifest } from '@start9labs/marketplace' name: 'hasUi', }) export class UiPipe implements PipeTransform { - transform(interfaces: PackageDataEntry['service-interfaces']): boolean { + transform(interfaces: PackageDataEntry['serviceInterfaces']): boolean { return interfaces ? hasUi(interfaces) : false } } diff --git a/web/projects/ui/src/app/pkg-config/config-types.ts b/web/projects/ui/src/app/pkg-config/config-types.ts index 08f0b9d26..f73dbc0a4 100644 --- a/web/projects/ui/src/app/pkg-config/config-types.ts +++ b/web/projects/ui/src/app/pkg-config/config-types.ts @@ -24,8 +24,6 @@ export type ValueSpecOf = T extends 'string' ? ValueSpecList : T extends 'object' ? ValueSpecObject - : T extends 'pointer' - ? ValueSpecPointer : T extends 'union' ? ValueSpecUnion : never @@ -60,16 +58,6 @@ export interface ValueSpecUnion { default: string } -export interface ValueSpecPointer extends WithStandalone { - type: 'pointer' - subtype: 'package' | 'system' - 'package-id': string - target: 'lan-address' | 'tor-address' | 'config' | 'tor-key' - interface: string // will only exist if target = tor-key || tor-address || lan-address - selector?: string // will only exist if target = config - multi?: boolean // will only exist if target = config -} - export interface ValueSpecObject extends WithStandalone { type: 'object' spec: ConfigSpec 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 8f6a907bc..7786e3566 100644 --- a/web/projects/ui/src/app/services/api/api.fixures.ts +++ b/web/projects/ui/src/app/services/api/api.fixures.ts @@ -16,16 +16,16 @@ import { Log } from '@start9labs/shared' export module Mock { export const ServerUpdated: ServerStatusInfo = { - 'backup-progress': null, - 'update-progress': null, + backupProgress: 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', @@ -51,19 +51,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: @@ -72,9 +72,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 = { @@ -85,13 +85,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, @@ -100,7 +100,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.', @@ -112,25 +112,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, @@ -138,14 +138,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 = { @@ -178,8 +178,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.20.0': { icon: BTC_ICON, @@ -191,8 +191,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, @@ -201,13 +201,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, @@ -215,13 +215,13 @@ export module Mock { instructions: 'instructionsUrl', 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: { @@ -232,15 +232,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, @@ -249,15 +249,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, @@ -266,11 +266,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': { @@ -281,10 +281,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(), }, }, } @@ -295,8 +295,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', @@ -315,8 +315,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', @@ -325,8 +325,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', @@ -335,8 +335,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', @@ -361,7 +361,7 @@ export module Mock { }, }, memory: { - 'percentage-used': { + percentageUsed: { value: '30.7', unit: '%', }, @@ -377,29 +377,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: '%', }, @@ -425,7 +425,7 @@ export module Mock { value: '992.59', unit: 'GB', }, - 'percentage-used': { + percentageUsed: { value: '46.4', unit: '%', }, @@ -487,15 +487,15 @@ export module Mock { current: 'b7b1a9cef4284f00af9e9dda6e676177', sessions: { '9513226517c54ddd8107d6d7b9d8aed7': { - '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'], }, }, 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'], @@ -514,13 +514,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', @@ -528,7 +528,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', @@ -542,7 +542,7 @@ export module Mock { }, connected: 'Goosers', country: 'US', - 'available-wifi': [ + availableWifi: [ { ssid: 'Goosers a billion', strength: 40, @@ -568,13 +568,13 @@ export module Mock { path: '/Desktop/startos-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: '', }, }, // 'ftcvewdnkemfksdm': { @@ -585,7 +585,7 @@ export module Mock { // used: 0, // model: 'Evo SATA 2.5', // vendor: 'Samsung', - // 'embassy-os': null, + // startOs: null, // }, csgashbdjkasnd: { type: 'cifs', @@ -593,7 +593,7 @@ export module Mock { path: '/Desktop/startos-backups-2', username: 'TestUser', mountable: true, - 'embassy-os': null, + startOs: null, }, powjefhjbnwhdva: { type: 'disk', @@ -603,13 +603,13 @@ export module Mock { used: 100000000000, model: null, vendor: 'SSK', - '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: '', }, }, } @@ -617,17 +617,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(), }, }, @@ -1062,17 +1062,7 @@ export module Mock { warning: 'Careful changing this', }, variants: { - internal: { - 'lan-address': { - name: 'LAN Address', - type: 'pointer', - subtype: 'package', - target: 'lan-address', - 'package-id': 'bitcoind', - description: 'the lan address', - interface: 'asdf', - }, - }, + internal: {}, external: { 'emergency-contact': { name: 'Emergency Contact', @@ -1385,12 +1375,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: { @@ -1398,10 +1388,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, @@ -1617,28 +1607,28 @@ export module Mock { }, }, }, - 'current-dependencies': {}, - 'dependency-info': {}, - 'marketplace-url': 'https://registry.start9.com/', - 'developer-key': 'developer-key', + currentDependencies: {}, + dependencyInfo: {}, + marketplaceUrl: 'https://registry.start9.com/', + developerKey: 'developer-key', } 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, @@ -1746,40 +1736,40 @@ 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', + marketplaceUrl: 'https://registry.start9.com/', + developerKey: 'developer-key', } 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, @@ -1991,17 +1981,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', @@ -2011,8 +2001,8 @@ export module Mock { icon: 'assets/img/service-icons/btc-rpc-proxy.png', }, }, - 'marketplace-url': 'https://registry.start9.com/', - 'developer-key': 'developer-key', + marketplaceUrl: 'https://registry.start9.com/', + developerKey: 'developer-key', } export const LocalPkgs: { [key: string]: PackageDataEntry } = 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 7dc83e2e6..0bab23a5a 100644 --- a/web/projects/ui/src/app/services/api/api.types.ts +++ b/web/projects/ui/src/app/services/api/api.types.ts @@ -30,8 +30,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 @@ -51,14 +51,14 @@ export module RR { export type FollowServerLogsReq = { limit?: number } // server.logs.follow & server.kernel-logs.follow export type FollowServerLogsRes = { - 'start-cursor': string + startCursor: string guid: string } export type GetServerMetricsReq = {} // server.metrics export type GetServerMetricsRes = Metrics - export type UpdateServerReq = { 'marketplace-url': string } // server.update + export type UpdateServerReq = { marketplaceUrl: string } // server.update export type UpdateServerRes = 'updating' | 'no-updates' export type RestartServerReq = {} // server.restart @@ -71,7 +71,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 @@ -114,7 +114,7 @@ export module RR { connected: string | null country: string | null ethernet: boolean - 'available-wifi': AvailableWifi[] + availableWifi: AvailableWifi[] } export type AddWifiReq = { @@ -163,14 +163,14 @@ export module RR { export type RemoveBackupTargetReq = { id: string } // backup.target.cifs.remove export type RemoveBackupTargetRes = 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 = { // backup.create - 'target-id': string - 'package-ids': string[] - 'old-password': string | null + targetId: string + packageIds: string[] + oldPassword: string | null password: string } export type CreateBackupRes = null @@ -192,9 +192,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 @@ -210,15 +210,15 @@ export module RR { export type RestorePackagesReq = { // package.backup.restore ids: string[] - 'target-id': string - 'old-password': string | null + 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 @@ -236,12 +236,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: ConfigSpec } @@ -253,10 +253,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 = { @@ -265,7 +265,7 @@ export module RR { category?: string query?: string page?: number - 'per-page'?: number + perPage?: number } export type GetMarketplacePackagesRes = MarketplacePkg[] @@ -276,7 +276,7 @@ export module RR { export interface MarketplaceEOS { version: string headline: string - 'release-notes': { [version: string]: string } + releaseNotes: { [version: string]: string } } export interface Breakages { @@ -306,23 +306,23 @@ 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 } @@ -336,8 +336,8 @@ export interface Metric { } export interface Session { - 'last-active': string - 'user-agent': string + lastActive: string + userAgent: string metadata: SessionMetadata } @@ -372,7 +372,7 @@ export interface DiskBackupTarget { label: string | null capacity: number used: number | null - 'embassy-os': StartOSDiskInfo | null + startOs: StartOSDiskInfo | null } export interface CifsBackupTarget { @@ -381,7 +381,7 @@ export interface CifsBackupTarget { path: string username: string mountable: boolean - 'embassy-os': StartOSDiskInfo | null + startOs: StartOSDiskInfo | null } export type RecoverySource = DiskRecoverySource | CifsRecoverySource @@ -402,7 +402,7 @@ export interface CifsRecoverySource { export interface BackupInfo { version: string timestamp: string - 'package-backups': { + packageBackups: { [id: string]: PackageBackupInfo } } @@ -410,7 +410,7 @@ export interface BackupInfo { export interface PackageBackupInfo { title: string version: string - 'os-version': string + osVersion: string timestamp: string } @@ -419,7 +419,7 @@ export interface ServerSpecs { } export interface SSHKey { - 'created-at': string + createdAt: string alg: string hostname: string fingerprint: string @@ -429,8 +429,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 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 73765b44d..12b6f1d1a 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 @@ -158,7 +158,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 }) } @@ -205,7 +205,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 deabffdd2..6b423b244 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 @@ -216,8 +216,8 @@ export class MockApiService extends ApiService { return { entries, - 'start-cursor': 'startCursor', - 'end-cursor': 'endCursor', + startCursor: 'start-cursor', + endCursor: 'end-cursor', } } @@ -229,8 +229,8 @@ export class MockApiService extends ApiService { return { entries, - 'start-cursor': 'startCursor', - 'end-cursor': 'endCursor', + startCursor: 'start-cursor', + endCursor: 'end-cursor', } } @@ -240,8 +240,8 @@ export class MockApiService extends ApiService { return { entries, - 'start-cursor': 'startCursor', - 'end-cursor': 'endCursor', + startCursor: 'startCursor', + endCursor: 'end-cursor', } } @@ -250,7 +250,7 @@ export class MockApiService extends ApiService { ): Promise { await pauseFor(2000) return { - 'start-cursor': 'start-cursor', + startCursor: 'start-cursor', guid: '7251d5be-645f-4362-a51b-3a85be92b31e', } } @@ -260,7 +260,7 @@ export class MockApiService extends ApiService { ): Promise { await pauseFor(2000) return { - 'start-cursor': 'start-cursor', + startCursor: 'start-cursor', guid: '7251d5be-645f-4362-a51b-3a85be92b31e', } } @@ -270,7 +270,7 @@ export class MockApiService extends ApiService { ): Promise { await pauseFor(2000) return { - 'start-cursor': 'start-cursor', + startCursor: 'start-cursor', guid: '7251d5be-645f-4362-a51b-3a85be92b31e', } } @@ -312,7 +312,7 @@ export class MockApiService extends ApiService { const patch = [ { op: PatchOp.REPLACE, - path: '/server-info/status-info/update-progress', + path: '/serverInfo/statusInfo/updateProgress', value: initialProgress, }, ] @@ -329,7 +329,7 @@ export class MockApiService extends ApiService { const patch = [ { op: PatchOp.REPLACE, - path: '/server-info/status-info/restarting', + path: '/serverInfo/statusInfo/restarting', value: true, }, ] @@ -339,7 +339,7 @@ export class MockApiService extends ApiService { const patch2 = [ { op: PatchOp.REPLACE, - path: '/server-info/status-info/restarting', + path: '/serverInfo/statusInfo/restarting', value: false, }, ] @@ -357,7 +357,7 @@ export class MockApiService extends ApiService { const patch = [ { op: PatchOp.REPLACE, - path: '/server-info/status-info/shutting-down', + path: '/serverInfo/statusInfo/shuttingDown', value: true, }, ] @@ -367,7 +367,7 @@ export class MockApiService extends ApiService { const patch2 = [ { op: PatchOp.REPLACE, - path: '/server-info/status-info/shutting-down', + path: '/serverInfo/statusInfo/shuttingDown', value: false, }, ] @@ -439,7 +439,7 @@ export class MockApiService extends ApiService { const patch = [ { op: PatchOp.REPLACE, - path: '/server-info/unread-notification-count', + path: '/serverInfo/unreadNotificationCount', value: 0, }, ] @@ -529,7 +529,7 @@ export class MockApiService extends ApiService { path: path.replace(/\\/g, '/'), username, mountable: true, - 'embassy-os': null, + startOs: null, }, } } @@ -565,13 +565,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, @@ -655,8 +655,8 @@ export class MockApiService extends ApiService { } return { entries, - 'start-cursor': 'startCursor', - 'end-cursor': 'endCursor', + startCursor: 'startCursor', + endCursor: 'end-cursor', } } @@ -665,7 +665,7 @@ export class MockApiService extends ApiService { ): Promise { await pauseFor(2000) return { - 'start-cursor': 'start-cursor', + startCursor: 'start-cursor', guid: '7251d5be-645f-4362-a51b-3a85be92b31e', } } @@ -679,17 +679,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, @@ -698,8 +698,8 @@ export class MockApiService extends ApiService { // manifest, // both - 'installing-info': { - 'new-manifest': manifest, + installingInfo: { + newManifest: manifest, progress: PROGRESS, }, }, @@ -735,7 +735,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, }, ] @@ -755,13 +755,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, }, }, @@ -782,7 +782,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) @@ -865,7 +865,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[] = [ @@ -941,7 +941,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 = [ @@ -981,7 +981,7 @@ export class MockApiService extends ApiService { const patch2: RemoveOperation[] = [ { op: PatchOp.REMOVE, - path: `/package-data/${params.id}`, + path: `/packageData/${params.id}`, }, ] this.mockRevision(patch2) @@ -990,7 +990,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, }, ] @@ -1005,8 +1005,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: Mock.ConfigSpec, } } @@ -1028,7 +1028,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, }, ] @@ -1041,7 +1041,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, }) } @@ -1058,7 +1058,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, }, ] @@ -1071,7 +1071,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, }) } @@ -1083,7 +1083,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, }, ]) @@ -1096,7 +1096,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, }, ]) @@ -1105,10 +1105,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, }, }, ] @@ -1122,7 +1122,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, }, ] @@ -1134,7 +1134,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, }, ] @@ -1144,7 +1144,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, }, ] @@ -1154,12 +1154,12 @@ export class MockApiService extends ApiService { const patch3: Operation[] = [ { op: PatchOp.REPLACE, - path: '/server-info/status', + path: '/serverInfo/status', value: ServerStatus.Updated, }, { op: PatchOp.REMOVE, - path: '/server-info/status-info/update-progress', + path: '/serverInfo/statusInfo/updateProgress', }, ] this.mockRevision(patch3) @@ -1168,7 +1168,7 @@ export class MockApiService extends ApiService { const patch4 = [ { op: PatchOp.REPLACE, - path: '/server-info/status', + path: '/serverInfo/status', value: ServerStatus.Running, }, ] @@ -1178,7 +1178,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 db9f5c86b..5bd69293c 100644 --- a/web/projects/ui/src/app/services/api/mock-patch.ts +++ b/web/projects/ui/src/app/services/api/mock-patch.ts @@ -10,7 +10,7 @@ import { BUILT_IN_WIDGETS } from '../../pages/widgets/built-in/widgets' export const mockPatchData: DataModel = { ui: { name: `Matt's Server`, - 'ack-welcome': '1.0.0', + ackWelcome: '1.0.0', theme: 'Dark', widgets: BUILT_IN_WIDGETS.filter( ({ id }) => @@ -20,8 +20,8 @@ export const mockPatchData: DataModel = { id === 'metrics', ), marketplace: { - 'selected-url': 'https://registry.start9.com/', - 'known-hosts': { + selectedUrl: 'https://registry.start9.com/', + knownHosts: { 'https://registry.start9.com/': { name: 'Start9 Registry', }, @@ -31,21 +31,20 @@ export const mockPatchData: DataModel = { }, }, }, - dev: {}, gaming: { snake: { - 'high-score': 0, + highScore: 0, }, }, - 'ack-instructions': {}, + ackInstructions: {}, }, - 'server-info': { + serverInfo: { id: 'abcdefgh', version: '0.3.5.1', - 'last-backup': new Date(new Date().valueOf() - 604800001).toISOString(), - 'lan-address': 'https://adjective-noun.local', - 'tor-address': 'https://myveryownspecialtoraddress.onion', - 'ip-info': { + lastBackup: new Date(new Date().valueOf() - 604800001).toISOString(), + lanAddress: 'https://adjective-noun.local', + torAddress: 'https://myveryownspecialtoraddress.onion', + ipInfo: { eth0: { ipv4: '10.0.0.1', ipv6: null, @@ -55,28 +54,28 @@ export const mockPatchData: DataModel = { ipv6: 'FE80:CD00:0000:0CDE:1257:0000:211E:729CD', }, }, - 'last-wifi-region': null, - 'unread-notification-count': 4, + lastWifiRegion: null, + unreadNotificationCount: 4, // password is asdfasdf - 'password-hash': + passwordHash: '$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ', - 'eos-version-compat': '>=0.3.0 <=0.3.0.1', - 'status-info': { - 'backup-progress': null, + eosVersionCompat: '>=0.3.0 <=0.3.0.1', + statusInfo: { + backupProgress: null, updated: false, - 'update-progress': null, + updateProgress: null, restarting: false, - 'shutting-down': false, + shuttingDown: false, }, hostname: 'random-words', 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, platform: 'x86_64-nonfree', }, - 'package-data': { + packageData: { bitcoind: { - 'state-info': { + stateInfo: { state: PackageState.Installed, manifest: { ...Mock.MockManifestBitcoind, @@ -84,7 +83,7 @@ export const mockPatchData: DataModel = { }, }, icon: '/assets/img/service-icons/bitcoind.svg', - 'last-backup': null, + lastBackup: null, status: { configured: true, main: { @@ -116,10 +115,10 @@ export const mockPatchData: DataModel = { }, }, }, - 'dependency-config-errors': {}, + dependencyConfigErrors: {}, }, actions: {}, // @TODO - 'service-interfaces': { + serviceInterfaces: { ui: { id: 'ui', hasPrimary: false, @@ -335,13 +334,13 @@ export const mockPatchData: DataModel = { }, }, }, - 'current-dependencies': {}, - 'dependency-info': {}, - 'marketplace-url': 'https://registry.start9.com/', - 'developer-key': 'developer-key', + currentDependencies: {}, + dependencyInfo: {}, + marketplaceUrl: 'https://registry.start9.com/', + developerKey: 'developer-key', }, lnd: { - 'state-info': { + stateInfo: { state: PackageState.Installed, manifest: { ...Mock.MockManifestLnd, @@ -349,18 +348,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, @@ -570,17 +569,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', @@ -590,8 +589,8 @@ export const mockPatchData: DataModel = { icon: 'assets/img/service-icons/btc-rpc-proxy.png', }, }, - 'marketplace-url': 'https://registry.start9.com/', - 'developer-key': 'developer-key', + marketplaceUrl: 'https://registry.start9.com/', + developerKey: 'developer-key', }, }, } diff --git a/web/projects/ui/src/app/services/config.service.ts b/web/projects/ui/src/app/services/config.service.ts index 71719ae4a..2bae31e63 100644 --- a/web/projects/ui/src/app/services/config.service.ts +++ b/web/projects/ui/src/app/services/config.service.ts @@ -63,9 +63,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 '' @@ -128,7 +126,7 @@ export class ConfigService { } 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 c73beabda..50020f5fe 100644 --- a/web/projects/ui/src/app/services/dep-error.service.ts +++ b/web/projects/ui/src/app/services/dep-error.service.ts @@ -20,7 +20,7 @@ export type PkgDependencyErrors = Record providedIn: 'root', }) export class DepErrorService { - readonly depErrors$ = this.patch.watch$('package-data').pipe( + readonly depErrors$ = this.patch.watch$('packageData').pipe( map(pkgs => Object.keys(pkgs) .map(id => ({ @@ -53,7 +53,7 @@ export class DepErrorService { } private getDepErrors( - pkgs: DataModel['package-data'], + pkgs: DataModel['packageData'], pkgId: string, outerErrors: AllDependencyErrors, ): PkgDependencyErrors { @@ -71,7 +71,7 @@ export class DepErrorService { } private getDepError( - pkgs: DataModel['package-data'], + pkgs: DataModel['packageData'], pkg: PackageDataEntry, depId: string, outerErrors: AllDependencyErrors, @@ -79,14 +79,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)) { @@ -98,9 +98,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, } @@ -120,7 +118,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, @@ -144,14 +142,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 396c84223..dcd1d0de0 100644 --- a/web/projects/ui/src/app/services/eos.service.ts +++ b/web/projects/ui/src/app/services/eos.service.ts @@ -15,13 +15,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', 'backup-progress') + .watch$('serverInfo', 'statusInfo', 'backupProgress') .pipe( map(obj => !!obj), distinctUntilChanged(), diff --git a/web/projects/ui/src/app/services/form.service.ts b/web/projects/ui/src/app/services/form.service.ts index 66d368b50..ee8f0f136 100644 --- a/web/projects/ui/src/app/services/form.service.ts +++ b/web/projects/ui/src/app/services/form.service.ts @@ -89,7 +89,6 @@ export class FormService { UntypedFormGroup | UntypedFormArray | UntypedFormControl > = {} Object.entries(config).map(([key, spec]) => { - if (spec.type === 'pointer') return group[key] = this.getFormEntry(spec, current ? current[key] : undefined) }) return this.formBuilder.group(group, { validators }) diff --git a/web/projects/ui/src/app/services/marketplace.service.ts b/web/projects/ui/src/app/services/marketplace.service.ts index 9592e7da1..ac9d4a8f4 100644 --- a/web/projects/ui/src/app/services/marketplace.service.ts +++ b/web/projects/ui/src/app/services/marketplace.service.ts @@ -39,7 +39,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 @@ -73,8 +73,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 }), @@ -171,9 +171,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) } @@ -206,18 +206,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, @@ -276,7 +276,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) @@ -306,7 +306,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 23ee15925..5372a665c 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 { }) modal.onWillDismiss().then(() => { 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 9f90e798f..537e15329 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 @@ -1,28 +1,25 @@ import { Url } from '@start9labs/shared' import { Manifest } from '@start9labs/marketplace' -import { BasicInfo } from 'src/app/pages/developer-routes/developer-menu/form-info' import { types } from '@start9labs/start-sdk' -import { InputSpec } from '@start9labs/start-sdk/cjs/sdk/lib/config/configTypes' import { ActionMetadata } from '@start9labs/start-sdk/cjs/sdk/lib/types' 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 // eOS emver + ackWelcome: string // eOS emver marketplace: UIMarketplaceData - dev: DevData gaming: { snake: { - 'high-score': number + highScore: number } } - 'ack-instructions': Record + ackInstructions: Record theme: string widgets: readonly Widget[] } @@ -41,8 +38,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 @@ -53,33 +50,22 @@ export interface UIStore { name?: string } -export interface DevData { - [id: string]: DevProjectData -} - -export interface DevProjectData { - name: string - instructions: string - config: string - 'basic-info'?: BasicInfo -} - export interface ServerInfo { id: string version: string - 'last-backup': string | null - 'lan-address': Url - 'tor-address': Url - 'ip-info': IpInfo - 'last-wifi-region': string | null - 'unread-notification-count': number - 'status-info': ServerStatusInfo - 'eos-version-compat': string - 'password-hash': string + lastBackup: string | null + lanAddress: Url + torAddress: Url + ipInfo: IpInfo + lastWifiRegion: string | null + unreadNotificationCount: number + statusInfo: ServerStatusInfo + eosVersionCompat: string + passwordHash: string hostname: string pubkey: string - 'ca-fingerprint': string - 'ntp-synced': boolean + caFingerprint: string + ntpSynced: boolean platform: string } @@ -91,15 +77,15 @@ export interface IpInfo { } export interface ServerStatusInfo { - 'backup-progress': null | { + backupProgress: null | { [packageId: string]: { complete: boolean } } 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 { @@ -109,21 +95,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 + serviceInterfaces: Record + marketplaceUrl: string | null + developerKey: string } export type StateInfo = InstalledState | InstallingState | UpdatingState @@ -135,12 +121,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 } @@ -154,13 +140,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 = @@ -250,7 +236,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 cda895e89..7e1f52b49 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 @@ -22,12 +22,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/services/ui-launcher.service.ts b/web/projects/ui/src/app/services/ui-launcher.service.ts index 82250048a..badbc7a3e 100644 --- a/web/projects/ui/src/app/services/ui-launcher.service.ts +++ b/web/projects/ui/src/app/services/ui-launcher.service.ts @@ -12,7 +12,7 @@ export class UiLauncherService { private readonly config: ConfigService, ) {} - launch(interfaces: PackageDataEntry['service-interfaces']): void { + launch(interfaces: PackageDataEntry['serviceInterfaces']): void { this.windowRef.open( this.config.launchableAddress(interfaces), '_blank', 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]) } diff --git a/web/projects/ui/src/app/util/properties.util.ts b/web/projects/ui/src/app/util/properties.util.ts index 0d1d7e6f4..5afb4bd8b 100644 --- a/web/projects/ui/src/app/util/properties.util.ts +++ b/web/projects/ui/src/app/util/properties.util.ts @@ -12,8 +12,6 @@ import matches, { arrayOf, } from 'ts-matches' -type ValidVersion = 1 | 2 - type PropertiesV1 = typeof matchPropertiesV1._TYPE type PackagePropertiesV1 = PropertiesV1[] type PackagePropertiesV2 = {