basyx-typescript-sdk 0.2.1 → 0.9.0

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.
Files changed (155) hide show
  1. package/README.md +5 -3
  2. package/bundle/index.js +17522 -841
  3. package/bundle/index.js.map +1 -1
  4. package/dist/clients/AasDiscoveryClient.d.ts +67 -0
  5. package/dist/clients/AasDiscoveryClient.js +115 -0
  6. package/dist/clients/AasRegistryClient.d.ts +163 -0
  7. package/dist/clients/AasRegistryClient.js +287 -0
  8. package/dist/clients/AasRepositoryClient.d.ts +790 -103
  9. package/dist/clients/AasRepositoryClient.js +1323 -211
  10. package/dist/clients/AasxFileClient.d.ts +81 -0
  11. package/dist/clients/AasxFileClient.js +148 -0
  12. package/dist/clients/ConceptDescriptionRepositoryClient.d.ts +83 -0
  13. package/dist/clients/ConceptDescriptionRepositoryClient.js +143 -0
  14. package/dist/clients/SubmodelRegistryClient.d.ts +77 -0
  15. package/dist/clients/SubmodelRegistryClient.js +138 -0
  16. package/dist/clients/SubmodelRepositoryClient.d.ts +354 -0
  17. package/dist/clients/SubmodelRepositoryClient.js +585 -0
  18. package/dist/clients/index.d.ts +6 -0
  19. package/dist/clients/index.js +6 -0
  20. package/dist/generated/AasDiscoveryService/apis/AssetAdministrationShellBasicDiscoveryAPIApi.d.ts +80 -0
  21. package/dist/generated/AasDiscoveryService/apis/AssetAdministrationShellBasicDiscoveryAPIApi.js +156 -0
  22. package/dist/generated/AasDiscoveryService/apis/DescriptionAPIApi.d.ts +26 -0
  23. package/dist/generated/AasDiscoveryService/apis/DescriptionAPIApi.js +40 -0
  24. package/dist/generated/AasDiscoveryService/apis/index.d.ts +2 -0
  25. package/dist/generated/AasDiscoveryService/apis/index.js +4 -0
  26. package/dist/generated/AasDiscoveryService/index.d.ts +3 -0
  27. package/dist/generated/AasDiscoveryService/index.js +5 -0
  28. package/dist/generated/AasDiscoveryService/models/index.d.ts +297 -0
  29. package/dist/generated/AasDiscoveryService/models/index.js +48 -0
  30. package/dist/generated/AasDiscoveryService/runtime.d.ts +181 -0
  31. package/dist/generated/AasDiscoveryService/runtime.js +326 -0
  32. package/dist/generated/AasRegistryService/apis/AssetAdministrationShellRegistryAPIApi.d.ts +139 -0
  33. package/dist/generated/AasRegistryService/apis/AssetAdministrationShellRegistryAPIApi.js +312 -0
  34. package/dist/generated/AasRegistryService/apis/DescriptionAPIApi.d.ts +26 -0
  35. package/dist/generated/AasRegistryService/apis/DescriptionAPIApi.js +40 -0
  36. package/dist/generated/AasRegistryService/apis/index.d.ts +2 -0
  37. package/dist/generated/AasRegistryService/apis/index.js +4 -0
  38. package/dist/generated/AasRegistryService/index.d.ts +3 -0
  39. package/dist/generated/AasRegistryService/index.js +5 -0
  40. package/dist/generated/AasRegistryService/models/index.d.ts +1070 -0
  41. package/dist/generated/AasRegistryService/models/index.js +151 -0
  42. package/dist/generated/AasRegistryService/runtime.d.ts +181 -0
  43. package/dist/generated/AasRegistryService/runtime.js +326 -0
  44. package/dist/generated/AasRepositoryService/apis/AssetAdministrationShellRepositoryAPIApi.d.ts +870 -0
  45. package/dist/generated/AasRepositoryService/apis/AssetAdministrationShellRepositoryAPIApi.js +1842 -0
  46. package/dist/generated/AasRepositoryService/apis/DescriptionAPIApi.d.ts +26 -0
  47. package/dist/generated/AasRepositoryService/apis/DescriptionAPIApi.js +40 -0
  48. package/dist/generated/AasRepositoryService/apis/SerializationAPIApi.d.ts +30 -0
  49. package/dist/generated/AasRepositoryService/apis/SerializationAPIApi.js +49 -0
  50. package/dist/generated/AasRepositoryService/apis/index.d.ts +3 -0
  51. package/dist/generated/AasRepositoryService/apis/index.js +5 -0
  52. package/dist/generated/AasRepositoryService/index.d.ts +3 -0
  53. package/dist/generated/AasRepositoryService/index.js +5 -0
  54. package/dist/generated/AasRepositoryService/models/index.d.ts +4585 -0
  55. package/dist/generated/AasRepositoryService/models/index.js +221 -0
  56. package/dist/generated/AasRepositoryService/runtime.d.ts +181 -0
  57. package/dist/generated/AasRepositoryService/runtime.js +326 -0
  58. package/dist/generated/AasxFileService/apis/AASXFileServerAPIApi.d.ts +78 -0
  59. package/dist/generated/AasxFileService/apis/AASXFileServerAPIApi.js +184 -0
  60. package/dist/generated/AasxFileService/apis/index.d.ts +1 -0
  61. package/dist/generated/AasxFileService/apis/index.js +3 -0
  62. package/dist/generated/AasxFileService/index.d.ts +3 -0
  63. package/dist/generated/AasxFileService/index.js +5 -0
  64. package/dist/generated/AasxFileService/models/index.d.ts +80 -0
  65. package/dist/generated/AasxFileService/models/index.js +10 -0
  66. package/dist/generated/AasxFileService/runtime.d.ts +181 -0
  67. package/dist/generated/AasxFileService/runtime.js +326 -0
  68. package/dist/generated/ConceptDescriptionRepositoryService/apis/ConceptDescriptionRepositoryAPIApi.d.ts +78 -0
  69. package/dist/generated/ConceptDescriptionRepositoryService/apis/ConceptDescriptionRepositoryAPIApi.js +164 -0
  70. package/dist/generated/ConceptDescriptionRepositoryService/apis/DescriptionAPIApi.d.ts +26 -0
  71. package/dist/generated/ConceptDescriptionRepositoryService/apis/DescriptionAPIApi.js +40 -0
  72. package/dist/generated/ConceptDescriptionRepositoryService/apis/SerializationAPIApi.d.ts +30 -0
  73. package/dist/generated/ConceptDescriptionRepositoryService/apis/SerializationAPIApi.js +49 -0
  74. package/dist/generated/ConceptDescriptionRepositoryService/apis/index.d.ts +3 -0
  75. package/dist/generated/ConceptDescriptionRepositoryService/apis/index.js +5 -0
  76. package/dist/generated/ConceptDescriptionRepositoryService/index.d.ts +3 -0
  77. package/dist/generated/ConceptDescriptionRepositoryService/index.js +5 -0
  78. package/dist/generated/ConceptDescriptionRepositoryService/models/index.d.ts +2869 -0
  79. package/dist/generated/ConceptDescriptionRepositoryService/models/index.js +209 -0
  80. package/dist/generated/ConceptDescriptionRepositoryService/runtime.d.ts +181 -0
  81. package/dist/generated/ConceptDescriptionRepositoryService/runtime.js +326 -0
  82. package/dist/generated/SubmodelRegistryService/apis/DescriptionAPIApi.d.ts +26 -0
  83. package/dist/generated/SubmodelRegistryService/apis/DescriptionAPIApi.js +40 -0
  84. package/dist/generated/SubmodelRegistryService/apis/SubmodelRegistryAPIApi.d.ts +75 -0
  85. package/dist/generated/SubmodelRegistryService/apis/SubmodelRegistryAPIApi.js +155 -0
  86. package/dist/generated/SubmodelRegistryService/apis/index.d.ts +2 -0
  87. package/dist/generated/SubmodelRegistryService/apis/index.js +4 -0
  88. package/dist/generated/SubmodelRegistryService/index.d.ts +3 -0
  89. package/dist/generated/SubmodelRegistryService/index.js +5 -0
  90. package/dist/generated/SubmodelRegistryService/models/index.d.ts +924 -0
  91. package/dist/generated/SubmodelRegistryService/models/index.js +141 -0
  92. package/dist/generated/SubmodelRegistryService/runtime.d.ts +181 -0
  93. package/dist/generated/SubmodelRegistryService/runtime.js +326 -0
  94. package/dist/generated/SubmodelRepositoryService/apis/DescriptionAPIApi.d.ts +26 -0
  95. package/dist/generated/SubmodelRepositoryService/apis/DescriptionAPIApi.js +40 -0
  96. package/dist/generated/SubmodelRepositoryService/apis/SerializationAPIApi.d.ts +30 -0
  97. package/dist/generated/SubmodelRepositoryService/apis/SerializationAPIApi.js +49 -0
  98. package/dist/generated/SubmodelRepositoryService/apis/SubmodelRepositoryAPIApi.d.ts +802 -0
  99. package/dist/generated/SubmodelRepositoryService/apis/SubmodelRepositoryAPIApi.js +1572 -0
  100. package/dist/generated/SubmodelRepositoryService/apis/index.d.ts +3 -0
  101. package/dist/generated/SubmodelRepositoryService/apis/index.js +5 -0
  102. package/dist/generated/SubmodelRepositoryService/index.d.ts +3 -0
  103. package/dist/generated/SubmodelRepositoryService/index.js +5 -0
  104. package/dist/generated/SubmodelRepositoryService/models/index.d.ts +4623 -0
  105. package/dist/generated/SubmodelRepositoryService/models/index.js +221 -0
  106. package/dist/generated/SubmodelRepositoryService/runtime.d.ts +181 -0
  107. package/dist/generated/SubmodelRepositoryService/runtime.js +326 -0
  108. package/dist/generated/index.d.ts +8 -2
  109. package/dist/generated/index.js +8 -3
  110. package/dist/index.d.ts +1 -1
  111. package/dist/index.js +1 -1
  112. package/dist/lib/apiConfig.d.ts +2 -0
  113. package/dist/lib/apiConfig.js +41 -0
  114. package/dist/lib/base64Url.js +4 -0
  115. package/dist/lib/convertAasDescriptorTypes.d.ts +34 -0
  116. package/dist/lib/convertAasDescriptorTypes.js +76 -0
  117. package/dist/lib/convertAasDiscoveryTypes.d.ts +18 -0
  118. package/dist/lib/convertAasDiscoveryTypes.js +39 -0
  119. package/dist/lib/convertAasTypes.d.ts +7 -7
  120. package/dist/lib/convertAasTypes.js +5 -0
  121. package/dist/lib/convertConceptDescriptionTypes.d.ts +18 -0
  122. package/dist/lib/convertConceptDescriptionTypes.js +39 -0
  123. package/dist/lib/convertSubmodelTypes.d.ts +34 -0
  124. package/dist/lib/convertSubmodelTypes.js +69 -0
  125. package/dist/lib/descriptorJsonization.d.ts +12 -0
  126. package/dist/lib/descriptorJsonization.js +172 -0
  127. package/dist/lib/errorHandler.d.ts +9 -0
  128. package/dist/lib/errorHandler.js +113 -0
  129. package/dist/models/Descriptors.d.ts +51 -0
  130. package/dist/models/Descriptors.js +56 -0
  131. package/dist/models/index.d.ts +0 -1
  132. package/dist/models/index.js +0 -1
  133. package/dist/utils/DescriptorUtils.d.ts +9 -0
  134. package/dist/utils/DescriptorUtils.js +37 -0
  135. package/dist/utils/KeyTypesUtil.d.ts +24 -0
  136. package/dist/utils/KeyTypesUtil.js +55 -0
  137. package/dist/utils/MultiLanguagePropertyUtils.d.ts +24 -0
  138. package/dist/utils/MultiLanguagePropertyUtils.js +46 -0
  139. package/dist/utils/ReferableUtils.d.ts +69 -0
  140. package/dist/utils/ReferableUtils.js +220 -0
  141. package/dist/utils/ReferenceUtil.d.ts +9 -0
  142. package/dist/utils/ReferenceUtil.js +22 -0
  143. package/dist/utils/SemanticIdUtils.d.ts +119 -0
  144. package/dist/utils/SemanticIdUtils.js +363 -0
  145. package/package.json +14 -11
  146. package/dist/generated/schemas.gen.d.ts +0 -2357
  147. package/dist/generated/schemas.gen.js +0 -2789
  148. package/dist/generated/sdk.gen.d.ts +0 -822
  149. package/dist/generated/sdk.gen.js +0 -2225
  150. package/dist/generated/types.gen.d.ts +0 -10829
  151. package/dist/generated/types.gen.js +0 -2
  152. package/dist/lib/createAasRepoClient.d.ts +0 -9
  153. package/dist/lib/createAasRepoClient.js +0 -15
  154. package/dist/models/aas-repository.d.ts +0 -65
  155. package/dist/models/aas-repository.js +0 -1
