Skip to content

Commit

Permalink
feat: code prettier
Browse files Browse the repository at this point in the history
Signed-off-by: Jeroen Branje <[email protected]>
  • Loading branch information
jeroenbranje committed Dec 10, 2024
1 parent 3224d18 commit 5877592
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 16 deletions.
40 changes: 35 additions & 5 deletions apps/envited.ascs.digital/common/asset/createTokenMetadata.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { TOKEN_TAGS } from '../constants/tokenTags'
import domainMetadata from '../fixtures/domainMetadata.json'
import manifest from '../fixtures/manifest.json'
import manifestLicenseRefCustomCommercialAgreement from '../fixtures/manifestLicenseRefCustomCommercialAgreement.json'
import manifestLicenseRefPolicySmartContract from '../fixtures/manifestLicenseRefPolicySmartContract.json'
import manifestRemoteAssetData from '../fixtures/manifestRemoteAssetData.json'
import * as SUT from './createTokenMetadata'
import { TOKEN_TAGS } from '../constants/tokenTags'

export const TEST_TOKEN_TAGS = {
ASAM_OPENDRIVE_VERSION: 'ASAM OpenDRIVE 1.6',
Expand All @@ -20,7 +20,15 @@ describe('common/asset/createTokenMetadata', () => {
isBooleanAmount: true,
name: 'TestfeldNiedersachsen_ALKS_ODR_sample',
description: 'simple hdmap example file on Testfeld Niedersachsen for ALKS scenario',
tags: [TOKEN_TAGS.GAIA_X, TOKEN_TAGS.ASCS, TOKEN_TAGS.ENVITED_X, TOKEN_TAGS.EVES, TOKEN_TAGS.NFT, TEST_TOKEN_TAGS.ASAM_OPENDRIVE_VERSION, TOKEN_TAGS.THIRD_PARTY_HOSTED],
tags: [
TOKEN_TAGS.GAIA_X,
TOKEN_TAGS.ASCS,
TOKEN_TAGS.ENVITED_X,
TOKEN_TAGS.EVES,
TOKEN_TAGS.NFT,
TEST_TOKEN_TAGS.ASAM_OPENDRIVE_VERSION,
TOKEN_TAGS.THIRD_PARTY_HOSTED,
],
minter: 'MINTER',
creators: ['CREATOR'],
publishers: ['Automotive Solution Center for Simulation e.V.', 'ENVITED-X Data Space'],
Expand Down Expand Up @@ -117,7 +125,15 @@ describe('common/asset/createTokenMetadata', () => {
isBooleanAmount: true,
name: 'TestfeldNiedersachsen_ALKS_ODR_sample',
description: 'simple hdmap example file on Testfeld Niedersachsen for ALKS scenario',
tags: [TOKEN_TAGS.GAIA_X, TOKEN_TAGS.ASCS, TOKEN_TAGS.ENVITED_X, TOKEN_TAGS.EVES, TOKEN_TAGS.NFT, TEST_TOKEN_TAGS.ASAM_OPENDRIVE_VERSION, TOKEN_TAGS.THIRD_PARTY_HOSTED],
tags: [
TOKEN_TAGS.GAIA_X,
TOKEN_TAGS.ASCS,
TOKEN_TAGS.ENVITED_X,
TOKEN_TAGS.EVES,
TOKEN_TAGS.NFT,
TEST_TOKEN_TAGS.ASAM_OPENDRIVE_VERSION,
TOKEN_TAGS.THIRD_PARTY_HOSTED,
],
minter: 'MINTER',
creators: ['CREATOR'],
publishers: ['Automotive Solution Center for Simulation e.V.', 'ENVITED-X Data Space'],
Expand Down Expand Up @@ -214,7 +230,14 @@ describe('common/asset/createTokenMetadata', () => {
isBooleanAmount: true,
name: 'TestfeldNiedersachsen_ALKS_ODR_sample',
description: 'simple hdmap example file on Testfeld Niedersachsen for ALKS scenario',
tags: [TOKEN_TAGS.GAIA_X, TOKEN_TAGS.ASCS, TOKEN_TAGS.ENVITED_X, TOKEN_TAGS.EVES, TOKEN_TAGS.NFT, TEST_TOKEN_TAGS.ASAM_OPENDRIVE_VERSION],
tags: [
TOKEN_TAGS.GAIA_X,
TOKEN_TAGS.ASCS,
TOKEN_TAGS.ENVITED_X,
TOKEN_TAGS.EVES,
TOKEN_TAGS.NFT,
TEST_TOKEN_TAGS.ASAM_OPENDRIVE_VERSION,
],
minter: 'MINTER',
creators: ['CREATOR'],
publishers: ['Automotive Solution Center for Simulation e.V.', 'ENVITED-X Data Space'],
Expand Down Expand Up @@ -311,7 +334,14 @@ describe('common/asset/createTokenMetadata', () => {
isBooleanAmount: true,
name: 'TestfeldNiedersachsen_ALKS_ODR_sample',
description: 'simple hdmap example file on Testfeld Niedersachsen for ALKS scenario',
tags: [TOKEN_TAGS.GAIA_X, TOKEN_TAGS.ASCS, TOKEN_TAGS.ENVITED_X, TOKEN_TAGS.EVES, TOKEN_TAGS.NFT, TEST_TOKEN_TAGS.ASAM_OPENDRIVE_VERSION],
tags: [
TOKEN_TAGS.GAIA_X,
TOKEN_TAGS.ASCS,
TOKEN_TAGS.ENVITED_X,
TOKEN_TAGS.EVES,
TOKEN_TAGS.NFT,
TEST_TOKEN_TAGS.ASAM_OPENDRIVE_VERSION,
],
minter: 'MINTER',
creators: ['CREATOR'],
publishers: ['Automotive Solution Center for Simulation e.V.', 'ENVITED-X Data Space'],
Expand Down
11 changes: 9 additions & 2 deletions apps/envited.ascs.digital/common/asset/createTokenMetadata.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { append, equals } from 'ramda'

import { TOKEN_TAGS } from '../constants/tokenTags'
import { extractFilenameFromPath, formatAssetUri, formatIpfsUri } from './createTokenMetadata.utils'
import { Manifest } from './types'
import { formatManifestLinkPath, hasManifestThirdPartyLinks } from './validateAndCreateMetadata.utils'
import { TOKEN_TAGS } from '../constants/tokenTags'

export const createTokenMetadata = ({
asset,
Expand Down Expand Up @@ -45,7 +45,14 @@ export const createTokenMetadata = ({
const version = domainMetadata.data['hdmap:format']['hdmap:version']['@value']
const today = new Date()
const date = today.toISOString().split('T')[0]
const tags = [TOKEN_TAGS.GAIA_X, TOKEN_TAGS.ASCS, TOKEN_TAGS.ENVITED_X, TOKEN_TAGS.EVES, TOKEN_TAGS.NFT, `${formatType} ${version}`]
const tags = [
TOKEN_TAGS.GAIA_X,
TOKEN_TAGS.ASCS,
TOKEN_TAGS.ENVITED_X,
TOKEN_TAGS.EVES,
TOKEN_TAGS.NFT,
`${formatType} ${version}`,
]
const isThirdPartyHosted = hasManifestThirdPartyLinks(manifest.data)

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
equals,
find,
groupBy,
includes,
is,
isNil,
map,
Expand All @@ -20,7 +21,6 @@ import {
reject,
replace,
startsWith,
includes,
} from 'ramda'

import { extractFromByteArray, read } from '../archive'
Expand Down Expand Up @@ -99,7 +99,10 @@ export const isSelfHosted = includes('.envited-x.net')
export const hasManifestThirdPartyLinks = (manifest: Manifest) =>
pipe(
getAllManifestLinks,
map((link: ManifestLink) => isRemoteUrl(link['manifest:path']['@value'])&&!isSelfHosted(link['manifest:path']['@value'])),
map(
(link: ManifestLink) =>
isRemoteUrl(link['manifest:path']['@value']) && !isSelfHosted(link['manifest:path']['@value']),
),
(x: boolean[]) => any(equals(true))(x),
)(manifest)

Expand Down
14 changes: 7 additions & 7 deletions apps/envited.ascs.digital/common/constants/tokenTags.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export const TOKEN_TAGS = {
GAIA_X: 'GaiaX',
ASCS: 'ASCS',
ENVITED_X: 'ENVITED-X',
EVES: 'EVES',
NFT: 'nft',
THIRD_PARTY_HOSTED: 'Third Party Hosted',
}
GAIA_X: 'GaiaX',
ASCS: 'ASCS',
ENVITED_X: 'ENVITED-X',
EVES: 'EVES',
NFT: 'nft',
THIRD_PARTY_HOSTED: 'Third Party Hosted',
}

0 comments on commit 5877592

Please sign in to comment.