feat: enable strictNullChecks

feat: enable `noImplicitAny`

chore: remove sync data access

fix loading package data for affected dependencies

chore: properly get alt marketplace data

update patchdb client to allow for emit on undefined values
This commit is contained in:
waterplea
2022-05-26 18:20:31 +03:00
committed by Lucy C
parent 948fb795f2
commit 0390954a85
99 changed files with 674 additions and 535 deletions

View File

@@ -0,0 +1,11 @@
import { ActivatedRoute } from '@angular/router'
export function getProjectId({ snapshot }: ActivatedRoute): string {
const projectId = snapshot.paramMap.get('projectId')
if (!projectId) {
throw new Error('projectId is missing from route params')
}
return projectId
}

View File

@@ -3,9 +3,9 @@ import { InstallProgress } from 'src/app/types/install-progress'
import { ProgressData } from 'src/app/types/progress-data'
export function packageLoadingProgress(
loadData: InstallProgress,
loadData?: InstallProgress,
): ProgressData | null {
if (isEmptyObject(loadData)) {
if (!loadData || isEmptyObject(loadData)) {
return null
}
@@ -20,6 +20,7 @@ export function packageLoadingProgress(
} = loadData
// only permit 100% when "complete" == true
size = size || 0
downloaded = downloadComplete ? size : Math.max(downloaded - 1, 0)
validated = validationComplete ? size : Math.max(validated - 1, 0)
unpacked = unpackComplete ? size : Math.max(unpacked - 1, 0)

View File

@@ -5,12 +5,12 @@ import {
} from 'src/app/services/patch-db/data-model'
export function parseDataModel(data: DataModel): ParsedData {
const all = JSON.parse(JSON.stringify(data['package-data'])) as {
[id: string]: PackageDataEntry
}
const all: Record<string, PackageDataEntry> = JSON.parse(
JSON.stringify(data['package-data']),
)
const order = [...(data.ui['pkg-order'] || [])]
const pkgs = []
const pkgs: PackageDataEntry[] = []
const recoveredPkgs = Object.entries(data['recovered-packages'])
.filter(([id, _]) => !all[id])
.map(([id, val]) => ({

View File

@@ -29,7 +29,7 @@ const matchPropertiesV1 = shape(
qr: boolean,
},
['description', 'copyable', 'qr'],
{ description: null as null, copyable: false, qr: false } as const,
{ copyable: false, qr: false } as const,
)
type PropertiesV1 = typeof matchPropertiesV1._TYPE
@@ -49,7 +49,6 @@ const matchPackagePropertyString = shape(
},
['description', 'copyable', 'qr', 'masked'],
{
description: null as null,
copyable: false,
qr: false,
masked: false,
@@ -100,16 +99,16 @@ export function parsePropertiesPermissive(
name,
value: {
value: String(value),
description: null,
copyable: false,
qr: false,
masked: false,
},
}))
.reduce((acc, { name, value }) => {
acc[name] = value
// TODO: Fix type
acc[name] = value as any
return acc
}, {})
}, {} as PackageProperties)
}
switch (properties.version) {
case 1: