1
- import type {
1
+ import { jsonization } from '@aas-core-works/aas-core3.0-typescript' ;
2
+ import {
2
3
AssetAdministrationShell as CoreAssetAdministrationShell ,
3
4
AssetInformation as CoreAssetInformation ,
4
5
Reference as CoreReference ,
5
6
} from '@aas-core-works/aas-core3.0-typescript/types' ;
6
- import type {
7
+ import {
7
8
AssetAdministrationShell as ApiAssetAdministrationShell ,
8
9
AssetInformation as ApiAssetInformation ,
9
10
Reference as ApiReference ,
10
11
} from '../generated/types.gen' ;
11
- import { jsonization } from '@aas-core-works/aas-core3.0-typescript' ;
12
12
13
13
/**
14
14
* Convert an API AssetAdministrationShell to a Core Works AssetAdministrationShell
@@ -27,7 +27,10 @@ export function convertApiAasToCoreAas(aas: ApiAssetAdministrationShell): CoreAs
27
27
if ( instanceOrError . error !== null ) {
28
28
throw instanceOrError . error ;
29
29
}
30
- return instanceOrError . mustValue ( ) ;
30
+ const instance = instanceOrError . mustValue ( ) ;
31
+ // set the prototype
32
+ Object . setPrototypeOf ( instance , CoreAssetAdministrationShell . prototype ) ;
33
+ return instance ;
31
34
}
32
35
33
36
/**
@@ -65,7 +68,10 @@ export function convertApiAssetInformationToCoreAssetInformation(
65
68
if ( instanceOrError . error !== null ) {
66
69
throw instanceOrError . error ;
67
70
}
68
- return instanceOrError . mustValue ( ) ;
71
+ const instance = instanceOrError . mustValue ( ) ;
72
+ // set the prototype
73
+ Object . setPrototypeOf ( instance , CoreAssetInformation . prototype ) ;
74
+ return instance ;
69
75
}
70
76
71
77
/**
@@ -103,7 +109,10 @@ export function convertApiReferenceToCoreReference(reference: ApiReference): Cor
103
109
if ( instanceOrError . error !== null ) {
104
110
throw instanceOrError . error ;
105
111
}
106
- return instanceOrError . mustValue ( ) ;
112
+ const instance = instanceOrError . mustValue ( ) ;
113
+ // set the prototype
114
+ Object . setPrototypeOf ( instance , CoreReference . prototype ) ;
115
+ return instance ;
107
116
}
108
117
109
118
/**
0 commit comments