Skip to content

Commit 7b3d131

Browse files
authored
Adds missing model exports (#326)
* Adds missing export for descriptor models * Removes console logs * Updates README to correctly display how to handle errors * Bumps version to 1.0.2
1 parent 98f4fd9 commit 7b3d131

10 files changed

+25
-24
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,13 @@ async function getAllShells() {
6060

6161
try {
6262
const response = await client.getAllAssetAdministrationShells({ configuration });
63-
console.log('Asset Administration Shells fetched successfully:', response);
64-
// You can now use the response as needed
63+
64+
if (response.success) {
65+
console.log('Asset Administration Shells fetched successfully:', response.data);
66+
// You can now use the response data as needed
67+
} else {
68+
console.error('Failed to fetch Asset Administration Shells:', response.error);
69+
}
6570
} catch (error) {
6671
console.error('Error fetching Asset Administration Shells:', error);
6772
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "basyx-typescript-sdk",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "BaSyx TypeScript SDK for developing applications and components for the Asset Administration Shell (AAS)",
55
"main": "bundle/index.cjs",
66
"module": "bundle/index.mjs",

src/clients/AasDiscoveryClient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export class AasDiscoveryClient {
4949
});
5050

5151
const shellIds = result.result ?? [];
52-
console.log('all shellIds:', shellIds);
52+
5353
return {
5454
success: true,
5555
data: { pagedResult: result.pagingMetadata, result: shellIds },
@@ -88,7 +88,7 @@ export class AasDiscoveryClient {
8888
aasIdentifier: encodedAasIdentifier,
8989
specificAssetId: specificAssetId.map(convertCoreAssetIdToApiAssetId),
9090
});
91-
console.log('created asset links:', result);
91+
9292
return { success: true, data: result.map(convertApiAssetIdToCoreAssetId) };
9393
} catch (err) {
9494
const customError = await handleApiError(err);

src/clients/AasRegistryClient.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class AasRegistryClient {
5656
assetType: encodedAssetType,
5757
});
5858
const aasDescriptors = (result.result ?? []).map(convertApiAasDescriptorToCoreAasDescriptor);
59-
console.log('all aas descriptors:', aasDescriptors);
59+
6060
return {
6161
success: true,
6262
data: { pagedResult: result.pagingMetadata, result: aasDescriptors },
@@ -92,7 +92,7 @@ export class AasRegistryClient {
9292
assetAdministrationShellDescriptor
9393
),
9494
});
95-
console.log('created aas descriptor:', result);
95+
9696
return { success: true, data: convertApiAasDescriptorToCoreAasDescriptor(result) };
9797
} catch (err) {
9898
const customError = await handleApiError(err);
@@ -243,7 +243,7 @@ export class AasRegistryClient {
243243
cursor: cursor,
244244
});
245245
const submodelDescriptors = (result.result ?? []).map(convertApiSubmodelDescriptorToCoreSubmodelDescriptor);
246-
console.log('all submodel descriptors:', submodelDescriptors);
246+
247247
return {
248248
success: true,
249249
data: { pagedResult: result.pagingMetadata, result: submodelDescriptors },
@@ -282,11 +282,10 @@ export class AasRegistryClient {
282282
aasIdentifier: encodedAasIdentifier,
283283
submodelDescriptor: convertCoreSubmodelDescriptorToApiSubmodelDescriptor(submodelDescriptor),
284284
});
285-
console.log('created submodel descriptor:', result);
285+
286286
return { success: true, data: convertApiSubmodelDescriptorToCoreSubmodelDescriptor(result) };
287287
} catch (err) {
288288
const customError = await handleApiError(err);
289-
//console.log('error during creation of submodel descriptor:', customError);
290289
return { success: false, error: customError };
291290
}
292291
}

