basyx-typescript-sdk 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/index.js +58 -54
- package/bundle/index.js.map +1 -1
- package/dist/clients/AasRepositoryClient.js +58 -54
- package/package.json +1 -1
package/bundle/index.js
CHANGED
|
@@ -665,18 +665,18 @@ class AasRepositoryClient {
|
|
|
665
665
|
try {
|
|
666
666
|
const client = createCustomClient(baseUrl, headers);
|
|
667
667
|
const encodedAssetIds = assetIds?.map((id) => base64Encode(JSON.stringify(id)));
|
|
668
|
-
const
|
|
668
|
+
const result = await getAllAssetAdministrationShells({
|
|
669
669
|
client,
|
|
670
670
|
query: { assetIds: encodedAssetIds, idShort, limit, cursor },
|
|
671
671
|
});
|
|
672
|
-
if (error) {
|
|
673
|
-
return { success: false, error };
|
|
672
|
+
if (result.error) {
|
|
673
|
+
return { success: false, error: result.error };
|
|
674
674
|
}
|
|
675
|
-
const shells = (data.result ?? []).map(convertApiAasToCoreAas);
|
|
675
|
+
const shells = (result.data.result ?? []).map(convertApiAasToCoreAas);
|
|
676
676
|
return {
|
|
677
677
|
success: true,
|
|
678
678
|
data: {
|
|
679
|
-
pagedResult: data.paging_metadata,
|
|
679
|
+
pagedResult: result.data.paging_metadata,
|
|
680
680
|
result: shells,
|
|
681
681
|
},
|
|
682
682
|
};
|
|
@@ -702,14 +702,14 @@ class AasRepositoryClient {
|
|
|
702
702
|
const { baseUrl, assetAdministrationShell, headers } = options;
|
|
703
703
|
try {
|
|
704
704
|
const client = createCustomClient(baseUrl, headers);
|
|
705
|
-
const
|
|
705
|
+
const result = await postAssetAdministrationShell({
|
|
706
706
|
client,
|
|
707
707
|
body: convertCoreAasToApiAas(assetAdministrationShell),
|
|
708
708
|
});
|
|
709
|
-
if (error) {
|
|
710
|
-
return { success: false, error };
|
|
709
|
+
if (result.error) {
|
|
710
|
+
return { success: false, error: result.error };
|
|
711
711
|
}
|
|
712
|
-
return { success: true, data: convertApiAasToCoreAas(data) };
|
|
712
|
+
return { success: true, data: convertApiAasToCoreAas(result.data) };
|
|
713
713
|
}
|
|
714
714
|
catch (err) {
|
|
715
715
|
return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
|
|
@@ -730,14 +730,14 @@ class AasRepositoryClient {
|
|
|
730
730
|
try {
|
|
731
731
|
const client = createCustomClient(baseUrl, headers);
|
|
732
732
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
733
|
-
const
|
|
733
|
+
const result = await deleteAssetAdministrationShellById({
|
|
734
734
|
client,
|
|
735
735
|
path: { aasIdentifier: encodedAasIdentifier },
|
|
736
736
|
});
|
|
737
|
-
if (error) {
|
|
738
|
-
return { success: false, error };
|
|
737
|
+
if (result.error) {
|
|
738
|
+
return { success: false, error: result.error };
|
|
739
739
|
}
|
|
740
|
-
return { success: true, data };
|
|
740
|
+
return { success: true, data: result.data };
|
|
741
741
|
}
|
|
742
742
|
catch (err) {
|
|
743
743
|
return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
|
|
@@ -758,14 +758,18 @@ class AasRepositoryClient {
|
|
|
758
758
|
try {
|
|
759
759
|
const client = createCustomClient(baseUrl, headers);
|
|
760
760
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
761
|
-
const
|
|
761
|
+
const result = await getAssetAdministrationShellById({
|
|
762
762
|
client,
|
|
763
763
|
path: { aasIdentifier: encodedAasIdentifier },
|
|
764
764
|
});
|
|
765
|
-
if (error) {
|
|
766
|
-
|
|
765
|
+
if (result.error) {
|
|
766
|
+
// Return the complete error object with status code
|
|
767
|
+
return {
|
|
768
|
+
success: false,
|
|
769
|
+
error: result.error,
|
|
770
|
+
};
|
|
767
771
|
}
|
|
768
|
-
return { success: true, data: convertApiAasToCoreAas(data) };
|
|
772
|
+
return { success: true, data: convertApiAasToCoreAas(result.data) };
|
|
769
773
|
}
|
|
770
774
|
catch (err) {
|
|
771
775
|
return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
|
|
@@ -787,15 +791,15 @@ class AasRepositoryClient {
|
|
|
787
791
|
try {
|
|
788
792
|
const client = createCustomClient(baseUrl, headers);
|
|
789
793
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
790
|
-
const
|
|
794
|
+
const result = await putAssetAdministrationShellById({
|
|
791
795
|
client,
|
|
792
796
|
path: { aasIdentifier: encodedAasIdentifier },
|
|
793
797
|
body: convertCoreAasToApiAas(assetAdministrationShell),
|
|
794
798
|
});
|
|
795
|
-
if (error) {
|
|
796
|
-
return { success: false, error };
|
|
799
|
+
if (result.error) {
|
|
800
|
+
return { success: false, error: result.error };
|
|
797
801
|
}
|
|
798
|
-
return { success: true, data };
|
|
802
|
+
return { success: true, data: result.data };
|
|
799
803
|
}
|
|
800
804
|
catch (err) {
|
|
801
805
|
return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
|
|
@@ -816,16 +820,16 @@ class AasRepositoryClient {
|
|
|
816
820
|
try {
|
|
817
821
|
const client = createCustomClient(baseUrl, headers);
|
|
818
822
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
819
|
-
const
|
|
823
|
+
const result = await getAssetInformationAasRepository({
|
|
820
824
|
client,
|
|
821
825
|
path: { aasIdentifier: encodedAasIdentifier },
|
|
822
826
|
});
|
|
823
|
-
if (error) {
|
|
824
|
-
return { success: false, error };
|
|
827
|
+
if (result.error) {
|
|
828
|
+
return { success: false, error: result.error };
|
|
825
829
|
}
|
|
826
830
|
return {
|
|
827
831
|
success: true,
|
|
828
|
-
data: convertApiAssetInformationToCoreAssetInformation(data),
|
|
832
|
+
data: convertApiAssetInformationToCoreAssetInformation(result.data),
|
|
829
833
|
};
|
|
830
834
|
}
|
|
831
835
|
catch (err) {
|
|
@@ -848,15 +852,15 @@ class AasRepositoryClient {
|
|
|
848
852
|
try {
|
|
849
853
|
const client = createCustomClient(baseUrl, headers);
|
|
850
854
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
851
|
-
const
|
|
855
|
+
const result = await putAssetInformationAasRepository({
|
|
852
856
|
client,
|
|
853
857
|
path: { aasIdentifier: encodedAasIdentifier },
|
|
854
858
|
body: convertCoreAssetInformationToApiAssetInformation(assetInformation),
|
|
855
859
|
});
|
|
856
|
-
if (error) {
|
|
857
|
-
return { success: false, error };
|
|
860
|
+
if (result.error) {
|
|
861
|
+
return { success: false, error: result.error };
|
|
858
862
|
}
|
|
859
|
-
return { success: true, data };
|
|
863
|
+
return { success: true, data: result.data };
|
|
860
864
|
}
|
|
861
865
|
catch (err) {
|
|
862
866
|
return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
|
|
@@ -877,16 +881,16 @@ class AasRepositoryClient {
|
|
|
877
881
|
try {
|
|
878
882
|
const client = createCustomClient(baseUrl, headers);
|
|
879
883
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
880
|
-
const
|
|
884
|
+
const result = await deleteThumbnailAasRepository({
|
|
881
885
|
client,
|
|
882
886
|
path: { aasIdentifier: encodedAasIdentifier },
|
|
883
887
|
});
|
|
884
|
-
if (error) {
|
|
885
|
-
return { success: false, error };
|
|
888
|
+
if (result.error) {
|
|
889
|
+
return { success: false, error: result.error };
|
|
886
890
|
}
|
|
887
891
|
return {
|
|
888
892
|
success: true,
|
|
889
|
-
data: data,
|
|
893
|
+
data: result.data,
|
|
890
894
|
};
|
|
891
895
|
}
|
|
892
896
|
catch (err) {
|
|
@@ -908,14 +912,14 @@ class AasRepositoryClient {
|
|
|
908
912
|
try {
|
|
909
913
|
const client = createCustomClient(baseUrl, headers);
|
|
910
914
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
911
|
-
const
|
|
915
|
+
const result = await getThumbnailAasRepository({
|
|
912
916
|
client,
|
|
913
917
|
path: { aasIdentifier: encodedAasIdentifier },
|
|
914
918
|
});
|
|
915
|
-
if (error) {
|
|
916
|
-
return { success: false, error };
|
|
919
|
+
if (result.error) {
|
|
920
|
+
return { success: false, error: result.error };
|
|
917
921
|
}
|
|
918
|
-
return { success: true, data };
|
|
922
|
+
return { success: true, data: result.data };
|
|
919
923
|
}
|
|
920
924
|
catch (err) {
|
|
921
925
|
return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
|
|
@@ -937,15 +941,15 @@ class AasRepositoryClient {
|
|
|
937
941
|
try {
|
|
938
942
|
const client = createCustomClient(baseUrl, headers);
|
|
939
943
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
940
|
-
const
|
|
944
|
+
const result = await putThumbnailAasRepository({
|
|
941
945
|
client,
|
|
942
946
|
path: { aasIdentifier: encodedAasIdentifier },
|
|
943
947
|
body: thumbnail,
|
|
944
948
|
});
|
|
945
|
-
if (error) {
|
|
946
|
-
return { success: false, error };
|
|
949
|
+
if (result.error) {
|
|
950
|
+
return { success: false, error: result.error };
|
|
947
951
|
}
|
|
948
|
-
return { success: true, data };
|
|
952
|
+
return { success: true, data: result.data };
|
|
949
953
|
}
|
|
950
954
|
catch (err) {
|
|
951
955
|
return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
|
|
@@ -968,19 +972,19 @@ class AasRepositoryClient {
|
|
|
968
972
|
try {
|
|
969
973
|
const client = createCustomClient(baseUrl, headers);
|
|
970
974
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
971
|
-
const
|
|
975
|
+
const result = await getAllSubmodelReferencesAasRepository({
|
|
972
976
|
client,
|
|
973
977
|
path: { aasIdentifier: encodedAasIdentifier },
|
|
974
978
|
query: { limit, cursor },
|
|
975
979
|
});
|
|
976
|
-
if (error) {
|
|
977
|
-
return { success: false, error };
|
|
980
|
+
if (result.error) {
|
|
981
|
+
return { success: false, error: result.error };
|
|
978
982
|
}
|
|
979
|
-
const submodelReferences = (data.result ?? []).map(convertApiReferenceToCoreReference);
|
|
983
|
+
const submodelReferences = (result.data.result ?? []).map(convertApiReferenceToCoreReference);
|
|
980
984
|
return {
|
|
981
985
|
success: true,
|
|
982
986
|
data: {
|
|
983
|
-
pagedResult: data.paging_metadata,
|
|
987
|
+
pagedResult: result.data.paging_metadata,
|
|
984
988
|
result: submodelReferences,
|
|
985
989
|
},
|
|
986
990
|
};
|
|
@@ -1005,15 +1009,15 @@ class AasRepositoryClient {
|
|
|
1005
1009
|
try {
|
|
1006
1010
|
const client = createCustomClient(baseUrl, headers);
|
|
1007
1011
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
1008
|
-
const
|
|
1012
|
+
const result = await postSubmodelReferenceAasRepository({
|
|
1009
1013
|
client,
|
|
1010
1014
|
path: { aasIdentifier: encodedAasIdentifier },
|
|
1011
1015
|
body: convertCoreReferenceToApiReference(submodelReference),
|
|
1012
1016
|
});
|
|
1013
|
-
if (error) {
|
|
1014
|
-
return { success: false, error };
|
|
1017
|
+
if (result.error) {
|
|
1018
|
+
return { success: false, error: result.error };
|
|
1015
1019
|
}
|
|
1016
|
-
return { success: true, data: convertApiReferenceToCoreReference(data) };
|
|
1020
|
+
return { success: true, data: convertApiReferenceToCoreReference(result.data) };
|
|
1017
1021
|
}
|
|
1018
1022
|
catch (err) {
|
|
1019
1023
|
return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
|
|
@@ -1036,17 +1040,17 @@ class AasRepositoryClient {
|
|
|
1036
1040
|
const client = createCustomClient(baseUrl, headers);
|
|
1037
1041
|
const encodedAasIdentifier = base64Encode(aasIdentifier);
|
|
1038
1042
|
const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
|
|
1039
|
-
const
|
|
1043
|
+
const result = await deleteSubmodelReferenceByIdAasRepository({
|
|
1040
1044
|
client,
|
|
1041
1045
|
path: {
|
|
1042
1046
|
aasIdentifier: encodedAasIdentifier,
|
|
1043
1047
|
submodelIdentifier: encodedSubmodelIdentifier,
|
|
1044
1048
|
},
|
|
1045
1049
|
});
|
|
1046
|
-
if (error) {
|
|
1047
|
-
return { success: false, error };
|
|
1050
|
+
if (result.error) {
|
|
1051
|
+
return { success: false, error: result.error };
|
|
1048
1052
|
}
|
|
1049
|
-
return { success: true, data };
|
|
1053
|
+
return { success: true, data: result.data };
|
|
1050
1054
|
}
|
|
1051
1055
|
catch (err) {
|
|
1052
1056
|
return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
|