@@ -0,0 +1,67 @@
1
+ import type { SpecificAssetId } from '@aas-core-works/aas-core3.0-typescript/types';
2
+ import type { ApiResult } from '../models/api';
3
+ import type { AssetId } from '../models/AssetId';
4
+ import { AasDiscoveryService } from '../generated';
5
+ export declare class AasDiscoveryClient {
6
+ /**
7
+ * Returns a list of Asset Administration Shell IDs linked to specific asset identifiers or the global asset ID
8
+ *
9
+ * @param options Object containing:
10
+ * - configuration: The http request options
11
+ * - assetIds?: A list of specific Asset identifiers
12
+ * - limit?: The maximum number of elements in the response array
13
+ * - cursor?: A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
14
+ *
15
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
16
+ */
17
+ getAllAssetAdministrationShellIdsByAssetLink(options: {
18
+ configuration: AasDiscoveryService.Configuration;
19
+ assetIds?: AssetId[];
20
+ limit?: number;
21
+ cursor?: string;
22
+ }): Promise<ApiResult<{
23
+ pagedResult: AasDiscoveryService.PagedResultPagingMetadata | undefined;
24
+ result: string[];
25
+ }, AasDiscoveryService.Result>>;
26
+ /**
27
+ * Creates specific asset identifiers linked to an Asset Administration Shell to edit discoverable content
28
+ *
29
+ * @param options Object containing:
30
+ * - configuration: The http request options.
31
+ * - aasIdentifier: The Asset Administration Shell’s unique id
32
+ * - specificAssetId: A set of specific asset identifiers
33
+ *
34
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
35
+ */
36
+ postAllAssetLinksById(options: {
37
+ configuration: AasDiscoveryService.Configuration;
38
+ aasIdentifier: string;
39
+ specificAssetId: Array<SpecificAssetId>;
40
+ }): Promise<ApiResult<Array<SpecificAssetId>, AasDiscoveryService.Result>>;
41
+ /**
42
+ * Deletes specified specific asset identifiers linked to an Asset Administration Shell
43
+ *
44
+ * @param options Object containing:
45
+ * - configuration: The http request options
46
+ * - aasIdentifier: The Asset Administration Shell’s unique id
47
+ *
48
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
49
+ */
50
+ deleteAllAssetLinksById(options: {
51
+ configuration: AasDiscoveryService.Configuration;
52
+ aasIdentifier: string;
53
+ }): Promise<ApiResult<void, AasDiscoveryService.Result>>;
54
+ /**
55
+ * Returns a list of specific asset identifiers based on an Asset Administration Shell ID to edit discoverable content.
56
+ *
57
+ * @param options Object containing:
58
+ * - configuration: The http request options
59
+ * - aasIdentifier: The Asset Administration Shell’s unique id
60
+ *
61
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
62
+ */
63
+ getAllAssetLinksById(options: {
64
+ configuration: AasDiscoveryService.Configuration;
65
+ aasIdentifier: string;
66
+ }): Promise<ApiResult<Array<SpecificAssetId>, AasDiscoveryService.Result>>;
67
+ }
@@ -0,0 +1,115 @@
1
+ import { AasDiscoveryService } from '../generated';
2
+ import { applyDefaults } from '../lib/apiConfig';
3
+ import { base64Encode } from '../lib/base64Url';
4
+ import { convertApiAssetIdToCoreAssetId, convertCoreAssetIdToApiAssetId } from '../lib/convertAasDiscoveryTypes';
5
+ import { handleApiError } from '../lib/errorHandler';
6
+ export class AasDiscoveryClient {
7
+ /**
8
+ * Returns a list of Asset Administration Shell IDs linked to specific asset identifiers or the global asset ID
9
+ *
10
+ * @param options Object containing:
11
+ * - configuration: The http request options
12
+ * - assetIds?: A list of specific Asset identifiers
13
+ * - limit?: The maximum number of elements in the response array
14
+ * - cursor?: A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
15
+ *
16
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
17
+ */
18
+ async getAllAssetAdministrationShellIdsByAssetLink(options) {
19
+ const { configuration, assetIds, limit, cursor } = options;
20
+ try {
21
+ const apiInstance = new AasDiscoveryService.AssetAdministrationShellBasicDiscoveryAPIApi(applyDefaults(configuration));
22
+ const encodedAssetIds = assetIds?.map((id) => base64Encode(JSON.stringify(id)));
23
+ const result = await apiInstance.getAllAssetAdministrationShellIdsByAssetLink({
24
+ assetIds: encodedAssetIds,
25
+ limit: limit,
26
+ cursor: cursor,
27
+ });
28
+ const shellIds = result.result ?? [];
29
+ console.log('all shellIds:', shellIds);
30
+ return {
31
+ success: true,
32
+ data: { pagedResult: result.pagingMetadata, result: shellIds },
33
+ };
34
+ }
35
+ catch (err) {
36
+ const customError = await handleApiError(err);
37
+ return { success: false, error: customError };
38
+ }
39
+ }
40
+ /**
41
+ * Creates specific asset identifiers linked to an Asset Administration Shell to edit discoverable content
42
+ *
43
+ * @param options Object containing:
44
+ * - configuration: The http request options.
45
+ * - aasIdentifier: The Asset Administration Shell’s unique id
46
+ * - specificAssetId: A set of specific asset identifiers
47
+ *
48
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
49
+ */
50
+ async postAllAssetLinksById(options) {
51
+ const { configuration, aasIdentifier, specificAssetId } = options;
52
+ try {
53
+ const apiInstance = new AasDiscoveryService.AssetAdministrationShellBasicDiscoveryAPIApi(applyDefaults(configuration));
54
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
55
+ const result = await apiInstance.postAllAssetLinksById({
56
+ aasIdentifier: encodedAasIdentifier,
57
+ specificAssetId: specificAssetId.map(convertCoreAssetIdToApiAssetId),
58
+ });
59
+ console.log('created asset links:', result);
60
+ return { success: true, data: result.map(convertApiAssetIdToCoreAssetId) };
61
+ }
62
+ catch (err) {
63
+ const customError = await handleApiError(err);
64
+ return { success: false, error: customError };
65
+ }
66
+ }
67
+ /**
68
+ * Deletes specified specific asset identifiers linked to an Asset Administration Shell
69
+ *
70
+ * @param options Object containing:
71
+ * - configuration: The http request options
72
+ * - aasIdentifier: The Asset Administration Shell’s unique id
73
+ *
74
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
75
+ */
76
+ async deleteAllAssetLinksById(options) {
77
+ const { configuration, aasIdentifier } = options;
78
+ try {
79
+ const apiInstance = new AasDiscoveryService.AssetAdministrationShellBasicDiscoveryAPIApi(applyDefaults(configuration));
80
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
81
+ const result = await apiInstance.deleteAllAssetLinksById({
82
+ aasIdentifier: encodedAasIdentifier,
83
+ });
84
+ return { success: true, data: result };
85
+ }
86
+ catch (err) {
87
+ const customError = await handleApiError(err);
88
+ return { success: false, error: customError };
89
+ }
90
+ }
91
+ /**
92
+ * Returns a list of specific asset identifiers based on an Asset Administration Shell ID to edit discoverable content.
93
+ *
94
+ * @param options Object containing:
95
+ * - configuration: The http request options
96
+ * - aasIdentifier: The Asset Administration Shell’s unique id
97
+ *
98
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
99
+ */
100
+ async getAllAssetLinksById(options) {
101
+ const { configuration, aasIdentifier } = options;
102
+ try {
103
+ const apiInstance = new AasDiscoveryService.AssetAdministrationShellBasicDiscoveryAPIApi(applyDefaults(configuration));
104
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
105
+ const result = await apiInstance.getAllAssetLinksById({
106
+ aasIdentifier: encodedAasIdentifier,
107
+ });
108
+ return { success: true, data: result.map(convertApiAssetIdToCoreAssetId) };
109
+ }
110
+ catch (err) {
111
+ const customError = await handleApiError(err);
112
+ return { success: false, error: customError };
113
+ }
114
+ }
115
+ }
@@ -0,0 +1,163 @@
1
+ import type { ApiResult } from '../models/api';
2
+ import { AasRegistryService } from '../generated';
3
+ import { AssetAdministrationShellDescriptor, SubmodelDescriptor } from '../models/Descriptors';
4
+ export declare class AasRegistryClient {
5
+ /**
6
+ * Returns all Asset Administration Shell Descriptors
7
+ *
8
+ * @param options Object containing:
9
+ * - configuration: The http request options
10
+ * - limit?: The maximum number of elements in the response array
11
+ * - cursor?: A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
12
+ * - assetKind?: The Asset's kind (Instance or Type)
13
+ * - assetType?: The Asset's type (UTF8-BASE64-URL-encoded)
14
+ *
15
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
16
+ */
17
+ getAllAssetAdministrationShellDescriptors(options: {
18
+ configuration: AasRegistryService.Configuration;
19
+ limit?: number;
20
+ cursor?: string;
21
+ assetKind?: AasRegistryService.AssetKind;
22
+ assetType?: string;
23
+ }): Promise<ApiResult<{
24
+ pagedResult: AasRegistryService.PagedResultPagingMetadata | undefined;
25
+ result: AssetAdministrationShellDescriptor[];
26
+ }, AasRegistryService.Result>>;
27
+ /**
28
+ * Creates a new Asset Administration Shell Descriptor, i.e. registers an AAS
29
+ *
30
+ * @param options Object containing:
31
+ * - configuration: The http request options.
32
+ * - assetAdministrationShellDescriptor: Asset Administration Shell Descriptor object
33
+ *
34
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
35
+ */
36
+ postAssetAdministrationShellDescriptor(options: {
37
+ configuration: AasRegistryService.Configuration;
38
+ assetAdministrationShellDescriptor: AssetAdministrationShellDescriptor;
39
+ }): Promise<ApiResult<AssetAdministrationShellDescriptor, AasRegistryService.Result>>;
40
+ /**
41
+ * Deletes an Asset Administration Shell Descriptor, i.e. de-registers an AAS
42
+ *
43
+ * @param options Object containing:
44
+ * - configuration: The http request options
45
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
46
+ *
47
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
48
+ */
49
+ deleteAssetAdministrationShellDescriptorById(options: {
50
+ configuration: AasRegistryService.Configuration;
51
+ aasIdentifier: string;
52
+ }): Promise<ApiResult<void, AasRegistryService.Result>>;
53
+ /**
54
+ * Returns a specific Asset Administration Shell Descriptor
55
+ *
56
+ * @param options Object containing:
57
+ * - configuration: The http request options
58
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
59
+ *
60
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
61
+ */
62
+ getAssetAdministrationShellDescriptorById(options: {
63
+ configuration: AasRegistryService.Configuration;
64
+ aasIdentifier: string;
65
+ }): Promise<ApiResult<AssetAdministrationShellDescriptor, AasRegistryService.Result>>;
66
+ /**
67
+ * Creates or updates an existing Asset Administration Shell Descriptor
68
+ *
69
+ * @param options Object containing:
70
+ * - configuration: The http request options
71
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
72
+ * - assetAdministrationShellDescriptor: Asset Administration Shell Descriptor object
73
+ *
74
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
75
+ */
76
+ putAssetAdministrationShellDescriptorById(options: {
77
+ configuration: AasRegistryService.Configuration;
78
+ aasIdentifier: string;
79
+ assetAdministrationShellDescriptor: AssetAdministrationShellDescriptor;
80
+ }): Promise<ApiResult<AssetAdministrationShellDescriptor | void, AasRegistryService.Result>>;
81
+ /**
82
+ * Returns all Submodel Descriptors
83
+ *
84
+ * @param options Object containing:
85
+ * - configuration: The http request options
86
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
87
+ * - limit?: The maximum number of elements in the response array
88
+ * - cursor?: A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
89
+ *
90
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
91
+ */
92
+ getAllSubmodelDescriptorsThroughSuperpath(options: {
93
+ configuration: AasRegistryService.Configuration;
94
+ aasIdentifier: string;
95
+ limit?: number;
96
+ cursor?: string;
97
+ }): Promise<ApiResult<{
98
+ pagedResult: AasRegistryService.PagedResultPagingMetadata | undefined;
99
+ result: SubmodelDescriptor[];
100
+ }, AasRegistryService.Result>>;
101
+ /**
102
+ * Creates a new Submodel Descriptor, i.e. registers a submodel
103
+ *
104
+ * @param options Object containing:
105
+ * - configuration: The http request options.
106
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
107
+ * - submodelDescriptor: Submodel Descriptor object
108
+ *
109
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
110
+ */
111
+ postSubmodelDescriptorThroughSuperpath(options: {
112
+ configuration: AasRegistryService.Configuration;
113
+ aasIdentifier: string;
114
+ submodelDescriptor: SubmodelDescriptor;
115
+ }): Promise<ApiResult<SubmodelDescriptor, AasRegistryService.Result>>;
116
+ /**
117
+ * Returns a specific Submodel Descriptor
118
+ *
119
+ * @param options Object containing:
120
+ * - configuration: The http request options
121
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
122
+ * - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
123
+ *
124
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
125
+ */
126
+ getSubmodelDescriptorByIdThroughSuperpath(options: {
127
+ configuration: AasRegistryService.Configuration;
128
+ aasIdentifier: string;
129
+ submodelIdentifier: string;
130
+ }): Promise<ApiResult<SubmodelDescriptor, AasRegistryService.Result>>;
131
+ /**
132
+ * Deletes a Submodel Descriptor, i.e. de-registers a submodel
133
+ *
134
+ * @param options Object containing:
135
+ * - configuration: The http request options
136
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
137
+ * - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
138
+ *
139
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
140
+ */
141
+ deleteSubmodelDescriptorByIdThroughSuperpath(options: {
142
+ configuration: AasRegistryService.Configuration;
143
+ aasIdentifier: string;
144
+ submodelIdentifier: string;
145
+ }): Promise<ApiResult<void, AasRegistryService.Result>>;
146
+ /**
147
+ * Creates or updates an existing Submodel Descriptor
148
+ *
149
+ * @param options Object containing:
150
+ * - configuration: The http request options
151
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
152
+ * - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
153
+ * - submodelDescriptor: Submodel Descriptor object
154
+ *
155
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
156
+ */
157
+ putSubmodelDescriptorByIdThroughSuperpath(options: {
158
+ configuration: AasRegistryService.Configuration;
159
+ aasIdentifier: string;
160
+ submodelIdentifier: string;
161
+ submodelDescriptor: SubmodelDescriptor;
162
+ }): Promise<ApiResult<SubmodelDescriptor | void, AasRegistryService.Result>>;
163
+ }
@@ -0,0 +1,287 @@
1
+ import { AasRegistryService } from '../generated';
2
+ import { applyDefaults } from '../lib/apiConfig';
3
+ import { base64Encode } from '../lib/base64Url';
4
+ import { convertApiAasDescriptorToCoreAasDescriptor, convertApiSubmodelDescriptorToCoreSubmodelDescriptor, convertCoreAasDescriptorToApiAasDescriptor, convertCoreSubmodelDescriptorToApiSubmodelDescriptor, } from '../lib/convertAasDescriptorTypes';
5
+ import { handleApiError } from '../lib/errorHandler';
6
+ export class AasRegistryClient {
7
+ /**
8
+ * Returns all Asset Administration Shell Descriptors
9
+ *
10
+ * @param options Object containing:
11
+ * - configuration: The http request options
12
+ * - limit?: The maximum number of elements in the response array
13
+ * - cursor?: A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
14
+ * - assetKind?: The Asset's kind (Instance or Type)
15
+ * - assetType?: The Asset's type (UTF8-BASE64-URL-encoded)
16
+ *
17
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
18
+ */
19
+ async getAllAssetAdministrationShellDescriptors(options) {
20
+ const { configuration, limit, cursor, assetKind, assetType } = options;
21
+ try {
22
+ const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
23
+ const encodedAssetType = assetType ? base64Encode(assetType) : undefined;
24
+ const result = await apiInstance.getAllAssetAdministrationShellDescriptors({
25
+ limit: limit,
26
+ cursor: cursor,
27
+ assetKind: assetKind,
28
+ assetType: encodedAssetType,
29
+ });
30
+ const aasDescriptors = (result.result ?? []).map(convertApiAasDescriptorToCoreAasDescriptor);
31
+ console.log('all aas descriptors:', aasDescriptors);
32
+ return {
33
+ success: true,
34
+ data: { pagedResult: result.pagingMetadata, result: aasDescriptors },
35
+ };
36
+ }
37
+ catch (err) {
38
+ const customError = await handleApiError(err);
39
+ return { success: false, error: customError };
40
+ }
41
+ }
42
+ /**
43
+ * Creates a new Asset Administration Shell Descriptor, i.e. registers an AAS
44
+ *
45
+ * @param options Object containing:
46
+ * - configuration: The http request options.
47
+ * - assetAdministrationShellDescriptor: Asset Administration Shell Descriptor object
48
+ *
49
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
50
+ */
51
+ async postAssetAdministrationShellDescriptor(options) {
52
+ const { configuration, assetAdministrationShellDescriptor } = options;
53
+ try {
54
+ const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
55
+ const result = await apiInstance.postAssetAdministrationShellDescriptor({
56
+ assetAdministrationShellDescriptor: convertCoreAasDescriptorToApiAasDescriptor(assetAdministrationShellDescriptor),
57
+ });
58
+ console.log('created aas descriptor:', result);
59
+ return { success: true, data: convertApiAasDescriptorToCoreAasDescriptor(result) };
60
+ }
61
+ catch (err) {
62
+ const customError = await handleApiError(err);
63
+ return { success: false, error: customError };
64
+ }
65
+ }
66
+ /**
67
+ * Deletes an Asset Administration Shell Descriptor, i.e. de-registers an AAS
68
+ *
69
+ * @param options Object containing:
70
+ * - configuration: The http request options
71
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
72
+ *
73
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
74
+ */
75
+ async deleteAssetAdministrationShellDescriptorById(options) {
76
+ const { configuration, aasIdentifier } = options;
77
+ try {
78
+ const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
79
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
80
+ const result = await apiInstance.deleteAssetAdministrationShellDescriptorById({
81
+ aasIdentifier: encodedAasIdentifier,
82
+ });
83
+ return { success: true, data: result };
84
+ }
85
+ catch (err) {
86
+ const customError = await handleApiError(err);
87
+ return { success: false, error: customError };
88
+ }
89
+ }
90
+ /**
91
+ * Returns a specific Asset Administration Shell Descriptor
92
+ *
93
+ * @param options Object containing:
94
+ * - configuration: The http request options
95
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
96
+ *
97
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
98
+ */
99
+ async getAssetAdministrationShellDescriptorById(options) {
100
+ const { configuration, aasIdentifier } = options;
101
+ try {
102
+ const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
103
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
104
+ const result = await apiInstance.getAssetAdministrationShellDescriptorById({
105
+ aasIdentifier: encodedAasIdentifier,
106
+ });
107
+ return { success: true, data: convertApiAasDescriptorToCoreAasDescriptor(result) };
108
+ }
109
+ catch (err) {
110
+ const customError = await handleApiError(err);
111
+ return { success: false, error: customError };
112
+ }
113
+ }
114
+ /**
115
+ * Creates or updates an existing Asset Administration Shell Descriptor
116
+ *
117
+ * @param options Object containing:
118
+ * - configuration: The http request options
119
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
120
+ * - assetAdministrationShellDescriptor: Asset Administration Shell Descriptor object
121
+ *
122
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
123
+ */
124
+ async putAssetAdministrationShellDescriptorById(options) {
125
+ const { configuration, aasIdentifier, assetAdministrationShellDescriptor } = options;
126
+ try {
127
+ const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
128
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
129
+ const result = await apiInstance.putAssetAdministrationShellDescriptorById({
130
+ aasIdentifier: encodedAasIdentifier,
131
+ assetAdministrationShellDescriptor: convertCoreAasDescriptorToApiAasDescriptor(assetAdministrationShellDescriptor),
132
+ });
133
+ return { success: true, data: result ? convertApiAasDescriptorToCoreAasDescriptor(result) : undefined };
134
+ }
135
+ catch (err) {
136
+ const customError = await handleApiError(err);
137
+ return { success: false, error: customError };
138
+ }
139
+ }
140
+ /**
141
+ * Returns all Submodel Descriptors
142
+ *
143
+ * @param options Object containing:
144
+ * - configuration: The http request options
145
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
146
+ * - limit?: The maximum number of elements in the response array
147
+ * - cursor?: A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
148
+ *
149
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
150
+ */
151
+ async getAllSubmodelDescriptorsThroughSuperpath(options) {
152
+ const { configuration, aasIdentifier, limit, cursor } = options;
153
+ try {
154
+ const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
155
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
156
+ const result = await apiInstance.getAllSubmodelDescriptorsThroughSuperpath({
157
+ aasIdentifier: encodedAasIdentifier,
158
+ limit: limit,
159
+ cursor: cursor,
160
+ });
161
+ const submodelDescriptors = (result.result ?? []).map(convertApiSubmodelDescriptorToCoreSubmodelDescriptor);
162
+ console.log('all submodel descriptors:', submodelDescriptors);
163
+ return {
164
+ success: true,
165
+ data: { pagedResult: result.pagingMetadata, result: submodelDescriptors },
166
+ };
167
+ }
168
+ catch (err) {
169
+ const customError = await handleApiError(err);
170
+ return { success: false, error: customError };
171
+ }
172
+ }
173
+ /**
174
+ * Creates a new Submodel Descriptor, i.e. registers a submodel
175
+ *
176
+ * @param options Object containing:
177
+ * - configuration: The http request options.
178
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
179
+ * - submodelDescriptor: Submodel Descriptor object
180
+ *
181
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
182
+ */
183
+ async postSubmodelDescriptorThroughSuperpath(options) {
184
+ const { configuration, aasIdentifier, submodelDescriptor } = options;
185
+ try {
186
+ const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
187
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
188
+ const result = await apiInstance.postSubmodelDescriptorThroughSuperpath({
189
+ aasIdentifier: encodedAasIdentifier,
190
+ submodelDescriptor: convertCoreSubmodelDescriptorToApiSubmodelDescriptor(submodelDescriptor),
191
+ });
192
+ console.log('created submodel descriptor:', result);
193
+ return { success: true, data: convertApiSubmodelDescriptorToCoreSubmodelDescriptor(result) };
194
+ }
195
+ catch (err) {
196
+ const customError = await handleApiError(err);
197
+ //console.log('error during creation of submodel descriptor:', customError);
198
+ return { success: false, error: customError };
199
+ }
200
+ }
201
+ /**
202
+ * Returns a specific Submodel Descriptor
203
+ *
204
+ * @param options Object containing:
205
+ * - configuration: The http request options
206
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
207
+ * - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
208
+ *
209
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
210
+ */
211
+ async getSubmodelDescriptorByIdThroughSuperpath(options) {
212
+ const { configuration, aasIdentifier, submodelIdentifier } = options;
213
+ try {
214
+ const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
215
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
216
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
217
+ const result = await apiInstance.getSubmodelDescriptorByIdThroughSuperpath({
218
+ aasIdentifier: encodedAasIdentifier,
219
+ submodelIdentifier: encodedSubmodelIdentifier,
220
+ });
221
+ return { success: true, data: convertApiSubmodelDescriptorToCoreSubmodelDescriptor(result) };
222
+ }
223
+ catch (err) {
224
+ const customError = await handleApiError(err);
225
+ return { success: false, error: customError };
226
+ }
227
+ }
228
+ /**
229
+ * Deletes a Submodel Descriptor, i.e. de-registers a submodel
230
+ *
231
+ * @param options Object containing:
232
+ * - configuration: The http request options
233
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
234
+ * - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
235
+ *
236
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
237
+ */
238
+ async deleteSubmodelDescriptorByIdThroughSuperpath(options) {
239
+ const { configuration, aasIdentifier, submodelIdentifier } = options;
240
+ try {
241
+ const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
242
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
243
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
244
+ const result = await apiInstance.deleteSubmodelDescriptorByIdThroughSuperpath({
245
+ aasIdentifier: encodedAasIdentifier,
246
+ submodelIdentifier: encodedSubmodelIdentifier,
247
+ });
248
+ return { success: true, data: result };
249
+ }
250
+ catch (err) {
251
+ const customError = await handleApiError(err);
252
+ return { success: false, error: customError };
253
+ }
254
+ }
255
+ /**
256
+ * Creates or updates an existing Submodel Descriptor
257
+ *
258
+ * @param options Object containing:
259
+ * - configuration: The http request options
260
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
261
+ * - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
262
+ * - submodelDescriptor: Submodel Descriptor object
263
+ *
264
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
265
+ */
266
+ async putSubmodelDescriptorByIdThroughSuperpath(options) {
267
+ const { configuration, aasIdentifier, submodelIdentifier, submodelDescriptor } = options;
268
+ try {
269
+ const apiInstance = new AasRegistryService.AssetAdministrationShellRegistryAPIApi(applyDefaults(configuration));
270
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
271
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
272
+ const result = await apiInstance.putSubmodelDescriptorByIdThroughSuperpath({
273
+ aasIdentifier: encodedAasIdentifier,
274
+ submodelIdentifier: encodedSubmodelIdentifier,
275
+ submodelDescriptor: convertCoreSubmodelDescriptorToApiSubmodelDescriptor(submodelDescriptor),
276
+ });
277
+ return {
278
+ success: true,
279
+ data: result ? convertApiSubmodelDescriptorToCoreSubmodelDescriptor(result) : undefined,
280
+ };
281
+ }
282
+ catch (err) {
283
+ const customError = await handleApiError(err);
284
+ return { success: false, error: customError };
285
+ }
286
+ }
287
+ }