src/clients/AasRepositoryClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,7 @@ export class AasRepositoryClient {
13331333
idShortPath: idShortPath,
13341334
submodelElement: convertCoreSubmodelElementToApiSubmodelElement(submodelElement),
13351335
});
1336-
console.log('created element at specified path:', result);
1336+
13371337
return { success: true, data: convertApiSubmodelElementToCoreSubmodelElement(result) };
13381338
} catch (err) {
13391339
const customError = await handleApiError(err);

src/clients/AasxFileClient.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,12 @@ export class AasxFileClient {
3333
const result = await apiInstance.getAllAASXPackageIds({
3434
aasId: aasId,
3535
});
36-
console.log('received packages:', result);
36+
3737
return {
3838
success: true,
3939
data: { result },
4040
};
4141
} catch (err) {
42-
console.error('Failed to fetch AASX packagees:', err);
4342
const customError = await handleApiError(err);
4443
return { success: false, error: customError };
4544
}
@@ -75,10 +74,9 @@ export class AasxFileClient {
7574
file: file,
7675
fileName: fileName,
7776
});
78-
console.log('created aasx package: ', result);
77+
7978
return { success: true, data: result };
8079
} catch (err) {
81-
console.error('Failed to create AASX package:', err);
8280
const customError = await handleApiError(err);
8381
return { success: false, error: customError };
8482
}
@@ -107,10 +105,9 @@ export class AasxFileClient {
107105
const result = await apiInstance.getAASXByPackageId({
108106
packageId: encodedPackageId,
109107
});
110-
console.log('received aasx package by id: ', result);
108+
111109
return { success: true, data: result };
112110
} catch (err) {
113-
console.error('Failed to fetch AASX package by id:', err);
114111
const customError = await handleApiError(err);
115112
return { success: false, error: customError };
116113
}

src/clients/SubmodelRegistryClient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class SubmodelRegistryClient {
4444
cursor: cursor,
4545
});
4646
const submodelDescriptors = (result.result ?? []).map(convertApiSubmodelDescriptorToCoreSubmodelDescriptor);
47-
console.log('all submodel descriptors:', submodelDescriptors);
47+
4848
return {
4949
success: true,
5050
data: { pagedResult: result.pagingMetadata, result: submodelDescriptors },
@@ -76,7 +76,7 @@ export class SubmodelRegistryClient {
7676
const result = await apiInstance.postSubmodelDescriptor({
7777
submodelDescriptor: convertCoreSubmodelDescriptorToApiSubmodelDescriptor(submodelDescriptor),
7878
});
79-
console.log('created submodel descriptor:', result);
79+
8080
return { success: true, data: convertApiSubmodelDescriptorToCoreSubmodelDescriptor(result) };
8181
} catch (err) {
8282
const customError = await handleApiError(err);

src/clients/SubmodelRepositoryClient.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class SubmodelRepositoryClient {
6161
});
6262

6363
const submodels = (result.result ?? []).map(convertApiSubmodelToCoreSubmodel);
64-
console.log('all submodels:', submodels);
64+
6565
return {
6666
success: true,
6767
data: { pagedResult: result.pagingMetadata, result: submodels },
@@ -248,7 +248,7 @@ export class SubmodelRepositoryClient {
248248
});
249249

250250
const submodelElements = (result.result ?? []).map(convertApiSubmodelElementToCoreSubmodelElement);
251-
console.log('all submodelElements:', submodelElements);
251+
252252
return {
253253
success: true,
254254
data: { pagedResult: result.pagingMetadata, result: submodelElements },
@@ -324,7 +324,7 @@ export class SubmodelRepositoryClient {
324324
level: level,
325325
extent: extent,
326326
});
327-
console.log('data:', result);
327+
328328
return { success: true, data: convertApiSubmodelElementToCoreSubmodelElement(result) };
329329
} catch (err) {
330330
const customError = await handleApiError(err);
@@ -361,7 +361,7 @@ export class SubmodelRepositoryClient {
361361
idShortPath: idShortPath,
362362
submodelElement: convertCoreSubmodelElementToApiSubmodelElement(submodelElement),
363363
});
364-
console.log('created element at specified path:', result);
364+
365365
return { success: true, data: convertApiSubmodelElementToCoreSubmodelElement(result) };
366366
} catch (err) {
367367
const customError = await handleApiError(err);

src/models/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export * from './api';
22
export * from './AssetId';
3+
export * from './Descriptors';

src/utils/SemanticIdUtils.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export function checkSemanticId(submodelElement: ISubmodelElement, semanticId: s
2525
if (!Array.isArray(submodelElement?.semanticId?.keys) || submodelElement.semanticId.keys.length == 0) return false;
2626

2727
for (const key of submodelElement.semanticId.keys) {
28-
// console.log('checkSemanticId: ', 'key of submodelElement', key.value, 'semanticId', semanticId);
2928
if (key.value.startsWith('0112/')) {
3029
return checkSemanticIdIecCdd(key.value, semanticId);
3130
} else if (key.value.startsWith('0173-1#') || key.value.startsWith('0173/1///')) {

0 commit comments

Comments
 (0)