basyx-typescript-sdk 0.2.2 → 1.0.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 (143) hide show
  1. package/README.md +19 -12
  2. package/bundle/index.js +15444 -866
  3. package/bundle/index.js.map +1 -1
  4. package/dist/clients/AasDiscoveryClient.d.ts +68 -0
  5. package/dist/clients/AasDiscoveryClient.js +115 -0
  6. package/dist/clients/AasRegistryClient.d.ts +164 -0
  7. package/dist/clients/AasRegistryClient.js +287 -0
  8. package/dist/clients/AasRepositoryClient.d.ts +791 -103
  9. package/dist/clients/AasRepositoryClient.js +1323 -215
  10. package/dist/clients/AasxFileClient.d.ts +82 -0
  11. package/dist/clients/AasxFileClient.js +148 -0
  12. package/dist/clients/ConceptDescriptionRepositoryClient.d.ts +84 -0
  13. package/dist/clients/ConceptDescriptionRepositoryClient.js +143 -0
  14. package/dist/clients/SubmodelRegistryClient.d.ts +78 -0
  15. package/dist/clients/SubmodelRegistryClient.js +138 -0
  16. package/dist/clients/SubmodelRepositoryClient.d.ts +355 -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 +2 -0
  27. package/dist/generated/AasDiscoveryService/index.js +4 -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/AasRegistryService/apis/AssetAdministrationShellRegistryAPIApi.d.ts +139 -0
  31. package/dist/generated/AasRegistryService/apis/AssetAdministrationShellRegistryAPIApi.js +312 -0
  32. package/dist/generated/AasRegistryService/apis/DescriptionAPIApi.d.ts +26 -0
  33. package/dist/generated/AasRegistryService/apis/DescriptionAPIApi.js +40 -0
  34. package/dist/generated/AasRegistryService/apis/index.d.ts +2 -0
  35. package/dist/generated/AasRegistryService/apis/index.js +4 -0
  36. package/dist/generated/AasRegistryService/index.d.ts +2 -0
  37. package/dist/generated/AasRegistryService/index.js +4 -0
  38. package/dist/generated/AasRegistryService/models/index.d.ts +1070 -0
  39. package/dist/generated/AasRegistryService/models/index.js +151 -0
  40. package/dist/generated/AasRepositoryService/apis/AssetAdministrationShellRepositoryAPIApi.d.ts +870 -0
  41. package/dist/generated/AasRepositoryService/apis/AssetAdministrationShellRepositoryAPIApi.js +1842 -0
  42. package/dist/generated/AasRepositoryService/apis/DescriptionAPIApi.d.ts +26 -0
  43. package/dist/generated/AasRepositoryService/apis/DescriptionAPIApi.js +40 -0
  44. package/dist/generated/AasRepositoryService/apis/SerializationAPIApi.d.ts +30 -0
  45. package/dist/generated/AasRepositoryService/apis/SerializationAPIApi.js +49 -0
  46. package/dist/generated/AasRepositoryService/apis/index.d.ts +3 -0
  47. package/dist/generated/AasRepositoryService/apis/index.js +5 -0
  48. package/dist/generated/AasRepositoryService/index.d.ts +2 -0
  49. package/dist/generated/AasRepositoryService/index.js +4 -0
  50. package/dist/generated/AasRepositoryService/models/index.d.ts +4585 -0
  51. package/dist/generated/AasRepositoryService/models/index.js +221 -0
  52. package/dist/generated/AasxFileService/apis/AASXFileServerAPIApi.d.ts +78 -0
  53. package/dist/generated/AasxFileService/apis/AASXFileServerAPIApi.js +184 -0
  54. package/dist/generated/AasxFileService/apis/index.d.ts +1 -0
  55. package/dist/generated/AasxFileService/apis/index.js +3 -0
  56. package/dist/generated/AasxFileService/index.d.ts +2 -0
  57. package/dist/generated/AasxFileService/index.js +4 -0
  58. package/dist/generated/AasxFileService/models/index.d.ts +80 -0
  59. package/dist/generated/AasxFileService/models/index.js +10 -0
  60. package/dist/generated/ConceptDescriptionRepositoryService/apis/ConceptDescriptionRepositoryAPIApi.d.ts +78 -0
  61. package/dist/generated/ConceptDescriptionRepositoryService/apis/ConceptDescriptionRepositoryAPIApi.js +164 -0
  62. package/dist/generated/ConceptDescriptionRepositoryService/apis/DescriptionAPIApi.d.ts +26 -0
  63. package/dist/generated/ConceptDescriptionRepositoryService/apis/DescriptionAPIApi.js +40 -0
  64. package/dist/generated/ConceptDescriptionRepositoryService/apis/SerializationAPIApi.d.ts +30 -0
  65. package/dist/generated/ConceptDescriptionRepositoryService/apis/SerializationAPIApi.js +49 -0
  66. package/dist/generated/ConceptDescriptionRepositoryService/apis/index.d.ts +3 -0
  67. package/dist/generated/ConceptDescriptionRepositoryService/apis/index.js +5 -0
  68. package/dist/generated/ConceptDescriptionRepositoryService/index.d.ts +2 -0
  69. package/dist/generated/ConceptDescriptionRepositoryService/index.js +3 -0
  70. package/dist/generated/ConceptDescriptionRepositoryService/models/index.d.ts +2869 -0
  71. package/dist/generated/ConceptDescriptionRepositoryService/models/index.js +209 -0
  72. package/dist/generated/SubmodelRegistryService/apis/DescriptionAPIApi.d.ts +26 -0
  73. package/dist/generated/SubmodelRegistryService/apis/DescriptionAPIApi.js +40 -0
  74. package/dist/generated/SubmodelRegistryService/apis/SubmodelRegistryAPIApi.d.ts +75 -0
  75. package/dist/generated/SubmodelRegistryService/apis/SubmodelRegistryAPIApi.js +155 -0
  76. package/dist/generated/SubmodelRegistryService/apis/index.d.ts +2 -0
  77. package/dist/generated/SubmodelRegistryService/apis/index.js +4 -0
  78. package/dist/generated/SubmodelRegistryService/index.d.ts +2 -0
  79. package/dist/generated/SubmodelRegistryService/index.js +4 -0
  80. package/dist/generated/SubmodelRegistryService/models/index.d.ts +924 -0
  81. package/dist/generated/SubmodelRegistryService/models/index.js +141 -0
  82. package/dist/generated/SubmodelRepositoryService/apis/DescriptionAPIApi.d.ts +26 -0
  83. package/dist/generated/SubmodelRepositoryService/apis/DescriptionAPIApi.js +40 -0
  84. package/dist/generated/SubmodelRepositoryService/apis/SerializationAPIApi.d.ts +30 -0
  85. package/dist/generated/SubmodelRepositoryService/apis/SerializationAPIApi.js +49 -0
  86. package/dist/generated/SubmodelRepositoryService/apis/SubmodelRepositoryAPIApi.d.ts +802 -0
  87. package/dist/generated/SubmodelRepositoryService/apis/SubmodelRepositoryAPIApi.js +1572 -0
  88. package/dist/generated/SubmodelRepositoryService/apis/index.d.ts +3 -0
  89. package/dist/generated/SubmodelRepositoryService/apis/index.js +5 -0
  90. package/dist/generated/SubmodelRepositoryService/index.d.ts +2 -0
  91. package/dist/generated/SubmodelRepositoryService/index.js +4 -0
  92. package/dist/generated/SubmodelRepositoryService/models/index.d.ts +4623 -0
  93. package/dist/generated/SubmodelRepositoryService/models/index.js +221 -0
  94. package/dist/generated/index.d.ts +9 -2
  95. package/dist/generated/index.js +9 -3
  96. package/dist/generated/runtime.d.ts +181 -0
  97. package/dist/generated/runtime.js +326 -0
  98. package/dist/index.d.ts +1 -1
  99. package/dist/index.js +1 -1
  100. package/dist/lib/apiConfig.d.ts +2 -0
  101. package/dist/lib/apiConfig.js +23 -0
  102. package/dist/lib/base64Url.js +4 -0
  103. package/dist/lib/convertAasDescriptorTypes.d.ts +34 -0
  104. package/dist/lib/convertAasDescriptorTypes.js +76 -0
  105. package/dist/lib/convertAasDiscoveryTypes.d.ts +18 -0
  106. package/dist/lib/convertAasDiscoveryTypes.js +39 -0
  107. package/dist/lib/convertAasTypes.d.ts +7 -7
  108. package/dist/lib/convertAasTypes.js +5 -0
  109. package/dist/lib/convertConceptDescriptionTypes.d.ts +18 -0
  110. package/dist/lib/convertConceptDescriptionTypes.js +39 -0
  111. package/dist/lib/convertSubmodelTypes.d.ts +34 -0
  112. package/dist/lib/convertSubmodelTypes.js +69 -0
  113. package/dist/lib/descriptorJsonization.d.ts +12 -0
  114. package/dist/lib/descriptorJsonization.js +172 -0
  115. package/dist/lib/errorHandler.d.ts +9 -0
  116. package/dist/lib/errorHandler.js +94 -0
  117. package/dist/models/Descriptors.d.ts +51 -0
  118. package/dist/models/Descriptors.js +56 -0
  119. package/dist/models/index.d.ts +0 -1
  120. package/dist/models/index.js +0 -1
  121. package/dist/utils/DescriptorUtils.d.ts +9 -0
  122. package/dist/utils/DescriptorUtils.js +37 -0
  123. package/dist/utils/KeyTypesUtil.d.ts +24 -0
  124. package/dist/utils/KeyTypesUtil.js +55 -0
  125. package/dist/utils/MultiLanguagePropertyUtils.d.ts +24 -0
  126. package/dist/utils/MultiLanguagePropertyUtils.js +46 -0
  127. package/dist/utils/ReferableUtils.d.ts +69 -0
  128. package/dist/utils/ReferableUtils.js +220 -0
  129. package/dist/utils/ReferenceUtil.d.ts +9 -0
  130. package/dist/utils/ReferenceUtil.js +22 -0
  131. package/dist/utils/SemanticIdUtils.d.ts +119 -0
  132. package/dist/utils/SemanticIdUtils.js +363 -0
  133. package/package.json +14 -11
  134. package/dist/generated/schemas.gen.d.ts +0 -2357
  135. package/dist/generated/schemas.gen.js +0 -2789
  136. package/dist/generated/sdk.gen.d.ts +0 -822
  137. package/dist/generated/sdk.gen.js +0 -2225
  138. package/dist/generated/types.gen.d.ts +0 -10829
  139. package/dist/generated/types.gen.js +0 -2
  140. package/dist/lib/createAasRepoClient.d.ts +0 -9
  141. package/dist/lib/createAasRepoClient.js +0 -15
  142. package/dist/models/aas-repository.d.ts +0 -65
  143. package/dist/models/aas-repository.js +0 -1
