fix types

This commit is contained in:
Matt Hill
2023-03-15 15:01:16 -06:00
committed by Aiden McClelland
parent 178391e7b2
commit 6556fcc531
13 changed files with 455 additions and 11398 deletions

11793
frontend/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -74,7 +74,7 @@
"patch-db-client": "file: ../../../patch-db/client",
"pbkdf2": "^3.1.2",
"rxjs": "^7.5.6",
"start-sdk": "^0.4.0-lib0.alpha3",
"start-sdk": "^0.4.0-lib0.alpha6",
"swiper": "^8.2.4",
"ts-matches": "^5.2.1",
"tslib": "^2.3.0",
@@ -92,12 +92,12 @@
"@types/js-yaml": "^4.0.5",
"@types/marked": "^4.0.3",
"@types/mustache": "^4.1.2",
"@types/node": "^16.9.1",
"@types/node": "^18.15.0",
"@types/node-jose": "^1.1.10",
"@types/pbkdf2": "^3.1.0",
"@types/uuid": "^8.3.1",
"husky": "^4.3.8",
"lint-staged": "^12.3.7",
"lint-staged": "^13.2.0",
"ng-packagr": "^14.1.0",
"node-html-parser": "^5.3.3",
"prettier": "^2.6.1",

View File

@@ -12,7 +12,7 @@ import {
ModalController,
} from '@ionic/angular'
import { GenericFormPage } from 'src/app/modals/generic-form/generic-form.page'
import { ConfigSpec } from 'start-sdk/types/config-types'
import { InputSpec } from 'start-sdk/types/config-types'
import { ApiService } from 'src/app/services/api/embassy-api.service'
import { ErrorToastService } from '@start9labs/shared'
import { MappedBackupTarget } from 'src/app/types/mapped-backup-target'
@@ -274,7 +274,7 @@ export class BackupDrivesStatusComponent {
@Input() hasValidBackup!: boolean
}
const CifsSpec: ConfigSpec = {
const CifsSpec: InputSpec = {
hostname: {
type: 'string',
name: 'Hostname',

View File

@@ -11,7 +11,7 @@ import {
import { FormArray, UntypedFormArray, UntypedFormGroup } from '@angular/forms'
import { AlertButton, AlertController, ModalController } from '@ionic/angular'
import {
ConfigSpec,
InputSpec,
ListValueSpecOf,
ValueSpec,
ValueSpecBoolean,
@@ -37,7 +37,7 @@ interface Config {
styleUrls: ['./form-object.component.scss'],
})
export class FormObjectComponent {
@Input() objectSpec!: ConfigSpec
@Input() objectSpec!: InputSpec
@Input() formGroup!: UntypedFormGroup
@Input() current?: Config
@Input() original?: Config

View File

@@ -13,7 +13,7 @@ import {
isObject,
} from '@start9labs/shared'
import { DependentInfo } from 'src/app/types/dependent-info'
import { ConfigSpec } from 'start-sdk/types/config-types'
import { InputSpec } from 'start-sdk/types/config-types'
import {
DataModel,
PackageDataEntry,
@@ -42,7 +42,7 @@ export class AppConfigPage {
pkg!: PackageDataEntry
loadingText = ''
configSpec?: ConfigSpec
configSpec?: InputSpec
configForm?: UntypedFormGroup
original?: object // only if existing config

View File

@@ -5,7 +5,7 @@ import {
convertValuesRecursive,
FormService,
} from 'src/app/services/form.service'
import { ConfigSpec } from 'start-sdk/types/config-types'
import { InputSpec } from 'start-sdk/types/config-types'
export interface ActionButton {
text: string
@@ -20,7 +20,7 @@ export interface ActionButton {
})
export class GenericFormPage {
@Input() title!: string
@Input() spec!: ConfigSpec
@Input() spec!: InputSpec
@Input() buttons!: ActionButton[]
@Input() initialValue: object = {}

View File

@@ -12,7 +12,7 @@ import {
} 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 'start-sdk/types/config-types'
import { InputSpec } from 'start-sdk/types/config-types'
import * as yaml from 'js-yaml'
import { v4 } from 'uuid'
import { DataModel, DevData } from 'src/app/services/patch-db/data-model'
@@ -217,7 +217,7 @@ export class DeveloperListPage {
const SAMPLE_INSTUCTIONS = `# Create Instructions using Markdown! :)`
const SAMPLE_CONFIG: ConfigSpec = {
const SAMPLE_CONFIG: InputSpec = {
'sample-string': {
type: 'string',
name: 'Example String Input',

View File

@@ -1,4 +1,4 @@
import { ConfigSpec } from 'start-sdk/types/config-types'
import { InputSpec } from 'start-sdk/types/config-types'
import { DevProjectData } from 'src/app/services/patch-db/data-model'
export type BasicInfo = {
@@ -17,7 +17,7 @@ export type BasicInfo = {
}
}
export function getBasicInfoSpec(devData: DevProjectData): ConfigSpec {
export function getBasicInfoSpec(devData: DevProjectData): InputSpec {
const basicInfo = devData['basic-info']
return {
id: {

View File

@@ -1191,7 +1191,7 @@ export module Mock {
},
} as any // @TODO why is this necessary?
export const ConfigSpec: RR.GetPackageConfigRes['spec'] = {
export const InputSpec: RR.GetPackageConfigRes['spec'] = {
bitcoin: {
type: 'object',
name: 'Bitcoin Settings',
@@ -1327,7 +1327,7 @@ export module Mock {
},
],
// the outer spec here, at the list level, says that what's inside (the inner spec) pertains to its inner elements.
// it just so happens that ValueSpecObject's have the field { spec: ConfigSpec }
// it just so happens that ValueSpecObject's have the field { spec: InputSpec }
// see 'union-list' below for a different example.
spec: {
'unique-by': 'last-name',

View File

@@ -1,7 +1,7 @@
import { Dump, Revision } from 'patch-db-client'
import { MarketplacePkg, StoreInfo } from '@start9labs/marketplace'
import { PackagePropertiesVersioned } from 'src/app/util/properties.util'
import { ConfigSpec } from 'start-sdk/types/config-types'
import { InputSpec } from 'start-sdk/types/config-types'
import {
DataModel,
DependencyError,
@@ -204,7 +204,7 @@ export module RR {
export type DryUpdatePackageRes = Breakages
export type GetPackageConfigReq = { id: string } // package.config.get
export type GetPackageConfigRes = { spec: ConfigSpec; config: object }
export type GetPackageConfigRes = { spec: InputSpec; config: object }
export type DrySetPackageConfigReq = { id: string; config: object } // package.config.set.dry
export type DrySetPackageConfigRes = Breakages
@@ -247,7 +247,7 @@ export module RR {
export type DryConfigureDependencyRes = {
'old-config': object
'new-config': object
spec: ConfigSpec
spec: InputSpec
}
export type SideloadPackageReq = {

View File

@@ -665,7 +665,7 @@ export class MockApiService extends ApiService {
await pauseFor(2000)
return {
config: Mock.MockConfig,
spec: Mock.ConfigSpec,
spec: Mock.InputSpec,
}
}
@@ -900,7 +900,7 @@ export class MockApiService extends ApiService {
return {
'old-config': Mock.MockConfig,
'new-config': Mock.MockDependencyConfig,
spec: Mock.ConfigSpec,
spec: Mock.InputSpec,
}
}

View File

@@ -8,7 +8,7 @@ import {
Validators,
} from '@angular/forms'
import {
ConfigSpec,
InputSpec,
isValueSpecListOf,
ListValueSpecNumber,
ListValueSpecObject,
@@ -34,7 +34,7 @@ export class FormService {
constructor(private readonly formBuilder: UntypedFormBuilder) {}
createForm(
spec: ConfigSpec,
spec: InputSpec,
current: { [key: string]: any } = {},
): UntypedFormGroup {
return this.getFormGroup(spec, [], current)
@@ -80,7 +80,7 @@ export class FormService {
}
private getFormGroup(
config: ConfigSpec,
config: InputSpec,
validators: ValidatorFn[] = [],
current?: { [key: string]: any } | null,
): UntypedFormGroup {
@@ -450,7 +450,7 @@ function uniqueByMessageWrapper(
spec: ListValueSpecObject | ListValueSpecUnion,
obj: Record<string, string>,
) {
let configSpec: ConfigSpec
let configSpec: InputSpec
if (isUnion(spec)) {
const tagId = spec.tag.id
configSpec = {
@@ -469,7 +469,7 @@ function uniqueByMessageWrapper(
function uniqueByMessage(
uniqueBy: UniqueBy,
configSpec: ConfigSpec,
configSpec: InputSpec,
outermost = true,
): string {
let joinFunc
@@ -510,7 +510,7 @@ function isUnion(spec: any): spec is ListValueSpecUnion {
}
export function convertValuesRecursive(
configSpec: ConfigSpec,
configSpec: InputSpec,
group: UntypedFormGroup,
) {
Object.entries(configSpec).forEach(([key, valueSpec]) => {

View File

@@ -1,4 +1,4 @@
import { ConfigSpec } from 'start-sdk/types/config-types'
import { InputSpec } from 'start-sdk/types/config-types'
import { Url } from '@start9labs/shared'
import { MarketplaceManifest } from '@start9labs/marketplace'
import { BasicInfo } from 'src/app/pages/developer-routes/developer-menu/form-info'
@@ -264,7 +264,7 @@ export interface Action {
warning: string | null
implementation: ActionImpl
'allowed-statuses': (PackageMainStatus.Stopped | PackageMainStatus.Running)[]
'input-spec': ConfigSpec | null
'input-spec': InputSpec | null
}
export interface Status {