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,82 @@
1
+ import type { ApiResult } from '../models/api';
2
+ import { AasxFileService } from '../generated';
3
+ import { Configuration } from '../generated/runtime';
4
+ export declare class AasxFileClient {
5
+ /**
6
+ * Returns a list of available AASX packages at the server
7
+ *
8
+ * @param options Object containing:
9
+ * - configuration: The http request options
10
+ * - aasId?: The Asset Administration Shell’s unique id
11
+ *
12
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
13
+ */
14
+ getAllAASXPackageIds(options: {
15
+ configuration: Configuration;
16
+ aasId?: string;
17
+ }): Promise<ApiResult<{
18
+ result: AasxFileService.PackageDescription[];
19
+ }, AasxFileService.Result>>;
20
+ /**
21
+ * Stores the AASX package at the server
22
+ *
23
+ * @param options Object containing:
24
+ * - configuration: The http request options.
25
+ * - aasIds?: A list of Asset Administration Shells' unique ids
26
+ * - file: The file to upload
27
+ * - fileName: The name of the file
28
+ *
29
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
30
+ */
31
+ postAASXPackage(options: {
32
+ configuration: Configuration;
33
+ aasIds?: string[];
34
+ file: Blob;
35
+ fileName: string;
36
+ }): Promise<ApiResult<AasxFileService.PackageDescription, AasxFileService.Result>>;
37
+ /**
38
+ * Returns a specific AASX package from the server
39
+ *
40
+ * @param options Object containing:
41
+ * - configuration: The http request options
42
+ * - packageId: The package Id (UTF8-BASE64-URL-encoded)
43
+ *
44
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
45
+ */
46
+ getAASXByPackageId(options: {
47
+ configuration: Configuration;
48
+ packageId: string;
49
+ }): Promise<ApiResult<Blob, AasxFileService.Result>>;
50
+ /**
51
+ * Updates the AASX package at the server
52
+ *
53
+ * @param options Object containing:
54
+ * - configuration: The http request options
55
+ * - packageId: The package Id (UTF8-BASE64-URL-encoded)
56
+ * - aasIds?: A list of Asset Administration Shells' unique ids
57
+ * - file: The file to upload
58
+ * - fileName: The name of the file
59
+ *
60
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
61
+ */
62
+ putAASXByPackageId(options: {
63
+ configuration: Configuration;
64
+ packageId: string;
65
+ aasIds?: string[];
66
+ file: Blob;
67
+ fileName: string;
68
+ }): Promise<ApiResult<void, AasxFileService.Result>>;
69
+ /**
70
+ * Deletes a specific AASX package from the server
71
+ *
72
+ * @param options Object containing:
73
+ * - configuration: The http request options.
74
+ * - packageId: The package Id (UTF8-BASE64-URL-encoded)
75
+ *
76
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
77
+ */
78
+ deleteAASXByPackageId(options: {
79
+ configuration: Configuration;
80
+ packageId: string;
81
+ }): Promise<ApiResult<void, AasxFileService.Result>>;
82
+ }
@@ -0,0 +1,148 @@
1
+ import { AasxFileService } from '../generated';
2
+ import { applyDefaults } from '../lib/apiConfig';
3
+ import { base64Encode } from '../lib/base64Url';
4
+ import { handleApiError } from '../lib/errorHandler';
5
+ export class AasxFileClient {
6
+ /**
7
+ * Returns a list of available AASX packages at the server
8
+ *
9
+ * @param options Object containing:
10
+ * - configuration: The http request options
11
+ * - aasId?: The Asset Administration Shell’s unique id
12
+ *
13
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
14
+ */
15
+ async getAllAASXPackageIds(options) {
16
+ const { configuration, aasId } = options;
17
+ try {
18
+ const apiInstance = new AasxFileService.AASXFileServerAPIApi(applyDefaults(configuration));
19
+ //const encodedAasIdentifier = aasId ? base64Encode(aasId) : undefined;
20
+ const result = await apiInstance.getAllAASXPackageIds({
21
+ aasId: aasId,
22
+ });
23
+ console.log('received packages:', result);
24
+ return {
25
+ success: true,
26
+ data: { result },
27
+ };
28
+ }
29
+ catch (err) {
30
+ console.error('Failed to fetch AASX packagees:', err);
31
+ const customError = await handleApiError(err);
32
+ return { success: false, error: customError };
33
+ }
34
+ }
35
+ /**
36
+ * Stores the AASX package at the server
37
+ *
38
+ * @param options Object containing:
39
+ * - configuration: The http request options.
40
+ * - aasIds?: A list of Asset Administration Shells' unique ids
41
+ * - file: The file to upload
42
+ * - fileName: The name of the file
43
+ *
44
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
45
+ */
46
+ async postAASXPackage(options) {
47
+ const { configuration, aasIds, file, fileName } = options;
48
+ try {
49
+ const apiInstance = new AasxFileService.AASXFileServerAPIApi(applyDefaults(configuration));
50
+ //const encodedAasIdentifiers = aasIds?.map((id) => base64Encode(id));
51
+ //const encodedFileName = base64Encode(fileName);
52
+ const result = await apiInstance.postAASXPackage({
53
+ aasIds: aasIds,
54
+ file: file,
55
+ fileName: fileName,
56
+ });
57
+ console.log('created aasx package: ', result);
58
+ return { success: true, data: result };
59
+ }
60
+ catch (err) {
61
+ console.error('Failed to create AASX package:', err);
62
+ const customError = await handleApiError(err);
63
+ return { success: false, error: customError };
64
+ }
65
+ }
66
+ /**
67
+ * Returns a specific AASX package from the server
68
+ *
69
+ * @param options Object containing:
70
+ * - configuration: The http request options
71
+ * - packageId: The package Id (UTF8-BASE64-URL-encoded)
72
+ *
73
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
74
+ */
75
+ async getAASXByPackageId(options) {
76
+ const { configuration, packageId } = options;
77
+ try {
78
+ const apiInstance = new AasxFileService.AASXFileServerAPIApi(applyDefaults(configuration));
79
+ const encodedPackageId = base64Encode(packageId);
80
+ const result = await apiInstance.getAASXByPackageId({
81
+ packageId: encodedPackageId,
82
+ });
83
+ console.log('received aasx package by id: ', result);
84
+ return { success: true, data: result };
85
+ }
86
+ catch (err) {
87
+ console.error('Failed to fetch AASX package by id:', err);
88
+ const customError = await handleApiError(err);
89
+ return { success: false, error: customError };
90
+ }
91
+ }
92
+ /**
93
+ * Updates the AASX package at the server
94
+ *
95
+ * @param options Object containing:
96
+ * - configuration: The http request options
97
+ * - packageId: The package Id (UTF8-BASE64-URL-encoded)
98
+ * - aasIds?: A list of Asset Administration Shells' unique ids
99
+ * - file: The file to upload
100
+ * - fileName: The name of the file
101
+ *
102
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
103
+ */
104
+ async putAASXByPackageId(options) {
105
+ const { configuration, packageId, aasIds, file, fileName } = options;
106
+ try {
107
+ const apiInstance = new AasxFileService.AASXFileServerAPIApi(applyDefaults(configuration));
108
+ //const encodedAasIdentifiers = aasIds?.map((id) => base64Encode(id));
109
+ const encodedPackageId = base64Encode(packageId);
110
+ //const encodedFileName = base64Encode(fileName);
111
+ const result = await apiInstance.putAASXByPackageId({
112
+ packageId: encodedPackageId,
113
+ aasIds: aasIds,
114
+ file: file,
115
+ fileName: fileName,
116
+ });
117
+ return { success: true, data: result };
118
+ }
119
+ catch (err) {
120
+ const customError = await handleApiError(err);
121
+ return { success: false, error: customError };
122
+ }
123
+ }
124
+ /**
125
+ * Deletes a specific AASX package from the server
126
+ *
127
+ * @param options Object containing:
128
+ * - configuration: The http request options.
129
+ * - packageId: The package Id (UTF8-BASE64-URL-encoded)
130
+ *
131
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
132
+ */
133
+ async deleteAASXByPackageId(options) {
134
+ const { configuration, packageId } = options;
135
+ try {
136
+ const apiInstance = new AasxFileService.AASXFileServerAPIApi(applyDefaults(configuration));
137
+ const encodedPackageId = base64Encode(packageId);
138
+ const result = await apiInstance.deleteAASXByPackageId({
139
+ packageId: encodedPackageId,
140
+ });
141
+ return { success: true, data: result };
142
+ }
143
+ catch (err) {
144
+ const customError = await handleApiError(err);
145
+ return { success: false, error: customError };
146
+ }
147
+ }
148
+ }
@@ -0,0 +1,84 @@
1
+ import type { ConceptDescription } from '@aas-core-works/aas-core3.0-typescript/types';
2
+ import type { ApiResult } from '../models/api';
3
+ import { ConceptDescriptionRepositoryService } from '../generated';
4
+ import { Configuration } from '../generated/runtime';
5
+ export declare class ConceptDescriptionRepositoryClient {
6
+ /**
7
+ * Returns a specific Concept Description
8
+ *
9
+ * @param options Object containing:
10
+ * - configuration: The http request options
11
+ * - cdIdentifier: The Concept Description’s unique id
12
+ *
13
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
14
+ */
15
+ getConceptDescriptionById(options: {
16
+ configuration: Configuration;
17
+ cdIdentifier: string;
18
+ }): Promise<ApiResult<ConceptDescription, ConceptDescriptionRepositoryService.Result>>;
19
+ /**
20
+ * Deletes a Concept Description
21
+ *
22
+ * @param options Object containing:
23
+ * - configuration: The http request options
24
+ * - cdIdentifier: The Concept Description’s unique id
25
+ *
26
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
27
+ */
28
+ deleteConceptDescriptionById(options: {
29
+ configuration: Configuration;
30
+ cdIdentifier: string;
31
+ }): Promise<ApiResult<void, ConceptDescriptionRepositoryService.Result>>;
32
+ /**
33
+ * Updates an existing Concept Description
34
+ *
35
+ * @param options Object containing:
36
+ * - configuration: The http request options
37
+ * - cdIdentifier: The Concept Description’s unique id
38
+ * - conceptDescription: Concept Description object
39
+ *
40
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
41
+ */
42
+ putConceptDescriptionById(options: {
43
+ configuration: Configuration;
44
+ cdIdentifier: string;
45
+ conceptDescription: ConceptDescription;
46
+ }): Promise<ApiResult<ConceptDescription | void, ConceptDescriptionRepositoryService.Result>>;
47
+ /**
48
+ * Returns all Concept Descriptions
49
+ *
50
+ * @param options Object containing:
51
+ * - configuration: The http request options
52
+ * - idShort?: The Concept Description’s IdShort
53
+ * - isCaseOf?: IsCaseOf reference (UTF8-BASE64-URL-encoded)
54
+ * - dataSpecificationRef?: DataSpecification reference (UTF8-BASE64-URL-encoded)
55
+ * - limit?: The maximum number of elements in the response array
56
+ * - cursor?: A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
57
+ *
58
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
59
+ */
60
+ getAllConceptDescriptions(options: {
61
+ configuration: Configuration;
62
+ idShort?: string;
63
+ isCaseOf?: string;
64
+ dataSpecificationRef?: string;
65
+ limit?: number;
66
+ cursor?: string;
67
+ }): Promise<ApiResult<{
68
+ pagedResult: ConceptDescriptionRepositoryService.PagedResultPagingMetadata | undefined;
69
+ result: ConceptDescription[];
70
+ }, ConceptDescriptionRepositoryService.Result>>;
71
+ /**
72
+ * Creates a new Concept Description
73
+ *
74
+ * @param options Object containing:
75
+ * - configuration: The http request options.
76
+ * - conceptDescription: Concept Description object
77
+ *
78
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
79
+ */
80
+ postConceptDescription(options: {
81
+ configuration: Configuration;
82
+ conceptDescription: ConceptDescription;
83
+ }): Promise<ApiResult<ConceptDescription, ConceptDescriptionRepositoryService.Result>>;
84
+ }
@@ -0,0 +1,143 @@
1
+ import { ConceptDescriptionRepositoryService } from '../generated'; // Updated import
2
+ import { applyDefaults } from '../lib/apiConfig';
3
+ import { base64Encode } from '../lib/base64Url';
4
+ import { convertApiCDToCoreCD, convertCoreCDToApiCD } from '../lib/convertConceptDescriptionTypes';
5
+ import { handleApiError } from '../lib/errorHandler';
6
+ export class ConceptDescriptionRepositoryClient {
7
+ /**
8
+ * Returns a specific Concept Description
9
+ *
10
+ * @param options Object containing:
11
+ * - configuration: The http request options
12
+ * - cdIdentifier: The Concept Description’s unique id
13
+ *
14
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
15
+ */
16
+ async getConceptDescriptionById(options) {
17
+ const { configuration, cdIdentifier } = options;
18
+ try {
19
+ const apiInstance = new ConceptDescriptionRepositoryService.ConceptDescriptionRepositoryAPIApi(applyDefaults(configuration));
20
+ const encodedCdIdentifier = base64Encode(cdIdentifier);
21
+ const result = await apiInstance.getConceptDescriptionById({
22
+ cdIdentifier: encodedCdIdentifier,
23
+ });
24
+ return { success: true, data: convertApiCDToCoreCD(result) };
25
+ }
26
+ catch (err) {
27
+ const customError = await handleApiError(err);
28
+ return { success: false, error: customError };
29
+ }
30
+ }
31
+ /**
32
+ * Deletes a Concept Description
33
+ *
34
+ * @param options Object containing:
35
+ * - configuration: The http request options
36
+ * - cdIdentifier: The Concept Description’s unique id
37
+ *
38
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
39
+ */
40
+ async deleteConceptDescriptionById(options) {
41
+ const { configuration, cdIdentifier } = options;
42
+ try {
43
+ const apiInstance = new ConceptDescriptionRepositoryService.ConceptDescriptionRepositoryAPIApi(applyDefaults(configuration));
44
+ const encodedCdIdentifier = base64Encode(cdIdentifier);
45
+ const result = await apiInstance.deleteConceptDescriptionById({
46
+ cdIdentifier: encodedCdIdentifier,
47
+ });
48
+ return { success: true, data: result };
49
+ }
50
+ catch (err) {
51
+ const customError = await handleApiError(err);
52
+ return { success: false, error: customError };
53
+ }
54
+ }
55
+ /**
56
+ * Updates an existing Concept Description
57
+ *
58
+ * @param options Object containing:
59
+ * - configuration: The http request options
60
+ * - cdIdentifier: The Concept Description’s unique id
61
+ * - conceptDescription: Concept Description object
62
+ *
63
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
64
+ */
65
+ async putConceptDescriptionById(options) {
66
+ const { configuration, cdIdentifier, conceptDescription } = options;
67
+ try {
68
+ const apiInstance = new ConceptDescriptionRepositoryService.ConceptDescriptionRepositoryAPIApi(applyDefaults(configuration));
69
+ const encodedCdIdentifier = base64Encode(cdIdentifier);
70
+ const result = await apiInstance.putConceptDescriptionById({
71
+ cdIdentifier: encodedCdIdentifier,
72
+ conceptDescription: convertCoreCDToApiCD(conceptDescription),
73
+ });
74
+ return { success: true, data: result ? convertApiCDToCoreCD(result) : undefined };
75
+ }
76
+ catch (err) {
77
+ const customError = await handleApiError(err);
78
+ return { success: false, error: customError };
79
+ }
80
+ }
81
+ /**
82
+ * Returns all Concept Descriptions
83
+ *
84
+ * @param options Object containing:
85
+ * - configuration: The http request options
86
+ * - idShort?: The Concept Description’s IdShort
87
+ * - isCaseOf?: IsCaseOf reference (UTF8-BASE64-URL-encoded)
88
+ * - dataSpecificationRef?: DataSpecification reference (UTF8-BASE64-URL-encoded)
89
+ * - limit?: The maximum number of elements in the response array
90
+ * - cursor?: A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
91
+ *
92
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
93
+ */
94
+ async getAllConceptDescriptions(options) {
95
+ const { configuration, idShort, isCaseOf, dataSpecificationRef, limit, cursor } = options;
96
+ try {
97
+ const apiInstance = new ConceptDescriptionRepositoryService.ConceptDescriptionRepositoryAPIApi(applyDefaults(configuration));
98
+ const encodedIsCaseOf = isCaseOf ? base64Encode(JSON.stringify(isCaseOf)) : undefined;
99
+ const encodedDataSpecificationRef = dataSpecificationRef
100
+ ? base64Encode(JSON.stringify(dataSpecificationRef))
101
+ : undefined;
102
+ const result = await apiInstance.getAllConceptDescriptions({
103
+ idShort: idShort,
104
+ isCaseOf: encodedIsCaseOf,
105
+ dataSpecificationRef: encodedDataSpecificationRef,
106
+ limit: limit,
107
+ cursor: cursor,
108
+ });
109
+ const conceptDescriptions = (result.result ?? []).map(convertApiCDToCoreCD);
110
+ return {
111
+ success: true,
112
+ data: { pagedResult: result.pagingMetadata, result: conceptDescriptions },
113
+ };
114
+ }
115
+ catch (err) {
116
+ const customError = await handleApiError(err);
117
+ return { success: false, error: customError };
118
+ }
119
+ }
120
+ /**
121
+ * Creates a new Concept Description
122
+ *
123
+ * @param options Object containing:
124
+ * - configuration: The http request options.
125
+ * - conceptDescription: Concept Description object
126
+ *
127
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
128
+ */
129
+ async postConceptDescription(options) {
130
+ const { configuration, conceptDescription } = options;
131
+ try {
132
+ const apiInstance = new ConceptDescriptionRepositoryService.ConceptDescriptionRepositoryAPIApi(applyDefaults(configuration));
133
+ const result = await apiInstance.postConceptDescription({
134
+ conceptDescription: convertCoreCDToApiCD(conceptDescription),
135
+ });
136
+ return { success: true, data: convertApiCDToCoreCD(result) };
137
+ }
138
+ catch (err) {
139
+ const customError = await handleApiError(err);
140
+ return { success: false, error: customError };
141
+ }
142
+ }
143
+ }
@@ -0,0 +1,78 @@
1
+ import type { ApiResult } from '../models/api';
2
+ import { SubmodelRegistryService } from '../generated';
3
+ import { Configuration } from '../generated/runtime';
4
+ import { SubmodelDescriptor } from '../models/Descriptors';
5
+ export declare class SubmodelRegistryClient {
6
+ /**
7
+ * Returns all Submodel 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
+ *
14
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
15
+ */
16
+ getAllSubmodelDescriptors(options: {
17
+ configuration: Configuration;
18
+ limit?: number;
19
+ cursor?: string;
20
+ }): Promise<ApiResult<{
21
+ pagedResult: SubmodelRegistryService.PagedResultPagingMetadata | undefined;
22
+ result: SubmodelDescriptor[];
23
+ }, SubmodelRegistryService.Result>>;
24
+ /**
25
+ * Creates a new Submodel Descriptor, i.e. registers a Submodel
26
+ *
27
+ * @param options Object containing:
28
+ * - configuration: The http request options.
29
+ * - submodelDescriptor: Submodel Descriptor object
30
+ *
31
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
32
+ */
33
+ postSubmodelDescriptor(options: {
34
+ configuration: Configuration;
35
+ submodelDescriptor: SubmodelDescriptor;
36
+ }): Promise<ApiResult<SubmodelDescriptor, SubmodelRegistryService.Result>>;
37
+ /**
38
+ * Deletes a Submodel Descriptor, i.e. de-registers a Submodel
39
+ *
40
+ * @param options Object containing:
41
+ * - configuration: The http request options
42
+ * - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
43
+ *
44
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
45
+ */
46
+ deleteSubmodelDescriptorById(options: {
47
+ configuration: Configuration;
48
+ submodelIdentifier: string;
49
+ }): Promise<ApiResult<void, SubmodelRegistryService.Result>>;
50
+ /**
51
+ * Returns a specific Submodel Descriptor
52
+ *
53
+ * @param options Object containing:
54
+ * - configuration: The http request options
55
+ * - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
56
+ *
57
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
58
+ */
59
+ getSubmodelDescriptorById(options: {
60
+ configuration: Configuration;
61
+ submodelIdentifier: string;
62
+ }): Promise<ApiResult<SubmodelDescriptor, SubmodelRegistryService.Result>>;
63
+ /**
64
+ * Creates or updates an existing Submodel Descriptor
65
+ *
66
+ * @param options Object containing:
67
+ * - configuration: The http request options
68
+ * - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
69
+ * - submodelDescriptor: Submodel Descriptor object
70
+ *
71
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
72
+ */
73
+ putSubmodelDescriptorById(options: {
74
+ configuration: Configuration;
75
+ submodelIdentifier: string;
76
+ submodelDescriptor: SubmodelDescriptor;
77
+ }): Promise<ApiResult<SubmodelDescriptor | void, SubmodelRegistryService.Result>>;
78
+ }
@@ -0,0 +1,138 @@
1
+ import { SubmodelRegistryService } from '../generated';
2
+ import { applyDefaults } from '../lib/apiConfig';
3
+ import { base64Encode } from '../lib/base64Url';
4
+ import { convertApiSubmodelDescriptorToCoreSubmodelDescriptor, convertCoreSubmodelDescriptorToApiSubmodelDescriptor, } from '../lib/convertAasDescriptorTypes';
5
+ import { handleApiError } from '../lib/errorHandler';
6
+ export class SubmodelRegistryClient {
7
+ /**
8
+ * Returns all Submodel 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
+ *
15
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
16
+ */
17
+ async getAllSubmodelDescriptors(options) {
18
+ const { configuration, limit, cursor } = options;
19
+ try {
20
+ const apiInstance = new SubmodelRegistryService.SubmodelRegistryAPIApi(applyDefaults(configuration));
21
+ const result = await apiInstance.getAllSubmodelDescriptors({
22
+ limit: limit,
23
+ cursor: cursor,
24
+ });
25
+ const submodelDescriptors = (result.result ?? []).map(convertApiSubmodelDescriptorToCoreSubmodelDescriptor);
26
+ console.log('all submodel descriptors:', submodelDescriptors);
27
+ return {
28
+ success: true,
29
+ data: { pagedResult: result.pagingMetadata, result: submodelDescriptors },
30
+ };
31
+ }
32
+ catch (err) {
33
+ const customError = await handleApiError(err);
34
+ return { success: false, error: customError };
35
+ }
36
+ }
37
+ /**
38
+ * Creates a new Submodel Descriptor, i.e. registers a Submodel
39
+ *
40
+ * @param options Object containing:
41
+ * - configuration: The http request options.
42
+ * - submodelDescriptor: Submodel Descriptor object
43
+ *
44
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
45
+ */
46
+ async postSubmodelDescriptor(options) {
47
+ const { configuration, submodelDescriptor } = options;
48
+ try {
49
+ const apiInstance = new SubmodelRegistryService.SubmodelRegistryAPIApi(applyDefaults(configuration));
50
+ const result = await apiInstance.postSubmodelDescriptor({
51
+ submodelDescriptor: convertCoreSubmodelDescriptorToApiSubmodelDescriptor(submodelDescriptor),
52
+ });
53
+ console.log('created submodel descriptor:', result);
54
+ return { success: true, data: convertApiSubmodelDescriptorToCoreSubmodelDescriptor(result) };
55
+ }
56
+ catch (err) {
57
+ const customError = await handleApiError(err);
58
+ return { success: false, error: customError };
59
+ }
60
+ }
61
+ /**
62
+ * Deletes a Submodel Descriptor, i.e. de-registers a Submodel
63
+ *
64
+ * @param options Object containing:
65
+ * - configuration: The http request options
66
+ * - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
67
+ *
68
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
69
+ */
70
+ async deleteSubmodelDescriptorById(options) {
71
+ const { configuration, submodelIdentifier } = options;
72
+ try {
73
+ const apiInstance = new SubmodelRegistryService.SubmodelRegistryAPIApi(applyDefaults(configuration));
74
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
75
+ const result = await apiInstance.deleteSubmodelDescriptorById({
76
+ submodelIdentifier: encodedSubmodelIdentifier,
77
+ });
78
+ return { success: true, data: result };
79
+ }
80
+ catch (err) {
81
+ const customError = await handleApiError(err);
82
+ return { success: false, error: customError };
83
+ }
84
+ }
85
+ /**
86
+ * Returns a specific Submodel Descriptor
87
+ *
88
+ * @param options Object containing:
89
+ * - configuration: The http request options
90
+ * - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
91
+ *
92
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
93
+ */
94
+ async getSubmodelDescriptorById(options) {
95
+ const { configuration, submodelIdentifier } = options;
96
+ try {
97
+ const apiInstance = new SubmodelRegistryService.SubmodelRegistryAPIApi(applyDefaults(configuration));
98
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
99
+ const result = await apiInstance.getSubmodelDescriptorById({
100
+ submodelIdentifier: encodedSubmodelIdentifier,
101
+ });
102
+ return { success: true, data: convertApiSubmodelDescriptorToCoreSubmodelDescriptor(result) };
103
+ }
104
+ catch (err) {
105
+ const customError = await handleApiError(err);
106
+ return { success: false, error: customError };
107
+ }
108
+ }
109
+ /**
110
+ * Creates or updates an existing Submodel Descriptor
111
+ *
112
+ * @param options Object containing:
113
+ * - configuration: The http request options
114
+ * - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
115
+ * - submodelDescriptor: Submodel Descriptor object
116
+ *
117
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
118
+ */
119
+ async putSubmodelDescriptorById(options) {
120
+ const { configuration, submodelIdentifier, submodelDescriptor } = options;
121
+ try {
122
+ const apiInstance = new SubmodelRegistryService.SubmodelRegistryAPIApi(applyDefaults(configuration));
123
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
124
+ const result = await apiInstance.putSubmodelDescriptorById({
125
+ submodelIdentifier: encodedSubmodelIdentifier,
126
+ submodelDescriptor: convertCoreSubmodelDescriptorToApiSubmodelDescriptor(submodelDescriptor),
127
+ });
128
+ return {
129
+ success: true,
130
+ data: result ? convertApiSubmodelDescriptorToCoreSubmodelDescriptor(result) : undefined,
131
+ };
132
+ }
133
+ catch (err) {
134
+ const customError = await handleApiError(err);
135
+ return { success: false, error: customError };
136
+ }
137
+ }
138
+ }