@@ -0,0 +1,68 @@
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
+ import { Configuration } from '../generated/runtime';
6
+ export declare 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
+ getAllAssetAdministrationShellIdsByAssetLink(options: {
19
+ configuration: Configuration;
20
+ assetIds?: AssetId[];
21
+ limit?: number;
22
+ cursor?: string;
23
+ }): Promise<ApiResult<{
24
+ pagedResult: AasDiscoveryService.PagedResultPagingMetadata | undefined;
25
+ result: string[];
26
+ }, AasDiscoveryService.Result>>;
27
+ /**
28
+ * Creates specific asset identifiers linked to an Asset Administration Shell to edit discoverable content
29
+ *
30
+ * @param options Object containing:
31
+ * - configuration: The http request options.
32
+ * - aasIdentifier: The Asset Administration Shell’s unique id
33
+ * - specificAssetId: A set of specific asset identifiers
34
+ *
35
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
36
+ */
37
+ postAllAssetLinksById(options: {
38
+ configuration: Configuration;
39
+ aasIdentifier: string;
40
+ specificAssetId: Array<SpecificAssetId>;
41
+ }): Promise<ApiResult<Array<SpecificAssetId>, AasDiscoveryService.Result>>;
42
+ /**
43
+ * Deletes specified specific asset identifiers linked to an Asset Administration Shell
44
+ *
45
+ * @param options Object containing:
46
+ * - configuration: The http request options
47
+ * - aasIdentifier: The Asset Administration Shell’s unique id
48
+ *
49
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
50
+ */
51
+ deleteAllAssetLinksById(options: {
52
+ configuration: Configuration;
53
+ aasIdentifier: string;
54
+ }): Promise<ApiResult<void, AasDiscoveryService.Result>>;
55
+ /**
56
+ * Returns a list of specific asset identifiers based on an Asset Administration Shell ID to edit discoverable content.
57
+ *
58
+ * @param options Object containing:
59
+ * - configuration: The http request options
60
+ * - aasIdentifier: The Asset Administration Shell’s unique id
61
+ *
62
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
63
+ */
64
+ getAllAssetLinksById(options: {
65
+ configuration: Configuration;
66
+ aasIdentifier: string;
67
+ }): Promise<ApiResult<Array<SpecificAssetId>, AasDiscoveryService.Result>>;
68
+ }
@@ -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,164 @@
1
+ import type { ApiResult } from '../models/api';
2
+ import { AasRegistryService } from '../generated';
3
+ import { Configuration } from '../generated/runtime';
4
+ import { AssetAdministrationShellDescriptor, SubmodelDescriptor } from '../models/Descriptors';
5
+ export declare class AasRegistryClient {
6
+ /**
7
+ * Returns all Asset Administration Shell Descriptors
8
+ *
9
+ * @param options Object containing:
10
+ * - configuration: The http request options
11
+ * - limit?: The maximum number of elements in the response array
12
+ * - cursor?: A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
13
+ * - assetKind?: The Asset's kind (Instance or Type)
14
+ * - assetType?: The Asset's type (UTF8-BASE64-URL-encoded)
15
+ *
16
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
17
+ */
18
+ getAllAssetAdministrationShellDescriptors(options: {
19
+ configuration: Configuration;
20
+ limit?: number;
21
+ cursor?: string;
22
+ assetKind?: AasRegistryService.AssetKind;
23
+ assetType?: string;
24
+ }): Promise<ApiResult<{
25
+ pagedResult: AasRegistryService.PagedResultPagingMetadata | undefined;
26
+ result: AssetAdministrationShellDescriptor[];
27
+ }, AasRegistryService.Result>>;
28
+ /**
29
+ * Creates a new Asset Administration Shell Descriptor, i.e. registers an AAS
30
+ *
31
+ * @param options Object containing:
32
+ * - configuration: The http request options.
33
+ * - assetAdministrationShellDescriptor: Asset Administration Shell Descriptor object
34
+ *
35
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
36
+ */
37
+ postAssetAdministrationShellDescriptor(options: {
38
+ configuration: Configuration;
39
+ assetAdministrationShellDescriptor: AssetAdministrationShellDescriptor;
40
+ }): Promise<ApiResult<AssetAdministrationShellDescriptor, AasRegistryService.Result>>;
41
+ /**
42
+ * Deletes an Asset Administration Shell Descriptor, i.e. de-registers an AAS
43
+ *
44
+ * @param options Object containing:
45
+ * - configuration: The http request options
46
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
47
+ *
48
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
49
+ */
50
+ deleteAssetAdministrationShellDescriptorById(options: {
51
+ configuration: Configuration;
52
+ aasIdentifier: string;
53
+ }): Promise<ApiResult<void, AasRegistryService.Result>>;
54
+ /**
55
+ * Returns a specific Asset Administration Shell Descriptor
56
+ *
57
+ * @param options Object containing:
58
+ * - configuration: The http request options
59
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
60
+ *
61
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
62
+ */
63
+ getAssetAdministrationShellDescriptorById(options: {
64
+ configuration: Configuration;
65
+ aasIdentifier: string;
66
+ }): Promise<ApiResult<AssetAdministrationShellDescriptor, AasRegistryService.Result>>;
67
+ /**
68
+ * Creates or updates an existing Asset Administration Shell Descriptor
69
+ *
70
+ * @param options Object containing:
71
+ * - configuration: The http request options
72
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
73
+ * - assetAdministrationShellDescriptor: Asset Administration Shell Descriptor object
74
+ *
75
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
76
+ */
77
+ putAssetAdministrationShellDescriptorById(options: {
78
+ configuration: Configuration;
79
+ aasIdentifier: string;
80
+ assetAdministrationShellDescriptor: AssetAdministrationShellDescriptor;
81
+ }): Promise<ApiResult<AssetAdministrationShellDescriptor | void, AasRegistryService.Result>>;
82
+ /**
83
+ * Returns all Submodel Descriptors
84
+ *
85
+ * @param options Object containing:
86
+ * - configuration: The http request options
87
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
88
+ * - limit?: The maximum number of elements in the response array
89
+ * - cursor?: A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
90
+ *
91
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
92
+ */
93
+ getAllSubmodelDescriptorsThroughSuperpath(options: {
94
+ configuration: Configuration;
95
+ aasIdentifier: string;
96
+ limit?: number;
97
+ cursor?: string;
98
+ }): Promise<ApiResult<{
99
+ pagedResult: AasRegistryService.PagedResultPagingMetadata | undefined;
100
+ result: SubmodelDescriptor[];
101
+ }, AasRegistryService.Result>>;
102
+ /**
103
+ * Creates a new Submodel Descriptor, i.e. registers a submodel
104
+ *
105
+ * @param options Object containing:
106
+ * - configuration: The http request options.
107
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
108
+ * - submodelDescriptor: Submodel Descriptor object
109
+ *
110
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
111
+ */
112
+ postSubmodelDescriptorThroughSuperpath(options: {
113
+ configuration: Configuration;
114
+ aasIdentifier: string;
115
+ submodelDescriptor: SubmodelDescriptor;
116
+ }): Promise<ApiResult<SubmodelDescriptor, AasRegistryService.Result>>;
117
+ /**
118
+ * Returns a specific Submodel Descriptor
119
+ *
120
+ * @param options Object containing:
121
+ * - configuration: The http request options
122
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
123
+ * - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
124
+ *
125
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
126
+ */
127
+ getSubmodelDescriptorByIdThroughSuperpath(options: {
128
+ configuration: Configuration;
129
+ aasIdentifier: string;
130
+ submodelIdentifier: string;
131
+ }): Promise<ApiResult<SubmodelDescriptor, AasRegistryService.Result>>;
132
+ /**
133
+ * Deletes a Submodel Descriptor, i.e. de-registers a submodel
134
+ *
135
+ * @param options Object containing:
136
+ * - configuration: The http request options
137
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
138
+ * - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
139
+ *
140
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
141
+ */
142
+ deleteSubmodelDescriptorByIdThroughSuperpath(options: {
143
+ configuration: Configuration;
144
+ aasIdentifier: string;
145
+ submodelIdentifier: string;
146
+ }): Promise<ApiResult<void, AasRegistryService.Result>>;
147
+ /**
148
+ * Creates or updates an existing Submodel Descriptor
149
+ *
150
+ * @param options Object containing:
151
+ * - configuration: The http request options
152
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
153
+ * - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
154
+ * - submodelDescriptor: Submodel Descriptor object
155
+ *
156
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
157
+ */
158
+ putSubmodelDescriptorByIdThroughSuperpath(options: {
159
+ configuration: Configuration;
160
+ aasIdentifier: string;
161
+ submodelIdentifier: string;
162
+ submodelDescriptor: SubmodelDescriptor;
163
+ }): Promise<ApiResult<SubmodelDescriptor | void, AasRegistryService.Result>>;
164
+ }
@@ -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
+ }