From 230838c22b0107a327fd95c5134558aa8b0c1d17 Mon Sep 17 00:00:00 2001 From: waterplea Date: Thu, 16 May 2024 12:28:59 +0100 Subject: [PATCH] chore: types imports --- .../routes/service/components/actions.component.ts | 4 ++-- .../routes/service/components/backups.component.ts | 4 ++-- .../service/components/health-check.component.ts | 4 ++-- .../service/components/health-checks.component.ts | 4 ++-- .../routes/service/components/progress.component.ts | 4 ++-- .../routes/service/pipes/to-additional.pipe.ts | 4 ++-- .../portal/routes/service/pipes/to-menu.pipe.ts | 6 +++--- .../routes/service/routes/service.component.ts | 12 ++++++------ .../routes/system/notifications/item.component.ts | 4 ++-- web/projects/ui/src/app/services/actions.service.ts | 10 +++++----- web/tsconfig.json | 3 +-- 11 files changed, 29 insertions(+), 30 deletions(-) diff --git a/web/projects/ui/src/app/routes/portal/routes/service/components/actions.component.ts b/web/projects/ui/src/app/routes/portal/routes/service/components/actions.component.ts index 696c46620..4c286e2c1 100644 --- a/web/projects/ui/src/app/routes/portal/routes/service/components/actions.component.ts +++ b/web/projects/ui/src/app/routes/portal/routes/service/components/actions.component.ts @@ -4,7 +4,7 @@ import { inject, Input, } from '@angular/core' -import { Manifest } from '@startos' +import { T } from '@start9labs/start-sdk' import { tuiPure } from '@taiga-ui/cdk' import { TuiButtonModule, @@ -86,7 +86,7 @@ export class ServiceActionsComponent { return this.pkg.status.configured } - get manifest(): Manifest { + get manifest(): T.Manifest { return getManifest(this.pkg) } diff --git a/web/projects/ui/src/app/routes/portal/routes/service/components/backups.component.ts b/web/projects/ui/src/app/routes/portal/routes/service/components/backups.component.ts index 42d0d0230..799556ffd 100644 --- a/web/projects/ui/src/app/routes/portal/routes/service/components/backups.component.ts +++ b/web/projects/ui/src/app/routes/portal/routes/service/components/backups.component.ts @@ -6,7 +6,7 @@ import { input, } from '@angular/core' import { RouterLink } from '@angular/router' -import { PackageDataEntry } from '@startos' +import { T } from '@start9labs/start-sdk' import { TuiButtonModule } from '@taiga-ui/experimental' @Component({ @@ -52,7 +52,7 @@ import { TuiButtonModule } from '@taiga-ui/experimental' imports: [TuiButtonModule, RouterLink, I18nPluralPipe], }) export class ServiceBackupsComponent { - pkg = input.required() + pkg = input.required() readonly previous = computed(() => daysBetween(new Date(), new Date(this.pkg().lastBackup || new Date())), diff --git a/web/projects/ui/src/app/routes/portal/routes/service/components/health-check.component.ts b/web/projects/ui/src/app/routes/portal/routes/service/components/health-check.component.ts index 0d08ff124..024e5262c 100644 --- a/web/projects/ui/src/app/routes/portal/routes/service/components/health-check.component.ts +++ b/web/projects/ui/src/app/routes/portal/routes/service/components/health-check.component.ts @@ -1,6 +1,6 @@ import { CommonModule } from '@angular/common' import { ChangeDetectionStrategy, Component, Input } from '@angular/core' -import { HealthCheckResult } from '@startos' +import { T } from '@start9labs/start-sdk' import { TuiLoaderModule, TuiSvgModule } from '@taiga-ui/core' @Component({ @@ -43,7 +43,7 @@ import { TuiLoaderModule, TuiSvgModule } from '@taiga-ui/core' }) export class ServiceHealthCheckComponent { @Input({ required: true }) - check!: HealthCheckResult + check!: T.HealthCheckResult @Input() connected = false diff --git a/web/projects/ui/src/app/routes/portal/routes/service/components/health-checks.component.ts b/web/projects/ui/src/app/routes/portal/routes/service/components/health-checks.component.ts index 78c0b4fb1..b82d127a4 100644 --- a/web/projects/ui/src/app/routes/portal/routes/service/components/health-checks.component.ts +++ b/web/projects/ui/src/app/routes/portal/routes/service/components/health-checks.component.ts @@ -5,7 +5,7 @@ import { inject, Input, } from '@angular/core' -import { HealthCheckResult } from '@startos' +import { T } from '@start9labs/start-sdk' import { ServiceHealthCheckComponent } from 'src/app/routes/portal/routes/service/components/health-check.component' import { ConnectionService } from 'src/app/services/connection.service' @@ -31,7 +31,7 @@ import { ConnectionService } from 'src/app/services/connection.service' }) export class ServiceHealthChecksComponent { @Input({ required: true }) - checks: readonly HealthCheckResult[] = [] + checks: readonly T.HealthCheckResult[] = [] readonly connected$ = inject(ConnectionService).connected$ } diff --git a/web/projects/ui/src/app/routes/portal/routes/service/components/progress.component.ts b/web/projects/ui/src/app/routes/portal/routes/service/components/progress.component.ts index 5a077ff70..85456a455 100644 --- a/web/projects/ui/src/app/routes/portal/routes/service/components/progress.component.ts +++ b/web/projects/ui/src/app/routes/portal/routes/service/components/progress.component.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core' -import { Progress } from '@startos' +import { T } from '@start9labs/start-sdk' import { TuiProgressModule } from '@taiga-ui/kit' import { InstallingProgressPipe } from 'src/app/routes/portal/routes/service/pipes/install-progress.pipe' @@ -26,5 +26,5 @@ import { InstallingProgressPipe } from 'src/app/routes/portal/routes/service/pip imports: [TuiProgressModule, InstallingProgressPipe], }) export class ServiceProgressComponent { - @Input({ required: true }) progress!: Progress + @Input({ required: true }) progress!: T.Progress } diff --git a/web/projects/ui/src/app/routes/portal/routes/service/pipes/to-additional.pipe.ts b/web/projects/ui/src/app/routes/portal/routes/service/pipes/to-additional.pipe.ts index 6be7f245d..a1f1f61b0 100644 --- a/web/projects/ui/src/app/routes/portal/routes/service/pipes/to-additional.pipe.ts +++ b/web/projects/ui/src/app/routes/portal/routes/service/pipes/to-additional.pipe.ts @@ -1,6 +1,6 @@ import { inject, Pipe, PipeTransform } from '@angular/core' import { CopyService, MarkdownComponent } from '@start9labs/shared' -import { Manifest } from '@startos' +import { T } from '@start9labs/start-sdk' import { TuiDialogService } from '@taiga-ui/core' import { PolymorpheusComponent } from '@tinkoff/ng-polymorpheus' import { from } from 'rxjs' @@ -68,7 +68,7 @@ export class ToAdditionalPipe implements PipeTransform { ] } - private showLicense({ id, version }: Manifest) { + private showLicense({ id, version }: T.Manifest) { this.dialogs .open(new PolymorpheusComponent(MarkdownComponent), { label: 'License', diff --git a/web/projects/ui/src/app/routes/portal/routes/service/pipes/to-menu.pipe.ts b/web/projects/ui/src/app/routes/portal/routes/service/pipes/to-menu.pipe.ts index be4bca698..5883cd2fd 100644 --- a/web/projects/ui/src/app/routes/portal/routes/service/pipes/to-menu.pipe.ts +++ b/web/projects/ui/src/app/routes/portal/routes/service/pipes/to-menu.pipe.ts @@ -1,7 +1,7 @@ import { inject, Pipe, PipeTransform } from '@angular/core' import { Params } from '@angular/router' import { MarkdownComponent } from '@start9labs/shared' -import { Manifest } from '@startos' +import { T } from '@start9labs/start-sdk' import { TuiDialogService } from '@taiga-ui/core' import { PolymorpheusComponent } from '@tinkoff/ng-polymorpheus' import { from } from 'rxjs' @@ -114,7 +114,7 @@ export class ToMenuPipe implements PipeTransform { ] } - private showInstructions({ title, id, version }: Manifest) { + private showInstructions({ title, id, version }: T.Manifest) { this.api .setDbValue(['ack-instructions', id], true) .catch(e => console.error('Failed to mark instructions as seen', e)) @@ -134,7 +134,7 @@ export class ToMenuPipe implements PipeTransform { .subscribe() } - private openConfig({ title, id }: Manifest) { + private openConfig({ title, id }: T.Manifest) { this.formDialog.open(ConfigModal, { label: `${title} configuration`, data: { pkgId: id }, diff --git a/web/projects/ui/src/app/routes/portal/routes/service/routes/service.component.ts b/web/projects/ui/src/app/routes/portal/routes/service/routes/service.component.ts index 8b96919d6..1452fc6fe 100644 --- a/web/projects/ui/src/app/routes/portal/routes/service/routes/service.component.ts +++ b/web/projects/ui/src/app/routes/portal/routes/service/routes/service.component.ts @@ -2,7 +2,7 @@ import { CommonModule } from '@angular/common' import { ChangeDetectionStrategy, Component, inject } from '@angular/core' import { ActivatedRoute, NavigationExtras, Router } from '@angular/router' import { isEmptyObject } from '@start9labs/shared' -import { HealthCheckResult, MainStatus, Manifest } from '@startos' +import { T } from '@start9labs/start-sdk' import { PatchDB } from 'patch-db-client' import { combineLatest, map, switchMap } from 'rxjs' import { @@ -217,7 +217,7 @@ export class ServiceRoute { private getDepValues( pkg: PackageDataEntry, - pkgManifest: Manifest, + pkgManifest: T.Manifest, depId: string, depErrors: PkgDependencyErrors, ): DependencyInfo { @@ -249,7 +249,7 @@ export class ServiceRoute { private getDepErrors( pkg: PackageDataEntry, - pkgManifest: Manifest, + pkgManifest: T.Manifest, depId: string, depErrors: PkgDependencyErrors, ) { @@ -291,7 +291,7 @@ export class ServiceRoute { async fixDep( pkg: PackageDataEntry, - pkgManifest: Manifest, + pkgManifest: T.Manifest, action: 'install' | 'update' | 'configure', depId: string, ): Promise { @@ -312,7 +312,7 @@ export class ServiceRoute { private async installDep( pkg: PackageDataEntry, - manifest: Manifest, + manifest: T.Manifest, depId: string, ): Promise { const dependentInfo: DependentInfo = { @@ -333,7 +333,7 @@ export class ServiceRoute { } } -function toHealthCheck(main: MainStatus): HealthCheckResult[] | null { +function toHealthCheck(main: T.MainStatus): T.HealthCheckResult[] | null { return main.status !== 'running' || isEmptyObject(main.health) ? null : Object.values(main.health) diff --git a/web/projects/ui/src/app/routes/portal/routes/system/notifications/item.component.ts b/web/projects/ui/src/app/routes/portal/routes/system/notifications/item.component.ts index 2a05182e7..dddfacfe8 100644 --- a/web/projects/ui/src/app/routes/portal/routes/system/notifications/item.component.ts +++ b/web/projects/ui/src/app/routes/portal/routes/system/notifications/item.component.ts @@ -6,7 +6,7 @@ import { Input, } from '@angular/core' import { RouterLink } from '@angular/router' -import { Manifest } from '@startos' +import { T } from '@start9labs/start-sdk' import { tuiPure } from '@taiga-ui/cdk' import { TuiSvgModule } from '@taiga-ui/core' import { TuiLineClampModule } from '@taiga-ui/kit' @@ -67,7 +67,7 @@ export class NotificationItemComponent { overflow = false @tuiPure - get manifest$(): Observable { + get manifest$(): Observable { return this.patch .watch$( 'packageData', diff --git a/web/projects/ui/src/app/services/actions.service.ts b/web/projects/ui/src/app/services/actions.service.ts index 613f09f61..e0e685023 100644 --- a/web/projects/ui/src/app/services/actions.service.ts +++ b/web/projects/ui/src/app/services/actions.service.ts @@ -1,6 +1,6 @@ import { inject, Injectable } from '@angular/core' import { ErrorService, LoadingService } from '@start9labs/shared' -import { Manifest } from '@startos' +import { T } from '@start9labs/start-sdk' import { TuiDialogOptions, TuiDialogService } from '@taiga-ui/core' import { TUI_PROMPT, TuiPromptData } from '@taiga-ui/kit' import { PatchDB } from 'patch-db-client' @@ -26,14 +26,14 @@ export class ActionsService { private readonly formDialog = inject(FormDialogService) private readonly patch = inject(PatchDB) - configure(manifest: Manifest): void { + configure(manifest: T.Manifest): void { this.formDialog.open(ConfigModal, { label: `${manifest.title} configuration`, data: { pkgId: manifest.id }, }) } - async start(manifest: Manifest, unmet: boolean): Promise { + async start(manifest: T.Manifest, unmet: boolean): Promise { const deps = `${manifest.title} has unmet dependencies. It will not work as expected.` if ( @@ -44,7 +44,7 @@ export class ActionsService { } } - async stop({ id, title, alerts }: Manifest): Promise { + async stop({ id, title, alerts }: T.Manifest): Promise { let content = alerts.stop || '' if (hasCurrentDeps(id, await getAllPackages(this.patch))) { @@ -62,7 +62,7 @@ export class ActionsService { } } - async restart({ id, title }: Manifest): Promise { + async restart({ id, title }: T.Manifest): Promise { if (hasCurrentDeps(id, await getAllPackages(this.patch))) { this.dialogs .open( diff --git a/web/tsconfig.json b/web/tsconfig.json index 6ea5ae52e..9b4b79b35 100644 --- a/web/tsconfig.json +++ b/web/tsconfig.json @@ -23,8 +23,7 @@ "paths": { /* These paths are relative to each app base folder */ "@start9labs/marketplace": ["../marketplace/index"], - "@start9labs/shared": ["../shared/src/public-api"], - "@startos": ["../../../core/startos/bindings/index"] + "@start9labs/shared": ["../shared/src/public-api"] }, "typeRoots": ["node_modules/@types"], "types": ["node"]