-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
57 changed files
with
742 additions
and
735 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 55 additions & 55 deletions
110
...er/src/app/packages/create-json-reader.ts → ...ver/src/app/package/create-json-reader.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,55 @@ | ||
/****************************************************************************** | ||
* | ||
* Copyright (c) 2019-2024 Fraunhofer IOSB-INA Lemgo, | ||
* eine rechtlich nicht selbstaendige Einrichtung der Fraunhofer-Gesellschaft | ||
* zur Foerderung der angewandten Forschung e.V. | ||
* | ||
*****************************************************************************/ | ||
|
||
import { aas } from 'aas-core'; | ||
import { AASReader } from './aas-reader.js'; | ||
import { JsonReaderV2 } from './json-reader-v2.js'; | ||
import { JsonReaderV3 } from './json-reader-v3.js'; | ||
import * as aasV2 from '../types/aas-v2.js'; | ||
|
||
export function createJsonReader(data: object): AASReader { | ||
if (isAssetAdministrationShellEnvironment(data)) { | ||
return new JsonReaderV2(data); | ||
} | ||
|
||
if (isEnvironment(data)) { | ||
return new JsonReaderV3(data); | ||
} | ||
|
||
if (isSubmodelElement(data)) { | ||
return new JsonReaderV3(); | ||
} | ||
|
||
if (isSubmodelElementV2(data)) { | ||
return new JsonReaderV2(); | ||
} | ||
|
||
throw new Error('Not implemented.'); | ||
|
||
function isAssetAdministrationShellEnvironment(value: unknown): value is aasV2.AssetAdministrationShellEnvironment { | ||
const env = value as aasV2.AssetAdministrationShellEnvironment; | ||
return Array.isArray(env.assets); | ||
} | ||
|
||
function isEnvironment(value: unknown): value is aas.Environment { | ||
const env = value as aas.Environment; | ||
return ( | ||
Array.isArray(env.assetAdministrationShells) && | ||
Array.isArray(env.submodels) && | ||
Array.isArray(env.conceptDescriptions) | ||
); | ||
} | ||
|
||
function isSubmodelElement(value: unknown): value is aas.Referable { | ||
return typeof (value as aas.Referable).modelType === 'string'; | ||
} | ||
|
||
function isSubmodelElementV2(value: unknown): value is aasV2.Referable { | ||
return typeof (value as aasV2.Referable).modelType?.name === 'string'; | ||
} | ||
} | ||
/****************************************************************************** | ||
* | ||
* Copyright (c) 2019-2024 Fraunhofer IOSB-INA Lemgo, | ||
* eine rechtlich nicht selbstaendige Einrichtung der Fraunhofer-Gesellschaft | ||
* zur Foerderung der angewandten Forschung e.V. | ||
* | ||
*****************************************************************************/ | ||
|
||
import { aas } from 'aas-core'; | ||
import { AASReader } from './aas-reader.js'; | ||
import { JsonReaderV2 } from './json-reader-v2.js'; | ||
import { JsonReaderV3 } from './json-reader-v3.js'; | ||
import * as aasV2 from '../types/aas-v2.js'; | ||
|
||
export function createJsonReader(data: object): AASReader { | ||
if (isAssetAdministrationShellEnvironment(data)) { | ||
return new JsonReaderV2(data); | ||
} | ||
|
||
if (isEnvironment(data)) { | ||
return new JsonReaderV3(data); | ||
} | ||
|
||
if (isSubmodelElement(data)) { | ||
return new JsonReaderV3(); | ||
} | ||
|
||
if (isSubmodelElementV2(data)) { | ||
return new JsonReaderV2(); | ||
} | ||
|
||
throw new Error('Not implemented.'); | ||
|
||
function isAssetAdministrationShellEnvironment(value: unknown): value is aasV2.AssetAdministrationShellEnvironment { | ||
const env = value as aasV2.AssetAdministrationShellEnvironment; | ||
return Array.isArray(env.assets); | ||
} | ||
|
||
function isEnvironment(value: unknown): value is aas.Environment { | ||
const env = value as aas.Environment; | ||
return ( | ||
Array.isArray(env.assetAdministrationShells) && | ||
Array.isArray(env.submodels) && | ||
Array.isArray(env.conceptDescriptions) | ||
); | ||
} | ||
|
||
function isSubmodelElement(value: unknown): value is aas.Referable { | ||
return typeof (value as aas.Referable).modelType === 'string'; | ||
} | ||
|
||
function isSubmodelElementV2(value: unknown): value is aasV2.Referable { | ||
return typeof (value as aasV2.Referable).modelType?.name === 'string'; | ||
} | ||
} |
Oops, something went wrong.