Skip to content

Commit

Permalink
feat: replace any with correct type
Browse files Browse the repository at this point in the history
Signed-off-by: Jeroen Branje <[email protected]>
  • Loading branch information
jeroenbranje committed Dec 3, 2024
1 parent bb8dbd1 commit 0da65ea
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
10 changes: 9 additions & 1 deletion apps/envited.ascs.digital/common/asset/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export enum AccessRole {
}

export interface Manifest {
'@context': any
'@context': ManifestContext
'@id': string
'@type': string
'manifest:data': {
Expand All @@ -16,6 +16,14 @@ export interface Manifest {
'manifest:license': ManifestLicense
}

export interface ManifestContext {
xsd: string
gx: string
skos: string
sh: string
manifest: string
}

export interface ManifestLink {
'@type': string
'manifest:accessRole': AccessRole
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import manifest from '../fixtures/manifest.json'
import { Manifest } from './types'
import * as SUT from './validateAndCreateMetadata'

describe('common/asset/validateAndCreateMetadata', () => {
Expand Down Expand Up @@ -230,7 +231,7 @@ describe('common/asset/validateAndCreateMetadata', () => {
getFileFromByteArray: getFileFromByteArrayStub,
validateShaclDataWithSchema: validateShaclDataSchemaStub,
fs: fsStub,
})(byteArray as any, manifest as any)
})(byteArray as any, manifest as Manifest)

expect(result).toEqual({
conforms: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ export const _getShaclSchemaAndValidate =
}: {
validateManifest: (
byteArray: Uint8Array,
) => Promise<{ conforms: boolean; report: ValidationReport<any> | { conforms: boolean }; data: any }>
) => Promise<{ conforms: boolean; report: ValidationReport | { conforms: boolean }; data: any }>
validateDomainMetadata: (
byteArray: Uint8Array,
manifest: Manifest,
) => Promise<{ conforms: boolean; reports: (ValidationReport<any> | { conforms: boolean })[]; data: any }>
) => Promise<{ conforms: boolean; reports: (ValidationReport | { conforms: boolean })[]; data: any }>
}) =>
async (byteArray: Uint8Array) => {
try {
Expand Down Expand Up @@ -76,7 +76,7 @@ export const _validateManifest =
data: string,
stream: NodeJS.ReadableStream,
) => Promise<
| ValidationReport<any>
| ValidationReport
| {
conforms: boolean
}
Expand Down Expand Up @@ -117,7 +117,7 @@ export const _validateDomainMetadata =
data: string,
stream: NodeJS.ReadableStream,
) => Promise<
| ValidationReport<any>
| ValidationReport
| {
conforms: boolean
}
Expand Down Expand Up @@ -171,7 +171,7 @@ export const _validateAndCreateMetadata =
getShaclSchemaAndValidate: (byteArray: Uint8Array) => Promise<
| {
conforms: boolean
reports: (ValidationReport<any> | { conforms: boolean })[]
reports: (ValidationReport | { conforms: boolean })[]
data: { manifest?: undefined; domainMetadata?: undefined }
}
| { conforms: boolean; data: { manifest: any; domainMetadata: any }; reports: { conforms: boolean }[] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const _main =
asset: Asset,
) => Promise<{
conforms: boolean
reports: (ValidationReport<any> | { conforms: boolean })[] | { conforms: boolean }[]
reports: (ValidationReport | { conforms: boolean })[] | { conforms: boolean }[]
metadata: any
modifiedManifest: Record<string, unknown>
assetCID: string
Expand Down

0 comments on commit 0da65ea

Please sign in to comment.